@banou/stub 0.0.52 → 0.0.54

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 (61) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +23 -28
  3. package/build/assets/anime-index-CWT8EUVb.js +1 -0
  4. package/build/assets/anime-seasons-CoquI0pK.js +1 -0
  5. package/build/assets/dist-BhdcN4JK.js +1328 -0
  6. package/build/assets/embed-BXVON2cN.js +293 -0
  7. package/build/assets/embed-title-BD9cgqvV.js +1 -0
  8. package/build/assets/emotion-react-jsx-runtime.browser.esm-BQbalngd.js +1 -0
  9. package/build/assets/index-CKS-vpo7.js +2631 -0
  10. package/build/assets/{lib-account-D3OycIgO.js → lib-account-COp-RaN5.js} +1 -1
  11. package/build/assets/lib-account-CiFA5y4M.js +2 -0
  12. package/build/assets/lib-api-DIgTslNb-DP1_yG_t.js +374 -0
  13. package/build/assets/lib-api-Dqph3zoA.js +2 -0
  14. package/build/assets/{lib-api-DIgTslNb-Dy8pDGuW.js → lib-build-JdIfVZn7.js} +549 -918
  15. package/build/assets/lib-dist-DvqYL0NS.js +112 -0
  16. package/build/assets/lib-emotion-react-jsx-runtime.browser.esm-BXK3nCt6.js +2741 -0
  17. package/build/assets/lib-jassub-worker-CLcXAXXL.wasm +0 -0
  18. package/build/assets/lib-jassub-worker-modern-C7bYVPj4.wasm +0 -0
  19. package/build/assets/lib-remote-C1YHVUVa.js +2 -0
  20. package/build/assets/lib-remote-Cgazpbxo.js +416 -0
  21. package/build/assets/lib-theme-player-Ca8vejFM.js +8749 -0
  22. package/build/assets/{lib-worker-fbrqP6pm.js → lib-worker-PtOuAkPf.js} +1750 -1856
  23. package/build/assets/{lib-worker-CvSIFpg3.js → lib-worker-Z6aSHw7w.js} +1 -1
  24. package/build/assets/lib-worker-anime-index-CWT8EUVb.js +1 -0
  25. package/build/assets/lib-worker-anime-seasons-CoquI0pK.js +1 -0
  26. package/build/assets/lib-worker-fonts-pE_hQFbP.js +1 -0
  27. package/build/assets/lib-worker-index-wTApHofM.js +2631 -0
  28. package/build/assets/lib-worker-jassub-worker-5YNtWxS6.js +1 -0
  29. package/build/assets/lib-worker-worker-BNxa-Gim.js +150 -0
  30. package/build/assets/main-L3DMTKgc.js +5095 -0
  31. package/build/assets/preload-helper-BXrbqLIp.js +1 -0
  32. package/build/assets/site-status-c5cvFL2q.js +71 -0
  33. package/build/assets/theme-player-kjqP6iMr.js +1 -0
  34. package/build/assets/{worker-CrS-zxdF.js → worker-DuBkNi7w.js} +1 -1
  35. package/build/assets/worker-DxIvGCqk.js +1 -0
  36. package/build/embed.html +6 -3
  37. package/build/index.html +6 -4
  38. package/build/index.js +13460 -14229
  39. package/fkn.json +1 -1
  40. package/package.json +15 -4
  41. package/store/background.webp +0 -0
  42. package/store/cover.webp +0 -0
  43. package/store/home.webp +0 -0
  44. package/store/search.webp +0 -0
  45. package/store/season.webp +0 -0
  46. package/store/sources.webp +0 -0
  47. package/store/title.webp +0 -0
  48. package/build/assets/anime-index-Jbe1K3rX.js +0 -1
  49. package/build/assets/anime-seasons-DrpjiWUr.js +0 -1
  50. package/build/assets/embed-CV2x4LBa.js +0 -1609
  51. package/build/assets/embed-title-MMtofoQC.js +0 -1
  52. package/build/assets/index-qhMrnlXc.js +0 -2453
  53. package/build/assets/lib-account-B1yNOmvG.js +0 -2
  54. package/build/assets/lib-api-BH2vA5gl.js +0 -2
  55. package/build/assets/lib-rolldown-runtime-Cb76FRpK.js +0 -27
  56. package/build/assets/lib-worker-anime-index-Jbe1K3rX.js +0 -1
  57. package/build/assets/lib-worker-anime-seasons-DrpjiWUr.js +0 -1
  58. package/build/assets/lib-worker-index-CQP5MZBp.js +0 -2453
  59. package/build/assets/main-Bf72Kvvx.js +0 -4499
  60. package/build/assets/site-status--bPTCMnf.js +0 -71
  61. package/build/assets/worker-CpMTiYu3.js +0 -1
@@ -0,0 +1,1328 @@
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{c as e,i as t,n,r,t as i}from"./preload-helper-BXrbqLIp.js";import{$ as a,A as o,B as s,C as c,D as l,E as u,I as d,J as f,L as p,M as m,N as h,O as g,P as _,T as v,U as y,V as b,X as x,Z as S,a as C,at as w,c as T,ct as E,d as D,dt as O,et as k,i as A,it as j,j as ee,k as M,l as te,n as N,nt as P,o as ne,ot as F,q as I,r as L,s as re,t as ie,tt as R,w as ae,z}from"./emotion-react-jsx-runtime.browser.esm-BQbalngd.js";var B=_(`captions-off`,[[`path`,{d:`M10.5 5H19a2 2 0 0 1 2 2v8.5`,key:`jqtk4d`}],[`path`,{d:`M17 11h-.5`,key:`1961ue`}],[`path`,{d:`M19 19H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2`,key:`1keqsi`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M7 11h4`,key:`1o1z6v`}],[`path`,{d:`M7 15h2.5`,key:`1ina1g`}]]),oe=_(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),se=_(`minimize`,[[`path`,{d:`M8 3v3a2 2 0 0 1-2 2H3`,key:`hohbtr`}],[`path`,{d:`M21 8h-3a2 2 0 0 1-2-2V3`,key:`5jw1f3`}],[`path`,{d:`M3 16h3a2 2 0 0 1 2 2v3`,key:`198tvr`}],[`path`,{d:`M16 21v-3a2 2 0 0 1 2-2h3`,key:`ph8mxp`}]]),ce=_(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),le=_(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);I();var ue={};(function(e){var t=Object.prototype.hasOwnProperty,n=`~`;function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(e,t,r,a,o){if(typeof r!=`function`)throw TypeError(`The listener must be a function`);var s=new i(r,a||e,o),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function o(e,t){--e._eventsCount===0?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}s.prototype.eventNames=function(){var e=[],r,i;if(this._eventsCount===0)return e;for(i in r=this._events)t.call(r,i)&&e.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e},s.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,a=r.length,o=Array(a);i<a;i++)o[i]=r[i].fn;return o},s.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,i,a,o){var s=n?n+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,r),!0;case 4:return c.fn.call(c.context,t,r,i),!0;case 5:return c.fn.call(c.context,t,r,i,a),!0;case 6:return c.fn.call(c.context,t,r,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,r);break;case 4:c[d].fn.call(c[d].context,t,r,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},s.prototype.on=function(e,t,n){return a(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return a(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,r,i){var a=n?n+e:e;if(!this._events[a])return this;if(!t)return o(this,a),this;var s=this._events[a];if(s.fn)s.fn===t&&(!i||s.once)&&(!r||s.context===r)&&o(this,a);else{for(var c=0,l=[],u=s.length;c<u;c++)(s[c].fn!==t||i&&!s[c].once||r&&s[c].context!==r)&&l.push(s[c]);l.length?this._events[a]=l.length===1?l[0]:l:o(this,a)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s})({get exports(){return ue},set exports(e){ue=e}});var V=ue,de=class extends Error{constructor(e){super(e),this.name=`TimeoutError`}},fe=class extends Error{constructor(e){super(),this.name=`AbortError`,this.message=e}},pe=e=>globalThis.DOMException===void 0?new fe(e):new DOMException(e),me=e=>{let t=e.reason===void 0?pe(`This operation was aborted.`):e.reason;return t instanceof Error?t:pe(t)};function he(e,t,n,r){let i,a=new Promise((a,o)=>{if(typeof t!=`number`||Math.sign(t)!==1)throw TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(t===1/0){a(e);return}if(r={customTimers:{setTimeout,clearTimeout},...r},r.signal){let{signal:e}=r;e.aborted&&o(me(e)),e.addEventListener(`abort`,()=>{o(me(e))})}i=r.customTimers.setTimeout.call(void 0,()=>{if(typeof n==`function`){try{a(n())}catch(e){o(e)}return}let r=typeof n==`string`?n:`Promise timed out after ${t} milliseconds`,i=n instanceof Error?n:new de(r);typeof e.cancel==`function`&&e.cancel(),o(i)},t),(async()=>{try{a(await e)}catch(e){o(e)}finally{r.customTimers.clearTimeout.call(void 0,i)}})()});return a.clear=()=>{clearTimeout(i),i=void 0},a}function ge(e,t,n){let r=0,i=e.length;for(;i>0;){let a=Math.trunc(i/2),o=r+a;n(e[o],t)<=0?(r=++o,i-=a+1):i=a}return r}var 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)},_e,ve=class{constructor(){_e.set(this,[])}enqueue(e,t){t={priority:0,...t};let n={priority:t.priority,run:e};if(this.size&&H(this,_e,`f`)[this.size-1].priority>=t.priority){H(this,_e,`f`).push(n);return}let r=ge(H(this,_e,`f`),n,(e,t)=>t.priority-e.priority);H(this,_e,`f`).splice(r,0,n)}dequeue(){return H(this,_e,`f`).shift()?.run}filter(e){return H(this,_e,`f`).filter(t=>t.priority===e.priority).map(e=>e.run)}get size(){return H(this,_e,`f`).length}};_e=new WeakMap;var U=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},W=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)},G,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,K,ke,q,Ae,je,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,Ve,He=new de,Ue=class extends Error{},We=class extends V{constructor(e){if(super(),G.add(this),ye.set(this,void 0),be.set(this,void 0),xe.set(this,0),Se.set(this,void 0),Ce.set(this,void 0),we.set(this,0),Te.set(this,void 0),Ee.set(this,void 0),De.set(this,void 0),Oe.set(this,void 0),K.set(this,0),ke.set(this,void 0),q.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:ve,...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})`);U(this,ye,e.carryoverConcurrencyCount,`f`),U(this,be,e.intervalCap===1/0||e.interval===0,`f`),U(this,Se,e.intervalCap,`f`),U(this,Ce,e.interval,`f`),U(this,De,new e.queueClass,`f`),U(this,Oe,e.queueClass,`f`),this.concurrency=e.concurrency,this.timeout=e.timeout,U(this,Ae,e.throwOnTimeout===!0,`f`),U(this,q,e.autoStart===!1,`f`)}get concurrency(){return W(this,ke,`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})`);U(this,ke,e,`f`),W(this,G,`m`,Be).call(this)}async add(e,t={}){return new Promise((n,r)=>{W(this,De,`f`).enqueue(async()=>{var i,a;U(this,K,(i=W(this,K,`f`),i++,i),`f`),U(this,xe,(a=W(this,xe,`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}):he(Promise.resolve(e({signal:t.signal})),t.timeout===void 0?this.timeout:t.timeout,()=>{(t.throwOnTimeout===void 0?W(this,Ae,`f`):t.throwOnTimeout)&&r(He)}));n(i),this.emit(`completed`,i)}catch(e){r(e),this.emit(`error`,e)}W(this,G,`m`,Ne).call(this)},t),W(this,G,`m`,Le).call(this),this.emit(`add`)})}async addAll(e,t){return Promise.all(e.map(async e=>this.add(e,t)))}start(){return W(this,q,`f`)?(U(this,q,!1,`f`),W(this,G,`m`,Be).call(this),this):this}pause(){U(this,q,!0,`f`)}clear(){U(this,De,new(W(this,Oe,`f`)),`f`)}async onEmpty(){W(this,De,`f`).size!==0&&await W(this,G,`m`,Ve).call(this,`empty`)}async onSizeLessThan(e){W(this,De,`f`).size<e||await W(this,G,`m`,Ve).call(this,`next`,()=>W(this,De,`f`).size<e)}async onIdle(){(W(this,K,`f`)!==0||W(this,De,`f`).size!==0)&&await W(this,G,`m`,Ve).call(this,`idle`)}get size(){return W(this,De,`f`).size}sizeBy(e){return W(this,De,`f`).filter(e).length}get pending(){return W(this,K,`f`)}get isPaused(){return W(this,q,`f`)}};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,K=new WeakMap,ke=new WeakMap,q=new WeakMap,Ae=new WeakMap,G=new WeakSet,je=function(){return W(this,be,`f`)||W(this,xe,`f`)<W(this,Se,`f`)},Me=function(){return W(this,K,`f`)<W(this,ke,`f`)},Ne=function(){var e;U(this,K,(e=W(this,K,`f`),e--,e),`f`),W(this,G,`m`,Le).call(this),this.emit(`next`)},Pe=function(){this.emit(`empty`),W(this,K,`f`)===0&&this.emit(`idle`)},Fe=function(){W(this,G,`m`,ze).call(this),W(this,G,`m`,Re).call(this),U(this,Ee,void 0,`f`)},Ie=function(){let e=Date.now();if(W(this,Te,`f`)===void 0){let t=W(this,we,`f`)-e;if(t<0)U(this,xe,W(this,ye,`f`)?W(this,K,`f`):0,`f`);else return W(this,Ee,`f`)===void 0&&U(this,Ee,setTimeout(()=>{W(this,G,`m`,Fe).call(this)},t),`f`),!0}return!1},Le=function(){if(W(this,De,`f`).size===0)return W(this,Te,`f`)&&clearInterval(W(this,Te,`f`)),U(this,Te,void 0,`f`),W(this,G,`m`,Pe).call(this),!1;if(!W(this,q,`f`)){let e=!W(this,G,`a`,Ie);if(W(this,G,`a`,je)&&W(this,G,`a`,Me)){let t=W(this,De,`f`).dequeue();return t?(this.emit(`active`),t(),e&&W(this,G,`m`,Re).call(this),!0):!1}}return!1},Re=function(){W(this,be,`f`)||W(this,Te,`f`)!==void 0||(U(this,Te,setInterval(()=>{W(this,G,`m`,ze).call(this)},W(this,Ce,`f`)),`f`),U(this,we,Date.now()+W(this,Ce,`f`),`f`))},ze=function(){W(this,xe,`f`)===0&&W(this,K,`f`)===0&&W(this,Te,`f`)&&(clearInterval(W(this,Te,`f`)),U(this,Te,void 0,`f`)),U(this,xe,W(this,ye,`f`)?W(this,K,`f`):0,`f`),W(this,G,`m`,Be).call(this)},Be=function(){for(;W(this,G,`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,J=(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},Y={[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=J({box:()=>Gt,isType:()=>Wt,objectsOnly:()=>!0,revive:()=>Kt,type:()=>Ut}),Ut=`arrayBuffer`,Wt=e=>e instanceof ArrayBuffer,Gt=(e,t)=>({...Y,type:Ut,...Bt(e,t)}),Kt=(e,t)=>Vt(e),qt=J({box:()=>Xt,isType:()=>Yt,objectsOnly:()=>!0,revive:()=>Zt,type:()=>Jt}),Jt=`date`,Yt=e=>e instanceof Date,Xt=(e,t)=>({...Y,type:Jt,ISOString:e.toISOString()}),Zt=(e,t)=>new Date(e.ISOString),Qt=J({box:()=>tn,isType:()=>en,objectsOnly:()=>!0,revive:()=>nn,type:()=>$t}),$t=`headers`,en=e=>e instanceof Headers,tn=(e,t)=>({...Y,type:$t,entries:[...e.entries()]}),nn=(e,t)=>new Headers(e.entries),rn=J({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{...Y,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=J({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{...Y,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=J({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{...Y,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=J({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{...Y,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),{...Y,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=J({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})),{...Y,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=J({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(),{...Y,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=J({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(),{...Y,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=J({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(),{...Y,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=J({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{...Y,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}),{...Y,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=J({box:()=>ti,isType:()=>ei,objectsOnly:()=>!0,revive:()=>ni,type:()=>$r}),$r=`response`,ei=e=>e instanceof Response,ti=(e,t)=>({...Y,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=J({box:()=>oi,isType:()=>ai,objectsOnly:()=>!0,revive:()=>si,type:()=>ii}),ii=`request`,ai=e=>e instanceof Request,oi=(e,t)=>({...Y,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=J({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{...Y,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)}),{...Y,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):{...Y,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=J({box:()=>Ti,isType:()=>wi,objectsOnly:()=>!0,revive:()=>Ei,type:()=>`map`}),wi=e=>e instanceof Map,Ti=(e,t)=>({...Y,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=J({box:()=>ki,isType:()=>Oi,objectsOnly:()=>!0,revive:()=>Ai,type:()=>`set`}),Oi=e=>e instanceof Set,ki=(e,t)=>({...Y,type:`set`,values:Array.from(e,e=>Da(e,t))}),Ai=(e,t)=>new Set(e.values.map(e=>ka(e,t))),ji=J({box:()=>Pi,isType:()=>Ni,revive:()=>Fi,type:()=>Mi}),Mi=`bigint`,Ni=e=>typeof e==`bigint`,Pi=(e,t)=>({...Y,type:Mi,value:e.toString()}),Fi=(e,t)=>BigInt(e.value),Ii=J({box:()=>zi,isType:()=>Ri,objectsOnly:()=>!0,revive:()=>Bi,type:()=>Li}),Li=`event`,Ri=e=>e instanceof Event,zi=(e,t)=>({...Y,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=J({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{...Y,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=J({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,{...Y,type:Xi,description:e.description},t):{...Y,type:Xi,registryKey:n}},$i=(e,t)=>`registryKey`in e?Symbol.for(e.registryKey):Symbol(e.description),ea=J({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{...Y,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)?{...Y,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)?{...Y,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)=>({...Y,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=J({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=e(t(((e,t)=>{n();var i=r!==void 0&&!!r.hrtime,a=65535,o=10,s=i?1e9/o:1e3/o,c=i?()=>{let[e,t]=r.hrtime();return e*1e9+t}:()=>performance.now();function l(e){return(c()-e)/s&a}t.exports=function(e){let t=c(),n=o*(e||5),r=[0],i=1,s=l(t)-1&a;return function(e){let c=l(t),u=c-s&a;for(u>n&&(u=n),s=c;u--;)i===n&&(i=0),r[i]=r[i===0?n-1:i-1],i++;e&&(r[i-1]+=e);let d=r[i-1],f=r.length<n?0:r[i===n?0:i];return r.length<o?d:(d-f)*o/r.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,ee=0,M,te=()=>M??t.currentTime,N=!1,P=!1,ne=0,F=0,I=null,L=0,re=0,ie=!1,R=0,ae=!0,z=(e,t,n=!1)=>{let r=e?.message===`Cancelled`;t&&r||(console.error(e),(!ie||n)&&(ie=!0,m?.(r?Error(`Reading the video file failed`,{cause:e}):e)))},B=async(e=!1)=>{if(ee>0&&!e)return;let n=t.currentTime,r=e?ys:gs,i=e?bs:_s,a=rs(T),o=(e,t)=>(ae=!1,D(e,t));a.length&&a[0].start<n+r&&await o(0,n+r);for(let{end:e}of a)e>n+i&&await o(n+i,e)},oe=()=>{let e=rs(T);if(!e.length)return!0;let t=te(),n=e.find(e=>e.start<=t+Cs&&t<e.end);return V()&&le(t)&&(!n||n.start<=t)||n&&n.end>=t+_s?!1:!n||n.end<t+vs},se=e=>rs(T).find(t=>t.start<=e+Cs&&e<t.end),ce=()=>se(t.currentTime),le=(e=t.currentTime)=>{let n=se(e);return e>=re-.1||!!n&&n.end>=re-.1},ue=()=>{let e=rs(T).map(e=>e.end);e.length&&(re=Math.max(re,...e)),N&&(P=!0)},V=()=>N||P&&(rs(T).at(-1)?.end??0)>=re-.1,de=async e=>{j=!0,I=null,L=0,R=e,ae=!0;let t=++F;try{let{data:n,pts:r,subtitles:i,finished:o}=await y.seek(e);if(x||t!==F||(o&&(N=!0),i?.length&&a.pushFragments(i),await O(r),x||t!==F))return;n.byteLength&&(await E(n),ue())}catch(e){t===F&&(ae=!1),z(e,x||t!==F)}finally{t===F&&(j=!1)}},fe=async()=>{let e=I;if(e)try{await E(e),ue(),I===e&&(I=null,L=0)}catch(n){if(I!==e)return;if(n?.name===`QuotaExceededError`){let n=await B(!0).then(()=>!0,()=>!1);if(I!==e)return;if(n){N=!1,await de(ce()?.end??t.currentTime);return}}if(L+=1,L<xs)return;throw I=null,n}},pe=async()=>{if(A||j||be!==void 0||x||!I&&(N||!oe()))return;let e=++ne,t=F,n=()=>x||e!==ne||t!==F;A=!0;try{if(!I){let{data:e,subtitles:t,finished:r}=await y.read();if(n()||(r&&(N=!0),t?.length&&a.pushFragments(t),!e.byteLength))return;I=e,L=0}await fe(),!n()&&ie&&(ie=!1,h?.())}catch(e){z(e,n())}finally{e===ne&&(A=!1)}},me=e=>e>=R&&he(e)&&H(e),he=e=>rs(T).some(t=>t.start<=e&&e<t.end),ge=e=>{let t=se(e);return t?t.end-e:0},H=e=>ge(e)>=ws||V()&&le(e),_e=async e=>{if(!x&&!(he(e)&&H(e))){N=!1,ee++,M=e;try{await de(e);let t=F;for(let n=0;n<Ts&&!(x||t!==F||N||ge(e)>=ws);n++){let t=ge(e);if(await pe(),ge(e)<=t)break}}finally{ee--,M===e&&(M=void 0)}}},ve=0,U=null,W,G=e=>{let t=performance.now(),n=t-ve;if(n>=Es){ve=t,U=null,g?.(e);return}U=e,!W&&(W=setTimeout(()=>{W=void 0;let e=U;U=null,!(e===null||x)&&(ve=performance.now(),g?.(e))},Es-n))};b.push(()=>{W&&clearTimeout(W)});let ye=0,be;b.push(()=>{be&&clearTimeout(be)});let xe=()=>{let n=t.currentTime,r=e.info.input.duration||t.duration;r>0&&G(Math.min(Math.max(n/r,0),1));let i=performance.now(),a=i-ye<Ds;if(ye=i,!me(n)&&!(ae&&(j||ge(n)>0)&&Math.abs(n-R)<.001)){if(N=!1,be&&clearTimeout(be),!a){be=void 0,de(n);return}be=setTimeout(()=>{if(be=void 0,x)return;let e=t.currentTime;me(e)||(N=!1,de(e))},Ds)}};t.addEventListener(`seeking`,xe),b.push(()=>t.removeEventListener(`seeking`,xe));let Se=!1,Ce=()=>{if(Se)return;Se=!0;let e=t.error;z(new ms(`the media element failed: ${e?.message??`unknown`}`,{cause:e}),!1,!0)};t.addEventListener(`error`,Ce),b.push(()=>t.removeEventListener(`error`,Ce));let we=setInterval(()=>{Se||t.error||(B().catch(()=>{}),pe().catch(e=>z(e,!1)),V()&&!I&&le()&&C.readyState===`open`&&k().catch(()=>{}))},100);return b.push(()=>clearInterval(we)),{destroy:S,prepareSeek:_e,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 X(e){return typeof e==`function`}function Qs(e){return e===null}function Z(e){return e===void 0}function $s(e){return typeof e==`object`&&!!e}var ec=Object.prototype.hasOwnProperty;function tc(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(!ec.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var nc=new Map,rc=new Set;function ic(e){return e.trim().replaceAll(`_`,`-`).toLowerCase()}function ac(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 oc(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 sc(e){return ac(ic(e))}function cc(e){let t=sc(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=oc(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 lc(e){let t={};for(let n=e.length-1;n>=0;n--){let r=e[n],i=nc.get(r);i&&Object.assign(t,i)}return t}function uc(e){return lc(cc(e))}function dc(e){return rc.add(e),()=>{rc.delete(e)}}var fc=/\{([^{}]+)\}/g;function pc(e,t){return t?e.replace(fc,(e,n)=>Object.hasOwn(t,n)?String(t[n]):e):e}function mc(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,pc(o??(i?t.text:s)??String(a),c)}}var hc=E(null);E(void 0);function gc(){let e=j(hc),[t,n]=F(e=>e+1,0);k(()=>dc(()=>n()),[]);let r=w(()=>mc(uc(`en`),`en`),[t]);return e?e.translator:r}function _c(){return j(hc)?.locale??`en`}function vc(e){let t=e.composedPath();return t.length>0?t[0]:e.target}function yc(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 bc(e=document){let t=e.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}var xc=[`button`,`input`,`select`,`textarea`,`a[href]`,`[role="button"]`,`[role="menu"]`,`[role="menuitem"]`,`[role="menuitemcheckbox"]`,`[role="menuitemradio"]`,`[role="slider"]`,`[data-interactive]`].join(`,`),Sc=[`textarea`,`select`,`input:not([type])`,...[`text`,`search`,`url`,`tel`,`email`,`password`,`number`].map(e=>`input[type="${e}"]`),`[contenteditable]:not([contenteditable="false"])`].join(`,`);function Cc(e){return e.matches(Sc)}function wc(e){let t=vc(e);return t instanceof Element&&Cc(t)}function Tc(e){let t=vc(e);return t instanceof Element&&t.closest(xc)!==null}var Ec=new Set([` `,`Enter`]),Dc=`button,a[href],[role="slider"],[role="button"]`;function Oc(e){if(!Ec.has(e.key))return!1;let t=vc(e);return t instanceof Element&&t.matches(Dc)}function Q(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function kc(e){return e instanceof Node&&e.nodeType===11&&`host`in e}function Ac(e){return e.kind===`captions`||e.kind===`subtitles`}function jc(e,t){if(!(e instanceof HTMLElement))return null;for(let n of e.querySelectorAll(`track`))if(n.track===t)return n;return null}function Mc(e,t){return e.textTracks?Array.from(e.textTracks).filter(t).sort(Nc):[]}function Nc(e,t){return e.kind>t.kind?1:e.kind<t.kind?-1:0}function Pc(e){let t=[];for(let n=0;n<e.length;n++)t.push([e.start(n),e.end(n)]);return t}function Fc(e,t){let n=t;for(;n;){if(n===e||e.contains(n))return!0;let t=n.getRootNode();n=kc(t)?t.host:n.parentNode}return!1}function Ic(){return`WebKitPlaybackTargetAvailabilityEvent`in globalThis}function Lc(e){return Ic()&&`webkitCurrentPlaybackTargetIsWireless`in e}I();function Rc(e,t){if(X(e))return e(t);e!=null&&(e.current=t)}function zc(...e){let t=e.flat();return e=>{let n=t.map(t=>Rc(t,e));if(n.some(X))return()=>{for(let e=0;e<n.length;e++){let r=n[e];X(r)?r():Rc(t[e],null)}}}}function Bc(...e){return R(zc(...e),[...e])}I();function Vc(e,t,n,r=tc){let i=S(void 0),a=()=>{let e=n(t());return i.current!==void 0&&r(i.current,e)?i.current:(i.current=e,e)};return z(e,a,a)}function Hc(e){return e}function Uc(...e){}var Wc=()=>Uc;function Gc(e,t,n){return Vc(t?t=>e.subscribe(t):Wc,t?()=>e.state:()=>e,t??Hc,n)}I();var Kc=E(null),qc=()=>{},Jc={state:{},subscribe:()=>qc};function Yc({value:e,children:t}){return D(Kc.Provider,{value:e,children:t})}function Xc(){let e=j(Kc);if(!e)throw Error(`usePlayerContext must be used within a Player Provider`);return e}function Zc(e){let{store:t}=Xc();return Gc(t,e)}function Qc(e){let t=j(Kc),n=Gc(t?.store??Jc,t?e:void 0);return t?n:void 0}function $c(){let{media:e}=Xc();return e}function el(){let{container:e}=Xc();return e}function tl(){return j(Kc)?.container??null}function nl(){return j(Kc)?.popupGroup}function rl(){return j(Kc)?.setMedia}function il(){return j(Kc)?.setContainer}function al(e){if(`any`in AbortSignal)return AbortSignal.any(e);let t=new AbortController;for(let n of e){if(n.aborted)return t.abort(n.reason),t.signal;n.addEventListener(`abort`,()=>t.abort(n.reason),{signal:t.signal})}return t.signal}var ol=class{#e=new AbortController;#t=new Map;get base(){return this.#e.signal}clear(){for(let e of this.#t.values())e.abort();this.#t.clear()}reset(){this.clear(),this.#e.abort(),this.#e=new AbortController}supersede(e){this.#t.get(e)?.abort();let t=new AbortController;return this.#t.set(e,t),al([this.#e.signal,t.signal])}};function sl(...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 cl=class extends Error{code;cause;constructor(e,t){super(t?.message??e),this.name=`StoreError`,this.code=e,this.cause=t?.cause}};function ll(){throw new cl(`NO_TARGET`)}function ul(){throw new cl(`DESTROYED`)}function dl(){return e=>e}var fl=!1;function pl(){fl||(fl=!0,queueMicrotask(hl))}var ml=new Set;function hl(){fl=!1;for(let e of ml)e.flush();ml.clear()}var gl=Object.prototype.hasOwnProperty,_l=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(!gl.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 Uc;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,ml.add(this),pl()}};function vl(e){return new _l(e)}var yl=Symbol.for(`@videojs/store`);function bl(){return(e,t={})=>{let n=null,r=!1,i=new AbortController,a=new ol,o;function s(){r&&ul(),n||ll()}let c=e.state({target:()=>(s(),n),signals:a,get:()=>o.current,set:e=>o.patch(e)});o=vl(c);let l={[yl]:!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&&ul(),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 xl=dl();function Sl(e,t){if(arguments.length===1)return xl(e);let{name:n,state:r,attach:i}=e,a=e=>xl({...Z(n)?{}:{name:n},state:t=>r(t,e),...i?{attach:t=>i(t,e)}:{}}),o=a(t),s=(e=>Z(e)?o:a(e));return s.state=o.state,o.attach&&(s.attach=o.attach),Z(n)||Object.defineProperty(s,"name",{value:n}),s}var Cl=Object.freeze({length:0,start:()=>0,end:()=>0}),wl=Object.assign(new EventTarget,{length:0,*[Symbol.iterator](){},getTrackById:()=>null}),Tl=new EventTarget;Object.freeze({});function El(e){return e.readyState>=1}function Dl(e){if(!$s(e))return!1;let t=e;return!Z(t.paused)&&!Z(t.ended)&&X(t.pause)}function Ol(e){if(!$s(e))return!1;let t=e;return!Z(t.currentTime)&&!Z(t.duration)&&!Z(t.seeking)}function kl(e){if(!$s(e))return!1;let t=e;return!Z(t.src)&&!Z(t.currentSrc)&&!Z(t.readyState)&&X(t.load)}function Al(e){if(!$s(e))return!1;let t=e;return!Z(t.volume)&&!Z(t.muted)}function jl(e){return $s(e)?!Z(e.playbackRate):!1}function Ml(e){if(!$s(e))return!1;let t=e;return!Z(t.buffered)&&t.buffered!==Cl&&!Z(t.seekable)&&t.seekable!==Cl}function Nl(e){return $s(e)?!Z(e.error):!1}function Pl(e){if(!$s(e))return!1;let t=e;return!Z(t.textTracks)&&t.textTracks!==wl}function Fl(e){return $s(e)?!Z(e.videoRenditions):!1}function Il(e){return $s(e)?!Z(e.audioTracks):!1}function Ll(e){if(!$s(e))return!1;let t=e;return!Z(t.videoWidth)&&!Z(t.videoHeight)}function Rl(e){if(!$s(e))return!1;let t=e;return $s(t.remote)&&t.remote!==Tl}function zl(e){return $s(e)?!Z(e.streamType):!1}function Bl(e){if(!$s(e))return!1;let t=e;return!Z(t.liveEdgeStart)&&!Z(t.targetLiveWindow)}function Vl(e){return $s(e)&&`querySelectorAll`in e&&X(e.querySelectorAll)}function Hl(e,t){return e.id||String(t)}function Ul(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 Wl=Sl({name:`audioTrack`,state:({target:e})=>({audioTrackList:[],selectAudioTrack(t){let{media:n}=e();if(!Il(n))return;let r=[...n.audioTracks],i=r.find((e,n)=>Hl(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=()=>Il(r)?r.audioTracks:null,s=(e=o())=>{n({audioTrackList:e?[...e].map(Ul):[]})},c=()=>{let e=o();if(e===i){s(e);return}a?.abort(),a=new AbortController,i=e,i&&(Q(i,`addtrack`,()=>s(i),{signal:a.signal}),Q(i,`removetrack`,()=>s(i),{signal:a.signal}),Q(i,`change`,()=>s(i),{signal:a.signal})),s(i)};c(),Q(r,`loadstart`,c,{signal:t}),t.addEventListener(`abort`,()=>a?.abort(),{once:!0})}}),Gl=Sl({name:`buffer`,state:()=>({buffered:[],seekable:[]}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Ml(r))return;let i=()=>n({buffered:Pc(r.buffered),seekable:Pc(r.seekable)});i(),Q(r,`progress`,i,{signal:t}),Q(r,`emptied`,i,{signal:t})}});function Kl(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 ql=250,Jl=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!Tc(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;Q(this.#e,`pointerdown`,e=>{e.button===0&&(t=Date.now())},{signal:e}),Q(this.#e,`pointerup`,e=>{if(e.button!==0||Date.now()-t>ql||Tc(e))return;let n=e.pointerType,r=e.clientX,i=this.#e,a=this.#t,o={resolve:e=>Ql(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}}},Yl=new WeakMap;function Xl(e){return Yl.get(e)}function Zl(e){let t=Yl.get(e);return t||(t=new Jl(e),Yl.set(e,t)),t}function Ql(e,t,n,r,i){let a=i.getBoundingClientRect(),o=$l(e,t,n),s=o.size>0?Kl(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 $l(e,t,n){let r=new Set;for(let i of e)i.disabled||i.type===t&&(i.pointer&&i.pointer!==n||i.region&&r.add(i.region));return r}function eu(e){let t=e;if($s(t.remote)&&`state`in t.remote&&`prompt`in t.remote)return t.remote}function tu(e){return eu(e)?.state===`connected`}function nu(e){return eu(e)?.state===`connecting`}async function ru(e){let t=eu(e);if(!t)throw new DOMException(`Remote playback not supported`,`NotSupportedError`);return t.prompt()}var iu=2e3,au=250,ou=500,su=Sl({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(!Dl(i)||Qs(a))return;let o=e=>e||i.paused||tu(i)||nu(i),s;function c(){clearTimeout(s),s=void 0}function l(){c(),s=setTimeout(d,iu)}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<ou;function h(e){f=Date.now(),e.pointerType===`touch`&&(p=f)}function g(e){if(e.pointerType===`touch`&&(p=Date.now()),e.pointerType===`touch`&&Date.now()-f<au){if(Xl(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(Q(a,`pointermove`,v,{signal:t}),Q(a,`pointerdown`,h,{signal:t}),Q(a,`pointerup`,g,{signal:t}),Q(a,`keyup`,u,{signal:t}),Q(a,`focusin`,()=>{m()||u()},{signal:t}),Q(a,`mouseleave`,()=>{m()||d()},{signal:t}),Q(i,`play`,_,{signal:t}),Q(i,`pause`,_,{signal:t}),Q(i,`ended`,_,{signal:t}),Rl(i)){let e=()=>{let{userActive:e}=n();r({controlsVisible:o(e)})};Q(i.remote,`connect`,e,{signal:t}),Q(i.remote,`connecting`,e,{signal:t}),Q(i.remote,`disconnect`,e,{signal:t})}t.addEventListener(`abort`,c,{once:!0}),l()}}),cu=Sl({name:`error`,state:({set:e})=>({error:null,dismissError(){e({error:null})}}),attach({target:e,signal:t,set:n}){let{media:r}=e;Nl(r)&&(Q(r,`error`,()=>n({error:r.error}),{signal:t}),Q(r,`emptied`,()=>n({error:null}),{signal:t}))}});function lu(){let e=document;return e.fullscreenEnabled||e.webkitFullscreenEnabled?!0:X(document.createElement(`video`).webkitSetPresentationMode)}function uu(){let e=document;return e.fullscreenElement??e.webkitFullscreenElement??null}function du(e){if(!(e instanceof Element))return!1;try{return e.matches(`:fullscreen`)}catch{return!1}}function fu(e,t){if(t.webkitPresentationMode===`fullscreen`)return!0;let n=uu();return n&&(n===e||n===t)||du(e)||du(t)?!0:t.isFullscreen??!1}async function pu(e,t){let n=document;if(e&&(n.fullscreenEnabled||n.webkitFullscreenEnabled)){let t=e;if(X(t.requestFullscreen))return t.requestFullscreen();if(X(t.webkitRequestFullscreen))return t.webkitRequestFullscreen()}let r=t;if(X(r.webkitSetPresentationMode)){r.webkitSetPresentationMode(`fullscreen`);return}let i=t;if(X(i.requestFullscreen))return i.requestFullscreen()}async function mu(e){let t=document,n=e;if(n.webkitPresentationMode===`fullscreen`&&X(n.webkitSetPresentationMode)){n.webkitSetPresentationMode(`inline`);return}if(X(t.exitFullscreen))return t.exitFullscreen();if(X(t.webkitExitFullscreen))return t.webkitExitFullscreen();let r=e;if(X(r.exitFullscreen))return r.exitFullscreen()}function hu(){if(document.pictureInPictureEnabled){let e=/.*Version\/.*Safari\/.*/.test(navigator.userAgent),t=typeof matchMedia==`function`&&matchMedia(`(display-mode: standalone)`).matches;return!e||!t}return X(document.createElement(`video`).webkitSetPresentationMode)}function gu(e){return e.webkitPresentationMode===`picture-in-picture`||document.pictureInPictureElement===e?!0:e.isPictureInPicture??!1}async function _u(e){let t=e;if(X(t.webkitSetPresentationMode)){t.webkitSetPresentationMode(`picture-in-picture`);return}let n=e;if(X(n.requestPictureInPicture))return n.requestPictureInPicture()}async function vu(e){let t=e;if(t.webkitPresentationMode===`picture-in-picture`&&X(t.webkitSetPresentationMode)){t.webkitSetPresentationMode(`inline`);return}if(X(document.exitPictureInPicture))return document.exitPictureInPicture();let n=e;if(X(n.exitPictureInPicture))return n.exitPictureInPicture()}var yu=Sl({name:`fullscreen`,state:({target:e})=>({fullscreen:!1,fullscreenAvailability:`unavailable`,async requestFullscreen(){let{media:t,container:n}=e();return gu(t)&&await vu(t),pu(n,t)},async exitFullscreen(){let{media:t}=e();return mu(t)},async toggleFullscreen(){let{media:t,container:n}=e();return fu(n,t)?mu(t):(gu(t)&&await vu(t),pu(n,t))}}),attach({target:e,signal:t,set:n}){let{media:r,container:i}=e;n({fullscreenAvailability:lu()?`available`:`unsupported`});let a=()=>n({fullscreen:fu(i,r)});a(),Q(document,`fullscreenchange`,a,{signal:t}),Q(document,`webkitfullscreenchange`,a,{signal:t}),`webkitPresentationMode`in r&&Q(r,`webkitpresentationmodechanged`,a,{signal:t})}}),bu=Sl({name:`pip`,state:({target:e})=>({pip:!1,pipAvailability:`unavailable`,async requestPictureInPicture(){let{media:t,container:n}=e();return fu(n,t)&&await mu(t),_u(t)},async exitPictureInPicture(){let{media:t}=e();return vu(t)},async togglePictureInPicture(){let{media:t,container:n}=e();return gu(t)?vu(t):(fu(n,t)&&await mu(t),_u(t))}}),attach({target:e,signal:t,set:n}){let{media:r}=e;n({pipAvailability:hu()?`available`:`unsupported`});let i=()=>n({pip:gu(r)});i(),Q(r,`enterpictureinpicture`,i,{signal:t}),Q(r,`leavepictureinpicture`,i,{signal:t}),`webkitPresentationMode`in r&&Q(r,`webkitpresentationmodechanged`,i,{signal:t})}}),xu=Sl({name:`playback`,state:({target:e})=>({paused:!0,ended:!1,started:!1,waiting:!1,play(){return e().media.play()},pause(){let{media:t}=e();Dl(t)&&t.pause()},togglePaused(){let t=e().media;return Dl(t)?t.paused?(t.play(),!0):(t.pause(),!1):!1}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Dl(r)||!Ol(r)||!kl(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(),Q(r,`emptied`,i,{signal:t}),Q(r,`play`,i,{signal:t}),Q(r,`pause`,i,{signal:t}),Q(r,`ended`,i,{signal:t}),Q(r,`playing`,i,{signal:t}),Q(r,`waiting`,i,{signal:t}),Q(r,`seeked`,i,{signal:t})}}),Su=[.2,.5,.7,1,1.2,1.5,1.7,2],Cu=Sl({name:`playbackRate`,state:({target:e})=>({playbackRates:Su,playbackRate:1,setPlaybackRate(t){let{media:n}=e();jl(n)&&(n.playbackRate=t)}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!jl(r))return;let i=()=>n({playbackRate:r.playbackRate});i(),Q(r,`ratechange`,i,{signal:t})}}),wu=`auto`;function Tu(e,t){return e.id||String(t)}function Eu(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 Du(e){return e.width&&e.height?Math.min(e.width,e.height):e.height??e.width}var Ou=Sl({name:`quality`,state:({target:e})=>({videoRenditionList:[],activeVideoRendition:null,selectVideoRendition(t){let{media:n}=e();if(!Fl(n))return;if(t===wu){n.videoRenditions.selectedIndex=-1;return}let r=[...n.videoRenditions].findIndex((e,n)=>Tu(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=()=>Fl(r)?r.videoRenditions:null,s=e=>{if(!e)return null;let t=[...e],n=t.find(e=>e.active);if(n)return n;if(!Ll(r)||!r.videoWidth&&!r.videoHeight)return null;let i=Du({width:r.videoWidth||void 0,height:r.videoHeight||void 0}),a=t.filter(e=>Du(e)===i);return a.length===1?a[0]:null},c=(e=o())=>{let t=s(e);n({videoRenditionList:e?[...e].map(Eu):[],activeVideoRendition:t?Eu(t):null})},l=()=>{let e=o();if(e===i){c(e);return}a?.abort(),a=new AbortController,i=e,i&&(Q(i,`addrendition`,()=>c(i),{signal:a.signal}),Q(i,`removerendition`,()=>c(i),{signal:a.signal}),Q(i,`change`,()=>c(i),{signal:a.signal}),Q(i,`activechange`,()=>c(i),{signal:a.signal})),c(i)};l(),Q(r,`loadstart`,l,{signal:t}),Q(r,`resize`,()=>c(i),{signal:t}),t.addEventListener(`abort`,()=>a?.abort(),{once:!0})}}),ku=Sl({name:`remotePlayback`,state:({target:e})=>({remotePlaybackState:`disconnected`,remotePlaybackAvailability:`unsupported`,async toggleRemotePlayback(){let{media:t,container:n}=e();return tu(t)?ru(t):(fu(n,t)&&await mu(t),await ru(t))}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Rl(r))return;if(Lc(r)){let e=()=>{n({remotePlaybackState:r.webkitCurrentPlaybackTargetIsWireless?`connected`:`disconnected`})};Q(r,`webkitplaybacktargetavailabilitychanged`,e=>{let{availability:t}=e;n({remotePlaybackAvailability:t===`available`?`available`:`unavailable`})},{signal:t}),Q(r,`webkitcurrentplaybacktargetiswirelesschanged`,e,{signal:t}),e();return}let i=()=>n({remotePlaybackState:r.remote.state});i(),Q(r.remote,`connect`,i,{signal:t}),Q(r.remote,`connecting`,i,{signal:t}),Q(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(()=>{})})}}),Au=Sl({name:`source`,state:({target:e,signals:t})=>({source:null,canPlay:!1,loadSource(n){t.clear();let{media:r}=e();return kl(r)?(r.src=n,r.load(),n):n}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!kl(r))return;let i=()=>n({source:r.currentSrc||r.src||null,canPlay:r.readyState>=HTMLMediaElement.HAVE_ENOUGH_DATA});i(),Q(r,`canplay`,i,{signal:t}),Q(r,`canplaythrough`,i,{signal:t}),Q(r,`loadstart`,i,{signal:t}),Q(r,`emptied`,i,{signal:t})}});function ju(e,t){return e.id||`track:${t}:${e.kind}:${e.language}:${e.label}`}var Mu=Sl({name:`textTrack`,state:({target:e})=>({chaptersCues:[],thumbnailCues:[],thumbnailTrackSrc:null,textTrackList:[],subtitlesShowing:!1,toggleSubtitles(t){let{media:n}=e();if(!Pl(n))return!1;let r=Mc(n,Ac);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(!Pl(n))return;let r=Array.from(n.textTracks).map((e,t)=>({index:t,track:e})).filter(({track:e})=>Ac(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})=>ju(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(!Pl(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:ju(i,n),kind:i.kind,label:i.label,language:i.language,mode:i.mode}),Ac(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=jc(r,t)?.src??null);let d=Vl(r)&&r.querySelectorAll(`track`)||[],f=r instanceof HTMLElement&&r.shadowRoot?.querySelectorAll(`track`)||[];for(let e of[...d,...f])e.track?.cues?.length||Q(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&&(Q(o,`addtrack`,a,{signal:t}),Q(o,`removetrack`,a,{signal:t}),Q(o,`change`,a,{signal:t})),Q(r,`loadstart`,a,{signal:t}),t.addEventListener(`abort`,()=>i?.abort(),{once:!0})}}),Nu={seek:Symbol.for(`@videojs/seek`)},Pu=Sl({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(Nu.seek);if(!Ol(i)||!kl(i))return 0;if(!El(i)&&!await yc(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 yc(i,`seeked`,{signal:a}).catch(Uc),i.currentTime}}),attach({target:e,signal:t,set:n,get:r}){let{media:i}=e;if(!Ol(i))return;let a=()=>{let{duration:e}=i;if(e===1/0&&Ml(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(),Q(i,`timeupdate`,s,{signal:t}),Q(i,`durationchange`,o,{signal:t}),Q(i,`seeking`,o,{signal:t}),Q(i,`seeked`,o,{signal:t}),Q(i,`loadedmetadata`,o,{signal:t}),Q(i,`emptied`,o,{signal:t}),Q(i,`progress`,s,{signal:t})}}),Fu=.25,Iu=Sl({name:`volume`,state:({target:e})=>({volume:1,muted:!1,volumeAvailability:`unavailable`,setVolume(t){let{media:n}=e();if(!Al(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 Al(t)?(t.muted||t.volume===0?(t.muted=!1,t.volume===0&&(t.volume=Fu)):t.muted=!0,t.muted):!1}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Al(r))return;n({volumeAvailability:Lu()});let i=()=>n({volume:r.volume,muted:r.muted});i(),Q(r,`volumechange`,i,{signal:t})}});function Lu(){let e=document.createElement(`video`);try{return e.volume=.5,e.volume===.5?`available`:`unsupported`}catch{return`unsupported`}}var Ru=[xu,Cu,Ou,Wl,Iu,Pu,Au,Gl,yu,bu,ku,su,Mu,cu],zu=`group`;function Bu(e){let t=bc(e.ownerDocument);(!t||t===e.ownerDocument.body||!Fc(e,t))&&e.focus({preventScroll:!0})}function Vu(){let e=null;return{open(t){e!==t&&(e?.close(`group-open`),e=t)},close(t){e===t&&(e=null)}}}var Hu={key:`container.label`,text:`Media player`};I();var Uu=y(function({children:e,tabIndex:t=0,role:n=zu,"aria-label":r,"aria-labelledby":i,...a},o){let s=il(),c=gc(),l=S(null),u=Bc(o,l);k(()=>(s?.(l.current),()=>s?.(null)),[s]);let d=e=>{a.onPointerUp?.(e);let t=l.current;t&&Bu(t)};return D(`div`,{ref:u,role:n,tabIndex:t,...r!==void 0||i!==void 0?{"aria-label":r,"aria-labelledby":i}:{"aria-label":c(Hu)},...a,onPointerUp:d,children:e})});I();function Wu(e){let t=S(e);return t.current=e,t}I();function Gu(e,t,n){let r=S(null),i=Wu(t),a=Wu(n);k(()=>(r.current===null?i.current?.():(clearTimeout(r.current),r.current=null),()=>{r.current=setTimeout(()=>{a.current?.(),e.destroy()},0)}),[e])}I();function Ku(e){function t({children:t}){let[n,r]=P(()=>bl()(sl(...e.features))),[i]=P(()=>Vu()),[a,o]=P(null),[s,c]=P(null);return Gu(n),k(()=>{if(a){if(n.destroyed){r(bl()(sl(...e.features)));return}return n.attach({media:a,container:s})}},[a,s,n]),D(Yc,{value:w(()=>({store:n,media:a,setMedia:o,container:s,setContainer:c,popupGroup:i}),[n,a,s,i]),children:t})}function n(e){let{store:t}=Xc();return Gc(t,e)}return{Provider:t,Container:Uu,usePlayer:n,useMedia:$c}}var qu=(e,t)=>{if(globalThis.navigator?.vendor===`Apple Computer, Inc.`)throw new DOMException(`A media element routed into Web Audio loses its volume and mute, or its sound, in this engine`,`NotSupportedError`);return e.createMediaElementSource(t)},Ju=t(((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})()}));n(),I();var Yu=e(Ju(),1),Xu=`react-tooltip-core-styles`,Zu=`react-tooltip-base-styles`,Qu={core:!1,base:!1};function $u({css:e,id:t=Zu,type:n=`base`,ref:i}){if(!e||typeof document>`u`||Qu[n]||n===`core`&&r!==void 0&&(r==null?void 0:{})?.REACT_TOOLTIP_DISABLE_CORE_STYLES||n!==`base`&&r!==void 0&&(r==null?void 0:{})?.REACT_TOOLTIP_DISABLE_BASE_STYLES)return;n===`core`&&(t=Xu),i||={};let{insertAt:a}=i;if(document.getElementById(t))return;let o=document.head||document.getElementsByTagName(`head`)[0],s=document.createElement(`style`);s.id=t,s.type=`text/css`,a===`top`&&o.firstChild?o.insertBefore(s,o.firstChild):o.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e)),Qu[n]=!0}var ed=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r=`top`,offset:i=10,strategy:a=`absolute`,middlewares:o=[T(Number(i)),re({fallbackAxisSideDirection:`start`}),te({padding:5})],border:s,arrowSize:c=8})=>{if(!e||t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};let l=o;return n?(l.push(A({element:n,padding:5})),ne(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}}))):ne(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})))},td=(e,t)=>!(`CSS`in window&&`supports`in window.CSS)||window.CSS.supports(e,t),nd=(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},rd=e=>e!==null&&!Array.isArray(e)&&typeof e==`object`,id=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every(((e,n)=>id(e,t[n])));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!rd(e)||!rd(t))return e===t;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every((n=>id(e[n],t[n])))},ad=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`}))},od=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(ad(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},sd=typeof window<`u`?x:k,cd=e=>{e.current&&=(clearTimeout(e.current),null)},ld=`DEFAULT_TOOLTIP_ID`,ud={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},dd=E({getTooltipData:()=>ud});function fd(e=ld){return j(dd).getTooltipData(e)}var pd={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`},md={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`},hd=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:i=`dark`,anchorId:o,anchorSelect:c,place:l=`top`,offset:u=10,events:d=[`hover`],openOnClick:f=!1,positionStrategy:p=`absolute`,middlewares:m,wrapper:h,delayShow:g=0,delayHide:_=0,float:v=!1,hidden:y=!1,noArrow:b=!1,clickable:x=!1,closeOnEsc:w=!1,closeOnScroll:T=!1,closeOnResize:E=!1,openEvents:D,closeEvents:O,globalCloseEvents:A,imperativeModeOnly:j,style:ee,position:M,afterShow:te,afterHide:N,disableTooltip:ne,content:F,contentWrapperRef:I,isOpen:L,defaultIsOpen:re=!1,setIsOpen:ie,previousActiveAnchor:ae,activeAnchor:z,setActiveAnchor:B,border:oe,opacity:se,arrowColor:ce,arrowSize:le=8,role:ue=`tooltip`})=>{let V=S(null),de=S(null),fe=S(null),pe=S(null),me=S(null),[he,ge]=P({tooltipStyles:{},tooltipArrowStyles:{},place:l}),[H,_e]=P(!1),[ve,U]=P(!1),[W,G]=P(null),ye=S(!1),be=S(null),{anchorRefs:xe,setActiveAnchor:Se}=fd(t),Ce=S(!1),[we,Te]=P([]),Ee=S(!1),De=f||d.includes(`click`),Oe=De||D?.click||D?.dblclick||D?.mousedown,K=D?{...D}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!D&&De&&Object.assign(K,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});let ke=O?{...O}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!O&&De&&Object.assign(ke,{mouseleave:!1,blur:!1,mouseout:!1});let q=A?{...A}:{escape:w||!1,scroll:T||!1,resize:E||!1,clickOutsideAnchor:Oe||!1};j&&(Object.assign(K,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(ke,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(q,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),sd((()=>(Ee.current=!0,()=>{Ee.current=!1})),[]);let Ae=e=>{Ee.current&&(e&&U(!0),setTimeout((()=>{Ee.current&&(ie?.(e),L===void 0&&_e(e))}),10))};k((()=>{if(t){if(H){n(ae);let r=e(z),i=[...new Set([...r,t])].filter(Boolean).join(` `);z?.setAttribute(`aria-describedby`,i)}else n(z);return()=>{n(z),n(ae)}}function e(e){return(e?.getAttribute(`aria-describedby`))?.split(` `)||[]}function n(n){let r=e(n).filter((e=>e!==t));r.length?n?.setAttribute(`aria-describedby`,r.join(` `)):n?.removeAttribute(`aria-describedby`)}}),[z,H,t,ae]),k((()=>{if(L===void 0)return()=>null;L&&U(!0);let e=setTimeout((()=>{_e(L)}),10);return()=>{clearTimeout(e)}}),[L]),k((()=>{if(H!==ye.current){if(cd(me),ye.current=H,H)te?.();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`));me.current=setTimeout((()=>{U(!1),G(null),N?.()}),e+25)}}}),[H]);let je=e=>{ge((t=>id(t,e)?t:e))},Me=(e=g)=>{cd(fe),ve?Ae(!0):fe.current=setTimeout((()=>{Ae(!0)}),e)},Ne=(e=_)=>{cd(pe),pe.current=setTimeout((()=>{Ce.current||Ae(!1)}),e)},Pe=e=>{if(!e)return;let t=e.currentTarget??e.target;if(!t?.isConnected)return B(null),void Se({current:null});g?Me():Ae(!0),B(t),Se({current:t}),cd(pe)},Fe=()=>{x?Ne(_||100):_?Ne():Ae(!1),cd(fe)},Ie=({x:e,y:t})=>{ed({place:W?.place??l,offset:u,elementReference:{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})},tooltipReference:V.current,tooltipArrowReference:de.current,strategy:p,middlewares:m,border:oe,arrowSize:le}).then((e=>{je(e)}))},Le=e=>{if(!e)return;let t=e,n={x:t.clientX,y:t.clientY};Ie(n),be.current=n},Re=e=>{if(!H)return;let t=e.target;t.isConnected&&(V.current?.contains(t)||[document.querySelector(`[id='${o}']`),...we].some((e=>e?.contains(t)))||(Ae(!1),cd(fe)))},ze=nd(Pe,50,!0),Be=nd(Fe,50,!0),Ve=e=>{Be.cancel(),ze(e)},He=()=>{ze.cancel(),Be()},Ue=R((()=>{let e=W?.position??M;e?Ie(e):v?be.current&&Ie(be.current):z!=null&&z.isConnected&&ed({place:W?.place??l,offset:u,elementReference:z,tooltipReference:V.current,tooltipArrowReference:de.current,strategy:p,middlewares:m,border:oe,arrowSize:le}).then((e=>{Ee.current&&je(e)}))}),[H,z,F,ee,l,W?.place,u,p,M,W?.position,v,le]);k((()=>{var e,t;let n=new Set(xe);we.forEach((e=>{ne!=null&&ne(e)||n.add({current:e})}));let r=document.querySelector(`[id='${o}']`);r&&!(ne!=null&&ne(r))&&n.add({current:r});let i=()=>{Ae(!1)},a=od(z),s=od(V.current);q.scroll&&(window.addEventListener(`scroll`,i),a?.addEventListener(`scroll`,i),s?.addEventListener(`scroll`,i));let c=null;q.resize?window.addEventListener(`resize`,i):z&&V.current&&(c=C(z,V.current,Ue,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));let l=e=>{e.key===`Escape`&&Ae(!1)};q.escape&&window.addEventListener(`keydown`,l),q.clickOutsideAnchor&&window.addEventListener(`click`,Re);let u=[],d=e=>!!(e?.target&&z?.contains(e.target)),f=e=>{H&&d(e)||Pe(e)},p=e=>{H&&d(e)&&Fe()},m=[`mouseover`,`mouseout`,`mouseenter`,`mouseleave`,`focus`,`blur`],h=[`click`,`dblclick`,`mousedown`,`mouseup`];Object.entries(K).forEach((([e,t])=>{t&&(m.includes(e)?u.push({event:e,listener:Ve}):h.includes(e)&&u.push({event:e,listener:f}))})),Object.entries(ke).forEach((([e,t])=>{t&&(m.includes(e)?u.push({event:e,listener:He}):h.includes(e)&&u.push({event:e,listener:p}))})),v&&u.push({event:`pointermove`,listener:Le});let g=()=>{Ce.current=!0},_=()=>{Ce.current=!1,Fe()},y=x&&(ke.mouseout||ke.mouseleave);return y&&((e=V.current)==null||e.addEventListener(`mouseover`,g),(t=V.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;q.scroll&&(window.removeEventListener(`scroll`,i),a?.removeEventListener(`scroll`,i),s?.removeEventListener(`scroll`,i)),q.resize?window.removeEventListener(`resize`,i):c?.(),q.clickOutsideAnchor&&window.removeEventListener(`click`,Re),q.escape&&window.removeEventListener(`keydown`,l),y&&((e=V.current)==null||e.removeEventListener(`mouseover`,g),(t=V.current)==null||t.removeEventListener(`mouseout`,_)),u.forEach((({event:e,listener:t})=>{n.forEach((n=>{var r;(r=n.current)==null||r.removeEventListener(e,t)}))}))}}),[z,Ue,ve,xe,we,D,O,A,De,g,_]),k((()=>{let e=W?.anchorSelect??c??``;!e&&t&&(e=`[data-tooltip-id='${t.replace(/'/g,`\\'`)}']`);let n=new MutationObserver((n=>{let r=[],i=[];n.forEach((n=>{if(n.type===`attributes`&&n.attributeName===`data-tooltip-id`&&(n.target.getAttribute(`data-tooltip-id`)===t?r.push(n.target):n.oldValue===t&&i.push(n.target)),n.type===`childList`){if(z){let t=[...n.removedNodes].filter((e=>e.nodeType===1));if(e)try{i.push(...t.filter((t=>t.matches(e)))),i.push(...t.flatMap((t=>[...t.querySelectorAll(e)])))}catch{}t.some((e=>!!(e?.contains)?.call(e,z)&&(U(!1),Ae(!1),B(null),cd(fe),cd(pe),!0)))}if(e)try{let t=[...n.addedNodes].filter((e=>e.nodeType===1));r.push(...t.filter((t=>t.matches(e)))),r.push(...t.flatMap((t=>[...t.querySelectorAll(e)])))}catch{}}})),(r.length||i.length)&&Te((e=>[...e.filter((e=>!i.includes(e))),...r]))}));return n.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-tooltip-id`],attributeOldValue:!0}),()=>{n.disconnect()}}),[t,c,W?.anchorSelect,z]),k((()=>{Ue()}),[Ue]),k((()=>{if(!I?.current)return()=>null;let e=new ResizeObserver((()=>{setTimeout((()=>Ue()))}));return e.observe(I.current),()=>{e.disconnect()}}),[F,I?.current]),k((()=>{let e=document.querySelector(`[id='${o}']`),t=[...we,e];z&&t.includes(z)||B(we[0]??e)}),[o,we,z]),k((()=>(re&&Ae(!0),()=>{cd(fe),cd(pe)})),[]),k((()=>{let e=W?.anchorSelect??c;if(!e&&t&&(e=`[data-tooltip-id='${t.replace(/'/g,`\\'`)}']`),e)try{let t=Array.from(document.querySelectorAll(e));Te(t)}catch{Te([])}}),[t,c,W?.anchorSelect]),k((()=>{fe.current&&(cd(fe),Me(g))}),[g]);let We=W?.content??F,Ge=H&&Object.keys(he.tooltipStyles).length>0;return a(e,(()=>({open:e=>{if(e?.anchorSelect)try{document.querySelector(e.anchorSelect)}catch{console.warn(`[react-tooltip] "${e.anchorSelect}" is not a valid CSS selector`);return}G(e??null),e?.delay?Me(e.delay):Ae(!0)},close:e=>{e?.delay?Ne(e.delay):Ae(!1)},activeAnchor:z,place:he.place,isOpen:!!(ve&&!y&&We&&Ge)}))),ve&&!y&&We?s.createElement(h,{id:t,role:ue,className:(0,Yu.default)(`react-tooltip`,pd.tooltip,md.tooltip,md[i],n,`react-tooltip__place-${he.place}`,pd[Ge?`show`:`closing`],Ge?`react-tooltip__show`:`react-tooltip__closing`,p===`fixed`&&pd.fixed,x&&pd.clickable),onTransitionEnd:e=>{cd(me),H||e.propertyName!==`opacity`||(U(!1),G(null),N?.())},style:{...ee,...he.tooltipStyles,opacity:se!==void 0&&Ge?se:void 0},ref:V},s.createElement(h,{className:(0,Yu.default)(`react-tooltip-content-wrapper`,pd.content,md.content)},We),s.createElement(h,{className:(0,Yu.default)(`react-tooltip-arrow`,pd.arrow,md.arrow,r,b&&pd.noArrow),style:{...he.tooltipArrowStyles,background:ce?`linear-gradient(to right bottom, transparent 50%, ${ce} 50%)`:void 0,"--rt-arrow-size":`${le}px`},ref:de})):null},gd=({content:e})=>s.createElement(`span`,{dangerouslySetInnerHTML:{__html:e}}),_d=s.forwardRef((({id:e,anchorId:t,anchorSelect:n,content:r,html:i,render:a,className:o,classNameArrow:c,variant:l=`dark`,place:u=`top`,offset:d=10,wrapper:f=`div`,children:p=null,events:m=[`hover`],openOnClick:h=!1,positionStrategy:g=`absolute`,middlewares:_,delayShow:v=0,delayHide:y=0,float:b=!1,hidden:x=!1,noArrow:C=!1,clickable:w=!1,closeOnEsc:T=!1,closeOnScroll:E=!1,closeOnResize:D=!1,openEvents:O,closeEvents:A,globalCloseEvents:j,imperativeModeOnly:ee=!1,style:M,position:te,isOpen:N,defaultIsOpen:ne=!1,disableStyleInjection:F=!1,border:I,opacity:L,arrowColor:re,arrowSize:ie,setIsOpen:R,afterShow:ae,afterHide:z,disableTooltip:B,role:oe=`tooltip`},se)=>{let[ce,le]=P(r),[ue,V]=P(i),[de,fe]=P(u),[pe,me]=P(l),[he,ge]=P(d),[H,_e]=P(v),[ve,U]=P(y),[W,G]=P(b),[ye,be]=P(x),[xe,Se]=P(f),[Ce,we]=P(m),[Te,Ee]=P(g),[De,Oe]=P(null),[K,ke]=P(null),q=S(null),Ae=S(F),{anchorRefs:je,activeAnchor:Me}=fd(e),Ne=e=>e?.getAttributeNames().reduce(((t,n)=>(n.startsWith(`data-tooltip-`)&&(t[n.replace(/^data-tooltip-/,``)]=e?.getAttribute(n)??null),t)),{}),Pe=e=>{let t={place:e=>{fe(e??u)},content:e=>{le(e??r)},html:e=>{V(e??i)},variant:e=>{me(e??l)},offset:e=>{ge(e===null?d:Number(e))},wrapper:e=>{Se(e??f)},events:e=>{let t=e?.split(` `);we(t??m)},"position-strategy":e=>{Ee(e??g)},"delay-show":e=>{_e(e===null?v:Number(e))},"delay-hide":e=>{U(e===null?y:Number(e))},float:e=>{G(e===null?b:e===`true`)},hidden:e=>{be(e===null?x:e===`true`)},"class-name":e=>{Oe(e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,n])=>{var r;(r=t[e])==null||r.call(t,n)}))};k((()=>{le(r)}),[r]),k((()=>{V(i)}),[i]),k((()=>{fe(u)}),[u]),k((()=>{me(l)}),[l]),k((()=>{ge(d)}),[d]),k((()=>{_e(v)}),[v]),k((()=>{U(y)}),[y]),k((()=>{G(b)}),[b]),k((()=>{be(x)}),[x]),k((()=>{Ee(g)}),[g]),k((()=>{Ae.current!==F&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[F]),k((()=>{typeof window<`u`&&window.dispatchEvent(new CustomEvent(`react-tooltip-inject-styles`,{detail:{disableCore:F===`core`,disableBase:F}}))}),[]),k((()=>{let r=new Set(je),i=n;if(!i&&e&&(i=`[data-tooltip-id='${e.replace(/'/g,`\\'`)}']`),i)try{document.querySelectorAll(i).forEach((e=>{r.add({current:e})}))}catch{console.warn(`[react-tooltip] "${i}" is not a valid CSS selector`)}let a=document.querySelector(`[id='${t}']`);if(a&&r.add({current:a}),!r.size)return()=>null;let o=K??a??Me.current,s=new MutationObserver((e=>{e.forEach((e=>{if(!o||e.type!==`attributes`||!e.attributeName?.startsWith(`data-tooltip-`))return;let t=Ne(o);Pe(t)}))})),c={attributes:!0,childList:!1,subtree:!1};if(o){let e=Ne(o);Pe(e),s.observe(o,c)}return()=>{s.disconnect()}}),[je,Me,K,t,n]),k((()=>{M!=null&&M.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),I&&!td(`border`,`${I}`)&&console.warn(`[react-tooltip] "${I}" is not a valid \`border\`.`),M!=null&&M.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),L&&!td(`opacity`,`${L}`)&&console.warn(`[react-tooltip] "${L}" is not a valid \`opacity\`.`)}),[]);let Fe=p,Ie=S(null);if(a){let e=a({content:K?.getAttribute(`data-tooltip-content`)||ce||null,activeAnchor:K});Fe=e?s.createElement(`div`,{ref:Ie,className:`react-tooltip-content-wrapper`},e):null}else ce&&(Fe=ce);ue&&(Fe=s.createElement(gd,{content:ue}));let Le={forwardRef:se,id:e,anchorId:t,anchorSelect:n,className:(0,Yu.default)(o,De),classNameArrow:c,content:Fe,contentWrapperRef:Ie,place:de,variant:pe,offset:he,wrapper:xe,events:Ce,openOnClick:h,positionStrategy:Te,middlewares:_,delayShow:H,delayHide:ve,float:W,hidden:ye,noArrow:C,clickable:w,closeOnEsc:T,closeOnScroll:E,closeOnResize:D,openEvents:O,closeEvents:A,globalCloseEvents:j,imperativeModeOnly:ee,style:M,position:te,isOpen:N,defaultIsOpen:ne,border:I,opacity:L,arrowColor:re,arrowSize:ie,setIsOpen:R,afterShow:ae,afterHide:z,disableTooltip:B,activeAnchor:K,previousActiveAnchor:q.current,setActiveAnchor:e=>{ke((t=>(e!=null&&e.isSameNode(t)||(q.current=t),e)))},role:oe};return s.createElement(hd,{...Le})}));typeof window<`u`&&window.addEventListener(`react-tooltip-inject-styles`,(e=>{e.detail.disableCore||$u({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||$u({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`})})),I();var vd={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,volumeNormalizer:null,playbackError:null,playbackErrors:[],ready:!1,setSourceState:()=>{}},yd=Sl({name:`source`,state:()=>({...vd}),attach({set:e}){e({setSourceState:t=>e(t),setHideUI:t=>e({hideUI:t})})}}),bd=Ku({features:[...Ru,yd],displayName:`MediaPlayer`}),$=bd.usePlayer,xd=e=>{if(e&&e!==`und`)try{return new Intl.DisplayNames([navigator.language||`en`],{type:`language`,fallback:`none`}).of(e)||void 0}catch{return}},Sd=e=>e?.replace(/_/g,` `).trim()||void 0,Cd=e=>{let t=e.map(e=>xd(e.language)??Sd(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=Sd(e.title);return{track:e,label:(n[i]??0)>1&&a&&a!==i?`${i} (${a})`:i}})},wd=e=>Cd(e).map(({track:e,label:t})=>({id:e.streamIndex,label:t})),Td=[0,250,1e3,3e3,1e4],Ed=6e4,Dd=500,Od=15e3,kd=e=>e instanceof Error?e.message:String(e),Ad=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(kd(n)),n=n?.cause}return t.length?t.join(`
5
+ `):void 0},jd=(e,t,n)=>{let r=$(),{read:i,size:a,publicPath:o=``,libavWorkerUrl:s=``,jassubWorkerUrl:c=``,jassubWasmUrl:l=``,jassubLegacyWasmUrl:u,defaultFontUrl:d,bufferSize:f,autoplay:p=!1,chapters:m,seekPrepareBudgetMs:h=Dd}=n??{},g=S(m);g.current=m;let[_,v]=P(void 0),[y,b]=P(0),x=S({count:0,at:0}),C=S(void 0);k(()=>(x.current={count:0,at:0},r.setSourceState({playbackErrors:[]}),()=>{C.current&&clearTimeout(C.current)}),[a]);let w=S(null),T=S(null),E=S(!1),D=S(i);D.current=i;let O=S(n?.onSeek);O.current=n?.onSeek;let A=S(n?.onPlaybackError);A.current=n?.onPlaybackError;let j=R(e=>{let t=typeof e==`number`?e:void 0;E.current=!0,r.setSourceState({selectedSubtitleTrack:t}),w.current?.selectSubtitleStream(t)},[r]),ee=R(e=>{let t=w.current;if(!t||h<=0){r.seek(e);return}let n=typeof window<`u`&&window.__mediaPlayerSeekDebug,i=performance.now(),a=!1,o=`prepared`,s=()=>{if(!a&&(a=!0,r.seek(e),n)){let n=t.videoElement,r=0;if(n)for(let t=0;t<n.buffered.length;t++)n.buffered.start(t)<=e+1&&e<n.buffered.end(t)&&(r=n.buffered.end(t)-e);console.warn(`[media-player] seek to ${e.toFixed(2)} moved after ${Math.round(performance.now()-i)}ms via ${o}, runway ${r.toFixed(1)}s${o===`deadline`?` (EXPOSED: moved before its data was ready)`:``}`)}};r.setSourceState({seekingTo:e});let c=t.videoElement,l=()=>{c?.removeEventListener(`seeked`,l),clearTimeout(u),r.setSourceState({seekingTo:void 0})},u=setTimeout(l,Od);c?.addEventListener(`seeked`,l);let d=setTimeout(()=>{o=`deadline`,s()},h);t.prepareSeek(e).catch(()=>{}).finally(()=>{clearTimeout(d),s()})},[r,h]),M=R(e=>{typeof e==`number`&&(r.setSourceState({selectedAudioTrack:e}),v(e))},[r]),te=$(e=>e.setSourceState);k(()=>{te({selectSubtitleTrack:j,selectAudioTrack:M,requestSeek:ee})},[te,j,M,ee]),k(()=>{if(!e||!t||!a||!i)return;let n=!1;r.setSourceState({playbackError:null,ready:!1});let m=(t,n)=>{let i=Date.now(),a=kd(t),o=Ad(t),s=r.playbackErrors,c=s[s.length-1];if(c&&c.message===a&&c.detail===o&&c.recovered===n){let e={...c,count:c.count+1,lastAt:i};r.setSourceState({playbackErrors:[...s.slice(0,-1),e]});return}let l={at:i,lastAt:i,count:1,atMediaTime:Number.isFinite(e.currentTime)?e.currentTime:void 0,message:a,detail:o,recovered:n};r.setSourceState({playbackErrors:[...s,l]})},h=e=>{if(n)return;let t=hs(e);if(m(e,t),t){let t=performance.now();t-x.current.at>Ed&&(x.current={count:0,at:t});let n=Td[Math.min(x.current.count,Td.length-1)];x.current={count:x.current.count+1,at:t},console.warn(`the media element failed; rebuilding the pipeline${n?` in ${n}ms`:``}`,e),C.current&&clearTimeout(C.current),C.current=setTimeout(()=>b(e=>e+1),n);return}console.error(`playback failed`,e),r.setSourceState({playbackError:e}),A.current?.(e)};return(async()=>{try{let i=await As({videoElement:e,subtitleContainer:t,read:(e,t)=>D.current(e,t),length:a,publicPath:o,libavWorkerUrl:s,jassubWorkerUrl:c,jassubWasmUrl:l,jassubLegacyWasmUrl:u,defaultFontUrl:d,bufferSize:f,audioStreamIndex:_,onReady:()=>{if(n)return;r.setSourceState({ready:!0});let t=T.current;T.current=null,t&&t.size===a&&t.time>0&&(e.currentTime=t.time),p&&e.play().catch(()=>{})},onError:h,onRecovered:()=>{n||r.setSourceState({playbackError:null})},onSeek:e=>O.current?.(e),onSubtitleStreams:e=>{n||r.setSourceState({subtitleTracks:wd(e),...E.current?{}:{selectedSubtitleTrack:e[0]?.streamIndex}})},onAudioStreams:(e,t)=>{n||r.setSourceState({audioTracks:wd(e),selectedAudioTrack:t})}});if(n){i.destroy();return}w.current=i,r.setSourceState({indexes:i.indexes,chapters:g.current??i.chapters});let m=r.selectedSubtitleTrack;typeof m==`number`&&i.selectSubtitleStream(m)}catch(e){h(e)}})(),()=>{n=!0,T.current={time:e.currentTime,size:a},w.current?.destroy(),w.current=null,r.setSourceState({ready:!1})}},[r,e,t,a,o,s,c,l,u,d,f,_,p,y])},Md=5e3,Nd=6e4,Pd=({publicPath:e,workerUrl:t,length:n,read:r,downloadedRanges:i})=>{let[a,o]=P([]),s=S(null),c=S(r);c.current=r;let l=w(()=>i?.map(({startByteOffset:e,endByteOffset:t})=>[e,t]),[i?.map(({startByteOffset:e,endByteOffset:t})=>`${e}-${t}`).join(`,`)]),u=S(l);return u.current=l,k(()=>{if(!n||!r||!e||!t)return;let i=!1,a=null,l,d=Md,f=()=>{Bs({publicPath:e,workerUrl:t,length:n,read:(e,t)=>c.current(e,t),onThumbnails:e=>{i||o(e)}}).then(e=>{if(i){e.destroy();return}a=e,s.current=e,e.update(u.current)},()=>{i||(l=setTimeout(f,d),d=Math.min(d*2,Nd))})};return f(),()=>{i=!0,clearTimeout(l),s.current=null,a?.destroy(),o([])}},[n,e,t]),k(()=>{s.current?.update(l)},[l]),{thumbnails:a,requestThumbnail:R(e=>{s.current?.prioritize(e)},[])}},Fd=(e,t)=>{let n=S(null),[r,i]=P(!1),[a]=P(()=>Js());k(()=>{if(!e||!t||!a)return;let r=Ys({video:e,subtitles:t,mode:a,onBurnedInChange:i});return n.current=r,()=>{r.destroy(),n.current=null,i(!1)}},[e,t,a]);let o=R(()=>{n.current?.toggle().catch(e=>{console.warn(`picture in picture was refused`,e)})},[]);return{toggle:e&&t&&a?o:null,mode:a,burnedIn:r}},Id=`(hover: hover) and (pointer: fine)`,Ld=()=>typeof matchMedia==`function`?matchMedia(Id):void 0,Rd=e=>{let t=Ld();return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)},zd=()=>!!Ld()?.matches,Bd=()=>!1,Vd=(e,t)=>{let[n,r]=P(!1),[i,a]=P(),o=S(t);t&&(o.current=t);let s=S(!1),c=R(e=>{s.current!==e&&(s.current=e,o.current?.onArmedChange(e))},[]),l=R(t=>{!e||e.readyState<1||e.error||(a(t),c(!0))},[e,c]),u=R(()=>{a(void 0),c(!1)},[c]),d=!!t&&!!e;k(()=>{if(!d||!e)return;let t=()=>{r(!0),u()},n=()=>r(!1);return e.addEventListener(`enterpictureinpicture`,t),e.addEventListener(`leavepictureinpicture`,n),()=>{e.removeEventListener(`enterpictureinpicture`,t),e.removeEventListener(`leavepictureinpicture`,n),r(!1),u()}},[e,d,u]);let f=z(Rd,zd,Bd),[p,m]=P(!1);k(()=>{if(!d)return;let e=e=>{e.pointerType===`touch`&&m(!0)},t=e=>{e.pointerType!==`touch`&&m(!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})}},[d]);let h=d&&f&&!p;k(()=>{h||u()},[h,u]);let g=R(()=>{Promise.resolve(e?.exitPictureInPicture?.()).catch(e=>{console.warn(`leaving picture in picture was refused`,e)})},[e]);return w(()=>h?{active:n,armed:i,arm:l,disarm:u,exit:g}:null,[h,n,i,l,u,g])},Hd=async(e,t,n={})=>(await e.audioWorklet.addModule(t),new AudioWorkletNode(e,`banou-volume-normalizer`,{channelCountMode:`max`,processorOptions:n})),Ud=new WeakMap,Wd=e=>new Promise((t,n)=>{let r=()=>{(e.state===`running`||e.state===`closed`)&&(e.removeEventListener(`statechange`,r),e.state===`running`?t():n(new DOMException(`The AudioContext closed before it ran`,`InvalidStateError`)))};e.addEventListener(`statechange`,r),r()}),Gd=(e,t,n={})=>{let r=Ud.get(e);if(r)return r.wake(),r;let i=new AudioContext,a=n.enabled!==!1,o,s=!1,c=()=>20*Math.log10(Math.max(e.volume,1e-6)),l=e.ownerDocument,u=()=>{i.state===`suspended`&&i.resume().catch(()=>{})},d=e=>{for(let t of[`pointerdown`,`pointerup`,`keydown`])e?l.addEventListener(t,u,!0):l.removeEventListener(t,u,!0)},f=()=>{let e=!s&&i.state===`suspended`;d(e),e&&o&&u()};i.addEventListener(`statechange`,f),f();let p=(async()=>{let r=await Hd(i,t,{...n,enabled:a,inputGainDb:c()});await Wd(i);let s=qu(i,e);return r.port.postMessage({enabled:a,inputGainDb:c()}),s.connect(r).connect(i.destination),e.addEventListener(`volumechange`,()=>r.port.postMessage({inputGainDb:c()})),e.addEventListener(`seeking`,()=>r.port.postMessage({reset:`seek`})),e.addEventListener(`emptied`,()=>r.port.postMessage({reset:`source`})),o=r,r})();p.catch(()=>{s=!0,d(!1),i.close().catch(()=>{})});let m={context:i,routed:p,setEnabled:e=>{a=e,o?.port.postMessage({enabled:a})},release:()=>{s=!0,d(!1),e.isConnected?i.state===`running`&&i.suspend().catch(()=>{}):(Ud.delete(e),i.close().catch(()=>{}))},wake:()=>{i.state!==`closed`&&(s=!1,u(),f())}};return Ud.set(e,m),m},Kd=(e,t,n)=>{let r=S(null),[i,a]=P(!1);return k(()=>{if(e&&t){if(n&&!r.current){let i=Gd(e,t,{enabled:n});r.current=i,i.routed.catch(e=>{r.current===i&&(console.warn(`[media-player] the volume normalizer is unavailable:`,e),a(!0))})}r.current?.setEnabled(n)}},[e,t,n]),k(()=>()=>{r.current?.release(),r.current=null},[e]),{refused:i}},qd={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
+ `}},Jd=d`
138
+ display: flex;
139
+ justify-content: center;
140
+ align-items: center;
141
+
142
+ canvas {
143
+ top: unset !important;
144
+ left: unset !important;
145
+ width: 100%;
146
+ height: 100%;
147
+ margin: auto;
148
+ pointer-events: none;
149
+ }
150
+ `,Yd=d`
151
+ position: absolute;
152
+ top: 0;
153
+ left: 0;
154
+ width: 100%;
155
+ padding: calc(1.2 * var(--mp-unit)) calc(1.6 * var(--mp-unit));
156
+ /* clears a notch once the player is fullscreen; resolves to zero everywhere else */
157
+ padding-top: calc(calc(1.2 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
158
+ ${qd.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
+ `,Xd=p`
180
+ to { transform: rotate(360deg); }
181
+ `,Zd=d`
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: ${Xd} 0.8s linear infinite;
198
+ }
199
+ `,Qd=d`
200
+ position: absolute;
201
+ inset: auto 0 20%;
202
+ z-index: 3;
203
+ padding: 0 calc(2 * var(--mp-unit));
204
+ text-align: center;
205
+ color: #fff;
206
+ ${qd.bLarge.regular}
207
+ text-shadow: 0 0 4px rgba(0, 0, 0, 1);
208
+ pointer-events: none;
209
+ `,$d=e=>e instanceof Error?e.message:typeof e==`string`?e:`Playback failed`,ef=({onSubtitleRef:e})=>{let t=$(e=>e.title),n=$(e=>e.hideUI),r=$(e=>e.playbackError),i=$(e=>e.ready),a=$(e=>e.size),o=$(e=>e.waiting),s=$(e=>e.seekingTo);return L(ie,{children:[t?N(`div`,{className:`title`,css:Yd,style:{...n?{opacity:`0`,pointerEvents:`none`}:{}},children:t}):void 0,((a?!i:o)||s!==void 0)&&!r?N(`div`,{css:Zd}):void 0,r?N(`div`,{css:Qd,children:$d(r)}):void 0,N(`div`,{className:`subtitles`,ref:e,css:Jd})]})},tf=1e-4,nf=1,rf=e=>Math.max(tf,Math.min(nf,e))**2,af=e=>Math.max(tf,Math.min(nf,e))**(nf/2),of=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}`},sf=(e,t)=>`${of(e)} / ${of(t)}`,cf=e=>d`
210
+ display: flex;
211
+ justify-content: flex-start;
212
+
213
+ /*
214
+ * Bounded here rather than at each call site.
215
+ *
216
+ * react-tooltip's own chip rule carries width: max-content, so with nothing opposing it a chip
217
+ * grows to the widest UNWRAPPED line of its content: a two sentence tooltip measured 1178px
218
+ * through this component. Both declarations are load bearing, since a bound with no wrapping only
219
+ * moves the overflow inside a narrow box. 26 units is the width control-bar.tsx was already
220
+ * imposing on its own two line tooltip by hand, so nothing in the bar changes shape.
221
+ */
222
+ max-width: min(calc(26 * var(--mp-unit)), calc(100vw - calc(2.4 * var(--mp-unit))));
223
+ white-space: normal;
224
+ overflow-wrap: anywhere;
225
+ text-align: left;
226
+
227
+ /*
228
+ * The radius carries !important for the same reason the paddings below do.
229
+ *
230
+ * react-tooltip injects its stylesheet from a passive effect while emotion inserts through
231
+ * useInsertionEffect, which runs earlier, so react-tooltip's sheet lands in the head LAST at
232
+ * exactly this specificity and wins every tie. Its own radius is 3px, which is what was drawn
233
+ * here until this was stated.
234
+ */
235
+ border-radius: calc(0.4 * var(--mp-unit))!important;
236
+ user-select: none;
237
+
238
+ z-index: 3;
239
+
240
+ * {
241
+ ${qd.bMedium.regular}
242
+ }
243
+
244
+ ${e===`sm`&&d`
245
+ padding: calc(0.4 * var(--mp-unit))!important;
246
+ `}
247
+ ${e===`md`&&d`
248
+ padding: calc(0.6 * var(--mp-unit))!important;
249
+ `}
250
+ ${e===`lg`&&d`
251
+ padding: calc(1.2 * var(--mp-unit))!important;
252
+ `}
253
+ `,lf={x:-1,y:-1,anchors:0},uf=e=>{lf.x=e.clientX,lf.y=e.clientY},df=()=>(lf.anchors++===0&&window.addEventListener(`pointermove`,uf,{capture:!0,passive:!0}),()=>{--lf.anchors===0&&window.removeEventListener(`pointermove`,uf,{capture:!0})}),ff=({id:e,toolTipText:t,text:n,delayShow:r=0,closeDelay:i=0,offset:a=20,tooltipPlace:o=`top`,disabled:s=!1,size:c=`md`})=>{let l=S(null),u=S(null);return k(()=>{let e=df(),t=()=>{let e=l.current;if(!e)return;let{left:t,right:n,top:r,bottom:i}=e.getBoundingClientRect();lf.x>=t&&lf.x<n&&lf.y>=r&&lf.y<i||u.current?.close()},n=[`fullscreenchange`,`webkitfullscreenchange`];for(let e of n)document.addEventListener(e,t);return()=>{e();for(let e of n)document.removeEventListener(e,t)}},[]),L(ie,{children:[N(`div`,{ref:l,"data-tooltip-id":e,"data-open":!0,"data-tooltip-offset":a,"data-tooltip-delay-show":r,"data-tooltip-delay-hide":i,"data-tooltip-place":o,children:n}),!s&&N(_d,{ref:u,css:cf(c),id:e,noArrow:!0,children:t})]})},pf=({ref:e,onChange:t,orientation:n=`horizontal`,disabled:r=!1})=>{let[i,a]=P(!1),o=S(t);o.current=t;let s=S(null),c=R((t,r)=>{let i=e.current;if(!i)return 0;let{left:a,right:o,top:s,bottom:c}=i.getBoundingClientRect(),l=n===`horizontal`?(t-a)/(o-a):(c-r)/(c-s);return Math.min(Math.max(l,0),1)},[e,n]),l=R(e=>{if(!(r||e.button>0)){s.current=e.pointerId;try{e.currentTarget.setPointerCapture?.(e.pointerId)}catch{}a(!0),o.current(c(e.clientX,e.clientY))}},[r,c]),u=R(e=>{s.current===e.pointerId&&o.current(c(e.clientX,e.clientY))},[c]),d=R(e=>{if(s.current===e.pointerId){s.current=null;try{e.currentTarget.releasePointerCapture?.(e.pointerId)}catch{}a(!1)}},[]);return k(()=>{r&&(s.current=null,a(!1))},[r]),{dragging:i,handlers:{onPointerDown:l,onPointerMove:u,onPointerUp:d,onPointerCancel:d,style:{touchAction:`none`}}}},mf=2,hf=.005,gf=`#000`,_f=`#0000`,vf=(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<=hf||r>=.995||n.add(Number((r*100).toFixed(4)))}return n.size?[0,...[...n].sort((e,t)=>e-t),100]:[]},yf=(e,t)=>{let n=mf/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)?gf:_f} ${c} ${l}`),a!==r&&i.push(`${_f} calc(${s}% - ${n}px) calc(${s}% + ${n}px)`)}return`linear-gradient(90deg, ${i.join(`, `)})`},bf=new Set([`op`,`ops`,`opening`,`openings`,`ncop`,`オープニング`,`op主題歌`]),xf=new Set([`ed`,`eds`,`ending`,`endings`,`nced`,`credits`,`endcard`,`endroll`,`エンディング`,`エンドカード`,`エンドロール`,`ed主題歌`]),Sf=new Set([`intro`,`イントロ`]),Cf=new Set([`outro`,`アウトロ`]),wf={"credits start":`ending`,"credits end":null,"preview end":null,"end credits":`ending`,"closing credits":`ending`},Tf=new Set([`theme`,`themes`,`song`,`sequence`,`nc`,`non`,`credit`,`creditless`,`textless`,`clean`,`tv`,`size`,`version`,`ver`,`full`,`the`,`主題歌`,`ノンクレジット`]),Ef=new Set([`post`,`pre`,`after`,`before`,`non`]),Df=/[-:|~/\\[\]()「」『』【】,.!?"'’]|\s+by\s+/u,Of=e=>!e.trim()||/^chapter\s*\d+$/i.test(e.trim())||/^\d{1,2}:\d{2}:\d{2}([.,]\d+)?$/.test(e.trim()),kf=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)&&!Tf.has(e)),Af=(e,t)=>{if(bf.has(e))return`opening`;if(xf.has(e))return`ending`;if(t){if(Sf.has(e))return`opening`;if(Cf.has(e))return`ending`}},jf=(e,t)=>{if(Of(e))return;let n=e.trim().toLowerCase().replace(/\s+/gu,` `);if(n in wf)return wf[n]??void 0;let r=n.split(Df).map(e=>e.trim()).filter(Boolean);if(r.some(e=>e.split(/[\s_]+/u).some(e=>Ef.has(e))))return;let i=r.length>1?[r[0],r.at(-1)]:r;for(let e of i){let n=kf(e);if(n.length!==1)continue;let r=Af(n[0],t);if(r)return r}},Mf=15,Nf=87,Pf=93,Ff=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>=Nf&&e<=Pf),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},If=e=>{let t=e.map(({title:e})=>jf(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<Mf)return;let r=t[n];if(r)return r;let i=jf(e.title,!0);return i&&!t.includes(i)?i:void 0});return e.every(({title:e})=>Of(e))?Ff(e):i},Lf=d`
254
+ position: relative;
255
+ height: calc(.4 * var(--mp-unit));
256
+
257
+ --thumbnail-width: calc(25 * var(--mp-unit));
258
+ --thumbnail-half: calc(12.5 * var(--mp-unit));
259
+
260
+ transition: transform .2s ease-in-out;
261
+
262
+ margin: 0 12px;
263
+ @media (min-width: 768px) {
264
+ margin: 0 16px;
265
+ }
266
+ @media (min-width: 2560px) {
267
+ margin: 0 24px;
268
+ }
269
+
270
+ user-select: none;
271
+ cursor: pointer;
272
+
273
+ :hover {
274
+ .background-bar {
275
+ transform: scaleY(1.5);
276
+ }
277
+ .loaded {
278
+ transform: scaleY(1.5);
279
+ top: calc(-.1 * var(--mp-unit));
280
+ }
281
+ .play-container {
282
+ transform: scaleY(1.5);
283
+ }
284
+ }
285
+
286
+ /*
287
+ * One copy of the track per mask, stacked.
288
+ *
289
+ * The rest track paints every segment except the one under the pointer, the focus track paints only that one and
290
+ * is the only element that grows. Both are full bar width, which is what keeps every percentage
291
+ * and every scaleX inside them meaning exactly what it meant before chapters existed: the gaps are
292
+ * cut by a mask, not by resizing anything.
293
+ *
294
+ * The mask sits HERE and never on .loaded-part or .play. Those two carry a scaleX, and a mask
295
+ * travels with its element's transform, so a gap drawn on them would slide with the fill.
296
+ */
297
+ .track {
298
+ position: absolute;
299
+ inset: 0;
300
+ /* never a hit target: .padding is the only one, and a second would break the drag gesture and
301
+ fire a bubbling mouseout at every boundary crossing */
302
+ pointer-events: none;
303
+ }
304
+
305
+ /*
306
+ * The segment under the pointer, on TOP of the growth the whole bar already got.
307
+ *
308
+ * Measured off YouTube's live player, hovering one chapter of five: every other segment goes 4px
309
+ * to 6px, and the one under the pointer goes to 10px. Both grow about the bar's centre line, so
310
+ * the emphasised segment bulges above and below its neighbours rather than sitting on them. 6 x
311
+ * 1.667 is 10, and the 1.5 the layers inside already carry gets this track from 4 to exactly that.
312
+ */
313
+ .track.focus {
314
+ transform: scaleY(1.667);
315
+ }
316
+
317
+
318
+ .background-bar {
319
+ position: absolute;
320
+ inset: 0;
321
+ background-color: hsla(0, 100%, 100%, .2);
322
+ }
323
+
324
+ .cursor-time {
325
+ display: flex;
326
+ justify-content: center;
327
+
328
+ /* The seekbar's other hover affordance, the thumbnail below, gets a rounded box and a drop
329
+ shadow. A source that ships no thumbnails, which is every source whose media the player does
330
+ not own, leaves this readout as the entire preview, so it carries the same treatment instead
331
+ of sitting as bare text on the picture. The ink comes from the player root. */
332
+ background-color: rgba(28, 28, 28, .95);
333
+ border-radius: calc(.4 * var(--mp-unit));
334
+ padding: 0 calc(.6 * var(--mp-unit));
335
+ box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
336
+
337
+ text-shadow: 0 0 4px rgba(0, 0, 0, 1);
338
+ ${qd.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
+ `,Rf=4,zf=()=>{let e=$(),t=$(e=>e.currentTime),n=$(e=>e.requestSeek),r=$(e=>e.duration),i=$(e=>e.size),a=$(e=>e.downloadedRanges),o=$(e=>e.buffered),s=$(e=>e.indexes),c=$(e=>e.thumbnails),l=$(e=>e.thumbnailAt),u=$(e=>e.requestThumbnail),d=$(e=>e.chapters),f=$(e=>e.seekingTo),p=$(e=>e.setSourceState),m=$(e=>e.hideUI),h=S(null),[g,_]=P(void 0),[v,y]=P(void 0),b=e=>{y(e),u(e)},x=!!v;k(()=>{if(x)return p({seekPreview:!0}),()=>p({seekPreview:!1})},[p,x]),k(()=>{m&&b(void 0)},[m]);let C=S(void 0),T=S(0),E=S(void 0),D=S(void 0),O=S(!1),{dragging:A,handlers:j}=pf({ref:h,onChange:e=>{if(T.current+=1,E.current=e,D.current===void 0)D.current=e;else if(!O.current){let t=h.current?.getBoundingClientRect().width??0;Math.abs(e-D.current)*t>Rf&&(O.current=!0)}_(e),C.current!==`mouse`&&b(e*r)}}),ee=e=>{C.current=e.pointerType,T.current=0,D.current=void 0,O.current=!1,j.onPointerDown(e)},M=t=>{j.onPointerUp(t);let i=T.current>0?E.current:void 0;if(i!==void 0&&r){let t=i*r;n?n(t):e.seek(t)}T.current=0,O.current=!1,D.current=void 0,t.pointerType!==`mouse`&&b(void 0)},te=e=>{if(!h.current)return;let{left:t,right:n}=h.current.getBoundingClientRect();return Math.min(Math.max((e-t)/(n-t),0),1)*r},ne=S(`mouse`),F=e=>{ne.current=e.pointerType},I=e=>{ne.current!==`touch`&&b(te(e.clientX))},re=()=>{h.current&&b(void 0)},ie=e=>r?e/r*100:0,R=(e,t,n)=>{let r=Number((n-t).toFixed(4)),i=t*100;return N(`div`,{className:`loaded-part`,style:{transform:`scaleX(${r})`,marginLeft:`${i}%`}},e)},ae=w(()=>i===void 0?r?o.map(([e,t],n)=>R(n,e/r,t/r)):[]:a?.map((e,t)=>{if(!i||!r)return null;let n=s.filter(t=>e.startByteOffset<=t.pos&&t.pos<=e.endByteOffset),a=n.at(0),o=n.at(-1);return!a||!o?null:R(t,a.timestamp/r,o.timestamp/r)})??[],[r,i,i===void 0?o:void 0,s.length,a?.map(({startByteOffset:e,endByteOffset:t})=>`${e}/${t}`).join(`,`)]);k(()=>{g!==void 0&&r&&A&&O.current&&e.seek(g*r)},[e,A,g,r]);let z=w(()=>{if(!r)return 0;if(A&&g!==void 0)return g;let e=f??t;return typeof e==`number`?e/r:0},[r,t,A,g,f]),B=w(()=>vf(d,r),[d,r]),oe=B.length>0,se=w(()=>{if(!oe||v===void 0||!r)return-1;let e=v/r*100,t=B.findIndex((t,n)=>n<B.length-1&&e>=t&&e<B[n+1]);return t>=0?t:B.length-2},[oe,B,v,r]),ce=w(()=>oe?yf(B,e=>e!==se):void 0,[oe,B,se]),le=w(()=>se>=0?yf(B,e=>e===se):void 0,[B,se]),ue=w(()=>{if(v!==void 0)return d.find(({start:e,end:t})=>e<=v&&v<t)},[d,v]),V=w(()=>{if(v){if(l)return l(v);if(c.length)return c.find(({startTime:e,endTime:t})=>e<=v&&v<t)}},[c,l,v]),de=(e,t)=>L(`div`,{className:e?`track ${e}`:`track`,style:t?{maskImage:t}:void 0,children:[N(`div`,{className:`background-bar`}),N(`div`,{className:`loaded`,children:ae}),N(`div`,{className:`play-container`,children:N(`div`,{className:`play`,style:{transform:`scaleX(${z})`}})})]});return L(`div`,{css:Lf,ref:h,className:[`progress-bar`,A?`dragging`:``,oe?`segmented`:``].filter(Boolean).join(` `),onPointerDown:F,onPointerMove:F,onMouseMove:I,onMouseOut:re,children:[de(void 0,ce),v?L(`div`,{className:`cursor-time`,style:{left:ue?`clamp(var(--thumbnail-half), ${ie(v)}%, calc(100% - var(--thumbnail-half)))`:`clamp(calc(3 * var(--mp-unit)), ${ie(v)}%, calc(100% - calc(3 * var(--mp-unit))))`,maxWidth:ue?`var(--thumbnail-width)`:void 0},children:[N(`span`,{className:`cursor-time-value`,children:of(v)}),ue?N(`span`,{className:`chapter-title`,children:ue.title}):void 0]}):void 0,N(`div`,{className:`progress`}),N(`div`,{className:`hover`}),le?de(`focus`,le):void 0,N(`div`,{className:`scrubber`}),N(`div`,{className:`padding`,...j,onPointerDown:ee,onPointerUp:M,onPointerCancel:M}),N(`div`,{className:`thumbnail`,style:{left:`clamp(var(--thumbnail-half), ${ie(v??1)}%, calc(100% - var(--thumbnail-half)))`},children:V?.url?N(`img`,{src:V.url}):void 0})]})},Bf=`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`,Vf={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`},Hf=e=>L(`svg`,{...Vf,...e,children:[N(`path`,{d:`M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5`}),N(`rect`,{x:`12`,y:`13`,width:`10`,height:`8`,rx:`1`,ry:`1`}),N(`path`,{d:`M14.5 18.5h2m2 0h1`})]}),Uf=e=>L(`svg`,{...Vf,...e,children:[N(`path`,{d:`M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5`}),N(`rect`,{x:`12`,y:`13`,width:`10`,height:`8`,rx:`1`,ry:`1`}),N(`path`,{d:`M6 9h3m2 0h2`})]}),Wf=d`
473
+ .popover {
474
+ position: absolute;
475
+ /* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
476
+ bar, so a menu centred on it puts its own edges wherever the button happens to sit: with no
477
+ picture-in-picture button, which is every source whose media the player does not own, an edge
478
+ landed outside the box, and the root's \`overflow: hidden\` cut it off, taking the rows under it
479
+ out of reach. The inset matches the bar's own padding so the menu lines up with the last button. */
480
+ right: calc(12px + env(safe-area-inset-right, 0px));
481
+ bottom: calc(100% + 8px);
482
+
483
+ overflow-y: auto;
484
+ width: 180px;
485
+ /* \`100%\` is the control bar, which is the width of the PLAYER. The old \`100vw\` was the viewport,
486
+ which equals the player only when the player is the whole document, and it is the wrong kind of
487
+ guard besides: a max-width shrinks the box, it never moves it back inside. */
488
+ max-width: calc(100% - 24px);
489
+ /* Sized to its rows, capped at what fits. A fixed height left the settings menu two thirds empty
490
+ once subtitles moved out to its own button, and a long track list scrolls at the cap either way. */
491
+ height: max-content;
492
+ /* The room actually above the bar. A short player had the top of the menu clipped by that same
493
+ \`overflow: hidden\`. With no size container in the ancestry this resolves against the small
494
+ viewport, so it can only ever shrink the box, never grow it. */
495
+ max-height: min(160px, calc(100cqh - 100% - 16px));
496
+ @media (min-width: 768px) {
497
+ right: calc(16px + env(safe-area-inset-right, 0px));
498
+ width: 250px;
499
+ max-width: calc(100% - 32px);
500
+ }
501
+ @media (min-width: 2560px) {
502
+ right: calc(24px + env(safe-area-inset-right, 0px));
503
+ max-width: calc(100% - 48px);
504
+ }
505
+
506
+ display: flex;
507
+ flex-direction: column;
508
+
509
+ border-radius: 8px;
510
+ background-color: rgba(28,28,28,0.95);
511
+ ${qd.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
+ ${qd.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
+ ${qd.bSmall.regular}
597
+ }
598
+ }
599
+ `,Gf=({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 L(`div`,{onClick:()=>{l||r(e??void 0)},className:[a,l?`unavailable`:null].filter(Boolean).join(` `)||void 0,children:[N(`span`,{children:i}),N(`span`,{children:s?`…`:(n??null)===e?`✓`:``})]},e??`__off__`)};return L(`div`,{className:`popover track-list`,children:[L(`div`,{className:i?`back`:`back no-hover`,onClick:i,children:[i?N(ee,{}):null,N(`span`,{children:e})]}),s?N(`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`))]})},Kf=({onReset:e}={})=>{let t=S(null),[n,r]=P(!1),[i,a]=P(void 0),[o,s]=P(!1),c=S(e);c.current=e;let l=()=>{r(!1),c.current?.()};return k(()=>{let e=e=>{n&&t.current&&!t.current.contains(e.target)&&l()};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[n]),{open:n,toggle:()=>{r(e=>!e),s(!1),c.current?.()},close:l,containerRef:t,pending:i,failed:o,runSelect:(e,t)=>{if(i!==void 0)return;s(!1);let n;try{n=t()}catch(e){console.warn(`[media-player] track selection failed:`,e),s(!0);return}if(!(n instanceof Promise)){l();return}a(e),n.then(()=>{a(void 0),l()},e=>{console.warn(`[media-player] track selection failed:`,e),a(void 0),s(!0)})}}},qf=d`
600
+ /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
601
+ which is the width of the player box, so it can be clamped to it. */
602
+ position: static;
603
+
604
+ .errors {
605
+ /* the icon keeps its size, the pressable box grows around it */
606
+ @media (pointer: coarse) {
607
+ box-sizing: border-box;
608
+ justify-content: center;
609
+
610
+ min-width: 44px;
611
+ min-height: 44px;
612
+ }
613
+ }
614
+
615
+ ${Wf}
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
+ ${qd.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
+ ${qd.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
+ ${qd.bSmall.regular}
684
+ }
685
+ }
686
+ }
687
+ `,Jf=e=>new Date(e).toLocaleTimeString(),Yf=e=>e===void 0||!Number.isFinite(e)?void 0:of(Math.max(0,e)),Xf=e=>e.reduce((e,t)=>e+t.count,0),Zf=e=>e.map((e,t)=>{let n=Yf(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
+ `),Qf=()=>{let e=$(e=>e.playbackErrors),{open:t,toggle:n,containerRef:r}=Kf(),[i,a]=P(!1);if(e.length===0)return null;let o=()=>{navigator.clipboard?.writeText(Zf(e)).then(()=>{a(!0),setTimeout(()=>a(!1),2e3)},e=>console.warn(`[media-player] could not copy the errors:`,e))},s=`Playback errors (${Xf(e)})`;return L(`div`,{css:qf,ref:r,children:[N(ff,{id:`errors`,disabled:t,text:N(`button`,{className:`errors`,type:`button`,onClick:n,"aria-label":s,"aria-expanded":t,children:N(le,{className:`alert-triangle`})}),toolTipText:N(`span`,{children:s})}),t&&L(`div`,{className:`popover error-list`,children:[L(`div`,{className:`back no-hover`,children:[N(`span`,{children:s}),L(`button`,{className:`copy`,type:`button`,onClick:o,"aria-label":`Copy the errors`,children:[N(i?m:M,{}),N(`span`,{children:i?`Copied`:`Copy`})]})]}),e.map((e,t)=>L(`div`,{className:`entry no-hover`,children:[L(`span`,{className:`when`,children:[Jf(e.at),e.count>1?` to ${Jf(e.lastAt)}`:``,Yf(e.atMediaTime)?` at ${Yf(e.atMediaTime)}`:``,e.recovered?` recovered`:``,e.count>1?N(`span`,{className:`count`,children:`×${e.count}`}):null]}),N(`span`,{className:`what`,children:e.message}),e.detail?N(`span`,{className:`cause`,children:e.detail}):null]},`${e.at}-${t}`))]})]})},$f=d`
691
+ display: flex;
692
+ align-items: center;
693
+ justify-content: center;
694
+ flex-direction: column;
695
+ width: 100%;
696
+
697
+ .playback-slider {
698
+ display: flex;
699
+ align-items: center;
700
+
701
+ padding: 8px 4px;
702
+ margin: 0 2px;
703
+ /* a finger needs a 44px band to press, so the padding grows while the track stays 3px */
704
+ @media (pointer: coarse) {
705
+ padding: 20px 8px;
706
+ }
707
+
708
+ cursor: pointer;
709
+
710
+ > div {
711
+ position: relative;
712
+
713
+ background: #ccc;
714
+ border-radius: 4px;
715
+
716
+ width: 120px;
717
+ max-width: 100%;
718
+ height: 3px;
719
+ @media (min-width: 768px) {
720
+ height: 4px;
721
+ }
722
+ }
723
+
724
+ .playback-handle {
725
+ position: absolute;
726
+
727
+
728
+ background: #ffffff;
729
+ border-radius: 50%;
730
+ transform: translateX(-50%);
731
+ pointer-events: none;
732
+
733
+ width: 10px;
734
+ height: 10px;
735
+ top: -3.5px;
736
+ @media (min-width: 768px) {
737
+ width: 12px;
738
+ height: 12px;
739
+ top: -4px;
740
+ }
741
+ }
742
+ }
743
+ `,ep=()=>{let e=$(),t=$(e=>e.playbackRate),n=S(null),r=S(null),i=.25,a=2.75,o=(e,t=.05)=>Math.round(e/t)*t,s=o(t||1),c=e=>(e-i)/a*100,l=e=>o(i+e*a),{handlers:u}=pf({ref:r,onChange:t=>e.setPlaybackRate(l(t))}),d=t=>{t.preventDefault();let n=.05,r=s;r=t.deltaY<0?Math.min(3,r+n):Math.max(i,r-n),e.setPlaybackRate(r)};k(()=>{let e=n.current;return e&&e.addEventListener(`wheel`,d,{passive:!1}),()=>{e&&e.removeEventListener(`wheel`,d)}},[t]);let f=c(s);return L(`div`,{css:$f,children:[L(`div`,{children:[s.toFixed(2),`x`]}),N(`div`,{className:`playback-slider`,ref:n,...u,children:N(`div`,{ref:r,style:{background:`linear-gradient(to right,
744
+ #fff 0% ${f}%,
745
+ #3A3A3A ${f}% 100%
746
+ )`},children:N(`div`,{className:`playback-handle`,style:{left:`${f}%`}})})})]})},tp=d`
747
+ /* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
748
+ as wide as the player box and can therefore be clamped to it. The outside-click check uses
749
+ \`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
750
+ tooltips already resolve against the control bar with no positioned wrapper of their own. */
751
+ position: static;
752
+
753
+ .settings {
754
+ /* the icon keeps its size, the pressable box grows around it */
755
+ @media (pointer: coarse) {
756
+ box-sizing: border-box;
757
+ justify-content: center;
758
+
759
+ min-width: 44px;
760
+ min-height: 44px;
761
+ }
762
+ }
763
+
764
+ ${Wf}
765
+
766
+ .switch {
767
+ position: relative;
768
+ flex-shrink: 0;
769
+ width: 28px;
770
+ height: 16px;
771
+ margin-right: 6px;
772
+ border-radius: 8px;
773
+ background-color: rgba(255,255,255,.3);
774
+ transition: background-color 0.15s ease-in-out;
775
+
776
+ ::after {
777
+ content: '';
778
+ position: absolute;
779
+ top: 2px;
780
+ left: 2px;
781
+ width: 12px;
782
+ height: 12px;
783
+ border-radius: 50%;
784
+ background-color: #fff;
785
+ transition: transform 0.15s ease-in-out;
786
+ }
787
+
788
+ &.on {
789
+ background-color: #fff;
790
+ ::after {
791
+ background-color: #1c1c1c;
792
+ transform: translateX(12px);
793
+ }
794
+ }
795
+ }
796
+
797
+ .unavailable {
798
+ opacity: 0.5;
799
+ }
800
+
801
+ .playback-rate {
802
+ .slider {
803
+ width: 100%;
804
+ }
805
+ .options {
806
+ display: grid;
807
+ grid-template-columns: 1fr 1fr 1fr 1fr;
808
+ align-items: center;
809
+
810
+ padding: 8px 12px;
811
+ /* four presets across a 180px popover leave targets 34px wide, so a finger gets two rows of two
812
+ until the popover is wide enough for the row of four */
813
+ @media (pointer: coarse) {
814
+ grid-template-columns: 1fr 1fr;
815
+ }
816
+ @media (pointer: coarse) and (min-width: 768px) {
817
+ grid-template-columns: 1fr 1fr 1fr 1fr;
818
+ }
819
+
820
+ > div {
821
+ display: flex;
822
+ align-items: center;
823
+ border-radius: 4px;
824
+
825
+ padding: 8px 6px;
826
+ height: 100%;
827
+ @media (pointer: coarse) {
828
+ box-sizing: border-box;
829
+ min-height: 44px;
830
+ }
831
+
832
+ cursor: pointer;
833
+ :hover {
834
+ background-color: rgba(255,255,255,.1);
835
+ }
836
+ }
837
+ }
838
+ }
839
+
840
+ `,np=()=>{let e=$(),t=$(e=>e.playbackRate),n=$(e=>e.audioTracks),r=$(e=>e.selectedAudioTrack),i=$(e=>e.selectAudioTrack),a=$(e=>e.volumeNormalizer),[s,c]=P(0),{open:l,toggle:d,containerRef:f,pending:p,failed:m,runSelect:h}=Kf({onReset:()=>c(0)}),g=t=>{e.setPlaybackRate(t),c(0)},_=e=>{e!==void 0&&h(e,()=>i(e))},v=e=>()=>{c(e)};return L(`div`,{css:tp,ref:f,children:[N(ff,{id:`settings`,disabled:l,text:N(`button`,{className:`settings`,type:`button`,onClick:d,"aria-label":`Settings`,"aria-expanded":l,children:N(u,{})}),toolTipText:N(`span`,{children:`Settings`})}),l&&s===0&&L(`div`,{className:`popover menu`,children:[n.length>1?L(`div`,{onClick:v(2),children:[N(`div`,{children:`Audio`}),N(`div`,{children:N(o,{})})]}):null,L(`div`,{onClick:v(1),children:[N(`div`,{children:`Playback speed`}),L(`div`,{children:[N(`span`,{className:`secondary`,children:t===1?`(Default)`:t.toFixed(2)}),N(o,{})]})]}),a?L(`div`,{role:`switch`,"aria-checked":a.available&&a.enabled,"aria-disabled":!a.available,className:a.available?void 0:`no-hover unavailable`,onClick:()=>{a.available&&a.setEnabled(!a.enabled)},children:[N(`div`,{children:`Normalize volume`}),N(`div`,{children:a.available?N(`span`,{className:a.enabled?`switch on`:`switch`}):N(`span`,{className:`secondary`,children:`Unavailable`})})]}):null]}),l&&s===1&&L(`div`,{className:`popover playback-rate`,children:[L(`div`,{className:`back`,onClick:v(0),children:[N(ee,{}),N(`span`,{children:`Playback speed`})]}),N(`div`,{className:`slider no-hover`,children:N(ep,{})}),L(`div`,{className:`options no-hover`,children:[N(`div`,{onClick:()=>g(.5),children:`0.5x`}),N(`div`,{onClick:()=>g(1),children:`1x`}),N(`div`,{onClick:()=>g(1.5),children:`1.5x`}),N(`div`,{onClick:()=>g(2),children:`2x`})]})]}),l&&s===2&&N(Gf,{title:`Audio`,tracks:n,selected:r,onSelect:_,onBack:v(0),pending:p,failed:m})]})},rp=d`
841
+ /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
842
+ which is the width of the player box, so it can be clamped to it. */
843
+ position: static;
844
+
845
+ .subtitles {
846
+ /* the icon keeps its size, the pressable box grows around it */
847
+ @media (pointer: coarse) {
848
+ box-sizing: border-box;
849
+ justify-content: center;
850
+
851
+ min-width: 44px;
852
+ min-height: 44px;
853
+ }
854
+ }
855
+
856
+ ${Wf}
857
+ `,ip=()=>{let e=$(e=>e.subtitleTracks),t=$(e=>e.selectedSubtitleTrack),n=$(e=>e.selectSubtitleTrack),r=$(e=>e.subtitleOffLabel),{open:i,toggle:a,containerRef:o,pending:s,failed:c,runSelect:l}=Kf();if(e.length===0)return null;let u=t!==void 0;return L(`div`,{css:rp,ref:o,children:[N(ff,{id:`subtitles`,disabled:i,text:N(`button`,{className:`subtitles`,type:`button`,onClick:a,"aria-label":`Subtitles`,"aria-expanded":i,"aria-pressed":u,children:u?N(h,{className:`captions`}):N(B,{className:`captions-off`})}),toolTipText:N(`span`,{children:`Subtitles`})}),i&&N(Gf,{title:`Subtitles`,tracks:e,selected:t,onSelect:e=>l(e??null,()=>n(e)),offLabel:r??`Disable`,pending:s,failed:c})]})},ap={primary:`#EAEBEE`,secondary:`#D0D0D9`,hover:`rgba(255, 255, 255, 0.13)`,borderPrimary:`#384F70`,backgroundTooltip:`#222222`},op=d`
858
+ display: flex;
859
+ align-items: center;
860
+
861
+ padding: 16px 4px;
862
+ margin: 0 2px;
863
+ /* a finger needs a 44px band to press, so the padding grows while the track stays 3px */
864
+ @media (pointer: coarse) {
865
+ padding: 22px 4px;
866
+ }
867
+
868
+ cursor: pointer;
869
+
870
+ > div {
871
+ position: relative;
872
+
873
+ background: #ccc;
874
+ border-radius: 4px;
875
+
876
+ width: 80px;
877
+ height: 3px;
878
+ /* the control bar has under 360px to fit every button once the slider is always open, so the
879
+ track lends some of its length back on a phone and takes it again on anything wider */
880
+ @media (pointer: coarse) {
881
+ width: 64px;
882
+ }
883
+ @media (pointer: coarse) and (min-width: 768px) {
884
+ width: 80px;
885
+ }
886
+ }
887
+
888
+ .volume-handle {
889
+ position: absolute;
890
+ top: -3.5px;
891
+
892
+ background: #ffffff;
893
+ border-radius: 50%;
894
+ transform: translateX(-50%);
895
+ pointer-events: none;
896
+
897
+ width: 10px;
898
+ height: 10px;
899
+ }
900
+ `,sp=({value:e,onChange:t})=>{let n=$(e=>e.volume),r=$(e=>e.muted),i=S(null),a=S(null),{handlers:o}=pf({ref:a,onChange:t}),s=n=>{n.preventDefault();let r=.05,i=e;i=n.deltaY<0?Math.min(1,i+r):Math.max(0,i-r),t(i)};k(()=>{let e=i.current;return e&&e.addEventListener(`wheel`,s,{passive:!1}),()=>{e&&e.removeEventListener(`wheel`,s)}},[e]);let c=e*100,l=w(()=>Math.round(r?0:af(n)*100),[n,r]);return N(ff,{id:`volume-slider`,text:N(`div`,{ref:i,css:op,...o,children:N(`div`,{ref:a,style:{background:`linear-gradient(to right,
901
+ #fff 0% ${c}%,
902
+ #3A3A3A ${c}% 100%
903
+ )`},children:N(`div`,{className:`volume-handle`,style:{left:`${e*100}%`}})})}),toolTipText:L(`div`,{className:`volume-value`,children:[l,`%`]})})},cp=d`
904
+ position: relative;
905
+ display: flex;
906
+ align-items: center;
907
+
908
+ .volume-slider-container {
909
+ display: flex;
910
+ align-items: center;
911
+
912
+ width: 0;
913
+ margin-right: 0;
914
+ overflow: hidden;
915
+ pointer-events: none;
916
+
917
+ transition: margin .2s cubic-bezier(0.4,0,1,1), width .2s cubic-bezier(0.4,0,1,1);
918
+ -webkit-transition: margin .2s cubic-bezier(0.4,0,1,1), width .2s cubic-bezier(0.4,0,1,1);
919
+
920
+ .volume-slider-background {
921
+ display: flex;
922
+ flex-direction: row;
923
+ align-items: center;
924
+
925
+ border-radius: 4px;
926
+
927
+ .volume-value {
928
+ ${qd.bMedium.regular};
929
+ color: #ffffff;
930
+ }
931
+ }
932
+ }
933
+
934
+ &:hover .volume-slider-container {
935
+ width: calc(9 * var(--mp-unit));
936
+
937
+ transition: margin .2s cubic-bezier(0,0,0.2,1), width .2s cubic-bezier(0,0,0.2,1);
938
+ -webkit-transition: margin .2s cubic-bezier(0,0,0.2,1), width .2s cubic-bezier(0,0,0.2,1);
939
+
940
+ pointer-events: auto;
941
+ }
942
+
943
+ /* a touch screen has no hover, so the slider stays open there and the button only mutes */
944
+ @media (pointer: coarse) {
945
+ /* auto, not a fixed rem: the container keeps overflow: hidden, so a narrower fixed width
946
+ silently clips the track and makes the clipped part unhittable */
947
+ .volume-slider-container,
948
+ &:hover .volume-slider-container {
949
+ width: auto;
950
+
951
+ pointer-events: auto;
952
+ }
953
+
954
+ /* a 44px press target around an 18px icon, floored here because the control bar sets the
955
+ padding at a higher specificity */
956
+ .sound {
957
+ /* border-box explicitly, since a consumer reset cannot be assumed */
958
+ box-sizing: border-box;
959
+ justify-content: center;
960
+
961
+ min-width: 44px;
962
+ min-height: 44px;
963
+ }
964
+ }
965
+
966
+ `,lp=({ref:e})=>{let t=$(),n=$(e=>e.volume),r=$(e=>e.muted),i=w(()=>af(n),[n]);return L(`div`,{css:cp,children:[N(ff,{id:`sound`,text:N(`button`,{className:`sound`,type:`button`,onClick:()=>t.toggleMuted(),ref:e,"aria-label":`Mute`,"aria-pressed":r||n===0,children:N(r||n===0?c:n<=.5?v:ae,{size:18,color:`#fff`})}),toolTipText:N(`span`,{children:r?`Unmute (m)`:`Mute (m)`})}),N(`div`,{className:`volume-slider-container`,children:N(`div`,{className:`volume-slider-background`,children:N(sp,{value:r?0:i,onChange:e=>{t.setVolume(rf(e))}})})})]})},up=.05,dp=5,fp=50,pp=1e3,mp=d`
967
+ position: absolute;
968
+ bottom: 0;
969
+ width: 100%;
970
+
971
+ 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%);
972
+ transition: opacity 0.1s cubic-bezier(.4,0,1,1);
973
+
974
+ .actions {
975
+ display: flex;
976
+ justify-content: space-between;
977
+
978
+ /* repeated per breakpoint: nested at-rules are hoisted after the rule, so a shorthand inside a
979
+ media query would override a longhand above it and silently drop the safe-area inset */
980
+ 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));
981
+ @media (min-width: 768px) {
982
+ 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));
983
+ }
984
+ @media (min-width: 2560px) {
985
+ 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));
986
+ }
987
+
988
+ .left, .right {
989
+ display: flex;
990
+ align-items: center;
991
+
992
+ button {
993
+ display: flex;
994
+ align-items: center;
995
+
996
+ outline: none;
997
+ border: none;
998
+ background: none;
999
+
1000
+ svg {
1001
+ width: 18px;
1002
+ height: 18px;
1003
+ @media (min-width: 768px) {
1004
+ width: 24px;
1005
+ height: 24px;
1006
+ }
1007
+ @media (min-width: 2560px) {
1008
+ width: 28px;
1009
+ height: 28px;
1010
+ }
1011
+ }
1012
+
1013
+ svg {
1014
+ stroke: #fff;
1015
+ }
1016
+
1017
+ /* Reads as unavailable rather than absent, so the bar does not reflow when tracks land. */
1018
+ &:disabled {
1019
+ cursor: default;
1020
+ opacity: .4;
1021
+ }
1022
+ }
1023
+
1024
+ .play, .sound, .time, .errors, .subtitles, .settings, .picture-in-picture, .full-screen {
1025
+ display: flex;
1026
+ align-items: center;
1027
+
1028
+ height: 100%;
1029
+
1030
+ border-radius: 4px;
1031
+ user-select: none;
1032
+
1033
+ padding: 8px;
1034
+ @media (min-width: 768px) {
1035
+ padding: 8px 12px;
1036
+ }
1037
+ @media (min-width: 2560px) {
1038
+ padding: 8px 12px;
1039
+ }
1040
+ }
1041
+
1042
+ .play, .sound, .errors, .subtitles, .settings, .picture-in-picture, .full-screen {
1043
+ border-radius: 4px;
1044
+
1045
+ padding: 8px;
1046
+ @media (min-width: 768px) {
1047
+ padding: 8px 12px;
1048
+ }
1049
+ @media (min-width: 2560px) {
1050
+ padding: 8px 12px;
1051
+ }
1052
+
1053
+ cursor: pointer;
1054
+
1055
+ /* .armed is the hover of a control letting its click through, which takes no pointer events
1056
+ of its own and so is never :hover */
1057
+ :hover, &.armed {
1058
+ background-color: ${ap.hover};
1059
+ }
1060
+
1061
+ /* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
1062
+ window still has a mouse */
1063
+ @media (pointer: coarse) {
1064
+ /* border-box explicitly, since a consumer reset cannot be assumed */
1065
+ box-sizing: border-box;
1066
+ min-width: 44px;
1067
+ min-height: 44px;
1068
+ justify-content: center;
1069
+ }
1070
+ }
1071
+ }
1072
+
1073
+ .left {
1074
+ .time {
1075
+ ${qd.bMedium.regular}
1076
+ text-shadow: 0 0 4px rgba(0, 0, 0, 1);
1077
+ }
1078
+ }
1079
+ .right {
1080
+ .picture-in-picture {
1081
+ img {
1082
+ width: 22px;
1083
+ height: 22px;
1084
+ @media (min-width: 768px) {
1085
+ width: 28px;
1086
+ height: 28px;
1087
+ }
1088
+ @media (min-width: 2560px) {
1089
+ width: 32px;
1090
+ height: 32px;
1091
+ }
1092
+ }
1093
+ }
1094
+ }
1095
+ }
1096
+ `,hp=({shortcuts:e=`window`,root:t})=>{let n=$(),r=$(e=>e.paused),i=$(e=>e.currentTime),a=$(e=>e.duration),o=$(e=>e.seekingTo),s=$(e=>e.fullscreen),c=$(e=>e.hideUI),u=$(e=>e.togglePictureInPicture),d=$(e=>e.pictureInPictureMode),f=$(e=>e.burnedInSubtitles),p=$(e=>e.passThroughPictureInPicture),m=$(e=>e.subtitleTracks),h=$(e=>e.requestSeek),[_,v]=P(null),y=S(null),b=S(void 0),x=d===`burn-in`,C=m.length>0,w=a>0&&i===a,T=R(({direction:e,stepSize:t})=>{let r=af(n.volume),i=e===`up`?t:-t,a=Math.max(0,Math.min(1,r+i)),o=n.muted;n.setVolume(rf(a)),o&&!n.muted&&n.toggleMuted()},[n]),E=S(!1);k(()=>{let r=e=>h?h(e):n.seek(e),i=e=>e.composedPath()[0],a=e=>{E.current=!!t.current?.contains(i(e)??null)},o=a=>{let o=i(a);if(o?.isContentEditable||/^(input|textarea|select)$/i.test(o?.tagName??``))return;let s=t.current?.contains(o??null)||o===document.body&&E.current;if(e===`player`&&!n.fullscreen&&!s)return;let c=!0;if(a.key===`f`)n.toggleFullscreen();else if(a.key===`k`)n.togglePaused();else if(a.key===` `)n.togglePaused();else if(a.key===`m`)n.toggleMuted();else if(a.key===`ArrowUp`)T({direction:`up`,stepSize:up});else if(a.key===`ArrowDown`)T({direction:`down`,stepSize:up});else if(a.key===`ArrowRight`){if(!n.duration)return;r(Math.min(n.currentTime+dp,n.duration))}else a.key===`ArrowLeft`?r(Math.max(n.currentTime-dp,0)):c=!1;c&&a.preventDefault()};return window.addEventListener(`keydown`,o),window.addEventListener(`pointerdown`,a,!0),window.addEventListener(`focusin`,a,!0),()=>{window.removeEventListener(`keydown`,o),window.removeEventListener(`pointerdown`,a,!0),window.removeEventListener(`focusin`,a,!0)}},[n,T,h,e,t]);let D=R(e=>{e.preventDefault(),e.deltaY<0?T({direction:`up`,stepSize:up}):T({direction:`down`,stepSize:up})},[T]);k(()=>{if(_)return _.addEventListener(`wheel`,D,{passive:!1}),()=>_.removeEventListener(`wheel`,D)},[_,D]);let O=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})},A=!!p?.armed;return k(()=>{if(!A)return;clearInterval(b.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})},fp);return b.current=t,()=>{e=Date.now()+pp}},[A]),k(()=>()=>clearInterval(b.current),[]),L(`div`,{css:mp,style:{...c?{opacity:`0`,pointerEvents:`none`}:A?{pointerEvents:`none`}:{}},children:[N(zf,{}),L(`div`,{className:`actions`,children:[L(`div`,{className:`left`,children:[N(ff,{id:`play`,tooltipPlace:`top-start`,text:N(`button`,{className:`play`,type:`button`,onClick:()=>n.togglePaused(),"aria-label":w?`Replay`:r?`Play`:`Pause`,children:N(w?ce:r?l:g,{})}),toolTipText:N(`span`,{children:w?`Replay (k)`:r?`Play (k)`:`Pause (k)`})}),N(lp,{ref:v}),N(`div`,{className:`time`,children:sf(o??i,a)})]}),L(`div`,{className:`right`,children:[N(Qf,{}),N(ip,{}),N(np,{}),p?N(ff,{id:`picture-in-picture`,tooltipPlace:`top-end`,text:N(`button`,{ref:y,className:p.armed?`picture-in-picture armed`:`picture-in-picture`,type:`button`,onPointerEnter:O,onPointerMove:O,onClick:p.active?p.exit:void 0,"aria-label":`Picture in picture`,"aria-pressed":p.active,children:N(`img`,{src:Bf,alt:``})}),toolTipText:N(`span`,{children:p.active?`Exit picture in picture`:`Picture in picture`})}):u?N(ff,{id:`picture-in-picture`,tooltipPlace:`top-end`,text:N(`button`,{className:`picture-in-picture`,type:`button`,onClick:u,disabled:x&&!C,"aria-label":x?`Put the subtitles in the video`:`Picture in picture`,"aria-pressed":x?f:void 0,children:x?N(f?Hf:Uf,{}):N(`img`,{src:Bf,alt:``})}),toolTipText:N(`span`,{children:x?C?f?`Subtitles are in the picture`:`Put the subtitles in the picture`:`This file has no subtitles`:`Picture in picture`})}):null,N(ff,{id:`full-screen`,tooltipPlace:`top-end`,text:N(`button`,{className:`full-screen`,type:`button`,onClick:()=>n.toggleFullscreen(),"aria-label":`Full screen`,"aria-pressed":s,children:N(s?se:oe,{})}),toolTipText:N(`span`,{children:s?`Exit full screen (f)`:`Full screen (f)`})})]})]})]})},gp=9e3,_p=d`
1097
+ position: absolute;
1098
+ inset: 0;
1099
+ z-index: 2;
1100
+ pointer-events: none;
1101
+
1102
+ .card {
1103
+ position: absolute;
1104
+ /* Where Firefox draws its own toggle: right aligned, a little past the middle of the height. */
1105
+ top: 52%;
1106
+ right: calc(7 * var(--mp-unit));
1107
+ transform: translateY(-50%);
1108
+
1109
+ display: flex;
1110
+ align-items: center;
1111
+ gap: calc(1.2 * var(--mp-unit));
1112
+
1113
+ max-width: min(calc(42 * var(--mp-unit)), 60%);
1114
+ padding: calc(1.4 * var(--mp-unit)) calc(1.8 * var(--mp-unit));
1115
+ border-radius: calc(0.8 * var(--mp-unit));
1116
+ background-color: rgba(20, 20, 22, 0.94);
1117
+ box-shadow: 0 0 calc(2 * var(--mp-unit)) rgba(0, 0, 0, 0.6);
1118
+
1119
+ opacity: 0;
1120
+ transition: opacity 0.25s ease;
1121
+ }
1122
+
1123
+ &.show .card {
1124
+ opacity: 1;
1125
+ }
1126
+
1127
+ .text {
1128
+ ${qd.bMedium.medium}
1129
+ color: #fff;
1130
+ }
1131
+
1132
+ /* Points at the edge the browser's control lives on, which is the whole message. */
1133
+ .arrow {
1134
+ flex: none;
1135
+ font-size: calc(2.6 * var(--mp-unit));
1136
+ line-height: 1;
1137
+ color: #fff;
1138
+ }
1139
+ `,vp=()=>{let e=$(e=>e.burnedInSubtitles),t=$(e=>e.pictureInPictureMode),[n,r]=P(!1);return k(()=>{if(t!==`burn-in`||!e){r(!1);return}r(!0);let n=setTimeout(()=>r(!1),gp);return()=>clearTimeout(n)},[t,e]),t!==`burn-in`||!e?null:N(`div`,{css:_p,className:n?`show`:``,role:`status`,children:L(`div`,{className:`card`,children:[N(`div`,{className:`text`,children:`Now click your browser's pop out button`}),N(`div`,{className:`arrow`,"aria-hidden":`true`,children:`→`})]})})},yp=1,bp=6e3,xp=1,Sp={opening:`Skip Opening`,ending:`Skip Ending`},Cp=d`
1140
+ position: absolute;
1141
+ inset: 0;
1142
+ z-index: 2;
1143
+ pointer-events: none;
1144
+
1145
+ button {
1146
+ position: absolute;
1147
+ /* clear of the control bar, which is 6 to 8px of padding plus a row of 18 to 28px controls and
1148
+ the seekbar above them */
1149
+ bottom: calc(7 * var(--mp-unit));
1150
+ right: calc(2.4 * var(--mp-unit));
1151
+
1152
+ /* the one thing in this layer that can be pressed */
1153
+ pointer-events: auto;
1154
+ cursor: pointer;
1155
+
1156
+ ${qd.bMedium.bold}
1157
+ color: #fff;
1158
+ padding: calc(1 * var(--mp-unit)) calc(1.8 * var(--mp-unit));
1159
+ border: 1px solid rgba(255, 255, 255, .55);
1160
+ border-radius: calc(.4 * var(--mp-unit));
1161
+ background-color: rgba(20, 20, 22, .8);
1162
+ box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
1163
+
1164
+ opacity: 0;
1165
+ transform: translateY(calc(.6 * var(--mp-unit)));
1166
+ /* visibility as well as opacity, so a faded button cannot be hovered or pressed */
1167
+ visibility: hidden;
1168
+ transition: opacity .18s ease, transform .18s ease, visibility .18s;
1169
+
1170
+ &:hover, &:focus-visible {
1171
+ background-color: rgba(255, 255, 255, .92);
1172
+ color: #111;
1173
+ border-color: transparent;
1174
+ }
1175
+ }
1176
+
1177
+ &.show button {
1178
+ opacity: 1;
1179
+ transform: none;
1180
+ visibility: visible;
1181
+ }
1182
+
1183
+ @media (pointer: coarse) {
1184
+ button {
1185
+ /* a finger needs a target, and the control row below is already 44px */
1186
+ min-height: 44px;
1187
+ bottom: calc(9 * var(--mp-unit));
1188
+ }
1189
+ }
1190
+ `,wp=()=>{let e=$(e=>e.chapters),t=$(e=>e.currentTime),n=$(e=>e.requestSeek),r=$(e=>e.seekPreview),i=$(),a=w(()=>If(e),[e]),o=w(()=>{if(typeof t!=`number`)return;let n=e.findIndex((e,n)=>a[n]!==void 0&&e.start-yp<=t&&t<e.end),r=n>=0?a[n]:void 0;return r?{kind:r,end:e[n].end}:void 0},[e,a,t]),s=S(0),[c,l]=P(0);k(()=>{let e=typeof t==`number`?t:0,n=s.current;s.current=e,e<n-xp&&l(e=>e+1)},[t]);let[u,d]=P(!1),f=o?`${o.kind}@${o.end}`:``;return k(()=>{if(!f){d(!1);return}d(!0);let e=setTimeout(()=>d(!1),bp);return()=>clearTimeout(e)},[f,c]),k(()=>{o||d(!1)},[o]),o?N(`div`,{css:Cp,className:u&&!r?`show`:``,children:N(`button`,{type:`button`,className:`skip-chapter`,onClick:()=>{d(!1),n?n(o.end):i.seek(o.end)},children:Sp[o.kind]})}):null},Tp=3e3,Ep=d`
1191
+ position: absolute;
1192
+ inset: 0;
1193
+ z-index: 2;
1194
+ /* Never eats a click: click-to-pause still reaches the video underneath, and an item that needs a
1195
+ pointer (a tooltip anchor, a button) sets \`pointer-events: auto\` on itself. */
1196
+ pointer-events: none;
1197
+ /* visibility, not only opacity: an item that took pointer events back would otherwise stay
1198
+ hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
1199
+ not, and transitioning it holds the item on screen for the length of the fade. */
1200
+ transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
1201
+ `,Dp=(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')`},Op=d`
1202
+ position: relative;
1203
+ background-color: black;
1204
+ display: flex;
1205
+ justify-content: center;
1206
+ align-items: center;
1207
+ height: 100%;
1208
+ width: 100%;
1209
+ /* focusable with shortcuts='player', and the first key after a click on the picture would otherwise
1210
+ ring the whole player as :focus-visible */
1211
+ outline: none;
1212
+
1213
+ & > div:not(:last-of-type) {
1214
+ position: absolute;
1215
+ z-index: 2;
1216
+ }
1217
+
1218
+ /* The subtitle layer sits UNDER the title and the spinner, where the canvas itself used to sit.
1219
+ As a plain child div it is matched by the rule above and raised to the overlay items' level,
1220
+ which paints subtitles over the title's gradient, over the spinner and over the error text.
1221
+ Naming the type as well is what takes it back: :not() carries the specificity of its argument,
1222
+ so the rule above is (0,2,1) and a bare .subtitles at (0,2,0) loses to it whatever the source
1223
+ order, while div.subtitles ties at (0,2,1) and second place in the same block then wins.
1224
+ subtitle-layering.browser.test.tsx measures the computed value rather than trusting this. */
1225
+ & > div.subtitles {
1226
+ inset: 0;
1227
+ z-index: 1;
1228
+ pointer-events: none;
1229
+ }
1230
+
1231
+ /* Over everything, the control bar included, while a click on the picture in picture control is let
1232
+ through, with a hole at the control. Inside the hole every pointer event goes to the host's
1233
+ document and this one hears nothing, so the pointer arriving on this layer is the only sign here
1234
+ that it left the control. Named with its type for the specificity reason just above. */
1235
+ & > div.pass-through {
1236
+ inset: 0;
1237
+ z-index: 5;
1238
+ }
1239
+
1240
+ canvas {
1241
+ height: 100%;
1242
+ width: 100%;
1243
+ pointer-events: none;
1244
+ position: absolute;
1245
+ z-index: 1;
1246
+ }
1247
+
1248
+ .video, video {
1249
+ height: 100%;
1250
+ width: 100%;
1251
+ background-color: black;
1252
+ object-fit: contain;
1253
+ }
1254
+
1255
+ &.hide {
1256
+ cursor: none;
1257
+ }
1258
+ `,kp=(e,t=``)=>b.toArray(e).flatMap((e,n)=>{let r=`${t}${f(e)&&e.key!=null?e.key:n}`;return f(e)&&e.type===O?kp(e.props.children,`${r}/`):[{key:r,item:e}]}),Ap=({ref:e,onVideoRef:t,onSubtitleRef:n,overlay:r,controls:i,shortcuts:a,children:o})=>{let s=$(),c=$(e=>e.hideUI),l=$(e=>e.setHideUI),u=$(e=>e.hasMedia),d=$(e=>e.passThroughPictureInPicture),f=S(void 0),p=S(`mouse`),m=S({x:-1,y:-1}),h=S(null);k(()=>()=>clearTimeout(f.current),[]),k(()=>{u||(clearTimeout(f.current),l(!1))},[u,l]);let g=()=>{u&&l(!0)},_=t=>{h.current=t,typeof e==`function`?e(t):e&&(e.current=t)},v=()=>{if(s.passThroughPictureInPicture?.armed)return!0;if(p.current!==`mouse`)return!1;let{x:e,y:t}=m.current;if(!h.current||e<0)return!1;let n=document.elementFromPoint(e,t);return!!n&&h.current.contains(n)&&!n.closest(`.video`)},y=()=>{if(v()){f.current=setTimeout(y,Tp);return}g()},b=()=>{l(!1),clearTimeout(f.current),f.current=setTimeout(y,Tp)};return L(`div`,{css:Op,ref:_,onPointerMove:e=>{p.current=e.pointerType,e.pointerType===`mouse`&&(m.current={x:e.clientX,y:e.clientY},b())},onPointerDown:e=>{p.current=e.pointerType},onMouseOut:e=>{let t=e.relatedTarget;if(t&&e.currentTarget.contains(t))return;let{left:n,right:r,top:i,bottom:a}=e.currentTarget.getBoundingClientRect();e.clientX>=n&&e.clientX<r&&e.clientY>=i&&e.clientY<a||(clearTimeout(f.current),g())},className:c?`hide`:``,tabIndex:a===`player`?-1:void 0,children:[N(ef,{onSubtitleRef:n}),kp(r).map(({key:e,item:t})=>N(`div`,{css:Ep,style:{...c?{opacity:`0`,visibility:`hidden`,pointerEvents:`none`}:{}},children:t},e)),i===!1?null:N(hp,{shortcuts:a,root:h}),N(vp,{}),N(wp,{}),d?.armed&&h.current?N(`div`,{className:`pass-through`,style:{clipPath:Dp(d.armed,h.current.getBoundingClientRect())},onPointerOver:d.disarm}):null,L(`div`,{className:`video`,onClick:()=>{if(p.current===`mouse`){s.togglePaused();return}c?b():(clearTimeout(f.current),g())},children:[t?N(`video`,{ref:t,playsInline:!0}):null,o]})]})},jp=({options:e,children:t})=>{let n=`media`in e?e:null,r=n?null:e,{title:a,chapters:o}=e,{size:s,downloadedRanges:c,publicPath:l,libavWorkerUrl:u,read:d,thumbnailRead:f,thumbnailsEnabled:p}=r??{},m=rl(),h=il(),[g,_]=P(null),[v,y]=P(null),b=n?.media??g;k(()=>(m?.(b),()=>m?.(null)),[b,m]);let{expose:x}=e,C=x===!0?{}:x||void 0,T=S(C);T.current=C;let E=C?C.id:void 0,D=C?C.origin:void 0,O=C?C.channel:void 0;k(()=>{if(!x||!b)return;let e,t=!1;return i(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(b,T.current??{}))}).catch(()=>{}),()=>{t=!0,e?.()}},[b,!!x,E,D,O]),jd(g,v,r);let A=r?.normalizeVolume,[j,ee]=P(!!A);k(()=>{ee(!!A)},[A]);let M=S(r?.onNormalizeVolumeChange);M.current=r?.onNormalizeVolumeChange;let te=r?.normalizerWorkletUrl,{refused:ne}=Kd(g,te,j),F=w(()=>te&&typeof AudioWorkletNode==`function`?{enabled:j,available:!ne,setEnabled:e=>{ee(e),M.current?.(e)}}:null,[te,j,ne]),{thumbnails:I,requestThumbnail:L}=Pd({publicPath:l,workerUrl:u,length:p===!1?void 0:s,read:f??d,downloadedRanges:c}),re=n?.thumbnails?.all??I,{toggle:ie,mode:R,burnedIn:ae}=Fd(g,v),z=Vd(n?.media??null,n?.pictureInPicture),B=$(e=>e.setSourceState),oe=n?!!n.media:s!==void 0;k(()=>{B({title:a,size:s,downloadedRanges:c,hasMedia:oe})},[B,a,s,c,oe]);let se=n?.thumbnails?.at;k(()=>{B({thumbnails:re,thumbnailAt:se,requestThumbnail:L,togglePictureInPicture:ie,pictureInPictureMode:R,burnedInSubtitles:ae})},[B,re,se,L,ie,R,ae]),k(()=>{B({volumeNormalizer:F})},[B,F]),k(()=>{B({passThroughPictureInPicture:z})},[B,z]);let ce=n?.subtitles?.selection,le=n?.audioTracks?.selection;return k(()=>{ce&&B({subtitleTracks:ce.options.map(({id:e,label:t,disabled:n})=>({id:e,label:t,disabled:n})),selectedSubtitleTrack:ce.selectedId??void 0,selectSubtitleTrack:e=>ce.select(e==null?null:String(e)),subtitleOffLabel:ce.offLabel})},[B,ce]),k(()=>{le&&B({audioTracks:le.options.map(({id:e,label:t,disabled:n})=>({id:e,label:t,disabled:n})),selectedAudioTrack:le.selectedId??void 0,selectAudioTrack:e=>le.select(String(e))})},[B,le]),k(()=>{o&&B({chapters:o})},[B,o]),N(Ap,{ref:h,onVideoRef:n?void 0:_,onSubtitleRef:y,overlay:e.overlay,controls:e.controls,shortcuts:e.shortcuts,children:t})},Mp=d`
1259
+ /**
1260
+ * The chrome's whole scale, in one place.
1261
+ *
1262
+ * Everything inside is sized against this rather than against \`rem\`, because \`rem\` is root
1263
+ * relative and a library cannot own the host page's root font. The old contract was that the host
1264
+ * set \`html { font-size: 62.5% }\`, which silently rendered every control 1.6x too large in any app
1265
+ * that did not, and could not be met by an app whose own screens are sized against the default.
1266
+ * Override it on the player element to rescale the whole chrome.
1267
+ */
1268
+ --mp-unit: 10px;
1269
+
1270
+ /**
1271
+ * The chrome's own typeface, for exactly the reason the unit above exists.
1272
+ *
1273
+ * \`font-family\` inherits, and this library declared it nowhere, so every label drew in whatever the
1274
+ * embedding document happened to set, and in the UA's serif where it set nothing. Not hypothetical:
1275
+ * stub mounts the player in a second document, \`embed.html\`, which sets no font and loads no face,
1276
+ * and the entire settings menu came out in Times New Roman.
1277
+ *
1278
+ * Named faces only, no bundled webfont. The chrome is a handful of short labels, so a font request
1279
+ * on the critical path of a document whose job is to paint video buys a round trip and a flash of
1280
+ * unstyled text for nothing.
1281
+ *
1282
+ * Read through \`var()\` so a host with a brand face sets \`--mp-font-family\` on any ancestor and it
1283
+ * inherits in. A bare \`font-family\` on the host can no longer reach the chrome: this declaration is
1284
+ * on the player element itself and beats anything inherited.
1285
+ */
1286
+ font-family: var(
1287
+ --mp-font-family,
1288
+ system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif,
1289
+ 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji'
1290
+ );
1291
+
1292
+ /**
1293
+ * The chrome's default ink, same argument again.
1294
+ *
1295
+ * Most text here names its own colour, but the two time readouts do not: the elapsed/duration pair
1296
+ * and the seekbar's hover time carry a font token and a black text-shadow and nothing else.
1297
+ * Inherited from a host that declares none that resolves to \`canvastext\`, which is black text under
1298
+ * a black halo on a dark gradient.
1299
+ */
1300
+ color: #fff;
1301
+
1302
+ /**
1303
+ * The settings menu scrolls, and a UA that has not been told the surface is dark paints that
1304
+ * scrollbar in its light theme: a white track down the side of a #1c1c1c menu. Declared here rather
1305
+ * than asked of the host, so it reaches the menu and nothing outside the player.
1306
+ */
1307
+ color-scheme: dark;
1308
+
1309
+ /**
1310
+ * The other half of owning the chrome's own scale.
1311
+ *
1312
+ * Every control here is authored against a border box, which this library's dev app sets globally
1313
+ * and a host page has no reason to. Shipped without it, anything that is \`width: 100%\` AND carries
1314
+ * padding overflows its own box: the top bar ran 32px past the player and clipped the right end of
1315
+ * whatever the app had put there. Scoped to the player's subtree so it cannot reach the host's
1316
+ * layout, and only \`box-sizing\`, because zeroing margins here would reach the app's own content.
1317
+ */
1318
+ &, & *, & *::before, & *::after {
1319
+ box-sizing: border-box;
1320
+ }
1321
+
1322
+ display: flex;
1323
+ justify-content: center;
1324
+ background-color: #111;
1325
+ height: 100%;
1326
+ width: 100%;
1327
+ overflow: hidden;
1328
+ `,Np=e=>N(`div`,{css:Mp,children:N(bd.Provider,{children:N(jp,{options:e,children:e.children})})});export{el as A,Bc as B,Bl as C,vl as D,Sl as E,Zc as F,gc as G,wc as H,Uc as I,Qs as J,pc as K,Hc as L,tl as M,Qc as N,ll as O,nl as P,Z as Q,Vc as R,Ml as S,zl as T,Oc as U,Q as V,_c as W,$s as X,Zs as Y,Xs as Z,cu as _,Uu as a,Gl as b,Pu as c,ku as d,Ou as f,yu as g,bu as h,Wu as i,rl as j,ol as k,Mu as l,xu as m,Ku as n,Ru as o,Cu as p,X as q,Gu as r,Iu as s,Np as t,Au as u,su as v,Ol as w,Wl as x,Zl as y,zc as z};