@banou/stub 0.0.32 → 0.0.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1592 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./remote-VQoP8ehb.js","./remote-CVVOdyaq.js","./build-CQLpK1BK.js"])))=>i.map(i=>d[i]);
2
+ import{$ as e,F as t,G as n,H as r,I as i,J as a,K as o,M as s,P as c,Q as l,R as u,U as d,V as f,X as p,Y as m,Z as h,_ as g,at as _,ct as v,d as y,et as b,f as x,ft as S,g as C,h as w,i as T,it as E,j as D,l as O,m as k,nt as A,ot as j,p as ee,q as te,rt as M,tt as N,u as P,y as F}from"./uri-DvH8-88e.js";import{a as I,c as L,l as R,n as z,o as ne,s as re,t as ie}from"./fetch-Cr-sZisy.js";import{n as B}from"./remote-CVVOdyaq.js";_(),l();var ae=new Set([`ExtensionOperationUnsupportedError`,`FrameWindowRefusedError`]),oe=2,se=`unreadable`,ce=(e,t)=>{let n;return Promise.race([Promise.resolve().then(e).catch(()=>se),new Promise(e=>{n=setTimeout(()=>e(void 0),t)})]).finally(()=>clearTimeout(n))},le=async({url:e,domains:t,isSignedIn:n,onSignInPage:r,pollMs:i=1e3,readTimeoutMs:a=5e3})=>{let o=z({window:{url:e},domains:t}),s;try{s=await o}catch(e){let t=e?.name;if(t===`FrameWindowBlockedError`)return`blocked`;if(t&&ae.has(t))return console.warn(`[login-window] window mode was refused`,e),`unsupported`;if(L(e))return`closed`;throw e}let c=s.closed.then(()=>`closed`),l=!1,u=0;for(;;){let e=await Promise.race([c,new Promise(e=>setTimeout(e,i)).then(()=>Promise.all([ce(()=>n(s),a),r&&ce(()=>r(s),a)]))]);if(e===`closed`)return`closed`;let[t,o]=e;if(o===!0?(l=!0,u=0):(o===!1||o===se)&&l&&(u+=1),t===!0||u>=oe)return await s.close(),`authed`}},ue={};(function(e){var t=Object.prototype.hasOwnProperty,n=`~`;function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(e,t,r,a,o){if(typeof r!=`function`)throw TypeError(`The listener must be a function`);var s=new i(r,a||e,o),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function o(e,t){--e._eventsCount===0?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}s.prototype.eventNames=function(){var e=[],r,i;if(this._eventsCount===0)return e;for(i in r=this._events)t.call(r,i)&&e.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e},s.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,a=r.length,o=Array(a);i<a;i++)o[i]=r[i].fn;return o},s.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,i,a,o){var s=n?n+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,r),!0;case 4:return c.fn.call(c.context,t,r,i),!0;case 5:return c.fn.call(c.context,t,r,i,a),!0;case 6:return c.fn.call(c.context,t,r,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,r);break;case 4:c[d].fn.call(c[d].context,t,r,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},s.prototype.on=function(e,t,n){return a(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return a(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,r,i){var a=n?n+e:e;if(!this._events[a])return this;if(!t)return o(this,a),this;var s=this._events[a];if(s.fn)s.fn===t&&(!i||s.once)&&(!r||s.context===r)&&o(this,a);else{for(var c=0,l=[],u=s.length;c<u;c++)(s[c].fn!==t||i&&!s[c].once||r&&s[c].context!==r)&&l.push(s[c]);l.length?this._events[a]=l.length===1?l[0]:l:o(this,a)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s})({get exports(){return ue},set exports(e){ue=e}});var de=ue,fe=class extends Error{constructor(e){super(e),this.name=`TimeoutError`}},pe=class extends Error{constructor(e){super(),this.name=`AbortError`,this.message=e}},me=e=>globalThis.DOMException===void 0?new pe(e):new DOMException(e),he=e=>{let t=e.reason===void 0?me(`This operation was aborted.`):e.reason;return t instanceof Error?t:me(t)};function ge(e,t,n,r){let i,a=new Promise((a,o)=>{if(typeof t!=`number`||Math.sign(t)!==1)throw TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(t===1/0){a(e);return}if(r={customTimers:{setTimeout,clearTimeout},...r},r.signal){let{signal:e}=r;e.aborted&&o(he(e)),e.addEventListener(`abort`,()=>{o(he(e))})}i=r.customTimers.setTimeout.call(void 0,()=>{if(typeof n==`function`){try{a(n())}catch(e){o(e)}return}let r=typeof n==`string`?n:`Promise timed out after ${t} milliseconds`,i=n instanceof Error?n:new fe(r);typeof e.cancel==`function`&&e.cancel(),o(i)},t),(async()=>{try{a(await e)}catch(e){o(e)}finally{r.customTimers.clearTimeout.call(void 0,i)}})()});return a.clear=()=>{clearTimeout(i),i=void 0},a}function _e(e,t,n){let r=0,i=e.length;for(;i>0;){let a=Math.trunc(i/2),o=r+a;n(e[o],t)<=0?(r=++o,i-=a+1):i=a}return r}var ve=function(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)},ye,be=class{constructor(){ye.set(this,[])}enqueue(e,t){t={priority:0,...t};let n={priority:t.priority,run:e};if(this.size&&ve(this,ye,`f`)[this.size-1].priority>=t.priority){ve(this,ye,`f`).push(n);return}let r=_e(ve(this,ye,`f`),n,(e,t)=>t.priority-e.priority);ve(this,ye,`f`).splice(r,0,n)}dequeue(){return ve(this,ye,`f`).shift()?.run}filter(e){return ve(this,ye,`f`).filter(t=>t.priority===e.priority).map(e=>e.run)}get size(){return ve(this,ye,`f`).length}};ye=new WeakMap;var V=function(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n},H=function(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)},U,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,We,Ge,Ke=new fe,qe=class extends Error{},Je=class extends de{constructor(e){if(super(),U.add(this),xe.set(this,void 0),Se.set(this,void 0),Ce.set(this,0),we.set(this,void 0),Te.set(this,void 0),Ee.set(this,0),De.set(this,void 0),Oe.set(this,void 0),ke.set(this,void 0),Ae.set(this,void 0),je.set(this,0),Me.set(this,void 0),Ne.set(this,void 0),Pe.set(this,void 0),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e={carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:be,...e},!(typeof e.intervalCap==`number`&&e.intervalCap>=1))throw TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??``}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??``}\` (${typeof e.interval})`);V(this,xe,e.carryoverConcurrencyCount,`f`),V(this,Se,e.intervalCap===1/0||e.interval===0,`f`),V(this,we,e.intervalCap,`f`),V(this,Te,e.interval,`f`),V(this,ke,new e.queueClass,`f`),V(this,Ae,e.queueClass,`f`),this.concurrency=e.concurrency,this.timeout=e.timeout,V(this,Pe,e.throwOnTimeout===!0,`f`),V(this,Ne,e.autoStart===!1,`f`)}get concurrency(){return H(this,Me,`f`)}set concurrency(e){if(!(typeof e==`number`&&e>=1))throw TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);V(this,Me,e,`f`),H(this,U,`m`,We).call(this)}async add(e,t={}){return new Promise((n,r)=>{H(this,ke,`f`).enqueue(async()=>{var i,a;V(this,je,(i=H(this,je,`f`),i++,i),`f`),V(this,Ce,(a=H(this,Ce,`f`),a++,a),`f`);try{if(t.signal?.aborted){r(new qe(`The task was aborted.`));return}let i=await(this.timeout===void 0&&t.timeout===void 0?e({signal:t.signal}):ge(Promise.resolve(e({signal:t.signal})),t.timeout===void 0?this.timeout:t.timeout,()=>{(t.throwOnTimeout===void 0?H(this,Pe,`f`):t.throwOnTimeout)&&r(Ke)}));n(i),this.emit(`completed`,i)}catch(e){r(e),this.emit(`error`,e)}H(this,U,`m`,Le).call(this)},t),H(this,U,`m`,Ve).call(this),this.emit(`add`)})}async addAll(e,t){return Promise.all(e.map(async e=>this.add(e,t)))}start(){return H(this,Ne,`f`)?(V(this,Ne,!1,`f`),H(this,U,`m`,We).call(this),this):this}pause(){V(this,Ne,!0,`f`)}clear(){V(this,ke,new(H(this,Ae,`f`)),`f`)}async onEmpty(){H(this,ke,`f`).size!==0&&await H(this,U,`m`,Ge).call(this,`empty`)}async onSizeLessThan(e){H(this,ke,`f`).size<e||await H(this,U,`m`,Ge).call(this,`next`,()=>H(this,ke,`f`).size<e)}async onIdle(){(H(this,je,`f`)!==0||H(this,ke,`f`).size!==0)&&await H(this,U,`m`,Ge).call(this,`idle`)}get size(){return H(this,ke,`f`).size}sizeBy(e){return H(this,ke,`f`).filter(e).length}get pending(){return H(this,je,`f`)}get isPaused(){return H(this,Ne,`f`)}};xe=new WeakMap,Se=new WeakMap,Ce=new WeakMap,we=new WeakMap,Te=new WeakMap,Ee=new WeakMap,De=new WeakMap,Oe=new WeakMap,ke=new WeakMap,Ae=new WeakMap,je=new WeakMap,Me=new WeakMap,Ne=new WeakMap,Pe=new WeakMap,U=new WeakSet,Fe=function(){return H(this,Se,`f`)||H(this,Ce,`f`)<H(this,we,`f`)},Ie=function(){return H(this,je,`f`)<H(this,Me,`f`)},Le=function(){var e;V(this,je,(e=H(this,je,`f`),e--,e),`f`),H(this,U,`m`,Ve).call(this),this.emit(`next`)},Re=function(){this.emit(`empty`),H(this,je,`f`)===0&&this.emit(`idle`)},ze=function(){H(this,U,`m`,Ue).call(this),H(this,U,`m`,He).call(this),V(this,Oe,void 0,`f`)},Be=function(){let e=Date.now();if(H(this,De,`f`)===void 0){let t=H(this,Ee,`f`)-e;if(t<0)V(this,Ce,H(this,xe,`f`)?H(this,je,`f`):0,`f`);else return H(this,Oe,`f`)===void 0&&V(this,Oe,setTimeout(()=>{H(this,U,`m`,ze).call(this)},t),`f`),!0}return!1},Ve=function(){if(H(this,ke,`f`).size===0)return H(this,De,`f`)&&clearInterval(H(this,De,`f`)),V(this,De,void 0,`f`),H(this,U,`m`,Re).call(this),!1;if(!H(this,Ne,`f`)){let e=!H(this,U,`a`,Be);if(H(this,U,`a`,Fe)&&H(this,U,`a`,Ie)){let t=H(this,ke,`f`).dequeue();return t?(this.emit(`active`),t(),e&&H(this,U,`m`,He).call(this),!0):!1}}return!1},He=function(){H(this,Se,`f`)||H(this,De,`f`)!==void 0||(V(this,De,setInterval(()=>{H(this,U,`m`,Ue).call(this)},H(this,Te,`f`)),`f`),V(this,Ee,Date.now()+H(this,Te,`f`),`f`))},Ue=function(){H(this,Ce,`f`)===0&&H(this,je,`f`)===0&&H(this,De,`f`)&&(clearInterval(H(this,De,`f`)),V(this,De,void 0,`f`)),V(this,Ce,H(this,xe,`f`)?H(this,je,`f`):0,`f`),H(this,U,`m`,We).call(this)},We=function(){for(;H(this,U,`m`,Ve).call(this););},Ge=async function(e,t){return new Promise(n=>{let r=()=>{(!t||t())&&(this.off(e,r),n())};this.on(e,r)})};var Ye=Object.defineProperty,W=(e,t)=>{let n={};for(var r in e)Ye(n,r,{get:e[r],enumerable:!0});return t||Ye(n,Symbol.toStringTag,{value:`Module`}),n},Xe=`__OSRA_KEY__`,Ze=`__OSRA_DEFAULT_KEY__`,Qe=`__OSRA_BOX__`,$e=()=>globalThis.browser??globalThis.chrome,et=()=>$e()?.runtime,tt=(e,t)=>bt(e)&&e.__OSRA_KEY__===t,nt=(e,t)=>{if(e){if(e.aborted){t();return}e.addEventListener(`abort`,t,{once:!0})}},rt=({listener:e,transport:t,remoteName:n,key:r=Ze,origin:i=`*`,unregisterSignal:a})=>{if(a?.aborted)return;let o=Rt(t)?t.receive:t;if(typeof o==`function`){let t=o((t,i)=>{a?.aborted||tt(t,r)&&(n&&t.name!==n||e(t,i))});typeof t==`function`&&nt(a,t);return}if(wt(o)||Tt(o)||Dt(o)||Ot(o)){let t=(t,i)=>{let o=(t,a)=>{tt(t,r)&&(n&&t.name!==n||e(t,{port:i,sender:a}))};t.addListener(o),nt(a,()=>t.removeListener(o))};if(wt(o))t(o.onMessage);else if(Dt(o)){let e=e=>t(e.onMessage,e);o.addListener(e),nt(a,()=>o.removeListener(e))}else Ot(o)?t(o):t(o.onMessage);return}let s=vt(o)?o.port:o,c=i!==`*`&&kt(o),l=t=>{let a=t.data;if(typeof a==`string`)try{a=JSON.parse(a)}catch{return}tt(a,r)&&(n&&a.name!==n||c&&t.origin&&t.origin!==i||e(a,{receiveTransport:o,source:t.source,origin:t.origin}))};s.addEventListener(`message`,l),s instanceof MessagePort&&s.start(),nt(a,()=>s.removeEventListener(`message`,l))},it=new WeakSet,at=e=>String(e?.message??e).includes(`disconnected port`),ot=(e,t,n=`*`,r=[])=>{let i=Rt(e)?e.emit:e;if(typeof i==`function`)i(t,r);else if(kt(i))i.postMessage(t,n,r);else if(Tt(i)){if(it.has(i))return;try{i.postMessage(t)}catch(e){if(!at(e))throw e;it.add(i)}}else if(wt(i))i.sendMessage(t)?.catch?.(e=>{if(!String(e?.message).includes(`Receiving end does not exist`))throw e});else if(pt(i)){let e=JSON.stringify(t);i.readyState===WebSocket.CONNECTING?i.addEventListener(`open`,()=>i.send(e),{once:!0}):i.send(e)}else vt(i)?i.port.postMessage(t,r):i.postMessage(t,r)},st=globalThis.Float16Array,ct={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float16Array:st,Float32Array,Float64Array,BigInt64Array,BigUint64Array},lt=Object.values(ct),ut=e=>{let t=e.constructor.name;if(t in ct)return t;for(let[t,n]of Object.entries(ct))if(n&&e instanceof n)return t;throw Error(`Unknown typed array type`)},dt=e=>{let t=ct[e];if(!t)throw Error(`Unknown typed array type`);return t},ft=e=>xt(e,lt),pt=e=>e instanceof WebSocket,mt=e=>!!globalThis.ServiceWorkerContainer&&e instanceof ServiceWorkerContainer,ht=e=>!!globalThis.ServiceWorker&&e instanceof ServiceWorker,gt=e=>!!globalThis.Worker&&e instanceof Worker,_t=e=>{let t=globalThis.DedicatedWorkerGlobalScope;return!!t&&e instanceof t},vt=e=>!!globalThis.SharedWorker&&e instanceof SharedWorker,yt=e=>e instanceof MessagePort,bt=e=>!!e&&typeof e==`object`&&`__OSRA_KEY__`in e&&!!e.__OSRA_KEY__,xt=(e,t)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return!1;for(let n of t)if(n&&e instanceof n)return!0;return!1},St=e=>xt(e,[globalThis.SharedArrayBuffer]),Ct=e=>xt(e,[globalThis.ArrayBuffer,globalThis.MessagePort,globalThis.ReadableStream,globalThis.WritableStream,globalThis.TransformStream,globalThis.ImageBitmap,globalThis.OffscreenCanvas,globalThis.AudioData,globalThis.VideoFrame,globalThis.MediaSourceHandle,globalThis.MediaStreamTrack,globalThis.MIDIAccess,globalThis.RTCDataChannel,globalThis.WebTransportReceiveStream,globalThis.WebTransportSendStream]),wt=e=>{let t=et();return t?e===t:!1},Tt=(e,t=!1)=>!e||typeof e!=`object`||kt(e)||!(`name`in e)||!(`disconnect`in e)||!(`postMessage`in e)?!1:!t||`sender`in e&&`onMessage`in e&&`onDisconnect`in e,Et=e=>!!e&&typeof e==`object`&&!kt(e)&&`addListener`in e&&`hasListener`in e&&`removeListener`in e,Dt=e=>{let t=et();return t?e===t.onConnect||e===t.onConnectExternal:!1},Ot=e=>Et(e),kt=e=>{if(!e||typeof e!=`object`)return!1;try{return`window`in e&&e.window===e}catch{try{return`closed`in e&&typeof e.closed==`boolean`&&`close`in e&&typeof e.close==`function`}catch{return!1}}},At=e=>pt(e)||Tt(e)||wt(e),jt=e=>pt(e)||Tt(e)||Dt(e)||Ot(e)||wt(e),Mt=e=>!!e&&typeof e==`object`&&!kt(e)&&`isJson`in e&&e.isJson===!0||At(e)||jt(e),Nt=e=>kt(e)||At(e)||ht(e)||gt(e)||_t(e)||vt(e)||yt(e)||It(e),Pt=e=>kt(e)||jt(e)||mt(e)||gt(e)||_t(e)||vt(e)||yt(e)||Lt(e),Ft=e=>{if(!e||typeof e!=`object`||kt(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},It=e=>!Ft(e)||!(`emit`in e)?!1:Nt(e.emit)||typeof e.emit==`function`,Lt=e=>!Ft(e)||!(`receive`in e)?!1:Pt(e.receive)||typeof e.receive==`function`,Rt=e=>It(e)||Lt(e),zt=()=>globalThis.Buffer,Bt=32768,Vt=e=>{let t=e.toBase64;if(typeof t==`function`)return t.call(e);let n=zt();if(n)return n.from(e).toString(`base64`);let r=``;for(let t=0;t<e.length;t+=Bt)r+=String.fromCharCode(...e.subarray(t,t+Bt));return btoa(r)},Ht=e=>{let t=Uint8Array.fromBase64;if(typeof t==`function`)return t(e);let n=zt();if(n)return new Uint8Array(n.from(e,`base64`));let r=atob(e),i=new Uint8Array(r.length);for(let e=0;e<r.length;e++)i[e]=r.charCodeAt(e);return i},G={[Qe]:`revivable`},Ut=e=>!!e&&typeof e==`object`&&`__OSRA_BOX__`in e&&e.__OSRA_BOX__===`revivable`,Wt=(e,t)=>Mt(t.transport)?{base64Buffer:Vt(new Uint8Array(e))}:{arrayBuffer:e},Gt=e=>`arrayBuffer`in e?e.arrayBuffer:Ht(e.base64Buffer).buffer,Kt=W({box:()=>Yt,isType:()=>Jt,objectsOnly:()=>!0,revive:()=>Xt,type:()=>qt}),qt=`arrayBuffer`,Jt=e=>e instanceof ArrayBuffer,Yt=(e,t)=>({...G,type:qt,...Wt(e,t)}),Xt=(e,t)=>Gt(e),Zt=W({box:()=>en,isType:()=>$t,objectsOnly:()=>!0,revive:()=>tn,type:()=>Qt}),Qt=`date`,$t=e=>e instanceof Date,en=(e,t)=>({...G,type:Qt,ISOString:e.toISOString()}),tn=(e,t)=>new Date(e.ISOString),nn=W({box:()=>on,isType:()=>an,objectsOnly:()=>!0,revive:()=>sn,type:()=>rn}),rn=`headers`,an=e=>e instanceof Headers,on=(e,t)=>({...G,type:rn,entries:[...e.entries()]}),sn=(e,t)=>new Headers(e.entries),cn=W({box:()=>fn,isType:()=>dn,objectsOnly:()=>!0,revive:()=>pn,type:()=>ln}),ln=`error`,un={Error,TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError},dn=e=>e instanceof Error,fn=(e,t)=>{let n=`cause`in e&&e.cause!==void 0,r=typeof AggregateError<`u`&&e instanceof AggregateError,i=typeof DOMException<`u`&&e instanceof DOMException;return{...G,type:ln,name:e.name,message:e.message,stack:e.stack||e.toString(),...n?{cause:ja(e.cause,t)}:{},...r?{errors:ja(e.errors,t)}:{},...i?{isDOMException:!0}:{}}},pn=(e,t)=>{let n=e.cause===void 0?void 0:Na(e.cause,t),r=n===void 0?void 0:{cause:n};if(e.isDOMException&&typeof DOMException<`u`){let t=new DOMException(e.message,e.name);if(e.stack)try{Object.defineProperty(t,"stack",{value:e.stack,configurable:!0})}catch{}return t}let i;if(e.errors!==void 0&&typeof AggregateError<`u`)i=AggregateError(Na(e.errors,t),e.message,r);else{let t=un[e.name]??Error;i=r===void 0?new t(e.message):new t(e.message,r)}return e.name&&i.name!==e.name&&(i.name=e.name),e.stack&&(i.stack=e.stack),i},mn=W({box:()=>_n,isType:()=>gn,objectsOnly:()=>!0,revive:()=>vn,type:()=>hn}),hn=`typedArray`,gn=ft,_n=(e,t)=>{let n=e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return{...G,type:hn,typedArrayType:ut(e),...Wt(n,t)}},vn=(e,t)=>new(dt(e.typedArrayType))(Gt(e)),yn=new WeakMap,bn=new WeakSet,xn=(e,t)=>{if(bn.has(e))return t(),()=>{};let n=yn.get(e);return n||yn.set(e,n=new Set),n.add(t),()=>n.delete(t)},Sn=e=>bn.has(e),Cn=e=>{if(bn.has(e))return;bn.add(e);let t=yn.get(e);if(t){yn.delete(e);for(let e of t)try{e()}catch{}}},wn=W({box:()=>In,forceTransfer:()=>Nn,isInTransfer:()=>Mn,isType:()=>Fn,objectsOnly:()=>!0,outsideTransfer:()=>Pn,revive:()=>Ln,transfer:()=>An,type:()=>Tn}),Tn=`transfer`,En=Symbol.for(`osra.transfer`),Dn=e=>typeof e==`object`&&!!e,On=e=>Dn(e)&&En in e&&e[En]===!0,kn=e=>Dn(e)?ArrayBuffer.isView(e)?!0:xt(e,[globalThis.ArrayBuffer,globalThis.MessagePort,globalThis.ReadableStream,globalThis.WritableStream,globalThis.TransformStream,globalThis.Request,globalThis.Response,globalThis.ImageBitmap,globalThis.OffscreenCanvas,globalThis.VideoFrame,globalThis.AudioData]):!1,An=e=>kn(e)?{[En]:!0,value:e}:e,jn=0,Mn=()=>jn>0,Nn=e=>Dn(e)&&!On(e)?{[En]:!0,value:e}:e,Pn=e=>{let t=jn;jn=0;try{return e()}finally{jn=t}},Fn=e=>On(e),In=(e,t)=>{jn++;try{return{...G,type:Tn,inner:ja(e.value,t),degraded:Mt(t.transport)}}finally{jn--}},Ln=(e,t)=>Na(e.inner,t),Rn=e=>xt(e,[globalThis.MessagePort,globalThis.ReadableStream,globalThis.WritableStream,globalThis.TransformStream,globalThis.OffscreenCanvas,globalThis.MediaSourceHandle,globalThis.MediaStreamTrack,globalThis.MIDIAccess,globalThis.RTCDataChannel,globalThis.WebTransportReceiveStream,globalThis.WebTransportSendStream]),zn=e=>Ut(e)&&e.type===`transfer`,Bn=e=>{let t=[],n=new WeakSet,r=(e,i)=>{if(e&&typeof e==`object`&&!n.has(e)&&(n.add(e),!St(e))){if(zn(e)){r(e.inner,i||!e.degraded);return}if(Rn(e)){t.push(e);return}if(Ct(e)){i&&t.push(e);return}if(ArrayBuffer.isView(e)){i&&e instanceof DataView&&!St(e.buffer)&&!n.has(e.buffer)&&(n.add(e.buffer),t.push(e.buffer));return}if(Array.isArray(e)){for(let t of e)r(t,i);return}for(let t of Object.values(e))r(t,i)}};return r(e,!1),t},Vn=class{_listeners=new Map;addEventListener(e,t,n){if(!t)return;let r=this._listeners.get(e);r||(r=new Map,this._listeners.set(e,r)),r.has(t)||r.set(t,typeof n==`object`&&!!n?.once)}removeEventListener(e,t,n){t&&this._listeners.get(e)?.delete(t)}_peer;_queue=[];_started=!1;_closed=!1;_onClose;_onmessage=null;get onmessage(){return this._onmessage}set onmessage(e){this._onmessage=e,e!==null&&this.start()}onmessageerror=null;dispatchEvent(e){e.type===`message`?this._onmessage?.call(this,e):e.type===`messageerror`&&this.onmessageerror?.call(this,e);let t=this._listeners.get(e.type);if(t)for(let[n,r]of[...t])r&&t.delete(n),typeof n==`function`?n.call(this,e):n.handleEvent(e);return!0}postMessage(e,t){let n=this._peer;!n||n._closed||queueMicrotask(()=>{if(n._closed)return;let t=new MessageEvent(`message`,{data:e});n._started?n.dispatchEvent(t):n._queue.push(t)})}start(){if(!this._started){this._started=!0;for(let e of this._queue.splice(0))this.dispatchEvent(e)}}close(){if(this._closed)return;this._closed=!0,this._queue.length=0,this._onClose?.();let e=this._peer;e&&!e._closed&&queueMicrotask(()=>{e._closed||e.dispatchEvent(new Event(`close`))})}},Hn=class{port1;port2;constructor(){let e=new Vn,t=new Vn;e._peer=t,t._peer=e,this.port1=e,this.port2=t}},Un=new FinalizationRegistry(e=>{try{e()}catch{}}),Wn=(e,t)=>{let n={};return Un.register(e,t,n),()=>Un.unregister(n)},Gn=W({box:()=>pr,createRevivableChannel:()=>vr,init:()=>rr,isType:()=>ir,markPortsShipped:()=>gr,objectsOnly:()=>!0,postPreBoxed:()=>dr,revive:()=>mr,type:()=>Kn}),Kn=`messagePort`,qn=2048,Jn=128,Yn=1024,Xn=new WeakMap,Zn=e=>{let t=Xn.get(e);if(!t)throw Error(`osra message-port: connection state missing; did init() run?`);return t},Qn=(e,t)=>{let n=e.ports.get(t);return n||(n={nextSeq:0,buffer:new Map,outSeq:0},e.ports.set(t,n),e.pendingPorts++),n},$n=(e,t)=>{let n=e.ports.get(t);if(n&&!n.handler&&e.pendingPorts--,e.ports.delete(t),e.tombstones.size>=Jn){let t=e.tombstones.values().next().value;t!==void 0&&e.tombstones.delete(t)}e.tombstones.add(t)},er=e=>{if(e.handler)for(let t=e.buffer.get(e.nextSeq);t!==void 0;t=e.buffer.get(e.nextSeq))e.buffer.delete(e.nextSeq),e.nextSeq++,e.handler(t)},tr=(e,t)=>Qn(Zn(e),t).outSeq++,nr=(e,t,n)=>{let r=Zn(e);if(r.tombstones.has(t)){setTimeout(()=>n({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:t}));return}let i=Qn(r,t);i.handler||r.pendingPorts--,i.handler=n,er(i)},rr=e=>{let t={ports:new Map,tombstones:new Set,pendingPorts:0};Xn.set(e,t),e.eventTarget.addEventListener(`message`,({detail:n})=>{if(n.type!==`message`&&n.type!==`message-port-close`||t.tombstones.has(n.portId))return;let r=t.ports.get(n.portId);if(n.seq===void 0){r?.handler?.(n);return}if(!r){if(t.pendingPorts>=Yn)return;r=Qn(t,n.portId)}if(!(n.seq<r.nextSeq)){if(r.buffer.size>=qn&&!(n.seq===r.nextSeq&&r.handler)){r.buffer.clear(),$n(t,n.portId),r.handler?.({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:n.portId});return}r.buffer.set(n.seq,n),er(r)}}),xn(e,()=>{for(let[n,r]of[...t.ports])r.handler?.({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:n});t.ports.clear(),t.tombstones.clear(),t.pendingPorts=0})},ir=e=>e instanceof MessagePort||e instanceof Vn,ar=(e,t)=>{try{let n=Zn(e).ports.get(t);e.sendMessage({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:t,seq:n?n.outSeq++:0})}catch{}},or=(e,t,n)=>{if(n){e.postMessage(t);return}let r=Bn(t);e.postMessage(t,r),gr(r)},sr=(e,t,n,r)=>{let i;try{i=Na(e,t)}catch(e){r(),globalThis.reportError?.(e);return}n(i)},cr=(e,t,n)=>()=>{let r=e.deref();r&&ar(r,n);let i=t.deref();i&&$n(i,n)},lr=new WeakSet,ur=e=>e!==null&&(typeof e==`object`||typeof e==`function`),dr=(e,t,n)=>{ur(t)&&lr.add(t),e.postMessage(t,n??[])},fr=(e,t)=>ur(e)&&lr.delete(e)?e:Pn(()=>ja(e,t)),pr=(e,t,n)=>{let r=e instanceof Vn;if(!r&&!Mt(t.transport))return{...G,type:Kn,port:e,...n?.autoBox?{autoBox:!0}:{}};let i=Zn(t),a=e,o=globalThis.crypto.randomUUID(),s=new WeakRef(a),c=new WeakRef(t),l=new WeakRef(i),u=!1,d=()=>{if(u)return;u=!0;let e=l.deref();e&&$n(e,o),m?.();let t=s.deref();t?.removeEventListener(`message`,p),t instanceof Vn&&(t._onClose=void 0)},f=e=>{if(e.type===`message-port-close`){d(),a.dispatchEvent(new Event(`close`)),a.close();return}sr(e.data,t,e=>or(a,e,!1),()=>{})};function p({data:e}){t.sendMessage({type:`message`,remoteUuid:t.remoteUuid,data:fr(e,t),portId:o,seq:tr(t,o)})}let m=Wn(a,cr(c,l,o));return a.addEventListener(`message`,p),a.start(),a instanceof Vn&&(a._onClose=()=>{u||(ar(t,o),d())}),nr(t,o,f),{...G,type:Kn,portId:o,synthetic:r}},mr=(e,t)=>`port`in e?(gr([e.port]),e.autoBox?_r(e.port,t):e.port):yr(e.portId,t,e.synthetic),hr=new WeakMap,gr=e=>{for(let t of e){let e=hr.get(t);if(e){hr.delete(t),e.shipped=!0;for(let t of e.pending.splice(0))t()}}},_r=(e,t,n)=>{let r=new EventTarget,i=({data:e})=>{sr(e,t,e=>r.dispatchEvent(new MessageEvent(`message`,{data:e})),()=>r.dispatchEvent(new Event(`messageerror`)))},a=()=>{r.dispatchEvent(new Event(`messageerror`))},o=()=>{r.dispatchEvent(new Event(`close`))};e.addEventListener(`message`,i),e.addEventListener(`messageerror`,a),e.addEventListener(`close`,o),r.postMessage=(r,i)=>{let a=Pn(()=>ja(r,t)),o=Bn(a),s=Array.isArray(i)?i:[],c=s.length?[...o,...s]:o,l=()=>{e.postMessage(a,c),gr(c)};if(n&&!n.shipped){n.pending.push(l);return}l()},r.start=()=>e.start();let s=()=>{e.removeEventListener(`message`,i),e.removeEventListener(`messageerror`,a),e.removeEventListener(`close`,o),e.close()};return r.close=()=>{if(n&&!n.shipped){n.pending.push(s);return}s()},r},vr=e=>{if(Mt(e.transport)){let{port1:t,port2:n}=new Hn;return{localPort:t,boxedRemote:pr(n,e)}}let{port1:t,port2:n}=new MessageChannel,r={shipped:!1,pending:[]};return hr.set(n,r),{localPort:_r(t,e,r),boxedRemote:pr(n,e,{autoBox:!0})}},yr=(e,t,n)=>{let r=Zn(t),{port1:i,port2:a}=n?new Hn:new MessageChannel,o=new WeakRef(i),s=new WeakRef(a),c=!1,l=!1;i instanceof Vn||i.addEventListener(`close`,e=>{l&&e.stopImmediatePropagation()});let u=()=>{if(c)return;c=!0,$n(r,e);let t=s.deref();t?.removeEventListener(`message`,f),t?.close(),p?.()},d=e=>{if(e.type===`message-port-close`){u();let e=o.deref();e?.dispatchEvent(new Event(`close`)),l=!0,e?.close();return}if(!o.deref()){u();return}let r=s.deref();r&&sr(e.data,t,e=>or(r,e,n),()=>o.deref()?.dispatchEvent(new Event(`messageerror`)))},f=({data:n})=>{t.sendMessage({type:`message`,remoteUuid:t.remoteUuid,data:fr(n,t),portId:e,seq:tr(t,e)})},p=Wn(i,()=>{ar(t,e),u()});return i instanceof Vn&&(i._onClose=()=>{c||(ar(t,e),u())}),a.addEventListener(`message`,f),a.start(),nr(t,e,d),i},br=W({box:()=>Tr,isType:()=>wr,objectsOnly:()=>!0,revive:()=>Er,type:()=>xr}),xr=`promise`,Sr=e=>e instanceof Promise,Cr=new Set,wr=e=>e instanceof Promise,Tr=(e,t)=>{if(!Sr(e))throw TypeError(`Expected Promise`);let{localPort:n,boxedRemote:r}=vr(t),i=e=>{n.postMessage(e),n.close()};return e.then(e=>i({type:`resolve`,data:e})).catch(e=>i({type:`reject`,error:e})),{...G,type:xr,port:r}},Er=(e,t)=>{let n=mr(e.port,t);Cr.add(n);let r=`portId`in e.port;return new Promise((e,i)=>{let a,o=()=>{n.close(),Cr.delete(n),a?.()};if(r&&Sn(t)){i(Error(`osra: connection closed`)),o();return}a=r?xn(t,()=>{i(Error(`osra: connection closed`)),o()}):void 0,n.addEventListener(`message`,({data:t})=>{t.type===`resolve`?e(t.data):i(t.error),o()},{once:!0}),n.start()})},Dr=W({box:()=>Mr,isType:()=>jr,objectsOnly:()=>!0,revive:()=>Nr,type:()=>Or}),Or=`function`,kr=new Set,Ar=e=>{e instanceof ReadableStream?e.locked||e.cancel(Error(`osra: connection closed`)).catch(()=>{}):typeof WritableStream<`u`&&e instanceof WritableStream&&(e.locked||e.abort(Error(`osra: connection closed`)).catch(()=>{}))},jr=e=>typeof e==`function`,Mr=(e,t)=>{let{port1:n,port2:r}=new Hn;return n.addEventListener(`message`,({data:n})=>{let[r,i]=n;(async()=>{let n;try{n={type:`return`,value:await e(...i)}}catch(e){n={type:`throw`,error:e}}if(Sn(t)){n.type===`return`&&Ar(n.value);try{r.close()}catch{}return}let a=(()=>{try{return ja(n,t)}catch(e){return ja({type:`throw`,error:e},t)}})();dr(r,a),queueMicrotask(()=>{try{r.close()}catch{}})})()}),n.start(),{...G,type:Or,port:pr(r,t)}},Nr=(e,t)=>{let n=mr(e.port,t);return((...e)=>new Promise((r,i)=>{if(Sn(t)){i(Error(`osra: connection closed`));return}let{port1:a,port2:o}=new Hn;kr.add(a);let s,c=()=>{a.close(),kr.delete(a),s?.()};s=xn(t,()=>{i(Error(`osra: connection closed`)),c()}),a.addEventListener(`message`,({data:e})=>{let t=e;t.type===`return`?r(t.value):i(t.error),c()},{once:!0}),a.start();let l=Pn(()=>ja([o,e],t));dr(n,l)}))},Pr=W({MAX_CREDIT_WINDOW:()=>64,box:()=>Br,isType:()=>Ir,objectsOnly:()=>!0,revive:()=>Wr,type:()=>Fr}),Fr=`readableStream`,Ir=e=>e instanceof ReadableStream,Lr=2,Rr=8,zr=4194304,Br=(e,t)=>{let{localPort:n,boxedRemote:r}=vr(t),i=e.getReader(),a=Mn(),o=0,s=!1,c=!1,l=e=>{c=!0;try{n.postMessage(e)}catch{}n.close()},u=async()=>{if(!(s||c)){for(s=!0;o>0;){let e;try{e=await i.read()}catch(e){c||l({type:`error`,error:e});return}if(c)return;if(e.done){l({type:`end`});return}o--;let t=a?Nn(e.value):e.value;try{n.postMessage({type:`chunk`,value:t})}catch(e){l({type:`error`,error:e}),i.cancel(e).catch(()=>{});return}}s=!1}};return n.addEventListener(`message`,({data:e})=>{e instanceof Promise||!(`type`in e)||(e.type===`pull`?n.postMessage(i.read()):e.type===`credit`?(o+=e.n,u()):e.type===`cancel`&&(c=!0,i.cancel(e.reason).catch(()=>{}),n.close()))}),n.addEventListener(`close`,()=>{c||(c=!0,i.cancel(Error(`osra: connection closed`)).catch(()=>{}))},{once:!0}),n.start(),{...G,type:Fr,credit:!0,port:r}},Vr=e=>ArrayBuffer.isView(e)||e instanceof ArrayBuffer?e.byteLength:typeof e==`string`?e.length*2:typeof Blob<`u`&&e instanceof Blob?e.size:void 0,Hr=e=>{let t=!1,n=0,r,i=[],a=!1,o=!1,s,c,l=()=>r===void 0?Rr:Math.max(Lr,Math.min(64,Math.floor(zr/r))),u=()=>{let t=l(),r=n+i.length;if(r>t/2)return;let a=t-r;n+=a,e.postMessage({type:`credit`,n:a})},d=()=>{t=!0,queueMicrotask(()=>e.close())},f=e=>{if(o=!0,s=e,!c||i.length)return;let t=c;c=void 0,d(),t.reject(e)};return new ReadableStream({start:()=>{e.addEventListener(`message`,({data:o})=>{if(!(o instanceof Promise||!(`type`in o))){if(o.type===`chunk`){if(t)return;if(n<=0){i.length=0,f(Error(`osra: stream exceeded its credit window`)),queueMicrotask(()=>e.close());return}n--;let a=Vr(o.value);if(a!==void 0&&(r=r===void 0?a:r*.875+a*.125),c){let e=c;c=void 0,e.controller.enqueue(o.value),e.resolve()}else i.push(o.value)}else if(o.type===`end`){if(t||(a=!0,!c||i.length))return;let e=c;c=void 0,d(),e.controller.close(),e.resolve()}else if(o.type===`error`){if(t)return;f(o.error)}}}),e.addEventListener(`messageerror`,()=>{t||f(Error(`osra: a chunk failed to deserialize on this platform`))}),e.addEventListener(`close`,()=>{t||a||o||f(Error(`osra: connection closed`))},{once:!0})},pull:e=>{if(!t){if(i.length){e.enqueue(i.shift()),!a&&!o&&u();return}if(o)return d(),Promise.reject(s);if(a){d(),e.close();return}return u(),new Promise((t,n)=>{c={controller:e,resolve:t,reject:n}})}},cancel:n=>{t=!0,i.length=0;let r=c;c=void 0,r?.resolve(),e.postMessage({type:`cancel`,reason:n}),queueMicrotask(()=>e.close())}})},Ur=e=>{let t=!1;return new ReadableStream({start:n=>{e.addEventListener(`messageerror`,()=>{if(!t){t=!0;try{n.error(Error(`osra: a chunk failed to deserialize on this platform`))}catch{}queueMicrotask(()=>e.close())}}),e.addEventListener(`close`,()=>{if(!t){t=!0;try{n.error(Error(`osra: connection closed`))}catch{}}},{once:!0})},pull:n=>new Promise((r,i)=>{e.addEventListener(`message`,({data:a})=>{a instanceof Promise&&a.then(i=>{i.done?(t=!0,n.close(),e.postMessage({type:`cancel`}),queueMicrotask(()=>e.close())):n.enqueue(i.value),r()}).catch(e=>{t=!0,i(e)})},{once:!0}),e.postMessage({type:`pull`})}),cancel:n=>{t=!0,e.postMessage({type:`cancel`,reason:n}),queueMicrotask(()=>e.close())}})},Wr=(e,t)=>{let n=mr(e.port,t);return n.start(),e.credit?Hr(n):Ur(n)},Gr=W({box:()=>Jr,isType:()=>qr,objectsOnly:()=>!0,revive:()=>Yr,type:()=>Kr}),Kr=`writableStream`,qr=e=>e instanceof WritableStream,Jr=(e,t)=>{let{localPort:n,boxedRemote:r}=vr(t),i=e.getWriter(),a=!1,o=(e,t)=>e.then(()=>n.postMessage({type:`ack`})).catch(e=>n.postMessage({type:`err`,error:e?.message??String(e)})).then(()=>{t&&(a=!0,queueMicrotask(()=>n.close()))});return n.addEventListener(`message`,({data:e})=>{!e||typeof e!=`object`||!(`type`in e)||(e.type===`write`?o(i.write(e.chunk),!1):e.type===`close`?o(i.close(),!0):e.type===`abort`&&o(i.abort(e.reason),!0))}),n.addEventListener(`messageerror`,()=>{n.postMessage({type:`err`,error:`osra: a chunk failed to deserialize on this platform`})}),n.addEventListener(`close`,()=>{a||(a=!0,i.abort(Error(`osra: connection closed`)).catch(()=>{}))},{once:!0}),n.start(),{...G,type:Kr,port:r,...Mn()?{transferChunks:!0}:{}}},Yr=(e,t)=>{let n=mr(e.port,t);n.start();let r=new Set,i=!1;n.addEventListener(`close`,()=>{i=!0;let e=Error(`osra: connection closed`);for(let t of[...r])t(e);r.clear()},{once:!0});let a=Promise.resolve(),o=e=>{let t=a.then(()=>new Promise((t,a)=>{if(i){a(Error(`osra: connection closed`));return}let o=e=>{r.delete(a),e()};r.add(a),n.addEventListener(`message`,({data:e})=>{!e||typeof e!=`object`||!(`type`in e)||(e.type===`ack`?o(t):e.type===`err`&&o(()=>a(Error(e.error))))},{once:!0}),n.postMessage(e)}));return a=t.catch(()=>{}),t},s=e.transferChunks===!0;return new WritableStream({write:e=>o({type:`write`,chunk:s?Nn(e):e}),close:()=>o({type:`close`}),abort:e=>o({type:`abort`,reason:e})})},Xr=W({box:()=>ei,isType:()=>Qr,objectsOnly:()=>!0,revive:()=>ti,type:()=>Zr}),Zr=`abortSignal`,Qr=e=>e instanceof AbortSignal,$r=new WeakMap,ei=(e,t)=>{if(e.aborted)return{...G,type:Zr,aborted:!0,reason:ja(e.reason,t)};let{localPort:n,boxedRemote:r}=vr(t),i=()=>{n.postMessage({type:`abort`,reason:e.reason}),n.close(),a()},a=xn(t,()=>{e.removeEventListener(`abort`,i),n.close()});return e.addEventListener(`abort`,i,{once:!0}),{...G,type:Zr,aborted:!1,reason:void 0,port:r}},ti=(e,t)=>{let n=new AbortController;if(e.aborted||e.port===void 0)return n.abort(Na(e.reason,t)),n.signal;let r=mr(e.port,t);return $r.set(n.signal,r),r.start(),r.addEventListener(`message`,({data:e})=>{e.type===`abort`&&(n.abort(Na(e.reason,t)),$r.delete(n.signal),r.close())}),n.signal},ni=W({box:()=>ai,isType:()=>ii,objectsOnly:()=>!0,revive:()=>oi,type:()=>ri}),ri=`response`,ii=e=>e instanceof Response,ai=(e,t)=>({...G,type:ri,status:e.status,statusText:e.statusText,headers:on(e.headers,t),body:e.body?Br(e.body,t):null,url:e.url,redirected:e.redirected}),oi=(e,t)=>{if(e.status===0)return Response.error();let n=sn(e.headers,t),r=e.body?Wr(e.body,t):null,i=e.status===101||e.status===204||e.status===205||e.status===304;r&&i&&r.cancel().catch(()=>{});let a=new Response(i?null:r,{status:e.status,statusText:e.statusText,headers:n});return e.url&&Object.defineProperty(a,"url",{value:e.url,configurable:!0}),e.redirected&&Object.defineProperty(a,"redirected",{value:!0,configurable:!0}),a},si=W({box:()=>ui,isType:()=>li,objectsOnly:()=>!0,revive:()=>di,type:()=>ci}),ci=`request`,li=e=>e instanceof Request,ui=(e,t)=>({...G,type:ci,method:e.method,url:e.url,headers:on(e.headers,t),body:e.body?Br(e.body,t):null,credentials:e.credentials,cache:e.cache,mode:e.mode,redirect:e.redirect,referrer:e.referrer,referrerPolicy:e.referrerPolicy,integrity:e.integrity,keepalive:e.keepalive,signal:ei(e.signal,t)}),di=(e,t)=>{let n=sn(e.headers,t),r={method:e.method,headers:n,credentials:e.credentials,cache:e.cache,redirect:e.redirect,referrer:e.referrer,referrerPolicy:e.referrerPolicy,integrity:e.integrity,keepalive:e.keepalive,signal:ti(e.signal,t)};return e.mode!==`navigate`&&(r.mode=e.mode),e.body&&(r.body=Wr(e.body,t),r.duplex=`half`),new Request(e.url,r)},fi=W({box:()=>wi,boxByReference:()=>Ti,identity:()=>vi,isType:()=>xi,objectsOnly:()=>!0,revive:()=>Ei,type:()=>pi}),pi=`identity`,mi=e=>e!==null&&(typeof e==`object`||typeof e==`function`),hi=e=>{if(e===null)return!1;let t=typeof e;return t===`object`||t===`function`||t===`symbol`&&Symbol.keyFor(e)===void 0},gi=new WeakMap,_i=e=>{let t=gi.get(e);if(t!==void 0)return t;let n=globalThis.crypto.randomUUID();return gi.set(e,n),n},vi=e=>(mi(e)&&_i(e),e),yi=new WeakMap,bi=e=>{let t=yi.get(e);if(t)return t;let n=new Map,r={idToLocal:n,pins:new Map,aliasIds:new WeakMap,disposeRegistry:new FinalizationRegistry(t=>{if(n.delete(t),!Sn(e))try{e.sendMessage({type:`identity-dispose`,remoteUuid:e.remoteUuid,id:t})}catch{}})};return yi.set(e,r),e.eventTarget.addEventListener(`message`,({detail:e})=>{e?.type===`identity-dispose`&&(r.pins.delete(e.id),r.idToLocal.delete(e.id))}),xn(e,()=>{r.pins.clear(),r.idToLocal.clear()}),r},xi=e=>mi(e)&&gi.has(e),Si=(e,t)=>{let n=t.aliasIds.get(e);if(n!==void 0)return n;let r=_i(e),i=t.idToLocal.get(r);if(i===void 0||i.deref()===e)return r;let a=globalThis.crypto.randomUUID();return t.aliasIds.set(e,a),a},Ci=(e,t,n)=>{let r=Si(e,n);if(n.idToLocal.has(r))return{...G,type:pi,id:r};let i=t();return n.idToLocal.set(r,new WeakRef(e)),n.disposeRegistry.register(e,r,e),Ta(()=>{},()=>{n.idToLocal.delete(r),n.disposeRegistry.unregister(e)}),{...G,type:pi,id:r,inner:i}},wi=(e,t)=>{let n=bi(t),r=()=>Ma(e,t,pi);return hi(e)?Ci(e,r,n):{...G,type:pi,id:globalThis.crypto.randomUUID(),inner:r()}},Ti=(e,t,n)=>Ci(e,()=>t,bi(n)),Ei=(e,t)=>{let n=bi(t);if(n.pins.has(e.id))return n.pins.get(e.id);let r=n.idToLocal.get(e.id)?.deref();if(r!==void 0)return r;if(!(`inner`in e)||e.inner===void 0){try{t.sendMessage({type:`identity-dispose`,remoteUuid:t.remoteUuid,id:e.id})}catch{}throw Error(`osra identity: received id=${e.id} with no inner payload and nothing local to resolve it to`)}let i=Na(e.inner,t);return n.pins.set(e.id,i),hi(i)&&(gi.has(i)||gi.set(i,e.id),n.idToLocal.set(e.id,new WeakRef(i))),i},Di=W({box:()=>ki,isType:()=>Oi,objectsOnly:()=>!0,revive:()=>Ai,type:()=>`map`}),Oi=e=>e instanceof Map,ki=(e,t)=>({...G,type:`map`,entries:Array.from(e,([e,n])=>[ja(e,t),ja(n,t)])}),Ai=(e,t)=>new Map(e.entries.map(([e,n])=>[Na(e,t),Na(n,t)])),ji=W({box:()=>Ni,isType:()=>Mi,objectsOnly:()=>!0,revive:()=>Pi,type:()=>`set`}),Mi=e=>e instanceof Set,Ni=(e,t)=>({...G,type:`set`,values:Array.from(e,e=>ja(e,t))}),Pi=(e,t)=>new Set(e.values.map(e=>Na(e,t))),Fi=W({box:()=>Ri,isType:()=>Li,revive:()=>zi,type:()=>Ii}),Ii=`bigint`,Li=e=>typeof e==`bigint`,Ri=(e,t)=>({...G,type:Ii,value:e.toString()}),zi=(e,t)=>BigInt(e.value),Bi=W({box:()=>Ui,isType:()=>Hi,objectsOnly:()=>!0,revive:()=>Wi,type:()=>Vi}),Vi=`event`,Hi=e=>e instanceof Event,Ui=(e,t)=>({...G,type:Vi,eventType:e.type,bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed,...e instanceof CustomEvent?{detail:ja(e.detail,t)}:{}}),Wi=(e,t)=>{let n={bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed};return`detail`in e?new CustomEvent(e.eventType,{...n,detail:Na(e.detail,t)}):new Event(e.eventType,n)},Gi=W({box:()=>Ji,isType:()=>qi,objectsOnly:()=>!0,revive:()=>Qi,type:()=>Ki}),Ki=`eventTarget`,qi=e=>e instanceof EventTarget,Ji=(e,t)=>{let n=[],r=e=>typeof e==`boolean`?e:!!e?.capture;return{...G,type:Ki,addListener:Mr((t,i,a)=>{n.push({eventType:t,listener:i,capture:r(a)}),e.addEventListener(t,i,a)},t),removeListener:Mr((t,i,a)=>{let o=r(a),s=n.findIndex(e=>e.eventType===t&&e.listener===i&&e.capture===o);s!==-1&&n.splice(s,1),e.removeEventListener(t,i,a)},t),removeAllListeners:Mr(()=>{for(let{eventType:t,listener:r,capture:i}of n.splice(0))e.removeEventListener(t,r,{capture:i})},t)}},Yi=new WeakMap,Xi=e=>{if(typeof e==`function`)return e;let t=Yi.get(e);return t||Yi.set(e,t=t=>e.handleEvent(t)),t},Zi=(e,t,n,r)=>e.find(e=>e.eventType===t&&e.listener===n&&e.capture===r),Qi=(e,t)=>{let n=Nr(e.addListener,t),r=Nr(e.removeListener,t),i=Nr(e.removeAllListeners,t),a=new EventTarget,o=[],s=e=>{let t=o.indexOf(e);t!==-1&&o.splice(t,1)};return Object.defineProperty(a,"addEventListener",{value:(e,t,r)=>{if(t===null)return;let i=Xi(t),a=typeof r==`boolean`?r:!!r?.capture;if(Zi(o,e,i,a))return;let c=typeof r==`object`&&r?.once?e=>(s(l),i(e)):i,l={eventType:e,listener:i,capture:a,wire:c};o.push(l),(typeof r==`object`?r?.signal:void 0)?.addEventListener(`abort`,()=>s(l),{once:!0}),n(e,vi(c),r).catch(()=>{})}}),Object.defineProperty(a,"removeEventListener",{value:(e,t,n)=>{if(t===null)return;let i=Xi(t),a=typeof n==`boolean`?n:!!n?.capture,c=Zi(o,e,i,a);c&&(s(c),r(e,vi(c.wire),{capture:a}).catch(()=>{}))}}),Wn(a,()=>{i().catch(()=>{})}),a},$i=W({box:()=>na,isType:()=>ta,revive:()=>ra,type:()=>ea}),ea=`symbol`,ta=e=>typeof e==`symbol`,na=(e,t)=>{let n=Symbol.keyFor(e);return n===void 0?Ti(e,{...G,type:ea,description:e.description},t):{...G,type:ea,registryKey:n}},ra=(e,t)=>`registryKey`in e?Symbol.for(e.registryKey):Symbol(e.description),ia=W({box:()=>sa,isType:()=>oa,objectsOnly:()=>!0,revive:()=>ca,type:()=>aa}),aa=`asyncIterator`,oa=e=>!e||typeof e!=`object`||typeof ReadableStream<`u`&&e instanceof ReadableStream?!1:typeof e[Symbol.asyncIterator]==`function`,sa=(e,t)=>{let n=e[Symbol.asyncIterator]();return{...G,type:aa,next:Mr((e=>n.next(e)),t),return:Mr((e=>n.return?.(e)??Promise.resolve({done:!0,value:e})),t),throw:Mr((e=>n.throw?.(e)??Promise.reject(e)),t)}},ca=(e,t)=>{let n=Nr(e.next,t),r=Nr(e.return,t),i=Nr(e.throw,t),a={next:(...e)=>n(...e),return:e=>r(e),throw:e=>i(e),[Symbol.asyncIterator]:()=>a};return a},la=[globalThis.File,globalThis.FileList,globalThis.RegExp,globalThis.DataView,globalThis.ImageData,globalThis.FormData,globalThis.DOMException,globalThis.DOMMatrix,globalThis.DOMMatrixReadOnly,globalThis.DOMPoint,globalThis.DOMPointReadOnly,globalThis.DOMQuad,globalThis.DOMRect,globalThis.DOMRectReadOnly,globalThis.CryptoKey,globalThis.FileSystemHandle,globalThis.FileSystemFileHandle,globalThis.FileSystemDirectoryHandle,globalThis.RTCCertificate],ua=[globalThis.CropTarget,globalThis.EncodedAudioChunk,globalThis.EncodedVideoChunk,globalThis.FencedFrameConfig,globalThis.GPUCompilationInfo,globalThis.GPUCompilationMessage,globalThis.GPUPipelineError,globalThis.RTCEncodedAudioFrame,globalThis.RTCEncodedVideoFrame,globalThis.WebTransportError],da={type:`clonable`,capableOnly:!0,objectsOnly:!0,isType:e=>xt(e,la)||xt(e,ua),box:(e,t)=>e,revive:(e,t)=>e},fa=[globalThis.ImageBitmap,globalThis.OffscreenCanvas,globalThis.WritableStream,globalThis.TransformStream,globalThis.MediaStreamTrack,globalThis.RTCDataChannel],pa=[globalThis.AudioData,globalThis.VideoFrame,globalThis.MediaSourceHandle,globalThis.MIDIAccess,globalThis.WebTransportReceiveStream,globalThis.WebTransportSendStream],ma={type:`transferable`,capableOnly:!0,objectsOnly:!0,isType:e=>xt(e,fa)||xt(e,pa),box:(e,t)=>e,revive:(e,t)=>e},ha={type:`blob`,capableOnly:!0,objectsOnly:!0,isType:e=>typeof Blob<`u`&&e instanceof Blob,box:(e,t)=>{if(Mt(t.transport))throw TypeError(`osra: Blob is only supported on structured-clone transports, send an ArrayBuffer or Uint8Array instead`);return e},revive:(e,t)=>e},ga=e=>{if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},_a=[wn,fi,Kt,Zt,nn,cn,mn,br,Dr,Gn,Pr,Gr,Xr,ni,si,Di,ji,Fi,$i,Bi,ia,{type:`nonFiniteNumber`,isType:e=>typeof e==`number`&&!Number.isFinite(e),box:(e,t)=>Mt(t.transport)?{...G,type:`nonFiniteNumber`,value:String(e)}:e,revive:(e,t)=>Number(e.value)},{type:`undefined`,isType:e=>e===void 0,box:(e,t)=>Mt(t.transport)?{...G,type:`undefined`}:e,revive:(e,t)=>void 0},da,ma,ha,Gi,{type:`unclonable`,objectsOnly:!0,isType:e=>{if(typeof e!=`object`||!e||Array.isArray(e)||ga(e))return!1;try{return structuredClone(e),!1}catch{return!0}},box:(e,t)=>({...G,type:`unclonable`}),revive:(e,t)=>({})}],va=(e,t)=>t.find(t=>t.type===e.type),ya=e=>!!e&&typeof e==`object`&&Object.getPrototypeOf(e)===Object.prototype,ba=(e,t)=>Array.isArray(e)?e.map(e=>t(e)):ya(e)?Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n)])):e,xa=new WeakSet,Sa=new WeakSet,Ca=0,wa=[],Ta=(e,t)=>{if(Ca===0){e();return}wa.push({commit:e,rollback:t})},Ea=e=>{let t=wa;wa=[];for(let n of t)try{e?n.rollback():n.commit()}catch{}},Da=e=>e!==null&&(typeof e==`object`||typeof e==`function`),Oa=new WeakMap,ka=e=>{let t=Oa.get(e);if(t)return t;let n=e.filter(e=>!e.objectsOnly);return Oa.set(e,n),n},Aa=(e,t,n)=>{let r=(e===null||typeof e!=`object`&&typeof e!=`function`?ka(t.revivableModules):t.revivableModules).find(t=>t.type!==n&&t.isType(e));return r?r.box(e,t):ba(e,e=>ja(e,t))},ja=(e,t)=>{if(Ut(e))return e;let n=Da(e);if(n){if(xa.has(e))throw TypeError(`osra: cannot serialize a circular structure - break the cycle or send the container by reference`);xa.add(e)}Ca++;let r=!0;try{let n=Aa(e,t);return r=!1,n}finally{n&&xa.delete(e),Ca--,Ca===0&&Ea(r)}},Ma=(e,t,n)=>Aa(e,t,n),Na=(e,t)=>{let n=Da(e);if(n){if(Sa.has(e))throw TypeError(`osra: cannot revive a circular structure`);Sa.add(e)}try{if(Ut(e)){let n=va(e,t.revivableModules);if(n)return n.revive(e,t)}return ba(e,e=>Na(e,t))}finally{n&&Sa.delete(e)}},Pa=W({init:()=>La,startBidirectionalConnection:()=>Ia,type:()=>Fa}),Fa=`bidirectional`,Ia=({transport:e,value:t,remoteUuid:n,eventTarget:r,send:i,revivableModules:a})=>{let o={transport:e,remoteUuid:n,sendMessage:i,eventTarget:r,revivableModules:a};for(let e of a)e.init?.(o);let{promise:s,resolve:c}=Promise.withResolvers();return r.addEventListener(`message`,function e({detail:t}){t.type===`init`&&(c(t.data),r.removeEventListener(`message`,e))}),i({type:`init`,remoteUuid:n,data:ja(t,o)}),{revivableContext:o,remoteValue:s.then(e=>Na(e,o))}},La=e=>{if(!(Nt(e.transport)&&Pt(e.transport)))return;if(e.protocolEventTarget.addEventListener(`message`,({detail:{message:t,peer:n}})=>{if(t.type===`announce`){if(!t.remoteUuid){e.sendMessage({type:`announce`,remoteUuid:t.uuid});return}if(t.remoteUuid!==e.getUuid()||e.connectionContexts.has(t.uuid))return;e.sendMessage({type:`announce`,remoteUuid:t.uuid});let r=e.createConnectionEventTarget(),i={...n(),abort:()=>e.abortConnection(t.uuid)},a;try{let n=e.valueFor(i);if(e.claimPendingAbort(t.uuid)){e.sendMessage({type:`close`,remoteUuid:t.uuid});return}a=Ia({transport:e.transport,value:n,remoteUuid:t.uuid,eventTarget:r,send:t=>e.sendMessage(t),revivableModules:e.revivableModules})}catch(n){e.sendMessage({type:`close`,remoteUuid:t.uuid}),e.rejectRemoteValue(n);return}let o={type:`bidirectional`,eventTarget:r,connection:a};e.connectionContexts.set(t.uuid,o),o.connection.remoteValue.then(t=>e.addConnection(i,t),t=>e.rejectRemoteValue(t));return}if(t.type===`close`){if(t.remoteUuid!==e.getUuid())return;let n=e.connectionContexts.get(t.uuid);if(!n)return;e.connectionContexts.delete(t.uuid),Cn(n.connection.revivableContext),e.rejectRemoteValue(Error(`osra: peer closed the connection`));return}if(t.remoteUuid!==e.getUuid())return;let r=e.connectionContexts.get(t.uuid);r&&r.eventTarget.dispatchEvent(new CustomEvent(`message`,{detail:t}))}),e.presetRemoteUuid!==void 0){let t=e.presetRemoteUuid,n=e.createConnectionEventTarget(),r,i;try{i={abort:()=>e.abortConnection(t)};let a=e.valueFor(i);if(e.claimPendingAbort(t)){e.sendMessage({type:`close`,remoteUuid:t});return}r=Ia({transport:e.transport,value:a,remoteUuid:e.presetRemoteUuid,eventTarget:n,send:t=>e.sendMessage(t),revivableModules:e.revivableModules})}catch(n){e.sendMessage({type:`close`,remoteUuid:t}),e.rejectRemoteValue(n);return}let a={type:`bidirectional`,eventTarget:n,connection:r};e.connectionContexts.set(e.presetRemoteUuid,a),a.connection.remoteValue.then(t=>e.addConnection(i,t),t=>e.rejectRemoteValue(t));return}let t=50,n,r=()=>{if(!(e.unregisterSignal?.aborted||e.connectionContexts.size>0)){try{e.sendMessage({type:`announce`},`*`)}catch{}n=setTimeout(r,t),t=Math.min(t*2,1e3)}};e.unregisterSignal?.addEventListener(`abort`,()=>clearTimeout(n),{once:!0}),r()},Ra=()=>new EventTarget,za=e=>{let t=Rt(e),n=t?e.emit:e,r=t?e.receive:e;return{isJson:t&&`isJson`in e&&e.isJson!==void 0?e.isJson:n!==void 0&&Mt(n)||r!==void 0&&Mt(r),...n===void 0?{}:{emit:n},...r===void 0?{}:{receive:r}}},Ba=e=>e?e(_a):_a,Va=32,Ha=()=>{let e=[],t=new Set,n=!1,r=()=>({value:void 0,done:!0});return{push:r=>{if(!n){if(t.size===0){e.push(r),e.length>Va&&e.shift();return}for(let e of t){let t=e.wake;if(t){e.wake=void 0,t({value:r,done:!1});continue}e.buffered.push(r)}}},close:()=>{n=!0;for(let e of t){let t=e.wake;e.wake=void 0,t?.(r())}},iterate:()=>{let i={buffered:[...e]};t.add(i);let a=!1;return{[Symbol.asyncIterator](){return this},next:()=>{if(a)return Promise.resolve(r());let e=i.buffered.shift();return e?Promise.resolve({value:e,done:!1}):n?Promise.resolve(r()):new Promise(e=>{i.wake=e})},return:()=>{a=!0,t.delete(i);let e=i.wake;return i.wake=void 0,e?.(r()),Promise.resolve(r())}}}}},Ua=(e,t,n)=>{let r=e.then(n);r.catch(()=>{});let i=()=>{let e=t.iterate();return{[Symbol.asyncIterator](){return this},next:()=>e.next().then(e=>e.done?{value:void 0,done:!0}:{value:n(e.value),done:!1}),return:()=>e.return?.()??Promise.resolve({value:void 0,done:!0})}};return Object.assign(r,{[Symbol.asyncIterator]:i})},Wa=Symbol.for(`osra.context`),Ga=e=>typeof e==`object`&&!!e&&Wa in e,Ka=[Pa],qa=(e,{transport:t,name:n,remoteName:r,key:i=Ze,origin:a=`*`,unregisterSignal:o,revivableModules:s,uuid:c,remoteUuid:l,connection:u=({value:e})=>e})=>{let d=u,f=za(t);if(!(Nt(f)&&Pt(f))){let e=Ha();e.close();let t=Promise.reject(Error(`osra: transport must be able to both emit and receive to establish a connection; pass a bidirectional platform transport or a custom { emit, receive } pair`));return t.catch(()=>{}),Ua(t,e,d)}let p=Ba(s),m=new Map,h=new Set,g=Ha(),{promise:_,resolve:v,reject:y}=Promise.withResolvers();_.catch(()=>{});let b=c??globalThis.crypto.randomUUID(),x=(e,t=a)=>{let r={[Xe]:i,name:n,uuid:b,...e},o=Bn(r);ot(f,r,t,o),gr(o)},S=(e,t)=>{o?.aborted||x(e,t)},C=Ra(),w={transport:f,valueFor:t=>Ga(e)?e[Wa](t):e,revivableModules:p,connectionContexts:m,getUuid:()=>b,presetRemoteUuid:l,sendMessage:S,protocolEventTarget:C,rejectRemoteValue:y,abortConnection:e=>{let t=m.get(e);if(!t){h.add(e);return}m.delete(e),x({type:`close`,remoteUuid:e}),Cn(t.connection.revivableContext),y(Error(`osra: connection aborted`))},claimPendingAbort:e=>h.delete(e),addConnection:(e,t)=>{let n={value:t,context:e};v(n),g.push(n)},createConnectionEventTarget:Ra,unregisterSignal:o};if(rt({listener:(e,t)=>{e.uuid!==b&&C.dispatchEvent(new CustomEvent(`message`,{detail:{message:e,peer:()=>({...t.origin?{origin:t.origin}:{},...t.source?{source:t.source}:{},...t.port?{port:t.port}:{},...t.sender?{sender:t.sender}:{}})}}))},transport:f,remoteName:r,key:i,origin:a,unregisterSignal:o}),o?.aborted)return y(o.reason),g.close(),Ua(_,g,d);o?.addEventListener(`abort`,()=>{for(let[e,t]of m)x({type:`close`,remoteUuid:e}),Cn(t.connection.revivableContext);m.clear(),g.close(),y(o.reason)},{once:!0});for(let e of Ka)e.init(w);return Ua(_,g,d)},Ja=(e,t)=>qa(e,t),Ya=[[`aac`,`audio/mp4; codecs="mp4a.40.2"`],[`opus`,`audio/mp4; codecs="opus"`],[`flac`,`audio/mp4; codecs="flac"`],[`ac3`,`audio/mp4; codecs="ac-3"`],[`eac3`,`audio/mp4; codecs="ec-3"`]],Xa=[`aac`,`opus`,`flac`],Za=()=>{let e=globalThis.MediaSource;if(typeof e?.isTypeSupported!=`function`)return[...Xa];let t=Ya.filter(([,t])=>{try{return e.isTypeSupported(t)}catch{return!1}}).map(([e])=>e);return t.includes(`aac`)?t:[...Xa]},Qa=e=>new Promise((t,n)=>{if(e.aborted)return n();e.addEventListener(`abort`,()=>{n()})}),$a=async({publicPath:e,workerUrl:t,workerOptions:n,read:r,length:i,bufferSize:a,audioStreamIndex:o,audioCodecs:s,transferReads:c=!0})=>{let l=new Worker(t,n),{makeRemuxer:u}=await Ja({},{transport:l}),d=await u({publicPath:e,length:i,bufferSize:a,audioStreamIndex:o,audioCodecs:s??Za()}),f=new Je({concurrency:1}),p=!1,m=(e,t)=>{p||!c||e.byteLength>0||t>=i||(p=!0,console.warn(`libav-wasm: read(${t}) returned 0 bytes, ${i-t} bytes before the end of the file. Reads are transferred, so the buffer read() returns is detached in the caller and handing back bytes you keep returns that same detached buffer. Return a copy, or pass transferReads: false.`))},h=e=>(t,n)=>e.signal.aborted?Promise.resolve({resolved:new Uint8Array().buffer,rejected:!0}):Promise.race([r(Number(t),Number(n)).then(e=>{m(e,Number(t));let n=new Uint8Array(e).buffer;return{resolved:c?An(n):n,rejected:!1}},()=>({resolved:new Uint8Array().buffer,rejected:!0})),Qa(e.signal).then(()=>({resolved:new Uint8Array().buffer,rejected:!0}),()=>({resolved:new Uint8Array().buffer,rejected:!0}))]),g=[];return{worker:l,remuxer:d,wasmRead:h,addTask:e=>{let t=[...g];g=[],f.clear(),t.forEach(e=>e.abort());let n=new AbortController;return g=[...g,n],Promise.race([f.add(async()=>e(n),{signal:n.signal}),Qa(n.signal).then(()=>Promise.reject(Error(`Cancelled`)),()=>Promise.reject(Error(`Cancelled`)))])},destroy:async()=>{let e=[...g];g=[],f.clear(),e.forEach(e=>e.abort()),await d.destroy(),l.terminate()}}},eo=async e=>{let{worker:t,remuxer:n,wasmRead:r,addTask:i,destroy:a}=await $a({...e,bufferSize:e.bufferSize??25e5});return{worker:t,init:()=>i(e=>n.init(r(e))),destroy:a,seek:e=>i(t=>n.seek(r(t),e)),read:()=>i(e=>n.read(r(e))),readKeyframe:e=>i(t=>n.readKeyframe(r(t),e)),setAudioStreamIndex:e=>n.setAudioStreamIndex(e)}},to=async e=>{let{worker:t,remuxer:n,wasmRead:r,addTask:i,destroy:a}=await $a({...e,bufferSize:e.bufferSize??1e6});return{worker:t,init:()=>i(e=>n.initThumbnail(r(e))),readKeyframe:e=>i(t=>n.readKeyframe(r(t),e)),destroy:a}},no=typeof HTMLVideoElement<`u`?HTMLVideoElement.prototype:{},ro=`getVideoPlaybackQuality`in no||`webkitDecodedFrameCount`in no||`mozPresentedFrames`in no||`mozPaintedFrames`in no;if(!(`requestVideoFrameCallback`in no)&&ro&&typeof requestAnimationFrame==`function`){no._rvfcpolyfillmap={};let e=`getVideoPlaybackQuality`in no?e=>{let{totalFrameDelay:t,totalVideoFrames:n,droppedVideoFrames:r}=e.getVideoPlaybackQuality();return{presentedFrames:n-r,totalFrameDelay:t}}:e=>({presentedFrames:e.mozPresentedFrames||e.mozPaintedFrames||e.webkitDecodedFrameCount-(e.webkitDroppedFrameCount||0),totalFrameDelay:e.mozFrameDelay||0});no.requestVideoFrameCallback=function(t){let n=performance.now(),r=e(this),i=r.presentedFrames,a=(o,s)=>{let c=e(this),l=c.presentedFrames;if(l>i){let e=c.totalFrameDelay-r.totalFrameDelay||0,i=s-o;t(s,{presentationTime:s+e*1e3,expectedDisplayTime:s+i,width:this.videoWidth,height:this.videoHeight,mediaTime:Math.max(0,this.currentTime||0)+i/1e3,presentedFrames:l,processingDuration:e}),delete this._rvfcpolyfillmap[n]}else this._rvfcpolyfillmap[n]=requestAnimationFrame(e=>a(s,e))};return this._rvfcpolyfillmap[n]=requestAnimationFrame(e=>a(n,e)),n},no.cancelVideoFrameCallback=function(e){cancelAnimationFrame(this._rvfcpolyfillmap[e]),delete this._rvfcpolyfillmap[e]}}var io={RAW:`RAW`,PROXY:`PROXY`,THROW:`THROW`,HANDLER:`HANDLER`},ao={GET:`GET`,SET:`SET`,APPLY:`APPLY`,CONSTRUCT:`CONSTRUCT`,RELEASE:`RELEASE`},oo=Symbol(`Abslink.proxy`),so=Symbol(`Abslink.releaseProxy`),co=Symbol(`Abslink.finalizer`),lo=Symbol(`Abslink.thrown`),uo=e=>typeof e==`object`&&!!e||typeof e==`function`,fo=new Map([[`proxy`,{canHandle:e=>uo(e)&&oo in e,serialize(e,t){let n=e[oo];return mo(e,t,n),[n,[]]},deserialize(e,t){return ho(t,e)}}],[`throw`,{canHandle:e=>uo(e)&&lo in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(Error(e.value.message),e.value):e.value}}]]);function po(e,t){let n=t,r=e.slice(0,-1);for(let e of r)Object.prototype.hasOwnProperty.call(n,e)&&(n=n[e]);let i=e[e.length-1],a=i?n[i]:n;return{parent:n,RawValue:a,lastSegment:i}}function mo(e,t,n){return t.on(`message`,function r(i){if(!i)return;let{id:a,type:o,path:s,markerID:c}={path:[],...i};if(c!==n)return;let l=(i.argumentList??[]).map(e=>Oo(e,t)),u;try{let{parent:n,RawValue:r,lastSegment:a}=po(s,e);switch(o){case ao.GET:u=r;break;case ao.SET:n[a]=Oo(i.value,t),u=!0;break;case ao.APPLY:u=r.apply(n,l);break;case ao.CONSTRUCT:u=new r(...l);break;case ao.RELEASE:u=void 0;break;default:return}}catch(e){u={value:e,[lo]:0}}Promise.resolve(u).catch(e=>({value:e,[lo]:0})).then(i=>{o===ao.CONSTRUCT&&(i=Eo(i));let[s,c]=Do(i,t);t.postMessage({...s,id:a,markerID:n},c),o===ao.RELEASE&&(t.off(`message`,r),e[co]?.())}).catch(e=>{let[r,i]=Do({value:TypeError(`Unserializable return value`),[lo]:0},t);t.postMessage({...r,id:a,markerID:n},i)})}),e}function ho(e,t){let n=new Map;return e.on(`message`,e=>{if(!e?.id)return;let t=n.get(e.id);if(t)try{t(e)}finally{n.delete(e.id)}}),So({endpoint:e,pendingListeners:n,rootMarkerID:t})}function go(e){if(e)throw Error(`Proxy has been released and is not useable`)}async function _o(e){await ko(e,{type:ao.RELEASE})}var vo=new WeakMap,yo=`FinalizationRegistry`in globalThis&&new FinalizationRegistry(e=>{let t=(vo.get(e)??0)-1;vo.set(e,t),t===0&&_o(e).finally(()=>{e.pendingListeners.clear()})});function bo(e,t){let n=(vo.get(t)??0)+1;vo.set(t,n),yo&&yo.register(e,t,e)}function xo(e){yo&&yo.unregister(e)}function So(e,t=[]){let n=!1,r=new Map,i=new Proxy(function(){},{get(a,o){if(go(n),o===so)return async()=>{for(let e of r.values())e[so]();r.clear(),xo(i),_o(e).finally(()=>{e.pendingListeners.clear()}),n=!0};if(o===`then`){if(t.length===0)return{then:()=>i};let n=ko(e,{type:ao.GET,path:t.map(e=>e.toString())}).then(t=>Oo(t,e.endpoint));return n.then.bind(n)}let s=r.get(o);if(s)return s;let c=So(e,[...t,o]);return r.set(o,c),c},set(r,i,a){go(n);let[o,s]=Do(a,e.endpoint);return ko(e,{type:ao.SET,path:[...t,i].map(e=>e.toString()),value:o},s).then(t=>Oo(t,e.endpoint))},apply(r,i,a){if(go(n),t[t.length-1]===`bind`)return So(e,t.slice(0,-1));let[o,s]=To(a,e);return ko(e,{type:ao.APPLY,path:t.map(e=>e.toString()),argumentList:o},s).then(t=>Oo(t,e.endpoint))},construct(r,i){go(n);let[a,o]=To(i,e);return ko(e,{type:ao.CONSTRUCT,path:t.map(e=>e.toString()),argumentList:a},o).then(t=>Oo(t,e.endpoint))}});return bo(i,e),i}var Co=new WeakMap;function wo(e,t){return Co.set(e,t),e}function To(e,t){let n=[],r=[];for(let i of e){let[e,a]=Do(i,t.endpoint);n.push(e),r.push(...a)}return[n,r]}function Eo(e){return Object.assign(e,{[oo]:Po()})}function Do(e,t){for(let[n,r]of fo)if(r.canHandle(e)){let[i,a]=r.serialize(e,t);return[{type:io.HANDLER,name:n,value:i},a]}return[{type:io.RAW,value:e},Co.get(e)??[]]}function Oo(e,t){switch(e.type){case io.HANDLER:return fo.get(e.name).deserialize(e.value,t);case io.RAW:return e.value}}function ko(e,t,n=[]){return new Promise(r=>{let i=Po();e.pendingListeners.set(i,r),e.endpoint.postMessage({id:i,...t,markerID:e.rootMarkerID},n)})}var Ao=[],jo=`0123456789abcdef`;for(let e=0;e<256;e++)Ao[e]=jo[e>>4&15]+jo[e&15];var Mo=0,No=``;function Po(){let e=0;if(!No||Mo+16>512)for(No=``,Mo=0;e<256;++e)No+=Ao[Math.random()*256|0];return No.substring(Mo,++Mo+16)}function Fo(e,t){let n=new WeakMap;return e.start?.(),t.start?.(),{on(t,r){let i=e=>r(e.data);`addEventListener`in e?e.addEventListener(t,i):`addListener`in e?e.addListener(t,i):e.on(t,i),n.set(r,i)},off(t,r){let i=n.get(r);`removeEventListener`in e?e.removeEventListener(t,i):`removeListener`in e?e.removeListener(t,i):e.off(t,i),n.delete(r)},postMessage(e,n=[]){t.postMessage(e,n)}}}function Io(e,t=e){return ho(Fo(e,t))}var Lo=S(v(((e,t)=>{ne();var n=re!==void 0&&!!re.hrtime,r=65535,i=10,a=n?1e9/i:1e3/i,o=n?()=>{let[e,t]=re.hrtime();return e*1e9+t}:()=>performance.now();function s(e){return(o()-e)/a&r}t.exports=function(e){let t=o(),n=i*(e||5),a=[0],c=1,l=s(t)-1&r;return function(e){let o=s(t),u=o-l&r;for(u>n&&(u=n),l=o;u--;)c===n&&(c=0),a[c]=a[c===0?n-1:c-1],c++;e&&(a[c-1]+=e);let d=a[c-1],f=a.length<n?0:a[c===n?0:c];return a.length<i?d:(d-f)*i/a.length}}}))(),1),Ro=class{fps=(0,Lo.default)(5);processingDuration=(0,Lo.default)(5);droppedFrames=0;presentedFrames=0;mistimedFrames=0;_drop(){++this.droppedFrames}_startTime=0;_startFrame(){this._startTime=performance.now()}onsubtitleFrameCallback=(e,{fps:t,processingDuration:n,droppedFrames:r})=>console.info(`%cFPS: %c%f %c| Frame Time: %c%d ms %c| Dropped Frames: %c%d %c| 5s Avg`,`color: #888`,`color: #0f0; font-weight: bold`,t.toFixed(1),`color: #888`,`color: #0ff; font-weight: bold`,n,`color: #888`,`color: #f00; font-weight: bold`,r,`color: #888`);_endFrame(e){++this.presentedFrames;let t=this.fps(1),n=performance.now(),r=this.processingDuration((n-this._startTime)/t),i=Math.max(0,n-e.expectedDisplayTime);i&&++this.mistimedFrames,this.onsubtitleFrameCallback?.(n,{fps:t,processingDuration:r,droppedFrames:this.droppedFrames,presentedFrames:this.presentedFrames,mistimedFrames:this.mistimedFrames,presentationTime:n,expectedDisplayTime:e.expectedDisplayTime+(i>0?t/1e3:0),frameDelay:i,width:e.width,height:e.height,mediaTime:e.mediaTime})}},zo={rgb:`RGB`,bt709:`BT709`,bt470bg:`BT601`,smpte170m:`BT601`},Bo=class e{timeOffset;prescaleFactor;prescaleHeightLimit;maxRenderHeight;debug;renderer;ready;busy=!1;_video;_videoWidth=0;_videoHeight=0;_videoColorSpace=null;_canvas;_ro=new ResizeObserver(async()=>{await this.ready,this.resize()});_destroyed=!1;_lastDemandTime;_skipped=!1;_worker;constructor(t){if(!globalThis.Worker)throw Error(`Worker not supported`);if(!t)throw Error(`No options provided`);if(!t.video&&!t.canvas)throw Error(`You should give video or canvas in options.`);e._test(),this.timeOffset=t.timeOffset??0,this._video=t.video,this._canvas=t.canvas??document.createElement(`canvas`),this._video&&!t.canvas&&(this._canvas.className=`JASSUB`,this._canvas.style.position=`absolute`,this._canvas.style.pointerEvents=`none`,this._video.insertAdjacentElement(`afterend`,this._canvas));let n=this._canvas.transferControlToOffscreen();this.debug=t.debug?new Ro:null,this.prescaleFactor=t.prescaleFactor??1,this.prescaleHeightLimit=t.prescaleHeightLimit??1080,this.maxRenderHeight=t.maxRenderHeight??0,this._worker=t.workerUrl?new Worker(t.workerUrl,{name:`jassub-worker`,type:`module`}):new Worker(new URL(new URL(`worker-dPoC1jvm.js`,import.meta.url).href,``+import.meta.url),{name:`jassub-worker`,type:`module`});let r=Io(this._worker),i=t.modernWasmUrl??new URL(new URL(`jassub-worker-modern-C7bYVPj4.wasm`,import.meta.url).href,``+import.meta.url).href,a=t.wasmUrl??new URL(new URL(`jassub-worker-CLcXAXXL.wasm`,import.meta.url).href,``+import.meta.url).href,o=t.availableFonts??{};!o[`liberation sans`]&&!t.defaultFont&&(o[`liberation sans`]=new URL(new URL(`default-jVcJgvWm.woff2`,import.meta.url).href,``+import.meta.url).href),this.ready=new r({wasmUrl:e._supportsSIMD?i:a,width:n.width,height:n.height,subUrl:t.subUrl,subContent:t.subContent??null,fonts:t.fonts??[],availableFonts:o,defaultFont:t.defaultFont??`liberation sans`,debug:!!t.debug,libassMemoryLimit:t.libassMemoryLimit??0,libassGlyphLimit:t.libassGlyphLimit??0,queryFonts:t.queryFonts??`local`},Eo(e=>this._getLocalFont(e)),wo(n,[n])).then(e=>{this.renderer=e}),this._video?this.setVideo(this._video):this._ro.observe(this._canvas)}static _supportsSIMD;static _test(){if(e._supportsSIMD!=null)return;try{e._supportsSIMD=WebAssembly.validate(Uint8Array.of(0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,43,1,41,0,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,128,2,11))}catch{e._supportsSIMD=!1}let t=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(t instanceof WebAssembly.Module)||!(new WebAssembly.Instance(t)instanceof WebAssembly.Instance))throw Error(`WASM not supported`)}async resize(e=!!this._video?.paused,t=0,n=0){let r=this._video?.videoWidth??this._videoWidth,i=this._video?.videoHeight??this._videoHeight,a=this._getElementBoundingBox(this._video??this._canvas,r,i);if(!t||!n){let e=this._videoWidth/r||1,o=this._videoHeight/i||1,{width:s,height:c}=this._computeRenderSize(a.width*e,a.height*o);t=Math.round(s),n=Math.round(c)}this._video&&(this._canvas.style.width=Math.round(a.width)+`px`,this._canvas.style.height=Math.round(a.height)+`px`,this._canvas.style.top=a.y+`px`,this._canvas.style.left=a.x+`px`),await this.renderer._resizeCanvas(t,n,this._videoWidth||t,this._videoHeight||n),this._lastDemandTime&&await this._demandRender(e)}_getElementBoundingBox(e,t,n){let{clientWidth:r,clientHeight:i,offsetLeft:a,offsetTop:o}=e,s=t/n;return r/i>s?(n=i,t=i*s):(n=r/s,t=r),{x:a+(r-t)/2,y:o+(i-n)/2,width:t,height:n}}_computeRenderSize(e=0,t=0){if(t<=0||e<=0)return{width:0,height:0};let n=this.prescaleFactor<=0?1:this.prescaleFactor,r=self.devicePixelRatio||1,i=n<1?-1:1,a=t*r;return i*a*n<=i*this.prescaleHeightLimit?a*=n:i*a<i*this.prescaleHeightLimit&&(a=this.prescaleHeightLimit),this.maxRenderHeight>0&&a>this.maxRenderHeight&&(a=this.maxRenderHeight),e*=a/t,t=a,{width:e,height:t}}async setVideo(e){this._removeListeners(),this._video=e,this._ro.observe(e),typeof VideoFrame<`u`&&(e.addEventListener(`loadedmetadata`,this._boundUpdateColorSpace),this._updateColorSpace({target:e})),await this.ready,this._video.requestVideoFrameCallback((e,t)=>this._handleRVFC(t))}async _getLocalFont(e,t=`regular`){if(navigator.permissions?.query){let{state:e}=await navigator.permissions.query({name:`local-fonts`});if(e!==`granted`)return}for(let n of await self.queryLocalFonts()){let r=n.family.toLowerCase(),i=n.style.toLowerCase();if(r===e&&i===t){let e=await n.blob();return new Uint8Array(await e.arrayBuffer())}}}_handleRVFC(e){this._destroyed||(this.manualRender(e),this._video.requestVideoFrameCallback((e,t)=>this._handleRVFC(t)))}manualRender(e,t=!1){return this._lastDemandTime=e,this._demandRender(t)}async _demandRender(e=!1){let{mediaTime:t,width:n,height:r}=this._lastDemandTime;if(n!==this._videoWidth||r!==this._videoHeight)return this._videoWidth=n,this._videoHeight=r,await this.resize(e);if(this.busy){this._skipped=!0,this.debug?._drop();return}this.busy=!0,this._skipped=!1,this.debug?._startFrame(),await this.renderer._draw(t+this.timeOffset,e),this.debug?._endFrame(this._lastDemandTime),this.busy=!1,this._skipped&&await this._demandRender()}_boundUpdateColorSpace=this._updateColorSpace.bind(this);_updateColorSpace({target:e}){this._video.requestVideoFrameCallback(async()=>{if(!(this._destroyed||this._video!==e))try{let e=new VideoFrame(this._video);e.close(),await this.ready,await this.renderer._setColorSpace(zo[e.colorSpace.matrix])}catch(e){console.warn(e)}})}_removeListeners(){this._ro.disconnect(),this._video?.removeEventListener(`loadedmetadata`,this._boundUpdateColorSpace)}async destroy(){if(!this._destroyed){this._destroyed=!0,this._canvas.remove(),this._removeListeners();try{await this.ready,await this.renderer?.[so]()}finally{this._worker.terminate()}}}};function Vo(e){var t=e.toLowerCase().trim().split(/\s*;\s*/);return t[0]===`banner`?{name:t[0],delay:t[1]*1||0,leftToRight:t[2]*1||0,fadeAwayWidth:t[3]*1||0}:/^scroll\s/.test(t[0])?{name:t[0],y1:Math.min(t[1]*1,t[2]*1),y2:Math.max(t[1]*1,t[2]*1),delay:t[3]*1||0,fadeAwayHeight:t[4]*1||0}:e===``?null:{name:e}}function Ho(e){return e?e.toLowerCase().replace(/([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)/g,` $1 `).replace(/([mnlbspc])/g,` $1 `).trim().replace(/\s+/g,` `).split(/\s(?=[mnlbspc])/).map(function(e){return e.split(` `).filter(function(e,t){return!(t&&isNaN(e*1))})}):[]}var Uo=`b.i.u.s.fsp.k.K.kf.ko.kt.fe.q.p.pbo.a.an.fscx.fscy.fax.fay.frx.fry.frz.fr.be.blur.bord.xbord.ybord.shad.xshad.yshad`.split(`.`).map(function(e){return{name:e,regex:RegExp(`^`+e+`-?\\d`)}});function Wo(e){for(var t,n={},r=0;r<Uo.length;r++){var i=Uo[r],a=i.name;if(i.regex.test(e))return n[a]=e.slice(a.length)*1,n}if(/^fn/.test(e))n.fn=e.slice(2);else if(/^r/.test(e))n.r=e.slice(1);else if(/^fs[\d+-]/.test(e))n.fs=e.slice(2);else if(/^\d?c&?H?[0-9a-fA-F]+|^\d?c$/.test(e)){var o=e.match(/^(\d?)c&?H?(\w*)/),s=o[1],c=o[2];n[`c`+(s||1)]=c&&(`000000`+c).slice(-6)}else if(/^\da&?H?[0-9a-fA-F]+/.test(e)){var l=e.match(/^(\d)a&?H?([0-9a-f]+)/i),u=l[1],d=l[2];n[`a`+u]=(`00`+d).slice(-2)}else if(/^alpha&?H?[0-9a-fA-F]+/.test(e))t=e.match(/^alpha&?H?([0-9a-f]+)/i),n.alpha=t[1],n.alpha=(`00`+n.alpha).slice(-2);else if(/^(?:pos|org|move|fad|fade)\([^)]+/.test(e)){var f=e.match(/^(\w+)\((.*?)\)?$/),p=f[1];n[p]=f[2].trim().split(/\s*,\s*/).map(Number)}else if(/^i?clip\([^)]+/.test(e)){var m=e.match(/^i?clip\((.*?)\)?$/)[1].trim().split(/\s*,\s*/);n.clip={inverse:/iclip/.test(e),scale:1,drawing:null,dots:null},m.length===1&&(n.clip.drawing=Ho(m[0])),m.length===2&&(n.clip.scale=m[0]*1,n.clip.drawing=Ho(m[1])),m.length===4&&(n.clip.dots=m.map(Number))}else if(/^t\(/.test(e)){var h=e.match(/^t\((.*?)\)?$/)[1].trim().replace(/\\.*/,function(e){return e.replace(/,/g,`
3
+ `)}).split(/\s*,\s*/);if(!h[0])return n;n.t={t1:0,t2:0,accel:1,tags:h[h.length-1].replace(/\n/g,`,`).split(`\\`).slice(1).map(Wo)},h.length===2&&(n.t.accel=h[0]*1),h.length===3&&(n.t.t1=h[0]*1,n.t.t2=h[1]*1),h.length===4&&(n.t.t1=h[0]*1,n.t.t2=h[1]*1,n.t.accel=h[2]*1)}return n}function Go(e){for(var t=[],n=0,r=``,i=e.split(`\\`).slice(1).concat(``).join(`\\`),a=0;a<i.length;a++){var o=i[a];o===`(`&&n++,o===`)`&&n--,n<0&&(n=0),!n&&o===`\\`?(r&&t.push(r),r=``):r+=o}return t.map(Wo)}function Ko(e){var t=e.split(/{(.*?)}/),n=[];t[0].length&&n.push({tags:[],text:t[0],drawing:[]});for(var r=1;r<t.length;r+=2){var i=Go(t[r]),a=i.reduce(function(e,t){return t.p===void 0?e:!!t.p},!1);n.push({tags:i,text:a?``:t[r+1],drawing:a?Ho(t[r+1]):[]})}return{raw:e,combined:n.map(function(e){return e.text}).join(``),parsed:n}}function qo(e){var t=e.split(`:`);return t[0]*3600+t[1]*60+t[2]*1}function Jo(e,t){var n=e.split(`,`);if(n.length>t.length){var r=n.slice(t.length-1).join();n=n.slice(0,t.length-1),n.push(r)}for(var i={},a=0;a<n.length;a++){var o=t[a],s=n[a].trim();switch(o){case`Layer`:case`MarginL`:case`MarginR`:case`MarginV`:i[o]=s*1;break;case`Start`:case`End`:i[o]=qo(s);break;case`Effect`:i[o]=Vo(s);break;case`Text`:i[o]=Ko(s);break;default:i[o]=s}}return i}var Yo=[`Name`,`Fontname`,`Fontsize`,`PrimaryColour`,`SecondaryColour`,`OutlineColour`,`BackColour`,`Bold`,`Italic`,`Underline`,`StrikeOut`,`ScaleX`,`ScaleY`,`Spacing`,`Angle`,`BorderStyle`,`Outline`,`Shadow`,`Alignment`,`MarginL`,`MarginR`,`MarginV`,`Encoding`],Xo=[`Layer`,`Start`,`End`,`Style`,`Name`,`MarginL`,`MarginR`,`MarginV`,`Effect`,`Text`];function Zo(e){var t=Yo.concat(Xo);return e.match(/Format\s*:\s*(.*)/i)[1].split(/\s*,\s*/).map(function(e){return t.find(function(t){return t.toLowerCase()===e.toLowerCase()})||e})}function Qo(e,t){var n=e.match(/Style\s*:\s*(.*)/i)[1].split(/\s*,\s*/);return Object.assign.apply(Object,[{}].concat(t.map(function(e,t){var r={};return r[e]=n[t],r})))}function $o(e){for(var t={info:{},styles:{format:[],style:[]},events:{format:[],comment:[],dialogue:[]}},n=e.split(/\r?\n/),r=0,i=0;i<n.length;i++){var a=n[i].trim();if(!/^;/.test(a)&&(/^\[Script Info\]/i.test(a)?r=1:/^\[V4\+? Styles\]/i.test(a)?r=2:/^\[Events\]/i.test(a)?r=3:/^\[.*\]/.test(a)&&(r=0),r!==0)){if(r===1&&/:/.test(a)){var o=a.match(/(.*?)\s*:\s*(.*)/),s=o[1],c=o[2];t.info[s]=c}if(r===2&&(/^Format\s*:/i.test(a)&&(t.styles.format=Zo(a)),/^Style\s*:/i.test(a)&&t.styles.style.push(Qo(a,t.styles.format))),r===3&&(/^Format\s*:/i.test(a)&&(t.events.format=Zo(a)),/^(?:Comment|Dialogue)\s*:/i.test(a))){var l=a.match(/^(\w+?)\s*:\s*(.*)/i),u=l[1],d=l[2];t.events[u.toLowerCase()].push(Jo(d,t.events.format))}}}return t}var es={M:`m`,L:`l`,C:`b`};function ts(e){return e.instructions.map(function(e){var t,n=e.type,r=e.points;return(t=[es[n]]).concat.apply(t,r.map(function(e){return[e.x,e.y]})).join(` `)}).join(` `)}var ns=function(e){return function(t){return function(n){return``+t+e+`&H`+n+`&`}}},rs=ns(`c`),is=ns(`a`),as={c1:rs(1),c2:rs(2),c3:rs(3),c4:rs(4),a1:is(1),a2:is(2),a3:is(3),a4:is(4),pos:function(e){return`pos(`+[e.x,e.y]+`)`},org:function(e){return`org(`+[e.x,e.y]+`)`},move:function(e){return`move(`+[e.x1,e.y1,e.x2,e.y2,e.t1,e.t2]+`)`},fade:function(e){return e.type===`fad`?`fad(`+[e.t1,e.t2]+`)`:`fade(`+[e.a1,e.a2,e.a3,e.t1,e.t2,e.t3,e.t4]+`)`},clip:function(e){return(e.inverse?`i`:``)+`clip(`+(e.dots?``+[e.dots.x1,e.dots.y1,e.dots.x2,e.dots.y2]:(e.scale===1?``:e.scale+`,`)+ts(e.drawing))+`)`},t:function(e){return e.map(function(e){return`t(`+[e.t1,e.t2,e.accel,os(e.tag)]+`)`}).join(`\\`)}};function os(e){return Object.keys(e).map(function(t){return`\\`+(as[t]||(function(e){return``+t+e}))(e[t])}).join(``)}var ss=e=>Array(e.buffered.length).fill(void 0).map((t,n)=>({index:n,start:e.buffered.start(n),end:e.buffered.end(n)})),cs=e=>new Promise((t,n)=>{let r=()=>{e.removeEventListener(`updateend`,i),e.removeEventListener(`abort`,i),e.removeEventListener(`error`,a)},i=()=>{r(),t()},a=e=>{r(),n(Error(`The browser rejected a media segment`,{cause:e}))};e.addEventListener(`updateend`,i,{once:!0}),e.addEventListener(`abort`,i,{once:!0}),e.addEventListener(`error`,a,{once:!0})}),ls=(e,t)=>{let n=Promise.resolve(),r=e=>{let t=n.then(e,e);return n=t.catch(()=>{}),t};return{appendBuffer:t=>r(()=>(e.appendBuffer(t),cs(e))),unbufferRange:(t,n)=>r(()=>t>=n?Promise.resolve():(e.remove(t,n),cs(e))),updateTimestampOffset:t=>r(async()=>{e.timestampOffset=t}),endOfStream:()=>r(async()=>{if(!(t.readyState!==`open`||e.updating))try{t.endOfStream()}catch{}})}},us=e=>e===void 0?void 0:new URL(e,document.baseURI).toString(),ds=e=>new Date(e).toISOString().slice(11,22),fs=1,ps=e=>new Map($o(e).styles.style.map((e,t)=>[e.Name,t+fs])),ms=(e,t)=>{let n=t.replace(/^\*+/,``),r=n.toLowerCase()==="default"?`Default`:n;return e.styles.get(r)??e.styles.get(`Default`)??0},hs=e=>{let t=e.content.match(/\r?\n\[Events\]\r?\nFormat: (.*)/)?.[0];return t?{type:`header`,streamIndex:e.streamIndex,content:e.content,eventsContent:t,styles:ps(e.content)}:(console.warn(`subtitle stream ${e.streamIndex} has no Events format, ignoring the track`),null)},gs=(e,t)=>{let[n,r]=t.content.split(`,`),i=Number(n),a=`Dialogue: ${r},${ds(t.start)},${ds(t.end)},${t.content.replace(`${i},${r},`,``)}`,o=$o(`${e.eventsContent}\r\n${a}`).events.dialogue[0];if(!o)throw Error(`dialogue event is undefined`);return{type:`dialogue`,streamIndex:t.streamIndex,index:i,assEvent:{Name:o.Name??``,Effect:o.Effect?.name??``,Layer:o.Layer,MarginL:o.MarginL,MarginR:o.MarginR,MarginV:o.MarginV,Style:ms(e,o.Style),Text:o.Text.raw,Start:o.Start*1e3,Duration:(o.End-o.Start)*1e3,ReadOrder:i}}},_s=e=>{let{video:t,container:n,workerUrl:r}=e,i=us(e.wasmUrl),a=us(e.legacyWasmUrl),o=us(e.defaultFontUrl),s,c=[],l=new Map,u=[],d=new Map,f,p=e.onStreams,m=!1,h=e=>{console.warn(`the subtitle renderer failed; the file plays without subtitles`,e)},g=e=>{let t=s;t&&t.ready.then(()=>s===t?e(t.renderer):void 0).catch(h)},_=!1,v=()=>{_||(_=!0,queueMicrotask(()=>{_=!1;let e=s;!e||!t.videoWidth||e.ready.then(()=>{if(s===e)return e.manualRender({expectedDisplayTime:performance.now(),width:t.videoWidth,height:t.videoHeight,mediaTime:t.currentTime},!0)}).catch(h)}))},y=[`loadedmetadata`,`seeked`,`pause`],b=()=>v(),x=e=>{let l=document.createElement(`canvas`);n.append(l);try{s=new Bo({video:t,canvas:l,subContent:e.content,workerUrl:r,modernWasmUrl:i,...a?{wasmUrl:a}:{},fonts:c.map(([,e])=>e),availableFonts:{...Object.fromEntries(c),...o?{"liberation sans":o}:{}},queryFonts:!1})}catch(e){l.remove(),h(e);return}s.ready.catch(h);for(let e of y)t.addEventListener(e,b);o&&g(e=>{Promise.resolve(e.addFonts([o])).then(v,h)}),v()};return{pushAttachments:e=>{c=[...c,...e.map(e=>[e.filename,new Uint8Array(e.data)])]},pushFragments:e=>{let t=[];for(let n of e)if(n.type===`header`){if(l.has(n.streamIndex))continue;let e=hs(n);if(!e)continue;l.set(n.streamIndex,e),u.push({streamIndex:n.streamIndex,title:n.title,language:n.language}),p?.([...u]),f===void 0&&(f=n.streamIndex),!s&&!m&&x(e)}else{let e=l.get(n.streamIndex);if(!e)continue;let r=d.get(n.streamIndex);r||(r=new Map,d.set(n.streamIndex,r));let i=gs(e,n);if(r.has(i.index))continue;r.set(i.index,i),f===n.streamIndex&&t.push(i.assEvent)}t.length&&(g(e=>Promise.all(t.map(t=>e.createEvent(t)))),v())},selectStream:e=>{let t=e??-1;if(t===f||!s)return;f=t;let n=l.get(t),r=[...d.get(t)?.values()??[]].map(e=>e.assEvent);g(e=>{let t=[e.freeTrack()];if(n){t.push(e.setTrack(n.content));for(let n of r)t.push(e.createEvent(n))}return Promise.all(t)}),v()},getStreams:()=>[...u],getSelectedStream:()=>f,setOnStreams:e=>{p=e},destroy:()=>{m=!0;let e=s;s=void 0;for(let e of y)t.removeEventListener(e,b);e?.destroy().catch(()=>{})}}},vs=class extends Error{mediaElement=!0;constructor(e,t){super(e,t),this.name=`MediaElementError`}},ys=e=>!!e&&typeof e==`object`&&e.mediaElement===!0,bs=-20,xs=60,Ss=30,Cs=-5,ws=20,Ts=5,Es=15e3,Ds=1,Os=3,ks=12,As=200,js=250,Ms=25e5,Ns=e=>{let{worker:t}=e,n=setTimeout(()=>t.terminate(),2e3);e.destroy().catch(()=>{}).finally(()=>{clearTimeout(n),t.terminate()})},Ps=async e=>{let{videoElement:t,subtitleContainer:n,read:r,length:i,publicPath:a,libavWorkerUrl:o,jassubWorkerUrl:s,jassubWasmUrl:c,jassubLegacyWasmUrl:l,defaultFontUrl:u,bufferSize:d=Ms,audioStreamIndex:f,onReady:p,onError:m,onRecovered:h,onSeek:g,onSubtitleStreams:_,onAudioStreams:v}=e,y=await eo({publicPath:a,workerUrl:o,workerOptions:{type:`module`},bufferSize:d,length:i,audioStreamIndex:f,read:r}),b=[],x=!1,S=()=>{if(!x){x=!0;for(let e of[...b].reverse())try{e()}catch{}}};b.push(()=>Ns(y));try{let e=await y.init(),r=e.audioStreams??[],i=r.some(e=>e.streamIndex===f)?f:r[0]?.streamIndex??-1;v?.(r,i);let a=_s({video:t,container:n,workerUrl:s,wasmUrl:c,legacyWasmUrl:l,defaultFontUrl:u,onStreams:_});if(b.push(()=>a.destroy()),e.attachments?.length&&a.pushAttachments(e.attachments),!e.info.output.videoMimeType)throw Error(`The video codec in this file could not be identified`);let o=[e.info.output.videoMimeType,e.info.output.audioMimeType].filter(Boolean).join(`,`),d=`video/mp4; codecs="${o}"`;if(!MediaSource.isTypeSupported(d))throw Error(`This browser cannot play the codecs in this file: ${o}`);let C=new MediaSource,w=URL.createObjectURL(C);b.push(()=>URL.revokeObjectURL(w)),t.src=w,b.push(()=>{try{t.pause()}catch{}t.removeAttribute(`src`),t.load()});let T=await new Promise((t,n)=>{let r=setTimeout(()=>{i(),n(Error(`The MediaSource never opened`))},Es),i=()=>{clearTimeout(r),C.removeEventListener(`sourceopen`,a),C.removeEventListener(`sourceclose`,o),C.removeEventListener(`error`,o)},a=()=>{try{let n=C.addSourceBuffer(d);n.mode=`segments`;let r=e.info.input.duration;Number.isFinite(r)&&r>0&&(C.duration=r),i(),t(n)}catch(e){i(),n(e)}},o=()=>{i(),n(Error(`The MediaSource closed before a SourceBuffer could be created`))};C.addEventListener(`sourceopen`,a,{once:!0}),C.addEventListener(`sourceclose`,o,{once:!0}),C.addEventListener(`error`,o,{once:!0})}),{appendBuffer:E,unbufferRange:D,updateTimestampOffset:O,endOfStream:k}=ls(T,C);await E(e.data),e.subtitles?.length&&a.pushFragments(e.subtitles),p?.();let A=!1,j=!1,ee=0,te,M=()=>te??t.currentTime,N=!1,P=0,F=0,I=null,L=0,R=0,z=!1,ne=0,re=(e,t,n=!1)=>{let r=e?.message===`Cancelled`;t&&r||(console.error(e),(!z||n)&&(z=!0,m?.(r?Error(`Reading the video file failed`,{cause:e}):e)))},ie=async(e=!1)=>{if(ee>0&&!e)return;let n=t.currentTime,r=e?Cs:bs,i=e?ws:xs;for(let{start:e,end:t}of ss(T))e<n+r&&await D(e,n+r),t>n+i&&await D(n+i,t)},B=()=>{let e=ss(T);if(!e.length)return!0;let t=M(),n=e.find(e=>e.start<=t+Ds&&t<e.end);return n&&n.end>=t+xs?!1:!n||n.end<t+Ss},ae=()=>{let e=t.currentTime;return ss(T).find(t=>t.start<=e+Ds&&e<t.end)},oe=()=>{let e=ae();return!!e&&e.end>=R-.1},se=()=>{let e=ss(T).map(e=>e.end);e.length&&(R=Math.max(R,...e))},ce=async e=>{j=!0,I=null,L=0,ne=e;let t=++F;try{let{data:n,pts:r,subtitles:i,finished:o}=await y.seek(e);if(x||t!==F||(o&&(N=!0),i?.length&&a.pushFragments(i),await O(r),x||t!==F))return;n.byteLength&&(await E(n),se())}catch(e){re(e,x||t!==F)}finally{t===F&&(j=!1)}},le=async()=>{let e=I;if(e)try{await E(e),se(),I===e&&(I=null,L=0)}catch(n){if(I!==e)return;if(n?.name===`QuotaExceededError`){let n=await ie(!0).then(()=>!0,()=>!1);if(I!==e)return;if(n){N=!1,await ce(ae()?.end??t.currentTime);return}}if(L+=1,L<Ts)return;throw I=null,n}},ue=async()=>{if(A||j||be!==void 0||x||!I&&(N||!B()))return;let e=++P,t=F,n=()=>x||e!==P||t!==F;A=!0;try{if(!I){let{data:e,subtitles:t,finished:r}=await y.read();if(n()||(r&&(N=!0),t?.length&&a.pushFragments(t),!e.byteLength))return;I=e,L=0}await le(),!n()&&z&&(z=!1,h?.())}catch(e){re(e,n())}finally{e===P&&(A=!1)}},de=e=>e>=ne&&!!ae(),fe=e=>ss(T).some(t=>t.start<=e+Ds&&e<t.end),pe=e=>{let t=ss(T).find(t=>t.start<=e+Ds&&e<t.end);return t?t.end-e:0},me=async e=>{if(!x&&!(pe(e)>=Os)){N=!1,ee++,te=e;try{fe(e)||await ce(e);let t=F;for(let n=0;n<ks&&!(x||t!==F||N||pe(e)>=Os);n++){let t=pe(e);if(await ue(),pe(e)<=t)break}}finally{ee--,te===e&&(te=void 0)}}},he=0,ge=null,_e,ve=e=>{let t=performance.now(),n=t-he;if(n>=As){he=t,ge=null,g?.(e);return}ge=e,!_e&&(_e=setTimeout(()=>{_e=void 0;let e=ge;ge=null,!(e===null||x)&&(he=performance.now(),g?.(e))},As-n))};b.push(()=>{_e&&clearTimeout(_e)});let ye=0,be;b.push(()=>{be&&clearTimeout(be)});let V=()=>{let n=t.currentTime,r=e.info.input.duration||t.duration;r>0&&ve(Math.min(Math.max(n/r,0),1));let i=performance.now(),a=i-ye<js;if(ye=i,!de(n)&&!(j&&Math.abs(n-ne)<.001)){if(N=!1,be&&clearTimeout(be),!a){be=void 0,ce(n);return}be=setTimeout(()=>{if(be=void 0,x)return;let e=t.currentTime;de(e)||(N=!1,ce(e))},js)}};t.addEventListener(`seeking`,V),b.push(()=>t.removeEventListener(`seeking`,V));let H=!1,U=()=>{if(H)return;H=!0;let e=t.error;re(new vs(`the media element failed: ${e?.message??`unknown`}`,{cause:e}),!1,!0)};t.addEventListener(`error`,U),b.push(()=>t.removeEventListener(`error`,U));let xe=setInterval(()=>{H||t.error||(ie().catch(()=>{}),ue().catch(e=>re(e,!1)),N&&!I&&oe()&&C.readyState===`open`&&k().catch(()=>{}))},100);return b.push(()=>clearInterval(xe)),{destroy:S,prepareSeek:me,videoElement:t,selectSubtitleStream:e=>a.selectStream(e),indexes:e.indexes??[],chapters:e.chapters??[],duration:e.info.input.duration,videoMimeType:e.info.output.videoMimeType,audioMimeType:e.info.output.audioMimeType}}catch(e){throw S(),e}},Fs=5,Is=500,Ls=320,Rs=1e6,zs=3,Bs=1e4,Vs=1.5,Hs=4e6,Us=3e4,Ws=async e=>{let{publicPath:t,workerUrl:n,length:r,read:i,onThumbnails:a,width:o=Ls}=e,s=await to({publicPath:t,workerUrl:n,workerOptions:{type:`module`},length:r,read:i});try{let t=await s.init(),n=t.duration,i=Math.max(e.interval??Fs,n/Is),c=[],l=e=>{let t=[];for(let[a,o]of e.entries()){let s=t.at(-1);s&&o.timestamp-s.timestamp<i||t.push({timestamp:o.timestamp,endTime:n,startByte:o.pos,endByte:Math.min((e[a+1]?.pos??r)+Rs,r),done:!1,attempts:0})}for(let[e,r]of t.entries())r.endTime=t[e+1]?.timestamp??n;return t.length>1&&t.at(-1).timestamp>n-i*2&&t.pop(),t};c=l(t.indexes);let u=[],d=!1,f=[],p=!1,m,h=-1,g=!1,_=!1,v,y=()=>{let e=m;if(e!==void 0){let t=f.findIndex(({timestamp:t,endTime:n})=>t<=e&&e<n);if(t>=0)return t}return 0},b=()=>{let e=[];for(let[t,n]of u.entries()){n.startTime-(e.at(-1)?.endTime??0)>.01&&e.push({url:``,startTime:e.at(-1)?.endTime??0,endTime:n.startTime}),e.push(n);let r=u[t+1];r&&r.startTime-n.endTime>.01&&e.push({url:``,startTime:n.endTime,endTime:r.startTime})}let t=e.at(-1)?.endTime??0;n-t>.01&&e.push({url:``,startTime:t,endTime:n}),a(e)},x=async e=>{if(d)return;let t=await Promise.race([s.readKeyframe(e.timestamp),new Promise((e,t)=>setTimeout(()=>t(Error(`timed out`)),Bs))]),n=await createImageBitmap(new Blob([t],{type:`image/png`})),r=new OffscreenCanvas(o,Math.max(1,Math.round(n.height*(o/n.width))));r.getContext(`2d`).drawImage(n,0,0,r.width,r.height),n.close();let i=await r.convertToBlob({type:`image/webp`,quality:.7});d||(u=[...u,{url:URL.createObjectURL(i),startTime:e.timestamp,endTime:e.endTime}].sort((e,t)=>e.startTime-t.startTime),b())},S=()=>{if(p||d||_)return;if(g){g=!1;let e=v;w(T(e)).then(()=>{E(e),S()});return}if(!f.length)return;let e=f.splice(y(),1)[0];p=!0,x(e).catch(()=>{e.attempts+=1,e.done=e.attempts>=zs}).finally(()=>{p=!1,S()})},C=e=>{e.done=!0,f.push(e),S()},w=async e=>{_=!0;try{let t=await Promise.race([s.init(),new Promise((e,t)=>setTimeout(()=>t(Error(`timed out`)),Us))]);if(d)return;h=e;let n=l(t.indexes);if(!n.length)return;let r=new Map(u.map(e=>[e.startTime,e]));for(let e of n)r.has(e.timestamp)&&(e.done=!0);c=n;let i=new Set(n.map(e=>e.timestamp));for(let e of u)i.has(e.startTime)||URL.revokeObjectURL(e.url);u=n.filter(e=>r.has(e.timestamp)).map(e=>({url:r.get(e.timestamp).url,startTime:e.timestamp,endTime:e.endTime})),f.length=0,b()}catch{}finally{_=!1}},T=e=>e?e.reduce((e,[,t])=>Math.max(e,t),0):r,E=e=>{for(let t of c)t.done||(!e||e.some(([e,n])=>e<=t.startByte&&t.endByte<=n))&&C(t)};return b(),{update:e=>{if(d)return;v=e;let t=T(e);h<0?h=t:(t>=Math.max(h*Vs,h+Hs)||t>=r&&h<r)&&(g=!0),E(e),S()},prioritize:e=>{d||(m=e)},destroy:()=>{d=!0,f.length=0;for(let e of u)URL.revokeObjectURL(e.url);u=[],Ns(s)}}}catch(e){throw Ns(s),e}},Gs=1280,Ks=1920,qs=250,Js=100,Ys=()=>typeof HTMLCanvasElement<`u`&&`captureStream`in HTMLCanvasElement.prototype,Xs=()=>typeof document<`u`&&typeof HTMLVideoElement<`u`&&typeof HTMLVideoElement.prototype.requestPictureInPicture==`function`&&!!document.pictureInPictureEnabled,Zs=()=>typeof HTMLVideoElement<`u`&&`mozCaptureStream`in HTMLVideoElement.prototype,Qs=()=>Ys()?Xs()?`window`:Zs()?`burn-in`:null:null,$s=e=>{let{video:t,subtitles:n}=e,r=e.mode??Qs()??`window`,i=e.maxWidth??(r===`burn-in`?Ks:Gs),a,o,s,c=!1,l=!1,u=!1,d=!1,f,p=()=>r===`burn-in`?!!a:!!a&&document.pictureInPictureElement===a.mirror,m=(e,r)=>{r.drawImage(t,0,0,e.width,e.height);let i=n.querySelector(`canvas`);i&&i.width>0&&i.height>0&&r.drawImage(i,0,0,e.width,e.height)},h=()=>{a&&m(a.composite,a.context)},g=`requestVideoFrameCallback`in t,_=()=>{h(),v()},v=()=>{d||!a||(o=g?t.requestVideoFrameCallback(_):requestAnimationFrame(_))},y=()=>{o!==void 0&&(g?t.cancelVideoFrameCallback(o):cancelAnimationFrame(o)),s!==void 0&&clearInterval(s),o=void 0,s=void 0},b=()=>{`mediaSession`in navigator&&(navigator.mediaSession.playbackState=t.paused?`paused`:`playing`)},x=()=>{c||l||!t.paused||t.play().catch(()=>{})},S=()=>{c||l||(t.paused||t.pause(),r!==`burn-in`&&(c=!0,a?.mirror.play().catch(()=>{}).finally(()=>{c=!1})))},C=()=>{b(),a?.mirror.play().catch(()=>{})},w=()=>{b(),r===`burn-in`&&a?.mirror.pause()},T=()=>{if(r!==`burn-in`||!a||!t.paused||l)return;l=!0;let{mirror:e}=a;h(),e.play().then(()=>new Promise(e=>{setTimeout(e,Js)})).catch(()=>{}).finally(()=>{e.pause(),setTimeout(()=>{l=!1},Js)})},E=[[`play`,()=>{t.play().catch(()=>{})}],[`pause`,()=>t.pause()]],D=e=>{if(`mediaSession`in navigator)for(let[t,n]of E)try{navigator.mediaSession.setActionHandler(t,e?n:null)}catch{}},O=()=>{if(y(),D(!1),t.removeEventListener(`play`,C),t.removeEventListener(`pause`,w),t.removeEventListener(`seeked`,T),!a){f?.();return}let{stream:e,mirror:n}=a;n.removeEventListener(`play`,x),n.removeEventListener(`pause`,S),n.removeEventListener(`leavepictureinpicture`,k);for(let t of e.getTracks())t.stop();n.remove(),a=void 0,f?.()},k=()=>O(),A=e=>{let r=t.style.opacity,i=n.style.display;e.style.cssText=`position:absolute;inset:0;width:100%;height:100%;object-fit:contain;background:#000;z-index:1`,t.style.opacity=`0`,n.style.display=`none`,f=()=>{f=void 0,t.style.opacity=r,n.style.display=i}},j=async()=>{let n=Math.min(t.videoWidth||i,i),o=Math.round(n*((t.videoHeight||9)/(t.videoWidth||16))),c=document.createElement(`canvas`);c.width=n,c.height=o;let l=c.getContext(`2d`);if(!l)throw Error(`the picture in picture composite has no 2d context`);let u=document.createElement(`video`);u.muted=!0,u.playsInline=!0,r===`burn-in`?A(u):u.style.cssText=`position:fixed;width:1px;height:1px;opacity:0;pointer-events:none;left:-1px;top:-1px`,m(c,l);let f={composite:c,context:l,stream:c.captureStream(),mirror:u};if(a=f,u.srcObject=f.stream,(e.container??t.parentElement??document.body).appendChild(u),v(),s=setInterval(()=>{t.paused&&h()},qs),u.play().catch(()=>{}),u.readyState===0&&await new Promise(e=>{let t=()=>{clearTimeout(n),e()},n=setTimeout(t,1e3);u.addEventListener(`loadedmetadata`,t,{once:!0})}),d||a!==f){u.remove();return}if(u.addEventListener(`play`,x),u.addEventListener(`pause`,S),u.addEventListener(`leavepictureinpicture`,k),t.addEventListener(`play`,C),t.addEventListener(`pause`,w),t.addEventListener(`seeked`,T),D(!0),b(),r===`burn-in`){t.paused&&u.pause(),e.onBurnedInChange?.(!0);return}await u.requestPictureInPicture()};return{toggle:async()=>{if(!(d||u)){u=!0;try{if(p()){if(r===`burn-in`){O(),e.onBurnedInChange?.(!1);return}await document.exitPictureInPicture().catch(()=>{});return}r!==`burn-in`&&document.pictureInPictureElement&&await document.exitPictureInPicture().catch(()=>{});try{await j()}catch(t){console.warn(`subtitle compositing for picture in picture failed`,t),O(),r===`burn-in`&&e.onBurnedInChange?.(!1)}}finally{u=!1}}},mode:r,destroy:()=>{d=!0,r!==`burn-in`&&p()&&document.exitPictureInPicture().catch(()=>{}),O(),r===`burn-in`&&e.onBurnedInChange?.(!1)}}};function ec(e){return typeof e==`string`}function tc(e){return typeof e==`number`}function K(e){return typeof e==`function`}function nc(e){return e===null}function q(e){return e===void 0}function rc(e){return typeof e==`object`&&!!e}function ic(e,t){let n={...t};for(let t in e)q(e[t])||(n[t]=e[t]);return n}function ac(e,t){let n={};for(let r of t)Object.hasOwn(e,r)&&(n[r]=e[r]);return n}var oc=Object.prototype.hasOwnProperty;function sc(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!oc.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var cc=new Map,lc=new Set;function uc(e){return e.trim().replaceAll(`_`,`-`).toLowerCase()}function dc(e){let t=e.indexOf(`-x-`),n=(t===-1?e:e.slice(0,t)).indexOf(`-u-`);return n===-1?e:e.slice(0,n)+(t===-1?``:e.slice(t))}function fc(e){if(e[0]!==`zh`)return;let t=e.find(e=>e===`hant`||e===`hans`);return t===`hant`?`zh-tw`:t===`hans`?`zh-cn`:void 0}function pc(e){return dc(uc(e))}function mc(e){let t=pc(e);if(!t)return[`en`];let n=t.split(`-`).filter(Boolean),r=[];for(let e=n.length;e>=1;e--)r.push(n.slice(0,e).join(`-`));let i=fc(n),a=r.indexOf(`zh`);i&&a!==-1&&r.splice(a,0,i);let o=[],s=new Set;for(let e of r)s.has(e)||(s.add(e),o.push(e));return s.has(`en`)||o.push(`en`),o}function hc(e){let t={};for(let n=e.length-1;n>=0;n--){let r=e[n],i=cc.get(r);i&&Object.assign(t,i)}return t}function gc(e){return hc(mc(e))}function _c(e){return lc.add(e),()=>{lc.delete(e)}}function vc(e){return typeof e==`string`?e:e.text}function yc(e){return rc(e)&&`key`in e&&`text`in e}var bc=/\{([^{}]+)\}/g;function xc(e,t){return t?e.replace(bc,(e,n)=>Object.hasOwn(t,n)?String(t[n]):e):e}function Sc(e,t,n){return typeof e==`string`?e:typeof t==`function`?t(e,n):xc(vc(e),t??n)}function Cc(e,t){return(t,n)=>{let r=n,i=typeof t!=`string`,a=i?t.key:t,o=e[a],s=r?.default,c=r?{...r}:void 0;return c&&delete c.default,xc(o??(i?t.text:s)??String(a),c)}}r();var wc=M(null);M(void 0);function Tc(){let t=e(wc),[n,r]=N(e=>e+1,0);m(()=>_c(()=>r()),[]);let i=b(()=>Cc(gc(`en`),`en`),[n]);return t?t.translator:i}function Ec(){return e(wc)?.locale??`en`}function Dc(e){let t=e.closest(`[dir]`)?.getAttribute(`dir`);return t?t.toLowerCase()===`rtl`:getComputedStyle(e).direction===`rtl`}function Oc(e){let t=e.composedPath();return t.length>0?t[0]:e.target}function kc(e,t,n){return new Promise((r,i)=>{let a=()=>{i(n?.signal?.reason??`Aborted`)};if(n?.signal?.aborted){a();return}n?.signal?.addEventListener(`abort`,a,{once:!0}),e.addEventListener(t,e=>{n?.signal?.removeEventListener(`abort`,a),r(e)},{...n,once:!0})})}function Ac(e=document){let t=e.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}function jc(){return typeof CSS<`u`&&CSS.supports(`anchor-name: --a`)}var Mc=[`button`,`input`,`select`,`textarea`,`a[href]`,`[role="button"]`,`[role="menu"]`,`[role="menuitem"]`,`[role="menuitemcheckbox"]`,`[role="menuitemradio"]`,`[role="slider"]`,`[data-interactive]`].join(`,`),Nc=[`textarea`,`select`,`input:not([type])`,...[`text`,`search`,`url`,`tel`,`email`,`password`,`number`].map(e=>`input[type="${e}"]`),`[contenteditable]:not([contenteditable="false"])`].join(`,`);function Pc(e){return e.matches(Nc)}function Fc(e){let t=Oc(e);return t instanceof Element&&Pc(t)}function Ic(e){let t=Oc(e);return t instanceof Element&&t.closest(Mc)!==null}var Lc=new Set([` `,`Enter`]),Rc=`button,a[href],[role="slider"],[role="button"]`;function zc(e){if(!Lc.has(e.key))return!1;let t=Oc(e);return t instanceof Element&&t.matches(Rc)}function J(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function Bc(){return typeof navigator<`u`&&/mac/i.test(navigator.userAgent)}var Vc={sideOffset:0,boundaryOffset:0},Hc={top:`bottom`,bottom:`top`,left:`right`,right:`left`};function Uc(e,t,n,r){let i=r.boundaryOffset??0;switch(n){case`top`:return e.top-t.top-i-r.sideOffset;case`bottom`:return t.bottom-e.bottom-i-r.sideOffset;case`left`:return e.left-t.left-i-r.sideOffset;case`right`:return t.right-e.right-i-r.sideOffset}}function Wc(e,t,n,r,i=Vc){let a=r.side,o=Hc[a],s=a===`top`||a===`bottom`?t.height:t.width,c=Uc(e,n,a,i);return c>=s?a:Uc(e,n,o,i)>c?o:a}function Gc(e){try{e?.showPopover?.()}catch{}}function Kc(e){try{e?.hidePopover?.()}catch{}}function qc(e){return e instanceof Node&&e.nodeType===11&&`host`in e}function Jc(e,t){let n=t.trim();if(!n)return 0;let r=Number.parseFloat(n);if(!Number.isNaN(r)&&(/^-?\d*\.?\d+$/.test(n)||n.endsWith(`px`)))return r;let i=e.ownerDocument,a=i?.documentElement;if(!Number.isNaN(r)&&n.endsWith(`rem`))return r*(a&&Number.parseFloat(getComputedStyle(a).fontSize)||16);if(!Number.isNaN(r)&&n.endsWith(`em`))return r*(e instanceof HTMLElement&&Number.parseFloat(getComputedStyle(e).fontSize)||16);if(!i)return Number.isNaN(r)?0:r;let o=i.createElement(`div`);if(o.style.position=`absolute`,o.style.visibility=`hidden`,o.style.pointerEvents=`none`,o.style.inlineSize=n,!o.style.inlineSize)return 0;o.style.blockSize=`0`,o.style.padding=`0`,o.style.border=`0`,o.style.inset=`0`;let s=getComputedStyle(e);o.style.fontSize=s.fontSize;for(let e=0;e<s.length;e++){let t=s.item(e);t.startsWith(`--`)&&o.style.setProperty(t,s.getPropertyValue(t))}let c=i.body??i.documentElement;if(!c)return Number.isNaN(r)?0:r;if(c.appendChild(o),getComputedStyle(o).inlineSize===`auto`)return o.remove(),0;let l=o.getBoundingClientRect().width;return o.remove(),Number.isFinite(l)?l:Number.isNaN(r)?0:r}function Yc(e){return e.kind===`captions`||e.kind===`subtitles`}function Xc(e,t){if(!(e instanceof HTMLElement))return null;for(let n of e.querySelectorAll(`track`))if(n.track===t)return n;return null}function Zc(e,t){return e.textTracks?Array.from(e.textTracks).filter(t).sort(Qc):[]}function Qc(e,t){return e.kind>t.kind?1:e.kind<t.kind?-1:0}function $c(e){let t=[];for(let n=0;n<e.length;n++)t.push([e.start(n),e.end(n)]);return t}function el(e,t){let n=t;for(;n;){if(n===e||e.contains(n))return!0;let t=n.getRootNode();n=qc(t)?t.host:n.parentNode}return!1}function tl(){return`WebKitPlaybackTargetAvailabilityEvent`in globalThis}function nl(e){return tl()&&`webkitCurrentPlaybackTargetIsWireless`in e}r();function rl(e,t){if(K(e))return e(t);e!=null&&(e.current=t)}function il(...e){let t=e.flat();return e=>{let n=t.map(t=>rl(t,e));if(n.some(K))return()=>{for(let e=0;e<n.length;e++){let r=n[e];K(r)?r():rl(t[e],null)}}}}function al(...e){return p(il(...e),[...e])}r();function ol(e,t,n,r=sc){let i=o(void 0),a=()=>{let e=n(t());return i.current!==void 0&&r(i.current,e)?i.current:(i.current=e,e)};return c(e,a,a)}function sl(e){return e}function cl(...e){}function ll(e,t,n){let r=n?.leading??!1,i=null,a,o=!1;function s(){i=setTimeout(()=>{i=null,o&&(o=!1,e(...a),s())},t)}let c=(...n)=>{if(a=n,r)i===null?(e(...a),s()):o=!0;else{if(i!==null)return;i=setTimeout(()=>{i=null,e(...a)},t)}};return c.cancel=()=>{i!==null&&(clearTimeout(i),i=null),o=!1},c}function ul(e,t,n){return ol(t=>e.subscribe(t),()=>e.current,t??sl,n)}var dl=()=>cl;function fl(e,t,n){return ol(t?t=>e.subscribe(t):dl,t?()=>e.state:()=>e,t??sl,n)}r();var pl=M(null),ml=()=>{},hl={state:{},subscribe:()=>ml};function gl({value:e,children:t}){return F(pl.Provider,{value:e,children:t})}function _l(){let t=e(pl);if(!t)throw Error(`usePlayerContext must be used within a Player Provider`);return t}function vl(e){let{store:t}=_l();return fl(t,e)}function yl(t){let n=e(pl),r=fl(n?.store??hl,n?t:void 0);return n?r:void 0}function bl(){let{media:e}=_l();return e}function xl(){let{container:e}=_l();return e}function Sl(){return e(pl)?.container??null}function Cl(){return e(pl)?.popupGroup}function wl(){return e(pl)?.setMedia}function Tl(){return e(pl)?.setContainer}function El(e){if(`any`in AbortSignal)return AbortSignal.any(e);let t=new AbortController;for(let n of e){if(n.aborted)return t.abort(n.reason),t.signal;n.addEventListener(`abort`,()=>t.abort(n.reason),{signal:t.signal})}return t.signal}var Dl=class{#e=new AbortController;#t=new Map;get base(){return this.#e.signal}clear(){for(let e of this.#t.values())e.abort();this.#t.clear()}reset(){this.clear(),this.#e.abort(),this.#e=new AbortController}supersede(e){this.#t.get(e)?.abort();let t=new AbortController;return this.#t.set(e,t),El([this.#e.signal,t.signal])}};function Ol(...e){return{state:t=>{let n=e.map(e=>e.state(t));return Object.assign({},...n)},attach:t=>{for(let n of e)try{n.attach?.(t)}catch(e){t.reportError(e)}}}}var kl=class extends Error{code;cause;constructor(e,t){super(t?.message??e),this.name=`StoreError`,this.code=e,this.cause=t?.cause}};function Al(){throw new kl(`NO_TARGET`)}function jl(){throw new kl(`DESTROYED`)}var Ml={target:Al,signals:new Dl,get:Al,set:Al};function Nl(e){let t=e.state(Ml),n=Object.keys(t),r=n[0];return Object.assign(r?e=>{if(r in e)return ac(e,n)}:()=>void 0,{displayName:e.name})}function Pl(){return e=>e}var Fl=!1;function Il(){Fl||(Fl=!0,queueMicrotask(Rl))}var Ll=new Set;function Rl(){Fl=!1;for(let e of Ll)e.flush();Ll.clear()}var zl=Object.prototype.hasOwnProperty,Bl=class{#e;#t=new Set;#n=!1;constructor(e){this.#e=Object.freeze({...e})}get current(){return this.#e}patch(e){let t={...this.#e},n=!1;for(let r in e){if(!zl.call(e,r))continue;let i=e[r];Object.is(this.#e[r],i)||(t[r]=i,n=!0)}n&&(this.#e=Object.freeze(t),this.#r())}subscribe(e,t){let n=t?.signal;if(n?.aborted)return cl;if(this.#t.add(e),!n)return()=>this.#t.delete(e);let r=()=>this.#t.delete(e);return n.addEventListener(`abort`,r,{once:!0}),()=>{n.removeEventListener(`abort`,r),this.#t.delete(e)}}flush(){if(this.#n){this.#n=!1;for(let e of this.#t)e()}}#r(){this.#n=!0,Ll.add(this),Il()}};function Vl(e){return new Bl(e)}var Hl=Symbol.for(`@videojs/store`);function Ul(){return(e,t={})=>{let n=null,r=!1,i=new AbortController,a=new Dl,o;function s(){r&&jl(),n||Al()}let c=e.state({target:()=>(s(),n),signals:a,get:()=>o.current,set:e=>o.patch(e)});o=Vl(c);let l={[Hl]:!0,get $state(){return o},get target(){return n},get destroyed(){return r},get state(){return o.current},attach:u,destroy:f,subscribe:p};for(let e of Object.keys(c))Object.defineProperty(l,e,{get:()=>o.current[e],enumerable:!0});try{t.onSetup?.({store:l,signal:i.signal})}catch(e){m(e)}return l;function u(i){r&&jl(),a.reset(),n=i;let s={target:i,signal:a.base,get:()=>o.current,set:e=>o.patch(e),reportError:m,store:{get state(){return o.current},subscribe:p}};try{e.attach?.(s)}catch(e){m(e)}try{t.onAttach?.({store:l,target:i,signal:a.base})}catch(e){m(e)}return d}function d(){nc(n)||(a.reset(),n=null,o.patch(c))}function f(){r||(r=!0,d(),i.abort())}function p(e,t){return o.subscribe(e,t)}function m(e){t.onError?t.onError({store:l,error:e}):console.error(`[vjs-store]`,e)}}}var Wl=Pl();function Gl(e,t){if(arguments.length===1)return Wl(e);let{name:n,state:r,attach:i}=e,a=e=>Wl({...q(n)?{}:{name:n},state:t=>r(t,e),...i?{attach:t=>i(t,e)}:{}}),o=a(t),s=(e=>q(e)?o:a(e));return s.state=o.state,o.attach&&(s.attach=o.attach),q(n)||Object.defineProperty(s,"name",{value:n}),s}var Kl=Object.freeze({length:0,start:()=>0,end:()=>0}),ql=Object.assign(new EventTarget,{length:0,*[Symbol.iterator](){},getTrackById:()=>null}),Jl=new EventTarget;Object.freeze({});var Yl=class e extends Error{static MEDIA_ERR_ABORTED=1;static MEDIA_ERR_NETWORK=2;static MEDIA_ERR_DECODE=3;static MEDIA_ERR_SRC_NOT_SUPPORTED=4;static MEDIA_ERR_ENCRYPTED=5;static MEDIA_ERR_CUSTOM=100;static defaultMessages={1:`You stopped media playback before it finished.`,2:`This media could not be loaded due to a network or server issue.`,3:`This media could not be played. It may be corrupted, or your browser may not support its format.`,4:`This media could not be loaded. It may be unavailable, or your browser may not support its format.`,5:`This media could not be played because it could not be decrypted.`};name;code;context;fatal;data;constructor(t,n=e.MEDIA_ERR_CUSTOM,r,i){super(t),this.name=`MediaError`,this.code=n,this.context=i,this.fatal=r??(n>=e.MEDIA_ERR_NETWORK&&n<=e.MEDIA_ERR_ENCRYPTED),this.message||=e.defaultMessages[this.code]??``}};function Xl(e){return e.readyState>=1}function Zl(e){if(!rc(e))return!1;let t=e;return!q(t.paused)&&!q(t.ended)&&K(t.pause)}function Ql(e){if(!rc(e))return!1;let t=e;return!q(t.currentTime)&&!q(t.duration)&&!q(t.seeking)}function $l(e){if(!rc(e))return!1;let t=e;return!q(t.src)&&!q(t.currentSrc)&&!q(t.readyState)&&K(t.load)}function eu(e){if(!rc(e))return!1;let t=e;return!q(t.volume)&&!q(t.muted)}function tu(e){return rc(e)?!q(e.playbackRate):!1}function nu(e){if(!rc(e))return!1;let t=e;return!q(t.buffered)&&t.buffered!==Kl&&!q(t.seekable)&&t.seekable!==Kl}function ru(e){return rc(e)?!q(e.error):!1}function iu(e){if(!rc(e))return!1;let t=e;return!q(t.textTracks)&&t.textTracks!==ql}function au(e){return rc(e)?!q(e.videoRenditions):!1}function ou(e){return rc(e)?!q(e.audioTracks):!1}function su(e){if(!rc(e))return!1;let t=e;return!q(t.videoWidth)&&!q(t.videoHeight)}function cu(e){if(!rc(e))return!1;let t=e;return rc(t.remote)&&t.remote!==Jl}function lu(e){return rc(e)?!q(e.streamType):!1}function uu(e){if(!rc(e))return!1;let t=e;return!q(t.liveEdgeStart)&&!q(t.targetLiveWindow)}function du(e){return rc(e)&&`querySelectorAll`in e&&K(e.querySelectorAll)}var fu={ON_DEMAND:`on-demand`,LIVE:`live`,UNKNOWN:`unknown`};function pu(e,t){return e.id||String(t)}function mu(e){return{...e.id!==void 0&&{id:e.id},...e.kind!==void 0&&{kind:e.kind},label:e.label,language:e.language,enabled:e.enabled}}var hu=Gl({name:`audioTrack`,state:({target:e})=>({audioTrackList:[],selectAudioTrack(t){let{media:n}=e();if(!ou(n))return;let r=[...n.audioTracks],i=r.find((e,n)=>pu(e,n)===t);if(i)for(let e of r)e.enabled=e===i}}),attach({target:e,signal:t,set:n}){let{media:r}=e,i=null,a=null,o=()=>ou(r)?r.audioTracks:null,s=(e=o())=>{n({audioTrackList:e?[...e].map(mu):[]})},c=()=>{let e=o();if(e===i){s(e);return}a?.abort(),a=new AbortController,i=e,i&&(J(i,`addtrack`,()=>s(i),{signal:a.signal}),J(i,`removetrack`,()=>s(i),{signal:a.signal}),J(i,`change`,()=>s(i),{signal:a.signal})),s(i)};c(),J(r,`loadstart`,c,{signal:t}),t.addEventListener(`abort`,()=>a?.abort(),{once:!0})}}),gu=Gl({name:`buffer`,state:()=>({buffered:[],seekable:[]}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!nu(r))return;let i=()=>n({buffered:$c(r.buffered),seekable:$c(r.seekable)});i(),J(r,`progress`,i,{signal:t}),J(r,`emptied`,i,{signal:t})}});function _u(e,t,n){if(n.size===0)return null;let r=e-t.left,i=t.width;if(i===0)return null;let a=r/i;return n.size===2&&n.has(`left`)&&n.has(`right`)?a<.5?`left`:`right`:n.size===3?a<1/3?`left`:a<2/3?`center`:`right`:n.has(`left`)&&a<.5?`left`:n.has(`right`)&&a>=.5?`right`:n.has(`center`)&&(n.size===1||a>=1/3&&a<2/3)?`center`:null}var vu=250,yu=class{#e;#t=[];#n=new Set;#r=null;#i=new Set;constructor(e){this.#e=e}get bindings(){return this.#t}subscribe(e){return this.#i.add(e),()=>this.#i.delete(e)}claimsTap(e,t){return!Ic(e)&&this.#t.some(n=>n.type===`tap`&&n.action===t&&(!n.pointer||n.pointer===e.pointerType))}add(e){let t={...e,onActivate:t=>{if(this.#i.size>0){let n={type:e.type,source:`gesture`,action:e.action,value:e.value,region:e.region,pointer:e.pointer,event:t};for(let e of this.#i)try{e(n)}catch{}}e.onActivate(t)}};this.#t.push(t),this.#n.add(t.recognizer),this.#a();let n=!1;return()=>{if(n)return;n=!0;let e=this.#t.indexOf(t);e!==-1&&this.#t.splice(e,1),this.#o()}}#a(){if(this.#r)return;this.#r=new AbortController;let{signal:e}=this.#r,t=0;J(this.#e,`pointerdown`,e=>{e.button===0&&(t=Date.now())},{signal:e}),J(this.#e,`pointerup`,e=>{if(e.button!==0||Date.now()-t>vu||Ic(e))return;let n=e.pointerType,r=e.clientX,i=this.#e,a=this.#t,o={resolve:e=>Cu(a,e,n,r,i)};for(let t of this.#n)t.handleUp(o,e)},{signal:e})}#o(){if(!(this.#t.length>0)){for(let e of this.#n)e.reset();this.#n.clear(),this.#r?.abort(),this.#r=null}}},bu=new WeakMap;function xu(e){return bu.get(e)}function Su(e){let t=bu.get(e);return t||(t=new yu(e),bu.set(e,t)),t}function Cu(e,t,n,r,i){let a=i.getBoundingClientRect(),o=wu(e,t,n),s=o.size>0?_u(r,a,o):null,c=[];for(let r of e)if(!r.disabled&&r.type===t&&!(r.pointer&&r.pointer!==n)){if(r.region){if(r.region!==s)continue}else if(s!==null)continue;c.push(r)}return c}function wu(e,t,n){let r=new Set;for(let i of e)i.disabled||i.type===t&&(i.pointer&&i.pointer!==n||i.region&&r.add(i.region));return r}function Tu(e){let t=e;if(rc(t.remote)&&`state`in t.remote&&`prompt`in t.remote)return t.remote}function Eu(e){return Tu(e)?.state===`connected`}function Du(e){return Tu(e)?.state===`connecting`}async function Ou(e){let t=Tu(e);if(!t)throw new DOMException(`Remote playback not supported`,`NotSupportedError`);return t.prompt()}var ku=2e3,Au=250,ju=500,Mu=Gl({name:`controls`,state:({get:e,set:t})=>({userActive:!0,controlsVisible:!0,toggleControls(){let n=!e().userActive;return t({userActive:n,controlsVisible:n}),n}}),attach({target:e,signal:t,get:n,set:r}){let{media:i,container:a}=e;if(!Zl(i)||nc(a))return;let o=e=>e||i.paused||Eu(i)||Du(i),s;function c(){clearTimeout(s),s=void 0}function l(){c(),s=setTimeout(d,ku)}function u(){n().userActive||r({userActive:!0,controlsVisible:!0}),l()}function d(){c(),r({userActive:!1,controlsVisible:o(!1)})}r({toggleControls(){return n().controlsVisible?d():u(),n().controlsVisible}});let f=0,p=0,m=()=>p>0&&Date.now()-p<ju;function h(e){f=Date.now(),e.pointerType===`touch`&&(p=f)}function g(e){if(e.pointerType===`touch`&&(p=Date.now()),e.pointerType===`touch`&&Date.now()-f<Au){if(xu(a)?.claimsTap(e,`toggleControls`))return;let t=[i,a].includes(e.target);n().controlsVisible&&t?d():u()}else u()}let _=()=>{let{userActive:e}=n();r({controlsVisible:o(e)}),!i.paused&&e&&l()};function v(e){if(e.pointerType===`touch`){n().userActive&&l();return}u()}if(J(a,`pointermove`,v,{signal:t}),J(a,`pointerdown`,h,{signal:t}),J(a,`pointerup`,g,{signal:t}),J(a,`keyup`,u,{signal:t}),J(a,`focusin`,()=>{m()||u()},{signal:t}),J(a,`mouseleave`,()=>{m()||d()},{signal:t}),J(i,`play`,_,{signal:t}),J(i,`pause`,_,{signal:t}),J(i,`ended`,_,{signal:t}),cu(i)){let e=()=>{let{userActive:e}=n();r({controlsVisible:o(e)})};J(i.remote,`connect`,e,{signal:t}),J(i.remote,`connecting`,e,{signal:t}),J(i.remote,`disconnect`,e,{signal:t})}t.addEventListener(`abort`,c,{once:!0}),l()}}),Nu=Gl({name:`error`,state:({set:e})=>({error:null,dismissError(){e({error:null})}}),attach({target:e,signal:t,set:n}){let{media:r}=e;ru(r)&&(J(r,`error`,()=>n({error:r.error}),{signal:t}),J(r,`emptied`,()=>n({error:null}),{signal:t}))}});function Pu(){let e=document;return e.fullscreenEnabled||e.webkitFullscreenEnabled?!0:K(document.createElement(`video`).webkitSetPresentationMode)}function Fu(){let e=document;return e.fullscreenElement??e.webkitFullscreenElement??null}function Iu(e){if(!(e instanceof Element))return!1;try{return e.matches(`:fullscreen`)}catch{return!1}}function Lu(e,t){if(t.webkitPresentationMode===`fullscreen`)return!0;let n=Fu();return n&&(n===e||n===t)||Iu(e)||Iu(t)?!0:t.isFullscreen??!1}async function Ru(e,t){let n=document;if(e&&(n.fullscreenEnabled||n.webkitFullscreenEnabled)){let t=e;if(K(t.requestFullscreen))return t.requestFullscreen();if(K(t.webkitRequestFullscreen))return t.webkitRequestFullscreen()}let r=t;if(K(r.webkitSetPresentationMode)){r.webkitSetPresentationMode(`fullscreen`);return}let i=t;if(K(i.requestFullscreen))return i.requestFullscreen()}async function zu(e){let t=document,n=e;if(n.webkitPresentationMode===`fullscreen`&&K(n.webkitSetPresentationMode)){n.webkitSetPresentationMode(`inline`);return}if(K(t.exitFullscreen))return t.exitFullscreen();if(K(t.webkitExitFullscreen))return t.webkitExitFullscreen();let r=e;if(K(r.exitFullscreen))return r.exitFullscreen()}function Bu(){if(document.pictureInPictureEnabled){let e=/.*Version\/.*Safari\/.*/.test(navigator.userAgent),t=typeof matchMedia==`function`&&matchMedia(`(display-mode: standalone)`).matches;return!e||!t}return K(document.createElement(`video`).webkitSetPresentationMode)}function Vu(e){return e.webkitPresentationMode===`picture-in-picture`||document.pictureInPictureElement===e?!0:e.isPictureInPicture??!1}async function Hu(e){let t=e;if(K(t.webkitSetPresentationMode)){t.webkitSetPresentationMode(`picture-in-picture`);return}let n=e;if(K(n.requestPictureInPicture))return n.requestPictureInPicture()}async function Uu(e){let t=e;if(t.webkitPresentationMode===`picture-in-picture`&&K(t.webkitSetPresentationMode)){t.webkitSetPresentationMode(`inline`);return}if(K(document.exitPictureInPicture))return document.exitPictureInPicture();let n=e;if(K(n.exitPictureInPicture))return n.exitPictureInPicture()}var Wu=Gl({name:`fullscreen`,state:({target:e})=>({fullscreen:!1,fullscreenAvailability:`unavailable`,async requestFullscreen(){let{media:t,container:n}=e();return Vu(t)&&await Uu(t),Ru(n,t)},async exitFullscreen(){let{media:t}=e();return zu(t)},async toggleFullscreen(){let{media:t,container:n}=e();return Lu(n,t)?zu(t):(Vu(t)&&await Uu(t),Ru(n,t))}}),attach({target:e,signal:t,set:n}){let{media:r,container:i}=e;n({fullscreenAvailability:Pu()?`available`:`unsupported`});let a=()=>n({fullscreen:Lu(i,r)});a(),J(document,`fullscreenchange`,a,{signal:t}),J(document,`webkitfullscreenchange`,a,{signal:t}),`webkitPresentationMode`in r&&J(r,`webkitpresentationmodechanged`,a,{signal:t})}}),Gu=Gl({name:`live`,state:()=>({liveEdgeStart:NaN,targetLiveWindow:NaN}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!uu(r))return;let i=()=>n({liveEdgeStart:r.liveEdgeStart,targetLiveWindow:r.targetLiveWindow});i(),J(r,`targetlivewindowchange`,i,{signal:t}),J(r,`streamtypechange`,i,{signal:t}),J(r,`loadedmetadata`,i,{signal:t}),J(r,`canplay`,i,{signal:t}),J(r,`progress`,i,{signal:t}),J(r,`durationchange`,i,{signal:t}),J(r,`timeupdate`,i,{signal:t}),J(r,`emptied`,i,{signal:t})}}),Ku=Gl({name:`pip`,state:({target:e})=>({pip:!1,pipAvailability:`unavailable`,async requestPictureInPicture(){let{media:t,container:n}=e();return Lu(n,t)&&await zu(t),Hu(t)},async exitPictureInPicture(){let{media:t}=e();return Uu(t)},async togglePictureInPicture(){let{media:t,container:n}=e();return Vu(t)?Uu(t):(Lu(n,t)&&await zu(t),Hu(t))}}),attach({target:e,signal:t,set:n}){let{media:r}=e;n({pipAvailability:Bu()?`available`:`unsupported`});let i=()=>n({pip:Vu(r)});i(),J(r,`enterpictureinpicture`,i,{signal:t}),J(r,`leavepictureinpicture`,i,{signal:t}),`webkitPresentationMode`in r&&J(r,`webkitpresentationmodechanged`,i,{signal:t})}}),qu=Gl({name:`playback`,state:({target:e})=>({paused:!0,ended:!1,started:!1,waiting:!1,play(){return e().media.play()},pause(){let{media:t}=e();Zl(t)&&t.pause()},togglePaused(){let t=e().media;return Zl(t)?t.paused?(t.play(),!0):(t.pause(),!1):!1}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Zl(r)||!Ql(r)||!$l(r))return;let i=()=>n({paused:r.paused,ended:r.ended,started:!r.paused||r.currentTime>0,waiting:r.readyState<HTMLMediaElement.HAVE_FUTURE_DATA&&!r.paused});i(),J(r,`emptied`,i,{signal:t}),J(r,`play`,i,{signal:t}),J(r,`pause`,i,{signal:t}),J(r,`ended`,i,{signal:t}),J(r,`playing`,i,{signal:t}),J(r,`waiting`,i,{signal:t}),J(r,`seeked`,i,{signal:t})}}),Ju=[.2,.5,.7,1,1.2,1.5,1.7,2],Yu=Gl({name:`playbackRate`,state:({target:e})=>({playbackRates:Ju,playbackRate:1,setPlaybackRate(t){let{media:n}=e();tu(n)&&(n.playbackRate=t)}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!tu(r))return;let i=()=>n({playbackRate:r.playbackRate});i(),J(r,`ratechange`,i,{signal:t})}}),Xu=`auto`;function Zu(e,t){return e.id||String(t)}function Qu(e){return{...e.id!==void 0&&{id:e.id},...e.width!==void 0&&{width:e.width},...e.height!==void 0&&{height:e.height},...e.bitrate!==void 0&&{bitrate:e.bitrate},...e.frameRate!==void 0&&{frameRate:e.frameRate},...e.codec!==void 0&&{codec:e.codec},selected:e.selected}}function $u(e){return e.width&&e.height?Math.min(e.width,e.height):e.height??e.width}var ed=Gl({name:`quality`,state:({target:e})=>({videoRenditionList:[],activeVideoRendition:null,selectVideoRendition(t){let{media:n}=e();if(!au(n))return;if(t===Xu){n.videoRenditions.selectedIndex=-1;return}let r=[...n.videoRenditions].findIndex((e,n)=>Zu(e,n)===t);r!==-1&&(n.videoRenditions.selectedIndex=r)}}),attach({target:e,signal:t,set:n}){let{media:r}=e,i=null,a=null,o=()=>au(r)?r.videoRenditions:null,s=e=>{if(!e)return null;let t=[...e],n=t.find(e=>e.active);if(n)return n;if(!su(r)||!r.videoWidth&&!r.videoHeight)return null;let i=$u({width:r.videoWidth||void 0,height:r.videoHeight||void 0}),a=t.filter(e=>$u(e)===i);return a.length===1?a[0]:null},c=(e=o())=>{let t=s(e);n({videoRenditionList:e?[...e].map(Qu):[],activeVideoRendition:t?Qu(t):null})},l=()=>{let e=o();if(e===i){c(e);return}a?.abort(),a=new AbortController,i=e,i&&(J(i,`addrendition`,()=>c(i),{signal:a.signal}),J(i,`removerendition`,()=>c(i),{signal:a.signal}),J(i,`change`,()=>c(i),{signal:a.signal}),J(i,`activechange`,()=>c(i),{signal:a.signal})),c(i)};l(),J(r,`loadstart`,l,{signal:t}),J(r,`resize`,()=>c(i),{signal:t}),t.addEventListener(`abort`,()=>a?.abort(),{once:!0})}}),td=Gl({name:`remotePlayback`,state:({target:e})=>({remotePlaybackState:`disconnected`,remotePlaybackAvailability:`unsupported`,async toggleRemotePlayback(){let{media:t,container:n}=e();return Eu(t)?Ou(t):(Lu(n,t)&&await zu(t),await Ou(t))}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!cu(r))return;if(nl(r)){let e=()=>{n({remotePlaybackState:r.webkitCurrentPlaybackTargetIsWireless?`connected`:`disconnected`})};J(r,`webkitplaybacktargetavailabilitychanged`,e=>{let{availability:t}=e;n({remotePlaybackAvailability:t===`available`?`available`:`unavailable`})},{signal:t}),J(r,`webkitcurrentplaybacktargetiswirelesschanged`,e,{signal:t}),e();return}let i=()=>n({remotePlaybackState:r.remote.state});i(),J(r.remote,`connect`,i,{signal:t}),J(r.remote,`connecting`,i,{signal:t}),J(r.remote,`disconnect`,i,{signal:t}),r.remote.watchAvailability(e=>{n({remotePlaybackAvailability:e?`available`:`unavailable`})}).catch(()=>{n({remotePlaybackAvailability:`unsupported`})}),t.addEventListener(`abort`,()=>{r.remote?.cancelWatchAvailability?.().catch(()=>{})})}}),nd=Gl({name:`source`,state:({target:e,signals:t})=>({source:null,canPlay:!1,loadSource(n){t.clear();let{media:r}=e();return $l(r)?(r.src=n,r.load(),n):n}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!$l(r))return;let i=()=>n({source:r.currentSrc||r.src||null,canPlay:r.readyState>=HTMLMediaElement.HAVE_ENOUGH_DATA});i(),J(r,`canplay`,i,{signal:t}),J(r,`canplaythrough`,i,{signal:t}),J(r,`loadstart`,i,{signal:t}),J(r,`emptied`,i,{signal:t})}}),rd=Gl({name:`streamType`,state:()=>({streamType:fu.UNKNOWN}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(lu(r)){let e=()=>n({streamType:r.streamType});e(),J(r,`streamtypechange`,e,{signal:t});return}if(!Ql(r))return;let i=()=>{let{duration:e}=r;return e===1/0?fu.LIVE:Number.isFinite(e)&&e>0?fu.ON_DEMAND:fu.UNKNOWN},a=()=>n({streamType:i()});a(),J(r,`durationchange`,a,{signal:t}),J(r,`loadedmetadata`,a,{signal:t}),J(r,`emptied`,a,{signal:t}),nu(r)&&J(r,`progress`,a,{signal:t})}});function id(e,t){return e.id||`track:${t}:${e.kind}:${e.language}:${e.label}`}var ad=Gl({name:`textTrack`,state:({target:e})=>({chaptersCues:[],thumbnailCues:[],thumbnailTrackSrc:null,textTrackList:[],subtitlesShowing:!1,toggleSubtitles(t){let{media:n}=e();if(!iu(n))return!1;let r=Zc(n,Yc);if(!r.length)return!1;let i=r.some(e=>e.mode===`showing`),a=t??!i;for(let e of r)e.mode=a?`showing`:`disabled`;return a},selectSubtitlesTrack(t){let{media:n}=e();if(!iu(n))return;let r=Array.from(n.textTracks).map((e,t)=>({index:t,track:e})).filter(({track:e})=>Yc(e));if(!r.length)return;if(t===`off`){for(let{track:e}of r)e.mode=`disabled`;return}let i=r.find(({index:e,track:n})=>id(n,e)===t)?.track;if(i)for(let{track:e}of r)e.mode=e===i?`showing`:`disabled`}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!iu(r))return;let i=null,a=()=>{i?.abort(),i=new AbortController;let e=null,t=null,o=[],s=!1;for(let n=0;n<r.textTracks.length;n++){let i=r.textTracks[n];!e&&i.kind===`chapters`&&(e=i),!t&&i.kind===`metadata`&&i.label===`thumbnails`&&(t=i),o.push({id:id(i,n),kind:i.kind,label:i.label,language:i.language,mode:i.mode}),Yc(i)&&i.mode===`showing`&&(s=!0)}let c=e?.cues?Array.from(e.cues):[],l=t?.cues?Array.from(t.cues):[],u=null;t&&(u=Xc(r,t)?.src??null);let d=du(r)&&r.querySelectorAll(`track`)||[],f=r instanceof HTMLElement&&r.shadowRoot?.querySelectorAll(`track`)||[];for(let e of[...d,...f])e.track?.cues?.length||J(e,`load`,a,{signal:i.signal});n({chaptersCues:c,thumbnailCues:l,thumbnailTrackSrc:u,textTrackList:o,subtitlesShowing:s})};a();let o=r.textTracks;o instanceof EventTarget&&(J(o,`addtrack`,a,{signal:t}),J(o,`removetrack`,a,{signal:t}),J(o,`change`,a,{signal:t})),J(r,`loadstart`,a,{signal:t}),t.addEventListener(`abort`,()=>i?.abort(),{once:!0})}}),od={seek:Symbol.for(`@videojs/seek`)},sd=Gl({name:`time`,state:({target:e,signals:t,set:n})=>({currentTime:0,duration:0,seeking:!1,async seek(r){let{media:i}=e(),a=t.supersede(od.seek);if(!Ql(i)||!$l(i))return 0;if(!Xl(i)&&!await kc(i,`loadedmetadata`,{signal:a}).catch(()=>!1))return i.currentTime;let o=Math.max(0,Math.min(r,i.duration||1/0));return n({currentTime:o,seeking:!0}),i.currentTime=o,await kc(i,`seeked`,{signal:a}).catch(cl),i.currentTime}}),attach({target:e,signal:t,set:n,get:r}){let{media:i}=e;if(!Ql(i))return;let a=()=>{let{duration:e}=i;if(e===1/0&&nu(i)){let{seekable:e}=i;return e.length>0?e.end(e.length-1):0}return Number.isFinite(e)?e:0},o=()=>n({currentTime:i.currentTime,duration:a(),seeking:i.seeking}),s=()=>{r().seeking||o()};o(),J(i,`timeupdate`,s,{signal:t}),J(i,`durationchange`,o,{signal:t}),J(i,`seeking`,o,{signal:t}),J(i,`seeked`,o,{signal:t}),J(i,`loadedmetadata`,o,{signal:t}),J(i,`emptied`,o,{signal:t}),J(i,`progress`,s,{signal:t})}}),cd=.25,ld=Gl({name:`volume`,state:({target:e})=>({volume:1,muted:!1,volumeAvailability:`unavailable`,setVolume(t){let{media:n}=e();if(!eu(n))return 0;let r=Math.max(0,Math.min(1,t));return r>0&&n.muted&&(n.muted=!1),n.volume=r,n.volume},toggleMuted(){let{media:t}=e();return eu(t)?(t.muted||t.volume===0?(t.muted=!1,t.volume===0&&(t.volume=cd)):t.muted=!0,t.muted):!1}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!eu(r))return;n({volumeAvailability:ud()});let i=()=>n({volume:r.volume,muted:r.muted});i(),J(r,`volumechange`,i,{signal:t})}});function ud(){let e=document.createElement(`video`);try{return e.volume=.5,e.volume===.5?`available`:`unsupported`}catch{return`unsupported`}}Nl(hu);var dd=Nl(gu),fd=Nl(Mu),pd=Nl(Nu),md=Nl(Wu);Nl(Gu);var hd=Nl(Ku),gd=Nl(qu),_d=Nl(Yu);Nl(ed),Nl(td),Nl(nd),Nl(rd);var vd=Nl(ad),yd=Nl(sd),bd=Nl(ld),xd={seekStep({store:e,value:t}){if(q(t))return;let n=yd(e.state);n&&n.seek(n.currentTime+t)},volumeStep({store:e,value:t}){if(q(t))return;let n=bd(e.state);n&&n.setVolume(n.volume+t)},speedUp({store:e}){let t=_d(e.state);if(!t)return;let{playbackRates:n,playbackRate:r}=t,i=n.indexOf(r),a=i<0||i>=n.length-1?0:i+1;t.setPlaybackRate(n[a])},speedDown({store:e}){let t=_d(e.state);if(!t)return;let{playbackRates:n,playbackRate:r}=t,i=n.indexOf(r),a=i<=0?n.length-1:i-1;t.setPlaybackRate(n[a])}},Sd={seekStep:xd.seekStep,volumeStep:xd.volumeStep,speedUp:xd.speedUp,speedDown:xd.speedDown};function Cd(e){return Sd[e]||(({store:t})=>{let n=t.state[e];K(n)&&n()})}var wd=200,Td=class{#e=0;#t=null;handleUp(e,t){if(e.resolve(`doubletap`).length>0){let n=Date.now();if(n-this.#e<wd){this.#n(),this.#e=0,e.resolve(`doubletap`)[0]?.onActivate(t);return}this.#e=n,this.#n(),this.#t=setTimeout(()=>{this.#t=null,this.#e=0,e.resolve(`tap`)[0]?.onActivate(t)},wd);return}e.resolve(`tap`)[0]?.onActivate(t)}#n(){this.#t!==null&&(clearTimeout(this.#t),this.#t=null)}reset(){this.#n(),this.#e=0}},Ed=new WeakMap;function Dd(e){let t=Ed.get(e);return t||(t=new Td,Ed.set(e,t),t)}function Od(e,t,n){return Su(e).add({type:`tap`,recognizer:Dd(e),onActivate:t,pointer:n?.pointer,region:n?.region,disabled:n?.disabled,action:n?.action,value:n?.value})}function kd(e,t,n){return Su(e).add({type:`doubletap`,recognizer:Dd(e),onActivate:t,pointer:n?.pointer,region:n?.region,disabled:n?.disabled,action:n?.action,value:n?.value})}function Ad(e){return e.startsWith(`toggle`)}var jd={togglePaused({store:e}){let t=gd(e.state);t&&(t.paused?t.play():t.pause())},toggleMuted({store:e}){bd(e.state)?.toggleMuted()},toggleFullscreen({store:e}){let t=md(e.state);t&&(t.fullscreen?t.exitFullscreen():t.requestFullscreen())},toggleSubtitles({store:e}){vd(e.state)?.toggleSubtitles()},togglePictureInPicture({store:e}){let t=hd(e.state);t&&(t.pip?t.exitPictureInPicture():t.requestPictureInPicture())},seekStep:xd.seekStep,volumeStep:xd.volumeStep,speedUp:xd.speedUp,speedDown:xd.speedDown,seekToPercent({store:e,value:t,key:n}){let r=yd(e.state);if(!r||r.duration<=0)return;let i;if(!q(t))i=t;else if(n>=`0`&&n<=`9`)i=Number(n)*10;else return;r.seek(i/100*r.duration)}};function Md(e){return jd[e]}var Nd={shift:`Shift`,ctrl:`Control`,alt:`Alt`,meta:`Meta`},Pd={shift:`Shift`,ctrl:`Ctrl`,alt:`Alt`,meta:`Meta`},Fd=[`ctrl`,`shift`,`alt`,`meta`];function Id(e){return e.map(e=>{let t=[];for(let n of Fd)e.modifiers.has(n)&&t.push(Nd[n]);return t.push(e.originalKey),t.join(`+`)}).join(` `)}function Ld(e){let t=[];for(let n of Fd)e.modifiers.has(n)&&t.push(Pd[n]);return t.push(Rd(e.originalKey)),t.join(`+`)}function Rd(e){return e.length===1?e.toUpperCase():e}var zd=class{#e;#t=[];#n=0;#r=null;#i=null;#a=new Set;#o=new Set;#s=!1;constructor(e){this.#e=e}subscribe(e){return this.#a.add(e),()=>this.#a.delete(e)}subscribeShortcutChanges(e){return this.#o.add(e),()=>this.#o.delete(e)}add(e){let t={parsed:Vd(e.keys),options:e,id:this.#n++};this.#t.push(t),this.#c(),e.target===`document`?this.#u():this.#l(),this.#h();let n=!1;return()=>{if(n)return;n=!0;let e=this.#t.indexOf(t);e!==-1&&this.#t.splice(e,1),this.#d(),this.#h()}}getAriaKeys(e){return this.getShortcut(e).aria}getShortcut(e,t){let n=this.#p(e,t);if(!n.length)return{};let r=n.flatMap(e=>e.parsed),i=n[n.length-1];return{aria:Id(r),shortcut:this.#m(i)}}destroy(){this.#s||(this.#s=!0,this.#r?.abort(),this.#r=null,this.#i?.abort(),this.#i=null,this.#t=[],this.#h(),this.#a.clear(),this.#o.clear())}#c(){this.#t.sort((e,t)=>{let n=t.parsed[0].modifiers.size-e.parsed[0].modifiers.size;return n===0?e.id-t.id:n})}#l(){this.#r||(this.#r=new AbortController,J(this.#e,`keydown`,this.#f,{signal:this.#r.signal}))}#u(){this.#i||(this.#i=new AbortController,J(document,`keydown`,this.#f,{signal:this.#i.signal}))}#d(){let e=this.#t.some(e=>e.options.target!==`document`),t=this.#t.some(e=>e.options.target===`document`);e||(this.#r?.abort(),this.#r=null),t||(this.#i?.abort(),this.#i=null)}#f=e=>{if(e.key===`Unidentified`||zc(e)||e.defaultPrevented)return;let t=Fc(e);for(let n of this.#t){let{options:r,parsed:i}=n;if(!r.disabled&&!(e.repeat&&r.repeatable===!1)&&r.target===`document`==(e.currentTarget===document)){for(let n of i)if(Ud(n,e)&&!(t&&n.modifiers.size===0)){if(this.#a.size>0){let t={source:`hotkey`,action:r.action,value:r.value,event:e};for(let e of this.#a)try{e(t)}catch{}}e.preventDefault(),r.onActivate(e,n.originalKey);return}}}};#p(e,t){return this.#t.filter(n=>n.options.disabled||n.options.action!==e?!1:q(t)?!0:n.options.value===t).sort((e,t)=>e.id-t.id)}#m(e){return e.options.keys===`0-9`?e.options.keys:Ld(e.parsed[0])}#h(){for(let e of this.#o)e()}},Bd=new Set([`shift`,`ctrl`,`alt`,`meta`]);function Vd(e){if(e===`0-9`)return Array.from({length:10},(e,t)=>({modifiers:new Set,key:String(t),originalKey:String(t)}));let t=e.split(`+`),n=t.pop(),r=new Set;for(let e of t){let t=e.toLowerCase();t===`mod`?r.add(Bc()?`meta`:`ctrl`):Bd.has(t)&&r.add(t)}return[{modifiers:r,key:n===`Space`?` `:n.toLowerCase(),originalKey:n}]}function Hd(e){return e.length===1&&!/[a-z]/i.test(e)}function Ud(e,t){if(t.key===`Unidentified`||t.key.toLowerCase()!==e.key)return!1;let n=Hd(t.key),r=n?t.shiftKey&&e.modifiers.has(`shift`):t.shiftKey,i=n?t.altKey&&e.modifiers.has(`alt`):t.altKey;return r===e.modifiers.has(`shift`)&&t.ctrlKey===e.modifiers.has(`ctrl`)&&i===e.modifiers.has(`alt`)&&t.metaKey===e.modifiers.has(`meta`)}var Wd=new WeakMap;function Gd(e){let t=Wd.get(e);return t||(t=new zd(e),Wd.set(e,t)),t}function Kd(e,t){return Gd(e).add(t)}var qd=[qu,Yu,ed,hu,ld,sd,nd,gu,Wu,Ku,td,Mu,ad,Nu];function Jd(e){let{transition:t}=e,n=t.state,r=new AbortController,i=null;function a(){if(r.signal.aborted)return null;let{active:e,status:i}=n.current;return e&&i!==`ending`?null:(i===`ending`&&t.cancel(),t.open())}function o(e){let{active:i,status:a}=n.current;return r.signal.aborted||!i||a===`ending`?null:t.close(e)}function s(){if(c(),typeof document>`u`)return;i=new AbortController;let{signal:t}=i;J(document,`keydown`,l,{signal:t}),e.onDocumentActive?.(t)}function c(){i?.abort(),i=null}function l(t){t.key===`Escape`&&(t.defaultPrevented||n.current.active&&(e.closeOnEscape?.()??!0)&&e.onEscapeDismiss(t))}let u=n.subscribe(()=>{n.current.active?s():c()});r.signal.addEventListener(`abort`,()=>{u(),t.destroy(),c()});function d(){r.signal.aborted||r.abort()}return{input:n,open:a,close:o,signal:r.signal,destroy:d}}function Yd(e){let{onOpenChange:t}=e,n=null,r=null,i=null,a=Jd({transition:e.transition,closeOnEscape:e.closeOnEscape,onEscapeDismiss(e){e.stopPropagation(),c()}}),o=a.input;function s(){r=document.activeElement;let i=a.open();i&&(t(!0),requestAnimationFrame(()=>{!a.signal.aborted&&o.current.active&&n?.focus()}),i.then(()=>{!a.signal.aborted&&o.current.active&&e.onOpenChangeComplete?.(!0)}))}function c(){let i=a.close(n);i&&(t(!1),i.then(()=>{a.signal.aborted||(r&&=(r.focus(),null),e.onOpenChangeComplete?.(!1))}))}function l(){if(u(),!n)return;i=new AbortController;let{signal:e}=i;J(n,`click`,d,{signal:e})}function u(){i?.abort(),i=null}function d(e){e.target instanceof HTMLButtonElement&&c()}function f(e){n=e,l()}return a.signal.addEventListener(`abort`,()=>{u(),n=null,r=null}),{input:o,open:s,close:c,setElement:f,destroy:a.destroy}}function Xd(e){let{onActivate:t,isDisabled:n}=e;return{role:`button`,tabIndex:0,onClick(e){if(n()){e.preventDefault();return}t(e)},onPointerDown(e){n()&&e.preventDefault()},onMouseDown(e){n()&&e.preventDefault()},onKeyDown(e){if(e.target===e.currentTarget){if(n()){e.key!==`Tab`&&e.preventDefault();return}e.key===`Enter`?(e.preventDefault(),t(e)):e.key===` `&&e.preventDefault()}},onKeyUp(e){e.target===e.currentTarget&&(n()||e.key===` `&&t(e))}}}var Zd=`group`;function Qd(e){let t=Ac(e.ownerDocument);(!t||t===e.ownerDocument.body||!el(e,t))&&e.focus({preventScroll:!0})}var $d={transitionStarting:`data-starting-style`,transitionEnding:`data-ending-style`};function ef(e){return{transitionStarting:e===`starting`,transitionEnding:e===`ending`}}function tf(e){let{onOpenChange:t,closeOnOutsideClick:n}=e,r=null,i=null,a=null,o=new Set,s=!1,c=null,l=Jd({transition:e.transition,closeOnEscape:e.closeOnEscape,onEscapeDismiss(e){e.preventDefault(),x(`escape`,e)},onDocumentActive(e){J(document,`pointerdown`,w,{capture:!0,signal:e})}}),u=l.input,d={close(e){x(e)}};function f(){a!==null&&(clearTimeout(a),a=null)}function p(){return globalThis.matchMedia?.(`(hover: hover)`)?.matches??!1}function m(){return p()?globalThis.matchMedia?.(`(pointer: fine)`)?.matches??!1:!1}function h(){return!e.openOnHover?.()||p()}function g(){s=!1,c!==null&&(clearTimeout(c),c=null)}function _(){s=!0,c!==null&&clearTimeout(c),c=setTimeout(g,500)}function v(){return s?(g(),!0):!1}function y(){return r?r.hasAttribute(`disabled`)?!0:r.getAttribute(`aria-disabled`)===`true`:!1}function b(n,r){let i=l.open();i&&(e.group?.()?.open(d),t(!0,r?{reason:n,event:r}:{reason:n}),i.then(()=>{!l.signal.aborted&&u.current.active&&e.onOpenChangeComplete?.(!0)}))}function x(n,r){let a=l.close(i);a&&(e.group?.()?.close(d),t(!1,r?{reason:n,event:r}:{reason:n}),a.then(()=>{l.signal.aborted||(Kc(i),e.onOpenChangeComplete?.(!1))}))}function S(e=`click`){b(e)}function C(e=`click`){x(e)}function w(e){if(!n()||!u.current.active)return;let t=e.composedPath();if(r&&t.includes(r)||i&&t.includes(i)){_();return}g(),x(`outside-click`,e)}l.signal.addEventListener(`abort`,()=>{e.group?.()?.close(d),f(),g(),o.clear(),r=null,i=null});let T={onClick(e){h()&&(y()||(u.current.active&&u.current.status!==`ending`?x(`click`,e):b(`click`,e)))},onPointerEnter(t){if(!e.openOnHover?.()||!p()||(f(),u.current.active))return;let n=e.delay?.()??300;a=setTimeout(()=>b(`hover`),n)},onPointerLeave(t){if(!e.openOnHover?.()||!p()||(f(),!u.current.active))return;let n=e.closeDelay?.()??0;a=setTimeout(()=>x(`hover`),n)},onFocusIn(t){if(e.openOnHover?.()){if(!m())return;b(`focus`)}},onFocusOut(t){let n=t.relatedTarget;n&&(r?.contains(n)||i?.contains(n))||e.openOnHover?.()&&x(`blur`)}},E={onPointerEnter(t){e.openOnHover?.()&&f()},onPointerLeave(t){if(!e.openOnHover?.()||o.size>0||(f(),!u.current.active))return;let n=e.closeDelay?.()??0;a=setTimeout(()=>x(`hover`),n)},onGotPointerCapture(e){o.add(e.pointerId)},onLostPointerCapture(e){o.delete(e.pointerId)},onFocusOut(e){let t=e.relatedTarget;if(!(t&&(r?.contains(t)||i?.contains(t)))&&!v()){if(t!==null){x(`blur`);return}requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(!u.current.active||u.current.status===`ending`||u.current.status===`starting`)return;let e=document.activeElement;e&&(r?.contains(e)||i?.contains(e))||x(`blur`)})})}}};function D(e){r=e}function O(e){!e&&i&&u.current.active&&Kc(i),i=e,e&&u.current.active&&Gc(e)}return{input:u,triggerProps:T,popupProps:E,get triggerElement(){return r},setTriggerElement:D,setPopupElement:O,open:S,close:C,destroy:l.destroy}}function nf(e,t,n,r){let i=e+n,a=t+r;return{x:e,y:t,width:n,height:r,top:t,right:i,bottom:a,left:e,toJSON(){return{x:e,y:t,width:n,height:r,top:t,right:i,bottom:a,left:e}}}}function rf(e,t){let n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),i=Math.min(e.right,t.right),a=Math.min(e.bottom,t.bottom);return nf(n,r,Math.max(0,i-n),Math.max(0,a-r))}function af(e){let t=document.documentElement.getBoundingClientRect();return e?rf(t,e.getBoundingClientRect()):t}function of(e,t={}){if(!e)return null;if(!ec(e))return e;if(e===`viewport`)return null;if(e===`container`)return t.container??null;try{return(t.root??document).querySelector(e)}catch{return null}}var sf={sideOffset:`--media-popover-side-offset`,alignOffset:`--media-popover-align-offset`,boundaryOffset:`--media-popover-boundary-offset`,anchorWidth:`--media-popover-anchor-width`,anchorHeight:`--media-popover-anchor-height`,availableWidth:`--media-popover-available-width`,availableHeight:`--media-popover-available-height`};function cf(e,t,n){return Math.max(t,Math.min(n,e))}function lf(e,t,n){let r=Math.round((e-n)/t)*t+n,i=`${t}`.indexOf(`.`);return i===-1?r:Number(r.toFixed(`${t}`.length-i-1))}var uf={sideOffset:0,alignOffset:0,boundaryOffset:0},df={top:`bottom`,bottom:`top`,left:`right`,right:`left`};function ff(e){return`${cf(e,0,1/0)}px`}function pf(e,t,n,r){let i=n-r;return i<t?t:cf(e,t,i)}function mf(e,t,n,r,i,a,o,s){let c=a===`start`?e+o:a===`end`?t+o:e+n/2+o,l=a===`start`?`0px`:a===`end`?`-100%`:`-50%`;return{base:`${c}px`,translate:`clamp(${r+s-c}px, ${l}, calc(${i-s-c}px - 100%))`}}function hf(e,t,n,r,i,a,o=sf){if(jc())return{...gf(e,t,o,n,i,a),...n&&i?_f(n,i,t,a,o):{}};if(n&&r){let e=a??uf;return{position:`fixed`,margin:`0`,...vf(n,r,t,e,i),...i?_f(n,i,t,e,o):{}}}return{}}function gf(e,t,n=sf,r,i,a=uf){let o=`var(${n.sideOffset}, 0px)`,s=`var(${n.alignOffset}, 0px)`,{side:c,align:l}=t,u=a.boundaryOffset??0,d={positionAnchor:`--${e}`,position:`fixed`,inset:`auto`,margin:`0`,justifySelf:`normal`,alignSelf:`normal`,marginInlineStart:`0`,marginBlockStart:`0`,translate:`none`},f=df[c];if(c===`top`||c===`bottom`){if(d[f]=`calc(anchor(${c}) + ${o})`,r&&i){let{base:e,translate:t}=mf(r.left,r.right,r.width,i.left,i.right,l,a.alignOffset,u);return d.left=e,d.translate=`${t} 0`,d}l===`start`?d.left=`calc(anchor(left) + ${s})`:l===`end`?d.right=`calc(anchor(right) + ${s})`:(d.justifySelf=`anchor-center`,d.marginInlineStart=s)}else{if(d[f]=`calc(anchor(${c}) + ${o})`,r&&i){let{base:e,translate:t}=mf(r.top,r.bottom,r.height,i.top,i.bottom,l,a.alignOffset,u);return d.top=e,d.translate=`0 ${t}`,d}l===`start`?d.top=`calc(anchor(top) + ${s})`:l===`end`?d.bottom=`calc(anchor(bottom) + ${s})`:(d.alignSelf=`anchor-center`,d.marginBlockStart=s)}return d}function _f(e,t,n,r=uf,i=sf){let a={},{side:o}=n,s=r.boundaryOffset??0,c=t.left+s,l=t.right-s,u=t.top+s,d=t.bottom-s;if(a[i.anchorWidth]=`${e.width}px`,a[i.anchorHeight]=`${e.height}px`,o===`top`||o===`bottom`){let t=o===`top`?e.top-u:d-e.bottom;a[i.availableHeight]=ff(t-r.sideOffset),a[i.availableWidth]=ff(l-c)}else{let t=o===`left`?e.left-c:l-e.right;a[i.availableWidth]=ff(t-r.sideOffset),a[i.availableHeight]=ff(d-u)}return a}function vf(e,t,n,r={sideOffset:0,alignOffset:0},i){let{side:a,align:o}=n,{sideOffset:s,alignOffset:c}=r,l=0,u,d=0,f;if(a===`top`?u=`calc(100% - ${e.top}px + ${s}px)`:a===`bottom`?l=e.bottom+s:a===`left`?f=`calc(100% - ${e.left}px + ${s}px)`:d=e.right+s,a===`top`||a===`bottom`?d=o===`start`?e.left+c:o===`end`?e.right-t.width+c:e.left+(e.width-t.width)/2+c:l=o===`start`?e.top+c:o===`end`?e.bottom-t.height+c:e.top+(e.height-t.height)/2+c,i){let e=r.boundaryOffset??0;a===`top`||a===`bottom`?d=pf(d,i.left+e,i.right-e,t.width):l=pf(l,i.top+e,i.bottom-e,t.height)}return{top:a===`top`?`auto`:`${l}px`,bottom:u??`auto`,left:a===`left`?`auto`:`${d}px`,right:f??`auto`}}function yf(e,t=sf){let n=getComputedStyle(e);return{sideOffset:Jc(e,n.getPropertyValue(t.sideOffset)),alignOffset:Jc(e,n.getPropertyValue(t.alignOffset)),boundaryOffset:Jc(e,n.getPropertyValue(t.boundaryOffset))}}function bf(e,t){let n=e.getBoundingClientRect(),r=e.offsetWidth||n.width,i=e.offsetHeight||n.height;return nf(n.left,n.top,t===`left`||t===`right`?Math.max(r,e.scrollWidth):r,t===`top`||t===`bottom`?Math.max(i,e.scrollHeight):i)}function xf(){let e=null;return{open(t){e!==t&&(e?.close(`group-open`),e=t)},close(t){e===t&&(e=null)}}}function Sf(e,t,n,r){let i;return i=n===`vertical`?1-(e.clientY-t.top)/t.height:r?(t.right-e.clientX)/t.width:(e.clientX-t.left)/t.width,Number.isFinite(i)?cf(i*100,0,100):0}function Cf(e){let t=Vl({pointerPercent:0,dragPercent:0,dragging:!1,pointing:!1,focused:!1}),n=new AbortController,r=e.changeThrottle??0,i=!1,a=!1,o=null,s=null,c=0,l=!1,u=r>0?ll(t=>e.onValueChange?.(t),r,{leading:!0}):null;function d(t,n){n&&u?u(t):e.onValueChange?.(t)}function f(){if(nc(s))return;let t=s;s=null;try{e.getElement().releasePointerCapture(t)}catch{}}function p(){i?(l||e.onValueCommit?.(c),i=!1,t.patch({dragging:!1,pointing:!1}),e.onDragEnd?.()):t.patch({pointing:!1}),l=!1,m()}function m(){u?.cancel(),s=null,o=null}let h={onPointerDown(n){if(e.isDisabled())return;n.stopPropagation(),n.preventDefault();let r=e.getElement();o=r.getBoundingClientRect(),a=e.isRTL(),l=!1,f(),s=n.pointerId,r.setPointerCapture(n.pointerId);let u=Sf(n,o,e.getOrientation(),a);i=!0,c=u,t.patch({pointing:!0,dragging:!0,pointerPercent:u,dragPercent:u}),e.onDragStart?.(),e.onValueChange?.(u),e.getThumbElement?.()?.focus({preventScroll:!0,focusVisible:!1})},onPointerMove(n){if(e.isDisabled())return;if(!nc(s)){if(n.pointerType!==`touch`&&n.buttons===0){p();return}let r=Sf(n,o,e.getOrientation(),a);c=r,t.patch({dragPercent:r,pointerPercent:r}),d(r,!0);return}let r=Sf(n,e.getElement().getBoundingClientRect(),e.getOrientation(),e.isRTL());t.patch({pointing:!0,pointerPercent:r})},onPointerUp(t){if(e.isDisabled()||(t.stopPropagation(),nc(s)))return;let n=Sf(t,o,e.getOrientation(),a);u?.cancel(),e.onValueChange?.(n),e.onValueCommit?.(n),l=!0},onPointerLeave(){nc(s)&&t.patch({pointing:!1})},onLostPointerCapture(){p()}},g={onKeyDown(n){if(e.isDisabled()){n.key!==`Tab`&&n.preventDefault();return}let r=e.getStepPercent(),i=e.getLargeStepPercent(),a=lf(e.getPercent(),r,0),o=e.isRTL()?-1:1,s=n.shiftKey?i:r,c=null;switch(n.key){case`ArrowRight`:c=a+s*o;break;case`ArrowLeft`:c=a-s*o;break;case`ArrowUp`:c=a+s;break;case`ArrowDown`:c=a-s;break;case`PageUp`:c=a+i;break;case`PageDown`:c=a-i;break;case`Home`:c=0;break;case`End`:c=100}c!==null&&(n.preventDefault(),c=cf(c,0,100),t.patch({pointerPercent:c,dragPercent:c}),e.onValueChange?.(c),e.onValueCommit?.(c))},onFocus(){t.patch({focused:!0})},onBlur(){t.patch({focused:!1})}};function _(t){if(!e.adjustPercent||t.thumbAlignment!==`edge`)return t;let n=e.getElement(),r=e.getThumbElement?.();if(!r)return t;let i=t.orientation===`horizontal`,a=i?r.offsetWidth:r.offsetHeight,o=i?n.offsetWidth:n.offsetHeight;return{...t,fillPercent:e.adjustPercent(t.fillPercent,a,o),pointerPercent:e.adjustPercent(t.pointerPercent,a,o)}}let v=null;return e.onResize&&(v=new ResizeObserver(()=>e.onResize()),v.observe(e.getElement())),{input:t,rootProps:h,rootStyle:{touchAction:`none`,userSelect:`none`},thumbProps:g,adjustForAlignment:_,destroy(){n.signal.aborted||(n.abort(),v?.disconnect(),f(),m())}}}var wf={fill:`--media-slider-fill`,pointer:`--media-slider-pointer`,buffer:`--media-slider-buffer`};function Tf(e){return{[wf.fill]:`${e.fillPercent.toFixed(3)}%`,[wf.pointer]:`${e.pointerPercent.toFixed(3)}%`}}function Ef(e){return{...Tf(e),[wf.buffer]:`${e.bufferPercent.toFixed(3)}%`}}function Df(e,t){let n=e/2;return{position:`absolute`,left:t===`visible`?`calc(var(${wf.pointer}) - ${n}px)`:`min(max(0px, calc(var(${wf.pointer}) - ${n}px)), calc(100% - ${e}px))`,width:`max-content`,pointerEvents:`none`}}var Of=class{findActiveThumbnail(e,t){if(e.length===0)return;let n=0,r=e.length-1,i;for(;n<=r;){let a=n+r>>>1,o=e[a];t>=o.startTime?(i=o,n=a+1):r=a-1}return i}parseConstraints(e){let t=parseFloat(e.minWidth),n=parseFloat(e.maxWidth),r=parseFloat(e.minHeight),i=parseFloat(e.maxHeight);return{minWidth:Number.isFinite(t)?t:0,maxWidth:Number.isFinite(n)?n:1/0,minHeight:Number.isFinite(r)?r:0,maxHeight:Number.isFinite(i)?i:1/0}}calculateScale(e,t,n){let{minWidth:r,maxWidth:i,minHeight:a,maxHeight:o}=n,s=Math.min(i/e,o/t),c=Math.max(r/e,a/t);return Number.isFinite(s)&&s<1?s:Number.isFinite(c)&&c>1?c:1}resize(e,t,n,r){let i=e.width??t,a=e.height??n;if(!i||!a)return;let o=this.calculateScale(i,a,r),s=e.coords?.x??0,c=e.coords?.y??0,l=o===1?0:1;return{scale:o,containerWidth:Math.max(0,Math.floor(i*o)-l*2),containerHeight:Math.max(0,Math.floor(a*o)-l*2),imageWidth:Math.ceil(t*o),imageHeight:Math.ceil(n*o),offsetX:Math.ceil(s*o)+l,offsetY:Math.ceil(c*o)+l}}getState(e,t,n){return{loading:e,error:t,hidden:!e&&!n}}getAttrs(e){return{role:`img`,"aria-hidden":`true`}}};function kf(e){let{getContainer:t,getImg:n,onStateChange:r}=e,i=new Of,a=new AbortController,o=a.signal,s=!1,c=!1,l=0,u=0,d=``,f=!1,p=null;function m(){let e=n();e&&(l=e.naturalWidth,u=e.naturalHeight),s=!1,c=!1,r()}function h(){s=!1,c=!0,r()}function g(e){J(e,`load`,m,{signal:o}),J(e,`error`,h,{signal:o})}function _(){if(!f){let e=n();e&&(g(e),f=!0)}if(!p){let e=t();e&&(p=new ResizeObserver(r),p.observe(e))}}function v(e){_();let t=e??``;t!==d&&(d=t,t?(s=!0,c=!1):(s=!1,c=!1,l=0,u=0))}function y(){_();let e=n();e?.complete&&d&&(e.naturalWidth>0?(l=e.naturalWidth,u=e.naturalHeight,s=!1,c=!1):(s=!1,c=!0),r())}function b(){a.abort(),p?.disconnect(),p=null}return{get loading(){return s},get error(){return c},get naturalWidth(){return l},get naturalHeight(){return u},readConstraints(){let e=t();return e?i.parseConstraints(getComputedStyle(e)):{minWidth:0,maxWidth:1/0,minHeight:0,maxHeight:1/0}},updateSrc:v,connect:y,destroy:b}}var Af={hover:`hover`,focus:`focus`,escape:`escape`,blur:`blur`,"imperative-action":`imperative-action`};function jf(e){let t={transition:e.transition,onOpenChange(t,n){let r=Af[n.reason];if(!r)return;let i=e.group?.();t?i?.notifyOpen():i?.notifyClose();let a=n.event?{reason:r,event:n.event}:{reason:r};e.onOpenChange(t,a)},closeOnEscape:()=>!0,closeOnOutsideClick:()=>!1,openOnHover:()=>!0,delay:()=>{let t=e.group?.();return t?.shouldSkipDelay()?0:e.delay?.()??t?.delay??600},closeDelay:()=>{let t=e.group?.();return e.closeDelay?.()??t?.closeDelay??0}};e.onOpenChangeComplete&&(t.onOpenChangeComplete=e.onOpenChangeComplete);let n=tf(t),r=!1,{onClick:i,...a}=n.triggerProps,o={...a,onPointerDown(){r=!0},onPointerEnter(t){e.disabled?.()||t.pointerType!==`touch`&&a.onPointerEnter(t)},onFocusIn(t){if(!e.disabled?.()){if(r){r=!1;return}a.onFocusIn(t)}}},s={...n.popupProps,onPointerEnter(t){e.disableHoverablePopup?.()||n.popupProps.onPointerEnter(t)}};return{...n,triggerProps:o,popupProps:s,get triggerElement(){return n.triggerElement},open:()=>n.open(`hover`),close:(e=`hover`)=>n.close(e)}}function Mf(){let e=Vl({active:!1,status:`idle`}),t=!1,n=0,r=0;function i(i=null){cancelAnimationFrame(n),cancelAnimationFrame(r),n=0,r=0;let a=e.current.active;return a&&e.patch({status:`idle`}),e.patch({active:!0,status:`starting`}),new Promise(o=>{n=requestAnimationFrame(()=>{n=0,a&&(Pf(i),Nf(i)),r=requestAnimationFrame(()=>{if(r=0,t||!e.current.active)return o();e.patch({status:`idle`}),o()})})})}function a(i){return cancelAnimationFrame(n),cancelAnimationFrame(r),n=0,r=0,e.patch({status:`ending`}),new Promise(a=>{n=requestAnimationFrame(()=>{n=0,r=requestAnimationFrame(()=>{if(r=0,t)return a();Ff(i).finally(()=>{if(t||e.current.status!==`ending`)return a();e.patch({active:!1,status:`idle`}),a()})})})})}function o(){cancelAnimationFrame(n),cancelAnimationFrame(r),n=0,r=0,e.current.status!==`idle`&&e.patch({status:`idle`})}return{state:e,open:i,close:a,cancel:o,destroy(){t||(t=!0,o())}}}function Nf(e){e&&e.offsetHeight}function Pf(e){let t=e?.getAnimations?.({subtree:!0})??[];for(let e of t)e.cancel()}function Ff(e){if(!e)return Promise.resolve();let t=e.getAnimations?.()??[];return t.length===0?Promise.resolve():Promise.all(t.map(e=>e.finished)).then(cl,cl)}function If(e){return{onWheel(t){if(e.isDisabled())return;let n=Math.sign(t.deltaY);if(n===0)return;t.preventDefault();let r=e.getStepPercent(),i=cf(e.getPercent()-n*r,0,100);e.onValueChange?.(i)}}}function Lf(e,t){if(!t)return!1;if(K(e.composedPath))return e.composedPath().includes(t);let n=e.target;return n instanceof Node&&t.contains(n)}function Rf(e,t){let n={};for(let r in e){if(t&&!(r in t))continue;let i=t?.[r]??zf(r),a=e[r];a===!0?n[i]=``:a&&(n[i]=String(a))}return n}function zf(e){return`data-${e.toLowerCase()}`}var Bf={key:`container.label`,text:`Media player`};r();var Vf=u(function({children:e,tabIndex:t=0,role:n=Zd,"aria-label":r,"aria-labelledby":i,...a},s){let c=Tl(),l=Tc(),u=o(null),d=al(s,u);m(()=>(c?.(u.current),()=>c?.(null)),[c]);let f=e=>{a.onPointerUp?.(e);let t=u.current;t&&Qd(t)};return F(`div`,{ref:d,role:n,tabIndex:t,...r!==void 0||i!==void 0?{"aria-label":r,"aria-labelledby":i}:{"aria-label":l(Bf)},...a,onPointerUp:f,children:e})});r();function Y(e){let t=o(e);return t.current=e,t}r();function Hf(e,t,n){let r=o(null),i=Y(t),a=Y(n);m(()=>(r.current===null?i.current?.():(clearTimeout(r.current),r.current=null),()=>{r.current=setTimeout(()=>{a.current?.(),e.destroy()},0)}),[e])}r();function Uf(e){function t({children:t}){let[n,r]=h(()=>Ul()(Ol(...e.features))),[i]=h(()=>xf()),[a,o]=h(null),[s,c]=h(null);return Hf(n),m(()=>{if(a){if(n.destroyed){r(Ul()(Ol(...e.features)));return}return n.attach({media:a,container:s})}},[a,s,n]),F(gl,{value:b(()=>({store:n,media:a,setMedia:o,container:s,setContainer:c,popupGroup:i}),[n,a,s,i]),children:t})}function n(e){let{store:t}=_l();return fl(t,e)}return{Provider:t,Container:Vf,usePlayer:n,useMedia:bl}}function Wf(e){return e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>=65&&e.charCodeAt(2)<=90}function Gf(e,t){return Wf(e)&&(typeof t==`function`||t===void 0)}function Kf(e,t){return t?e?n=>{t(n),e(n)}:t:e}function qf(e,t){return t&&e?`${t} ${e}`:t||e}function Jf(e,t){return t?e?{...e,...t}:t:e}function Yf(e,t){if(!t)return e;for(let n in t){let r=t[n];n===`className`?e.className=qf(e.className,r):n===`style`?e.style=Jf(e.style,r):e[n]=Gf(n,r)?Kf(e[n],r):r}return e}function Xf(...e){let t={};for(let n of e)t=Yf(t,n);return t}r();function Zf(e,t){return K(e)?e(t):e}function Qf(e,t){return K(e)?e(t):e}function $f(e){let t=e;return t.ref??t.props?.ref}function X(e,t,n){let{className:r,style:i,render:a}=t,{state:o,ref:s,props:c,stateAttrMap:l}=n,u=Zf(r,o),p=Qf(i,o),m=Xf(l?Rf(o,l):{},...Array.isArray(c)?c:c?[c]:[]);if(u!==void 0&&(m.className=m.className?`${m.className} ${u}`:u),p!==void 0&&(m.style=m.style?{...m.style,...p}:p),K(a)){let e=il(s,m.ref);return a({...m,ref:e},o)}if(d(a)){let e=$f(a),t=il(s,m.ref,e),n=Xf(m,a.props);return n.ref=t,f(a,n)}return m.ref=il(s,m.ref),E(e,m)}r();function ep(e){let{displayName:t,onActivate:n,isDisabled:r}=e,i=p(e=>{},[t]);return{getButtonProps:p(e=>Xf(Xd({onActivate:n,isDisabled:r}),e),[n,r]),buttonRef:i}}r();function tp(e,t){let n=xl(),[r,i]=h({});return m(()=>{if(!n||!e){i({});return}let r=Gd(n),a=()=>i(r.getShortcut(e,t));return a(),r.subscribeShortcutChanges(a)},[n,e,t]),r}r(),M(null).Provider,M(null).Provider,M(null).Provider,M(null).Provider;var np=M(!1);np.Provider;function rp(){return e(np)}M(null).Provider,r();var ip=M(null),ap=ip.Provider;function op(){let t=e(ip);if(!t)throw Error(`Tooltip compound components must be used within a Tooltip.Root`);return t}function sp(){return e(ip)}r();function cp(e,t){return e.getLabelParams?.(t)}function lp(e){let{displayName:t,core:r,stateAttrMap:i,selector:a,action:o,hotkeyAction:s,hotkeyValue:c,tooltipLabel:l,isSupported:d}=e,f=new Set(Object.keys(r.defaultProps)),p=u(function(e,u){let{render:p,className:m,style:g,..._}=e,v={},y={};for(let e of Object.keys(_))f.has(e)?v[e]=_[e]:y[e]=_[e];let b=sp(),x=rp(),S=b?.setContent,C=vl(a),w=tp(s,c?.(v)),T=Tc(),[E]=h(()=>new r);f.has(`menuTrigger`)&&q(v.menuTrigger)&&(v.menuTrigger=x),E.setProps(v);let{getButtonProps:D,buttonRef:O}=ep({displayName:t,onActivate:()=>{Promise.resolve(o(E,C)).catch(e=>{})},isDisabled:()=>!!v.disabled||!C});C&&E.setMedia(C);let k=C?E.getState():null,A=k?d?.(k)??!0:!1,j=k&&A?Sc(E.getLabel(k),T,cp(E,k)):void 0,ee=k&&A?l?.(E,k)??j:void 0;if(n(()=>{if(S)return S(ee?{label:ee,shortcut:w.shortcut}:void 0),()=>S(void 0)},[S,ee,w.shortcut]),!C||!k||!A)return null;let te=E.getAttrs(k),M=te[`aria-label`],N={...te,...yc(M)?{"aria-label":Sc(M,T,cp(E,k))}:void 0,"aria-keyshortcuts":w.aria};return X(`button`,{render:p,className:m,style:g},{state:k,stateAttrMap:i,ref:[u,O],props:[D(),N,y]})});return p.displayName=t,p}function up(e,t){return K(e)?e(t)||void 0:e||void 0}var dp=class{static defaultProps={open:!1,defaultOpen:!1};setProps(e){}#e=null;#t=void 0;#n=void 0;setInput(e){this.#e=e}setTitleId(e){this.#t=e}setDescriptionId(e){this.#n=e}getState(){let e=this.#e;return{open:e.active,status:e.status,titleId:this.#t,descriptionId:this.#n,...ef(e.status)}}getAttrs(e){return{role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":e.titleId,"aria-describedby":e.descriptionId}}},fp={open:`data-open`,...$d},pp=class e{static defaultProps={delay:500};state=Vl({visible:!1});#e={...e.defaultProps};#t=null;setProps(t){this.#e=ic(t,e.defaultProps)}destroy(){this.#n()}update(e){let t=e.waiting&&!e.paused;t&&!this.state.current.visible&&!this.#t?this.#t=setTimeout(()=>{this.#t=null,this.state.patch({visible:!0})},this.#e.delay):t||(this.#n(),this.state.patch({visible:!1}))}#n(){this.#t!==null&&(clearTimeout(this.#t),this.#t=null)}},mp={visible:`data-visible`},hp=class{#e=null;setMedia(e){this.#e=e}getState(){let e=this.#e;return{visible:e.controlsVisible,userActive:e.userActive}}},gp={visible:`data-visible`,userActive:`data-user-active`},_p=class extends dp{setProps(){}},vp=`common.`,yp={key:`${vp}empty`,text:``},bp={key:`${vp}ok`,text:`OK`},xp=`errors.`,Sp={key:`${xp}aborted`,text:`You stopped media playback before it finished.`},Cp={key:`${xp}network`,text:`This media could not be loaded due to a network or server issue.`},wp={key:`${xp}decode`,text:`This media could not be played. It may be corrupted, or your browser may not support its format.`},Tp={key:`${xp}source`,text:`This media could not be loaded. It may be unavailable, or your browser may not support its format.`},Ep={key:`${xp}encrypted`,text:`This media could not be played because it could not be decrypted.`},Dp={key:`${xp}title`,text:`Something went wrong.`},Op={key:`${xp}unexpected`,text:`An unexpected error occurred.`},kp={[Yl.MEDIA_ERR_ABORTED]:Sp,[Yl.MEDIA_ERR_NETWORK]:Cp,[Yl.MEDIA_ERR_DECODE]:wp,[Yl.MEDIA_ERR_SRC_NOT_SUPPORTED]:Tp,[Yl.MEDIA_ERR_ENCRYPTED]:Ep,[Yl.MEDIA_ERR_CUSTOM]:yp},Ap={[Yl.MEDIA_ERR_SRC_NOT_SUPPORTED]:[`Failed to open media`]};function jp(e){return e>=Yl.MEDIA_ERR_ABORTED&&e<=Yl.MEDIA_ERR_ENCRYPTED}function Mp(){return Dp}function Np(){return bp}function Pp(e,t){if(e){let t=kp[e.code],n=e.message?.trim();if(n){let r=Yl.defaultMessages[e.code];if(t&&r&&n===r)return t;let i=Ap[e.code];return t&&jp(e.code)&&!e.context&&i?.includes(n)?t:n}if(t)return t}return t?.trim()||Op}var Fp=`fullscreen.`,Ip={key:`${Fp}enter`,text:`Enter fullscreen`},Lp={key:`${Fp}exit`,text:`Exit fullscreen`},Rp=class e{static defaultProps={label:``,disabled:!1};state=Vl({fullscreen:!1,availability:`unavailable`,disabled:!0,hidden:!0,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=ic(t,e.defaultProps)}getLabel(e){return up(this.#e.label,e)||(e.fullscreen?Lp:Ip)}getAttrs(e){return{"aria-label":this.getLabel(e),"aria-disabled":e.disabled?`true`:void 0,hidden:e.hidden?``:void 0}}setMedia(e){this.#t=e}getState(){let e=this.#t,t=e.fullscreenAvailability;return this.state.patch({fullscreen:e.fullscreen,availability:t,disabled:this.#e.disabled||t!==`available`,hidden:t!==`available`}),this.state.patch({label:vc(this.getLabel(this.state.current))}),this.state.current}async toggle(e){if(this.setMedia(e),!this.getState().disabled)return e.fullscreen?e.exitFullscreen():e.requestFullscreen()}},zp={fullscreen:`data-fullscreen`,availability:`data-availability`,disabled:`data-disabled`,hidden:`data-hidden`},Bp={key:`playback.rate`,text:`Playback rate {rate}`},Vp=`volume.`,Hp={key:`${Vp}mutedValue`,text:`{percent}, muted`};`${Vp}`;var Up={key:`${Vp}label`,text:`Volume`};`${Vp}`;var Wp=Intl.DurationFormat,Gp=new Map;function Kp(e,t){if(e===`digital`){let e=e=>String(e).padStart(2,`0`);return{format:n=>{let r=`${e(n.minutes??0)}:${e(n.seconds??0)}`;return t===`always`||n.hours!==void 0?`${n.hours??0}:${r}`:r}}}let n=[[`hours`,`hour`],[`minutes`,`minute`],[`seconds`,`second`]];return{format:e=>n.filter(([t])=>e[t]!==void 0).map(([t,n])=>{let r=e[t]??0;return`${r} ${n}${r===1?``:`s`}`}).join(`, `)}}function qp(e){return e===void 0?``:Array.isArray(e)?e.join(`:`):e}function Jp(e){let t=Array.isArray(e)?e[0]:e;return!t||t===`en`||t.startsWith(`en-`)}function Yp(e,t=`long`,n){let r=`${qp(e)}:${t}:${n??``}`,i=Gp.get(r);return i||(i=Wp?new Wp(e,n===void 0?{style:t}:{style:t,hoursDisplay:n}):Kp(t,n),Gp.set(r,i)),i}function Xp(e){return tc(e)&&Number.isFinite(e)}function Zp(e,t){if(!Xp(e))return`0:00`;let n=e<0,r=Math.floor(Math.abs(e)),i=Math.floor(r/3600),a=Math.floor(r%3600/60),o=r%60,s=Xp(t??0)?Math.abs(t??0):0,c=Math.floor(s/3600),l=Math.floor(s/60%60),u=i>0||c>0,d=u||l>=10,f=u?{hours:i,minutes:a,seconds:o}:{minutes:a,seconds:o},p=Yp(`en`,`digital`,u?`always`:`auto`).format(f);return d||(p=p.replace(/^0(?=\d:)/,``)),`${n?`-`:``}${p}`}function Qp(e){if(!Xp(e))return`PT0S`;let t=Math.abs(e),n=Math.floor(t/3600),r=Math.floor(t/60%60),i=Math.floor(t%60),a=`PT`;return n>0&&(a+=`${n}H`),r>0&&(a+=`${r}M`),(i>0||a===`PT`)&&(a+=`${i}S`),a}function $p(e,t){if(!Xp(e))return``;let n=e<0,r=Math.floor(Math.abs(e)),i=Math.floor(r/3600),a=Math.floor(r%3600/60),o=r%60,s={};i>0&&(s.hours=i),a>0&&(s.minutes=a),(o>0||i===0&&a===0)&&(s.seconds=o);let c=Yp(t?.locale,t?.style??`long`).format(s);if(n){let e=t?.formatRemaining;return e?e(c):Jp(t?.locale)?`${c} remaining`:c}return c}var em=`buttons.`,tm={key:`${em}play`,text:`Play`},nm={key:`${em}pause`,text:`Pause`},rm={key:`${em}replay`,text:`Replay`},im={key:`${em}mute`,text:`Mute`},am={key:`${em}unmute`,text:`Unmute`},om=class e{static defaultProps={label:``,disabled:!1};state=Vl({muted:!1,volumeLevel:`off`,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=ic(t,e.defaultProps)}getLabel(e){return up(this.#e.label,e)||(e.muted?am:im)}getAttrs(e){return{"aria-label":this.getLabel(e),"aria-disabled":this.#e.disabled?`true`:void 0}}setMedia(e){this.#t=e}getState(){let e=this.#t;return this.state.patch({muted:e.muted||e.volume===0,volumeLevel:sm(e)}),this.state.patch({label:vc(this.getLabel(this.state.current))}),this.state.current}toggle(e){this.#e.disabled||e.toggleMuted()}};function sm(e){return e.muted||e.volume===0?`off`:e.volume<.5?`low`:e.volume<.75?`medium`:`high`}var cm={muted:`data-muted`,volumeLevel:`data-volume-level`},lm=`pip.`,um={key:`${lm}enter`,text:`Enter picture-in-picture`},dm={key:`${lm}exit`,text:`Exit picture-in-picture`},fm=class e{static defaultProps={label:``,disabled:!1};state=Vl({pip:!1,availability:`unavailable`,disabled:!0,hidden:!0,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=ic(t,e.defaultProps)}getLabel(e){return up(this.#e.label,e)||(e.pip?dm:um)}getAttrs(e){return{"aria-label":this.getLabel(e),"aria-disabled":e.disabled?`true`:void 0,hidden:e.hidden?``:void 0}}setMedia(e){this.#t=e}getState(){let e=this.#t,t=e.pipAvailability;return this.state.patch({pip:e.pip,availability:t,disabled:this.#e.disabled||t!==`available`,hidden:t!==`available`}),this.state.patch({label:vc(this.getLabel(this.state.current))}),this.state.current}async toggle(e){if(this.setMedia(e),!this.getState().disabled)return e.pip?e.exitPictureInPicture():e.requestPictureInPicture()}},pm={pip:`data-pip`,availability:`data-availability`,disabled:`data-disabled`,hidden:`data-hidden`},mm=class e{static defaultProps={label:``,disabled:!1};state=Vl({paused:!0,ended:!1,started:!1,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=ic(t,e.defaultProps)}getLabel(e){return up(this.#e.label,e)||(e.ended?rm:e.paused?tm:nm)}getAttrs(e){return{"aria-label":this.getLabel(e),"aria-disabled":this.#e.disabled?`true`:void 0}}setMedia(e){this.#t=e}getState(){let e=this.#t;return this.state.patch({paused:e.paused,ended:e.ended,started:e.started}),this.state.patch({label:vc(this.getLabel(this.state.current))}),this.state.current}async toggle(e){if(!this.#e.disabled){if(e.paused||e.ended)return e.play();e.pause()}}},hm={paused:`data-paused`,ended:`data-ended`,started:`data-started`},gm=class e{static defaultProps={label:``,disabled:!1,menuTrigger:!1};state=Vl({rate:1,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=ic(t,e.defaultProps)}getLabel(e){let t=up(this.#e.label,e);return t===void 0?Bp:t}getLabelParams(e){if(up(this.#e.label,e)===void 0)return{rate:e.rate}}getAttrs(e){return{"aria-label":this.getLabel(e),"aria-disabled":this.#e.disabled?`true`:void 0}}setMedia(e){this.#t=e}getState(){let e=this.#t;return this.state.patch({rate:e.playbackRate}),this.state.patch({label:vc(this.getLabel(this.state.current))}),this.state.current}cycle(e){if(this.#e.disabled||this.#e.menuTrigger)return;let{playbackRates:t,playbackRate:n}=e;if(t.length===0)return;let r=t.indexOf(n),i=r===-1?t.find(e=>e>n)??t[0]:t[(r+1)%t.length];e.setPlaybackRate(i)}},_m={rate:`data-rate`},vm=class e{static defaultProps={side:`top`,align:`center`,modal:!1,closeOnEscape:!0,closeOnOutsideClick:!0,open:!1,defaultOpen:!1,openOnHover:!1,delay:300,closeDelay:0};#e={...e.defaultProps};constructor(e){e&&this.setProps(e)}setProps(t){this.#e=ic(t,e.defaultProps)}#t=null;setInput(e){this.#t=e}getState(){let e=this.#t;return{open:e.active,status:e.status,side:this.#e.side,align:this.#e.align,modal:this.#e.modal,...ef(e.status)}}getTriggerAttrs(e,t){return{"aria-expanded":e.open&&e.status!==`ending`?`true`:`false`,"aria-haspopup":`dialog`,"aria-controls":t}}getPopupAttrs(e){return{popover:`manual`,role:`dialog`,"aria-modal":e.modal===!0?`true`:void 0}}},ym={open:`data-open`,side:`data-side`,align:`data-align`,...$d},bm=`seek.`,xm={key:`${bm}forward`,text:`Seek forward {seconds} seconds`},Sm={key:`${bm}backward`,text:`Seek backward {seconds} seconds`},Cm=class e{static defaultProps={seconds:30,label:``,disabled:!1};state=Vl({seeking:!1,direction:`forward`,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=ic(t,e.defaultProps)}getLabel(e){let t=up(this.#e.label,e);return t===void 0?e.direction===`backward`?Sm:xm:t}getLabelParams(e){if(up(this.#e.label,e)===void 0)return{seconds:Math.abs(this.#e.seconds)}}getAttrs(e){return{"aria-label":this.getLabel(e),"aria-disabled":this.#e.disabled?`true`:void 0}}setMedia(e){this.#t=e}getState(){let e=this.#t,t=this.#e.seconds<0?`backward`:`forward`;return this.state.patch({seeking:e.seeking,direction:t}),this.state.patch({label:vc(this.getLabel(this.state.current))}),this.state.current}async seek(e){this.#e.disabled||await e.seek(e.currentTime+this.#e.seconds)}},wm={seeking:`data-seeking`,direction:`data-direction`},Tm=class e{static defaultProps={label:``,step:1,largeStep:10,orientation:`horizontal`,disabled:!1,thumbAlignment:`center`,value:0,min:0,max:100};static defaultInput={pointerPercent:0,dragPercent:0,dragging:!1,pointing:!1,focused:!1};#e={...e.defaultProps};#t={...e.defaultInput};get props(){return this.#e}get input(){return this.#t}constructor(e){e&&this.setProps(e)}setProps(t){this.#e=ic(t,e.defaultProps)}setInput(e){this.#t=e}getSliderState(e){let{orientation:t,disabled:n,thumbAlignment:r}=this.#e,{pointerPercent:i,dragging:a,pointing:o,focused:s}=this.#t;return{value:e,fillPercent:this.percentFromValue(e),pointerPercent:i,dragging:a,pointing:o,interactive:a||o||s,orientation:t,disabled:n,thumbAlignment:r}}getLabel(e){return up(this.#e.label,e)||``}getAttrs(e){return{role:`slider`,tabIndex:e.disabled?-1:0,autoComplete:`off`,"aria-label":this.getLabel(e),"aria-valuemin":this.#e.min,"aria-valuemax":this.#e.max,"aria-valuenow":e.value,"aria-orientation":e.orientation,"aria-disabled":e.disabled?`true`:void 0}}valueFromPercent(e){let{min:t,max:n,step:r}=this.#e;return lf(cf(t+e/100*(n-t),t,n),r,t)}rawValueFromPercent(e){let{min:t,max:n}=this.#e;return cf(t+e/100*(n-t),t,n)}percentFromValue(e){let{min:t,max:n}=this.#e;return n===t?0:(e-t)/(n-t)*100}getStepPercent(){let{step:e,min:t,max:n}=this.#e,r=n-t;return r>0?e/r*100:0}getLargeStepPercent(){let{largeStep:e,min:t,max:n}=this.#e,r=n-t;return r>0?e/r*100:0}adjustPercentForAlignment(e,t,n){if(this.#e.thumbAlignment===`center`||n===0)return e;let r=t/n*100/2,i=r,a=100-r;return i+e/100*(a-i)}},Em={dragging:`data-dragging`,pointing:`data-pointing`,interactive:`data-interactive`,orientation:`data-orientation`,disabled:`data-disabled`},Dm={loading:`data-loading`,error:`data-error`,hidden:`data-hidden`};function Om(e,t){let n=e.trim().split(`#`),r=n[0]??``,i=n[1],a=t?new URL(r,t).href:r;if(!i)return{url:a};let o=i.indexOf(`=`);if(o===-1)return{url:a};let s=i.slice(0,o),c=i.slice(o+1).split(`,`).map(Number),l={};for(let e=0;e<s.length;e++){let t=s[e],n=c[e];t&&tc(n)&&!Number.isNaN(n)&&(l[t]=n)}let u={url:a};return tc(l.w)&&(u.width=l.w),tc(l.h)&&(u.height=l.h),tc(l.x)&&tc(l.y)&&(u.coords={x:l.x,y:l.y}),u}function km(e,t){let n=[];for(let r of e){let e=Om(r.text,t),i={url:e.url,startTime:r.startTime,endTime:r.endTime};e.width&&(i.width=e.width),e.height&&(i.height=e.height),e.coords&&(i.coords=e.coords),n.push(i)}return n}var Am=`time.`,jm={key:`${Am}current`,text:`Current time`},Mm={key:`${Am}duration`,text:`Duration`},Nm={key:`${Am}remaining`,text:`Remaining`},Pm={key:`${Am}remainingSuffix`,text:`{duration} remaining`},Fm={key:`${Am}showElapsed`,text:`{duration}. Show elapsed time.`},Im={key:`${Am}showDuration`,text:`{duration}. Show duration.`},Lm={key:`${Am}showRemaining`,text:`{duration}. Show remaining time.`},Rm={key:`${Am}position`,text:`{current} of {duration}`},zm={current:Fm,duration:Im,remaining:Lm},Bm={current:jm,duration:Mm,remaining:Nm},Vm=class e{static defaultProps={type:`current`,negativeSign:`-`,label:``,toggle:!1};#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=ic(t,e.defaultProps)}setMedia(e){this.#t=e}#n(){let e=this.#t,{type:t}=this.#e;switch(t){case`current`:return e.currentTime;case`duration`:return e.duration;case`remaining`:return e.currentTime-e.duration;default:return 0}}#r(){let e=this.#t,t=this.#n();return Zp(Math.abs(t),e.duration)}#i(){let{type:e}=this.#e,t=this.#n();return $p(e===`remaining`?t<0?t:-Math.abs(t):t)}#a(){let e=this.#n();return Qp(Math.abs(e))}#o(e,t){return e===`current`?t===`remaining`?`current`:`remaining`:t===`duration`?`remaining`:`duration`}getLabel(e,t=this.#e.type){let n=up(this.#e.label,e);return n===void 0?this.#e.toggle?zm[this.#o(t,e.type)]:Bm[this.#e.type]:n}getLabelParams(e){return up(this.#e.label,e)===void 0&&this.#e.toggle?{duration:e.phrase}:void 0}getAttrs(e,t=this.#e.type){return{"aria-label":this.getLabel(e,t),role:this.#e.toggle?`button`:void 0,tabIndex:this.#e.toggle?0:void 0}}getState(){let e=this.#n();return{type:this.#e.type,seconds:e,negative:this.#e.type===`remaining`&&e<0,text:this.#r(),phrase:this.#i(),datetime:this.#a()}}},Hm={type:`data-type`},Um={key:`slider.seek`,text:`Seek`},Wm=class e extends Tm{static defaultProps={...Tm.defaultProps,label:``,changeThrottle:100,pauseOnDrag:!1};#e={...e.defaultProps};#t=null;#n;#r=!1;constructor(e){super(),e&&this.setProps(e)}setProps(t){this.#e=ic(t,e.defaultProps),super.setProps({...t,min:0})}setMedia(e){this.#t=e}setFormatLocale(e){this.#n=e}getState(){let{duration:e,currentTime:t,seeking:n,buffered:r}=this.#t;super.setProps({...this.#e,min:0,max:e});let i=super.getSliderState(t),a=r.length>0?r[r.length-1][1]:0,o=e>0?a/e*100:0;return{...i,currentTime:t,duration:e,seeking:n,bufferPercent:o}}getLabel(e){return super.getLabel(e)||Um}#i(e){return e.dragging?this.rawValueFromPercent(e.pointerPercent):e.value}#a(e){return this.#n===void 0?$p(e):$p(e,{locale:this.#n})}getValueText(e){return Number.isFinite(e.duration)?Rm:this.getValueTextParams(e).current}getValueTextParams(e){let t=this.#a(this.#i(e));return Number.isFinite(e.duration)?{current:t,duration:this.#a(e.duration)}:{current:t}}startDrag(e){this.#r=!1,this.#e.pauseOnDrag&&e&&!e.paused&&(this.#r=!0,e.pause())}endDrag(e){this.#r&&e?.play().catch(()=>{}),this.#r=!1}getAttrs(e){let t=super.getAttrs(e),n=this.#i(e);return{...t,"aria-valuenow":n,"aria-valuetext":this.getValueText(e)}}},Gm={...Em,seeking:`data-seeking`},Km=class e{static defaultProps={side:`top`,align:`center`,open:!1,defaultOpen:!1,delay:600,closeDelay:0,disableHoverablePopup:!0,disabled:!1};#e={...e.defaultProps};constructor(e){e&&this.setProps(e)}setProps(t){this.#e=ic(t,e.defaultProps)}#t=null;setInput(e){this.#t=e}getState(){let e=this.#t;return{open:e.active,status:e.status,side:this.#e.side,align:this.#e.align,...ef(e.status)}}getPopupAttrs(e){return{popover:`manual`,role:`presentation`}}},qm={sideOffset:`--media-tooltip-side-offset`,alignOffset:`--media-tooltip-align-offset`,boundaryOffset:`--media-tooltip-boundary-offset`,anchorWidth:`--media-tooltip-anchor-width`,anchorHeight:`--media-tooltip-anchor-height`,availableWidth:`--media-tooltip-available-width`,availableHeight:`--media-tooltip-available-height`},Jm={open:`data-open`,side:`data-side`,align:`data-align`,...$d},Ym=class e{static defaultProps={delay:600,closeDelay:0,timeout:400};#e={...e.defaultProps};#t=0;#n=!1;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=ic(t,e.defaultProps)}get delay(){return this.#e.delay}get closeDelay(){return this.#e.closeDelay}shouldSkipDelay(){return this.#n?!0:Date.now()-this.#t<this.#e.timeout}notifyOpen(){this.#n=!0}notifyClose(){this.#n=!1,this.#t=Date.now()}},Xm=new Map;function Zm(e){return e===void 0?``:Array.isArray(e)?e.join(`:`):e}function Qm(e){let t=Zm(e),n=Xm.get(t);if(!n)try{n=new Intl.NumberFormat(e,{style:`percent`,maximumFractionDigits:0}),Xm.set(t,n)}catch{return}return n}function $m(e){return`${Math.round(Math.min(1,Math.max(0,e))*100)}%`}function eh(e,t){let n=!tc(e)||!Number.isFinite(e)?0:Math.min(1,Math.max(0,e));try{let e=Qm(t)??Qm(void 0);if(e)return e.format(n)}catch{}return $m(n)}var th=class e extends Tm{static defaultProps={...Tm.defaultProps,label:``,wheelStep:5};#e=null;#t;constructor(e){super(),e&&this.setProps(e)}setProps(t){super.setProps(ic(t,e.defaultProps))}setMedia(e){this.#e=e}setFormatLocale(e){this.#t=e}getState(){let e=this.#e,{volume:t,muted:n}=e,r=n||t===0,{dragging:i,dragPercent:a}=this.input,o=t*100,s=i?this.valueFromPercent(a):o,c=super.getSliderState(s);return{...c,fillPercent:r?0:c.fillPercent,volume:t,muted:r,availability:e.volumeAvailability}}getWheelStepPercent(){let e=this.props,t=e.max-e.min;return t>0?e.wheelStep/t*100:0}getLabel(e){return super.getLabel(e)||Up}getValueText(e){return e.muted?Hp:this.getValueTextParams(e).percent}getValueTextParams(e){return{percent:eh(e.value/100,this.#t)}}getAttrs(e){return{...super.getAttrs(e),"aria-valuetext":this.getValueText(e)}}},nh={...Em,availability:`data-availability`};r();var rh=M(null),ih=rh.Provider;function ah(){let t=e(rh);if(!t)throw Error(`AlertDialog compound components must be used within an AlertDialog.Root`);return t}var oh=Object.defineProperty,sh=(e,t)=>{let n={};for(var r in e)oh(n,r,{get:e[r],enumerable:!0});return t||oh(n,Symbol.toStringTag,{value:`Module`}),n};r();var ch=u(function({render:e,className:t,style:n,disabled:r,...i},a){let{dialog:o,state:s}=ah(),c=p(()=>{r||o.close()},[o,r]);return X(`button`,{render:e,className:t,style:n},{state:s,ref:[a],props:[{type:`button`,disabled:r,onClick:c},i]})});r();function lh(e){let{displayName:t,tag:n,useContext:r,staticProps:i,getProps:a}=e,o=u(function(e,t){let{render:o,className:s,style:c,...l}=e,u=r(),d=a?.(u.state);return X(n,{render:o,className:s,style:c},{state:u.state,stateAttrMap:u.stateAttrMap,ref:t,props:[i,d,l].filter(Boolean)})});return o.displayName=t,o}var uh=lh({displayName:`AlertDialogDescription`,tag:`p`,useContext:ah,getProps:e=>({id:e.descriptionId})});r();var dh=u(function({render:e,className:t,style:n,...r},i){let{core:a,dialog:o,state:s,stateAttrMap:c}=ah(),l=al(i,p(e=>{o.setElement(e)},[o]));return s.open?X(`div`,{render:e,className:t,style:n},{state:s,stateAttrMap:c,ref:l,props:[{tabIndex:-1,...a.getAttrs(s)},r]}):null});r();var fh=/[^a-zA-Z0-9_-]/g;function ph(e){let t=te().replace(fh,``);return e?`${e}-${t}`:t}r();function mh({open:e,defaultOpen:t=dp.defaultProps.defaultOpen,onOpenChange:n,onOpenChangeComplete:r,children:i}){let[a]=h(()=>new dp),o=e!==void 0,s=Y(n),c=Y(r),[l]=h(()=>{let e=Yd({transition:Mf(),onOpenChange:e=>{s.current?.(e)},onOpenChangeComplete:e=>{c.current?.(e)}});return!o&&t&&e.open(),e}),u=ph(`alert-dialog-title`),d=ph(`alert-dialog-desc`);a.setTitleId(u),a.setDescriptionId(d),m(()=>{if(e===void 0)return;let{active:t}=l.input.current;e!==t&&(e?l.open():l.close())},[e,l]),Hf(l);let f=ul(l.input);return a.setInput(f),F(ih,{value:{core:a,dialog:l,state:a.getState(),stateAttrMap:fp},children:i})}var hh=lh({displayName:`AlertDialogTitle`,tag:`h2`,useContext:ah,getProps:e=>({id:e.titleId})}),gh=sh({Close:()=>ch,Description:()=>uh,Popup:()=>dh,Root:()=>mh,Title:()=>hh});r();var _h=u(function(e,t){let{render:n,className:r,style:i,delay:a,...o}=e,s=vl(gd),[l]=h(()=>new pp);Hf(l),l.setProps({delay:a}),s&&l.update(s);let u=c(e=>l.state.subscribe(e),()=>l.state.current,()=>l.state.current);return s?X(`div`,{render:n,className:r,style:i},{state:u,stateAttrMap:mp,ref:[t],props:[o]}):null});r();var vh=M(null),yh=vh.Provider;function bh(){let t=e(vh);if(!t)throw Error(`Controls compound components must be used within a Controls.Root`);return t}function xh(){return e(vh)}r();var Sh=u(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{state:s,stateAttrMap:c}=bh(),l=o[`aria-label`]||o[`aria-labelledby`]?`group`:void 0;return X(`div`,{render:n,className:r,style:i},{state:s,stateAttrMap:c,ref:[t],props:[{role:l,children:a},o]})});r();var Ch=u(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=vl(fd),[c]=h(()=>new hp);if(!s)return null;c.setMedia(s);let l=c.getState();return F(yh,{value:{state:l,stateAttrMap:gp},children:X(`div`,{render:n,className:r,style:i},{state:l,stateAttrMap:gp,ref:[t],props:[{children:a},o,{"data-interactive":``}]})})}),wh=sh({Group:()=>Sh,Root:()=>Ch});r();var Th=M(null),Eh=Th.Provider;function Dh(){let t=e(Th);if(!t)throw Error(`ErrorDialog compound components must be used within an ErrorDialog.Root`);return t}r();var Oh=u(function({render:e,className:t,style:n,disabled:r,children:i,...a},o){let s=Tc(),{dialog:c,state:l,stateAttrMap:u}=ah(),d=p(()=>{r||c.close()},[c,r]),f=i??Sc(Np(),s);return X(`button`,{render:e,className:t,style:n},{state:l,stateAttrMap:u,ref:o,props:[{type:`button`,disabled:r,onClick:d,children:f},a]})});r();var kh=u(function({render:e,className:t,style:n,children:r,...i},a){let o=Tc(),{state:s,stateAttrMap:c}=ah(),{lastError:l}=Dh(),u=Pp(l),d=r??Sc(u,o);return X(`p`,{render:e,className:t,style:n},{state:s,stateAttrMap:c,ref:a,props:[{id:s.descriptionId,children:d},i]})});r();function Ah({children:e}){let[t]=h(()=>new _p),n=vl(pd),r=o(n?.error??null);n?.error&&(r.current=n.error);let i=Y(n),[a]=h(()=>Yd({transition:Mf(),onOpenChange:e=>{e||i.current?.dismissError()}})),s=ph(`error-dialog-title`),c=ph(`error-dialog-desc`);t.setTitleId(s),t.setDescriptionId(c),m(()=>{let e=!!n?.error,{active:t}=a.input.current;e&&!t?a.open():!e&&t&&a.close()},[n?.error,a]),Hf(a);let l=ul(a.input);t.setInput(l);let u=t.getState();return n?F(Eh,{value:{lastError:r.current},children:F(ih,{value:{core:t,dialog:a,state:u,stateAttrMap:fp},children:e})}):null}r();var jh=u(function({render:e,className:t,style:n,children:r,...i},a){let o=Tc(),{state:s,stateAttrMap:c}=ah(),l=r??Sc(Mp(),o);return X(`h2`,{render:e,className:t,style:n},{state:s,stateAttrMap:c,ref:a,props:[{id:s.titleId,children:l},i]})}),Mh=sh({Close:()=>Oh,Description:()=>kh,Popup:()=>dh,Root:()=>Ah,Title:()=>jh}),Nh=lp({displayName:`FullscreenButton`,core:Rp,stateAttrMap:zp,selector:md,action:(e,t)=>e.toggle(t),hotkeyAction:`toggleFullscreen`,isSupported:e=>!e.hidden});r();function Ph({type:e,action:t,value:n,pointer:r,region:i,disabled:a}){let o=vl(),s=xl();return m(()=>{if(!s||!e||!t||a)return;let c=Cd(t);if(!c)return;let l=e=>{c({store:o,value:n,event:e})},u={pointer:r,region:i,action:t,value:n};return e===`doubletap`?kd(s,l,u):Od(s,l,u)},[s,o,e,t,n,r,i,a]),null}var Fh=Ph;r();function Ih(){let[,e]=N(e=>e+1,0);return e}r();function Lh(e){let t=Y(e),r=o(null),i=o(null),a=Ih(),[s]=h(()=>Cf({getElement:()=>r.current,getThumbElement:()=>i.current,getOrientation:()=>t.current.orientation??`horizontal`,isRTL:()=>r.current?Dc(r.current):!1,isDisabled:()=>t.current.disabled??!1,getPercent:()=>t.current.getPercent(),getStepPercent:()=>t.current.getStepPercent(),getLargeStepPercent:()=>t.current.getLargeStepPercent(),changeThrottle:t.current.changeThrottle,adjustPercent:t.current.adjustPercent,onValueChange:e=>t.current.onValueChange?.(e),onValueCommit:e=>t.current.onValueCommit?.(e),onDragStart:()=>t.current.onDragStart?.(),onDragEnd:()=>t.current.onDragEnd?.()}));Hf(s);let c=ul(s.input),l=e.computeState(c);return n(()=>{l.thumbAlignment===`edge`&&r.current&&i.current&&a()},[l.thumbAlignment]),{state:l,cssVars:e.getCSSVars(s.adjustForAlignment(l)),rootRef:p(e=>{r.current=e},[]),thumbRef:p(e=>{i.current=e},[]),rootProps:s.rootProps,rootStyle:s.rootStyle,thumbProps:s.thumbProps}}r();function Rh({keys:e,action:t,value:n,disabled:r,target:i}){let a=vl(),o=xl();return m(()=>{if(!o||!e||!t||r)return;let s=Md(t);if(s)return Kd(o,{keys:e,action:t,value:n,target:i,disabled:r,repeatable:!Ad(t),onActivate:(e,t)=>{s({store:a,key:t,value:n})}})},[o,a,e,t,n,r,i]),null}var zh=Rh;r();function Bh(e){let t=e.side,[n,r]=h({preferred:t,side:t}),i=e.open&&n.preferred===t?n.side:t,a=b(()=>i===t?e:{...e,side:i},[i,e,t]),o=p(e=>r(n=>n.preferred===t&&n.side===e?n:{preferred:t,side:e}),[t]);return m(()=>{e.open||o(t)},[e.open,t,o]),{state:a,preferredSide:t,setPositionedSide:o}}var Vh=lp({displayName:`MuteButton`,core:om,stateAttrMap:cm,selector:bd,action:(e,t)=>e.toggle(t),hotkeyAction:`toggleMuted`}),Hh=lp({displayName:`PiPButton`,core:fm,stateAttrMap:pm,selector:hd,action:(e,t)=>e.toggle(t),hotkeyAction:`togglePictureInPicture`,isSupported:e=>!e.hidden}),Uh=lp({displayName:`PlayButton`,core:mm,stateAttrMap:hm,selector:gd,action:(e,t)=>e.toggle(t),hotkeyAction:`togglePaused`}),Wh=lp({displayName:`PlaybackRateButton`,core:gm,stateAttrMap:_m,selector:_d,action:(e,t)=>e.cycle(t),hotkeyAction:`speedUp`});r();var Gh=M(null),Kh=Gh.Provider;function qh(){let t=e(Gh);if(!t)throw Error(`Popover compound components must be used within a Popover.Root`);return t}var Jh=lh({displayName:`PopoverArrow`,tag:`div`,useContext:qh,staticProps:{"aria-hidden":`true`}});r();var Yh={position:`fixed`,inset:`auto`,margin:0},Xh=u(function({render:e,className:t,style:r,...i},a){let{core:s,popover:c,state:l,preferredSide:u,setPositionedSide:d,stateAttrMap:f,anchorName:m,popupId:g,boundary:_,container:v}=qh(),y=o(null),x=al(a,p(e=>{c.setPopupElement(e),e&&jc()&&e.style.setProperty(`position-anchor`,`--${m}`)},[c,m]),y),S=b(()=>({side:u,align:l.align}),[u,l.align]),C=b(()=>{if(!jc())return null;let{positionAnchor:e,...t}=hf(m,S);return t},[m,S]),[w,T]=h(null);n(()=>{if(!l.open){T(null);return}function e(){let e=c.triggerElement,t=y.current;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getRootNode(),i=of(_,{container:v,root:r}),a=bf(t,S.side),o=af(i),s=yf(t),l=Wc(n,a,o,S,s),{positionAnchor:u,...f}=hf(m,{...S,side:l},n,jc()?void 0:a,o,s);T(f),d(l)}e();let t=c.triggerElement,n=y.current,r=n?of(_,{container:v,root:n.getRootNode()}):null,i=0;function a(t){t&&Lf(t,y.current)||(cancelAnimationFrame(i),i=requestAnimationFrame(e))}a();let o=typeof ResizeObserver==`function`?new ResizeObserver(()=>{a()}):null;return t&&o&&o.observe(t),n&&o&&o.observe(n),r&&o&&o.observe(r),window.addEventListener(`scroll`,a,{capture:!0,passive:!0}),window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(i),o?.disconnect(),window.removeEventListener(`scroll`,a,!0),window.removeEventListener(`resize`,a)}},[l.open,m,S,c,_,v,d]);let E=w??C??Yh;if(!l.open)return null;let{onFocusOut:D,...O}=c.popupProps;return X(`div`,{render:e,className:t,style:r},{state:l,stateAttrMap:f,ref:x,props:[{id:g,style:E,...s.getPopupAttrs(l)},{...O,onBlur:D},i]})});r();function Zh({open:e,defaultOpen:t=vm.defaultProps.defaultOpen,onOpenChange:n,onOpenChangeComplete:r,openOnHover:i=vm.defaultProps.openOnHover,delay:a=vm.defaultProps.delay,closeDelay:o=vm.defaultProps.closeDelay,boundary:s=`container`,children:c,...l}){let u=Sl(),d=Cl(),f=xh(),[p]=h(()=>new vm(l));p.setProps(l);let g=!q(e),_=Y(n),v=Y(r),y=Y(l.closeOnEscape),b=Y(l.closeOnOutsideClick),x=Y(i),S=Y(a),C=Y(o),w=Y(d),[T]=h(()=>{let e=tf({transition:Mf(),onOpenChange:(e,t)=>{_.current?.(e,t)},onOpenChangeComplete:e=>{v.current?.(e)},closeOnEscape:()=>y.current??vm.defaultProps.closeOnEscape,closeOnOutsideClick:()=>b.current??vm.defaultProps.closeOnOutsideClick,openOnHover:()=>x.current,delay:()=>S.current,closeDelay:()=>C.current,group:()=>w.current});return!g&&t&&e.open(`click`),e}),E=ph(),D=ph(`popup`);m(()=>{if(q(e))return;let{active:t}=T.input.current;e!==t&&(e?T.open(`click`):T.close(`click`))},[e,T]),m(()=>{q(f?.state.visible)||f.state.visible||T.close(`imperative-action`)},[f?.state.visible,T]),Hf(T);let O=ul(T.input);p.setInput(O);let{state:k,preferredSide:A,setPositionedSide:j}=Bh(p.getState());return F(Kh,{value:{core:p,popover:T,state:k,preferredSide:A,setPositionedSide:j,stateAttrMap:ym,anchorName:E,popupId:D,boundary:s,container:u},children:c})}r();var Qh=u(function({render:e,className:t,style:n,...r},i){let{core:a,popover:o,state:s,stateAttrMap:c,anchorName:l,popupId:u}=qh(),d=p(e=>{o.setTriggerElement(e),e&&jc()&&e.style.setProperty(`anchor-name`,`--${l}`)},[o,l]),{onFocusIn:f,onFocusOut:m,...h}=o.triggerProps;return X(`button`,{render:e,className:t,style:n},{state:s,stateAttrMap:c,ref:[i,d],props:[{type:`button`,...a.getTriggerAttrs(s,u)},{...h,onFocus:f,onBlur:m},r]})}),$h=sh({Arrow:()=>Jh,Popup:()=>Xh,Root:()=>Zh,Trigger:()=>Qh}),eg=lp({displayName:`SeekButton`,core:Cm,stateAttrMap:wm,selector:yd,action:(e,t)=>e.seek(t),hotkeyAction:`seekStep`,hotkeyValue:e=>typeof e.seconds==`number`?e.seconds:Cm.defaultProps.seconds});r();var tg=u(function(e,t){let{render:n,className:r,style:i,time:a=0,thumbnails:s,crossOrigin:c,loading:l,fetchPriority:u,...d}=e,[f]=h(()=>new Of),p=o(null),m=o(null),g=yl(vd),[,_]=h(0),[v]=h(()=>kf({getContainer:()=>p.current,getImg:()=>m.current,onStateChange:()=>_(e=>e+1)}));Hf(v,()=>v.connect());let y=b(()=>s&&s.length>0?s:g&&g.thumbnailCues.length>0?km(g.thumbnailCues,g.thumbnailTrackSrc??void 0):[],[s,g]),x=b(()=>f.findActiveThumbnail(y,a),[f,y,a]);v.updateSrc(x?.url);let S=f.getState(v.loading,v.error,x),C={overflow:`hidden`},w;if(x&&v.naturalWidth&&v.naturalHeight){let e=v.readConstraints(),t=f.resize(x,v.naturalWidth,v.naturalHeight,e);t&&(C={overflow:`hidden`,width:t.containerWidth,height:t.containerHeight},w={width:t.imageWidth,height:t.imageHeight,maxWidth:`none`,transform:t.offsetX||t.offsetY?`translate(-${t.offsetX}px, -${t.offsetY}px)`:void 0})}return X(`div`,{render:n,className:r,style:i},{state:S,stateAttrMap:Dm,ref:[t,p],props:[f.getAttrs(S),{style:C},d,{children:F(`img`,{ref:m,alt:``,"aria-hidden":`true`,decoding:`async`,src:x?.url,crossOrigin:c===``||c===null?void 0:c,loading:l,style:w,fetchPriority:u})}]})});r();var ng=M(null);function rg({value:e,children:t}){return F(ng.Provider,{value:e,children:t})}function ig(){let t=e(ng);if(!t)throw Error(`Slider compound components must be used within a Slider.Root`);return t}var ag=lh({displayName:`SliderBuffer`,tag:`div`,useContext:ig}),og=lh({displayName:`SliderFill`,tag:`div`,useContext:ig});r();var sg=u(function(e,t){let{render:n,className:r,style:i,overflow:a=`clamp`,...s}=e,c=ig(),{state:l}=c,u=o(null),[d,f]=h(0);m(()=>{let e=u.current;if(!e)return;let t=new ResizeObserver(([e])=>{f(e.contentRect.width)});return t.observe(e),()=>t.disconnect()},[]);let p=Df(d,a);return X(`div`,{render:n,className:r,style:i},{state:l,stateAttrMap:c.stateAttrMap,ref:[t,u],props:[{style:p},s]})});r();var cg=u(function(e,t){let{render:n,className:r,style:i,label:a,min:o,max:s,step:c,largeStep:l,orientation:u,disabled:d,thumbAlignment:f,value:p=0,onValueChange:m,onValueCommit:g,onDragStart:_,onDragEnd:v,...y}=e,[b]=h(()=>new Tm),x=Tc();b.setProps({label:a,min:o,max:s,step:c,largeStep:l,orientation:u,disabled:d,thumbAlignment:f});let{state:S,cssVars:C,rootRef:w,thumbRef:T,rootProps:E,rootStyle:D,thumbProps:O}=Lh({computeState:e=>(b.setInput(e),b.getSliderState(p)),getPercent:()=>b.percentFromValue(p),getStepPercent:()=>b.getStepPercent(),getLargeStepPercent:()=>b.getLargeStepPercent(),orientation:u,disabled:d,adjustPercent:(e,t,n)=>b.adjustPercentForAlignment(e,t,n),getCSSVars:Tf,onValueChange:e=>m?.(b.valueFromPercent(e)),onValueCommit:e=>g?.(b.valueFromPercent(e)),onDragStart:_,onDragEnd:v});return F(rg,{value:{state:S,pointerValue:b.valueFromPercent(S.pointerPercent),thumbRef:T,thumbProps:O,stateAttrMap:Em,getAttrs:e=>{let t=b.getAttrs(e);return{...t,"aria-label":Sc(t[`aria-label`],x)}},formatValue:void 0},children:X(`div`,{render:n,className:r,style:i},{state:S,stateAttrMap:Em,ref:[t,w],props:[{style:{...C,...D}},E,y]})})});r();var lg=u(function(e,t){let{render:n,className:r,style:i,...a}=e,o=ig(),{state:s,thumbRef:c,thumbProps:l,getAttrs:u}=o,d=u(s);return X(`div`,{render:n,className:r,style:i},{state:s,stateAttrMap:o.stateAttrMap,ref:[t,c],props:[d,l,a]})});r();var ug=u(function(e,t){let{pointerValue:n}=ig();return F(tg,{ref:t,...e,time:n})}),dg=lh({displayName:`SliderTrack`,tag:`div`,useContext:ig});r();var fg=u(function(e,t){let{render:n,className:r,style:i,type:a=`current`,format:o,...s}=e,c=ig(),{state:l,pointerValue:u,formatValue:d}=c,f=a===`pointer`?u:l.value,p=o?o(f):d?d(f,a):String(Math.round(f));return X(`output`,{render:n,className:r,style:i},{state:l,stateAttrMap:c.stateAttrMap,ref:t,props:[{"aria-live":`off`,children:p},s]})}),pg=sh({Buffer:()=>ag,Fill:()=>og,Preview:()=>sg,Root:()=>cg,Thumb:()=>lg,Thumbnail:()=>ug,Track:()=>dg,Value:()=>fg});r();var mg=u(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e;return X(`span`,{render:n,className:r,style:i},{state:{},ref:[t],props:[{children:a},o]})});r();var hg=u(function(e,t){let{render:n,className:r,style:i,children:a=`/`,...o}=e;return X(`span`,{render:n,className:r,style:i},{state:{},ref:[t],props:[{"aria-hidden":`true`,children:a},o]})});r(),_();var gg=u(function(e,t){let{render:n,className:r,style:i,type:a,negativeSign:o,label:s,toggle:c=!1,...l}=e,u=vl(yd),d=Tc(),f=Ec(),[p]=h(()=>new Vm),g=a??Vm.defaultProps.type,[_,v]=h(g);if(m(()=>{v(g)},[g,c]),p.setProps({type:_,negativeSign:o,label:s,toggle:c}),!u)return null;p.setMedia(u);let y=p.getState(),b=p.getAttrs(y,g),x=p.getLabelParams(y)?{duration:y.type===`remaining`?Sc(Pm,d,{duration:$p(Math.abs(y.seconds),{locale:f})}):$p(Math.abs(y.seconds),{locale:f})}:void 0,S=y.negative?F(j,{children:[F(`span`,{"aria-hidden":`true`,children:o??Vm.defaultProps.negativeSign}),y.text]}):y.text,C=()=>{v(e=>g===`current`?e===`remaining`?`current`:`remaining`:e===`duration`?`remaining`:`duration`)},w=e=>{e.defaultPrevented||C()},T=e=>{!e.defaultPrevented&&zc(e.nativeEvent)&&(e.preventDefault(),!e.repeat&&C())};return X(`time`,{render:n,className:r,style:i},{state:y,stateAttrMap:Hm,ref:[t],props:[{dateTime:y.datetime,children:S,...b,"aria-label":Sc(b[`aria-label`],d,x),...c?{onClick:w,onKeyDown:T}:void 0},l]})}),_g=sh({Group:()=>mg,Separator:()=>hg,Value:()=>gg});r();var vg=()=>Promise.resolve(0),yg=u(function(e,t){let{render:n,className:r,style:i,label:a,changeThrottle:o=Wm.defaultProps.changeThrottle,step:s=Wm.defaultProps.step,largeStep:c=Wm.defaultProps.largeStep,orientation:l,disabled:u,thumbAlignment:d,onDragStart:f,onDragEnd:p,pauseOnDrag:g,..._}=e,v=vl(yd),y=vl(dd),b=vl(gd),x=Tc(),S=Ec(),[C]=h(()=>new Wm);C.setProps({label:a,step:s,largeStep:c,orientation:l,disabled:u,thumbAlignment:d,pauseOnDrag:g,changeThrottle:o}),C.setFormatLocale(S);let w=Y(v&&y?{...v,...y}:null),T=Y(b);m(()=>()=>C.endDrag(T.current),[C]);let E=v?.duration??0,{state:D,cssVars:O,rootRef:k,thumbRef:A,rootProps:j,rootStyle:ee,thumbProps:te}=Lh({computeState:e=>(C.setInput(e),!v||!y?C.setMedia({currentTime:0,duration:0,seeking:!1,seek:vg,buffered:[],seekable:[]}):C.setMedia({...v,...y}),C.getState()),getPercent:()=>E>0?(v?.currentTime??0)/E*100:0,getStepPercent:()=>C.getStepPercent(),getLargeStepPercent:()=>C.getLargeStepPercent(),orientation:l,disabled:u,changeThrottle:o,adjustPercent:(e,t,n)=>C.adjustPercentForAlignment(e,t,n),getCSSVars:Ef,onValueCommit:e=>{let t=w.current;t&&t.seek(C.rawValueFromPercent(e))},onDragStart:()=>{C.startDrag(T.current),f?.()},onDragEnd:()=>{C.endDrag(T.current),p?.()}});return v?F(rg,{value:{state:D,pointerValue:C.valueFromPercent(D.pointerPercent),thumbRef:A,thumbProps:te,stateAttrMap:Gm,getAttrs:e=>{let t=C.getAttrs(e);return{...t,"aria-label":Sc(t[`aria-label`],x),"aria-valuetext":Sc(t[`aria-valuetext`],x,C.getValueTextParams(e))}},formatValue:e=>Zp(e,E)},children:X(`div`,{render:n,className:r,style:i},{state:D,stateAttrMap:Gm,ref:[t,k],props:[{style:{...O,...ee}},j,_]})}):null}),bg=sh({Buffer:()=>ag,Fill:()=>og,Preview:()=>sg,Root:()=>yg,Thumb:()=>lg,Track:()=>dg,Value:()=>fg}),xg=lh({displayName:`TooltipArrow`,tag:`div`,useContext:op,staticProps:{"aria-hidden":`true`}});r();var Sg=u(function({render:e,className:t,style:n,children:r,...i},a){let{state:o,stateAttrMap:s,content:c}=op(),l=r===void 0?c?.label??``:r;return X(`span`,{render:e,className:t,style:n},{state:o,stateAttrMap:s,ref:a,props:[i,{children:l}]})});r();var Cg=u(function({render:e,className:t,style:n,children:r,...i},a){let{state:o,stateAttrMap:s,content:c}=op(),l=r??c?.shortcut??null;return l?X(`kbd`,{render:e,className:t,style:n},{state:o,stateAttrMap:s,ref:a,props:[i,{children:l}]}):null});r(),_();var wg={position:`fixed`,inset:`auto`,margin:0},Tg=u(function({render:e,className:t,style:r,children:i,...a},s){let{core:c,tooltip:l,state:u,preferredSide:d,setPositionedSide:f,stateAttrMap:m,anchorName:g,popupId:_,boundary:v,container:y}=op(),x=o(null),S=al(s,p(e=>{l.setPopupElement(e),e&&jc()&&e.style.setProperty(`position-anchor`,`--${g}`)},[l,g]),x),C=b(()=>({side:d,align:u.align}),[d,u.align]),w=b(()=>{if(!jc())return null;let{positionAnchor:e,...t}=hf(g,C,void 0,void 0,void 0,void 0,qm);return t},[g,C]),[T,E]=h(null);n(()=>{if(!u.open){E(null);return}function e(){let e=l.triggerElement,t=x.current;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getRootNode(),i=of(v,{container:y,root:r}),a=bf(t,C.side),o=af(i),s=yf(t,qm),c=Wc(n,a,o,C,s),{positionAnchor:u,...d}=hf(g,{...C,side:c},n,jc()?void 0:a,o,s,qm);E(d),f(c)}e();let t=l.triggerElement,n=x.current,r=n?of(v,{container:y,root:n.getRootNode()}):null,i=0;function a(t){t&&Lf(t,x.current)||(cancelAnimationFrame(i),i=requestAnimationFrame(e))}a();let o=typeof ResizeObserver==`function`?new ResizeObserver(()=>{a()}):null;return t&&o&&o.observe(t),n&&o&&o.observe(n),r&&o&&o.observe(r),window.addEventListener(`scroll`,a,{capture:!0,passive:!0}),window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(i),o?.disconnect(),window.removeEventListener(`scroll`,a,!0),window.removeEventListener(`resize`,a)}},[u.open,g,C,l,v,y,f]);let D=T??w??wg;if(!u.open)return null;let O=i===void 0?F(j,{children:[F(Sg,{}),F(Cg,{})]}):i,{onFocusOut:k,...A}=l.popupProps;return X(`div`,{render:e,className:t,style:r},{state:u,stateAttrMap:m,ref:S,props:[{id:_,style:D,...c.getPopupAttrs(u)},{children:O},{...A,onBlur:k},a]})});r();var Eg=M(null),Dg=Eg.Provider;function Og(){return e(Eg)?.group}r();function kg({delay:e,closeDelay:t,timeout:n,children:r}){let[i]=h(()=>new Ym({delay:e,closeDelay:t,timeout:n}));return i.setProps({delay:e,closeDelay:t,timeout:n}),F(Dg,{value:{group:i},children:r})}r();function Ag({open:e,defaultOpen:t=Km.defaultProps.defaultOpen,onOpenChange:n,onOpenChangeComplete:r,delay:i=Km.defaultProps.delay,closeDelay:a=Km.defaultProps.closeDelay,disableHoverablePopup:o=Km.defaultProps.disableHoverablePopup,disabled:s=Km.defaultProps.disabled,boundary:c=`container`,children:l,...u}){let d=Sl(),f=xh(),[p]=h(()=>new Km(u));p.setProps(u);let g=!q(e),_=Og(),v=Y(n),y=Y(r),b=Y(i),x=Y(a),S=Y(o),C=Y(s),w=Y(_),[T]=h(()=>{let e=jf({transition:Mf(),onOpenChange:(e,t)=>{v.current?.(e,t)},onOpenChangeComplete:e=>{y.current?.(e)},delay:()=>b.current,closeDelay:()=>x.current,disableHoverablePopup:()=>S.current,disabled:()=>C.current,group:()=>w.current});return!g&&t&&e.open(),e}),[E,D]=h(),O=ph(),k=ph(`tooltip`);m(()=>{if(q(e))return;let{active:t}=T.input.current;e!==t&&(e?T.open():T.close())},[e,T]),m(()=>{q(f?.state.visible)||f.state.visible||T.close(`imperative-action`)},[f?.state.visible,T]),Hf(T);let A=ul(T.input);p.setInput(A);let{state:j,preferredSide:ee,setPositionedSide:te}=Bh(p.getState());return F(ap,{value:{core:p,tooltip:T,state:j,preferredSide:ee,setPositionedSide:te,stateAttrMap:Jm,anchorName:O,popupId:k,content:E,setContent:D,boundary:c,container:d},children:l})}r();var jg=u(function({render:e,className:t,style:n,...r},i){let{tooltip:a,state:o,stateAttrMap:s,anchorName:c}=op(),l=p(e=>{a.setTriggerElement(e),e&&jc()&&e.style.setProperty(`anchor-name`,`--${c}`)},[a,c]),{onFocusIn:u,onFocusOut:d,...f}=a.triggerProps;return X(`button`,{render:e,className:t,style:n},{state:o,stateAttrMap:s,ref:[i,l],props:[{type:`button`},{...f,onFocus:u,onBlur:d},r]})}),Mg=sh({Arrow:()=>xg,Label:()=>Sg,Popup:()=>Tg,Provider:()=>kg,Root:()=>Ag,Shortcut:()=>Cg,Trigger:()=>jg});r();var Ng={volume:0,muted:!1,volumeAvailability:`unsupported`,setVolume:()=>0,toggleMuted:()=>!1},Pg=u(function(e,t){let{render:n,className:r,style:i,label:a,orientation:s,step:c=th.defaultProps.step,largeStep:l=th.defaultProps.largeStep,wheelStep:u=th.defaultProps.wheelStep,disabled:d,thumbAlignment:f,onDragStart:m,onDragEnd:g,..._}=e,v=vl(bd),y=Tc(),b=Ec(),[x]=h(()=>new th);x.setProps({label:a,orientation:s,step:c,largeStep:l,wheelStep:u,disabled:d,thumbAlignment:f}),x.setFormatLocale(b);let S=Y(v),C=Y(d),w=()=>(S.current?.volume??0)*100,T=()=>x.getStepPercent(),E=e=>S.current?.setVolume(e/100),{state:D,cssVars:O,rootRef:k,thumbRef:A,rootProps:j,rootStyle:ee,thumbProps:te}=Lh({computeState:e=>(x.setInput(e),x.setMedia(v??Ng),x.getState()),getPercent:w,getStepPercent:T,getLargeStepPercent:()=>x.getLargeStepPercent(),orientation:s,disabled:d,adjustPercent:(e,t,n)=>x.adjustPercentForAlignment(e,t,n),getCSSVars:Tf,onValueChange:E,onValueCommit:E,onDragStart:m,onDragEnd:g}),[M]=h(()=>If({isDisabled:()=>!!C.current||!S.current,getPercent:()=>(S.current?.volume??0)*100,getStepPercent:()=>x.getWheelStepPercent(),onValueChange:e=>S.current?.setVolume(e/100)})),N=o(null),P=p(e=>{N.current?.(),N.current=null,e&&(N.current=J(e,`wheel`,M.onWheel,{passive:!1}))},[M]);return v?F(rg,{value:{state:D,pointerValue:x.valueFromPercent(D.pointerPercent),thumbRef:A,thumbProps:te,stateAttrMap:nh,getAttrs:e=>{let t=x.getAttrs(e);return{...t,"aria-label":Sc(t[`aria-label`],y),"aria-valuetext":Sc(t[`aria-valuetext`],y,x.getValueTextParams(e))}},formatValue:e=>`${Math.round(e)}%`},children:X(`div`,{render:n,className:r,style:i},{state:D,stateAttrMap:nh,ref:[t,k,P],props:[{style:{...O,...ee}},j,_]})}):null}),Fg=sh({Fill:()=>og,Preview:()=>sg,Root:()=>Pg,Thumb:()=>lg,Track:()=>dg,Value:()=>fg}),Ig=v(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Lg=v(((e,t)=>{var n=Ig();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),Rg=v(((e,t)=>{t.exports=Lg()()}));r();var Z=S(Rg());function zg(){return zg=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},zg.apply(this,arguments)}function Bg(e,t){if(e==null)return{};var n=Vg(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Vg(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Hg=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Bg(e,[`color`,`size`]);return t.createElement(`svg`,zg({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`path`,{d:`M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z`}),t.createElement(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),t.createElement(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`}))});Hg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Hg.displayName=`AlertTriangle`,r();function Ug(){return Ug=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ug.apply(this,arguments)}function Wg(e,t){if(e==null)return{};var n=Gg(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Gg(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Kg=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Wg(e,[`color`,`size`]);return t.createElement(`svg`,Ug({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`polyline`,{points:`20 6 9 17 4 12`}))});Kg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Kg.displayName=`Check`,r();function qg(){return qg=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},qg.apply(this,arguments)}function Jg(e,t){if(e==null)return{};var n=Yg(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Yg(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Xg=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Jg(e,[`color`,`size`]);return t.createElement(`svg`,qg({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`polyline`,{points:`15 18 9 12 15 6`}))});Xg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Xg.displayName=`ChevronLeft`,r();function Zg(){return Zg=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Zg.apply(this,arguments)}function Qg(e,t){if(e==null)return{};var n=$g(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function $g(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var e_=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Qg(e,[`color`,`size`]);return t.createElement(`svg`,Zg({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`polyline`,{points:`9 18 15 12 9 6`}))});e_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},e_.displayName=`ChevronRight`,r();function t_(){return t_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},t_.apply(this,arguments)}function n_(e,t){if(e==null)return{};var n=r_(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function r_(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var i_=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=n_(e,[`color`,`size`]);return t.createElement(`svg`,t_({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),t.createElement(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`}))});i_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},i_.displayName=`Copy`,r();function a_(){return a_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a_.apply(this,arguments)}function o_(e,t){if(e==null)return{};var n=s_(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function s_(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var c_=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=o_(e,[`color`,`size`]);return t.createElement(`svg`,a_({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3`}))});c_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},c_.displayName=`Maximize`,r();function l_(){return l_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l_.apply(this,arguments)}function u_(e,t){if(e==null)return{};var n=d_(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function d_(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var f_=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=u_(e,[`color`,`size`]);return t.createElement(`svg`,l_({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`path`,{d:`M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3`}))});f_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},f_.displayName=`Minimize`,r();function p_(){return p_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},p_.apply(this,arguments)}function m_(e,t){if(e==null)return{};var n=h_(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function h_(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var g_=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=m_(e,[`color`,`size`]);return t.createElement(`svg`,p_({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`rect`,{x:`6`,y:`4`,width:`4`,height:`16`}),t.createElement(`rect`,{x:`14`,y:`4`,width:`4`,height:`16`}))});g_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},g_.displayName=`Pause`,r();function __(){return __=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},__.apply(this,arguments)}function v_(e,t){if(e==null)return{};var n=y_(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function y_(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var b_=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=v_(e,[`color`,`size`]);return t.createElement(`svg`,__({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`polygon`,{points:`5 3 19 12 5 21 5 3`}))});b_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},b_.displayName=`Play`,r();function x_(){return x_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},x_.apply(this,arguments)}function S_(e,t){if(e==null)return{};var n=C_(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function C_(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var w_=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=S_(e,[`color`,`size`]);return t.createElement(`svg`,x_({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`polyline`,{points:`1 4 1 10 7 10`}),t.createElement(`path`,{d:`M3.51 15a9 9 0 1 0 2.13-9.36L1 10`}))});w_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},w_.displayName=`RotateCcw`,r();function T_(){return T_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},T_.apply(this,arguments)}function E_(e,t){if(e==null)return{};var n=D_(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function D_(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var O_=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=E_(e,[`color`,`size`]);return t.createElement(`svg`,T_({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`circle`,{cx:`12`,cy:`12`,r:`3`}),t.createElement(`path`,{d:`M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z`}))});O_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},O_.displayName=`Settings`,r();function k_(){return k_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},k_.apply(this,arguments)}function A_(e,t){if(e==null)return{};var n=j_(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function j_(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var M_=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=A_(e,[`color`,`size`]);return t.createElement(`svg`,k_({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`polygon`,{points:`11 5 6 9 2 9 2 15 6 15 11 19 11 5`}),t.createElement(`path`,{d:`M15.54 8.46a5 5 0 0 1 0 7.07`}))});M_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},M_.displayName=`Volume1`,r();function N_(){return N_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},N_.apply(this,arguments)}function P_(e,t){if(e==null)return{};var n=F_(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function F_(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var I_=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=P_(e,[`color`,`size`]);return t.createElement(`svg`,N_({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`polygon`,{points:`11 5 6 9 2 9 2 15 6 15 11 19 11 5`}),t.createElement(`path`,{d:`M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07`}))});I_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},I_.displayName=`Volume2`,r();function L_(){return L_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},L_.apply(this,arguments)}function R_(e,t){if(e==null)return{};var n=z_(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function z_(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var B_=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=R_(e,[`color`,`size`]);return t.createElement(`svg`,L_({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`polygon`,{points:`11 5 6 9 2 9 2 15 6 15 11 19 11 5`}),t.createElement(`line`,{x1:`23`,y1:`9`,x2:`17`,y2:`15`}),t.createElement(`line`,{x1:`17`,y1:`9`,x2:`23`,y2:`15`}))});B_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},B_.displayName=`VolumeX`;var V_=v(((e,t)=>{(function(){var e={}.hasOwnProperty;function n(){for(var e=``,t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,r(n)))}return e}function r(t){if(typeof t==`string`||typeof t==`number`)return t;if(typeof t!=`object`)return``;if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes(`[native code]`))return t.toString();var r=``;for(var a in t)e.call(t,a)&&t[a]&&(r=i(r,a));return r}function i(e,t){return t?e?e+` `+t:e+t:e}t!==void 0&&t.exports?(n.default=n,t.exports=n):typeof define==`function`&&typeof define.amd==`object`&&define.amd?define(`classnames`,[],function(){return n}):window.classNames=n})()}));ne(),r();var H_=S(V_(),1),U_=`react-tooltip-core-styles`,W_=`react-tooltip-base-styles`,G_={core:!1,base:!1};function K_({css:e,id:t=W_,type:n=`base`,ref:r}){if(!e||typeof document>`u`||G_[n]||n===`core`&&re!==void 0&&(re==null?void 0:{})?.REACT_TOOLTIP_DISABLE_CORE_STYLES||n!==`base`&&re!==void 0&&(re==null?void 0:{})?.REACT_TOOLTIP_DISABLE_BASE_STYLES)return;n===`core`&&(t=U_),r||={};let{insertAt:i}=r;if(document.getElementById(t))return;let a=document.head||document.getElementsByTagName(`head`)[0],o=document.createElement(`style`);o.id=t,o.type=`text/css`,i===`top`&&a.firstChild?a.insertBefore(o,a.firstChild):a.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e)),G_[n]=!0}var q_=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r=`top`,offset:i=10,strategy:a=`absolute`,middlewares:o=[C(Number(i)),w({fallbackAxisSideDirection:`start`}),g({padding:5})],border:s,arrowSize:c=8})=>{if(!e||t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};let l=o;return n?(l.push(x({element:n,padding:5})),k(e,t,{placement:r,strategy:a,middleware:l}).then((({x:e,y:t,placement:n,middlewareData:r})=>{let i={left:`${e}px`,top:`${t}px`,border:s},{x:a,y:o}=r.arrow??{x:0,y:0},l={top:`bottom`,right:`left`,bottom:`top`,left:`right`}[n.split(`-`)[0]]??`bottom`,u=s&&{borderBottom:s,borderRight:s},d=0;if(s){let e=`${s}`.match(/(\d+)px/);d=e?.[1]?Number(e[1]):1}return{tooltipStyles:i,tooltipArrowStyles:{left:a==null?``:`${a}px`,top:o==null?``:`${o}px`,right:``,bottom:``,...u,[l]:`-${c/2+d-1}px`},place:n}}))):k(e,t,{placement:`bottom`,strategy:a,middleware:l}).then((({x:e,y:t,placement:n})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:n})))},J_=(e,t)=>!(`CSS`in window&&`supports`in window.CSS)||window.CSS.supports(e,t),Y_=(e,t,n)=>{let r=null,i=function(...i){let a=()=>{r=null,n||e.apply(this,i)};n&&!r&&(e.apply(this,i),r=setTimeout(a,t)),n||(r&&clearTimeout(r),r=setTimeout(a,t))};return i.cancel=()=>{r&&=(clearTimeout(r),null)},i},X_=e=>e!==null&&!Array.isArray(e)&&typeof e==`object`,Z_=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every(((e,n)=>Z_(e,t[n])));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!X_(e)||!X_(t))return e===t;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every((n=>Z_(e[n],t[n])))},Q_=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;let t=getComputedStyle(e);return[`overflow`,`overflow-x`,`overflow-y`].some((e=>{let n=t.getPropertyValue(e);return n===`auto`||n===`scroll`}))},$_=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(Q_(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},ev=typeof window<`u`?n:m,tv=e=>{e.current&&=(clearTimeout(e.current),null)},nv=`DEFAULT_TOOLTIP_ID`,rv={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},iv=M({getTooltipData:()=>rv});function av(t=nv){return e(iv).getTooltipData(t)}var ov={tooltip:`core-styles-module_tooltip__3vRRp`,fixed:`core-styles-module_fixed__pcSol`,arrow:`core-styles-module_arrow__cvMwQ`,content:`core-styles-module_content__BRKdB`,noArrow:`core-styles-module_noArrow__xock6`,clickable:`core-styles-module_clickable__ZuTTB`,show:`core-styles-module_show__Nt9eE`,closing:`core-styles-module_closing__sGnxF`},sv={tooltip:`styles-module_tooltip__mnnfp`,content:`styles-module_content__ydYdI`,arrow:`styles-module_arrow__K0L3T`,dark:`styles-module_dark__xNqje`,light:`styles-module_light__Z6W-X`,success:`styles-module_success__A2AKt`,warning:`styles-module_warning__SCK0X`,error:`styles-module_error__JvumD`,info:`styles-module_info__BWdHW`},cv=({forwardRef:e,id:n,className:r,classNameArrow:i,variant:s=`dark`,anchorId:c,anchorSelect:l,place:u=`top`,offset:d=10,events:f=[`hover`],openOnClick:g=!1,positionStrategy:_=`absolute`,middlewares:v,wrapper:y,delayShow:b=0,delayHide:x=0,float:S=!1,hidden:C=!1,noArrow:w=!1,clickable:T=!1,closeOnEsc:E=!1,closeOnScroll:D=!1,closeOnResize:O=!1,openEvents:k,closeEvents:A,globalCloseEvents:j,imperativeModeOnly:te,style:M,position:N,afterShow:P,afterHide:F,disableTooltip:I,content:L,contentWrapperRef:R,isOpen:z,defaultIsOpen:ne=!1,setIsOpen:re,previousActiveAnchor:ie,activeAnchor:B,setActiveAnchor:ae,border:oe,opacity:se,arrowColor:ce,arrowSize:le=8,role:ue=`tooltip`})=>{let de=o(null),fe=o(null),pe=o(null),me=o(null),he=o(null),[ge,_e]=h({tooltipStyles:{},tooltipArrowStyles:{},place:u}),[ve,ye]=h(!1),[be,V]=h(!1),[H,U]=h(null),xe=o(!1),Se=o(null),{anchorRefs:Ce,setActiveAnchor:we}=av(n),Te=o(!1),[Ee,De]=h([]),Oe=o(!1),ke=g||f.includes(`click`),Ae=ke||k?.click||k?.dblclick||k?.mousedown,je=k?{...k}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!k&&ke&&Object.assign(je,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});let Me=A?{...A}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!A&&ke&&Object.assign(Me,{mouseleave:!1,blur:!1,mouseout:!1});let Ne=j?{...j}:{escape:E||!1,scroll:D||!1,resize:O||!1,clickOutsideAnchor:Ae||!1};te&&(Object.assign(je,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(Me,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(Ne,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),ev((()=>(Oe.current=!0,()=>{Oe.current=!1})),[]);let Pe=e=>{Oe.current&&(e&&V(!0),setTimeout((()=>{Oe.current&&(re?.(e),z===void 0&&ye(e))}),10))};m((()=>{if(n){if(ve){t(ie);let r=e(B),i=[...new Set([...r,n])].filter(Boolean).join(` `);B?.setAttribute(`aria-describedby`,i)}else t(B);return()=>{t(B),t(ie)}}function e(e){return(e?.getAttribute(`aria-describedby`))?.split(` `)||[]}function t(t){let r=e(t).filter((e=>e!==n));r.length?t?.setAttribute(`aria-describedby`,r.join(` `)):t?.removeAttribute(`aria-describedby`)}}),[B,ve,n,ie]),m((()=>{if(z===void 0)return()=>null;z&&V(!0);let e=setTimeout((()=>{ye(z)}),10);return()=>{clearTimeout(e)}}),[z]),m((()=>{if(ve!==xe.current){if(tv(he),xe.current=ve,ve)P?.();else{let e=(e=>{let t=e.match(/^([\d.]+)(ms|s)$/);if(!t)return 0;let[,n,r]=t;return Number(n)*(r===`ms`?1:1e3)})(getComputedStyle(document.body).getPropertyValue(`--rt-transition-show-delay`));he.current=setTimeout((()=>{V(!1),U(null),F?.()}),e+25)}}}),[ve]);let Fe=e=>{_e((t=>Z_(t,e)?t:e))},Ie=(e=b)=>{tv(pe),be?Pe(!0):pe.current=setTimeout((()=>{Pe(!0)}),e)},Le=(e=x)=>{tv(me),me.current=setTimeout((()=>{Te.current||Pe(!1)}),e)},Re=e=>{if(!e)return;let t=e.currentTarget??e.target;if(!t?.isConnected)return ae(null),void we({current:null});b?Ie():Pe(!0),ae(t),we({current:t}),tv(me)},ze=()=>{T?Le(x||100):x?Le():Pe(!1),tv(pe)},Be=({x:e,y:t})=>{q_({place:H?.place??u,offset:d,elementReference:{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})},tooltipReference:de.current,tooltipArrowReference:fe.current,strategy:_,middlewares:v,border:oe,arrowSize:le}).then((e=>{Fe(e)}))},Ve=e=>{if(!e)return;let t=e,n={x:t.clientX,y:t.clientY};Be(n),Se.current=n},He=e=>{if(!ve)return;let t=e.target;t.isConnected&&(de.current?.contains(t)||[document.querySelector(`[id='${c}']`),...Ee].some((e=>e?.contains(t)))||(Pe(!1),tv(pe)))},Ue=Y_(Re,50,!0),We=Y_(ze,50,!0),Ge=e=>{We.cancel(),Ue(e)},Ke=()=>{Ue.cancel(),We()},qe=p((()=>{let e=H?.position??N;e?Be(e):S?Se.current&&Be(Se.current):B!=null&&B.isConnected&&q_({place:H?.place??u,offset:d,elementReference:B,tooltipReference:de.current,tooltipArrowReference:fe.current,strategy:_,middlewares:v,border:oe,arrowSize:le}).then((e=>{Oe.current&&Fe(e)}))}),[ve,B,L,M,u,H?.place,d,_,N,H?.position,S,le]);m((()=>{var e,t;let n=new Set(Ce);Ee.forEach((e=>{I!=null&&I(e)||n.add({current:e})}));let r=document.querySelector(`[id='${c}']`);r&&!(I!=null&&I(r))&&n.add({current:r});let i=()=>{Pe(!1)},a=$_(B),o=$_(de.current);Ne.scroll&&(window.addEventListener(`scroll`,i),a?.addEventListener(`scroll`,i),o?.addEventListener(`scroll`,i));let s=null;Ne.resize?window.addEventListener(`resize`,i):B&&de.current&&(s=ee(B,de.current,qe,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));let l=e=>{e.key===`Escape`&&Pe(!1)};Ne.escape&&window.addEventListener(`keydown`,l),Ne.clickOutsideAnchor&&window.addEventListener(`click`,He);let u=[],d=e=>!!(e?.target&&B?.contains(e.target)),f=e=>{ve&&d(e)||Re(e)},p=e=>{ve&&d(e)&&ze()},m=[`mouseover`,`mouseout`,`mouseenter`,`mouseleave`,`focus`,`blur`],h=[`click`,`dblclick`,`mousedown`,`mouseup`];Object.entries(je).forEach((([e,t])=>{t&&(m.includes(e)?u.push({event:e,listener:Ge}):h.includes(e)&&u.push({event:e,listener:f}))})),Object.entries(Me).forEach((([e,t])=>{t&&(m.includes(e)?u.push({event:e,listener:Ke}):h.includes(e)&&u.push({event:e,listener:p}))})),S&&u.push({event:`pointermove`,listener:Ve});let g=()=>{Te.current=!0},_=()=>{Te.current=!1,ze()},v=T&&(Me.mouseout||Me.mouseleave);return v&&((e=de.current)==null||e.addEventListener(`mouseover`,g),(t=de.current)==null||t.addEventListener(`mouseout`,_)),u.forEach((({event:e,listener:t})=>{n.forEach((n=>{var r;(r=n.current)==null||r.addEventListener(e,t)}))})),()=>{var e,t;Ne.scroll&&(window.removeEventListener(`scroll`,i),a?.removeEventListener(`scroll`,i),o?.removeEventListener(`scroll`,i)),Ne.resize?window.removeEventListener(`resize`,i):s?.(),Ne.clickOutsideAnchor&&window.removeEventListener(`click`,He),Ne.escape&&window.removeEventListener(`keydown`,l),v&&((e=de.current)==null||e.removeEventListener(`mouseover`,g),(t=de.current)==null||t.removeEventListener(`mouseout`,_)),u.forEach((({event:e,listener:t})=>{n.forEach((n=>{var r;(r=n.current)==null||r.removeEventListener(e,t)}))}))}}),[B,qe,be,Ce,Ee,k,A,j,ke,b,x]),m((()=>{let e=H?.anchorSelect??l??``;!e&&n&&(e=`[data-tooltip-id='${n.replace(/'/g,`\\'`)}']`);let t=new MutationObserver((t=>{let r=[],i=[];t.forEach((t=>{if(t.type===`attributes`&&t.attributeName===`data-tooltip-id`&&(t.target.getAttribute(`data-tooltip-id`)===n?r.push(t.target):t.oldValue===n&&i.push(t.target)),t.type===`childList`){if(B){let n=[...t.removedNodes].filter((e=>e.nodeType===1));if(e)try{i.push(...n.filter((t=>t.matches(e)))),i.push(...n.flatMap((t=>[...t.querySelectorAll(e)])))}catch{}n.some((e=>!!(e?.contains)?.call(e,B)&&(V(!1),Pe(!1),ae(null),tv(pe),tv(me),!0)))}if(e)try{let n=[...t.addedNodes].filter((e=>e.nodeType===1));r.push(...n.filter((t=>t.matches(e)))),r.push(...n.flatMap((t=>[...t.querySelectorAll(e)])))}catch{}}})),(r.length||i.length)&&De((e=>[...e.filter((e=>!i.includes(e))),...r]))}));return t.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-tooltip-id`],attributeOldValue:!0}),()=>{t.disconnect()}}),[n,l,H?.anchorSelect,B]),m((()=>{qe()}),[qe]),m((()=>{if(!R?.current)return()=>null;let e=new ResizeObserver((()=>{setTimeout((()=>qe()))}));return e.observe(R.current),()=>{e.disconnect()}}),[L,R?.current]),m((()=>{let e=document.querySelector(`[id='${c}']`),t=[...Ee,e];B&&t.includes(B)||ae(Ee[0]??e)}),[c,Ee,B]),m((()=>(ne&&Pe(!0),()=>{tv(pe),tv(me)})),[]),m((()=>{let e=H?.anchorSelect??l;if(!e&&n&&(e=`[data-tooltip-id='${n.replace(/'/g,`\\'`)}']`),e)try{let t=Array.from(document.querySelectorAll(e));De(t)}catch{De([])}}),[n,l,H?.anchorSelect]),m((()=>{pe.current&&(tv(pe),Ie(b))}),[b]);let Je=H?.content??L,Ye=ve&&Object.keys(ge.tooltipStyles).length>0;return a(e,(()=>({open:e=>{if(e?.anchorSelect)try{document.querySelector(e.anchorSelect)}catch{console.warn(`[react-tooltip] "${e.anchorSelect}" is not a valid CSS selector`);return}U(e??null),e?.delay?Ie(e.delay):Pe(!0)},close:e=>{e?.delay?Le(e.delay):Pe(!1)},activeAnchor:B,place:ge.place,isOpen:!!(be&&!C&&Je&&Ye)}))),be&&!C&&Je?t.createElement(y,{id:n,role:ue,className:(0,H_.default)(`react-tooltip`,ov.tooltip,sv.tooltip,sv[s],r,`react-tooltip__place-${ge.place}`,ov[Ye?`show`:`closing`],Ye?`react-tooltip__show`:`react-tooltip__closing`,_===`fixed`&&ov.fixed,T&&ov.clickable),onTransitionEnd:e=>{tv(he),ve||e.propertyName!==`opacity`||(V(!1),U(null),F?.())},style:{...M,...ge.tooltipStyles,opacity:se!==void 0&&Ye?se:void 0},ref:de},t.createElement(y,{className:(0,H_.default)(`react-tooltip-content-wrapper`,ov.content,sv.content)},Je),t.createElement(y,{className:(0,H_.default)(`react-tooltip-arrow`,ov.arrow,sv.arrow,i,w&&ov.noArrow),style:{...ge.tooltipArrowStyles,background:ce?`linear-gradient(to right bottom, transparent 50%, ${ce} 50%)`:void 0,"--rt-arrow-size":`${le}px`},ref:fe})):null},lv=({content:e})=>t.createElement(`span`,{dangerouslySetInnerHTML:{__html:e}}),uv=t.forwardRef((({id:e,anchorId:n,anchorSelect:r,content:i,html:a,render:s,className:c,classNameArrow:l,variant:u=`dark`,place:d=`top`,offset:f=10,wrapper:p=`div`,children:g=null,events:_=[`hover`],openOnClick:v=!1,positionStrategy:y=`absolute`,middlewares:b,delayShow:x=0,delayHide:S=0,float:C=!1,hidden:w=!1,noArrow:T=!1,clickable:E=!1,closeOnEsc:D=!1,closeOnScroll:O=!1,closeOnResize:k=!1,openEvents:A,closeEvents:j,globalCloseEvents:ee,imperativeModeOnly:te=!1,style:M,position:N,isOpen:P,defaultIsOpen:F=!1,disableStyleInjection:I=!1,border:L,opacity:R,arrowColor:z,arrowSize:ne,setIsOpen:re,afterShow:ie,afterHide:B,disableTooltip:ae,role:oe=`tooltip`},se)=>{let[ce,le]=h(i),[ue,de]=h(a),[fe,pe]=h(d),[me,he]=h(u),[ge,_e]=h(f),[ve,ye]=h(x),[be,V]=h(S),[H,U]=h(C),[xe,Se]=h(w),[Ce,we]=h(p),[Te,Ee]=h(_),[De,Oe]=h(y),[ke,Ae]=h(null),[je,Me]=h(null),Ne=o(null),Pe=o(I),{anchorRefs:Fe,activeAnchor:Ie}=av(e),Le=e=>e?.getAttributeNames().reduce(((t,n)=>(n.startsWith(`data-tooltip-`)&&(t[n.replace(/^data-tooltip-/,``)]=e?.getAttribute(n)??null),t)),{}),Re=e=>{let t={place:e=>{pe(e??d)},content:e=>{le(e??i)},html:e=>{de(e??a)},variant:e=>{he(e??u)},offset:e=>{_e(e===null?f:Number(e))},wrapper:e=>{we(e??p)},events:e=>{let t=e?.split(` `);Ee(t??_)},"position-strategy":e=>{Oe(e??y)},"delay-show":e=>{ye(e===null?x:Number(e))},"delay-hide":e=>{V(e===null?S:Number(e))},float:e=>{U(e===null?C:e===`true`)},hidden:e=>{Se(e===null?w:e===`true`)},"class-name":e=>{Ae(e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,n])=>{var r;(r=t[e])==null||r.call(t,n)}))};m((()=>{le(i)}),[i]),m((()=>{de(a)}),[a]),m((()=>{pe(d)}),[d]),m((()=>{he(u)}),[u]),m((()=>{_e(f)}),[f]),m((()=>{ye(x)}),[x]),m((()=>{V(S)}),[S]),m((()=>{U(C)}),[C]),m((()=>{Se(w)}),[w]),m((()=>{Oe(y)}),[y]),m((()=>{Pe.current!==I&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[I]),m((()=>{typeof window<`u`&&window.dispatchEvent(new CustomEvent(`react-tooltip-inject-styles`,{detail:{disableCore:I===`core`,disableBase:I}}))}),[]),m((()=>{let t=new Set(Fe),i=r;if(!i&&e&&(i=`[data-tooltip-id='${e.replace(/'/g,`\\'`)}']`),i)try{document.querySelectorAll(i).forEach((e=>{t.add({current:e})}))}catch{console.warn(`[react-tooltip] "${i}" is not a valid CSS selector`)}let a=document.querySelector(`[id='${n}']`);if(a&&t.add({current:a}),!t.size)return()=>null;let o=je??a??Ie.current,s=new MutationObserver((e=>{e.forEach((e=>{if(!o||e.type!==`attributes`||!e.attributeName?.startsWith(`data-tooltip-`))return;let t=Le(o);Re(t)}))})),c={attributes:!0,childList:!1,subtree:!1};if(o){let e=Le(o);Re(e),s.observe(o,c)}return()=>{s.disconnect()}}),[Fe,Ie,je,n,r]),m((()=>{M!=null&&M.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),L&&!J_(`border`,`${L}`)&&console.warn(`[react-tooltip] "${L}" is not a valid \`border\`.`),M!=null&&M.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),R&&!J_(`opacity`,`${R}`)&&console.warn(`[react-tooltip] "${R}" is not a valid \`opacity\`.`)}),[]);let ze=g,Be=o(null);if(s){let e=s({content:je?.getAttribute(`data-tooltip-content`)||ce||null,activeAnchor:je});ze=e?t.createElement(`div`,{ref:Be,className:`react-tooltip-content-wrapper`},e):null}else ce&&(ze=ce);ue&&(ze=t.createElement(lv,{content:ue}));let Ve={forwardRef:se,id:e,anchorId:n,anchorSelect:r,className:(0,H_.default)(c,ke),classNameArrow:l,content:ze,contentWrapperRef:Be,place:fe,variant:me,offset:ge,wrapper:Ce,events:Te,openOnClick:v,positionStrategy:De,middlewares:b,delayShow:ve,delayHide:be,float:H,hidden:xe,noArrow:T,clickable:E,closeOnEsc:D,closeOnScroll:O,closeOnResize:k,openEvents:A,closeEvents:j,globalCloseEvents:ee,imperativeModeOnly:te,style:M,position:N,isOpen:P,defaultIsOpen:F,border:L,opacity:R,arrowColor:z,arrowSize:ne,setIsOpen:re,afterShow:ie,afterHide:B,disableTooltip:ae,activeAnchor:je,previousActiveAnchor:Ne.current,setActiveAnchor:e=>{Me((t=>(e!=null&&e.isSameNode(t)||(Ne.current=t),e)))},role:oe};return t.createElement(cv,{...Ve})}));typeof window<`u`&&window.addEventListener(`react-tooltip-inject-styles`,(e=>{e.detail.disableCore||K_({css:`:root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s;--rt-arrow-size:8px}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit;z-index:-1;-webkit-backface-visibility:hidden;backface-visibility:hidden}.core-styles-module_content__BRKdB{position:relative;z-index:1}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}`,type:`core`}),e.detail.disableBase||K_({css:`
4
+ .styles-module_tooltip__mnnfp{border-radius:3px;font-size:90%;width:max-content}.styles-module_content__ydYdI{background:inherit;border-radius:inherit;padding:8px 16px}.styles-module_arrow__K0L3T{width:var(--rt-arrow-size);height:var(--rt-arrow-size)}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:`base`})})),r();var dv={indexes:[],chapters:[],thumbnails:[],requestThumbnail:()=>{},subtitleTracks:[],selectedSubtitleTrack:void 0,selectSubtitleTrack:()=>{},audioTracks:[],selectedAudioTrack:void 0,selectAudioTrack:()=>{},hideUI:!1,setHideUI:()=>{},hasMedia:!1,togglePictureInPicture:null,pictureInPictureMode:null,burnedInSubtitles:!1,playbackError:null,playbackErrors:[],ready:!1,setSourceState:()=>{}},fv=Gl({name:`source`,state:()=>({...dv}),attach({set:e}){e({setSourceState:t=>e(t),setHideUI:t=>e({hideUI:t})})}}),pv=Uf({features:[...qd,fv],displayName:`MediaPlayer`}),Q=pv.usePlayer,mv=e=>{if(e&&e!==`und`)try{return new Intl.DisplayNames([navigator.language||`en`],{type:`language`,fallback:`none`}).of(e)||void 0}catch{return}},hv=e=>e?.replace(/_/g,` `).trim()||void 0,gv=e=>{let t=e.map(e=>mv(e.language)??hv(e.title)??`Track ${e.streamIndex}`),n=t.reduce((e,t)=>({...e,[t]:(e[t]??0)+1}),{});return e.map((e,r)=>{let i=t[r],a=hv(e.title);return{track:e,label:(n[i]??0)>1&&a&&a!==i?`${i} (${a})`:i}})},_v=e=>gv(e).map(({track:e,label:t})=>({id:e.streamIndex,label:t})),vv=[0,250,1e3,3e3,1e4],yv=6e4,bv=500,xv=15e3,Sv=e=>e instanceof Error?e.message:String(e),Cv=e=>{let t=[],n=e?.cause;for(let e=0;n!=null&&e<8;e++){if(typeof MediaError<`u`&&n instanceof MediaError){t.push(`MediaError code ${n.code}${n.message?`: ${n.message}`:``}`);break}t.push(Sv(n)),n=n?.cause}return t.length?t.join(`
5
+ `):void 0},wv=(e,t,n)=>{let r=Q(),{read:i,size:a,publicPath:s=``,libavWorkerUrl:c=``,jassubWorkerUrl:l=``,jassubWasmUrl:u=``,jassubLegacyWasmUrl:d,defaultFontUrl:f,bufferSize:g,autoplay:_=!1,chapters:v,seekPrepareBudgetMs:y=bv}=n??{},b=o(v);b.current=v;let[x,S]=h(void 0),[C,w]=h(0),T=o({count:0,at:0}),E=o(void 0);m(()=>(T.current={count:0,at:0},r.setSourceState({playbackErrors:[]}),()=>{E.current&&clearTimeout(E.current)}),[a]);let D=o(null),O=o(null),k=o(!1),A=o(i);A.current=i;let j=o(n?.onSeek);j.current=n?.onSeek;let ee=o(n?.onPlaybackError);ee.current=n?.onPlaybackError;let te=p(e=>{let t=typeof e==`number`?e:void 0;k.current=!0,r.setSourceState({selectedSubtitleTrack:t}),D.current?.selectSubtitleStream(t)},[r]),M=p(e=>{let t=D.current;if(!t||y<=0){r.seek(e);return}let n=typeof window<`u`&&window.__mediaPlayerSeekDebug,i=performance.now(),a=!1,o=`prepared`,s=()=>{if(!a&&(a=!0,r.seek(e),n)){let n=t.videoElement,r=0;if(n)for(let t=0;t<n.buffered.length;t++)n.buffered.start(t)<=e+1&&e<n.buffered.end(t)&&(r=n.buffered.end(t)-e);console.warn(`[media-player] seek to ${e.toFixed(2)} moved after ${Math.round(performance.now()-i)}ms via ${o}, runway ${r.toFixed(1)}s${o===`deadline`?` (EXPOSED: moved before its data was ready)`:``}`)}};r.setSourceState({seekingTo:e});let c=t.videoElement,l=()=>{c?.removeEventListener(`seeked`,l),clearTimeout(u),r.setSourceState({seekingTo:void 0})},u=setTimeout(l,xv);c?.addEventListener(`seeked`,l);let d=setTimeout(()=>{o=`deadline`,s()},y);t.prepareSeek(e).catch(()=>{}).finally(()=>{clearTimeout(d),s()})},[r,y]),N=p(e=>{typeof e==`number`&&(r.setSourceState({selectedAudioTrack:e}),S(e))},[r]),P=Q(e=>e.setSourceState);m(()=>{P({selectSubtitleTrack:te,selectAudioTrack:N,requestSeek:M})},[P,te,N,M]),m(()=>{if(!e||!t||!a||!i)return;let n=!1;r.setSourceState({playbackError:null,ready:!1});let o=(t,n)=>{let i=Date.now(),a=Sv(t),o=Cv(t),s=r.playbackErrors,c=s[s.length-1];if(c&&c.message===a&&c.detail===o&&c.recovered===n){let e={...c,count:c.count+1,lastAt:i};r.setSourceState({playbackErrors:[...s.slice(0,-1),e]});return}let l={at:i,lastAt:i,count:1,atMediaTime:Number.isFinite(e.currentTime)?e.currentTime:void 0,message:a,detail:o,recovered:n};r.setSourceState({playbackErrors:[...s,l]})},p=e=>{if(n)return;let t=ys(e);if(o(e,t),t){let t=performance.now();t-T.current.at>yv&&(T.current={count:0,at:t});let n=vv[Math.min(T.current.count,vv.length-1)];T.current={count:T.current.count+1,at:t},console.warn(`the media element failed; rebuilding the pipeline${n?` in ${n}ms`:``}`,e),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>w(e=>e+1),n);return}console.error(`playback failed`,e),r.setSourceState({playbackError:e}),ee.current?.(e)};return(async()=>{try{let i=await Ps({videoElement:e,subtitleContainer:t,read:(e,t)=>A.current(e,t),length:a,publicPath:s,libavWorkerUrl:c,jassubWorkerUrl:l,jassubWasmUrl:u,jassubLegacyWasmUrl:d,defaultFontUrl:f,bufferSize:g,audioStreamIndex:x,onReady:()=>{if(n)return;r.setSourceState({ready:!0});let t=O.current;O.current=null,t&&t.size===a&&t.time>0&&(e.currentTime=t.time),_&&e.play().catch(()=>{})},onError:p,onRecovered:()=>{n||r.setSourceState({playbackError:null})},onSeek:e=>j.current?.(e),onSubtitleStreams:e=>{n||r.setSourceState({subtitleTracks:_v(e),...k.current?{}:{selectedSubtitleTrack:e[0]?.streamIndex}})},onAudioStreams:(e,t)=>{n||r.setSourceState({audioTracks:_v(e),selectedAudioTrack:t})}});if(n){i.destroy();return}D.current=i,r.setSourceState({indexes:i.indexes,chapters:b.current??i.chapters});let o=r.selectedSubtitleTrack;typeof o==`number`&&i.selectSubtitleStream(o)}catch(e){p(e)}})(),()=>{n=!0,O.current={time:e.currentTime,size:a},D.current?.destroy(),D.current=null,r.setSourceState({ready:!1})}},[r,e,t,a,s,c,l,u,d,f,g,x,_,C])},Tv=5e3,Ev=6e4,Dv=({publicPath:e,workerUrl:t,length:n,read:r,downloadedRanges:i})=>{let[a,s]=h([]),c=o(null),l=o(r);l.current=r;let u=b(()=>i?.map(({startByteOffset:e,endByteOffset:t})=>[e,t]),[i?.map(({startByteOffset:e,endByteOffset:t})=>`${e}-${t}`).join(`,`)]),d=o(u);return d.current=u,m(()=>{if(!n||!r||!e||!t)return;let i=!1,a=null,o,u=Tv,f=()=>{Ws({publicPath:e,workerUrl:t,length:n,read:(e,t)=>l.current(e,t),onThumbnails:e=>{i||s(e)}}).then(e=>{if(i){e.destroy();return}a=e,c.current=e,e.update(d.current)},()=>{i||(o=setTimeout(f,u),u=Math.min(u*2,Ev))})};return f(),()=>{i=!0,clearTimeout(o),c.current=null,a?.destroy(),s([])}},[n,e,t]),m(()=>{c.current?.update(u)},[u]),{thumbnails:a,requestThumbnail:p(e=>{c.current?.prioritize(e)},[])}},Ov=(e,t)=>{let n=o(null),[r,i]=h(!1),[a]=h(()=>Qs());m(()=>{if(!e||!t||!a)return;let r=$s({video:e,subtitles:t,mode:a,onBurnedInChange:i});return n.current=r,()=>{r.destroy(),n.current=null,i(!1)}},[e,t,a]);let s=p(()=>{n.current?.toggle().catch(e=>{console.warn(`picture in picture was refused`,e)})},[]);return{toggle:e&&t&&a?s:null,mode:a,burnedIn:r}},kv={headings:{large:`
6
+ font-weight: 600;
7
+ font-size: calc(2.8 * var(--mp-unit));
8
+ line-height: calc(3.4 * var(--mp-unit));
9
+ @media (min-width: 960px) {
10
+ font-size: calc(3.4 * var(--mp-unit));
11
+ line-height: calc(4.1 * var(--mp-unit));
12
+ }
13
+ `,medium:`
14
+ font-weight: 600;
15
+ font-size: calc(2.4 * var(--mp-unit));
16
+ line-height: calc(2.9 * var(--mp-unit));
17
+ @media (min-width: 960px) {
18
+ font-size: calc(2.8 * var(--mp-unit));
19
+ line-height: calc(3.4 * var(--mp-unit));
20
+ }
21
+ `,small:`
22
+ font-weight: 500;
23
+ font-size: calc(1.8 * var(--mp-unit));
24
+ line-height: calc(1.9 * var(--mp-unit));
25
+ @media (min-width: 960px) {
26
+ font-size: calc(1.8 * var(--mp-unit));
27
+ line-height: calc(2.2 * var(--mp-unit));
28
+ }
29
+ @media (min-width: 2560px) {
30
+ font-size: calc(2.2 * var(--mp-unit));
31
+ line-height: calc(2.6 * var(--mp-unit));
32
+ }
33
+ `,extraSmall:`
34
+ font-weight: 500;
35
+ font-size: calc(1.4 * var(--mp-unit));
36
+ line-height: calc(1.7 * var(--mp-unit));
37
+ @media (min-width: 960px) {
38
+ font-size: calc(1.6 * var(--mp-unit));
39
+ line-height: calc(1.9 * var(--mp-unit));
40
+ }
41
+ `},bLarge:{bold:`
42
+ font-weight: 600;
43
+ font-size: calc(1.4 * var(--mp-unit));
44
+ line-height: calc(2 * var(--mp-unit));
45
+ @media (min-width: 960px) {
46
+ font-size: calc(1.6 * var(--mp-unit));
47
+ line-height: calc(2.2 * var(--mp-unit));
48
+ }
49
+ `,medium:`
50
+ font-weight: 500;
51
+ font-size: calc(1.4 * var(--mp-unit));
52
+ line-height: calc(2 * var(--mp-unit));
53
+ @media (min-width: 960px) {
54
+ font-size: calc(1.6 * var(--mp-unit));
55
+ line-height: calc(2.2 * var(--mp-unit));
56
+ }
57
+ `,regular:`
58
+ font-weight: 400;
59
+ font-size: calc(1.4 * var(--mp-unit));
60
+ line-height: calc(2 * var(--mp-unit));
61
+ @media (min-width: 960px) {
62
+ font-size: calc(1.6 * var(--mp-unit));
63
+ line-height: calc(2.2 * var(--mp-unit));
64
+ }
65
+ `},bMedium:{bold:`
66
+ font-weight: 600;
67
+ font-size: calc(1.2 * var(--mp-unit));
68
+ line-height: calc(1.7 * var(--mp-unit));
69
+ @media (min-width: 960px) {
70
+ font-size: calc(1.4 * var(--mp-unit));
71
+ line-height: calc(2 * var(--mp-unit));
72
+ }
73
+ `,medium:`
74
+ font-weight: 500;
75
+ font-size: calc(1.2 * var(--mp-unit));
76
+ line-height: calc(1.7 * var(--mp-unit));
77
+ @media (min-width: 960px) {
78
+ font-size: calc(1.4 * var(--mp-unit));
79
+ line-height: calc(2 * var(--mp-unit));
80
+ }
81
+ `,regular:`
82
+ font-weight: 400;
83
+ font-size: calc(1.2 * var(--mp-unit));
84
+ line-height: calc(1.7 * var(--mp-unit));
85
+ @media (min-width: 960px) {
86
+ font-size: calc(1.4 * var(--mp-unit));
87
+ line-height: calc(2 * var(--mp-unit));
88
+ }
89
+ `},bSmall:{bold:`
90
+ font-weight: 600;
91
+ font-size: calc(1 * var(--mp-unit));
92
+ line-height: calc(1.4 * var(--mp-unit));
93
+ @media (min-width: 960px) {
94
+ font-size: calc(1.2 * var(--mp-unit));
95
+ line-height: calc(1.7 * var(--mp-unit));
96
+ }
97
+ `,medium:`
98
+ font-weight: 500;
99
+ font-size: calc(1 * var(--mp-unit));
100
+ line-height: calc(1.4 * var(--mp-unit));
101
+ @media (min-width: 960px) {
102
+ font-size: calc(1.2 * var(--mp-unit));
103
+ line-height: calc(1.7 * var(--mp-unit));
104
+ }
105
+ `,regular:`
106
+ font-weight: 400;
107
+ font-size: calc(1 * var(--mp-unit));
108
+ line-height: calc(1.4 * var(--mp-unit));
109
+ @media (min-width: 960px) {
110
+ font-size: calc(1.2 * var(--mp-unit));
111
+ line-height: calc(1.7 * var(--mp-unit));
112
+ }
113
+ `},bExtraSmall:{bold:`
114
+ font-weight: 600;
115
+ font-size: calc(0.8 * var(--mp-unit));
116
+ line-height: calc(1.1 * var(--mp-unit));
117
+ @media (min-width: 960px) {
118
+ font-size: calc(1 * var(--mp-unit));
119
+ line-height: calc(1.4 * var(--mp-unit));
120
+ }
121
+ `,medium:`
122
+ font-weight: 500;
123
+ font-size: calc(0.8 * var(--mp-unit));
124
+ line-height: calc(1.1 * var(--mp-unit));
125
+ @media (min-width: 960px) {
126
+ font-size: calc(1 * var(--mp-unit));
127
+ line-height: calc(1.4 * var(--mp-unit));
128
+ }
129
+ `,regular:`
130
+ font-weight: 400;
131
+ font-size: calc(0.8 * var(--mp-unit));
132
+ line-height: calc(1.1 * var(--mp-unit));
133
+ @media (min-width: 960px) {
134
+ font-size: calc(1 * var(--mp-unit));
135
+ line-height: calc(1.4 * var(--mp-unit));
136
+ }
137
+ `}},Av=D`
138
+ display: flex;
139
+ justify-content: center;
140
+ align-items: center;
141
+
142
+ canvas {
143
+ top: unset !important;
144
+ left: unset !important;
145
+ width: 100%;
146
+ height: 100%;
147
+ margin: auto;
148
+ pointer-events: none;
149
+ }
150
+ `,jv=D`
151
+ position: absolute;
152
+ top: 0;
153
+ left: 0;
154
+ width: 100%;
155
+ padding: calc(1.2 * var(--mp-unit)) calc(1.6 * var(--mp-unit));
156
+ /* clears a notch once the player is fullscreen; resolves to zero everywhere else */
157
+ padding-top: calc(calc(1.2 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
158
+ ${kv.headings.small}
159
+ color: white;
160
+ text-shadow: 0 0 4px rgba(0, 0, 0, 1);
161
+ z-index: 2;
162
+ pointer-events: none;
163
+
164
+ /* one line with an ellipsis until there is width to wrap, since a release filename would
165
+ otherwise run to four lines on a phone */
166
+ white-space: nowrap;
167
+ overflow: hidden;
168
+ text-overflow: ellipsis;
169
+
170
+ @media (min-width: 768px) {
171
+ padding: calc(2.4 * var(--mp-unit));
172
+ padding-top: calc(calc(2.4 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
173
+ white-space: normal;
174
+ overflow: visible;
175
+ }
176
+
177
+ background: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.3) 30%, rgba(0,0,0,0.2) 60%, rgba(0,0,0,0.1) 80%, transparent 100%);
178
+ transition: opacity 0.1s cubic-bezier(.4,0,1,1);
179
+ `,Mv=D`
180
+ position: absolute;
181
+ inset: 0;
182
+ z-index: 2;
183
+ display: flex;
184
+ justify-content: center;
185
+ align-items: center;
186
+ pointer-events: none;
187
+
188
+ ::after {
189
+ content: '';
190
+ width: calc(4 * var(--mp-unit));
191
+ height: calc(4 * var(--mp-unit));
192
+ border-radius: 50%;
193
+ border: 3px solid rgba(255, 255, 255, 0.25);
194
+ border-top-color: #fff;
195
+ animation: ${s`
196
+ to { transform: rotate(360deg); }
197
+ `} 0.8s linear infinite;
198
+ }
199
+ `,Nv=D`
200
+ position: absolute;
201
+ inset: auto 0 20%;
202
+ z-index: 3;
203
+ padding: 0 calc(2 * var(--mp-unit));
204
+ text-align: center;
205
+ color: #fff;
206
+ ${kv.bLarge.regular}
207
+ text-shadow: 0 0 4px rgba(0, 0, 0, 1);
208
+ pointer-events: none;
209
+ `,Pv=e=>e instanceof Error?e.message:typeof e==`string`?e:`Playback failed`,Fv=({onSubtitleRef:e})=>{let t=Q(e=>e.title),n=Q(e=>e.hideUI),r=Q(e=>e.playbackError),i=Q(e=>e.ready),a=Q(e=>e.size),o=Q(e=>e.waiting),s=Q(e=>e.seekingTo);return y(O,{children:[t?P(`div`,{className:`title`,css:jv,style:{...n?{opacity:`0`,pointerEvents:`none`}:{}},children:t}):void 0,((a?!i:o)||s!==void 0)&&!r?P(`div`,{css:Mv}):void 0,r?P(`div`,{css:Nv,children:Pv(r)}):void 0,P(`div`,{className:`subtitles`,ref:e,css:Av})]})},Iv=1e-4,Lv=1,Rv=e=>Math.max(Iv,Math.min(Lv,e))**2,zv=e=>Math.max(Iv,Math.min(Lv,e))**(Lv/2),Bv=e=>{if(e===void 0)return`0:00`;let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);return t>0?`${t}:${n<10?`0`:``}${n}:${r<10?`0`:``}${r}`:`${n}:${r<10?`0`:``}${r}`},Vv=(e,t)=>`${Bv(e)} / ${Bv(t)}`,Hv=e=>D`
210
+ display: flex;
211
+ justify-content: flex-start;
212
+
213
+ /*
214
+ * Bounded here rather than at each call site.
215
+ *
216
+ * react-tooltip's own chip rule carries width: max-content, so with nothing opposing it a chip
217
+ * grows to the widest UNWRAPPED line of its content: a two sentence tooltip measured 1178px
218
+ * through this component. Both declarations are load bearing, since a bound with no wrapping only
219
+ * moves the overflow inside a narrow box. 26 units is the width control-bar.tsx was already
220
+ * imposing on its own two line tooltip by hand, so nothing in the bar changes shape.
221
+ */
222
+ max-width: min(calc(26 * var(--mp-unit)), calc(100vw - calc(2.4 * var(--mp-unit))));
223
+ white-space: normal;
224
+ overflow-wrap: anywhere;
225
+ text-align: left;
226
+
227
+ /*
228
+ * The radius carries !important for the same reason the paddings below do.
229
+ *
230
+ * react-tooltip injects its stylesheet from a passive effect while emotion inserts through
231
+ * useInsertionEffect, which runs earlier, so react-tooltip's sheet lands in the head LAST at
232
+ * exactly this specificity and wins every tie. Its own radius is 3px, which is what was drawn
233
+ * here until this was stated.
234
+ */
235
+ border-radius: calc(0.4 * var(--mp-unit))!important;
236
+ user-select: none;
237
+
238
+ z-index: 3;
239
+
240
+ * {
241
+ ${kv.bMedium.regular}
242
+ }
243
+
244
+ ${e===`sm`&&D`
245
+ padding: calc(0.4 * var(--mp-unit))!important;
246
+ `}
247
+ ${e===`md`&&D`
248
+ padding: calc(0.6 * var(--mp-unit))!important;
249
+ `}
250
+ ${e===`lg`&&D`
251
+ padding: calc(1.2 * var(--mp-unit))!important;
252
+ `}
253
+ `,Uv={x:-1,y:-1,anchors:0},Wv=e=>{Uv.x=e.clientX,Uv.y=e.clientY},Gv=()=>(Uv.anchors++===0&&window.addEventListener(`pointermove`,Wv,{capture:!0,passive:!0}),()=>{--Uv.anchors===0&&window.removeEventListener(`pointermove`,Wv,{capture:!0})}),Kv=({id:e,toolTipText:t,text:n,delayShow:r=0,closeDelay:i=0,offset:a=20,tooltipPlace:s=`top`,disabled:c=!1,size:l=`md`})=>{let u=o(null),d=o(null);return m(()=>{let e=Gv(),t=()=>{let e=u.current;if(!e)return;let{left:t,right:n,top:r,bottom:i}=e.getBoundingClientRect();Uv.x>=t&&Uv.x<n&&Uv.y>=r&&Uv.y<i||d.current?.close()},n=[`fullscreenchange`,`webkitfullscreenchange`];for(let e of n)document.addEventListener(e,t);return()=>{e();for(let e of n)document.removeEventListener(e,t)}},[]),y(O,{children:[P(`div`,{ref:u,"data-tooltip-id":e,"data-open":!0,"data-tooltip-offset":a,"data-tooltip-delay-show":r,"data-tooltip-delay-hide":i,"data-tooltip-place":s,children:n}),!c&&P(uv,{ref:d,css:Hv(l),id:e,noArrow:!0,children:t})]})},qv=({ref:e,onChange:t,orientation:n=`horizontal`,disabled:r=!1})=>{let[i,a]=h(!1),s=o(t);s.current=t;let c=o(null),l=p((t,r)=>{let i=e.current;if(!i)return 0;let{left:a,right:o,top:s,bottom:c}=i.getBoundingClientRect(),l=n===`horizontal`?(t-a)/(o-a):(c-r)/(c-s);return Math.min(Math.max(l,0),1)},[e,n]),u=p(e=>{if(!(r||e.button>0)){c.current=e.pointerId;try{e.currentTarget.setPointerCapture?.(e.pointerId)}catch{}a(!0),s.current(l(e.clientX,e.clientY))}},[r,l]),d=p(e=>{c.current===e.pointerId&&s.current(l(e.clientX,e.clientY))},[l]),f=p(e=>{if(c.current===e.pointerId){c.current=null;try{e.currentTarget.releasePointerCapture?.(e.pointerId)}catch{}a(!1)}},[]);return m(()=>{r&&(c.current=null,a(!1))},[r]),{dragging:i,handlers:{onPointerDown:u,onPointerMove:d,onPointerUp:f,onPointerCancel:f,style:{touchAction:`none`}}}},Jv=2,Yv=.005,Xv=`#000`,Zv=`#0000`,Qv=(e,t)=>{if(!t)return[];let n=new Set;for(let{start:r,end:i}of e)for(let e of[r,i]){let r=e/t;r<=Yv||r>=1-Yv||n.add(Number((r*100).toFixed(4)))}return n.size?[0,...[...n].sort((e,t)=>e-t),100]:[]},$v=(e,t)=>{let n=Jv/2,r=e.length-2,i=[];for(let a=0;a<=r;a+=1){let o=e[a],s=e[a+1],c=a===0?`0%`:`calc(${o}% + ${n}px)`,l=a===r?`100%`:`calc(${s}% - ${n}px)`;i.push(`${t(a)?Xv:Zv} ${c} ${l}`),a!==r&&i.push(`${Zv} calc(${s}% - ${n}px) calc(${s}% + ${n}px)`)}return`linear-gradient(90deg, ${i.join(`, `)})`},ey=new Set([`op`,`ops`,`opening`,`openings`,`ncop`,`オープニング`,`op主題歌`]),ty=new Set([`ed`,`eds`,`ending`,`endings`,`nced`,`credits`,`endcard`,`endroll`,`エンディング`,`エンドカード`,`エンドロール`,`ed主題歌`]),ny=new Set([`intro`,`イントロ`]),ry=new Set([`outro`,`アウトロ`]),iy={"credits start":`ending`,"credits end":null,"preview end":null,"end credits":`ending`,"closing credits":`ending`},ay=new Set([`theme`,`themes`,`song`,`sequence`,`nc`,`non`,`credit`,`creditless`,`textless`,`clean`,`tv`,`size`,`version`,`ver`,`full`,`the`,`主題歌`,`ノンクレジット`]),oy=new Set([`post`,`pre`,`after`,`before`,`non`]),sy=/[-:|~/\\[\]()「」『』【】,.!?"'’]|\s+by\s+/u,cy=e=>/^chapter\s*\d+$/i.test(e.trim())||/^\d{1,2}:\d{2}:\d{2}([.,]\d+)?$/.test(e.trim()),ly=e=>e.replace(/([a-z぀-ヿ一-鿿])\s*\d+\s*$/u,`$1`).split(/[\s_]+/u).map(e=>e.replace(/^[^\w぀-ヿ一-鿿]+|[^\w぀-ヿ一-鿿]+$/gu,``)).filter(e=>e&&!/^\d+$/.test(e)&&!ay.has(e)),uy=(e,t)=>{if(ey.has(e))return`opening`;if(ty.has(e))return`ending`;if(t){if(ny.has(e))return`opening`;if(ry.has(e))return`ending`}},dy=(e,t)=>{if(cy(e))return;let n=e.trim().toLowerCase().replace(/\s+/gu,` `);if(n in iy)return iy[n]??void 0;let r=n.split(sy).map(e=>e.trim()).filter(Boolean);if(r.some(e=>e.split(/[\s_]+/u).some(e=>oy.has(e))))return;let i=r.length>1?[r[0],r.at(-1)]:r;for(let e of i){let n=ly(e);if(n.length!==1)continue;let r=uy(n[0],t);if(r)return r}},fy=15,py=87,my=93,hy=e=>{let t=e.map(()=>void 0),n=e.at(-1)?.end??0;if(!n)return t;let r=e.map((e,t)=>({index:t,start:e.start,length:e.end-e.start})).filter(({length:e})=>e>=py&&e<=my),i=n/2,a=r.filter(({start:e})=>e<i),o=r.filter(({start:e})=>e>=i);return a.length===1&&(t[a[0].index]=`opening`),o.length===1&&(t[o[0].index]=`ending`),t},gy=e=>{let t=e.map(({title:e})=>dy(e,!1)),n=e.reduce((e,n,r)=>e+(t[r]?n.end-n.start:0),0),r=e.reduce((e,t)=>e+(t.end-t.start),0);if(r>0&&n*2>r)return e.map(()=>void 0);let i=e.map((e,n)=>{if(e.end-e.start<fy)return;let r=t[n];if(r)return r;let i=dy(e.title,!0);return i&&!t.includes(i)?i:void 0});return i.some(Boolean)?i:hy(e)},_y=D`
254
+ position: relative;
255
+ height: calc(.4 * var(--mp-unit));
256
+
257
+ --thumbnail-width: calc(25 * var(--mp-unit));
258
+ --thumbnail-half: calc(12.5 * var(--mp-unit));
259
+
260
+ transition: transform .2s ease-in-out;
261
+
262
+ margin: 0 12px;
263
+ @media (min-width: 768px) {
264
+ margin: 0 16px;
265
+ }
266
+ @media (min-width: 2560px) {
267
+ margin: 0 24px;
268
+ }
269
+
270
+ user-select: none;
271
+ cursor: pointer;
272
+
273
+ :hover {
274
+ .background-bar {
275
+ transform: scaleY(1.5);
276
+ }
277
+ .loaded {
278
+ transform: scaleY(1.5);
279
+ top: calc(-.1 * var(--mp-unit));
280
+ }
281
+ .play-container {
282
+ transform: scaleY(1.5);
283
+ }
284
+ }
285
+
286
+ /*
287
+ * One copy of the track per mask, stacked.
288
+ *
289
+ * The rest track paints every segment except the one under the pointer, the focus track paints only that one and
290
+ * is the only element that grows. Both are full bar width, which is what keeps every percentage
291
+ * and every scaleX inside them meaning exactly what it meant before chapters existed: the gaps are
292
+ * cut by a mask, not by resizing anything.
293
+ *
294
+ * The mask sits HERE and never on .loaded-part or .play. Those two carry a scaleX, and a mask
295
+ * travels with its element's transform, so a gap drawn on them would slide with the fill.
296
+ */
297
+ .track {
298
+ position: absolute;
299
+ inset: 0;
300
+ /* never a hit target: .padding is the only one, and a second would break the drag gesture and
301
+ fire a bubbling mouseout at every boundary crossing */
302
+ pointer-events: none;
303
+ }
304
+
305
+ /*
306
+ * The segment under the pointer, on TOP of the growth the whole bar already got.
307
+ *
308
+ * Measured off YouTube's live player, hovering one chapter of five: every other segment goes 4px
309
+ * to 6px, and the one under the pointer goes to 10px. Both grow about the bar's centre line, so
310
+ * the emphasised segment bulges above and below its neighbours rather than sitting on them. 6 x
311
+ * 1.667 is 10, and the 1.5 the layers inside already carry gets this track from 4 to exactly that.
312
+ */
313
+ .track.focus {
314
+ transform: scaleY(1.667);
315
+ }
316
+
317
+
318
+ .background-bar {
319
+ position: absolute;
320
+ inset: 0;
321
+ background-color: hsla(0, 100%, 100%, .2);
322
+ }
323
+
324
+ .cursor-time {
325
+ display: flex;
326
+ justify-content: center;
327
+
328
+ /* The seekbar's other hover affordance, the thumbnail below, gets a rounded box and a drop
329
+ shadow. A source that ships no thumbnails, which is every source whose media the player does
330
+ not own, leaves this readout as the entire preview, so it carries the same treatment instead
331
+ of sitting as bare text on the picture. The ink comes from the player root. */
332
+ background-color: rgba(28, 28, 28, .95);
333
+ border-radius: calc(.4 * var(--mp-unit));
334
+ padding: 0 calc(.6 * var(--mp-unit));
335
+ box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
336
+
337
+ text-shadow: 0 0 4px rgba(0, 0, 0, 1);
338
+ ${kv.bMedium.bold}
339
+
340
+ gap: calc(.6 * var(--mp-unit));
341
+
342
+ /*
343
+ * The chapter under the pointer, next to the time, which is where the reference puts it.
344
+ *
345
+ * It is the one part of this pill whose width the player does not control, so it is capped and
346
+ * ellipsised rather than allowed to push the box outside the picture. The cap and the clamp that
347
+ * positions the pill are set together on the element, since a centred box can only be kept
348
+ * inside the bar if the clamp knows its half width.
349
+ */
350
+ .chapter-title {
351
+ overflow: hidden;
352
+ text-overflow: ellipsis;
353
+ min-width: 0;
354
+ font-weight: normal;
355
+ }
356
+
357
+ position: absolute;
358
+ /* Anchored on its bottom edge rather than its top: now that it has a background its height
359
+ follows the font size, and a top-anchored box would grow downward into the track. */
360
+ bottom: calc(1.2 * var(--mp-unit));
361
+ /* Sized to its content, replacing a fixed 5 unit box that \`1:04:09\` overflows. Transparent, that
362
+ overflow was invisible; filled, it would not be. */
363
+ width: max-content;
364
+ white-space: nowrap;
365
+ transform: translateX(-50%);
366
+
367
+ pointer-events: none;
368
+ }
369
+
370
+ .loaded {
371
+ transform-origin: 0 0;
372
+ position: absolute;
373
+ bottom: 0;
374
+ height: calc(.4 * var(--mp-unit));
375
+ width: 100%;
376
+ .loaded-part {
377
+ transform-origin: 0 0;
378
+ bottom: 0;
379
+ height: calc(.4 * var(--mp-unit));
380
+ width: 100%;
381
+ position: absolute;
382
+ background-color: hsla(0, 100%, 100%, .4);
383
+ }
384
+ }
385
+
386
+ .play-container {
387
+ position: absolute;
388
+ bottom: 0;
389
+ width: 100%;
390
+ height: calc(.4 * var(--mp-unit));
391
+ }
392
+
393
+ .play {
394
+ transform-origin: 0 0;
395
+ background-color: #f03;
396
+ position: absolute;
397
+ bottom: 0;
398
+ height: calc(.4 * var(--mp-unit));
399
+ width: 100%;
400
+ }
401
+
402
+ .padding {
403
+ position: absolute;
404
+ bottom: -7.5px;
405
+ height: calc(2 * var(--mp-unit));
406
+ width: 100%;
407
+ }
408
+
409
+ .thumbnail {
410
+ display: flex;
411
+ justify-content: center;
412
+
413
+ position: absolute;
414
+ top: calc(calc(-3.4375 * var(--mp-unit)) - var(--thumbnail-width) * 9/16);
415
+ height: calc(var(--thumbnail-width) * 9/16);
416
+ width: var(--thumbnail-width);
417
+
418
+ margin-left: calc(var(--thumbnail-half) * -1);
419
+ pointer-events: none;
420
+
421
+ img {
422
+ border-radius: calc(.4 * var(--mp-unit));
423
+ box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
424
+
425
+ width: 100%;
426
+ height: 100%;
427
+ object-fit: cover;
428
+ }
429
+ }
430
+
431
+ /* a thumb is far wider than a cursor, so the hit strip grows to 44px and the track thickens */
432
+ @media (pointer: coarse) {
433
+ height: calc(.6 * var(--mp-unit));
434
+
435
+ /* press feedback, coarse only: a finger has no hover, so without this the bar gives no sign
436
+ it is being dragged */
437
+ &.dragging {
438
+ .background-bar, .loaded, .play-container {
439
+ transform: scaleY(1.5);
440
+ }
441
+ }
442
+
443
+ .loaded {
444
+ height: calc(.6 * var(--mp-unit));
445
+ .loaded-part {
446
+ height: calc(.6 * var(--mp-unit));
447
+ }
448
+ }
449
+
450
+ .play-container {
451
+ height: calc(.6 * var(--mp-unit));
452
+ }
453
+
454
+ .play {
455
+ height: calc(.6 * var(--mp-unit));
456
+ }
457
+
458
+ /* grows upward into the video: centred, it would hang over the control row and win hit
459
+ testing against taps meant for play, mute and fullscreen */
460
+ .padding {
461
+ height: 44px;
462
+ bottom: 0;
463
+ }
464
+ }
465
+
466
+ /* the clamp only holds the preview inside the bar while the bar is the wider of the two, so
467
+ below that the preview is narrowed instead */
468
+ @media (max-width: 480px) {
469
+ --thumbnail-width: calc(18 * var(--mp-unit));
470
+ --thumbnail-half: calc(9 * var(--mp-unit));
471
+ }
472
+ `,vy=4,yy=()=>{let e=Q(),t=Q(e=>e.currentTime),n=Q(e=>e.requestSeek),r=Q(e=>e.duration),i=Q(e=>e.size),a=Q(e=>e.downloadedRanges),s=Q(e=>e.indexes),c=Q(e=>e.thumbnails),l=Q(e=>e.thumbnailAt),u=Q(e=>e.requestThumbnail),d=Q(e=>e.chapters),f=Q(e=>e.seekingTo),p=o(null),[g,_]=h(void 0),[v,x]=h(void 0),S=e=>{x(e),u(e)},C=o(void 0),w=o(0),T=o(void 0),E=o(void 0),D=o(!1),{dragging:O,handlers:k}=qv({ref:p,onChange:e=>{if(w.current+=1,T.current=e,E.current===void 0)E.current=e;else if(!D.current){let t=p.current?.getBoundingClientRect().width??0;Math.abs(e-E.current)*t>vy&&(D.current=!0)}_(e),C.current!==`mouse`&&S(e*r)}}),A=e=>{C.current=e.pointerType,w.current=0,E.current=void 0,D.current=!1,k.onPointerDown(e)},j=t=>{k.onPointerUp(t);let i=w.current>0?T.current:void 0;if(i!==void 0&&r){let t=i*r;n?n(t):e.seek(t)}w.current=0,D.current=!1,E.current=void 0,t.pointerType!==`mouse`&&S(void 0)},ee=e=>{if(!p.current)return;let{left:t,right:n}=p.current.getBoundingClientRect();return Math.min(Math.max((e-t)/(n-t),0),1)*r},te=e=>{S(ee(e.clientX))},M=()=>{p.current&&S(void 0)},N=e=>r?e/r*100:0,F=b(()=>a?.map((e,t)=>{if(!i||!r)return null;let n=s.filter(t=>e.startByteOffset<=t.pos&&t.pos<=e.endByteOffset),a=n.at(0),o=n.at(-1);if(!a||!o)return null;let c=a.timestamp/r,l=o.timestamp/r,u=Number((l-c).toFixed(2)),d=c*100;return P(`div`,{className:`loaded-part`,style:{transform:`scaleX(${u})`,marginLeft:`${d}%`}},t)})??[],[r,s.length,a?.map(({startByteOffset:e,endByteOffset:t})=>`${e}/${t}`).join(`,`)]);m(()=>{g===void 0||!r||!O||!D.current||e.seek(g*r)},[e,O,g,r]);let I=b(()=>{if(!r)return 0;if(O&&g!==void 0)return g;let e=f??t;return typeof e==`number`?e/r:0},[r,t,O,g,f]),L=b(()=>Qv(d,r),[d,r]),R=L.length>0,z=b(()=>{if(!R||v===void 0||!r)return-1;let e=v/r*100,t=L.findIndex((t,n)=>n<L.length-1&&e>=t&&e<L[n+1]);return t>=0?t:L.length-2},[R,L,v,r]),ne=b(()=>R?$v(L,e=>e!==z):void 0,[R,L,z]),re=b(()=>z>=0?$v(L,e=>e===z):void 0,[L,z]),ie=b(()=>{if(v!==void 0)return d.find(({start:e,end:t})=>e<=v&&v<t)},[d,v]),B=b(()=>{if(v){if(l)return l(v);if(c.length)return c.find(({startTime:e,endTime:t})=>e<=v&&v<t)}},[c,l,v]),ae=(e,t)=>y(`div`,{className:e?`track ${e}`:`track`,style:t?{maskImage:t}:void 0,children:[P(`div`,{className:`background-bar`}),P(`div`,{className:`loaded`,children:F}),P(`div`,{className:`play-container`,children:P(`div`,{className:`play`,style:{transform:`scaleX(${I})`}})})]});return y(`div`,{css:_y,ref:p,className:[`progress-bar`,O?`dragging`:``,R?`segmented`:``].filter(Boolean).join(` `),onMouseMove:te,onMouseOut:M,children:[ae(void 0,ne),v?y(`div`,{className:`cursor-time`,style:{left:ie?`clamp(var(--thumbnail-half), ${N(v)}%, calc(100% - var(--thumbnail-half)))`:`clamp(calc(3 * var(--mp-unit)), ${N(v)}%, calc(100% - calc(3 * var(--mp-unit))))`,maxWidth:ie?`var(--thumbnail-width)`:void 0},children:[P(`span`,{className:`cursor-time-value`,children:Bv(v)}),ie?P(`span`,{className:`chapter-title`,children:ie.title}):void 0]}):void 0,P(`div`,{className:`progress`}),P(`div`,{className:`hover`}),re?ae(`focus`,re):void 0,P(`div`,{className:`scrubber`}),P(`div`,{className:`padding`,...k,onPointerDown:A,onPointerUp:j,onPointerCancel:j}),P(`div`,{className:`thumbnail`,style:{left:`clamp(var(--thumbnail-half), ${N(v??1)}%, calc(100% - var(--thumbnail-half)))`},children:B?.url?P(`img`,{src:B.url}):void 0})]})},by=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23fff'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20class='icon%20icon-tabler%20icons-tabler-outline%20icon-tabler-picture-in-picture'%3e%3cpath%20stroke='none'%20d='M0%200h24v24H0z'%20fill='none'%20/%3e%3cpath%20d='M11%2019h-6a2%202%200%200%201%20-2%20-2v-10a2%202%200%200%201%202%20-2h14a2%202%200%200%201%202%202v4'%20/%3e%3cpath%20d='M14%2014m0%201a1%201%200%200%201%201%20-1h5a1%201%200%200%201%201%201v3a1%201%200%200%201%20-1%201h-5a1%201%200%200%201%20-1%20-1z'%20/%3e%3c/svg%3e`,xy={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},Sy=e=>y(`svg`,{...xy,...e,children:[P(`rect`,{x:`3`,y:`5`,width:`18`,height:`14`,rx:`2`,ry:`2`}),P(`path`,{d:`M7 15h4m4 0h2M7 11h2m4 0h4`})]}),Cy=e=>y(`svg`,{...xy,...e,children:[P(`rect`,{x:`3`,y:`5`,width:`18`,height:`14`,rx:`2`,ry:`2`}),P(`path`,{d:`M7 15h4m4 0h2M7 11h2m4 0h4`}),P(`line`,{x1:`2`,y1:`2`,x2:`22`,y2:`22`})]}),wy=e=>y(`svg`,{...xy,...e,children:[P(`path`,{d:`M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5`}),P(`rect`,{x:`12`,y:`13`,width:`10`,height:`8`,rx:`1`,ry:`1`}),P(`path`,{d:`M14.5 18.5h2m2 0h1`})]}),Ty=e=>y(`svg`,{...xy,...e,children:[P(`path`,{d:`M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5`}),P(`rect`,{x:`12`,y:`13`,width:`10`,height:`8`,rx:`1`,ry:`1`}),P(`path`,{d:`M6 9h3m2 0h2`})]}),Ey=D`
473
+ .popover {
474
+ position: absolute;
475
+ /* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
476
+ bar, so a menu centred on it puts its own edges wherever the button happens to sit: with no
477
+ picture-in-picture button, which is every source whose media the player does not own, an edge
478
+ landed outside the box, and the root's \`overflow: hidden\` cut it off, taking the rows under it
479
+ out of reach. The inset matches the bar's own padding so the menu lines up with the last button. */
480
+ right: calc(12px + env(safe-area-inset-right, 0px));
481
+ bottom: calc(100% + 8px);
482
+
483
+ overflow-y: auto;
484
+ width: 180px;
485
+ /* \`100%\` is the control bar, which is the width of the PLAYER. The old \`100vw\` was the viewport,
486
+ which equals the player only when the player is the whole document, and it is the wrong kind of
487
+ guard besides: a max-width shrinks the box, it never moves it back inside. */
488
+ max-width: calc(100% - 24px);
489
+ /* Sized to its rows, capped at what fits. A fixed height left the settings menu two thirds empty
490
+ once subtitles moved out to its own button, and a long track list scrolls at the cap either way. */
491
+ height: max-content;
492
+ /* The room actually above the bar. A short player had the top of the menu clipped by that same
493
+ \`overflow: hidden\`. With no size container in the ancestry this resolves against the small
494
+ viewport, so it can only ever shrink the box, never grow it. */
495
+ max-height: min(160px, calc(100cqh - 100% - 16px));
496
+ @media (min-width: 768px) {
497
+ right: calc(16px + env(safe-area-inset-right, 0px));
498
+ width: 250px;
499
+ max-width: calc(100% - 32px);
500
+ }
501
+ @media (min-width: 2560px) {
502
+ right: calc(24px + env(safe-area-inset-right, 0px));
503
+ max-width: calc(100% - 48px);
504
+ }
505
+
506
+ display: flex;
507
+ flex-direction: column;
508
+
509
+ border-radius: 8px;
510
+ background-color: rgba(28,28,28,0.95);
511
+ ${kv.bMedium.regular}
512
+
513
+ z-index: 4;
514
+
515
+ > div {
516
+ display: flex;
517
+ align-items: center;
518
+ justify-content: space-between;
519
+
520
+ color: #fff;
521
+ outline: none;
522
+
523
+ padding: 8px 6px 8px 12px;
524
+
525
+ width: 100%;
526
+ /* rows keep their own height inside the fixed height column, so a long page scrolls rather than
527
+ squashing every row into it */
528
+ flex-shrink: 0;
529
+ @media (pointer: coarse) {
530
+ box-sizing: border-box;
531
+ min-height: 44px;
532
+ }
533
+
534
+ :first-of-type {
535
+ border-radius: 8px 8px 0 0;
536
+ }
537
+ :last-of-type {
538
+ border-radius: 0 0 8px 8px;
539
+ }
540
+ &:not(.no-hover) {
541
+ cursor: pointer;
542
+ }
543
+ &:not(.no-hover):hover {
544
+ background-color: rgba(255,255,255,.1);
545
+ }
546
+
547
+ > div {
548
+ display: flex;
549
+ align-items: center;
550
+ justify-content: center;
551
+
552
+ .secondary {
553
+ color: #eee;
554
+ ${kv.bSmall.regular}
555
+ }
556
+ }
557
+ }
558
+
559
+ .back {
560
+ display: flex;
561
+ align-items: center;
562
+ justify-content: flex-start;
563
+ border-bottom: 1px solid #4D4D4E;
564
+
565
+ svg {
566
+ transform: translateX(-4px);
567
+ transition: transform 0.2s ease-in-out;
568
+ }
569
+
570
+ :hover {
571
+ svg {
572
+ transform: translateX(-8px);
573
+ }
574
+ }
575
+ }
576
+ }
577
+
578
+ .track-list {
579
+ .description {
580
+ word-break: break-word;
581
+ }
582
+
583
+ /* Dimmed and inert, but still listed. A source that names a track it cannot serve right now is
584
+ saying the track exists, and dropping the row would read as the source having nothing. */
585
+ .unavailable {
586
+ opacity: 0.5;
587
+ cursor: default;
588
+ :hover {
589
+ background-color: transparent;
590
+ }
591
+ }
592
+
593
+ .failed {
594
+ border-bottom: 1px solid #4D4D4E;
595
+ color: #f66;
596
+ ${kv.bSmall.regular}
597
+ }
598
+ }
599
+ `,Dy=({title:e,tracks:t,selected:n,onSelect:r,onBack:i,offLabel:a,pending:o,failed:s})=>{let c=o!==void 0,l=(e,i,a)=>{let s=c&&o===e,l=c||t.find(t=>t.id===e)?.disabled;return y(`div`,{onClick:()=>{l||r(e??void 0)},className:[a,l?`unavailable`:null].filter(Boolean).join(` `)||void 0,children:[P(`span`,{children:i}),P(`span`,{children:s?`…`:(n??null)===e?`✓`:``})]},e??`__off__`)};return y(`div`,{className:`popover track-list`,children:[y(`div`,{className:i?`back`:`back no-hover`,onClick:i,children:[i?P(Xg,{}):null,P(`span`,{children:e})]}),s?P(`div`,{className:`no-hover failed`,children:`Could not switch. Try again.`}):null,a?l(null,a):null,t.map(({id:e,label:t})=>l(e,t,`description`))]})},Oy=({onReset:e}={})=>{let t=o(null),[n,r]=h(!1),[i,a]=h(void 0),[s,c]=h(!1),l=o(e);l.current=e;let u=()=>{r(!1),l.current?.()};return m(()=>{let e=e=>{n&&t.current&&!t.current.contains(e.target)&&u()};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[n]),{open:n,toggle:()=>{r(e=>!e),c(!1),l.current?.()},close:u,containerRef:t,pending:i,failed:s,runSelect:(e,t)=>{if(i!==void 0)return;c(!1);let n;try{n=t()}catch(e){console.warn(`[media-player] track selection failed:`,e),c(!0);return}if(!(n instanceof Promise)){u();return}a(e),n.then(()=>{a(void 0),u()},e=>{console.warn(`[media-player] track selection failed:`,e),a(void 0),c(!0)})}}},ky=D`
600
+ /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
601
+ which is the width of the player box, so it can be clamped to it. */
602
+ position: static;
603
+
604
+ .errors {
605
+ /* the icon keeps its size, the pressable box grows around it */
606
+ @media (pointer: coarse) {
607
+ box-sizing: border-box;
608
+ justify-content: center;
609
+
610
+ min-width: 44px;
611
+ min-height: 44px;
612
+ }
613
+ }
614
+
615
+ ${Ey}
616
+
617
+ .popover.error-list {
618
+ /* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
619
+ decoder message that has been ellipsized is not worth copying. */
620
+ width: 420px;
621
+ max-height: min(300px, calc(100cqh - 100% - 16px));
622
+
623
+ /* track-menu's header is a left-aligned label row; here it carries a control too, so the two
624
+ ends go to the two ends */
625
+ .back {
626
+ justify-content: space-between;
627
+ gap: 8px;
628
+ }
629
+
630
+ .copy {
631
+ /* sits in the header row, which track-menu styles as .back */
632
+ display: flex;
633
+ align-items: center;
634
+ gap: 6px;
635
+
636
+ background: none;
637
+ border: none;
638
+ padding: 4px 6px;
639
+ border-radius: 4px;
640
+
641
+ color: #fff;
642
+ cursor: pointer;
643
+ ${kv.bSmall.regular}
644
+
645
+ &:hover {
646
+ background-color: rgba(255,255,255,.1);
647
+ }
648
+
649
+ svg {
650
+ width: 14px;
651
+ height: 14px;
652
+ }
653
+ }
654
+
655
+ .entry {
656
+ /* one failure is a block of text, so it stacks instead of sitting on one line */
657
+ display: flex;
658
+ flex-direction: column;
659
+ align-items: flex-start;
660
+ gap: 2px;
661
+
662
+ .when {
663
+ color: #bbb;
664
+ ${kv.bSmall.regular}
665
+
666
+ /* the one part of the line worth scanning for, so it is the one part at full brightness */
667
+ .count {
668
+ margin-left: 6px;
669
+ color: #fff;
670
+ }
671
+ }
672
+
673
+ .what {
674
+ /* the decoder's own words, which are long and must not be cut */
675
+ overflow-wrap: anywhere;
676
+ white-space: pre-wrap;
677
+ }
678
+
679
+ .cause {
680
+ color: #ddd;
681
+ overflow-wrap: anywhere;
682
+ white-space: pre-wrap;
683
+ ${kv.bSmall.regular}
684
+ }
685
+ }
686
+ }
687
+ `,Ay=e=>new Date(e).toLocaleTimeString(),jy=e=>e===void 0||!Number.isFinite(e)?void 0:Bv(Math.max(0,e)),My=e=>e.reduce((e,t)=>e+t.count,0),Ny=e=>e.map((e,t)=>{let n=jy(e.atMediaTime),r=e.count>1?`${new Date(e.at).toISOString()} to ${new Date(e.lastAt).toISOString()} ×${e.count}`:new Date(e.at).toISOString();return[`${t+1}. ${r}${n?` (at ${n})`:``}${e.recovered?` [recovered]`:``}`,e.message,e.detail].filter(Boolean).join(`
688
+ `)}).join(`
689
+
690
+ `),Py=()=>{let e=Q(e=>e.playbackErrors),{open:t,toggle:n,containerRef:r}=Oy(),[i,a]=h(!1);if(e.length===0)return null;let o=()=>{navigator.clipboard?.writeText(Ny(e)).then(()=>{a(!0),setTimeout(()=>a(!1),2e3)},e=>console.warn(`[media-player] could not copy the errors:`,e))},s=`Playback errors (${My(e)})`;return y(`div`,{css:ky,ref:r,children:[P(Kv,{id:`errors`,disabled:t,text:P(`button`,{className:`errors`,type:`button`,onClick:n,"aria-label":s,"aria-expanded":t,children:P(Hg,{className:`alert-triangle`})}),toolTipText:P(`span`,{children:s})}),t&&y(`div`,{className:`popover error-list`,children:[y(`div`,{className:`back no-hover`,children:[P(`span`,{children:s}),y(`button`,{className:`copy`,type:`button`,onClick:o,"aria-label":`Copy the errors`,children:[P(i?Kg:i_,{}),P(`span`,{children:i?`Copied`:`Copy`})]})]}),e.map((e,t)=>y(`div`,{className:`entry no-hover`,children:[y(`span`,{className:`when`,children:[Ay(e.at),e.count>1?` to ${Ay(e.lastAt)}`:``,jy(e.atMediaTime)?` at ${jy(e.atMediaTime)}`:``,e.recovered?` recovered`:``,e.count>1?P(`span`,{className:`count`,children:`×${e.count}`}):null]}),P(`span`,{className:`what`,children:e.message}),e.detail?P(`span`,{className:`cause`,children:e.detail}):null]},`${e.at}-${t}`))]})]})},Fy=D`
691
+ display: flex;
692
+ align-items: center;
693
+ justify-content: center;
694
+ flex-direction: column;
695
+ width: 100%;
696
+
697
+ .playback-slider {
698
+ display: flex;
699
+ align-items: center;
700
+
701
+ padding: 8px 4px;
702
+ margin: 0 2px;
703
+ /* a finger needs a 44px band to press, so the padding grows while the track stays 3px */
704
+ @media (pointer: coarse) {
705
+ padding: 20px 8px;
706
+ }
707
+
708
+ cursor: pointer;
709
+
710
+ > div {
711
+ position: relative;
712
+
713
+ background: #ccc;
714
+ border-radius: 4px;
715
+
716
+ width: 120px;
717
+ max-width: 100%;
718
+ height: 3px;
719
+ @media (min-width: 768px) {
720
+ height: 4px;
721
+ }
722
+ }
723
+
724
+ .playback-handle {
725
+ position: absolute;
726
+
727
+
728
+ background: #ffffff;
729
+ border-radius: 50%;
730
+ transform: translateX(-50%);
731
+ pointer-events: none;
732
+
733
+ width: 10px;
734
+ height: 10px;
735
+ top: -3.5px;
736
+ @media (min-width: 768px) {
737
+ width: 12px;
738
+ height: 12px;
739
+ top: -4px;
740
+ }
741
+ }
742
+ }
743
+ `,Iy=()=>{let e=Q(),t=Q(e=>e.playbackRate),n=o(null),r=o(null),i=.25,a=2.75,s=(e,t=.05)=>Math.round(e/t)*t,c=s(t||1),l=e=>(e-i)/a*100,u=e=>s(i+e*a),{handlers:d}=qv({ref:r,onChange:t=>e.setPlaybackRate(u(t))}),f=t=>{t.preventDefault();let n=.05,r=c;r=t.deltaY<0?Math.min(3,r+n):Math.max(i,r-n),e.setPlaybackRate(r)};m(()=>{let e=n.current;return e&&e.addEventListener(`wheel`,f,{passive:!1}),()=>{e&&e.removeEventListener(`wheel`,f)}},[t]);let p=l(c);return y(`div`,{css:Fy,children:[y(`div`,{children:[c.toFixed(2),`x`]}),P(`div`,{className:`playback-slider`,ref:n,...d,children:P(`div`,{ref:r,style:{background:`linear-gradient(to right,
744
+ #fff 0% ${p}%,
745
+ #3A3A3A ${p}% 100%
746
+ )`},children:P(`div`,{className:`playback-handle`,style:{left:`${p}%`}})})})]})},Ly=D`
747
+ /* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
748
+ as wide as the player box and can therefore be clamped to it. The outside-click check uses
749
+ \`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
750
+ tooltips already resolve against the control bar with no positioned wrapper of their own. */
751
+ position: static;
752
+
753
+ .settings {
754
+ /* the icon keeps its size, the pressable box grows around it */
755
+ @media (pointer: coarse) {
756
+ box-sizing: border-box;
757
+ justify-content: center;
758
+
759
+ min-width: 44px;
760
+ min-height: 44px;
761
+ }
762
+ }
763
+
764
+ ${Ey}
765
+
766
+ .playback-rate {
767
+ .slider {
768
+ width: 100%;
769
+ }
770
+ .options {
771
+ display: grid;
772
+ grid-template-columns: 1fr 1fr 1fr 1fr;
773
+ align-items: center;
774
+
775
+ padding: 8px 12px;
776
+ /* four presets across a 180px popover leave targets 34px wide, so a finger gets two rows of two
777
+ until the popover is wide enough for the row of four */
778
+ @media (pointer: coarse) {
779
+ grid-template-columns: 1fr 1fr;
780
+ }
781
+ @media (pointer: coarse) and (min-width: 768px) {
782
+ grid-template-columns: 1fr 1fr 1fr 1fr;
783
+ }
784
+
785
+ > div {
786
+ display: flex;
787
+ align-items: center;
788
+ border-radius: 4px;
789
+
790
+ padding: 8px 6px;
791
+ height: 100%;
792
+ @media (pointer: coarse) {
793
+ box-sizing: border-box;
794
+ min-height: 44px;
795
+ }
796
+
797
+ cursor: pointer;
798
+ :hover {
799
+ background-color: rgba(255,255,255,.1);
800
+ }
801
+ }
802
+ }
803
+ }
804
+
805
+ `,Ry=()=>{let e=Q(),t=Q(e=>e.playbackRate),n=Q(e=>e.audioTracks),r=Q(e=>e.selectedAudioTrack),i=Q(e=>e.selectAudioTrack),[a,o]=h(0),{open:s,toggle:c,containerRef:l,pending:u,failed:d,runSelect:f}=Oy({onReset:()=>o(0)}),p=t=>{e.setPlaybackRate(t),o(0)},m=e=>{e!==void 0&&f(e,()=>i(e))},g=e=>()=>{o(e)};return y(`div`,{css:Ly,ref:l,children:[P(Kv,{id:`settings`,disabled:s,text:P(`button`,{className:`settings`,type:`button`,onClick:c,"aria-label":`Settings`,"aria-expanded":s,children:P(O_,{})}),toolTipText:P(`span`,{children:`Settings`})}),s&&a===0&&y(`div`,{className:`popover menu`,children:[n.length>1?y(`div`,{onClick:g(2),children:[P(`div`,{children:`Audio`}),P(`div`,{children:P(e_,{})})]}):null,y(`div`,{onClick:g(1),children:[P(`div`,{children:`Playback speed`}),y(`div`,{children:[P(`span`,{className:`secondary`,children:t===1?`(Default)`:t.toFixed(2)}),P(e_,{})]})]})]}),s&&a===1&&y(`div`,{className:`popover playback-rate`,children:[y(`div`,{className:`back`,onClick:g(0),children:[P(Xg,{}),P(`span`,{children:`Playback speed`})]}),P(`div`,{className:`slider no-hover`,children:P(Iy,{})}),y(`div`,{className:`options no-hover`,children:[P(`div`,{onClick:()=>p(.5),children:`0.5x`}),P(`div`,{onClick:()=>p(1),children:`1x`}),P(`div`,{onClick:()=>p(1.5),children:`1.5x`}),P(`div`,{onClick:()=>p(2),children:`2x`})]})]}),s&&a===2&&P(Dy,{title:`Audio`,tracks:n,selected:r,onSelect:m,onBack:g(0),pending:u,failed:d})]})},zy=D`
806
+ /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
807
+ which is the width of the player box, so it can be clamped to it. */
808
+ position: static;
809
+
810
+ .subtitles {
811
+ /* the icon keeps its size, the pressable box grows around it */
812
+ @media (pointer: coarse) {
813
+ box-sizing: border-box;
814
+ justify-content: center;
815
+
816
+ min-width: 44px;
817
+ min-height: 44px;
818
+ }
819
+ }
820
+
821
+ ${Ey}
822
+ `,By=()=>{let e=Q(e=>e.subtitleTracks),t=Q(e=>e.selectedSubtitleTrack),n=Q(e=>e.selectSubtitleTrack),r=Q(e=>e.subtitleOffLabel),{open:i,toggle:a,containerRef:o,pending:s,failed:c,runSelect:l}=Oy();if(e.length===0)return null;let u=t!==void 0;return y(`div`,{css:zy,ref:o,children:[P(Kv,{id:`subtitles`,disabled:i,text:P(`button`,{className:`subtitles`,type:`button`,onClick:a,"aria-label":`Subtitles`,"aria-expanded":i,"aria-pressed":u,children:u?P(Sy,{className:`captions`}):P(Cy,{className:`captions-off`})}),toolTipText:P(`span`,{children:`Subtitles`})}),i&&P(Dy,{title:`Subtitles`,tracks:e,selected:t,onSelect:e=>l(e??null,()=>n(e)),offLabel:r??`Disable`,pending:s,failed:c})]})},Vy={primary:`#EAEBEE`,secondary:`#D0D0D9`,hover:`rgba(255, 255, 255, 0.13)`,borderPrimary:`#384F70`,backgroundTooltip:`#222222`},Hy=D`
823
+ display: flex;
824
+ align-items: center;
825
+
826
+ padding: 16px 4px;
827
+ margin: 0 2px;
828
+ /* a finger needs a 44px band to press, so the padding grows while the track stays 3px */
829
+ @media (pointer: coarse) {
830
+ padding: 22px 4px;
831
+ }
832
+
833
+ cursor: pointer;
834
+
835
+ > div {
836
+ position: relative;
837
+
838
+ background: #ccc;
839
+ border-radius: 4px;
840
+
841
+ width: 80px;
842
+ height: 3px;
843
+ /* the control bar has under 360px to fit every button once the slider is always open, so the
844
+ track lends some of its length back on a phone and takes it again on anything wider */
845
+ @media (pointer: coarse) {
846
+ width: 64px;
847
+ }
848
+ @media (pointer: coarse) and (min-width: 768px) {
849
+ width: 80px;
850
+ }
851
+ }
852
+
853
+ .volume-handle {
854
+ position: absolute;
855
+ top: -3.5px;
856
+
857
+ background: #ffffff;
858
+ border-radius: 50%;
859
+ transform: translateX(-50%);
860
+ pointer-events: none;
861
+
862
+ width: 10px;
863
+ height: 10px;
864
+ }
865
+ `,Uy=({value:e,onChange:t})=>{let n=Q(e=>e.volume),r=Q(e=>e.muted),i=o(null),a=o(null),{handlers:s}=qv({ref:a,onChange:t}),c=n=>{n.preventDefault();let r=.05,i=e;i=n.deltaY<0?Math.min(1,i+r):Math.max(0,i-r),t(i)};m(()=>{let e=i.current;return e&&e.addEventListener(`wheel`,c,{passive:!1}),()=>{e&&e.removeEventListener(`wheel`,c)}},[e]);let l=e*100,u=b(()=>Math.round(r?0:zv(n)*100),[n,r]);return P(Kv,{id:`volume-slider`,text:P(`div`,{ref:i,css:Hy,...s,children:P(`div`,{ref:a,style:{background:`linear-gradient(to right,
866
+ #fff 0% ${l}%,
867
+ #3A3A3A ${l}% 100%
868
+ )`},children:P(`div`,{className:`volume-handle`,style:{left:`${e*100}%`}})})}),toolTipText:y(`div`,{className:`volume-value`,children:[u,`%`]})})},Wy=D`
869
+ position: relative;
870
+ display: flex;
871
+ align-items: center;
872
+
873
+ .volume-slider-container {
874
+ display: flex;
875
+ align-items: center;
876
+
877
+ width: 0;
878
+ margin-right: 0;
879
+ overflow: hidden;
880
+ pointer-events: none;
881
+
882
+ transition: margin .2s cubic-bezier(0.4,0,1,1), width .2s cubic-bezier(0.4,0,1,1);
883
+ -webkit-transition: margin .2s cubic-bezier(0.4,0,1,1), width .2s cubic-bezier(0.4,0,1,1);
884
+
885
+ .volume-slider-background {
886
+ display: flex;
887
+ flex-direction: row;
888
+ align-items: center;
889
+
890
+ border-radius: 4px;
891
+
892
+ .volume-value {
893
+ ${kv.bMedium.regular};
894
+ color: #ffffff;
895
+ }
896
+ }
897
+ }
898
+
899
+ &:hover .volume-slider-container {
900
+ width: calc(9 * var(--mp-unit));
901
+
902
+ transition: margin .2s cubic-bezier(0,0,0.2,1), width .2s cubic-bezier(0,0,0.2,1);
903
+ -webkit-transition: margin .2s cubic-bezier(0,0,0.2,1), width .2s cubic-bezier(0,0,0.2,1);
904
+
905
+ pointer-events: auto;
906
+ }
907
+
908
+ /* a touch screen has no hover, so the slider stays open there and the button only mutes */
909
+ @media (pointer: coarse) {
910
+ /* auto, not a fixed rem: the container keeps overflow: hidden, so a narrower fixed width
911
+ silently clips the track and makes the clipped part unhittable */
912
+ .volume-slider-container,
913
+ &:hover .volume-slider-container {
914
+ width: auto;
915
+
916
+ pointer-events: auto;
917
+ }
918
+
919
+ /* a 44px press target around an 18px icon, floored here because the control bar sets the
920
+ padding at a higher specificity */
921
+ .sound {
922
+ /* border-box explicitly, since a consumer reset cannot be assumed */
923
+ box-sizing: border-box;
924
+ justify-content: center;
925
+
926
+ min-width: 44px;
927
+ min-height: 44px;
928
+ }
929
+ }
930
+
931
+ `,Gy=({ref:e})=>{let t=Q(),n=Q(e=>e.volume),r=Q(e=>e.muted),i=b(()=>zv(n),[n]);return y(`div`,{css:Wy,children:[P(Kv,{id:`sound`,text:P(`button`,{className:`sound`,type:`button`,onClick:()=>t.toggleMuted(),ref:e,"aria-label":`Mute`,"aria-pressed":r||n===0,children:P(r||n===0?B_:n<=.5?M_:I_,{size:18,color:`#fff`})}),toolTipText:P(`span`,{children:r?`Unmute (m)`:`Mute (m)`})}),P(`div`,{className:`volume-slider-container`,children:P(`div`,{className:`volume-slider-background`,children:P(Uy,{value:r?0:i,onChange:e=>{t.setVolume(Rv(e))}})})})]})},Ky=.05,qy=5,Jy=D`
932
+ display: flex;
933
+ flex-direction: column;
934
+ gap: calc(0.4 * var(--mp-unit));
935
+
936
+ .hint {
937
+ opacity: 0.72;
938
+ font-size: 0.9em;
939
+ }
940
+ `,Yy=D`
941
+ position: absolute;
942
+ bottom: 0;
943
+ width: 100%;
944
+
945
+ background: linear-gradient(0deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.45) 20%, rgba(0,0,0,0.3) 40%, rgba(0,0,0,0.15) 70%, transparent 100%);
946
+ transition: opacity 0.1s cubic-bezier(.4,0,1,1);
947
+
948
+ .actions {
949
+ display: flex;
950
+ justify-content: space-between;
951
+
952
+ /* repeated per breakpoint: nested at-rules are hoisted after the rule, so a shorthand inside a
953
+ media query would override a longhand above it and silently drop the safe-area inset */
954
+ padding: 6px calc(12px + env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) calc(12px + env(safe-area-inset-left, 0px));
955
+ @media (min-width: 768px) {
956
+ padding: 8px calc(16px + env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) calc(16px + env(safe-area-inset-left, 0px));
957
+ }
958
+ @media (min-width: 2560px) {
959
+ padding: 8px calc(24px + env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) calc(24px + env(safe-area-inset-left, 0px));
960
+ }
961
+
962
+ .left, .right {
963
+ display: flex;
964
+ align-items: center;
965
+
966
+ button {
967
+ display: flex;
968
+ align-items: center;
969
+
970
+ outline: none;
971
+ border: none;
972
+ background: none;
973
+
974
+ svg {
975
+ width: 18px;
976
+ height: 18px;
977
+ @media (min-width: 768px) {
978
+ width: 24px;
979
+ height: 24px;
980
+ }
981
+ @media (min-width: 2560px) {
982
+ width: 28px;
983
+ height: 28px;
984
+ }
985
+ }
986
+
987
+ svg {
988
+ stroke: #fff;
989
+ }
990
+
991
+ /* Reads as unavailable rather than absent, so the bar does not reflow when tracks land. */
992
+ &:disabled {
993
+ cursor: default;
994
+ opacity: .4;
995
+ }
996
+ }
997
+
998
+ .play, .sound, .time, .errors, .subtitles, .settings, .picture-in-picture, .full-screen {
999
+ display: flex;
1000
+ align-items: center;
1001
+
1002
+ height: 100%;
1003
+
1004
+ border-radius: 4px;
1005
+ user-select: none;
1006
+
1007
+ padding: 8px;
1008
+ @media (min-width: 768px) {
1009
+ padding: 8px 12px;
1010
+ }
1011
+ @media (min-width: 2560px) {
1012
+ padding: 8px 12px;
1013
+ }
1014
+ }
1015
+
1016
+ .play, .sound, .errors, .subtitles, .settings, .picture-in-picture, .full-screen {
1017
+ border-radius: 4px;
1018
+
1019
+ padding: 8px;
1020
+ @media (min-width: 768px) {
1021
+ padding: 8px 12px;
1022
+ }
1023
+ @media (min-width: 2560px) {
1024
+ padding: 8px 12px;
1025
+ }
1026
+
1027
+ cursor: pointer;
1028
+
1029
+ :hover {
1030
+ background-color: ${Vy.hover};
1031
+ }
1032
+
1033
+ /* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
1034
+ window still has a mouse */
1035
+ @media (pointer: coarse) {
1036
+ /* border-box explicitly, since a consumer reset cannot be assumed */
1037
+ box-sizing: border-box;
1038
+ min-width: 44px;
1039
+ min-height: 44px;
1040
+ justify-content: center;
1041
+ }
1042
+ }
1043
+ }
1044
+
1045
+ .left {
1046
+ .time {
1047
+ ${kv.bMedium.regular}
1048
+ text-shadow: 0 0 4px rgba(0, 0, 0, 1);
1049
+ }
1050
+ }
1051
+ .right {
1052
+ .picture-in-picture {
1053
+ img {
1054
+ width: 22px;
1055
+ height: 22px;
1056
+ @media (min-width: 768px) {
1057
+ width: 28px;
1058
+ height: 28px;
1059
+ }
1060
+ @media (min-width: 2560px) {
1061
+ width: 32px;
1062
+ height: 32px;
1063
+ }
1064
+ }
1065
+ }
1066
+ }
1067
+ }
1068
+ `,Xy=()=>{let e=Q(),t=Q(e=>e.paused),n=Q(e=>e.currentTime),r=Q(e=>e.duration),i=Q(e=>e.seekingTo),a=Q(e=>e.fullscreen),o=Q(e=>e.hideUI),s=Q(e=>e.togglePictureInPicture),c=Q(e=>e.pictureInPictureMode),l=Q(e=>e.burnedInSubtitles),u=Q(e=>e.subtitleTracks),d=Q(e=>e.requestSeek),[f,g]=h(null),_=c===`burn-in`,v=u.length>0,b=r>0&&n===r,x=p(({direction:t,stepSize:n})=>{let r=zv(e.volume),i=t===`up`?n:-n,a=Math.max(0,Math.min(1,r+i)),o=e.muted;e.setVolume(Rv(a)),o&&!e.muted&&e.toggleMuted()},[e]);m(()=>{let t=t=>d?d(t):e.seek(t),n=n=>{let r=n.target;if(r?.isContentEditable||/^(input|textarea|select)$/i.test(r?.tagName??``))return;let i=!0;if(n.key===`f`)e.toggleFullscreen();else if(n.key===`k`)e.togglePaused();else if(n.key===` `)e.togglePaused();else if(n.key===`m`)e.toggleMuted();else if(n.key===`ArrowUp`)x({direction:`up`,stepSize:Ky});else if(n.key===`ArrowDown`)x({direction:`down`,stepSize:Ky});else if(n.key===`ArrowRight`){if(!e.duration)return;t(Math.min(e.currentTime+qy,e.duration))}else n.key===`ArrowLeft`?t(Math.max(e.currentTime-qy,0)):i=!1;i&&n.preventDefault()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,x,d]);let S=p(e=>{e.preventDefault(),e.deltaY<0?x({direction:`up`,stepSize:Ky}):x({direction:`down`,stepSize:Ky})},[x]);return m(()=>{if(f)return f.addEventListener(`wheel`,S,{passive:!1}),()=>f.removeEventListener(`wheel`,S)},[f,S]),y(`div`,{css:Yy,style:{...o?{opacity:`0`,pointerEvents:`none`}:{}},children:[P(yy,{}),y(`div`,{className:`actions`,children:[y(`div`,{className:`left`,children:[P(Kv,{id:`play`,tooltipPlace:`top-start`,text:P(`button`,{className:`play`,type:`button`,onClick:()=>e.togglePaused(),"aria-label":b?`Replay`:t?`Play`:`Pause`,children:P(b?w_:t?b_:g_,{})}),toolTipText:P(`span`,{children:b?`Replay (k)`:t?`Play (k)`:`Pause (k)`})}),P(Gy,{ref:g}),P(`div`,{className:`time`,children:Vv(i??n,r)})]}),y(`div`,{className:`right`,children:[P(Py,{}),P(By,{}),P(Ry,{}),s?P(Kv,{id:`picture-in-picture`,tooltipPlace:`top-end`,text:P(`button`,{className:`picture-in-picture`,type:`button`,onClick:s,disabled:_&&!v,"aria-label":_?`Put the subtitles in the video`:`Picture in picture`,"aria-pressed":_?l:void 0,children:_?P(l?wy:Ty,{}):P(`img`,{src:by,alt:``})}),toolTipText:y(`span`,{css:Jy,children:[P(`span`,{className:`lead`,children:_?v?l?`Subtitles are in the picture`:`Put the subtitles in the picture`:`This file has no subtitles`:`Picture in picture`}),_&&v?P(`span`,{className:`hint`,children:`Then hover the video and click your browser's own pop out button`}):null]})}):null,P(Kv,{id:`full-screen`,tooltipPlace:`top-end`,text:P(`button`,{className:`full-screen`,type:`button`,onClick:()=>e.toggleFullscreen(),"aria-label":`Full screen`,"aria-pressed":a,children:P(a?f_:c_,{})}),toolTipText:P(`span`,{children:a?`Exit full screen (f)`:`Full screen (f)`})})]})]})]})},Zy=9e3,Qy=D`
1069
+ position: absolute;
1070
+ inset: 0;
1071
+ z-index: 2;
1072
+ pointer-events: none;
1073
+
1074
+ .card {
1075
+ position: absolute;
1076
+ /* Where Firefox draws its own toggle: right aligned, a little past the middle of the height. */
1077
+ top: 52%;
1078
+ right: calc(7 * var(--mp-unit));
1079
+ transform: translateY(-50%);
1080
+
1081
+ display: flex;
1082
+ align-items: center;
1083
+ gap: calc(1.2 * var(--mp-unit));
1084
+
1085
+ max-width: min(calc(42 * var(--mp-unit)), 60%);
1086
+ padding: calc(1.4 * var(--mp-unit)) calc(1.8 * var(--mp-unit));
1087
+ border-radius: calc(0.8 * var(--mp-unit));
1088
+ background-color: rgba(20, 20, 22, 0.94);
1089
+ box-shadow: 0 0 calc(2 * var(--mp-unit)) rgba(0, 0, 0, 0.6);
1090
+
1091
+ opacity: 0;
1092
+ transition: opacity 0.25s ease;
1093
+ }
1094
+
1095
+ &.show .card {
1096
+ opacity: 1;
1097
+ }
1098
+
1099
+ .words {
1100
+ display: flex;
1101
+ flex-direction: column;
1102
+ gap: calc(0.3 * var(--mp-unit));
1103
+ }
1104
+
1105
+ .title {
1106
+ ${kv.bMedium.bold}
1107
+ color: #fff;
1108
+ }
1109
+
1110
+ .body {
1111
+ ${kv.bSmall.regular}
1112
+ color: rgba(255, 255, 255, 0.75);
1113
+ }
1114
+
1115
+ /* Points at the edge the browser's control lives on, which is the whole message. */
1116
+ .arrow {
1117
+ flex: none;
1118
+ font-size: calc(2.6 * var(--mp-unit));
1119
+ line-height: 1;
1120
+ color: #fff;
1121
+ }
1122
+ `,$y=()=>{let e=Q(e=>e.burnedInSubtitles),t=Q(e=>e.pictureInPictureMode),[n,r]=h(!1);return m(()=>{if(t!==`burn-in`||!e){r(!1);return}r(!0);let n=setTimeout(()=>r(!1),Zy);return()=>clearTimeout(n)},[t,e]),t!==`burn-in`||!e?null:P(`div`,{css:Qy,className:n?`show`:``,role:`status`,children:y(`div`,{className:`card`,children:[y(`div`,{className:`words`,children:[P(`div`,{className:`title`,children:`Subtitles are in the picture`}),P(`div`,{className:`body`,children:`Now hover the video and click your browser's own pop out button`})]}),P(`div`,{className:`arrow`,"aria-hidden":`true`,children:`→`})]})})},eb=1,tb=6e3,nb=1,rb={opening:`Skip Opening`,ending:`Skip Ending`},ib=D`
1123
+ position: absolute;
1124
+ inset: 0;
1125
+ z-index: 2;
1126
+ pointer-events: none;
1127
+
1128
+ button {
1129
+ position: absolute;
1130
+ /* clear of the control bar, which is 6 to 8px of padding plus a row of 18 to 28px controls and
1131
+ the seekbar above them */
1132
+ bottom: calc(7 * var(--mp-unit));
1133
+ right: calc(2.4 * var(--mp-unit));
1134
+
1135
+ /* the one thing in this layer that can be pressed */
1136
+ pointer-events: auto;
1137
+ cursor: pointer;
1138
+
1139
+ ${kv.bMedium.bold}
1140
+ color: #fff;
1141
+ padding: calc(1 * var(--mp-unit)) calc(1.8 * var(--mp-unit));
1142
+ border: 1px solid rgba(255, 255, 255, .55);
1143
+ border-radius: calc(.4 * var(--mp-unit));
1144
+ background-color: rgba(20, 20, 22, .8);
1145
+ box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
1146
+
1147
+ opacity: 0;
1148
+ transform: translateY(calc(.6 * var(--mp-unit)));
1149
+ /* visibility as well as opacity, so a faded button cannot be hovered or pressed */
1150
+ visibility: hidden;
1151
+ transition: opacity .18s ease, transform .18s ease, visibility .18s;
1152
+
1153
+ &:hover, &:focus-visible {
1154
+ background-color: rgba(255, 255, 255, .92);
1155
+ color: #111;
1156
+ border-color: transparent;
1157
+ }
1158
+ }
1159
+
1160
+ &.show button {
1161
+ opacity: 1;
1162
+ transform: none;
1163
+ visibility: visible;
1164
+ }
1165
+
1166
+ @media (pointer: coarse) {
1167
+ button {
1168
+ /* a finger needs a target, and the control row below is already 44px */
1169
+ min-height: 44px;
1170
+ bottom: calc(9 * var(--mp-unit));
1171
+ }
1172
+ }
1173
+ `,ab=()=>{let e=Q(e=>e.chapters),t=Q(e=>e.currentTime),n=Q(e=>e.requestSeek),r=Q(),i=b(()=>gy(e),[e]),a=b(()=>{if(typeof t!=`number`)return;let n=e.findIndex((e,n)=>i[n]!==void 0&&e.start-eb<=t&&t<e.end),r=n>=0?i[n]:void 0;return r?{kind:r,end:e[n].end}:void 0},[e,i,t]),s=o(0),[c,l]=h(0);m(()=>{let e=typeof t==`number`?t:0,n=s.current;s.current=e,e<n-nb&&l(e=>e+1)},[t]);let[u,d]=h(!1),f=a?`${a.kind}@${a.end}`:``;return m(()=>{if(!f){d(!1);return}d(!0);let e=setTimeout(()=>d(!1),tb);return()=>clearTimeout(e)},[f,c]),m(()=>{a||d(!1)},[a]),a?P(`div`,{css:ib,className:u?`show`:``,children:P(`button`,{type:`button`,className:`skip-chapter`,onClick:()=>{d(!1),n?n(a.end):r.seek(a.end)},children:rb[a.kind]})}):null},ob=3e3,sb=D`
1174
+ position: absolute;
1175
+ inset: 0;
1176
+ z-index: 2;
1177
+ /* Never eats a click: click-to-pause still reaches the video underneath, and an item that needs a
1178
+ pointer (a tooltip anchor, a button) sets \`pointer-events: auto\` on itself. */
1179
+ pointer-events: none;
1180
+ /* visibility, not only opacity: an item that took pointer events back would otherwise stay
1181
+ hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
1182
+ not, and transitioning it holds the item on screen for the length of the fade. */
1183
+ transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
1184
+ `,cb=D`
1185
+ position: relative;
1186
+ background-color: black;
1187
+ display: flex;
1188
+ justify-content: center;
1189
+ align-items: center;
1190
+ height: 100%;
1191
+ width: 100%;
1192
+
1193
+ & > div:not(:last-of-type) {
1194
+ position: absolute;
1195
+ z-index: 2;
1196
+ }
1197
+
1198
+ /* The subtitle layer sits UNDER the title and the spinner, where the canvas itself used to sit.
1199
+ As a plain child div it is matched by the rule above and raised to the overlay items' level,
1200
+ which paints subtitles over the title's gradient, over the spinner and over the error text.
1201
+ Naming the type as well is what takes it back: :not() carries the specificity of its argument,
1202
+ so the rule above is (0,2,1) and a bare .subtitles at (0,2,0) loses to it whatever the source
1203
+ order, while div.subtitles ties at (0,2,1) and second place in the same block then wins.
1204
+ subtitle-layering.browser.test.tsx measures the computed value rather than trusting this. */
1205
+ & > div.subtitles {
1206
+ inset: 0;
1207
+ z-index: 1;
1208
+ pointer-events: none;
1209
+ }
1210
+
1211
+ canvas {
1212
+ height: 100%;
1213
+ width: 100%;
1214
+ pointer-events: none;
1215
+ position: absolute;
1216
+ z-index: 1;
1217
+ }
1218
+
1219
+ .video, video {
1220
+ height: 100%;
1221
+ width: 100%;
1222
+ background-color: black;
1223
+ object-fit: contain;
1224
+ }
1225
+
1226
+ &.hide {
1227
+ cursor: none;
1228
+ }
1229
+ `,lb=(e,t=``)=>i.toArray(e).flatMap((e,n)=>{let r=`${t}${d(e)&&e.key!=null?e.key:n}`;return d(e)&&e.type===j?lb(e.props.children,`${r}/`):[{key:r,item:e}]}),ub=({ref:e,onVideoRef:t,onSubtitleRef:n,overlay:r,controls:i,children:a})=>{let s=Q(),c=Q(e=>e.hideUI),l=Q(e=>e.setHideUI),u=Q(e=>e.hasMedia),d=o(void 0),f=o(`mouse`),p=o({x:-1,y:-1}),h=o(null);m(()=>()=>clearTimeout(d.current),[]),m(()=>{u||(clearTimeout(d.current),l(!1))},[u,l]);let g=()=>{u&&l(!0)},_=t=>{h.current=t,typeof e==`function`?e(t):e&&(e.current=t)},v=()=>{if(f.current!==`mouse`)return!1;let{x:e,y:t}=p.current;if(!h.current||e<0)return!1;let n=document.elementFromPoint(e,t);return!!n&&h.current.contains(n)&&!n.closest(`.video`)},b=()=>{if(v()){d.current=setTimeout(b,ob);return}g()},x=()=>{l(!1),clearTimeout(d.current),d.current=setTimeout(b,ob)};return y(`div`,{css:cb,ref:_,onPointerMove:e=>{f.current=e.pointerType,e.pointerType===`mouse`&&(p.current={x:e.clientX,y:e.clientY},x())},onPointerDown:e=>{f.current=e.pointerType},onMouseOut:e=>{let t=e.relatedTarget;if(t&&e.currentTarget.contains(t))return;let{left:n,right:r,top:i,bottom:a}=e.currentTarget.getBoundingClientRect();e.clientX>=n&&e.clientX<r&&e.clientY>=i&&e.clientY<a||(clearTimeout(d.current),g())},className:c?`hide`:``,children:[P(Fv,{onSubtitleRef:n}),lb(r).map(({key:e,item:t})=>P(`div`,{css:sb,style:{...c?{opacity:`0`,visibility:`hidden`,pointerEvents:`none`}:{}},children:t},e)),i===!1?null:P(Xy,{}),P($y,{}),P(ab,{}),y(`div`,{className:`video`,onClick:()=>{if(f.current===`mouse`){s.togglePaused();return}c?x():(clearTimeout(d.current),g())},children:[t?P(`video`,{ref:t,playsInline:!0}):null,a]})]})},db=({options:e,children:t})=>{let n=`media`in e?e:null,r=n?null:e,{title:i,chapters:a}=e,{size:s,downloadedRanges:c,publicPath:l,libavWorkerUrl:u,read:d,thumbnailRead:f,thumbnailsEnabled:p}=r??{},g=wl(),_=Tl(),[v,y]=h(null),[b,x]=h(null),S=n?.media??v;m(()=>(g?.(S),()=>g?.(null)),[S,g]);let{expose:C}=e,w=C===!0?{}:C||void 0,T=o(w);T.current=w;let E=w?w.id:void 0,D=w?w.origin:void 0,O=w?w.channel:void 0;m(()=>{if(!C||!S)return;let e,t=!1;return I(async()=>{let{exposePlayer:e}=await import(`./remote-VQoP8ehb.js`);return{exposePlayer:e}},__vite__mapDeps([0,1,2]),import.meta.url).then(({exposePlayer:n})=>{t||(e=n(S,T.current??{}))}).catch(()=>{}),()=>{t=!0,e?.()}},[S,!!C,E,D,O]),wv(v,b,r);let{thumbnails:k,requestThumbnail:A}=Dv({publicPath:l,workerUrl:u,length:p===!1?void 0:s,read:f??d,downloadedRanges:c}),j=n?.thumbnails?.all??k,{toggle:ee,mode:te,burnedIn:M}=Ov(v,b),N=Q(e=>e.setSourceState),F=n?!!n.media:s!==void 0;m(()=>{N({title:i,size:s,downloadedRanges:c,hasMedia:F})},[N,i,s,c,F]);let L=n?.thumbnails?.at;m(()=>{N({thumbnails:j,thumbnailAt:L,requestThumbnail:A,togglePictureInPicture:ee,pictureInPictureMode:te,burnedInSubtitles:M})},[N,j,L,A,ee,te,M]);let R=n?.subtitles?.selection,z=n?.audioTracks?.selection;return m(()=>{R&&N({subtitleTracks:R.options.map(({id:e,label:t,disabled:n})=>({id:e,label:t,disabled:n})),selectedSubtitleTrack:R.selectedId??void 0,selectSubtitleTrack:e=>R.select(e==null?null:String(e)),subtitleOffLabel:R.offLabel})},[N,R]),m(()=>{z&&N({audioTracks:z.options.map(({id:e,label:t,disabled:n})=>({id:e,label:t,disabled:n})),selectedAudioTrack:z.selectedId??void 0,selectAudioTrack:e=>z.select(String(e))})},[N,z]),m(()=>{a&&N({chapters:a})},[N,a]),P(ub,{ref:_,onVideoRef:n?void 0:y,onSubtitleRef:x,overlay:e.overlay,controls:e.controls,children:t})},fb=D`
1230
+ /**
1231
+ * The chrome's whole scale, in one place.
1232
+ *
1233
+ * Everything inside is sized against this rather than against \`rem\`, because \`rem\` is root
1234
+ * relative and a library cannot own the host page's root font. The old contract was that the host
1235
+ * set \`html { font-size: 62.5% }\`, which silently rendered every control 1.6x too large in any app
1236
+ * that did not, and could not be met by an app whose own screens are sized against the default.
1237
+ * Override it on the player element to rescale the whole chrome.
1238
+ */
1239
+ --mp-unit: 10px;
1240
+
1241
+ /**
1242
+ * The chrome's own typeface, for exactly the reason the unit above exists.
1243
+ *
1244
+ * \`font-family\` inherits, and this library declared it nowhere, so every label drew in whatever the
1245
+ * embedding document happened to set, and in the UA's serif where it set nothing. Not hypothetical:
1246
+ * stub mounts the player in a second document, \`embed.html\`, which sets no font and loads no face,
1247
+ * and the entire settings menu came out in Times New Roman.
1248
+ *
1249
+ * Named faces only, no bundled webfont. The chrome is a handful of short labels, so a font request
1250
+ * on the critical path of a document whose job is to paint video buys a round trip and a flash of
1251
+ * unstyled text for nothing.
1252
+ *
1253
+ * Read through \`var()\` so a host with a brand face sets \`--mp-font-family\` on any ancestor and it
1254
+ * inherits in. A bare \`font-family\` on the host can no longer reach the chrome: this declaration is
1255
+ * on the player element itself and beats anything inherited.
1256
+ */
1257
+ font-family: var(
1258
+ --mp-font-family,
1259
+ system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif,
1260
+ 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji'
1261
+ );
1262
+
1263
+ /**
1264
+ * The chrome's default ink, same argument again.
1265
+ *
1266
+ * Most text here names its own colour, but the two time readouts do not: the elapsed/duration pair
1267
+ * and the seekbar's hover time carry a font token and a black text-shadow and nothing else.
1268
+ * Inherited from a host that declares none that resolves to \`canvastext\`, which is black text under
1269
+ * a black halo on a dark gradient.
1270
+ */
1271
+ color: #fff;
1272
+
1273
+ /**
1274
+ * The settings menu scrolls, and a UA that has not been told the surface is dark paints that
1275
+ * scrollbar in its light theme: a white track down the side of a #1c1c1c menu. Declared here rather
1276
+ * than asked of the host, so it reaches the menu and nothing outside the player.
1277
+ */
1278
+ color-scheme: dark;
1279
+
1280
+ /**
1281
+ * The other half of owning the chrome's own scale.
1282
+ *
1283
+ * Every control here is authored against a border box, which this library's dev app sets globally
1284
+ * and a host page has no reason to. Shipped without it, anything that is \`width: 100%\` AND carries
1285
+ * padding overflows its own box: the top bar ran 32px past the player and clipped the right end of
1286
+ * whatever the app had put there. Scoped to the player's subtree so it cannot reach the host's
1287
+ * layout, and only \`box-sizing\`, because zeroing margins here would reach the app's own content.
1288
+ */
1289
+ &, & *, & *::before, & *::after {
1290
+ box-sizing: border-box;
1291
+ }
1292
+
1293
+ display: flex;
1294
+ justify-content: center;
1295
+ background-color: #111;
1296
+ height: 100%;
1297
+ width: 100%;
1298
+ overflow: hidden;
1299
+ `,pb=e=>P(`div`,{css:fb,children:P(pv.Provider,{children:P(db,{options:e,children:e.children})})}),mb=({menu:e,section:t,option:n,sectionIndex:r})=>[...[...document.querySelectorAll(e)].flatMap(e=>[...e.querySelectorAll(t)])[r]?.querySelectorAll(n)??[]].map(e=>({label:e.getAttribute(`aria-label`)??``,selected:e.getAttribute(`aria-checked`)===`true`,disabled:e.getAttribute(`aria-disabled`)===`true`})),hb=async({button:e,timeout:t})=>{let n=Date.now()+t,r=document.querySelector(e);for(;!r&&Date.now()<n;)await new Promise(e=>setTimeout(e,100)),r=document.querySelector(e);if(!r)throw Object.assign(Error(`Crunchyroll track button is not on the page`),{name:`CrunchyrollControlMissingError`});let i=r.getBoundingClientRect(),a={bubbles:!0,cancelable:!0,composed:!0,clientX:i.left+i.width/2,clientY:i.top+i.height/2,button:0},o={...a,pointerType:`mouse`,pointerId:1,isPrimary:!0};r.dispatchEvent(new PointerEvent(`pointerdown`,{...o,buttons:1})),r.dispatchEvent(new MouseEvent(`mousedown`,{...a,buttons:1})),r.dispatchEvent(new PointerEvent(`pointerup`,{...o,buttons:0})),r.dispatchEvent(new MouseEvent(`mouseup`,{...a,buttons:0})),r.dispatchEvent(new MouseEvent(`click`,{...a,buttons:0}))},gb=({menu:e,section:t,option:n,sectionIndex:r,optionIndex:i})=>{let a=[...document.querySelectorAll(e)].flatMap(e=>[...e.querySelectorAll(t)])[r]?.querySelectorAll(n)[i];if(!a)throw Object.assign(Error(`Crunchyroll track option ${i} is not in the menu`),{name:`CrunchyrollControlMissingError`});let o=a.getBoundingClientRect(),s={bubbles:!0,cancelable:!0,composed:!0,clientX:o.left+o.width/2,clientY:o.top+o.height/2,button:0},c={...s,pointerType:`mouse`,pointerId:1,isPrimary:!0};a.dispatchEvent(new PointerEvent(`pointerdown`,{...c,buttons:1})),a.dispatchEvent(new MouseEvent(`mousedown`,{...s,buttons:1})),a.dispatchEvent(new PointerEvent(`pointerup`,{...c,buttons:0})),a.dispatchEvent(new MouseEvent(`mouseup`,{...s,buttons:0})),a.dispatchEvent(new MouseEvent(`click`,{...s,buttons:0}))},_b=async({timeline:e,time:t,timeout:n})=>{let r=Date.now()+n,i=document.querySelector(e);for(;!i&&Date.now()<r;)await new Promise(e=>setTimeout(e,100)),i=document.querySelector(e);if(i?.tagName!==`INPUT`)throw Object.assign(Error(`Crunchyroll timeline is not on the page`),{name:`CrunchyrollControlMissingError`});let a=i,o=Number(a.min||0),s=Number(a.max||100),c=a.getBoundingClientRect(),l=Math.max(0,Math.min(1,(t-o)/(s-o))),u={bubbles:!0,cancelable:!0,composed:!0,clientX:c.left+c.width*l,clientY:c.top+c.height/2,button:0},d={...u,pointerType:`mouse`,pointerId:1,isPrimary:!0},f=a.type===`range`&&Number.isFinite(o)&&Number.isFinite(s)&&s>o;f&&(a.dispatchEvent(new PointerEvent(`pointerdown`,{...d,buttons:1})),a.dispatchEvent(new MouseEvent(`mousedown`,{...u,buttons:1}))),a._valueTracker?.setValue(``),Object.getOwnPropertyDescriptor(Object.getPrototypeOf(a),`value`).set.call(a,String(t)),a.dispatchEvent(new Event(`input`,{bubbles:!0})),f&&(a.dispatchEvent(new PointerEvent(`pointerup`,{...d,buttons:0})),a.dispatchEvent(new MouseEvent(`mouseup`,{...u,buttons:0}))),a.dispatchEvent(new Event(`change`,{bubbles:!0}))},vb=`[data-testid="track-selection-button"]`,yb=`[data-testid="audio-text-track-menu"]`,bb=`.timeline-slider`,xb=`[role="menu"]`,Sb=`[role="menuitemradio"]`,Cb=1e4,wb=2e4,Tb=5e3,Eb=100,Db={menu:yb,section:xb,option:Sb},Ob=/^(off|none|disabled)$/i,kb=e=>new Promise(t=>setTimeout(t,e)),Ab=()=>!1,jb=e=>{if(e())throw Error(`Crunchyroll track operation cancelled`)},Mb=e=>e===`audio`?0:1,Nb=e=>e.replace(/\s+/g,` `).trim(),Pb=(e,t)=>{let n=[...new Map(t.map(e=>({...e,label:Nb(e.label)})).filter(e=>e.label).map(e=>[e.id,e])).values()],r=n.find(e=>e.selected);if(!r)return;let i=e===`subtitles`?n.find(e=>Ob.test(e.label)):void 0,a=n.filter(e=>e!==i).map(e=>({id:e.id,label:e.label,disabled:e.disabled||void 0}));if(!(a.length<2&&!i)&&a.length)return{options:a,selectedId:r===i?null:r.id,...i?{offLabel:i.label}:{}}},Fb=async(e,t)=>{jb(t);let n=e.locator(yb);if(await n.exists({timeout:1e3})){jb(t);return}jb(t),await e.evaluate(hb,{button:vb,timeout:Cb});let r=Date.now()+Cb;for(;Date.now()<r;){if(jb(t),await n.exists({timeout:1e3}))return;await kb(Eb)}throw Error(`Crunchyroll track menu did not open`)},Ib=async(e,t,n)=>{jb(n);let r=await e.evaluate(mb,{...Db,sectionIndex:Mb(t)});jb(n);let i=r.map((e,t)=>({...e,label:Nb(e.label),index:t})),a=new Map;for(let e of i)a.set(e.label,(a.get(e.label)??0)+1);let o=new Map;return i.map(e=>{let t=(o.get(e.label)??0)+1;return o.set(e.label,t),{...e,id:a.get(e.label)===1?e.label:`${e.label}#${t}`}})},Lb=async(e,t)=>{let[n,r]=await Promise.all([Ib(e,`audio`,t),Ib(e,`subtitles`,t)]);return{audio:Pb(`audio`,n),subtitles:Pb(`subtitles`,r)}},Rb=async(e,t=Ab)=>(await Fb(e,t),Lb(e,t)),zb=async(e,t,n,r)=>(await Ib(e,t,r)).find(e=>n===null?Ob.test(e.label):e.id===n)?.index??-1,Bb=async(e,t,n,r)=>{let i=Date.now()+wb;for(;Date.now()<i;){jb(r),await Fb(e,r);let i=(await Ib(e,t,r)).find(e=>e.selected);if(i&&(n===null?Ob.test(i.label):i.id===n))return;await kb(Eb)}throw Error(`Crunchyroll did not apply the ${t} option`)},Vb=(e,t)=>{let n=Number.isFinite(e)?Math.max(0,e):0;return!Number.isFinite(t)||t<=0?n:Math.min(n,Math.max(0,t-.1))},Hb=e=>({currentTime:e.currentTime,paused:e.paused,volume:e.volume,muted:e.muted,playbackRate:e.playbackRate}),Ub=(e,t)=>e.evaluate(_b,{timeline:bb,time:t,timeout:wb}),Wb=async(e,t,n)=>{let r=Date.now()+5e3;for(;Date.now()<r&&(jb(n),!(e.currentSrc!==t||e.readyState<2));)await kb(Eb);if(e.currentSrc===t&&e.readyState>=2)return!1;let i=Date.now()+wb;for(;Date.now()<i;){if(jb(n),e.readyState>=2)return!0;await kb(Eb)}throw Error(`Crunchyroll playback did not become ready after changing tracks`)},Gb=async(e,t,n,r)=>{jb(r),t.volume=n.volume,t.muted=n.muted,t.playbackRate=n.playbackRate;let i=Vb(n.currentTime,t.duration);Math.abs(t.currentTime-i)>2&&await Ub(e,i);let a=Date.now()+wb;for(;Date.now()<a&&(Math.abs(t.currentTime-i)>2||t.seeking||t.readyState<2);)jb(r),await kb(Eb);if(Math.abs(t.currentTime-i)>2||t.seeking||t.readyState<2)throw Error(`Crunchyroll playback position was not restored after changing tracks`);jb(r),n.paused?t.pause():await t.play();let o=Date.now()+Tb;for(;Date.now()<o&&t.paused!==n.paused;)jb(r),await kb(Eb);if(t.paused!==n.paused)throw Error(`Crunchyroll playback state was not restored after changing tracks`)},Kb=async(e,t,n,r,i=Ab)=>{await Fb(e,i);let a=await zb(e,n,r,i);if(a<0)throw Error(`Crunchyroll ${n} option is no longer available`);jb(i);let o=t.currentSrc,s=Hb(t);return await e.evaluate(gb,{...Db,sectionIndex:Mb(n),optionIndex:a}),await Bb(e,n,r,i),await Wb(t,o,i)&&await Gb(e,t,s,i),Rb(e,i)},qb=(e,t)=>{Ub(e,t).catch(e=>console.warn(`[cr] timeline seek failed:`,e))},Jb=(e,t)=>new Proxy(e,{set(e,n,r,i){return n===`currentTime`&&typeof r==`number`&&Number.isFinite(r)&&qb(t,r),Reflect.set(e,n,r,i)}}),Yb=({remote:e,frame:t,subtitles:n,audioTracks:r,thumbnails:i,chapters:a,children:o})=>{let s=b(()=>e&&t?Jb(e,t):null,[e,t]);return P(pb,{expose:!0,media:s,subtitles:n,audioTracks:r,thumbnails:i,chapters:a,children:o})},Xb=class extends Error{name=`BifParseError`},Zb=[137,66,73,70,13,10,26,10],Qb=64,$b=8,ex=4294967295,tx=36e3,nx=e=>{if(e.byteLength<Qb)throw new Xb(`truncated header: ${e.byteLength} bytes`);let t=new DataView(e);if(Zb.some((e,n)=>t.getUint8(n)!==e))throw new Xb(`bad magic`);let n=t.getUint32(12,!0),r=t.getUint32(16,!0)||1e3;if(n>tx)throw new Xb(`implausible frame count ${n}`);let i=Qb+(n+1)*$b;if(i>e.byteLength)throw new Xb(`truncated index: ${n} frames need ${i} bytes, have ${e.byteLength}`);let a=e=>t.getUint32(Qb+e*$b,!0),o=e=>t.getUint32(Qb+e*$b+4,!0);if(a(n)!==ex)throw new Xb(`the index does not end on the 0xffffffff entry`);let s=[];for(let t=0;t<n;t+=1){let c=o(t),l=o(t+1);if(c<i||l<=c||l>e.byteLength)throw new Xb(`image ${t} spans ${c}..${l}, outside ${i}..${e.byteLength}`);let u=a(t),d=t+1===n;if(!d&&a(t+1)<=u)throw new Xb(`timestamps do not increase at image ${t}`);s.push({start:u*r,end:d?1/0:a(t+1)*r,bytes:new Uint8Array(e,c,l-c)})}return s},rx=(e,t)=>{if(!e.length||!Number.isFinite(t))return;let n=0,r=e.length-1;for(;n<r;){let i=Math.ceil((n+r)/2);e[i].start<=t?n=i:r=i-1}return e[n]},ix=async({waitMs:e,fetchMs:t,maxBytes:n})=>{let r=/^(?:https?:\/\/|\/)\S*\.bif(?:[?#]\S*)?$/i,i=e=>typeof e==`string`&&e.length<8192&&e.includes(`.bif`)&&r.test(e),a=(e,t)=>{try{return e?.[t]}catch{return}},o=e=>{let t=Object.keys(e).find(e=>e.startsWith(`__reactFiber$`)||e.startsWith(`__reactInternalInstance$`));return t?a(e,t):void 0},s=e=>{let t=[],n=new Set,r=[e,...Array.from(e.querySelectorAll(`*`)).slice(0,3e3)];for(let e of r){let r=o(e);for(let e=0;r&&e<40&&!n.has(r);e+=1){n.add(r);let e=a(a(r,`memoizedProps`),`value`);e&&typeof e==`object`&&t.push(e),r=a(r,`return`)}}return t},c=e=>{let t=new Set,n=e,r=0;for(let e=0;e<=8&&n.length;e+=1){let e=[];for(let o of n){if(t.has(o))continue;if(t.add(o),r+=1,r>2e4)return;let n;try{n=Object.keys(o).slice(0,500)}catch{continue}for(let t of n){let n=a(o,t);if(i(n))return n;n&&typeof n==`object`&&(n===window||typeof a(n,`nodeType`)==`number`||ArrayBuffer.isView(n)||n instanceof ArrayBuffer||e.push(n))}}n=e}},l=e=>{let t=[];for(let n of e){let e=a(a(n,`volumeVM`),`_player`);if(!e||typeof e!=`object`)continue;let r=a(a(a(e,`playerOrchestrator`),`thumbnailOrchestrator`),`_currentBifUrl`);if(i(r))return{url:r,via:`named`};t.push(e)}let n=c(t.length?t:e);return n?{url:n,via:`search`}:void 0},u=async(e,r)=>{let i=new AbortController,a=setTimeout(()=>i.abort(),t);try{let t=await fetch(e,{signal:i.signal});if(!t.ok)return{none:`fetch-failed`,detail:`HTTP ${t.status}`};let a=Number(t.headers.get(`content-length`));if(a>n)return{none:`too-large`,detail:`${a} bytes`};let o=await t.arrayBuffer();return o.byteLength>n?{none:`too-large`,detail:`${o.byteLength} bytes`}:{bytes:o,via:r}}catch(e){return{none:`fetch-failed`,detail:String(e)}}finally{clearTimeout(a)}};try{let t=Date.now()+e,n=!1;for(;;){let e=document.querySelector(`.video-player-wrapper`);if(e?.querySelector(`video`)){n=!0;let t=l(s(e));if(t)return await u(t.url,t.via)}if(Date.now()>=t)return{none:n?`no-bif`:`no-player`};await new Promise(e=>setTimeout(e,500))}}catch(e){return{none:`failed`,detail:String(e)}}},ax={waitMs:1e4,fetchMs:15e3,maxBytes:31457280},ox=e=>{let t=new Map,n=!1;return{at:r=>{if(n)return;let i=rx(e,r*1e3);if(!i)return;let a=t.get(i);return a||(a={url:URL.createObjectURL(new Blob([i.bytes],{type:`image/jpeg`})),startTime:i.start/1e3,endTime:i.end/1e3},t.set(i,a)),a},dispose:()=>{n=!0;for(let{url:e}of t.values())URL.revokeObjectURL(e);t.clear()}}},sx=async e=>{let t=await e.evaluate(ix,ax);if(`none`in t)throw Error(`no BIF: ${t.none}${t.detail?` (${t.detail})`:``}`);let n=nx(t.bytes);if(!n.length)throw Error(`no BIF: the file has no images`);return ox(n)};l();var cx=e=>`https://static.crunchyroll.com/skip-events/production/${e}.json`,lx=e=>{try{return new URL(e).pathname.match(/\/watch\/([A-Z0-9]+)(?:\/|$)/)?.[1]}catch{return}},ux=[[`intro`,`Opening`],[`recap`,`Recap`],[`credits`,`Ending`],[`preview`,`Preview`]],dx=`Episode`,fx=e=>typeof e==`object`&&!!e&&!Array.isArray(e),px=(e,t)=>{if(!fx(e))return[];let n=t!==void 0&&Number.isFinite(t)&&t>0?t:1/0,r=ux.flatMap(([t,r])=>{let i=e[t];if(!fx(i))return[];let{start:a,end:o}=i;if(typeof a!=`number`||typeof o!=`number`||!Number.isFinite(a)||!Number.isFinite(o))return[];let s={start:Math.max(0,a),end:Math.min(o,n),title:r};return s.end>s.start?[s]:[]}).sort((e,t)=>e.start-t.start),i=[],a=0;for(let e of r){let t=Math.max(e.start,a);e.end<=t||(t>a&&i.push({start:a,end:t,title:dx}),i.push({start:t,end:e.end,title:e.title}),a=e.end)}return i.length&&n!==1/0&&a<n&&i.push({start:a,end:n,title:dx}),i},mx=new Set([403,404]),hx=async(e,t=ie)=>{let n=await t(cx(e));if(!n.ok){if(await n.body?.cancel().catch(()=>{}),mx.has(n.status))return{};throw Error(`${cx(e)} answered ${n.status}`)}return n.json()},gx=e=>{let[t,n]=h();return m(()=>{if(n(e?.duration),!e)return;let t=()=>n(e.duration);return e.addEventListener(`durationchange`,t),e.addEventListener(`loadedmetadata`,t),()=>{e.removeEventListener(`durationchange`,t),e.removeEventListener(`loadedmetadata`,t)}},[e]),t},_x=[],vx=(e,t)=>{let n=lx(e),[r,i]=h(),a=gx(t);return m(()=>{if(!n)return;let e=!1;return hx(n).then(t=>{e||i({episodeId:n,events:t})},t=>{e||console.warn(`[cr] skip events unavailable:`,t)}),()=>{e=!0}},[n]),b(()=>{if(!r||r.episodeId!==n)return _x;let e=px(r.events,a);return e.length?e:_x},[r,n,a])};l();var yx=[`www.crunchyroll.com`,`crunchyroll.com`,`sso.crunchyroll.com`,`static.crunchyroll.com`],bx=`
1300
+ html, body {
1301
+ margin: 0 !important;
1302
+ padding: 0 !important;
1303
+ width: 100% !important;
1304
+ height: 100% !important;
1305
+ background: #000 !important;
1306
+ }
1307
+ *:not(:has(.video-player-wrapper)):not(.video-player-wrapper):not(.video-player-wrapper *) {
1308
+ display: none !important;
1309
+ }
1310
+ div[data-testid="player-controls-root"] {
1311
+ display: none !important;
1312
+ }
1313
+ .video-player-wrapper,
1314
+ .video-player,
1315
+ .player-container,
1316
+ .video-player-wrapper > *,
1317
+ .video-player > *,
1318
+ .player-container > * {
1319
+ position: absolute !important;
1320
+ inset: 0 !important;
1321
+ width: 100% !important;
1322
+ height: 100% !important;
1323
+ z-index: 9999999;
1324
+ }
1325
+ .video-player-wrapper video,
1326
+ .video-player video,
1327
+ .player-container video {
1328
+ width: 100% !important;
1329
+ height: 100% !important;
1330
+ object-fit: contain !important;
1331
+ }
1332
+ .video-player-wrapper *:not(:has(video)):not(video):not(:has(.timeline-slider)):not(.timeline-slider) {
1333
+ display: none !important;
1334
+ }
1335
+ .timeline-container,
1336
+ .timeline-container *,
1337
+ .timeline-slider {
1338
+ opacity: 0 !important;
1339
+ pointer-events: none !important;
1340
+ }
1341
+ `,xx=`https://sso.crunchyroll.com/authorize?${new URLSearchParams({client_id:`noaihdevm_6iyg0a8l0q`,redirect_uri:`https://www.crunchyroll.com/callback`,response_type:`cookie`,state:`/`})}`,Sx=async e=>{let[t,n]=await Promise.all([e.locator(`.cx-app`).exists(),e.locator(`#recaptcha-container`).exists()]);return t||n},Cx=3e4,wx=async()=>R()?`extension`:(document.readyState!==`complete`&&await new Promise(e=>{let t=()=>{clearTimeout(n),e()},n=setTimeout(()=>{window.removeEventListener(`load`,t),e()},1e4);window.addEventListener(`load`,t,{once:!0})}),await new Promise(e=>setTimeout(e,300)),R()?`extension`:`cloud`),Tx=async(e,t)=>{let n=Date.now()+Cx;for(;!t()&&Date.now()<n;){if(await e.locator(`.shell-header`).exists()){await new Promise(e=>setTimeout(e,100));continue}if(t())throw Error(`Login state check timed out`);let[n,r]=await Promise.all([e.locator(`#user-menu-anonymous`).exists(),e.locator(`#user-menu-authenticated`).exists()]);if(r||n)return{isLoggedIn:r,isLoggedOut:n};await new Promise(e=>setTimeout(e,100))}throw Error(`Login state check timed out`)},Ex=3e4,Dx=async(e,t)=>{let n=Date.now()+Ex;for(;!t()&&Date.now()<n;){try{if(await e.locator(`video`).exists())return t()?null:await e.locator(`video`).videoElement()}catch(e){if(e?.name===`LocatorUnsupportedError`)throw e}await new Promise(e=>setTimeout(e,100))}return null},Ox=s`
1342
+ to { transform: rotate(360deg); }
1343
+ `,kx=D`
1344
+ position: relative;
1345
+ width: 100%;
1346
+ height: 100%;
1347
+ background: #000;
1348
+ /* The double-tap-to-fullscreen gesture otherwise word-selects the
1349
+ skin's labels/time readouts, flashing them blue. Player chrome isn't
1350
+ meant to be selected, so suppress it across the whole player. */
1351
+ user-select: none;
1352
+ -webkit-user-select: none;
1353
+
1354
+ .cr-frame {
1355
+ position: absolute;
1356
+ inset: 0;
1357
+ width: 100%;
1358
+ height: 100%;
1359
+ border: none;
1360
+ background: #000;
1361
+ /* CR's own chrome is hidden, so the iframe must not swallow clicks -
1362
+ taps belong to the videojs gesture layer stacked above it. */
1363
+ pointer-events: none;
1364
+ }
1365
+
1366
+ .overlay {
1367
+ position: absolute;
1368
+ inset: 0;
1369
+ display: flex;
1370
+ flex-direction: column;
1371
+ align-items: center;
1372
+ justify-content: center;
1373
+ gap: 1.6rem;
1374
+ background: #000;
1375
+ font-size: 1.4rem;
1376
+ color: rgba(255, 255, 255, 0.8);
1377
+ /* Above the skin's own layers (its controls/error dialog top out at
1378
+ z-index 20) so the login/loading screen fully covers them. */
1379
+ z-index: 30;
1380
+ }
1381
+
1382
+ .login-button {
1383
+ padding: 0.8rem 2rem;
1384
+ background: #f47521;
1385
+ color: #fff;
1386
+ border: none;
1387
+ border-radius: 0.4rem;
1388
+ font-size: 1.4rem;
1389
+ font-weight: 600;
1390
+ cursor: pointer;
1391
+
1392
+ &:hover {
1393
+ background: #e0651a;
1394
+ }
1395
+
1396
+ &:disabled {
1397
+ opacity: 0.6;
1398
+ cursor: default;
1399
+ }
1400
+ }
1401
+
1402
+ .login-note {
1403
+ max-width: 36rem;
1404
+ font-size: 1.2rem;
1405
+ text-align: center;
1406
+ color: rgba(255, 255, 255, 0.6);
1407
+ }
1408
+
1409
+ /* @banou/media-player's own buffering spinner (overlay.tsx), same box and centre, so when the video
1410
+ arrives still buffering the player's spinner takes over from this one without a jump */
1411
+ .loading-spinner {
1412
+ box-sizing: border-box;
1413
+ width: calc(4 * var(--mp-unit, 10px));
1414
+ height: calc(4 * var(--mp-unit, 10px));
1415
+ border-radius: 50%;
1416
+ border: 3px solid rgba(255, 255, 255, 0.25);
1417
+ border-top-color: #fff;
1418
+ animation: ${Ox} 0.8s linear infinite;
1419
+ }
1420
+ `,Ax=({url:e})=>{let[t,n]=h(`detecting`),[r,i]=h(null),[a,s]=h(null),[c,l]=h(!0),[u,d]=h(!1),[f,g]=h(),[_,v]=h(null),[x,S]=h(0),[C,w]=h(0),[T,E]=h(!1),[D,k]=h(!1),A=o(null),j=o(null),[ee,te]=h(!1),M=o(!1),[N,F]=h(),[I,L]=h(),ne=vx(e,_),re=o(0),ie=o({generation:0,tail:Promise.resolve()}),B=o(!0),ae=p(()=>{let e=re.current+1;return re.current=e,ie.current={generation:e,tail:Promise.resolve()},F(void 0),e},[]),oe=p((e,t)=>{if(ie.current.generation!==e)return Promise.reject(Error(`Crunchyroll track operation cancelled`));let n=ie.current,r=n.tail.then(t);return n.tail=r.then(()=>{},()=>{}),r},[]);m(()=>()=>{B.current=!1,re.current+=1},[]),m(()=>{let e=!1;return wx().then(t=>{e||n(t)}),()=>{e=!0}},[]),m(()=>{if(!r||t===`detecting`)return;let e=!1;return z({iframe:r,domains:yx,permissions:[{category:`evaluation`,reason:`Switch Crunchyroll audio and subtitles, seek the video, and show the seek preview thumbnails`}]}).then(r=>{if(e)return;let i=R()?`extension`:`cloud`;if(i!==t){n(i);return}s(r)}).catch(t=>{e||(console.error(`Failed to attach Crunchyroll frame`,t),g(t?.message||`Failed to load player`),l(!1))}),()=>{e=!0}},[r,t]),m(()=>{if(!a)return;let n=!1,r=()=>n;return l(!0),g(void 0),d(!1),v(null),ae(),(async()=>{if(t===`cloud`){if(await a.goto(e,{waitUntil:`documentstart`}),n)return;let{isLoggedIn:t}=await Tx(a,r);if(n)return;if(!t){l(!1),d(!0);return}if(await a.addStyleTag({content:bx}),n)return;let i=await Dx(a,r);if(n)return;if(l(!1),!i)throw Error(`The episode did not load a player. It may be unavailable or require a different plan.`);v(i);return}if(await a.goto(e,{waitUntil:`documentstart`}),n||(await a.addStyleTag({content:bx}),n))return;let{isLoggedIn:i}=await Tx(a,r);if(n)return;if(!i){l(!1),d(!0);return}let o=await Dx(a,r);if(!n){if(l(!1),!o)throw Error(`The episode did not load a player. It may be unavailable or require a different plan.`);v(o)}})().catch(e=>{n||(console.error(`Failed to load Crunchyroll player`,e),g(e?.message||`Failed to load player`),l(!1))}),()=>{n=!0}},[a,e,x,t,ae]),m(()=>{if(!a||!_)return;let e=ae(),t=!1,n=()=>t||!B.current||e!==re.current;return(async()=>{let t,r;for(let i=0;i<5&&!n();i+=1){try{if(r=await oe(e,()=>Rb(a,n)),t=void 0,n()||(F(r),r.audio&&r.subtitles))return}catch(e){t=e}await new Promise(e=>setTimeout(e,500))}if(!r&&t)throw t})().then(()=>{},e=>{n()||console.warn(`[cr] track discovery failed:`,e)}),()=>{t=!0}},[a,_,ae,oe]),m(()=>{if(!a||!_)return;let e=!1,t;return sx(a).then(n=>{if(e)return n.dispose();t=n,L(n)},t=>{e||console.warn(`[cr] seek thumbnails unavailable:`,t)}),()=>{e=!0,t?.dispose(),L(void 0)}},[a,_]);let se=re.current,ce=p((e,t)=>{if(!a||!_)return Promise.reject(Error(`Crunchyroll player is not ready`));let n=()=>!B.current||se!==re.current;return oe(se,async()=>{try{let r=await Kb(a,_,e,t,n);if(n())throw Error(`Crunchyroll track operation cancelled`);F(r)}catch(e){if(!n())try{let e=await Rb(a,n);n()||F(e)}catch{}throw e}})},[a,_,oe,se]),ue=b(()=>N?.subtitles&&{selection:{...N.subtitles,select:e=>ce(`subtitles`,e)}},[N?.subtitles,ce]),de=b(()=>N?.audio&&{selection:{...N.audio,select:e=>ce(`audio`,e)}},[N?.audio,ce]),fe=p(()=>{if(A.current!==null)return;let e=globalThis.open(xx,`_blank`,`width=500,height=700`);if(!e){k(!0),l(!1);return}k(!1),E(!0),j.current=e;let t=setInterval(()=>{e.closed&&(clearInterval(t),A.current===t&&(A.current=null),j.current===e&&(j.current=null),E(!1),S(e=>e+1))},500);A.current=t},[]),pe=p(()=>{s(null),g(void 0),v(null),ae(),d(!1),l(!0),w(e=>e+1)},[ae]),me=p(()=>{if(M.current)return;M.current=!0;let e=le({url:xx,domains:yx,isSignedIn:e=>e.locator(`#user-menu-authenticated`).exists(),onSignInPage:Sx});k(!1),te(!0),e.then(e=>{if(B.current){if(e===`blocked`){k(!0);return}if(e===`unsupported`){g(`The Crunchyroll sign-in window could not be opened here.`);return}if(e===`authed`){pe();return}d(!1),l(!0),S(e=>e+1)}},e=>{B.current&&(console.error(`Crunchyroll sign-in window failed`,e),g(e?.message||`The sign-in window failed`))}).finally(()=>{M.current=!1,B.current&&te(!1)})},[pe]);m(()=>()=>{A.current!==null&&(clearInterval(A.current),A.current=null)},[]),m(()=>{A.current!==null&&(clearInterval(A.current),A.current=null,E(!1)),k(!1)},[e]);let he=p(()=>{j.current!==null&&(j.current.close(),j.current=null),A.current!==null&&(clearInterval(A.current),A.current=null),k(!1),E(!1),pe()},[pe]),ge=(c||f||D||u)&&y(`div`,{className:`overlay`,children:[u&&!f&&!D&&y(O,{children:[`You need to be logged in to Crunchyroll to watch this content.`,t===`extension`?P(`button`,{className:`login-button`,onClick:fe,disabled:T,children:T?`Finish signing in the popup...`:`Open Crunchyroll Login Page`}):y(O,{children:[P(`button`,{className:`login-button`,onClick:me,disabled:ee,children:ee?`Finish signing in the window...`:`Sign in to Crunchyroll`}),P(`span`,{className:`login-note`,children:`Sign-in happens in a window served through FKN, so your browser will not autofill saved passwords or offer passkeys there.`})]})]}),D&&!f&&y(O,{children:[`The login popup was blocked. Allow popups for this page and try again.`,P(`button`,{className:`login-button`,onClick:t===`extension`?fe:me,children:`Open Crunchyroll Login Page`})]}),f&&y(O,{children:[f,P(`button`,{className:`login-button`,onClick:he,children:`Retry`})]}),c&&!f&&!u&&P(`div`,{className:`loading-spinner`,role:`status`,"aria-label":`Loading`})]});return y(`div`,{css:kx,children:[t!==`detecting`&&P(Yb,{remote:_,frame:a,subtitles:ue,audioTracks:de,thumbnails:I,chapters:ne,children:P(`iframe`,{ref:i,className:`cr-frame`,referrerPolicy:`no-referrer`,allow:`encrypted-media; autoplay; fullscreen;`},`${t}-${C}`)}),ge]})},jx=e=>e,Mx=jx(({className:e,children:t})=>P(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:18,height:18,fill:`none`,"aria-hidden":`true`,className:e,children:t})),Nx=jx(({className:e})=>P(Mx,{className:e,children:P(`path`,{fill:`currentColor`,d:`m14.051 10.723-7.985 4.964a1.98 1.98 0 0 1-2.758-.638A2.06 2.06 0 0 1 3 13.964V4.036C3 2.91 3.895 2 5 2c.377 0 .747.109 1.066.313l7.985 4.964a2.057 2.057 0 0 1 .627 2.808c-.16.257-.373.475-.627.637`})})),Px=jx(({className:e})=>y(Mx,{className:e,children:[P(`rect`,{width:5,height:14,x:2,y:2,fill:`currentColor`,rx:1.75}),P(`rect`,{width:5,height:14,x:11,y:2,fill:`currentColor`,rx:1.75})]})),Fx=jx(({className:e})=>y(Mx,{className:e,children:[P(`path`,{fill:`currentColor`,d:`M9 17a8 8 0 0 1-8-8h2a6 6 0 1 0 1.287-3.713l1.286 1.286A.25.25 0 0 1 5.396 7H1.25A.25.25 0 0 1 1 6.75V2.604a.25.25 0 0 1 .427-.177l1.438 1.438A8 8 0 1 1 9 17`}),P(`path`,{fill:`currentColor`,d:`m11.61 9.639-3.331 2.07a.826.826 0 0 1-1.15-.266.86.86 0 0 1-.129-.452V6.849C7 6.38 7.374 6 7.834 6c.158 0 .312.045.445.13l3.331 2.071a.858.858 0 0 1 0 1.438`})]})),Ix=jx(({className:e})=>P(Mx,{className:e,children:P(`path`,{fill:`currentColor`,d:`M1 9c0 2.21.895 4.21 2.343 5.657l1.414-1.414a6 6 0 1 1 8.956-7.956l-1.286 1.286a.25.25 0 0 0 .177.427h4.146a.25.25 0 0 0 .25-.25V2.604a.25.25 0 0 0-.427-.177l-1.438 1.438A8 8 0 0 0 1 9`})})),Lx=jx(({className:e})=>P(Mx,{className:e,children:P(`path`,{fill:`currentColor`,d:`M.714 6.008h3.072l4.071-3.857c.5-.376 1.143 0 1.143.601V15.28c0 .602-.643.903-1.143.602l-4.071-3.858H.714c-.428 0-.714-.3-.714-.752V6.76c0-.451.286-.752.714-.752M14.5 7.586l-1.768-1.768a1 1 0 1 0-1.414 1.414L13.085 9l-1.767 1.768a1 1 0 0 0 1.414 1.414l1.768-1.768 1.768 1.768a1 1 0 0 0 1.414-1.414L15.914 9l1.768-1.768a1 1 0 0 0-1.414-1.414z`})})),Rx=jx(({className:e})=>P(Mx,{className:e,children:P(`path`,{fill:`currentColor`,d:`M.714 6.008h3.072l4.071-3.857c.5-.376 1.143 0 1.143.601V15.28c0 .602-.643.903-1.143.602l-4.071-3.858H.714c-.428 0-.714-.3-.714-.752V6.76c0-.451.286-.752.714-.752m10.568.59a.91.91 0 0 1 0-1.316.91.91 0 0 1 1.316 0c1.203 1.203 1.47 2.216 1.522 3.208q.012.255.011.51c0 1.16-.358 2.733-1.533 3.803a.7.7 0 0 1-.298.156c-.382.106-.873-.011-1.018-.156a.91.91 0 0 1 0-1.316c.57-.57.995-1.551.995-2.487 0-.944-.26-1.667-.995-2.402`})})),zx=jx(({className:e})=>y(Mx,{className:e,children:[P(`path`,{fill:`currentColor`,d:`M15.6 3.3c-.4-.4-1-.4-1.4 0s-.4 1 0 1.4C15.4 5.9 16 7.4 16 9s-.6 3.1-1.8 4.3c-.4.4-.4 1 0 1.4.2.2.5.3.7.3.3 0 .5-.1.7-.3C17.1 13.2 18 11.2 18 9s-.9-4.2-2.4-5.7`}),P(`path`,{fill:`currentColor`,d:`M.714 6.008h3.072l4.071-3.857c.5-.376 1.143 0 1.143.601V15.28c0 .602-.643.903-1.143.602l-4.071-3.858H.714c-.428 0-.714-.3-.714-.752V6.76c0-.451.286-.752.714-.752m10.568.59a.91.91 0 0 1 0-1.316.91.91 0 0 1 1.316 0c1.203 1.203 1.47 2.216 1.522 3.208q.012.255.011.51c0 1.16-.358 2.733-1.533 3.803a.7.7 0 0 1-.298.156c-.382.106-.873-.011-1.018-.156a.91.91 0 0 1 0-1.316c.57-.57.995-1.551.995-2.487 0-.944-.26-1.667-.995-2.402`})]})),Bx=jx(({className:e})=>P(Mx,{className:e,children:P(`path`,{fill:`currentColor`,d:`M9.57 3.617A1 1 0 0 0 8.646 3H4c-.552 0-1 .449-1 1v4.646a.996.996 0 0 0 1.001 1 1 1 0 0 0 .706-.293l4.647-4.647a1 1 0 0 0 .216-1.089m4.812 4.812a1 1 0 0 0-1.089.217l-4.647 4.647a.998.998 0 0 0 .708 1.706H14c.552 0 1-.449 1-1V9.353a1 1 0 0 0-.618-.924`})})),Vx=jx(({className:e})=>P(Mx,{className:e,children:P(`path`,{fill:`currentColor`,d:`M7.883 1.93a.99.99 0 0 0-1.09.217L2.146 6.793A.998.998 0 0 0 2.853 8.5H7.5c.551 0 1-.449 1-1V2.854a1 1 0 0 0-.617-.924m7.263 7.57H10.5c-.551 0-1 .449-1 1v4.646a.996.996 0 0 0 1.001 1.001 1 1 0 0 0 .706-.293l4.646-4.646a.998.998 0 0 0-.707-1.707z`})})),Hx=jx(({className:e})=>y(Mx,{className:e,children:[P(`path`,{fill:`currentColor`,d:`M13 2a4 4 0 0 1 4 4v2.035A3.5 3.5 0 0 0 16.5 8H15V6.273C15 5.018 13.96 4 12.679 4H4.32C3.04 4 2 5.018 2 6.273v5.454C2 12.982 3.04 14 4.321 14H6v1.5q0 .255.035.5H4a4 4 0 0 1-4-4V6a4 4 0 0 1 4-4z`}),P(`rect`,{width:10,height:7,x:8,y:10,fill:`currentColor`,rx:2}),P(`path`,{fill:`currentColor`,d:`M7.129 5.547a.6.6 0 0 0-.656.13L3.677 8.473A.6.6 0 0 0 4.102 9.5h2.796c.332 0 .602-.27.602-.602V6.103a.6.6 0 0 0-.371-.556`})]})),Ux=jx(({className:e})=>y(Mx,{className:e,children:[P(`path`,{fill:`currentColor`,d:`M13 2a4 4 0 0 1 4 4v2.036A3.5 3.5 0 0 0 16.5 8H15V6.273C15 5.018 13.96 4 12.679 4H4.32C3.04 4 2 5.018 2 6.273v5.454C2 12.982 3.04 14 4.321 14H6v1.5q0 .255.036.5H4a4 4 0 0 1-4-4V6a4 4 0 0 1 4-4z`}),P(`rect`,{width:10,height:7,x:8,y:10,fill:`currentColor`,rx:2}),P(`path`,{fill:`currentColor`,d:`M4.871 10.454a.6.6 0 0 0 .656-.131l2.796-2.796A.6.6 0 0 0 7.898 6.5H5.102a.603.603 0 0 0-.602.602v2.795a.6.6 0 0 0 .371.556`})]})),Wx=jx(({className:e})=>P(Mx,{className:e,children:P(`path`,{fill:`currentColor`,d:`M15 2a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V5a3 3 0 0 1 3-3zM4 11a1 1 0 1 0 0 2h5a1 1 0 1 0 0-2zm8 0a1 1 0 1 0 0 2h2a1 1 0 1 0 0-2zM4 8a1 1 0 0 0 0 2h1a1 1 0 0 0 0-2zm4 0a1 1 0 0 0 0 2h3a1 1 0 1 0 0-2zm6 0a1 1 0 1 0 0 2 1 1 0 0 0 0-2`})})),Gx=jx(({className:e})=>y(Mx,{className:e,children:[P(`rect`,{width:16,height:12,x:1,y:3,stroke:`currentColor`,strokeWidth:2,rx:3}),P(`rect`,{width:3,height:2,x:3,y:8,fill:`currentColor`,rx:1}),P(`rect`,{width:2,height:2,x:13,y:8,fill:`currentColor`,rx:1}),P(`rect`,{width:4,height:2,x:11,y:11,fill:`currentColor`,rx:1}),P(`rect`,{width:5,height:2,x:7,y:8,fill:`currentColor`,rx:1}),P(`rect`,{width:7,height:2,x:3,y:11,fill:`currentColor`,rx:1})]})),Kx=jx(({className:e})=>P(Mx,{className:e,children:y(`g`,{fill:`currentColor`,children:[P(`rect`,{width:2,height:5,x:8,y:.5,opacity:.5,rx:1,children:P(`animate`,{attributeName:`opacity`,begin:`0s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),P(`rect`,{width:2,height:5,x:12.243,y:2.257,opacity:.45,rx:1,transform:`rotate(45 13.243 4.757)`,children:P(`animate`,{attributeName:`opacity`,begin:`0.125s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),P(`rect`,{width:5,height:2,x:12.5,y:8,opacity:.4,rx:1,children:P(`animate`,{attributeName:`opacity`,begin:`0.25s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),P(`rect`,{width:5,height:2,x:10.743,y:12.243,opacity:.35,rx:1,transform:`rotate(45 13.243 13.243)`,children:P(`animate`,{attributeName:`opacity`,begin:`0.375s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),P(`rect`,{width:2,height:5,x:8,y:12.5,opacity:.3,rx:1,children:P(`animate`,{attributeName:`opacity`,begin:`0.5s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),P(`rect`,{width:2,height:5,x:3.757,y:10.743,opacity:.25,rx:1,transform:`rotate(45 4.757 13.243)`,children:P(`animate`,{attributeName:`opacity`,begin:`0.625s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),P(`rect`,{width:5,height:2,x:.5,y:8,opacity:.15,rx:1,children:P(`animate`,{attributeName:`opacity`,begin:`0.75s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),P(`rect`,{width:5,height:2,x:2.257,y:3.757,opacity:.1,rx:1,transform:`rotate(45 4.757 4.757)`,children:P(`animate`,{attributeName:`opacity`,begin:`0.875s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})})]})})),qx=jx(({className:e})=>P(Mx,{className:e,children:P(`path`,{fill:`currentColor`,d:`M9 2a1 1 0 0 1 1 1v12a1 1 0 1 1-2 0V3a1 1 0 0 1 1-1zm4 3a1 1 0 0 1 1 1v6a1 1 0 1 1-2 0V6a1 1 0 0 1 1-1zM5 5a1 1 0 0 1 1 1v6a1 1 0 1 1-2 0V6a1 1 0 0 1 1-1zm8 4a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0v-1a1 1 0 0 1 1-1zM5 9a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0v-1a1 1 0 0 1 1-1z`})})),Jx=jx(({className:e})=>P(Mx,{className:e,children:P(`path`,{fill:`currentColor`,d:`M3 5a1 1 0 0 1 1-1h10a1 1 0 1 1 0 2H4a1 1 0 0 1-1-1zm0 4a1 1 0 0 1 1-1h10a1 1 0 1 1 0 2H4a1 1 0 0 1-1-1zm1 3a1 1 0 1 0 0 2h6a1 1 0 1 0 0-2H4z`})})),Yx=jx(({className:e})=>P(Mx,{className:e,children:P(`path`,{fill:`currentColor`,d:`M14.53 4.53a.75.75 0 0 0-1.06-1.06L7 9.94 4.53 7.47a.75.75 0 0 0-1.06 1.06l3 3a.75.75 0 0 0 1.06 0l7-7z`})}));l();var Xx=10,$=e=>e,Zx=$(wh.Root),Qx=$(_h),$x=$(Mh.Root),eS=$(gh.Popup),tS=$(gh.Title),nS=$(gh.Close),rS=$(Mh.Description),iS=$(Mg.Provider),aS=$(Mg.Root),oS=$(Mg.Trigger),sS=$(Mg.Popup),cS=$($h.Root),lS=$($h.Trigger),uS=$($h.Popup),dS=$(Uh),fS=$(eg),pS=$(Vh),mS=$(Hh),hS=$(Nh),gS=$(Wh),_S=$(_g.Value),vS=$(bg.Root),yS=$(pg.Track),bS=$(pg.Fill),xS=$(pg.Buffer),SS=$(pg.Thumb),CS=$(pg.Value),wS=$(Fg.Root),TS=$(zh),ES=$(Fh),DS=$(Vf),OS=({className:e,...t})=>P(`button`,{type:`button`,className:`media-button media-button--subtle media-button--icon${e?` ${e}`:``}`,...t}),kS=({selection:e,icon:t})=>{let[n,r]=h(!1),[i,a]=h(!1),[o,s]=h(!1);m(()=>s(!1),[e.selectedId]);let c=[...e.offLabel?[{id:null,label:e.offLabel}]:[],...e.options],l=t=>{if(t===e.selectedId){r(!1);return}s(!1),a(!0),Promise.resolve().then(()=>e.onSelect(t)).then(()=>r(!1)).catch(t=>{console.warn(`[player] ${e.label} selection failed:`,t),s(!0)}).finally(()=>a(!1))};return y(cS,{open:n,onOpenChange:e=>r(e),children:[P(lS,{render:P(OS,{className:`media-button--menu${o?` media-button--error`:``}`,"aria-label":e.label}),children:t}),P(uS,{className:`media-surface media-popover media-popover--menu`,children:y(`div`,{className:`stub-menu`,role:`menu`,"aria-label":e.label,children:[P(`div`,{className:`stub-menu__heading`,children:e.label}),c.map(t=>{let n=t.id===e.selectedId;return y(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":n,className:`stub-menu__item${n?` stub-menu__item--active`:``}`,disabled:i||`disabled`in t&&t.disabled,onClick:()=>l(t.id),children:[P(`span`,{className:`stub-menu__check`,children:n?P(Yx,{className:`media-icon`}):null}),P(`span`,{className:`stub-menu__label`,children:t.label}),`description`in t&&t.description?P(`span`,{className:`stub-menu__description`,children:t.description}):null]},t.id??`__off__`)})]})})]})},AS=()=>y(cS,{openOnHover:!0,delay:200,closeDelay:100,side:`top`,children:[P(lS,{render:y(pS,{className:`media-button--mute`,render:P(OS,{}),children:[P(Lx,{className:`media-icon media-icon--volume-off`}),P(Rx,{className:`media-icon media-icon--volume-low`}),P(zx,{className:`media-icon media-icon--volume-high`})]})}),P(uS,{className:`media-surface media-popover media-popover--volume`,children:y(wS,{className:`media-slider`,orientation:`vertical`,thumbAlignment:`edge`,children:[P(yS,{className:`media-slider__track`,children:P(bS,{className:`media-slider__fill`})}),P(SS,{className:`media-slider__thumb media-slider__thumb--persistent`})]})})]}),jS=({capabilities:e,children:t,className:n,...r})=>y(DS,{className:`media-default-skin media-default-skin--video${n?` ${n}`:``}`,...r,children:[t,P(Qx,{render:e=>P(`div`,{...e,className:`media-buffering-indicator`,children:P(`div`,{className:`media-surface`,children:P(Kx,{className:`media-icon`})})})}),P($x,{children:P(eS,{className:`media-error`,children:y(`div`,{className:`media-error__dialog media-surface`,children:[y(`div`,{className:`media-error__content`,children:[P(tS,{className:`media-error__title`,children:`Something went wrong.`}),P(rS,{className:`media-error__description`})]}),P(`div`,{className:`media-error__actions`,children:P(nS,{className:`media-button media-button--primary`,children:`OK`})})]})})}),P(Zx,{className:`media-surface media-controls`,children:y(iS,{children:[y(`div`,{className:`media-button-group`,children:[y(aS,{side:`top`,children:[P(oS,{render:y(dS,{className:`media-button--play`,render:P(OS,{}),children:[P(Fx,{className:`media-icon media-icon--restart`}),P(Nx,{className:`media-icon media-icon--play`}),P(Px,{className:`media-icon media-icon--pause`})]})}),P(sS,{className:`media-surface media-tooltip`})]}),y(aS,{side:`top`,children:[P(oS,{render:P(fS,{seconds:-10,className:`media-button--seek`,render:P(OS,{}),children:y(`span`,{className:`media-icon__container`,children:[P(Ix,{className:`media-icon media-icon--seek media-icon--flipped`}),P(`span`,{className:`media-icon__label`,children:Xx})]})})}),y(sS,{className:`media-surface media-tooltip`,children:[`Seek backward `,Xx,` seconds`]})]}),y(aS,{side:`top`,children:[P(oS,{render:P(fS,{seconds:Xx,className:`media-button--seek`,render:P(OS,{}),children:y(`span`,{className:`media-icon__container`,children:[P(Ix,{className:`media-icon media-icon--seek`}),P(`span`,{className:`media-icon__label`,children:Xx})]})})}),y(sS,{className:`media-surface media-tooltip`,children:[`Seek forward `,Xx,` seconds`]})]})]}),y(`div`,{className:`media-time-controls`,children:[P(_S,{type:`current`,className:`media-time`}),y(vS,{className:`media-slider`,children:[y(yS,{className:`media-slider__track`,children:[P(bS,{className:`media-slider__fill`}),P(xS,{className:`media-slider__buffer`})]}),P(SS,{className:`media-slider__thumb`}),P(`div`,{className:`media-surface media-thumbnail media-slider__preview`,children:P(CS,{type:`pointer`,className:`media-time media-thumbnail__time`})})]}),P(_S,{type:`duration`,className:`media-time`})]}),y(`div`,{className:`media-button-group`,children:[y(aS,{side:`top`,children:[P(oS,{render:P(gS,{className:`media-button--playback-rate`,render:P(OS,{})})}),P(sS,{className:`media-surface media-tooltip`,children:`Toggle playback rate`})]}),P(AS,{}),e?.subtitles&&P(kS,{selection:e.subtitles,icon:e.subtitles.selectedId?P(Wx,{className:`media-icon`}):P(Gx,{className:`media-icon`})},`subtitles`),e?.audioTracks&&P(kS,{selection:e.audioTracks,icon:P(qx,{className:`media-icon`})},`audio`),e?.qualityLevels&&P(kS,{selection:e.qualityLevels,icon:P(Jx,{className:`media-icon`})},`quality`),y(aS,{side:`top`,children:[P(oS,{render:y(mS,{className:`media-button--pip`,render:P(OS,{}),children:[P(Hx,{className:`media-icon media-icon--pip-enter`}),P(Ux,{className:`media-icon media-icon--pip-exit`})]})}),P(sS,{className:`media-surface media-tooltip`})]}),y(aS,{side:`top`,children:[P(oS,{render:y(hS,{className:`media-button--fullscreen`,render:P(OS,{}),children:[P(Bx,{className:`media-icon media-icon--fullscreen-enter`}),P(Vx,{className:`media-icon media-icon--fullscreen-exit`})]})}),P(sS,{className:`media-surface media-tooltip`})]})]})]})}),P(`div`,{className:`media-overlay`}),P(TS,{keys:`Space`,action:`togglePaused`}),P(TS,{keys:`k`,action:`togglePaused`}),P(TS,{keys:`m`,action:`toggleMuted`}),P(TS,{keys:`f`,action:`toggleFullscreen`}),P(TS,{keys:`i`,action:`togglePictureInPicture`}),P(TS,{keys:`ArrowRight`,action:`seekStep`,value:5}),P(TS,{keys:`ArrowLeft`,action:`seekStep`,value:-5}),P(TS,{keys:`l`,action:`seekStep`,value:10}),P(TS,{keys:`j`,action:`seekStep`,value:-10}),P(TS,{keys:`ArrowUp`,action:`volumeStep`,value:.05}),P(TS,{keys:`ArrowDown`,action:`volumeStep`,value:-.05}),P(TS,{keys:`0-9`,action:`seekToPercent`}),P(TS,{keys:`Home`,action:`seekToPercent`,value:0}),P(TS,{keys:`End`,action:`seekToPercent`,value:100}),P(TS,{keys:`>`,action:`speedUp`}),P(TS,{keys:`<`,action:`speedDown`}),P(ES,{type:`tap`,action:`togglePaused`,pointer:`mouse`,region:`center`}),P(ES,{type:`tap`,action:`toggleControls`,pointer:`touch`}),P(ES,{type:`doubletap`,action:`seekStep`,value:-10,region:`left`}),P(ES,{type:`doubletap`,action:`toggleFullscreen`,region:`center`}),P(ES,{type:`doubletap`,action:`seekStep`,value:10,region:`right`})]});l();var{Provider:MS}=Uf({features:qd}),NS=e=>`media`in e?e:{media:e},PS=({remote:e,frame:t,adapter:n})=>{let r=wl();return m(()=>{if(!r||!e||!t)return;let i=n?n(e,t):e;if(!i)return;let a=NS(i);r(a.media);let o=B(a.media);return()=>{o(),r(null),a.dispose?.()}},[e,t,n,r]),null},FS=D`
1421
+ position: absolute;
1422
+ inset: 0;
1423
+ border-radius: 0.8rem;
1424
+ background: transparent !important;
1425
+ &.media-default-skin--video {
1426
+ background: transparent !important;
1427
+ }
1428
+
1429
+ .media-popover--menu {
1430
+ padding: 0.4rem;
1431
+ }
1432
+
1433
+ /**
1434
+ * The track menu is stub's own markup, so it carries a stub prefix rather than a media one.
1435
+ *
1436
+ * It was named \`media-menu\` when the skin had no menu of its own. videojs beta.26 added one, and
1437
+ * upstream's nested \`.media-default-skin .media-menu .media-menu__item\` is specificity (0,3,0)
1438
+ * against this file's (0,2,0), so it silently took over padding, gap, cursor and justification the
1439
+ * moment the dependency moved. A prefix upstream will never mint is the only durable fix; matching
1440
+ * their specificity would just move the race to insertion order.
1441
+ */
1442
+ .stub-menu {
1443
+ display: flex;
1444
+ flex-direction: column;
1445
+ min-width: 18rem;
1446
+ max-height: 32rem;
1447
+ overflow-y: auto;
1448
+ }
1449
+ .stub-menu__heading {
1450
+ padding: 0.6rem 1rem 0.4rem;
1451
+ font-size: 1.1rem;
1452
+ font-weight: 600;
1453
+ letter-spacing: 0.04em;
1454
+ text-transform: uppercase;
1455
+ opacity: 0.6;
1456
+ }
1457
+ .stub-menu__item {
1458
+ display: flex;
1459
+ align-items: center;
1460
+ gap: 0.6rem;
1461
+ width: 100%;
1462
+ padding: 0.6rem 1rem;
1463
+ border: none;
1464
+ border-radius: 0.4rem;
1465
+ background: transparent;
1466
+ color: inherit;
1467
+ font-size: 1.3rem;
1468
+ text-align: left;
1469
+ cursor: pointer;
1470
+
1471
+ &:hover:not(:disabled) {
1472
+ background: rgba(255, 255, 255, 0.12);
1473
+ }
1474
+ &:disabled {
1475
+ opacity: 0.5;
1476
+ cursor: default;
1477
+ }
1478
+ }
1479
+ .stub-menu__check {
1480
+ display: inline-flex;
1481
+ width: 1.6rem;
1482
+ flex: none;
1483
+ }
1484
+ .stub-menu__label {
1485
+ flex: 1;
1486
+ }
1487
+ .stub-menu__description {
1488
+ opacity: 0.6;
1489
+ font-size: 1.1rem;
1490
+ }
1491
+ .media-button--error {
1492
+ color: #f66;
1493
+ }
1494
+ `,IS=({remote:e,frame:t,adapter:n,capabilities:r,children:i})=>y(MS,{children:[P(PS,{remote:e,frame:t,adapter:n}),P(jS,{capabilities:r,css:FS,children:i})]}),LS=`[data-uia="timeline"]`,RS=`[data-uia="video-canvas"]`,zS=`[data-uia="player"]`,BS=`Seeks the video to the point you pick on the timeline.`,VS=`Reveals the player controls so the timeline can be used.`,HS=140,US=2,WS=12e3,GS=26,KS=110,qS={"still-watching":`[data-uia="interrupt-autoplay-continue"], [data-uia="interrupter-title"]`,"next-episode":`[data-uia="next-episode-seamless-button"], [data-uia="next-episode-seamless-button-draining"]`,error:`[data-uia="error-container"], [data-uia="nfp-error"]`},JS=e=>new Promise(t=>setTimeout(t,e)),YS=e=>e<0?0:e>1?1:e,XS=0,ZS=()=>{let e=XS*1.1;return XS++,{x:.5+Math.cos(e)*.05,y:.5+Math.sin(e)*.05}},QS=(e,t)=>{let n=null,r,i,a=!1,o=async()=>{if(!a){a=!0;try{await Promise.all([t.locator(RS).ensure(`hover`,{reason:VS}),t.locator(zS).ensure(`hover`,{reason:VS}),t.locator(LS).ensure(`click`,{reason:BS})])}catch(e){a=!1,console.warn(`[nf] permission request failed:`,e)}}},s=()=>{if(n==null)return;let t=e.currentTime;Number.isFinite(t)&&Math.abs(t-n)<US&&(n=null,i&&clearTimeout(i))};e.addEventListener(`timeupdate`,s);let c=async n=>{let r=e.duration;if(!Number.isFinite(r)||r<=0){console.warn(`[nf] seek: duration unknown`,r);return}let i=YS(n/r);o();let a=t.locator(LS),s=e.paused===!0;if(s)try{await e.play()}catch{}let c=!1;for(let e=0;e<GS;e++){if(e%2==0&&(await t.locator(RS).hover({position:ZS(),reason:VS}).catch(()=>{}),await t.locator(zS).hover({position:ZS(),reason:VS}).catch(()=>{})),await a.exists().catch(()=>!1)){c=!0;break}await JS(KS)}if(!c){let n=await Promise.all(Object.entries(qS).map(async([e,n])=>await t.locator(n).exists().catch(()=>!1)?e:``)).then(e=>e.filter(Boolean).join(`, `)).catch(()=>``);if(console.warn(`[nf] seek aborted: controls never revealed${n?` (blocked by ${n})`:``}`),s)try{await e.pause()}catch{}return}if(await a.click({position:{x:i,y:.5},reason:BS}).catch(e=>console.warn(`[nf] timeline click failed:`,e?.message??e)),s)try{await e.pause()}catch{}};return{media:new Proxy(e,{get(e,t,r){return t===`currentTime`&&n!=null?n:Reflect.get(e,t,r)},set(e,t,a,o){return t===`currentTime`&&typeof a==`number`&&Number.isFinite(a)?(n=a,r&&clearTimeout(r),r=setTimeout(()=>{c(a).catch(e=>console.warn(`[nf] timeline seek failed:`,e))},HS),i&&clearTimeout(i),i=setTimeout(()=>{n=null},WS),!0):Reflect.set(e,t,a,o)}}),dispose:()=>{e.removeEventListener(`timeupdate`,s),r&&clearTimeout(r),i&&clearTimeout(i)}}},$S=({remote:e,frame:t,capabilities:n,children:r})=>P(IS,{remote:e,frame:t,adapter:QS,capabilities:n,children:r});l();var eC=[`netflix.com`,`www.netflix.com`,`nflxvideo.net`,`nflxso.net`,`nflxext.com`,`nflximg.net`,`assets.nflxext.com`],tC=`https://www.netflix.com/login`,nC=`
1495
+ html, body {
1496
+ margin: 0 !important;
1497
+ padding: 0 !important;
1498
+ width: 100% !important;
1499
+ height: 100% !important;
1500
+ overflow: hidden !important;
1501
+ background: #000 !important;
1502
+ }
1503
+ /* Truly-unwanted chrome - collapse it entirely. */
1504
+ .watch-video--evidence-overlay-container,
1505
+ .watch-video--skip-content,
1506
+ .watch-video--nextEpisode-seamless-button,
1507
+ .watch-video--back-container,
1508
+ [data-uia="player-back-to-browse"],
1509
+ [data-uia="control-nav-back"],
1510
+ [data-uia="control-flag"] {
1511
+ display: none !important;
1512
+ pointer-events: none !important;
1513
+ }
1514
+ /* Keep the controls bar in LAYOUT (so the seek adapter can locate + click the
1515
+ [data-uia="timeline"] scrubber) but invisible and inert to real taps. NEVER
1516
+ display:none here, or the scrubber loses its box and the seek no-ops - mirrors
1517
+ Crunchyroll's opacity:0 timeline trick. The skin draws the visible controls. */
1518
+ [data-uia="controls-standard"],
1519
+ .watch-video--bottom-controls-container,
1520
+ .PlayerControlsNeo__layout,
1521
+ .PlayerControlsNeo__core-controls,
1522
+ .PlayerControlsNeo__button-control-row {
1523
+ opacity: 0 !important;
1524
+ pointer-events: none !important;
1525
+ }
1526
+ [data-uia="timeline"],
1527
+ [data-uia="timeline"] * {
1528
+ pointer-events: auto !important;
1529
+ }
1530
+ .watch-video,
1531
+ [data-uia="video-canvas"] {
1532
+ position: fixed !important;
1533
+ inset: 0 !important;
1534
+ width: 100% !important;
1535
+ height: 100% !important;
1536
+ z-index: 9999999 !important;
1537
+ }
1538
+ .watch-video video,
1539
+ [data-uia="video-canvas"] video {
1540
+ width: 100% !important;
1541
+ height: 100% !important;
1542
+ object-fit: contain !important;
1543
+ }
1544
+ `,rC=async(e,t=10,n=500)=>{for(let r=0;r<t;r++)try{return await e()}catch(e){if(r===t-1||!(e instanceof Error)||!e.message.includes(`not registered`))throw e;await new Promise(e=>setTimeout(e,n))}throw Error(`unreachable`)},iC=async e=>{for(let t=0;t<50;t++){if(await e.locator(`[data-uia="header"] a[href*="/login"]`).exists())return!1;if(await e.locator(`.watch-video, [data-uia="video-canvas"]`).exists())return!0;await new Promise(e=>setTimeout(e,200))}return!1},aC=async(e,t)=>{for(;!t();){try{if(await e.locator(`video`).exists())return await e.locator(`video`).videoElement()}catch(e){if(e?.name===`LocatorUnsupportedError`)throw e}await new Promise(e=>setTimeout(e,200))}return null},oC=D`
1545
+ position: relative;
1546
+ width: 100%;
1547
+ height: 100%;
1548
+ background: #000;
1549
+ user-select: none;
1550
+ -webkit-user-select: none;
1551
+
1552
+ .nf-frame {
1553
+ position: absolute;
1554
+ inset: 0;
1555
+ width: 100%;
1556
+ height: 100%;
1557
+ border: none;
1558
+ background: #000;
1559
+ /* Netflix's own chrome is hidden, so the iframe must not swallow taps -
1560
+ they belong to the skin's gesture layer stacked above it. */
1561
+ pointer-events: none;
1562
+ }
1563
+
1564
+ .overlay {
1565
+ position: absolute;
1566
+ inset: 0;
1567
+ display: flex;
1568
+ flex-direction: column;
1569
+ align-items: center;
1570
+ justify-content: center;
1571
+ gap: 1.6rem;
1572
+ background: #000;
1573
+ font-size: 1.4rem;
1574
+ color: rgba(255, 255, 255, 0.8);
1575
+ z-index: 30;
1576
+ }
1577
+
1578
+ .login-button {
1579
+ padding: 0.8rem 2rem;
1580
+ background: #e50914;
1581
+ color: #fff;
1582
+ border: none;
1583
+ border-radius: 0.4rem;
1584
+ font-size: 1.4rem;
1585
+ font-weight: 600;
1586
+ cursor: pointer;
1587
+
1588
+ &:hover {
1589
+ background: #c11119;
1590
+ }
1591
+ }
1592
+ `,sC={cr:Ax,nf:({url:e})=>{let[t,n]=h(null),[r,i]=h(null),[a,o]=h(!0),[s,c]=h(!1),[l,u]=h(),[d,f]=h(null),[g,_]=h(0);m(()=>{if(!t)return;let e=!1;return(async()=>{for(let n=0;!e;n++)try{let n=await z({iframe:t,domains:eC});if(e)return;if(!R()){u(`Netflix playback currently needs the FKN browser extension.`),o(!1);return}i(n);return}catch(t){if(e)return;if(n>=4){console.error(`Failed to attach Netflix frame`,t),u(t instanceof Error?t.message:`Failed to load player`),o(!1);return}await new Promise(e=>setTimeout(e,300*(n+1)))}})(),()=>{e=!0}},[t]),m(()=>{if(!r)return;let t=!1,n=()=>t;return o(!0),u(void 0),c(!1),f(null),(async()=>{if(await r.goto(e,{waitUntil:`load`}),await rC(()=>r.addStyleTag({content:nC})),t)return;o(!1);let i=await iC(r);if(t)return;if(!i){c(!0);return}let a=await aC(r,n);!t&&a&&f(a)})().catch(e=>{t||(console.error(`Failed to load Netflix player`,e),u(e?.message??`Failed to load player`),o(!1))}),()=>{t=!0}},[r,e,g]);let v=p(()=>{let e=globalThis.open(tC,`_blank`,`width=500,height=700`);if(!e)return;let t=setInterval(()=>{e.closed&&(clearInterval(t),_(e=>e+1))},500)},[]);return y(`div`,{css:oC,children:[P($S,{remote:d,frame:r,children:P(`iframe`,{ref:n,className:`nf-frame`,referrerPolicy:`no-referrer`,allow:`encrypted-media; autoplay; fullscreen;`})}),(s||l||a)&&y(`div`,{className:`overlay`,children:[s&&y(O,{children:[`You need to be logged in to Netflix to watch this content.`,P(`button`,{className:`login-button`,onClick:v,children:`Open Netflix Login Page`})]}),l&&!s&&l,a&&!l&&!s&&`Loading Netflix player...`]})]})}},cC=e=>sC[e],lC=new URLSearchParams(globalThis.location.search),uC=lC.get(`mediaUri`),dC=lC.get(`episodeUri`),fC=lC.get(`sourceUri`),pC=lC.get(`url`),mC=fC?T(fC).origin:void 0,hC=mC?cC(mC):void 0;A(P(()=>!uC||!dC||!fC||!pC||!hC?P(`div`,{children:`Unsupported or missing parameters`}):P(hC,{url:pC,mediaUri:uC,episodeUri:dC,sourceUri:fC}),{}),document.getElementById(`app`));