@banou/stub 0.0.46 → 0.0.48

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,1609 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./remote-BwnfCi4M.js","./remote-CAlKhZLk.js","./build-mcPaLDi_.js"])))=>i.map(i=>d[i]);
2
- import{$ as e,B as t,I as n,J as r,K as i,L as a,Q as o,S as s,U as c,V as l,X as u,Z as d,_ as f,_t as p,a as m,at as h,b as g,ct as _,dt as v,et as y,g as b,h as x,i as S,it as C,l as w,lt as T,m as E,nt as D,ot as O,pt as k,q as A,r as ee,rt as j,st as M,t as N,tt as P,ut as te,v as F,w as I,x as ne,y as L,z as R}from"./embed-title-glP3xA0i.js";import{_ as re,a as ie,d as ae,i as z,l as oe,n as se,r as ce,t as le,u as ue}from"./login-window-Ceh8mJXR.js";import{n as de}from"./remote-CAlKhZLk.js";te(),j();var B={};(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 B},set exports(e){B=e}});var fe=B,pe=class extends Error{constructor(e){super(e),this.name=`TimeoutError`}},me=class extends Error{constructor(e){super(),this.name=`AbortError`,this.message=e}},he=e=>globalThis.DOMException===void 0?new me(e):new DOMException(e),ge=e=>{let t=e.reason===void 0?he(`This operation was aborted.`):e.reason;return t instanceof Error?t:he(t)};function _e(e,t,n,r){let i,a=new Promise((a,o)=>{if(typeof t!=`number`||Math.sign(t)!==1)throw TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(t===1/0){a(e);return}if(r={customTimers:{setTimeout,clearTimeout},...r},r.signal){let{signal:e}=r;e.aborted&&o(ge(e)),e.addEventListener(`abort`,()=>{o(ge(e))})}i=r.customTimers.setTimeout.call(void 0,()=>{if(typeof n==`function`){try{a(n())}catch(e){o(e)}return}let r=typeof n==`string`?n:`Promise timed out after ${t} milliseconds`,i=n instanceof Error?n:new pe(r);typeof e.cancel==`function`&&e.cancel(),o(i)},t),(async()=>{try{a(await e)}catch(e){o(e)}finally{r.customTimers.clearTimeout.call(void 0,i)}})()});return a.clear=()=>{clearTimeout(i),i=void 0},a}function ve(e,t,n){let r=0,i=e.length;for(;i>0;){let a=Math.trunc(i/2),o=r+a;n(e[o],t)<=0?(r=++o,i-=a+1):i=a}return r}var ye=function(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)},V,be=class{constructor(){V.set(this,[])}enqueue(e,t){t={priority:0,...t};let n={priority:t.priority,run:e};if(this.size&&ye(this,V,`f`)[this.size-1].priority>=t.priority){ye(this,V,`f`).push(n);return}let r=ve(ye(this,V,`f`),n,(e,t)=>t.priority-e.priority);ye(this,V,`f`).splice(r,0,n)}dequeue(){return ye(this,V,`f`).shift()?.run}filter(e){return ye(this,V,`f`).filter(t=>t.priority===e.priority).map(e=>e.run)}get size(){return ye(this,V,`f`).length}};V=new WeakMap;var H=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},U=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)},W,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,We,Ge,Ke=new pe,qe=class extends Error{},Je=class extends fe{constructor(e){if(super(),W.add(this),xe.set(this,void 0),Se.set(this,void 0),Ce.set(this,0),we.set(this,void 0),Te.set(this,void 0),Ee.set(this,0),De.set(this,void 0),Oe.set(this,void 0),ke.set(this,void 0),Ae.set(this,void 0),je.set(this,0),Me.set(this,void 0),Ne.set(this,void 0),Pe.set(this,void 0),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e={carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:be,...e},!(typeof e.intervalCap==`number`&&e.intervalCap>=1))throw TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??``}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??``}\` (${typeof e.interval})`);H(this,xe,e.carryoverConcurrencyCount,`f`),H(this,Se,e.intervalCap===1/0||e.interval===0,`f`),H(this,we,e.intervalCap,`f`),H(this,Te,e.interval,`f`),H(this,ke,new e.queueClass,`f`),H(this,Ae,e.queueClass,`f`),this.concurrency=e.concurrency,this.timeout=e.timeout,H(this,Pe,e.throwOnTimeout===!0,`f`),H(this,Ne,e.autoStart===!1,`f`)}get concurrency(){return U(this,Me,`f`)}set concurrency(e){if(!(typeof e==`number`&&e>=1))throw TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);H(this,Me,e,`f`),U(this,W,`m`,We).call(this)}async add(e,t={}){return new Promise((n,r)=>{U(this,ke,`f`).enqueue(async()=>{var i,a;H(this,je,(i=U(this,je,`f`),i++,i),`f`),H(this,Ce,(a=U(this,Ce,`f`),a++,a),`f`);try{if(t.signal?.aborted){r(new qe(`The task was aborted.`));return}let i=await(this.timeout===void 0&&t.timeout===void 0?e({signal:t.signal}):_e(Promise.resolve(e({signal:t.signal})),t.timeout===void 0?this.timeout:t.timeout,()=>{(t.throwOnTimeout===void 0?U(this,Pe,`f`):t.throwOnTimeout)&&r(Ke)}));n(i),this.emit(`completed`,i)}catch(e){r(e),this.emit(`error`,e)}U(this,W,`m`,Le).call(this)},t),U(this,W,`m`,Ve).call(this),this.emit(`add`)})}async addAll(e,t){return Promise.all(e.map(async e=>this.add(e,t)))}start(){return U(this,Ne,`f`)?(H(this,Ne,!1,`f`),U(this,W,`m`,We).call(this),this):this}pause(){H(this,Ne,!0,`f`)}clear(){H(this,ke,new(U(this,Ae,`f`)),`f`)}async onEmpty(){U(this,ke,`f`).size!==0&&await U(this,W,`m`,Ge).call(this,`empty`)}async onSizeLessThan(e){U(this,ke,`f`).size<e||await U(this,W,`m`,Ge).call(this,`next`,()=>U(this,ke,`f`).size<e)}async onIdle(){(U(this,je,`f`)!==0||U(this,ke,`f`).size!==0)&&await U(this,W,`m`,Ge).call(this,`idle`)}get size(){return U(this,ke,`f`).size}sizeBy(e){return U(this,ke,`f`).filter(e).length}get pending(){return U(this,je,`f`)}get isPaused(){return U(this,Ne,`f`)}};xe=new WeakMap,Se=new WeakMap,Ce=new WeakMap,we=new WeakMap,Te=new WeakMap,Ee=new WeakMap,De=new WeakMap,Oe=new WeakMap,ke=new WeakMap,Ae=new WeakMap,je=new WeakMap,Me=new WeakMap,Ne=new WeakMap,Pe=new WeakMap,W=new WeakSet,Fe=function(){return U(this,Se,`f`)||U(this,Ce,`f`)<U(this,we,`f`)},Ie=function(){return U(this,je,`f`)<U(this,Me,`f`)},Le=function(){var e;H(this,je,(e=U(this,je,`f`),e--,e),`f`),U(this,W,`m`,Ve).call(this),this.emit(`next`)},Re=function(){this.emit(`empty`),U(this,je,`f`)===0&&this.emit(`idle`)},ze=function(){U(this,W,`m`,Ue).call(this),U(this,W,`m`,He).call(this),H(this,Oe,void 0,`f`)},Be=function(){let e=Date.now();if(U(this,De,`f`)===void 0){let t=U(this,Ee,`f`)-e;if(t<0)H(this,Ce,U(this,xe,`f`)?U(this,je,`f`):0,`f`);else return U(this,Oe,`f`)===void 0&&H(this,Oe,setTimeout(()=>{U(this,W,`m`,ze).call(this)},t),`f`),!0}return!1},Ve=function(){if(U(this,ke,`f`).size===0)return U(this,De,`f`)&&clearInterval(U(this,De,`f`)),H(this,De,void 0,`f`),U(this,W,`m`,Re).call(this),!1;if(!U(this,Ne,`f`)){let e=!U(this,W,`a`,Be);if(U(this,W,`a`,Fe)&&U(this,W,`a`,Ie)){let t=U(this,ke,`f`).dequeue();return t?(this.emit(`active`),t(),e&&U(this,W,`m`,He).call(this),!0):!1}}return!1},He=function(){U(this,Se,`f`)||U(this,De,`f`)!==void 0||(H(this,De,setInterval(()=>{U(this,W,`m`,Ue).call(this)},U(this,Te,`f`)),`f`),H(this,Ee,Date.now()+U(this,Te,`f`),`f`))},Ue=function(){U(this,Ce,`f`)===0&&U(this,je,`f`)===0&&U(this,De,`f`)&&(clearInterval(U(this,De,`f`)),H(this,De,void 0,`f`)),H(this,Ce,U(this,xe,`f`)?U(this,je,`f`):0,`f`),U(this,W,`m`,We).call(this)},We=function(){for(;U(this,W,`m`,Ve).call(this););},Ge=async function(e,t){return new Promise(n=>{let r=()=>{(!t||t())&&(this.off(e,r),n())};this.on(e,r)})};var Ye=Object.defineProperty,Xe=(e,t)=>{let n={};for(var r in e)Ye(n,r,{get:e[r],enumerable:!0});return t||Ye(n,Symbol.toStringTag,{value:`Module`}),n},Ze=`__OSRA_KEY__`,Qe=`__OSRA_DEFAULT_KEY__`,$e=`__OSRA_BOX__`,et=()=>globalThis.browser??globalThis.chrome,tt=()=>et()?.runtime,nt=(e,t)=>xt(e)&&e.__OSRA_KEY__===t,rt=(e,t)=>{if(e){if(e.aborted){t();return}e.addEventListener(`abort`,t,{once:!0})}},it=({listener:e,transport:t,remoteName:n,key:r=Qe,origin:i=`*`,unregisterSignal:a})=>{if(a?.aborted)return;let o=zt(t)?t.receive:t;if(typeof o==`function`){let t=o((t,i)=>{a?.aborted||nt(t,r)&&(n&&t.name!==n||e(t,i))});typeof t==`function`&&rt(a,t);return}if(Tt(o)||Et(o)||Ot(o)||kt(o)){let t=(t,i)=>{let o=(t,a)=>{nt(t,r)&&(n&&t.name!==n||e(t,{port:i,sender:a}))};t.addListener(o),rt(a,()=>t.removeListener(o))};if(Tt(o))t(o.onMessage);else if(Ot(o)){let e=e=>t(e.onMessage,e);o.addListener(e),rt(a,()=>o.removeListener(e))}else kt(o)?t(o):t(o.onMessage);return}let s=yt(o)?o.port:o,c=i!==`*`&&At(o),l=t=>{let a=t.data;if(typeof a==`string`)try{a=JSON.parse(a)}catch{return}nt(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(),rt(a,()=>s.removeEventListener(`message`,l))},at=new WeakSet,ot=e=>String(e?.message??e).includes(`disconnected port`),st=(e,t,n=`*`,r=[])=>{let i=zt(e)?e.emit:e;if(typeof i==`function`)i(t,r);else if(At(i))i.postMessage(t,n,r);else if(Et(i)){if(at.has(i))return;try{i.postMessage(t)}catch(e){if(!ot(e))throw e;at.add(i)}}else if(Tt(i))i.sendMessage(t)?.catch?.(e=>{if(!String(e?.message).includes(`Receiving end does not exist`))throw e});else if(mt(i)){let e=JSON.stringify(t);i.readyState===WebSocket.CONNECTING?i.addEventListener(`open`,()=>i.send(e),{once:!0}):i.send(e)}else yt(i)?i.port.postMessage(t,r):i.postMessage(t,r)},ct=globalThis.Float16Array,lt={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float16Array:ct,Float32Array,Float64Array,BigInt64Array,BigUint64Array},ut=Object.values(lt),dt=e=>{let t=e.constructor.name;if(t in lt)return t;for(let[t,n]of Object.entries(lt))if(n&&e instanceof n)return t;throw Error(`Unknown typed array type`)},ft=e=>{let t=lt[e];if(!t)throw Error(`Unknown typed array type`);return t},pt=e=>St(e,ut),mt=e=>e instanceof WebSocket,ht=e=>!!globalThis.ServiceWorkerContainer&&e instanceof ServiceWorkerContainer,gt=e=>!!globalThis.ServiceWorker&&e instanceof ServiceWorker,_t=e=>!!globalThis.Worker&&e instanceof Worker,vt=e=>{let t=globalThis.DedicatedWorkerGlobalScope;return!!t&&e instanceof t},yt=e=>!!globalThis.SharedWorker&&e instanceof SharedWorker,bt=e=>e instanceof MessagePort,xt=e=>!!e&&typeof e==`object`&&`__OSRA_KEY__`in e&&!!e.__OSRA_KEY__,St=(e,t)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return!1;for(let n of t)if(n&&e instanceof n)return!0;return!1},Ct=e=>St(e,[globalThis.SharedArrayBuffer]),wt=e=>St(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]),Tt=e=>{let t=tt();return t?e===t:!1},Et=(e,t=!1)=>!e||typeof e!=`object`||At(e)||!(`name`in e)||!(`disconnect`in e)||!(`postMessage`in e)?!1:!t||`sender`in e&&`onMessage`in e&&`onDisconnect`in e,Dt=e=>!!e&&typeof e==`object`&&!At(e)&&`addListener`in e&&`hasListener`in e&&`removeListener`in e,Ot=e=>{let t=tt();return t?e===t.onConnect||e===t.onConnectExternal:!1},kt=e=>Dt(e),At=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}}},jt=e=>mt(e)||Et(e)||Tt(e),Mt=e=>mt(e)||Et(e)||Ot(e)||kt(e)||Tt(e),Nt=e=>!!e&&typeof e==`object`&&!At(e)&&`isJson`in e&&e.isJson===!0||jt(e)||Mt(e),Pt=e=>At(e)||jt(e)||gt(e)||_t(e)||vt(e)||yt(e)||bt(e)||Lt(e),Ft=e=>At(e)||Mt(e)||ht(e)||_t(e)||vt(e)||yt(e)||bt(e)||Rt(e),It=e=>{if(!e||typeof e!=`object`||At(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},Lt=e=>!It(e)||!(`emit`in e)?!1:Pt(e.emit)||typeof e.emit==`function`,Rt=e=>!It(e)||!(`receive`in e)?!1:Ft(e.receive)||typeof e.receive==`function`,zt=e=>Lt(e)||Rt(e),Bt=()=>globalThis.Buffer,Vt=32768,Ht=e=>{let t=e.toBase64;if(typeof t==`function`)return t.call(e);let n=Bt();if(n)return n.from(e).toString(`base64`);let r=``;for(let t=0;t<e.length;t+=Vt)r+=String.fromCharCode(...e.subarray(t,t+Vt));return btoa(r)},Ut=e=>{let t=Uint8Array.fromBase64;if(typeof t==`function`)return t(e);let n=Bt();if(n)return new Uint8Array(n.from(e,`base64`));let r=atob(e),i=new Uint8Array(r.length);for(let e=0;e<r.length;e++)i[e]=r.charCodeAt(e);return i},G={[$e]:`revivable`},Wt=e=>!!e&&typeof e==`object`&&`__OSRA_BOX__`in e&&e.__OSRA_BOX__===`revivable`,Gt=(e,t)=>Nt(t.transport)?{base64Buffer:Ht(new Uint8Array(e))}:{arrayBuffer:e},Kt=e=>`arrayBuffer`in e?e.arrayBuffer:Ut(e.base64Buffer).buffer,qt=Xe({box:()=>Xt,isType:()=>Yt,objectsOnly:()=>!0,revive:()=>Zt,type:()=>Jt}),Jt=`arrayBuffer`,Yt=e=>e instanceof ArrayBuffer,Xt=(e,t)=>({...G,type:Jt,...Gt(e,t)}),Zt=(e,t)=>Kt(e),Qt=Xe({box:()=>tn,isType:()=>en,objectsOnly:()=>!0,revive:()=>nn,type:()=>$t}),$t=`date`,en=e=>e instanceof Date,tn=(e,t)=>({...G,type:$t,ISOString:e.toISOString()}),nn=(e,t)=>new Date(e.ISOString),rn=Xe({box:()=>sn,isType:()=>on,objectsOnly:()=>!0,revive:()=>cn,type:()=>an}),an=`headers`,on=e=>e instanceof Headers,sn=(e,t)=>({...G,type:an,entries:[...e.entries()]}),cn=(e,t)=>new Headers(e.entries),ln=Xe({box:()=>pn,isType:()=>fn,objectsOnly:()=>!0,revive:()=>mn,type:()=>un}),un=`error`,dn={Error,TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError},fn=e=>e instanceof Error,pn=(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:un,name:e.name,message:e.message,stack:e.stack||e.toString(),...n?{cause:Ma(e.cause,t)}:{},...r?{errors:Ma(e.errors,t)}:{},...i?{isDOMException:!0}:{}}},mn=(e,t)=>{let n=e.cause===void 0?void 0:Pa(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(Pa(e.errors,t),e.message,r);else{let t=dn[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},hn=Xe({box:()=>vn,isType:()=>_n,objectsOnly:()=>!0,revive:()=>yn,type:()=>gn}),gn=`typedArray`,_n=pt,vn=(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:gn,typedArrayType:dt(e),...Gt(n,t)}},yn=(e,t)=>new(ft(e.typedArrayType))(Kt(e)),bn=new WeakMap,xn=new WeakSet,Sn=(e,t)=>{if(xn.has(e))return t(),()=>{};let n=bn.get(e);return n||bn.set(e,n=new Set),n.add(t),()=>n.delete(t)},Cn=e=>xn.has(e),wn=e=>{if(xn.has(e))return;xn.add(e);let t=bn.get(e);if(t){bn.delete(e);for(let e of t)try{e()}catch{}}},Tn=Xe({box:()=>Ln,forceTransfer:()=>Pn,isInTransfer:()=>Nn,isType:()=>In,objectsOnly:()=>!0,outsideTransfer:()=>Fn,revive:()=>Rn,transfer:()=>jn,type:()=>En}),En=`transfer`,Dn=Symbol.for(`osra.transfer`),On=e=>typeof e==`object`&&!!e,kn=e=>On(e)&&Dn in e&&e[Dn]===!0,An=e=>On(e)?ArrayBuffer.isView(e)?!0:St(e,[globalThis.ArrayBuffer,globalThis.MessagePort,globalThis.ReadableStream,globalThis.WritableStream,globalThis.TransformStream,globalThis.Request,globalThis.Response,globalThis.ImageBitmap,globalThis.OffscreenCanvas,globalThis.VideoFrame,globalThis.AudioData]):!1,jn=e=>An(e)?{[Dn]:!0,value:e}:e,Mn=0,Nn=()=>Mn>0,Pn=e=>On(e)&&!kn(e)?{[Dn]:!0,value:e}:e,Fn=e=>{let t=Mn;Mn=0;try{return e()}finally{Mn=t}},In=e=>kn(e),Ln=(e,t)=>{Mn++;try{return{...G,type:En,inner:Ma(e.value,t),degraded:Nt(t.transport)}}finally{Mn--}},Rn=(e,t)=>Pa(e.inner,t),zn=e=>St(e,[globalThis.MessagePort,globalThis.ReadableStream,globalThis.WritableStream,globalThis.TransformStream,globalThis.OffscreenCanvas,globalThis.MediaSourceHandle,globalThis.MediaStreamTrack,globalThis.MIDIAccess,globalThis.RTCDataChannel,globalThis.WebTransportReceiveStream,globalThis.WebTransportSendStream]),Bn=e=>Wt(e)&&e.type===`transfer`,Vn=e=>{let t=[],n=new WeakSet,r=(e,i)=>{if(e&&typeof e==`object`&&!n.has(e)&&(n.add(e),!Ct(e))){if(Bn(e)){r(e.inner,i||!e.degraded);return}if(zn(e)){t.push(e);return}if(wt(e)){i&&t.push(e);return}if(ArrayBuffer.isView(e)){i&&e instanceof DataView&&!Ct(e.buffer)&&!n.has(e.buffer)&&(n.add(e.buffer),t.push(e.buffer));return}if(Array.isArray(e)){for(let t of e)r(t,i);return}for(let t of Object.values(e))r(t,i)}};return r(e,!1),t},Hn=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`))})}},Un=class{port1;port2;constructor(){let e=new Hn,t=new Hn;e._peer=t,t._peer=e,this.port1=e,this.port2=t}},Wn=new FinalizationRegistry(e=>{try{e()}catch{}}),Gn=(e,t)=>{let n={};return Wn.register(e,t,n),()=>Wn.unregister(n)},Kn=Xe({box:()=>mr,createRevivableChannel:()=>yr,init:()=>ir,isType:()=>ar,markPortsShipped:()=>_r,objectsOnly:()=>!0,postPreBoxed:()=>fr,revive:()=>hr,type:()=>qn}),qn=`messagePort`,Jn=2048,Yn=128,Xn=1024,Zn=new WeakMap,Qn=e=>{let t=Zn.get(e);if(!t)throw Error(`osra message-port: connection state missing; did init() run?`);return t},$n=(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},er=(e,t)=>{let n=e.ports.get(t);if(n&&!n.handler&&e.pendingPorts--,e.ports.delete(t),e.tombstones.size>=Yn){let t=e.tombstones.values().next().value;t!==void 0&&e.tombstones.delete(t)}e.tombstones.add(t)},tr=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)},nr=(e,t)=>$n(Qn(e),t).outSeq++,rr=(e,t,n)=>{let r=Qn(e);if(r.tombstones.has(t)){setTimeout(()=>n({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:t}));return}let i=$n(r,t);i.handler||r.pendingPorts--,i.handler=n,tr(i)},ir=e=>{let t={ports:new Map,tombstones:new Set,pendingPorts:0};Zn.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>=Xn)return;r=$n(t,n.portId)}if(!(n.seq<r.nextSeq)){if(r.buffer.size>=Jn&&!(n.seq===r.nextSeq&&r.handler)){r.buffer.clear(),er(t,n.portId),r.handler?.({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:n.portId});return}r.buffer.set(n.seq,n),tr(r)}}),Sn(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})},ar=e=>e instanceof MessagePort||e instanceof Hn,or=(e,t)=>{try{let n=Qn(e).ports.get(t);e.sendMessage({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:t,seq:n?n.outSeq++:0})}catch{}},sr=(e,t,n)=>{if(n){e.postMessage(t);return}let r=Vn(t);e.postMessage(t,r),_r(r)},cr=(e,t,n,r)=>{let i;try{i=Pa(e,t)}catch(e){r(),globalThis.reportError?.(e);return}n(i)},lr=(e,t,n)=>()=>{let r=e.deref();r&&or(r,n);let i=t.deref();i&&er(i,n)},ur=new WeakSet,dr=e=>e!==null&&(typeof e==`object`||typeof e==`function`),fr=(e,t,n)=>{dr(t)&&ur.add(t),e.postMessage(t,n??[])},pr=(e,t)=>dr(e)&&ur.delete(e)?e:Fn(()=>Ma(e,t)),mr=(e,t,n)=>{let r=e instanceof Hn;if(!r&&!Nt(t.transport))return{...G,type:qn,port:e,...n?.autoBox?{autoBox:!0}:{}};let i=Qn(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&&er(e,o),m?.();let t=s.deref();t?.removeEventListener(`message`,p),t instanceof Hn&&(t._onClose=void 0)},f=e=>{if(e.type===`message-port-close`){d(),a.dispatchEvent(new Event(`close`)),a.close();return}cr(e.data,t,e=>sr(a,e,!1),()=>{})};function p({data:e}){t.sendMessage({type:`message`,remoteUuid:t.remoteUuid,data:pr(e,t),portId:o,seq:nr(t,o)})}let m=Gn(a,lr(c,l,o));return a.addEventListener(`message`,p),a.start(),a instanceof Hn&&(a._onClose=()=>{u||(or(t,o),d())}),rr(t,o,f),{...G,type:qn,portId:o,synthetic:r}},hr=(e,t)=>`port`in e?(_r([e.port]),e.autoBox?vr(e.port,t):e.port):br(e.portId,t,e.synthetic),gr=new WeakMap,_r=e=>{for(let t of e){let e=gr.get(t);if(e){gr.delete(t),e.shipped=!0;for(let t of e.pending.splice(0))t()}}},vr=(e,t,n)=>{let r=new EventTarget,i=({data:e})=>{cr(e,t,e=>r.dispatchEvent(new MessageEvent(`message`,{data:e})),()=>r.dispatchEvent(new Event(`messageerror`)))},a=()=>{r.dispatchEvent(new Event(`messageerror`))},o=()=>{r.dispatchEvent(new Event(`close`))};e.addEventListener(`message`,i),e.addEventListener(`messageerror`,a),e.addEventListener(`close`,o),r.postMessage=(r,i)=>{let a=Fn(()=>Ma(r,t)),o=Vn(a),s=Array.isArray(i)?i:[],c=s.length?[...o,...s]:o,l=()=>{e.postMessage(a,c),_r(c)};if(n&&!n.shipped){n.pending.push(l);return}l()},r.start=()=>e.start();let s=()=>{e.removeEventListener(`message`,i),e.removeEventListener(`messageerror`,a),e.removeEventListener(`close`,o),e.close()};return r.close=()=>{if(n&&!n.shipped){n.pending.push(s);return}s()},r},yr=e=>{if(Nt(e.transport)){let{port1:t,port2:n}=new Un;return{localPort:t,boxedRemote:mr(n,e)}}let{port1:t,port2:n}=new MessageChannel,r={shipped:!1,pending:[]};return gr.set(n,r),{localPort:vr(t,e,r),boxedRemote:mr(n,e,{autoBox:!0})}},br=(e,t,n)=>{let r=Qn(t),{port1:i,port2:a}=n?new Un:new MessageChannel,o=new WeakRef(i),s=new WeakRef(a),c=!1,l=!1;i instanceof Hn||i.addEventListener(`close`,e=>{l&&e.stopImmediatePropagation()});let u=()=>{if(c)return;c=!0,er(r,e);let t=s.deref();t?.removeEventListener(`message`,f),t?.close(),p?.()},d=e=>{if(e.type===`message-port-close`){u();let e=o.deref();e?.dispatchEvent(new Event(`close`)),l=!0,e?.close();return}if(!o.deref()){u();return}let r=s.deref();r&&cr(e.data,t,e=>sr(r,e,n),()=>o.deref()?.dispatchEvent(new Event(`messageerror`)))},f=({data:n})=>{t.sendMessage({type:`message`,remoteUuid:t.remoteUuid,data:pr(n,t),portId:e,seq:nr(t,e)})},p=Gn(i,()=>{or(t,e),u()});return i instanceof Hn&&(i._onClose=()=>{c||(or(t,e),u())}),a.addEventListener(`message`,f),a.start(),rr(t,e,d),i},xr=Xe({box:()=>Er,isType:()=>Tr,objectsOnly:()=>!0,revive:()=>Dr,type:()=>Sr}),Sr=`promise`,Cr=e=>e instanceof Promise,wr=new Set,Tr=e=>e instanceof Promise,Er=(e,t)=>{if(!Cr(e))throw TypeError(`Expected Promise`);let{localPort:n,boxedRemote:r}=yr(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:Sr,port:r}},Dr=(e,t)=>{let n=hr(e.port,t);wr.add(n);let r=`portId`in e.port;return new Promise((e,i)=>{let a,o=()=>{n.close(),wr.delete(n),a?.()};if(r&&Cn(t)){i(Error(`osra: connection closed`)),o();return}a=r?Sn(t,()=>{i(Error(`osra: connection closed`)),o()}):void 0,n.addEventListener(`message`,({data:t})=>{t.type===`resolve`?e(t.data):i(t.error),o()},{once:!0}),n.start()})},Or=Xe({box:()=>Nr,isType:()=>Mr,objectsOnly:()=>!0,revive:()=>Pr,type:()=>kr}),kr=`function`,Ar=new Set,jr=e=>{e instanceof ReadableStream?e.locked||e.cancel(Error(`osra: connection closed`)).catch(()=>{}):typeof WritableStream<`u`&&e instanceof WritableStream&&(e.locked||e.abort(Error(`osra: connection closed`)).catch(()=>{}))},Mr=e=>typeof e==`function`,Nr=(e,t)=>{let{port1:n,port2:r}=new Un;return n.addEventListener(`message`,({data:n})=>{let[r,i]=n;(async()=>{let n;try{n={type:`return`,value:await e(...i)}}catch(e){n={type:`throw`,error:e}}if(Cn(t)){n.type===`return`&&jr(n.value);try{r.close()}catch{}return}let a=(()=>{try{return Ma(n,t)}catch(e){return Ma({type:`throw`,error:e},t)}})();fr(r,a),queueMicrotask(()=>{try{r.close()}catch{}})})()}),n.start(),{...G,type:kr,port:mr(r,t)}},Pr=(e,t)=>{let n=hr(e.port,t);return((...e)=>new Promise((r,i)=>{if(Cn(t)){i(Error(`osra: connection closed`));return}let{port1:a,port2:o}=new Un;Ar.add(a);let s,c=()=>{a.close(),Ar.delete(a),s?.()};s=Sn(t,()=>{i(Error(`osra: connection closed`)),c()}),a.addEventListener(`message`,({data:e})=>{let t=e;t.type===`return`?r(t.value):i(t.error),c()},{once:!0}),a.start();let l=Fn(()=>Ma([o,e],t));fr(n,l)}))},Fr=Xe({MAX_CREDIT_WINDOW:()=>64,box:()=>Vr,isType:()=>Lr,objectsOnly:()=>!0,revive:()=>Gr,type:()=>Ir}),Ir=`readableStream`,Lr=e=>e instanceof ReadableStream,Rr=2,zr=8,Br=4194304,Vr=(e,t)=>{let{localPort:n,boxedRemote:r}=yr(t),i=e.getReader(),a=Nn(),o=0,s=!1,c=!1,l=e=>{c=!0;try{n.postMessage(e)}catch{}n.close()},u=async()=>{if(!(s||c)){for(s=!0;o>0;){let e;try{e=await i.read()}catch(e){c||l({type:`error`,error:e});return}if(c)return;if(e.done){l({type:`end`});return}o--;let t=a?Pn(e.value):e.value;try{n.postMessage({type:`chunk`,value:t})}catch(e){l({type:`error`,error:e}),i.cancel(e).catch(()=>{});return}}s=!1}};return n.addEventListener(`message`,({data:e})=>{e instanceof Promise||!(`type`in e)||(e.type===`pull`?n.postMessage(i.read()):e.type===`credit`?(o+=e.n,u()):e.type===`cancel`&&(c=!0,i.cancel(e.reason).catch(()=>{}),n.close()))}),n.addEventListener(`close`,()=>{c||(c=!0,i.cancel(Error(`osra: connection closed`)).catch(()=>{}))},{once:!0}),n.start(),{...G,type:Ir,credit:!0,port:r}},Hr=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,Ur=e=>{let t=!1,n=0,r,i=[],a=!1,o=!1,s,c,l=()=>r===void 0?zr:Math.max(Rr,Math.min(64,Math.floor(Br/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=Hr(o.value);if(a!==void 0&&(r=r===void 0?a:r*.875+a*.125),c){let e=c;c=void 0,e.controller.enqueue(o.value),e.resolve()}else i.push(o.value)}else if(o.type===`end`){if(t||(a=!0,!c||i.length))return;let e=c;c=void 0,d(),e.controller.close(),e.resolve()}else if(o.type===`error`){if(t)return;f(o.error)}}}),e.addEventListener(`messageerror`,()=>{t||f(Error(`osra: a chunk failed to deserialize on this platform`))}),e.addEventListener(`close`,()=>{t||a||o||f(Error(`osra: connection closed`))},{once:!0})},pull:e=>{if(!t){if(i.length){e.enqueue(i.shift()),!a&&!o&&u();return}if(o)return d(),Promise.reject(s);if(a){d(),e.close();return}return u(),new Promise((t,n)=>{c={controller:e,resolve:t,reject:n}})}},cancel:n=>{t=!0,i.length=0;let r=c;c=void 0,r?.resolve(),e.postMessage({type:`cancel`,reason:n}),queueMicrotask(()=>e.close())}})},Wr=e=>{let t=!1;return new ReadableStream({start:n=>{e.addEventListener(`messageerror`,()=>{if(!t){t=!0;try{n.error(Error(`osra: a chunk failed to deserialize on this platform`))}catch{}queueMicrotask(()=>e.close())}}),e.addEventListener(`close`,()=>{if(!t){t=!0;try{n.error(Error(`osra: connection closed`))}catch{}}},{once:!0})},pull:n=>new Promise((r,i)=>{e.addEventListener(`message`,({data:a})=>{a instanceof Promise&&a.then(i=>{i.done?(t=!0,n.close(),e.postMessage({type:`cancel`}),queueMicrotask(()=>e.close())):n.enqueue(i.value),r()}).catch(e=>{t=!0,i(e)})},{once:!0}),e.postMessage({type:`pull`})}),cancel:n=>{t=!0,e.postMessage({type:`cancel`,reason:n}),queueMicrotask(()=>e.close())}})},Gr=(e,t)=>{let n=hr(e.port,t);return n.start(),e.credit?Ur(n):Wr(n)},Kr=Xe({box:()=>Yr,isType:()=>Jr,objectsOnly:()=>!0,revive:()=>Xr,type:()=>qr}),qr=`writableStream`,Jr=e=>e instanceof WritableStream,Yr=(e,t)=>{let{localPort:n,boxedRemote:r}=yr(t),i=e.getWriter(),a=!1,o=(e,t)=>e.then(()=>n.postMessage({type:`ack`})).catch(e=>n.postMessage({type:`err`,error:e?.message??String(e)})).then(()=>{t&&(a=!0,queueMicrotask(()=>n.close()))});return n.addEventListener(`message`,({data:e})=>{!e||typeof e!=`object`||!(`type`in e)||(e.type===`write`?o(i.write(e.chunk),!1):e.type===`close`?o(i.close(),!0):e.type===`abort`&&o(i.abort(e.reason),!0))}),n.addEventListener(`messageerror`,()=>{n.postMessage({type:`err`,error:`osra: a chunk failed to deserialize on this platform`})}),n.addEventListener(`close`,()=>{a||(a=!0,i.abort(Error(`osra: connection closed`)).catch(()=>{}))},{once:!0}),n.start(),{...G,type:qr,port:r,...Nn()?{transferChunks:!0}:{}}},Xr=(e,t)=>{let n=hr(e.port,t);n.start();let r=new Set,i=!1;n.addEventListener(`close`,()=>{i=!0;let e=Error(`osra: connection closed`);for(let t of[...r])t(e);r.clear()},{once:!0});let a=Promise.resolve(),o=e=>{let t=a.then(()=>new Promise((t,a)=>{if(i){a(Error(`osra: connection closed`));return}let o=e=>{r.delete(a),e()};r.add(a),n.addEventListener(`message`,({data:e})=>{!e||typeof e!=`object`||!(`type`in e)||(e.type===`ack`?o(t):e.type===`err`&&o(()=>a(Error(e.error))))},{once:!0}),n.postMessage(e)}));return a=t.catch(()=>{}),t},s=e.transferChunks===!0;return new WritableStream({write:e=>o({type:`write`,chunk:s?Pn(e):e}),close:()=>o({type:`close`}),abort:e=>o({type:`abort`,reason:e})})},Zr=Xe({box:()=>ti,isType:()=>$r,objectsOnly:()=>!0,revive:()=>ni,type:()=>Qr}),Qr=`abortSignal`,$r=e=>e instanceof AbortSignal,ei=new WeakMap,ti=(e,t)=>{if(e.aborted)return{...G,type:Qr,aborted:!0,reason:Ma(e.reason,t)};let{localPort:n,boxedRemote:r}=yr(t),i=()=>{n.postMessage({type:`abort`,reason:e.reason}),n.close(),a()},a=Sn(t,()=>{e.removeEventListener(`abort`,i),n.close()});return e.addEventListener(`abort`,i,{once:!0}),{...G,type:Qr,aborted:!1,reason:void 0,port:r}},ni=(e,t)=>{let n=new AbortController;if(e.aborted||e.port===void 0)return n.abort(Pa(e.reason,t)),n.signal;let r=hr(e.port,t);return ei.set(n.signal,r),r.start(),r.addEventListener(`message`,({data:e})=>{e.type===`abort`&&(n.abort(Pa(e.reason,t)),ei.delete(n.signal),r.close())}),n.signal},ri=Xe({box:()=>oi,isType:()=>ai,objectsOnly:()=>!0,revive:()=>si,type:()=>ii}),ii=`response`,ai=e=>e instanceof Response,oi=(e,t)=>({...G,type:ii,status:e.status,statusText:e.statusText,headers:sn(e.headers,t),body:e.body?Vr(e.body,t):null,url:e.url,redirected:e.redirected}),si=(e,t)=>{if(e.status===0)return Response.error();let n=cn(e.headers,t),r=e.body?Gr(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},ci=Xe({box:()=>di,isType:()=>ui,objectsOnly:()=>!0,revive:()=>fi,type:()=>li}),li=`request`,ui=e=>e instanceof Request,di=(e,t)=>({...G,type:li,method:e.method,url:e.url,headers:sn(e.headers,t),body:e.body?Vr(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:ti(e.signal,t)}),fi=(e,t)=>{let n=cn(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:ni(e.signal,t)};return e.mode!==`navigate`&&(r.mode=e.mode),e.body&&(r.body=Gr(e.body,t),r.duplex=`half`),new Request(e.url,r)},pi=Xe({box:()=>Ti,boxByReference:()=>Ei,identity:()=>yi,isType:()=>Si,objectsOnly:()=>!0,revive:()=>Di,type:()=>mi}),mi=`identity`,hi=e=>e!==null&&(typeof e==`object`||typeof e==`function`),gi=e=>{if(e===null)return!1;let t=typeof e;return t===`object`||t===`function`||t===`symbol`&&Symbol.keyFor(e)===void 0},_i=new WeakMap,vi=e=>{let t=_i.get(e);if(t!==void 0)return t;let n=globalThis.crypto.randomUUID();return _i.set(e,n),n},yi=e=>(hi(e)&&vi(e),e),bi=new WeakMap,xi=e=>{let t=bi.get(e);if(t)return t;let n=new Map,r={idToLocal:n,pins:new Map,aliasIds:new WeakMap,disposeRegistry:new FinalizationRegistry(t=>{if(n.delete(t),!Cn(e))try{e.sendMessage({type:`identity-dispose`,remoteUuid:e.remoteUuid,id:t})}catch{}})};return bi.set(e,r),e.eventTarget.addEventListener(`message`,({detail:e})=>{e?.type===`identity-dispose`&&(r.pins.delete(e.id),r.idToLocal.delete(e.id))}),Sn(e,()=>{r.pins.clear(),r.idToLocal.clear()}),r},Si=e=>hi(e)&&_i.has(e),Ci=(e,t)=>{let n=t.aliasIds.get(e);if(n!==void 0)return n;let r=vi(e),i=t.idToLocal.get(r);if(i===void 0||i.deref()===e)return r;let a=globalThis.crypto.randomUUID();return t.aliasIds.set(e,a),a},wi=(e,t,n)=>{let r=Ci(e,n);if(n.idToLocal.has(r))return{...G,type:mi,id:r};let i=t();return n.idToLocal.set(r,new WeakRef(e)),n.disposeRegistry.register(e,r,e),Ea(()=>{},()=>{n.idToLocal.delete(r),n.disposeRegistry.unregister(e)}),{...G,type:mi,id:r,inner:i}},Ti=(e,t)=>{let n=xi(t),r=()=>Na(e,t,mi);return gi(e)?wi(e,r,n):{...G,type:mi,id:globalThis.crypto.randomUUID(),inner:r()}},Ei=(e,t,n)=>wi(e,()=>t,xi(n)),Di=(e,t)=>{let n=xi(t);if(n.pins.has(e.id))return n.pins.get(e.id);let r=n.idToLocal.get(e.id)?.deref();if(r!==void 0)return r;if(!(`inner`in e)||e.inner===void 0){try{t.sendMessage({type:`identity-dispose`,remoteUuid:t.remoteUuid,id:e.id})}catch{}throw Error(`osra identity: received id=${e.id} with no inner payload and nothing local to resolve it to`)}let i=Pa(e.inner,t);return n.pins.set(e.id,i),gi(i)&&(_i.has(i)||_i.set(i,e.id),n.idToLocal.set(e.id,new WeakRef(i))),i},Oi=Xe({box:()=>Ai,isType:()=>ki,objectsOnly:()=>!0,revive:()=>ji,type:()=>`map`}),ki=e=>e instanceof Map,Ai=(e,t)=>({...G,type:`map`,entries:Array.from(e,([e,n])=>[Ma(e,t),Ma(n,t)])}),ji=(e,t)=>new Map(e.entries.map(([e,n])=>[Pa(e,t),Pa(n,t)])),Mi=Xe({box:()=>Pi,isType:()=>Ni,objectsOnly:()=>!0,revive:()=>Fi,type:()=>`set`}),Ni=e=>e instanceof Set,Pi=(e,t)=>({...G,type:`set`,values:Array.from(e,e=>Ma(e,t))}),Fi=(e,t)=>new Set(e.values.map(e=>Pa(e,t))),Ii=Xe({box:()=>zi,isType:()=>Ri,revive:()=>Bi,type:()=>Li}),Li=`bigint`,Ri=e=>typeof e==`bigint`,zi=(e,t)=>({...G,type:Li,value:e.toString()}),Bi=(e,t)=>BigInt(e.value),Vi=Xe({box:()=>Wi,isType:()=>Ui,objectsOnly:()=>!0,revive:()=>Gi,type:()=>Hi}),Hi=`event`,Ui=e=>e instanceof Event,Wi=(e,t)=>({...G,type:Hi,eventType:e.type,bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed,...e instanceof CustomEvent?{detail:Ma(e.detail,t)}:{}}),Gi=(e,t)=>{let n={bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed};return`detail`in e?new CustomEvent(e.eventType,{...n,detail:Pa(e.detail,t)}):new Event(e.eventType,n)},Ki=Xe({box:()=>Yi,isType:()=>Ji,objectsOnly:()=>!0,revive:()=>$i,type:()=>qi}),qi=`eventTarget`,Ji=e=>e instanceof EventTarget,Yi=(e,t)=>{let n=[],r=e=>typeof e==`boolean`?e:!!e?.capture;return{...G,type:qi,addListener:Nr((t,i,a)=>{n.push({eventType:t,listener:i,capture:r(a)}),e.addEventListener(t,i,a)},t),removeListener:Nr((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:Nr(()=>{for(let{eventType:t,listener:r,capture:i}of n.splice(0))e.removeEventListener(t,r,{capture:i})},t)}},Xi=new WeakMap,Zi=e=>{if(typeof e==`function`)return e;let t=Xi.get(e);return t||Xi.set(e,t=t=>e.handleEvent(t)),t},Qi=(e,t,n,r)=>e.find(e=>e.eventType===t&&e.listener===n&&e.capture===r),$i=(e,t)=>{let n=Pr(e.addListener,t),r=Pr(e.removeListener,t),i=Pr(e.removeAllListeners,t),a=new EventTarget,o=[],s=e=>{let t=o.indexOf(e);t!==-1&&o.splice(t,1)};return Object.defineProperty(a,"addEventListener",{value:(e,t,r)=>{if(t===null)return;let i=Zi(t),a=typeof r==`boolean`?r:!!r?.capture;if(Qi(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,yi(c),r).catch(()=>{})}}),Object.defineProperty(a,"removeEventListener",{value:(e,t,n)=>{if(t===null)return;let i=Zi(t),a=typeof n==`boolean`?n:!!n?.capture,c=Qi(o,e,i,a);c&&(s(c),r(e,yi(c.wire),{capture:a}).catch(()=>{}))}}),Gn(a,()=>{i().catch(()=>{})}),a},ea=Xe({box:()=>ra,isType:()=>na,revive:()=>ia,type:()=>ta}),ta=`symbol`,na=e=>typeof e==`symbol`,ra=(e,t)=>{let n=Symbol.keyFor(e);return n===void 0?Ei(e,{...G,type:ta,description:e.description},t):{...G,type:ta,registryKey:n}},ia=(e,t)=>`registryKey`in e?Symbol.for(e.registryKey):Symbol(e.description),aa=Xe({box:()=>ca,isType:()=>sa,objectsOnly:()=>!0,revive:()=>la,type:()=>oa}),oa=`asyncIterator`,sa=e=>!e||typeof e!=`object`||typeof ReadableStream<`u`&&e instanceof ReadableStream?!1:typeof e[Symbol.asyncIterator]==`function`,ca=(e,t)=>{let n=e[Symbol.asyncIterator]();return{...G,type:oa,next:Nr((e=>n.next(e)),t),return:Nr((e=>n.return?.(e)??Promise.resolve({done:!0,value:e})),t),throw:Nr((e=>n.throw?.(e)??Promise.reject(e)),t)}},la=(e,t)=>{let n=Pr(e.next,t),r=Pr(e.return,t),i=Pr(e.throw,t),a={next:(...e)=>n(...e),return:e=>r(e),throw:e=>i(e),[Symbol.asyncIterator]:()=>a};return a},ua=[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],da=[globalThis.CropTarget,globalThis.EncodedAudioChunk,globalThis.EncodedVideoChunk,globalThis.FencedFrameConfig,globalThis.GPUCompilationInfo,globalThis.GPUCompilationMessage,globalThis.GPUPipelineError,globalThis.RTCEncodedAudioFrame,globalThis.RTCEncodedVideoFrame,globalThis.WebTransportError],fa={type:`clonable`,capableOnly:!0,objectsOnly:!0,isType:e=>St(e,ua)||St(e,da),box:(e,t)=>e,revive:(e,t)=>e},pa=[globalThis.ImageBitmap,globalThis.OffscreenCanvas,globalThis.WritableStream,globalThis.TransformStream,globalThis.MediaStreamTrack,globalThis.RTCDataChannel],ma=[globalThis.AudioData,globalThis.VideoFrame,globalThis.MediaSourceHandle,globalThis.MIDIAccess,globalThis.WebTransportReceiveStream,globalThis.WebTransportSendStream],ha={type:`transferable`,capableOnly:!0,objectsOnly:!0,isType:e=>St(e,pa)||St(e,ma),box:(e,t)=>e,revive:(e,t)=>e},ga={type:`blob`,capableOnly:!0,objectsOnly:!0,isType:e=>typeof Blob<`u`&&e instanceof Blob,box:(e,t)=>{if(Nt(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},_a=e=>{if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},va=[Tn,pi,qt,Qt,rn,ln,hn,xr,Or,Kn,Fr,Kr,Zr,ri,ci,Oi,Mi,Ii,ea,Vi,aa,{type:`nonFiniteNumber`,isType:e=>typeof e==`number`&&!Number.isFinite(e),box:(e,t)=>Nt(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)=>Nt(t.transport)?{...G,type:`undefined`}:e,revive:(e,t)=>void 0},fa,ha,ga,Ki,{type:`unclonable`,objectsOnly:!0,isType:e=>{if(typeof e!=`object`||!e||Array.isArray(e)||_a(e))return!1;try{return structuredClone(e),!1}catch{return!0}},box:(e,t)=>({...G,type:`unclonable`}),revive:(e,t)=>({})}],ya=(e,t)=>t.find(t=>t.type===e.type),ba=e=>!!e&&typeof e==`object`&&Object.getPrototypeOf(e)===Object.prototype,xa=(e,t)=>Array.isArray(e)?e.map(e=>t(e)):ba(e)?Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n)])):e,Sa=new WeakSet,Ca=new WeakSet,wa=0,Ta=[],Ea=(e,t)=>{if(wa===0){e();return}Ta.push({commit:e,rollback:t})},Da=e=>{let t=Ta;Ta=[];for(let n of t)try{e?n.rollback():n.commit()}catch{}},Oa=e=>e!==null&&(typeof e==`object`||typeof e==`function`),ka=new WeakMap,Aa=e=>{let t=ka.get(e);if(t)return t;let n=e.filter(e=>!e.objectsOnly);return ka.set(e,n),n},ja=(e,t,n)=>{let r=(e===null||typeof e!=`object`&&typeof e!=`function`?Aa(t.revivableModules):t.revivableModules).find(t=>t.type!==n&&t.isType(e));return r?r.box(e,t):xa(e,e=>Ma(e,t))},Ma=(e,t)=>{if(Wt(e))return e;let n=Oa(e);if(n){if(Sa.has(e))throw TypeError(`osra: cannot serialize a circular structure - break the cycle or send the container by reference`);Sa.add(e)}wa++;let r=!0;try{let n=ja(e,t);return r=!1,n}finally{n&&Sa.delete(e),wa--,wa===0&&Da(r)}},Na=(e,t,n)=>ja(e,t,n),Pa=(e,t)=>{let n=Oa(e);if(n){if(Ca.has(e))throw TypeError(`osra: cannot revive a circular structure`);Ca.add(e)}try{if(Wt(e)){let n=ya(e,t.revivableModules);if(n)return n.revive(e,t)}return xa(e,e=>Pa(e,t))}finally{n&&Ca.delete(e)}},Fa=Xe({init:()=>Ra,startBidirectionalConnection:()=>La,type:()=>Ia}),Ia=`bidirectional`,La=({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:Ma(t,o)}),{revivableContext:o,remoteValue:s.then(e=>Pa(e,o))}},Ra=e=>{if(!(Pt(e.transport)&&Ft(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=La({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),wn(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=La({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()},za=()=>new EventTarget,Ba=e=>{let t=zt(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&&Nt(n)||r!==void 0&&Nt(r),...n===void 0?{}:{emit:n},...r===void 0?{}:{receive:r}}},Va=e=>e?e(va):va,Ha=32,Ua=()=>{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())}}}}},Wa=(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})},Ga=Symbol.for(`osra.context`),Ka=e=>typeof e==`object`&&!!e&&Ga in e,qa=[Fa],Ja=(e,{transport:t,name:n,remoteName:r,key:i=Qe,origin:a=`*`,unregisterSignal:o,revivableModules:s,uuid:c,remoteUuid:l,connection:u=({value:e})=>e})=>{let d=u,f=Ba(t);if(!(Pt(f)&&Ft(f))){let e=Ua();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(()=>{}),Wa(t,e,d)}let p=Va(s),m=new Map,h=new Set,g=Ua(),{promise:_,resolve:v,reject:y}=Promise.withResolvers();_.catch(()=>{});let b=c??globalThis.crypto.randomUUID(),x=(e,t=a)=>{let r={[Ze]:i,name:n,uuid:b,...e},o=Vn(r);st(f,r,t,o),_r(o)},S=(e,t)=>{o?.aborted||x(e,t)},C=za(),w={transport:f,valueFor:t=>Ka(e)?e[Ga](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}),wn(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:za,unregisterSignal:o};if(it({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(),Wa(_,g,d);o?.addEventListener(`abort`,()=>{for(let[e,t]of m)x({type:`close`,remoteUuid:e}),wn(t.connection.revivableContext);m.clear(),g.close(),y(o.reason)},{once:!0});for(let e of qa)e.init(w);return Wa(_,g,d)},Ya=(e,t)=>Ja(e,t),Xa=[[`aac`,`audio/mp4; codecs="mp4a.40.2"`],[`opus`,`audio/mp4; codecs="opus"`],[`flac`,`audio/mp4; codecs="flac"`],[`ac3`,`audio/mp4; codecs="ac-3"`],[`eac3`,`audio/mp4; codecs="ec-3"`]],Za=[`aac`,`opus`,`flac`],Qa=()=>{let e=globalThis.MediaSource;if(typeof e?.isTypeSupported!=`function`)return[...Za];let t=Xa.filter(([,t])=>{try{return e.isTypeSupported(t)}catch{return!1}}).map(([e])=>e);return t.includes(`aac`)?t:[...Za]},$a=e=>new Promise((t,n)=>{if(e.aborted)return n();e.addEventListener(`abort`,()=>{n()})}),eo=async({publicPath:e,workerUrl:t,workerOptions:n,read:r,length:i,bufferSize:a,audioStreamIndex:o,audioCodecs:s,transferReads:c=!0})=>{let l=new Worker(t,n),{makeRemuxer:u}=await Ya({},{transport:l}),d=await u({publicPath:e,length:i,bufferSize:a,audioStreamIndex:o,audioCodecs:s??Qa()}),f=new Je({concurrency:1}),p=!1,m=(e,t)=>{p||!c||e.byteLength>0||t>=i||(p=!0,console.warn(`libav-wasm: read(${t}) returned 0 bytes, ${i-t} bytes before the end of the file. Reads are transferred, so the buffer read() returns is detached in the caller and handing back bytes you keep returns that same detached buffer. Return a copy, or pass transferReads: false.`))},h=e=>(t,n)=>e.signal.aborted?Promise.resolve({resolved:new Uint8Array().buffer,rejected:!0}):Promise.race([r(Number(t),Number(n)).then(e=>{m(e,Number(t));let n=new Uint8Array(e).buffer;return{resolved:c?jn(n):n,rejected:!1}},()=>({resolved:new Uint8Array().buffer,rejected:!0})),$a(e.signal).then(()=>({resolved:new Uint8Array().buffer,rejected:!0}),()=>({resolved:new Uint8Array().buffer,rejected:!0}))]),g=[];return{worker:l,remuxer:d,wasmRead:h,addTask:e=>{let t=[...g];g=[],f.clear(),t.forEach(e=>e.abort());let n=new AbortController;return g=[...g,n],Promise.race([f.add(async()=>e(n),{signal:n.signal}),$a(n.signal).then(()=>Promise.reject(Error(`Cancelled`)),()=>Promise.reject(Error(`Cancelled`)))])},destroy:async()=>{let e=[...g];g=[],f.clear(),e.forEach(e=>e.abort()),await d.destroy(),l.terminate()}}},to=async e=>{let{worker:t,remuxer:n,wasmRead:r,addTask:i,destroy:a}=await eo({...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)}},no=async e=>{let{worker:t,remuxer:n,wasmRead:r,addTask:i,destroy:a}=await eo({...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}},ro=typeof HTMLVideoElement<`u`?HTMLVideoElement.prototype:{},io=`getVideoPlaybackQuality`in ro||`webkitDecodedFrameCount`in ro||`mozPresentedFrames`in ro||`mozPaintedFrames`in ro;if(!(`requestVideoFrameCallback`in ro)&&io&&typeof requestAnimationFrame==`function`){ro._rvfcpolyfillmap={};let e=`getVideoPlaybackQuality`in ro?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});ro.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},ro.cancelVideoFrameCallback=function(e){cancelAnimationFrame(this._rvfcpolyfillmap[e]),delete this._rvfcpolyfillmap[e]}}var ao={RAW:`RAW`,PROXY:`PROXY`,THROW:`THROW`,HANDLER:`HANDLER`},oo={GET:`GET`,SET:`SET`,APPLY:`APPLY`,CONSTRUCT:`CONSTRUCT`,RELEASE:`RELEASE`},so=Symbol(`Abslink.proxy`),co=Symbol(`Abslink.releaseProxy`),lo=Symbol(`Abslink.finalizer`),uo=Symbol(`Abslink.thrown`),fo=e=>typeof e==`object`&&!!e||typeof e==`function`,po=new Map([[`proxy`,{canHandle:e=>fo(e)&&so in e,serialize(e,t){let n=e[so];return ho(e,t,n),[n,[]]},deserialize(e,t){return go(t,e)}}],[`throw`,{canHandle:e=>fo(e)&&uo in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(Error(e.value.message),e.value):e.value}}]]);function mo(e,t){let n=t,r=e.slice(0,-1);for(let e of r)Object.prototype.hasOwnProperty.call(n,e)&&(n=n[e]);let i=e[e.length-1],a=i?n[i]:n;return{parent:n,RawValue:a,lastSegment:i}}function ho(e,t,n){return t.on(`message`,function r(i){if(!i)return;let{id:a,type:o,path:s,markerID:c}={path:[],...i};if(c!==n)return;let l=(i.argumentList??[]).map(e=>ko(e,t)),u;try{let{parent:n,RawValue:r,lastSegment:a}=mo(s,e);switch(o){case oo.GET:u=r;break;case oo.SET:n[a]=ko(i.value,t),u=!0;break;case oo.APPLY:u=r.apply(n,l);break;case oo.CONSTRUCT:u=new r(...l);break;case oo.RELEASE:u=void 0;break;default:return}}catch(e){u={value:e,[uo]:0}}Promise.resolve(u).catch(e=>({value:e,[uo]:0})).then(i=>{o===oo.CONSTRUCT&&(i=Do(i));let[s,c]=Oo(i,t);t.postMessage({...s,id:a,markerID:n},c),o===oo.RELEASE&&(t.off(`message`,r),e[lo]?.())}).catch(e=>{let[r,i]=Oo({value:TypeError(`Unserializable return value`),[uo]:0},t);t.postMessage({...r,id:a,markerID:n},i)})}),e}function go(e,t){let n=new Map;return e.on(`message`,e=>{if(!e?.id)return;let t=n.get(e.id);if(t)try{t(e)}finally{n.delete(e.id)}}),Co({endpoint:e,pendingListeners:n,rootMarkerID:t})}function _o(e){if(e)throw Error(`Proxy has been released and is not useable`)}async function vo(e){await Ao(e,{type:oo.RELEASE})}var yo=new WeakMap,bo=`FinalizationRegistry`in globalThis&&new FinalizationRegistry(e=>{let t=(yo.get(e)??0)-1;yo.set(e,t),t===0&&vo(e).finally(()=>{e.pendingListeners.clear()})});function xo(e,t){let n=(yo.get(t)??0)+1;yo.set(t,n),bo&&bo.register(e,t,e)}function So(e){bo&&bo.unregister(e)}function Co(e,t=[]){let n=!1,r=new Map,i=new Proxy(function(){},{get(a,o){if(_o(n),o===co)return async()=>{for(let e of r.values())e[co]();r.clear(),So(i),vo(e).finally(()=>{e.pendingListeners.clear()}),n=!0};if(o===`then`){if(t.length===0)return{then:()=>i};let n=Ao(e,{type:oo.GET,path:t.map(e=>e.toString())}).then(t=>ko(t,e.endpoint));return n.then.bind(n)}let s=r.get(o);if(s)return s;let c=Co(e,[...t,o]);return r.set(o,c),c},set(r,i,a){_o(n);let[o,s]=Oo(a,e.endpoint);return Ao(e,{type:oo.SET,path:[...t,i].map(e=>e.toString()),value:o},s).then(t=>ko(t,e.endpoint))},apply(r,i,a){if(_o(n),t[t.length-1]===`bind`)return Co(e,t.slice(0,-1));let[o,s]=Eo(a,e);return Ao(e,{type:oo.APPLY,path:t.map(e=>e.toString()),argumentList:o},s).then(t=>ko(t,e.endpoint))},construct(r,i){_o(n);let[a,o]=Eo(i,e);return Ao(e,{type:oo.CONSTRUCT,path:t.map(e=>e.toString()),argumentList:a},o).then(t=>ko(t,e.endpoint))}});return xo(i,e),i}var wo=new WeakMap;function To(e,t){return wo.set(e,t),e}function Eo(e,t){let n=[],r=[];for(let i of e){let[e,a]=Oo(i,t.endpoint);n.push(e),r.push(...a)}return[n,r]}function Do(e){return Object.assign(e,{[so]:Fo()})}function Oo(e,t){for(let[n,r]of po)if(r.canHandle(e)){let[i,a]=r.serialize(e,t);return[{type:ao.HANDLER,name:n,value:i},a]}return[{type:ao.RAW,value:e},wo.get(e)??[]]}function ko(e,t){switch(e.type){case ao.HANDLER:return po.get(e.name).deserialize(e.value,t);case ao.RAW:return e.value}}function Ao(e,t,n=[]){return new Promise(r=>{let i=Fo();e.pendingListeners.set(i,r),e.endpoint.postMessage({id:i,...t,markerID:e.rootMarkerID},n)})}var jo=[],Mo=`0123456789abcdef`;for(let e=0;e<256;e++)jo[e]=Mo[e>>4&15]+Mo[e&15];var No=0,Po=``;function Fo(){let e=0;if(!Po||No+16>512)for(Po=``,No=0;e<256;++e)Po+=jo[Math.random()*256|0];return Po.substring(No,++No+16)}function Io(e,t){let n=new WeakMap;return e.start?.(),t.start?.(),{on(t,r){let i=e=>r(e.data);`addEventListener`in e?e.addEventListener(t,i):`addListener`in e?e.addListener(t,i):e.on(t,i),n.set(r,i)},off(t,r){let i=n.get(r);`removeEventListener`in e?e.removeEventListener(t,i):`removeListener`in e?e.removeListener(t,i):e.off(t,i),n.delete(r)},postMessage(e,n=[]){t.postMessage(e,n)}}}function Lo(e,t=e){return go(Io(e,t))}var Ro=p(k(((e,t)=>{ue();var n=ae!==void 0&&!!ae.hrtime,r=65535,i=10,a=n?1e9/i:1e3/i,o=n?()=>{let[e,t]=ae.hrtime();return e*1e9+t}:()=>performance.now();function s(e){return(o()-e)/a&r}t.exports=function(e){let t=o(),n=i*(e||5),a=[0],c=1,l=s(t)-1&r;return function(e){let o=s(t),u=o-l&r;for(u>n&&(u=n),l=o;u--;)c===n&&(c=0),a[c]=a[c===0?n-1:c-1],c++;e&&(a[c-1]+=e);let d=a[c-1],f=a.length<n?0:a[c===n?0:c];return a.length<i?d:(d-f)*i/a.length}}}))(),1),zo=class{fps=(0,Ro.default)(5);processingDuration=(0,Ro.default)(5);droppedFrames=0;presentedFrames=0;mistimedFrames=0;_drop(){++this.droppedFrames}_startTime=0;_startFrame(){this._startTime=performance.now()}onsubtitleFrameCallback=(e,{fps:t,processingDuration:n,droppedFrames:r})=>console.info(`%cFPS: %c%f %c| Frame Time: %c%d ms %c| Dropped Frames: %c%d %c| 5s Avg`,`color: #888`,`color: #0f0; font-weight: bold`,t.toFixed(1),`color: #888`,`color: #0ff; font-weight: bold`,n,`color: #888`,`color: #f00; font-weight: bold`,r,`color: #888`);_endFrame(e){++this.presentedFrames;let t=this.fps(1),n=performance.now(),r=this.processingDuration((n-this._startTime)/t),i=Math.max(0,n-e.expectedDisplayTime);i&&++this.mistimedFrames,this.onsubtitleFrameCallback?.(n,{fps:t,processingDuration:r,droppedFrames:this.droppedFrames,presentedFrames:this.presentedFrames,mistimedFrames:this.mistimedFrames,presentationTime:n,expectedDisplayTime:e.expectedDisplayTime+(i>0?t/1e3:0),frameDelay:i,width:e.width,height:e.height,mediaTime:e.mediaTime})}},Bo={rgb:`RGB`,bt709:`BT709`,bt470bg:`BT601`,smpte170m:`BT601`},Vo=class e{timeOffset;prescaleFactor;prescaleHeightLimit;maxRenderHeight;debug;renderer;ready;busy=!1;_video;_videoWidth=0;_videoHeight=0;_videoColorSpace=null;_canvas;_ro=new ResizeObserver(async()=>{await this.ready,this.resize()});_destroyed=!1;_lastDemandTime;_skipped=!1;_worker;constructor(t){if(!globalThis.Worker)throw Error(`Worker not supported`);if(!t)throw Error(`No options provided`);if(!t.video&&!t.canvas)throw Error(`You should give video or canvas in options.`);e._test(),this.timeOffset=t.timeOffset??0,this._video=t.video,this._canvas=t.canvas??document.createElement(`canvas`),this._video&&!t.canvas&&(this._canvas.className=`JASSUB`,this._canvas.style.position=`absolute`,this._canvas.style.pointerEvents=`none`,this._video.insertAdjacentElement(`afterend`,this._canvas));let n=this._canvas.transferControlToOffscreen();this.debug=t.debug?new zo:null,this.prescaleFactor=t.prescaleFactor??1,this.prescaleHeightLimit=t.prescaleHeightLimit??1080,this.maxRenderHeight=t.maxRenderHeight??0,this._worker=t.workerUrl?new Worker(t.workerUrl,{name:`jassub-worker`,type:`module`}):new Worker(new URL(new URL(`worker-dPoC1jvm.js`,import.meta.url).href,``+import.meta.url),{name:`jassub-worker`,type:`module`});let r=Lo(this._worker),i=t.modernWasmUrl??new URL(new URL(`jassub-worker-modern-C7bYVPj4.wasm`,import.meta.url).href,``+import.meta.url).href,a=t.wasmUrl??new URL(new URL(`jassub-worker-CLcXAXXL.wasm`,import.meta.url).href,``+import.meta.url).href,o=t.availableFonts??{};!o[`liberation sans`]&&!t.defaultFont&&(o[`liberation sans`]=new URL(new URL(`default-jVcJgvWm.woff2`,import.meta.url).href,``+import.meta.url).href),this.ready=new r({wasmUrl:e._supportsSIMD?i:a,width:n.width,height:n.height,subUrl:t.subUrl,subContent:t.subContent??null,fonts:t.fonts??[],availableFonts:o,defaultFont:t.defaultFont??`liberation sans`,debug:!!t.debug,libassMemoryLimit:t.libassMemoryLimit??0,libassGlyphLimit:t.libassGlyphLimit??0,queryFonts:t.queryFonts??`local`},Do(e=>this._getLocalFont(e)),To(n,[n])).then(e=>{this.renderer=e}),this._video?this.setVideo(this._video):this._ro.observe(this._canvas)}static _supportsSIMD;static _test(){if(e._supportsSIMD!=null)return;try{e._supportsSIMD=WebAssembly.validate(Uint8Array.of(0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,43,1,41,0,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,128,2,11))}catch{e._supportsSIMD=!1}let t=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(t instanceof WebAssembly.Module)||!(new WebAssembly.Instance(t)instanceof WebAssembly.Instance))throw Error(`WASM not supported`)}async resize(e=!!this._video?.paused,t=0,n=0){let r=this._video?.videoWidth??this._videoWidth,i=this._video?.videoHeight??this._videoHeight,a=this._getElementBoundingBox(this._video??this._canvas,r,i);if(!t||!n){let e=this._videoWidth/r||1,o=this._videoHeight/i||1,{width:s,height:c}=this._computeRenderSize(a.width*e,a.height*o);t=Math.round(s),n=Math.round(c)}this._video&&(this._canvas.style.width=Math.round(a.width)+`px`,this._canvas.style.height=Math.round(a.height)+`px`,this._canvas.style.top=a.y+`px`,this._canvas.style.left=a.x+`px`),await this.renderer._resizeCanvas(t,n,this._videoWidth||t,this._videoHeight||n),this._lastDemandTime&&await this._demandRender(e)}_getElementBoundingBox(e,t,n){let{clientWidth:r,clientHeight:i,offsetLeft:a,offsetTop:o}=e,s=t/n;return r/i>s?(n=i,t=i*s):(n=r/s,t=r),{x:a+(r-t)/2,y:o+(i-n)/2,width:t,height:n}}_computeRenderSize(e=0,t=0){if(t<=0||e<=0)return{width:0,height:0};let n=this.prescaleFactor<=0?1:this.prescaleFactor,r=self.devicePixelRatio||1,i=n<1?-1:1,a=t*r;return i*a*n<=i*this.prescaleHeightLimit?a*=n:i*a<i*this.prescaleHeightLimit&&(a=this.prescaleHeightLimit),this.maxRenderHeight>0&&a>this.maxRenderHeight&&(a=this.maxRenderHeight),e*=a/t,t=a,{width:e,height:t}}async setVideo(e){this._removeListeners(),this._video=e,this._ro.observe(e),typeof VideoFrame<`u`&&(e.addEventListener(`loadedmetadata`,this._boundUpdateColorSpace),this._updateColorSpace({target:e})),await this.ready,this._video.requestVideoFrameCallback((e,t)=>this._handleRVFC(t))}async _getLocalFont(e,t=`regular`){if(navigator.permissions?.query){let{state:e}=await navigator.permissions.query({name:`local-fonts`});if(e!==`granted`)return}for(let n of await self.queryLocalFonts()){let r=n.family.toLowerCase(),i=n.style.toLowerCase();if(r===e&&i===t){let e=await n.blob();return new Uint8Array(await e.arrayBuffer())}}}_handleRVFC(e){this._destroyed||(this.manualRender(e),this._video.requestVideoFrameCallback((e,t)=>this._handleRVFC(t)))}manualRender(e,t=!1){return this._lastDemandTime=e,this._demandRender(t)}async _demandRender(e=!1){let{mediaTime:t,width:n,height:r}=this._lastDemandTime;if(n!==this._videoWidth||r!==this._videoHeight)return this._videoWidth=n,this._videoHeight=r,await this.resize(e);if(this.busy){this._skipped=!0,this.debug?._drop();return}this.busy=!0,this._skipped=!1,this.debug?._startFrame(),await this.renderer._draw(t+this.timeOffset,e),this.debug?._endFrame(this._lastDemandTime),this.busy=!1,this._skipped&&await this._demandRender()}_boundUpdateColorSpace=this._updateColorSpace.bind(this);_updateColorSpace({target:e}){this._video.requestVideoFrameCallback(async()=>{if(!(this._destroyed||this._video!==e))try{let e=new VideoFrame(this._video);e.close(),await this.ready,await this.renderer._setColorSpace(Bo[e.colorSpace.matrix])}catch(e){console.warn(e)}})}_removeListeners(){this._ro.disconnect(),this._video?.removeEventListener(`loadedmetadata`,this._boundUpdateColorSpace)}async destroy(){if(!this._destroyed){this._destroyed=!0,this._canvas.remove(),this._removeListeners();try{await this.ready,await this.renderer?.[co]()}finally{this._worker.terminate()}}}};function Ho(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 Uo(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 Wo=`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 Go(e){for(var t,n={},r=0;r<Wo.length;r++){var i=Wo[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=Uo(m[0])),m.length===2&&(n.clip.scale=m[0]*1,n.clip.drawing=Uo(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(Go)},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 Ko(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(Go)}function qo(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=Ko(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?Uo(t[r+1]):[]})}return{raw:e,combined:n.map(function(e){return e.text}).join(``),parsed:n}}function Jo(e){var t=e.split(`:`);return t[0]*3600+t[1]*60+t[2]*1}function Yo(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]=Jo(s);break;case`Effect`:i[o]=Ho(s);break;case`Text`:i[o]=qo(s);break;default:i[o]=s}}return i}var Xo=[`Name`,`Fontname`,`Fontsize`,`PrimaryColour`,`SecondaryColour`,`OutlineColour`,`BackColour`,`Bold`,`Italic`,`Underline`,`StrikeOut`,`ScaleX`,`ScaleY`,`Spacing`,`Angle`,`BorderStyle`,`Outline`,`Shadow`,`Alignment`,`MarginL`,`MarginR`,`MarginV`,`Encoding`],Zo=[`Layer`,`Start`,`End`,`Style`,`Name`,`MarginL`,`MarginR`,`MarginV`,`Effect`,`Text`];function Qo(e){var t=Xo.concat(Zo);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 $o(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 es(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=Qo(a)),/^Style\s*:/i.test(a)&&t.styles.style.push($o(a,t.styles.format))),r===3&&(/^Format\s*:/i.test(a)&&(t.events.format=Qo(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(Yo(d,t.events.format))}}}return t}var ts={M:`m`,L:`l`,C:`b`};function ns(e){return e.instructions.map(function(e){var t,n=e.type,r=e.points;return(t=[ts[n]]).concat.apply(t,r.map(function(e){return[e.x,e.y]})).join(` `)}).join(` `)}var rs=function(e){return function(t){return function(n){return``+t+e+`&H`+n+`&`}}},is=rs(`c`),as=rs(`a`),os={c1:is(1),c2:is(2),c3:is(3),c4:is(4),a1:as(1),a2:as(2),a3:as(3),a4:as(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+`,`)+ns(e.drawing))+`)`},t:function(e){return e.map(function(e){return`t(`+[e.t1,e.t2,e.accel,ss(e.tag)]+`)`}).join(`\\`)}};function ss(e){return Object.keys(e).map(function(t){return`\\`+(os[t]||(function(e){return``+t+e}))(e[t])}).join(``)}var cs=e=>Array(e.buffered.length).fill(void 0).map((t,n)=>({index:n,start:e.buffered.start(n),end:e.buffered.end(n)})),ls=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})}),us=(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),ls(e))),unbufferRange:(t,n)=>r(()=>t>=n?Promise.resolve():(e.remove(t,n),ls(e))),updateTimestampOffset:t=>r(async()=>{e.timestampOffset=t}),endOfStream:()=>r(async()=>{if(!(t.readyState!==`open`||e.updating))try{t.endOfStream()}catch{}})}},ds=e=>e===void 0?void 0:new URL(e,document.baseURI).toString(),fs=e=>new Date(e).toISOString().slice(11,22),ps=1,ms=e=>new Map(es(e).styles.style.map((e,t)=>[e.Name,t+ps])),hs=(e,t)=>{let n=t.replace(/^\*+/,``),r=n.toLowerCase()==="default"?`Default`:n;return e.styles.get(r)??e.styles.get(`Default`)??0},gs=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:ms(e.content)}:(console.warn(`subtitle stream ${e.streamIndex} has no Events format, ignoring the track`),null)},_s=(e,t)=>{let[n,r]=t.content.split(`,`),i=Number(n),a=`Dialogue: ${r},${fs(t.start)},${fs(t.end)},${t.content.replace(`${i},${r},`,``)}`,o=es(`${e.eventsContent}\r\n${a}`).events.dialogue[0];if(!o)throw Error(`dialogue event is undefined`);return{type:`dialogue`,streamIndex:t.streamIndex,index:i,assEvent:{Name:o.Name??``,Effect:o.Effect?.name??``,Layer:o.Layer,MarginL:o.MarginL,MarginR:o.MarginR,MarginV:o.MarginV,Style:hs(e,o.Style),Text:o.Text.raw,Start:o.Start*1e3,Duration:(o.End-o.Start)*1e3,ReadOrder:i}}},vs=e=>{let{video:t,container:n,workerUrl:r}=e,i=ds(e.wasmUrl),a=ds(e.legacyWasmUrl),o=ds(e.defaultFontUrl),s,c=[],l=new Map,u=[],d=new Map,f,p=e.onStreams,m=!1,h=e=>{console.warn(`the subtitle renderer failed; the file plays without subtitles`,e)},g=e=>{let t=s;t&&t.ready.then(()=>s===t?e(t.renderer):void 0).catch(h)},_=!1,v=()=>{_||(_=!0,queueMicrotask(()=>{_=!1;let e=s;e&&t.videoWidth&&e.ready.then(()=>{if(s===e)return e.manualRender({expectedDisplayTime:performance.now(),width:t.videoWidth,height:t.videoHeight,mediaTime:t.currentTime},!0)}).catch(h)}))},y=[`loadedmetadata`,`seeked`,`pause`],b=()=>v(),x=e=>{let l=document.createElement(`canvas`);n.append(l);try{s=new Vo({video:t,canvas:l,subContent:e.content,workerUrl:r,modernWasmUrl:i,...a?{wasmUrl:a}:{},fonts:c.map(([,e])=>e),availableFonts:{...Object.fromEntries(c),...o?{"liberation sans":o}:{}},queryFonts:!1})}catch(e){l.remove(),h(e);return}s.ready.catch(h);for(let e of y)t.addEventListener(e,b);o&&g(e=>{Promise.resolve(e.addFonts([o])).then(v,h)}),v()};return{pushAttachments:e=>{c=[...c,...e.map(e=>[e.filename,new Uint8Array(e.data)])]},pushFragments:e=>{let t=[];for(let n of e)if(n.type===`header`){if(l.has(n.streamIndex))continue;let e=gs(n);if(!e)continue;l.set(n.streamIndex,e),u.push({streamIndex:n.streamIndex,title:n.title,language:n.language}),p?.([...u]),f===void 0&&(f=n.streamIndex),!s&&!m&&x(e)}else{let e=l.get(n.streamIndex);if(!e)continue;let r=d.get(n.streamIndex);r||(r=new Map,d.set(n.streamIndex,r));let i=_s(e,n);if(r.has(i.index))continue;r.set(i.index,i),f===n.streamIndex&&t.push(i.assEvent)}t.length&&(g(e=>Promise.all(t.map(t=>e.createEvent(t)))),v())},selectStream:e=>{let t=e??-1;if(t===f||!s)return;f=t;let n=l.get(t),r=[...d.get(t)?.values()??[]].map(e=>e.assEvent);g(e=>{let t=[e.freeTrack()];if(n){t.push(e.setTrack(n.content));for(let n of r)t.push(e.createEvent(n))}return Promise.all(t)}),v()},getStreams:()=>[...u],getSelectedStream:()=>f,setOnStreams:e=>{p=e},destroy:()=>{m=!0;let e=s;s=void 0;for(let e of y)t.removeEventListener(e,b);e?.destroy().catch(()=>{})}}},ys=class extends Error{mediaElement=!0;constructor(e,t){super(e,t),this.name=`MediaElementError`}},bs=e=>!!e&&typeof e==`object`&&e.mediaElement===!0,xs=-20,Ss=60,Cs=30,ws=-5,Ts=20,Es=5,Ds=15e3,Os=1,ks=3,As=12,js=200,Ms=250,Ns=25e5,Ps=e=>{let{worker:t}=e,n=setTimeout(()=>t.terminate(),2e3);e.destroy().catch(()=>{}).finally(()=>{clearTimeout(n),t.terminate()})},Fs=async e=>{let{videoElement:t,subtitleContainer:n,read:r,length:i,publicPath:a,libavWorkerUrl:o,jassubWorkerUrl:s,jassubWasmUrl:c,jassubLegacyWasmUrl:l,defaultFontUrl:u,bufferSize:d=Ns,audioStreamIndex:f,onReady:p,onError:m,onRecovered:h,onSeek:g,onSubtitleStreams:_,onAudioStreams:v}=e,y=await to({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(()=>Ps(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=vs({video:t,container:n,workerUrl:s,wasmUrl:c,legacyWasmUrl:l,defaultFontUrl:u,onStreams:_});if(b.push(()=>a.destroy()),e.attachments?.length&&a.pushAttachments(e.attachments),!e.info.output.videoMimeType)throw Error(`The video codec in this file could not be identified`);let o=[e.info.output.videoMimeType,e.info.output.audioMimeType].filter(Boolean).join(`,`),d=`video/mp4; codecs="${o}"`;if(!MediaSource.isTypeSupported(d))throw Error(`This browser cannot play the codecs in this file: ${o}`);let C=new MediaSource,w=URL.createObjectURL(C);b.push(()=>URL.revokeObjectURL(w)),t.src=w,b.push(()=>{try{t.pause()}catch{}t.removeAttribute(`src`),t.load()});let T=await new Promise((t,n)=>{let r=setTimeout(()=>{i(),n(Error(`The MediaSource never opened`))},Ds),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}=us(T,C);await E(e.data),e.subtitles?.length&&a.pushFragments(e.subtitles),p?.();let A=!1,ee=!1,j=0,M,N=()=>M??t.currentTime,P=!1,te=0,F=0,I=null,ne=0,L=0,R=!1,re=0,ie=(e,t,n=!1)=>{let r=e?.message===`Cancelled`;t&&r||(console.error(e),(!R||n)&&(R=!0,m?.(r?Error(`Reading the video file failed`,{cause:e}):e)))},ae=async(e=!1)=>{if(j>0&&!e)return;let n=t.currentTime,r=e?ws:xs,i=e?Ts:Ss;for(let{start:e,end:t}of cs(T))e<n+r&&await D(e,n+r),t>n+i&&await D(n+i,t)},z=()=>{let e=cs(T);if(!e.length)return!0;let t=N(),n=e.find(e=>e.start<=t+Os&&t<e.end);return n&&n.end>=t+Ss?!1:!n||n.end<t+Cs},oe=()=>{let e=t.currentTime;return cs(T).find(t=>t.start<=e+Os&&e<t.end)},se=()=>{let e=oe();return!!e&&e.end>=L-.1},ce=()=>{let e=cs(T).map(e=>e.end);e.length&&(L=Math.max(L,...e))},le=async e=>{ee=!0,I=null,ne=0,re=e;let t=++F;try{let{data:n,pts:r,subtitles:i,finished:o}=await y.seek(e);if(x||t!==F||(o&&(P=!0),i?.length&&a.pushFragments(i),await O(r),x||t!==F))return;n.byteLength&&(await E(n),ce())}catch(e){ie(e,x||t!==F)}finally{t===F&&(ee=!1)}},ue=async()=>{let e=I;if(e)try{await E(e),ce(),I===e&&(I=null,ne=0)}catch(n){if(I!==e)return;if(n?.name===`QuotaExceededError`){let n=await ae(!0).then(()=>!0,()=>!1);if(I!==e)return;if(n){P=!1,await le(oe()?.end??t.currentTime);return}}if(ne+=1,ne<Es)return;throw I=null,n}},de=async()=>{if(A||ee||V!==void 0||x||!I&&(P||!z()))return;let e=++te,t=F,n=()=>x||e!==te||t!==F;A=!0;try{if(!I){let{data:e,subtitles:t,finished:r}=await y.read();if(n()||(r&&(P=!0),t?.length&&a.pushFragments(t),!e.byteLength))return;I=e,ne=0}await ue(),!n()&&R&&(R=!1,h?.())}catch(e){ie(e,n())}finally{e===te&&(A=!1)}},B=e=>e>=re&&!!oe(),fe=e=>cs(T).some(t=>t.start<=e+Os&&e<t.end),pe=e=>{let t=cs(T).find(t=>t.start<=e+Os&&e<t.end);return t?t.end-e:0},me=async e=>{if(!x&&!(pe(e)>=ks)){P=!1,j++,M=e;try{fe(e)||await le(e);let t=F;for(let n=0;n<As&&!(x||t!==F||P||pe(e)>=ks);n++){let t=pe(e);if(await de(),pe(e)<=t)break}}finally{j--,M===e&&(M=void 0)}}},he=0,ge=null,_e,ve=e=>{let t=performance.now(),n=t-he;if(n>=js){he=t,ge=null,g?.(e);return}ge=e,!_e&&(_e=setTimeout(()=>{_e=void 0;let e=ge;ge=null,!(e===null||x)&&(he=performance.now(),g?.(e))},js-n))};b.push(()=>{_e&&clearTimeout(_e)});let ye=0,V;b.push(()=>{V&&clearTimeout(V)});let be=()=>{let n=t.currentTime,r=e.info.input.duration||t.duration;r>0&&ve(Math.min(Math.max(n/r,0),1));let i=performance.now(),a=i-ye<Ms;if(ye=i,!B(n)&&!(ee&&Math.abs(n-re)<.001)){if(P=!1,V&&clearTimeout(V),!a){V=void 0,le(n);return}V=setTimeout(()=>{if(V=void 0,x)return;let e=t.currentTime;B(e)||(P=!1,le(e))},Ms)}};t.addEventListener(`seeking`,be),b.push(()=>t.removeEventListener(`seeking`,be));let H=!1,U=()=>{if(H)return;H=!0;let e=t.error;ie(new ys(`the media element failed: ${e?.message??`unknown`}`,{cause:e}),!1,!0)};t.addEventListener(`error`,U),b.push(()=>t.removeEventListener(`error`,U));let W=setInterval(()=>{H||t.error||(ae().catch(()=>{}),de().catch(e=>ie(e,!1)),P&&!I&&se()&&C.readyState===`open`&&k().catch(()=>{}))},100);return b.push(()=>clearInterval(W)),{destroy:S,prepareSeek:me,videoElement:t,selectSubtitleStream:e=>a.selectStream(e),indexes:e.indexes??[],chapters:e.chapters??[],duration:e.info.input.duration,videoMimeType:e.info.output.videoMimeType,audioMimeType:e.info.output.audioMimeType}}catch(e){throw S(),e}},Is=5,Ls=500,Rs=320,zs=1e6,Bs=3,Vs=1e4,Hs=1.5,Us=4e6,Ws=3e4,Gs=async e=>{let{publicPath:t,workerUrl:n,length:r,read:i,onThumbnails:a,width:o=Rs}=e,s=await no({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??Is,n/Ls),c=[],l=e=>{let t=[];for(let[a,o]of e.entries()){let s=t.at(-1);s&&o.timestamp-s.timestamp<i||t.push({timestamp:o.timestamp,endTime:n,startByte:o.pos,endByte:Math.min((e[a+1]?.pos??r)+zs,r),done:!1,attempts:0})}for(let[e,r]of t.entries())r.endTime=t[e+1]?.timestamp??n;return t.length>1&&t.at(-1).timestamp>n-i*2&&t.pop(),t};c=l(t.indexes);let u=[],d=!1,f=[],p=!1,m,h=-1,g=!1,_=!1,v,y=()=>{let e=m;if(e!==void 0){let t=f.findIndex(({timestamp:t,endTime:n})=>t<=e&&e<n);if(t>=0)return t}return 0},b=()=>{let e=[];for(let[t,n]of u.entries()){n.startTime-(e.at(-1)?.endTime??0)>.01&&e.push({url:``,startTime:e.at(-1)?.endTime??0,endTime:n.startTime}),e.push(n);let r=u[t+1];r&&r.startTime-n.endTime>.01&&e.push({url:``,startTime:n.endTime,endTime:r.startTime})}let t=e.at(-1)?.endTime??0;n-t>.01&&e.push({url:``,startTime:t,endTime:n}),a(e)},x=async e=>{if(d)return;let t=await Promise.race([s.readKeyframe(e.timestamp),new Promise((e,t)=>setTimeout(()=>t(Error(`timed out`)),Vs))]),n=await createImageBitmap(new Blob([t],{type:`image/png`})),r=new OffscreenCanvas(o,Math.max(1,Math.round(n.height*(o/n.width))));r.getContext(`2d`).drawImage(n,0,0,r.width,r.height),n.close();let i=await r.convertToBlob({type:`image/webp`,quality:.7});d||(u=[...u,{url:URL.createObjectURL(i),startTime:e.timestamp,endTime:e.endTime}].sort((e,t)=>e.startTime-t.startTime),b())},S=()=>{if(p||d||_)return;if(g){g=!1;let e=v;w(T(e)).then(()=>{E(e),S()});return}if(!f.length)return;let e=f.splice(y(),1)[0];p=!0,x(e).catch(()=>{e.attempts+=1,e.done=e.attempts>=Bs}).finally(()=>{p=!1,S()})},C=e=>{e.done=!0,f.push(e),S()},w=async e=>{_=!0;try{let t=await Promise.race([s.init(),new Promise((e,t)=>setTimeout(()=>t(Error(`timed out`)),Ws))]);if(d)return;h=e;let n=l(t.indexes);if(!n.length)return;let r=new Map(u.map(e=>[e.startTime,e]));for(let e of n)r.has(e.timestamp)&&(e.done=!0);c=n;let i=new Set(n.map(e=>e.timestamp));for(let e of u)i.has(e.startTime)||URL.revokeObjectURL(e.url);u=n.filter(e=>r.has(e.timestamp)).map(e=>({url:r.get(e.timestamp).url,startTime:e.timestamp,endTime:e.endTime})),f.length=0,b()}catch{}finally{_=!1}},T=e=>e?e.reduce((e,[,t])=>Math.max(e,t),0):r,E=e=>{for(let t of c)t.done||(!e||e.some(([e,n])=>e<=t.startByte&&t.endByte<=n))&&C(t)};return b(),{update:e=>{if(d)return;v=e;let t=T(e);h<0?h=t:(t>=Math.max(h*Hs,h+Us)||t>=r&&h<r)&&(g=!0),E(e),S()},prioritize:e=>{d||(m=e)},destroy:()=>{d=!0,f.length=0;for(let e of u)URL.revokeObjectURL(e.url);u=[],Ps(s)}}}catch(e){throw Ps(s),e}},Ks=1280,qs=1920,Js=250,Ys=100,Xs=()=>typeof HTMLCanvasElement<`u`&&`captureStream`in HTMLCanvasElement.prototype,Zs=()=>typeof document<`u`&&typeof HTMLVideoElement<`u`&&typeof HTMLVideoElement.prototype.requestPictureInPicture==`function`&&!!document.pictureInPictureEnabled,Qs=()=>typeof HTMLVideoElement<`u`&&`mozCaptureStream`in HTMLVideoElement.prototype,$s=()=>Xs()?Zs()?`window`:Qs()?`burn-in`:null:null,ec=e=>{let{video:t,subtitles:n}=e,r=e.mode??$s()??`window`,i=e.maxWidth??(r===`burn-in`?qs:Ks),a,o,s,c=!1,l=!1,u=!1,d=!1,f,p=()=>r===`burn-in`?!!a:!!a&&document.pictureInPictureElement===a.mirror,m=(e,r)=>{r.drawImage(t,0,0,e.width,e.height);let i=n.querySelector(`canvas`);i&&i.width>0&&i.height>0&&r.drawImage(i,0,0,e.width,e.height)},h=()=>{a&&m(a.composite,a.context)},g=`requestVideoFrameCallback`in t,_=()=>{h(),v()},v=()=>{!d&&a&&(o=g?t.requestVideoFrameCallback(_):requestAnimationFrame(_))},y=()=>{o!==void 0&&(g?t.cancelVideoFrameCallback(o):cancelAnimationFrame(o)),s!==void 0&&clearInterval(s),o=void 0,s=void 0},b=()=>{`mediaSession`in navigator&&(navigator.mediaSession.playbackState=t.paused?`paused`:`playing`)},x=()=>{c||l||!t.paused||t.play().catch(()=>{})},S=()=>{c||l||(t.paused||t.pause(),r!==`burn-in`&&(c=!0,a?.mirror.play().catch(()=>{}).finally(()=>{c=!1})))},C=()=>{b(),a?.mirror.play().catch(()=>{})},w=()=>{b(),r===`burn-in`&&a?.mirror.pause()},T=()=>{if(r!==`burn-in`||!a||!t.paused||l)return;l=!0;let{mirror:e}=a;h(),e.play().then(()=>new Promise(e=>{setTimeout(e,Ys)})).catch(()=>{}).finally(()=>{e.pause(),setTimeout(()=>{l=!1},Ys)})},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}},ee=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()},Js),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 ee()}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 tc(e){return typeof e==`string`}function nc(e){return typeof e==`number`}function K(e){return typeof e==`function`}function rc(e){return e===null}function q(e){return e===void 0}function ic(e){return typeof e==`object`&&!!e}function ac(e,t){let n={...t};for(let t in e)q(e[t])||(n[t]=e[t]);return n}function oc(e,t){let n={};for(let r of t)Object.hasOwn(e,r)&&(n[r]=e[r]);return n}var sc=Object.prototype.hasOwnProperty;function cc(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(!sc.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var lc=new Map,uc=new Set;function dc(e){return e.trim().replaceAll(`_`,`-`).toLowerCase()}function fc(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 pc(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 mc(e){return fc(dc(e))}function hc(e){let t=mc(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=pc(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 gc(e){let t={};for(let n=e.length-1;n>=0;n--){let r=e[n],i=lc.get(r);i&&Object.assign(t,i)}return t}function _c(e){return gc(hc(e))}function vc(e){return uc.add(e),()=>{uc.delete(e)}}function yc(e){return typeof e==`string`?e:e.text}function bc(e){return ic(e)&&`key`in e&&`text`in e}var xc=/\{([^{}]+)\}/g;function Sc(e,t){return t?e.replace(xc,(e,n)=>Object.hasOwn(t,n)?String(t[n]):e):e}function Cc(e,t,n){return typeof e==`string`?e:typeof t==`function`?t(e,n):Sc(yc(e),t??n)}function wc(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,Sc(o??(i?t.text:s)??String(a),c)}}A();var Tc=_(null);_(void 0);function Ec(){let e=C(Tc),[t,n]=O(e=>e+1,0);y(()=>vc(()=>n()),[]);let r=h(()=>wc(_c(`en`),`en`),[t]);return e?e.translator:r}function Dc(){return C(Tc)?.locale??`en`}function Oc(e){let t=e.closest(`[dir]`)?.getAttribute(`dir`);return t?t.toLowerCase()===`rtl`:getComputedStyle(e).direction===`rtl`}function kc(e){let t=e.composedPath();return t.length>0?t[0]:e.target}function Ac(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 jc(e=document){let t=e.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}function Mc(){return typeof CSS<`u`&&CSS.supports(`anchor-name: --a`)}var Nc=[`button`,`input`,`select`,`textarea`,`a[href]`,`[role="button"]`,`[role="menu"]`,`[role="menuitem"]`,`[role="menuitemcheckbox"]`,`[role="menuitemradio"]`,`[role="slider"]`,`[data-interactive]`].join(`,`),Pc=[`textarea`,`select`,`input:not([type])`,...[`text`,`search`,`url`,`tel`,`email`,`password`,`number`].map(e=>`input[type="${e}"]`),`[contenteditable]:not([contenteditable="false"])`].join(`,`);function Fc(e){return e.matches(Pc)}function Ic(e){let t=kc(e);return t instanceof Element&&Fc(t)}function Lc(e){let t=kc(e);return t instanceof Element&&t.closest(Nc)!==null}var Rc=new Set([` `,`Enter`]),zc=`button,a[href],[role="slider"],[role="button"]`;function Bc(e){if(!Rc.has(e.key))return!1;let t=kc(e);return t instanceof Element&&t.matches(zc)}function J(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function Vc(){return typeof navigator<`u`&&/mac/i.test(navigator.userAgent)}var Hc={sideOffset:0,boundaryOffset:0},Uc={top:`bottom`,bottom:`top`,left:`right`,right:`left`};function Wc(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 Gc(e,t,n,r,i=Hc){let a=r.side,o=Uc[a],s=a===`top`||a===`bottom`?t.height:t.width,c=Wc(e,n,a,i);return c>=s?a:Wc(e,n,o,i)>c?o:a}function Kc(e){try{e?.showPopover?.()}catch{}}function qc(e){try{e?.hidePopover?.()}catch{}}function Jc(e){return e instanceof Node&&e.nodeType===11&&`host`in e}function Yc(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 Xc(e){return e.kind===`captions`||e.kind===`subtitles`}function Zc(e,t){if(!(e instanceof HTMLElement))return null;for(let n of e.querySelectorAll(`track`))if(n.track===t)return n;return null}function Qc(e,t){return e.textTracks?Array.from(e.textTracks).filter(t).sort($c):[]}function $c(e,t){return e.kind>t.kind?1:e.kind<t.kind?-1:0}function el(e){let t=[];for(let n=0;n<e.length;n++)t.push([e.start(n),e.end(n)]);return t}function tl(e,t){let n=t;for(;n;){if(n===e||e.contains(n))return!0;let t=n.getRootNode();n=Jc(t)?t.host:n.parentNode}return!1}function nl(){return`WebKitPlaybackTargetAvailabilityEvent`in globalThis}function rl(e){return nl()&&`webkitCurrentPlaybackTargetIsWireless`in e}A();function il(e,t){if(K(e))return e(t);e!=null&&(e.current=t)}function al(...e){let t=e.flat();return e=>{let n=t.map(t=>il(t,e));if(n.some(K))return()=>{for(let e=0;e<n.length;e++){let r=n[e];K(r)?r():il(t[e],null)}}}}function ol(...e){return P(al(...e),[...e])}A();function sl(e,t,n,r=cc){let i=d(void 0),a=()=>{let e=n(t());return i.current!==void 0&&r(i.current,e)?i.current:(i.current=e,e)};return R(e,a,a)}function cl(e){return e}function ll(...e){}function ul(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 dl(e,t,n){return sl(t=>e.subscribe(t),()=>e.current,t??cl,n)}var fl=()=>ll;function pl(e,t,n){return sl(t?t=>e.subscribe(t):fl,t?()=>e.state:()=>e,t??cl,n)}A();var ml=_(null),hl=()=>{},gl={state:{},subscribe:()=>hl};function _l({value:e,children:t}){return I(ml.Provider,{value:e,children:t})}function vl(){let e=C(ml);if(!e)throw Error(`usePlayerContext must be used within a Player Provider`);return e}function yl(e){let{store:t}=vl();return pl(t,e)}function bl(e){let t=C(ml),n=pl(t?.store??gl,t?e:void 0);return t?n:void 0}function xl(){let{media:e}=vl();return e}function Sl(){let{container:e}=vl();return e}function Cl(){return C(ml)?.container??null}function wl(){return C(ml)?.popupGroup}function Tl(){return C(ml)?.setMedia}function El(){return C(ml)?.setContainer}function Dl(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 Ol=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),Dl([this.#e.signal,t.signal])}};function kl(...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 Al=class extends Error{code;cause;constructor(e,t){super(t?.message??e),this.name=`StoreError`,this.code=e,this.cause=t?.cause}};function jl(){throw new Al(`NO_TARGET`)}function Ml(){throw new Al(`DESTROYED`)}var Nl={target:jl,signals:new Ol,get:jl,set:jl};function Pl(e){let t=e.state(Nl),n=Object.keys(t),r=n[0];return Object.assign(r?e=>{if(r in e)return oc(e,n)}:()=>void 0,{displayName:e.name})}function Fl(){return e=>e}var Il=!1;function Ll(){Il||(Il=!0,queueMicrotask(zl))}var Rl=new Set;function zl(){Il=!1;for(let e of Rl)e.flush();Rl.clear()}var Bl=Object.prototype.hasOwnProperty,Vl=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(!Bl.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 ll;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,Rl.add(this),Ll()}};function Hl(e){return new Vl(e)}var Ul=Symbol.for(`@videojs/store`);function Wl(){return(e,t={})=>{let n=null,r=!1,i=new AbortController,a=new Ol,o;function s(){r&&Ml(),n||jl()}let c=e.state({target:()=>(s(),n),signals:a,get:()=>o.current,set:e=>o.patch(e)});o=Hl(c);let l={[Ul]:!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&&Ml(),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(){rc(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 Gl=Fl();function Kl(e,t){if(arguments.length===1)return Gl(e);let{name:n,state:r,attach:i}=e,a=e=>Gl({...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 ql=Object.freeze({length:0,start:()=>0,end:()=>0}),Jl=Object.assign(new EventTarget,{length:0,*[Symbol.iterator](){},getTrackById:()=>null}),Yl=new EventTarget;Object.freeze({});var Xl=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 Zl(e){return e.readyState>=1}function Ql(e){if(!ic(e))return!1;let t=e;return!q(t.paused)&&!q(t.ended)&&K(t.pause)}function $l(e){if(!ic(e))return!1;let t=e;return!q(t.currentTime)&&!q(t.duration)&&!q(t.seeking)}function eu(e){if(!ic(e))return!1;let t=e;return!q(t.src)&&!q(t.currentSrc)&&!q(t.readyState)&&K(t.load)}function tu(e){if(!ic(e))return!1;let t=e;return!q(t.volume)&&!q(t.muted)}function nu(e){return ic(e)?!q(e.playbackRate):!1}function ru(e){if(!ic(e))return!1;let t=e;return!q(t.buffered)&&t.buffered!==ql&&!q(t.seekable)&&t.seekable!==ql}function iu(e){return ic(e)?!q(e.error):!1}function au(e){if(!ic(e))return!1;let t=e;return!q(t.textTracks)&&t.textTracks!==Jl}function ou(e){return ic(e)?!q(e.videoRenditions):!1}function su(e){return ic(e)?!q(e.audioTracks):!1}function cu(e){if(!ic(e))return!1;let t=e;return!q(t.videoWidth)&&!q(t.videoHeight)}function lu(e){if(!ic(e))return!1;let t=e;return ic(t.remote)&&t.remote!==Yl}function uu(e){return ic(e)?!q(e.streamType):!1}function du(e){if(!ic(e))return!1;let t=e;return!q(t.liveEdgeStart)&&!q(t.targetLiveWindow)}function fu(e){return ic(e)&&`querySelectorAll`in e&&K(e.querySelectorAll)}var pu={ON_DEMAND:`on-demand`,LIVE:`live`,UNKNOWN:`unknown`};function mu(e,t){return e.id||String(t)}function hu(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 gu=Kl({name:`audioTrack`,state:({target:e})=>({audioTrackList:[],selectAudioTrack(t){let{media:n}=e();if(!su(n))return;let r=[...n.audioTracks],i=r.find((e,n)=>mu(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=()=>su(r)?r.audioTracks:null,s=(e=o())=>{n({audioTrackList:e?[...e].map(hu):[]})},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})}}),_u=Kl({name:`buffer`,state:()=>({buffered:[],seekable:[]}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!ru(r))return;let i=()=>n({buffered:el(r.buffered),seekable:el(r.seekable)});i(),J(r,`progress`,i,{signal:t}),J(r,`emptied`,i,{signal:t})}});function vu(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 yu=250,bu=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!Lc(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>yu||Lc(e))return;let n=e.pointerType,r=e.clientX,i=this.#e,a=this.#t,o={resolve:e=>wu(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}}},xu=new WeakMap;function Su(e){return xu.get(e)}function Cu(e){let t=xu.get(e);return t||(t=new bu(e),xu.set(e,t)),t}function wu(e,t,n,r,i){let a=i.getBoundingClientRect(),o=Tu(e,t,n),s=o.size>0?vu(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 Tu(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 Eu(e){let t=e;if(ic(t.remote)&&`state`in t.remote&&`prompt`in t.remote)return t.remote}function Du(e){return Eu(e)?.state===`connected`}function Ou(e){return Eu(e)?.state===`connecting`}async function ku(e){let t=Eu(e);if(!t)throw new DOMException(`Remote playback not supported`,`NotSupportedError`);return t.prompt()}var Au=2e3,ju=250,Mu=500,Nu=Kl({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(!Ql(i)||rc(a))return;let o=e=>e||i.paused||Du(i)||Ou(i),s;function c(){clearTimeout(s),s=void 0}function l(){c(),s=setTimeout(d,Au)}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<Mu;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<ju){if(Su(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}),lu(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()}}),Pu=Kl({name:`error`,state:({set:e})=>({error:null,dismissError(){e({error:null})}}),attach({target:e,signal:t,set:n}){let{media:r}=e;iu(r)&&(J(r,`error`,()=>n({error:r.error}),{signal:t}),J(r,`emptied`,()=>n({error:null}),{signal:t}))}});function Fu(){let e=document;return e.fullscreenEnabled||e.webkitFullscreenEnabled?!0:K(document.createElement(`video`).webkitSetPresentationMode)}function Iu(){let e=document;return e.fullscreenElement??e.webkitFullscreenElement??null}function Lu(e){if(!(e instanceof Element))return!1;try{return e.matches(`:fullscreen`)}catch{return!1}}function Ru(e,t){if(t.webkitPresentationMode===`fullscreen`)return!0;let n=Iu();return n&&(n===e||n===t)||Lu(e)||Lu(t)?!0:t.isFullscreen??!1}async function zu(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 Bu(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 Vu(){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 Hu(e){return e.webkitPresentationMode===`picture-in-picture`||document.pictureInPictureElement===e?!0:e.isPictureInPicture??!1}async function Uu(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 Wu(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 Gu=Kl({name:`fullscreen`,state:({target:e})=>({fullscreen:!1,fullscreenAvailability:`unavailable`,async requestFullscreen(){let{media:t,container:n}=e();return Hu(t)&&await Wu(t),zu(n,t)},async exitFullscreen(){let{media:t}=e();return Bu(t)},async toggleFullscreen(){let{media:t,container:n}=e();return Ru(n,t)?Bu(t):(Hu(t)&&await Wu(t),zu(n,t))}}),attach({target:e,signal:t,set:n}){let{media:r,container:i}=e;n({fullscreenAvailability:Fu()?`available`:`unsupported`});let a=()=>n({fullscreen:Ru(i,r)});a(),J(document,`fullscreenchange`,a,{signal:t}),J(document,`webkitfullscreenchange`,a,{signal:t}),`webkitPresentationMode`in r&&J(r,`webkitpresentationmodechanged`,a,{signal:t})}}),Ku=Kl({name:`live`,state:()=>({liveEdgeStart:NaN,targetLiveWindow:NaN}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!du(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})}}),qu=Kl({name:`pip`,state:({target:e})=>({pip:!1,pipAvailability:`unavailable`,async requestPictureInPicture(){let{media:t,container:n}=e();return Ru(n,t)&&await Bu(t),Uu(t)},async exitPictureInPicture(){let{media:t}=e();return Wu(t)},async togglePictureInPicture(){let{media:t,container:n}=e();return Hu(t)?Wu(t):(Ru(n,t)&&await Bu(t),Uu(t))}}),attach({target:e,signal:t,set:n}){let{media:r}=e;n({pipAvailability:Vu()?`available`:`unsupported`});let i=()=>n({pip:Hu(r)});i(),J(r,`enterpictureinpicture`,i,{signal:t}),J(r,`leavepictureinpicture`,i,{signal:t}),`webkitPresentationMode`in r&&J(r,`webkitpresentationmodechanged`,i,{signal:t})}}),Ju=Kl({name:`playback`,state:({target:e})=>({paused:!0,ended:!1,started:!1,waiting:!1,play(){return e().media.play()},pause(){let{media:t}=e();Ql(t)&&t.pause()},togglePaused(){let t=e().media;return Ql(t)?t.paused?(t.play(),!0):(t.pause(),!1):!1}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Ql(r)||!$l(r)||!eu(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})}}),Yu=[.2,.5,.7,1,1.2,1.5,1.7,2],Xu=Kl({name:`playbackRate`,state:({target:e})=>({playbackRates:Yu,playbackRate:1,setPlaybackRate(t){let{media:n}=e();nu(n)&&(n.playbackRate=t)}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!nu(r))return;let i=()=>n({playbackRate:r.playbackRate});i(),J(r,`ratechange`,i,{signal:t})}}),Zu=`auto`;function Qu(e,t){return e.id||String(t)}function $u(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 ed(e){return e.width&&e.height?Math.min(e.width,e.height):e.height??e.width}var td=Kl({name:`quality`,state:({target:e})=>({videoRenditionList:[],activeVideoRendition:null,selectVideoRendition(t){let{media:n}=e();if(!ou(n))return;if(t===Zu){n.videoRenditions.selectedIndex=-1;return}let r=[...n.videoRenditions].findIndex((e,n)=>Qu(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=()=>ou(r)?r.videoRenditions:null,s=e=>{if(!e)return null;let t=[...e],n=t.find(e=>e.active);if(n)return n;if(!cu(r)||!r.videoWidth&&!r.videoHeight)return null;let i=ed({width:r.videoWidth||void 0,height:r.videoHeight||void 0}),a=t.filter(e=>ed(e)===i);return a.length===1?a[0]:null},c=(e=o())=>{let t=s(e);n({videoRenditionList:e?[...e].map($u):[],activeVideoRendition:t?$u(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})}}),nd=Kl({name:`remotePlayback`,state:({target:e})=>({remotePlaybackState:`disconnected`,remotePlaybackAvailability:`unsupported`,async toggleRemotePlayback(){let{media:t,container:n}=e();return Du(t)?ku(t):(Ru(n,t)&&await Bu(t),await ku(t))}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!lu(r))return;if(rl(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(()=>{})})}}),rd=Kl({name:`source`,state:({target:e,signals:t})=>({source:null,canPlay:!1,loadSource(n){t.clear();let{media:r}=e();return eu(r)?(r.src=n,r.load(),n):n}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!eu(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})}}),id=Kl({name:`streamType`,state:()=>({streamType:pu.UNKNOWN}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(uu(r)){let e=()=>n({streamType:r.streamType});e(),J(r,`streamtypechange`,e,{signal:t});return}if(!$l(r))return;let i=()=>{let{duration:e}=r;return e===1/0?pu.LIVE:Number.isFinite(e)&&e>0?pu.ON_DEMAND:pu.UNKNOWN},a=()=>n({streamType:i()});a(),J(r,`durationchange`,a,{signal:t}),J(r,`loadedmetadata`,a,{signal:t}),J(r,`emptied`,a,{signal:t}),ru(r)&&J(r,`progress`,a,{signal:t})}});function ad(e,t){return e.id||`track:${t}:${e.kind}:${e.language}:${e.label}`}var od=Kl({name:`textTrack`,state:({target:e})=>({chaptersCues:[],thumbnailCues:[],thumbnailTrackSrc:null,textTrackList:[],subtitlesShowing:!1,toggleSubtitles(t){let{media:n}=e();if(!au(n))return!1;let r=Qc(n,Xc);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(!au(n))return;let r=Array.from(n.textTracks).map((e,t)=>({index:t,track:e})).filter(({track:e})=>Xc(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})=>ad(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(!au(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:ad(i,n),kind:i.kind,label:i.label,language:i.language,mode:i.mode}),Xc(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=Zc(r,t)?.src??null);let d=fu(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})}}),sd={seek:Symbol.for(`@videojs/seek`)},cd=Kl({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(sd.seek);if(!$l(i)||!eu(i))return 0;if(!Zl(i)&&!await Ac(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 Ac(i,`seeked`,{signal:a}).catch(ll),i.currentTime}}),attach({target:e,signal:t,set:n,get:r}){let{media:i}=e;if(!$l(i))return;let a=()=>{let{duration:e}=i;if(e===1/0&&ru(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})}}),ld=.25,ud=Kl({name:`volume`,state:({target:e})=>({volume:1,muted:!1,volumeAvailability:`unavailable`,setVolume(t){let{media:n}=e();if(!tu(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 tu(t)?(t.muted||t.volume===0?(t.muted=!1,t.volume===0&&(t.volume=ld)):t.muted=!0,t.muted):!1}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!tu(r))return;n({volumeAvailability:dd()});let i=()=>n({volume:r.volume,muted:r.muted});i(),J(r,`volumechange`,i,{signal:t})}});function dd(){let e=document.createElement(`video`);try{return e.volume=.5,e.volume===.5?`available`:`unsupported`}catch{return`unsupported`}}Pl(gu);var fd=Pl(_u),pd=Pl(Nu),md=Pl(Pu),hd=Pl(Gu);Pl(Ku);var gd=Pl(qu),_d=Pl(Ju),vd=Pl(Xu);Pl(td),Pl(nd),Pl(rd),Pl(id);var yd=Pl(od),bd=Pl(cd),xd=Pl(ud),Sd={seekStep({store:e,value:t}){if(q(t))return;let n=bd(e.state);n&&n.seek(n.currentTime+t)},volumeStep({store:e,value:t}){if(q(t))return;let n=xd(e.state);n&&n.setVolume(n.volume+t)},speedUp({store:e}){let t=vd(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=vd(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])}},Cd={seekStep:Sd.seekStep,volumeStep:Sd.volumeStep,speedUp:Sd.speedUp,speedDown:Sd.speedDown};function wd(e){return Cd[e]||(({store:t})=>{let n=t.state[e];K(n)&&n()})}var Td=200,Ed=class{#e=0;#t=null;handleUp(e,t){if(e.resolve(`doubletap`).length>0){let n=Date.now();if(n-this.#e<Td){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)},Td);return}e.resolve(`tap`)[0]?.onActivate(t)}#n(){this.#t!==null&&(clearTimeout(this.#t),this.#t=null)}reset(){this.#n(),this.#e=0}},Dd=new WeakMap;function Od(e){let t=Dd.get(e);return t||(t=new Ed,Dd.set(e,t),t)}function kd(e,t,n){return Cu(e).add({type:`tap`,recognizer:Od(e),onActivate:t,pointer:n?.pointer,region:n?.region,disabled:n?.disabled,action:n?.action,value:n?.value})}function Ad(e,t,n){return Cu(e).add({type:`doubletap`,recognizer:Od(e),onActivate:t,pointer:n?.pointer,region:n?.region,disabled:n?.disabled,action:n?.action,value:n?.value})}function jd(e){return e.startsWith(`toggle`)}var Md={togglePaused({store:e}){let t=_d(e.state);t&&(t.paused?t.play():t.pause())},toggleMuted({store:e}){xd(e.state)?.toggleMuted()},toggleFullscreen({store:e}){let t=hd(e.state);t&&(t.fullscreen?t.exitFullscreen():t.requestFullscreen())},toggleSubtitles({store:e}){yd(e.state)?.toggleSubtitles()},togglePictureInPicture({store:e}){let t=gd(e.state);t&&(t.pip?t.exitPictureInPicture():t.requestPictureInPicture())},seekStep:Sd.seekStep,volumeStep:Sd.volumeStep,speedUp:Sd.speedUp,speedDown:Sd.speedDown,seekToPercent({store:e,value:t,key:n}){let r=bd(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 Nd(e){return Md[e]}var Pd={shift:`Shift`,ctrl:`Control`,alt:`Alt`,meta:`Meta`},Fd={shift:`Shift`,ctrl:`Ctrl`,alt:`Alt`,meta:`Meta`},Id=[`ctrl`,`shift`,`alt`,`meta`];function Ld(e){return e.map(e=>{let t=[];for(let n of Id)e.modifiers.has(n)&&t.push(Pd[n]);return t.push(e.originalKey),t.join(`+`)}).join(` `)}function Rd(e){let t=[];for(let n of Id)e.modifiers.has(n)&&t.push(Fd[n]);return t.push(zd(e.originalKey)),t.join(`+`)}function zd(e){return e.length===1?e.toUpperCase():e}var Bd=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:Hd(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:Ld(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`||Bc(e)||e.defaultPrevented)return;let t=Ic(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(Wd(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:Rd(e.parsed[0])}#h(){for(let e of this.#o)e()}},Vd=new Set([`shift`,`ctrl`,`alt`,`meta`]);function Hd(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(Vc()?`meta`:`ctrl`):Vd.has(t)&&r.add(t)}return[{modifiers:r,key:n===`Space`?` `:n.toLowerCase(),originalKey:n}]}function Ud(e){return e.length===1&&!/[a-z]/i.test(e)}function Wd(e,t){if(t.key===`Unidentified`||t.key.toLowerCase()!==e.key)return!1;let n=Ud(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 Gd=new WeakMap;function Kd(e){let t=Gd.get(e);return t||(t=new Bd(e),Gd.set(e,t)),t}function qd(e,t){return Kd(e).add(t)}var Jd=[Ju,Xu,td,gu,ud,cd,rd,_u,Gu,qu,nd,Nu,od,Pu];function Yd(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 Xd(e){let{onOpenChange:t}=e,n=null,r=null,i=null,a=Yd({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 Zd(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 Qd=`group`;function $d(e){let t=jc(e.ownerDocument);(!t||t===e.ownerDocument.body||!tl(e,t))&&e.focus({preventScroll:!0})}var ef={transitionStarting:`data-starting-style`,transitionEnding:`data-ending-style`};function tf(e){return{transitionStarting:e===`starting`,transitionEnding:e===`ending`}}function nf(e){let{onOpenChange:t,closeOnOutsideClick:n}=e,r=null,i=null,a=null,o=new Set,s=!1,c=null,l=Yd({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||(qc(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&&qc(i),i=e,e&&u.current.active&&Kc(e)}return{input:u,triggerProps:T,popupProps:E,get triggerElement(){return r},setTriggerElement:D,setPopupElement:O,open:S,close:C,destroy:l.destroy}}function rf(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 af(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 rf(n,r,Math.max(0,i-n),Math.max(0,a-r))}function of(e){let t=document.documentElement.getBoundingClientRect();return e?af(t,e.getBoundingClientRect()):t}function sf(e,t={}){if(!e)return null;if(!tc(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 cf={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 lf(e,t,n){return Math.max(t,Math.min(n,e))}function uf(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 df={sideOffset:0,alignOffset:0,boundaryOffset:0},ff={top:`bottom`,bottom:`top`,left:`right`,right:`left`};function pf(e){return`${lf(e,0,1/0)}px`}function mf(e,t,n,r){let i=n-r;return i<t?t:lf(e,t,i)}function hf(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 gf(e,t,n,r,i,a,o=cf){if(Mc())return{..._f(e,t,o,n,i,a),...n&&i?vf(n,i,t,a,o):{}};if(n&&r){let e=a??df;return{position:`fixed`,margin:`0`,...yf(n,r,t,e,i),...i?vf(n,i,t,e,o):{}}}return{}}function _f(e,t,n=cf,r,i,a=df){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=ff[c];if(c===`top`||c===`bottom`){if(d[f]=`calc(anchor(${c}) + ${o})`,r&&i){let{base:e,translate:t}=hf(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}=hf(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 vf(e,t,n,r=df,i=cf){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]=pf(t-r.sideOffset),a[i.availableWidth]=pf(l-c)}else{let t=o===`left`?e.left-c:l-e.right;a[i.availableWidth]=pf(t-r.sideOffset),a[i.availableHeight]=pf(d-u)}return a}function yf(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=mf(d,i.left+e,i.right-e,t.width):l=mf(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 bf(e,t=cf){let n=getComputedStyle(e);return{sideOffset:Yc(e,n.getPropertyValue(t.sideOffset)),alignOffset:Yc(e,n.getPropertyValue(t.alignOffset)),boundaryOffset:Yc(e,n.getPropertyValue(t.boundaryOffset))}}function xf(e,t){let n=e.getBoundingClientRect(),r=e.offsetWidth||n.width,i=e.offsetHeight||n.height;return rf(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 Sf(){let e=null;return{open(t){e!==t&&(e?.close(`group-open`),e=t)},close(t){e===t&&(e=null)}}}function Cf(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)?lf(i*100,0,100):0}function wf(e){let t=Hl({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?ul(t=>e.onValueChange?.(t),r,{leading:!0}):null;function d(t,n){n&&u?u(t):e.onValueChange?.(t)}function f(){if(rc(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=Cf(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(!rc(s)){if(n.pointerType!==`touch`&&n.buttons===0){p();return}let r=Cf(n,o,e.getOrientation(),a);c=r,t.patch({dragPercent:r,pointerPercent:r}),d(r,!0);return}let r=Cf(n,e.getElement().getBoundingClientRect(),e.getOrientation(),e.isRTL());t.patch({pointing:!0,pointerPercent:r})},onPointerUp(t){if(e.isDisabled()||(t.stopPropagation(),rc(s)))return;let n=Cf(t,o,e.getOrientation(),a);u?.cancel(),e.onValueChange?.(n),e.onValueCommit?.(n),l=!0},onPointerLeave(){rc(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=uf(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=lf(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 Tf={fill:`--media-slider-fill`,pointer:`--media-slider-pointer`,buffer:`--media-slider-buffer`};function Ef(e){return{[Tf.fill]:`${e.fillPercent.toFixed(3)}%`,[Tf.pointer]:`${e.pointerPercent.toFixed(3)}%`}}function Df(e){return{...Ef(e),[Tf.buffer]:`${e.bufferPercent.toFixed(3)}%`}}function Of(e,t){let n=e/2;return{position:`absolute`,left:t===`visible`?`calc(var(${Tf.pointer}) - ${n}px)`:`min(max(0px, calc(var(${Tf.pointer}) - ${n}px)), calc(100% - ${e}px))`,width:`max-content`,pointerEvents:`none`}}var kf=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 Af(e){let{getContainer:t,getImg:n,onStateChange:r}=e,i=new kf,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 jf={hover:`hover`,focus:`focus`,escape:`escape`,blur:`blur`,"imperative-action":`imperative-action`};function Mf(e){let t={transition:e.transition,onOpenChange(t,n){let r=jf[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=nf(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 Nf(){let e=Hl({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&&(Ff(i),Pf(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();If(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 Pf(e){e&&e.offsetHeight}function Ff(e){let t=e?.getAnimations?.({subtree:!0})??[];for(let e of t)e.cancel()}function If(e){if(!e)return Promise.resolve();let t=e.getAnimations?.()??[];return t.length===0?Promise.resolve():Promise.all(t.map(e=>e.finished)).then(ll,ll)}function Lf(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=lf(e.getPercent()-n*r,0,100);e.onValueChange?.(i)}}}function Rf(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 zf(e,t){let n={};for(let r in e){if(t&&!(r in t))continue;let i=t?.[r]??Bf(r),a=e[r];a===!0?n[i]=``:a&&(n[i]=String(a))}return n}function Bf(e){return`data-${e.toLowerCase()}`}var Vf={key:`container.label`,text:`Media player`};A();var Hf=c(function({children:e,tabIndex:t=0,role:n=Qd,"aria-label":r,"aria-labelledby":i,...a},o){let s=El(),c=Ec(),l=d(null),u=ol(o,l);y(()=>(s?.(l.current),()=>s?.(null)),[s]);let f=e=>{a.onPointerUp?.(e);let t=l.current;t&&$d(t)};return I(`div`,{ref:u,role:n,tabIndex:t,...r!==void 0||i!==void 0?{"aria-label":r,"aria-labelledby":i}:{"aria-label":c(Vf)},...a,onPointerUp:f,children:e})});A();function Y(e){let t=d(e);return t.current=e,t}A();function Uf(e,t,n){let r=d(null),i=Y(t),a=Y(n);y(()=>(r.current===null?i.current?.():(clearTimeout(r.current),r.current=null),()=>{r.current=setTimeout(()=>{a.current?.(),e.destroy()},0)}),[e])}A();function Wf(e){function t({children:t}){let[n,r]=D(()=>Wl()(kl(...e.features))),[i]=D(()=>Sf()),[a,o]=D(null),[s,c]=D(null);return Uf(n),y(()=>{if(a){if(n.destroyed){r(Wl()(kl(...e.features)));return}return n.attach({media:a,container:s})}},[a,s,n]),I(_l,{value:h(()=>({store:n,media:a,setMedia:o,container:s,setContainer:c,popupGroup:i}),[n,a,s,i]),children:t})}function n(e){let{store:t}=vl();return pl(t,e)}return{Provider:t,Container:Hf,usePlayer:n,useMedia:xl}}function Gf(e){return e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>=65&&e.charCodeAt(2)<=90}function Kf(e,t){return Gf(e)&&(typeof t==`function`||t===void 0)}function qf(e,t){return t?e?n=>{t(n),e(n)}:t:e}function Jf(e,t){return t&&e?`${t} ${e}`:t||e}function Yf(e,t){return t?e?{...e,...t}:t:e}function Xf(e,t){if(!t)return e;for(let n in t){let r=t[n];n===`className`?e.className=Jf(e.className,r):n===`style`?e.style=Yf(e.style,r):e[n]=Kf(n,r)?qf(e[n],r):r}return e}function Zf(...e){let t={};for(let n of e)t=Xf(t,n);return t}A();function Qf(e,t){return K(e)?e(t):e}function $f(e,t){return K(e)?e(t):e}function ep(e){let t=e;return t.ref??t.props?.ref}function X(e,t,n){let{className:a,style:o,render:s}=t,{state:c,ref:l,props:u,stateAttrMap:d}=n,f=Qf(a,c),p=$f(o,c),m=Zf(d?zf(c,d):{},...Array.isArray(u)?u:u?[u]:[]);if(f!==void 0&&(m.className=m.className?`${m.className} ${f}`:f),p!==void 0&&(m.style=m.style?{...m.style,...p}:p),K(s)){let e=al(l,m.ref);return s({...m,ref:e},c)}if(r(s)){let e=ep(s),t=al(l,m.ref,e),n=Zf(m,s.props);return n.ref=t,i(s,n)}return m.ref=al(l,m.ref),T(e,m)}A();function tp(e){let{displayName:t,onActivate:n,isDisabled:r}=e,i=P(e=>{},[t]);return{getButtonProps:P(e=>Zf(Zd({onActivate:n,isDisabled:r}),e),[n,r]),buttonRef:i}}A();function np(e,t){let n=Sl(),[r,i]=D({});return y(()=>{if(!n||!e){i({});return}let r=Kd(n),a=()=>i(r.getShortcut(e,t));return a(),r.subscribeShortcutChanges(a)},[n,e,t]),r}A(),_(null).Provider,_(null).Provider,_(null).Provider,_(null).Provider;var rp=_(!1);rp.Provider;function ip(){return C(rp)}_(null).Provider,A();var ap=_(null),op=ap.Provider;function sp(){let e=C(ap);if(!e)throw Error(`Tooltip compound components must be used within a Tooltip.Root`);return e}function cp(){return C(ap)}A();function lp(e,t){return e.getLabelParams?.(t)}function up(e){let{displayName:t,core:n,stateAttrMap:r,selector:i,action:a,hotkeyAction:o,hotkeyValue:s,tooltipLabel:l,isSupported:d}=e,f=new Set(Object.keys(n.defaultProps)),p=c(function(e,c){let{render:p,className:m,style:h,...g}=e,_={},v={};for(let e of Object.keys(g))f.has(e)?_[e]=g[e]:v[e]=g[e];let y=cp(),b=ip(),x=y?.setContent,S=yl(i),C=np(o,s?.(_)),w=Ec(),[T]=D(()=>new n);f.has(`menuTrigger`)&&q(_.menuTrigger)&&(_.menuTrigger=b),T.setProps(_);let{getButtonProps:E,buttonRef:O}=tp({displayName:t,onActivate:()=>{Promise.resolve(a(T,S)).catch(e=>{})},isDisabled:()=>!!_.disabled||!S});S&&T.setMedia(S);let k=S?T.getState():null,A=k?d?.(k)??!0:!1,ee=k&&A?Cc(T.getLabel(k),w,lp(T,k)):void 0,j=k&&A?l?.(T,k)??ee:void 0;if(u(()=>{if(x)return x(j?{label:j,shortcut:C.shortcut}:void 0),()=>x(void 0)},[x,j,C.shortcut]),!S||!k||!A)return null;let M=T.getAttrs(k),N=M[`aria-label`],P={...M,...bc(N)?{"aria-label":Cc(N,w,lp(T,k))}:void 0,"aria-keyshortcuts":C.aria};return X(`button`,{render:p,className:m,style:h},{state:k,stateAttrMap:r,ref:[c,O],props:[E(),P,v]})});return p.displayName=t,p}function dp(e,t){return K(e)?e(t)||void 0:e||void 0}var fp=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,...tf(e.status)}}getAttrs(e){return{role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":e.titleId,"aria-describedby":e.descriptionId}}},pp={open:`data-open`,...ef},mp=class e{static defaultProps={delay:500};state=Hl({visible:!1});#e={...e.defaultProps};#t=null;setProps(t){this.#e=ac(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)}},hp={visible:`data-visible`},gp=class{#e=null;setMedia(e){this.#e=e}getState(){let e=this.#e;return{visible:e.controlsVisible,userActive:e.userActive}}},_p={visible:`data-visible`,userActive:`data-user-active`},vp=class extends fp{setProps(){}},yp=`common.`,bp={key:`${yp}empty`,text:``},xp={key:`${yp}ok`,text:`OK`},Sp=`errors.`,Cp={key:`${Sp}aborted`,text:`You stopped media playback before it finished.`},wp={key:`${Sp}network`,text:`This media could not be loaded due to a network or server issue.`},Tp={key:`${Sp}decode`,text:`This media could not be played. It may be corrupted, or your browser may not support its format.`},Ep={key:`${Sp}source`,text:`This media could not be loaded. It may be unavailable, or your browser may not support its format.`},Dp={key:`${Sp}encrypted`,text:`This media could not be played because it could not be decrypted.`},Op={key:`${Sp}title`,text:`Something went wrong.`},kp={key:`${Sp}unexpected`,text:`An unexpected error occurred.`},Ap={[Xl.MEDIA_ERR_ABORTED]:Cp,[Xl.MEDIA_ERR_NETWORK]:wp,[Xl.MEDIA_ERR_DECODE]:Tp,[Xl.MEDIA_ERR_SRC_NOT_SUPPORTED]:Ep,[Xl.MEDIA_ERR_ENCRYPTED]:Dp,[Xl.MEDIA_ERR_CUSTOM]:bp},jp={[Xl.MEDIA_ERR_SRC_NOT_SUPPORTED]:[`Failed to open media`]};function Mp(e){return e>=Xl.MEDIA_ERR_ABORTED&&e<=Xl.MEDIA_ERR_ENCRYPTED}function Np(){return Op}function Pp(){return xp}function Fp(e,t){if(e){let t=Ap[e.code],n=e.message?.trim();if(n){let r=Xl.defaultMessages[e.code];if(t&&r&&n===r)return t;let i=jp[e.code];return t&&Mp(e.code)&&!e.context&&i?.includes(n)?t:n}if(t)return t}return t?.trim()||kp}var Ip=`fullscreen.`,Lp={key:`${Ip}enter`,text:`Enter fullscreen`},Rp={key:`${Ip}exit`,text:`Exit fullscreen`},zp=class e{static defaultProps={label:``,disabled:!1};state=Hl({fullscreen:!1,availability:`unavailable`,disabled:!0,hidden:!0,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=ac(t,e.defaultProps)}getLabel(e){return dp(this.#e.label,e)||(e.fullscreen?Rp:Lp)}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:yc(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()}},Bp={fullscreen:`data-fullscreen`,availability:`data-availability`,disabled:`data-disabled`,hidden:`data-hidden`},Vp={key:`playback.rate`,text:`Playback rate {rate}`},Hp=`volume.`,Up={key:`${Hp}mutedValue`,text:`{percent}, muted`};`${Hp}`;var Wp={key:`${Hp}label`,text:`Volume`};`${Hp}`;var Gp=Intl.DurationFormat,Kp=new Map;function qp(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 Jp(e){return e===void 0?``:Array.isArray(e)?e.join(`:`):e}function Yp(e){let t=Array.isArray(e)?e[0]:e;return!t||t===`en`||t.startsWith(`en-`)}function Xp(e,t=`long`,n){let r=`${Jp(e)}:${t}:${n??``}`,i=Kp.get(r);return i||(i=Gp?new Gp(e,n===void 0?{style:t}:{style:t,hoursDisplay:n}):qp(t,n),Kp.set(r,i)),i}function Zp(e){return nc(e)&&Number.isFinite(e)}function Qp(e,t){if(!Zp(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=Zp(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=Xp(`en`,`digital`,u?`always`:`auto`).format(f);return d||(p=p.replace(/^0(?=\d:)/,``)),`${n?`-`:``}${p}`}function $p(e){if(!Zp(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 em(e,t){if(!Zp(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=Xp(t?.locale,t?.style??`long`).format(s);if(n){let e=t?.formatRemaining;return e?e(c):Yp(t?.locale)?`${c} remaining`:c}return c}var tm=`buttons.`,nm={key:`${tm}play`,text:`Play`},rm={key:`${tm}pause`,text:`Pause`},im={key:`${tm}replay`,text:`Replay`},am={key:`${tm}mute`,text:`Mute`},om={key:`${tm}unmute`,text:`Unmute`},sm=class e{static defaultProps={label:``,disabled:!1};state=Hl({muted:!1,volumeLevel:`off`,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=ac(t,e.defaultProps)}getLabel(e){return dp(this.#e.label,e)||(e.muted?om:am)}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:cm(e)}),this.state.patch({label:yc(this.getLabel(this.state.current))}),this.state.current}toggle(e){this.#e.disabled||e.toggleMuted()}};function cm(e){return e.muted||e.volume===0?`off`:e.volume<.5?`low`:e.volume<.75?`medium`:`high`}var lm={muted:`data-muted`,volumeLevel:`data-volume-level`},um=`pip.`,dm={key:`${um}enter`,text:`Enter picture-in-picture`},fm={key:`${um}exit`,text:`Exit picture-in-picture`},pm=class e{static defaultProps={label:``,disabled:!1};state=Hl({pip:!1,availability:`unavailable`,disabled:!0,hidden:!0,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=ac(t,e.defaultProps)}getLabel(e){return dp(this.#e.label,e)||(e.pip?fm:dm)}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:yc(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()}},mm={pip:`data-pip`,availability:`data-availability`,disabled:`data-disabled`,hidden:`data-hidden`},hm=class e{static defaultProps={label:``,disabled:!1};state=Hl({paused:!0,ended:!1,started:!1,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=ac(t,e.defaultProps)}getLabel(e){return dp(this.#e.label,e)||(e.ended?im:e.paused?nm:rm)}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:yc(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()}}},gm={paused:`data-paused`,ended:`data-ended`,started:`data-started`},_m=class e{static defaultProps={label:``,disabled:!1,menuTrigger:!1};state=Hl({rate:1,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=ac(t,e.defaultProps)}getLabel(e){let t=dp(this.#e.label,e);return t===void 0?Vp:t}getLabelParams(e){if(dp(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:yc(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)}},vm={rate:`data-rate`},ym=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=ac(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,...tf(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}}},bm={open:`data-open`,side:`data-side`,align:`data-align`,...ef},xm=`seek.`,Sm={key:`${xm}forward`,text:`Seek forward {seconds} seconds`},Cm={key:`${xm}backward`,text:`Seek backward {seconds} seconds`},wm=class e{static defaultProps={seconds:30,label:``,disabled:!1};state=Hl({seeking:!1,direction:`forward`,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=ac(t,e.defaultProps)}getLabel(e){let t=dp(this.#e.label,e);return t===void 0?e.direction===`backward`?Cm:Sm:t}getLabelParams(e){if(dp(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:yc(this.getLabel(this.state.current))}),this.state.current}async seek(e){this.#e.disabled||await e.seek(e.currentTime+this.#e.seconds)}},Tm={seeking:`data-seeking`,direction:`data-direction`},Em=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=ac(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 dp(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 uf(lf(t+e/100*(n-t),t,n),r,t)}rawValueFromPercent(e){let{min:t,max:n}=this.#e;return lf(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)}},Dm={dragging:`data-dragging`,pointing:`data-pointing`,interactive:`data-interactive`,orientation:`data-orientation`,disabled:`data-disabled`},Om={loading:`data-loading`,error:`data-error`,hidden:`data-hidden`};function km(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&&nc(n)&&!Number.isNaN(n)&&(l[t]=n)}let u={url:a};return nc(l.w)&&(u.width=l.w),nc(l.h)&&(u.height=l.h),nc(l.x)&&nc(l.y)&&(u.coords={x:l.x,y:l.y}),u}function Am(e,t){let n=[];for(let r of e){let e=km(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 jm=`time.`,Mm={key:`${jm}current`,text:`Current time`},Nm={key:`${jm}duration`,text:`Duration`},Pm={key:`${jm}remaining`,text:`Remaining`},Fm={key:`${jm}remainingSuffix`,text:`{duration} remaining`},Im={key:`${jm}showElapsed`,text:`{duration}. Show elapsed time.`},Lm={key:`${jm}showDuration`,text:`{duration}. Show duration.`},Rm={key:`${jm}showRemaining`,text:`{duration}. Show remaining time.`},zm={key:`${jm}position`,text:`{current} of {duration}`},Bm={current:Im,duration:Lm,remaining:Rm},Vm={current:Mm,duration:Nm,remaining:Pm},Hm=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=ac(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 Qp(Math.abs(t),e.duration)}#i(){let{type:e}=this.#e,t=this.#n();return em(e===`remaining`?t<0?t:-Math.abs(t):t)}#a(){let e=this.#n();return $p(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=dp(this.#e.label,e);return n===void 0?this.#e.toggle?Bm[this.#o(t,e.type)]:Vm[this.#e.type]:n}getLabelParams(e){return dp(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()}}},Um={type:`data-type`},Wm={key:`slider.seek`,text:`Seek`},Gm=class e extends Em{static defaultProps={...Em.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=ac(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)||Wm}#i(e){return e.dragging?this.rawValueFromPercent(e.pointerPercent):e.value}#a(e){return this.#n===void 0?em(e):em(e,{locale:this.#n})}getValueText(e){return Number.isFinite(e.duration)?zm: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)}}},Km={...Dm,seeking:`data-seeking`},qm=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=ac(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,...tf(e.status)}}getPopupAttrs(e){return{popover:`manual`,role:`presentation`}}},Jm={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`},Ym={open:`data-open`,side:`data-side`,align:`data-align`,...ef},Xm=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=ac(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()}},Zm=new Map;function Qm(e){return e===void 0?``:Array.isArray(e)?e.join(`:`):e}function $m(e){let t=Qm(e),n=Zm.get(t);if(!n)try{n=new Intl.NumberFormat(e,{style:`percent`,maximumFractionDigits:0}),Zm.set(t,n)}catch{return}return n}function eh(e){return`${Math.round(Math.min(1,Math.max(0,e))*100)}%`}function th(e,t){let n=!nc(e)||!Number.isFinite(e)?0:Math.min(1,Math.max(0,e));try{let e=$m(t)??$m(void 0);if(e)return e.format(n)}catch{}return eh(n)}var nh=class e extends Em{static defaultProps={...Em.defaultProps,label:``,wheelStep:5};#e=null;#t;constructor(e){super(),e&&this.setProps(e)}setProps(t){super.setProps(ac(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)||Wp}getValueText(e){return e.muted?Up:this.getValueTextParams(e).percent}getValueTextParams(e){return{percent:th(e.value/100,this.#t)}}getAttrs(e){return{...super.getAttrs(e),"aria-valuetext":this.getValueText(e)}}},rh={...Dm,availability:`data-availability`};A();var ih=_(null),ah=ih.Provider;function oh(){let e=C(ih);if(!e)throw Error(`AlertDialog compound components must be used within an AlertDialog.Root`);return e}var sh=Object.defineProperty,ch=(e,t)=>{let n={};for(var r in e)sh(n,r,{get:e[r],enumerable:!0});return t||sh(n,Symbol.toStringTag,{value:`Module`}),n};A();var lh=c(function({render:e,className:t,style:n,disabled:r,...i},a){let{dialog:o,state:s}=oh(),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]})});A();function uh(e){let{displayName:t,tag:n,useContext:r,staticProps:i,getProps:a}=e,o=c(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 dh=uh({displayName:`AlertDialogDescription`,tag:`p`,useContext:oh,getProps:e=>({id:e.descriptionId})});A();var fh=c(function({render:e,className:t,style:n,...r},i){let{core:a,dialog:o,state:s,stateAttrMap:c}=oh(),l=ol(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});A();var ph=/[^a-zA-Z0-9_-]/g;function mh(e){let t=o().replace(ph,``);return e?`${e}-${t}`:t}A();function hh({open:e,defaultOpen:t=fp.defaultProps.defaultOpen,onOpenChange:n,onOpenChangeComplete:r,children:i}){let[a]=D(()=>new fp),o=e!==void 0,s=Y(n),c=Y(r),[l]=D(()=>{let e=Xd({transition:Nf(),onOpenChange:e=>{s.current?.(e)},onOpenChangeComplete:e=>{c.current?.(e)}});return!o&&t&&e.open(),e}),u=mh(`alert-dialog-title`),d=mh(`alert-dialog-desc`);a.setTitleId(u),a.setDescriptionId(d),y(()=>{if(e===void 0)return;let{active:t}=l.input.current;e!==t&&(e?l.open():l.close())},[e,l]),Uf(l);let f=dl(l.input);return a.setInput(f),I(ah,{value:{core:a,dialog:l,state:a.getState(),stateAttrMap:pp},children:i})}var gh=uh({displayName:`AlertDialogTitle`,tag:`h2`,useContext:oh,getProps:e=>({id:e.titleId})}),_h=ch({Close:()=>lh,Description:()=>dh,Popup:()=>fh,Root:()=>hh,Title:()=>gh});A();var vh=c(function(e,t){let{render:n,className:r,style:i,delay:a,...o}=e,s=yl(_d),[c]=D(()=>new mp);Uf(c),c.setProps({delay:a}),s&&c.update(s);let l=R(e=>c.state.subscribe(e),()=>c.state.current,()=>c.state.current);return s?X(`div`,{render:n,className:r,style:i},{state:l,stateAttrMap:hp,ref:[t],props:[o]}):null});A();var yh=_(null),bh=yh.Provider;function xh(){let e=C(yh);if(!e)throw Error(`Controls compound components must be used within a Controls.Root`);return e}function Sh(){return C(yh)}A();var Ch=c(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{state:s,stateAttrMap:c}=xh(),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]})});A();var wh=c(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=yl(pd),[c]=D(()=>new gp);if(!s)return null;c.setMedia(s);let l=c.getState();return I(bh,{value:{state:l,stateAttrMap:_p},children:X(`div`,{render:n,className:r,style:i},{state:l,stateAttrMap:_p,ref:[t],props:[{children:a},o,{"data-interactive":``}]})})}),Th=ch({Group:()=>Ch,Root:()=>wh});A();var Eh=_(null),Dh=Eh.Provider;function Oh(){let e=C(Eh);if(!e)throw Error(`ErrorDialog compound components must be used within an ErrorDialog.Root`);return e}A();var kh=c(function({render:e,className:t,style:n,disabled:r,children:i,...a},o){let s=Ec(),{dialog:c,state:l,stateAttrMap:u}=oh(),d=P(()=>{r||c.close()},[c,r]),f=i??Cc(Pp(),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]})});A();var Ah=c(function({render:e,className:t,style:n,children:r,...i},a){let o=Ec(),{state:s,stateAttrMap:c}=oh(),{lastError:l}=Oh(),u=Fp(l),d=r??Cc(u,o);return X(`p`,{render:e,className:t,style:n},{state:s,stateAttrMap:c,ref:a,props:[{id:s.descriptionId,children:d},i]})});A();function jh({children:e}){let[t]=D(()=>new vp),n=yl(md),r=d(n?.error??null);n?.error&&(r.current=n.error);let i=Y(n),[a]=D(()=>Xd({transition:Nf(),onOpenChange:e=>{e||i.current?.dismissError()}})),o=mh(`error-dialog-title`),s=mh(`error-dialog-desc`);t.setTitleId(o),t.setDescriptionId(s),y(()=>{let e=!!n?.error,{active:t}=a.input.current;e&&!t?a.open():!e&&t&&a.close()},[n?.error,a]),Uf(a);let c=dl(a.input);t.setInput(c);let l=t.getState();return n?I(Dh,{value:{lastError:r.current},children:I(ah,{value:{core:t,dialog:a,state:l,stateAttrMap:pp},children:e})}):null}A();var Mh=c(function({render:e,className:t,style:n,children:r,...i},a){let o=Ec(),{state:s,stateAttrMap:c}=oh(),l=r??Cc(Np(),o);return X(`h2`,{render:e,className:t,style:n},{state:s,stateAttrMap:c,ref:a,props:[{id:s.titleId,children:l},i]})}),Nh=ch({Close:()=>kh,Description:()=>Ah,Popup:()=>fh,Root:()=>jh,Title:()=>Mh}),Ph=up({displayName:`FullscreenButton`,core:zp,stateAttrMap:Bp,selector:hd,action:(e,t)=>e.toggle(t),hotkeyAction:`toggleFullscreen`,isSupported:e=>!e.hidden});A();function Fh({type:e,action:t,value:n,pointer:r,region:i,disabled:a}){let o=yl(),s=Sl();return y(()=>{if(!s||!e||!t||a)return;let c=wd(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`?Ad(s,l,u):kd(s,l,u)},[s,o,e,t,n,r,i,a]),null}var Ih=Fh;A();function Lh(){let[,e]=O(e=>e+1,0);return e}A();function Rh(e){let t=Y(e),n=d(null),r=d(null),i=Lh(),[a]=D(()=>wf({getElement:()=>n.current,getThumbElement:()=>r.current,getOrientation:()=>t.current.orientation??`horizontal`,isRTL:()=>n.current?Oc(n.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?.()}));Uf(a);let o=dl(a.input),s=e.computeState(o);return u(()=>{s.thumbAlignment===`edge`&&n.current&&r.current&&i()},[s.thumbAlignment]),{state:s,cssVars:e.getCSSVars(a.adjustForAlignment(s)),rootRef:P(e=>{n.current=e},[]),thumbRef:P(e=>{r.current=e},[]),rootProps:a.rootProps,rootStyle:a.rootStyle,thumbProps:a.thumbProps}}A();function zh({keys:e,action:t,value:n,disabled:r,target:i}){let a=yl(),o=Sl();return y(()=>{if(!o||!e||!t||r)return;let s=Nd(t);if(s)return qd(o,{keys:e,action:t,value:n,target:i,disabled:r,repeatable:!jd(t),onActivate:(e,t)=>{s({store:a,key:t,value:n})}})},[o,a,e,t,n,r,i]),null}var Bh=zh;A();function Vh(e){let t=e.side,[n,r]=D({preferred:t,side:t}),i=e.open&&n.preferred===t?n.side:t,a=h(()=>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 y(()=>{e.open||o(t)},[e.open,t,o]),{state:a,preferredSide:t,setPositionedSide:o}}var Hh=up({displayName:`MuteButton`,core:sm,stateAttrMap:lm,selector:xd,action:(e,t)=>e.toggle(t),hotkeyAction:`toggleMuted`}),Uh=up({displayName:`PiPButton`,core:pm,stateAttrMap:mm,selector:gd,action:(e,t)=>e.toggle(t),hotkeyAction:`togglePictureInPicture`,isSupported:e=>!e.hidden}),Wh=up({displayName:`PlayButton`,core:hm,stateAttrMap:gm,selector:_d,action:(e,t)=>e.toggle(t),hotkeyAction:`togglePaused`}),Gh=up({displayName:`PlaybackRateButton`,core:_m,stateAttrMap:vm,selector:vd,action:(e,t)=>e.cycle(t),hotkeyAction:`speedUp`});A();var Kh=_(null),qh=Kh.Provider;function Jh(){let e=C(Kh);if(!e)throw Error(`Popover compound components must be used within a Popover.Root`);return e}var Yh=uh({displayName:`PopoverArrow`,tag:`div`,useContext:Jh,staticProps:{"aria-hidden":`true`}});A();var Xh={position:`fixed`,inset:`auto`,margin:0},Zh=c(function({render:e,className:t,style:n,...r},i){let{core:a,popover:o,state:s,preferredSide:c,setPositionedSide:l,stateAttrMap:f,anchorName:p,popupId:m,boundary:g,container:_}=Jh(),v=d(null),y=ol(i,P(e=>{o.setPopupElement(e),e&&Mc()&&e.style.setProperty(`position-anchor`,`--${p}`)},[o,p]),v),b=h(()=>({side:c,align:s.align}),[c,s.align]),x=h(()=>{if(!Mc())return null;let{positionAnchor:e,...t}=gf(p,b);return t},[p,b]),[S,C]=D(null);u(()=>{if(!s.open){C(null);return}function e(){let e=o.triggerElement,t=v.current;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getRootNode(),i=sf(g,{container:_,root:r}),a=xf(t,b.side),s=of(i),c=bf(t),u=Gc(n,a,s,b,c),{positionAnchor:d,...f}=gf(p,{...b,side:u},n,Mc()?void 0:a,s,c);C(f),l(u)}e();let t=o.triggerElement,n=v.current,r=n?sf(g,{container:_,root:n.getRootNode()}):null,i=0;function a(t){t&&Rf(t,v.current)||(cancelAnimationFrame(i),i=requestAnimationFrame(e))}a();let c=typeof ResizeObserver==`function`?new ResizeObserver(()=>{a()}):null;return t&&c&&c.observe(t),n&&c&&c.observe(n),r&&c&&c.observe(r),window.addEventListener(`scroll`,a,{capture:!0,passive:!0}),window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(i),c?.disconnect(),window.removeEventListener(`scroll`,a,!0),window.removeEventListener(`resize`,a)}},[s.open,p,b,o,g,_,l]);let w=S??x??Xh;if(!s.open)return null;let{onFocusOut:T,...E}=o.popupProps;return X(`div`,{render:e,className:t,style:n},{state:s,stateAttrMap:f,ref:y,props:[{id:m,style:w,...a.getPopupAttrs(s)},{...E,onBlur:T},r]})});A();function Qh({open:e,defaultOpen:t=ym.defaultProps.defaultOpen,onOpenChange:n,onOpenChangeComplete:r,openOnHover:i=ym.defaultProps.openOnHover,delay:a=ym.defaultProps.delay,closeDelay:o=ym.defaultProps.closeDelay,boundary:s=`container`,children:c,...l}){let u=Cl(),d=wl(),f=Sh(),[p]=D(()=>new ym(l));p.setProps(l);let m=!q(e),h=Y(n),g=Y(r),_=Y(l.closeOnEscape),v=Y(l.closeOnOutsideClick),b=Y(i),x=Y(a),S=Y(o),C=Y(d),[w]=D(()=>{let e=nf({transition:Nf(),onOpenChange:(e,t)=>{h.current?.(e,t)},onOpenChangeComplete:e=>{g.current?.(e)},closeOnEscape:()=>_.current??ym.defaultProps.closeOnEscape,closeOnOutsideClick:()=>v.current??ym.defaultProps.closeOnOutsideClick,openOnHover:()=>b.current,delay:()=>x.current,closeDelay:()=>S.current,group:()=>C.current});return!m&&t&&e.open(`click`),e}),T=mh(),E=mh(`popup`);y(()=>{if(q(e))return;let{active:t}=w.input.current;e!==t&&(e?w.open(`click`):w.close(`click`))},[e,w]),y(()=>{q(f?.state.visible)||f.state.visible||w.close(`imperative-action`)},[f?.state.visible,w]),Uf(w);let O=dl(w.input);p.setInput(O);let{state:k,preferredSide:A,setPositionedSide:ee}=Vh(p.getState());return I(qh,{value:{core:p,popover:w,state:k,preferredSide:A,setPositionedSide:ee,stateAttrMap:bm,anchorName:T,popupId:E,boundary:s,container:u},children:c})}A();var $h=c(function({render:e,className:t,style:n,...r},i){let{core:a,popover:o,state:s,stateAttrMap:c,anchorName:l,popupId:u}=Jh(),d=P(e=>{o.setTriggerElement(e),e&&Mc()&&e.style.setProperty(`anchor-name`,`--${l}`)},[o,l]),{onFocusIn:f,onFocusOut:p,...m}=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)},{...m,onFocus:f,onBlur:p},r]})}),eg=ch({Arrow:()=>Yh,Popup:()=>Zh,Root:()=>Qh,Trigger:()=>$h}),tg=up({displayName:`SeekButton`,core:wm,stateAttrMap:Tm,selector:bd,action:(e,t)=>e.seek(t),hotkeyAction:`seekStep`,hotkeyValue:e=>typeof e.seconds==`number`?e.seconds:wm.defaultProps.seconds});A();var ng=c(function(e,t){let{render:n,className:r,style:i,time:a=0,thumbnails:o,crossOrigin:s,loading:c,fetchPriority:l,...u}=e,[f]=D(()=>new kf),p=d(null),m=d(null),g=bl(yd),[,_]=D(0),[v]=D(()=>Af({getContainer:()=>p.current,getImg:()=>m.current,onStateChange:()=>_(e=>e+1)}));Uf(v,()=>v.connect());let y=h(()=>o&&o.length>0?o:g&&g.thumbnailCues.length>0?Am(g.thumbnailCues,g.thumbnailTrackSrc??void 0):[],[o,g]),b=h(()=>f.findActiveThumbnail(y,a),[f,y,a]);v.updateSrc(b?.url);let x=f.getState(v.loading,v.error,b),S={overflow:`hidden`},C;if(b&&v.naturalWidth&&v.naturalHeight){let e=v.readConstraints(),t=f.resize(b,v.naturalWidth,v.naturalHeight,e);t&&(S={overflow:`hidden`,width:t.containerWidth,height:t.containerHeight},C={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:x,stateAttrMap:Om,ref:[t,p],props:[f.getAttrs(x),{style:S},u,{children:I(`img`,{ref:m,alt:``,"aria-hidden":`true`,decoding:`async`,src:b?.url,crossOrigin:s===``||s===null?void 0:s,loading:c,style:C,fetchPriority:l})}]})});A();var rg=_(null);function ig({value:e,children:t}){return I(rg.Provider,{value:e,children:t})}function ag(){let e=C(rg);if(!e)throw Error(`Slider compound components must be used within a Slider.Root`);return e}var og=uh({displayName:`SliderBuffer`,tag:`div`,useContext:ag}),sg=uh({displayName:`SliderFill`,tag:`div`,useContext:ag});A();var cg=c(function(e,t){let{render:n,className:r,style:i,overflow:a=`clamp`,...o}=e,s=ag(),{state:c}=s,l=d(null),[u,f]=D(0);y(()=>{let e=l.current;if(!e)return;let t=new ResizeObserver(([e])=>{f(e.contentRect.width)});return t.observe(e),()=>t.disconnect()},[]);let p=Of(u,a);return X(`div`,{render:n,className:r,style:i},{state:c,stateAttrMap:s.stateAttrMap,ref:[t,l],props:[{style:p},o]})});A();var lg=c(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:h,onDragStart:g,onDragEnd:_,...v}=e,[y]=D(()=>new Em),b=Ec();y.setProps({label:a,min:o,max:s,step:c,largeStep:l,orientation:u,disabled:d,thumbAlignment:f});let{state:x,cssVars:S,rootRef:C,thumbRef:w,rootProps:T,rootStyle:E,thumbProps:O}=Rh({computeState:e=>(y.setInput(e),y.getSliderState(p)),getPercent:()=>y.percentFromValue(p),getStepPercent:()=>y.getStepPercent(),getLargeStepPercent:()=>y.getLargeStepPercent(),orientation:u,disabled:d,adjustPercent:(e,t,n)=>y.adjustPercentForAlignment(e,t,n),getCSSVars:Ef,onValueChange:e=>m?.(y.valueFromPercent(e)),onValueCommit:e=>h?.(y.valueFromPercent(e)),onDragStart:g,onDragEnd:_});return I(ig,{value:{state:x,pointerValue:y.valueFromPercent(x.pointerPercent),thumbRef:w,thumbProps:O,stateAttrMap:Dm,getAttrs:e=>{let t=y.getAttrs(e);return{...t,"aria-label":Cc(t[`aria-label`],b)}},formatValue:void 0},children:X(`div`,{render:n,className:r,style:i},{state:x,stateAttrMap:Dm,ref:[t,C],props:[{style:{...S,...E}},T,v]})})});A();var ug=c(function(e,t){let{render:n,className:r,style:i,...a}=e,o=ag(),{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]})});A();var dg=c(function(e,t){let{pointerValue:n}=ag();return I(ng,{ref:t,...e,time:n})}),fg=uh({displayName:`SliderTrack`,tag:`div`,useContext:ag});A();var pg=c(function(e,t){let{render:n,className:r,style:i,type:a=`current`,format:o,...s}=e,c=ag(),{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]})}),mg=ch({Buffer:()=>og,Fill:()=>sg,Preview:()=>cg,Root:()=>lg,Thumb:()=>ug,Thumbnail:()=>dg,Track:()=>fg,Value:()=>pg});A();var hg=c(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]})});A();var gg=c(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]})});A(),te();var _g=c(function(e,t){let{render:n,className:r,style:i,type:a,negativeSign:o,label:s,toggle:c=!1,...l}=e,u=yl(bd),d=Ec(),f=Dc(),[p]=D(()=>new Hm),m=a??Hm.defaultProps.type,[h,g]=D(m);if(y(()=>{g(m)},[m,c]),p.setProps({type:h,negativeSign:o,label:s,toggle:c}),!u)return null;p.setMedia(u);let _=p.getState(),b=p.getAttrs(_,m),x=p.getLabelParams(_)?{duration:_.type===`remaining`?Cc(Fm,d,{duration:em(Math.abs(_.seconds),{locale:f})}):em(Math.abs(_.seconds),{locale:f})}:void 0,S=_.negative?I(v,{children:[I(`span`,{"aria-hidden":`true`,children:o??Hm.defaultProps.negativeSign}),_.text]}):_.text,C=()=>{g(e=>m===`current`?e===`remaining`?`current`:`remaining`:e===`duration`?`remaining`:`duration`)},w=e=>{e.defaultPrevented||C()},T=e=>{!e.defaultPrevented&&Bc(e.nativeEvent)&&(e.preventDefault(),!e.repeat&&C())};return X(`time`,{render:n,className:r,style:i},{state:_,stateAttrMap:Um,ref:[t],props:[{dateTime:_.datetime,children:S,...b,"aria-label":Cc(b[`aria-label`],d,x),...c?{onClick:w,onKeyDown:T}:void 0},l]})}),vg=ch({Group:()=>hg,Separator:()=>gg,Value:()=>_g});A();var yg=()=>Promise.resolve(0),bg=c(function(e,t){let{render:n,className:r,style:i,label:a,changeThrottle:o=Gm.defaultProps.changeThrottle,step:s=Gm.defaultProps.step,largeStep:c=Gm.defaultProps.largeStep,orientation:l,disabled:u,thumbAlignment:d,onDragStart:f,onDragEnd:p,pauseOnDrag:m,...h}=e,g=yl(bd),_=yl(fd),v=yl(_d),b=Ec(),x=Dc(),[S]=D(()=>new Gm);S.setProps({label:a,step:s,largeStep:c,orientation:l,disabled:u,thumbAlignment:d,pauseOnDrag:m,changeThrottle:o}),S.setFormatLocale(x);let C=Y(g&&_?{...g,..._}:null),w=Y(v);y(()=>()=>S.endDrag(w.current),[S]);let T=g?.duration??0,{state:E,cssVars:O,rootRef:k,thumbRef:A,rootProps:ee,rootStyle:j,thumbProps:M}=Rh({computeState:e=>(S.setInput(e),!g||!_?S.setMedia({currentTime:0,duration:0,seeking:!1,seek:yg,buffered:[],seekable:[]}):S.setMedia({...g,..._}),S.getState()),getPercent:()=>T>0?(g?.currentTime??0)/T*100:0,getStepPercent:()=>S.getStepPercent(),getLargeStepPercent:()=>S.getLargeStepPercent(),orientation:l,disabled:u,changeThrottle:o,adjustPercent:(e,t,n)=>S.adjustPercentForAlignment(e,t,n),getCSSVars:Df,onValueCommit:e=>{let t=C.current;t&&t.seek(S.rawValueFromPercent(e))},onDragStart:()=>{S.startDrag(w.current),f?.()},onDragEnd:()=>{S.endDrag(w.current),p?.()}});return g?I(ig,{value:{state:E,pointerValue:S.valueFromPercent(E.pointerPercent),thumbRef:A,thumbProps:M,stateAttrMap:Km,getAttrs:e=>{let t=S.getAttrs(e);return{...t,"aria-label":Cc(t[`aria-label`],b),"aria-valuetext":Cc(t[`aria-valuetext`],b,S.getValueTextParams(e))}},formatValue:e=>Qp(e,T)},children:X(`div`,{render:n,className:r,style:i},{state:E,stateAttrMap:Km,ref:[t,k],props:[{style:{...O,...j}},ee,h]})}):null}),xg=ch({Buffer:()=>og,Fill:()=>sg,Preview:()=>cg,Root:()=>bg,Thumb:()=>ug,Track:()=>fg,Value:()=>pg}),Sg=uh({displayName:`TooltipArrow`,tag:`div`,useContext:sp,staticProps:{"aria-hidden":`true`}});A();var Cg=c(function({render:e,className:t,style:n,children:r,...i},a){let{state:o,stateAttrMap:s,content:c}=sp(),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}]})});A();var wg=c(function({render:e,className:t,style:n,children:r,...i},a){let{state:o,stateAttrMap:s,content:c}=sp(),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});A(),te();var Tg={position:`fixed`,inset:`auto`,margin:0},Eg=c(function({render:e,className:t,style:n,children:r,...i},a){let{core:o,tooltip:s,state:c,preferredSide:l,setPositionedSide:f,stateAttrMap:p,anchorName:m,popupId:g,boundary:_,container:y}=sp(),b=d(null),x=ol(a,P(e=>{s.setPopupElement(e),e&&Mc()&&e.style.setProperty(`position-anchor`,`--${m}`)},[s,m]),b),S=h(()=>({side:l,align:c.align}),[l,c.align]),C=h(()=>{if(!Mc())return null;let{positionAnchor:e,...t}=gf(m,S,void 0,void 0,void 0,void 0,Jm);return t},[m,S]),[w,T]=D(null);u(()=>{if(!c.open){T(null);return}function e(){let e=s.triggerElement,t=b.current;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getRootNode(),i=sf(_,{container:y,root:r}),a=xf(t,S.side),o=of(i),c=bf(t,Jm),l=Gc(n,a,o,S,c),{positionAnchor:u,...d}=gf(m,{...S,side:l},n,Mc()?void 0:a,o,c,Jm);T(d),f(l)}e();let t=s.triggerElement,n=b.current,r=n?sf(_,{container:y,root:n.getRootNode()}):null,i=0;function a(t){t&&Rf(t,b.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)}},[c.open,m,S,s,_,y,f]);let E=w??C??Tg;if(!c.open)return null;let O=r===void 0?I(v,{children:[I(Cg,{}),I(wg,{})]}):r,{onFocusOut:k,...A}=s.popupProps;return X(`div`,{render:e,className:t,style:n},{state:c,stateAttrMap:p,ref:x,props:[{id:g,style:E,...o.getPopupAttrs(c)},{children:O},{...A,onBlur:k},i]})});A();var Dg=_(null),Og=Dg.Provider;function kg(){return C(Dg)?.group}A();function Ag({delay:e,closeDelay:t,timeout:n,children:r}){let[i]=D(()=>new Xm({delay:e,closeDelay:t,timeout:n}));return i.setProps({delay:e,closeDelay:t,timeout:n}),I(Og,{value:{group:i},children:r})}A();function jg({open:e,defaultOpen:t=qm.defaultProps.defaultOpen,onOpenChange:n,onOpenChangeComplete:r,delay:i=qm.defaultProps.delay,closeDelay:a=qm.defaultProps.closeDelay,disableHoverablePopup:o=qm.defaultProps.disableHoverablePopup,disabled:s=qm.defaultProps.disabled,boundary:c=`container`,children:l,...u}){let d=Cl(),f=Sh(),[p]=D(()=>new qm(u));p.setProps(u);let m=!q(e),h=kg(),g=Y(n),_=Y(r),v=Y(i),b=Y(a),x=Y(o),S=Y(s),C=Y(h),[w]=D(()=>{let e=Mf({transition:Nf(),onOpenChange:(e,t)=>{g.current?.(e,t)},onOpenChangeComplete:e=>{_.current?.(e)},delay:()=>v.current,closeDelay:()=>b.current,disableHoverablePopup:()=>x.current,disabled:()=>S.current,group:()=>C.current});return!m&&t&&e.open(),e}),[T,E]=D(),O=mh(),k=mh(`tooltip`);y(()=>{if(q(e))return;let{active:t}=w.input.current;e!==t&&(e?w.open():w.close())},[e,w]),y(()=>{q(f?.state.visible)||f.state.visible||w.close(`imperative-action`)},[f?.state.visible,w]),Uf(w);let A=dl(w.input);p.setInput(A);let{state:ee,preferredSide:j,setPositionedSide:M}=Vh(p.getState());return I(op,{value:{core:p,tooltip:w,state:ee,preferredSide:j,setPositionedSide:M,stateAttrMap:Ym,anchorName:O,popupId:k,content:T,setContent:E,boundary:c,container:d},children:l})}A();var Mg=c(function({render:e,className:t,style:n,...r},i){let{tooltip:a,state:o,stateAttrMap:s,anchorName:c}=sp(),l=P(e=>{a.setTriggerElement(e),e&&Mc()&&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]})}),Ng=ch({Arrow:()=>Sg,Label:()=>Cg,Popup:()=>Eg,Provider:()=>Ag,Root:()=>jg,Shortcut:()=>wg,Trigger:()=>Mg});A();var Pg={volume:0,muted:!1,volumeAvailability:`unsupported`,setVolume:()=>0,toggleMuted:()=>!1},Fg=c(function(e,t){let{render:n,className:r,style:i,label:a,orientation:o,step:s=nh.defaultProps.step,largeStep:c=nh.defaultProps.largeStep,wheelStep:l=nh.defaultProps.wheelStep,disabled:u,thumbAlignment:f,onDragStart:p,onDragEnd:m,...h}=e,g=yl(xd),_=Ec(),v=Dc(),[y]=D(()=>new nh);y.setProps({label:a,orientation:o,step:s,largeStep:c,wheelStep:l,disabled:u,thumbAlignment:f}),y.setFormatLocale(v);let b=Y(g),x=Y(u),S=()=>(b.current?.volume??0)*100,C=()=>y.getStepPercent(),w=e=>b.current?.setVolume(e/100),{state:T,cssVars:E,rootRef:O,thumbRef:k,rootProps:A,rootStyle:ee,thumbProps:j}=Rh({computeState:e=>(y.setInput(e),y.setMedia(g??Pg),y.getState()),getPercent:S,getStepPercent:C,getLargeStepPercent:()=>y.getLargeStepPercent(),orientation:o,disabled:u,adjustPercent:(e,t,n)=>y.adjustPercentForAlignment(e,t,n),getCSSVars:Ef,onValueChange:w,onValueCommit:w,onDragStart:p,onDragEnd:m}),[M]=D(()=>Lf({isDisabled:()=>!!x.current||!b.current,getPercent:()=>(b.current?.volume??0)*100,getStepPercent:()=>y.getWheelStepPercent(),onValueChange:e=>b.current?.setVolume(e/100)})),N=d(null),te=P(e=>{N.current?.(),N.current=null,e&&(N.current=J(e,`wheel`,M.onWheel,{passive:!1}))},[M]);return g?I(ig,{value:{state:T,pointerValue:y.valueFromPercent(T.pointerPercent),thumbRef:k,thumbProps:j,stateAttrMap:rh,getAttrs:e=>{let t=y.getAttrs(e);return{...t,"aria-label":Cc(t[`aria-label`],_),"aria-valuetext":Cc(t[`aria-valuetext`],_,y.getValueTextParams(e))}},formatValue:e=>`${Math.round(e)}%`},children:X(`div`,{render:n,className:r,style:i},{state:T,stateAttrMap:rh,ref:[t,O,te],props:[{style:{...E,...ee}},A,h]})}):null}),Ig=ch({Fill:()=>sg,Preview:()=>cg,Root:()=>Fg,Thumb:()=>ug,Track:()=>fg,Value:()=>pg}),Lg=k(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Rg=k(((e,t)=>{var n=Lg();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}})),zg=k(((e,t)=>{t.exports=Rg()()}));A();var Z=p(zg());function Bg(){return Bg=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Bg.apply(this,arguments)}function Vg(e,t){if(e==null)return{};var n=Hg(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 Hg(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=c(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Vg(e,[`color`,`size`]);return t.createElement(`svg`,Bg({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`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`}))});Ug.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Ug.displayName=`AlertTriangle`,A();function Wg(){return Wg=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Wg.apply(this,arguments)}function Gg(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 qg=c(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`,Wg({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`polyline`,{points:`20 6 9 17 4 12`}))});qg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},qg.displayName=`Check`,A();function Jg(){return Jg=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},Jg.apply(this,arguments)}function Yg(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 Zg=c(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Yg(e,[`color`,`size`]);return t.createElement(`svg`,Jg({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`}))});Zg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Zg.displayName=`ChevronLeft`,A();function Qg(){return Qg=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Qg.apply(this,arguments)}function $g(e,t){if(e==null)return{};var n=e_(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 e_(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 t_=c(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=$g(e,[`color`,`size`]);return t.createElement(`svg`,Qg({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`polyline`,{points:`9 18 15 12 9 6`}))});t_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},t_.displayName=`ChevronRight`,A();function n_(){return n_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n_.apply(this,arguments)}function r_(e,t){if(e==null)return{};var n=i_(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 i_(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 a_=c(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=r_(e,[`color`,`size`]);return t.createElement(`svg`,n_({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`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`}))});a_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},a_.displayName=`Copy`,A();function o_(){return o_=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},o_.apply(this,arguments)}function s_(e,t){if(e==null)return{};var n=c_(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function c_(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var l_=c(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=s_(e,[`color`,`size`]);return t.createElement(`svg`,o_({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`}))});l_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},l_.displayName=`Maximize`,A();function u_(){return u_=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},u_.apply(this,arguments)}function d_(e,t){if(e==null)return{};var n=f_(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function f_(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var p_=c(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=d_(e,[`color`,`size`]);return t.createElement(`svg`,u_({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`}))});p_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},p_.displayName=`Minimize`,A();function m_(){return m_=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},m_.apply(this,arguments)}function h_(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 __=c(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=h_(e,[`color`,`size`]);return t.createElement(`svg`,m_({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`}))});__.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},__.displayName=`Pause`,A();function v_(){return v_=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},v_.apply(this,arguments)}function y_(e,t){if(e==null)return{};var n=b_(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 b_(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 x_=c(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=y_(e,[`color`,`size`]);return t.createElement(`svg`,v_({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`}))});x_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},x_.displayName=`Play`,A();function S_(){return S_=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},S_.apply(this,arguments)}function C_(e,t){if(e==null)return{};var n=w_(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 w_(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 T_=c(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=C_(e,[`color`,`size`]);return t.createElement(`svg`,S_({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`}))});T_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},T_.displayName=`RotateCcw`,A();function E_(){return E_=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},E_.apply(this,arguments)}function D_(e,t){if(e==null)return{};var n=O_(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 O_(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 k_=c(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=D_(e,[`color`,`size`]);return t.createElement(`svg`,E_({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`}))});k_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},k_.displayName=`Settings`,A();function A_(){return A_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},A_.apply(this,arguments)}function j_(e,t){if(e==null)return{};var n=M_(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 M_(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 N_=c(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=j_(e,[`color`,`size`]);return t.createElement(`svg`,A_({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`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`}))});N_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},N_.displayName=`Volume1`,A();function P_(){return P_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},P_.apply(this,arguments)}function F_(e,t){if(e==null)return{};var n=I_(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 I_(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 L_=c(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=F_(e,[`color`,`size`]);return t.createElement(`svg`,P_({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`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`}))});L_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},L_.displayName=`Volume2`,A();function R_(){return R_=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},R_.apply(this,arguments)}function z_(e,t){if(e==null)return{};var n=B_(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 B_(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 V_=c(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=z_(e,[`color`,`size`]);return t.createElement(`svg`,R_({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`}))});V_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},V_.displayName=`VolumeX`;var H_=k(((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})()}));ue(),A();var U_=p(H_(),1),W_=`react-tooltip-core-styles`,G_=`react-tooltip-base-styles`,K_={core:!1,base:!1};function q_({css:e,id:t=G_,type:n=`base`,ref:r}){if(!e||typeof document>`u`||K_[n]||n===`core`&&ae!==void 0&&(ae==null?void 0:{})?.REACT_TOOLTIP_DISABLE_CORE_STYLES||n!==`base`&&ae!==void 0&&(ae==null?void 0:{})?.REACT_TOOLTIP_DISABLE_BASE_STYLES)return;n===`core`&&(t=W_),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)),K_[n]=!0}var J_=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r=`top`,offset:i=10,strategy:a=`absolute`,middlewares:o=[ne(Number(i)),g({fallbackAxisSideDirection:`start`}),s({padding:5})],border:c,arrowSize:l=8})=>{if(!e||t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};let u=o;return n?(u.push(f({element:n,padding:5})),L(e,t,{placement:r,strategy:a,middleware:u}).then((({x:e,y:t,placement:n,middlewareData:r})=>{let i={left:`${e}px`,top:`${t}px`,border:c},{x:a,y:o}=r.arrow??{x:0,y:0},s={top:`bottom`,right:`left`,bottom:`top`,left:`right`}[n.split(`-`)[0]]??`bottom`,u=c&&{borderBottom:c,borderRight:c},d=0;if(c){let e=`${c}`.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,[s]:`-${l/2+d-1}px`},place:n}}))):L(e,t,{placement:`bottom`,strategy:a,middleware:u}).then((({x:e,y:t,placement:n})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:n})))},Y_=(e,t)=>!(`CSS`in window&&`supports`in window.CSS)||window.CSS.supports(e,t),X_=(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},Z_=e=>e!==null&&!Array.isArray(e)&&typeof e==`object`,Q_=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every(((e,n)=>Q_(e,t[n])));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Z_(e)||!Z_(t))return e===t;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every((n=>Q_(e[n],t[n])))},$_=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`}))},ev=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if($_(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},tv=typeof window<`u`?u:y,nv=e=>{e.current&&=(clearTimeout(e.current),null)},rv=`DEFAULT_TOOLTIP_ID`,iv={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},av=_({getTooltipData:()=>iv});function ov(e=rv){return C(av).getTooltipData(e)}var sv={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`},cv={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`},lv=({forwardRef:n,id:r,className:i,classNameArrow:a,variant:o=`dark`,anchorId:s,anchorSelect:c,place:l=`top`,offset:u=10,events:f=[`hover`],openOnClick:p=!1,positionStrategy:m=`absolute`,middlewares:h,wrapper:g,delayShow:_=0,delayHide:v=0,float:b=!1,hidden:x=!1,noArrow:S=!1,clickable:C=!1,closeOnEsc:w=!1,closeOnScroll:T=!1,closeOnResize:E=!1,openEvents:O,closeEvents:k,globalCloseEvents:A,imperativeModeOnly:ee,style:j,position:M,afterShow:N,afterHide:te,disableTooltip:I,content:ne,contentWrapperRef:L,isOpen:R,defaultIsOpen:re=!1,setIsOpen:ie,previousActiveAnchor:ae,activeAnchor:z,setActiveAnchor:oe,border:se,opacity:ce,arrowColor:le,arrowSize:ue=8,role:de=`tooltip`})=>{let B=d(null),fe=d(null),pe=d(null),me=d(null),he=d(null),[ge,_e]=D({tooltipStyles:{},tooltipArrowStyles:{},place:l}),[ve,ye]=D(!1),[V,be]=D(!1),[H,U]=D(null),W=d(!1),xe=d(null),{anchorRefs:Se,setActiveAnchor:Ce}=ov(r),we=d(!1),[Te,Ee]=D([]),De=d(!1),Oe=p||f.includes(`click`),ke=Oe||O?.click||O?.dblclick||O?.mousedown,Ae=O?{...O}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!O&&Oe&&Object.assign(Ae,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});let je=k?{...k}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!k&&Oe&&Object.assign(je,{mouseleave:!1,blur:!1,mouseout:!1});let Me=A?{...A}:{escape:w||!1,scroll:T||!1,resize:E||!1,clickOutsideAnchor:ke||!1};ee&&(Object.assign(Ae,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(je,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(Me,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),tv((()=>(De.current=!0,()=>{De.current=!1})),[]);let Ne=e=>{De.current&&(e&&be(!0),setTimeout((()=>{De.current&&(ie?.(e),R===void 0&&ye(e))}),10))};y((()=>{if(r){if(ve){t(ae);let n=e(z),i=[...new Set([...n,r])].filter(Boolean).join(` `);z?.setAttribute(`aria-describedby`,i)}else t(z);return()=>{t(z),t(ae)}}function e(e){return(e?.getAttribute(`aria-describedby`))?.split(` `)||[]}function t(t){let n=e(t).filter((e=>e!==r));n.length?t?.setAttribute(`aria-describedby`,n.join(` `)):t?.removeAttribute(`aria-describedby`)}}),[z,ve,r,ae]),y((()=>{if(R===void 0)return()=>null;R&&be(!0);let e=setTimeout((()=>{ye(R)}),10);return()=>{clearTimeout(e)}}),[R]),y((()=>{if(ve!==W.current){if(nv(he),W.current=ve,ve)N?.();else{let e=(e=>{let t=e.match(/^([\d.]+)(ms|s)$/);if(!t)return 0;let[,n,r]=t;return Number(n)*(r===`ms`?1:1e3)})(getComputedStyle(document.body).getPropertyValue(`--rt-transition-show-delay`));he.current=setTimeout((()=>{be(!1),U(null),te?.()}),e+25)}}}),[ve]);let Pe=e=>{_e((t=>Q_(t,e)?t:e))},Fe=(e=_)=>{nv(pe),V?Ne(!0):pe.current=setTimeout((()=>{Ne(!0)}),e)},Ie=(e=v)=>{nv(me),me.current=setTimeout((()=>{we.current||Ne(!1)}),e)},Le=e=>{if(!e)return;let t=e.currentTarget??e.target;if(!t?.isConnected)return oe(null),void Ce({current:null});_?Fe():Ne(!0),oe(t),Ce({current:t}),nv(me)},Re=()=>{C?Ie(v||100):v?Ie():Ne(!1),nv(pe)},ze=({x:e,y:t})=>{J_({place:H?.place??l,offset:u,elementReference:{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})},tooltipReference:B.current,tooltipArrowReference:fe.current,strategy:m,middlewares:h,border:se,arrowSize:ue}).then((e=>{Pe(e)}))},Be=e=>{if(!e)return;let t=e,n={x:t.clientX,y:t.clientY};ze(n),xe.current=n},Ve=e=>{if(!ve)return;let t=e.target;t.isConnected&&(B.current?.contains(t)||[document.querySelector(`[id='${s}']`),...Te].some((e=>e?.contains(t)))||(Ne(!1),nv(pe)))},He=X_(Le,50,!0),Ue=X_(Re,50,!0),We=e=>{Ue.cancel(),He(e)},Ge=()=>{He.cancel(),Ue()},Ke=P((()=>{let e=H?.position??M;e?ze(e):b?xe.current&&ze(xe.current):z!=null&&z.isConnected&&J_({place:H?.place??l,offset:u,elementReference:z,tooltipReference:B.current,tooltipArrowReference:fe.current,strategy:m,middlewares:h,border:se,arrowSize:ue}).then((e=>{De.current&&Pe(e)}))}),[ve,z,ne,j,l,H?.place,u,m,M,H?.position,b,ue]);y((()=>{var e,t;let n=new Set(Se);Te.forEach((e=>{I!=null&&I(e)||n.add({current:e})}));let r=document.querySelector(`[id='${s}']`);r&&!(I!=null&&I(r))&&n.add({current:r});let i=()=>{Ne(!1)},a=ev(z),o=ev(B.current);Me.scroll&&(window.addEventListener(`scroll`,i),a?.addEventListener(`scroll`,i),o?.addEventListener(`scroll`,i));let c=null;Me.resize?window.addEventListener(`resize`,i):z&&B.current&&(c=F(z,B.current,Ke,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));let l=e=>{e.key===`Escape`&&Ne(!1)};Me.escape&&window.addEventListener(`keydown`,l),Me.clickOutsideAnchor&&window.addEventListener(`click`,Ve);let u=[],d=e=>!!(e?.target&&z?.contains(e.target)),f=e=>{ve&&d(e)||Le(e)},p=e=>{ve&&d(e)&&Re()},m=[`mouseover`,`mouseout`,`mouseenter`,`mouseleave`,`focus`,`blur`],h=[`click`,`dblclick`,`mousedown`,`mouseup`];Object.entries(Ae).forEach((([e,t])=>{t&&(m.includes(e)?u.push({event:e,listener:We}):h.includes(e)&&u.push({event:e,listener:f}))})),Object.entries(je).forEach((([e,t])=>{t&&(m.includes(e)?u.push({event:e,listener:Ge}):h.includes(e)&&u.push({event:e,listener:p}))})),b&&u.push({event:`pointermove`,listener:Be});let g=()=>{we.current=!0},_=()=>{we.current=!1,Re()},v=C&&(je.mouseout||je.mouseleave);return v&&((e=B.current)==null||e.addEventListener(`mouseover`,g),(t=B.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;Me.scroll&&(window.removeEventListener(`scroll`,i),a?.removeEventListener(`scroll`,i),o?.removeEventListener(`scroll`,i)),Me.resize?window.removeEventListener(`resize`,i):c?.(),Me.clickOutsideAnchor&&window.removeEventListener(`click`,Ve),Me.escape&&window.removeEventListener(`keydown`,l),v&&((e=B.current)==null||e.removeEventListener(`mouseover`,g),(t=B.current)==null||t.removeEventListener(`mouseout`,_)),u.forEach((({event:e,listener:t})=>{n.forEach((n=>{var r;(r=n.current)==null||r.removeEventListener(e,t)}))}))}}),[z,Ke,V,Se,Te,O,k,A,Oe,_,v]),y((()=>{let e=H?.anchorSelect??c??``;!e&&r&&(e=`[data-tooltip-id='${r.replace(/'/g,`\\'`)}']`);let t=new MutationObserver((t=>{let n=[],i=[];t.forEach((t=>{if(t.type===`attributes`&&t.attributeName===`data-tooltip-id`&&(t.target.getAttribute(`data-tooltip-id`)===r?n.push(t.target):t.oldValue===r&&i.push(t.target)),t.type===`childList`){if(z){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,z)&&(be(!1),Ne(!1),oe(null),nv(pe),nv(me),!0)))}if(e)try{let r=[...t.addedNodes].filter((e=>e.nodeType===1));n.push(...r.filter((t=>t.matches(e)))),n.push(...r.flatMap((t=>[...t.querySelectorAll(e)])))}catch{}}})),(n.length||i.length)&&Ee((e=>[...e.filter((e=>!i.includes(e))),...n]))}));return t.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-tooltip-id`],attributeOldValue:!0}),()=>{t.disconnect()}}),[r,c,H?.anchorSelect,z]),y((()=>{Ke()}),[Ke]),y((()=>{if(!L?.current)return()=>null;let e=new ResizeObserver((()=>{setTimeout((()=>Ke()))}));return e.observe(L.current),()=>{e.disconnect()}}),[ne,L?.current]),y((()=>{let e=document.querySelector(`[id='${s}']`),t=[...Te,e];z&&t.includes(z)||oe(Te[0]??e)}),[s,Te,z]),y((()=>(re&&Ne(!0),()=>{nv(pe),nv(me)})),[]),y((()=>{let e=H?.anchorSelect??c;if(!e&&r&&(e=`[data-tooltip-id='${r.replace(/'/g,`\\'`)}']`),e)try{let t=Array.from(document.querySelectorAll(e));Ee(t)}catch{Ee([])}}),[r,c,H?.anchorSelect]),y((()=>{pe.current&&(nv(pe),Fe(_))}),[_]);let qe=H?.content??ne,Je=ve&&Object.keys(ge.tooltipStyles).length>0;return e(n,(()=>({open:e=>{if(e?.anchorSelect)try{document.querySelector(e.anchorSelect)}catch{console.warn(`[react-tooltip] "${e.anchorSelect}" is not a valid CSS selector`);return}U(e??null),e?.delay?Fe(e.delay):Ne(!0)},close:e=>{e?.delay?Ie(e.delay):Ne(!1)},activeAnchor:z,place:ge.place,isOpen:!!(V&&!x&&qe&&Je)}))),V&&!x&&qe?t.createElement(g,{id:r,role:de,className:(0,U_.default)(`react-tooltip`,sv.tooltip,cv.tooltip,cv[o],i,`react-tooltip__place-${ge.place}`,sv[Je?`show`:`closing`],Je?`react-tooltip__show`:`react-tooltip__closing`,m===`fixed`&&sv.fixed,C&&sv.clickable),onTransitionEnd:e=>{nv(he),ve||e.propertyName!==`opacity`||(be(!1),U(null),te?.())},style:{...j,...ge.tooltipStyles,opacity:ce!==void 0&&Je?ce:void 0},ref:B},t.createElement(g,{className:(0,U_.default)(`react-tooltip-content-wrapper`,sv.content,cv.content)},qe),t.createElement(g,{className:(0,U_.default)(`react-tooltip-arrow`,sv.arrow,cv.arrow,a,S&&sv.noArrow),style:{...ge.tooltipArrowStyles,background:le?`linear-gradient(to right bottom, transparent 50%, ${le} 50%)`:void 0,"--rt-arrow-size":`${ue}px`},ref:fe})):null},uv=({content:e})=>t.createElement(`span`,{dangerouslySetInnerHTML:{__html:e}}),dv=t.forwardRef((({id:e,anchorId:n,anchorSelect:r,content:i,html:a,render:o,className:s,classNameArrow:c,variant:l=`dark`,place:u=`top`,offset:f=10,wrapper:p=`div`,children:m=null,events:h=[`hover`],openOnClick:g=!1,positionStrategy:_=`absolute`,middlewares:v,delayShow:b=0,delayHide:x=0,float:S=!1,hidden:C=!1,noArrow:w=!1,clickable:T=!1,closeOnEsc:E=!1,closeOnScroll:O=!1,closeOnResize:k=!1,openEvents:A,closeEvents:ee,globalCloseEvents:j,imperativeModeOnly:M=!1,style:N,position:P,isOpen:te,defaultIsOpen:F=!1,disableStyleInjection:I=!1,border:ne,opacity:L,arrowColor:R,arrowSize:re,setIsOpen:ie,afterShow:ae,afterHide:z,disableTooltip:oe,role:se=`tooltip`},ce)=>{let[le,ue]=D(i),[de,B]=D(a),[fe,pe]=D(u),[me,he]=D(l),[ge,_e]=D(f),[ve,ye]=D(b),[V,be]=D(x),[H,U]=D(S),[W,xe]=D(C),[Se,Ce]=D(p),[we,Te]=D(h),[Ee,De]=D(_),[Oe,ke]=D(null),[Ae,je]=D(null),Me=d(null),Ne=d(I),{anchorRefs:Pe,activeAnchor:Fe}=ov(e),Ie=e=>e?.getAttributeNames().reduce(((t,n)=>(n.startsWith(`data-tooltip-`)&&(t[n.replace(/^data-tooltip-/,``)]=e?.getAttribute(n)??null),t)),{}),Le=e=>{let t={place:e=>{pe(e??u)},content:e=>{ue(e??i)},html:e=>{B(e??a)},variant:e=>{he(e??l)},offset:e=>{_e(e===null?f:Number(e))},wrapper:e=>{Ce(e??p)},events:e=>{let t=e?.split(` `);Te(t??h)},"position-strategy":e=>{De(e??_)},"delay-show":e=>{ye(e===null?b:Number(e))},"delay-hide":e=>{be(e===null?x:Number(e))},float:e=>{U(e===null?S:e===`true`)},hidden:e=>{xe(e===null?C:e===`true`)},"class-name":e=>{ke(e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,n])=>{var r;(r=t[e])==null||r.call(t,n)}))};y((()=>{ue(i)}),[i]),y((()=>{B(a)}),[a]),y((()=>{pe(u)}),[u]),y((()=>{he(l)}),[l]),y((()=>{_e(f)}),[f]),y((()=>{ye(b)}),[b]),y((()=>{be(x)}),[x]),y((()=>{U(S)}),[S]),y((()=>{xe(C)}),[C]),y((()=>{De(_)}),[_]),y((()=>{Ne.current!==I&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[I]),y((()=>{typeof window<`u`&&window.dispatchEvent(new CustomEvent(`react-tooltip-inject-styles`,{detail:{disableCore:I===`core`,disableBase:I}}))}),[]),y((()=>{let t=new Set(Pe),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=Ae??a??Fe.current,s=new MutationObserver((e=>{e.forEach((e=>{if(!o||e.type!==`attributes`||!e.attributeName?.startsWith(`data-tooltip-`))return;let t=Ie(o);Le(t)}))})),c={attributes:!0,childList:!1,subtree:!1};if(o){let e=Ie(o);Le(e),s.observe(o,c)}return()=>{s.disconnect()}}),[Pe,Fe,Ae,n,r]),y((()=>{N!=null&&N.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),ne&&!Y_(`border`,`${ne}`)&&console.warn(`[react-tooltip] "${ne}" is not a valid \`border\`.`),N!=null&&N.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),L&&!Y_(`opacity`,`${L}`)&&console.warn(`[react-tooltip] "${L}" is not a valid \`opacity\`.`)}),[]);let Re=m,ze=d(null);if(o){let e=o({content:Ae?.getAttribute(`data-tooltip-content`)||le||null,activeAnchor:Ae});Re=e?t.createElement(`div`,{ref:ze,className:`react-tooltip-content-wrapper`},e):null}else le&&(Re=le);de&&(Re=t.createElement(uv,{content:de}));let Be={forwardRef:ce,id:e,anchorId:n,anchorSelect:r,className:(0,U_.default)(s,Oe),classNameArrow:c,content:Re,contentWrapperRef:ze,place:fe,variant:me,offset:ge,wrapper:Se,events:we,openOnClick:g,positionStrategy:Ee,middlewares:v,delayShow:ve,delayHide:V,float:H,hidden:W,noArrow:w,clickable:T,closeOnEsc:E,closeOnScroll:O,closeOnResize:k,openEvents:A,closeEvents:ee,globalCloseEvents:j,imperativeModeOnly:M,style:N,position:P,isOpen:te,defaultIsOpen:F,border:ne,opacity:L,arrowColor:R,arrowSize:re,setIsOpen:ie,afterShow:ae,afterHide:z,disableTooltip:oe,activeAnchor:Ae,previousActiveAnchor:Me.current,setActiveAnchor:e=>{je((t=>(e!=null&&e.isSameNode(t)||(Me.current=t),e)))},role:se};return t.createElement(lv,{...Be})}));typeof window<`u`&&window.addEventListener(`react-tooltip-inject-styles`,(e=>{e.detail.disableCore||q_({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||q_({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`})})),A();var fv={indexes:[],chapters:[],thumbnails:[],requestThumbnail:()=>{},seekPreview:!1,subtitleTracks:[],selectedSubtitleTrack:void 0,selectSubtitleTrack:()=>{},audioTracks:[],selectedAudioTrack:void 0,selectAudioTrack:()=>{},hideUI:!1,setHideUI:()=>{},hasMedia:!1,togglePictureInPicture:null,passThroughPictureInPicture:null,pictureInPictureMode:null,burnedInSubtitles:!1,playbackError:null,playbackErrors:[],ready:!1,setSourceState:()=>{}},pv=Kl({name:`source`,state:()=>({...fv}),attach({set:e}){e({setSourceState:t=>e(t),setHideUI:t=>e({hideUI:t})})}}),mv=Wf({features:[...Jd,pv],displayName:`MediaPlayer`}),Q=mv.usePlayer,hv=e=>{if(e&&e!==`und`)try{return new Intl.DisplayNames([navigator.language||`en`],{type:`language`,fallback:`none`}).of(e)||void 0}catch{return}},gv=e=>e?.replace(/_/g,` `).trim()||void 0,_v=e=>{let t=e.map(e=>hv(e.language)??gv(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=gv(e.title);return{track:e,label:(n[i]??0)>1&&a&&a!==i?`${i} (${a})`:i}})},vv=e=>_v(e).map(({track:e,label:t})=>({id:e.streamIndex,label:t})),yv=[0,250,1e3,3e3,1e4],bv=6e4,xv=500,Sv=15e3,Cv=e=>e instanceof Error?e.message:String(e),wv=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(Cv(n)),n=n?.cause}return t.length?t.join(`
5
- `):void 0},Tv=(e,t,n)=>{let r=Q(),{read:i,size:a,publicPath:o=``,libavWorkerUrl:s=``,jassubWorkerUrl:c=``,jassubWasmUrl:l=``,jassubLegacyWasmUrl:u,defaultFontUrl:f,bufferSize:p,autoplay:m=!1,chapters:h,seekPrepareBudgetMs:g=xv}=n??{},_=d(h);_.current=h;let[v,b]=D(void 0),[x,S]=D(0),C=d({count:0,at:0}),w=d(void 0);y(()=>(C.current={count:0,at:0},r.setSourceState({playbackErrors:[]}),()=>{w.current&&clearTimeout(w.current)}),[a]);let T=d(null),E=d(null),O=d(!1),k=d(i);k.current=i;let A=d(n?.onSeek);A.current=n?.onSeek;let ee=d(n?.onPlaybackError);ee.current=n?.onPlaybackError;let j=P(e=>{let t=typeof e==`number`?e:void 0;O.current=!0,r.setSourceState({selectedSubtitleTrack:t}),T.current?.selectSubtitleStream(t)},[r]),M=P(e=>{let t=T.current;if(!t||g<=0){r.seek(e);return}let n=typeof window<`u`&&window.__mediaPlayerSeekDebug,i=performance.now(),a=!1,o=`prepared`,s=()=>{if(!a&&(a=!0,r.seek(e),n)){let n=t.videoElement,r=0;if(n)for(let t=0;t<n.buffered.length;t++)n.buffered.start(t)<=e+1&&e<n.buffered.end(t)&&(r=n.buffered.end(t)-e);console.warn(`[media-player] seek to ${e.toFixed(2)} moved after ${Math.round(performance.now()-i)}ms via ${o}, runway ${r.toFixed(1)}s${o===`deadline`?` (EXPOSED: moved before its data was ready)`:``}`)}};r.setSourceState({seekingTo:e});let c=t.videoElement,l=()=>{c?.removeEventListener(`seeked`,l),clearTimeout(u),r.setSourceState({seekingTo:void 0})},u=setTimeout(l,Sv);c?.addEventListener(`seeked`,l);let d=setTimeout(()=>{o=`deadline`,s()},g);t.prepareSeek(e).catch(()=>{}).finally(()=>{clearTimeout(d),s()})},[r,g]),N=P(e=>{typeof e==`number`&&(r.setSourceState({selectedAudioTrack:e}),b(e))},[r]),te=Q(e=>e.setSourceState);y(()=>{te({selectSubtitleTrack:j,selectAudioTrack:N,requestSeek:M})},[te,j,N,M]),y(()=>{if(!e||!t||!a||!i)return;let n=!1;r.setSourceState({playbackError:null,ready:!1});let d=(t,n)=>{let i=Date.now(),a=Cv(t),o=wv(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]})},h=e=>{if(n)return;let t=bs(e);if(d(e,t),t){let t=performance.now();t-C.current.at>bv&&(C.current={count:0,at:t});let n=yv[Math.min(C.current.count,yv.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}),ee.current?.(e)};return(async()=>{try{let i=await Fs({videoElement:e,subtitleContainer:t,read:(e,t)=>k.current(e,t),length:a,publicPath:o,libavWorkerUrl:s,jassubWorkerUrl:c,jassubWasmUrl:l,jassubLegacyWasmUrl:u,defaultFontUrl:f,bufferSize:p,audioStreamIndex:v,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),m&&e.play().catch(()=>{})},onError:h,onRecovered:()=>{n||r.setSourceState({playbackError:null})},onSeek:e=>A.current?.(e),onSubtitleStreams:e=>{n||r.setSourceState({subtitleTracks:vv(e),...O.current?{}:{selectedSubtitleTrack:e[0]?.streamIndex}})},onAudioStreams:(e,t)=>{n||r.setSourceState({audioTracks:vv(e),selectedAudioTrack:t})}});if(n){i.destroy();return}T.current=i,r.setSourceState({indexes:i.indexes,chapters:_.current??i.chapters});let d=r.selectedSubtitleTrack;typeof d==`number`&&i.selectSubtitleStream(d)}catch(e){h(e)}})(),()=>{n=!0,E.current={time:e.currentTime,size:a},T.current?.destroy(),T.current=null,r.setSourceState({ready:!1})}},[r,e,t,a,o,s,c,l,u,f,p,v,m,x])},Ev=5e3,Dv=6e4,Ov=({publicPath:e,workerUrl:t,length:n,read:r,downloadedRanges:i})=>{let[a,o]=D([]),s=d(null),c=d(r);c.current=r;let l=h(()=>i?.map(({startByteOffset:e,endByteOffset:t})=>[e,t]),[i?.map(({startByteOffset:e,endByteOffset:t})=>`${e}-${t}`).join(`,`)]),u=d(l);return u.current=l,y(()=>{if(!n||!r||!e||!t)return;let i=!1,a=null,l,d=Ev,f=()=>{Gs({publicPath:e,workerUrl:t,length:n,read:(e,t)=>c.current(e,t),onThumbnails:e=>{i||o(e)}}).then(e=>{if(i){e.destroy();return}a=e,s.current=e,e.update(u.current)},()=>{i||(l=setTimeout(f,d),d=Math.min(d*2,Dv))})};return f(),()=>{i=!0,clearTimeout(l),s.current=null,a?.destroy(),o([])}},[n,e,t]),y(()=>{s.current?.update(l)},[l]),{thumbnails:a,requestThumbnail:P(e=>{s.current?.prioritize(e)},[])}},kv=(e,t)=>{let n=d(null),[r,i]=D(!1),[a]=D(()=>$s());y(()=>{if(!e||!t||!a)return;let r=ec({video:e,subtitles:t,mode:a,onBurnedInChange:i});return n.current=r,()=>{r.destroy(),n.current=null,i(!1)}},[e,t,a]);let o=P(()=>{n.current?.toggle().catch(e=>{console.warn(`picture in picture was refused`,e)})},[]);return{toggle:e&&t&&a?o:null,mode:a,burnedIn:r}},Av=`(hover: hover) and (pointer: fine)`,jv=()=>typeof matchMedia==`function`?matchMedia(Av):void 0,Mv=e=>{let t=jv();return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)},Nv=()=>!!jv()?.matches,Pv=()=>!1,Fv=(e,t)=>{let[n,r]=D(!1),[i,a]=D(),o=d(t);t&&(o.current=t);let s=d(!1),c=P(e=>{s.current!==e&&(s.current=e,o.current?.onArmedChange(e))},[]),l=P(t=>{!e||e.readyState<1||e.error||(a(t),c(!0))},[e,c]),u=P(()=>{a(void 0),c(!1)},[c]),f=!!t&&!!e;y(()=>{if(!f||!e)return;let t=()=>{r(!0),u()},n=()=>r(!1);return e.addEventListener(`enterpictureinpicture`,t),e.addEventListener(`leavepictureinpicture`,n),()=>{e.removeEventListener(`enterpictureinpicture`,t),e.removeEventListener(`leavepictureinpicture`,n),r(!1),u()}},[e,f,u]);let p=R(Mv,Nv,Pv),[m,g]=D(!1);y(()=>{if(!f)return;let e=e=>{e.pointerType===`touch`&&g(!0)},t=e=>{e.pointerType!==`touch`&&g(!1)};return window.addEventListener(`pointerdown`,e,{capture:!0,passive:!0}),window.addEventListener(`pointermove`,t,{capture:!0,passive:!0}),()=>{window.removeEventListener(`pointerdown`,e,{capture:!0}),window.removeEventListener(`pointermove`,t,{capture:!0})}},[f]);let _=f&&p&&!m;y(()=>{_||u()},[_,u]);let v=P(()=>{Promise.resolve(e?.exitPictureInPicture?.()).catch(e=>{console.warn(`leaving picture in picture was refused`,e)})},[e]);return h(()=>_?{active:n,armed:i,arm:l,disarm:u,exit:v}:null,[_,n,i,l,u,v])},Iv={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
- `}},Lv=n`
138
- display: flex;
139
- justify-content: center;
140
- align-items: center;
141
-
142
- canvas {
143
- top: unset !important;
144
- left: unset !important;
145
- width: 100%;
146
- height: 100%;
147
- margin: auto;
148
- pointer-events: none;
149
- }
150
- `,Rv=n`
151
- position: absolute;
152
- top: 0;
153
- left: 0;
154
- width: 100%;
155
- padding: calc(1.2 * var(--mp-unit)) calc(1.6 * var(--mp-unit));
156
- /* clears a notch once the player is fullscreen; resolves to zero everywhere else */
157
- padding-top: calc(calc(1.2 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
158
- ${Iv.headings.small}
159
- color: white;
160
- text-shadow: 0 0 4px rgba(0, 0, 0, 1);
161
- z-index: 2;
162
- pointer-events: none;
163
-
164
- /* one line with an ellipsis until there is width to wrap, since a release filename would
165
- otherwise run to four lines on a phone */
166
- white-space: nowrap;
167
- overflow: hidden;
168
- text-overflow: ellipsis;
169
-
170
- @media (min-width: 768px) {
171
- padding: calc(2.4 * var(--mp-unit));
172
- padding-top: calc(calc(2.4 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
173
- white-space: normal;
174
- overflow: visible;
175
- }
176
-
177
- background: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.3) 30%, rgba(0,0,0,0.2) 60%, rgba(0,0,0,0.1) 80%, transparent 100%);
178
- transition: opacity 0.1s cubic-bezier(.4,0,1,1);
179
- `,zv=a`
180
- to { transform: rotate(360deg); }
181
- `,Bv=n`
182
- position: absolute;
183
- inset: 0;
184
- z-index: 2;
185
- display: flex;
186
- justify-content: center;
187
- align-items: center;
188
- pointer-events: none;
189
-
190
- ::after {
191
- content: '';
192
- width: calc(4 * var(--mp-unit));
193
- height: calc(4 * var(--mp-unit));
194
- border-radius: 50%;
195
- border: 3px solid rgba(255, 255, 255, 0.25);
196
- border-top-color: #fff;
197
- animation: ${zv} 0.8s linear infinite;
198
- }
199
- `,Vv=n`
200
- position: absolute;
201
- inset: auto 0 20%;
202
- z-index: 3;
203
- padding: 0 calc(2 * var(--mp-unit));
204
- text-align: center;
205
- color: #fff;
206
- ${Iv.bLarge.regular}
207
- text-shadow: 0 0 4px rgba(0, 0, 0, 1);
208
- pointer-events: none;
209
- `,Hv=e=>e instanceof Error?e.message:typeof e==`string`?e:`Playback failed`,Uv=({onSubtitleRef:e})=>{let t=Q(e=>e.title),n=Q(e=>e.hideUI),r=Q(e=>e.playbackError),i=Q(e=>e.ready),a=Q(e=>e.size),o=Q(e=>e.waiting),s=Q(e=>e.seekingTo);return b(E,{children:[t?x(`div`,{className:`title`,css:Rv,style:{...n?{opacity:`0`,pointerEvents:`none`}:{}},children:t}):void 0,((a?!i:o)||s!==void 0)&&!r?x(`div`,{css:Bv}):void 0,r?x(`div`,{css:Vv,children:Hv(r)}):void 0,x(`div`,{className:`subtitles`,ref:e,css:Lv})]})},Wv=1e-4,Gv=1,Kv=e=>Math.max(Wv,Math.min(Gv,e))**2,qv=e=>Math.max(Wv,Math.min(Gv,e))**(Gv/2),Jv=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}`},Yv=(e,t)=>`${Jv(e)} / ${Jv(t)}`,Xv=e=>n`
210
- display: flex;
211
- justify-content: flex-start;
212
-
213
- /*
214
- * Bounded here rather than at each call site.
215
- *
216
- * react-tooltip's own chip rule carries width: max-content, so with nothing opposing it a chip
217
- * grows to the widest UNWRAPPED line of its content: a two sentence tooltip measured 1178px
218
- * through this component. Both declarations are load bearing, since a bound with no wrapping only
219
- * moves the overflow inside a narrow box. 26 units is the width control-bar.tsx was already
220
- * imposing on its own two line tooltip by hand, so nothing in the bar changes shape.
221
- */
222
- max-width: min(calc(26 * var(--mp-unit)), calc(100vw - calc(2.4 * var(--mp-unit))));
223
- white-space: normal;
224
- overflow-wrap: anywhere;
225
- text-align: left;
226
-
227
- /*
228
- * The radius carries !important for the same reason the paddings below do.
229
- *
230
- * react-tooltip injects its stylesheet from a passive effect while emotion inserts through
231
- * useInsertionEffect, which runs earlier, so react-tooltip's sheet lands in the head LAST at
232
- * exactly this specificity and wins every tie. Its own radius is 3px, which is what was drawn
233
- * here until this was stated.
234
- */
235
- border-radius: calc(0.4 * var(--mp-unit))!important;
236
- user-select: none;
237
-
238
- z-index: 3;
239
-
240
- * {
241
- ${Iv.bMedium.regular}
242
- }
243
-
244
- ${e===`sm`&&n`
245
- padding: calc(0.4 * var(--mp-unit))!important;
246
- `}
247
- ${e===`md`&&n`
248
- padding: calc(0.6 * var(--mp-unit))!important;
249
- `}
250
- ${e===`lg`&&n`
251
- padding: calc(1.2 * var(--mp-unit))!important;
252
- `}
253
- `,Zv={x:-1,y:-1,anchors:0},Qv=e=>{Zv.x=e.clientX,Zv.y=e.clientY},$v=()=>(Zv.anchors++===0&&window.addEventListener(`pointermove`,Qv,{capture:!0,passive:!0}),()=>{--Zv.anchors===0&&window.removeEventListener(`pointermove`,Qv,{capture:!0})}),ey=({id:e,toolTipText:t,text:n,delayShow:r=0,closeDelay:i=0,offset:a=20,tooltipPlace:o=`top`,disabled:s=!1,size:c=`md`})=>{let l=d(null),u=d(null);return y(()=>{let e=$v(),t=()=>{let e=l.current;if(!e)return;let{left:t,right:n,top:r,bottom:i}=e.getBoundingClientRect();Zv.x>=t&&Zv.x<n&&Zv.y>=r&&Zv.y<i||u.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)}},[]),b(E,{children:[x(`div`,{ref:l,"data-tooltip-id":e,"data-open":!0,"data-tooltip-offset":a,"data-tooltip-delay-show":r,"data-tooltip-delay-hide":i,"data-tooltip-place":o,children:n}),!s&&x(dv,{ref:u,css:Xv(c),id:e,noArrow:!0,children:t})]})},ty=({ref:e,onChange:t,orientation:n=`horizontal`,disabled:r=!1})=>{let[i,a]=D(!1),o=d(t);o.current=t;let s=d(null),c=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]),l=P(e=>{if(!(r||e.button>0)){s.current=e.pointerId;try{e.currentTarget.setPointerCapture?.(e.pointerId)}catch{}a(!0),o.current(c(e.clientX,e.clientY))}},[r,c]),u=P(e=>{s.current===e.pointerId&&o.current(c(e.clientX,e.clientY))},[c]),f=P(e=>{if(s.current===e.pointerId){s.current=null;try{e.currentTarget.releasePointerCapture?.(e.pointerId)}catch{}a(!1)}},[]);return y(()=>{r&&(s.current=null,a(!1))},[r]),{dragging:i,handlers:{onPointerDown:l,onPointerMove:u,onPointerUp:f,onPointerCancel:f,style:{touchAction:`none`}}}},ny=2,ry=.005,iy=`#000`,ay=`#0000`,oy=(e,t)=>{if(!t)return[];let n=new Set;for(let{start:r,end:i}of e)for(let e of[r,i]){let r=e/t;r<=ry||r>=.995||n.add(Number((r*100).toFixed(4)))}return n.size?[0,...[...n].sort((e,t)=>e-t),100]:[]},sy=(e,t)=>{let n=ny/2,r=e.length-2,i=[];for(let a=0;a<=r;a+=1){let o=e[a],s=e[a+1],c=a===0?`0%`:`calc(${o}% + ${n}px)`,l=a===r?`100%`:`calc(${s}% - ${n}px)`;i.push(`${t(a)?iy:ay} ${c} ${l}`),a!==r&&i.push(`${ay} calc(${s}% - ${n}px) calc(${s}% + ${n}px)`)}return`linear-gradient(90deg, ${i.join(`, `)})`},cy=new Set([`op`,`ops`,`opening`,`openings`,`ncop`,`オープニング`,`op主題歌`]),ly=new Set([`ed`,`eds`,`ending`,`endings`,`nced`,`credits`,`endcard`,`endroll`,`エンディング`,`エンドカード`,`エンドロール`,`ed主題歌`]),uy=new Set([`intro`,`イントロ`]),dy=new Set([`outro`,`アウトロ`]),fy={"credits start":`ending`,"credits end":null,"preview end":null,"end credits":`ending`,"closing credits":`ending`},py=new Set([`theme`,`themes`,`song`,`sequence`,`nc`,`non`,`credit`,`creditless`,`textless`,`clean`,`tv`,`size`,`version`,`ver`,`full`,`the`,`主題歌`,`ノンクレジット`]),my=new Set([`post`,`pre`,`after`,`before`,`non`]),hy=/[-:|~/\\[\]()「」『』【】,.!?"'’]|\s+by\s+/u,gy=e=>!e.trim()||/^chapter\s*\d+$/i.test(e.trim())||/^\d{1,2}:\d{2}:\d{2}([.,]\d+)?$/.test(e.trim()),_y=e=>e.replace(/([a-z぀-ヿ一-鿿])\s*\d+\s*$/u,`$1`).split(/[\s_]+/u).map(e=>e.replace(/^[^\w぀-ヿ一-鿿]+|[^\w぀-ヿ一-鿿]+$/gu,``)).filter(e=>e&&!/^\d+$/.test(e)&&!py.has(e)),vy=(e,t)=>{if(cy.has(e))return`opening`;if(ly.has(e))return`ending`;if(t){if(uy.has(e))return`opening`;if(dy.has(e))return`ending`}},yy=(e,t)=>{if(gy(e))return;let n=e.trim().toLowerCase().replace(/\s+/gu,` `);if(n in fy)return fy[n]??void 0;let r=n.split(hy).map(e=>e.trim()).filter(Boolean);if(r.some(e=>e.split(/[\s_]+/u).some(e=>my.has(e))))return;let i=r.length>1?[r[0],r.at(-1)]:r;for(let e of i){let n=_y(e);if(n.length!==1)continue;let r=vy(n[0],t);if(r)return r}},by=15,xy=87,Sy=93,Cy=e=>{let t=e.map(()=>void 0),n=e.at(-1)?.end??0;if(!n)return t;let r=e.map((e,t)=>({index:t,start:e.start,length:e.end-e.start})).filter(({length:e})=>e>=xy&&e<=Sy),i=n/2,a=r.filter(({start:e})=>e<i),o=r.filter(({start:e})=>e>=i);return a.length===1&&(t[a[0].index]=`opening`),o.length===1&&(t[o[0].index]=`ending`),t},wy=e=>{let t=e.map(({title:e})=>yy(e,!1)),n=e.reduce((e,n,r)=>e+(t[r]?n.end-n.start:0),0),r=e.reduce((e,t)=>e+(t.end-t.start),0);if(r>0&&n*2>r)return e.map(()=>void 0);let i=e.map((e,n)=>{if(e.end-e.start<by)return;let r=t[n];if(r)return r;let i=yy(e.title,!0);return i&&!t.includes(i)?i:void 0});return e.every(({title:e})=>gy(e))?Cy(e):i},Ty=n`
254
- position: relative;
255
- height: calc(.4 * var(--mp-unit));
256
-
257
- --thumbnail-width: calc(25 * var(--mp-unit));
258
- --thumbnail-half: calc(12.5 * var(--mp-unit));
259
-
260
- transition: transform .2s ease-in-out;
261
-
262
- margin: 0 12px;
263
- @media (min-width: 768px) {
264
- margin: 0 16px;
265
- }
266
- @media (min-width: 2560px) {
267
- margin: 0 24px;
268
- }
269
-
270
- user-select: none;
271
- cursor: pointer;
272
-
273
- :hover {
274
- .background-bar {
275
- transform: scaleY(1.5);
276
- }
277
- .loaded {
278
- transform: scaleY(1.5);
279
- top: calc(-.1 * var(--mp-unit));
280
- }
281
- .play-container {
282
- transform: scaleY(1.5);
283
- }
284
- }
285
-
286
- /*
287
- * One copy of the track per mask, stacked.
288
- *
289
- * The rest track paints every segment except the one under the pointer, the focus track paints only that one and
290
- * is the only element that grows. Both are full bar width, which is what keeps every percentage
291
- * and every scaleX inside them meaning exactly what it meant before chapters existed: the gaps are
292
- * cut by a mask, not by resizing anything.
293
- *
294
- * The mask sits HERE and never on .loaded-part or .play. Those two carry a scaleX, and a mask
295
- * travels with its element's transform, so a gap drawn on them would slide with the fill.
296
- */
297
- .track {
298
- position: absolute;
299
- inset: 0;
300
- /* never a hit target: .padding is the only one, and a second would break the drag gesture and
301
- fire a bubbling mouseout at every boundary crossing */
302
- pointer-events: none;
303
- }
304
-
305
- /*
306
- * The segment under the pointer, on TOP of the growth the whole bar already got.
307
- *
308
- * Measured off YouTube's live player, hovering one chapter of five: every other segment goes 4px
309
- * to 6px, and the one under the pointer goes to 10px. Both grow about the bar's centre line, so
310
- * the emphasised segment bulges above and below its neighbours rather than sitting on them. 6 x
311
- * 1.667 is 10, and the 1.5 the layers inside already carry gets this track from 4 to exactly that.
312
- */
313
- .track.focus {
314
- transform: scaleY(1.667);
315
- }
316
-
317
-
318
- .background-bar {
319
- position: absolute;
320
- inset: 0;
321
- background-color: hsla(0, 100%, 100%, .2);
322
- }
323
-
324
- .cursor-time {
325
- display: flex;
326
- justify-content: center;
327
-
328
- /* The seekbar's other hover affordance, the thumbnail below, gets a rounded box and a drop
329
- shadow. A source that ships no thumbnails, which is every source whose media the player does
330
- not own, leaves this readout as the entire preview, so it carries the same treatment instead
331
- of sitting as bare text on the picture. The ink comes from the player root. */
332
- background-color: rgba(28, 28, 28, .95);
333
- border-radius: calc(.4 * var(--mp-unit));
334
- padding: 0 calc(.6 * var(--mp-unit));
335
- box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
336
-
337
- text-shadow: 0 0 4px rgba(0, 0, 0, 1);
338
- ${Iv.bMedium.bold}
339
-
340
- gap: calc(.6 * var(--mp-unit));
341
-
342
- /*
343
- * The chapter under the pointer, next to the time, which is where the reference puts it.
344
- *
345
- * It is the one part of this pill whose width the player does not control, so it is capped and
346
- * ellipsised rather than allowed to push the box outside the picture. The cap and the clamp that
347
- * positions the pill are set together on the element, since a centred box can only be kept
348
- * inside the bar if the clamp knows its half width.
349
- */
350
- .chapter-title {
351
- overflow: hidden;
352
- text-overflow: ellipsis;
353
- min-width: 0;
354
- font-weight: normal;
355
- }
356
-
357
- position: absolute;
358
- /* Anchored on its bottom edge rather than its top: now that it has a background its height
359
- follows the font size, and a top-anchored box would grow downward into the track. */
360
- bottom: calc(1.2 * var(--mp-unit));
361
- /* Sized to its content, replacing a fixed 5 unit box that \`1:04:09\` overflows. Transparent, that
362
- overflow was invisible; filled, it would not be. */
363
- width: max-content;
364
- white-space: nowrap;
365
- transform: translateX(-50%);
366
-
367
- pointer-events: none;
368
- }
369
-
370
- .loaded {
371
- transform-origin: 0 0;
372
- position: absolute;
373
- bottom: 0;
374
- height: calc(.4 * var(--mp-unit));
375
- width: 100%;
376
- .loaded-part {
377
- transform-origin: 0 0;
378
- bottom: 0;
379
- height: calc(.4 * var(--mp-unit));
380
- width: 100%;
381
- position: absolute;
382
- background-color: hsla(0, 100%, 100%, .4);
383
- }
384
- }
385
-
386
- .play-container {
387
- position: absolute;
388
- bottom: 0;
389
- width: 100%;
390
- height: calc(.4 * var(--mp-unit));
391
- }
392
-
393
- .play {
394
- transform-origin: 0 0;
395
- background-color: #f03;
396
- position: absolute;
397
- bottom: 0;
398
- height: calc(.4 * var(--mp-unit));
399
- width: 100%;
400
- }
401
-
402
- .padding {
403
- position: absolute;
404
- bottom: -7.5px;
405
- height: calc(2 * var(--mp-unit));
406
- width: 100%;
407
- }
408
-
409
- .thumbnail {
410
- display: flex;
411
- justify-content: center;
412
-
413
- position: absolute;
414
- top: calc(calc(-3.4375 * var(--mp-unit)) - var(--thumbnail-width) * 9/16);
415
- height: calc(var(--thumbnail-width) * 9/16);
416
- width: var(--thumbnail-width);
417
-
418
- margin-left: calc(var(--thumbnail-half) * -1);
419
- pointer-events: none;
420
-
421
- img {
422
- border-radius: calc(.4 * var(--mp-unit));
423
- box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
424
-
425
- width: 100%;
426
- height: 100%;
427
- object-fit: cover;
428
- }
429
- }
430
-
431
- /* a thumb is far wider than a cursor, so the hit strip grows to 44px and the track thickens */
432
- @media (pointer: coarse) {
433
- height: calc(.6 * var(--mp-unit));
434
-
435
- /* press feedback, coarse only: a finger has no hover, so without this the bar gives no sign
436
- it is being dragged */
437
- &.dragging {
438
- .background-bar, .loaded, .play-container {
439
- transform: scaleY(1.5);
440
- }
441
- }
442
-
443
- .loaded {
444
- height: calc(.6 * var(--mp-unit));
445
- .loaded-part {
446
- height: calc(.6 * var(--mp-unit));
447
- }
448
- }
449
-
450
- .play-container {
451
- height: calc(.6 * var(--mp-unit));
452
- }
453
-
454
- .play {
455
- height: calc(.6 * var(--mp-unit));
456
- }
457
-
458
- /* grows upward into the video: centred, it would hang over the control row and win hit
459
- testing against taps meant for play, mute and fullscreen */
460
- .padding {
461
- height: 44px;
462
- bottom: 0;
463
- }
464
- }
465
-
466
- /* the clamp only holds the preview inside the bar while the bar is the wider of the two, so
467
- below that the preview is narrowed instead */
468
- @media (max-width: 480px) {
469
- --thumbnail-width: calc(18 * var(--mp-unit));
470
- --thumbnail-half: calc(9 * var(--mp-unit));
471
- }
472
- `,Ey=4,Dy=()=>{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),o=Q(e=>e.buffered),s=Q(e=>e.indexes),c=Q(e=>e.thumbnails),l=Q(e=>e.thumbnailAt),u=Q(e=>e.requestThumbnail),f=Q(e=>e.chapters),p=Q(e=>e.seekingTo),m=Q(e=>e.setSourceState),g=Q(e=>e.hideUI),_=d(null),[v,S]=D(void 0),[C,w]=D(void 0),T=e=>{w(e),u(e)},E=!!C;y(()=>{if(E)return m({seekPreview:!0}),()=>m({seekPreview:!1})},[m,E]),y(()=>{g&&T(void 0)},[g]);let O=d(void 0),k=d(0),A=d(void 0),ee=d(void 0),j=d(!1),{dragging:M,handlers:N}=ty({ref:_,onChange:e=>{if(k.current+=1,A.current=e,ee.current===void 0)ee.current=e;else if(!j.current){let t=_.current?.getBoundingClientRect().width??0;Math.abs(e-ee.current)*t>Ey&&(j.current=!0)}S(e),O.current!==`mouse`&&T(e*r)}}),P=e=>{O.current=e.pointerType,k.current=0,ee.current=void 0,j.current=!1,N.onPointerDown(e)},te=t=>{N.onPointerUp(t);let i=k.current>0?A.current:void 0;if(i!==void 0&&r){let t=i*r;n?n(t):e.seek(t)}k.current=0,j.current=!1,ee.current=void 0,t.pointerType!==`mouse`&&T(void 0)},F=e=>{if(!_.current)return;let{left:t,right:n}=_.current.getBoundingClientRect();return Math.min(Math.max((e-t)/(n-t),0),1)*r},I=d(`mouse`),ne=e=>{I.current=e.pointerType},L=e=>{I.current!==`touch`&&T(F(e.clientX))},R=()=>{_.current&&T(void 0)},re=e=>r?e/r*100:0,ie=(e,t,n)=>{let r=Number((n-t).toFixed(4)),i=t*100;return x(`div`,{className:`loaded-part`,style:{transform:`scaleX(${r})`,marginLeft:`${i}%`}},e)},ae=h(()=>i===void 0?r?o.map(([e,t],n)=>ie(n,e/r,t/r)):[]: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);return!a||!o?null:ie(t,a.timestamp/r,o.timestamp/r)})??[],[r,i,i===void 0?o:void 0,s.length,a?.map(({startByteOffset:e,endByteOffset:t})=>`${e}/${t}`).join(`,`)]);y(()=>{v!==void 0&&r&&M&&j.current&&e.seek(v*r)},[e,M,v,r]);let z=h(()=>{if(!r)return 0;if(M&&v!==void 0)return v;let e=p??t;return typeof e==`number`?e/r:0},[r,t,M,v,p]),oe=h(()=>oy(f,r),[f,r]),se=oe.length>0,ce=h(()=>{if(!se||C===void 0||!r)return-1;let e=C/r*100,t=oe.findIndex((t,n)=>n<oe.length-1&&e>=t&&e<oe[n+1]);return t>=0?t:oe.length-2},[se,oe,C,r]),le=h(()=>se?sy(oe,e=>e!==ce):void 0,[se,oe,ce]),ue=h(()=>ce>=0?sy(oe,e=>e===ce):void 0,[oe,ce]),de=h(()=>{if(C!==void 0)return f.find(({start:e,end:t})=>e<=C&&C<t)},[f,C]),B=h(()=>{if(C){if(l)return l(C);if(c.length)return c.find(({startTime:e,endTime:t})=>e<=C&&C<t)}},[c,l,C]),fe=(e,t)=>b(`div`,{className:e?`track ${e}`:`track`,style:t?{maskImage:t}:void 0,children:[x(`div`,{className:`background-bar`}),x(`div`,{className:`loaded`,children:ae}),x(`div`,{className:`play-container`,children:x(`div`,{className:`play`,style:{transform:`scaleX(${z})`}})})]});return b(`div`,{css:Ty,ref:_,className:[`progress-bar`,M?`dragging`:``,se?`segmented`:``].filter(Boolean).join(` `),onPointerDown:ne,onPointerMove:ne,onMouseMove:L,onMouseOut:R,children:[fe(void 0,le),C?b(`div`,{className:`cursor-time`,style:{left:de?`clamp(var(--thumbnail-half), ${re(C)}%, calc(100% - var(--thumbnail-half)))`:`clamp(calc(3 * var(--mp-unit)), ${re(C)}%, calc(100% - calc(3 * var(--mp-unit))))`,maxWidth:de?`var(--thumbnail-width)`:void 0},children:[x(`span`,{className:`cursor-time-value`,children:Jv(C)}),de?x(`span`,{className:`chapter-title`,children:de.title}):void 0]}):void 0,x(`div`,{className:`progress`}),x(`div`,{className:`hover`}),ue?fe(`focus`,ue):void 0,x(`div`,{className:`scrubber`}),x(`div`,{className:`padding`,...N,onPointerDown:P,onPointerUp:te,onPointerCancel:te}),x(`div`,{className:`thumbnail`,style:{left:`clamp(var(--thumbnail-half), ${re(C??1)}%, calc(100% - var(--thumbnail-half)))`},children:B?.url?x(`img`,{src:B.url}):void 0})]})},Oy=`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`,ky={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`},Ay=e=>b(`svg`,{...ky,...e,children:[x(`rect`,{x:`3`,y:`5`,width:`18`,height:`14`,rx:`2`,ry:`2`}),x(`path`,{d:`M7 15h4m4 0h2M7 11h2m4 0h4`})]}),jy=e=>b(`svg`,{...ky,...e,children:[x(`rect`,{x:`3`,y:`5`,width:`18`,height:`14`,rx:`2`,ry:`2`}),x(`path`,{d:`M7 15h4m4 0h2M7 11h2m4 0h4`}),x(`line`,{x1:`2`,y1:`2`,x2:`22`,y2:`22`})]}),My=e=>b(`svg`,{...ky,...e,children:[x(`path`,{d:`M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5`}),x(`rect`,{x:`12`,y:`13`,width:`10`,height:`8`,rx:`1`,ry:`1`}),x(`path`,{d:`M14.5 18.5h2m2 0h1`})]}),Ny=e=>b(`svg`,{...ky,...e,children:[x(`path`,{d:`M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5`}),x(`rect`,{x:`12`,y:`13`,width:`10`,height:`8`,rx:`1`,ry:`1`}),x(`path`,{d:`M6 9h3m2 0h2`})]}),Py=n`
473
- .popover {
474
- position: absolute;
475
- /* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
476
- bar, so a menu centred on it puts its own edges wherever the button happens to sit: with no
477
- picture-in-picture button, which is every source whose media the player does not own, an edge
478
- landed outside the box, and the root's \`overflow: hidden\` cut it off, taking the rows under it
479
- out of reach. The inset matches the bar's own padding so the menu lines up with the last button. */
480
- right: calc(12px + env(safe-area-inset-right, 0px));
481
- bottom: calc(100% + 8px);
482
-
483
- overflow-y: auto;
484
- width: 180px;
485
- /* \`100%\` is the control bar, which is the width of the PLAYER. The old \`100vw\` was the viewport,
486
- which equals the player only when the player is the whole document, and it is the wrong kind of
487
- guard besides: a max-width shrinks the box, it never moves it back inside. */
488
- max-width: calc(100% - 24px);
489
- /* Sized to its rows, capped at what fits. A fixed height left the settings menu two thirds empty
490
- once subtitles moved out to its own button, and a long track list scrolls at the cap either way. */
491
- height: max-content;
492
- /* The room actually above the bar. A short player had the top of the menu clipped by that same
493
- \`overflow: hidden\`. With no size container in the ancestry this resolves against the small
494
- viewport, so it can only ever shrink the box, never grow it. */
495
- max-height: min(160px, calc(100cqh - 100% - 16px));
496
- @media (min-width: 768px) {
497
- right: calc(16px + env(safe-area-inset-right, 0px));
498
- width: 250px;
499
- max-width: calc(100% - 32px);
500
- }
501
- @media (min-width: 2560px) {
502
- right: calc(24px + env(safe-area-inset-right, 0px));
503
- max-width: calc(100% - 48px);
504
- }
505
-
506
- display: flex;
507
- flex-direction: column;
508
-
509
- border-radius: 8px;
510
- background-color: rgba(28,28,28,0.95);
511
- ${Iv.bMedium.regular}
512
-
513
- z-index: 4;
514
-
515
- > div {
516
- display: flex;
517
- align-items: center;
518
- justify-content: space-between;
519
-
520
- color: #fff;
521
- outline: none;
522
-
523
- padding: 8px 6px 8px 12px;
524
-
525
- width: 100%;
526
- /* rows keep their own height inside the fixed height column, so a long page scrolls rather than
527
- squashing every row into it */
528
- flex-shrink: 0;
529
- @media (pointer: coarse) {
530
- box-sizing: border-box;
531
- min-height: 44px;
532
- }
533
-
534
- :first-of-type {
535
- border-radius: 8px 8px 0 0;
536
- }
537
- :last-of-type {
538
- border-radius: 0 0 8px 8px;
539
- }
540
- &:not(.no-hover) {
541
- cursor: pointer;
542
- }
543
- &:not(.no-hover):hover {
544
- background-color: rgba(255,255,255,.1);
545
- }
546
-
547
- > div {
548
- display: flex;
549
- align-items: center;
550
- justify-content: center;
551
-
552
- .secondary {
553
- color: #eee;
554
- ${Iv.bSmall.regular}
555
- }
556
- }
557
- }
558
-
559
- .back {
560
- display: flex;
561
- align-items: center;
562
- justify-content: flex-start;
563
- border-bottom: 1px solid #4D4D4E;
564
-
565
- svg {
566
- transform: translateX(-4px);
567
- transition: transform 0.2s ease-in-out;
568
- }
569
-
570
- :hover {
571
- svg {
572
- transform: translateX(-8px);
573
- }
574
- }
575
- }
576
- }
577
-
578
- .track-list {
579
- .description {
580
- word-break: break-word;
581
- }
582
-
583
- /* Dimmed and inert, but still listed. A source that names a track it cannot serve right now is
584
- saying the track exists, and dropping the row would read as the source having nothing. */
585
- .unavailable {
586
- opacity: 0.5;
587
- cursor: default;
588
- :hover {
589
- background-color: transparent;
590
- }
591
- }
592
-
593
- .failed {
594
- border-bottom: 1px solid #4D4D4E;
595
- color: #f66;
596
- ${Iv.bSmall.regular}
597
- }
598
- }
599
- `,Fy=({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 b(`div`,{onClick:()=>{l||r(e??void 0)},className:[a,l?`unavailable`:null].filter(Boolean).join(` `)||void 0,children:[x(`span`,{children:i}),x(`span`,{children:s?`…`:(n??null)===e?`✓`:``})]},e??`__off__`)};return b(`div`,{className:`popover track-list`,children:[b(`div`,{className:i?`back`:`back no-hover`,onClick:i,children:[i?x(Zg,{}):null,x(`span`,{children:e})]}),s?x(`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`))]})},Iy=({onReset:e}={})=>{let t=d(null),[n,r]=D(!1),[i,a]=D(void 0),[o,s]=D(!1),c=d(e);c.current=e;let l=()=>{r(!1),c.current?.()};return y(()=>{let e=e=>{n&&t.current&&!t.current.contains(e.target)&&l()};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[n]),{open:n,toggle:()=>{r(e=>!e),s(!1),c.current?.()},close:l,containerRef:t,pending:i,failed:o,runSelect:(e,t)=>{if(i!==void 0)return;s(!1);let n;try{n=t()}catch(e){console.warn(`[media-player] track selection failed:`,e),s(!0);return}if(!(n instanceof Promise)){l();return}a(e),n.then(()=>{a(void 0),l()},e=>{console.warn(`[media-player] track selection failed:`,e),a(void 0),s(!0)})}}},Ly=n`
600
- /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
601
- which is the width of the player box, so it can be clamped to it. */
602
- position: static;
603
-
604
- .errors {
605
- /* the icon keeps its size, the pressable box grows around it */
606
- @media (pointer: coarse) {
607
- box-sizing: border-box;
608
- justify-content: center;
609
-
610
- min-width: 44px;
611
- min-height: 44px;
612
- }
613
- }
614
-
615
- ${Py}
616
-
617
- .popover.error-list {
618
- /* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
619
- decoder message that has been ellipsized is not worth copying. */
620
- width: 420px;
621
- max-height: min(300px, calc(100cqh - 100% - 16px));
622
-
623
- /* track-menu's header is a left-aligned label row; here it carries a control too, so the two
624
- ends go to the two ends */
625
- .back {
626
- justify-content: space-between;
627
- gap: 8px;
628
- }
629
-
630
- .copy {
631
- /* sits in the header row, which track-menu styles as .back */
632
- display: flex;
633
- align-items: center;
634
- gap: 6px;
635
-
636
- background: none;
637
- border: none;
638
- padding: 4px 6px;
639
- border-radius: 4px;
640
-
641
- color: #fff;
642
- cursor: pointer;
643
- ${Iv.bSmall.regular}
644
-
645
- &:hover {
646
- background-color: rgba(255,255,255,.1);
647
- }
648
-
649
- svg {
650
- width: 14px;
651
- height: 14px;
652
- }
653
- }
654
-
655
- .entry {
656
- /* one failure is a block of text, so it stacks instead of sitting on one line */
657
- display: flex;
658
- flex-direction: column;
659
- align-items: flex-start;
660
- gap: 2px;
661
-
662
- .when {
663
- color: #bbb;
664
- ${Iv.bSmall.regular}
665
-
666
- /* the one part of the line worth scanning for, so it is the one part at full brightness */
667
- .count {
668
- margin-left: 6px;
669
- color: #fff;
670
- }
671
- }
672
-
673
- .what {
674
- /* the decoder's own words, which are long and must not be cut */
675
- overflow-wrap: anywhere;
676
- white-space: pre-wrap;
677
- }
678
-
679
- .cause {
680
- color: #ddd;
681
- overflow-wrap: anywhere;
682
- white-space: pre-wrap;
683
- ${Iv.bSmall.regular}
684
- }
685
- }
686
- }
687
- `,Ry=e=>new Date(e).toLocaleTimeString(),zy=e=>e===void 0||!Number.isFinite(e)?void 0:Jv(Math.max(0,e)),By=e=>e.reduce((e,t)=>e+t.count,0),Vy=e=>e.map((e,t)=>{let n=zy(e.atMediaTime),r=e.count>1?`${new Date(e.at).toISOString()} to ${new Date(e.lastAt).toISOString()} ×${e.count}`:new Date(e.at).toISOString();return[`${t+1}. ${r}${n?` (at ${n})`:``}${e.recovered?` [recovered]`:``}`,e.message,e.detail].filter(Boolean).join(`
688
- `)}).join(`
689
-
690
- `),Hy=()=>{let e=Q(e=>e.playbackErrors),{open:t,toggle:n,containerRef:r}=Iy(),[i,a]=D(!1);if(e.length===0)return null;let o=()=>{navigator.clipboard?.writeText(Vy(e)).then(()=>{a(!0),setTimeout(()=>a(!1),2e3)},e=>console.warn(`[media-player] could not copy the errors:`,e))},s=`Playback errors (${By(e)})`;return b(`div`,{css:Ly,ref:r,children:[x(ey,{id:`errors`,disabled:t,text:x(`button`,{className:`errors`,type:`button`,onClick:n,"aria-label":s,"aria-expanded":t,children:x(Ug,{className:`alert-triangle`})}),toolTipText:x(`span`,{children:s})}),t&&b(`div`,{className:`popover error-list`,children:[b(`div`,{className:`back no-hover`,children:[x(`span`,{children:s}),b(`button`,{className:`copy`,type:`button`,onClick:o,"aria-label":`Copy the errors`,children:[x(i?qg:a_,{}),x(`span`,{children:i?`Copied`:`Copy`})]})]}),e.map((e,t)=>b(`div`,{className:`entry no-hover`,children:[b(`span`,{className:`when`,children:[Ry(e.at),e.count>1?` to ${Ry(e.lastAt)}`:``,zy(e.atMediaTime)?` at ${zy(e.atMediaTime)}`:``,e.recovered?` recovered`:``,e.count>1?x(`span`,{className:`count`,children:`×${e.count}`}):null]}),x(`span`,{className:`what`,children:e.message}),e.detail?x(`span`,{className:`cause`,children:e.detail}):null]},`${e.at}-${t}`))]})]})},Uy=n`
691
- display: flex;
692
- align-items: center;
693
- justify-content: center;
694
- flex-direction: column;
695
- width: 100%;
696
-
697
- .playback-slider {
698
- display: flex;
699
- align-items: center;
700
-
701
- padding: 8px 4px;
702
- margin: 0 2px;
703
- /* a finger needs a 44px band to press, so the padding grows while the track stays 3px */
704
- @media (pointer: coarse) {
705
- padding: 20px 8px;
706
- }
707
-
708
- cursor: pointer;
709
-
710
- > div {
711
- position: relative;
712
-
713
- background: #ccc;
714
- border-radius: 4px;
715
-
716
- width: 120px;
717
- max-width: 100%;
718
- height: 3px;
719
- @media (min-width: 768px) {
720
- height: 4px;
721
- }
722
- }
723
-
724
- .playback-handle {
725
- position: absolute;
726
-
727
-
728
- background: #ffffff;
729
- border-radius: 50%;
730
- transform: translateX(-50%);
731
- pointer-events: none;
732
-
733
- width: 10px;
734
- height: 10px;
735
- top: -3.5px;
736
- @media (min-width: 768px) {
737
- width: 12px;
738
- height: 12px;
739
- top: -4px;
740
- }
741
- }
742
- }
743
- `,Wy=()=>{let e=Q(),t=Q(e=>e.playbackRate),n=d(null),r=d(null),i=.25,a=2.75,o=(e,t=.05)=>Math.round(e/t)*t,s=o(t||1),c=e=>(e-i)/a*100,l=e=>o(i+e*a),{handlers:u}=ty({ref:r,onChange:t=>e.setPlaybackRate(l(t))}),f=t=>{t.preventDefault();let n=.05,r=s;r=t.deltaY<0?Math.min(3,r+n):Math.max(i,r-n),e.setPlaybackRate(r)};y(()=>{let e=n.current;return e&&e.addEventListener(`wheel`,f,{passive:!1}),()=>{e&&e.removeEventListener(`wheel`,f)}},[t]);let p=c(s);return b(`div`,{css:Uy,children:[b(`div`,{children:[s.toFixed(2),`x`]}),x(`div`,{className:`playback-slider`,ref:n,...u,children:x(`div`,{ref:r,style:{background:`linear-gradient(to right,
744
- #fff 0% ${p}%,
745
- #3A3A3A ${p}% 100%
746
- )`},children:x(`div`,{className:`playback-handle`,style:{left:`${p}%`}})})})]})},Gy=n`
747
- /* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
748
- as wide as the player box and can therefore be clamped to it. The outside-click check uses
749
- \`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
750
- tooltips already resolve against the control bar with no positioned wrapper of their own. */
751
- position: static;
752
-
753
- .settings {
754
- /* the icon keeps its size, the pressable box grows around it */
755
- @media (pointer: coarse) {
756
- box-sizing: border-box;
757
- justify-content: center;
758
-
759
- min-width: 44px;
760
- min-height: 44px;
761
- }
762
- }
763
-
764
- ${Py}
765
-
766
- .playback-rate {
767
- .slider {
768
- width: 100%;
769
- }
770
- .options {
771
- display: grid;
772
- grid-template-columns: 1fr 1fr 1fr 1fr;
773
- align-items: center;
774
-
775
- padding: 8px 12px;
776
- /* four presets across a 180px popover leave targets 34px wide, so a finger gets two rows of two
777
- until the popover is wide enough for the row of four */
778
- @media (pointer: coarse) {
779
- grid-template-columns: 1fr 1fr;
780
- }
781
- @media (pointer: coarse) and (min-width: 768px) {
782
- grid-template-columns: 1fr 1fr 1fr 1fr;
783
- }
784
-
785
- > div {
786
- display: flex;
787
- align-items: center;
788
- border-radius: 4px;
789
-
790
- padding: 8px 6px;
791
- height: 100%;
792
- @media (pointer: coarse) {
793
- box-sizing: border-box;
794
- min-height: 44px;
795
- }
796
-
797
- cursor: pointer;
798
- :hover {
799
- background-color: rgba(255,255,255,.1);
800
- }
801
- }
802
- }
803
- }
804
-
805
- `,Ky=()=>{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]=D(0),{open:s,toggle:c,containerRef:l,pending:u,failed:d,runSelect:f}=Iy({onReset:()=>o(0)}),p=t=>{e.setPlaybackRate(t),o(0)},m=e=>{e!==void 0&&f(e,()=>i(e))},h=e=>()=>{o(e)};return b(`div`,{css:Gy,ref:l,children:[x(ey,{id:`settings`,disabled:s,text:x(`button`,{className:`settings`,type:`button`,onClick:c,"aria-label":`Settings`,"aria-expanded":s,children:x(k_,{})}),toolTipText:x(`span`,{children:`Settings`})}),s&&a===0&&b(`div`,{className:`popover menu`,children:[n.length>1?b(`div`,{onClick:h(2),children:[x(`div`,{children:`Audio`}),x(`div`,{children:x(t_,{})})]}):null,b(`div`,{onClick:h(1),children:[x(`div`,{children:`Playback speed`}),b(`div`,{children:[x(`span`,{className:`secondary`,children:t===1?`(Default)`:t.toFixed(2)}),x(t_,{})]})]})]}),s&&a===1&&b(`div`,{className:`popover playback-rate`,children:[b(`div`,{className:`back`,onClick:h(0),children:[x(Zg,{}),x(`span`,{children:`Playback speed`})]}),x(`div`,{className:`slider no-hover`,children:x(Wy,{})}),b(`div`,{className:`options no-hover`,children:[x(`div`,{onClick:()=>p(.5),children:`0.5x`}),x(`div`,{onClick:()=>p(1),children:`1x`}),x(`div`,{onClick:()=>p(1.5),children:`1.5x`}),x(`div`,{onClick:()=>p(2),children:`2x`})]})]}),s&&a===2&&x(Fy,{title:`Audio`,tracks:n,selected:r,onSelect:m,onBack:h(0),pending:u,failed:d})]})},qy=n`
806
- /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
807
- which is the width of the player box, so it can be clamped to it. */
808
- position: static;
809
-
810
- .subtitles {
811
- /* the icon keeps its size, the pressable box grows around it */
812
- @media (pointer: coarse) {
813
- box-sizing: border-box;
814
- justify-content: center;
815
-
816
- min-width: 44px;
817
- min-height: 44px;
818
- }
819
- }
820
-
821
- ${Py}
822
- `,Jy=()=>{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}=Iy();if(e.length===0)return null;let u=t!==void 0;return b(`div`,{css:qy,ref:o,children:[x(ey,{id:`subtitles`,disabled:i,text:x(`button`,{className:`subtitles`,type:`button`,onClick:a,"aria-label":`Subtitles`,"aria-expanded":i,"aria-pressed":u,children:u?x(Ay,{className:`captions`}):x(jy,{className:`captions-off`})}),toolTipText:x(`span`,{children:`Subtitles`})}),i&&x(Fy,{title:`Subtitles`,tracks:e,selected:t,onSelect:e=>l(e??null,()=>n(e)),offLabel:r??`Disable`,pending:s,failed:c})]})},Yy={primary:`#EAEBEE`,secondary:`#D0D0D9`,hover:`rgba(255, 255, 255, 0.13)`,borderPrimary:`#384F70`,backgroundTooltip:`#222222`},Xy=n`
823
- display: flex;
824
- align-items: center;
825
-
826
- padding: 16px 4px;
827
- margin: 0 2px;
828
- /* a finger needs a 44px band to press, so the padding grows while the track stays 3px */
829
- @media (pointer: coarse) {
830
- padding: 22px 4px;
831
- }
832
-
833
- cursor: pointer;
834
-
835
- > div {
836
- position: relative;
837
-
838
- background: #ccc;
839
- border-radius: 4px;
840
-
841
- width: 80px;
842
- height: 3px;
843
- /* the control bar has under 360px to fit every button once the slider is always open, so the
844
- track lends some of its length back on a phone and takes it again on anything wider */
845
- @media (pointer: coarse) {
846
- width: 64px;
847
- }
848
- @media (pointer: coarse) and (min-width: 768px) {
849
- width: 80px;
850
- }
851
- }
852
-
853
- .volume-handle {
854
- position: absolute;
855
- top: -3.5px;
856
-
857
- background: #ffffff;
858
- border-radius: 50%;
859
- transform: translateX(-50%);
860
- pointer-events: none;
861
-
862
- width: 10px;
863
- height: 10px;
864
- }
865
- `,Zy=({value:e,onChange:t})=>{let n=Q(e=>e.volume),r=Q(e=>e.muted),i=d(null),a=d(null),{handlers:o}=ty({ref:a,onChange:t}),s=n=>{n.preventDefault();let r=.05,i=e;i=n.deltaY<0?Math.min(1,i+r):Math.max(0,i-r),t(i)};y(()=>{let e=i.current;return e&&e.addEventListener(`wheel`,s,{passive:!1}),()=>{e&&e.removeEventListener(`wheel`,s)}},[e]);let c=e*100,l=h(()=>Math.round(r?0:qv(n)*100),[n,r]);return x(ey,{id:`volume-slider`,text:x(`div`,{ref:i,css:Xy,...o,children:x(`div`,{ref:a,style:{background:`linear-gradient(to right,
866
- #fff 0% ${c}%,
867
- #3A3A3A ${c}% 100%
868
- )`},children:x(`div`,{className:`volume-handle`,style:{left:`${e*100}%`}})})}),toolTipText:b(`div`,{className:`volume-value`,children:[l,`%`]})})},Qy=n`
869
- position: relative;
870
- display: flex;
871
- align-items: center;
872
-
873
- .volume-slider-container {
874
- display: flex;
875
- align-items: center;
876
-
877
- width: 0;
878
- margin-right: 0;
879
- overflow: hidden;
880
- pointer-events: none;
881
-
882
- transition: margin .2s cubic-bezier(0.4,0,1,1), width .2s cubic-bezier(0.4,0,1,1);
883
- -webkit-transition: margin .2s cubic-bezier(0.4,0,1,1), width .2s cubic-bezier(0.4,0,1,1);
884
-
885
- .volume-slider-background {
886
- display: flex;
887
- flex-direction: row;
888
- align-items: center;
889
-
890
- border-radius: 4px;
891
-
892
- .volume-value {
893
- ${Iv.bMedium.regular};
894
- color: #ffffff;
895
- }
896
- }
897
- }
898
-
899
- &:hover .volume-slider-container {
900
- width: calc(9 * var(--mp-unit));
901
-
902
- transition: margin .2s cubic-bezier(0,0,0.2,1), width .2s cubic-bezier(0,0,0.2,1);
903
- -webkit-transition: margin .2s cubic-bezier(0,0,0.2,1), width .2s cubic-bezier(0,0,0.2,1);
904
-
905
- pointer-events: auto;
906
- }
907
-
908
- /* a touch screen has no hover, so the slider stays open there and the button only mutes */
909
- @media (pointer: coarse) {
910
- /* auto, not a fixed rem: the container keeps overflow: hidden, so a narrower fixed width
911
- silently clips the track and makes the clipped part unhittable */
912
- .volume-slider-container,
913
- &:hover .volume-slider-container {
914
- width: auto;
915
-
916
- pointer-events: auto;
917
- }
918
-
919
- /* a 44px press target around an 18px icon, floored here because the control bar sets the
920
- padding at a higher specificity */
921
- .sound {
922
- /* border-box explicitly, since a consumer reset cannot be assumed */
923
- box-sizing: border-box;
924
- justify-content: center;
925
-
926
- min-width: 44px;
927
- min-height: 44px;
928
- }
929
- }
930
-
931
- `,$y=({ref:e})=>{let t=Q(),n=Q(e=>e.volume),r=Q(e=>e.muted),i=h(()=>qv(n),[n]);return b(`div`,{css:Qy,children:[x(ey,{id:`sound`,text:x(`button`,{className:`sound`,type:`button`,onClick:()=>t.toggleMuted(),ref:e,"aria-label":`Mute`,"aria-pressed":r||n===0,children:x(r||n===0?V_:n<=.5?N_:L_,{size:18,color:`#fff`})}),toolTipText:x(`span`,{children:r?`Unmute (m)`:`Mute (m)`})}),x(`div`,{className:`volume-slider-container`,children:x(`div`,{className:`volume-slider-background`,children:x(Zy,{value:r?0:i,onChange:e=>{t.setVolume(Kv(e))}})})})]})},eb=.05,tb=5,nb=50,rb=1e3,ib=n`
932
- display: flex;
933
- flex-direction: column;
934
- gap: calc(0.4 * var(--mp-unit));
935
-
936
- .hint {
937
- opacity: 0.72;
938
- font-size: 0.9em;
939
- }
940
- `,ab=n`
941
- position: absolute;
942
- bottom: 0;
943
- width: 100%;
944
-
945
- background: linear-gradient(0deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.45) 20%, rgba(0,0,0,0.3) 40%, rgba(0,0,0,0.15) 70%, transparent 100%);
946
- transition: opacity 0.1s cubic-bezier(.4,0,1,1);
947
-
948
- .actions {
949
- display: flex;
950
- justify-content: space-between;
951
-
952
- /* repeated per breakpoint: nested at-rules are hoisted after the rule, so a shorthand inside a
953
- media query would override a longhand above it and silently drop the safe-area inset */
954
- padding: 6px calc(12px + env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) calc(12px + env(safe-area-inset-left, 0px));
955
- @media (min-width: 768px) {
956
- padding: 8px calc(16px + env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) calc(16px + env(safe-area-inset-left, 0px));
957
- }
958
- @media (min-width: 2560px) {
959
- padding: 8px calc(24px + env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) calc(24px + env(safe-area-inset-left, 0px));
960
- }
961
-
962
- .left, .right {
963
- display: flex;
964
- align-items: center;
965
-
966
- button {
967
- display: flex;
968
- align-items: center;
969
-
970
- outline: none;
971
- border: none;
972
- background: none;
973
-
974
- svg {
975
- width: 18px;
976
- height: 18px;
977
- @media (min-width: 768px) {
978
- width: 24px;
979
- height: 24px;
980
- }
981
- @media (min-width: 2560px) {
982
- width: 28px;
983
- height: 28px;
984
- }
985
- }
986
-
987
- svg {
988
- stroke: #fff;
989
- }
990
-
991
- /* Reads as unavailable rather than absent, so the bar does not reflow when tracks land. */
992
- &:disabled {
993
- cursor: default;
994
- opacity: .4;
995
- }
996
- }
997
-
998
- .play, .sound, .time, .errors, .subtitles, .settings, .picture-in-picture, .full-screen {
999
- display: flex;
1000
- align-items: center;
1001
-
1002
- height: 100%;
1003
-
1004
- border-radius: 4px;
1005
- user-select: none;
1006
-
1007
- padding: 8px;
1008
- @media (min-width: 768px) {
1009
- padding: 8px 12px;
1010
- }
1011
- @media (min-width: 2560px) {
1012
- padding: 8px 12px;
1013
- }
1014
- }
1015
-
1016
- .play, .sound, .errors, .subtitles, .settings, .picture-in-picture, .full-screen {
1017
- border-radius: 4px;
1018
-
1019
- padding: 8px;
1020
- @media (min-width: 768px) {
1021
- padding: 8px 12px;
1022
- }
1023
- @media (min-width: 2560px) {
1024
- padding: 8px 12px;
1025
- }
1026
-
1027
- cursor: pointer;
1028
-
1029
- /* .armed is the hover of a control letting its click through, which takes no pointer events
1030
- of its own and so is never :hover */
1031
- :hover, &.armed {
1032
- background-color: ${Yy.hover};
1033
- }
1034
-
1035
- /* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
1036
- window still has a mouse */
1037
- @media (pointer: coarse) {
1038
- /* border-box explicitly, since a consumer reset cannot be assumed */
1039
- box-sizing: border-box;
1040
- min-width: 44px;
1041
- min-height: 44px;
1042
- justify-content: center;
1043
- }
1044
- }
1045
- }
1046
-
1047
- .left {
1048
- .time {
1049
- ${Iv.bMedium.regular}
1050
- text-shadow: 0 0 4px rgba(0, 0, 0, 1);
1051
- }
1052
- }
1053
- .right {
1054
- .picture-in-picture {
1055
- img {
1056
- width: 22px;
1057
- height: 22px;
1058
- @media (min-width: 768px) {
1059
- width: 28px;
1060
- height: 28px;
1061
- }
1062
- @media (min-width: 2560px) {
1063
- width: 32px;
1064
- height: 32px;
1065
- }
1066
- }
1067
- }
1068
- }
1069
- }
1070
- `,ob=()=>{let e=Q(),t=Q(e=>e.paused),n=Q(e=>e.currentTime),r=Q(e=>e.duration),i=Q(e=>e.seekingTo),a=Q(e=>e.fullscreen),o=Q(e=>e.hideUI),s=Q(e=>e.togglePictureInPicture),c=Q(e=>e.pictureInPictureMode),l=Q(e=>e.burnedInSubtitles),u=Q(e=>e.passThroughPictureInPicture),f=Q(e=>e.subtitleTracks),p=Q(e=>e.requestSeek),[m,h]=D(null),g=d(null),_=d(void 0),v=c===`burn-in`,S=f.length>0,C=r>0&&n===r,w=P(({direction:t,stepSize:n})=>{let r=qv(e.volume),i=t===`up`?n:-n,a=Math.max(0,Math.min(1,r+i)),o=e.muted;e.setVolume(Kv(a)),o&&!e.muted&&e.toggleMuted()},[e]);y(()=>{let t=t=>p?p(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`)w({direction:`up`,stepSize:eb});else if(n.key===`ArrowDown`)w({direction:`down`,stepSize:eb});else if(n.key===`ArrowRight`){if(!e.duration)return;t(Math.min(e.currentTime+tb,e.duration))}else n.key===`ArrowLeft`?t(Math.max(e.currentTime-tb,0)):i=!1;i&&n.preventDefault()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,w,p]);let T=P(e=>{e.preventDefault(),e.deltaY<0?w({direction:`up`,stepSize:eb}):w({direction:`down`,stepSize:eb})},[w]);y(()=>{if(m)return m.addEventListener(`wheel`,T,{passive:!1}),()=>m.removeEventListener(`wheel`,T)},[m,T]);let E=e=>{if(!u||u.active||u.armed||e.pointerType===`touch`)return;let{left:t,top:n,width:r,height:i}=e.currentTarget.getBoundingClientRect();u.arm({left:t,top:n,width:r,height:i})},O=!!u?.armed;return y(()=>{if(!O)return;clearInterval(_.current);let e=1/0,t=setInterval(()=>{if(Date.now()>e){clearInterval(t);return}let n=g.current,r=document.activeElement;n&&r?.tagName===`IFRAME`&&r.closest(`.video`)?.parentElement?.contains(n)&&n.focus({preventScroll:!0})},nb);return _.current=t,()=>{e=Date.now()+rb}},[O]),y(()=>()=>clearInterval(_.current),[]),b(`div`,{css:ab,style:{...o?{opacity:`0`,pointerEvents:`none`}:O?{pointerEvents:`none`}:{}},children:[x(Dy,{}),b(`div`,{className:`actions`,children:[b(`div`,{className:`left`,children:[x(ey,{id:`play`,tooltipPlace:`top-start`,text:x(`button`,{className:`play`,type:`button`,onClick:()=>e.togglePaused(),"aria-label":C?`Replay`:t?`Play`:`Pause`,children:x(C?T_:t?x_:__,{})}),toolTipText:x(`span`,{children:C?`Replay (k)`:t?`Play (k)`:`Pause (k)`})}),x($y,{ref:h}),x(`div`,{className:`time`,children:Yv(i??n,r)})]}),b(`div`,{className:`right`,children:[x(Hy,{}),x(Jy,{}),x(Ky,{}),u?x(ey,{id:`picture-in-picture`,tooltipPlace:`top-end`,text:x(`button`,{ref:g,className:u.armed?`picture-in-picture armed`:`picture-in-picture`,type:`button`,onPointerEnter:E,onPointerMove:E,onClick:u.active?u.exit:void 0,"aria-label":`Picture in picture`,"aria-pressed":u.active,children:x(`img`,{src:Oy,alt:``})}),toolTipText:x(`span`,{children:u.active?`Exit picture in picture`:`Picture in picture`})}):s?x(ey,{id:`picture-in-picture`,tooltipPlace:`top-end`,text:x(`button`,{className:`picture-in-picture`,type:`button`,onClick:s,disabled:v&&!S,"aria-label":v?`Put the subtitles in the video`:`Picture in picture`,"aria-pressed":v?l:void 0,children:v?x(l?My:Ny,{}):x(`img`,{src:Oy,alt:``})}),toolTipText:b(`span`,{css:ib,children:[x(`span`,{className:`lead`,children:v?S?l?`Subtitles are in the picture`:`Put the subtitles in the picture`:`This file has no subtitles`:`Picture in picture`}),v&&S?x(`span`,{className:`hint`,children:`Then hover the video and click your browser's own pop out button`}):null]})}):null,x(ey,{id:`full-screen`,tooltipPlace:`top-end`,text:x(`button`,{className:`full-screen`,type:`button`,onClick:()=>e.toggleFullscreen(),"aria-label":`Full screen`,"aria-pressed":a,children:x(a?p_:l_,{})}),toolTipText:x(`span`,{children:a?`Exit full screen (f)`:`Full screen (f)`})})]})]})]})},sb=9e3,cb=n`
1071
- position: absolute;
1072
- inset: 0;
1073
- z-index: 2;
1074
- pointer-events: none;
1075
-
1076
- .card {
1077
- position: absolute;
1078
- /* Where Firefox draws its own toggle: right aligned, a little past the middle of the height. */
1079
- top: 52%;
1080
- right: calc(7 * var(--mp-unit));
1081
- transform: translateY(-50%);
1082
-
1083
- display: flex;
1084
- align-items: center;
1085
- gap: calc(1.2 * var(--mp-unit));
1086
-
1087
- max-width: min(calc(42 * var(--mp-unit)), 60%);
1088
- padding: calc(1.4 * var(--mp-unit)) calc(1.8 * var(--mp-unit));
1089
- border-radius: calc(0.8 * var(--mp-unit));
1090
- background-color: rgba(20, 20, 22, 0.94);
1091
- box-shadow: 0 0 calc(2 * var(--mp-unit)) rgba(0, 0, 0, 0.6);
1092
-
1093
- opacity: 0;
1094
- transition: opacity 0.25s ease;
1095
- }
1096
-
1097
- &.show .card {
1098
- opacity: 1;
1099
- }
1100
-
1101
- .words {
1102
- display: flex;
1103
- flex-direction: column;
1104
- gap: calc(0.3 * var(--mp-unit));
1105
- }
1106
-
1107
- .title {
1108
- ${Iv.bMedium.bold}
1109
- color: #fff;
1110
- }
1111
-
1112
- .body {
1113
- ${Iv.bSmall.regular}
1114
- color: rgba(255, 255, 255, 0.75);
1115
- }
1116
-
1117
- /* Points at the edge the browser's control lives on, which is the whole message. */
1118
- .arrow {
1119
- flex: none;
1120
- font-size: calc(2.6 * var(--mp-unit));
1121
- line-height: 1;
1122
- color: #fff;
1123
- }
1124
- `,lb=()=>{let e=Q(e=>e.burnedInSubtitles),t=Q(e=>e.pictureInPictureMode),[n,r]=D(!1);return y(()=>{if(t!==`burn-in`||!e){r(!1);return}r(!0);let n=setTimeout(()=>r(!1),sb);return()=>clearTimeout(n)},[t,e]),t!==`burn-in`||!e?null:x(`div`,{css:cb,className:n?`show`:``,role:`status`,children:b(`div`,{className:`card`,children:[b(`div`,{className:`words`,children:[x(`div`,{className:`title`,children:`Subtitles are in the picture`}),x(`div`,{className:`body`,children:`Now hover the video and click your browser's own pop out button`})]}),x(`div`,{className:`arrow`,"aria-hidden":`true`,children:`→`})]})})},ub=1,db=6e3,fb=1,pb={opening:`Skip Opening`,ending:`Skip Ending`},mb=n`
1125
- position: absolute;
1126
- inset: 0;
1127
- z-index: 2;
1128
- pointer-events: none;
1129
-
1130
- button {
1131
- position: absolute;
1132
- /* clear of the control bar, which is 6 to 8px of padding plus a row of 18 to 28px controls and
1133
- the seekbar above them */
1134
- bottom: calc(7 * var(--mp-unit));
1135
- right: calc(2.4 * var(--mp-unit));
1136
-
1137
- /* the one thing in this layer that can be pressed */
1138
- pointer-events: auto;
1139
- cursor: pointer;
1140
-
1141
- ${Iv.bMedium.bold}
1142
- color: #fff;
1143
- padding: calc(1 * var(--mp-unit)) calc(1.8 * var(--mp-unit));
1144
- border: 1px solid rgba(255, 255, 255, .55);
1145
- border-radius: calc(.4 * var(--mp-unit));
1146
- background-color: rgba(20, 20, 22, .8);
1147
- box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
1148
-
1149
- opacity: 0;
1150
- transform: translateY(calc(.6 * var(--mp-unit)));
1151
- /* visibility as well as opacity, so a faded button cannot be hovered or pressed */
1152
- visibility: hidden;
1153
- transition: opacity .18s ease, transform .18s ease, visibility .18s;
1154
-
1155
- &:hover, &:focus-visible {
1156
- background-color: rgba(255, 255, 255, .92);
1157
- color: #111;
1158
- border-color: transparent;
1159
- }
1160
- }
1161
-
1162
- &.show button {
1163
- opacity: 1;
1164
- transform: none;
1165
- visibility: visible;
1166
- }
1167
-
1168
- @media (pointer: coarse) {
1169
- button {
1170
- /* a finger needs a target, and the control row below is already 44px */
1171
- min-height: 44px;
1172
- bottom: calc(9 * var(--mp-unit));
1173
- }
1174
- }
1175
- `,hb=()=>{let e=Q(e=>e.chapters),t=Q(e=>e.currentTime),n=Q(e=>e.requestSeek),r=Q(e=>e.seekPreview),i=Q(),a=h(()=>wy(e),[e]),o=h(()=>{if(typeof t!=`number`)return;let n=e.findIndex((e,n)=>a[n]!==void 0&&e.start-ub<=t&&t<e.end),r=n>=0?a[n]:void 0;return r?{kind:r,end:e[n].end}:void 0},[e,a,t]),s=d(0),[c,l]=D(0);y(()=>{let e=typeof t==`number`?t:0,n=s.current;s.current=e,e<n-fb&&l(e=>e+1)},[t]);let[u,f]=D(!1),p=o?`${o.kind}@${o.end}`:``;return y(()=>{if(!p){f(!1);return}f(!0);let e=setTimeout(()=>f(!1),db);return()=>clearTimeout(e)},[p,c]),y(()=>{o||f(!1)},[o]),o?x(`div`,{css:mb,className:u&&!r?`show`:``,children:x(`button`,{type:`button`,className:`skip-chapter`,onClick:()=>{f(!1),n?n(o.end):i.seek(o.end)},children:pb[o.kind]})}):null},gb=3e3,_b=n`
1176
- position: absolute;
1177
- inset: 0;
1178
- z-index: 2;
1179
- /* Never eats a click: click-to-pause still reaches the video underneath, and an item that needs a
1180
- pointer (a tooltip anchor, a button) sets \`pointer-events: auto\` on itself. */
1181
- pointer-events: none;
1182
- /* visibility, not only opacity: an item that took pointer events back would otherwise stay
1183
- hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
1184
- not, and transitioning it holds the item on screen for the length of the fade. */
1185
- transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
1186
- `,vb=(e,t)=>{let n=e.left-t.left,r=e.top-t.top;return`path(evenodd, 'M0 0H${t.width}V${t.height}H0Z M${n} ${r}H${n+e.width}V${r+e.height}H${n}Z')`},yb=n`
1187
- position: relative;
1188
- background-color: black;
1189
- display: flex;
1190
- justify-content: center;
1191
- align-items: center;
1192
- height: 100%;
1193
- width: 100%;
1194
-
1195
- & > div:not(:last-of-type) {
1196
- position: absolute;
1197
- z-index: 2;
1198
- }
1199
-
1200
- /* The subtitle layer sits UNDER the title and the spinner, where the canvas itself used to sit.
1201
- As a plain child div it is matched by the rule above and raised to the overlay items' level,
1202
- which paints subtitles over the title's gradient, over the spinner and over the error text.
1203
- Naming the type as well is what takes it back: :not() carries the specificity of its argument,
1204
- so the rule above is (0,2,1) and a bare .subtitles at (0,2,0) loses to it whatever the source
1205
- order, while div.subtitles ties at (0,2,1) and second place in the same block then wins.
1206
- subtitle-layering.browser.test.tsx measures the computed value rather than trusting this. */
1207
- & > div.subtitles {
1208
- inset: 0;
1209
- z-index: 1;
1210
- pointer-events: none;
1211
- }
1212
-
1213
- /* Over everything, the control bar included, while a click on the picture in picture control is let
1214
- through, with a hole at the control. Inside the hole every pointer event goes to the host's
1215
- document and this one hears nothing, so the pointer arriving on this layer is the only sign here
1216
- that it left the control. Named with its type for the specificity reason just above. */
1217
- & > div.pass-through {
1218
- inset: 0;
1219
- z-index: 5;
1220
- }
1221
-
1222
- canvas {
1223
- height: 100%;
1224
- width: 100%;
1225
- pointer-events: none;
1226
- position: absolute;
1227
- z-index: 1;
1228
- }
1229
-
1230
- .video, video {
1231
- height: 100%;
1232
- width: 100%;
1233
- background-color: black;
1234
- object-fit: contain;
1235
- }
1236
-
1237
- &.hide {
1238
- cursor: none;
1239
- }
1240
- `,bb=(e,t=``)=>l.toArray(e).flatMap((e,n)=>{let i=`${t}${r(e)&&e.key!=null?e.key:n}`;return r(e)&&e.type===v?bb(e.props.children,`${i}/`):[{key:i,item:e}]}),xb=({ref:e,onVideoRef:t,onSubtitleRef:n,overlay:r,controls:i,children:a})=>{let o=Q(),s=Q(e=>e.hideUI),c=Q(e=>e.setHideUI),l=Q(e=>e.hasMedia),u=Q(e=>e.passThroughPictureInPicture),f=d(void 0),p=d(`mouse`),m=d({x:-1,y:-1}),h=d(null);y(()=>()=>clearTimeout(f.current),[]),y(()=>{l||(clearTimeout(f.current),c(!1))},[l,c]);let g=()=>{l&&c(!0)},_=t=>{h.current=t,typeof e==`function`?e(t):e&&(e.current=t)},v=()=>{if(o.passThroughPictureInPicture?.armed)return!0;if(p.current!==`mouse`)return!1;let{x:e,y:t}=m.current;if(!h.current||e<0)return!1;let n=document.elementFromPoint(e,t);return!!n&&h.current.contains(n)&&!n.closest(`.video`)},S=()=>{if(v()){f.current=setTimeout(S,gb);return}g()},C=()=>{c(!1),clearTimeout(f.current),f.current=setTimeout(S,gb)};return b(`div`,{css:yb,ref:_,onPointerMove:e=>{p.current=e.pointerType,e.pointerType===`mouse`&&(m.current={x:e.clientX,y:e.clientY},C())},onPointerDown:e=>{p.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(f.current),g())},className:s?`hide`:``,children:[x(Uv,{onSubtitleRef:n}),bb(r).map(({key:e,item:t})=>x(`div`,{css:_b,style:{...s?{opacity:`0`,visibility:`hidden`,pointerEvents:`none`}:{}},children:t},e)),i===!1?null:x(ob,{}),x(lb,{}),x(hb,{}),u?.armed&&h.current?x(`div`,{className:`pass-through`,style:{clipPath:vb(u.armed,h.current.getBoundingClientRect())},onPointerOver:u.disarm}):null,b(`div`,{className:`video`,onClick:()=>{if(p.current===`mouse`){o.togglePaused();return}s?C():(clearTimeout(f.current),g())},children:[t?x(`video`,{ref:t,playsInline:!0}):null,a]})]})},Sb=({options:e,children:t})=>{let n=`media`in e?e:null,r=n?null:e,{title:i,chapters:a}=e,{size:o,downloadedRanges:s,publicPath:c,libavWorkerUrl:l,read:u,thumbnailRead:f,thumbnailsEnabled:p}=r??{},m=Tl(),h=El(),[g,_]=D(null),[v,b]=D(null),S=n?.media??g;y(()=>(m?.(S),()=>m?.(null)),[S,m]);let{expose:C}=e,w=C===!0?{}:C||void 0,T=d(w);T.current=w;let E=w?w.id:void 0,O=w?w.origin:void 0,k=w?w.channel:void 0;y(()=>{if(!C||!S)return;let e,t=!1;return oe(async()=>{let{exposePlayer:e}=await import(`./remote-BwnfCi4M.js`);return{exposePlayer:e}},__vite__mapDeps([0,1,2]),import.meta.url).then(({exposePlayer:n})=>{t||(e=n(S,T.current??{}))}).catch(()=>{}),()=>{t=!0,e?.()}},[S,!!C,E,O,k]),Tv(g,v,r);let{thumbnails:A,requestThumbnail:ee}=Ov({publicPath:c,workerUrl:l,length:p===!1?void 0:o,read:f??u,downloadedRanges:s}),j=n?.thumbnails?.all??A,{toggle:M,mode:N,burnedIn:P}=kv(g,v),te=Fv(n?.media??null,n?.pictureInPicture),F=Q(e=>e.setSourceState),I=n?!!n.media:o!==void 0;y(()=>{F({title:i,size:o,downloadedRanges:s,hasMedia:I})},[F,i,o,s,I]);let ne=n?.thumbnails?.at;y(()=>{F({thumbnails:j,thumbnailAt:ne,requestThumbnail:ee,togglePictureInPicture:M,pictureInPictureMode:N,burnedInSubtitles:P})},[F,j,ne,ee,M,N,P]),y(()=>{F({passThroughPictureInPicture:te})},[F,te]);let L=n?.subtitles?.selection,R=n?.audioTracks?.selection;return y(()=>{L&&F({subtitleTracks:L.options.map(({id:e,label:t,disabled:n})=>({id:e,label:t,disabled:n})),selectedSubtitleTrack:L.selectedId??void 0,selectSubtitleTrack:e=>L.select(e==null?null:String(e)),subtitleOffLabel:L.offLabel})},[F,L]),y(()=>{R&&F({audioTracks:R.options.map(({id:e,label:t,disabled:n})=>({id:e,label:t,disabled:n})),selectedAudioTrack:R.selectedId??void 0,selectAudioTrack:e=>R.select(String(e))})},[F,R]),y(()=>{a&&F({chapters:a})},[F,a]),x(xb,{ref:h,onVideoRef:n?void 0:_,onSubtitleRef:b,overlay:e.overlay,controls:e.controls,children:t})},Cb=n`
1241
- /**
1242
- * The chrome's whole scale, in one place.
1243
- *
1244
- * Everything inside is sized against this rather than against \`rem\`, because \`rem\` is root
1245
- * relative and a library cannot own the host page's root font. The old contract was that the host
1246
- * set \`html { font-size: 62.5% }\`, which silently rendered every control 1.6x too large in any app
1247
- * that did not, and could not be met by an app whose own screens are sized against the default.
1248
- * Override it on the player element to rescale the whole chrome.
1249
- */
1250
- --mp-unit: 10px;
1251
-
1252
- /**
1253
- * The chrome's own typeface, for exactly the reason the unit above exists.
1254
- *
1255
- * \`font-family\` inherits, and this library declared it nowhere, so every label drew in whatever the
1256
- * embedding document happened to set, and in the UA's serif where it set nothing. Not hypothetical:
1257
- * stub mounts the player in a second document, \`embed.html\`, which sets no font and loads no face,
1258
- * and the entire settings menu came out in Times New Roman.
1259
- *
1260
- * Named faces only, no bundled webfont. The chrome is a handful of short labels, so a font request
1261
- * on the critical path of a document whose job is to paint video buys a round trip and a flash of
1262
- * unstyled text for nothing.
1263
- *
1264
- * Read through \`var()\` so a host with a brand face sets \`--mp-font-family\` on any ancestor and it
1265
- * inherits in. A bare \`font-family\` on the host can no longer reach the chrome: this declaration is
1266
- * on the player element itself and beats anything inherited.
1267
- */
1268
- font-family: var(
1269
- --mp-font-family,
1270
- system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif,
1271
- 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji'
1272
- );
1273
-
1274
- /**
1275
- * The chrome's default ink, same argument again.
1276
- *
1277
- * Most text here names its own colour, but the two time readouts do not: the elapsed/duration pair
1278
- * and the seekbar's hover time carry a font token and a black text-shadow and nothing else.
1279
- * Inherited from a host that declares none that resolves to \`canvastext\`, which is black text under
1280
- * a black halo on a dark gradient.
1281
- */
1282
- color: #fff;
1283
-
1284
- /**
1285
- * The settings menu scrolls, and a UA that has not been told the surface is dark paints that
1286
- * scrollbar in its light theme: a white track down the side of a #1c1c1c menu. Declared here rather
1287
- * than asked of the host, so it reaches the menu and nothing outside the player.
1288
- */
1289
- color-scheme: dark;
1290
-
1291
- /**
1292
- * The other half of owning the chrome's own scale.
1293
- *
1294
- * Every control here is authored against a border box, which this library's dev app sets globally
1295
- * and a host page has no reason to. Shipped without it, anything that is \`width: 100%\` AND carries
1296
- * padding overflows its own box: the top bar ran 32px past the player and clipped the right end of
1297
- * whatever the app had put there. Scoped to the player's subtree so it cannot reach the host's
1298
- * layout, and only \`box-sizing\`, because zeroing margins here would reach the app's own content.
1299
- */
1300
- &, & *, & *::before, & *::after {
1301
- box-sizing: border-box;
1302
- }
1303
-
1304
- display: flex;
1305
- justify-content: center;
1306
- background-color: #111;
1307
- height: 100%;
1308
- width: 100%;
1309
- overflow: hidden;
1310
- `,wb=e=>x(`div`,{css:Cb,children:x(mv.Provider,{children:x(Sb,{options:e,children:e.children})})}),Tb=({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`})),Eb=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}))},Db=({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}))},Ob=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}))},kb=`stub:pictureinpicturerefused`,Ab=({video:e})=>{let t=document.querySelector(e);if(!document.pictureInPictureEnabled||typeof t?.requestPictureInPicture!=`function`)return!1;let n=(e,t)=>e.dispatchEvent(new CustomEvent(`stub:pictureinpicturerefused`,{detail:`${t.name}: ${t.message}`})),r=t=>{if(!t.isTrusted||(t.stopImmediatePropagation(),t.type!==`click`))return;t.preventDefault();let r=document.querySelector(e);r&&(r.disablePictureInPicture=!1,r.requestPictureInPicture().catch(e=>n(r,e)))};for(let e of[`pointerdown`,`mousedown`,`pointerup`,`mouseup`,`click`,`dblclick`])window.addEventListener(e,r,!0);return!0},jb=`[data-testid="track-selection-button"]`,Mb=`[data-testid="audio-text-track-menu"]`,Nb=`.timeline-slider`,Pb=`[role="menu"]`,Fb=`[role="menuitemradio"]`,Ib=1e4,Lb=2e4,Rb=5e3,zb=100,Bb={menu:Mb,section:Pb,option:Fb},Vb=/^(off|none|disabled)$/i,Hb=e=>new Promise(t=>setTimeout(t,e)),Ub=()=>!1,Wb=e=>{if(e())throw Error(`Crunchyroll track operation cancelled`)},Gb=e=>e===`audio`?0:1,Kb=e=>e.replace(/\s+/g,` `).trim(),qb=(e,t)=>{let n=[...new Map(t.map(e=>({...e,label:Kb(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=>Vb.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}:{}}},Jb=async(e,t)=>{Wb(t);let n=e.locator(Mb);if(await n.exists({timeout:1e3})){Wb(t);return}Wb(t),await e.evaluate(Eb,{button:jb,timeout:Ib});let r=Date.now()+Ib;for(;Date.now()<r;){if(Wb(t),await n.exists({timeout:1e3}))return;await Hb(zb)}throw Error(`Crunchyroll track menu did not open`)},Yb=async(e,t,n)=>{Wb(n);let r=await e.evaluate(Tb,{...Bb,sectionIndex:Gb(t)});Wb(n);let i=r.map((e,t)=>({...e,label:Kb(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}`}})},Xb=async(e,t)=>{let[n,r]=await Promise.all([Yb(e,`audio`,t),Yb(e,`subtitles`,t)]);return{audio:qb(`audio`,n),subtitles:qb(`subtitles`,r)}},Zb=async(e,t=Ub)=>(await Jb(e,t),Xb(e,t)),Qb=async(e,t,n,r)=>(await Yb(e,t,r)).find(e=>n===null?Vb.test(e.label):e.id===n)?.index??-1,$b=async(e,t,n,r)=>{let i=Date.now()+Lb;for(;Date.now()<i;){Wb(r),await Jb(e,r);let i=(await Yb(e,t,r)).find(e=>e.selected);if(i&&(n===null?Vb.test(i.label):i.id===n))return;await Hb(zb)}throw Error(`Crunchyroll did not apply the ${t} option`)},ex=(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))},tx=e=>({currentTime:e.currentTime,paused:e.paused,volume:e.volume,muted:e.muted,playbackRate:e.playbackRate}),nx=(e,t)=>e.evaluate(Ob,{timeline:Nb,time:t,timeout:Lb}),rx=async(e,t,n)=>{let r=Date.now()+5e3;for(;Date.now()<r&&(Wb(n),!(e.currentSrc!==t||e.readyState<2));)await Hb(zb);if(e.currentSrc===t&&e.readyState>=2)return!1;let i=Date.now()+Lb;for(;Date.now()<i;){if(Wb(n),e.readyState>=2)return!0;await Hb(zb)}throw Error(`Crunchyroll playback did not become ready after changing tracks`)},ix=async(e,t,n,r)=>{Wb(r),t.volume=n.volume,t.muted=n.muted,t.playbackRate=n.playbackRate;let i=ex(n.currentTime,t.duration);Math.abs(t.currentTime-i)>2&&await nx(e,i);let a=Date.now()+Lb;for(;Date.now()<a&&(Math.abs(t.currentTime-i)>2||t.seeking||t.readyState<2);)Wb(r),await Hb(zb);if(Math.abs(t.currentTime-i)>2||t.seeking||t.readyState<2)throw Error(`Crunchyroll playback position was not restored after changing tracks`);Wb(r),n.paused?t.pause():await t.play();let o=Date.now()+Rb;for(;Date.now()<o&&t.paused!==n.paused;)Wb(r),await Hb(zb);if(t.paused!==n.paused)throw Error(`Crunchyroll playback state was not restored after changing tracks`)},ax=async(e,t,n,r,i=Ub)=>{await Jb(e,i);let a=await Qb(e,n,r,i);if(a<0)throw Error(`Crunchyroll ${n} option is no longer available`);Wb(i);let o=t.currentSrc,s=tx(t);return await e.evaluate(Db,{...Bb,sectionIndex:Gb(n),optionIndex:a}),await $b(e,n,r,i),await rx(t,o,i)&&await ix(e,t,s,i),Zb(e,i)},ox=(e,t)=>{nx(e,t).catch(e=>console.warn(`[cr] timeline seek failed:`,e))},sx=(e,t)=>new Proxy(e,{set(e,n,r,i){return n===`currentTime`&&typeof r==`number`&&Number.isFinite(r)&&ox(t,r),Reflect.set(e,n,r,i)}}),cx=({title:e,remote:t,frame:n,subtitles:r,audioTracks:i,thumbnails:a,chapters:o,pictureInPicture:s,children:c})=>{let l=h(()=>t&&n?sx(t,n):null,[t,n]);return x(wb,{expose:!0,media:l,title:e,subtitles:r,audioTracks:i,thumbnails:a,chapters:o,pictureInPicture:s,children:c})},lx=3e4,ux=async(e,t)=>{let n=Date.now()+lx,r=!1;for(;!t();){let i=await e.locator(`.shell-header`).exists();r||=i;let[a,o]=await Promise.all([e.locator(`#user-menu-anonymous`).exists(),e.locator(`#user-menu-authenticated`).exists()]);if(t())break;if(o)return{isLoggedIn:o,isLoggedOut:!1};let s=Date.now()>=n;if(a&&!i&&(r||s))return{isLoggedIn:o,isLoggedOut:a};if(s)break;await new Promise(e=>setTimeout(e,100))}throw Error(`Login state check timed out`)};j();var dx=`video`,fx=(e,t,n)=>{let[r,i]=D(null);return y(()=>{if(!e||!t)return;let n=!1;(async()=>e.evaluate(Ab,{video:dx}))().then(e=>{!n&&e&&i(t)},e=>{n||console.warn(`[cr] picture in picture unavailable:`,e)});let r=e=>console.warn(`[cr] picture in picture refused:`,e.detail);return t.addEventListener(kb,r),()=>{n=!0,t.removeEventListener(kb,r),i(null)}},[e,t]),h(()=>r&&r===t&&n?{onArmedChange:e=>{n.style.pointerEvents=e?`auto`:``}}:void 0,[r,t,n])},px=class extends Error{name=`BifParseError`},mx=[137,66,73,70,13,10,26,10],hx=64,gx=8,_x=4294967295,vx=36e3,yx=e=>{if(e.byteLength<hx)throw new px(`truncated header: ${e.byteLength} bytes`);let t=new DataView(e);if(mx.some((e,n)=>t.getUint8(n)!==e))throw new px(`bad magic`);let n=t.getUint32(12,!0),r=t.getUint32(16,!0)||1e3;if(n>vx)throw new px(`implausible frame count ${n}`);let i=hx+(n+1)*gx;if(i>e.byteLength)throw new px(`truncated index: ${n} frames need ${i} bytes, have ${e.byteLength}`);let a=e=>t.getUint32(hx+e*gx,!0),o=e=>t.getUint32(hx+e*gx+4,!0);if(a(n)!==_x)throw new px(`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 px(`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 px(`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},bx=(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]},xx=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)}}},Sx={waitMs:1e4,fetchMs:15e3,maxBytes:31457280},Cx=e=>{let t=new Map,n=!1;return{at:r=>{if(n)return;let i=bx(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()}}},wx=async e=>{let t=await e.evaluate(xx,Sx);if(`none`in t)throw Error(`no BIF: ${t.none}${t.detail?` (${t.detail})`:``}`);let n=yx(t.bytes);if(!n.length)throw Error(`no BIF: the file has no images`);return Cx(n)};j();var Tx=e=>`https://static.crunchyroll.com/skip-events/production/${e}.json`,Ex=e=>{try{return new URL(e).pathname.match(/\/watch\/([A-Z0-9]+)(?:\/|$)/)?.[1]}catch{return}},Dx=[[`intro`,`Opening`],[`recap`,`Recap`],[`credits`,`Ending`],[`preview`,`Preview`]],Ox=`Episode`,kx=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Ax=(e,t)=>{if(!kx(e))return[];let n=t!==void 0&&Number.isFinite(t)&&t>0?t:1/0,r=Dx.flatMap(([t,r])=>{let i=e[t];if(!kx(i))return[];let{start:a,end:o}=i;if(typeof a!=`number`||typeof o!=`number`||!Number.isFinite(a)||!Number.isFinite(o))return[];let s={start:Math.max(0,a),end:Math.min(o,n),title:r};return s.end>s.start?[s]:[]}).sort((e,t)=>e.start-t.start),i=[],a=0;for(let e of r){let t=Math.max(e.start,a);e.end<=t||(t>a&&i.push({start:a,end:t,title:Ox}),i.push({start:t,end:e.end,title:e.title}),a=e.end)}return i.length&&n!==1/0&&a<n&&i.push({start:a,end:n,title:Ox}),i},jx=new Set([403,404]),Mx=async(e,t=z)=>{let n=await t(Tx(e));if(!n.ok){if(await n.body?.cancel().catch(()=>{}),jx.has(n.status))return{};throw Error(`${Tx(e)} answered ${n.status}`)}return n.json()},Nx=e=>{let[t,n]=D();return y(()=>{if(n(e?.duration),!e)return;let t=()=>n(e.duration);return e.addEventListener(`durationchange`,t),e.addEventListener(`loadedmetadata`,t),()=>{e.removeEventListener(`durationchange`,t),e.removeEventListener(`loadedmetadata`,t)}},[e]),t},Px=[],Fx=(e,t)=>{let n=Ex(e),[r,i]=D(),a=Nx(t);return y(()=>{if(!n)return;let e=!1;return Mx(n).then(t=>{e||i({episodeId:n,events:t})},t=>{e||console.warn(`[cr] skip events unavailable:`,t)}),()=>{e=!0}},[n]),h(()=>{if(!r||r.episodeId!==n)return Px;let e=Ax(r.events,a);return e.length?e:Px},[r,n,a])};j();var Ix=`
1311
- html, body {
1312
- margin: 0 !important;
1313
- padding: 0 !important;
1314
- width: 100% !important;
1315
- height: 100% !important;
1316
- background: #000 !important;
1317
- }
1318
- *:not(:has(.video-player-wrapper)):not(.video-player-wrapper):not(.video-player-wrapper *) {
1319
- display: none !important;
1320
- }
1321
- div[data-testid="player-controls-root"] {
1322
- display: none !important;
1323
- }
1324
- .video-player-wrapper,
1325
- .video-player,
1326
- .player-container,
1327
- .video-player-wrapper > *,
1328
- .video-player > *,
1329
- .player-container > * {
1330
- position: absolute !important;
1331
- inset: 0 !important;
1332
- width: 100% !important;
1333
- height: 100% !important;
1334
- z-index: 9999999;
1335
- }
1336
- .video-player-wrapper video,
1337
- .video-player video,
1338
- .player-container video {
1339
- width: 100% !important;
1340
- height: 100% !important;
1341
- object-fit: contain !important;
1342
- }
1343
- .video-player-wrapper *:not(:has(video)):not(video):not(:has(.timeline-slider)):not(.timeline-slider) {
1344
- display: none !important;
1345
- }
1346
- .timeline-container,
1347
- .timeline-container *,
1348
- .timeline-slider {
1349
- opacity: 0 !important;
1350
- pointer-events: none !important;
1351
- }
1352
- /* shows only where the frame takes pointer events: the player's picture in picture control, armed */
1353
- html, html * {
1354
- cursor: pointer !important;
1355
- }
1356
- `,Lx=3e4,Rx=async(e,t)=>{let n=Date.now()+Lx;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},zx=a`
1357
- to { transform: rotate(360deg); }
1358
- `,Bx=n`
1359
- position: relative;
1360
- width: 100%;
1361
- height: 100%;
1362
- background: #000;
1363
- /* The double-tap-to-fullscreen gesture otherwise word-selects the
1364
- skin's labels/time readouts, flashing them blue. Player chrome isn't
1365
- meant to be selected, so suppress it across the whole player. */
1366
- user-select: none;
1367
- -webkit-user-select: none;
1368
-
1369
- .cr-frame {
1370
- position: absolute;
1371
- inset: 0;
1372
- width: 100%;
1373
- height: 100%;
1374
- border: none;
1375
- background: #000;
1376
- /* CR's own chrome is hidden, so the iframe must not swallow clicks -
1377
- taps belong to the videojs gesture layer stacked above it. The one
1378
- exception is picture-in-picture.ts, which lifts this while the
1379
- player's picture in picture control is under the pointer. */
1380
- pointer-events: none;
1381
- }
1382
-
1383
- .overlay {
1384
- position: absolute;
1385
- inset: 0;
1386
- display: flex;
1387
- flex-direction: column;
1388
- align-items: center;
1389
- justify-content: center;
1390
- gap: 1.6rem;
1391
- background: #000;
1392
- font-size: 1.4rem;
1393
- color: rgba(255, 255, 255, 0.8);
1394
- /* Above the skin's own layers (its controls/error dialog top out at
1395
- z-index 20) so the login/loading screen fully covers them. */
1396
- z-index: 30;
1397
- }
1398
-
1399
- .login-button {
1400
- padding: 0.8rem 2rem;
1401
- background: #f47521;
1402
- color: #fff;
1403
- border: none;
1404
- border-radius: 0.4rem;
1405
- font-size: 1.4rem;
1406
- font-weight: 600;
1407
- cursor: pointer;
1408
-
1409
- &:hover {
1410
- background: #e0651a;
1411
- }
1412
-
1413
- &:disabled {
1414
- opacity: 0.6;
1415
- cursor: default;
1416
- }
1417
- }
1418
-
1419
- .login-note {
1420
- max-width: 36rem;
1421
- font-size: 1.2rem;
1422
- text-align: center;
1423
- color: rgba(255, 255, 255, 0.6);
1424
- }
1425
-
1426
- /* @banou/media-player's own buffering spinner (overlay.tsx), same box and centre, so when the video
1427
- arrives still buffering the player's spinner takes over from this one without a jump */
1428
- .loading-spinner {
1429
- box-sizing: border-box;
1430
- width: calc(4 * var(--mp-unit, 10px));
1431
- height: calc(4 * var(--mp-unit, 10px));
1432
- border-radius: 50%;
1433
- border: 3px solid rgba(255, 255, 255, 0.25);
1434
- border-top-color: #fff;
1435
- animation: ${zx} 0.8s linear infinite;
1436
- }
1437
- `,Vx=({url:e,title:t})=>{let[n,r]=D(`detecting`),[i,a]=D(null),[o,s]=D(null),[c,l]=D(!0),[u,f]=D(!1),[p,g]=D(),[_,v]=D(null),[C,w]=D(0),[T,O]=D(0),[k,A]=D(!1),[j,M]=D(!1),N=d(null),te=d(null),[F,I]=D(!1),ne=d(!1),[L,R]=D(),[re,ae]=D(),z=Fx(e,_),oe=fx(o,_,i),ue=d(0),de=d({generation:0,tail:Promise.resolve()}),B=d(!0),fe=P(()=>{let e=ue.current+1;return ue.current=e,de.current={generation:e,tail:Promise.resolve()},R(void 0),e},[]),pe=P((e,t)=>{if(de.current.generation!==e)return Promise.reject(Error(`Crunchyroll track operation cancelled`));let n=de.current,r=n.tail.then(t);return n.tail=r.then(()=>{},()=>{}),r},[]);y(()=>()=>{B.current=!1,ue.current+=1},[]),y(()=>{let e=!1;return ce().then(t=>{e||r(t)}),()=>{e=!0}},[]),y(()=>{if(!i||n===`detecting`)return;let e=!1;return ie({iframe:i,domains:ee,cookies:se(n),permissions:[{category:`evaluation`,reason:`Switch audio and subtitles, seek the video, show seek thumbnails and open picture in picture`}]}).then(t=>{e||s(t)}).catch(t=>{e||(console.error(`Failed to attach Crunchyroll frame`,t),g(t?.message||`Failed to load player`),l(!1))}),()=>{e=!0}},[i,n]),y(()=>{if(!o)return;let t=!1,r=()=>t;return l(!0),g(void 0),f(!1),v(null),fe(),(async()=>{if(n===`cloud`){if(await o.goto(e,{waitUntil:`commit`}),t)return;let{isLoggedIn:n}=await ux(o,r);if(t)return;if(!n){l(!1),f(!0);return}if(await o.addStyleTag({content:Ix}),t)return;let i=await Rx(o,r);if(t)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 o.goto(e,{waitUntil:`commit`}),t||(await o.addStyleTag({content:Ix}),t))return;let{isLoggedIn:i}=await ux(o,r);if(t)return;if(!i){l(!1),f(!0);return}let a=await Rx(o,r);if(!t){if(l(!1),!a)throw Error(`The episode did not load a player. It may be unavailable or require a different plan.`);v(a)}})().catch(e=>{t||(console.error(`Failed to load Crunchyroll player`,e),g(e?.message||`Failed to load player`),l(!1))}),()=>{t=!0}},[o,e,C,n,fe]),y(()=>{if(!o||!_)return;let e=fe(),t=!1,n=()=>t||!B.current||e!==ue.current;return(async()=>{let t,r;for(let i=0;i<5&&!n();i+=1){try{if(r=await pe(e,()=>Zb(o,n)),t=void 0,n()||(R(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}},[o,_,fe,pe]),y(()=>{if(!o||!_)return;let e=!1,t;return wx(o).then(n=>{if(e)return n.dispose();t=n,ae(n)},t=>{e||console.warn(`[cr] seek thumbnails unavailable:`,t)}),()=>{e=!0,t?.dispose(),ae(void 0)}},[o,_]);let me=ue.current,he=P((e,t)=>{if(!o||!_)return Promise.reject(Error(`Crunchyroll player is not ready`));let n=()=>!B.current||me!==ue.current;return pe(me,async()=>{try{let r=await ax(o,_,e,t,n);if(n())throw Error(`Crunchyroll track operation cancelled`);R(r)}catch(e){if(!n())try{let e=await Zb(o,n);n()||R(e)}catch{}throw e}})},[o,_,pe,me]),ge=h(()=>L?.subtitles&&{selection:{...L.subtitles,select:e=>he(`subtitles`,e)}},[L?.subtitles,he]),_e=h(()=>L?.audio&&{selection:{...L.audio,select:e=>he(`audio`,e)}},[L?.audio,he]),ve=P(()=>{if(N.current!==null)return;let e=globalThis.open(S,`_blank`,`width=500,height=700`);if(!e){M(!0),l(!1);return}M(!1),A(!0),te.current=e;let t=setInterval(()=>{e.closed&&(clearInterval(t),N.current===t&&(N.current=null),te.current===e&&(te.current=null),A(!1),w(e=>e+1))},500);N.current=t},[]),ye=P(()=>{s(null),g(void 0),v(null),fe(),f(!1),l(!0),O(e=>e+1)},[fe]),V=P(()=>{if(ne.current)return;ne.current=!0;let e=le({url:S,domains:ee,isSignedIn:m});M(!1),I(!0),e.then(e=>{if(B.current){if(e===`blocked`){M(!0);return}if(e===`unsupported`){g(`The Crunchyroll sign-in window could not be opened here.`);return}if(e===`authed`){ye();return}f(!1),l(!0),w(e=>e+1)}},e=>{B.current&&(console.error(`Crunchyroll sign-in window failed`,e),g(e?.message||`The sign-in window failed`))}).finally(()=>{ne.current=!1,B.current&&I(!1)})},[ye]);y(()=>()=>{N.current!==null&&(clearInterval(N.current),N.current=null)},[]),y(()=>{N.current!==null&&(clearInterval(N.current),N.current=null,A(!1)),M(!1)},[e]);let be=P(()=>{te.current!==null&&(te.current.close(),te.current=null),N.current!==null&&(clearInterval(N.current),N.current=null),M(!1),A(!1),ye()},[ye]),H=(c||p||j||u)&&b(`div`,{className:`overlay`,children:[u&&!p&&!j&&b(E,{children:[`You need to be logged in to Crunchyroll to watch this content.`,n===`extension`?x(`button`,{className:`login-button`,onClick:ve,disabled:k,children:k?`Finish signing in the popup...`:`Open Crunchyroll Login Page`}):b(E,{children:[x(`button`,{className:`login-button`,onClick:V,disabled:F,children:F?`Finish signing in the window...`:`Sign in to Crunchyroll`}),x(`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.`})]})]}),j&&!p&&b(E,{children:[`The login popup was blocked. Allow popups for this page and try again.`,x(`button`,{className:`login-button`,onClick:n===`extension`?ve:V,children:`Open Crunchyroll Login Page`})]}),p&&b(E,{children:[p,x(`button`,{className:`login-button`,onClick:be,children:`Retry`})]}),c&&!p&&!u&&x(`div`,{className:`loading-spinner`,role:`status`,"aria-label":`Loading`})]});return b(`div`,{css:Bx,children:[n!==`detecting`&&x(cx,{title:t,remote:_,frame:o,subtitles:ge,audioTracks:_e,thumbnails:re,chapters:z,pictureInPicture:oe,children:x(`iframe`,{ref:a,className:`cr-frame`,referrerPolicy:`no-referrer`,allow:`encrypted-media; autoplay; fullscreen;`},`${n}-${T}`)}),H]})},Hx=e=>e,Ux=Hx(({className:e,children:t})=>x(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:18,height:18,fill:`none`,"aria-hidden":`true`,className:e,children:t})),Wx=Hx(({className:e})=>x(Ux,{className:e,children:x(`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`})})),Gx=Hx(({className:e})=>b(Ux,{className:e,children:[x(`rect`,{width:5,height:14,x:2,y:2,fill:`currentColor`,rx:1.75}),x(`rect`,{width:5,height:14,x:11,y:2,fill:`currentColor`,rx:1.75})]})),Kx=Hx(({className:e})=>b(Ux,{className:e,children:[x(`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`}),x(`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`})]})),qx=Hx(({className:e})=>x(Ux,{className:e,children:x(`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`})})),Jx=Hx(({className:e})=>x(Ux,{className:e,children:x(`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`})})),Yx=Hx(({className:e})=>x(Ux,{className:e,children:x(`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`})})),Xx=Hx(({className:e})=>b(Ux,{className:e,children:[x(`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`}),x(`path`,{fill:`currentColor`,d:`M.714 6.008h3.072l4.071-3.857c.5-.376 1.143 0 1.143.601V15.28c0 .602-.643.903-1.143.602l-4.071-3.858H.714c-.428 0-.714-.3-.714-.752V6.76c0-.451.286-.752.714-.752m10.568.59a.91.91 0 0 1 0-1.316.91.91 0 0 1 1.316 0c1.203 1.203 1.47 2.216 1.522 3.208q.012.255.011.51c0 1.16-.358 2.733-1.533 3.803a.7.7 0 0 1-.298.156c-.382.106-.873-.011-1.018-.156a.91.91 0 0 1 0-1.316c.57-.57.995-1.551.995-2.487 0-.944-.26-1.667-.995-2.402`})]})),Zx=Hx(({className:e})=>x(Ux,{className:e,children:x(`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`})})),Qx=Hx(({className:e})=>x(Ux,{className:e,children:x(`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`})})),$x=Hx(({className:e})=>b(Ux,{className:e,children:[x(`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`}),x(`rect`,{width:10,height:7,x:8,y:10,fill:`currentColor`,rx:2}),x(`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`})]})),eS=Hx(({className:e})=>b(Ux,{className:e,children:[x(`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`}),x(`rect`,{width:10,height:7,x:8,y:10,fill:`currentColor`,rx:2}),x(`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`})]})),tS=Hx(({className:e})=>x(Ux,{className:e,children:x(`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`})})),nS=Hx(({className:e})=>b(Ux,{className:e,children:[x(`rect`,{width:16,height:12,x:1,y:3,stroke:`currentColor`,strokeWidth:2,rx:3}),x(`rect`,{width:3,height:2,x:3,y:8,fill:`currentColor`,rx:1}),x(`rect`,{width:2,height:2,x:13,y:8,fill:`currentColor`,rx:1}),x(`rect`,{width:4,height:2,x:11,y:11,fill:`currentColor`,rx:1}),x(`rect`,{width:5,height:2,x:7,y:8,fill:`currentColor`,rx:1}),x(`rect`,{width:7,height:2,x:3,y:11,fill:`currentColor`,rx:1})]})),rS=Hx(({className:e})=>x(Ux,{className:e,children:b(`g`,{fill:`currentColor`,children:[x(`rect`,{width:2,height:5,x:8,y:.5,opacity:.5,rx:1,children:x(`animate`,{attributeName:`opacity`,begin:`0s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),x(`rect`,{width:2,height:5,x:12.243,y:2.257,opacity:.45,rx:1,transform:`rotate(45 13.243 4.757)`,children:x(`animate`,{attributeName:`opacity`,begin:`0.125s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),x(`rect`,{width:5,height:2,x:12.5,y:8,opacity:.4,rx:1,children:x(`animate`,{attributeName:`opacity`,begin:`0.25s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),x(`rect`,{width:5,height:2,x:10.743,y:12.243,opacity:.35,rx:1,transform:`rotate(45 13.243 13.243)`,children:x(`animate`,{attributeName:`opacity`,begin:`0.375s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),x(`rect`,{width:2,height:5,x:8,y:12.5,opacity:.3,rx:1,children:x(`animate`,{attributeName:`opacity`,begin:`0.5s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),x(`rect`,{width:2,height:5,x:3.757,y:10.743,opacity:.25,rx:1,transform:`rotate(45 4.757 13.243)`,children:x(`animate`,{attributeName:`opacity`,begin:`0.625s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),x(`rect`,{width:5,height:2,x:.5,y:8,opacity:.15,rx:1,children:x(`animate`,{attributeName:`opacity`,begin:`0.75s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),x(`rect`,{width:5,height:2,x:2.257,y:3.757,opacity:.1,rx:1,transform:`rotate(45 4.757 4.757)`,children:x(`animate`,{attributeName:`opacity`,begin:`0.875s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})})]})})),iS=Hx(({className:e})=>x(Ux,{className:e,children:x(`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`})})),aS=Hx(({className:e})=>x(Ux,{className:e,children:x(`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`})})),oS=Hx(({className:e})=>x(Ux,{className:e,children:x(`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`})}));j();var sS=10,$=e=>e,cS=$(Th.Root),lS=$(vh),uS=$(Nh.Root),dS=$(_h.Popup),fS=$(_h.Title),pS=$(_h.Close),mS=$(Nh.Description),hS=$(Ng.Provider),gS=$(Ng.Root),_S=$(Ng.Trigger),vS=$(Ng.Popup),yS=$(eg.Root),bS=$(eg.Trigger),xS=$(eg.Popup),SS=$(Wh),CS=$(tg),wS=$(Hh),TS=$(Uh),ES=$(Ph),DS=$(Gh),OS=$(vg.Value),kS=$(xg.Root),AS=$(mg.Track),jS=$(mg.Fill),MS=$(mg.Buffer),NS=$(mg.Thumb),PS=$(mg.Value),FS=$(Ig.Root),IS=$(Bh),LS=$(Ih),RS=$(Hf),zS=({className:e,...t})=>x(`button`,{type:`button`,className:`media-button media-button--subtle media-button--icon${e?` ${e}`:``}`,...t}),BS=({selection:e,icon:t})=>{let[n,r]=D(!1),[i,a]=D(!1),[o,s]=D(!1);y(()=>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 b(yS,{open:n,onOpenChange:e=>r(e),children:[x(bS,{render:x(zS,{className:`media-button--menu${o?` media-button--error`:``}`,"aria-label":e.label}),children:t}),x(xS,{className:`media-surface media-popover media-popover--menu`,children:b(`div`,{className:`stub-menu`,role:`menu`,"aria-label":e.label,children:[x(`div`,{className:`stub-menu__heading`,children:e.label}),c.map(t=>{let n=t.id===e.selectedId;return b(`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:[x(`span`,{className:`stub-menu__check`,children:n?x(oS,{className:`media-icon`}):null}),x(`span`,{className:`stub-menu__label`,children:t.label}),`description`in t&&t.description?x(`span`,{className:`stub-menu__description`,children:t.description}):null]},t.id??`__off__`)})]})})]})},VS=()=>b(yS,{openOnHover:!0,delay:200,closeDelay:100,side:`top`,children:[x(bS,{render:b(wS,{className:`media-button--mute`,render:x(zS,{}),children:[x(Jx,{className:`media-icon media-icon--volume-off`}),x(Yx,{className:`media-icon media-icon--volume-low`}),x(Xx,{className:`media-icon media-icon--volume-high`})]})}),x(xS,{className:`media-surface media-popover media-popover--volume`,children:b(FS,{className:`media-slider`,orientation:`vertical`,thumbAlignment:`edge`,children:[x(AS,{className:`media-slider__track`,children:x(jS,{className:`media-slider__fill`})}),x(NS,{className:`media-slider__thumb media-slider__thumb--persistent`})]})})]}),HS=({capabilities:e,children:t,className:n,...r})=>b(RS,{className:`media-default-skin media-default-skin--video${n?` ${n}`:``}`,...r,children:[t,x(lS,{render:e=>x(`div`,{...e,className:`media-buffering-indicator`,children:x(`div`,{className:`media-surface`,children:x(rS,{className:`media-icon`})})})}),x(uS,{children:x(dS,{className:`media-error`,children:b(`div`,{className:`media-error__dialog media-surface`,children:[b(`div`,{className:`media-error__content`,children:[x(fS,{className:`media-error__title`,children:`Something went wrong.`}),x(mS,{className:`media-error__description`})]}),x(`div`,{className:`media-error__actions`,children:x(pS,{className:`media-button media-button--primary`,children:`OK`})})]})})}),x(cS,{className:`media-surface media-controls`,children:b(hS,{children:[b(`div`,{className:`media-button-group`,children:[b(gS,{side:`top`,children:[x(_S,{render:b(SS,{className:`media-button--play`,render:x(zS,{}),children:[x(Kx,{className:`media-icon media-icon--restart`}),x(Wx,{className:`media-icon media-icon--play`}),x(Gx,{className:`media-icon media-icon--pause`})]})}),x(vS,{className:`media-surface media-tooltip`})]}),b(gS,{side:`top`,children:[x(_S,{render:x(CS,{seconds:-10,className:`media-button--seek`,render:x(zS,{}),children:b(`span`,{className:`media-icon__container`,children:[x(qx,{className:`media-icon media-icon--seek media-icon--flipped`}),x(`span`,{className:`media-icon__label`,children:sS})]})})}),b(vS,{className:`media-surface media-tooltip`,children:[`Seek backward `,sS,` seconds`]})]}),b(gS,{side:`top`,children:[x(_S,{render:x(CS,{seconds:sS,className:`media-button--seek`,render:x(zS,{}),children:b(`span`,{className:`media-icon__container`,children:[x(qx,{className:`media-icon media-icon--seek`}),x(`span`,{className:`media-icon__label`,children:sS})]})})}),b(vS,{className:`media-surface media-tooltip`,children:[`Seek forward `,sS,` seconds`]})]})]}),b(`div`,{className:`media-time-controls`,children:[x(OS,{type:`current`,className:`media-time`}),b(kS,{className:`media-slider`,children:[b(AS,{className:`media-slider__track`,children:[x(jS,{className:`media-slider__fill`}),x(MS,{className:`media-slider__buffer`})]}),x(NS,{className:`media-slider__thumb`}),x(`div`,{className:`media-surface media-thumbnail media-slider__preview`,children:x(PS,{type:`pointer`,className:`media-time media-thumbnail__time`})})]}),x(OS,{type:`duration`,className:`media-time`})]}),b(`div`,{className:`media-button-group`,children:[b(gS,{side:`top`,children:[x(_S,{render:x(DS,{className:`media-button--playback-rate`,render:x(zS,{})})}),x(vS,{className:`media-surface media-tooltip`,children:`Toggle playback rate`})]}),x(VS,{}),e?.subtitles&&x(BS,{selection:e.subtitles,icon:e.subtitles.selectedId?x(tS,{className:`media-icon`}):x(nS,{className:`media-icon`})},`subtitles`),e?.audioTracks&&x(BS,{selection:e.audioTracks,icon:x(iS,{className:`media-icon`})},`audio`),e?.qualityLevels&&x(BS,{selection:e.qualityLevels,icon:x(aS,{className:`media-icon`})},`quality`),b(gS,{side:`top`,children:[x(_S,{render:b(TS,{className:`media-button--pip`,render:x(zS,{}),children:[x($x,{className:`media-icon media-icon--pip-enter`}),x(eS,{className:`media-icon media-icon--pip-exit`})]})}),x(vS,{className:`media-surface media-tooltip`})]}),b(gS,{side:`top`,children:[x(_S,{render:b(ES,{className:`media-button--fullscreen`,render:x(zS,{}),children:[x(Zx,{className:`media-icon media-icon--fullscreen-enter`}),x(Qx,{className:`media-icon media-icon--fullscreen-exit`})]})}),x(vS,{className:`media-surface media-tooltip`})]})]})]})}),x(`div`,{className:`media-overlay`}),x(IS,{keys:`Space`,action:`togglePaused`}),x(IS,{keys:`k`,action:`togglePaused`}),x(IS,{keys:`m`,action:`toggleMuted`}),x(IS,{keys:`f`,action:`toggleFullscreen`}),x(IS,{keys:`i`,action:`togglePictureInPicture`}),x(IS,{keys:`ArrowRight`,action:`seekStep`,value:5}),x(IS,{keys:`ArrowLeft`,action:`seekStep`,value:-5}),x(IS,{keys:`l`,action:`seekStep`,value:10}),x(IS,{keys:`j`,action:`seekStep`,value:-10}),x(IS,{keys:`ArrowUp`,action:`volumeStep`,value:.05}),x(IS,{keys:`ArrowDown`,action:`volumeStep`,value:-.05}),x(IS,{keys:`0-9`,action:`seekToPercent`}),x(IS,{keys:`Home`,action:`seekToPercent`,value:0}),x(IS,{keys:`End`,action:`seekToPercent`,value:100}),x(IS,{keys:`>`,action:`speedUp`}),x(IS,{keys:`<`,action:`speedDown`}),x(LS,{type:`tap`,action:`togglePaused`,pointer:`mouse`,region:`center`}),x(LS,{type:`tap`,action:`toggleControls`,pointer:`touch`}),x(LS,{type:`doubletap`,action:`seekStep`,value:-10,region:`left`}),x(LS,{type:`doubletap`,action:`toggleFullscreen`,region:`center`}),x(LS,{type:`doubletap`,action:`seekStep`,value:10,region:`right`})]});j();var{Provider:US}=Wf({features:Jd}),WS=e=>`media`in e?e:{media:e},GS=({remote:e,frame:t,adapter:n})=>{let r=Tl();return y(()=>{if(!r||!e||!t)return;let i=n?n(e,t):e;if(!i)return;let a=WS(i);r(a.media);let o=de(a.media);return()=>{o(),r(null),a.dispose?.()}},[e,t,n,r]),null},KS=n`
1438
- position: absolute;
1439
- inset: 0;
1440
- border-radius: 0.8rem;
1441
- background: transparent !important;
1442
- &.media-default-skin--video {
1443
- background: transparent !important;
1444
- }
1445
-
1446
- .media-popover--menu {
1447
- padding: 0.4rem;
1448
- }
1449
-
1450
- /**
1451
- * The track menu is stub's own markup, so it carries a stub prefix rather than a media one.
1452
- *
1453
- * It was named \`media-menu\` when the skin had no menu of its own. videojs beta.26 added one, and
1454
- * upstream's nested \`.media-default-skin .media-menu .media-menu__item\` is specificity (0,3,0)
1455
- * against this file's (0,2,0), so it silently took over padding, gap, cursor and justification the
1456
- * moment the dependency moved. A prefix upstream will never mint is the only durable fix; matching
1457
- * their specificity would just move the race to insertion order.
1458
- */
1459
- .stub-menu {
1460
- display: flex;
1461
- flex-direction: column;
1462
- min-width: 18rem;
1463
- max-height: 32rem;
1464
- overflow-y: auto;
1465
- }
1466
- .stub-menu__heading {
1467
- padding: 0.6rem 1rem 0.4rem;
1468
- font-size: 1.1rem;
1469
- font-weight: 600;
1470
- letter-spacing: 0.04em;
1471
- text-transform: uppercase;
1472
- opacity: 0.6;
1473
- }
1474
- .stub-menu__item {
1475
- display: flex;
1476
- align-items: center;
1477
- gap: 0.6rem;
1478
- width: 100%;
1479
- padding: 0.6rem 1rem;
1480
- border: none;
1481
- border-radius: 0.4rem;
1482
- background: transparent;
1483
- color: inherit;
1484
- font-size: 1.3rem;
1485
- text-align: left;
1486
- cursor: pointer;
1487
-
1488
- &:hover:not(:disabled) {
1489
- background: rgba(255, 255, 255, 0.12);
1490
- }
1491
- &:disabled {
1492
- opacity: 0.5;
1493
- cursor: default;
1494
- }
1495
- }
1496
- .stub-menu__check {
1497
- display: inline-flex;
1498
- width: 1.6rem;
1499
- flex: none;
1500
- }
1501
- .stub-menu__label {
1502
- flex: 1;
1503
- }
1504
- .stub-menu__description {
1505
- opacity: 0.6;
1506
- font-size: 1.1rem;
1507
- }
1508
- .media-button--error {
1509
- color: #f66;
1510
- }
1511
- `,qS=({remote:e,frame:t,adapter:n,capabilities:r,children:i})=>b(US,{children:[x(GS,{remote:e,frame:t,adapter:n}),x(HS,{capabilities:r,css:KS,children:i})]}),JS=`[data-uia="timeline"]`,YS=`[data-uia="video-canvas"]`,XS=`[data-uia="player"]`,ZS=`Seeks the video to the point you pick on the timeline.`,QS=`Reveals the player controls so the timeline can be used.`,$S=140,eC=2,tC=12e3,nC=26,rC=110,iC={"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"]`},aC=e=>new Promise(t=>setTimeout(t,e)),oC=e=>e<0?0:e>1?1:e,sC=0,cC=()=>{let e=sC*1.1;return sC++,{x:.5+Math.cos(e)*.05,y:.5+Math.sin(e)*.05}},lC=(e,t)=>{let n=null,r,i,a=!1,o=async()=>{if(!a){a=!0;try{await Promise.all([t.locator(YS).ensure(`hover`,{reason:QS}),t.locator(XS).ensure(`hover`,{reason:QS}),t.locator(JS).ensure(`click`,{reason:ZS})])}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)<eC&&(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=oC(n/r);o();let a=t.locator(JS),s=e.paused===!0;if(s)try{await e.play()}catch{}let c=!1;for(let e=0;e<nC;e++){if(e%2==0&&(await t.locator(YS).hover({relativePosition:cC(),reason:QS}).catch(()=>{}),await t.locator(XS).hover({relativePosition:cC(),reason:QS}).catch(()=>{})),await a.exists().catch(()=>!1)){c=!0;break}await aC(rC)}if(!c){let n=await Promise.all(Object.entries(iC).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({relativePosition:{x:i,y:.5},reason:ZS}).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))},$S),i&&clearTimeout(i),i=setTimeout(()=>{n=null},tC),!0):Reflect.set(e,t,a,o)}}),dispose:()=>{e.removeEventListener(`timeupdate`,s),r&&clearTimeout(r),i&&clearTimeout(i)}}},uC=({remote:e,frame:t,capabilities:n,children:r})=>x(qS,{remote:e,frame:t,adapter:lC,capabilities:n,children:r});j();var dC=[`netflix.com`,`www.netflix.com`,`nflxvideo.net`,`nflxso.net`,`nflxext.com`,`nflximg.net`,`assets.nflxext.com`],fC=`https://www.netflix.com/login`,pC=`
1512
- html, body {
1513
- margin: 0 !important;
1514
- padding: 0 !important;
1515
- width: 100% !important;
1516
- height: 100% !important;
1517
- overflow: hidden !important;
1518
- background: #000 !important;
1519
- }
1520
- /* Truly-unwanted chrome - collapse it entirely. */
1521
- .watch-video--evidence-overlay-container,
1522
- .watch-video--skip-content,
1523
- .watch-video--nextEpisode-seamless-button,
1524
- .watch-video--back-container,
1525
- [data-uia="player-back-to-browse"],
1526
- [data-uia="control-nav-back"],
1527
- [data-uia="control-flag"] {
1528
- display: none !important;
1529
- pointer-events: none !important;
1530
- }
1531
- /* Keep the controls bar in LAYOUT (so the seek adapter can locate + click the
1532
- [data-uia="timeline"] scrubber) but invisible and inert to real taps. NEVER
1533
- display:none here, or the scrubber loses its box and the seek no-ops - mirrors
1534
- Crunchyroll's opacity:0 timeline trick. The skin draws the visible controls. */
1535
- [data-uia="controls-standard"],
1536
- .watch-video--bottom-controls-container,
1537
- .PlayerControlsNeo__layout,
1538
- .PlayerControlsNeo__core-controls,
1539
- .PlayerControlsNeo__button-control-row {
1540
- opacity: 0 !important;
1541
- pointer-events: none !important;
1542
- }
1543
- [data-uia="timeline"],
1544
- [data-uia="timeline"] * {
1545
- pointer-events: auto !important;
1546
- }
1547
- .watch-video,
1548
- [data-uia="video-canvas"] {
1549
- position: fixed !important;
1550
- inset: 0 !important;
1551
- width: 100% !important;
1552
- height: 100% !important;
1553
- z-index: 9999999 !important;
1554
- }
1555
- .watch-video video,
1556
- [data-uia="video-canvas"] video {
1557
- width: 100% !important;
1558
- height: 100% !important;
1559
- object-fit: contain !important;
1560
- }
1561
- `,mC=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`)},hC=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},gC=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},_C=n`
1562
- position: relative;
1563
- width: 100%;
1564
- height: 100%;
1565
- background: #000;
1566
- user-select: none;
1567
- -webkit-user-select: none;
1568
-
1569
- .nf-frame {
1570
- position: absolute;
1571
- inset: 0;
1572
- width: 100%;
1573
- height: 100%;
1574
- border: none;
1575
- background: #000;
1576
- /* Netflix's own chrome is hidden, so the iframe must not swallow taps -
1577
- they belong to the skin's gesture layer stacked above it. */
1578
- pointer-events: none;
1579
- }
1580
-
1581
- .overlay {
1582
- position: absolute;
1583
- inset: 0;
1584
- display: flex;
1585
- flex-direction: column;
1586
- align-items: center;
1587
- justify-content: center;
1588
- gap: 1.6rem;
1589
- background: #000;
1590
- font-size: 1.4rem;
1591
- color: rgba(255, 255, 255, 0.8);
1592
- z-index: 30;
1593
- }
1594
-
1595
- .login-button {
1596
- padding: 0.8rem 2rem;
1597
- background: #e50914;
1598
- color: #fff;
1599
- border: none;
1600
- border-radius: 0.4rem;
1601
- font-size: 1.4rem;
1602
- font-weight: 600;
1603
- cursor: pointer;
1604
-
1605
- &:hover {
1606
- background: #c11119;
1607
- }
1608
- }
1609
- `,vC={cr:Vx,nf:({url:e})=>{let[t,n]=D(null),[r,i]=D(null),[a,o]=D(!0),[s,c]=D(!1),[l,u]=D(),[d,f]=D(null),[p,m]=D(0);y(()=>{if(!t)return;let e=!1;return(async()=>{for(let n=0;!e;n++)try{let n=await ie({iframe:t,domains:dC,cookies:`native`});if(e)return;i(n);return}catch(t){if(e)return;if(!re()){u(`Netflix playback currently needs the FKN browser extension.`),o(!1);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]),y(()=>{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 mC(()=>r.addStyleTag({content:pC})),t)return;o(!1);let i=await hC(r);if(t)return;if(!i){c(!0);return}let a=await gC(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,p]);let h=P(()=>{let e=globalThis.open(fC,`_blank`,`width=500,height=700`);if(!e)return;let t=setInterval(()=>{e.closed&&(clearInterval(t),m(e=>e+1))},500)},[]);return b(`div`,{css:_C,children:[x(uC,{remote:d,frame:r,children:x(`iframe`,{ref:n,className:`nf-frame`,referrerPolicy:`no-referrer`,allow:`encrypted-media; autoplay; fullscreen;`})}),(s||l||a)&&b(`div`,{className:`overlay`,children:[s&&b(E,{children:[`You need to be logged in to Netflix to watch this content.`,x(`button`,{className:`login-button`,onClick:h,children:`Open Netflix Login Page`})]}),l&&!s&&l,a&&!l&&!s&&`Loading Netflix player...`]})]})}},yC=e=>vC[e];j();var bC=new URLSearchParams(globalThis.location.search),xC=bC.get(`mediaUri`),SC=bC.get(`episodeUri`),CC=bC.get(`sourceUri`),wC=bC.get(`url`),TC=CC?w(CC).origin:void 0,EC=TC?yC(TC):void 0;M(x(()=>{let[e,t]=D();return y(()=>N(t),[]),!xC||!SC||!CC||!wC||!EC?x(`div`,{children:`Unsupported or missing parameters`}):x(EC,{url:wC,mediaUri:xC,episodeUri:SC,sourceUri:CC,title:e})},{}),document.getElementById(`app`));