@cardenelabs/dragon 0.43.0 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/README.md +21 -0
  2. package/dist/cli.cjs +6804 -5032
  3. package/dist/cli.cjs.map +1 -1
  4. package/dist/cli.js +6804 -5032
  5. package/dist/cli.js.map +1 -1
  6. package/dist/export.cjs +7172 -5536
  7. package/dist/export.cjs.map +1 -1
  8. package/dist/export.d.cts +1 -1
  9. package/dist/export.d.ts +1 -1
  10. package/dist/export.js +7171 -5537
  11. package/dist/export.js.map +1 -1
  12. package/dist/index.cjs +12244 -10449
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +55 -3
  15. package/dist/index.d.ts +55 -3
  16. package/dist/index.js +12244 -10449
  17. package/dist/index.js.map +1 -1
  18. package/dist/{ink-B6s_SMXG.d.cts → ink-DeDtzaTL.d.cts} +27 -3
  19. package/dist/{ink-B6s_SMXG.d.ts → ink-DeDtzaTL.d.ts} +27 -3
  20. package/dist/light/chunk-6ZUKJ3VO.js +489 -0
  21. package/dist/light/chunk-6ZUKJ3VO.js.map +1 -0
  22. package/dist/light/chunk-CLS6JVKK.cjs +84 -0
  23. package/dist/light/chunk-CLS6JVKK.cjs.map +1 -0
  24. package/dist/light/chunk-JNSHZTPF.js +1141 -0
  25. package/dist/light/chunk-JNSHZTPF.js.map +1 -0
  26. package/dist/light/chunk-OUQ44P45.cjs +489 -0
  27. package/dist/light/chunk-OUQ44P45.cjs.map +1 -0
  28. package/dist/light/chunk-VRAW7VAQ.cjs +1141 -0
  29. package/dist/light/chunk-VRAW7VAQ.cjs.map +1 -0
  30. package/dist/light/chunk-YDKPEKGZ.js +84 -0
  31. package/dist/light/chunk-YDKPEKGZ.js.map +1 -0
  32. package/dist/light/git-C4RVNFT6.js +637 -0
  33. package/dist/light/git-C4RVNFT6.js.map +1 -0
  34. package/dist/light/git-I7D7RIW2.cjs +637 -0
  35. package/dist/light/git-I7D7RIW2.cjs.map +1 -0
  36. package/dist/light/index.cjs +9885 -0
  37. package/dist/light/index.cjs.map +1 -0
  38. package/dist/light/index.d.cts +976 -0
  39. package/dist/light/index.d.ts +976 -0
  40. package/dist/light/index.js +9885 -0
  41. package/dist/light/index.js.map +1 -0
  42. package/dist/light/lineup-FAIKTH3Y.cjs +283 -0
  43. package/dist/light/lineup-FAIKTH3Y.cjs.map +1 -0
  44. package/dist/light/lineup-YEG4HHEI.js +283 -0
  45. package/dist/light/lineup-YEG4HHEI.js.map +1 -0
  46. package/dist/light/state-P3LIVI3K.js +335 -0
  47. package/dist/light/state-P3LIVI3K.js.map +1 -0
  48. package/dist/light/state-ZZUK6AQT.cjs +335 -0
  49. package/dist/light/state-ZZUK6AQT.cjs.map +1 -0
  50. package/dist/light/time-64DJKYAL.cjs +719 -0
  51. package/dist/light/time-64DJKYAL.cjs.map +1 -0
  52. package/dist/light/time-B5WUQOFP.js +719 -0
  53. package/dist/light/time-B5WUQOFP.js.map +1 -0
  54. package/dist/light/tree-5HPREYW2.js +478 -0
  55. package/dist/light/tree-5HPREYW2.js.map +1 -0
  56. package/dist/light/tree-66EH4QVI.cjs +478 -0
  57. package/dist/light/tree-66EH4QVI.cjs.map +1 -0
  58. package/dist/node.cjs +1932 -680
  59. package/dist/node.cjs.map +1 -1
  60. package/dist/node.js +1932 -680
  61. package/dist/node.js.map +1 -1
  62. package/dist/player.global.js +3 -3
  63. package/package.json +14 -2
  64. package/src/api.ts +71 -0
  65. package/src/field-messages.ts +6 -0
  66. package/src/figure-text.ts +4 -0
  67. package/src/index.ts +6 -65
  68. package/src/kinds/all.ts +16 -0
  69. package/src/kinds/git.ts +3 -0
  70. package/src/kinds/lineup.ts +3 -0
  71. package/src/kinds/registry.ts +46 -0
  72. package/src/kinds/state.ts +2 -0
  73. package/src/kinds/time.ts +3 -0
  74. package/src/kinds/tree.ts +3 -0
  75. package/src/layout/git.ts +0 -1
  76. package/src/layout/lineup.ts +218 -0
  77. package/src/layout/time.ts +0 -1
  78. package/src/layout/tree.ts +0 -1
  79. package/src/light.ts +31 -0
  80. package/src/look/values.ts +31 -2
  81. package/src/messages.ts +54 -0
  82. package/src/parser.ts +123 -1
  83. package/src/player-global.ts +3 -0
  84. package/src/player.ts +1 -1
  85. package/src/printer.ts +30 -1
  86. package/src/render/draw.ts +731 -0
  87. package/src/render/lineup.ts +184 -0
  88. package/src/render/parts.ts +19 -7
  89. package/src/render/svg.ts +4 -697
  90. package/src/render/time.ts +1 -4
  91. package/src/render/tree.ts +3 -2
  92. package/src/schema.ts +52 -4
  93. package/src/schemas/diagram.schema.json +145 -22
  94. package/src/schemas/validate-diagram.js +1 -1
  95. package/src/timeline.ts +14 -0
  96. package/src/view.ts +1 -1
  97. package/src/words.ts +15 -2
@@ -119,7 +119,10 @@ type DiagramEvent = {
119
119
  } | {
120
120
  type: "now";
121
121
  to: number;
122
- } | TimeMarkEvent | TimeSpanEvent | TreeLeaf | TreeNode;
122
+ } | TimeMarkEvent | TimeSpanEvent | TreeLeaf | TreeNode | LineupOrder | {
123
+ type: "seal" | "open" | "pick";
124
+ box: string;
125
+ } | LineupStamp;
123
126
  /** 時間軸の図 (#3165) の、印の列 `row` の `from` から `to` の目盛りの印の色を変える出来事 */
124
127
  interface TimeMarkEvent {
125
128
  type: "mark";
@@ -207,6 +210,24 @@ interface TreeNode {
207
210
  children: string[];
208
211
  hash?: string;
209
212
  }
213
+ /** 列の図 (#3239) の、列 `box` の並びを `items` に書き換える出来事。前の段との差分を描く部品が滑る動きに変える */
214
+ interface LineupOrder {
215
+ type: "line";
216
+ box: string;
217
+ items: string[];
218
+ }
219
+ /** 列の図の、列 `box` の右に `text` の札を押す出来事 */
220
+ interface LineupStamp {
221
+ type: "stamp";
222
+ box: string;
223
+ text: string;
224
+ }
225
+ /** 列の図のチップ。`color` を書かないチップは薄い色で、`label` を書かないチップは色だけで出す */
226
+ interface LineupItem {
227
+ id: string;
228
+ color?: Color;
229
+ label?: string;
230
+ }
210
231
  /** 枝分かれの図の枝。上から宣言した順に帯を並べる */
211
232
  interface GitBranch {
212
233
  id: string;
@@ -233,7 +254,7 @@ interface Step {
233
254
  }
234
255
  interface Diagram {
235
256
  version: number;
236
- kind: "sequence" | "architecture" | "state" | "git" | "time" | "tree";
257
+ kind: "sequence" | "architecture" | "state" | "git" | "time" | "tree" | "lineup";
237
258
  title: string;
238
259
  view?: ViewMode;
239
260
  regions?: Region[];
@@ -254,6 +275,9 @@ interface Diagram {
254
275
  branches: GitBranch[];
255
276
  };
256
277
  time?: TimeSpec;
278
+ lineup?: {
279
+ items: LineupItem[];
280
+ };
257
281
  }
258
282
  interface FieldError {
259
283
  /** 誤った欄の場所 (JSON Pointer) */
@@ -469,4 +493,4 @@ type Overlap = {
469
493
  */
470
494
  declare function describeOverlap(overlap: Overlap, lang?: NotationLang): string;
471
495
 
472
- export { type TimeSpanEvent as $, type SceneRegion as A, type Box as B, type CheckOptions as C, type Diagram as D, type SceneSide as E, type FieldError as F, type GitBranch as G, type SceneStrip as H, type InkPart as I, type SceneTrail as J, type StatePath as K, type Layout as L, type Step as M, type NotationLang as N, type Overlap as O, type Point as P, type StepSource as Q, type Rect as R, type SceneBox as S, type Theme as T, type StripMeter as U, type ViewMode as V, type TimeMarkEvent as W, type TimePeriod as X, type TimePoint as Y, type TimeRow as Z, type TimeScale as _, type ColorKey as a, type TimeSpec as a0, type TreeLeaf as a1, type TreeNode as a2, describeOverlap as a3, resolvePalette as a4, validateDiagram as a5, type TextStyle as b, type Colors as c, type Carry as d, type Checked as e, type Color as f, type ColorName as g, DEFAULT_PALETTE as h, type DiagramEvent as i, FONTS as j, type Family as k, type GitCommit as l, type LabelSide as m, type OverlapSpot as n, PALETTES as o, type Palette as p, READABLE_PX as q, type Region as r, type SceneAction as s, type SceneBadge as t, type SceneEdge as u, type SceneEnd as v, type SceneField as w, type SceneLabel as x, type SceneLifeline as y, type ScenePath as z };
496
+ export { type TimePoint as $, type SceneLabel as A, type Box as B, type CheckOptions as C, type Diagram as D, type SceneLifeline as E, type FieldError as F, type GitBranch as G, type ScenePath as H, type InkPart as I, type SceneRegion as J, type SceneSide as K, type Layout as L, type SceneStrip as M, type NotationLang as N, type Overlap as O, type Point as P, type SceneTrail as Q, type Rect as R, type SceneBox as S, type Theme as T, type StatePath as U, type ViewMode as V, type Step as W, type StepSource as X, type StripMeter as Y, type TimeMarkEvent as Z, type TimePeriod as _, type ColorKey as a, type TimeRow as a0, type TimeScale as a1, type TimeSpanEvent as a2, type TimeSpec as a3, type TreeLeaf as a4, type TreeNode as a5, describeOverlap as a6, resolvePalette as a7, validateDiagram as a8, type TextStyle as b, type Colors as c, type Carry as d, type Checked as e, type Color as f, type ColorName as g, DEFAULT_PALETTE as h, type DiagramEvent as i, FONTS as j, type Family as k, type GitCommit as l, type LabelSide as m, type LineupItem as n, type LineupOrder as o, type LineupStamp as p, type OverlapSpot as q, PALETTES as r, type Palette as s, READABLE_PX as t, type Region as u, type SceneAction as v, type SceneBadge as w, type SceneEdge as x, type SceneEnd as y, type SceneField as z };
@@ -119,7 +119,10 @@ type DiagramEvent = {
119
119
  } | {
120
120
  type: "now";
121
121
  to: number;
122
- } | TimeMarkEvent | TimeSpanEvent | TreeLeaf | TreeNode;
122
+ } | TimeMarkEvent | TimeSpanEvent | TreeLeaf | TreeNode | LineupOrder | {
123
+ type: "seal" | "open" | "pick";
124
+ box: string;
125
+ } | LineupStamp;
123
126
  /** 時間軸の図 (#3165) の、印の列 `row` の `from` から `to` の目盛りの印の色を変える出来事 */
124
127
  interface TimeMarkEvent {
125
128
  type: "mark";
@@ -207,6 +210,24 @@ interface TreeNode {
207
210
  children: string[];
208
211
  hash?: string;
209
212
  }
213
+ /** 列の図 (#3239) の、列 `box` の並びを `items` に書き換える出来事。前の段との差分を描く部品が滑る動きに変える */
214
+ interface LineupOrder {
215
+ type: "line";
216
+ box: string;
217
+ items: string[];
218
+ }
219
+ /** 列の図の、列 `box` の右に `text` の札を押す出来事 */
220
+ interface LineupStamp {
221
+ type: "stamp";
222
+ box: string;
223
+ text: string;
224
+ }
225
+ /** 列の図のチップ。`color` を書かないチップは薄い色で、`label` を書かないチップは色だけで出す */
226
+ interface LineupItem {
227
+ id: string;
228
+ color?: Color;
229
+ label?: string;
230
+ }
210
231
  /** 枝分かれの図の枝。上から宣言した順に帯を並べる */
211
232
  interface GitBranch {
212
233
  id: string;
@@ -233,7 +254,7 @@ interface Step {
233
254
  }
234
255
  interface Diagram {
235
256
  version: number;
236
- kind: "sequence" | "architecture" | "state" | "git" | "time" | "tree";
257
+ kind: "sequence" | "architecture" | "state" | "git" | "time" | "tree" | "lineup";
237
258
  title: string;
238
259
  view?: ViewMode;
239
260
  regions?: Region[];
@@ -254,6 +275,9 @@ interface Diagram {
254
275
  branches: GitBranch[];
255
276
  };
256
277
  time?: TimeSpec;
278
+ lineup?: {
279
+ items: LineupItem[];
280
+ };
257
281
  }
258
282
  interface FieldError {
259
283
  /** 誤った欄の場所 (JSON Pointer) */
@@ -469,4 +493,4 @@ type Overlap = {
469
493
  */
470
494
  declare function describeOverlap(overlap: Overlap, lang?: NotationLang): string;
471
495
 
472
- export { type TimeSpanEvent as $, type SceneRegion as A, type Box as B, type CheckOptions as C, type Diagram as D, type SceneSide as E, type FieldError as F, type GitBranch as G, type SceneStrip as H, type InkPart as I, type SceneTrail as J, type StatePath as K, type Layout as L, type Step as M, type NotationLang as N, type Overlap as O, type Point as P, type StepSource as Q, type Rect as R, type SceneBox as S, type Theme as T, type StripMeter as U, type ViewMode as V, type TimeMarkEvent as W, type TimePeriod as X, type TimePoint as Y, type TimeRow as Z, type TimeScale as _, type ColorKey as a, type TimeSpec as a0, type TreeLeaf as a1, type TreeNode as a2, describeOverlap as a3, resolvePalette as a4, validateDiagram as a5, type TextStyle as b, type Colors as c, type Carry as d, type Checked as e, type Color as f, type ColorName as g, DEFAULT_PALETTE as h, type DiagramEvent as i, FONTS as j, type Family as k, type GitCommit as l, type LabelSide as m, type OverlapSpot as n, PALETTES as o, type Palette as p, READABLE_PX as q, type Region as r, type SceneAction as s, type SceneBadge as t, type SceneEdge as u, type SceneEnd as v, type SceneField as w, type SceneLabel as x, type SceneLifeline as y, type ScenePath as z };
496
+ export { type TimePoint as $, type SceneLabel as A, type Box as B, type CheckOptions as C, type Diagram as D, type SceneLifeline as E, type FieldError as F, type GitBranch as G, type ScenePath as H, type InkPart as I, type SceneRegion as J, type SceneSide as K, type Layout as L, type SceneStrip as M, type NotationLang as N, type Overlap as O, type Point as P, type SceneTrail as Q, type Rect as R, type SceneBox as S, type Theme as T, type StatePath as U, type ViewMode as V, type Step as W, type StepSource as X, type StripMeter as Y, type TimeMarkEvent as Z, type TimePeriod as _, type ColorKey as a, type TimeRow as a0, type TimeScale as a1, type TimeSpanEvent as a2, type TimeSpec as a3, type TreeLeaf as a4, type TreeNode as a5, describeOverlap as a6, resolvePalette as a7, validateDiagram as a8, type TextStyle as b, type Colors as c, type Carry as d, type Checked as e, type Color as f, type ColorName as g, DEFAULT_PALETTE as h, type DiagramEvent as i, FONTS as j, type Family as k, type GitCommit as l, type LabelSide as m, type LineupItem as n, type LineupOrder as o, type LineupStamp as p, type OverlapSpot as q, PALETTES as r, type Palette as s, READABLE_PX as t, type Region as u, type SceneAction as v, type SceneBadge as w, type SceneEdge as x, type SceneEnd as y, type SceneField as z };
@@ -0,0 +1,489 @@
1
+ import {
2
+ EASE,
3
+ FIGURE_TEXT,
4
+ LOOK,
5
+ MOTION,
6
+ TYPE,
7
+ along,
8
+ carrierHalf,
9
+ crossesRect,
10
+ hasWide,
11
+ markText,
12
+ pathLength,
13
+ textBox,
14
+ textWidth
15
+ } from "./chunk-JNSHZTPF.js";
16
+
17
+ // src/render/icons.ts
18
+ var ICONS = {
19
+ app: "M -9 -7 h18 a2 2 0 0 1 2 2 v10 a2 2 0 0 1 -2 2 h-18 a2 2 0 0 1 -2 -2 v-10 a2 2 0 0 1 2 -2 z M -11 -2 h22",
20
+ router: "M -9 -4 h16 M 3 -8 l4 4 l-4 4 M 9 5 h-16 M -3 1 l-4 4 l4 4",
21
+ on: "M -7 7 L 7 -7 M -1 -7 h8 v8",
22
+ off: "M -7 -7 L 7 7 M 7 -1 v8 h-8",
23
+ pool: "M -9 -5 a9 3.5 0 1 0 18 0 a9 3.5 0 1 0 -18 0 M -9 -5 v10 a9 3.5 0 0 0 18 0 v-10 M -9 0 a9 3.5 0 0 0 18 0",
24
+ db: "M -9 -5 a9 3.5 0 1 0 18 0 a9 3.5 0 1 0 -18 0 M -9 -5 v10 a9 3.5 0 0 0 18 0 v-10 M -9 0 a9 3.5 0 0 0 18 0",
25
+ exe: "M -5 -8 L 7 0 L -5 8 Z",
26
+ idx: "M -9 -7 h18 M -9 -2 h18 M -9 3 h18 M -9 8 h11",
27
+ sign: "M -9 4 c 3 -9 5 -9 6 0 s 3 7 6 -2 s 3 -6 6 0",
28
+ env: "M -8 -5.5 h16 v11 h-16 z M -8 -5.5 l8 6 l8 -6",
29
+ lock: "M -5.5 -1 h11 v8 h-11 z M -3.5 -1 v-3 a3.5 3.5 0 0 1 7 0 v3",
30
+ check: "M -5 0 l3.5 3.5 l6.5 -7",
31
+ flag: "M -4 8 V -8 M -4 -7 H 6 L 3.5 -3.5 L 6 0 H -4",
32
+ x: "M -5 -5 l10 10 M 5 -5 l-10 10",
33
+ chain: "M -1.5 4.5 l-2 2 a3.5 3.5 0 0 1 -5 -5 l3 -3 a3.5 3.5 0 0 1 5 0 M 1.5 -4.5 l2 -2 a3.5 3.5 0 0 1 5 5 l-3 3 a3.5 3.5 0 0 1 -5 0 M -2.5 2.5 l5 -5",
34
+ net: "M -1.3 -4.6 L -5.8 3 M 1.3 -4.6 L 5.8 3 M -4.3 5.5 H 4.3 M -2.2 -7 a 2.2 2.2 0 1 0 4.4 0 a 2.2 2.2 0 1 0 -4.4 0 M -9.2 5.5 a 2.2 2.2 0 1 0 4.4 0 a 2.2 2.2 0 1 0 -4.4 0 M 4.8 5.5 a 2.2 2.2 0 1 0 4.4 0 a 2.2 2.2 0 1 0 -4.4 0",
35
+ user: "M -4 -4.5 a4 4 0 1 0 8 0 a4 4 0 1 0 -8 0 M -8 9 c0 -5 3.6 -7.5 8 -7.5 s8 2.5 8 7.5",
36
+ server: "M -9 -8 h18 v7 h-18 z M -9 1 h18 v7 h-18 z M -5 -4.5 h0.01 M -5 4.5 h0.01",
37
+ key: "M -9 0 a3.5 3.5 0 1 0 7 0 a3.5 3.5 0 1 0 -7 0 M -2 0 h10 M 5 0 v3.5 M 8 0 v2.5",
38
+ shield: "M 0 -9 l8 3 v5 c0 5 -3.5 8 -8 10 c-4.5 -2 -8 -5 -8 -10 v-5 z",
39
+ globe: "M -9 0 a9 9 0 1 0 18 0 a9 9 0 1 0 -18 0 M -9 0 h18 M 0 -9 c-4.5 4 -4.5 14 0 18 M 0 -9 c4.5 4 4.5 14 0 18",
40
+ bolt: "M 2 -9 L -5 1 h5 l-2 8 l7 -10 h-5 z",
41
+ doc: "M -6 -9 h8 l5 5 v13 h-13 z M 2 -9 v5 h5 M -3 1 h7 M -3 5 h5",
42
+ box: "M -9 -4.5 l9 -4.5 l9 4.5 v9 l-9 4.5 l-9 -4.5 z M -9 -4.5 l9 4.5 l9 -4.5 M 0 0 v9",
43
+ truck: "M -10 -6 h11 v10 h-11 z M 1 -2 h5 l3.5 3.5 v2.5 h-8.5 M -7.5 6.5 a1.8 1.8 0 1 0 3.6 0 a1.8 1.8 0 1 0 -3.6 0 M 3 6.5 a1.8 1.8 0 1 0 3.6 0 a1.8 1.8 0 1 0 -3.6 0",
44
+ card: "M -9 -6.5 h18 a2 2 0 0 1 2 2 v9 a2 2 0 0 1 -2 2 h-18 a2 2 0 0 1 -2 -2 v-9 a2 2 0 0 1 2 -2 z M -11 -2 h22 M -7 3 h5",
45
+ cart: "M -10 -8 h3 l3 11 h11 l2.5 -8 h-15.5 M -4.5 7.5 a1.5 1.5 0 1 0 3 0 a1.5 1.5 0 1 0 -3 0 M 5 7.5 a1.5 1.5 0 1 0 3 0 a1.5 1.5 0 1 0 -3 0",
46
+ clock: "M -9 0 a9 9 0 1 0 18 0 a9 9 0 1 0 -18 0 M 0 -5 v5 l3.5 2.5",
47
+ branch: "M -4 -4.5 v9 M 5 0.5 c0 4 -9 3 -9 6.5 M -6.2 -7 a2.2 2.2 0 1 0 4.4 0 a2.2 2.2 0 1 0 -4.4 0 M -6.2 7 a2.2 2.2 0 1 0 4.4 0 a2.2 2.2 0 1 0 -4.4 0 M 2.8 -2 a2.2 2.2 0 1 0 4.4 0 a2.2 2.2 0 1 0 -4.4 0",
48
+ cloud: "M -7 6 h13 a4.5 4.5 0 0 0 0.5 -9 a6 6 0 0 0 -11.5 -1 a4.5 4.5 0 0 0 -2 10 z",
49
+ refresh: "M 7 -3 a7.5 7.5 0 1 0 0.5 5 M 7.5 -8 v5 h-5",
50
+ undo: "M -7 -2 h10 a5 5 0 0 1 0 10 h-6 M -3 -6 l-4 4 l4 4",
51
+ yen: "M -6 -8 l6 7 l6 -7 M 0 -1 v9 M -5 1.5 h10 M -5 5 h10",
52
+ layers: "M 0 -8 l9 4.5 l-9 4.5 l-9 -4.5 z M -9 2.5 l9 4.5 l9 -4.5",
53
+ code: "M -4 -6 l-5 6 l5 6 M 4 -6 l5 6 l-5 6",
54
+ paint: "M -8 8 c 0 -3 2 -5 4.5 -5 l 9 -9 l 3.5 3.5 l -9 9 c 0 2.5 -2 4.5 -5 4.5 z",
55
+ tree: "M 0 -5 v4 M -6 -1 h12 M -6 -1 v3 M 6 -1 v3 M -9 2 h6 v6 h-6 z M 3 2 h6 v6 h-6 z M -3 -10 h6 v5 h-6 z",
56
+ block: "M -9 -7 h18 a2 2 0 0 1 2 2 v10 a2 2 0 0 1 -2 2 h-18 a2 2 0 0 1 -2 -2 v-10 a2 2 0 0 1 2 -2 z M -11 -2.5 h22 M -6 2.5 h8"
57
+ };
58
+
59
+ // src/render/ink.ts
60
+ var ALWAYS = [[0, Number.POSITIVE_INFINITY]];
61
+ var BITE = 0.5;
62
+ var visible = (item, t) => item.shown.some(([a, b]) => a <= t && t < b);
63
+ var spotOf = (ink) => ({ text: ink.text, rect: { x: ink.rect.x, y: ink.rect.y, w: ink.rect.w, h: ink.rect.h }, badge: ink.badge === true, ...ink.part ? { part: ink.part } : {} });
64
+ function findOverlaps(inks, stills, traces = []) {
65
+ const out = [];
66
+ stills.forEach((t, step) => {
67
+ const seen = inks.filter((ink) => visible(ink, t));
68
+ seen.forEach((a, i) => {
69
+ for (const b of seen.slice(i + 1)) {
70
+ const w = Math.min(a.rect.x + a.rect.w, b.rect.x + b.rect.w) - Math.max(a.rect.x, b.rect.x);
71
+ const h = Math.min(a.rect.y + a.rect.h, b.rect.y + b.rect.h) - Math.max(a.rect.y, b.rect.y);
72
+ if (w > BITE && h > BITE) out.push({ kind: "texts", step, texts: [a.text, b.text], spots: [spotOf(a), spotOf(b)] });
73
+ }
74
+ });
75
+ const lines = traces.filter((trace) => visible(trace, t));
76
+ for (const ink of seen) {
77
+ if (ink.boxed) continue;
78
+ for (const line of lines) if (crossesRect(line.points, ink.rect, BITE)) out.push({ kind: "line", step, text: ink.text, line: { from: line.from, to: line.to }, spots: [spotOf(ink)] });
79
+ }
80
+ });
81
+ return out;
82
+ }
83
+ function describeOverlap(overlap, lang = "ja") {
84
+ const t = FIGURE_TEXT[lang];
85
+ const partName = (part) => part.kind === "icon" ? t.iconOf(part.box) : part.kind === "coin" ? t.coin : t.envelope;
86
+ const name = (spot) => spot.badge ? t.badgeName(spot.text) : spot.part ? partName(spot.part) : t.quoted(spot.text);
87
+ if (overlap.kind === "texts") return t.textsOverlap(name(overlap.spots[0]), name(overlap.spots[1]));
88
+ return t.lineCrosses(overlap.line.from, overlap.line.to, name(overlap.spots[0]));
89
+ }
90
+
91
+ // src/render/parts.ts
92
+ var esc = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
93
+ var linkTo = (link, markup) => link === void 0 ? markup : `<a href="${esc(link)}">${markup}</a>`;
94
+ var r1 = (v) => Math.round(v * 100) / 100;
95
+ var cs = (k) => k === "coin" ? "--c:var(--coin);--ct:var(--coint)" : `--c:var(--c-${k});--ct:var(--t-${k})`;
96
+ function glyph(name, x, y, scale, cls = "dg-gl") {
97
+ const d = name === void 0 ? void 0 : ICONS[name];
98
+ return d ? `<path class="${cls}" transform="translate(${r1(x)} ${r1(y)}) scale(${scale})" d="${d}"/>` : "";
99
+ }
100
+ function iconSvg(name) {
101
+ if (!Object.hasOwn(ICONS, name)) return void 0;
102
+ const width = LOOK.stroke.glyph * LOOK.box.iconScale;
103
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="-12 -12 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="${width}" stroke-linecap="round" stroke-linejoin="round"><path d="${ICONS[name]}"/></svg>`;
104
+ }
105
+ function pathOf(points) {
106
+ const pts = points.filter((p, i) => i === 0 || p[0] !== points[i - 1][0] || p[1] !== points[i - 1][1]);
107
+ const [x0, y0] = pts[0];
108
+ let d = `M ${r1(x0)} ${r1(y0)}`;
109
+ for (let i = 1; i < pts.length - 1; i++) {
110
+ const [ax, ay] = pts[i - 1];
111
+ const [bx, by] = pts[i];
112
+ const [cx, cy] = pts[i + 1];
113
+ const l1 = Math.hypot(bx - ax, by - ay);
114
+ const l2 = Math.hypot(cx - bx, cy - by);
115
+ const a = Math.min(LOOK.edge.bend, l1 / 2, l2 / 2);
116
+ d += ` L ${r1(bx - (bx - ax) / l1 * a)} ${r1(by - (by - ay) / l1 * a)} Q ${r1(bx)} ${r1(by)} ${r1(bx + (cx - bx) / l2 * a)} ${r1(by + (cy - by) / l2 * a)}`;
117
+ }
118
+ if (pts.length > 1) {
119
+ const [lx, ly] = pts[pts.length - 1];
120
+ d += ` L ${r1(lx)} ${r1(ly)}`;
121
+ }
122
+ return d;
123
+ }
124
+ function arrowHead(points) {
125
+ const [ex, ey] = points[points.length - 1];
126
+ const [px, py] = points[points.length - 2];
127
+ const len = Math.hypot(ex - px, ey - py) || 1;
128
+ const dx = (ex - px) / len;
129
+ const dy = (ey - py) / len;
130
+ const { arrow: a, arrowHalf: h } = LOOK.edge;
131
+ return `M ${r1(ex - dx * a - dy * h)} ${r1(ey - dy * a + dx * h)} L ${r1(ex)} ${r1(ey)} L ${r1(ex - dx * a + dy * h)} ${r1(ey - dy * a - dx * h)}`;
132
+ }
133
+ var sansOf = (t) => ({ ...t, family: "sans" });
134
+ function write(ink, cls, x, y, text, style, shown = ALWAYS, anchor) {
135
+ ink?.push({ text, rect: textBox(text, x, y, style, anchor), shown });
136
+ return `<text class="${cls}" x="${r1(x)}" y="${r1(y)}"${anchor ? ` text-anchor="${anchor}"` : ""}>${esc(text)}</text>`;
137
+ }
138
+ function rangeKf(m, ranges) {
139
+ const pts = [[0, { opacity: 0 }]];
140
+ for (const [a, b] of ranges) pts.push([a, { opacity: 0 }, EASE.out], [a + MOTION.fade, { opacity: 1 }], [b - 0.1, { opacity: 1 }, EASE.inOut], [b + 0.25, { opacity: 0 }]);
141
+ pts.push([m.total, { opacity: 0 }]);
142
+ return m.kf(pts);
143
+ }
144
+ function activeKf(ctx, on) {
145
+ const ranges = [];
146
+ for (let k = 0; k < on.length; ) {
147
+ let e = k;
148
+ while (e + 1 < on.length && on[e + 1] === on[e] + 1) e++;
149
+ ranges.push([ctx.t.steps[on[k]].start, ctx.t.steps[on[e]].end]);
150
+ k = e + 1;
151
+ }
152
+ return rangeKf(ctx.m, ranges);
153
+ }
154
+ function band(region, ink) {
155
+ const { radius, icon, iconRadius, iconScale, nameY, line } = LOOK.region;
156
+ const { x, y } = region.header;
157
+ const lines = region.lines.map((t, k) => write(ink, "dg-bz", x, region.y + nameY + k * line, t, TYPE.regionName)).join("");
158
+ const note = region.note ? write(ink, "dg-bx", x, region.y + nameY + region.lines.length * line + 1, region.note, TYPE.regionNote) : "";
159
+ const mark = region.icon && ICONS[region.icon] ? `<rect class="dg-bi" x="${r1(x)}" y="${r1(y)}" width="${icon}" height="${icon}" rx="${iconRadius}"/>${glyph(region.icon, x + icon / 2, y + icon / 2, iconScale)}` : "";
160
+ return `<g style="${cs(region.color)}"><rect class="dg-band" x="${r1(region.x + 0.5)}" y="${r1(region.y + 0.5)}" width="${r1(region.w - 1)}" height="${r1(region.h - 1)}" rx="${radius}"/>${mark}${lines}${note}</g>`;
161
+ }
162
+ function subLines(box, m, changes, y, ink, right) {
163
+ const seq = [[0, box.sub ?? "", "dg-ss"], ...changes];
164
+ return seq.map(([t, text, cls], k) => {
165
+ const next = seq[k + 1]?.[0];
166
+ const anim = k === 0 ? next === void 0 ? "" : m.until(next - MOTION.untilFade) : next === void 0 ? m.rise(t) : m.rise(t, next - MOTION.untilFade);
167
+ if (text === "") return "";
168
+ const shown = [[k === 0 ? 0 : t, next === void 0 ? Number.POSITIVE_INFINITY : next - MOTION.untilFade]];
169
+ const style = cls === "dg-ss" ? TYPE.boxSub : TYPE.boxSubStrong;
170
+ const drawn = right === void 0 ? write(ink, cls, box.cx, y, text, style, shown, "middle") : write(ink, cls, right - textWidth(text, style), y, text, style, shown);
171
+ return `<g${anim ? ` class="dg-a" style="${anim}"` : ""}>${drawn}</g>`;
172
+ }).join("");
173
+ }
174
+ function cardFrame(box, ctx, act, y, h) {
175
+ const rect = (cls, extra = "") => `<rect class="${cls}" x="${r1(box.x)}" y="${r1(y)}" width="${r1(box.w)}" height="${h}" rx="${LOOK.box.radius}"${extra}/>`;
176
+ return `${act ? `<g class="dg-a" style="${act}">${rect("dg-halo")}</g>` : ""}${rect("dg-st", ` ${ctx.sh}`)}${act ? `<g class="dg-a" style="${act}">${rect("dg-on")}</g>` : ""}`;
177
+ }
178
+ function card(box, ctx, on, changes, lit) {
179
+ const { icon, iconRadius, iconScale, iconY, nameY, subY } = LOOK.box;
180
+ const subs = subLines(box, ctx.m, changes, box.cy + subY, ctx.ink);
181
+ const act = lit ? lit.length > 0 ? rangeKf(ctx.m, lit.map((s) => [s.start, s.end])) : void 0 : on.length > 0 ? activeKf(ctx, on) : void 0;
182
+ const ix = box.iconX ?? box.cx;
183
+ const slot = box.slot ? `<rect class="dg-slot" x="${r1(box.slot.x)}" y="${r1(box.slot.y)}" width="${r1(box.slot.w)}" height="${r1(box.slot.h)}" rx="${LOOK.slot.radius}"/>` : "";
184
+ let mark = "";
185
+ if (box.icon && ICONS[box.icon]) {
186
+ const rect = { x: ix - icon / 2, y: box.cy + iconY - icon / 2, w: icon, h: icon };
187
+ ctx.ink.push({ text: `${box.name} \u306E\u7D75\u67C4`, rect, shown: ALWAYS, boxed: true, part: { kind: "icon", box: box.name } });
188
+ mark = `<rect class="dg-ic" x="${r1(rect.x)}" y="${r1(rect.y)}" width="${icon}" height="${icon}" rx="${iconRadius}"/>${glyph(box.icon, ix, box.cy + iconY, iconScale)}`;
189
+ }
190
+ return `<g style="${cs(box.color)}">${cardFrame(box, ctx, act, box.y, box.h)}${slot}${mark}${write(ctx.ink, "dg-sn", box.cx, box.cy + nameY, box.name, TYPE.boxName, ALWAYS, "middle")}${subs}</g>`;
191
+ }
192
+ function headCard(box, ctx, on, changes) {
193
+ const { pad, h, nameY, subY } = LOOK.follow.head;
194
+ const subs = subLines(box, ctx.m, changes, pad + subY);
195
+ const act = on.length > 0 ? activeKf(ctx, on) : void 0;
196
+ return `<g style="${cs(box.color)}">${cardFrame(box, ctx, act, pad, h)}<text class="dg-sn" x="${r1(box.cx)}" y="${r1(pad + nameY)}" text-anchor="middle">${esc(box.name)}</text>${subs}</g>`;
197
+ }
198
+ function ghostCard(box, ink) {
199
+ const { icon, iconRadius, iconScale, radius } = LOOK.box;
200
+ const G = LOOK.state.ghost;
201
+ const ix = box.x + G.pad + icon / 2;
202
+ const tx = box.x + G.pad + icon + G.gap;
203
+ const mark = box.icon && ICONS[box.icon] ? `<rect class="dg-ic" x="${r1(ix - icon / 2)}" y="${r1(box.cy - icon / 2)}" width="${icon}" height="${icon}" rx="${iconRadius}"/>${glyph(box.icon, ix, box.cy, iconScale)}` : "";
204
+ const nameY = box.sub ? G.nameY : LOOK.baseline.mark;
205
+ const sub = box.sub ? write(ink, "dg-ss", tx, box.cy + G.subY, box.sub, TYPE.boxSub, ALWAYS, "start") : "";
206
+ return `<g data-ghost="${esc(box.id)}" style="${cs(box.color)}"><rect class="dg-ghost" x="${r1(box.x)}" y="${r1(box.y)}" width="${r1(box.w)}" height="${box.h}" rx="${radius}"/>${mark}${write(ink, "dg-sn", tx, box.cy + nameY, box.name, TYPE.boxName, ALWAYS, "start")}${sub}</g>`;
207
+ }
208
+ function doneMark(box, at, ctx) {
209
+ const { r, inset } = LOOK.state.done;
210
+ const x = box.x + box.w - inset;
211
+ const y = box.y + inset;
212
+ return `<g class="dg-popc dg-a" data-done="${esc(box.id)}" style="${cs(box.color)};${ctx.m.pop(at)}"><circle class="dg-done" cx="${r1(x)}" cy="${r1(y)}" r="${r}"/>${glyph("check", x, y, 0.5, "dg-done-ck")}</g>`;
213
+ }
214
+ function path(p, color, ink, traces) {
215
+ traces.push({ from: p.from, to: p.to, points: p.points, shown: ALWAYS });
216
+ const sans = p.label?.family === "sans";
217
+ const label2 = p.label ? write(ink, `dg-path-t${sans ? " dg-path-tj" : ""}`, p.label.x + LOOK.label.padX, p.label.y + p.label.h / 2 + LOOK.baseline.label, p.label.text, sans ? TYPE.labelJa : TYPE.label) : "";
218
+ return `<g data-path="${esc(`${p.from}->${p.to}`)}" style="${cs(color)}"><path class="dg-path" d="${pathOf(p.points)}"/><path class="dg-path-h" d="${arrowHead(p.points)}"/>${label2}</g>`;
219
+ }
220
+ function side(s, color, ink) {
221
+ const { pad } = LOOK.state.side;
222
+ const title = s.y + pad + TYPE.regionName.size;
223
+ const notes = s.notes.map((note, k) => write(ink, "dg-side-n", s.x + pad, title + LOOK.region.line * (k + 1), note, TYPE.regionNote)).join("");
224
+ return `<g style="${cs(color)}"><rect class="dg-side" x="${r1(s.x + 0.5)}" y="${r1(s.y + 0.5)}" width="${r1(s.w - 1)}" height="${r1(s.h - 1)}" rx="${LOOK.region.radius}"/>${write(ink, "dg-side-t", s.x + pad, title, s.title, TYPE.regionName)}${notes}</g>`;
225
+ }
226
+ function endMark(e, color, ink) {
227
+ const { end } = LOOK.state;
228
+ const at = markText(e);
229
+ const text = e.text === "" ? "" : write(ink, "dg-mark", at[0], at[1], e.text, TYPE.regionNote);
230
+ const x = r1(e.x);
231
+ const y = r1(e.y);
232
+ if (e.kind === "start") return `<g data-end="start"><circle class="dg-start" cx="${x}" cy="${y}" r="${e.r}"/>${text}</g>`;
233
+ if (e.ghost) return `<g data-end="finish" style="${cs(color)}"><circle class="dg-end-x" cx="${x}" cy="${y}" r="${e.r}"/><circle class="dg-end-xi" cx="${x}" cy="${y}" r="${end.inner}"/>${text}</g>`;
234
+ return `<g data-end="finish"><circle class="dg-end" cx="${x}" cy="${y}" r="${e.r}"/><circle class="dg-end-in" cx="${x}" cy="${y}" r="${end.inner}"/>${text}</g>`;
235
+ }
236
+ function lifeline(x, y1, y2) {
237
+ return `<line class="dg-ll" x1="${r1(x)}" y1="${r1(y1)}" x2="${r1(x)}" y2="${r1(y2)}"/>`;
238
+ }
239
+ function edge(e, time, ctx, past = false, since = 0) {
240
+ const { m } = ctx;
241
+ ctx.traces.push({ from: e.from, to: e.to, points: e.points, shown: since > 0 ? [[since, Number.POSITIVE_INFINITY]] : ALWAYS });
242
+ const d = pathOf(e.points);
243
+ const head = arrowHead(e.points);
244
+ const { start: a, drawn: b, end } = time;
245
+ const tail = past ? [
246
+ [end, { opacity: 1 }, EASE.inOut],
247
+ [end + 0.4, { opacity: 0 }],
248
+ [m.total, { opacity: 0 }]
249
+ ] : [
250
+ [end, { opacity: 1 }, EASE.inOut],
251
+ [end + 0.4, { opacity: 0.45 }],
252
+ [ctx.end + 0.3, { opacity: 0.45 }, EASE.inOut],
253
+ [ctx.end + 1, { opacity: 0.95 }],
254
+ [m.last, { opacity: 0.95 }, EASE.inOut],
255
+ [m.total, { opacity: 0 }]
256
+ ];
257
+ const line = m.kf([
258
+ [0, { opacity: 0, "stroke-dashoffset": 1 }],
259
+ [a, { opacity: 0, "stroke-dashoffset": 1 }, EASE.inOut],
260
+ [a + 0.05, { opacity: 1 }],
261
+ [b, { "stroke-dashoffset": 0 }],
262
+ [m.last, { "stroke-dashoffset": 0 }],
263
+ [m.total, { "stroke-dashoffset": 1 }],
264
+ ...tail
265
+ ]);
266
+ const hk = m.kf([[0, { opacity: 0 }], [b - 0.05, { opacity: 0 }], [b, { opacity: 1 }], ...tail]);
267
+ const run = -(end - b) * 26;
268
+ const flow = m.kf([
269
+ [0, { opacity: 0, "stroke-dashoffset": 0 }],
270
+ [b, { opacity: 0, "stroke-dashoffset": 0 }],
271
+ [b + 0.25, { opacity: 0.9 }],
272
+ [end - 0.1, { opacity: 0.9 }, EASE.inOut],
273
+ [end + 0.2, { opacity: 0, "stroke-dashoffset": run }],
274
+ [m.total, { opacity: 0, "stroke-dashoffset": run }]
275
+ ]);
276
+ const grey = past ? m.kf([[0, { opacity: 0 }], [end, { opacity: 0 }, EASE.inOut], [end + 0.4, { opacity: 1 }], [m.last, { opacity: 1 }, EASE.inOut], [m.total, { opacity: 0 }]]) : "";
277
+ const path2 = `<path class="dg-e" d="${d}"/><path class="dg-eh" d="${head}"/>`;
278
+ return {
279
+ base: `${since > 0 ? `<g class="dg-a" style="${m.vis(since)}">${path2}</g>` : path2}${past ? `<path class="dg-e-past dg-a" d="${d}" style="${grey}"/><path class="dg-eh-past dg-a" d="${head}" style="${grey}"/>` : ""}`,
280
+ lit: `<g style="${cs(e.color)}"><path class="dg-e-on dg-a" pathLength="1" d="${d}" style="${line}"/><path class="dg-eh-on dg-a" d="${head}" style="${hk}"/><path class="dg-flow dg-a" d="${d}" style="${flow}"/></g>`
281
+ };
282
+ }
283
+ function label(l, time, ctx) {
284
+ const ja = l.family === "sans" ? " dg-capj" : "";
285
+ const { radius } = LOOK.label;
286
+ const shown = time.again ? [[time.start, time.end], [time.again.start, time.again.end]] : [[time.start, time.end]];
287
+ ctx.ink.push({ text: l.text, rect: l, shown, boxed: true });
288
+ if (time.after) ctx.ink.push({ text: l.text, rect: textBox(l.text, l.x + l.w / 2, l.y + l.h / 2 + LOOK.baseline.label, l.family === "sans" ? TYPE.labelJa : TYPE.label, "middle"), shown: [[time.after.start, time.after.end]] });
289
+ const x = r1(l.x + l.w / 2);
290
+ const y = r1(l.y + l.h / 2 + LOOK.baseline.label);
291
+ const past = time.after ? `<g class="dg-cap-past${l.family === "sans" ? " dg-cap-pastj" : ""} dg-a" style="${ctx.m.vis(time.after.start, time.after.end)}"><text x="${x}" y="${y}" text-anchor="middle">${esc(l.text)}</text></g>` : "";
292
+ const caps = shown.map(([a, b]) => `<g class="dg-cap${ja} dg-a" style="${cs(l.color)};${ctx.m.rise(a, b, true)}"><rect x="${r1(l.x)}" y="${r1(l.y)}" width="${r1(l.w)}" height="${l.h}" rx="${radius}"/><text x="${x}" y="${y}" text-anchor="middle">${esc(l.text)}</text></g>`);
293
+ return `${past}${caps.join("")}`;
294
+ }
295
+ function action(a, at, until, ctx, again) {
296
+ const shown = again ? [[at, until], [again.start, again.end]] : [[at, until]];
297
+ ctx.ink.push({ text: a.text, rect: a, shown, boxed: true });
298
+ return shown.map(
299
+ ([from, to]) => `<g class="dg-act dg-a" style="${cs(a.color)};${ctx.m.rise(from, to, true)}"><rect x="${r1(a.x)}" y="${r1(a.y)}" width="${r1(a.w)}" height="${a.h}" rx="${LOOK.action.radius}"/><text x="${r1(a.x + a.w / 2)}" y="${r1(a.y + a.h / 2 + LOOK.baseline.action)}" text-anchor="middle">${esc(a.text)}</text></g>`
300
+ ).join("");
301
+ }
302
+ function carrierShape(e, sh) {
303
+ const C = LOOK.carrier;
304
+ if (e.carry.kind === "coin") return `<circle class="dg-coin" r="${C.coinR}"/><circle class="dg-coin-in" r="${C.coinIn}"/>`;
305
+ if (e.carry.kind === "tag") {
306
+ const text = e.carry.text;
307
+ const ja = hasWide(text);
308
+ const w = textWidth(text, ja ? TYPE.carrierJa : TYPE.carrier) + C.tagPadX * 2;
309
+ return `<rect class="dg-car" x="${r1(-w / 2)}" y="${-C.tagH / 2}" width="${r1(w)}" height="${C.tagH}" rx="${C.tagH / 2}" ${sh}/><text class="dg-car-t${ja ? " dg-car-tj" : ""}" y="${LOOK.baseline.carrier}" text-anchor="middle">${esc(text)}</text>`;
310
+ }
311
+ return `<rect class="dg-env" x="${-C.envW / 2}" y="${-C.envH / 2}" width="${C.envW}" height="${C.envH}" rx="3" ${sh}/><path class="dg-env-in" d="M -8 -4.5 L 0 1.5 L 8 -4.5"/>`;
312
+ }
313
+ var easeInOut = (t) => t < 0.5 ? 4 * t * t * t : 1 - (-2 * t + 2) ** 3 / 2;
314
+ function carrier(e, time, ctx) {
315
+ const { m } = ctx;
316
+ const n = LOOK.carrier.samples;
317
+ const route = e.wait ? [e.wait, ...e.points] : e.points;
318
+ const length = pathLength(route);
319
+ const { depart: a, arrive: b, start: from, end: gone } = time;
320
+ const path2 = [];
321
+ for (let k = 0; k <= n; k++) {
322
+ const [x, y] = along(route, easeInOut(k / n) * length);
323
+ path2.push([a + (b - a) * k / n, x, y]);
324
+ }
325
+ const first = path2[0];
326
+ const lastPoint = path2[path2.length - 1];
327
+ const rest = e.settle ?? [lastPoint[1], lastPoint[2]];
328
+ const pts = [[0, first[1], first[2]], ...path2];
329
+ if (e.settle) pts.push([Math.min(b + 0.3, Math.max(gone, b + 0.01)), rest[0], rest[1]]);
330
+ pts.push([gone, rest[0], rest[1]], [m.total, rest[0], rest[1]]);
331
+ const [hx, hy] = carrierHalf(e.carry);
332
+ const name = e.carry.kind === "tag" ? e.carry.text : e.carry.kind === "coin" ? "\u786C\u8CA8" : "\u5C01\u7B52";
333
+ const part = e.carry.kind === "tag" ? {} : { part: { kind: e.carry.kind === "coin" ? "coin" : "envelope" } };
334
+ const box = (p) => ({ x: p[0] - hx, y: p[1] - hy, w: hx * 2, h: hy * 2 });
335
+ if (a > from) ctx.ink.push({ text: name, rect: box([first[1], first[2]]), shown: [[from, a]], boxed: true, ...part });
336
+ ctx.ink.push({ text: name, rect: box(rest), shown: [[b, gone]], boxed: true, ...part });
337
+ const fade = gone < m.last ? 0.05 : 0.18;
338
+ return `<g class="dg-a" style="${m.move(pts, m.blink(from + 0.02, gone, fade))}">${carrierShape(e, ctx.sh)}</g>`;
339
+ }
340
+ function badge(b, ctx, grey = false) {
341
+ const { m } = ctx;
342
+ const span = ctx.t.steps[b.step];
343
+ const a = span.start;
344
+ const e = span.end;
345
+ const { r, ring: rr } = LOOK.badge;
346
+ const shown = { visibility: "visible" };
347
+ const hidden = { visibility: "hidden" };
348
+ const swap = b.until === void 0 ? void 0 : ctx.t.steps[b.until].start;
349
+ const next = swap !== void 0 && swap <= e + 1e-6;
350
+ const fill = m.kf([
351
+ [0, { opacity: 0, transform: "scale(.5)", ...hidden }],
352
+ [a, { opacity: 0, transform: "scale(.5)", ...hidden }, EASE.pop],
353
+ [a + 0.35, { opacity: 1, transform: "scale(1)", ...shown }],
354
+ [e, { opacity: 1, transform: "scale(1)", ...shown }, EASE.inOut],
355
+ [e + (next ? MOTION.untilFade : 0.4), { opacity: 0, transform: "scale(1)", ...hidden }],
356
+ [m.total, { opacity: 0, transform: "scale(.5)", ...hidden }]
357
+ ]);
358
+ const pastEnd = swap ?? m.last;
359
+ const past = next ? m.kf([
360
+ [0, { opacity: 0, ...hidden }],
361
+ [m.total, { opacity: 0, ...hidden }]
362
+ ]) : m.kf([
363
+ [0, { opacity: 0, ...hidden }],
364
+ [e, { opacity: 0, ...hidden }, EASE.inOut],
365
+ [e + 0.4, { opacity: 1, ...shown }],
366
+ [pastEnd, { opacity: 1, ...shown }, EASE.inOut],
367
+ ...swap === void 0 ? [] : [[swap + MOTION.untilFade, { opacity: 0, ...hidden }]],
368
+ [m.total, { opacity: 0, ...hidden }]
369
+ ]);
370
+ const ring = m.kf([
371
+ [0, { opacity: 0, transform: "scale(1)" }],
372
+ [a + 0.05, { opacity: 0, transform: "scale(1)" }],
373
+ [a + 0.1, { opacity: 0.7, transform: "scale(1)" }, EASE.out],
374
+ [a + 0.9, { opacity: 0, transform: "scale(2.3)" }],
375
+ [m.total, { opacity: 0, transform: "scale(1)" }]
376
+ ]);
377
+ const x = r1(b.x);
378
+ const y = r1(b.y);
379
+ const ty = r1(b.y + LOOK.baseline.badge);
380
+ const no = b.step + 1;
381
+ ctx.ink.push({ text: String(no), rect: { x: b.x - r, y: b.y - r, w: r * 2, h: r * 2 }, shown: [[a, pastEnd]], boxed: true, badge: true });
382
+ return `<g class="dg-bd" data-step="${b.step}" style="${cs(b.color)}"><circle class="dg-bdr dg-popc dg-a" cx="${x}" cy="${y}" r="${rr}" style="${ring}"/><g class="dg-a" style="${past}"><circle class="${grey ? "dg-bdp-g" : "dg-bdp"}" cx="${x}" cy="${y}" r="${rr}"/><text class="${grey ? "dg-bdpt-g" : "dg-bdpt"}" x="${x}" y="${ty}" text-anchor="middle">${no}</text></g><g class="dg-popc dg-a" style="${fill}"><circle class="dg-bdf" cx="${x}" cy="${y}" r="${r}"/><text class="dg-bdft" x="${x}" y="${ty}" text-anchor="middle">${no}</text></g></g>`;
383
+ }
384
+ function strip(s, changes, ctx, now = false, arrivals = /* @__PURE__ */ new Map(), meter) {
385
+ const { m, sh } = ctx;
386
+ const S = LOOK.strip;
387
+ const my = s.y + S.h / 2;
388
+ const parts = [
389
+ `<rect class="dg-strip" x="${r1(s.x + 0.5)}" y="${r1(s.y + 0.5)}" width="${r1(s.w - 1)}" height="${r1(s.h - 1)}" rx="${LOOK.region.radius}" ${sh}/>`,
390
+ `<g style="${cs("slate")}"><rect class="dg-bi" x="${r1(s.x + S.pad)}" y="${r1(my - S.icon / 2)}" width="${S.icon}" height="${S.icon}" rx="${LOOK.box.iconRadius}"/>${glyph("env", s.x + S.pad + S.icon / 2, my, 0.78)}</g>`,
391
+ write(ctx.ink, "dg-sh", s.x + S.titleX, my + LOOK.baseline.stripTitle, s.title, TYPE.stripTitle)
392
+ ];
393
+ s.fields.forEach((field, i) => {
394
+ const prev = s.fields[i - 1];
395
+ if (prev && prev.y === field.y) {
396
+ const sx = field.x - S.fieldGap / 2;
397
+ parts.push(`<line class="dg-sep" x1="${r1(sx)}" y1="${r1(field.y + S.sepInset)}" x2="${r1(sx)}" y2="${r1(field.y + S.h - S.sepInset)}"/>`);
398
+ }
399
+ parts.push(write(ctx.ink, "dg-fl", field.x, field.y + S.nameY, field.name, TYPE.fieldName));
400
+ const gauge = meter?.(field);
401
+ if (gauge !== void 0) {
402
+ parts.push(gauge);
403
+ return;
404
+ }
405
+ const list = changes.get(field.name) ?? [];
406
+ const values = list.filter((c) => c.value !== void 0);
407
+ const tags = list.filter((c) => c.tag !== void 0);
408
+ values.forEach((c, k) => {
409
+ const next = values[k + 1]?.at;
410
+ const value = c.value;
411
+ const cls = hasWide(value) ? "dg-fvj" : "dg-fv";
412
+ ctx.ink.push({ text: value, rect: textBox(value, field.x, field.y + S.valueY, hasWide(value) ? TYPE.fieldValueJa : TYPE.fieldValue), shown: [[c.at, next === void 0 ? Number.POSITIVE_INFINITY : next - MOTION.untilFade]] });
413
+ const textOf = (c2) => `<text class="${c2}" x="${r1(field.x)}" y="${r1(field.y + S.valueY)}">${esc(value)}</text>`;
414
+ const text = textOf(cls);
415
+ if (!now) {
416
+ const anim = next === void 0 ? m.rise(c.at) : m.rise(c.at, next - MOTION.untilFade);
417
+ parts.push(`<g class="dg-a" style="${anim}">${text}</g>`);
418
+ return;
419
+ }
420
+ const until = Math.min(c.until, next ?? c.until);
421
+ const dot = `<circle class="dg-fl-now" cx="${r1(field.x + textWidth(field.name, TYPE.fieldName) + S.now.gap)}" cy="${r1(field.y + S.nameY - TYPE.fieldName.size / 3)}" r="${S.now.r}"/>`;
422
+ parts.push(`<g class="dg-fv-now dg-a" data-step="${c.step}" style="${cs(c.color)};${m.rise(c.at, until - MOTION.untilFade)}">${textOf(`${cls} dg-fv-c`)}${dot}</g>`);
423
+ if (next === void 0 || next > until) parts.push(`<g class="dg-a" style="${m.vis(until - MOTION.untilFade, next === void 0 ? m.last : next - MOTION.untilFade)}">${text}</g>`);
424
+ });
425
+ tags.forEach((c, k) => {
426
+ const next = tags[k + 1]?.at;
427
+ const tag = c.tag;
428
+ const shown = [...values].reverse().find((v) => v.at <= c.at + 1e-9)?.value;
429
+ const x = field.x + (shown ? textWidth(shown, hasWide(shown) ? TYPE.fieldValueJa : TYPE.fieldValue) + S.tagGap : 0);
430
+ const w = textWidth(tag, TYPE.tag) + S.tagPadX * 2;
431
+ const y = field.y + S.valueY - S.tagH / 2 - LOOK.baseline.tag;
432
+ ctx.ink.push({ text: tag, rect: { x, y, w, h: S.tagH }, shown: [[c.at, next === void 0 ? Number.POSITIVE_INFINITY : next - MOTION.untilFade]], boxed: true });
433
+ parts.push(
434
+ `<g class="dg-tg dg-popc dg-a" style="${cs(c.color)};${next === void 0 ? m.pop(c.at) : m.pop(c.at, next - MOTION.untilFade)}"><rect x="${r1(x)}" y="${r1(y)}" width="${r1(w)}" height="${S.tagH}" rx="${S.tagH / 2}"/><text x="${r1(x + w / 2)}" y="${r1(y + S.tagH / 2 + LOOK.baseline.tag)}" text-anchor="middle">${esc(tag)}</text></g>`
435
+ );
436
+ });
437
+ });
438
+ if (s.trail) {
439
+ const t = s.trail;
440
+ const last = s.fields[s.fields.length - 1];
441
+ if (last && last.y === t.y) {
442
+ const sx = t.x - S.fieldGap / 2;
443
+ parts.push(`<line class="dg-sep" x1="${r1(sx)}" y1="${r1(t.y + S.sepInset)}" x2="${r1(sx)}" y2="${r1(t.y + S.h - S.sepInset)}"/>`);
444
+ }
445
+ parts.push(write(ctx.ink, "dg-fl", t.x, t.y + S.nameY, t.title, TYPE.fieldName));
446
+ const dy = t.y + S.valueY - TYPE.fieldValue.size / 3;
447
+ t.states.forEach((state, k) => {
448
+ const cx = r1(t.x + S.trail.r + k * S.trail.step);
449
+ const at = arrivals.get(state.box);
450
+ const fill = at === void 0 ? "" : `<circle class="dg-tr-fill dg-a" cx="${cx}" cy="${r1(dy)}" r="${S.trail.r}" style="${m.pop(at)}"/>`;
451
+ parts.push(`<g data-trail="${esc(state.box)}" style="${cs(state.color)}"><circle class="dg-tr-ring" cx="${cx}" cy="${r1(dy)}" r="${S.trail.r}"/>${fill}</g>`);
452
+ });
453
+ }
454
+ return parts.join("");
455
+ }
456
+
457
+ export {
458
+ ICONS,
459
+ ALWAYS,
460
+ findOverlaps,
461
+ describeOverlap,
462
+ esc,
463
+ linkTo,
464
+ cs,
465
+ glyph,
466
+ iconSvg,
467
+ pathOf,
468
+ arrowHead,
469
+ sansOf,
470
+ write,
471
+ activeKf,
472
+ band,
473
+ subLines,
474
+ card,
475
+ headCard,
476
+ ghostCard,
477
+ doneMark,
478
+ path,
479
+ side,
480
+ endMark,
481
+ lifeline,
482
+ edge,
483
+ label,
484
+ action,
485
+ carrier,
486
+ badge,
487
+ strip
488
+ };
489
+ //# sourceMappingURL=chunk-6ZUKJ3VO.js.map