@cardenelabs/dragon 0.45.5 → 0.46.1

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 (72) hide show
  1. package/README.ja.md +331 -0
  2. package/README.md +200 -188
  3. package/dist/cli.cjs +148 -111
  4. package/dist/cli.cjs.map +1 -1
  5. package/dist/cli.js +148 -111
  6. package/dist/cli.js.map +1 -1
  7. package/dist/export.cjs +139 -109
  8. package/dist/export.cjs.map +1 -1
  9. package/dist/export.js +139 -109
  10. package/dist/export.js.map +1 -1
  11. package/dist/index.cjs +99 -62
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.js +99 -62
  14. package/dist/index.js.map +1 -1
  15. package/dist/light/chunk-CLS6JVKK.cjs.map +1 -1
  16. package/dist/light/{chunk-EHTQUCW4.js → chunk-DVGDEPCV.js} +6 -2
  17. package/dist/light/chunk-DVGDEPCV.js.map +1 -0
  18. package/dist/light/{chunk-5OQV42W3.cjs → chunk-SUL4AJLI.cjs} +6 -2
  19. package/dist/light/chunk-SUL4AJLI.cjs.map +1 -0
  20. package/dist/light/{chunk-JCEKXALJ.cjs → chunk-V34DCH34.cjs} +90 -87
  21. package/dist/light/chunk-V34DCH34.cjs.map +1 -0
  22. package/dist/light/{chunk-YEQSLVIN.js → chunk-YO3UBEC3.js} +12 -9
  23. package/dist/light/chunk-YO3UBEC3.js.map +1 -0
  24. package/dist/light/{git-K3KAAAWW.cjs → git-WBGFDRBD.cjs} +59 -59
  25. package/dist/light/git-WBGFDRBD.cjs.map +1 -0
  26. package/dist/light/{git-GESUYKGR.js → git-WEJL6VAY.js} +3 -3
  27. package/dist/light/index.cjs +407 -375
  28. package/dist/light/index.cjs.map +1 -1
  29. package/dist/light/index.js +92 -60
  30. package/dist/light/index.js.map +1 -1
  31. package/dist/light/{lineup-2V2U7HZH.js → lineup-6LN6Z5T2.js} +3 -3
  32. package/dist/light/{lineup-623J25LU.cjs → lineup-WLGNGTFX.cjs} +40 -40
  33. package/dist/light/lineup-WLGNGTFX.cjs.map +1 -0
  34. package/dist/light/{state-T4OTVING.js → state-DFYTMQI7.js} +2 -2
  35. package/dist/light/{state-OZVCHX7H.cjs → state-JVAH4TSM.cjs} +41 -41
  36. package/dist/light/state-JVAH4TSM.cjs.map +1 -0
  37. package/dist/light/{time-KVMZIKYF.cjs → time-EXRPI34B.cjs} +84 -84
  38. package/dist/light/time-EXRPI34B.cjs.map +1 -0
  39. package/dist/light/{time-O4CMTUV5.js → time-M3EGEFDU.js} +3 -3
  40. package/dist/light/{tree-6D7KI57H.cjs → tree-DECHTXFU.cjs} +62 -62
  41. package/dist/light/tree-DECHTXFU.cjs.map +1 -0
  42. package/dist/light/{tree-ZJZQI5QT.js → tree-MFU54QKY.js} +3 -3
  43. package/dist/node.cjs +115 -49
  44. package/dist/node.cjs.map +1 -1
  45. package/dist/node.js +115 -49
  46. package/dist/node.js.map +1 -1
  47. package/dist/player.global.js +3 -3
  48. package/package.json +1 -1
  49. package/src/field-messages.ts +4 -0
  50. package/src/look/values.ts +5 -1
  51. package/src/messages.ts +11 -1
  52. package/src/nearest.ts +37 -0
  53. package/src/parser.ts +4 -2
  54. package/src/render/draw.ts +2 -1
  55. package/src/render/parts.ts +28 -7
  56. package/src/schema.ts +27 -3
  57. package/src/schemas/diagram.schema.json +3 -2
  58. package/src/schemas/validate-diagram.js +1 -1
  59. package/dist/light/chunk-5OQV42W3.cjs.map +0 -1
  60. package/dist/light/chunk-EHTQUCW4.js.map +0 -1
  61. package/dist/light/chunk-JCEKXALJ.cjs.map +0 -1
  62. package/dist/light/chunk-YEQSLVIN.js.map +0 -1
  63. package/dist/light/git-K3KAAAWW.cjs.map +0 -1
  64. package/dist/light/lineup-623J25LU.cjs.map +0 -1
  65. package/dist/light/state-OZVCHX7H.cjs.map +0 -1
  66. package/dist/light/time-KVMZIKYF.cjs.map +0 -1
  67. package/dist/light/tree-6D7KI57H.cjs.map +0 -1
  68. /package/dist/light/{git-GESUYKGR.js.map → git-WEJL6VAY.js.map} +0 -0
  69. /package/dist/light/{lineup-2V2U7HZH.js.map → lineup-6LN6Z5T2.js.map} +0 -0
  70. /package/dist/light/{state-T4OTVING.js.map → state-DFYTMQI7.js.map} +0 -0
  71. /package/dist/light/{time-O4CMTUV5.js.map → time-M3EGEFDU.js.map} +0 -0
  72. /package/dist/light/{tree-ZJZQI5QT.js.map → tree-MFU54QKY.js.map} +0 -0
package/dist/export.js CHANGED
@@ -317,7 +317,11 @@ var LOOK = {
317
317
  gap: 10,
318
318
  /** 図の外周の余白 */
319
319
  margin: 14,
320
- box: { h: 72, minW: 92, padX: 12, radius: 12, icon: 24, iconRadius: 7, iconY: -16, iconScale: 0.74, nameY: 12, subY: 27 },
320
+ /**
321
+ * 箱。`iconY` と `nameY` と `subY` は箱の真ん中から絵柄の真ん中と名前と下の字の基準線まで。
322
+ * `nameMid` と `subMid` はアイコンも置き場の枠も持つ箱が無い図の名前と下の字の基準線で、名前を箱の真ん中に置き、下の字を名前から `subY - nameY` と同じ間で置く (#3307、#3309)
323
+ */
324
+ box: { h: 72, minW: 92, padX: 12, radius: 12, icon: 24, iconRadius: 7, iconY: -16, iconScale: 0.74, nameY: 12, nameMid: 5, subY: 27, subMid: 20 },
321
325
  region: { pad: 18, gap: 10, radius: 14, inset: 14, icon: 24, iconRadius: 7, iconScale: 0.68, nameY: 58, line: 16, minH: 108 },
322
326
  architecture: { columns: 4, columnGap: 56, maxColumnGap: 160, rowGap: 44, labelRoom: 16 },
323
327
  /**
@@ -829,8 +833,8 @@ function longest(points) {
829
833
  }
830
834
  return { a: best.a, b: best.b, vertical: Math.abs(best.b[0] - best.a[0]) < Math.abs(best.b[1] - best.a[1]) };
831
835
  }
832
- function along(points, distance) {
833
- let left = distance;
836
+ function along(points, distance2) {
837
+ let left = distance2;
834
838
  for (let i = 1; i < points.length; i++) {
835
839
  const a = points[i - 1];
836
840
  const b = points[i];
@@ -1663,6 +1667,7 @@ var ja = {
1663
1667
  additionalProperties: (key) => `${key} \u3068\u3044\u3046\u6B04\u306F\u66F8\u3051\u306A\u3044`,
1664
1668
  required: (key) => `${key} \u306E\u6B04\u304C\u8981\u308B`,
1665
1669
  enum: (values) => `${values.join(" / ")} \u306E\u3069\u308C\u304B\u306B\u3059\u308B`,
1670
+ unknownIcon: (value, near) => `${value} \u3068\u3044\u3046 icon \u306F\u7121\u3044\u3002\u8FD1\u3044\u540D\u524D\u306F ${near}`,
1666
1671
  type: (type) => TYPES_JA[type] ?? `${type} \u306B\u3059\u308B`,
1667
1672
  minLength: (limit) => `${limit} \u5B57\u4EE5\u4E0A\u66F8\u304F`,
1668
1673
  maxLength: (limit) => `${limit} \u5B57\u307E\u3067\u306B\u3059\u308B`,
@@ -1687,6 +1692,7 @@ var en = {
1687
1692
  additionalProperties: (key) => `The ${key} field is not allowed`,
1688
1693
  required: (key) => `The ${key} field is required`,
1689
1694
  enum: (values) => `Use one of ${values.join(" / ")}`,
1695
+ unknownIcon: (value, near) => `There is no icon named ${value}. The closest is ${near}`,
1690
1696
  type: (type) => TYPES_EN[type] ?? `Use ${type}`,
1691
1697
  minLength: (limit) => `Write at least ${plural(limit, "character")}`,
1692
1698
  maxLength: (limit) => `Write at most ${plural(limit, "character")}`,
@@ -1709,6 +1715,75 @@ var en = {
1709
1715
  };
1710
1716
  var FIELD_MESSAGES = { ja, en };
1711
1717
 
1718
+ // src/nearest.ts
1719
+ var MAX_DISTANCE = 2;
1720
+ function nearest(word, candidates) {
1721
+ const written = [...word.toLowerCase()];
1722
+ let limit = Math.min(MAX_DISTANCE, written.length - 1);
1723
+ let best;
1724
+ for (const candidate of candidates) {
1725
+ const d = distance(written, [...candidate.toLowerCase()]);
1726
+ if (d > limit) continue;
1727
+ best = candidate;
1728
+ limit = d - 1;
1729
+ }
1730
+ return best;
1731
+ }
1732
+ function distance(a, b) {
1733
+ let previous = Array.from({ length: b.length + 1 }, (_, j) => j);
1734
+ for (let i = 1; i <= a.length; i++) {
1735
+ const current = [i];
1736
+ for (let j = 1; j <= b.length; j++) {
1737
+ const replace = previous[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1);
1738
+ current.push(Math.min(previous[j] + 1, current[j - 1] + 1, replace));
1739
+ }
1740
+ previous = current;
1741
+ }
1742
+ return previous[b.length];
1743
+ }
1744
+
1745
+ // src/render/icons.ts
1746
+ var ICONS = {
1747
+ 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",
1748
+ 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",
1749
+ on: "M -7 7 L 7 -7 M -1 -7 h8 v8",
1750
+ off: "M -7 -7 L 7 7 M 7 -1 v8 h-8",
1751
+ 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",
1752
+ 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",
1753
+ exe: "M -5 -8 L 7 0 L -5 8 Z",
1754
+ idx: "M -9 -7 h18 M -9 -2 h18 M -9 3 h18 M -9 8 h11",
1755
+ sign: "M -9 4 c 3 -9 5 -9 6 0 s 3 7 6 -2 s 3 -6 6 0",
1756
+ env: "M -8 -5.5 h16 v11 h-16 z M -8 -5.5 l8 6 l8 -6",
1757
+ 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",
1758
+ check: "M -5 0 l3.5 3.5 l6.5 -7",
1759
+ flag: "M -4 8 V -8 M -4 -7 H 6 L 3.5 -3.5 L 6 0 H -4",
1760
+ x: "M -5 -5 l10 10 M 5 -5 l-10 10",
1761
+ 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",
1762
+ 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",
1763
+ 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",
1764
+ 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",
1765
+ 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",
1766
+ 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",
1767
+ 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",
1768
+ bolt: "M 2 -9 L -5 1 h5 l-2 8 l7 -10 h-5 z",
1769
+ doc: "M -6 -9 h8 l5 5 v13 h-13 z M 2 -9 v5 h5 M -3 1 h7 M -3 5 h5",
1770
+ 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",
1771
+ 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",
1772
+ 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",
1773
+ 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",
1774
+ 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",
1775
+ 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",
1776
+ 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",
1777
+ refresh: "M 7 -3 a7.5 7.5 0 1 0 0.5 5 M 7.5 -8 v5 h-5",
1778
+ undo: "M -7 -2 h10 a5 5 0 0 1 0 10 h-6 M -3 -6 l-4 4 l4 4",
1779
+ yen: "M -6 -8 l6 7 l6 -7 M 0 -1 v9 M -5 1.5 h10 M -5 5 h10",
1780
+ 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",
1781
+ code: "M -4 -6 l-5 6 l5 6 M 4 -6 l5 6 l-5 6",
1782
+ 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",
1783
+ 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",
1784
+ 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"
1785
+ };
1786
+
1712
1787
  // src/schemas/validate-diagram.js
1713
1788
  function ucs2length(str) {
1714
1789
  let length = 0;
@@ -2667,6 +2742,7 @@ function validate25(data, { instancePath = "", parentData, parentDataProperty, r
2667
2742
  return errors === 0;
2668
2743
  }
2669
2744
  var schema79 = { "enum": ["blue", "amber", "green", "violet", "rose", "slate", "coin"] };
2745
+ var schema80 = { "enum": ["app", "router", "on", "off", "pool", "db", "exe", "idx", "sign", "env", "lock", "check", "flag", "x", "chain", "net", "user", "server", "key", "shield", "globe", "bolt", "doc", "box", "truck", "card", "cart", "clock", "branch", "cloud", "refresh", "undo", "yen", "layers", "code", "paint", "tree", "block"] };
2670
2746
  var pattern0 = new RegExp("^[^\\s\\[\\]\u300C\u300D=:]+$", "u");
2671
2747
  var func3 = ucs2length;
2672
2748
  function validate30(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
@@ -2782,32 +2858,22 @@ function validate30(data, { instancePath = "", parentData, parentDataProperty, r
2782
2858
  }
2783
2859
  if (data.icon !== void 0) {
2784
2860
  let data4 = data.icon;
2785
- if (typeof data4 === "string") {
2786
- if (func3(data4) < 1) {
2787
- const err10 = { instancePath: instancePath + "/icon", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
2788
- if (vErrors === null) {
2789
- vErrors = [err10];
2790
- } else {
2791
- vErrors.push(err10);
2792
- }
2793
- errors++;
2794
- }
2795
- } else {
2796
- const err11 = { instancePath: instancePath + "/icon", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2861
+ if (!(data4 === "app" || data4 === "router" || data4 === "on" || data4 === "off" || data4 === "pool" || data4 === "db" || data4 === "exe" || data4 === "idx" || data4 === "sign" || data4 === "env" || data4 === "lock" || data4 === "check" || data4 === "flag" || data4 === "x" || data4 === "chain" || data4 === "net" || data4 === "user" || data4 === "server" || data4 === "key" || data4 === "shield" || data4 === "globe" || data4 === "bolt" || data4 === "doc" || data4 === "box" || data4 === "truck" || data4 === "card" || data4 === "cart" || data4 === "clock" || data4 === "branch" || data4 === "cloud" || data4 === "refresh" || data4 === "undo" || data4 === "yen" || data4 === "layers" || data4 === "code" || data4 === "paint" || data4 === "tree" || data4 === "block")) {
2862
+ const err10 = { instancePath: instancePath + "/icon", schemaPath: "#/definitions/icon/enum", keyword: "enum", params: { allowedValues: schema80.enum }, message: "must be equal to one of the allowed values" };
2797
2863
  if (vErrors === null) {
2798
- vErrors = [err11];
2864
+ vErrors = [err10];
2799
2865
  } else {
2800
- vErrors.push(err11);
2866
+ vErrors.push(err10);
2801
2867
  }
2802
2868
  errors++;
2803
2869
  }
2804
2870
  }
2805
2871
  } else {
2806
- const err12 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2872
+ const err11 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2807
2873
  if (vErrors === null) {
2808
- vErrors = [err12];
2874
+ vErrors = [err11];
2809
2875
  } else {
2810
- vErrors.push(err12);
2876
+ vErrors.push(err11);
2811
2877
  }
2812
2878
  errors++;
2813
2879
  }
@@ -2928,22 +2994,12 @@ function validate32(data, { instancePath = "", parentData, parentDataProperty, r
2928
2994
  }
2929
2995
  if (data.icon !== void 0) {
2930
2996
  let data4 = data.icon;
2931
- if (typeof data4 === "string") {
2932
- if (func3(data4) < 1) {
2933
- const err10 = { instancePath: instancePath + "/icon", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
2934
- if (vErrors === null) {
2935
- vErrors = [err10];
2936
- } else {
2937
- vErrors.push(err10);
2938
- }
2939
- errors++;
2940
- }
2941
- } else {
2942
- const err11 = { instancePath: instancePath + "/icon", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2997
+ if (!(data4 === "app" || data4 === "router" || data4 === "on" || data4 === "off" || data4 === "pool" || data4 === "db" || data4 === "exe" || data4 === "idx" || data4 === "sign" || data4 === "env" || data4 === "lock" || data4 === "check" || data4 === "flag" || data4 === "x" || data4 === "chain" || data4 === "net" || data4 === "user" || data4 === "server" || data4 === "key" || data4 === "shield" || data4 === "globe" || data4 === "bolt" || data4 === "doc" || data4 === "box" || data4 === "truck" || data4 === "card" || data4 === "cart" || data4 === "clock" || data4 === "branch" || data4 === "cloud" || data4 === "refresh" || data4 === "undo" || data4 === "yen" || data4 === "layers" || data4 === "code" || data4 === "paint" || data4 === "tree" || data4 === "block")) {
2998
+ const err10 = { instancePath: instancePath + "/icon", schemaPath: "#/definitions/icon/enum", keyword: "enum", params: { allowedValues: schema80.enum }, message: "must be equal to one of the allowed values" };
2943
2999
  if (vErrors === null) {
2944
- vErrors = [err11];
3000
+ vErrors = [err10];
2945
3001
  } else {
2946
- vErrors.push(err11);
3002
+ vErrors.push(err10);
2947
3003
  }
2948
3004
  errors++;
2949
3005
  }
@@ -2952,20 +3008,20 @@ function validate32(data, { instancePath = "", parentData, parentDataProperty, r
2952
3008
  let data5 = data.region;
2953
3009
  if (typeof data5 === "string") {
2954
3010
  if (!pattern0.test(data5)) {
2955
- const err12 = { instancePath: instancePath + "/region", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
3011
+ const err11 = { instancePath: instancePath + "/region", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
2956
3012
  if (vErrors === null) {
2957
- vErrors = [err12];
3013
+ vErrors = [err11];
2958
3014
  } else {
2959
- vErrors.push(err12);
3015
+ vErrors.push(err11);
2960
3016
  }
2961
3017
  errors++;
2962
3018
  }
2963
3019
  } else {
2964
- const err13 = { instancePath: instancePath + "/region", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3020
+ const err12 = { instancePath: instancePath + "/region", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2965
3021
  if (vErrors === null) {
2966
- vErrors = [err13];
3022
+ vErrors = [err12];
2967
3023
  } else {
2968
- vErrors.push(err13);
3024
+ vErrors.push(err12);
2969
3025
  }
2970
3026
  errors++;
2971
3027
  }
@@ -2974,30 +3030,30 @@ function validate32(data, { instancePath = "", parentData, parentDataProperty, r
2974
3030
  let data6 = data.link;
2975
3031
  if (typeof data6 === "string") {
2976
3032
  if (!pattern3.test(data6)) {
2977
- const err14 = { instancePath: instancePath + "/link", schemaPath: "#/definitions/url/pattern", keyword: "pattern", params: { pattern: "^(/|https?://)" }, message: 'must match pattern "^(/|https?://)"' };
3033
+ const err13 = { instancePath: instancePath + "/link", schemaPath: "#/definitions/url/pattern", keyword: "pattern", params: { pattern: "^(/|https?://)" }, message: 'must match pattern "^(/|https?://)"' };
2978
3034
  if (vErrors === null) {
2979
- vErrors = [err14];
3035
+ vErrors = [err13];
2980
3036
  } else {
2981
- vErrors.push(err14);
3037
+ vErrors.push(err13);
2982
3038
  }
2983
3039
  errors++;
2984
3040
  }
2985
3041
  } else {
2986
- const err15 = { instancePath: instancePath + "/link", schemaPath: "#/definitions/url/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3042
+ const err14 = { instancePath: instancePath + "/link", schemaPath: "#/definitions/url/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2987
3043
  if (vErrors === null) {
2988
- vErrors = [err15];
3044
+ vErrors = [err14];
2989
3045
  } else {
2990
- vErrors.push(err15);
3046
+ vErrors.push(err14);
2991
3047
  }
2992
3048
  errors++;
2993
3049
  }
2994
3050
  }
2995
3051
  } else {
2996
- const err16 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
3052
+ const err15 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2997
3053
  if (vErrors === null) {
2998
- vErrors = [err16];
3054
+ vErrors = [err15];
2999
3055
  } else {
3000
- vErrors.push(err16);
3056
+ vErrors.push(err15);
3001
3057
  }
3002
3058
  errors++;
3003
3059
  }
@@ -8051,6 +8107,7 @@ var LANE_MOST = 12;
8051
8107
  var HEAD = "HEAD";
8052
8108
 
8053
8109
  // src/schema.ts
8110
+ var ICON_NAMES = Object.keys(ICONS);
8054
8111
  var EVENT_TYPES = ["edge", "action", "swap", "strip", "commit", "branch", "now", "mark", "span", "leaf", "node", "line", "seal", "open", "pick", "stamp"];
8055
8112
  var ABSENT = "#/definitions/absent/not";
8056
8113
  var ABSENT_KINDS = {
@@ -8080,7 +8137,16 @@ var WIRED_EVENTS = ["edge", "action"];
8080
8137
  var DURATION = /^\^\[0-9\]\+\(\\\.\[0-9\]\+\)\?\(([a-z|]+)\)\$$/u;
8081
8138
  var RATIO = /%\)\$$/u;
8082
8139
  var escape = (key) => key.replaceAll("~", "~0").replaceAll("/", "~1");
8140
+ function valueAt(input, pointer) {
8141
+ let value = input;
8142
+ for (const raw of pointer.split("/").slice(1)) {
8143
+ if (typeof value !== "object" || value === null) return void 0;
8144
+ value = value[raw.replaceAll("~1", "/").replaceAll("~0", "~")];
8145
+ }
8146
+ return value;
8147
+ }
8083
8148
  var URL_RULE = "#/definitions/url/pattern";
8149
+ var ICON_RULE = "#/definitions/icon/enum";
8084
8150
  var HEX = /^\^\[0-9a-f\]\{(\d+),(\d+)\}\$$/u;
8085
8151
  function forbiddenOf(pattern) {
8086
8152
  const inside = /^\^\[\^(.+)\]\+\$$/u.exec(pattern)?.[1];
@@ -8091,7 +8157,7 @@ function forbiddenOf(pattern) {
8091
8157
  var branchesOf = (anyOf, errors) => errors.filter(
8092
8158
  (error) => error !== anyOf && error.schemaPath.startsWith(`${anyOf.schemaPath}/`) && (error.instancePath === anyOf.instancePath || error.instancePath.startsWith(`${anyOf.instancePath}/`))
8093
8159
  );
8094
- function toFieldError(error, errors, m) {
8160
+ function toFieldError(error, errors, m, input) {
8095
8161
  const params = error.params;
8096
8162
  const at2 = error.instancePath;
8097
8163
  switch (error.keyword) {
@@ -8124,8 +8190,12 @@ function toFieldError(error, errors, m) {
8124
8190
  const tag = String(params.tag);
8125
8191
  return { pointer: `${at2}/${escape(tag)}`, message: m.discriminator(tag, EVENT_TYPES) };
8126
8192
  }
8127
- case "enum":
8193
+ case "enum": {
8194
+ const written = error.schemaPath === ICON_RULE ? valueAt(input, at2) : void 0;
8195
+ const near = typeof written === "string" ? nearest(written, ICON_NAMES) : void 0;
8196
+ if (typeof written === "string" && near !== void 0) return { pointer: at2, message: m.unknownIcon(written, near) };
8128
8197
  return { pointer: at2, message: m.enum(params.allowedValues.map(String)) };
8198
+ }
8129
8199
  case "type":
8130
8200
  return { pointer: at2, message: m.type(String(params.type)) };
8131
8201
  case "minLength":
@@ -8161,7 +8231,7 @@ function validateDiagram(input, options = {}) {
8161
8231
  const all = validate_diagram_default.errors ?? [];
8162
8232
  const inBranch = new Set(all.filter((error) => error.keyword === "anyOf").flatMap((anyOf) => branchesOf(anyOf, all)));
8163
8233
  const m = FIELD_MESSAGES[options.lang ?? "ja"];
8164
- const errors = all.filter((error) => error.keyword !== "if" && !inBranch.has(error)).map((error) => toFieldError(error, all, m));
8234
+ const errors = all.filter((error) => error.keyword !== "if" && !inBranch.has(error)).map((error) => toFieldError(error, all, m, input));
8165
8235
  return { ok: false, errors };
8166
8236
  }
8167
8237
 
@@ -8424,48 +8494,6 @@ function stateTimes(diagram, edges, last) {
8424
8494
  return [...times.values()];
8425
8495
  }
8426
8496
 
8427
- // src/render/icons.ts
8428
- var ICONS = {
8429
- 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",
8430
- 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",
8431
- on: "M -7 7 L 7 -7 M -1 -7 h8 v8",
8432
- off: "M -7 -7 L 7 7 M 7 -1 v8 h-8",
8433
- 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",
8434
- 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",
8435
- exe: "M -5 -8 L 7 0 L -5 8 Z",
8436
- idx: "M -9 -7 h18 M -9 -2 h18 M -9 3 h18 M -9 8 h11",
8437
- sign: "M -9 4 c 3 -9 5 -9 6 0 s 3 7 6 -2 s 3 -6 6 0",
8438
- env: "M -8 -5.5 h16 v11 h-16 z M -8 -5.5 l8 6 l8 -6",
8439
- 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",
8440
- check: "M -5 0 l3.5 3.5 l6.5 -7",
8441
- flag: "M -4 8 V -8 M -4 -7 H 6 L 3.5 -3.5 L 6 0 H -4",
8442
- x: "M -5 -5 l10 10 M 5 -5 l-10 10",
8443
- 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",
8444
- 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",
8445
- 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",
8446
- 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",
8447
- 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",
8448
- 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",
8449
- 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",
8450
- bolt: "M 2 -9 L -5 1 h5 l-2 8 l7 -10 h-5 z",
8451
- doc: "M -6 -9 h8 l5 5 v13 h-13 z M 2 -9 v5 h5 M -3 1 h7 M -3 5 h5",
8452
- 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",
8453
- 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",
8454
- 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",
8455
- 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",
8456
- 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",
8457
- 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",
8458
- 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",
8459
- refresh: "M 7 -3 a7.5 7.5 0 1 0 0.5 5 M 7.5 -8 v5 h-5",
8460
- undo: "M -7 -2 h10 a5 5 0 0 1 0 10 h-6 M -3 -6 l-4 4 l4 4",
8461
- yen: "M -6 -8 l6 7 l6 -7 M 0 -1 v9 M -5 1.5 h10 M -5 5 h10",
8462
- 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",
8463
- code: "M -4 -6 l-5 6 l5 6 M 4 -6 l5 6 l-5 6",
8464
- 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",
8465
- 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",
8466
- 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"
8467
- };
8468
-
8469
8497
  // src/render/ink.ts
8470
8498
  var ALWAYS = [[0, Number.POSITIVE_INFINITY]];
8471
8499
  var BITE = 0.5;
@@ -8497,7 +8525,7 @@ var linkTo = (link, markup) => link === void 0 ? markup : `<a href="${esc(link)}
8497
8525
  var r1 = (v) => Math.round(v * 100) / 100;
8498
8526
  var cs = (k) => k === "coin" ? "--c:var(--coin);--ct:var(--coint)" : `--c:var(--c-${k});--ct:var(--t-${k})`;
8499
8527
  function glyph(name, x, y, scale, cls = "dg-gl") {
8500
- const d = name === void 0 ? void 0 : ICONS[name];
8528
+ const d = name !== void 0 && drawsIcon(name) ? ICONS[name] : void 0;
8501
8529
  return d ? `<path class="${cls}" transform="translate(${r1(x)} ${r1(y)}) scale(${scale})" d="${d}"/>` : "";
8502
8530
  }
8503
8531
  function pathOf(points) {
@@ -8528,6 +8556,8 @@ function arrowHead(points) {
8528
8556
  const { arrow: a, arrowHalf: h } = LOOK.edge;
8529
8557
  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)}`;
8530
8558
  }
8559
+ var drawsIcon = (name) => name !== void 0 && Object.hasOwn(ICONS, name);
8560
+ var boxTextY = (boxes) => boxes.some((b) => drawsIcon(b.icon) || b.slot !== void 0) ? { name: LOOK.box.nameY, sub: LOOK.box.subY } : { name: LOOK.box.nameMid, sub: LOOK.box.subMid };
8531
8561
  var sansOf = (t) => ({ ...t, family: "sans" });
8532
8562
  function write(ink, cls, x, y, text2, style, shown = ALWAYS, anchor) {
8533
8563
  ink?.push({ text: text2, rect: textBox(text2, x, y, style, anchor), shown });
@@ -8554,7 +8584,7 @@ function band(region, ink) {
8554
8584
  const { x, y } = region.header;
8555
8585
  const lines = region.lines.map((t, k) => write(ink, "dg-bz", x, region.y + nameY + k * line, t, TYPE.regionName)).join("");
8556
8586
  const note = region.note ? write(ink, "dg-bx", x, region.y + nameY + region.lines.length * line + 1, region.note, TYPE.regionNote) : "";
8557
- 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)}` : "";
8587
+ const mark = drawsIcon(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)}` : "";
8558
8588
  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>`;
8559
8589
  }
8560
8590
  function subLines(box, m, changes, y, ink, right) {
@@ -8574,18 +8604,18 @@ function cardFrame(box, ctx, act, y, h) {
8574
8604
  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>` : ""}`;
8575
8605
  }
8576
8606
  function card(box, ctx, on, changes, lit) {
8577
- const { icon, iconRadius, iconScale, iconY, nameY, subY } = LOOK.box;
8578
- const subs = subLines(box, ctx.m, changes, box.cy + subY, ctx.ink);
8607
+ const { icon, iconRadius, iconScale, iconY } = LOOK.box;
8608
+ const subs = subLines(box, ctx.m, changes, box.cy + ctx.boxText.sub, ctx.ink);
8579
8609
  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;
8580
8610
  const ix = box.iconX ?? box.cx;
8581
8611
  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}"/>` : "";
8582
8612
  let mark = "";
8583
- if (box.icon && ICONS[box.icon]) {
8613
+ if (drawsIcon(box.icon)) {
8584
8614
  const rect = { x: ix - icon / 2, y: box.cy + iconY - icon / 2, w: icon, h: icon };
8585
8615
  ctx.ink.push({ text: `${box.name} \u306E\u7D75\u67C4`, rect, shown: ALWAYS, boxed: true, part: { kind: "icon", box: box.name } });
8586
8616
  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)}`;
8587
8617
  }
8588
- 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>`;
8618
+ 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 + ctx.boxText.name, box.name, TYPE.boxName, ALWAYS, "middle")}${subs}</g>`;
8589
8619
  }
8590
8620
  function headCard(box, ctx, on, changes) {
8591
8621
  const { pad: pad2, h, nameY, subY } = LOOK.follow.head;
@@ -8598,7 +8628,7 @@ function ghostCard(box, ink) {
8598
8628
  const G = LOOK.state.ghost;
8599
8629
  const ix = box.x + G.pad + icon / 2;
8600
8630
  const tx = box.x + G.pad + icon + G.gap;
8601
- 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)}` : "";
8631
+ const mark = drawsIcon(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)}` : "";
8602
8632
  const nameY = box.sub ? G.nameY : LOOK.baseline.mark;
8603
8633
  const sub = box.sub ? write(ink, "dg-ss", tx, box.cy + G.subY, box.sub, TYPE.boxSub, ALWAYS, "start") : "";
8604
8634
  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>`;
@@ -9195,7 +9225,7 @@ function drawSvg(diagram, layout, timeline, palette, theme, follow, ink = [], tr
9195
9225
  const vars = paletteVars(palette, theme);
9196
9226
  const id = nameOf(`${JSON.stringify(diagram)}|${vars}|${follow ? `${follow.width}|${follow.lang}` : ""}`);
9197
9227
  const m = new Motion(`dg${id}`, timeline.total, timeline.last);
9198
- const ctx = { m, t: timeline, id, sh: `filter="url(#dg-sh-${id})"`, end: timeline.steps[timeline.steps.length - 1].end, ink, traces };
9228
+ const ctx = { m, t: timeline, id, sh: `filter="url(#dg-sh-${id})"`, end: timeline.steps[timeline.steps.length - 1].end, ink, traces, boxText: boxTextY(layout.boxes) };
9199
9229
  const on = involved(diagram);
9200
9230
  const subs = subChanges(diagram, timeline, layout.kind !== "sequence");
9201
9231
  const L = { band: [], base: [], lit: [], node: [], badge: [], top: [] };
@@ -11126,7 +11156,7 @@ function simplify(keys2) {
11126
11156
  }
11127
11157
  return out;
11128
11158
  }
11129
- function valueAt(keys2, t) {
11159
+ function valueAt2(keys2, t) {
11130
11160
  const first = keys2[0];
11131
11161
  if (!first) return 0;
11132
11162
  if (t <= first[0]) return first[1];
@@ -11308,7 +11338,7 @@ function meterField(field, keys2, ctx) {
11308
11338
  const y = field.y + M.y;
11309
11339
  const kf = m.kf([
11310
11340
  ...simplify(keys2).map(([t, v]) => [t, { transform: `scaleX(${r14(v * 1e3) / 1e3})` }]),
11311
- [m.last, { transform: `scaleX(${r14(valueAt(keys2, m.last) * 1e3) / 1e3})` }, EASE.inOut],
11341
+ [m.last, { transform: `scaleX(${r14(valueAt2(keys2, m.last) * 1e3) / 1e3})` }, EASE.inOut],
11312
11342
  [m.total, { transform: "scaleX(0)" }]
11313
11343
  ]);
11314
11344
  const lx = x + w * line;
@@ -11316,9 +11346,9 @@ function meterField(field, keys2, ctx) {
11316
11346
  }
11317
11347
  function timeFocus(layout, timeline, step, parts, vw, vh) {
11318
11348
  const span = timeline.steps[step];
11319
- const position = valueAt(timeline.needle ?? [], span.end - MOTION.still);
11349
+ const position = valueAt2(timeline.needle ?? [], span.end - MOTION.still);
11320
11350
  const badge2 = layout.badges.find((b) => b.step === step);
11321
- const anchored = badge2 && valueAt(timeline.needle ?? [], span.start) === position && !(layout.strip && badge2.y >= layout.strip.y);
11351
+ const anchored = badge2 && valueAt2(timeline.needle ?? [], span.start) === position && !(layout.strip && badge2.y >= layout.strip.y);
11322
11352
  const ax = anchored ? badge2.x : layout.axis.x + position * layout.axis.unit;
11323
11353
  const top = Math.min(...layout.rows.map((r) => r.y));
11324
11354
  const bottom = Math.max(...layout.rows.map((r) => r.y + r.h));
@@ -11900,16 +11930,16 @@ async function film(stage2, plan2) {
11900
11930
  const delay = gifEvery / fps * 1e3;
11901
11931
  const sampled = [];
11902
11932
  let colors = [];
11903
- const nearest = /* @__PURE__ */ new Map();
11933
+ const nearest2 = /* @__PURE__ */ new Map();
11904
11934
  const toIndex = (data) => {
11905
11935
  const index = new Uint8Array(data.length / 4);
11906
11936
  for (let p = 0; p < index.length; p++) {
11907
11937
  const i = p * 4;
11908
11938
  const key = data[i] << 16 | data[i + 1] << 8 | data[i + 2];
11909
- let k = nearest.get(key);
11939
+ let k = nearest2.get(key);
11910
11940
  if (k === void 0) {
11911
11941
  k = gif.nearestColorIndex(colors, [data[i], data[i + 1], data[i + 2]]);
11912
- nearest.set(key, k);
11942
+ nearest2.set(key, k);
11913
11943
  }
11914
11944
  index[p] = k;
11915
11945
  }