@banou/stub 0.0.31 → 0.0.32

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=(e,t)=>{let n;return Promise.race([Promise.resolve().then(e).catch(()=>void 0),new Promise(e=>{n=setTimeout(()=>e(void 0),t)})]).finally(()=>clearTimeout(n))},le=async({url:e,domains:t,isSignedIn:n,onSignInPage:r,pollMs:i=1e3,readTimeoutMs:a=5e3})=>{let o=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([ce(()=>n(s),a),r&&ce(()=>r(s),a)]))]);if(e===`closed`)return`closed`;let[t,o]=e;if(o===!0?(l=!0,u=0):o===!1&&l&&(u+=1),t===!0||u>=se)return await s.close(),`authed`}},ue={};(function(e){var t=Object.prototype.hasOwnProperty,n=`~`;function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(e,t,r,a,o){if(typeof r!=`function`)throw TypeError(`The listener must be a function`);var s=new i(r,a||e,o),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function o(e,t){--e._eventsCount===0?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}s.prototype.eventNames=function(){var e=[],r,i;if(this._eventsCount===0)return e;for(i in r=this._events)t.call(r,i)&&e.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e},s.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,a=r.length,o=Array(a);i<a;i++)o[i]=r[i].fn;return o},s.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,i,a,o){var s=n?n+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,r),!0;case 4:return c.fn.call(c.context,t,r,i),!0;case 5:return c.fn.call(c.context,t,r,i,a),!0;case 6:return c.fn.call(c.context,t,r,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,r);break;case 4:c[d].fn.call(c[d].context,t,r,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},s.prototype.on=function(e,t,n){return a(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return a(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,r,i){var a=n?n+e:e;if(!this._events[a])return this;if(!t)return o(this,a),this;var s=this._events[a];if(s.fn)s.fn===t&&(!i||s.once)&&(!r||s.context===r)&&o(this,a);else{for(var c=0,l=[],u=s.length;c<u;c++)(s[c].fn!==t||i&&!s[c].once||r&&s[c].context!==r)&&l.push(s[c]);l.length?this._events[a]=l.length===1?l[0]:l:o(this,a)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s})({get exports(){return ue},set exports(e){ue=e}});var de=ue,fe=class extends Error{constructor(e){super(e),this.name=`TimeoutError`}},z=class extends Error{constructor(e){super(),this.name=`AbortError`,this.message=e}},pe=e=>globalThis.DOMException===void 0?new z(e):new DOMException(e),me=e=>{let t=e.reason===void 0?pe(`This operation was aborted.`):e.reason;return t instanceof Error?t:pe(t)};function he(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(me(e)),e.addEventListener(`abort`,()=>{o(me(e))})}i=r.customTimers.setTimeout.call(void 0,()=>{if(typeof n==`function`){try{a(n())}catch(e){o(e)}return}let r=typeof n==`string`?n:`Promise timed out after ${t} milliseconds`,i=n instanceof Error?n:new fe(r);typeof e.cancel==`function`&&e.cancel(),o(i)},t),(async()=>{try{a(await e)}catch(e){o(e)}finally{r.customTimers.clearTimeout.call(void 0,i)}})()});return a.clear=()=>{clearTimeout(i),i=void 0},a}function ge(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 _e=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)},ve,ye=class{constructor(){ve.set(this,[])}enqueue(e,t){t={priority:0,...t};let n={priority:t.priority,run:e};if(this.size&&_e(this,ve,`f`)[this.size-1].priority>=t.priority){_e(this,ve,`f`).push(n);return}let r=ge(_e(this,ve,`f`),n,(e,t)=>t.priority-e.priority);_e(this,ve,`f`).splice(r,0,n)}dequeue(){return _e(this,ve,`f`).shift()?.run}filter(e){return _e(this,ve,`f`).filter(t=>t.priority===e.priority).map(e=>e.run)}get size(){return _e(this,ve,`f`).length}};ve=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,U,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,We=new fe,Ge=class extends Error{},Ke=class extends de{constructor(e){if(super(),H.add(this),U.set(this,void 0),be.set(this,void 0),xe.set(this,0),Se.set(this,void 0),Ce.set(this,void 0),we.set(this,0),Te.set(this,void 0),Ee.set(this,void 0),De.set(this,void 0),Oe.set(this,void 0),ke.set(this,0),Ae.set(this,void 0),je.set(this,void 0),Me.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:ye,...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,U,e.carryoverConcurrencyCount,`f`),B(this,be,e.intervalCap===1/0||e.interval===0,`f`),B(this,Se,e.intervalCap,`f`),B(this,Ce,e.interval,`f`),B(this,De,new e.queueClass,`f`),B(this,Oe,e.queueClass,`f`),this.concurrency=e.concurrency,this.timeout=e.timeout,B(this,Me,e.throwOnTimeout===!0,`f`),B(this,je,e.autoStart===!1,`f`)}get concurrency(){return V(this,Ae,`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,Ae,e,`f`),V(this,H,`m`,He).call(this)}async add(e,t={}){return new Promise((n,r)=>{V(this,De,`f`).enqueue(async()=>{var i,a;B(this,ke,(i=V(this,ke,`f`),i++,i),`f`),B(this,xe,(a=V(this,xe,`f`),a++,a),`f`);try{if(t.signal?.aborted){r(new Ge(`The task was aborted.`));return}let i=await(this.timeout===void 0&&t.timeout===void 0?e({signal:t.signal}):he(Promise.resolve(e({signal:t.signal})),t.timeout===void 0?this.timeout:t.timeout,()=>{(t.throwOnTimeout===void 0?V(this,Me,`f`):t.throwOnTimeout)&&r(We)}));n(i),this.emit(`completed`,i)}catch(e){r(e),this.emit(`error`,e)}V(this,H,`m`,Fe).call(this)},t),V(this,H,`m`,ze).call(this),this.emit(`add`)})}async addAll(e,t){return Promise.all(e.map(async e=>this.add(e,t)))}start(){return V(this,je,`f`)?(B(this,je,!1,`f`),V(this,H,`m`,He).call(this),this):this}pause(){B(this,je,!0,`f`)}clear(){B(this,De,new(V(this,Oe,`f`)),`f`)}async onEmpty(){V(this,De,`f`).size!==0&&await V(this,H,`m`,Ue).call(this,`empty`)}async onSizeLessThan(e){V(this,De,`f`).size<e||await V(this,H,`m`,Ue).call(this,`next`,()=>V(this,De,`f`).size<e)}async onIdle(){(V(this,ke,`f`)!==0||V(this,De,`f`).size!==0)&&await V(this,H,`m`,Ue).call(this,`idle`)}get size(){return V(this,De,`f`).size}sizeBy(e){return V(this,De,`f`).filter(e).length}get pending(){return V(this,ke,`f`)}get isPaused(){return V(this,je,`f`)}};U=new WeakMap,be=new WeakMap,xe=new WeakMap,Se=new WeakMap,Ce=new WeakMap,we=new WeakMap,Te=new WeakMap,Ee=new WeakMap,De=new WeakMap,Oe=new WeakMap,ke=new WeakMap,Ae=new WeakMap,je=new WeakMap,Me=new WeakMap,H=new WeakSet,Ne=function(){return V(this,be,`f`)||V(this,xe,`f`)<V(this,Se,`f`)},Pe=function(){return V(this,ke,`f`)<V(this,Ae,`f`)},Fe=function(){var e;B(this,ke,(e=V(this,ke,`f`),e--,e),`f`),V(this,H,`m`,ze).call(this),this.emit(`next`)},Ie=function(){this.emit(`empty`),V(this,ke,`f`)===0&&this.emit(`idle`)},Le=function(){V(this,H,`m`,Ve).call(this),V(this,H,`m`,Be).call(this),B(this,Ee,void 0,`f`)},Re=function(){let e=Date.now();if(V(this,Te,`f`)===void 0){let t=V(this,we,`f`)-e;if(t<0)B(this,xe,V(this,U,`f`)?V(this,ke,`f`):0,`f`);else return V(this,Ee,`f`)===void 0&&B(this,Ee,setTimeout(()=>{V(this,H,`m`,Le).call(this)},t),`f`),!0}return!1},ze=function(){if(V(this,De,`f`).size===0)return V(this,Te,`f`)&&clearInterval(V(this,Te,`f`)),B(this,Te,void 0,`f`),V(this,H,`m`,Ie).call(this),!1;if(!V(this,je,`f`)){let e=!V(this,H,`a`,Re);if(V(this,H,`a`,Ne)&&V(this,H,`a`,Pe)){let t=V(this,De,`f`).dequeue();return t?(this.emit(`active`),t(),e&&V(this,H,`m`,Be).call(this),!0):!1}}return!1},Be=function(){V(this,be,`f`)||V(this,Te,`f`)!==void 0||(B(this,Te,setInterval(()=>{V(this,H,`m`,Ve).call(this)},V(this,Ce,`f`)),`f`),B(this,we,Date.now()+V(this,Ce,`f`),`f`))},Ve=function(){V(this,xe,`f`)===0&&V(this,ke,`f`)===0&&V(this,Te,`f`)&&(clearInterval(V(this,Te,`f`)),B(this,Te,void 0,`f`)),B(this,xe,V(this,U,`f`)?V(this,ke,`f`):0,`f`),V(this,H,`m`,He).call(this)},He=function(){for(;V(this,H,`m`,ze).call(this););},Ue=async function(e,t){return new Promise(n=>{let r=()=>{(!t||t())&&(this.off(e,r),n())};this.on(e,r)})};var qe=Object.defineProperty,W=(e,t)=>{let n={};for(var r in e)qe(n,r,{get:e[r],enumerable:!0});return t||qe(n,Symbol.toStringTag,{value:`Module`}),n},Je=`__OSRA_KEY__`,Ye=`__OSRA_DEFAULT_KEY__`,Xe=`__OSRA_BOX__`,Ze=()=>globalThis.browser??globalThis.chrome,Qe=()=>Ze()?.runtime,$e=(e,t)=>gt(e)&&e.__OSRA_KEY__===t,et=(e,t)=>{if(e){if(e.aborted){t();return}e.addEventListener(`abort`,t,{once:!0})}},tt=({listener:e,transport:t,remoteName:n,key:r=Ye,origin:i=`*`,unregisterSignal:a})=>{if(a?.aborted)return;let o=Pt(t)?t.receive:t;if(typeof o==`function`){let t=o((t,i)=>{a?.aborted||$e(t,r)&&(n&&t.name!==n||e(t,i))});typeof t==`function`&&et(a,t);return}if(bt(o)||xt(o)||Ct(o)||wt(o)){let t=(t,i)=>{let o=(t,a)=>{$e(t,r)&&(n&&t.name!==n||e(t,{port:i,sender:a}))};t.addListener(o),et(a,()=>t.removeListener(o))};if(bt(o))t(o.onMessage);else if(Ct(o)){let e=e=>t(e.onMessage,e);o.addListener(e),et(a,()=>o.removeListener(e))}else wt(o)?t(o):t(o.onMessage);return}let s=mt(o)?o.port:o,c=i!==`*`&&Tt(o),l=t=>{let a=t.data;if(typeof a==`string`)try{a=JSON.parse(a)}catch{return}$e(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(),et(a,()=>s.removeEventListener(`message`,l))},nt=(e,t,n=`*`,r=[])=>{let i=Pt(e)?e.emit:e;if(typeof i==`function`)i(t,r);else if(Tt(i))i.postMessage(t,n,r);else if(xt(i))i.postMessage(t);else if(bt(i))i.sendMessage(t)?.catch?.(e=>{if(!String(e?.message).includes(`Receiving end does not exist`))throw e});else if(lt(i)){let e=JSON.stringify(t);i.readyState===WebSocket.CONNECTING?i.addEventListener(`open`,()=>i.send(e),{once:!0}):i.send(e)}else mt(i)?i.port.postMessage(t,r):i.postMessage(t,r)},rt=globalThis.Float16Array,it={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float16Array:rt,Float32Array,Float64Array,BigInt64Array,BigUint64Array},at=Object.values(it),ot=e=>{let t=e.constructor.name;if(t in it)return t;for(let[t,n]of Object.entries(it))if(n&&e instanceof n)return t;throw Error(`Unknown typed array type`)},st=e=>{let t=it[e];if(!t)throw Error(`Unknown typed array type`);return t},ct=e=>at.some(t=>!!t&&e instanceof t),lt=e=>e instanceof WebSocket,ut=e=>!!globalThis.ServiceWorkerContainer&&e instanceof ServiceWorkerContainer,dt=e=>!!globalThis.ServiceWorker&&e instanceof ServiceWorker,ft=e=>!!globalThis.Worker&&e instanceof Worker,pt=e=>{let t=globalThis.DedicatedWorkerGlobalScope;return!!t&&e instanceof t},mt=e=>!!globalThis.SharedWorker&&e instanceof SharedWorker,ht=e=>e instanceof MessagePort,gt=e=>!!e&&typeof e==`object`&&`__OSRA_KEY__`in e&&!!e.__OSRA_KEY__,_t=(e,t)=>{for(let n of t)if(n&&e instanceof n)return!0;return!1},vt=e=>_t(e,[globalThis.SharedArrayBuffer]),yt=e=>_t(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]),bt=e=>{let t=Qe();return t?e===t:!1},xt=(e,t=!1)=>!e||typeof e!=`object`||Tt(e)||!(`name`in e)||!(`disconnect`in e)||!(`postMessage`in e)?!1:!t||`sender`in e&&`onMessage`in e&&`onDisconnect`in e,St=e=>!!e&&typeof e==`object`&&!Tt(e)&&`addListener`in e&&`hasListener`in e&&`removeListener`in e,Ct=e=>{let t=Qe();return t?e===t.onConnect||e===t.onConnectExternal:!1},wt=e=>St(e),Tt=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}}},Et=e=>lt(e)||xt(e)||bt(e),Dt=e=>lt(e)||xt(e)||Ct(e)||wt(e)||bt(e),Ot=e=>!!e&&typeof e==`object`&&!Tt(e)&&`isJson`in e&&e.isJson===!0||Et(e)||Dt(e),kt=e=>Tt(e)||Et(e)||dt(e)||ft(e)||pt(e)||mt(e)||ht(e)||Mt(e),At=e=>Tt(e)||Dt(e)||ut(e)||ft(e)||pt(e)||mt(e)||ht(e)||Nt(e),jt=e=>{if(!e||typeof e!=`object`||Tt(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},Mt=e=>!jt(e)||!(`emit`in e)?!1:kt(e.emit)||typeof e.emit==`function`,Nt=e=>!jt(e)||!(`receive`in e)?!1:At(e.receive)||typeof e.receive==`function`,Pt=e=>Mt(e)||Nt(e),G={[Xe]:`revivable`},Ft=e=>!!e&&typeof e==`object`&&`__OSRA_BOX__`in e&&e.__OSRA_BOX__===`revivable`,It=(e,t)=>Ot(t.transport)?{base64Buffer:new Uint8Array(e).toBase64()}:{arrayBuffer:e},Lt=e=>`arrayBuffer`in e?e.arrayBuffer:Uint8Array.fromBase64(e.base64Buffer).buffer,Rt=W({box:()=>Vt,isType:()=>Bt,revive:()=>Ht,type:()=>zt}),zt=`arrayBuffer`,Bt=e=>e instanceof ArrayBuffer,Vt=(e,t)=>({...G,type:zt,...It(e,t)}),Ht=(e,t)=>Lt(e),Ut=W({box:()=>Kt,isType:()=>Gt,revive:()=>qt,type:()=>Wt}),Wt=`date`,Gt=e=>e instanceof Date,Kt=(e,t)=>({...G,type:Wt,ISOString:e.toISOString()}),qt=(e,t)=>new Date(e.ISOString),Jt=W({box:()=>Zt,isType:()=>Xt,revive:()=>Qt,type:()=>Yt}),Yt=`headers`,Xt=e=>e instanceof Headers,Zt=(e,t)=>({...G,type:Yt,entries:[...e.entries()]}),Qt=(e,t)=>new Headers(e.entries),$t=W({box:()=>rn,isType:()=>nn,revive:()=>an,type:()=>en}),en=`error`,tn={Error,TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError},nn=e=>e instanceof Error,rn=(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:en,name:e.name,message:e.message,stack:e.stack||e.toString(),...n?{cause:oa(e.cause,t)}:{},...r?{errors:oa(e.errors,t)}:{},...i?{isDOMException:!0}:{}}},an=(e,t)=>{let n=e.cause===void 0?void 0:sa(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(sa(e.errors,t),e.message,r);else{let t=tn[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},on=W({box:()=>ln,isType:()=>cn,revive:()=>un,type:()=>sn}),sn=`typedArray`,cn=ct,ln=(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:sn,typedArrayType:ot(e),...It(n,t)}},un=(e,t)=>new(st(e.typedArrayType))(Lt(e)),dn=new WeakMap,fn=new WeakSet,pn=(e,t)=>{if(fn.has(e))return t(),()=>{};let n=dn.get(e);return n||dn.set(e,n=new Set),n.add(t),()=>n.delete(t)},mn=e=>{if(fn.has(e))return;fn.add(e);let t=dn.get(e);if(t){dn.delete(e);for(let e of t)try{e()}catch{}}},hn=W({box:()=>Cn,isType:()=>Sn,revive:()=>wn,transfer:()=>xn,type:()=>gn}),gn=`transfer`,_n=Symbol.for(`osra.transfer`),vn=e=>typeof e==`object`&&!!e,yn=e=>vn(e)&&_n in e&&e[_n]===!0,bn=e=>vn(e)?ArrayBuffer.isView(e)?!0:_t(e,[globalThis.ArrayBuffer,globalThis.MessagePort,globalThis.ReadableStream,globalThis.WritableStream,globalThis.TransformStream,globalThis.ImageBitmap,globalThis.OffscreenCanvas,globalThis.VideoFrame,globalThis.AudioData]):!1,xn=e=>bn(e)?{[_n]:!0,value:e}:e,Sn=e=>yn(e),Cn=(e,t)=>({...G,type:gn,inner:oa(e.value,t),degraded:Ot(t.transport)}),wn=(e,t)=>sa(e.inner,t),Tn=e=>_t(e,[globalThis.MessagePort,globalThis.ReadableStream,globalThis.WritableStream,globalThis.TransformStream,globalThis.OffscreenCanvas,globalThis.MediaSourceHandle,globalThis.MediaStreamTrack,globalThis.MIDIAccess,globalThis.RTCDataChannel,globalThis.WebTransportReceiveStream,globalThis.WebTransportSendStream]),En=e=>Ft(e)&&e.type===`transfer`,Dn=e=>{let t=[],n=new WeakSet,r=(e,i)=>{if(e&&typeof e==`object`&&!n.has(e)&&(n.add(e),!vt(e))){if(En(e)){r(e.inner,i||!e.degraded);return}if(Tn(e)){t.push(e);return}if(yt(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},On=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`))})}},kn=class{port1;port2;constructor(){let e=new On,t=new On;e._peer=t,t._peer=e,this.port1=e,this.port2=t}},An=new FinalizationRegistry(e=>{try{e()}catch{}}),jn=(e,t)=>{let n={};return An.register(e,t,n),()=>An.unregister(n)},Mn=W({box:()=>Yn,createRevivableChannel:()=>Qn,init:()=>Wn,isType:()=>Gn,revive:()=>Xn,type:()=>Nn}),Nn=`messagePort`,Pn=2048,Fn=128,In=1024,Ln=new WeakMap,Rn=e=>{let t=Ln.get(e);if(!t)throw Error(`osra message-port: connection state missing; did init() run?`);return t},zn=(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},Bn=(e,t)=>{let n=e.ports.get(t);if(n&&!n.handler&&e.pendingPorts--,e.ports.delete(t),e.tombstones.size>=Fn){let t=e.tombstones.values().next().value;t!==void 0&&e.tombstones.delete(t)}e.tombstones.add(t)},Vn=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)},Hn=(e,t)=>zn(Rn(e),t).outSeq++,Un=(e,t,n)=>{let r=Rn(e);if(r.tombstones.has(t)){setTimeout(()=>n({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:t}));return}let i=zn(r,t);i.handler||r.pendingPorts--,i.handler=n,Vn(i)},Wn=e=>{let t={ports:new Map,tombstones:new Set,pendingPorts:0};Ln.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>=In)return;r=zn(t,n.portId)}if(!(n.seq<r.nextSeq)){if(r.buffer.size>=Pn&&!(n.seq===r.nextSeq&&r.handler)){r.buffer.clear(),Bn(t,n.portId),r.handler?.({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:n.portId});return}r.buffer.set(n.seq,n),Vn(r)}}),pn(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})},Gn=e=>e instanceof MessagePort||e instanceof On,Kn=(e,t)=>{try{let n=Rn(e).ports.get(t);e.sendMessage({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:t,seq:n?n.outSeq++:0})}catch{}},qn=(e,t,n)=>{n?e.postMessage(t):e.postMessage(t,Dn(t))},Jn=(e,t,n)=>()=>{let r=e.deref();r&&Kn(r,n);let i=t.deref();i&&Bn(i,n)},Yn=(e,t,n)=>{let r=e instanceof On;if(!r&&!Ot(t.transport))return{...G,type:Nn,port:e,...n?.autoBox?{autoBox:!0}:{}};let i=Rn(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&&Bn(e,o),m?.();let t=s.deref();t?.removeEventListener(`message`,p),t instanceof On&&(t._onClose=void 0)},f=e=>{if(e.type===`message-port-close`){d(),a.dispatchEvent(new Event(`close`)),a.close();return}qn(a,sa(e.data,t),!1)};function p({data:e}){t.sendMessage({type:`message`,remoteUuid:t.remoteUuid,data:oa(e,t),portId:o,seq:Hn(t,o)})}let m=jn(a,Jn(c,l,o));return a.addEventListener(`message`,p),a.start(),a instanceof On&&(a._onClose=()=>{u||(Kn(t,o),d())}),Un(t,o,f),{...G,type:Nn,portId:o,synthetic:r}},Xn=(e,t)=>`port`in e?e.autoBox?Zn(e.port,t):e.port:$n(e.portId,t,e.synthetic),Zn=(e,t)=>{let n=new EventTarget,r=({data:e})=>{n.dispatchEvent(new MessageEvent(`message`,{data:sa(e,t)}))},i=()=>{n.dispatchEvent(new Event(`close`))};return e.addEventListener(`message`,r),e.addEventListener(`close`,i),n.postMessage=(n,r)=>{let i=oa(n,t),a=Dn(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},Qn=e=>{if(Ot(e.transport)){let{port1:t,port2:n}=new kn;return{localPort:t,boxedRemote:Yn(n,e)}}let{port1:t,port2:n}=new MessageChannel;return{localPort:Zn(t,e),boxedRemote:Yn(n,e,{autoBox:!0})}},$n=(e,t,n)=>{let r=Rn(t),{port1:i,port2:a}=n?new kn:new MessageChannel,o=new WeakRef(i),s=new WeakRef(a),c=!1,l=()=>{if(c)return;c=!0,Bn(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&&qn(r,sa(e.data,t),n)},d=({data:n})=>{t.sendMessage({type:`message`,remoteUuid:t.remoteUuid,data:oa(n,t),portId:e,seq:Hn(t,e)})},f=jn(i,()=>{Kn(t,e),l()});return i instanceof On&&(i._onClose=()=>{c||(Kn(t,e),l())}),a.addEventListener(`message`,d),a.start(),Un(t,e,u),i},er=W({box:()=>ar,isType:()=>ir,revive:()=>or,type:()=>tr}),tr=`promise`,nr=e=>e instanceof Promise,rr=new Set,ir=e=>e instanceof Promise,ar=(e,t)=>{if(!nr(e))throw TypeError(`Expected Promise`);let{localPort:n,boxedRemote:r}=Qn(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:tr,port:r}},or=(e,t)=>{let n=Xn(e.port,t);rr.add(n);let r=`portId`in e.port;return new Promise((e,i)=>{let a=()=>{n.close(),rr.delete(n),o()},o=r?pn(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()})},sr=W({box:()=>dr,isType:()=>ur,revive:()=>fr,type:()=>cr}),cr=`function`,lr=new Set,ur=e=>typeof e==`function`,dr=(e,t)=>{let{port1:n,port2:r}=new kn;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 oa(n,t)}catch(e){return oa({type:`throw`,error:e},t)}})();r.postMessage(a,Dn(a)),queueMicrotask(()=>{try{r.close()}catch{}})})()}),n.start(),{...G,type:cr,port:Yn(r,t)}},fr=(e,t)=>{let n=Xn(e.port,t);return((...e)=>new Promise((r,i)=>{let{port1:a,port2:o}=new kn;lr.add(a);let s=()=>{a.close(),lr.delete(a),c()},c=pn(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=oa([o,e],t);n.postMessage(l,Dn(l))}))},pr=W({MAX_CREDIT_WINDOW:()=>64,box:()=>yr,isType:()=>hr,revive:()=>Cr,type:()=>mr}),mr=`readableStream`,hr=e=>e instanceof ReadableStream,gr=2,_r=8,vr=4194304,yr=(e,t)=>{let{localPort:n,boxedRemote:r}=Qn(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:mr,credit:!0,port:r}},br=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,xr=e=>{let t=!1,n=0,r,i=[],a=!1,o=!1,s,c,l=()=>r===void 0?_r:Math.max(gr,Math.min(64,Math.floor(vr/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=br(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())}})},Sr=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())}})},Cr=(e,t)=>{let n=Xn(e.port,t);return n.start(),e.credit?xr(n):Sr(n)},wr=W({box:()=>Dr,isType:()=>Er,revive:()=>Or,type:()=>Tr}),Tr=`writableStream`,Er=e=>e instanceof WritableStream,Dr=(e,t)=>{let{localPort:n,boxedRemote:r}=Qn(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:Tr,port:r}},Or=(e,t)=>{let n=Xn(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})})},kr=W({box:()=>Nr,isType:()=>jr,revive:()=>Pr,type:()=>Ar}),Ar=`abortSignal`,jr=e=>e instanceof AbortSignal,Mr=new WeakMap,Nr=(e,t)=>{if(e.aborted)return{...G,type:Ar,aborted:!0,reason:oa(e.reason,t)};let{localPort:n,boxedRemote:r}=Qn(t),i=()=>{n.postMessage({type:`abort`,reason:e.reason}),n.close(),a()},a=pn(t,()=>{e.removeEventListener(`abort`,i),n.close()});return e.addEventListener(`abort`,i,{once:!0}),{...G,type:Ar,aborted:!1,reason:void 0,port:r}},Pr=(e,t)=>{let n=new AbortController;if(e.aborted||e.port===void 0)return n.abort(sa(e.reason,t)),n.signal;let r=Xn(e.port,t);return Mr.set(n.signal,r),r.start(),r.addEventListener(`message`,({data:e})=>{e.type===`abort`&&(n.abort(sa(e.reason,t)),Mr.delete(n.signal),r.close())}),n.signal},Fr=W({box:()=>Rr,isType:()=>Lr,revive:()=>zr,type:()=>Ir}),Ir=`response`,Lr=e=>e instanceof Response,Rr=(e,t)=>({...G,type:Ir,status:e.status,statusText:e.statusText,headers:Zt(e.headers,t),body:e.body?yr(e.body,t):null,url:e.url,redirected:e.redirected}),zr=(e,t)=>{if(e.status===0)return Response.error();let n=Qt(e.headers,t),r=e.body?Cr(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},Br=W({box:()=>Ur,isType:()=>Hr,revive:()=>Wr,type:()=>Vr}),Vr=`request`,Hr=e=>e instanceof Request,Ur=(e,t)=>({...G,type:Vr,method:e.method,url:e.url,headers:Zt(e.headers,t),body:e.body?yr(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:Nr(e.signal,t)}),Wr=(e,t)=>{let n=Qt(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:Pr(e.signal,t)};return e.mode!==`navigate`&&(r.mode=e.mode),e.body&&(r.body=Cr(e.body,t),r.duplex=`half`),new Request(e.url,r)},Gr=W({box:()=>ai,boxByReference:()=>oi,identity:()=>$r,isType:()=>ri,revive:()=>si,type:()=>Kr}),Kr=`identity`,qr=Symbol.for(`osra.identity`),Jr=e=>e!==null&&(typeof e==`object`||typeof e==`function`),Yr=e=>{if(e===null)return!1;let t=typeof e;return t===`object`||t===`function`||t===`symbol`&&Symbol.keyFor(e)===void 0},Xr=e=>Jr(e)&&qr in e&&e[qr]===!0,Zr=new WeakMap,Qr=e=>{if(Xr(e))return e;let t=Zr.get(e);if(t)return t;let n={[qr]:!0,value:e};return Zr.set(e,n),n},$r=e=>Jr(e)?Qr(e):e,ei=new WeakMap,ti=e=>{let t=ei.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 ei.set(e,o),ni(e,o),pn(e,()=>{o.receiveCache.clear(),o.idToSent.clear()}),o},ni=(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&&Yr(n)&&t.revivedToId.delete(n)}))},ri=e=>Xr(e),ii=(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}},ai=(e,t)=>{let n=ti(t),r=e.value,i=oa(r,t);if(!Yr(r))return{...G,type:Kr,id:globalThis.crypto.randomUUID(),inner:i};let{id:a,isExisting:o}=ii(r,n);return o?{...G,type:Kr,id:a}:{...G,type:Kr,id:a,inner:i}},oi=(e,t,n)=>{let{id:r,isExisting:i}=ii(e,ti(n));return i?{...G,type:Kr,id:r}:{...G,type:Kr,id:r,inner:t}},si=(e,t)=>{let n=ti(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=sa(e.inner,t);return n.receiveCache.set(e.id,a),Yr(a)&&n.revivedToId.set(a,e.id),a},ci=W({box:()=>ui,isType:()=>li,revive:()=>di,type:()=>`map`}),li=e=>e instanceof Map,ui=(e,t)=>({...G,type:`map`,entries:Array.from(e,([e,n])=>[oa(e,t),oa(n,t)])}),di=(e,t)=>new Map(e.entries.map(([e,n])=>[sa(e,t),sa(n,t)])),fi=W({box:()=>mi,isType:()=>pi,revive:()=>hi,type:()=>`set`}),pi=e=>e instanceof Set,mi=(e,t)=>({...G,type:`set`,values:Array.from(e,e=>oa(e,t))}),hi=(e,t)=>new Set(e.values.map(e=>sa(e,t))),gi=W({box:()=>yi,isType:()=>vi,revive:()=>bi,type:()=>_i}),_i=`bigint`,vi=e=>typeof e==`bigint`,yi=(e,t)=>({...G,type:_i,value:e.toString()}),bi=(e,t)=>BigInt(e.value),xi=W({box:()=>wi,isType:()=>Ci,revive:()=>Ti,type:()=>Si}),Si=`event`,Ci=e=>e instanceof Event,wi=(e,t)=>({...G,type:Si,eventType:e.type,bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed,...e instanceof CustomEvent?{detail:oa(e.detail,t)}:{}}),Ti=(e,t)=>{let n={bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed};return`detail`in e?new CustomEvent(e.eventType,{...n,detail:sa(e.detail,t)}):new Event(e.eventType,n)},Ei=W({box:()=>ki,isType:()=>Oi,revive:()=>Ni,type:()=>Di}),Di=`eventTarget`,Oi=e=>e instanceof EventTarget,ki=(e,t)=>{let n=[],r=e=>typeof e==`boolean`?e:!!e?.capture;return{...G,type:Di,addListener:dr((t,i,a)=>{n.push({eventType:t,listener:i,capture:r(a)}),e.addEventListener(t,i,a)},t),removeListener:dr((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:dr(()=>{for(let{eventType:t,listener:r,capture:i}of n.splice(0))e.removeEventListener(t,r,{capture:i})},t)}},Ai=new WeakMap,ji=e=>{if(typeof e==`function`)return e;let t=Ai.get(e);return t||Ai.set(e,t=t=>e.handleEvent(t)),t},Mi=(e,t,n,r)=>e.find(e=>e.eventType===t&&e.listener===n&&e.capture===r),Ni=(e,t)=>{let n=fr(e.addListener,t),r=fr(e.removeListener,t),i=fr(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=ji(t),a=typeof r==`boolean`?r:!!r?.capture;if(Mi(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,$r(c),r).catch(()=>{})}}),Object.defineProperty(a,"removeEventListener",{value:(e,t,n)=>{if(t===null)return;let i=ji(t),a=typeof n==`boolean`?n:!!n?.capture,c=Mi(o,e,i,a);c&&(s(c),r(e,$r(c.wire),{capture:a}).catch(()=>{}))}}),jn(a,()=>{i().catch(()=>{})}),a},Pi=W({box:()=>Li,isType:()=>Ii,revive:()=>Ri,type:()=>Fi}),Fi=`symbol`,Ii=e=>typeof e==`symbol`,Li=(e,t)=>{let n=Symbol.keyFor(e);return n===void 0?oi(e,{...G,type:Fi,description:e.description},t):{...G,type:Fi,registryKey:n}},Ri=(e,t)=>`registryKey`in e?Symbol.for(e.registryKey):Symbol(e.description),zi=W({box:()=>Hi,isType:()=>Vi,revive:()=>Ui,type:()=>Bi}),Bi=`asyncIterator`,Vi=e=>!e||typeof e!=`object`||typeof ReadableStream<`u`&&e instanceof ReadableStream?!1:typeof e[Symbol.asyncIterator]==`function`,Hi=(e,t)=>{let n=e[Symbol.asyncIterator]();return{...G,type:Bi,next:dr((e=>n.next(e)),t),return:dr((e=>n.return?.(e)??Promise.resolve({done:!0,value:e})),t),throw:dr((e=>n.throw?.(e)??Promise.reject(e)),t)}},Ui=(e,t)=>{let n=fr(e.next,t),r=fr(e.return,t),i=fr(e.throw,t),a={next:(...e)=>n(...e),return:e=>r(e),throw:e=>i(e),[Symbol.asyncIterator]:()=>a};return a},Wi=[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],Gi=[globalThis.CropTarget,globalThis.EncodedAudioChunk,globalThis.EncodedVideoChunk,globalThis.FencedFrameConfig,globalThis.GPUCompilationInfo,globalThis.GPUCompilationMessage,globalThis.GPUPipelineError,globalThis.RTCEncodedAudioFrame,globalThis.RTCEncodedVideoFrame,globalThis.WebTransportError],Ki={type:`clonable`,capableOnly:!0,isType:e=>_t(e,Wi)||_t(e,Gi),box:(e,t)=>e,revive:(e,t)=>e},qi=[globalThis.ImageBitmap,globalThis.OffscreenCanvas,globalThis.WritableStream,globalThis.TransformStream,globalThis.MediaStreamTrack,globalThis.RTCDataChannel],Ji=[globalThis.AudioData,globalThis.VideoFrame,globalThis.MediaSourceHandle,globalThis.MIDIAccess,globalThis.WebTransportReceiveStream,globalThis.WebTransportSendStream],Yi={type:`transferable`,capableOnly:!0,isType:e=>_t(e,qi)||_t(e,Ji),box:(e,t)=>e,revive:(e,t)=>e},Xi={type:`blob`,capableOnly:!0,isType:e=>typeof Blob<`u`&&e instanceof Blob,box:(e,t)=>{if(Ot(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},Zi=e=>{if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},Qi=[hn,Gr,Rt,Ut,Jt,$t,on,er,sr,Mn,pr,wr,kr,Fr,Br,ci,fi,gi,Pi,xi,zi,{type:`nonFiniteNumber`,isType:e=>typeof e==`number`&&!Number.isFinite(e),box:(e,t)=>Ot(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)=>Ot(t.transport)?{...G,type:`undefined`}:e,revive:(e,t)=>void 0},Ki,Yi,Xi,Ei,{type:`unclonable`,isType:e=>{if(typeof e!=`object`||!e||Array.isArray(e)||Zi(e))return!1;try{return structuredClone(e),!1}catch{return!0}},box:(e,t)=>({...G,type:`unclonable`}),revive:(e,t)=>({})}],$i=(e,t)=>t.find(t=>t.isType(e)),ea=(e,t)=>t.find(t=>t.type===e.type),ta=e=>!!e&&typeof e==`object`&&Object.getPrototypeOf(e)===Object.prototype,na=(e,t)=>Array.isArray(e)?e.map(e=>t(e)):ta(e)?Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n)])):e,ra=new WeakSet,ia=new WeakSet,aa=e=>e!==null&&(typeof e==`object`||typeof e==`function`),oa=(e,t)=>{if(Ft(e))return e;let n=aa(e);if(n){if(ra.has(e))throw TypeError(`osra: cannot serialize a circular structure - break the cycle or send the container by reference`);ra.add(e)}try{let n=$i(e,t.revivableModules);return n?n.box(e,t):na(e,e=>oa(e,t))}finally{n&&ra.delete(e)}},sa=(e,t)=>{let n=aa(e);if(n){if(ia.has(e))throw TypeError(`osra: cannot revive a circular structure`);ia.add(e)}try{if(Ft(e)){let n=ea(e,t.revivableModules);if(n)return n.revive(e,t)}return na(e,e=>sa(e,t))}finally{n&&ia.delete(e)}},ca=W({init:()=>da,startBidirectionalConnection:()=>ua,type:()=>la}),la=`bidirectional`,ua=({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:oa(t,o)}),{revivableContext:o,remoteValue:s.then(e=>sa(e,o))}},da=e=>{if(!(kt(e.transport)&&At(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=ua({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),mn(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=ua({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()},fa=()=>new EventTarget,pa=e=>{let t=Pt(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&&Ot(n)||r!==void 0&&Ot(r),...n===void 0?{}:{emit:n},...r===void 0?{}:{receive:r}}},ma=e=>e?e(Qi):Qi,ha=32,ga=()=>{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>ha&&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())}}}}},_a=(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})},va=Symbol.for(`osra.context`),ya=e=>typeof e==`object`&&!!e&&va in e,ba=[ca],xa=(e,{transport:t,name:n,remoteName:r,key:i=Ye,origin:a=`*`,unregisterSignal:o,revivableModules:s,uuid:c,remoteUuid:l,connection:u=({value:e})=>e})=>{let d=u,f=pa(t);if(!(kt(f)&&At(f))){let e=ga();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(()=>{}),_a(t,e,d)}let p=ma(s),m=new Map,h=new Set,g=ga(),{promise:_,resolve:v,reject:y}=Promise.withResolvers();_.catch(()=>{});let b=c??globalThis.crypto.randomUUID(),x=(e,t=a)=>{let r={[Je]:i,name:n,uuid:b,...e};nt(f,r,t,Dn(r))},S=(e,t)=>{o?.aborted||x(e,t)},C=fa(),w={transport:f,valueFor:t=>ya(e)?e[va](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}),mn(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:fa,unregisterSignal:o};if(tt({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(),_a(_,g,d);o?.addEventListener(`abort`,()=>{for(let[e,t]of m)x({type:`close`,remoteUuid:e}),mn(t.connection.revivableContext);m.clear(),g.close(),y(o.reason)},{once:!0});for(let e of ba)e.init(w);return _a(_,g,d)},Sa=(e,t)=>xa(e,t),Ca=e=>new Promise((t,n)=>{if(e.aborted)return n();e.addEventListener(`abort`,()=>{n()})}),wa=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 Sa({},{transport:c}),u=await l({publicPath:e,length:i,bufferSize:a,audioStreamIndex:o}),d=new Ke({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?xn(n):n,rejected:!1}},()=>({resolved:new Uint8Array().buffer,rejected:!0})),Ca(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}),Ca(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()}}},Ta=async e=>{let{worker:t,remuxer:n,wasmRead:r,addTask:i,destroy:a}=await wa({...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)}},Ea=async e=>{let{worker:t,remuxer:n,wasmRead:r,addTask:i,destroy:a}=await wa({...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}},Da=typeof HTMLVideoElement<`u`?HTMLVideoElement.prototype:{},Oa=`getVideoPlaybackQuality`in Da||`webkitDecodedFrameCount`in Da||`mozPresentedFrames`in Da||`mozPaintedFrames`in Da;if(!(`requestVideoFrameCallback`in Da)&&Oa&&typeof requestAnimationFrame==`function`){Da._rvfcpolyfillmap={};let e=`getVideoPlaybackQuality`in Da?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});Da.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},Da.cancelVideoFrameCallback=function(e){cancelAnimationFrame(this._rvfcpolyfillmap[e]),delete this._rvfcpolyfillmap[e]}}var ka={bt709:`BT709`,bt470bg:`BT601`,smpte170m:`BT601`},Aa={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`}},ja=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=ka[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='${Aa[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 Ma(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 Na(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 Pa=`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 Fa(e){for(var t,n={},r=0;r<Pa.length;r++){var i=Pa[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=Na(m[0])),m.length===2&&(n.clip.scale=m[0]*1,n.clip.drawing=Na(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(Fa)},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 Ia(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(Fa)}function La(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=Ia(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?Na(t[r+1]):[]})}return{raw:e,combined:n.map(function(e){return e.text}).join(``),parsed:n}}function Ra(e){var t=e.split(`:`);return t[0]*3600+t[1]*60+t[2]*1}function za(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]=Ra(s);break;case`Effect`:i[o]=Ma(s);break;case`Text`:i[o]=La(s);break;default:i[o]=s}}return i}var Ba=[`Name`,`Fontname`,`Fontsize`,`PrimaryColour`,`SecondaryColour`,`OutlineColour`,`BackColour`,`Bold`,`Italic`,`Underline`,`StrikeOut`,`ScaleX`,`ScaleY`,`Spacing`,`Angle`,`BorderStyle`,`Outline`,`Shadow`,`Alignment`,`MarginL`,`MarginR`,`MarginV`,`Encoding`],Va=[`Layer`,`Start`,`End`,`Style`,`Name`,`MarginL`,`MarginR`,`MarginV`,`Effect`,`Text`];function Ha(e){var t=Ba.concat(Va);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 Ua(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 Wa(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=Ha(a)),/^Style\s*:/i.test(a)&&t.styles.style.push(Ua(a,t.styles.format))),r===3&&(/^Format\s*:/i.test(a)&&(t.events.format=Ha(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(za(d,t.events.format))}}}return t}var Ga={M:`m`,L:`l`,C:`b`};function Ka(e){return e.instructions.map(function(e){var t,n=e.type,r=e.points;return(t=[Ga[n]]).concat.apply(t,r.map(function(e){return[e.x,e.y]})).join(` `)}).join(` `)}var qa=function(e){return function(t){return function(n){return``+t+e+`&H`+n+`&`}}},Ja=qa(`c`),Ya=qa(`a`),Xa={c1:Ja(1),c2:Ja(2),c3:Ja(3),c4:Ja(4),a1:Ya(1),a2:Ya(2),a3:Ya(3),a4:Ya(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+`,`)+Ka(e.drawing))+`)`},t:function(e){return e.map(function(e){return`t(`+[e.t1,e.t2,e.accel,Za(e.tag)]+`)`}).join(`\\`)}};function Za(e){return Object.keys(e).map(function(t){return`\\`+(Xa[t]||(function(e){return``+t+e}))(e[t])}).join(``)}var Qa=e=>Array(e.buffered.length).fill(void 0).map((t,n)=>({index:n,start:e.buffered.start(n),end:e.buffered.end(n)})),$a=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})}),eo=(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),$a(e))),unbufferRange:(t,n)=>r(()=>t>=n?Promise.resolve():(e.remove(t,n),$a(e))),updateTimestampOffset:t=>r(async()=>{e.timestampOffset=t}),endOfStream:()=>r(async()=>{if(!(t.readyState!==`open`||e.updating))try{t.endOfStream()}catch{}})}},to=(e,t)=>e.createEvent(t),no=e=>e===void 0?void 0:new URL(e,document.baseURI).toString(),ro=e=>new Date(e).toISOString().slice(11,22),io=1,ao=e=>new Map(Wa(e).styles.style.map((e,t)=>[e.Name,t+io])),oo=(e,t)=>{let n=t.replace(/^\*+/,``),r=n.toLowerCase()==="default"?`Default`:n;return e.styles.get(r)??e.styles.get(`Default`)??0},so=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:ao(e.content)}:(console.warn(`subtitle stream ${e.streamIndex} has no Events format, ignoring the track`),null)},co=(e,t)=>{let[n,r]=t.content.split(`,`),i=Number(n),a=`Dialogue: ${r},${ro(t.start)},${ro(t.end)},${t.content.replace(`${i},${r},`,``)}`,o=Wa(`${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:oo(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}}},lo=e=>{let{video:t,canvas:n,workerUrl:r}=e,i=no(e.wasmUrl),a=no(e.legacyWasmUrl),o=no(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 ja({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=so(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=co(e,t);if(n.has(r.index))continue;n.set(r.index,r),f===t.streamIndex&&s&&to(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()??[])to(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}}},uo=class extends Error{mediaElement=!0;constructor(e,t){super(e,t),this.name=`MediaElementError`}},fo=e=>!!e&&typeof e==`object`&&e.mediaElement===!0,po=-20,mo=60,ho=30,go=-5,_o=20,vo=5,yo=15e3,bo=1,xo=3,So=12,Co=200,wo=250,To=25e5,Eo=e=>{let{worker:t}=e,n=setTimeout(()=>t.terminate(),2e3);e.destroy().catch(()=>{}).finally(()=>{clearTimeout(n),t.terminate()})},Do=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=To,audioStreamIndex:f,onReady:p,onError:m,onRecovered:h,onSeek:g,onSubtitleStreams:_,onAudioStreams:v}=e,y=await Ta({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(()=>Eo(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=lo({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`))},yo),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}=eo(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?go:po,i=e?_o:mo;for(let{start:e,end:t}of Qa(T))e<n+r&&await D(e,n+r),t>n+i&&await D(n+i,t)},R=()=>{let e=Qa(T);if(!e.length)return!0;let t=N(),n=e.find(e=>e.start<=t+bo&&t<e.end);return n&&n.end>=t+mo?!1:!n||n.end<t+ho},se=()=>{let e=t.currentTime;return Qa(T).find(t=>t.start<=e+bo&&e<t.end)},ce=()=>{let e=se();return!!e&&e.end>=ne-.1},le=()=>{let e=Qa(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<vo)return;throw L=null,n}},fe=async()=>{if(A||j||V!==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)}},z=e=>e>=ie&&!!se(),pe=e=>Qa(T).some(t=>t.start<=e+bo&&e<t.end),me=e=>{let t=Qa(T).find(t=>t.start<=e+bo&&e<t.end);return t?t.end-e:0},he=async e=>{if(!x&&!(me(e)>=xo)){P=!1,ee++,M=e;try{pe(e)||await ue(e);let t=I;for(let n=0;n<So&&!(x||t!==I||P||me(e)>=xo);n++){let t=me(e);if(await fe(),me(e)<=t)break}}finally{ee--,M===e&&(M=void 0)}}},ge=0,_e=null,ve,ye=e=>{let t=performance.now(),n=t-ge;if(n>=Co){ge=t,_e=null,g?.(e);return}_e=e,!ve&&(ve=setTimeout(()=>{ve=void 0;let e=_e;_e=null,!(e===null||x)&&(ge=performance.now(),g?.(e))},Co-n))};b.push(()=>{ve&&clearTimeout(ve)});let B=0,V;b.push(()=>{V&&clearTimeout(V)});let H=()=>{let n=t.currentTime,r=e.info.input.duration||t.duration;r>0&&ye(Math.min(Math.max(n/r,0),1));let i=performance.now(),a=i-B<wo;if(B=i,!z(n)&&!(j&&Math.abs(n-ie)<.001)){if(P=!1,V&&clearTimeout(V),!a){V=void 0,ue(n);return}V=setTimeout(()=>{if(V=void 0,x)return;let e=t.currentTime;z(e)||(P=!1,ue(e))},wo)}};t.addEventListener(`seeking`,H),b.push(()=>t.removeEventListener(`seeking`,H));let U=!1,be=()=>{if(U)return;U=!0;let e=t.error;ae(new uo(`the media element failed: ${e?.message??`unknown`}`,{cause:e}),!1,!0)};t.addEventListener(`error`,be),b.push(()=>t.removeEventListener(`error`,be));let xe=setInterval(()=>{U||t.error||(oe().catch(()=>{}),fe().catch(e=>ae(e,!1)),P&&!L&&ce()&&C.readyState===`open`&&k().catch(()=>{}))},100);return b.push(()=>clearInterval(xe)),{destroy:S,prepareSeek:he,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}},Oo=5,ko=500,Ao=320,jo=1e6,Mo=3,No=1e4,Po=async e=>{let{publicPath:t,workerUrl:n,length:r,read:i,onThumbnails:a,width:o=Ao}=e,s=await Ea({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??Oo,n/ko),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)+jo,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`)),No))]),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>=Mo})};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=[],Eo(s)}}}catch(e){throw Eo(s),e}},Fo=1280,Io=1920,Lo=250,Ro=100,zo=()=>typeof HTMLCanvasElement<`u`&&`captureStream`in HTMLCanvasElement.prototype,Bo=()=>typeof document<`u`&&typeof HTMLVideoElement<`u`&&typeof HTMLVideoElement.prototype.requestPictureInPicture==`function`&&!!document.pictureInPictureEnabled,Vo=()=>typeof HTMLVideoElement<`u`&&`mozCaptureStream`in HTMLVideoElement.prototype,Ho=()=>zo()?Bo()?`window`:Vo()?`burn-in`:null:null,Uo=e=>{let{video:t,canvas:n}=e,r=e.mode??Ho()??`window`,i=e.maxWidth??(r===`burn-in`?Io:Fo),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,Ro)})).catch(()=>{}).finally(()=>{e.pause(),setTimeout(()=>{l=!1},Ro)})},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()},Lo),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 Wo(e){return typeof e==`string`}function Go(e){return typeof e==`number`}function K(e){return typeof e==`function`}function Ko(e){return e===null}function q(e){return e===void 0}function qo(e){return typeof e==`object`&&!!e}function Jo(e,t){let n={...t};for(let t in e)q(e[t])||(n[t]=e[t]);return n}function Yo(e,t){let n={};for(let r of t)Object.hasOwn(e,r)&&(n[r]=e[r]);return n}var Xo=Object.prototype.hasOwnProperty;function Zo(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(!Xo.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var Qo=new Map,$o=new Set;function es(e){return e.trim().replaceAll(`_`,`-`).toLowerCase()}function ts(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 ns(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 rs(e){return ts(es(e))}function is(e){let t=rs(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=ns(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 as(e){let t={};for(let n=e.length-1;n>=0;n--){let r=e[n],i=Qo.get(r);i&&Object.assign(t,i)}return t}function os(e){return as(is(e))}function ss(e){return $o.add(e),()=>{$o.delete(e)}}function cs(e){return typeof e==`string`?e:e.text}function ls(e){return qo(e)&&`key`in e&&`text`in e}var us=/\{([^{}]+)\}/g;function ds(e,t){return t?e.replace(us,(e,n)=>Object.hasOwn(t,n)?String(t[n]):e):e}function fs(e,t,n){return typeof e==`string`?e:typeof t==`function`?t(e,n):ds(cs(e),t??n)}function ps(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,ds(o??(i?t.text:s)??String(a),c)}}r();var ms=N(null);N(void 0);function hs(){let t=e(ms),[n,r]=P(e=>e+1,0);m(()=>ss(()=>r()),[]);let i=b(()=>ps(os(`en`),`en`),[n]);return t?t.translator:i}function gs(){return e(ms)?.locale??`en`}function _s(e){let t=e.closest(`[dir]`)?.getAttribute(`dir`);return t?t.toLowerCase()===`rtl`:getComputedStyle(e).direction===`rtl`}function vs(e){let t=e.composedPath();return t.length>0?t[0]:e.target}function ys(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 bs(e=document){let t=e.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}function xs(){return typeof CSS<`u`&&CSS.supports(`anchor-name: --a`)}var Ss=[`button`,`input`,`select`,`textarea`,`a[href]`,`[role="button"]`,`[role="menu"]`,`[role="menuitem"]`,`[role="menuitemcheckbox"]`,`[role="menuitemradio"]`,`[role="slider"]`,`[data-interactive]`].join(`,`),Cs=[`textarea`,`select`,`input:not([type])`,...[`text`,`search`,`url`,`tel`,`email`,`password`,`number`].map(e=>`input[type="${e}"]`),`[contenteditable]:not([contenteditable="false"])`].join(`,`);function ws(e){return e.matches(Cs)}function Ts(e){let t=vs(e);return t instanceof Element&&ws(t)}function Es(e){let t=vs(e);return t instanceof Element&&t.closest(Ss)!==null}var Ds=new Set([` `,`Enter`]),Os=`button,a[href],[role="slider"],[role="button"]`;function ks(e){if(!Ds.has(e.key))return!1;let t=vs(e);return t instanceof Element&&t.matches(Os)}function J(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function As(){return typeof navigator<`u`&&/mac/i.test(navigator.userAgent)}var js={sideOffset:0,boundaryOffset:0},Ms={top:`bottom`,bottom:`top`,left:`right`,right:`left`};function Ns(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 Ps(e,t,n,r,i=js){let a=r.side,o=Ms[a],s=a===`top`||a===`bottom`?t.height:t.width,c=Ns(e,n,a,i);return c>=s?a:Ns(e,n,o,i)>c?o:a}function Fs(e){try{e?.showPopover?.()}catch{}}function Is(e){try{e?.hidePopover?.()}catch{}}function Ls(e){return e instanceof Node&&e.nodeType===11&&`host`in e}function Rs(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 zs(e){return e.kind===`captions`||e.kind===`subtitles`}function Bs(e,t){if(!(e instanceof HTMLElement))return null;for(let n of e.querySelectorAll(`track`))if(n.track===t)return n;return null}function Vs(e,t){return e.textTracks?Array.from(e.textTracks).filter(t).sort(Hs):[]}function Hs(e,t){return e.kind>t.kind?1:e.kind<t.kind?-1:0}function Us(e){let t=[];for(let n=0;n<e.length;n++)t.push([e.start(n),e.end(n)]);return t}function Ws(e,t){let n=t;for(;n;){if(n===e||e.contains(n))return!0;let t=n.getRootNode();n=Ls(t)?t.host:n.parentNode}return!1}function Gs(){return`WebKitPlaybackTargetAvailabilityEvent`in globalThis}function Ks(e){return Gs()&&`webkitCurrentPlaybackTargetIsWireless`in e}r();function qs(e,t){if(K(e))return e(t);e!=null&&(e.current=t)}function Js(...e){let t=e.flat();return e=>{let n=t.map(t=>qs(t,e));if(n.some(K))return()=>{for(let e=0;e<n.length;e++){let r=n[e];K(r)?r():qs(t[e],null)}}}}function Ys(...e){return p(Js(...e),[...e])}r();function Xs(e,t,n,r=Zo){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 Zs(e){return e}function Qs(...e){}function $s(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 ec(e,t,n){return Xs(t=>e.subscribe(t),()=>e.current,t??Zs,n)}var tc=()=>Qs;function nc(e,t,n){return Xs(t?t=>e.subscribe(t):tc,t?()=>e.state:()=>e,t??Zs,n)}r();var rc=N(null),ic=()=>{},ac={state:{},subscribe:()=>ic};function oc({value:e,children:t}){return I(rc.Provider,{value:e,children:t})}function sc(){let t=e(rc);if(!t)throw Error(`usePlayerContext must be used within a Player Provider`);return t}function cc(e){let{store:t}=sc();return nc(t,e)}function lc(t){let n=e(rc),r=nc(n?.store??ac,n?t:void 0);return n?r:void 0}function uc(){let{media:e}=sc();return e}function dc(){let{container:e}=sc();return e}function fc(){return e(rc)?.container??null}function pc(){return e(rc)?.popupGroup}function mc(){return e(rc)?.setMedia}function hc(){return e(rc)?.setContainer}function gc(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 _c=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),gc([this.#e.signal,t.signal])}};function vc(...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 yc=class extends Error{code;cause;constructor(e,t){super(t?.message??e),this.name=`StoreError`,this.code=e,this.cause=t?.cause}};function bc(){throw new yc(`NO_TARGET`)}function xc(){throw new yc(`DESTROYED`)}var Sc={target:bc,signals:new _c,get:bc,set:bc};function Cc(e){let t=e.state(Sc),n=Object.keys(t),r=n[0];return Object.assign(r?e=>{if(r in e)return Yo(e,n)}:()=>void 0,{displayName:e.name})}function wc(){return e=>e}var Tc=!1;function Ec(){Tc||(Tc=!0,queueMicrotask(Oc))}var Dc=new Set;function Oc(){Tc=!1;for(let e of Dc)e.flush();Dc.clear()}var kc=Object.prototype.hasOwnProperty,Ac=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(!kc.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 Qs;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,Dc.add(this),Ec()}};function jc(e){return new Ac(e)}var Mc=Symbol.for(`@videojs/store`);function Nc(){return(e,t={})=>{let n=null,r=!1,i=new AbortController,a=new _c,o;function s(){r&&xc(),n||bc()}let c=e.state({target:()=>(s(),n),signals:a,get:()=>o.current,set:e=>o.patch(e)});o=jc(c);let l={[Mc]:!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&&xc(),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(){Ko(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 Pc=wc();function Fc(e,t){if(arguments.length===1)return Pc(e);let{name:n,state:r,attach:i}=e,a=e=>Pc({...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 Ic=Object.freeze({length:0,start:()=>0,end:()=>0}),Lc=Object.assign(new EventTarget,{length:0,*[Symbol.iterator](){},getTrackById:()=>null}),Rc=new EventTarget;Object.freeze({});var zc=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 Bc(e){return e.readyState>=1}function Vc(e){if(!qo(e))return!1;let t=e;return!q(t.paused)&&!q(t.ended)&&K(t.pause)}function Hc(e){if(!qo(e))return!1;let t=e;return!q(t.currentTime)&&!q(t.duration)&&!q(t.seeking)}function Uc(e){if(!qo(e))return!1;let t=e;return!q(t.src)&&!q(t.currentSrc)&&!q(t.readyState)&&K(t.load)}function Wc(e){if(!qo(e))return!1;let t=e;return!q(t.volume)&&!q(t.muted)}function Gc(e){return qo(e)?!q(e.playbackRate):!1}function Kc(e){if(!qo(e))return!1;let t=e;return!q(t.buffered)&&t.buffered!==Ic&&!q(t.seekable)&&t.seekable!==Ic}function qc(e){return qo(e)?!q(e.error):!1}function Jc(e){if(!qo(e))return!1;let t=e;return!q(t.textTracks)&&t.textTracks!==Lc}function Yc(e){return qo(e)?!q(e.videoRenditions):!1}function Xc(e){return qo(e)?!q(e.audioTracks):!1}function Zc(e){if(!qo(e))return!1;let t=e;return!q(t.videoWidth)&&!q(t.videoHeight)}function Qc(e){if(!qo(e))return!1;let t=e;return qo(t.remote)&&t.remote!==Rc}function $c(e){return qo(e)?!q(e.streamType):!1}function el(e){if(!qo(e))return!1;let t=e;return!q(t.liveEdgeStart)&&!q(t.targetLiveWindow)}function tl(e){return qo(e)&&`querySelectorAll`in e&&K(e.querySelectorAll)}var nl={ON_DEMAND:`on-demand`,LIVE:`live`,UNKNOWN:`unknown`};function rl(e,t){return e.id||String(t)}function il(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 al=Fc({name:`audioTrack`,state:({target:e})=>({audioTrackList:[],selectAudioTrack(t){let{media:n}=e();if(!Xc(n))return;let r=[...n.audioTracks],i=r.find((e,n)=>rl(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=()=>Xc(r)?r.audioTracks:null,s=(e=o())=>{n({audioTrackList:e?[...e].map(il):[]})},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})}}),ol=Fc({name:`buffer`,state:()=>({buffered:[],seekable:[]}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Kc(r))return;let i=()=>n({buffered:Us(r.buffered),seekable:Us(r.seekable)});i(),J(r,`progress`,i,{signal:t}),J(r,`emptied`,i,{signal:t})}});function sl(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 cl=250,ll=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!Es(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>cl||Es(e))return;let n=e.pointerType,r=e.clientX,i=this.#e,a=this.#t,o={resolve:e=>pl(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}}},ul=new WeakMap;function dl(e){return ul.get(e)}function fl(e){let t=ul.get(e);return t||(t=new ll(e),ul.set(e,t)),t}function pl(e,t,n,r,i){let a=i.getBoundingClientRect(),o=ml(e,t,n),s=o.size>0?sl(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 ml(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 hl(e){let t=e;if(qo(t.remote)&&`state`in t.remote&&`prompt`in t.remote)return t.remote}function gl(e){return hl(e)?.state===`connected`}function _l(e){return hl(e)?.state===`connecting`}async function vl(e){let t=hl(e);if(!t)throw new DOMException(`Remote playback not supported`,`NotSupportedError`);return t.prompt()}var yl=2e3,bl=250,xl=500,Sl=Fc({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(!Vc(i)||Ko(a))return;let o=e=>e||i.paused||gl(i)||_l(i),s;function c(){clearTimeout(s),s=void 0}function l(){c(),s=setTimeout(d,yl)}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<xl;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<bl){if(dl(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}),Qc(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()}}),Cl=Fc({name:`error`,state:({set:e})=>({error:null,dismissError(){e({error:null})}}),attach({target:e,signal:t,set:n}){let{media:r}=e;qc(r)&&(J(r,`error`,()=>n({error:r.error}),{signal:t}),J(r,`emptied`,()=>n({error:null}),{signal:t}))}});function wl(){let e=document;return e.fullscreenEnabled||e.webkitFullscreenEnabled?!0:K(document.createElement(`video`).webkitSetPresentationMode)}function Tl(){let e=document;return e.fullscreenElement??e.webkitFullscreenElement??null}function El(e){if(!(e instanceof Element))return!1;try{return e.matches(`:fullscreen`)}catch{return!1}}function Dl(e,t){if(t.webkitPresentationMode===`fullscreen`)return!0;let n=Tl();return n&&(n===e||n===t)||El(e)||El(t)?!0:t.isFullscreen??!1}async function Ol(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 kl(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 Al(){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 jl(e){return e.webkitPresentationMode===`picture-in-picture`||document.pictureInPictureElement===e?!0:e.isPictureInPicture??!1}async function Ml(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 Nl(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 Pl=Fc({name:`fullscreen`,state:({target:e})=>({fullscreen:!1,fullscreenAvailability:`unavailable`,async requestFullscreen(){let{media:t,container:n}=e();return jl(t)&&await Nl(t),Ol(n,t)},async exitFullscreen(){let{media:t}=e();return kl(t)},async toggleFullscreen(){let{media:t,container:n}=e();return Dl(n,t)?kl(t):(jl(t)&&await Nl(t),Ol(n,t))}}),attach({target:e,signal:t,set:n}){let{media:r,container:i}=e;n({fullscreenAvailability:wl()?`available`:`unsupported`});let a=()=>n({fullscreen:Dl(i,r)});a(),J(document,`fullscreenchange`,a,{signal:t}),J(document,`webkitfullscreenchange`,a,{signal:t}),`webkitPresentationMode`in r&&J(r,`webkitpresentationmodechanged`,a,{signal:t})}}),Fl=Fc({name:`live`,state:()=>({liveEdgeStart:NaN,targetLiveWindow:NaN}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!el(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})}}),Il=Fc({name:`pip`,state:({target:e})=>({pip:!1,pipAvailability:`unavailable`,async requestPictureInPicture(){let{media:t,container:n}=e();return Dl(n,t)&&await kl(t),Ml(t)},async exitPictureInPicture(){let{media:t}=e();return Nl(t)},async togglePictureInPicture(){let{media:t,container:n}=e();return jl(t)?Nl(t):(Dl(n,t)&&await kl(t),Ml(t))}}),attach({target:e,signal:t,set:n}){let{media:r}=e;n({pipAvailability:Al()?`available`:`unsupported`});let i=()=>n({pip:jl(r)});i(),J(r,`enterpictureinpicture`,i,{signal:t}),J(r,`leavepictureinpicture`,i,{signal:t}),`webkitPresentationMode`in r&&J(r,`webkitpresentationmodechanged`,i,{signal:t})}}),Ll=Fc({name:`playback`,state:({target:e})=>({paused:!0,ended:!1,started:!1,waiting:!1,play(){return e().media.play()},pause(){let{media:t}=e();Vc(t)&&t.pause()},togglePaused(){let t=e().media;return Vc(t)?t.paused?(t.play(),!0):(t.pause(),!1):!1}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Vc(r)||!Hc(r)||!Uc(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})}}),Rl=[.2,.5,.7,1,1.2,1.5,1.7,2],zl=Fc({name:`playbackRate`,state:({target:e})=>({playbackRates:Rl,playbackRate:1,setPlaybackRate(t){let{media:n}=e();Gc(n)&&(n.playbackRate=t)}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Gc(r))return;let i=()=>n({playbackRate:r.playbackRate});i(),J(r,`ratechange`,i,{signal:t})}}),Bl=`auto`;function Vl(e,t){return e.id||String(t)}function Hl(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 Ul(e){return e.width&&e.height?Math.min(e.width,e.height):e.height??e.width}var Wl=Fc({name:`quality`,state:({target:e})=>({videoRenditionList:[],activeVideoRendition:null,selectVideoRendition(t){let{media:n}=e();if(!Yc(n))return;if(t===Bl){n.videoRenditions.selectedIndex=-1;return}let r=[...n.videoRenditions].findIndex((e,n)=>Vl(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=()=>Yc(r)?r.videoRenditions:null,s=e=>{if(!e)return null;let t=[...e],n=t.find(e=>e.active);if(n)return n;if(!Zc(r)||!r.videoWidth&&!r.videoHeight)return null;let i=Ul({width:r.videoWidth||void 0,height:r.videoHeight||void 0}),a=t.filter(e=>Ul(e)===i);return a.length===1?a[0]:null},c=(e=o())=>{let t=s(e);n({videoRenditionList:e?[...e].map(Hl):[],activeVideoRendition:t?Hl(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})}}),Gl=Fc({name:`remotePlayback`,state:({target:e})=>({remotePlaybackState:`disconnected`,remotePlaybackAvailability:`unsupported`,async toggleRemotePlayback(){let{media:t,container:n}=e();return gl(t)?vl(t):(Dl(n,t)&&await kl(t),await vl(t))}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Qc(r))return;if(Ks(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(()=>{})})}}),Kl=Fc({name:`source`,state:({target:e,signals:t})=>({source:null,canPlay:!1,loadSource(n){t.clear();let{media:r}=e();return Uc(r)?(r.src=n,r.load(),n):n}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Uc(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})}}),ql=Fc({name:`streamType`,state:()=>({streamType:nl.UNKNOWN}),attach({target:e,signal:t,set:n}){let{media:r}=e;if($c(r)){let e=()=>n({streamType:r.streamType});e(),J(r,`streamtypechange`,e,{signal:t});return}if(!Hc(r))return;let i=()=>{let{duration:e}=r;return e===1/0?nl.LIVE:Number.isFinite(e)&&e>0?nl.ON_DEMAND:nl.UNKNOWN},a=()=>n({streamType:i()});a(),J(r,`durationchange`,a,{signal:t}),J(r,`loadedmetadata`,a,{signal:t}),J(r,`emptied`,a,{signal:t}),Kc(r)&&J(r,`progress`,a,{signal:t})}});function Jl(e,t){return e.id||`track:${t}:${e.kind}:${e.language}:${e.label}`}var Yl=Fc({name:`textTrack`,state:({target:e})=>({chaptersCues:[],thumbnailCues:[],thumbnailTrackSrc:null,textTrackList:[],subtitlesShowing:!1,toggleSubtitles(t){let{media:n}=e();if(!Jc(n))return!1;let r=Vs(n,zs);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(!Jc(n))return;let r=Array.from(n.textTracks).map((e,t)=>({index:t,track:e})).filter(({track:e})=>zs(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})=>Jl(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(!Jc(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:Jl(i,n),kind:i.kind,label:i.label,language:i.language,mode:i.mode}),zs(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=Bs(r,t)?.src??null);let d=tl(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})}}),Xl={seek:Symbol.for(`@videojs/seek`)},Zl=Fc({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(Xl.seek);if(!Hc(i)||!Uc(i))return 0;if(!Bc(i)&&!await ys(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 ys(i,`seeked`,{signal:a}).catch(Qs),i.currentTime}}),attach({target:e,signal:t,set:n,get:r}){let{media:i}=e;if(!Hc(i))return;let a=()=>{let{duration:e}=i;if(e===1/0&&Kc(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})}}),Ql=.25,$l=Fc({name:`volume`,state:({target:e})=>({volume:1,muted:!1,volumeAvailability:`unavailable`,setVolume(t){let{media:n}=e();if(!Wc(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 Wc(t)?(t.muted||t.volume===0?(t.muted=!1,t.volume===0&&(t.volume=Ql)):t.muted=!0,t.muted):!1}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Wc(r))return;n({volumeAvailability:eu()});let i=()=>n({volume:r.volume,muted:r.muted});i(),J(r,`volumechange`,i,{signal:t})}});function eu(){let e=document.createElement(`video`);try{return e.volume=.5,e.volume===.5?`available`:`unsupported`}catch{return`unsupported`}}Cc(al);var tu=Cc(ol),nu=Cc(Sl),ru=Cc(Cl),iu=Cc(Pl);Cc(Fl);var au=Cc(Il),ou=Cc(Ll),su=Cc(zl);Cc(Wl),Cc(Gl),Cc(Kl),Cc(ql);var cu=Cc(Yl),lu=Cc(Zl),uu=Cc($l),du={seekStep({store:e,value:t}){if(q(t))return;let n=lu(e.state);n&&n.seek(n.currentTime+t)},volumeStep({store:e,value:t}){if(q(t))return;let n=uu(e.state);n&&n.setVolume(n.volume+t)},speedUp({store:e}){let t=su(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=su(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])}},fu={seekStep:du.seekStep,volumeStep:du.volumeStep,speedUp:du.speedUp,speedDown:du.speedDown};function pu(e){return fu[e]||(({store:t})=>{let n=t.state[e];K(n)&&n()})}var mu=200,hu=class{#e=0;#t=null;handleUp(e,t){if(e.resolve(`doubletap`).length>0){let n=Date.now();if(n-this.#e<mu){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)},mu);return}e.resolve(`tap`)[0]?.onActivate(t)}#n(){this.#t!==null&&(clearTimeout(this.#t),this.#t=null)}reset(){this.#n(),this.#e=0}},gu=new WeakMap;function _u(e){let t=gu.get(e);return t||(t=new hu,gu.set(e,t),t)}function vu(e,t,n){return fl(e).add({type:`tap`,recognizer:_u(e),onActivate:t,pointer:n?.pointer,region:n?.region,disabled:n?.disabled,action:n?.action,value:n?.value})}function yu(e,t,n){return fl(e).add({type:`doubletap`,recognizer:_u(e),onActivate:t,pointer:n?.pointer,region:n?.region,disabled:n?.disabled,action:n?.action,value:n?.value})}function bu(e){return e.startsWith(`toggle`)}var xu={togglePaused({store:e}){let t=ou(e.state);t&&(t.paused?t.play():t.pause())},toggleMuted({store:e}){uu(e.state)?.toggleMuted()},toggleFullscreen({store:e}){let t=iu(e.state);t&&(t.fullscreen?t.exitFullscreen():t.requestFullscreen())},toggleSubtitles({store:e}){cu(e.state)?.toggleSubtitles()},togglePictureInPicture({store:e}){let t=au(e.state);t&&(t.pip?t.exitPictureInPicture():t.requestPictureInPicture())},seekStep:du.seekStep,volumeStep:du.volumeStep,speedUp:du.speedUp,speedDown:du.speedDown,seekToPercent({store:e,value:t,key:n}){let r=lu(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 Su(e){return xu[e]}var Cu={shift:`Shift`,ctrl:`Control`,alt:`Alt`,meta:`Meta`},wu={shift:`Shift`,ctrl:`Ctrl`,alt:`Alt`,meta:`Meta`},Tu=[`ctrl`,`shift`,`alt`,`meta`];function Eu(e){return e.map(e=>{let t=[];for(let n of Tu)e.modifiers.has(n)&&t.push(Cu[n]);return t.push(e.originalKey),t.join(`+`)}).join(` `)}function Du(e){let t=[];for(let n of Tu)e.modifiers.has(n)&&t.push(wu[n]);return t.push(Ou(e.originalKey)),t.join(`+`)}function Ou(e){return e.length===1?e.toUpperCase():e}var ku=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:ju(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:Eu(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`||ks(e)||e.defaultPrevented)return;let t=Ts(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(Nu(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:Du(e.parsed[0])}#h(){for(let e of this.#o)e()}},Au=new Set([`shift`,`ctrl`,`alt`,`meta`]);function ju(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(As()?`meta`:`ctrl`):Au.has(t)&&r.add(t)}return[{modifiers:r,key:n===`Space`?` `:n.toLowerCase(),originalKey:n}]}function Mu(e){return e.length===1&&!/[a-z]/i.test(e)}function Nu(e,t){if(t.key===`Unidentified`||t.key.toLowerCase()!==e.key)return!1;let n=Mu(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 Pu=new WeakMap;function Fu(e){let t=Pu.get(e);return t||(t=new ku(e),Pu.set(e,t)),t}function Iu(e,t){return Fu(e).add(t)}var Lu=[Ll,zl,Wl,al,$l,Zl,Kl,ol,Pl,Il,Gl,Sl,Yl,Cl];function Ru(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 zu(e){let{onOpenChange:t}=e,n=null,r=null,i=null,a=Ru({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 Bu(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 Vu=`group`;function Hu(e){let t=bs(e.ownerDocument);(!t||t===e.ownerDocument.body||!Ws(e,t))&&e.focus({preventScroll:!0})}var Uu={transitionStarting:`data-starting-style`,transitionEnding:`data-ending-style`};function Wu(e){return{transitionStarting:e===`starting`,transitionEnding:e===`ending`}}function Gu(e){let{onOpenChange:t,closeOnOutsideClick:n}=e,r=null,i=null,a=null,o=new Set,s=!1,c=null,l=Ru({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||(Is(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&&Is(i),i=e,e&&u.current.active&&Fs(e)}return{input:u,triggerProps:T,popupProps:E,get triggerElement(){return r},setTriggerElement:D,setPopupElement:O,open:S,close:C,destroy:l.destroy}}function Ku(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 qu(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 Ku(n,r,Math.max(0,i-n),Math.max(0,a-r))}function Ju(e){let t=document.documentElement.getBoundingClientRect();return e?qu(t,e.getBoundingClientRect()):t}function Yu(e,t={}){if(!e)return null;if(!Wo(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 Xu={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 Zu(e,t,n){return Math.max(t,Math.min(n,e))}function Qu(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 $u={sideOffset:0,alignOffset:0,boundaryOffset:0},ed={top:`bottom`,bottom:`top`,left:`right`,right:`left`};function td(e){return`${Zu(e,0,1/0)}px`}function nd(e,t,n,r){let i=n-r;return i<t?t:Zu(e,t,i)}function rd(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 id(e,t,n,r,i,a,o=Xu){if(xs())return{...ad(e,t,o,n,i,a),...n&&i?od(n,i,t,a,o):{}};if(n&&r){let e=a??$u;return{position:`fixed`,margin:`0`,...sd(n,r,t,e,i),...i?od(n,i,t,e,o):{}}}return{}}function ad(e,t,n=Xu,r,i,a=$u){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=ed[c];if(c===`top`||c===`bottom`){if(d[f]=`calc(anchor(${c}) + ${o})`,r&&i){let{base:e,translate:t}=rd(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}=rd(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 od(e,t,n,r=$u,i=Xu){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]=td(t-r.sideOffset),a[i.availableWidth]=td(l-c)}else{let t=o===`left`?e.left-c:l-e.right;a[i.availableWidth]=td(t-r.sideOffset),a[i.availableHeight]=td(d-u)}return a}function sd(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=nd(d,i.left+e,i.right-e,t.width):l=nd(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 cd(e,t=Xu){let n=getComputedStyle(e);return{sideOffset:Rs(e,n.getPropertyValue(t.sideOffset)),alignOffset:Rs(e,n.getPropertyValue(t.alignOffset)),boundaryOffset:Rs(e,n.getPropertyValue(t.boundaryOffset))}}function ld(e,t){let n=e.getBoundingClientRect(),r=e.offsetWidth||n.width,i=e.offsetHeight||n.height;return Ku(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 ud(){let e=null;return{open(t){e!==t&&(e?.close(`group-open`),e=t)},close(t){e===t&&(e=null)}}}function dd(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)?Zu(i*100,0,100):0}function fd(e){let t=jc({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?$s(t=>e.onValueChange?.(t),r,{leading:!0}):null;function d(t,n){n&&u?u(t):e.onValueChange?.(t)}function f(){if(Ko(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=dd(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(!Ko(s)){if(n.pointerType!==`touch`&&n.buttons===0){p();return}let r=dd(n,o,e.getOrientation(),a);c=r,t.patch({dragPercent:r,pointerPercent:r}),d(r,!0);return}let r=dd(n,e.getElement().getBoundingClientRect(),e.getOrientation(),e.isRTL());t.patch({pointing:!0,pointerPercent:r})},onPointerUp(t){if(e.isDisabled()||(t.stopPropagation(),Ko(s)))return;let n=dd(t,o,e.getOrientation(),a);u?.cancel(),e.onValueChange?.(n),e.onValueCommit?.(n),l=!0},onPointerLeave(){Ko(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=Qu(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=Zu(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 pd={fill:`--media-slider-fill`,pointer:`--media-slider-pointer`,buffer:`--media-slider-buffer`};function md(e){return{[pd.fill]:`${e.fillPercent.toFixed(3)}%`,[pd.pointer]:`${e.pointerPercent.toFixed(3)}%`}}function hd(e){return{...md(e),[pd.buffer]:`${e.bufferPercent.toFixed(3)}%`}}function gd(e,t){let n=e/2;return{position:`absolute`,left:t===`visible`?`calc(var(${pd.pointer}) - ${n}px)`:`min(max(0px, calc(var(${pd.pointer}) - ${n}px)), calc(100% - ${e}px))`,width:`max-content`,pointerEvents:`none`}}var _d=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 vd(e){let{getContainer:t,getImg:n,onStateChange:r}=e,i=new _d,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 yd={hover:`hover`,focus:`focus`,escape:`escape`,blur:`blur`,"imperative-action":`imperative-action`};function bd(e){let t={transition:e.transition,onOpenChange(t,n){let r=yd[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=Gu(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 xd(){let e=jc({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&&(Cd(i),Sd(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();wd(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 Sd(e){e&&e.offsetHeight}function Cd(e){let t=e?.getAnimations?.({subtree:!0})??[];for(let e of t)e.cancel()}function wd(e){if(!e)return Promise.resolve();let t=e.getAnimations?.()??[];return t.length===0?Promise.resolve():Promise.all(t.map(e=>e.finished)).then(Qs,Qs)}function Td(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=Zu(e.getPercent()-n*r,0,100);e.onValueChange?.(i)}}}function Ed(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 Dd(e,t){let n={};for(let r in e){if(t&&!(r in t))continue;let i=t?.[r]??Od(r),a=e[r];a===!0?n[i]=``:a&&(n[i]=String(a))}return n}function Od(e){return`data-${e.toLowerCase()}`}var kd={key:`container.label`,text:`Media player`};r();var Ad=u(function({children:e,tabIndex:t=0,role:n=Vu,"aria-label":r,"aria-labelledby":i,...a},s){let c=hc(),l=hs(),u=o(null),d=Ys(s,u);m(()=>(c?.(u.current),()=>c?.(null)),[c]);let f=e=>{a.onPointerUp?.(e);let t=u.current;t&&Hu(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(kd)},...a,onPointerUp:f,children:e})});r();function Y(e){let t=o(e);return t.current=e,t}r();function jd(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 Md(e){function t({children:t}){let[n,r]=h(()=>Nc()(vc(...e.features))),[i]=h(()=>ud()),[a,o]=h(null),[s,c]=h(null);return jd(n),m(()=>{if(a){if(n.destroyed){r(Nc()(vc(...e.features)));return}return n.attach({media:a,container:s})}},[a,s,n]),I(oc,{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}=sc();return nc(t,e)}return{Provider:t,Container:Ad,usePlayer:n,useMedia:uc}}function Nd(e){return e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>=65&&e.charCodeAt(2)<=90}function Pd(e,t){return Nd(e)&&(typeof t==`function`||t===void 0)}function Fd(e,t){return t?e?n=>{t(n),e(n)}:t:e}function Id(e,t){return t&&e?`${t} ${e}`:t||e}function Ld(e,t){return t?e?{...e,...t}:t:e}function Rd(e,t){if(!t)return e;for(let n in t){let r=t[n];n===`className`?e.className=Id(e.className,r):n===`style`?e.style=Ld(e.style,r):e[n]=Pd(n,r)?Fd(e[n],r):r}return e}function zd(...e){let t={};for(let n of e)t=Rd(t,n);return t}r();function Bd(e,t){return K(e)?e(t):e}function Vd(e,t){return K(e)?e(t):e}function Hd(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=Bd(r,o),p=Vd(i,o),m=zd(l?Dd(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=Js(s,m.ref);return a({...m,ref:e},o)}if(d(a)){let e=Hd(a),t=Js(s,m.ref,e),n=zd(m,a.props);return n.ref=t,f(a,n)}return m.ref=Js(s,m.ref),E(e,m)}r();function Ud(e){let{displayName:t,onActivate:n,isDisabled:r}=e,i=p(e=>{},[t]);return{getButtonProps:p(e=>zd(Bu({onActivate:n,isDisabled:r}),e),[n,r]),buttonRef:i}}r();function Wd(e,t){let n=dc(),[r,i]=h({});return m(()=>{if(!n||!e){i({});return}let r=Fu(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 Gd=N(!1);Gd.Provider;function Kd(){return e(Gd)}N(null).Provider,r();var qd=N(null),Jd=qd.Provider;function Yd(){let t=e(qd);if(!t)throw Error(`Tooltip compound components must be used within a Tooltip.Root`);return t}function Xd(){return e(qd)}r();function Zd(e,t){return e.getLabelParams?.(t)}function Qd(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=Xd(),x=Kd(),S=b?.setContent,C=cc(a),w=Wd(s,c?.(v)),T=hs(),[E]=h(()=>new r);f.has(`menuTrigger`)&&q(v.menuTrigger)&&(v.menuTrigger=x),E.setProps(v);let{getButtonProps:D,buttonRef:O}=Ud({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?fs(E.getLabel(k),T,Zd(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,...ls(N)?{"aria-label":fs(N,T,Zd(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 $d(e,t){return K(e)?e(t)||void 0:e||void 0}var ef=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,...Wu(e.status)}}getAttrs(e){return{role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":e.titleId,"aria-describedby":e.descriptionId}}},tf={open:`data-open`,...Uu},nf=class e{static defaultProps={delay:500};state=jc({visible:!1});#e={...e.defaultProps};#t=null;setProps(t){this.#e=Jo(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)}},rf={visible:`data-visible`},af=class{#e=null;setMedia(e){this.#e=e}getState(){let e=this.#e;return{visible:e.controlsVisible,userActive:e.userActive}}},of={visible:`data-visible`,userActive:`data-user-active`},sf=class extends ef{setProps(){}},cf=`common.`,lf={key:`${cf}empty`,text:``},uf={key:`${cf}ok`,text:`OK`},df=`errors.`,ff={key:`${df}aborted`,text:`You stopped media playback before it finished.`},pf={key:`${df}network`,text:`This media could not be loaded due to a network or server issue.`},mf={key:`${df}decode`,text:`This media could not be played. It may be corrupted, or your browser may not support its format.`},hf={key:`${df}source`,text:`This media could not be loaded. It may be unavailable, or your browser may not support its format.`},gf={key:`${df}encrypted`,text:`This media could not be played because it could not be decrypted.`},_f={key:`${df}title`,text:`Something went wrong.`},vf={key:`${df}unexpected`,text:`An unexpected error occurred.`},yf={[zc.MEDIA_ERR_ABORTED]:ff,[zc.MEDIA_ERR_NETWORK]:pf,[zc.MEDIA_ERR_DECODE]:mf,[zc.MEDIA_ERR_SRC_NOT_SUPPORTED]:hf,[zc.MEDIA_ERR_ENCRYPTED]:gf,[zc.MEDIA_ERR_CUSTOM]:lf},bf={[zc.MEDIA_ERR_SRC_NOT_SUPPORTED]:[`Failed to open media`]};function xf(e){return e>=zc.MEDIA_ERR_ABORTED&&e<=zc.MEDIA_ERR_ENCRYPTED}function Sf(){return _f}function Cf(){return uf}function wf(e,t){if(e){let t=yf[e.code],n=e.message?.trim();if(n){let r=zc.defaultMessages[e.code];if(t&&r&&n===r)return t;let i=bf[e.code];return t&&xf(e.code)&&!e.context&&i?.includes(n)?t:n}if(t)return t}return t?.trim()||vf}var Tf=`fullscreen.`,Ef={key:`${Tf}enter`,text:`Enter fullscreen`},Df={key:`${Tf}exit`,text:`Exit fullscreen`},Of=class e{static defaultProps={label:``,disabled:!1};state=jc({fullscreen:!1,availability:`unavailable`,disabled:!0,hidden:!0,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Jo(t,e.defaultProps)}getLabel(e){return $d(this.#e.label,e)||(e.fullscreen?Df:Ef)}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:cs(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()}},kf={fullscreen:`data-fullscreen`,availability:`data-availability`,disabled:`data-disabled`,hidden:`data-hidden`},Af={key:`playback.rate`,text:`Playback rate {rate}`},jf=`volume.`,Mf={key:`${jf}mutedValue`,text:`{percent}, muted`};`${jf}`;var Nf={key:`${jf}label`,text:`Volume`};`${jf}`;var Pf=Intl.DurationFormat,Ff=new Map;function If(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 Lf(e){return e===void 0?``:Array.isArray(e)?e.join(`:`):e}function Rf(e){let t=Array.isArray(e)?e[0]:e;return!t||t===`en`||t.startsWith(`en-`)}function zf(e,t=`long`,n){let r=`${Lf(e)}:${t}:${n??``}`,i=Ff.get(r);return i||(i=Pf?new Pf(e,n===void 0?{style:t}:{style:t,hoursDisplay:n}):If(t,n),Ff.set(r,i)),i}function Bf(e){return Go(e)&&Number.isFinite(e)}function Vf(e,t){if(!Bf(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=Bf(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=zf(`en`,`digital`,u?`always`:`auto`).format(f);return d||(p=p.replace(/^0(?=\d:)/,``)),`${n?`-`:``}${p}`}function Hf(e){if(!Bf(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 Uf(e,t){if(!Bf(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=zf(t?.locale,t?.style??`long`).format(s);if(n){let e=t?.formatRemaining;return e?e(c):Rf(t?.locale)?`${c} remaining`:c}return c}var Wf=`buttons.`,Gf={key:`${Wf}play`,text:`Play`},Kf={key:`${Wf}pause`,text:`Pause`},qf={key:`${Wf}replay`,text:`Replay`},Jf={key:`${Wf}mute`,text:`Mute`},Yf={key:`${Wf}unmute`,text:`Unmute`},Xf=class e{static defaultProps={label:``,disabled:!1};state=jc({muted:!1,volumeLevel:`off`,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Jo(t,e.defaultProps)}getLabel(e){return $d(this.#e.label,e)||(e.muted?Yf:Jf)}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:Zf(e)}),this.state.patch({label:cs(this.getLabel(this.state.current))}),this.state.current}toggle(e){this.#e.disabled||e.toggleMuted()}};function Zf(e){return e.muted||e.volume===0?`off`:e.volume<.5?`low`:e.volume<.75?`medium`:`high`}var Qf={muted:`data-muted`,volumeLevel:`data-volume-level`},$f=`pip.`,ep={key:`${$f}enter`,text:`Enter picture-in-picture`},tp={key:`${$f}exit`,text:`Exit picture-in-picture`},np=class e{static defaultProps={label:``,disabled:!1};state=jc({pip:!1,availability:`unavailable`,disabled:!0,hidden:!0,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Jo(t,e.defaultProps)}getLabel(e){return $d(this.#e.label,e)||(e.pip?tp:ep)}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:cs(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()}},rp={pip:`data-pip`,availability:`data-availability`,disabled:`data-disabled`,hidden:`data-hidden`},ip=class e{static defaultProps={label:``,disabled:!1};state=jc({paused:!0,ended:!1,started:!1,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Jo(t,e.defaultProps)}getLabel(e){return $d(this.#e.label,e)||(e.ended?qf:e.paused?Gf:Kf)}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:cs(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()}}},ap={paused:`data-paused`,ended:`data-ended`,started:`data-started`},op=class e{static defaultProps={label:``,disabled:!1,menuTrigger:!1};state=jc({rate:1,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Jo(t,e.defaultProps)}getLabel(e){let t=$d(this.#e.label,e);return t===void 0?Af:t}getLabelParams(e){if($d(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:cs(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)}},sp={rate:`data-rate`},cp=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=Jo(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,...Wu(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}}},lp={open:`data-open`,side:`data-side`,align:`data-align`,...Uu},up=`seek.`,dp={key:`${up}forward`,text:`Seek forward {seconds} seconds`},fp={key:`${up}backward`,text:`Seek backward {seconds} seconds`},pp=class e{static defaultProps={seconds:30,label:``,disabled:!1};state=jc({seeking:!1,direction:`forward`,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Jo(t,e.defaultProps)}getLabel(e){let t=$d(this.#e.label,e);return t===void 0?e.direction===`backward`?fp:dp:t}getLabelParams(e){if($d(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:cs(this.getLabel(this.state.current))}),this.state.current}async seek(e){this.#e.disabled||await e.seek(e.currentTime+this.#e.seconds)}},mp={seeking:`data-seeking`,direction:`data-direction`},hp=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=Jo(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 $d(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 Qu(Zu(t+e/100*(n-t),t,n),r,t)}rawValueFromPercent(e){let{min:t,max:n}=this.#e;return Zu(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)}},gp={dragging:`data-dragging`,pointing:`data-pointing`,interactive:`data-interactive`,orientation:`data-orientation`,disabled:`data-disabled`},_p={loading:`data-loading`,error:`data-error`,hidden:`data-hidden`};function vp(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&&Go(n)&&!Number.isNaN(n)&&(l[t]=n)}let u={url:a};return Go(l.w)&&(u.width=l.w),Go(l.h)&&(u.height=l.h),Go(l.x)&&Go(l.y)&&(u.coords={x:l.x,y:l.y}),u}function yp(e,t){let n=[];for(let r of e){let e=vp(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 bp=`time.`,xp={key:`${bp}current`,text:`Current time`},Sp={key:`${bp}duration`,text:`Duration`},Cp={key:`${bp}remaining`,text:`Remaining`},wp={key:`${bp}remainingSuffix`,text:`{duration} remaining`},Tp={key:`${bp}showElapsed`,text:`{duration}. Show elapsed time.`},Ep={key:`${bp}showDuration`,text:`{duration}. Show duration.`},Dp={key:`${bp}showRemaining`,text:`{duration}. Show remaining time.`},Op={key:`${bp}position`,text:`{current} of {duration}`},kp={current:Tp,duration:Ep,remaining:Dp},Ap={current:xp,duration:Sp,remaining:Cp},jp=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=Jo(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 Vf(Math.abs(t),e.duration)}#i(){let{type:e}=this.#e,t=this.#n();return Uf(e===`remaining`?t<0?t:-Math.abs(t):t)}#a(){let e=this.#n();return Hf(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=$d(this.#e.label,e);return n===void 0?this.#e.toggle?kp[this.#o(t,e.type)]:Ap[this.#e.type]:n}getLabelParams(e){return $d(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()}}},Mp={type:`data-type`},Np={key:`slider.seek`,text:`Seek`},Pp=class e extends hp{static defaultProps={...hp.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=Jo(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)||Np}#i(e){return e.dragging?this.rawValueFromPercent(e.pointerPercent):e.value}#a(e){return this.#n===void 0?Uf(e):Uf(e,{locale:this.#n})}getValueText(e){return Number.isFinite(e.duration)?Op: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)}}},Fp={...gp,seeking:`data-seeking`},Ip=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=Jo(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,...Wu(e.status)}}getPopupAttrs(e){return{popover:`manual`,role:`presentation`}}},Lp={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`},Rp={open:`data-open`,side:`data-side`,align:`data-align`,...Uu},zp=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=Jo(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()}},Bp=new Map;function Vp(e){return e===void 0?``:Array.isArray(e)?e.join(`:`):e}function Hp(e){let t=Vp(e),n=Bp.get(t);if(!n)try{n=new Intl.NumberFormat(e,{style:`percent`,maximumFractionDigits:0}),Bp.set(t,n)}catch{return}return n}function Up(e){return`${Math.round(Math.min(1,Math.max(0,e))*100)}%`}function Wp(e,t){let n=!Go(e)||!Number.isFinite(e)?0:Math.min(1,Math.max(0,e));try{let e=Hp(t)??Hp(void 0);if(e)return e.format(n)}catch{}return Up(n)}var Gp=class e extends hp{static defaultProps={...hp.defaultProps,label:``,wheelStep:5};#e=null;#t;constructor(e){super(),e&&this.setProps(e)}setProps(t){super.setProps(Jo(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)||Nf}getValueText(e){return e.muted?Mf:this.getValueTextParams(e).percent}getValueTextParams(e){return{percent:Wp(e.value/100,this.#t)}}getAttrs(e){return{...super.getAttrs(e),"aria-valuetext":this.getValueText(e)}}},Kp={...gp,availability:`data-availability`};r();var qp=N(null),Jp=qp.Provider;function Yp(){let t=e(qp);if(!t)throw Error(`AlertDialog compound components must be used within an AlertDialog.Root`);return t}var Xp=Object.defineProperty,Zp=(e,t)=>{let n={};for(var r in e)Xp(n,r,{get:e[r],enumerable:!0});return t||Xp(n,Symbol.toStringTag,{value:`Module`}),n};r();var Qp=u(function({render:e,className:t,style:n,disabled:r,...i},a){let{dialog:o,state:s}=Yp(),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 $p(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 em=$p({displayName:`AlertDialogDescription`,tag:`p`,useContext:Yp,getProps:e=>({id:e.descriptionId})});r();var tm=u(function({render:e,className:t,style:n,...r},i){let{core:a,dialog:o,state:s,stateAttrMap:c}=Yp(),l=Ys(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 nm=/[^a-zA-Z0-9_-]/g;function rm(e){let t=M().replace(nm,``);return e?`${e}-${t}`:t}r();function im({open:e,defaultOpen:t=ef.defaultProps.defaultOpen,onOpenChange:n,onOpenChangeComplete:r,children:i}){let[a]=h(()=>new ef),o=e!==void 0,s=Y(n),c=Y(r),[l]=h(()=>{let e=zu({transition:xd(),onOpenChange:e=>{s.current?.(e)},onOpenChangeComplete:e=>{c.current?.(e)}});return!o&&t&&e.open(),e}),u=rm(`alert-dialog-title`),d=rm(`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]),jd(l);let f=ec(l.input);return a.setInput(f),I(Jp,{value:{core:a,dialog:l,state:a.getState(),stateAttrMap:tf},children:i})}var am=$p({displayName:`AlertDialogTitle`,tag:`h2`,useContext:Yp,getProps:e=>({id:e.titleId})}),om=Zp({Close:()=>Qp,Description:()=>em,Popup:()=>tm,Root:()=>im,Title:()=>am});r();var sm=u(function(e,t){let{render:n,className:r,style:i,delay:a,...o}=e,s=cc(ou),[l]=h(()=>new nf);jd(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:rf,ref:[t],props:[o]}):null});r();var cm=N(null),lm=cm.Provider;function um(){let t=e(cm);if(!t)throw Error(`Controls compound components must be used within a Controls.Root`);return t}function dm(){return e(cm)}r();var fm=u(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{state:s,stateAttrMap:c}=um(),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 pm=u(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=cc(nu),[c]=h(()=>new af);if(!s)return null;c.setMedia(s);let l=c.getState();return I(lm,{value:{state:l,stateAttrMap:of},children:X(`div`,{render:n,className:r,style:i},{state:l,stateAttrMap:of,ref:[t],props:[{children:a},o,{"data-interactive":``}]})})}),mm=Zp({Group:()=>fm,Root:()=>pm});r();var hm=N(null),gm=hm.Provider;function _m(){let t=e(hm);if(!t)throw Error(`ErrorDialog compound components must be used within an ErrorDialog.Root`);return t}r();var vm=u(function({render:e,className:t,style:n,disabled:r,children:i,...a},o){let s=hs(),{dialog:c,state:l,stateAttrMap:u}=Yp(),d=p(()=>{r||c.close()},[c,r]),f=i??fs(Cf(),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 ym=u(function({render:e,className:t,style:n,children:r,...i},a){let o=hs(),{state:s,stateAttrMap:c}=Yp(),{lastError:l}=_m(),u=wf(l),d=r??fs(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 bm({children:e}){let[t]=h(()=>new sf),n=cc(ru),r=o(n?.error??null);n?.error&&(r.current=n.error);let i=Y(n),[a]=h(()=>zu({transition:xd(),onOpenChange:e=>{e||i.current?.dismissError()}})),s=rm(`error-dialog-title`),c=rm(`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]),jd(a);let l=ec(a.input);t.setInput(l);let u=t.getState();return n?I(gm,{value:{lastError:r.current},children:I(Jp,{value:{core:t,dialog:a,state:u,stateAttrMap:tf},children:e})}):null}r();var xm=u(function({render:e,className:t,style:n,children:r,...i},a){let o=hs(),{state:s,stateAttrMap:c}=Yp(),l=r??fs(Sf(),o);return X(`h2`,{render:e,className:t,style:n},{state:s,stateAttrMap:c,ref:a,props:[{id:s.titleId,children:l},i]})}),Sm=Zp({Close:()=>vm,Description:()=>ym,Popup:()=>tm,Root:()=>bm,Title:()=>xm}),Cm=Qd({displayName:`FullscreenButton`,core:Of,stateAttrMap:kf,selector:iu,action:(e,t)=>e.toggle(t),hotkeyAction:`toggleFullscreen`,isSupported:e=>!e.hidden});r();function wm({type:e,action:t,value:n,pointer:r,region:i,disabled:a}){let o=cc(),s=dc();return m(()=>{if(!s||!e||!t||a)return;let c=pu(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`?yu(s,l,u):vu(s,l,u)},[s,o,e,t,n,r,i,a]),null}var Tm=wm;r();function Em(){let[,e]=P(e=>e+1,0);return e}r();function Dm(e){let t=Y(e),r=o(null),i=o(null),a=Em(),[s]=h(()=>fd({getElement:()=>r.current,getThumbElement:()=>i.current,getOrientation:()=>t.current.orientation??`horizontal`,isRTL:()=>r.current?_s(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?.()}));jd(s);let c=ec(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 Om({keys:e,action:t,value:n,disabled:r,target:i}){let a=cc(),o=dc();return m(()=>{if(!o||!e||!t||r)return;let s=Su(t);if(s)return Iu(o,{keys:e,action:t,value:n,target:i,disabled:r,repeatable:!bu(t),onActivate:(e,t)=>{s({store:a,key:t,value:n})}})},[o,a,e,t,n,r,i]),null}var km=Om;r();function Am(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 jm=Qd({displayName:`MuteButton`,core:Xf,stateAttrMap:Qf,selector:uu,action:(e,t)=>e.toggle(t),hotkeyAction:`toggleMuted`}),Mm=Qd({displayName:`PiPButton`,core:np,stateAttrMap:rp,selector:au,action:(e,t)=>e.toggle(t),hotkeyAction:`togglePictureInPicture`,isSupported:e=>!e.hidden}),Nm=Qd({displayName:`PlayButton`,core:ip,stateAttrMap:ap,selector:ou,action:(e,t)=>e.toggle(t),hotkeyAction:`togglePaused`}),Pm=Qd({displayName:`PlaybackRateButton`,core:op,stateAttrMap:sp,selector:su,action:(e,t)=>e.cycle(t),hotkeyAction:`speedUp`});r();var Fm=N(null),Im=Fm.Provider;function Lm(){let t=e(Fm);if(!t)throw Error(`Popover compound components must be used within a Popover.Root`);return t}var Rm=$p({displayName:`PopoverArrow`,tag:`div`,useContext:Lm,staticProps:{"aria-hidden":`true`}});r();var zm={position:`fixed`,inset:`auto`,margin:0},Bm=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}=Lm(),y=o(null),x=Ys(a,p(e=>{c.setPopupElement(e),e&&xs()&&e.style.setProperty(`position-anchor`,`--${m}`)},[c,m]),y),S=b(()=>({side:u,align:l.align}),[u,l.align]),C=b(()=>{if(!xs())return null;let{positionAnchor:e,...t}=id(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=Yu(_,{container:v,root:r}),a=ld(t,S.side),o=Ju(i),s=cd(t),l=Ps(n,a,o,S,s),{positionAnchor:u,...f}=id(m,{...S,side:l},n,xs()?void 0:a,o,s);T(f),d(l)}e();let t=c.triggerElement,n=y.current,r=n?Yu(_,{container:v,root:n.getRootNode()}):null,i=0;function a(t){t&&Ed(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??zm;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 Vm({open:e,defaultOpen:t=cp.defaultProps.defaultOpen,onOpenChange:n,onOpenChangeComplete:r,openOnHover:i=cp.defaultProps.openOnHover,delay:a=cp.defaultProps.delay,closeDelay:o=cp.defaultProps.closeDelay,boundary:s=`container`,children:c,...l}){let u=fc(),d=pc(),f=dm(),[p]=h(()=>new cp(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=Gu({transition:xd(),onOpenChange:(e,t)=>{_.current?.(e,t)},onOpenChangeComplete:e=>{v.current?.(e)},closeOnEscape:()=>y.current??cp.defaultProps.closeOnEscape,closeOnOutsideClick:()=>b.current??cp.defaultProps.closeOnOutsideClick,openOnHover:()=>x.current,delay:()=>S.current,closeDelay:()=>C.current,group:()=>w.current});return!g&&t&&e.open(`click`),e}),E=rm(),D=rm(`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]),jd(T);let O=ec(T.input);p.setInput(O);let{state:k,preferredSide:A,setPositionedSide:j}=Am(p.getState());return I(Im,{value:{core:p,popover:T,state:k,preferredSide:A,setPositionedSide:j,stateAttrMap:lp,anchorName:E,popupId:D,boundary:s,container:u},children:c})}r();var Hm=u(function({render:e,className:t,style:n,...r},i){let{core:a,popover:o,state:s,stateAttrMap:c,anchorName:l,popupId:u}=Lm(),d=p(e=>{o.setTriggerElement(e),e&&xs()&&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]})}),Um=Zp({Arrow:()=>Rm,Popup:()=>Bm,Root:()=>Vm,Trigger:()=>Hm}),Wm=Qd({displayName:`SeekButton`,core:pp,stateAttrMap:mp,selector:lu,action:(e,t)=>e.seek(t),hotkeyAction:`seekStep`,hotkeyValue:e=>typeof e.seconds==`number`?e.seconds:pp.defaultProps.seconds});r();var Gm=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 _d),p=o(null),m=o(null),g=lc(cu),[,_]=h(0),[v]=h(()=>vd({getContainer:()=>p.current,getImg:()=>m.current,onStateChange:()=>_(e=>e+1)}));jd(v,()=>v.connect());let y=b(()=>s&&s.length>0?s:g&&g.thumbnailCues.length>0?yp(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:_p,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 Km=N(null);function qm({value:e,children:t}){return I(Km.Provider,{value:e,children:t})}function Jm(){let t=e(Km);if(!t)throw Error(`Slider compound components must be used within a Slider.Root`);return t}var Ym=$p({displayName:`SliderBuffer`,tag:`div`,useContext:Jm}),Xm=$p({displayName:`SliderFill`,tag:`div`,useContext:Jm});r();var Zm=u(function(e,t){let{render:n,className:r,style:i,overflow:a=`clamp`,...s}=e,c=Jm(),{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=gd(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 Qm=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 hp),x=hs();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}=Dm({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:md,onValueChange:e=>m?.(b.valueFromPercent(e)),onValueCommit:e=>g?.(b.valueFromPercent(e)),onDragStart:_,onDragEnd:v});return I(qm,{value:{state:S,pointerValue:b.valueFromPercent(S.pointerPercent),thumbRef:T,thumbProps:O,stateAttrMap:gp,getAttrs:e=>{let t=b.getAttrs(e);return{...t,"aria-label":fs(t[`aria-label`],x)}},formatValue:void 0},children:X(`div`,{render:n,className:r,style:i},{state:S,stateAttrMap:gp,ref:[t,w],props:[{style:{...C,...D}},E,y]})})});r();var $m=u(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Jm(),{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 eh=u(function(e,t){let{pointerValue:n}=Jm();return I(Gm,{ref:t,...e,time:n})}),th=$p({displayName:`SliderTrack`,tag:`div`,useContext:Jm});r();var nh=u(function(e,t){let{render:n,className:r,style:i,type:a=`current`,format:o,...s}=e,c=Jm(),{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]})}),rh=Zp({Buffer:()=>Ym,Fill:()=>Xm,Preview:()=>Zm,Root:()=>Qm,Thumb:()=>$m,Thumbnail:()=>eh,Track:()=>th,Value:()=>nh});r();var ih=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 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:[{"aria-hidden":`true`,children:a},o]})});r(),_();var oh=u(function(e,t){let{render:n,className:r,style:i,type:a,negativeSign:o,label:s,toggle:c=!1,...l}=e,u=cc(lu),d=hs(),f=gs(),[p]=h(()=>new jp),g=a??jp.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`?fs(wp,d,{duration:Uf(Math.abs(y.seconds),{locale:f})}):Uf(Math.abs(y.seconds),{locale:f})}:void 0,S=y.negative?I(j,{children:[I(`span`,{"aria-hidden":`true`,children:o??jp.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&&ks(e.nativeEvent)&&(e.preventDefault(),!e.repeat&&C())};return X(`time`,{render:n,className:r,style:i},{state:y,stateAttrMap:Mp,ref:[t],props:[{dateTime:y.datetime,children:S,...b,"aria-label":fs(b[`aria-label`],d,x),...c?{onClick:w,onKeyDown:T}:void 0},l]})}),sh=Zp({Group:()=>ih,Separator:()=>ah,Value:()=>oh});r();var ch=()=>Promise.resolve(0),lh=u(function(e,t){let{render:n,className:r,style:i,label:a,changeThrottle:o=Pp.defaultProps.changeThrottle,step:s=Pp.defaultProps.step,largeStep:c=Pp.defaultProps.largeStep,orientation:l,disabled:u,thumbAlignment:d,onDragStart:f,onDragEnd:p,pauseOnDrag:g,..._}=e,v=cc(lu),y=cc(tu),b=cc(ou),x=hs(),S=gs(),[C]=h(()=>new Pp);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}=Dm({computeState:e=>(C.setInput(e),!v||!y?C.setMedia({currentTime:0,duration:0,seeking:!1,seek:ch,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:hd,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(qm,{value:{state:D,pointerValue:C.valueFromPercent(D.pointerPercent),thumbRef:A,thumbProps:M,stateAttrMap:Fp,getAttrs:e=>{let t=C.getAttrs(e);return{...t,"aria-label":fs(t[`aria-label`],x),"aria-valuetext":fs(t[`aria-valuetext`],x,C.getValueTextParams(e))}},formatValue:e=>Vf(e,E)},children:X(`div`,{render:n,className:r,style:i},{state:D,stateAttrMap:Fp,ref:[t,k],props:[{style:{...O,...ee}},j,_]})}):null}),uh=Zp({Buffer:()=>Ym,Fill:()=>Xm,Preview:()=>Zm,Root:()=>lh,Thumb:()=>$m,Track:()=>th,Value:()=>nh}),dh=$p({displayName:`TooltipArrow`,tag:`div`,useContext:Yd,staticProps:{"aria-hidden":`true`}});r();var fh=u(function({render:e,className:t,style:n,children:r,...i},a){let{state:o,stateAttrMap:s,content:c}=Yd(),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 ph=u(function({render:e,className:t,style:n,children:r,...i},a){let{state:o,stateAttrMap:s,content:c}=Yd(),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 mh={position:`fixed`,inset:`auto`,margin:0},hh=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}=Yd(),x=o(null),S=Ys(s,p(e=>{l.setPopupElement(e),e&&xs()&&e.style.setProperty(`position-anchor`,`--${g}`)},[l,g]),x),C=b(()=>({side:d,align:u.align}),[d,u.align]),w=b(()=>{if(!xs())return null;let{positionAnchor:e,...t}=id(g,C,void 0,void 0,void 0,void 0,Lp);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=Yu(v,{container:y,root:r}),a=ld(t,C.side),o=Ju(i),s=cd(t,Lp),c=Ps(n,a,o,C,s),{positionAnchor:u,...d}=id(g,{...C,side:c},n,xs()?void 0:a,o,s,Lp);E(d),f(c)}e();let t=l.triggerElement,n=x.current,r=n?Yu(v,{container:y,root:n.getRootNode()}):null,i=0;function a(t){t&&Ed(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??mh;if(!u.open)return null;let O=i===void 0?I(j,{children:[I(fh,{}),I(ph,{})]}):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 gh=N(null),_h=gh.Provider;function vh(){return e(gh)?.group}r();function yh({delay:e,closeDelay:t,timeout:n,children:r}){let[i]=h(()=>new zp({delay:e,closeDelay:t,timeout:n}));return i.setProps({delay:e,closeDelay:t,timeout:n}),I(_h,{value:{group:i},children:r})}r();function bh({open:e,defaultOpen:t=Ip.defaultProps.defaultOpen,onOpenChange:n,onOpenChangeComplete:r,delay:i=Ip.defaultProps.delay,closeDelay:a=Ip.defaultProps.closeDelay,disableHoverablePopup:o=Ip.defaultProps.disableHoverablePopup,disabled:s=Ip.defaultProps.disabled,boundary:c=`container`,children:l,...u}){let d=fc(),f=dm(),[p]=h(()=>new Ip(u));p.setProps(u);let g=!q(e),_=vh(),v=Y(n),y=Y(r),b=Y(i),x=Y(a),S=Y(o),C=Y(s),w=Y(_),[T]=h(()=>{let e=bd({transition:xd(),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=rm(),k=rm(`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]),jd(T);let A=ec(T.input);p.setInput(A);let{state:j,preferredSide:ee,setPositionedSide:M}=Am(p.getState());return I(Jd,{value:{core:p,tooltip:T,state:j,preferredSide:ee,setPositionedSide:M,stateAttrMap:Rp,anchorName:O,popupId:k,content:E,setContent:D,boundary:c,container:d},children:l})}r();var xh=u(function({render:e,className:t,style:n,...r},i){let{tooltip:a,state:o,stateAttrMap:s,anchorName:c}=Yd(),l=p(e=>{a.setTriggerElement(e),e&&xs()&&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]})}),Sh=Zp({Arrow:()=>dh,Label:()=>fh,Popup:()=>hh,Provider:()=>yh,Root:()=>bh,Shortcut:()=>ph,Trigger:()=>xh});r();var Ch={volume:0,muted:!1,volumeAvailability:`unsupported`,setVolume:()=>0,toggleMuted:()=>!1},wh=u(function(e,t){let{render:n,className:r,style:i,label:a,orientation:s,step:c=Gp.defaultProps.step,largeStep:l=Gp.defaultProps.largeStep,wheelStep:u=Gp.defaultProps.wheelStep,disabled:d,thumbAlignment:f,onDragStart:m,onDragEnd:g,..._}=e,v=cc(uu),y=hs(),b=gs(),[x]=h(()=>new Gp);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}=Dm({computeState:e=>(x.setInput(e),x.setMedia(v??Ch),x.getState()),getPercent:w,getStepPercent:T,getLargeStepPercent:()=>x.getLargeStepPercent(),orientation:s,disabled:d,adjustPercent:(e,t,n)=>x.adjustPercentForAlignment(e,t,n),getCSSVars:md,onValueChange:E,onValueCommit:E,onDragStart:m,onDragEnd:g}),[N]=h(()=>Td({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(qm,{value:{state:D,pointerValue:x.valueFromPercent(D.pointerPercent),thumbRef:A,thumbProps:M,stateAttrMap:Kp,getAttrs:e=>{let t=x.getAttrs(e);return{...t,"aria-label":fs(t[`aria-label`],y),"aria-valuetext":fs(t[`aria-valuetext`],y,x.getValueTextParams(e))}},formatValue:e=>`${Math.round(e)}%`},children:X(`div`,{render:n,className:r,style:i},{state:D,stateAttrMap:Kp,ref:[t,k,F],props:[{style:{...O,...ee}},j,_]})}):null}),Th=Zp({Fill:()=>Xm,Preview:()=>Zm,Root:()=>wh,Thumb:()=>$m,Track:()=>th,Value:()=>nh}),Eh=v(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Dh=v(((e,t)=>{var n=Eh();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}})),Oh=v(((e,t)=>{t.exports=Dh()()}));r();var Z=S(Oh());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 Ah(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 Mh=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Ah(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(`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`}))});Mh.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Mh.displayName=`AlertTriangle`,r();function Nh(){return Nh=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},Nh.apply(this,arguments)}function Ph(e,t){if(e==null)return{};var n=Fh(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 Fh(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 Ih=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Ph(e,[`color`,`size`]);return t.createElement(`svg`,Nh({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`}))});Ih.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Ih.displayName=`Check`,r();function Lh(){return Lh=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},Lh.apply(this,arguments)}function Rh(e,t){if(e==null)return{};var n=zh(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 zh(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 Bh=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Rh(e,[`color`,`size`]);return t.createElement(`svg`,Lh({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`}))});Bh.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Bh.displayName=`ChevronLeft`,r();function Vh(){return Vh=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},Vh.apply(this,arguments)}function Hh(e,t){if(e==null)return{};var n=Uh(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 Uh(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 Wh=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Hh(e,[`color`,`size`]);return t.createElement(`svg`,Vh({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`}))});Wh.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Wh.displayName=`ChevronRight`,r();function Gh(){return Gh=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},Gh.apply(this,arguments)}function Kh(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 Jh=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Kh(e,[`color`,`size`]);return t.createElement(`svg`,Gh({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`}))});Jh.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Jh.displayName=`Copy`,r();function Yh(){return Yh=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},Yh.apply(this,arguments)}function Xh(e,t){if(e==null)return{};var n=Zh(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 Zh(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 Qh=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Xh(e,[`color`,`size`]);return t.createElement(`svg`,Yh({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`}))});Qh.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Qh.displayName=`Maximize`,r();function $h(){return $h=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},$h.apply(this,arguments)}function eg(e,t){if(e==null)return{};var n=tg(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 tg(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 ng=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=eg(e,[`color`,`size`]);return t.createElement(`svg`,$h({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`}))});ng.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},ng.displayName=`Minimize`,r();function rg(){return rg=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},rg.apply(this,arguments)}function ig(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 og=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=ig(e,[`color`,`size`]);return t.createElement(`svg`,rg({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`}))});og.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},og.displayName=`Pause`,r();function sg(){return sg=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},sg.apply(this,arguments)}function cg(e,t){if(e==null)return{};var n=lg(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 lg(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 ug=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=cg(e,[`color`,`size`]);return t.createElement(`svg`,sg({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`}))});ug.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},ug.displayName=`Play`,r();function dg(){return dg=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},dg.apply(this,arguments)}function fg(e,t){if(e==null)return{};var n=pg(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 pg(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 mg=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=fg(e,[`color`,`size`]);return t.createElement(`svg`,dg({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`}))});mg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},mg.displayName=`RotateCcw`,r();function hg(){return hg=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},hg.apply(this,arguments)}function gg(e,t){if(e==null)return{};var n=_g(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function _g(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var vg=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=gg(e,[`color`,`size`]);return t.createElement(`svg`,hg({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`}))});vg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},vg.displayName=`Settings`,r();function yg(){return yg=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},yg.apply(this,arguments)}function bg(e,t){if(e==null)return{};var n=xg(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 xg(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=bg(e,[`color`,`size`]);return t.createElement(`svg`,yg({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`}))});Sg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Sg.displayName=`Volume1`,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 wg(e,t){if(e==null)return{};var n=Tg(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 Tg(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 Eg=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=wg(e,[`color`,`size`]);return t.createElement(`svg`,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:`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`}))});Eg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Eg.displayName=`Volume2`,r();function Dg(){return Dg=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},Dg.apply(this,arguments)}function Og(e,t){if(e==null)return{};var n=kg(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 kg(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 Ag=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Og(e,[`color`,`size`]);return t.createElement(`svg`,Dg({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`}))});Ag.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Ag.displayName=`VolumeX`;var jg=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 Mg=S(jg(),1),Ng=`react-tooltip-core-styles`,Pg=`react-tooltip-base-styles`,Fg={core:!1,base:!1};function Ig({css:e,id:t=Pg,type:n=`base`,ref:r}){if(!e||typeof document>`u`||Fg[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=Ng),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)),Fg[n]=!0}var Lg=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})))},Rg=(e,t)=>!(`CSS`in window&&`supports`in window.CSS)||window.CSS.supports(e,t),zg=(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},Bg=e=>e!==null&&!Array.isArray(e)&&typeof e==`object`,Vg=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every(((e,n)=>Vg(e,t[n])));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Bg(e)||!Bg(t))return e===t;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every((n=>Vg(e[n],t[n])))},Hg=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`}))},Ug=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(Hg(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},Wg=typeof window<`u`?n:m,Gg=e=>{e.current&&=(clearTimeout(e.current),null)},Kg=`DEFAULT_TOOLTIP_ID`,qg={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},Jg=N({getTooltipData:()=>qg});function Yg(t=Kg){return e(Jg).getTooltipData(t)}var Xg={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`},Zg={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`},Qg=({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 z=o(null),pe=o(null),me=o(null),he=o(null),ge=o(null),[_e,ve]=h({tooltipStyles:{},tooltipArrowStyles:{},place:u}),[ye,B]=h(!1),[V,H]=h(!1),[U,be]=h(null),xe=o(!1),Se=o(null),{anchorRefs:Ce,setActiveAnchor:we}=Yg(n),Te=o(!1),[Ee,De]=h([]),Oe=o(!1),ke=g||f.includes(`click`),Ae=ke||k?.click||k?.dblclick||k?.mousedown,je=k?{...k}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!k&&ke&&Object.assign(je,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});let Me=A?{...A}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!A&&ke&&Object.assign(Me,{mouseleave:!1,blur:!1,mouseout:!1});let Ne=j?{...j}:{escape:E||!1,scroll:D||!1,resize:O||!1,clickOutsideAnchor:Ae||!1};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})),Wg((()=>(Oe.current=!0,()=>{Oe.current=!1})),[]);let Pe=e=>{Oe.current&&(e&&H(!0),setTimeout((()=>{Oe.current&&(ae?.(e),re===void 0&&B(e))}),10))};m((()=>{if(n){if(ye){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,ye,n,oe]),m((()=>{if(re===void 0)return()=>null;re&&H(!0);let e=setTimeout((()=>{B(re)}),10);return()=>{clearTimeout(e)}}),[re]),m((()=>{if(ye!==xe.current){if(Gg(ge),xe.current=ye,ye)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`));ge.current=setTimeout((()=>{H(!1),be(null),I?.()}),e+25)}}}),[ye]);let Fe=e=>{ve((t=>Vg(t,e)?t:e))},Ie=(e=b)=>{Gg(me),V?Pe(!0):me.current=setTimeout((()=>{Pe(!0)}),e)},Le=(e=x)=>{Gg(he),he.current=setTimeout((()=>{Te.current||Pe(!1)}),e)},Re=e=>{if(!e)return;let t=e.currentTarget??e.target;if(!t?.isConnected)return se(null),void we({current:null});b?Ie():Pe(!0),se(t),we({current:t}),Gg(he)},ze=()=>{T?Le(x||100):x?Le():Pe(!1),Gg(me)},Be=({x:e,y:t})=>{Lg({place:U?.place??u,offset:d,elementReference:{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})},tooltipReference:z.current,tooltipArrowReference:pe.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),Se.current=n},He=e=>{if(!ye)return;let t=e.target;t.isConnected&&(z.current?.contains(t)||[document.querySelector(`[id='${c}']`),...Ee].some((e=>e?.contains(t)))||(Pe(!1),Gg(me)))},Ue=zg(Re,50,!0),We=zg(ze,50,!0),Ge=e=>{We.cancel(),Ue(e)},Ke=()=>{Ue.cancel(),We()},qe=p((()=>{let e=U?.position??P;e?Be(e):S?Se.current&&Be(Se.current):R!=null&&R.isConnected&&Lg({place:U?.place??u,offset:d,elementReference:R,tooltipReference:z.current,tooltipArrowReference:pe.current,strategy:_,middlewares:v,border:ce,arrowSize:de}).then((e=>{Oe.current&&Fe(e)}))}),[ye,R,te,N,u,U?.place,d,_,P,U?.position,S,de]);m((()=>{var e,t;let n=new Set(Ce);Ee.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=Ug(R),o=Ug(z.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&&z.current&&(s=ee(R,z.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=>{ye&&d(e)||Re(e)},p=e=>{ye&&d(e)&&ze()},m=[`mouseover`,`mouseout`,`mouseenter`,`mouseleave`,`focus`,`blur`],h=[`click`,`dblclick`,`mousedown`,`mouseup`];Object.entries(je).forEach((([e,t])=>{t&&(m.includes(e)?u.push({event:e,listener:Ge}):h.includes(e)&&u.push({event:e,listener:f}))})),Object.entries(Me).forEach((([e,t])=>{t&&(m.includes(e)?u.push({event:e,listener:Ke}):h.includes(e)&&u.push({event:e,listener:p}))})),S&&u.push({event:`pointermove`,listener:Ve});let g=()=>{Te.current=!0},_=()=>{Te.current=!1,ze()},v=T&&(Me.mouseout||Me.mouseleave);return v&&((e=z.current)==null||e.addEventListener(`mouseover`,g),(t=z.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=z.current)==null||e.removeEventListener(`mouseover`,g),(t=z.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,V,Ce,Ee,k,A,j,ke,b,x]),m((()=>{let e=U?.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)&&(H(!1),Pe(!1),se(null),Gg(me),Gg(he),!0)))}if(e)try{let n=[...t.addedNodes].filter((e=>e.nodeType===1));r.push(...n.filter((t=>t.matches(e)))),r.push(...n.flatMap((t=>[...t.querySelectorAll(e)])))}catch{}}})),(r.length||i.length)&&De((e=>[...e.filter((e=>!i.includes(e))),...r]))}));return t.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-tooltip-id`],attributeOldValue:!0}),()=>{t.disconnect()}}),[n,l,U?.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=[...Ee,e];R&&t.includes(R)||se(Ee[0]??e)}),[c,Ee,R]),m((()=>(ie&&Pe(!0),()=>{Gg(me),Gg(he)})),[]),m((()=>{let e=U?.anchorSelect??l;if(!e&&n&&(e=`[data-tooltip-id='${n.replace(/'/g,`\\'`)}']`),e)try{let t=Array.from(document.querySelectorAll(e));De(t)}catch{De([])}}),[n,l,U?.anchorSelect]),m((()=>{me.current&&(Gg(me),Ie(b))}),[b]);let W=U?.content??te,Je=ye&&Object.keys(_e.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}be(e??null),e?.delay?Ie(e.delay):Pe(!0)},close:e=>{e?.delay?Le(e.delay):Pe(!1)},activeAnchor:R,place:_e.place,isOpen:!!(V&&!C&&W&&Je)}))),V&&!C&&W?t.createElement(y,{id:n,role:fe,className:(0,Mg.default)(`react-tooltip`,Xg.tooltip,Zg.tooltip,Zg[s],r,`react-tooltip__place-${_e.place}`,Xg[Je?`show`:`closing`],Je?`react-tooltip__show`:`react-tooltip__closing`,_===`fixed`&&Xg.fixed,T&&Xg.clickable),onTransitionEnd:e=>{Gg(ge),ye||e.propertyName!==`opacity`||(H(!1),be(null),I?.())},style:{...N,..._e.tooltipStyles,opacity:le!==void 0&&Je?le:void 0},ref:z},t.createElement(y,{className:(0,Mg.default)(`react-tooltip-content-wrapper`,Xg.content,Zg.content)},W),t.createElement(y,{className:(0,Mg.default)(`react-tooltip-arrow`,Xg.arrow,Zg.arrow,i,w&&Xg.noArrow),style:{..._e.tooltipArrowStyles,background:ue?`linear-gradient(to right bottom, transparent 50%, ${ue} 50%)`:void 0,"--rt-arrow-size":`${de}px`},ref:pe})):null},$g=({content:e})=>t.createElement(`span`,{dangerouslySetInnerHTML:{__html:e}}),e_=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,z]=h(a),[pe,me]=h(d),[he,ge]=h(u),[_e,ve]=h(f),[ye,B]=h(x),[V,H]=h(S),[U,be]=h(C),[xe,Se]=h(w),[Ce,we]=h(p),[Te,Ee]=h(_),[De,Oe]=h(y),[ke,Ae]=h(null),[je,Me]=h(null),Ne=o(null),Pe=o(L),{anchorRefs:Fe,activeAnchor:Ie}=Yg(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=>{me(e??d)},content:e=>{de(e??i)},html:e=>{z(e??a)},variant:e=>{ge(e??u)},offset:e=>{ve(e===null?f:Number(e))},wrapper:e=>{we(e??p)},events:e=>{let t=e?.split(` `);Ee(t??_)},"position-strategy":e=>{Oe(e??y)},"delay-show":e=>{B(e===null?x:Number(e))},"delay-hide":e=>{H(e===null?S:Number(e))},float:e=>{be(e===null?C:e===`true`)},hidden:e=>{Se(e===null?w:e===`true`)},"class-name":e=>{Ae(e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,n])=>{var r;(r=t[e])==null||r.call(t,n)}))};m((()=>{de(i)}),[i]),m((()=>{z(a)}),[a]),m((()=>{me(d)}),[d]),m((()=>{ge(u)}),[u]),m((()=>{ve(f)}),[f]),m((()=>{B(x)}),[x]),m((()=>{H(S)}),[S]),m((()=>{be(C)}),[C]),m((()=>{Se(w)}),[w]),m((()=>{Oe(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&&!Rg(`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&&!Rg(`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($g,{content:fe}));let Ve={forwardRef:le,id:e,anchorId:n,anchorSelect:r,className:(0,Mg.default)(c,ke),classNameArrow:l,content:ze,contentWrapperRef:Be,place:pe,variant:he,offset:_e,wrapper:Ce,events:Te,openOnClick:v,positionStrategy:De,middlewares:b,delayShow:ye,delayHide:V,float:U,hidden:xe,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(Qg,{...Ve})}));typeof window<`u`&&window.addEventListener(`react-tooltip-inject-styles`,(e=>{e.detail.disableCore||Ig({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||Ig({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 t_={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:()=>{}},n_=Fc({name:`source`,state:()=>({...t_}),attach({set:e}){e({setSourceState:t=>e(t),setHideUI:t=>e({hideUI:t})})}}),r_=Md({features:[...Lu,n_],displayName:`MediaPlayer`}),Q=r_.usePlayer,i_=e=>{if(e&&e!==`und`)try{return new Intl.DisplayNames([navigator.language||`en`],{type:`language`,fallback:`none`}).of(e)||void 0}catch{return}},a_=e=>e?.replace(/_/g,` `).trim()||void 0,o_=e=>{let t=e.map(e=>i_(e.language)??a_(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=a_(e.title);return{track:e,label:(n[i]??0)>1&&a&&a!==i?`${i} (${a})`:i}})},s_=e=>o_(e).map(({track:e,label:t})=>({id:e.streamIndex,label:t})),c_=[0,250,1e3,3e3,1e4],l_=6e4,u_=500,d_=e=>e instanceof Error?e.message:String(e),f_=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(d_(n)),n=n?.cause}return t.length?t.join(`
5
- `):void 0},p_=(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=u_}=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=d_(t),o=f_(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=fo(e);if(o(e,t),t){let t=performance.now();t-C.current.at>l_&&(C.current={count:0,at:t});let n=c_[Math.min(C.current.count,c_.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 Do({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:s_(e),...D.current?{}:{selectedSubtitleTrack:e[0]?.streamIndex}})},onAudioStreams:(e,t)=>{n||r.setSourceState({audioTracks:s_(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])},m_=5e3,h_=6e4,g_=({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=m_,f=()=>{Po({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,h_))})};return f(),()=>{i=!0,clearTimeout(o),c.current=null,a?.destroy(),s([])}},[n,e,t]),m(()=>{c.current?.update(u)},[u]),a},__=(e,t)=>{let n=o(null),[r,i]=h(!1),[a]=h(()=>Ho());m(()=>{if(!e||!t||!a)return;let r=Uo({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}},v_={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
- `}},y_=D`
138
- top: unset !important;
139
- left: unset !important;
140
- width: 100%;
141
- height: 100%;
142
- margin: auto;
143
- pointer-events: none;
144
- `,b_=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
- ${v_.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
- `,x_=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
- `,S_=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
- ${v_.bLarge.regular}
201
- text-shadow: 0 0 4px rgba(0, 0, 0, 1);
202
- pointer-events: none;
203
- `,C_=e=>e instanceof Error?e.message:typeof e==`string`?e:`Playback failed`,w_=({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:b_,style:{...n?{opacity:`0`,pointerEvents:`none`}:{}},children:t}):void 0,(a?!i:o)&&!r?F(`div`,{css:x_}):void 0,r?F(`div`,{css:S_,children:C_(r)}):void 0,F(`canvas`,{ref:e,css:y_})]})},T_=1e-4,E_=1,D_=e=>Math.max(T_,Math.min(E_,e))**2,O_=e=>Math.max(T_,Math.min(E_,e))**(E_/2),k_=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}`},A_=(e,t)=>`${k_(e)} / ${k_(t)}`,j_=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
- ${v_.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
- `,M_={x:-1,y:-1,anchors:0},N_=e=>{M_.x=e.clientX,M_.y=e.clientY},P_=()=>(M_.anchors++===0&&window.addEventListener(`pointermove`,N_,{capture:!0,passive:!0}),()=>{--M_.anchors===0&&window.removeEventListener(`pointermove`,N_,{capture:!0})}),F_=({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=P_(),t=()=>{let e=u.current;if(!e)return;let{left:t,right:n,top:r,bottom:i}=e.getBoundingClientRect();M_.x>=t&&M_.x<n&&M_.y>=r&&M_.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(e_,{ref:d,css:j_(l),id:e,noArrow:!0,children:t})]})},I_=({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`}}}},L_=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
- ${v_.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
- `,R_=4,z_=()=>{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}=I_({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>R_&&(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:L_,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})]})},B_=`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`,V_={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`},H_=e=>y(`svg`,{...V_,...e,children:[F(`rect`,{x:`3`,y:`5`,width:`18`,height:`14`,rx:`2`,ry:`2`}),F(`path`,{d:`M7 15h4m4 0h2M7 11h2m4 0h4`})]}),U_=e=>y(`svg`,{...V_,...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`})]}),W_=e=>y(`svg`,{...V_,...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`})]}),G_=e=>y(`svg`,{...V_,...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`})]}),K_=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
- ${v_.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
- ${v_.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
- ${v_.bSmall.regular}
543
- }
544
- }
545
- `,q_=({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(Bh,{}):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`))]})},J_=({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)})}}},Y_=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
- ${K_}
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
- ${v_.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
- ${v_.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
- ${v_.bSmall.regular}
630
- }
631
- }
632
- }
633
- `,X_=e=>new Date(e).toLocaleTimeString(),Z_=e=>e===void 0||!Number.isFinite(e)?void 0:k_(Math.max(0,e)),Q_=e=>e.reduce((e,t)=>e+t.count,0),$_=e=>e.map((e,t)=>{let n=Z_(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
- `),ev=()=>{let e=Q(e=>e.playbackErrors),{open:t,toggle:n,containerRef:r}=J_(),[i,a]=h(!1);if(e.length===0)return null;let o=()=>{navigator.clipboard?.writeText($_(e)).then(()=>{a(!0),setTimeout(()=>a(!1),2e3)},e=>console.warn(`[media-player] could not copy the errors:`,e))},s=`Playback errors (${Q_(e)})`;return y(`div`,{css:Y_,ref:r,children:[F(F_,{id:`errors`,disabled:t,text:F(`button`,{className:`errors`,type:`button`,onClick:n,"aria-label":s,"aria-expanded":t,children:F(Mh,{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?Ih:Jh,{}),F(`span`,{children:i?`Copied`:`Copy`})]})]}),e.map((e,t)=>y(`div`,{className:`entry no-hover`,children:[y(`span`,{className:`when`,children:[X_(e.at),e.count>1?` to ${X_(e.lastAt)}`:``,Z_(e.atMediaTime)?` at ${Z_(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}`))]})]})},tv=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
- `,nv=()=>{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}=I_({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:tv,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}%`}})})})]})},rv=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
- ${K_}
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
- `,iv=()=>{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}=J_({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:rv,ref:l,children:[F(F_,{id:`settings`,disabled:s,text:F(`button`,{className:`settings`,type:`button`,onClick:c,"aria-label":`Settings`,"aria-expanded":s,children:F(vg,{})}),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(Wh,{})})]}):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(Wh,{})]})]})]}),s&&a===1&&y(`div`,{className:`popover playback-rate`,children:[y(`div`,{className:`back`,onClick:g(0),children:[F(Bh,{}),F(`span`,{children:`Playback speed`})]}),F(`div`,{className:`slider no-hover`,children:F(nv,{})}),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(q_,{title:`Audio`,tracks:n,selected:r,onSelect:m,onBack:g(0),pending:u,failed:d})]})},av=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
- ${K_}
768
- `,ov=()=>{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}=J_();if(e.length===0)return null;let u=t!==void 0;return y(`div`,{css:av,ref:o,children:[F(F_,{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(H_,{className:`captions`}):F(U_,{className:`captions-off`})}),toolTipText:F(`span`,{children:`Subtitles`})}),i&&F(q_,{title:`Subtitles`,tracks:e,selected:t,onSelect:e=>l(e??null,()=>n(e)),offLabel:r??`Disable`,pending:s,failed:c})]})},sv={primary:`#EAEBEE`,secondary:`#D0D0D9`,hover:`rgba(255, 255, 255, 0.13)`,borderPrimary:`#384F70`,backgroundTooltip:`#222222`},cv=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
- `,lv=({value:e,onChange:t})=>{let n=Q(e=>e.volume),r=Q(e=>e.muted),i=o(null),a=o(null),{handlers:s}=I_({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:O_(n)*100),[n,r]);return F(F_,{id:`volume-slider`,text:F(`div`,{ref:i,css:cv,...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,`%`]})})},uv=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
- ${v_.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
- `,dv=({ref:e})=>{let t=Q(),n=Q(e=>e.volume),r=Q(e=>e.muted),i=b(()=>O_(n),[n]);return y(`div`,{css:uv,children:[F(F_,{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?Ag:n<=.5?Sg:Eg,{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(lv,{value:r?0:i,onChange:e=>{t.setVolume(D_(e))}})})})]})},fv=.05,pv=5,mv=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
- `,hv=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: ${sv.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
- ${v_.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
- `,gv=()=>{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=O_(e.volume),i=t===`up`?n:-n,a=Math.max(0,Math.min(1,r+i)),o=e.muted;e.setVolume(D_(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:fv});else if(n.key===`ArrowDown`)b({direction:`down`,stepSize:fv});else if(n.key===`ArrowRight`){if(!e.duration)return;t(Math.min(e.currentTime+pv,e.duration))}else n.key===`ArrowLeft`?t(Math.max(e.currentTime-pv,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:fv}):b({direction:`down`,stepSize:fv})},[b]);return m(()=>{if(d)return d.addEventListener(`wheel`,x,{passive:!1}),()=>d.removeEventListener(`wheel`,x)},[d,x]),y(`div`,{css:hv,style:{...a?{opacity:`0`,pointerEvents:`none`}:{}},children:[F(z_,{}),y(`div`,{className:`actions`,children:[y(`div`,{className:`left`,children:[F(F_,{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?mg:t?ug:og,{})}),toolTipText:F(`span`,{children:v?`Replay (k)`:t?`Play (k)`:`Pause (k)`})}),F(dv,{ref:f}),F(`div`,{className:`time`,children:A_(n,r)})]}),y(`div`,{className:`right`,children:[F(ev,{}),F(ov,{}),F(iv,{}),o?F(F_,{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?W_:G_,{}):F(`img`,{src:B_,alt:``})}),toolTipText:y(`span`,{css:mv,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(F_,{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?ng:Qh,{})}),toolTipText:F(`span`,{children:i?`Exit full screen (f)`:`Full screen (f)`})})]})]})]})},_v=9e3,vv=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
- ${v_.bMedium.bold}
1053
- color: #fff;
1054
- }
1055
-
1056
- .body {
1057
- ${v_.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
- `,yv=()=>{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),_v);return()=>clearTimeout(n)},[t,e]),t!==`burn-in`||!e?null:F(`div`,{css:vv,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:`→`})]})})},bv=3e3,xv=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
- `,Sv=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
- `,Cv=(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?Cv(e.props.children,`${r}/`):[{key:r,item:e}]}),wv=({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(_,bv);return}l(!0)},v=()=>{l(!1),clearTimeout(u.current),u.current=setTimeout(_,bv)};return y(`div`,{css:Sv,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(w_,{onCanvasRef:n}),Cv(r).map(({key:e,item:t})=>F(`div`,{css:xv,style:{...c?{opacity:`0`,visibility:`hidden`,pointerEvents:`none`}:{}},children:t},e)),i===!1?null:F(gv,{}),F(yv,{}),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]})]})},Tv=({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=mc(),g=hc(),[_,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]),p_(_,y,r);let O=g_({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}=__(_,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(wv,{ref:g,onVideoRef:n?void 0:v,onCanvasRef:b,overlay:e.overlay,controls:e.controls,children:t})},Ev=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
- `,Dv=e=>F(`div`,{css:Ev,children:F(r_.Provider,{children:F(Tv,{options:e,children:e.children})})}),Ov=({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`})),kv=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}))},Av=({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}))},jv=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}))},Mv=`[data-testid="track-selection-button"]`,Nv=`[data-testid="audio-text-track-menu"]`,Pv=`.timeline-slider`,Fv=`[role="menu"]`,Iv=`[role="menuitemradio"]`,Lv=1e4,Rv=2e4,zv=5e3,Bv=100,Vv={menu:Nv,section:Fv,option:Iv},Hv=/^(off|none|disabled)$/i,Uv=e=>new Promise(t=>setTimeout(t,e)),Wv=()=>!1,Gv=e=>{if(e())throw Error(`Crunchyroll track operation cancelled`)},Kv=e=>e===`audio`?0:1,qv=e=>e.replace(/\s+/g,` `).trim(),Jv=(e,t)=>{let n=[...new Map(t.map(e=>({...e,label:qv(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=>Hv.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}:{}}},Yv=async(e,t)=>{Gv(t);let n=e.locator(Nv);if(await n.exists({timeout:1e3})){Gv(t);return}Gv(t),await e.evaluate(kv,{button:Mv,timeout:Lv});let r=Date.now()+Lv;for(;Date.now()<r;){if(Gv(t),await n.exists({timeout:1e3}))return;await Uv(Bv)}throw Error(`Crunchyroll track menu did not open`)},Xv=async(e,t,n)=>{Gv(n);let r=await e.evaluate(Ov,{...Vv,sectionIndex:Kv(t)});Gv(n);let i=r.map((e,t)=>({...e,label:qv(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}`}})},Zv=async(e,t)=>{let[n,r]=await Promise.all([Xv(e,`audio`,t),Xv(e,`subtitles`,t)]);return{audio:Jv(`audio`,n),subtitles:Jv(`subtitles`,r)}},Qv=async(e,t=Wv)=>(await Yv(e,t),Zv(e,t)),$v=async(e,t,n,r)=>(await Xv(e,t,r)).find(e=>n===null?Hv.test(e.label):e.id===n)?.index??-1,ey=async(e,t,n,r)=>{let i=Date.now()+Rv;for(;Date.now()<i;){Gv(r),await Yv(e,r);let i=(await Xv(e,t,r)).find(e=>e.selected);if(i&&(n===null?Hv.test(i.label):i.id===n))return;await Uv(Bv)}throw Error(`Crunchyroll did not apply the ${t} option`)},ty=(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))},ny=e=>({currentTime:e.currentTime,paused:e.paused,volume:e.volume,muted:e.muted,playbackRate:e.playbackRate}),ry=(e,t)=>e.evaluate(jv,{timeline:Pv,time:t,timeout:Rv}),iy=async(e,t,n)=>{let r=Date.now()+5e3;for(;Date.now()<r&&(Gv(n),!(e.currentSrc!==t||e.readyState<2));)await Uv(Bv);if(e.currentSrc===t&&e.readyState>=2)return!1;let i=Date.now()+Rv;for(;Date.now()<i;){if(Gv(n),e.readyState>=2)return!0;await Uv(Bv)}throw Error(`Crunchyroll playback did not become ready after changing tracks`)},ay=async(e,t,n,r)=>{Gv(r),t.volume=n.volume,t.muted=n.muted,t.playbackRate=n.playbackRate;let i=ty(n.currentTime,t.duration);Math.abs(t.currentTime-i)>2&&await ry(e,i);let a=Date.now()+Rv;for(;Date.now()<a&&(Math.abs(t.currentTime-i)>2||t.seeking||t.readyState<2);)Gv(r),await Uv(Bv);if(Math.abs(t.currentTime-i)>2||t.seeking||t.readyState<2)throw Error(`Crunchyroll playback position was not restored after changing tracks`);Gv(r),n.paused?t.pause():await t.play();let o=Date.now()+zv;for(;Date.now()<o&&t.paused!==n.paused;)Gv(r),await Uv(Bv);if(t.paused!==n.paused)throw Error(`Crunchyroll playback state was not restored after changing tracks`)},oy=async(e,t,n,r,i=Wv)=>{await Yv(e,i);let a=await $v(e,n,r,i);if(a<0)throw Error(`Crunchyroll ${n} option is no longer available`);Gv(i);let o=t.currentSrc,s=ny(t);return await e.evaluate(Av,{...Vv,sectionIndex:Kv(n),optionIndex:a}),await ey(e,n,r,i),await iy(t,o,i)&&await ay(e,t,s,i),Qv(e,i)},sy=(e,t)=>{ry(e,t).catch(e=>console.warn(`[cr] timeline seek failed:`,e))},cy=(e,t)=>new Proxy(e,{set(e,n,r,i){return n===`currentTime`&&typeof r==`number`&&Number.isFinite(r)&&sy(t,r),Reflect.set(e,n,r,i)}}),ly=({remote:e,frame:t,subtitles:n,audioTracks:r,thumbnails:i,children:a})=>{let o=b(()=>e&&t?cy(e,t):null,[e,t]);return F(Dv,{expose:!0,media:o,subtitles:n,audioTracks:r,thumbnails:i,children:a})},uy=class extends Error{name=`BifParseError`},dy=[137,66,73,70,13,10,26,10],fy=64,py=8,my=4294967295,hy=36e3,gy=e=>{if(e.byteLength<fy)throw new uy(`truncated header: ${e.byteLength} bytes`);let t=new DataView(e);if(dy.some((e,n)=>t.getUint8(n)!==e))throw new uy(`bad magic`);let n=t.getUint32(12,!0),r=t.getUint32(16,!0)||1e3;if(n>hy)throw new uy(`implausible frame count ${n}`);let i=fy+(n+1)*py;if(i>e.byteLength)throw new uy(`truncated index: ${n} frames need ${i} bytes, have ${e.byteLength}`);let a=e=>t.getUint32(fy+e*py,!0),o=e=>t.getUint32(fy+e*py+4,!0);if(a(n)!==my)throw new uy(`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 uy(`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 uy(`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},_y=(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]},vy=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)}}},yy={waitMs:1e4,fetchMs:15e3,maxBytes:31457280},by=e=>{let t=new Map,n=!1;return{at:r=>{if(n)return;let i=_y(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()}}},xy=async e=>{let t=await e.evaluate(vy,yy);if(`none`in t)throw Error(`no BIF: ${t.none}${t.detail?` (${t.detail})`:``}`);let n=gy(t.bytes);if(!n.length)throw Error(`no BIF: the file has no images`);return by(n)};l();var Sy=[`www.crunchyroll.com`,`crunchyroll.com`,`sso.crunchyroll.com`,`static.crunchyroll.com`],Cy=`
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
- `,wy=`https://sso.crunchyroll.com/authorize?${new URLSearchParams({client_id:`noaihdevm_6iyg0a8l0q`,redirect_uri:`https://www.crunchyroll.com/callback`,response_type:`cookie`,state:`/`})}`,Ty=async e=>{let[t,n]=await Promise.all([e.locator(`.cx-app`).exists(),e.locator(`#recaptcha-container`).exists()]);return t||n},Ey=3e4,Dy=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`),Oy=async(e,t)=>{let n=Date.now()+Ey;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`)},ky=3e4,Ay=async(e,t)=>{let n=Date.now()+ky;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},jy=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
- `,My=({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 Dy().then(t=>{e||n(t)}),()=>{e=!0}},[]),m(()=>{if(!r||t===`detecting`)return;let e=!1;return ae({iframe:r,domains:Sy,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 Oy(a,r);if(n)return;if(!t){l(!1),d(!0);return}if(await a.addStyleTag({content:Cy}),n)return;let i=await Ay(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:Cy}),n))return;let{isLoggedIn:i}=await Oy(a,r);if(n)return;if(!i){l(!1),d(!0);return}let o=await Ay(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,()=>Qv(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 xy(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,ue=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 oy(a,_,e,t,n);if(n())throw Error(`Crunchyroll track operation cancelled`);I(r)}catch(e){if(!n())try{let e=await Qv(a,n);n()||I(e)}catch{}throw e}})},[a,_,se,ce]),de=b(()=>P?.subtitles&&{selection:{...P.subtitles,select:e=>ue(`subtitles`,e)}},[P?.subtitles,ue]),fe=b(()=>P?.audio&&{selection:{...P.audio,select:e=>ue(`audio`,e)}},[P?.audio,ue]),z=p(()=>{if(A.current!==null)return;let e=globalThis.open(wy,`_blank`,`width=500,height=700`);if(!e){k(!0),l(!1);return}k(!1),E(!0),j.current=e;let t=setInterval(()=>{e.closed&&(clearInterval(t),A.current===t&&(A.current=null),j.current===e&&(j.current=null),E(!1),S(e=>e+1))},500);A.current=t},[]),pe=p(()=>{s(null),g(void 0),v(null),R(),d(!1),l(!0),w(e=>e+1)},[R]),me=p(()=>{if(N.current)return;N.current=!0;let e=le({url:wy,domains:Sy,isSignedIn:e=>e.locator(`#user-menu-authenticated`).exists(),onSignInPage:Ty});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`){pe();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)})},[pe]);m(()=>()=>{A.current!==null&&(clearInterval(A.current),A.current=null)},[]),m(()=>{A.current!==null&&(clearInterval(A.current),A.current=null,E(!1)),k(!1)},[e]);let he=p(()=>{j.current!==null&&(j.current.close(),j.current=null),A.current!==null&&(clearInterval(A.current),A.current=null),k(!1),E(!1),pe()},[pe]),ge=(c||f||D||u)&&y(`div`,{className:`overlay`,children:[u&&!f&&!D&&y(O,{children:[`You need to be logged in to Crunchyroll to watch this content.`,t===`extension`?F(`button`,{className:`login-button`,onClick:z,disabled:T,children:T?`Finish signing in the popup...`:`Open Crunchyroll Login Page`}):y(O,{children:[F(`button`,{className:`login-button`,onClick:me,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`?z:me,children:`Open Crunchyroll Login Page`})]}),f&&y(O,{children:[f,F(`button`,{className:`login-button`,onClick:he,children:`Retry`})]}),c&&!f&&!u&&`Loading Crunchyroll player...`]});return y(`div`,{css:jy,children:[t!==`detecting`&&F(ly,{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}`)}),ge]})},Ny=e=>e,Py=Ny(({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})),Fy=Ny(({className:e})=>F(Py,{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`})})),Iy=Ny(({className:e})=>y(Py,{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})]})),Ly=Ny(({className:e})=>y(Py,{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`})]})),Ry=Ny(({className:e})=>F(Py,{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`})})),zy=Ny(({className:e})=>F(Py,{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`})})),By=Ny(({className:e})=>F(Py,{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`})})),Vy=Ny(({className:e})=>y(Py,{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`})]})),Hy=Ny(({className:e})=>F(Py,{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`})})),Uy=Ny(({className:e})=>F(Py,{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`})})),Wy=Ny(({className:e})=>y(Py,{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`})]})),Gy=Ny(({className:e})=>y(Py,{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`})]})),Ky=Ny(({className:e})=>F(Py,{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`})})),qy=Ny(({className:e})=>y(Py,{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})]})),Jy=Ny(({className:e})=>F(Py,{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`})})]})})),Yy=Ny(({className:e})=>F(Py,{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`})})),Xy=Ny(({className:e})=>F(Py,{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`})})),Zy=Ny(({className:e})=>F(Py,{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 Qy=10,$=e=>e,$y=$(mm.Root),eb=$(sm),tb=$(Sm.Root),nb=$(om.Popup),rb=$(om.Title),ib=$(om.Close),ab=$(Sm.Description),ob=$(Sh.Provider),sb=$(Sh.Root),cb=$(Sh.Trigger),lb=$(Sh.Popup),ub=$(Um.Root),db=$(Um.Trigger),fb=$(Um.Popup),pb=$(Nm),mb=$(Wm),hb=$(jm),gb=$(Mm),_b=$(Cm),vb=$(Pm),yb=$(sh.Value),bb=$(uh.Root),xb=$(rh.Track),Sb=$(rh.Fill),Cb=$(rh.Buffer),wb=$(rh.Thumb),Tb=$(rh.Value),Eb=$(Th.Root),Db=$(km),Ob=$(Tm),kb=$(Ad),Ab=({className:e,...t})=>F(`button`,{type:`button`,className:`media-button media-button--subtle media-button--icon${e?` ${e}`:``}`,...t}),jb=({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(ub,{open:n,onOpenChange:e=>r(e),children:[F(db,{render:F(Ab,{className:`media-button--menu${o?` media-button--error`:``}`,"aria-label":e.label}),children:t}),F(fb,{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(Zy,{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__`)})]})})]})},Mb=()=>y(ub,{openOnHover:!0,delay:200,closeDelay:100,side:`top`,children:[F(db,{render:y(hb,{className:`media-button--mute`,render:F(Ab,{}),children:[F(zy,{className:`media-icon media-icon--volume-off`}),F(By,{className:`media-icon media-icon--volume-low`}),F(Vy,{className:`media-icon media-icon--volume-high`})]})}),F(fb,{className:`media-surface media-popover media-popover--volume`,children:y(Eb,{className:`media-slider`,orientation:`vertical`,thumbAlignment:`edge`,children:[F(xb,{className:`media-slider__track`,children:F(Sb,{className:`media-slider__fill`})}),F(wb,{className:`media-slider__thumb media-slider__thumb--persistent`})]})})]}),Nb=({capabilities:e,children:t,className:n,...r})=>y(kb,{className:`media-default-skin media-default-skin--video${n?` ${n}`:``}`,...r,children:[t,F(eb,{render:e=>F(`div`,{...e,className:`media-buffering-indicator`,children:F(`div`,{className:`media-surface`,children:F(Jy,{className:`media-icon`})})})}),F(tb,{children:F(nb,{className:`media-error`,children:y(`div`,{className:`media-error__dialog media-surface`,children:[y(`div`,{className:`media-error__content`,children:[F(rb,{className:`media-error__title`,children:`Something went wrong.`}),F(ab,{className:`media-error__description`})]}),F(`div`,{className:`media-error__actions`,children:F(ib,{className:`media-button media-button--primary`,children:`OK`})})]})})}),F($y,{className:`media-surface media-controls`,children:y(ob,{children:[y(`div`,{className:`media-button-group`,children:[y(sb,{side:`top`,children:[F(cb,{render:y(pb,{className:`media-button--play`,render:F(Ab,{}),children:[F(Ly,{className:`media-icon media-icon--restart`}),F(Fy,{className:`media-icon media-icon--play`}),F(Iy,{className:`media-icon media-icon--pause`})]})}),F(lb,{className:`media-surface media-tooltip`})]}),y(sb,{side:`top`,children:[F(cb,{render:F(mb,{seconds:-10,className:`media-button--seek`,render:F(Ab,{}),children:y(`span`,{className:`media-icon__container`,children:[F(Ry,{className:`media-icon media-icon--seek media-icon--flipped`}),F(`span`,{className:`media-icon__label`,children:Qy})]})})}),y(lb,{className:`media-surface media-tooltip`,children:[`Seek backward `,Qy,` seconds`]})]}),y(sb,{side:`top`,children:[F(cb,{render:F(mb,{seconds:Qy,className:`media-button--seek`,render:F(Ab,{}),children:y(`span`,{className:`media-icon__container`,children:[F(Ry,{className:`media-icon media-icon--seek`}),F(`span`,{className:`media-icon__label`,children:Qy})]})})}),y(lb,{className:`media-surface media-tooltip`,children:[`Seek forward `,Qy,` seconds`]})]})]}),y(`div`,{className:`media-time-controls`,children:[F(yb,{type:`current`,className:`media-time`}),y(bb,{className:`media-slider`,children:[y(xb,{className:`media-slider__track`,children:[F(Sb,{className:`media-slider__fill`}),F(Cb,{className:`media-slider__buffer`})]}),F(wb,{className:`media-slider__thumb`}),F(`div`,{className:`media-surface media-thumbnail media-slider__preview`,children:F(Tb,{type:`pointer`,className:`media-time media-thumbnail__time`})})]}),F(yb,{type:`duration`,className:`media-time`})]}),y(`div`,{className:`media-button-group`,children:[y(sb,{side:`top`,children:[F(cb,{render:F(vb,{className:`media-button--playback-rate`,render:F(Ab,{})})}),F(lb,{className:`media-surface media-tooltip`,children:`Toggle playback rate`})]}),F(Mb,{}),e?.subtitles&&F(jb,{selection:e.subtitles,icon:e.subtitles.selectedId?F(Ky,{className:`media-icon`}):F(qy,{className:`media-icon`})},`subtitles`),e?.audioTracks&&F(jb,{selection:e.audioTracks,icon:F(Yy,{className:`media-icon`})},`audio`),e?.qualityLevels&&F(jb,{selection:e.qualityLevels,icon:F(Xy,{className:`media-icon`})},`quality`),y(sb,{side:`top`,children:[F(cb,{render:y(gb,{className:`media-button--pip`,render:F(Ab,{}),children:[F(Wy,{className:`media-icon media-icon--pip-enter`}),F(Gy,{className:`media-icon media-icon--pip-exit`})]})}),F(lb,{className:`media-surface media-tooltip`})]}),y(sb,{side:`top`,children:[F(cb,{render:y(_b,{className:`media-button--fullscreen`,render:F(Ab,{}),children:[F(Hy,{className:`media-icon media-icon--fullscreen-enter`}),F(Uy,{className:`media-icon media-icon--fullscreen-exit`})]})}),F(lb,{className:`media-surface media-tooltip`})]})]})]})}),F(`div`,{className:`media-overlay`}),F(Db,{keys:`Space`,action:`togglePaused`}),F(Db,{keys:`k`,action:`togglePaused`}),F(Db,{keys:`m`,action:`toggleMuted`}),F(Db,{keys:`f`,action:`toggleFullscreen`}),F(Db,{keys:`i`,action:`togglePictureInPicture`}),F(Db,{keys:`ArrowRight`,action:`seekStep`,value:5}),F(Db,{keys:`ArrowLeft`,action:`seekStep`,value:-5}),F(Db,{keys:`l`,action:`seekStep`,value:10}),F(Db,{keys:`j`,action:`seekStep`,value:-10}),F(Db,{keys:`ArrowUp`,action:`volumeStep`,value:.05}),F(Db,{keys:`ArrowDown`,action:`volumeStep`,value:-.05}),F(Db,{keys:`0-9`,action:`seekToPercent`}),F(Db,{keys:`Home`,action:`seekToPercent`,value:0}),F(Db,{keys:`End`,action:`seekToPercent`,value:100}),F(Db,{keys:`>`,action:`speedUp`}),F(Db,{keys:`<`,action:`speedDown`}),F(Ob,{type:`tap`,action:`togglePaused`,pointer:`mouse`,region:`center`}),F(Ob,{type:`tap`,action:`toggleControls`,pointer:`touch`}),F(Ob,{type:`doubletap`,action:`seekStep`,value:-10,region:`left`}),F(Ob,{type:`doubletap`,action:`toggleFullscreen`,region:`center`}),F(Ob,{type:`doubletap`,action:`seekStep`,value:10,region:`right`})]});l();var{Provider:Pb}=Md({features:Lu}),Fb=e=>`media`in e?e:{media:e},Ib=({remote:e,frame:t,adapter:n})=>{let r=mc();return m(()=>{if(!r||!e||!t)return;let i=n?n(e,t):e;if(!i)return;let a=Fb(i);r(a.media);let o=oe(a.media);return()=>{o(),r(null),a.dispose?.()}},[e,t,n,r]),null},Lb=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
- `,Rb=({remote:e,frame:t,adapter:n,capabilities:r,children:i})=>y(Pb,{children:[F(Ib,{remote:e,frame:t,adapter:n}),F(Nb,{capabilities:r,css:Lb,children:i})]}),zb=`[data-uia="timeline"]`,Bb=`[data-uia="video-canvas"]`,Vb=`[data-uia="player"]`,Hb=`Seeks the video to the point you pick on the timeline.`,Ub=`Reveals the player controls so the timeline can be used.`,Wb=140,Gb=2,Kb=12e3,qb=26,Jb=110,Yb={"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"]`},Xb=e=>new Promise(t=>setTimeout(t,e)),Zb=e=>e<0?0:e>1?1:e,Qb=0,$b=()=>{let e=Qb*1.1;return Qb++,{x:.5+Math.cos(e)*.05,y:.5+Math.sin(e)*.05}},ex=(e,t)=>{let n=null,r,i,a=!1,o=async()=>{if(!a){a=!0;try{await Promise.all([t.locator(Bb).ensure(`hover`,{reason:Ub}),t.locator(Vb).ensure(`hover`,{reason:Ub}),t.locator(zb).ensure(`click`,{reason:Hb})])}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)<Gb&&(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=Zb(n/r);o();let a=t.locator(zb),s=e.paused===!0;if(s)try{await e.play()}catch{}let c=!1;for(let e=0;e<qb;e++){if(e%2==0&&(await t.locator(Bb).hover({position:$b(),reason:Ub}).catch(()=>{}),await t.locator(Vb).hover({position:$b(),reason:Ub}).catch(()=>{})),await a.exists().catch(()=>!1)){c=!0;break}await Xb(Jb)}if(!c){let n=await Promise.all(Object.entries(Yb).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:Hb}).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))},Wb),i&&clearTimeout(i),i=setTimeout(()=>{n=null},Kb),!0):Reflect.set(e,t,a,o)}}),dispose:()=>{e.removeEventListener(`timeupdate`,s),r&&clearTimeout(r),i&&clearTimeout(i)}}},tx=({remote:e,frame:t,capabilities:n,children:r})=>F(Rb,{remote:e,frame:t,adapter:ex,capabilities:n,children:r});l();var nx=[`netflix.com`,`www.netflix.com`,`nflxvideo.net`,`nflxso.net`,`nflxext.com`,`nflximg.net`,`assets.nflxext.com`],rx=`https://www.netflix.com/login`,ix=`
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
- `,ax=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`)},ox=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},sx=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},cx=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
- `,lx={cr:My,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:nx});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 ax(()=>r.addStyleTag({content:ix})),t)return;o(!1);let i=await ox(r);if(t)return;if(!i){c(!0);return}let a=await sx(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(rx,`_blank`,`width=500,height=700`);if(!e)return;let t=setInterval(()=>{e.closed&&(clearInterval(t),_(e=>e+1))},500)},[]);return y(`div`,{css:cx,children:[F(tx,{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...`]})]})}},ux=e=>lx[e],dx=new URLSearchParams(globalThis.location.search),fx=dx.get(`mediaUri`),px=dx.get(`episodeUri`),mx=dx.get(`sourceUri`),hx=dx.get(`url`),gx=mx?T(mx).origin:void 0,_x=gx?ux(gx):void 0;A(F(()=>!fx||!px||!mx||!hx||!_x?F(`div`,{children:`Unsupported or missing parameters`}):F(_x,{url:hx,mediaUri:fx,episodeUri:px,sourceUri:mx}),{}),document.getElementById(`app`));