@banou/stub 0.0.40 → 0.0.42

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.
Files changed (42) hide show
  1. package/build/assets/account-Dqz2amwB.js +1 -0
  2. package/build/assets/account-uIgK7-D5.js +1 -0
  3. package/build/assets/api-Dp-2AT3u-DnXkochq.js +3 -0
  4. package/build/assets/api-rrvhokeg.js +1 -0
  5. package/build/assets/build-mcPaLDi_.js +1 -0
  6. package/build/assets/embed-Dq58Zgjw.js +1609 -0
  7. package/build/assets/index-C09RPTYO.js +2485 -0
  8. package/build/assets/lib-account-BsgOxvGV.js +2 -0
  9. package/build/assets/lib-account-DgN_bHrt.js +51 -0
  10. package/build/assets/{lib-api-CtiKFcK3-lXOtBAbs.js → lib-api-Dp-2AT3u-5287Hymh.js} +576 -555
  11. package/build/assets/lib-api-kFj1W6Gv.js +2 -0
  12. package/build/assets/{lib-worker-CC8a9TDD.js → lib-worker-CWFsPxSd.js} +2720 -1946
  13. package/build/assets/lib-worker-RTWfVDSm.js +2 -0
  14. package/build/assets/lib-worker-index-QCwdkNNi.js +2485 -0
  15. package/build/assets/login-window-BippQvfb.js +71 -0
  16. package/build/assets/main-Dh0CtXj9.js +4253 -0
  17. package/build/assets/remote-BwnfCi4M.js +1 -0
  18. package/build/assets/{remote-CVVOdyaq.js → remote-CAlKhZLk.js} +1 -1
  19. package/build/assets/worker-BuIMw0JP.js +1 -0
  20. package/build/assets/worker-DOci0z8U.js +1 -0
  21. package/build/embed.html +6 -6
  22. package/build/index.html +7 -7
  23. package/build/index.js +7739 -5577
  24. package/fkn.json +1 -1
  25. package/package.json +2 -2
  26. package/build/assets/account-BgpTCUUd.js +0 -1
  27. package/build/assets/account-wP7U-PeH.js +0 -1
  28. package/build/assets/api-Bh_MpFDA.js +0 -1
  29. package/build/assets/api-CtiKFcK3-DDpRQueA.js +0 -3
  30. package/build/assets/build-CQLpK1BK.js +0 -1
  31. package/build/assets/embed-EZLj05C7.js +0 -1609
  32. package/build/assets/fetch-DAk81ulb.js +0 -71
  33. package/build/assets/index-BYXKnZ5C.js +0 -2380
  34. package/build/assets/lib-account-CF0gclnF.js +0 -2
  35. package/build/assets/lib-account-CnUKCNw7.js +0 -41
  36. package/build/assets/lib-api-BdPC6S5P.js +0 -2
  37. package/build/assets/lib-worker-BijvIwz2.js +0 -2
  38. package/build/assets/lib-worker-index-DN7VOVxv.js +0 -2380
  39. package/build/assets/main-DnKOGs5t.js +0 -4005
  40. package/build/assets/remote-VQoP8ehb.js +0 -1
  41. package/build/assets/worker-B9WbCrpk.js +0 -1
  42. package/build/assets/worker-CdIDYmal.js +0 -1
@@ -0,0 +1,1609 @@
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,G as n,I as r,J as i,L as a,N as o,P as s,Q as c,R as l,U as u,W as d,X as f,Y as p,Z as m,_ as h,at as g,ct as _,d as v,et as y,f as b,g as x,h as S,it as C,m as w,mt as T,nt as E,o as D,ot as O,p as k,q as A,rt as j,st as M,t as N,tt as P,ut as F,v as ee,x as I,y as L}from"./embed-title-CKGXRNB_.js";import{c as te,h as ne,i as re,l as ie,n as ae,s as oe,t as R}from"./login-window-BippQvfb.js";import{n as z}from"./remote-CAlKhZLk.js";M(),y();var se={};(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 se},set exports(e){se=e}});var ce=se,le=class extends Error{constructor(e){super(e),this.name=`TimeoutError`}},ue=class extends Error{constructor(e){super(),this.name=`AbortError`,this.message=e}},de=e=>globalThis.DOMException===void 0?new ue(e):new DOMException(e),B=e=>{let t=e.reason===void 0?de(`This operation was aborted.`):e.reason;return t instanceof Error?t:de(t)};function fe(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(B(e)),e.addEventListener(`abort`,()=>{o(B(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 le(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 pe(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 me=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)},he,ge=class{constructor(){he.set(this,[])}enqueue(e,t){t={priority:0,...t};let n={priority:t.priority,run:e};if(this.size&&me(this,he,`f`)[this.size-1].priority>=t.priority){me(this,he,`f`).push(n);return}let r=pe(me(this,he,`f`),n,(e,t)=>t.priority-e.priority);me(this,he,`f`).splice(r,0,n)}dequeue(){return me(this,he,`f`).shift()?.run}filter(e){return me(this,he,`f`).filter(t=>t.priority===e.priority).map(e=>e.run)}get size(){return me(this,he,`f`).length}};he=new WeakMap;var V=function(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n},H=function(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)},U,_e,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,Ve,He=new le,Ue=class extends Error{},We=class extends ce{constructor(e){if(super(),U.add(this),_e.set(this,void 0),ve.set(this,void 0),ye.set(this,0),be.set(this,void 0),xe.set(this,void 0),Se.set(this,0),Ce.set(this,void 0),we.set(this,void 0),Te.set(this,void 0),Ee.set(this,void 0),De.set(this,0),Oe.set(this,void 0),ke.set(this,void 0),Ae.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:ge,...e},!(typeof e.intervalCap==`number`&&e.intervalCap>=1))throw TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??``}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??``}\` (${typeof e.interval})`);V(this,_e,e.carryoverConcurrencyCount,`f`),V(this,ve,e.intervalCap===1/0||e.interval===0,`f`),V(this,be,e.intervalCap,`f`),V(this,xe,e.interval,`f`),V(this,Te,new e.queueClass,`f`),V(this,Ee,e.queueClass,`f`),this.concurrency=e.concurrency,this.timeout=e.timeout,V(this,Ae,e.throwOnTimeout===!0,`f`),V(this,ke,e.autoStart===!1,`f`)}get concurrency(){return H(this,Oe,`f`)}set concurrency(e){if(!(typeof e==`number`&&e>=1))throw TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);V(this,Oe,e,`f`),H(this,U,`m`,Be).call(this)}async add(e,t={}){return new Promise((n,r)=>{H(this,Te,`f`).enqueue(async()=>{var i,a;V(this,De,(i=H(this,De,`f`),i++,i),`f`),V(this,ye,(a=H(this,ye,`f`),a++,a),`f`);try{if(t.signal?.aborted){r(new Ue(`The task was aborted.`));return}let i=await(this.timeout===void 0&&t.timeout===void 0?e({signal:t.signal}):fe(Promise.resolve(e({signal:t.signal})),t.timeout===void 0?this.timeout:t.timeout,()=>{(t.throwOnTimeout===void 0?H(this,Ae,`f`):t.throwOnTimeout)&&r(He)}));n(i),this.emit(`completed`,i)}catch(e){r(e),this.emit(`error`,e)}H(this,U,`m`,Ne).call(this)},t),H(this,U,`m`,Le).call(this),this.emit(`add`)})}async addAll(e,t){return Promise.all(e.map(async e=>this.add(e,t)))}start(){return H(this,ke,`f`)?(V(this,ke,!1,`f`),H(this,U,`m`,Be).call(this),this):this}pause(){V(this,ke,!0,`f`)}clear(){V(this,Te,new(H(this,Ee,`f`)),`f`)}async onEmpty(){H(this,Te,`f`).size!==0&&await H(this,U,`m`,Ve).call(this,`empty`)}async onSizeLessThan(e){H(this,Te,`f`).size<e||await H(this,U,`m`,Ve).call(this,`next`,()=>H(this,Te,`f`).size<e)}async onIdle(){(H(this,De,`f`)!==0||H(this,Te,`f`).size!==0)&&await H(this,U,`m`,Ve).call(this,`idle`)}get size(){return H(this,Te,`f`).size}sizeBy(e){return H(this,Te,`f`).filter(e).length}get pending(){return H(this,De,`f`)}get isPaused(){return H(this,ke,`f`)}};_e=new WeakMap,ve=new WeakMap,ye=new WeakMap,be=new WeakMap,xe=new WeakMap,Se=new WeakMap,Ce=new WeakMap,we=new WeakMap,Te=new WeakMap,Ee=new WeakMap,De=new WeakMap,Oe=new WeakMap,ke=new WeakMap,Ae=new WeakMap,U=new WeakSet,je=function(){return H(this,ve,`f`)||H(this,ye,`f`)<H(this,be,`f`)},Me=function(){return H(this,De,`f`)<H(this,Oe,`f`)},Ne=function(){var e;V(this,De,(e=H(this,De,`f`),e--,e),`f`),H(this,U,`m`,Le).call(this),this.emit(`next`)},Pe=function(){this.emit(`empty`),H(this,De,`f`)===0&&this.emit(`idle`)},Fe=function(){H(this,U,`m`,ze).call(this),H(this,U,`m`,Re).call(this),V(this,we,void 0,`f`)},Ie=function(){let e=Date.now();if(H(this,Ce,`f`)===void 0){let t=H(this,Se,`f`)-e;if(t<0)V(this,ye,H(this,_e,`f`)?H(this,De,`f`):0,`f`);else return H(this,we,`f`)===void 0&&V(this,we,setTimeout(()=>{H(this,U,`m`,Fe).call(this)},t),`f`),!0}return!1},Le=function(){if(H(this,Te,`f`).size===0)return H(this,Ce,`f`)&&clearInterval(H(this,Ce,`f`)),V(this,Ce,void 0,`f`),H(this,U,`m`,Pe).call(this),!1;if(!H(this,ke,`f`)){let e=!H(this,U,`a`,Ie);if(H(this,U,`a`,je)&&H(this,U,`a`,Me)){let t=H(this,Te,`f`).dequeue();return t?(this.emit(`active`),t(),e&&H(this,U,`m`,Re).call(this),!0):!1}}return!1},Re=function(){H(this,ve,`f`)||H(this,Ce,`f`)!==void 0||(V(this,Ce,setInterval(()=>{H(this,U,`m`,ze).call(this)},H(this,xe,`f`)),`f`),V(this,Se,Date.now()+H(this,xe,`f`),`f`))},ze=function(){H(this,ye,`f`)===0&&H(this,De,`f`)===0&&H(this,Ce,`f`)&&(clearInterval(H(this,Ce,`f`)),V(this,Ce,void 0,`f`)),V(this,ye,H(this,_e,`f`)?H(this,De,`f`):0,`f`),H(this,U,`m`,Be).call(this)},Be=function(){for(;H(this,U,`m`,Le).call(this););},Ve=async function(e,t){return new Promise(n=>{let r=()=>{(!t||t())&&(this.off(e,r),n())};this.on(e,r)})};var Ge=Object.defineProperty,W=(e,t)=>{let n={};for(var r in e)Ge(n,r,{get:e[r],enumerable:!0});return t||Ge(n,Symbol.toStringTag,{value:`Module`}),n},Ke=`__OSRA_KEY__`,qe=`__OSRA_DEFAULT_KEY__`,Je=`__OSRA_BOX__`,Ye=()=>globalThis.browser??globalThis.chrome,Xe=()=>Ye()?.runtime,Ze=(e,t)=>gt(e)&&e.__OSRA_KEY__===t,Qe=(e,t)=>{if(e){if(e.aborted){t();return}e.addEventListener(`abort`,t,{once:!0})}},$e=({listener:e,transport:t,remoteName:n,key:r=qe,origin:i=`*`,unregisterSignal:a})=>{if(a?.aborted)return;let o=Pt(t)?t.receive:t;if(typeof o==`function`){let t=o((t,i)=>{a?.aborted||Ze(t,r)&&(n&&t.name!==n||e(t,i))});typeof t==`function`&&Qe(a,t);return}if(bt(o)||xt(o)||Ct(o)||wt(o)){let t=(t,i)=>{let o=(t,a)=>{Ze(t,r)&&(n&&t.name!==n||e(t,{port:i,sender:a}))};t.addListener(o),Qe(a,()=>t.removeListener(o))};if(bt(o))t(o.onMessage);else if(Ct(o)){let e=e=>t(e.onMessage,e);o.addListener(e),Qe(a,()=>o.removeListener(e))}else wt(o)?t(o):t(o.onMessage);return}let s=mt(o)?o.port:o,c=i!==`*`&&Tt(o),l=t=>{let a=t.data;if(typeof a==`string`)try{a=JSON.parse(a)}catch{return}Ze(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(),Qe(a,()=>s.removeEventListener(`message`,l))},et=new WeakSet,tt=e=>String(e?.message??e).includes(`disconnected port`),nt=(e,t,n=`*`,r=[])=>{let i=Pt(e)?e.emit:e;if(typeof i==`function`)i(t,r);else if(Tt(i))i.postMessage(t,n,r);else if(xt(i)){if(et.has(i))return;try{i.postMessage(t)}catch(e){if(!tt(e))throw e;et.add(i)}}else if(bt(i))i.sendMessage(t)?.catch?.(e=>{if(!String(e?.message).includes(`Receiving end does not exist`))throw e});else if(lt(i)){let e=JSON.stringify(t);i.readyState===WebSocket.CONNECTING?i.addEventListener(`open`,()=>i.send(e),{once:!0}):i.send(e)}else mt(i)?i.port.postMessage(t,r):i.postMessage(t,r)},rt=globalThis.Float16Array,it={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float16Array:rt,Float32Array,Float64Array,BigInt64Array,BigUint64Array},at=Object.values(it),ot=e=>{let t=e.constructor.name;if(t in it)return t;for(let[t,n]of Object.entries(it))if(n&&e instanceof n)return t;throw Error(`Unknown typed array type`)},st=e=>{let t=it[e];if(!t)throw Error(`Unknown typed array type`);return t},ct=e=>_t(e,at),lt=e=>e instanceof WebSocket,ut=e=>!!globalThis.ServiceWorkerContainer&&e instanceof ServiceWorkerContainer,dt=e=>!!globalThis.ServiceWorker&&e instanceof ServiceWorker,ft=e=>!!globalThis.Worker&&e instanceof Worker,pt=e=>{let t=globalThis.DedicatedWorkerGlobalScope;return!!t&&e instanceof t},mt=e=>!!globalThis.SharedWorker&&e instanceof SharedWorker,ht=e=>e instanceof MessagePort,gt=e=>!!e&&typeof e==`object`&&`__OSRA_KEY__`in e&&!!e.__OSRA_KEY__,_t=(e,t)=>{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},vt=e=>_t(e,[globalThis.SharedArrayBuffer]),yt=e=>_t(e,[globalThis.ArrayBuffer,globalThis.MessagePort,globalThis.ReadableStream,globalThis.WritableStream,globalThis.TransformStream,globalThis.ImageBitmap,globalThis.OffscreenCanvas,globalThis.AudioData,globalThis.VideoFrame,globalThis.MediaSourceHandle,globalThis.MediaStreamTrack,globalThis.MIDIAccess,globalThis.RTCDataChannel,globalThis.WebTransportReceiveStream,globalThis.WebTransportSendStream]),bt=e=>{let t=Xe();return t?e===t:!1},xt=(e,t=!1)=>!e||typeof e!=`object`||Tt(e)||!(`name`in e)||!(`disconnect`in e)||!(`postMessage`in e)?!1:!t||`sender`in e&&`onMessage`in e&&`onDisconnect`in e,St=e=>!!e&&typeof e==`object`&&!Tt(e)&&`addListener`in e&&`hasListener`in e&&`removeListener`in e,Ct=e=>{let t=Xe();return t?e===t.onConnect||e===t.onConnectExternal:!1},wt=e=>St(e),Tt=e=>{if(!e||typeof e!=`object`)return!1;try{return`window`in e&&e.window===e}catch{try{return`closed`in e&&typeof e.closed==`boolean`&&`close`in e&&typeof e.close==`function`}catch{return!1}}},Et=e=>lt(e)||xt(e)||bt(e),Dt=e=>lt(e)||xt(e)||Ct(e)||wt(e)||bt(e),Ot=e=>!!e&&typeof e==`object`&&!Tt(e)&&`isJson`in e&&e.isJson===!0||Et(e)||Dt(e),kt=e=>Tt(e)||Et(e)||dt(e)||ft(e)||pt(e)||mt(e)||ht(e)||Mt(e),At=e=>Tt(e)||Dt(e)||ut(e)||ft(e)||pt(e)||mt(e)||ht(e)||Nt(e),jt=e=>{if(!e||typeof e!=`object`||Tt(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},Mt=e=>!jt(e)||!(`emit`in e)?!1:kt(e.emit)||typeof e.emit==`function`,Nt=e=>!jt(e)||!(`receive`in e)?!1:At(e.receive)||typeof e.receive==`function`,Pt=e=>Mt(e)||Nt(e),Ft=()=>globalThis.Buffer,It=32768,Lt=e=>{let t=e.toBase64;if(typeof t==`function`)return t.call(e);let n=Ft();if(n)return n.from(e).toString(`base64`);let r=``;for(let t=0;t<e.length;t+=It)r+=String.fromCharCode(...e.subarray(t,t+It));return btoa(r)},Rt=e=>{let t=Uint8Array.fromBase64;if(typeof t==`function`)return t(e);let n=Ft();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={[Je]:`revivable`},zt=e=>!!e&&typeof e==`object`&&`__OSRA_BOX__`in e&&e.__OSRA_BOX__===`revivable`,Bt=(e,t)=>Ot(t.transport)?{base64Buffer:Lt(new Uint8Array(e))}:{arrayBuffer:e},Vt=e=>`arrayBuffer`in e?e.arrayBuffer:Rt(e.base64Buffer).buffer,Ht=W({box:()=>Gt,isType:()=>Wt,objectsOnly:()=>!0,revive:()=>Kt,type:()=>Ut}),Ut=`arrayBuffer`,Wt=e=>e instanceof ArrayBuffer,Gt=(e,t)=>({...G,type:Ut,...Bt(e,t)}),Kt=(e,t)=>Vt(e),qt=W({box:()=>Xt,isType:()=>Yt,objectsOnly:()=>!0,revive:()=>Zt,type:()=>Jt}),Jt=`date`,Yt=e=>e instanceof Date,Xt=(e,t)=>({...G,type:Jt,ISOString:e.toISOString()}),Zt=(e,t)=>new Date(e.ISOString),Qt=W({box:()=>tn,isType:()=>en,objectsOnly:()=>!0,revive:()=>nn,type:()=>$t}),$t=`headers`,en=e=>e instanceof Headers,tn=(e,t)=>({...G,type:$t,entries:[...e.entries()]}),nn=(e,t)=>new Headers(e.entries),rn=W({box:()=>cn,isType:()=>sn,objectsOnly:()=>!0,revive:()=>ln,type:()=>an}),an=`error`,on={Error,TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError},sn=e=>e instanceof Error,cn=(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:an,name:e.name,message:e.message,stack:e.stack||e.toString(),...n?{cause:Da(e.cause,t)}:{},...r?{errors:Da(e.errors,t)}:{},...i?{isDOMException:!0}:{}}},ln=(e,t)=>{let n=e.cause===void 0?void 0:ka(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(ka(e.errors,t),e.message,r);else{let t=on[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},un=W({box:()=>pn,isType:()=>fn,objectsOnly:()=>!0,revive:()=>mn,type:()=>dn}),dn=`typedArray`,fn=ct,pn=(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:dn,typedArrayType:ot(e),...Bt(n,t)}},mn=(e,t)=>new(st(e.typedArrayType))(Vt(e)),hn=new WeakMap,gn=new WeakSet,_n=(e,t)=>{if(gn.has(e))return t(),()=>{};let n=hn.get(e);return n||hn.set(e,n=new Set),n.add(t),()=>n.delete(t)},vn=e=>gn.has(e),yn=e=>{if(gn.has(e))return;gn.add(e);let t=hn.get(e);if(t){hn.delete(e);for(let e of t)try{e()}catch{}}},bn=W({box:()=>Mn,forceTransfer:()=>kn,isInTransfer:()=>On,isType:()=>jn,objectsOnly:()=>!0,outsideTransfer:()=>An,revive:()=>Nn,transfer:()=>En,type:()=>xn}),xn=`transfer`,Sn=Symbol.for(`osra.transfer`),Cn=e=>typeof e==`object`&&!!e,wn=e=>Cn(e)&&Sn in e&&e[Sn]===!0,Tn=e=>Cn(e)?ArrayBuffer.isView(e)?!0:_t(e,[globalThis.ArrayBuffer,globalThis.MessagePort,globalThis.ReadableStream,globalThis.WritableStream,globalThis.TransformStream,globalThis.Request,globalThis.Response,globalThis.ImageBitmap,globalThis.OffscreenCanvas,globalThis.VideoFrame,globalThis.AudioData]):!1,En=e=>Tn(e)?{[Sn]:!0,value:e}:e,Dn=0,On=()=>Dn>0,kn=e=>Cn(e)&&!wn(e)?{[Sn]:!0,value:e}:e,An=e=>{let t=Dn;Dn=0;try{return e()}finally{Dn=t}},jn=e=>wn(e),Mn=(e,t)=>{Dn++;try{return{...G,type:xn,inner:Da(e.value,t),degraded:Ot(t.transport)}}finally{Dn--}},Nn=(e,t)=>ka(e.inner,t),Pn=e=>_t(e,[globalThis.MessagePort,globalThis.ReadableStream,globalThis.WritableStream,globalThis.TransformStream,globalThis.OffscreenCanvas,globalThis.MediaSourceHandle,globalThis.MediaStreamTrack,globalThis.MIDIAccess,globalThis.RTCDataChannel,globalThis.WebTransportReceiveStream,globalThis.WebTransportSendStream]),Fn=e=>zt(e)&&e.type===`transfer`,In=e=>{let t=[],n=new WeakSet,r=(e,i)=>{if(e&&typeof e==`object`&&!n.has(e)&&(n.add(e),!vt(e))){if(Fn(e)){r(e.inner,i||!e.degraded);return}if(Pn(e)){t.push(e);return}if(yt(e)){i&&t.push(e);return}if(ArrayBuffer.isView(e)){i&&e instanceof DataView&&!vt(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},Ln=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`))})}},Rn=class{port1;port2;constructor(){let e=new Ln,t=new Ln;e._peer=t,t._peer=e,this.port1=e,this.port2=t}},zn=new FinalizationRegistry(e=>{try{e()}catch{}}),Bn=(e,t)=>{let n={};return zn.register(e,t,n),()=>zn.unregister(n)},Vn=W({box:()=>lr,createRevivableChannel:()=>mr,init:()=>$n,isType:()=>er,markPortsShipped:()=>fr,objectsOnly:()=>!0,postPreBoxed:()=>sr,revive:()=>ur,type:()=>Hn}),Hn=`messagePort`,Un=2048,Wn=128,Gn=1024,Kn=new WeakMap,qn=e=>{let t=Kn.get(e);if(!t)throw Error(`osra message-port: connection state missing; did init() run?`);return t},Jn=(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},Yn=(e,t)=>{let n=e.ports.get(t);if(n&&!n.handler&&e.pendingPorts--,e.ports.delete(t),e.tombstones.size>=Wn){let t=e.tombstones.values().next().value;t!==void 0&&e.tombstones.delete(t)}e.tombstones.add(t)},Xn=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)},Zn=(e,t)=>Jn(qn(e),t).outSeq++,Qn=(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=Jn(r,t);i.handler||r.pendingPorts--,i.handler=n,Xn(i)},$n=e=>{let t={ports:new Map,tombstones:new Set,pendingPorts:0};Kn.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>=Gn)return;r=Jn(t,n.portId)}if(!(n.seq<r.nextSeq)){if(r.buffer.size>=Un&&!(n.seq===r.nextSeq&&r.handler)){r.buffer.clear(),Yn(t,n.portId),r.handler?.({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:n.portId});return}r.buffer.set(n.seq,n),Xn(r)}}),_n(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})},er=e=>e instanceof MessagePort||e instanceof Ln,tr=(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{}},nr=(e,t,n)=>{if(n){e.postMessage(t);return}let r=In(t);e.postMessage(t,r),fr(r)},rr=(e,t,n,r)=>{let i;try{i=ka(e,t)}catch(e){r(),globalThis.reportError?.(e);return}n(i)},ir=(e,t,n)=>()=>{let r=e.deref();r&&tr(r,n);let i=t.deref();i&&Yn(i,n)},ar=new WeakSet,or=e=>e!==null&&(typeof e==`object`||typeof e==`function`),sr=(e,t,n)=>{or(t)&&ar.add(t),e.postMessage(t,n??[])},cr=(e,t)=>or(e)&&ar.delete(e)?e:An(()=>Da(e,t)),lr=(e,t,n)=>{let r=e instanceof Ln;if(!r&&!Ot(t.transport))return{...G,type:Hn,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&&Yn(e,o),m?.();let t=s.deref();t?.removeEventListener(`message`,p),t instanceof Ln&&(t._onClose=void 0)},f=e=>{if(e.type===`message-port-close`){d(),a.dispatchEvent(new Event(`close`)),a.close();return}rr(e.data,t,e=>nr(a,e,!1),()=>{})};function p({data:e}){t.sendMessage({type:`message`,remoteUuid:t.remoteUuid,data:cr(e,t),portId:o,seq:Zn(t,o)})}let m=Bn(a,ir(c,l,o));return a.addEventListener(`message`,p),a.start(),a instanceof Ln&&(a._onClose=()=>{u||(tr(t,o),d())}),Qn(t,o,f),{...G,type:Hn,portId:o,synthetic:r}},ur=(e,t)=>`port`in e?(fr([e.port]),e.autoBox?pr(e.port,t):e.port):hr(e.portId,t,e.synthetic),dr=new WeakMap,fr=e=>{for(let t of e){let e=dr.get(t);if(e){dr.delete(t),e.shipped=!0;for(let t of e.pending.splice(0))t()}}},pr=(e,t,n)=>{let r=new EventTarget,i=({data:e})=>{rr(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=An(()=>Da(r,t)),o=In(a),s=Array.isArray(i)?i:[],c=s.length?[...o,...s]:o,l=()=>{e.postMessage(a,c),fr(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},mr=e=>{if(Ot(e.transport)){let{port1:t,port2:n}=new Rn;return{localPort:t,boxedRemote:lr(n,e)}}let{port1:t,port2:n}=new MessageChannel,r={shipped:!1,pending:[]};return dr.set(n,r),{localPort:pr(t,e,r),boxedRemote:lr(n,e,{autoBox:!0})}},hr=(e,t,n)=>{let r=qn(t),{port1:i,port2:a}=n?new Rn:new MessageChannel,o=new WeakRef(i),s=new WeakRef(a),c=!1,l=!1;i instanceof Ln||i.addEventListener(`close`,e=>{l&&e.stopImmediatePropagation()});let u=()=>{if(c)return;c=!0,Yn(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&&rr(e.data,t,e=>nr(r,e,n),()=>o.deref()?.dispatchEvent(new Event(`messageerror`)))},f=({data:n})=>{t.sendMessage({type:`message`,remoteUuid:t.remoteUuid,data:cr(n,t),portId:e,seq:Zn(t,e)})},p=Bn(i,()=>{tr(t,e),u()});return i instanceof Ln&&(i._onClose=()=>{c||(tr(t,e),u())}),a.addEventListener(`message`,f),a.start(),Qn(t,e,d),i},gr=W({box:()=>xr,isType:()=>br,objectsOnly:()=>!0,revive:()=>Sr,type:()=>_r}),_r=`promise`,vr=e=>e instanceof Promise,yr=new Set,br=e=>e instanceof Promise,xr=(e,t)=>{if(!vr(e))throw TypeError(`Expected Promise`);let{localPort:n,boxedRemote:r}=mr(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:_r,port:r}},Sr=(e,t)=>{let n=ur(e.port,t);yr.add(n);let r=`portId`in e.port;return new Promise((e,i)=>{let a,o=()=>{n.close(),yr.delete(n),a?.()};if(r&&vn(t)){i(Error(`osra: connection closed`)),o();return}a=r?_n(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()})},Cr=W({box:()=>Or,isType:()=>Dr,objectsOnly:()=>!0,revive:()=>kr,type:()=>wr}),wr=`function`,Tr=new Set,Er=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(()=>{}))},Dr=e=>typeof e==`function`,Or=(e,t)=>{let{port1:n,port2:r}=new Rn;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(vn(t)){n.type===`return`&&Er(n.value);try{r.close()}catch{}return}let a=(()=>{try{return Da(n,t)}catch(e){return Da({type:`throw`,error:e},t)}})();sr(r,a),queueMicrotask(()=>{try{r.close()}catch{}})})()}),n.start(),{...G,type:wr,port:lr(r,t)}},kr=(e,t)=>{let n=ur(e.port,t);return((...e)=>new Promise((r,i)=>{if(vn(t)){i(Error(`osra: connection closed`));return}let{port1:a,port2:o}=new Rn;Tr.add(a);let s,c=()=>{a.close(),Tr.delete(a),s?.()};s=_n(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=An(()=>Da([o,e],t));sr(n,l)}))},Ar=W({MAX_CREDIT_WINDOW:()=>64,box:()=>Ir,isType:()=>Mr,objectsOnly:()=>!0,revive:()=>Br,type:()=>jr}),jr=`readableStream`,Mr=e=>e instanceof ReadableStream,Nr=2,Pr=8,Fr=4194304,Ir=(e,t)=>{let{localPort:n,boxedRemote:r}=mr(t),i=e.getReader(),a=On(),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?kn(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:jr,credit:!0,port:r}},Lr=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,Rr=e=>{let t=!1,n=0,r,i=[],a=!1,o=!1,s,c,l=()=>r===void 0?Pr:Math.max(Nr,Math.min(64,Math.floor(Fr/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=Lr(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())}})},zr=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())}})},Br=(e,t)=>{let n=ur(e.port,t);return n.start(),e.credit?Rr(n):zr(n)},Vr=W({box:()=>Wr,isType:()=>Ur,objectsOnly:()=>!0,revive:()=>Gr,type:()=>Hr}),Hr=`writableStream`,Ur=e=>e instanceof WritableStream,Wr=(e,t)=>{let{localPort:n,boxedRemote:r}=mr(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:Hr,port:r,...On()?{transferChunks:!0}:{}}},Gr=(e,t)=>{let n=ur(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?kn(e):e}),close:()=>o({type:`close`}),abort:e=>o({type:`abort`,reason:e})})},Kr=W({box:()=>Xr,isType:()=>Jr,objectsOnly:()=>!0,revive:()=>Zr,type:()=>qr}),qr=`abortSignal`,Jr=e=>e instanceof AbortSignal,Yr=new WeakMap,Xr=(e,t)=>{if(e.aborted)return{...G,type:qr,aborted:!0,reason:Da(e.reason,t)};let{localPort:n,boxedRemote:r}=mr(t),i=()=>{n.postMessage({type:`abort`,reason:e.reason}),n.close(),a()},a=_n(t,()=>{e.removeEventListener(`abort`,i),n.close()});return e.addEventListener(`abort`,i,{once:!0}),{...G,type:qr,aborted:!1,reason:void 0,port:r}},Zr=(e,t)=>{let n=new AbortController;if(e.aborted||e.port===void 0)return n.abort(ka(e.reason,t)),n.signal;let r=ur(e.port,t);return Yr.set(n.signal,r),r.start(),r.addEventListener(`message`,({data:e})=>{e.type===`abort`&&(n.abort(ka(e.reason,t)),Yr.delete(n.signal),r.close())}),n.signal},Qr=W({box:()=>ti,isType:()=>ei,objectsOnly:()=>!0,revive:()=>ni,type:()=>$r}),$r=`response`,ei=e=>e instanceof Response,ti=(e,t)=>({...G,type:$r,status:e.status,statusText:e.statusText,headers:tn(e.headers,t),body:e.body?Ir(e.body,t):null,url:e.url,redirected:e.redirected}),ni=(e,t)=>{if(e.status===0)return Response.error();let n=nn(e.headers,t),r=e.body?Br(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},ri=W({box:()=>oi,isType:()=>ai,objectsOnly:()=>!0,revive:()=>si,type:()=>ii}),ii=`request`,ai=e=>e instanceof Request,oi=(e,t)=>({...G,type:ii,method:e.method,url:e.url,headers:tn(e.headers,t),body:e.body?Ir(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:Xr(e.signal,t)}),si=(e,t)=>{let n=nn(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:Zr(e.signal,t)};return e.mode!==`navigate`&&(r.mode=e.mode),e.body&&(r.body=Br(e.body,t),r.duplex=`half`),new Request(e.url,r)},ci=W({box:()=>bi,boxByReference:()=>xi,identity:()=>mi,isType:()=>_i,objectsOnly:()=>!0,revive:()=>Si,type:()=>li}),li=`identity`,ui=e=>e!==null&&(typeof e==`object`||typeof e==`function`),di=e=>{if(e===null)return!1;let t=typeof e;return t===`object`||t===`function`||t===`symbol`&&Symbol.keyFor(e)===void 0},fi=new WeakMap,pi=e=>{let t=fi.get(e);if(t!==void 0)return t;let n=globalThis.crypto.randomUUID();return fi.set(e,n),n},mi=e=>(ui(e)&&pi(e),e),hi=new WeakMap,gi=e=>{let t=hi.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),!vn(e))try{e.sendMessage({type:`identity-dispose`,remoteUuid:e.remoteUuid,id:t})}catch{}})};return hi.set(e,r),e.eventTarget.addEventListener(`message`,({detail:e})=>{e?.type===`identity-dispose`&&(r.pins.delete(e.id),r.idToLocal.delete(e.id))}),_n(e,()=>{r.pins.clear(),r.idToLocal.clear()}),r},_i=e=>ui(e)&&fi.has(e),vi=(e,t)=>{let n=t.aliasIds.get(e);if(n!==void 0)return n;let r=pi(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},yi=(e,t,n)=>{let r=vi(e,n);if(n.idToLocal.has(r))return{...G,type:li,id:r};let i=t();return n.idToLocal.set(r,new WeakRef(e)),n.disposeRegistry.register(e,r,e),xa(()=>{},()=>{n.idToLocal.delete(r),n.disposeRegistry.unregister(e)}),{...G,type:li,id:r,inner:i}},bi=(e,t)=>{let n=gi(t),r=()=>Oa(e,t,li);return di(e)?yi(e,r,n):{...G,type:li,id:globalThis.crypto.randomUUID(),inner:r()}},xi=(e,t,n)=>yi(e,()=>t,gi(n)),Si=(e,t)=>{let n=gi(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=ka(e.inner,t);return n.pins.set(e.id,i),di(i)&&(fi.has(i)||fi.set(i,e.id),n.idToLocal.set(e.id,new WeakRef(i))),i},Ci=W({box:()=>Ti,isType:()=>wi,objectsOnly:()=>!0,revive:()=>Ei,type:()=>`map`}),wi=e=>e instanceof Map,Ti=(e,t)=>({...G,type:`map`,entries:Array.from(e,([e,n])=>[Da(e,t),Da(n,t)])}),Ei=(e,t)=>new Map(e.entries.map(([e,n])=>[ka(e,t),ka(n,t)])),Di=W({box:()=>ki,isType:()=>Oi,objectsOnly:()=>!0,revive:()=>Ai,type:()=>`set`}),Oi=e=>e instanceof Set,ki=(e,t)=>({...G,type:`set`,values:Array.from(e,e=>Da(e,t))}),Ai=(e,t)=>new Set(e.values.map(e=>ka(e,t))),ji=W({box:()=>Pi,isType:()=>Ni,revive:()=>Fi,type:()=>Mi}),Mi=`bigint`,Ni=e=>typeof e==`bigint`,Pi=(e,t)=>({...G,type:Mi,value:e.toString()}),Fi=(e,t)=>BigInt(e.value),Ii=W({box:()=>zi,isType:()=>Ri,objectsOnly:()=>!0,revive:()=>Bi,type:()=>Li}),Li=`event`,Ri=e=>e instanceof Event,zi=(e,t)=>({...G,type:Li,eventType:e.type,bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed,...e instanceof CustomEvent?{detail:Da(e.detail,t)}:{}}),Bi=(e,t)=>{let n={bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed};return`detail`in e?new CustomEvent(e.eventType,{...n,detail:ka(e.detail,t)}):new Event(e.eventType,n)},Vi=W({box:()=>Wi,isType:()=>Ui,objectsOnly:()=>!0,revive:()=>Ji,type:()=>Hi}),Hi=`eventTarget`,Ui=e=>e instanceof EventTarget,Wi=(e,t)=>{let n=[],r=e=>typeof e==`boolean`?e:!!e?.capture;return{...G,type:Hi,addListener:Or((t,i,a)=>{n.push({eventType:t,listener:i,capture:r(a)}),e.addEventListener(t,i,a)},t),removeListener:Or((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:Or(()=>{for(let{eventType:t,listener:r,capture:i}of n.splice(0))e.removeEventListener(t,r,{capture:i})},t)}},Gi=new WeakMap,Ki=e=>{if(typeof e==`function`)return e;let t=Gi.get(e);return t||Gi.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),Ji=(e,t)=>{let n=kr(e.addListener,t),r=kr(e.removeListener,t),i=kr(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=Ki(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,mi(c),r).catch(()=>{})}}),Object.defineProperty(a,"removeEventListener",{value:(e,t,n)=>{if(t===null)return;let i=Ki(t),a=typeof n==`boolean`?n:!!n?.capture,c=qi(o,e,i,a);c&&(s(c),r(e,mi(c.wire),{capture:a}).catch(()=>{}))}}),Bn(a,()=>{i().catch(()=>{})}),a},Yi=W({box:()=>Qi,isType:()=>Zi,revive:()=>$i,type:()=>Xi}),Xi=`symbol`,Zi=e=>typeof e==`symbol`,Qi=(e,t)=>{let n=Symbol.keyFor(e);return n===void 0?xi(e,{...G,type:Xi,description:e.description},t):{...G,type:Xi,registryKey:n}},$i=(e,t)=>`registryKey`in e?Symbol.for(e.registryKey):Symbol(e.description),ea=W({box:()=>ra,isType:()=>na,objectsOnly:()=>!0,revive:()=>ia,type:()=>ta}),ta=`asyncIterator`,na=e=>!e||typeof e!=`object`||typeof ReadableStream<`u`&&e instanceof ReadableStream?!1:typeof e[Symbol.asyncIterator]==`function`,ra=(e,t)=>{let n=e[Symbol.asyncIterator]();return{...G,type:ta,next:Or((e=>n.next(e)),t),return:Or((e=>n.return?.(e)??Promise.resolve({done:!0,value:e})),t),throw:Or((e=>n.throw?.(e)??Promise.reject(e)),t)}},ia=(e,t)=>{let n=kr(e.next,t),r=kr(e.return,t),i=kr(e.throw,t),a={next:(...e)=>n(...e),return:e=>r(e),throw:e=>i(e),[Symbol.asyncIterator]:()=>a};return a},aa=[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],oa=[globalThis.CropTarget,globalThis.EncodedAudioChunk,globalThis.EncodedVideoChunk,globalThis.FencedFrameConfig,globalThis.GPUCompilationInfo,globalThis.GPUCompilationMessage,globalThis.GPUPipelineError,globalThis.RTCEncodedAudioFrame,globalThis.RTCEncodedVideoFrame,globalThis.WebTransportError],sa={type:`clonable`,capableOnly:!0,objectsOnly:!0,isType:e=>_t(e,aa)||_t(e,oa),box:(e,t)=>e,revive:(e,t)=>e},ca=[globalThis.ImageBitmap,globalThis.OffscreenCanvas,globalThis.WritableStream,globalThis.TransformStream,globalThis.MediaStreamTrack,globalThis.RTCDataChannel],la=[globalThis.AudioData,globalThis.VideoFrame,globalThis.MediaSourceHandle,globalThis.MIDIAccess,globalThis.WebTransportReceiveStream,globalThis.WebTransportSendStream],ua={type:`transferable`,capableOnly:!0,objectsOnly:!0,isType:e=>_t(e,ca)||_t(e,la),box:(e,t)=>e,revive:(e,t)=>e},da={type:`blob`,capableOnly:!0,objectsOnly:!0,isType:e=>typeof Blob<`u`&&e instanceof Blob,box:(e,t)=>{if(Ot(t.transport))throw TypeError(`osra: Blob is only supported on structured-clone transports, send an ArrayBuffer or Uint8Array instead`);return e},revive:(e,t)=>e},fa=e=>{if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},pa=[bn,ci,Ht,qt,Qt,rn,un,gr,Cr,Vn,Ar,Vr,Kr,Qr,ri,Ci,Di,ji,Yi,Ii,ea,{type:`nonFiniteNumber`,isType:e=>typeof e==`number`&&!Number.isFinite(e),box:(e,t)=>Ot(t.transport)?{...G,type:`nonFiniteNumber`,value:String(e)}:e,revive:(e,t)=>Number(e.value)},{type:`undefined`,isType:e=>e===void 0,box:(e,t)=>Ot(t.transport)?{...G,type:`undefined`}:e,revive:(e,t)=>void 0},sa,ua,da,Vi,{type:`unclonable`,objectsOnly:!0,isType:e=>{if(typeof e!=`object`||!e||Array.isArray(e)||fa(e))return!1;try{return structuredClone(e),!1}catch{return!0}},box:(e,t)=>({...G,type:`unclonable`}),revive:(e,t)=>({})}],ma=(e,t)=>t.find(t=>t.type===e.type),ha=e=>!!e&&typeof e==`object`&&Object.getPrototypeOf(e)===Object.prototype,ga=(e,t)=>Array.isArray(e)?e.map(e=>t(e)):ha(e)?Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n)])):e,_a=new WeakSet,va=new WeakSet,ya=0,ba=[],xa=(e,t)=>{if(ya===0){e();return}ba.push({commit:e,rollback:t})},Sa=e=>{let t=ba;ba=[];for(let n of t)try{e?n.rollback():n.commit()}catch{}},Ca=e=>e!==null&&(typeof e==`object`||typeof e==`function`),wa=new WeakMap,Ta=e=>{let t=wa.get(e);if(t)return t;let n=e.filter(e=>!e.objectsOnly);return wa.set(e,n),n},Ea=(e,t,n)=>{let r=(e===null||typeof e!=`object`&&typeof e!=`function`?Ta(t.revivableModules):t.revivableModules).find(t=>t.type!==n&&t.isType(e));return r?r.box(e,t):ga(e,e=>Da(e,t))},Da=(e,t)=>{if(zt(e))return e;let n=Ca(e);if(n){if(_a.has(e))throw TypeError(`osra: cannot serialize a circular structure - break the cycle or send the container by reference`);_a.add(e)}ya++;let r=!0;try{let n=Ea(e,t);return r=!1,n}finally{n&&_a.delete(e),ya--,ya===0&&Sa(r)}},Oa=(e,t,n)=>Ea(e,t,n),ka=(e,t)=>{let n=Ca(e);if(n){if(va.has(e))throw TypeError(`osra: cannot revive a circular structure`);va.add(e)}try{if(zt(e)){let n=ma(e,t.revivableModules);if(n)return n.revive(e,t)}return ga(e,e=>ka(e,t))}finally{n&&va.delete(e)}},Aa=W({init:()=>Na,startBidirectionalConnection:()=>Ma,type:()=>ja}),ja=`bidirectional`,Ma=({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:Da(t,o)}),{revivableContext:o,remoteValue:s.then(e=>ka(e,o))}},Na=e=>{if(!(kt(e.transport)&&At(e.transport)))return;if(e.protocolEventTarget.addEventListener(`message`,({detail:{message:t,peer:n}})=>{if(t.type===`announce`){if(!t.remoteUuid){e.sendMessage({type:`announce`,remoteUuid:t.uuid});return}if(t.remoteUuid!==e.getUuid()||e.connectionContexts.has(t.uuid))return;e.sendMessage({type:`announce`,remoteUuid:t.uuid});let r=e.createConnectionEventTarget(),i={...n(),abort:()=>e.abortConnection(t.uuid)},a;try{let n=e.valueFor(i);if(e.claimPendingAbort(t.uuid)){e.sendMessage({type:`close`,remoteUuid:t.uuid});return}a=Ma({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),yn(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=Ma({transport:e.transport,value:a,remoteUuid:e.presetRemoteUuid,eventTarget:n,send:t=>e.sendMessage(t),revivableModules:e.revivableModules})}catch(n){e.sendMessage({type:`close`,remoteUuid:t}),e.rejectRemoteValue(n);return}let a={type:`bidirectional`,eventTarget:n,connection:r};e.connectionContexts.set(e.presetRemoteUuid,a),a.connection.remoteValue.then(t=>e.addConnection(i,t),t=>e.rejectRemoteValue(t));return}let t=50,n,r=()=>{if(!(e.unregisterSignal?.aborted||e.connectionContexts.size>0)){try{e.sendMessage({type:`announce`},`*`)}catch{}n=setTimeout(r,t),t=Math.min(t*2,1e3)}};e.unregisterSignal?.addEventListener(`abort`,()=>clearTimeout(n),{once:!0}),r()},Pa=()=>new EventTarget,Fa=e=>{let t=Pt(e),n=t?e.emit:e,r=t?e.receive:e;return{isJson:t&&`isJson`in e&&e.isJson!==void 0?e.isJson:n!==void 0&&Ot(n)||r!==void 0&&Ot(r),...n===void 0?{}:{emit:n},...r===void 0?{}:{receive:r}}},Ia=e=>e?e(pa):pa,La=32,Ra=()=>{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>La&&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())}}}}},za=(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})},Ba=Symbol.for(`osra.context`),Va=e=>typeof e==`object`&&!!e&&Ba in e,Ha=[Aa],Ua=(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=Fa(t);if(!(kt(f)&&At(f))){let e=Ra();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(()=>{}),za(t,e,d)}let p=Ia(s),m=new Map,h=new Set,g=Ra(),{promise:_,resolve:v,reject:y}=Promise.withResolvers();_.catch(()=>{});let b=c??globalThis.crypto.randomUUID(),x=(e,t=a)=>{let r={[Ke]:i,name:n,uuid:b,...e},o=In(r);nt(f,r,t,o),fr(o)},S=(e,t)=>{o?.aborted||x(e,t)},C=Pa(),w={transport:f,valueFor:t=>Va(e)?e[Ba](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}),yn(t.connection.revivableContext),y(Error(`osra: connection aborted`))},claimPendingAbort:e=>h.delete(e),addConnection:(e,t)=>{let n={value:t,context:e};v(n),g.push(n)},createConnectionEventTarget:Pa,unregisterSignal:o};if($e({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(),za(_,g,d);o?.addEventListener(`abort`,()=>{for(let[e,t]of m)x({type:`close`,remoteUuid:e}),yn(t.connection.revivableContext);m.clear(),g.close(),y(o.reason)},{once:!0});for(let e of Ha)e.init(w);return za(_,g,d)},Wa=(e,t)=>Ua(e,t),Ga=[[`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"`]],Ka=[`aac`,`opus`,`flac`],qa=()=>{let e=globalThis.MediaSource;if(typeof e?.isTypeSupported!=`function`)return[...Ka];let t=Ga.filter(([,t])=>{try{return e.isTypeSupported(t)}catch{return!1}}).map(([e])=>e);return t.includes(`aac`)?t:[...Ka]},Ja=e=>new Promise((t,n)=>{if(e.aborted)return n();e.addEventListener(`abort`,()=>{n()})}),Ya=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 Wa({},{transport:l}),d=await u({publicPath:e,length:i,bufferSize:a,audioStreamIndex:o,audioCodecs:s??qa()}),f=new We({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?En(n):n,rejected:!1}},()=>({resolved:new Uint8Array().buffer,rejected:!0})),Ja(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}),Ja(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()}}},Xa=async e=>{let{worker:t,remuxer:n,wasmRead:r,addTask:i,destroy:a}=await Ya({...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)}},Za=async e=>{let{worker:t,remuxer:n,wasmRead:r,addTask:i,destroy:a}=await Ya({...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}},Qa=typeof HTMLVideoElement<`u`?HTMLVideoElement.prototype:{},$a=`getVideoPlaybackQuality`in Qa||`webkitDecodedFrameCount`in Qa||`mozPresentedFrames`in Qa||`mozPaintedFrames`in Qa;if(!(`requestVideoFrameCallback`in Qa)&&$a&&typeof requestAnimationFrame==`function`){Qa._rvfcpolyfillmap={};let e=`getVideoPlaybackQuality`in Qa?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});Qa.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},Qa.cancelVideoFrameCallback=function(e){cancelAnimationFrame(this._rvfcpolyfillmap[e]),delete this._rvfcpolyfillmap[e]}}var eo={RAW:`RAW`,PROXY:`PROXY`,THROW:`THROW`,HANDLER:`HANDLER`},to={GET:`GET`,SET:`SET`,APPLY:`APPLY`,CONSTRUCT:`CONSTRUCT`,RELEASE:`RELEASE`},no=Symbol(`Abslink.proxy`),ro=Symbol(`Abslink.releaseProxy`),io=Symbol(`Abslink.finalizer`),ao=Symbol(`Abslink.thrown`),oo=e=>typeof e==`object`&&!!e||typeof e==`function`,so=new Map([[`proxy`,{canHandle:e=>oo(e)&&no in e,serialize(e,t){let n=e[no];return lo(e,t,n),[n,[]]},deserialize(e,t){return uo(t,e)}}],[`throw`,{canHandle:e=>oo(e)&&ao 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 co(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 lo(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=>wo(e,t)),u;try{let{parent:n,RawValue:r,lastSegment:a}=co(s,e);switch(o){case to.GET:u=r;break;case to.SET:n[a]=wo(i.value,t),u=!0;break;case to.APPLY:u=r.apply(n,l);break;case to.CONSTRUCT:u=new r(...l);break;case to.RELEASE:u=void 0;break;default:return}}catch(e){u={value:e,[ao]:0}}Promise.resolve(u).catch(e=>({value:e,[ao]:0})).then(i=>{o===to.CONSTRUCT&&(i=So(i));let[s,c]=Co(i,t);t.postMessage({...s,id:a,markerID:n},c),o===to.RELEASE&&(t.off(`message`,r),e[io]?.())}).catch(e=>{let[r,i]=Co({value:TypeError(`Unserializable return value`),[ao]:0},t);t.postMessage({...r,id:a,markerID:n},i)})}),e}function uo(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)}}),vo({endpoint:e,pendingListeners:n,rootMarkerID:t})}function fo(e){if(e)throw Error(`Proxy has been released and is not useable`)}async function po(e){await To(e,{type:to.RELEASE})}var mo=new WeakMap,ho=`FinalizationRegistry`in globalThis&&new FinalizationRegistry(e=>{let t=(mo.get(e)??0)-1;mo.set(e,t),t===0&&po(e).finally(()=>{e.pendingListeners.clear()})});function go(e,t){let n=(mo.get(t)??0)+1;mo.set(t,n),ho&&ho.register(e,t,e)}function _o(e){ho&&ho.unregister(e)}function vo(e,t=[]){let n=!1,r=new Map,i=new Proxy(function(){},{get(a,o){if(fo(n),o===ro)return async()=>{for(let e of r.values())e[ro]();r.clear(),_o(i),po(e).finally(()=>{e.pendingListeners.clear()}),n=!0};if(o===`then`){if(t.length===0)return{then:()=>i};let n=To(e,{type:to.GET,path:t.map(e=>e.toString())}).then(t=>wo(t,e.endpoint));return n.then.bind(n)}let s=r.get(o);if(s)return s;let c=vo(e,[...t,o]);return r.set(o,c),c},set(r,i,a){fo(n);let[o,s]=Co(a,e.endpoint);return To(e,{type:to.SET,path:[...t,i].map(e=>e.toString()),value:o},s).then(t=>wo(t,e.endpoint))},apply(r,i,a){if(fo(n),t[t.length-1]===`bind`)return vo(e,t.slice(0,-1));let[o,s]=xo(a,e);return To(e,{type:to.APPLY,path:t.map(e=>e.toString()),argumentList:o},s).then(t=>wo(t,e.endpoint))},construct(r,i){fo(n);let[a,o]=xo(i,e);return To(e,{type:to.CONSTRUCT,path:t.map(e=>e.toString()),argumentList:a},o).then(t=>wo(t,e.endpoint))}});return go(i,e),i}var yo=new WeakMap;function bo(e,t){return yo.set(e,t),e}function xo(e,t){let n=[],r=[];for(let i of e){let[e,a]=Co(i,t.endpoint);n.push(e),r.push(...a)}return[n,r]}function So(e){return Object.assign(e,{[no]:Ao()})}function Co(e,t){for(let[n,r]of so)if(r.canHandle(e)){let[i,a]=r.serialize(e,t);return[{type:eo.HANDLER,name:n,value:i},a]}return[{type:eo.RAW,value:e},yo.get(e)??[]]}function wo(e,t){switch(e.type){case eo.HANDLER:return so.get(e.name).deserialize(e.value,t);case eo.RAW:return e.value}}function To(e,t,n=[]){return new Promise(r=>{let i=Ao();e.pendingListeners.set(i,r),e.endpoint.postMessage({id:i,...t,markerID:e.rootMarkerID},n)})}var Eo=[],Do=`0123456789abcdef`;for(let e=0;e<256;e++)Eo[e]=Do[e>>4&15]+Do[e&15];var Oo=0,ko=``;function Ao(){let e=0;if(!ko||Oo+16>512)for(ko=``,Oo=0;e<256;++e)ko+=Eo[Math.random()*256|0];return ko.substring(Oo,++Oo+16)}function jo(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 Mo(e,t=e){return uo(jo(e,t))}var No=T(F(((e,t)=>{te();var n=ie!==void 0&&!!ie.hrtime,r=65535,i=10,a=n?1e9/i:1e3/i,o=n?()=>{let[e,t]=ie.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),Po=class{fps=(0,No.default)(5);processingDuration=(0,No.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})}},Fo={rgb:`RGB`,bt709:`BT709`,bt470bg:`BT601`,smpte170m:`BT601`},Io=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 Po: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=Mo(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`},So(e=>this._getLocalFont(e)),bo(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(Fo[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?.[ro]()}finally{this._worker.terminate()}}}};function Lo(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 Ro(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 zo=`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 Bo(e){for(var t,n={},r=0;r<zo.length;r++){var i=zo[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=Ro(m[0])),m.length===2&&(n.clip.scale=m[0]*1,n.clip.drawing=Ro(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(Bo)},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 Vo(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(Bo)}function Ho(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=Vo(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?Ro(t[r+1]):[]})}return{raw:e,combined:n.map(function(e){return e.text}).join(``),parsed:n}}function Uo(e){var t=e.split(`:`);return t[0]*3600+t[1]*60+t[2]*1}function Wo(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]=Uo(s);break;case`Effect`:i[o]=Lo(s);break;case`Text`:i[o]=Ho(s);break;default:i[o]=s}}return i}var Go=[`Name`,`Fontname`,`Fontsize`,`PrimaryColour`,`SecondaryColour`,`OutlineColour`,`BackColour`,`Bold`,`Italic`,`Underline`,`StrikeOut`,`ScaleX`,`ScaleY`,`Spacing`,`Angle`,`BorderStyle`,`Outline`,`Shadow`,`Alignment`,`MarginL`,`MarginR`,`MarginV`,`Encoding`],Ko=[`Layer`,`Start`,`End`,`Style`,`Name`,`MarginL`,`MarginR`,`MarginV`,`Effect`,`Text`];function qo(e){var t=Go.concat(Ko);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 Jo(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 Yo(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(Jo(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(Wo(d,t.events.format))}}}return t}var Xo={M:`m`,L:`l`,C:`b`};function Zo(e){return e.instructions.map(function(e){var t,n=e.type,r=e.points;return(t=[Xo[n]]).concat.apply(t,r.map(function(e){return[e.x,e.y]})).join(` `)}).join(` `)}var Qo=function(e){return function(t){return function(n){return``+t+e+`&H`+n+`&`}}},$o=Qo(`c`),es=Qo(`a`),ts={c1:$o(1),c2:$o(2),c3:$o(3),c4:$o(4),a1:es(1),a2:es(2),a3:es(3),a4:es(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+`,`)+Zo(e.drawing))+`)`},t:function(e){return e.map(function(e){return`t(`+[e.t1,e.t2,e.accel,ns(e.tag)]+`)`}).join(`\\`)}};function ns(e){return Object.keys(e).map(function(t){return`\\`+(ts[t]||(function(e){return``+t+e}))(e[t])}).join(``)}var rs=e=>Array(e.buffered.length).fill(void 0).map((t,n)=>({index:n,start:e.buffered.start(n),end:e.buffered.end(n)})),is=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})}),as=(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),is(e))),unbufferRange:(t,n)=>r(()=>t>=n?Promise.resolve():(e.remove(t,n),is(e))),updateTimestampOffset:t=>r(async()=>{e.timestampOffset=t}),endOfStream:()=>r(async()=>{if(!(t.readyState!==`open`||e.updating))try{t.endOfStream()}catch{}})}},os=e=>e===void 0?void 0:new URL(e,document.baseURI).toString(),ss=e=>new Date(e).toISOString().slice(11,22),cs=1,ls=e=>new Map(Yo(e).styles.style.map((e,t)=>[e.Name,t+cs])),us=(e,t)=>{let n=t.replace(/^\*+/,``),r=n.toLowerCase()==="default"?`Default`:n;return e.styles.get(r)??e.styles.get(`Default`)??0},ds=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:ls(e.content)}:(console.warn(`subtitle stream ${e.streamIndex} has no Events format, ignoring the track`),null)},fs=(e,t)=>{let[n,r]=t.content.split(`,`),i=Number(n),a=`Dialogue: ${r},${ss(t.start)},${ss(t.end)},${t.content.replace(`${i},${r},`,``)}`,o=Yo(`${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:us(e,o.Style),Text:o.Text.raw,Start:o.Start*1e3,Duration:(o.End-o.Start)*1e3,ReadOrder:i}}},ps=e=>{let{video:t,container:n,workerUrl:r}=e,i=os(e.wasmUrl),a=os(e.legacyWasmUrl),o=os(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 Io({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=ds(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=fs(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(()=>{})}}},ms=class extends Error{mediaElement=!0;constructor(e,t){super(e,t),this.name=`MediaElementError`}},hs=e=>!!e&&typeof e==`object`&&e.mediaElement===!0,gs=-20,_s=60,vs=30,ys=-5,bs=20,xs=5,Ss=15e3,Cs=1,ws=3,Ts=12,Es=200,Ds=250,Os=25e5,ks=e=>{let{worker:t}=e,n=setTimeout(()=>t.terminate(),2e3);e.destroy().catch(()=>{}).finally(()=>{clearTimeout(n),t.terminate()})},As=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=Os,audioStreamIndex:f,onReady:p,onError:m,onRecovered:h,onSeek:g,onSubtitleStreams:_,onAudioStreams:v}=e,y=await Xa({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(()=>ks(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=ps({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`))},Ss),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}=as(T,C);await E(e.data),e.subtitles?.length&&a.pushFragments(e.subtitles),p?.();let A=!1,j=!1,M=0,N,P=()=>N??t.currentTime,F=!1,ee=0,I=0,L=null,te=0,ne=0,re=!1,ie=0,ae=(e,t,n=!1)=>{let r=e?.message===`Cancelled`;t&&r||(console.error(e),(!re||n)&&(re=!0,m?.(r?Error(`Reading the video file failed`,{cause:e}):e)))},oe=async(e=!1)=>{if(M>0&&!e)return;let n=t.currentTime,r=e?ys:gs,i=e?bs:_s;for(let{start:e,end:t}of rs(T))e<n+r&&await D(e,n+r),t>n+i&&await D(n+i,t)},R=()=>{let e=rs(T);if(!e.length)return!0;let t=P(),n=e.find(e=>e.start<=t+Cs&&t<e.end);return n&&n.end>=t+_s?!1:!n||n.end<t+vs},z=()=>{let e=t.currentTime;return rs(T).find(t=>t.start<=e+Cs&&e<t.end)},se=()=>{let e=z();return!!e&&e.end>=ne-.1},ce=()=>{let e=rs(T).map(e=>e.end);e.length&&(ne=Math.max(ne,...e))},le=async e=>{j=!0,L=null,te=0,ie=e;let t=++I;try{let{data:n,pts:r,subtitles:i,finished:o}=await y.seek(e);if(x||t!==I||(o&&(F=!0),i?.length&&a.pushFragments(i),await O(r),x||t!==I))return;n.byteLength&&(await E(n),ce())}catch(e){ae(e,x||t!==I)}finally{t===I&&(j=!1)}},ue=async()=>{let e=L;if(e)try{await E(e),ce(),L===e&&(L=null,te=0)}catch(n){if(L!==e)return;if(n?.name===`QuotaExceededError`){let n=await oe(!0).then(()=>!0,()=>!1);if(L!==e)return;if(n){F=!1,await le(z()?.end??t.currentTime);return}}if(te+=1,te<xs)return;throw L=null,n}},de=async()=>{if(A||j||_e!==void 0||x||!L&&(F||!R()))return;let e=++ee,t=I,n=()=>x||e!==ee||t!==I;A=!0;try{if(!L){let{data:e,subtitles:t,finished:r}=await y.read();if(n()||(r&&(F=!0),t?.length&&a.pushFragments(t),!e.byteLength))return;L=e,te=0}await ue(),!n()&&re&&(re=!1,h?.())}catch(e){ae(e,n())}finally{e===ee&&(A=!1)}},B=e=>e>=ie&&!!z(),fe=e=>rs(T).some(t=>t.start<=e+Cs&&e<t.end),pe=e=>{let t=rs(T).find(t=>t.start<=e+Cs&&e<t.end);return t?t.end-e:0},me=async e=>{if(!x&&!(pe(e)>=ws)){F=!1,M++,N=e;try{fe(e)||await le(e);let t=I;for(let n=0;n<Ts&&!(x||t!==I||F||pe(e)>=ws);n++){let t=pe(e);if(await de(),pe(e)<=t)break}}finally{M--,N===e&&(N=void 0)}}},he=0,ge=null,V,H=e=>{let t=performance.now(),n=t-he;if(n>=Es){he=t,ge=null,g?.(e);return}ge=e,!V&&(V=setTimeout(()=>{V=void 0;let e=ge;ge=null,!(e===null||x)&&(he=performance.now(),g?.(e))},Es-n))};b.push(()=>{V&&clearTimeout(V)});let U=0,_e;b.push(()=>{_e&&clearTimeout(_e)});let ve=()=>{let n=t.currentTime,r=e.info.input.duration||t.duration;r>0&&H(Math.min(Math.max(n/r,0),1));let i=performance.now(),a=i-U<Ds;if(U=i,!B(n)&&!(j&&Math.abs(n-ie)<.001)){if(F=!1,_e&&clearTimeout(_e),!a){_e=void 0,le(n);return}_e=setTimeout(()=>{if(_e=void 0,x)return;let e=t.currentTime;B(e)||(F=!1,le(e))},Ds)}};t.addEventListener(`seeking`,ve),b.push(()=>t.removeEventListener(`seeking`,ve));let ye=!1,be=()=>{if(ye)return;ye=!0;let e=t.error;ae(new ms(`the media element failed: ${e?.message??`unknown`}`,{cause:e}),!1,!0)};t.addEventListener(`error`,be),b.push(()=>t.removeEventListener(`error`,be));let xe=setInterval(()=>{ye||t.error||(oe().catch(()=>{}),de().catch(e=>ae(e,!1)),F&&!L&&se()&&C.readyState===`open`&&k().catch(()=>{}))},100);return b.push(()=>clearInterval(xe)),{destroy:S,prepareSeek:me,videoElement:t,selectSubtitleStream:e=>a.selectStream(e),indexes:e.indexes??[],chapters:e.chapters??[],duration:e.info.input.duration,videoMimeType:e.info.output.videoMimeType,audioMimeType:e.info.output.audioMimeType}}catch(e){throw S(),e}},js=5,Ms=500,Ns=320,Ps=1e6,Fs=3,Is=1e4,Ls=1.5,Rs=4e6,zs=3e4,Bs=async e=>{let{publicPath:t,workerUrl:n,length:r,read:i,onThumbnails:a,width:o=Ns}=e,s=await Za({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??js,n/Ms),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)+Ps,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`)),Is))]),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>=Fs}).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`)),zs))]);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*Ls,h+Rs)||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=[],ks(s)}}}catch(e){throw ks(s),e}},Vs=1280,Hs=1920,Us=250,Ws=100,Gs=()=>typeof HTMLCanvasElement<`u`&&`captureStream`in HTMLCanvasElement.prototype,Ks=()=>typeof document<`u`&&typeof HTMLVideoElement<`u`&&typeof HTMLVideoElement.prototype.requestPictureInPicture==`function`&&!!document.pictureInPictureEnabled,qs=()=>typeof HTMLVideoElement<`u`&&`mozCaptureStream`in HTMLVideoElement.prototype,Js=()=>Gs()?Ks()?`window`:qs()?`burn-in`:null:null,Ys=e=>{let{video:t,subtitles:n}=e,r=e.mode??Js()??`window`,i=e.maxWidth??(r===`burn-in`?Hs:Vs),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,Ws)})).catch(()=>{}).finally(()=>{e.pause(),setTimeout(()=>{l=!1},Ws)})},E=[[`play`,()=>{t.play().catch(()=>{})}],[`pause`,()=>t.pause()]],D=e=>{if(`mediaSession`in navigator)for(let[t,n]of E)try{navigator.mediaSession.setActionHandler(t,e?n:null)}catch{}},O=()=>{if(y(),D(!1),t.removeEventListener(`play`,C),t.removeEventListener(`pause`,w),t.removeEventListener(`seeked`,T),!a){f?.();return}let{stream:e,mirror:n}=a;n.removeEventListener(`play`,x),n.removeEventListener(`pause`,S),n.removeEventListener(`leavepictureinpicture`,k);for(let t of e.getTracks())t.stop();n.remove(),a=void 0,f?.()},k=()=>O(),A=e=>{let r=t.style.opacity,i=n.style.display;e.style.cssText=`position:absolute;inset:0;width:100%;height:100%;object-fit:contain;background:#000;z-index:1`,t.style.opacity=`0`,n.style.display=`none`,f=()=>{f=void 0,t.style.opacity=r,n.style.display=i}},j=async()=>{let n=Math.min(t.videoWidth||i,i),o=Math.round(n*((t.videoHeight||9)/(t.videoWidth||16))),c=document.createElement(`canvas`);c.width=n,c.height=o;let l=c.getContext(`2d`);if(!l)throw Error(`the picture in picture composite has no 2d context`);let u=document.createElement(`video`);u.muted=!0,u.playsInline=!0,r===`burn-in`?A(u):u.style.cssText=`position:fixed;width:1px;height:1px;opacity:0;pointer-events:none;left:-1px;top:-1px`,m(c,l);let f={composite:c,context:l,stream:c.captureStream(),mirror:u};if(a=f,u.srcObject=f.stream,(e.container??t.parentElement??document.body).appendChild(u),v(),s=setInterval(()=>{t.paused&&h()},Us),u.play().catch(()=>{}),u.readyState===0&&await new Promise(e=>{let t=()=>{clearTimeout(n),e()},n=setTimeout(t,1e3);u.addEventListener(`loadedmetadata`,t,{once:!0})}),d||a!==f){u.remove();return}if(u.addEventListener(`play`,x),u.addEventListener(`pause`,S),u.addEventListener(`leavepictureinpicture`,k),t.addEventListener(`play`,C),t.addEventListener(`pause`,w),t.addEventListener(`seeked`,T),D(!0),b(),r===`burn-in`){t.paused&&u.pause(),e.onBurnedInChange?.(!0);return}await u.requestPictureInPicture()};return{toggle:async()=>{if(!(d||u)){u=!0;try{if(p()){if(r===`burn-in`){O(),e.onBurnedInChange?.(!1);return}await document.exitPictureInPicture().catch(()=>{});return}r!==`burn-in`&&document.pictureInPictureElement&&await document.exitPictureInPicture().catch(()=>{});try{await j()}catch(t){console.warn(`subtitle compositing for picture in picture failed`,t),O(),r===`burn-in`&&e.onBurnedInChange?.(!1)}}finally{u=!1}}},mode:r,destroy:()=>{d=!0,r!==`burn-in`&&p()&&document.exitPictureInPicture().catch(()=>{}),O(),r===`burn-in`&&e.onBurnedInChange?.(!1)}}};function Xs(e){return typeof e==`string`}function Zs(e){return typeof e==`number`}function K(e){return typeof e==`function`}function Qs(e){return e===null}function q(e){return e===void 0}function $s(e){return typeof e==`object`&&!!e}function ec(e,t){let n={...t};for(let t in e)q(e[t])||(n[t]=e[t]);return n}function tc(e,t){let n={};for(let r of t)Object.hasOwn(e,r)&&(n[r]=e[r]);return n}var nc=Object.prototype.hasOwnProperty;function rc(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(!nc.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var ic=new Map,ac=new Set;function oc(e){return e.trim().replaceAll(`_`,`-`).toLowerCase()}function sc(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 cc(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 lc(e){return sc(oc(e))}function uc(e){let t=lc(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=cc(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 dc(e){let t={};for(let n=e.length-1;n>=0;n--){let r=e[n],i=ic.get(r);i&&Object.assign(t,i)}return t}function fc(e){return dc(uc(e))}function pc(e){return ac.add(e),()=>{ac.delete(e)}}function mc(e){return typeof e==`string`?e:e.text}function hc(e){return $s(e)&&`key`in e&&`text`in e}var gc=/\{([^{}]+)\}/g;function _c(e,t){return t?e.replace(gc,(e,n)=>Object.hasOwn(t,n)?String(t[n]):e):e}function vc(e,t,n){return typeof e==`string`?e:typeof t==`function`?t(e,n):_c(mc(e),t??n)}function yc(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,_c(o??(i?t.text:s)??String(a),c)}}d();var bc=g(null);g(void 0);function xc(){let e=P(bc),[t,n]=j(e=>e+1,0);m(()=>pc(()=>n()),[]);let r=E(()=>yc(fc(`en`),`en`),[t]);return e?e.translator:r}function Sc(){return P(bc)?.locale??`en`}function Cc(e){let t=e.closest(`[dir]`)?.getAttribute(`dir`);return t?t.toLowerCase()===`rtl`:getComputedStyle(e).direction===`rtl`}function wc(e){let t=e.composedPath();return t.length>0?t[0]:e.target}function Tc(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 Ec(e=document){let t=e.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}function Dc(){return typeof CSS<`u`&&CSS.supports(`anchor-name: --a`)}var Oc=[`button`,`input`,`select`,`textarea`,`a[href]`,`[role="button"]`,`[role="menu"]`,`[role="menuitem"]`,`[role="menuitemcheckbox"]`,`[role="menuitemradio"]`,`[role="slider"]`,`[data-interactive]`].join(`,`),kc=[`textarea`,`select`,`input:not([type])`,...[`text`,`search`,`url`,`tel`,`email`,`password`,`number`].map(e=>`input[type="${e}"]`),`[contenteditable]:not([contenteditable="false"])`].join(`,`);function Ac(e){return e.matches(kc)}function jc(e){let t=wc(e);return t instanceof Element&&Ac(t)}function Mc(e){let t=wc(e);return t instanceof Element&&t.closest(Oc)!==null}var Nc=new Set([` `,`Enter`]),Pc=`button,a[href],[role="slider"],[role="button"]`;function Fc(e){if(!Nc.has(e.key))return!1;let t=wc(e);return t instanceof Element&&t.matches(Pc)}function J(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function Ic(){return typeof navigator<`u`&&/mac/i.test(navigator.userAgent)}var Lc={sideOffset:0,boundaryOffset:0},Rc={top:`bottom`,bottom:`top`,left:`right`,right:`left`};function zc(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 Bc(e,t,n,r,i=Lc){let a=r.side,o=Rc[a],s=a===`top`||a===`bottom`?t.height:t.width,c=zc(e,n,a,i);return c>=s?a:zc(e,n,o,i)>c?o:a}function Vc(e){try{e?.showPopover?.()}catch{}}function Hc(e){try{e?.hidePopover?.()}catch{}}function Uc(e){return e instanceof Node&&e.nodeType===11&&`host`in e}function Wc(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 Gc(e){return e.kind===`captions`||e.kind===`subtitles`}function Kc(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(Jc):[]}function Jc(e,t){return e.kind>t.kind?1:e.kind<t.kind?-1:0}function Yc(e){let t=[];for(let n=0;n<e.length;n++)t.push([e.start(n),e.end(n)]);return t}function Xc(e,t){let n=t;for(;n;){if(n===e||e.contains(n))return!0;let t=n.getRootNode();n=Uc(t)?t.host:n.parentNode}return!1}function Zc(){return`WebKitPlaybackTargetAvailabilityEvent`in globalThis}function Qc(e){return Zc()&&`webkitCurrentPlaybackTargetIsWireless`in e}d();function $c(e,t){if(K(e))return e(t);e!=null&&(e.current=t)}function el(...e){let t=e.flat();return e=>{let n=t.map(t=>$c(t,e));if(n.some(K))return()=>{for(let e=0;e<n.length;e++){let r=n[e];K(r)?r():$c(t[e],null)}}}}function tl(...e){return c(el(...e),[...e])}d();function nl(e,t,n,a=rc){let o=i(void 0),s=()=>{let e=n(t());return o.current!==void 0&&a(o.current,e)?o.current:(o.current=e,e)};return r(e,s,s)}function rl(e){return e}function il(...e){}function al(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 ol(e,t,n){return nl(t=>e.subscribe(t),()=>e.current,t??rl,n)}var sl=()=>il;function cl(e,t,n){return nl(t?t=>e.subscribe(t):sl,t?()=>e.state:()=>e,t??rl,n)}d();var ll=g(null),ul=()=>{},dl={state:{},subscribe:()=>ul};function fl({value:e,children:t}){return I(ll.Provider,{value:e,children:t})}function pl(){let e=P(ll);if(!e)throw Error(`usePlayerContext must be used within a Player Provider`);return e}function ml(e){let{store:t}=pl();return cl(t,e)}function hl(e){let t=P(ll),n=cl(t?.store??dl,t?e:void 0);return t?n:void 0}function gl(){let{media:e}=pl();return e}function _l(){let{container:e}=pl();return e}function vl(){return P(ll)?.container??null}function yl(){return P(ll)?.popupGroup}function bl(){return P(ll)?.setMedia}function xl(){return P(ll)?.setContainer}function Sl(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 Cl=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),Sl([this.#e.signal,t.signal])}};function wl(...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 Tl=class extends Error{code;cause;constructor(e,t){super(t?.message??e),this.name=`StoreError`,this.code=e,this.cause=t?.cause}};function El(){throw new Tl(`NO_TARGET`)}function Dl(){throw new Tl(`DESTROYED`)}var Ol={target:El,signals:new Cl,get:El,set:El};function kl(e){let t=e.state(Ol),n=Object.keys(t),r=n[0];return Object.assign(r?e=>{if(r in e)return tc(e,n)}:()=>void 0,{displayName:e.name})}function Al(){return e=>e}var jl=!1;function Ml(){jl||(jl=!0,queueMicrotask(Pl))}var Nl=new Set;function Pl(){jl=!1;for(let e of Nl)e.flush();Nl.clear()}var Fl=Object.prototype.hasOwnProperty,Il=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(!Fl.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 il;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,Nl.add(this),Ml()}};function Ll(e){return new Il(e)}var Rl=Symbol.for(`@videojs/store`);function zl(){return(e,t={})=>{let n=null,r=!1,i=new AbortController,a=new Cl,o;function s(){r&&Dl(),n||El()}let c=e.state({target:()=>(s(),n),signals:a,get:()=>o.current,set:e=>o.patch(e)});o=Ll(c);let l={[Rl]:!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&&Dl(),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(){Qs(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 Bl=Al();function Vl(e,t){if(arguments.length===1)return Bl(e);let{name:n,state:r,attach:i}=e,a=e=>Bl({...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 Hl=Object.freeze({length:0,start:()=>0,end:()=>0}),Ul=Object.assign(new EventTarget,{length:0,*[Symbol.iterator](){},getTrackById:()=>null}),Wl=new EventTarget;Object.freeze({});var Gl=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 Kl(e){return e.readyState>=1}function ql(e){if(!$s(e))return!1;let t=e;return!q(t.paused)&&!q(t.ended)&&K(t.pause)}function Jl(e){if(!$s(e))return!1;let t=e;return!q(t.currentTime)&&!q(t.duration)&&!q(t.seeking)}function Yl(e){if(!$s(e))return!1;let t=e;return!q(t.src)&&!q(t.currentSrc)&&!q(t.readyState)&&K(t.load)}function Xl(e){if(!$s(e))return!1;let t=e;return!q(t.volume)&&!q(t.muted)}function Zl(e){return $s(e)?!q(e.playbackRate):!1}function Ql(e){if(!$s(e))return!1;let t=e;return!q(t.buffered)&&t.buffered!==Hl&&!q(t.seekable)&&t.seekable!==Hl}function $l(e){return $s(e)?!q(e.error):!1}function eu(e){if(!$s(e))return!1;let t=e;return!q(t.textTracks)&&t.textTracks!==Ul}function tu(e){return $s(e)?!q(e.videoRenditions):!1}function nu(e){return $s(e)?!q(e.audioTracks):!1}function ru(e){if(!$s(e))return!1;let t=e;return!q(t.videoWidth)&&!q(t.videoHeight)}function iu(e){if(!$s(e))return!1;let t=e;return $s(t.remote)&&t.remote!==Wl}function au(e){return $s(e)?!q(e.streamType):!1}function ou(e){if(!$s(e))return!1;let t=e;return!q(t.liveEdgeStart)&&!q(t.targetLiveWindow)}function su(e){return $s(e)&&`querySelectorAll`in e&&K(e.querySelectorAll)}var cu={ON_DEMAND:`on-demand`,LIVE:`live`,UNKNOWN:`unknown`};function lu(e,t){return e.id||String(t)}function uu(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 du=Vl({name:`audioTrack`,state:({target:e})=>({audioTrackList:[],selectAudioTrack(t){let{media:n}=e();if(!nu(n))return;let r=[...n.audioTracks],i=r.find((e,n)=>lu(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=()=>nu(r)?r.audioTracks:null,s=(e=o())=>{n({audioTrackList:e?[...e].map(uu):[]})},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})}}),fu=Vl({name:`buffer`,state:()=>({buffered:[],seekable:[]}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Ql(r))return;let i=()=>n({buffered:Yc(r.buffered),seekable:Yc(r.seekable)});i(),J(r,`progress`,i,{signal:t}),J(r,`emptied`,i,{signal:t})}});function pu(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 mu=250,hu=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!Mc(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>mu||Mc(e))return;let n=e.pointerType,r=e.clientX,i=this.#e,a=this.#t,o={resolve:e=>yu(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}}},gu=new WeakMap;function _u(e){return gu.get(e)}function vu(e){let t=gu.get(e);return t||(t=new hu(e),gu.set(e,t)),t}function yu(e,t,n,r,i){let a=i.getBoundingClientRect(),o=bu(e,t,n),s=o.size>0?pu(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 bu(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 xu(e){let t=e;if($s(t.remote)&&`state`in t.remote&&`prompt`in t.remote)return t.remote}function Su(e){return xu(e)?.state===`connected`}function Cu(e){return xu(e)?.state===`connecting`}async function wu(e){let t=xu(e);if(!t)throw new DOMException(`Remote playback not supported`,`NotSupportedError`);return t.prompt()}var Tu=2e3,Eu=250,Du=500,Ou=Vl({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)||Qs(a))return;let o=e=>e||i.paused||Su(i)||Cu(i),s;function c(){clearTimeout(s),s=void 0}function l(){c(),s=setTimeout(d,Tu)}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<Du;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<Eu){if(_u(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}),iu(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()}}),ku=Vl({name:`error`,state:({set:e})=>({error:null,dismissError(){e({error:null})}}),attach({target:e,signal:t,set:n}){let{media:r}=e;$l(r)&&(J(r,`error`,()=>n({error:r.error}),{signal:t}),J(r,`emptied`,()=>n({error:null}),{signal:t}))}});function Au(){let e=document;return e.fullscreenEnabled||e.webkitFullscreenEnabled?!0:K(document.createElement(`video`).webkitSetPresentationMode)}function ju(){let e=document;return e.fullscreenElement??e.webkitFullscreenElement??null}function Mu(e){if(!(e instanceof Element))return!1;try{return e.matches(`:fullscreen`)}catch{return!1}}function Nu(e,t){if(t.webkitPresentationMode===`fullscreen`)return!0;let n=ju();return n&&(n===e||n===t)||Mu(e)||Mu(t)?!0:t.isFullscreen??!1}async function Pu(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 Fu(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 Iu(){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 Lu(e){return e.webkitPresentationMode===`picture-in-picture`||document.pictureInPictureElement===e?!0:e.isPictureInPicture??!1}async function Ru(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 zu(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 Bu=Vl({name:`fullscreen`,state:({target:e})=>({fullscreen:!1,fullscreenAvailability:`unavailable`,async requestFullscreen(){let{media:t,container:n}=e();return Lu(t)&&await zu(t),Pu(n,t)},async exitFullscreen(){let{media:t}=e();return Fu(t)},async toggleFullscreen(){let{media:t,container:n}=e();return Nu(n,t)?Fu(t):(Lu(t)&&await zu(t),Pu(n,t))}}),attach({target:e,signal:t,set:n}){let{media:r,container:i}=e;n({fullscreenAvailability:Au()?`available`:`unsupported`});let a=()=>n({fullscreen:Nu(i,r)});a(),J(document,`fullscreenchange`,a,{signal:t}),J(document,`webkitfullscreenchange`,a,{signal:t}),`webkitPresentationMode`in r&&J(r,`webkitpresentationmodechanged`,a,{signal:t})}}),Vu=Vl({name:`live`,state:()=>({liveEdgeStart:NaN,targetLiveWindow:NaN}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!ou(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})}}),Hu=Vl({name:`pip`,state:({target:e})=>({pip:!1,pipAvailability:`unavailable`,async requestPictureInPicture(){let{media:t,container:n}=e();return Nu(n,t)&&await Fu(t),Ru(t)},async exitPictureInPicture(){let{media:t}=e();return zu(t)},async togglePictureInPicture(){let{media:t,container:n}=e();return Lu(t)?zu(t):(Nu(n,t)&&await Fu(t),Ru(t))}}),attach({target:e,signal:t,set:n}){let{media:r}=e;n({pipAvailability:Iu()?`available`:`unsupported`});let i=()=>n({pip:Lu(r)});i(),J(r,`enterpictureinpicture`,i,{signal:t}),J(r,`leavepictureinpicture`,i,{signal:t}),`webkitPresentationMode`in r&&J(r,`webkitpresentationmodechanged`,i,{signal:t})}}),Uu=Vl({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)||!Jl(r)||!Yl(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})}}),Wu=[.2,.5,.7,1,1.2,1.5,1.7,2],Gu=Vl({name:`playbackRate`,state:({target:e})=>({playbackRates:Wu,playbackRate:1,setPlaybackRate(t){let{media:n}=e();Zl(n)&&(n.playbackRate=t)}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Zl(r))return;let i=()=>n({playbackRate:r.playbackRate});i(),J(r,`ratechange`,i,{signal:t})}}),Ku=`auto`;function qu(e,t){return e.id||String(t)}function Ju(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 Yu(e){return e.width&&e.height?Math.min(e.width,e.height):e.height??e.width}var Xu=Vl({name:`quality`,state:({target:e})=>({videoRenditionList:[],activeVideoRendition:null,selectVideoRendition(t){let{media:n}=e();if(!tu(n))return;if(t===Ku){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=()=>tu(r)?r.videoRenditions:null,s=e=>{if(!e)return null;let t=[...e],n=t.find(e=>e.active);if(n)return n;if(!ru(r)||!r.videoWidth&&!r.videoHeight)return null;let i=Yu({width:r.videoWidth||void 0,height:r.videoHeight||void 0}),a=t.filter(e=>Yu(e)===i);return a.length===1?a[0]:null},c=(e=o())=>{let t=s(e);n({videoRenditionList:e?[...e].map(Ju):[],activeVideoRendition:t?Ju(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})}}),Zu=Vl({name:`remotePlayback`,state:({target:e})=>({remotePlaybackState:`disconnected`,remotePlaybackAvailability:`unsupported`,async toggleRemotePlayback(){let{media:t,container:n}=e();return Su(t)?wu(t):(Nu(n,t)&&await Fu(t),await wu(t))}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!iu(r))return;if(Qc(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(()=>{})})}}),Qu=Vl({name:`source`,state:({target:e,signals:t})=>({source:null,canPlay:!1,loadSource(n){t.clear();let{media:r}=e();return Yl(r)?(r.src=n,r.load(),n):n}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Yl(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})}}),$u=Vl({name:`streamType`,state:()=>({streamType:cu.UNKNOWN}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(au(r)){let e=()=>n({streamType:r.streamType});e(),J(r,`streamtypechange`,e,{signal:t});return}if(!Jl(r))return;let i=()=>{let{duration:e}=r;return e===1/0?cu.LIVE:Number.isFinite(e)&&e>0?cu.ON_DEMAND:cu.UNKNOWN},a=()=>n({streamType:i()});a(),J(r,`durationchange`,a,{signal:t}),J(r,`loadedmetadata`,a,{signal:t}),J(r,`emptied`,a,{signal:t}),Ql(r)&&J(r,`progress`,a,{signal:t})}});function ed(e,t){return e.id||`track:${t}:${e.kind}:${e.language}:${e.label}`}var td=Vl({name:`textTrack`,state:({target:e})=>({chaptersCues:[],thumbnailCues:[],thumbnailTrackSrc:null,textTrackList:[],subtitlesShowing:!1,toggleSubtitles(t){let{media:n}=e();if(!eu(n))return!1;let r=qc(n,Gc);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(!eu(n))return;let r=Array.from(n.textTracks).map((e,t)=>({index:t,track:e})).filter(({track:e})=>Gc(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})=>ed(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(!eu(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:ed(i,n),kind:i.kind,label:i.label,language:i.language,mode:i.mode}),Gc(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=Kc(r,t)?.src??null);let d=su(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})}}),nd={seek:Symbol.for(`@videojs/seek`)},rd=Vl({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(nd.seek);if(!Jl(i)||!Yl(i))return 0;if(!Kl(i)&&!await Tc(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 Tc(i,`seeked`,{signal:a}).catch(il),i.currentTime}}),attach({target:e,signal:t,set:n,get:r}){let{media:i}=e;if(!Jl(i))return;let a=()=>{let{duration:e}=i;if(e===1/0&&Ql(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})}}),id=.25,ad=Vl({name:`volume`,state:({target:e})=>({volume:1,muted:!1,volumeAvailability:`unavailable`,setVolume(t){let{media:n}=e();if(!Xl(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 Xl(t)?(t.muted||t.volume===0?(t.muted=!1,t.volume===0&&(t.volume=id)):t.muted=!0,t.muted):!1}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Xl(r))return;n({volumeAvailability:od()});let i=()=>n({volume:r.volume,muted:r.muted});i(),J(r,`volumechange`,i,{signal:t})}});function od(){let e=document.createElement(`video`);try{return e.volume=.5,e.volume===.5?`available`:`unsupported`}catch{return`unsupported`}}kl(du);var sd=kl(fu),cd=kl(Ou),ld=kl(ku),ud=kl(Bu);kl(Vu);var dd=kl(Hu),fd=kl(Uu),pd=kl(Gu);kl(Xu),kl(Zu),kl(Qu),kl($u);var md=kl(td),hd=kl(rd),gd=kl(ad),_d={seekStep({store:e,value:t}){if(q(t))return;let n=hd(e.state);n&&n.seek(n.currentTime+t)},volumeStep({store:e,value:t}){if(q(t))return;let n=gd(e.state);n&&n.setVolume(n.volume+t)},speedUp({store:e}){let t=pd(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=pd(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])}},vd={seekStep:_d.seekStep,volumeStep:_d.volumeStep,speedUp:_d.speedUp,speedDown:_d.speedDown};function yd(e){return vd[e]||(({store:t})=>{let n=t.state[e];K(n)&&n()})}var bd=200,xd=class{#e=0;#t=null;handleUp(e,t){if(e.resolve(`doubletap`).length>0){let n=Date.now();if(n-this.#e<bd){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)},bd);return}e.resolve(`tap`)[0]?.onActivate(t)}#n(){this.#t!==null&&(clearTimeout(this.#t),this.#t=null)}reset(){this.#n(),this.#e=0}},Sd=new WeakMap;function Cd(e){let t=Sd.get(e);return t||(t=new xd,Sd.set(e,t),t)}function wd(e,t,n){return vu(e).add({type:`tap`,recognizer:Cd(e),onActivate:t,pointer:n?.pointer,region:n?.region,disabled:n?.disabled,action:n?.action,value:n?.value})}function Td(e,t,n){return vu(e).add({type:`doubletap`,recognizer:Cd(e),onActivate:t,pointer:n?.pointer,region:n?.region,disabled:n?.disabled,action:n?.action,value:n?.value})}function Ed(e){return e.startsWith(`toggle`)}var Dd={togglePaused({store:e}){let t=fd(e.state);t&&(t.paused?t.play():t.pause())},toggleMuted({store:e}){gd(e.state)?.toggleMuted()},toggleFullscreen({store:e}){let t=ud(e.state);t&&(t.fullscreen?t.exitFullscreen():t.requestFullscreen())},toggleSubtitles({store:e}){md(e.state)?.toggleSubtitles()},togglePictureInPicture({store:e}){let t=dd(e.state);t&&(t.pip?t.exitPictureInPicture():t.requestPictureInPicture())},seekStep:_d.seekStep,volumeStep:_d.volumeStep,speedUp:_d.speedUp,speedDown:_d.speedDown,seekToPercent({store:e,value:t,key:n}){let r=hd(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 Od(e){return Dd[e]}var kd={shift:`Shift`,ctrl:`Control`,alt:`Alt`,meta:`Meta`},Ad={shift:`Shift`,ctrl:`Ctrl`,alt:`Alt`,meta:`Meta`},jd=[`ctrl`,`shift`,`alt`,`meta`];function Md(e){return e.map(e=>{let t=[];for(let n of jd)e.modifiers.has(n)&&t.push(kd[n]);return t.push(e.originalKey),t.join(`+`)}).join(` `)}function Nd(e){let t=[];for(let n of jd)e.modifiers.has(n)&&t.push(Ad[n]);return t.push(Pd(e.originalKey)),t.join(`+`)}function Pd(e){return e.length===1?e.toUpperCase():e}var Fd=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:Ld(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:Md(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`||Fc(e)||e.defaultPrevented)return;let t=jc(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(zd(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:Nd(e.parsed[0])}#h(){for(let e of this.#o)e()}},Id=new Set([`shift`,`ctrl`,`alt`,`meta`]);function Ld(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(Ic()?`meta`:`ctrl`):Id.has(t)&&r.add(t)}return[{modifiers:r,key:n===`Space`?` `:n.toLowerCase(),originalKey:n}]}function Rd(e){return e.length===1&&!/[a-z]/i.test(e)}function zd(e,t){if(t.key===`Unidentified`||t.key.toLowerCase()!==e.key)return!1;let n=Rd(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 Bd=new WeakMap;function Vd(e){let t=Bd.get(e);return t||(t=new Fd(e),Bd.set(e,t)),t}function Hd(e,t){return Vd(e).add(t)}var Ud=[Uu,Gu,Xu,du,ad,rd,Qu,fu,Bu,Hu,Zu,Ou,td,ku];function Wd(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 Gd(e){let{onOpenChange:t}=e,n=null,r=null,i=null,a=Wd({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 Kd(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 Jd(e){let t=Ec(e.ownerDocument);(!t||t===e.ownerDocument.body||!Xc(e,t))&&e.focus({preventScroll:!0})}var Yd={transitionStarting:`data-starting-style`,transitionEnding:`data-ending-style`};function Xd(e){return{transitionStarting:e===`starting`,transitionEnding:e===`ending`}}function Zd(e){let{onOpenChange:t,closeOnOutsideClick:n}=e,r=null,i=null,a=null,o=new Set,s=!1,c=null,l=Wd({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||(Hc(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&&Hc(i),i=e,e&&u.current.active&&Vc(e)}return{input:u,triggerProps:T,popupProps:E,get triggerElement(){return r},setTriggerElement:D,setPopupElement:O,open:S,close:C,destroy:l.destroy}}function Qd(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 $d(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 Qd(n,r,Math.max(0,i-n),Math.max(0,a-r))}function ef(e){let t=document.documentElement.getBoundingClientRect();return e?$d(t,e.getBoundingClientRect()):t}function tf(e,t={}){if(!e)return null;if(!Xs(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 nf={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 rf(e,t,n){return Math.max(t,Math.min(n,e))}function af(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 of={sideOffset:0,alignOffset:0,boundaryOffset:0},sf={top:`bottom`,bottom:`top`,left:`right`,right:`left`};function cf(e){return`${rf(e,0,1/0)}px`}function lf(e,t,n,r){let i=n-r;return i<t?t:rf(e,t,i)}function uf(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 df(e,t,n,r,i,a,o=nf){if(Dc())return{...ff(e,t,o,n,i,a),...n&&i?pf(n,i,t,a,o):{}};if(n&&r){let e=a??of;return{position:`fixed`,margin:`0`,...mf(n,r,t,e,i),...i?pf(n,i,t,e,o):{}}}return{}}function ff(e,t,n=nf,r,i,a=of){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=sf[c];if(c===`top`||c===`bottom`){if(d[f]=`calc(anchor(${c}) + ${o})`,r&&i){let{base:e,translate:t}=uf(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}=uf(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 pf(e,t,n,r=of,i=nf){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]=cf(t-r.sideOffset),a[i.availableWidth]=cf(l-c)}else{let t=o===`left`?e.left-c:l-e.right;a[i.availableWidth]=cf(t-r.sideOffset),a[i.availableHeight]=cf(d-u)}return a}function mf(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=lf(d,i.left+e,i.right-e,t.width):l=lf(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 hf(e,t=nf){let n=getComputedStyle(e);return{sideOffset:Wc(e,n.getPropertyValue(t.sideOffset)),alignOffset:Wc(e,n.getPropertyValue(t.alignOffset)),boundaryOffset:Wc(e,n.getPropertyValue(t.boundaryOffset))}}function gf(e,t){let n=e.getBoundingClientRect(),r=e.offsetWidth||n.width,i=e.offsetHeight||n.height;return Qd(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 _f(){let e=null;return{open(t){e!==t&&(e?.close(`group-open`),e=t)},close(t){e===t&&(e=null)}}}function vf(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)?rf(i*100,0,100):0}function yf(e){let t=Ll({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?al(t=>e.onValueChange?.(t),r,{leading:!0}):null;function d(t,n){n&&u?u(t):e.onValueChange?.(t)}function f(){if(Qs(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=vf(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(!Qs(s)){if(n.pointerType!==`touch`&&n.buttons===0){p();return}let r=vf(n,o,e.getOrientation(),a);c=r,t.patch({dragPercent:r,pointerPercent:r}),d(r,!0);return}let r=vf(n,e.getElement().getBoundingClientRect(),e.getOrientation(),e.isRTL());t.patch({pointing:!0,pointerPercent:r})},onPointerUp(t){if(e.isDisabled()||(t.stopPropagation(),Qs(s)))return;let n=vf(t,o,e.getOrientation(),a);u?.cancel(),e.onValueChange?.(n),e.onValueCommit?.(n),l=!0},onPointerLeave(){Qs(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=af(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=rf(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 bf={fill:`--media-slider-fill`,pointer:`--media-slider-pointer`,buffer:`--media-slider-buffer`};function xf(e){return{[bf.fill]:`${e.fillPercent.toFixed(3)}%`,[bf.pointer]:`${e.pointerPercent.toFixed(3)}%`}}function Sf(e){return{...xf(e),[bf.buffer]:`${e.bufferPercent.toFixed(3)}%`}}function Cf(e,t){let n=e/2;return{position:`absolute`,left:t===`visible`?`calc(var(${bf.pointer}) - ${n}px)`:`min(max(0px, calc(var(${bf.pointer}) - ${n}px)), calc(100% - ${e}px))`,width:`max-content`,pointerEvents:`none`}}var wf=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 Tf(e){let{getContainer:t,getImg:n,onStateChange:r}=e,i=new wf,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 Ef={hover:`hover`,focus:`focus`,escape:`escape`,blur:`blur`,"imperative-action":`imperative-action`};function Df(e){let t={transition:e.transition,onOpenChange(t,n){let r=Ef[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=Zd(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 Of(){let e=Ll({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&&(Af(i),kf(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();jf(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 kf(e){e&&e.offsetHeight}function Af(e){let t=e?.getAnimations?.({subtree:!0})??[];for(let e of t)e.cancel()}function jf(e){if(!e)return Promise.resolve();let t=e.getAnimations?.()??[];return t.length===0?Promise.resolve():Promise.all(t.map(e=>e.finished)).then(il,il)}function Mf(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=rf(e.getPercent()-n*r,0,100);e.onValueChange?.(i)}}}function Nf(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 Pf(e,t){let n={};for(let r in e){if(t&&!(r in t))continue;let i=t?.[r]??Ff(r),a=e[r];a===!0?n[i]=``:a&&(n[i]=String(a))}return n}function Ff(e){return`data-${e.toLowerCase()}`}var If={key:`container.label`,text:`Media player`};d();var Lf=t(function({children:e,tabIndex:t=0,role:n=qd,"aria-label":r,"aria-labelledby":a,...o},s){let c=xl(),l=xc(),u=i(null),d=tl(s,u);m(()=>(c?.(u.current),()=>c?.(null)),[c]);let f=e=>{o.onPointerUp?.(e);let t=u.current;t&&Jd(t)};return I(`div`,{ref:d,role:n,tabIndex:t,...r!==void 0||a!==void 0?{"aria-label":r,"aria-labelledby":a}:{"aria-label":l(If)},...o,onPointerUp:f,children:e})});d();function Y(e){let t=i(e);return t.current=e,t}d();function Rf(e,t,n){let r=i(null),a=Y(t),o=Y(n);m(()=>(r.current===null?a.current?.():(clearTimeout(r.current),r.current=null),()=>{r.current=setTimeout(()=>{o.current?.(),e.destroy()},0)}),[e])}d();function zf(t){function n({children:n}){let[r,i]=e(()=>zl()(wl(...t.features))),[a]=e(()=>_f()),[o,s]=e(null),[c,l]=e(null);return Rf(r),m(()=>{if(o){if(r.destroyed){i(zl()(wl(...t.features)));return}return r.attach({media:o,container:c})}},[o,c,r]),I(fl,{value:E(()=>({store:r,media:o,setMedia:s,container:c,setContainer:l,popupGroup:a}),[r,o,c,a]),children:n})}function r(e){let{store:t}=pl();return cl(t,e)}return{Provider:n,Container:Lf,usePlayer:r,useMedia:gl}}function Bf(e){return e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>=65&&e.charCodeAt(2)<=90}function Vf(e,t){return Bf(e)&&(typeof t==`function`||t===void 0)}function Hf(e,t){return t?e?n=>{t(n),e(n)}:t:e}function Uf(e,t){return t&&e?`${t} ${e}`:t||e}function Wf(e,t){return t?e?{...e,...t}:t:e}function Gf(e,t){if(!t)return e;for(let n in t){let r=t[n];n===`className`?e.className=Uf(e.className,r):n===`style`?e.style=Wf(e.style,r):e[n]=Vf(n,r)?Hf(e[n],r):r}return e}function Kf(...e){let t={};for(let n of e)t=Gf(t,n);return t}d();function qf(e,t){return K(e)?e(t):e}function Jf(e,t){return K(e)?e(t):e}function Yf(e){let t=e;return t.ref??t.props?.ref}function X(e,t,r){let{className:i,style:a,render:o}=t,{state:s,ref:c,props:l,stateAttrMap:d}=r,f=qf(i,s),p=Jf(a,s),m=Kf(d?Pf(s,d):{},...Array.isArray(l)?l:l?[l]:[]);if(f!==void 0&&(m.className=m.className?`${m.className} ${f}`:f),p!==void 0&&(m.style=m.style?{...m.style,...p}:p),K(o)){let e=el(c,m.ref);return o({...m,ref:e},s)}if(n(o)){let e=Yf(o),t=el(c,m.ref,e),n=Kf(m,o.props);return n.ref=t,u(o,n)}return m.ref=el(c,m.ref),O(e,m)}d();function Xf(e){let{displayName:t,onActivate:n,isDisabled:r}=e,i=c(e=>{},[t]);return{getButtonProps:c(e=>Kf(Kd({onActivate:n,isDisabled:r}),e),[n,r]),buttonRef:i}}d();function Zf(t,n){let r=_l(),[i,a]=e({});return m(()=>{if(!r||!t){a({});return}let e=Vd(r),i=()=>a(e.getShortcut(t,n));return i(),e.subscribeShortcutChanges(i)},[r,t,n]),i}d(),g(null).Provider,g(null).Provider,g(null).Provider,g(null).Provider;var Qf=g(!1);Qf.Provider;function $f(){return P(Qf)}g(null).Provider,d();var ep=g(null),tp=ep.Provider;function np(){let e=P(ep);if(!e)throw Error(`Tooltip compound components must be used within a Tooltip.Root`);return e}function rp(){return P(ep)}d();function ip(e,t){return e.getLabelParams?.(t)}function ap(n){let{displayName:r,core:i,stateAttrMap:a,selector:o,action:s,hotkeyAction:c,hotkeyValue:l,tooltipLabel:u,isSupported:d}=n,f=new Set(Object.keys(i.defaultProps)),p=t(function(t,n){let{render:p,className:m,style:h,...g}=t,_={},v={};for(let e of Object.keys(g))f.has(e)?_[e]=g[e]:v[e]=g[e];let y=rp(),b=$f(),x=y?.setContent,S=ml(o),C=Zf(c,l?.(_)),w=xc(),[T]=e(()=>new i);f.has(`menuTrigger`)&&q(_.menuTrigger)&&(_.menuTrigger=b),T.setProps(_);let{getButtonProps:E,buttonRef:D}=Xf({displayName:r,onActivate:()=>{Promise.resolve(s(T,S)).catch(e=>{})},isDisabled:()=>!!_.disabled||!S});S&&T.setMedia(S);let O=S?T.getState():null,k=O?d?.(O)??!0:!1,j=O&&k?vc(T.getLabel(O),w,ip(T,O)):void 0,M=O&&k?u?.(T,O)??j:void 0;if(A(()=>{if(x)return x(M?{label:M,shortcut:C.shortcut}:void 0),()=>x(void 0)},[x,M,C.shortcut]),!S||!O||!k)return null;let N=T.getAttrs(O),P=N[`aria-label`],F={...N,...hc(P)?{"aria-label":vc(P,w,ip(T,O))}:void 0,"aria-keyshortcuts":C.aria};return X(`button`,{render:p,className:m,style:h},{state:O,stateAttrMap:a,ref:[n,D],props:[E(),F,v]})});return p.displayName=r,p}function op(e,t){return K(e)?e(t)||void 0:e||void 0}var sp=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,...Xd(e.status)}}getAttrs(e){return{role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":e.titleId,"aria-describedby":e.descriptionId}}},cp={open:`data-open`,...Yd},lp=class e{static defaultProps={delay:500};state=Ll({visible:!1});#e={...e.defaultProps};#t=null;setProps(t){this.#e=ec(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)}},up={visible:`data-visible`},dp=class{#e=null;setMedia(e){this.#e=e}getState(){let e=this.#e;return{visible:e.controlsVisible,userActive:e.userActive}}},fp={visible:`data-visible`,userActive:`data-user-active`},pp=class extends sp{setProps(){}},mp=`common.`,hp={key:`${mp}empty`,text:``},gp={key:`${mp}ok`,text:`OK`},_p=`errors.`,vp={key:`${_p}aborted`,text:`You stopped media playback before it finished.`},yp={key:`${_p}network`,text:`This media could not be loaded due to a network or server issue.`},bp={key:`${_p}decode`,text:`This media could not be played. It may be corrupted, or your browser may not support its format.`},xp={key:`${_p}source`,text:`This media could not be loaded. It may be unavailable, or your browser may not support its format.`},Sp={key:`${_p}encrypted`,text:`This media could not be played because it could not be decrypted.`},Cp={key:`${_p}title`,text:`Something went wrong.`},wp={key:`${_p}unexpected`,text:`An unexpected error occurred.`},Tp={[Gl.MEDIA_ERR_ABORTED]:vp,[Gl.MEDIA_ERR_NETWORK]:yp,[Gl.MEDIA_ERR_DECODE]:bp,[Gl.MEDIA_ERR_SRC_NOT_SUPPORTED]:xp,[Gl.MEDIA_ERR_ENCRYPTED]:Sp,[Gl.MEDIA_ERR_CUSTOM]:hp},Ep={[Gl.MEDIA_ERR_SRC_NOT_SUPPORTED]:[`Failed to open media`]};function Dp(e){return e>=Gl.MEDIA_ERR_ABORTED&&e<=Gl.MEDIA_ERR_ENCRYPTED}function Op(){return Cp}function kp(){return gp}function Ap(e,t){if(e){let t=Tp[e.code],n=e.message?.trim();if(n){let r=Gl.defaultMessages[e.code];if(t&&r&&n===r)return t;let i=Ep[e.code];return t&&Dp(e.code)&&!e.context&&i?.includes(n)?t:n}if(t)return t}return t?.trim()||wp}var jp=`fullscreen.`,Mp={key:`${jp}enter`,text:`Enter fullscreen`},Np={key:`${jp}exit`,text:`Exit fullscreen`},Pp=class e{static defaultProps={label:``,disabled:!1};state=Ll({fullscreen:!1,availability:`unavailable`,disabled:!0,hidden:!0,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=ec(t,e.defaultProps)}getLabel(e){return op(this.#e.label,e)||(e.fullscreen?Np:Mp)}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:mc(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()}},Fp={fullscreen:`data-fullscreen`,availability:`data-availability`,disabled:`data-disabled`,hidden:`data-hidden`},Ip={key:`playback.rate`,text:`Playback rate {rate}`},Lp=`volume.`,Rp={key:`${Lp}mutedValue`,text:`{percent}, muted`};`${Lp}`;var zp={key:`${Lp}label`,text:`Volume`};`${Lp}`;var Bp=Intl.DurationFormat,Vp=new Map;function Hp(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 Up(e){return e===void 0?``:Array.isArray(e)?e.join(`:`):e}function Wp(e){let t=Array.isArray(e)?e[0]:e;return!t||t===`en`||t.startsWith(`en-`)}function Gp(e,t=`long`,n){let r=`${Up(e)}:${t}:${n??``}`,i=Vp.get(r);return i||(i=Bp?new Bp(e,n===void 0?{style:t}:{style:t,hoursDisplay:n}):Hp(t,n),Vp.set(r,i)),i}function Kp(e){return Zs(e)&&Number.isFinite(e)}function qp(e,t){if(!Kp(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=Kp(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=Gp(`en`,`digital`,u?`always`:`auto`).format(f);return d||(p=p.replace(/^0(?=\d:)/,``)),`${n?`-`:``}${p}`}function Jp(e){if(!Kp(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 Yp(e,t){if(!Kp(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=Gp(t?.locale,t?.style??`long`).format(s);if(n){let e=t?.formatRemaining;return e?e(c):Wp(t?.locale)?`${c} remaining`:c}return c}var Xp=`buttons.`,Zp={key:`${Xp}play`,text:`Play`},Qp={key:`${Xp}pause`,text:`Pause`},$p={key:`${Xp}replay`,text:`Replay`},em={key:`${Xp}mute`,text:`Mute`},tm={key:`${Xp}unmute`,text:`Unmute`},nm=class e{static defaultProps={label:``,disabled:!1};state=Ll({muted:!1,volumeLevel:`off`,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=ec(t,e.defaultProps)}getLabel(e){return op(this.#e.label,e)||(e.muted?tm:em)}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:rm(e)}),this.state.patch({label:mc(this.getLabel(this.state.current))}),this.state.current}toggle(e){this.#e.disabled||e.toggleMuted()}};function rm(e){return e.muted||e.volume===0?`off`:e.volume<.5?`low`:e.volume<.75?`medium`:`high`}var im={muted:`data-muted`,volumeLevel:`data-volume-level`},am=`pip.`,om={key:`${am}enter`,text:`Enter picture-in-picture`},sm={key:`${am}exit`,text:`Exit picture-in-picture`},cm=class e{static defaultProps={label:``,disabled:!1};state=Ll({pip:!1,availability:`unavailable`,disabled:!0,hidden:!0,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=ec(t,e.defaultProps)}getLabel(e){return op(this.#e.label,e)||(e.pip?sm:om)}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:mc(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()}},lm={pip:`data-pip`,availability:`data-availability`,disabled:`data-disabled`,hidden:`data-hidden`},um=class e{static defaultProps={label:``,disabled:!1};state=Ll({paused:!0,ended:!1,started:!1,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=ec(t,e.defaultProps)}getLabel(e){return op(this.#e.label,e)||(e.ended?$p:e.paused?Zp:Qp)}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:mc(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()}}},dm={paused:`data-paused`,ended:`data-ended`,started:`data-started`},fm=class e{static defaultProps={label:``,disabled:!1,menuTrigger:!1};state=Ll({rate:1,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=ec(t,e.defaultProps)}getLabel(e){let t=op(this.#e.label,e);return t===void 0?Ip:t}getLabelParams(e){if(op(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:mc(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)}},pm={rate:`data-rate`},mm=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=ec(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,...Xd(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}}},hm={open:`data-open`,side:`data-side`,align:`data-align`,...Yd},gm=`seek.`,_m={key:`${gm}forward`,text:`Seek forward {seconds} seconds`},vm={key:`${gm}backward`,text:`Seek backward {seconds} seconds`},ym=class e{static defaultProps={seconds:30,label:``,disabled:!1};state=Ll({seeking:!1,direction:`forward`,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=ec(t,e.defaultProps)}getLabel(e){let t=op(this.#e.label,e);return t===void 0?e.direction===`backward`?vm:_m:t}getLabelParams(e){if(op(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:mc(this.getLabel(this.state.current))}),this.state.current}async seek(e){this.#e.disabled||await e.seek(e.currentTime+this.#e.seconds)}},bm={seeking:`data-seeking`,direction:`data-direction`},xm=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=ec(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 op(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 af(rf(t+e/100*(n-t),t,n),r,t)}rawValueFromPercent(e){let{min:t,max:n}=this.#e;return rf(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)}},Sm={dragging:`data-dragging`,pointing:`data-pointing`,interactive:`data-interactive`,orientation:`data-orientation`,disabled:`data-disabled`},Cm={loading:`data-loading`,error:`data-error`,hidden:`data-hidden`};function wm(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&&Zs(n)&&!Number.isNaN(n)&&(l[t]=n)}let u={url:a};return Zs(l.w)&&(u.width=l.w),Zs(l.h)&&(u.height=l.h),Zs(l.x)&&Zs(l.y)&&(u.coords={x:l.x,y:l.y}),u}function Tm(e,t){let n=[];for(let r of e){let e=wm(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 Em=`time.`,Dm={key:`${Em}current`,text:`Current time`},Om={key:`${Em}duration`,text:`Duration`},km={key:`${Em}remaining`,text:`Remaining`},Am={key:`${Em}remainingSuffix`,text:`{duration} remaining`},jm={key:`${Em}showElapsed`,text:`{duration}. Show elapsed time.`},Mm={key:`${Em}showDuration`,text:`{duration}. Show duration.`},Nm={key:`${Em}showRemaining`,text:`{duration}. Show remaining time.`},Pm={key:`${Em}position`,text:`{current} of {duration}`},Fm={current:jm,duration:Mm,remaining:Nm},Im={current:Dm,duration:Om,remaining:km},Lm=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=ec(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 Yp(e===`remaining`?t<0?t:-Math.abs(t):t)}#a(){let e=this.#n();return Jp(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=op(this.#e.label,e);return n===void 0?this.#e.toggle?Fm[this.#o(t,e.type)]:Im[this.#e.type]:n}getLabelParams(e){return op(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()}}},Rm={type:`data-type`},zm={key:`slider.seek`,text:`Seek`},Bm=class e extends xm{static defaultProps={...xm.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=ec(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)||zm}#i(e){return e.dragging?this.rawValueFromPercent(e.pointerPercent):e.value}#a(e){return this.#n===void 0?Yp(e):Yp(e,{locale:this.#n})}getValueText(e){return Number.isFinite(e.duration)?Pm: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)}}},Vm={...Sm,seeking:`data-seeking`},Hm=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=ec(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,...Xd(e.status)}}getPopupAttrs(e){return{popover:`manual`,role:`presentation`}}},Um={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`},Wm={open:`data-open`,side:`data-side`,align:`data-align`,...Yd},Gm=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=ec(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()}},Km=new Map;function qm(e){return e===void 0?``:Array.isArray(e)?e.join(`:`):e}function Jm(e){let t=qm(e),n=Km.get(t);if(!n)try{n=new Intl.NumberFormat(e,{style:`percent`,maximumFractionDigits:0}),Km.set(t,n)}catch{return}return n}function Ym(e){return`${Math.round(Math.min(1,Math.max(0,e))*100)}%`}function Xm(e,t){let n=!Zs(e)||!Number.isFinite(e)?0:Math.min(1,Math.max(0,e));try{let e=Jm(t)??Jm(void 0);if(e)return e.format(n)}catch{}return Ym(n)}var Zm=class e extends xm{static defaultProps={...xm.defaultProps,label:``,wheelStep:5};#e=null;#t;constructor(e){super(),e&&this.setProps(e)}setProps(t){super.setProps(ec(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)||zp}getValueText(e){return e.muted?Rp:this.getValueTextParams(e).percent}getValueTextParams(e){return{percent:Xm(e.value/100,this.#t)}}getAttrs(e){return{...super.getAttrs(e),"aria-valuetext":this.getValueText(e)}}},Qm={...Sm,availability:`data-availability`};d();var $m=g(null),eh=$m.Provider;function th(){let e=P($m);if(!e)throw Error(`AlertDialog compound components must be used within an AlertDialog.Root`);return e}var nh=Object.defineProperty,rh=(e,t)=>{let n={};for(var r in e)nh(n,r,{get:e[r],enumerable:!0});return t||nh(n,Symbol.toStringTag,{value:`Module`}),n};d();var ih=t(function({render:e,className:t,style:n,disabled:r,...i},a){let{dialog:o,state:s}=th(),l=c(()=>{r||o.close()},[o,r]);return X(`button`,{render:e,className:t,style:n},{state:s,ref:[a],props:[{type:`button`,disabled:r,onClick:l},i]})});d();function ah(e){let{displayName:n,tag:r,useContext:i,staticProps:a,getProps:o}=e,s=t(function(e,t){let{render:n,className:s,style:c,...l}=e,u=i(),d=o?.(u.state);return X(r,{render:n,className:s,style:c},{state:u.state,stateAttrMap:u.stateAttrMap,ref:t,props:[a,d,l].filter(Boolean)})});return s.displayName=n,s}var oh=ah({displayName:`AlertDialogDescription`,tag:`p`,useContext:th,getProps:e=>({id:e.descriptionId})});d();var sh=t(function({render:e,className:t,style:n,...r},i){let{core:a,dialog:o,state:s,stateAttrMap:l}=th(),u=tl(i,c(e=>{o.setElement(e)},[o]));return s.open?X(`div`,{render:e,className:t,style:n},{state:s,stateAttrMap:l,ref:u,props:[{tabIndex:-1,...a.getAttrs(s)},r]}):null});d();var ch=/[^a-zA-Z0-9_-]/g;function lh(e){let t=p().replace(ch,``);return e?`${e}-${t}`:t}d();function uh({open:t,defaultOpen:n=sp.defaultProps.defaultOpen,onOpenChange:r,onOpenChangeComplete:i,children:a}){let[o]=e(()=>new sp),s=t!==void 0,c=Y(r),l=Y(i),[u]=e(()=>{let e=Gd({transition:Of(),onOpenChange:e=>{c.current?.(e)},onOpenChangeComplete:e=>{l.current?.(e)}});return!s&&n&&e.open(),e}),d=lh(`alert-dialog-title`),f=lh(`alert-dialog-desc`);o.setTitleId(d),o.setDescriptionId(f),m(()=>{if(t===void 0)return;let{active:e}=u.input.current;t!==e&&(t?u.open():u.close())},[t,u]),Rf(u);let p=ol(u.input);return o.setInput(p),I(eh,{value:{core:o,dialog:u,state:o.getState(),stateAttrMap:cp},children:a})}var dh=ah({displayName:`AlertDialogTitle`,tag:`h2`,useContext:th,getProps:e=>({id:e.titleId})}),fh=rh({Close:()=>ih,Description:()=>oh,Popup:()=>sh,Root:()=>uh,Title:()=>dh});d();var ph=t(function(t,n){let{render:i,className:a,style:o,delay:s,...c}=t,l=ml(fd),[u]=e(()=>new lp);Rf(u),u.setProps({delay:s}),l&&u.update(l);let d=r(e=>u.state.subscribe(e),()=>u.state.current,()=>u.state.current);return l?X(`div`,{render:i,className:a,style:o},{state:d,stateAttrMap:up,ref:[n],props:[c]}):null});d();var mh=g(null),hh=mh.Provider;function gh(){let e=P(mh);if(!e)throw Error(`Controls compound components must be used within a Controls.Root`);return e}function _h(){return P(mh)}d();var vh=t(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{state:s,stateAttrMap:c}=gh(),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]})});d();var yh=t(function(t,n){let{render:r,className:i,style:a,children:o,...s}=t,c=ml(cd),[l]=e(()=>new dp);if(!c)return null;l.setMedia(c);let u=l.getState();return I(hh,{value:{state:u,stateAttrMap:fp},children:X(`div`,{render:r,className:i,style:a},{state:u,stateAttrMap:fp,ref:[n],props:[{children:o},s,{"data-interactive":``}]})})}),bh=rh({Group:()=>vh,Root:()=>yh});d();var xh=g(null),Sh=xh.Provider;function Ch(){let e=P(xh);if(!e)throw Error(`ErrorDialog compound components must be used within an ErrorDialog.Root`);return e}d();var wh=t(function({render:e,className:t,style:n,disabled:r,children:i,...a},o){let s=xc(),{dialog:l,state:u,stateAttrMap:d}=th(),f=c(()=>{r||l.close()},[l,r]),p=i??vc(kp(),s);return X(`button`,{render:e,className:t,style:n},{state:u,stateAttrMap:d,ref:o,props:[{type:`button`,disabled:r,onClick:f,children:p},a]})});d();var Th=t(function({render:e,className:t,style:n,children:r,...i},a){let o=xc(),{state:s,stateAttrMap:c}=th(),{lastError:l}=Ch(),u=Ap(l),d=r??vc(u,o);return X(`p`,{render:e,className:t,style:n},{state:s,stateAttrMap:c,ref:a,props:[{id:s.descriptionId,children:d},i]})});d();function Eh({children:t}){let[n]=e(()=>new pp),r=ml(ld),a=i(r?.error??null);r?.error&&(a.current=r.error);let o=Y(r),[s]=e(()=>Gd({transition:Of(),onOpenChange:e=>{e||o.current?.dismissError()}})),c=lh(`error-dialog-title`),l=lh(`error-dialog-desc`);n.setTitleId(c),n.setDescriptionId(l),m(()=>{let e=!!r?.error,{active:t}=s.input.current;e&&!t?s.open():!e&&t&&s.close()},[r?.error,s]),Rf(s);let u=ol(s.input);n.setInput(u);let d=n.getState();return r?I(Sh,{value:{lastError:a.current},children:I(eh,{value:{core:n,dialog:s,state:d,stateAttrMap:cp},children:t})}):null}d();var Dh=t(function({render:e,className:t,style:n,children:r,...i},a){let o=xc(),{state:s,stateAttrMap:c}=th(),l=r??vc(Op(),o);return X(`h2`,{render:e,className:t,style:n},{state:s,stateAttrMap:c,ref:a,props:[{id:s.titleId,children:l},i]})}),Oh=rh({Close:()=>wh,Description:()=>Th,Popup:()=>sh,Root:()=>Eh,Title:()=>Dh}),kh=ap({displayName:`FullscreenButton`,core:Pp,stateAttrMap:Fp,selector:ud,action:(e,t)=>e.toggle(t),hotkeyAction:`toggleFullscreen`,isSupported:e=>!e.hidden});d();function Ah({type:e,action:t,value:n,pointer:r,region:i,disabled:a}){let o=ml(),s=_l();return m(()=>{if(!s||!e||!t||a)return;let c=yd(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`?Td(s,l,u):wd(s,l,u)},[s,o,e,t,n,r,i,a]),null}var jh=Ah;d();function Mh(){let[,e]=j(e=>e+1,0);return e}d();function Nh(t){let n=Y(t),r=i(null),a=i(null),o=Mh(),[s]=e(()=>yf({getElement:()=>r.current,getThumbElement:()=>a.current,getOrientation:()=>n.current.orientation??`horizontal`,isRTL:()=>r.current?Cc(r.current):!1,isDisabled:()=>n.current.disabled??!1,getPercent:()=>n.current.getPercent(),getStepPercent:()=>n.current.getStepPercent(),getLargeStepPercent:()=>n.current.getLargeStepPercent(),changeThrottle:n.current.changeThrottle,adjustPercent:n.current.adjustPercent,onValueChange:e=>n.current.onValueChange?.(e),onValueCommit:e=>n.current.onValueCommit?.(e),onDragStart:()=>n.current.onDragStart?.(),onDragEnd:()=>n.current.onDragEnd?.()}));Rf(s);let l=ol(s.input),u=t.computeState(l);return A(()=>{u.thumbAlignment===`edge`&&r.current&&a.current&&o()},[u.thumbAlignment]),{state:u,cssVars:t.getCSSVars(s.adjustForAlignment(u)),rootRef:c(e=>{r.current=e},[]),thumbRef:c(e=>{a.current=e},[]),rootProps:s.rootProps,rootStyle:s.rootStyle,thumbProps:s.thumbProps}}d();function Ph({keys:e,action:t,value:n,disabled:r,target:i}){let a=ml(),o=_l();return m(()=>{if(!o||!e||!t||r)return;let s=Od(t);if(s)return Hd(o,{keys:e,action:t,value:n,target:i,disabled:r,repeatable:!Ed(t),onActivate:(e,t)=>{s({store:a,key:t,value:n})}})},[o,a,e,t,n,r,i]),null}var Fh=Ph;d();function Ih(t){let n=t.side,[r,i]=e({preferred:n,side:n}),a=t.open&&r.preferred===n?r.side:n,o=E(()=>a===n?t:{...t,side:a},[a,t,n]),s=c(e=>i(t=>t.preferred===n&&t.side===e?t:{preferred:n,side:e}),[n]);return m(()=>{t.open||s(n)},[t.open,n,s]),{state:o,preferredSide:n,setPositionedSide:s}}var Lh=ap({displayName:`MuteButton`,core:nm,stateAttrMap:im,selector:gd,action:(e,t)=>e.toggle(t),hotkeyAction:`toggleMuted`}),Rh=ap({displayName:`PiPButton`,core:cm,stateAttrMap:lm,selector:dd,action:(e,t)=>e.toggle(t),hotkeyAction:`togglePictureInPicture`,isSupported:e=>!e.hidden}),zh=ap({displayName:`PlayButton`,core:um,stateAttrMap:dm,selector:fd,action:(e,t)=>e.toggle(t),hotkeyAction:`togglePaused`}),Bh=ap({displayName:`PlaybackRateButton`,core:fm,stateAttrMap:pm,selector:pd,action:(e,t)=>e.cycle(t),hotkeyAction:`speedUp`});d();var Vh=g(null),Hh=Vh.Provider;function Uh(){let e=P(Vh);if(!e)throw Error(`Popover compound components must be used within a Popover.Root`);return e}var Wh=ah({displayName:`PopoverArrow`,tag:`div`,useContext:Uh,staticProps:{"aria-hidden":`true`}});d();var Gh={position:`fixed`,inset:`auto`,margin:0},Kh=t(function({render:t,className:n,style:r,...a},o){let{core:s,popover:l,state:u,preferredSide:d,setPositionedSide:f,stateAttrMap:p,anchorName:m,popupId:h,boundary:g,container:_}=Uh(),v=i(null),y=tl(o,c(e=>{l.setPopupElement(e),e&&Dc()&&e.style.setProperty(`position-anchor`,`--${m}`)},[l,m]),v),b=E(()=>({side:d,align:u.align}),[d,u.align]),x=E(()=>{if(!Dc())return null;let{positionAnchor:e,...t}=df(m,b);return t},[m,b]),[S,C]=e(null);A(()=>{if(!u.open){C(null);return}function e(){let e=l.triggerElement,t=v.current;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getRootNode(),i=tf(g,{container:_,root:r}),a=gf(t,b.side),o=ef(i),s=hf(t),c=Bc(n,a,o,b,s),{positionAnchor:u,...d}=df(m,{...b,side:c},n,Dc()?void 0:a,o,s);C(d),f(c)}e();let t=l.triggerElement,n=v.current,r=n?tf(g,{container:_,root:n.getRootNode()}):null,i=0;function a(t){t&&Nf(t,v.current)||(cancelAnimationFrame(i),i=requestAnimationFrame(e))}a();let o=typeof ResizeObserver==`function`?new ResizeObserver(()=>{a()}):null;return t&&o&&o.observe(t),n&&o&&o.observe(n),r&&o&&o.observe(r),window.addEventListener(`scroll`,a,{capture:!0,passive:!0}),window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(i),o?.disconnect(),window.removeEventListener(`scroll`,a,!0),window.removeEventListener(`resize`,a)}},[u.open,m,b,l,g,_,f]);let w=S??x??Gh;if(!u.open)return null;let{onFocusOut:T,...D}=l.popupProps;return X(`div`,{render:t,className:n,style:r},{state:u,stateAttrMap:p,ref:y,props:[{id:h,style:w,...s.getPopupAttrs(u)},{...D,onBlur:T},a]})});d();function qh({open:t,defaultOpen:n=mm.defaultProps.defaultOpen,onOpenChange:r,onOpenChangeComplete:i,openOnHover:a=mm.defaultProps.openOnHover,delay:o=mm.defaultProps.delay,closeDelay:s=mm.defaultProps.closeDelay,boundary:c=`container`,children:l,...u}){let d=vl(),f=yl(),p=_h(),[h]=e(()=>new mm(u));h.setProps(u);let g=!q(t),_=Y(r),v=Y(i),y=Y(u.closeOnEscape),b=Y(u.closeOnOutsideClick),x=Y(a),S=Y(o),C=Y(s),w=Y(f),[T]=e(()=>{let e=Zd({transition:Of(),onOpenChange:(e,t)=>{_.current?.(e,t)},onOpenChangeComplete:e=>{v.current?.(e)},closeOnEscape:()=>y.current??mm.defaultProps.closeOnEscape,closeOnOutsideClick:()=>b.current??mm.defaultProps.closeOnOutsideClick,openOnHover:()=>x.current,delay:()=>S.current,closeDelay:()=>C.current,group:()=>w.current});return!g&&n&&e.open(`click`),e}),E=lh(),D=lh(`popup`);m(()=>{if(q(t))return;let{active:e}=T.input.current;t!==e&&(t?T.open(`click`):T.close(`click`))},[t,T]),m(()=>{q(p?.state.visible)||p.state.visible||T.close(`imperative-action`)},[p?.state.visible,T]),Rf(T);let O=ol(T.input);h.setInput(O);let{state:k,preferredSide:A,setPositionedSide:j}=Ih(h.getState());return I(Hh,{value:{core:h,popover:T,state:k,preferredSide:A,setPositionedSide:j,stateAttrMap:hm,anchorName:E,popupId:D,boundary:c,container:d},children:l})}d();var Jh=t(function({render:e,className:t,style:n,...r},i){let{core:a,popover:o,state:s,stateAttrMap:l,anchorName:u,popupId:d}=Uh(),f=c(e=>{o.setTriggerElement(e),e&&Dc()&&e.style.setProperty(`anchor-name`,`--${u}`)},[o,u]),{onFocusIn:p,onFocusOut:m,...h}=o.triggerProps;return X(`button`,{render:e,className:t,style:n},{state:s,stateAttrMap:l,ref:[i,f],props:[{type:`button`,...a.getTriggerAttrs(s,d)},{...h,onFocus:p,onBlur:m},r]})}),Yh=rh({Arrow:()=>Wh,Popup:()=>Kh,Root:()=>qh,Trigger:()=>Jh}),Xh=ap({displayName:`SeekButton`,core:ym,stateAttrMap:bm,selector:hd,action:(e,t)=>e.seek(t),hotkeyAction:`seekStep`,hotkeyValue:e=>typeof e.seconds==`number`?e.seconds:ym.defaultProps.seconds});d();var Zh=t(function(t,n){let{render:r,className:a,style:o,time:s=0,thumbnails:c,crossOrigin:l,loading:u,fetchPriority:d,...f}=t,[p]=e(()=>new wf),m=i(null),h=i(null),g=hl(md),[,_]=e(0),[v]=e(()=>Tf({getContainer:()=>m.current,getImg:()=>h.current,onStateChange:()=>_(e=>e+1)}));Rf(v,()=>v.connect());let y=E(()=>c&&c.length>0?c:g&&g.thumbnailCues.length>0?Tm(g.thumbnailCues,g.thumbnailTrackSrc??void 0):[],[c,g]),b=E(()=>p.findActiveThumbnail(y,s),[p,y,s]);v.updateSrc(b?.url);let x=p.getState(v.loading,v.error,b),S={overflow:`hidden`},C;if(b&&v.naturalWidth&&v.naturalHeight){let e=v.readConstraints(),t=p.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:r,className:a,style:o},{state:x,stateAttrMap:Cm,ref:[n,m],props:[p.getAttrs(x),{style:S},f,{children:I(`img`,{ref:h,alt:``,"aria-hidden":`true`,decoding:`async`,src:b?.url,crossOrigin:l===``||l===null?void 0:l,loading:u,style:C,fetchPriority:d})}]})});d();var Qh=g(null);function $h({value:e,children:t}){return I(Qh.Provider,{value:e,children:t})}function eg(){let e=P(Qh);if(!e)throw Error(`Slider compound components must be used within a Slider.Root`);return e}var tg=ah({displayName:`SliderBuffer`,tag:`div`,useContext:eg}),ng=ah({displayName:`SliderFill`,tag:`div`,useContext:eg});d();var rg=t(function(t,n){let{render:r,className:a,style:o,overflow:s=`clamp`,...c}=t,l=eg(),{state:u}=l,d=i(null),[f,p]=e(0);m(()=>{let e=d.current;if(!e)return;let t=new ResizeObserver(([e])=>{p(e.contentRect.width)});return t.observe(e),()=>t.disconnect()},[]);let h=Cf(f,s);return X(`div`,{render:r,className:a,style:o},{state:u,stateAttrMap:l.stateAttrMap,ref:[n,d],props:[{style:h},c]})});d();var ig=t(function(t,n){let{render:r,className:i,style:a,label:o,min:s,max:c,step:l,largeStep:u,orientation:d,disabled:f,thumbAlignment:p,value:m=0,onValueChange:h,onValueCommit:g,onDragStart:_,onDragEnd:v,...y}=t,[b]=e(()=>new xm),x=xc();b.setProps({label:o,min:s,max:c,step:l,largeStep:u,orientation:d,disabled:f,thumbAlignment:p});let{state:S,cssVars:C,rootRef:w,thumbRef:T,rootProps:E,rootStyle:D,thumbProps:O}=Nh({computeState:e=>(b.setInput(e),b.getSliderState(m)),getPercent:()=>b.percentFromValue(m),getStepPercent:()=>b.getStepPercent(),getLargeStepPercent:()=>b.getLargeStepPercent(),orientation:d,disabled:f,adjustPercent:(e,t,n)=>b.adjustPercentForAlignment(e,t,n),getCSSVars:xf,onValueChange:e=>h?.(b.valueFromPercent(e)),onValueCommit:e=>g?.(b.valueFromPercent(e)),onDragStart:_,onDragEnd:v});return I($h,{value:{state:S,pointerValue:b.valueFromPercent(S.pointerPercent),thumbRef:T,thumbProps:O,stateAttrMap:Sm,getAttrs:e=>{let t=b.getAttrs(e);return{...t,"aria-label":vc(t[`aria-label`],x)}},formatValue:void 0},children:X(`div`,{render:r,className:i,style:a},{state:S,stateAttrMap:Sm,ref:[n,w],props:[{style:{...C,...D}},E,y]})})});d();var ag=t(function(e,t){let{render:n,className:r,style:i,...a}=e,o=eg(),{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]})});d();var og=t(function(e,t){let{pointerValue:n}=eg();return I(Zh,{ref:t,...e,time:n})}),sg=ah({displayName:`SliderTrack`,tag:`div`,useContext:eg});d();var cg=t(function(e,t){let{render:n,className:r,style:i,type:a=`current`,format:o,...s}=e,c=eg(),{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]})}),lg=rh({Buffer:()=>tg,Fill:()=>ng,Preview:()=>rg,Root:()=>ig,Thumb:()=>ag,Thumbnail:()=>og,Track:()=>sg,Value:()=>cg});d();var ug=t(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]})});d();var dg=t(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]})});d(),M();var fg=t(function(t,n){let{render:r,className:i,style:a,type:o,negativeSign:s,label:c,toggle:l=!1,...u}=t,d=ml(hd),f=xc(),p=Sc(),[h]=e(()=>new Lm),g=o??Lm.defaultProps.type,[v,y]=e(g);if(m(()=>{y(g)},[g,l]),h.setProps({type:v,negativeSign:s,label:c,toggle:l}),!d)return null;h.setMedia(d);let b=h.getState(),x=h.getAttrs(b,g),S=h.getLabelParams(b)?{duration:b.type===`remaining`?vc(Am,f,{duration:Yp(Math.abs(b.seconds),{locale:p})}):Yp(Math.abs(b.seconds),{locale:p})}:void 0,C=b.negative?I(_,{children:[I(`span`,{"aria-hidden":`true`,children:s??Lm.defaultProps.negativeSign}),b.text]}):b.text,w=()=>{y(e=>g===`current`?e===`remaining`?`current`:`remaining`:e===`duration`?`remaining`:`duration`)},T=e=>{e.defaultPrevented||w()},E=e=>{!e.defaultPrevented&&Fc(e.nativeEvent)&&(e.preventDefault(),!e.repeat&&w())};return X(`time`,{render:r,className:i,style:a},{state:b,stateAttrMap:Rm,ref:[n],props:[{dateTime:b.datetime,children:C,...x,"aria-label":vc(x[`aria-label`],f,S),...l?{onClick:T,onKeyDown:E}:void 0},u]})}),pg=rh({Group:()=>ug,Separator:()=>dg,Value:()=>fg});d();var mg=()=>Promise.resolve(0),hg=t(function(t,n){let{render:r,className:i,style:a,label:o,changeThrottle:s=Bm.defaultProps.changeThrottle,step:c=Bm.defaultProps.step,largeStep:l=Bm.defaultProps.largeStep,orientation:u,disabled:d,thumbAlignment:f,onDragStart:p,onDragEnd:h,pauseOnDrag:g,..._}=t,v=ml(hd),y=ml(sd),b=ml(fd),x=xc(),S=Sc(),[C]=e(()=>new Bm);C.setProps({label:o,step:c,largeStep:l,orientation:u,disabled:d,thumbAlignment:f,pauseOnDrag:g,changeThrottle:s}),C.setFormatLocale(S);let w=Y(v&&y?{...v,...y}:null),T=Y(b);m(()=>()=>C.endDrag(T.current),[C]);let E=v?.duration??0,{state:D,cssVars:O,rootRef:k,thumbRef:A,rootProps:j,rootStyle:M,thumbProps:N}=Nh({computeState:e=>(C.setInput(e),!v||!y?C.setMedia({currentTime:0,duration:0,seeking:!1,seek:mg,buffered:[],seekable:[]}):C.setMedia({...v,...y}),C.getState()),getPercent:()=>E>0?(v?.currentTime??0)/E*100:0,getStepPercent:()=>C.getStepPercent(),getLargeStepPercent:()=>C.getLargeStepPercent(),orientation:u,disabled:d,changeThrottle:s,adjustPercent:(e,t,n)=>C.adjustPercentForAlignment(e,t,n),getCSSVars:Sf,onValueCommit:e=>{let t=w.current;t&&t.seek(C.rawValueFromPercent(e))},onDragStart:()=>{C.startDrag(T.current),p?.()},onDragEnd:()=>{C.endDrag(T.current),h?.()}});return v?I($h,{value:{state:D,pointerValue:C.valueFromPercent(D.pointerPercent),thumbRef:A,thumbProps:N,stateAttrMap:Vm,getAttrs:e=>{let t=C.getAttrs(e);return{...t,"aria-label":vc(t[`aria-label`],x),"aria-valuetext":vc(t[`aria-valuetext`],x,C.getValueTextParams(e))}},formatValue:e=>qp(e,E)},children:X(`div`,{render:r,className:i,style:a},{state:D,stateAttrMap:Vm,ref:[n,k],props:[{style:{...O,...M}},j,_]})}):null}),gg=rh({Buffer:()=>tg,Fill:()=>ng,Preview:()=>rg,Root:()=>hg,Thumb:()=>ag,Track:()=>sg,Value:()=>cg}),_g=ah({displayName:`TooltipArrow`,tag:`div`,useContext:np,staticProps:{"aria-hidden":`true`}});d();var vg=t(function({render:e,className:t,style:n,children:r,...i},a){let{state:o,stateAttrMap:s,content:c}=np(),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}]})});d();var yg=t(function({render:e,className:t,style:n,children:r,...i},a){let{state:o,stateAttrMap:s,content:c}=np(),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});d(),M();var bg={position:`fixed`,inset:`auto`,margin:0},xg=t(function({render:t,className:n,style:r,children:a,...o},s){let{core:l,tooltip:u,state:d,preferredSide:f,setPositionedSide:p,stateAttrMap:m,anchorName:h,popupId:g,boundary:v,container:y}=np(),b=i(null),x=tl(s,c(e=>{u.setPopupElement(e),e&&Dc()&&e.style.setProperty(`position-anchor`,`--${h}`)},[u,h]),b),S=E(()=>({side:f,align:d.align}),[f,d.align]),C=E(()=>{if(!Dc())return null;let{positionAnchor:e,...t}=df(h,S,void 0,void 0,void 0,void 0,Um);return t},[h,S]),[w,T]=e(null);A(()=>{if(!d.open){T(null);return}function e(){let e=u.triggerElement,t=b.current;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getRootNode(),i=tf(v,{container:y,root:r}),a=gf(t,S.side),o=ef(i),s=hf(t,Um),c=Bc(n,a,o,S,s),{positionAnchor:l,...d}=df(h,{...S,side:c},n,Dc()?void 0:a,o,s,Um);T(d),p(c)}e();let t=u.triggerElement,n=b.current,r=n?tf(v,{container:y,root:n.getRootNode()}):null,i=0;function a(t){t&&Nf(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)}},[d.open,h,S,u,v,y,p]);let D=w??C??bg;if(!d.open)return null;let O=a===void 0?I(_,{children:[I(vg,{}),I(yg,{})]}):a,{onFocusOut:k,...j}=u.popupProps;return X(`div`,{render:t,className:n,style:r},{state:d,stateAttrMap:m,ref:x,props:[{id:g,style:D,...l.getPopupAttrs(d)},{children:O},{...j,onBlur:k},o]})});d();var Sg=g(null),Cg=Sg.Provider;function wg(){return P(Sg)?.group}d();function Tg({delay:t,closeDelay:n,timeout:r,children:i}){let[a]=e(()=>new Gm({delay:t,closeDelay:n,timeout:r}));return a.setProps({delay:t,closeDelay:n,timeout:r}),I(Cg,{value:{group:a},children:i})}d();function Eg({open:t,defaultOpen:n=Hm.defaultProps.defaultOpen,onOpenChange:r,onOpenChangeComplete:i,delay:a=Hm.defaultProps.delay,closeDelay:o=Hm.defaultProps.closeDelay,disableHoverablePopup:s=Hm.defaultProps.disableHoverablePopup,disabled:c=Hm.defaultProps.disabled,boundary:l=`container`,children:u,...d}){let f=vl(),p=_h(),[h]=e(()=>new Hm(d));h.setProps(d);let g=!q(t),_=wg(),v=Y(r),y=Y(i),b=Y(a),x=Y(o),S=Y(s),C=Y(c),w=Y(_),[T]=e(()=>{let e=Df({transition:Of(),onOpenChange:(e,t)=>{v.current?.(e,t)},onOpenChangeComplete:e=>{y.current?.(e)},delay:()=>b.current,closeDelay:()=>x.current,disableHoverablePopup:()=>S.current,disabled:()=>C.current,group:()=>w.current});return!g&&n&&e.open(),e}),[E,D]=e(),O=lh(),k=lh(`tooltip`);m(()=>{if(q(t))return;let{active:e}=T.input.current;t!==e&&(t?T.open():T.close())},[t,T]),m(()=>{q(p?.state.visible)||p.state.visible||T.close(`imperative-action`)},[p?.state.visible,T]),Rf(T);let A=ol(T.input);h.setInput(A);let{state:j,preferredSide:M,setPositionedSide:N}=Ih(h.getState());return I(tp,{value:{core:h,tooltip:T,state:j,preferredSide:M,setPositionedSide:N,stateAttrMap:Wm,anchorName:O,popupId:k,content:E,setContent:D,boundary:l,container:f},children:u})}d();var Dg=t(function({render:e,className:t,style:n,...r},i){let{tooltip:a,state:o,stateAttrMap:s,anchorName:l}=np(),u=c(e=>{a.setTriggerElement(e),e&&Dc()&&e.style.setProperty(`anchor-name`,`--${l}`)},[a,l]),{onFocusIn:d,onFocusOut:f,...p}=a.triggerProps;return X(`button`,{render:e,className:t,style:n},{state:o,stateAttrMap:s,ref:[i,u],props:[{type:`button`},{...p,onFocus:d,onBlur:f},r]})}),Og=rh({Arrow:()=>_g,Label:()=>vg,Popup:()=>xg,Provider:()=>Tg,Root:()=>Eg,Shortcut:()=>yg,Trigger:()=>Dg});d();var kg={volume:0,muted:!1,volumeAvailability:`unsupported`,setVolume:()=>0,toggleMuted:()=>!1},Ag=t(function(t,n){let{render:r,className:a,style:o,label:s,orientation:l,step:u=Zm.defaultProps.step,largeStep:d=Zm.defaultProps.largeStep,wheelStep:f=Zm.defaultProps.wheelStep,disabled:p,thumbAlignment:m,onDragStart:h,onDragEnd:g,..._}=t,v=ml(gd),y=xc(),b=Sc(),[x]=e(()=>new Zm);x.setProps({label:s,orientation:l,step:u,largeStep:d,wheelStep:f,disabled:p,thumbAlignment:m}),x.setFormatLocale(b);let S=Y(v),C=Y(p),w=()=>(S.current?.volume??0)*100,T=()=>x.getStepPercent(),E=e=>S.current?.setVolume(e/100),{state:D,cssVars:O,rootRef:k,thumbRef:A,rootProps:j,rootStyle:M,thumbProps:N}=Nh({computeState:e=>(x.setInput(e),x.setMedia(v??kg),x.getState()),getPercent:w,getStepPercent:T,getLargeStepPercent:()=>x.getLargeStepPercent(),orientation:l,disabled:p,adjustPercent:(e,t,n)=>x.adjustPercentForAlignment(e,t,n),getCSSVars:xf,onValueChange:E,onValueCommit:E,onDragStart:h,onDragEnd:g}),[P]=e(()=>Mf({isDisabled:()=>!!C.current||!S.current,getPercent:()=>(S.current?.volume??0)*100,getStepPercent:()=>x.getWheelStepPercent(),onValueChange:e=>S.current?.setVolume(e/100)})),F=i(null),ee=c(e=>{F.current?.(),F.current=null,e&&(F.current=J(e,`wheel`,P.onWheel,{passive:!1}))},[P]);return v?I($h,{value:{state:D,pointerValue:x.valueFromPercent(D.pointerPercent),thumbRef:A,thumbProps:N,stateAttrMap:Qm,getAttrs:e=>{let t=x.getAttrs(e);return{...t,"aria-label":vc(t[`aria-label`],y),"aria-valuetext":vc(t[`aria-valuetext`],y,x.getValueTextParams(e))}},formatValue:e=>`${Math.round(e)}%`},children:X(`div`,{render:r,className:a,style:o},{state:D,stateAttrMap:Qm,ref:[n,k,ee],props:[{style:{...O,...M}},j,_]})}):null}),jg=rh({Fill:()=>ng,Preview:()=>rg,Root:()=>Ag,Thumb:()=>ag,Track:()=>sg,Value:()=>cg}),Mg=F(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Ng=F(((e,t)=>{var n=Mg();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}})),Pg=F(((e,t)=>{t.exports=Ng()()}));d();var Z=T(Pg());function Fg(){return Fg=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Fg.apply(this,arguments)}function Ig(e,t){if(e==null)return{};var n=Lg(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Lg(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Rg=t(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,o=i===void 0?24:i,s=Ig(e,[`color`,`size`]);return a.createElement(`svg`,Fg({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),a.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`}),a.createElement(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),a.createElement(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`}))});Rg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Rg.displayName=`AlertTriangle`,d();function zg(){return zg=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},zg.apply(this,arguments)}function Bg(e,t){if(e==null)return{};var n=Vg(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Vg(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Hg=t(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,o=i===void 0?24:i,s=Bg(e,[`color`,`size`]);return a.createElement(`svg`,zg({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),a.createElement(`polyline`,{points:`20 6 9 17 4 12`}))});Hg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Hg.displayName=`Check`,d();function Ug(){return Ug=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ug.apply(this,arguments)}function Wg(e,t){if(e==null)return{};var n=Gg(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Gg(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Kg=t(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,o=i===void 0?24:i,s=Wg(e,[`color`,`size`]);return a.createElement(`svg`,Ug({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),a.createElement(`polyline`,{points:`15 18 9 12 15 6`}))});Kg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Kg.displayName=`ChevronLeft`,d();function qg(){return qg=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},qg.apply(this,arguments)}function Jg(e,t){if(e==null)return{};var n=Yg(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Yg(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Xg=t(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,o=i===void 0?24:i,s=Jg(e,[`color`,`size`]);return a.createElement(`svg`,qg({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),a.createElement(`polyline`,{points:`9 18 15 12 9 6`}))});Xg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Xg.displayName=`ChevronRight`,d();function Zg(){return Zg=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Zg.apply(this,arguments)}function Qg(e,t){if(e==null)return{};var n=$g(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function $g(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var e_=t(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,o=i===void 0?24:i,s=Qg(e,[`color`,`size`]);return a.createElement(`svg`,Zg({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),a.createElement(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),a.createElement(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`}))});e_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},e_.displayName=`Copy`,d();function t_(){return t_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},t_.apply(this,arguments)}function n_(e,t){if(e==null)return{};var n=r_(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function r_(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var i_=t(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,o=i===void 0?24:i,s=n_(e,[`color`,`size`]);return a.createElement(`svg`,t_({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),a.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`}))});i_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},i_.displayName=`Maximize`,d();function a_(){return a_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a_.apply(this,arguments)}function o_(e,t){if(e==null)return{};var n=s_(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function s_(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var c_=t(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,o=i===void 0?24:i,s=o_(e,[`color`,`size`]);return a.createElement(`svg`,a_({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),a.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`}))});c_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},c_.displayName=`Minimize`,d();function l_(){return l_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l_.apply(this,arguments)}function u_(e,t){if(e==null)return{};var n=d_(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function d_(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var f_=t(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,o=i===void 0?24:i,s=u_(e,[`color`,`size`]);return a.createElement(`svg`,l_({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),a.createElement(`rect`,{x:`6`,y:`4`,width:`4`,height:`16`}),a.createElement(`rect`,{x:`14`,y:`4`,width:`4`,height:`16`}))});f_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},f_.displayName=`Pause`,d();function p_(){return p_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},p_.apply(this,arguments)}function m_(e,t){if(e==null)return{};var n=h_(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function h_(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var g_=t(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,o=i===void 0?24:i,s=m_(e,[`color`,`size`]);return a.createElement(`svg`,p_({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),a.createElement(`polygon`,{points:`5 3 19 12 5 21 5 3`}))});g_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},g_.displayName=`Play`,d();function __(){return __=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},__.apply(this,arguments)}function v_(e,t){if(e==null)return{};var n=y_(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function y_(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var b_=t(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,o=i===void 0?24:i,s=v_(e,[`color`,`size`]);return a.createElement(`svg`,__({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),a.createElement(`polyline`,{points:`1 4 1 10 7 10`}),a.createElement(`path`,{d:`M3.51 15a9 9 0 1 0 2.13-9.36L1 10`}))});b_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},b_.displayName=`RotateCcw`,d();function x_(){return x_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},x_.apply(this,arguments)}function S_(e,t){if(e==null)return{};var n=C_(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function C_(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var w_=t(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,o=i===void 0?24:i,s=S_(e,[`color`,`size`]);return a.createElement(`svg`,x_({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),a.createElement(`circle`,{cx:`12`,cy:`12`,r:`3`}),a.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`}))});w_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},w_.displayName=`Settings`,d();function T_(){return T_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},T_.apply(this,arguments)}function E_(e,t){if(e==null)return{};var n=D_(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function D_(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var O_=t(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,o=i===void 0?24:i,s=E_(e,[`color`,`size`]);return a.createElement(`svg`,T_({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),a.createElement(`polygon`,{points:`11 5 6 9 2 9 2 15 6 15 11 19 11 5`}),a.createElement(`path`,{d:`M15.54 8.46a5 5 0 0 1 0 7.07`}))});O_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},O_.displayName=`Volume1`,d();function k_(){return k_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},k_.apply(this,arguments)}function A_(e,t){if(e==null)return{};var n=j_(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function j_(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var M_=t(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,o=i===void 0?24:i,s=A_(e,[`color`,`size`]);return a.createElement(`svg`,k_({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),a.createElement(`polygon`,{points:`11 5 6 9 2 9 2 15 6 15 11 19 11 5`}),a.createElement(`path`,{d:`M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07`}))});M_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},M_.displayName=`Volume2`,d();function N_(){return N_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},N_.apply(this,arguments)}function P_(e,t){if(e==null)return{};var n=F_(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function F_(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var I_=t(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,o=i===void 0?24:i,s=P_(e,[`color`,`size`]);return a.createElement(`svg`,N_({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),a.createElement(`polygon`,{points:`11 5 6 9 2 9 2 15 6 15 11 19 11 5`}),a.createElement(`line`,{x1:`23`,y1:`9`,x2:`17`,y2:`15`}),a.createElement(`line`,{x1:`17`,y1:`9`,x2:`23`,y2:`15`}))});I_.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},I_.displayName=`VolumeX`;var L_=F(((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})()}));te(),d();var R_=T(L_(),1),z_=`react-tooltip-core-styles`,B_=`react-tooltip-base-styles`,V_={core:!1,base:!1};function H_({css:e,id:t=B_,type:n=`base`,ref:r}){if(!e||typeof document>`u`||V_[n]||n===`core`&&ie!==void 0&&(ie==null?void 0:{})?.REACT_TOOLTIP_DISABLE_CORE_STYLES||n!==`base`&&ie!==void 0&&(ie==null?void 0:{})?.REACT_TOOLTIP_DISABLE_BASE_STYLES)return;n===`core`&&(t=z_),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)),V_[n]=!0}var U_=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r=`top`,offset:i=10,strategy:a=`absolute`,middlewares:o=[ee(Number(i)),h({fallbackAxisSideDirection:`start`}),L({padding:5})],border:s,arrowSize:c=8})=>{if(!e||t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};let l=o;return n?(l.push(w({element:n,padding:5})),x(e,t,{placement:r,strategy:a,middleware:l}).then((({x:e,y:t,placement:n,middlewareData:r})=>{let i={left:`${e}px`,top:`${t}px`,border:s},{x:a,y:o}=r.arrow??{x:0,y:0},l={top:`bottom`,right:`left`,bottom:`top`,left:`right`}[n.split(`-`)[0]]??`bottom`,u=s&&{borderBottom:s,borderRight:s},d=0;if(s){let e=`${s}`.match(/(\d+)px/);d=e?.[1]?Number(e[1]):1}return{tooltipStyles:i,tooltipArrowStyles:{left:a==null?``:`${a}px`,top:o==null?``:`${o}px`,right:``,bottom:``,...u,[l]:`-${c/2+d-1}px`},place:n}}))):x(e,t,{placement:`bottom`,strategy:a,middleware:l}).then((({x:e,y:t,placement:n})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:n})))},W_=(e,t)=>!(`CSS`in window&&`supports`in window.CSS)||window.CSS.supports(e,t),G_=(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},K_=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(!K_(e)||!K_(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])))},J_=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`}))},Y_=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(J_(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},X_=typeof window<`u`?A:m,Z_=e=>{e.current&&=(clearTimeout(e.current),null)},Q_=`DEFAULT_TOOLTIP_ID`,$_={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},ev=g({getTooltipData:()=>$_});function tv(e=Q_){return P(ev).getTooltipData(e)}var nv={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`},rv={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`},iv=({forwardRef:t,id:n,className:r,classNameArrow:o,variant:s=`dark`,anchorId:l,anchorSelect:u,place:d=`top`,offset:p=10,events:h=[`hover`],openOnClick:g=!1,positionStrategy:_=`absolute`,middlewares:v,wrapper:y,delayShow:b=0,delayHide:x=0,float:C=!1,hidden:w=!1,noArrow:T=!1,clickable:E=!1,closeOnEsc:D=!1,closeOnScroll:O=!1,closeOnResize:k=!1,openEvents:A,closeEvents:j,globalCloseEvents:M,imperativeModeOnly:N,style:P,position:F,afterShow:ee,afterHide:I,disableTooltip:L,content:te,contentWrapperRef:ne,isOpen:re,defaultIsOpen:ie=!1,setIsOpen:ae,previousActiveAnchor:oe,activeAnchor:R,setActiveAnchor:z,border:se,opacity:ce,arrowColor:le,arrowSize:ue=8,role:de=`tooltip`})=>{let B=i(null),fe=i(null),pe=i(null),me=i(null),he=i(null),[ge,V]=e({tooltipStyles:{},tooltipArrowStyles:{},place:d}),[H,U]=e(!1),[_e,ve]=e(!1),[ye,be]=e(null),xe=i(!1),Se=i(null),{anchorRefs:Ce,setActiveAnchor:we}=tv(n),Te=i(!1),[Ee,De]=e([]),Oe=i(!1),ke=g||h.includes(`click`),Ae=ke||A?.click||A?.dblclick||A?.mousedown,je=A?{...A}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!A&&ke&&Object.assign(je,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});let Me=j?{...j}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!j&&ke&&Object.assign(Me,{mouseleave:!1,blur:!1,mouseout:!1});let Ne=M?{...M}:{escape:D||!1,scroll:O||!1,resize:k||!1,clickOutsideAnchor:Ae||!1};N&&(Object.assign(je,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(Me,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(Ne,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),X_((()=>(Oe.current=!0,()=>{Oe.current=!1})),[]);let Pe=e=>{Oe.current&&(e&&ve(!0),setTimeout((()=>{Oe.current&&(ae?.(e),re===void 0&&U(e))}),10))};m((()=>{if(n){if(H){t(oe);let r=e(R),i=[...new Set([...r,n])].filter(Boolean).join(` `);R?.setAttribute(`aria-describedby`,i)}else t(R);return()=>{t(R),t(oe)}}function e(e){return(e?.getAttribute(`aria-describedby`))?.split(` `)||[]}function t(t){let r=e(t).filter((e=>e!==n));r.length?t?.setAttribute(`aria-describedby`,r.join(` `)):t?.removeAttribute(`aria-describedby`)}}),[R,H,n,oe]),m((()=>{if(re===void 0)return()=>null;re&&ve(!0);let e=setTimeout((()=>{U(re)}),10);return()=>{clearTimeout(e)}}),[re]),m((()=>{if(H!==xe.current){if(Z_(he),xe.current=H,H)ee?.();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((()=>{ve(!1),be(null),I?.()}),e+25)}}}),[H]);let Fe=e=>{V((t=>q_(t,e)?t:e))},Ie=(e=b)=>{Z_(pe),_e?Pe(!0):pe.current=setTimeout((()=>{Pe(!0)}),e)},Le=(e=x)=>{Z_(me),me.current=setTimeout((()=>{Te.current||Pe(!1)}),e)},Re=e=>{if(!e)return;let t=e.currentTarget??e.target;if(!t?.isConnected)return z(null),void we({current:null});b?Ie():Pe(!0),z(t),we({current:t}),Z_(me)},ze=()=>{E?Le(x||100):x?Le():Pe(!1),Z_(pe)},Be=({x:e,y:t})=>{U_({place:ye?.place??d,offset:p,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:_,middlewares:v,border:se,arrowSize:ue}).then((e=>{Fe(e)}))},Ve=e=>{if(!e)return;let t=e,n={x:t.clientX,y:t.clientY};Be(n),Se.current=n},He=e=>{if(!H)return;let t=e.target;t.isConnected&&(B.current?.contains(t)||[document.querySelector(`[id='${l}']`),...Ee].some((e=>e?.contains(t)))||(Pe(!1),Z_(pe)))},Ue=G_(Re,50,!0),We=G_(ze,50,!0),Ge=e=>{We.cancel(),Ue(e)},W=()=>{Ue.cancel(),We()},Ke=c((()=>{let e=ye?.position??F;e?Be(e):C?Se.current&&Be(Se.current):R!=null&&R.isConnected&&U_({place:ye?.place??d,offset:p,elementReference:R,tooltipReference:B.current,tooltipArrowReference:fe.current,strategy:_,middlewares:v,border:se,arrowSize:ue}).then((e=>{Oe.current&&Fe(e)}))}),[H,R,te,P,d,ye?.place,p,_,F,ye?.position,C,ue]);m((()=>{var e,t;let n=new Set(Ce);Ee.forEach((e=>{L!=null&&L(e)||n.add({current:e})}));let r=document.querySelector(`[id='${l}']`);r&&!(L!=null&&L(r))&&n.add({current:r});let i=()=>{Pe(!1)},a=Y_(R),o=Y_(B.current);Ne.scroll&&(window.addEventListener(`scroll`,i),a?.addEventListener(`scroll`,i),o?.addEventListener(`scroll`,i));let s=null;Ne.resize?window.addEventListener(`resize`,i):R&&B.current&&(s=S(R,B.current,Ke,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));let c=e=>{e.key===`Escape`&&Pe(!1)};Ne.escape&&window.addEventListener(`keydown`,c),Ne.clickOutsideAnchor&&window.addEventListener(`click`,He);let u=[],d=e=>!!(e?.target&&R?.contains(e.target)),f=e=>{H&&d(e)||Re(e)},p=e=>{H&&d(e)&&ze()},m=[`mouseover`,`mouseout`,`mouseenter`,`mouseleave`,`focus`,`blur`],h=[`click`,`dblclick`,`mousedown`,`mouseup`];Object.entries(je).forEach((([e,t])=>{t&&(m.includes(e)?u.push({event:e,listener:Ge}):h.includes(e)&&u.push({event:e,listener:f}))})),Object.entries(Me).forEach((([e,t])=>{t&&(m.includes(e)?u.push({event:e,listener:W}):h.includes(e)&&u.push({event:e,listener:p}))})),C&&u.push({event:`pointermove`,listener:Ve});let g=()=>{Te.current=!0},_=()=>{Te.current=!1,ze()},v=E&&(Me.mouseout||Me.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;Ne.scroll&&(window.removeEventListener(`scroll`,i),a?.removeEventListener(`scroll`,i),o?.removeEventListener(`scroll`,i)),Ne.resize?window.removeEventListener(`resize`,i):s?.(),Ne.clickOutsideAnchor&&window.removeEventListener(`click`,He),Ne.escape&&window.removeEventListener(`keydown`,c),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)}))}))}}),[R,Ke,_e,Ce,Ee,A,j,M,ke,b,x]),m((()=>{let e=ye?.anchorSelect??u??``;!e&&n&&(e=`[data-tooltip-id='${n.replace(/'/g,`\\'`)}']`);let t=new MutationObserver((t=>{let r=[],i=[];t.forEach((t=>{if(t.type===`attributes`&&t.attributeName===`data-tooltip-id`&&(t.target.getAttribute(`data-tooltip-id`)===n?r.push(t.target):t.oldValue===n&&i.push(t.target)),t.type===`childList`){if(R){let n=[...t.removedNodes].filter((e=>e.nodeType===1));if(e)try{i.push(...n.filter((t=>t.matches(e)))),i.push(...n.flatMap((t=>[...t.querySelectorAll(e)])))}catch{}n.some((e=>!!(e?.contains)?.call(e,R)&&(ve(!1),Pe(!1),z(null),Z_(pe),Z_(me),!0)))}if(e)try{let n=[...t.addedNodes].filter((e=>e.nodeType===1));r.push(...n.filter((t=>t.matches(e)))),r.push(...n.flatMap((t=>[...t.querySelectorAll(e)])))}catch{}}})),(r.length||i.length)&&De((e=>[...e.filter((e=>!i.includes(e))),...r]))}));return t.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-tooltip-id`],attributeOldValue:!0}),()=>{t.disconnect()}}),[n,u,ye?.anchorSelect,R]),m((()=>{Ke()}),[Ke]),m((()=>{if(!ne?.current)return()=>null;let e=new ResizeObserver((()=>{setTimeout((()=>Ke()))}));return e.observe(ne.current),()=>{e.disconnect()}}),[te,ne?.current]),m((()=>{let e=document.querySelector(`[id='${l}']`),t=[...Ee,e];R&&t.includes(R)||z(Ee[0]??e)}),[l,Ee,R]),m((()=>(ie&&Pe(!0),()=>{Z_(pe),Z_(me)})),[]),m((()=>{let e=ye?.anchorSelect??u;if(!e&&n&&(e=`[data-tooltip-id='${n.replace(/'/g,`\\'`)}']`),e)try{let t=Array.from(document.querySelectorAll(e));De(t)}catch{De([])}}),[n,u,ye?.anchorSelect]),m((()=>{pe.current&&(Z_(pe),Ie(b))}),[b]);let qe=ye?.content??te,Je=H&&Object.keys(ge.tooltipStyles).length>0;return f(t,(()=>({open:e=>{if(e?.anchorSelect)try{document.querySelector(e.anchorSelect)}catch{console.warn(`[react-tooltip] "${e.anchorSelect}" is not a valid CSS selector`);return}be(e??null),e?.delay?Ie(e.delay):Pe(!0)},close:e=>{e?.delay?Le(e.delay):Pe(!1)},activeAnchor:R,place:ge.place,isOpen:!!(_e&&!w&&qe&&Je)}))),_e&&!w&&qe?a.createElement(y,{id:n,role:de,className:(0,R_.default)(`react-tooltip`,nv.tooltip,rv.tooltip,rv[s],r,`react-tooltip__place-${ge.place}`,nv[Je?`show`:`closing`],Je?`react-tooltip__show`:`react-tooltip__closing`,_===`fixed`&&nv.fixed,E&&nv.clickable),onTransitionEnd:e=>{Z_(he),H||e.propertyName!==`opacity`||(ve(!1),be(null),I?.())},style:{...P,...ge.tooltipStyles,opacity:ce!==void 0&&Je?ce:void 0},ref:B},a.createElement(y,{className:(0,R_.default)(`react-tooltip-content-wrapper`,nv.content,rv.content)},qe),a.createElement(y,{className:(0,R_.default)(`react-tooltip-arrow`,nv.arrow,rv.arrow,o,T&&nv.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},av=({content:e})=>a.createElement(`span`,{dangerouslySetInnerHTML:{__html:e}}),ov=a.forwardRef((({id:t,anchorId:n,anchorSelect:r,content:o,html:s,render:c,className:l,classNameArrow:u,variant:d=`dark`,place:f=`top`,offset:p=10,wrapper:h=`div`,children:g=null,events:_=[`hover`],openOnClick:v=!1,positionStrategy:y=`absolute`,middlewares:b,delayShow:x=0,delayHide:S=0,float:C=!1,hidden:w=!1,noArrow:T=!1,clickable:E=!1,closeOnEsc:D=!1,closeOnScroll:O=!1,closeOnResize:k=!1,openEvents:A,closeEvents:j,globalCloseEvents:M,imperativeModeOnly:N=!1,style:P,position:F,isOpen:ee,defaultIsOpen:I=!1,disableStyleInjection:L=!1,border:te,opacity:ne,arrowColor:re,arrowSize:ie,setIsOpen:ae,afterShow:oe,afterHide:R,disableTooltip:z,role:se=`tooltip`},ce)=>{let[le,ue]=e(o),[de,B]=e(s),[fe,pe]=e(f),[me,he]=e(d),[ge,V]=e(p),[H,U]=e(x),[_e,ve]=e(S),[ye,be]=e(C),[xe,Se]=e(w),[Ce,we]=e(h),[Te,Ee]=e(_),[De,Oe]=e(y),[ke,Ae]=e(null),[je,Me]=e(null),Ne=i(null),Pe=i(L),{anchorRefs:Fe,activeAnchor:Ie}=tv(t),Le=e=>e?.getAttributeNames().reduce(((t,n)=>(n.startsWith(`data-tooltip-`)&&(t[n.replace(/^data-tooltip-/,``)]=e?.getAttribute(n)??null),t)),{}),Re=e=>{let t={place:e=>{pe(e??f)},content:e=>{ue(e??o)},html:e=>{B(e??s)},variant:e=>{he(e??d)},offset:e=>{V(e===null?p:Number(e))},wrapper:e=>{we(e??h)},events:e=>{let t=e?.split(` `);Ee(t??_)},"position-strategy":e=>{Oe(e??y)},"delay-show":e=>{U(e===null?x:Number(e))},"delay-hide":e=>{ve(e===null?S:Number(e))},float:e=>{be(e===null?C:e===`true`)},hidden:e=>{Se(e===null?w:e===`true`)},"class-name":e=>{Ae(e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,n])=>{var r;(r=t[e])==null||r.call(t,n)}))};m((()=>{ue(o)}),[o]),m((()=>{B(s)}),[s]),m((()=>{pe(f)}),[f]),m((()=>{he(d)}),[d]),m((()=>{V(p)}),[p]),m((()=>{U(x)}),[x]),m((()=>{ve(S)}),[S]),m((()=>{be(C)}),[C]),m((()=>{Se(w)}),[w]),m((()=>{Oe(y)}),[y]),m((()=>{Pe.current!==L&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[L]),m((()=>{typeof window<`u`&&window.dispatchEvent(new CustomEvent(`react-tooltip-inject-styles`,{detail:{disableCore:L===`core`,disableBase:L}}))}),[]),m((()=>{let e=new Set(Fe),i=r;if(!i&&t&&(i=`[data-tooltip-id='${t.replace(/'/g,`\\'`)}']`),i)try{document.querySelectorAll(i).forEach((t=>{e.add({current:t})}))}catch{console.warn(`[react-tooltip] "${i}" is not a valid CSS selector`)}let a=document.querySelector(`[id='${n}']`);if(a&&e.add({current:a}),!e.size)return()=>null;let o=je??a??Ie.current,s=new MutationObserver((e=>{e.forEach((e=>{if(!o||e.type!==`attributes`||!e.attributeName?.startsWith(`data-tooltip-`))return;let t=Le(o);Re(t)}))})),c={attributes:!0,childList:!1,subtree:!1};if(o){let e=Le(o);Re(e),s.observe(o,c)}return()=>{s.disconnect()}}),[Fe,Ie,je,n,r]),m((()=>{P!=null&&P.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),te&&!W_(`border`,`${te}`)&&console.warn(`[react-tooltip] "${te}" is not a valid \`border\`.`),P!=null&&P.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),ne&&!W_(`opacity`,`${ne}`)&&console.warn(`[react-tooltip] "${ne}" is not a valid \`opacity\`.`)}),[]);let ze=g,Be=i(null);if(c){let e=c({content:je?.getAttribute(`data-tooltip-content`)||le||null,activeAnchor:je});ze=e?a.createElement(`div`,{ref:Be,className:`react-tooltip-content-wrapper`},e):null}else le&&(ze=le);de&&(ze=a.createElement(av,{content:de}));let Ve={forwardRef:ce,id:t,anchorId:n,anchorSelect:r,className:(0,R_.default)(l,ke),classNameArrow:u,content:ze,contentWrapperRef:Be,place:fe,variant:me,offset:ge,wrapper:Ce,events:Te,openOnClick:v,positionStrategy:De,middlewares:b,delayShow:H,delayHide:_e,float:ye,hidden:xe,noArrow:T,clickable:E,closeOnEsc:D,closeOnScroll:O,closeOnResize:k,openEvents:A,closeEvents:j,globalCloseEvents:M,imperativeModeOnly:N,style:P,position:F,isOpen:ee,defaultIsOpen:I,border:te,opacity:ne,arrowColor:re,arrowSize:ie,setIsOpen:ae,afterShow:oe,afterHide:R,disableTooltip:z,activeAnchor:je,previousActiveAnchor:Ne.current,setActiveAnchor:e=>{Me((t=>(e!=null&&e.isSameNode(t)||(Ne.current=t),e)))},role:se};return a.createElement(iv,{...Ve})}));typeof window<`u`&&window.addEventListener(`react-tooltip-inject-styles`,(e=>{e.detail.disableCore||H_({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||H_({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`})})),d();var sv={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:()=>{}},cv=Vl({name:`source`,state:()=>({...sv}),attach({set:e}){e({setSourceState:t=>e(t),setHideUI:t=>e({hideUI:t})})}}),lv=zf({features:[...Ud,cv],displayName:`MediaPlayer`}),Q=lv.usePlayer,uv=e=>{if(e&&e!==`und`)try{return new Intl.DisplayNames([navigator.language||`en`],{type:`language`,fallback:`none`}).of(e)||void 0}catch{return}},dv=e=>e?.replace(/_/g,` `).trim()||void 0,fv=e=>{let t=e.map(e=>uv(e.language)??dv(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=dv(e.title);return{track:e,label:(n[i]??0)>1&&a&&a!==i?`${i} (${a})`:i}})},pv=e=>fv(e).map(({track:e,label:t})=>({id:e.streamIndex,label:t})),mv=[0,250,1e3,3e3,1e4],hv=6e4,gv=500,_v=15e3,vv=e=>e instanceof Error?e.message:String(e),yv=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(vv(n)),n=n?.cause}return t.length?t.join(`
5
+ `):void 0},bv=(t,n,r)=>{let a=Q(),{read:o,size:s,publicPath:l=``,libavWorkerUrl:u=``,jassubWorkerUrl:d=``,jassubWasmUrl:f=``,jassubLegacyWasmUrl:p,defaultFontUrl:h,bufferSize:g,autoplay:_=!1,chapters:v,seekPrepareBudgetMs:y=gv}=r??{},b=i(v);b.current=v;let[x,S]=e(void 0),[C,w]=e(0),T=i({count:0,at:0}),E=i(void 0);m(()=>(T.current={count:0,at:0},a.setSourceState({playbackErrors:[]}),()=>{E.current&&clearTimeout(E.current)}),[s]);let D=i(null),O=i(null),k=i(!1),A=i(o);A.current=o;let j=i(r?.onSeek);j.current=r?.onSeek;let M=i(r?.onPlaybackError);M.current=r?.onPlaybackError;let N=c(e=>{let t=typeof e==`number`?e:void 0;k.current=!0,a.setSourceState({selectedSubtitleTrack:t}),D.current?.selectSubtitleStream(t)},[a]),P=c(e=>{let t=D.current;if(!t||y<=0){a.seek(e);return}let n=typeof window<`u`&&window.__mediaPlayerSeekDebug,r=performance.now(),i=!1,o=`prepared`,s=()=>{if(!i&&(i=!0,a.seek(e),n)){let n=t.videoElement,i=0;if(n)for(let t=0;t<n.buffered.length;t++)n.buffered.start(t)<=e+1&&e<n.buffered.end(t)&&(i=n.buffered.end(t)-e);console.warn(`[media-player] seek to ${e.toFixed(2)} moved after ${Math.round(performance.now()-r)}ms via ${o}, runway ${i.toFixed(1)}s${o===`deadline`?` (EXPOSED: moved before its data was ready)`:``}`)}};a.setSourceState({seekingTo:e});let c=t.videoElement,l=()=>{c?.removeEventListener(`seeked`,l),clearTimeout(u),a.setSourceState({seekingTo:void 0})},u=setTimeout(l,_v);c?.addEventListener(`seeked`,l);let d=setTimeout(()=>{o=`deadline`,s()},y);t.prepareSeek(e).catch(()=>{}).finally(()=>{clearTimeout(d),s()})},[a,y]),F=c(e=>{typeof e==`number`&&(a.setSourceState({selectedAudioTrack:e}),S(e))},[a]),ee=Q(e=>e.setSourceState);m(()=>{ee({selectSubtitleTrack:N,selectAudioTrack:F,requestSeek:P})},[ee,N,F,P]),m(()=>{if(!t||!n||!s||!o)return;let e=!1;a.setSourceState({playbackError:null,ready:!1});let r=(e,n)=>{let r=Date.now(),i=vv(e),o=yv(e),s=a.playbackErrors,c=s[s.length-1];if(c&&c.message===i&&c.detail===o&&c.recovered===n){let e={...c,count:c.count+1,lastAt:r};a.setSourceState({playbackErrors:[...s.slice(0,-1),e]});return}let l={at:r,lastAt:r,count:1,atMediaTime:Number.isFinite(t.currentTime)?t.currentTime:void 0,message:i,detail:o,recovered:n};a.setSourceState({playbackErrors:[...s,l]})},i=t=>{if(e)return;let n=hs(t);if(r(t,n),n){let e=performance.now();e-T.current.at>hv&&(T.current={count:0,at:e});let n=mv[Math.min(T.current.count,mv.length-1)];T.current={count:T.current.count+1,at:e},console.warn(`the media element failed; rebuilding the pipeline${n?` in ${n}ms`:``}`,t),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>w(e=>e+1),n);return}console.error(`playback failed`,t),a.setSourceState({playbackError:t}),M.current?.(t)};return(async()=>{try{let r=await As({videoElement:t,subtitleContainer:n,read:(e,t)=>A.current(e,t),length:s,publicPath:l,libavWorkerUrl:u,jassubWorkerUrl:d,jassubWasmUrl:f,jassubLegacyWasmUrl:p,defaultFontUrl:h,bufferSize:g,audioStreamIndex:x,onReady:()=>{if(e)return;a.setSourceState({ready:!0});let n=O.current;O.current=null,n&&n.size===s&&n.time>0&&(t.currentTime=n.time),_&&t.play().catch(()=>{})},onError:i,onRecovered:()=>{e||a.setSourceState({playbackError:null})},onSeek:e=>j.current?.(e),onSubtitleStreams:t=>{e||a.setSourceState({subtitleTracks:pv(t),...k.current?{}:{selectedSubtitleTrack:t[0]?.streamIndex}})},onAudioStreams:(t,n)=>{e||a.setSourceState({audioTracks:pv(t),selectedAudioTrack:n})}});if(e){r.destroy();return}D.current=r,a.setSourceState({indexes:r.indexes,chapters:b.current??r.chapters});let o=a.selectedSubtitleTrack;typeof o==`number`&&r.selectSubtitleStream(o)}catch(e){i(e)}})(),()=>{e=!0,O.current={time:t.currentTime,size:s},D.current?.destroy(),D.current=null,a.setSourceState({ready:!1})}},[a,t,n,s,l,u,d,f,p,h,g,x,_,C])},xv=5e3,Sv=6e4,Cv=({publicPath:t,workerUrl:n,length:r,read:a,downloadedRanges:o})=>{let[s,l]=e([]),u=i(null),d=i(a);d.current=a;let f=E(()=>o?.map(({startByteOffset:e,endByteOffset:t})=>[e,t]),[o?.map(({startByteOffset:e,endByteOffset:t})=>`${e}-${t}`).join(`,`)]),p=i(f);return p.current=f,m(()=>{if(!r||!a||!t||!n)return;let e=!1,i=null,o,s=xv,c=()=>{Bs({publicPath:t,workerUrl:n,length:r,read:(e,t)=>d.current(e,t),onThumbnails:t=>{e||l(t)}}).then(t=>{if(e){t.destroy();return}i=t,u.current=t,t.update(p.current)},()=>{e||(o=setTimeout(c,s),s=Math.min(s*2,Sv))})};return c(),()=>{e=!0,clearTimeout(o),u.current=null,i?.destroy(),l([])}},[r,t,n]),m(()=>{u.current?.update(f)},[f]),{thumbnails:s,requestThumbnail:c(e=>{u.current?.prioritize(e)},[])}},wv=(t,n)=>{let r=i(null),[a,o]=e(!1),[s]=e(()=>Js());m(()=>{if(!t||!n||!s)return;let e=Ys({video:t,subtitles:n,mode:s,onBurnedInChange:o});return r.current=e,()=>{e.destroy(),r.current=null,o(!1)}},[t,n,s]);let l=c(()=>{r.current?.toggle().catch(e=>{console.warn(`picture in picture was refused`,e)})},[]);return{toggle:t&&n&&s?l:null,mode:s,burnedIn:a}},Tv=`(hover: hover) and (pointer: fine)`,Ev=()=>typeof matchMedia==`function`?matchMedia(Tv):void 0,Dv=e=>{let t=Ev();return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)},Ov=()=>!!Ev()?.matches,kv=()=>!1,Av=(t,n)=>{let[a,o]=e(!1),[s,l]=e(),u=i(n);n&&(u.current=n);let d=i(!1),f=c(e=>{d.current!==e&&(d.current=e,u.current?.onArmedChange(e))},[]),p=c(e=>{!t||t.readyState<1||t.error||(l(e),f(!0))},[t,f]),h=c(()=>{l(void 0),f(!1)},[f]),g=!!n&&!!t;m(()=>{if(!g||!t)return;let e=()=>{o(!0),h()},n=()=>o(!1);return t.addEventListener(`enterpictureinpicture`,e),t.addEventListener(`leavepictureinpicture`,n),()=>{t.removeEventListener(`enterpictureinpicture`,e),t.removeEventListener(`leavepictureinpicture`,n),o(!1),h()}},[t,g,h]);let _=r(Dv,Ov,kv),[v,y]=e(!1);m(()=>{if(!g)return;let e=e=>{e.pointerType===`touch`&&y(!0)},t=e=>{e.pointerType!==`touch`&&y(!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})}},[g]);let b=g&&_&&!v;m(()=>{b||h()},[b,h]);let x=c(()=>{Promise.resolve(t?.exitPictureInPicture?.()).catch(e=>{console.warn(`leaving picture in picture was refused`,e)})},[t]);return E(()=>b?{active:a,armed:s,arm:p,disarm:h,exit:x}:null,[b,a,s,p,h,x])},jv={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
+ `}},Mv=o`
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
+ `,Nv=o`
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
+ ${jv.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
+ `,Pv=s`
180
+ to { transform: rotate(360deg); }
181
+ `,Fv=o`
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: ${Pv} 0.8s linear infinite;
198
+ }
199
+ `,Iv=o`
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
+ ${jv.bLarge.regular}
207
+ text-shadow: 0 0 4px rgba(0, 0, 0, 1);
208
+ pointer-events: none;
209
+ `,Lv=e=>e instanceof Error?e.message:typeof e==`string`?e:`Playback failed`,Rv=({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 k(v,{children:[t?b(`div`,{className:`title`,css:Nv,style:{...n?{opacity:`0`,pointerEvents:`none`}:{}},children:t}):void 0,((a?!i:o)||s!==void 0)&&!r?b(`div`,{css:Fv}):void 0,r?b(`div`,{css:Iv,children:Lv(r)}):void 0,b(`div`,{className:`subtitles`,ref:e,css:Mv})]})},zv=1e-4,Bv=1,Vv=e=>Math.max(zv,Math.min(Bv,e))**2,Hv=e=>Math.max(zv,Math.min(Bv,e))**(Bv/2),Uv=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}`},Wv=(e,t)=>`${Uv(e)} / ${Uv(t)}`,Gv=e=>o`
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
+ ${jv.bMedium.regular}
242
+ }
243
+
244
+ ${e===`sm`&&o`
245
+ padding: calc(0.4 * var(--mp-unit))!important;
246
+ `}
247
+ ${e===`md`&&o`
248
+ padding: calc(0.6 * var(--mp-unit))!important;
249
+ `}
250
+ ${e===`lg`&&o`
251
+ padding: calc(1.2 * var(--mp-unit))!important;
252
+ `}
253
+ `,Kv={x:-1,y:-1,anchors:0},qv=e=>{Kv.x=e.clientX,Kv.y=e.clientY},Jv=()=>(Kv.anchors++===0&&window.addEventListener(`pointermove`,qv,{capture:!0,passive:!0}),()=>{--Kv.anchors===0&&window.removeEventListener(`pointermove`,qv,{capture:!0})}),Yv=({id:e,toolTipText:t,text:n,delayShow:r=0,closeDelay:a=0,offset:o=20,tooltipPlace:s=`top`,disabled:c=!1,size:l=`md`})=>{let u=i(null),d=i(null);return m(()=>{let e=Jv(),t=()=>{let e=u.current;if(!e)return;let{left:t,right:n,top:r,bottom:i}=e.getBoundingClientRect();Kv.x>=t&&Kv.x<n&&Kv.y>=r&&Kv.y<i||d.current?.close()},n=[`fullscreenchange`,`webkitfullscreenchange`];for(let e of n)document.addEventListener(e,t);return()=>{e();for(let e of n)document.removeEventListener(e,t)}},[]),k(v,{children:[b(`div`,{ref:u,"data-tooltip-id":e,"data-open":!0,"data-tooltip-offset":o,"data-tooltip-delay-show":r,"data-tooltip-delay-hide":a,"data-tooltip-place":s,children:n}),!c&&b(ov,{ref:d,css:Gv(l),id:e,noArrow:!0,children:t})]})},Xv=({ref:t,onChange:n,orientation:r=`horizontal`,disabled:a=!1})=>{let[o,s]=e(!1),l=i(n);l.current=n;let u=i(null),d=c((e,n)=>{let i=t.current;if(!i)return 0;let{left:a,right:o,top:s,bottom:c}=i.getBoundingClientRect(),l=r===`horizontal`?(e-a)/(o-a):(c-n)/(c-s);return Math.min(Math.max(l,0),1)},[t,r]),f=c(e=>{if(!(a||e.button>0)){u.current=e.pointerId;try{e.currentTarget.setPointerCapture?.(e.pointerId)}catch{}s(!0),l.current(d(e.clientX,e.clientY))}},[a,d]),p=c(e=>{u.current===e.pointerId&&l.current(d(e.clientX,e.clientY))},[d]),h=c(e=>{if(u.current===e.pointerId){u.current=null;try{e.currentTarget.releasePointerCapture?.(e.pointerId)}catch{}s(!1)}},[]);return m(()=>{a&&(u.current=null,s(!1))},[a]),{dragging:o,handlers:{onPointerDown:f,onPointerMove:p,onPointerUp:h,onPointerCancel:h,style:{touchAction:`none`}}}},Zv=2,Qv=.005,$v=`#000`,ey=`#0000`,ty=(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<=Qv||r>=.995||n.add(Number((r*100).toFixed(4)))}return n.size?[0,...[...n].sort((e,t)=>e-t),100]:[]},ny=(e,t)=>{let n=Zv/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)?$v:ey} ${c} ${l}`),a!==r&&i.push(`${ey} calc(${s}% - ${n}px) calc(${s}% + ${n}px)`)}return`linear-gradient(90deg, ${i.join(`, `)})`},ry=new Set([`op`,`ops`,`opening`,`openings`,`ncop`,`オープニング`,`op主題歌`]),iy=new Set([`ed`,`eds`,`ending`,`endings`,`nced`,`credits`,`endcard`,`endroll`,`エンディング`,`エンドカード`,`エンドロール`,`ed主題歌`]),ay=new Set([`intro`,`イントロ`]),oy=new Set([`outro`,`アウトロ`]),sy={"credits start":`ending`,"credits end":null,"preview end":null,"end credits":`ending`,"closing credits":`ending`},cy=new Set([`theme`,`themes`,`song`,`sequence`,`nc`,`non`,`credit`,`creditless`,`textless`,`clean`,`tv`,`size`,`version`,`ver`,`full`,`the`,`主題歌`,`ノンクレジット`]),ly=new Set([`post`,`pre`,`after`,`before`,`non`]),uy=/[-:|~/\\[\]()「」『』【】,.!?"'’]|\s+by\s+/u,dy=e=>!e.trim()||/^chapter\s*\d+$/i.test(e.trim())||/^\d{1,2}:\d{2}:\d{2}([.,]\d+)?$/.test(e.trim()),fy=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)&&!cy.has(e)),py=(e,t)=>{if(ry.has(e))return`opening`;if(iy.has(e))return`ending`;if(t){if(ay.has(e))return`opening`;if(oy.has(e))return`ending`}},my=(e,t)=>{if(dy(e))return;let n=e.trim().toLowerCase().replace(/\s+/gu,` `);if(n in sy)return sy[n]??void 0;let r=n.split(uy).map(e=>e.trim()).filter(Boolean);if(r.some(e=>e.split(/[\s_]+/u).some(e=>ly.has(e))))return;let i=r.length>1?[r[0],r.at(-1)]:r;for(let e of i){let n=fy(e);if(n.length!==1)continue;let r=py(n[0],t);if(r)return r}},hy=15,gy=87,_y=93,vy=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>=gy&&e<=_y),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},yy=e=>{let t=e.map(({title:e})=>my(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<hy)return;let r=t[n];if(r)return r;let i=my(e.title,!0);return i&&!t.includes(i)?i:void 0});return e.every(({title:e})=>dy(e))?vy(e):i},by=o`
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
+ ${jv.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
+ `,xy=4,Sy=()=>{let t=Q(),n=Q(e=>e.currentTime),r=Q(e=>e.requestSeek),a=Q(e=>e.duration),o=Q(e=>e.size),s=Q(e=>e.downloadedRanges),c=Q(e=>e.buffered),l=Q(e=>e.indexes),u=Q(e=>e.thumbnails),d=Q(e=>e.thumbnailAt),f=Q(e=>e.requestThumbnail),p=Q(e=>e.chapters),h=Q(e=>e.seekingTo),g=Q(e=>e.setSourceState),_=Q(e=>e.hideUI),v=i(null),[y,x]=e(void 0),[S,C]=e(void 0),w=e=>{C(e),f(e)},T=!!S;m(()=>{if(T)return g({seekPreview:!0}),()=>g({seekPreview:!1})},[g,T]),m(()=>{_&&w(void 0)},[_]);let D=i(void 0),O=i(0),A=i(void 0),j=i(void 0),M=i(!1),{dragging:N,handlers:P}=Xv({ref:v,onChange:e=>{if(O.current+=1,A.current=e,j.current===void 0)j.current=e;else if(!M.current){let t=v.current?.getBoundingClientRect().width??0;Math.abs(e-j.current)*t>xy&&(M.current=!0)}x(e),D.current!==`mouse`&&w(e*a)}}),F=e=>{D.current=e.pointerType,O.current=0,j.current=void 0,M.current=!1,P.onPointerDown(e)},ee=e=>{P.onPointerUp(e);let n=O.current>0?A.current:void 0;if(n!==void 0&&a){let e=n*a;r?r(e):t.seek(e)}O.current=0,M.current=!1,j.current=void 0,e.pointerType!==`mouse`&&w(void 0)},I=e=>{if(!v.current)return;let{left:t,right:n}=v.current.getBoundingClientRect();return Math.min(Math.max((e-t)/(n-t),0),1)*a},L=i(`mouse`),te=e=>{L.current=e.pointerType},ne=e=>{L.current!==`touch`&&w(I(e.clientX))},re=()=>{v.current&&w(void 0)},ie=e=>a?e/a*100:0,ae=(e,t,n)=>{let r=Number((n-t).toFixed(4)),i=t*100;return b(`div`,{className:`loaded-part`,style:{transform:`scaleX(${r})`,marginLeft:`${i}%`}},e)},oe=E(()=>o===void 0?a?c.map(([e,t],n)=>ae(n,e/a,t/a)):[]:s?.map((e,t)=>{if(!o||!a)return null;let n=l.filter(t=>e.startByteOffset<=t.pos&&t.pos<=e.endByteOffset),r=n.at(0),i=n.at(-1);return!r||!i?null:ae(t,r.timestamp/a,i.timestamp/a)})??[],[a,o,o===void 0?c:void 0,l.length,s?.map(({startByteOffset:e,endByteOffset:t})=>`${e}/${t}`).join(`,`)]);m(()=>{y!==void 0&&a&&N&&M.current&&t.seek(y*a)},[t,N,y,a]);let R=E(()=>{if(!a)return 0;if(N&&y!==void 0)return y;let e=h??n;return typeof e==`number`?e/a:0},[a,n,N,y,h]),z=E(()=>ty(p,a),[p,a]),se=z.length>0,ce=E(()=>{if(!se||S===void 0||!a)return-1;let e=S/a*100,t=z.findIndex((t,n)=>n<z.length-1&&e>=t&&e<z[n+1]);return t>=0?t:z.length-2},[se,z,S,a]),le=E(()=>se?ny(z,e=>e!==ce):void 0,[se,z,ce]),ue=E(()=>ce>=0?ny(z,e=>e===ce):void 0,[z,ce]),de=E(()=>{if(S!==void 0)return p.find(({start:e,end:t})=>e<=S&&S<t)},[p,S]),B=E(()=>{if(S){if(d)return d(S);if(u.length)return u.find(({startTime:e,endTime:t})=>e<=S&&S<t)}},[u,d,S]),fe=(e,t)=>k(`div`,{className:e?`track ${e}`:`track`,style:t?{maskImage:t}:void 0,children:[b(`div`,{className:`background-bar`}),b(`div`,{className:`loaded`,children:oe}),b(`div`,{className:`play-container`,children:b(`div`,{className:`play`,style:{transform:`scaleX(${R})`}})})]});return k(`div`,{css:by,ref:v,className:[`progress-bar`,N?`dragging`:``,se?`segmented`:``].filter(Boolean).join(` `),onPointerDown:te,onPointerMove:te,onMouseMove:ne,onMouseOut:re,children:[fe(void 0,le),S?k(`div`,{className:`cursor-time`,style:{left:de?`clamp(var(--thumbnail-half), ${ie(S)}%, calc(100% - var(--thumbnail-half)))`:`clamp(calc(3 * var(--mp-unit)), ${ie(S)}%, calc(100% - calc(3 * var(--mp-unit))))`,maxWidth:de?`var(--thumbnail-width)`:void 0},children:[b(`span`,{className:`cursor-time-value`,children:Uv(S)}),de?b(`span`,{className:`chapter-title`,children:de.title}):void 0]}):void 0,b(`div`,{className:`progress`}),b(`div`,{className:`hover`}),ue?fe(`focus`,ue):void 0,b(`div`,{className:`scrubber`}),b(`div`,{className:`padding`,...P,onPointerDown:F,onPointerUp:ee,onPointerCancel:ee}),b(`div`,{className:`thumbnail`,style:{left:`clamp(var(--thumbnail-half), ${ie(S??1)}%, calc(100% - var(--thumbnail-half)))`},children:B?.url?b(`img`,{src:B.url}):void 0})]})},Cy=`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`,wy={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`},Ty=e=>k(`svg`,{...wy,...e,children:[b(`rect`,{x:`3`,y:`5`,width:`18`,height:`14`,rx:`2`,ry:`2`}),b(`path`,{d:`M7 15h4m4 0h2M7 11h2m4 0h4`})]}),Ey=e=>k(`svg`,{...wy,...e,children:[b(`rect`,{x:`3`,y:`5`,width:`18`,height:`14`,rx:`2`,ry:`2`}),b(`path`,{d:`M7 15h4m4 0h2M7 11h2m4 0h4`}),b(`line`,{x1:`2`,y1:`2`,x2:`22`,y2:`22`})]}),Dy=e=>k(`svg`,{...wy,...e,children:[b(`path`,{d:`M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5`}),b(`rect`,{x:`12`,y:`13`,width:`10`,height:`8`,rx:`1`,ry:`1`}),b(`path`,{d:`M14.5 18.5h2m2 0h1`})]}),Oy=e=>k(`svg`,{...wy,...e,children:[b(`path`,{d:`M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5`}),b(`rect`,{x:`12`,y:`13`,width:`10`,height:`8`,rx:`1`,ry:`1`}),b(`path`,{d:`M6 9h3m2 0h2`})]}),ky=o`
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
+ ${jv.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
+ ${jv.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
+ ${jv.bSmall.regular}
597
+ }
598
+ }
599
+ `,Ay=({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 k(`div`,{onClick:()=>{l||r(e??void 0)},className:[a,l?`unavailable`:null].filter(Boolean).join(` `)||void 0,children:[b(`span`,{children:i}),b(`span`,{children:s?`…`:(n??null)===e?`✓`:``})]},e??`__off__`)};return k(`div`,{className:`popover track-list`,children:[k(`div`,{className:i?`back`:`back no-hover`,onClick:i,children:[i?b(Kg,{}):null,b(`span`,{children:e})]}),s?b(`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`))]})},jy=({onReset:t}={})=>{let n=i(null),[r,a]=e(!1),[o,s]=e(void 0),[c,l]=e(!1),u=i(t);u.current=t;let d=()=>{a(!1),u.current?.()};return m(()=>{let e=e=>{r&&n.current&&!n.current.contains(e.target)&&d()};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[r]),{open:r,toggle:()=>{a(e=>!e),l(!1),u.current?.()},close:d,containerRef:n,pending:o,failed:c,runSelect:(e,t)=>{if(o!==void 0)return;l(!1);let n;try{n=t()}catch(e){console.warn(`[media-player] track selection failed:`,e),l(!0);return}if(!(n instanceof Promise)){d();return}s(e),n.then(()=>{s(void 0),d()},e=>{console.warn(`[media-player] track selection failed:`,e),s(void 0),l(!0)})}}},My=o`
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
+ ${ky}
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
+ ${jv.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
+ ${jv.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
+ ${jv.bSmall.regular}
684
+ }
685
+ }
686
+ }
687
+ `,Ny=e=>new Date(e).toLocaleTimeString(),Py=e=>e===void 0||!Number.isFinite(e)?void 0:Uv(Math.max(0,e)),Fy=e=>e.reduce((e,t)=>e+t.count,0),Iy=e=>e.map((e,t)=>{let n=Py(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
+ `),Ly=()=>{let t=Q(e=>e.playbackErrors),{open:n,toggle:r,containerRef:i}=jy(),[a,o]=e(!1);if(t.length===0)return null;let s=()=>{navigator.clipboard?.writeText(Iy(t)).then(()=>{o(!0),setTimeout(()=>o(!1),2e3)},e=>console.warn(`[media-player] could not copy the errors:`,e))},c=`Playback errors (${Fy(t)})`;return k(`div`,{css:My,ref:i,children:[b(Yv,{id:`errors`,disabled:n,text:b(`button`,{className:`errors`,type:`button`,onClick:r,"aria-label":c,"aria-expanded":n,children:b(Rg,{className:`alert-triangle`})}),toolTipText:b(`span`,{children:c})}),n&&k(`div`,{className:`popover error-list`,children:[k(`div`,{className:`back no-hover`,children:[b(`span`,{children:c}),k(`button`,{className:`copy`,type:`button`,onClick:s,"aria-label":`Copy the errors`,children:[b(a?Hg:e_,{}),b(`span`,{children:a?`Copied`:`Copy`})]})]}),t.map((e,t)=>k(`div`,{className:`entry no-hover`,children:[k(`span`,{className:`when`,children:[Ny(e.at),e.count>1?` to ${Ny(e.lastAt)}`:``,Py(e.atMediaTime)?` at ${Py(e.atMediaTime)}`:``,e.recovered?` recovered`:``,e.count>1?b(`span`,{className:`count`,children:`×${e.count}`}):null]}),b(`span`,{className:`what`,children:e.message}),e.detail?b(`span`,{className:`cause`,children:e.detail}):null]},`${e.at}-${t}`))]})]})},Ry=o`
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
+ `,zy=()=>{let e=Q(),t=Q(e=>e.playbackRate),n=i(null),r=i(null),a=.25,o=2.75,s=(e,t=.05)=>Math.round(e/t)*t,c=s(t||1),l=e=>(e-a)/o*100,u=e=>s(a+e*o),{handlers:d}=Xv({ref:r,onChange:t=>e.setPlaybackRate(u(t))}),f=t=>{t.preventDefault();let n=.05,r=c;r=t.deltaY<0?Math.min(3,r+n):Math.max(a,r-n),e.setPlaybackRate(r)};m(()=>{let e=n.current;return e&&e.addEventListener(`wheel`,f,{passive:!1}),()=>{e&&e.removeEventListener(`wheel`,f)}},[t]);let p=l(c);return k(`div`,{css:Ry,children:[k(`div`,{children:[c.toFixed(2),`x`]}),b(`div`,{className:`playback-slider`,ref:n,...d,children:b(`div`,{ref:r,style:{background:`linear-gradient(to right,
744
+ #fff 0% ${p}%,
745
+ #3A3A3A ${p}% 100%
746
+ )`},children:b(`div`,{className:`playback-handle`,style:{left:`${p}%`}})})})]})},By=o`
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
+ ${ky}
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
+ `,Vy=()=>{let t=Q(),n=Q(e=>e.playbackRate),r=Q(e=>e.audioTracks),i=Q(e=>e.selectedAudioTrack),a=Q(e=>e.selectAudioTrack),[o,s]=e(0),{open:c,toggle:l,containerRef:u,pending:d,failed:f,runSelect:p}=jy({onReset:()=>s(0)}),m=e=>{t.setPlaybackRate(e),s(0)},h=e=>{e!==void 0&&p(e,()=>a(e))},g=e=>()=>{s(e)};return k(`div`,{css:By,ref:u,children:[b(Yv,{id:`settings`,disabled:c,text:b(`button`,{className:`settings`,type:`button`,onClick:l,"aria-label":`Settings`,"aria-expanded":c,children:b(w_,{})}),toolTipText:b(`span`,{children:`Settings`})}),c&&o===0&&k(`div`,{className:`popover menu`,children:[r.length>1?k(`div`,{onClick:g(2),children:[b(`div`,{children:`Audio`}),b(`div`,{children:b(Xg,{})})]}):null,k(`div`,{onClick:g(1),children:[b(`div`,{children:`Playback speed`}),k(`div`,{children:[b(`span`,{className:`secondary`,children:n===1?`(Default)`:n.toFixed(2)}),b(Xg,{})]})]})]}),c&&o===1&&k(`div`,{className:`popover playback-rate`,children:[k(`div`,{className:`back`,onClick:g(0),children:[b(Kg,{}),b(`span`,{children:`Playback speed`})]}),b(`div`,{className:`slider no-hover`,children:b(zy,{})}),k(`div`,{className:`options no-hover`,children:[b(`div`,{onClick:()=>m(.5),children:`0.5x`}),b(`div`,{onClick:()=>m(1),children:`1x`}),b(`div`,{onClick:()=>m(1.5),children:`1.5x`}),b(`div`,{onClick:()=>m(2),children:`2x`})]})]}),c&&o===2&&b(Ay,{title:`Audio`,tracks:r,selected:i,onSelect:h,onBack:g(0),pending:d,failed:f})]})},Hy=o`
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
+ ${ky}
822
+ `,Uy=()=>{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}=jy();if(e.length===0)return null;let u=t!==void 0;return k(`div`,{css:Hy,ref:o,children:[b(Yv,{id:`subtitles`,disabled:i,text:b(`button`,{className:`subtitles`,type:`button`,onClick:a,"aria-label":`Subtitles`,"aria-expanded":i,"aria-pressed":u,children:u?b(Ty,{className:`captions`}):b(Ey,{className:`captions-off`})}),toolTipText:b(`span`,{children:`Subtitles`})}),i&&b(Ay,{title:`Subtitles`,tracks:e,selected:t,onSelect:e=>l(e??null,()=>n(e)),offLabel:r??`Disable`,pending:s,failed:c})]})},Wy={primary:`#EAEBEE`,secondary:`#D0D0D9`,hover:`rgba(255, 255, 255, 0.13)`,borderPrimary:`#384F70`,backgroundTooltip:`#222222`},Gy=o`
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
+ `,Ky=({value:e,onChange:t})=>{let n=Q(e=>e.volume),r=Q(e=>e.muted),a=i(null),o=i(null),{handlers:s}=Xv({ref:o,onChange:t}),c=n=>{n.preventDefault();let r=.05,i=e;i=n.deltaY<0?Math.min(1,i+r):Math.max(0,i-r),t(i)};m(()=>{let e=a.current;return e&&e.addEventListener(`wheel`,c,{passive:!1}),()=>{e&&e.removeEventListener(`wheel`,c)}},[e]);let l=e*100,u=E(()=>Math.round(r?0:Hv(n)*100),[n,r]);return b(Yv,{id:`volume-slider`,text:b(`div`,{ref:a,css:Gy,...s,children:b(`div`,{ref:o,style:{background:`linear-gradient(to right,
866
+ #fff 0% ${l}%,
867
+ #3A3A3A ${l}% 100%
868
+ )`},children:b(`div`,{className:`volume-handle`,style:{left:`${e*100}%`}})})}),toolTipText:k(`div`,{className:`volume-value`,children:[u,`%`]})})},qy=o`
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
+ ${jv.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
+ `,Jy=({ref:e})=>{let t=Q(),n=Q(e=>e.volume),r=Q(e=>e.muted),i=E(()=>Hv(n),[n]);return k(`div`,{css:qy,children:[b(Yv,{id:`sound`,text:b(`button`,{className:`sound`,type:`button`,onClick:()=>t.toggleMuted(),ref:e,"aria-label":`Mute`,"aria-pressed":r||n===0,children:b(r||n===0?I_:n<=.5?O_:M_,{size:18,color:`#fff`})}),toolTipText:b(`span`,{children:r?`Unmute (m)`:`Mute (m)`})}),b(`div`,{className:`volume-slider-container`,children:b(`div`,{className:`volume-slider-background`,children:b(Ky,{value:r?0:i,onChange:e=>{t.setVolume(Vv(e))}})})})]})},Yy=.05,Xy=5,Zy=50,Qy=1e3,$y=o`
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
+ `,eb=o`
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: ${Wy.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
+ ${jv.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
+ `,tb=()=>{let t=Q(),n=Q(e=>e.paused),r=Q(e=>e.currentTime),a=Q(e=>e.duration),o=Q(e=>e.seekingTo),s=Q(e=>e.fullscreen),l=Q(e=>e.hideUI),u=Q(e=>e.togglePictureInPicture),d=Q(e=>e.pictureInPictureMode),f=Q(e=>e.burnedInSubtitles),p=Q(e=>e.passThroughPictureInPicture),h=Q(e=>e.subtitleTracks),g=Q(e=>e.requestSeek),[_,v]=e(null),y=i(null),x=i(void 0),S=d===`burn-in`,C=h.length>0,w=a>0&&r===a,T=c(({direction:e,stepSize:n})=>{let r=Hv(t.volume),i=e===`up`?n:-n,a=Math.max(0,Math.min(1,r+i)),o=t.muted;t.setVolume(Vv(a)),o&&!t.muted&&t.toggleMuted()},[t]);m(()=>{let e=e=>g?g(e):t.seek(e),n=n=>{let r=n.target;if(r?.isContentEditable||/^(input|textarea|select)$/i.test(r?.tagName??``))return;let i=!0;if(n.key===`f`)t.toggleFullscreen();else if(n.key===`k`)t.togglePaused();else if(n.key===` `)t.togglePaused();else if(n.key===`m`)t.toggleMuted();else if(n.key===`ArrowUp`)T({direction:`up`,stepSize:Yy});else if(n.key===`ArrowDown`)T({direction:`down`,stepSize:Yy});else if(n.key===`ArrowRight`){if(!t.duration)return;e(Math.min(t.currentTime+Xy,t.duration))}else n.key===`ArrowLeft`?e(Math.max(t.currentTime-Xy,0)):i=!1;i&&n.preventDefault()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[t,T,g]);let E=c(e=>{e.preventDefault(),e.deltaY<0?T({direction:`up`,stepSize:Yy}):T({direction:`down`,stepSize:Yy})},[T]);m(()=>{if(_)return _.addEventListener(`wheel`,E,{passive:!1}),()=>_.removeEventListener(`wheel`,E)},[_,E]);let D=e=>{if(!p||p.active||p.armed||e.pointerType===`touch`)return;let{left:t,top:n,width:r,height:i}=e.currentTarget.getBoundingClientRect();p.arm({left:t,top:n,width:r,height:i})},O=!!p?.armed;return m(()=>{if(!O)return;clearInterval(x.current);let e=1/0,t=setInterval(()=>{if(Date.now()>e){clearInterval(t);return}let n=y.current,r=document.activeElement;n&&r?.tagName===`IFRAME`&&r.closest(`.video`)?.parentElement?.contains(n)&&n.focus({preventScroll:!0})},Zy);return x.current=t,()=>{e=Date.now()+Qy}},[O]),m(()=>()=>clearInterval(x.current),[]),k(`div`,{css:eb,style:{...l?{opacity:`0`,pointerEvents:`none`}:O?{pointerEvents:`none`}:{}},children:[b(Sy,{}),k(`div`,{className:`actions`,children:[k(`div`,{className:`left`,children:[b(Yv,{id:`play`,tooltipPlace:`top-start`,text:b(`button`,{className:`play`,type:`button`,onClick:()=>t.togglePaused(),"aria-label":w?`Replay`:n?`Play`:`Pause`,children:b(w?b_:n?g_:f_,{})}),toolTipText:b(`span`,{children:w?`Replay (k)`:n?`Play (k)`:`Pause (k)`})}),b(Jy,{ref:v}),b(`div`,{className:`time`,children:Wv(o??r,a)})]}),k(`div`,{className:`right`,children:[b(Ly,{}),b(Uy,{}),b(Vy,{}),p?b(Yv,{id:`picture-in-picture`,tooltipPlace:`top-end`,text:b(`button`,{ref:y,className:p.armed?`picture-in-picture armed`:`picture-in-picture`,type:`button`,onPointerEnter:D,onPointerMove:D,onClick:p.active?p.exit:void 0,"aria-label":`Picture in picture`,"aria-pressed":p.active,children:b(`img`,{src:Cy,alt:``})}),toolTipText:b(`span`,{children:p.active?`Exit picture in picture`:`Picture in picture`})}):u?b(Yv,{id:`picture-in-picture`,tooltipPlace:`top-end`,text:b(`button`,{className:`picture-in-picture`,type:`button`,onClick:u,disabled:S&&!C,"aria-label":S?`Put the subtitles in the video`:`Picture in picture`,"aria-pressed":S?f:void 0,children:S?b(f?Dy:Oy,{}):b(`img`,{src:Cy,alt:``})}),toolTipText:k(`span`,{css:$y,children:[b(`span`,{className:`lead`,children:S?C?f?`Subtitles are in the picture`:`Put the subtitles in the picture`:`This file has no subtitles`:`Picture in picture`}),S&&C?b(`span`,{className:`hint`,children:`Then hover the video and click your browser's own pop out button`}):null]})}):null,b(Yv,{id:`full-screen`,tooltipPlace:`top-end`,text:b(`button`,{className:`full-screen`,type:`button`,onClick:()=>t.toggleFullscreen(),"aria-label":`Full screen`,"aria-pressed":s,children:b(s?c_:i_,{})}),toolTipText:b(`span`,{children:s?`Exit full screen (f)`:`Full screen (f)`})})]})]})]})},nb=9e3,rb=o`
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
+ ${jv.bMedium.bold}
1109
+ color: #fff;
1110
+ }
1111
+
1112
+ .body {
1113
+ ${jv.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
+ `,ib=()=>{let t=Q(e=>e.burnedInSubtitles),n=Q(e=>e.pictureInPictureMode),[r,i]=e(!1);return m(()=>{if(n!==`burn-in`||!t){i(!1);return}i(!0);let e=setTimeout(()=>i(!1),nb);return()=>clearTimeout(e)},[n,t]),n!==`burn-in`||!t?null:b(`div`,{css:rb,className:r?`show`:``,role:`status`,children:k(`div`,{className:`card`,children:[k(`div`,{className:`words`,children:[b(`div`,{className:`title`,children:`Subtitles are in the picture`}),b(`div`,{className:`body`,children:`Now hover the video and click your browser's own pop out button`})]}),b(`div`,{className:`arrow`,"aria-hidden":`true`,children:`→`})]})})},ab=1,ob=6e3,sb=1,cb={opening:`Skip Opening`,ending:`Skip Ending`},lb=o`
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
+ ${jv.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
+ `,ub=()=>{let t=Q(e=>e.chapters),n=Q(e=>e.currentTime),r=Q(e=>e.requestSeek),a=Q(e=>e.seekPreview),o=Q(),s=E(()=>yy(t),[t]),c=E(()=>{if(typeof n!=`number`)return;let e=t.findIndex((e,t)=>s[t]!==void 0&&e.start-ab<=n&&n<e.end),r=e>=0?s[e]:void 0;return r?{kind:r,end:t[e].end}:void 0},[t,s,n]),l=i(0),[u,d]=e(0);m(()=>{let e=typeof n==`number`?n:0,t=l.current;l.current=e,e<t-sb&&d(e=>e+1)},[n]);let[f,p]=e(!1),h=c?`${c.kind}@${c.end}`:``;return m(()=>{if(!h){p(!1);return}p(!0);let e=setTimeout(()=>p(!1),ob);return()=>clearTimeout(e)},[h,u]),m(()=>{c||p(!1)},[c]),c?b(`div`,{css:lb,className:f&&!a?`show`:``,children:b(`button`,{type:`button`,className:`skip-chapter`,onClick:()=>{p(!1),r?r(c.end):o.seek(c.end)},children:cb[c.kind]})}):null},db=3e3,fb=o`
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
+ `,pb=(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')`},mb=o`
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
+ `,hb=(e,t=``)=>l.toArray(e).flatMap((e,r)=>{let i=`${t}${n(e)&&e.key!=null?e.key:r}`;return n(e)&&e.type===_?hb(e.props.children,`${i}/`):[{key:i,item:e}]}),gb=({ref:e,onVideoRef:t,onSubtitleRef:n,overlay:r,controls:a,children:o})=>{let s=Q(),c=Q(e=>e.hideUI),l=Q(e=>e.setHideUI),u=Q(e=>e.hasMedia),d=Q(e=>e.passThroughPictureInPicture),f=i(void 0),p=i(`mouse`),h=i({x:-1,y:-1}),g=i(null);m(()=>()=>clearTimeout(f.current),[]),m(()=>{u||(clearTimeout(f.current),l(!1))},[u,l]);let _=()=>{u&&l(!0)},v=t=>{g.current=t,typeof e==`function`?e(t):e&&(e.current=t)},y=()=>{if(s.passThroughPictureInPicture?.armed)return!0;if(p.current!==`mouse`)return!1;let{x:e,y:t}=h.current;if(!g.current||e<0)return!1;let n=document.elementFromPoint(e,t);return!!n&&g.current.contains(n)&&!n.closest(`.video`)},x=()=>{if(y()){f.current=setTimeout(x,db);return}_()},S=()=>{l(!1),clearTimeout(f.current),f.current=setTimeout(x,db)};return k(`div`,{css:mb,ref:v,onPointerMove:e=>{p.current=e.pointerType,e.pointerType===`mouse`&&(h.current={x:e.clientX,y:e.clientY},S())},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),_())},className:c?`hide`:``,children:[b(Rv,{onSubtitleRef:n}),hb(r).map(({key:e,item:t})=>b(`div`,{css:fb,style:{...c?{opacity:`0`,visibility:`hidden`,pointerEvents:`none`}:{}},children:t},e)),a===!1?null:b(tb,{}),b(ib,{}),b(ub,{}),d?.armed&&g.current?b(`div`,{className:`pass-through`,style:{clipPath:pb(d.armed,g.current.getBoundingClientRect())},onPointerOver:d.disarm}):null,k(`div`,{className:`video`,onClick:()=>{if(p.current===`mouse`){s.togglePaused();return}c?S():(clearTimeout(f.current),_())},children:[t?b(`video`,{ref:t,playsInline:!0}):null,o]})]})},_b=({options:t,children:n})=>{let r=`media`in t?t:null,a=r?null:t,{title:o,chapters:s}=t,{size:c,downloadedRanges:l,publicPath:u,libavWorkerUrl:d,read:f,thumbnailRead:p,thumbnailsEnabled:h}=a??{},g=bl(),_=xl(),[v,y]=e(null),[x,S]=e(null),C=r?.media??v;m(()=>(g?.(C),()=>g?.(null)),[C,g]);let{expose:w}=t,T=w===!0?{}:w||void 0,E=i(T);E.current=T;let D=T?T.id:void 0,O=T?T.origin:void 0,k=T?T.channel:void 0;m(()=>{if(!w||!C)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(C,E.current??{}))}).catch(()=>{}),()=>{t=!0,e?.()}},[C,!!w,D,O,k]),bv(v,x,a);let{thumbnails:A,requestThumbnail:j}=Cv({publicPath:u,workerUrl:d,length:h===!1?void 0:c,read:p??f,downloadedRanges:l}),M=r?.thumbnails?.all??A,{toggle:N,mode:P,burnedIn:F}=wv(v,x),ee=Av(r?.media??null,r?.pictureInPicture),I=Q(e=>e.setSourceState),L=r?!!r.media:c!==void 0;m(()=>{I({title:o,size:c,downloadedRanges:l,hasMedia:L})},[I,o,c,l,L]);let te=r?.thumbnails?.at;m(()=>{I({thumbnails:M,thumbnailAt:te,requestThumbnail:j,togglePictureInPicture:N,pictureInPictureMode:P,burnedInSubtitles:F})},[I,M,te,j,N,P,F]),m(()=>{I({passThroughPictureInPicture:ee})},[I,ee]);let ne=r?.subtitles?.selection,re=r?.audioTracks?.selection;return m(()=>{ne&&I({subtitleTracks:ne.options.map(({id:e,label:t,disabled:n})=>({id:e,label:t,disabled:n})),selectedSubtitleTrack:ne.selectedId??void 0,selectSubtitleTrack:e=>ne.select(e==null?null:String(e)),subtitleOffLabel:ne.offLabel})},[I,ne]),m(()=>{re&&I({audioTracks:re.options.map(({id:e,label:t,disabled:n})=>({id:e,label:t,disabled:n})),selectedAudioTrack:re.selectedId??void 0,selectAudioTrack:e=>re.select(String(e))})},[I,re]),m(()=>{s&&I({chapters:s})},[I,s]),b(gb,{ref:_,onVideoRef:r?void 0:y,onSubtitleRef:S,overlay:t.overlay,controls:t.controls,children:n})},vb=o`
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
+ `,yb=e=>b(`div`,{css:vb,children:b(lv.Provider,{children:b(_b,{options:e,children:e.children})})}),bb=({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`})),xb=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}))},Sb=({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}))},Cb=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}))},wb=`stub:pictureinpicturerefused`,Tb=({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},Eb=`[data-testid="track-selection-button"]`,Db=`[data-testid="audio-text-track-menu"]`,Ob=`.timeline-slider`,kb=`[role="menu"]`,Ab=`[role="menuitemradio"]`,jb=1e4,Mb=2e4,Nb=5e3,Pb=100,Fb={menu:Db,section:kb,option:Ab},Ib=/^(off|none|disabled)$/i,Lb=e=>new Promise(t=>setTimeout(t,e)),Rb=()=>!1,zb=e=>{if(e())throw Error(`Crunchyroll track operation cancelled`)},Bb=e=>e===`audio`?0:1,Vb=e=>e.replace(/\s+/g,` `).trim(),Hb=(e,t)=>{let n=[...new Map(t.map(e=>({...e,label:Vb(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=>Ib.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}:{}}},Ub=async(e,t)=>{zb(t);let n=e.locator(Db);if(await n.exists({timeout:1e3})){zb(t);return}zb(t),await e.evaluate(xb,{button:Eb,timeout:jb});let r=Date.now()+jb;for(;Date.now()<r;){if(zb(t),await n.exists({timeout:1e3}))return;await Lb(Pb)}throw Error(`Crunchyroll track menu did not open`)},Wb=async(e,t,n)=>{zb(n);let r=await e.evaluate(bb,{...Fb,sectionIndex:Bb(t)});zb(n);let i=r.map((e,t)=>({...e,label:Vb(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}`}})},Gb=async(e,t)=>{let[n,r]=await Promise.all([Wb(e,`audio`,t),Wb(e,`subtitles`,t)]);return{audio:Hb(`audio`,n),subtitles:Hb(`subtitles`,r)}},Kb=async(e,t=Rb)=>(await Ub(e,t),Gb(e,t)),qb=async(e,t,n,r)=>(await Wb(e,t,r)).find(e=>n===null?Ib.test(e.label):e.id===n)?.index??-1,Jb=async(e,t,n,r)=>{let i=Date.now()+Mb;for(;Date.now()<i;){zb(r),await Ub(e,r);let i=(await Wb(e,t,r)).find(e=>e.selected);if(i&&(n===null?Ib.test(i.label):i.id===n))return;await Lb(Pb)}throw Error(`Crunchyroll did not apply the ${t} option`)},Yb=(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))},Xb=e=>({currentTime:e.currentTime,paused:e.paused,volume:e.volume,muted:e.muted,playbackRate:e.playbackRate}),Zb=(e,t)=>e.evaluate(Cb,{timeline:Ob,time:t,timeout:Mb}),Qb=async(e,t,n)=>{let r=Date.now()+5e3;for(;Date.now()<r&&(zb(n),!(e.currentSrc!==t||e.readyState<2));)await Lb(Pb);if(e.currentSrc===t&&e.readyState>=2)return!1;let i=Date.now()+Mb;for(;Date.now()<i;){if(zb(n),e.readyState>=2)return!0;await Lb(Pb)}throw Error(`Crunchyroll playback did not become ready after changing tracks`)},$b=async(e,t,n,r)=>{zb(r),t.volume=n.volume,t.muted=n.muted,t.playbackRate=n.playbackRate;let i=Yb(n.currentTime,t.duration);Math.abs(t.currentTime-i)>2&&await Zb(e,i);let a=Date.now()+Mb;for(;Date.now()<a&&(Math.abs(t.currentTime-i)>2||t.seeking||t.readyState<2);)zb(r),await Lb(Pb);if(Math.abs(t.currentTime-i)>2||t.seeking||t.readyState<2)throw Error(`Crunchyroll playback position was not restored after changing tracks`);zb(r),n.paused?t.pause():await t.play();let o=Date.now()+Nb;for(;Date.now()<o&&t.paused!==n.paused;)zb(r),await Lb(Pb);if(t.paused!==n.paused)throw Error(`Crunchyroll playback state was not restored after changing tracks`)},ex=async(e,t,n,r,i=Rb)=>{await Ub(e,i);let a=await qb(e,n,r,i);if(a<0)throw Error(`Crunchyroll ${n} option is no longer available`);zb(i);let o=t.currentSrc,s=Xb(t);return await e.evaluate(Sb,{...Fb,sectionIndex:Bb(n),optionIndex:a}),await Jb(e,n,r,i),await Qb(t,o,i)&&await $b(e,t,s,i),Kb(e,i)},tx=(e,t)=>{Zb(e,t).catch(e=>console.warn(`[cr] timeline seek failed:`,e))},nx=(e,t)=>new Proxy(e,{set(e,n,r,i){return n===`currentTime`&&typeof r==`number`&&Number.isFinite(r)&&tx(t,r),Reflect.set(e,n,r,i)}}),rx=({title:e,remote:t,frame:n,subtitles:r,audioTracks:i,thumbnails:a,chapters:o,pictureInPicture:s,children:c})=>{let l=E(()=>t&&n?nx(t,n):null,[t,n]);return b(yb,{expose:!0,media:l,title:e,subtitles:r,audioTracks:i,thumbnails:a,chapters:o,pictureInPicture:s,children:c})},ix=3e4,ax=async(e,t)=>{let n=Date.now()+ix,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`)};y();var ox=`video`,sx=(t,n,r)=>{let[i,a]=e(null);return m(()=>{if(!t||!n)return;let e=!1;(async()=>t.evaluate(Tb,{video:ox}))().then(t=>{!e&&t&&a(n)},t=>{e||console.warn(`[cr] picture in picture unavailable:`,t)});let r=e=>console.warn(`[cr] picture in picture refused:`,e.detail);return n.addEventListener(wb,r),()=>{e=!0,n.removeEventListener(wb,r),a(null)}},[t,n]),E(()=>i&&i===n&&r?{onArmedChange:e=>{r.style.pointerEvents=e?`auto`:``}}:void 0,[i,n,r])},cx=class extends Error{name=`BifParseError`},lx=[137,66,73,70,13,10,26,10],ux=64,dx=8,fx=4294967295,px=36e3,mx=e=>{if(e.byteLength<ux)throw new cx(`truncated header: ${e.byteLength} bytes`);let t=new DataView(e);if(lx.some((e,n)=>t.getUint8(n)!==e))throw new cx(`bad magic`);let n=t.getUint32(12,!0),r=t.getUint32(16,!0)||1e3;if(n>px)throw new cx(`implausible frame count ${n}`);let i=ux+(n+1)*dx;if(i>e.byteLength)throw new cx(`truncated index: ${n} frames need ${i} bytes, have ${e.byteLength}`);let a=e=>t.getUint32(ux+e*dx,!0),o=e=>t.getUint32(ux+e*dx+4,!0);if(a(n)!==fx)throw new cx(`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 cx(`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 cx(`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},hx=(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]},gx=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)}}},_x={waitMs:1e4,fetchMs:15e3,maxBytes:31457280},vx=e=>{let t=new Map,n=!1;return{at:r=>{if(n)return;let i=hx(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()}}},yx=async e=>{let t=await e.evaluate(gx,_x);if(`none`in t)throw Error(`no BIF: ${t.none}${t.detail?` (${t.detail})`:``}`);let n=mx(t.bytes);if(!n.length)throw Error(`no BIF: the file has no images`);return vx(n)};y();var bx=e=>`https://static.crunchyroll.com/skip-events/production/${e}.json`,xx=e=>{try{return new URL(e).pathname.match(/\/watch\/([A-Z0-9]+)(?:\/|$)/)?.[1]}catch{return}},Sx=[[`intro`,`Opening`],[`recap`,`Recap`],[`credits`,`Ending`],[`preview`,`Preview`]],Cx=`Episode`,wx=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Tx=(e,t)=>{if(!wx(e))return[];let n=t!==void 0&&Number.isFinite(t)&&t>0?t:1/0,r=Sx.flatMap(([t,r])=>{let i=e[t];if(!wx(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:Cx}),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:Cx}),i},Ex=new Set([403,404]),Dx=async(e,t=ae)=>{let n=await t(bx(e));if(!n.ok){if(await n.body?.cancel().catch(()=>{}),Ex.has(n.status))return{};throw Error(`${bx(e)} answered ${n.status}`)}return n.json()},Ox=t=>{let[n,r]=e();return m(()=>{if(r(t?.duration),!t)return;let e=()=>r(t.duration);return t.addEventListener(`durationchange`,e),t.addEventListener(`loadedmetadata`,e),()=>{t.removeEventListener(`durationchange`,e),t.removeEventListener(`loadedmetadata`,e)}},[t]),n},kx=[],Ax=(t,n)=>{let r=xx(t),[i,a]=e(),o=Ox(n);return m(()=>{if(!r)return;let e=!1;return Dx(r).then(t=>{e||a({episodeId:r,events:t})},t=>{e||console.warn(`[cr] skip events unavailable:`,t)}),()=>{e=!0}},[r]),E(()=>{if(!i||i.episodeId!==r)return kx;let e=Tx(i.events,o);return e.length?e:kx},[i,r,o])};y();var jx=[`www.crunchyroll.com`,`crunchyroll.com`,`sso.crunchyroll.com`,`static.crunchyroll.com`],Mx=`
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
+ `,Nx=`https://sso.crunchyroll.com/authorize?${new URLSearchParams({client_id:`noaihdevm_6iyg0a8l0q`,redirect_uri:`https://www.crunchyroll.com/callback`,response_type:`cookie`,state:`/`})}`,Px=async()=>ne()?`extension`:(document.readyState!==`complete`&&await new Promise(e=>{let t=()=>{clearTimeout(n),e()},n=setTimeout(()=>{window.removeEventListener(`load`,t),e()},1e4);window.addEventListener(`load`,t,{once:!0})}),await new Promise(e=>setTimeout(e,300)),ne()?`extension`:`cloud`),Fx=3e4,Ix=async(e,t)=>{let n=Date.now()+Fx;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},Lx=s`
1357
+ to { transform: rotate(360deg); }
1358
+ `,Rx=o`
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: ${Lx} 0.8s linear infinite;
1436
+ }
1437
+ `,zx=({url:t,title:n})=>{let[r,a]=e(`detecting`),[o,s]=e(null),[l,u]=e(null),[d,f]=e(!0),[p,h]=e(!1),[g,_]=e(),[y,x]=e(null),[S,C]=e(0),[w,T]=e(0),[D,O]=e(!1),[A,j]=e(!1),M=i(null),N=i(null),[P,F]=e(!1),ee=i(!1),[I,L]=e(),[te,ie]=e(),ae=Ax(t,y),oe=sx(l,y,o),z=i(0),se=i({generation:0,tail:Promise.resolve()}),ce=i(!0),le=c(()=>{let e=z.current+1;return z.current=e,se.current={generation:e,tail:Promise.resolve()},L(void 0),e},[]),ue=c((e,t)=>{if(se.current.generation!==e)return Promise.reject(Error(`Crunchyroll track operation cancelled`));let n=se.current,r=n.tail.then(t);return n.tail=r.then(()=>{},()=>{}),r},[]);m(()=>()=>{ce.current=!1,z.current+=1},[]),m(()=>{let e=!1;return Px().then(t=>{e||a(t)}),()=>{e=!0}},[]),m(()=>{if(!o||r===`detecting`)return;let e=!1;return re({iframe:o,domains:jx,permissions:[{category:`evaluation`,reason:`Switch Crunchyroll audio and subtitles, seek the video, show the seek preview thumbnails, and open picture in picture`}]}).then(t=>{if(e)return;let n=ne()?`extension`:`cloud`;if(n!==r){a(n);return}u(t)}).catch(t=>{e||(console.error(`Failed to attach Crunchyroll frame`,t),_(t?.message||`Failed to load player`),f(!1))}),()=>{e=!0}},[o,r]),m(()=>{if(!l)return;let e=!1,n=()=>e;return f(!0),_(void 0),h(!1),x(null),le(),(async()=>{if(r===`cloud`){if(await l.goto(t,{waitUntil:`documentstart`}),e)return;let{isLoggedIn:r}=await ax(l,n);if(e)return;if(!r){f(!1),h(!0);return}if(await l.addStyleTag({content:Mx}),e)return;let i=await Ix(l,n);if(e)return;if(f(!1),!i)throw Error(`The episode did not load a player. It may be unavailable or require a different plan.`);x(i);return}if(await l.goto(t,{waitUntil:`documentstart`}),e||(await l.addStyleTag({content:Mx}),e))return;let{isLoggedIn:i}=await ax(l,n);if(e)return;if(!i){f(!1),h(!0);return}let a=await Ix(l,n);if(!e){if(f(!1),!a)throw Error(`The episode did not load a player. It may be unavailable or require a different plan.`);x(a)}})().catch(t=>{e||(console.error(`Failed to load Crunchyroll player`,t),_(t?.message||`Failed to load player`),f(!1))}),()=>{e=!0}},[l,t,S,r,le]),m(()=>{if(!l||!y)return;let e=le(),t=!1,n=()=>t||!ce.current||e!==z.current;return(async()=>{let t,r;for(let i=0;i<5&&!n();i+=1){try{if(r=await ue(e,()=>Kb(l,n)),t=void 0,n()||(L(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}},[l,y,le,ue]),m(()=>{if(!l||!y)return;let e=!1,t;return yx(l).then(n=>{if(e)return n.dispose();t=n,ie(n)},t=>{e||console.warn(`[cr] seek thumbnails unavailable:`,t)}),()=>{e=!0,t?.dispose(),ie(void 0)}},[l,y]);let de=z.current,B=c((e,t)=>{if(!l||!y)return Promise.reject(Error(`Crunchyroll player is not ready`));let n=()=>!ce.current||de!==z.current;return ue(de,async()=>{try{let r=await ex(l,y,e,t,n);if(n())throw Error(`Crunchyroll track operation cancelled`);L(r)}catch(e){if(!n())try{let e=await Kb(l,n);n()||L(e)}catch{}throw e}})},[l,y,ue,de]),fe=E(()=>I?.subtitles&&{selection:{...I.subtitles,select:e=>B(`subtitles`,e)}},[I?.subtitles,B]),pe=E(()=>I?.audio&&{selection:{...I.audio,select:e=>B(`audio`,e)}},[I?.audio,B]),me=c(()=>{if(M.current!==null)return;let e=globalThis.open(Nx,`_blank`,`width=500,height=700`);if(!e){j(!0),f(!1);return}j(!1),O(!0),N.current=e;let t=setInterval(()=>{e.closed&&(clearInterval(t),M.current===t&&(M.current=null),N.current===e&&(N.current=null),O(!1),C(e=>e+1))},500);M.current=t},[]),he=c(()=>{u(null),_(void 0),x(null),le(),h(!1),f(!0),T(e=>e+1)},[le]),ge=c(()=>{if(ee.current)return;ee.current=!0;let e=R({url:Nx,domains:jx,isSignedIn:e=>e.locator(`#user-menu-authenticated`).exists()});j(!1),F(!0),e.then(e=>{if(ce.current){if(e===`blocked`){j(!0);return}if(e===`unsupported`){_(`The Crunchyroll sign-in window could not be opened here.`);return}if(e===`authed`){he();return}h(!1),f(!0),C(e=>e+1)}},e=>{ce.current&&(console.error(`Crunchyroll sign-in window failed`,e),_(e?.message||`The sign-in window failed`))}).finally(()=>{ee.current=!1,ce.current&&F(!1)})},[he]);m(()=>()=>{M.current!==null&&(clearInterval(M.current),M.current=null)},[]),m(()=>{M.current!==null&&(clearInterval(M.current),M.current=null,O(!1)),j(!1)},[t]);let V=c(()=>{N.current!==null&&(N.current.close(),N.current=null),M.current!==null&&(clearInterval(M.current),M.current=null),j(!1),O(!1),he()},[he]),H=(d||g||A||p)&&k(`div`,{className:`overlay`,children:[p&&!g&&!A&&k(v,{children:[`You need to be logged in to Crunchyroll to watch this content.`,r===`extension`?b(`button`,{className:`login-button`,onClick:me,disabled:D,children:D?`Finish signing in the popup...`:`Open Crunchyroll Login Page`}):k(v,{children:[b(`button`,{className:`login-button`,onClick:ge,disabled:P,children:P?`Finish signing in the window...`:`Sign in to Crunchyroll`}),b(`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.`})]})]}),A&&!g&&k(v,{children:[`The login popup was blocked. Allow popups for this page and try again.`,b(`button`,{className:`login-button`,onClick:r===`extension`?me:ge,children:`Open Crunchyroll Login Page`})]}),g&&k(v,{children:[g,b(`button`,{className:`login-button`,onClick:V,children:`Retry`})]}),d&&!g&&!p&&b(`div`,{className:`loading-spinner`,role:`status`,"aria-label":`Loading`})]});return k(`div`,{css:Rx,children:[r!==`detecting`&&b(rx,{title:n,remote:y,frame:l,subtitles:fe,audioTracks:pe,thumbnails:te,chapters:ae,pictureInPicture:oe,children:b(`iframe`,{ref:s,className:`cr-frame`,referrerPolicy:`no-referrer`,allow:`encrypted-media; autoplay; fullscreen;`},`${r}-${w}`)}),H]})},Bx=e=>e,Vx=Bx(({className:e,children:t})=>b(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:18,height:18,fill:`none`,"aria-hidden":`true`,className:e,children:t})),Hx=Bx(({className:e})=>b(Vx,{className:e,children:b(`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`})})),Ux=Bx(({className:e})=>k(Vx,{className:e,children:[b(`rect`,{width:5,height:14,x:2,y:2,fill:`currentColor`,rx:1.75}),b(`rect`,{width:5,height:14,x:11,y:2,fill:`currentColor`,rx:1.75})]})),Wx=Bx(({className:e})=>k(Vx,{className:e,children:[b(`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`}),b(`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`})]})),Gx=Bx(({className:e})=>b(Vx,{className:e,children:b(`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`})})),Kx=Bx(({className:e})=>b(Vx,{className:e,children:b(`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`})})),qx=Bx(({className:e})=>b(Vx,{className:e,children:b(`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`})})),Jx=Bx(({className:e})=>k(Vx,{className:e,children:[b(`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`}),b(`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`})]})),Yx=Bx(({className:e})=>b(Vx,{className:e,children:b(`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`})})),Xx=Bx(({className:e})=>b(Vx,{className:e,children:b(`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`})})),Zx=Bx(({className:e})=>k(Vx,{className:e,children:[b(`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`}),b(`rect`,{width:10,height:7,x:8,y:10,fill:`currentColor`,rx:2}),b(`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`})]})),Qx=Bx(({className:e})=>k(Vx,{className:e,children:[b(`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`}),b(`rect`,{width:10,height:7,x:8,y:10,fill:`currentColor`,rx:2}),b(`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`})]})),$x=Bx(({className:e})=>b(Vx,{className:e,children:b(`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`})})),eS=Bx(({className:e})=>k(Vx,{className:e,children:[b(`rect`,{width:16,height:12,x:1,y:3,stroke:`currentColor`,strokeWidth:2,rx:3}),b(`rect`,{width:3,height:2,x:3,y:8,fill:`currentColor`,rx:1}),b(`rect`,{width:2,height:2,x:13,y:8,fill:`currentColor`,rx:1}),b(`rect`,{width:4,height:2,x:11,y:11,fill:`currentColor`,rx:1}),b(`rect`,{width:5,height:2,x:7,y:8,fill:`currentColor`,rx:1}),b(`rect`,{width:7,height:2,x:3,y:11,fill:`currentColor`,rx:1})]})),tS=Bx(({className:e})=>b(Vx,{className:e,children:k(`g`,{fill:`currentColor`,children:[b(`rect`,{width:2,height:5,x:8,y:.5,opacity:.5,rx:1,children:b(`animate`,{attributeName:`opacity`,begin:`0s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),b(`rect`,{width:2,height:5,x:12.243,y:2.257,opacity:.45,rx:1,transform:`rotate(45 13.243 4.757)`,children:b(`animate`,{attributeName:`opacity`,begin:`0.125s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),b(`rect`,{width:5,height:2,x:12.5,y:8,opacity:.4,rx:1,children:b(`animate`,{attributeName:`opacity`,begin:`0.25s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),b(`rect`,{width:5,height:2,x:10.743,y:12.243,opacity:.35,rx:1,transform:`rotate(45 13.243 13.243)`,children:b(`animate`,{attributeName:`opacity`,begin:`0.375s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),b(`rect`,{width:2,height:5,x:8,y:12.5,opacity:.3,rx:1,children:b(`animate`,{attributeName:`opacity`,begin:`0.5s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),b(`rect`,{width:2,height:5,x:3.757,y:10.743,opacity:.25,rx:1,transform:`rotate(45 4.757 13.243)`,children:b(`animate`,{attributeName:`opacity`,begin:`0.625s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),b(`rect`,{width:5,height:2,x:.5,y:8,opacity:.15,rx:1,children:b(`animate`,{attributeName:`opacity`,begin:`0.75s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),b(`rect`,{width:5,height:2,x:2.257,y:3.757,opacity:.1,rx:1,transform:`rotate(45 4.757 4.757)`,children:b(`animate`,{attributeName:`opacity`,begin:`0.875s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})})]})})),nS=Bx(({className:e})=>b(Vx,{className:e,children:b(`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`})})),rS=Bx(({className:e})=>b(Vx,{className:e,children:b(`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`})})),iS=Bx(({className:e})=>b(Vx,{className:e,children:b(`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`})}));y();var aS=10,$=e=>e,oS=$(bh.Root),sS=$(ph),cS=$(Oh.Root),lS=$(fh.Popup),uS=$(fh.Title),dS=$(fh.Close),fS=$(Oh.Description),pS=$(Og.Provider),mS=$(Og.Root),hS=$(Og.Trigger),gS=$(Og.Popup),_S=$(Yh.Root),vS=$(Yh.Trigger),yS=$(Yh.Popup),bS=$(zh),xS=$(Xh),SS=$(Lh),CS=$(Rh),wS=$(kh),TS=$(Bh),ES=$(pg.Value),DS=$(gg.Root),OS=$(lg.Track),kS=$(lg.Fill),AS=$(lg.Buffer),jS=$(lg.Thumb),MS=$(lg.Value),NS=$(jg.Root),PS=$(Fh),FS=$(jh),IS=$(Lf),LS=({className:e,...t})=>b(`button`,{type:`button`,className:`media-button media-button--subtle media-button--icon${e?` ${e}`:``}`,...t}),RS=({selection:t,icon:n})=>{let[r,i]=e(!1),[a,o]=e(!1),[s,c]=e(!1);m(()=>c(!1),[t.selectedId]);let l=[...t.offLabel?[{id:null,label:t.offLabel}]:[],...t.options],u=e=>{if(e===t.selectedId){i(!1);return}c(!1),o(!0),Promise.resolve().then(()=>t.onSelect(e)).then(()=>i(!1)).catch(e=>{console.warn(`[player] ${t.label} selection failed:`,e),c(!0)}).finally(()=>o(!1))};return k(_S,{open:r,onOpenChange:e=>i(e),children:[b(vS,{render:b(LS,{className:`media-button--menu${s?` media-button--error`:``}`,"aria-label":t.label}),children:n}),b(yS,{className:`media-surface media-popover media-popover--menu`,children:k(`div`,{className:`stub-menu`,role:`menu`,"aria-label":t.label,children:[b(`div`,{className:`stub-menu__heading`,children:t.label}),l.map(e=>{let n=e.id===t.selectedId;return k(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":n,className:`stub-menu__item${n?` stub-menu__item--active`:``}`,disabled:a||`disabled`in e&&e.disabled,onClick:()=>u(e.id),children:[b(`span`,{className:`stub-menu__check`,children:n?b(iS,{className:`media-icon`}):null}),b(`span`,{className:`stub-menu__label`,children:e.label}),`description`in e&&e.description?b(`span`,{className:`stub-menu__description`,children:e.description}):null]},e.id??`__off__`)})]})})]})},zS=()=>k(_S,{openOnHover:!0,delay:200,closeDelay:100,side:`top`,children:[b(vS,{render:k(SS,{className:`media-button--mute`,render:b(LS,{}),children:[b(Kx,{className:`media-icon media-icon--volume-off`}),b(qx,{className:`media-icon media-icon--volume-low`}),b(Jx,{className:`media-icon media-icon--volume-high`})]})}),b(yS,{className:`media-surface media-popover media-popover--volume`,children:k(NS,{className:`media-slider`,orientation:`vertical`,thumbAlignment:`edge`,children:[b(OS,{className:`media-slider__track`,children:b(kS,{className:`media-slider__fill`})}),b(jS,{className:`media-slider__thumb media-slider__thumb--persistent`})]})})]}),BS=({capabilities:e,children:t,className:n,...r})=>k(IS,{className:`media-default-skin media-default-skin--video${n?` ${n}`:``}`,...r,children:[t,b(sS,{render:e=>b(`div`,{...e,className:`media-buffering-indicator`,children:b(`div`,{className:`media-surface`,children:b(tS,{className:`media-icon`})})})}),b(cS,{children:b(lS,{className:`media-error`,children:k(`div`,{className:`media-error__dialog media-surface`,children:[k(`div`,{className:`media-error__content`,children:[b(uS,{className:`media-error__title`,children:`Something went wrong.`}),b(fS,{className:`media-error__description`})]}),b(`div`,{className:`media-error__actions`,children:b(dS,{className:`media-button media-button--primary`,children:`OK`})})]})})}),b(oS,{className:`media-surface media-controls`,children:k(pS,{children:[k(`div`,{className:`media-button-group`,children:[k(mS,{side:`top`,children:[b(hS,{render:k(bS,{className:`media-button--play`,render:b(LS,{}),children:[b(Wx,{className:`media-icon media-icon--restart`}),b(Hx,{className:`media-icon media-icon--play`}),b(Ux,{className:`media-icon media-icon--pause`})]})}),b(gS,{className:`media-surface media-tooltip`})]}),k(mS,{side:`top`,children:[b(hS,{render:b(xS,{seconds:-10,className:`media-button--seek`,render:b(LS,{}),children:k(`span`,{className:`media-icon__container`,children:[b(Gx,{className:`media-icon media-icon--seek media-icon--flipped`}),b(`span`,{className:`media-icon__label`,children:aS})]})})}),k(gS,{className:`media-surface media-tooltip`,children:[`Seek backward `,aS,` seconds`]})]}),k(mS,{side:`top`,children:[b(hS,{render:b(xS,{seconds:aS,className:`media-button--seek`,render:b(LS,{}),children:k(`span`,{className:`media-icon__container`,children:[b(Gx,{className:`media-icon media-icon--seek`}),b(`span`,{className:`media-icon__label`,children:aS})]})})}),k(gS,{className:`media-surface media-tooltip`,children:[`Seek forward `,aS,` seconds`]})]})]}),k(`div`,{className:`media-time-controls`,children:[b(ES,{type:`current`,className:`media-time`}),k(DS,{className:`media-slider`,children:[k(OS,{className:`media-slider__track`,children:[b(kS,{className:`media-slider__fill`}),b(AS,{className:`media-slider__buffer`})]}),b(jS,{className:`media-slider__thumb`}),b(`div`,{className:`media-surface media-thumbnail media-slider__preview`,children:b(MS,{type:`pointer`,className:`media-time media-thumbnail__time`})})]}),b(ES,{type:`duration`,className:`media-time`})]}),k(`div`,{className:`media-button-group`,children:[k(mS,{side:`top`,children:[b(hS,{render:b(TS,{className:`media-button--playback-rate`,render:b(LS,{})})}),b(gS,{className:`media-surface media-tooltip`,children:`Toggle playback rate`})]}),b(zS,{}),e?.subtitles&&b(RS,{selection:e.subtitles,icon:e.subtitles.selectedId?b($x,{className:`media-icon`}):b(eS,{className:`media-icon`})},`subtitles`),e?.audioTracks&&b(RS,{selection:e.audioTracks,icon:b(nS,{className:`media-icon`})},`audio`),e?.qualityLevels&&b(RS,{selection:e.qualityLevels,icon:b(rS,{className:`media-icon`})},`quality`),k(mS,{side:`top`,children:[b(hS,{render:k(CS,{className:`media-button--pip`,render:b(LS,{}),children:[b(Zx,{className:`media-icon media-icon--pip-enter`}),b(Qx,{className:`media-icon media-icon--pip-exit`})]})}),b(gS,{className:`media-surface media-tooltip`})]}),k(mS,{side:`top`,children:[b(hS,{render:k(wS,{className:`media-button--fullscreen`,render:b(LS,{}),children:[b(Yx,{className:`media-icon media-icon--fullscreen-enter`}),b(Xx,{className:`media-icon media-icon--fullscreen-exit`})]})}),b(gS,{className:`media-surface media-tooltip`})]})]})]})}),b(`div`,{className:`media-overlay`}),b(PS,{keys:`Space`,action:`togglePaused`}),b(PS,{keys:`k`,action:`togglePaused`}),b(PS,{keys:`m`,action:`toggleMuted`}),b(PS,{keys:`f`,action:`toggleFullscreen`}),b(PS,{keys:`i`,action:`togglePictureInPicture`}),b(PS,{keys:`ArrowRight`,action:`seekStep`,value:5}),b(PS,{keys:`ArrowLeft`,action:`seekStep`,value:-5}),b(PS,{keys:`l`,action:`seekStep`,value:10}),b(PS,{keys:`j`,action:`seekStep`,value:-10}),b(PS,{keys:`ArrowUp`,action:`volumeStep`,value:.05}),b(PS,{keys:`ArrowDown`,action:`volumeStep`,value:-.05}),b(PS,{keys:`0-9`,action:`seekToPercent`}),b(PS,{keys:`Home`,action:`seekToPercent`,value:0}),b(PS,{keys:`End`,action:`seekToPercent`,value:100}),b(PS,{keys:`>`,action:`speedUp`}),b(PS,{keys:`<`,action:`speedDown`}),b(FS,{type:`tap`,action:`togglePaused`,pointer:`mouse`,region:`center`}),b(FS,{type:`tap`,action:`toggleControls`,pointer:`touch`}),b(FS,{type:`doubletap`,action:`seekStep`,value:-10,region:`left`}),b(FS,{type:`doubletap`,action:`toggleFullscreen`,region:`center`}),b(FS,{type:`doubletap`,action:`seekStep`,value:10,region:`right`})]});y();var{Provider:VS}=zf({features:Ud}),HS=e=>`media`in e?e:{media:e},US=({remote:e,frame:t,adapter:n})=>{let r=bl();return m(()=>{if(!r||!e||!t)return;let i=n?n(e,t):e;if(!i)return;let a=HS(i);r(a.media);let o=z(a.media);return()=>{o(),r(null),a.dispose?.()}},[e,t,n,r]),null},WS=o`
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
+ `,GS=({remote:e,frame:t,adapter:n,capabilities:r,children:i})=>k(VS,{children:[b(US,{remote:e,frame:t,adapter:n}),b(BS,{capabilities:r,css:WS,children:i})]}),KS=`[data-uia="timeline"]`,qS=`[data-uia="video-canvas"]`,JS=`[data-uia="player"]`,YS=`Seeks the video to the point you pick on the timeline.`,XS=`Reveals the player controls so the timeline can be used.`,ZS=140,QS=2,$S=12e3,eC=26,tC=110,nC={"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"]`},rC=e=>new Promise(t=>setTimeout(t,e)),iC=e=>e<0?0:e>1?1:e,aC=0,oC=()=>{let e=aC*1.1;return aC++,{x:.5+Math.cos(e)*.05,y:.5+Math.sin(e)*.05}},sC=(e,t)=>{let n=null,r,i,a=!1,o=async()=>{if(!a){a=!0;try{await Promise.all([t.locator(qS).ensure(`hover`,{reason:XS}),t.locator(JS).ensure(`hover`,{reason:XS}),t.locator(KS).ensure(`click`,{reason:YS})])}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)<QS&&(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=iC(n/r);o();let a=t.locator(KS),s=e.paused===!0;if(s)try{await e.play()}catch{}let c=!1;for(let e=0;e<eC;e++){if(e%2==0&&(await t.locator(qS).hover({position:oC(),reason:XS}).catch(()=>{}),await t.locator(JS).hover({position:oC(),reason:XS}).catch(()=>{})),await a.exists().catch(()=>!1)){c=!0;break}await rC(tC)}if(!c){let n=await Promise.all(Object.entries(nC).map(async([e,n])=>await t.locator(n).exists().catch(()=>!1)?e:``)).then(e=>e.filter(Boolean).join(`, `)).catch(()=>``);if(console.warn(`[nf] seek aborted: controls never revealed${n?` (blocked by ${n})`:``}`),s)try{await e.pause()}catch{}return}if(await a.click({position:{x:i,y:.5},reason:YS}).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))},ZS),i&&clearTimeout(i),i=setTimeout(()=>{n=null},$S),!0):Reflect.set(e,t,a,o)}}),dispose:()=>{e.removeEventListener(`timeupdate`,s),r&&clearTimeout(r),i&&clearTimeout(i)}}},cC=({remote:e,frame:t,capabilities:n,children:r})=>b(GS,{remote:e,frame:t,adapter:sC,capabilities:n,children:r});y();var lC=[`netflix.com`,`www.netflix.com`,`nflxvideo.net`,`nflxso.net`,`nflxext.com`,`nflximg.net`,`assets.nflxext.com`],uC=`https://www.netflix.com/login`,dC=`
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
+ `,fC=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`)},pC=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},mC=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},hC=o`
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
+ `,gC={cr:zx,nf:({url:t})=>{let[n,r]=e(null),[i,a]=e(null),[o,s]=e(!0),[l,u]=e(!1),[d,f]=e(),[p,h]=e(null),[g,_]=e(0);m(()=>{if(!n)return;let e=!1;return(async()=>{for(let t=0;!e;t++)try{let t=await re({iframe:n,domains:lC});if(e)return;if(!ne()){f(`Netflix playback currently needs the FKN browser extension.`),s(!1);return}a(t);return}catch(n){if(e)return;if(t>=4){console.error(`Failed to attach Netflix frame`,n),f(n instanceof Error?n.message:`Failed to load player`),s(!1);return}await new Promise(e=>setTimeout(e,300*(t+1)))}})(),()=>{e=!0}},[n]),m(()=>{if(!i)return;let e=!1,n=()=>e;return s(!0),f(void 0),u(!1),h(null),(async()=>{if(await i.goto(t,{waitUntil:`load`}),await fC(()=>i.addStyleTag({content:dC})),e)return;s(!1);let r=await pC(i);if(e)return;if(!r){u(!0);return}let a=await mC(i,n);!e&&a&&h(a)})().catch(t=>{e||(console.error(`Failed to load Netflix player`,t),f(t?.message??`Failed to load player`),s(!1))}),()=>{e=!0}},[i,t,g]);let y=c(()=>{let e=globalThis.open(uC,`_blank`,`width=500,height=700`);if(!e)return;let t=setInterval(()=>{e.closed&&(clearInterval(t),_(e=>e+1))},500)},[]);return k(`div`,{css:hC,children:[b(cC,{remote:p,frame:i,children:b(`iframe`,{ref:r,className:`nf-frame`,referrerPolicy:`no-referrer`,allow:`encrypted-media; autoplay; fullscreen;`})}),(l||d||o)&&k(`div`,{className:`overlay`,children:[l&&k(v,{children:[`You need to be logged in to Netflix to watch this content.`,b(`button`,{className:`login-button`,onClick:y,children:`Open Netflix Login Page`})]}),d&&!l&&d,o&&!d&&!l&&`Loading Netflix player...`]})]})}},_C=e=>gC[e];y();var vC=new URLSearchParams(globalThis.location.search),yC=vC.get(`mediaUri`),bC=vC.get(`episodeUri`),xC=vC.get(`sourceUri`),SC=vC.get(`url`),CC=xC?D(xC).origin:void 0,wC=CC?_C(CC):void 0;C(b(()=>{let[t,n]=e();return m(()=>N(n),[]),!yC||!bC||!xC||!SC||!wC?b(`div`,{children:`Unsupported or missing parameters`}):b(wC,{url:SC,mediaUri:yC,episodeUri:bC,sourceUri:xC,title:t})},{}),document.getElementById(`app`));