@pixerate/editor 0.80.0 → 0.82.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 (107) hide show
  1. package/README.md +13 -3
  2. package/dist/agent/index.cjs +138 -13
  3. package/dist/agent/index.cjs.map +1 -1
  4. package/dist/agent/index.d.cts +9 -5
  5. package/dist/agent/index.d.ts +9 -5
  6. package/dist/agent/index.js +144 -19
  7. package/dist/agent/index.js.map +1 -1
  8. package/dist/animation-editor/index.d.cts +1 -1
  9. package/dist/animation-editor/index.d.ts +1 -1
  10. package/dist/bridge/index.d.cts +3 -3
  11. package/dist/bridge/index.d.ts +3 -3
  12. package/dist/{bridge-client-C5dRjrz5.d.ts → bridge-client-CMGfnjTl.d.ts} +1 -1
  13. package/dist/{bridge-client-C5OziCRK.d.cts → bridge-client-VpnICVxP.d.cts} +1 -1
  14. package/dist/{builtins-BKYlHH1s.d.ts → builtins-CV1fDj64.d.ts} +5 -1
  15. package/dist/{builtins-1kqwLUnb.d.cts → builtins-c4w0eAYl.d.cts} +5 -1
  16. package/dist/canvas/index.cjs +235 -104
  17. package/dist/canvas/index.cjs.map +1 -1
  18. package/dist/canvas/index.d.cts +59 -1
  19. package/dist/canvas/index.d.ts +59 -1
  20. package/dist/canvas/index.js +234 -103
  21. package/dist/canvas/index.js.map +1 -1
  22. package/dist/capture-DFEMFmVt.d.cts +133 -0
  23. package/dist/capture-wwNGaW05.d.ts +133 -0
  24. package/dist/chart/index.d.cts +1 -1
  25. package/dist/chart/index.d.ts +1 -1
  26. package/dist/{chunk-2CJ3LPYQ.js → chunk-424H3P4I.js} +13 -295
  27. package/dist/chunk-424H3P4I.js.map +1 -0
  28. package/dist/{chunk-K73CKYUM.cjs → chunk-EI2MOVQ3.cjs} +198 -3
  29. package/dist/chunk-EI2MOVQ3.cjs.map +1 -0
  30. package/dist/chunk-FURT6ZFZ.cjs +1 -0
  31. package/dist/chunk-FURT6ZFZ.cjs.map +1 -0
  32. package/dist/{chunk-GPWNYQ7R.js → chunk-O2W2SP3C.js} +197 -2
  33. package/dist/chunk-O2W2SP3C.js.map +1 -0
  34. package/dist/{chunk-UN33YOXW.cjs → chunk-PA5S7KPC.cjs} +293 -2
  35. package/dist/chunk-PA5S7KPC.cjs.map +1 -0
  36. package/dist/{chunk-IB3ZHQAX.js → chunk-PTYWCFFW.js} +29 -4
  37. package/dist/chunk-PTYWCFFW.js.map +1 -0
  38. package/dist/{chunk-JQ3BB3E6.js → chunk-PXDEFEG2.js} +293 -2
  39. package/dist/chunk-PXDEFEG2.js.map +1 -0
  40. package/dist/chunk-REOJJIY3.js +201 -0
  41. package/dist/chunk-REOJJIY3.js.map +1 -0
  42. package/dist/chunk-RJ2BFKEN.js +1 -0
  43. package/dist/chunk-RJ2BFKEN.js.map +1 -0
  44. package/dist/{chunk-YU4WQE5M.cjs → chunk-TAPXWP2B.cjs} +95 -377
  45. package/dist/chunk-TAPXWP2B.cjs.map +1 -0
  46. package/dist/{chunk-HXDMZQTD.cjs → chunk-TPOT575P.cjs} +29 -4
  47. package/dist/{chunk-IB3ZHQAX.js.map → chunk-TPOT575P.cjs.map} +1 -1
  48. package/dist/chunk-VJUVNERT.cjs +201 -0
  49. package/dist/chunk-VJUVNERT.cjs.map +1 -0
  50. package/dist/commands/index.cjs +2 -2
  51. package/dist/commands/index.d.cts +2 -2
  52. package/dist/commands/index.d.ts +2 -2
  53. package/dist/commands/index.js +1 -1
  54. package/dist/diagram/index.d.cts +1 -1
  55. package/dist/diagram/index.d.ts +1 -1
  56. package/dist/dom-capture-7Wvf6Tyg.d.ts +59 -0
  57. package/dist/dom-capture-GyYuE-zq.d.cts +59 -0
  58. package/dist/generation/index.cjs +932 -791
  59. package/dist/generation/index.cjs.map +1 -1
  60. package/dist/generation/index.d.cts +268 -242
  61. package/dist/generation/index.d.ts +268 -242
  62. package/dist/generation/index.js +926 -785
  63. package/dist/generation/index.js.map +1 -1
  64. package/dist/image-editor/index.cjs +362 -2
  65. package/dist/image-editor/index.cjs.map +1 -1
  66. package/dist/image-editor/index.d.cts +35 -2
  67. package/dist/image-editor/index.d.ts +35 -2
  68. package/dist/image-editor/index.js +361 -1
  69. package/dist/image-editor/index.js.map +1 -1
  70. package/dist/index.cjs +3 -3
  71. package/dist/index.cjs.map +1 -1
  72. package/dist/index.js +16 -16
  73. package/dist/{registry-DIpIaCkH.d.cts → registry-BqA1AZt0.d.cts} +1 -1
  74. package/dist/{registry-7AZFuand.d.ts → registry-D-4fit9C.d.ts} +1 -1
  75. package/dist/spreadsheet/index.cjs +3 -3
  76. package/dist/spreadsheet/index.cjs.map +1 -1
  77. package/dist/spreadsheet/index.js +16 -16
  78. package/dist/tools/index.cjs +33 -4
  79. package/dist/tools/index.cjs.map +1 -1
  80. package/dist/tools/index.d.cts +4 -2
  81. package/dist/tools/index.d.ts +4 -2
  82. package/dist/tools/index.js +43 -14
  83. package/dist/video-editor/index.d.cts +1 -1
  84. package/dist/video-editor/index.d.ts +1 -1
  85. package/package.json +2 -1
  86. package/skills/README.md +55 -0
  87. package/skills/pixerate-agent-tools/SKILL.md +75 -0
  88. package/skills/pixerate-animation-editor/SKILL.md +155 -0
  89. package/skills/pixerate-animation-editor/references/commands.md +123 -0
  90. package/skills/pixerate-canvas/SKILL.md +231 -0
  91. package/skills/pixerate-chart/SKILL.md +190 -0
  92. package/skills/pixerate-diagram/SKILL.md +134 -0
  93. package/skills/pixerate-generation/SKILL.md +109 -0
  94. package/skills/pixerate-image-editor/SKILL.md +140 -0
  95. package/skills/pixerate-parameters/SKILL.md +83 -0
  96. package/skills/pixerate-rich-text/SKILL.md +160 -0
  97. package/skills/pixerate-spreadsheet/SKILL.md +146 -0
  98. package/skills/pixerate-vector/SKILL.md +191 -0
  99. package/skills/pixerate-vector/references/commands.md +138 -0
  100. package/skills/pixerate-video-editor/SKILL.md +173 -0
  101. package/dist/chunk-2CJ3LPYQ.js.map +0 -1
  102. package/dist/chunk-GPWNYQ7R.js.map +0 -1
  103. package/dist/chunk-HXDMZQTD.cjs.map +0 -1
  104. package/dist/chunk-JQ3BB3E6.js.map +0 -1
  105. package/dist/chunk-K73CKYUM.cjs.map +0 -1
  106. package/dist/chunk-UN33YOXW.cjs.map +0 -1
  107. package/dist/chunk-YU4WQE5M.cjs.map +0 -1
@@ -0,0 +1,133 @@
1
+ import { A as AgentTool, a as AgentToolProvider } from './registry-BqA1AZt0.cjs';
2
+ import { J as JsonSchema } from './schema-Di0CS6Pe.cjs';
3
+
4
+ /** A rectangle in a surface's own units (canvas units, image pixels, CSS pixels). */
5
+ interface CaptureRect {
6
+ x: number;
7
+ y: number;
8
+ width: number;
9
+ height: number;
10
+ }
11
+ /**
12
+ * What to capture: what is on screen (`viewport`), everything (`content`), the
13
+ * selection, the bounds of some items by id (the surface's `items.region`,
14
+ * e.g. `nodes`), or an explicit `rect`.
15
+ */
16
+ type CaptureRegion = 'viewport' | 'content' | 'selection' | 'rect' | (string & {});
17
+ type CaptureFormat = 'png' | 'jpeg';
18
+ /** What a surface is asked to draw. */
19
+ interface CaptureRenderRequest {
20
+ /** Region name the agent asked for. */
21
+ region: CaptureRegion;
22
+ /** The area to draw, in surface units. */
23
+ rect: CaptureRect;
24
+ /** Output size in pixels. */
25
+ width: number;
26
+ height: number;
27
+ /** Output pixels per surface unit (`width / rect.width`). */
28
+ scale: number;
29
+ format: CaptureFormat;
30
+ /** JPEG quality, 0-1. */
31
+ quality: number;
32
+ /** Draw selection boxes, presence cursors and other transient overlays too. */
33
+ includeOverlays: boolean;
34
+ signal?: AbortSignal;
35
+ }
36
+ /** A rendered image: base64 data with its MIME type, or a `data:` URL. */
37
+ type CapturedImage = {
38
+ data: string;
39
+ mimeType: string;
40
+ } | string;
41
+ /**
42
+ * Something an agent can take a screenshot of. Bounds are in the surface's
43
+ * own units; `render` draws a rectangle of it at a given pixel size.
44
+ */
45
+ interface CaptureSurface {
46
+ /** Name of the coordinate space, used in the tool description and results (e.g. `canvas units`). */
47
+ units: string;
48
+ /** What is on screen now. Omit when the surface has no viewport. */
49
+ viewport?: () => CaptureRect | null;
50
+ /** Bounds of everything, or `null` when the surface is empty. */
51
+ content: () => CaptureRect | null;
52
+ /** Bounds of the selection (`null` when nothing is selected) and the selected ids. */
53
+ selection?: () => {
54
+ rect: CaptureRect | null;
55
+ ids?: string[];
56
+ };
57
+ /** Capture by item ids, e.g. canvas nodes. */
58
+ items?: {
59
+ /** Region name, e.g. `nodes`. */
60
+ region: string;
61
+ /** Singular noun for messages, e.g. `node`. */
62
+ noun: string;
63
+ /** Where the ids come from, for error messages (e.g. `get_editor_state`). */
64
+ source?: string;
65
+ /** Bounds of the found items and the ids that were not found. */
66
+ bounds: (ids: string[]) => {
67
+ rect: CaptureRect | null;
68
+ missing: string[];
69
+ };
70
+ };
71
+ /** Describes the overlays `includeOverlays` adds; omit when the surface has none. */
72
+ overlays?: string;
73
+ /** Largest output pixels per surface unit (default 2). */
74
+ maxScale?: number;
75
+ render: (request: CaptureRenderRequest) => CapturedImage | Promise<CapturedImage>;
76
+ }
77
+ interface CaptureToolOptions {
78
+ /** Tool name (default `capture_view`). */
79
+ name?: string;
80
+ /** Tool title (default `Capture a screenshot`). */
81
+ title?: string;
82
+ /** What is being captured, for the description (default `the view`). */
83
+ subject?: string;
84
+ /** Longest output side when the agent passes no `maxEdge` (default 1024). */
85
+ defaultMaxEdge?: number;
86
+ /** Margin around `content`, `selection` and item regions when the agent passes no `padding` (default 16 units). */
87
+ defaultPadding?: number;
88
+ }
89
+ interface CaptureToolProviderOptions extends CaptureToolOptions {
90
+ /** Provider id (unique per registry, default `capture`). */
91
+ id?: string;
92
+ /** Always prefix tool names with `<namespace>__`. */
93
+ namespace?: string;
94
+ }
95
+ /** Bounds of the capture: union of rects, `null` for none. */
96
+ declare function unionCaptureRects(rects: readonly (CaptureRect | null | undefined)[]): CaptureRect | null;
97
+ /**
98
+ * Output pixel size for `rect`: the longest side at most `maxEdge`, never more
99
+ * than `maxScale` pixels per unit, at least 1 × 1.
100
+ */
101
+ declare function captureOutputSize(rect: CaptureRect, maxEdge: number, maxScale?: number): {
102
+ width: number;
103
+ height: number;
104
+ scale: number;
105
+ };
106
+ /** Splits a `data:` URL or plain base64 into base64 data and MIME type. */
107
+ declare function toCapturedImageData(image: CapturedImage, fallbackMimeType: string): {
108
+ data: string;
109
+ mimeType: string;
110
+ };
111
+ /** JSON Schema of the capture tool's arguments for a surface (only the options it supports). */
112
+ declare function captureInputSchema(surface: CaptureSurface, options?: CaptureToolOptions): JsonSchema & {
113
+ type: 'object';
114
+ };
115
+ /**
116
+ * Works out the rectangle and pixel size for a capture call, checking the
117
+ * arguments against the surface. Throws an error that says how to fix the call.
118
+ */
119
+ declare function resolveCaptureRequest(surface: CaptureSurface, args: Record<string, any>, options?: CaptureToolOptions): Omit<CaptureRenderRequest, 'signal'> & {
120
+ ids?: string[];
121
+ };
122
+ /**
123
+ * The `capture_view` agent tool for a surface: renders a region as an image
124
+ * the model can look at. The result has the image and a text block, and
125
+ * `structuredContent` with the captured `rect` (surface units), the pixel
126
+ * size and `scale`, so a point in the image maps back with
127
+ * `x = rect.x + px / scale`.
128
+ */
129
+ declare function createCaptureTool(surface: CaptureSurface, options?: CaptureToolOptions): AgentTool;
130
+ /** A provider with just the `capture_view` tool for a surface. */
131
+ declare function createCaptureToolProvider(surface: CaptureSurface, options?: CaptureToolProviderOptions): AgentToolProvider;
132
+
133
+ export { type CaptureFormat as C, type CapturedImage as a, type CaptureSurface as b, type CaptureRect as c, type CaptureRegion as d, type CaptureRenderRequest as e, type CaptureToolOptions as f, type CaptureToolProviderOptions as g, captureInputSchema as h, captureOutputSize as i, createCaptureTool as j, createCaptureToolProvider as k, resolveCaptureRequest as r, toCapturedImageData as t, unionCaptureRects as u };
@@ -0,0 +1,133 @@
1
+ import { A as AgentTool, a as AgentToolProvider } from './registry-D-4fit9C.js';
2
+ import { J as JsonSchema } from './schema-Di0CS6Pe.js';
3
+
4
+ /** A rectangle in a surface's own units (canvas units, image pixels, CSS pixels). */
5
+ interface CaptureRect {
6
+ x: number;
7
+ y: number;
8
+ width: number;
9
+ height: number;
10
+ }
11
+ /**
12
+ * What to capture: what is on screen (`viewport`), everything (`content`), the
13
+ * selection, the bounds of some items by id (the surface's `items.region`,
14
+ * e.g. `nodes`), or an explicit `rect`.
15
+ */
16
+ type CaptureRegion = 'viewport' | 'content' | 'selection' | 'rect' | (string & {});
17
+ type CaptureFormat = 'png' | 'jpeg';
18
+ /** What a surface is asked to draw. */
19
+ interface CaptureRenderRequest {
20
+ /** Region name the agent asked for. */
21
+ region: CaptureRegion;
22
+ /** The area to draw, in surface units. */
23
+ rect: CaptureRect;
24
+ /** Output size in pixels. */
25
+ width: number;
26
+ height: number;
27
+ /** Output pixels per surface unit (`width / rect.width`). */
28
+ scale: number;
29
+ format: CaptureFormat;
30
+ /** JPEG quality, 0-1. */
31
+ quality: number;
32
+ /** Draw selection boxes, presence cursors and other transient overlays too. */
33
+ includeOverlays: boolean;
34
+ signal?: AbortSignal;
35
+ }
36
+ /** A rendered image: base64 data with its MIME type, or a `data:` URL. */
37
+ type CapturedImage = {
38
+ data: string;
39
+ mimeType: string;
40
+ } | string;
41
+ /**
42
+ * Something an agent can take a screenshot of. Bounds are in the surface's
43
+ * own units; `render` draws a rectangle of it at a given pixel size.
44
+ */
45
+ interface CaptureSurface {
46
+ /** Name of the coordinate space, used in the tool description and results (e.g. `canvas units`). */
47
+ units: string;
48
+ /** What is on screen now. Omit when the surface has no viewport. */
49
+ viewport?: () => CaptureRect | null;
50
+ /** Bounds of everything, or `null` when the surface is empty. */
51
+ content: () => CaptureRect | null;
52
+ /** Bounds of the selection (`null` when nothing is selected) and the selected ids. */
53
+ selection?: () => {
54
+ rect: CaptureRect | null;
55
+ ids?: string[];
56
+ };
57
+ /** Capture by item ids, e.g. canvas nodes. */
58
+ items?: {
59
+ /** Region name, e.g. `nodes`. */
60
+ region: string;
61
+ /** Singular noun for messages, e.g. `node`. */
62
+ noun: string;
63
+ /** Where the ids come from, for error messages (e.g. `get_editor_state`). */
64
+ source?: string;
65
+ /** Bounds of the found items and the ids that were not found. */
66
+ bounds: (ids: string[]) => {
67
+ rect: CaptureRect | null;
68
+ missing: string[];
69
+ };
70
+ };
71
+ /** Describes the overlays `includeOverlays` adds; omit when the surface has none. */
72
+ overlays?: string;
73
+ /** Largest output pixels per surface unit (default 2). */
74
+ maxScale?: number;
75
+ render: (request: CaptureRenderRequest) => CapturedImage | Promise<CapturedImage>;
76
+ }
77
+ interface CaptureToolOptions {
78
+ /** Tool name (default `capture_view`). */
79
+ name?: string;
80
+ /** Tool title (default `Capture a screenshot`). */
81
+ title?: string;
82
+ /** What is being captured, for the description (default `the view`). */
83
+ subject?: string;
84
+ /** Longest output side when the agent passes no `maxEdge` (default 1024). */
85
+ defaultMaxEdge?: number;
86
+ /** Margin around `content`, `selection` and item regions when the agent passes no `padding` (default 16 units). */
87
+ defaultPadding?: number;
88
+ }
89
+ interface CaptureToolProviderOptions extends CaptureToolOptions {
90
+ /** Provider id (unique per registry, default `capture`). */
91
+ id?: string;
92
+ /** Always prefix tool names with `<namespace>__`. */
93
+ namespace?: string;
94
+ }
95
+ /** Bounds of the capture: union of rects, `null` for none. */
96
+ declare function unionCaptureRects(rects: readonly (CaptureRect | null | undefined)[]): CaptureRect | null;
97
+ /**
98
+ * Output pixel size for `rect`: the longest side at most `maxEdge`, never more
99
+ * than `maxScale` pixels per unit, at least 1 × 1.
100
+ */
101
+ declare function captureOutputSize(rect: CaptureRect, maxEdge: number, maxScale?: number): {
102
+ width: number;
103
+ height: number;
104
+ scale: number;
105
+ };
106
+ /** Splits a `data:` URL or plain base64 into base64 data and MIME type. */
107
+ declare function toCapturedImageData(image: CapturedImage, fallbackMimeType: string): {
108
+ data: string;
109
+ mimeType: string;
110
+ };
111
+ /** JSON Schema of the capture tool's arguments for a surface (only the options it supports). */
112
+ declare function captureInputSchema(surface: CaptureSurface, options?: CaptureToolOptions): JsonSchema & {
113
+ type: 'object';
114
+ };
115
+ /**
116
+ * Works out the rectangle and pixel size for a capture call, checking the
117
+ * arguments against the surface. Throws an error that says how to fix the call.
118
+ */
119
+ declare function resolveCaptureRequest(surface: CaptureSurface, args: Record<string, any>, options?: CaptureToolOptions): Omit<CaptureRenderRequest, 'signal'> & {
120
+ ids?: string[];
121
+ };
122
+ /**
123
+ * The `capture_view` agent tool for a surface: renders a region as an image
124
+ * the model can look at. The result has the image and a text block, and
125
+ * `structuredContent` with the captured `rect` (surface units), the pixel
126
+ * size and `scale`, so a point in the image maps back with
127
+ * `x = rect.x + px / scale`.
128
+ */
129
+ declare function createCaptureTool(surface: CaptureSurface, options?: CaptureToolOptions): AgentTool;
130
+ /** A provider with just the `capture_view` tool for a surface. */
131
+ declare function createCaptureToolProvider(surface: CaptureSurface, options?: CaptureToolProviderOptions): AgentToolProvider;
132
+
133
+ export { type CaptureFormat as C, type CapturedImage as a, type CaptureSurface as b, type CaptureRect as c, type CaptureRegion as d, type CaptureRenderRequest as e, type CaptureToolOptions as f, type CaptureToolProviderOptions as g, captureInputSchema as h, captureOutputSize as i, createCaptureTool as j, createCaptureToolProvider as k, resolveCaptureRequest as r, toCapturedImageData as t, unionCaptureRects as u };
@@ -3,7 +3,7 @@ export { z as ChartCircleMark, a as ChartCurve, b as ChartLabelPosition, c as Ch
3
3
  import { C as ChartLayoutOptions, a as ChartController, b as ChartSpecPatch } from '../controller-R2biKk_E.cjs';
4
4
  export { c as CHART_AXIS_KINDS, d as CHART_AXIS_SCALES, e as CHART_CURVES, f as CHART_LABEL_POSITIONS, g as CHART_LEGEND_POSITIONS, h as CHART_MARKERS, i as CHART_NUMBER_STYLES, j as CHART_ORIENTATIONS, k as CHART_SERIES_TYPES, l as CHART_STACKINGS, m as CHART_TRENDLINE_TYPES, n as CHART_TYPES, o as CHART_TYPE_LABELS, p as CSS_VARIABLE_CHART_THEME, q as ChartActionResult, r as ChartControllerOptions, s as ChartDomSpec, t as ChartEditOptions, u as ChartFamily, v as ChartSeriesInput, w as ChartSeriesPatch, x as ChartSparklineKind, y as ChartSparklineOptions, z as ChartState, A as ChartSvgOptions, B as ChartTableData, D as ChartTableOptions, E as ChartTextMeasure, F as ChartTrendFit, G as DEFAULT_CHART_PALETTE, H as DEFAULT_CHART_THEME, I as chartColorInputValue, J as chartColorsByCategory, K as chartDataFromTable, L as chartDataToTable, M as chartFamily, N as chartMovingAverage, O as chartPointColor, P as chartSceneToDomSpec, Q as chartSceneToSvg, R as chartSeriesColor, S as chartSeriesType, T as chartSliceColor, U as chartSupportsTrendlines, V as chartTextBaseline, W as chartTextTransform, X as chartToSvg, Y as chartTrendlineName, Z as cloneChartSeries, _ as cloneChartSpec, $ as contrastingTextColor, a0 as createChartController, a1 as createChartSpec, a2 as defaultChartAxis, a3 as estimateChartTextWidth, a4 as fitChartTrendline, a5 as isCartesianChart, a6 as isXyChart, a7 as layoutSparkline, a8 as normalizeChartAxis, a9 as normalizeChartErrorBars, aa as normalizeChartSpec, ab as normalizeChartTrendline, ac as normalizeChartValues, ad as parseChartValue, ae as sameChartSelection, af as sparklineToSvg, ag as trendNumberText, ah as uniqueChartSeriesId } from '../controller-R2biKk_E.cjs';
5
5
  import { C as CommandSpec } from '../registry-CaR7LC6W.cjs';
6
- import { A as AgentToolProvider } from '../registry-DIpIaCkH.cjs';
6
+ import { a as AgentToolProvider } from '../registry-BqA1AZt0.cjs';
7
7
  import { e as PresenceClock, g as PresenceStore, d as PresenceActorInfo, c as PresenceActor, f as PresenceState, h as createInstantPresenceClock } from '../presence-Cb6WhcrQ.cjs';
8
8
  import { Z as ZipReadOptions } from '../zip-4nG0YAH7.cjs';
9
9
  import '../HistoryManager-DeQQMBCj.cjs';
@@ -3,7 +3,7 @@ export { z as ChartCircleMark, a as ChartCurve, b as ChartLabelPosition, c as Ch
3
3
  import { C as ChartLayoutOptions, a as ChartController, b as ChartSpecPatch } from '../controller-D2rj5umx.js';
4
4
  export { c as CHART_AXIS_KINDS, d as CHART_AXIS_SCALES, e as CHART_CURVES, f as CHART_LABEL_POSITIONS, g as CHART_LEGEND_POSITIONS, h as CHART_MARKERS, i as CHART_NUMBER_STYLES, j as CHART_ORIENTATIONS, k as CHART_SERIES_TYPES, l as CHART_STACKINGS, m as CHART_TRENDLINE_TYPES, n as CHART_TYPES, o as CHART_TYPE_LABELS, p as CSS_VARIABLE_CHART_THEME, q as ChartActionResult, r as ChartControllerOptions, s as ChartDomSpec, t as ChartEditOptions, u as ChartFamily, v as ChartSeriesInput, w as ChartSeriesPatch, x as ChartSparklineKind, y as ChartSparklineOptions, z as ChartState, A as ChartSvgOptions, B as ChartTableData, D as ChartTableOptions, E as ChartTextMeasure, F as ChartTrendFit, G as DEFAULT_CHART_PALETTE, H as DEFAULT_CHART_THEME, I as chartColorInputValue, J as chartColorsByCategory, K as chartDataFromTable, L as chartDataToTable, M as chartFamily, N as chartMovingAverage, O as chartPointColor, P as chartSceneToDomSpec, Q as chartSceneToSvg, R as chartSeriesColor, S as chartSeriesType, T as chartSliceColor, U as chartSupportsTrendlines, V as chartTextBaseline, W as chartTextTransform, X as chartToSvg, Y as chartTrendlineName, Z as cloneChartSeries, _ as cloneChartSpec, $ as contrastingTextColor, a0 as createChartController, a1 as createChartSpec, a2 as defaultChartAxis, a3 as estimateChartTextWidth, a4 as fitChartTrendline, a5 as isCartesianChart, a6 as isXyChart, a7 as layoutSparkline, a8 as normalizeChartAxis, a9 as normalizeChartErrorBars, aa as normalizeChartSpec, ab as normalizeChartTrendline, ac as normalizeChartValues, ad as parseChartValue, ae as sameChartSelection, af as sparklineToSvg, ag as trendNumberText, ah as uniqueChartSeriesId } from '../controller-D2rj5umx.js';
5
5
  import { C as CommandSpec } from '../registry-rVtFJjRM.js';
6
- import { A as AgentToolProvider } from '../registry-7AZFuand.js';
6
+ import { a as AgentToolProvider } from '../registry-D-4fit9C.js';
7
7
  import { e as PresenceClock, g as PresenceStore, d as PresenceActorInfo, c as PresenceActor, f as PresenceState, h as createInstantPresenceClock } from '../presence-Cb6WhcrQ.js';
8
8
  import { Z as ZipReadOptions } from '../zip-4nG0YAH7.js';
9
9
  import '../HistoryManager-DWSLd6Tf.js';
@@ -1,15 +1,26 @@
1
1
  import {
2
2
  FormulaEvaluator,
3
3
  WHOLE_COLUMN_END_ROW,
4
+ aggregateValues,
5
+ compareCellValues,
4
6
  describeFormulaError,
7
+ fillSeries,
8
+ getFillDirection,
5
9
  getFormulaArgumentSpecIndex,
6
10
  getFormulaFunction,
7
11
  getFormulaSignature,
8
12
  getFormulaSignatureParts,
13
+ isBlankValue,
14
+ isSingleCellRange,
15
+ matchesFilterRule,
16
+ normalizeRange,
9
17
  parseFormula,
18
+ rangeContains,
19
+ rangeContainsRange,
20
+ rangesIntersect,
10
21
  searchFormulaFunctions,
11
22
  tokenizeFormula
12
- } from "./chunk-JQ3BB3E6.js";
23
+ } from "./chunk-PXDEFEG2.js";
13
24
  import {
14
25
  NumberFormat,
15
26
  colNameToIndex,
@@ -19,12 +30,9 @@ import {
19
30
  isBlank,
20
31
  isFormulaError,
21
32
  numberToText,
22
- numericValue,
23
33
  parseCellInput,
24
- parseIsoDate,
25
34
  serialFromYmd,
26
35
  serialToDate,
27
- sortCompareValues,
28
36
  toBoolean,
29
37
  toText
30
38
  } from "./chunk-EKYHKQPG.js";
@@ -1287,282 +1295,6 @@ function isLambdaDefinition(definition) {
1287
1295
  return /^=?\s*LAMBDA\s*\(/i.test(definition.refersTo);
1288
1296
  }
1289
1297
 
1290
- // src/spreadsheet/table.ts
1291
- function normalizeRange(range) {
1292
- return {
1293
- startRow: Math.min(range.startRow, range.endRow),
1294
- startCol: Math.min(range.startCol, range.endCol),
1295
- endRow: Math.max(range.startRow, range.endRow),
1296
- endCol: Math.max(range.startCol, range.endCol)
1297
- };
1298
- }
1299
- function rangeContains(range, row, col) {
1300
- const r = normalizeRange(range);
1301
- return row >= r.startRow && row <= r.endRow && col >= r.startCol && col <= r.endCol;
1302
- }
1303
- function rangesIntersect(a, b) {
1304
- const x = normalizeRange(a);
1305
- const y = normalizeRange(b);
1306
- return x.startRow <= y.endRow && y.startRow <= x.endRow && x.startCol <= y.endCol && y.startCol <= x.endCol;
1307
- }
1308
- function rangeContainsRange(outer, inner) {
1309
- const o = normalizeRange(outer);
1310
- const i = normalizeRange(inner);
1311
- return i.startRow >= o.startRow && i.endRow <= o.endRow && i.startCol >= o.startCol && i.endCol <= o.endCol;
1312
- }
1313
- function isSingleCellRange(range) {
1314
- const r = normalizeRange(range);
1315
- return r.startRow === r.endRow && r.startCol === r.endCol;
1316
- }
1317
- var NUMBER_PATTERN = /^[-+]?(\d+\.?\d*|\.\d+)(e[-+]?\d+)?$/i;
1318
- var ISO_DATE_PATTERN = /^(\d{4})-(\d{2})-(\d{2})$/;
1319
- function isBlankValue(value) {
1320
- return value === null || value === void 0 || typeof value === "string" && value.trim() === "";
1321
- }
1322
- function toNumber(value) {
1323
- if (typeof value === "number") return Number.isFinite(value) ? value : null;
1324
- if (typeof value === "string") {
1325
- const trimmed = value.trim();
1326
- if (NUMBER_PATTERN.test(trimmed)) return parseFloat(trimmed);
1327
- }
1328
- return null;
1329
- }
1330
- var collator = typeof Intl !== "undefined" ? new Intl.Collator(void 0, { numeric: true, sensitivity: "base" }) : null;
1331
- function compareText(a, b) {
1332
- return collator ? collator.compare(a, b) : a < b ? -1 : a > b ? 1 : 0;
1333
- }
1334
- function compareCellValues(a, b, direction = "asc") {
1335
- const aBlank = isBlankValue(a);
1336
- const bBlank = isBlankValue(b);
1337
- if (aBlank || bBlank) return aBlank === bBlank ? 0 : aBlank ? 1 : -1;
1338
- let result;
1339
- if (isPlainText(a) && isPlainText(b) && !(parseIsoDate(a) && parseIsoDate(b))) {
1340
- result = compareText(a, b);
1341
- } else {
1342
- result = sortCompareValues(a, b);
1343
- }
1344
- if (result === 0) return 0;
1345
- return direction === "desc" ? -Math.sign(result) : Math.sign(result);
1346
- }
1347
- var isPlainText = (value) => typeof value === "string" && !isFormulaError(value);
1348
- function filterValue(value) {
1349
- if (isBlankValue(value) || isFormulaError(value)) return null;
1350
- if (typeof value === "number") return Number.isFinite(value) ? { value, kind: "number" } : null;
1351
- if (typeof value === "boolean") return { value, kind: "boolean" };
1352
- const num = numericValue(value);
1353
- if (num !== null) return { value: num, kind: "number" };
1354
- const text = String(value);
1355
- return { value: text, kind: parseIsoDate(text) ? "number" : "text" };
1356
- }
1357
- function filterOperand(operand) {
1358
- if (typeof operand !== "string") return filterValue(operand);
1359
- if (operand.trim() === "") return null;
1360
- const parsed = parseCellInput(operand.trim());
1361
- if (parsed.type === "number" || parsed.type === "date" || parsed.type === "boolean") return filterValue(parsed.value);
1362
- return { value: operand, kind: "text" };
1363
- }
1364
- function compareForFilter(value, operand) {
1365
- const a = filterValue(value);
1366
- const b = filterOperand(operand);
1367
- if (!a || !b || a.kind !== b.kind) return null;
1368
- return compareValues(a.value, b.value);
1369
- }
1370
- function looselyEquals(value, operand) {
1371
- const c = compareForFilter(value, operand);
1372
- if (c !== null) return c === 0;
1373
- return String(value ?? "").trim().toLowerCase() === String(operand ?? "").trim().toLowerCase();
1374
- }
1375
- function matchesFilterRule(value, rule) {
1376
- const text = String(value ?? "").toLowerCase();
1377
- switch (rule.operator) {
1378
- case "equals":
1379
- return looselyEquals(value, rule.value);
1380
- case "notEquals":
1381
- return !looselyEquals(value, rule.value);
1382
- case "contains":
1383
- return text.includes(String(rule.value ?? "").toLowerCase());
1384
- case "notContains":
1385
- return !text.includes(String(rule.value ?? "").toLowerCase());
1386
- case "greaterThan": {
1387
- const c = compareForFilter(value, rule.value);
1388
- return c !== null && c > 0;
1389
- }
1390
- case "greaterThanOrEqual": {
1391
- const c = compareForFilter(value, rule.value);
1392
- return c !== null && c >= 0;
1393
- }
1394
- case "lessThan": {
1395
- const c = compareForFilter(value, rule.value);
1396
- return c !== null && c < 0;
1397
- }
1398
- case "lessThanOrEqual": {
1399
- const c = compareForFilter(value, rule.value);
1400
- return c !== null && c <= 0;
1401
- }
1402
- case "between": {
1403
- const lo = compareForFilter(value, rule.value);
1404
- const hi = compareForFilter(value, rule.value2);
1405
- return lo !== null && hi !== null && lo >= 0 && hi <= 0;
1406
- }
1407
- case "isBlank":
1408
- return isBlankValue(value);
1409
- case "isNotBlank":
1410
- return !isBlankValue(value);
1411
- case "oneOf":
1412
- return (rule.values ?? []).some((candidate) => String(candidate) === String(value ?? ""));
1413
- default:
1414
- return true;
1415
- }
1416
- }
1417
- function aggregateValues(values, aggregate) {
1418
- if (aggregate === "count") return values.filter((v) => !isBlankValue(v)).length;
1419
- const numbers = [];
1420
- for (const v of values) {
1421
- const n = toNumber(v);
1422
- if (n !== null) numbers.push(n);
1423
- }
1424
- if (numbers.length === 0) return aggregate === "sum" ? 0 : null;
1425
- switch (aggregate) {
1426
- case "sum":
1427
- return roundFloat(numbers.reduce((s, n) => s + n, 0));
1428
- case "average":
1429
- return roundFloat(numbers.reduce((s, n) => s + n, 0) / numbers.length);
1430
- case "min":
1431
- return numbers.reduce((m, n) => n < m ? n : m, numbers[0]);
1432
- case "max":
1433
- return numbers.reduce((m, n) => n > m ? n : m, numbers[0]);
1434
- default:
1435
- return null;
1436
- }
1437
- }
1438
- function roundFloat(value) {
1439
- return Number.isInteger(value) ? value : parseFloat(value.toPrecision(12));
1440
- }
1441
- var DAY_MS = 864e5;
1442
- var TRAILING_NUMBER = /^(.*?)(\d+)(\D*)$/;
1443
- function classifyFillValue(raw) {
1444
- if (raw.trim() === "") return { kind: "blank" };
1445
- const num = toNumber(raw);
1446
- if (num !== null) return { kind: "number", value: num };
1447
- const typed = parseCellInput(raw);
1448
- const date = ISO_DATE_PATTERN.exec(typed.type === "date" ? String(typed.value) : raw.trim());
1449
- if (date) {
1450
- const [year, month, day] = [Number(date[1]), Number(date[2]), Number(date[3])];
1451
- const time = Date.UTC(year, month - 1, day);
1452
- const check = new Date(time);
1453
- if (check.getUTCMonth() === month - 1 && check.getUTCDate() === day) {
1454
- return { kind: "date", time, year, month, day };
1455
- }
1456
- }
1457
- const textNumber = TRAILING_NUMBER.exec(raw);
1458
- if (textNumber && textNumber[1] !== "") {
1459
- return {
1460
- kind: "textNumber",
1461
- prefix: textNumber[1],
1462
- value: parseInt(textNumber[2], 10),
1463
- width: textNumber[2].length,
1464
- suffix: textNumber[3]
1465
- };
1466
- }
1467
- return { kind: "text", text: raw };
1468
- }
1469
- var pad = (n, width) => String(Math.abs(n)).padStart(width, "0");
1470
- function formatDate(time) {
1471
- const d = new Date(time);
1472
- return `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1, 2)}-${pad(d.getUTCDate(), 2)}`;
1473
- }
1474
- function constantStep(values) {
1475
- const step = values[1] - values[0];
1476
- for (let i = 2; i < values.length; i++) {
1477
- if (Math.abs(values[i] - values[i - 1] - step) > 1e-9) return null;
1478
- }
1479
- return step;
1480
- }
1481
- function linearTrend(values, x) {
1482
- const n = values.length;
1483
- const meanX = (n - 1) / 2;
1484
- const meanY = values.reduce((s, v) => s + v, 0) / n;
1485
- let num = 0;
1486
- let den = 0;
1487
- values.forEach((v, i) => {
1488
- num += (i - meanX) * (v - meanY);
1489
- den += (i - meanX) ** 2;
1490
- });
1491
- const slope = den === 0 ? 0 : num / den;
1492
- return meanY + slope * (x - meanX);
1493
- }
1494
- function fillSeries(source, count) {
1495
- if (count <= 0) return [];
1496
- if (source.length === 0) return Array(count).fill("");
1497
- const repeat = () => Array.from({ length: count }, (_, i) => source[i % source.length]);
1498
- const parsed = source.map(classifyFillValue);
1499
- const kind = parsed[0].kind;
1500
- if (!parsed.every((p) => p.kind === kind)) return repeat();
1501
- const n = source.length;
1502
- if (kind === "number") {
1503
- if (n === 1) return repeat();
1504
- const values = parsed.map((p) => p.value);
1505
- return Array.from({ length: count }, (_, i) => String(roundFloat(linearTrend(values, n + i))));
1506
- }
1507
- if (kind === "date") {
1508
- const dates = parsed;
1509
- if (n === 1) {
1510
- return Array.from({ length: count }, (_, i) => formatDate(dates[0].time + (i + 1) * DAY_MS));
1511
- }
1512
- const monthIndex = dates.map((d) => d.year * 12 + (d.month - 1));
1513
- const monthStep = constantStep(monthIndex);
1514
- if (monthStep !== null && monthStep !== 0 && dates.every((d) => d.day === dates[0].day)) {
1515
- const last = monthIndex[n - 1];
1516
- return Array.from({ length: count }, (_, i) => {
1517
- const m = last + monthStep * (i + 1);
1518
- const year = Math.floor(m / 12);
1519
- const month = m - year * 12;
1520
- const daysInMonth = new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
1521
- return formatDate(Date.UTC(year, month, Math.min(dates[0].day, daysInMonth)));
1522
- });
1523
- }
1524
- const dayStep = constantStep(dates.map((d) => Math.round(d.time / DAY_MS)));
1525
- if (dayStep === null) return repeat();
1526
- const lastTime = dates[n - 1].time;
1527
- return Array.from({ length: count }, (_, i) => formatDate(lastTime + dayStep * (i + 1) * DAY_MS));
1528
- }
1529
- if (kind === "textNumber") {
1530
- const items = parsed;
1531
- const { prefix, suffix } = items[0];
1532
- if (!items.every((t) => t.prefix === prefix && t.suffix === suffix)) return repeat();
1533
- const step = n === 1 ? 1 : constantStep(items.map((t) => t.value));
1534
- if (step === null) return repeat();
1535
- const last = items[n - 1];
1536
- return Array.from({ length: count }, (_, i) => {
1537
- const value = last.value + step * (i + 1);
1538
- const digits = value < 0 ? `-${pad(value, last.width)}` : pad(value, last.width);
1539
- return `${prefix}${digits}${suffix}`;
1540
- });
1541
- }
1542
- return repeat();
1543
- }
1544
- function computeFillTarget(source, pointer) {
1545
- const s = normalizeRange(source);
1546
- const rowOverflow = pointer.row > s.endRow ? pointer.row - s.endRow : pointer.row < s.startRow ? s.startRow - pointer.row : 0;
1547
- const colOverflow = pointer.col > s.endCol ? pointer.col - s.endCol : pointer.col < s.startCol ? s.startCol - pointer.col : 0;
1548
- if (rowOverflow === 0 && colOverflow === 0) return null;
1549
- if (rowOverflow >= colOverflow) {
1550
- return pointer.row > s.endRow ? { ...s, endRow: pointer.row } : { ...s, startRow: pointer.row };
1551
- }
1552
- return pointer.col > s.endCol ? { ...s, endCol: pointer.col } : { ...s, startCol: pointer.col };
1553
- }
1554
- function getFillDirection(source, target) {
1555
- const s = normalizeRange(source);
1556
- const t = normalizeRange(target);
1557
- const sameCols = s.startCol === t.startCol && s.endCol === t.endCol;
1558
- const sameRows = s.startRow === t.startRow && s.endRow === t.endRow;
1559
- if (sameCols && t.startRow === s.startRow && t.endRow > s.endRow) return "down";
1560
- if (sameCols && t.endRow === s.endRow && t.startRow < s.startRow) return "up";
1561
- if (sameRows && t.startCol === s.startCol && t.endCol > s.endCol) return "right";
1562
- if (sameRows && t.endCol === s.endCol && t.startCol < s.startCol) return "left";
1563
- return null;
1564
- }
1565
-
1566
1298
  // src/spreadsheet/clipboard.ts
1567
1299
  var SPREADSHEET_CLIPBOARD_MIME = "application/x.pixerate.spreadsheet+json";
1568
1300
  var displayText = (value) => value === null || value === void 0 ? "" : String(value);
@@ -6699,20 +6431,6 @@ export {
6699
6431
  copySheetName,
6700
6432
  validateDefinedName,
6701
6433
  isLambdaDefinition,
6702
- normalizeRange,
6703
- rangeContains,
6704
- rangesIntersect,
6705
- rangeContainsRange,
6706
- isSingleCellRange,
6707
- isBlankValue,
6708
- toNumber,
6709
- compareCellValues,
6710
- matchesFilterRule,
6711
- aggregateValues,
6712
- roundFloat,
6713
- fillSeries,
6714
- computeFillTarget,
6715
- getFillDirection,
6716
6434
  SPREADSHEET_CLIPBOARD_MIME,
6717
6435
  serializeHtmlTable,
6718
6436
  parseHtmlTable,
@@ -6803,4 +6521,4 @@ export {
6803
6521
  getSpreadsheetScrollToCell,
6804
6522
  sameSpreadsheetViewWindow
6805
6523
  };
6806
- //# sourceMappingURL=chunk-2CJ3LPYQ.js.map
6524
+ //# sourceMappingURL=chunk-424H3P4I.js.map