@pixerate/editor 0.50.0 → 0.52.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 (45) hide show
  1. package/dist/chart/index.cjs +509 -56
  2. package/dist/chart/index.cjs.map +1 -1
  3. package/dist/chart/index.d.cts +194 -7
  4. package/dist/chart/index.d.ts +194 -7
  5. package/dist/chart/index.js +461 -8
  6. package/dist/chart/index.js.map +1 -1
  7. package/dist/{chunk-2Q46FKZK.cjs → chunk-2DEBI6KU.cjs} +23 -23
  8. package/dist/{chunk-2Q46FKZK.cjs.map → chunk-2DEBI6KU.cjs.map} +1 -1
  9. package/dist/{chunk-3JNRQVTS.cjs → chunk-3ZBAXET6.cjs} +323 -3
  10. package/dist/chunk-3ZBAXET6.cjs.map +1 -0
  11. package/dist/{chunk-T6XU4B54.js → chunk-5N6AQCVB.js} +6 -6
  12. package/dist/{chunk-MR2764X2.js → chunk-AGGUNWT6.js} +2 -322
  13. package/dist/chunk-AGGUNWT6.js.map +1 -0
  14. package/dist/{chunk-LNKZPIQD.cjs → chunk-M5Z77GFH.cjs} +21 -21
  15. package/dist/{chunk-LNKZPIQD.cjs.map → chunk-M5Z77GFH.cjs.map} +1 -1
  16. package/dist/{chunk-3CC7OPUQ.cjs → chunk-O6FO6VI3.cjs} +3 -323
  17. package/dist/chunk-O6FO6VI3.cjs.map +1 -0
  18. package/dist/{chunk-GJBIVWB2.js → chunk-UAW5FEMD.js} +322 -2
  19. package/dist/chunk-UAW5FEMD.js.map +1 -0
  20. package/dist/{chunk-DQPBQXKG.js → chunk-YMKPMXZ4.js} +6 -6
  21. package/dist/{controller-DtbEo3om.d.ts → controller-BdKzaxs2.d.ts} +1 -1
  22. package/dist/{controller-ChjCCMLl.d.cts → controller-DS3drIvy.d.cts} +1 -1
  23. package/dist/export/index.cjs +4 -4
  24. package/dist/export/index.js +3 -3
  25. package/dist/extensions/index.cjs +4 -4
  26. package/dist/extensions/index.d.cts +2 -2
  27. package/dist/extensions/index.d.ts +2 -2
  28. package/dist/extensions/index.js +3 -3
  29. package/dist/{index-DoHqT1mq.d.cts → index-DOy9HzfC.d.cts} +1 -1
  30. package/dist/{index-YLZ0fKqE.d.ts → index-Dt9lzydb.d.ts} +1 -1
  31. package/dist/index.cjs +12 -11
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.d.cts +6 -113
  34. package/dist/index.d.ts +6 -113
  35. package/dist/index.js +10 -9
  36. package/dist/index.js.map +1 -1
  37. package/dist/zip-4nG0YAH7.d.cts +110 -0
  38. package/dist/zip-4nG0YAH7.d.ts +110 -0
  39. package/package.json +1 -1
  40. package/dist/chunk-3CC7OPUQ.cjs.map +0 -1
  41. package/dist/chunk-3JNRQVTS.cjs.map +0 -1
  42. package/dist/chunk-GJBIVWB2.js.map +0 -1
  43. package/dist/chunk-MR2764X2.js.map +0 -1
  44. /package/dist/{chunk-T6XU4B54.js.map → chunk-5N6AQCVB.js.map} +0 -0
  45. /package/dist/{chunk-DQPBQXKG.js.map → chunk-YMKPMXZ4.js.map} +0 -0
@@ -15,7 +15,8 @@ var _chunkTGBCBQFVcjs = require('../chunk-TGBCBQFV.cjs');
15
15
 
16
16
 
17
17
 
18
- var _chunk3JNRQVTScjs = require('../chunk-3JNRQVTS.cjs');
18
+
19
+ var _chunk3ZBAXET6cjs = require('../chunk-3ZBAXET6.cjs');
19
20
 
20
21
 
21
22
 
@@ -128,6 +129,127 @@ require('../chunk-XP5IUZUO.cjs');
128
129
  var _chunkTNNJXF46cjs = require('../chunk-TNNJXF46.cjs');
129
130
  require('../chunk-QKLRAA4T.cjs');
130
131
 
132
+ // src/chart/raster.ts
133
+ var CHART_RASTER_MAX_SIZE = 1024;
134
+ function chartRasterSize(width, height, scale = 2, maxSize = CHART_RASTER_MAX_SIZE) {
135
+ if (!(width > 0) || !(height > 0)) throw new Error(`A chart image needs a positive width and height; got ${width} \xD7 ${height}.`);
136
+ const factor = Math.min(scale > 0 ? scale : 1, maxSize / Math.max(width, height));
137
+ return { width: Math.max(1, Math.round(width * factor)), height: Math.max(1, Math.round(height * factor)), scale: factor };
138
+ }
139
+ function closingParen(text, open2) {
140
+ let depth = 0;
141
+ for (let i = open2; i < text.length; i++) {
142
+ if (text[i] === "(") depth++;
143
+ else if (text[i] === ")" && --depth === 0) return i + 1;
144
+ }
145
+ return -1;
146
+ }
147
+ function substituteVars(value, lookup, depth = 0) {
148
+ let out = "";
149
+ let i = 0;
150
+ for (let at = value.indexOf("var(", i); at !== -1; at = value.indexOf("var(", i)) {
151
+ const end = closingParen(value, at + 3);
152
+ if (end === -1) break;
153
+ const inner = value.slice(at + 4, end - 1);
154
+ let comma = -1;
155
+ for (let j = 0, d = 0; j < inner.length; j++) {
156
+ if (inner[j] === "(") d++;
157
+ else if (inner[j] === ")") d--;
158
+ else if (inner[j] === "," && d === 0) {
159
+ comma = j;
160
+ break;
161
+ }
162
+ }
163
+ const name = (comma === -1 ? inner : inner.slice(0, comma)).trim();
164
+ const fallback = comma === -1 ? "" : inner.slice(comma + 1).trim();
165
+ const found = lookup(name).trim();
166
+ const resolved = found || fallback;
167
+ out += value.slice(i, at) + (depth < 8 && resolved.includes("var(") ? substituteVars(resolved, lookup, depth + 1) : resolved);
168
+ i = end;
169
+ }
170
+ return out + value.slice(i);
171
+ }
172
+ var PAINT_ATTRIBUTE = /(\s)([\w:-]+)="([^"]*)"/g;
173
+ function resolveChartSvgPaints(svg, options = {}) {
174
+ const doc = globalThis.document;
175
+ const scope = _nullishCoalesce(_nullishCoalesce(options.scope, () => ( _optionalChain([doc, 'optionalAccess', _2 => _2.documentElement]))), () => ( null));
176
+ const view = _nullishCoalesce(_optionalChain([scope, 'optionalAccess', _3 => _3.ownerDocument, 'optionalAccess', _4 => _4.defaultView]), () => ( globalThis));
177
+ let computed;
178
+ const style = () => {
179
+ if (computed === void 0) computed = scope && typeof _optionalChain([view, 'optionalAccess', _5 => _5.getComputedStyle]) === "function" ? view.getComputedStyle(scope) : null;
180
+ return computed;
181
+ };
182
+ const lookup = _nullishCoalesce(options.lookup, () => ( ((name) => _nullishCoalesce(_optionalChain([style, 'call', _6 => _6(), 'optionalAccess', _7 => _7.getPropertyValue, 'call', _8 => _8(name)]), () => ( "")))));
183
+ return svg.replace(PAINT_ATTRIBUTE, (match, space, name, raw) => {
184
+ let value = raw;
185
+ if (value.includes("var(")) value = substituteVars(value.replace(/&quot;/g, '"'), lookup).replace(/"/g, "&quot;");
186
+ if (/currentcolor/i.test(value)) value = value.replace(/currentcolor/gi, _optionalChain([style, 'call', _9 => _9(), 'optionalAccess', _10 => _10.color]) || "#000000");
187
+ if (name === "font-family" && /^(inherit|unset|initial)$/i.test(value.trim())) value = (_optionalChain([style, 'call', _11 => _11(), 'optionalAccess', _12 => _12.fontFamily]) || "sans-serif").replace(/"/g, "'");
188
+ if (value === raw) return match;
189
+ return value.trim() ? `${space}${name}="${value}"` : "";
190
+ });
191
+ }
192
+ var NO_DOM = 'Rasterizing a chart needs a browser DOM (document, Image and a 2D canvas). Outside a browser, render SVG with chartToSvg (or render_chart with format "svg") and convert it with an SVG renderer, or pass your own rasterize option to createChartToolProvider.';
193
+ async function svgToPngDataUrl(svg, options) {
194
+ const doc = _nullishCoalesce(options.document, () => ( globalThis.document));
195
+ const ImageCtor = _nullishCoalesce(_optionalChain([doc, 'optionalAccess', _13 => _13.defaultView, 'optionalAccess', _14 => _14.Image]), () => ( globalThis.Image));
196
+ if (!doc || typeof doc.createElement !== "function" || !ImageCtor) throw new Error(NO_DOM);
197
+ const size = chartRasterSize(options.width, options.height, options.scale, options.maxSize);
198
+ const canvas = doc.createElement("canvas");
199
+ canvas.width = size.width;
200
+ canvas.height = size.height;
201
+ let context = null;
202
+ try {
203
+ context = canvas.getContext("2d");
204
+ } catch (e2) {
205
+ context = null;
206
+ }
207
+ if (!context) throw new Error(NO_DOM);
208
+ const drawable = resolveChartSvgPaints(svg, options);
209
+ const image = new ImageCtor();
210
+ await new Promise((resolve2, reject) => {
211
+ image.onload = () => resolve2();
212
+ image.onerror = () => reject(new Error("The chart SVG could not be loaded as an image; check that it is a complete <svg> document with the SVG namespace."));
213
+ image.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(drawable)}`;
214
+ });
215
+ const background = _nullishCoalesce(options.background, () => ( "#ffffff"));
216
+ if (background !== "transparent") {
217
+ context.fillStyle = background;
218
+ context.fillRect(0, 0, size.width, size.height);
219
+ }
220
+ context.drawImage(image, 0, 0, size.width, size.height);
221
+ const url = canvas.toDataURL("image/png");
222
+ if (!url.startsWith("data:image/png")) throw new Error("This canvas cannot export PNG (toDataURL returned no image).");
223
+ return { url, width: size.width, height: size.height };
224
+ }
225
+ async function rasterizeChartSvg(svg, options) {
226
+ const { url, width, height } = await svgToPngDataUrl(svg, options);
227
+ return { data: url.slice(url.indexOf(",") + 1), mimeType: "image/png", width, height };
228
+ }
229
+ function createChartRasterizer(options = {}) {
230
+ const doc = _nullishCoalesce(options.document, () => ( globalThis.document));
231
+ if (!doc || typeof doc.createElement !== "function") return void 0;
232
+ return (svg, size) => rasterizeChartSvg(svg, { ...options, ...size });
233
+ }
234
+ function chartFileName(spec, extension) {
235
+ const base = (_nullishCoalesce(spec.title, () => ( ""))).toLowerCase().replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "").slice(0, 60);
236
+ return `${base || "chart"}.${extension}`;
237
+ }
238
+ async function downloadChartPng(spec, options = {}) {
239
+ const { width = 800, height = 450, filename = chartFileName(spec, "png"), theme, ...raster } = options;
240
+ const svg = _chunkGTZXF4BIcjs.chartToSvg.call(void 0, spec, { width, height, theme });
241
+ const { url, width: w, height: h } = await svgToPngDataUrl(svg, { ...raster, width, height });
242
+ const doc = _nullishCoalesce(raster.document, () => ( globalThis.document));
243
+ const link = doc.createElement("a");
244
+ link.href = url;
245
+ link.download = filename;
246
+ link.style.display = "none";
247
+ _optionalChain([doc, 'access', _15 => _15.body, 'optionalAccess', _16 => _16.appendChild, 'call', _17 => _17(link)]);
248
+ link.click();
249
+ link.remove();
250
+ return { data: url.slice(url.indexOf(",") + 1), mimeType: "image/png", width: w, height: h, filename };
251
+ }
252
+
131
253
  // src/chart/recommend.ts
132
254
  var blank = (c) => c === null || c === void 0 || String(c).trim() === "";
133
255
  var isText = (c) => blank(c) || _chunkJOX6MJW4cjs.parseChartValue.call(void 0, c) === void 0;
@@ -135,7 +257,7 @@ function analyzeChartTable(rows) {
135
257
  const grid = rows.filter((r) => r.some((c) => !blank(c)));
136
258
  const height = grid.length;
137
259
  const width = Math.max(0, ...grid.map((r) => r.length));
138
- const cell = (r, c) => _optionalChain([grid, 'access', _2 => _2[r], 'optionalAccess', _3 => _3[c]]);
260
+ const cell = (r, c) => _optionalChain([grid, 'access', _18 => _18[r], 'optionalAccess', _19 => _19[c]]);
139
261
  const headerRow = height > 1 && grid[0].some((c) => !blank(c) && isText(c)) && Array.from({ length: width - 1 }, (_, i) => i + 1).every((c) => isText(cell(0, c)));
140
262
  const blankCorner = headerRow && blank(cell(0, 0));
141
263
  const labelColumn = width > 1 && (blankCorner || Array.from({ length: height - (headerRow ? 1 : 0) }, (_, i) => i + (headerRow ? 1 : 0)).every((r) => isText(cell(r, 0))));
@@ -156,7 +278,7 @@ function analyzeChartTable(rows) {
156
278
  anyNegative = true;
157
279
  } else if (v > 0) anyPositive = true;
158
280
  }
159
- const labels = byRows ? _nullishCoalesce(_optionalChain([grid, 'access', _4 => _4[0], 'optionalAccess', _5 => _5.slice, 'call', _6 => _6(labelColumn ? 1 : 0)]), () => ( [])) : grid.slice(headerRow ? 1 : 0).map((r) => r[0]);
281
+ const labels = byRows ? _nullishCoalesce(_optionalChain([grid, 'access', _20 => _20[0], 'optionalAccess', _21 => _21.slice, 'call', _22 => _22(labelColumn ? 1 : 0)]), () => ( [])) : grid.slice(headerRow ? 1 : 0).map((r) => r[0]);
160
282
  const dates = (byRows ? headerRow : labelColumn) && labels.length > 1 && labels.filter((l) => !blank(l) && _chunkGTZXF4BIcjs.parseChartDate.call(void 0, String(l)) !== null).length >= labels.length * 0.8;
161
283
  return {
162
284
  headerRow,
@@ -233,8 +355,8 @@ function recommendForShape(shape) {
233
355
  function chartFromTable(rows, options = {}) {
234
356
  const shape = analyzeChartTable(rows);
235
357
  const rec = (_nullishCoalesce(options.type, () => ( "auto"))) === "auto" ? recommendForShape(shape)[0] : void 0;
236
- const type = _nullishCoalesce(_optionalChain([rec, 'optionalAccess', _7 => _7.type]), () => ( (options.type === "auto" || !options.type ? "bar" : options.type)));
237
- const stacking = _nullishCoalesce(_optionalChain([rec, 'optionalAccess', _8 => _8.stacking]), () => ( "none"));
358
+ const type = _nullishCoalesce(_optionalChain([rec, 'optionalAccess', _23 => _23.type]), () => ( (options.type === "auto" || !options.type ? "bar" : options.type)));
359
+ const stacking = _nullishCoalesce(_optionalChain([rec, 'optionalAccess', _24 => _24.stacking]), () => ( "none"));
238
360
  const grid = rows.filter((r) => r.some((c) => !blank(c))).map((r) => [...r]);
239
361
  const width = Math.max(0, ...grid.map((r) => r.length));
240
362
  let table = grid;
@@ -283,7 +405,7 @@ function createChartCommands(controller, options = {}) {
283
405
  params: object({ width: _chunkTGBCBQFVcjs.WIDTH, height: _chunkTGBCBQFVcjs.HEIGHT }),
284
406
  run: (_ctx, params = {}) => {
285
407
  const spec = controller.getSpec();
286
- return { spec: controller.toJSON(), table: _chunkJOX6MJW4cjs.chartDataToTable.call(void 0, spec), summary: _chunkGTZXF4BIcjs.summarizeChart.call(void 0, controller.toJSON(), { width: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _9 => _9.width]), () => ( 640)), height: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _10 => _10.height]), () => ( 400)) }), issues: controller.getState().issues };
408
+ return { spec: controller.toJSON(), table: _chunkJOX6MJW4cjs.chartDataToTable.call(void 0, spec), summary: _chunkGTZXF4BIcjs.summarizeChart.call(void 0, controller.toJSON(), { width: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _25 => _25.width]), () => ( 640)), height: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _26 => _26.height]), () => ( 400)) }), issues: controller.getState().issues };
287
409
  }
288
410
  },
289
411
  {
@@ -373,7 +495,7 @@ function createChartCommands(controller, options = {}) {
373
495
  keywords: ["chart", "category", "row", "label"],
374
496
  description: "Inserts a category (gaps in every series) at `at` (default: the end).",
375
497
  params: object({ label: { type: "string", description: "Category label (default: its number)." }, at: { type: "integer", minimum: 0, description: "Index to insert at (default: the end)." } }),
376
- run: (_ctx, params = {}) => controller.addCategory(_optionalChain([params, 'optionalAccess', _11 => _11.label]), { at: _optionalChain([params, 'optionalAccess', _12 => _12.at]) })
498
+ run: (_ctx, params = {}) => controller.addCategory(_optionalChain([params, 'optionalAccess', _27 => _27.label]), { at: _optionalChain([params, 'optionalAccess', _28 => _28.at]) })
377
499
  },
378
500
  {
379
501
  ...base,
@@ -411,7 +533,7 @@ function createChartCommands(controller, options = {}) {
411
533
  params: object({ series: _chunkTGBCBQFVcjs.SERIES_REF, index: { type: "integer", minimum: 0, description: "Trendline index (0 = first)." } }, ["series", "index"]),
412
534
  run: (_ctx, params) => {
413
535
  check(controller.removeTrendline(resolveSeries(params.series).id, params.index));
414
- return { trendlines: _nullishCoalesce(_optionalChain([controller, 'access', _13 => _13.getSeries, 'call', _14 => _14(resolveSeries(params.series).id), 'optionalAccess', _15 => _15.trendlines]), () => ( [])) };
536
+ return { trendlines: _nullishCoalesce(_optionalChain([controller, 'access', _29 => _29.getSeries, 'call', _30 => _30(resolveSeries(params.series).id), 'optionalAccess', _31 => _31.trendlines]), () => ( [])) };
415
537
  }
416
538
  },
417
539
  {
@@ -482,7 +604,7 @@ function createChartCommands(controller, options = {}) {
482
604
  keywords: ["chart", "mermaid", "markdown", "export"],
483
605
  description: "Returns the chart as Mermaid text (with a round-trip comment unless meta is false).",
484
606
  params: object({ meta: { type: "boolean", description: "Include the %% @pixerate round-trip comment (default true)." } }),
485
- run: (_ctx, params = {}) => ({ mermaid: _chunkGTZXF4BIcjs.chartToMermaid.call(void 0, controller.toJSON(), { meta: _optionalChain([params, 'optionalAccess', _16 => _16.meta]) }) })
607
+ run: (_ctx, params = {}) => ({ mermaid: _chunkGTZXF4BIcjs.chartToMermaid.call(void 0, controller.toJSON(), { meta: _optionalChain([params, 'optionalAccess', _32 => _32.meta]) }) })
486
608
  },
487
609
  {
488
610
  ...base,
@@ -491,7 +613,7 @@ function createChartCommands(controller, options = {}) {
491
613
  readOnly: true,
492
614
  keywords: ["chart", "office", "word", "powerpoint", "docx", "pptx", "xml", "export"],
493
615
  description: "Returns the chart as a DrawingML chart part (c:chartSpace) and what could not be written.",
494
- run: () => _chunk3JNRQVTScjs.chartToOoxml.call(void 0, controller.toJSON())
616
+ run: () => _chunk3ZBAXET6cjs.chartToOoxml.call(void 0, controller.toJSON())
495
617
  },
496
618
  {
497
619
  ...base,
@@ -502,7 +624,7 @@ function createChartCommands(controller, options = {}) {
502
624
  description: "Returns the chart drawn as a standalone, accessible SVG string (with <title> and <desc>).",
503
625
  params: object({ width: _chunkTGBCBQFVcjs.WIDTH, height: _chunkTGBCBQFVcjs.HEIGHT }),
504
626
  run: (_ctx, params = {}) => ({
505
- svg: _chunkGTZXF4BIcjs.chartToSvg.call(void 0, controller.toJSON(), { width: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _17 => _17.width]), () => ( 640)), height: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _18 => _18.height]), () => ( 400)) })
627
+ svg: _chunkGTZXF4BIcjs.chartToSvg.call(void 0, controller.toJSON(), { width: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _33 => _33.width]), () => ( 640)), height: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _34 => _34.height]), () => ( 400)) })
506
628
  })
507
629
  },
508
630
  {
@@ -514,7 +636,7 @@ function createChartCommands(controller, options = {}) {
514
636
  description: "Suggests chart types for the current data (or CSV), best first, each with a reason.",
515
637
  params: object({ csv: { type: "string", description: "CSV text to analyse instead of the current data." } }),
516
638
  run: (_ctx, params = {}) => ({
517
- recommendations: recommendChartTypes(_optionalChain([params, 'optionalAccess', _19 => _19.csv]) !== void 0 ? _chunkTNNJXF46cjs.parseCsv.call(void 0, params.csv) : _chunkJOX6MJW4cjs.chartDataToTable.call(void 0, controller.getSpec()))
639
+ recommendations: recommendChartTypes(_optionalChain([params, 'optionalAccess', _35 => _35.csv]) !== void 0 ? _chunkTNNJXF46cjs.parseCsv.call(void 0, params.csv) : _chunkJOX6MJW4cjs.chartDataToTable.call(void 0, controller.getSpec()))
518
640
  })
519
641
  },
520
642
  {
@@ -527,7 +649,7 @@ function createChartCommands(controller, options = {}) {
527
649
  run: () => {
528
650
  const s = controller.getSpec();
529
651
  const visible = s.series.filter((x) => !x.hidden);
530
- const colors = _chunkJOX6MJW4cjs.chartColorsByCategory.call(void 0, s.type) ? s.categories.map((_, i) => _optionalChain([visible, 'access', _20 => _20[0], 'optionalAccess', _21 => _21.pointColors, 'optionalAccess', _22 => _22[i]]) || _chunkJOX6MJW4cjs.chartSliceColor.call(void 0, s, i)) : visible.map((x) => _chunkJOX6MJW4cjs.chartSeriesColor.call(void 0, s, s.series.indexOf(x)));
652
+ const colors = _chunkJOX6MJW4cjs.chartColorsByCategory.call(void 0, s.type) ? s.categories.map((_, i) => _optionalChain([visible, 'access', _36 => _36[0], 'optionalAccess', _37 => _37.pointColors, 'optionalAccess', _38 => _38[i]]) || _chunkJOX6MJW4cjs.chartSliceColor.call(void 0, s, i)) : visible.map((x) => _chunkJOX6MJW4cjs.chartSeriesColor.call(void 0, s, s.series.indexOf(x)));
531
653
  return { colors, ..._chunkJOX6MJW4cjs.checkChartColors.call(void 0, colors) };
532
654
  }
533
655
  },
@@ -557,7 +679,7 @@ function chartClientToScene(scene, box, clientX, clientY) {
557
679
  return { x: (clientX - box.left) * sx, y: (clientY - box.top) * sy };
558
680
  }
559
681
  function canDragChartPoint(controller, scene, target) {
560
- if (_optionalChain([target, 'optionalAccess', _23 => _23.kind]) !== "point" || !scene.valueScale || scene.percent) return false;
682
+ if (_optionalChain([target, 'optionalAccess', _39 => _39.kind]) !== "point" || !scene.valueScale || scene.percent) return false;
561
683
  const spec = controller.getSpec();
562
684
  const family = _chunkJOX6MJW4cjs.chartFamily.call(void 0, spec);
563
685
  if (family !== "cartesian" && family !== "xy" && family !== "waterfall") return false;
@@ -582,7 +704,7 @@ function snapChartDragValue(scene, value, options = {}) {
582
704
  }
583
705
  if (best !== null) return best;
584
706
  }
585
- return _chunkGTZXF4BIcjs.snapChartValue.call(void 0, scene, value, options.step, _optionalChain([scale, 'optionalAccess', _24 => _24.ticks]));
707
+ return _chunkGTZXF4BIcjs.snapChartValue.call(void 0, scene, value, options.step, _optionalChain([scale, 'optionalAccess', _40 => _40.ticks]));
586
708
  }
587
709
  function startChartPointDrag(controller, scene, target, start, options = {}) {
588
710
  if (!canDragChartPoint(controller, scene, target)) return null;
@@ -593,7 +715,7 @@ function startChartPointDrag(controller, scene, target, start, options = {}) {
593
715
  const scale = secondary ? scene.valueScale2 : scene.valueScale;
594
716
  const xy = _chunkJOX6MJW4cjs.chartFamily.call(void 0, spec) === "xy" && !!scene.xScale;
595
717
  const startValue = _nullishCoalesce(series.values[index], () => ( 0));
596
- const startX = _nullishCoalesce(_optionalChain([series, 'access', _25 => _25.x, 'optionalAccess', _26 => _26[index]]), () => ( null));
718
+ const startX = _nullishCoalesce(_optionalChain([series, 'access', _41 => _41.x, 'optionalAccess', _42 => _42[index]]), () => ( null));
597
719
  const startAt = _chunkGTZXF4BIcjs.chartValueAtPoint.call(void 0, scene, start, secondary);
598
720
  const startAtX = xy ? _chunkGTZXF4BIcjs.chartXAtPoint.call(void 0, scene, start) : void 0;
599
721
  if (startAt === void 0) return null;
@@ -640,7 +762,7 @@ function startChartPointDrag(controller, scene, target, start, options = {}) {
640
762
  const xs = [..._nullishCoalesce(series.x, () => ( []))];
641
763
  xs[index] = x;
642
764
  controller.setValue(seriesId, index, y, { label });
643
- if (x !== _optionalChain([controller, 'access', _27 => _27.getSeries, 'call', _28 => _28(seriesId), 'optionalAccess', _29 => _29.x, 'optionalAccess', _30 => _30[index]])) controller.updateSeries(seriesId, { x: xs });
765
+ if (x !== _optionalChain([controller, 'access', _43 => _43.getSeries, 'call', _44 => _44(seriesId), 'optionalAccess', _45 => _45.x, 'optionalAccess', _46 => _46[index]])) controller.updateSeries(seriesId, { x: xs });
644
766
  } else controller.setValue(seriesId, index, y, { label });
645
767
  },
646
768
  end() {
@@ -674,7 +796,7 @@ function handleChartKey(controller, scene, event) {
674
796
  return true;
675
797
  case "ArrowLeft":
676
798
  case "ArrowRight": {
677
- if (event.altKey || _optionalChain([selection, 'optionalAccess', _31 => _31.kind]) !== "point" && _optionalChain([selection, 'optionalAccess', _32 => _32.kind]) !== "category") return false;
799
+ if (event.altKey || _optionalChain([selection, 'optionalAccess', _47 => _47.kind]) !== "point" && _optionalChain([selection, 'optionalAccess', _48 => _48.kind]) !== "category") return false;
678
800
  const n = spec.categories.length;
679
801
  const index = Math.max(0, Math.min(n - 1, selection.index + (event.key === "ArrowRight" ? 1 : -1)));
680
802
  controller.select({ ...selection, index });
@@ -682,9 +804,9 @@ function handleChartKey(controller, scene, event) {
682
804
  }
683
805
  case "ArrowUp":
684
806
  case "ArrowDown": {
685
- if (_optionalChain([selection, 'optionalAccess', _33 => _33.kind]) !== "point" || _optionalChain([scene, 'optionalAccess', _34 => _34.percent])) return false;
686
- const secondary = _optionalChain([controller, 'access', _35 => _35.getSeries, 'call', _36 => _36(selection.seriesId), 'optionalAccess', _37 => _37.axis]) === "secondary";
687
- const ticks = _nullishCoalesce(_nullishCoalesce(_optionalChain([(secondary ? _optionalChain([scene, 'optionalAccess', _38 => _38.valueScale2]) : null), 'optionalAccess', _39 => _39.ticks]), () => ( _optionalChain([scene, 'optionalAccess', _40 => _40.valueScale, 'optionalAccess', _41 => _41.ticks]))), () => ( []));
807
+ if (_optionalChain([selection, 'optionalAccess', _49 => _49.kind]) !== "point" || _optionalChain([scene, 'optionalAccess', _50 => _50.percent])) return false;
808
+ const secondary = _optionalChain([controller, 'access', _51 => _51.getSeries, 'call', _52 => _52(selection.seriesId), 'optionalAccess', _53 => _53.axis]) === "secondary";
809
+ const ticks = _nullishCoalesce(_nullishCoalesce(_optionalChain([(secondary ? _optionalChain([scene, 'optionalAccess', _54 => _54.valueScale2]) : null), 'optionalAccess', _55 => _55.ticks]), () => ( _optionalChain([scene, 'optionalAccess', _56 => _56.valueScale, 'optionalAccess', _57 => _57.ticks]))), () => ( []));
688
810
  const step = ticks.length > 1 ? ticks[1] - ticks[0] : 1;
689
811
  const amount = event.shiftKey ? step : event.altKey ? step / 100 : step / 10;
690
812
  controller.nudgeValue(selection.seriesId, selection.index, amount * (event.key === "ArrowUp" ? 1 : -1));
@@ -709,20 +831,20 @@ function describeChartSelection(controller, selection = controller.getState().se
709
831
  case "axis":
710
832
  return selection.axis === "x" ? _chunkJOX6MJW4cjs.chartFamily.call(void 0, spec) === "xy" ? "X axis" : "Category axis" : selection.axis === "y" ? "Value axis" : "Secondary value axis";
711
833
  case "series":
712
- return `Series "${_nullishCoalesce(_optionalChain([controller, 'access', _42 => _42.getSeries, 'call', _43 => _43(selection.seriesId), 'optionalAccess', _44 => _44.name]), () => ( selection.seriesId))}"`;
834
+ return `Series "${_nullishCoalesce(_optionalChain([controller, 'access', _58 => _58.getSeries, 'call', _59 => _59(selection.seriesId), 'optionalAccess', _60 => _60.name]), () => ( selection.seriesId))}"`;
713
835
  case "category":
714
836
  return `Category "${_nullishCoalesce(spec.categories[selection.index], () => ( selection.index))}"`;
715
837
  case "trendline": {
716
838
  const series = controller.getSeries(selection.seriesId);
717
- const line = _optionalChain([series, 'optionalAccess', _45 => _45.trendlines, 'optionalAccess', _46 => _46[selection.index]]);
718
- return `${line ? line.type.replace("-", " ") : "Trendline"} trendline on "${_nullishCoalesce(_optionalChain([series, 'optionalAccess', _47 => _47.name]), () => ( selection.seriesId))}"`;
839
+ const line = _optionalChain([series, 'optionalAccess', _61 => _61.trendlines, 'optionalAccess', _62 => _62[selection.index]]);
840
+ return `${line ? line.type.replace("-", " ") : "Trendline"} trendline on "${_nullishCoalesce(_optionalChain([series, 'optionalAccess', _63 => _63.name]), () => ( selection.seriesId))}"`;
719
841
  }
720
842
  case "point": {
721
843
  const series = controller.getSeries(selection.seriesId);
722
- const value = _optionalChain([series, 'optionalAccess', _48 => _48.values, 'access', _49 => _49[selection.index]]);
723
- const x = _optionalChain([series, 'optionalAccess', _50 => _50.x, 'optionalAccess', _51 => _51[selection.index]]);
724
- if (x !== void 0 && x !== null && _chunkJOX6MJW4cjs.chartFamily.call(void 0, spec) === "xy") return `${_nullishCoalesce(_optionalChain([series, 'optionalAccess', _52 => _52.name]), () => ( selection.seriesId))}: (${x}, ${_nullishCoalesce(value, () => ( "blank"))})`;
725
- return `${_nullishCoalesce(_optionalChain([series, 'optionalAccess', _53 => _53.name]), () => ( selection.seriesId))} \xB7 ${_nullishCoalesce(spec.categories[selection.index], () => ( selection.index))}: ${_nullishCoalesce(value, () => ( "blank"))}`;
844
+ const value = _optionalChain([series, 'optionalAccess', _64 => _64.values, 'access', _65 => _65[selection.index]]);
845
+ const x = _optionalChain([series, 'optionalAccess', _66 => _66.x, 'optionalAccess', _67 => _67[selection.index]]);
846
+ if (x !== void 0 && x !== null && _chunkJOX6MJW4cjs.chartFamily.call(void 0, spec) === "xy") return `${_nullishCoalesce(_optionalChain([series, 'optionalAccess', _68 => _68.name]), () => ( selection.seriesId))}: (${x}, ${_nullishCoalesce(value, () => ( "blank"))})`;
847
+ return `${_nullishCoalesce(_optionalChain([series, 'optionalAccess', _69 => _69.name]), () => ( selection.seriesId))} \xB7 ${_nullishCoalesce(spec.categories[selection.index], () => ( selection.index))}: ${_nullishCoalesce(value, () => ( "blank"))}`;
726
848
  }
727
849
  }
728
850
  }
@@ -763,6 +885,7 @@ function chartHitTest(scene, point, measure = (t, s, w = 400) => t.length * s *
763
885
  }
764
886
 
765
887
  // src/chart/tools.ts
888
+ var RENDER_CHART_INSTRUCTIONS = 'Draws the chart without changing it so you can check how it looks: SVG text by default, or a PNG image with format "png" when the host can rasterize. Returns the layout warnings (hidden or thinned labels, dropped markers) alongside. An image costs tokens, so render after a batch of edits rather than after each one, and use it to check what text cannot tell you: overlapping or cut-off labels, a crowded legend, unreadable colours, whether the chart reads at the given size. For values, ids and warnings alone, get_chart is cheaper.';
766
889
  var READ = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
767
890
  var WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
768
891
  var WRITE_IDEMPOTENT = { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false };
@@ -817,21 +940,36 @@ function createChartToolProvider(controller, options = {}) {
817
940
  const renderChart = {
818
941
  name: "render_chart",
819
942
  title: "Render the chart",
820
- description: 'Draws the chart without changing it, to check it visually: SVG text by default, or a PNG image (format "png") when the host can rasterize. Look for overlapping or hidden labels; get_chart lists layout warnings without a render.',
943
+ description: RENDER_CHART_INSTRUCTIONS,
821
944
  inputSchema: {
822
945
  type: "object",
823
- properties: { width: _chunkTGBCBQFVcjs.WIDTH, height: _chunkTGBCBQFVcjs.HEIGHT, format: { type: "string", enum: ["svg", "png"], description: "svg (default) or png (only when the host supports it)." } },
946
+ properties: {
947
+ width: _chunkTGBCBQFVcjs.WIDTH,
948
+ height: _chunkTGBCBQFVcjs.HEIGHT,
949
+ format: { type: "string", enum: ["svg", "png"], description: "svg (default): the SVG document as text. png: an image to look at (only when the host can rasterize; costs image tokens)." }
950
+ },
824
951
  additionalProperties: false
825
952
  },
826
953
  annotations: { title: "Render the chart", ...READ },
827
954
  handler: async ({ width = size.width, height = size.height, format = "svg" }) => {
828
- const svg = _chunkGTZXF4BIcjs.chartToSvg.call(void 0, controller.toJSON(), { width, height });
955
+ const json = controller.toJSON();
956
+ const scene = _chunkGTZXF4BIcjs.layoutChart.call(void 0, json, { width, height, selection: null });
957
+ const svg = _chunkGTZXF4BIcjs.chartSceneToSvg.call(void 0, scene, { ariaLabel: json.title || void 0, description: _chunkGTZXF4BIcjs.describeChart.call(void 0, json) });
958
+ const warnings = scene.warnings;
829
959
  if (format === "png") {
830
- if (!options.rasterize) fail2('This host cannot rasterize charts; call render_chart with format "svg".');
960
+ if (!options.rasterize) fail2('This host cannot rasterize charts; call render_chart with format "svg", or get_chart for the layout warnings.');
831
961
  const image = await options.rasterize(svg, { width, height });
832
- return { content: [{ type: "image", data: image.data, mimeType: image.mimeType }], structuredContent: { width, height, mimeType: image.mimeType } };
962
+ const info = { width, height, mimeType: image.mimeType, warnings };
963
+ const note = warnings.length ? `Layout warnings: ${warnings.map((w) => w.message).join(" ")}` : "No layout warnings.";
964
+ return {
965
+ content: [
966
+ { type: "image", data: image.data, mimeType: image.mimeType },
967
+ { type: "text", text: `Chart at ${width} \xD7 ${height}. ${note}` }
968
+ ],
969
+ structuredContent: info
970
+ };
833
971
  }
834
- return { svg, width, height };
972
+ return { svg, width, height, warnings };
835
973
  }
836
974
  };
837
975
  const checkColors = {
@@ -850,7 +988,7 @@ function createChartToolProvider(controller, options = {}) {
850
988
  handler: ({ colors, surface }) => {
851
989
  const s = spec();
852
990
  const visible = s.series.filter((x) => !x.hidden);
853
- const own = _chunkJOX6MJW4cjs.chartColorsByCategory.call(void 0, s.type) ? s.categories.map((_, i) => _optionalChain([visible, 'access', _54 => _54[0], 'optionalAccess', _55 => _55.pointColors, 'optionalAccess', _56 => _56[i]]) || _chunkJOX6MJW4cjs.chartSliceColor.call(void 0, s, i)) : visible.map((x) => _chunkJOX6MJW4cjs.chartSeriesColor.call(void 0, s, s.series.indexOf(x)));
991
+ const own = _chunkJOX6MJW4cjs.chartColorsByCategory.call(void 0, s.type) ? s.categories.map((_, i) => _optionalChain([visible, 'access', _70 => _70[0], 'optionalAccess', _71 => _71.pointColors, 'optionalAccess', _72 => _72[i]]) || _chunkJOX6MJW4cjs.chartSliceColor.call(void 0, s, i)) : visible.map((x) => _chunkJOX6MJW4cjs.chartSeriesColor.call(void 0, s, s.series.indexOf(x)));
854
992
  return { colors: _nullishCoalesce(colors, () => ( own)), ..._chunkJOX6MJW4cjs.checkChartColors.call(void 0, _nullishCoalesce(colors, () => ( own)), { surface }) };
855
993
  }
856
994
  };
@@ -880,8 +1018,8 @@ function createChartToolProvider(controller, options = {}) {
880
1018
  annotations: { title: "Read a trendline fit", ...READ },
881
1019
  handler: ({ series, index }) => {
882
1020
  const s = seriesById(series);
883
- const line = _optionalChain([s, 'access', _57 => _57.trendlines, 'optionalAccess', _58 => _58[index]]);
884
- if (!line) fail2(`"${s.name}" has no trendline ${index}; it has ${_nullishCoalesce(_optionalChain([s, 'access', _59 => _59.trendlines, 'optionalAccess', _60 => _60.length]), () => ( 0))}.`);
1021
+ const line = _optionalChain([s, 'access', _73 => _73.trendlines, 'optionalAccess', _74 => _74[index]]);
1022
+ if (!line) fail2(`"${s.name}" has no trendline ${index}; it has ${_nullishCoalesce(_optionalChain([s, 'access', _75 => _75.trendlines, 'optionalAccess', _76 => _76.length]), () => ( 0))}.`);
885
1023
  if (line.type === "moving-average") return { trendline: line, points: controller.trendlineMovingAverage(s.id, index) };
886
1024
  const fit = controller.trendlineFit(s.id, index);
887
1025
  if (!fit) fail2(`The ${line.type} trendline on "${s.name}" cannot be fitted: it needs more points (and positive values for log, exponential and power fits).`);
@@ -913,7 +1051,7 @@ function createChartToolProvider(controller, options = {}) {
913
1051
  description: "Returns the chart as a DrawingML chart part (c:chartSpace) for Word or PowerPoint files, with what could not be written as sentences.",
914
1052
  inputSchema: { type: "object", properties: {}, additionalProperties: false },
915
1053
  annotations: { title: "Export chart as Office XML", ...READ },
916
- handler: () => _chunk3JNRQVTScjs.chartToOoxml.call(void 0, controller.toJSON())
1054
+ handler: () => _chunk3ZBAXET6cjs.chartToOoxml.call(void 0, controller.toJSON())
917
1055
  };
918
1056
  const updateChart = {
919
1057
  name: "update_chart",
@@ -1107,7 +1245,7 @@ function createChartToolProvider(controller, options = {}) {
1107
1245
  inputSchema: { type: "object", properties: { xml: { type: "string", description: "The chart part XML, e.g. word/charts/chart1.xml." } }, required: ["xml"], additionalProperties: false },
1108
1246
  annotations: { title: "Import an Office chart", ...DESTRUCTIVE },
1109
1247
  handler: ({ xml }) => {
1110
- const read = _chunk3JNRQVTScjs.chartFromOoxml.call(void 0, xml, { DOMParser: Parser() });
1248
+ const read = _chunk3ZBAXET6cjs.chartFromOoxml.call(void 0, xml, { DOMParser: Parser() });
1111
1249
  if (read.issues.some((i) => i.path === "" || i.path === "plotArea")) fail2(read.issues.map((i) => i.message).join(" "));
1112
1250
  resolve(controller.update({ ...read.spec }, { label: "Import Office chart" }));
1113
1251
  return { spec: controller.toJSON(), issues: read.issues.map((i) => i.message), unsupported: read.unsupported, lossless: read.lossless };
@@ -1139,7 +1277,7 @@ function createChartToolProvider(controller, options = {}) {
1139
1277
  handler: ({ series, index }) => {
1140
1278
  const s = seriesById(series);
1141
1279
  resolve(controller.removeTrendline(s.id, index));
1142
- return { series: s.id, trendlines: _nullishCoalesce(_optionalChain([controller, 'access', _61 => _61.getSeries, 'call', _62 => _62(s.id), 'optionalAccess', _63 => _63.trendlines]), () => ( [])) };
1280
+ return { series: s.id, trendlines: _nullishCoalesce(_optionalChain([controller, 'access', _77 => _77.getSeries, 'call', _78 => _78(s.id), 'optionalAccess', _79 => _79.trendlines]), () => ( [])) };
1143
1281
  }
1144
1282
  };
1145
1283
  const applyPreset = {
@@ -1249,9 +1387,9 @@ function createChartToolProvider(controller, options = {}) {
1249
1387
  const scene = _chunkGTZXF4BIcjs.layoutChart.call(void 0, controller.toJSON(), { width, height });
1250
1388
  const start = { x: from.x * width, y: from.y * height };
1251
1389
  const target = chartHitTest(scene, start);
1252
- if (_optionalChain([target, 'optionalAccess', _64 => _64.kind]) !== "point") fail2(`There is no bar or point at (${from.x}, ${from.y}); ${target ? `that is the ${target.kind}` : "that is outside the chart"}. Use render_chart to find marks.`);
1390
+ if (_optionalChain([target, 'optionalAccess', _80 => _80.kind]) !== "point") fail2(`There is no bar or point at (${from.x}, ${from.y}); ${target ? `that is the ${target.kind}` : "that is outside the chart"}. Use render_chart to find marks.`);
1253
1391
  const t = target;
1254
- const before = _nullishCoalesce(_optionalChain([controller, 'access', _65 => _65.getSeries, 'call', _66 => _66(t.seriesId), 'optionalAccess', _67 => _67.values, 'access', _68 => _68[t.index]]), () => ( null));
1392
+ const before = _nullishCoalesce(_optionalChain([controller, 'access', _81 => _81.getSeries, 'call', _82 => _82(t.seriesId), 'optionalAccess', _83 => _83.values, 'access', _84 => _84[t.index]]), () => ( null));
1255
1393
  const session = startChartPointDrag(controller, scene, t, start);
1256
1394
  if (!session) fail2("That point cannot be dragged here (percent-stacked charts, pies and gaps cannot be dragged).");
1257
1395
  session.move({ x: to.x * width, y: to.y * height }, { fine, lockAxis });
@@ -1279,7 +1417,7 @@ function createChartToolProvider(controller, options = {}) {
1279
1417
  const scene = _chunkGTZXF4BIcjs.layoutChart.call(void 0, controller.toJSON(), size);
1280
1418
  const used = handleChartKey(controller, scene, { key: k, shiftKey: shift, altKey: alt });
1281
1419
  const sel = controller.getState().selection;
1282
- const value = _optionalChain([sel, 'optionalAccess', _69 => _69.kind]) === "point" ? _nullishCoalesce(_optionalChain([controller, 'access', _70 => _70.getSeries, 'call', _71 => _71(sel.seriesId), 'optionalAccess', _72 => _72.values, 'access', _73 => _73[sel.index]]), () => ( null)) : void 0;
1420
+ const value = _optionalChain([sel, 'optionalAccess', _85 => _85.kind]) === "point" ? _nullishCoalesce(_optionalChain([controller, 'access', _86 => _86.getSeries, 'call', _87 => _87(sel.seriesId), 'optionalAccess', _88 => _88.values, 'access', _89 => _89[sel.index]]), () => ( null)) : void 0;
1283
1421
  return { used, selection: sel, ...value !== void 0 ? { value } : {} };
1284
1422
  }
1285
1423
  };
@@ -1335,7 +1473,7 @@ function parsePartialChartJson(text) {
1335
1473
  if (!src) return void 0;
1336
1474
  try {
1337
1475
  return JSON.parse(src);
1338
- } catch (e2) {
1476
+ } catch (e3) {
1339
1477
  }
1340
1478
  const stack = [];
1341
1479
  let inString = false;
@@ -1359,7 +1497,7 @@ function parsePartialChartJson(text) {
1359
1497
  const candidate = trimmed + [...stack].reverse().join("");
1360
1498
  try {
1361
1499
  return JSON.parse(candidate);
1362
- } catch (e3) {
1500
+ } catch (e4) {
1363
1501
  const next = trimmed.replace(/,\s*$/, "").replace(/(?:,|\{)\s*"[^"]*"\s*:?\s*$/, (m) => m.trim().startsWith("{") ? "{" : "").replace(/:\s*$/, ": null").replace(/(?<=[\[,:]\s*)(-|tr?u?|fa?l?s?|nu?l?)$/, "").replace(/(?<=[\[,:]\s*)(-?\d+\.)$/, (m) => m.slice(0, -1));
1364
1502
  if (next === trimmed) break;
1365
1503
  out = next;
@@ -1413,7 +1551,7 @@ var ChartStream = (_class = class {
1413
1551
  function safeParse(text) {
1414
1552
  try {
1415
1553
  return JSON.parse(text);
1416
- } catch (e4) {
1554
+ } catch (e5) {
1417
1555
  return parsePartialChartJson(text);
1418
1556
  }
1419
1557
  }
@@ -1501,7 +1639,7 @@ function createInstantChartClock(start = 0) {
1501
1639
  };
1502
1640
  }
1503
1641
  function chartPointAnchor(scene, seriesId, index) {
1504
- const mark = scene.marks.find((m) => (m.role === "bar" || m.role === "point") && _optionalChain([m, 'access', _74 => _74.target, 'optionalAccess', _75 => _75.kind]) === "point" && m.target.seriesId === seriesId && m.target.index === index);
1642
+ const mark = scene.marks.find((m) => (m.role === "bar" || m.role === "point") && _optionalChain([m, 'access', _90 => _90.target, 'optionalAccess', _91 => _91.kind]) === "point" && m.target.seriesId === seriesId && m.target.index === index);
1505
1643
  if (!mark) return null;
1506
1644
  if (mark.kind === "rect") return { x: mark.x + mark.width / 2, y: mark.y };
1507
1645
  if (mark.kind === "circle") return { x: mark.cx, y: mark.cy };
@@ -1527,8 +1665,8 @@ function planChartCommand(spec, scene, command, speed = 1) {
1527
1665
  case "setValue": {
1528
1666
  const at = chartPointAnchor(scene, command.seriesId, command.index);
1529
1667
  const series = spec.series.find((s) => s.id === command.seriesId);
1530
- const from = _nullishCoalesce(_optionalChain([series, 'optionalAccess', _76 => _76.values, 'access', _77 => _77[command.index]]), () => ( 0));
1531
- const scale = _optionalChain([series, 'optionalAccess', _78 => _78.axis]) === "secondary" ? _nullishCoalesce(scene.valueScale2, () => ( scene.valueScale)) : scene.valueScale;
1668
+ const from = _nullishCoalesce(_optionalChain([series, 'optionalAccess', _92 => _92.values, 'access', _93 => _93[command.index]]), () => ( 0));
1669
+ const scale = _optionalChain([series, 'optionalAccess', _94 => _94.axis]) === "secondary" ? _nullishCoalesce(scene.valueScale2, () => ( scene.valueScale)) : scene.valueScale;
1532
1670
  if (at && scale) {
1533
1671
  const px = _chunkGTZXF4BIcjs.linearMap.call(void 0, command.value, scale.domain, scale.range);
1534
1672
  const to = scale.axis === "y" ? { x: at.x, y: px } : { x: px, y: at.y };
@@ -1540,12 +1678,12 @@ function planChartCommand(spec, scene, command, speed = 1) {
1540
1678
  case "select": {
1541
1679
  const sel = command.selection;
1542
1680
  let to = null;
1543
- if (_optionalChain([sel, 'optionalAccess', _79 => _79.kind]) === "point") to = chartPointAnchor(scene, sel.seriesId, sel.index);
1681
+ if (_optionalChain([sel, 'optionalAccess', _95 => _95.kind]) === "point") to = chartPointAnchor(scene, sel.seriesId, sel.index);
1544
1682
  else if (sel) {
1545
1683
  const m = scene.marks.find((x) => x.target && JSON.stringify(x.target) === JSON.stringify(sel));
1546
- if (_optionalChain([m, 'optionalAccess', _80 => _80.kind]) === "text") to = { x: m.x, y: m.y };
1547
- else if (_optionalChain([m, 'optionalAccess', _81 => _81.kind]) === "rect") to = { x: m.x + m.width / 2, y: m.y + m.height / 2 };
1548
- else if (_optionalChain([m, 'optionalAccess', _82 => _82.kind]) === "circle") to = { x: m.cx, y: m.cy };
1684
+ if (_optionalChain([m, 'optionalAccess', _96 => _96.kind]) === "text") to = { x: m.x, y: m.y };
1685
+ else if (_optionalChain([m, 'optionalAccess', _97 => _97.kind]) === "rect") to = { x: m.x + m.width / 2, y: m.y + m.height / 2 };
1686
+ else if (_optionalChain([m, 'optionalAccess', _98 => _98.kind]) === "circle") to = { x: m.cx, y: m.cy };
1549
1687
  }
1550
1688
  if (to) steps.push({ type: "move", to, ms: ms(380) }, { type: "press" }, { type: "release" });
1551
1689
  steps.push({ type: "commit" });
@@ -1612,7 +1750,7 @@ var ChartDirector = (_class3 = class {
1612
1750
  const t = f / frames;
1613
1751
  const e = 1 - Math.pow(1 - t, 3);
1614
1752
  this.presence.set({ id, x: from.x + (to.x - from.x) * e, y: from.y + (to.y - from.y) * e });
1615
- _optionalChain([each, 'optionalCall', _83 => _83(e)]);
1753
+ _optionalChain([each, 'optionalCall', _99 => _99(e)]);
1616
1754
  await this.clock.wait(ms / frames);
1617
1755
  }
1618
1756
  }
@@ -1644,7 +1782,7 @@ var ChartDirector = (_class3 = class {
1644
1782
  if (command.kind !== "setValue") break;
1645
1783
  const stale2 = this.stale(command);
1646
1784
  if (stale2) return { ok: false, command, message: stale2 };
1647
- const label = `${_nullishCoalesce(_optionalChain([this, 'access', _84 => _84.presence, 'access', _85 => _85.getState, 'call', _86 => _86(), 'access', _87 => _87.actors, 'access', _88 => _88.find, 'call', _89 => _89((a) => a.id === id), 'optionalAccess', _90 => _90.name]), () => ( "Agent"))}: edit value`;
1785
+ const label = `${_nullishCoalesce(_optionalChain([this, 'access', _100 => _100.presence, 'access', _101 => _101.getState, 'call', _102 => _102(), 'access', _103 => _103.actors, 'access', _104 => _104.find, 'call', _105 => _105((a) => a.id === id), 'optionalAccess', _106 => _106.name]), () => ( "Agent"))}: edit value`;
1648
1786
  await this.move(id, where(), step.to, step.ms, (e) => {
1649
1787
  const v = step.from + (step.value - step.from) * e;
1650
1788
  this.controller.setValue(command.seriesId, command.index, Number(v.toPrecision(12)), { label });
@@ -1667,6 +1805,321 @@ var ChartDirector = (_class3 = class {
1667
1805
  }
1668
1806
  }, _class3);
1669
1807
 
1808
+ // src/chart/office-files.ts
1809
+ var OfficeChartsError = class extends Error {
1810
+ constructor(message, options) {
1811
+ super(message, options);
1812
+ this.name = "OfficeChartsError";
1813
+ }
1814
+ };
1815
+ var CHARTEX_NS = "http://schemas.microsoft.com/office/drawing/2014/chartex";
1816
+ var STRICT_CHART_NS = "http://purl.oclc.org/ooxml/drawingml/chart";
1817
+ var dirname = (path) => path.slice(0, path.lastIndexOf("/") + 1);
1818
+ function resolvePartPath(baseDir, target) {
1819
+ const out = [];
1820
+ for (const segment of (target.startsWith("/") ? target.slice(1) : baseDir + target).split("/")) {
1821
+ if (segment === "" || segment === ".") continue;
1822
+ if (segment === "..") out.pop();
1823
+ else out.push(segment);
1824
+ }
1825
+ return out.join("/");
1826
+ }
1827
+ var relsPathFor = (partPath) => `${dirname(partPath)}_rels/${partPath.slice(dirname(partPath).length)}.rels`;
1828
+ function elements(root, localName) {
1829
+ return Array.from(root.getElementsByTagNameNS("*", localName));
1830
+ }
1831
+ function relId(el, localName = "id") {
1832
+ for (const a of Array.from(el.attributes)) {
1833
+ if (a.localName === localName && (_optionalChain([a, 'access', _107 => _107.namespaceURI, 'optionalAccess', _108 => _108.includes, 'call', _109 => _109("relationships")]) || a.prefix === "r")) return a.value;
1834
+ }
1835
+ return void 0;
1836
+ }
1837
+ var firstChild = (el, localName) => el ? Array.from(_nullishCoalesce(el.children, () => ( el.childNodes))).find((n) => n.nodeType === 1 && n.localName === localName) : void 0;
1838
+ async function readXml(r, path) {
1839
+ const entry = _nullishCoalesce(r.zip.get(path), () => ( r.zip.entries.find((e) => e.name.toLowerCase() === path.toLowerCase())));
1840
+ if (!entry) return null;
1841
+ const doc = new r.Parser().parseFromString(await r.zip.readText(entry), "application/xml");
1842
+ return doc.getElementsByTagName("parsererror").length ? null : doc;
1843
+ }
1844
+ async function readRels(r, partPath) {
1845
+ const rels = /* @__PURE__ */ new Map();
1846
+ const doc = await readXml(r, relsPathFor(partPath));
1847
+ if (!doc) return rels;
1848
+ for (const rel of elements(doc, "Relationship")) {
1849
+ const id = rel.getAttribute("Id");
1850
+ if (!id) continue;
1851
+ const target = _nullishCoalesce(rel.getAttribute("Target"), () => ( ""));
1852
+ const external = _optionalChain([rel, 'access', _110 => _110.getAttribute, 'call', _111 => _111("TargetMode"), 'optionalAccess', _112 => _112.toLowerCase, 'call', _113 => _113()]) === "external";
1853
+ rels.set(id, { type: _nullishCoalesce(rel.getAttribute("Type"), () => ( "")), target: external ? target : resolvePartPath(dirname(partPath), target), external });
1854
+ }
1855
+ return rels;
1856
+ }
1857
+ var isChartRef = (el) => el.localName === "chart" && (el.namespaceURI === _chunk3ZBAXET6cjs.CHART_OOXML_NS || el.namespaceURI === STRICT_CHART_NS || el.namespaceURI === CHARTEX_NS);
1858
+ function frameName(ref) {
1859
+ for (let el = ref.parentElement; el; el = el.parentElement) {
1860
+ if (el.localName === "graphicFrame") {
1861
+ const nv = elements(el, "cNvPr")[0];
1862
+ return _optionalChain([nv, 'optionalAccess', _114 => _114.getAttribute, 'call', _115 => _115("name")]) || void 0;
1863
+ }
1864
+ }
1865
+ return void 0;
1866
+ }
1867
+ async function chartsInPart(r, root, rels, place) {
1868
+ for (const ref of elements(root, "chart")) {
1869
+ if (r.charts.length >= r.max) return;
1870
+ if (!isChartRef(ref)) continue;
1871
+ const rel = rels.get(_nullishCoalesce(relId(ref), () => ( "")));
1872
+ if (!rel || rel.external || r.seen.has(rel.target)) continue;
1873
+ const entry = r.zip.get(rel.target);
1874
+ if (!entry) continue;
1875
+ r.seen.add(rel.target);
1876
+ const read = _chunk3ZBAXET6cjs.chartFromOoxml.call(void 0, await r.zip.readText(entry), { DOMParser: r.Parser });
1877
+ const name = frameName(ref);
1878
+ r.charts.push({
1879
+ id: `chart-${r.charts.length + 1}`,
1880
+ path: rel.target,
1881
+ partKind: ref.namespaceURI === CHARTEX_NS ? "chartex" : "chart",
1882
+ ...place(ref),
1883
+ ...name ? { name } : {},
1884
+ title: read.spec.title,
1885
+ spec: read.spec,
1886
+ issues: read.issues.map((i) => i.message),
1887
+ unsupported: read.unsupported,
1888
+ lossless: read.lossless
1889
+ });
1890
+ }
1891
+ }
1892
+ function columnName(index) {
1893
+ let name = "";
1894
+ for (let n = index + 1; n > 0; n = Math.floor((n - 1) / 26)) name = String.fromCharCode(65 + (n - 1) % 26) + name;
1895
+ return name;
1896
+ }
1897
+ function anchorCell(marker) {
1898
+ const col = Number(_optionalChain([firstChild, 'call', _116 => _116(marker, "col"), 'optionalAccess', _117 => _117.textContent]));
1899
+ const row = Number(_optionalChain([firstChild, 'call', _118 => _118(marker, "row"), 'optionalAccess', _119 => _119.textContent]));
1900
+ return Number.isInteger(col) && Number.isInteger(row) && col >= 0 && row >= 0 ? `${columnName(col)}${row + 1}` : void 0;
1901
+ }
1902
+ function drawingPlace(ref) {
1903
+ for (let el = ref.parentElement; el; el = el.parentElement) {
1904
+ if (el.localName === "twoCellAnchor" || el.localName === "oneCellAnchor") {
1905
+ const anchor = anchorCell(firstChild(el, "from"));
1906
+ const to = el.localName === "twoCellAnchor" ? anchorCell(firstChild(el, "to")) : void 0;
1907
+ return { ...anchor ? { anchor } : {}, ...anchor && to ? { range: `${anchor}:${to}` } : {} };
1908
+ }
1909
+ if (el.localName === "absoluteAnchor") return {};
1910
+ }
1911
+ return {};
1912
+ }
1913
+ async function readMainPart(r) {
1914
+ const rootRels = await readRels(r, "");
1915
+ const main = [...rootRels.values()].find((rel) => /\/officeDocument$/.test(rel.type) && !rel.external);
1916
+ const doc = main ? await readXml(r, main.target) : null;
1917
+ if (!main || !doc) throw new OfficeChartsError("This is not an Office file: _rels/.rels names no main part (expected an .xlsx, .pptx or .docx file).");
1918
+ return { path: main.target, doc };
1919
+ }
1920
+ async function readXlsx(r, main) {
1921
+ const rels = await readRels(r, main.path);
1922
+ for (const sheet of elements(main.doc, "sheet")) {
1923
+ const rel = rels.get(_nullishCoalesce(relId(sheet), () => ( "")));
1924
+ if (!rel || rel.external) continue;
1925
+ const doc = await readXml(r, rel.target);
1926
+ if (!doc) continue;
1927
+ const sheetName = _nullishCoalesce(sheet.getAttribute("name"), () => ( rel.target));
1928
+ const sheetRels = await readRels(r, rel.target);
1929
+ for (const drawingRef of elements(doc, "drawing")) {
1930
+ const drawingRel = sheetRels.get(_nullishCoalesce(relId(drawingRef), () => ( "")));
1931
+ if (!drawingRel || drawingRel.external) continue;
1932
+ const drawing = await readXml(r, drawingRel.target);
1933
+ if (!drawing) continue;
1934
+ const drawingRels = await readRels(r, drawingRel.target);
1935
+ await chartsInPart(r, drawing, drawingRels, (ref) => ({ sheet: sheetName, ...drawingPlace(ref) }));
1936
+ }
1937
+ }
1938
+ }
1939
+ async function readPptx(r, main) {
1940
+ const rels = await readRels(r, main.path);
1941
+ const slides = elements(main.doc, "sldId");
1942
+ for (let i = 0; i < slides.length; i++) {
1943
+ const rel = rels.get(_nullishCoalesce(relId(slides[i]), () => ( "")));
1944
+ if (!rel || rel.external) continue;
1945
+ const doc = await readXml(r, rel.target);
1946
+ if (!doc) continue;
1947
+ await chartsInPart(r, doc, await readRels(r, rel.target), () => ({ slide: i + 1 }));
1948
+ }
1949
+ }
1950
+ async function readDocx(r, main) {
1951
+ await chartsInPart(r, main.doc, await readRels(r, main.path), () => ({}));
1952
+ }
1953
+ async function open(bytes, options) {
1954
+ const Parser = _nullishCoalesce(options.DOMParser, () => ( globalThis.DOMParser));
1955
+ if (!Parser) throw new OfficeChartsError("Reading Office files needs a DOMParser. In Node, pass one (e.g. from jsdom or @xmldom/xmldom) as { DOMParser }.");
1956
+ let zip;
1957
+ try {
1958
+ zip = await _chunk3ZBAXET6cjs.readZip.call(void 0, bytes, options);
1959
+ } catch (error) {
1960
+ throw new OfficeChartsError(`This is not an Office file: ${error.message}`, { cause: error });
1961
+ }
1962
+ const r = { zip, Parser, max: _nullishCoalesce(options.maxCharts, () => ( 500)), charts: [], seen: /* @__PURE__ */ new Set() };
1963
+ const main = await readMainPart(r);
1964
+ const root = main.doc.documentElement.localName;
1965
+ const format = root === "workbook" ? "xlsx" : root === "presentation" ? "pptx" : root === "document" ? "docx" : void 0;
1966
+ if (!format) throw new OfficeChartsError(`The main part ${main.path} is a <${root}>; expected an Excel workbook, PowerPoint presentation or Word document.`);
1967
+ return { r, main, format };
1968
+ }
1969
+ var READERS = { xlsx: readXlsx, pptx: readPptx, docx: readDocx };
1970
+ async function extractOfficeCharts(bytes, options = {}) {
1971
+ const { r, main, format } = await open(bytes, options);
1972
+ await READERS[format](r, main);
1973
+ return { format, charts: r.charts };
1974
+ }
1975
+ async function extractAs(format, bytes, options) {
1976
+ const result = await extractOfficeCharts(bytes, options);
1977
+ if (result.format !== format) throw new OfficeChartsError(`This is a .${result.format} file, not a .${format} file.`);
1978
+ return result.charts;
1979
+ }
1980
+ var extractXlsxCharts = (bytes, options = {}) => extractAs("xlsx", bytes, options);
1981
+ var extractPptxCharts = (bytes, options = {}) => extractAs("pptx", bytes, options);
1982
+ var extractDocxCharts = (bytes, options = {}) => extractAs("docx", bytes, options);
1983
+ function describeOfficeChartPlace(chart) {
1984
+ if (chart.sheet !== void 0) return chart.anchor ? `${chart.sheet}!${chart.anchor}` : chart.sheet;
1985
+ if (chart.slide !== void 0) return `Slide ${chart.slide}`;
1986
+ return "Document";
1987
+ }
1988
+
1989
+ // src/chart/file-tools.ts
1990
+ var READ2 = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
1991
+ var DESTRUCTIVE2 = { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false };
1992
+ var fail3 = (message) => {
1993
+ throw new Error(message);
1994
+ };
1995
+ function fromBase64(data) {
1996
+ const clean = data.replace(/^data:[^,]*,/, "").replace(/\s+/g, "");
1997
+ let binary;
1998
+ try {
1999
+ binary = atob(clean);
2000
+ } catch (e6) {
2001
+ return fail3('"data" is not valid base64. Pass the whole .xlsx, .pptx or .docx file encoded as base64 (a data: URL prefix is fine).');
2002
+ }
2003
+ const out = new Uint8Array(binary.length);
2004
+ for (let i = 0; i < binary.length; i++) out[i] = binary.charCodeAt(i);
2005
+ return out;
2006
+ }
2007
+ function chartSummary(chart) {
2008
+ return {
2009
+ id: chart.id,
2010
+ place: describeOfficeChartPlace(chart),
2011
+ ...chart.sheet !== void 0 ? { sheet: chart.sheet } : {},
2012
+ ...chart.slide !== void 0 ? { slide: chart.slide } : {},
2013
+ ...chart.anchor ? { anchor: chart.anchor } : {},
2014
+ ...chart.range ? { range: chart.range } : {},
2015
+ ...chart.name ? { name: chart.name } : {},
2016
+ path: chart.path,
2017
+ partKind: chart.partKind,
2018
+ title: chart.title,
2019
+ type: chart.spec.type,
2020
+ series: chart.spec.series.map((s) => s.name),
2021
+ categories: chart.spec.categories.length,
2022
+ issues: chart.issues,
2023
+ unsupported: chart.unsupported,
2024
+ lossless: chart.lossless
2025
+ };
2026
+ }
2027
+ function createOfficeChartToolProvider(options = {}) {
2028
+ const cache = /* @__PURE__ */ new WeakMap();
2029
+ const readOnlyReason = () => {
2030
+ const r = typeof options.readOnly === "function" ? options.readOnly() : options.readOnly;
2031
+ if (!r) return null;
2032
+ return typeof r === "string" ? r : "This chart is read-only.";
2033
+ };
2034
+ const source = options.files ? { file: { type: "string", description: "Name of an open file, as list_open_files returns it." } } : { data: { type: "string", description: "The whole .xlsx, .pptx or .docx file as base64 (a data: URL prefix is allowed)." } };
2035
+ const sourceKey = options.files ? "file" : "data";
2036
+ const read = (args) => {
2037
+ if (!options.files) return extractOfficeCharts(fromBase64(String(args.data)), { DOMParser: options.DOMParser });
2038
+ const files = options.files();
2039
+ const file = files.find((f) => f.name === args.file);
2040
+ if (!file) return fail3(`There is no open file "${String(args.file)}"; expected one of ${files.map((f) => JSON.stringify(f.name)).join(", ") || "(none; ask the user to open an .xlsx, .pptx or .docx file)"}.`);
2041
+ let result = cache.get(file);
2042
+ if (!result) {
2043
+ result = extractOfficeCharts(file.data, { DOMParser: options.DOMParser });
2044
+ cache.set(file, result);
2045
+ result.catch(() => cache.delete(file));
2046
+ }
2047
+ return result;
2048
+ };
2049
+ const chartById = async (args) => {
2050
+ const { charts } = await read(args);
2051
+ const chart = charts.find((c) => c.id === args.chartId);
2052
+ if (!chart) fail3(`There is no chart "${String(args.chartId)}" in this file; expected one of ${charts.map((c) => `"${c.id}" (${describeOfficeChartPlace(c)})`).join(", ") || "(none: the file has no charts)"}.`);
2053
+ return chart;
2054
+ };
2055
+ const CHART_ID = { type: "string", description: 'Chart id from list_file_charts, e.g. "chart-1".' };
2056
+ const listOpenFiles = {
2057
+ name: "list_open_files",
2058
+ title: "List open files",
2059
+ description: "Lists the Office files the user opened that charts can be read from. Returns their names and sizes in bytes.",
2060
+ inputSchema: { type: "object", properties: {}, additionalProperties: false },
2061
+ annotations: { title: "List open files", ...READ2 },
2062
+ handler: () => ({ files: (_nullishCoalesce(_optionalChain([options, 'access', _120 => _120.files, 'optionalCall', _121 => _121()]), () => ( []))).map((f) => ({ name: f.name, bytes: f.data.byteLength })) })
2063
+ };
2064
+ const listCharts = {
2065
+ name: "list_file_charts",
2066
+ title: "List the charts in an Office file",
2067
+ description: "Reads an Excel workbook, PowerPoint deck or Word document and lists its charts in file order: id, where it sits (sheet name and anchor cell, or slide number), title, type, series names, number of categories, read problems, features the chart editor cannot hold, and whether it reads losslessly. Pass an id to get_file_chart or load_file_chart.",
2068
+ inputSchema: { type: "object", properties: { ...source }, required: [sourceKey], additionalProperties: false },
2069
+ annotations: { title: "List the charts in an Office file", ...READ2 },
2070
+ handler: async (args) => {
2071
+ const result = await read(args);
2072
+ return { format: result.format, charts: result.charts.map(chartSummary) };
2073
+ }
2074
+ };
2075
+ const getChart = {
2076
+ name: "get_file_chart",
2077
+ title: "Get a chart from an Office file",
2078
+ description: "Returns one chart of an Office file with its full chart spec (data, axes, series styles), where it sits and its read problems.",
2079
+ inputSchema: { type: "object", properties: { ...source, chartId: CHART_ID }, required: [sourceKey, "chartId"], additionalProperties: false },
2080
+ annotations: { title: "Get a chart from an Office file", ...READ2 },
2081
+ handler: async (args) => {
2082
+ const chart = await chartById(args);
2083
+ return { ...chartSummary(chart), spec: chart.spec };
2084
+ }
2085
+ };
2086
+ const loadChart = {
2087
+ name: "load_file_chart",
2088
+ title: "Load a chart from an Office file",
2089
+ description: "Replaces the chart in the editor with a chart from an Office file, as one undo step. Returns the new spec, read problems and features the editor could not keep.",
2090
+ inputSchema: { type: "object", properties: { ...source, chartId: CHART_ID }, required: [sourceKey, "chartId"], additionalProperties: false },
2091
+ annotations: { title: "Load a chart from an Office file", ...DESTRUCTIVE2 },
2092
+ handler: async (args) => {
2093
+ const reason = readOnlyReason();
2094
+ if (reason) fail3(reason);
2095
+ const chart = await chartById(args);
2096
+ const result = options.controller.update({ ...chart.spec }, { label: "Load chart from file" });
2097
+ if (!result.ok) fail3(_nullishCoalesce(result.message, () => ( "The chart could not be loaded.")));
2098
+ return { id: chart.id, place: describeOfficeChartPlace(chart), spec: options.controller.toJSON(), issues: chart.issues, unsupported: chart.unsupported, lossless: chart.lossless };
2099
+ }
2100
+ };
2101
+ return {
2102
+ id: _nullishCoalesce(options.id, () => ( "office-charts")),
2103
+ ...options.namespace ? { namespace: options.namespace } : {},
2104
+ tools: () => [...options.files ? [listOpenFiles] : [], listCharts, getChart, ...options.controller && !readOnlyReason() ? [loadChart] : []]
2105
+ };
2106
+ }
2107
+
2108
+
2109
+
2110
+
2111
+
2112
+
2113
+
2114
+
2115
+
2116
+
2117
+
2118
+
2119
+
2120
+
2121
+
2122
+
1670
2123
 
1671
2124
 
1672
2125
 
@@ -1799,5 +2252,5 @@ var ChartDirector = (_class3 = class {
1799
2252
 
1800
2253
 
1801
2254
 
1802
- exports.CHART_AXIS_KINDS = _chunkJOX6MJW4cjs.CHART_AXIS_KINDS; exports.CHART_COLOR_SCHEMES = _chunkGTZXF4BIcjs.CHART_COLOR_SCHEMES; exports.CHART_CURVES = _chunkJOX6MJW4cjs.CHART_CURVES; exports.CHART_DATE_STEPS = _chunkGTZXF4BIcjs.CHART_DATE_STEPS; exports.CHART_LABEL_POSITIONS = _chunkJOX6MJW4cjs.CHART_LABEL_POSITIONS; exports.CHART_LAYOUT_PRESETS = _chunkGTZXF4BIcjs.CHART_LAYOUT_PRESETS; exports.CHART_LEGEND_POSITIONS = _chunkJOX6MJW4cjs.CHART_LEGEND_POSITIONS; exports.CHART_MARKERS = _chunkJOX6MJW4cjs.CHART_MARKERS; exports.CHART_MERMAID_META_PREFIX = _chunkGTZXF4BIcjs.CHART_MERMAID_META_PREFIX; exports.CHART_NUMBER_STYLES = _chunkJOX6MJW4cjs.CHART_NUMBER_STYLES; exports.CHART_OOXML_CONTENT_TYPE = _chunk3JNRQVTScjs.CHART_OOXML_CONTENT_TYPE; exports.CHART_OOXML_NS = _chunk3JNRQVTScjs.CHART_OOXML_NS; exports.CHART_OOXML_RELATIONSHIP = _chunk3JNRQVTScjs.CHART_OOXML_RELATIONSHIP; exports.CHART_ORIENTATIONS = _chunkJOX6MJW4cjs.CHART_ORIENTATIONS; exports.CHART_PALETTE_SHADES = _chunkJOX6MJW4cjs.CHART_PALETTE_SHADES; exports.CHART_PRESENCE_COLORS = CHART_PRESENCE_COLORS; exports.CHART_SERIES_TYPES = _chunkJOX6MJW4cjs.CHART_SERIES_TYPES; exports.CHART_STACKINGS = _chunkJOX6MJW4cjs.CHART_STACKINGS; exports.CHART_TRENDLINE_TYPES = _chunkJOX6MJW4cjs.CHART_TRENDLINE_TYPES; exports.CHART_TYPES = _chunkJOX6MJW4cjs.CHART_TYPES; exports.CHART_TYPE_LABELS = _chunkJOX6MJW4cjs.CHART_TYPE_LABELS; exports.CSS_VARIABLE_CHART_THEME = _chunkJOX6MJW4cjs.CSS_VARIABLE_CHART_THEME; exports.ChartController = _chunkGTZXF4BIcjs.ChartController; exports.ChartDirector = ChartDirector; exports.ChartPresence = ChartPresence; exports.ChartStream = ChartStream; exports.DEFAULT_CHART_PALETTE = _chunkJOX6MJW4cjs.DEFAULT_CHART_PALETTE; exports.DEFAULT_CHART_THEME = _chunkJOX6MJW4cjs.DEFAULT_CHART_THEME; exports.MAX_CHART_DATA_LABELS = _chunkGTZXF4BIcjs.MAX_CHART_DATA_LABELS; exports.MAX_CHART_LINE_POINTS = _chunkGTZXF4BIcjs.MAX_CHART_LINE_POINTS; exports.MAX_CHART_MARKERS = _chunkGTZXF4BIcjs.MAX_CHART_MARKERS; exports.analyzeChartTable = analyzeChartTable; exports.blendChartScenes = blendChartScenes; exports.canDragChartPoint = canDragChartPoint; exports.chartBoxStats = _chunkGTZXF4BIcjs.chartBoxStats; exports.chartClientToScene = chartClientToScene; exports.chartColorDistance = _chunkJOX6MJW4cjs.chartColorDistance; exports.chartColorInputValue = _chunkJOX6MJW4cjs.chartColorInputValue; exports.chartColorsByCategory = _chunkJOX6MJW4cjs.chartColorsByCategory; exports.chartContrastRatio = _chunkJOX6MJW4cjs.chartContrastRatio; exports.chartDataFromTable = _chunkJOX6MJW4cjs.chartDataFromTable; exports.chartDataToTable = _chunkJOX6MJW4cjs.chartDataToTable; exports.chartDateLabels = _chunkGTZXF4BIcjs.chartDateLabels; exports.chartDateToSerial = _chunkGTZXF4BIcjs.chartDateToSerial; exports.chartFamily = _chunkJOX6MJW4cjs.chartFamily; exports.chartFormatToCode = _chunk3JNRQVTScjs.chartFormatToCode; exports.chartFromMermaid = _chunkGTZXF4BIcjs.chartFromMermaid; exports.chartFromOoxml = _chunk3JNRQVTScjs.chartFromOoxml; exports.chartFromTable = chartFromTable; exports.chartHistogram = _chunkGTZXF4BIcjs.chartHistogram; exports.chartHitTest = chartHitTest; exports.chartLuminance = _chunkJOX6MJW4cjs.chartLuminance; exports.chartMermaidFamily = _chunkGTZXF4BIcjs.chartMermaidFamily; exports.chartMovingAverage = _chunkGTZXF4BIcjs.chartMovingAverage; exports.chartPointAnchor = chartPointAnchor; exports.chartPointColor = _chunkJOX6MJW4cjs.chartPointColor; exports.chartPresetPatch = _chunkGTZXF4BIcjs.chartPresetPatch; exports.chartQuantile = _chunkGTZXF4BIcjs.chartQuantile; exports.chartRgbToHex = _chunkJOX6MJW4cjs.chartRgbToHex; exports.chartRgbToOklab = _chunkJOX6MJW4cjs.chartRgbToOklab; exports.chartSceneToDomSpec = _chunkGTZXF4BIcjs.chartSceneToDomSpec; exports.chartSceneToSvg = _chunkGTZXF4BIcjs.chartSceneToSvg; exports.chartSerialToDate = _chunkGTZXF4BIcjs.chartSerialToDate; exports.chartSeriesColor = _chunkJOX6MJW4cjs.chartSeriesColor; exports.chartSeriesType = _chunkJOX6MJW4cjs.chartSeriesType; exports.chartSliceColor = _chunkJOX6MJW4cjs.chartSliceColor; exports.chartSquarify = _chunkGTZXF4BIcjs.chartSquarify; exports.chartSupportsTrendlines = _chunkGTZXF4BIcjs.chartSupportsTrendlines; exports.chartTextBaseline = _chunkGTZXF4BIcjs.chartTextBaseline; exports.chartTextOn = _chunkJOX6MJW4cjs.chartTextOn; exports.chartTextTransform = _chunkGTZXF4BIcjs.chartTextTransform; exports.chartToMermaid = _chunkGTZXF4BIcjs.chartToMermaid; exports.chartToOoxml = _chunk3JNRQVTScjs.chartToOoxml; exports.chartToSvg = _chunkGTZXF4BIcjs.chartToSvg; exports.chartTrendlineName = _chunkGTZXF4BIcjs.chartTrendlineName; exports.chartValueAtPoint = _chunkGTZXF4BIcjs.chartValueAtPoint; exports.chartXAtPoint = _chunkGTZXF4BIcjs.chartXAtPoint; exports.checkChartColors = _chunkJOX6MJW4cjs.checkChartColors; exports.cloneChartSeries = _chunkJOX6MJW4cjs.cloneChartSeries; exports.cloneChartSpec = _chunkJOX6MJW4cjs.cloneChartSpec; exports.compileChartFormatCode = _chunkGTZXF4BIcjs.compileChartFormatCode; exports.contrastingTextColor = _chunkGTZXF4BIcjs.contrastingTextColor; exports.createChartCommands = createChartCommands; exports.createChartController = _chunkGTZXF4BIcjs.createChartController; exports.createChartSpec = _chunkJOX6MJW4cjs.createChartSpec; exports.createChartToolProvider = createChartToolProvider; exports.createInstantChartClock = createInstantChartClock; exports.cyclePaletteColor = _chunkJOX6MJW4cjs.cyclePaletteColor; exports.decimateChartPoints = _chunkGTZXF4BIcjs.decimateChartPoints; exports.defaultChartAxis = _chunkJOX6MJW4cjs.defaultChartAxis; exports.describeChart = _chunkGTZXF4BIcjs.describeChart; exports.describeChartSelection = describeChartSelection; exports.easeChartTween = easeChartTween; exports.estimateChartTextWidth = _chunkGTZXF4BIcjs.estimateChartTextWidth; exports.findMermaidCharts = _chunkGTZXF4BIcjs.findMermaidCharts; exports.fitChartTrendline = _chunkGTZXF4BIcjs.fitChartTrendline; exports.formatChartDate = _chunkGTZXF4BIcjs.formatChartDate; exports.formatChartNumber = _chunkGTZXF4BIcjs.formatChartNumber; exports.formatChartValueWithCode = _chunkGTZXF4BIcjs.formatChartValueWithCode; exports.handleChartKey = handleChartKey; exports.isCartesianChart = _chunkJOX6MJW4cjs.isCartesianChart; exports.isXyChart = _chunkJOX6MJW4cjs.isXyChart; exports.layoutChart = _chunkGTZXF4BIcjs.layoutChart; exports.layoutSparkline = _chunkGTZXF4BIcjs.layoutSparkline; exports.linearMap = _chunkGTZXF4BIcjs.linearMap; exports.monochromeChartPalette = _chunkGTZXF4BIcjs.monochromeChartPalette; exports.niceScale = _chunkGTZXF4BIcjs.niceScale; exports.niceStep = _chunkGTZXF4BIcjs.niceStep; exports.normalizeChartAxis = _chunkJOX6MJW4cjs.normalizeChartAxis; exports.normalizeChartSpec = _chunkJOX6MJW4cjs.normalizeChartSpec; exports.normalizeChartTrendline = _chunkJOX6MJW4cjs.normalizeChartTrendline; exports.normalizeChartValues = _chunkJOX6MJW4cjs.normalizeChartValues; exports.parseChartColor = _chunkJOX6MJW4cjs.parseChartColor; exports.parseChartDate = _chunkGTZXF4BIcjs.parseChartDate; exports.parseChartValue = _chunkJOX6MJW4cjs.parseChartValue; exports.parsePartialChartJson = parsePartialChartJson; exports.planChartCommand = planChartCommand; exports.realChartClock = realChartClock; exports.recommendChartTypes = recommendChartTypes; exports.recommendForShape = recommendForShape; exports.sameChartSelection = _chunkGTZXF4BIcjs.sameChartSelection; exports.shadeChartColor = _chunkJOX6MJW4cjs.shadeChartColor; exports.simulateChartVision = _chunkJOX6MJW4cjs.simulateChartVision; exports.snapChartDragValue = snapChartDragValue; exports.snapChartValue = _chunkGTZXF4BIcjs.snapChartValue; exports.sparklineToSvg = _chunkGTZXF4BIcjs.sparklineToSvg; exports.startChartPointDrag = startChartPointDrag; exports.stepDecimals = _chunkGTZXF4BIcjs.stepDecimals; exports.summarizeChart = _chunkGTZXF4BIcjs.summarizeChart; exports.summarizeChartSeries = _chunkGTZXF4BIcjs.summarizeChartSeries; exports.trendNumberText = _chunkGTZXF4BIcjs.trendNumberText; exports.uniqueChartSeriesId = _chunkJOX6MJW4cjs.uniqueChartSeriesId;
2255
+ exports.CHART_AXIS_KINDS = _chunkJOX6MJW4cjs.CHART_AXIS_KINDS; exports.CHART_COLOR_SCHEMES = _chunkGTZXF4BIcjs.CHART_COLOR_SCHEMES; exports.CHART_CURVES = _chunkJOX6MJW4cjs.CHART_CURVES; exports.CHART_DATE_STEPS = _chunkGTZXF4BIcjs.CHART_DATE_STEPS; exports.CHART_LABEL_POSITIONS = _chunkJOX6MJW4cjs.CHART_LABEL_POSITIONS; exports.CHART_LAYOUT_PRESETS = _chunkGTZXF4BIcjs.CHART_LAYOUT_PRESETS; exports.CHART_LEGEND_POSITIONS = _chunkJOX6MJW4cjs.CHART_LEGEND_POSITIONS; exports.CHART_MARKERS = _chunkJOX6MJW4cjs.CHART_MARKERS; exports.CHART_MERMAID_META_PREFIX = _chunkGTZXF4BIcjs.CHART_MERMAID_META_PREFIX; exports.CHART_NUMBER_STYLES = _chunkJOX6MJW4cjs.CHART_NUMBER_STYLES; exports.CHART_OOXML_CONTENT_TYPE = _chunk3ZBAXET6cjs.CHART_OOXML_CONTENT_TYPE; exports.CHART_OOXML_NS = _chunk3ZBAXET6cjs.CHART_OOXML_NS; exports.CHART_OOXML_RELATIONSHIP = _chunk3ZBAXET6cjs.CHART_OOXML_RELATIONSHIP; exports.CHART_ORIENTATIONS = _chunkJOX6MJW4cjs.CHART_ORIENTATIONS; exports.CHART_PALETTE_SHADES = _chunkJOX6MJW4cjs.CHART_PALETTE_SHADES; exports.CHART_PRESENCE_COLORS = CHART_PRESENCE_COLORS; exports.CHART_RASTER_MAX_SIZE = CHART_RASTER_MAX_SIZE; exports.CHART_SERIES_TYPES = _chunkJOX6MJW4cjs.CHART_SERIES_TYPES; exports.CHART_STACKINGS = _chunkJOX6MJW4cjs.CHART_STACKINGS; exports.CHART_TRENDLINE_TYPES = _chunkJOX6MJW4cjs.CHART_TRENDLINE_TYPES; exports.CHART_TYPES = _chunkJOX6MJW4cjs.CHART_TYPES; exports.CHART_TYPE_LABELS = _chunkJOX6MJW4cjs.CHART_TYPE_LABELS; exports.CSS_VARIABLE_CHART_THEME = _chunkJOX6MJW4cjs.CSS_VARIABLE_CHART_THEME; exports.ChartController = _chunkGTZXF4BIcjs.ChartController; exports.ChartDirector = ChartDirector; exports.ChartPresence = ChartPresence; exports.ChartStream = ChartStream; exports.DEFAULT_CHART_PALETTE = _chunkJOX6MJW4cjs.DEFAULT_CHART_PALETTE; exports.DEFAULT_CHART_THEME = _chunkJOX6MJW4cjs.DEFAULT_CHART_THEME; exports.MAX_CHART_DATA_LABELS = _chunkGTZXF4BIcjs.MAX_CHART_DATA_LABELS; exports.MAX_CHART_LINE_POINTS = _chunkGTZXF4BIcjs.MAX_CHART_LINE_POINTS; exports.MAX_CHART_MARKERS = _chunkGTZXF4BIcjs.MAX_CHART_MARKERS; exports.OfficeChartsError = OfficeChartsError; exports.RENDER_CHART_INSTRUCTIONS = RENDER_CHART_INSTRUCTIONS; exports.analyzeChartTable = analyzeChartTable; exports.blendChartScenes = blendChartScenes; exports.canDragChartPoint = canDragChartPoint; exports.chartBoxStats = _chunkGTZXF4BIcjs.chartBoxStats; exports.chartClientToScene = chartClientToScene; exports.chartColorDistance = _chunkJOX6MJW4cjs.chartColorDistance; exports.chartColorInputValue = _chunkJOX6MJW4cjs.chartColorInputValue; exports.chartColorsByCategory = _chunkJOX6MJW4cjs.chartColorsByCategory; exports.chartContrastRatio = _chunkJOX6MJW4cjs.chartContrastRatio; exports.chartDataFromTable = _chunkJOX6MJW4cjs.chartDataFromTable; exports.chartDataToTable = _chunkJOX6MJW4cjs.chartDataToTable; exports.chartDateLabels = _chunkGTZXF4BIcjs.chartDateLabels; exports.chartDateToSerial = _chunkGTZXF4BIcjs.chartDateToSerial; exports.chartFamily = _chunkJOX6MJW4cjs.chartFamily; exports.chartFileName = chartFileName; exports.chartFormatToCode = _chunk3ZBAXET6cjs.chartFormatToCode; exports.chartFromMermaid = _chunkGTZXF4BIcjs.chartFromMermaid; exports.chartFromOoxml = _chunk3ZBAXET6cjs.chartFromOoxml; exports.chartFromTable = chartFromTable; exports.chartHistogram = _chunkGTZXF4BIcjs.chartHistogram; exports.chartHitTest = chartHitTest; exports.chartLuminance = _chunkJOX6MJW4cjs.chartLuminance; exports.chartMermaidFamily = _chunkGTZXF4BIcjs.chartMermaidFamily; exports.chartMovingAverage = _chunkGTZXF4BIcjs.chartMovingAverage; exports.chartPointAnchor = chartPointAnchor; exports.chartPointColor = _chunkJOX6MJW4cjs.chartPointColor; exports.chartPresetPatch = _chunkGTZXF4BIcjs.chartPresetPatch; exports.chartQuantile = _chunkGTZXF4BIcjs.chartQuantile; exports.chartRasterSize = chartRasterSize; exports.chartRgbToHex = _chunkJOX6MJW4cjs.chartRgbToHex; exports.chartRgbToOklab = _chunkJOX6MJW4cjs.chartRgbToOklab; exports.chartSceneToDomSpec = _chunkGTZXF4BIcjs.chartSceneToDomSpec; exports.chartSceneToSvg = _chunkGTZXF4BIcjs.chartSceneToSvg; exports.chartSerialToDate = _chunkGTZXF4BIcjs.chartSerialToDate; exports.chartSeriesColor = _chunkJOX6MJW4cjs.chartSeriesColor; exports.chartSeriesType = _chunkJOX6MJW4cjs.chartSeriesType; exports.chartSliceColor = _chunkJOX6MJW4cjs.chartSliceColor; exports.chartSquarify = _chunkGTZXF4BIcjs.chartSquarify; exports.chartSupportsTrendlines = _chunkGTZXF4BIcjs.chartSupportsTrendlines; exports.chartTextBaseline = _chunkGTZXF4BIcjs.chartTextBaseline; exports.chartTextOn = _chunkJOX6MJW4cjs.chartTextOn; exports.chartTextTransform = _chunkGTZXF4BIcjs.chartTextTransform; exports.chartToMermaid = _chunkGTZXF4BIcjs.chartToMermaid; exports.chartToOoxml = _chunk3ZBAXET6cjs.chartToOoxml; exports.chartToSvg = _chunkGTZXF4BIcjs.chartToSvg; exports.chartTrendlineName = _chunkGTZXF4BIcjs.chartTrendlineName; exports.chartValueAtPoint = _chunkGTZXF4BIcjs.chartValueAtPoint; exports.chartXAtPoint = _chunkGTZXF4BIcjs.chartXAtPoint; exports.checkChartColors = _chunkJOX6MJW4cjs.checkChartColors; exports.cloneChartSeries = _chunkJOX6MJW4cjs.cloneChartSeries; exports.cloneChartSpec = _chunkJOX6MJW4cjs.cloneChartSpec; exports.compileChartFormatCode = _chunkGTZXF4BIcjs.compileChartFormatCode; exports.contrastingTextColor = _chunkGTZXF4BIcjs.contrastingTextColor; exports.createChartCommands = createChartCommands; exports.createChartController = _chunkGTZXF4BIcjs.createChartController; exports.createChartRasterizer = createChartRasterizer; exports.createChartSpec = _chunkJOX6MJW4cjs.createChartSpec; exports.createChartToolProvider = createChartToolProvider; exports.createInstantChartClock = createInstantChartClock; exports.createOfficeChartToolProvider = createOfficeChartToolProvider; exports.cyclePaletteColor = _chunkJOX6MJW4cjs.cyclePaletteColor; exports.decimateChartPoints = _chunkGTZXF4BIcjs.decimateChartPoints; exports.defaultChartAxis = _chunkJOX6MJW4cjs.defaultChartAxis; exports.describeChart = _chunkGTZXF4BIcjs.describeChart; exports.describeChartSelection = describeChartSelection; exports.describeOfficeChartPlace = describeOfficeChartPlace; exports.downloadChartPng = downloadChartPng; exports.easeChartTween = easeChartTween; exports.estimateChartTextWidth = _chunkGTZXF4BIcjs.estimateChartTextWidth; exports.extractDocxCharts = extractDocxCharts; exports.extractOfficeCharts = extractOfficeCharts; exports.extractPptxCharts = extractPptxCharts; exports.extractXlsxCharts = extractXlsxCharts; exports.findMermaidCharts = _chunkGTZXF4BIcjs.findMermaidCharts; exports.fitChartTrendline = _chunkGTZXF4BIcjs.fitChartTrendline; exports.formatChartDate = _chunkGTZXF4BIcjs.formatChartDate; exports.formatChartNumber = _chunkGTZXF4BIcjs.formatChartNumber; exports.formatChartValueWithCode = _chunkGTZXF4BIcjs.formatChartValueWithCode; exports.handleChartKey = handleChartKey; exports.isCartesianChart = _chunkJOX6MJW4cjs.isCartesianChart; exports.isXyChart = _chunkJOX6MJW4cjs.isXyChart; exports.layoutChart = _chunkGTZXF4BIcjs.layoutChart; exports.layoutSparkline = _chunkGTZXF4BIcjs.layoutSparkline; exports.linearMap = _chunkGTZXF4BIcjs.linearMap; exports.monochromeChartPalette = _chunkGTZXF4BIcjs.monochromeChartPalette; exports.niceScale = _chunkGTZXF4BIcjs.niceScale; exports.niceStep = _chunkGTZXF4BIcjs.niceStep; exports.normalizeChartAxis = _chunkJOX6MJW4cjs.normalizeChartAxis; exports.normalizeChartSpec = _chunkJOX6MJW4cjs.normalizeChartSpec; exports.normalizeChartTrendline = _chunkJOX6MJW4cjs.normalizeChartTrendline; exports.normalizeChartValues = _chunkJOX6MJW4cjs.normalizeChartValues; exports.parseChartColor = _chunkJOX6MJW4cjs.parseChartColor; exports.parseChartDate = _chunkGTZXF4BIcjs.parseChartDate; exports.parseChartValue = _chunkJOX6MJW4cjs.parseChartValue; exports.parsePartialChartJson = parsePartialChartJson; exports.planChartCommand = planChartCommand; exports.rasterizeChartSvg = rasterizeChartSvg; exports.realChartClock = realChartClock; exports.recommendChartTypes = recommendChartTypes; exports.recommendForShape = recommendForShape; exports.resolveChartSvgPaints = resolveChartSvgPaints; exports.sameChartSelection = _chunkGTZXF4BIcjs.sameChartSelection; exports.shadeChartColor = _chunkJOX6MJW4cjs.shadeChartColor; exports.simulateChartVision = _chunkJOX6MJW4cjs.simulateChartVision; exports.snapChartDragValue = snapChartDragValue; exports.snapChartValue = _chunkGTZXF4BIcjs.snapChartValue; exports.sparklineToSvg = _chunkGTZXF4BIcjs.sparklineToSvg; exports.startChartPointDrag = startChartPointDrag; exports.stepDecimals = _chunkGTZXF4BIcjs.stepDecimals; exports.summarizeChart = _chunkGTZXF4BIcjs.summarizeChart; exports.summarizeChartSeries = _chunkGTZXF4BIcjs.summarizeChartSeries; exports.trendNumberText = _chunkGTZXF4BIcjs.trendNumberText; exports.uniqueChartSeriesId = _chunkJOX6MJW4cjs.uniqueChartSeriesId;
1803
2256
  //# sourceMappingURL=index.cjs.map