strata-react 2.1.3 → 2.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -226,14 +226,14 @@ thousands of lines. Such an app imports the same stylesheet **without the reset*
226
226
  | Items kept for offline | `createReserve`, `useReserve` | The read side of the outbox: items the server made ahead (rounds of play), kept per key in localStorage (`strata:reserve:<name>:<key>`), `size` each. `take(key)` removes and returns the oldest (an item is used once); `refresh(key, fresh)` after a fresh item arrives drops kept items `sameMake(kept, fresh)` calls out of date and tops up in one request when fewer than half remain (one in flight per key; a failure is tried again at the next refresh); `useReserve(reserve, key)` is the count for "6 rounds kept for offline"; `seed` and `clear` for tests and stories. Without storage nothing is kept and `persisted` says so |
227
227
  | History and save state | `useHistory`, `useHistoryState`, `History`, `useAutoSave`, `SaveStatus`, `SaveState`, `useLeaveGuard` | Undo and redo for a document edited over a session: a step is a name and an `undo`/`redo` pair, `begin(label)` groups a drag into one step, a `key` merges a slider's pushes, a `limit` drops the oldest. `history.commands` are Undo and Redo as `Command`s ("Undo move clip", Mod+Z, Mod+Shift+Z or Mod+Y) for `useCommands` and `Menu`. `useAutoSave` debounces and never overlaps saves; `SaveStatus` is the fixed-width sign ("Saved 10:42", "Saving…", "Unsaved changes", "Not saved" with the reason and "Try again"), quiet except for a failure and its recovery. For one removal that commits after a few seconds, use `useUndoable` |
228
228
  | Links and URL choices | `ButtonLink`, `TextLink`, `useSearchParam`, `NativeSelect param=`, `ChoiceGroup param=`, `ToggleGroup param=` | `ButtonLink` is a link (`to` for a route, `href` for a download) drawn as a `Button` with its variants; it sets `data-variant`, so `variant="default"` is the view's one filled button for `expectOneFilledButton()`. `TextLink` is the house in-app link. Both are React Aria links with React Router navigation. A filter or choice a person would link to is `useSearchParam("mode", { default, parse })` (the default is never written, an invalid value reads as the default, other params are kept, history is replaced), or `param=` on the three controls, as `Tabs` does |
229
- | Speech | `speak`, `useSpeech`, `SayAgain`, `ClipsProvider`, `useClips`, `useSayOnShow`, `canSay`, `textOf`, `installFakeSpeech` (`strata-react/testing`) | The browser's `speechSynthesis` with the voice picked by language once voices have loaded, what is being said cancelled by the next prompt, a slightly slow default rate, and nothing where there is no speech or the person muted it. Recorded prompts (`speak(parts)`, `SayAgain parts=`): each part's clip plays in order, and the browser's voice says the words when a part has no clip or one fails (one voice per prompt). `SayAgain`'s name is the sentence it says. `installFakeSpeech()` records what was said and which clips played in a test (`clips()`, `finish()`, `failClip()`) . `ClipsProvider load=` reads the app's clip list once (a record of line text to URL, read again only when `clipsQueryKey` is invalidated); `useClips()` gives `ready`, `parts(text)`, `say(text)` and `words(text)` (`split` cuts a prompt into lines, `describe` words a line that has no clip), `useSayOnShow(text)` says a prompt once the list has arrived or failed, and `SayAgain` inside the provider needs no `parts` or `lang`; outside it, the browser's voice alone |
229
+ | Speech | `speak`, `useSpeech`, `SayAgain`, `SayPicture`, `ClipsProvider`, `useClips`, `useSayOnShow`, `canSay`, `textOf`, `installFakeSpeech` (`strata-react/testing`) | The browser's `speechSynthesis` with the voice picked by language once voices have loaded, what is being said cancelled by the next prompt, a slightly slow default rate, and nothing where there is no speech or the person muted it. Recorded prompts (`speak(parts)`, `SayAgain parts=`): each part's clip plays in order, and the browser's voice says the words when a part has no clip or one fails (one voice per prompt). `SayAgain`'s name is the sentence it says; `SayPicture` is the same on a big picture (the picture alone where nothing can be heard). `installFakeSpeech()` records what was said and which clips played in a test (`clips()`, `finish()`, `failClip()`) . `ClipsProvider load=` reads the app's clip list once (a record of line text to URL, read again only when `clipsQueryKey` is invalidated); `useClips()` gives `ready`, `parts(text)`, `say(text)` and `words(text)` (`split` cuts a prompt into lines, `describe` words a line that has no clip), `useSayOnShow(text)` says a prompt once the list has arrived or failed, and `SayAgain` inside the provider needs no `parts` or `lang`; outside it, the browser's voice alone |
230
230
  | Recording | `useRecorder`, `useAutoRecorder`, `InputLevel`, `ListeningLevel`, `TakeLevel`, `MicrophoneContext`, `encodeWav`, `createSegmenter`, `fakeMicrophone`, `speechScript` (`strata-react/testing`) | One take of speech from the microphone as a lossless 16-bit PCM WAV (an AudioWorklet, not MediaRecorder, which only writes compressed audio), with the browser's echo cancellation, noise suppression and gain off. `start()` resolves with the take when it stops, by `stop()` or at `maxSeconds`. `InputLevel` is the live peak in dBFS with a "Too loud" notch at -3; `TakeLevel` judges the finished take for speech in words. The device comes from `MicrophoneContext`, so tests pass `renderWithStrata(ui, { microphone: fakeMicrophone() })`. The microphone needs a secure page (https or localhost); the refusals read as sentences. Hands-free: `useAutoRecorder({ maxSeconds, onTake, paused })` keeps the microphone open and hands over each stretch of speech as its own take (`AutoTake`, `cut` when it ran past `maxSeconds`), cut by `createSegmenter` (20 ms frames against the room's measured quiet: 12 dB to start, 1 s of quiet to end, 0.3 s kept either side, under 0.3 s of speech dropped); `ListeningLevel` says whether it is waiting, hearing a take or paused, with the room's level. `fakeMicrophone({ script: speechScript(n), loop })` reads with gaps |
231
231
  | Toolbar and toggles | `Toolbar`, `ToolbarSeparator`, `Toggle`, `ToggleGroup`, `Switch` | A toolbar is one tab stop with arrows, Home and End inside; needs a `label`. `Toggle` (`aria-pressed`) and `ToggleGroup` (one of 2 to 7, always one chosen) show chosen as an ink border on a tint, never the filled primary, so they do not break the one-filled-button rule; an icon-only toggle still needs its `label` (shown as a tooltip). `Switch` is only for a setting that applies at once, label and control one target |
232
232
  | Commands | `Command`, `useCommands`, `Menu`, `ContextMenu`, `CommandMenu`, `CommandLegend`, `formatChord`, `matchesChord` | A command is declared once (label or label function, chords, `disabled` with a reason, `destructive`, `checked`) and drives the key handler, dropdown and menu-bar menus, the context menu, the searchable command menu (Mod+K) and the legend, so they cannot disagree. Chords are written once ("Mod+Shift+Z") and shown per platform (⇧⌘Z, Ctrl+Shift+Z); they never fire while typing or during IME composition, and a chord the browser keeps (Ctrl+S) needs `claim: true`. `useHotkeys` is unchanged for single keys |
233
233
  | Overlays | `Dialog`, `DialogProps`, `AlertDialog`, `Popover`, `Tooltip` | React Aria underneath. A dialog always has a title and, via `actions`'s close render prop, a way out; `closable={false}` while work cannot stop; `placement="end"` is a sheet. `AlertDialog` is the only confirm: required verb on the confirm button, Cancel focused first, no outside dismiss, stays open with the reason when an async confirm fails. `Popover` needs a `label`. `Tooltip` opens on hover and focus and `IconButton` uses it. All portal onto the `layer-*` stacking utilities |
234
234
  | Value controls | `NumberField`, `Slider`, `ColorField`, `SecretField` | Set a number or colour precisely, inside `Field`. `NumberField` and `Slider` are React Aria's; the number field runs with `commitBehavior="validate"`, so a typed value outside `min`/`max` is kept on screen, explained in the `Field` ("Enter a value from 0% to 500%.") and never passed to `onChange`. A value that is not known is `null` and shows an en dash, never 0 or NaN. Digits and decimal mark follow `locale`. The unit sits inside the control, and in the slider's spoken value when `Intl` has it (%, °, ms, s, kB, MB, GB, kbps, Mbps). Arrows step, Home/End jump to the limits; `Slider editable` adds a number field. `ColorField`: platform picker, typed hex that is normalised, app suggestions, and a contrast note against `against`. No motion on value changes. `NumberField` options for a value set a little at a time or that costs work to change: `nudge={[0.1, 1, 10]}` (a toolbar of named step buttons that repeat when held and stop at the limits), `suggestion={{ value, label, reason }}` (a row with the reason in words and Use this value, never applied by itself) and `preview` (changes wait behind Apply and Revert; `onChange` is Apply's). `SecretField` is a credential the server keeps and never shows again: not set, set (no characters, no length, no input in the DOM), a masked entry with a Show toggle named for what it reveals, `onSave` through `AsyncButton`, Replace, a confirmed Remove that says what stops working, and a Test whose result is text beside it; a set, untouched field reports nothing |
235
235
  | Notices and progress | `Alert`, `toast`, `StrataToastRegion`, `useClientWork`, `JobStatus` | Three weights. A `toast` confirms finished work and goes by itself (5 s plus 40 ms a character, 8 s minimum with an action, paused under the pointer or focus, always dismissable); it has no danger tone, because an error a person must act on is an inline `Alert` with its recovery as `action` (`announce` makes it `role="alert"` only when it answers something the person just did). `StrataToastRegion` goes once at the app root. `useClientWork` runs browser work with progress, cancel (aborts its `signal`, ends `cancelled`, never `failed`) and a double-start guard; `JobStatus` shows it exactly as it shows a server job, with `onCancel`, `cancelled` and `onDismiss` |
236
- | Media player | `MediaPlayer`, `useMediaElement`, `SPEECH_RATES`, `useMediaSpans`, `SpanActions`, `PlayerNotice`, `SpanStrip`, `MediaContents` | Play a file or a sequence of chapters without the event glue: `marks` puts one file's own chapters (and `kind: "scene"` scenes, shorter) on the seek bar, each named in a tooltip and pressed to jump; the skip buttons beside Play step by scene (small) and chapter (large), or by 10 s and 1 min where a file has none (`skip`, `skipAction`); `fps` adds frame steps (`,` and `.`); `float` keeps a playing video in a corner box once the player has scrolled off the screen; and `MediaContents` lists them beside the player (the playing one marked, pressing one plays from its start, never scrolling the page); the element, its state, Strata's controls (or the browser's own on a touch device, `controls="auto"`), a load error with Try again, `navigator.mediaSession` metadata, the seek bar spanning the whole sequence. `useMediaElement(ref)` alone follows an element drawn with the browser's controls `spans` and `spanKinds` mark stretches (an intro, a recap, a sponsor read) on the seek bar as named ranges in a status role's tone and act on them as playback reaches them: `auto` skips (or mutes, for `action: "mute"`) with "Skipped intro" and Undo, `ask` offers a Skip button over the picture and on the `s` key, `off` only draws; each is acted on once, `onSpan` reports `skipped`, `muted`, `undone` or `played`, and `SeekBar` takes `spans` too. `mediaRef` hands out the player's state and requests (an object ref holds the latest, no render of its own), `overlay` draws the app's own thing over the picture only, `heading` (title, subtitle, avatar, each a link, with the app's router `state`) is drawn across the top of a video while paused or the pointer moves, and a video keeps a 16:9 (or `aspect`) box before its metadata loads. `gain` plays the sound at a factor through Web Audio (an app's loudness normalisation: 100% is the level the app chose; a change glides there) and `boost` lets the volume past 100% behind a Louder toggle (`VolumeControl boost`), both with a limiter at -1 dBFS; the element is routed only once its audio context runs, so a context the page may not start costs the gain, never the sound. A video has a Full screen button and the `f` key by default (`fullscreen={false}` removes them); on the picture a click plays or pauses, a double click toggles full screen and the wheel sets the volume while the player has focus. A kind's `colour` names a custom property of the app's theme (`"--seg-sponsor"`) instead of a tone, each range carries `data-kind`, and under the browser's own controls a `SpanStrip` under the picture draws the ranges. `start` begins a first load at a time (an attacher's `startAt`, or a seek once the metadata is in) and says "Picked up at 2:05" with Start over (`resumeWords`); `onProgress` reports the position and the seconds actually played through, each once, a skipped span counted (`useMediaElement` takes it too, with `markWatched`). The HLS attacher starts a `growing` source at its beginning, honours `config.startPosition` and takes `words` for its failures. |
236
+ | Media player | `MediaPlayer`, `useMediaElement`, `SPEECH_RATES`, `useMediaSpans`, `SpanActions`, `PlayerNotice`, `SpanStrip`, `MediaContents` | Play a file or a sequence of chapters without the event glue: `marks` puts one file's own chapters (and `kind: "scene"` scenes, shorter) on the seek bar, each named in a tooltip and pressed to jump; the skip buttons beside Play step by scene (small) and chapter (large), or by 10 s and 1 min where a file has none (`skip`, `skipAction`); `fps` adds frame steps (`,` and `.`); `float` keeps a playing video in a corner box once the player has scrolled off the screen; and `MediaContents` lists them beside the player (the playing one marked, pressing one plays from its start, never scrolling the page); the element, its state, Strata's controls (or the browser's own on a touch device, `controls="auto"`), a load error with Try again, `navigator.mediaSession` metadata, the seek bar spanning the whole sequence. `useMediaElement(ref)` alone follows an element drawn with the browser's controls `spans` and `spanKinds` mark stretches (an intro, a recap, a sponsor read) on the seek bar as named ranges in a status role's tone and act on them as playback reaches them: `auto` skips (or mutes, for `action: "mute"`) with "Skipped intro" and Undo, `ask` offers a Skip button over the picture and on the `s` key, `off` only draws; each is acted on once, `onSpan` reports `skipped`, `muted`, `undone` or `played`, and `SeekBar` takes `spans` too. `mediaRef` hands out the player's state and requests (an object ref holds the latest, no render of its own), `overlay` draws the app's own thing over the picture only, `heading` (title, subtitle, avatar, each a link, with the app's router `state`) is drawn across the top of a video while paused or the pointer moves, and a video keeps a 16:9 (or `aspect`) box before its metadata loads. `gain` plays the sound at a factor through Web Audio (an app's loudness normalisation: 100% is the level the app chose; a change glides there) and `boost` lets the volume past 100% behind a Louder toggle (`VolumeControl boost`), both with a limiter at -1 dBFS; the element is routed only once its audio context runs, so a context the page may not start costs the gain, never the sound. A video has a Full screen button and the `f` key by default (`fullscreen={false}` removes them); on the picture a click plays or pauses, a double click toggles full screen and the wheel sets the volume while the player has focus. A kind's `colour` names a custom property of the app's theme (`"--seg-sponsor"`) instead of a tone, each range carries `data-kind`, and under the browser's own controls a `SpanStrip` under the picture draws the ranges. `start` begins a first load at a time (an attacher's `startAt`, or a seek once the metadata is in) and says "Picked up at 2:05" with Start over (`resumeWords`); `onProgress` reports the position and the seconds actually played through, each once, a skipped span counted (`useMediaElement` takes it too, with `markWatched`). The HLS attacher starts a `growing` source at its beginning, honours `config.startPosition` and takes `words` for its failures. `stats` shows playback stats over a video while the heading shows (resolution, the size drawn, frame rate, dropped frames, codecs, bitrate, connection, buffer, bytes fetched, the `gain` in dB), measured by `useMediaStats` and reported by a stream engine through `StreamContext.onStats` (the HLS attacher does), then the app's own lines (`MediaStat[]`). |
237
237
  | Edit lists | `EditListPlayer`, `useEditList`; `editTimes`, `locateInEdit`, `editTimeOf`, `continues`, `nextBreak` | An edit (clips that are stretches `[start, end)` of files) played as one timeline before it is rendered: two stacked `<video>` elements, the one behind already loaded and sought to the next clip that does not carry straight on, so a cut shows no gap; clips of one file that follow on play through; the cut is timed from the browser's frame callbacks (a refresh early by the frame loop where there are none); a seek bar marked at every clip, Previous and Next clip (P and N), frame steps with `fps` (`,` and `.`), a new edit (another revision) stays in the clip being watched, and the empty state is a required prop |
238
238
  | Media playback | `useTimeline`, `TimelinePlayer`, `Transport`, `SeekBar`, `TimeReadout`, `VolumeControl`, `RateChoice`, `MediaStage`, `StageGuides`, `transportShortcuts`, `format.timecode` | The controls around anything that plays, wired to a player the app owns (HTML media, Web Audio, a canvas, a data replay). Every control is a named icon button in one toolbar; the play button's name is "Play" or "Pause". `SeekBar` has the formatted time as its accessible value, arrows step 5 s and Page keys 30 s by default, and optional marks. `VolumeControl` shows its percent, and muting remembers the level. `transportShortcuts` is the one list for `useHotkeys` and `KeysLegend` (Space and K, J and L, the arrows by a frame, Home and End). `format.timecode` prints m:ss, m:ss.mmm or m:ss:ff. `MediaStage` fits a picture of any aspect ratio into the pane with a letterbox on the sunken surface role, and takes overlays such as `StageGuides` `useTimeline` is the same state for a clock the app owns (a recorded run, a replay, an animation): rAF at `rate`, loops or stops, play at the end restarts, a seek pauses, `step` by `frame`, `startAt`, joins a `MediaGroup` and the key-owner rule, so `Transport`, `SeekBar` and `transportShortcuts` plug in; `TimelinePlayer` puts a stage (a `SceneViewport` given `time`) over the same control bar, with the stage keeping the arrow keys. |
239
239
  | Listening and reading | `Waveform`, `TranscriptView`, `PlayWindowButton`, `MediaGroup`, `FilmStrip`; `resamplePeaks`, `peaksFromAudio`, `peakGain`, `phraseAt`, `wordAt`, `pickEvenly`, `frameAt` | Timed media: a waveform from peaks or a decoded file (one slider, marks by line style, named spans, zoom, a keyboard-made range, a spectrogram underlay, `normalise` to draw quiet sound to fill the height and say by how much); `FilmStrip` is a row of frames from a stretch of video that fits its width (picked evenly), each with its time, pressing one seeks (`onSeek`, one tab stop with arrow keys), and the frame at `time` inside `span` is ringed; timed text that marks the heard word and plays from any word (modes, speakers, follow and Jump to now, virtualised), with doubtful words (dotted, named, counted, "Only doubtful"), a mark per phrase set from a row menu (`states`, `onPhraseState`), correction in place (Enter or F2, `onEdit`) and a hover and focus card (`renderCard`); `MediaPlayer window` plays one stretch of a file, `MediaGroup` lets one player play at a time, `PlayWindowButton` is a row's play control on a shared element; a review transcript needs no player (`time` and `onSeek` are optional), takes `marking` (words become `MarkableText` marks with ids `wordId(phraseId, index)`, selected across rows that are not mounted) and shows a corrected word (`word.correction`) dotted with the original on hover and `onCorrectionPress` to open it |
@@ -199,6 +199,16 @@ function createFormat(locale, options = {}) {
199
199
  return withUnit(scaled, chosen, Math.abs(scaled) < 10 && chosen !== "B" ? decimal : integer);
200
200
  },
201
201
  /**
202
+ * A rate in bits per second, in the largest decimal unit it reaches, as networks and video
203
+ * are measured: "850 kb/s", "4.2 Mb/s", "35 Mb/s", "1.2 Gb/s" (one decimal below 10).
204
+ */
205
+ bitrate: (bitsPerSecond) => {
206
+ if (bitsPerSecond == null || !Number.isFinite(bitsPerSecond) || bitsPerSecond < 0) return missing;
207
+ const [scale, unit] = bitsPerSecond >= 1e9 ? [1e9, "Gb/s"] : bitsPerSecond >= 1e6 ? [1e6, "Mb/s"] : bitsPerSecond >= 1e3 ? [1e3, "kb/s"] : [1, "b/s"];
208
+ const scaled = bitsPerSecond / scale;
209
+ return withUnit(scaled, unit, scaled < 10 && scale > 1 ? decimal : integer);
210
+ },
211
+ /**
202
212
  * A length of time in words, the unit chosen by size: "45 s", "16 min", "3.5 h", "2 days". Unknown
203
213
  * (null, negative, not finite) prints the placeholder. `style: "parts"` is an uptime, the two
204
214
  * largest units written out: "1d 1h 0m", "2h 5m", "5m 3s". Not `runningTime`, which is a media clock.
@@ -493,4 +503,4 @@ function ChoiceGroupView({ legend, name, choices, value, onChange, error }) {
493
503
  }
494
504
 
495
505
  export { Textarea as a, useSearchParam as c, createFormat as d, format as f, NativeSelect as i, MISSING as l, Field as n, useFieldControl as o, toDate as p, Input$1 as r, controlHeight as s, ChoiceGroup as t, NBSP as u };
496
- //# sourceMappingURL=field-DBCsFIng.js.map
506
+ //# sourceMappingURL=field-BY42OY3g.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-BY42OY3g.js","names":["Input"],"sources":["../src/lib/format.ts","../src/lib/search-param.ts","../src/lib/control.ts","../src/components/field.tsx"],"sourcesContent":["// Every number and date on screen goes through Intl, once, here. Units are joined with a\n// non-breaking space so \"212 °C\" never wraps between figure and unit. A product that is not\n// en-GB calls createFormat with its locale once and exports the result from its own lib.\n//\n// The number formatters are callable (`format.integer(n)`) because that is the form people reach\n// for (strata-react issue #12), and they keep Intl's methods (`format.integer.format(n)`,\n// `formatToParts`, `resolvedOptions`) so existing calls and Intl knowledge still work.\n//\n// Dates follow the same shape. Every date formatter is callable with a Date, an ISO string or\n// epoch milliseconds (`format.dateTime(row.at)`), because rows arrive from an API as ISO strings\n// and an app that has to wrap each one in `new Date(...)` soon builds its own Intl.DateTimeFormat\n// beside it instead (strata-react issue #31, from the Bright Horizons History screen). An invalid\n// date throws a RangeError naming the input rather than printing \"Invalid Date\" into a row.\n// `date` and `dateTime` use Intl's medium/short styles, so the locale decides the order\n// (\"8 Nov 2026, 06:05\" in en-GB, \"Nov 8, 2026, 6:05 AM\" in en-US) and nobody hand-writes a\n// pattern. `timeZone` is optional: left out, times are the viewer's; a product that shows a place's\n// times (a kiln in one room, a shop's opening hours) passes that place's zone once.\n//\n// Tests: the non-breaking space is a real character in the DOM. Testing Library's text matchers\n// (`getByText`, `toHaveTextContent`) collapse whitespace and match \"6 pieces\", but accessible-name\n// matching (`getByRole(\"heading\", { name: \"6 pieces\" })`) compares the name exactly and does not.\n// Build the expected string with the same formatter (`{ name: format.count(6, \"piece\") }`), or\n// use a regex with `\\s` (`/6\\spieces/`), which matches U+00A0.\n//\n// A value that is not known (`null` or `undefined`: a count the source does not give, a date for\n// something never synced) prints as the placeholder, an en dash unless `createFormat`'s `missing`\n// says otherwise, from every number and date formatter (strata-react issue #47). Each screen used\n// to pick its own (\"–\", \"Never\", blank), so tables and cards disagreed. An invalid date still\n// throws: that is a bug, not a missing value.\n//\n// Three formatters came from the Tubes viewer, which wrote its own (strata-react issue #52): `ago`\n// (\"3 weeks ago\", from Intl.RelativeTimeFormat, with `now` passed in by tests), `compact` (\"1.2k\"\n// in en-GB, and `count`'s `{ compact: true }` for \"1.2k views\") and `runningTime` (\"4:05\", \"1:02:09\"), the\n// m:ss of a media player, which Intl.DurationFormat's long form is not. `share` is `percent` for a\n// part of a whole (strata-react issue #43): a part that is there never prints as \"0%\", nor a part\n// short of the whole as \"100%\".\n//\n// Four more came from a status page (strata-react issue #341, jburnhams/homepage), each written by\n// hand there because `format` had no equivalent: `bytes` in binary units (`{ binary: true }`:\n// memory is read in KiB, MiB, GiB, and `free -h` shows them, so a decimal GB reads 7% high);\n// `duration` (\"16 min\", \"3.5 h\", \"2 days\" to say how long, or `style: \"parts\"` for an uptime,\n// \"1d 1h 0m\"), which `runningTime`'s clock cannot say; `measure` (a reading and its unit, \"12.3 GB\",\n// \"41%\"); and `agoTick` (\"now\", \"−30 s\", \"−2 min\") for the axis of a history chart.\n\nexport const NBSP = \" \";\n\n/** The placeholder printed for a value that is not known: an en dash. */\nexport const MISSING = \"–\";\n\n/** The decimal byte units `format.bytes` writes. */\nexport type ByteUnit = \"B\" | \"kB\" | \"MB\" | \"GB\" | \"TB\" | \"PB\";\nconst BYTE_UNITS: readonly ByteUnit[] = [\"B\", \"kB\", \"MB\", \"GB\", \"TB\", \"PB\"];\nconst BYTE_SIZE = Object.fromEntries(BYTE_UNITS.map((u, i) => [u, 1000 ** i])) as Record<ByteUnit, number>;\n\n/** The binary byte units `format.bytes` writes with `{ binary: true }`. */\nexport type BinaryByteUnit = \"B\" | \"KiB\" | \"MiB\" | \"GiB\" | \"TiB\" | \"PiB\";\nconst BINARY_UNITS: readonly BinaryByteUnit[] = [\"B\", \"KiB\", \"MiB\", \"GiB\", \"TiB\", \"PiB\"];\nconst BINARY_SIZE = Object.fromEntries(BINARY_UNITS.map((u, i) => [u, 1024 ** i])) as Record<BinaryByteUnit, number>;\nconst SIZE: Record<ByteUnit | BinaryByteUnit, number> = { ...BYTE_SIZE, ...BINARY_SIZE };\n\n/** What `format.bytes` and `format.byteUnit` take beyond the value: `{ binary: true }` for KiB, MiB, GiB (powers of 1024), or a unit to fix. A binary unit implies binary. */\nexport type BytesOptions = { binary?: boolean; unit?: ByteUnit | BinaryByteUnit };\n\nfunction chooseByteUnit(value: number, binary: boolean): ByteUnit | BinaryByteUnit {\n const units: readonly (ByteUnit | BinaryByteUnit)[] = binary ? BINARY_UNITS : BYTE_UNITS;\n return [...units].reverse().find((u) => Math.abs(value) >= SIZE[u]) ?? \"B\";\n}\n\n/** An `Intl.NumberFormat` that can also be called directly: `f(n)` is `f.format(n)`. `null` or `undefined` prints the placeholder. */\nexport type NumberFormatter = ((value: number | bigint | Intl.StringNumericLiteral | null | undefined) => string) & {\n format: (value: number | bigint | Intl.StringNumericLiteral | null | undefined) => string;\n} & Pick<Intl.NumberFormat, \"formatToParts\" | \"resolvedOptions\">;\n\n/** What a date formatter accepts: a Date, an ISO 8601 string, or epoch milliseconds. */\nexport type DateInput = Date | string | number;\n\n/** An `Intl.DateTimeFormat` that can also be called directly, with a Date, an ISO string or epoch milliseconds. */\nexport type DateFormatter = ((value: DateInput | null | undefined) => string) & {\n format: (value: DateInput | null | undefined) => string;\n formatToParts: (value: DateInput) => Intl.DateTimeFormatPart[];\n formatRange: (start: DateInput, end: DateInput) => string;\n} & Pick<Intl.DateTimeFormat, \"resolvedOptions\">;\n\n/** Options shared by every date formatter one `createFormat` call makes. */\nexport interface FormatOptions {\n /** An IANA zone (\"Europe/London\", \"UTC\") to show times in. Left out, times are the viewer's own. */\n timeZone?: string;\n /** What a missing value (`null`, `undefined`) prints as. Default an en dash (`MISSING`). */\n missing?: string;\n}\n\n/** Options for `format.count`. */\nexport interface CountOptions {\n /** Write the figure compactly: \"1.2k views\". The noun still agrees with the exact count. */\n compact?: boolean;\n}\n\n/** A Date from a Date, an ISO string or epoch milliseconds; throws a RangeError naming the input when it is not a date. */\nexport function toDate(value: DateInput): Date {\n const date = value instanceof Date ? value : new Date(value);\n if (Number.isNaN(date.getTime())) throw new RangeError(`Not a date: ${JSON.stringify(String(value))}`);\n return date;\n}\n\nfunction callableDate(df: Intl.DateTimeFormat, missing: string): DateFormatter {\n const format = (value: DateInput | null | undefined) => (value == null ? missing : df.format(toDate(value)));\n return Object.assign(format, {\n format,\n formatToParts: (value: DateInput) => df.formatToParts(toDate(value)),\n formatRange: (start: DateInput, end: DateInput) => df.formatRange(toDate(start), toDate(end)),\n resolvedOptions: () => df.resolvedOptions(),\n });\n}\n\nfunction callable(nf: Intl.NumberFormat, missing: string): NumberFormatter {\n const format = (value: number | bigint | Intl.StringNumericLiteral | null | undefined) =>\n value == null ? missing : nf.format(value);\n return Object.assign(format, {\n format,\n formatToParts: (value: number | bigint) => nf.formatToParts(value),\n resolvedOptions: () => nf.resolvedOptions(),\n });\n}\n\n// Largest first: `ago` says a span in the largest unit it fills at least once, rounded down, so\n// 13 days is \"last week\" and 20 days \"2 weeks ago\", never \"3 weeks\" too early.\nconst DAY = 86_400_000;\nconst AGO_STEPS: readonly [Intl.RelativeTimeFormatUnit, number][] = [\n [\"year\", 365 * DAY],\n [\"month\", 30 * DAY],\n [\"week\", 7 * DAY],\n [\"day\", DAY],\n [\"hour\", 3_600_000],\n [\"minute\", 60_000],\n];\n\n/** Intl formatters for one locale (and optionally one time zone): integers, decimals, percent, dates, times, units with a non-breaking space, byte sizes, and counted nouns. */\nexport function createFormat(locale: string, options: FormatOptions = {}) {\n const { timeZone, missing = MISSING } = options;\n const dates = (opts: Intl.DateTimeFormatOptions) =>\n callableDate(new Intl.DateTimeFormat(locale, { ...opts, timeZone }), missing);\n const integer = callable(new Intl.NumberFormat(locale, { maximumFractionDigits: 0 }), missing);\n const decimal = callable(new Intl.NumberFormat(locale, { maximumFractionDigits: 1 }), missing);\n const percent = callable(new Intl.NumberFormat(locale, { style: \"percent\", maximumFractionDigits: 0 }), missing);\n const compact = callable(new Intl.NumberFormat(locale, { notation: \"compact\", maximumFractionDigits: 1 }), missing);\n const relative = new Intl.RelativeTimeFormat(locale, { numeric: \"auto\" });\n const plurals = new Intl.PluralRules(locale);\n const clock = dates({ hour: \"2-digit\", minute: \"2-digit\" });\n const day = dates({ weekday: \"long\", day: \"numeric\", month: \"long\" });\n const shortDay = dates({ weekday: \"short\", hour: \"2-digit\", minute: \"2-digit\" });\n const date = dates({ dateStyle: \"medium\" });\n const dateTime = dates({ dateStyle: \"medium\", timeStyle: \"short\" });\n const withUnit = (value: number, unit: string, fmt: Pick<Intl.NumberFormat, \"format\"> = integer) =>\n `${fmt.format(value)}${NBSP}${unit}`;\n return {\n locale,\n /** The zone times are shown in, or `undefined` for the viewer's own. */\n timeZone,\n /** Whole numbers with grouping: `format.integer(1222)` is \"1,222\". */\n integer,\n /** One decimal place at most: `format.decimal(3.14)` is \"3.1\". */\n decimal,\n /** A ratio as a whole percent: `format.percent(0.42)` is \"42%\". */\n percent,\n /**\n * A part's share of a whole, as `percent` but never misleading at the ends: a part above 0 that\n * rounds to 0 is \"<1%\", and one short of the whole that rounds to 100 is \">99%\".\n * `format.share(2.4 / 512)` is \"<1%\".\n */\n share: (value: number | null | undefined) => {\n if (value == null || Number.isNaN(value)) return missing;\n if (value > 0 && value < 0.005) return `<${percent.format(0.01)}`;\n if (value >= 0.995 && value < 1) return `>${percent.format(0.99)}`;\n return percent.format(value);\n },\n /** A figure in short form for counts that run to thousands: `format.compact(1234)` is \"1.2k\" in en-GB, \"1.2K\" in en-US. */\n compact,\n /**\n * How long ago (or how far ahead) a time is, in the largest unit it reaches:\n * \"3 weeks ago\", \"yesterday\", \"in 2 hours\", \"now\" under a minute. Pass `now` in tests.\n */\n ago: (value: DateInput | null | undefined, now: DateInput = new Date()) => {\n if (value == null) return missing;\n const diff = toDate(value).getTime() - toDate(now).getTime();\n const span = Math.abs(diff);\n for (const [unit, size] of AGO_STEPS) {\n if (span >= size) return relative.format(Math.sign(diff) * Math.floor(span / size), unit);\n }\n return relative.format(0, \"second\");\n },\n /**\n * A media running time from seconds, as a player shows it: \"4:05\", \"1:02:09\". Unknown\n * (null, negative, not finite) prints the placeholder. Set it in `tabular-nums`.\n */\n runningTime: (seconds: number | null | undefined) => {\n if (seconds == null || !Number.isFinite(seconds) || seconds < 0) return missing;\n const s = Math.floor(seconds);\n const two = (n: number) => String(n).padStart(2, \"0\");\n const [h, m] = [Math.floor(s / 3600), Math.floor((s % 3600) / 60)];\n return h > 0 ? `${h}:${two(m)}:${two(s % 60)}` : `${m}:${two(s % 60)}`;\n },\n /**\n * A position in media as an editor shows it, to a chosen precision: \"4:05\" (seconds), \"4:05.250\"\n * (`\"ms\"`), or \"0:04:05:07\" (`\"frames\"` at `fps`, the last part the frame). Hours appear only\n * from one hour, except in frames. Frames are always four parts, hours included, as SMPTE\n * timecode is (non-drop frame, with colons): a three-part \"1:05:00\" reads as one hour five, so\n * a frame count must never be three. Editors write the same four parts (strata-react issue\n * #122). Floors, never rounds up, so a time never reads ahead of the picture. Unknown (null,\n * negative, not finite) prints the placeholder. Set it in `tabular-nums`.\n */\n timecode: (\n seconds: number | null | undefined,\n { precision = \"seconds\", fps = 30 }: { precision?: \"seconds\" | \"ms\" | \"frames\"; fps?: number } = {},\n ) => {\n if (seconds == null || !Number.isFinite(seconds) || seconds < 0) return missing;\n const whole = Math.floor(seconds);\n const two = (n: number) => String(n).padStart(2, \"0\");\n const [h, m] = [Math.floor(whole / 3600), Math.floor((whole % 3600) / 60)];\n const base = h > 0 ? `${h}:${two(m)}:${two(whole % 60)}` : `${m}:${two(whole % 60)}`;\n if (precision === \"ms\")\n return `${base}.${String(Math.min(Math.floor((seconds - whole) * 1000 + 1e-6), 999)).padStart(3, \"0\")}`;\n if (precision === \"frames\")\n return `${h}:${two(m)}:${two(whole % 60)}:${two(Math.min(Math.floor((seconds - whole) * fps + 1e-6), Math.ceil(fps) - 1))}`;\n return base;\n },\n /** What a missing value prints as: an en dash unless `createFormat`'s `missing` says otherwise. */\n missing,\n /** A time of day: `format.clock(at)` is \"06:05\". */\n clock,\n /** A day without its year, for this week's things: `format.day(at)` is \"Sunday 8 November\". */\n day,\n /** A weekday and time, for chart axes and recent rows: `format.shortDay(at)` is \"Sun 06:05\". */\n shortDay,\n /** A date with its year, for a record or a deadline: `format.date(at)` is \"8 Nov 2026\". */\n date,\n /** A date and time, for a log or history row: `format.dateTime(at)` is \"8 Nov 2026, 06:05\". */\n dateTime,\n /** A figure and its unit joined by a non-breaking space (`NBSP`), so they never wrap apart. */\n withUnit,\n /** A temperature in °C, joined by a non-breaking space. */\n celsius: (value: number) => withUnit(value, \"°C\"),\n /**\n * A size in bytes in the largest decimal unit it reaches (kB, MB, GB, TB, as disks and\n * networks are sold): one decimal below 10 (\"5.2 GB\"), whole above (\"431 GB\"). Pass `unit`\n * to fix the unit, so figures compared side by side (\"431 of 466 GB\") share one. Memory is\n * read in binary units: `{ binary: true }` writes KiB, MiB, GiB (\"7.6 GiB\"), and a binary\n * unit (\"GiB\") picks that too. The second argument is a unit or `{ binary, unit }`.\n */\n bytes: (value: number, unitOrOptions?: ByteUnit | BinaryByteUnit | BytesOptions) => {\n const { binary = false, unit } =\n typeof unitOrOptions === \"string\" ? { unit: unitOrOptions } : (unitOrOptions ?? {});\n const chosen = unit ?? chooseByteUnit(value, binary);\n const scaled = value / SIZE[chosen];\n return withUnit(scaled, chosen, Math.abs(scaled) < 10 && chosen !== \"B\" ? decimal : integer);\n },\n /**\n * A rate in bits per second, in the largest decimal unit it reaches, as networks and video\n * are measured: \"850 kb/s\", \"4.2 Mb/s\", \"35 Mb/s\", \"1.2 Gb/s\" (one decimal below 10).\n */\n bitrate: (bitsPerSecond: number | null | undefined) => {\n if (bitsPerSecond == null || !Number.isFinite(bitsPerSecond) || bitsPerSecond < 0) return missing;\n const [scale, unit] =\n bitsPerSecond >= 1e9\n ? [1e9, \"Gb/s\"]\n : bitsPerSecond >= 1e6\n ? [1e6, \"Mb/s\"]\n : bitsPerSecond >= 1e3\n ? [1e3, \"kb/s\"]\n : [1, \"b/s\"];\n const scaled = bitsPerSecond / scale;\n return withUnit(scaled, unit, scaled < 10 && scale > 1 ? decimal : integer);\n },\n /**\n * A length of time in words, the unit chosen by size: \"45 s\", \"16 min\", \"3.5 h\", \"2 days\". Unknown\n * (null, negative, not finite) prints the placeholder. `style: \"parts\"` is an uptime, the two\n * largest units written out: \"1d 1h 0m\", \"2h 5m\", \"5m 3s\". Not `runningTime`, which is a media clock.\n */\n duration: (seconds: number | null | undefined, { style = \"approx\" }: { style?: \"approx\" | \"parts\" } = {}) => {\n if (seconds == null || !Number.isFinite(seconds) || seconds < 0) return missing;\n if (style === \"parts\") {\n const s = Math.floor(seconds);\n const [d, h, m] = [Math.floor(s / 86400), Math.floor((s % 86400) / 3600), Math.floor((s % 3600) / 60)];\n if (d > 0) return `${d}d${NBSP}${h}h${NBSP}${m}m`;\n if (h > 0) return `${h}h${NBSP}${m}m`;\n if (m > 0) return `${m}m${NBSP}${s % 60}s`;\n return `${s}s`;\n }\n if (seconds < 60) return withUnit(Math.floor(seconds), \"s\");\n if (seconds < 3600) return withUnit(Math.floor(seconds / 60), \"min\");\n if (seconds < 86400) return withUnit(seconds / 3600, \"h\", decimal);\n const days = seconds / 86400;\n return withUnit(days, plurals.select(Math.round(days * 10) / 10) === \"one\" ? \"day\" : \"days\", decimal);\n },\n /**\n * A reading and its unit: `format.measure(12.34, \"GB\")` is \"12.3 GB\" (one decimal at most, a\n * non-breaking space). `\"%\"` takes the figure as percent points and goes through `percent`, so\n * the locale decides the spacing: `format.measure(41, \"%\")` is \"41%\". Unknown prints the placeholder.\n */\n measure: (value: number | null | undefined, unit: string) =>\n value == null ? missing : unit === \"%\" ? percent.format(value / 100) : withUnit(value, unit, decimal),\n /**\n * A tick for the axis of a chart of the past, from seconds before now: \"now\", \"−30 s\", \"−2 min\",\n * \"−6 h\", \"−3 d\" (a true minus sign). Pass it as `LineChart`'s `formatX` after turning x into seconds ago.\n */\n agoTick: (secondsAgo: number | null | undefined) => {\n if (secondsAgo == null || !Number.isFinite(secondsAgo)) return missing;\n const s = Math.abs(secondsAgo);\n if (s < 1) return \"now\";\n const [n, unit] = s < 60 ? [s, \"s\"] : s < 3600 ? [s / 60, \"min\"] : s < 86400 ? [s / 3600, \"h\"] : [s / 86400, \"d\"];\n return `−${integer.format(n)}${NBSP}${unit}`;\n },\n /**\n * A distance in metres as a person says it: metres under a kilometre (\"850 m\"), then\n * kilometres, one decimal below 100 (\"12.4 km\"), whole above; `\"imperial\"` is feet under a\n * tenth of a mile (\"320 ft\"), then miles (\"7.7 mi\").\n */\n distance: (metres: number, system: \"metric\" | \"imperial\" = \"metric\") => {\n if (system === \"imperial\") {\n const miles = metres / 1609.344;\n return miles < 0.1 ? withUnit(metres * 3.28084, \"ft\") : withUnit(miles, \"mi\", miles < 100 ? decimal : integer);\n }\n return Math.abs(metres) < 1000\n ? withUnit(metres, \"m\")\n : withUnit(metres / 1000, \"km\", Math.abs(metres) < 100_000 ? decimal : integer);\n },\n /** The unit `bytes` would choose for a value, to share it across a set of figures. */\n byteUnit: (value: number, { binary = false }: { binary?: boolean } = {}) => chooseByteUnit(value, binary),\n /**\n * \"1 piece\", \"6 pieces\": the count and its noun, so copy never reads \"1 pieces\". They are\n * joined by a non-breaking space (`NBSP`), not a plain one: in a test, match with the same\n * call or a `\\s` regex, not a typed \"6 pieces\" string in a role's `name`.\n */\n count: (\n value: number | null | undefined,\n one: string,\n many = `${one}s`,\n { compact: short = false }: CountOptions = {},\n ) =>\n value == null\n ? missing\n : `${(short ? compact : integer).format(value)}${NBSP}${plurals.select(value) === \"one\" ? one : many}`,\n };\n}\n\nexport type Format = ReturnType<typeof createFormat>;\n\n/** The en-GB formatters. */\nexport const format = createFormat(\"en-GB\");\n","import * as React from \"react\";\nimport { useSearchParams } from \"react-router\";\n\n// \"Anything a person would link or reload into (tab, sort, filter, page, open item) is in the URL.\"\n// Tabs (`param=`), DataTable (`sortParam`) and `useExpanded({ param })` already do; a plain filter or\n// choice did not, so each app wrote the same `setParams(p => { new URLSearchParams(p) … })` (#297).\n// Rules fixed here once: the default is never written (the plain URL stays plain, as `Tabs` does),\n// a value that does not parse reads as the default (a stale or hand-edited link must not break the\n// screen), other params are kept, and a filter replaces the history entry (Back leaves the screen,\n// it does not walk through every filter change; `replace: false` for a choice worth a Back step).\n\n/** Options of `useSearchParam`. */\nexport type SearchParamOptions<T extends string> = {\n /** Read when the param is missing or invalid; setting it removes the param. */\n default: T;\n /** Says whether a raw value is allowed: a type guard (`isMode`), or a function that returns the typed value or `undefined`. */\n parse?: (raw: string) => T | boolean | undefined;\n /** Replace the history entry instead of adding one. Default `true`, since most params are filters. */\n replace?: boolean;\n};\n\n/** What `useSearchParam` returns: the value, and a setter that takes the next value or `null` for the default. */\nexport type SearchParam<T extends string> = readonly [T, (next: T | null) => void];\n\n/**\n * One value held in a URL search parameter (React Router): `const [mode, setMode] = useSearchParam(\"mode\", { default: \"all\", parse: isMode })`.\n * Reads and validates it, drops the param when set to the default or `null`, keeps the others, and replaces the history entry by default.\n */\nexport function useSearchParam<T extends string = string>(\n key: string,\n { default: fallback, parse, replace = true }: SearchParamOptions<T>,\n): SearchParam<T> {\n const [params, setParams] = useSearchParams();\n const raw = params.get(key);\n let value = fallback;\n if (raw !== null) {\n const parsed = parse ? parse(raw) : (raw as T);\n if (parsed === true) value = raw as T;\n else if (typeof parsed === \"string\") value = parsed;\n }\n const set = React.useCallback(\n (next: T | null) =>\n setParams(\n (p) => {\n const out = new URLSearchParams(p);\n if (next === null || next === fallback) out.delete(key);\n else out.set(key, next);\n return out;\n },\n { replace },\n ),\n [key, fallback, replace, setParams],\n );\n return [value, set];\n}\n","// Control sizes, one set for everything that sits in a toolbar or a property row: `default` is\n// --control-h and `sm` is --control-h-sm, so two controls of the same size name are the same height\n// in every density (issue #117). Button, IconButton, Toggle, ToggleGroup, Input, NativeSelect and\n// NumberField all take it as `size`.\n\n/** The size names a control takes: `default` (--control-h) or `sm` (--control-h-sm). */\nexport type ControlSize = \"default\" | \"sm\";\n\n/** The height class of each control size. */\nexport const controlHeight: Record<ControlSize, string> = {\n default: \"h-(--control-h)\",\n sm: \"h-(--control-h-sm)\",\n};\n","import * as React from \"react\";\nimport { CircleAlert } from \"lucide-react\";\nimport { Label, Radio, RadioGroup } from \"react-aria-components\";\nimport { cn } from \"../lib/utils\";\nimport { useSearchParam } from \"../lib/search-param\";\nimport { controlHeight, type ControlSize } from \"../lib/control\";\n\n// Field owns the wiring a generated form usually forgets: the label's htmlFor, aria-describedby\n// pointing at the hint and the error, and aria-invalid. Controls read it from context, so a control\n// inside a Field cannot end up unlabelled or silently invalid.\n//\n// A one-field form (\"paste a link, Add\", a search box, \"invite by email\") puts its button on the\n// control's row, not beside the whole field (strata-react issue #46, from the Tubes Library\n// screen): in a plain flex row the button lines up with label, hint and error together and drifts\n// off the input whenever one shows. `action` is drawn on the control's row, both at --control-h,\n// with the hint and the error under both across the full width. It wraps under the control only\n// when the row cannot keep the control 10rem wide beside it (a 250px inspector body keeps a Reset beside its slider, issue #116): on a phone a short \"Add\" stays on the\n// row, as a search box's button does, and a long label or a narrow column wraps. The error and hint stay the input's description; the\n// button is not described by them. Field messages for a form come from `useAsyncAction`'s\n// `fieldErrors` (its `validate`, or the server's 422), so no `problem` state is kept by hand.\n\ntype FieldState = {\n id: string;\n label: string;\n describedBy?: string;\n invalid: boolean;\n report: (message: string | undefined) => void;\n};\nconst FieldContext = React.createContext<FieldState | null>(null);\n\n// A control that checks what was typed (a number field, a colour field) reports its own message to\n// the Field it sits in, which draws it as the field's error, so a value outside the limits is\n// explained in the same place and way as a server's 422, with nothing for the screen to wire.\n// `error` from the screen wins over the control's own. Outside a Field `report` does nothing and\n// the control marks itself invalid without a message.\n/** @internal The surrounding Field, and where a control reports its own message. */\nexport function useFieldControl() {\n const field = React.useContext(FieldContext);\n return { field, report: field?.report ?? noReport };\n}\n\nfunction useField(id?: string) {\n const field = React.useContext(FieldContext);\n return {\n // Inside a Field the Field's id wins, so the label always points at the control. To choose the\n // id yourself, pass it to Field.\n id: field?.id ?? id,\n \"aria-describedby\": field?.describedBy,\n \"aria-invalid\": field?.invalid || undefined,\n };\n}\n\nconst noReport = () => {};\n\nexport type FieldProps = {\n label: string;\n /** The control's id, when the page needs a known one (an anchor, a test). Generated otherwise. */\n id?: string;\n /** What the person needs to know before typing, such as limits or units. */\n hint?: React.ReactNode;\n /** What went wrong and how to fix it, in one sentence. Shown under the control, never in a toast. */\n error?: string;\n /** A button on the control's row, for a one-field form (an `AsyncButton` \"Add\"). The hint and error run under both; on a narrow screen it wraps under the control. */\n action?: React.ReactNode;\n children: React.ReactNode;\n className?: string;\n};\n\n/** A labelled form field: wires the label, hint, error, `aria-describedby` and `aria-invalid` into the one control it wraps. */\nexport function Field({ label, id: idProp, hint, error, action, children, className }: FieldProps) {\n const generated = React.useId();\n const id = idProp ?? generated;\n const hintId = hint ? `${id}-hint` : undefined;\n const [reported, report] = React.useState<string>();\n const shown = error ?? reported;\n const errorId = shown ? `${id}-error` : undefined;\n const describedBy = [errorId, hintId].filter(Boolean).join(\" \") || undefined;\n\n return (\n <FieldContext.Provider value={{ id, label, describedBy, invalid: Boolean(shown), report }}>\n <div className={cn(\"grid min-w-0 content-start gap-1.5\", className)}>\n <label htmlFor={id} className=\"type-label text-foreground\">\n {label}\n </label>\n {action ? (\n <div className=\"flex flex-wrap items-start gap-2\">\n <div className=\"min-w-40 flex-1\">{children}</div>\n <div className=\"flex shrink-0 items-center\">{action}</div>\n </div>\n ) : (\n children\n )}\n {shown && (\n <p id={errorId} className=\"flex items-start gap-1.5 type-body-sm text-danger\">\n <CircleAlert aria-hidden className=\"mt-0.5 size-4 shrink-0\" />\n {shown}\n </p>\n )}\n {hint && (\n <p id={hintId} className=\"type-body-sm text-muted-foreground\">\n {hint}\n </p>\n )}\n </div>\n </FieldContext.Provider>\n );\n}\n\nconst control =\n \"w-full min-w-0 rounded-control border border-input bg-background px-3 type-body text-foreground transition-state placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:bg-muted disabled:opacity-70 aria-invalid:border-danger\";\n\n/** A text input that picks up its id and descriptions from the surrounding `Field`. `size=\"sm\"` is --control-h-sm; the native `size` (a width in characters) is not passed on. */\nexport function Input({\n className,\n id,\n size = \"default\",\n ...props\n}: Omit<React.ComponentProps<\"input\">, \"size\"> & { size?: ControlSize }) {\n return <input {...useField(id)} className={cn(control, controlHeight[size], className)} {...props} />;\n}\n\n/** A multi-line input that picks up its id and descriptions from the surrounding `Field`. */\nexport function Textarea({ className, id, ...props }: React.ComponentProps<\"textarea\">) {\n return <textarea {...useField(id)} className={cn(control, \"min-h-24 py-2\", className)} {...props} />;\n}\n\n// A native select, styled. For short option lists on a touch screen it beats a custom listbox:\n// the platform picker, typeahead and form autofill all work with no code.\n/** The platform select, styled. The default for short lists, especially on touch screens. `size=\"sm\"` is --control-h-sm. */\nexport function NativeSelect(props: NativeSelectProps) {\n // `param` is a different component so a select outside a router (no `param`) never calls router hooks.\n return props.param === undefined ? <PlainSelect {...(props as PlainSelectProps)} /> : <ParamSelect {...props} />;\n}\n\ntype PlainSelectProps = Omit<React.ComponentProps<\"select\">, \"size\"> & { size?: ControlSize };\n\n/** Props of `NativeSelect`: a native select's own, or (with `param`) a choice held in the URL. */\nexport type NativeSelectProps =\n | (PlainSelectProps & { param?: undefined; paramDefault?: undefined })\n | (Omit<PlainSelectProps, \"value\" | \"defaultValue\" | \"onChange\"> & {\n /** The search parameter that holds the choice (`?mode=…`), so it can be linked and survives a reload. */\n param: string;\n /** The option that is chosen when the URL says nothing; choosing it removes the param. */\n paramDefault: string;\n /** Called after the URL changes. */\n onChange?: (value: string) => void;\n });\n\nfunction PlainSelect({ className, id, size = \"default\", ...props }: PlainSelectProps) {\n return <select {...useField(id)} className={cn(control, controlHeight[size], \"pr-8\", className)} {...props} />;\n}\n\n/** The values of every `<option>`, looking inside `<optgroup>`s and fragments. */\nfunction optionValues(children: React.ReactNode): string[] {\n return React.Children.toArray(children).flatMap((c) => {\n if (!React.isValidElement<{ value?: string; children?: React.ReactNode }>(c)) return [];\n if (c.type === \"option\") return [c.props.value ?? String(c.props.children)];\n return optionValues(c.props.children);\n });\n}\n\nfunction ParamSelect({\n param,\n paramDefault,\n onChange,\n children,\n ...props\n}: Extract<NativeSelectProps, { param: string }>) {\n // An unknown value in the URL reads as the default: the select shows an option that exists.\n const options = optionValues(children);\n const [value, setValue] = useSearchParam(param, {\n default: paramDefault,\n parse: (raw) => options.length === 0 || options.includes(raw),\n });\n return (\n <PlainSelect\n {...props}\n value={value}\n onChange={(e) => {\n setValue(e.target.value);\n onChange?.(e.target.value);\n }}\n >\n {children}\n </PlainSelect>\n );\n}\n\n// Radio choices: React Aria's RadioGroup (a group named by its label, arrow-key movement, one tab\n// stop), and each row wraps its control so the whole row is one hit target. The dot is drawn from\n// tokens, not the platform's accent-color radio.\n/** One option of a `ChoiceGroup`: its value, its words, and optionally a decorative `leading` mark (a swatch) before the words, which a screen reader skips, so the label must say it all. */\nexport type Choice = { value: string; label: string; detail?: string; leading?: React.ReactNode };\n\n/** Radio choices in a fieldset with a legend; each whole row is the hit target. For 2 to 5 options that each need a sentence. */\nexport function ChoiceGroup(props: ChoiceGroupProps) {\n return props.param === undefined ? <ChoiceGroupView {...props} /> : <ParamChoiceGroup {...props} />;\n}\n\n/** Props of `ChoiceGroup`: the value and `onChange` are the caller's, or (with `param`) the URL's, the first choice being the default. */\nexport type ChoiceGroupProps = {\n legend: string;\n name: string;\n choices: Choice[];\n error?: string;\n} & (\n | { value: string; onChange: (value: string) => void; param?: undefined }\n | {\n /** The search parameter that holds the choice, so it can be linked and survives a reload. The first choice is the default and is not written. */\n param: string;\n value?: undefined;\n /** Called after the URL changes. */\n onChange?: (value: string) => void;\n }\n);\n\nfunction ParamChoiceGroup({ param, choices, onChange, ...props }: Extract<ChoiceGroupProps, { param: string }>) {\n const [value, setValue] = useSearchParam(param, {\n default: choices[0]?.value ?? \"\",\n parse: (raw) => choices.some((c) => c.value === raw),\n });\n return (\n <ChoiceGroupView\n {...props}\n choices={choices}\n value={value}\n onChange={(next) => {\n setValue(next);\n onChange?.(next);\n }}\n />\n );\n}\n\nfunction ChoiceGroupView({\n legend,\n name,\n choices,\n value,\n onChange,\n error,\n}: {\n legend: string;\n name: string;\n choices: Choice[];\n value: string;\n onChange: (value: string) => void;\n error?: string;\n}) {\n const errorId = React.useId();\n return (\n <RadioGroup\n name={name}\n value={value}\n onChange={onChange}\n aria-describedby={error ? errorId : undefined}\n className=\"grid gap-2\"\n >\n <Label className=\"mb-1.5 type-label text-foreground\">{legend}</Label>\n {choices.map((c) => (\n <Radio\n key={c.value}\n value={c.value}\n className=\"group flex min-h-(--control-h-sm) cursor-pointer items-start gap-3 py-1\"\n >\n <span\n aria-hidden\n className=\"mt-1 grid size-4 shrink-0 place-items-center rounded-pill border border-input bg-background transition-state group-selected:border-primary group-focus-visible:outline-2 group-focus-visible:outline-offset-2 group-focus-visible:outline-ring\"\n >\n <span className=\"size-2 rounded-pill bg-primary opacity-0 group-selected:opacity-100\" />\n </span>\n {c.leading && <span className=\"mt-0.5 shrink-0\">{c.leading}</span>}\n <span className=\"grid\">\n <span className=\"type-body\">{c.label}</span>\n {c.detail && <span className=\"type-body-sm text-muted-foreground\">{c.detail}</span>}\n </span>\n </Radio>\n ))}\n {error && (\n <p id={errorId} className=\"flex items-start gap-1.5 type-body-sm text-danger\">\n <CircleAlert aria-hidden className=\"mt-0.5 size-4 shrink-0\" />\n {error}\n </p>\n )}\n </RadioGroup>\n );\n}\n"],"mappings":";;;;;;;;AA4CA,MAAa,OAAO;;AAGpB,MAAa,UAAU;AAIvB,MAAM,aAAkC;CAAC;CAAK;CAAM;CAAM;CAAM;CAAM;AAAI;AAC1E,MAAM,YAAY,OAAO,YAAY,WAAW,KAAK,GAAG,MAAM,CAAC,GAAG,OAAQ,CAAC,CAAC,CAAC;AAI7E,MAAM,eAA0C;CAAC;CAAK;CAAO;CAAO;CAAO;CAAO;AAAK;AACvF,MAAM,cAAc,OAAO,YAAY,aAAa,KAAK,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC;AACjF,MAAM,OAAkD;CAAE,GAAG;CAAW,GAAG;AAAY;AAKvF,SAAS,eAAe,OAAe,QAA4C;CAEjF,OAAO,CAAC,GAD8C,SAAS,eAAe,UAC9D,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,MAAM,KAAK,IAAI,KAAK,KAAK,KAAK,EAAE,KAAK;AACzE;;AAgCA,SAAgB,OAAO,OAAwB;CAC7C,MAAM,OAAO,iBAAiB,OAAO,QAAQ,IAAI,KAAK,KAAK;CAC3D,IAAI,OAAO,MAAM,KAAK,QAAQ,CAAC,GAAG,MAAM,IAAI,WAAW,eAAe,KAAK,UAAU,OAAO,KAAK,CAAC,GAAG;CACrG,OAAO;AAC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,4 @@
1
- import { f as SourceAttacher } from "./media-player-Buvu2l7R.js";
1
+ import { f as SourceAttacher } from "./media-player-C6j069Aa.js";
2
2
  import Hls, { HlsConfig } from "hls.js";
3
3
  /** The parts of hls.js this entry uses, so the engine can be handed in (a test's, or an app's own build). */
4
4
  export type HlsEngine = typeof Hls;
package/dist/hls.js CHANGED
@@ -45,6 +45,39 @@ function createHlsAttacher(Engine, { prefer = "engine", config = {}, words = {}
45
45
  startPosition: at > 0 ? at : config.startPosition ?? (context.growing ? 0 : -1)
46
46
  });
47
47
  engine = hls;
48
+ const report = context.onStats;
49
+ if (report) {
50
+ let loaded = 0;
51
+ let loadedSeconds = 0;
52
+ const declared = (level) => {
53
+ const l = hls.levels[level];
54
+ if (!l) return;
55
+ report({
56
+ ...l.bitrate > 0 ? { bitrate: l.bitrate } : {},
57
+ ...l.videoCodec ? { videoCodec: l.videoCodec } : {},
58
+ ...l.audioCodec ? { audioCodec: l.audioCodec } : {}
59
+ });
60
+ };
61
+ hls.on(Engine.Events.LEVEL_SWITCHED, (_event, data) => declared(data.level));
62
+ hls.on(Engine.Events.BUFFER_CODECS, (_event, data) => {
63
+ const video = data.video?.codec ?? data.audiovideo?.codec;
64
+ const audio = data.audio?.codec;
65
+ report({
66
+ ...video ? { videoCodec: video } : {},
67
+ ...audio ? { audioCodec: audio } : {}
68
+ });
69
+ });
70
+ hls.on(Engine.Events.FRAG_LOADED, (_event, data) => {
71
+ if (data.frag.type !== "main") return;
72
+ loaded += data.frag.stats.loaded || data.payload.byteLength;
73
+ loadedSeconds += data.frag.duration;
74
+ report({
75
+ loaded,
76
+ loadedSeconds,
77
+ bandwidth: hls.bandwidthEstimate
78
+ });
79
+ });
80
+ }
48
81
  let recoveries = 0;
49
82
  hls.on(Engine.Events.FRAG_LOADED, () => {
50
83
  recoveries = 0;
package/dist/hls.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"hls.js","names":[],"sources":["../src/hls/index.ts"],"sourcesContent":["import Hls, { type HlsConfig } from \"hls.js\";\nimport type { SourceAttacher, StreamAttachment, StreamContext } from \"../components/media-player\";\n\n// The HLS entry: `import { attachHls } from \"strata-react/hls\"` (strata-react issue #179, from\n// strata-360, whose film preview is an HLS stream that starts playing after a couple of seconds and\n// keeps growing while the rest is made). `hls.js` is an optional peer that only this entry imports, as\n// `leaflet` is for the map, so an app that never plays a stream never installs it, and the main entry\n// never reaches it (the peer-contract test walks the built chunks to keep that true).\n//\n// It is a `SourceAttacher`, the one shape the main entry knows: `<MediaPlayer attach={attachHls}\n// src=\"…/film.m3u8\" />`, or `useAttachedSource(ref, src, attachHls, media.reportProblem)` beside\n// `useMediaElement` for a plain `<video>` (the panorama viewer, the compare components). It does three\n// things the engine does not do for a player:\n//\n// - **The engine wherever it can run, the element's own HLS where it cannot.** The brief was \"native\n// where the browser plays it\", but Chromium now plays HLS natively and, checked in Chromium 158 here,\n// its native pipeline failed (`DEMUXER_ERROR_COULD_NOT_PARSE`) on a growing playlist that hls.js plays,\n// which is the case this exists for. So hls.js is used wherever Media Source Extensions exist, one\n// behaviour on every browser, and the element's `src` only where they do not (older iOS). `prefer:\n// \"native\"` turns that around for an app that wants the system's own player behaviour.\n// - **Recovers what can be recovered, and says what cannot.** hls.js reports a fatal error for a\n// dropped connection or a decoder hiccup that its own `startLoad()` or `recoverMediaError()` fixes;\n// up to three of those are tried quietly (the count resets once a segment loads), and only then does\n// the player's load error appear, in words, with Try again. Try again restarts the engine at the\n// time playback had reached.\n// - **Cleans up**: the engine is destroyed when the source changes, the attacher changes or the player\n// unmounts, so a source switch never leaves two engines on one element.\n//\n// What is *growing* is the player's business (`MediaPlayer growing`), not the engine's: hls.js plays a\n// playlist with no end-list as a live one and the element reports the end of what exists as its\n// seekable range.\n//\n// Checked: hls.js has `isSupported()` (false with no Media Source Extensions), `startPosition` for a\n// restart in place, `startLoad()` and `recoverMediaError()` for the two recoverable kinds of fatal\n// error, and `Events.FRAG_LOADED` to know it is working again.\n\n/** The parts of hls.js this entry uses, so the engine can be handed in (a test's, or an app's own build). */\nexport type HlsEngine = typeof Hls;\n\nconst WORDS = {\n network: \"The connection to the stream dropped.\",\n media: \"The stream could not be decoded.\",\n other: \"The stream could not be played.\",\n unsupported: \"This browser cannot play this kind of stream.\",\n};\n\n/** The words an HLS attacher says for each way a stream fails. */\nexport type HlsWords = Partial<Record<keyof typeof WORDS, string>>;\n\n/** Options of an HLS attacher. */\nexport type HlsAttacherOptions = {\n /** Which to use where both would do: `\"engine\"` (default) is hls.js, `\"native\"` is the element's own HLS. Where only one is available that one is used. */\n prefer?: \"engine\" | \"native\";\n /** hls.js's own configuration. */\n config?: Partial<HlsConfig>;\n /** What each failure says in the product's words (the connection dropped, the stream could not be decoded, anything else, no support here). Defaults are plain English. */\n words?: HlsWords;\n};\n\n/** Makes a `SourceAttacher` around an hls.js engine: the engine where the browser has Media Source Extensions, otherwise the element's own HLS. */\nexport function createHlsAttacher(\n Engine: HlsEngine,\n { prefer = \"engine\", config = {}, words = {} }: HlsAttacherOptions = {},\n): SourceAttacher {\n const say = { ...WORDS, ...words };\n return (el: HTMLMediaElement, src: string, context: StreamContext): StreamAttachment => {\n const canNative = el.canPlayType(\"application/vnd.apple.mpegurl\") !== \"\";\n const native = canNative && (prefer === \"native\" || !Engine.isSupported());\n let engine: Hls | null = null;\n let seekOnLoad: (() => void) | null = null;\n\n const stop = () => {\n engine?.destroy();\n engine = null;\n if (seekOnLoad) el.removeEventListener(\"loadedmetadata\", seekOnLoad);\n seekOnLoad = null;\n };\n\n const start = (at: number) => {\n stop();\n if (native) {\n el.src = src;\n if (at > 0) {\n seekOnLoad = () => {\n el.currentTime = at;\n seekOnLoad = null;\n };\n el.addEventListener(\"loadedmetadata\", seekOnLoad, { once: true });\n }\n return;\n }\n if (!Engine.isSupported()) {\n context.onProblem(say.unsupported);\n return;\n }\n // Where playback had reached, else the app's own start, else the beginning of a source still being made\n // (an EVENT playlist counts as live to hls.js, which with -1 would start at the newest part), else hls.js's choice.\n const hls = new Engine({\n ...config,\n startPosition: at > 0 ? at : (config.startPosition ?? (context.growing ? 0 : -1)),\n });\n engine = hls;\n let recoveries = 0;\n hls.on(Engine.Events.FRAG_LOADED, () => {\n recoveries = 0;\n });\n hls.on(Engine.Events.ERROR, (_event, data) => {\n if (!data.fatal || engine !== hls) return;\n if (recoveries < 3 && data.type === Engine.ErrorTypes.NETWORK_ERROR) {\n recoveries++;\n hls.startLoad();\n } else if (recoveries < 3 && data.type === Engine.ErrorTypes.MEDIA_ERROR) {\n recoveries++;\n hls.recoverMediaError();\n } else {\n context.onProblem(\n data.type === Engine.ErrorTypes.NETWORK_ERROR\n ? say.network\n : data.type === Engine.ErrorTypes.MEDIA_ERROR\n ? say.media\n : say.other,\n );\n stop();\n }\n });\n hls.loadSource(src);\n hls.attachMedia(el);\n };\n\n start(context.startAt);\n return {\n detach: () => {\n stop();\n if (native) el.removeAttribute(\"src\");\n },\n reload: start,\n };\n };\n}\n\n/** HLS for `MediaPlayer attach` and `useAttachedSource`: hls.js where the browser has Media Source Extensions, the element's own HLS where it does not. */\nexport const attachHls: SourceAttacher = createHlsAttacher(Hls);\n\n/** An HLS attacher with options: `prefer: \"native\"`, or hls.js's own `config` (buffer sizes, headers). */\nexport const hlsAttacher = (options: HlsAttacherOptions): SourceAttacher => createHlsAttacher(Hls, options);\n\n/** Whether this browser can play HLS at all, natively or through hls.js. */\nexport function hlsSupported(): boolean {\n if (typeof document === \"undefined\") return false;\n return document.createElement(\"video\").canPlayType(\"application/vnd.apple.mpegurl\") !== \"\" || Hls.isSupported();\n}\n"],"mappings":";;;AAuCA,MAAM,QAAQ;CACZ,SAAS;CACT,OAAO;CACP,OAAO;CACP,aAAa;AACf;;AAgBA,SAAgB,kBACd,QACA,EAAE,SAAS,UAAU,SAAS,CAAC,GAAG,QAAQ,CAAC,MAA0B,CAAC,GACtD;CAChB,MAAM,MAAM;EAAE,GAAG;EAAO,GAAG;CAAM;CACjC,QAAQ,IAAsB,KAAa,YAA6C;EAEt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L,cAAc;IACZ,KAAK;IACL,IAAI,QAAQ,GAAG,gBAAgB,KAAK;GACtC;GACA,QAAQ;EACV;CACF;AACF;;AAGA,MAAa,YAA4B,kBAAkB,GAAG;;AAG9D,MAAa,eAAe,YAAgD,kBAAkB,KAAK,OAAO;;AAG1G,SAAgB,eAAwB;CACtC,IAAI,OAAO,aAAa,aAAa,OAAO;CAC5C,OAAO,SAAS,cAAc,OAAO,CAAC,CAAC,YAAY,+BAA+B,MAAM,MAAM,IAAI,YAAY;AAChH"}
1
+ {"version":3,"file":"hls.js","names":[],"sources":["../src/hls/index.ts"],"sourcesContent":["import Hls, { type HlsConfig } from \"hls.js\";\nimport type { SourceAttacher, StreamAttachment, StreamContext } from \"../components/media-player\";\n\n// The HLS entry: `import { attachHls } from \"strata-react/hls\"` (strata-react issue #179, from\n// strata-360, whose film preview is an HLS stream that starts playing after a couple of seconds and\n// keeps growing while the rest is made). `hls.js` is an optional peer that only this entry imports, as\n// `leaflet` is for the map, so an app that never plays a stream never installs it, and the main entry\n// never reaches it (the peer-contract test walks the built chunks to keep that true).\n//\n// It is a `SourceAttacher`, the one shape the main entry knows: `<MediaPlayer attach={attachHls}\n// src=\"…/film.m3u8\" />`, or `useAttachedSource(ref, src, attachHls, media.reportProblem)` beside\n// `useMediaElement` for a plain `<video>` (the panorama viewer, the compare components). It does three\n// things the engine does not do for a player:\n//\n// - **The engine wherever it can run, the element's own HLS where it cannot.** The brief was \"native\n// where the browser plays it\", but Chromium now plays HLS natively and, checked in Chromium 158 here,\n// its native pipeline failed (`DEMUXER_ERROR_COULD_NOT_PARSE`) on a growing playlist that hls.js plays,\n// which is the case this exists for. So hls.js is used wherever Media Source Extensions exist, one\n// behaviour on every browser, and the element's `src` only where they do not (older iOS). `prefer:\n// \"native\"` turns that around for an app that wants the system's own player behaviour.\n// - **Recovers what can be recovered, and says what cannot.** hls.js reports a fatal error for a\n// dropped connection or a decoder hiccup that its own `startLoad()` or `recoverMediaError()` fixes;\n// up to three of those are tried quietly (the count resets once a segment loads), and only then does\n// the player's load error appear, in words, with Try again. Try again restarts the engine at the\n// time playback had reached.\n// - **Cleans up**: the engine is destroyed when the source changes, the attacher changes or the player\n// unmounts, so a source switch never leaves two engines on one element.\n//\n// What is *growing* is the player's business (`MediaPlayer growing`), not the engine's: hls.js plays a\n// playlist with no end-list as a live one and the element reports the end of what exists as its\n// seekable range.\n//\n// It also says what it plays, for the player's stats panel (`StreamContext.onStats`, issue #414): the\n// codecs from `BUFFER_CODECS` (a media playlist names none; the parsed segments do), the bitrate a\n// multivariant playlist declares for the level playing, and from each main segment fetched its bytes,\n// its seconds and hls.js's estimate of the connection.\n//\n// Checked: hls.js has `isSupported()` (false with no Media Source Extensions), `startPosition` for a\n// restart in place, `startLoad()` and `recoverMediaError()` for the two recoverable kinds of fatal\n// error, and `Events.FRAG_LOADED` to know it is working again.\n\n/** The parts of hls.js this entry uses, so the engine can be handed in (a test's, or an app's own build). */\nexport type HlsEngine = typeof Hls;\n\nconst WORDS = {\n network: \"The connection to the stream dropped.\",\n media: \"The stream could not be decoded.\",\n other: \"The stream could not be played.\",\n unsupported: \"This browser cannot play this kind of stream.\",\n};\n\n/** The words an HLS attacher says for each way a stream fails. */\nexport type HlsWords = Partial<Record<keyof typeof WORDS, string>>;\n\n/** Options of an HLS attacher. */\nexport type HlsAttacherOptions = {\n /** Which to use where both would do: `\"engine\"` (default) is hls.js, `\"native\"` is the element's own HLS. Where only one is available that one is used. */\n prefer?: \"engine\" | \"native\";\n /** hls.js's own configuration. */\n config?: Partial<HlsConfig>;\n /** What each failure says in the product's words (the connection dropped, the stream could not be decoded, anything else, no support here). Defaults are plain English. */\n words?: HlsWords;\n};\n\n/** Makes a `SourceAttacher` around an hls.js engine: the engine where the browser has Media Source Extensions, otherwise the element's own HLS. */\nexport function createHlsAttacher(\n Engine: HlsEngine,\n { prefer = \"engine\", config = {}, words = {} }: HlsAttacherOptions = {},\n): SourceAttacher {\n const say = { ...WORDS, ...words };\n return (el: HTMLMediaElement, src: string, context: StreamContext): StreamAttachment => {\n const canNative = el.canPlayType(\"application/vnd.apple.mpegurl\") !== \"\";\n const native = canNative && (prefer === \"native\" || !Engine.isSupported());\n let engine: Hls | null = null;\n let seekOnLoad: (() => void) | null = null;\n\n const stop = () => {\n engine?.destroy();\n engine = null;\n if (seekOnLoad) el.removeEventListener(\"loadedmetadata\", seekOnLoad);\n seekOnLoad = null;\n };\n\n const start = (at: number) => {\n stop();\n if (native) {\n el.src = src;\n if (at > 0) {\n seekOnLoad = () => {\n el.currentTime = at;\n seekOnLoad = null;\n };\n el.addEventListener(\"loadedmetadata\", seekOnLoad, { once: true });\n }\n return;\n }\n if (!Engine.isSupported()) {\n context.onProblem(say.unsupported);\n return;\n }\n // Where playback had reached, else the app's own start, else the beginning of a source still being made\n // (an EVENT playlist counts as live to hls.js, which with -1 would start at the newest part), else hls.js's choice.\n const hls = new Engine({\n ...config,\n startPosition: at > 0 ? at : (config.startPosition ?? (context.growing ? 0 : -1)),\n });\n engine = hls;\n const report = context.onStats;\n if (report) {\n let loaded = 0;\n let loadedSeconds = 0;\n const declared = (level: number) => {\n const l = hls.levels[level];\n if (!l) return;\n report({\n ...(l.bitrate > 0 ? { bitrate: l.bitrate } : {}),\n ...(l.videoCodec ? { videoCodec: l.videoCodec } : {}),\n ...(l.audioCodec ? { audioCodec: l.audioCodec } : {}),\n });\n };\n hls.on(Engine.Events.LEVEL_SWITCHED, (_event, data) => declared(data.level));\n hls.on(Engine.Events.BUFFER_CODECS, (_event, data) => {\n const video = data.video?.codec ?? data.audiovideo?.codec;\n const audio = data.audio?.codec;\n report({ ...(video ? { videoCodec: video } : {}), ...(audio ? { audioCodec: audio } : {}) });\n });\n hls.on(Engine.Events.FRAG_LOADED, (_event, data) => {\n if (data.frag.type !== \"main\") return;\n loaded += data.frag.stats.loaded || data.payload.byteLength;\n loadedSeconds += data.frag.duration;\n report({ loaded, loadedSeconds, bandwidth: hls.bandwidthEstimate });\n });\n }\n let recoveries = 0;\n hls.on(Engine.Events.FRAG_LOADED, () => {\n recoveries = 0;\n });\n hls.on(Engine.Events.ERROR, (_event, data) => {\n if (!data.fatal || engine !== hls) return;\n if (recoveries < 3 && data.type === Engine.ErrorTypes.NETWORK_ERROR) {\n recoveries++;\n hls.startLoad();\n } else if (recoveries < 3 && data.type === Engine.ErrorTypes.MEDIA_ERROR) {\n recoveries++;\n hls.recoverMediaError();\n } else {\n context.onProblem(\n data.type === Engine.ErrorTypes.NETWORK_ERROR\n ? say.network\n : data.type === Engine.ErrorTypes.MEDIA_ERROR\n ? say.media\n : say.other,\n );\n stop();\n }\n });\n hls.loadSource(src);\n hls.attachMedia(el);\n };\n\n start(context.startAt);\n return {\n detach: () => {\n stop();\n if (native) el.removeAttribute(\"src\");\n },\n reload: start,\n };\n };\n}\n\n/** HLS for `MediaPlayer attach` and `useAttachedSource`: hls.js where the browser has Media Source Extensions, the element's own HLS where it does not. */\nexport const attachHls: SourceAttacher = createHlsAttacher(Hls);\n\n/** An HLS attacher with options: `prefer: \"native\"`, or hls.js's own `config` (buffer sizes, headers). */\nexport const hlsAttacher = (options: HlsAttacherOptions): SourceAttacher => createHlsAttacher(Hls, options);\n\n/** Whether this browser can play HLS at all, natively or through hls.js. */\nexport function hlsSupported(): boolean {\n if (typeof document === \"undefined\") return false;\n return document.createElement(\"video\").canPlayType(\"application/vnd.apple.mpegurl\") !== \"\" || Hls.isSupported();\n}\n"],"mappings":";;;AA4CA,MAAM,QAAQ;CACZ,SAAS;CACT,OAAO;CACP,OAAO;CACP,aAAa;AACf;;AAgBA,SAAgB,kBACd,QACA,EAAE,SAAS,UAAU,SAAS,CAAC,GAAG,QAAQ,CAAC,MAA0B,CAAC,GACtD;CAChB,MAAM,MAAM;EAAE,GAAG;EAAO,GAAG;CAAM;CACjC,QAAQ,IAAsB,KAAa,YAA6C;EAEtF,MAAM,SADY,GAAG,YAAY,+BAA+B,MAAM,OACzC,WAAW,YAAY,CAAC,OAAO,YAAY;EACxE,IAAI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
1
1
  import { A as AsyncActionOptions, B as RowAction, C as useColorScheme, D as DensityName, E as Density, F as useAsyncAction, H as buttonVariants, I as Button, L as ButtonProps, M as AsyncLabels, N as FieldErrors, O as DensityProps, P as Phase, R as IconButton, S as palettes, T as useSystemColorScheme, U as ControlSize, V as RowActionProps, W as IconComponent, _ as PaletteOption, a as browserMicrophone, b as colorSchemeScript, c as COLOR_SCHEME_STORAGE_KEY, d as ColorSchemeLabels, f as ColorSchemePreference, g as PaletteChoice, h as PALETTE_STORAGE_KEY, i as MicrophoneStream, j as AsyncButton, k as AsyncAction, l as ColorScheme, m as DEFAULT_PALETTE, n as MicrophoneContext, o as explainMicrophoneError, p as ColorSchemeState, r as MicrophoneError, s as useMicrophone, t as Microphone, u as ColorSchemeChoice, v as PaletteState, w as usePalette, x as paletteScript, y as ThemeProvider, z as IconButtonProps } from "./microphone-DWh4OaMH.js";
2
2
  import { n as geo, t as LatLng } from "./geo-DfKa9JtK.js";
3
- import { $ as LineChartGroupProps, A as RateChoice, B as VolumeControlProps, C as SpanBehaviour, D as useMediaSpans, E as SpanWords, F as StageGuides, G as isTypingTarget, H as HotkeysOptions, I as TimeReadout, J as ChartMark, K as keyName, L as Transport, M as SeekBarProps, N as SeekBarSpan, O as MediaStage, P as SpanStrip, Q as LineChartGroup, R as TransportProps, S as SpanActionsNotice, T as SpanOutcome, U as KeysLegend, V as transportShortcuts, W as Shortcut, X as GroupedChart, Y as ChartSpan, Z as LineChart, _ as MediaProgress, _t as skipAction, a as MediaPlayerProps, at as valueAt, b as PlayerNotice, bt as usePlayerWarnings, c as MediaSource, ct as CursorScope, d as SPEECH_RATES, dt as useSharedCursor, et as LineChartProps, f as SourceAttacher, ft as MediaMark, g as useMediaElement, gt as marksFor, h as useAttachedSource, ht as SkipSteps, i as MediaPlayer, it as logScale, j as SeekBar, k as Precision, l as MediaWindow, lt as CursorScopeProps, m as StreamContext, mt as SkipLevel, n as MediaElementState, nt as SpanTone, o as MediaProblem, ot as CursorMapping, p as StreamAttachment, pt as SkipAction, q as useHotkeys, r as MediaHeading, rt as YScale, s as MediaSession, st as CursorOwner, t as MediaElementOptions, tt as Point, u as ResumeWords, ut as SharedCursor, v as MediaSpanData, vt as PlayerWarning, w as SpanKind, x as SpanActions, y as MediaSpansState, yt as PlayerWarningEvent, z as VolumeControl } from "./media-player-Buvu2l7R.js";
3
+ import { $ as ChartMark, A as SpanOutcome, B as StageGuides, C as MediaSpanData, Ct as PlayerWarning, D as SpanActionsNotice, E as SpanActions, F as RateChoice, G as VolumeControlProps, H as Transport, I as SeekBar, J as KeysLegend, K as transportShortcuts, L as SeekBarProps, M as useMediaSpans, N as MediaStage, O as SpanBehaviour, P as Precision, Q as useHotkeys, R as SeekBarSpan, S as MediaProgress, St as skipAction, T as PlayerNotice, Tt as usePlayerWarnings, U as TransportProps, V as TimeReadout, W as VolumeControl, X as isTypingTarget, Y as Shortcut, Z as keyName, _ as MediaStat, _t as MediaMark, a as MediaPlayerProps, at as LineChartProps, b as mediaStatRows, bt as SkipSteps, c as MediaSource, ct as YScale, d as SPEECH_RATES, dt as CursorMapping, et as ChartSpan, f as SourceAttacher, ft as CursorOwner, g as useMediaElement, gt as useSharedCursor, h as useAttachedSource, ht as SharedCursor, i as MediaPlayer, it as LineChartGroupProps, j as SpanWords, k as SpanKind, l as MediaWindow, lt as logScale, m as StreamContext, mt as CursorScopeProps, n as MediaElementState, nt as LineChart, o as MediaProblem, ot as Point, p as StreamAttachment, pt as CursorScope, q as HotkeysOptions, r as MediaHeading, rt as LineChartGroup, s as MediaSession, st as SpanTone, t as MediaElementOptions, tt as GroupedChart, u as ResumeWords, ut as valueAt, v as MediaStats, vt as SkipAction, w as MediaSpansState, wt as PlayerWarningEvent, x as useMediaStats, xt as marksFor, y as StreamStats, yt as SkipLevel, z as SpanStrip } from "./media-player-C6j069Aa.js";
4
4
  import { ClassValue } from "clsx";
5
5
  import * as React from "react";
6
6
  import { DropItem } from "react-aria-components";
@@ -114,6 +114,11 @@ export declare function createFormat(locale: string, options?: FormatOptions): {
114
114
  * unit ("GiB") picks that too. The second argument is a unit or `{ binary, unit }`.
115
115
  */
116
116
  bytes: (value: number, unitOrOptions?: ByteUnit | BinaryByteUnit | BytesOptions) => string;
117
+ /**
118
+ * A rate in bits per second, in the largest decimal unit it reaches, as networks and video
119
+ * are measured: "850 kb/s", "4.2 Mb/s", "35 Mb/s", "1.2 Gb/s" (one decimal below 10).
120
+ */
121
+ bitrate: (bitsPerSecond: number | null | undefined) => string;
117
122
  /**
118
123
  * A length of time in words, the unit chosen by size: "45 s", "16 min", "3.5 h", "2 days". Unknown
119
124
  * (null, negative, not finite) prints the placeholder. `style: "parts"` is an uptime, the two
@@ -217,6 +222,11 @@ declare const format$1: {
217
222
  * unit ("GiB") picks that too. The second argument is a unit or `{ binary, unit }`.
218
223
  */
219
224
  bytes: (value: number, unitOrOptions?: ByteUnit | BinaryByteUnit | BytesOptions) => string;
225
+ /**
226
+ * A rate in bits per second, in the largest decimal unit it reaches, as networks and video
227
+ * are measured: "850 kb/s", "4.2 Mb/s", "35 Mb/s", "1.2 Gb/s" (one decimal below 10).
228
+ */
229
+ bitrate: (bitsPerSecond: number | null | undefined) => string;
220
230
  /**
221
231
  * A length of time in words, the unit chosen by size: "45 s", "16 min", "3.5 h", "2 days". Unknown
222
232
  * (null, negative, not finite) prints the placeholder. `style: "parts"` is an uptime, the two
@@ -3928,7 +3938,14 @@ type SayAgainProps = UseSpeechOptions & {
3928
3938
  className?: string;
3929
3939
  };
3930
3940
  /** An icon button that says one sentence aloud, from its recordings when given, else with the browser's voice; hidden where neither can be heard or it is muted. */
3931
- export declare function SayAgain({ text, parts, verb, className, ...options }: SayAgainProps): import("react").JSX.Element | null;
3941
+ export declare function SayAgain({ text, parts, verb, className, ...options }: SayAgainProps): React.JSX.Element | null;
3942
+ /** Props of `SayPicture`. */
3943
+ type SayPictureProps = SayAgainProps & {
3944
+ /** The picture pressed to hear `text`; the button's name is the sentence, so mark a decorative picture `aria-hidden`. */
3945
+ children: React.ReactNode;
3946
+ };
3947
+ /** A picture that says one sentence when pressed (the big speaker over a listening round), from its recordings when given; just the picture where nothing can be heard or it is muted. */
3948
+ export declare function SayPicture({ text, parts, verb, className, children, ...options }: SayPictureProps): React.JSX.Element;
3932
3949
  /** The quietest level a speech meter draws, in dBFS: below it is silence for speech. */
3933
3950
  export declare const LEVEL_FLOOR_DB = -60;
3934
3951
  /** Joins chunks of samples into one buffer, in order. */
@@ -5503,5 +5520,5 @@ export declare function rangeBetween(ids: readonly string[], a: string | null, b
5503
5520
  export declare function countMarks(marks: Readonly<Record<string, string | undefined>>, ids?: readonly string[]): Record<string, number>;
5504
5521
  /** The id `by` places from `from` in `ids`, held to the ends; the first (or last) when `from` is not set. */
5505
5522
  export declare function stepId(ids: readonly string[], from: string | null, by: number): string | null;
5506
- export { type ActiveItem, type AlertDialogProps, type AlertProps, type Api, type ApiOptions, type ApiPage, type AspectRatio, type AsyncAction, type AsyncActionOptions, AsyncButton, type AsyncLabels, type AudioMedia, type AutoRecorder, type AutoRecorderState, type AutoSave, type AutoSaveOptions, type AutoTake, type BinaryByteUnit, type BookPage, type BookUrl, type BookViewerProps, type BoxListProps, type BoxOverlayProps, type BoxSource, type BoxTone, type BoxedPictureProps, type BoxesState, Button, type ButtonLinkProps, type ButtonProps, type ByteHighlight, type ByteRange, type ByteUnit, type ByteViewProps, type BytesOptions, COLOR_SCHEME_STORAGE_KEY, type Candidate, type CellValue, type ChartMark, type ChartSpan, type CheckboxGesture, type CheckboxProps, type Choice, type ChoiceCounts, type ChoiceGridProps, type ChoiceGroupProps, type ChoiceMarks, type ChoiceSize, type ChoiceState, type Choices, type ClientWork, type Clips, type ClipsContext, type ClipsProviderProps, type ColorFieldProps, type ColorScheme, ColorSchemeChoice, type ColorSchemeLabels, type ColorSchemePreference, type ColorSchemeState, type Column, type Command, type CommandMenuProps, type CommandsOptions, type CompareAudioProps, type CompareGridProps, type CompareMode, type CompareProps, type CompareTextProps, type CompareVideoGridProps, type CompareVideoProps, type ComposerProps, type CompositionBarProps, type CompositionPart, type ConsoleLevel, type ConsoleLine, type ConsoleProps, type ContextMenuProps, type ControlSize, type ConversationImage, type ConversationProps, type ConversationTurn, type CountOptions, type CursorMapping, type CursorOwner, CursorScope, type CursorScopeProps, type CutChange, type CutLimit, type CutRoom, DEFAULT_PALETTE, type DataTableProps, type DateFormatter, type DateInput, type DecodedAudio, type Delivery, Density, type DensityName, type DensityProps, type DescribeError, type DialogProps, type Difference, type DifferenceState, type DisclosureOpenProps, type DisclosureProps, type DragData, type DragSourceProps, type DropTarget, type Easing, type EditClip, type EditListOptions, type EditListPlayerProps, type EditListSlot, type EditListState, type EditTimes, type EditableRegion, type EntityMatch, type EntityMatcher, type ErrorBody, type Expanded, type ExpandedOptions, type FailedRemoval, type FetchJsonInit, type FetchJsonOptions, type FieldErrors, type FieldProps, type FileIntake, type FileIntakeOptions, type FileOutcome, type FilmFrame, type FilmStripProps, type Folder, type FolderListing, type FolderPickerProps, type Format, type FormatOptions, type FullscreenFrameProps, type GlimpseLook, type GlimpseProps, type GlimpseWhy, type Grid, type GroupMember, type GroupedChart, type Handle, type History, type HistoryOptions, type HistoryStateOptions, type HistoryStep, type HotkeysOptions, IconButton, type IconButtonProps, type IconComponent, type ImageMedia, type Implies, type InViewOptions, type InfiniteListProps, type InfiniteLoad, type InfiniteLoadOptions, type InitialSelection, type InkColours, type InkMatch, type InkMatchState, type InputLevelProps, type InspectorProps, type InspectorSectionProps, type Job, type JobAction, type JobActionOptions, type JobFailure, type JobOptions, type JobProgress, type JobRow, type JobStatusProps, type JobWords, type JobsTableProps, type KeyCheck, KeysLegend, type LatLng, type LightboxItem, type LightboxProps, type LightboxUrl, LineChart, LineChartGroup, type LineChartGroupProps, type LineChartProps, type LinkCardProps, type ListeningLevelProps, type Load, type LoadFailure, type LoadMoreProps, type Loudness, type MarkKind, type MarkPattern, type MarkTone, type MarkableTextProps, type MediaContentsItem, type MediaContentsProps, type MediaElementOptions, type MediaElementState, type MediaHeading, type MediaMark, MediaPlayer, type MediaPlayerProps, type MediaProblem, type MediaProgress, type MediaSession, type MediaSource, type MediaSpanData, type MediaSpansState, MediaStage, type MediaWindow, type MenuEntry, type MenuProps, type MeterProps, type MeterThreshold, type MetricProps, type Microphone, MicrophoneContext, MicrophoneError, type MicrophoneStream, type More, type NativeSelectProps, type NavItem, type NumberFieldProps, type NumberFormatter, type Outbox, type OutboxItem, type OutboxOptions, type OutboxRefusal, type OutboxRequest, type OutboxSnapshot, type OutboxStatusProps, PALETTE_STORAGE_KEY, type PageNames, type Pair, type PairAnswer, type PairJudgeProps, type PairVoteProps, type PairVoteSlot, type PairVoteWords, PaletteChoice, type PaletteOption, type PaletteState, type PaneProps, type PeakPair, type PendingRemoval, type Phase, type PictureBox, type PictureRegion, type PixelImageProps, type Pixels, type PlaceBoardProps, type PlaceState, type Platform, type PlayWindowButtonProps, PlayerNotice, type PlayerWarning, type PlayerWarningEvent, type Point, type Poll, type PopoverProps, type Precision, type Property, type PropertyListProps, type PropertyRowProps, type RangeProps, RateChoice, type ReadPixels, type Rebinding, type Recorder, type RecorderState, type Recording, type Rect, type RectLimits, type Region, type RegionEditorProps, type RegionTone, type Reserve, type ReserveOptions, type ResumeWords, type Block as RichBlock, type Inline as RichInline, type RichTextProps, RowAction, type RowActionProps, type RowExpansion, type RowSelection, SPEECH_RATES, type SaveState, type SayAgainProps, type SayOnShowOptions, type Saying, type ScheduleRow, type ScheduleTableProps, type SearchParam, type SearchParamOptions, type SecretFieldProps, type SecretTestResult, SeekBar, type SeekBarProps, type SeekBarSpan, type Segment, type Segmenter, type SegmenterOptions, type SelectableGridProps, type SequenceItem, type SequenceTimelineProps, type SetOptions, type ShareBox, type SharedCursor, type Shortcut, type ShortcutOverrides, type SkipAction, type SkipLevel, type SkipSteps, type SliderProps, type Sort, type SortableListProps, type SourceAttacher, SpanActions, type SpanActionsNotice, type SpanBehaviour, type SpanKind, type SpanOutcome, SpanStrip, type SpanTone, type SpanWords, type SpeakOptions, type Speech, type SpeechLevel, type SpeechPart, StageGuides, type StageState, type StageWords, type Stale, type StrataToastRegionProps, type StreamAttachment, type StreamContext, type SwitchProps, type SystemFact, type SystemFolder, type SystemInfoLike, type SystemPanelProps, type SystemService, type TabItem, type TakeLevelProps, type TextDifference, type TextLinkProps, type TextMedia, type TextSegment, ThemeProvider, type ThumbnailProps, type TileAspect, type TileGridProps, type TileSize, TimeReadout, type TimelineChange, type TimelineClock, type TimelineClockOptions, type TimelineDrop, type TimelineItem, type TimelineLane, type TimelineMarker, type TimelinePlayerProps, type TimelineProps, type ToastContentProps, type ToggleGroupProps, type ToggleOption, type ToggleProps, type Tone, type ToolbarProps, type TooltipProps, type TranscriptGroup, type TranscriptPhrase, type TranscriptPhraseState, type TranscriptSeek, type TranscriptViewProps, type TranscriptWord, Transport, type TransportProps, type TreeNodeState, type TreeProps, type TypedApi, type Undoable, type UndoableOptions, type UseAutoRecorderOptions, type UseRecorderOptions, type UseSpeechOptions, type VideoLoop, type VideoMedia, type VideoMode, type ViewGroup, type ViewGroupRows, type ViewOptionsConfig, type ViewOptionsProps, type ViewOptionsState, type ViewPointerOptions, type ViewSort, type Viewport, type ViewportFrameProps, type ViewportState, VolumeControl, type VolumeControlProps, type WaveformMark, type WaveformMarkKind, type WaveformPeaks, type WaveformProps, type WaveformSpan, type WaveformTone, type WorkContext, type WorkPhase, type WorkflowRunLike, type WorkflowRunOptions, type WorkflowStage, type WorkflowStepsProps, type WorkflowSummaryData, type WorkflowSummaryProps, type WorkflowSummaryState, type WorkflowSummaryWords, type WorkspaceBarProps, type WorkspaceState, type YScale, browserMicrophone, buttonVariants, colorSchemeScript, explainMicrophoneError, format$1 as format, geo, isTypingTarget, keyName, logScale, marksFor, paletteScript, palettes, readPixels$1 as readPixels, skipAction, transportShortcuts, useAsyncAction, useAttachedSource, useColorScheme, useHotkeys, useMediaElement, useMediaSpans, useMicrophone, usePalette, usePlayerWarnings, useSharedCursor, useSystemColorScheme, valueAt };
5523
+ export { type ActiveItem, type AlertDialogProps, type AlertProps, type Api, type ApiOptions, type ApiPage, type AspectRatio, type AsyncAction, type AsyncActionOptions, AsyncButton, type AsyncLabels, type AudioMedia, type AutoRecorder, type AutoRecorderState, type AutoSave, type AutoSaveOptions, type AutoTake, type BinaryByteUnit, type BookPage, type BookUrl, type BookViewerProps, type BoxListProps, type BoxOverlayProps, type BoxSource, type BoxTone, type BoxedPictureProps, type BoxesState, Button, type ButtonLinkProps, type ButtonProps, type ByteHighlight, type ByteRange, type ByteUnit, type ByteViewProps, type BytesOptions, COLOR_SCHEME_STORAGE_KEY, type Candidate, type CellValue, type ChartMark, type ChartSpan, type CheckboxGesture, type CheckboxProps, type Choice, type ChoiceCounts, type ChoiceGridProps, type ChoiceGroupProps, type ChoiceMarks, type ChoiceSize, type ChoiceState, type Choices, type ClientWork, type Clips, type ClipsContext, type ClipsProviderProps, type ColorFieldProps, type ColorScheme, ColorSchemeChoice, type ColorSchemeLabels, type ColorSchemePreference, type ColorSchemeState, type Column, type Command, type CommandMenuProps, type CommandsOptions, type CompareAudioProps, type CompareGridProps, type CompareMode, type CompareProps, type CompareTextProps, type CompareVideoGridProps, type CompareVideoProps, type ComposerProps, type CompositionBarProps, type CompositionPart, type ConsoleLevel, type ConsoleLine, type ConsoleProps, type ContextMenuProps, type ControlSize, type ConversationImage, type ConversationProps, type ConversationTurn, type CountOptions, type CursorMapping, type CursorOwner, CursorScope, type CursorScopeProps, type CutChange, type CutLimit, type CutRoom, DEFAULT_PALETTE, type DataTableProps, type DateFormatter, type DateInput, type DecodedAudio, type Delivery, Density, type DensityName, type DensityProps, type DescribeError, type DialogProps, type Difference, type DifferenceState, type DisclosureOpenProps, type DisclosureProps, type DragData, type DragSourceProps, type DropTarget, type Easing, type EditClip, type EditListOptions, type EditListPlayerProps, type EditListSlot, type EditListState, type EditTimes, type EditableRegion, type EntityMatch, type EntityMatcher, type ErrorBody, type Expanded, type ExpandedOptions, type FailedRemoval, type FetchJsonInit, type FetchJsonOptions, type FieldErrors, type FieldProps, type FileIntake, type FileIntakeOptions, type FileOutcome, type FilmFrame, type FilmStripProps, type Folder, type FolderListing, type FolderPickerProps, type Format, type FormatOptions, type FullscreenFrameProps, type GlimpseLook, type GlimpseProps, type GlimpseWhy, type Grid, type GroupMember, type GroupedChart, type Handle, type History, type HistoryOptions, type HistoryStateOptions, type HistoryStep, type HotkeysOptions, IconButton, type IconButtonProps, type IconComponent, type ImageMedia, type Implies, type InViewOptions, type InfiniteListProps, type InfiniteLoad, type InfiniteLoadOptions, type InitialSelection, type InkColours, type InkMatch, type InkMatchState, type InputLevelProps, type InspectorProps, type InspectorSectionProps, type Job, type JobAction, type JobActionOptions, type JobFailure, type JobOptions, type JobProgress, type JobRow, type JobStatusProps, type JobWords, type JobsTableProps, type KeyCheck, KeysLegend, type LatLng, type LightboxItem, type LightboxProps, type LightboxUrl, LineChart, LineChartGroup, type LineChartGroupProps, type LineChartProps, type LinkCardProps, type ListeningLevelProps, type Load, type LoadFailure, type LoadMoreProps, type Loudness, type MarkKind, type MarkPattern, type MarkTone, type MarkableTextProps, type MediaContentsItem, type MediaContentsProps, type MediaElementOptions, type MediaElementState, type MediaHeading, type MediaMark, MediaPlayer, type MediaPlayerProps, type MediaProblem, type MediaProgress, type MediaSession, type MediaSource, type MediaSpanData, type MediaSpansState, MediaStage, type MediaStat, type MediaStats, type MediaWindow, type MenuEntry, type MenuProps, type MeterProps, type MeterThreshold, type MetricProps, type Microphone, MicrophoneContext, MicrophoneError, type MicrophoneStream, type More, type NativeSelectProps, type NavItem, type NumberFieldProps, type NumberFormatter, type Outbox, type OutboxItem, type OutboxOptions, type OutboxRefusal, type OutboxRequest, type OutboxSnapshot, type OutboxStatusProps, PALETTE_STORAGE_KEY, type PageNames, type Pair, type PairAnswer, type PairJudgeProps, type PairVoteProps, type PairVoteSlot, type PairVoteWords, PaletteChoice, type PaletteOption, type PaletteState, type PaneProps, type PeakPair, type PendingRemoval, type Phase, type PictureBox, type PictureRegion, type PixelImageProps, type Pixels, type PlaceBoardProps, type PlaceState, type Platform, type PlayWindowButtonProps, PlayerNotice, type PlayerWarning, type PlayerWarningEvent, type Point, type Poll, type PopoverProps, type Precision, type Property, type PropertyListProps, type PropertyRowProps, type RangeProps, RateChoice, type ReadPixels, type Rebinding, type Recorder, type RecorderState, type Recording, type Rect, type RectLimits, type Region, type RegionEditorProps, type RegionTone, type Reserve, type ReserveOptions, type ResumeWords, type Block as RichBlock, type Inline as RichInline, type RichTextProps, RowAction, type RowActionProps, type RowExpansion, type RowSelection, SPEECH_RATES, type SaveState, type SayAgainProps, type SayOnShowOptions, type SayPictureProps, type Saying, type ScheduleRow, type ScheduleTableProps, type SearchParam, type SearchParamOptions, type SecretFieldProps, type SecretTestResult, SeekBar, type SeekBarProps, type SeekBarSpan, type Segment, type Segmenter, type SegmenterOptions, type SelectableGridProps, type SequenceItem, type SequenceTimelineProps, type SetOptions, type ShareBox, type SharedCursor, type Shortcut, type ShortcutOverrides, type SkipAction, type SkipLevel, type SkipSteps, type SliderProps, type Sort, type SortableListProps, type SourceAttacher, SpanActions, type SpanActionsNotice, type SpanBehaviour, type SpanKind, type SpanOutcome, SpanStrip, type SpanTone, type SpanWords, type SpeakOptions, type Speech, type SpeechLevel, type SpeechPart, StageGuides, type StageState, type StageWords, type Stale, type StrataToastRegionProps, type StreamAttachment, type StreamContext, type StreamStats, type SwitchProps, type SystemFact, type SystemFolder, type SystemInfoLike, type SystemPanelProps, type SystemService, type TabItem, type TakeLevelProps, type TextDifference, type TextLinkProps, type TextMedia, type TextSegment, ThemeProvider, type ThumbnailProps, type TileAspect, type TileGridProps, type TileSize, TimeReadout, type TimelineChange, type TimelineClock, type TimelineClockOptions, type TimelineDrop, type TimelineItem, type TimelineLane, type TimelineMarker, type TimelinePlayerProps, type TimelineProps, type ToastContentProps, type ToggleGroupProps, type ToggleOption, type ToggleProps, type Tone, type ToolbarProps, type TooltipProps, type TranscriptGroup, type TranscriptPhrase, type TranscriptPhraseState, type TranscriptSeek, type TranscriptViewProps, type TranscriptWord, Transport, type TransportProps, type TreeNodeState, type TreeProps, type TypedApi, type Undoable, type UndoableOptions, type UseAutoRecorderOptions, type UseRecorderOptions, type UseSpeechOptions, type VideoLoop, type VideoMedia, type VideoMode, type ViewGroup, type ViewGroupRows, type ViewOptionsConfig, type ViewOptionsProps, type ViewOptionsState, type ViewPointerOptions, type ViewSort, type Viewport, type ViewportFrameProps, type ViewportState, VolumeControl, type VolumeControlProps, type WaveformMark, type WaveformMarkKind, type WaveformPeaks, type WaveformProps, type WaveformSpan, type WaveformTone, type WorkContext, type WorkPhase, type WorkflowRunLike, type WorkflowRunOptions, type WorkflowStage, type WorkflowStepsProps, type WorkflowSummaryData, type WorkflowSummaryProps, type WorkflowSummaryState, type WorkflowSummaryWords, type WorkspaceBarProps, type WorkspaceState, type YScale, browserMicrophone, buttonVariants, colorSchemeScript, explainMicrophoneError, format$1 as format, geo, isTypingTarget, keyName, logScale, marksFor, mediaStatRows, paletteScript, palettes, readPixels$1 as readPixels, skipAction, transportShortcuts, useAsyncAction, useAttachedSource, useColorScheme, useHotkeys, useMediaElement, useMediaSpans, useMediaStats, useMicrophone, usePalette, usePlayerWarnings, useSharedCursor, useSystemColorScheme, valueAt };
5507
5524
  //# sourceMappingURL=index.d.ts.map