@banou/stub 0.0.57 → 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.
Files changed (36) hide show
  1. package/build/assets/anime-seasons-BYvYwRwn.js +1 -0
  2. package/build/assets/dist-xpUFCIHk.js +1328 -0
  3. package/build/assets/{embed-CvUavYUV.js → embed-BxT8fPdZ.js} +2 -2
  4. package/build/assets/embed-title-CosoIrXe.js +1 -0
  5. package/build/assets/{index-QkhLG9eC.js → index-DOZodZks.js} +173 -173
  6. package/build/assets/{jassub-worker-CLcXAXXL.wasm → jassub-worker-CkfUMbe_.wasm} +0 -0
  7. package/build/assets/jassub-worker-ezqkHxaC.js +1 -0
  8. package/build/assets/{lib-jassub-worker-modern-C7bYVPj4.wasm → jassub-worker-modern-Bwy5Vua-.wasm} +0 -0
  9. package/build/assets/{lib-jassub-worker-CLcXAXXL.wasm → lib-jassub-worker-CkfUMbe_.wasm} +0 -0
  10. package/build/assets/{jassub-worker-modern-C7bYVPj4.wasm → lib-jassub-worker-modern-Bwy5Vua-.wasm} +0 -0
  11. package/build/assets/{lib-theme-player-4uF0yCCA.js → lib-theme-player-DpmBH0Uz.js} +1058 -922
  12. package/build/assets/{lib-worker-CxxbWsMo.js → lib-worker-BXCkN-9Q.js} +1 -1
  13. package/build/assets/{lib-worker-CWhdV26-.js → lib-worker-CwmB42Tz.js} +1 -1
  14. package/build/assets/lib-worker-anime-seasons-BYvYwRwn.js +1 -0
  15. package/build/assets/lib-worker-index-DGh_UlvN.js +2654 -0
  16. package/build/assets/lib-worker-jassub-worker-C5QJW1O3.js +1 -0
  17. package/build/assets/lib-worker-worker-BjIUO7P3.js +146 -0
  18. package/build/assets/{main-Dn8WJvvc.js → main-BLeaopKB.js} +154 -130
  19. package/build/assets/{theme-player-CyPxG_F7.js → theme-player-BfHkKsCa.js} +1 -1
  20. package/build/assets/{worker-D1Q7LumD.js → worker-4O2hafPi.js} +1 -1
  21. package/build/assets/worker-DJ-UoKG9.js +146 -0
  22. package/build/assets/{worker-8lj-R-8y.js → worker-s1DarU5c.js} +1 -1
  23. package/build/embed.html +3 -3
  24. package/build/index.html +3 -3
  25. package/build/index.js +5886 -5616
  26. package/fkn.json +1 -1
  27. package/package.json +2 -2
  28. package/build/assets/anime-seasons-B76P0Y3X.js +0 -1
  29. package/build/assets/dist-k1lV5fLd.js +0 -1328
  30. package/build/assets/embed-title-B8J34NSF.js +0 -1
  31. package/build/assets/jassub-worker-CmZGEPuv.js +0 -1
  32. package/build/assets/lib-worker-anime-seasons-B76P0Y3X.js +0 -1
  33. package/build/assets/lib-worker-index-DkGAwfbK.js +0 -2654
  34. package/build/assets/lib-worker-jassub-worker-5YNtWxS6.js +0 -1
  35. package/build/assets/lib-worker-worker-BNxa-Gim.js +0 -150
  36. package/build/assets/worker-dPoC1jvm.js +0 -150
@@ -1,4 +1,4 @@
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-B8J34NSF.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-k1lV5fLd.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=`
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
2
  html, body {
3
3
  margin: 0 !important;
4
4
  padding: 0 !important;
@@ -217,7 +217,7 @@ 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}f
217
217
  border-top-color: #fff;
218
218
  animation: ${kc} 0.8s linear infinite;
219
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($,{keys:`>`,action:`speedUp`}),k($,{keys:`<`,action:`speedDown`}),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`
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
221
  position: absolute;
222
222
  inset: 0;
223
223
  border-radius: 0.8rem;
@@ -0,0 +1 @@
1
+ import{a as e}from"./country-Cg7CfAmX.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var t=e=>{let[t,n]=e.split(`:`);return{origin:t,id:n}},n=(e,n)=>{let r=e.split(`,`).filter(Boolean).map(e=>t(e));return n?r.find(({origin:e})=>e===n):r},r=({origin:e,id:t})=>`${e}:${t}`,i=e=>e.join(`,`),a=e=>{let t=e.split(`:`).filter(e=>e.length);if(t[1]?.includes(`,`))throw Error(`Invalid uri: ${e}, contains "," character in id`);return t.length===2},o=/[,/()]/,s=e=>{let t=e.indexOf(`:`);return t>0&&!o.test(e.slice(t+1))},c=e=>e.split(`,`).every(a),l=/ag:\((.*)\)(?:-(.*))?/,u=e=>{if(!e?.startsWith(`ag:`))return!1;let t=e.match(l);if(!t)return!1;let n=t?.[1];return!n||c(n)},d=e=>u(e)||!s(e)||!a(e)?e:h([e]),f=(e,t,n)=>{if(!e||!t||e===t||!u(e)||!u(t)||!y(e,t))return!1;if(t===n)return!0;let r=_(e)?.handleUris??[],i=_(t)?.handleUris??[];return r.length>i.length},p=e=>{if(!e||a(e)||u(e))return e;try{let t=decodeURIComponent(e);return a(t)||u(t)?t:e}catch{return e}},m=e=>{let t=p(e);return t&&d(t)},h=(e,t)=>`ag:(${g(e)})${t?`-${t}`:``}`,g=(e,t=!0)=>t?g(n(Array.isArray(e)?e.join(`,`):e).filter(e=>e.origin&&e.id).sort((e,t)=>e.id.localeCompare(t.id)).sort((e,t)=>e.origin.localeCompare(t.origin)).map(r),!1):encodeURI(Array.isArray(e)?e.join(`,`):e),_=e=>{if(typeof e!=`string`)return;let t=e.match(l);if(!t)return;let a=n(t[1]).filter(e=>e.origin&&e.id).sort((e,t)=>e.id.localeCompare(t.id)).sort((e,t)=>e.origin.localeCompare(t.origin));return t&&{uri:`ag:(${i(a.map(r))})`,origin:`ag`,id:`(${i(a.map(r))})`,handleUris:a.map(r),handleUrisString:i(a.map(r)),handleUrisValues:a,episodeId:t[2]}},v=e=>u(e)?[...new Set(_(e)?.handleUrisValues.map(e=>e.origin)??[])]:a(e)?[t(e).origin]:[],y=(e,t)=>{let n=_(e),r=_(t);return!n||!r?!1:n.handleUris.some(e=>r.handleUris.some(t=>e===t))},b=`stub:embed-tracks`,x=`stub:embed-tracks?`,S=`stub:embed-track-pick`,C=[`subtitles`,`audio`],w=(e,t,n=window)=>{let r=()=>n.parent.postMessage({type:b,tracks:e},n.location.origin),i=e=>{if(e.source!==n.parent||e.origin!==n.location.origin)return;let{type:i,kind:a,id:o}=e.data??{};i===x&&r(),i===S&&t(a,o)};return n.addEventListener(`message`,i),n.parent!==n&&r(),()=>n.removeEventListener(`message`,i)},T=(e,t=window)=>{let n=new Set,r,i=i=>{if(i.source!==e.contentWindow||i.origin!==t.location.origin)return;let{type:a,tracks:o}=i.data??{};if(a===b){r=o;for(let e of n)e(o)}},a=()=>e.contentWindow?.postMessage({type:x},t.location.origin);return t.addEventListener(`message`,i),e.addEventListener(`load`,a),{onTracks:e=>(n.add(e),r&&e(r),()=>{n.delete(e)}),select:(n,r)=>e.contentWindow?.postMessage({type:S,kind:n,id:r},t.location.origin),dispose:()=>{t.removeEventListener(`message`,i),e.removeEventListener(`load`,a)}}},E=[`amazon.co.jp`,`www.amazon.co.jp`,`amazon.com`,`www.amazon.com`,`amazon.co.uk`,`www.amazon.co.uk`,`amazon.de`,`www.amazon.de`,`primevideo.com`,`www.primevideo.com`,`app.primevideo.com`,`media-amazon.com`,`ssl-images-amazon.com`,`aiv-cdn.net`,`pv-cdn.net`,`aiv-delivery.net`,`a2z.com`,`prime-video.amazon.dev`],D={US:`amazon.com`,PR:`amazon.com`,GU:`amazon.com`,VI:`amazon.com`,AS:`amazon.com`,MP:`amazon.com`,UM:`amazon.com`,GB:`amazon.co.uk`,DE:`amazon.de`,AT:`amazon.de`,JP:`amazon.co.jp`},O=e=>D[e]??`primevideo.com`,k=e=>URL.parse(e)?.hostname.replace(/^(www|watch|app)\./,``),A=t=>k(t)===O(e()),j=e=>e===`amazon.co.jp`,M=`https://www.amazon.co.jp/ap/signin?${new URLSearchParams({"openid.return_to":`https://www.amazon.co.jp/gp/video/storefront`,"openid.identity":`http://specs.openid.net/auth/2.0/identifier_select`,"openid.assoc_handle":`jpflex`,"openid.mode":`checkid_setup`,"openid.claimed_id":`http://specs.openid.net/auth/2.0/identifier_select`,"openid.ns":`http://specs.openid.net/auth/2.0`})}`,N=e=>e===`amazon.co.jp`?M:e===`primevideo.com`?`https://www.primevideo.com/auth-redirect?signin=1&returnUrl=%2Fstorefront`:`https://www.${e}/gp/video/auth-redirect?signin=1&returnUrl=%2Fgp%2Fvideo%2Fstorefront`,P=`a[data-csa-c-content-id="nav_ya_signin"], [data-testid="pv-nav-sign-in"]`,F=async e=>await e.locator(`#nav-link-accountList, #pv-footer`).exists()&&!await e.locator(`a[data-csa-c-content-id="nav_ya_signin"], [data-testid="pv-nav-sign-in"]`).exists(),I=`stub:embed-relay-tried`,L=`triedRelays`,R=new Map,z=e=>e.split(`-`)[0],B=e=>{let t=R.get(z(e));return t?.length?{[L]:t.join(`,`)}:{}},V=e=>e.get(L)?.split(`,`).filter(Boolean)??[],H=(e,t,n=window)=>{let r=r=>{if(r.source!==e.contentWindow||r.origin!==n.location.origin)return;let{type:i,relay:a}=r.data??{};if(i!==I||typeof a!=`string`)return;let o=z(t),s=R.get(o)??[];s.includes(a)||R.set(o,[...s,a])};return n.addEventListener(`message`,r),()=>n.removeEventListener(`message`,r)},U=(e,t=window)=>{t.parent!==t&&t.parent.postMessage({type:I,relay:e},t.location.origin)},W=`stub:embed-unplayable`,G=(e,t,n=window)=>{let r=r=>{r.source===e.contentWindow&&r.origin===n.location.origin&&r.data?.type===W&&t()};return n.addEventListener(`message`,r),()=>n.removeEventListener(`message`,r)},K=(e=window)=>{e.parent!==e&&e.parent.postMessage({type:W},e.location.origin)},q=`stub:embed-title`,J=`stub:embed-title?`,Y=(e,t,n=window)=>{let r=()=>e.contentWindow?.postMessage({type:q,title:t},n.location.origin),i=t=>{t.source===e.contentWindow&&t.origin===n.location.origin&&t.data?.type===J&&r()};return n.addEventListener(`message`,i),r(),()=>n.removeEventListener(`message`,i)},X=(e,t=window)=>{let n=n=>{if(n.source!==t.parent||n.origin!==t.location.origin)return;let{type:r,title:i}=n.data??{};r===q&&typeof i==`string`&&e(i)};return t.addEventListener(`message`,n),t.parent!==t&&t.parent.postMessage({type:J},t.location.origin),()=>t.removeEventListener(`message`,n)};export{t as C,v as D,y as E,m as O,_ as S,s as T,C as _,H as a,d as b,B as c,A as d,j as f,k as g,O as h,K as i,f as k,E as l,F as m,Y as n,U as o,N as p,G as r,V as s,X as t,P as u,T as v,u as w,p as x,w as y};