{"version":3,"file":"media-player-C4NN-Z01.mjs","names":["toggleMute","volumeTarget","playMedia","el","HTMLMediaElement","play","catch","err","DOMException","name","togglePlayback","paused","pause","seekMedia","time","currentTime","setMediaVolume","v","t","volume","muted","toggleMediaMute","setMediaRate","rate","playbackRate","defaultPlaybackRate","setMediaLoop","loop","PLAYER_HOST_CLASS","createPlayerHost","HTMLDivElement","host","document","createElement","className","placeHost","parent","Element","HTMLElement","append","removeHost","remove","PlayerAction","kind","direction","delta","digit","PlayerKey","id","keys","label","action","videoOnly","PLAYER_KEYS","Array","from","length","_","const","matchesKeys","e","Pick","KeyboardEvent","metaKey","ctrlKey","altKey","parts","split","shift","key","toLowerCase","shiftKey","useEffect","useRef","useState","useEventCallback","useLatestRef","IDLE_MS","Idle","idle","wake","rest","IdleOptions","keepUp","noTimer","enabled","quietMs","useIdle","t0","$","_c","t1","t2","undefined","asleep","setAsleep","held","untimed","wasUntimed","setWasUntimed","timer","hold","noArm","t3","current","clearTimeout","setTimeout","arm","t4","t5","t6","t7","t8","t9","_c","useCallback","useRef","useSyncExternalStore","bufferedEnd","MediaState","paused","ended","duration","volume","muted","MediaTime","currentTime","buffered","STATE_EVENTS","const","TIME_EVENTS","INITIAL_STATE","Number","NaN","INITIAL_TIME","readState","el","HTMLMediaElement","readTime","sameValues","a","T","b","k","Object","keys","is","useElementSnapshot","events","read","initial","$","_c","t0","value","cache","t1","current","t2","notify","_temp","onEvent","next","prev","e","addEventListener","e_0","removeEventListener","subscribe","useMediaState","useMediaTime","_c","_temp","subscribe","useEffect","useRef","useState","createPreviewSeeker","SeekPreview","t0","$","_c","src","time","width","height","video","setVideo","failed","setFailed","seeker","latest","t1","t2","current","seek","t3","t4","s","dispose","t5","t6","Symbol","for","t7","_c","useRef","useState","PointerEvent","Text","previewSize","clamp","formatTime","fractionAt","seekKeyTarget","SeekPreview","SeekBarProps","currentTime","duration","buffered","rate","video","HTMLVideoElement","onSeek","time","onDragChange","dragging","PLAYER_INSET","pct","f","SeekBar","t0","$","_c","trackRef","bubbleRef","setDragging","draggingNow","t1","Symbol","for","fraction","left","frame","hover","setHover","armed","setArmed","d","Number","isFinite","played","t2","x","r","current","getBoundingClientRect","width","fractionOf","t3","e","clientX","bar","currentTarget","bw","offsetWidth","player","closest","lo","hi","right","videoWidth","videoHeight","height","onPointerMove","t4","endDrag","t5","Math","round","t6","t7","t8","t9","t10","undefined","t11","t12","e_0","button","setPointerCapture","pointerId","t13","e_1","next","key","preventDefault","stopPropagation","t14","t15","t16","t17","t18","t19","t20","t21","t22","t23","t24","currentSrc","t25","t26","t27","t28","t29","_c","Text","formatTime","useMediaTime","SeekBar","Timeline","t0","$","_c","el","duration","rate","remaining","onToggleRemaining","onSeek","onSeekDrag","currentTime","buffered","d","Number","isFinite","t1","t2","t3","HTMLVideoElement","t4","t5","t6","t7","_c","_Fragment","FocusEventHandler","KeyboardEventHandler","PointerEventHandler","Ref","ControlSizeProvider","SURFACE_LEVELS","TooltipProvider","cn","IconButton","Text","symbol","TOOLTIP_DELAY_MS","rateShort","sameRate","volumeGlyph","Timeline","playIcon","pauseIcon","volumeUpIcon","volumeDownIcon","volumeOffIcon","settingsIcon","fullscreenIcon","fullscreenExitIcon","VOLUME_ICONS","off","down","up","const","ControlPillProps","kind","el","HTMLMediaElement","paused","duration","volume","rate","remaining","settingsOpen","volumeOpen","fullscreen","onPlay","onMute","onSeek","time","onSeekDrag","dragging","onToggleRemaining","onSettings","onFullscreen","onSpeakerEnter","HTMLElement","onSpeakerLeave","onSpeakerFocus","onSpeakerBlur","onSpeakerKeyDown","speakerRef","HTMLSpanElement","gearRef","ref","HTMLDivElement","ControlPill","t0","$","_c","muteLabel","t1","Symbol","for","float","t2","t3","t4","t5","t6","t7","undefined","t8","t9","t10","t11","t12","t13","t14","t15","t16","t17","t18","t19","playIcon","pauseIcon","volumeUpIcon","volumeOffIcon","settingsIcon","fullscreenIcon","fullscreenExitIcon","_c","useEffect","useRef","useState","Text","DIAL_WHEEL_SETTLE_MS","RATE_MAX","RATE_MIN","clickRate","dialTicks","dragRate","keyRate","rulerOffset","wheelRate","focusElement","SetRate","rate","opts","snap","TICKS","SpeedDial","t0","$","_c","settle","setRate","focused","drag","setDrag","wheelEl","settleTimer","undefined","rateRef","t1","t2","el","current","onWheel","e","preventDefault","next","deltaX","deltaY","clearTimeout","setTimeout","addEventListener","passive","removeEventListener","t3","t4","t5","t6","reveal","dragNow","t7","clientX","box","moved","left","width","end","t8","settleDrag","t9","toFixed","t10","t11","t12","e_0","button","currentTarget","setPointerCapture","pointerId","x","t13","e_1","dx","Math","abs","t14","e_2","getBoundingClientRect","t15","e_3","next_0","key","stopPropagation","t16","t17","t18","t19","transform","t20","Symbol","for","map","_temp","t21","t22","t23","t","kind","Tick","_c","_temp","_Fragment","CSSProperties","Ref","SURFACE_LEVELS","cn","Theme","Text","SwitchIndicator","Kbd","symbol","Icon","RATE_PRESETS","rateReadout","rateShort","sameRate","mediaSettingsThemeScope","SpeedDial","SetRate","resetIcon","loopIcon","pipIcon","SettingsPanelProps","open","place","rate","settle","setRate","loop","onLoop","pip","onToggle","sheet","ref","HTMLElement","SettingsPanel","t0","$","_c","t1","atOne","t2","t3","t4","undefined","t5","t6","t7","Symbol","for","overlay","t8","t9","t10","t11","t12","t13","t14","t15","t16","t17","t18","map","r","t19","t20","t21","t22","t23","t24","t25","t26","t27","t28","t29","loopIcon","pipIcon","_c","CSSProperties","FocusEventHandler","KeyboardEvent","PointerEvent","PointerEventHandler","Ref","SURFACE_LEVELS","cn","Theme","Slider","VOLUME_STEP","mediaVolumeThemeScope","KEY_STEPS","Record","ArrowUp","ArrowRight","ArrowDown","ArrowLeft","VolumeCapsule","t0","$","_c","open","place","volume","onVolume","onPointerEnter","onPointerLeave","onBlur","onTab","onDragChange","sliderRef","ref","t1","t2","undefined","t3","Symbol","for","float","t4","e","key","preventDefault","shiftKey","step","stopPropagation","t5","t6","t7","t8","e_0","button","t9","t10","_c","useEffect","useRef","useState","MouseEvent","Ref","SURFACE_LEVELS","cn","Text","symbol","IconRef","Icon","SEEK_RUN_MS","TOUCH_SKIP_SECONDS","clamp","formatTime","fractionAt","rateShort","sameRate","volumeGlyph","NO_TAPS","judgeTap","sideAt","TapMemory","useMediaTime","playIcon","pauseIcon","replayIcon","backIcon","forwardIcon","volumeUpIcon","volumeOffIcon","settingsIcon","fullscreenIcon","fullscreenExitIcon","leftIcon","rightIcon","GLASS","float","TouchControlsProps","el","HTMLMediaElement","label","shown","paused","ended","duration","volume","rate","remaining","fullscreen","settingsOpen","onTap","onWake","onPlay","onSkip","seconds","onMute","onToggleRemaining","onSettings","onFullscreen","onSeek","time","onSeekDrag","dragging","gearRef","HTMLSpanElement","Run","side","n","TouchControls","props","$","_c","memory","tapTimer","undefined","runTimer","run","setRun","t0","t1","Symbol","for","clearTimeout","current","t2","dir","end","Number","isFinite","currentTime","r","setTimeout","sideSeek","t3","e","box","currentTarget","getBoundingClientRect","side_0","clientX","left","width","judged","performance","now","verdict","kind","last","delay","onSurfaceClick","t4","fn","press","muteLabel","t5","t6","t7","t8","t9","t10","t11","t12","t13","t14","t15","t16","t17","t18","t19","t20","t21","t22","t23","t24","t25","t26","t27","t28","t29","t30","t31","t32","t33","t34","t35","t36","t37","t38","t39","t40","t41","t42","TouchButton","aria","className","icon","onClick","stopPropagation","Ripple","on","chevron","TouchTime","d","TouchSeekBar","onDragChange","buffered","trackRef","drag","setDrag","shownTime","f","x","timeAt","x_0","t","move","Math","round","button","setPointerCapture","pointerId","e_0","playIcon","pauseIcon","backIcon","forwardIcon","_c","_Fragment","useCallback","useEffect","useMemo","useRef","useState","useSyncExternalStore","CSSProperties","FocusEvent","ReactFocusEvent","KeyboardEvent","ReactKeyboardEvent","ReactNode","SyntheticEvent","SURFACE_LEVELS","cn","isPointerModality","Theme","PortalHost","Text","useEventCallback","useLatestRef","useSurfaceTabId","targetClaimsKey","usePlayPauseShortcut","useSurfaceShortcuts","symbol","Icon","SLIM","TOUCH_HIDE_MS","TOUCH_QUERY","VOLUME_CLOSE_MS","PLAYER_KEYS","matchesKeys","PlayerAction","RATE_KEY_STEP","VOLUME_KEY_STEP","VOLUME_STEP","audibleVolume","clampRate","digitTarget","rateShort","skipSeconds","skipTarget","snapRate","mediaPlayerThemeScope","useIdle","playMedia","seekMedia","setMediaLoop","setMediaRate","setMediaVolume","toggleMediaMute","togglePlayback","useMediaState","ControlPill","SettingsPanel","VolumeCapsule","SetRate","focusElement","useMediaQuery","TouchControls","playIcon","pauseIcon","backIcon","forwardIcon","loopIcon","FLASH_GLASS","float","PLAYER_ATTR","PlayerProps","kind","src","label","autoPlay","poster","onError","error","MediaError","onPlay","className","pip","open","toggle","mediaRef","el","HTMLMediaElement","rootRef","HTMLElement","Flash","n","content","wide","keyInside","root","e","target","Node","contains","spaceIsFor","Element","owner","closest","surface","getAttribute","peers","Array","from","ownerDocument","querySelectorAll","filter","p","pick","find","hasAttribute","spaceOnOwnButton","button","undefined","useFullscreenOf","doc","$","_c","t0","notify","_temp","addEventListener","removeEventListener","subscribe","t1","fullscreenElement","read","FOCUSABLE","placeAbove","pill","anchor","align","width","getBoundingClientRect","b","top","bottom","gap","left","right","Math","max","Player","setEl","setRoot","pillRef","speakerRef","gearRef","volumeRef","settingsRef","volumeSliderRef","resumeAfterSeek","media","muted","volume","rate","setRateState","settle","setSettle","loop","setLoop","remaining","setRemaining","settings","setSettings","volumeAt","setVolumeAt","seeking","setSeeking","volumeDragging","setVolumeDragging","flash","setFlash","nativeFullscreen","filling","setFilling","fullscreen","touch","pipOpen","wasPip","setWasPip","played","setPlayed","paused","settingsOpen","volumeOpen","t2","t3","t4","t5","t6","keepUp","noTimer","enabled","quietMs","idle","wake","rest","t7","t8","t9","Symbol","for","t10","f","show","r","opts","snap","next","setRate","t11","v","setVolume","t12","t13","exitFullscreen","fullscreenEnabled","requestFullscreen","toggleFullscreen","t14","current","gear","openSettings","volumeDraggingRef","volumeClose","t15","open_0","clearTimeout","pill_0","speaker","setTimeout","openVolume","t16","t17","t18","node","inVolumeControls","t19","relatedTarget","onVolumeBlur","t20","back","speaker_0","querySelector","reveal","controls","indexOf","tabFromCapsule","t21","t22","onDown","e_0","t","t23","t24","targets","onWheel","e_1","preventDefault","sign","deltaY","t_0","passive","t_1","t25","action","bb282","currentTime","direction","duration","base","delta","round","_temp2","next_0","digit","run","t26","e_2","when","t27","onSpace","t28","settingsOpenNow","t29","t30","k","videoOnly","t31","k_0","id","keys","group","e_3","handler","map","descriptors","inOwnWindow","e_4","defaultPrevented","native","nativeEvent","key","hit","k_1","onKeyDown","dragging","pause","onSeekDrag","t32","node_0","setRootRef","t33","node_1","setMediaRef","t34","t35","e_5","currentTarget","t36","t37","ref","preload","common","const","t38","t39","t40","t41","t42","t43","t44","t45","t46","t47","t48","t49","t50","t51","t52","t53","t54","ended","seconds","_temp3","t_2","t_3","_temp4","e_6","shiftKey","dragging_0","matches","t55","t56","_temp5","t57","onToggle","t58","t59","t60","l_0","l","r_1","r_0","CenterFlash","BigPlay","_c","descriptors","_Fragment","useEffect","useLayoutEffect","useRef","useState","createPortal","Button","ControlSizeProvider","cn","trackInputModality","Theme","Text","useEventCallback","symbol","Icon","PIP_WIDTH","documentPipOf","mirrorPageInto","pipOffered","requestPipWindow","mediaPlayerThemeScope","createPlayerHost","placeHost","PLAYER_HOST_CLASS","removeHost","Player","focusElement","renderMode","pipIcon","MediaPlayerProps","kind","src","label","autoPlay","poster","onError","error","MediaError","onPlay","className","MediaPlayer","props","$","_c","t0","StaticMediaPlayer","t1","t2","t3","t4","LiveMediaPlayer","host","slotRef","HTMLDivElement","rootRef","HTMLElement","mediaRef","HTMLMediaElement","win","setWin","Window","holder","setHolder","width","height","offered","window","current","close","openOwnWindow","w","root","r","getBoundingClientRect","dispose","document","untrack","body","reveal","addEventListener","once","requesting","toggle","media","pictureInPictureElement","exitPictureInPicture","enterPip","api","Math","round","max","HTMLVideoElement","requestPictureInPicture","open","m","_c","_Fragment","SLIM","IDLE_MS","PREVIEW_MIN_W","PREVIEW_MAX_W","PREVIEW_MAX_H_SHARE","aspect","w","width","h","maxH","height","TOUCH_HIDE_MS","WHITE","FG_DIM","ACCENT","BLACK","INK","TOOLTIP","HOVER","ROW_HOVER","HAIRLINE","GLASS_EDGE","SWITCH_OFF","FOCUS","GLASS_TINT","GLASS_PANEL","GLASS_FILTER","GLASS_SHADOW","mediaPlayerTheme","defineFixedTheme","colorPaletteGroup","both","materialGroup","shadowGroup","shapeGroup","overlayGroup","densityGroup","typeScaleGroup","iconsGroup","mediaPlayerThemeScope","fixedThemeScope","mediaSettingsTheme","defineSubTheme","mediaSettingsThemeScope","subThemeScope","mediaVolumeTheme","mediaVolumeThemeScope","api","win","pip","size","err","sheet","n","rules","style","to","r","SPRITES","MIRROR","from","clone","source","target","a","view","observer","head","attrs","sprites","records","hi","lo","v","seconds","m","s","x","left","end","i","ranges","currentTime","VOLUME_STEP","VOLUME_KEY_STEP","muted","volume","RATE_MIN","RATE_STEP","RATE_PRESETS","RATE_KEY_STEP","DIAL_PX_PER_STEP","EPS","b","rate","startRate","dx","deltaX","deltaY","key","ticks","major","mid","current","delta","duration","d","step","digit","el","time","t","loop","PLAYER_HOST_CLASS","host","PLAYER_KEYS","e","parts","keys","shift","$","c","t1","t2","t0","noTimer","quietMs","asleep","setAsleep","useState","held","keepUp","enabled","untimed","wasUntimed","setWasUntimed","timer","useRef","hold","useLatestRef","noArm","arm","useEventCallback","t5","useEffect","wake","rest","t8","t9","STATE_EVENTS","TIME_EVENTS","INITIAL_STATE","INITIAL_TIME","k","initial","cache","read","events","next","notify","e_0","useSyncExternalStore","inFlight","pending","video","setVideo","failed","setFailed","seeker","latest","t4","t7","src","PLAYER_INSET","f","trackRef","bubbleRef","dragging","setDragging","draggingNow","hover","setHover","armed","setArmed","played","fractionOf","onSeek","bar","bw","player","onPointerMove","onDragChange","endDrag","t6","t10","e_1","t14","buffered","t15","t16","t17","t18","t19","t20","t21","t22","t23","t24","t25","t26","t27","Text","t28","t29","t3","onSeekDrag","remaining","onToggleRemaining","Fragment","playIcon$2","symbol","pauseIcon$2","volumeUpIcon$1","volumeDownIcon","volumeOffIcon$1","settingsIcon$1","fullscreenIcon$1","fullscreenExitIcon$1","VOLUME_ICONS","muteLabel","cn","SURFACE_LEVELS","paused","onPlay","IconButton","volumeOpen","onMute","onSpeakerBlur","onSpeakerEnter","onSpeakerFocus","onSpeakerKeyDown","onSpeakerLeave","speakerRef","t11","t12","kind","t13","settingsOpen","onSettings","gearRef","fullscreen","onFullscreen","ControlSizeProvider","TooltipProvider","ref","TICKS","drag","setDrag","wheelEl","settleTimer","rateRef","setRate","focused","focusElement","dragNow","clientX","box","settleDrag","e_2","next_0","e_3","settle","resetIcon","loopIcon$1","pipIcon$1","atOne","open","place","Icon","Kbd","SwitchIndicator","onLoop","Theme","KEY_STEPS","onTab","onVolume","sliderRef","Slider","onBlur","onPointerEnter","onPointerLeave","fraction","NO_TAPS","side","running","memory","now","double","playIcon$1","pauseIcon$1","replayIcon","backIcon$1","forwardIcon$1","volumeUpIcon","volumeOffIcon","settingsIcon","fullscreenIcon","fullscreenExitIcon","leftIcon","rightIcon","GLASS","props","tapTimer","runTimer","run","setRun","onSkip","dir","sideSeek","onTap","side_0","judged","onSurfaceClick","onWake","fn","press","shown","label","ended","t30","t31","t32","t33","t34","t35","t36","t37","t38","t39","t40","t41","t42","aria","className","icon","onClick","on","chevron","shownTime","timeAt","x_0","move","playIcon","pauseIcon","backIcon","forwardIcon","loopIcon","FLASH_GLASS","PLAYER_ATTR","root","owner","surface","peers","p","button","isPointerModality","doc","subscribe","FOCUSABLE","anchor","top","pill","bottom","align","setEl","setRoot","pillRef","volumeRef","settingsRef","volumeSliderRef","resumeAfterSeek","media","setRateState","setSettle","setLoop","setRemaining","settings","setSettings","volumeAt","setVolumeAt","seeking","setSeeking","volumeDragging","setVolumeDragging","flash","setFlash","nativeFullscreen","filling","setFilling","useSurfaceTabId","touch","useMediaQuery","pipOpen","wasPip","setWasPip","setPlayed","wide","show","snap","opts","setVolume","toggle","toggleFullscreen","gear","openSettings","volumeDraggingRef","volumeClose","pill_0","speaker","open_0","openVolume","node","inVolumeControls","onVolumeBlur","speaker_0","back","controls","tabFromCapsule","targets","t_0","t_1","action","base","when","onSpace","settingsOpenNow","k_0","inOwnWindow","e_4","native","targetClaimsKey","hit","k_1","onKeyDown","rootRef","node_0","setRootRef","mediaRef","node_1","setMediaRef","autoPlay","onError","e_5","common","t43","idle","t44","t45","t46","t47","t48","t49","t50","t51","t52","poster","t53","t54","t_2","t_3","e_6","dragging_0","t55","t57","t58","t59","PortalHost","t60","l_0","r_1","r_0","l","pipIcon","renderMode","slotRef","setWin","holder","setHolder","offered","useLayoutEffect","dispose","untrack","trackInputModality","requesting","root_0","w_0","media_0","Button","createPortal"],"sources":["../../../../../__A__/dev/singularity/.claude/worktrees/att-1794515063-e6dm4h/plugins/media/plugins/player/web/internal/geometry.ts","../../../../../__A__/dev/singularity/.claude/worktrees/att-1794515063-e6dm4h/plugins/media/plugins/player/web/internal/theme.ts","../../../../../__A__/dev/singularity/.claude/worktrees/att-1794515063-e6dm4h/plugins/media/plugins/player/web/internal/document-pip.ts","../../../../../__A__/dev/singularity/.claude/worktrees/att-1794515063-e6dm4h/plugins/media/plugins/player/web/internal/math.ts","../../../../../__A__/dev/singularity/.claude/worktrees/att-1794515063-e6dm4h/plugins/media/plugins/player/web/internal/media-ops.ts","../../../../../__A__/dev/singularity/.claude/worktrees/att-1794515063-e6dm4h/plugins/media/plugins/player/web/internal/keymap.ts","../../../../../__A__/dev/singularity/.claude/worktrees/att-1794515063-e6dm4h/plugins/media/plugins/player/web/internal/use-idle.ts","../../../../../__A__/dev/singularity/.claude/worktrees/att-1794515063-e6dm4h/plugins/media/plugins/player/web/internal/use-media-state.ts","../../../../../__A__/dev/singularity/.claude/worktrees/att-1794515063-e6dm4h/plugins/media/plugins/player/web/internal/preview-seeker.ts","../../../../../__A__/dev/singularity/.claude/worktrees/att-1794515063-e6dm4h/plugins/media/plugins/player/web/components/seek-preview.tsx","../../../../../__A__/dev/singularity/.claude/worktrees/att-1794515063-e6dm4h/plugins/media/plugins/player/web/components/seek-bar.tsx","../../../../../__A__/dev/singularity/.claude/worktrees/att-1794515063-e6dm4h/plugins/media/plugins/player/web/components/timeline.tsx","../../../../../__A__/dev/singularity/.claude/worktrees/att-1794515063-e6dm4h/plugins/media/plugins/player/web/components/control-pill.tsx","../../../../../__A__/dev/singularity/.claude/worktrees/att-1794515063-e6dm4h/plugins/media/plugins/player/web/components/speed-dial.tsx","../../../../../__A__/dev/singularity/.claude/worktrees/att-1794515063-e6dm4h/plugins/media/plugins/player/web/components/settings-panel.tsx","../../../../../__A__/dev/singularity/.claude/worktrees/att-1794515063-e6dm4h/plugins/media/plugins/player/web/components/volume-capsule.tsx","../../../../../__A__/dev/singularity/.claude/worktrees/att-1794515063-e6dm4h/plugins/media/plugins/player/web/internal/taps.ts","../../../../../__A__/dev/singularity/.claude/worktrees/att-1794515063-e6dm4h/plugins/media/plugins/player/web/components/touch-controls.tsx","../../../../../__A__/dev/singularity/.claude/worktrees/att-1794515063-e6dm4h/plugins/media/plugins/player/web/components/player.tsx","../../../../../__A__/dev/singularity/.claude/worktrees/att-1794515063-e6dm4h/plugins/media/plugins/player/web/components/media-player.tsx"],"sourcesContent":["/**\n * The player's measures, as the prototype names them\n * (`proto-1793924689-zwfacl`, its `slim` size — the one shipped). Kept as\n * named constants, not a size knob: the prototype also designs `regular`\n * (row 40, button 36, icon 22, pill 48) and `slimmer` (row 28, button 26,\n * icon 18, pill 36); a size option is these numbers switched as one set.\n *\n * The CSS (`media-player.css`) spells the same numbers; the ones the code\n * computes with live here.\n */\nexport const SLIM = {\n /** The button row; the pill is the row + 8px (3px padding, 1px border). */\n row: 34,\n /** A pill button's square. */\n button: 30,\n /** The space between the pill and anything floating above it. */\n gap: 6,\n /** The settings panel's scale: the pill's height over the regular 48px. */\n k: 0.875,\n} as const;\n\n/** How long the controls stay up after the pointer last moved, while playing. */\nexport const IDLE_MS = 2000;\n/** The volume capsule stays open this long after the pointer leaves it. */\nexport const VOLUME_CLOSE_MS = 180;\n/** A wheel over the speed dial settles onto the step this long after it stops. */\nexport const DIAL_WHEEL_SETTLE_MS = 120;\n/** The size the picture-in-picture window opens at (its height follows the video). */\nexport const PIP_WIDTH = 560;\n/** A pill button's tooltip waits this long under the pointer. */\nexport const TOOLTIP_DELAY_MS = 350;\n\n/** The preview frame's size: a quarter of the player's width, in bounds. */\nconst PREVIEW_MIN_W = 96;\nconst PREVIEW_MAX_W = 192;\n/** …and never taller than this share of the player (a short or portrait video). */\nconst PREVIEW_MAX_H_SHARE = 0.4;\n\n/**\n * The preview frame's size inside a `width × height` player for a video of\n * `aspect` (width over height), or null while the aspect is not known yet.\n */\nexport function previewSize(\n aspect: number,\n width: number,\n height: number,\n): { width: number; height: number } | null {\n if (!(aspect > 0)) return null;\n let w = Math.min(PREVIEW_MAX_W, Math.max(PREVIEW_MIN_W, width / 4));\n let h = w / aspect;\n const maxH = height * PREVIEW_MAX_H_SHARE;\n if (h > maxH) {\n h = maxH;\n w = h * aspect;\n }\n return { width: Math.round(w), height: Math.round(h) };\n}\n\n// ── Touch (`proto-1794361798-f9dak8`) ───────────────────────────────────\n\n/** The media query a touch-first screen answers: no hover, a coarse pointer. */\nexport const TOUCH_QUERY = \"(hover: none) and (pointer: coarse)\";\n/**\n * How long the touch controls stay up after the last tap, while playing.\n * Shorter than YouTube's ~3 s on purpose: the picture is the point on a small\n * screen, and every tap on the chrome restarts the clock.\n */\nexport const TOUCH_HIDE_MS = 1500;\n/** One centre ± button, or one tap of a side double-tap: media seconds. */\nexport const TOUCH_SKIP_SECONDS = 10;\n/** A second tap on the same side within this is a double-tap (a seek), not two taps. */\nexport const DOUBLE_TAP_MS = 280;\n/** Once a side seek runs, each tap on that side within this seeks again. */\nexport const SEEK_RUN_MS = 750;\n/** Where a side starts: a tap left of this fraction of the width is the left side… */\nexport const SIDE_LEFT = 0.38;\n/** …and right of this one the right side; between them, the middle. */\nexport const SIDE_RIGHT = 0.62;\n","import {\n both,\n defineFixedTheme,\n defineSubTheme,\n} from \"@plugins/ui/plugins/theme-engine/core\";\nimport {\n fixedThemeScope,\n subThemeScope,\n} from \"@plugins/primitives/plugins/css/plugins/ui-kit/core\";\nimport { colorPaletteGroup } from \"@plugins/ui/plugins/tokens/plugins/color-palette/core\";\nimport { materialGroup } from \"@plugins/ui/plugins/tokens/plugins/material/core\";\nimport { shadowGroup } from \"@plugins/ui/plugins/tokens/plugins/shadow/core\";\nimport { shapeGroup } from \"@plugins/ui/plugins/tokens/plugins/shape/core\";\nimport { overlayGroup } from \"@plugins/ui/plugins/tokens/plugins/overlay/core\";\nimport { densityGroup } from \"@plugins/ui/plugins/tokens/plugins/density/core\";\nimport { typeScaleGroup } from \"@plugins/ui/plugins/tokens/plugins/type-scale/core\";\nimport { iconsGroup } from \"@plugins/ui/plugins/tokens/plugins/icons/core\";\nimport { SLIM } from \"./geometry\";\n\n// The prototype's palette (`proto-1793924689-zwfacl`), by its own names.\nconst WHITE = \"oklch(1 0 0)\"; // --fg\nconst FG_DIM = \"oklch(1 0 0 / 0.78)\"; // --fg-dim\nconst ACCENT = \"oklch(0.5990 0.2299 286.20)\"; // --accent: violet, #7c5cff\nconst BLACK = \"oklch(0 0 0)\"; // the player behind the video\nconst INK = \"oklch(0.1931 0.0080 285.63)\"; // rgb(20 20 24): tooltips, the time bubble, the badge's ring\nconst TOOLTIP = \"oklch(0.1931 0.0080 285.63 / 0.9)\";\nconst HOVER = \"oklch(1 0 0 / 0.14)\"; // a button hovered or open; a key cap\nconst ROW_HOVER = \"oklch(1 0 0 / 0.09)\"; // a settings row hovered\nconst HAIRLINE = \"oklch(1 0 0 / 0.12)\"; // the bubble's and tooltip's ring\nconst GLASS_EDGE = \"oklch(1 0 0 / 0.16)\"; // every glass surface's border\nconst SWITCH_OFF = \"oklch(1 0 0 / 0.2)\";\nconst FOCUS = \"oklch(1 0 0 / 0.6)\";\n\n// The `clear` glass — the one shipped. Its siblings in the prototype, for when\n// a glass option is wanted: `frosted` (tint rgb(20 20 24 / .42), panel .56,\n// blur(24px) saturate(1.3) brightness(.7)) and `dark` (rgb(14 14 18 / .6),\n// panel .66, blur(24px) saturate(1.2) brightness(.6)).\nconst GLASS_TINT = \"oklch(0.2793 0.0109 285.67 / 0.26)\"; // rgb(40 40 46 / .26): pill, capsule, flash\nconst GLASS_PANEL = \"oklch(0.2367 0.0076 285.81 / 0.44)\"; // rgb(30 30 34 / .44): the settings panel\nconst GLASS_FILTER = \"blur(18px) saturate(1.5) brightness(0.82)\";\nconst GLASS_SHADOW =\n \"0 10px 30px oklch(0 0 0 / 0.32), inset 0 1px 0 oklch(1 0 0 / 0.07)\";\n\n/**\n * What the player's controls wear: dark glass and white glyphs whatever the\n * app's theme — controls over a picture follow the video convention, not the\n * page's light or dark. A fixed theme, so the tooltips and panels opened from\n * the controls wear it too.\n *\n * Its pieces map onto the surface roles: the pill, the volume capsule and the\n * centre feedback are `float` glass (the `material` group's float fill,\n * backdrop and border, `shadow-float`); the settings panel is the denser\n * `overlay` glass (popover fill and backdrop, `shadow-popover`); a hovered or\n * open button is the float surface's hover (`accent`); the accent itself — the\n * played part of the seek bar, the dial's needle, the picked chip, the Loop\n * switch — is `primary`.\n */\nexport const mediaPlayerTheme = defineFixedTheme({\n id: \"media-player\",\n label: \"Media player controls\",\n scheme: \"dark\",\n fragments: [\n colorPaletteGroup.fragment(\n both({\n background: BLACK,\n foreground: WHITE,\n card: INK,\n cardForeground: WHITE,\n popover: INK,\n popoverForeground: WHITE,\n popoverBorder: GLASS_EDGE,\n popoverHover: ROW_HOVER,\n primary: ACCENT,\n primaryForeground: WHITE,\n secondary: HOVER,\n secondaryForeground: WHITE,\n accent: HOVER,\n accentForeground: WHITE,\n muted: HOVER,\n mutedForeground: FG_DIM,\n border: HAIRLINE,\n input: HAIRLINE,\n ring: FOCUS,\n switchTrack: SWITCH_OFF,\n switchKnob: WHITE,\n switchKnobOn: WHITE,\n sliderKnob: WHITE,\n }),\n ),\n materialGroup.fragment(\n both({\n floatFill: GLASS_TINT,\n floatBackdrop: GLASS_FILTER,\n floatBorder: GLASS_EDGE,\n popoverFill: GLASS_PANEL,\n popoverBackdrop: GLASS_FILTER,\n }),\n ),\n shadowGroup.fragment(\n both({\n \"shadow-float\": GLASS_SHADOW,\n \"shadow-popover\": GLASS_SHADOW,\n // The volume knob lifts off the capsule.\n \"shadow-slider-knob\": \"0 1px 4px oklch(0 0 0 / 0.4)\",\n }),\n ),\n shapeGroup.fragment(\n both({\n // The pill and the capsule are fully round; the settings panel's\n // corners are 20px at the regular size, scaled.\n radiusFloat: \"9999px\",\n radiusPopover: `${20 * SLIM.k}px`,\n }),\n ),\n overlayGroup.fragment(\n both({\n tooltipFill: TOOLTIP,\n tooltipBorder: HAIRLINE,\n tooltipRadius: \"9999px\",\n tooltipPadX: \"0.625rem\",\n tooltipPadY: \"0.25rem\",\n tooltipShadow: \"none\",\n tooltipOffset: \"12px\",\n tooltipArrowSize: \"0px\",\n }),\n ),\n densityGroup.fragment(\n both({\n // The pill's buttons: a 30px square holding a 20px glyph.\n controlHeightSm: `${SLIM.button / 16}rem`,\n controlIconSm: \"1.25rem\",\n // The volume capsule's slider: a 4px track, a 12px knob.\n sliderTrackH: \"0.25rem\",\n sliderKnobSize: \"0.75rem\",\n }),\n ),\n typeScaleGroup.fragment(\n both({\n // The times and the settings rows: 13px, regular.\n fontSizeBody: \"0.8125rem\",\n lineHeightBody: \"1.25rem\",\n // The speed readout and the centre flash: 15px, semibold.\n fontSizeSubheading: \"0.9375rem\",\n lineHeightSubheading: \"1.25rem\",\n // The gear's speed badge: 9px bold figures on a 13px line.\n fontSizeTagCompact: \"0.5625rem\",\n lineHeightTagCompact: \"0.8125rem\",\n }),\n ),\n // The prototype's glyphs are Material's filled ones.\n iconsGroup.fragment(both({ iconFill: \"filled\" })),\n ],\n});\n\nexport const mediaPlayerThemeScope = fixedThemeScope(mediaPlayerTheme);\n\n/**\n * The settings panel is drawn at the pill's scale: every measure of it is the\n * regular design times `SLIM.k` — its words through the type scale's\n * `fontScale`, its geometry in `media-player.css`.\n */\nexport const mediaSettingsTheme = defineSubTheme({\n id: \"media-player-settings\",\n label: \"Media player settings panel\",\n fragments: [typeScaleGroup.fragment(both({ fontScale: `${SLIM.k}` }))],\n});\n\nexport const mediaSettingsThemeScope = subThemeScope(mediaSettingsTheme);\n\n/**\n * The volume capsule's slider: a white fill on a 30% white track, its keyboard\n * focus a soft white halo — the seek bar keeps the accent for the played part.\n */\nexport const mediaVolumeTheme = defineSubTheme({\n id: \"media-player-volume\",\n label: \"Media player volume\",\n fragments: [\n colorPaletteGroup.fragment(\n both({\n primary: WHITE,\n border: \"oklch(1 0 0 / 0.3)\",\n ring: \"oklch(1 0 0 / 0.35)\",\n }),\n ),\n ],\n});\n\nexport const mediaVolumeThemeScope = subThemeScope(mediaVolumeTheme);\n","/**\n * Document Picture-in-Picture: an always-on-top window the player moves into\n * whole — controls, panels and all — instead of the browser's own video\n * picture in picture, which shows the bare video under controls nobody can\n * theme.\n */\n\n/** The `window.documentPictureInPicture` API (Chromium 116+), not in the DOM lib yet. */\nexport interface DocumentPictureInPicture {\n requestWindow(options: { width: number; height: number }): Promise;\n}\n\nexport function documentPipOf(win: Window): DocumentPictureInPicture | null {\n const api = (win as Window & { documentPictureInPicture?: unknown })\n .documentPictureInPicture;\n return typeof api === \"object\" && api !== null\n ? (api as DocumentPictureInPicture)\n : null;\n}\n\n/** Whether any picture in picture is offered here: our own window, or the browser's video one. */\nexport function pipOffered(win: Window): boolean {\n return documentPipOf(win) !== null || win.document.pictureInPictureEnabled;\n}\n\n/**\n * Ask for our own window. The browser may refuse — inside a frame Chrome\n * answers \"only allowed from a top-level browsing context\", without a user\n * gesture it refuses too — and it says so with a `DOMException`: that, and\n * only that, answers `null` (the caller falls back to the video's own picture\n * in picture), with a warning naming why. Anything else is a bug and throws.\n */\nexport async function requestPipWindow(\n pip: DocumentPictureInPicture,\n size: { width: number; height: number },\n): Promise {\n try {\n return await pip.requestWindow(size);\n } catch (err) {\n if (err instanceof DOMException) {\n console.warn(\n \"Document picture-in-picture refused; using the browser's video picture in picture:\",\n err,\n );\n return null;\n }\n throw err;\n }\n}\n\n/**\n * A stylesheet for the window: a `` whose rules the page can read\n * (same origin) is inlined as a `