@mog-sdk/node 0.1.12 → 0.1.14

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.
package/dist/index.cjs CHANGED
@@ -90,10 +90,45 @@ function activeCellToStoreCellData(data, row, col) {
90
90
  }
91
91
  async function getData(ctx, sheetId, row, col) {
92
92
  const cellId = await ctx.computeBridge.getCellIdAt(sheetId, row, col);
93
- if (!cellId) return void 0;
94
- const data = await ctx.computeBridge.getActiveCell(sheetId, cellId);
95
- if (!data) return void 0;
96
- return activeCellToStoreCellData(data, row, col);
93
+ if (cellId) {
94
+ const data = await ctx.computeBridge.getActiveCell(sheetId, cellId);
95
+ if (data) return activeCellToStoreCellData(data, row, col);
96
+ }
97
+ const cellData = await ctx.computeBridge.getCellData(sheetId, row, col);
98
+ if (cellData != null) {
99
+ const obj = cellData;
100
+ const rawValue = obj.value ?? obj.raw;
101
+ if (rawValue != null) {
102
+ const value = parseMirrorValue(rawValue);
103
+ if (value !== null && value !== void 0) {
104
+ return {
105
+ id: obj.cell_id ?? obj.cellId ?? "",
106
+ row,
107
+ col,
108
+ raw: value
109
+ };
110
+ }
111
+ }
112
+ }
113
+ return void 0;
114
+ }
115
+ function parseMirrorValue(json) {
116
+ if (typeof json !== "object" || json === null) return null;
117
+ const obj = json;
118
+ switch (obj.type) {
119
+ case "number":
120
+ return obj.value;
121
+ case "text":
122
+ return obj.value;
123
+ case "boolean":
124
+ return obj.value;
125
+ case "error":
126
+ return obj.value;
127
+ case "null":
128
+ return null;
129
+ default:
130
+ return null;
131
+ }
97
132
  }
98
133
  function getEffectiveValue(data) {
99
134
  if (data.formula !== void 0) {
@@ -295,6 +330,36 @@ var init_errors = __esm({
295
330
  }
296
331
  });
297
332
 
333
+ // ../../contracts/src/document/protection.ts
334
+ var DEFAULT_PROTECTION_OPTIONS, DEFAULT_WORKBOOK_PROTECTION_OPTIONS;
335
+ var init_protection = __esm({
336
+ "../../contracts/src/document/protection.ts"() {
337
+ "use strict";
338
+ init_cjs_shims();
339
+ DEFAULT_PROTECTION_OPTIONS = {
340
+ // Selection defaults to true (users can always select cells)
341
+ selectLockedCells: true,
342
+ selectUnlockedCells: true,
343
+ // All other operations blocked by default
344
+ insertRows: false,
345
+ insertColumns: false,
346
+ deleteRows: false,
347
+ deleteColumns: false,
348
+ formatCells: false,
349
+ formatColumns: false,
350
+ formatRows: false,
351
+ sort: false,
352
+ useAutoFilter: false,
353
+ usePivotTableReports: false,
354
+ editObjects: false,
355
+ editScenarios: false
356
+ };
357
+ DEFAULT_WORKBOOK_PROTECTION_OPTIONS = {
358
+ structure: true
359
+ };
360
+ }
361
+ });
362
+
298
363
  // ../../infra/transport/src/command-metadata.gen.ts
299
364
  var BYTES_TUPLE_COMMANDS, RECALC_COMMANDS;
300
365
  var init_command_metadata_gen = __esm({
@@ -774,165 +839,6 @@ var init_napi_transport = __esm({
774
839
  }
775
840
  });
776
841
 
777
- // ../../node_modules/.pnpm/@tauri-apps+api@2.10.1/node_modules/@tauri-apps/api/external/tslib/tslib.es6.js
778
- function __classPrivateFieldGet(receiver, state, kind, f) {
779
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
780
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
781
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
782
- }
783
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
784
- if (kind === "m") throw new TypeError("Private method is not writable");
785
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
786
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
787
- return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
788
- }
789
- var init_tslib_es6 = __esm({
790
- "../../node_modules/.pnpm/@tauri-apps+api@2.10.1/node_modules/@tauri-apps/api/external/tslib/tslib.es6.js"() {
791
- "use strict";
792
- init_cjs_shims();
793
- }
794
- });
795
-
796
- // ../../node_modules/.pnpm/@tauri-apps+api@2.10.1/node_modules/@tauri-apps/api/core.js
797
- var core_exports = {};
798
- __export(core_exports, {
799
- Channel: () => Channel,
800
- PluginListener: () => PluginListener,
801
- Resource: () => Resource,
802
- SERIALIZE_TO_IPC_FN: () => SERIALIZE_TO_IPC_FN,
803
- addPluginListener: () => addPluginListener,
804
- checkPermissions: () => checkPermissions,
805
- convertFileSrc: () => convertFileSrc,
806
- invoke: () => invoke,
807
- isTauri: () => isTauri2,
808
- requestPermissions: () => requestPermissions,
809
- transformCallback: () => transformCallback
810
- });
811
- function transformCallback(callback, once = false) {
812
- return window.__TAURI_INTERNALS__.transformCallback(callback, once);
813
- }
814
- async function addPluginListener(plugin, event, cb) {
815
- const handler = new Channel(cb);
816
- try {
817
- await invoke(`plugin:${plugin}|register_listener`, {
818
- event,
819
- handler
820
- });
821
- return new PluginListener(plugin, event, handler.id);
822
- } catch {
823
- await invoke(`plugin:${plugin}|registerListener`, { event, handler });
824
- return new PluginListener(plugin, event, handler.id);
825
- }
826
- }
827
- async function checkPermissions(plugin) {
828
- return invoke(`plugin:${plugin}|check_permissions`);
829
- }
830
- async function requestPermissions(plugin) {
831
- return invoke(`plugin:${plugin}|request_permissions`);
832
- }
833
- async function invoke(cmd, args = {}, options) {
834
- return window.__TAURI_INTERNALS__.invoke(cmd, args, options);
835
- }
836
- function convertFileSrc(filePath, protocol = "asset") {
837
- return window.__TAURI_INTERNALS__.convertFileSrc(filePath, protocol);
838
- }
839
- function isTauri2() {
840
- return !!(globalThis || window).isTauri;
841
- }
842
- var _Channel_onmessage, _Channel_nextMessageIndex, _Channel_pendingMessages, _Channel_messageEndIndex, _Resource_rid, SERIALIZE_TO_IPC_FN, Channel, PluginListener, Resource;
843
- var init_core = __esm({
844
- "../../node_modules/.pnpm/@tauri-apps+api@2.10.1/node_modules/@tauri-apps/api/core.js"() {
845
- "use strict";
846
- init_cjs_shims();
847
- init_tslib_es6();
848
- SERIALIZE_TO_IPC_FN = "__TAURI_TO_IPC_KEY__";
849
- Channel = class {
850
- constructor(onmessage) {
851
- _Channel_onmessage.set(this, void 0);
852
- _Channel_nextMessageIndex.set(this, 0);
853
- _Channel_pendingMessages.set(this, []);
854
- _Channel_messageEndIndex.set(this, void 0);
855
- __classPrivateFieldSet(this, _Channel_onmessage, onmessage || (() => {
856
- }), "f");
857
- this.id = transformCallback((rawMessage) => {
858
- const index = rawMessage.index;
859
- if ("end" in rawMessage) {
860
- if (index == __classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")) {
861
- this.cleanupCallback();
862
- } else {
863
- __classPrivateFieldSet(this, _Channel_messageEndIndex, index, "f");
864
- }
865
- return;
866
- }
867
- const message = rawMessage.message;
868
- if (index == __classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")) {
869
- __classPrivateFieldGet(this, _Channel_onmessage, "f").call(this, message);
870
- __classPrivateFieldSet(this, _Channel_nextMessageIndex, __classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") + 1, "f");
871
- while (__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") in __classPrivateFieldGet(this, _Channel_pendingMessages, "f")) {
872
- const message2 = __classPrivateFieldGet(this, _Channel_pendingMessages, "f")[__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")];
873
- __classPrivateFieldGet(this, _Channel_onmessage, "f").call(this, message2);
874
- delete __classPrivateFieldGet(this, _Channel_pendingMessages, "f")[__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")];
875
- __classPrivateFieldSet(this, _Channel_nextMessageIndex, __classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") + 1, "f");
876
- }
877
- if (__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") === __classPrivateFieldGet(this, _Channel_messageEndIndex, "f")) {
878
- this.cleanupCallback();
879
- }
880
- } else {
881
- __classPrivateFieldGet(this, _Channel_pendingMessages, "f")[index] = message;
882
- }
883
- });
884
- }
885
- cleanupCallback() {
886
- window.__TAURI_INTERNALS__.unregisterCallback(this.id);
887
- }
888
- set onmessage(handler) {
889
- __classPrivateFieldSet(this, _Channel_onmessage, handler, "f");
890
- }
891
- get onmessage() {
892
- return __classPrivateFieldGet(this, _Channel_onmessage, "f");
893
- }
894
- [(_Channel_onmessage = /* @__PURE__ */ new WeakMap(), _Channel_nextMessageIndex = /* @__PURE__ */ new WeakMap(), _Channel_pendingMessages = /* @__PURE__ */ new WeakMap(), _Channel_messageEndIndex = /* @__PURE__ */ new WeakMap(), SERIALIZE_TO_IPC_FN)]() {
895
- return `__CHANNEL__:${this.id}`;
896
- }
897
- toJSON() {
898
- return this[SERIALIZE_TO_IPC_FN]();
899
- }
900
- };
901
- PluginListener = class {
902
- constructor(plugin, event, channelId) {
903
- this.plugin = plugin;
904
- this.event = event;
905
- this.channelId = channelId;
906
- }
907
- async unregister() {
908
- return invoke(`plugin:${this.plugin}|remove_listener`, {
909
- event: this.event,
910
- channelId: this.channelId
911
- });
912
- }
913
- };
914
- Resource = class {
915
- get rid() {
916
- return __classPrivateFieldGet(this, _Resource_rid, "f");
917
- }
918
- constructor(rid) {
919
- _Resource_rid.set(this, void 0);
920
- __classPrivateFieldSet(this, _Resource_rid, rid, "f");
921
- }
922
- /**
923
- * Destroys and cleans up this resource from memory.
924
- * **You should not call any method on this object anymore and should drop any reference to it.**
925
- */
926
- async close() {
927
- return invoke("plugin:resources|close", {
928
- rid: this.rid
929
- });
930
- }
931
- };
932
- _Resource_rid = /* @__PURE__ */ new WeakMap();
933
- }
934
- });
935
-
936
842
  // ../../infra/transport/src/tauri-transport.ts
937
843
  function createTauriTransport() {
938
844
  let invokeFunc = null;
@@ -940,8 +846,8 @@ function createTauriTransport() {
940
846
  async call(command, args) {
941
847
  let fn = invokeFunc;
942
848
  if (!fn) {
943
- const { invoke: invoke2 } = await Promise.resolve().then(() => (init_core(), core_exports));
944
- fn = invoke2;
849
+ const { invoke } = await import("@tauri-apps/api/core");
850
+ fn = invoke;
945
851
  invokeFunc = fn;
946
852
  }
947
853
  try {
@@ -2203,6 +2109,101 @@ var init_mutation_result_handler = __esm({
2203
2109
  }
2204
2110
  });
2205
2111
 
2112
+ // ../../contracts/src/core/commands.ts
2113
+ var init_commands = __esm({
2114
+ "../../contracts/src/core/commands.ts"() {
2115
+ "use strict";
2116
+ init_cjs_shims();
2117
+ }
2118
+ });
2119
+
2120
+ // ../../contracts/src/core/core.ts
2121
+ var init_core = __esm({
2122
+ "../../contracts/src/core/core.ts"() {
2123
+ "use strict";
2124
+ init_cjs_shims();
2125
+ }
2126
+ });
2127
+
2128
+ // ../../contracts/src/core/disposable.ts
2129
+ var init_disposable = __esm({
2130
+ "../../contracts/src/core/disposable.ts"() {
2131
+ "use strict";
2132
+ init_cjs_shims();
2133
+ }
2134
+ });
2135
+
2136
+ // ../../contracts/src/core/event-base.ts
2137
+ var init_event_base = __esm({
2138
+ "../../contracts/src/core/event-base.ts"() {
2139
+ "use strict";
2140
+ init_cjs_shims();
2141
+ }
2142
+ });
2143
+
2144
+ // ../../contracts/src/core/execution.ts
2145
+ var init_execution = __esm({
2146
+ "../../contracts/src/core/execution.ts"() {
2147
+ "use strict";
2148
+ init_cjs_shims();
2149
+ }
2150
+ });
2151
+
2152
+ // ../../contracts/src/core/result.ts
2153
+ var init_result = __esm({
2154
+ "../../contracts/src/core/result.ts"() {
2155
+ "use strict";
2156
+ init_cjs_shims();
2157
+ }
2158
+ });
2159
+
2160
+ // ../../contracts/src/core/schema.ts
2161
+ var init_schema = __esm({
2162
+ "../../contracts/src/core/schema.ts"() {
2163
+ "use strict";
2164
+ init_cjs_shims();
2165
+ }
2166
+ });
2167
+
2168
+ // ../../contracts/src/core/formatted-text.ts
2169
+ function asFormattedText(s) {
2170
+ return s;
2171
+ }
2172
+ function displayStringOrNull(text) {
2173
+ return text;
2174
+ }
2175
+ var init_formatted_text = __esm({
2176
+ "../../contracts/src/core/formatted-text.ts"() {
2177
+ "use strict";
2178
+ init_cjs_shims();
2179
+ }
2180
+ });
2181
+
2182
+ // ../../contracts/src/core/testing.ts
2183
+ var init_testing = __esm({
2184
+ "../../contracts/src/core/testing.ts"() {
2185
+ "use strict";
2186
+ init_cjs_shims();
2187
+ }
2188
+ });
2189
+
2190
+ // ../../contracts/src/core/index.ts
2191
+ var init_core2 = __esm({
2192
+ "../../contracts/src/core/index.ts"() {
2193
+ "use strict";
2194
+ init_cjs_shims();
2195
+ init_commands();
2196
+ init_core();
2197
+ init_disposable();
2198
+ init_event_base();
2199
+ init_execution();
2200
+ init_result();
2201
+ init_schema();
2202
+ init_formatted_text();
2203
+ init_testing();
2204
+ }
2205
+ });
2206
+
2206
2207
  // ../../kernel/src/bridges/wire/constants.gen.ts
2207
2208
  var HEADER_SIZE, CELL_STRIDE, MERGE_STRIDE, DIM_STRIDE, NO_STRING, MUTATION_HEADER_SIZE, PATCH_STRIDE, OFF_NUMBER_VALUE, OFF_DISPLAY_OFF, OFF_ERROR_OFF, OFF_FLAGS, OFF_FORMAT_IDX, OFF_DISPLAY_LEN, OFF_ERROR_LEN, OFF_BG_COLOR_OVERRIDE, OFF_FONT_COLOR_OVERRIDE, DATA_BAR_ENTRY_STRIDE, ICON_ENTRY_STRIDE, MUT_HAS_PROJECTION_CHANGES, MUT_HAS_ERRORS, MUT_HAS_PALETTE, ICON_SET_NAMES;
2208
2209
  var init_constants_gen = __esm({
@@ -2260,12 +2261,12 @@ var init_constants_gen = __esm({
2260
2261
  });
2261
2262
 
2262
2263
  // ../../kernel/src/bridges/wire/binary-mutation-reader.ts
2263
- var import_core, sharedDecoder, BinaryMutationReader;
2264
+ var sharedDecoder, BinaryMutationReader;
2264
2265
  var init_binary_mutation_reader = __esm({
2265
2266
  "../../kernel/src/bridges/wire/binary-mutation-reader.ts"() {
2266
2267
  "use strict";
2267
2268
  init_cjs_shims();
2268
- import_core = require("@mog-sdk/spreadsheet-contracts/core");
2269
+ init_core2();
2269
2270
  init_constants_gen();
2270
2271
  sharedDecoder = new TextDecoder("utf-8");
2271
2272
  BinaryMutationReader = class {
@@ -2364,7 +2365,7 @@ var init_binary_mutation_reader = __esm({
2364
2365
  const displayLen = this._view.getUint16(recOff + OFF_DISPLAY_LEN, true);
2365
2366
  if (displayOff === NO_STRING || displayLen === 0) return null;
2366
2367
  const start = this._stringPoolStart + displayOff;
2367
- return (0, import_core.asFormattedText)(sharedDecoder.decode(this._bytes.subarray(start, start + displayLen)));
2368
+ return asFormattedText(sharedDecoder.decode(this._bytes.subarray(start, start + displayLen)));
2368
2369
  }
2369
2370
  /**
2370
2371
  * Get a zero-copy subarray view of the raw UTF-8 display bytes for patch i.
@@ -2516,7 +2517,7 @@ var init_binary_mutation_reader = __esm({
2516
2517
  const displayLen = this._view.getUint16(recOff + OFF_DISPLAY_LEN, true);
2517
2518
  if (displayOff === NO_STRING || displayLen === 0) return null;
2518
2519
  const start = this._stringPoolStart + displayOff;
2519
- return (0, import_core.asFormattedText)(sharedDecoder.decode(this._bytes.subarray(start, start + displayLen)));
2520
+ return asFormattedText(sharedDecoder.decode(this._bytes.subarray(start, start + displayLen)));
2520
2521
  }
2521
2522
  /**
2522
2523
  * Get a zero-copy subarray view of the raw UTF-8 display bytes for spill patch i.
@@ -2565,12 +2566,12 @@ function rgbaU32ToHex(value) {
2565
2566
  const b = value >>> 8 & 255;
2566
2567
  return "#" + (1 << 24 | r << 16 | g << 8 | b).toString(16).slice(1).toUpperCase();
2567
2568
  }
2568
- var import_core2, sharedEncoder, sharedDecoder2, EMPTY_FORMAT, BinaryViewportBuffer, CellAccessor;
2569
+ var sharedEncoder, sharedDecoder2, EMPTY_FORMAT, BinaryViewportBuffer, CellAccessor;
2569
2570
  var init_binary_viewport_buffer = __esm({
2570
2571
  "../../kernel/src/bridges/wire/binary-viewport-buffer.ts"() {
2571
2572
  "use strict";
2572
2573
  init_cjs_shims();
2573
- import_core2 = require("@mog-sdk/spreadsheet-contracts/core");
2574
+ init_core2();
2574
2575
  init_constants_gen();
2575
2576
  init_constants_gen();
2576
2577
  sharedEncoder = new TextEncoder();
@@ -2890,7 +2891,7 @@ var init_binary_viewport_buffer = __esm({
2890
2891
  sampleCells.push({
2891
2892
  row,
2892
2893
  col,
2893
- displayText: (0, import_core2.displayStringOrNull)(reader.patchDisplayText(i))
2894
+ displayText: displayStringOrNull(reader.patchDisplayText(i))
2894
2895
  });
2895
2896
  }
2896
2897
  }
@@ -2909,7 +2910,7 @@ var init_binary_viewport_buffer = __esm({
2909
2910
  sampleCells.push({
2910
2911
  row,
2911
2912
  col,
2912
- displayText: (0, import_core2.displayStringOrNull)(reader.spillPatchDisplayText(i))
2913
+ displayText: displayStringOrNull(reader.spillPatchDisplayText(i))
2913
2914
  });
2914
2915
  }
2915
2916
  }
@@ -3667,7 +3668,7 @@ var init_binary_viewport_buffer = __esm({
3667
3668
  */
3668
3669
  get displayText() {
3669
3670
  const decoded = this._buffer.getOrDecodeString(this._displayOff, this._displayLen);
3670
- return decoded !== null ? (0, import_core2.asFormattedText)(decoded) : null;
3671
+ return decoded !== null ? asFormattedText(decoded) : null;
3671
3672
  }
3672
3673
  /**
3673
3674
  * Get the error text for the current cell.
@@ -3729,13 +3730,13 @@ var init_binary_viewport_buffer = __esm({
3729
3730
  function cellKey(row, col) {
3730
3731
  return `${row},${col}`;
3731
3732
  }
3732
- var import_core3, ViewportCoordinator;
3733
+ var ViewportCoordinator;
3733
3734
  var init_viewport_coordinator = __esm({
3734
3735
  "../../kernel/src/bridges/wire/viewport-coordinator.ts"() {
3735
3736
  "use strict";
3736
3737
  init_cjs_shims();
3737
3738
  init_binary_viewport_buffer();
3738
- import_core3 = require("@mog-sdk/spreadsheet-contracts/core");
3739
+ init_core2();
3739
3740
  ViewportCoordinator = class {
3740
3741
  constructor(viewportId) {
3741
3742
  /** Monotonically increasing version, incremented on every write. */
@@ -3856,7 +3857,7 @@ var init_viewport_coordinator = __esm({
3856
3857
  flags: reader.patchFlags(i),
3857
3858
  numberValue: reader.patchNumberValue(i),
3858
3859
  formatIdx: reader.patchFormatIdx(i),
3859
- displayString: (0, import_core3.displayStringOrNull)(reader.patchDisplayText(i)),
3860
+ displayString: displayStringOrNull(reader.patchDisplayText(i)),
3860
3861
  errorString: reader.patchErrorText(i),
3861
3862
  bgColorOverride: reader.patchBgColorOverride(i),
3862
3863
  fontColorOverride: reader.patchFontColorOverride(i),
@@ -3873,7 +3874,7 @@ var init_viewport_coordinator = __esm({
3873
3874
  flags: reader.spillPatchFlags(i),
3874
3875
  numberValue: reader.spillPatchNumberValue(i),
3875
3876
  formatIdx: reader.spillPatchFormatIdx(i),
3876
- displayString: (0, import_core3.displayStringOrNull)(reader.spillPatchDisplayText(i)),
3877
+ displayString: displayStringOrNull(reader.spillPatchDisplayText(i)),
3877
3878
  errorString: reader.spillPatchErrorText(i),
3878
3879
  bgColorOverride: reader.spillPatchBgColorOverride(i),
3879
3880
  fontColorOverride: reader.spillPatchFontColorOverride(i),
@@ -5033,10 +5034,11 @@ var init_compute_core = __esm({
5033
5034
  * Requires at least CONTEXT_SET phase (the engine may or may not have been started yet).
5034
5035
  * After fullRecalc completes, the bridge transitions to STARTED phase.
5035
5036
  */
5036
- async fullRecalc() {
5037
+ async fullRecalc(options) {
5037
5038
  this.ensurePhase("CONTEXT_SET", "fullRecalc");
5038
5039
  const result = await this.transport.call("compute_full_recalc", {
5039
- docId: this.docId
5040
+ docId: this.docId,
5041
+ options: options ?? {}
5040
5042
  });
5041
5043
  this._phase = "STARTED";
5042
5044
  this.mutationHandler?.applyAndNotify({ recalc: result });
@@ -6672,6 +6674,9 @@ var init_compute_bridge_gen = __esm({
6672
6674
  pivotUnregisterDef(sheetId, pivotName) {
6673
6675
  return this.core.mutatePlain(this.core.transport.call("compute_pivot_unregister_def", { docId: this.core.docId, sheetId, pivotName }));
6674
6676
  }
6677
+ pivotMaterialize(sheetId, pivotId, expansionState) {
6678
+ return this.core.query(this.core.transport.call("compute_pivot_materialize", { docId: this.core.docId, sheetId, pivotId, expansionState }));
6679
+ }
6675
6680
  registerViewport(viewportId, sheetId, startRow, startCol, endRow, endCol) {
6676
6681
  return this.core.mutatePlain(this.core.transport.call("compute_register_viewport", { docId: this.core.docId, viewportId, sheetId, startRow, startCol, endRow, endCol }));
6677
6682
  }
@@ -6798,13 +6803,13 @@ async function rustSchemaInferColumn(values) {
6798
6803
  const t = await getSchemaTransport();
6799
6804
  return t.call("compute_schema_infer_column", { values });
6800
6805
  }
6801
- var import_protection, ComputeBridge, schemaTransport;
6806
+ var ComputeBridge, schemaTransport;
6802
6807
  var init_compute_bridge = __esm({
6803
6808
  "../../kernel/src/bridges/compute/compute-bridge.ts"() {
6804
6809
  "use strict";
6805
6810
  init_cjs_shims();
6806
6811
  init_formula_string();
6807
- import_protection = require("@mog-sdk/spreadsheet-contracts/protection");
6812
+ init_protection();
6808
6813
  init_src();
6809
6814
  init_compute_wire_converters();
6810
6815
  init_compute_core();
@@ -6928,8 +6933,8 @@ var init_compute_bridge = __esm({
6928
6933
  // ===========================================================================
6929
6934
  // Error Recovery delegates
6930
6935
  // ===========================================================================
6931
- fullRecalc() {
6932
- return this.core.fullRecalc();
6936
+ fullRecalc(options) {
6937
+ return this.core.fullRecalc(options);
6933
6938
  }
6934
6939
  exportToXlsxBytes() {
6935
6940
  return this.core.exportToXlsxBytes();
@@ -7146,7 +7151,7 @@ var init_compute_bridge = __esm({
7146
7151
  async getSheetProtectionOptions(sheetId) {
7147
7152
  const settings = await this.getSheetSettings(sheetId);
7148
7153
  if (!settings.isProtected) return null;
7149
- return { ...import_protection.DEFAULT_PROTECTION_OPTIONS, ...settings.protectionOptions };
7154
+ return { ...DEFAULT_PROTECTION_OPTIONS, ...settings.protectionOptions };
7150
7155
  }
7151
7156
  /** Set multiple sheet settings at once (iterates entries). */
7152
7157
  async setSheetSettings(sheetId, updates) {
@@ -7230,19 +7235,77 @@ var init_compute_bridge = __esm({
7230
7235
  }
7231
7236
  });
7232
7237
 
7238
+ // ../../contracts/src/rendering/grid-renderer.ts
7239
+ var init_grid_renderer = __esm({
7240
+ "../../contracts/src/rendering/grid-renderer.ts"() {
7241
+ "use strict";
7242
+ init_cjs_shims();
7243
+ }
7244
+ });
7245
+
7246
+ // ../../contracts/src/rendering/constants.ts
7247
+ var DEFAULT_COL_WIDTH_WINDOWS, DEFAULT_COL_WIDTH_MACOS, _isMac, DEFAULT_COL_WIDTH;
7248
+ var init_constants = __esm({
7249
+ "../../contracts/src/rendering/constants.ts"() {
7250
+ "use strict";
7251
+ init_cjs_shims();
7252
+ DEFAULT_COL_WIDTH_WINDOWS = 64;
7253
+ DEFAULT_COL_WIDTH_MACOS = 72;
7254
+ _isMac = typeof navigator !== "undefined" && /Mac/.test(navigator.platform ?? "");
7255
+ DEFAULT_COL_WIDTH = _isMac ? DEFAULT_COL_WIDTH_MACOS : DEFAULT_COL_WIDTH_WINDOWS;
7256
+ }
7257
+ });
7258
+
7259
+ // ../../contracts/src/rendering/data-sources.ts
7260
+ var DEFAULT_CHROME_THEME;
7261
+ var init_data_sources = __esm({
7262
+ "../../contracts/src/rendering/data-sources.ts"() {
7263
+ "use strict";
7264
+ init_cjs_shims();
7265
+ DEFAULT_CHROME_THEME = {
7266
+ canvasBackground: "#ffffff",
7267
+ gridlineColor: "#e0e0e0",
7268
+ headerBackground: "#f8f9fa",
7269
+ headerText: "#333333",
7270
+ headerBorder: "#dadce0",
7271
+ headerHighlightBackground: "#e8eaed",
7272
+ headerHighlightText: "#1a73e8",
7273
+ selectionFill: "rgba(66, 133, 244, 0.1)",
7274
+ selectionBorder: "#4285f4",
7275
+ activeCellBorder: "#1a73e8",
7276
+ fillHandleColor: "#4285f4",
7277
+ dragSourceColor: "rgba(66, 133, 244, 0.15)",
7278
+ dragTargetColor: "#4285f4",
7279
+ scrollbarTrack: "#f1f1f1",
7280
+ scrollbarThumb: "#c1c1c1"
7281
+ };
7282
+ }
7283
+ });
7284
+
7285
+ // ../../contracts/src/rendering/index.ts
7286
+ var init_rendering = __esm({
7287
+ "../../contracts/src/rendering/index.ts"() {
7288
+ "use strict";
7289
+ init_cjs_shims();
7290
+ init_grid_renderer();
7291
+ init_constants();
7292
+ init_data_sources();
7293
+ }
7294
+ });
7295
+
7233
7296
  // ../../kernel/src/domain/sheets/sheet-meta-defaults.ts
7234
7297
  function getSheetMetaDefault(field) {
7235
7298
  const def = SHEET_META_SCHEMA[field];
7236
7299
  return def.default;
7237
7300
  }
7238
- var import_rendering, SHEET_META_DEFAULT_ROW_HEIGHT, SHEET_META_DEFAULT_COL_WIDTH, SHEET_META_DEFAULT_GRIDLINE_COLOR, SHEET_META_SCHEMA;
7301
+ var SHEET_META_DEFAULT_ROW_HEIGHT, SHEET_META_DEFAULT_COL_WIDTH, SHEET_META_DEFAULT_GRIDLINE_COLOR, SHEET_META_SCHEMA;
7239
7302
  var init_sheet_meta_defaults = __esm({
7240
7303
  "../../kernel/src/domain/sheets/sheet-meta-defaults.ts"() {
7241
7304
  "use strict";
7242
7305
  init_cjs_shims();
7243
- import_rendering = require("@mog-sdk/spreadsheet-contracts/rendering");
7306
+ init_rendering();
7244
7307
  SHEET_META_DEFAULT_ROW_HEIGHT = 20;
7245
- SHEET_META_DEFAULT_COL_WIDTH = import_rendering.DEFAULT_COL_WIDTH;
7308
+ SHEET_META_DEFAULT_COL_WIDTH = DEFAULT_COL_WIDTH;
7246
7309
  SHEET_META_DEFAULT_GRIDLINE_COLOR = "#e2e2e2";
7247
7310
  SHEET_META_SCHEMA = {
7248
7311
  // ===========================================================================
@@ -7782,12 +7845,11 @@ function normalizeRange(range2) {
7782
7845
  sheetId: range2.sheetId
7783
7846
  };
7784
7847
  }
7785
- var import_core4;
7786
7848
  var init_range = __esm({
7787
7849
  "../../spreadsheet-utils/src/range.ts"() {
7788
7850
  "use strict";
7789
7851
  init_cjs_shims();
7790
- import_core4 = require("@mog-sdk/spreadsheet-contracts/core");
7852
+ init_core2();
7791
7853
  }
7792
7854
  });
7793
7855
 
@@ -7815,6 +7877,15 @@ function letterToCol(letters) {
7815
7877
  function toA12(row, col) {
7816
7878
  return `${colToLetter3(col)}${row + 1}`;
7817
7879
  }
7880
+ function quoteSheetName(name) {
7881
+ if (/[^A-Za-z0-9_]/.test(name) || /^\d/.test(name)) {
7882
+ return `'${name.replace(/'/g, "''")}'`;
7883
+ }
7884
+ return name;
7885
+ }
7886
+ function toSheetA1(row, col, sheetName) {
7887
+ return `${quoteSheetName(sheetName)}!${colToLetter3(col)}${row + 1}`;
7888
+ }
7818
7889
  function parseCellAddress(ref) {
7819
7890
  const match = ref.match(CELL_ADDRESS_REGEX);
7820
7891
  if (!match) return null;
@@ -9244,7 +9315,7 @@ var init_data_extractor = __esm({
9244
9315
  });
9245
9316
 
9246
9317
  // ../../charts/src/core/index.ts
9247
- var init_core2 = __esm({
9318
+ var init_core3 = __esm({
9248
9319
  "../../charts/src/core/index.ts"() {
9249
9320
  "use strict";
9250
9321
  init_cjs_shims();
@@ -13228,7 +13299,7 @@ var init_src2 = __esm({
13228
13299
  "../../charts/src/index.ts"() {
13229
13300
  "use strict";
13230
13301
  init_cjs_shims();
13231
- init_core2();
13302
+ init_core3();
13232
13303
  init_primitives();
13233
13304
  init_compiler();
13234
13305
  }
@@ -13241,6 +13312,15 @@ __export(chart_bridge_exports, {
13241
13312
  createChartBridge: () => createChartBridge,
13242
13313
  initChartWasm: () => initChartWasm
13243
13314
  });
13315
+ function normalizeAxisForRendering(axis) {
13316
+ const normAxis = (a) => a ? { ...a, type: a.type ?? a.axisType, show: a.show ?? a.visible } : a;
13317
+ return {
13318
+ ...axis,
13319
+ xAxis: normAxis(axis.categoryAxis ?? axis.xAxis),
13320
+ yAxis: normAxis(axis.valueAxis ?? axis.yAxis),
13321
+ secondaryYAxis: normAxis(axis.secondaryValueAxis ?? axis.secondaryYAxis)
13322
+ };
13323
+ }
13244
13324
  function toChartConfig(chart) {
13245
13325
  return {
13246
13326
  type: chart.chartType ?? "bar",
@@ -13255,12 +13335,13 @@ function toChartConfig(chart) {
13255
13335
  title: chart.title,
13256
13336
  subtitle: chart.subtitle,
13257
13337
  legend: chart.legend,
13258
- axis: chart.axis,
13338
+ axis: chart.axis ? normalizeAxisForRendering(chart.axis) : chart.axis,
13259
13339
  colors: chart.colors,
13260
13340
  series: chart.series,
13261
13341
  dataLabels: chart.dataLabels,
13262
13342
  pieSlice: chart.pieSlice,
13263
- trendline: chart.trendline,
13343
+ trendline: Array.isArray(chart.trendline) ? chart.trendline[0] : chart.trendline,
13344
+ trendlines: chart.trendline,
13264
13345
  showLines: chart.showLines,
13265
13346
  smoothLines: chart.smoothLines,
13266
13347
  radarFilled: chart.radarFilled,
@@ -13276,7 +13357,7 @@ function toChartConfig(chart) {
13276
13357
  splitType: chart.splitType,
13277
13358
  splitValue: chart.splitValue,
13278
13359
  subType: chart.subType,
13279
- extra: chart.definition
13360
+ extra: chart.ooxml
13280
13361
  };
13281
13362
  }
13282
13363
  function initChartWasm(exports2) {
@@ -13674,7 +13755,7 @@ var init_chart_bridge = __esm({
13674
13755
  type: "nominal"
13675
13756
  };
13676
13757
  }
13677
- const chartTitle = chart.definition && typeof chart.definition === "object" ? chart.definition.chartTitle : void 0;
13758
+ const chartTitle = chart.ooxml && typeof chart.ooxml === "object" ? chart.ooxml.chartTitle : void 0;
13678
13759
  let titleSpec;
13679
13760
  if (chart.title) {
13680
13761
  titleSpec = {
@@ -13716,7 +13797,7 @@ var init_chart_bridge = __esm({
13716
13797
  if (chart.colors && chart.colors.length > 0) {
13717
13798
  specConfig.range = { category: chart.colors };
13718
13799
  }
13719
- const chartArea = chart.definition && typeof chart.definition === "object" ? chart.definition.chartArea : void 0;
13800
+ const chartArea = chart.ooxml && typeof chart.ooxml === "object" ? chart.ooxml.chartArea : void 0;
13720
13801
  if (chartArea?.fill && typeof chartArea.fill === "object") {
13721
13802
  specConfig.background = chartArea.fill.color;
13722
13803
  }
@@ -15741,10 +15822,11 @@ var init_cell_properties = __esm({
15741
15822
  });
15742
15823
 
15743
15824
  // ../../kernel/src/api/internal/value-conversions.ts
15744
- function viewportCellValueToCellValue(cv) {
15825
+ function normalizeCellValue(cv) {
15826
+ if (cv !== null && isCellError(cv)) return errorDisplayString(cv.value);
15745
15827
  return cv;
15746
15828
  }
15747
- function viewportCellValueToString(cv) {
15829
+ function cellValueToString(cv) {
15748
15830
  if (cv === null || cv === void 0) return "";
15749
15831
  if (typeof cv === "string") return cv;
15750
15832
  if (typeof cv === "number") return String(cv);
@@ -15908,15 +15990,14 @@ function buildBaseFields(data) {
15908
15990
  name: data.name,
15909
15991
  visible: data.visible,
15910
15992
  groupId: data.groupId,
15911
- altText: data.altText,
15993
+ altText: "altText" in data ? data.altText : void 0,
15912
15994
  createdAt: data.createdAt,
15913
15995
  updatedAt: data.updatedAt
15914
15996
  };
15915
15997
  }
15916
- function toShapeObject(data) {
15917
- const d = data;
15998
+ function toShapeObject(d) {
15918
15999
  return {
15919
- ...buildBaseFields(data),
16000
+ ...buildBaseFields(d),
15920
16001
  type: "shape",
15921
16002
  shapeType: d.shapeType ?? "rect",
15922
16003
  fill: d.fill,
@@ -15926,10 +16007,9 @@ function toShapeObject(data) {
15926
16007
  adjustments: d.adjustments
15927
16008
  };
15928
16009
  }
15929
- function toPictureObject(data) {
15930
- const d = data;
16010
+ function toPictureObject(d) {
15931
16011
  return {
15932
- ...buildBaseFields(data),
16012
+ ...buildBaseFields(d),
15933
16013
  type: "picture",
15934
16014
  src: d.src ?? "",
15935
16015
  originalWidth: d.originalWidth ?? 0,
@@ -15938,10 +16018,9 @@ function toPictureObject(data) {
15938
16018
  adjustments: d.adjustments
15939
16019
  };
15940
16020
  }
15941
- function toTextBoxObject(data) {
15942
- const d = data;
16021
+ function toTextBoxObject(d) {
15943
16022
  return {
15944
- ...buildBaseFields(data),
16023
+ ...buildBaseFields(d),
15945
16024
  type: "textbox",
15946
16025
  content: d.content ?? "",
15947
16026
  defaultFormat: d.defaultFormat,
@@ -15952,10 +16031,9 @@ function toTextBoxObject(data) {
15952
16031
  wordArt: d.wordArt
15953
16032
  };
15954
16033
  }
15955
- function toConnectorObject(data) {
15956
- const d = data;
16034
+ function toConnectorObject(d) {
15957
16035
  return {
15958
- ...buildBaseFields(data),
16036
+ ...buildBaseFields(d),
15959
16037
  type: "connector",
15960
16038
  shapeType: d.shapeType ?? "connector",
15961
16039
  startConnection: d.startConnection,
@@ -15964,8 +16042,7 @@ function toConnectorObject(data) {
15964
16042
  outline: d.outline
15965
16043
  };
15966
16044
  }
15967
- function toChartObject(data) {
15968
- const d = data;
16045
+ function toChartObject(d) {
15969
16046
  const chartConfig = {
15970
16047
  subType: d.subType,
15971
16048
  seriesOrientation: d.seriesOrientation,
@@ -15994,41 +16071,38 @@ function toChartObject(data) {
15994
16071
  tableCategoryColumn: d.tableCategoryColumn,
15995
16072
  useTableColumnNamesAsLabels: d.useTableColumnNamesAsLabels,
15996
16073
  tableColumnNames: d.tableColumnNames,
15997
- definition: d.definition,
15998
16074
  ooxml: d.ooxml
15999
16075
  };
16000
16076
  return {
16001
- ...buildBaseFields(data),
16077
+ ...buildBaseFields(d),
16002
16078
  type: "chart",
16003
16079
  chartType: d.chartType ?? "column",
16004
- anchorMode: data.anchor.anchorMode === "twoCell" ? "twoCell" : "oneCell",
16005
- widthCells: d.widthCells ?? data.width ?? 8,
16006
- heightCells: d.heightCells ?? data.height ?? 15,
16080
+ anchorMode: d.anchor.anchorMode === "twoCell" ? "twoCell" : "oneCell",
16081
+ widthCells: d.widthCells ?? d.width ?? 8,
16082
+ heightCells: d.heightCells ?? d.height ?? 15,
16007
16083
  chartConfig,
16008
16084
  dataRangeIdentity: d.dataRangeIdentity,
16009
16085
  seriesRangeIdentity: d.seriesRangeIdentity,
16010
16086
  categoryRangeIdentity: d.categoryRangeIdentity
16011
16087
  };
16012
16088
  }
16013
- function toEquationObject(data) {
16014
- const d = data;
16089
+ function toEquationObject(d) {
16090
+ const equation = typeof d.equation === "string" ? { id: d.id, omml: d.equation } : d.equation;
16015
16091
  return {
16016
- ...buildBaseFields(data),
16092
+ ...buildBaseFields(d),
16017
16093
  type: "equation",
16018
- equation: d.equation
16094
+ equation
16019
16095
  };
16020
16096
  }
16021
- function toSmartArtObject(data) {
16022
- const d = data;
16097
+ function toSmartArtObject(d) {
16023
16098
  return {
16024
- ...buildBaseFields(data),
16099
+ ...buildBaseFields(d),
16025
16100
  type: "smartart",
16026
16101
  diagram: d.definition ?? {}
16027
16102
  };
16028
16103
  }
16029
- function toDrawingObject(data) {
16030
- const common = buildBaseFields(data);
16031
- const d = data;
16104
+ function toDrawingObject(d) {
16105
+ const common = buildBaseFields(d);
16032
16106
  const strokes = /* @__PURE__ */ new Map();
16033
16107
  if (d.strokes) {
16034
16108
  for (const [id, stroke] of Object.entries(d.strokes)) {
@@ -16053,10 +16127,9 @@ function toDrawingObject(data) {
16053
16127
  backgroundColor: d.backgroundColor
16054
16128
  };
16055
16129
  }
16056
- function toOleObjectObject(data) {
16057
- const d = data;
16130
+ function toOleObjectObject(d) {
16058
16131
  return {
16059
- ...buildBaseFields(data),
16132
+ ...buildBaseFields(d),
16060
16133
  type: "oleObject",
16061
16134
  progId: d.progId ?? "",
16062
16135
  dvAspect: d.dvAspect ?? "content",
@@ -16067,8 +16140,7 @@ function toOleObjectObject(data) {
16067
16140
  };
16068
16141
  }
16069
16142
  function toFloatingObject(data) {
16070
- const objectType = data.type ?? "shape";
16071
- switch (objectType) {
16143
+ switch (data.type) {
16072
16144
  case "shape":
16073
16145
  return toShapeObject(data);
16074
16146
  case "picture":
@@ -16088,10 +16160,43 @@ function toFloatingObject(data) {
16088
16160
  case "drawing":
16089
16161
  return toDrawingObject(data);
16090
16162
  case "slicer":
16091
- default:
16092
- return toShapeObject({ ...data, type: "shape" });
16163
+ case "camera":
16164
+ case "formControl":
16165
+ default: {
16166
+ const fallback = Object.assign({}, data, { type: "shape" });
16167
+ return toShapeObject(fallback);
16168
+ }
16093
16169
  }
16094
16170
  }
16171
+ function createMinimalFloatingObject(type, id, sheetId, extras) {
16172
+ const wire = {
16173
+ id,
16174
+ sheetId,
16175
+ type,
16176
+ anchor: {
16177
+ anchorRow: 0,
16178
+ anchorCol: 0,
16179
+ anchorRowOffset: 0,
16180
+ anchorColOffset: 0,
16181
+ anchorMode: "absolute"
16182
+ },
16183
+ width: 100,
16184
+ height: 100,
16185
+ zIndex: 0,
16186
+ rotation: 0,
16187
+ flipH: false,
16188
+ flipV: false,
16189
+ locked: false,
16190
+ visible: true,
16191
+ printable: true,
16192
+ opacity: 1,
16193
+ name: "",
16194
+ createdAt: 0,
16195
+ updatedAt: 0,
16196
+ ...extras
16197
+ };
16198
+ return toFloatingObject(wire);
16199
+ }
16095
16200
  var init_floating_object_mapper = __esm({
16096
16201
  "../../kernel/src/bridges/compute/floating-object-mapper.ts"() {
16097
16202
  "use strict";
@@ -16304,7 +16409,7 @@ function toDisposable(fn) {
16304
16409
  return disposable;
16305
16410
  }
16306
16411
  var DisposableBase, DisposableStore, DisposableNone;
16307
- var init_disposable = __esm({
16412
+ var init_disposable2 = __esm({
16308
16413
  "../../spreadsheet-utils/src/disposable.ts"() {
16309
16414
  "use strict";
16310
16415
  init_cjs_shims();
@@ -16368,7 +16473,7 @@ function ok(value) {
16368
16473
  function err(error) {
16369
16474
  return { ok: false, error };
16370
16475
  }
16371
- var init_result = __esm({
16476
+ var init_result2 = __esm({
16372
16477
  "../../spreadsheet-utils/src/result.ts"() {
16373
16478
  "use strict";
16374
16479
  init_cjs_shims();
@@ -16381,7 +16486,7 @@ var init_subscribable = __esm({
16381
16486
  "../../kernel/src/services/primitives/subscribable.ts"() {
16382
16487
  "use strict";
16383
16488
  init_cjs_shims();
16384
- init_disposable();
16489
+ init_disposable2();
16385
16490
  Subscribable = class extends DisposableBase {
16386
16491
  constructor() {
16387
16492
  super(...arguments);
@@ -16441,7 +16546,7 @@ var init_event_emitter = __esm({
16441
16546
  "../../kernel/src/services/primitives/event-emitter.ts"() {
16442
16547
  "use strict";
16443
16548
  init_cjs_shims();
16444
- init_disposable();
16549
+ init_disposable2();
16445
16550
  TypedEventEmitter = class extends DisposableBase {
16446
16551
  constructor() {
16447
16552
  super(...arguments);
@@ -16506,8 +16611,8 @@ var init_primitives3 = __esm({
16506
16611
  "../../kernel/src/services/primitives/index.ts"() {
16507
16612
  "use strict";
16508
16613
  init_cjs_shims();
16509
- init_disposable();
16510
- init_result();
16614
+ init_disposable2();
16615
+ init_result2();
16511
16616
  init_subscribable();
16512
16617
  init_event_emitter();
16513
16618
  }
@@ -24557,10 +24662,37 @@ var init_equation_bridge = __esm({
24557
24662
  }
24558
24663
  });
24559
24664
 
24665
+ // ../../contracts/src/bridges/ink-recognition-bridge.ts
24666
+ var DEFAULT_RECOGNITION_THRESHOLDS;
24667
+ var init_ink_recognition_bridge = __esm({
24668
+ "../../contracts/src/bridges/ink-recognition-bridge.ts"() {
24669
+ "use strict";
24670
+ init_cjs_shims();
24671
+ DEFAULT_RECOGNITION_THRESHOLDS = {
24672
+ line: 0.7,
24673
+ rectangle: 0.65,
24674
+ ellipse: 0.7,
24675
+ triangle: 0.6,
24676
+ arrow: 0.6,
24677
+ star: 0.65,
24678
+ text: 0.5
24679
+ };
24680
+ }
24681
+ });
24682
+
24683
+ // ../../contracts/src/bridges/index.ts
24684
+ var init_bridges = __esm({
24685
+ "../../contracts/src/bridges/index.ts"() {
24686
+ "use strict";
24687
+ init_cjs_shims();
24688
+ init_ink_recognition_bridge();
24689
+ }
24690
+ });
24691
+
24560
24692
  // ../../kernel/src/domain/drawing/ink-recognition-bridge.ts
24561
24693
  function createInkRecognitionBridge(initialThresholds) {
24562
24694
  let thresholds = {
24563
- ...import_bridges.DEFAULT_RECOGNITION_THRESHOLDS,
24695
+ ...DEFAULT_RECOGNITION_THRESHOLDS,
24564
24696
  ...initialThresholds
24565
24697
  };
24566
24698
  return {
@@ -24973,12 +25105,11 @@ async function recognizeWithBrowserAPI(strokes) {
24973
25105
  }
24974
25106
  return null;
24975
25107
  }
24976
- var import_bridges;
24977
- var init_ink_recognition_bridge = __esm({
25108
+ var init_ink_recognition_bridge2 = __esm({
24978
25109
  "../../kernel/src/domain/drawing/ink-recognition-bridge.ts"() {
24979
25110
  "use strict";
24980
25111
  init_cjs_shims();
24981
- import_bridges = require("@mog-sdk/spreadsheet-contracts/bridges");
25112
+ init_bridges();
24982
25113
  }
24983
25114
  });
24984
25115
 
@@ -25216,7 +25347,7 @@ var init_pivot_bridge = __esm({
25216
25347
  expandedColumns: {}
25217
25348
  };
25218
25349
  try {
25219
- const result = await this.ctx.computeBridge.pivotComputeFromSource(
25350
+ const result = await this.ctx.computeBridge.pivotMaterialize(
25220
25351
  sheetId,
25221
25352
  pivotId,
25222
25353
  expansionState ?? null
@@ -25420,7 +25551,7 @@ var init_pivot_bridge = __esm({
25420
25551
  const rowData = [];
25421
25552
  for (let col = range2.startCol; col <= range2.endCol; col++) {
25422
25553
  const cell = cellMap.get(`${row},${col}`);
25423
- rowData.push(cell ? viewportCellValueToCellValue(cell.value) ?? null : null);
25554
+ rowData.push(cell ? normalizeCellValue(cell.value) ?? null : null);
25424
25555
  }
25425
25556
  data.push(rowData);
25426
25557
  }
@@ -29991,7 +30122,7 @@ var init_arrows = __esm({
29991
30122
 
29992
30123
  // ../../canvas/drawing/shapes/src/presets/constants.ts
29993
30124
  var KAPPA;
29994
- var init_constants = __esm({
30125
+ var init_constants2 = __esm({
29995
30126
  "../../canvas/drawing/shapes/src/presets/constants.ts"() {
29996
30127
  "use strict";
29997
30128
  init_cjs_shims();
@@ -30015,7 +30146,7 @@ var init_primitives4 = __esm({
30015
30146
  "use strict";
30016
30147
  init_cjs_shims();
30017
30148
  init_src3();
30018
- init_constants();
30149
+ init_constants2();
30019
30150
  }
30020
30151
  });
30021
30152
 
@@ -30025,7 +30156,7 @@ var init_basic = __esm({
30025
30156
  "use strict";
30026
30157
  init_cjs_shims();
30027
30158
  init_src3();
30028
- init_constants();
30159
+ init_constants2();
30029
30160
  init_primitives4();
30030
30161
  init_registry3();
30031
30162
  init_primitives4();
@@ -70098,23 +70229,438 @@ var init_rules = __esm({
70098
70229
  }
70099
70230
  });
70100
70231
 
70232
+ // ../../contracts/src/smartart/layouts.ts
70233
+ var init_layouts2 = __esm({
70234
+ "../../contracts/src/smartart/layouts.ts"() {
70235
+ "use strict";
70236
+ init_cjs_shims();
70237
+ }
70238
+ });
70239
+
70240
+ // ../../contracts/src/smartart/ooxml-algorithm-types.ts
70241
+ var ParameterId, VALID_PARAMS_BY_ALGORITHM;
70242
+ var init_ooxml_algorithm_types = __esm({
70243
+ "../../contracts/src/smartart/ooxml-algorithm-types.ts"() {
70244
+ "use strict";
70245
+ init_cjs_shims();
70246
+ ParameterId = {
70247
+ // ── Alignment Parameters ──────────────────────────────────────────────────
70248
+ /** Horizontal alignment of children within the layout area. */
70249
+ horzAlign: "horzAlign",
70250
+ /** Vertical alignment of children within the layout area. */
70251
+ vertAlign: "vertAlign",
70252
+ /** Horizontal alignment for individual nodes (hierarchy algorithms). */
70253
+ nodeHorzAlign: "nodeHorzAlign",
70254
+ /** Vertical alignment for individual nodes (hierarchy algorithms). */
70255
+ nodeVertAlign: "nodeVertAlign",
70256
+ /** Hierarchy alignment (16 possible values for tree orientation). */
70257
+ hierAlign: "hierAlign",
70258
+ /** Text alignment (whether text should be aligned with shape). */
70259
+ alignTx: "alignTx",
70260
+ // ── Direction Parameters ──────────────────────────────────────────────────
70261
+ /** Child direction (horizontal or vertical arrangement of children). */
70262
+ chDir: "chDir",
70263
+ /** Child alignment (how children align on the cross-axis). */
70264
+ chAlign: "chAlign",
70265
+ /** Secondary child alignment (for complex hierarchy layouts). */
70266
+ secChAlign: "secChAlign",
70267
+ /** Linear direction (which edge children flow from). */
70268
+ linDir: "linDir",
70269
+ /** Secondary linear direction (for complex hierarchy layouts). */
70270
+ secLinDir: "secLinDir",
70271
+ /** Text direction (horizontal or vertical text blocks). */
70272
+ txDir: "txDir",
70273
+ /** Text block direction (horizontal or vertical text flow). */
70274
+ txBlDir: "txBlDir",
70275
+ /** Growth direction (which corner the snake starts from). */
70276
+ grDir: "grDir",
70277
+ /** Flow direction (whether snake flows by row or column). */
70278
+ flowDir: "flowDir",
70279
+ /** Continue direction (same direction or reversed for each row). */
70280
+ contDir: "contDir",
70281
+ // ── Connector Parameters ──────────────────────────────────────────────────
70282
+ /** Connector routing style (straight, bend, curve, long curve). */
70283
+ connRout: "connRout",
70284
+ /** Beginning/start arrowhead style for connectors. */
70285
+ begSty: "begSty",
70286
+ /** Ending arrowhead style for connectors. */
70287
+ endSty: "endSty",
70288
+ /** Connector dimension (1D, 2D, or custom). */
70289
+ dim: "dim",
70290
+ /** Source node name for connector routing. */
70291
+ srcNode: "srcNode",
70292
+ /** Destination node name for connector routing. */
70293
+ dstNode: "dstNode",
70294
+ /** Beginning connection points (which points on the source shape). */
70295
+ begPts: "begPts",
70296
+ /** Ending connection points (which points on the destination shape). */
70297
+ endPts: "endPts",
70298
+ /** Bend point position for right-angle connectors. */
70299
+ bendPt: "bendPt",
70300
+ // ── Cycle/Circular Parameters ─────────────────────────────────────────────
70301
+ /** Start angle in degrees for cycle algorithm. */
70302
+ stAng: "stAng",
70303
+ /** Span angle in degrees for cycle algorithm. */
70304
+ spanAng: "spanAng",
70305
+ /** Rotation path (none or along the circular path). */
70306
+ rotPath: "rotPath",
70307
+ /** Center shape mapping (whether first node goes to center). */
70308
+ ctrShpMap: "ctrShpMap",
70309
+ // ── Snake Parameters ──────────────────────────────────────────────────────
70310
+ /** Breakpoint logic for snake wrapping (end of canvas, balanced, fixed). */
70311
+ bkpt: "bkpt",
70312
+ /** Breakpoint fixed value (number of items per row when bkpt=fixed). */
70313
+ bkPtFixedVal: "bkPtFixedVal",
70314
+ /** Offset mode for staggered rows in snake layout. */
70315
+ off: "off",
70316
+ // ── Linear/Sequence Parameters ────────────────────────────────────────────
70317
+ /** Starting element index (which node type starts the alternating sequence). */
70318
+ stElem: "stElem",
70319
+ /** Starting bullet level for text algorithm. */
70320
+ stBulletLvl: "stBulletLvl",
70321
+ // ── Pyramid Parameters ────────────────────────────────────────────────────
70322
+ /** Pyramid accent position (before or after the level). */
70323
+ pyraAcctPos: "pyraAcctPos",
70324
+ /** Pyramid accent text margin (step or stack behavior). */
70325
+ pyraAcctTxMar: "pyraAcctTxMar",
70326
+ /** Pyramid level node name. */
70327
+ pyraLvlNode: "pyraLvlNode",
70328
+ /** Pyramid accent background node name. */
70329
+ pyraAcctBkgdNode: "pyraAcctBkgdNode",
70330
+ /** Pyramid accent text node name. */
70331
+ pyraAcctTxNode: "pyraAcctTxNode",
70332
+ // ── Text Parameters ───────────────────────────────────────────────────────
70333
+ /** Parent text LTR alignment. */
70334
+ parTxLTRAlign: "parTxLTRAlign",
70335
+ /** Parent text RTL alignment. */
70336
+ parTxRTLAlign: "parTxRTLAlign",
70337
+ /** Shape text LTR alignment for children. */
70338
+ shpTxLTRAlignCh: "shpTxLTRAlignCh",
70339
+ /** Shape text RTL alignment for children. */
70340
+ shpTxRTLAlignCh: "shpTxRTLAlignCh",
70341
+ /** Text anchor horizontal position. */
70342
+ txAnchorHorz: "txAnchorHorz",
70343
+ /** Text anchor vertical position. */
70344
+ txAnchorVert: "txAnchorVert",
70345
+ /** Text anchor horizontal position for children. */
70346
+ txAnchorHorzCh: "txAnchorHorzCh",
70347
+ /** Text anchor vertical position for children. */
70348
+ txAnchorVertCh: "txAnchorVertCh",
70349
+ /** Auto text rotation mode (none, upright, gravity-based). */
70350
+ autoTxRot: "autoTxRot",
70351
+ // ── Spacing & Sizing Parameters ───────────────────────────────────────────
70352
+ /** Aspect ratio value. */
70353
+ ar: "ar",
70354
+ /** Line spacing for parent text (percentage). */
70355
+ lnSpPar: "lnSpPar",
70356
+ /** Line spacing after parent paragraph (percentage). */
70357
+ lnSpAfParP: "lnSpAfParP",
70358
+ /** Line spacing for child text (percentage). */
70359
+ lnSpCh: "lnSpCh",
70360
+ /** Line spacing after child paragraph (percentage). */
70361
+ lnSpAfChP: "lnSpAfChP",
70362
+ // ── Hierarchy-Specific Parameters ─────────────────────────────────────────
70363
+ /** Root short distance flag (hierarchy algorithms). */
70364
+ rtShortDist: "rtShortDist",
70365
+ // ── Fallback Parameter ────────────────────────────────────────────────────
70366
+ /** Fallback dimension for the algorithm. */
70367
+ fallback: "fallback"
70368
+ };
70369
+ VALID_PARAMS_BY_ALGORITHM = {
70370
+ composite: [ParameterId.ar],
70371
+ lin: [
70372
+ ParameterId.linDir,
70373
+ ParameterId.chDir,
70374
+ ParameterId.chAlign,
70375
+ ParameterId.horzAlign,
70376
+ ParameterId.vertAlign,
70377
+ ParameterId.stElem,
70378
+ ParameterId.fallback,
70379
+ ParameterId.nodeHorzAlign,
70380
+ ParameterId.nodeVertAlign
70381
+ ],
70382
+ snake: [
70383
+ ParameterId.grDir,
70384
+ ParameterId.flowDir,
70385
+ ParameterId.contDir,
70386
+ ParameterId.bkpt,
70387
+ ParameterId.bkPtFixedVal,
70388
+ ParameterId.off
70389
+ ],
70390
+ cycle: [ParameterId.stAng, ParameterId.spanAng, ParameterId.rotPath, ParameterId.ctrShpMap],
70391
+ hierRoot: [
70392
+ ParameterId.hierAlign,
70393
+ ParameterId.nodeHorzAlign,
70394
+ ParameterId.nodeVertAlign,
70395
+ ParameterId.rtShortDist
70396
+ ],
70397
+ hierChild: [
70398
+ ParameterId.chAlign,
70399
+ ParameterId.linDir,
70400
+ ParameterId.secChAlign,
70401
+ ParameterId.secLinDir
70402
+ ],
70403
+ pyra: [
70404
+ ParameterId.linDir,
70405
+ ParameterId.txDir,
70406
+ ParameterId.pyraAcctPos,
70407
+ ParameterId.pyraAcctTxMar,
70408
+ ParameterId.pyraLvlNode,
70409
+ ParameterId.pyraAcctBkgdNode,
70410
+ ParameterId.pyraAcctTxNode
70411
+ ],
70412
+ conn: [
70413
+ ParameterId.srcNode,
70414
+ ParameterId.dstNode,
70415
+ ParameterId.connRout,
70416
+ ParameterId.begSty,
70417
+ ParameterId.endSty,
70418
+ ParameterId.dim,
70419
+ ParameterId.bendPt,
70420
+ ParameterId.begPts,
70421
+ ParameterId.endPts
70422
+ ],
70423
+ tx: [
70424
+ ParameterId.parTxLTRAlign,
70425
+ ParameterId.parTxRTLAlign,
70426
+ ParameterId.shpTxLTRAlignCh,
70427
+ ParameterId.shpTxRTLAlignCh,
70428
+ ParameterId.txAnchorVert,
70429
+ ParameterId.txAnchorHorz,
70430
+ ParameterId.txAnchorVertCh,
70431
+ ParameterId.txAnchorHorzCh,
70432
+ ParameterId.txBlDir,
70433
+ ParameterId.autoTxRot,
70434
+ ParameterId.stBulletLvl,
70435
+ ParameterId.lnSpPar,
70436
+ ParameterId.lnSpAfParP,
70437
+ ParameterId.lnSpCh,
70438
+ ParameterId.lnSpAfChP,
70439
+ ParameterId.alignTx
70440
+ ],
70441
+ sp: []
70442
+ };
70443
+ }
70444
+ });
70445
+
70446
+ // ../../contracts/src/smartart/ooxml-data-model-types.ts
70447
+ var init_ooxml_data_model_types = __esm({
70448
+ "../../contracts/src/smartart/ooxml-data-model-types.ts"() {
70449
+ "use strict";
70450
+ init_cjs_shims();
70451
+ }
70452
+ });
70453
+
70454
+ // ../../contracts/src/smartart/ooxml-drawing-types.ts
70455
+ var init_ooxml_drawing_types = __esm({
70456
+ "../../contracts/src/smartart/ooxml-drawing-types.ts"() {
70457
+ "use strict";
70458
+ init_cjs_shims();
70459
+ }
70460
+ });
70461
+
70462
+ // ../../contracts/src/smartart/ooxml-engine-types.ts
70463
+ var POSITIONAL_CONSTRAINT_TYPES, DIMENSIONAL_CONSTRAINT_TYPES, MARGIN_CONSTRAINT_TYPES, FONT_CONSTRAINT_TYPES, SPACING_CONSTRAINT_TYPES, GEOMETRY_CONSTRAINT_TYPES, USER_DEFINED_CONSTRAINT_TYPES, ALL_CONSTRAINT_TYPES, ALL_ELEMENT_TYPES, ALL_FUNCTION_TYPES, ALL_FUNCTION_OPERATORS, ALL_FUNCTION_ARGUMENTS;
70464
+ var init_ooxml_engine_types = __esm({
70465
+ "../../contracts/src/smartart/ooxml-engine-types.ts"() {
70466
+ "use strict";
70467
+ init_cjs_shims();
70468
+ POSITIONAL_CONSTRAINT_TYPES = [
70469
+ "l",
70470
+ "t",
70471
+ "r",
70472
+ "b",
70473
+ "lOff",
70474
+ "tOff",
70475
+ "rOff",
70476
+ "bOff",
70477
+ "ctrX",
70478
+ "ctrY",
70479
+ "ctrXOff",
70480
+ "ctrYOff"
70481
+ ];
70482
+ DIMENSIONAL_CONSTRAINT_TYPES = [
70483
+ "w",
70484
+ "h",
70485
+ "wOff",
70486
+ "hOff"
70487
+ ];
70488
+ MARGIN_CONSTRAINT_TYPES = [
70489
+ "lMarg",
70490
+ "tMarg",
70491
+ "rMarg",
70492
+ "bMarg",
70493
+ "begMarg",
70494
+ "endMarg"
70495
+ ];
70496
+ FONT_CONSTRAINT_TYPES = [
70497
+ "primFontSz",
70498
+ "secFontSz"
70499
+ ];
70500
+ SPACING_CONSTRAINT_TYPES = [
70501
+ "sp",
70502
+ "sibSp",
70503
+ "secSibSp"
70504
+ ];
70505
+ GEOMETRY_CONSTRAINT_TYPES = [
70506
+ "connDist",
70507
+ "diam",
70508
+ "stemThick",
70509
+ "begPad",
70510
+ "endPad",
70511
+ "wArH",
70512
+ "hArH",
70513
+ "bendDist"
70514
+ ];
70515
+ USER_DEFINED_CONSTRAINT_TYPES = [
70516
+ "userA",
70517
+ "userB",
70518
+ "userC",
70519
+ "userD",
70520
+ "userE",
70521
+ "userF",
70522
+ "userG",
70523
+ "userH",
70524
+ "userI",
70525
+ "userJ",
70526
+ "userK",
70527
+ "userL",
70528
+ "userM",
70529
+ "userN",
70530
+ "userO",
70531
+ "userP",
70532
+ "userQ",
70533
+ "userR",
70534
+ "userS",
70535
+ "userT",
70536
+ "userU",
70537
+ "userV",
70538
+ "userW",
70539
+ "userX",
70540
+ "userY",
70541
+ "userZ"
70542
+ ];
70543
+ ALL_CONSTRAINT_TYPES = [
70544
+ ...POSITIONAL_CONSTRAINT_TYPES,
70545
+ ...DIMENSIONAL_CONSTRAINT_TYPES,
70546
+ ...MARGIN_CONSTRAINT_TYPES,
70547
+ ...FONT_CONSTRAINT_TYPES,
70548
+ ...SPACING_CONSTRAINT_TYPES,
70549
+ ...GEOMETRY_CONSTRAINT_TYPES,
70550
+ "pyraAcctRatio",
70551
+ "alignOff",
70552
+ ...USER_DEFINED_CONSTRAINT_TYPES,
70553
+ "none"
70554
+ ];
70555
+ ALL_ELEMENT_TYPES = [
70556
+ "all",
70557
+ "doc",
70558
+ "node",
70559
+ "norm",
70560
+ "nonNorm",
70561
+ "asst",
70562
+ "nonAsst",
70563
+ "parTrans",
70564
+ "pres",
70565
+ "sibTrans"
70566
+ ];
70567
+ ALL_FUNCTION_TYPES = [
70568
+ "cnt",
70569
+ "pos",
70570
+ "revPos",
70571
+ "posEven",
70572
+ "posOdd",
70573
+ "var",
70574
+ "depth",
70575
+ "maxDepth"
70576
+ ];
70577
+ ALL_FUNCTION_OPERATORS = [
70578
+ "equ",
70579
+ "neq",
70580
+ "gt",
70581
+ "lt",
70582
+ "gte",
70583
+ "lte"
70584
+ ];
70585
+ ALL_FUNCTION_ARGUMENTS = [
70586
+ "none",
70587
+ "orgChart",
70588
+ "chMax",
70589
+ "chPref",
70590
+ "bulEnabled",
70591
+ "dir",
70592
+ "hierBranch",
70593
+ "animOne",
70594
+ "animLvl",
70595
+ "resizeHandles"
70596
+ ];
70597
+ }
70598
+ });
70599
+
70600
+ // ../../contracts/src/smartart/ooxml-layout-types.ts
70601
+ var init_ooxml_layout_types = __esm({
70602
+ "../../contracts/src/smartart/ooxml-layout-types.ts"() {
70603
+ "use strict";
70604
+ init_cjs_shims();
70605
+ }
70606
+ });
70607
+
70608
+ // ../../contracts/src/smartart/ooxml-style-types.ts
70609
+ var init_ooxml_style_types = __esm({
70610
+ "../../contracts/src/smartart/ooxml-style-types.ts"() {
70611
+ "use strict";
70612
+ init_cjs_shims();
70613
+ }
70614
+ });
70615
+
70616
+ // ../../contracts/src/smartart/styles.ts
70617
+ var init_styles3 = __esm({
70618
+ "../../contracts/src/smartart/styles.ts"() {
70619
+ "use strict";
70620
+ init_cjs_shims();
70621
+ }
70622
+ });
70623
+
70624
+ // ../../contracts/src/smartart/types.ts
70625
+ var init_types4 = __esm({
70626
+ "../../contracts/src/smartart/types.ts"() {
70627
+ "use strict";
70628
+ init_cjs_shims();
70629
+ }
70630
+ });
70631
+
70632
+ // ../../contracts/src/smartart/index.ts
70633
+ var init_smartart = __esm({
70634
+ "../../contracts/src/smartart/index.ts"() {
70635
+ "use strict";
70636
+ init_cjs_shims();
70637
+ init_layouts2();
70638
+ init_ooxml_algorithm_types();
70639
+ init_ooxml_data_model_types();
70640
+ init_ooxml_drawing_types();
70641
+ init_ooxml_engine_types();
70642
+ init_ooxml_layout_types();
70643
+ init_ooxml_style_types();
70644
+ init_styles3();
70645
+ init_types4();
70646
+ }
70647
+ });
70648
+
70101
70649
  // ../../canvas/drawing/smartart/src/engine/algorithms/composite.ts
70102
- var import_smartart2;
70103
70650
  var init_composite = __esm({
70104
70651
  "../../canvas/drawing/smartart/src/engine/algorithms/composite.ts"() {
70105
70652
  "use strict";
70106
70653
  init_cjs_shims();
70107
- import_smartart2 = require("@mog-sdk/spreadsheet-contracts/smartart");
70654
+ init_smartart();
70108
70655
  }
70109
70656
  });
70110
70657
 
70111
70658
  // ../../canvas/drawing/smartart/src/engine/algorithms/linear.ts
70112
- var import_smartart3;
70113
70659
  var init_linear2 = __esm({
70114
70660
  "../../canvas/drawing/smartart/src/engine/algorithms/linear.ts"() {
70115
70661
  "use strict";
70116
70662
  init_cjs_shims();
70117
- import_smartart3 = require("@mog-sdk/spreadsheet-contracts/smartart");
70663
+ init_smartart();
70118
70664
  }
70119
70665
  });
70120
70666
 
@@ -70127,90 +70673,82 @@ var init_param_utils = __esm({
70127
70673
  });
70128
70674
 
70129
70675
  // ../../canvas/drawing/smartart/src/engine/algorithms/snake.ts
70130
- var import_smartart4;
70131
70676
  var init_snake = __esm({
70132
70677
  "../../canvas/drawing/smartart/src/engine/algorithms/snake.ts"() {
70133
70678
  "use strict";
70134
70679
  init_cjs_shims();
70135
- import_smartart4 = require("@mog-sdk/spreadsheet-contracts/smartart");
70680
+ init_smartart();
70136
70681
  init_param_utils();
70137
70682
  }
70138
70683
  });
70139
70684
 
70140
70685
  // ../../canvas/drawing/smartart/src/engine/algorithms/cycle.ts
70141
- var import_smartart5;
70142
70686
  var init_cycle2 = __esm({
70143
70687
  "../../canvas/drawing/smartart/src/engine/algorithms/cycle.ts"() {
70144
70688
  "use strict";
70145
70689
  init_cjs_shims();
70146
- import_smartart5 = require("@mog-sdk/spreadsheet-contracts/smartart");
70690
+ init_smartart();
70147
70691
  init_param_utils();
70148
70692
  }
70149
70693
  });
70150
70694
 
70151
70695
  // ../../canvas/drawing/smartart/src/engine/algorithms/hier-root.ts
70152
- var import_smartart6;
70153
70696
  var init_hier_root = __esm({
70154
70697
  "../../canvas/drawing/smartart/src/engine/algorithms/hier-root.ts"() {
70155
70698
  "use strict";
70156
70699
  init_cjs_shims();
70157
- import_smartart6 = require("@mog-sdk/spreadsheet-contracts/smartart");
70700
+ init_smartart();
70158
70701
  init_param_utils();
70159
70702
  }
70160
70703
  });
70161
70704
 
70162
70705
  // ../../canvas/drawing/smartart/src/engine/algorithms/hier-child.ts
70163
- var import_smartart7;
70164
70706
  var init_hier_child = __esm({
70165
70707
  "../../canvas/drawing/smartart/src/engine/algorithms/hier-child.ts"() {
70166
70708
  "use strict";
70167
70709
  init_cjs_shims();
70168
- import_smartart7 = require("@mog-sdk/spreadsheet-contracts/smartart");
70710
+ init_smartart();
70169
70711
  init_param_utils();
70170
70712
  }
70171
70713
  });
70172
70714
 
70173
70715
  // ../../canvas/drawing/smartart/src/engine/algorithms/pyramid.ts
70174
- var import_smartart8;
70175
70716
  var init_pyramid2 = __esm({
70176
70717
  "../../canvas/drawing/smartart/src/engine/algorithms/pyramid.ts"() {
70177
70718
  "use strict";
70178
70719
  init_cjs_shims();
70179
- import_smartart8 = require("@mog-sdk/spreadsheet-contracts/smartart");
70720
+ init_smartart();
70180
70721
  init_param_utils();
70181
70722
  }
70182
70723
  });
70183
70724
 
70184
70725
  // ../../canvas/drawing/smartart/src/engine/algorithms/connector.ts
70185
- var import_smartart9;
70186
70726
  var init_connector = __esm({
70187
70727
  "../../canvas/drawing/smartart/src/engine/algorithms/connector.ts"() {
70188
70728
  "use strict";
70189
70729
  init_cjs_shims();
70190
- import_smartart9 = require("@mog-sdk/spreadsheet-contracts/smartart");
70730
+ init_smartart();
70191
70731
  init_connector_routing();
70192
70732
  init_param_utils();
70193
70733
  }
70194
70734
  });
70195
70735
 
70196
70736
  // ../../canvas/drawing/smartart/src/engine/algorithms/text.ts
70197
- var import_smartart10;
70198
70737
  var init_text3 = __esm({
70199
70738
  "../../canvas/drawing/smartart/src/engine/algorithms/text.ts"() {
70200
70739
  "use strict";
70201
70740
  init_cjs_shims();
70202
- import_smartart10 = require("@mog-sdk/spreadsheet-contracts/smartart");
70741
+ init_smartart();
70203
70742
  init_param_utils();
70204
70743
  }
70205
70744
  });
70206
70745
 
70207
70746
  // ../../canvas/drawing/smartart/src/engine/algorithms/space.ts
70208
- var import_smartart11;
70209
70747
  var init_space = __esm({
70210
70748
  "../../canvas/drawing/smartart/src/engine/algorithms/space.ts"() {
70211
70749
  "use strict";
70212
70750
  init_cjs_shims();
70213
- import_smartart11 = require("@mog-sdk/spreadsheet-contracts/smartart");
70751
+ init_smartart();
70214
70752
  }
70215
70753
  });
70216
70754
 
@@ -70369,19 +70907,19 @@ var init_drawing_parser = __esm({
70369
70907
  });
70370
70908
 
70371
70909
  // ../../canvas/drawing/smartart/src/parser/layout-def-parser.ts
70372
- var import_smartart12, VALID_ELEMENT_TYPES, VALID_FUNCTION_TYPES, VALID_FUNCTION_OPERATORS, VALID_FUNCTION_ARGUMENTS;
70910
+ var VALID_ELEMENT_TYPES, VALID_FUNCTION_TYPES, VALID_FUNCTION_OPERATORS, VALID_FUNCTION_ARGUMENTS;
70373
70911
  var init_layout_def_parser = __esm({
70374
70912
  "../../canvas/drawing/smartart/src/parser/layout-def-parser.ts"() {
70375
70913
  "use strict";
70376
70914
  init_cjs_shims();
70377
- import_smartart12 = require("@mog-sdk/spreadsheet-contracts/smartart");
70915
+ init_smartart();
70378
70916
  init_data_model_parser();
70379
70917
  init_drawingml_helpers();
70380
70918
  init_xml_helpers();
70381
- VALID_ELEMENT_TYPES = new Set(import_smartart12.ALL_ELEMENT_TYPES);
70382
- VALID_FUNCTION_TYPES = new Set(import_smartart12.ALL_FUNCTION_TYPES);
70383
- VALID_FUNCTION_OPERATORS = new Set(import_smartart12.ALL_FUNCTION_OPERATORS);
70384
- VALID_FUNCTION_ARGUMENTS = new Set(import_smartart12.ALL_FUNCTION_ARGUMENTS);
70919
+ VALID_ELEMENT_TYPES = new Set(ALL_ELEMENT_TYPES);
70920
+ VALID_FUNCTION_TYPES = new Set(ALL_FUNCTION_TYPES);
70921
+ VALID_FUNCTION_OPERATORS = new Set(ALL_FUNCTION_OPERATORS);
70922
+ VALID_FUNCTION_ARGUMENTS = new Set(ALL_FUNCTION_ARGUMENTS);
70385
70923
  }
70386
70924
  });
70387
70925
 
@@ -74276,7 +74814,7 @@ var init_cell_anchor_resolver = __esm({
74276
74814
  });
74277
74815
 
74278
74816
  // ../../kernel/src/floating-objects/types.ts
74279
- var init_types4 = __esm({
74817
+ var init_types5 = __esm({
74280
74818
  "../../kernel/src/floating-objects/types.ts"() {
74281
74819
  "use strict";
74282
74820
  init_cjs_shims();
@@ -74375,7 +74913,7 @@ var init_picture_manager = __esm({
74375
74913
  "use strict";
74376
74914
  init_cjs_shims();
74377
74915
  init_document();
74378
- init_types4();
74916
+ init_types5();
74379
74917
  }
74380
74918
  });
74381
74919
 
@@ -74477,7 +75015,7 @@ var init_textbox_manager = __esm({
74477
75015
  "../../kernel/src/floating-objects/managers/textbox-manager.ts"() {
74478
75016
  "use strict";
74479
75017
  init_cjs_shims();
74480
- init_types4();
75018
+ init_types5();
74481
75019
  DEFAULT_TEXTBOX_FILL = { type: "solid", color: "#ffffff" };
74482
75020
  DEFAULT_TEXTBOX_BORDER = { style: "solid", color: "#000000", width: 1 };
74483
75021
  }
@@ -75658,7 +76196,7 @@ var init_kernel_context = __esm({
75658
76196
  init_cjs_shims();
75659
76197
  init_chart_bridge();
75660
76198
  init_equation_bridge();
75661
- init_ink_recognition_bridge();
76199
+ init_ink_recognition_bridge2();
75662
76200
  init_locale_bridge();
75663
76201
  init_pivot_bridge();
75664
76202
  init_schema_bridge();
@@ -76680,7 +77218,20 @@ var WorkbookHistoryImpl = class {
76680
77218
 
76681
77219
  // ../../kernel/src/api/workbook/names.ts
76682
77220
  init_cjs_shims();
76683
- var import_api = require("@mog-sdk/spreadsheet-contracts/api");
77221
+
77222
+ // ../../contracts/src/api/index.ts
77223
+ init_cjs_shims();
77224
+
77225
+ // ../../contracts/src/api/types.ts
77226
+ init_cjs_shims();
77227
+
77228
+ // ../../contracts/src/api/worksheet/index.ts
77229
+ init_cjs_shims();
77230
+
77231
+ // ../../contracts/src/api/worksheet/format-mappings.ts
77232
+ init_cjs_shims();
77233
+
77234
+ // ../../kernel/src/api/workbook/names.ts
76684
77235
  init_errors();
76685
77236
 
76686
77237
  // ../../kernel/src/domain/formulas/named-ranges.ts
@@ -77303,13 +77854,13 @@ var WorkbookNamesImpl = class {
77303
77854
  if (!values) return null;
77304
77855
  return values.map(
77305
77856
  (row) => row.map((cell) => {
77306
- if (cell === null || cell === void 0) return import_api.RangeValueType.Empty;
77307
- if (typeof cell === "boolean") return import_api.RangeValueType.Boolean;
77308
- if (typeof cell === "number") return import_api.RangeValueType.Double;
77309
- if (typeof cell === "string") return import_api.RangeValueType.String;
77857
+ if (cell === null || cell === void 0) return "Empty" /* Empty */;
77858
+ if (typeof cell === "boolean") return "Boolean" /* Boolean */;
77859
+ if (typeof cell === "number") return "Double" /* Double */;
77860
+ if (typeof cell === "string") return "String" /* String */;
77310
77861
  if (typeof cell === "object" && cell !== null && "type" in cell)
77311
- return import_api.RangeValueType.Error;
77312
- return import_api.RangeValueType.String;
77862
+ return "Error" /* Error */;
77863
+ return "String" /* String */;
77313
77864
  })
77314
77865
  );
77315
77866
  }
@@ -77401,7 +77952,7 @@ var BUILT_IN_LISTS = [
77401
77952
  ];
77402
77953
 
77403
77954
  // ../../kernel/src/domain/workbook/workbook.ts
77404
- var import_protection2 = require("@mog-sdk/spreadsheet-contracts/protection");
77955
+ init_protection();
77405
77956
 
77406
77957
  // ../../spreadsheet-utils/src/protection.ts
77407
77958
  init_cjs_shims();
@@ -77441,7 +77992,7 @@ async function setSelectedSheetIds(ctx, sheetIds, _origin = "user") {
77441
77992
  }
77442
77993
  async function protect(ctx, password, options, _origin = "user") {
77443
77994
  const fullOptions = {
77444
- ...import_protection2.DEFAULT_WORKBOOK_PROTECTION_OPTIONS,
77995
+ ...DEFAULT_WORKBOOK_PROTECTION_OPTIONS,
77445
77996
  ...options
77446
77997
  };
77447
77998
  const current = await getSettings(ctx);
@@ -77857,7 +78408,7 @@ init_sheet_meta();
77857
78408
 
77858
78409
  // ../../kernel/src/api/worksheet/worksheet-impl.ts
77859
78410
  init_cjs_shims();
77860
- var import_core6 = require("@mog-sdk/spreadsheet-contracts/core");
78411
+ init_core2();
77861
78412
  init_errors3();
77862
78413
  init_errors();
77863
78414
 
@@ -78877,22 +79428,18 @@ async function batchGetCellPositions(ctx, sheetId, cellIds) {
78877
79428
 
78878
79429
  // ../../kernel/src/api/worksheet/operations/dependency-operations.ts
78879
79430
  init_cjs_shims();
78880
- function colToLetter4(col) {
78881
- let result = "";
78882
- let c = col;
78883
- while (c >= 0) {
78884
- result = String.fromCharCode(c % 26 + 65) + result;
78885
- c = Math.floor(c / 26) - 1;
78886
- }
78887
- return result;
78888
- }
79431
+ init_a1();
78889
79432
  async function getDependents(ctx, sheetId, row, col) {
78890
79433
  const results = await ctx.computeBridge.getDependents(sheetId, row, col);
78891
- return results.map((r) => `${colToLetter4(r.col)}${r.row + 1}`);
79434
+ return results.map(
79435
+ (r) => r.sheetId === sheetId ? toA12(r.row, r.col) : toSheetA1(r.row, r.col, r.sheetName)
79436
+ );
78892
79437
  }
78893
79438
  async function getPrecedents(ctx, sheetId, row, col) {
78894
79439
  const results = await ctx.computeBridge.getPrecedents(sheetId, row, col);
78895
- return results.map((r) => `${colToLetter4(r.col)}${r.row + 1}`);
79440
+ return results.map(
79441
+ (r) => r.sheetId === sheetId ? toA12(r.row, r.col) : toSheetA1(r.row, r.col, r.sheetName)
79442
+ );
78896
79443
  }
78897
79444
 
78898
79445
  // ../../kernel/src/api/worksheet/operations/fill-operations.ts
@@ -79213,7 +79760,7 @@ async function findCells(ctx, sheetId, predicate) {
79213
79760
  const results = [];
79214
79761
  for (const cell of rangeResult.cells) {
79215
79762
  const cellData = {
79216
- value: viewportCellValueToCellValue(cell.value),
79763
+ value: normalizeCellValue(cell.value),
79217
79764
  formula: cell.formula
79218
79765
  };
79219
79766
  if (predicate(cellData, cell.row, cell.col)) {
@@ -79266,18 +79813,18 @@ async function regexSearch(ctx, sheetId, patterns, options) {
79266
79813
  bounds.maxCol
79267
79814
  );
79268
79815
  for (const cell of rangeResult.cells) {
79269
- const valueStr = cell.formatted ?? viewportCellValueToString(cell.value);
79816
+ const valueStr = cell.formatted ?? cellValueToString(cell.value);
79270
79817
  for (const { regex, source } of compiledPatterns) {
79271
79818
  regex.lastIndex = 0;
79272
79819
  if (regex.test(valueStr)) {
79273
- const address = `${colToLetter3(cell.col)}${cell.row + 1}`;
79820
+ const address = toA12(cell.row, cell.col);
79274
79821
  results.push({ address, value: valueStr, sheetName, matchedPattern: source });
79275
79822
  break;
79276
79823
  }
79277
79824
  if (options?.includeFormulas && cell.formula) {
79278
79825
  regex.lastIndex = 0;
79279
79826
  if (regex.test(cell.formula)) {
79280
- const address = `${colToLetter3(cell.col)}${cell.row + 1}`;
79827
+ const address = toA12(cell.row, cell.col);
79281
79828
  results.push({ address, value: valueStr, sheetName, matchedPattern: source });
79282
79829
  break;
79283
79830
  }
@@ -79310,9 +79857,9 @@ async function getRangeWithIdentity(ctx, sheetId, startRow, startCol, endRow, en
79310
79857
  cellId: cell.cellId,
79311
79858
  row: cell.row,
79312
79859
  col: cell.col,
79313
- value: viewportCellValueToCellValue(cell.value),
79860
+ value: normalizeCellValue(cell.value),
79314
79861
  formulaText: cell.formula,
79315
- displayString: cell.formatted ?? viewportCellValueToString(cell.value)
79862
+ displayString: cell.formatted ?? cellValueToString(cell.value)
79316
79863
  }));
79317
79864
  }
79318
79865
 
@@ -79341,7 +79888,7 @@ async function getRange(ctx, sheetId, range2) {
79341
79888
  if (!cell) {
79342
79889
  rowData.push({ value: null });
79343
79890
  } else {
79344
- const value = viewportCellValueToCellValue(cell.value);
79891
+ const value = normalizeCellValue(cell.value);
79345
79892
  rowData.push({
79346
79893
  value: value ?? null,
79347
79894
  formula: cell.formula,
@@ -79444,7 +79991,6 @@ async function clearRange2(ctx, sheetId, range2) {
79444
79991
 
79445
79992
  // ../../kernel/src/api/worksheet/operations/range-query-operations.ts
79446
79993
  init_cjs_shims();
79447
- var import_api3 = require("@mog-sdk/spreadsheet-contracts/api");
79448
79994
  init_a1();
79449
79995
  init_value_conversions();
79450
79996
  async function clearWithMode(ctx, sheetId, range2, applyTo = "all") {
@@ -79520,7 +80066,7 @@ async function getDisplayText(ctx, sheetId, range2) {
79520
80066
  if (!cell) {
79521
80067
  rowData.push("");
79522
80068
  } else {
79523
- rowData.push(cell.formatted ?? viewportCellValueToString(cell.value));
80069
+ rowData.push(cell.formatted ?? cellValueToString(cell.value));
79524
80070
  }
79525
80071
  }
79526
80072
  result.push(rowData);
@@ -79546,9 +80092,9 @@ async function getValueTypes(ctx, sheetId, range2) {
79546
80092
  for (let col = n.startCol; col <= n.endCol; col++) {
79547
80093
  const cell = cellMap.get(`${row},${col}`);
79548
80094
  if (!cell) {
79549
- rowData.push(import_api3.RangeValueType.Empty);
80095
+ rowData.push("Empty" /* Empty */);
79550
80096
  } else {
79551
- rowData.push(classifyValueType(viewportCellValueToCellValue(cell.value)));
80097
+ rowData.push(classifyValueType(normalizeCellValue(cell.value)));
79552
80098
  }
79553
80099
  }
79554
80100
  result.push(rowData);
@@ -79556,12 +80102,16 @@ async function getValueTypes(ctx, sheetId, range2) {
79556
80102
  return result;
79557
80103
  }
79558
80104
  function classifyValueType(value) {
79559
- if (value === null || value === void 0) return import_api3.RangeValueType.Empty;
79560
- if (typeof value === "string") return value === "" ? import_api3.RangeValueType.Empty : import_api3.RangeValueType.String;
79561
- if (typeof value === "number") return import_api3.RangeValueType.Double;
79562
- if (typeof value === "boolean") return import_api3.RangeValueType.Boolean;
79563
- if (typeof value === "object" && value !== null && "type" in value) return import_api3.RangeValueType.Error;
79564
- return import_api3.RangeValueType.String;
80105
+ if (value === null || value === void 0) return "Empty" /* Empty */;
80106
+ if (typeof value === "string") {
80107
+ if (value === "") return "Empty" /* Empty */;
80108
+ if (value.startsWith("#")) return "Error" /* Error */;
80109
+ return "String" /* String */;
80110
+ }
80111
+ if (typeof value === "number") return "Double" /* Double */;
80112
+ if (typeof value === "boolean") return "Boolean" /* Boolean */;
80113
+ if (typeof value === "object" && value !== null && "type" in value) return "Error" /* Error */;
80114
+ return "String" /* String */;
79565
80115
  }
79566
80116
  async function findInRange(ctx, sheetId, range2, text, options) {
79567
80117
  const n = normalizeRange(range2);
@@ -79583,7 +80133,7 @@ async function findInRange(ctx, sheetId, range2, text, options) {
79583
80133
  n.endCol
79584
80134
  );
79585
80135
  for (const cell of rangeResult.cells) {
79586
- const valueStr = cell.formatted ?? viewportCellValueToString(cell.value);
80136
+ const valueStr = cell.formatted ?? cellValueToString(cell.value);
79587
80137
  if (pattern.test(valueStr)) {
79588
80138
  return {
79589
80139
  address: `${colToLetter3(cell.col)}${cell.row + 1}`,
@@ -79615,7 +80165,7 @@ async function replaceAll(ctx, sheetId, range2, text, replacement, options) {
79615
80165
  const edits = [];
79616
80166
  for (const cell of rangeResult.cells) {
79617
80167
  if (cell.formula) continue;
79618
- const valueStr = viewportCellValueToString(cell.value);
80168
+ const valueStr = cellValueToString(cell.value);
79619
80169
  if (!valueStr) continue;
79620
80170
  pattern.lastIndex = 0;
79621
80171
  if (pattern.test(valueStr)) {
@@ -79658,46 +80208,46 @@ async function getNumberFormatCategories(ctx, sheetId, range2) {
79658
80208
  }
79659
80209
  function detectFormatType(formatCode) {
79660
80210
  if (!formatCode || formatCode === "" || formatCode === "General") {
79661
- return import_api3.NumberFormatCategory.General;
80211
+ return "General" /* General */;
79662
80212
  }
79663
80213
  if (formatCode === "@") {
79664
- return import_api3.NumberFormatCategory.Text;
80214
+ return "Text" /* Text */;
79665
80215
  }
79666
80216
  const stripped = formatCode.replace(/\[[^\]]*\]/g, "").replace(/"[^"]*"/g, "");
79667
80217
  if (/[yYmMdD]/.test(stripped) && /[yYdD]/.test(stripped)) {
79668
- return import_api3.NumberFormatCategory.Date;
80218
+ return "Date" /* Date */;
79669
80219
  }
79670
80220
  if (/[hHsS]/.test(stripped)) {
79671
80221
  if (/[yYdD]/.test(stripped)) {
79672
- return import_api3.NumberFormatCategory.Date;
80222
+ return "Date" /* Date */;
79673
80223
  }
79674
- return import_api3.NumberFormatCategory.Time;
80224
+ return "Time" /* Time */;
79675
80225
  }
79676
80226
  if (/AM\/PM/i.test(stripped)) {
79677
- return import_api3.NumberFormatCategory.Time;
80227
+ return "Time" /* Time */;
79678
80228
  }
79679
80229
  if (stripped.includes("%")) {
79680
- return import_api3.NumberFormatCategory.Percentage;
80230
+ return "Percentage" /* Percentage */;
79681
80231
  }
79682
80232
  if (/[eE][+-]/.test(stripped)) {
79683
- return import_api3.NumberFormatCategory.Scientific;
80233
+ return "Scientific" /* Scientific */;
79684
80234
  }
79685
80235
  if (stripped.includes("/") && !/[yYmMdDhHsS]/.test(stripped)) {
79686
- return import_api3.NumberFormatCategory.Fraction;
80236
+ return "Fraction" /* Fraction */;
79687
80237
  }
79688
80238
  if (/[_*]/.test(stripped) && /[$(]/.test(stripped)) {
79689
- return import_api3.NumberFormatCategory.Accounting;
80239
+ return "Accounting" /* Accounting */;
79690
80240
  }
79691
80241
  if (/[$€£¥₹]/.test(formatCode)) {
79692
- return import_api3.NumberFormatCategory.Currency;
80242
+ return "Currency" /* Currency */;
79693
80243
  }
79694
80244
  if (/^0{5}/.test(stripped) || /^0{3}-0{2}-0{4}/.test(stripped)) {
79695
- return import_api3.NumberFormatCategory.Special;
80245
+ return "Special" /* Special */;
79696
80246
  }
79697
80247
  if (/[#0]/.test(stripped)) {
79698
- return import_api3.NumberFormatCategory.Number;
80248
+ return "Number" /* Number */;
79699
80249
  }
79700
- return import_api3.NumberFormatCategory.Custom;
80250
+ return "Custom" /* Custom */;
79701
80251
  }
79702
80252
 
79703
80253
  // ../../kernel/src/api/worksheet/operations/sort-operations.ts
@@ -79740,9 +80290,18 @@ init_cjs_shims();
79740
80290
  // ../../kernel/src/api/worksheet/collections/object-collection-impl.ts
79741
80291
  init_cjs_shims();
79742
80292
 
80293
+ // ../../kernel/src/api/worksheet/handles/floating-object-handle-factory.ts
80294
+ init_cjs_shims();
80295
+
79743
80296
  // ../../kernel/src/api/worksheet/handles/floating-object-handle-impl.ts
79744
80297
  init_cjs_shims();
79745
80298
  init_errors();
80299
+ function narrowHandle(handle, expected) {
80300
+ if (handle.type !== expected) {
80301
+ throw new KernelError("OPERATION_FAILED", `Expected ${expected}, got ${handle.type}`);
80302
+ }
80303
+ return handle;
80304
+ }
79746
80305
  var FloatingObjectHandleImpl = class _FloatingObjectHandleImpl {
79747
80306
  constructor(id, type, objectsImpl, boundsReader) {
79748
80307
  this.id = id;
@@ -79789,11 +80348,11 @@ var FloatingObjectHandleImpl = class _FloatingObjectHandleImpl {
79789
80348
  return this.boundsReader?.getBounds(this.id) ?? null;
79790
80349
  }
79791
80350
  async getData() {
79792
- const info = await this.objectsImpl.get(this.id);
79793
- if (!info) throw new KernelError("OPERATION_FAILED", `Object ${this.id} not found`);
79794
- return info;
80351
+ const obj = await this.objectsImpl.getFullObject(this.id);
80352
+ if (!obj) throw new KernelError("OPERATION_FAILED", `Object ${this.id} not found`);
80353
+ return obj;
79795
80354
  }
79796
- // -- Type narrowing --
80355
+ // -- Type narrowing (is* predicates) --
79797
80356
  isShape() {
79798
80357
  return this.type === "shape";
79799
80358
  }
@@ -79830,58 +80389,43 @@ var FloatingObjectHandleImpl = class _FloatingObjectHandleImpl {
79830
80389
  isSlicer() {
79831
80390
  return this.type === "slicer";
79832
80391
  }
79833
- /** @internal Throw if this handle's type doesn't match expected. */
79834
- assertType(expected) {
79835
- if (this.type !== expected) {
79836
- throw new KernelError("OPERATION_FAILED", `Expected ${expected}, got ${this.type}`);
79837
- }
79838
- }
80392
+ /**
80393
+ * Type-checked narrowing — throws if this handle's type does not match.
80394
+ * The factory (createFloatingObjectHandle) guarantees that when type === 'shape',
80395
+ * `this` is a ShapeHandleImpl which implements ShapeHandle, etc.
80396
+ */
79839
80397
  asShape() {
79840
- this.assertType("shape");
79841
- return this;
80398
+ return narrowHandle(this, "shape");
79842
80399
  }
79843
80400
  asPicture() {
79844
- this.assertType("picture");
79845
- return this;
80401
+ return narrowHandle(this, "picture");
79846
80402
  }
79847
80403
  asTextBox() {
79848
- this.assertType("textbox");
79849
- return this;
80404
+ return narrowHandle(this, "textbox");
79850
80405
  }
79851
80406
  asDrawing() {
79852
- this.assertType("drawing");
79853
- return this;
80407
+ return narrowHandle(this, "drawing");
79854
80408
  }
79855
80409
  asEquation() {
79856
- this.assertType("equation");
79857
- return this;
80410
+ return narrowHandle(this, "equation");
79858
80411
  }
79859
80412
  asWordArt() {
79860
- this.assertType("wordart");
79861
- return this;
80413
+ throw new KernelError("OPERATION_FAILED", `Expected wordart, got ${this.type}`);
79862
80414
  }
79863
80415
  asSmartArt() {
79864
- this.assertType("smartart");
79865
- return this;
80416
+ return narrowHandle(this, "smartart");
79866
80417
  }
79867
80418
  asChart() {
79868
- this.assertType("chart");
79869
- return this;
79870
- }
79871
- asCamera() {
79872
- throw new KernelError("OPERATION_FAILED", "Camera objects are no longer supported");
80419
+ return narrowHandle(this, "chart");
79873
80420
  }
79874
80421
  asConnector() {
79875
- this.assertType("connector");
79876
- return this;
80422
+ return narrowHandle(this, "connector");
79877
80423
  }
79878
80424
  asOleObject() {
79879
- this.assertType("oleObject");
79880
- return this;
80425
+ return narrowHandle(this, "oleObject");
79881
80426
  }
79882
80427
  asSlicer() {
79883
- this.assertType("slicer");
79884
- return this;
80428
+ return narrowHandle(this, "slicer");
79885
80429
  }
79886
80430
  };
79887
80431
 
@@ -79901,9 +80445,9 @@ var ShapeHandleImpl = class _ShapeHandleImpl extends FloatingObjectHandleImpl {
79901
80445
  return new _ShapeHandleImpl(receipt.id, this.shapeType, this.objectsImpl, this.boundsReader);
79902
80446
  }
79903
80447
  async getData() {
79904
- const shape = await this.objectsImpl.getShape(this.id);
79905
- if (!shape) throw new KernelError("OPERATION_FAILED", `Shape ${this.id} not found`);
79906
- return shape;
80448
+ const obj = await this.objectsImpl.getFullObject(this.id);
80449
+ if (!obj || obj.type !== "shape") throw new KernelError("OPERATION_FAILED", `Shape ${this.id} not found`);
80450
+ return obj;
79907
80451
  }
79908
80452
  };
79909
80453
 
@@ -79922,9 +80466,9 @@ var PictureHandleImpl = class _PictureHandleImpl extends FloatingObjectHandleImp
79922
80466
  return new _PictureHandleImpl(receipt.id, this.objectsImpl, this.boundsReader);
79923
80467
  }
79924
80468
  async getData() {
79925
- const info = await this.objectsImpl.get(this.id);
79926
- if (!info) throw new KernelError("OPERATION_FAILED", `Picture ${this.id} not found`);
79927
- return info;
80469
+ const obj = await this.objectsImpl.getFullObject(this.id);
80470
+ if (!obj || obj.type !== "picture") throw new KernelError("OPERATION_FAILED", `Picture ${this.id} not found`);
80471
+ return obj;
79928
80472
  }
79929
80473
  };
79930
80474
 
@@ -79943,9 +80487,9 @@ var TextBoxHandleImpl = class _TextBoxHandleImpl extends FloatingObjectHandleImp
79943
80487
  return new _TextBoxHandleImpl(receipt.id, this.objectsImpl, this.boundsReader);
79944
80488
  }
79945
80489
  async getData() {
79946
- const info = await this.objectsImpl.get(this.id);
79947
- if (!info) throw new KernelError("OPERATION_FAILED", `TextBox ${this.id} not found`);
79948
- return info;
80490
+ const obj = await this.objectsImpl.getFullObject(this.id);
80491
+ if (!obj || obj.type !== "textbox") throw new KernelError("OPERATION_FAILED", `TextBox ${this.id} not found`);
80492
+ return obj;
79949
80493
  }
79950
80494
  };
79951
80495
 
@@ -80000,9 +80544,9 @@ var EquationHandleImpl = class _EquationHandleImpl extends FloatingObjectHandleI
80000
80544
  return new _EquationHandleImpl(receipt.id, this.objectsImpl, this.boundsReader);
80001
80545
  }
80002
80546
  async getData() {
80003
- const info = await this.objectsImpl.get(this.id);
80004
- if (!info) throw new KernelError("OPERATION_FAILED", `Equation ${this.id} not found`);
80005
- return info;
80547
+ const obj = await this.objectsImpl.getFullObject(this.id);
80548
+ if (!obj || obj.type !== "equation") throw new KernelError("OPERATION_FAILED", `Equation ${this.id} not found`);
80549
+ return obj;
80006
80550
  }
80007
80551
  };
80008
80552
 
@@ -80021,9 +80565,9 @@ var ConnectorHandleImpl = class _ConnectorHandleImpl extends FloatingObjectHandl
80021
80565
  return new _ConnectorHandleImpl(receipt.id, this.objectsImpl, this.boundsReader);
80022
80566
  }
80023
80567
  async getData() {
80024
- const info = await this.objectsImpl.get(this.id);
80025
- if (!info) throw new KernelError("OPERATION_FAILED", `Connector ${this.id} not found`);
80026
- return info;
80568
+ const obj = await this.objectsImpl.getFullObject(this.id);
80569
+ if (!obj || obj.type !== "connector") throw new KernelError("OPERATION_FAILED", `Connector ${this.id} not found`);
80570
+ return obj;
80027
80571
  }
80028
80572
  };
80029
80573
 
@@ -80039,9 +80583,9 @@ var ChartHandleImpl = class _ChartHandleImpl extends FloatingObjectHandleImpl {
80039
80583
  return new _ChartHandleImpl(receipt.id, this.objectsImpl, this.boundsReader);
80040
80584
  }
80041
80585
  async getData() {
80042
- const info = await this.objectsImpl.get(this.id);
80043
- if (!info) throw new KernelError("OPERATION_FAILED", `Chart ${this.id} not found`);
80044
- return info;
80586
+ const obj = await this.objectsImpl.getFullObject(this.id);
80587
+ if (!obj || obj.type !== "chart") throw new KernelError("OPERATION_FAILED", `Chart ${this.id} not found`);
80588
+ return obj;
80045
80589
  }
80046
80590
  };
80047
80591
 
@@ -80057,9 +80601,9 @@ var SmartArtHandleImpl = class _SmartArtHandleImpl extends FloatingObjectHandleI
80057
80601
  return new _SmartArtHandleImpl(receipt.id, this.objectsImpl, this.boundsReader);
80058
80602
  }
80059
80603
  async getData() {
80060
- const info = await this.objectsImpl.get(this.id);
80061
- if (!info) throw new KernelError("OPERATION_FAILED", `SmartArt ${this.id} not found`);
80062
- return info;
80604
+ const obj = await this.objectsImpl.getFullObject(this.id);
80605
+ if (!obj || obj.type !== "smartart") throw new KernelError("OPERATION_FAILED", `SmartArt ${this.id} not found`);
80606
+ return obj;
80063
80607
  }
80064
80608
  };
80065
80609
 
@@ -80075,9 +80619,9 @@ var SlicerHandleImpl = class _SlicerHandleImpl extends FloatingObjectHandleImpl
80075
80619
  return new _SlicerHandleImpl(receipt.id, this.objectsImpl, this.boundsReader);
80076
80620
  }
80077
80621
  async getData() {
80078
- const info = await this.objectsImpl.get(this.id);
80079
- if (!info) throw new KernelError("OPERATION_FAILED", `Slicer ${this.id} not found`);
80080
- return info;
80622
+ const obj = await this.objectsImpl.getFullObject(this.id);
80623
+ if (!obj) throw new KernelError("OPERATION_FAILED", `Slicer ${this.id} not found`);
80624
+ return obj;
80081
80625
  }
80082
80626
  };
80083
80627
 
@@ -80093,12 +80637,50 @@ var OleObjectHandleImpl = class _OleObjectHandleImpl extends FloatingObjectHandl
80093
80637
  return new _OleObjectHandleImpl(receipt.id, this.objectsImpl, this.boundsReader);
80094
80638
  }
80095
80639
  async getData() {
80096
- const info = await this.objectsImpl.get(this.id);
80097
- if (!info) throw new KernelError("OPERATION_FAILED", `OleObject ${this.id} not found`);
80098
- return info;
80640
+ const obj = await this.objectsImpl.getFullObject(this.id);
80641
+ if (!obj || obj.type !== "oleObject") throw new KernelError("OPERATION_FAILED", `OleObject ${this.id} not found`);
80642
+ return obj;
80099
80643
  }
80100
80644
  };
80101
80645
 
80646
+ // ../../kernel/src/api/worksheet/handles/floating-object-handle-factory.ts
80647
+ function createFloatingObjectHandle(id, type, objectsImpl, boundsReader, shapeType) {
80648
+ switch (type) {
80649
+ case "shape":
80650
+ return new ShapeHandleImpl(
80651
+ id,
80652
+ shapeType ?? "rect",
80653
+ objectsImpl,
80654
+ boundsReader
80655
+ );
80656
+ case "picture":
80657
+ return new PictureHandleImpl(id, objectsImpl, boundsReader);
80658
+ case "textbox":
80659
+ return new TextBoxHandleImpl(id, objectsImpl, boundsReader);
80660
+ case "drawing":
80661
+ return new DrawingHandleImpl(id, objectsImpl, boundsReader);
80662
+ case "equation":
80663
+ return new EquationHandleImpl(id, objectsImpl, boundsReader);
80664
+ case "connector":
80665
+ return new ConnectorHandleImpl(id, objectsImpl, boundsReader);
80666
+ case "chart":
80667
+ return new ChartHandleImpl(id, objectsImpl, boundsReader);
80668
+ case "smartart":
80669
+ return new SmartArtHandleImpl(id, objectsImpl, boundsReader);
80670
+ case "slicer":
80671
+ return new SlicerHandleImpl(id, objectsImpl, boundsReader);
80672
+ case "oleObject":
80673
+ return new OleObjectHandleImpl(id, objectsImpl, boundsReader);
80674
+ default:
80675
+ return new FloatingObjectHandleImpl(
80676
+ id,
80677
+ type,
80678
+ objectsImpl,
80679
+ boundsReader
80680
+ );
80681
+ }
80682
+ }
80683
+
80102
80684
  // ../../kernel/src/api/worksheet/collections/object-collection-impl.ts
80103
80685
  var WorksheetObjectCollectionImpl = class {
80104
80686
  constructor(objectsImpl, boundsReader) {
@@ -80167,30 +80749,7 @@ var WorksheetObjectCollectionImpl = class {
80167
80749
  return this.objectsImpl.ungroup(groupId);
80168
80750
  }
80169
80751
  createHandle(id, type) {
80170
- switch (type) {
80171
- case "shape":
80172
- return new ShapeHandleImpl(id, "rect", this.objectsImpl, this.boundsReader);
80173
- case "picture":
80174
- return new PictureHandleImpl(id, this.objectsImpl, this.boundsReader);
80175
- case "textbox":
80176
- return new TextBoxHandleImpl(id, this.objectsImpl, this.boundsReader);
80177
- case "drawing":
80178
- return new DrawingHandleImpl(id, this.objectsImpl, this.boundsReader);
80179
- case "equation":
80180
- return new EquationHandleImpl(id, this.objectsImpl, this.boundsReader);
80181
- case "connector":
80182
- return new ConnectorHandleImpl(id, this.objectsImpl, this.boundsReader);
80183
- case "chart":
80184
- return new ChartHandleImpl(id, this.objectsImpl, this.boundsReader);
80185
- case "smartart":
80186
- return new SmartArtHandleImpl(id, this.objectsImpl, this.boundsReader);
80187
- case "slicer":
80188
- return new SlicerHandleImpl(id, this.objectsImpl, this.boundsReader);
80189
- case "oleObject":
80190
- return new OleObjectHandleImpl(id, this.objectsImpl, this.boundsReader);
80191
- default:
80192
- return new FloatingObjectHandleImpl(id, type, this.objectsImpl, this.boundsReader);
80193
- }
80752
+ return createFloatingObjectHandle(id, type, this.objectsImpl, this.boundsReader);
80194
80753
  }
80195
80754
  };
80196
80755
 
@@ -80338,9 +80897,9 @@ var WordArtHandleImpl = class _WordArtHandleImpl extends FloatingObjectHandleImp
80338
80897
  return new _WordArtHandleImpl(receipt.id, this.objectsImpl, this.boundsReader);
80339
80898
  }
80340
80899
  async getData() {
80341
- const info = await this.objectsImpl.get(this.id);
80342
- if (!info) throw new KernelError("OPERATION_FAILED", `WordArt ${this.id} not found`);
80343
- return info;
80900
+ const obj = await this.objectsImpl.getFullObject(this.id);
80901
+ if (!obj || obj.type !== "textbox") throw new KernelError("OPERATION_FAILED", `WordArt ${this.id} not found`);
80902
+ return obj;
80344
80903
  }
80345
80904
  };
80346
80905
 
@@ -80618,7 +81177,7 @@ function chartConfigToInternal(config) {
80618
81177
  series: config.series,
80619
81178
  dataLabels: config.dataLabels,
80620
81179
  pieSlice: config.pieSlice,
80621
- trendline: config.trendline,
81180
+ trendline: config.trendlines ?? (config.trendline ? [config.trendline] : void 0),
80622
81181
  showLines: config.showLines,
80623
81182
  smoothLines: config.smoothLines,
80624
81183
  radarFilled: config.radarFilled,
@@ -80635,7 +81194,7 @@ function chartConfigToInternal(config) {
80635
81194
  splitValue: config.splitValue,
80636
81195
  widthCells: config.width,
80637
81196
  heightCells: config.height,
80638
- definition: buildStatisticalExtra(config)
81197
+ ooxml: buildStatisticalExtra(config)
80639
81198
  };
80640
81199
  }
80641
81200
  function chartUpdatesToInternal(updates) {
@@ -80662,7 +81221,11 @@ function chartUpdatesToInternal(updates) {
80662
81221
  if (updates.series !== void 0) result.series = updates.series;
80663
81222
  if (updates.dataLabels !== void 0) result.dataLabels = updates.dataLabels;
80664
81223
  if (updates.pieSlice !== void 0) result.pieSlice = updates.pieSlice;
80665
- if (updates.trendline !== void 0) result.trendline = updates.trendline;
81224
+ if (updates.trendlines !== void 0) {
81225
+ result.trendline = updates.trendlines;
81226
+ } else if (updates.trendline !== void 0) {
81227
+ result.trendline = updates.trendline ? [updates.trendline] : void 0;
81228
+ }
80666
81229
  if (updates.showLines !== void 0) result.showLines = updates.showLines;
80667
81230
  if (updates.smoothLines !== void 0) result.smoothLines = updates.smoothLines;
80668
81231
  if (updates.radarFilled !== void 0) result.radarFilled = updates.radarFilled;
@@ -80679,7 +81242,7 @@ function chartUpdatesToInternal(updates) {
80679
81242
  if (updates.splitValue !== void 0) result.splitValue = updates.splitValue;
80680
81243
  if (updates.name !== void 0) result.name = updates.name;
80681
81244
  const statisticalExtra = buildStatisticalExtra(updates);
80682
- if (statisticalExtra) result.definition = statisticalExtra;
81245
+ if (statisticalExtra) result.ooxml = statisticalExtra;
80683
81246
  return result;
80684
81247
  }
80685
81248
  function serializedChartToChart(chart) {
@@ -80704,7 +81267,8 @@ function serializedChartToChart(chart) {
80704
81267
  series: chart.series,
80705
81268
  dataLabels: chart.dataLabels,
80706
81269
  pieSlice: chart.pieSlice,
80707
- trendline: chart.trendline,
81270
+ trendline: Array.isArray(chart.trendline) ? chart.trendline[0] : chart.trendline,
81271
+ trendlines: chart.trendline,
80708
81272
  showLines: chart.showLines,
80709
81273
  smoothLines: chart.smoothLines,
80710
81274
  radarFilled: chart.radarFilled,
@@ -80719,7 +81283,7 @@ function serializedChartToChart(chart) {
80719
81283
  bubbleScale: chart.bubbleScale,
80720
81284
  splitType: chart.splitType,
80721
81285
  splitValue: chart.splitValue,
80722
- ...unpackStatisticalExtra(chart.definition),
81286
+ ...unpackStatisticalExtra(chart.ooxml),
80723
81287
  name: chart.name || void 0,
80724
81288
  createdAt: chart.createdAt,
80725
81289
  updatedAt: chart.updatedAt
@@ -80747,7 +81311,10 @@ async function applyUpdate(ctx, sheetId, chartId, updates) {
80747
81311
  function ensurePointsArray(series, minLength) {
80748
81312
  const points = [...series.points ?? []];
80749
81313
  while (points.length <= minLength) {
80750
- points.push({});
81314
+ points.push({ idx: points.length });
81315
+ }
81316
+ for (let i = 0; i < points.length; i++) {
81317
+ points[i].idx = i;
80751
81318
  }
80752
81319
  return points;
80753
81320
  }
@@ -80974,40 +81541,6 @@ init_cjs_shims();
80974
81541
  init_a1();
80975
81542
  init_compute_core();
80976
81543
  init_errors();
80977
- function cellRefToA1(cellRef) {
80978
- const parts = cellRef.split(":");
80979
- if (parts.length !== 2) return cellRef;
80980
- const col = parseInt(parts[0], 10);
80981
- const row = parseInt(parts[1], 10);
80982
- if (isNaN(col) || isNaN(row)) return cellRef;
80983
- return toA12(row, col);
80984
- }
80985
- function toApiComment(c) {
80986
- const text = c.content ?? c.runs.map((r) => r.text).join("");
80987
- return {
80988
- id: c.id,
80989
- cellId: c.cellRef,
80990
- cellAddress: cellRefToA1(c.cellRef),
80991
- author: c.author,
80992
- authorId: c.authorId,
80993
- text,
80994
- content: c.runs.length > 0 ? c.runs.map((r) => ({
80995
- text: r.text,
80996
- bold: r.bold || void 0,
80997
- italic: r.italic || void 0,
80998
- underline: r.underline || void 0,
80999
- strikethrough: r.strikethrough || void 0,
81000
- color: r.color ?? void 0,
81001
- fontName: r.fontName ?? void 0,
81002
- fontSize: r.fontSize ?? void 0
81003
- })) : void 0,
81004
- threadId: c.threadId || void 0,
81005
- parentId: c.parentId ?? void 0,
81006
- resolved: c.resolved ?? void 0,
81007
- createdAt: c.createdAt ?? 0,
81008
- modifiedAt: c.modifiedAt ?? void 0
81009
- };
81010
- }
81011
81544
  function propagateResolved(comments) {
81012
81545
  const rootResolved = /* @__PURE__ */ new Map();
81013
81546
  for (const c of comments) {
@@ -81133,7 +81666,7 @@ var WorksheetCommentsImpl = class {
81133
81666
  "addCommentByPosition: no comment returned in MutationResult.data"
81134
81667
  );
81135
81668
  }
81136
- return toApiComment(comment);
81669
+ return comment;
81137
81670
  }
81138
81671
  async update(commentId, text) {
81139
81672
  if (!text || text.trim().length === 0) {
@@ -81152,7 +81685,7 @@ var WorksheetCommentsImpl = class {
81152
81685
  }
81153
81686
  async list() {
81154
81687
  const comments = await this.ctx.computeBridge.getAllComments(this.sheetId);
81155
- return propagateResolved(comments.map(toApiComment));
81688
+ return propagateResolved(comments);
81156
81689
  }
81157
81690
  async getForCell(a, b) {
81158
81691
  const { row, col } = resolveCell(a, b);
@@ -81161,7 +81694,7 @@ var WorksheetCommentsImpl = class {
81161
81694
  row,
81162
81695
  col
81163
81696
  );
81164
- return comments.map(toApiComment);
81697
+ return comments;
81165
81698
  }
81166
81699
  async addReply(commentId, text, author) {
81167
81700
  const parent = await this.ctx.computeBridge.getComment(this.sheetId, commentId);
@@ -81178,7 +81711,7 @@ var WorksheetCommentsImpl = class {
81178
81711
  author,
81179
81712
  { parentId: commentId }
81180
81713
  );
81181
- return toApiComment(comment);
81714
+ return comment;
81182
81715
  }
81183
81716
  async getThread(commentId) {
81184
81717
  const comment = await this.ctx.computeBridge.getComment(this.sheetId, commentId);
@@ -81187,11 +81720,11 @@ var WorksheetCommentsImpl = class {
81187
81720
  }
81188
81721
  const threadId = comment.threadId ?? comment.id;
81189
81722
  const thread = await this.ctx.computeBridge.getCommentThread(this.sheetId, threadId);
81190
- return propagateResolved(thread.map(toApiComment));
81723
+ return propagateResolved(thread);
81191
81724
  }
81192
81725
  async getById(commentId) {
81193
81726
  const comment = await this.ctx.computeBridge.getComment(this.sheetId, commentId);
81194
- return comment ? toApiComment(comment) : null;
81727
+ return comment ?? null;
81195
81728
  }
81196
81729
  };
81197
81730
 
@@ -81414,18 +81947,9 @@ var WorksheetFiltersImpl = class {
81414
81947
  const filters = await this.ctx.computeBridge.getFiltersInSheet(this.sheetId);
81415
81948
  if (filters.length === 0) return null;
81416
81949
  const filter = filters[0];
81417
- const columns = /* @__PURE__ */ new Map();
81418
- if (filter.columnFilters) {
81419
- for (const [key, value] of Object.entries(filter.columnFilters)) {
81420
- const colIdx = parseInt(key, 10);
81421
- if (!isNaN(colIdx) && value) {
81422
- columns.set(colIdx, value);
81423
- }
81424
- }
81425
- }
81426
81950
  return {
81427
81951
  range: `${toA12(filter.startRow ?? 0, filter.startCol ?? 0)}:${toA12(filter.endRow ?? 0, filter.endCol ?? 0)}`,
81428
- columns
81952
+ columnFilters: filter.columnFilters ?? {}
81429
81953
  };
81430
81954
  }
81431
81955
  async getForRange(range2) {
@@ -81496,9 +82020,9 @@ var WorksheetFiltersImpl = class {
81496
82020
  async list() {
81497
82021
  const raw = await this.ctx.computeBridge.getFiltersInSheet(this.sheetId);
81498
82022
  return raw.map((f) => ({
81499
- id: f.id ?? f.filterId,
81500
- range: f.range,
81501
- columns: f.columns
82023
+ id: f.id,
82024
+ range: void 0,
82025
+ columnFilters: f.columnFilters
81502
82026
  }));
81503
82027
  }
81504
82028
  async listDetails() {
@@ -81516,13 +82040,22 @@ var WorksheetFiltersImpl = class {
81516
82040
  }
81517
82041
  async getSortState(filterId) {
81518
82042
  try {
81519
- return await this.ctx.computeBridge.getFilterSortState(this.sheetId, filterId);
82043
+ const sortState = await this.ctx.computeBridge.getFilterSortState(this.sheetId, filterId);
82044
+ if (!sortState) return null;
82045
+ return {
82046
+ column: sortState.columnCellId,
82047
+ direction: sortState.order === "asc" ? "asc" : "desc"
82048
+ };
81520
82049
  } catch {
81521
82050
  return null;
81522
82051
  }
81523
82052
  }
81524
82053
  async setSortState(filterId, state) {
81525
- await this.ctx.computeBridge.setFilterSortState(this.sheetId, filterId, state);
82054
+ await this.ctx.computeBridge.setFilterSortState(this.sheetId, filterId, {
82055
+ columnCellId: String(state.column),
82056
+ order: state.direction === "asc" ? "asc" : "desc",
82057
+ sortBy: "value"
82058
+ });
81526
82059
  }
81527
82060
  };
81528
82061
 
@@ -81557,6 +82090,12 @@ init_cjs_shims();
81557
82090
  // ../../number-formats/src/constants.ts
81558
82091
  init_cjs_shims();
81559
82092
 
82093
+ // ../../contracts/src/number-formats/constants.ts
82094
+ init_cjs_shims();
82095
+
82096
+ // ../../contracts/src/number-formats/constants.gen.ts
82097
+ init_cjs_shims();
82098
+
81560
82099
  // ../../number-formats/src/format-utils.ts
81561
82100
  init_cjs_shims();
81562
82101
 
@@ -82898,7 +83437,12 @@ var WorksheetPivotsImpl = class _WorksheetPivotsImpl {
82898
83437
  }
82899
83438
  async queryPivot(pivotName, filters) {
82900
83439
  const pivot = await this.findPivotByName(pivotName);
82901
- if (!pivot) return null;
83440
+ if (!pivot) {
83441
+ throw new KernelError(
83442
+ "COMPUTE_ERROR",
83443
+ `queryPivot: Pivot table "${pivotName}" not found on this sheet`
83444
+ );
83445
+ }
82902
83446
  const pivotId = pivot.id ?? pivot.name;
82903
83447
  const result = await this.ctx.pivot.compute(this.sheetId, pivotId);
82904
83448
  if (!result) return null;
@@ -83255,7 +83799,7 @@ init_errors();
83255
83799
 
83256
83800
  // ../../kernel/src/api/worksheet/operations/sheet-management-operations.ts
83257
83801
  init_cjs_shims();
83258
- var import_protection4 = require("@mog-sdk/spreadsheet-contracts/protection");
83802
+ init_protection();
83259
83803
  function parseCellRef2(ref) {
83260
83804
  const match = ref.match(/^([A-Z]+)(\d+)$/i);
83261
83805
  if (!match) return null;
@@ -83679,12 +84223,35 @@ var WorksheetSlicersImpl = class {
83679
84223
  }
83680
84224
  async add(config) {
83681
84225
  const caption = config.caption ?? config.name ?? "";
84226
+ const source = config.source ?? {
84227
+ type: "table",
84228
+ tableId: config.tableName ?? "",
84229
+ columnCellId: config.columnName ?? ""
84230
+ };
84231
+ const defaultStyle = {
84232
+ columnCount: 1,
84233
+ buttonHeight: 30,
84234
+ showSelectionIndicator: true,
84235
+ crossFilter: "showItemsWithDataAtTop",
84236
+ customListSort: true,
84237
+ showItemsWithNoData: true,
84238
+ sortOrder: "ascending"
84239
+ };
83682
84240
  const storedConfig = {
83683
- ...config,
83684
- caption
84241
+ id: config.id ?? "",
84242
+ sheetId: config.sheetId ?? "",
84243
+ source,
84244
+ caption,
84245
+ style: config.style ?? defaultStyle,
84246
+ position: config.position,
84247
+ zIndex: config.zIndex ?? 0,
84248
+ locked: config.locked ?? false,
84249
+ showHeader: config.showHeader ?? true,
84250
+ multiSelect: config.multiSelect ?? true,
84251
+ selectedValues: config.selectedValues ?? []
83685
84252
  };
83686
84253
  await this.ctx.computeBridge.createSlicer(this.sheetId, storedConfig);
83687
- return storedConfig.id ?? "";
84254
+ return storedConfig.id;
83688
84255
  }
83689
84256
  async remove(slicerId) {
83690
84257
  validateSlicerId(slicerId, "deleteSlicer");
@@ -83846,11 +84413,15 @@ var WorksheetSlicersImpl = class {
83846
84413
  }
83847
84414
  async updateConfig(slicerId, updates) {
83848
84415
  validateSlicerId(slicerId, "updateSlicerConfig");
83849
- await this.ctx.computeBridge.updateSlicerConfig(
83850
- this.sheetId,
83851
- slicerId,
83852
- updates
83853
- );
84416
+ const bridgeUpdate = {};
84417
+ if (updates.caption !== void 0) bridgeUpdate.caption = updates.caption;
84418
+ if (updates.name !== void 0 && bridgeUpdate.caption === void 0) {
84419
+ bridgeUpdate.caption = updates.name;
84420
+ }
84421
+ if (updates.style !== void 0) bridgeUpdate.style = updates.style;
84422
+ if (updates.position !== void 0) bridgeUpdate.position = updates.position;
84423
+ if (updates.showHeader !== void 0) bridgeUpdate.showHeader = updates.showHeader;
84424
+ await this.ctx.computeBridge.updateSlicerConfig(this.sheetId, slicerId, bridgeUpdate);
83854
84425
  }
83855
84426
  async getState(slicerId) {
83856
84427
  const state = await this.ctx.computeBridge.getSlicerState(this.sheetId, slicerId);
@@ -84444,6 +85015,7 @@ function toBridgeTextToColumnsOptions(options) {
84444
85015
  // ../../kernel/src/api/worksheet/tables.ts
84445
85016
  init_cjs_shims();
84446
85017
  init_errors();
85018
+ init_value_conversions();
84447
85019
 
84448
85020
  // ../../kernel/src/api/worksheet/operations/table-operations.ts
84449
85021
  init_cjs_shims();
@@ -84465,31 +85037,15 @@ function bridgeTableToTableInfo(table) {
84465
85037
  const endRowA1 = table.range.endRow + 1;
84466
85038
  const range2 = `${startLetter}${startRowA1}:${endLetter}${endRowA1}`;
84467
85039
  return {
84468
- id: table.id,
84469
- name: table.name,
84470
- range: range2,
84471
- hasHeaders: table.hasHeaderRow,
84472
- showTotals: table.hasTotalsRow,
84473
- style: table.style || void 0,
84474
- highlightFirstColumn: table.emphasizeFirstColumn,
84475
- highlightLastColumn: table.emphasizeLastColumn,
84476
- showBandedColumns: table.bandedColumns,
84477
- showBandedRows: table.bandedRows,
84478
- showFilterButton: table.showFilterButtons,
84479
- showHeaders: table.hasHeaderRow,
84480
- columns: table.columns.map((col) => ({
84481
- name: col.name,
84482
- index: col.index,
84483
- totalFunction: col.totalsFunction ?? void 0,
84484
- calculatedFormula: col.calculatedFormula ?? void 0
84485
- }))
85040
+ ...table,
85041
+ range: range2
84486
85042
  };
84487
85043
  }
84488
85044
  function getTableColumnDataCellsFromInfo(table, colIndex) {
84489
85045
  const parsed = parseA1Range(table.range);
84490
85046
  if (!parsed) return [];
84491
- const dataStartRow = table.hasHeaders ? parsed.startRow + 1 : parsed.startRow;
84492
- const dataEndRow = table.showTotals ? parsed.endRow - 1 : parsed.endRow;
85047
+ const dataStartRow = table.hasHeaderRow ? parsed.startRow + 1 : parsed.startRow;
85048
+ const dataEndRow = table.hasTotalsRow ? parsed.endRow - 1 : parsed.endRow;
84493
85049
  if (dataStartRow > dataEndRow) return [];
84494
85050
  const col = parsed.startCol + colIndex;
84495
85051
  if (col > parsed.endCol) return [];
@@ -84502,15 +85058,15 @@ function getTableColumnDataCellsFromInfo(table, colIndex) {
84502
85058
  function getDataBodyRangeFromInfo(table) {
84503
85059
  const parsed = parseA1Range(table.range);
84504
85060
  if (!parsed) return null;
84505
- const dataStartRow = table.hasHeaders ? parsed.startRow + 1 : parsed.startRow;
84506
- const dataEndRow = table.showTotals ? parsed.endRow - 1 : parsed.endRow;
85061
+ const dataStartRow = table.hasHeaderRow ? parsed.startRow + 1 : parsed.startRow;
85062
+ const dataEndRow = table.hasTotalsRow ? parsed.endRow - 1 : parsed.endRow;
84507
85063
  if (dataStartRow > dataEndRow) return null;
84508
85064
  const startLetter = colToLetter3(parsed.startCol);
84509
85065
  const endLetter = colToLetter3(parsed.endCol);
84510
85066
  return `${startLetter}${dataStartRow + 1}:${endLetter}${dataEndRow + 1}`;
84511
85067
  }
84512
85068
  function getHeaderRowRangeFromInfo(table) {
84513
- if (!table.hasHeaders) return null;
85069
+ if (!table.hasHeaderRow) return null;
84514
85070
  const parsed = parseA1Range(table.range);
84515
85071
  if (!parsed) return null;
84516
85072
  const startLetter = colToLetter3(parsed.startCol);
@@ -84519,7 +85075,7 @@ function getHeaderRowRangeFromInfo(table) {
84519
85075
  return `${startLetter}${headerRow}:${endLetter}${headerRow}`;
84520
85076
  }
84521
85077
  function getTotalRowRangeFromInfo(table) {
84522
- if (!table.showTotals) return null;
85078
+ if (!table.hasTotalsRow) return null;
84523
85079
  const parsed = parseA1Range(table.range);
84524
85080
  if (!parsed) return null;
84525
85081
  const startLetter = colToLetter3(parsed.startCol);
@@ -84615,23 +85171,23 @@ var WorksheetTablesImpl = class {
84615
85171
  if (updates.name !== void 0) {
84616
85172
  await this.ctx.computeBridge.renameTable(tableName, updates.name);
84617
85173
  }
84618
- const boolOptionMap = {
84619
- highlightFirstColumn: "emphasizeFirstColumn",
84620
- highlightLastColumn: "emphasizeLastColumn",
84621
- showBandedColumns: "bandedColumns",
84622
- showBandedRows: "bandedRows",
84623
- showFilterButton: "showFilterButtons"
84624
- };
84625
- for (const [key, bridgeOption] of Object.entries(boolOptionMap)) {
85174
+ const boolOptions = [
85175
+ "emphasizeFirstColumn",
85176
+ "emphasizeLastColumn",
85177
+ "bandedColumns",
85178
+ "bandedRows",
85179
+ "showFilterButtons"
85180
+ ];
85181
+ for (const key of boolOptions) {
84626
85182
  if (updates[key] !== void 0) {
84627
- await this.ctx.computeBridge.setTableBoolOption(tableName, bridgeOption, updates[key]);
85183
+ await this.ctx.computeBridge.setTableBoolOption(tableName, key, updates[key]);
84628
85184
  }
84629
85185
  }
84630
- if (updates.showHeaders !== void 0) {
84631
- await this.setShowHeaders(tableName, updates.showHeaders);
85186
+ if (updates.hasHeaderRow !== void 0) {
85187
+ await this.setShowHeaders(tableName, updates.hasHeaderRow);
84632
85188
  }
84633
- if (updates.showTotals !== void 0) {
84634
- await this.setShowTotals(tableName, updates.showTotals);
85189
+ if (updates.hasTotalsRow !== void 0) {
85190
+ await this.setShowTotals(tableName, updates.hasTotalsRow);
84635
85191
  }
84636
85192
  }
84637
85193
  async getAtCell(row, col) {
@@ -84752,14 +85308,14 @@ var WorksheetTablesImpl = class {
84752
85308
  async setShowHeaders(tableName, visible) {
84753
85309
  const table = await this.get(tableName);
84754
85310
  if (!table) throw new KernelError("COMPUTE_ERROR", `Table not found: ${tableName}`);
84755
- if (table.hasHeaders !== visible) {
85311
+ if (table.hasHeaderRow !== visible) {
84756
85312
  await this.ctx.computeBridge.toggleHeaderRow(tableName);
84757
85313
  }
84758
85314
  }
84759
85315
  async setShowTotals(tableName, visible) {
84760
85316
  const table = await this.get(tableName);
84761
85317
  if (!table) throw new KernelError("COMPUTE_ERROR", `Table not found: ${tableName}`);
84762
- if ((table.showTotals ?? false) !== visible) {
85318
+ if (table.hasTotalsRow !== visible) {
84763
85319
  await this.ctx.computeBridge.toggleTotalsRow(tableName);
84764
85320
  }
84765
85321
  }
@@ -84793,8 +85349,8 @@ var WorksheetTablesImpl = class {
84793
85349
  if (!table) throw new KernelError("COMPUTE_ERROR", `Table not found: ${tableName}`);
84794
85350
  const parsed = parseA1Range2(table.range);
84795
85351
  if (!parsed) return 0;
84796
- const dataStartRow = table.hasHeaders ? parsed.startRow + 1 : parsed.startRow;
84797
- const dataEndRow = table.showTotals ? parsed.endRow - 1 : parsed.endRow;
85352
+ const dataStartRow = table.hasHeaderRow ? parsed.startRow + 1 : parsed.startRow;
85353
+ const dataEndRow = table.hasTotalsRow ? parsed.endRow - 1 : parsed.endRow;
84798
85354
  return Math.max(0, dataEndRow - dataStartRow + 1);
84799
85355
  }
84800
85356
  async getRowRange(tableName, index) {
@@ -84802,7 +85358,7 @@ var WorksheetTablesImpl = class {
84802
85358
  if (!table) throw new KernelError("COMPUTE_ERROR", `Table not found: ${tableName}`);
84803
85359
  const parsed = parseA1Range2(table.range);
84804
85360
  if (!parsed) throw new KernelError("COMPUTE_ERROR", `Invalid table range: ${table.range}`);
84805
- const dataStartRow = table.hasHeaders ? parsed.startRow + 1 : parsed.startRow;
85361
+ const dataStartRow = table.hasHeaderRow ? parsed.startRow + 1 : parsed.startRow;
84806
85362
  const absRow = dataStartRow + index;
84807
85363
  const startLetter = colToLetter3(parsed.startCol);
84808
85364
  const endLetter = colToLetter3(parsed.endCol);
@@ -84813,7 +85369,7 @@ var WorksheetTablesImpl = class {
84813
85369
  if (!table) throw new KernelError("COMPUTE_ERROR", `Table not found: ${tableName}`);
84814
85370
  const parsed = parseA1Range2(table.range);
84815
85371
  if (!parsed) return [];
84816
- const dataStartRow = table.hasHeaders ? parsed.startRow + 1 : parsed.startRow;
85372
+ const dataStartRow = table.hasHeaderRow ? parsed.startRow + 1 : parsed.startRow;
84817
85373
  const absRow = dataStartRow + index;
84818
85374
  return queryRangeValues(this.ctx, this.sheetId, absRow, parsed.startCol, absRow, parsed.endCol);
84819
85375
  }
@@ -84822,7 +85378,7 @@ var WorksheetTablesImpl = class {
84822
85378
  if (!table) throw new KernelError("COMPUTE_ERROR", `Table not found: ${tableName}`);
84823
85379
  const parsed = parseA1Range2(table.range);
84824
85380
  if (!parsed) return;
84825
- const dataStartRow = table.hasHeaders ? parsed.startRow + 1 : parsed.startRow;
85381
+ const dataStartRow = table.hasHeaderRow ? parsed.startRow + 1 : parsed.startRow;
84826
85382
  const absRow = dataStartRow + index;
84827
85383
  const edits = values.map((val, i) => ({
84828
85384
  row: absRow,
@@ -84841,15 +85397,15 @@ var WorksheetTablesImpl = class {
84841
85397
  if (!parsed) return null;
84842
85398
  const col = parsed.startCol + columnIndex;
84843
85399
  if (col > parsed.endCol) return null;
84844
- const dataStartRow = table.hasHeaders ? parsed.startRow + 1 : parsed.startRow;
84845
- const dataEndRow = table.showTotals ? parsed.endRow - 1 : parsed.endRow;
85400
+ const dataStartRow = table.hasHeaderRow ? parsed.startRow + 1 : parsed.startRow;
85401
+ const dataEndRow = table.hasTotalsRow ? parsed.endRow - 1 : parsed.endRow;
84846
85402
  if (dataStartRow > dataEndRow) return null;
84847
85403
  const letter = colToLetter3(col);
84848
85404
  return `${letter}${dataStartRow + 1}:${letter}${dataEndRow + 1}`;
84849
85405
  }
84850
85406
  async getColumnHeaderRange(tableName, columnIndex) {
84851
85407
  const table = await this.get(tableName);
84852
- if (!table || !table.hasHeaders) return null;
85408
+ if (!table || !table.hasHeaderRow) return null;
84853
85409
  const parsed = parseA1Range2(table.range);
84854
85410
  if (!parsed) return null;
84855
85411
  const col = parsed.startCol + columnIndex;
@@ -84870,7 +85426,7 @@ var WorksheetTablesImpl = class {
84870
85426
  }
84871
85427
  async getColumnTotalRange(tableName, columnIndex) {
84872
85428
  const table = await this.get(tableName);
84873
- if (!table || !table.showTotals) return null;
85429
+ if (!table || !table.hasTotalsRow) return null;
84874
85430
  const parsed = parseA1Range2(table.range);
84875
85431
  if (!parsed) return null;
84876
85432
  const col = parsed.startCol + columnIndex;
@@ -84886,8 +85442,8 @@ var WorksheetTablesImpl = class {
84886
85442
  if (!parsed) return [];
84887
85443
  const col = parsed.startCol + columnIndex;
84888
85444
  if (col > parsed.endCol) return [];
84889
- const dataStartRow = table.hasHeaders ? parsed.startRow + 1 : parsed.startRow;
84890
- const dataEndRow = table.showTotals ? parsed.endRow - 1 : parsed.endRow;
85445
+ const dataStartRow = table.hasHeaderRow ? parsed.startRow + 1 : parsed.startRow;
85446
+ const dataEndRow = table.hasTotalsRow ? parsed.endRow - 1 : parsed.endRow;
84891
85447
  if (dataStartRow > dataEndRow) return [];
84892
85448
  return queryRangeValues(this.ctx, this.sheetId, dataStartRow, col, dataEndRow, col);
84893
85449
  }
@@ -84898,7 +85454,7 @@ var WorksheetTablesImpl = class {
84898
85454
  if (!parsed) return;
84899
85455
  const col = parsed.startCol + columnIndex;
84900
85456
  if (col > parsed.endCol) return;
84901
- const dataStartRow = table.hasHeaders ? parsed.startRow + 1 : parsed.startRow;
85457
+ const dataStartRow = table.hasHeaderRow ? parsed.startRow + 1 : parsed.startRow;
84902
85458
  const edits = values.map((val, i) => ({
84903
85459
  row: dataStartRow + i,
84904
85460
  col,
@@ -84914,8 +85470,8 @@ var WorksheetTablesImpl = class {
84914
85470
  if (!table) throw new KernelError("COMPUTE_ERROR", `Table not found: ${tableName}`);
84915
85471
  const parsed = parseA1Range2(table.range);
84916
85472
  if (!parsed) return;
84917
- const dataStartRow = table.hasHeaders ? parsed.startRow + 1 : parsed.startRow;
84918
- const dataEndRow = table.showTotals ? parsed.endRow - 1 : parsed.endRow;
85473
+ const dataStartRow = table.hasHeaderRow ? parsed.startRow + 1 : parsed.startRow;
85474
+ const dataEndRow = table.hasTotalsRow ? parsed.endRow - 1 : parsed.endRow;
84919
85475
  if (dataStartRow > dataEndRow) return;
84920
85476
  const numCols = parsed.endCol - parsed.startCol + 1;
84921
85477
  const numRows = dataEndRow - dataStartRow + 1;
@@ -84935,7 +85491,7 @@ var WorksheetTablesImpl = class {
84935
85491
  const row = [];
84936
85492
  for (let c = 0; c < numCols; c++) {
84937
85493
  const cell = cellMap.get(`${dataStartRow + r},${parsed.startCol + c}`);
84938
- row.push(cell?.value ?? null);
85494
+ row.push(normalizeCellValue(cell?.value ?? null));
84939
85495
  }
84940
85496
  rows.push(row);
84941
85497
  }
@@ -85007,7 +85563,7 @@ async function queryRangeValues(ctx, sheetId, startRow, startCol, endRow, endCol
85007
85563
  for (let r = startRow; r <= endRow; r++) {
85008
85564
  for (let c = startCol; c <= endCol; c++) {
85009
85565
  const cell = cellMap.get(`${r},${c}`);
85010
- values.push(cell?.value ?? null);
85566
+ values.push(normalizeCellValue(cell?.value ?? null));
85011
85567
  }
85012
85568
  }
85013
85569
  return values;
@@ -85597,6 +86153,117 @@ var WorksheetViewImpl = class {
85597
86153
  }
85598
86154
  };
85599
86155
 
86156
+ // ../../kernel/src/api/worksheet/what-if.ts
86157
+ init_cjs_shims();
86158
+
86159
+ // ../../kernel/src/api/worksheet/operations/data-table-operations.ts
86160
+ init_cjs_shims();
86161
+ init_errors();
86162
+ async function dataTable(ctx, sheetId, formulaCell, options) {
86163
+ const formulaPos = resolveCell(formulaCell);
86164
+ const formulaCellId = await getCellIdAt2(ctx, sheetId, formulaPos.row, formulaPos.col);
86165
+ if (!formulaCellId) {
86166
+ throw new KernelError("COMPUTE_ERROR", `Formula cell ${formulaCell} has no content.`);
86167
+ }
86168
+ let rowInputCellId = null;
86169
+ if (options.rowInputCell) {
86170
+ const pos = resolveCell(options.rowInputCell);
86171
+ const cid = await getCellIdAt2(ctx, sheetId, pos.row, pos.col);
86172
+ if (!cid) {
86173
+ throw new KernelError(
86174
+ "COMPUTE_ERROR",
86175
+ `Row input cell ${options.rowInputCell} must contain a value before calling dataTable().`
86176
+ );
86177
+ }
86178
+ rowInputCellId = cid;
86179
+ }
86180
+ let colInputCellId = null;
86181
+ if (options.colInputCell) {
86182
+ const pos = resolveCell(options.colInputCell);
86183
+ const cid = await getCellIdAt2(ctx, sheetId, pos.row, pos.col);
86184
+ if (!cid) {
86185
+ throw new KernelError(
86186
+ "COMPUTE_ERROR",
86187
+ `Column input cell ${options.colInputCell} must contain a value before calling dataTable().`
86188
+ );
86189
+ }
86190
+ colInputCellId = cid;
86191
+ }
86192
+ const bridgeResult = await ctx.computeBridge.dataTable({
86193
+ formula_cell: formulaCellId,
86194
+ row_input_cell: rowInputCellId,
86195
+ col_input_cell: colInputCellId,
86196
+ row_values: options.rowValues,
86197
+ col_values: options.colValues
86198
+ });
86199
+ const result = bridgeResult;
86200
+ return {
86201
+ results: result.results,
86202
+ cellCount: result.cellCount ?? result.cell_count ?? 0,
86203
+ elapsedMs: result.elapsedMs ?? result.elapsed_ms ?? 0,
86204
+ cancelled: result.cancelled ?? false
86205
+ };
86206
+ }
86207
+
86208
+ // ../../kernel/src/api/worksheet/operations/goal-seek-operations.ts
86209
+ init_cjs_shims();
86210
+ init_errors();
86211
+ async function goalSeek(ctx, sheetId, targetCell, targetValue, changingCell) {
86212
+ const targetPos = resolveCell(targetCell);
86213
+ const changingPos = resolveCell(changingCell);
86214
+ const formulaCellId = await getCellIdAt2(
86215
+ ctx,
86216
+ sheetId,
86217
+ targetPos.row,
86218
+ targetPos.col
86219
+ );
86220
+ if (!formulaCellId) {
86221
+ throw new KernelError("COMPUTE_ERROR", `Target cell ${targetCell} has no content.`);
86222
+ }
86223
+ const inputCellId = await getCellIdAt2(
86224
+ ctx,
86225
+ sheetId,
86226
+ changingPos.row,
86227
+ changingPos.col
86228
+ );
86229
+ if (!inputCellId) {
86230
+ throw new KernelError("COMPUTE_ERROR", `Changing cell ${changingCell} has no content.`);
86231
+ }
86232
+ const changingData = await getCell(ctx, sheetId, changingPos.row, changingPos.col);
86233
+ const initialGuess = typeof changingData?.value === "number" ? changingData.value : 0;
86234
+ const bridgeResult = await ctx.computeBridge.goalSeek({
86235
+ formula_cell: formulaCellId,
86236
+ target: targetValue,
86237
+ input_cell: inputCellId,
86238
+ initial_guess: initialGuess
86239
+ });
86240
+ const result = bridgeResult;
86241
+ const solutionValue = result.solutionValue ?? result.solution_value;
86242
+ const iterations = result.iterations;
86243
+ if (result.found && solutionValue != null) {
86244
+ await setCell(ctx, sheetId, changingPos.row, changingPos.col, solutionValue);
86245
+ }
86246
+ return {
86247
+ found: result.found,
86248
+ value: solutionValue,
86249
+ iterations
86250
+ };
86251
+ }
86252
+
86253
+ // ../../kernel/src/api/worksheet/what-if.ts
86254
+ var WorksheetWhatIfImpl = class {
86255
+ constructor(ctx, sheetId) {
86256
+ this.ctx = ctx;
86257
+ this.sheetId = sheetId;
86258
+ }
86259
+ async goalSeek(targetCell, targetValue, changingCell) {
86260
+ return goalSeek(this.ctx, this.sheetId, targetCell, targetValue, changingCell);
86261
+ }
86262
+ async dataTable(formulaCell, options) {
86263
+ return dataTable(this.ctx, this.sheetId, formulaCell, options);
86264
+ }
86265
+ };
86266
+
85600
86267
  // ../../kernel/src/api/worksheet/objects.ts
85601
86268
  init_cjs_shims();
85602
86269
  init_errors();
@@ -86300,8 +86967,8 @@ function objectToInfo(obj) {
86300
86967
  flipH: obj.position?.flipH,
86301
86968
  flipV: obj.position?.flipV,
86302
86969
  zIndex: obj.zIndex,
86303
- visible: obj.visible,
86304
- groupId: obj.groupId,
86970
+ visible: "visible" in obj ? obj.visible : void 0,
86971
+ groupId: "groupId" in obj ? obj.groupId : void 0,
86305
86972
  anchorType: obj.position?.anchorType,
86306
86973
  altText: obj.altText
86307
86974
  };
@@ -86514,7 +87181,7 @@ async function getConnectorData(manager, connectorId) {
86514
87181
  }
86515
87182
  async function getGroupMembers(manager, _ctx, sheetId, groupId) {
86516
87183
  const objects = await manager.getObjectsInSheet(sheetId);
86517
- return objects.filter((obj) => obj.groupId === groupId).map((obj) => obj.id);
87184
+ return objects.filter((obj) => "groupId" in obj && obj.groupId === groupId).map((obj) => obj.id);
86518
87185
  }
86519
87186
  function deriveImageFormat(src) {
86520
87187
  const dataUrlMatch = src.match(/^data:image\/([^;,]+)/);
@@ -86563,6 +87230,7 @@ async function getConnectionSiteCount(manager, objectId) {
86563
87230
 
86564
87231
  // ../../kernel/src/api/worksheet/operations/shape-operations.ts
86565
87232
  init_cjs_shims();
87233
+ init_floating_object_mapper();
86566
87234
  function shapeObjectToShape(shape, sheetId) {
86567
87235
  return {
86568
87236
  id: shape.id,
@@ -86602,7 +87270,7 @@ function buildMutationReceipt2(change, action) {
86602
87270
  domain: "floatingObject",
86603
87271
  action,
86604
87272
  id: change.objectId,
86605
- object: change.data,
87273
+ object: change.data ? toFloatingObject(change.data) : createMinimalFloatingObject("shape", change.objectId, ""),
86606
87274
  bounds
86607
87275
  };
86608
87276
  }
@@ -86637,7 +87305,7 @@ async function createShape(ctx, sheetId, config) {
86637
87305
  domain: "floatingObject",
86638
87306
  action: "create",
86639
87307
  id: "",
86640
- object: { id: "", sheetId, type: "shape", shapeType: config.type },
87308
+ object: createMinimalFloatingObject("shape", "", sheetId),
86641
87309
  bounds: {
86642
87310
  x: 0,
86643
87311
  y: 0,
@@ -86727,7 +87395,7 @@ async function updateShape(ctx, sheetId, shapeId, updates) {
86727
87395
  domain: "floatingObject",
86728
87396
  action: "update",
86729
87397
  id: shapeId,
86730
- object: { id: shapeId, sheetId, type: "shape" },
87398
+ object: createMinimalFloatingObject("shape", shapeId, sheetId),
86731
87399
  bounds: { x: 0, y: 0, width: 0, height: 0, rotation: 0 }
86732
87400
  };
86733
87401
  }
@@ -87003,6 +87671,15 @@ var WorksheetObjectsImpl = class {
87003
87671
  async get(objectId) {
87004
87672
  return await getFloatingObject(this.mgr, this.ctx, this.sheetId, objectId);
87005
87673
  }
87674
+ /**
87675
+ * Get the full domain-typed FloatingObject for an object by ID.
87676
+ * Returns the discriminated union variant (ShapeObject, PictureObject, etc.)
87677
+ * directly from the manager, bypassing the API-level FloatingObjectInfo projection.
87678
+ */
87679
+ async getFullObject(objectId) {
87680
+ const obj = await this.mgr.getObject(objectId);
87681
+ return obj ?? null;
87682
+ }
87006
87683
  async computeObjectBounds(objectId) {
87007
87684
  const obj = await this.mgr.getObject(objectId);
87008
87685
  if (!obj) return null;
@@ -87371,7 +88048,7 @@ var WorksheetImpl = class {
87371
88048
  async getValue(a, b) {
87372
88049
  const { row, col } = resolveCell(a, b);
87373
88050
  const data = await getCell(this.ctx, this.sheetId, row, col);
87374
- return data?.value ?? null;
88051
+ return normalizeCellValue(data?.value ?? null);
87375
88052
  }
87376
88053
  async getData() {
87377
88054
  const range2 = await getUsedRange2(this.ctx, this.sheetId);
@@ -87383,7 +88060,7 @@ var WorksheetImpl = class {
87383
88060
  endRow: range2.endRow,
87384
88061
  endCol: range2.endCol
87385
88062
  });
87386
- return cellData.map((row) => row.map((cell) => cell.value ?? null));
88063
+ return cellData.map((row) => row.map((cell) => normalizeCellValue(cell.value ?? null)));
87387
88064
  }
87388
88065
  async getRange(a, b, c, d) {
87389
88066
  const bounds = resolveRange(a, b, c, d);
@@ -87507,7 +88184,7 @@ var WorksheetImpl = class {
87507
88184
  rowData.push({ value: null });
87508
88185
  } else {
87509
88186
  rowData.push({
87510
- value: viewportCellValueToCellValue(vc.value) ?? null,
88187
+ value: normalizeCellValue(vc.value) ?? null,
87511
88188
  formula: vc.formula,
87512
88189
  format: vc.format ?? void 0
87513
88190
  });
@@ -87534,10 +88211,10 @@ var WorksheetImpl = class {
87534
88211
  const { row, col } = resolveCell(address);
87535
88212
  const data = await getCell(this.ctx, this.sheetId, row, col);
87536
88213
  if (!data) return "";
87537
- const displayValue = await getDisplayValue2(this.ctx, this.sheetId, row, col);
87538
- let result = displayValue;
88214
+ const rawValue = cellValueToString(data.value);
88215
+ let result = rawValue;
87539
88216
  if (data.formula) {
87540
- result = displayValue !== "" ? `${displayValue}(${data.formula})` : `(${data.formula})`;
88217
+ result = rawValue !== "" ? `${rawValue}(${data.formula})` : `(${data.formula})`;
87541
88218
  }
87542
88219
  const styleHintsStr = await getStyleHints(this.ctx, this.sheetId, row, col);
87543
88220
  if (styleHintsStr) {
@@ -87578,7 +88255,7 @@ var WorksheetImpl = class {
87578
88255
  row,
87579
88256
  col,
87580
88257
  formula: vc.formula,
87581
- value: viewportCellValueToCellValue(vc.value)
88258
+ value: normalizeCellValue(vc.value)
87582
88259
  });
87583
88260
  }
87584
88261
  }
@@ -87603,8 +88280,8 @@ var WorksheetImpl = class {
87603
88280
  rowValues.push(`${cellAddr}:`);
87604
88281
  continue;
87605
88282
  }
87606
- const displayValue = vc.formatted ?? viewportCellValueToString(vc.value);
87607
- let cellStr = displayValue;
88283
+ const rawValue = cellValueToString(vc.value);
88284
+ let cellStr = rawValue;
87608
88285
  if (vc.formula) {
87609
88286
  const abbreviation = formulaAnalysis.formulaToId.get(`${row},${col}`);
87610
88287
  if (abbreviation) {
@@ -87625,7 +88302,7 @@ var WorksheetImpl = class {
87625
88302
  const styleCells = rangeData.cells.map((vc) => ({
87626
88303
  row: vc.row,
87627
88304
  col: vc.col,
87628
- value: viewportCellValueToCellValue(vc.value),
88305
+ value: normalizeCellValue(vc.value),
87629
88306
  format: vc.format
87630
88307
  }));
87631
88308
  const styleLines = analyzeStylePatterns(styleCells);
@@ -87647,7 +88324,7 @@ var WorksheetImpl = class {
87647
88324
  const leftCellData = leftRange.cells.map((vc) => ({
87648
88325
  row: vc.row,
87649
88326
  col: vc.col,
87650
- value: viewportCellValueToCellValue(vc.value),
88327
+ value: normalizeCellValue(vc.value),
87651
88328
  formatted: vc.formatted ?? void 0,
87652
88329
  indent: 0
87653
88330
  // indent not available from queryRange; would need format.indent
@@ -87676,7 +88353,7 @@ var WorksheetImpl = class {
87676
88353
  const aboveCellData = aboveRange.cells.map((vc) => ({
87677
88354
  row: vc.row,
87678
88355
  col: vc.col,
87679
- value: viewportCellValueToCellValue(vc.value),
88356
+ value: normalizeCellValue(vc.value),
87680
88357
  formatted: vc.formatted ?? void 0
87681
88358
  }));
87682
88359
  const aboveLine = buildAboveContext(
@@ -87815,7 +88492,7 @@ var WorksheetImpl = class {
87815
88492
  const cells = (rowMap.get(row) ?? []).slice().sort((a, b) => a.col - b.col);
87816
88493
  const rowData = [];
87817
88494
  for (const vc of cells) {
87818
- const rawValue = viewportCellValueToString(vc.value);
88495
+ const rawValue = cellValueToString(vc.value);
87819
88496
  const addr = toA12(vc.row, vc.col);
87820
88497
  if (vc.formula) {
87821
88498
  rowData.push(`${addr}:${rawValue}(=${vc.formula})`);
@@ -88023,7 +88700,7 @@ var WorksheetImpl = class {
88023
88700
  fields.push("");
88024
88701
  continue;
88025
88702
  }
88026
- let str = cell.formatted != null && cell.formatted !== "" ? cell.formatted : isCellError(val) ? `#${val.value}!` : String(val);
88703
+ let str = cell.formatted != null && cell.formatted !== "" ? cell.formatted : String(normalizeCellValue(val));
88027
88704
  if (str.length > 0 && "=+-@".includes(str[0])) {
88028
88705
  str = " " + str;
88029
88706
  }
@@ -88076,7 +88753,7 @@ var WorksheetImpl = class {
88076
88753
  const row = cellData[i];
88077
88754
  const obj = {};
88078
88755
  for (let j = 0; j < headers.length; j++) {
88079
- obj[headers[j]] = row[j]?.value ?? null;
88756
+ obj[headers[j]] = normalizeCellValue(row[j]?.value ?? null);
88080
88757
  }
88081
88758
  result.push(obj);
88082
88759
  }
@@ -88127,48 +88804,6 @@ var WorksheetImpl = class {
88127
88804
  });
88128
88805
  return formatValues(this.ctx, bridgeEntries);
88129
88806
  }
88130
- async goalSeek(targetCell, targetValue, changingCell) {
88131
- const sheetId = this.sheetId;
88132
- const targetPos = resolveCell(targetCell);
88133
- const changingPos = resolveCell(changingCell);
88134
- const formulaCellId = await getCellIdAt2(
88135
- this.ctx,
88136
- sheetId,
88137
- targetPos.row,
88138
- targetPos.col
88139
- );
88140
- if (!formulaCellId) {
88141
- throw new KernelError("COMPUTE_ERROR", `Target cell ${targetCell} has no content.`);
88142
- }
88143
- const inputCellId = await getCellIdAt2(
88144
- this.ctx,
88145
- sheetId,
88146
- changingPos.row,
88147
- changingPos.col
88148
- );
88149
- if (!inputCellId) {
88150
- throw new KernelError("COMPUTE_ERROR", `Changing cell ${changingCell} has no content.`);
88151
- }
88152
- const changingData = await getCell(this.ctx, sheetId, changingPos.row, changingPos.col);
88153
- const initialGuess = typeof changingData?.value === "number" ? changingData.value : 0;
88154
- const bridgeResult = await this.ctx.computeBridge.goalSeek({
88155
- formula_cell: formulaCellId,
88156
- target: targetValue,
88157
- input_cell: inputCellId,
88158
- initial_guess: initialGuess
88159
- });
88160
- const result = bridgeResult;
88161
- const solutionValue = result.solutionValue ?? result.solution_value;
88162
- const iterations = result.iterations;
88163
- if (result.found && solutionValue != null) {
88164
- await setCell(this.ctx, sheetId, changingPos.row, changingPos.col, solutionValue);
88165
- }
88166
- return {
88167
- found: result.found,
88168
- value: solutionValue,
88169
- iterations
88170
- };
88171
- }
88172
88807
  // ===========================================================================
88173
88808
  // Visibility
88174
88809
  // ===========================================================================
@@ -88240,7 +88875,7 @@ var WorksheetImpl = class {
88240
88875
  case 1:
88241
88876
  return accessor.numberValue;
88242
88877
  case 2:
88243
- return (0, import_core6.displayStringOrNull)(accessor.displayText);
88878
+ return displayStringOrNull(accessor.displayText);
88244
88879
  case 3:
88245
88880
  return accessor.numberValue !== 0;
88246
88881
  case 4: {
@@ -88506,6 +89141,9 @@ var WorksheetImpl = class {
88506
89141
  get protection() {
88507
89142
  return this._protection ??= new WorksheetProtectionImpl(this.ctx, this.sheetId);
88508
89143
  }
89144
+ get whatIf() {
89145
+ return this._whatIf ??= new WorksheetWhatIfImpl(this.ctx, this.sheetId);
89146
+ }
88509
89147
  get print() {
88510
89148
  return this._print ??= new WorksheetPrintImpl(this.ctx, this.sheetId);
88511
89149
  }
@@ -88737,8 +89375,7 @@ var WorkbookStylesImpl = class {
88737
89375
  this.ctx = ctx;
88738
89376
  }
88739
89377
  async getTableStyles() {
88740
- const styles = await this.ctx.computeBridge.getAllCustomTableStyles();
88741
- return styles;
89378
+ return this.ctx.computeBridge.getAllCustomTableStyles();
88742
89379
  }
88743
89380
  async createTableStyle(config) {
88744
89381
  const result = await this.ctx.computeBridge.createCustomTableStyle(
@@ -88864,7 +89501,7 @@ var WorkbookThemeImpl = class {
88864
89501
 
88865
89502
  // ../../kernel/src/api/workbook/workbook-impl.ts
88866
89503
  init_cjs_shims();
88867
- init_disposable();
89504
+ init_disposable2();
88868
89505
  init_errors();
88869
89506
 
88870
89507
  // ../../kernel/src/domain/form-controls/index.ts
@@ -89451,8 +90088,27 @@ var globalRegistry = new FunctionRegistry();
89451
90088
 
89452
90089
  // ../../spreadsheet-utils/src/function-catalog.ts
89453
90090
  init_cjs_shims();
89454
- var import_function_registry = require("@mog-sdk/spreadsheet-contracts/utils/function-registry");
89455
- var C = import_function_registry.FunctionCategory;
90091
+
90092
+ // ../../contracts/src/utils/function-registry.ts
90093
+ init_cjs_shims();
90094
+ var FunctionCategory = /* @__PURE__ */ ((FunctionCategory2) => {
90095
+ FunctionCategory2["MATH"] = "Math";
90096
+ FunctionCategory2["STATISTICAL"] = "Statistical";
90097
+ FunctionCategory2["TEXT"] = "Text";
90098
+ FunctionCategory2["LOGICAL"] = "Logical";
90099
+ FunctionCategory2["DATE_TIME"] = "Date & Time";
90100
+ FunctionCategory2["LOOKUP"] = "Lookup & Reference";
90101
+ FunctionCategory2["FINANCIAL"] = "Financial";
90102
+ FunctionCategory2["INFORMATION"] = "Information";
90103
+ FunctionCategory2["DATABASE"] = "Database";
90104
+ FunctionCategory2["ENGINEERING"] = "Engineering";
90105
+ FunctionCategory2["WEB"] = "Web";
90106
+ FunctionCategory2["TESTING"] = "Testing";
90107
+ return FunctionCategory2;
90108
+ })(FunctionCategory || {});
90109
+
90110
+ // ../../spreadsheet-utils/src/function-catalog.ts
90111
+ var C = FunctionCategory;
89456
90112
  var INLINE_FUNCTIONS = [
89457
90113
  // Aggregates
89458
90114
  ["SUM", C.MATH, "Adds all numbers in a range of cells", 1, -1],
@@ -90318,7 +90974,7 @@ function convertToFunctionInfo(metadata) {
90318
90974
 
90319
90975
  // ../../kernel/src/api/workbook/viewport.ts
90320
90976
  init_cjs_shims();
90321
- init_disposable();
90977
+ init_disposable2();
90322
90978
  var regionCounter = 0;
90323
90979
  var ViewportRegionImpl = class extends DisposableBase {
90324
90980
  constructor(sheetId, bounds, computeBridge, viewportId) {
@@ -90372,7 +91028,7 @@ var WorkbookViewportImpl = class {
90372
91028
  };
90373
91029
 
90374
91030
  // ../../kernel/src/api/workbook/workbook-impl.ts
90375
- var import_rendering2 = require("@mog-sdk/spreadsheet-contracts/rendering");
91031
+ init_rendering();
90376
91032
  var API_EVENT_TO_INTERNAL = {
90377
91033
  cellChanged: "cell:changed",
90378
91034
  rangeChanged: "range:changed",
@@ -90666,24 +91322,41 @@ var WorkbookImpl = class {
90666
91322
  timestamp: cp.timestamp
90667
91323
  }));
90668
91324
  }
90669
- async calculate(calculationType) {
90670
- const type = calculationType ?? "full";
90671
- try {
90672
- switch (type) {
90673
- case "recalculate":
90674
- await this.ctx.computeBridge.fullRecalc();
90675
- break;
90676
- case "full":
90677
- await this.ctx.computeBridge.fullRecalc();
90678
- break;
90679
- case "fullRebuild":
90680
- await this.ctx.computeBridge.fullRecalc();
90681
- break;
91325
+ async calculate(options) {
91326
+ const opts = typeof options === "string" ? { calculationType: options } : options ?? {};
91327
+ const recalcOptions = {};
91328
+ if (opts.iterative !== void 0) {
91329
+ if (typeof opts.iterative === "boolean") {
91330
+ recalcOptions.iterative = opts.iterative;
91331
+ } else {
91332
+ recalcOptions.iterative = true;
91333
+ if (opts.iterative.maxIterations !== void 0) {
91334
+ recalcOptions.maxIterations = opts.iterative.maxIterations;
91335
+ }
91336
+ if (opts.iterative.maxChange !== void 0) {
91337
+ recalcOptions.maxChange = opts.iterative.maxChange;
91338
+ }
90682
91339
  }
91340
+ }
91341
+ try {
91342
+ const result = await this.ctx.computeBridge.fullRecalc(recalcOptions);
91343
+ return {
91344
+ hasCircularRefs: result.metrics?.hasCircularRefs ?? false,
91345
+ converged: result.metrics?.iterativeConverged ?? false,
91346
+ iterations: result.metrics?.iterativeIterations ?? 0,
91347
+ maxDelta: result.metrics?.iterativeMaxDelta ?? 0,
91348
+ circularCellCount: result.metrics?.circularCellCount ?? 0
91349
+ };
90683
91350
  } catch (e) {
90684
91351
  const msg = String(e);
90685
91352
  if (msg.includes("Unknown napi method") || msg.includes("not a function") || msg.includes("not found")) {
90686
- return;
91353
+ return {
91354
+ hasCircularRefs: false,
91355
+ converged: false,
91356
+ iterations: 0,
91357
+ maxDelta: 0,
91358
+ circularCellCount: 0
91359
+ };
90687
91360
  }
90688
91361
  throw new KernelError("COMPUTE_ERROR", `Full recalculation failed: ${msg}`);
90689
91362
  }
@@ -91056,7 +91729,7 @@ var WorkbookImpl = class {
91056
91729
  get theme() {
91057
91730
  return this._theme ??= new WorkbookThemeImpl(
91058
91731
  { ctx: this.ctx, eventBus: this.eventBus },
91059
- import_rendering2.DEFAULT_CHROME_THEME
91732
+ DEFAULT_CHROME_THEME
91060
91733
  );
91061
91734
  }
91062
91735
  get viewport() {
@@ -91145,6 +91818,7 @@ var api_spec_default = {
91145
91818
  viewport: "WorkbookViewport"
91146
91819
  },
91147
91820
  ws: {
91821
+ whatIf: "WorksheetWhatIf",
91148
91822
  smartArt: "WorksheetSmartArt",
91149
91823
  changes: "WorksheetChanges",
91150
91824
  formats: "WorksheetFormats",
@@ -91242,10 +91916,12 @@ var api_spec_default = {
91242
91916
  ]
91243
91917
  },
91244
91918
  calculate: {
91245
- signature: "calculate(calculationType?: CalculationType): Promise<void>;",
91246
- docstring: "Trigger recalculation of formulas.\n@param calculationType - Type of recalculation (default: 'full')\n - 'recalculate' \u2014 recalculate dirty cells only\n - 'full' \u2014 recalculate all cells\n - 'fullRebuild' \u2014 rebuild dependency graph and recalculate all",
91919
+ signature: "calculate(options?: CalculateOptions | CalculationType): Promise<CalculateResult>;",
91920
+ docstring: "Trigger recalculation of formulas.\n@param options - Calculation options, or a CalculationType string for backward compatibility",
91247
91921
  usedTypes: [
91248
- "CalculationType"
91922
+ "CalculateOptions",
91923
+ "CalculationType",
91924
+ "CalculateResult"
91249
91925
  ]
91250
91926
  },
91251
91927
  getCalculationMode: {
@@ -91265,17 +91941,17 @@ var api_spec_default = {
91265
91941
  },
91266
91942
  setIterativeCalculation: {
91267
91943
  signature: "setIterativeCalculation(enabled: boolean): Promise<void>;",
91268
- docstring: "Set whether iterative calculation is enabled for circular references.\nConvenience mutator \u2014 patches `calculationSettings.enableIterativeCalculation`.",
91944
+ docstring: "Set whether iterative calculation is enabled for circular references.\nConvenience mutator \u2014 patches `calculationSettings.enableIterativeCalculation`.\n@deprecated Use calculate({ iterative: ... }) instead.",
91269
91945
  usedTypes: []
91270
91946
  },
91271
91947
  setMaxIterations: {
91272
91948
  signature: "setMaxIterations(n: number): Promise<void>;",
91273
- docstring: "Set the maximum number of iterations for iterative calculation.\nConvenience mutator \u2014 patches `calculationSettings.maxIterations`.",
91949
+ docstring: "Set the maximum number of iterations for iterative calculation.\nConvenience mutator \u2014 patches `calculationSettings.maxIterations`.\n@deprecated Use calculate({ iterative: { maxIterations: n } }) instead.",
91274
91950
  usedTypes: []
91275
91951
  },
91276
91952
  setConvergenceThreshold: {
91277
91953
  signature: "setConvergenceThreshold(threshold: number): Promise<void>;",
91278
- docstring: "Set the convergence threshold (maximum change) for iterative calculation.\nConvenience mutator \u2014 patches `calculationSettings.maxChange`.",
91954
+ docstring: "Set the convergence threshold (maximum change) for iterative calculation.\nConvenience mutator \u2014 patches `calculationSettings.maxChange`.\n@deprecated Use calculate({ iterative: { maxChange: threshold } }) instead.",
91279
91955
  usedTypes: []
91280
91956
  },
91281
91957
  getUsePrecisionAsDisplayed: {
@@ -91733,13 +92409,6 @@ var api_spec_default = {
91733
92409
  "FormatEntry"
91734
92410
  ]
91735
92411
  },
91736
- goalSeek: {
91737
- signature: "goalSeek(targetCell: string, targetValue: number, changingCell: string): Promise<GoalSeekResult>;",
91738
- docstring: "Run a goal seek to find the input value that produces a target result.",
91739
- usedTypes: [
91740
- "GoalSeekResult"
91741
- ]
91742
- },
91743
92412
  isVisible: {
91744
92413
  signature: "isVisible(): boolean;",
91745
92414
  docstring: "Check if the sheet is visible (sync -- local metadata).",
@@ -92261,6 +92930,25 @@ var api_spec_default = {
92261
92930
  }
92262
92931
  }
92263
92932
  },
92933
+ WorksheetWhatIf: {
92934
+ docstring: "Sub-API for What-If analysis operations.",
92935
+ functions: {
92936
+ goalSeek: {
92937
+ signature: "goalSeek(targetCell: string, targetValue: number, changingCell: string): Promise<GoalSeekResult>;",
92938
+ docstring: "Run a goal seek to find the input value that produces a target result.",
92939
+ usedTypes: [
92940
+ "GoalSeekResult"
92941
+ ]
92942
+ },
92943
+ dataTable: {
92944
+ signature: "dataTable(\n formulaCell: string,\n options: {\n rowInputCell?: string | null;\n colInputCell?: string | null;\n rowValues: (string | number | boolean | null)[];\n colValues: (string | number | boolean | null)[];\n },\n ): Promise<DataTableResult>;",
92945
+ docstring: "Evaluate a formula with different input values (What-If Data Table).\n\nOne-variable table: provide either `rowInputCell` or `colInputCell` (not both).\nTwo-variable table: provide both `rowInputCell` and `colInputCell`.\n\nFor one-variable tables, pass an empty array for the unused dimension's values.\n\nInput cells must already contain a value before calling this method.\n\n@param formulaCell - A1 address of the cell containing the formula to evaluate\n@param options - Input cells and substitution values\n@returns 2D grid of computed results",
92946
+ usedTypes: [
92947
+ "DataTableResult"
92948
+ ]
92949
+ }
92950
+ }
92951
+ },
92264
92952
  WorksheetSmartArt: {
92265
92953
  docstring: "",
92266
92954
  functions: {
@@ -92400,7 +93088,18 @@ var api_spec_default = {
92400
93088
  functions: {
92401
93089
  set: {
92402
93090
  signature: "set(address: string, format: CellFormat): Promise<FormatChangeResult>;",
92403
- docstring: 'Set format for a single cell.\n\n@param address - A1-style cell address (e.g. "A1", "B3")\n@param format - Format properties to apply',
93091
+ docstring: `Set format for a single cell.
93092
+
93093
+ @param address - A1-style cell address (e.g. "A1", "B3")
93094
+ @param format - Format properties to apply
93095
+
93096
+ @example
93097
+ // Bold red currency
93098
+ await ws.formats.set('A1', { bold: true, fontColor: '#ff0000', numberFormat: '$#,##0.00' });
93099
+ // Date format
93100
+ await ws.formats.set('B1', { numberFormat: 'YYYY-MM-DD' });
93101
+ // Header style
93102
+ await ws.formats.set('A1', { bold: true, fontSize: 14, backgroundColor: '#4472c4', fontColor: '#ffffff' });`,
92404
93103
  usedTypes: [
92405
93104
  "CellFormat",
92406
93105
  "FormatChangeResult"
@@ -92408,7 +93107,21 @@ var api_spec_default = {
92408
93107
  },
92409
93108
  setRange: {
92410
93109
  signature: "setRange(range: string, format: CellFormat): Promise<FormatChangeResult>;",
92411
- docstring: 'Set format for a contiguous range.\n\n@param range - A1-style range string (e.g. "A1:B2")\n@param format - Format properties to apply',
93110
+ docstring: `Set format for a contiguous range.
93111
+
93112
+ @param range - A1-style range string (e.g. "A1:B2")
93113
+ @param format - Format properties to apply
93114
+
93115
+ @example
93116
+ // Currency column
93117
+ await ws.formats.setRange('B2:B100', { numberFormat: '$#,##0.00' });
93118
+ // Header row with borders
93119
+ await ws.formats.setRange('A1:F1', {
93120
+ bold: true,
93121
+ backgroundColor: '#4472c4',
93122
+ fontColor: '#ffffff',
93123
+ borders: { bottom: { style: 'medium', color: '#2f5496' } }
93124
+ });`,
92412
93125
  usedTypes: [
92413
93126
  "CellFormat",
92414
93127
  "FormatChangeResult"
@@ -94585,8 +95298,8 @@ var api_spec_default = {
94585
95298
  },
94586
95299
  AxisConfig: {
94587
95300
  name: "AxisConfig",
94588
- definition: "{\n xAxis?: {\n type: AxisType;\n title?: string;\n min?: number;\n max?: number;\n gridLines?: boolean;\n /** Show minor gridlines between major gridlines */\n minorGridLines?: boolean;\n majorUnit?: number;\n minorUnit?: number;\n tickMarks?: 'inside' | 'outside' | 'cross' | 'none';\n /** Minor tick mark style (separate from major tickMarks) */\n minorTickMarks?: 'inside' | 'outside' | 'cross' | 'none';\n numberFormat?: string;\n reverse?: boolean;\n visible?: boolean;\n position?: 'bottom' | 'top' | 'left' | 'right';\n logBase?: number;\n displayUnit?: string;\n };\n yAxis?: {\n type: AxisType;\n title?: string;\n min?: number;\n max?: number;\n gridLines?: boolean;\n /** Show minor gridlines between major gridlines */\n minorGridLines?: boolean;\n majorUnit?: number;\n minorUnit?: number;\n tickMarks?: 'inside' | 'outside' | 'cross' | 'none';\n /** Minor tick mark style (separate from major tickMarks) */\n minorTickMarks?: 'inside' | 'outside' | 'cross' | 'none';\n numberFormat?: string;\n reverse?: boolean;\n visible?: boolean;\n position?: 'bottom' | 'top' | 'left' | 'right';\n logBase?: number;\n displayUnit?: string;\n };\n secondaryYAxis?: {\n type: AxisType;\n title?: string;\n min?: number;\n max?: number;\n show: boolean;\n majorUnit?: number;\n minorUnit?: number;\n tickMarks?: 'inside' | 'outside' | 'cross' | 'none';\n /** Minor tick mark style (separate from major tickMarks) */\n minorTickMarks?: 'inside' | 'outside' | 'cross' | 'none';\n numberFormat?: string;\n reverse?: boolean;\n visible?: boolean;\n position?: 'bottom' | 'top' | 'left' | 'right';\n logBase?: number;\n displayUnit?: string;\n };\n}",
94589
- docstring: "Axis configuration"
95301
+ definition: "{\n categoryAxis?: SingleAxisConfig;\n valueAxis?: SingleAxisConfig;\n secondaryCategoryAxis?: SingleAxisConfig;\n secondaryValueAxis?: SingleAxisConfig;\n /** @deprecated Use categoryAxis instead */\n xAxis?: SingleAxisConfig;\n /** @deprecated Use valueAxis instead */\n yAxis?: SingleAxisConfig;\n /** @deprecated Use secondaryValueAxis instead */\n secondaryYAxis?: SingleAxisConfig;\n}",
95302
+ docstring: "Axis configuration (matches AxisData wire type).\n\nWire field names: categoryAxis, valueAxis, secondaryCategoryAxis, secondaryValueAxis.\nLegacy aliases: xAxis, yAxis, secondaryYAxis (mapped in chart-bridge)."
94590
95303
  },
94591
95304
  AxisType: {
94592
95305
  name: "AxisType",
@@ -94741,7 +95454,34 @@ var api_spec_default = {
94741
95454
  CellFormat: {
94742
95455
  name: "CellFormat",
94743
95456
  definition: `{
95457
+ /** Excel-compatible number format code string.
95458
+
95459
+ Common format codes:
95460
+ - Currency: '$#,##0.00'
95461
+ - Accounting: '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)'
95462
+ - Percentage: '0.00%'
95463
+ - Date: 'M/D/YYYY', 'YYYY-MM-DD', 'MMM D, YYYY'
95464
+ - Time: 'h:mm AM/PM', 'HH:mm:ss'
95465
+ - Number: '#,##0.00', '0.00'
95466
+ - Scientific: '0.00E+00'
95467
+ - Text: '@'
95468
+ - Fraction: '# ?/?'
95469
+
95470
+ See the \`formatPresets\` section in api-spec.json for the full catalog
95471
+ of 85+ pre-defined format codes with examples.
95472
+
95473
+ @example
95474
+ // Currency
95475
+ { numberFormat: '$#,##0.00' }
95476
+ // Percentage with 1 decimal
95477
+ { numberFormat: '0.0%' }
95478
+ // ISO date
95479
+ { numberFormat: 'YYYY-MM-DD' } */
94744
95480
  numberFormat?: string;
95481
+ /** Number format category hint. Auto-detected from numberFormat when not set.
95482
+ Valid values: 'general' | 'number' | 'currency' | 'accounting' | 'date' |
95483
+ 'time' | 'percentage' | 'fraction' | 'scientific' | 'text' |
95484
+ 'special' | 'custom' */
94745
95485
  numberFormatType?: NumberFormatType;
94746
95486
  fontFamily?: string;
94747
95487
  fontSize?: number;
@@ -94960,8 +95700,8 @@ Example: { ignoreError: true } to suppress error indicators. */
94960
95700
  },
94961
95701
  ChartBorder: {
94962
95702
  name: "ChartBorder",
94963
- definition: "{\n color?: string;\n width?: number;\n style?: 'solid' | 'dashed' | 'dotted' | 'none';\n}",
94964
- docstring: "Shared chart border configuration"
95703
+ definition: "{\n color?: string;\n width?: number;\n style?: string;\n}",
95704
+ docstring: "Shared chart border configuration (matches ChartBorderData wire type)"
94965
95705
  },
94966
95706
  ChartConfig: {
94967
95707
  name: "ChartConfig",
@@ -94992,7 +95732,10 @@ Example: { ignoreError: true } to suppress error indicators. */
94992
95732
  series?: SeriesConfig[];
94993
95733
  dataLabels?: DataLabelConfig;
94994
95734
  pieSlice?: PieSliceConfig;
95735
+ /** @deprecated Use trendlines[] instead \u2014 kept for backward compat */
94995
95736
  trendline?: TrendlineConfig;
95737
+ /** Wire-compatible trendline array */
95738
+ trendlines?: TrendlineConfig[];
94996
95739
  /** Connect scatter points with lines (scatter-lines variant) */
94997
95740
  showLines?: boolean;
94998
95741
  /** Use smooth curves for scatter lines (scatter-smooth-lines variant) */
@@ -95102,11 +95845,6 @@ that are stored on the chart but not part of the core config schema. */
95102
95845
  definition: "{\n /** Column index to write to (0-indexed) */\n columnIndex: number;\n /** JSONPath or field name to extract from data */\n dataPath: string;\n /** Optional transform formula (receives value as input) */\n transform?: string;\n /** Header text (if headerRow >= 0) */\n headerText?: string;\n}",
95103
95846
  docstring: "Column mapping for a sheet data binding."
95104
95847
  },
95105
- Comment: {
95106
- name: "Comment",
95107
- definition: "{\n id: string;\n cellId: string;\n cellAddress: string;\n text: string;\n author: string;\n threadId?: string;\n resolved?: boolean;\n createdAt?: number;\n parentId?: string;\n authorId?: string;\n modifiedAt?: number;\n content?: RichTextSegment[];\n}",
95108
- docstring: "A cell comment (thread-aware)."
95109
- },
95110
95848
  ConditionalFormat: {
95111
95849
  name: "ConditionalFormat",
95112
95850
  definition: "{\n /** Unique format identifier. */\n id: string;\n /** Cell ranges this format applies to. */\n ranges: CellRange[];\n /** Rules to evaluate (sorted by priority). */\n rules: CFRule[];\n}",
@@ -95164,8 +95902,8 @@ that are stored on the chart but not part of the core config schema. */
95164
95902
  },
95165
95903
  DataLabelConfig: {
95166
95904
  name: "DataLabelConfig",
95167
- definition: "{\n show: boolean;\n position?: 'inside' | 'outside' | 'top' | 'bottom' | 'left' | 'right';\n format?: string;\n showCategoryName?: boolean;\n showSeriesName?: boolean;\n showPercentage?: boolean;\n showBubbleSize?: boolean;\n showLegendKey?: boolean;\n separator?: string;\n /** Show leader lines connecting data labels to their data points (pie/doughnut charts) */\n showLeaderLines?: boolean;\n}",
95168
- docstring: "Data label configuration"
95905
+ definition: "{\n show: boolean;\n position?: string;\n format?: string;\n showValue?: boolean;\n showCategoryName?: boolean;\n showSeriesName?: boolean;\n showPercentage?: boolean;\n showBubbleSize?: boolean;\n showLegendKey?: boolean;\n separator?: string;\n showLeaderLines?: boolean;\n text?: string;\n}",
95906
+ docstring: "Data label configuration (matches DataLabelData wire type)"
95169
95907
  },
95170
95908
  DatePeriod: {
95171
95909
  name: "DatePeriod",
@@ -95219,8 +95957,8 @@ that are stored on the chart but not part of the core config schema. */
95219
95957
  },
95220
95958
  ErrorBarConfig: {
95221
95959
  name: "ErrorBarConfig",
95222
- definition: "{\n visible?: boolean;\n type?: 'fixedValue' | 'percentage' | 'standardDeviation' | 'standardError' | 'custom';\n include?: 'both' | 'plus' | 'minus';\n value?: number;\n}",
95223
- docstring: "Error bar configuration for series"
95960
+ definition: "{\n visible?: boolean;\n direction?: string;\n barType?: string;\n valueType?: string;\n value?: number;\n noEndCap?: boolean;\n}",
95961
+ docstring: "Error bar configuration for series (matches ErrorBarData wire type)"
95224
95962
  },
95225
95963
  ErrorVariant: {
95226
95964
  name: "ErrorVariant",
@@ -95262,7 +96000,7 @@ Used in condition filters where users specify rules like
95262
96000
  },
95263
96001
  FilterDetailInfo: {
95264
96002
  name: "FilterDetailInfo",
95265
- definition: "{\n /** Filter ID */\n id: string;\n /** Resolved numeric range of the filter */\n range: { startRow: number; startCol: number; endRow: number; endCol: number };\n /** Per-column filter criteria, keyed by header cell ID */\n columnFilters: Record<string, ColumnFilterCriteria>;\n}",
96003
+ definition: "{\n /** Filter ID */\n id: string;\n /** Resolved numeric range of the filter */\n range: { startRow: number; startCol: number; endRow: number; endCol: number };\n /** Per-column filter criteria, keyed by header cell ID */\n columnFilters: Record<string, ColumnFilter>;\n}",
95266
96004
  docstring: "Detailed filter information including resolved numeric range and column filters."
95267
96005
  },
95268
96006
  FilterInfo: {
@@ -95277,8 +96015,8 @@ Used in condition filters where users specify rules like
95277
96015
  },
95278
96016
  FilterState: {
95279
96017
  name: "FilterState",
95280
- definition: "{\n /** The range the auto-filter is applied to (A1 notation) */\n range: string;\n /** Per-column filter criteria, keyed by column index */\n columns: Map<number, ColumnFilterCriteria>;\n}",
95281
- docstring: "Current auto-filter state for a sheet."
96018
+ definition: "{\n /** The range the auto-filter is applied to (A1 notation) */\n range: string;\n /** Per-column filter criteria, keyed by column identifier (string) */\n columnFilters: Record<string, ColumnFilter>;\n}",
96019
+ docstring: "API filter state \u2014 derived from Rust FilterState with A1-notation range."
95282
96020
  },
95283
96021
  FloatingObject: {
95284
96022
  name: "FloatingObject",
@@ -95380,13 +96118,8 @@ Used in condition filters where users specify rules like
95380
96118
  },
95381
96119
  LegendConfig: {
95382
96120
  name: "LegendConfig",
95383
- definition: "{\n show: boolean;\n position: LegendPosition;\n visible?: boolean;\n overlay?: boolean;\n font?: ChartFont;\n}",
95384
- docstring: "Legend configuration"
95385
- },
95386
- LegendPosition: {
95387
- name: "LegendPosition",
95388
- definition: "'top' | 'bottom' | 'left' | 'right' | 'none'",
95389
- docstring: "Legend position options"
96121
+ definition: "{\n show: boolean;\n position: string;\n visible: boolean;\n overlay?: boolean;\n font?: ChartFont;\n}",
96122
+ docstring: "Legend configuration (matches LegendData wire type)"
95390
96123
  },
95391
96124
  LineDash: {
95392
96125
  name: "LineDash",
@@ -95451,7 +96184,7 @@ Used in condition filters where users specify rules like
95451
96184
  Note: {
95452
96185
  name: "Note",
95453
96186
  definition: "{\n content: string;\n author: string;\n cellAddress: string;\n}",
95454
- docstring: "A cell note (simple, single string per cell)."
96187
+ docstring: "A cell note (simple, single string per cell). API-only type (no Rust equivalent)."
95455
96188
  },
95456
96189
  NumberFormatCategory: {
95457
96190
  name: "NumberFormatCategory",
@@ -95472,11 +96205,6 @@ Used in condition filters where users specify rules like
95472
96205
  },
95473
96206
  docstring: "Number format category classification.\nMatches the FormatType enum from Rust compute-formats."
95474
96207
  },
95475
- NumberFormatType: {
95476
- name: "NumberFormatType",
95477
- definition: "| 'general'\n | 'number'\n | 'currency'\n | 'accounting'\n | 'date'\n | 'time'\n | 'percentage'\n | 'fraction'\n | 'scientific'\n | 'text'\n | 'special'\n | 'custom'",
95478
- docstring: "Number format types"
95479
- },
95480
96208
  ObjectAnchorType: {
95481
96209
  name: "ObjectAnchorType",
95482
96210
  definition: "| 'twoCell' // Anchored to two cells (moves and resizes with cells)\n | 'oneCell' // Anchored to one cell (moves but doesn't resize)\n | 'absolute'",
@@ -95588,8 +96316,8 @@ Used in condition filters where users specify rules like
95588
96316
  },
95589
96317
  PieSliceConfig: {
95590
96318
  name: "PieSliceConfig",
95591
- definition: "{\n /** Index of slice to explode (pull out from center) */\n explodedIndex?: number;\n /** Array of indices to explode */\n explodedIndices?: number[];\n /** Distance to explode (0-1, default 0.1) */\n explodeOffset?: number;\n /** Allow clicking to select/explode slices */\n selectable?: boolean;\n}",
95592
- docstring: "Pie/doughnut slice configuration for exploded slices"
96319
+ definition: "{\n explosion?: number;\n explodedIndices?: number[];\n explodeOffset?: number;\n}",
96320
+ docstring: "Pie/doughnut slice configuration (matches PieSliceData wire type)"
95593
96321
  },
95594
96322
  PivotQueryRecord: {
95595
96323
  name: "PivotQueryRecord",
@@ -95628,8 +96356,8 @@ Used in condition filters where users specify rules like
95628
96356
  },
95629
96357
  PointFormat: {
95630
96358
  name: "PointFormat",
95631
- definition: "{\n fill?: string;\n border?: ChartBorder;\n dataLabel?: DataLabelConfig;\n}",
95632
- docstring: "Per-point formatting for individual data points in a series"
96359
+ definition: "{\n idx: number;\n fill?: string;\n border?: ChartBorder;\n dataLabel?: DataLabelConfig;\n}",
96360
+ docstring: "Per-point formatting for individual data points (matches PointFormatData wire type)"
95633
96361
  },
95634
96362
  PrintSettings: {
95635
96363
  name: "PrintSettings",
@@ -95678,11 +96406,6 @@ Used in condition filters where users specify rules like
95678
96406
  definition: "{\n [K in keyof CellFormat]-?: CellFormat[K] | null;\n}",
95679
96407
  docstring: "Dense cell format where every property is explicitly present (null when unset). Returned by formats.get()."
95680
96408
  },
95681
- RichTextSegment: {
95682
- name: "RichTextSegment",
95683
- definition: "{\n text: string;\n bold?: boolean;\n italic?: boolean;\n underline?: boolean;\n strikethrough?: boolean;\n color?: string;\n fontName?: string;\n fontSize?: number;\n}",
95684
- docstring: "A single segment of rich text content."
95685
- },
95686
96409
  Scenario: {
95687
96410
  name: "Scenario",
95688
96411
  definition: "{\n /** Unique scenario ID */\n id: string;\n /** Creation timestamp (Unix ms) */\n createdAt: number;\n}",
@@ -95710,46 +96433,8 @@ Used in condition filters where users specify rules like
95710
96433
  },
95711
96434
  SeriesConfig: {
95712
96435
  name: "SeriesConfig",
95713
- definition: `{
95714
- name?: string;
95715
- type?: ChartType;
95716
- color?: string;
95717
- yAxisIndex?: 0 | 1;
95718
- showMarkers?: boolean;
95719
- markerSize?: number;
95720
- markerStyle?: | 'circle'
95721
- | 'dash'
95722
- | 'diamond'
95723
- | 'dot'
95724
- | 'picture'
95725
- | 'plus'
95726
- | 'square'
95727
- | 'star'
95728
- | 'triangle'
95729
- | 'x'
95730
- | 'auto'
95731
- | 'none';
95732
- lineWidth?: number;
95733
- smooth?: boolean;
95734
- dataLabels?: DataLabelConfig;
95735
- trendline?: TrendlineConfig;
95736
- errorBars?: ErrorBarConfig;
95737
- /** Separate X-axis error bars (for scatter/bubble charts) */
95738
- xErrorBars?: ErrorBarConfig;
95739
- /** Separate Y-axis error bars (for scatter/bubble charts) */
95740
- yErrorBars?: ErrorBarConfig;
95741
- /** Whether to invert the fill color for negative values */
95742
- invertIfNegative?: boolean;
95743
- /** Explosion distance for pie/doughnut per-series (0-400%) */
95744
- explosion?: number;
95745
- /** Data values range in A1 notation (e.g., "B2:B10") */
95746
- values?: string;
95747
- /** Category labels range in A1 notation (e.g., "A2:A10") */
95748
- categories?: string;
95749
- /** Per-point formatting overrides */
95750
- points?: PointFormat[];
95751
- }`,
95752
- docstring: "Individual series configuration"
96436
+ definition: "{\n name?: string;\n type?: string;\n color?: string;\n values?: string;\n categories?: string;\n bubbleSize?: string;\n smooth?: boolean;\n explosion?: number;\n invertIfNegative?: boolean;\n yAxisIndex?: number;\n showMarkers?: boolean;\n markerSize?: number;\n markerStyle?: string;\n lineWidth?: number;\n points?: PointFormat[];\n dataLabels?: DataLabelConfig;\n trendlines?: TrendlineConfig[];\n errorBars?: ErrorBarConfig;\n xErrorBars?: ErrorBarConfig;\n yErrorBars?: ErrorBarConfig;\n idx?: number;\n order?: number;\n /** @deprecated Use trendlines[] instead */\n trendline?: TrendlineConfig;\n}",
96437
+ docstring: "Individual series configuration (matches ChartSeriesData wire type)"
95753
96438
  },
95754
96439
  SeriesOrientation: {
95755
96440
  name: "SeriesOrientation",
@@ -95826,6 +96511,11 @@ Used in condition filters where users specify rules like
95826
96511
  definition: "{\n /** Sheet ID */\n id: string;\n /** Sheet name */\n name: string;\n /** Sheet index (0-based) */\n index: number;\n /** Range containing all non-empty cells (A1 notation), or null if empty */\n usedRange: string | null;\n /** Number of cells with data */\n cellCount: number;\n /** Number of cells with formulas */\n formulaCount: number;\n /** Number of charts in this sheet */\n chartCount: number;\n /** Sheet dimensions */\n dimensions: { rows: number; cols: number };\n}",
95827
96512
  docstring: "A summary snapshot of a single sheet."
95828
96513
  },
96514
+ SingleAxisConfig: {
96515
+ name: "SingleAxisConfig",
96516
+ definition: "{\n title?: string;\n visible: boolean;\n min?: number;\n max?: number;\n axisType?: string;\n gridLines?: boolean;\n minorGridLines?: boolean;\n majorUnit?: number;\n minorUnit?: number;\n tickMarks?: string;\n minorTickMarks?: string;\n numberFormat?: string;\n reverse?: boolean;\n position?: string;\n logBase?: number;\n displayUnit?: string;\n /** @deprecated Alias for axisType \u2014 kept for backward compat with charts package */\n type?: AxisType;\n /** @deprecated Alias for visible \u2014 kept for backward compat with charts package */\n show?: boolean;\n}",
96517
+ docstring: "Single axis configuration (matches SingleAxisData wire type)."
96518
+ },
95829
96519
  Slicer: {
95830
96520
  name: "Slicer",
95831
96521
  definition: "{\n /** Currently selected filter items */\n selectedItems: CellValue[];\n /** Position and dimensions in pixels */\n position: { x: number; y: number; width: number; height: number };\n}",
@@ -95833,7 +96523,7 @@ Used in condition filters where users specify rules like
95833
96523
  },
95834
96524
  SlicerConfig: {
95835
96525
  name: "SlicerConfig",
95836
- definition: "{\n /** Name of the table to connect the slicer to */\n tableName?: string;\n /** Column name within the table to filter on */\n columnName?: string;\n /** Display name for the slicer (auto-generated if omitted) */\n name?: string;\n /** Position and dimensions in pixels */\n position?: { x: number; y: number; width: number; height: number };\n /** Data source connection (rich alternative to tableName/columnName) */\n source?: SlicerSource;\n /** Slicer caption (header text) */\n caption?: string;\n /** Style configuration (partial for incremental updates) */\n style?: Partial<SlicerStyle>;\n /** Show slicer header */\n showHeader?: boolean;\n /** Currently selected date range start (timeline slicers) */\n selectedStartDate?: number;\n /** Currently selected date range end (timeline slicers) */\n selectedEndDate?: number;\n /** Current aggregation level (timeline slicers) */\n timelineLevel?: TimelineLevel;\n}",
96526
+ definition: "{\n /** Slicer ID (generated if omitted) */\n id?: string;\n /** Sheet ID the slicer belongs to */\n sheetId?: string;\n /** Name of the table to connect the slicer to */\n tableName?: string;\n /** Column name within the table to filter on */\n columnName?: string;\n /** Display name for the slicer (auto-generated if omitted) */\n name?: string;\n /** Position and dimensions in pixels */\n position?: { x: number; y: number; width: number; height: number };\n /** Data source connection (rich alternative to tableName/columnName) */\n source?: SlicerSource;\n /** Slicer caption (header text) */\n caption?: string;\n /** Style configuration */\n style?: SlicerStyle;\n /** Show slicer header */\n showHeader?: boolean;\n /** Z-order within the sheet */\n zIndex?: number;\n /** Whether slicer position is locked */\n locked?: boolean;\n /** Whether multi-select is enabled */\n multiSelect?: boolean;\n /** Initial selected values */\n selectedValues?: CellValue[];\n /** Currently selected date range start (timeline slicers) */\n selectedStartDate?: number;\n /** Currently selected date range end (timeline slicers) */\n selectedEndDate?: number;\n /** Current aggregation level (timeline slicers) */\n timelineLevel?: TimelineLevel;\n}",
95837
96527
  docstring: "Configuration for creating a new slicer."
95838
96528
  },
95839
96529
  SlicerCustomStyle: {
@@ -95943,13 +96633,13 @@ Used in condition filters where users specify rules like
95943
96633
  },
95944
96634
  TableColumn: {
95945
96635
  name: "TableColumn",
95946
- definition: "{\n /** Column header name */\n name: string;\n /** Column index within the table (0-based) */\n index: number;\n /** Total row function type */\n totalFunction?: TotalFunction;\n /** Calculated column formula */\n calculatedFormula?: string;\n}",
95947
- docstring: "A single column in a table."
96636
+ definition: "{\n /** Unique column ID */\n id: string;\n /** Column header name */\n name: string;\n /** Column index within the table (0-based) */\n index: number;\n /** Total row function type */\n totalsFunction: TotalsFunction | null;\n /** Total row label */\n totalsLabel: string | null;\n /** Calculated column formula */\n calculatedFormula?: string;\n}",
96637
+ docstring: "A single column in a table.\n\nField names match the Rust-generated `TableColumn` type (compute-types.gen.ts)."
95948
96638
  },
95949
96639
  TableInfo: {
95950
96640
  name: "TableInfo",
95951
- definition: "{\n /** Internal table identifier (opaque string) */\n id?: string;\n /** Table name */\n name: string;\n /** Table range in A1 notation */\n range: string;\n /** Whether the table has a header row */\n hasHeaders: boolean;\n /** Table style preset name */\n style?: TableStylePreset;\n /** Column definitions */\n columns: TableColumn[];\n /** Whether the total row is visible */\n showTotals?: boolean;\n /** Whether first column is highlighted */\n highlightFirstColumn?: boolean;\n /** Whether last column is highlighted */\n highlightLastColumn?: boolean;\n /** Whether banded columns are shown */\n showBandedColumns?: boolean;\n /** Whether banded rows are shown */\n showBandedRows?: boolean;\n /** Whether filter buttons are shown */\n showFilterButton?: boolean;\n /** Whether the header row is shown (mirrors hasHeaders) */\n showHeaders?: boolean;\n}",
95952
- docstring: "Information about an existing table."
96641
+ definition: "{\n /** Internal table identifier */\n id: string;\n /** Table name */\n name: string;\n /** Display name */\n displayName: string;\n /** Sheet the table belongs to */\n sheetId: string;\n /** Table range in A1 notation (converted from Rust SheetRange) */\n range: string;\n /** Column definitions */\n columns: TableColumn[];\n /** Whether the table has a header row */\n hasHeaderRow: boolean;\n /** Whether the totals row is visible */\n hasTotalsRow: boolean;\n /** Table style name */\n style: string;\n /** Whether banded rows are shown */\n bandedRows: boolean;\n /** Whether banded columns are shown */\n bandedColumns: boolean;\n /** Whether first column is emphasized */\n emphasizeFirstColumn: boolean;\n /** Whether last column is emphasized */\n emphasizeLastColumn: boolean;\n /** Whether filter buttons are shown */\n showFilterButtons: boolean;\n}",
96642
+ docstring: "Information about an existing table.\n\nField names match the Rust-generated `Table` type (compute-types.gen.ts)\nexcept `range` which is converted from `SheetRange` to A1 notation string."
95953
96643
  },
95954
96644
  TableOptions: {
95955
96645
  name: "TableOptions",
@@ -95961,16 +96651,6 @@ Used in condition filters where users specify rules like
95961
96651
  definition: "{\n /** Style name */\n name: string;\n}",
95962
96652
  docstring: "Configuration for creating/updating a custom table style."
95963
96653
  },
95964
- TableStyleInfo: {
95965
- name: "TableStyleInfo",
95966
- definition: "{\n /** Style name/ID */\n name: string;\n /** Display name */\n displayName?: string;\n /** Whether this is a built-in style */\n isBuiltIn?: boolean;\n}",
95967
- docstring: "Information about a custom table style."
95968
- },
95969
- TableStylePreset: {
95970
- name: "TableStylePreset",
95971
- definition: "| 'none'\n // Light styles\n | 'light1'\n | 'light2'\n | 'light3'\n | 'light4'\n | 'light5'\n | 'light6'\n | 'light7'\n | 'light8'\n | 'light9'\n | 'light10'\n | 'light11'\n | 'light12'\n | 'light13'\n | 'light14'\n | 'light15'\n | 'light16'\n | 'light17'\n | 'light18'\n | 'light19'\n | 'light20'\n | 'light21'\n // Medium styles\n | 'medium1'\n | 'medium2'\n | 'medium3'\n | 'medium4'\n | 'medium5'\n | 'medium6'\n | 'medium7'\n | 'medium8'\n | 'medium9'\n | 'medium10'\n | 'medium11'\n | 'medium12'\n | 'medium13'\n | 'medium14'\n | 'medium15'\n | 'medium16'\n | 'medium17'\n | 'medium18'\n | 'medium19'\n | 'medium20'\n | 'medium21'\n | 'medium22'\n | 'medium23'\n | 'medium24'\n | 'medium25'\n | 'medium26'\n | 'medium27'\n | 'medium28'\n // Dark styles\n | 'dark1'\n | 'dark2'\n | 'dark3'\n | 'dark4'\n | 'dark5'\n | 'dark6'\n | 'dark7'\n | 'dark8'\n | 'dark9'\n | 'dark10'\n | 'dark11'",
95972
- docstring: "Table style presets matching Excel's table style gallery.\nLight styles (1-21), Medium styles (1-28), Dark styles (1-11)."
95973
- },
95974
96654
  TextBoxBorder: {
95975
96655
  name: "TextBoxBorder",
95976
96656
  definition: "{\n /** Corner radius in pixels (for rounded corners) */\n radius?: number;\n}",
@@ -96030,20 +96710,15 @@ Used in condition filters where users specify rules like
96030
96710
  definition: "{\n text?: string;\n visible?: boolean;\n position?: 'top' | 'bottom' | 'left' | 'right' | 'overlay';\n font?: ChartFont;\n}",
96031
96711
  docstring: "Rich title configuration"
96032
96712
  },
96033
- TotalFunction: {
96034
- name: "TotalFunction",
96035
- definition: "| 'none'\n | 'sum'\n | 'count'\n | 'average'\n | 'min'\n | 'max'\n | 'stdDev'\n | 'var'\n | 'countNums'\n | 'custom'",
96036
- docstring: "Total row function types.\nMaps to Excel's total row dropdown options."
96713
+ TotalsFunction: {
96714
+ name: "TotalsFunction",
96715
+ definition: "| 'average'\n | 'count'\n | 'countNums'\n | 'max'\n | 'min'\n | 'stdDev'\n | 'sum'\n | 'var'\n | 'custom'\n | 'none'",
96716
+ docstring: "Totals function type (matches Rust TotalsFunction)."
96037
96717
  },
96038
96718
  TrendlineConfig: {
96039
96719
  name: "TrendlineConfig",
96040
- definition: "{\n show: boolean;\n type: TrendlineType;\n color?: string;\n lineWidth?: number;\n showEquation?: boolean;\n showR2?: boolean;\n order?: number;\n period?: number;\n intercept?: number;\n forwardPeriod?: number;\n backwardPeriod?: number;\n name?: string;\n}",
96041
- docstring: "Trendline configuration"
96042
- },
96043
- TrendlineType: {
96044
- name: "TrendlineType",
96045
- definition: "| 'linear'\n | 'exponential'\n | 'logarithmic'\n | 'polynomial'\n | 'power'\n | 'moving-average'",
96046
- docstring: "Trendline types for scatter charts"
96720
+ definition: "{\n show?: boolean;\n type?: string;\n color?: string;\n lineWidth?: number;\n order?: number;\n period?: number;\n forward?: number;\n backward?: number;\n intercept?: number;\n displayEquation?: boolean;\n displayRSquared?: boolean;\n name?: string;\n /** @deprecated Use displayEquation instead */\n showEquation?: boolean;\n /** @deprecated Use displayRSquared instead */\n showR2?: boolean;\n /** @deprecated Use forward instead */\n forwardPeriod?: number;\n /** @deprecated Use backward instead */\n backwardPeriod?: number;\n}",
96721
+ docstring: "Trendline configuration (matches TrendlineData wire type)"
96047
96722
  },
96048
96723
  UndoHistoryEntry: {
96049
96724
  name: "UndoHistoryEntry",
@@ -96162,6 +96837,415 @@ Used in condition filters where users specify rules like
96162
96837
  definition: "{\n /** All sheets in the workbook */\n sheets: SheetSnapshot[];\n /** ID of the currently active sheet */\n activeSheetId: string;\n /** Total number of sheets */\n sheetCount: number;\n}",
96163
96838
  docstring: "A summary snapshot of the entire workbook state."
96164
96839
  }
96840
+ },
96841
+ formatPresets: {
96842
+ general: {
96843
+ default: {
96844
+ code: "General",
96845
+ description: "",
96846
+ example: "1234.5"
96847
+ }
96848
+ },
96849
+ number: {
96850
+ integer: {
96851
+ code: "0",
96852
+ description: "No decimal places",
96853
+ example: "1235"
96854
+ },
96855
+ decimal1: {
96856
+ code: "0.0",
96857
+ description: "1 decimal place",
96858
+ example: "1234.5"
96859
+ },
96860
+ decimal2: {
96861
+ code: "0.00",
96862
+ description: "2 decimal places",
96863
+ example: "1234.50"
96864
+ },
96865
+ decimal3: {
96866
+ code: "0.000",
96867
+ description: "3 decimal places",
96868
+ example: "1234.500"
96869
+ },
96870
+ thousands: {
96871
+ code: "#,##0",
96872
+ description: "Thousands separator, no decimals",
96873
+ example: "1,235"
96874
+ },
96875
+ thousandsDecimal1: {
96876
+ code: "#,##0.0",
96877
+ description: "Thousands separator, 1 decimal",
96878
+ example: "1,234.5"
96879
+ },
96880
+ thousandsDecimal2: {
96881
+ code: "#,##0.00",
96882
+ description: "Thousands separator, 2 decimals",
96883
+ example: "1,234.50"
96884
+ },
96885
+ negativeRed: {
96886
+ code: "#,##0.00;[Red]-#,##0.00",
96887
+ description: "Red negative numbers",
96888
+ example: "-1,234.50"
96889
+ },
96890
+ negativeParens: {
96891
+ code: "#,##0.00;(#,##0.00)",
96892
+ description: "Parentheses for negatives",
96893
+ example: "(1,234.50)"
96894
+ },
96895
+ negativeParensRed: {
96896
+ code: "#,##0.00;[Red](#,##0.00)",
96897
+ description: "Red parentheses for negatives",
96898
+ example: "(1,234.50)"
96899
+ }
96900
+ },
96901
+ currency: {
96902
+ usd: {
96903
+ code: "$#,##0.00",
96904
+ description: "US Dollar",
96905
+ example: "$1,234.50"
96906
+ },
96907
+ usdNegMinus: {
96908
+ code: "$#,##0.00;-$#,##0.00",
96909
+ description: "USD minus",
96910
+ example: "-$1,234.50"
96911
+ },
96912
+ usdNegParens: {
96913
+ code: "$#,##0.00;($#,##0.00)",
96914
+ description: "USD parentheses",
96915
+ example: "($1,234.50)"
96916
+ },
96917
+ usdNegRed: {
96918
+ code: "$#,##0.00;[Red]-$#,##0.00",
96919
+ description: "USD red minus",
96920
+ example: "-$1,234.50"
96921
+ },
96922
+ usdNegParensRed: {
96923
+ code: "$#,##0.00;[Red]($#,##0.00)",
96924
+ description: "USD red parentheses",
96925
+ example: "($1,234.50)"
96926
+ },
96927
+ eur: {
96928
+ code: "\u20AC#,##0.00",
96929
+ description: "Euro",
96930
+ example: "\u20AC1,234.50"
96931
+ },
96932
+ gbp: {
96933
+ code: "\xA3#,##0.00",
96934
+ description: "British Pound",
96935
+ example: "\xA31,234.50"
96936
+ },
96937
+ jpy: {
96938
+ code: "\xA5#,##0",
96939
+ description: "Japanese Yen (no decimals)",
96940
+ example: "\xA51,235"
96941
+ },
96942
+ cny: {
96943
+ code: "\xA5#,##0.00",
96944
+ description: "Chinese Yuan",
96945
+ example: "\xA51,234.50"
96946
+ },
96947
+ inr: {
96948
+ code: "\u20B9#,##0.00",
96949
+ description: "Indian Rupee",
96950
+ example: "\u20B91,234.50"
96951
+ },
96952
+ krw: {
96953
+ code: "\u20A9#,##0",
96954
+ description: "Korean Won (no decimals)",
96955
+ example: "\u20A91,235"
96956
+ },
96957
+ chf: {
96958
+ code: "CHF #,##0.00",
96959
+ description: "Swiss Franc",
96960
+ example: "CHF 1,234.50"
96961
+ },
96962
+ cad: {
96963
+ code: "CA$#,##0.00",
96964
+ description: "Canadian Dollar",
96965
+ example: "CA$1,234.50"
96966
+ },
96967
+ aud: {
96968
+ code: "A$#,##0.00",
96969
+ description: "Australian Dollar",
96970
+ example: "A$1,234.50"
96971
+ }
96972
+ },
96973
+ accounting: {
96974
+ usd: {
96975
+ code: '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)',
96976
+ description: "USD Accounting",
96977
+ example: "$ 1,234.50"
96978
+ },
96979
+ eur: {
96980
+ code: '_(\u20AC* #,##0.00_);_(\u20AC* (#,##0.00);_(\u20AC* "-"??_);_(@_)',
96981
+ description: "EUR Accounting",
96982
+ example: "\u20AC 1,234.50"
96983
+ },
96984
+ gbp: {
96985
+ code: '_(\xA3* #,##0.00_);_(\xA3* (#,##0.00);_(\xA3* "-"??_);_(@_)',
96986
+ description: "GBP Accounting",
96987
+ example: "\xA3 1,234.50"
96988
+ }
96989
+ },
96990
+ date: {
96991
+ shortUS: {
96992
+ code: "m/d/yyyy",
96993
+ description: "Short date (US)",
96994
+ example: "12/13/2025"
96995
+ },
96996
+ mediumUS: {
96997
+ code: "mmm d, yyyy",
96998
+ description: "Medium date (US)",
96999
+ example: "Dec 13, 2025"
97000
+ },
97001
+ longUS: {
97002
+ code: "mmmm d, yyyy",
97003
+ description: "Long date (US)",
97004
+ example: "December 13, 2025"
97005
+ },
97006
+ fullUS: {
97007
+ code: "dddd, mmmm d, yyyy",
97008
+ description: "Full date (US)",
97009
+ example: "Saturday, December 13, 2025"
97010
+ },
97011
+ iso: {
97012
+ code: "yyyy-mm-dd",
97013
+ description: "ISO 8601",
97014
+ example: "2025-12-13"
97015
+ },
97016
+ shortEU: {
97017
+ code: "d/m/yyyy",
97018
+ description: "Short date (EU)",
97019
+ example: "13/12/2025"
97020
+ },
97021
+ mediumEU: {
97022
+ code: "d mmm yyyy",
97023
+ description: "Medium date (EU)",
97024
+ example: "13 Dec 2025"
97025
+ },
97026
+ longEU: {
97027
+ code: "d mmmm yyyy",
97028
+ description: "Long date (EU)",
97029
+ example: "13 December 2025"
97030
+ },
97031
+ monthYear: {
97032
+ code: "mmmm yyyy",
97033
+ description: "Month and year",
97034
+ example: "December 2025"
97035
+ },
97036
+ monthYearShort: {
97037
+ code: "mmm yyyy",
97038
+ description: "Short month and year",
97039
+ example: "Dec 2025"
97040
+ },
97041
+ dayMonth: {
97042
+ code: "d mmmm",
97043
+ description: "Day and month",
97044
+ example: "13 December"
97045
+ },
97046
+ dayMonthShort: {
97047
+ code: "d mmm",
97048
+ description: "Short day and month",
97049
+ example: "13 Dec"
97050
+ },
97051
+ excelShort: {
97052
+ code: "m/d/yy",
97053
+ description: "Excel short date",
97054
+ example: "12/13/25"
97055
+ },
97056
+ excelMedium: {
97057
+ code: "d-mmm-yy",
97058
+ description: "Excel medium date",
97059
+ example: "13-Dec-25"
97060
+ },
97061
+ excelLong: {
97062
+ code: "d-mmm-yyyy",
97063
+ description: "Excel long date",
97064
+ example: "13-Dec-2025"
97065
+ }
97066
+ },
97067
+ time: {
97068
+ short12: {
97069
+ code: "h:mm AM/PM",
97070
+ description: "12-hour short",
97071
+ example: "3:45 PM"
97072
+ },
97073
+ long12: {
97074
+ code: "h:mm:ss AM/PM",
97075
+ description: "12-hour with seconds",
97076
+ example: "3:45:30 PM"
97077
+ },
97078
+ short24: {
97079
+ code: "HH:mm",
97080
+ description: "24-hour short",
97081
+ example: "15:45"
97082
+ },
97083
+ long24: {
97084
+ code: "HH:mm:ss",
97085
+ description: "24-hour with seconds",
97086
+ example: "15:45:30"
97087
+ },
97088
+ dateTime12: {
97089
+ code: "m/d/yyyy h:mm AM/PM",
97090
+ description: "Date and 12-hour time",
97091
+ example: "12/13/2025 3:45 PM"
97092
+ },
97093
+ dateTime24: {
97094
+ code: "yyyy-mm-dd HH:mm",
97095
+ description: "ISO date and 24-hour time",
97096
+ example: "2025-12-13 15:45"
97097
+ },
97098
+ durationHM: {
97099
+ code: "[h]:mm",
97100
+ description: "Hours and minutes (elapsed)",
97101
+ example: "25:30"
97102
+ },
97103
+ durationHMS: {
97104
+ code: "[h]:mm:ss",
97105
+ description: "Hours, minutes, seconds (elapsed)",
97106
+ example: "25:30:45"
97107
+ },
97108
+ durationMS: {
97109
+ code: "[mm]:ss",
97110
+ description: "Minutes and seconds (elapsed)",
97111
+ example: "1530:45"
97112
+ }
97113
+ },
97114
+ percentage: {
97115
+ integer: {
97116
+ code: "0%",
97117
+ description: "No decimal places",
97118
+ example: "50%"
97119
+ },
97120
+ decimal1: {
97121
+ code: "0.0%",
97122
+ description: "1 decimal place",
97123
+ example: "50.0%"
97124
+ },
97125
+ decimal2: {
97126
+ code: "0.00%",
97127
+ description: "2 decimal places",
97128
+ example: "50.00%"
97129
+ },
97130
+ decimal3: {
97131
+ code: "0.000%",
97132
+ description: "3 decimal places",
97133
+ example: "50.000%"
97134
+ }
97135
+ },
97136
+ fraction: {
97137
+ halves: {
97138
+ code: "# ?/2",
97139
+ description: "Halves (1/2)",
97140
+ example: "1 1/2"
97141
+ },
97142
+ quarters: {
97143
+ code: "# ?/4",
97144
+ description: "Quarters (1/4)",
97145
+ example: "1 1/4"
97146
+ },
97147
+ eighths: {
97148
+ code: "# ?/8",
97149
+ description: "Eighths (1/8)",
97150
+ example: "1 3/8"
97151
+ },
97152
+ sixteenths: {
97153
+ code: "# ??/16",
97154
+ description: "Sixteenths (1/16)",
97155
+ example: "1 5/16"
97156
+ },
97157
+ tenths: {
97158
+ code: "# ?/10",
97159
+ description: "Tenths (1/10)",
97160
+ example: "1 3/10"
97161
+ },
97162
+ hundredths: {
97163
+ code: "# ??/100",
97164
+ description: "Hundredths (1/100)",
97165
+ example: "1 25/100"
97166
+ },
97167
+ upToOneDigit: {
97168
+ code: "# ?/?",
97169
+ description: "Up to one digit (1/4)",
97170
+ example: "1 2/3"
97171
+ },
97172
+ upToTwoDigits: {
97173
+ code: "# ??/??",
97174
+ description: "Up to two digits (21/25)",
97175
+ example: "1 25/67"
97176
+ },
97177
+ upToThreeDigits: {
97178
+ code: "# ???/???",
97179
+ description: "Up to three digits (312/943)",
97180
+ example: "1 312/943"
97181
+ }
97182
+ },
97183
+ scientific: {
97184
+ default: {
97185
+ code: "0.00E+00",
97186
+ description: "2 decimal places",
97187
+ example: "1.23E+03"
97188
+ },
97189
+ decimal1: {
97190
+ code: "0.0E+00",
97191
+ description: "1 decimal place",
97192
+ example: "1.2E+03"
97193
+ },
97194
+ decimal3: {
97195
+ code: "0.000E+00",
97196
+ description: "3 decimal places",
97197
+ example: "1.235E+03"
97198
+ },
97199
+ noDecimals: {
97200
+ code: "0E+00",
97201
+ description: "No decimal places",
97202
+ example: "1E+03"
97203
+ }
97204
+ },
97205
+ text: {
97206
+ default: {
97207
+ code: "@",
97208
+ description: "Display as entered",
97209
+ example: "1234"
97210
+ }
97211
+ },
97212
+ special: {
97213
+ zipCode: {
97214
+ code: "00000",
97215
+ description: "ZIP Code (5-digit)",
97216
+ example: "01234"
97217
+ },
97218
+ zipPlus4: {
97219
+ code: "00000-0000",
97220
+ description: "ZIP+4 Code",
97221
+ example: "01234-5678"
97222
+ },
97223
+ phone: {
97224
+ code: "(###) ###-####",
97225
+ description: "Phone Number",
97226
+ example: "(555) 123-4567"
97227
+ },
97228
+ ssn: {
97229
+ code: "000-00-0000",
97230
+ description: "Social Security Number",
97231
+ example: "123-45-6789"
97232
+ }
97233
+ },
97234
+ custom: {}
97235
+ },
97236
+ defaultFormats: {
97237
+ accounting: '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)',
97238
+ currency: "$#,##0.00",
97239
+ custom: "General",
97240
+ date: "m/d/yyyy",
97241
+ fraction: "# ?/?",
97242
+ general: "General",
97243
+ number: "#,##0.00",
97244
+ percentage: "0.00%",
97245
+ scientific: "0.00E+00",
97246
+ special: "00000",
97247
+ text: "@",
97248
+ time: "h:mm AM/PM"
96165
97249
  }
96166
97250
  };
96167
97251