@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
@@ -1,7 +1,8 @@
1
- import { C as ChartNumberFormat, a as ChartValue, b as ChartRect, c as ChartScene, d as ChartSpec, e as ChartLayoutOptions, f as ChartWarning, g as ChartAxis, h as ChartLegend, i as ChartType, j as ChartStacking, k as ChartSeries, l as ChartIssue, m as ChartController, n as ChartValueScale, o as ChartSelection, p as ChartSpecPatch } from '../controller-ChjCCMLl.cjs';
2
- export { q as CHART_AXIS_KINDS, r as CHART_CURVES, s as CHART_LABEL_POSITIONS, t as CHART_LEGEND_POSITIONS, u as CHART_MARKERS, v as CHART_NUMBER_STYLES, w as CHART_ORIENTATIONS, x as CHART_SERIES_TYPES, y as CHART_STACKINGS, z as CHART_TRENDLINE_TYPES, A as CHART_TYPES, B as CHART_TYPE_LABELS, D as CSS_VARIABLE_CHART_THEME, E as ChartActionResult, F as ChartCircleMark, G as ChartControllerOptions, H as ChartCurve, I as ChartDomSpec, J as ChartEditOptions, K as ChartFamily, L as ChartLabelPosition, M as ChartLegendPosition, N as ChartLineMark, O as ChartMark, P as ChartMarkRole, Q as ChartMarker, R as ChartOrientation, S as ChartPathMark, T as ChartRectMark, U as ChartSeriesInput, V as ChartSeriesPatch, W as ChartSeriesType, X as ChartSparklineKind, Y as ChartSparklineOptions, Z as ChartState, _ as ChartSvgOptions, $ as ChartTableData, a0 as ChartTableOptions, a1 as ChartTextMark, a2 as ChartTextMeasure, a3 as ChartTheme, a4 as ChartTrendFit, a5 as ChartTrendline, a6 as ChartTrendlineType, a7 as DEFAULT_CHART_PALETTE, a8 as DEFAULT_CHART_THEME, a9 as chartColorInputValue, aa as chartColorsByCategory, ab as chartDataFromTable, ac as chartDataToTable, ad as chartFamily, ae as chartMovingAverage, af as chartPointColor, ag as chartSceneToDomSpec, ah as chartSceneToSvg, ai as chartSeriesColor, aj as chartSeriesType, ak as chartSliceColor, al as chartSupportsTrendlines, am as chartTextBaseline, an as chartTextTransform, ao as chartToSvg, ap as chartTrendlineName, aq as cloneChartSeries, ar as cloneChartSpec, as as contrastingTextColor, at as createChartController, au as createChartSpec, av as defaultChartAxis, aw as estimateChartTextWidth, ax as fitChartTrendline, ay as isCartesianChart, az as isXyChart, aA as layoutSparkline, aB as normalizeChartAxis, aC as normalizeChartSpec, aD as normalizeChartTrendline, aE as normalizeChartValues, aF as parseChartValue, aG as sameChartSelection, aH as sparklineToSvg, aI as trendNumberText, aJ as uniqueChartSeriesId } from '../controller-ChjCCMLl.cjs';
1
+ import { C as ChartNumberFormat, a as ChartValue, b as ChartRect, c as ChartScene, d as ChartSpec, e as ChartLayoutOptions, f as ChartTheme, g as ChartWarning, h as ChartAxis, i as ChartLegend, j as ChartType, k as ChartStacking, l as ChartSeries, m as ChartIssue, n as ChartController, o as ChartValueScale, p as ChartSelection, q as ChartSpecPatch } from '../controller-DS3drIvy.cjs';
2
+ export { r as CHART_AXIS_KINDS, s as CHART_CURVES, t as CHART_LABEL_POSITIONS, u as CHART_LEGEND_POSITIONS, v as CHART_MARKERS, w as CHART_NUMBER_STYLES, x as CHART_ORIENTATIONS, y as CHART_SERIES_TYPES, z as CHART_STACKINGS, A as CHART_TRENDLINE_TYPES, B as CHART_TYPES, D as CHART_TYPE_LABELS, E as CSS_VARIABLE_CHART_THEME, F as ChartActionResult, G as ChartCircleMark, H as ChartControllerOptions, I as ChartCurve, J as ChartDomSpec, K as ChartEditOptions, L as ChartFamily, M as ChartLabelPosition, N as ChartLegendPosition, O as ChartLineMark, P as ChartMark, Q as ChartMarkRole, R as ChartMarker, S as ChartOrientation, T as ChartPathMark, U as ChartRectMark, V as ChartSeriesInput, W as ChartSeriesPatch, X as ChartSeriesType, Y as ChartSparklineKind, Z as ChartSparklineOptions, _ as ChartState, $ as ChartSvgOptions, a0 as ChartTableData, a1 as ChartTableOptions, a2 as ChartTextMark, a3 as ChartTextMeasure, a4 as ChartTrendFit, a5 as ChartTrendline, a6 as ChartTrendlineType, a7 as DEFAULT_CHART_PALETTE, a8 as DEFAULT_CHART_THEME, a9 as chartColorInputValue, aa as chartColorsByCategory, ab as chartDataFromTable, ac as chartDataToTable, ad as chartFamily, ae as chartMovingAverage, af as chartPointColor, ag as chartSceneToDomSpec, ah as chartSceneToSvg, ai as chartSeriesColor, aj as chartSeriesType, ak as chartSliceColor, al as chartSupportsTrendlines, am as chartTextBaseline, an as chartTextTransform, ao as chartToSvg, ap as chartTrendlineName, aq as cloneChartSeries, ar as cloneChartSpec, as as contrastingTextColor, at as createChartController, au as createChartSpec, av as defaultChartAxis, aw as estimateChartTextWidth, ax as fitChartTrendline, ay as isCartesianChart, az as isXyChart, aA as layoutSparkline, aB as normalizeChartAxis, aC as normalizeChartSpec, aD as normalizeChartTrendline, aE as normalizeChartValues, aF as parseChartValue, aG as sameChartSelection, aH as sparklineToSvg, aI as trendNumberText, aJ as uniqueChartSeriesId } from '../controller-DS3drIvy.cjs';
3
3
  import { C as CommandSpec } from '../registry-CaR7LC6W.cjs';
4
4
  import { A as AgentToolProvider } from '../registry-B4l-lYts.cjs';
5
+ import { Z as ZipReadOptions } from '../zip-4nG0YAH7.cjs';
5
6
  import '../HistoryManager-DeQQMBCj.cjs';
6
7
  import '../types-DsiXGmjo.cjs';
7
8
  import '../schema-Di0CS6Pe.cjs';
@@ -287,6 +288,86 @@ declare const MAX_CHART_LINE_POINTS = 2000;
287
288
  /** Markers beyond this many are thinned to one per 2px cell. */
288
289
  declare const MAX_CHART_MARKERS = 1000;
289
290
 
291
+ /** Longest side, in pixels, of a rasterized chart unless `maxSize` says otherwise. */
292
+ declare const CHART_RASTER_MAX_SIZE = 1024;
293
+ interface ChartPaintScope {
294
+ /**
295
+ * Element whose CSS variables, `color` and `font-family` stand in for `var(--x)`,
296
+ * `currentColor` and `inherit` (default: the document's root element). Pass the chart's
297
+ * container when its theme is scoped (e.g. a `.dark` wrapper).
298
+ */
299
+ scope?: Element | null;
300
+ /** Looks up a custom property (`--name`) instead of `getComputedStyle(scope)`. Return '' when unset. */
301
+ lookup?: (name: string) => string;
302
+ }
303
+ interface RasterizeChartOptions extends ChartPaintScope {
304
+ /** Size of the chart in CSS pixels (the SVG's own size). */
305
+ width: number;
306
+ height: number;
307
+ /** Pixels per CSS pixel (default 2), reduced so the longest side stays within `maxSize`. */
308
+ scale?: number;
309
+ /** Longest side of the image in pixels (default 1024). */
310
+ maxSize?: number;
311
+ /** Fill behind the chart (default white; `transparent` keeps the alpha channel). */
312
+ background?: string;
313
+ /** Document to create the canvas and image in (default: the global one). */
314
+ document?: Document;
315
+ }
316
+ interface ChartRasterImage {
317
+ /** Base64 PNG, without the `data:` prefix. */
318
+ data: string;
319
+ mimeType: 'image/png';
320
+ /** Size of the image in pixels. */
321
+ width: number;
322
+ height: number;
323
+ }
324
+ /** Pixel size of the image for a chart of `width` × `height` CSS pixels: `scale` × the size, longest side ≤ `maxSize`. */
325
+ declare function chartRasterSize(width: number, height: number, scale?: number, maxSize?: number): {
326
+ width: number;
327
+ height: number;
328
+ scale: number;
329
+ };
330
+ /**
331
+ * Makes a chart SVG drawable on its own (as an `<img>` or on a canvas, where the page's CSS
332
+ * does not apply): `var(--x, fallback)` becomes the variable's value on `scope` (or the
333
+ * fallback), `currentColor` the scope's colour and `font-family="inherit"` its font. An
334
+ * attribute left empty is dropped, so the renderer's default applies instead of an invalid
335
+ * paint. Text content is left alone.
336
+ */
337
+ declare function resolveChartSvgPaints(svg: string, options?: ChartPaintScope): string;
338
+ /**
339
+ * Turns a chart SVG (from `chartToSvg`, `chartSceneToSvg` or a live chart's `<svg>`) into a
340
+ * PNG in the browser: resolves CSS-variable paints first (see `resolveChartSvgPaints`, without
341
+ * which they draw black), draws it through an `Image` onto a canvas at `scale` (longest side
342
+ * ≤ `maxSize`, default 1024) over `background`, and returns base64 data. Throws a message
343
+ * saying what to do instead when there is no DOM or canvas.
344
+ */
345
+ declare function rasterizeChartSvg(svg: string, options: RasterizeChartOptions): Promise<ChartRasterImage>;
346
+ /**
347
+ * A `rasterize` function for `createChartToolProvider` (so `render_chart { format: "png" }`
348
+ * works), or `undefined` when there is no DOM to draw with. The React and Svelte
349
+ * `useChartToolProvider` pass one by default.
350
+ */
351
+ declare function createChartRasterizer(options?: Omit<RasterizeChartOptions, 'width' | 'height'>): ((svg: string, size: {
352
+ width: number;
353
+ height: number;
354
+ }) => Promise<ChartRasterImage>) | undefined;
355
+ interface DownloadChartPngOptions extends Omit<RasterizeChartOptions, 'width' | 'height'> {
356
+ /** Chart size in CSS pixels (default 800 × 450). */
357
+ width?: number;
358
+ height?: number;
359
+ /** File name (default: the chart title, else `chart`, plus `.png`). */
360
+ filename?: string;
361
+ /** Colours and type (default: the light default theme, with concrete colours). */
362
+ theme?: Partial<ChartTheme>;
363
+ }
364
+ /** A file name for a chart: its title in lower case with dashes, else `chart`, plus the extension. */
365
+ declare function chartFileName(spec: Pick<ChartSpec, 'title'>, extension: string): string;
366
+ /** Renders a chart to PNG (see `rasterizeChartSvg`) and saves it through a download link. Returns the image and the file name. */
367
+ declare function downloadChartPng(spec: ChartSpec, options?: DownloadChartPngOptions): Promise<ChartRasterImage & {
368
+ filename: string;
369
+ }>;
370
+
290
371
  interface ChartSummary {
291
372
  type: ChartSpec['type'];
292
373
  title: string;
@@ -604,12 +685,12 @@ declare function findMermaidCharts(text: string): FoundChartMermaid[];
604
685
  declare const CHART_OOXML_NS = "http://schemas.openxmlformats.org/drawingml/2006/chart";
605
686
  declare const CHART_OOXML_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
606
687
  declare const CHART_OOXML_RELATIONSHIP = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart";
607
- type ParserCtor$1 = {
688
+ type ParserCtor$3 = {
608
689
  new (): DOMParser;
609
690
  };
610
691
  interface ChartOoxmlReadOptions {
611
692
  /** `DOMParser` constructor (default: the global one; pass jsdom's or xmldom's in Node). */
612
- DOMParser?: ParserCtor$1;
693
+ DOMParser?: ParserCtor$3;
613
694
  }
614
695
  interface ChartOoxmlReadResult {
615
696
  spec: ChartSpec;
@@ -783,7 +864,7 @@ declare class ChartDirector {
783
864
  private performOne;
784
865
  }
785
866
 
786
- type ParserCtor = {
867
+ type ParserCtor$2 = {
787
868
  new (): DOMParser;
788
869
  };
789
870
  interface ChartToolProviderOptions {
@@ -802,7 +883,7 @@ interface ChartToolProviderOptions {
802
883
  height: number;
803
884
  };
804
885
  /** Enables `import_chart_ooxml` (reading Office chart XML needs a DOMParser). Default: the global one, if any. */
805
- DOMParser?: ParserCtor;
886
+ DOMParser?: ParserCtor$2;
806
887
  /**
807
888
  * Acts out `set_chart_values` and `select_chart_element` with a visible cursor (see
808
889
  * `ChartDirector`); each call is still one undo step. Without it, edits apply at once.
@@ -822,6 +903,11 @@ interface ChartToolProviderOptions {
822
903
  mimeType: string;
823
904
  };
824
905
  }
906
+ /**
907
+ * When to look at the chart, for `render_chart`'s description (after vectorcraft's
908
+ * `render_preview` and Ursula's VIEW_DIAGRAM_INSTRUCTIONS).
909
+ */
910
+ declare const 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.";
825
911
  /**
826
912
  * Agent tools for a chart editor, for a `ToolRegistry`: one tool per operation with strict
827
913
  * schemas. Reads (`get_chart`, `render_chart`, `check_chart_colors`, `recommend_chart`,
@@ -877,4 +963,105 @@ declare function blendChartScenes(from: ChartScene | null, to: ChartScene, t: nu
877
963
  /** Ease-out cubic, for tweens. */
878
964
  declare const easeChartTween: (t: number) => number;
879
965
 
880
- export { CHART_COLOR_SCHEMES, CHART_DATE_STEPS, CHART_LAYOUT_PRESETS, CHART_MERMAID_META_PREFIX, CHART_OOXML_CONTENT_TYPE, CHART_OOXML_NS, CHART_OOXML_RELATIONSHIP, CHART_PALETTE_SHADES, CHART_PRESENCE_COLORS, type ChartAgentCommand, ChartAxis, type ChartBoxStats, type ChartClock, type ChartColorCheck, type ChartColorCheckOptions, type ChartColorPair, type ChartColorScheme, type ChartCommandOptions, ChartController, type ChartDateLabels, type ChartDateStep, ChartDirector, type ChartDirectorActor, type ChartDirectorOptions, type ChartDragMoveOptions, type ChartFormatCode, type ChartFromTable, type ChartHistogramBin, ChartIssue, type ChartKeyInput, ChartLayoutOptions, type ChartLayoutPreset, ChartLegend, type ChartMermaidFamily, type ChartMermaidOptions, type ChartMermaidParseOptions, type ChartMermaidResult, ChartNumberFormat, type ChartOoxmlReadOptions, type ChartOoxmlReadResult, type ChartOoxmlWriteResult, type ChartPerformanceResult, type ChartPerformanceStep, type ChartPointDrag, ChartPresence, type ChartPresenceActor, type ChartPresenceState, type ChartPresetPatch, type ChartRecommendation, ChartRect, type ChartRgb, ChartScene, ChartSelection, ChartSeries, type ChartSeriesSummary, type ChartSnapOptions, ChartSpec, ChartSpecPatch, ChartStacking, ChartStream, type ChartStreamFormat, type ChartStreamResult, type ChartSummary, type ChartTableShape, type ChartToolProviderOptions, ChartType, ChartValue, ChartValueScale, type ChartVision, ChartWarning, type FoundChartMermaid, MAX_CHART_DATA_LABELS, MAX_CHART_LINE_POINTS, MAX_CHART_MARKERS, type NiceScale, analyzeChartTable, blendChartScenes, canDragChartPoint, chartBoxStats, chartClientToScene, chartColorDistance, chartContrastRatio, chartDateLabels, chartDateToSerial, chartFormatToCode, chartFromMermaid, chartFromOoxml, chartFromTable, chartHistogram, chartHitTest, chartLuminance, chartMermaidFamily, chartPointAnchor, chartPresetPatch, chartQuantile, chartRgbToHex, chartRgbToOklab, chartSerialToDate, chartSquarify, chartTextOn, chartToMermaid, chartToOoxml, chartValueAtPoint, chartXAtPoint, checkChartColors, compileChartFormatCode, createChartCommands, createChartToolProvider, createInstantChartClock, cyclePaletteColor, decimateChartPoints, describeChart, describeChartSelection, easeChartTween, findMermaidCharts, formatChartDate, formatChartNumber, formatChartValueWithCode, handleChartKey, layoutChart, linearMap, monochromeChartPalette, niceScale, niceStep, parseChartColor, parseChartDate, parsePartialChartJson, planChartCommand, realChartClock, recommendChartTypes, recommendForShape, shadeChartColor, simulateChartVision, snapChartDragValue, snapChartValue, startChartPointDrag, stepDecimals, summarizeChart, summarizeChartSeries };
966
+ type ParserCtor$1 = {
967
+ new (): DOMParser;
968
+ };
969
+ /** Office files charts can be read from. */
970
+ type OfficeChartFileFormat = 'xlsx' | 'pptx' | 'docx';
971
+ /** A chart found in an Excel workbook, PowerPoint deck or Word document. */
972
+ interface OfficeFileChart {
973
+ /** `chart-1`, `chart-2`, … in file order (sheets, slides or the document body). */
974
+ id: string;
975
+ /** The chart part, e.g. `xl/charts/chart1.xml` or `ppt/charts/chartEx1.xml`. */
976
+ path: string;
977
+ /** `chart` for DrawingML (`c:chartSpace`), `chartex` for Office 2016 charts (`cx:chartSpace`). */
978
+ partKind: 'chart' | 'chartex';
979
+ /** Worksheet or chart sheet name (xlsx). */
980
+ sheet?: string;
981
+ /** 1-based slide number (pptx). */
982
+ slide?: number;
983
+ /** Top-left cell the chart is anchored to, e.g. `B2` (xlsx worksheets). */
984
+ anchor?: string;
985
+ /** The cells the chart covers, e.g. `B2:H18` (xlsx two-cell anchors). */
986
+ range?: string;
987
+ /** The shape name (`cNvPr name`), e.g. `Chart 3`. */
988
+ name?: string;
989
+ /** The chart's title (may be empty). */
990
+ title: string;
991
+ spec: ChartSpec;
992
+ /** Problems reading it, as sentences. */
993
+ issues: string[];
994
+ /** Features the chart editor cannot hold (3-D, stock, …). */
995
+ unsupported: string[];
996
+ /** Writing `spec` back loses nothing. */
997
+ lossless: boolean;
998
+ }
999
+ interface OfficeChartsResult {
1000
+ format: OfficeChartFileFormat;
1001
+ charts: OfficeFileChart[];
1002
+ }
1003
+ interface OfficeChartsReadOptions extends ZipReadOptions {
1004
+ /** `DOMParser` constructor (default: the global one; pass jsdom's or xmldom's in Node). */
1005
+ DOMParser?: ParserCtor$1;
1006
+ /** Stop after this many charts (default 500). */
1007
+ maxCharts?: number;
1008
+ }
1009
+ /** Thrown when the bytes are not a readable Office file of the expected kind. */
1010
+ declare class OfficeChartsError extends Error {
1011
+ constructor(message: string, options?: {
1012
+ cause?: unknown;
1013
+ });
1014
+ }
1015
+ /**
1016
+ * Reads every chart in an Office file, detecting whether it is a workbook (charts on each
1017
+ * worksheet's or chart sheet's drawing, with the sheet name and anchor cell), a presentation
1018
+ * (charts on each slide, with the slide number) or a Word document (charts in the body).
1019
+ * DrawingML and Office 2016 chartex parts are both read with `chartFromOoxml`; data comes
1020
+ * from the cached values. Throws `OfficeChartsError` when the bytes are not an Office file.
1021
+ */
1022
+ declare function extractOfficeCharts(bytes: ArrayBuffer | ArrayBufferView, options?: OfficeChartsReadOptions): Promise<OfficeChartsResult>;
1023
+ /** The charts in an Excel workbook (`xl/drawings/drawingN.xml` → `xl/charts/chartN.xml`), with sheet and anchor cell. */
1024
+ declare const extractXlsxCharts: (bytes: ArrayBuffer | ArrayBufferView, options?: OfficeChartsReadOptions) => Promise<OfficeFileChart[]>;
1025
+ /** The charts in a PowerPoint deck (`p:graphicFrame` → `ppt/charts/chartN.xml`), with their slide number. */
1026
+ declare const extractPptxCharts: (bytes: ArrayBuffer | ArrayBufferView, options?: OfficeChartsReadOptions) => Promise<OfficeFileChart[]>;
1027
+ /** The charts in the body of a Word document (`word/charts/chartN.xml`). */
1028
+ declare const extractDocxCharts: (bytes: ArrayBuffer | ArrayBufferView, options?: OfficeChartsReadOptions) => Promise<OfficeFileChart[]>;
1029
+ /** Where a chart sits, for labels: `Sheet1!B2`, `Slide 3`, `Document`. */
1030
+ declare function describeOfficeChartPlace(chart: OfficeFileChart): string;
1031
+
1032
+ type ParserCtor = {
1033
+ new (): DOMParser;
1034
+ };
1035
+ /** A file the host has opened and lets the agent read charts from. */
1036
+ interface OfficeChartFile {
1037
+ name: string;
1038
+ data: ArrayBuffer | ArrayBufferView;
1039
+ }
1040
+ interface OfficeChartToolProviderOptions {
1041
+ /** Provider id (unique per registry). Default `office-charts`. */
1042
+ id?: string;
1043
+ /** Always prefix tool names with `<namespace>__`. */
1044
+ namespace?: string;
1045
+ /**
1046
+ * Files the user opened. With it, the tools take a `file` name (and `list_open_files` lists
1047
+ * them); without it, they take the file's bytes as base64 `data`.
1048
+ */
1049
+ files?: () => readonly OfficeChartFile[];
1050
+ /** Enables `load_file_chart`, which replaces this chart with one from a file. */
1051
+ controller?: ChartController;
1052
+ /** The chart cannot be edited: `load_file_chart` is hidden. A string is the reason. */
1053
+ readOnly?: boolean | string | (() => boolean | string);
1054
+ /** `DOMParser` constructor (default: the global one). */
1055
+ DOMParser?: ParserCtor;
1056
+ }
1057
+ /**
1058
+ * Agent tools for reading charts out of Office files (`.xlsx`, `.pptx`, `.docx`), for a
1059
+ * `ToolRegistry`. `list_file_charts` lists every chart with where it sits (sheet and anchor
1060
+ * cell, slide number) and its read problems; `get_file_chart` returns one chart's full spec;
1061
+ * with a `controller`, `load_file_chart` replaces that chart editor's chart with one of them
1062
+ * as one undo step. With `files`, the tools address the files the user opened by name
1063
+ * (`list_open_files`); otherwise they take the file as base64.
1064
+ */
1065
+ declare function createOfficeChartToolProvider(options?: OfficeChartToolProviderOptions): AgentToolProvider;
1066
+
1067
+ export { CHART_COLOR_SCHEMES, CHART_DATE_STEPS, CHART_LAYOUT_PRESETS, CHART_MERMAID_META_PREFIX, CHART_OOXML_CONTENT_TYPE, CHART_OOXML_NS, CHART_OOXML_RELATIONSHIP, CHART_PALETTE_SHADES, CHART_PRESENCE_COLORS, CHART_RASTER_MAX_SIZE, type ChartAgentCommand, ChartAxis, type ChartBoxStats, type ChartClock, type ChartColorCheck, type ChartColorCheckOptions, type ChartColorPair, type ChartColorScheme, type ChartCommandOptions, ChartController, type ChartDateLabels, type ChartDateStep, ChartDirector, type ChartDirectorActor, type ChartDirectorOptions, type ChartDragMoveOptions, type ChartFormatCode, type ChartFromTable, type ChartHistogramBin, ChartIssue, type ChartKeyInput, ChartLayoutOptions, type ChartLayoutPreset, ChartLegend, type ChartMermaidFamily, type ChartMermaidOptions, type ChartMermaidParseOptions, type ChartMermaidResult, ChartNumberFormat, type ChartOoxmlReadOptions, type ChartOoxmlReadResult, type ChartOoxmlWriteResult, type ChartPaintScope, type ChartPerformanceResult, type ChartPerformanceStep, type ChartPointDrag, ChartPresence, type ChartPresenceActor, type ChartPresenceState, type ChartPresetPatch, type ChartRasterImage, type ChartRecommendation, ChartRect, type ChartRgb, ChartScene, ChartSelection, ChartSeries, type ChartSeriesSummary, type ChartSnapOptions, ChartSpec, ChartSpecPatch, ChartStacking, ChartStream, type ChartStreamFormat, type ChartStreamResult, type ChartSummary, type ChartTableShape, ChartTheme, type ChartToolProviderOptions, ChartType, ChartValue, ChartValueScale, type ChartVision, ChartWarning, type DownloadChartPngOptions, type FoundChartMermaid, MAX_CHART_DATA_LABELS, MAX_CHART_LINE_POINTS, MAX_CHART_MARKERS, type NiceScale, type OfficeChartFile, type OfficeChartFileFormat, type OfficeChartToolProviderOptions, OfficeChartsError, type OfficeChartsReadOptions, type OfficeChartsResult, type OfficeFileChart, RENDER_CHART_INSTRUCTIONS, type RasterizeChartOptions, analyzeChartTable, blendChartScenes, canDragChartPoint, chartBoxStats, chartClientToScene, chartColorDistance, chartContrastRatio, chartDateLabels, chartDateToSerial, chartFileName, chartFormatToCode, chartFromMermaid, chartFromOoxml, chartFromTable, chartHistogram, chartHitTest, chartLuminance, chartMermaidFamily, chartPointAnchor, chartPresetPatch, chartQuantile, chartRasterSize, chartRgbToHex, chartRgbToOklab, chartSerialToDate, chartSquarify, chartTextOn, chartToMermaid, chartToOoxml, chartValueAtPoint, chartXAtPoint, checkChartColors, compileChartFormatCode, createChartCommands, createChartRasterizer, createChartToolProvider, createInstantChartClock, createOfficeChartToolProvider, cyclePaletteColor, decimateChartPoints, describeChart, describeChartSelection, describeOfficeChartPlace, downloadChartPng, easeChartTween, extractDocxCharts, extractOfficeCharts, extractPptxCharts, extractXlsxCharts, findMermaidCharts, formatChartDate, formatChartNumber, formatChartValueWithCode, handleChartKey, layoutChart, linearMap, monochromeChartPalette, niceScale, niceStep, parseChartColor, parseChartDate, parsePartialChartJson, planChartCommand, rasterizeChartSvg, realChartClock, recommendChartTypes, recommendForShape, resolveChartSvgPaints, shadeChartColor, simulateChartVision, snapChartDragValue, snapChartValue, startChartPointDrag, stepDecimals, summarizeChart, summarizeChartSeries };
@@ -1,7 +1,8 @@
1
- import { C as ChartNumberFormat, a as ChartValue, b as ChartRect, c as ChartScene, d as ChartSpec, e as ChartLayoutOptions, f as ChartWarning, g as ChartAxis, h as ChartLegend, i as ChartType, j as ChartStacking, k as ChartSeries, l as ChartIssue, m as ChartController, n as ChartValueScale, o as ChartSelection, p as ChartSpecPatch } from '../controller-DtbEo3om.js';
2
- export { q as CHART_AXIS_KINDS, r as CHART_CURVES, s as CHART_LABEL_POSITIONS, t as CHART_LEGEND_POSITIONS, u as CHART_MARKERS, v as CHART_NUMBER_STYLES, w as CHART_ORIENTATIONS, x as CHART_SERIES_TYPES, y as CHART_STACKINGS, z as CHART_TRENDLINE_TYPES, A as CHART_TYPES, B as CHART_TYPE_LABELS, D as CSS_VARIABLE_CHART_THEME, E as ChartActionResult, F as ChartCircleMark, G as ChartControllerOptions, H as ChartCurve, I as ChartDomSpec, J as ChartEditOptions, K as ChartFamily, L as ChartLabelPosition, M as ChartLegendPosition, N as ChartLineMark, O as ChartMark, P as ChartMarkRole, Q as ChartMarker, R as ChartOrientation, S as ChartPathMark, T as ChartRectMark, U as ChartSeriesInput, V as ChartSeriesPatch, W as ChartSeriesType, X as ChartSparklineKind, Y as ChartSparklineOptions, Z as ChartState, _ as ChartSvgOptions, $ as ChartTableData, a0 as ChartTableOptions, a1 as ChartTextMark, a2 as ChartTextMeasure, a3 as ChartTheme, a4 as ChartTrendFit, a5 as ChartTrendline, a6 as ChartTrendlineType, a7 as DEFAULT_CHART_PALETTE, a8 as DEFAULT_CHART_THEME, a9 as chartColorInputValue, aa as chartColorsByCategory, ab as chartDataFromTable, ac as chartDataToTable, ad as chartFamily, ae as chartMovingAverage, af as chartPointColor, ag as chartSceneToDomSpec, ah as chartSceneToSvg, ai as chartSeriesColor, aj as chartSeriesType, ak as chartSliceColor, al as chartSupportsTrendlines, am as chartTextBaseline, an as chartTextTransform, ao as chartToSvg, ap as chartTrendlineName, aq as cloneChartSeries, ar as cloneChartSpec, as as contrastingTextColor, at as createChartController, au as createChartSpec, av as defaultChartAxis, aw as estimateChartTextWidth, ax as fitChartTrendline, ay as isCartesianChart, az as isXyChart, aA as layoutSparkline, aB as normalizeChartAxis, aC as normalizeChartSpec, aD as normalizeChartTrendline, aE as normalizeChartValues, aF as parseChartValue, aG as sameChartSelection, aH as sparklineToSvg, aI as trendNumberText, aJ as uniqueChartSeriesId } from '../controller-DtbEo3om.js';
1
+ import { C as ChartNumberFormat, a as ChartValue, b as ChartRect, c as ChartScene, d as ChartSpec, e as ChartLayoutOptions, f as ChartTheme, g as ChartWarning, h as ChartAxis, i as ChartLegend, j as ChartType, k as ChartStacking, l as ChartSeries, m as ChartIssue, n as ChartController, o as ChartValueScale, p as ChartSelection, q as ChartSpecPatch } from '../controller-BdKzaxs2.js';
2
+ export { r as CHART_AXIS_KINDS, s as CHART_CURVES, t as CHART_LABEL_POSITIONS, u as CHART_LEGEND_POSITIONS, v as CHART_MARKERS, w as CHART_NUMBER_STYLES, x as CHART_ORIENTATIONS, y as CHART_SERIES_TYPES, z as CHART_STACKINGS, A as CHART_TRENDLINE_TYPES, B as CHART_TYPES, D as CHART_TYPE_LABELS, E as CSS_VARIABLE_CHART_THEME, F as ChartActionResult, G as ChartCircleMark, H as ChartControllerOptions, I as ChartCurve, J as ChartDomSpec, K as ChartEditOptions, L as ChartFamily, M as ChartLabelPosition, N as ChartLegendPosition, O as ChartLineMark, P as ChartMark, Q as ChartMarkRole, R as ChartMarker, S as ChartOrientation, T as ChartPathMark, U as ChartRectMark, V as ChartSeriesInput, W as ChartSeriesPatch, X as ChartSeriesType, Y as ChartSparklineKind, Z as ChartSparklineOptions, _ as ChartState, $ as ChartSvgOptions, a0 as ChartTableData, a1 as ChartTableOptions, a2 as ChartTextMark, a3 as ChartTextMeasure, a4 as ChartTrendFit, a5 as ChartTrendline, a6 as ChartTrendlineType, a7 as DEFAULT_CHART_PALETTE, a8 as DEFAULT_CHART_THEME, a9 as chartColorInputValue, aa as chartColorsByCategory, ab as chartDataFromTable, ac as chartDataToTable, ad as chartFamily, ae as chartMovingAverage, af as chartPointColor, ag as chartSceneToDomSpec, ah as chartSceneToSvg, ai as chartSeriesColor, aj as chartSeriesType, ak as chartSliceColor, al as chartSupportsTrendlines, am as chartTextBaseline, an as chartTextTransform, ao as chartToSvg, ap as chartTrendlineName, aq as cloneChartSeries, ar as cloneChartSpec, as as contrastingTextColor, at as createChartController, au as createChartSpec, av as defaultChartAxis, aw as estimateChartTextWidth, ax as fitChartTrendline, ay as isCartesianChart, az as isXyChart, aA as layoutSparkline, aB as normalizeChartAxis, aC as normalizeChartSpec, aD as normalizeChartTrendline, aE as normalizeChartValues, aF as parseChartValue, aG as sameChartSelection, aH as sparklineToSvg, aI as trendNumberText, aJ as uniqueChartSeriesId } from '../controller-BdKzaxs2.js';
3
3
  import { C as CommandSpec } from '../registry-rVtFJjRM.js';
4
4
  import { A as AgentToolProvider } from '../registry-CSlH4iUn.js';
5
+ import { Z as ZipReadOptions } from '../zip-4nG0YAH7.js';
5
6
  import '../HistoryManager-DWSLd6Tf.js';
6
7
  import '../types-DsiXGmjo.js';
7
8
  import '../schema-Di0CS6Pe.js';
@@ -287,6 +288,86 @@ declare const MAX_CHART_LINE_POINTS = 2000;
287
288
  /** Markers beyond this many are thinned to one per 2px cell. */
288
289
  declare const MAX_CHART_MARKERS = 1000;
289
290
 
291
+ /** Longest side, in pixels, of a rasterized chart unless `maxSize` says otherwise. */
292
+ declare const CHART_RASTER_MAX_SIZE = 1024;
293
+ interface ChartPaintScope {
294
+ /**
295
+ * Element whose CSS variables, `color` and `font-family` stand in for `var(--x)`,
296
+ * `currentColor` and `inherit` (default: the document's root element). Pass the chart's
297
+ * container when its theme is scoped (e.g. a `.dark` wrapper).
298
+ */
299
+ scope?: Element | null;
300
+ /** Looks up a custom property (`--name`) instead of `getComputedStyle(scope)`. Return '' when unset. */
301
+ lookup?: (name: string) => string;
302
+ }
303
+ interface RasterizeChartOptions extends ChartPaintScope {
304
+ /** Size of the chart in CSS pixels (the SVG's own size). */
305
+ width: number;
306
+ height: number;
307
+ /** Pixels per CSS pixel (default 2), reduced so the longest side stays within `maxSize`. */
308
+ scale?: number;
309
+ /** Longest side of the image in pixels (default 1024). */
310
+ maxSize?: number;
311
+ /** Fill behind the chart (default white; `transparent` keeps the alpha channel). */
312
+ background?: string;
313
+ /** Document to create the canvas and image in (default: the global one). */
314
+ document?: Document;
315
+ }
316
+ interface ChartRasterImage {
317
+ /** Base64 PNG, without the `data:` prefix. */
318
+ data: string;
319
+ mimeType: 'image/png';
320
+ /** Size of the image in pixels. */
321
+ width: number;
322
+ height: number;
323
+ }
324
+ /** Pixel size of the image for a chart of `width` × `height` CSS pixels: `scale` × the size, longest side ≤ `maxSize`. */
325
+ declare function chartRasterSize(width: number, height: number, scale?: number, maxSize?: number): {
326
+ width: number;
327
+ height: number;
328
+ scale: number;
329
+ };
330
+ /**
331
+ * Makes a chart SVG drawable on its own (as an `<img>` or on a canvas, where the page's CSS
332
+ * does not apply): `var(--x, fallback)` becomes the variable's value on `scope` (or the
333
+ * fallback), `currentColor` the scope's colour and `font-family="inherit"` its font. An
334
+ * attribute left empty is dropped, so the renderer's default applies instead of an invalid
335
+ * paint. Text content is left alone.
336
+ */
337
+ declare function resolveChartSvgPaints(svg: string, options?: ChartPaintScope): string;
338
+ /**
339
+ * Turns a chart SVG (from `chartToSvg`, `chartSceneToSvg` or a live chart's `<svg>`) into a
340
+ * PNG in the browser: resolves CSS-variable paints first (see `resolveChartSvgPaints`, without
341
+ * which they draw black), draws it through an `Image` onto a canvas at `scale` (longest side
342
+ * ≤ `maxSize`, default 1024) over `background`, and returns base64 data. Throws a message
343
+ * saying what to do instead when there is no DOM or canvas.
344
+ */
345
+ declare function rasterizeChartSvg(svg: string, options: RasterizeChartOptions): Promise<ChartRasterImage>;
346
+ /**
347
+ * A `rasterize` function for `createChartToolProvider` (so `render_chart { format: "png" }`
348
+ * works), or `undefined` when there is no DOM to draw with. The React and Svelte
349
+ * `useChartToolProvider` pass one by default.
350
+ */
351
+ declare function createChartRasterizer(options?: Omit<RasterizeChartOptions, 'width' | 'height'>): ((svg: string, size: {
352
+ width: number;
353
+ height: number;
354
+ }) => Promise<ChartRasterImage>) | undefined;
355
+ interface DownloadChartPngOptions extends Omit<RasterizeChartOptions, 'width' | 'height'> {
356
+ /** Chart size in CSS pixels (default 800 × 450). */
357
+ width?: number;
358
+ height?: number;
359
+ /** File name (default: the chart title, else `chart`, plus `.png`). */
360
+ filename?: string;
361
+ /** Colours and type (default: the light default theme, with concrete colours). */
362
+ theme?: Partial<ChartTheme>;
363
+ }
364
+ /** A file name for a chart: its title in lower case with dashes, else `chart`, plus the extension. */
365
+ declare function chartFileName(spec: Pick<ChartSpec, 'title'>, extension: string): string;
366
+ /** Renders a chart to PNG (see `rasterizeChartSvg`) and saves it through a download link. Returns the image and the file name. */
367
+ declare function downloadChartPng(spec: ChartSpec, options?: DownloadChartPngOptions): Promise<ChartRasterImage & {
368
+ filename: string;
369
+ }>;
370
+
290
371
  interface ChartSummary {
291
372
  type: ChartSpec['type'];
292
373
  title: string;
@@ -604,12 +685,12 @@ declare function findMermaidCharts(text: string): FoundChartMermaid[];
604
685
  declare const CHART_OOXML_NS = "http://schemas.openxmlformats.org/drawingml/2006/chart";
605
686
  declare const CHART_OOXML_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
606
687
  declare const CHART_OOXML_RELATIONSHIP = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart";
607
- type ParserCtor$1 = {
688
+ type ParserCtor$3 = {
608
689
  new (): DOMParser;
609
690
  };
610
691
  interface ChartOoxmlReadOptions {
611
692
  /** `DOMParser` constructor (default: the global one; pass jsdom's or xmldom's in Node). */
612
- DOMParser?: ParserCtor$1;
693
+ DOMParser?: ParserCtor$3;
613
694
  }
614
695
  interface ChartOoxmlReadResult {
615
696
  spec: ChartSpec;
@@ -783,7 +864,7 @@ declare class ChartDirector {
783
864
  private performOne;
784
865
  }
785
866
 
786
- type ParserCtor = {
867
+ type ParserCtor$2 = {
787
868
  new (): DOMParser;
788
869
  };
789
870
  interface ChartToolProviderOptions {
@@ -802,7 +883,7 @@ interface ChartToolProviderOptions {
802
883
  height: number;
803
884
  };
804
885
  /** Enables `import_chart_ooxml` (reading Office chart XML needs a DOMParser). Default: the global one, if any. */
805
- DOMParser?: ParserCtor;
886
+ DOMParser?: ParserCtor$2;
806
887
  /**
807
888
  * Acts out `set_chart_values` and `select_chart_element` with a visible cursor (see
808
889
  * `ChartDirector`); each call is still one undo step. Without it, edits apply at once.
@@ -822,6 +903,11 @@ interface ChartToolProviderOptions {
822
903
  mimeType: string;
823
904
  };
824
905
  }
906
+ /**
907
+ * When to look at the chart, for `render_chart`'s description (after vectorcraft's
908
+ * `render_preview` and Ursula's VIEW_DIAGRAM_INSTRUCTIONS).
909
+ */
910
+ declare const 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.";
825
911
  /**
826
912
  * Agent tools for a chart editor, for a `ToolRegistry`: one tool per operation with strict
827
913
  * schemas. Reads (`get_chart`, `render_chart`, `check_chart_colors`, `recommend_chart`,
@@ -877,4 +963,105 @@ declare function blendChartScenes(from: ChartScene | null, to: ChartScene, t: nu
877
963
  /** Ease-out cubic, for tweens. */
878
964
  declare const easeChartTween: (t: number) => number;
879
965
 
880
- export { CHART_COLOR_SCHEMES, CHART_DATE_STEPS, CHART_LAYOUT_PRESETS, CHART_MERMAID_META_PREFIX, CHART_OOXML_CONTENT_TYPE, CHART_OOXML_NS, CHART_OOXML_RELATIONSHIP, CHART_PALETTE_SHADES, CHART_PRESENCE_COLORS, type ChartAgentCommand, ChartAxis, type ChartBoxStats, type ChartClock, type ChartColorCheck, type ChartColorCheckOptions, type ChartColorPair, type ChartColorScheme, type ChartCommandOptions, ChartController, type ChartDateLabels, type ChartDateStep, ChartDirector, type ChartDirectorActor, type ChartDirectorOptions, type ChartDragMoveOptions, type ChartFormatCode, type ChartFromTable, type ChartHistogramBin, ChartIssue, type ChartKeyInput, ChartLayoutOptions, type ChartLayoutPreset, ChartLegend, type ChartMermaidFamily, type ChartMermaidOptions, type ChartMermaidParseOptions, type ChartMermaidResult, ChartNumberFormat, type ChartOoxmlReadOptions, type ChartOoxmlReadResult, type ChartOoxmlWriteResult, type ChartPerformanceResult, type ChartPerformanceStep, type ChartPointDrag, ChartPresence, type ChartPresenceActor, type ChartPresenceState, type ChartPresetPatch, type ChartRecommendation, ChartRect, type ChartRgb, ChartScene, ChartSelection, ChartSeries, type ChartSeriesSummary, type ChartSnapOptions, ChartSpec, ChartSpecPatch, ChartStacking, ChartStream, type ChartStreamFormat, type ChartStreamResult, type ChartSummary, type ChartTableShape, type ChartToolProviderOptions, ChartType, ChartValue, ChartValueScale, type ChartVision, ChartWarning, type FoundChartMermaid, MAX_CHART_DATA_LABELS, MAX_CHART_LINE_POINTS, MAX_CHART_MARKERS, type NiceScale, analyzeChartTable, blendChartScenes, canDragChartPoint, chartBoxStats, chartClientToScene, chartColorDistance, chartContrastRatio, chartDateLabels, chartDateToSerial, chartFormatToCode, chartFromMermaid, chartFromOoxml, chartFromTable, chartHistogram, chartHitTest, chartLuminance, chartMermaidFamily, chartPointAnchor, chartPresetPatch, chartQuantile, chartRgbToHex, chartRgbToOklab, chartSerialToDate, chartSquarify, chartTextOn, chartToMermaid, chartToOoxml, chartValueAtPoint, chartXAtPoint, checkChartColors, compileChartFormatCode, createChartCommands, createChartToolProvider, createInstantChartClock, cyclePaletteColor, decimateChartPoints, describeChart, describeChartSelection, easeChartTween, findMermaidCharts, formatChartDate, formatChartNumber, formatChartValueWithCode, handleChartKey, layoutChart, linearMap, monochromeChartPalette, niceScale, niceStep, parseChartColor, parseChartDate, parsePartialChartJson, planChartCommand, realChartClock, recommendChartTypes, recommendForShape, shadeChartColor, simulateChartVision, snapChartDragValue, snapChartValue, startChartPointDrag, stepDecimals, summarizeChart, summarizeChartSeries };
966
+ type ParserCtor$1 = {
967
+ new (): DOMParser;
968
+ };
969
+ /** Office files charts can be read from. */
970
+ type OfficeChartFileFormat = 'xlsx' | 'pptx' | 'docx';
971
+ /** A chart found in an Excel workbook, PowerPoint deck or Word document. */
972
+ interface OfficeFileChart {
973
+ /** `chart-1`, `chart-2`, … in file order (sheets, slides or the document body). */
974
+ id: string;
975
+ /** The chart part, e.g. `xl/charts/chart1.xml` or `ppt/charts/chartEx1.xml`. */
976
+ path: string;
977
+ /** `chart` for DrawingML (`c:chartSpace`), `chartex` for Office 2016 charts (`cx:chartSpace`). */
978
+ partKind: 'chart' | 'chartex';
979
+ /** Worksheet or chart sheet name (xlsx). */
980
+ sheet?: string;
981
+ /** 1-based slide number (pptx). */
982
+ slide?: number;
983
+ /** Top-left cell the chart is anchored to, e.g. `B2` (xlsx worksheets). */
984
+ anchor?: string;
985
+ /** The cells the chart covers, e.g. `B2:H18` (xlsx two-cell anchors). */
986
+ range?: string;
987
+ /** The shape name (`cNvPr name`), e.g. `Chart 3`. */
988
+ name?: string;
989
+ /** The chart's title (may be empty). */
990
+ title: string;
991
+ spec: ChartSpec;
992
+ /** Problems reading it, as sentences. */
993
+ issues: string[];
994
+ /** Features the chart editor cannot hold (3-D, stock, …). */
995
+ unsupported: string[];
996
+ /** Writing `spec` back loses nothing. */
997
+ lossless: boolean;
998
+ }
999
+ interface OfficeChartsResult {
1000
+ format: OfficeChartFileFormat;
1001
+ charts: OfficeFileChart[];
1002
+ }
1003
+ interface OfficeChartsReadOptions extends ZipReadOptions {
1004
+ /** `DOMParser` constructor (default: the global one; pass jsdom's or xmldom's in Node). */
1005
+ DOMParser?: ParserCtor$1;
1006
+ /** Stop after this many charts (default 500). */
1007
+ maxCharts?: number;
1008
+ }
1009
+ /** Thrown when the bytes are not a readable Office file of the expected kind. */
1010
+ declare class OfficeChartsError extends Error {
1011
+ constructor(message: string, options?: {
1012
+ cause?: unknown;
1013
+ });
1014
+ }
1015
+ /**
1016
+ * Reads every chart in an Office file, detecting whether it is a workbook (charts on each
1017
+ * worksheet's or chart sheet's drawing, with the sheet name and anchor cell), a presentation
1018
+ * (charts on each slide, with the slide number) or a Word document (charts in the body).
1019
+ * DrawingML and Office 2016 chartex parts are both read with `chartFromOoxml`; data comes
1020
+ * from the cached values. Throws `OfficeChartsError` when the bytes are not an Office file.
1021
+ */
1022
+ declare function extractOfficeCharts(bytes: ArrayBuffer | ArrayBufferView, options?: OfficeChartsReadOptions): Promise<OfficeChartsResult>;
1023
+ /** The charts in an Excel workbook (`xl/drawings/drawingN.xml` → `xl/charts/chartN.xml`), with sheet and anchor cell. */
1024
+ declare const extractXlsxCharts: (bytes: ArrayBuffer | ArrayBufferView, options?: OfficeChartsReadOptions) => Promise<OfficeFileChart[]>;
1025
+ /** The charts in a PowerPoint deck (`p:graphicFrame` → `ppt/charts/chartN.xml`), with their slide number. */
1026
+ declare const extractPptxCharts: (bytes: ArrayBuffer | ArrayBufferView, options?: OfficeChartsReadOptions) => Promise<OfficeFileChart[]>;
1027
+ /** The charts in the body of a Word document (`word/charts/chartN.xml`). */
1028
+ declare const extractDocxCharts: (bytes: ArrayBuffer | ArrayBufferView, options?: OfficeChartsReadOptions) => Promise<OfficeFileChart[]>;
1029
+ /** Where a chart sits, for labels: `Sheet1!B2`, `Slide 3`, `Document`. */
1030
+ declare function describeOfficeChartPlace(chart: OfficeFileChart): string;
1031
+
1032
+ type ParserCtor = {
1033
+ new (): DOMParser;
1034
+ };
1035
+ /** A file the host has opened and lets the agent read charts from. */
1036
+ interface OfficeChartFile {
1037
+ name: string;
1038
+ data: ArrayBuffer | ArrayBufferView;
1039
+ }
1040
+ interface OfficeChartToolProviderOptions {
1041
+ /** Provider id (unique per registry). Default `office-charts`. */
1042
+ id?: string;
1043
+ /** Always prefix tool names with `<namespace>__`. */
1044
+ namespace?: string;
1045
+ /**
1046
+ * Files the user opened. With it, the tools take a `file` name (and `list_open_files` lists
1047
+ * them); without it, they take the file's bytes as base64 `data`.
1048
+ */
1049
+ files?: () => readonly OfficeChartFile[];
1050
+ /** Enables `load_file_chart`, which replaces this chart with one from a file. */
1051
+ controller?: ChartController;
1052
+ /** The chart cannot be edited: `load_file_chart` is hidden. A string is the reason. */
1053
+ readOnly?: boolean | string | (() => boolean | string);
1054
+ /** `DOMParser` constructor (default: the global one). */
1055
+ DOMParser?: ParserCtor;
1056
+ }
1057
+ /**
1058
+ * Agent tools for reading charts out of Office files (`.xlsx`, `.pptx`, `.docx`), for a
1059
+ * `ToolRegistry`. `list_file_charts` lists every chart with where it sits (sheet and anchor
1060
+ * cell, slide number) and its read problems; `get_file_chart` returns one chart's full spec;
1061
+ * with a `controller`, `load_file_chart` replaces that chart editor's chart with one of them
1062
+ * as one undo step. With `files`, the tools address the files the user opened by name
1063
+ * (`list_open_files`); otherwise they take the file as base64.
1064
+ */
1065
+ declare function createOfficeChartToolProvider(options?: OfficeChartToolProviderOptions): AgentToolProvider;
1066
+
1067
+ export { CHART_COLOR_SCHEMES, CHART_DATE_STEPS, CHART_LAYOUT_PRESETS, CHART_MERMAID_META_PREFIX, CHART_OOXML_CONTENT_TYPE, CHART_OOXML_NS, CHART_OOXML_RELATIONSHIP, CHART_PALETTE_SHADES, CHART_PRESENCE_COLORS, CHART_RASTER_MAX_SIZE, type ChartAgentCommand, ChartAxis, type ChartBoxStats, type ChartClock, type ChartColorCheck, type ChartColorCheckOptions, type ChartColorPair, type ChartColorScheme, type ChartCommandOptions, ChartController, type ChartDateLabels, type ChartDateStep, ChartDirector, type ChartDirectorActor, type ChartDirectorOptions, type ChartDragMoveOptions, type ChartFormatCode, type ChartFromTable, type ChartHistogramBin, ChartIssue, type ChartKeyInput, ChartLayoutOptions, type ChartLayoutPreset, ChartLegend, type ChartMermaidFamily, type ChartMermaidOptions, type ChartMermaidParseOptions, type ChartMermaidResult, ChartNumberFormat, type ChartOoxmlReadOptions, type ChartOoxmlReadResult, type ChartOoxmlWriteResult, type ChartPaintScope, type ChartPerformanceResult, type ChartPerformanceStep, type ChartPointDrag, ChartPresence, type ChartPresenceActor, type ChartPresenceState, type ChartPresetPatch, type ChartRasterImage, type ChartRecommendation, ChartRect, type ChartRgb, ChartScene, ChartSelection, ChartSeries, type ChartSeriesSummary, type ChartSnapOptions, ChartSpec, ChartSpecPatch, ChartStacking, ChartStream, type ChartStreamFormat, type ChartStreamResult, type ChartSummary, type ChartTableShape, ChartTheme, type ChartToolProviderOptions, ChartType, ChartValue, ChartValueScale, type ChartVision, ChartWarning, type DownloadChartPngOptions, type FoundChartMermaid, MAX_CHART_DATA_LABELS, MAX_CHART_LINE_POINTS, MAX_CHART_MARKERS, type NiceScale, type OfficeChartFile, type OfficeChartFileFormat, type OfficeChartToolProviderOptions, OfficeChartsError, type OfficeChartsReadOptions, type OfficeChartsResult, type OfficeFileChart, RENDER_CHART_INSTRUCTIONS, type RasterizeChartOptions, analyzeChartTable, blendChartScenes, canDragChartPoint, chartBoxStats, chartClientToScene, chartColorDistance, chartContrastRatio, chartDateLabels, chartDateToSerial, chartFileName, chartFormatToCode, chartFromMermaid, chartFromOoxml, chartFromTable, chartHistogram, chartHitTest, chartLuminance, chartMermaidFamily, chartPointAnchor, chartPresetPatch, chartQuantile, chartRasterSize, chartRgbToHex, chartRgbToOklab, chartSerialToDate, chartSquarify, chartTextOn, chartToMermaid, chartToOoxml, chartValueAtPoint, chartXAtPoint, checkChartColors, compileChartFormatCode, createChartCommands, createChartRasterizer, createChartToolProvider, createInstantChartClock, createOfficeChartToolProvider, cyclePaletteColor, decimateChartPoints, describeChart, describeChartSelection, describeOfficeChartPlace, downloadChartPng, easeChartTween, extractDocxCharts, extractOfficeCharts, extractPptxCharts, extractXlsxCharts, findMermaidCharts, formatChartDate, formatChartNumber, formatChartValueWithCode, handleChartKey, layoutChart, linearMap, monochromeChartPalette, niceScale, niceStep, parseChartColor, parseChartDate, parsePartialChartJson, planChartCommand, rasterizeChartSvg, realChartClock, recommendChartTypes, recommendForShape, resolveChartSvgPaints, shadeChartColor, simulateChartVision, snapChartDragValue, snapChartValue, startChartPointDrag, stepDecimals, summarizeChart, summarizeChartSeries };