@banou/stub 0.0.56 → 0.0.58
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.
- package/README.md +2 -2
- package/build/assets/anime-index-BEkCRogm.js +1 -0
- package/build/assets/anime-seasons-BYvYwRwn.js +1 -0
- package/build/assets/country-Cg7CfAmX.js +72 -0
- package/build/assets/dist-xpUFCIHk.js +1328 -0
- package/build/assets/embed-BxT8fPdZ.js +392 -0
- package/build/assets/embed-title-CosoIrXe.js +1 -0
- package/build/assets/{index-GI3b_BTS.js → index-DOZodZks.js} +318 -264
- package/build/assets/{jassub-worker-CLcXAXXL.wasm → jassub-worker-CkfUMbe_.wasm} +0 -0
- package/build/assets/jassub-worker-ezqkHxaC.js +1 -0
- package/build/assets/{lib-jassub-worker-modern-C7bYVPj4.wasm → jassub-worker-modern-Bwy5Vua-.wasm} +0 -0
- package/build/assets/{lib-jassub-worker-CLcXAXXL.wasm → lib-jassub-worker-CkfUMbe_.wasm} +0 -0
- package/build/assets/{jassub-worker-modern-C7bYVPj4.wasm → lib-jassub-worker-modern-Bwy5Vua-.wasm} +0 -0
- package/build/assets/{lib-emotion-react-jsx-runtime.browser.esm-C5mAgoyK.js → lib-player-volume-Cj__TqOH.js} +577 -553
- package/build/assets/{lib-theme-player-w0MKAikK.js → lib-theme-player-DpmBH0Uz.js} +2730 -2377
- package/build/assets/{lib-worker-uEoF-jLP.js → lib-worker-BXCkN-9Q.js} +2762 -2201
- package/build/assets/{lib-worker-DxgAerh1.js → lib-worker-CwmB42Tz.js} +1 -1
- package/build/assets/lib-worker-anime-index-BEkCRogm.js +1 -0
- package/build/assets/lib-worker-anime-seasons-BYvYwRwn.js +1 -0
- package/build/assets/{lib-worker-index-uCN9UHKr.js → lib-worker-index-DGh_UlvN.js} +318 -264
- package/build/assets/lib-worker-jassub-worker-C5QJW1O3.js +1 -0
- package/build/assets/lib-worker-worker-BjIUO7P3.js +146 -0
- package/build/assets/main-BLeaopKB.js +5774 -0
- package/build/assets/{preload-helper-Bx4ePS05.js → player-volume-ChubmlGg.js} +1 -1
- package/build/assets/theme-player-BfHkKsCa.js +1 -0
- package/build/assets/{worker-Buc1-1GE.js → worker-4O2hafPi.js} +1 -1
- package/build/assets/worker-DJ-UoKG9.js +146 -0
- package/build/assets/worker-s1DarU5c.js +1 -0
- package/build/embed.html +5 -5
- package/build/index.html +5 -5
- package/build/index.js +10315 -8342
- package/fkn.json +1 -1
- package/package.json +3 -4
- package/store/home.webp +0 -0
- package/store/movie.webp +0 -0
- package/store/phone.webp +0 -0
- package/store/search.webp +0 -0
- package/store/series.webp +0 -0
- package/store/title.webp +0 -0
- package/build/assets/anime-index-Dl2tJrXZ.js +0 -1
- package/build/assets/anime-seasons-Egf79hrL.js +0 -1
- package/build/assets/dist-D2Wlyi7R.js +0 -1328
- package/build/assets/embed-C1Cncaqj.js +0 -392
- package/build/assets/embed-title-DY0iSLZj.js +0 -1
- package/build/assets/jassub-worker-CmZGEPuv.js +0 -1
- package/build/assets/lib-worker-anime-index-Dl2tJrXZ.js +0 -1
- package/build/assets/lib-worker-anime-seasons-Egf79hrL.js +0 -1
- package/build/assets/lib-worker-jassub-worker-5YNtWxS6.js +0 -1
- package/build/assets/lib-worker-worker-BNxa-Gim.js +0 -150
- package/build/assets/main-BvwWBTz2.js +0 -5228
- package/build/assets/site-status-BWHbNndL.js +0 -72
- package/build/assets/theme-player-B-ZX9FYo.js +0 -1
- package/build/assets/worker-DmLPM08h.js +0 -1
- package/build/assets/worker-dPoC1jvm.js +0 -150
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
import{C as e,g as t,i as n,l as r,m as i,o as a,p as o,s,t as c,u as l,y as u}from"./embed-title-CosoIrXe.js";import{B as d,D as f,Q as p,U as m,V as h,X as g,Z as _,a as v,at as y,ct as b,dt as x,et as S,ft as C,ht as w,it as T,lt as E,mt as D,nt as O,o as k,ot as A,pt as ee,q as j,r as M,s as N,st as P,tt as F,ut as te}from"./player-volume-ChubmlGg.js";import{A as ne,E as re,F as ie,H as I,L as ae,O as oe,P as se,X as ce,Y as le,Z as L,_ as ue,b as de,g as fe,j as pe,k as me,w as he}from"./country-Cg7CfAmX.js";import{A as ge,B as R,C as _e,D as z,E as ve,F as B,G as ye,H as be,I as xe,J as Se,K as Ce,L as we,M as Te,N as Ee,O as De,P as Oe,Q as V,R as ke,S as Ae,T as je,U as Me,V as H,W as Ne,X as Pe,Y as Fe,Z as Ie,_ as Le,a as Re,b as ze,c as Be,d as Ve,f as He,g as Ue,h as We,i as U,j as Ge,k as Ke,l as qe,m as Je,n as Ye,o as Xe,p as Ze,q as Qe,r as $e,s as et,t as tt,u as nt,v as rt,w as it,x as at,y as ot,z as st}from"./dist-xpUFCIHk.js";import{n as ct}from"./remote-DQ5KVR01.js";D(),P();var lt=e=>`https://static.crunchyroll.com/skip-events/production/${e}.json`,ut=e=>{try{return new URL(e).pathname.match(/\/watch\/([A-Z0-9]+)(?:\/|$)/)?.[1]}catch{return}},dt=[[`intro`,`Opening`],[`recap`,`Recap`],[`credits`,`Ending`],[`preview`,`Preview`]],ft=`Episode`,pt=e=>typeof e==`object`&&!!e&&!Array.isArray(e),mt=(e,t)=>{if(!pt(e))return[];let n=t!==void 0&&Number.isFinite(t)&&t>0?t:1/0,r=dt.flatMap(([t,r])=>{let i=e[t];if(!pt(i))return[];let{start:a,end:o}=i;if(typeof a!=`number`||typeof o!=`number`||!Number.isFinite(a)||!Number.isFinite(o))return[];let s={start:Math.max(0,a),end:Math.min(o,n),title:r};return s.end>s.start?[s]:[]}).sort((e,t)=>e.start-t.start),i=[],a=0;for(let e of r){let t=Math.max(e.start,a);e.end<=t||(t>a&&i.push({start:a,end:t,title:ft}),i.push({start:t,end:e.end,title:e.title}),a=e.end)}return i.length&&n!==1/0&&a<n&&i.push({start:a,end:n,title:ft}),i},ht=new Set([403,404]),gt=async(e,t=ie)=>{let n=await t(lt(e));if(!n.ok){if(await n.body?.cancel().catch(()=>{}),ht.has(n.status))return{};throw Error(`${lt(e)} answered ${n.status}`)}return n.json()},_t=e=>{let[t,n]=A();return T(()=>{if(n(e?.duration),!e)return;let t=()=>n(e.duration);return e.addEventListener(`durationchange`,t),e.addEventListener(`loadedmetadata`,t),()=>{e.removeEventListener(`durationchange`,t),e.removeEventListener(`loadedmetadata`,t)}},[e]),t},vt=[],yt=(e,t)=>{let n=ut(e),[r,i]=A(),a=_t(t);return T(()=>{if(!n)return;let e=!1;return gt(n).then(t=>{e||i({episodeId:n,events:t})},t=>{e||console.warn(`[cr] skip events unavailable:`,t)}),()=>{e=!0}},[n]),E(()=>{if(!r||r.episodeId!==n)return vt;let e=mt(r.events,a);return e.length?e:vt},[r,n,a])},bt=5e3,xt=async(e,t)=>{let n=await I.fetch(`${me}/auth/v1/token`,{method:`POST`,headers:{authorization:`Basic ${btoa(`cr_web:`)}`,"content-type":`application/x-www-form-urlencoded`},body:`grant_type=client_id&device_id=${crypto.randomUUID()}`,relay:t}),r=ce(n),{access_token:i}=await n.json();if(!r||!i)throw Error(`Crunchyroll token through ${r}: ${n.status}`);let a=await I.fetch(`${me}/content/v2/cms/objects/${e}?ratings=true&locale=en-US`,{headers:{authorization:`Bearer ${i}`},relay:{id:r}});if(!a.ok&&a.status!==404)throw Error(`Crunchyroll episode through ${r}: ${a.status}`);return{relay:r,listed:a.ok}},St=async(e,t)=>{let n=ut(e);if(!n)return[];let r=async()=>{let e=[];for(;;){let{relay:r,listed:i}=await xt(n,{exclude:[...t,...e]});if(i)return e;if(t.includes(r)||e.includes(r))return[];e.push(r)}},i,a=new Promise(e=>{i=setTimeout(e,bt,[])});return Promise.race([r().catch(()=>[]),a]).finally(()=>clearTimeout(i))};function W(e,t){let n={...t};for(let t in e)V(e[t])||(n[t]=e[t]);return n}function Ct(e,t){let n={};for(let r of t)Object.hasOwn(e,r)&&(n[r]=e[r]);return n}function wt(e){return typeof e==`string`?e:e.text}function Tt(e){return Pe(e)&&`key`in e&&`text`in e}function G(e,t,n){return typeof e==`string`?e:typeof t==`function`?t(e,n):Ce(wt(e),t??n)}function Et(e){let t=e.closest(`[dir]`)?.getAttribute(`dir`);return t?t.toLowerCase()===`rtl`:getComputedStyle(e).direction===`rtl`}function Dt(){return typeof CSS<`u`&&CSS.supports(`anchor-name: --a`)}function Ot(){return typeof navigator<`u`&&/mac/i.test(navigator.userAgent)}var kt={sideOffset:0,boundaryOffset:0},At={top:`bottom`,bottom:`top`,left:`right`,right:`left`};function jt(e,t,n,r){let i=r.boundaryOffset??0;switch(n){case`top`:return e.top-t.top-i-r.sideOffset;case`bottom`:return t.bottom-e.bottom-i-r.sideOffset;case`left`:return e.left-t.left-i-r.sideOffset;case`right`:return t.right-e.right-i-r.sideOffset}}function Mt(e,t,n,r,i=kt){let a=r.side,o=At[a],s=a===`top`||a===`bottom`?t.height:t.width,c=jt(e,n,a,i);return c>=s?a:jt(e,n,o,i)>c?o:a}function Nt(e){try{e?.showPopover?.()}catch{}}function Pt(e){try{e?.hidePopover?.()}catch{}}function Ft(e,t){let n=t.trim();if(!n)return 0;let r=Number.parseFloat(n);if(!Number.isNaN(r)&&(/^-?\d*\.?\d+$/.test(n)||n.endsWith(`px`)))return r;let i=e.ownerDocument,a=i?.documentElement;if(!Number.isNaN(r)&&n.endsWith(`rem`))return r*(a&&Number.parseFloat(getComputedStyle(a).fontSize)||16);if(!Number.isNaN(r)&&n.endsWith(`em`))return r*(e instanceof HTMLElement&&Number.parseFloat(getComputedStyle(e).fontSize)||16);if(!i)return Number.isNaN(r)?0:r;let o=i.createElement(`div`);if(o.style.position=`absolute`,o.style.visibility=`hidden`,o.style.pointerEvents=`none`,o.style.inlineSize=n,!o.style.inlineSize)return 0;o.style.blockSize=`0`,o.style.padding=`0`,o.style.border=`0`,o.style.inset=`0`;let s=getComputedStyle(e);o.style.fontSize=s.fontSize;for(let e=0;e<s.length;e++){let t=s.item(e);t.startsWith(`--`)&&o.style.setProperty(t,s.getPropertyValue(t))}let c=i.body??i.documentElement;if(!c)return Number.isNaN(r)?0:r;if(c.appendChild(o),getComputedStyle(o).inlineSize===`auto`)return o.remove(),0;let l=o.getBoundingClientRect().width;return o.remove(),Number.isFinite(l)?l:Number.isNaN(r)?0:r}function It(e,t,n){let r=n?.leading??!1,i=null,a,o=!1;function s(){i=setTimeout(()=>{i=null,o&&(o=!1,e(...a),s())},t)}let c=(...n)=>{if(a=n,r)i===null?(e(...a),s()):o=!0;else{if(i!==null)return;i=setTimeout(()=>{i=null,e(...a)},t)}};return c.cancel=()=>{i!==null&&(clearTimeout(i),i=null),o=!1},c}function Lt(e,t,n){return ke(t=>e.subscribe(t),()=>e.current,t??we,n)}var Rt={target:De,signals:new Ke,get:De,set:De};function K(e){let t=e.state(Rt),n=Object.keys(t),r=n[0];return Object.assign(r?e=>{if(r in e)return Ct(e,n)}:()=>void 0,{displayName:e.name})}var zt=class e extends Error{static MEDIA_ERR_ABORTED=1;static MEDIA_ERR_NETWORK=2;static MEDIA_ERR_DECODE=3;static MEDIA_ERR_SRC_NOT_SUPPORTED=4;static MEDIA_ERR_ENCRYPTED=5;static MEDIA_ERR_CUSTOM=100;static defaultMessages={1:`You stopped media playback before it finished.`,2:`This media could not be loaded due to a network or server issue.`,3:`This media could not be played. It may be corrupted, or your browser may not support its format.`,4:`This media could not be loaded. It may be unavailable, or your browser may not support its format.`,5:`This media could not be played because it could not be decrypted.`};name;code;context;fatal;data;constructor(t,n=e.MEDIA_ERR_CUSTOM,r,i){super(t),this.name=`MediaError`,this.code=n,this.context=i,this.fatal=r??(n>=e.MEDIA_ERR_NETWORK&&n<=e.MEDIA_ERR_ENCRYPTED),this.message||=e.defaultMessages[this.code]??``}},Bt={ON_DEMAND:`on-demand`,LIVE:`live`,UNKNOWN:`unknown`},Vt=ve({name:`live`,state:()=>({liveEdgeStart:NaN,targetLiveWindow:NaN}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!_e(r))return;let i=()=>n({liveEdgeStart:r.liveEdgeStart,targetLiveWindow:r.targetLiveWindow});i(),H(r,`targetlivewindowchange`,i,{signal:t}),H(r,`streamtypechange`,i,{signal:t}),H(r,`loadedmetadata`,i,{signal:t}),H(r,`canplay`,i,{signal:t}),H(r,`progress`,i,{signal:t}),H(r,`durationchange`,i,{signal:t}),H(r,`timeupdate`,i,{signal:t}),H(r,`emptied`,i,{signal:t})}}),Ht=ve({name:`streamType`,state:()=>({streamType:Bt.UNKNOWN}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(je(r)){let e=()=>n({streamType:r.streamType});e(),H(r,`streamtypechange`,e,{signal:t});return}if(!it(r))return;let i=()=>{let{duration:e}=r;return e===1/0?Bt.LIVE:Number.isFinite(e)&&e>0?Bt.ON_DEMAND:Bt.UNKNOWN},a=()=>n({streamType:i()});a(),H(r,`durationchange`,a,{signal:t}),H(r,`loadedmetadata`,a,{signal:t}),H(r,`emptied`,a,{signal:t}),Ae(r)&&H(r,`progress`,a,{signal:t})}});K(at);var Ut=K(ze),Wt=K(rt),Gt=K(Le),Kt=K(Ue);K(Vt);var qt=K(We),Jt=K(Je),Yt=K(Ze);K(He),K(Ve),K(nt),K(Ht);var Xt=K(qe),Zt=K(Be),Qt=K(et),$t={seekStep({store:e,value:t}){if(V(t))return;let n=Zt(e.state);n&&n.seek(n.currentTime+t)},volumeStep({store:e,value:t}){if(V(t))return;let n=Qt(e.state);n&&n.setVolume(n.volume+t)},speedUp({store:e}){let t=Yt(e.state);if(!t)return;let{playbackRates:n,playbackRate:r}=t,i=n.indexOf(r),a=i<0||i>=n.length-1?0:i+1;t.setPlaybackRate(n[a])},speedDown({store:e}){let t=Yt(e.state);if(!t)return;let{playbackRates:n,playbackRate:r}=t,i=n.indexOf(r),a=i<=0?n.length-1:i-1;t.setPlaybackRate(n[a])}},en={seekStep:$t.seekStep,volumeStep:$t.volumeStep,speedUp:$t.speedUp,speedDown:$t.speedDown};function tn(e){return en[e]||(({store:t})=>{let n=t.state[e];Qe(n)&&n()})}var nn=200,rn=class{#e=0;#t=null;handleUp(e,t){if(e.resolve(`doubletap`).length>0){let n=Date.now();if(n-this.#e<nn){this.#n(),this.#e=0,e.resolve(`doubletap`)[0]?.onActivate(t);return}this.#e=n,this.#n(),this.#t=setTimeout(()=>{this.#t=null,this.#e=0,e.resolve(`tap`)[0]?.onActivate(t)},nn);return}e.resolve(`tap`)[0]?.onActivate(t)}#n(){this.#t!==null&&(clearTimeout(this.#t),this.#t=null)}reset(){this.#n(),this.#e=0}},an=new WeakMap;function on(e){let t=an.get(e);return t||(t=new rn,an.set(e,t),t)}function sn(e,t,n){return ot(e).add({type:`tap`,recognizer:on(e),onActivate:t,pointer:n?.pointer,region:n?.region,disabled:n?.disabled,action:n?.action,value:n?.value})}function cn(e,t,n){return ot(e).add({type:`doubletap`,recognizer:on(e),onActivate:t,pointer:n?.pointer,region:n?.region,disabled:n?.disabled,action:n?.action,value:n?.value})}function ln(e){return e.startsWith(`toggle`)}var un={togglePaused({store:e}){let t=Jt(e.state);t&&(t.paused?t.play():t.pause())},toggleMuted({store:e}){Qt(e.state)?.toggleMuted()},toggleFullscreen({store:e}){let t=Kt(e.state);t&&(t.fullscreen?t.exitFullscreen():t.requestFullscreen())},toggleSubtitles({store:e}){Xt(e.state)?.toggleSubtitles()},togglePictureInPicture({store:e}){let t=qt(e.state);t&&(t.pip?t.exitPictureInPicture():t.requestPictureInPicture())},seekStep:$t.seekStep,volumeStep:$t.volumeStep,speedUp:$t.speedUp,speedDown:$t.speedDown,seekToPercent({store:e,value:t,key:n}){let r=Zt(e.state);if(!r||r.duration<=0)return;let i;if(!V(t))i=t;else if(n>=`0`&&n<=`9`)i=Number(n)*10;else return;r.seek(i/100*r.duration)}};function dn(e){return un[e]}var fn={shift:`Shift`,ctrl:`Control`,alt:`Alt`,meta:`Meta`},pn={shift:`Shift`,ctrl:`Ctrl`,alt:`Alt`,meta:`Meta`},mn=[`ctrl`,`shift`,`alt`,`meta`];function hn(e){return e.map(e=>{let t=[];for(let n of mn)e.modifiers.has(n)&&t.push(fn[n]);return t.push(e.originalKey),t.join(`+`)}).join(` `)}function gn(e){let t=[];for(let n of mn)e.modifiers.has(n)&&t.push(pn[n]);return t.push(_n(e.originalKey)),t.join(`+`)}function _n(e){return e.length===1?e.toUpperCase():e}var vn=class{#e;#t=[];#n=0;#r=null;#i=null;#a=new Set;#o=new Set;#s=!1;constructor(e){this.#e=e}subscribe(e){return this.#a.add(e),()=>this.#a.delete(e)}subscribeShortcutChanges(e){return this.#o.add(e),()=>this.#o.delete(e)}add(e){let t={parsed:bn(e.keys),options:e,id:this.#n++};this.#t.push(t),this.#c(),e.target===`document`?this.#u():this.#l(),this.#h();let n=!1;return()=>{if(n)return;n=!0;let e=this.#t.indexOf(t);e!==-1&&this.#t.splice(e,1),this.#d(),this.#h()}}getAriaKeys(e){return this.getShortcut(e).aria}getShortcut(e,t){let n=this.#p(e,t);if(!n.length)return{};let r=n.flatMap(e=>e.parsed),i=n[n.length-1];return{aria:hn(r),shortcut:this.#m(i)}}destroy(){this.#s||(this.#s=!0,this.#r?.abort(),this.#r=null,this.#i?.abort(),this.#i=null,this.#t=[],this.#h(),this.#a.clear(),this.#o.clear())}#c(){this.#t.sort((e,t)=>{let n=t.parsed[0].modifiers.size-e.parsed[0].modifiers.size;return n===0?e.id-t.id:n})}#l(){this.#r||(this.#r=new AbortController,H(this.#e,`keydown`,this.#f,{signal:this.#r.signal}))}#u(){this.#i||(this.#i=new AbortController,H(document,`keydown`,this.#f,{signal:this.#i.signal}))}#d(){let e=this.#t.some(e=>e.options.target!==`document`),t=this.#t.some(e=>e.options.target===`document`);e||(this.#r?.abort(),this.#r=null),t||(this.#i?.abort(),this.#i=null)}#f=e=>{if(e.key===`Unidentified`||Me(e)||e.defaultPrevented)return;let t=be(e);for(let n of this.#t){let{options:r,parsed:i}=n;if(!r.disabled&&!(e.repeat&&r.repeatable===!1)&&r.target===`document`==(e.currentTarget===document)){for(let n of i)if(Sn(n,e)&&!(t&&n.modifiers.size===0)){if(this.#a.size>0){let t={source:`hotkey`,action:r.action,value:r.value,event:e};for(let e of this.#a)try{e(t)}catch{}}e.preventDefault(),r.onActivate(e,n.originalKey);return}}}};#p(e,t){return this.#t.filter(n=>n.options.disabled||n.options.action!==e?!1:V(t)?!0:n.options.value===t).sort((e,t)=>e.id-t.id)}#m(e){return e.options.keys===`0-9`?e.options.keys:gn(e.parsed[0])}#h(){for(let e of this.#o)e()}},yn=new Set([`shift`,`ctrl`,`alt`,`meta`]);function bn(e){if(e===`0-9`)return Array.from({length:10},(e,t)=>({modifiers:new Set,key:String(t),originalKey:String(t)}));let t=e.split(`+`),n=t.pop(),r=new Set;for(let e of t){let t=e.toLowerCase();t===`mod`?r.add(Ot()?`meta`:`ctrl`):yn.has(t)&&r.add(t)}return[{modifiers:r,key:n===`Space`?` `:n.toLowerCase(),originalKey:n}]}function xn(e){return e.length===1&&!/[a-z]/i.test(e)}function Sn(e,t){if(t.key===`Unidentified`||t.key.toLowerCase()!==e.key)return!1;let n=xn(t.key),r=n?t.shiftKey&&e.modifiers.has(`shift`):t.shiftKey,i=n?t.altKey&&e.modifiers.has(`alt`):t.altKey;return r===e.modifiers.has(`shift`)&&t.ctrlKey===e.modifiers.has(`ctrl`)&&i===e.modifiers.has(`alt`)&&t.metaKey===e.modifiers.has(`meta`)}var Cn=new WeakMap;function wn(e){let t=Cn.get(e);return t||(t=new vn(e),Cn.set(e,t)),t}function Tn(e,t){return wn(e).add(t)}function En(e){let{transition:t}=e,n=t.state,r=new AbortController,i=null;function a(){if(r.signal.aborted)return null;let{active:e,status:i}=n.current;return e&&i!==`ending`?null:(i===`ending`&&t.cancel(),t.open())}function o(e){let{active:i,status:a}=n.current;return r.signal.aborted||!i||a===`ending`?null:t.close(e)}function s(){if(c(),typeof document>`u`)return;i=new AbortController;let{signal:t}=i;H(document,`keydown`,l,{signal:t}),e.onDocumentActive?.(t)}function c(){i?.abort(),i=null}function l(t){t.key===`Escape`&&(t.defaultPrevented||n.current.active&&(e.closeOnEscape?.()??!0)&&e.onEscapeDismiss(t))}let u=n.subscribe(()=>{n.current.active?s():c()});r.signal.addEventListener(`abort`,()=>{u(),t.destroy(),c()});function d(){r.signal.aborted||r.abort()}return{input:n,open:a,close:o,signal:r.signal,destroy:d}}function Dn(e){let{onOpenChange:t}=e,n=null,r=null,i=null,a=En({transition:e.transition,closeOnEscape:e.closeOnEscape,onEscapeDismiss(e){e.stopPropagation(),c()}}),o=a.input;function s(){r=document.activeElement;let i=a.open();i&&(t(!0),requestAnimationFrame(()=>{!a.signal.aborted&&o.current.active&&n?.focus()}),i.then(()=>{!a.signal.aborted&&o.current.active&&e.onOpenChangeComplete?.(!0)}))}function c(){let i=a.close(n);i&&(t(!1),i.then(()=>{a.signal.aborted||(r&&=(r.focus(),null),e.onOpenChangeComplete?.(!1))}))}function l(){if(u(),!n)return;i=new AbortController;let{signal:e}=i;H(n,`click`,d,{signal:e})}function u(){i?.abort(),i=null}function d(e){e.target instanceof HTMLButtonElement&&c()}function f(e){n=e,l()}return a.signal.addEventListener(`abort`,()=>{u(),n=null,r=null}),{input:o,open:s,close:c,setElement:f,destroy:a.destroy}}function On(e){let{onActivate:t,isDisabled:n}=e;return{role:`button`,tabIndex:0,onClick(e){if(n()){e.preventDefault();return}t(e)},onPointerDown(e){n()&&e.preventDefault()},onMouseDown(e){n()&&e.preventDefault()},onKeyDown(e){if(e.target===e.currentTarget){if(n()){e.key!==`Tab`&&e.preventDefault();return}e.key===`Enter`?(e.preventDefault(),t(e)):e.key===` `&&e.preventDefault()}},onKeyUp(e){e.target===e.currentTarget&&(n()||e.key===` `&&t(e))}}}var kn={transitionStarting:`data-starting-style`,transitionEnding:`data-ending-style`};function An(e){return{transitionStarting:e===`starting`,transitionEnding:e===`ending`}}function jn(e){let{onOpenChange:t,closeOnOutsideClick:n}=e,r=null,i=null,a=null,o=new Set,s=!1,c=null,l=En({transition:e.transition,closeOnEscape:e.closeOnEscape,onEscapeDismiss(e){e.preventDefault(),x(`escape`,e)},onDocumentActive(e){H(document,`pointerdown`,w,{capture:!0,signal:e})}}),u=l.input,d={close(e){x(e)}};function f(){a!==null&&(clearTimeout(a),a=null)}function p(){return globalThis.matchMedia?.(`(hover: hover)`)?.matches??!1}function m(){return p()?globalThis.matchMedia?.(`(pointer: fine)`)?.matches??!1:!1}function h(){return!e.openOnHover?.()||p()}function g(){s=!1,c!==null&&(clearTimeout(c),c=null)}function _(){s=!0,c!==null&&clearTimeout(c),c=setTimeout(g,500)}function v(){return s?(g(),!0):!1}function y(){return r?r.hasAttribute(`disabled`)?!0:r.getAttribute(`aria-disabled`)===`true`:!1}function b(n,r){let i=l.open();i&&(e.group?.()?.open(d),t(!0,r?{reason:n,event:r}:{reason:n}),i.then(()=>{!l.signal.aborted&&u.current.active&&e.onOpenChangeComplete?.(!0)}))}function x(n,r){let a=l.close(i);a&&(e.group?.()?.close(d),t(!1,r?{reason:n,event:r}:{reason:n}),a.then(()=>{l.signal.aborted||(Pt(i),e.onOpenChangeComplete?.(!1))}))}function S(e=`click`){b(e)}function C(e=`click`){x(e)}function w(e){if(!n()||!u.current.active)return;let t=e.composedPath();if(r&&t.includes(r)||i&&t.includes(i)){_();return}g(),x(`outside-click`,e)}l.signal.addEventListener(`abort`,()=>{e.group?.()?.close(d),f(),g(),o.clear(),r=null,i=null});let T={onClick(e){h()&&(y()||(u.current.active&&u.current.status!==`ending`?x(`click`,e):b(`click`,e)))},onPointerEnter(t){if(!e.openOnHover?.()||!p()||(f(),u.current.active))return;let n=e.delay?.()??300;a=setTimeout(()=>b(`hover`),n)},onPointerLeave(t){if(!e.openOnHover?.()||!p()||(f(),!u.current.active))return;let n=e.closeDelay?.()??0;a=setTimeout(()=>x(`hover`),n)},onFocusIn(t){if(e.openOnHover?.()){if(!m())return;b(`focus`)}},onFocusOut(t){let n=t.relatedTarget;n&&(r?.contains(n)||i?.contains(n))||e.openOnHover?.()&&x(`blur`)}},E={onPointerEnter(t){e.openOnHover?.()&&f()},onPointerLeave(t){if(!e.openOnHover?.()||o.size>0||(f(),!u.current.active))return;let n=e.closeDelay?.()??0;a=setTimeout(()=>x(`hover`),n)},onGotPointerCapture(e){o.add(e.pointerId)},onLostPointerCapture(e){o.delete(e.pointerId)},onFocusOut(e){let t=e.relatedTarget;if(!(t&&(r?.contains(t)||i?.contains(t)))&&!v()){if(t!==null){x(`blur`);return}requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(!u.current.active||u.current.status===`ending`||u.current.status===`starting`)return;let e=document.activeElement;e&&(r?.contains(e)||i?.contains(e))||x(`blur`)})})}}};function D(e){r=e}function O(e){!e&&i&&u.current.active&&Pt(i),i=e,e&&u.current.active&&Nt(e)}return{input:u,triggerProps:T,popupProps:E,get triggerElement(){return r},setTriggerElement:D,setPopupElement:O,open:S,close:C,destroy:l.destroy}}function Mn(e,t,n,r){let i=e+n,a=t+r;return{x:e,y:t,width:n,height:r,top:t,right:i,bottom:a,left:e,toJSON(){return{x:e,y:t,width:n,height:r,top:t,right:i,bottom:a,left:e}}}}function Nn(e,t){let n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),i=Math.min(e.right,t.right),a=Math.min(e.bottom,t.bottom);return Mn(n,r,Math.max(0,i-n),Math.max(0,a-r))}function Pn(e){let t=document.documentElement.getBoundingClientRect();return e?Nn(t,e.getBoundingClientRect()):t}function Fn(e,t={}){if(!e)return null;if(!Ie(e))return e;if(e===`viewport`)return null;if(e===`container`)return t.container??null;try{return(t.root??document).querySelector(e)}catch{return null}}var In={sideOffset:`--media-popover-side-offset`,alignOffset:`--media-popover-align-offset`,boundaryOffset:`--media-popover-boundary-offset`,anchorWidth:`--media-popover-anchor-width`,anchorHeight:`--media-popover-anchor-height`,availableWidth:`--media-popover-available-width`,availableHeight:`--media-popover-available-height`};function Ln(e,t,n){return Math.max(t,Math.min(n,e))}function Rn(e,t,n){let r=Math.round((e-n)/t)*t+n,i=`${t}`.indexOf(`.`);return i===-1?r:Number(r.toFixed(`${t}`.length-i-1))}var zn={sideOffset:0,alignOffset:0,boundaryOffset:0},Bn={top:`bottom`,bottom:`top`,left:`right`,right:`left`};function Vn(e){return`${Ln(e,0,1/0)}px`}function Hn(e,t,n,r){let i=n-r;return i<t?t:Ln(e,t,i)}function Un(e,t,n,r,i,a,o,s){let c=a===`start`?e+o:a===`end`?t+o:e+n/2+o,l=a===`start`?`0px`:a===`end`?`-100%`:`-50%`;return{base:`${c}px`,translate:`clamp(${r+s-c}px, ${l}, calc(${i-s-c}px - 100%))`}}function Wn(e,t,n,r,i,a,o=In){if(Dt())return{...Gn(e,t,o,n,i,a),...n&&i?Kn(n,i,t,a,o):{}};if(n&&r){let e=a??zn;return{position:`fixed`,margin:`0`,...qn(n,r,t,e,i),...i?Kn(n,i,t,e,o):{}}}return{}}function Gn(e,t,n=In,r,i,a=zn){let o=`var(${n.sideOffset}, 0px)`,s=`var(${n.alignOffset}, 0px)`,{side:c,align:l}=t,u=a.boundaryOffset??0,d={positionAnchor:`--${e}`,position:`fixed`,inset:`auto`,margin:`0`,justifySelf:`normal`,alignSelf:`normal`,marginInlineStart:`0`,marginBlockStart:`0`,translate:`none`},f=Bn[c];if(c===`top`||c===`bottom`){if(d[f]=`calc(anchor(${c}) + ${o})`,r&&i){let{base:e,translate:t}=Un(r.left,r.right,r.width,i.left,i.right,l,a.alignOffset,u);return d.left=e,d.translate=`${t} 0`,d}l===`start`?d.left=`calc(anchor(left) + ${s})`:l===`end`?d.right=`calc(anchor(right) + ${s})`:(d.justifySelf=`anchor-center`,d.marginInlineStart=s)}else{if(d[f]=`calc(anchor(${c}) + ${o})`,r&&i){let{base:e,translate:t}=Un(r.top,r.bottom,r.height,i.top,i.bottom,l,a.alignOffset,u);return d.top=e,d.translate=`0 ${t}`,d}l===`start`?d.top=`calc(anchor(top) + ${s})`:l===`end`?d.bottom=`calc(anchor(bottom) + ${s})`:(d.alignSelf=`anchor-center`,d.marginBlockStart=s)}return d}function Kn(e,t,n,r=zn,i=In){let a={},{side:o}=n,s=r.boundaryOffset??0,c=t.left+s,l=t.right-s,u=t.top+s,d=t.bottom-s;if(a[i.anchorWidth]=`${e.width}px`,a[i.anchorHeight]=`${e.height}px`,o===`top`||o===`bottom`){let t=o===`top`?e.top-u:d-e.bottom;a[i.availableHeight]=Vn(t-r.sideOffset),a[i.availableWidth]=Vn(l-c)}else{let t=o===`left`?e.left-c:l-e.right;a[i.availableWidth]=Vn(t-r.sideOffset),a[i.availableHeight]=Vn(d-u)}return a}function qn(e,t,n,r={sideOffset:0,alignOffset:0},i){let{side:a,align:o}=n,{sideOffset:s,alignOffset:c}=r,l=0,u,d=0,f;if(a===`top`?u=`calc(100% - ${e.top}px + ${s}px)`:a===`bottom`?l=e.bottom+s:a===`left`?f=`calc(100% - ${e.left}px + ${s}px)`:d=e.right+s,a===`top`||a===`bottom`?d=o===`start`?e.left+c:o===`end`?e.right-t.width+c:e.left+(e.width-t.width)/2+c:l=o===`start`?e.top+c:o===`end`?e.bottom-t.height+c:e.top+(e.height-t.height)/2+c,i){let e=r.boundaryOffset??0;a===`top`||a===`bottom`?d=Hn(d,i.left+e,i.right-e,t.width):l=Hn(l,i.top+e,i.bottom-e,t.height)}return{top:a===`top`?`auto`:`${l}px`,bottom:u??`auto`,left:a===`left`?`auto`:`${d}px`,right:f??`auto`}}function Jn(e,t=In){let n=getComputedStyle(e);return{sideOffset:Ft(e,n.getPropertyValue(t.sideOffset)),alignOffset:Ft(e,n.getPropertyValue(t.alignOffset)),boundaryOffset:Ft(e,n.getPropertyValue(t.boundaryOffset))}}function Yn(e,t){let n=e.getBoundingClientRect(),r=e.offsetWidth||n.width,i=e.offsetHeight||n.height;return Mn(n.left,n.top,t===`left`||t===`right`?Math.max(r,e.scrollWidth):r,t===`top`||t===`bottom`?Math.max(i,e.scrollHeight):i)}function Xn(e,t,n,r){let i;return i=n===`vertical`?1-(e.clientY-t.top)/t.height:r?(t.right-e.clientX)/t.width:(e.clientX-t.left)/t.width,Number.isFinite(i)?Ln(i*100,0,100):0}function Zn(e){let t=z({pointerPercent:0,dragPercent:0,dragging:!1,pointing:!1,focused:!1}),n=new AbortController,r=e.changeThrottle??0,i=!1,a=!1,o=null,s=null,c=0,l=!1,u=r>0?It(t=>e.onValueChange?.(t),r,{leading:!0}):null;function d(t,n){n&&u?u(t):e.onValueChange?.(t)}function f(){if(Se(s))return;let t=s;s=null;try{e.getElement().releasePointerCapture(t)}catch{}}function p(){i?(l||e.onValueCommit?.(c),i=!1,t.patch({dragging:!1,pointing:!1}),e.onDragEnd?.()):t.patch({pointing:!1}),l=!1,m()}function m(){u?.cancel(),s=null,o=null}let h={onPointerDown(n){if(e.isDisabled())return;n.stopPropagation(),n.preventDefault();let r=e.getElement();o=r.getBoundingClientRect(),a=e.isRTL(),l=!1,f(),s=n.pointerId,r.setPointerCapture(n.pointerId);let u=Xn(n,o,e.getOrientation(),a);i=!0,c=u,t.patch({pointing:!0,dragging:!0,pointerPercent:u,dragPercent:u}),e.onDragStart?.(),e.onValueChange?.(u),e.getThumbElement?.()?.focus({preventScroll:!0,focusVisible:!1})},onPointerMove(n){if(e.isDisabled())return;if(!Se(s)){if(n.pointerType!==`touch`&&n.buttons===0){p();return}let r=Xn(n,o,e.getOrientation(),a);c=r,t.patch({dragPercent:r,pointerPercent:r}),d(r,!0);return}let r=Xn(n,e.getElement().getBoundingClientRect(),e.getOrientation(),e.isRTL());t.patch({pointing:!0,pointerPercent:r})},onPointerUp(t){if(e.isDisabled()||(t.stopPropagation(),Se(s)))return;let n=Xn(t,o,e.getOrientation(),a);u?.cancel(),e.onValueChange?.(n),e.onValueCommit?.(n),l=!0},onPointerLeave(){Se(s)&&t.patch({pointing:!1})},onLostPointerCapture(){p()}},g={onKeyDown(n){if(e.isDisabled()){n.key!==`Tab`&&n.preventDefault();return}let r=e.getStepPercent(),i=e.getLargeStepPercent(),a=Rn(e.getPercent(),r,0),o=e.isRTL()?-1:1,s=n.shiftKey?i:r,c=null;switch(n.key){case`ArrowRight`:c=a+s*o;break;case`ArrowLeft`:c=a-s*o;break;case`ArrowUp`:c=a+s;break;case`ArrowDown`:c=a-s;break;case`PageUp`:c=a+i;break;case`PageDown`:c=a-i;break;case`Home`:c=0;break;case`End`:c=100}c!==null&&(n.preventDefault(),c=Ln(c,0,100),t.patch({pointerPercent:c,dragPercent:c}),e.onValueChange?.(c),e.onValueCommit?.(c))},onFocus(){t.patch({focused:!0})},onBlur(){t.patch({focused:!1})}};function _(t){if(!e.adjustPercent||t.thumbAlignment!==`edge`)return t;let n=e.getElement(),r=e.getThumbElement?.();if(!r)return t;let i=t.orientation===`horizontal`,a=i?r.offsetWidth:r.offsetHeight,o=i?n.offsetWidth:n.offsetHeight;return{...t,fillPercent:e.adjustPercent(t.fillPercent,a,o),pointerPercent:e.adjustPercent(t.pointerPercent,a,o)}}let v=null;return e.onResize&&(v=new ResizeObserver(()=>e.onResize()),v.observe(e.getElement())),{input:t,rootProps:h,rootStyle:{touchAction:`none`,userSelect:`none`},thumbProps:g,adjustForAlignment:_,destroy(){n.signal.aborted||(n.abort(),v?.disconnect(),f(),m())}}}var Qn={fill:`--media-slider-fill`,pointer:`--media-slider-pointer`,buffer:`--media-slider-buffer`};function $n(e){return{[Qn.fill]:`${e.fillPercent.toFixed(3)}%`,[Qn.pointer]:`${e.pointerPercent.toFixed(3)}%`}}function er(e){return{...$n(e),[Qn.buffer]:`${e.bufferPercent.toFixed(3)}%`}}function tr(e,t){let n=e/2;return{position:`absolute`,left:t===`visible`?`calc(var(${Qn.pointer}) - ${n}px)`:`min(max(0px, calc(var(${Qn.pointer}) - ${n}px)), calc(100% - ${e}px))`,width:`max-content`,pointerEvents:`none`}}var nr=class{findActiveThumbnail(e,t){if(e.length===0)return;let n=0,r=e.length-1,i;for(;n<=r;){let a=n+r>>>1,o=e[a];t>=o.startTime?(i=o,n=a+1):r=a-1}return i}parseConstraints(e){let t=parseFloat(e.minWidth),n=parseFloat(e.maxWidth),r=parseFloat(e.minHeight),i=parseFloat(e.maxHeight);return{minWidth:Number.isFinite(t)?t:0,maxWidth:Number.isFinite(n)?n:1/0,minHeight:Number.isFinite(r)?r:0,maxHeight:Number.isFinite(i)?i:1/0}}calculateScale(e,t,n){let{minWidth:r,maxWidth:i,minHeight:a,maxHeight:o}=n,s=Math.min(i/e,o/t),c=Math.max(r/e,a/t);return Number.isFinite(s)&&s<1?s:Number.isFinite(c)&&c>1?c:1}resize(e,t,n,r){let i=e.width??t,a=e.height??n;if(!i||!a)return;let o=this.calculateScale(i,a,r),s=e.coords?.x??0,c=e.coords?.y??0,l=o===1?0:1;return{scale:o,containerWidth:Math.max(0,Math.floor(i*o)-l*2),containerHeight:Math.max(0,Math.floor(a*o)-l*2),imageWidth:Math.ceil(t*o),imageHeight:Math.ceil(n*o),offsetX:Math.ceil(s*o)+l,offsetY:Math.ceil(c*o)+l}}getState(e,t,n){return{loading:e,error:t,hidden:!e&&!n}}getAttrs(e){return{role:`img`,"aria-hidden":`true`}}};function rr(e){let{getContainer:t,getImg:n,onStateChange:r}=e,i=new nr,a=new AbortController,o=a.signal,s=!1,c=!1,l=0,u=0,d=``,f=!1,p=null;function m(){let e=n();e&&(l=e.naturalWidth,u=e.naturalHeight),s=!1,c=!1,r()}function h(){s=!1,c=!0,r()}function g(e){H(e,`load`,m,{signal:o}),H(e,`error`,h,{signal:o})}function _(){if(!f){let e=n();e&&(g(e),f=!0)}if(!p){let e=t();e&&(p=new ResizeObserver(r),p.observe(e))}}function v(e){_();let t=e??``;t!==d&&(d=t,t?(s=!0,c=!1):(s=!1,c=!1,l=0,u=0))}function y(){_();let e=n();e?.complete&&d&&(e.naturalWidth>0?(l=e.naturalWidth,u=e.naturalHeight,s=!1,c=!1):(s=!1,c=!0),r())}function b(){a.abort(),p?.disconnect(),p=null}return{get loading(){return s},get error(){return c},get naturalWidth(){return l},get naturalHeight(){return u},readConstraints(){let e=t();return e?i.parseConstraints(getComputedStyle(e)):{minWidth:0,maxWidth:1/0,minHeight:0,maxHeight:1/0}},updateSrc:v,connect:y,destroy:b}}var ir={hover:`hover`,focus:`focus`,escape:`escape`,blur:`blur`,"imperative-action":`imperative-action`};function ar(e){let t={transition:e.transition,onOpenChange(t,n){let r=ir[n.reason];if(!r)return;let i=e.group?.();t?i?.notifyOpen():i?.notifyClose();let a=n.event?{reason:r,event:n.event}:{reason:r};e.onOpenChange(t,a)},closeOnEscape:()=>!0,closeOnOutsideClick:()=>!1,openOnHover:()=>!0,delay:()=>{let t=e.group?.();return t?.shouldSkipDelay()?0:e.delay?.()??t?.delay??600},closeDelay:()=>{let t=e.group?.();return e.closeDelay?.()??t?.closeDelay??0}};e.onOpenChangeComplete&&(t.onOpenChangeComplete=e.onOpenChangeComplete);let n=jn(t),r=!1,{onClick:i,...a}=n.triggerProps,o={...a,onPointerDown(){r=!0},onPointerEnter(t){e.disabled?.()||t.pointerType!==`touch`&&a.onPointerEnter(t)},onFocusIn(t){if(!e.disabled?.()){if(r){r=!1;return}a.onFocusIn(t)}}},s={...n.popupProps,onPointerEnter(t){e.disableHoverablePopup?.()||n.popupProps.onPointerEnter(t)}};return{...n,triggerProps:o,popupProps:s,get triggerElement(){return n.triggerElement},open:()=>n.open(`hover`),close:(e=`hover`)=>n.close(e)}}function or(){let e=z({active:!1,status:`idle`}),t=!1,n=0,r=0;function i(i=null){cancelAnimationFrame(n),cancelAnimationFrame(r),n=0,r=0;let a=e.current.active;return a&&e.patch({status:`idle`}),e.patch({active:!0,status:`starting`}),new Promise(o=>{n=requestAnimationFrame(()=>{n=0,a&&(cr(i),sr(i)),r=requestAnimationFrame(()=>{if(r=0,t||!e.current.active)return o();e.patch({status:`idle`}),o()})})})}function a(i){return cancelAnimationFrame(n),cancelAnimationFrame(r),n=0,r=0,e.patch({status:`ending`}),new Promise(a=>{n=requestAnimationFrame(()=>{n=0,r=requestAnimationFrame(()=>{if(r=0,t)return a();lr(i).finally(()=>{if(t||e.current.status!==`ending`)return a();e.patch({active:!1,status:`idle`}),a()})})})})}function o(){cancelAnimationFrame(n),cancelAnimationFrame(r),n=0,r=0,e.current.status!==`idle`&&e.patch({status:`idle`})}return{state:e,open:i,close:a,cancel:o,destroy(){t||(t=!0,o())}}}function sr(e){e&&e.offsetHeight}function cr(e){let t=e?.getAnimations?.({subtree:!0})??[];for(let e of t)e.cancel()}function lr(e){if(!e)return Promise.resolve();let t=e.getAnimations?.()??[];return t.length===0?Promise.resolve():Promise.all(t.map(e=>e.finished)).then(xe,xe)}function ur(e){return{onWheel(t){if(e.isDisabled())return;let n=Math.sign(t.deltaY);if(n===0)return;t.preventDefault();let r=e.getStepPercent(),i=Ln(e.getPercent()-n*r,0,100);e.onValueChange?.(i)}}}function dr(e,t){if(!t)return!1;if(Qe(e.composedPath))return e.composedPath().includes(t);let n=e.target;return n instanceof Node&&t.contains(n)}function fr(e,t){let n={};for(let r in e){if(t&&!(r in t))continue;let i=t?.[r]??pr(r),a=e[r];a===!0?n[i]=``:a&&(n[i]=String(a))}return n}function pr(e){return`data-${e.toLowerCase()}`}function mr(e){return e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>=65&&e.charCodeAt(2)<=90}function hr(e,t){return mr(e)&&(typeof t==`function`||t===void 0)}function gr(e,t){return t?e?n=>{t(n),e(n)}:t:e}function _r(e,t){return t&&e?`${t} ${e}`:t||e}function vr(e,t){return t?e?{...e,...t}:t:e}function yr(e,t){if(!t)return e;for(let n in t){let r=t[n];n===`className`?e.className=_r(e.className,r):n===`style`?e.style=vr(e.style,r):e[n]=hr(n,r)?gr(e[n],r):r}return e}function br(...e){let t={};for(let n of e)t=yr(t,n);return t}_();function xr(e,t){return Qe(e)?e(t):e}function Sr(e,t){return Qe(e)?e(t):e}function Cr(e){let t=e;return t.ref??t.props?.ref}function q(e,t,n){let{className:r,style:i,render:a}=t,{state:o,ref:s,props:c,stateAttrMap:l}=n,u=xr(r,o),d=Sr(i,o),f=br(l?fr(o,l):{},...Array.isArray(c)?c:c?[c]:[]);if(u!==void 0&&(f.className=f.className?`${f.className} ${u}`:u),d!==void 0&&(f.style=f.style?{...f.style,...d}:d),Qe(a)){let e=st(s,f.ref);return a({...f,ref:e},o)}if(p(a)){let e=Cr(a),t=st(s,f.ref,e),n=br(f,a.props);return n.ref=t,g(a,n)}return f.ref=st(s,f.ref),ee(e,f)}_();function wr(e){let{displayName:t,onActivate:n,isDisabled:r}=e,i=y(e=>{},[t]);return{getButtonProps:y(e=>br(On({onActivate:n,isDisabled:r}),e),[n,r]),buttonRef:i}}_();function Tr(e,t){let n=ge(),[r,i]=A({});return T(()=>{if(!n||!e){i({});return}let r=wn(n),a=()=>i(r.getShortcut(e,t));return a(),r.subscribeShortcutChanges(a)},[n,e,t]),r}_(),C(null).Provider,C(null).Provider,C(null).Provider,C(null).Provider;var Er=C(!1);Er.Provider;function Dr(){return b(Er)}C(null).Provider,_();var Or=C(null),kr=Or.Provider;function Ar(){let e=b(Or);if(!e)throw Error(`Tooltip compound components must be used within a Tooltip.Root`);return e}function jr(){return b(Or)}_();function Mr(e,t){return e.getLabelParams?.(t)}function Nr(e){let{displayName:t,core:n,stateAttrMap:r,selector:i,action:a,hotkeyAction:o,hotkeyValue:s,tooltipLabel:c,isSupported:l}=e,u=new Set(Object.keys(n.defaultProps)),d=j(function(e,d){let{render:f,className:p,style:m,...h}=e,g={},_={};for(let e of Object.keys(h))u.has(e)?g[e]=h[e]:_[e]=h[e];let v=jr(),y=Dr(),b=v?.setContent,x=B(i),C=Tr(o,s?.(g)),w=ye(),[T]=A(()=>new n);u.has(`menuTrigger`)&&V(g.menuTrigger)&&(g.menuTrigger=y),T.setProps(g);let{getButtonProps:E,buttonRef:D}=wr({displayName:t,onActivate:()=>{Promise.resolve(a(T,x)).catch(e=>{})},isDisabled:()=>!!g.disabled||!x});x&&T.setMedia(x);let O=x?T.getState():null,k=O?l?.(O)??!0:!1,ee=O&&k?G(T.getLabel(O),w,Mr(T,O)):void 0,j=O&&k?c?.(T,O)??ee:void 0;if(S(()=>{if(b)return b(j?{label:j,shortcut:C.shortcut}:void 0),()=>b(void 0)},[b,j,C.shortcut]),!x||!O||!k)return null;let M=T.getAttrs(O),N=M[`aria-label`],P={...M,...Tt(N)?{"aria-label":G(N,w,Mr(T,O))}:void 0,"aria-keyshortcuts":C.aria};return q(`button`,{render:f,className:p,style:m},{state:O,stateAttrMap:r,ref:[d,D],props:[E(),P,_]})});return d.displayName=t,d}function J(e,t){return Qe(e)?e(t)||void 0:e||void 0}var Pr=class{static defaultProps={open:!1,defaultOpen:!1};setProps(e){}#e=null;#t=void 0;#n=void 0;setInput(e){this.#e=e}setTitleId(e){this.#t=e}setDescriptionId(e){this.#n=e}getState(){let e=this.#e;return{open:e.active,status:e.status,titleId:this.#t,descriptionId:this.#n,...An(e.status)}}getAttrs(e){return{role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":e.titleId,"aria-describedby":e.descriptionId}}},Fr={open:`data-open`,...kn},Ir=class e{static defaultProps={delay:500};state=z({visible:!1});#e={...e.defaultProps};#t=null;setProps(t){this.#e=W(t,e.defaultProps)}destroy(){this.#n()}update(e){let t=e.waiting&&!e.paused;t&&!this.state.current.visible&&!this.#t?this.#t=setTimeout(()=>{this.#t=null,this.state.patch({visible:!0})},this.#e.delay):t||(this.#n(),this.state.patch({visible:!1}))}#n(){this.#t!==null&&(clearTimeout(this.#t),this.#t=null)}},Lr={visible:`data-visible`},Rr=class{#e=null;setMedia(e){this.#e=e}getState(){let e=this.#e;return{visible:e.controlsVisible,userActive:e.userActive}}},zr={visible:`data-visible`,userActive:`data-user-active`},Br=class extends Pr{setProps(){}},Vr=`common.`,Hr={key:`${Vr}empty`,text:``},Ur={key:`${Vr}ok`,text:`OK`},Wr=`errors.`,Gr={key:`${Wr}aborted`,text:`You stopped media playback before it finished.`},Kr={key:`${Wr}network`,text:`This media could not be loaded due to a network or server issue.`},qr={key:`${Wr}decode`,text:`This media could not be played. It may be corrupted, or your browser may not support its format.`},Jr={key:`${Wr}source`,text:`This media could not be loaded. It may be unavailable, or your browser may not support its format.`},Yr={key:`${Wr}encrypted`,text:`This media could not be played because it could not be decrypted.`},Xr={key:`${Wr}title`,text:`Something went wrong.`},Zr={key:`${Wr}unexpected`,text:`An unexpected error occurred.`},Qr={[zt.MEDIA_ERR_ABORTED]:Gr,[zt.MEDIA_ERR_NETWORK]:Kr,[zt.MEDIA_ERR_DECODE]:qr,[zt.MEDIA_ERR_SRC_NOT_SUPPORTED]:Jr,[zt.MEDIA_ERR_ENCRYPTED]:Yr,[zt.MEDIA_ERR_CUSTOM]:Hr},$r={[zt.MEDIA_ERR_SRC_NOT_SUPPORTED]:[`Failed to open media`]};function ei(e){return e>=zt.MEDIA_ERR_ABORTED&&e<=zt.MEDIA_ERR_ENCRYPTED}function ti(){return Xr}function ni(){return Ur}function ri(e,t){if(e){let t=Qr[e.code],n=e.message?.trim();if(n){let r=zt.defaultMessages[e.code];if(t&&r&&n===r)return t;let i=$r[e.code];return t&&ei(e.code)&&!e.context&&i?.includes(n)?t:n}if(t)return t}return t?.trim()||Zr}var ii=`fullscreen.`,ai={key:`${ii}enter`,text:`Enter fullscreen`},oi={key:`${ii}exit`,text:`Exit fullscreen`},si=class e{static defaultProps={label:``,disabled:!1};state=z({fullscreen:!1,availability:`unavailable`,disabled:!0,hidden:!0,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=W(t,e.defaultProps)}getLabel(e){return J(this.#e.label,e)||(e.fullscreen?oi:ai)}getAttrs(e){return{"aria-label":this.getLabel(e),"aria-disabled":e.disabled?`true`:void 0,hidden:e.hidden?``:void 0}}setMedia(e){this.#t=e}getState(){let e=this.#t,t=e.fullscreenAvailability;return this.state.patch({fullscreen:e.fullscreen,availability:t,disabled:this.#e.disabled||t!==`available`,hidden:t!==`available`}),this.state.patch({label:wt(this.getLabel(this.state.current))}),this.state.current}async toggle(e){if(this.setMedia(e),!this.getState().disabled)return e.fullscreen?e.exitFullscreen():e.requestFullscreen()}},ci={fullscreen:`data-fullscreen`,availability:`data-availability`,disabled:`data-disabled`,hidden:`data-hidden`},li={key:`playback.rate`,text:`Playback rate {rate}`},ui=`volume.`,di={key:`${ui}mutedValue`,text:`{percent}, muted`};`${ui}`;var fi={key:`${ui}label`,text:`Volume`};`${ui}`;var pi=Intl.DurationFormat,mi=new Map;function hi(e,t){if(e===`digital`){let e=e=>String(e).padStart(2,`0`);return{format:n=>{let r=`${e(n.minutes??0)}:${e(n.seconds??0)}`;return t===`always`||n.hours!==void 0?`${n.hours??0}:${r}`:r}}}let n=[[`hours`,`hour`],[`minutes`,`minute`],[`seconds`,`second`]];return{format:e=>n.filter(([t])=>e[t]!==void 0).map(([t,n])=>{let r=e[t]??0;return`${r} ${n}${r===1?``:`s`}`}).join(`, `)}}function gi(e){return e===void 0?``:Array.isArray(e)?e.join(`:`):e}function _i(e){let t=Array.isArray(e)?e[0]:e;return!t||t===`en`||t.startsWith(`en-`)}function vi(e,t=`long`,n){let r=`${gi(e)}:${t}:${n??``}`,i=mi.get(r);return i||(i=pi?new pi(e,n===void 0?{style:t}:{style:t,hoursDisplay:n}):hi(t,n),mi.set(r,i)),i}function yi(e){return Fe(e)&&Number.isFinite(e)}function bi(e,t){if(!yi(e))return`0:00`;let n=e<0,r=Math.floor(Math.abs(e)),i=Math.floor(r/3600),a=Math.floor(r%3600/60),o=r%60,s=yi(t??0)?Math.abs(t??0):0,c=Math.floor(s/3600),l=Math.floor(s/60%60),u=i>0||c>0,d=u||l>=10,f=u?{hours:i,minutes:a,seconds:o}:{minutes:a,seconds:o},p=vi(`en`,`digital`,u?`always`:`auto`).format(f);return d||(p=p.replace(/^0(?=\d:)/,``)),`${n?`-`:``}${p}`}function xi(e){if(!yi(e))return`PT0S`;let t=Math.abs(e),n=Math.floor(t/3600),r=Math.floor(t/60%60),i=Math.floor(t%60),a=`PT`;return n>0&&(a+=`${n}H`),r>0&&(a+=`${r}M`),(i>0||a===`PT`)&&(a+=`${i}S`),a}function Si(e,t){if(!yi(e))return``;let n=e<0,r=Math.floor(Math.abs(e)),i=Math.floor(r/3600),a=Math.floor(r%3600/60),o=r%60,s={};i>0&&(s.hours=i),a>0&&(s.minutes=a),(o>0||i===0&&a===0)&&(s.seconds=o);let c=vi(t?.locale,t?.style??`long`).format(s);if(n){let e=t?.formatRemaining;return e?e(c):_i(t?.locale)?`${c} remaining`:c}return c}var Ci=`buttons.`,wi={key:`${Ci}play`,text:`Play`},Ti={key:`${Ci}pause`,text:`Pause`},Ei={key:`${Ci}replay`,text:`Replay`},Di={key:`${Ci}mute`,text:`Mute`},Oi={key:`${Ci}unmute`,text:`Unmute`},ki=class e{static defaultProps={label:``,disabled:!1};state=z({muted:!1,volumeLevel:`off`,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=W(t,e.defaultProps)}getLabel(e){return J(this.#e.label,e)||(e.muted?Oi:Di)}getAttrs(e){return{"aria-label":this.getLabel(e),"aria-disabled":this.#e.disabled?`true`:void 0}}setMedia(e){this.#t=e}getState(){let e=this.#t;return this.state.patch({muted:e.muted||e.volume===0,volumeLevel:Ai(e)}),this.state.patch({label:wt(this.getLabel(this.state.current))}),this.state.current}toggle(e){this.#e.disabled||e.toggleMuted()}};function Ai(e){return e.muted||e.volume===0?`off`:e.volume<.5?`low`:e.volume<.75?`medium`:`high`}var ji={muted:`data-muted`,volumeLevel:`data-volume-level`},Mi=`pip.`,Ni={key:`${Mi}enter`,text:`Enter picture-in-picture`},Pi={key:`${Mi}exit`,text:`Exit picture-in-picture`},Fi=class e{static defaultProps={label:``,disabled:!1};state=z({pip:!1,availability:`unavailable`,disabled:!0,hidden:!0,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=W(t,e.defaultProps)}getLabel(e){return J(this.#e.label,e)||(e.pip?Pi:Ni)}getAttrs(e){return{"aria-label":this.getLabel(e),"aria-disabled":e.disabled?`true`:void 0,hidden:e.hidden?``:void 0}}setMedia(e){this.#t=e}getState(){let e=this.#t,t=e.pipAvailability;return this.state.patch({pip:e.pip,availability:t,disabled:this.#e.disabled||t!==`available`,hidden:t!==`available`}),this.state.patch({label:wt(this.getLabel(this.state.current))}),this.state.current}async toggle(e){if(this.setMedia(e),!this.getState().disabled)return e.pip?e.exitPictureInPicture():e.requestPictureInPicture()}},Ii={pip:`data-pip`,availability:`data-availability`,disabled:`data-disabled`,hidden:`data-hidden`},Li=class e{static defaultProps={label:``,disabled:!1};state=z({paused:!0,ended:!1,started:!1,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=W(t,e.defaultProps)}getLabel(e){return J(this.#e.label,e)||(e.ended?Ei:e.paused?wi:Ti)}getAttrs(e){return{"aria-label":this.getLabel(e),"aria-disabled":this.#e.disabled?`true`:void 0}}setMedia(e){this.#t=e}getState(){let e=this.#t;return this.state.patch({paused:e.paused,ended:e.ended,started:e.started}),this.state.patch({label:wt(this.getLabel(this.state.current))}),this.state.current}async toggle(e){if(!this.#e.disabled){if(e.paused||e.ended)return e.play();e.pause()}}},Ri={paused:`data-paused`,ended:`data-ended`,started:`data-started`},zi=class e{static defaultProps={label:``,disabled:!1,menuTrigger:!1};state=z({rate:1,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=W(t,e.defaultProps)}getLabel(e){let t=J(this.#e.label,e);return t===void 0?li:t}getLabelParams(e){if(J(this.#e.label,e)===void 0)return{rate:e.rate}}getAttrs(e){return{"aria-label":this.getLabel(e),"aria-disabled":this.#e.disabled?`true`:void 0}}setMedia(e){this.#t=e}getState(){let e=this.#t;return this.state.patch({rate:e.playbackRate}),this.state.patch({label:wt(this.getLabel(this.state.current))}),this.state.current}cycle(e){if(this.#e.disabled||this.#e.menuTrigger)return;let{playbackRates:t,playbackRate:n}=e;if(t.length===0)return;let r=t.indexOf(n),i=r===-1?t.find(e=>e>n)??t[0]:t[(r+1)%t.length];e.setPlaybackRate(i)}},Bi={rate:`data-rate`},Vi=class e{static defaultProps={side:`top`,align:`center`,modal:!1,closeOnEscape:!0,closeOnOutsideClick:!0,open:!1,defaultOpen:!1,openOnHover:!1,delay:300,closeDelay:0};#e={...e.defaultProps};constructor(e){e&&this.setProps(e)}setProps(t){this.#e=W(t,e.defaultProps)}#t=null;setInput(e){this.#t=e}getState(){let e=this.#t;return{open:e.active,status:e.status,side:this.#e.side,align:this.#e.align,modal:this.#e.modal,...An(e.status)}}getTriggerAttrs(e,t){return{"aria-expanded":e.open&&e.status!==`ending`?`true`:`false`,"aria-haspopup":`dialog`,"aria-controls":t}}getPopupAttrs(e){return{popover:`manual`,role:`dialog`,"aria-modal":e.modal===!0?`true`:void 0}}},Hi={open:`data-open`,side:`data-side`,align:`data-align`,...kn},Ui=`seek.`,Wi={key:`${Ui}forward`,text:`Seek forward {seconds} seconds`},Gi={key:`${Ui}backward`,text:`Seek backward {seconds} seconds`},Ki=class e{static defaultProps={seconds:30,label:``,disabled:!1};state=z({seeking:!1,direction:`forward`,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=W(t,e.defaultProps)}getLabel(e){let t=J(this.#e.label,e);return t===void 0?e.direction===`backward`?Gi:Wi:t}getLabelParams(e){if(J(this.#e.label,e)===void 0)return{seconds:Math.abs(this.#e.seconds)}}getAttrs(e){return{"aria-label":this.getLabel(e),"aria-disabled":this.#e.disabled?`true`:void 0}}setMedia(e){this.#t=e}getState(){let e=this.#t,t=this.#e.seconds<0?`backward`:`forward`;return this.state.patch({seeking:e.seeking,direction:t}),this.state.patch({label:wt(this.getLabel(this.state.current))}),this.state.current}async seek(e){this.#e.disabled||await e.seek(e.currentTime+this.#e.seconds)}},qi={seeking:`data-seeking`,direction:`data-direction`},Ji=class e{static defaultProps={label:``,step:1,largeStep:10,orientation:`horizontal`,disabled:!1,thumbAlignment:`center`,value:0,min:0,max:100};static defaultInput={pointerPercent:0,dragPercent:0,dragging:!1,pointing:!1,focused:!1};#e={...e.defaultProps};#t={...e.defaultInput};get props(){return this.#e}get input(){return this.#t}constructor(e){e&&this.setProps(e)}setProps(t){this.#e=W(t,e.defaultProps)}setInput(e){this.#t=e}getSliderState(e){let{orientation:t,disabled:n,thumbAlignment:r}=this.#e,{pointerPercent:i,dragging:a,pointing:o,focused:s}=this.#t;return{value:e,fillPercent:this.percentFromValue(e),pointerPercent:i,dragging:a,pointing:o,interactive:a||o||s,orientation:t,disabled:n,thumbAlignment:r}}getLabel(e){return J(this.#e.label,e)||``}getAttrs(e){return{role:`slider`,tabIndex:e.disabled?-1:0,autoComplete:`off`,"aria-label":this.getLabel(e),"aria-valuemin":this.#e.min,"aria-valuemax":this.#e.max,"aria-valuenow":e.value,"aria-orientation":e.orientation,"aria-disabled":e.disabled?`true`:void 0}}valueFromPercent(e){let{min:t,max:n,step:r}=this.#e;return Rn(Ln(t+e/100*(n-t),t,n),r,t)}rawValueFromPercent(e){let{min:t,max:n}=this.#e;return Ln(t+e/100*(n-t),t,n)}percentFromValue(e){let{min:t,max:n}=this.#e;return n===t?0:(e-t)/(n-t)*100}getStepPercent(){let{step:e,min:t,max:n}=this.#e,r=n-t;return r>0?e/r*100:0}getLargeStepPercent(){let{largeStep:e,min:t,max:n}=this.#e,r=n-t;return r>0?e/r*100:0}adjustPercentForAlignment(e,t,n){if(this.#e.thumbAlignment===`center`||n===0)return e;let r=t/n*100/2,i=r,a=100-r;return i+e/100*(a-i)}},Yi={dragging:`data-dragging`,pointing:`data-pointing`,interactive:`data-interactive`,orientation:`data-orientation`,disabled:`data-disabled`},Xi={loading:`data-loading`,error:`data-error`,hidden:`data-hidden`};function Zi(e,t){let n=e.trim().split(`#`),r=n[0]??``,i=n[1],a=t?new URL(r,t).href:r;if(!i)return{url:a};let o=i.indexOf(`=`);if(o===-1)return{url:a};let s=i.slice(0,o),c=i.slice(o+1).split(`,`).map(Number),l={};for(let e=0;e<s.length;e++){let t=s[e],n=c[e];t&&Fe(n)&&!Number.isNaN(n)&&(l[t]=n)}let u={url:a};return Fe(l.w)&&(u.width=l.w),Fe(l.h)&&(u.height=l.h),Fe(l.x)&&Fe(l.y)&&(u.coords={x:l.x,y:l.y}),u}function Qi(e,t){let n=[];for(let r of e){let e=Zi(r.text,t),i={url:e.url,startTime:r.startTime,endTime:r.endTime};e.width&&(i.width=e.width),e.height&&(i.height=e.height),e.coords&&(i.coords=e.coords),n.push(i)}return n}var $i=`time.`,ea={key:`${$i}current`,text:`Current time`},ta={key:`${$i}duration`,text:`Duration`},na={key:`${$i}remaining`,text:`Remaining`},ra={key:`${$i}remainingSuffix`,text:`{duration} remaining`},ia={key:`${$i}showElapsed`,text:`{duration}. Show elapsed time.`},aa={key:`${$i}showDuration`,text:`{duration}. Show duration.`},oa={key:`${$i}showRemaining`,text:`{duration}. Show remaining time.`},sa={key:`${$i}position`,text:`{current} of {duration}`},ca={current:ia,duration:aa,remaining:oa},la={current:ea,duration:ta,remaining:na},ua=class e{static defaultProps={type:`current`,negativeSign:`-`,label:``,toggle:!1};#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=W(t,e.defaultProps)}setMedia(e){this.#t=e}#n(){let e=this.#t,{type:t}=this.#e;switch(t){case`current`:return e.currentTime;case`duration`:return e.duration;case`remaining`:return e.currentTime-e.duration;default:return 0}}#r(){let e=this.#t,t=this.#n();return bi(Math.abs(t),e.duration)}#i(){let{type:e}=this.#e,t=this.#n();return Si(e===`remaining`?t<0?t:-Math.abs(t):t)}#a(){let e=this.#n();return xi(Math.abs(e))}#o(e,t){return e===`current`?t===`remaining`?`current`:`remaining`:t===`duration`?`remaining`:`duration`}getLabel(e,t=this.#e.type){let n=J(this.#e.label,e);return n===void 0?this.#e.toggle?ca[this.#o(t,e.type)]:la[this.#e.type]:n}getLabelParams(e){return J(this.#e.label,e)===void 0&&this.#e.toggle?{duration:e.phrase}:void 0}getAttrs(e,t=this.#e.type){return{"aria-label":this.getLabel(e,t),role:this.#e.toggle?`button`:void 0,tabIndex:this.#e.toggle?0:void 0}}getState(){let e=this.#n();return{type:this.#e.type,seconds:e,negative:this.#e.type===`remaining`&&e<0,text:this.#r(),phrase:this.#i(),datetime:this.#a()}}},da={type:`data-type`},fa={key:`slider.seek`,text:`Seek`},pa=class e extends Ji{static defaultProps={...Ji.defaultProps,label:``,changeThrottle:100,pauseOnDrag:!1};#e={...e.defaultProps};#t=null;#n;#r=!1;constructor(e){super(),e&&this.setProps(e)}setProps(t){this.#e=W(t,e.defaultProps),super.setProps({...t,min:0})}setMedia(e){this.#t=e}setFormatLocale(e){this.#n=e}getState(){let{duration:e,currentTime:t,seeking:n,buffered:r}=this.#t;super.setProps({...this.#e,min:0,max:e});let i=super.getSliderState(t),a=r.length>0?r[r.length-1][1]:0,o=e>0?a/e*100:0;return{...i,currentTime:t,duration:e,seeking:n,bufferPercent:o}}getLabel(e){return super.getLabel(e)||fa}#i(e){return e.dragging?this.rawValueFromPercent(e.pointerPercent):e.value}#a(e){return this.#n===void 0?Si(e):Si(e,{locale:this.#n})}getValueText(e){return Number.isFinite(e.duration)?sa:this.getValueTextParams(e).current}getValueTextParams(e){let t=this.#a(this.#i(e));return Number.isFinite(e.duration)?{current:t,duration:this.#a(e.duration)}:{current:t}}startDrag(e){this.#r=!1,this.#e.pauseOnDrag&&e&&!e.paused&&(this.#r=!0,e.pause())}endDrag(e){this.#r&&e?.play().catch(()=>{}),this.#r=!1}getAttrs(e){let t=super.getAttrs(e),n=this.#i(e);return{...t,"aria-valuenow":n,"aria-valuetext":this.getValueText(e)}}},ma={...Yi,seeking:`data-seeking`},ha=class e{static defaultProps={side:`top`,align:`center`,open:!1,defaultOpen:!1,delay:600,closeDelay:0,disableHoverablePopup:!0,disabled:!1};#e={...e.defaultProps};constructor(e){e&&this.setProps(e)}setProps(t){this.#e=W(t,e.defaultProps)}#t=null;setInput(e){this.#t=e}getState(){let e=this.#t;return{open:e.active,status:e.status,side:this.#e.side,align:this.#e.align,...An(e.status)}}getPopupAttrs(e){return{popover:`manual`,role:`presentation`}}},ga={sideOffset:`--media-tooltip-side-offset`,alignOffset:`--media-tooltip-align-offset`,boundaryOffset:`--media-tooltip-boundary-offset`,anchorWidth:`--media-tooltip-anchor-width`,anchorHeight:`--media-tooltip-anchor-height`,availableWidth:`--media-tooltip-available-width`,availableHeight:`--media-tooltip-available-height`},_a={open:`data-open`,side:`data-side`,align:`data-align`,...kn},va=class e{static defaultProps={delay:600,closeDelay:0,timeout:400};#e={...e.defaultProps};#t=0;#n=!1;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=W(t,e.defaultProps)}get delay(){return this.#e.delay}get closeDelay(){return this.#e.closeDelay}shouldSkipDelay(){return this.#n?!0:Date.now()-this.#t<this.#e.timeout}notifyOpen(){this.#n=!0}notifyClose(){this.#n=!1,this.#t=Date.now()}},ya=new Map;function ba(e){return e===void 0?``:Array.isArray(e)?e.join(`:`):e}function xa(e){let t=ba(e),n=ya.get(t);if(!n)try{n=new Intl.NumberFormat(e,{style:`percent`,maximumFractionDigits:0}),ya.set(t,n)}catch{return}return n}function Sa(e){return`${Math.round(Math.min(1,Math.max(0,e))*100)}%`}function Ca(e,t){let n=!Fe(e)||!Number.isFinite(e)?0:Math.min(1,Math.max(0,e));try{let e=xa(t)??xa(void 0);if(e)return e.format(n)}catch{}return Sa(n)}var wa=class e extends Ji{static defaultProps={...Ji.defaultProps,label:``,wheelStep:5};#e=null;#t;constructor(e){super(),e&&this.setProps(e)}setProps(t){super.setProps(W(t,e.defaultProps))}setMedia(e){this.#e=e}setFormatLocale(e){this.#t=e}getState(){let e=this.#e,{volume:t,muted:n}=e,r=n||t===0,{dragging:i,dragPercent:a}=this.input,o=t*100,s=i?this.valueFromPercent(a):o,c=super.getSliderState(s);return{...c,fillPercent:r?0:c.fillPercent,volume:t,muted:r,availability:e.volumeAvailability}}getWheelStepPercent(){let e=this.props,t=e.max-e.min;return t>0?e.wheelStep/t*100:0}getLabel(e){return super.getLabel(e)||fi}getValueText(e){return e.muted?di:this.getValueTextParams(e).percent}getValueTextParams(e){return{percent:Ca(e.value/100,this.#t)}}getAttrs(e){return{...super.getAttrs(e),"aria-valuetext":this.getValueText(e)}}},Ta={...Yi,availability:`data-availability`};_();var Ea=C(null),Da=Ea.Provider;function Oa(){let e=b(Ea);if(!e)throw Error(`AlertDialog compound components must be used within an AlertDialog.Root`);return e}var ka=Object.defineProperty,Aa=(e,t)=>{let n={};for(var r in e)ka(n,r,{get:e[r],enumerable:!0});return t||ka(n,Symbol.toStringTag,{value:`Module`}),n};_();var ja=j(function({render:e,className:t,style:n,disabled:r,...i},a){let{dialog:o,state:s}=Oa(),c=y(()=>{r||o.close()},[o,r]);return q(`button`,{render:e,className:t,style:n},{state:s,ref:[a],props:[{type:`button`,disabled:r,onClick:c},i]})});_();function Ma(e){let{displayName:t,tag:n,useContext:r,staticProps:i,getProps:a}=e,o=j(function(e,t){let{render:o,className:s,style:c,...l}=e,u=r(),d=a?.(u.state);return q(n,{render:o,className:s,style:c},{state:u.state,stateAttrMap:u.stateAttrMap,ref:t,props:[i,d,l].filter(Boolean)})});return o.displayName=t,o}var Na=Ma({displayName:`AlertDialogDescription`,tag:`p`,useContext:Oa,getProps:e=>({id:e.descriptionId})});_();var Pa=j(function({render:e,className:t,style:n,...r},i){let{core:a,dialog:o,state:s,stateAttrMap:c}=Oa(),l=R(i,y(e=>{o.setElement(e)},[o]));return s.open?q(`div`,{render:e,className:t,style:n},{state:s,stateAttrMap:c,ref:l,props:[{tabIndex:-1,...a.getAttrs(s)},r]}):null});_();var Fa=/[^a-zA-Z0-9_-]/g;function Ia(e){let t=O().replace(Fa,``);return e?`${e}-${t}`:t}_();function La({open:e,defaultOpen:t=Pr.defaultProps.defaultOpen,onOpenChange:n,onOpenChangeComplete:r,children:i}){let[a]=A(()=>new Pr),o=e!==void 0,s=U(n),c=U(r),[l]=A(()=>{let e=Dn({transition:or(),onOpenChange:e=>{s.current?.(e)},onOpenChangeComplete:e=>{c.current?.(e)}});return!o&&t&&e.open(),e}),u=Ia(`alert-dialog-title`),d=Ia(`alert-dialog-desc`);a.setTitleId(u),a.setDescriptionId(d),T(()=>{if(e===void 0)return;let{active:t}=l.input.current;e!==t&&(e?l.open():l.close())},[e,l]),$e(l);let p=Lt(l.input);return a.setInput(p),f(Da,{value:{core:a,dialog:l,state:a.getState(),stateAttrMap:Fr},children:i})}var Ra=Ma({displayName:`AlertDialogTitle`,tag:`h2`,useContext:Oa,getProps:e=>({id:e.titleId})}),za=Aa({Close:()=>ja,Description:()=>Na,Popup:()=>Pa,Root:()=>La,Title:()=>Ra});_();var Ba=j(function(e,t){let{render:n,className:r,style:i,delay:a,...o}=e,s=B(Jt),[c]=A(()=>new Ir);$e(c),c.setProps({delay:a}),s&&c.update(s);let l=m(e=>c.state.subscribe(e),()=>c.state.current,()=>c.state.current);return s?q(`div`,{render:n,className:r,style:i},{state:l,stateAttrMap:Lr,ref:[t],props:[o]}):null});_();var Va=C(null),Ha=Va.Provider;function Ua(){let e=b(Va);if(!e)throw Error(`Controls compound components must be used within a Controls.Root`);return e}function Wa(){return b(Va)}_();var Ga=j(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{state:s,stateAttrMap:c}=Ua(),l=o[`aria-label`]||o[`aria-labelledby`]?`group`:void 0;return q(`div`,{render:n,className:r,style:i},{state:s,stateAttrMap:c,ref:[t],props:[{role:l,children:a},o]})});_();var Ka=j(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=B(Wt),[c]=A(()=>new Rr);if(!s)return null;c.setMedia(s);let l=c.getState();return f(Ha,{value:{state:l,stateAttrMap:zr},children:q(`div`,{render:n,className:r,style:i},{state:l,stateAttrMap:zr,ref:[t],props:[{children:a},o,{"data-interactive":``}]})})}),qa=Aa({Group:()=>Ga,Root:()=>Ka});_();var Ja=C(null),Ya=Ja.Provider;function Xa(){let e=b(Ja);if(!e)throw Error(`ErrorDialog compound components must be used within an ErrorDialog.Root`);return e}_();var Za=j(function({render:e,className:t,style:n,disabled:r,children:i,...a},o){let s=ye(),{dialog:c,state:l,stateAttrMap:u}=Oa(),d=y(()=>{r||c.close()},[c,r]),f=i??G(ni(),s);return q(`button`,{render:e,className:t,style:n},{state:l,stateAttrMap:u,ref:o,props:[{type:`button`,disabled:r,onClick:d,children:f},a]})});_();var Qa=j(function({render:e,className:t,style:n,children:r,...i},a){let o=ye(),{state:s,stateAttrMap:c}=Oa(),{lastError:l}=Xa(),u=ri(l),d=r??G(u,o);return q(`p`,{render:e,className:t,style:n},{state:s,stateAttrMap:c,ref:a,props:[{id:s.descriptionId,children:d},i]})});_();function $a({children:e}){let[t]=A(()=>new Br),n=B(Gt),r=F(n?.error??null);n?.error&&(r.current=n.error);let i=U(n),[a]=A(()=>Dn({transition:or(),onOpenChange:e=>{e||i.current?.dismissError()}})),o=Ia(`error-dialog-title`),s=Ia(`error-dialog-desc`);t.setTitleId(o),t.setDescriptionId(s),T(()=>{let e=!!n?.error,{active:t}=a.input.current;e&&!t?a.open():!e&&t&&a.close()},[n?.error,a]),$e(a);let c=Lt(a.input);t.setInput(c);let l=t.getState();return n?f(Ya,{value:{lastError:r.current},children:f(Da,{value:{core:t,dialog:a,state:l,stateAttrMap:Fr},children:e})}):null}_();var eo=j(function({render:e,className:t,style:n,children:r,...i},a){let o=ye(),{state:s,stateAttrMap:c}=Oa(),l=r??G(ti(),o);return q(`h2`,{render:e,className:t,style:n},{state:s,stateAttrMap:c,ref:a,props:[{id:s.titleId,children:l},i]})}),to=Aa({Close:()=>Za,Description:()=>Qa,Popup:()=>Pa,Root:()=>$a,Title:()=>eo}),no=Nr({displayName:`FullscreenButton`,core:si,stateAttrMap:ci,selector:Kt,action:(e,t)=>e.toggle(t),hotkeyAction:`toggleFullscreen`,isSupported:e=>!e.hidden});_();function ro({type:e,action:t,value:n,pointer:r,region:i,disabled:a}){let o=B(),s=ge();return T(()=>{if(!s||!e||!t||a)return;let c=tn(t);if(!c)return;let l=e=>{c({store:o,value:n,event:e})},u={pointer:r,region:i,action:t,value:n};return e===`doubletap`?cn(s,l,u):sn(s,l,u)},[s,o,e,t,n,r,i,a]),null}var io=ro;_();function ao(){let[,e]=te(e=>e+1,0);return e}_();function oo(e){let t=U(e),n=F(null),r=F(null),i=ao(),[a]=A(()=>Zn({getElement:()=>n.current,getThumbElement:()=>r.current,getOrientation:()=>t.current.orientation??`horizontal`,isRTL:()=>n.current?Et(n.current):!1,isDisabled:()=>t.current.disabled??!1,getPercent:()=>t.current.getPercent(),getStepPercent:()=>t.current.getStepPercent(),getLargeStepPercent:()=>t.current.getLargeStepPercent(),changeThrottle:t.current.changeThrottle,adjustPercent:t.current.adjustPercent,onValueChange:e=>t.current.onValueChange?.(e),onValueCommit:e=>t.current.onValueCommit?.(e),onDragStart:()=>t.current.onDragStart?.(),onDragEnd:()=>t.current.onDragEnd?.()}));$e(a);let o=Lt(a.input),s=e.computeState(o);return S(()=>{s.thumbAlignment===`edge`&&n.current&&r.current&&i()},[s.thumbAlignment]),{state:s,cssVars:e.getCSSVars(a.adjustForAlignment(s)),rootRef:y(e=>{n.current=e},[]),thumbRef:y(e=>{r.current=e},[]),rootProps:a.rootProps,rootStyle:a.rootStyle,thumbProps:a.thumbProps}}_();function so({keys:e,action:t,value:n,disabled:r,target:i}){let a=B(),o=ge();return T(()=>{if(!o||!e||!t||r)return;let s=dn(t);if(s)return Tn(o,{keys:e,action:t,value:n,target:i,disabled:r,repeatable:!ln(t),onActivate:(e,t)=>{s({store:a,key:t,value:n})}})},[o,a,e,t,n,r,i]),null}var co=so;_();function lo(e){let t=e.side,[n,r]=A({preferred:t,side:t}),i=e.open&&n.preferred===t?n.side:t,a=E(()=>i===t?e:{...e,side:i},[i,e,t]),o=y(e=>r(n=>n.preferred===t&&n.side===e?n:{preferred:t,side:e}),[t]);return T(()=>{e.open||o(t)},[e.open,t,o]),{state:a,preferredSide:t,setPositionedSide:o}}var uo=Nr({displayName:`MuteButton`,core:ki,stateAttrMap:ji,selector:Qt,action:(e,t)=>e.toggle(t),hotkeyAction:`toggleMuted`}),fo=Nr({displayName:`PiPButton`,core:Fi,stateAttrMap:Ii,selector:qt,action:(e,t)=>e.toggle(t),hotkeyAction:`togglePictureInPicture`,isSupported:e=>!e.hidden}),po=Nr({displayName:`PlayButton`,core:Li,stateAttrMap:Ri,selector:Jt,action:(e,t)=>e.toggle(t),hotkeyAction:`togglePaused`}),mo=Nr({displayName:`PlaybackRateButton`,core:zi,stateAttrMap:Bi,selector:Yt,action:(e,t)=>e.cycle(t),hotkeyAction:`speedUp`});_();var ho=C(null),go=ho.Provider;function _o(){let e=b(ho);if(!e)throw Error(`Popover compound components must be used within a Popover.Root`);return e}var vo=Ma({displayName:`PopoverArrow`,tag:`div`,useContext:_o,staticProps:{"aria-hidden":`true`}});_();var yo={position:`fixed`,inset:`auto`,margin:0},bo=j(function({render:e,className:t,style:n,...r},i){let{core:a,popover:o,state:s,preferredSide:c,setPositionedSide:l,stateAttrMap:u,anchorName:d,popupId:f,boundary:p,container:m}=_o(),h=F(null),g=R(i,y(e=>{o.setPopupElement(e),e&&Dt()&&e.style.setProperty(`position-anchor`,`--${d}`)},[o,d]),h),_=E(()=>({side:c,align:s.align}),[c,s.align]),v=E(()=>{if(!Dt())return null;let{positionAnchor:e,...t}=Wn(d,_);return t},[d,_]),[b,x]=A(null);S(()=>{if(!s.open){x(null);return}function e(){let e=o.triggerElement,t=h.current;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getRootNode(),i=Fn(p,{container:m,root:r}),a=Yn(t,_.side),s=Pn(i),c=Jn(t),u=Mt(n,a,s,_,c),{positionAnchor:f,...g}=Wn(d,{..._,side:u},n,Dt()?void 0:a,s,c);x(g),l(u)}e();let t=o.triggerElement,n=h.current,r=n?Fn(p,{container:m,root:n.getRootNode()}):null,i=0;function a(t){t&&dr(t,h.current)||(cancelAnimationFrame(i),i=requestAnimationFrame(e))}a();let c=typeof ResizeObserver==`function`?new ResizeObserver(()=>{a()}):null;return t&&c&&c.observe(t),n&&c&&c.observe(n),r&&c&&c.observe(r),window.addEventListener(`scroll`,a,{capture:!0,passive:!0}),window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(i),c?.disconnect(),window.removeEventListener(`scroll`,a,!0),window.removeEventListener(`resize`,a)}},[s.open,d,_,o,p,m,l]);let C=b??v??yo;if(!s.open)return null;let{onFocusOut:w,...T}=o.popupProps;return q(`div`,{render:e,className:t,style:n},{state:s,stateAttrMap:u,ref:g,props:[{id:f,style:C,...a.getPopupAttrs(s)},{...T,onBlur:w},r]})});_();function xo({open:e,defaultOpen:t=Vi.defaultProps.defaultOpen,onOpenChange:n,onOpenChangeComplete:r,openOnHover:i=Vi.defaultProps.openOnHover,delay:a=Vi.defaultProps.delay,closeDelay:o=Vi.defaultProps.closeDelay,boundary:s=`container`,children:c,...l}){let u=Te(),d=Oe(),p=Wa(),[m]=A(()=>new Vi(l));m.setProps(l);let h=!V(e),g=U(n),_=U(r),v=U(l.closeOnEscape),y=U(l.closeOnOutsideClick),b=U(i),x=U(a),S=U(o),C=U(d),[w]=A(()=>{let e=jn({transition:or(),onOpenChange:(e,t)=>{g.current?.(e,t)},onOpenChangeComplete:e=>{_.current?.(e)},closeOnEscape:()=>v.current??Vi.defaultProps.closeOnEscape,closeOnOutsideClick:()=>y.current??Vi.defaultProps.closeOnOutsideClick,openOnHover:()=>b.current,delay:()=>x.current,closeDelay:()=>S.current,group:()=>C.current});return!h&&t&&e.open(`click`),e}),E=Ia(),D=Ia(`popup`);T(()=>{if(V(e))return;let{active:t}=w.input.current;e!==t&&(e?w.open(`click`):w.close(`click`))},[e,w]),T(()=>{V(p?.state.visible)||p.state.visible||w.close(`imperative-action`)},[p?.state.visible,w]),$e(w);let O=Lt(w.input);m.setInput(O);let{state:k,preferredSide:ee,setPositionedSide:j}=lo(m.getState());return f(go,{value:{core:m,popover:w,state:k,preferredSide:ee,setPositionedSide:j,stateAttrMap:Hi,anchorName:E,popupId:D,boundary:s,container:u},children:c})}_();var So=j(function({render:e,className:t,style:n,...r},i){let{core:a,popover:o,state:s,stateAttrMap:c,anchorName:l,popupId:u}=_o(),d=y(e=>{o.setTriggerElement(e),e&&Dt()&&e.style.setProperty(`anchor-name`,`--${l}`)},[o,l]),{onFocusIn:f,onFocusOut:p,...m}=o.triggerProps;return q(`button`,{render:e,className:t,style:n},{state:s,stateAttrMap:c,ref:[i,d],props:[{type:`button`,...a.getTriggerAttrs(s,u)},{...m,onFocus:f,onBlur:p},r]})}),Co=Aa({Arrow:()=>vo,Popup:()=>bo,Root:()=>xo,Trigger:()=>So}),wo=Nr({displayName:`SeekButton`,core:Ki,stateAttrMap:qi,selector:Zt,action:(e,t)=>e.seek(t),hotkeyAction:`seekStep`,hotkeyValue:e=>typeof e.seconds==`number`?e.seconds:Ki.defaultProps.seconds});_();var To=j(function(e,t){let{render:n,className:r,style:i,time:a=0,thumbnails:o,crossOrigin:s,loading:c,fetchPriority:l,...u}=e,[d]=A(()=>new nr),p=F(null),m=F(null),h=Ee(Xt),[,g]=A(0),[_]=A(()=>rr({getContainer:()=>p.current,getImg:()=>m.current,onStateChange:()=>g(e=>e+1)}));$e(_,()=>_.connect());let v=E(()=>o&&o.length>0?o:h&&h.thumbnailCues.length>0?Qi(h.thumbnailCues,h.thumbnailTrackSrc??void 0):[],[o,h]),y=E(()=>d.findActiveThumbnail(v,a),[d,v,a]);_.updateSrc(y?.url);let b=d.getState(_.loading,_.error,y),x={overflow:`hidden`},S;if(y&&_.naturalWidth&&_.naturalHeight){let e=_.readConstraints(),t=d.resize(y,_.naturalWidth,_.naturalHeight,e);t&&(x={overflow:`hidden`,width:t.containerWidth,height:t.containerHeight},S={width:t.imageWidth,height:t.imageHeight,maxWidth:`none`,transform:t.offsetX||t.offsetY?`translate(-${t.offsetX}px, -${t.offsetY}px)`:void 0})}return q(`div`,{render:n,className:r,style:i},{state:b,stateAttrMap:Xi,ref:[t,p],props:[d.getAttrs(b),{style:x},u,{children:f(`img`,{ref:m,alt:``,"aria-hidden":`true`,decoding:`async`,src:y?.url,crossOrigin:s===``||s===null?void 0:s,loading:c,style:S,fetchPriority:l})}]})});_();var Eo=C(null);function Do({value:e,children:t}){return f(Eo.Provider,{value:e,children:t})}function Oo(){let e=b(Eo);if(!e)throw Error(`Slider compound components must be used within a Slider.Root`);return e}var ko=Ma({displayName:`SliderBuffer`,tag:`div`,useContext:Oo}),Ao=Ma({displayName:`SliderFill`,tag:`div`,useContext:Oo});_();var jo=j(function(e,t){let{render:n,className:r,style:i,overflow:a=`clamp`,...o}=e,s=Oo(),{state:c}=s,l=F(null),[u,d]=A(0);T(()=>{let e=l.current;if(!e)return;let t=new ResizeObserver(([e])=>{d(e.contentRect.width)});return t.observe(e),()=>t.disconnect()},[]);let f=tr(u,a);return q(`div`,{render:n,className:r,style:i},{state:c,stateAttrMap:s.stateAttrMap,ref:[t,l],props:[{style:f},o]})});_();var Mo=j(function(e,t){let{render:n,className:r,style:i,label:a,min:o,max:s,step:c,largeStep:l,orientation:u,disabled:d,thumbAlignment:p,value:m=0,onValueChange:h,onValueCommit:g,onDragStart:_,onDragEnd:v,...y}=e,[b]=A(()=>new Ji),x=ye();b.setProps({label:a,min:o,max:s,step:c,largeStep:l,orientation:u,disabled:d,thumbAlignment:p});let{state:S,cssVars:C,rootRef:w,thumbRef:T,rootProps:E,rootStyle:D,thumbProps:O}=oo({computeState:e=>(b.setInput(e),b.getSliderState(m)),getPercent:()=>b.percentFromValue(m),getStepPercent:()=>b.getStepPercent(),getLargeStepPercent:()=>b.getLargeStepPercent(),orientation:u,disabled:d,adjustPercent:(e,t,n)=>b.adjustPercentForAlignment(e,t,n),getCSSVars:$n,onValueChange:e=>h?.(b.valueFromPercent(e)),onValueCommit:e=>g?.(b.valueFromPercent(e)),onDragStart:_,onDragEnd:v});return f(Do,{value:{state:S,pointerValue:b.valueFromPercent(S.pointerPercent),thumbRef:T,thumbProps:O,stateAttrMap:Yi,getAttrs:e=>{let t=b.getAttrs(e);return{...t,"aria-label":G(t[`aria-label`],x)}},formatValue:void 0},children:q(`div`,{render:n,className:r,style:i},{state:S,stateAttrMap:Yi,ref:[t,w],props:[{style:{...C,...D}},E,y]})})});_();var No=j(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Oo(),{state:s,thumbRef:c,thumbProps:l,getAttrs:u}=o,d=u(s);return q(`div`,{render:n,className:r,style:i},{state:s,stateAttrMap:o.stateAttrMap,ref:[t,c],props:[d,l,a]})});_();var Po=j(function(e,t){let{pointerValue:n}=Oo();return f(To,{ref:t,...e,time:n})}),Fo=Ma({displayName:`SliderTrack`,tag:`div`,useContext:Oo});_();var Io=j(function(e,t){let{render:n,className:r,style:i,type:a=`current`,format:o,...s}=e,c=Oo(),{state:l,pointerValue:u,formatValue:d}=c,f=a===`pointer`?u:l.value,p=o?o(f):d?d(f,a):String(Math.round(f));return q(`output`,{render:n,className:r,style:i},{state:l,stateAttrMap:c.stateAttrMap,ref:t,props:[{"aria-live":`off`,children:p},s]})}),Lo=Aa({Buffer:()=>ko,Fill:()=>Ao,Preview:()=>jo,Root:()=>Mo,Thumb:()=>No,Thumbnail:()=>Po,Track:()=>Fo,Value:()=>Io});_();var Ro=j(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e;return q(`span`,{render:n,className:r,style:i},{state:{},ref:[t],props:[{children:a},o]})});_();var zo=j(function(e,t){let{render:n,className:r,style:i,children:a=`/`,...o}=e;return q(`span`,{render:n,className:r,style:i},{state:{},ref:[t],props:[{"aria-hidden":`true`,children:a},o]})});_(),D();var Bo=j(function(e,t){let{render:n,className:r,style:i,type:a,negativeSign:o,label:s,toggle:c=!1,...l}=e,u=B(Zt),d=ye(),p=Ne(),[m]=A(()=>new ua),h=a??ua.defaultProps.type,[g,_]=A(h);if(T(()=>{_(h)},[h,c]),m.setProps({type:g,negativeSign:o,label:s,toggle:c}),!u)return null;m.setMedia(u);let v=m.getState(),y=m.getAttrs(v,h),b=m.getLabelParams(v)?{duration:v.type===`remaining`?G(ra,d,{duration:Si(Math.abs(v.seconds),{locale:p})}):Si(Math.abs(v.seconds),{locale:p})}:void 0,x=v.negative?f(w,{children:[f(`span`,{"aria-hidden":`true`,children:o??ua.defaultProps.negativeSign}),v.text]}):v.text,S=()=>{_(e=>h===`current`?e===`remaining`?`current`:`remaining`:e===`duration`?`remaining`:`duration`)},C=e=>{e.defaultPrevented||S()},E=e=>{!e.defaultPrevented&&Me(e.nativeEvent)&&(e.preventDefault(),!e.repeat&&S())};return q(`time`,{render:n,className:r,style:i},{state:v,stateAttrMap:da,ref:[t],props:[{dateTime:v.datetime,children:x,...y,"aria-label":G(y[`aria-label`],d,b),...c?{onClick:C,onKeyDown:E}:void 0},l]})}),Vo=Aa({Group:()=>Ro,Separator:()=>zo,Value:()=>Bo});_();var Ho=()=>Promise.resolve(0),Uo=j(function(e,t){let{render:n,className:r,style:i,label:a,changeThrottle:o=pa.defaultProps.changeThrottle,step:s=pa.defaultProps.step,largeStep:c=pa.defaultProps.largeStep,orientation:l,disabled:u,thumbAlignment:d,onDragStart:p,onDragEnd:m,pauseOnDrag:h,...g}=e,_=B(Zt),v=B(Ut),y=B(Jt),b=ye(),x=Ne(),[S]=A(()=>new pa);S.setProps({label:a,step:s,largeStep:c,orientation:l,disabled:u,thumbAlignment:d,pauseOnDrag:h,changeThrottle:o}),S.setFormatLocale(x);let C=U(_&&v?{..._,...v}:null),w=U(y);T(()=>()=>S.endDrag(w.current),[S]);let E=_?.duration??0,{state:D,cssVars:O,rootRef:k,thumbRef:ee,rootProps:j,rootStyle:M,thumbProps:N}=oo({computeState:e=>(S.setInput(e),!_||!v?S.setMedia({currentTime:0,duration:0,seeking:!1,seek:Ho,buffered:[],seekable:[]}):S.setMedia({..._,...v}),S.getState()),getPercent:()=>E>0?(_?.currentTime??0)/E*100:0,getStepPercent:()=>S.getStepPercent(),getLargeStepPercent:()=>S.getLargeStepPercent(),orientation:l,disabled:u,changeThrottle:o,adjustPercent:(e,t,n)=>S.adjustPercentForAlignment(e,t,n),getCSSVars:er,onValueCommit:e=>{let t=C.current;t&&t.seek(S.rawValueFromPercent(e))},onDragStart:()=>{S.startDrag(w.current),p?.()},onDragEnd:()=>{S.endDrag(w.current),m?.()}});return _?f(Do,{value:{state:D,pointerValue:S.valueFromPercent(D.pointerPercent),thumbRef:ee,thumbProps:N,stateAttrMap:ma,getAttrs:e=>{let t=S.getAttrs(e);return{...t,"aria-label":G(t[`aria-label`],b),"aria-valuetext":G(t[`aria-valuetext`],b,S.getValueTextParams(e))}},formatValue:e=>bi(e,E)},children:q(`div`,{render:n,className:r,style:i},{state:D,stateAttrMap:ma,ref:[t,k],props:[{style:{...O,...M}},j,g]})}):null}),Wo=Aa({Buffer:()=>ko,Fill:()=>Ao,Preview:()=>jo,Root:()=>Uo,Thumb:()=>No,Track:()=>Fo,Value:()=>Io}),Go=Ma({displayName:`TooltipArrow`,tag:`div`,useContext:Ar,staticProps:{"aria-hidden":`true`}});_();var Ko=j(function({render:e,className:t,style:n,children:r,...i},a){let{state:o,stateAttrMap:s,content:c}=Ar(),l=r===void 0?c?.label??``:r;return q(`span`,{render:e,className:t,style:n},{state:o,stateAttrMap:s,ref:a,props:[i,{children:l}]})});_();var qo=j(function({render:e,className:t,style:n,children:r,...i},a){let{state:o,stateAttrMap:s,content:c}=Ar(),l=r??c?.shortcut??null;return l?q(`kbd`,{render:e,className:t,style:n},{state:o,stateAttrMap:s,ref:a,props:[i,{children:l}]}):null});_(),D();var Jo={position:`fixed`,inset:`auto`,margin:0},Yo=j(function({render:e,className:t,style:n,children:r,...i},a){let{core:o,tooltip:s,state:c,preferredSide:l,setPositionedSide:u,stateAttrMap:d,anchorName:p,popupId:m,boundary:h,container:g}=Ar(),_=F(null),v=R(a,y(e=>{s.setPopupElement(e),e&&Dt()&&e.style.setProperty(`position-anchor`,`--${p}`)},[s,p]),_),b=E(()=>({side:l,align:c.align}),[l,c.align]),x=E(()=>{if(!Dt())return null;let{positionAnchor:e,...t}=Wn(p,b,void 0,void 0,void 0,void 0,ga);return t},[p,b]),[C,T]=A(null);S(()=>{if(!c.open){T(null);return}function e(){let e=s.triggerElement,t=_.current;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getRootNode(),i=Fn(h,{container:g,root:r}),a=Yn(t,b.side),o=Pn(i),c=Jn(t,ga),l=Mt(n,a,o,b,c),{positionAnchor:d,...f}=Wn(p,{...b,side:l},n,Dt()?void 0:a,o,c,ga);T(f),u(l)}e();let t=s.triggerElement,n=_.current,r=n?Fn(h,{container:g,root:n.getRootNode()}):null,i=0;function a(t){t&&dr(t,_.current)||(cancelAnimationFrame(i),i=requestAnimationFrame(e))}a();let o=typeof ResizeObserver==`function`?new ResizeObserver(()=>{a()}):null;return t&&o&&o.observe(t),n&&o&&o.observe(n),r&&o&&o.observe(r),window.addEventListener(`scroll`,a,{capture:!0,passive:!0}),window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(i),o?.disconnect(),window.removeEventListener(`scroll`,a,!0),window.removeEventListener(`resize`,a)}},[c.open,p,b,s,h,g,u]);let D=C??x??Jo;if(!c.open)return null;let O=r===void 0?f(w,{children:[f(Ko,{}),f(qo,{})]}):r,{onFocusOut:k,...ee}=s.popupProps;return q(`div`,{render:e,className:t,style:n},{state:c,stateAttrMap:d,ref:v,props:[{id:m,style:D,...o.getPopupAttrs(c)},{children:O},{...ee,onBlur:k},i]})});_();var Xo=C(null),Zo=Xo.Provider;function Qo(){return b(Xo)?.group}_();function $o({delay:e,closeDelay:t,timeout:n,children:r}){let[i]=A(()=>new va({delay:e,closeDelay:t,timeout:n}));return i.setProps({delay:e,closeDelay:t,timeout:n}),f(Zo,{value:{group:i},children:r})}_();function es({open:e,defaultOpen:t=ha.defaultProps.defaultOpen,onOpenChange:n,onOpenChangeComplete:r,delay:i=ha.defaultProps.delay,closeDelay:a=ha.defaultProps.closeDelay,disableHoverablePopup:o=ha.defaultProps.disableHoverablePopup,disabled:s=ha.defaultProps.disabled,boundary:c=`container`,children:l,...u}){let d=Te(),p=Wa(),[m]=A(()=>new ha(u));m.setProps(u);let h=!V(e),g=Qo(),_=U(n),v=U(r),y=U(i),b=U(a),x=U(o),S=U(s),C=U(g),[w]=A(()=>{let e=ar({transition:or(),onOpenChange:(e,t)=>{_.current?.(e,t)},onOpenChangeComplete:e=>{v.current?.(e)},delay:()=>y.current,closeDelay:()=>b.current,disableHoverablePopup:()=>x.current,disabled:()=>S.current,group:()=>C.current});return!h&&t&&e.open(),e}),[E,D]=A(),O=Ia(),k=Ia(`tooltip`);T(()=>{if(V(e))return;let{active:t}=w.input.current;e!==t&&(e?w.open():w.close())},[e,w]),T(()=>{V(p?.state.visible)||p.state.visible||w.close(`imperative-action`)},[p?.state.visible,w]),$e(w);let ee=Lt(w.input);m.setInput(ee);let{state:j,preferredSide:M,setPositionedSide:N}=lo(m.getState());return f(kr,{value:{core:m,tooltip:w,state:j,preferredSide:M,setPositionedSide:N,stateAttrMap:_a,anchorName:O,popupId:k,content:E,setContent:D,boundary:c,container:d},children:l})}_();var ts=j(function({render:e,className:t,style:n,...r},i){let{tooltip:a,state:o,stateAttrMap:s,anchorName:c}=Ar(),l=y(e=>{a.setTriggerElement(e),e&&Dt()&&e.style.setProperty(`anchor-name`,`--${c}`)},[a,c]),{onFocusIn:u,onFocusOut:d,...f}=a.triggerProps;return q(`button`,{render:e,className:t,style:n},{state:o,stateAttrMap:s,ref:[i,l],props:[{type:`button`},{...f,onFocus:u,onBlur:d},r]})}),ns=Aa({Arrow:()=>Go,Label:()=>Ko,Popup:()=>Yo,Provider:()=>$o,Root:()=>es,Shortcut:()=>qo,Trigger:()=>ts});_();var rs={volume:0,muted:!1,volumeAvailability:`unsupported`,setVolume:()=>0,toggleMuted:()=>!1},is=j(function(e,t){let{render:n,className:r,style:i,label:a,orientation:o,step:s=wa.defaultProps.step,largeStep:c=wa.defaultProps.largeStep,wheelStep:l=wa.defaultProps.wheelStep,disabled:u,thumbAlignment:d,onDragStart:p,onDragEnd:m,...h}=e,g=B(Qt),_=ye(),v=Ne(),[b]=A(()=>new wa);b.setProps({label:a,orientation:o,step:s,largeStep:c,wheelStep:l,disabled:u,thumbAlignment:d}),b.setFormatLocale(v);let x=U(g),S=U(u),C=()=>(x.current?.volume??0)*100,w=()=>b.getStepPercent(),T=e=>x.current?.setVolume(e/100),{state:E,cssVars:D,rootRef:O,thumbRef:k,rootProps:ee,rootStyle:j,thumbProps:M}=oo({computeState:e=>(b.setInput(e),b.setMedia(g??rs),b.getState()),getPercent:C,getStepPercent:w,getLargeStepPercent:()=>b.getLargeStepPercent(),orientation:o,disabled:u,adjustPercent:(e,t,n)=>b.adjustPercentForAlignment(e,t,n),getCSSVars:$n,onValueChange:T,onValueCommit:T,onDragStart:p,onDragEnd:m}),[N]=A(()=>ur({isDisabled:()=>!!S.current||!x.current,getPercent:()=>(x.current?.volume??0)*100,getStepPercent:()=>b.getWheelStepPercent(),onValueChange:e=>x.current?.setVolume(e/100)})),P=F(null),te=y(e=>{P.current?.(),P.current=null,e&&(P.current=H(e,`wheel`,N.onWheel,{passive:!1}))},[N]);return g?f(Do,{value:{state:E,pointerValue:b.valueFromPercent(E.pointerPercent),thumbRef:k,thumbProps:M,stateAttrMap:Ta,getAttrs:e=>{let t=b.getAttrs(e);return{...t,"aria-label":G(t[`aria-label`],_),"aria-valuetext":G(t[`aria-valuetext`],_,b.getValueTextParams(e))}},formatValue:e=>`${Math.round(e)}%`},children:q(`div`,{render:n,className:r,style:i},{state:E,stateAttrMap:Ta,ref:[t,O,te],props:[{style:{...D,...j}},ee,h]})}):null}),as=Aa({Fill:()=>Ao,Preview:()=>jo,Root:()=>is,Thumb:()=>No,Track:()=>Fo,Value:()=>Io});P();var os=({title:e,remote:t,children:n})=>{let r=E(()=>t?M(t):null,[t]);return T(()=>r?.hold(),[r]),T(()=>r?ct(r.served(r.media)):void 0,[r]),k(tt,{media:r?.media??null,title:e,children:n})},ss=({play:e,signIn:t,rent:n})=>/^\/(ap\/signin|ax\/claim)\b|\/auth-redirect\b/.test(location.pathname)?`signed-out`:document.querySelector(e)?`play`:document.querySelector(t)?`signed-out`:document.querySelector(n)?`rent`:`pending`,cs=({play:e})=>{let t=document.querySelector(e);if(!t)throw Object.assign(Error(`Prime Video Play is not on the page`),{name:`PrimeControlMissingError`});t.click()},ls=({videos:e})=>[...document.querySelectorAll(e)].findIndex(e=>e.readyState>0);P();var us={play:`[data-testid="dp-atf-play-button"]`,signIn:l,rent:`[data-automation-id^="ab-"][data-automation-id*="tvod"]`},ds=`#dv-web-player video`,fs=`
|
|
2
|
+
html, body {
|
|
3
|
+
margin: 0 !important;
|
|
4
|
+
padding: 0 !important;
|
|
5
|
+
width: 100% !important;
|
|
6
|
+
height: 100% !important;
|
|
7
|
+
overflow: hidden !important;
|
|
8
|
+
background: #000 !important;
|
|
9
|
+
}
|
|
10
|
+
*:not(:has(#dv-web-player)):not(#dv-web-player):not(#dv-web-player *) {
|
|
11
|
+
display: none !important;
|
|
12
|
+
}
|
|
13
|
+
#dv-web-player {
|
|
14
|
+
position: fixed !important;
|
|
15
|
+
inset: 0 !important;
|
|
16
|
+
width: 100% !important;
|
|
17
|
+
height: 100% !important;
|
|
18
|
+
z-index: 9999999 !important;
|
|
19
|
+
}
|
|
20
|
+
#dv-web-player :has(video),
|
|
21
|
+
#dv-web-player video {
|
|
22
|
+
position: absolute !important;
|
|
23
|
+
inset: 0 !important;
|
|
24
|
+
width: 100% !important;
|
|
25
|
+
height: 100% !important;
|
|
26
|
+
transform: none !important;
|
|
27
|
+
}
|
|
28
|
+
#dv-web-player video {
|
|
29
|
+
object-fit: contain !important;
|
|
30
|
+
}
|
|
31
|
+
#dv-web-player *:not(:has(video)):not(video) {
|
|
32
|
+
opacity: 0 !important;
|
|
33
|
+
pointer-events: none !important;
|
|
34
|
+
}
|
|
35
|
+
`,ps=3e4,ms=3e4,hs=e=>{let t=new URL(e);return t.pathname===`/watch`&&(t.pathname=`/detail`),t.href},gs=async(e,t,n)=>{let r=Date.now()+n;for(;!t()&&Date.now()<r;){try{let t=await e();if(t!==void 0)return t}catch(e){if(e?.name===`LocatorUnsupportedError`)throw e}await new Promise(e=>setTimeout(e,200))}},_s=h`
|
|
36
|
+
to { transform: rotate(360deg); }
|
|
37
|
+
`,vs=d`
|
|
38
|
+
position: relative;
|
|
39
|
+
width: 100%;
|
|
40
|
+
height: 100%;
|
|
41
|
+
background: #000;
|
|
42
|
+
user-select: none;
|
|
43
|
+
-webkit-user-select: none;
|
|
44
|
+
|
|
45
|
+
.pv-frame {
|
|
46
|
+
position: absolute;
|
|
47
|
+
inset: 0;
|
|
48
|
+
width: 100%;
|
|
49
|
+
height: 100%;
|
|
50
|
+
border: none;
|
|
51
|
+
background: #000;
|
|
52
|
+
/* taps belong to the player's controls stacked above it */
|
|
53
|
+
pointer-events: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.overlay {
|
|
57
|
+
position: absolute;
|
|
58
|
+
inset: 0;
|
|
59
|
+
display: flex;
|
|
60
|
+
flex-direction: column;
|
|
61
|
+
align-items: center;
|
|
62
|
+
justify-content: center;
|
|
63
|
+
gap: 1.6rem;
|
|
64
|
+
background: #000;
|
|
65
|
+
font-size: 1.4rem;
|
|
66
|
+
color: rgba(255, 255, 255, 0.8);
|
|
67
|
+
z-index: 30;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.login-button {
|
|
71
|
+
padding: 0.8rem 2rem;
|
|
72
|
+
background: #00a8e1;
|
|
73
|
+
color: #fff;
|
|
74
|
+
border: none;
|
|
75
|
+
border-radius: 0.4rem;
|
|
76
|
+
font-size: 1.4rem;
|
|
77
|
+
font-weight: 600;
|
|
78
|
+
text-decoration: none;
|
|
79
|
+
cursor: pointer;
|
|
80
|
+
|
|
81
|
+
&:hover {
|
|
82
|
+
background: #0090c2;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&:disabled {
|
|
86
|
+
opacity: 0.6;
|
|
87
|
+
cursor: default;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.loading-spinner {
|
|
92
|
+
box-sizing: border-box;
|
|
93
|
+
width: calc(4 * var(--mp-unit, 10px));
|
|
94
|
+
height: calc(4 * var(--mp-unit, 10px));
|
|
95
|
+
border-radius: 50%;
|
|
96
|
+
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
97
|
+
border-top-color: #fff;
|
|
98
|
+
animation: ${_s} 0.8s linear infinite;
|
|
99
|
+
}
|
|
100
|
+
`,ys=({url:e,title:a})=>{let s=t(e),[c,l]=A(`detecting`),[u,d]=A(null),[f,p]=A(null),[m,h]=A(!0),[g,_]=A(!1),[b,x]=A(!1),[S,C]=A(),[w,E]=A(null),[D,O]=A(0),[ee,j]=A(0),[M,P]=A(!1),[te,ne]=A(!1),ie=F(void 0),I=F(!0);T(()=>()=>{I.current=!1,clearInterval(ie.current)},[]),T(()=>{let e=!1;return oe().then(t=>{e||l(t)}),()=>{e=!0}},[]),T(()=>{if(!u||c===`detecting`)return;let e=!1;return ae({iframe:u,domains:[...r].sort((e,t)=>Number(t===s)-Number(e===s)),cookies:re(c),permissions:[{category:`evaluation`,reason:`Press Play on the episode and see whether you are signed in`}]}).then(t=>{e||p(t)}).catch(t=>{e||(console.error(`Failed to attach Prime Video frame`,t),C(t?.message||`Failed to load player`),h(!1))}),()=>{e=!0}},[u,c,s]),T(()=>{if(!f)return;let t=!1,r=()=>t;return h(!0),C(void 0),_(!1),x(!1),E(null),(async()=>{await f.goto(hs(e),{waitUntil:`commit`});let i=await gs(async()=>{let e=await f.evaluate(ss,us);return e===`pending`?void 0:e},r,ps);if(t)return;if(i&&fe.record(`prime`,i===`signed-out`?`signed-out`:`signed-in`),i===`signed-out`){h(!1),_(!0);return}if(i===`rent`){h(!1),x(!0),n();return}if(!i)throw Error(`Prime Video shows no Play button for this episode.`);await f.evaluate(cs,us);let a=await gs(async()=>{let e=await f.evaluate(ls,{videos:ds});return e<0?void 0:f.locator(ds).nth(e).videoElement()},r,ms);if(!t){if(!a)throw Error(`The episode did not load a player.`);await f.addStyleTag({content:fs}),!t&&(h(!1),E(a))}})().catch(e=>{t||(console.error(`Failed to load Prime Video player`,e),C(e?.message||`Failed to load player`),h(!1))}),()=>{t=!0}},[f,e,D]);let se=y(()=>{p(null),C(void 0),E(null),_(!1),x(!1),ne(!1),h(!0),j(e=>e+1)},[]),ce=y(()=>{ne(!1);let e=o(s);if(c===`extension`){let t=globalThis.open(e,`_blank`,`width=500,height=700`);if(!t)return ne(!0);P(!0),clearInterval(ie.current),ie.current=setInterval(()=>{t.closed&&(clearInterval(ie.current),P(!1),O(e=>e+1))},500);return}let t=he({url:e,domains:r,isSignedIn:i});P(!0),t.then(e=>{if(I.current){if(e===`blocked`)return ne(!0);if(e===`unsupported`)return C(`The Prime Video sign-in window could not open here.`);if(e===`authed`)return se();O(e=>e+1)}},e=>{I.current&&(console.error(`Prime Video sign-in window failed`,e),C(e?.message||`The sign-in window failed`))}).finally(()=>{I.current&&P(!1)})},[c,se,s]),le=k(`a`,{className:`login-button`,href:hs(e),target:`_blank`,rel:`noreferrer`,children:`Open on Prime Video`}),L=(m||S||g||b)&&k(`div`,{className:`overlay`,children:S?N(v,{children:[S,k(`button`,{className:`login-button`,onClick:se,children:`Retry`}),le]}):g?N(v,{children:[te?`Allow popups for this page to sign in.`:`Sign in to Prime Video to watch.`,k(`button`,{className:`login-button`,onClick:ce,disabled:M,children:M?`Finish signing in the window...`:`Sign in to Prime Video`})]}):b?N(v,{children:[`Prime Video offers this episode only to rent or buy here.`,le]}):k(`div`,{className:`loading-spinner`,role:`status`,"aria-label":`Loading`})});return N(`div`,{css:vs,children:[c!==`detecting`&&k(os,{title:a,remote:w,children:k(`iframe`,{ref:d,className:`pv-frame`,referrerPolicy:`no-referrer`,allow:`encrypted-media; autoplay; fullscreen;`},`${c}-${ee}`)}),L]})},bs=({menu:e,section:t,option:n,sectionIndex:r})=>[...[...document.querySelectorAll(e)].flatMap(e=>[...e.querySelectorAll(t)])[r]?.querySelectorAll(n)??[]].map(e=>({label:e.getAttribute(`aria-label`)??``,selected:e.getAttribute(`aria-checked`)===`true`,disabled:e.getAttribute(`aria-disabled`)===`true`})),xs=async({button:e,timeout:t})=>{let n=Date.now()+t,r=document.querySelector(e);for(;!r&&Date.now()<n;)await new Promise(e=>setTimeout(e,100)),r=document.querySelector(e);if(!r)throw Object.assign(Error(`Crunchyroll button is not on the page: ${e}`),{name:`CrunchyrollControlMissingError`});let i=r.getBoundingClientRect(),a={bubbles:!0,cancelable:!0,composed:!0,clientX:i.left+i.width/2,clientY:i.top+i.height/2,button:0},o={...a,pointerType:`mouse`,pointerId:1,isPrimary:!0};r.dispatchEvent(new PointerEvent(`pointerdown`,{...o,buttons:1})),r.dispatchEvent(new MouseEvent(`mousedown`,{...a,buttons:1})),r.dispatchEvent(new PointerEvent(`pointerup`,{...o,buttons:0})),r.dispatchEvent(new MouseEvent(`mouseup`,{...a,buttons:0})),r.dispatchEvent(new MouseEvent(`click`,{...a,buttons:0}))},Ss=({menu:e,section:t,option:n,sectionIndex:r,optionIndex:i})=>{let a=[...document.querySelectorAll(e)].flatMap(e=>[...e.querySelectorAll(t)])[r]?.querySelectorAll(n)[i];if(!a)throw Object.assign(Error(`Crunchyroll option ${i} is not in the menu: ${e}`),{name:`CrunchyrollControlMissingError`});let o=a.getBoundingClientRect(),s={bubbles:!0,cancelable:!0,composed:!0,clientX:o.left+o.width/2,clientY:o.top+o.height/2,button:0},c={...s,pointerType:`mouse`,pointerId:1,isPrimary:!0};a.dispatchEvent(new PointerEvent(`pointerdown`,{...c,buttons:1})),a.dispatchEvent(new MouseEvent(`mousedown`,{...s,buttons:1})),a.dispatchEvent(new PointerEvent(`pointerup`,{...c,buttons:0})),a.dispatchEvent(new MouseEvent(`mouseup`,{...s,buttons:0})),a.dispatchEvent(new MouseEvent(`click`,{...s,buttons:0}))},Cs=async({timeline:e,time:t,timeout:n})=>{let r=Date.now()+n,i=document.querySelector(e);for(;!i&&Date.now()<r;)await new Promise(e=>setTimeout(e,100)),i=document.querySelector(e);if(i?.tagName!==`INPUT`)throw Object.assign(Error(`Crunchyroll timeline is not on the page`),{name:`CrunchyrollControlMissingError`});let a=i,o=Number(a.min||0),s=Number(a.max||100),c=a.getBoundingClientRect(),l=Math.max(0,Math.min(1,(t-o)/(s-o))),u={bubbles:!0,cancelable:!0,composed:!0,clientX:c.left+c.width*l,clientY:c.top+c.height/2,button:0},d={...u,pointerType:`mouse`,pointerId:1,isPrimary:!0},f=a.type===`range`&&Number.isFinite(o)&&Number.isFinite(s)&&s>o;f&&(a.dispatchEvent(new PointerEvent(`pointerdown`,{...d,buttons:1})),a.dispatchEvent(new MouseEvent(`mousedown`,{...u,buttons:1}))),a._valueTracker?.setValue(``),Object.getOwnPropertyDescriptor(Object.getPrototypeOf(a),`value`).set.call(a,String(t)),a.dispatchEvent(new Event(`input`,{bubbles:!0})),f&&(a.dispatchEvent(new PointerEvent(`pointerup`,{...d,buttons:0})),a.dispatchEvent(new MouseEvent(`mouseup`,{...u,buttons:0}))),a.dispatchEvent(new Event(`change`,{bubbles:!0}))},ws=`stub:pictureinpicturerefused`,Ts=({video:e})=>{let t=document.querySelector(e);if(!document.pictureInPictureEnabled||typeof t?.requestPictureInPicture!=`function`)return!1;let n=(e,t)=>e.dispatchEvent(new CustomEvent(`stub:pictureinpicturerefused`,{detail:`${t.name}: ${t.message}`})),r=t=>{if(!t.isTrusted||(t.stopImmediatePropagation(),t.type!==`click`))return;t.preventDefault();let r=document.querySelector(e);r&&(r.disablePictureInPicture=!1,r.requestPictureInPicture().catch(e=>n(r,e)))};for(let e of[`pointerdown`,`mousedown`,`pointerup`,`mouseup`,`click`,`dblclick`])window.addEventListener(e,r,!0);return!0},Es=`[data-testid="track-selection-button"]`,Ds=`[data-testid="audio-text-track-menu"]`,Os=`[data-testid="player-settings-menu-button"]`,ks=`.timeline-slider`,As=`[role="menu"]`,js=`[role="menuitemradio"]`,Ms=1e4,Ns=2e3,Ps=2e4,Fs=5e3,Is=100,Ls=/^(off|none|disabled)$/i,Rs={button:Es,open:Ds,menu:Ds,section:As,option:js,timeout:Ms},zs={button:Os,open:`${Os}[aria-expanded="true"]`,menu:`:has(> ${Os}) + [role="menu"]`,section:`${As}:has(${js})`,option:js,timeout:Ns},Bs={audio:{...Rs,sectionIndex:0},subtitles:{...Rs,sectionIndex:1},quality:{...zs,sectionIndex:0}},Vs=e=>new Promise(t=>setTimeout(t,e)),Hs=()=>!1,Y=e=>{if(e())throw Error(`Crunchyroll track operation cancelled`)},Us=e=>e.replace(/\s+/g,` `).trim(),Ws=(e,t)=>{let n=[...new Map(t.map(e=>({...e,label:Us(e.label)})).filter(e=>e.label).map(e=>[e.id,e])).values()],r=n.find(e=>e.selected);if(!r&&e!==`quality`)return;let i=e===`subtitles`?n.find(e=>Ls.test(e.label)):void 0,a=n.filter(e=>e!==i).map(e=>({id:e.id,label:e.label,disabled:e.disabled||void 0}));if(!(a.length<2&&!i)&&a.length)return{options:a,selectedId:!r||r===i?null:r.id,...i?{offLabel:i.label}:{}}},Gs=async(e,{button:t,open:n,timeout:r},i)=>{Y(i);let a=e.locator(n);if(await a.exists({timeout:1e3})){Y(i);return}Y(i),await e.evaluate(xs,{button:t,timeout:r});let o=Date.now()+r;for(;Date.now()<o;){if(Y(i),await a.exists({timeout:1e3}))return;await Vs(Is)}throw Error(`Crunchyroll menu did not open: ${t}`)},Ks=async(e,t,n)=>{Y(n);let r=await e.evaluate(bs,Bs[t]);Y(n);let i=r.map((e,t)=>({...e,label:Us(e.label),index:t})),a=new Map;for(let e of i)a.set(e.label,(a.get(e.label)??0)+1);let o=new Map;return i.map(e=>{let t=(o.get(e.label)??0)+1;return o.set(e.label,t),{...e,id:a.get(e.label)===1?e.label:`${e.label}#${t}`}})},qs=async(e,t,n)=>Ws(t,await Ks(e,t,n)),Js=async(e,t)=>{try{return await e.locator(Os).exists({timeout:1e3})?(await Gs(e,Bs.quality,t),await qs(e,`quality`,t)):void 0}catch(e){if(t())throw e;return}},Ys=async(e,t=Hs)=>{await Gs(e,Bs.audio,t);let[n,r]=await Promise.all([qs(e,`audio`,t),qs(e,`subtitles`,t)]);return{audio:n,subtitles:r,quality:await Js(e,t)}},Xs=async(e,t,n,r)=>(await Ks(e,t,r)).find(e=>n===null?Ls.test(e.label):e.id===n)?.index??-1,Zs=async(e,t,n,r)=>{let i=Date.now()+Ps;for(;Date.now()<i;){Y(r),await Gs(e,Bs[t],r);let i=(await Ks(e,t,r)).find(e=>e.selected);if(i&&(n===null?Ls.test(i.label):i.id===n))return;await Vs(Is)}throw Error(`Crunchyroll did not apply the ${t} option`)},Qs=(e,t)=>{let n=Number.isFinite(e)?Math.max(0,e):0;return!Number.isFinite(t)||t<=0?n:Math.min(n,Math.max(0,t-.1))},$s=e=>({currentTime:e.currentTime,paused:e.paused,playbackRate:e.playbackRate}),ec=(e,t)=>e.evaluate(Cs,{timeline:ks,time:t,timeout:Ps}),tc=async(e,t,n)=>{let r=Date.now()+5e3;for(;Date.now()<r&&(Y(n),!(e.currentSrc!==t||e.readyState<2));)await Vs(Is);if(e.currentSrc===t&&e.readyState>=2)return!1;let i=Date.now()+Ps;for(;Date.now()<i;){if(Y(n),e.readyState>=2)return!0;await Vs(Is)}throw Error(`Crunchyroll playback did not become ready after changing tracks`)},nc=async(e,t,n,r)=>{Y(r),t.playbackRate=n.playbackRate;let i=Qs(n.currentTime,t.duration);Math.abs(t.currentTime-i)>2&&await ec(e,i);let a=Date.now()+Ps;for(;Date.now()<a&&(Math.abs(t.currentTime-i)>2||t.seeking||t.readyState<2);)Y(r),await Vs(Is);if(Math.abs(t.currentTime-i)>2||t.seeking||t.readyState<2)throw Error(`Crunchyroll playback position was not restored after changing tracks`);Y(r),n.paused?t.pause():await t.play();let o=Date.now()+Fs;for(;Date.now()<o&&t.paused!==n.paused;)Y(r),await Vs(Is);if(t.paused!==n.paused)throw Error(`Crunchyroll playback state was not restored after changing tracks`)},rc=async(e,t,n,r,i=Hs)=>{await Gs(e,Bs[n],i);let a=await Xs(e,n,r,i);if(a<0)throw Error(`Crunchyroll ${n} option is no longer available`);Y(i);let o=t.currentSrc,s=$s(t);return await e.evaluate(Ss,{...Bs[n],optionIndex:a}),await Zs(e,n,r,i),n!==`quality`&&await tc(t,o,i)&&await nc(e,t,s,i),Ys(e,i)},ic=(e,t)=>{ec(e,t).catch(e=>console.warn(`[cr] timeline seek failed:`,e))},ac=(e,t)=>new Proxy(e,{set(e,n,r,i){return n===`currentTime`&&typeof r==`number`&&Number.isFinite(r)&&ic(t,r),Reflect.set(e,n,r,i)}});P();var oc=({title:e,remote:t,frame:n,subtitles:r,audioTracks:i,quality:a,thumbnails:o,chapters:s,pictureInPicture:c,children:l})=>{let u=E(()=>t?M(t):null,[t]);T(()=>u?.hold(),[u]);let d=E(()=>u&&n?ac(u.media,n):null,[u,n]);return T(()=>u&&d?ct(u.served(d)):void 0,[u,d]),k(tt,{media:d,title:e,subtitles:r,audioTracks:i,quality:a,thumbnails:o,chapters:s,pictureInPicture:c,children:l})},sc=3e4,cc=async(e,t)=>{let n=Date.now()+sc,r=!1;for(;!t();){let i=await e.locator(`.shell-header`).exists();r||=i;let[a,o]=await Promise.all([e.locator(`#user-menu-anonymous`).exists(),e.locator(`#user-menu-authenticated`).exists()]);if(t())break;if(o)return{isLoggedIn:o,isLoggedOut:!1};let s=Date.now()>=n;if(a&&!i&&(r||s))return{isLoggedIn:o,isLoggedOut:a};if(s)break;await new Promise(e=>setTimeout(e,100))}throw Error(`Login state check timed out`)};P();var lc=`video`,uc=(e,t,n)=>{let[r,i]=A(null);return T(()=>{if(!e||!t)return;let n=!1;(async()=>e.evaluate(Ts,{video:lc}))().then(e=>{!n&&e&&i(t)},e=>{n||console.warn(`[cr] picture in picture unavailable:`,e)});let r=e=>console.warn(`[cr] picture in picture refused:`,e.detail);return t.addEventListener(ws,r),()=>{n=!0,t.removeEventListener(ws,r),i(null)}},[e,t]),E(()=>r&&r===t&&n?{onArmedChange:e=>{n.style.pointerEvents=e?`auto`:``}}:void 0,[r,t,n])},dc=class extends Error{name=`BifParseError`},fc=[137,66,73,70,13,10,26,10],pc=64,mc=8,hc=4294967295,gc=36e3,_c=e=>{if(e.byteLength<pc)throw new dc(`truncated header: ${e.byteLength} bytes`);let t=new DataView(e);if(fc.some((e,n)=>t.getUint8(n)!==e))throw new dc(`bad magic`);let n=t.getUint32(12,!0),r=t.getUint32(16,!0)||1e3;if(n>gc)throw new dc(`implausible frame count ${n}`);let i=pc+(n+1)*mc;if(i>e.byteLength)throw new dc(`truncated index: ${n} frames need ${i} bytes, have ${e.byteLength}`);let a=e=>t.getUint32(pc+e*mc,!0),o=e=>t.getUint32(pc+e*mc+4,!0);if(a(n)!==hc)throw new dc(`the index does not end on the 0xffffffff entry`);let s=[];for(let t=0;t<n;t+=1){let c=o(t),l=o(t+1);if(c<i||l<=c||l>e.byteLength)throw new dc(`image ${t} spans ${c}..${l}, outside ${i}..${e.byteLength}`);let u=a(t),d=t+1===n;if(!d&&a(t+1)<=u)throw new dc(`timestamps do not increase at image ${t}`);s.push({start:u*r,end:d?1/0:a(t+1)*r,bytes:new Uint8Array(e,c,l-c)})}return s},vc=(e,t)=>{if(!e.length||!Number.isFinite(t))return;let n=0,r=e.length-1;for(;n<r;){let i=Math.ceil((n+r)/2);e[i].start<=t?n=i:r=i-1}return e[n]},yc=async({waitMs:e,fetchMs:t,maxBytes:n})=>{let r=/^(?:https?:\/\/|\/)\S*\.bif(?:[?#]\S*)?$/i,i=e=>typeof e==`string`&&e.length<8192&&e.includes(`.bif`)&&r.test(e),a=(e,t)=>{try{return e?.[t]}catch{return}},o=e=>{let t=Object.keys(e).find(e=>e.startsWith(`__reactFiber$`)||e.startsWith(`__reactInternalInstance$`));return t?a(e,t):void 0},s=e=>{let t=[],n=new Set,r=[e,...Array.from(e.querySelectorAll(`*`)).slice(0,3e3)];for(let e of r){let r=o(e);for(let e=0;r&&e<40&&!n.has(r);e+=1){n.add(r);let e=a(a(r,`memoizedProps`),`value`);e&&typeof e==`object`&&t.push(e),r=a(r,`return`)}}return t},c=e=>{let t=new Set,n=e,r=0;for(let e=0;e<=8&&n.length;e+=1){let e=[];for(let o of n){if(t.has(o))continue;if(t.add(o),r+=1,r>2e4)return;let n;try{n=Object.keys(o).slice(0,500)}catch{continue}for(let t of n){let n=a(o,t);if(i(n))return n;n&&typeof n==`object`&&(n===window||typeof a(n,`nodeType`)==`number`||ArrayBuffer.isView(n)||n instanceof ArrayBuffer||e.push(n))}}n=e}},l=e=>{let t=[];for(let n of e){let e=a(a(n,`volumeVM`),`_player`);if(!e||typeof e!=`object`)continue;let r=a(a(a(e,`playerOrchestrator`),`thumbnailOrchestrator`),`_currentBifUrl`);if(i(r))return{url:r,via:`named`};t.push(e)}let n=c(t.length?t:e);return n?{url:n,via:`search`}:void 0},u=async(e,r)=>{let i=new AbortController,a=setTimeout(()=>i.abort(),t);try{let t=await fetch(e,{signal:i.signal});if(!t.ok)return{none:`fetch-failed`,detail:`HTTP ${t.status}`};let a=Number(t.headers.get(`content-length`));if(a>n)return{none:`too-large`,detail:`${a} bytes`};let o=await t.arrayBuffer();return o.byteLength>n?{none:`too-large`,detail:`${o.byteLength} bytes`}:{bytes:o,via:r}}catch(e){return{none:`fetch-failed`,detail:String(e)}}finally{clearTimeout(a)}};try{let t=Date.now()+e,n=!1;for(;;){let e=document.querySelector(`.video-player-wrapper`);if(e?.querySelector(`video`)){n=!0;let t=l(s(e));if(t)return await u(t.url,t.via)}if(Date.now()>=t)return{none:n?`no-bif`:`no-player`};await new Promise(e=>setTimeout(e,500))}}catch(e){return{none:`failed`,detail:String(e)}}},bc={waitMs:1e4,fetchMs:15e3,maxBytes:31457280},xc=e=>{let t=new Map,n=!1;return{at:r=>{if(n)return;let i=vc(e,r*1e3);if(!i)return;let a=t.get(i);return a||(a={url:URL.createObjectURL(new Blob([i.bytes],{type:`image/jpeg`})),startTime:i.start/1e3,endTime:i.end/1e3},t.set(i,a)),a},dispose:()=>{n=!0;for(let{url:e}of t.values())URL.revokeObjectURL(e);t.clear()}}},Sc=async e=>{let t=await e.evaluate(yc,bc);if(`none`in t)throw Error(`no BIF: ${t.none}${t.detail?` (${t.detail})`:``}`);let n=_c(t.bytes);if(!n.length)throw Error(`no BIF: the file has no images`);return xc(n)},Cc=async(e,t)=>{for(;!t();){if(await e.locator(`.erc-region-restricted, .erc-blocked-stream [data-t="unavailable-svg"], .erc-not-found`).exists().catch(()=>!1))return!0;await new Promise(e=>setTimeout(e,250))}return!1};P();var wc=de(()=>localStorage,new BroadcastChannel(ue)),Tc=`
|
|
101
|
+
html, body {
|
|
102
|
+
margin: 0 !important;
|
|
103
|
+
padding: 0 !important;
|
|
104
|
+
width: 100% !important;
|
|
105
|
+
height: 100% !important;
|
|
106
|
+
background: #000 !important;
|
|
107
|
+
}
|
|
108
|
+
*:not(:has(.video-player-wrapper)):not(.video-player-wrapper):not(.video-player-wrapper *) {
|
|
109
|
+
display: none !important;
|
|
110
|
+
}
|
|
111
|
+
div[data-testid="player-controls-root"] {
|
|
112
|
+
display: none !important;
|
|
113
|
+
}
|
|
114
|
+
.video-player-wrapper,
|
|
115
|
+
.video-player,
|
|
116
|
+
.player-container,
|
|
117
|
+
.video-player-wrapper > *,
|
|
118
|
+
.video-player > *,
|
|
119
|
+
.player-container > * {
|
|
120
|
+
position: absolute !important;
|
|
121
|
+
inset: 0 !important;
|
|
122
|
+
width: 100% !important;
|
|
123
|
+
height: 100% !important;
|
|
124
|
+
z-index: 9999999;
|
|
125
|
+
}
|
|
126
|
+
.video-player-wrapper video,
|
|
127
|
+
.video-player video,
|
|
128
|
+
.player-container video {
|
|
129
|
+
width: 100% !important;
|
|
130
|
+
height: 100% !important;
|
|
131
|
+
object-fit: contain !important;
|
|
132
|
+
}
|
|
133
|
+
.video-player-wrapper *:not(:has(video)):not(video):not(:has(.timeline-slider)):not(.timeline-slider) {
|
|
134
|
+
display: none !important;
|
|
135
|
+
}
|
|
136
|
+
.timeline-container,
|
|
137
|
+
.timeline-container *,
|
|
138
|
+
.timeline-slider {
|
|
139
|
+
opacity: 0 !important;
|
|
140
|
+
pointer-events: none !important;
|
|
141
|
+
}
|
|
142
|
+
/* shows only where the frame takes pointer events: the player's picture in picture control, armed */
|
|
143
|
+
html, html * {
|
|
144
|
+
cursor: pointer !important;
|
|
145
|
+
}
|
|
146
|
+
`,Ec=`This episode is not available on Crunchyroll in your region. Try another source.`,Dc=3e4,Oc=async(e,t)=>{let n=Date.now()+Dc;for(;!t()&&Date.now()<n;){try{if(await e.locator(`video`).exists())return t()?null:await e.locator(`video`).videoElement()}catch(e){if(e?.name===`LocatorUnsupportedError`)throw e}await new Promise(e=>setTimeout(e,100))}return null},kc=h`
|
|
147
|
+
to { transform: rotate(360deg); }
|
|
148
|
+
`,Ac=d`
|
|
149
|
+
position: relative;
|
|
150
|
+
width: 100%;
|
|
151
|
+
height: 100%;
|
|
152
|
+
background: #000;
|
|
153
|
+
/* The double-tap-to-fullscreen gesture otherwise word-selects the
|
|
154
|
+
skin's labels/time readouts, flashing them blue. Player chrome isn't
|
|
155
|
+
meant to be selected, so suppress it across the whole player. */
|
|
156
|
+
user-select: none;
|
|
157
|
+
-webkit-user-select: none;
|
|
158
|
+
|
|
159
|
+
.cr-frame {
|
|
160
|
+
position: absolute;
|
|
161
|
+
inset: 0;
|
|
162
|
+
width: 100%;
|
|
163
|
+
height: 100%;
|
|
164
|
+
border: none;
|
|
165
|
+
background: #000;
|
|
166
|
+
/* CR's own chrome is hidden, so the iframe must not swallow clicks -
|
|
167
|
+
taps belong to the videojs gesture layer stacked above it. The one
|
|
168
|
+
exception is picture-in-picture.ts, which lifts this while the
|
|
169
|
+
player's picture in picture control is under the pointer. */
|
|
170
|
+
pointer-events: none;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.overlay {
|
|
174
|
+
position: absolute;
|
|
175
|
+
inset: 0;
|
|
176
|
+
display: flex;
|
|
177
|
+
flex-direction: column;
|
|
178
|
+
align-items: center;
|
|
179
|
+
justify-content: center;
|
|
180
|
+
gap: 1.6rem;
|
|
181
|
+
background: #000;
|
|
182
|
+
font-size: 1.4rem;
|
|
183
|
+
color: rgba(255, 255, 255, 0.8);
|
|
184
|
+
/* Above the skin's own layers (its controls/error dialog top out at
|
|
185
|
+
z-index 20) so the login/loading screen fully covers them. */
|
|
186
|
+
z-index: 30;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.login-button {
|
|
190
|
+
padding: 0.8rem 2rem;
|
|
191
|
+
background: #f47521;
|
|
192
|
+
color: #fff;
|
|
193
|
+
border: none;
|
|
194
|
+
border-radius: 0.4rem;
|
|
195
|
+
font-size: 1.4rem;
|
|
196
|
+
font-weight: 600;
|
|
197
|
+
cursor: pointer;
|
|
198
|
+
|
|
199
|
+
&:hover {
|
|
200
|
+
background: #e0651a;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
&:disabled {
|
|
204
|
+
opacity: 0.6;
|
|
205
|
+
cursor: default;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/* @banou/media-player's own buffering spinner (overlay.tsx), same box and centre, so when the video
|
|
210
|
+
arrives still buffering the player's spinner takes over from this one without a jump */
|
|
211
|
+
.loading-spinner {
|
|
212
|
+
box-sizing: border-box;
|
|
213
|
+
width: calc(4 * var(--mp-unit, 10px));
|
|
214
|
+
height: calc(4 * var(--mp-unit, 10px));
|
|
215
|
+
border-radius: 50%;
|
|
216
|
+
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
217
|
+
border-top-color: #fff;
|
|
218
|
+
animation: ${kc} 0.8s linear infinite;
|
|
219
|
+
}
|
|
220
|
+
`,jc=({url:e,title:t,triedRelays:r=[],unlistedRelays:i})=>{let[o,s]=A(`detecting`),[c,l]=A(null),[d,f]=A(null),[p,m]=A(!0),[h,g]=A(!1),[_,b]=A(),[x,S]=A(!1),C=F(r),[w,D]=A(null),[O,ee]=A(0),[j,M]=A(0),[P,te]=A(!1),[ie,I]=A(!1),L=F(null),ue=F(null),[de,me]=A(!1),ge=F(!1),[R,_e]=A(),[z,ve]=A(0),[B,ye]=A(),be=yt(e,w),xe=uc(d,w,c),Se=F(0),Ce=F({generation:0,tail:Promise.resolve()}),we=F(!0),Te=y(()=>{let e=Se.current+1;return Se.current=e,Ce.current={generation:e,tail:Promise.resolve()},_e(void 0),e},[]),Ee=y((e,t)=>{if(Ce.current.generation!==e)return Promise.reject(Error(`Crunchyroll track operation cancelled`));let n=Ce.current,r=n.tail.then(t);return n.tail=r.then(()=>{},()=>{}),r},[]);T(()=>()=>{we.current=!1,Se.current+=1},[]),T(()=>{let e=!1;return oe().then(t=>{e||s(t)}),()=>{e=!0}},[]),T(()=>{if(!c||o===`detecting`)return;let e=!1;return Promise.resolve(o===`cloud`?i:void 0).then(t=>{for(let e of t??[])C.current.includes(e)||(C.current=[...C.current,e]);if(!e)return ae({iframe:c,domains:ne,cookies:re(o),relay:C.current.length?{exclude:C.current}:void 0,permissions:[{category:`evaluation`,reason:`Switch audio, subtitles and quality, seek, show seek thumbnails and open picture in picture`}]})}).then(t=>{!e&&t&&f(t)}).catch(t=>{if(!e){if(m(!1),le(t))return S(!0),n();console.error(`Failed to attach Crunchyroll frame`,t),b(t?.message||`Failed to load player`)}}),()=>{e=!0}},[c,o]);let De=y(()=>{f(null),b(void 0),D(null),Te(),g(!1),m(!0),M(e=>e+1)},[Te]);T(()=>{if(!d)return;let t=!1,i=!1,s=()=>t||i;m(!0),b(void 0),g(!1),D(null),Te();let c=async()=>{o!==`cloud`&&await d.addStyleTag({content:Tc});let{isLoggedIn:e}=await cc(d,s);return s()?null:(fe.record(`crunchyroll`,e?`signed-in`:`signed-out`),e?(o===`cloud`&&await d.addStyleTag({content:Tc}),s()?null:Oc(d,s)):`signed-out`)};return(async()=>{if(await d.goto(e,{waitUntil:`commit`}),t)return;let o=c(),l=Cc(d,s).then(async e=>e?`unavailable`:o),u=await Promise.race([o,l]).finally(()=>{i=!0});if(!t){if(u===`unavailable`){let e=ce(d);if(e&&!C.current.includes(e)){C.current=[...C.current,e],De();return}m(!1),S(!0),n();return}if(m(!1),u===`signed-out`){g(!0);return}if(!u)throw Error(`The episode did not load a player.`);for(let e of C.current)r.includes(e)||a(e);D(u)}})().catch(e=>{t||(console.error(`Failed to load Crunchyroll player`,e),b(e?.message||`Failed to load player`),m(!1))}),()=>{t=!0}},[d,e,O,o,Te,De]),T(()=>{if(!d||!w)return;let e=Te(),t=!1,n=()=>t||!we.current||e!==Se.current;return(async()=>{let t,r;for(let i=0;i<5&&!n();i+=1){try{if(r=await Ee(e,()=>Ys(d,n)),t=void 0,n()||(_e(r),r.audio&&r.subtitles))return}catch(e){t=e}await new Promise(e=>setTimeout(e,500))}if(!r&&t)throw t})().then(()=>{},e=>{n()||console.warn(`[cr] track discovery failed:`,e)}),()=>{t=!0}},[d,w,Te,Ee]),T(()=>{if(!d||!w)return;let e=!1,t;return Sc(d).then(n=>{if(e)return n.dispose();t=n,ye(n)},t=>{e||console.warn(`[cr] seek thumbnails unavailable:`,t)}),()=>{e=!0,t?.dispose(),ye(void 0)}},[d,w]);let Oe=Se.current,V=y((e,t)=>{if(!d||!w)return Promise.reject(Error(`Crunchyroll player is not ready`));let n=()=>!we.current||Oe!==Se.current;return ve(e=>e+1),Ee(Oe,async()=>{try{let r=await rc(d,w,e,t,n);if(n())throw Error(`Crunchyroll track operation cancelled`);_e(r)}catch(e){if(!n())try{let e=await Ys(d,n);n()||_e(e)}catch{}throw e}}).finally(()=>ve(e=>e-1))},[d,w,Ee,Oe]),ke=E(()=>R?.subtitles&&{selection:{...R.subtitles,select:e=>V(`subtitles`,e)}},[R?.subtitles,V]),Ae=E(()=>R?.audio&&{selection:{...R.audio,select:e=>V(`audio`,e)}},[R?.audio,V]),je=E(()=>R?.quality&&{selection:{...R.quality,select:e=>V(`quality`,e)}},[R?.quality,V]),Me=E(()=>{let e=e=>e&&{ids:e.options.filter(e=>!e.disabled).map(e=>e.id),selected:e.selectedId};return{subtitles:e(R?.subtitles),audio:e(R?.audio),busy:z>0}},[R,z]);T(()=>u(Me,(e,t)=>{V(e,t).catch(()=>{})}),[Me,V]);let H=y(()=>{if(L.current!==null)return;let e=globalThis.open(pe,`_blank`,`width=500,height=700`);if(!e){I(!0),m(!1);return}I(!1),te(!0),ue.current=e;let t=setInterval(()=>{e.closed&&(clearInterval(t),wc.connect(`cr`),L.current===t&&(L.current=null),ue.current===e&&(ue.current=null),te(!1),ee(e=>e+1))},500);L.current=t},[]),Ne=y(()=>{if(ge.current)return;ge.current=!0;let e=he({url:pe,domains:ne,isSignedIn:se});I(!1),me(!0),e.then(e=>{if(e!==`blocked`&&wc.connect(`cr`),we.current){if(e===`blocked`){I(!0);return}if(e===`unsupported`){b(`The Crunchyroll sign-in window could not be opened here.`);return}if(e===`authed`){De();return}g(!1),m(!0),ee(e=>e+1)}},e=>{we.current&&(console.error(`Crunchyroll sign-in window failed`,e),b(e?.message||`The sign-in window failed`))}).finally(()=>{ge.current=!1,we.current&&me(!1)})},[De]);T(()=>()=>{L.current!==null&&(clearInterval(L.current),L.current=null)},[]),T(()=>{L.current!==null&&(clearInterval(L.current),L.current=null,te(!1)),I(!1)},[e]);let Pe=y(()=>{ue.current!==null&&(ue.current.close(),ue.current=null),L.current!==null&&(clearInterval(L.current),L.current=null),I(!1),te(!1),De()},[De]),Fe=(p||_||ie||h||x)&&N(`div`,{className:`overlay`,children:[x&&Ec,h&&!_&&!ie&&N(v,{children:[`Sign in to Crunchyroll to watch.`,o===`extension`?k(`button`,{className:`login-button`,onClick:H,disabled:P,children:P?`Finish signing in the popup...`:`Open Crunchyroll Login Page`}):k(`button`,{className:`login-button`,onClick:Ne,disabled:de,children:de?`Finish signing in the window...`:`Sign in to Crunchyroll`})]}),ie&&!_&&N(v,{children:[`The login popup was blocked. Allow popups for this page and try again.`,k(`button`,{className:`login-button`,onClick:o===`extension`?H:Ne,children:`Open Crunchyroll Login Page`})]}),_&&N(v,{children:[_,k(`button`,{className:`login-button`,onClick:Pe,children:`Retry`})]}),p&&!_&&!h&&k(`div`,{className:`loading-spinner`,role:`status`,"aria-label":`Loading`})]});return N(`div`,{css:Ac,children:[o!==`detecting`&&k(oc,{title:t,remote:w,frame:d,subtitles:ke,audioTracks:Ae,quality:je,thumbnails:B,chapters:be,pictureInPicture:xe,children:k(`iframe`,{ref:l,className:`cr-frame`,referrerPolicy:`no-referrer`,allow:`encrypted-media; autoplay; fullscreen;`},`${o}-${j}`)}),Fe]})},X=e=>e,Z=X(({className:e,children:t})=>k(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:18,height:18,fill:`none`,"aria-hidden":`true`,className:e,children:t})),Mc=X(({className:e})=>k(Z,{className:e,children:k(`path`,{fill:`currentColor`,d:`m14.051 10.723-7.985 4.964a1.98 1.98 0 0 1-2.758-.638A2.06 2.06 0 0 1 3 13.964V4.036C3 2.91 3.895 2 5 2c.377 0 .747.109 1.066.313l7.985 4.964a2.057 2.057 0 0 1 .627 2.808c-.16.257-.373.475-.627.637`})})),Nc=X(({className:e})=>N(Z,{className:e,children:[k(`rect`,{width:5,height:14,x:2,y:2,fill:`currentColor`,rx:1.75}),k(`rect`,{width:5,height:14,x:11,y:2,fill:`currentColor`,rx:1.75})]})),Pc=X(({className:e})=>N(Z,{className:e,children:[k(`path`,{fill:`currentColor`,d:`M9 17a8 8 0 0 1-8-8h2a6 6 0 1 0 1.287-3.713l1.286 1.286A.25.25 0 0 1 5.396 7H1.25A.25.25 0 0 1 1 6.75V2.604a.25.25 0 0 1 .427-.177l1.438 1.438A8 8 0 1 1 9 17`}),k(`path`,{fill:`currentColor`,d:`m11.61 9.639-3.331 2.07a.826.826 0 0 1-1.15-.266.86.86 0 0 1-.129-.452V6.849C7 6.38 7.374 6 7.834 6c.158 0 .312.045.445.13l3.331 2.071a.858.858 0 0 1 0 1.438`})]})),Fc=X(({className:e})=>k(Z,{className:e,children:k(`path`,{fill:`currentColor`,d:`M1 9c0 2.21.895 4.21 2.343 5.657l1.414-1.414a6 6 0 1 1 8.956-7.956l-1.286 1.286a.25.25 0 0 0 .177.427h4.146a.25.25 0 0 0 .25-.25V2.604a.25.25 0 0 0-.427-.177l-1.438 1.438A8 8 0 0 0 1 9`})})),Ic=X(({className:e})=>k(Z,{className:e,children:k(`path`,{fill:`currentColor`,d:`M.714 6.008h3.072l4.071-3.857c.5-.376 1.143 0 1.143.601V15.28c0 .602-.643.903-1.143.602l-4.071-3.858H.714c-.428 0-.714-.3-.714-.752V6.76c0-.451.286-.752.714-.752M14.5 7.586l-1.768-1.768a1 1 0 1 0-1.414 1.414L13.085 9l-1.767 1.768a1 1 0 0 0 1.414 1.414l1.768-1.768 1.768 1.768a1 1 0 0 0 1.414-1.414L15.914 9l1.768-1.768a1 1 0 0 0-1.414-1.414z`})})),Lc=X(({className:e})=>k(Z,{className:e,children:k(`path`,{fill:`currentColor`,d:`M.714 6.008h3.072l4.071-3.857c.5-.376 1.143 0 1.143.601V15.28c0 .602-.643.903-1.143.602l-4.071-3.858H.714c-.428 0-.714-.3-.714-.752V6.76c0-.451.286-.752.714-.752m10.568.59a.91.91 0 0 1 0-1.316.91.91 0 0 1 1.316 0c1.203 1.203 1.47 2.216 1.522 3.208q.012.255.011.51c0 1.16-.358 2.733-1.533 3.803a.7.7 0 0 1-.298.156c-.382.106-.873-.011-1.018-.156a.91.91 0 0 1 0-1.316c.57-.57.995-1.551.995-2.487 0-.944-.26-1.667-.995-2.402`})})),Rc=X(({className:e})=>N(Z,{className:e,children:[k(`path`,{fill:`currentColor`,d:`M15.6 3.3c-.4-.4-1-.4-1.4 0s-.4 1 0 1.4C15.4 5.9 16 7.4 16 9s-.6 3.1-1.8 4.3c-.4.4-.4 1 0 1.4.2.2.5.3.7.3.3 0 .5-.1.7-.3C17.1 13.2 18 11.2 18 9s-.9-4.2-2.4-5.7`}),k(`path`,{fill:`currentColor`,d:`M.714 6.008h3.072l4.071-3.857c.5-.376 1.143 0 1.143.601V15.28c0 .602-.643.903-1.143.602l-4.071-3.858H.714c-.428 0-.714-.3-.714-.752V6.76c0-.451.286-.752.714-.752m10.568.59a.91.91 0 0 1 0-1.316.91.91 0 0 1 1.316 0c1.203 1.203 1.47 2.216 1.522 3.208q.012.255.011.51c0 1.16-.358 2.733-1.533 3.803a.7.7 0 0 1-.298.156c-.382.106-.873-.011-1.018-.156a.91.91 0 0 1 0-1.316c.57-.57.995-1.551.995-2.487 0-.944-.26-1.667-.995-2.402`})]})),zc=X(({className:e})=>k(Z,{className:e,children:k(`path`,{fill:`currentColor`,d:`M9.57 3.617A1 1 0 0 0 8.646 3H4c-.552 0-1 .449-1 1v4.646a.996.996 0 0 0 1.001 1 1 1 0 0 0 .706-.293l4.647-4.647a1 1 0 0 0 .216-1.089m4.812 4.812a1 1 0 0 0-1.089.217l-4.647 4.647a.998.998 0 0 0 .708 1.706H14c.552 0 1-.449 1-1V9.353a1 1 0 0 0-.618-.924`})})),Bc=X(({className:e})=>k(Z,{className:e,children:k(`path`,{fill:`currentColor`,d:`M7.883 1.93a.99.99 0 0 0-1.09.217L2.146 6.793A.998.998 0 0 0 2.853 8.5H7.5c.551 0 1-.449 1-1V2.854a1 1 0 0 0-.617-.924m7.263 7.57H10.5c-.551 0-1 .449-1 1v4.646a.996.996 0 0 0 1.001 1.001 1 1 0 0 0 .706-.293l4.646-4.646a.998.998 0 0 0-.707-1.707z`})})),Vc=X(({className:e})=>N(Z,{className:e,children:[k(`path`,{fill:`currentColor`,d:`M13 2a4 4 0 0 1 4 4v2.035A3.5 3.5 0 0 0 16.5 8H15V6.273C15 5.018 13.96 4 12.679 4H4.32C3.04 4 2 5.018 2 6.273v5.454C2 12.982 3.04 14 4.321 14H6v1.5q0 .255.035.5H4a4 4 0 0 1-4-4V6a4 4 0 0 1 4-4z`}),k(`rect`,{width:10,height:7,x:8,y:10,fill:`currentColor`,rx:2}),k(`path`,{fill:`currentColor`,d:`M7.129 5.547a.6.6 0 0 0-.656.13L3.677 8.473A.6.6 0 0 0 4.102 9.5h2.796c.332 0 .602-.27.602-.602V6.103a.6.6 0 0 0-.371-.556`})]})),Hc=X(({className:e})=>N(Z,{className:e,children:[k(`path`,{fill:`currentColor`,d:`M13 2a4 4 0 0 1 4 4v2.036A3.5 3.5 0 0 0 16.5 8H15V6.273C15 5.018 13.96 4 12.679 4H4.32C3.04 4 2 5.018 2 6.273v5.454C2 12.982 3.04 14 4.321 14H6v1.5q0 .255.036.5H4a4 4 0 0 1-4-4V6a4 4 0 0 1 4-4z`}),k(`rect`,{width:10,height:7,x:8,y:10,fill:`currentColor`,rx:2}),k(`path`,{fill:`currentColor`,d:`M4.871 10.454a.6.6 0 0 0 .656-.131l2.796-2.796A.6.6 0 0 0 7.898 6.5H5.102a.603.603 0 0 0-.602.602v2.795a.6.6 0 0 0 .371.556`})]})),Uc=X(({className:e})=>k(Z,{className:e,children:k(`path`,{fill:`currentColor`,d:`M15 2a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V5a3 3 0 0 1 3-3zM4 11a1 1 0 1 0 0 2h5a1 1 0 1 0 0-2zm8 0a1 1 0 1 0 0 2h2a1 1 0 1 0 0-2zM4 8a1 1 0 0 0 0 2h1a1 1 0 0 0 0-2zm4 0a1 1 0 0 0 0 2h3a1 1 0 1 0 0-2zm6 0a1 1 0 1 0 0 2 1 1 0 0 0 0-2`})})),Wc=X(({className:e})=>N(Z,{className:e,children:[k(`rect`,{width:16,height:12,x:1,y:3,stroke:`currentColor`,strokeWidth:2,rx:3}),k(`rect`,{width:3,height:2,x:3,y:8,fill:`currentColor`,rx:1}),k(`rect`,{width:2,height:2,x:13,y:8,fill:`currentColor`,rx:1}),k(`rect`,{width:4,height:2,x:11,y:11,fill:`currentColor`,rx:1}),k(`rect`,{width:5,height:2,x:7,y:8,fill:`currentColor`,rx:1}),k(`rect`,{width:7,height:2,x:3,y:11,fill:`currentColor`,rx:1})]})),Gc=X(({className:e})=>k(Z,{className:e,children:N(`g`,{fill:`currentColor`,children:[k(`rect`,{width:2,height:5,x:8,y:.5,opacity:.5,rx:1,children:k(`animate`,{attributeName:`opacity`,begin:`0s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),k(`rect`,{width:2,height:5,x:12.243,y:2.257,opacity:.45,rx:1,transform:`rotate(45 13.243 4.757)`,children:k(`animate`,{attributeName:`opacity`,begin:`0.125s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),k(`rect`,{width:5,height:2,x:12.5,y:8,opacity:.4,rx:1,children:k(`animate`,{attributeName:`opacity`,begin:`0.25s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),k(`rect`,{width:5,height:2,x:10.743,y:12.243,opacity:.35,rx:1,transform:`rotate(45 13.243 13.243)`,children:k(`animate`,{attributeName:`opacity`,begin:`0.375s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),k(`rect`,{width:2,height:5,x:8,y:12.5,opacity:.3,rx:1,children:k(`animate`,{attributeName:`opacity`,begin:`0.5s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),k(`rect`,{width:2,height:5,x:3.757,y:10.743,opacity:.25,rx:1,transform:`rotate(45 4.757 13.243)`,children:k(`animate`,{attributeName:`opacity`,begin:`0.625s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),k(`rect`,{width:5,height:2,x:.5,y:8,opacity:.15,rx:1,children:k(`animate`,{attributeName:`opacity`,begin:`0.75s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),k(`rect`,{width:5,height:2,x:2.257,y:3.757,opacity:.1,rx:1,transform:`rotate(45 4.757 4.757)`,children:k(`animate`,{attributeName:`opacity`,begin:`0.875s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})})]})})),Kc=X(({className:e})=>k(Z,{className:e,children:k(`path`,{fill:`currentColor`,d:`M9 2a1 1 0 0 1 1 1v12a1 1 0 1 1-2 0V3a1 1 0 0 1 1-1zm4 3a1 1 0 0 1 1 1v6a1 1 0 1 1-2 0V6a1 1 0 0 1 1-1zM5 5a1 1 0 0 1 1 1v6a1 1 0 1 1-2 0V6a1 1 0 0 1 1-1zm8 4a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0v-1a1 1 0 0 1 1-1zM5 9a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0v-1a1 1 0 0 1 1-1z`})})),qc=X(({className:e})=>k(Z,{className:e,children:k(`path`,{fill:`currentColor`,d:`M3 5a1 1 0 0 1 1-1h10a1 1 0 1 1 0 2H4a1 1 0 0 1-1-1zm0 4a1 1 0 0 1 1-1h10a1 1 0 1 1 0 2H4a1 1 0 0 1-1-1zm1 3a1 1 0 1 0 0 2h6a1 1 0 1 0 0-2H4z`})})),Jc=X(({className:e})=>k(Z,{className:e,children:k(`path`,{fill:`currentColor`,d:`M14.53 4.53a.75.75 0 0 0-1.06-1.06L7 9.94 4.53 7.47a.75.75 0 0 0-1.06 1.06l3 3a.75.75 0 0 0 1.06 0l7-7z`})}));P();var Yc=10,Q=e=>e,Xc=Q(qa.Root),Zc=Q(Ba),Qc=Q(to.Root),$c=Q(za.Popup),el=Q(za.Title),tl=Q(za.Close),nl=Q(to.Description),rl=Q(ns.Provider),il=Q(ns.Root),al=Q(ns.Trigger),ol=Q(ns.Popup),sl=Q(Co.Root),cl=Q(Co.Trigger),ll=Q(Co.Popup),ul=Q(po),dl=Q(wo),fl=Q(uo),pl=Q(fo),ml=Q(no),hl=Q(mo),gl=Q(Vo.Value),_l=Q(Wo.Root),vl=Q(Lo.Track),yl=Q(Lo.Fill),bl=Q(Lo.Buffer),xl=Q(Lo.Thumb),Sl=Q(Lo.Value),Cl=Q(as.Root),$=Q(co),wl=Q(io),Tl=Q(Re),El=({className:e,...t})=>k(`button`,{type:`button`,className:`media-button media-button--subtle media-button--icon${e?` ${e}`:``}`,...t}),Dl=({selection:e,icon:t})=>{let[n,r]=A(!1),[i,a]=A(!1),[o,s]=A(!1);T(()=>s(!1),[e.selectedId]);let c=[...e.offLabel?[{id:null,label:e.offLabel}]:[],...e.options],l=t=>{if(t===e.selectedId){r(!1);return}s(!1),a(!0),Promise.resolve().then(()=>e.onSelect(t)).then(()=>r(!1)).catch(t=>{console.warn(`[player] ${e.label} selection failed:`,t),s(!0)}).finally(()=>a(!1))};return N(sl,{open:n,onOpenChange:e=>r(e),children:[k(cl,{render:k(El,{className:`media-button--menu${o?` media-button--error`:``}`,"aria-label":e.label}),children:t}),k(ll,{className:`media-surface media-popover media-popover--menu`,children:N(`div`,{className:`stub-menu`,role:`menu`,"aria-label":e.label,children:[k(`div`,{className:`stub-menu__heading`,children:e.label}),c.map(t=>{let n=t.id===e.selectedId;return N(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":n,className:`stub-menu__item${n?` stub-menu__item--active`:``}`,disabled:i||`disabled`in t&&t.disabled,onClick:()=>l(t.id),children:[k(`span`,{className:`stub-menu__check`,children:n?k(Jc,{className:`media-icon`}):null}),k(`span`,{className:`stub-menu__label`,children:t.label}),`description`in t&&t.description?k(`span`,{className:`stub-menu__description`,children:t.description}):null]},t.id??`__off__`)})]})})]})},Ol=()=>N(sl,{openOnHover:!0,delay:200,closeDelay:100,side:`top`,children:[k(cl,{render:N(fl,{className:`media-button--mute`,render:k(El,{}),children:[k(Ic,{className:`media-icon media-icon--volume-off`}),k(Lc,{className:`media-icon media-icon--volume-low`}),k(Rc,{className:`media-icon media-icon--volume-high`})]})}),k(ll,{className:`media-surface media-popover media-popover--volume`,children:N(Cl,{className:`media-slider`,orientation:`vertical`,thumbAlignment:`edge`,children:[k(vl,{className:`media-slider__track`,children:k(yl,{className:`media-slider__fill`})}),k(xl,{className:`media-slider__thumb media-slider__thumb--persistent`})]})})]}),kl=({capabilities:e,children:t,className:n,...r})=>N(Tl,{className:`media-default-skin media-default-skin--video${n?` ${n}`:``}`,...r,children:[t,k(Zc,{render:e=>k(`div`,{...e,className:`media-buffering-indicator`,children:k(`div`,{className:`media-surface`,children:k(Gc,{className:`media-icon`})})})}),k(Qc,{children:k($c,{className:`media-error`,children:N(`div`,{className:`media-error__dialog media-surface`,children:[N(`div`,{className:`media-error__content`,children:[k(el,{className:`media-error__title`,children:`Something went wrong.`}),k(nl,{className:`media-error__description`})]}),k(`div`,{className:`media-error__actions`,children:k(tl,{className:`media-button media-button--primary`,children:`OK`})})]})})}),k(Xc,{className:`media-surface media-controls`,children:N(rl,{children:[N(`div`,{className:`media-button-group`,children:[N(il,{side:`top`,children:[k(al,{render:N(ul,{className:`media-button--play`,render:k(El,{}),children:[k(Pc,{className:`media-icon media-icon--restart`}),k(Mc,{className:`media-icon media-icon--play`}),k(Nc,{className:`media-icon media-icon--pause`})]})}),k(ol,{className:`media-surface media-tooltip`})]}),N(il,{side:`top`,children:[k(al,{render:k(dl,{seconds:-10,className:`media-button--seek`,render:k(El,{}),children:N(`span`,{className:`media-icon__container`,children:[k(Fc,{className:`media-icon media-icon--seek media-icon--flipped`}),k(`span`,{className:`media-icon__label`,children:Yc})]})})}),N(ol,{className:`media-surface media-tooltip`,children:[`Seek backward `,Yc,` seconds`]})]}),N(il,{side:`top`,children:[k(al,{render:k(dl,{seconds:Yc,className:`media-button--seek`,render:k(El,{}),children:N(`span`,{className:`media-icon__container`,children:[k(Fc,{className:`media-icon media-icon--seek`}),k(`span`,{className:`media-icon__label`,children:Yc})]})})}),N(ol,{className:`media-surface media-tooltip`,children:[`Seek forward `,Yc,` seconds`]})]})]}),N(`div`,{className:`media-time-controls`,children:[k(gl,{type:`current`,className:`media-time`}),N(_l,{className:`media-slider`,children:[N(vl,{className:`media-slider__track`,children:[k(yl,{className:`media-slider__fill`}),k(bl,{className:`media-slider__buffer`})]}),k(xl,{className:`media-slider__thumb`}),k(`div`,{className:`media-surface media-thumbnail media-slider__preview`,children:k(Sl,{type:`pointer`,className:`media-time media-thumbnail__time`})})]}),k(gl,{type:`duration`,className:`media-time`})]}),N(`div`,{className:`media-button-group`,children:[N(il,{side:`top`,children:[k(al,{render:k(hl,{className:`media-button--playback-rate`,render:k(El,{})})}),k(ol,{className:`media-surface media-tooltip`,children:`Toggle playback rate`})]}),k(Ol,{}),e?.subtitles&&k(Dl,{selection:e.subtitles,icon:e.subtitles.selectedId?k(Uc,{className:`media-icon`}):k(Wc,{className:`media-icon`})},`subtitles`),e?.audioTracks&&k(Dl,{selection:e.audioTracks,icon:k(Kc,{className:`media-icon`})},`audio`),e?.qualityLevels&&k(Dl,{selection:e.qualityLevels,icon:k(qc,{className:`media-icon`})},`quality`),N(il,{side:`top`,children:[k(al,{render:N(pl,{className:`media-button--pip`,render:k(El,{}),children:[k(Vc,{className:`media-icon media-icon--pip-enter`}),k(Hc,{className:`media-icon media-icon--pip-exit`})]})}),k(ol,{className:`media-surface media-tooltip`})]}),N(il,{side:`top`,children:[k(al,{render:N(ml,{className:`media-button--fullscreen`,render:k(El,{}),children:[k(zc,{className:`media-icon media-icon--fullscreen-enter`}),k(Bc,{className:`media-icon media-icon--fullscreen-exit`})]})}),k(ol,{className:`media-surface media-tooltip`})]})]})]})}),k(`div`,{className:`media-overlay`}),k($,{keys:`Space`,action:`togglePaused`}),k($,{keys:`k`,action:`togglePaused`}),k($,{keys:`m`,action:`toggleMuted`}),k($,{keys:`f`,action:`toggleFullscreen`}),k($,{keys:`i`,action:`togglePictureInPicture`}),k($,{keys:`ArrowRight`,action:`seekStep`,value:5}),k($,{keys:`ArrowLeft`,action:`seekStep`,value:-5}),k($,{keys:`l`,action:`seekStep`,value:10}),k($,{keys:`j`,action:`seekStep`,value:-10}),k($,{keys:`ArrowUp`,action:`volumeStep`,value:.05}),k($,{keys:`ArrowDown`,action:`volumeStep`,value:-.05}),k($,{keys:`0-9`,action:`seekToPercent`}),k($,{keys:`Home`,action:`seekToPercent`,value:0}),k($,{keys:`End`,action:`seekToPercent`,value:100}),k(wl,{type:`tap`,action:`togglePaused`,pointer:`mouse`,region:`center`}),k(wl,{type:`tap`,action:`toggleControls`,pointer:`touch`}),k(wl,{type:`doubletap`,action:`seekStep`,value:-10,region:`left`}),k(wl,{type:`doubletap`,action:`toggleFullscreen`,region:`center`}),k(wl,{type:`doubletap`,action:`seekStep`,value:10,region:`right`})]});P();var{Provider:Al}=Ye({features:Xe}),jl=e=>`media`in e?e:{media:e},Ml=({remote:e,frame:t,adapter:n})=>{let r=Ge();return T(()=>{if(!r||!e||!t)return;let i=M(e),a=n?n(i.media,t):i.media;if(!a)return;let o=jl(a),s=i.hold();r(o.media);let c=ct(i.served(o.media));return()=>{c(),s(),r(null),o.dispose?.()}},[e,t,n,r]),null},Nl=d`
|
|
221
|
+
position: absolute;
|
|
222
|
+
inset: 0;
|
|
223
|
+
border-radius: 0.8rem;
|
|
224
|
+
background: transparent !important;
|
|
225
|
+
&.media-default-skin--video {
|
|
226
|
+
background: transparent !important;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.media-popover--menu {
|
|
230
|
+
padding: 0.4rem;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* The track menu is stub's own markup, so it carries a stub prefix rather than a media one.
|
|
235
|
+
*
|
|
236
|
+
* It was named \`media-menu\` when the skin had no menu of its own. videojs beta.26 added one, and
|
|
237
|
+
* upstream's nested \`.media-default-skin .media-menu .media-menu__item\` is specificity (0,3,0)
|
|
238
|
+
* against this file's (0,2,0), so it silently took over padding, gap, cursor and justification the
|
|
239
|
+
* moment the dependency moved. A prefix upstream will never mint is the only durable fix; matching
|
|
240
|
+
* their specificity would just move the race to insertion order.
|
|
241
|
+
*/
|
|
242
|
+
.stub-menu {
|
|
243
|
+
display: flex;
|
|
244
|
+
flex-direction: column;
|
|
245
|
+
min-width: 18rem;
|
|
246
|
+
max-height: 32rem;
|
|
247
|
+
overflow-y: auto;
|
|
248
|
+
}
|
|
249
|
+
.stub-menu__heading {
|
|
250
|
+
padding: 0.6rem 1rem 0.4rem;
|
|
251
|
+
font-size: 1.1rem;
|
|
252
|
+
font-weight: 600;
|
|
253
|
+
letter-spacing: 0.04em;
|
|
254
|
+
text-transform: uppercase;
|
|
255
|
+
opacity: 0.6;
|
|
256
|
+
}
|
|
257
|
+
.stub-menu__item {
|
|
258
|
+
display: flex;
|
|
259
|
+
align-items: center;
|
|
260
|
+
gap: 0.6rem;
|
|
261
|
+
width: 100%;
|
|
262
|
+
padding: 0.6rem 1rem;
|
|
263
|
+
border: none;
|
|
264
|
+
border-radius: 0.4rem;
|
|
265
|
+
background: transparent;
|
|
266
|
+
color: inherit;
|
|
267
|
+
font-size: 1.3rem;
|
|
268
|
+
text-align: left;
|
|
269
|
+
cursor: pointer;
|
|
270
|
+
|
|
271
|
+
&:hover:not(:disabled) {
|
|
272
|
+
background: rgba(255, 255, 255, 0.12);
|
|
273
|
+
}
|
|
274
|
+
&:disabled {
|
|
275
|
+
opacity: 0.5;
|
|
276
|
+
cursor: default;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
.stub-menu__check {
|
|
280
|
+
display: inline-flex;
|
|
281
|
+
width: 1.6rem;
|
|
282
|
+
flex: none;
|
|
283
|
+
}
|
|
284
|
+
.stub-menu__label {
|
|
285
|
+
flex: 1;
|
|
286
|
+
}
|
|
287
|
+
.stub-menu__description {
|
|
288
|
+
opacity: 0.6;
|
|
289
|
+
font-size: 1.1rem;
|
|
290
|
+
}
|
|
291
|
+
.media-button--error {
|
|
292
|
+
color: #f66;
|
|
293
|
+
}
|
|
294
|
+
`,Pl=({remote:e,frame:t,adapter:n,capabilities:r,children:i})=>N(Al,{children:[k(Ml,{remote:e,frame:t,adapter:n}),k(kl,{capabilities:r,css:Nl,children:i})]}),Fl=`[data-uia="timeline"]`,Il=`[data-uia="video-canvas"]`,Ll=`[data-uia="player"]`,Rl=`Seeks the video to the point you pick on the timeline.`,zl=`Reveals the player controls so the timeline can be used.`,Bl=140,Vl=2,Hl=12e3,Ul=26,Wl=110,Gl={"still-watching":`[data-uia="interrupt-autoplay-continue"], [data-uia="interrupter-title"]`,"next-episode":`[data-uia="next-episode-seamless-button"], [data-uia="next-episode-seamless-button-draining"]`,error:`[data-uia="error-container"], [data-uia="nfp-error"]`},Kl=e=>new Promise(t=>setTimeout(t,e)),ql=e=>e<0?0:e>1?1:e,Jl=0,Yl=()=>{let e=Jl*1.1;return Jl++,{x:.5+Math.cos(e)*.05,y:.5+Math.sin(e)*.05}},Xl=(e,t)=>{let n=null,r,i,a=!1,o=async()=>{if(!a){a=!0;try{await Promise.all([t.locator(Il).ensure(`hover`,{reason:zl}),t.locator(Ll).ensure(`hover`,{reason:zl}),t.locator(Fl).ensure(`click`,{reason:Rl})])}catch(e){a=!1,console.warn(`[nf] permission request failed:`,e)}}},s=()=>{if(n==null)return;let t=e.currentTime;Number.isFinite(t)&&Math.abs(t-n)<Vl&&(n=null,i&&clearTimeout(i))};e.addEventListener(`timeupdate`,s);let c=async n=>{let r=e.duration;if(!Number.isFinite(r)||r<=0){console.warn(`[nf] seek: duration unknown`,r);return}let i=ql(n/r);o();let a=t.locator(Fl),s=e.paused===!0;if(s)try{await e.play()}catch{}let c=!1;for(let e=0;e<Ul;e++){if(e%2==0&&(await t.locator(Il).hover({relativePosition:Yl(),reason:zl}).catch(()=>{}),await t.locator(Ll).hover({relativePosition:Yl(),reason:zl}).catch(()=>{})),await a.exists().catch(()=>!1)){c=!0;break}await Kl(Wl)}if(!c){let n=await Promise.all(Object.entries(Gl).map(async([e,n])=>await t.locator(n).exists().catch(()=>!1)?e:``)).then(e=>e.filter(Boolean).join(`, `)).catch(()=>``);if(console.warn(`[nf] seek aborted: controls never revealed${n?` (blocked by ${n})`:``}`),s)try{await e.pause()}catch{}return}if(await a.click({relativePosition:{x:i,y:.5},reason:Rl}).catch(e=>console.warn(`[nf] timeline click failed:`,e?.message??e)),s)try{await e.pause()}catch{}};return{media:new Proxy(e,{get(e,t,r){return t===`currentTime`&&n!=null?n:Reflect.get(e,t,r)},set(e,t,a,o){return t===`currentTime`&&typeof a==`number`&&Number.isFinite(a)?(n=a,r&&clearTimeout(r),r=setTimeout(()=>{c(a).catch(e=>console.warn(`[nf] timeline seek failed:`,e))},Bl),i&&clearTimeout(i),i=setTimeout(()=>{n=null},Hl),!0):Reflect.set(e,t,a,o)}}),dispose:()=>{e.removeEventListener(`timeupdate`,s),r&&clearTimeout(r),i&&clearTimeout(i)}}},Zl=({remote:e,frame:t,capabilities:n,children:r})=>k(Pl,{remote:e,frame:t,adapter:Xl,capabilities:n,children:r});P();var Ql=[`netflix.com`,`www.netflix.com`,`nflxvideo.net`,`nflxso.net`,`nflxext.com`,`nflximg.net`,`assets.nflxext.com`],$l=`https://www.netflix.com/login`,eu=`
|
|
295
|
+
html, body {
|
|
296
|
+
margin: 0 !important;
|
|
297
|
+
padding: 0 !important;
|
|
298
|
+
width: 100% !important;
|
|
299
|
+
height: 100% !important;
|
|
300
|
+
overflow: hidden !important;
|
|
301
|
+
background: #000 !important;
|
|
302
|
+
}
|
|
303
|
+
/* Truly-unwanted chrome - collapse it entirely. */
|
|
304
|
+
.watch-video--evidence-overlay-container,
|
|
305
|
+
.watch-video--skip-content,
|
|
306
|
+
.watch-video--nextEpisode-seamless-button,
|
|
307
|
+
.watch-video--back-container,
|
|
308
|
+
[data-uia="player-back-to-browse"],
|
|
309
|
+
[data-uia="control-nav-back"],
|
|
310
|
+
[data-uia="control-flag"] {
|
|
311
|
+
display: none !important;
|
|
312
|
+
pointer-events: none !important;
|
|
313
|
+
}
|
|
314
|
+
/* Keep the controls bar in LAYOUT (so the seek adapter can locate + click the
|
|
315
|
+
[data-uia="timeline"] scrubber) but invisible and inert to real taps. NEVER
|
|
316
|
+
display:none here, or the scrubber loses its box and the seek no-ops - mirrors
|
|
317
|
+
Crunchyroll's opacity:0 timeline trick. The skin draws the visible controls. */
|
|
318
|
+
[data-uia="controls-standard"],
|
|
319
|
+
.watch-video--bottom-controls-container,
|
|
320
|
+
.PlayerControlsNeo__layout,
|
|
321
|
+
.PlayerControlsNeo__core-controls,
|
|
322
|
+
.PlayerControlsNeo__button-control-row {
|
|
323
|
+
opacity: 0 !important;
|
|
324
|
+
pointer-events: none !important;
|
|
325
|
+
}
|
|
326
|
+
[data-uia="timeline"],
|
|
327
|
+
[data-uia="timeline"] * {
|
|
328
|
+
pointer-events: auto !important;
|
|
329
|
+
}
|
|
330
|
+
.watch-video,
|
|
331
|
+
[data-uia="video-canvas"] {
|
|
332
|
+
position: fixed !important;
|
|
333
|
+
inset: 0 !important;
|
|
334
|
+
width: 100% !important;
|
|
335
|
+
height: 100% !important;
|
|
336
|
+
z-index: 9999999 !important;
|
|
337
|
+
}
|
|
338
|
+
.watch-video video,
|
|
339
|
+
[data-uia="video-canvas"] video {
|
|
340
|
+
width: 100% !important;
|
|
341
|
+
height: 100% !important;
|
|
342
|
+
object-fit: contain !important;
|
|
343
|
+
}
|
|
344
|
+
`,tu=async(e,t=10,n=500)=>{for(let r=0;r<t;r++)try{return await e()}catch(e){if(r===t-1||!(e instanceof Error)||!e.message.includes(`not registered`))throw e;await new Promise(e=>setTimeout(e,n))}throw Error(`unreachable`)},nu=async e=>{for(let t=0;t<50;t++){if(await e.locator(`[data-uia="header"] a[href*="/login"]`).exists())return!1;if(await e.locator(`.watch-video, [data-uia="video-canvas"]`).exists())return!0;await new Promise(e=>setTimeout(e,200))}return!1},ru=async(e,t)=>{for(;!t();){try{if(await e.locator(`video`).exists())return await e.locator(`video`).videoElement()}catch(e){if(e?.name===`LocatorUnsupportedError`)throw e}await new Promise(e=>setTimeout(e,200))}return null},iu=d`
|
|
345
|
+
position: relative;
|
|
346
|
+
width: 100%;
|
|
347
|
+
height: 100%;
|
|
348
|
+
background: #000;
|
|
349
|
+
user-select: none;
|
|
350
|
+
-webkit-user-select: none;
|
|
351
|
+
|
|
352
|
+
.nf-frame {
|
|
353
|
+
position: absolute;
|
|
354
|
+
inset: 0;
|
|
355
|
+
width: 100%;
|
|
356
|
+
height: 100%;
|
|
357
|
+
border: none;
|
|
358
|
+
background: #000;
|
|
359
|
+
/* Netflix's own chrome is hidden, so the iframe must not swallow taps -
|
|
360
|
+
they belong to the skin's gesture layer stacked above it. */
|
|
361
|
+
pointer-events: none;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.overlay {
|
|
365
|
+
position: absolute;
|
|
366
|
+
inset: 0;
|
|
367
|
+
display: flex;
|
|
368
|
+
flex-direction: column;
|
|
369
|
+
align-items: center;
|
|
370
|
+
justify-content: center;
|
|
371
|
+
gap: 1.6rem;
|
|
372
|
+
background: #000;
|
|
373
|
+
font-size: 1.4rem;
|
|
374
|
+
color: rgba(255, 255, 255, 0.8);
|
|
375
|
+
z-index: 30;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.login-button {
|
|
379
|
+
padding: 0.8rem 2rem;
|
|
380
|
+
background: #e50914;
|
|
381
|
+
color: #fff;
|
|
382
|
+
border: none;
|
|
383
|
+
border-radius: 0.4rem;
|
|
384
|
+
font-size: 1.4rem;
|
|
385
|
+
font-weight: 600;
|
|
386
|
+
cursor: pointer;
|
|
387
|
+
|
|
388
|
+
&:hover {
|
|
389
|
+
background: #c11119;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
`,au={cr:jc,nf:({url:e})=>{let[t,n]=A(null),[r,i]=A(null),[a,o]=A(!0),[s,c]=A(!1),[l,u]=A(),[d,f]=A(null),[p,m]=A(0);T(()=>{if(!t)return;let e=!1;return(async()=>{for(let n=0;!e;n++)try{let n=await ae({iframe:t,domains:Ql,cookies:`native`});if(e)return;i(n);return}catch(t){if(e)return;if(!L()){u(`Netflix playback currently needs the FKN browser extension.`),o(!1);return}if(n>=4){console.error(`Failed to attach Netflix frame`,t),u(t instanceof Error?t.message:`Failed to load player`),o(!1);return}await new Promise(e=>setTimeout(e,300*(n+1)))}})(),()=>{e=!0}},[t]),T(()=>{if(!r)return;let t=!1,n=()=>t;return o(!0),u(void 0),c(!1),f(null),(async()=>{if(await r.goto(e,{waitUntil:`load`}),await tu(()=>r.addStyleTag({content:eu})),t)return;o(!1);let i=await nu(r);if(t)return;if(!i){c(!0);return}let a=await ru(r,n);!t&&a&&f(a)})().catch(e=>{t||(console.error(`Failed to load Netflix player`,e),u(e?.message??`Failed to load player`),o(!1))}),()=>{t=!0}},[r,e,p]);let h=y(()=>{let e=globalThis.open($l,`_blank`,`width=500,height=700`);if(!e)return;let t=setInterval(()=>{e.closed&&(clearInterval(t),m(e=>e+1))},500)},[]);return N(`div`,{css:iu,children:[k(Zl,{remote:d,frame:r,children:k(`iframe`,{ref:n,className:`nf-frame`,referrerPolicy:`no-referrer`,allow:`encrypted-media; autoplay; fullscreen;`})}),(s||l||a)&&N(`div`,{className:`overlay`,children:[s&&N(v,{children:[`Sign in to Netflix to watch.`,k(`button`,{className:`login-button`,onClick:h,children:`Open Netflix Login Page`})]}),l&&!s&&l,a&&!l&&!s&&`Loading Netflix player...`]})]})},amazon:ys},ou=e=>au[e];P();var su=new URLSearchParams(globalThis.location.search),cu=su.get(`mediaUri`),lu=su.get(`episodeUri`),uu=su.get(`sourceUri`),du=su.get(`url`),fu=s(su),pu=uu?e(uu).origin:void 0,mu=pu?ou(pu):void 0,hu=pu===`cr`&&du&&!L()?St(du,fu):void 0;x(k(()=>{let[e,t]=A();return T(()=>c(t),[]),!cu||!lu||!uu||!du||!mu?k(`div`,{children:`Unsupported or missing parameters`}):k(mu,{url:du,mediaUri:cu,episodeUri:lu,sourceUri:uu,title:e,triedRelays:fu,unlistedRelays:hu})},{}),document.getElementById(`app`));
|