@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.cjs CHANGED
@@ -323,7 +323,11 @@ var LOOK = {
323
323
  gap: 10,
324
324
  /** 図の外周の余白 */
325
325
  margin: 14,
326
- box: { h: 72, minW: 92, padX: 12, radius: 12, icon: 24, iconRadius: 7, iconY: -16, iconScale: 0.74, nameY: 12, subY: 27 },
326
+ /**
327
+ * 箱。`iconY` と `nameY` と `subY` は箱の真ん中から絵柄の真ん中と名前と下の字の基準線まで。
328
+ * `nameMid` と `subMid` はアイコンも置き場の枠も持つ箱が無い図の名前と下の字の基準線で、名前を箱の真ん中に置き、下の字を名前から `subY - nameY` と同じ間で置く (#3307、#3309)
329
+ */
330
+ 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 },
327
331
  region: { pad: 18, gap: 10, radius: 14, inset: 14, icon: 24, iconRadius: 7, iconScale: 0.68, nameY: 58, line: 16, minH: 108 },
328
332
  architecture: { columns: 4, columnGap: 56, maxColumnGap: 160, rowGap: 44, labelRoom: 16 },
329
333
  /**
@@ -835,8 +839,8 @@ function longest(points) {
835
839
  }
836
840
  return { a: best.a, b: best.b, vertical: Math.abs(best.b[0] - best.a[0]) < Math.abs(best.b[1] - best.a[1]) };
837
841
  }
838
- function along(points, distance) {
839
- let left = distance;
842
+ function along(points, distance2) {
843
+ let left = distance2;
840
844
  for (let i = 1; i < points.length; i++) {
841
845
  const a = points[i - 1];
842
846
  const b = points[i];
@@ -1669,6 +1673,7 @@ var ja = {
1669
1673
  additionalProperties: (key) => `${key} \u3068\u3044\u3046\u6B04\u306F\u66F8\u3051\u306A\u3044`,
1670
1674
  required: (key) => `${key} \u306E\u6B04\u304C\u8981\u308B`,
1671
1675
  enum: (values) => `${values.join(" / ")} \u306E\u3069\u308C\u304B\u306B\u3059\u308B`,
1676
+ unknownIcon: (value, near) => `${value} \u3068\u3044\u3046 icon \u306F\u7121\u3044\u3002\u8FD1\u3044\u540D\u524D\u306F ${near}`,
1672
1677
  type: (type) => TYPES_JA[type] ?? `${type} \u306B\u3059\u308B`,
1673
1678
  minLength: (limit) => `${limit} \u5B57\u4EE5\u4E0A\u66F8\u304F`,
1674
1679
  maxLength: (limit) => `${limit} \u5B57\u307E\u3067\u306B\u3059\u308B`,
@@ -1693,6 +1698,7 @@ var en = {
1693
1698
  additionalProperties: (key) => `The ${key} field is not allowed`,
1694
1699
  required: (key) => `The ${key} field is required`,
1695
1700
  enum: (values) => `Use one of ${values.join(" / ")}`,
1701
+ unknownIcon: (value, near) => `There is no icon named ${value}. The closest is ${near}`,
1696
1702
  type: (type) => TYPES_EN[type] ?? `Use ${type}`,
1697
1703
  minLength: (limit) => `Write at least ${plural(limit, "character")}`,
1698
1704
  maxLength: (limit) => `Write at most ${plural(limit, "character")}`,
@@ -1715,6 +1721,75 @@ var en = {
1715
1721
  };
1716
1722
  var FIELD_MESSAGES = { ja, en };
1717
1723
 
1724
+ // src/nearest.ts
1725
+ var MAX_DISTANCE = 2;
1726
+ function nearest(word, candidates) {
1727
+ const written = [...word.toLowerCase()];
1728
+ let limit = Math.min(MAX_DISTANCE, written.length - 1);
1729
+ let best;
1730
+ for (const candidate of candidates) {
1731
+ const d = distance(written, [...candidate.toLowerCase()]);
1732
+ if (d > limit) continue;
1733
+ best = candidate;
1734
+ limit = d - 1;
1735
+ }
1736
+ return best;
1737
+ }
1738
+ function distance(a, b) {
1739
+ let previous = Array.from({ length: b.length + 1 }, (_, j) => j);
1740
+ for (let i = 1; i <= a.length; i++) {
1741
+ const current = [i];
1742
+ for (let j = 1; j <= b.length; j++) {
1743
+ const replace = previous[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1);
1744
+ current.push(Math.min(previous[j] + 1, current[j - 1] + 1, replace));
1745
+ }
1746
+ previous = current;
1747
+ }
1748
+ return previous[b.length];
1749
+ }
1750
+
1751
+ // src/render/icons.ts
1752
+ var ICONS = {
1753
+ 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",
1754
+ 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",
1755
+ on: "M -7 7 L 7 -7 M -1 -7 h8 v8",
1756
+ off: "M -7 -7 L 7 7 M 7 -1 v8 h-8",
1757
+ 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",
1758
+ 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",
1759
+ exe: "M -5 -8 L 7 0 L -5 8 Z",
1760
+ idx: "M -9 -7 h18 M -9 -2 h18 M -9 3 h18 M -9 8 h11",
1761
+ sign: "M -9 4 c 3 -9 5 -9 6 0 s 3 7 6 -2 s 3 -6 6 0",
1762
+ env: "M -8 -5.5 h16 v11 h-16 z M -8 -5.5 l8 6 l8 -6",
1763
+ 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",
1764
+ check: "M -5 0 l3.5 3.5 l6.5 -7",
1765
+ flag: "M -4 8 V -8 M -4 -7 H 6 L 3.5 -3.5 L 6 0 H -4",
1766
+ x: "M -5 -5 l10 10 M 5 -5 l-10 10",
1767
+ 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",
1768
+ 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",
1769
+ 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",
1770
+ 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",
1771
+ 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",
1772
+ 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",
1773
+ 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",
1774
+ bolt: "M 2 -9 L -5 1 h5 l-2 8 l7 -10 h-5 z",
1775
+ doc: "M -6 -9 h8 l5 5 v13 h-13 z M 2 -9 v5 h5 M -3 1 h7 M -3 5 h5",
1776
+ 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",
1777
+ 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",
1778
+ 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",
1779
+ 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",
1780
+ 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",
1781
+ 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",
1782
+ 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",
1783
+ refresh: "M 7 -3 a7.5 7.5 0 1 0 0.5 5 M 7.5 -8 v5 h-5",
1784
+ undo: "M -7 -2 h10 a5 5 0 0 1 0 10 h-6 M -3 -6 l-4 4 l4 4",
1785
+ yen: "M -6 -8 l6 7 l6 -7 M 0 -1 v9 M -5 1.5 h10 M -5 5 h10",
1786
+ 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",
1787
+ code: "M -4 -6 l-5 6 l5 6 M 4 -6 l5 6 l-5 6",
1788
+ 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",
1789
+ 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",
1790
+ 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"
1791
+ };
1792
+
1718
1793
  // src/schemas/validate-diagram.js
1719
1794
  function ucs2length(str) {
1720
1795
  let length = 0;
@@ -2673,6 +2748,7 @@ function validate25(data, { instancePath = "", parentData, parentDataProperty, r
2673
2748
  return errors === 0;
2674
2749
  }
2675
2750
  var schema79 = { "enum": ["blue", "amber", "green", "violet", "rose", "slate", "coin"] };
2751
+ 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"] };
2676
2752
  var pattern0 = new RegExp("^[^\\s\\[\\]\u300C\u300D=:]+$", "u");
2677
2753
  var func3 = ucs2length;
2678
2754
  function validate30(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
@@ -2788,32 +2864,22 @@ function validate30(data, { instancePath = "", parentData, parentDataProperty, r
2788
2864
  }
2789
2865
  if (data.icon !== void 0) {
2790
2866
  let data4 = data.icon;
2791
- if (typeof data4 === "string") {
2792
- if (func3(data4) < 1) {
2793
- const err10 = { instancePath: instancePath + "/icon", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
2794
- if (vErrors === null) {
2795
- vErrors = [err10];
2796
- } else {
2797
- vErrors.push(err10);
2798
- }
2799
- errors++;
2800
- }
2801
- } else {
2802
- const err11 = { instancePath: instancePath + "/icon", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2867
+ 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")) {
2868
+ 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" };
2803
2869
  if (vErrors === null) {
2804
- vErrors = [err11];
2870
+ vErrors = [err10];
2805
2871
  } else {
2806
- vErrors.push(err11);
2872
+ vErrors.push(err10);
2807
2873
  }
2808
2874
  errors++;
2809
2875
  }
2810
2876
  }
2811
2877
  } else {
2812
- const err12 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2878
+ const err11 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2813
2879
  if (vErrors === null) {
2814
- vErrors = [err12];
2880
+ vErrors = [err11];
2815
2881
  } else {
2816
- vErrors.push(err12);
2882
+ vErrors.push(err11);
2817
2883
  }
2818
2884
  errors++;
2819
2885
  }
@@ -2934,22 +3000,12 @@ function validate32(data, { instancePath = "", parentData, parentDataProperty, r
2934
3000
  }
2935
3001
  if (data.icon !== void 0) {
2936
3002
  let data4 = data.icon;
2937
- if (typeof data4 === "string") {
2938
- if (func3(data4) < 1) {
2939
- const err10 = { instancePath: instancePath + "/icon", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
2940
- if (vErrors === null) {
2941
- vErrors = [err10];
2942
- } else {
2943
- vErrors.push(err10);
2944
- }
2945
- errors++;
2946
- }
2947
- } else {
2948
- const err11 = { instancePath: instancePath + "/icon", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3003
+ 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")) {
3004
+ 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" };
2949
3005
  if (vErrors === null) {
2950
- vErrors = [err11];
3006
+ vErrors = [err10];
2951
3007
  } else {
2952
- vErrors.push(err11);
3008
+ vErrors.push(err10);
2953
3009
  }
2954
3010
  errors++;
2955
3011
  }
@@ -2958,20 +3014,20 @@ function validate32(data, { instancePath = "", parentData, parentDataProperty, r
2958
3014
  let data5 = data.region;
2959
3015
  if (typeof data5 === "string") {
2960
3016
  if (!pattern0.test(data5)) {
2961
- const err12 = { instancePath: instancePath + "/region", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
3017
+ const err11 = { instancePath: instancePath + "/region", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
2962
3018
  if (vErrors === null) {
2963
- vErrors = [err12];
3019
+ vErrors = [err11];
2964
3020
  } else {
2965
- vErrors.push(err12);
3021
+ vErrors.push(err11);
2966
3022
  }
2967
3023
  errors++;
2968
3024
  }
2969
3025
  } else {
2970
- const err13 = { instancePath: instancePath + "/region", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3026
+ const err12 = { instancePath: instancePath + "/region", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2971
3027
  if (vErrors === null) {
2972
- vErrors = [err13];
3028
+ vErrors = [err12];
2973
3029
  } else {
2974
- vErrors.push(err13);
3030
+ vErrors.push(err12);
2975
3031
  }
2976
3032
  errors++;
2977
3033
  }
@@ -2980,30 +3036,30 @@ function validate32(data, { instancePath = "", parentData, parentDataProperty, r
2980
3036
  let data6 = data.link;
2981
3037
  if (typeof data6 === "string") {
2982
3038
  if (!pattern3.test(data6)) {
2983
- const err14 = { instancePath: instancePath + "/link", schemaPath: "#/definitions/url/pattern", keyword: "pattern", params: { pattern: "^(/|https?://)" }, message: 'must match pattern "^(/|https?://)"' };
3039
+ const err13 = { instancePath: instancePath + "/link", schemaPath: "#/definitions/url/pattern", keyword: "pattern", params: { pattern: "^(/|https?://)" }, message: 'must match pattern "^(/|https?://)"' };
2984
3040
  if (vErrors === null) {
2985
- vErrors = [err14];
3041
+ vErrors = [err13];
2986
3042
  } else {
2987
- vErrors.push(err14);
3043
+ vErrors.push(err13);
2988
3044
  }
2989
3045
  errors++;
2990
3046
  }
2991
3047
  } else {
2992
- const err15 = { instancePath: instancePath + "/link", schemaPath: "#/definitions/url/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3048
+ const err14 = { instancePath: instancePath + "/link", schemaPath: "#/definitions/url/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2993
3049
  if (vErrors === null) {
2994
- vErrors = [err15];
3050
+ vErrors = [err14];
2995
3051
  } else {
2996
- vErrors.push(err15);
3052
+ vErrors.push(err14);
2997
3053
  }
2998
3054
  errors++;
2999
3055
  }
3000
3056
  }
3001
3057
  } else {
3002
- const err16 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
3058
+ const err15 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
3003
3059
  if (vErrors === null) {
3004
- vErrors = [err16];
3060
+ vErrors = [err15];
3005
3061
  } else {
3006
- vErrors.push(err16);
3062
+ vErrors.push(err15);
3007
3063
  }
3008
3064
  errors++;
3009
3065
  }
@@ -8057,6 +8113,7 @@ var LANE_MOST = 12;
8057
8113
  var HEAD = "HEAD";
8058
8114
 
8059
8115
  // src/schema.ts
8116
+ var ICON_NAMES = Object.keys(ICONS);
8060
8117
  var EVENT_TYPES = ["edge", "action", "swap", "strip", "commit", "branch", "now", "mark", "span", "leaf", "node", "line", "seal", "open", "pick", "stamp"];
8061
8118
  var ABSENT = "#/definitions/absent/not";
8062
8119
  var ABSENT_KINDS = {
@@ -8086,7 +8143,16 @@ var WIRED_EVENTS = ["edge", "action"];
8086
8143
  var DURATION = /^\^\[0-9\]\+\(\\\.\[0-9\]\+\)\?\(([a-z|]+)\)\$$/u;
8087
8144
  var RATIO = /%\)\$$/u;
8088
8145
  var escape = (key) => key.replaceAll("~", "~0").replaceAll("/", "~1");
8146
+ function valueAt(input, pointer) {
8147
+ let value = input;
8148
+ for (const raw of pointer.split("/").slice(1)) {
8149
+ if (typeof value !== "object" || value === null) return void 0;
8150
+ value = value[raw.replaceAll("~1", "/").replaceAll("~0", "~")];
8151
+ }
8152
+ return value;
8153
+ }
8089
8154
  var URL_RULE = "#/definitions/url/pattern";
8155
+ var ICON_RULE = "#/definitions/icon/enum";
8090
8156
  var HEX = /^\^\[0-9a-f\]\{(\d+),(\d+)\}\$$/u;
8091
8157
  function forbiddenOf(pattern) {
8092
8158
  const inside = /^\^\[\^(.+)\]\+\$$/u.exec(pattern)?.[1];
@@ -8097,7 +8163,7 @@ function forbiddenOf(pattern) {
8097
8163
  var branchesOf = (anyOf, errors) => errors.filter(
8098
8164
  (error) => error !== anyOf && error.schemaPath.startsWith(`${anyOf.schemaPath}/`) && (error.instancePath === anyOf.instancePath || error.instancePath.startsWith(`${anyOf.instancePath}/`))
8099
8165
  );
8100
- function toFieldError(error, errors, m) {
8166
+ function toFieldError(error, errors, m, input) {
8101
8167
  const params = error.params;
8102
8168
  const at2 = error.instancePath;
8103
8169
  switch (error.keyword) {
@@ -8130,8 +8196,12 @@ function toFieldError(error, errors, m) {
8130
8196
  const tag = String(params.tag);
8131
8197
  return { pointer: `${at2}/${escape(tag)}`, message: m.discriminator(tag, EVENT_TYPES) };
8132
8198
  }
8133
- case "enum":
8199
+ case "enum": {
8200
+ const written = error.schemaPath === ICON_RULE ? valueAt(input, at2) : void 0;
8201
+ const near = typeof written === "string" ? nearest(written, ICON_NAMES) : void 0;
8202
+ if (typeof written === "string" && near !== void 0) return { pointer: at2, message: m.unknownIcon(written, near) };
8134
8203
  return { pointer: at2, message: m.enum(params.allowedValues.map(String)) };
8204
+ }
8135
8205
  case "type":
8136
8206
  return { pointer: at2, message: m.type(String(params.type)) };
8137
8207
  case "minLength":
@@ -8167,7 +8237,7 @@ function validateDiagram(input, options = {}) {
8167
8237
  const all = validate_diagram_default.errors ?? [];
8168
8238
  const inBranch = new Set(all.filter((error) => error.keyword === "anyOf").flatMap((anyOf) => branchesOf(anyOf, all)));
8169
8239
  const m = FIELD_MESSAGES[options.lang ?? "ja"];
8170
- const errors = all.filter((error) => error.keyword !== "if" && !inBranch.has(error)).map((error) => toFieldError(error, all, m));
8240
+ const errors = all.filter((error) => error.keyword !== "if" && !inBranch.has(error)).map((error) => toFieldError(error, all, m, input));
8171
8241
  return { ok: false, errors };
8172
8242
  }
8173
8243
 
@@ -8430,48 +8500,6 @@ function stateTimes(diagram, edges, last) {
8430
8500
  return [...times.values()];
8431
8501
  }
8432
8502
 
8433
- // src/render/icons.ts
8434
- var ICONS = {
8435
- 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",
8436
- 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",
8437
- on: "M -7 7 L 7 -7 M -1 -7 h8 v8",
8438
- off: "M -7 -7 L 7 7 M 7 -1 v8 h-8",
8439
- 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",
8440
- 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",
8441
- exe: "M -5 -8 L 7 0 L -5 8 Z",
8442
- idx: "M -9 -7 h18 M -9 -2 h18 M -9 3 h18 M -9 8 h11",
8443
- sign: "M -9 4 c 3 -9 5 -9 6 0 s 3 7 6 -2 s 3 -6 6 0",
8444
- env: "M -8 -5.5 h16 v11 h-16 z M -8 -5.5 l8 6 l8 -6",
8445
- 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",
8446
- check: "M -5 0 l3.5 3.5 l6.5 -7",
8447
- flag: "M -4 8 V -8 M -4 -7 H 6 L 3.5 -3.5 L 6 0 H -4",
8448
- x: "M -5 -5 l10 10 M 5 -5 l-10 10",
8449
- 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",
8450
- 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",
8451
- 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",
8452
- 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",
8453
- 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",
8454
- 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",
8455
- 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",
8456
- bolt: "M 2 -9 L -5 1 h5 l-2 8 l7 -10 h-5 z",
8457
- doc: "M -6 -9 h8 l5 5 v13 h-13 z M 2 -9 v5 h5 M -3 1 h7 M -3 5 h5",
8458
- 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",
8459
- 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",
8460
- 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",
8461
- 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",
8462
- 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",
8463
- 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",
8464
- 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",
8465
- refresh: "M 7 -3 a7.5 7.5 0 1 0 0.5 5 M 7.5 -8 v5 h-5",
8466
- undo: "M -7 -2 h10 a5 5 0 0 1 0 10 h-6 M -3 -6 l-4 4 l4 4",
8467
- yen: "M -6 -8 l6 7 l6 -7 M 0 -1 v9 M -5 1.5 h10 M -5 5 h10",
8468
- 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",
8469
- code: "M -4 -6 l-5 6 l5 6 M 4 -6 l5 6 l-5 6",
8470
- 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",
8471
- 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",
8472
- 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"
8473
- };
8474
-
8475
8503
  // src/render/ink.ts
8476
8504
  var ALWAYS = [[0, Number.POSITIVE_INFINITY]];
8477
8505
  var BITE = 0.5;
@@ -8503,7 +8531,7 @@ var linkTo = (link, markup) => link === void 0 ? markup : `<a href="${esc(link)}
8503
8531
  var r1 = (v) => Math.round(v * 100) / 100;
8504
8532
  var cs = (k) => k === "coin" ? "--c:var(--coin);--ct:var(--coint)" : `--c:var(--c-${k});--ct:var(--t-${k})`;
8505
8533
  function glyph(name, x, y, scale, cls = "dg-gl") {
8506
- const d = name === void 0 ? void 0 : ICONS[name];
8534
+ const d = name !== void 0 && drawsIcon(name) ? ICONS[name] : void 0;
8507
8535
  return d ? `<path class="${cls}" transform="translate(${r1(x)} ${r1(y)}) scale(${scale})" d="${d}"/>` : "";
8508
8536
  }
8509
8537
  function pathOf(points) {
@@ -8534,6 +8562,8 @@ function arrowHead(points) {
8534
8562
  const { arrow: a, arrowHalf: h } = LOOK.edge;
8535
8563
  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)}`;
8536
8564
  }
8565
+ var drawsIcon = (name) => name !== void 0 && Object.hasOwn(ICONS, name);
8566
+ 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 };
8537
8567
  var sansOf = (t) => ({ ...t, family: "sans" });
8538
8568
  function write(ink, cls, x, y, text2, style, shown = ALWAYS, anchor) {
8539
8569
  ink?.push({ text: text2, rect: textBox(text2, x, y, style, anchor), shown });
@@ -8560,7 +8590,7 @@ function band(region, ink) {
8560
8590
  const { x, y } = region.header;
8561
8591
  const lines = region.lines.map((t, k) => write(ink, "dg-bz", x, region.y + nameY + k * line, t, TYPE.regionName)).join("");
8562
8592
  const note = region.note ? write(ink, "dg-bx", x, region.y + nameY + region.lines.length * line + 1, region.note, TYPE.regionNote) : "";
8563
- 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)}` : "";
8593
+ 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)}` : "";
8564
8594
  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>`;
8565
8595
  }
8566
8596
  function subLines(box, m, changes, y, ink, right) {
@@ -8580,18 +8610,18 @@ function cardFrame(box, ctx, act, y, h) {
8580
8610
  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>` : ""}`;
8581
8611
  }
8582
8612
  function card(box, ctx, on, changes, lit) {
8583
- const { icon, iconRadius, iconScale, iconY, nameY, subY } = LOOK.box;
8584
- const subs = subLines(box, ctx.m, changes, box.cy + subY, ctx.ink);
8613
+ const { icon, iconRadius, iconScale, iconY } = LOOK.box;
8614
+ const subs = subLines(box, ctx.m, changes, box.cy + ctx.boxText.sub, ctx.ink);
8585
8615
  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;
8586
8616
  const ix = box.iconX ?? box.cx;
8587
8617
  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}"/>` : "";
8588
8618
  let mark = "";
8589
- if (box.icon && ICONS[box.icon]) {
8619
+ if (drawsIcon(box.icon)) {
8590
8620
  const rect = { x: ix - icon / 2, y: box.cy + iconY - icon / 2, w: icon, h: icon };
8591
8621
  ctx.ink.push({ text: `${box.name} \u306E\u7D75\u67C4`, rect, shown: ALWAYS, boxed: true, part: { kind: "icon", box: box.name } });
8592
8622
  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)}`;
8593
8623
  }
8594
- 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>`;
8624
+ 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>`;
8595
8625
  }
8596
8626
  function headCard(box, ctx, on, changes) {
8597
8627
  const { pad: pad2, h, nameY, subY } = LOOK.follow.head;
@@ -8604,7 +8634,7 @@ function ghostCard(box, ink) {
8604
8634
  const G = LOOK.state.ghost;
8605
8635
  const ix = box.x + G.pad + icon / 2;
8606
8636
  const tx = box.x + G.pad + icon + G.gap;
8607
- 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)}` : "";
8637
+ 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)}` : "";
8608
8638
  const nameY = box.sub ? G.nameY : LOOK.baseline.mark;
8609
8639
  const sub = box.sub ? write(ink, "dg-ss", tx, box.cy + G.subY, box.sub, TYPE.boxSub, ALWAYS, "start") : "";
8610
8640
  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>`;
@@ -9201,7 +9231,7 @@ function drawSvg(diagram, layout, timeline, palette, theme, follow, ink = [], tr
9201
9231
  const vars = paletteVars(palette, theme);
9202
9232
  const id = nameOf(`${JSON.stringify(diagram)}|${vars}|${follow ? `${follow.width}|${follow.lang}` : ""}`);
9203
9233
  const m = new Motion(`dg${id}`, timeline.total, timeline.last);
9204
- const ctx = { m, t: timeline, id, sh: `filter="url(#dg-sh-${id})"`, end: timeline.steps[timeline.steps.length - 1].end, ink, traces };
9234
+ 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) };
9205
9235
  const on = involved(diagram);
9206
9236
  const subs = subChanges(diagram, timeline, layout.kind !== "sequence");
9207
9237
  const L = { band: [], base: [], lit: [], node: [], badge: [], top: [] };
@@ -11132,7 +11162,7 @@ function simplify(keys2) {
11132
11162
  }
11133
11163
  return out;
11134
11164
  }
11135
- function valueAt(keys2, t) {
11165
+ function valueAt2(keys2, t) {
11136
11166
  const first = keys2[0];
11137
11167
  if (!first) return 0;
11138
11168
  if (t <= first[0]) return first[1];
@@ -11314,7 +11344,7 @@ function meterField(field, keys2, ctx) {
11314
11344
  const y = field.y + M.y;
11315
11345
  const kf = m.kf([
11316
11346
  ...simplify(keys2).map(([t, v]) => [t, { transform: `scaleX(${r14(v * 1e3) / 1e3})` }]),
11317
- [m.last, { transform: `scaleX(${r14(valueAt(keys2, m.last) * 1e3) / 1e3})` }, EASE.inOut],
11347
+ [m.last, { transform: `scaleX(${r14(valueAt2(keys2, m.last) * 1e3) / 1e3})` }, EASE.inOut],
11318
11348
  [m.total, { transform: "scaleX(0)" }]
11319
11349
  ]);
11320
11350
  const lx = x + w * line;
@@ -11322,9 +11352,9 @@ function meterField(field, keys2, ctx) {
11322
11352
  }
11323
11353
  function timeFocus(layout, timeline, step, parts, vw, vh) {
11324
11354
  const span = timeline.steps[step];
11325
- const position = valueAt(timeline.needle ?? [], span.end - MOTION.still);
11355
+ const position = valueAt2(timeline.needle ?? [], span.end - MOTION.still);
11326
11356
  const badge2 = layout.badges.find((b) => b.step === step);
11327
- const anchored = badge2 && valueAt(timeline.needle ?? [], span.start) === position && !(layout.strip && badge2.y >= layout.strip.y);
11357
+ const anchored = badge2 && valueAt2(timeline.needle ?? [], span.start) === position && !(layout.strip && badge2.y >= layout.strip.y);
11328
11358
  const ax = anchored ? badge2.x : layout.axis.x + position * layout.axis.unit;
11329
11359
  const top = Math.min(...layout.rows.map((r) => r.y));
11330
11360
  const bottom = Math.max(...layout.rows.map((r) => r.y + r.h));
@@ -11906,16 +11936,16 @@ async function film(stage2, plan2) {
11906
11936
  const delay = gifEvery / fps * 1e3;
11907
11937
  const sampled = [];
11908
11938
  let colors = [];
11909
- const nearest = /* @__PURE__ */ new Map();
11939
+ const nearest2 = /* @__PURE__ */ new Map();
11910
11940
  const toIndex = (data) => {
11911
11941
  const index = new Uint8Array(data.length / 4);
11912
11942
  for (let p = 0; p < index.length; p++) {
11913
11943
  const i = p * 4;
11914
11944
  const key = data[i] << 16 | data[i + 1] << 8 | data[i + 2];
11915
- let k = nearest.get(key);
11945
+ let k = nearest2.get(key);
11916
11946
  if (k === void 0) {
11917
11947
  k = gif.nearestColorIndex(colors, [data[i], data[i + 1], data[i + 2]]);
11918
- nearest.set(key, k);
11948
+ nearest2.set(key, k);
11919
11949
  }
11920
11950
  index[p] = k;
11921
11951
  }