@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.
@@ -1,1460 +0,0 @@
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 M,rt as N,tt as P,u as F,y as I}from"./uri-DvH8-88e.js";import{c as L,i as te,l as ne,o as re,s as ie,t as ae}from"./lib-ByuinM2l.js";import{n as oe}from"./remote-CVVOdyaq.js";_(),l();var R=new Set([`ExtensionOperationUnsupportedError`,`FrameWindowRefusedError`]),se=2,ce=`unreadable`,le=(e,t)=>{let n;return Promise.race([Promise.resolve().then(e).catch(()=>ce),new Promise(e=>{n=setTimeout(()=>e(void 0),t)})]).finally(()=>clearTimeout(n))},ue=async({url:e,domains:t,isSignedIn:n,onSignInPage:r,pollMs:i=1e3,readTimeoutMs:a=5e3})=>{let o=ae({window:{url:e},domains:t}),s;try{s=await o}catch(e){let t=e?.name;if(t===`FrameWindowBlockedError`)return`blocked`;if(t&&R.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([le(()=>n(s),a),r&&le(()=>r(s),a)]))]);if(e===`closed`)return`closed`;let[t,o]=e;if(o===!0?(l=!0,u=0):(o===!1||o===ce)&&l&&(u+=1),t===!0||u>=se)return await s.close(),`authed`}},de={};(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 de},set exports(e){de=e}});var fe=de,pe=class extends Error{constructor(e){super(e),this.name=`TimeoutError`}},me=class extends Error{constructor(e){super(),this.name=`AbortError`,this.message=e}},he=e=>globalThis.DOMException===void 0?new me(e):new DOMException(e),ge=e=>{let t=e.reason===void 0?he(`This operation was aborted.`):e.reason;return t instanceof Error?t:he(t)};function _e(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(ge(e)),e.addEventListener(`abort`,()=>{o(ge(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 pe(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 ve(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 ye=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)},z,be=class{constructor(){z.set(this,[])}enqueue(e,t){t={priority:0,...t};let n={priority:t.priority,run:e};if(this.size&&ye(this,z,`f`)[this.size-1].priority>=t.priority){ye(this,z,`f`).push(n);return}let r=ve(ye(this,z,`f`),n,(e,t)=>t.priority-e.priority);ye(this,z,`f`).splice(r,0,n)}dequeue(){return ye(this,z,`f`).shift()?.run}filter(e){return ye(this,z,`f`).filter(t=>t.priority===e.priority).map(e=>e.run)}get size(){return ye(this,z,`f`).length}};z=new WeakMap;var B=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},V=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)},H,xe,Se,Ce,we,Te,Ee,De,Oe,U,ke,Ae,je,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,We,Ge=new pe,Ke=class extends Error{},qe=class extends fe{constructor(e){if(super(),H.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),U.set(this,void 0),ke.set(this,void 0),Ae.set(this,0),je.set(this,void 0),Me.set(this,void 0),Ne.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})`);B(this,xe,e.carryoverConcurrencyCount,`f`),B(this,Se,e.intervalCap===1/0||e.interval===0,`f`),B(this,we,e.intervalCap,`f`),B(this,Te,e.interval,`f`),B(this,U,new e.queueClass,`f`),B(this,ke,e.queueClass,`f`),this.concurrency=e.concurrency,this.timeout=e.timeout,B(this,Ne,e.throwOnTimeout===!0,`f`),B(this,Me,e.autoStart===!1,`f`)}get concurrency(){return V(this,je,`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})`);B(this,je,e,`f`),V(this,H,`m`,Ue).call(this)}async add(e,t={}){return new Promise((n,r)=>{V(this,U,`f`).enqueue(async()=>{var i,a;B(this,Ae,(i=V(this,Ae,`f`),i++,i),`f`),B(this,Ce,(a=V(this,Ce,`f`),a++,a),`f`);try{if(t.signal?.aborted){r(new Ke(`The task was aborted.`));return}let i=await(this.timeout===void 0&&t.timeout===void 0?e({signal:t.signal}):_e(Promise.resolve(e({signal:t.signal})),t.timeout===void 0?this.timeout:t.timeout,()=>{(t.throwOnTimeout===void 0?V(this,Ne,`f`):t.throwOnTimeout)&&r(Ge)}));n(i),this.emit(`completed`,i)}catch(e){r(e),this.emit(`error`,e)}V(this,H,`m`,Ie).call(this)},t),V(this,H,`m`,Be).call(this),this.emit(`add`)})}async addAll(e,t){return Promise.all(e.map(async e=>this.add(e,t)))}start(){return V(this,Me,`f`)?(B(this,Me,!1,`f`),V(this,H,`m`,Ue).call(this),this):this}pause(){B(this,Me,!0,`f`)}clear(){B(this,U,new(V(this,ke,`f`)),`f`)}async onEmpty(){V(this,U,`f`).size!==0&&await V(this,H,`m`,We).call(this,`empty`)}async onSizeLessThan(e){V(this,U,`f`).size<e||await V(this,H,`m`,We).call(this,`next`,()=>V(this,U,`f`).size<e)}async onIdle(){(V(this,Ae,`f`)!==0||V(this,U,`f`).size!==0)&&await V(this,H,`m`,We).call(this,`idle`)}get size(){return V(this,U,`f`).size}sizeBy(e){return V(this,U,`f`).filter(e).length}get pending(){return V(this,Ae,`f`)}get isPaused(){return V(this,Me,`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,U=new WeakMap,ke=new WeakMap,Ae=new WeakMap,je=new WeakMap,Me=new WeakMap,Ne=new WeakMap,H=new WeakSet,Pe=function(){return V(this,Se,`f`)||V(this,Ce,`f`)<V(this,we,`f`)},Fe=function(){return V(this,Ae,`f`)<V(this,je,`f`)},Ie=function(){var e;B(this,Ae,(e=V(this,Ae,`f`),e--,e),`f`),V(this,H,`m`,Be).call(this),this.emit(`next`)},Le=function(){this.emit(`empty`),V(this,Ae,`f`)===0&&this.emit(`idle`)},Re=function(){V(this,H,`m`,He).call(this),V(this,H,`m`,Ve).call(this),B(this,Oe,void 0,`f`)},ze=function(){let e=Date.now();if(V(this,De,`f`)===void 0){let t=V(this,Ee,`f`)-e;if(t<0)B(this,Ce,V(this,xe,`f`)?V(this,Ae,`f`):0,`f`);else return V(this,Oe,`f`)===void 0&&B(this,Oe,setTimeout(()=>{V(this,H,`m`,Re).call(this)},t),`f`),!0}return!1},Be=function(){if(V(this,U,`f`).size===0)return V(this,De,`f`)&&clearInterval(V(this,De,`f`)),B(this,De,void 0,`f`),V(this,H,`m`,Le).call(this),!1;if(!V(this,Me,`f`)){let e=!V(this,H,`a`,ze);if(V(this,H,`a`,Pe)&&V(this,H,`a`,Fe)){let t=V(this,U,`f`).dequeue();return t?(this.emit(`active`),t(),e&&V(this,H,`m`,Ve).call(this),!0):!1}}return!1},Ve=function(){V(this,Se,`f`)||V(this,De,`f`)!==void 0||(B(this,De,setInterval(()=>{V(this,H,`m`,He).call(this)},V(this,Te,`f`)),`f`),B(this,Ee,Date.now()+V(this,Te,`f`),`f`))},He=function(){V(this,Ce,`f`)===0&&V(this,Ae,`f`)===0&&V(this,De,`f`)&&(clearInterval(V(this,De,`f`)),B(this,De,void 0,`f`)),B(this,Ce,V(this,xe,`f`)?V(this,Ae,`f`):0,`f`),V(this,H,`m`,Ue).call(this)},Ue=function(){for(;V(this,H,`m`,Be).call(this););},We=async function(e,t){return new Promise(n=>{let r=()=>{(!t||t())&&(this.off(e,r),n())};this.on(e,r)})};var Je=Object.defineProperty,W=(e,t)=>{let n={};for(var r in e)Je(n,r,{get:e[r],enumerable:!0});return t||Je(n,Symbol.toStringTag,{value:`Module`}),n},Ye=`__OSRA_KEY__`,Xe=`__OSRA_DEFAULT_KEY__`,Ze=`__OSRA_BOX__`,Qe=()=>globalThis.browser??globalThis.chrome,$e=()=>Qe()?.runtime,et=(e,t)=>_t(e)&&e.__OSRA_KEY__===t,tt=(e,t)=>{if(e){if(e.aborted){t();return}e.addEventListener(`abort`,t,{once:!0})}},nt=({listener:e,transport:t,remoteName:n,key:r=Xe,origin:i=`*`,unregisterSignal:a})=>{if(a?.aborted)return;let o=Ft(t)?t.receive:t;if(typeof o==`function`){let t=o((t,i)=>{a?.aborted||et(t,r)&&(n&&t.name!==n||e(t,i))});typeof t==`function`&&tt(a,t);return}if(xt(o)||St(o)||wt(o)||Tt(o)){let t=(t,i)=>{let o=(t,a)=>{et(t,r)&&(n&&t.name!==n||e(t,{port:i,sender:a}))};t.addListener(o),tt(a,()=>t.removeListener(o))};if(xt(o))t(o.onMessage);else if(wt(o)){let e=e=>t(e.onMessage,e);o.addListener(e),tt(a,()=>o.removeListener(e))}else Tt(o)?t(o):t(o.onMessage);return}let s=ht(o)?o.port:o,c=i!==`*`&&Et(o),l=t=>{let a=t.data;if(typeof a==`string`)try{a=JSON.parse(a)}catch{return}et(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(),tt(a,()=>s.removeEventListener(`message`,l))},rt=(e,t,n=`*`,r=[])=>{let i=Ft(e)?e.emit:e;if(typeof i==`function`)i(t,r);else if(Et(i))i.postMessage(t,n,r);else if(St(i))i.postMessage(t);else if(xt(i))i.sendMessage(t)?.catch?.(e=>{if(!String(e?.message).includes(`Receiving end does not exist`))throw e});else if(ut(i)){let e=JSON.stringify(t);i.readyState===WebSocket.CONNECTING?i.addEventListener(`open`,()=>i.send(e),{once:!0}):i.send(e)}else ht(i)?i.port.postMessage(t,r):i.postMessage(t,r)},it=globalThis.Float16Array,at={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float16Array:it,Float32Array,Float64Array,BigInt64Array,BigUint64Array},ot=Object.values(at),st=e=>{let t=e.constructor.name;if(t in at)return t;for(let[t,n]of Object.entries(at))if(n&&e instanceof n)return t;throw Error(`Unknown typed array type`)},ct=e=>{let t=at[e];if(!t)throw Error(`Unknown typed array type`);return t},lt=e=>ot.some(t=>!!t&&e instanceof t),ut=e=>e instanceof WebSocket,dt=e=>!!globalThis.ServiceWorkerContainer&&e instanceof ServiceWorkerContainer,ft=e=>!!globalThis.ServiceWorker&&e instanceof ServiceWorker,pt=e=>!!globalThis.Worker&&e instanceof Worker,mt=e=>{let t=globalThis.DedicatedWorkerGlobalScope;return!!t&&e instanceof t},ht=e=>!!globalThis.SharedWorker&&e instanceof SharedWorker,gt=e=>e instanceof MessagePort,_t=e=>!!e&&typeof e==`object`&&`__OSRA_KEY__`in e&&!!e.__OSRA_KEY__,vt=(e,t)=>{for(let n of t)if(n&&e instanceof n)return!0;return!1},yt=e=>vt(e,[globalThis.SharedArrayBuffer]),bt=e=>vt(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]),xt=e=>{let t=$e();return t?e===t:!1},St=(e,t=!1)=>!e||typeof e!=`object`||Et(e)||!(`name`in e)||!(`disconnect`in e)||!(`postMessage`in e)?!1:!t||`sender`in e&&`onMessage`in e&&`onDisconnect`in e,Ct=e=>!!e&&typeof e==`object`&&!Et(e)&&`addListener`in e&&`hasListener`in e&&`removeListener`in e,wt=e=>{let t=$e();return t?e===t.onConnect||e===t.onConnectExternal:!1},Tt=e=>Ct(e),Et=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}}},Dt=e=>ut(e)||St(e)||xt(e),Ot=e=>ut(e)||St(e)||wt(e)||Tt(e)||xt(e),kt=e=>!!e&&typeof e==`object`&&!Et(e)&&`isJson`in e&&e.isJson===!0||Dt(e)||Ot(e),At=e=>Et(e)||Dt(e)||ft(e)||pt(e)||mt(e)||ht(e)||gt(e)||Nt(e),jt=e=>Et(e)||Ot(e)||dt(e)||pt(e)||mt(e)||ht(e)||gt(e)||Pt(e),Mt=e=>{if(!e||typeof e!=`object`||Et(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},Nt=e=>!Mt(e)||!(`emit`in e)?!1:At(e.emit)||typeof e.emit==`function`,Pt=e=>!Mt(e)||!(`receive`in e)?!1:jt(e.receive)||typeof e.receive==`function`,Ft=e=>Nt(e)||Pt(e),G={[Ze]:`revivable`},It=e=>!!e&&typeof e==`object`&&`__OSRA_BOX__`in e&&e.__OSRA_BOX__===`revivable`,Lt=(e,t)=>kt(t.transport)?{base64Buffer:new Uint8Array(e).toBase64()}:{arrayBuffer:e},Rt=e=>`arrayBuffer`in e?e.arrayBuffer:Uint8Array.fromBase64(e.base64Buffer).buffer,zt=W({box:()=>Ht,isType:()=>Vt,revive:()=>Ut,type:()=>Bt}),Bt=`arrayBuffer`,Vt=e=>e instanceof ArrayBuffer,Ht=(e,t)=>({...G,type:Bt,...Lt(e,t)}),Ut=(e,t)=>Rt(e),Wt=W({box:()=>qt,isType:()=>Kt,revive:()=>Jt,type:()=>Gt}),Gt=`date`,Kt=e=>e instanceof Date,qt=(e,t)=>({...G,type:Gt,ISOString:e.toISOString()}),Jt=(e,t)=>new Date(e.ISOString),Yt=W({box:()=>Qt,isType:()=>Zt,revive:()=>$t,type:()=>Xt}),Xt=`headers`,Zt=e=>e instanceof Headers,Qt=(e,t)=>({...G,type:Xt,entries:[...e.entries()]}),$t=(e,t)=>new Headers(e.entries),en=W({box:()=>an,isType:()=>rn,revive:()=>on,type:()=>tn}),tn=`error`,nn={Error,TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError},rn=e=>e instanceof Error,an=(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:tn,name:e.name,message:e.message,stack:e.stack||e.toString(),...n?{cause:sa(e.cause,t)}:{},...r?{errors:sa(e.errors,t)}:{},...i?{isDOMException:!0}:{}}},on=(e,t)=>{let n=e.cause===void 0?void 0:ca(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(ca(e.errors,t),e.message,r);else{let t=nn[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},sn=W({box:()=>un,isType:()=>ln,revive:()=>dn,type:()=>cn}),cn=`typedArray`,ln=lt,un=(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:cn,typedArrayType:st(e),...Lt(n,t)}},dn=(e,t)=>new(ct(e.typedArrayType))(Rt(e)),fn=new WeakMap,pn=new WeakSet,mn=(e,t)=>{if(pn.has(e))return t(),()=>{};let n=fn.get(e);return n||fn.set(e,n=new Set),n.add(t),()=>n.delete(t)},hn=e=>{if(pn.has(e))return;pn.add(e);let t=fn.get(e);if(t){fn.delete(e);for(let e of t)try{e()}catch{}}},gn=W({box:()=>wn,isType:()=>Cn,revive:()=>Tn,transfer:()=>Sn,type:()=>_n}),_n=`transfer`,vn=Symbol.for(`osra.transfer`),yn=e=>typeof e==`object`&&!!e,bn=e=>yn(e)&&vn in e&&e[vn]===!0,xn=e=>yn(e)?ArrayBuffer.isView(e)?!0:vt(e,[globalThis.ArrayBuffer,globalThis.MessagePort,globalThis.ReadableStream,globalThis.WritableStream,globalThis.TransformStream,globalThis.ImageBitmap,globalThis.OffscreenCanvas,globalThis.VideoFrame,globalThis.AudioData]):!1,Sn=e=>xn(e)?{[vn]:!0,value:e}:e,Cn=e=>bn(e),wn=(e,t)=>({...G,type:_n,inner:sa(e.value,t),degraded:kt(t.transport)}),Tn=(e,t)=>ca(e.inner,t),En=e=>vt(e,[globalThis.MessagePort,globalThis.ReadableStream,globalThis.WritableStream,globalThis.TransformStream,globalThis.OffscreenCanvas,globalThis.MediaSourceHandle,globalThis.MediaStreamTrack,globalThis.MIDIAccess,globalThis.RTCDataChannel,globalThis.WebTransportReceiveStream,globalThis.WebTransportSendStream]),Dn=e=>It(e)&&e.type===`transfer`,On=e=>{let t=[],n=new WeakSet,r=(e,i)=>{if(e&&typeof e==`object`&&!n.has(e)&&(n.add(e),!yt(e))){if(Dn(e)){r(e.inner,i||!e.degraded);return}if(En(e)){t.push(e);return}if(bt(e)){i&&t.push(e);return}if(!ArrayBuffer.isView(e)){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},kn=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`))})}},An=class{port1;port2;constructor(){let e=new kn,t=new kn;e._peer=t,t._peer=e,this.port1=e,this.port2=t}},jn=new FinalizationRegistry(e=>{try{e()}catch{}}),Mn=(e,t)=>{let n={};return jn.register(e,t,n),()=>jn.unregister(n)},Nn=W({box:()=>Xn,createRevivableChannel:()=>$n,init:()=>Gn,isType:()=>Kn,revive:()=>Zn,type:()=>Pn}),Pn=`messagePort`,Fn=2048,In=128,Ln=1024,Rn=new WeakMap,zn=e=>{let t=Rn.get(e);if(!t)throw Error(`osra message-port: connection state missing; did init() run?`);return t},Bn=(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},Vn=(e,t)=>{let n=e.ports.get(t);if(n&&!n.handler&&e.pendingPorts--,e.ports.delete(t),e.tombstones.size>=In){let t=e.tombstones.values().next().value;t!==void 0&&e.tombstones.delete(t)}e.tombstones.add(t)},Hn=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)},Un=(e,t)=>Bn(zn(e),t).outSeq++,Wn=(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=Bn(r,t);i.handler||r.pendingPorts--,i.handler=n,Hn(i)},Gn=e=>{let t={ports:new Map,tombstones:new Set,pendingPorts:0};Rn.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>=Ln)return;r=Bn(t,n.portId)}if(!(n.seq<r.nextSeq)){if(r.buffer.size>=Fn&&!(n.seq===r.nextSeq&&r.handler)){r.buffer.clear(),Vn(t,n.portId),r.handler?.({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:n.portId});return}r.buffer.set(n.seq,n),Hn(r)}}),mn(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})},Kn=e=>e instanceof MessagePort||e instanceof kn,qn=(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{}},Jn=(e,t,n)=>{n?e.postMessage(t):e.postMessage(t,On(t))},Yn=(e,t,n)=>()=>{let r=e.deref();r&&qn(r,n);let i=t.deref();i&&Vn(i,n)},Xn=(e,t,n)=>{let r=e instanceof kn;if(!r&&!kt(t.transport))return{...G,type:Pn,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&&Vn(e,o),m?.();let t=s.deref();t?.removeEventListener(`message`,p),t instanceof kn&&(t._onClose=void 0)},f=e=>{if(e.type===`message-port-close`){d(),a.dispatchEvent(new Event(`close`)),a.close();return}Jn(a,ca(e.data,t),!1)};function p({data:e}){t.sendMessage({type:`message`,remoteUuid:t.remoteUuid,data:sa(e,t),portId:o,seq:Un(t,o)})}let m=Mn(a,Yn(c,l,o));return a.addEventListener(`message`,p),a.start(),a instanceof kn&&(a._onClose=()=>{u||(qn(t,o),d())}),Wn(t,o,f),{...G,type:Pn,portId:o,synthetic:r}},Zn=(e,t)=>`port`in e?e.autoBox?Qn(e.port,t):e.port:er(e.portId,t,e.synthetic),Qn=(e,t)=>{let n=new EventTarget,r=({data:e})=>{n.dispatchEvent(new MessageEvent(`message`,{data:ca(e,t)}))},i=()=>{n.dispatchEvent(new Event(`close`))};return e.addEventListener(`message`,r),e.addEventListener(`close`,i),n.postMessage=(n,r)=>{let i=sa(n,t),a=On(i),o=Array.isArray(r)?r:[];e.postMessage(i,o.length?[...a,...o]:a)},n.start=()=>e.start(),n.close=()=>{e.removeEventListener(`message`,r),e.removeEventListener(`close`,i),e.close()},n},$n=e=>{if(kt(e.transport)){let{port1:t,port2:n}=new An;return{localPort:t,boxedRemote:Xn(n,e)}}let{port1:t,port2:n}=new MessageChannel;return{localPort:Qn(t,e),boxedRemote:Xn(n,e,{autoBox:!0})}},er=(e,t,n)=>{let r=zn(t),{port1:i,port2:a}=n?new An:new MessageChannel,o=new WeakRef(i),s=new WeakRef(a),c=!1,l=()=>{if(c)return;c=!0,Vn(r,e);let t=s.deref();t?.removeEventListener(`message`,d),t?.close(),f?.()},u=e=>{if(e.type===`message-port-close`){l();let e=o.deref();e?.dispatchEvent(new Event(`close`)),e?.close();return}if(!o.deref()){l();return}let r=s.deref();r&&Jn(r,ca(e.data,t),n)},d=({data:n})=>{t.sendMessage({type:`message`,remoteUuid:t.remoteUuid,data:sa(n,t),portId:e,seq:Un(t,e)})},f=Mn(i,()=>{qn(t,e),l()});return i instanceof kn&&(i._onClose=()=>{c||(qn(t,e),l())}),a.addEventListener(`message`,d),a.start(),Wn(t,e,u),i},tr=W({box:()=>or,isType:()=>ar,revive:()=>sr,type:()=>nr}),nr=`promise`,rr=e=>e instanceof Promise,ir=new Set,ar=e=>e instanceof Promise,or=(e,t)=>{if(!rr(e))throw TypeError(`Expected Promise`);let{localPort:n,boxedRemote:r}=$n(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:nr,port:r}},sr=(e,t)=>{let n=Zn(e.port,t);ir.add(n);let r=`portId`in e.port;return new Promise((e,i)=>{let a=()=>{n.close(),ir.delete(n),o()},o=r?mn(t,()=>{i(Error(`osra: connection closed`)),a()}):()=>{};n.addEventListener(`message`,({data:t})=>{t.type===`resolve`?e(t.data):i(t.error),a()},{once:!0}),n.start()})},cr=W({box:()=>fr,isType:()=>dr,revive:()=>pr,type:()=>lr}),lr=`function`,ur=new Set,dr=e=>typeof e==`function`,fr=(e,t)=>{let{port1:n,port2:r}=new An;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}}let a=(()=>{try{return sa(n,t)}catch(e){return sa({type:`throw`,error:e},t)}})();r.postMessage(a,On(a)),queueMicrotask(()=>{try{r.close()}catch{}})})()}),n.start(),{...G,type:lr,port:Xn(r,t)}},pr=(e,t)=>{let n=Zn(e.port,t);return((...e)=>new Promise((r,i)=>{let{port1:a,port2:o}=new An;ur.add(a);let s=()=>{a.close(),ur.delete(a),c()},c=mn(t,()=>{i(Error(`osra: connection closed`)),s()});a.addEventListener(`message`,({data:e})=>{let t=e;t.type===`return`?r(t.value):i(t.error),s()},{once:!0}),a.start();let l=sa([o,e],t);n.postMessage(l,On(l))}))},mr=W({MAX_CREDIT_WINDOW:()=>64,box:()=>br,isType:()=>gr,revive:()=>wr,type:()=>hr}),hr=`readableStream`,gr=e=>e instanceof ReadableStream,_r=2,vr=8,yr=4194304,br=(e,t)=>{let{localPort:n,boxedRemote:r}=$n(t),i=e.getReader(),a=0,o=!1,s=!1,c=e=>{s=!0;try{n.postMessage(e)}catch{}n.close()},l=async()=>{if(!(o||s)){for(o=!0;a>0;){let e;try{e=await i.read()}catch(e){s||c({type:`error`,error:e});return}if(s)return;if(e.done){c({type:`end`});return}a--;try{n.postMessage({type:`chunk`,value:e.value})}catch(e){c({type:`error`,error:e}),i.cancel(e).catch(()=>{});return}}o=!1}};return n.addEventListener(`message`,({data:e})=>{e instanceof Promise||!(`type`in e)||(e.type===`pull`?n.postMessage(i.read()):e.type===`credit`?(a+=e.n,l()):e.type===`cancel`&&(s=!0,i.cancel(e.reason).catch(()=>{}),n.close()))}),n.addEventListener(`close`,()=>{s||(s=!0,i.cancel(Error(`osra: connection closed`)).catch(()=>{}))},{once:!0}),n.start(),{...G,type:hr,credit:!0,port:r}},xr=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,Sr=e=>{let t=!1,n=0,r,i=[],a=!1,o=!1,s,c,l=()=>r===void 0?vr:Math.max(_r,Math.min(64,Math.floor(yr/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=xr(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(`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(a){d(),e.close();return}return o?(d(),Promise.reject(s)):(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())}})},Cr=e=>{let t=!1;return new ReadableStream({start:n=>{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=Zn(e.port,t);return n.start(),e.credit?Sr(n):Cr(n)},Tr=W({box:()=>Or,isType:()=>Dr,revive:()=>kr,type:()=>Er}),Er=`writableStream`,Dr=e=>e instanceof WritableStream,Or=(e,t)=>{let{localPort:n,boxedRemote:r}=$n(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(`close`,()=>{a||(a=!0,i.abort(Error(`osra: connection closed`)).catch(()=>{}))},{once:!0}),n.start(),{...G,type:Er,port:r}},kr=(e,t)=>{let n=Zn(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};return new WritableStream({write:e=>o({type:`write`,chunk:e}),close:()=>o({type:`close`}),abort:e=>o({type:`abort`,reason:e})})},Ar=W({box:()=>Pr,isType:()=>Mr,revive:()=>Fr,type:()=>jr}),jr=`abortSignal`,Mr=e=>e instanceof AbortSignal,Nr=new WeakMap,Pr=(e,t)=>{if(e.aborted)return{...G,type:jr,aborted:!0,reason:sa(e.reason,t)};let{localPort:n,boxedRemote:r}=$n(t),i=()=>{n.postMessage({type:`abort`,reason:e.reason}),n.close(),a()},a=mn(t,()=>{e.removeEventListener(`abort`,i),n.close()});return e.addEventListener(`abort`,i,{once:!0}),{...G,type:jr,aborted:!1,reason:void 0,port:r}},Fr=(e,t)=>{let n=new AbortController;if(e.aborted||e.port===void 0)return n.abort(ca(e.reason,t)),n.signal;let r=Zn(e.port,t);return Nr.set(n.signal,r),r.start(),r.addEventListener(`message`,({data:e})=>{e.type===`abort`&&(n.abort(ca(e.reason,t)),Nr.delete(n.signal),r.close())}),n.signal},Ir=W({box:()=>zr,isType:()=>Rr,revive:()=>Br,type:()=>Lr}),Lr=`response`,Rr=e=>e instanceof Response,zr=(e,t)=>({...G,type:Lr,status:e.status,statusText:e.statusText,headers:Qt(e.headers,t),body:e.body?br(e.body,t):null,url:e.url,redirected:e.redirected}),Br=(e,t)=>{if(e.status===0)return Response.error();let n=$t(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},Vr=W({box:()=>Wr,isType:()=>Ur,revive:()=>Gr,type:()=>Hr}),Hr=`request`,Ur=e=>e instanceof Request,Wr=(e,t)=>({...G,type:Hr,method:e.method,url:e.url,headers:Qt(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:Pr(e.signal,t)}),Gr=(e,t)=>{let n=$t(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:Fr(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)},Kr=W({box:()=>oi,boxByReference:()=>si,identity:()=>ei,isType:()=>ii,revive:()=>ci,type:()=>qr}),qr=`identity`,Jr=Symbol.for(`osra.identity`),Yr=e=>e!==null&&(typeof e==`object`||typeof e==`function`),Xr=e=>{if(e===null)return!1;let t=typeof e;return t===`object`||t===`function`||t===`symbol`&&Symbol.keyFor(e)===void 0},Zr=e=>Yr(e)&&Jr in e&&e[Jr]===!0,Qr=new WeakMap,$r=e=>{if(Zr(e))return e;let t=Qr.get(e);if(t)return t;let n={[Jr]:!0,value:e};return Qr.set(e,n),n},ei=e=>Yr(e)?$r(e):e,ti=new WeakMap,ni=e=>{let t=ti.get(e);if(t)return t;let n=new WeakMap,r=new Map,i=new Map,a=new WeakMap,o={sendIds:n,idToSent:r,sendRegistry:new FinalizationRegistry(t=>{r.delete(t);try{e.sendMessage({type:`identity-dispose`,remoteUuid:e.remoteUuid,id:t})}catch{}}),receiveCache:i,revivedToId:a,listenerInstalled:!1};return ti.set(e,o),ri(e,o),mn(e,()=>{o.receiveCache.clear(),o.idToSent.clear()}),o},ri=(e,t)=>{t.listenerInstalled||(t.listenerInstalled=!0,e.eventTarget.addEventListener(`message`,({detail:e})=>{if(e?.type!==`identity-dispose`)return;let n=t.receiveCache.get(e.id);t.receiveCache.delete(e.id),n!==void 0&&Xr(n)&&t.revivedToId.delete(n)}))},ii=e=>Zr(e),ai=(e,t)=>{let n=t.sendIds.get(e);if(n!==void 0)return{id:n,isExisting:!0};let r=t.revivedToId.get(e);if(r!==void 0)return{id:r,isExisting:!0};let i=globalThis.crypto.randomUUID();return t.sendIds.set(e,i),t.idToSent.set(i,new WeakRef(e)),t.sendRegistry.register(e,i),{id:i,isExisting:!1}},oi=(e,t)=>{let n=ni(t),r=e.value,i=sa(r,t);if(!Xr(r))return{...G,type:qr,id:globalThis.crypto.randomUUID(),inner:i};let{id:a,isExisting:o}=ai(r,n);return o?{...G,type:qr,id:a}:{...G,type:qr,id:a,inner:i}},si=(e,t,n)=>{let{id:r,isExisting:i}=ai(e,ni(n));return i?{...G,type:qr,id:r}:{...G,type:qr,id:r,inner:t}},ci=(e,t)=>{let n=ni(t),r=n.receiveCache.get(e.id);if(r!==void 0)return r;let i=n.idToSent.get(e.id)?.deref();if(i!==void 0)return i;if(!(`inner`in e)||e.inner===void 0)throw Error(`osra identity: received id=${e.id} with no inner payload and no cached value`);let a=ca(e.inner,t);return n.receiveCache.set(e.id,a),Xr(a)&&n.revivedToId.set(a,e.id),a},li=W({box:()=>di,isType:()=>ui,revive:()=>fi,type:()=>`map`}),ui=e=>e instanceof Map,di=(e,t)=>({...G,type:`map`,entries:Array.from(e,([e,n])=>[sa(e,t),sa(n,t)])}),fi=(e,t)=>new Map(e.entries.map(([e,n])=>[ca(e,t),ca(n,t)])),pi=W({box:()=>hi,isType:()=>mi,revive:()=>gi,type:()=>`set`}),mi=e=>e instanceof Set,hi=(e,t)=>({...G,type:`set`,values:Array.from(e,e=>sa(e,t))}),gi=(e,t)=>new Set(e.values.map(e=>ca(e,t))),_i=W({box:()=>bi,isType:()=>yi,revive:()=>xi,type:()=>vi}),vi=`bigint`,yi=e=>typeof e==`bigint`,bi=(e,t)=>({...G,type:vi,value:e.toString()}),xi=(e,t)=>BigInt(e.value),Si=W({box:()=>Ti,isType:()=>wi,revive:()=>Ei,type:()=>Ci}),Ci=`event`,wi=e=>e instanceof Event,Ti=(e,t)=>({...G,type:Ci,eventType:e.type,bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed,...e instanceof CustomEvent?{detail:sa(e.detail,t)}:{}}),Ei=(e,t)=>{let n={bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed};return`detail`in e?new CustomEvent(e.eventType,{...n,detail:ca(e.detail,t)}):new Event(e.eventType,n)},Di=W({box:()=>Ai,isType:()=>ki,revive:()=>Pi,type:()=>Oi}),Oi=`eventTarget`,ki=e=>e instanceof EventTarget,Ai=(e,t)=>{let n=[],r=e=>typeof e==`boolean`?e:!!e?.capture;return{...G,type:Oi,addListener:fr((t,i,a)=>{n.push({eventType:t,listener:i,capture:r(a)}),e.addEventListener(t,i,a)},t),removeListener:fr((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:fr(()=>{for(let{eventType:t,listener:r,capture:i}of n.splice(0))e.removeEventListener(t,r,{capture:i})},t)}},ji=new WeakMap,Mi=e=>{if(typeof e==`function`)return e;let t=ji.get(e);return t||ji.set(e,t=t=>e.handleEvent(t)),t},Ni=(e,t,n,r)=>e.find(e=>e.eventType===t&&e.listener===n&&e.capture===r),Pi=(e,t)=>{let n=pr(e.addListener,t),r=pr(e.removeListener,t),i=pr(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=Mi(t),a=typeof r==`boolean`?r:!!r?.capture;if(Ni(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,ei(c),r).catch(()=>{})}}),Object.defineProperty(a,"removeEventListener",{value:(e,t,n)=>{if(t===null)return;let i=Mi(t),a=typeof n==`boolean`?n:!!n?.capture,c=Ni(o,e,i,a);c&&(s(c),r(e,ei(c.wire),{capture:a}).catch(()=>{}))}}),Mn(a,()=>{i().catch(()=>{})}),a},Fi=W({box:()=>Ri,isType:()=>Li,revive:()=>zi,type:()=>Ii}),Ii=`symbol`,Li=e=>typeof e==`symbol`,Ri=(e,t)=>{let n=Symbol.keyFor(e);return n===void 0?si(e,{...G,type:Ii,description:e.description},t):{...G,type:Ii,registryKey:n}},zi=(e,t)=>`registryKey`in e?Symbol.for(e.registryKey):Symbol(e.description),Bi=W({box:()=>Ui,isType:()=>Hi,revive:()=>Wi,type:()=>Vi}),Vi=`asyncIterator`,Hi=e=>!e||typeof e!=`object`||typeof ReadableStream<`u`&&e instanceof ReadableStream?!1:typeof e[Symbol.asyncIterator]==`function`,Ui=(e,t)=>{let n=e[Symbol.asyncIterator]();return{...G,type:Vi,next:fr((e=>n.next(e)),t),return:fr((e=>n.return?.(e)??Promise.resolve({done:!0,value:e})),t),throw:fr((e=>n.throw?.(e)??Promise.reject(e)),t)}},Wi=(e,t)=>{let n=pr(e.next,t),r=pr(e.return,t),i=pr(e.throw,t),a={next:(...e)=>n(...e),return:e=>r(e),throw:e=>i(e),[Symbol.asyncIterator]:()=>a};return a},Gi=[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],Ki=[globalThis.CropTarget,globalThis.EncodedAudioChunk,globalThis.EncodedVideoChunk,globalThis.FencedFrameConfig,globalThis.GPUCompilationInfo,globalThis.GPUCompilationMessage,globalThis.GPUPipelineError,globalThis.RTCEncodedAudioFrame,globalThis.RTCEncodedVideoFrame,globalThis.WebTransportError],qi={type:`clonable`,capableOnly:!0,isType:e=>vt(e,Gi)||vt(e,Ki),box:(e,t)=>e,revive:(e,t)=>e},Ji=[globalThis.ImageBitmap,globalThis.OffscreenCanvas,globalThis.WritableStream,globalThis.TransformStream,globalThis.MediaStreamTrack,globalThis.RTCDataChannel],Yi=[globalThis.AudioData,globalThis.VideoFrame,globalThis.MediaSourceHandle,globalThis.MIDIAccess,globalThis.WebTransportReceiveStream,globalThis.WebTransportSendStream],Xi={type:`transferable`,capableOnly:!0,isType:e=>vt(e,Ji)||vt(e,Yi),box:(e,t)=>e,revive:(e,t)=>e},Zi={type:`blob`,capableOnly:!0,isType:e=>typeof Blob<`u`&&e instanceof Blob,box:(e,t)=>{if(kt(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},Qi=e=>{if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},$i=[gn,Kr,zt,Wt,Yt,en,sn,tr,cr,Nn,mr,Tr,Ar,Ir,Vr,li,pi,_i,Fi,Si,Bi,{type:`nonFiniteNumber`,isType:e=>typeof e==`number`&&!Number.isFinite(e),box:(e,t)=>kt(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)=>kt(t.transport)?{...G,type:`undefined`}:e,revive:(e,t)=>void 0},qi,Xi,Zi,Di,{type:`unclonable`,isType:e=>{if(typeof e!=`object`||!e||Array.isArray(e)||Qi(e))return!1;try{return structuredClone(e),!1}catch{return!0}},box:(e,t)=>({...G,type:`unclonable`}),revive:(e,t)=>({})}],ea=(e,t)=>t.find(t=>t.isType(e)),ta=(e,t)=>t.find(t=>t.type===e.type),na=e=>!!e&&typeof e==`object`&&Object.getPrototypeOf(e)===Object.prototype,ra=(e,t)=>Array.isArray(e)?e.map(e=>t(e)):na(e)?Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n)])):e,ia=new WeakSet,aa=new WeakSet,oa=e=>e!==null&&(typeof e==`object`||typeof e==`function`),sa=(e,t)=>{if(It(e))return e;let n=oa(e);if(n){if(ia.has(e))throw TypeError(`osra: cannot serialize a circular structure - break the cycle or send the container by reference`);ia.add(e)}try{let n=ea(e,t.revivableModules);return n?n.box(e,t):ra(e,e=>sa(e,t))}finally{n&&ia.delete(e)}},ca=(e,t)=>{let n=oa(e);if(n){if(aa.has(e))throw TypeError(`osra: cannot revive a circular structure`);aa.add(e)}try{if(It(e)){let n=ta(e,t.revivableModules);if(n)return n.revive(e,t)}return ra(e,e=>ca(e,t))}finally{n&&aa.delete(e)}},la=W({init:()=>fa,startBidirectionalConnection:()=>da,type:()=>ua}),ua=`bidirectional`,da=({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:sa(t,o)}),{revivableContext:o,remoteValue:s.then(e=>ca(e,o))}},fa=e=>{if(!(At(e.transport)&&jt(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=da({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),hn(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=da({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()},pa=()=>new EventTarget,ma=e=>{let t=Ft(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&&kt(n)||r!==void 0&&kt(r),...n===void 0?{}:{emit:n},...r===void 0?{}:{receive:r}}},ha=e=>e?e($i):$i,ga=32,_a=()=>{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>ga&&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())}}}}},va=(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})},ya=Symbol.for(`osra.context`),ba=e=>typeof e==`object`&&!!e&&ya in e,xa=[la],Sa=(e,{transport:t,name:n,remoteName:r,key:i=Xe,origin:a=`*`,unregisterSignal:o,revivableModules:s,uuid:c,remoteUuid:l,connection:u=({value:e})=>e})=>{let d=u,f=ma(t);if(!(At(f)&&jt(f))){let e=_a();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(()=>{}),va(t,e,d)}let p=ha(s),m=new Map,h=new Set,g=_a(),{promise:_,resolve:v,reject:y}=Promise.withResolvers();_.catch(()=>{});let b=c??globalThis.crypto.randomUUID(),x=(e,t=a)=>{let r={[Ye]:i,name:n,uuid:b,...e};rt(f,r,t,On(r))},S=(e,t)=>{o?.aborted||x(e,t)},C=pa(),w={transport:f,valueFor:t=>ba(e)?e[ya](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}),hn(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:pa,unregisterSignal:o};if(nt({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(),va(_,g,d);o?.addEventListener(`abort`,()=>{for(let[e,t]of m)x({type:`close`,remoteUuid:e}),hn(t.connection.revivableContext);m.clear(),g.close(),y(o.reason)},{once:!0});for(let e of xa)e.init(w);return va(_,g,d)},Ca=(e,t)=>Sa(e,t),wa=e=>new Promise((t,n)=>{if(e.aborted)return n();e.addEventListener(`abort`,()=>{n()})}),Ta=async({publicPath:e,workerUrl:t,workerOptions:n,read:r,length:i,bufferSize:a,audioStreamIndex:o,transferReads:s=!0})=>{let c=new Worker(t,n),{makeRemuxer:l}=await Ca({},{transport:c}),u=await l({publicPath:e,length:i,bufferSize:a,audioStreamIndex:o}),d=new qe({concurrency:1}),f=!1,p=(e,t)=>{f||!s||e.byteLength>0||t>=i||(f=!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.`))},m=e=>(t,n)=>e.signal.aborted?Promise.resolve({resolved:new Uint8Array().buffer,rejected:!0}):Promise.race([r(Number(t),Number(n)).then(e=>{p(e,Number(t));let n=new Uint8Array(e).buffer;return{resolved:s?Sn(n):n,rejected:!1}},()=>({resolved:new Uint8Array().buffer,rejected:!0})),wa(e.signal).then(()=>({resolved:new Uint8Array().buffer,rejected:!0}),()=>({resolved:new Uint8Array().buffer,rejected:!0}))]),h=[];return{worker:c,remuxer:u,wasmRead:m,addTask:e=>{let t=[...h];h=[],d.clear(),t.forEach(e=>e.abort());let n=new AbortController;return h=[...h,n],Promise.race([d.add(async()=>e(n),{signal:n.signal}),wa(n.signal).then(()=>Promise.reject(Error(`Cancelled`)),()=>Promise.reject(Error(`Cancelled`)))])},destroy:async()=>{let e=[...h];h=[],d.clear(),e.forEach(e=>e.abort()),await u.destroy(),c.terminate()}}},Ea=async e=>{let{worker:t,remuxer:n,wasmRead:r,addTask:i,destroy:a}=await Ta({...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)}},Da=async e=>{let{worker:t,remuxer:n,wasmRead:r,addTask:i,destroy:a}=await Ta({...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}},Oa=typeof HTMLVideoElement<`u`?HTMLVideoElement.prototype:{},ka=`getVideoPlaybackQuality`in Oa||`webkitDecodedFrameCount`in Oa||`mozPresentedFrames`in Oa||`mozPaintedFrames`in Oa;if(!(`requestVideoFrameCallback`in Oa)&&ka&&typeof requestAnimationFrame==`function`){Oa._rvfcpolyfillmap={};let e=`getVideoPlaybackQuality`in Oa?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});Oa.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},Oa.cancelVideoFrameCallback=function(e){cancelAnimationFrame(this._rvfcpolyfillmap[e]),delete this._rvfcpolyfillmap[e]}}var Aa={bt709:`BT709`,bt470bg:`BT601`,smpte170m:`BT601`},ja={BT601:{BT709:`1.0863 -0.0723 -0.014 0 0 0.0965 0.8451 0.0584 0 0 -0.0141 -0.0277 1.0418`},BT709:{BT601:`0.9137 0.0784 0.0079 0 0 -0.1049 1.1722 -0.0671 0 0 0.0096 0.0322 0.9582`},FCC:{BT709:`1.0873 -0.0736 -0.0137 0 0 0.0974 0.8494 0.0531 0 0 -0.0127 -0.0251 1.0378`,BT601:`1.001 -0.0008 -0.0002 0 0 0.0009 1.005 -0.006 0 0 0.0013 0.0027 0.996`},SMPTE240M:{BT709:`0.9993 0.0006 0.0001 0 0 -0.0004 0.9812 0.0192 0 0 -0.0034 -0.0114 1.0148`,BT601:`0.913 0.0774 0.0096 0 0 -0.1051 1.1508 -0.0456 0 0 0.0063 0.0207 0.973`}},Ma=class e extends EventTarget{constructor(t){if(super(),!globalThis.Worker)throw this.destroy(`Worker not supported`);if(!t)throw this.destroy(`No options provided`);this._loaded=new Promise(e=>{this._init=e});let n=e._test();if(this._onDemandRender=`requestVideoFrameCallback`in HTMLVideoElement.prototype&&(t.onDemandRender??!0),this._offscreenRender=`transferControlToOffscreen`in HTMLCanvasElement.prototype&&!t.canvas&&(t.offscreenRender??!0),this.timeOffset=t.timeOffset||0,this._video=t.video,this._videoHeight=0,this._videoWidth=0,this._videoColorSpace=null,this._canvas=t.canvas,this._video&&!this._canvas)this._canvasParent=document.createElement(`div`),this._canvasParent.className=`JASSUB`,this._canvasParent.style.position=`relative`,this._canvas=this._createCanvas(),this._video.insertAdjacentElement(`afterend`,this._canvasParent);else if(!this._canvas)throw this.destroy(`Don't know where to render: you should give video or canvas in options.`);if(this._bufferCanvas=document.createElement(`canvas`),this._bufferCtx=this._bufferCanvas.getContext(`2d`),!this._bufferCtx)throw this.destroy(`Canvas rendering not supported`);this._canvasctrl=this._offscreenRender?this._canvas.transferControlToOffscreen():this._canvas,this._ctx=!this._offscreenRender&&this._canvasctrl.getContext(`2d`),this._lastRenderTime=0,this.debug=!!t.debug,this.prescaleFactor=t.prescaleFactor||1,this.prescaleHeightLimit=t.prescaleHeightLimit||1080,this.maxRenderHeight=t.maxRenderHeight||0,this._boundResize=this.resize.bind(this),this._boundTimeUpdate=this._timeupdate.bind(this),this._boundSetRate=this.setRate.bind(this),this._boundUpdateColorSpace=this._updateColorSpace.bind(this),this._video&&this.setVideo(t.video),this._onDemandRender&&(this.busy=!1,this._lastDemandTime=null),this._worker=new Worker(t.workerUrl||`jassub-worker.js`),this._worker.onmessage=e=>this._onmessage(e),this._worker.onerror=e=>this._error(e),n.then(()=>{this._worker.postMessage({target:`init`,wasmUrl:e._supportsSIMD&&t.modernWasmUrl?t.modernWasmUrl:t.wasmUrl??`jassub-worker.wasm`,legacyWasmUrl:t.legacyWasmUrl??`jassub-worker.wasm.js`,asyncRender:typeof createImageBitmap<`u`&&(t.asyncRender??!0),onDemandRender:this._onDemandRender,width:this._canvasctrl.width||0,height:this._canvasctrl.height||0,blendMode:t.blendMode||`js`,subUrl:t.subUrl,subContent:t.subContent||null,fonts:t.fonts||[],availableFonts:t.availableFonts||{"liberation sans":`./default.woff2`},fallbackFont:t.fallbackFont||`liberation sans`,debug:this.debug,targetFps:t.targetFps||24,dropAllAnimations:t.dropAllAnimations,dropAllBlur:t.dropAllBlur,libassMemoryLimit:t.libassMemoryLimit||0,libassGlyphLimit:t.libassGlyphLimit||0,useLocalFonts:typeof queryLocalFonts<`u`&&(t.useLocalFonts??!0),hasBitmapBug:e._hasBitmapBug}),this._offscreenRender===!0&&this.sendMessage(`offscreenCanvas`,null,[this._canvasctrl])})}_createCanvas(){return this._canvas=document.createElement(`canvas`),this._canvas.style.display=`block`,this._canvas.style.position=`absolute`,this._canvas.style.pointerEvents=`none`,this._canvasParent.appendChild(this._canvas),this._canvas}static _supportsSIMD=null;static _hasAlphaBug=null;static _hasBitmapBug=null;static _testSIMD(){if(e._supportsSIMD===null)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,10,1,8,0,65,0,253,15,253,98,11))}catch{e._supportsSIMD=!1}}static async _testImageBugs(){if(e._hasBitmapBug!==null)return;let t=document.createElement(`canvas`),n=t.getContext(`2d`,{willReadFrequently:!0});if(!n)throw Error(`Canvas rendering not supported`);if(typeof ImageData.prototype.constructor==`function`)try{new ImageData(new Uint8ClampedArray([0,0,0,0]),1,1)}catch{console.log(`Detected that ImageData is not constructable despite browser saying so`),self.ImageData=function(e,t,r){let i=n.createImageData(t,r);return e&&i.data.set(e),i}}let r=document.createElement(`canvas`),i=r.getContext(`2d`,{willReadFrequently:!0});if(!i)throw Error(`Canvas rendering not supported`);t.width=r.width=1,t.height=r.height=1,n.clearRect(0,0,1,1),i.clearRect(0,0,1,1);let a=i.getImageData(0,0,1,1).data;n.putImageData(new ImageData(new Uint8ClampedArray([0,255,0,0]),1,1),0,0),i.drawImage(t,0,0);let o=i.getImageData(0,0,1,1).data;if(e._hasAlphaBug=a[1]!==o[1],e._hasAlphaBug&&console.log(`Detected a browser having issue with transparent pixels, applying workaround`),typeof createImageBitmap<`u`){let t=new Uint8ClampedArray([255,0,255,0,255]).subarray(1,5);i.drawImage(await createImageBitmap(new ImageData(t,1)),0,0);let{data:n}=i.getImageData(0,0,1,1);e._hasBitmapBug=!1;for(let[r,i]of n.entries())if(Math.abs(t[r]-i)>15){e._hasBitmapBug=!0,console.log(`Detected a browser having issue with partial bitmaps, applying workaround`);break}}else e._hasBitmapBug=!1;t.remove(),r.remove()}static async _test(){e._testSIMD(),await e._testImageBugs()}resize(e=0,t=0,n=0,r=0,i=this._video?.paused){if((!e||!t)&&this._video){let i=this._getVideoPosition(),a=null;if(this._videoWidth){let e=this._video.videoWidth/this._videoWidth,t=this._video.videoHeight/this._videoHeight;a=this._computeCanvasSize((i.width||0)/e,(i.height||0)/t)}else a=this._computeCanvasSize(i.width||0,i.height||0);e=a.width,t=a.height,this._canvasParent&&(n=i.y-(this._canvasParent.getBoundingClientRect().top-this._video.getBoundingClientRect().top),r=i.x),this._canvas.style.width=i.width+`px`,this._canvas.style.height=i.height+`px`}this._canvas.style.top=n+`px`,this._canvas.style.left=r+`px`,i&&this.busy===!1?this.busy=!0:i=!1,this.sendMessage(`canvas`,{width:e,height:t,videoWidth:this._videoWidth||this._video.videoWidth,videoHeight:this._videoHeight||this._video.videoHeight,force:i})}_getVideoPosition(e=this._video.videoWidth,t=this._video.videoHeight){let n=e/t,{offsetWidth:r,offsetHeight:i}=this._video,a=r/i;e=r,t=i,a>n?e=Math.floor(i*n):t=Math.floor(r/n);let o=(r-e)/2,s=(i-t)/2;return{width:e,height:t,x:o,y:s}}_computeCanvasSize(e=0,t=0){let n=this.prescaleFactor<=0?1:this.prescaleFactor,r=self.devicePixelRatio||1;if(t<=0||e<=0)e=0,t=0;else{let i=n<1?-1:1,a=t*r;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}return{width:e,height:t}}_timeupdate({type:e}){let t={seeking:!0,waiting:!0,playing:!1}[e];t!=null&&(this._playstate=t),this.setCurrentTime(this._video.paused||this._playstate,this._video.currentTime+this.timeOffset)}setVideo(e){e instanceof HTMLVideoElement?(this._removeListeners(),this._video=e,this._onDemandRender?this._video.requestVideoFrameCallback(this._handleRVFC.bind(this)):(this._playstate=e.paused,e.addEventListener(`timeupdate`,this._boundTimeUpdate,!1),e.addEventListener(`progress`,this._boundTimeUpdate,!1),e.addEventListener(`waiting`,this._boundTimeUpdate,!1),e.addEventListener(`seeking`,this._boundTimeUpdate,!1),e.addEventListener(`playing`,this._boundTimeUpdate,!1),e.addEventListener(`ratechange`,this._boundSetRate,!1),e.addEventListener(`resize`,this._boundResize,!1)),`VideoFrame`in window&&(e.addEventListener(`loadedmetadata`,this._boundUpdateColorSpace,!1),e.readyState>2&&this._updateColorSpace()),e.videoWidth>0&&this.resize(),typeof ResizeObserver<`u`&&(this._ro||=new ResizeObserver(()=>this.resize()),this._ro.observe(e))):this._error(`Video element invalid!`)}runBenchmark(){this.sendMessage(`runBenchmark`)}setTrackByUrl(e){this.sendMessage(`setTrackByUrl`,{url:e}),this._reAttachOffscreen(),this._ctx&&(this._ctx.filter=`none`)}setTrack(e){this.sendMessage(`setTrack`,{content:e}),this._reAttachOffscreen(),this._ctx&&(this._ctx.filter=`none`)}freeTrack(){this.sendMessage(`freeTrack`)}setIsPaused(e){this.sendMessage(`video`,{isPaused:e})}setRate(e){this.sendMessage(`video`,{rate:e})}setCurrentTime(e,t,n){this.sendMessage(`video`,{isPaused:e,currentTime:t,rate:n,colorSpace:this._videoColorSpace})}createEvent(e){this.sendMessage(`createEvent`,{event:e})}setEvent(e,t){this.sendMessage(`setEvent`,{event:e,index:t})}removeEvent(e){this.sendMessage(`removeEvent`,{index:e})}getEvents(e){this._fetchFromWorker({target:`getEvents`},(t,{events:n})=>{e(t,n)})}styleOverride(e){this.sendMessage(`styleOverride`,{style:e})}disableStyleOverride(){this.sendMessage(`disableStyleOverride`)}createStyle(e){this.sendMessage(`createStyle`,{style:e})}setStyle(e,t){this.sendMessage(`setStyle`,{style:e,index:t})}removeStyle(e){this.sendMessage(`removeStyle`,{index:e})}getStyles(e){this._fetchFromWorker({target:`getStyles`},(t,{styles:n})=>{e(t,n)})}addFont(e){this.sendMessage(`addFont`,{font:e})}setDefaultFont(e){this.sendMessage(`defaultFont`,{font:e})}_sendLocalFont(e){try{queryLocalFonts().then(t=>{let n=t?.find(t=>t.fullName.toLowerCase()===e);n&&n.blob().then(e=>{e.arrayBuffer().then(e=>{this.addFont(new Uint8Array(e))})})})}catch(e){console.warn(`Local fonts API:`,e)}}_getLocalFont({font:e}){try{navigator?.permissions?.query?navigator.permissions.query({name:`local-fonts`}).then(t=>{t.state===`granted`&&this._sendLocalFont(e)}):this._sendLocalFont(e)}catch(e){console.warn(`Local fonts API:`,e)}}_unbusy(){this._lastDemandTime?this._demandRender(this._lastDemandTime):this.busy=!1}_handleRVFC(e,{mediaTime:t,width:n,height:r}){if(this._destroyed)return null;this.busy?this._lastDemandTime={mediaTime:t,width:n,height:r}:(this.busy=!0,this._demandRender({mediaTime:t,width:n,height:r})),this._video.requestVideoFrameCallback(this._handleRVFC.bind(this))}_demandRender({mediaTime:e,width:t,height:n}){this._lastDemandTime=null,(t!==this._videoWidth||n!==this._videoHeight)&&(this._videoWidth=t,this._videoHeight=n,this.resize()),this.sendMessage(`demand`,{time:e+this.timeOffset})}_detachOffscreen(){if(!this._offscreenRender||this._ctx)return null;this._canvas.remove(),this._createCanvas(),this._canvasctrl=this._canvas,this._ctx=this._canvasctrl.getContext(`2d`),this.sendMessage(`detachOffscreen`),this.busy=!1,this.resize(0,0,0,0,!0)}_reAttachOffscreen(){if(!this._offscreenRender||!this._ctx)return null;this._canvas.remove(),this._createCanvas(),this._canvasctrl=this._canvas.transferControlToOffscreen(),this._ctx=!1,this.sendMessage(`offscreenCanvas`,null,[this._canvasctrl]),this.resize(0,0,0,0,!0)}_updateColorSpace(){this._video.requestVideoFrameCallback(()=>{try{let e=new VideoFrame(this._video);this._videoColorSpace=Aa[e.colorSpace.matrix],e.close(),this.sendMessage(`getColorSpace`)}catch(e){console.warn(e)}})}_verifyColorSpace({subtitleColorSpace:e,videoColorSpace:t=this._videoColorSpace}){e&&t&&e!==t&&(this._detachOffscreen(),this._ctx.filter=`url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg'><filter id='f'><feColorMatrix type='matrix' values='${ja[e][t]} 0 0 0 0 0 1 0'/></filter></svg>#f")`)}_render({images:e,asyncRender:t,times:n,width:r,height:i,colorSpace:a}){this._unbusy(),this.debug&&(n.IPCTime=Date.now()-n.JSRenderTime),(this._canvasctrl.width!==r||this._canvasctrl.height!==i)&&(this._canvasctrl.width=r,this._canvasctrl.height=i,this._verifyColorSpace({subtitleColorSpace:a})),this._ctx.clearRect(0,0,this._canvasctrl.width,this._canvasctrl.height);for(let n of e)n.image&&(t?(this._ctx.drawImage(n.image,n.x,n.y),n.image.close()):(this._bufferCanvas.width=n.w,this._bufferCanvas.height=n.h,this._bufferCtx.putImageData(new ImageData(this._fixAlpha(new Uint8ClampedArray(n.image)),n.w,n.h),0,0),this._ctx.drawImage(this._bufferCanvas,n.x,n.y)));if(this.debug){n.JSRenderTime=Date.now()-n.JSRenderTime-n.IPCTime;let t=0,r=n.bitmaps||e.length;delete n.bitmaps;for(let e in n)t+=n[e];console.log(`Bitmaps: `+r+` Total: `+(t|0)+`ms`,n)}}_fixAlpha(t){if(e._hasAlphaBug)for(let e=3;e<t.length;e+=4)t[e]=t[e]>1?t[e]:1;return t}_ready(){this._init(),this.dispatchEvent(new CustomEvent(`ready`))}async sendMessage(e,t={},n){await this._loaded,n?this._worker.postMessage({target:e,transferable:n,...t},[...n]):this._worker.postMessage({target:e,...t})}_fetchFromWorker(e,t){try{let n=e.target,r=setTimeout(()=>{a(Error(`Error: Timeout while try to fetch `+n))},5e3),i=({data:e})=>{e.target===n&&(t(null,e),this._worker.removeEventListener(`message`,i),this._worker.removeEventListener(`error`,a),clearTimeout(r))},a=e=>{t(e),this._worker.removeEventListener(`message`,i),this._worker.removeEventListener(`error`,a),clearTimeout(r)};this._worker.addEventListener(`message`,i),this._worker.addEventListener(`error`,a),this._worker.postMessage(e)}catch(e){this._error(e)}}_console({content:e,command:t}){console[t].apply(console,JSON.parse(e))}_onmessage({data:e}){this[`_`+e.target]&&this[`_`+e.target](e)}_error(e){let t=e instanceof Error?e:e instanceof ErrorEvent?e.error:Error(e),n=e instanceof Event?new ErrorEvent(e.type,e):new ErrorEvent(`error`,{error:t});return this.dispatchEvent(n),console.error(t),t}_removeListeners(){this._video&&(this._ro&&this._ro.unobserve(this._video),this._ctx&&(this._ctx.filter=`none`),this._video.removeEventListener(`timeupdate`,this._boundTimeUpdate),this._video.removeEventListener(`progress`,this._boundTimeUpdate),this._video.removeEventListener(`waiting`,this._boundTimeUpdate),this._video.removeEventListener(`seeking`,this._boundTimeUpdate),this._video.removeEventListener(`playing`,this._boundTimeUpdate),this._video.removeEventListener(`ratechange`,this._boundSetRate),this._video.removeEventListener(`resize`,this._boundResize),this._video.removeEventListener(`loadedmetadata`,this._boundUpdateColorSpace))}destroy(e){return e&&=this._error(e),this._video&&this._canvasParent&&this._video.parentNode?.removeChild(this._canvasParent),this._destroyed=!0,this._removeListeners(),this.sendMessage(`destroy`),this._worker?.terminate(),e}};function Na(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 Pa(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 Fa=`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 Ia(e){for(var t,n={},r=0;r<Fa.length;r++){var i=Fa[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=Pa(m[0])),m.length===2&&(n.clip.scale=m[0]*1,n.clip.drawing=Pa(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(Ia)},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 La(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(Ia)}function Ra(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=La(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?Pa(t[r+1]):[]})}return{raw:e,combined:n.map(function(e){return e.text}).join(``),parsed:n}}function za(e){var t=e.split(`:`);return t[0]*3600+t[1]*60+t[2]*1}function Ba(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]=za(s);break;case`Effect`:i[o]=Na(s);break;case`Text`:i[o]=Ra(s);break;default:i[o]=s}}return i}var Va=[`Name`,`Fontname`,`Fontsize`,`PrimaryColour`,`SecondaryColour`,`OutlineColour`,`BackColour`,`Bold`,`Italic`,`Underline`,`StrikeOut`,`ScaleX`,`ScaleY`,`Spacing`,`Angle`,`BorderStyle`,`Outline`,`Shadow`,`Alignment`,`MarginL`,`MarginR`,`MarginV`,`Encoding`],Ha=[`Layer`,`Start`,`End`,`Style`,`Name`,`MarginL`,`MarginR`,`MarginV`,`Effect`,`Text`];function Ua(e){var t=Va.concat(Ha);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 Wa(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 Ga(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=Ua(a)),/^Style\s*:/i.test(a)&&t.styles.style.push(Wa(a,t.styles.format))),r===3&&(/^Format\s*:/i.test(a)&&(t.events.format=Ua(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(Ba(d,t.events.format))}}}return t}var Ka={M:`m`,L:`l`,C:`b`};function qa(e){return e.instructions.map(function(e){var t,n=e.type,r=e.points;return(t=[Ka[n]]).concat.apply(t,r.map(function(e){return[e.x,e.y]})).join(` `)}).join(` `)}var Ja=function(e){return function(t){return function(n){return``+t+e+`&H`+n+`&`}}},Ya=Ja(`c`),Xa=Ja(`a`),Za={c1:Ya(1),c2:Ya(2),c3:Ya(3),c4:Ya(4),a1:Xa(1),a2:Xa(2),a3:Xa(3),a4:Xa(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+`,`)+qa(e.drawing))+`)`},t:function(e){return e.map(function(e){return`t(`+[e.t1,e.t2,e.accel,Qa(e.tag)]+`)`}).join(`\\`)}};function Qa(e){return Object.keys(e).map(function(t){return`\\`+(Za[t]||(function(e){return``+t+e}))(e[t])}).join(``)}var $a=e=>Array(e.buffered.length).fill(void 0).map((t,n)=>({index:n,start:e.buffered.start(n),end:e.buffered.end(n)})),eo=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})}),to=(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),eo(e))),unbufferRange:(t,n)=>r(()=>t>=n?Promise.resolve():(e.remove(t,n),eo(e))),updateTimestampOffset:t=>r(async()=>{e.timestampOffset=t}),endOfStream:()=>r(async()=>{if(!(t.readyState!==`open`||e.updating))try{t.endOfStream()}catch{}})}},no=(e,t)=>e.createEvent(t),ro=e=>e===void 0?void 0:new URL(e,document.baseURI).toString(),io=e=>new Date(e).toISOString().slice(11,22),ao=1,oo=e=>new Map(Ga(e).styles.style.map((e,t)=>[e.Name,t+ao])),so=(e,t)=>{let n=t.replace(/^\*+/,``),r=n.toLowerCase()==="default"?`Default`:n;return e.styles.get(r)??e.styles.get(`Default`)??0},co=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:oo(e.content)}:(console.warn(`subtitle stream ${e.streamIndex} has no Events format, ignoring the track`),null)},lo=(e,t)=>{let[n,r]=t.content.split(`,`),i=Number(n),a=`Dialogue: ${r},${io(t.start)},${io(t.end)},${t.content.replace(`${i},${r},`,``)}`,o=Ga(`${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:{...o,Style:so(e,o.Style),Effect:o.Effect??``,Text:o.Text.raw,Duration:(o.End-o.Start)*1e3,Start:o.Start*1e3,End:o.End*1e3,ReadOrder:i,_index:i}}},uo=e=>{let{video:t,canvas:n,workerUrl:r}=e,i=ro(e.wasmUrl),a=ro(e.legacyWasmUrl),o=ro(e.defaultFontUrl),s,c=[],l=new Map,u=[],d=new Map,f,p=e.onStreams,m=setInterval(()=>{s?.setCurrentTime(t.paused,t.currentTime,t.playbackRate)},100),h=()=>s?.setRate(t.playbackRate),g=e=>{s=new Ma({onDemandRender:!1,video:t,canvas:n,subContent:e.content,workerUrl:r,modernWasmUrl:i,...a?{wasmUrl:a}:{},fonts:c.map(([,e])=>e),availableFonts:{...Object.fromEntries(c),...o?{"liberation sans":o}:{}}}),t.removeEventListener(`ratechange`,s._boundSetRate),t.addEventListener(`ratechange`,h)};return{pushAttachments:e=>{c=[...c,...e.map(e=>[e.filename,new Uint8Array(e.data)])]},pushFragments:e=>{for(let t of e)if(t.type===`header`){if(l.has(t.streamIndex))continue;let e=co(t);if(!e)continue;l.set(t.streamIndex,e),u.push({streamIndex:t.streamIndex,title:t.title,language:t.language}),p?.([...u]),f===void 0&&(f=t.streamIndex),s||g(e)}else{let e=l.get(t.streamIndex);if(!e)continue;let n=d.get(t.streamIndex);n||(n=new Map,d.set(t.streamIndex,n));let r=lo(e,t);if(n.has(r.index))continue;n.set(r.index,r),f===t.streamIndex&&s&&no(s,r.assEvent)}},selectStream:e=>{let n=e??-1;if(n===f||!s)return;f=n,s.freeTrack();let r=l.get(n);if(r){s.setTrack(r.content);for(let e of d.get(n)?.values()??[])no(s,e.assEvent);s.setCurrentTime(t.paused,t.currentTime,t.playbackRate)}},getStreams:()=>[...u],getSelectedStream:()=>f,setOnStreams:e=>{p=e},destroy:()=>{clearInterval(m),t.removeEventListener(`ratechange`,h),s?.destroy(),s=void 0}}},fo=class extends Error{mediaElement=!0;constructor(e,t){super(e,t),this.name=`MediaElementError`}},po=e=>!!e&&typeof e==`object`&&e.mediaElement===!0,mo=-20,ho=60,go=30,_o=-5,vo=20,yo=5,bo=15e3,xo=1,So=3,Co=12,wo=200,To=250,Eo=25e5,Do=e=>{let{worker:t}=e,n=setTimeout(()=>t.terminate(),2e3);e.destroy().catch(()=>{}).finally(()=>{clearTimeout(n),t.terminate()})},Oo=async e=>{let{videoElement:t,canvasElement:n,read:r,length:i,publicPath:a,libavWorkerUrl:o,jassubWorkerUrl:s,jassubWasmUrl:c,jassubLegacyWasmUrl:l,defaultFontUrl:u,bufferSize:d=Eo,audioStreamIndex:f,onReady:p,onError:m,onRecovered:h,onSeek:g,onSubtitleStreams:_,onAudioStreams:v}=e,y=await Ea({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(()=>Do(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=uo({video:t,canvas: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`))},bo),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}=to(T,C);await E(e.data),e.subtitles?.length&&a.pushFragments(e.subtitles),p?.();let A=!1,j=!1,ee=0,M,N=()=>M??t.currentTime,P=!1,F=0,I=0,L=null,te=0,ne=0,re=!1,ie=0,ae=(e,t,n=!1)=>{let r=e?.message===`Cancelled`;t&&r||(console.error(e),(!re||n)&&(re=!0,m?.(r?Error(`Reading the video file failed`,{cause:e}):e)))},oe=async(e=!1)=>{if(ee>0&&!e)return;let n=t.currentTime,r=e?_o:mo,i=e?vo:ho;for(let{start:e,end:t}of $a(T))e<n+r&&await D(e,n+r),t>n+i&&await D(n+i,t)},R=()=>{let e=$a(T);if(!e.length)return!0;let t=N(),n=e.find(e=>e.start<=t+xo&&t<e.end);return n&&n.end>=t+ho?!1:!n||n.end<t+go},se=()=>{let e=t.currentTime;return $a(T).find(t=>t.start<=e+xo&&e<t.end)},ce=()=>{let e=se();return!!e&&e.end>=ne-.1},le=()=>{let e=$a(T).map(e=>e.end);e.length&&(ne=Math.max(ne,...e))},ue=async e=>{j=!0,L=null,te=0,ie=e;let t=++I;try{let{data:n,pts:r,subtitles:i,finished:o}=await y.seek(e);if(x||t!==I||(o&&(P=!0),i?.length&&a.pushFragments(i),await O(r),x||t!==I))return;n.byteLength&&(await E(n),le())}catch(e){ae(e,x||t!==I)}finally{t===I&&(j=!1)}},de=async()=>{let e=L;if(e)try{await E(e),le(),L===e&&(L=null,te=0)}catch(n){if(L!==e)return;if(n?.name===`QuotaExceededError`){let n=await oe(!0).then(()=>!0,()=>!1);if(L!==e)return;if(n){P=!1,await ue(se()?.end??t.currentTime);return}}if(te+=1,te<yo)return;throw L=null,n}},fe=async()=>{if(A||j||B!==void 0||x||!L&&(P||!R()))return;let e=++F,t=I,n=()=>x||e!==F||t!==I;A=!0;try{if(!L){let{data:e,subtitles:t,finished:r}=await y.read();if(n()||(r&&(P=!0),t?.length&&a.pushFragments(t),!e.byteLength))return;L=e,te=0}await de(),!n()&&re&&(re=!1,h?.())}catch(e){ae(e,n())}finally{e===F&&(A=!1)}},pe=e=>e>=ie&&!!se(),me=e=>$a(T).some(t=>t.start<=e+xo&&e<t.end),he=e=>{let t=$a(T).find(t=>t.start<=e+xo&&e<t.end);return t?t.end-e:0},ge=async e=>{if(!x&&!(he(e)>=So)){P=!1,ee++,M=e;try{me(e)||await ue(e);let t=I;for(let n=0;n<Co&&!(x||t!==I||P||he(e)>=So);n++){let t=he(e);if(await fe(),he(e)<=t)break}}finally{ee--,M===e&&(M=void 0)}}},_e=0,ve=null,ye,z=e=>{let t=performance.now(),n=t-_e;if(n>=wo){_e=t,ve=null,g?.(e);return}ve=e,!ye&&(ye=setTimeout(()=>{ye=void 0;let e=ve;ve=null,!(e===null||x)&&(_e=performance.now(),g?.(e))},wo-n))};b.push(()=>{ye&&clearTimeout(ye)});let be=0,B;b.push(()=>{B&&clearTimeout(B)});let V=()=>{let n=t.currentTime,r=e.info.input.duration||t.duration;r>0&&z(Math.min(Math.max(n/r,0),1));let i=performance.now(),a=i-be<To;if(be=i,!pe(n)&&!(j&&Math.abs(n-ie)<.001)){if(P=!1,B&&clearTimeout(B),!a){B=void 0,ue(n);return}B=setTimeout(()=>{if(B=void 0,x)return;let e=t.currentTime;pe(e)||(P=!1,ue(e))},To)}};t.addEventListener(`seeking`,V),b.push(()=>t.removeEventListener(`seeking`,V));let H=!1,xe=()=>{if(H)return;H=!0;let e=t.error;ae(new fo(`the media element failed: ${e?.message??`unknown`}`,{cause:e}),!1,!0)};t.addEventListener(`error`,xe),b.push(()=>t.removeEventListener(`error`,xe));let Se=setInterval(()=>{H||t.error||(oe().catch(()=>{}),fe().catch(e=>ae(e,!1)),P&&!L&&ce()&&C.readyState===`open`&&k().catch(()=>{}))},100);return b.push(()=>clearInterval(Se)),{destroy:S,prepareSeek:ge,videoElement:t,selectSubtitleStream:e=>a.selectStream(e),indexes:e.indexes??[],duration:e.info.input.duration,videoMimeType:e.info.output.videoMimeType,audioMimeType:e.info.output.audioMimeType}}catch(e){throw S(),e}},ko=5,Ao=500,jo=320,Mo=1e6,No=3,Po=1e4,Fo=async e=>{let{publicPath:t,workerUrl:n,length:r,read:i,onThumbnails:a,width:o=jo}=e,s=await Da({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??ko,n/Ao),c=[];for(let[e,a]of t.indexes.entries()){let o=c.at(-1);o&&a.timestamp-o.timestamp<i||c.push({timestamp:a.timestamp,endTime:n,startByte:a.pos,endByte:Math.min((t.indexes[e+1]?.pos??r)+Mo,r),done:!1,attempts:0})}for(let[e,t]of c.entries())t.endTime=c[e+1]?.timestamp??n;c.length>1&&c.at(-1).timestamp>n-i*2&&c.pop();let l=[],u=!1,d=Promise.resolve(),f=()=>{let e=[];for(let[t,n]of l.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=l[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)},p=e=>{e.done=!0,d=d.then(async()=>{if(u)return;let t=await Promise.race([s.readKeyframe(e.timestamp),new Promise((e,t)=>setTimeout(()=>t(Error(`timed out`)),Po))]),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});u||(l=[...l,{url:URL.createObjectURL(i),startTime:e.timestamp,endTime:e.endTime}].sort((e,t)=>e.startTime-t.startTime),f())}).catch(()=>{e.attempts+=1,e.done=e.attempts>=No})};return f(),{update:e=>{if(!u)for(let t of c)t.done||(!e||e.some(([e,n])=>e<=t.startByte&&t.endByte<=n))&&p(t)},destroy:()=>{u=!0;for(let e of l)URL.revokeObjectURL(e.url);l=[],Do(s)}}}catch(e){throw Do(s),e}},Io=1280,Lo=1920,Ro=250,zo=100,Bo=()=>typeof HTMLCanvasElement<`u`&&`captureStream`in HTMLCanvasElement.prototype,Vo=()=>typeof document<`u`&&typeof HTMLVideoElement<`u`&&typeof HTMLVideoElement.prototype.requestPictureInPicture==`function`&&!!document.pictureInPictureEnabled,Ho=()=>typeof HTMLVideoElement<`u`&&`mozCaptureStream`in HTMLVideoElement.prototype,Uo=()=>Bo()?Vo()?`window`:Ho()?`burn-in`:null:null,Wo=e=>{let{video:t,canvas:n}=e,r=e.mode??Uo()??`window`,i=e.maxWidth??(r===`burn-in`?Lo:Io),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),n.width>0&&n.height>0&&r.drawImage(n,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,zo)})).catch(()=>{}).finally(()=>{e.pause(),setTimeout(()=>{l=!1},zo)})},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()},Ro),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 Go(e){return typeof e==`string`}function Ko(e){return typeof e==`number`}function K(e){return typeof e==`function`}function qo(e){return e===null}function q(e){return e===void 0}function Jo(e){return typeof e==`object`&&!!e}function Yo(e,t){let n={...t};for(let t in e)q(e[t])||(n[t]=e[t]);return n}function Xo(e,t){let n={};for(let r of t)Object.hasOwn(e,r)&&(n[r]=e[r]);return n}var Zo=Object.prototype.hasOwnProperty;function Qo(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(!Zo.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var $o=new Map,es=new Set;function ts(e){return e.trim().replaceAll(`_`,`-`).toLowerCase()}function ns(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 rs(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 is(e){return ns(ts(e))}function as(e){let t=is(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=rs(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 os(e){let t={};for(let n=e.length-1;n>=0;n--){let r=e[n],i=$o.get(r);i&&Object.assign(t,i)}return t}function ss(e){return os(as(e))}function cs(e){return es.add(e),()=>{es.delete(e)}}function ls(e){return typeof e==`string`?e:e.text}function us(e){return Jo(e)&&`key`in e&&`text`in e}var ds=/\{([^{}]+)\}/g;function fs(e,t){return t?e.replace(ds,(e,n)=>Object.hasOwn(t,n)?String(t[n]):e):e}function ps(e,t,n){return typeof e==`string`?e:typeof t==`function`?t(e,n):fs(ls(e),t??n)}function ms(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,fs(o??(i?t.text:s)??String(a),c)}}r();var hs=N(null);N(void 0);function gs(){let t=e(hs),[n,r]=P(e=>e+1,0);m(()=>cs(()=>r()),[]);let i=b(()=>ms(ss(`en`),`en`),[n]);return t?t.translator:i}function _s(){return e(hs)?.locale??`en`}function vs(e){let t=e.closest(`[dir]`)?.getAttribute(`dir`);return t?t.toLowerCase()===`rtl`:getComputedStyle(e).direction===`rtl`}function ys(e){let t=e.composedPath();return t.length>0?t[0]:e.target}function bs(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 xs(e=document){let t=e.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}function Ss(){return typeof CSS<`u`&&CSS.supports(`anchor-name: --a`)}var Cs=[`button`,`input`,`select`,`textarea`,`a[href]`,`[role="button"]`,`[role="menu"]`,`[role="menuitem"]`,`[role="menuitemcheckbox"]`,`[role="menuitemradio"]`,`[role="slider"]`,`[data-interactive]`].join(`,`),ws=[`textarea`,`select`,`input:not([type])`,...[`text`,`search`,`url`,`tel`,`email`,`password`,`number`].map(e=>`input[type="${e}"]`),`[contenteditable]:not([contenteditable="false"])`].join(`,`);function Ts(e){return e.matches(ws)}function Es(e){let t=ys(e);return t instanceof Element&&Ts(t)}function Ds(e){let t=ys(e);return t instanceof Element&&t.closest(Cs)!==null}var Os=new Set([` `,`Enter`]),ks=`button,a[href],[role="slider"],[role="button"]`;function As(e){if(!Os.has(e.key))return!1;let t=ys(e);return t instanceof Element&&t.matches(ks)}function J(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function js(){return typeof navigator<`u`&&/mac/i.test(navigator.userAgent)}var Ms={sideOffset:0,boundaryOffset:0},Ns={top:`bottom`,bottom:`top`,left:`right`,right:`left`};function Ps(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 Fs(e,t,n,r,i=Ms){let a=r.side,o=Ns[a],s=a===`top`||a===`bottom`?t.height:t.width,c=Ps(e,n,a,i);return c>=s?a:Ps(e,n,o,i)>c?o:a}function Is(e){try{e?.showPopover?.()}catch{}}function Ls(e){try{e?.hidePopover?.()}catch{}}function Rs(e){return e instanceof Node&&e.nodeType===11&&`host`in e}function zs(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 Bs(e){return e.kind===`captions`||e.kind===`subtitles`}function Vs(e,t){if(!(e instanceof HTMLElement))return null;for(let n of e.querySelectorAll(`track`))if(n.track===t)return n;return null}function Hs(e,t){return e.textTracks?Array.from(e.textTracks).filter(t).sort(Us):[]}function Us(e,t){return e.kind>t.kind?1:e.kind<t.kind?-1:0}function Ws(e){let t=[];for(let n=0;n<e.length;n++)t.push([e.start(n),e.end(n)]);return t}function Gs(e,t){let n=t;for(;n;){if(n===e||e.contains(n))return!0;let t=n.getRootNode();n=Rs(t)?t.host:n.parentNode}return!1}function Ks(){return`WebKitPlaybackTargetAvailabilityEvent`in globalThis}function qs(e){return Ks()&&`webkitCurrentPlaybackTargetIsWireless`in e}r();function Js(e,t){if(K(e))return e(t);e!=null&&(e.current=t)}function Ys(...e){let t=e.flat();return e=>{let n=t.map(t=>Js(t,e));if(n.some(K))return()=>{for(let e=0;e<n.length;e++){let r=n[e];K(r)?r():Js(t[e],null)}}}}function Xs(...e){return p(Ys(...e),[...e])}r();function Zs(e,t,n,r=Qo){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 Qs(e){return e}function $s(...e){}function ec(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 tc(e,t,n){return Zs(t=>e.subscribe(t),()=>e.current,t??Qs,n)}var nc=()=>$s;function rc(e,t,n){return Zs(t?t=>e.subscribe(t):nc,t?()=>e.state:()=>e,t??Qs,n)}r();var ic=N(null),ac=()=>{},oc={state:{},subscribe:()=>ac};function sc({value:e,children:t}){return I(ic.Provider,{value:e,children:t})}function cc(){let t=e(ic);if(!t)throw Error(`usePlayerContext must be used within a Player Provider`);return t}function lc(e){let{store:t}=cc();return rc(t,e)}function uc(t){let n=e(ic),r=rc(n?.store??oc,n?t:void 0);return n?r:void 0}function dc(){let{media:e}=cc();return e}function fc(){let{container:e}=cc();return e}function pc(){return e(ic)?.container??null}function mc(){return e(ic)?.popupGroup}function hc(){return e(ic)?.setMedia}function gc(){return e(ic)?.setContainer}function _c(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 vc=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),_c([this.#e.signal,t.signal])}};function yc(...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 bc=class extends Error{code;cause;constructor(e,t){super(t?.message??e),this.name=`StoreError`,this.code=e,this.cause=t?.cause}};function xc(){throw new bc(`NO_TARGET`)}function Sc(){throw new bc(`DESTROYED`)}var Cc={target:xc,signals:new vc,get:xc,set:xc};function wc(e){let t=e.state(Cc),n=Object.keys(t),r=n[0];return Object.assign(r?e=>{if(r in e)return Xo(e,n)}:()=>void 0,{displayName:e.name})}function Tc(){return e=>e}var Ec=!1;function Dc(){Ec||(Ec=!0,queueMicrotask(kc))}var Oc=new Set;function kc(){Ec=!1;for(let e of Oc)e.flush();Oc.clear()}var Ac=Object.prototype.hasOwnProperty,jc=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(!Ac.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 $s;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,Oc.add(this),Dc()}};function Mc(e){return new jc(e)}var Nc=Symbol.for(`@videojs/store`);function Pc(){return(e,t={})=>{let n=null,r=!1,i=new AbortController,a=new vc,o;function s(){r&&Sc(),n||xc()}let c=e.state({target:()=>(s(),n),signals:a,get:()=>o.current,set:e=>o.patch(e)});o=Mc(c);let l={[Nc]:!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&&Sc(),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(){qo(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 Fc=Tc();function Ic(e,t){if(arguments.length===1)return Fc(e);let{name:n,state:r,attach:i}=e,a=e=>Fc({...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 Lc=Object.freeze({length:0,start:()=>0,end:()=>0}),Rc=Object.assign(new EventTarget,{length:0,*[Symbol.iterator](){},getTrackById:()=>null}),zc=new EventTarget;Object.freeze({});var Bc=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 Vc(e){return e.readyState>=1}function Hc(e){if(!Jo(e))return!1;let t=e;return!q(t.paused)&&!q(t.ended)&&K(t.pause)}function Uc(e){if(!Jo(e))return!1;let t=e;return!q(t.currentTime)&&!q(t.duration)&&!q(t.seeking)}function Wc(e){if(!Jo(e))return!1;let t=e;return!q(t.src)&&!q(t.currentSrc)&&!q(t.readyState)&&K(t.load)}function Gc(e){if(!Jo(e))return!1;let t=e;return!q(t.volume)&&!q(t.muted)}function Kc(e){return Jo(e)?!q(e.playbackRate):!1}function qc(e){if(!Jo(e))return!1;let t=e;return!q(t.buffered)&&t.buffered!==Lc&&!q(t.seekable)&&t.seekable!==Lc}function Jc(e){return Jo(e)?!q(e.error):!1}function Yc(e){if(!Jo(e))return!1;let t=e;return!q(t.textTracks)&&t.textTracks!==Rc}function Xc(e){return Jo(e)?!q(e.videoRenditions):!1}function Zc(e){return Jo(e)?!q(e.audioTracks):!1}function Qc(e){if(!Jo(e))return!1;let t=e;return!q(t.videoWidth)&&!q(t.videoHeight)}function $c(e){if(!Jo(e))return!1;let t=e;return Jo(t.remote)&&t.remote!==zc}function el(e){return Jo(e)?!q(e.streamType):!1}function tl(e){if(!Jo(e))return!1;let t=e;return!q(t.liveEdgeStart)&&!q(t.targetLiveWindow)}function nl(e){return Jo(e)&&`querySelectorAll`in e&&K(e.querySelectorAll)}var rl={ON_DEMAND:`on-demand`,LIVE:`live`,UNKNOWN:`unknown`};function il(e,t){return e.id||String(t)}function al(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 ol=Ic({name:`audioTrack`,state:({target:e})=>({audioTrackList:[],selectAudioTrack(t){let{media:n}=e();if(!Zc(n))return;let r=[...n.audioTracks],i=r.find((e,n)=>il(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=()=>Zc(r)?r.audioTracks:null,s=(e=o())=>{n({audioTrackList:e?[...e].map(al):[]})},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})}}),sl=Ic({name:`buffer`,state:()=>({buffered:[],seekable:[]}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!qc(r))return;let i=()=>n({buffered:Ws(r.buffered),seekable:Ws(r.seekable)});i(),J(r,`progress`,i,{signal:t}),J(r,`emptied`,i,{signal:t})}});function cl(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 ll=250,ul=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!Ds(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>ll||Ds(e))return;let n=e.pointerType,r=e.clientX,i=this.#e,a=this.#t,o={resolve:e=>ml(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}}},dl=new WeakMap;function fl(e){return dl.get(e)}function pl(e){let t=dl.get(e);return t||(t=new ul(e),dl.set(e,t)),t}function ml(e,t,n,r,i){let a=i.getBoundingClientRect(),o=hl(e,t,n),s=o.size>0?cl(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 hl(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 gl(e){let t=e;if(Jo(t.remote)&&`state`in t.remote&&`prompt`in t.remote)return t.remote}function _l(e){return gl(e)?.state===`connected`}function vl(e){return gl(e)?.state===`connecting`}async function yl(e){let t=gl(e);if(!t)throw new DOMException(`Remote playback not supported`,`NotSupportedError`);return t.prompt()}var bl=2e3,xl=250,Sl=500,Cl=Ic({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(!Hc(i)||qo(a))return;let o=e=>e||i.paused||_l(i)||vl(i),s;function c(){clearTimeout(s),s=void 0}function l(){c(),s=setTimeout(d,bl)}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<Sl;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<xl){if(fl(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}),$c(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()}}),wl=Ic({name:`error`,state:({set:e})=>({error:null,dismissError(){e({error:null})}}),attach({target:e,signal:t,set:n}){let{media:r}=e;Jc(r)&&(J(r,`error`,()=>n({error:r.error}),{signal:t}),J(r,`emptied`,()=>n({error:null}),{signal:t}))}});function Tl(){let e=document;return e.fullscreenEnabled||e.webkitFullscreenEnabled?!0:K(document.createElement(`video`).webkitSetPresentationMode)}function El(){let e=document;return e.fullscreenElement??e.webkitFullscreenElement??null}function Dl(e){if(!(e instanceof Element))return!1;try{return e.matches(`:fullscreen`)}catch{return!1}}function Ol(e,t){if(t.webkitPresentationMode===`fullscreen`)return!0;let n=El();return n&&(n===e||n===t)||Dl(e)||Dl(t)?!0:t.isFullscreen??!1}async function kl(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 Al(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 jl(){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 Ml(e){return e.webkitPresentationMode===`picture-in-picture`||document.pictureInPictureElement===e?!0:e.isPictureInPicture??!1}async function Nl(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 Pl(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 Fl=Ic({name:`fullscreen`,state:({target:e})=>({fullscreen:!1,fullscreenAvailability:`unavailable`,async requestFullscreen(){let{media:t,container:n}=e();return Ml(t)&&await Pl(t),kl(n,t)},async exitFullscreen(){let{media:t}=e();return Al(t)},async toggleFullscreen(){let{media:t,container:n}=e();return Ol(n,t)?Al(t):(Ml(t)&&await Pl(t),kl(n,t))}}),attach({target:e,signal:t,set:n}){let{media:r,container:i}=e;n({fullscreenAvailability:Tl()?`available`:`unsupported`});let a=()=>n({fullscreen:Ol(i,r)});a(),J(document,`fullscreenchange`,a,{signal:t}),J(document,`webkitfullscreenchange`,a,{signal:t}),`webkitPresentationMode`in r&&J(r,`webkitpresentationmodechanged`,a,{signal:t})}}),Il=Ic({name:`live`,state:()=>({liveEdgeStart:NaN,targetLiveWindow:NaN}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!tl(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})}}),Ll=Ic({name:`pip`,state:({target:e})=>({pip:!1,pipAvailability:`unavailable`,async requestPictureInPicture(){let{media:t,container:n}=e();return Ol(n,t)&&await Al(t),Nl(t)},async exitPictureInPicture(){let{media:t}=e();return Pl(t)},async togglePictureInPicture(){let{media:t,container:n}=e();return Ml(t)?Pl(t):(Ol(n,t)&&await Al(t),Nl(t))}}),attach({target:e,signal:t,set:n}){let{media:r}=e;n({pipAvailability:jl()?`available`:`unsupported`});let i=()=>n({pip:Ml(r)});i(),J(r,`enterpictureinpicture`,i,{signal:t}),J(r,`leavepictureinpicture`,i,{signal:t}),`webkitPresentationMode`in r&&J(r,`webkitpresentationmodechanged`,i,{signal:t})}}),Rl=Ic({name:`playback`,state:({target:e})=>({paused:!0,ended:!1,started:!1,waiting:!1,play(){return e().media.play()},pause(){let{media:t}=e();Hc(t)&&t.pause()},togglePaused(){let t=e().media;return Hc(t)?t.paused?(t.play(),!0):(t.pause(),!1):!1}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Hc(r)||!Uc(r)||!Wc(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})}}),zl=[.2,.5,.7,1,1.2,1.5,1.7,2],Bl=Ic({name:`playbackRate`,state:({target:e})=>({playbackRates:zl,playbackRate:1,setPlaybackRate(t){let{media:n}=e();Kc(n)&&(n.playbackRate=t)}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Kc(r))return;let i=()=>n({playbackRate:r.playbackRate});i(),J(r,`ratechange`,i,{signal:t})}}),Vl=`auto`;function Hl(e,t){return e.id||String(t)}function Ul(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 Wl(e){return e.width&&e.height?Math.min(e.width,e.height):e.height??e.width}var Gl=Ic({name:`quality`,state:({target:e})=>({videoRenditionList:[],activeVideoRendition:null,selectVideoRendition(t){let{media:n}=e();if(!Xc(n))return;if(t===Vl){n.videoRenditions.selectedIndex=-1;return}let r=[...n.videoRenditions].findIndex((e,n)=>Hl(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=()=>Xc(r)?r.videoRenditions:null,s=e=>{if(!e)return null;let t=[...e],n=t.find(e=>e.active);if(n)return n;if(!Qc(r)||!r.videoWidth&&!r.videoHeight)return null;let i=Wl({width:r.videoWidth||void 0,height:r.videoHeight||void 0}),a=t.filter(e=>Wl(e)===i);return a.length===1?a[0]:null},c=(e=o())=>{let t=s(e);n({videoRenditionList:e?[...e].map(Ul):[],activeVideoRendition:t?Ul(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})}}),Kl=Ic({name:`remotePlayback`,state:({target:e})=>({remotePlaybackState:`disconnected`,remotePlaybackAvailability:`unsupported`,async toggleRemotePlayback(){let{media:t,container:n}=e();return _l(t)?yl(t):(Ol(n,t)&&await Al(t),await yl(t))}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!$c(r))return;if(qs(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(()=>{})})}}),ql=Ic({name:`source`,state:({target:e,signals:t})=>({source:null,canPlay:!1,loadSource(n){t.clear();let{media:r}=e();return Wc(r)?(r.src=n,r.load(),n):n}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Wc(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})}}),Jl=Ic({name:`streamType`,state:()=>({streamType:rl.UNKNOWN}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(el(r)){let e=()=>n({streamType:r.streamType});e(),J(r,`streamtypechange`,e,{signal:t});return}if(!Uc(r))return;let i=()=>{let{duration:e}=r;return e===1/0?rl.LIVE:Number.isFinite(e)&&e>0?rl.ON_DEMAND:rl.UNKNOWN},a=()=>n({streamType:i()});a(),J(r,`durationchange`,a,{signal:t}),J(r,`loadedmetadata`,a,{signal:t}),J(r,`emptied`,a,{signal:t}),qc(r)&&J(r,`progress`,a,{signal:t})}});function Yl(e,t){return e.id||`track:${t}:${e.kind}:${e.language}:${e.label}`}var Xl=Ic({name:`textTrack`,state:({target:e})=>({chaptersCues:[],thumbnailCues:[],thumbnailTrackSrc:null,textTrackList:[],subtitlesShowing:!1,toggleSubtitles(t){let{media:n}=e();if(!Yc(n))return!1;let r=Hs(n,Bs);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(!Yc(n))return;let r=Array.from(n.textTracks).map((e,t)=>({index:t,track:e})).filter(({track:e})=>Bs(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})=>Yl(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(!Yc(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:Yl(i,n),kind:i.kind,label:i.label,language:i.language,mode:i.mode}),Bs(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=Vs(r,t)?.src??null);let d=nl(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})}}),Zl={seek:Symbol.for(`@videojs/seek`)},Ql=Ic({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(Zl.seek);if(!Uc(i)||!Wc(i))return 0;if(!Vc(i)&&!await bs(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 bs(i,`seeked`,{signal:a}).catch($s),i.currentTime}}),attach({target:e,signal:t,set:n,get:r}){let{media:i}=e;if(!Uc(i))return;let a=()=>{let{duration:e}=i;if(e===1/0&&qc(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})}}),$l=.25,eu=Ic({name:`volume`,state:({target:e})=>({volume:1,muted:!1,volumeAvailability:`unavailable`,setVolume(t){let{media:n}=e();if(!Gc(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 Gc(t)?(t.muted||t.volume===0?(t.muted=!1,t.volume===0&&(t.volume=$l)):t.muted=!0,t.muted):!1}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Gc(r))return;n({volumeAvailability:tu()});let i=()=>n({volume:r.volume,muted:r.muted});i(),J(r,`volumechange`,i,{signal:t})}});function tu(){let e=document.createElement(`video`);try{return e.volume=.5,e.volume===.5?`available`:`unsupported`}catch{return`unsupported`}}wc(ol);var nu=wc(sl),ru=wc(Cl),iu=wc(wl),au=wc(Fl);wc(Il);var ou=wc(Ll),su=wc(Rl),cu=wc(Bl);wc(Gl),wc(Kl),wc(ql),wc(Jl);var lu=wc(Xl),uu=wc(Ql),du=wc(eu),fu={seekStep({store:e,value:t}){if(q(t))return;let n=uu(e.state);n&&n.seek(n.currentTime+t)},volumeStep({store:e,value:t}){if(q(t))return;let n=du(e.state);n&&n.setVolume(n.volume+t)},speedUp({store:e}){let t=cu(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=cu(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])}},pu={seekStep:fu.seekStep,volumeStep:fu.volumeStep,speedUp:fu.speedUp,speedDown:fu.speedDown};function mu(e){return pu[e]||(({store:t})=>{let n=t.state[e];K(n)&&n()})}var hu=200,gu=class{#e=0;#t=null;handleUp(e,t){if(e.resolve(`doubletap`).length>0){let n=Date.now();if(n-this.#e<hu){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)},hu);return}e.resolve(`tap`)[0]?.onActivate(t)}#n(){this.#t!==null&&(clearTimeout(this.#t),this.#t=null)}reset(){this.#n(),this.#e=0}},_u=new WeakMap;function vu(e){let t=_u.get(e);return t||(t=new gu,_u.set(e,t),t)}function yu(e,t,n){return pl(e).add({type:`tap`,recognizer:vu(e),onActivate:t,pointer:n?.pointer,region:n?.region,disabled:n?.disabled,action:n?.action,value:n?.value})}function bu(e,t,n){return pl(e).add({type:`doubletap`,recognizer:vu(e),onActivate:t,pointer:n?.pointer,region:n?.region,disabled:n?.disabled,action:n?.action,value:n?.value})}function xu(e){return e.startsWith(`toggle`)}var Su={togglePaused({store:e}){let t=su(e.state);t&&(t.paused?t.play():t.pause())},toggleMuted({store:e}){du(e.state)?.toggleMuted()},toggleFullscreen({store:e}){let t=au(e.state);t&&(t.fullscreen?t.exitFullscreen():t.requestFullscreen())},toggleSubtitles({store:e}){lu(e.state)?.toggleSubtitles()},togglePictureInPicture({store:e}){let t=ou(e.state);t&&(t.pip?t.exitPictureInPicture():t.requestPictureInPicture())},seekStep:fu.seekStep,volumeStep:fu.volumeStep,speedUp:fu.speedUp,speedDown:fu.speedDown,seekToPercent({store:e,value:t,key:n}){let r=uu(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 Cu(e){return Su[e]}var wu={shift:`Shift`,ctrl:`Control`,alt:`Alt`,meta:`Meta`},Tu={shift:`Shift`,ctrl:`Ctrl`,alt:`Alt`,meta:`Meta`},Eu=[`ctrl`,`shift`,`alt`,`meta`];function Du(e){return e.map(e=>{let t=[];for(let n of Eu)e.modifiers.has(n)&&t.push(wu[n]);return t.push(e.originalKey),t.join(`+`)}).join(` `)}function Ou(e){let t=[];for(let n of Eu)e.modifiers.has(n)&&t.push(Tu[n]);return t.push(ku(e.originalKey)),t.join(`+`)}function ku(e){return e.length===1?e.toUpperCase():e}var Au=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:Mu(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:Du(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`||As(e)||e.defaultPrevented)return;let t=Es(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(Pu(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:Ou(e.parsed[0])}#h(){for(let e of this.#o)e()}},ju=new Set([`shift`,`ctrl`,`alt`,`meta`]);function Mu(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(js()?`meta`:`ctrl`):ju.has(t)&&r.add(t)}return[{modifiers:r,key:n===`Space`?` `:n.toLowerCase(),originalKey:n}]}function Nu(e){return e.length===1&&!/[a-z]/i.test(e)}function Pu(e,t){if(t.key===`Unidentified`||t.key.toLowerCase()!==e.key)return!1;let n=Nu(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 Fu=new WeakMap;function Iu(e){let t=Fu.get(e);return t||(t=new Au(e),Fu.set(e,t)),t}function Lu(e,t){return Iu(e).add(t)}var Ru=[Rl,Bl,Gl,ol,eu,Ql,ql,sl,Fl,Ll,Kl,Cl,Xl,wl];function zu(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 Bu(e){let{onOpenChange:t}=e,n=null,r=null,i=null,a=zu({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 Vu(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 Hu=`group`;function Uu(e){let t=xs(e.ownerDocument);(!t||t===e.ownerDocument.body||!Gs(e,t))&&e.focus({preventScroll:!0})}var Wu={transitionStarting:`data-starting-style`,transitionEnding:`data-ending-style`};function Gu(e){return{transitionStarting:e===`starting`,transitionEnding:e===`ending`}}function Ku(e){let{onOpenChange:t,closeOnOutsideClick:n}=e,r=null,i=null,a=null,o=new Set,s=!1,c=null,l=zu({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||(Ls(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&&Ls(i),i=e,e&&u.current.active&&Is(e)}return{input:u,triggerProps:T,popupProps:E,get triggerElement(){return r},setTriggerElement:D,setPopupElement:O,open:S,close:C,destroy:l.destroy}}function qu(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 Ju(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 qu(n,r,Math.max(0,i-n),Math.max(0,a-r))}function Yu(e){let t=document.documentElement.getBoundingClientRect();return e?Ju(t,e.getBoundingClientRect()):t}function Xu(e,t={}){if(!e)return null;if(!Go(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 Zu={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 Qu(e,t,n){return Math.max(t,Math.min(n,e))}function $u(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 ed={sideOffset:0,alignOffset:0,boundaryOffset:0},td={top:`bottom`,bottom:`top`,left:`right`,right:`left`};function nd(e){return`${Qu(e,0,1/0)}px`}function rd(e,t,n,r){let i=n-r;return i<t?t:Qu(e,t,i)}function id(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 ad(e,t,n,r,i,a,o=Zu){if(Ss())return{...od(e,t,o,n,i,a),...n&&i?sd(n,i,t,a,o):{}};if(n&&r){let e=a??ed;return{position:`fixed`,margin:`0`,...cd(n,r,t,e,i),...i?sd(n,i,t,e,o):{}}}return{}}function od(e,t,n=Zu,r,i,a=ed){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=td[c];if(c===`top`||c===`bottom`){if(d[f]=`calc(anchor(${c}) + ${o})`,r&&i){let{base:e,translate:t}=id(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}=id(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 sd(e,t,n,r=ed,i=Zu){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]=nd(t-r.sideOffset),a[i.availableWidth]=nd(l-c)}else{let t=o===`left`?e.left-c:l-e.right;a[i.availableWidth]=nd(t-r.sideOffset),a[i.availableHeight]=nd(d-u)}return a}function cd(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=rd(d,i.left+e,i.right-e,t.width):l=rd(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 ld(e,t=Zu){let n=getComputedStyle(e);return{sideOffset:zs(e,n.getPropertyValue(t.sideOffset)),alignOffset:zs(e,n.getPropertyValue(t.alignOffset)),boundaryOffset:zs(e,n.getPropertyValue(t.boundaryOffset))}}function ud(e,t){let n=e.getBoundingClientRect(),r=e.offsetWidth||n.width,i=e.offsetHeight||n.height;return qu(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 dd(){let e=null;return{open(t){e!==t&&(e?.close(`group-open`),e=t)},close(t){e===t&&(e=null)}}}function fd(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)?Qu(i*100,0,100):0}function pd(e){let t=Mc({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?ec(t=>e.onValueChange?.(t),r,{leading:!0}):null;function d(t,n){n&&u?u(t):e.onValueChange?.(t)}function f(){if(qo(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=fd(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(!qo(s)){if(n.pointerType!==`touch`&&n.buttons===0){p();return}let r=fd(n,o,e.getOrientation(),a);c=r,t.patch({dragPercent:r,pointerPercent:r}),d(r,!0);return}let r=fd(n,e.getElement().getBoundingClientRect(),e.getOrientation(),e.isRTL());t.patch({pointing:!0,pointerPercent:r})},onPointerUp(t){if(e.isDisabled()||(t.stopPropagation(),qo(s)))return;let n=fd(t,o,e.getOrientation(),a);u?.cancel(),e.onValueChange?.(n),e.onValueCommit?.(n),l=!0},onPointerLeave(){qo(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=$u(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=Qu(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 md={fill:`--media-slider-fill`,pointer:`--media-slider-pointer`,buffer:`--media-slider-buffer`};function hd(e){return{[md.fill]:`${e.fillPercent.toFixed(3)}%`,[md.pointer]:`${e.pointerPercent.toFixed(3)}%`}}function gd(e){return{...hd(e),[md.buffer]:`${e.bufferPercent.toFixed(3)}%`}}function _d(e,t){let n=e/2;return{position:`absolute`,left:t===`visible`?`calc(var(${md.pointer}) - ${n}px)`:`min(max(0px, calc(var(${md.pointer}) - ${n}px)), calc(100% - ${e}px))`,width:`max-content`,pointerEvents:`none`}}var vd=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 yd(e){let{getContainer:t,getImg:n,onStateChange:r}=e,i=new vd,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 bd={hover:`hover`,focus:`focus`,escape:`escape`,blur:`blur`,"imperative-action":`imperative-action`};function xd(e){let t={transition:e.transition,onOpenChange(t,n){let r=bd[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=Ku(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 Sd(){let e=Mc({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&&(wd(i),Cd(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();Td(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 Cd(e){e&&e.offsetHeight}function wd(e){let t=e?.getAnimations?.({subtree:!0})??[];for(let e of t)e.cancel()}function Td(e){if(!e)return Promise.resolve();let t=e.getAnimations?.()??[];return t.length===0?Promise.resolve():Promise.all(t.map(e=>e.finished)).then($s,$s)}function Ed(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=Qu(e.getPercent()-n*r,0,100);e.onValueChange?.(i)}}}function Dd(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 Od(e,t){let n={};for(let r in e){if(t&&!(r in t))continue;let i=t?.[r]??kd(r),a=e[r];a===!0?n[i]=``:a&&(n[i]=String(a))}return n}function kd(e){return`data-${e.toLowerCase()}`}var Ad={key:`container.label`,text:`Media player`};r();var jd=u(function({children:e,tabIndex:t=0,role:n=Hu,"aria-label":r,"aria-labelledby":i,...a},s){let c=gc(),l=gs(),u=o(null),d=Xs(s,u);m(()=>(c?.(u.current),()=>c?.(null)),[c]);let f=e=>{a.onPointerUp?.(e);let t=u.current;t&&Uu(t)};return I(`div`,{ref:d,role:n,tabIndex:t,...r!==void 0||i!==void 0?{"aria-label":r,"aria-labelledby":i}:{"aria-label":l(Ad)},...a,onPointerUp:f,children:e})});r();function Y(e){let t=o(e);return t.current=e,t}r();function Md(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 Nd(e){function t({children:t}){let[n,r]=h(()=>Pc()(yc(...e.features))),[i]=h(()=>dd()),[a,o]=h(null),[s,c]=h(null);return Md(n),m(()=>{if(a){if(n.destroyed){r(Pc()(yc(...e.features)));return}return n.attach({media:a,container:s})}},[a,s,n]),I(sc,{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}=cc();return rc(t,e)}return{Provider:t,Container:jd,usePlayer:n,useMedia:dc}}function Pd(e){return e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>=65&&e.charCodeAt(2)<=90}function Fd(e,t){return Pd(e)&&(typeof t==`function`||t===void 0)}function Id(e,t){return t?e?n=>{t(n),e(n)}:t:e}function Ld(e,t){return t&&e?`${t} ${e}`:t||e}function Rd(e,t){return t?e?{...e,...t}:t:e}function zd(e,t){if(!t)return e;for(let n in t){let r=t[n];n===`className`?e.className=Ld(e.className,r):n===`style`?e.style=Rd(e.style,r):e[n]=Fd(n,r)?Id(e[n],r):r}return e}function Bd(...e){let t={};for(let n of e)t=zd(t,n);return t}r();function Vd(e,t){return K(e)?e(t):e}function Hd(e,t){return K(e)?e(t):e}function Ud(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=Vd(r,o),p=Hd(i,o),m=Bd(l?Od(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=Ys(s,m.ref);return a({...m,ref:e},o)}if(d(a)){let e=Ud(a),t=Ys(s,m.ref,e),n=Bd(m,a.props);return n.ref=t,f(a,n)}return m.ref=Ys(s,m.ref),E(e,m)}r();function Wd(e){let{displayName:t,onActivate:n,isDisabled:r}=e,i=p(e=>{},[t]);return{getButtonProps:p(e=>Bd(Vu({onActivate:n,isDisabled:r}),e),[n,r]),buttonRef:i}}r();function Gd(e,t){let n=fc(),[r,i]=h({});return m(()=>{if(!n||!e){i({});return}let r=Iu(n),a=()=>i(r.getShortcut(e,t));return a(),r.subscribeShortcutChanges(a)},[n,e,t]),r}r(),N(null).Provider,N(null).Provider,N(null).Provider,N(null).Provider;var Kd=N(!1);Kd.Provider;function qd(){return e(Kd)}N(null).Provider,r();var Jd=N(null),Yd=Jd.Provider;function Xd(){let t=e(Jd);if(!t)throw Error(`Tooltip compound components must be used within a Tooltip.Root`);return t}function Zd(){return e(Jd)}r();function Qd(e,t){return e.getLabelParams?.(t)}function $d(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=Zd(),x=qd(),S=b?.setContent,C=lc(a),w=Gd(s,c?.(v)),T=gs(),[E]=h(()=>new r);f.has(`menuTrigger`)&&q(v.menuTrigger)&&(v.menuTrigger=x),E.setProps(v);let{getButtonProps:D,buttonRef:O}=Wd({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?ps(E.getLabel(k),T,Qd(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 M=E.getAttrs(k),N=M[`aria-label`],P={...M,...us(N)?{"aria-label":ps(N,T,Qd(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(),P,y]})});return p.displayName=t,p}function ef(e,t){return K(e)?e(t)||void 0:e||void 0}var tf=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,...Gu(e.status)}}getAttrs(e){return{role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":e.titleId,"aria-describedby":e.descriptionId}}},nf={open:`data-open`,...Wu},rf=class e{static defaultProps={delay:500};state=Mc({visible:!1});#e={...e.defaultProps};#t=null;setProps(t){this.#e=Yo(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)}},af={visible:`data-visible`},of=class{#e=null;setMedia(e){this.#e=e}getState(){let e=this.#e;return{visible:e.controlsVisible,userActive:e.userActive}}},sf={visible:`data-visible`,userActive:`data-user-active`},cf=class extends tf{setProps(){}},lf=`common.`,uf={key:`${lf}empty`,text:``},df={key:`${lf}ok`,text:`OK`},ff=`errors.`,pf={key:`${ff}aborted`,text:`You stopped media playback before it finished.`},mf={key:`${ff}network`,text:`This media could not be loaded due to a network or server issue.`},hf={key:`${ff}decode`,text:`This media could not be played. It may be corrupted, or your browser may not support its format.`},gf={key:`${ff}source`,text:`This media could not be loaded. It may be unavailable, or your browser may not support its format.`},_f={key:`${ff}encrypted`,text:`This media could not be played because it could not be decrypted.`},vf={key:`${ff}title`,text:`Something went wrong.`},yf={key:`${ff}unexpected`,text:`An unexpected error occurred.`},bf={[Bc.MEDIA_ERR_ABORTED]:pf,[Bc.MEDIA_ERR_NETWORK]:mf,[Bc.MEDIA_ERR_DECODE]:hf,[Bc.MEDIA_ERR_SRC_NOT_SUPPORTED]:gf,[Bc.MEDIA_ERR_ENCRYPTED]:_f,[Bc.MEDIA_ERR_CUSTOM]:uf},xf={[Bc.MEDIA_ERR_SRC_NOT_SUPPORTED]:[`Failed to open media`]};function Sf(e){return e>=Bc.MEDIA_ERR_ABORTED&&e<=Bc.MEDIA_ERR_ENCRYPTED}function Cf(){return vf}function wf(){return df}function Tf(e,t){if(e){let t=bf[e.code],n=e.message?.trim();if(n){let r=Bc.defaultMessages[e.code];if(t&&r&&n===r)return t;let i=xf[e.code];return t&&Sf(e.code)&&!e.context&&i?.includes(n)?t:n}if(t)return t}return t?.trim()||yf}var Ef=`fullscreen.`,Df={key:`${Ef}enter`,text:`Enter fullscreen`},Of={key:`${Ef}exit`,text:`Exit fullscreen`},kf=class e{static defaultProps={label:``,disabled:!1};state=Mc({fullscreen:!1,availability:`unavailable`,disabled:!0,hidden:!0,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Yo(t,e.defaultProps)}getLabel(e){return ef(this.#e.label,e)||(e.fullscreen?Of:Df)}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:ls(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()}},Af={fullscreen:`data-fullscreen`,availability:`data-availability`,disabled:`data-disabled`,hidden:`data-hidden`},jf={key:`playback.rate`,text:`Playback rate {rate}`},Mf=`volume.`,Nf={key:`${Mf}mutedValue`,text:`{percent}, muted`};`${Mf}`;var Pf={key:`${Mf}label`,text:`Volume`};`${Mf}`;var Ff=Intl.DurationFormat,If=new Map;function Lf(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 Rf(e){return e===void 0?``:Array.isArray(e)?e.join(`:`):e}function zf(e){let t=Array.isArray(e)?e[0]:e;return!t||t===`en`||t.startsWith(`en-`)}function Bf(e,t=`long`,n){let r=`${Rf(e)}:${t}:${n??``}`,i=If.get(r);return i||(i=Ff?new Ff(e,n===void 0?{style:t}:{style:t,hoursDisplay:n}):Lf(t,n),If.set(r,i)),i}function Vf(e){return Ko(e)&&Number.isFinite(e)}function Hf(e,t){if(!Vf(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=Vf(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=Bf(`en`,`digital`,u?`always`:`auto`).format(f);return d||(p=p.replace(/^0(?=\d:)/,``)),`${n?`-`:``}${p}`}function Uf(e){if(!Vf(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 Wf(e,t){if(!Vf(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=Bf(t?.locale,t?.style??`long`).format(s);if(n){let e=t?.formatRemaining;return e?e(c):zf(t?.locale)?`${c} remaining`:c}return c}var Gf=`buttons.`,Kf={key:`${Gf}play`,text:`Play`},qf={key:`${Gf}pause`,text:`Pause`},Jf={key:`${Gf}replay`,text:`Replay`},Yf={key:`${Gf}mute`,text:`Mute`},Xf={key:`${Gf}unmute`,text:`Unmute`},Zf=class e{static defaultProps={label:``,disabled:!1};state=Mc({muted:!1,volumeLevel:`off`,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Yo(t,e.defaultProps)}getLabel(e){return ef(this.#e.label,e)||(e.muted?Xf:Yf)}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:Qf(e)}),this.state.patch({label:ls(this.getLabel(this.state.current))}),this.state.current}toggle(e){this.#e.disabled||e.toggleMuted()}};function Qf(e){return e.muted||e.volume===0?`off`:e.volume<.5?`low`:e.volume<.75?`medium`:`high`}var $f={muted:`data-muted`,volumeLevel:`data-volume-level`},ep=`pip.`,tp={key:`${ep}enter`,text:`Enter picture-in-picture`},np={key:`${ep}exit`,text:`Exit picture-in-picture`},rp=class e{static defaultProps={label:``,disabled:!1};state=Mc({pip:!1,availability:`unavailable`,disabled:!0,hidden:!0,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Yo(t,e.defaultProps)}getLabel(e){return ef(this.#e.label,e)||(e.pip?np:tp)}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:ls(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()}},ip={pip:`data-pip`,availability:`data-availability`,disabled:`data-disabled`,hidden:`data-hidden`},ap=class e{static defaultProps={label:``,disabled:!1};state=Mc({paused:!0,ended:!1,started:!1,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Yo(t,e.defaultProps)}getLabel(e){return ef(this.#e.label,e)||(e.ended?Jf:e.paused?Kf:qf)}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:ls(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()}}},op={paused:`data-paused`,ended:`data-ended`,started:`data-started`},sp=class e{static defaultProps={label:``,disabled:!1,menuTrigger:!1};state=Mc({rate:1,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Yo(t,e.defaultProps)}getLabel(e){let t=ef(this.#e.label,e);return t===void 0?jf:t}getLabelParams(e){if(ef(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:ls(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)}},cp={rate:`data-rate`},lp=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=Yo(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,...Gu(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}}},up={open:`data-open`,side:`data-side`,align:`data-align`,...Wu},dp=`seek.`,fp={key:`${dp}forward`,text:`Seek forward {seconds} seconds`},pp={key:`${dp}backward`,text:`Seek backward {seconds} seconds`},mp=class e{static defaultProps={seconds:30,label:``,disabled:!1};state=Mc({seeking:!1,direction:`forward`,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Yo(t,e.defaultProps)}getLabel(e){let t=ef(this.#e.label,e);return t===void 0?e.direction===`backward`?pp:fp:t}getLabelParams(e){if(ef(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:ls(this.getLabel(this.state.current))}),this.state.current}async seek(e){this.#e.disabled||await e.seek(e.currentTime+this.#e.seconds)}},hp={seeking:`data-seeking`,direction:`data-direction`},gp=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=Yo(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 ef(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 $u(Qu(t+e/100*(n-t),t,n),r,t)}rawValueFromPercent(e){let{min:t,max:n}=this.#e;return Qu(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)}},_p={dragging:`data-dragging`,pointing:`data-pointing`,interactive:`data-interactive`,orientation:`data-orientation`,disabled:`data-disabled`},vp={loading:`data-loading`,error:`data-error`,hidden:`data-hidden`};function yp(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&&Ko(n)&&!Number.isNaN(n)&&(l[t]=n)}let u={url:a};return Ko(l.w)&&(u.width=l.w),Ko(l.h)&&(u.height=l.h),Ko(l.x)&&Ko(l.y)&&(u.coords={x:l.x,y:l.y}),u}function bp(e,t){let n=[];for(let r of e){let e=yp(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 xp=`time.`,Sp={key:`${xp}current`,text:`Current time`},Cp={key:`${xp}duration`,text:`Duration`},wp={key:`${xp}remaining`,text:`Remaining`},Tp={key:`${xp}remainingSuffix`,text:`{duration} remaining`},Ep={key:`${xp}showElapsed`,text:`{duration}. Show elapsed time.`},Dp={key:`${xp}showDuration`,text:`{duration}. Show duration.`},Op={key:`${xp}showRemaining`,text:`{duration}. Show remaining time.`},kp={key:`${xp}position`,text:`{current} of {duration}`},Ap={current:Ep,duration:Dp,remaining:Op},jp={current:Sp,duration:Cp,remaining:wp},Mp=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=Yo(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 Hf(Math.abs(t),e.duration)}#i(){let{type:e}=this.#e,t=this.#n();return Wf(e===`remaining`?t<0?t:-Math.abs(t):t)}#a(){let e=this.#n();return Uf(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=ef(this.#e.label,e);return n===void 0?this.#e.toggle?Ap[this.#o(t,e.type)]:jp[this.#e.type]:n}getLabelParams(e){return ef(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()}}},Np={type:`data-type`},Pp={key:`slider.seek`,text:`Seek`},Fp=class e extends gp{static defaultProps={...gp.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=Yo(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)||Pp}#i(e){return e.dragging?this.rawValueFromPercent(e.pointerPercent):e.value}#a(e){return this.#n===void 0?Wf(e):Wf(e,{locale:this.#n})}getValueText(e){return Number.isFinite(e.duration)?kp: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)}}},Ip={..._p,seeking:`data-seeking`},Lp=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=Yo(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,...Gu(e.status)}}getPopupAttrs(e){return{popover:`manual`,role:`presentation`}}},Rp={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`},zp={open:`data-open`,side:`data-side`,align:`data-align`,...Wu},Bp=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=Yo(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()}},Vp=new Map;function Hp(e){return e===void 0?``:Array.isArray(e)?e.join(`:`):e}function Up(e){let t=Hp(e),n=Vp.get(t);if(!n)try{n=new Intl.NumberFormat(e,{style:`percent`,maximumFractionDigits:0}),Vp.set(t,n)}catch{return}return n}function Wp(e){return`${Math.round(Math.min(1,Math.max(0,e))*100)}%`}function Gp(e,t){let n=!Ko(e)||!Number.isFinite(e)?0:Math.min(1,Math.max(0,e));try{let e=Up(t)??Up(void 0);if(e)return e.format(n)}catch{}return Wp(n)}var Kp=class e extends gp{static defaultProps={...gp.defaultProps,label:``,wheelStep:5};#e=null;#t;constructor(e){super(),e&&this.setProps(e)}setProps(t){super.setProps(Yo(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)||Pf}getValueText(e){return e.muted?Nf:this.getValueTextParams(e).percent}getValueTextParams(e){return{percent:Gp(e.value/100,this.#t)}}getAttrs(e){return{...super.getAttrs(e),"aria-valuetext":this.getValueText(e)}}},qp={..._p,availability:`data-availability`};r();var Jp=N(null),Yp=Jp.Provider;function Xp(){let t=e(Jp);if(!t)throw Error(`AlertDialog compound components must be used within an AlertDialog.Root`);return t}var Zp=Object.defineProperty,Qp=(e,t)=>{let n={};for(var r in e)Zp(n,r,{get:e[r],enumerable:!0});return t||Zp(n,Symbol.toStringTag,{value:`Module`}),n};r();var $p=u(function({render:e,className:t,style:n,disabled:r,...i},a){let{dialog:o,state:s}=Xp(),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 em(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 tm=em({displayName:`AlertDialogDescription`,tag:`p`,useContext:Xp,getProps:e=>({id:e.descriptionId})});r();var nm=u(function({render:e,className:t,style:n,...r},i){let{core:a,dialog:o,state:s,stateAttrMap:c}=Xp(),l=Xs(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 rm=/[^a-zA-Z0-9_-]/g;function im(e){let t=M().replace(rm,``);return e?`${e}-${t}`:t}r();function am({open:e,defaultOpen:t=tf.defaultProps.defaultOpen,onOpenChange:n,onOpenChangeComplete:r,children:i}){let[a]=h(()=>new tf),o=e!==void 0,s=Y(n),c=Y(r),[l]=h(()=>{let e=Bu({transition:Sd(),onOpenChange:e=>{s.current?.(e)},onOpenChangeComplete:e=>{c.current?.(e)}});return!o&&t&&e.open(),e}),u=im(`alert-dialog-title`),d=im(`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]),Md(l);let f=tc(l.input);return a.setInput(f),I(Yp,{value:{core:a,dialog:l,state:a.getState(),stateAttrMap:nf},children:i})}var om=em({displayName:`AlertDialogTitle`,tag:`h2`,useContext:Xp,getProps:e=>({id:e.titleId})}),sm=Qp({Close:()=>$p,Description:()=>tm,Popup:()=>nm,Root:()=>am,Title:()=>om});r();var cm=u(function(e,t){let{render:n,className:r,style:i,delay:a,...o}=e,s=lc(su),[l]=h(()=>new rf);Md(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:af,ref:[t],props:[o]}):null});r();var lm=N(null),um=lm.Provider;function dm(){let t=e(lm);if(!t)throw Error(`Controls compound components must be used within a Controls.Root`);return t}function fm(){return e(lm)}r();var pm=u(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{state:s,stateAttrMap:c}=dm(),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 mm=u(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=lc(ru),[c]=h(()=>new of);if(!s)return null;c.setMedia(s);let l=c.getState();return I(um,{value:{state:l,stateAttrMap:sf},children:X(`div`,{render:n,className:r,style:i},{state:l,stateAttrMap:sf,ref:[t],props:[{children:a},o,{"data-interactive":``}]})})}),hm=Qp({Group:()=>pm,Root:()=>mm});r();var gm=N(null),_m=gm.Provider;function vm(){let t=e(gm);if(!t)throw Error(`ErrorDialog compound components must be used within an ErrorDialog.Root`);return t}r();var ym=u(function({render:e,className:t,style:n,disabled:r,children:i,...a},o){let s=gs(),{dialog:c,state:l,stateAttrMap:u}=Xp(),d=p(()=>{r||c.close()},[c,r]),f=i??ps(wf(),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 bm=u(function({render:e,className:t,style:n,children:r,...i},a){let o=gs(),{state:s,stateAttrMap:c}=Xp(),{lastError:l}=vm(),u=Tf(l),d=r??ps(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 xm({children:e}){let[t]=h(()=>new cf),n=lc(iu),r=o(n?.error??null);n?.error&&(r.current=n.error);let i=Y(n),[a]=h(()=>Bu({transition:Sd(),onOpenChange:e=>{e||i.current?.dismissError()}})),s=im(`error-dialog-title`),c=im(`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]),Md(a);let l=tc(a.input);t.setInput(l);let u=t.getState();return n?I(_m,{value:{lastError:r.current},children:I(Yp,{value:{core:t,dialog:a,state:u,stateAttrMap:nf},children:e})}):null}r();var Sm=u(function({render:e,className:t,style:n,children:r,...i},a){let o=gs(),{state:s,stateAttrMap:c}=Xp(),l=r??ps(Cf(),o);return X(`h2`,{render:e,className:t,style:n},{state:s,stateAttrMap:c,ref:a,props:[{id:s.titleId,children:l},i]})}),Cm=Qp({Close:()=>ym,Description:()=>bm,Popup:()=>nm,Root:()=>xm,Title:()=>Sm}),wm=$d({displayName:`FullscreenButton`,core:kf,stateAttrMap:Af,selector:au,action:(e,t)=>e.toggle(t),hotkeyAction:`toggleFullscreen`,isSupported:e=>!e.hidden});r();function Tm({type:e,action:t,value:n,pointer:r,region:i,disabled:a}){let o=lc(),s=fc();return m(()=>{if(!s||!e||!t||a)return;let c=mu(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`?bu(s,l,u):yu(s,l,u)},[s,o,e,t,n,r,i,a]),null}var Em=Tm;r();function Dm(){let[,e]=P(e=>e+1,0);return e}r();function Om(e){let t=Y(e),r=o(null),i=o(null),a=Dm(),[s]=h(()=>pd({getElement:()=>r.current,getThumbElement:()=>i.current,getOrientation:()=>t.current.orientation??`horizontal`,isRTL:()=>r.current?vs(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?.()}));Md(s);let c=tc(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 km({keys:e,action:t,value:n,disabled:r,target:i}){let a=lc(),o=fc();return m(()=>{if(!o||!e||!t||r)return;let s=Cu(t);if(s)return Lu(o,{keys:e,action:t,value:n,target:i,disabled:r,repeatable:!xu(t),onActivate:(e,t)=>{s({store:a,key:t,value:n})}})},[o,a,e,t,n,r,i]),null}var Am=km;r();function jm(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 Mm=$d({displayName:`MuteButton`,core:Zf,stateAttrMap:$f,selector:du,action:(e,t)=>e.toggle(t),hotkeyAction:`toggleMuted`}),Nm=$d({displayName:`PiPButton`,core:rp,stateAttrMap:ip,selector:ou,action:(e,t)=>e.toggle(t),hotkeyAction:`togglePictureInPicture`,isSupported:e=>!e.hidden}),Pm=$d({displayName:`PlayButton`,core:ap,stateAttrMap:op,selector:su,action:(e,t)=>e.toggle(t),hotkeyAction:`togglePaused`}),Fm=$d({displayName:`PlaybackRateButton`,core:sp,stateAttrMap:cp,selector:cu,action:(e,t)=>e.cycle(t),hotkeyAction:`speedUp`});r();var Im=N(null),Lm=Im.Provider;function Rm(){let t=e(Im);if(!t)throw Error(`Popover compound components must be used within a Popover.Root`);return t}var zm=em({displayName:`PopoverArrow`,tag:`div`,useContext:Rm,staticProps:{"aria-hidden":`true`}});r();var Bm={position:`fixed`,inset:`auto`,margin:0},Vm=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}=Rm(),y=o(null),x=Xs(a,p(e=>{c.setPopupElement(e),e&&Ss()&&e.style.setProperty(`position-anchor`,`--${m}`)},[c,m]),y),S=b(()=>({side:u,align:l.align}),[u,l.align]),C=b(()=>{if(!Ss())return null;let{positionAnchor:e,...t}=ad(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=Xu(_,{container:v,root:r}),a=ud(t,S.side),o=Yu(i),s=ld(t),l=Fs(n,a,o,S,s),{positionAnchor:u,...f}=ad(m,{...S,side:l},n,Ss()?void 0:a,o,s);T(f),d(l)}e();let t=c.triggerElement,n=y.current,r=n?Xu(_,{container:v,root:n.getRootNode()}):null,i=0;function a(t){t&&Dd(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??Bm;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 Hm({open:e,defaultOpen:t=lp.defaultProps.defaultOpen,onOpenChange:n,onOpenChangeComplete:r,openOnHover:i=lp.defaultProps.openOnHover,delay:a=lp.defaultProps.delay,closeDelay:o=lp.defaultProps.closeDelay,boundary:s=`container`,children:c,...l}){let u=pc(),d=mc(),f=fm(),[p]=h(()=>new lp(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=Ku({transition:Sd(),onOpenChange:(e,t)=>{_.current?.(e,t)},onOpenChangeComplete:e=>{v.current?.(e)},closeOnEscape:()=>y.current??lp.defaultProps.closeOnEscape,closeOnOutsideClick:()=>b.current??lp.defaultProps.closeOnOutsideClick,openOnHover:()=>x.current,delay:()=>S.current,closeDelay:()=>C.current,group:()=>w.current});return!g&&t&&e.open(`click`),e}),E=im(),D=im(`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]),Md(T);let O=tc(T.input);p.setInput(O);let{state:k,preferredSide:A,setPositionedSide:j}=jm(p.getState());return I(Lm,{value:{core:p,popover:T,state:k,preferredSide:A,setPositionedSide:j,stateAttrMap:up,anchorName:E,popupId:D,boundary:s,container:u},children:c})}r();var Um=u(function({render:e,className:t,style:n,...r},i){let{core:a,popover:o,state:s,stateAttrMap:c,anchorName:l,popupId:u}=Rm(),d=p(e=>{o.setTriggerElement(e),e&&Ss()&&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]})}),Wm=Qp({Arrow:()=>zm,Popup:()=>Vm,Root:()=>Hm,Trigger:()=>Um}),Gm=$d({displayName:`SeekButton`,core:mp,stateAttrMap:hp,selector:uu,action:(e,t)=>e.seek(t),hotkeyAction:`seekStep`,hotkeyValue:e=>typeof e.seconds==`number`?e.seconds:mp.defaultProps.seconds});r();var Km=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 vd),p=o(null),m=o(null),g=uc(lu),[,_]=h(0),[v]=h(()=>yd({getContainer:()=>p.current,getImg:()=>m.current,onStateChange:()=>_(e=>e+1)}));Md(v,()=>v.connect());let y=b(()=>s&&s.length>0?s:g&&g.thumbnailCues.length>0?bp(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:vp,ref:[t,p],props:[f.getAttrs(S),{style:C},d,{children:I(`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 qm=N(null);function Jm({value:e,children:t}){return I(qm.Provider,{value:e,children:t})}function Ym(){let t=e(qm);if(!t)throw Error(`Slider compound components must be used within a Slider.Root`);return t}var Xm=em({displayName:`SliderBuffer`,tag:`div`,useContext:Ym}),Zm=em({displayName:`SliderFill`,tag:`div`,useContext:Ym});r();var Qm=u(function(e,t){let{render:n,className:r,style:i,overflow:a=`clamp`,...s}=e,c=Ym(),{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=_d(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 $m=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 gp),x=gs();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}=Om({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:hd,onValueChange:e=>m?.(b.valueFromPercent(e)),onValueCommit:e=>g?.(b.valueFromPercent(e)),onDragStart:_,onDragEnd:v});return I(Jm,{value:{state:S,pointerValue:b.valueFromPercent(S.pointerPercent),thumbRef:T,thumbProps:O,stateAttrMap:_p,getAttrs:e=>{let t=b.getAttrs(e);return{...t,"aria-label":ps(t[`aria-label`],x)}},formatValue:void 0},children:X(`div`,{render:n,className:r,style:i},{state:S,stateAttrMap:_p,ref:[t,w],props:[{style:{...C,...D}},E,y]})})});r();var eh=u(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Ym(),{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 th=u(function(e,t){let{pointerValue:n}=Ym();return I(Km,{ref:t,...e,time:n})}),nh=em({displayName:`SliderTrack`,tag:`div`,useContext:Ym});r();var rh=u(function(e,t){let{render:n,className:r,style:i,type:a=`current`,format:o,...s}=e,c=Ym(),{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]})}),ih=Qp({Buffer:()=>Xm,Fill:()=>Zm,Preview:()=>Qm,Root:()=>$m,Thumb:()=>eh,Thumbnail:()=>th,Track:()=>nh,Value:()=>rh});r();var ah=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 oh=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 sh=u(function(e,t){let{render:n,className:r,style:i,type:a,negativeSign:o,label:s,toggle:c=!1,...l}=e,u=lc(uu),d=gs(),f=_s(),[p]=h(()=>new Mp),g=a??Mp.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`?ps(Tp,d,{duration:Wf(Math.abs(y.seconds),{locale:f})}):Wf(Math.abs(y.seconds),{locale:f})}:void 0,S=y.negative?I(j,{children:[I(`span`,{"aria-hidden":`true`,children:o??Mp.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&&As(e.nativeEvent)&&(e.preventDefault(),!e.repeat&&C())};return X(`time`,{render:n,className:r,style:i},{state:y,stateAttrMap:Np,ref:[t],props:[{dateTime:y.datetime,children:S,...b,"aria-label":ps(b[`aria-label`],d,x),...c?{onClick:w,onKeyDown:T}:void 0},l]})}),ch=Qp({Group:()=>ah,Separator:()=>oh,Value:()=>sh});r();var lh=()=>Promise.resolve(0),uh=u(function(e,t){let{render:n,className:r,style:i,label:a,changeThrottle:o=Fp.defaultProps.changeThrottle,step:s=Fp.defaultProps.step,largeStep:c=Fp.defaultProps.largeStep,orientation:l,disabled:u,thumbAlignment:d,onDragStart:f,onDragEnd:p,pauseOnDrag:g,..._}=e,v=lc(uu),y=lc(nu),b=lc(su),x=gs(),S=_s(),[C]=h(()=>new Fp);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:M}=Om({computeState:e=>(C.setInput(e),!v||!y?C.setMedia({currentTime:0,duration:0,seeking:!1,seek:lh,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:gd,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?I(Jm,{value:{state:D,pointerValue:C.valueFromPercent(D.pointerPercent),thumbRef:A,thumbProps:M,stateAttrMap:Ip,getAttrs:e=>{let t=C.getAttrs(e);return{...t,"aria-label":ps(t[`aria-label`],x),"aria-valuetext":ps(t[`aria-valuetext`],x,C.getValueTextParams(e))}},formatValue:e=>Hf(e,E)},children:X(`div`,{render:n,className:r,style:i},{state:D,stateAttrMap:Ip,ref:[t,k],props:[{style:{...O,...ee}},j,_]})}):null}),dh=Qp({Buffer:()=>Xm,Fill:()=>Zm,Preview:()=>Qm,Root:()=>uh,Thumb:()=>eh,Track:()=>nh,Value:()=>rh}),fh=em({displayName:`TooltipArrow`,tag:`div`,useContext:Xd,staticProps:{"aria-hidden":`true`}});r();var ph=u(function({render:e,className:t,style:n,children:r,...i},a){let{state:o,stateAttrMap:s,content:c}=Xd(),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 mh=u(function({render:e,className:t,style:n,children:r,...i},a){let{state:o,stateAttrMap:s,content:c}=Xd(),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 hh={position:`fixed`,inset:`auto`,margin:0},gh=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}=Xd(),x=o(null),S=Xs(s,p(e=>{l.setPopupElement(e),e&&Ss()&&e.style.setProperty(`position-anchor`,`--${g}`)},[l,g]),x),C=b(()=>({side:d,align:u.align}),[d,u.align]),w=b(()=>{if(!Ss())return null;let{positionAnchor:e,...t}=ad(g,C,void 0,void 0,void 0,void 0,Rp);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=Xu(v,{container:y,root:r}),a=ud(t,C.side),o=Yu(i),s=ld(t,Rp),c=Fs(n,a,o,C,s),{positionAnchor:u,...d}=ad(g,{...C,side:c},n,Ss()?void 0:a,o,s,Rp);E(d),f(c)}e();let t=l.triggerElement,n=x.current,r=n?Xu(v,{container:y,root:n.getRootNode()}):null,i=0;function a(t){t&&Dd(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??hh;if(!u.open)return null;let O=i===void 0?I(j,{children:[I(ph,{}),I(mh,{})]}):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 _h=N(null),vh=_h.Provider;function yh(){return e(_h)?.group}r();function bh({delay:e,closeDelay:t,timeout:n,children:r}){let[i]=h(()=>new Bp({delay:e,closeDelay:t,timeout:n}));return i.setProps({delay:e,closeDelay:t,timeout:n}),I(vh,{value:{group:i},children:r})}r();function xh({open:e,defaultOpen:t=Lp.defaultProps.defaultOpen,onOpenChange:n,onOpenChangeComplete:r,delay:i=Lp.defaultProps.delay,closeDelay:a=Lp.defaultProps.closeDelay,disableHoverablePopup:o=Lp.defaultProps.disableHoverablePopup,disabled:s=Lp.defaultProps.disabled,boundary:c=`container`,children:l,...u}){let d=pc(),f=fm(),[p]=h(()=>new Lp(u));p.setProps(u);let g=!q(e),_=yh(),v=Y(n),y=Y(r),b=Y(i),x=Y(a),S=Y(o),C=Y(s),w=Y(_),[T]=h(()=>{let e=xd({transition:Sd(),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=im(),k=im(`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]),Md(T);let A=tc(T.input);p.setInput(A);let{state:j,preferredSide:ee,setPositionedSide:M}=jm(p.getState());return I(Yd,{value:{core:p,tooltip:T,state:j,preferredSide:ee,setPositionedSide:M,stateAttrMap:zp,anchorName:O,popupId:k,content:E,setContent:D,boundary:c,container:d},children:l})}r();var Sh=u(function({render:e,className:t,style:n,...r},i){let{tooltip:a,state:o,stateAttrMap:s,anchorName:c}=Xd(),l=p(e=>{a.setTriggerElement(e),e&&Ss()&&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]})}),Ch=Qp({Arrow:()=>fh,Label:()=>ph,Popup:()=>gh,Provider:()=>bh,Root:()=>xh,Shortcut:()=>mh,Trigger:()=>Sh});r();var wh={volume:0,muted:!1,volumeAvailability:`unsupported`,setVolume:()=>0,toggleMuted:()=>!1},Th=u(function(e,t){let{render:n,className:r,style:i,label:a,orientation:s,step:c=Kp.defaultProps.step,largeStep:l=Kp.defaultProps.largeStep,wheelStep:u=Kp.defaultProps.wheelStep,disabled:d,thumbAlignment:f,onDragStart:m,onDragEnd:g,..._}=e,v=lc(du),y=gs(),b=_s(),[x]=h(()=>new Kp);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:M}=Om({computeState:e=>(x.setInput(e),x.setMedia(v??wh),x.getState()),getPercent:w,getStepPercent:T,getLargeStepPercent:()=>x.getLargeStepPercent(),orientation:s,disabled:d,adjustPercent:(e,t,n)=>x.adjustPercentForAlignment(e,t,n),getCSSVars:hd,onValueChange:E,onValueCommit:E,onDragStart:m,onDragEnd:g}),[N]=h(()=>Ed({isDisabled:()=>!!C.current||!S.current,getPercent:()=>(S.current?.volume??0)*100,getStepPercent:()=>x.getWheelStepPercent(),onValueChange:e=>S.current?.setVolume(e/100)})),P=o(null),F=p(e=>{P.current?.(),P.current=null,e&&(P.current=J(e,`wheel`,N.onWheel,{passive:!1}))},[N]);return v?I(Jm,{value:{state:D,pointerValue:x.valueFromPercent(D.pointerPercent),thumbRef:A,thumbProps:M,stateAttrMap:qp,getAttrs:e=>{let t=x.getAttrs(e);return{...t,"aria-label":ps(t[`aria-label`],y),"aria-valuetext":ps(t[`aria-valuetext`],y,x.getValueTextParams(e))}},formatValue:e=>`${Math.round(e)}%`},children:X(`div`,{render:n,className:r,style:i},{state:D,stateAttrMap:qp,ref:[t,k,F],props:[{style:{...O,...ee}},j,_]})}):null}),Eh=Qp({Fill:()=>Zm,Preview:()=>Qm,Root:()=>Th,Thumb:()=>eh,Track:()=>nh,Value:()=>rh}),Dh=v(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Oh=v(((e,t)=>{var n=Dh();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}})),kh=v(((e,t)=>{t.exports=Oh()()}));r();var Z=S(kh());function Ah(){return Ah=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},Ah.apply(this,arguments)}function jh(e,t){if(e==null)return{};var n=Mh(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 Mh(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 Nh=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=jh(e,[`color`,`size`]);return t.createElement(`svg`,Ah({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`}))});Nh.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Nh.displayName=`AlertTriangle`,r();function Ph(){return Ph=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},Ph.apply(this,arguments)}function Fh(e,t){if(e==null)return{};var n=Ih(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 Ih(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 Lh=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Fh(e,[`color`,`size`]);return t.createElement(`svg`,Ph({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`}))});Lh.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Lh.displayName=`Check`,r();function Rh(){return Rh=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},Rh.apply(this,arguments)}function zh(e,t){if(e==null)return{};var n=Bh(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 Bh(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 Vh=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=zh(e,[`color`,`size`]);return t.createElement(`svg`,Rh({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`}))});Vh.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Vh.displayName=`ChevronLeft`,r();function Hh(){return Hh=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},Hh.apply(this,arguments)}function Uh(e,t){if(e==null)return{};var n=Wh(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 Wh(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 Gh=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Uh(e,[`color`,`size`]);return t.createElement(`svg`,Hh({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`}))});Gh.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Gh.displayName=`ChevronRight`,r();function Kh(){return Kh=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},Kh.apply(this,arguments)}function qh(e,t){if(e==null)return{};var n=Jh(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 Jh(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 Yh=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=qh(e,[`color`,`size`]);return t.createElement(`svg`,Kh({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`}))});Yh.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Yh.displayName=`Copy`,r();function Xh(){return Xh=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},Xh.apply(this,arguments)}function Zh(e,t){if(e==null)return{};var n=Qh(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 Qh(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 $h=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Zh(e,[`color`,`size`]);return t.createElement(`svg`,Xh({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`}))});$h.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},$h.displayName=`Maximize`,r();function eg(){return eg=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},eg.apply(this,arguments)}function tg(e,t){if(e==null)return{};var n=ng(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 ng(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 rg=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=tg(e,[`color`,`size`]);return t.createElement(`svg`,eg({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`}))});rg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},rg.displayName=`Minimize`,r();function ig(){return ig=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},ig.apply(this,arguments)}function ag(e,t){if(e==null)return{};var n=og(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 og(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 sg=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=ag(e,[`color`,`size`]);return t.createElement(`svg`,ig({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`}))});sg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},sg.displayName=`Pause`,r();function cg(){return cg=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},cg.apply(this,arguments)}function lg(e,t){if(e==null)return{};var n=ug(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 ug(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 dg=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=lg(e,[`color`,`size`]);return t.createElement(`svg`,cg({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`}))});dg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},dg.displayName=`Play`,r();function fg(){return fg=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},fg.apply(this,arguments)}function pg(e,t){if(e==null)return{};var n=mg(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 mg(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=pg(e,[`color`,`size`]);return t.createElement(`svg`,fg({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`}))});hg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},hg.displayName=`RotateCcw`,r();function gg(){return gg=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},gg.apply(this,arguments)}function _g(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 yg=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=_g(e,[`color`,`size`]);return t.createElement(`svg`,gg({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`}))});yg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},yg.displayName=`Settings`,r();function bg(){return bg=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},bg.apply(this,arguments)}function xg(e,t){if(e==null)return{};var n=Sg(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 Sg(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 Cg=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=xg(e,[`color`,`size`]);return t.createElement(`svg`,bg({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`}))});Cg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Cg.displayName=`Volume1`,r();function wg(){return wg=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},wg.apply(this,arguments)}function Tg(e,t){if(e==null)return{};var n=Eg(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 Eg(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 Dg=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Tg(e,[`color`,`size`]);return t.createElement(`svg`,wg({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`}))});Dg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Dg.displayName=`Volume2`,r();function Og(){return Og=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},Og.apply(this,arguments)}function kg(e,t){if(e==null)return{};var n=Ag(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 Ag(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 jg=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=kg(e,[`color`,`size`]);return t.createElement(`svg`,Og({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`}))});jg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},jg.displayName=`VolumeX`;var Mg=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})()}));re(),r();var Ng=S(Mg(),1),Pg=`react-tooltip-core-styles`,Fg=`react-tooltip-base-styles`,Ig={core:!1,base:!1};function Lg({css:e,id:t=Fg,type:n=`base`,ref:r}){if(!e||typeof document>`u`||Ig[n]||n===`core`&&ie!==void 0&&(ie==null?void 0:{})?.REACT_TOOLTIP_DISABLE_CORE_STYLES||n!==`base`&&ie!==void 0&&(ie==null?void 0:{})?.REACT_TOOLTIP_DISABLE_BASE_STYLES)return;n===`core`&&(t=Pg),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)),Ig[n]=!0}var Rg=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})))},zg=(e,t)=>!(`CSS`in window&&`supports`in window.CSS)||window.CSS.supports(e,t),Bg=(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},Vg=e=>e!==null&&!Array.isArray(e)&&typeof e==`object`,Hg=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every(((e,n)=>Hg(e,t[n])));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Vg(e)||!Vg(t))return e===t;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every((n=>Hg(e[n],t[n])))},Ug=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`}))},Wg=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(Ug(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},Gg=typeof window<`u`?n:m,Kg=e=>{e.current&&=(clearTimeout(e.current),null)},qg=`DEFAULT_TOOLTIP_ID`,Jg={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},Yg=N({getTooltipData:()=>Jg});function Xg(t=qg){return e(Yg).getTooltipData(t)}var Zg={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`},Qg={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`},$g=({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:M,style:N,position:P,afterShow:F,afterHide:I,disableTooltip:L,content:te,contentWrapperRef:ne,isOpen:re,defaultIsOpen:ie=!1,setIsOpen:ae,previousActiveAnchor:oe,activeAnchor:R,setActiveAnchor:se,border:ce,opacity:le,arrowColor:ue,arrowSize:de=8,role:fe=`tooltip`})=>{let pe=o(null),me=o(null),he=o(null),ge=o(null),_e=o(null),[ve,ye]=h({tooltipStyles:{},tooltipArrowStyles:{},place:u}),[z,be]=h(!1),[B,V]=h(!1),[H,xe]=h(null),Se=o(!1),Ce=o(null),{anchorRefs:we,setActiveAnchor:Te}=Xg(n),Ee=o(!1),[De,Oe]=h([]),U=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};M&&(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})),Gg((()=>(U.current=!0,()=>{U.current=!1})),[]);let Pe=e=>{U.current&&(e&&V(!0),setTimeout((()=>{U.current&&(ae?.(e),re===void 0&&be(e))}),10))};m((()=>{if(n){if(z){t(oe);let r=e(R),i=[...new Set([...r,n])].filter(Boolean).join(` `);R?.setAttribute(`aria-describedby`,i)}else t(R);return()=>{t(R),t(oe)}}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`)}}),[R,z,n,oe]),m((()=>{if(re===void 0)return()=>null;re&&V(!0);let e=setTimeout((()=>{be(re)}),10);return()=>{clearTimeout(e)}}),[re]),m((()=>{if(z!==Se.current){if(Kg(_e),Se.current=z,z)F?.();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`));_e.current=setTimeout((()=>{V(!1),xe(null),I?.()}),e+25)}}}),[z]);let Fe=e=>{ye((t=>Hg(t,e)?t:e))},Ie=(e=b)=>{Kg(he),B?Pe(!0):he.current=setTimeout((()=>{Pe(!0)}),e)},Le=(e=x)=>{Kg(ge),ge.current=setTimeout((()=>{Ee.current||Pe(!1)}),e)},Re=e=>{if(!e)return;let t=e.currentTarget??e.target;if(!t?.isConnected)return se(null),void Te({current:null});b?Ie():Pe(!0),se(t),Te({current:t}),Kg(ge)},ze=()=>{T?Le(x||100):x?Le():Pe(!1),Kg(he)},Be=({x:e,y:t})=>{Rg({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:pe.current,tooltipArrowReference:me.current,strategy:_,middlewares:v,border:ce,arrowSize:de}).then((e=>{Fe(e)}))},Ve=e=>{if(!e)return;let t=e,n={x:t.clientX,y:t.clientY};Be(n),Ce.current=n},He=e=>{if(!z)return;let t=e.target;t.isConnected&&(pe.current?.contains(t)||[document.querySelector(`[id='${c}']`),...De].some((e=>e?.contains(t)))||(Pe(!1),Kg(he)))},Ue=Bg(Re,50,!0),We=Bg(ze,50,!0),Ge=e=>{We.cancel(),Ue(e)},Ke=()=>{Ue.cancel(),We()},qe=p((()=>{let e=H?.position??P;e?Be(e):S?Ce.current&&Be(Ce.current):R!=null&&R.isConnected&&Rg({place:H?.place??u,offset:d,elementReference:R,tooltipReference:pe.current,tooltipArrowReference:me.current,strategy:_,middlewares:v,border:ce,arrowSize:de}).then((e=>{U.current&&Fe(e)}))}),[z,R,te,N,u,H?.place,d,_,P,H?.position,S,de]);m((()=>{var e,t;let n=new Set(we);De.forEach((e=>{L!=null&&L(e)||n.add({current:e})}));let r=document.querySelector(`[id='${c}']`);r&&!(L!=null&&L(r))&&n.add({current:r});let i=()=>{Pe(!1)},a=Wg(R),o=Wg(pe.current);Ne.scroll&&(window.addEventListener(`scroll`,i),a?.addEventListener(`scroll`,i),o?.addEventListener(`scroll`,i));let s=null;Ne.resize?window.addEventListener(`resize`,i):R&&pe.current&&(s=ee(R,pe.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&&R?.contains(e.target)),f=e=>{z&&d(e)||Re(e)},p=e=>{z&&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=()=>{Ee.current=!0},_=()=>{Ee.current=!1,ze()},v=T&&(Me.mouseout||Me.mouseleave);return v&&((e=pe.current)==null||e.addEventListener(`mouseover`,g),(t=pe.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=pe.current)==null||e.removeEventListener(`mouseover`,g),(t=pe.current)==null||t.removeEventListener(`mouseout`,_)),u.forEach((({event:e,listener:t})=>{n.forEach((n=>{var r;(r=n.current)==null||r.removeEventListener(e,t)}))}))}}),[R,qe,B,we,De,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(R){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,R)&&(V(!1),Pe(!1),se(null),Kg(he),Kg(ge),!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)&&Oe((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,R]),m((()=>{qe()}),[qe]),m((()=>{if(!ne?.current)return()=>null;let e=new ResizeObserver((()=>{setTimeout((()=>qe()))}));return e.observe(ne.current),()=>{e.disconnect()}}),[te,ne?.current]),m((()=>{let e=document.querySelector(`[id='${c}']`),t=[...De,e];R&&t.includes(R)||se(De[0]??e)}),[c,De,R]),m((()=>(ie&&Pe(!0),()=>{Kg(he),Kg(ge)})),[]),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));Oe(t)}catch{Oe([])}}),[n,l,H?.anchorSelect]),m((()=>{he.current&&(Kg(he),Ie(b))}),[b]);let Je=H?.content??te,W=z&&Object.keys(ve.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}xe(e??null),e?.delay?Ie(e.delay):Pe(!0)},close:e=>{e?.delay?Le(e.delay):Pe(!1)},activeAnchor:R,place:ve.place,isOpen:!!(B&&!C&&Je&&W)}))),B&&!C&&Je?t.createElement(y,{id:n,role:fe,className:(0,Ng.default)(`react-tooltip`,Zg.tooltip,Qg.tooltip,Qg[s],r,`react-tooltip__place-${ve.place}`,Zg[W?`show`:`closing`],W?`react-tooltip__show`:`react-tooltip__closing`,_===`fixed`&&Zg.fixed,T&&Zg.clickable),onTransitionEnd:e=>{Kg(_e),z||e.propertyName!==`opacity`||(V(!1),xe(null),I?.())},style:{...N,...ve.tooltipStyles,opacity:le!==void 0&&W?le:void 0},ref:pe},t.createElement(y,{className:(0,Ng.default)(`react-tooltip-content-wrapper`,Zg.content,Qg.content)},Je),t.createElement(y,{className:(0,Ng.default)(`react-tooltip-arrow`,Zg.arrow,Qg.arrow,i,w&&Zg.noArrow),style:{...ve.tooltipArrowStyles,background:ue?`linear-gradient(to right bottom, transparent 50%, ${ue} 50%)`:void 0,"--rt-arrow-size":`${de}px`},ref:me})):null},e_=({content:e})=>t.createElement(`span`,{dangerouslySetInnerHTML:{__html:e}}),t_=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:M=!1,style:N,position:P,isOpen:F,defaultIsOpen:I=!1,disableStyleInjection:L=!1,border:te,opacity:ne,arrowColor:re,arrowSize:ie,setIsOpen:ae,afterShow:oe,afterHide:R,disableTooltip:se,role:ce=`tooltip`},le)=>{let[ue,de]=h(i),[fe,pe]=h(a),[me,he]=h(d),[ge,_e]=h(u),[ve,ye]=h(f),[z,be]=h(x),[B,V]=h(S),[H,xe]=h(C),[Se,Ce]=h(w),[we,Te]=h(p),[Ee,De]=h(_),[Oe,U]=h(y),[ke,Ae]=h(null),[je,Me]=h(null),Ne=o(null),Pe=o(L),{anchorRefs:Fe,activeAnchor:Ie}=Xg(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=>{he(e??d)},content:e=>{de(e??i)},html:e=>{pe(e??a)},variant:e=>{_e(e??u)},offset:e=>{ye(e===null?f:Number(e))},wrapper:e=>{Te(e??p)},events:e=>{let t=e?.split(` `);De(t??_)},"position-strategy":e=>{U(e??y)},"delay-show":e=>{be(e===null?x:Number(e))},"delay-hide":e=>{V(e===null?S:Number(e))},float:e=>{xe(e===null?C:e===`true`)},hidden:e=>{Ce(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((()=>{de(i)}),[i]),m((()=>{pe(a)}),[a]),m((()=>{he(d)}),[d]),m((()=>{_e(u)}),[u]),m((()=>{ye(f)}),[f]),m((()=>{be(x)}),[x]),m((()=>{V(S)}),[S]),m((()=>{xe(C)}),[C]),m((()=>{Ce(w)}),[w]),m((()=>{U(y)}),[y]),m((()=>{Pe.current!==L&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[L]),m((()=>{typeof window<`u`&&window.dispatchEvent(new CustomEvent(`react-tooltip-inject-styles`,{detail:{disableCore:L===`core`,disableBase:L}}))}),[]),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((()=>{N!=null&&N.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),te&&!zg(`border`,`${te}`)&&console.warn(`[react-tooltip] "${te}" is not a valid \`border\`.`),N!=null&&N.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),ne&&!zg(`opacity`,`${ne}`)&&console.warn(`[react-tooltip] "${ne}" is not a valid \`opacity\`.`)}),[]);let ze=g,Be=o(null);if(s){let e=s({content:je?.getAttribute(`data-tooltip-content`)||ue||null,activeAnchor:je});ze=e?t.createElement(`div`,{ref:Be,className:`react-tooltip-content-wrapper`},e):null}else ue&&(ze=ue);fe&&(ze=t.createElement(e_,{content:fe}));let Ve={forwardRef:le,id:e,anchorId:n,anchorSelect:r,className:(0,Ng.default)(c,ke),classNameArrow:l,content:ze,contentWrapperRef:Be,place:me,variant:ge,offset:ve,wrapper:we,events:Ee,openOnClick:v,positionStrategy:Oe,middlewares:b,delayShow:z,delayHide:B,float:H,hidden:Se,noArrow:T,clickable:E,closeOnEsc:D,closeOnScroll:O,closeOnResize:k,openEvents:A,closeEvents:j,globalCloseEvents:ee,imperativeModeOnly:M,style:N,position:P,isOpen:F,defaultIsOpen:I,border:te,opacity:ne,arrowColor:re,arrowSize:ie,setIsOpen:ae,afterShow:oe,afterHide:R,disableTooltip:se,activeAnchor:je,previousActiveAnchor:Ne.current,setActiveAnchor:e=>{Me((t=>(e!=null&&e.isSameNode(t)||(Ne.current=t),e)))},role:ce};return t.createElement($g,{...Ve})}));typeof window<`u`&&window.addEventListener(`react-tooltip-inject-styles`,(e=>{e.detail.disableCore||Lg({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||Lg({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 n_={indexes:[],thumbnails:[],subtitleTracks:[],selectedSubtitleTrack:void 0,selectSubtitleTrack:()=>{},audioTracks:[],selectedAudioTrack:void 0,selectAudioTrack:()=>{},hideUI:!1,setHideUI:()=>{},togglePictureInPicture:null,pictureInPictureMode:null,burnedInSubtitles:!1,playbackError:null,playbackErrors:[],ready:!1,setSourceState:()=>{}},r_=Ic({name:`source`,state:()=>({...n_}),attach({set:e}){e({setSourceState:t=>e(t),setHideUI:t=>e({hideUI:t})})}}),i_=Nd({features:[...Ru,r_],displayName:`MediaPlayer`}),Q=i_.usePlayer,a_=e=>{if(e&&e!==`und`)try{return new Intl.DisplayNames([navigator.language||`en`],{type:`language`,fallback:`none`}).of(e)||void 0}catch{return}},o_=e=>e?.replace(/_/g,` `).trim()||void 0,s_=e=>{let t=e.map(e=>a_(e.language)??o_(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=o_(e.title);return{track:e,label:(n[i]??0)>1&&a&&a!==i?`${i} (${a})`:i}})},c_=e=>s_(e).map(({track:e,label:t})=>({id:e.streamIndex,label:t})),l_=[0,250,1e3,3e3,1e4],u_=6e4,d_=500,f_=e=>e instanceof Error?e.message:String(e),p_=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(f_(n)),n=n?.cause}return t.length?t.join(`
5
- `):void 0},m_=(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,seekPrepareBudgetMs:v=d_}=n??{},[y,b]=h(void 0),[x,S]=h(0),C=o({count:0,at:0}),w=o(void 0);m(()=>(C.current={count:0,at:0},r.setSourceState({playbackErrors:[]}),()=>{w.current&&clearTimeout(w.current)}),[a]);let T=o(null),E=o(null),D=o(!1),O=o(i);O.current=i;let k=o(n?.onSeek);k.current=n?.onSeek;let A=o(n?.onPlaybackError);A.current=n?.onPlaybackError;let j=p(e=>{let t=typeof e==`number`?e:void 0;D.current=!0,r.setSourceState({selectedSubtitleTrack:t}),T.current?.selectSubtitleStream(t)},[r]),ee=p(e=>{let t=T.current;if(!t||v<=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)`:``}`)}},c=setTimeout(()=>{o=`deadline`,s()},v);t.prepareSeek(e).catch(()=>{}).finally(()=>{clearTimeout(c),s()})},[r,v]),M=p(e=>{typeof e==`number`&&(r.setSourceState({selectedAudioTrack:e}),b(e))},[r]),N=Q(e=>e.setSourceState);m(()=>{N({selectSubtitleTrack:j,selectAudioTrack:M,requestSeek:ee})},[N,j,M,ee]),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=f_(t),o=p_(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=po(e);if(o(e,t),t){let t=performance.now();t-C.current.at>u_&&(C.current={count:0,at:t});let n=l_[Math.min(C.current.count,l_.length-1)];C.current={count:C.current.count+1,at:t},console.warn(`the media element failed; rebuilding the pipeline${n?` in ${n}ms`:``}`,e),w.current&&clearTimeout(w.current),w.current=setTimeout(()=>S(e=>e+1),n);return}console.error(`playback failed`,e),r.setSourceState({playbackError:e}),A.current?.(e)};return(async()=>{try{let i=await Oo({videoElement:e,canvasElement:t,read:(e,t)=>O.current(e,t),length:a,publicPath:s,libavWorkerUrl:c,jassubWorkerUrl:l,jassubWasmUrl:u,jassubLegacyWasmUrl:d,defaultFontUrl:f,bufferSize:g,audioStreamIndex:y,onReady:()=>{if(n)return;r.setSourceState({ready:!0});let t=E.current;E.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=>k.current?.(e),onSubtitleStreams:e=>{n||r.setSourceState({subtitleTracks:c_(e),...D.current?{}:{selectedSubtitleTrack:e[0]?.streamIndex}})},onAudioStreams:(e,t)=>{n||r.setSourceState({audioTracks:c_(e),selectedAudioTrack:t})}});if(n){i.destroy();return}T.current=i,r.setSourceState({indexes:i.indexes});let o=r.selectedSubtitleTrack;typeof o==`number`&&i.selectSubtitleStream(o)}catch(e){p(e)}})(),()=>{n=!0,E.current={time:e.currentTime,size:a},T.current?.destroy(),T.current=null,r.setSourceState({ready:!1})}},[r,e,t,a,s,c,l,u,d,f,g,y,_,x])},h_=5e3,g_=6e4,__=({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=h_,f=()=>{Fo({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,g_))})};return f(),()=>{i=!0,clearTimeout(o),c.current=null,a?.destroy(),s([])}},[n,e,t]),m(()=>{c.current?.update(u)},[u]),a},v_=(e,t)=>{let n=o(null),[r,i]=h(!1),[a]=h(()=>Uo());m(()=>{if(!e||!t||!a)return;let r=Wo({video:e,canvas: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}},y_={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
- `}},b_=D`
138
- top: unset !important;
139
- left: unset !important;
140
- width: 100%;
141
- height: 100%;
142
- margin: auto;
143
- pointer-events: none;
144
- `,x_=D`
145
- position: absolute;
146
- top: 0;
147
- left: 0;
148
- width: 100%;
149
- padding: calc(1.2 * var(--mp-unit)) calc(1.6 * var(--mp-unit));
150
- /* clears a notch once the player is fullscreen; resolves to zero everywhere else */
151
- padding-top: calc(calc(1.2 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
152
- ${y_.headings.small}
153
- color: white;
154
- text-shadow: 0 0 4px rgba(0, 0, 0, 1);
155
- z-index: 2;
156
- pointer-events: none;
157
-
158
- /* one line with an ellipsis until there is width to wrap, since a release filename would
159
- otherwise run to four lines on a phone */
160
- white-space: nowrap;
161
- overflow: hidden;
162
- text-overflow: ellipsis;
163
-
164
- @media (min-width: 768px) {
165
- padding: calc(2.4 * var(--mp-unit));
166
- padding-top: calc(calc(2.4 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
167
- white-space: normal;
168
- overflow: visible;
169
- }
170
-
171
- 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%);
172
- transition: opacity 0.1s cubic-bezier(.4,0,1,1);
173
- `,S_=D`
174
- position: absolute;
175
- inset: 0;
176
- z-index: 2;
177
- display: flex;
178
- justify-content: center;
179
- align-items: center;
180
- pointer-events: none;
181
-
182
- ::after {
183
- content: '';
184
- width: calc(4 * var(--mp-unit));
185
- height: calc(4 * var(--mp-unit));
186
- border-radius: 50%;
187
- border: 3px solid rgba(255, 255, 255, 0.25);
188
- border-top-color: #fff;
189
- animation: ${s`
190
- to { transform: rotate(360deg); }
191
- `} 0.8s linear infinite;
192
- }
193
- `,C_=D`
194
- position: absolute;
195
- inset: auto 0 20%;
196
- z-index: 3;
197
- padding: 0 calc(2 * var(--mp-unit));
198
- text-align: center;
199
- color: #fff;
200
- ${y_.bLarge.regular}
201
- text-shadow: 0 0 4px rgba(0, 0, 0, 1);
202
- pointer-events: none;
203
- `,w_=e=>e instanceof Error?e.message:typeof e==`string`?e:`Playback failed`,T_=({onCanvasRef: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);return y(O,{children:[t?F(`div`,{className:`title`,css:x_,style:{...n?{opacity:`0`,pointerEvents:`none`}:{}},children:t}):void 0,(a?!i:o)&&!r?F(`div`,{css:S_}):void 0,r?F(`div`,{css:C_,children:w_(r)}):void 0,F(`canvas`,{ref:e,css:b_})]})},E_=1e-4,D_=1,O_=e=>Math.max(E_,Math.min(D_,e))**2,k_=e=>Math.max(E_,Math.min(D_,e))**(D_/2),A_=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}`},j_=(e,t)=>`${A_(e)} / ${A_(t)}`,M_=e=>D`
204
- display: flex;
205
- justify-content: flex-start;
206
-
207
- /*
208
- * Bounded here rather than at each call site.
209
- *
210
- * react-tooltip's own chip rule carries width: max-content, so with nothing opposing it a chip
211
- * grows to the widest UNWRAPPED line of its content: a two sentence tooltip measured 1178px
212
- * through this component. Both declarations are load bearing, since a bound with no wrapping only
213
- * moves the overflow inside a narrow box. 26 units is the width control-bar.tsx was already
214
- * imposing on its own two line tooltip by hand, so nothing in the bar changes shape.
215
- */
216
- max-width: min(calc(26 * var(--mp-unit)), calc(100vw - calc(2.4 * var(--mp-unit))));
217
- white-space: normal;
218
- overflow-wrap: anywhere;
219
- text-align: left;
220
-
221
- /*
222
- * The radius carries !important for the same reason the paddings below do.
223
- *
224
- * react-tooltip injects its stylesheet from a passive effect while emotion inserts through
225
- * useInsertionEffect, which runs earlier, so react-tooltip's sheet lands in the head LAST at
226
- * exactly this specificity and wins every tie. Its own radius is 3px, which is what was drawn
227
- * here until this was stated.
228
- */
229
- border-radius: calc(0.4 * var(--mp-unit))!important;
230
- user-select: none;
231
-
232
- z-index: 3;
233
-
234
- * {
235
- ${y_.bMedium.regular}
236
- }
237
-
238
- ${e===`sm`&&D`
239
- padding: calc(0.4 * var(--mp-unit))!important;
240
- `}
241
- ${e===`md`&&D`
242
- padding: calc(0.6 * var(--mp-unit))!important;
243
- `}
244
- ${e===`lg`&&D`
245
- padding: calc(1.2 * var(--mp-unit))!important;
246
- `}
247
- `,N_={x:-1,y:-1,anchors:0},P_=e=>{N_.x=e.clientX,N_.y=e.clientY},F_=()=>(N_.anchors++===0&&window.addEventListener(`pointermove`,P_,{capture:!0,passive:!0}),()=>{--N_.anchors===0&&window.removeEventListener(`pointermove`,P_,{capture:!0})}),I_=({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=F_(),t=()=>{let e=u.current;if(!e)return;let{left:t,right:n,top:r,bottom:i}=e.getBoundingClientRect();N_.x>=t&&N_.x<n&&N_.y>=r&&N_.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:[F(`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&&F(t_,{ref:d,css:M_(l),id:e,noArrow:!0,children:t})]})},L_=({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`}}}},R_=D`
248
- position: relative;
249
- height: calc(.4 * var(--mp-unit));
250
-
251
- --thumbnail-width: calc(25 * var(--mp-unit));
252
- --thumbnail-half: calc(12.5 * var(--mp-unit));
253
-
254
- transition: transform .2s ease-in-out;
255
-
256
- margin: 0 12px;
257
- @media (min-width: 768px) {
258
- margin: 0 16px;
259
- }
260
- @media (min-width: 2560px) {
261
- margin: 0 24px;
262
- }
263
-
264
- user-select: none;
265
- cursor: pointer;
266
-
267
- :hover {
268
- .background-bar {
269
- transform: scaleY(1.5);
270
- }
271
- .loaded {
272
- transform: scaleY(1.5);
273
- top: calc(-.1 * var(--mp-unit));
274
- }
275
- .play-container {
276
- transform: scaleY(1.5);
277
- }
278
- }
279
-
280
-
281
- .background-bar {
282
- position: absolute;
283
- inset: 0;
284
- background-color: hsla(0, 100%, 100%, .2);
285
- }
286
-
287
- .cursor-time {
288
- display: flex;
289
- justify-content: center;
290
-
291
- /* The seekbar's other hover affordance, the thumbnail below, gets a rounded box and a drop
292
- shadow. A source that ships no thumbnails, which is every source whose media the player does
293
- not own, leaves this readout as the entire preview, so it carries the same treatment instead
294
- of sitting as bare text on the picture. The ink comes from the player root. */
295
- background-color: rgba(28, 28, 28, .95);
296
- border-radius: calc(.4 * var(--mp-unit));
297
- padding: 0 calc(.6 * var(--mp-unit));
298
- box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
299
-
300
- text-shadow: 0 0 4px rgba(0, 0, 0, 1);
301
- ${y_.bMedium.bold}
302
-
303
- position: absolute;
304
- /* Anchored on its bottom edge rather than its top: now that it has a background its height
305
- follows the font size, and a top-anchored box would grow downward into the track. */
306
- bottom: calc(1.2 * var(--mp-unit));
307
- /* Sized to its content, replacing a fixed 5 unit box that \`1:04:09\` overflows. Transparent, that
308
- overflow was invisible; filled, it would not be. */
309
- width: max-content;
310
- white-space: nowrap;
311
- transform: translateX(-50%);
312
-
313
- pointer-events: none;
314
- }
315
-
316
- .loaded {
317
- transform-origin: 0 0;
318
- position: absolute;
319
- bottom: 0;
320
- height: calc(.4 * var(--mp-unit));
321
- width: 100%;
322
- .loaded-part {
323
- transform-origin: 0 0;
324
- bottom: 0;
325
- height: calc(.4 * var(--mp-unit));
326
- width: 100%;
327
- position: absolute;
328
- background-color: hsla(0, 100%, 100%, .4);
329
- }
330
- }
331
-
332
- .play-container {
333
- position: absolute;
334
- bottom: 0;
335
- width: 100%;
336
- height: calc(.4 * var(--mp-unit));
337
- }
338
-
339
- .play {
340
- transform-origin: 0 0;
341
- background-color: #f03;
342
- position: absolute;
343
- bottom: 0;
344
- height: calc(.4 * var(--mp-unit));
345
- width: 100%;
346
- }
347
-
348
- .padding {
349
- position: absolute;
350
- bottom: -7.5px;
351
- height: calc(2 * var(--mp-unit));
352
- width: 100%;
353
- }
354
-
355
- .thumbnail {
356
- display: flex;
357
- justify-content: center;
358
-
359
- position: absolute;
360
- top: calc(calc(-3.4375 * var(--mp-unit)) - var(--thumbnail-width) * 9/16);
361
- height: calc(var(--thumbnail-width) * 9/16);
362
- width: var(--thumbnail-width);
363
-
364
- margin-left: calc(var(--thumbnail-half) * -1);
365
- pointer-events: none;
366
-
367
- img {
368
- border-radius: calc(.4 * var(--mp-unit));
369
- box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
370
-
371
- width: 100%;
372
- height: 100%;
373
- object-fit: cover;
374
- }
375
- }
376
-
377
- /* a thumb is far wider than a cursor, so the hit strip grows to 44px and the track thickens */
378
- @media (pointer: coarse) {
379
- height: calc(.6 * var(--mp-unit));
380
-
381
- /* press feedback, coarse only: a finger has no hover, so without this the bar gives no sign
382
- it is being dragged */
383
- &.dragging {
384
- .background-bar, .loaded, .play-container {
385
- transform: scaleY(1.5);
386
- }
387
- }
388
-
389
- .loaded {
390
- height: calc(.6 * var(--mp-unit));
391
- .loaded-part {
392
- height: calc(.6 * var(--mp-unit));
393
- }
394
- }
395
-
396
- .play-container {
397
- height: calc(.6 * var(--mp-unit));
398
- }
399
-
400
- .play {
401
- height: calc(.6 * var(--mp-unit));
402
- }
403
-
404
- /* grows upward into the video: centred, it would hang over the control row and win hit
405
- testing against taps meant for play, mute and fullscreen */
406
- .padding {
407
- height: 44px;
408
- bottom: 0;
409
- }
410
- }
411
-
412
- /* the clamp only holds the preview inside the bar while the bar is the wider of the two, so
413
- below that the preview is narrowed instead */
414
- @media (max-width: 480px) {
415
- --thumbnail-width: calc(18 * var(--mp-unit));
416
- --thumbnail-half: calc(9 * var(--mp-unit));
417
- }
418
- `,z_=4,B_=()=>{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=o(null),[d,f]=h(void 0),[p,g]=h(void 0),_=o(void 0),v=o(0),x=o(void 0),S=o(void 0),C=o(!1),{dragging:w,handlers:T}=L_({ref:u,onChange:e=>{if(v.current+=1,x.current=e,S.current===void 0)S.current=e;else if(!C.current){let t=u.current?.getBoundingClientRect().width??0;Math.abs(e-S.current)*t>z_&&(C.current=!0)}f(e),_.current!==`mouse`&&g(e*r)}}),E=e=>{_.current=e.pointerType,v.current=0,S.current=void 0,C.current=!1,T.onPointerDown(e)},D=t=>{T.onPointerUp(t);let i=v.current>0?x.current:void 0;if(i!==void 0&&r){let t=i*r;n?n(t):e.seek(t)}v.current=0,C.current=!1,S.current=void 0,t.pointerType!==`mouse`&&g(void 0)},O=e=>{if(!u.current)return;let{left:t,right:n}=u.current.getBoundingClientRect();return Math.min(Math.max((e-t)/(n-t),0),1)*r},k=e=>{g(O(e.clientX))},A=()=>{u.current&&g(void 0)},j=e=>r?e/r*100:0,ee=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 F(`div`,{className:`loaded-part`,style:{transform:`scaleX(${u})`,marginLeft:`${d}%`}},t)})??[],[r,s.length,a?.map(({startByteOffset:e,endByteOffset:t})=>`${e}/${t}`).join(`,`)]),M=b(()=>{if(!p||p<0)return;let e=Math.floor(p/3600),t=Math.floor((p-e*3600)/60),n=Math.floor(p-e*3600-t*60);return`${e>0?`${e}:`:``}${t<10?`0`:``}${t}:${n<10?`0`:``}${n}`},[p]);m(()=>{d===void 0||!r||!w||!C.current||e.seek(d*r)},[e,w,d,r]);let N=b(()=>!r||typeof t!=`number`?0:t/r,[r,t]),P=b(()=>{if(p){if(l)return l(p);if(c.length)return c.find(({startTime:e,endTime:t})=>e<=p&&p<t)}},[c,l,p]);return y(`div`,{css:R_,ref:u,className:w?`progress-bar dragging`:`progress-bar`,onMouseMove:k,onMouseOut:A,children:[F(`div`,{className:`background-bar`}),p?F(`div`,{className:`cursor-time`,style:{left:`clamp(calc(3 * var(--mp-unit)), ${j(p)}%, calc(100% - calc(3 * var(--mp-unit))))`},children:M}):void 0,F(`div`,{className:`progress`}),F(`div`,{className:`loaded`,children:ee}),F(`div`,{className:`hover`}),F(`div`,{className:`play-container`,children:F(`div`,{className:`play`,style:{transform:`scaleX(${N})`}})}),F(`div`,{className:`chapters`}),F(`div`,{className:`scrubber`}),F(`div`,{className:`padding`,...T,onPointerDown:E,onPointerUp:D,onPointerCancel:D}),F(`div`,{className:`thumbnail`,style:{left:`clamp(var(--thumbnail-half), ${j(p??1)}%, calc(100% - var(--thumbnail-half)))`},children:P?.url?F(`img`,{src:P.url}):void 0})]})},V_=`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`,H_={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`},U_=e=>y(`svg`,{...H_,...e,children:[F(`rect`,{x:`3`,y:`5`,width:`18`,height:`14`,rx:`2`,ry:`2`}),F(`path`,{d:`M7 15h4m4 0h2M7 11h2m4 0h4`})]}),W_=e=>y(`svg`,{...H_,...e,children:[F(`rect`,{x:`3`,y:`5`,width:`18`,height:`14`,rx:`2`,ry:`2`}),F(`path`,{d:`M7 15h4m4 0h2M7 11h2m4 0h4`}),F(`line`,{x1:`2`,y1:`2`,x2:`22`,y2:`22`})]}),G_=e=>y(`svg`,{...H_,...e,children:[F(`path`,{d:`M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5`}),F(`rect`,{x:`12`,y:`13`,width:`10`,height:`8`,rx:`1`,ry:`1`}),F(`path`,{d:`M14.5 18.5h2m2 0h1`})]}),K_=e=>y(`svg`,{...H_,...e,children:[F(`path`,{d:`M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5`}),F(`rect`,{x:`12`,y:`13`,width:`10`,height:`8`,rx:`1`,ry:`1`}),F(`path`,{d:`M6 9h3m2 0h2`})]}),q_=D`
419
- .popover {
420
- position: absolute;
421
- /* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
422
- bar, so a menu centred on it puts its own edges wherever the button happens to sit: with no
423
- picture-in-picture button, which is every source whose media the player does not own, an edge
424
- landed outside the box, and the root's \`overflow: hidden\` cut it off, taking the rows under it
425
- out of reach. The inset matches the bar's own padding so the menu lines up with the last button. */
426
- right: calc(12px + env(safe-area-inset-right, 0px));
427
- bottom: calc(100% + 8px);
428
-
429
- overflow-y: auto;
430
- width: 180px;
431
- /* \`100%\` is the control bar, which is the width of the PLAYER. The old \`100vw\` was the viewport,
432
- which equals the player only when the player is the whole document, and it is the wrong kind of
433
- guard besides: a max-width shrinks the box, it never moves it back inside. */
434
- max-width: calc(100% - 24px);
435
- /* Sized to its rows, capped at what fits. A fixed height left the settings menu two thirds empty
436
- once subtitles moved out to its own button, and a long track list scrolls at the cap either way. */
437
- height: max-content;
438
- /* The room actually above the bar. A short player had the top of the menu clipped by that same
439
- \`overflow: hidden\`. With no size container in the ancestry this resolves against the small
440
- viewport, so it can only ever shrink the box, never grow it. */
441
- max-height: min(160px, calc(100cqh - 100% - 16px));
442
- @media (min-width: 768px) {
443
- right: calc(16px + env(safe-area-inset-right, 0px));
444
- width: 250px;
445
- max-width: calc(100% - 32px);
446
- }
447
- @media (min-width: 2560px) {
448
- right: calc(24px + env(safe-area-inset-right, 0px));
449
- max-width: calc(100% - 48px);
450
- }
451
-
452
- display: flex;
453
- flex-direction: column;
454
-
455
- border-radius: 8px;
456
- background-color: rgba(28,28,28,0.95);
457
- ${y_.bMedium.regular}
458
-
459
- z-index: 4;
460
-
461
- > div {
462
- display: flex;
463
- align-items: center;
464
- justify-content: space-between;
465
-
466
- color: #fff;
467
- outline: none;
468
-
469
- padding: 8px 6px 8px 12px;
470
-
471
- width: 100%;
472
- /* rows keep their own height inside the fixed height column, so a long page scrolls rather than
473
- squashing every row into it */
474
- flex-shrink: 0;
475
- @media (pointer: coarse) {
476
- box-sizing: border-box;
477
- min-height: 44px;
478
- }
479
-
480
- :first-of-type {
481
- border-radius: 8px 8px 0 0;
482
- }
483
- :last-of-type {
484
- border-radius: 0 0 8px 8px;
485
- }
486
- &:not(.no-hover) {
487
- cursor: pointer;
488
- }
489
- &:not(.no-hover):hover {
490
- background-color: rgba(255,255,255,.1);
491
- }
492
-
493
- > div {
494
- display: flex;
495
- align-items: center;
496
- justify-content: center;
497
-
498
- .secondary {
499
- color: #eee;
500
- ${y_.bSmall.regular}
501
- }
502
- }
503
- }
504
-
505
- .back {
506
- display: flex;
507
- align-items: center;
508
- justify-content: flex-start;
509
- border-bottom: 1px solid #4D4D4E;
510
-
511
- svg {
512
- transform: translateX(-4px);
513
- transition: transform 0.2s ease-in-out;
514
- }
515
-
516
- :hover {
517
- svg {
518
- transform: translateX(-8px);
519
- }
520
- }
521
- }
522
- }
523
-
524
- .track-list {
525
- .description {
526
- word-break: break-word;
527
- }
528
-
529
- /* Dimmed and inert, but still listed. A source that names a track it cannot serve right now is
530
- saying the track exists, and dropping the row would read as the source having nothing. */
531
- .unavailable {
532
- opacity: 0.5;
533
- cursor: default;
534
- :hover {
535
- background-color: transparent;
536
- }
537
- }
538
-
539
- .failed {
540
- border-bottom: 1px solid #4D4D4E;
541
- color: #f66;
542
- ${y_.bSmall.regular}
543
- }
544
- }
545
- `,J_=({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:[F(`span`,{children:i}),F(`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?F(Vh,{}):null,F(`span`,{children:e})]}),s?F(`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`))]})},Y_=({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)})}}},X_=D`
546
- /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
547
- which is the width of the player box, so it can be clamped to it. */
548
- position: static;
549
-
550
- .errors {
551
- /* the icon keeps its size, the pressable box grows around it */
552
- @media (pointer: coarse) {
553
- box-sizing: border-box;
554
- justify-content: center;
555
-
556
- min-width: 44px;
557
- min-height: 44px;
558
- }
559
- }
560
-
561
- ${q_}
562
-
563
- .popover.error-list {
564
- /* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
565
- decoder message that has been ellipsized is not worth copying. */
566
- width: 420px;
567
- max-height: min(300px, calc(100cqh - 100% - 16px));
568
-
569
- /* track-menu's header is a left-aligned label row; here it carries a control too, so the two
570
- ends go to the two ends */
571
- .back {
572
- justify-content: space-between;
573
- gap: 8px;
574
- }
575
-
576
- .copy {
577
- /* sits in the header row, which track-menu styles as .back */
578
- display: flex;
579
- align-items: center;
580
- gap: 6px;
581
-
582
- background: none;
583
- border: none;
584
- padding: 4px 6px;
585
- border-radius: 4px;
586
-
587
- color: #fff;
588
- cursor: pointer;
589
- ${y_.bSmall.regular}
590
-
591
- &:hover {
592
- background-color: rgba(255,255,255,.1);
593
- }
594
-
595
- svg {
596
- width: 14px;
597
- height: 14px;
598
- }
599
- }
600
-
601
- .entry {
602
- /* one failure is a block of text, so it stacks instead of sitting on one line */
603
- display: flex;
604
- flex-direction: column;
605
- align-items: flex-start;
606
- gap: 2px;
607
-
608
- .when {
609
- color: #bbb;
610
- ${y_.bSmall.regular}
611
-
612
- /* the one part of the line worth scanning for, so it is the one part at full brightness */
613
- .count {
614
- margin-left: 6px;
615
- color: #fff;
616
- }
617
- }
618
-
619
- .what {
620
- /* the decoder's own words, which are long and must not be cut */
621
- overflow-wrap: anywhere;
622
- white-space: pre-wrap;
623
- }
624
-
625
- .cause {
626
- color: #ddd;
627
- overflow-wrap: anywhere;
628
- white-space: pre-wrap;
629
- ${y_.bSmall.regular}
630
- }
631
- }
632
- }
633
- `,Z_=e=>new Date(e).toLocaleTimeString(),Q_=e=>e===void 0||!Number.isFinite(e)?void 0:A_(Math.max(0,e)),$_=e=>e.reduce((e,t)=>e+t.count,0),ev=e=>e.map((e,t)=>{let n=Q_(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(`
634
- `)}).join(`
635
-
636
- `),tv=()=>{let e=Q(e=>e.playbackErrors),{open:t,toggle:n,containerRef:r}=Y_(),[i,a]=h(!1);if(e.length===0)return null;let o=()=>{navigator.clipboard?.writeText(ev(e)).then(()=>{a(!0),setTimeout(()=>a(!1),2e3)},e=>console.warn(`[media-player] could not copy the errors:`,e))},s=`Playback errors (${$_(e)})`;return y(`div`,{css:X_,ref:r,children:[F(I_,{id:`errors`,disabled:t,text:F(`button`,{className:`errors`,type:`button`,onClick:n,"aria-label":s,"aria-expanded":t,children:F(Nh,{className:`alert-triangle`})}),toolTipText:F(`span`,{children:s})}),t&&y(`div`,{className:`popover error-list`,children:[y(`div`,{className:`back no-hover`,children:[F(`span`,{children:s}),y(`button`,{className:`copy`,type:`button`,onClick:o,"aria-label":`Copy the errors`,children:[F(i?Lh:Yh,{}),F(`span`,{children:i?`Copied`:`Copy`})]})]}),e.map((e,t)=>y(`div`,{className:`entry no-hover`,children:[y(`span`,{className:`when`,children:[Z_(e.at),e.count>1?` to ${Z_(e.lastAt)}`:``,Q_(e.atMediaTime)?` at ${Q_(e.atMediaTime)}`:``,e.recovered?` recovered`:``,e.count>1?F(`span`,{className:`count`,children:`×${e.count}`}):null]}),F(`span`,{className:`what`,children:e.message}),e.detail?F(`span`,{className:`cause`,children:e.detail}):null]},`${e.at}-${t}`))]})]})},nv=D`
637
- display: flex;
638
- align-items: center;
639
- justify-content: center;
640
- flex-direction: column;
641
- width: 100%;
642
-
643
- .playback-slider {
644
- display: flex;
645
- align-items: center;
646
-
647
- padding: 8px 4px;
648
- margin: 0 2px;
649
- /* a finger needs a 44px band to press, so the padding grows while the track stays 3px */
650
- @media (pointer: coarse) {
651
- padding: 20px 8px;
652
- }
653
-
654
- cursor: pointer;
655
-
656
- > div {
657
- position: relative;
658
-
659
- background: #ccc;
660
- border-radius: 4px;
661
-
662
- width: 120px;
663
- max-width: 100%;
664
- height: 3px;
665
- @media (min-width: 768px) {
666
- height: 4px;
667
- }
668
- }
669
-
670
- .playback-handle {
671
- position: absolute;
672
-
673
-
674
- background: #ffffff;
675
- border-radius: 50%;
676
- transform: translateX(-50%);
677
- pointer-events: none;
678
-
679
- width: 10px;
680
- height: 10px;
681
- top: -3.5px;
682
- @media (min-width: 768px) {
683
- width: 12px;
684
- height: 12px;
685
- top: -4px;
686
- }
687
- }
688
- }
689
- `,rv=()=>{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}=L_({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:nv,children:[y(`div`,{children:[c.toFixed(2),`x`]}),F(`div`,{className:`playback-slider`,ref:n,...d,children:F(`div`,{ref:r,style:{background:`linear-gradient(to right,
690
- #fff 0% ${p}%,
691
- #3A3A3A ${p}% 100%
692
- )`},children:F(`div`,{className:`playback-handle`,style:{left:`${p}%`}})})})]})},iv=D`
693
- /* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
694
- as wide as the player box and can therefore be clamped to it. The outside-click check uses
695
- \`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
696
- tooltips already resolve against the control bar with no positioned wrapper of their own. */
697
- position: static;
698
-
699
- .settings {
700
- /* the icon keeps its size, the pressable box grows around it */
701
- @media (pointer: coarse) {
702
- box-sizing: border-box;
703
- justify-content: center;
704
-
705
- min-width: 44px;
706
- min-height: 44px;
707
- }
708
- }
709
-
710
- ${q_}
711
-
712
- .playback-rate {
713
- .slider {
714
- width: 100%;
715
- }
716
- .options {
717
- display: grid;
718
- grid-template-columns: 1fr 1fr 1fr 1fr;
719
- align-items: center;
720
-
721
- padding: 8px 12px;
722
- /* four presets across a 180px popover leave targets 34px wide, so a finger gets two rows of two
723
- until the popover is wide enough for the row of four */
724
- @media (pointer: coarse) {
725
- grid-template-columns: 1fr 1fr;
726
- }
727
- @media (pointer: coarse) and (min-width: 768px) {
728
- grid-template-columns: 1fr 1fr 1fr 1fr;
729
- }
730
-
731
- > div {
732
- display: flex;
733
- align-items: center;
734
- border-radius: 4px;
735
-
736
- padding: 8px 6px;
737
- height: 100%;
738
- @media (pointer: coarse) {
739
- box-sizing: border-box;
740
- min-height: 44px;
741
- }
742
-
743
- cursor: pointer;
744
- :hover {
745
- background-color: rgba(255,255,255,.1);
746
- }
747
- }
748
- }
749
- }
750
-
751
- `,av=()=>{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}=Y_({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:iv,ref:l,children:[F(I_,{id:`settings`,disabled:s,text:F(`button`,{className:`settings`,type:`button`,onClick:c,"aria-label":`Settings`,"aria-expanded":s,children:F(yg,{})}),toolTipText:F(`span`,{children:`Settings`})}),s&&a===0&&y(`div`,{className:`popover menu`,children:[n.length>1?y(`div`,{onClick:g(2),children:[F(`div`,{children:`Audio`}),F(`div`,{children:F(Gh,{})})]}):null,y(`div`,{onClick:g(1),children:[F(`div`,{children:`Playback speed`}),y(`div`,{children:[F(`span`,{className:`secondary`,children:t===1?`(Default)`:t.toFixed(2)}),F(Gh,{})]})]})]}),s&&a===1&&y(`div`,{className:`popover playback-rate`,children:[y(`div`,{className:`back`,onClick:g(0),children:[F(Vh,{}),F(`span`,{children:`Playback speed`})]}),F(`div`,{className:`slider no-hover`,children:F(rv,{})}),y(`div`,{className:`options no-hover`,children:[F(`div`,{onClick:()=>p(.5),children:`0.5x`}),F(`div`,{onClick:()=>p(1),children:`1x`}),F(`div`,{onClick:()=>p(1.5),children:`1.5x`}),F(`div`,{onClick:()=>p(2),children:`2x`})]})]}),s&&a===2&&F(J_,{title:`Audio`,tracks:n,selected:r,onSelect:m,onBack:g(0),pending:u,failed:d})]})},ov=D`
752
- /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
753
- which is the width of the player box, so it can be clamped to it. */
754
- position: static;
755
-
756
- .subtitles {
757
- /* the icon keeps its size, the pressable box grows around it */
758
- @media (pointer: coarse) {
759
- box-sizing: border-box;
760
- justify-content: center;
761
-
762
- min-width: 44px;
763
- min-height: 44px;
764
- }
765
- }
766
-
767
- ${q_}
768
- `,sv=()=>{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}=Y_();if(e.length===0)return null;let u=t!==void 0;return y(`div`,{css:ov,ref:o,children:[F(I_,{id:`subtitles`,disabled:i,text:F(`button`,{className:`subtitles`,type:`button`,onClick:a,"aria-label":`Subtitles`,"aria-expanded":i,"aria-pressed":u,children:u?F(U_,{className:`captions`}):F(W_,{className:`captions-off`})}),toolTipText:F(`span`,{children:`Subtitles`})}),i&&F(J_,{title:`Subtitles`,tracks:e,selected:t,onSelect:e=>l(e??null,()=>n(e)),offLabel:r??`Disable`,pending:s,failed:c})]})},cv={primary:`#EAEBEE`,secondary:`#D0D0D9`,hover:`rgba(255, 255, 255, 0.13)`,borderPrimary:`#384F70`,backgroundTooltip:`#222222`},lv=D`
769
- display: flex;
770
- align-items: center;
771
-
772
- padding: 16px 4px;
773
- margin: 0 2px;
774
- /* a finger needs a 44px band to press, so the padding grows while the track stays 3px */
775
- @media (pointer: coarse) {
776
- padding: 22px 4px;
777
- }
778
-
779
- cursor: pointer;
780
-
781
- > div {
782
- position: relative;
783
-
784
- background: #ccc;
785
- border-radius: 4px;
786
-
787
- width: 80px;
788
- height: 3px;
789
- /* the control bar has under 360px to fit every button once the slider is always open, so the
790
- track lends some of its length back on a phone and takes it again on anything wider */
791
- @media (pointer: coarse) {
792
- width: 64px;
793
- }
794
- @media (pointer: coarse) and (min-width: 768px) {
795
- width: 80px;
796
- }
797
- }
798
-
799
- .volume-handle {
800
- position: absolute;
801
- top: -3.5px;
802
-
803
- background: #ffffff;
804
- border-radius: 50%;
805
- transform: translateX(-50%);
806
- pointer-events: none;
807
-
808
- width: 10px;
809
- height: 10px;
810
- }
811
- `,uv=({value:e,onChange:t})=>{let n=Q(e=>e.volume),r=Q(e=>e.muted),i=o(null),a=o(null),{handlers:s}=L_({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:k_(n)*100),[n,r]);return F(I_,{id:`volume-slider`,text:F(`div`,{ref:i,css:lv,...s,children:F(`div`,{ref:a,style:{background:`linear-gradient(to right,
812
- #fff 0% ${l}%,
813
- #3A3A3A ${l}% 100%
814
- )`},children:F(`div`,{className:`volume-handle`,style:{left:`${e*100}%`}})})}),toolTipText:y(`div`,{className:`volume-value`,children:[u,`%`]})})},dv=D`
815
- position: relative;
816
- display: flex;
817
- align-items: center;
818
-
819
- .volume-slider-container {
820
- display: flex;
821
- align-items: center;
822
-
823
- width: 0;
824
- margin-right: 0;
825
- overflow: hidden;
826
- pointer-events: none;
827
-
828
- transition: margin .2s cubic-bezier(0.4,0,1,1), width .2s cubic-bezier(0.4,0,1,1);
829
- -webkit-transition: margin .2s cubic-bezier(0.4,0,1,1), width .2s cubic-bezier(0.4,0,1,1);
830
-
831
- .volume-slider-background {
832
- display: flex;
833
- flex-direction: row;
834
- align-items: center;
835
-
836
- border-radius: 4px;
837
-
838
- .volume-value {
839
- ${y_.bMedium.regular};
840
- color: #ffffff;
841
- }
842
- }
843
- }
844
-
845
- &:hover .volume-slider-container {
846
- width: calc(9 * var(--mp-unit));
847
-
848
- transition: margin .2s cubic-bezier(0,0,0.2,1), width .2s cubic-bezier(0,0,0.2,1);
849
- -webkit-transition: margin .2s cubic-bezier(0,0,0.2,1), width .2s cubic-bezier(0,0,0.2,1);
850
-
851
- pointer-events: auto;
852
- }
853
-
854
- /* a touch screen has no hover, so the slider stays open there and the button only mutes */
855
- @media (pointer: coarse) {
856
- /* auto, not a fixed rem: the container keeps overflow: hidden, so a narrower fixed width
857
- silently clips the track and makes the clipped part unhittable */
858
- .volume-slider-container,
859
- &:hover .volume-slider-container {
860
- width: auto;
861
-
862
- pointer-events: auto;
863
- }
864
-
865
- /* a 44px press target around an 18px icon, floored here because the control bar sets the
866
- padding at a higher specificity */
867
- .sound {
868
- /* border-box explicitly, since a consumer reset cannot be assumed */
869
- box-sizing: border-box;
870
- justify-content: center;
871
-
872
- min-width: 44px;
873
- min-height: 44px;
874
- }
875
- }
876
-
877
- `,fv=({ref:e})=>{let t=Q(),n=Q(e=>e.volume),r=Q(e=>e.muted),i=b(()=>k_(n),[n]);return y(`div`,{css:dv,children:[F(I_,{id:`sound`,text:F(`button`,{className:`sound`,type:`button`,onClick:()=>t.toggleMuted(),ref:e,"aria-label":`Mute`,"aria-pressed":r||n===0,children:F(r||n===0?jg:n<=.5?Cg:Dg,{size:18,color:`#fff`})}),toolTipText:F(`span`,{children:r?`Unmute (m)`:`Mute (m)`})}),F(`div`,{className:`volume-slider-container`,children:F(`div`,{className:`volume-slider-background`,children:F(uv,{value:r?0:i,onChange:e=>{t.setVolume(O_(e))}})})})]})},pv=.05,mv=5,hv=D`
878
- display: flex;
879
- flex-direction: column;
880
- gap: calc(0.4 * var(--mp-unit));
881
-
882
- .hint {
883
- opacity: 0.72;
884
- font-size: 0.9em;
885
- }
886
- `,gv=D`
887
- position: absolute;
888
- bottom: 0;
889
- width: 100%;
890
-
891
- 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%);
892
- transition: opacity 0.1s cubic-bezier(.4,0,1,1);
893
-
894
- .actions {
895
- display: flex;
896
- justify-content: space-between;
897
-
898
- /* repeated per breakpoint: nested at-rules are hoisted after the rule, so a shorthand inside a
899
- media query would override a longhand above it and silently drop the safe-area inset */
900
- 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));
901
- @media (min-width: 768px) {
902
- 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));
903
- }
904
- @media (min-width: 2560px) {
905
- 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));
906
- }
907
-
908
- .left, .right {
909
- display: flex;
910
- align-items: center;
911
-
912
- button {
913
- display: flex;
914
- align-items: center;
915
-
916
- outline: none;
917
- border: none;
918
- background: none;
919
-
920
- svg {
921
- width: 18px;
922
- height: 18px;
923
- @media (min-width: 768px) {
924
- width: 24px;
925
- height: 24px;
926
- }
927
- @media (min-width: 2560px) {
928
- width: 28px;
929
- height: 28px;
930
- }
931
- }
932
-
933
- svg {
934
- stroke: #fff;
935
- }
936
-
937
- /* Reads as unavailable rather than absent, so the bar does not reflow when tracks land. */
938
- &:disabled {
939
- cursor: default;
940
- opacity: .4;
941
- }
942
- }
943
-
944
- .play, .sound, .time, .errors, .subtitles, .settings, .picture-in-picture, .full-screen {
945
- display: flex;
946
- align-items: center;
947
-
948
- height: 100%;
949
-
950
- border-radius: 4px;
951
- user-select: none;
952
-
953
- padding: 8px;
954
- @media (min-width: 768px) {
955
- padding: 8px 12px;
956
- }
957
- @media (min-width: 2560px) {
958
- padding: 8px 12px;
959
- }
960
- }
961
-
962
- .play, .sound, .errors, .subtitles, .settings, .picture-in-picture, .full-screen {
963
- border-radius: 4px;
964
-
965
- padding: 8px;
966
- @media (min-width: 768px) {
967
- padding: 8px 12px;
968
- }
969
- @media (min-width: 2560px) {
970
- padding: 8px 12px;
971
- }
972
-
973
- cursor: pointer;
974
-
975
- :hover {
976
- background-color: ${cv.hover};
977
- }
978
-
979
- /* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
980
- window still has a mouse */
981
- @media (pointer: coarse) {
982
- /* border-box explicitly, since a consumer reset cannot be assumed */
983
- box-sizing: border-box;
984
- min-width: 44px;
985
- min-height: 44px;
986
- justify-content: center;
987
- }
988
- }
989
- }
990
-
991
- .left {
992
- .time {
993
- ${y_.bMedium.regular}
994
- text-shadow: 0 0 4px rgba(0, 0, 0, 1);
995
- }
996
- }
997
- .right {
998
- .picture-in-picture {
999
- img {
1000
- width: 22px;
1001
- height: 22px;
1002
- @media (min-width: 768px) {
1003
- width: 28px;
1004
- height: 28px;
1005
- }
1006
- @media (min-width: 2560px) {
1007
- width: 32px;
1008
- height: 32px;
1009
- }
1010
- }
1011
- }
1012
- }
1013
- }
1014
- `,_v=()=>{let e=Q(),t=Q(e=>e.paused),n=Q(e=>e.currentTime),r=Q(e=>e.duration),i=Q(e=>e.fullscreen),a=Q(e=>e.hideUI),o=Q(e=>e.togglePictureInPicture),s=Q(e=>e.pictureInPictureMode),c=Q(e=>e.burnedInSubtitles),l=Q(e=>e.subtitleTracks),u=Q(e=>e.requestSeek),[d,f]=h(null),g=s===`burn-in`,_=l.length>0,v=r>0&&n===r,b=p(({direction:t,stepSize:n})=>{let r=k_(e.volume),i=t===`up`?n:-n,a=Math.max(0,Math.min(1,r+i)),o=e.muted;e.setVolume(O_(a)),o&&!e.muted&&e.toggleMuted()},[e]);m(()=>{let t=t=>u?u(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`)b({direction:`up`,stepSize:pv});else if(n.key===`ArrowDown`)b({direction:`down`,stepSize:pv});else if(n.key===`ArrowRight`){if(!e.duration)return;t(Math.min(e.currentTime+mv,e.duration))}else n.key===`ArrowLeft`?t(Math.max(e.currentTime-mv,0)):i=!1;i&&n.preventDefault()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,b,u]);let x=p(e=>{e.preventDefault(),e.deltaY<0?b({direction:`up`,stepSize:pv}):b({direction:`down`,stepSize:pv})},[b]);return m(()=>{if(d)return d.addEventListener(`wheel`,x,{passive:!1}),()=>d.removeEventListener(`wheel`,x)},[d,x]),y(`div`,{css:gv,style:{...a?{opacity:`0`,pointerEvents:`none`}:{}},children:[F(B_,{}),y(`div`,{className:`actions`,children:[y(`div`,{className:`left`,children:[F(I_,{id:`play`,tooltipPlace:`top-start`,text:F(`button`,{className:`play`,type:`button`,onClick:()=>e.togglePaused(),"aria-label":v?`Replay`:t?`Play`:`Pause`,children:F(v?hg:t?dg:sg,{})}),toolTipText:F(`span`,{children:v?`Replay (k)`:t?`Play (k)`:`Pause (k)`})}),F(fv,{ref:f}),F(`div`,{className:`time`,children:j_(n,r)})]}),y(`div`,{className:`right`,children:[F(tv,{}),F(sv,{}),F(av,{}),o?F(I_,{id:`picture-in-picture`,tooltipPlace:`top-end`,text:F(`button`,{className:`picture-in-picture`,type:`button`,onClick:o,disabled:g&&!_,"aria-label":g?`Put the subtitles in the video`:`Picture in picture`,"aria-pressed":g?c:void 0,children:g?F(c?G_:K_,{}):F(`img`,{src:V_,alt:``})}),toolTipText:y(`span`,{css:hv,children:[F(`span`,{className:`lead`,children:g?_?c?`Subtitles are in the picture`:`Put the subtitles in the picture`:`This file has no subtitles`:`Picture in picture`}),g&&_?F(`span`,{className:`hint`,children:`Then hover the video and click your browser's own pop out button`}):null]})}):null,F(I_,{id:`full-screen`,tooltipPlace:`top-end`,text:F(`button`,{className:`full-screen`,type:`button`,onClick:()=>e.toggleFullscreen(),"aria-label":`Full screen`,"aria-pressed":i,children:F(i?rg:$h,{})}),toolTipText:F(`span`,{children:i?`Exit full screen (f)`:`Full screen (f)`})})]})]})]})},vv=9e3,yv=D`
1015
- position: absolute;
1016
- inset: 0;
1017
- z-index: 2;
1018
- pointer-events: none;
1019
-
1020
- .card {
1021
- position: absolute;
1022
- /* Where Firefox draws its own toggle: right aligned, a little past the middle of the height. */
1023
- top: 52%;
1024
- right: calc(7 * var(--mp-unit));
1025
- transform: translateY(-50%);
1026
-
1027
- display: flex;
1028
- align-items: center;
1029
- gap: calc(1.2 * var(--mp-unit));
1030
-
1031
- max-width: min(calc(42 * var(--mp-unit)), 60%);
1032
- padding: calc(1.4 * var(--mp-unit)) calc(1.8 * var(--mp-unit));
1033
- border-radius: calc(0.8 * var(--mp-unit));
1034
- background-color: rgba(20, 20, 22, 0.94);
1035
- box-shadow: 0 0 calc(2 * var(--mp-unit)) rgba(0, 0, 0, 0.6);
1036
-
1037
- opacity: 0;
1038
- transition: opacity 0.25s ease;
1039
- }
1040
-
1041
- &.show .card {
1042
- opacity: 1;
1043
- }
1044
-
1045
- .words {
1046
- display: flex;
1047
- flex-direction: column;
1048
- gap: calc(0.3 * var(--mp-unit));
1049
- }
1050
-
1051
- .title {
1052
- ${y_.bMedium.bold}
1053
- color: #fff;
1054
- }
1055
-
1056
- .body {
1057
- ${y_.bSmall.regular}
1058
- color: rgba(255, 255, 255, 0.75);
1059
- }
1060
-
1061
- /* Points at the edge the browser's control lives on, which is the whole message. */
1062
- .arrow {
1063
- flex: none;
1064
- font-size: calc(2.6 * var(--mp-unit));
1065
- line-height: 1;
1066
- color: #fff;
1067
- }
1068
- `,bv=()=>{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),vv);return()=>clearTimeout(n)},[t,e]),t!==`burn-in`||!e?null:F(`div`,{css:yv,className:n?`show`:``,role:`status`,children:y(`div`,{className:`card`,children:[y(`div`,{className:`words`,children:[F(`div`,{className:`title`,children:`Subtitles are in the picture`}),F(`div`,{className:`body`,children:`Now hover the video and click your browser's own pop out button`})]}),F(`div`,{className:`arrow`,"aria-hidden":`true`,children:`→`})]})})},xv=3e3,Sv=D`
1069
- position: absolute;
1070
- inset: 0;
1071
- z-index: 2;
1072
- /* Never eats a click: click-to-pause still reaches the video underneath, and an item that needs a
1073
- pointer (a tooltip anchor, a button) sets \`pointer-events: auto\` on itself. */
1074
- pointer-events: none;
1075
- /* visibility, not only opacity: an item that took pointer events back would otherwise stay
1076
- hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
1077
- not, and transitioning it holds the item on screen for the length of the fade. */
1078
- transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
1079
- `,Cv=D`
1080
- position: relative;
1081
- background-color: black;
1082
- display: flex;
1083
- justify-content: center;
1084
- align-items: center;
1085
- height: 100%;
1086
- width: 100%;
1087
-
1088
- & > div:not(:last-of-type) {
1089
- position: absolute;
1090
- z-index: 2;
1091
- }
1092
-
1093
- canvas {
1094
- height: 100%;
1095
- width: 100%;
1096
- pointer-events: none;
1097
- position: absolute;
1098
- z-index: 1;
1099
- }
1100
-
1101
- .video, video {
1102
- height: 100%;
1103
- width: 100%;
1104
- background-color: black;
1105
- object-fit: contain;
1106
- }
1107
-
1108
- &.hide {
1109
- cursor: none;
1110
- }
1111
- `,wv=(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?wv(e.props.children,`${r}/`):[{key:r,item:e}]}),Tv=({ref:e,onVideoRef:t,onCanvasRef:n,overlay:r,controls:i,children:a})=>{let s=Q(),c=Q(e=>e.hideUI),l=Q(e=>e.setHideUI),u=o(void 0),d=o(`mouse`),f=o({x:-1,y:-1}),p=o(null);m(()=>()=>clearTimeout(u.current),[]);let h=t=>{p.current=t,typeof e==`function`?e(t):e&&(e.current=t)},g=()=>{if(d.current!==`mouse`)return!1;let{x:e,y:t}=f.current;if(!p.current||e<0)return!1;let n=document.elementFromPoint(e,t);return!!n&&p.current.contains(n)&&!n.closest(`.video`)},_=()=>{if(g()){u.current=setTimeout(_,xv);return}l(!0)},v=()=>{l(!1),clearTimeout(u.current),u.current=setTimeout(_,xv)};return y(`div`,{css:Cv,ref:h,onPointerMove:e=>{d.current=e.pointerType,e.pointerType===`mouse`&&(f.current={x:e.clientX,y:e.clientY},v())},onPointerDown:e=>{d.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(u.current),l(!0))},className:c?`hide`:``,children:[F(T_,{onCanvasRef:n}),wv(r).map(({key:e,item:t})=>F(`div`,{css:Sv,style:{...c?{opacity:`0`,visibility:`hidden`,pointerEvents:`none`}:{}},children:t},e)),i===!1?null:F(_v,{}),F(bv,{}),y(`div`,{className:`video`,onClick:()=>{if(d.current===`mouse`){s.togglePaused();return}c?v():(clearTimeout(u.current),l(!0))},children:[t?F(`video`,{ref:t,playsInline:!0}):null,a]})]})},Ev=({options:e,children:t})=>{let n=`media`in e?e:null,r=n?null:e,{title:i}=e,{size:a,downloadedRanges:s,publicPath:c,libavWorkerUrl:l,read:u,thumbnailRead:d,thumbnailsEnabled:f}=r??{},p=hc(),g=gc(),[_,v]=h(null),[y,b]=h(null),x=n?.media??_;m(()=>(p?.(x),()=>p?.(null)),[x,p]);let{expose:S}=e,C=S===!0?{}:S||void 0,w=o(C);w.current=C;let T=C?C.id:void 0,E=C?C.origin:void 0,D=C?C.channel:void 0;m(()=>{if(!S||!x)return;let e,t=!1;return te(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(x,w.current??{}))}).catch(()=>{}),()=>{t=!0,e?.()}},[x,!!S,T,E,D]),m_(_,y,r);let O=__({publicPath:c,workerUrl:l,length:f===!1?void 0:a,read:d??u,downloadedRanges:s}),k=n?.thumbnails?.all??O,{toggle:A,mode:j,burnedIn:ee}=v_(_,y),M=Q(e=>e.setSourceState);m(()=>{M({title:i,size:a,downloadedRanges:s})},[M,i,a,s]);let N=n?.thumbnails?.at;m(()=>{M({thumbnails:k,thumbnailAt:N,togglePictureInPicture:A,pictureInPictureMode:j,burnedInSubtitles:ee})},[M,k,N,A,j,ee]);let P=n?.subtitles?.selection,I=n?.audioTracks?.selection;return m(()=>{P&&M({subtitleTracks:P.options.map(({id:e,label:t,disabled:n})=>({id:e,label:t,disabled:n})),selectedSubtitleTrack:P.selectedId??void 0,selectSubtitleTrack:e=>P.select(e==null?null:String(e)),subtitleOffLabel:P.offLabel})},[M,P]),m(()=>{I&&M({audioTracks:I.options.map(({id:e,label:t,disabled:n})=>({id:e,label:t,disabled:n})),selectedAudioTrack:I.selectedId??void 0,selectAudioTrack:e=>I.select(String(e))})},[M,I]),F(Tv,{ref:g,onVideoRef:n?void 0:v,onCanvasRef:b,overlay:e.overlay,controls:e.controls,children:t})},Dv=D`
1112
- /**
1113
- * The chrome's whole scale, in one place.
1114
- *
1115
- * Everything inside is sized against this rather than against \`rem\`, because \`rem\` is root
1116
- * relative and a library cannot own the host page's root font. The old contract was that the host
1117
- * set \`html { font-size: 62.5% }\`, which silently rendered every control 1.6x too large in any app
1118
- * that did not, and could not be met by an app whose own screens are sized against the default.
1119
- * Override it on the player element to rescale the whole chrome.
1120
- */
1121
- --mp-unit: 10px;
1122
-
1123
- /**
1124
- * The chrome's own typeface, for exactly the reason the unit above exists.
1125
- *
1126
- * \`font-family\` inherits, and this library declared it nowhere, so every label drew in whatever the
1127
- * embedding document happened to set, and in the UA's serif where it set nothing. Not hypothetical:
1128
- * stub mounts the player in a second document, \`embed.html\`, which sets no font and loads no face,
1129
- * and the entire settings menu came out in Times New Roman.
1130
- *
1131
- * Named faces only, no bundled webfont. The chrome is a handful of short labels, so a font request
1132
- * on the critical path of a document whose job is to paint video buys a round trip and a flash of
1133
- * unstyled text for nothing.
1134
- *
1135
- * Read through \`var()\` so a host with a brand face sets \`--mp-font-family\` on any ancestor and it
1136
- * inherits in. A bare \`font-family\` on the host can no longer reach the chrome: this declaration is
1137
- * on the player element itself and beats anything inherited.
1138
- */
1139
- font-family: var(
1140
- --mp-font-family,
1141
- system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif,
1142
- 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji'
1143
- );
1144
-
1145
- /**
1146
- * The chrome's default ink, same argument again.
1147
- *
1148
- * Most text here names its own colour, but the two time readouts do not: the elapsed/duration pair
1149
- * and the seekbar's hover time carry a font token and a black text-shadow and nothing else.
1150
- * Inherited from a host that declares none that resolves to \`canvastext\`, which is black text under
1151
- * a black halo on a dark gradient.
1152
- */
1153
- color: #fff;
1154
-
1155
- /**
1156
- * The settings menu scrolls, and a UA that has not been told the surface is dark paints that
1157
- * scrollbar in its light theme: a white track down the side of a #1c1c1c menu. Declared here rather
1158
- * than asked of the host, so it reaches the menu and nothing outside the player.
1159
- */
1160
- color-scheme: dark;
1161
-
1162
- /**
1163
- * The other half of owning the chrome's own scale.
1164
- *
1165
- * Every control here is authored against a border box, which this library's dev app sets globally
1166
- * and a host page has no reason to. Shipped without it, anything that is \`width: 100%\` AND carries
1167
- * padding overflows its own box: the top bar ran 32px past the player and clipped the right end of
1168
- * whatever the app had put there. Scoped to the player's subtree so it cannot reach the host's
1169
- * layout, and only \`box-sizing\`, because zeroing margins here would reach the app's own content.
1170
- */
1171
- &, & *, & *::before, & *::after {
1172
- box-sizing: border-box;
1173
- }
1174
-
1175
- display: flex;
1176
- justify-content: center;
1177
- background-color: #111;
1178
- height: 100%;
1179
- width: 100%;
1180
- overflow: hidden;
1181
- `,Ov=e=>F(`div`,{css:Dv,children:F(i_.Provider,{children:F(Ev,{options:e,children:e.children})})}),kv=({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`})),Av=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}))},jv=({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}))},Mv=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}))},Nv=`[data-testid="track-selection-button"]`,Pv=`[data-testid="audio-text-track-menu"]`,Fv=`.timeline-slider`,Iv=`[role="menu"]`,Lv=`[role="menuitemradio"]`,Rv=1e4,zv=2e4,Bv=5e3,Vv=100,Hv={menu:Pv,section:Iv,option:Lv},Uv=/^(off|none|disabled)$/i,Wv=e=>new Promise(t=>setTimeout(t,e)),Gv=()=>!1,Kv=e=>{if(e())throw Error(`Crunchyroll track operation cancelled`)},qv=e=>e===`audio`?0:1,Jv=e=>e.replace(/\s+/g,` `).trim(),Yv=(e,t)=>{let n=[...new Map(t.map(e=>({...e,label:Jv(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=>Uv.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}:{}}},Xv=async(e,t)=>{Kv(t);let n=e.locator(Pv);if(await n.exists({timeout:1e3})){Kv(t);return}Kv(t),await e.evaluate(Av,{button:Nv,timeout:Rv});let r=Date.now()+Rv;for(;Date.now()<r;){if(Kv(t),await n.exists({timeout:1e3}))return;await Wv(Vv)}throw Error(`Crunchyroll track menu did not open`)},Zv=async(e,t,n)=>{Kv(n);let r=await e.evaluate(kv,{...Hv,sectionIndex:qv(t)});Kv(n);let i=r.map((e,t)=>({...e,label:Jv(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}`}})},Qv=async(e,t)=>{let[n,r]=await Promise.all([Zv(e,`audio`,t),Zv(e,`subtitles`,t)]);return{audio:Yv(`audio`,n),subtitles:Yv(`subtitles`,r)}},$v=async(e,t=Gv)=>(await Xv(e,t),Qv(e,t)),ey=async(e,t,n,r)=>(await Zv(e,t,r)).find(e=>n===null?Uv.test(e.label):e.id===n)?.index??-1,ty=async(e,t,n,r)=>{let i=Date.now()+zv;for(;Date.now()<i;){Kv(r),await Xv(e,r);let i=(await Zv(e,t,r)).find(e=>e.selected);if(i&&(n===null?Uv.test(i.label):i.id===n))return;await Wv(Vv)}throw Error(`Crunchyroll did not apply the ${t} option`)},ny=(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))},ry=e=>({currentTime:e.currentTime,paused:e.paused,volume:e.volume,muted:e.muted,playbackRate:e.playbackRate}),iy=(e,t)=>e.evaluate(Mv,{timeline:Fv,time:t,timeout:zv}),ay=async(e,t,n)=>{let r=Date.now()+5e3;for(;Date.now()<r&&(Kv(n),!(e.currentSrc!==t||e.readyState<2));)await Wv(Vv);if(e.currentSrc===t&&e.readyState>=2)return!1;let i=Date.now()+zv;for(;Date.now()<i;){if(Kv(n),e.readyState>=2)return!0;await Wv(Vv)}throw Error(`Crunchyroll playback did not become ready after changing tracks`)},oy=async(e,t,n,r)=>{Kv(r),t.volume=n.volume,t.muted=n.muted,t.playbackRate=n.playbackRate;let i=ny(n.currentTime,t.duration);Math.abs(t.currentTime-i)>2&&await iy(e,i);let a=Date.now()+zv;for(;Date.now()<a&&(Math.abs(t.currentTime-i)>2||t.seeking||t.readyState<2);)Kv(r),await Wv(Vv);if(Math.abs(t.currentTime-i)>2||t.seeking||t.readyState<2)throw Error(`Crunchyroll playback position was not restored after changing tracks`);Kv(r),n.paused?t.pause():await t.play();let o=Date.now()+Bv;for(;Date.now()<o&&t.paused!==n.paused;)Kv(r),await Wv(Vv);if(t.paused!==n.paused)throw Error(`Crunchyroll playback state was not restored after changing tracks`)},sy=async(e,t,n,r,i=Gv)=>{await Xv(e,i);let a=await ey(e,n,r,i);if(a<0)throw Error(`Crunchyroll ${n} option is no longer available`);Kv(i);let o=t.currentSrc,s=ry(t);return await e.evaluate(jv,{...Hv,sectionIndex:qv(n),optionIndex:a}),await ty(e,n,r,i),await ay(t,o,i)&&await oy(e,t,s,i),$v(e,i)},cy=(e,t)=>{iy(e,t).catch(e=>console.warn(`[cr] timeline seek failed:`,e))},ly=(e,t)=>new Proxy(e,{set(e,n,r,i){return n===`currentTime`&&typeof r==`number`&&Number.isFinite(r)&&cy(t,r),Reflect.set(e,n,r,i)}}),uy=({remote:e,frame:t,subtitles:n,audioTracks:r,thumbnails:i,children:a})=>{let o=b(()=>e&&t?ly(e,t):null,[e,t]);return F(Ov,{expose:!0,media:o,subtitles:n,audioTracks:r,thumbnails:i,children:a})},dy=class extends Error{name=`BifParseError`},fy=[137,66,73,70,13,10,26,10],py=64,my=8,hy=4294967295,gy=36e3,_y=e=>{if(e.byteLength<py)throw new dy(`truncated header: ${e.byteLength} bytes`);let t=new DataView(e);if(fy.some((e,n)=>t.getUint8(n)!==e))throw new dy(`bad magic`);let n=t.getUint32(12,!0),r=t.getUint32(16,!0)||1e3;if(n>gy)throw new dy(`implausible frame count ${n}`);let i=py+(n+1)*my;if(i>e.byteLength)throw new dy(`truncated index: ${n} frames need ${i} bytes, have ${e.byteLength}`);let a=e=>t.getUint32(py+e*my,!0),o=e=>t.getUint32(py+e*my+4,!0);if(a(n)!==hy)throw new dy(`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 dy(`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 dy(`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},vy=(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]},yy=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)}}},by={waitMs:1e4,fetchMs:15e3,maxBytes:31457280},xy=e=>{let t=new Map,n=!1;return{at:r=>{if(n)return;let i=vy(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()}}},Sy=async e=>{let t=await e.evaluate(yy,by);if(`none`in t)throw Error(`no BIF: ${t.none}${t.detail?` (${t.detail})`:``}`);let n=_y(t.bytes);if(!n.length)throw Error(`no BIF: the file has no images`);return xy(n)};l();var Cy=[`www.crunchyroll.com`,`crunchyroll.com`,`sso.crunchyroll.com`,`static.crunchyroll.com`],wy=`
1182
- html, body {
1183
- margin: 0 !important;
1184
- padding: 0 !important;
1185
- width: 100% !important;
1186
- height: 100% !important;
1187
- background: #000 !important;
1188
- }
1189
- *:not(:has(.video-player-wrapper)):not(.video-player-wrapper):not(.video-player-wrapper *) {
1190
- display: none !important;
1191
- }
1192
- div[data-testid="player-controls-root"] {
1193
- display: none !important;
1194
- }
1195
- .video-player-wrapper,
1196
- .video-player,
1197
- .player-container,
1198
- .video-player-wrapper > *,
1199
- .video-player > *,
1200
- .player-container > * {
1201
- position: absolute !important;
1202
- inset: 0 !important;
1203
- width: 100% !important;
1204
- height: 100% !important;
1205
- z-index: 9999999;
1206
- }
1207
- .video-player-wrapper video,
1208
- .video-player video,
1209
- .player-container video {
1210
- width: 100% !important;
1211
- height: 100% !important;
1212
- object-fit: contain !important;
1213
- }
1214
- .video-player-wrapper *:not(:has(video)):not(video):not(:has(.timeline-slider)):not(.timeline-slider) {
1215
- display: none !important;
1216
- }
1217
- .timeline-container,
1218
- .timeline-container *,
1219
- .timeline-slider {
1220
- opacity: 0 !important;
1221
- pointer-events: none !important;
1222
- }
1223
- `,Ty=`https://sso.crunchyroll.com/authorize?${new URLSearchParams({client_id:`noaihdevm_6iyg0a8l0q`,redirect_uri:`https://www.crunchyroll.com/callback`,response_type:`cookie`,state:`/`})}`,Ey=async e=>{let[t,n]=await Promise.all([e.locator(`.cx-app`).exists(),e.locator(`#recaptcha-container`).exists()]);return t||n},Dy=3e4,Oy=async()=>ne()?`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)),ne()?`extension`:`cloud`),ky=async(e,t)=>{let n=Date.now()+Dy;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`)},Ay=3e4,jy=async(e,t)=>{let n=Date.now()+Ay;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},My=D`
1224
- position: relative;
1225
- width: 100%;
1226
- height: 100%;
1227
- background: #000;
1228
- /* The double-tap-to-fullscreen gesture otherwise word-selects the
1229
- skin's labels/time readouts, flashing them blue. Player chrome isn't
1230
- meant to be selected, so suppress it across the whole player. */
1231
- user-select: none;
1232
- -webkit-user-select: none;
1233
-
1234
- .cr-frame {
1235
- position: absolute;
1236
- inset: 0;
1237
- width: 100%;
1238
- height: 100%;
1239
- border: none;
1240
- background: #000;
1241
- /* CR's own chrome is hidden, so the iframe must not swallow clicks -
1242
- taps belong to the videojs gesture layer stacked above it. */
1243
- pointer-events: none;
1244
- }
1245
-
1246
- .overlay {
1247
- position: absolute;
1248
- inset: 0;
1249
- display: flex;
1250
- flex-direction: column;
1251
- align-items: center;
1252
- justify-content: center;
1253
- gap: 1.6rem;
1254
- background: #000;
1255
- font-size: 1.4rem;
1256
- color: rgba(255, 255, 255, 0.8);
1257
- /* Above the skin's own layers (its controls/error dialog top out at
1258
- z-index 20) so the login/loading screen fully covers them. */
1259
- z-index: 30;
1260
- }
1261
-
1262
- .login-button {
1263
- padding: 0.8rem 2rem;
1264
- background: #f47521;
1265
- color: #fff;
1266
- border: none;
1267
- border-radius: 0.4rem;
1268
- font-size: 1.4rem;
1269
- font-weight: 600;
1270
- cursor: pointer;
1271
-
1272
- &:hover {
1273
- background: #e0651a;
1274
- }
1275
-
1276
- &:disabled {
1277
- opacity: 0.6;
1278
- cursor: default;
1279
- }
1280
- }
1281
-
1282
- .login-note {
1283
- max-width: 36rem;
1284
- font-size: 1.2rem;
1285
- text-align: center;
1286
- color: rgba(255, 255, 255, 0.6);
1287
- }
1288
- `,Ny=({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,M]=h(!1),N=o(!1),[P,I]=h(),[L,te]=h(),re=o(0),ie=o({generation:0,tail:Promise.resolve()}),oe=o(!0),R=p(()=>{let e=re.current+1;return re.current=e,ie.current={generation:e,tail:Promise.resolve()},I(void 0),e},[]),se=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(()=>()=>{oe.current=!1,re.current+=1},[]),m(()=>{let e=!1;return Oy().then(t=>{e||n(t)}),()=>{e=!0}},[]),m(()=>{if(!r||t===`detecting`)return;let e=!1;return ae({iframe:r,domains:Cy,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=ne()?`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),R(),(async()=>{if(t===`cloud`){if(await a.goto(e,{waitUntil:`load`}),n)return;let{isLoggedIn:t}=await ky(a,r);if(n)return;if(!t){l(!1),d(!0);return}if(await a.addStyleTag({content:wy}),n)return;let i=await jy(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:wy}),n))return;let{isLoggedIn:i}=await ky(a,r);if(n)return;if(!i){l(!1),d(!0);return}let o=await jy(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,R]),m(()=>{if(!a||!_)return;let e=R(),t=!1,n=()=>t||!oe.current||e!==re.current;return(async()=>{let t,r;for(let i=0;i<5&&!n();i+=1){try{if(r=await se(e,()=>$v(a,n)),t=void 0,n()||(I(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,_,R,se]),m(()=>{if(!a||!_)return;let e=!1,t;return Sy(a).then(n=>{if(e)return n.dispose();t=n,te(n)},t=>{e||console.warn(`[cr] seek thumbnails unavailable:`,t)}),()=>{e=!0,t?.dispose(),te(void 0)}},[a,_]);let ce=re.current,le=p((e,t)=>{if(!a||!_)return Promise.reject(Error(`Crunchyroll player is not ready`));let n=()=>!oe.current||ce!==re.current;return se(ce,async()=>{try{let r=await sy(a,_,e,t,n);if(n())throw Error(`Crunchyroll track operation cancelled`);I(r)}catch(e){if(!n())try{let e=await $v(a,n);n()||I(e)}catch{}throw e}})},[a,_,se,ce]),de=b(()=>P?.subtitles&&{selection:{...P.subtitles,select:e=>le(`subtitles`,e)}},[P?.subtitles,le]),fe=b(()=>P?.audio&&{selection:{...P.audio,select:e=>le(`audio`,e)}},[P?.audio,le]),pe=p(()=>{if(A.current!==null)return;let e=globalThis.open(Ty,`_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},[]),me=p(()=>{s(null),g(void 0),v(null),R(),d(!1),l(!0),w(e=>e+1)},[R]),he=p(()=>{if(N.current)return;N.current=!0;let e=ue({url:Ty,domains:Cy,isSignedIn:e=>e.locator(`#user-menu-authenticated`).exists(),onSignInPage:Ey});k(!1),M(!0),e.then(e=>{if(oe.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`){me();return}d(!1),l(!0),S(e=>e+1)}},e=>{oe.current&&(console.error(`Crunchyroll sign-in window failed`,e),g(e?.message||`The sign-in window failed`))}).finally(()=>{N.current=!1,oe.current&&M(!1)})},[me]);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 ge=p(()=>{j.current!==null&&(j.current.close(),j.current=null),A.current!==null&&(clearInterval(A.current),A.current=null),k(!1),E(!1),me()},[me]),_e=(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`?F(`button`,{className:`login-button`,onClick:pe,disabled:T,children:T?`Finish signing in the popup...`:`Open Crunchyroll Login Page`}):y(O,{children:[F(`button`,{className:`login-button`,onClick:he,disabled:ee,children:ee?`Finish signing in the window...`:`Sign in to Crunchyroll`}),F(`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.`,F(`button`,{className:`login-button`,onClick:t===`extension`?pe:he,children:`Open Crunchyroll Login Page`})]}),f&&y(O,{children:[f,F(`button`,{className:`login-button`,onClick:ge,children:`Retry`})]}),c&&!f&&!u&&`Loading Crunchyroll player...`]});return y(`div`,{css:My,children:[t!==`detecting`&&F(uy,{remote:_,frame:a,subtitles:de,audioTracks:fe,thumbnails:L,children:F(`iframe`,{ref:i,className:`cr-frame`,referrerPolicy:`no-referrer`,allow:`encrypted-media; autoplay; fullscreen;`},`${t}-${C}`)}),_e]})},Py=e=>e,Fy=Py(({className:e,children:t})=>F(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:18,height:18,fill:`none`,"aria-hidden":`true`,className:e,children:t})),Iy=Py(({className:e})=>F(Fy,{className:e,children:F(`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`})})),Ly=Py(({className:e})=>y(Fy,{className:e,children:[F(`rect`,{width:5,height:14,x:2,y:2,fill:`currentColor`,rx:1.75}),F(`rect`,{width:5,height:14,x:11,y:2,fill:`currentColor`,rx:1.75})]})),Ry=Py(({className:e})=>y(Fy,{className:e,children:[F(`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`}),F(`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`})]})),zy=Py(({className:e})=>F(Fy,{className:e,children:F(`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`})})),By=Py(({className:e})=>F(Fy,{className:e,children:F(`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`})})),Vy=Py(({className:e})=>F(Fy,{className:e,children:F(`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`})})),Hy=Py(({className:e})=>y(Fy,{className:e,children:[F(`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`}),F(`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`})]})),Uy=Py(({className:e})=>F(Fy,{className:e,children:F(`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`})})),Wy=Py(({className:e})=>F(Fy,{className:e,children:F(`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`})})),Gy=Py(({className:e})=>y(Fy,{className:e,children:[F(`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`}),F(`rect`,{width:10,height:7,x:8,y:10,fill:`currentColor`,rx:2}),F(`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`})]})),Ky=Py(({className:e})=>y(Fy,{className:e,children:[F(`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`}),F(`rect`,{width:10,height:7,x:8,y:10,fill:`currentColor`,rx:2}),F(`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`})]})),qy=Py(({className:e})=>F(Fy,{className:e,children:F(`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`})})),Jy=Py(({className:e})=>y(Fy,{className:e,children:[F(`rect`,{width:16,height:12,x:1,y:3,stroke:`currentColor`,strokeWidth:2,rx:3}),F(`rect`,{width:3,height:2,x:3,y:8,fill:`currentColor`,rx:1}),F(`rect`,{width:2,height:2,x:13,y:8,fill:`currentColor`,rx:1}),F(`rect`,{width:4,height:2,x:11,y:11,fill:`currentColor`,rx:1}),F(`rect`,{width:5,height:2,x:7,y:8,fill:`currentColor`,rx:1}),F(`rect`,{width:7,height:2,x:3,y:11,fill:`currentColor`,rx:1})]})),Yy=Py(({className:e})=>F(Fy,{className:e,children:y(`g`,{fill:`currentColor`,children:[F(`rect`,{width:2,height:5,x:8,y:.5,opacity:.5,rx:1,children:F(`animate`,{attributeName:`opacity`,begin:`0s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),F(`rect`,{width:2,height:5,x:12.243,y:2.257,opacity:.45,rx:1,transform:`rotate(45 13.243 4.757)`,children:F(`animate`,{attributeName:`opacity`,begin:`0.125s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),F(`rect`,{width:5,height:2,x:12.5,y:8,opacity:.4,rx:1,children:F(`animate`,{attributeName:`opacity`,begin:`0.25s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),F(`rect`,{width:5,height:2,x:10.743,y:12.243,opacity:.35,rx:1,transform:`rotate(45 13.243 13.243)`,children:F(`animate`,{attributeName:`opacity`,begin:`0.375s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),F(`rect`,{width:2,height:5,x:8,y:12.5,opacity:.3,rx:1,children:F(`animate`,{attributeName:`opacity`,begin:`0.5s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),F(`rect`,{width:2,height:5,x:3.757,y:10.743,opacity:.25,rx:1,transform:`rotate(45 4.757 13.243)`,children:F(`animate`,{attributeName:`opacity`,begin:`0.625s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),F(`rect`,{width:5,height:2,x:.5,y:8,opacity:.15,rx:1,children:F(`animate`,{attributeName:`opacity`,begin:`0.75s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),F(`rect`,{width:5,height:2,x:2.257,y:3.757,opacity:.1,rx:1,transform:`rotate(45 4.757 4.757)`,children:F(`animate`,{attributeName:`opacity`,begin:`0.875s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})})]})})),Xy=Py(({className:e})=>F(Fy,{className:e,children:F(`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`})})),Zy=Py(({className:e})=>F(Fy,{className:e,children:F(`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`})})),Qy=Py(({className:e})=>F(Fy,{className:e,children:F(`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 $y=10,$=e=>e,eb=$(hm.Root),tb=$(cm),nb=$(Cm.Root),rb=$(sm.Popup),ib=$(sm.Title),ab=$(sm.Close),ob=$(Cm.Description),sb=$(Ch.Provider),cb=$(Ch.Root),lb=$(Ch.Trigger),ub=$(Ch.Popup),db=$(Wm.Root),fb=$(Wm.Trigger),pb=$(Wm.Popup),mb=$(Pm),hb=$(Gm),gb=$(Mm),_b=$(Nm),vb=$(wm),yb=$(Fm),bb=$(ch.Value),xb=$(dh.Root),Sb=$(ih.Track),Cb=$(ih.Fill),wb=$(ih.Buffer),Tb=$(ih.Thumb),Eb=$(ih.Value),Db=$(Eh.Root),Ob=$(Am),kb=$(Em),Ab=$(jd),jb=({className:e,...t})=>F(`button`,{type:`button`,className:`media-button media-button--subtle media-button--icon${e?` ${e}`:``}`,...t}),Mb=({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(db,{open:n,onOpenChange:e=>r(e),children:[F(fb,{render:F(jb,{className:`media-button--menu${o?` media-button--error`:``}`,"aria-label":e.label}),children:t}),F(pb,{className:`media-surface media-popover media-popover--menu`,children:y(`div`,{className:`stub-menu`,role:`menu`,"aria-label":e.label,children:[F(`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:[F(`span`,{className:`stub-menu__check`,children:n?F(Qy,{className:`media-icon`}):null}),F(`span`,{className:`stub-menu__label`,children:t.label}),`description`in t&&t.description?F(`span`,{className:`stub-menu__description`,children:t.description}):null]},t.id??`__off__`)})]})})]})},Nb=()=>y(db,{openOnHover:!0,delay:200,closeDelay:100,side:`top`,children:[F(fb,{render:y(gb,{className:`media-button--mute`,render:F(jb,{}),children:[F(By,{className:`media-icon media-icon--volume-off`}),F(Vy,{className:`media-icon media-icon--volume-low`}),F(Hy,{className:`media-icon media-icon--volume-high`})]})}),F(pb,{className:`media-surface media-popover media-popover--volume`,children:y(Db,{className:`media-slider`,orientation:`vertical`,thumbAlignment:`edge`,children:[F(Sb,{className:`media-slider__track`,children:F(Cb,{className:`media-slider__fill`})}),F(Tb,{className:`media-slider__thumb media-slider__thumb--persistent`})]})})]}),Pb=({capabilities:e,children:t,className:n,...r})=>y(Ab,{className:`media-default-skin media-default-skin--video${n?` ${n}`:``}`,...r,children:[t,F(tb,{render:e=>F(`div`,{...e,className:`media-buffering-indicator`,children:F(`div`,{className:`media-surface`,children:F(Yy,{className:`media-icon`})})})}),F(nb,{children:F(rb,{className:`media-error`,children:y(`div`,{className:`media-error__dialog media-surface`,children:[y(`div`,{className:`media-error__content`,children:[F(ib,{className:`media-error__title`,children:`Something went wrong.`}),F(ob,{className:`media-error__description`})]}),F(`div`,{className:`media-error__actions`,children:F(ab,{className:`media-button media-button--primary`,children:`OK`})})]})})}),F(eb,{className:`media-surface media-controls`,children:y(sb,{children:[y(`div`,{className:`media-button-group`,children:[y(cb,{side:`top`,children:[F(lb,{render:y(mb,{className:`media-button--play`,render:F(jb,{}),children:[F(Ry,{className:`media-icon media-icon--restart`}),F(Iy,{className:`media-icon media-icon--play`}),F(Ly,{className:`media-icon media-icon--pause`})]})}),F(ub,{className:`media-surface media-tooltip`})]}),y(cb,{side:`top`,children:[F(lb,{render:F(hb,{seconds:-10,className:`media-button--seek`,render:F(jb,{}),children:y(`span`,{className:`media-icon__container`,children:[F(zy,{className:`media-icon media-icon--seek media-icon--flipped`}),F(`span`,{className:`media-icon__label`,children:$y})]})})}),y(ub,{className:`media-surface media-tooltip`,children:[`Seek backward `,$y,` seconds`]})]}),y(cb,{side:`top`,children:[F(lb,{render:F(hb,{seconds:$y,className:`media-button--seek`,render:F(jb,{}),children:y(`span`,{className:`media-icon__container`,children:[F(zy,{className:`media-icon media-icon--seek`}),F(`span`,{className:`media-icon__label`,children:$y})]})})}),y(ub,{className:`media-surface media-tooltip`,children:[`Seek forward `,$y,` seconds`]})]})]}),y(`div`,{className:`media-time-controls`,children:[F(bb,{type:`current`,className:`media-time`}),y(xb,{className:`media-slider`,children:[y(Sb,{className:`media-slider__track`,children:[F(Cb,{className:`media-slider__fill`}),F(wb,{className:`media-slider__buffer`})]}),F(Tb,{className:`media-slider__thumb`}),F(`div`,{className:`media-surface media-thumbnail media-slider__preview`,children:F(Eb,{type:`pointer`,className:`media-time media-thumbnail__time`})})]}),F(bb,{type:`duration`,className:`media-time`})]}),y(`div`,{className:`media-button-group`,children:[y(cb,{side:`top`,children:[F(lb,{render:F(yb,{className:`media-button--playback-rate`,render:F(jb,{})})}),F(ub,{className:`media-surface media-tooltip`,children:`Toggle playback rate`})]}),F(Nb,{}),e?.subtitles&&F(Mb,{selection:e.subtitles,icon:e.subtitles.selectedId?F(qy,{className:`media-icon`}):F(Jy,{className:`media-icon`})},`subtitles`),e?.audioTracks&&F(Mb,{selection:e.audioTracks,icon:F(Xy,{className:`media-icon`})},`audio`),e?.qualityLevels&&F(Mb,{selection:e.qualityLevels,icon:F(Zy,{className:`media-icon`})},`quality`),y(cb,{side:`top`,children:[F(lb,{render:y(_b,{className:`media-button--pip`,render:F(jb,{}),children:[F(Gy,{className:`media-icon media-icon--pip-enter`}),F(Ky,{className:`media-icon media-icon--pip-exit`})]})}),F(ub,{className:`media-surface media-tooltip`})]}),y(cb,{side:`top`,children:[F(lb,{render:y(vb,{className:`media-button--fullscreen`,render:F(jb,{}),children:[F(Uy,{className:`media-icon media-icon--fullscreen-enter`}),F(Wy,{className:`media-icon media-icon--fullscreen-exit`})]})}),F(ub,{className:`media-surface media-tooltip`})]})]})]})}),F(`div`,{className:`media-overlay`}),F(Ob,{keys:`Space`,action:`togglePaused`}),F(Ob,{keys:`k`,action:`togglePaused`}),F(Ob,{keys:`m`,action:`toggleMuted`}),F(Ob,{keys:`f`,action:`toggleFullscreen`}),F(Ob,{keys:`i`,action:`togglePictureInPicture`}),F(Ob,{keys:`ArrowRight`,action:`seekStep`,value:5}),F(Ob,{keys:`ArrowLeft`,action:`seekStep`,value:-5}),F(Ob,{keys:`l`,action:`seekStep`,value:10}),F(Ob,{keys:`j`,action:`seekStep`,value:-10}),F(Ob,{keys:`ArrowUp`,action:`volumeStep`,value:.05}),F(Ob,{keys:`ArrowDown`,action:`volumeStep`,value:-.05}),F(Ob,{keys:`0-9`,action:`seekToPercent`}),F(Ob,{keys:`Home`,action:`seekToPercent`,value:0}),F(Ob,{keys:`End`,action:`seekToPercent`,value:100}),F(Ob,{keys:`>`,action:`speedUp`}),F(Ob,{keys:`<`,action:`speedDown`}),F(kb,{type:`tap`,action:`togglePaused`,pointer:`mouse`,region:`center`}),F(kb,{type:`tap`,action:`toggleControls`,pointer:`touch`}),F(kb,{type:`doubletap`,action:`seekStep`,value:-10,region:`left`}),F(kb,{type:`doubletap`,action:`toggleFullscreen`,region:`center`}),F(kb,{type:`doubletap`,action:`seekStep`,value:10,region:`right`})]});l();var{Provider:Fb}=Nd({features:Ru}),Ib=e=>`media`in e?e:{media:e},Lb=({remote:e,frame:t,adapter:n})=>{let r=hc();return m(()=>{if(!r||!e||!t)return;let i=n?n(e,t):e;if(!i)return;let a=Ib(i);r(a.media);let o=oe(a.media);return()=>{o(),r(null),a.dispose?.()}},[e,t,n,r]),null},Rb=D`
1289
- position: absolute;
1290
- inset: 0;
1291
- border-radius: 0.8rem;
1292
- background: transparent !important;
1293
- &.media-default-skin--video {
1294
- background: transparent !important;
1295
- }
1296
-
1297
- .media-popover--menu {
1298
- padding: 0.4rem;
1299
- }
1300
-
1301
- /**
1302
- * The track menu is stub's own markup, so it carries a stub prefix rather than a media one.
1303
- *
1304
- * It was named \`media-menu\` when the skin had no menu of its own. videojs beta.26 added one, and
1305
- * upstream's nested \`.media-default-skin .media-menu .media-menu__item\` is specificity (0,3,0)
1306
- * against this file's (0,2,0), so it silently took over padding, gap, cursor and justification the
1307
- * moment the dependency moved. A prefix upstream will never mint is the only durable fix; matching
1308
- * their specificity would just move the race to insertion order.
1309
- */
1310
- .stub-menu {
1311
- display: flex;
1312
- flex-direction: column;
1313
- min-width: 18rem;
1314
- max-height: 32rem;
1315
- overflow-y: auto;
1316
- }
1317
- .stub-menu__heading {
1318
- padding: 0.6rem 1rem 0.4rem;
1319
- font-size: 1.1rem;
1320
- font-weight: 600;
1321
- letter-spacing: 0.04em;
1322
- text-transform: uppercase;
1323
- opacity: 0.6;
1324
- }
1325
- .stub-menu__item {
1326
- display: flex;
1327
- align-items: center;
1328
- gap: 0.6rem;
1329
- width: 100%;
1330
- padding: 0.6rem 1rem;
1331
- border: none;
1332
- border-radius: 0.4rem;
1333
- background: transparent;
1334
- color: inherit;
1335
- font-size: 1.3rem;
1336
- text-align: left;
1337
- cursor: pointer;
1338
-
1339
- &:hover:not(:disabled) {
1340
- background: rgba(255, 255, 255, 0.12);
1341
- }
1342
- &:disabled {
1343
- opacity: 0.5;
1344
- cursor: default;
1345
- }
1346
- }
1347
- .stub-menu__check {
1348
- display: inline-flex;
1349
- width: 1.6rem;
1350
- flex: none;
1351
- }
1352
- .stub-menu__label {
1353
- flex: 1;
1354
- }
1355
- .stub-menu__description {
1356
- opacity: 0.6;
1357
- font-size: 1.1rem;
1358
- }
1359
- .media-button--error {
1360
- color: #f66;
1361
- }
1362
- `,zb=({remote:e,frame:t,adapter:n,capabilities:r,children:i})=>y(Fb,{children:[F(Lb,{remote:e,frame:t,adapter:n}),F(Pb,{capabilities:r,css:Rb,children:i})]}),Bb=`[data-uia="timeline"]`,Vb=`[data-uia="video-canvas"]`,Hb=`[data-uia="player"]`,Ub=`Seeks the video to the point you pick on the timeline.`,Wb=`Reveals the player controls so the timeline can be used.`,Gb=140,Kb=2,qb=12e3,Jb=26,Yb=110,Xb={"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"]`},Zb=e=>new Promise(t=>setTimeout(t,e)),Qb=e=>e<0?0:e>1?1:e,$b=0,ex=()=>{let e=$b*1.1;return $b++,{x:.5+Math.cos(e)*.05,y:.5+Math.sin(e)*.05}},tx=(e,t)=>{let n=null,r,i,a=!1,o=async()=>{if(!a){a=!0;try{await Promise.all([t.locator(Vb).ensure(`hover`,{reason:Wb}),t.locator(Hb).ensure(`hover`,{reason:Wb}),t.locator(Bb).ensure(`click`,{reason:Ub})])}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)<Kb&&(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=Qb(n/r);o();let a=t.locator(Bb),s=e.paused===!0;if(s)try{await e.play()}catch{}let c=!1;for(let e=0;e<Jb;e++){if(e%2==0&&(await t.locator(Vb).hover({position:ex(),reason:Wb}).catch(()=>{}),await t.locator(Hb).hover({position:ex(),reason:Wb}).catch(()=>{})),await a.exists().catch(()=>!1)){c=!0;break}await Zb(Yb)}if(!c){let n=await Promise.all(Object.entries(Xb).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:Ub}).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))},Gb),i&&clearTimeout(i),i=setTimeout(()=>{n=null},qb),!0):Reflect.set(e,t,a,o)}}),dispose:()=>{e.removeEventListener(`timeupdate`,s),r&&clearTimeout(r),i&&clearTimeout(i)}}},nx=({remote:e,frame:t,capabilities:n,children:r})=>F(zb,{remote:e,frame:t,adapter:tx,capabilities:n,children:r});l();var rx=[`netflix.com`,`www.netflix.com`,`nflxvideo.net`,`nflxso.net`,`nflxext.com`,`nflximg.net`,`assets.nflxext.com`],ix=`https://www.netflix.com/login`,ax=`
1363
- html, body {
1364
- margin: 0 !important;
1365
- padding: 0 !important;
1366
- width: 100% !important;
1367
- height: 100% !important;
1368
- overflow: hidden !important;
1369
- background: #000 !important;
1370
- }
1371
- /* Truly-unwanted chrome - collapse it entirely. */
1372
- .watch-video--evidence-overlay-container,
1373
- .watch-video--skip-content,
1374
- .watch-video--nextEpisode-seamless-button,
1375
- .watch-video--back-container,
1376
- [data-uia="player-back-to-browse"],
1377
- [data-uia="control-nav-back"],
1378
- [data-uia="control-flag"] {
1379
- display: none !important;
1380
- pointer-events: none !important;
1381
- }
1382
- /* Keep the controls bar in LAYOUT (so the seek adapter can locate + click the
1383
- [data-uia="timeline"] scrubber) but invisible and inert to real taps. NEVER
1384
- display:none here, or the scrubber loses its box and the seek no-ops - mirrors
1385
- Crunchyroll's opacity:0 timeline trick. The skin draws the visible controls. */
1386
- [data-uia="controls-standard"],
1387
- .watch-video--bottom-controls-container,
1388
- .PlayerControlsNeo__layout,
1389
- .PlayerControlsNeo__core-controls,
1390
- .PlayerControlsNeo__button-control-row {
1391
- opacity: 0 !important;
1392
- pointer-events: none !important;
1393
- }
1394
- [data-uia="timeline"],
1395
- [data-uia="timeline"] * {
1396
- pointer-events: auto !important;
1397
- }
1398
- .watch-video,
1399
- [data-uia="video-canvas"] {
1400
- position: fixed !important;
1401
- inset: 0 !important;
1402
- width: 100% !important;
1403
- height: 100% !important;
1404
- z-index: 9999999 !important;
1405
- }
1406
- .watch-video video,
1407
- [data-uia="video-canvas"] video {
1408
- width: 100% !important;
1409
- height: 100% !important;
1410
- object-fit: contain !important;
1411
- }
1412
- `,ox=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`)},sx=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},cx=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},lx=D`
1413
- position: relative;
1414
- width: 100%;
1415
- height: 100%;
1416
- background: #000;
1417
- user-select: none;
1418
- -webkit-user-select: none;
1419
-
1420
- .nf-frame {
1421
- position: absolute;
1422
- inset: 0;
1423
- width: 100%;
1424
- height: 100%;
1425
- border: none;
1426
- background: #000;
1427
- /* Netflix's own chrome is hidden, so the iframe must not swallow taps -
1428
- they belong to the skin's gesture layer stacked above it. */
1429
- pointer-events: none;
1430
- }
1431
-
1432
- .overlay {
1433
- position: absolute;
1434
- inset: 0;
1435
- display: flex;
1436
- flex-direction: column;
1437
- align-items: center;
1438
- justify-content: center;
1439
- gap: 1.6rem;
1440
- background: #000;
1441
- font-size: 1.4rem;
1442
- color: rgba(255, 255, 255, 0.8);
1443
- z-index: 30;
1444
- }
1445
-
1446
- .login-button {
1447
- padding: 0.8rem 2rem;
1448
- background: #e50914;
1449
- color: #fff;
1450
- border: none;
1451
- border-radius: 0.4rem;
1452
- font-size: 1.4rem;
1453
- font-weight: 600;
1454
- cursor: pointer;
1455
-
1456
- &:hover {
1457
- background: #c11119;
1458
- }
1459
- }
1460
- `,ux={cr:Ny,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 ae({iframe:t,domains:rx});if(e)return;if(!ne()){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 ox(()=>r.addStyleTag({content:ax})),t)return;o(!1);let i=await sx(r);if(t)return;if(!i){c(!0);return}let a=await cx(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(ix,`_blank`,`width=500,height=700`);if(!e)return;let t=setInterval(()=>{e.closed&&(clearInterval(t),_(e=>e+1))},500)},[]);return y(`div`,{css:lx,children:[F(nx,{remote:d,frame:r,children:F(`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.`,F(`button`,{className:`login-button`,onClick:v,children:`Open Netflix Login Page`})]}),l&&!s&&l,a&&!l&&!s&&`Loading Netflix player...`]})]})}},dx=e=>ux[e],fx=new URLSearchParams(globalThis.location.search),px=fx.get(`mediaUri`),mx=fx.get(`episodeUri`),hx=fx.get(`sourceUri`),gx=fx.get(`url`),_x=hx?T(hx).origin:void 0,vx=_x?dx(_x):void 0;A(F(()=>!px||!mx||!hx||!gx||!vx?F(`div`,{children:`Unsupported or missing parameters`}):F(vx,{url:gx,mediaUri:px,episodeUri:mx,sourceUri:hx}),{}),document.getElementById(`app`));