@pixerate/editor 0.164.0 → 0.166.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 (146) hide show
  1. package/dist/agent/index.cjs +54 -39
  2. package/dist/agent/index.js +24 -9
  3. package/dist/animation/index.cjs +6 -5
  4. package/dist/animation/index.js +5 -4
  5. package/dist/animation-editor/index.cjs +65 -64
  6. package/dist/animation-editor/index.js +8 -7
  7. package/dist/bridge/cli.cjs +3 -3
  8. package/dist/bridge/cli.js +2 -2
  9. package/dist/bridge/index.cjs +3 -3
  10. package/dist/bridge/index.js +2 -2
  11. package/dist/canvas/index.cjs +89 -87
  12. package/dist/canvas/index.js +11 -9
  13. package/dist/chart/controller.d.cts +60 -2
  14. package/dist/chart/controller.d.ts +60 -2
  15. package/dist/chart/index.cjs +657 -163
  16. package/dist/chart/index.d.cts +3 -0
  17. package/dist/chart/index.d.ts +3 -0
  18. package/dist/chart/index.js +512 -18
  19. package/dist/chart/layout-families.d.cts +14 -0
  20. package/dist/chart/layout-families.d.ts +14 -0
  21. package/dist/chart/layout-shared.d.cts +5 -0
  22. package/dist/chart/layout-shared.d.ts +5 -0
  23. package/dist/chart/links.d.cts +34 -0
  24. package/dist/chart/links.d.ts +34 -0
  25. package/dist/chart/mermaid.d.cts +9 -6
  26. package/dist/chart/mermaid.d.ts +9 -6
  27. package/dist/chart/race.d.cts +26 -0
  28. package/dist/chart/race.d.ts +26 -0
  29. package/dist/chart/schemas.d.cts +5 -0
  30. package/dist/chart/schemas.d.ts +5 -0
  31. package/dist/chart/spec.d.cts +3 -2
  32. package/dist/chart/spec.d.ts +3 -2
  33. package/dist/chart/style.d.cts +33 -0
  34. package/dist/chart/style.d.ts +33 -0
  35. package/dist/chart/types.d.cts +28 -2
  36. package/dist/chart/types.d.ts +28 -2
  37. package/dist/{chunk-ZVNAMTFO.cjs → chunk-3FSUJIXN.cjs} +18 -174
  38. package/dist/{chunk-RQCMSEM5.cjs → chunk-4QUUHTGJ.cjs} +2 -2
  39. package/dist/{chunk-CIPIESX4.cjs → chunk-4ZC5QJE2.cjs} +3 -3
  40. package/dist/{chunk-S6X2QRVU.cjs → chunk-5UEFBM2M.cjs} +1 -138
  41. package/dist/{chunk-5FNGLV2D.js → chunk-5UNQDC3Q.js} +18 -3
  42. package/dist/{chunk-YSAGBIRW.cjs → chunk-6FYIFGBW.cjs} +16 -16
  43. package/dist/{chunk-QYZGBVNC.js → chunk-7272D3K2.js} +10 -8
  44. package/dist/{chunk-462WGGXX.cjs → chunk-AMX23CSN.cjs} +27 -16
  45. package/dist/{chunk-3VLOOO3G.js → chunk-BDIM6NVW.js} +1 -1
  46. package/dist/{chunk-R3P2M7HU.cjs → chunk-BPX4Z3N3.cjs} +355 -207
  47. package/dist/{chunk-D54JHQK2.cjs → chunk-CHLV7UFP.cjs} +51 -51
  48. package/dist/{chunk-OXERWBKE.js → chunk-DFCAR7AW.js} +3 -3
  49. package/dist/{chunk-GZ2FM3ZB.js → chunk-DKNEQX7T.js} +6 -162
  50. package/dist/{chunk-JCXMJUQO.cjs → chunk-EGZM52EO.cjs} +3 -3
  51. package/dist/{chunk-ES3UEVUT.cjs → chunk-EUIDTZNQ.cjs} +112 -110
  52. package/dist/{chunk-H3OEM3Q2.js → chunk-F6R67I3A.js} +1 -1
  53. package/dist/{chunk-3NEZJCBY.js → chunk-FR432ROA.js} +349 -201
  54. package/dist/chunk-HIDFL5LQ.js +484 -0
  55. package/dist/{chunk-22KLZZGH.cjs → chunk-HXOBOHH2.cjs} +8 -8
  56. package/dist/{chunk-MKTDELCD.js → chunk-I5MRJW7B.js} +1 -1
  57. package/dist/{chunk-SDHZG5TF.js → chunk-ILP77UD6.js} +160 -2
  58. package/dist/{chunk-Z4P2RBMJ.js → chunk-ITANXMZD.js} +177 -3
  59. package/dist/chunk-KGRZMHZB.js +204 -0
  60. package/dist/{chunk-SET6KJOP.js → chunk-LPIKXPBM.js} +1 -1
  61. package/dist/{chunk-BQWGN5WH.js → chunk-M2TPMYJE.js} +1 -1
  62. package/dist/{chunk-GTELFJRE.cjs → chunk-M5GLQQWG.cjs} +2 -2
  63. package/dist/{chunk-4VU4CP7R.js → chunk-MHLU6GRJ.js} +1 -138
  64. package/dist/{chunk-NZD2MZJC.cjs → chunk-MZFZSVUJ.cjs} +38 -23
  65. package/dist/{chunk-DAPQGA55.js → chunk-NQQDGGXY.js} +2 -2
  66. package/dist/chunk-O6OGNDND.js +164 -0
  67. package/dist/{chunk-PA3IMPPS.cjs → chunk-OVYQAYGH.cjs} +81 -81
  68. package/dist/{chunk-YXOW456B.js → chunk-PPEDZ5WR.js} +1 -1
  69. package/dist/{chunk-24M7VD6M.cjs → chunk-S4EIAIEW.cjs} +7 -7
  70. package/dist/{chunk-M4MIZPQI.cjs → chunk-SJ2CPTQC.cjs} +189 -15
  71. package/dist/{chunk-YGG7WDWT.cjs → chunk-SZWVMB3B.cjs} +24 -18
  72. package/dist/chunk-TFF2GTGN.cjs +153 -0
  73. package/dist/chunk-TTCJPX4U.cjs +204 -0
  74. package/dist/{chunk-SBQVEBSU.cjs → chunk-UUUTEVX6.cjs} +242 -68
  75. package/dist/{chunk-WI7QJA7A.cjs → chunk-UXETV2NC.cjs} +161 -3
  76. package/dist/{chunk-GKNEJ6EN.cjs → chunk-V5L2G22R.cjs} +321 -107
  77. package/dist/{chunk-TALQONZ5.js → chunk-VB2CY6EG.js} +3 -3
  78. package/dist/{chunk-QY4KUDMY.js → chunk-VRXXAXUT.js} +2 -2
  79. package/dist/chunk-VU6WQSMB.cjs +164 -0
  80. package/dist/{chunk-NHLYK3AX.js → chunk-XBQX76CT.js} +182 -8
  81. package/dist/{chunk-5AARIS3R.cjs → chunk-XCDGM7TD.cjs} +37 -37
  82. package/dist/{chunk-POR54B55.js → chunk-XNU45TYA.js} +7 -1
  83. package/dist/{chunk-EVXQNQND.js → chunk-XZB3TJ6K.js} +16 -5
  84. package/dist/chunk-YBAPT7NL.js +153 -0
  85. package/dist/{chunk-SZA42R4N.js → chunk-YUFTVNLX.js} +230 -16
  86. package/dist/chunk-Z2UQYMPS.cjs +484 -0
  87. package/dist/color/index.cjs +5 -3
  88. package/dist/color/index.js +12 -10
  89. package/dist/diagram/index.cjs +55 -243
  90. package/dist/diagram/index.js +12 -200
  91. package/dist/export/index.cjs +7 -6
  92. package/dist/export/index.js +6 -5
  93. package/dist/extensions/index.cjs +12 -9
  94. package/dist/extensions/index.js +11 -8
  95. package/dist/gradient/index.cjs +29 -27
  96. package/dist/gradient/index.js +6 -4
  97. package/dist/image-editor/index.cjs +644 -643
  98. package/dist/image-editor/index.js +7 -6
  99. package/dist/index.cjs +21 -18
  100. package/dist/index.js +14 -11
  101. package/dist/paint-editor/index.cjs +19 -18
  102. package/dist/paint-editor/index.js +7 -6
  103. package/dist/parameters/index.cjs +2 -2
  104. package/dist/parameters/index.js +1 -1
  105. package/dist/persistence/assetWrites.d.cts +22 -0
  106. package/dist/persistence/assetWrites.d.ts +22 -0
  107. package/dist/persistence/assets.d.cts +71 -0
  108. package/dist/persistence/assets.d.ts +71 -0
  109. package/dist/persistence/documentStore.d.cts +17 -1
  110. package/dist/persistence/documentStore.d.ts +17 -1
  111. package/dist/persistence/documentTools.d.cts +5 -1
  112. package/dist/persistence/documentTools.d.ts +5 -1
  113. package/dist/persistence/editorAutosave.d.cts +7 -0
  114. package/dist/persistence/editorAutosave.d.ts +7 -0
  115. package/dist/persistence/index.cjs +141 -21
  116. package/dist/persistence/index.js +130 -10
  117. package/dist/persistence/storage.d.cts +13 -1
  118. package/dist/persistence/storage.d.ts +13 -1
  119. package/dist/spreadsheet/index.cjs +3 -3
  120. package/dist/spreadsheet/index.js +2 -2
  121. package/dist/tokens/index.cjs +11 -3
  122. package/dist/tokens/index.d.cts +1 -0
  123. package/dist/tokens/index.d.ts +1 -0
  124. package/dist/tokens/index.js +10 -2
  125. package/dist/tokens/style.d.cts +36 -0
  126. package/dist/tokens/style.d.ts +36 -0
  127. package/dist/tools/index.cjs +15 -3
  128. package/dist/tools/index.d.cts +2 -0
  129. package/dist/tools/index.d.ts +2 -0
  130. package/dist/tools/index.js +14 -2
  131. package/dist/tools/style-tools.d.cts +19 -0
  132. package/dist/tools/style-tools.d.ts +19 -0
  133. package/dist/tools/style.d.cts +212 -0
  134. package/dist/tools/style.d.ts +212 -0
  135. package/dist/tools/view.d.cts +6 -0
  136. package/dist/tools/view.d.ts +6 -0
  137. package/dist/typography/index.cjs +8 -6
  138. package/dist/typography/index.js +5 -3
  139. package/dist/vector/index.cjs +953 -952
  140. package/dist/vector/index.js +7 -6
  141. package/dist/video-editor/index.cjs +8 -7
  142. package/dist/video-editor/index.js +6 -5
  143. package/package.json +1 -1
  144. package/skills/pixerate-chart/SKILL.md +20 -2
  145. package/dist/chunk-ERAGQL2N.cjs +0 -68
  146. package/dist/chunk-KMU6QJB7.js +0 -68
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  CHART_OOXML_NS,
9
9
  chartFromOoxml
10
- } from "./chunk-POR54B55.js";
10
+ } from "./chunk-XNU45TYA.js";
11
11
  import {
12
12
  compareDocuments
13
13
  } from "./chunk-V5OOP74P.js";
@@ -34,10 +34,10 @@ import {
34
34
  searchDocument,
35
35
  sliceContainsTable,
36
36
  syncInitialContent
37
- } from "./chunk-OXERWBKE.js";
37
+ } from "./chunk-DFCAR7AW.js";
38
38
  import {
39
39
  chartDataToTable
40
- } from "./chunk-3NEZJCBY.js";
40
+ } from "./chunk-FR432ROA.js";
41
41
  import {
42
42
  PIXERATE_DOCUMENT_MIME,
43
43
  getClipboardData,
@@ -18,7 +18,7 @@ import {
18
18
  unionBounds,
19
19
  vectorGradientPoints,
20
20
  widthProfileAt
21
- } from "./chunk-SET6KJOP.js";
21
+ } from "./chunk-LPIKXPBM.js";
22
22
  import {
23
23
  segmentLength,
24
24
  segmentParamAtLength,
@@ -29,7 +29,7 @@ import {
29
29
  } from "./chunk-5UJHB3BW.js";
30
30
  import {
31
31
  mixColorsOklab
32
- } from "./chunk-BQWGN5WH.js";
32
+ } from "./chunk-M2TPMYJE.js";
33
33
 
34
34
  // src/vector/blend.ts
35
35
  var lerpN = (a, b, t) => a + (b - a) * t;
@@ -0,0 +1,164 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/diagram/source/lines.ts
2
+ var HEADER_PATTERNS = [
3
+ [/^\s*(flowchart|graph)(?:-elk)?\b/i, "flowchart"],
4
+ [/^\s*stateDiagram(?:-v2)?\b/i, "state"],
5
+ [/^\s*classDiagram(?:-v2)?\b/i, "class"],
6
+ [/^\s*erDiagram\b/i, "er"],
7
+ [/^\s*requirementDiagram\b/i, "requirement"],
8
+ [/^\s*mindmap\b/i, "mindmap"],
9
+ [/^\s*sequenceDiagram\b/i, "sequence"],
10
+ [/^\s*gantt\b/i, "gantt"],
11
+ [/^\s*pie\b/i, "pie"],
12
+ [/^\s*journey\b/i, "journey"],
13
+ [/^\s*timeline\b/i, "timeline"],
14
+ [/^\s*gitGraph\b/i, "gitGraph"],
15
+ [/^\s*C4(Context|Container|Component|Dynamic|Deployment)\b/, "c4"],
16
+ [/^\s*quadrantChart\b/i, "quadrant"],
17
+ [/^\s*sankey(?:-beta)?\b/i, "sankey"],
18
+ [/^\s*xychart(?:-beta)?\b/i, "xychart"],
19
+ [/^\s*block(?:-beta)?\b/i, "block"],
20
+ [/^\s*architecture(?:-beta)?\b/i, "architecture"],
21
+ [/^\s*packet(?:-beta)?\b/i, "packet"],
22
+ [/^\s*kanban\b/i, "kanban"],
23
+ [/^\s*radar(?:-beta)?\b/i, "radar"],
24
+ [/^\s*treemap(?:-beta)?\b/i, "treemap"],
25
+ [/^\s*info\b/i, "info"]
26
+ ];
27
+ function detectFamilyFromHeader(header) {
28
+ for (const [re, family] of HEADER_PATTERNS) {
29
+ if (re.test(header)) return family;
30
+ }
31
+ return "unknown";
32
+ }
33
+ function isCommentLine(line) {
34
+ const t = line.trim();
35
+ return t.startsWith("%%") && !t.startsWith("%%{");
36
+ }
37
+ function isDirectiveLine(line) {
38
+ return /^\s*%%\{.*\}%%\s*$/.test(line);
39
+ }
40
+ function splitSource(source) {
41
+ const eol = source.includes("\r\n") ? "\r\n" : "\n";
42
+ const rawLines = source.split(/\r\n|\n/);
43
+ let end = rawLines.length;
44
+ while (end > 0 && rawLines[end - 1].trim() === "") end--;
45
+ const trailingLines = rawLines.slice(end);
46
+ const trailing = trailingLines.length ? eol + trailingLines.join(eol) : "";
47
+ const lines = rawLines.slice(0, end);
48
+ const preambleLines = [];
49
+ let i = 0;
50
+ let frontmatter;
51
+ if (lines[0] !== void 0 && /^---\s*$/.test(lines[0])) {
52
+ preambleLines.push(lines[0]);
53
+ i = 1;
54
+ const fm = [];
55
+ while (i < lines.length && !/^---\s*$/.test(lines[i])) {
56
+ fm.push(lines[i]);
57
+ preambleLines.push(lines[i]);
58
+ i++;
59
+ }
60
+ if (i < lines.length) {
61
+ preambleLines.push(lines[i]);
62
+ i++;
63
+ }
64
+ frontmatter = parseSimpleYaml(fm);
65
+ }
66
+ while (i < lines.length) {
67
+ const line = lines[i];
68
+ if (line.trim() === "" || isDirectiveLine(line) || isCommentLine(line)) {
69
+ preambleLines.push(line);
70
+ i++;
71
+ continue;
72
+ }
73
+ break;
74
+ }
75
+ const headerIndex = i;
76
+ const header = _nullishCoalesce(lines[i], () => ( ""));
77
+ const bodyLines = lines.slice(i + 1);
78
+ return {
79
+ eol,
80
+ preamble: { lines: preambleLines, frontmatter },
81
+ header,
82
+ headerIndex,
83
+ bodyLines,
84
+ trailing
85
+ };
86
+ }
87
+ function parseSimpleYaml(lines) {
88
+ const out = {};
89
+ let currentKey = null;
90
+ let nested = null;
91
+ for (const raw of lines) {
92
+ if (raw.trim() === "" || raw.trim().startsWith("#")) continue;
93
+ const indent = raw.length - raw.trimStart().length;
94
+ const m = /^([A-Za-z_][\w-]*)\s*:\s*(.*)$/.exec(raw.trim());
95
+ if (!m) continue;
96
+ const [, key, valueRaw] = m;
97
+ const value = parseYamlScalar(valueRaw);
98
+ if (indent === 0) {
99
+ currentKey = key;
100
+ if (valueRaw.trim() === "") {
101
+ nested = {};
102
+ out[key] = nested;
103
+ } else {
104
+ nested = null;
105
+ out[key] = value;
106
+ }
107
+ } else if (nested && currentKey) {
108
+ nested[key] = value;
109
+ }
110
+ }
111
+ return out;
112
+ }
113
+ function parseYamlScalar(v) {
114
+ const t = v.trim();
115
+ if (t === "") return "";
116
+ if (t.startsWith("{") || t.startsWith("[")) {
117
+ try {
118
+ return JSON.parse(t);
119
+ } catch (e) {
120
+ return t;
121
+ }
122
+ }
123
+ if (/^(true|false)$/i.test(t)) return t.toLowerCase() === "true";
124
+ if (/^-?\d+(\.\d+)?$/.test(t)) return Number(t);
125
+ if (t.startsWith('"') && t.endsWith('"') || t.startsWith("'") && t.endsWith("'")) {
126
+ return t.slice(1, -1);
127
+ }
128
+ return t;
129
+ }
130
+ function splitStatements(line) {
131
+ const parts = [];
132
+ let depth = 0;
133
+ let quote = null;
134
+ let cur = "";
135
+ for (let i = 0; i < line.length; i++) {
136
+ const ch = line[i];
137
+ if (quote) {
138
+ cur += ch;
139
+ if (ch === quote) quote = null;
140
+ continue;
141
+ }
142
+ if (ch === '"' || ch === "`") {
143
+ quote = ch;
144
+ cur += ch;
145
+ continue;
146
+ }
147
+ if (ch === "[" || ch === "(" || ch === "{") depth++;
148
+ else if (ch === "]" || ch === ")" || ch === "}") depth = Math.max(0, depth - 1);
149
+ if (ch === ";" && depth === 0) {
150
+ parts.push(cur);
151
+ cur = "";
152
+ continue;
153
+ }
154
+ cur += ch;
155
+ }
156
+ parts.push(cur);
157
+ return parts;
158
+ }
159
+
160
+
161
+
162
+
163
+
164
+ exports.detectFamilyFromHeader = detectFamilyFromHeader; exports.splitSource = splitSource; exports.splitStatements = splitStatements;
@@ -3,6 +3,42 @@ import {
3
3
  stripPrototypeKeys
4
4
  } from "./chunk-HF5QZS7Z.js";
5
5
 
6
+ // src/persistence/assetWrites.ts
7
+ var leases = /* @__PURE__ */ new Map();
8
+ var watchers = /* @__PURE__ */ new Set();
9
+ function leaseAssetRefs(refs) {
10
+ const held = [...new Set(refs)];
11
+ for (const ref of held) {
12
+ leases.set(ref, (leases.get(ref) ?? 0) + 1);
13
+ for (const touched of watchers) touched.add(ref);
14
+ }
15
+ let released = false;
16
+ return () => {
17
+ if (released) return;
18
+ released = true;
19
+ for (const ref of held) {
20
+ const n = (leases.get(ref) ?? 1) - 1;
21
+ if (n > 0) leases.set(ref, n);
22
+ else leases.delete(ref);
23
+ }
24
+ };
25
+ }
26
+ function watchAssetLeases() {
27
+ const touched = new Set(leases.keys());
28
+ watchers.add(touched);
29
+ return { touched, stop: () => void watchers.delete(touched) };
30
+ }
31
+ function withAssetLock(prefix, mode, task) {
32
+ let locks;
33
+ try {
34
+ locks = globalThis.navigator?.locks;
35
+ } catch {
36
+ locks = void 0;
37
+ }
38
+ if (!locks || typeof locks.request !== "function") return task();
39
+ return locks.request(`pixerate-editor-assets:${prefix}`, { mode }, task);
40
+ }
41
+
6
42
  // src/persistence/assets.ts
7
43
  var EDITOR_ASSET_PREFIX = "pixerate-asset:";
8
44
  var REF = /pixerate-asset:[0-9a-z]+-[0-9a-z]+(?:~[0-9]+)?/g;
@@ -45,7 +81,8 @@ function createEditorAssetRegistry() {
45
81
  },
46
82
  get size() {
47
83
  return byRef.size;
48
- }
84
+ },
85
+ refs: () => [...byRef.keys()]
49
86
  };
50
87
  }
51
88
  function externalizeAssets(value, registry) {
@@ -85,11 +122,22 @@ function internalizeAssets(value, registry) {
85
122
  return walk(value);
86
123
  }
87
124
  var persisted = /* @__PURE__ */ new WeakMap();
88
- var assetKey = (ref, options) => `${options.prefix ?? "pixerate.assets:"}${ref.slice(EDITOR_ASSET_PREFIX.length)}`;
125
+ var assetPrefix = (options) => options.prefix ?? "pixerate.assets:";
126
+ var assetKey = (ref, options) => `${assetPrefix(options)}${ref.slice(EDITOR_ASSET_PREFIX.length)}`;
127
+ var markerKey = (options) => `${assetPrefix(options)}#collected`;
128
+ var ASSET_ID = /^[0-9a-z]+-[0-9a-z]+(?:~[0-9]+)?$/;
89
129
  async function persistEditorAssets(storage, registry, document, options = {}) {
90
- const written = persisted.get(storage) ?? /* @__PURE__ */ new Set();
91
- persisted.set(storage, written);
92
- for (const ref of collectAssetRefs(document)) {
130
+ const refs = collectAssetRefs(document);
131
+ if (!refs.length) return;
132
+ const cache = persisted.get(storage) ?? { marker: void 0, keys: /* @__PURE__ */ new Set() };
133
+ persisted.set(storage, cache);
134
+ const marker = await storage.get(markerKey(options)).catch(() => void 0);
135
+ if (marker === void 0 || marker !== cache.marker) {
136
+ cache.keys.clear();
137
+ cache.marker = marker;
138
+ }
139
+ const written = cache.keys;
140
+ for (const ref of refs) {
93
141
  const key = assetKey(ref, options);
94
142
  if (written.has(key)) continue;
95
143
  const data = registry.get(ref);
@@ -120,12 +168,135 @@ function withEditorAssets(storage, registry, options = {}) {
120
168
  return value;
121
169
  },
122
170
  async set(key, value) {
123
- if (value.includes(EDITOR_ASSET_PREFIX)) await persistEditorAssets(storage, registry, value, options);
124
- await storage.set(key, value);
171
+ if (!value.includes(EDITOR_ASSET_PREFIX)) return storage.set(key, value);
172
+ await writeWithAssets(storage, registry, value, options, () => storage.set(key, value));
125
173
  },
126
- remove: (key) => storage.remove(key)
174
+ remove: (key) => storage.remove(key),
175
+ ...storage.keys ? { keys: (prefix) => storage.keys(prefix) } : {}
127
176
  };
128
177
  }
178
+ async function writeWithAssets(storage, registry, document, options, write) {
179
+ const release = leaseAssetRefs(collectAssetRefs(document));
180
+ try {
181
+ await withAssetLock(assetPrefix(options), "shared", async () => {
182
+ if (registry) await persistEditorAssets(storage, registry, document, options);
183
+ await write();
184
+ });
185
+ } finally {
186
+ release();
187
+ }
188
+ }
189
+ var isRegistry = (value) => !!value && typeof value === "object" && ["put", "get", "has", "set"].every((k) => typeof value[k] === "function");
190
+ var refChars = (ref) => parseInt(ref.slice(EDITOR_ASSET_PREFIX.length).split("-")[0], 36) || 0;
191
+ function keptRefs(keep) {
192
+ const out = /* @__PURE__ */ new Set();
193
+ const addRegistry = (registry) => {
194
+ if (typeof registry.refs !== "function") {
195
+ throw new Error("A registry passed in keep cannot list its references (it has no refs()). Use createEditorAssetRegistry, or pass the documents to keep instead.");
196
+ }
197
+ for (const ref of registry.refs()) out.add(ref);
198
+ };
199
+ for (const item of keep) {
200
+ if (isRegistry(item)) addRegistry(item);
201
+ else if (item && typeof item === "object" && isRegistry(item.assets)) addRegistry(item.assets);
202
+ else for (const ref of collectAssetRefs(item)) out.add(ref);
203
+ }
204
+ return out;
205
+ }
206
+ async function collectEditorAssetGarbage(storage, options = {}) {
207
+ if (typeof storage.keys !== "function") {
208
+ throw new Error(
209
+ `This ${storage.kind} storage cannot list its keys, so unreferenced assets cannot be found. Give the adapter a keys(prefix) method (every built-in adapter has one).`
210
+ );
211
+ }
212
+ const listKeys = storage.keys.bind(storage);
213
+ const prefix = assetPrefix(options);
214
+ const keep = keptRefs(options.keep ?? []);
215
+ const dryRun = options.dryRun === true;
216
+ return withAssetLock(prefix, "exclusive", async () => {
217
+ const watch = watchAssetLeases();
218
+ try {
219
+ const assetKeys = (await listKeys(prefix)).filter((key) => ASSET_ID.test(key.slice(prefix.length)));
220
+ const others = (await listKeys("")).filter((key) => !key.startsWith(prefix));
221
+ const live = /* @__PURE__ */ new Set();
222
+ for (const key of others) {
223
+ const value = await storage.get(key);
224
+ if (value !== null && value.includes(EDITOR_ASSET_PREFIX)) for (const ref of collectAssetRefs(value)) live.add(ref);
225
+ }
226
+ const toRef = (key) => `${EDITOR_ASSET_PREFIX}${key.slice(prefix.length)}`;
227
+ let referenced = 0;
228
+ let kept = 0;
229
+ const candidates = [];
230
+ for (const key of assetKeys) {
231
+ const ref = toRef(key);
232
+ if (live.has(ref)) referenced++;
233
+ else if (keep.has(ref) || watch.touched.has(ref)) kept++;
234
+ else candidates.push(ref);
235
+ }
236
+ let unreferenced = candidates;
237
+ if (options.only) {
238
+ const wanted = new Set(options.only);
239
+ const stale = [...wanted].filter((ref) => !candidates.includes(ref));
240
+ if (stale.length) {
241
+ throw new Error(
242
+ `${stale.length} of the given asset${stale.length === 1 ? " is" : "s are"} not unreferenced in storage now (${stale.slice(0, 3).join(", ")}${stale.length > 3 ? ", \u2026" : ""}): unknown, already deleted, referenced or in use. Nothing was deleted; find the unreferenced assets again.`
243
+ );
244
+ }
245
+ unreferenced = candidates.filter((ref) => wanted.has(ref));
246
+ }
247
+ const report = {
248
+ assets: assetKeys.length,
249
+ scannedKeys: others.length,
250
+ referenced,
251
+ kept,
252
+ unreferenced,
253
+ unreferencedChars: unreferenced.reduce((n, ref) => n + refChars(ref), 0),
254
+ removed: [],
255
+ freedChars: 0,
256
+ dryRun
257
+ };
258
+ if (dryRun || !unreferenced.length) return report;
259
+ await storage.set(markerKey(options), `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`);
260
+ for (const ref of unreferenced) {
261
+ if (watch.touched.has(ref)) {
262
+ report.kept++;
263
+ continue;
264
+ }
265
+ try {
266
+ await storage.remove(assetKey(ref, options));
267
+ } catch (error) {
268
+ throw new Error(
269
+ `Deleted ${report.removed.length} of ${unreferenced.length} unreferenced assets, then storage failed: ${error instanceof Error ? error.message : String(error)}. The rest are still stored and nothing refers to the deleted ones; run the collection again.`
270
+ );
271
+ }
272
+ report.removed.push(ref);
273
+ report.freedChars += refChars(ref);
274
+ }
275
+ return report;
276
+ } finally {
277
+ watch.stop();
278
+ }
279
+ });
280
+ }
281
+ async function tryCollectEditorAssetGarbage(storage, options = {}) {
282
+ if (typeof storage.keys !== "function") return null;
283
+ try {
284
+ return await collectEditorAssetGarbage(storage, options);
285
+ } catch {
286
+ return null;
287
+ }
288
+ }
289
+ async function collectRetiredEditorAssets(storage, doc, setting = true) {
290
+ if (!doc.assets || setting === false) return null;
291
+ const extra = setting === true ? {} : setting;
292
+ let current;
293
+ try {
294
+ current = doc.getDocument();
295
+ } catch {
296
+ return null;
297
+ }
298
+ return tryCollectEditorAssetGarbage(storage, { ...extra, keep: [current, ...extra.keep ?? []] });
299
+ }
129
300
 
130
301
  // src/persistence/migrate.ts
131
302
  function hasLoadProblems(report) {
@@ -378,6 +549,9 @@ export {
378
549
  persistEditorAssets,
379
550
  preloadEditorAssets,
380
551
  withEditorAssets,
552
+ collectEditorAssetGarbage,
553
+ tryCollectEditorAssetGarbage,
554
+ collectRetiredEditorAssets,
381
555
  hasLoadProblems,
382
556
  createLoadReport,
383
557
  migrateDocument,
@@ -18,7 +18,7 @@
18
18
 
19
19
 
20
20
 
21
- var _chunkJCXMJUQOcjs = require('./chunk-JCXMJUQO.cjs');
21
+ var _chunkEGZM52EOcjs = require('./chunk-EGZM52EO.cjs');
22
22
 
23
23
 
24
24
 
@@ -29,7 +29,7 @@ var _chunkGF2RBSDMcjs = require('./chunk-GF2RBSDM.cjs');
29
29
  var _chunkDWJJI6RTcjs = require('./chunk-DWJJI6RT.cjs');
30
30
 
31
31
 
32
- var _chunkCIPIESX4cjs = require('./chunk-CIPIESX4.cjs');
32
+ var _chunk4ZC5QJE2cjs = require('./chunk-4ZC5QJE2.cjs');
33
33
 
34
34
  // src/vector/blend.ts
35
35
  var lerpN = (a, b, t) => a + (b - a) * t;
@@ -37,7 +37,7 @@ var lerpP = (a, b, t) => [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t];
37
37
  var toP = (v) => [v.x, v.y];
38
38
  var mapP = (m, p) => [m[0] * p[0] + m[2] * p[1] + m[4], m[1] * p[0] + m[3] * p[1] + m[5]];
39
39
  var curvesOf = (c) => Math.max(0, (c.pts.length - 1) / 3) | 0;
40
- function subpathToMorphContour(sp, m = _chunkJCXMJUQOcjs.IDENTITY_MATRIX) {
40
+ function subpathToMorphContour(sp, m = _chunkEGZM52EOcjs.IDENTITY_MATRIX) {
41
41
  const n = sp.anchors.length;
42
42
  if (!n) return null;
43
43
  const first = mapP(m, toP(sp.anchors[0]));
@@ -67,8 +67,8 @@ function isStraight(p0, p1, p2, p3) {
67
67
  const u2 = along(p2);
68
68
  return off(p1) < tol && off(p2) < tol && u1 >= -1e-9 && u1 <= 1 + 1e-9 && u2 >= -1e-9 && u2 <= 1 + 1e-9;
69
69
  }
70
- function morphContourToSubpath(c, m = _chunkJCXMJUQOcjs.IDENTITY_MATRIX, closed = c.closed) {
71
- const pts = _chunkJCXMJUQOcjs.isIdentityMatrix.call(void 0, m) ? c.pts : c.pts.map((p) => mapP(m, p));
70
+ function morphContourToSubpath(c, m = _chunkEGZM52EOcjs.IDENTITY_MATRIX, closed = c.closed) {
71
+ const pts = _chunkEGZM52EOcjs.isIdentityMatrix.call(void 0, m) ? c.pts : c.pts.map((p) => mapP(m, p));
72
72
  const curves = curvesOf(c);
73
73
  const dropLast = closed && c.closed && curves > 0;
74
74
  const count = dropLast ? curves : curves + 1;
@@ -84,7 +84,7 @@ function morphContourToSubpath(c, m = _chunkJCXMJUQOcjs.IDENTITY_MATRIX, closed
84
84
  anchors[(k + 1) % count].in = { x: p2[0], y: p2[1] };
85
85
  }
86
86
  for (const a of anchors) {
87
- const type = _chunkJCXMJUQOcjs.inferAnchorType.call(void 0, a);
87
+ const type = _chunkEGZM52EOcjs.inferAnchorType.call(void 0, a);
88
88
  if (type !== "corner") a.type = type;
89
89
  }
90
90
  const isClosed = closed && curves > 0;
@@ -267,7 +267,7 @@ function bestStart(fixed, free, useShapeContext) {
267
267
  return best;
268
268
  }
269
269
  function placeIn(c, from, to) {
270
- const b = _chunkJCXMJUQOcjs.unionBounds.call(void 0, [boundsOfPoints(c.pts)]);
270
+ const b = _chunkEGZM52EOcjs.unionBounds.call(void 0, [boundsOfPoints(c.pts)]);
271
271
  const p = b ? [b.x + b.width / 2, b.y + b.height / 2] : c.pts[0];
272
272
  if (!from || !to) return p;
273
273
  const fx = from.width > 0 ? (p[0] - from.x) / from.width : 0.5;
@@ -452,11 +452,11 @@ function interpolateRigidMatrix(a, b, t) {
452
452
  function interpolateVectorColor(a, b, t) {
453
453
  if (t <= 0) return a;
454
454
  if (t >= 1) return b;
455
- return _nullishCoalesce(_chunkCIPIESX4cjs.mixColorsOklab.call(void 0, a, b, t), () => ( (t < 0.5 ? a : b)));
455
+ return _nullishCoalesce(_chunk4ZC5QJE2cjs.mixColorsOklab.call(void 0, a, b, t), () => ( (t < 0.5 ? a : b)));
456
456
  }
457
457
  function resampleGradientStops(g, offsets) {
458
458
  return offsets.map((offset) => {
459
- const s = _chunkJCXMJUQOcjs.sampleVectorGradient.call(void 0, g, offset);
459
+ const s = _chunkEGZM52EOcjs.sampleVectorGradient.call(void 0, g, offset);
460
460
  return s.opacity < 1 ? { offset, color: s.color, opacity: Math.round(s.opacity * 1e4) / 1e4 } : { offset, color: s.color };
461
461
  });
462
462
  }
@@ -467,11 +467,11 @@ function lerpAngle(a, b, t) {
467
467
  var lerpPoint = (a, b, t) => ({ x: lerpN(a.x, b.x, t), y: lerpN(a.y, b.y, t) });
468
468
  var sameColourModel = (a, b) => (_nullishCoalesce(a.interpolation, () => ( "srgb"))) === (_nullishCoalesce(b.interpolation, () => ( "srgb"))) && (_nullishCoalesce(a.smoothness, () => ( 0))) === (_nullishCoalesce(b.smoothness, () => ( 0)));
469
469
  function lerpStops(a, b, t) {
470
- let stopsA = _chunkJCXMJUQOcjs.sortedVectorGradientStops.call(void 0, a);
471
- let stopsB = _chunkJCXMJUQOcjs.sortedVectorGradientStops.call(void 0, b);
470
+ let stopsA = _chunkEGZM52EOcjs.sortedVectorGradientStops.call(void 0, a);
471
+ let stopsB = _chunkEGZM52EOcjs.sortedVectorGradientStops.call(void 0, b);
472
472
  const resampled = stopsA.length !== stopsB.length || !sameColourModel(a, b);
473
473
  if (resampled) {
474
- const offs = [..._chunkJCXMJUQOcjs.expandVectorGradientStops.call(void 0, a), ..._chunkJCXMJUQOcjs.expandVectorGradientStops.call(void 0, b), ...stopsA, ...stopsB].map((s) => s.offset).filter(Number.isFinite).sort((x, y) => x - y);
474
+ const offs = [..._chunkEGZM52EOcjs.expandVectorGradientStops.call(void 0, a), ..._chunkEGZM52EOcjs.expandVectorGradientStops.call(void 0, b), ...stopsA, ...stopsB].map((s) => s.offset).filter(Number.isFinite).sort((x, y) => x - y);
475
475
  const common = offs.filter((o, i) => i === 0 || o - offs[i - 1] > 1e-4);
476
476
  stopsA = resampleGradientStops(a, common);
477
477
  stopsB = resampleGradientStops(b, common);
@@ -498,8 +498,8 @@ function lerpGradient(a, b, t) {
498
498
  }
499
499
  if (near.spread && near.spread !== "pad") out.spread = near.spread;
500
500
  if (near.strokeMode && near.strokeMode !== "within") out.strokeMode = near.strokeMode;
501
- const ea = _chunkJCXMJUQOcjs.hasExplicitGradientGeometry.call(void 0, a);
502
- const eb = _chunkJCXMJUQOcjs.hasExplicitGradientGeometry.call(void 0, b);
501
+ const ea = _chunkEGZM52EOcjs.hasExplicitGradientGeometry.call(void 0, a);
502
+ const eb = _chunkEGZM52EOcjs.hasExplicitGradientGeometry.call(void 0, b);
503
503
  if (!ea && !eb) {
504
504
  if (a.angle !== void 0 || b.angle !== void 0 || a.type === "linear" || a.type === "reflected") {
505
505
  const fallback = a.type === "linear" || a.type === "reflected" ? 180 : 90;
@@ -512,10 +512,10 @@ function lerpGradient(a, b, t) {
512
512
  }
513
513
  return out;
514
514
  }
515
- const pa = _chunkJCXMJUQOcjs.vectorGradientPoints.call(void 0, a);
516
- const pb = _chunkJCXMJUQOcjs.vectorGradientPoints.call(void 0, b);
515
+ const pa = _chunkEGZM52EOcjs.vectorGradientPoints.call(void 0, a);
516
+ const pb = _chunkEGZM52EOcjs.vectorGradientPoints.call(void 0, b);
517
517
  if (pa.units !== pb.units) {
518
- const src = _chunkJCXMJUQOcjs.explicitVectorGradient.call(void 0, near);
518
+ const src = _chunkEGZM52EOcjs.explicitVectorGradient.call(void 0, near);
519
519
  return { ...src, stops: out.stops, ...out.interpolation ? { interpolation: out.interpolation } : {}, ...out.smoothness ? { smoothness: out.smoothness } : {} };
520
520
  }
521
521
  out.start = lerpPoint(pa.start, pb.start, t);
@@ -535,14 +535,14 @@ function solidLike(color, like) {
535
535
  function interpolateVectorPaint(a, b, t) {
536
536
  if (t <= 0) return a;
537
537
  if (t >= 1) return b;
538
- const pa = _chunkJCXMJUQOcjs.hasPaint.call(void 0, a);
539
- const pb = _chunkJCXMJUQOcjs.hasPaint.call(void 0, b);
538
+ const pa = _chunkEGZM52EOcjs.hasPaint.call(void 0, a);
539
+ const pb = _chunkEGZM52EOcjs.hasPaint.call(void 0, b);
540
540
  if (!pa && !pb) return t < 0.5 ? a : b;
541
541
  if (typeof a === "string" && pa && typeof b === "string" && pb) return interpolateVectorColor(a, b, t);
542
542
  if (!pa && typeof b === "string") return interpolateVectorColor("transparent", b, t);
543
543
  if (!pb && typeof a === "string") return interpolateVectorColor(a, "transparent", t);
544
- const ga = pa && _chunkJCXMJUQOcjs.isVectorGradient.call(void 0, a) ? a : null;
545
- const gb = pb && _chunkJCXMJUQOcjs.isVectorGradient.call(void 0, b) ? b : null;
544
+ const ga = pa && _chunkEGZM52EOcjs.isVectorGradient.call(void 0, a) ? a : null;
545
+ const gb = pb && _chunkEGZM52EOcjs.isVectorGradient.call(void 0, b) ? b : null;
546
546
  if (ga && gb) return _nullishCoalesce(lerpGradient(ga, gb, t), () => ( (t < 0.5 ? a : b)));
547
547
  if (gb) return _nullishCoalesce(lerpGradient(solidLike(pa ? a : null, gb), gb, t), () => ( b));
548
548
  if (ga) return _nullishCoalesce(lerpGradient(ga, solidLike(pb ? b : null, ga), t), () => ( a));
@@ -553,8 +553,8 @@ function interpolateWidthProfiles(a, b, t) {
553
553
  const at = [..._nullishCoalesce(a, () => ( [])), ..._nullishCoalesce(b, () => ( [])), { t: 0 }, { t: 1 }].map((p) => p.t).sort((x, y) => x - y);
554
554
  const ts = at.filter((v, i) => i === 0 || v - at[i - 1] > 1e-6);
555
555
  return ts.map((pos) => {
556
- const x = _chunkJCXMJUQOcjs.widthProfileAt.call(void 0, a, pos);
557
- const y = _chunkJCXMJUQOcjs.widthProfileAt.call(void 0, b, pos);
556
+ const x = _chunkEGZM52EOcjs.widthProfileAt.call(void 0, a, pos);
557
+ const y = _chunkEGZM52EOcjs.widthProfileAt.call(void 0, b, pos);
558
558
  return { t: pos, left: lerpN(x.left, y.left, t), right: lerpN(x.right, y.right, t) };
559
559
  });
560
560
  }
@@ -597,7 +597,7 @@ function reversedStyle(s) {
597
597
  out.endArrow = s.startArrow;
598
598
  out.startArrowScale = s.endArrowScale;
599
599
  out.endArrowScale = s.startArrowScale;
600
- if (_optionalChain([s, 'access', _6 => _6.strokeWidthProfile, 'optionalAccess', _7 => _7.length])) out.strokeWidthProfile = _chunkJCXMJUQOcjs.reverseWidthProfile.call(void 0, s.strokeWidthProfile);
600
+ if (_optionalChain([s, 'access', _6 => _6.strokeWidthProfile, 'optionalAccess', _7 => _7.length])) out.strokeWidthProfile = _chunkEGZM52EOcjs.reverseWidthProfile.call(void 0, s.strokeWidthProfile);
601
601
  for (const k of ["startArrow", "endArrow", "startArrowScale", "endArrowScale"]) if (out[k] === void 0) delete out[k];
602
602
  return out;
603
603
  }
@@ -623,19 +623,19 @@ function styleOf(n) {
623
623
  return out;
624
624
  }
625
625
  function contoursOf(node, m) {
626
- return _chunkJCXMJUQOcjs.expandVectorCorners.call(void 0, node.subpaths).map((sp) => subpathToMorphContour(sp, m)).filter((c) => !!c);
626
+ return _chunkEGZM52EOcjs.expandVectorCorners.call(void 0, node.subpaths).map((sp) => subpathToMorphContour(sp, m)).filter((c) => !!c);
627
627
  }
628
- function preparePathMorph(a, b, options, ma = _chunkJCXMJUQOcjs.nodeMatrix.call(void 0, a), mb = _chunkJCXMJUQOcjs.nodeMatrix.call(void 0, b)) {
628
+ function preparePathMorph(a, b, options, ma = _chunkEGZM52EOcjs.nodeMatrix.call(void 0, a), mb = _chunkEGZM52EOcjs.nodeMatrix.call(void 0, b)) {
629
629
  const corr = correspondMorphContours(contoursOf(a, ma), contoursOf(b, mb), options);
630
630
  const sim = procrustes(corr.a, corr.b);
631
631
  const styleA = styleOf(a);
632
632
  const styleB = corr.reversed ? reversedStyle(styleOf(b)) : styleOf(b);
633
- const rigid = !_chunkJCXMJUQOcjs.isIdentityMatrix.call(void 0, ma) || !_chunkJCXMJUQOcjs.isIdentityMatrix.call(void 0, mb);
633
+ const rigid = !_chunkEGZM52EOcjs.isIdentityMatrix.call(void 0, ma) || !_chunkEGZM52EOcjs.isIdentityMatrix.call(void 0, mb);
634
634
  const id = _nullishCoalesce(options.id, () => ( a.id));
635
635
  return (t) => {
636
636
  const contours = interpolateMorphContours(corr.a, corr.b, t, { linear: options.linear, rigidity: options.rigidity, similarity: sim });
637
- const m = rigid ? interpolateRigidMatrix(ma, mb, t) : _chunkJCXMJUQOcjs.IDENTITY_MATRIX;
638
- const back = rigid ? _chunkJCXMJUQOcjs.invertMatrix.call(void 0, m) : _chunkJCXMJUQOcjs.IDENTITY_MATRIX;
637
+ const m = rigid ? interpolateRigidMatrix(ma, mb, t) : _chunkEGZM52EOcjs.IDENTITY_MATRIX;
638
+ const back = rigid ? _chunkEGZM52EOcjs.invertMatrix.call(void 0, m) : _chunkEGZM52EOcjs.IDENTITY_MATRIX;
639
639
  const subpaths = contours.map((c, k) => {
640
640
  const closed = t <= 0 ? corr.a[k].closed : t >= 1 ? corr.b[k].closed : corr.a[k].closed && corr.b[k].closed;
641
641
  return morphContourToSubpath({ closed: corr.a[k].closed && corr.b[k].closed, pts: c.pts }, back, closed);
@@ -643,14 +643,14 @@ function preparePathMorph(a, b, options, ma = _chunkJCXMJUQOcjs.nodeMatrix.call(
643
643
  const node = { id, type: "path", subpaths, ...interpolateVectorStyle(styleA, styleB, t) };
644
644
  const opacity = lerpN(_nullishCoalesce(a.opacity, () => ( 1)), _nullishCoalesce(b.opacity, () => ( 1)), t);
645
645
  if (opacity < 1) node.opacity = opacity;
646
- if (rigid && !_chunkJCXMJUQOcjs.isIdentityMatrix.call(void 0, m)) node.transform = m;
646
+ if (rigid && !_chunkEGZM52EOcjs.isIdentityMatrix.call(void 0, m)) node.transform = m;
647
647
  return node;
648
648
  };
649
649
  }
650
- function flattenPaths(node, parent = _chunkJCXMJUQOcjs.IDENTITY_MATRIX) {
651
- const m = _chunkJCXMJUQOcjs.multiplyMatrices.call(void 0, _chunkJCXMJUQOcjs.nodeMatrix.call(void 0, node), parent);
650
+ function flattenPaths(node, parent = _chunkEGZM52EOcjs.IDENTITY_MATRIX) {
651
+ const m = _chunkEGZM52EOcjs.multiplyMatrices.call(void 0, _chunkEGZM52EOcjs.nodeMatrix.call(void 0, node), parent);
652
652
  if (node.type === "path") return [{ path: node, m, opacity: 1 }];
653
- if (node.type === "text" || node.type === "instance") return flattenPaths(_chunkJCXMJUQOcjs.expandVectorAppearance.call(void 0, node), parent);
653
+ if (node.type === "text" || node.type === "instance") return flattenPaths(_chunkEGZM52EOcjs.expandVectorAppearance.call(void 0, node), parent);
654
654
  const o = _nullishCoalesce(node.opacity, () => ( 1));
655
655
  return node.children.filter((c) => c.visible !== false).flatMap((c) => flattenPaths(c, m)).map((e) => ({ ...e, opacity: e.opacity * o }));
656
656
  }
@@ -672,8 +672,8 @@ function createVectorMorph(a, b, options = {}) {
672
672
  }
673
673
  const pa = flattenPaths(a);
674
674
  const pb = flattenPaths(b);
675
- const ba = _chunkJCXMJUQOcjs.unionBounds.call(void 0, pa.map((e) => placedBounds(e.path, e.m)));
676
- const bb = _chunkJCXMJUQOcjs.unionBounds.call(void 0, pb.map((e) => placedBounds(e.path, e.m)));
675
+ const ba = _chunkEGZM52EOcjs.unionBounds.call(void 0, pa.map((e) => placedBounds(e.path, e.m)));
676
+ const bb = _chunkEGZM52EOcjs.unionBounds.call(void 0, pb.map((e) => placedBounds(e.path, e.m)));
677
677
  const id = _nullishCoalesce(options.id, () => ( a.id));
678
678
  const parts = [];
679
679
  const opacities = [];
@@ -685,10 +685,10 @@ function createVectorMorph(a, b, options = {}) {
685
685
  parts.push(preparePathMorph(x.path, y.path, sub, x.m, y.m));
686
686
  opacities.push([x.opacity, y.opacity]);
687
687
  } else if (x) {
688
- parts.push(preparePathMorph(x.path, collapsedPath(x.path, x.m, ba, bb), sub, x.m, _chunkJCXMJUQOcjs.IDENTITY_MATRIX));
688
+ parts.push(preparePathMorph(x.path, collapsedPath(x.path, x.m, ba, bb), sub, x.m, _chunkEGZM52EOcjs.IDENTITY_MATRIX));
689
689
  opacities.push([x.opacity, x.opacity]);
690
690
  } else if (y) {
691
- parts.push(preparePathMorph(collapsedPath(y.path, y.m, bb, ba), y.path, sub, _chunkJCXMJUQOcjs.IDENTITY_MATRIX, y.m));
691
+ parts.push(preparePathMorph(collapsedPath(y.path, y.m, bb, ba), y.path, sub, _chunkEGZM52EOcjs.IDENTITY_MATRIX, y.m));
692
692
  opacities.push([y.opacity, y.opacity]);
693
693
  }
694
694
  }
@@ -8,7 +8,7 @@ import {
8
8
  isCartesianChart,
9
9
  normalizeChartSpec,
10
10
  parseChartColor
11
- } from "./chunk-3NEZJCBY.js";
11
+ } from "./chunk-FR432ROA.js";
12
12
 
13
13
  // src/chart/ooxml.ts
14
14
  var CHART_OOXML_NS = "http://schemas.openxmlformats.org/drawingml/2006/chart";
@@ -475,6 +475,12 @@ function chartToOoxml(spec) {
475
475
  } else if (family === "sunburst") {
476
476
  issues.push(`Sunburst charts are written as doughnut charts of the ${spec.tree.length ? "top-level group totals" : "values"}: DrawingML has no sunburst type (Office 2016 stores it as chartex).`);
477
477
  type = "donut";
478
+ } else if (family === "barrace") {
479
+ issues.push("Bar chart races are written as clustered bar charts of every name at every time point: DrawingML has no animation.");
480
+ type = "bar";
481
+ } else if (family === "sankey") {
482
+ issues.push("Sankey diagrams are written as bar charts of how much passes through each node: DrawingML has no flows.");
483
+ type = "bar";
478
484
  } else if (family === "parliament") {
479
485
  issues.push("Parliament charts are written as doughnut charts of the seats: DrawingML has no parliament type.");
480
486
  type = "donut";