strata-react 2.1.15 → 2.1.17

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/dist/index.js CHANGED
@@ -4481,7 +4481,7 @@ function PlayWindowButton({ media, window: w, label, size = "sm", className }) {
4481
4481
 
4482
4482
  // src/components/media-spans.tsx
4483
4483
  const lower = (label) => label.charAt(0).toLowerCase() + label.slice(1);
4484
- const WORDS$2 = {
4484
+ const WORDS$3 = {
4485
4485
  skip: (l) => `Skip ${lower(l)}`,
4486
4486
  skipped: (l) => `Skipped ${lower(l)}`,
4487
4487
  mute: (l) => `Mute ${lower(l)}`,
@@ -4493,7 +4493,7 @@ const NOTICE_MS$1 = 6e3;
4493
4493
  /** Draws the spans' ranges and acts on them as playback reaches them. See the file comment for the rules. */
4494
4494
  function useMediaSpans({ spans, kinds = {}, words, onSpan, time, playing, duration, limit = Infinity, seek, volume, setVolume }) {
4495
4495
  const w = {
4496
- ...WORDS$2,
4496
+ ...WORDS$3,
4497
4497
  ...words
4498
4498
  };
4499
4499
  const list = React.useMemo(() => {
@@ -7388,7 +7388,7 @@ const MARK_LINE = {
7388
7388
  dash: "4 3"
7389
7389
  }
7390
7390
  };
7391
- const WORDS$1 = {
7391
+ const WORDS$2 = {
7392
7392
  running: "Reading the waveform",
7393
7393
  finished: "Waveform ready",
7394
7394
  failed: "Could not read the waveform"
@@ -7406,7 +7406,7 @@ async function defaultDecode(data) {
7406
7406
  const clamp$3 = (v, lo, hi) => Math.min(Math.max(v, lo), hi);
7407
7407
  const clock = (t) => format.runningTime(t);
7408
7408
  /** An audio waveform with marks, spans and a playhead: one slider you click, drag or key to seek, zoom, and a range to select. */
7409
- function Waveform({ label, peaks, source, duration: given, time, onSeek, marks = [], spans = [], underlay, range: controlledRange, onRangeChange, step = 5, bigStep = 30, defaultView, buckets = 2e3, normalise = false, decode = defaultDecode, words = WORDS$1, disabled, className }) {
7409
+ function Waveform({ label, peaks, source, duration: given, time, onSeek, marks = [], spans = [], underlay, range: controlledRange, onRangeChange, step = 5, bigStep = 30, defaultView, buckets = 2e3, normalise = false, decode = defaultDecode, words = WORDS$2, disabled, className }) {
7410
7410
  const work = useClientWork(async ({ signal, progress }) => {
7411
7411
  const data = typeof source === "string" ? await (await fetch(source, { signal })).arrayBuffer() : await source.arrayBuffer();
7412
7412
  progress(0, buckets + 2);
@@ -9906,7 +9906,7 @@ function useObjectUrl(data, type) {
9906
9906
  }
9907
9907
 
9908
9908
  // src/components/pixel-image.tsx
9909
- const sizeOf = (p) => p.image ? {
9909
+ const sizeOf$1 = (p) => p.image ? {
9910
9910
  width: p.image.width,
9911
9911
  height: p.image.height,
9912
9912
  data: p.image.data
@@ -9922,7 +9922,7 @@ function pixelZoom(width, height, zoom = "fit", maxSize = 512) {
9922
9922
  }
9923
9923
  /** A decoded RGBA picture on a canvas at a whole-number zoom with square pixels, a checkerboard behind clear pixels, named with its size. */
9924
9924
  function PixelImage({ label, zoom = "fit", maxSize = 512, className, ...source }) {
9925
- const { width, height, data } = sizeOf(source);
9925
+ const { width, height, data } = sizeOf$1(source);
9926
9926
  const canvas = React.useRef(null);
9927
9927
  const complete = data.length === width * height * 4 && width > 0 && height > 0;
9928
9928
  const scale = pixelZoom(width, height, zoom, maxSize);
@@ -21623,9 +21623,9 @@ const HANDLE_AT = {
21623
21623
  sw: "left-0 bottom-0 -translate-x-1/2 translate-y-1/2",
21624
21624
  w: "left-0 top-1/2 -translate-x-1/2 -translate-y-1/2"
21625
21625
  };
21626
- const round$1 = (n) => format.integer(Math.round(n));
21626
+ const round$5 = (n) => format.integer(Math.round(n));
21627
21627
  /** A window said in words. */
21628
- const describeRegion = (r) => `${r.label}: ${round$1(r.w)} wide by ${round$1(r.h)} high, ${round$1(r.x)} across and ${round$1(r.y)} down`;
21628
+ const describeRegion = (r) => `${r.label}: ${round$5(r.w)} wide by ${round$5(r.h)} high, ${round$5(r.x)} across and ${round$5(r.y)} down`;
21629
21629
  /** Draw and move one or two named windows on a picture, with pointer, keyboard and numbers kept in step; aspect and bounds hold through all three; two windows make a from/to move with a Watch preview. */
21630
21630
  function RegionEditor({ label, children, size, regions, onChange, selectedId, onSelectedChange, aspect, min, bounds, step, onDraw, mode = "single", onPreview, duration = 1500, easing = "ease-in-out", fields = true, unit = "px", defaults, angle = 0, onAngleChange, guide, spreadLabels = {
21631
21631
  one: "Page",
@@ -21826,7 +21826,7 @@ function RegionEditor({ label, children, size, regions, onChange, selectedId, on
21826
21826
  ...regions[1],
21827
21827
  ...moved[1]
21828
21828
  }]);
21829
- setSaid(`Gutter at ${round$1(gutterOf(moved[0], moved[1]))}: ${spreadLabels.left} ${round$1(moved[0].w)} wide, ${spreadLabels.right} ${round$1(moved[1].w)} wide`);
21829
+ setSaid(`Gutter at ${round$5(gutterOf(moved[0], moved[1]))}: ${spreadLabels.left} ${round$5(moved[0].w)} wide, ${spreadLabels.right} ${round$5(moved[1].w)} wide`);
21830
21830
  }
21831
21831
  };
21832
21832
  const split = () => {
@@ -22538,7 +22538,7 @@ const STROKE = {
22538
22538
  warning: "var(--warning)",
22539
22539
  danger: "var(--danger)"
22540
22540
  };
22541
- const FILL = {
22541
+ const FILL$1 = {
22542
22542
  neutral: "var(--muted)",
22543
22543
  info: "var(--info-subtle)",
22544
22544
  success: "var(--success-subtle)",
@@ -22596,7 +22596,7 @@ function BoxOverlay({ label, of, boxes, state, onChoose, fillLit = true }) {
22596
22596
  y: b.y,
22597
22597
  width: b.w,
22598
22598
  height: b.h,
22599
- fill: filled ? FILL[tone] : "none",
22599
+ fill: filled ? FILL$1[tone] : "none",
22600
22600
  fillOpacity: filled ? .25 : void 0,
22601
22601
  stroke: STROKE[tone],
22602
22602
  strokeWidth: on ? 3 : 1.5,
@@ -23004,7 +23004,7 @@ function Row$1({ level, children }) {
23004
23004
  children
23005
23005
  });
23006
23006
  }
23007
- function Node$1({ node }) {
23007
+ function Node$2({ node }) {
23008
23008
  const c = useCtx();
23009
23009
  const key = c.nodeKey(node);
23010
23010
  c.nodes.set(key, node);
@@ -23095,7 +23095,7 @@ function ClosedChild({ id }) {
23095
23095
  }
23096
23096
  function Nodes({ nodes }) {
23097
23097
  const c = useCtx();
23098
- return /* @__PURE__ */ jsx(Fragment, { children: c.sorted(nodes).map((n) => /* @__PURE__ */ jsx(Node$1, { node: n }, c.nodeKey(n))) });
23098
+ return /* @__PURE__ */ jsx(Fragment, { children: c.sorted(nodes).map((n) => /* @__PURE__ */ jsx(Node$2, { node: n }, c.nodeKey(n))) });
23099
23099
  }
23100
23100
  function Children({ node }) {
23101
23101
  const c = useCtx();
@@ -23406,6 +23406,154 @@ function Tree({ label, roots, useChildren, nodeKey, nodeLabel, isBranch, renderN
23406
23406
  });
23407
23407
  }
23408
23408
 
23409
+ // src/components/json-view.tsx
23410
+ const kindOf = (v) => v === null ? "null" : Array.isArray(v) ? "array" : typeof v === "object" ? "object" : typeof v === "string" ? "string" : typeof v === "number" ? "number" : typeof v === "boolean" ? "boolean" : "other";
23411
+ const entriesOf = (v) => Array.isArray(v) ? v.map((x, i) => [String(i), x]) : v !== null && typeof v === "object" ? Object.entries(v) : [];
23412
+ const isBranch = (v) => entriesOf(v).length > 0;
23413
+ const child = (path, key) => `${path}/${key.replaceAll("~", "~0").replaceAll("/", "~1")}`;
23414
+ /** Every branch's path under `value` down to `depth` levels (all of them with `Infinity`): what `JsonView` opens at first, and what "Expand all" opens. */
23415
+ function jsonBranchPaths(value, depth = Infinity, path = "") {
23416
+ if (!isBranch(value) || depth <= 0) return [];
23417
+ return [path, ...entriesOf(value).flatMap(([k, v]) => jsonBranchPaths(v, depth - 1, child(path, k)))];
23418
+ }
23419
+ function Scalar({ value }) {
23420
+ const kind = kindOf(value);
23421
+ if (kind === "string") return /* @__PURE__ */ jsxs("span", {
23422
+ className: "whitespace-pre-wrap break-words text-success",
23423
+ children: [
23424
+ /* @__PURE__ */ jsx("span", {
23425
+ className: "text-muted-foreground",
23426
+ children: "\""
23427
+ }),
23428
+ value,
23429
+ /* @__PURE__ */ jsx("span", {
23430
+ className: "text-muted-foreground",
23431
+ children: "\""
23432
+ })
23433
+ ]
23434
+ });
23435
+ if (kind === "number") return /* @__PURE__ */ jsx("span", {
23436
+ className: "text-info tabular-nums",
23437
+ children: String(value)
23438
+ });
23439
+ if (kind === "boolean") return /* @__PURE__ */ jsx("span", {
23440
+ className: "text-primary",
23441
+ children: String(value)
23442
+ });
23443
+ if (kind === "null") return /* @__PURE__ */ jsx("span", {
23444
+ className: "italic text-muted-foreground",
23445
+ children: "null"
23446
+ });
23447
+ if (kind === "array") return /* @__PURE__ */ jsx("span", {
23448
+ className: "text-muted-foreground",
23449
+ children: "[]"
23450
+ });
23451
+ if (kind === "object") return /* @__PURE__ */ jsx("span", {
23452
+ className: "text-muted-foreground",
23453
+ children: "{}"
23454
+ });
23455
+ return /* @__PURE__ */ jsx("span", {
23456
+ className: "italic text-muted-foreground",
23457
+ children: String(value)
23458
+ });
23459
+ }
23460
+ const sizeOf = (v) => {
23461
+ const n = entriesOf(v).length;
23462
+ return Array.isArray(v) ? format.count(n, "item") : format.count(n, "key");
23463
+ };
23464
+ function Node$1({ name, value, path, index }) {
23465
+ const branch = isBranch(value);
23466
+ const array = Array.isArray(value);
23467
+ const text = kindOf(value) === "string" ? value : branch ? sizeOf(value) : String(value);
23468
+ return /* @__PURE__ */ jsxs(TreeItem, {
23469
+ id: path,
23470
+ textValue: `${name} ${text}`.trim(),
23471
+ className: "outline-none",
23472
+ children: [/* @__PURE__ */ jsx(TreeItemContent, { children: ({ level, isExpanded, isFocusVisible }) => /* @__PURE__ */ jsxs("div", {
23473
+ className: cn("flex min-h-(--control-h-sm) min-w-0 items-start gap-1 rounded-control py-1 pr-2 font-mono type-body-sm hover:bg-muted", isFocusVisible && "outline-2 -outline-offset-2 outline-ring"),
23474
+ style: { paddingInlineStart: `${(level - 1) * 1.25}rem` },
23475
+ children: [branch ? /* @__PURE__ */ jsx(Button$1, {
23476
+ slot: "chevron",
23477
+ "aria-label": isExpanded ? `Close ${name}` : `Open ${name}`,
23478
+ className: "grid size-5 shrink-0 place-items-center rounded-control text-muted-foreground",
23479
+ children: /* @__PURE__ */ jsx(ChevronRight, {
23480
+ "aria-hidden": true,
23481
+ className: cn("size-4", isExpanded && "rotate-90")
23482
+ })
23483
+ }) : /* @__PURE__ */ jsx("span", {
23484
+ "aria-hidden": true,
23485
+ className: "size-5 shrink-0"
23486
+ }), /* @__PURE__ */ jsxs("span", {
23487
+ className: "min-w-0 flex-1",
23488
+ children: [
23489
+ /* @__PURE__ */ jsx("span", {
23490
+ className: index ? "text-muted-foreground" : "font-medium text-foreground",
23491
+ children: name
23492
+ }),
23493
+ /* @__PURE__ */ jsx("span", {
23494
+ className: "text-muted-foreground",
23495
+ children: ": "
23496
+ }),
23497
+ branch ? /* @__PURE__ */ jsxs(Fragment, { children: [
23498
+ /* @__PURE__ */ jsx("span", {
23499
+ className: "text-muted-foreground",
23500
+ children: array ? isExpanded ? "[" : "[…]" : isExpanded ? "{" : "{…}"
23501
+ }),
23502
+ " ",
23503
+ /* @__PURE__ */ jsx("span", {
23504
+ className: "font-sans type-caption text-muted-foreground",
23505
+ children: sizeOf(value)
23506
+ })
23507
+ ] }) : /* @__PURE__ */ jsx(Scalar, { value })
23508
+ ]
23509
+ })]
23510
+ }) }), branch && entriesOf(value).map(([k, v]) => /* @__PURE__ */ jsx(Node$1, {
23511
+ name: k,
23512
+ value: v,
23513
+ path: child(path, k),
23514
+ index: array
23515
+ }, k))]
23516
+ });
23517
+ }
23518
+ /** Any JSON value as a tree: objects and arrays open and close (arrows, type-ahead, Expand all / Collapse all), values coloured by type with theme roles, long strings wrapped. The fallback for a value an app cannot show in its own words. */
23519
+ function JsonView({ value, label, openDepth = 2, expanded: given, rootName = "value", height = "32rem", className }) {
23520
+ const [initial] = React.useState(() => given ? [] : jsonBranchPaths(value, openDepth));
23521
+ const own = useExpanded({ initial });
23522
+ const expanded = given ?? own;
23523
+ const branch = isBranch(value);
23524
+ const all = React.useMemo(() => jsonBranchPaths(value), [value]);
23525
+ return /* @__PURE__ */ jsxs("div", {
23526
+ className: cn("grid min-w-0 gap-1", className),
23527
+ children: [branch && /* @__PURE__ */ jsxs("div", {
23528
+ className: "flex items-center gap-1",
23529
+ children: [/* @__PURE__ */ jsx(Button, {
23530
+ size: "sm",
23531
+ variant: "ghost",
23532
+ onPress: () => expanded.onChange(new Set(all)),
23533
+ children: "Expand all"
23534
+ }), /* @__PURE__ */ jsx(Button, {
23535
+ size: "sm",
23536
+ variant: "ghost",
23537
+ onPress: () => expanded.onChange(/* @__PURE__ */ new Set()),
23538
+ children: "Collapse all"
23539
+ })]
23540
+ }), /* @__PURE__ */ jsx(Tree$1, {
23541
+ "aria-label": label,
23542
+ expandedKeys: expanded.expanded,
23543
+ onExpandedChange: (keys) => expanded.onChange(new Set([...keys].map(String))),
23544
+ className: "min-w-0 overflow-y-auto rounded-control bg-surface-sunken p-1 outline-none",
23545
+ style: { maxHeight: height },
23546
+ "data-strata-scroll": "",
23547
+ children: /* @__PURE__ */ jsx(Node$1, {
23548
+ name: rootName,
23549
+ value,
23550
+ path: "",
23551
+ index: false
23552
+ })
23553
+ })]
23554
+ });
23555
+ }
23556
+
23409
23557
  // src/components/folder-picker.tsx
23410
23558
  const SEP = "/";
23411
23559
  const parts = (path) => path.split(SEP).filter(Boolean);
@@ -23738,7 +23886,7 @@ function clockParts(face = "teaching", over = {}) {
23738
23886
  minuteNumbers: over.minuteNumbers ?? p.minuteNumbers
23739
23887
  };
23740
23888
  }
23741
- const WORDS = [
23889
+ const WORDS$1 = [
23742
23890
  "twelve",
23743
23891
  "one",
23744
23892
  "two",
@@ -23801,7 +23949,7 @@ function dayPart(hours) {
23801
23949
  */
23802
23950
  function clockWords(hours, minutes, options = {}) {
23803
23951
  const m = (Math.round(minutes) % 60 + 60) % 60;
23804
- const hour = (n) => WORDS[(n % 12 + 12) % 12];
23952
+ const hour = (n) => WORDS$1[(n % 12 + 12) % 12];
23805
23953
  let said;
23806
23954
  if (m === 0) said = `${hour(hours)} o’clock`;
23807
23955
  else if (m === 30) said = `half past ${hour(hours)}`;
@@ -24498,7 +24646,7 @@ const FRACTION_OUTLINES = [
24498
24646
  "rectangle",
24499
24647
  "triangle"
24500
24648
  ];
24501
- const R = 92;
24649
+ const R$1 = 92;
24502
24650
  const C = 100;
24503
24651
  const RECT = {
24504
24652
  x: 6,
@@ -24517,8 +24665,8 @@ const TRIANGLE = [
24517
24665
  [192, 182],
24518
24666
  [8, 182]
24519
24667
  ];
24520
- const poly = (points) => `M${points.map(([x, y]) => `${round(x)} ${round(y)}`).join(" L")} Z`;
24521
- const round = (n) => Math.round(n * 100) / 100;
24668
+ const poly = (points) => `M${points.map(([x, y]) => `${round$4(x)} ${round$4(y)}`).join(" L")} Z`;
24669
+ const round$4 = (n) => Math.round(n * 100) / 100;
24522
24670
  const mid = (a, b) => [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2];
24523
24671
  const lerp = (a, b, t) => [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t];
24524
24672
  /** Cut points from 0 to 1: equal, or (unequal) each part one size bigger than the one before. */
@@ -24531,14 +24679,14 @@ function stops(parts, unequal) {
24531
24679
  return out;
24532
24680
  }
24533
24681
  function slices(parts, unequal) {
24534
- if (parts === 1) return [`M8 ${C} A${R} ${R} 0 1 1 192 ${C} A${R} ${R} 0 1 1 8 ${C} Z`];
24535
- const at = (t) => [C + R * Math.sin(t * 2 * Math.PI), C - R * Math.cos(t * 2 * Math.PI)];
24682
+ if (parts === 1) return [`M8 ${C} A${R$1} ${R$1} 0 1 1 192 ${C} A${R$1} ${R$1} 0 1 1 8 ${C} Z`];
24683
+ const at = (t) => [C + R$1 * Math.sin(t * 2 * Math.PI), C - R$1 * Math.cos(t * 2 * Math.PI)];
24536
24684
  const s = stops(parts, unequal);
24537
24685
  return s.slice(1).map((end, i) => {
24538
24686
  const [x0, y0] = at(s[i]);
24539
24687
  const [x1, y1] = at(end);
24540
24688
  const large = end - s[i] > .5 ? 1 : 0;
24541
- return `M${C} ${C} L${round(x0)} ${round(y0)} A${R} ${R} 0 ${large} 1 ${round(x1)} ${round(y1)} Z`;
24689
+ return `M${C} ${C} L${round$4(x0)} ${round$4(y0)} A${R$1} ${R$1} 0 ${large} 1 ${round$4(x1)} ${round$4(y1)} Z`;
24542
24690
  });
24543
24691
  }
24544
24692
  function boxParts(box, parts, cut) {
@@ -24964,5 +25112,663 @@ function SetClock({ value, onChange, step = 5, geared = true, face = "teaching",
24964
25112
  });
24965
25113
  }
24966
25114
 
24967
- export { ActiveList, Alert, AlertDialog, AppShell, AsyncButton, BRUSHES, BookViewer, BoxList, BoxOverlay, BoxedPicture, Breadcrumb, BulkBar, Button, ButtonLink, ByteView, CLOCK_FACE_STYLES, CLOCK_STYLES, COLOR_SCHEME_STORAGE_KEY, Checkbox, ChoiceGrid, ChoiceGridSkeleton, ChoiceGroup, ClipsProvider, Clock, ClockFace, ColorField, ColorSchemeChoice, CommandLegend, CommandMenu, Compare, CompareAudio, CompareGrid, CompareText, CompareVideo, CompareVideoGrid, Composer, CompositionBar, Concealed, Console, ContextMenu, Conversation, CursorScope, DEFAULT_PALETTE, DEFAULT_TOLERANCE, DIGITAL_CLOCK_STYLES, DataTable, DataView$1 as DataView, Density, Dialog, DigitalClock, Disclosure, Done, DragSource, DrawingLayer, DrawingToolbar, EditListPlayer, EmptyState, EventLog, FIT, FRACTION_OUTLINES, Field, FileButton, FileDropOverlay, FileDropZone, FileOutcomes, FilmStrip, FolderPicker, FractionShape, FullscreenFrame, Glimpse, HttpError, INK_COLOURS, IconButton, InfiniteList, Input, InputLevel, Inspector, InspectorSection, JobStatus, JobsTable, KeysLegend, LEVEL_FLOOR_DB, Lightbox, LineChart, LineChartGroup, LinkCard, LinkCardList, ListeningLevel, LoadError, LoadMore, MAX_SCALE, MAX_SIDE, MIN_SCALE, MISSING, Mark, MarkSummary, MarkableText, MediaContents, MediaGroup, MediaPlayer, MediaStage, Menu, Meter, Metric, MetricStrip, MicrophoneContext, MicrophoneError, MissingFile, NBSP, NativeSelect, NumberField, OutboxStatus, PALETTE_STORAGE_KEY, PageHeader, PairJudge, PairVote, PaletteChoice, Pane, PauseButton, PixelImage, PlaceBoard, PlayWindowButton, PlayerNotice, Popover, PropertyList, PropertyRow, RangeSlider, RateChoice, ReadAlong, RegionEditor, RichText, RowAction, SPEECH_RATES, STRATA_DRAG_TYPE, SaveStatus, SayAgain, SayPicture, ScheduleTable, SecretField, SeekBar, SelectableGrid, SelectableGridSkeleton, SequenceTimeline, SetClock, ShortcutEditor, SideNav, Skeleton, Slider, SortableList, SpanActions, SpanStrip, Split, StageGuides, StaleNotice, Status, StrataQueryProvider, StrataToastRegion, Switch, SystemPanel, TableSkeleton, Tabs, TakeLevel, TextLink, Textarea, ThemeProvider, Thumbnail, ThumbnailSkeleton, TileGrid, TileGridSkeleton, TimeReadout, Timeline, TimelinePlayer, TimelineZoomControls, Toggle, ToggleGroup, Toolbar, ToolbarSeparator, Tooltip, TranscriptView, Transport, Tree, UndoBar, ViewOptions, ViewportFrame, VirtualList, VolumeControl, Waveform, WorkflowSteps, WorkflowSummary, Workspace, WorkspaceBar, actualPixelsScale, ancestorsOf, apiPage, appBase, applyOp, boxViewport, browserMicrophone, buttonVariants, canFullscreen, canPlayClips, canSay, canSpeak, checkKey, clampToRoom, clampViewport, clipsQueryKey, clockParts, clockWords, cn, colorSchemeScript, commandShortcut, continues, countMarks, createApi, createFormat, createOutbox, createQueryClient, createReserve, createSegmenter, createTypedApi, crossedThreshold, currentItem, currentOf, curvePoints, dayPart, describeActionError, describeHttpError, describeRegion, describeWorkflowSummary, detectPlatform, diffWords, differences, digitalTime, diskThresholds, drawRect, drawingToSvg, ease, editTimeOf, editTimes, emptyDrawing, encodeWav, errorPayload, explainMicrophoneError, feedbackMarker, fetchJson, fieldErrorsOf, filterMarkup, findPage, fitPoints, fitRect, followAim, format, formatChord, fractionParts, fractionWords, frameAt, gainToVolume, geo, gridPoints, gutterOf, hitsStroke, hourAt, inkMatch, inputLevelThresholds, invertOp, isDigitalStyle, isDoubtful, isRefusal, isReservedChord, isSpeaking, isTaskRunning, isTypingTarget, isWorkflowRunning, jobProgressText, joinMediaGroup, joinRects, joinSamples, keyName, labelOf, lerpRect, locateInEdit, logScale, loudnessOf, marksFor, matchEntities, matchGains, matchesAccept, matchesChord, measureLoudness, mediaStatRows, minutesAt, moveGutter, moveMinuteHand, movePoints, moveRect, newStrokeId, nextBreak, noOverlap, normaliseAngle, pageName, paletteScript, palettes, parentOf, parseChord, parseInline, parseRichText, parseSort, peakDb, peakGain, peaksFromAudio, phraseAt, phraseDoubtful, phraseOfWordId, pickEvenly, pickVoice, pixelZoom, plainText, pointsBox, rangeBetween, readErrorBody, readPixels, readingOrder, regionShares, regionStyle, replay, resample, resamplePeaks, rescaleDrawing, resizeRect, rgbaToBlob, rmsDb, romanHour, safeHref, sayPosition, serialiseSort, settleCut, simplifyPoints, skipAction, smoothPath, snapToGrid, sortRows, speak, speechLevel, splitRect, staleOf, stepId, stepMinuteHand, stepOnGrid, stopSpeaking, strokeAt, strokeBox, strokeShape, summariseWorkflow, textOf, tickLabel, tickStep, ticksBetween, toDate, toLoad, toPeakPair, toast, toastTimeout, transportShortcuts, turnRect, turnedSize, typeSteps, useActiveItem, useAsyncAction, useAttachedSource, useAutoRecorder, useAutoSave, useBookUrl, useBoxes, useChoices, useClientWork, useClips, useColorScheme, useCommands, useCountdown, useDifference, useDrawing, useEditList, useExpanded, useFileIntake, useHistory, useHistoryState, useHotkeys, useInView, useInfiniteLoad, useInkMatch, useJob, useJobAction, useLeaveGuard, useLightboxUrl, useLoad, useMediaElement, useMediaSpans, useMediaStats, useMicrophone, useObjectUrl, useOutbox, useOutboxStarted, usePalette, usePlayerWarnings, usePoll, useReadAloud, useRebindableShortcuts, useRecorder, useReserve, useRevealed, useSayOnShow, useSearchParam, useSelection, useSettledStatus, useSharedCursor, useSpeaking, useSpeech, useSystemColorScheme, useSystemInfo, useTimeline, useTimelineZoom, useUndoable, useViewOptions, useViewPointers, useViewport, useWheelZoom, useWorkflowRun, useWorkspaceState, valueAt, viewOf, viewsOf, widthsOf, withBase, wordAt, wordId, zoomAt, zoomToBox };
25115
+ // src/components/money.tsx
25116
+ /** Every coin, smallest value first. */
25117
+ const COINS = [
25118
+ 1,
25119
+ 2,
25120
+ 5,
25121
+ 10,
25122
+ 20,
25123
+ 50,
25124
+ 100,
25125
+ 200
25126
+ ];
25127
+ /** Every note a Year 1 learner meets, smallest first. */
25128
+ const NOTES = [
25129
+ 500,
25130
+ 1e3,
25131
+ 2e3
25132
+ ];
25133
+ const COIN = {
25134
+ 1: {
25135
+ mm: 20.3,
25136
+ outline: "round",
25137
+ metal: "copper"
25138
+ },
25139
+ 2: {
25140
+ mm: 25.9,
25141
+ outline: "round",
25142
+ metal: "copper"
25143
+ },
25144
+ 5: {
25145
+ mm: 18,
25146
+ outline: "round",
25147
+ metal: "silver"
25148
+ },
25149
+ 10: {
25150
+ mm: 24.5,
25151
+ outline: "round",
25152
+ metal: "silver"
25153
+ },
25154
+ 20: {
25155
+ mm: 21.4,
25156
+ outline: "seven",
25157
+ metal: "silver"
25158
+ },
25159
+ 50: {
25160
+ mm: 27.3,
25161
+ outline: "seven",
25162
+ metal: "silver"
25163
+ },
25164
+ 100: {
25165
+ mm: 23.43,
25166
+ outline: "twelve",
25167
+ metal: "gold",
25168
+ centre: "silver"
25169
+ },
25170
+ 200: {
25171
+ mm: 28.4,
25172
+ outline: "round",
25173
+ metal: "gold",
25174
+ centre: "silver"
25175
+ }
25176
+ };
25177
+ const LARGEST = 28.4;
25178
+ const FILL = {
25179
+ copper: "fill-coin-copper",
25180
+ silver: "fill-coin-silver",
25181
+ gold: "fill-coin-gold"
25182
+ };
25183
+ const round$3 = (n) => Math.round(n * 100) / 100;
25184
+ /** The outline of a coin of radius `r` about (100, 100) as an SVG path: a circle, a Reuleaux heptagon (20p and 50p,
25185
+ * seven arcs each centred on the opposite corner, so the coin is the same width every way) or a twelve-sided polygon. */
25186
+ function coinOutline(outline, r) {
25187
+ if (outline === "round") return `M${100 - r} 100 A${r} ${r} 0 1 1 ${100 + r} 100 A${r} ${r} 0 1 1 ${100 - r} 100 Z`;
25188
+ const n = outline === "seven" ? 7 : 12;
25189
+ const at = (i) => {
25190
+ const t = i / n * 2 * Math.PI;
25191
+ return [round$3(100 + r * Math.sin(t)), round$3(100 - r * Math.cos(t))];
25192
+ };
25193
+ const corners = Array.from({ length: n }, (_, i) => at(i));
25194
+ if (n === 12) return `M${corners.map(([x, y]) => `${x} ${y}`).join(" L")} Z`;
25195
+ const [ax, ay] = corners[0];
25196
+ const [bx, by] = corners[3];
25197
+ const d = round$3(Math.hypot(ax - bx, ay - by));
25198
+ return `M${ax} ${ay} ${corners.slice(1).concat([corners[0]]).map(([x, y]) => `A${d} ${d} 0 0 1 ${x} ${y}`).join(" ")} Z`;
25199
+ }
25200
+ /** A value as it is written on a coin or a note: "20p", "£1", "£10". */
25201
+ function moneyWords(pence) {
25202
+ return pence < 100 ? `${pence}p` : `£${pence / 100}`;
25203
+ }
25204
+ /** A UK coin or note, drawn: its outline, its metal and its value. */
25205
+ function Money({ pence, toScale = false, label, className }) {
25206
+ const written = moneyWords(pence);
25207
+ const coin = COIN[pence];
25208
+ const said = label ?? `A ${written} ${coin ? "coin" : "note"}`;
25209
+ if (!coin) return /* @__PURE__ */ jsxs("svg", {
25210
+ viewBox: "0 0 200 110",
25211
+ role: "img",
25212
+ "aria-label": said,
25213
+ className: cn("block w-full", className),
25214
+ children: [
25215
+ /* @__PURE__ */ jsx("rect", {
25216
+ x: 4,
25217
+ y: 4,
25218
+ width: 192,
25219
+ height: 102,
25220
+ rx: 8,
25221
+ strokeWidth: 3,
25222
+ className: "fill-card stroke-foreground"
25223
+ }),
25224
+ /* @__PURE__ */ jsx("rect", {
25225
+ x: 4,
25226
+ y: 4,
25227
+ width: 46,
25228
+ height: 102,
25229
+ rx: 8,
25230
+ className: "fill-primary"
25231
+ }),
25232
+ /* @__PURE__ */ jsx("rect", {
25233
+ x: 30,
25234
+ y: 4,
25235
+ width: 20,
25236
+ height: 102,
25237
+ className: "fill-primary"
25238
+ }),
25239
+ /* @__PURE__ */ jsx("text", {
25240
+ x: 124,
25241
+ y: 57,
25242
+ textAnchor: "middle",
25243
+ dominantBaseline: "central",
25244
+ fontSize: 52,
25245
+ fontWeight: 700,
25246
+ className: "fill-foreground font-sans",
25247
+ children: written
25248
+ })
25249
+ ]
25250
+ });
25251
+ const r = 94 * (toScale ? coin.mm / LARGEST : 1);
25252
+ const outer = coinOutline(coin.outline, r);
25253
+ const centreR = r * .68;
25254
+ const size = written.length > 2 ? .5 : .62;
25255
+ return /* @__PURE__ */ jsxs("svg", {
25256
+ viewBox: "0 0 200 200",
25257
+ role: "img",
25258
+ "aria-label": said,
25259
+ className: cn("block aspect-square w-full", className),
25260
+ children: [
25261
+ /* @__PURE__ */ jsx("path", {
25262
+ d: outer,
25263
+ strokeWidth: 3,
25264
+ strokeLinejoin: "round",
25265
+ className: cn(FILL[coin.metal], "stroke-foreground")
25266
+ }),
25267
+ coin.centre ? /* @__PURE__ */ jsx("path", {
25268
+ d: coinOutline("round", centreR),
25269
+ strokeWidth: 2,
25270
+ className: cn(FILL[coin.centre], "stroke-coin-ink"),
25271
+ "data-centre": coin.centre
25272
+ }) : /* @__PURE__ */ jsx("path", {
25273
+ d: coinOutline(coin.outline, r * .86),
25274
+ strokeWidth: 1.5,
25275
+ className: "fill-none stroke-coin-ink"
25276
+ }),
25277
+ /* @__PURE__ */ jsx("text", {
25278
+ x: 100,
25279
+ y: 100,
25280
+ textAnchor: "middle",
25281
+ dominantBaseline: "central",
25282
+ fontSize: round$3(r * size),
25283
+ fontWeight: 700,
25284
+ className: "fill-coin-ink font-sans",
25285
+ children: written
25286
+ })
25287
+ ]
25288
+ });
25289
+ }
25290
+
25291
+ // src/components/solid.tsx
25292
+ /** Every shape, in the order a gallery shows them. */
25293
+ const SOLID_SHAPES = [
25294
+ "cube",
25295
+ "cuboid",
25296
+ "sphere",
25297
+ "cylinder",
25298
+ "cone",
25299
+ "pyramid",
25300
+ "prism"
25301
+ ];
25302
+ const WORDS = {
25303
+ cube: "A cube",
25304
+ cuboid: "A cuboid",
25305
+ sphere: "A sphere",
25306
+ cylinder: "A cylinder",
25307
+ cone: "A cone",
25308
+ pyramid: "A pyramid",
25309
+ prism: "A triangular prism"
25310
+ };
25311
+ const path = (...points) => `M${points.map(([x, y]) => `${x} ${y}`).join(" L")} Z`;
25312
+ const line = (a, b) => `M${a[0]} ${a[1]} L${b[0]} ${b[1]}`;
25313
+ const TOP$1 = "fill-primary-3";
25314
+ const FRONT = "fill-primary-5";
25315
+ const SIDE = "fill-primary-7";
25316
+ const HIDDEN = {
25317
+ strokeDasharray: "6 6",
25318
+ className: "fill-none stroke-muted-foreground"
25319
+ };
25320
+ /** A box seen from above and to the right: its front corner at (x, y), w wide, h high and d deep (drawn up and right). */
25321
+ function Box({ x, y, w, h, d }) {
25322
+ const dx = d * .7;
25323
+ const dy = -d * .5;
25324
+ const a = [x, y];
25325
+ const b = [x + w, y];
25326
+ const c = [x + w, y + h];
25327
+ const e = [x, y + h];
25328
+ const back = (p) => [p[0] + dx, p[1] + dy];
25329
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
25330
+ /* @__PURE__ */ jsx("path", {
25331
+ d: path(a, b, back(b), back(a)),
25332
+ className: TOP$1
25333
+ }),
25334
+ /* @__PURE__ */ jsx("path", {
25335
+ d: path(a, b, c, e),
25336
+ className: FRONT
25337
+ }),
25338
+ /* @__PURE__ */ jsx("path", {
25339
+ d: path(b, back(b), back(c), c),
25340
+ className: SIDE
25341
+ }),
25342
+ /* @__PURE__ */ jsx("path", {
25343
+ d: line(back(e), e),
25344
+ ...HIDDEN
25345
+ }),
25346
+ /* @__PURE__ */ jsx("path", {
25347
+ d: line(back(e), back(a)),
25348
+ ...HIDDEN
25349
+ }),
25350
+ /* @__PURE__ */ jsx("path", {
25351
+ d: line(back(e), back(c)),
25352
+ ...HIDDEN
25353
+ })
25354
+ ] });
25355
+ }
25356
+ function Drawing({ shape }) {
25357
+ switch (shape) {
25358
+ case "cube": return /* @__PURE__ */ jsx(Box, {
25359
+ x: 30,
25360
+ y: 70,
25361
+ w: 110,
25362
+ h: 110,
25363
+ d: 60
25364
+ });
25365
+ case "cuboid": return /* @__PURE__ */ jsx(Box, {
25366
+ x: 12,
25367
+ y: 95,
25368
+ w: 140,
25369
+ h: 80,
25370
+ d: 60
25371
+ });
25372
+ case "sphere": return /* @__PURE__ */ jsxs(Fragment, { children: [
25373
+ /* @__PURE__ */ jsx("circle", {
25374
+ cx: 100,
25375
+ cy: 100,
25376
+ r: 85,
25377
+ className: FRONT
25378
+ }),
25379
+ /* @__PURE__ */ jsx("path", {
25380
+ d: "M15 100 A85 24 0 0 1 185 100",
25381
+ ...HIDDEN
25382
+ }),
25383
+ /* @__PURE__ */ jsx("path", {
25384
+ d: "M15 100 A85 24 0 0 0 185 100",
25385
+ className: "fill-none"
25386
+ })
25387
+ ] });
25388
+ case "cylinder": return /* @__PURE__ */ jsxs(Fragment, { children: [
25389
+ /* @__PURE__ */ jsx("path", {
25390
+ d: "M40 45 L40 160 A60 18 0 0 0 160 160 L160 45 Z",
25391
+ className: FRONT
25392
+ }),
25393
+ /* @__PURE__ */ jsx("path", {
25394
+ d: "M40 160 A60 18 0 0 1 160 160",
25395
+ ...HIDDEN
25396
+ }),
25397
+ /* @__PURE__ */ jsx("ellipse", {
25398
+ cx: 100,
25399
+ cy: 45,
25400
+ rx: 60,
25401
+ ry: 18,
25402
+ className: TOP$1
25403
+ })
25404
+ ] });
25405
+ case "cone": return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("path", {
25406
+ d: "M100 15 L35 160 A65 20 0 0 0 165 160 Z",
25407
+ className: FRONT
25408
+ }), /* @__PURE__ */ jsx("path", {
25409
+ d: "M35 160 A65 20 0 0 1 165 160",
25410
+ ...HIDDEN
25411
+ })] });
25412
+ case "pyramid": {
25413
+ const apex = [95, 15];
25414
+ const fl = [25, 170];
25415
+ const fr = [135, 170];
25416
+ const br = [180, 135];
25417
+ const bl = [70, 135];
25418
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
25419
+ /* @__PURE__ */ jsx("path", {
25420
+ d: path(apex, fl, fr),
25421
+ className: FRONT
25422
+ }),
25423
+ /* @__PURE__ */ jsx("path", {
25424
+ d: path(apex, fr, br),
25425
+ className: SIDE
25426
+ }),
25427
+ /* @__PURE__ */ jsx("path", {
25428
+ d: line(bl, fl),
25429
+ ...HIDDEN
25430
+ }),
25431
+ /* @__PURE__ */ jsx("path", {
25432
+ d: line(bl, br),
25433
+ ...HIDDEN
25434
+ }),
25435
+ /* @__PURE__ */ jsx("path", {
25436
+ d: line(bl, apex),
25437
+ ...HIDDEN
25438
+ })
25439
+ ] });
25440
+ }
25441
+ case "prism": {
25442
+ const a = [20, 175];
25443
+ const b = [120, 175];
25444
+ const c = [70, 90];
25445
+ const back = (p) => [p[0] + 60, p[1] - 55];
25446
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
25447
+ /* @__PURE__ */ jsx("path", {
25448
+ d: path(c, back(c), back(b), b),
25449
+ className: SIDE
25450
+ }),
25451
+ /* @__PURE__ */ jsx("path", {
25452
+ d: path(a, b, c),
25453
+ className: FRONT
25454
+ }),
25455
+ /* @__PURE__ */ jsx("path", {
25456
+ d: line(back(a), back(b)),
25457
+ ...HIDDEN
25458
+ }),
25459
+ /* @__PURE__ */ jsx("path", {
25460
+ d: line(back(a), back(c)),
25461
+ ...HIDDEN
25462
+ }),
25463
+ /* @__PURE__ */ jsx("path", {
25464
+ d: line(back(a), a),
25465
+ ...HIDDEN
25466
+ })
25467
+ ] });
25468
+ }
25469
+ }
25470
+ }
25471
+ /** A 3-D shape drawn with its faces shaded and its hidden edges dashed: cube, cuboid, sphere, cylinder, cone and more. */
25472
+ function Solid({ shape, label, className }) {
25473
+ return /* @__PURE__ */ jsx("svg", {
25474
+ viewBox: "0 0 200 200",
25475
+ role: "img",
25476
+ "aria-label": label ?? WORDS[shape],
25477
+ className: cn("block aspect-square w-full", className),
25478
+ children: /* @__PURE__ */ jsx("g", {
25479
+ strokeWidth: 3,
25480
+ strokeLinejoin: "round",
25481
+ className: "stroke-foreground",
25482
+ children: /* @__PURE__ */ jsx(Drawing, { shape })
25483
+ })
25484
+ });
25485
+ }
25486
+ /** A 3-D shape's name as it is said: "a cube", "a triangular prism". */
25487
+ function solidWords(shape) {
25488
+ return WORDS[shape].replace(/^A/, "a");
25489
+ }
25490
+
25491
+ // src/components/fill-level.tsx
25492
+ const TOP = 20;
25493
+ const BOTTOM = 185;
25494
+ const round$2 = (n) => Math.round(n * 100) / 100;
25495
+ const edge = (y) => {
25496
+ const t = (y - TOP) / 165;
25497
+ return {
25498
+ left: round$2(30 + 15 * t),
25499
+ right: round$2(170 - 15 * t)
25500
+ };
25501
+ };
25502
+ /** How full a glass is, in words: "empty", "a quarter full", "half full", "three quarters full", "full", or "nearly
25503
+ * full" and "nearly empty" between. */
25504
+ function fillWords(level) {
25505
+ if (level <= 0) return "empty";
25506
+ if (level >= 1) return "full";
25507
+ const near = (x) => Math.abs(level - x) < .04;
25508
+ if (near(.25)) return "a quarter full";
25509
+ if (near(.5)) return "half full";
25510
+ if (near(.75)) return "three quarters full";
25511
+ if (level > .85) return "nearly full";
25512
+ if (level < .15) return "nearly empty";
25513
+ return level > .5 ? "more than half full" : "less than half full";
25514
+ }
25515
+ /** A glass filled to a level, from empty to full: the picture of capacity (fuller, half full, empty). */
25516
+ function FillLevel({ level, label, className }) {
25517
+ if (!(level >= 0 && level <= 1)) throw new RangeError(`level must be 0 to 1, not ${level}`);
25518
+ const surface = round$2(BOTTOM - 165 * level);
25519
+ const w = edge(surface);
25520
+ const b = edge(BOTTOM);
25521
+ const t = edge(TOP);
25522
+ return /* @__PURE__ */ jsxs("svg", {
25523
+ viewBox: "0 0 200 200",
25524
+ role: "img",
25525
+ "aria-label": label ?? `A glass, ${fillWords(level)}`,
25526
+ className: cn("block aspect-square w-full", className),
25527
+ children: [
25528
+ /* @__PURE__ */ jsx("path", {
25529
+ d: `M${t.left} ${TOP} L${b.left} ${BOTTOM} L${b.right} ${BOTTOM} L${t.right} ${TOP} Z`,
25530
+ className: "fill-card"
25531
+ }),
25532
+ level > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("path", {
25533
+ d: `M${w.left} ${surface} L${b.left} ${BOTTOM} L${b.right} ${BOTTOM} L${w.right} ${surface} Z`,
25534
+ className: "fill-info-subtle",
25535
+ "data-level": level
25536
+ }), /* @__PURE__ */ jsx("path", {
25537
+ d: `M${w.left} ${surface} L${w.right} ${surface}`,
25538
+ strokeWidth: 3,
25539
+ className: "stroke-info"
25540
+ })] }),
25541
+ /* @__PURE__ */ jsx("path", {
25542
+ d: `M${t.left} ${TOP} L${b.left} ${BOTTOM} L${b.right} ${BOTTOM} L${t.right} ${TOP}`,
25543
+ strokeWidth: 4,
25544
+ strokeLinejoin: "round",
25545
+ className: "fill-none stroke-foreground"
25546
+ })
25547
+ ]
25548
+ });
25549
+ }
25550
+
25551
+ // src/components/balance.tsx
25552
+ const TILT = 14;
25553
+ const ARM = 60;
25554
+ const PIVOT = [100, 62];
25555
+ const round$1 = (n) => Math.round(n * 100) / 100;
25556
+ /** A balance with a picture in each pan, tipped toward the heavier side or level. */
25557
+ function Balance({ left, right, down, label, className }) {
25558
+ const a = (down === "left" ? -1 : down === "right" ? 1 : 0) * TILT * Math.PI / 180;
25559
+ const end = (side) => [round$1(PIVOT[0] + side * ARM * Math.cos(a)), round$1(PIVOT[1] + side * ARM * Math.sin(a))];
25560
+ const [lx, ly] = end(-1);
25561
+ const [rx, ry] = end(1);
25562
+ const said = label ?? `A balance: ${left} on the left, ${right} on the right, ${down === "level" ? "level" : `the ${down} side down`}`;
25563
+ const pan = (x, y, thing, side) => /* @__PURE__ */ jsxs("g", {
25564
+ "data-side": side,
25565
+ children: [
25566
+ /* @__PURE__ */ jsx("path", {
25567
+ d: `M${x} ${y} L${x - 28} ${y + 52} M${x} ${y} L${x + 28} ${y + 52}`,
25568
+ strokeWidth: 2,
25569
+ className: "stroke-muted-foreground"
25570
+ }),
25571
+ /* @__PURE__ */ jsx("text", {
25572
+ x,
25573
+ y: y + 36,
25574
+ textAnchor: "middle",
25575
+ dominantBaseline: "central",
25576
+ fontSize: thing.length > 2 ? 14 : 34,
25577
+ className: "fill-foreground font-sans",
25578
+ children: thing
25579
+ }),
25580
+ /* @__PURE__ */ jsx("path", {
25581
+ d: `M${x - 32} ${y + 52} Q${x} ${y + 72} ${x + 32} ${y + 52} Z`,
25582
+ strokeWidth: 3,
25583
+ className: "fill-card stroke-foreground"
25584
+ })
25585
+ ]
25586
+ });
25587
+ return /* @__PURE__ */ jsx("svg", {
25588
+ viewBox: "0 0 200 200",
25589
+ role: "img",
25590
+ "aria-label": said,
25591
+ className: cn("block aspect-square w-full", className),
25592
+ "data-down": down,
25593
+ children: /* @__PURE__ */ jsxs("g", {
25594
+ strokeLinejoin: "round",
25595
+ strokeLinecap: "round",
25596
+ children: [
25597
+ /* @__PURE__ */ jsx("path", {
25598
+ d: `M${PIVOT[0]} ${PIVOT[1]} L${PIVOT[0]} 188 M70 188 L130 188`,
25599
+ strokeWidth: 5,
25600
+ className: "stroke-foreground"
25601
+ }),
25602
+ /* @__PURE__ */ jsx("path", {
25603
+ d: `M${lx} ${ly} L${rx} ${ry}`,
25604
+ strokeWidth: 5,
25605
+ className: "stroke-foreground"
25606
+ }),
25607
+ /* @__PURE__ */ jsx("circle", {
25608
+ cx: PIVOT[0],
25609
+ cy: PIVOT[1],
25610
+ r: 6,
25611
+ className: "fill-primary"
25612
+ }),
25613
+ pan(lx, ly, left, "left"),
25614
+ pan(rx, ry, right, "right")
25615
+ ]
25616
+ })
25617
+ });
25618
+ }
25619
+
25620
+ // src/components/length-bar.tsx
25621
+ const SPAN = 184;
25622
+ const THICK = 30;
25623
+ function Along({ length, max, look }) {
25624
+ const unit = SPAN / max;
25625
+ const w = unit * length;
25626
+ const y = 100 - THICK / 2;
25627
+ if (look === "cubes") return Array.from({ length }, (_, i) => /* @__PURE__ */ jsx("rect", {
25628
+ x: 8 + i * unit,
25629
+ y: 100 - unit / 2,
25630
+ width: unit,
25631
+ height: unit,
25632
+ className: "fill-primary"
25633
+ }, i));
25634
+ if (look === "pencil") {
25635
+ const tip = Math.min(unit * 1.2, w / 2);
25636
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
25637
+ /* @__PURE__ */ jsx("path", {
25638
+ d: `M8 ${y} L${8 + w - tip} ${y} L${8 + w} 100 L${8 + w - tip} 115 L8 115 Z`,
25639
+ className: "fill-secondary-9"
25640
+ }),
25641
+ /* @__PURE__ */ jsx("path", {
25642
+ d: `M${8 + w - tip} ${y} L${8 + w - tip} 115`,
25643
+ className: "fill-none"
25644
+ }),
25645
+ /* @__PURE__ */ jsx("path", {
25646
+ d: `M${8 + w - tip * .35} ${100 - THICK * .17} L${8 + w} 100 L${8 + w - tip * .35} 105.1 Z`,
25647
+ className: "fill-foreground"
25648
+ })
25649
+ ] });
25650
+ }
25651
+ return /* @__PURE__ */ jsx("rect", {
25652
+ x: 8,
25653
+ y,
25654
+ width: w,
25655
+ height: THICK,
25656
+ rx: 6,
25657
+ className: "fill-primary"
25658
+ });
25659
+ }
25660
+ /** Something drawn to a length (a ribbon, a pencil or cubes) on a frame shared by every bar compared. */
25661
+ function LengthBar({ length, max = 10, look = "ribbon", upright = false, label, className }) {
25662
+ if (!Number.isInteger(length) || length < 1 || length > max) throw new RangeError(`length must be a whole number from 1 to ${max}, not ${length}`);
25663
+ const cubes = `${length} cube${length === 1 ? "" : "s"}`;
25664
+ const said = label ?? (look === "cubes" ? upright ? `A tower of ${cubes}` : `A row of ${cubes}` : `A ${look} ${cubes} ${upright ? "tall" : "long"}`);
25665
+ return /* @__PURE__ */ jsx("svg", {
25666
+ viewBox: "0 0 200 200",
25667
+ role: "img",
25668
+ "aria-label": said,
25669
+ className: cn("block aspect-square w-full", className),
25670
+ children: /* @__PURE__ */ jsx("g", {
25671
+ transform: upright ? "rotate(-90 100 100)" : void 0,
25672
+ strokeWidth: 3,
25673
+ strokeLinejoin: "round",
25674
+ className: "stroke-foreground",
25675
+ "data-length": length,
25676
+ children: /* @__PURE__ */ jsx(Along, {
25677
+ length,
25678
+ max,
25679
+ look
25680
+ })
25681
+ })
25682
+ });
25683
+ }
25684
+
25685
+ // src/components/turn-arrow.tsx
25686
+ /** The four ways an arrow points, clockwise from up. */
25687
+ const FACINGS = [
25688
+ "up",
25689
+ "right",
25690
+ "down",
25691
+ "left"
25692
+ ];
25693
+ const DEGREES = {
25694
+ up: 0,
25695
+ right: 90,
25696
+ down: 180,
25697
+ left: 270
25698
+ };
25699
+ const round = (n) => Math.round(n * 100) / 100;
25700
+ /** Where an arrow points after a turn: up, a quarter turn clockwise, is right. */
25701
+ function turned(facing, turn) {
25702
+ const step = turn.clockwise ? turn.quarters : -turn.quarters;
25703
+ return FACINGS[((FACINGS.indexOf(facing) + step) % 4 + 4) % 4];
25704
+ }
25705
+ /** A turn as it is said: "a quarter turn clockwise", "a half turn", "a whole turn". A half or a whole turn ends in the
25706
+ * same place either way, so they are said without a direction. */
25707
+ function turnWords(turn) {
25708
+ const size = [
25709
+ "",
25710
+ "a quarter turn",
25711
+ "a half turn",
25712
+ "a three-quarter turn",
25713
+ "a whole turn"
25714
+ ][turn.quarters];
25715
+ if (turn.quarters === 2 || turn.quarters === 4) return size;
25716
+ return `${size} ${turn.clockwise ? "clockwise" : "anticlockwise"}`;
25717
+ }
25718
+ const R = 84;
25719
+ /** An arrow pointing up, right, down or left, with a turn drawn round it: the picture of quarter and half turns. */
25720
+ function TurnArrow({ facing, turn, label, className }) {
25721
+ const said = label ?? `An arrow pointing ${facing}${turn ? `, turning ${turnWords(turn)}` : ""}`;
25722
+ let arc = null;
25723
+ if (turn) {
25724
+ const start = DEGREES[facing] + (turn.clockwise ? 12 : -12);
25725
+ const sweep = Math.min(turn.quarters * 90, 336) - 24;
25726
+ const end = start + (turn.clockwise ? sweep : -sweep);
25727
+ const at = (deg, r = R) => {
25728
+ const t = deg * Math.PI / 180;
25729
+ return [round(100 + r * Math.sin(t)), round(100 - r * Math.cos(t))];
25730
+ };
25731
+ const [x0, y0] = at(start);
25732
+ const [x1, y1] = at(end);
25733
+ const large = sweep > 180 ? 1 : 0;
25734
+ const back = end + (turn.clockwise ? -10 : 10);
25735
+ const [ox, oy] = at(back, 93);
25736
+ const [ix, iy] = at(back, 75);
25737
+ arc = {
25738
+ d: `M${x0} ${y0} A${R} ${R} 0 ${large} ${turn.clockwise ? 1 : 0} ${x1} ${y1}`,
25739
+ head: `M${x1} ${y1} L${ox} ${oy} L${ix} ${iy} Z`
25740
+ };
25741
+ }
25742
+ return /* @__PURE__ */ jsxs("svg", {
25743
+ viewBox: "0 0 200 200",
25744
+ role: "img",
25745
+ "aria-label": said,
25746
+ className: cn("block aspect-square w-full", className),
25747
+ "data-facing": facing,
25748
+ children: [/* @__PURE__ */ jsx("g", {
25749
+ transform: `rotate(${DEGREES[facing]} 100 100)`,
25750
+ children: /* @__PURE__ */ jsx("path", {
25751
+ d: "M100 30 L140 78 L114 78 L114 165 L86 165 L86 78 L60 78 Z",
25752
+ strokeWidth: 4,
25753
+ strokeLinejoin: "round",
25754
+ className: "fill-primary stroke-foreground"
25755
+ })
25756
+ }), arc && /* @__PURE__ */ jsxs("g", {
25757
+ className: "stroke-secondary-9",
25758
+ children: [/* @__PURE__ */ jsx("path", {
25759
+ d: arc.d,
25760
+ strokeWidth: 6,
25761
+ strokeLinecap: "round",
25762
+ className: "fill-none"
25763
+ }), /* @__PURE__ */ jsx("path", {
25764
+ d: arc.head,
25765
+ strokeWidth: 2,
25766
+ strokeLinejoin: "round",
25767
+ className: "fill-secondary-9"
25768
+ })]
25769
+ })]
25770
+ });
25771
+ }
25772
+
25773
+ export { ActiveList, Alert, AlertDialog, AppShell, AsyncButton, BRUSHES, Balance, BookViewer, BoxList, BoxOverlay, BoxedPicture, Breadcrumb, BulkBar, Button, ButtonLink, ByteView, CLOCK_FACE_STYLES, CLOCK_STYLES, COINS, COLOR_SCHEME_STORAGE_KEY, Checkbox, ChoiceGrid, ChoiceGridSkeleton, ChoiceGroup, ClipsProvider, Clock, ClockFace, ColorField, ColorSchemeChoice, CommandLegend, CommandMenu, Compare, CompareAudio, CompareGrid, CompareText, CompareVideo, CompareVideoGrid, Composer, CompositionBar, Concealed, Console, ContextMenu, Conversation, CursorScope, DEFAULT_PALETTE, DEFAULT_TOLERANCE, DIGITAL_CLOCK_STYLES, DataTable, DataView$1 as DataView, Density, Dialog, DigitalClock, Disclosure, Done, DragSource, DrawingLayer, DrawingToolbar, EditListPlayer, EmptyState, EventLog, FACINGS, FIT, FRACTION_OUTLINES, Field, FileButton, FileDropOverlay, FileDropZone, FileOutcomes, FillLevel, FilmStrip, FolderPicker, FractionShape, FullscreenFrame, Glimpse, HttpError, INK_COLOURS, IconButton, InfiniteList, Input, InputLevel, Inspector, InspectorSection, JobStatus, JobsTable, JsonView, KeysLegend, LEVEL_FLOOR_DB, LengthBar, Lightbox, LineChart, LineChartGroup, LinkCard, LinkCardList, ListeningLevel, LoadError, LoadMore, MAX_SCALE, MAX_SIDE, MIN_SCALE, MISSING, Mark, MarkSummary, MarkableText, MediaContents, MediaGroup, MediaPlayer, MediaStage, Menu, Meter, Metric, MetricStrip, MicrophoneContext, MicrophoneError, MissingFile, Money, NBSP, NOTES, NativeSelect, NumberField, OutboxStatus, PALETTE_STORAGE_KEY, PageHeader, PairJudge, PairVote, PaletteChoice, Pane, PauseButton, PixelImage, PlaceBoard, PlayWindowButton, PlayerNotice, Popover, PropertyList, PropertyRow, RangeSlider, RateChoice, ReadAlong, RegionEditor, RichText, RowAction, SOLID_SHAPES, SPEECH_RATES, STRATA_DRAG_TYPE, SaveStatus, SayAgain, SayPicture, ScheduleTable, SecretField, SeekBar, SelectableGrid, SelectableGridSkeleton, SequenceTimeline, SetClock, ShortcutEditor, SideNav, Skeleton, Slider, Solid, SortableList, SpanActions, SpanStrip, Split, StageGuides, StaleNotice, Status, StrataQueryProvider, StrataToastRegion, Switch, SystemPanel, TableSkeleton, Tabs, TakeLevel, TextLink, Textarea, ThemeProvider, Thumbnail, ThumbnailSkeleton, TileGrid, TileGridSkeleton, TimeReadout, Timeline, TimelinePlayer, TimelineZoomControls, Toggle, ToggleGroup, Toolbar, ToolbarSeparator, Tooltip, TranscriptView, Transport, Tree, TurnArrow, UndoBar, ViewOptions, ViewportFrame, VirtualList, VolumeControl, Waveform, WorkflowSteps, WorkflowSummary, Workspace, WorkspaceBar, actualPixelsScale, ancestorsOf, apiPage, appBase, applyOp, boxViewport, browserMicrophone, buttonVariants, canFullscreen, canPlayClips, canSay, canSpeak, checkKey, clampToRoom, clampViewport, clipsQueryKey, clockParts, clockWords, cn, coinOutline, colorSchemeScript, commandShortcut, continues, countMarks, createApi, createFormat, createOutbox, createQueryClient, createReserve, createSegmenter, createTypedApi, crossedThreshold, currentItem, currentOf, curvePoints, dayPart, describeActionError, describeHttpError, describeRegion, describeWorkflowSummary, detectPlatform, diffWords, differences, digitalTime, diskThresholds, drawRect, drawingToSvg, ease, editTimeOf, editTimes, emptyDrawing, encodeWav, errorPayload, explainMicrophoneError, feedbackMarker, fetchJson, fieldErrorsOf, fillWords, filterMarkup, findPage, fitPoints, fitRect, followAim, format, formatChord, fractionParts, fractionWords, frameAt, gainToVolume, geo, gridPoints, gutterOf, hitsStroke, hourAt, inkMatch, inputLevelThresholds, invertOp, isDigitalStyle, isDoubtful, isRefusal, isReservedChord, isSpeaking, isTaskRunning, isTypingTarget, isWorkflowRunning, jobProgressText, joinMediaGroup, joinRects, joinSamples, jsonBranchPaths, keyName, labelOf, lerpRect, locateInEdit, logScale, loudnessOf, marksFor, matchEntities, matchGains, matchesAccept, matchesChord, measureLoudness, mediaStatRows, minutesAt, moneyWords, moveGutter, moveMinuteHand, movePoints, moveRect, newStrokeId, nextBreak, noOverlap, normaliseAngle, pageName, paletteScript, palettes, parentOf, parseChord, parseInline, parseRichText, parseSort, peakDb, peakGain, peaksFromAudio, phraseAt, phraseDoubtful, phraseOfWordId, pickEvenly, pickVoice, pixelZoom, plainText, pointsBox, rangeBetween, readErrorBody, readPixels, readingOrder, regionShares, regionStyle, replay, resample, resamplePeaks, rescaleDrawing, resizeRect, rgbaToBlob, rmsDb, romanHour, safeHref, sayPosition, serialiseSort, settleCut, simplifyPoints, skipAction, smoothPath, snapToGrid, solidWords, sortRows, speak, speechLevel, splitRect, staleOf, stepId, stepMinuteHand, stepOnGrid, stopSpeaking, strokeAt, strokeBox, strokeShape, summariseWorkflow, textOf, tickLabel, tickStep, ticksBetween, toDate, toLoad, toPeakPair, toast, toastTimeout, transportShortcuts, turnRect, turnWords, turned, turnedSize, typeSteps, useActiveItem, useAsyncAction, useAttachedSource, useAutoRecorder, useAutoSave, useBookUrl, useBoxes, useChoices, useClientWork, useClips, useColorScheme, useCommands, useCountdown, useDifference, useDrawing, useEditList, useExpanded, useFileIntake, useHistory, useHistoryState, useHotkeys, useInView, useInfiniteLoad, useInkMatch, useJob, useJobAction, useLeaveGuard, useLightboxUrl, useLoad, useMediaElement, useMediaSpans, useMediaStats, useMicrophone, useObjectUrl, useOutbox, useOutboxStarted, usePalette, usePlayerWarnings, usePoll, useReadAloud, useRebindableShortcuts, useRecorder, useReserve, useRevealed, useSayOnShow, useSearchParam, useSelection, useSettledStatus, useSharedCursor, useSpeaking, useSpeech, useSystemColorScheme, useSystemInfo, useTimeline, useTimelineZoom, useUndoable, useViewOptions, useViewPointers, useViewport, useWheelZoom, useWorkflowRun, useWorkspaceState, valueAt, viewOf, viewsOf, widthsOf, withBase, wordAt, wordId, zoomAt, zoomToBox };
24968
25774
  //# sourceMappingURL=index.js.map