@betteroffice/xlsx 0.2.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
- import { DisplayList, ChartRegion } from './headless.js';
2
- export { A11yCell, A11yChart, A11yColumnHeader, A11yGrid, A11yRow, A11yStrings, CellAddr, CellInput, CellRange, ChartA11yAttrs, Direction, DrawCmd, FillRectCmd, GeometryPathCommand, GridMeta, HyperlinkDestination, HyperlinkRegion, KeyInput, LineCmd, MoveOpts, PathCmd, PathStroke, Rect, Selection, SelectionAction, SelectionLimits, TextAlign, TextCmd, TrackOffsets, ViewportState, VisibleCells, VisibleRange, buildA11yGrid, cellAtPoint, cellCount, cellRect, chartRegionAtPoint, clampScroll, extendTo, fromTsv, hyperlinkAtCell, moveFocus, normalizeRange, parseHyperlinkLocation, rangeContains, rangeRect, safeExternalHyperlink, selectionAt, selectionKeyReducer, toTsv, totalExtent, trackCount, uniformOffsets, visibleCells, visibleRange } from './headless.js';
3
- import { C as CollaborationReplica, s as CollaborationUpdateOrigin } from './types-C24EBcAP.js';
1
+ export { B as BorderPatch, a as BorderPreset, b as BorderStyle, C as CalculationStatus, c as CapturedBorderEdge, d as CapturedBorderStyle, e as CapturedCellFormat, f as CapturedColor, g as CapturedFill, h as CapturedFormat, i as CellEdit, j as CellInputEdit, k as CellPoint, l as CellPosition, m as ChartEdit, n as ChartInfo, o as ChartMutation, p as ChartSeriesInfo, q as ChartSeriesName, r as ConditionalFormatInfo, s as ConditionalFormatOp, t as ConditionalFormatRuleInput, D as DifferentialFormatInput, u as DisplayListProfile, v as DisplayTooLargeError, E as EditProfile, w as EditResult, x as EditSuccess, y as ExportCompletion, z as ExportDiagnostic, A as ExportSeverity, H as HistoryState, F as HorizontalAlignment, M as MarkdownAnchor, G as MergedRange, N as NumberFormat, I as NumberFormatMutation, O as OpenWorkbookOptions, J as OpenWorkbookSessionOptions, K as OperationFailure, L as OperationRefusal, P as PrintMetrics, Q as ProfiledDisplayList, R as ProfiledEditResult, S as Proposal, T as ProposalCell, U as ProposalEdit, V as RangeStylePatch, W as SelectionFormatting, X as SheetInfo, Y as StaleProposalError, Z as StaleProposalTarget, _ as StyleProperty, $ as TextWrapping, a0 as ValidationSuccess, a1 as VerticalAlignment, a2 as Viewport, a3 as WasmInitInput, a4 as WorkbookCalculationContext, a5 as WorkbookCellGeometry, a6 as WorkbookCellInputs, a7 as WorkbookEditPeerFailedError, a8 as WorkbookEditSession, a9 as WorkbookFrame, aa as WorkbookFrameOptions, ab as WorkbookHandle, ac as WorkbookHyperlink, ad as WorkbookInitialPaint, ae as WorkbookInitialPaintRequest, af as WorkbookPeerHydrationError, ag as WorkbookPngUnavailableError, ah as WorkbookRecoveryReplayError, ai as WorkbookSession, aj as WorkbookSessionEvents, ak as WorkbookSessionMethods, al as WorkbookSessionOpenOptions, am as WorkbookSessionOpenReply, an as WorkbookSessionRecovery, ao as WorkbookSessionState, ap as WorkbookSheetSummary, aq as WorkbookSheetView, ar as WorkbookUpdateInfo, as as WorkbookUpdateListener, at as WorkbookUpdateOrigin, au as XlsxAnchor, av as XlsxAutoFilterOp, aw as XlsxCellAddress, ax as XlsxCellGuard, ay as XlsxCellPosition, az as XlsxCellRead, aA as XlsxCellValue, aB as XlsxDefinedName, aC as XlsxDefinedNameOp, aD as XlsxDefinedNamesRequest, aE as XlsxDefinedNamesResult, aF as XlsxEditCalculation, aG as XlsxEditFailure, aH as XlsxEditFailureCode, aI as XlsxEditHistory, aJ as XlsxEditOperation, aK as XlsxEditPreview, aL as XlsxEditReceipt, aM as XlsxEditRefusal, aN as XlsxEditRequest, aO as XlsxEditResult, aP as XlsxEditSource, aQ as XlsxEditStep, aR as XlsxErrorValue, aS as XlsxExportCell, aT as XlsxExportDefinedName, aU as XlsxExportDiagnostic, aV as XlsxExportDiagnosticCode, aW as XlsxExportFailure, aX as XlsxExportFailureCode, aY as XlsxExportHyperlink, aZ as XlsxExportMerge, a_ as XlsxExportObject, a$ as XlsxExportOptions, b0 as XlsxExportResult, b1 as XlsxExportScope, b2 as XlsxExportSheet, b3 as XlsxExportTable, b4 as XlsxExportValue, b5 as XlsxFindMatch, b6 as XlsxFindRequest, b7 as XlsxFindResult, b8 as XlsxFormulaResult, b9 as XlsxMarkdownContent, ba as XlsxMarkdownOptions, bb as XlsxObjectKind, bc as XlsxRangeAddress, bd as XlsxRangeRead, be as XlsxRangeTarget, bf as XlsxReadCalculation, bg as XlsxReadRequest, bh as XlsxReadResult, bi as XlsxSheetEntry, bj as XlsxSheetIdentity, bk as XlsxSourcePart, bl as XlsxStructuredContent, bm as XlsxTextMatch, bn as XlsxTextSearchOptions, bo as XlsxValidationResult, bp as createWorkbookEditSession, bq as exportXlsxMarkdown, br as exportXlsxStructured, bs as getDisplayListCellLimit, bt as initWasm, bu as isPngExportAvailable, bv as isProposalsAvailable, bw as isWasmAvailable, bx as openWorkbook, by as openWorkbookSession, bz as renderXlsxMarkdown, bA as wasmVersion, bB as workbookSessionRecovery } from './editPeer-DN6JDr8Z.js';
2
+ import { D as DisplayList } from './types-DdoEoFSX.js';
3
+ export { C as CellAddr, a as CellRange, b as ChartA11yAttrs, c as ChartRegion, d as Direction, e as DrawCmd, F as FillRectCmd, G as GeometryPathCommand, f as GridMeta, H as HyperlinkRegion, K as KeyInput, L as LineCmd, M as MoveOpts, P as PathCmd, g as PathStroke, h as PatternFillCmd, i as PatternType, R as Rect, S as Selection, j as SelectionAction, k as SelectionData, l as SelectionHidden, m as SelectionLimits, n as SelectionMerges, T as TextAlign, o as TextCmd, p as TextWrap } from './types-DdoEoFSX.js';
4
+ export { A11yCell, A11yChart, A11yColumnHeader, A11yGrid, A11yRow, A11yStrings, CellInput, HyperlinkDestination, TrackOffsets, ViewportState, VisibleCells, VisibleRange, buildA11yGrid, cellAtPoint, cellCount, cellRect, chartRegionAtPoint, clampScroll, extendTo, fromTsv, hyperlinkAtCell, moveFocus, normalizeRange, parseHyperlinkLocation, rangeContains, rangeRect, safeExternalHyperlink, selectionAt, selectionKeyReducer, toTsv, totalExtent, trackCount, uniformOffsets, visibleCells, visibleRange } from './headless.js';
5
+ import './asyncReplica-DuZEFXjI.js';
4
6
 
5
7
  /**
6
8
  * Canvas2D backend for the display list — the browser paint target.
@@ -21,337 +23,4 @@ declare function paintDisplayList(ctx: CanvasRenderingContext2D, dl: DisplayList
21
23
  y: number;
22
24
  }): void;
23
25
 
24
- type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
25
-
26
- /**
27
- * Wasm loader for the xlsx-wasm core.
28
- *
29
- * Call {@link initWasm} once before opening workbooks. The default browser path
30
- * streams the packaged wasm asset; non-fetch environments can pass bytes or a
31
- * precompiled module. Callers never see the JSON-string boundary.
32
- */
33
-
34
- /**
35
- * A scrolled window into a sheet. `x`/`y` are content-pixel offsets into the
36
- * non-frozen body. Mirrors the Rust `Viewport`.
37
- */
38
- interface Viewport {
39
- x: number;
40
- y: number;
41
- width: number;
42
- height: number;
43
- }
44
- interface PrintMetrics {
45
- dpi: number;
46
- maxDigitWidth: number;
47
- defaultRowHeightPt: number;
48
- defaultColumnWidth?: number;
49
- fontSizePt: number;
50
- fontFamily: string;
51
- fontAscent: number;
52
- fontDescent: number;
53
- }
54
- /**
55
- * Chrome-facing sheet metadata: stable IDs, tab names, active index, and the
56
- * scrollable content extent of the active sheet. Mirrors the Rust `SheetInfo`.
57
- */
58
- interface SheetInfo {
59
- sheetIds: string[];
60
- sheetNames: string[];
61
- activeSheet: number;
62
- contentWidth: number;
63
- contentHeight: number;
64
- frozenRows: number;
65
- frozenCols: number;
66
- initialScrollX: number;
67
- initialScrollY: number;
68
- }
69
- interface CellPosition {
70
- x: number;
71
- y: number;
72
- }
73
- /**
74
- * Result of any mutating call: whether it changed the workbook and the
75
- * (possibly grown) sheet metadata. Mirrors the Rust `EditResult`.
76
- *
77
- * `changed` lists the a1 addresses (on the active sheet) of *other* cells whose
78
- * displayed value moved as a fallout of the edit — the dependents the recalc
79
- * pass recomputed. It excludes the directly edited cell(s) and is omitted by
80
- * cores built before the recalc engine, so treat it as additive.
81
- */
82
- interface EditResult {
83
- applied: boolean;
84
- sheetInfo: SheetInfo;
85
- changed?: string[];
86
- limitedCells?: string[];
87
- }
88
- interface CalculationStatus {
89
- limitedCells: string[];
90
- }
91
- type NumberFormat = 'automatic' | 'plainText' | 'number' | 'percent' | 'scientific' | 'currency' | 'date' | 'time' | 'custom';
92
- type BorderPreset = 'all' | 'inner' | 'horizontal' | 'vertical' | 'outer' | 'left' | 'top' | 'right' | 'bottom' | 'none';
93
- type BorderStyle = 'solid' | 'dashed' | 'dotted' | 'double';
94
- type HorizontalAlignment = 'left' | 'center' | 'right';
95
- type VerticalAlignment = 'top' | 'middle' | 'bottom';
96
- type TextWrapping = 'overflow' | 'wrap' | 'clip';
97
- type StyleProperty = 'bold' | 'italic' | 'strikethrough' | 'fontFamily' | 'fontSize' | 'textColor' | 'fillColor' | 'borders' | 'horizontalAlignment' | 'verticalAlignment' | 'textWrapping';
98
- interface BorderPatch {
99
- preset?: BorderPreset;
100
- style?: BorderStyle;
101
- color?: string;
102
- }
103
- interface RangeStylePatch {
104
- bold?: boolean;
105
- italic?: boolean;
106
- strikethrough?: boolean;
107
- fontFamily?: string;
108
- fontSize?: number;
109
- textColor?: string;
110
- fillColor?: string;
111
- border?: BorderPatch;
112
- horizontalAlignment?: HorizontalAlignment;
113
- verticalAlignment?: VerticalAlignment;
114
- textWrapping?: TextWrapping;
115
- clear?: StyleProperty[];
116
- }
117
- type NumberFormatMutation = Exclude<NumberFormat, 'custom'> | 'increaseDecimal' | 'decreaseDecimal' | {
118
- type: 'custom';
119
- pattern: string;
120
- };
121
- interface SelectionFormatting {
122
- numberFormat?: NumberFormat;
123
- numberFormatPattern?: string;
124
- fontFamily?: string;
125
- fontSize?: number;
126
- bold?: boolean;
127
- italic?: boolean;
128
- strikethrough?: boolean;
129
- textColor?: string;
130
- fillColor?: string;
131
- borderPreset?: BorderPreset;
132
- borderStyle?: BorderStyle;
133
- borderColor?: string;
134
- horizontalAlignment?: HorizontalAlignment;
135
- verticalAlignment?: VerticalAlignment;
136
- textWrapping?: TextWrapping;
137
- }
138
- interface CapturedFormat {
139
- rows: number;
140
- columns: number;
141
- formats: unknown[];
142
- }
143
- interface CellPoint {
144
- row: number;
145
- col: number;
146
- }
147
- interface MergedRange {
148
- start: CellPoint;
149
- end: CellPoint;
150
- }
151
- interface HistoryState {
152
- canUndo: boolean;
153
- canRedo: boolean;
154
- undoDepth: number;
155
- redoDepth: number;
156
- }
157
- type WorkbookUpdateOrigin = CollaborationUpdateOrigin;
158
- type WorkbookUpdateListener = (update: Uint8Array, origin: WorkbookUpdateOrigin) => void;
159
- interface OpenWorkbookOptions {
160
- /** Open a Yrs-backed replica that can accept peer updates. */
161
- collaborative?: boolean;
162
- /** Peer-unique positive safe integer. Generated securely when omitted. */
163
- clientId?: number;
164
- }
165
- /**
166
- * The editable view of one cell: A1 address, the exact string the user would
167
- * edit (formulas as `=...`, guarded literals with a leading `'`), and whether
168
- * that string is a formula. Mirrors the Rust `CellEdit`.
169
- */
170
- interface CellEdit {
171
- a1: string;
172
- input: string;
173
- isFormula: boolean;
174
- }
175
- /** One cell of a batch edit: target coordinates plus the raw user input. */
176
- interface CellInputEdit {
177
- row: number;
178
- col: number;
179
- input: string;
180
- }
181
- /**
182
- * One edit inside a proposal. Same shape as {@link CellInputEdit} plus the
183
- * sheet index — a proposal's cells carry their own sheet on the wire, so it
184
- * can span sheets rather than being pinned to the active one.
185
- */
186
- interface ProposalEdit extends CellInputEdit {
187
- sheet: number;
188
- numberFormat?: NumberFormatMutation;
189
- }
190
- /**
191
- * One cell of a pending proposal: where it lands and the *formatted display
192
- * texts* before/after applying it. `oldText`/`newText` are what the grid shows,
193
- * not the raw input — the ghost decoration paints `newText` directly. Mirrors
194
- * the Rust proposal cell.
195
- */
196
- interface ProposalCell {
197
- sheet: number;
198
- row: number;
199
- col: number;
200
- a1: string;
201
- oldText: string;
202
- newText: string;
203
- }
204
- /**
205
- * A pending, un-applied set of cell changes an agent has staged for human
206
- * review. `note` is the agent's rationale (may be null); `cells` are the
207
- * per-cell before/after previews. Applying it is one undo step.
208
- */
209
- interface Proposal {
210
- id: string;
211
- agentId: string;
212
- note: string | null;
213
- cells: ProposalCell[];
214
- }
215
- /**
216
- * Thrown by {@link WorkbookHandle.acceptProposal} when the workbook changed
217
- * under a proposal since it was staged (an edit touched one of its base cells)
218
- * and `force` was not set. `cells` are the a1 addresses that moved, so the UI
219
- * can name them and offer a force-apply.
220
- */
221
- declare class StaleProposalError extends Error {
222
- readonly cells: string[];
223
- constructor(cells: string[]);
224
- }
225
- /**
226
- * A typed handle over an open workbook, hiding the wasm object and its JSON
227
- * boundary. Call {@link WorkbookHandle.dispose} to free the wasm memory.
228
- */
229
- interface WorkbookHandle extends CollaborationReplica {
230
- readonly clientId: number;
231
- /** Available in both modes; encodes this handle's current Yrs state vector. */
232
- encodeStateVector(): Uint8Array;
233
- /** Available in both modes; pass a peer vector to encode only the missing state. */
234
- encodeStateAsUpdate(remoteStateVector?: Uint8Array): Uint8Array;
235
- /** Apply a peer update. Standalone handles throw the Rust `NotCollaborative` error. */
236
- applyUpdate(update: Uint8Array): EditResult;
237
- /** Observe owned update bytes from local commits and accepted remote updates. */
238
- onUpdate(listener: WorkbookUpdateListener): () => void;
239
- sheetInfo(): SheetInfo;
240
- calculationStatus(): CalculationStatus;
241
- displayList(viewport: Viewport): DisplayList;
242
- printDisplayList(sheet: number, range: string, metrics: PrintMetrics, gridlines: boolean): DisplayList;
243
- /**
244
- * the chart under a viewport-local point on the active sheet, or `null`,
245
- * resolved against the current model from the same anchor geometry the
246
- * display list is built from. the returned `label` is always empty: a hit
247
- * test resolves anchors only and never reads a chart part.
248
- *
249
- * this answers for the model as it is now. chrome painting a frame should
250
- * hit-test that frame's own `charts` with `chartRegionAtPoint` instead, or a
251
- * mutation the canvas has not drawn yet will move the answer off the pixels.
252
- */
253
- chartAtPoint(viewport: Viewport, x: number, y: number): ChartRegion | null;
254
- /**
255
- * slide the chart frame `chart` names — a {@link ChartRegion} id — by a
256
- * content-pixel delta, clamped to the grid, as one undo step. the new anchor
257
- * is written back on save. throws for a chart pinned to the sheet by an
258
- * absolute anchor.
259
- */
260
- moveChart(sheet: number, chart: string, dx: number, dy: number): EditResult;
261
- setActiveSheet(index: number): void;
262
- /**
263
- * apply one user input to a cell (parses number/bool/formula/text) and
264
- * recalc its transitive dependents. one undo step; moved dependents come back
265
- * in `EditResult.changed`.
266
- */
267
- editCell(sheet: number, row: number, col: number, input: string): EditResult;
268
- /** apply a batch of inputs (paste path) as one undo step; dependents recalc. */
269
- editCells(sheet: number, edits: CellInputEdit[]): EditResult;
270
- /** raw op-list escape hatch for structural ops (insert/delete rows, merges…). */
271
- applyOps(ops: unknown[]): EditResult;
272
- undo(): EditResult;
273
- redo(): EditResult;
274
- /** the editable view of one cell (formula bar / in-cell editor prefill). */
275
- cell(sheet: number, row: number, col: number): CellEdit;
276
- cellPosition(sheet: number, row: number, col: number): CellPosition;
277
- /** row-major editable views for a range, e.g. "A1:C3" (clipboard copy). */
278
- rangeCells(sheet: number, range: string): CellEdit[][];
279
- patchRangeStyle(sheet: number, range: string, patch: RangeStylePatch): EditResult;
280
- setNumberFormat(sheet: number, range: string, format: NumberFormatMutation): EditResult;
281
- selectionFormatting(sheet: number, range: string): SelectionFormatting;
282
- captureFormat(sheet: number, range: string): CapturedFormat;
283
- applyFormat(sheet: number, range: string, format: CapturedFormat): EditResult;
284
- mergedRanges(sheet: number, range: string): MergedRange[];
285
- historyState(): HistoryState;
286
- /**
287
- * render the current sheet viewport to png bytes via the native raster
288
- * backend — the same display list the canvas paints, rasterized server-side.
289
- * throws if the embedded wasm was built without png export (the `raster`
290
- * cargo feature); guard with {@link isPngExportAvailable}.
291
- */
292
- renderPng(viewport: Viewport): Uint8Array;
293
- /**
294
- * render an a1 range (default: the used range) at an optional scale to png.
295
- * dimensions are capped wasm-side; same availability guard as renderPng.
296
- */
297
- renderRangePng(opts?: {
298
- range?: string;
299
- scale?: number;
300
- }): Uint8Array;
301
- /** serialize the workbook back to .xlsx bytes. */
302
- save(): Uint8Array;
303
- /**
304
- * stage an agent's proposed edits for human review without applying them.
305
- * returns the {@link Proposal} with per-cell formatted before/after previews.
306
- * throws if the embedded wasm predates proposals; guard with
307
- * {@link WorkbookHandle.isProposalsAvailable}.
308
- */
309
- propose(agentId: string, note: string | null, edits: ProposalEdit[]): Proposal;
310
- /** every pending proposal, oldest first. empty when none or unsupported. */
311
- listProposals(): Proposal[];
312
- /**
313
- * apply a pending proposal as one undo step and recalc dependents. throws
314
- * {@link StaleProposalError} when the base changed since it was staged and
315
- * `force` is not set; pass `{ force: true }` to apply anyway.
316
- */
317
- acceptProposal(id: string, opts?: {
318
- force?: boolean;
319
- }): EditResult & {
320
- proposalId: string;
321
- };
322
- /** drop a pending proposal without applying it; false when the id was unknown. */
323
- rejectProposal(id: string): boolean;
324
- /** whether the embedded wasm core was built with the proposals api. */
325
- isProposalsAvailable(): boolean;
326
- dispose(): void;
327
- }
328
- type WasmInitInput = InitInput | Promise<InitInput>;
329
- /** Initialize the workbook engine. Concurrent calls share the same attempt. */
330
- declare function initWasm(input?: WasmInitInput): Promise<void>;
331
- /**
332
- * Whether this environment exposes the WebAssembly runtime required by the core.
333
- */
334
- declare function isWasmAvailable(): boolean;
335
- /**
336
- * Whether the embedded wasm core was built with png export (the `raster` cargo
337
- * feature). The wasm-bindgen method only exists on the class when compiled in,
338
- * so chrome can disable an export control instead of calling and catching.
339
- */
340
- declare function isPngExportAvailable(): boolean;
341
- /**
342
- * Whether the embedded wasm core exposes the proposals api (propose / accept /
343
- * reject / list). The methods only exist on the class when compiled in, so the
344
- * UI can hide proposal chrome and degrade gracefully against an older module.
345
- */
346
- declare function isProposalsAvailable(): boolean;
347
- /**
348
- * Open a workbook from raw `.xlsx` bytes, initializing the core if needed.
349
- * Throws an `Error` if the bytes are not a readable workbook.
350
- */
351
- declare function openWorkbook(bytes: Uint8Array, options?: OpenWorkbookOptions): WorkbookHandle;
352
- /**
353
- * The crate version string, for asserting wasm/js parity.
354
- */
355
- declare function wasmVersion(): string;
356
-
357
- export { type BorderPatch, type BorderPreset, type BorderStyle, type CalculationStatus, type CapturedFormat, type CellEdit, type CellInputEdit, type CellPoint, type CellPosition, ChartRegion, DisplayList, type EditResult, type HistoryState, type HorizontalAlignment, type MergedRange, type NumberFormat, type NumberFormatMutation, type OpenWorkbookOptions, type PrintMetrics, type Proposal, type ProposalCell, type ProposalEdit, type RangeStylePatch, type SelectionFormatting, type SheetInfo, StaleProposalError, type StyleProperty, type TextWrapping, type VerticalAlignment, type Viewport, type WasmInitInput, type WorkbookHandle, type WorkbookUpdateListener, type WorkbookUpdateOrigin, initWasm, isPngExportAvailable, isProposalsAvailable, isWasmAvailable, openWorkbook, paintDisplayList, wasmVersion };
26
+ export { DisplayList, paintDisplayList };
package/dist/index.js CHANGED
@@ -1 +1,4 @@
1
- export{w as buildA11yGrid,o as cellAtPoint,j as cellCount,p as cellRect,n as chartRegionAtPoint,e as clampScroll,k as extendTo,v as fromTsv,r as hyperlinkAtCell,l as moveFocus,h as normalizeRange,t as parseHyperlinkLocation,i as rangeContains,q as rangeRect,s as safeExternalHyperlink,g as selectionAt,m as selectionKeyReducer,u as toTsv,b as totalExtent,a as trackCount,f as uniformOffsets,d as visibleCells,c as visibleRange}from'./chunk-E6PJOEEH.js';import {a}from'./chunk-O2XFH626.js';var he=1.3333333333333333,xe={left:"left",center:"center",right:"right"},ve={dashed:[4,2],dotted:[1,2]};function Ce(r,e,n,t={x:0,y:0}){r.save(),r.setTransform(n,0,0,n,t.x,t.y),r.beginPath(),r.rect(0,0,e.width,e.height),r.clip(),r.clearRect(0,0,e.width,e.height);for(let o of e.commands)Se(r,o);r.restore();}function Se(r,e){switch(e.op){case "fillRect":W(r,e.clip,()=>{r.fillStyle=e.color,r.fillRect(e.x,e.y,e.w,e.h);});return;case "line":W(r,e.clip,()=>Re(r,e));return;case "path":W(r,e.clip,()=>Pe(r,e));return;case "text":Je(r,e);return}}function W(r,e,n){if(!e){n();return}r.save(),r.beginPath(),r.rect(e.x,e.y,e.w,e.h),r.clip(),n(),r.restore();}function Pe(r,e){r.beginPath();for(let n of e.commands)switch(n.type){case "move":r.moveTo(n.x,n.y);break;case "line":r.lineTo(n.x,n.y);break;case "quad":r.quadraticCurveTo(n.cpx,n.cpy,n.x,n.y);break;case "cubic":r.bezierCurveTo(n.cp1x,n.cp1y,n.cp2x,n.cp2y,n.x,n.y);break;case "close":r.closePath();break}r.fillStyle=e.fill,r.fill(),e.stroke&&(r.strokeStyle=e.stroke.color,r.lineWidth=e.stroke.width,r.setLineDash([]),r.stroke());}function Re(r,e){if(r.strokeStyle=e.color,e.style==="double"){let n=Math.max(e.width*.8,.8),t=Math.abs(e.y1-e.y2)<=Math.abs(e.x1-e.x2),[o,i]=t?[0,n]:[n,0];r.lineWidth=Math.max(e.width*.6,.5),O(r,e.x1-o,e.y1-i,e.x2-o,e.y2-i),O(r,e.x1+o,e.y1+i,e.x2+o,e.y2+i);return}r.lineWidth=e.width,r.save(),r.setLineDash(e.style?ve[e.style]:[]),O(r,e.x1,e.y1,e.x2,e.y2),r.restore();}function O(r,e,n,t,o){r.beginPath(),r.moveTo(e,n),r.lineTo(t,o),r.stroke();}function Je(r,e){r.save(),e.clip&&(r.beginPath(),r.rect(e.clip.x,e.clip.y,e.clip.w,e.clip.h),r.clip()),r.fillStyle=e.color,r.font=Ae(e),r.textAlign=xe[e.align??"left"],r.textBaseline="alphabetic",e.highlight&&ke(r,e),r.fillStyle=e.color,r.fillText(e.text,e.x,e.y),(e.underline||e.strike||e.dashedUnderline)&&Ee(r,e),r.restore();}function Ae(r){let e=r.italic?"italic ":"",n=r.bold?"bold ":"",t=r.fontFamily?r.chart?r.fontFamily:`"${r.fontFamily.replace(/"/g,'\\"')}", sans-serif`:"sans-serif";return `${e}${n}${D(r)}px ${t}`}function D(r){return r.fontSize*he}function Ee(r,e){let n=r.measureText(e.text).width,t=e.align??"left",o=t==="right"?e.x-n:t==="center"?e.x-n/2:e.x,i=D(e),c=Math.max(i*.05,.5);r.fillStyle=e.color,e.underline&&r.fillRect(o,e.y+i*.1,n,c),e.strike&&r.fillRect(o,e.y-i*.26,n,c),e.dashedUnderline&&(r.save(),r.strokeStyle=e.color,r.lineWidth=c,r.setLineDash([3,2]),O(r,o,e.y+i*.1,o+n,e.y+i*.1),r.restore());}function ke(r,e){let n=r.measureText(e.text),t=n.width,o=e.align??"left",i=o==="right"?e.x-t:o==="center"?e.x-t/2:e.x,c=D(e),d=n.actualBoundingBoxAscent||c*.8,a=n.actualBoundingBoxDescent||c*.2;r.fillStyle=e.highlight,r.fillRect(i-2,e.y-d-1,t+4,d+a+2);}var h=class r{static __wrap(e){let n=Object.create(r.prototype);return n.__wbg_ptr=e,V.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,V.unregister(this),e}free(){let e=this.__destroy_into_raw();s.__wbg_xlsxdocument_free(e,0);}acceptProposalJson(e){let n,t;try{let c=y(e,s.__wbindgen_malloc,s.__wbindgen_realloc),d=g,a=s.xlsxdocument_acceptProposalJson(this.__wbg_ptr,c,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,_(a[2]);return n=o,t=i,p(o,i)}finally{s.__wbindgen_free(n,t,1);}}applyFormatJson(e){let n,t;try{let c=y(e,s.__wbindgen_malloc,s.__wbindgen_realloc),d=g,a=s.xlsxdocument_applyFormatJson(this.__wbg_ptr,c,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,_(a[2]);return n=o,t=i,p(o,i)}finally{s.__wbindgen_free(n,t,1);}}applyOpsJson(e){let n,t;try{let c=y(e,s.__wbindgen_malloc,s.__wbindgen_realloc),d=g,a=s.xlsxdocument_applyOpsJson(this.__wbg_ptr,c,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,_(a[2]);return n=o,t=i,p(o,i)}finally{s.__wbindgen_free(n,t,1);}}applyUpdateJson(e){let n,t;try{let c=U(e,s.__wbindgen_malloc),d=g,a=s.xlsxdocument_applyUpdateJson(this.__wbg_ptr,c,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,_(a[2]);return n=o,t=i,p(o,i)}finally{s.__wbindgen_free(n,t,1);}}calculationStatusJson(){let e,n;try{let i=s.xlsxdocument_calculationStatusJson(this.__wbg_ptr);var t=i[0],o=i[1];if(i[3])throw t=0,o=0,_(i[2]);return e=t,n=o,p(t,o)}finally{s.__wbindgen_free(e,n,1);}}captureFormatJson(e){let n,t;try{let c=y(e,s.__wbindgen_malloc,s.__wbindgen_realloc),d=g,a=s.xlsxdocument_captureFormatJson(this.__wbg_ptr,c,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,_(a[2]);return n=o,t=i,p(o,i)}finally{s.__wbindgen_free(n,t,1);}}cellJson(e){let n,t;try{let c=y(e,s.__wbindgen_malloc,s.__wbindgen_realloc),d=g,a=s.xlsxdocument_cellJson(this.__wbg_ptr,c,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,_(a[2]);return n=o,t=i,p(o,i)}finally{s.__wbindgen_free(n,t,1);}}cellPositionJson(e){let n,t;try{let c=y(e,s.__wbindgen_malloc,s.__wbindgen_realloc),d=g,a=s.xlsxdocument_cellPositionJson(this.__wbg_ptr,c,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,_(a[2]);return n=o,t=i,p(o,i)}finally{s.__wbindgen_free(n,t,1);}}chartAtPointJson(e){let n,t;try{let c=y(e,s.__wbindgen_malloc,s.__wbindgen_realloc),d=g,a=s.xlsxdocument_chartAtPointJson(this.__wbg_ptr,c,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,_(a[2]);return n=o,t=i,p(o,i)}finally{s.__wbindgen_free(n,t,1);}}clearUpdateObservation(){s.xlsxdocument_clearUpdateObservation(this.__wbg_ptr);}get clientId(){return s.xlsxdocument_clientId(this.__wbg_ptr)}displayListJson(e){let n,t;try{let c=y(e,s.__wbindgen_malloc,s.__wbindgen_realloc),d=g,a=s.xlsxdocument_displayListJson(this.__wbg_ptr,c,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,_(a[2]);return n=o,t=i,p(o,i)}finally{s.__wbindgen_free(n,t,1);}}drainUpdateEvent(){let e=s.xlsxdocument_drainUpdateEvent(this.__wbg_ptr);if(e[3])throw _(e[2]);var n=v(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),n}editCellJson(e){let n,t;try{let c=y(e,s.__wbindgen_malloc,s.__wbindgen_realloc),d=g,a=s.xlsxdocument_editCellJson(this.__wbg_ptr,c,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,_(a[2]);return n=o,t=i,p(o,i)}finally{s.__wbindgen_free(n,t,1);}}editCellsJson(e){let n,t;try{let c=y(e,s.__wbindgen_malloc,s.__wbindgen_realloc),d=g,a=s.xlsxdocument_editCellsJson(this.__wbg_ptr,c,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,_(a[2]);return n=o,t=i,p(o,i)}finally{s.__wbindgen_free(n,t,1);}}encodeDiff(e){let n=U(e,s.__wbindgen_malloc),t=g,o=s.xlsxdocument_encodeDiff(this.__wbg_ptr,n,t);if(o[3])throw _(o[2]);var i=v(o[0],o[1]).slice();return s.__wbindgen_free(o[0],o[1]*1,1),i}encodeStateAsUpdate(){let e=s.xlsxdocument_encodeStateAsUpdate(this.__wbg_ptr);var n=v(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),n}encodeStateVector(){let e=s.xlsxdocument_encodeStateVector(this.__wbg_ptr);var n=v(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),n}historyStateJson(){let e,n;try{let i=s.xlsxdocument_historyStateJson(this.__wbg_ptr);var t=i[0],o=i[1];if(i[3])throw t=0,o=0,_(i[2]);return e=t,n=o,p(t,o)}finally{s.__wbindgen_free(e,n,1);}}listProposalsJson(){let e,n;try{let i=s.xlsxdocument_listProposalsJson(this.__wbg_ptr);var t=i[0],o=i[1];if(i[3])throw t=0,o=0,_(i[2]);return e=t,n=o,p(t,o)}finally{s.__wbindgen_free(e,n,1);}}mergedRangesJson(e){let n,t;try{let c=y(e,s.__wbindgen_malloc,s.__wbindgen_realloc),d=g,a=s.xlsxdocument_mergedRangesJson(this.__wbg_ptr,c,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,_(a[2]);return n=o,t=i,p(o,i)}finally{s.__wbindgen_free(n,t,1);}}moveChartJson(e){let n,t;try{let c=y(e,s.__wbindgen_malloc,s.__wbindgen_realloc),d=g,a=s.xlsxdocument_moveChartJson(this.__wbg_ptr,c,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,_(a[2]);return n=o,t=i,p(o,i)}finally{s.__wbindgen_free(n,t,1);}}static open(e){let n=U(e,s.__wbindgen_malloc),t=g,o=s.xlsxdocument_open(n,t);if(o[2])throw _(o[1]);return r.__wrap(o[0])}static openCollaborative(e,n){let t=U(e,s.__wbindgen_malloc),o=g,i=s.xlsxdocument_openCollaborative(t,o,n);if(i[2])throw _(i[1]);return r.__wrap(i[0])}patchRangeStyleJson(e){let n,t;try{let c=y(e,s.__wbindgen_malloc,s.__wbindgen_realloc),d=g,a=s.xlsxdocument_patchRangeStyleJson(this.__wbg_ptr,c,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,_(a[2]);return n=o,t=i,p(o,i)}finally{s.__wbindgen_free(n,t,1);}}printDisplayListJson(e){let n,t;try{let c=y(e,s.__wbindgen_malloc,s.__wbindgen_realloc),d=g,a=s.xlsxdocument_printDisplayListJson(this.__wbg_ptr,c,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,_(a[2]);return n=o,t=i,p(o,i)}finally{s.__wbindgen_free(n,t,1);}}proposeJson(e){let n,t;try{let c=y(e,s.__wbindgen_malloc,s.__wbindgen_realloc),d=g,a=s.xlsxdocument_proposeJson(this.__wbg_ptr,c,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,_(a[2]);return n=o,t=i,p(o,i)}finally{s.__wbindgen_free(n,t,1);}}rangeCellsJson(e){let n,t;try{let c=y(e,s.__wbindgen_malloc,s.__wbindgen_realloc),d=g,a=s.xlsxdocument_rangeCellsJson(this.__wbg_ptr,c,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,_(a[2]);return n=o,t=i,p(o,i)}finally{s.__wbindgen_free(n,t,1);}}redoJson(){let e,n;try{let i=s.xlsxdocument_redoJson(this.__wbg_ptr);var t=i[0],o=i[1];if(i[3])throw t=0,o=0,_(i[2]);return e=t,n=o,p(t,o)}finally{s.__wbindgen_free(e,n,1);}}rejectProposalJson(e){let n,t;try{let c=y(e,s.__wbindgen_malloc,s.__wbindgen_realloc),d=g,a=s.xlsxdocument_rejectProposalJson(this.__wbg_ptr,c,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,_(a[2]);return n=o,t=i,p(o,i)}finally{s.__wbindgen_free(n,t,1);}}renderPng(e){let n=y(e,s.__wbindgen_malloc,s.__wbindgen_realloc),t=g,o=s.xlsxdocument_renderPng(this.__wbg_ptr,n,t);if(o[3])throw _(o[2]);var i=v(o[0],o[1]).slice();return s.__wbindgen_free(o[0],o[1]*1,1),i}renderRangePng(e){let n=y(e,s.__wbindgen_malloc,s.__wbindgen_realloc),t=g,o=s.xlsxdocument_renderRangePng(this.__wbg_ptr,n,t);if(o[3])throw _(o[2]);var i=v(o[0],o[1]).slice();return s.__wbindgen_free(o[0],o[1]*1,1),i}saveBytes(){let e=s.xlsxdocument_saveBytes(this.__wbg_ptr);if(e[3])throw _(e[2]);var n=v(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),n}selectionFormattingJson(e){let n,t;try{let c=y(e,s.__wbindgen_malloc,s.__wbindgen_realloc),d=g,a=s.xlsxdocument_selectionFormattingJson(this.__wbg_ptr,c,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,_(a[2]);return n=o,t=i,p(o,i)}finally{s.__wbindgen_free(n,t,1);}}setActiveSheet(e){let n=s.xlsxdocument_setActiveSheet(this.__wbg_ptr,e);if(n[1])throw _(n[0])}setRangeNumberFormatJson(e){let n,t;try{let c=y(e,s.__wbindgen_malloc,s.__wbindgen_realloc),d=g,a=s.xlsxdocument_setRangeNumberFormatJson(this.__wbg_ptr,c,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,_(a[2]);return n=o,t=i,p(o,i)}finally{s.__wbindgen_free(n,t,1);}}sheetInfoJson(){let e,n;try{let i=s.xlsxdocument_sheetInfoJson(this.__wbg_ptr);var t=i[0],o=i[1];if(i[3])throw t=0,o=0,_(i[2]);return e=t,n=o,p(t,o)}finally{s.__wbindgen_free(e,n,1);}}startUpdateObservation(){let e=s.xlsxdocument_startUpdateObservation(this.__wbg_ptr);if(e[1])throw _(e[0])}undoJson(){let e,n;try{let i=s.xlsxdocument_undoJson(this.__wbg_ptr);var t=i[0],o=i[1];if(i[3])throw t=0,o=0,_(i[2]);return e=t,n=o,p(t,o)}finally{s.__wbindgen_free(e,n,1);}}static version(){let e,n;try{let t=s.xlsxdocument_version();return e=t[0],n=t[1],p(t[0],t[1])}finally{s.__wbindgen_free(e,n,1);}}};Symbol.dispose&&(h.prototype[Symbol.dispose]=h.prototype.free);function Oe(){return {__proto__:null,"./xlsx_wasm_bg.js":{__proto__:null,__wbg___wbindgen_throw_344f42d3211c4765:function(e,n){throw new Error(p(e,n))},__wbg_getRandomValues_3f44b700395062e5:function(){return Ie(function(e,n){globalThis.crypto.getRandomValues(v(e,n));},arguments)},__wbg_now_86c0d4ba3fa605b8:function(){return Date.now()},__wbindgen_cast_0000000000000001:function(e,n){return p(e,n)},__wbindgen_init_externref_table:function(){let e=s.__wbindgen_externrefs,n=e.grow(4);e.set(0,void 0),e.set(n+0,void 0),e.set(n+1,null),e.set(n+2,true),e.set(n+3,false);}}}}var V=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>s.__wbg_xlsxdocument_free(r,1));function Ue(r){let e=s.__externref_table_alloc();return s.__wbindgen_externrefs.set(e,r),e}function v(r,e){return r=r>>>0,S().subarray(r/1,r/1+e)}function p(r,e){return Fe(r>>>0,e)}var P=null;function S(){return (P===null||P.byteLength===0)&&(P=new Uint8Array(s.memory.buffer)),P}function Ie(r,e){try{return r.apply(this,e)}catch(n){let t=Ue(n);s.__wbindgen_exn_store(t);}}function U(r,e){let n=e(r.length*1,1)>>>0;return S().set(r,n/1),g=r.length,n}function y(r,e,n){if(n===void 0){let d=R.encode(r),a=e(d.length,1)>>>0;return S().subarray(a,a+d.length).set(d),g=d.length,a}let t=r.length,o=e(t,1)>>>0,i=S(),c=0;for(;c<t;c++){let d=r.charCodeAt(c);if(d>127)break;i[o+c]=d;}if(c!==t){c!==0&&(r=r.slice(c)),o=n(o,t,t=c+r.length*3,1)>>>0;let d=S().subarray(o+c,o+t),a=R.encodeInto(r,d);c+=a.written,o=n(o,t,c,1)>>>0;}return g=c,o}function _(r){let e=s.__wbindgen_externrefs.get(r);return s.__externref_table_dealloc(r),e}var I=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true});I.decode();var Te=2146435072,N=0;function Fe(r,e){return N+=e,N>=Te&&(I=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}),I.decode(),N=e),I.decode(S().subarray(r,r+e))}var R=new TextEncoder;"encodeInto"in R||(R.encodeInto=function(r,e){let n=R.encode(r);return e.set(n),{read:r.length,written:n.length}});var g=0,s;function Ne(r,e){return s=r.exports,P=null,s.__wbindgen_start(),s}async function Le(r,e){if(typeof Response=="function"&&r instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(r,e)}catch(o){if(r.ok&&n(r.type)&&r.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",o);else throw o}let t=await r.arrayBuffer();return await WebAssembly.instantiate(t,e)}else {let t=await WebAssembly.instantiate(r,e);return t instanceof WebAssembly.Instance?{instance:t,module:r}:t}function n(t){switch(t){case "basic":case "cors":case "default":return true}return false}}async function B(r){if(s!==void 0)return s;if(r!==void 0&&(Object.getPrototypeOf(r)===Object.prototype?{module_or_path:r}=r:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),r===void 0)throw new Error("xlsx-wasm requires an explicit module or URL");let e=Oe();(typeof r=="string"||typeof Request=="function"&&r instanceof Request||typeof URL=="function"&&r instanceof URL)&&(r=fetch(r));let{instance:n,module:t}=await Le(await r,e);return Ne(n)}var T=class extends Error{constructor(n){super(`stale: ${n.join(", ")}`);a(this,"cells");this.name="StaleProposalError",this.cells=n;}},H="stale: ";function Me(r){let e=r.slice(H.length).split(",").map(n=>n.trim()).filter(n=>n.length>0);return new T(e)}var L=false,J;function ze(r=new URL("./generated/xlsx_wasm_bg.wasm",import.meta.url)){return L?Promise.resolve():J||(J=B({module_or_path:r}).then(()=>{L=true;},e=>{throw J=void 0,A(e)}),J)}function j(){if(!L)throw new Error("xlsx wasm is not initialized; call initWasm() first")}function A(r){return r instanceof Error?r:new Error(typeof r=="string"?r:String(r))}function Ve(){return typeof WebAssembly=="object"}function Be(){return typeof h.prototype.renderPng=="function"}function He(){return typeof h.prototype.proposeJson=="function"}function je(r,e={}){j();let n=qe(e),t;try{t=n===void 0?h.open(r):h.openCollaborative(r,n);}catch(l){throw A(l)}let o=new Map,i=[],c=0,d=false,a=false,E=0,F=false;function M(){if(d)throw new Error("workbook handle is disposed")}function q(){if(!(d||F||E!==0)){F=true;try{for(;!d&&i.length>0;){let l=i.shift();if(!l)break;for(let[u,f]of [...o]){if(d)return;if(o.get(u)===f)try{f(l.update.slice(),l.origin);}catch{}}}}finally{F=false,d&&(i.length=0);}}}function X(){if(!(!a||d))for(;;){let l=t.drainUpdateEvent();if(l.byteLength===0)return;let u=l[0];if(u!==0&&u!==1)throw new Error(`xlsx wasm returned unknown update origin ${u}`);i.push({update:l.subarray(1),origin:u===0?"local":"remote"});}}function w(l,u=false){M(),E+=1;try{let f,m,C=!1;try{f=l();}catch(x){m=x,C=!0;}if(u)try{X();}catch(x){C||(m=x,C=!0);}if(C)throw A(m);return f}finally{E-=1,E===0&&q();}}function k(l){return w(l,true)}function b(l,u=false){return w(()=>JSON.parse(l()),u)}function G(){a||(w(()=>t.startUpdateObservation()),a=true);}function $(){!a||o.size>0||d||(i.length=0,w(()=>t.clearUpdateObservation()),a=false);}return {get clientId(){return w(()=>t.clientId)},encodeStateVector(){return w(()=>t.encodeStateVector())},encodeStateAsUpdate(l){return w(()=>l===void 0?t.encodeStateAsUpdate():t.encodeDiff(l))},applyUpdate(l){return b(()=>t.applyUpdateJson(l),true)},onUpdate(l){if(M(),typeof l!="function")throw new TypeError("update listener must be a function");let u=c++;o.set(u,l);try{G();}catch(m){throw o.delete(u),m}let f=true;return ()=>{f&&(f=false,o.delete(u),$());}},sheetInfo(){return b(()=>t.sheetInfoJson())},calculationStatus(){return w(()=>{let l=t.calculationStatusJson;return typeof l!="function"?{limitedCells:[]}:JSON.parse(l.call(t))})},displayList(l){return b(()=>t.displayListJson(JSON.stringify(l)))},printDisplayList(l,u,f,m){return b(()=>t.printDisplayListJson(JSON.stringify({sheet:l,range:u,metrics:f,gridlines:m})))},chartAtPoint(l,u,f){return b(()=>t.chartAtPointJson(JSON.stringify({viewport:l,x:u,y:f})))},moveChart(l,u,f,m){return b(()=>t.moveChartJson(JSON.stringify({sheet:l,chart:u,dx:f,dy:m})),true)},setActiveSheet(l){k(()=>t.setActiveSheet(l));},editCell(l,u,f,m){return b(()=>t.editCellJson(JSON.stringify({sheet:l,row:u,col:f,input:m})),true)},editCells(l,u){return b(()=>t.editCellsJson(JSON.stringify({sheet:l,edits:u})),true)},applyOps(l){return b(()=>t.applyOpsJson(JSON.stringify({ops:l})),true)},undo(){return b(()=>t.undoJson(),true)},redo(){return b(()=>t.redoJson(),true)},cell(l,u,f){return b(()=>t.cellJson(JSON.stringify({sheet:l,row:u,col:f})))},cellPosition(l,u,f){return b(()=>t.cellPositionJson(JSON.stringify({sheet:l,row:u,col:f})))},rangeCells(l,u){return b(()=>t.rangeCellsJson(JSON.stringify({sheet:l,range:u}))).cells},patchRangeStyle(l,u,f){return b(()=>t.patchRangeStyleJson(JSON.stringify({sheet:l,range:u,patch:f})),true)},setNumberFormat(l,u,f){let m=typeof f=="string"?{type:f}:f;return b(()=>t.setRangeNumberFormatJson(JSON.stringify({sheet:l,range:u,format:m})),true)},selectionFormatting(l,u){return b(()=>t.selectionFormattingJson(JSON.stringify({sheet:l,range:u})))},captureFormat(l,u){return b(()=>t.captureFormatJson(JSON.stringify({sheet:l,range:u})))},applyFormat(l,u,f){return b(()=>t.applyFormatJson(JSON.stringify({sheet:l,range:u,format:f})),true)},mergedRanges(l,u){return b(()=>t.mergedRangesJson(JSON.stringify({sheet:l,range:u}))).ranges},historyState(){return b(()=>t.historyStateJson())},renderPng(l){return w(()=>{let u=t.renderPng;if(typeof u!="function")throw new Error("png export not in this build");return u.call(t,JSON.stringify(l)).slice()})},renderRangePng(l){return w(()=>{let u=t.renderRangePng;if(typeof u!="function")throw new Error("png export not in this build");return u.call(t,JSON.stringify(l??{})).slice()})},save(){return w(()=>t.saveBytes())},propose(l,u,f){return k(()=>{let m=t.proposeJson;if(typeof m!="function")throw new Error("proposals not in this build");let C=f.map(({numberFormat:x,...K})=>({...K,...x===void 0?{}:{numberFormat:typeof x=="string"?{type:x}:x}}));return JSON.parse(m.call(t,JSON.stringify({agentId:l,note:u,edits:C})))})},listProposals(){return w(()=>{let l=t.listProposalsJson;return typeof l!="function"?[]:JSON.parse(l.call(t)).proposals})},acceptProposal(l,u){try{return k(()=>{let f=t.acceptProposalJson;if(typeof f!="function")throw new Error("proposals not in this build");return JSON.parse(f.call(t,JSON.stringify({id:l,force:u?.force??!1})))})}catch(f){let m=f instanceof Error?f.message:typeof f=="string"?f:String(f);throw m.startsWith(H)?Me(m):A(f)}},rejectProposal(l){return k(()=>{let u=t.rejectProposalJson;return typeof u!="function"?false:JSON.parse(u.call(t,JSON.stringify({id:l}))).removed})},isProposalsAvailable(){return w(()=>typeof t.proposeJson=="function")},dispose(){if(d)return;d=true,o.clear(),i.length=0;let l;if(a){try{t.clearUpdateObservation();}catch(u){l=u;}a=false;}try{t.free();}catch(u){l??(l=u);}if(l!==void 0)throw A(l)}}}function qe(r){if(!r.collaborative){if(r.clientId!==void 0)throw new TypeError("clientId requires collaborative mode");return}if(r.clientId!==void 0){if(!Number.isSafeInteger(r.clientId)||r.clientId<=0||r.clientId>Number.MAX_SAFE_INTEGER)throw new RangeError("clientId must be a nonzero safe integer");return r.clientId}let e=globalThis.crypto;if(!e||typeof e.getRandomValues!="function")throw new Error("crypto.getRandomValues is required to generate a collaboration client ID");let n=new Uint32Array(2),t;do e.getRandomValues(n),t=(n[0]&2097151)*4294967296+n[1];while(t===0);return t}function Xe(){return j(),h.version()}export{T as StaleProposalError,ze as initWasm,Be as isPngExportAvailable,He as isProposalsAvailable,Ve as isWasmAvailable,je as openWorkbook,Ce as paintDisplayList,Xe as wasmVersion};
1
+ export{w as buildA11yGrid,o as cellAtPoint,j as cellCount,p as cellRect,n as chartRegionAtPoint,e as clampScroll,k as extendTo,v as fromTsv,r as hyperlinkAtCell,l as moveFocus,h as normalizeRange,t as parseHyperlinkLocation,i as rangeContains,q as rangeRect,s as safeExternalHyperlink,g as selectionAt,m as selectionKeyReducer,u as toTsv,b as totalExtent,a as trackCount,f as uniformOffsets,d as visibleCells,c as visibleRange}from'./chunk-SXM2HKJL.js';export{j as WorkbookEditPeerFailedError,b as WorkbookRecoveryReplayError,a as createWorkbookEditSession,e as openWorkbookSession,c as workbookSessionRecovery}from'./chunk-HJJEOLPD.js';export{l as DisplayTooLargeError,k as StaleProposalError,P as WorkbookPeerHydrationError,F as WorkbookPngUnavailableError,C as exportXlsxMarkdown,B as exportXlsxStructured,p as getDisplayListCellLimit,n as initWasm,r as isPngExportAvailable,s as isProposalsAvailable,q as isWasmAvailable,t as openWorkbook,D as renderXlsxMarkdown,E as wasmVersion}from'./chunk-K7TMSGNA.js';import'./chunk-JGTBRHCP.js';import'./chunk-O2XFH626.js';var W={gray125:[17,0,68,0,17,0,68,0],gray0625:[1,0,16,0,1,0,16,0],mediumGray:[85,170,85,170,85,170,85,170],darkGray:[119,221,119,221,119,221,119,221],lightGray:[17,68,17,68,17,68,17,68],darkHorizontal:[255,255,0,0,255,255,0,0],darkVertical:[51,51,51,51,51,51,51,51],darkDown:[51,102,204,153,51,102,204,153],darkUp:[51,153,204,102,51,153,204,102],darkGrid:[255,255,51,51,255,255,51,51],darkTrellis:[51,255,204,255,51,255,204,255],lightHorizontal:[255,0,0,0,255,0,0,0],lightVertical:[17,17,17,17,17,17,17,17],lightDown:[17,34,68,136,17,34,68,136],lightUp:[17,136,68,34,17,136,68,34],lightGrid:[255,17,17,17,255,17,17,17],lightTrellis:[17,170,68,170,17,170,68,170]};function P(e,t,n,r){let i=t.text,s=t.align??"left",o=n.parts;if(o.length===0&&!n.overflow){e.textAlign=s,r(e,t,i,n.left+X(s,n.width,0),s);return}e.textAlign="left";let a=0,l=0,u=false;for(let d=0;d<o.length;d++){let x=o[d],h=O(i,x.offset);l+=H(e,i,a,h),x.kind==="padding"?(l+=e.measureText(x.character).width,a=h+1):(u=true,a=h);}if(l+=H(e,i,a,i.length),n.overflow&&l>n.width){let x=(n.general===void 0?void 0:Ie(n.general,n.width,e))??Fe(n.width,e);r(e,t,x,n.left+X(s,n.width,e.measureText(x).width),"left");return}let p=u?Math.max(0,n.width-l):0,f=n.left+X(s,n.width,l+p);a=0;for(let d=0;d<o.length;d++){let x=o[d],h=O(i,x.offset);if(h>a){let g=i.slice(a,h);r(e,t,g,f,"left"),f+=e.measureText(g).width;}if(x.kind==="padding")f+=e.measureText(x.character).width,a=h+1;else {let g=e.measureText(x.character).width;g>0&&p>=g&&r(e,t,x.character.repeat(Math.floor(p/g)),f,"left"),f+=p,a=h;}}a<i.length&&r(e,t,a===0?i:i.slice(a),f,"left");}function O(e,t){let n=0;for(let r=0;r<t&&n<e.length;){let i=e.codePointAt(n);r+=i<128?1:i<2048?2:i<65536?3:4,n+=i>65535?2:1;}return n}function H(e,t,n,r){return r<=n?0:e.measureText(n===0&&r===t.length?t:t.slice(n,r)).width}function X(e,t,n){return e==="right"?t-n:e==="center"?(t-n)/2:0}function Fe(e,t){let n=t.measureText("#").width;return n>0&&e>0?"#".repeat(Math.max(1,Math.floor(e/n))):""}function Ie(e,t,n){if(!Number.isFinite(e)||e===0)return;let r=Math.floor(Math.log10(Math.abs(e)));if(r>=-4&&r<11)for(let i=Math.min(15,Math.max(0,10-r));i>=0;i--){let s=10**i,o=Math.sign(e)*Math.round(Math.abs(e)*s)/s,a=$(o.toFixed(i));if(Number(a)!==0&&n.measureText(a).width<=t)return a}for(let i=5;i>=0;i--){let s=Ne(e,i);if(n.measureText(s).width<=t)return s}}function Ne(e,t){let[n,r]=Math.abs(e).toExponential(14).split("e"),i=n.replace(".",""),s=Number(r),o=i.slice(0,t+1);if(i.charCodeAt(t+1)>=53){let l=o.search(/[0-8]9*$/);l<0?(o=`1${"0".repeat(t)}`,s++):o=`${o.slice(0,l)}${Number(o[l])+1}${"0".repeat(o.length-l-1)}`;}let a=o.length>1?$(`${o[0]}.${o.slice(1)}`):o;return `${e<0?"-":""}${a}E${s<0?"-":"+"}${Math.abs(s).toString().padStart(2,"0")}`}function $(e){return e.includes(".")?e.replace(/0+$/,"").replace(/\.$/,""):e}var w;function Le(e){if(w===void 0){let r=Intl.Segmenter;try{w=typeof r=="function"?new r(void 0,{granularity:"grapheme"}):null;}catch{w=null;}}if(w)return [...w.segment(e)].map(r=>r.index+r.segment.length);let t=[],n=0;for(let r of e)t.push(n+=r.length);return t}function V(e,t,n){let r=Number.isNaN(t)?Number.POSITIVE_INFINITY:t,i=[],o=(e.endsWith(`
2
+ `)?e.slice(0,e.endsWith(`\r
3
+ `)?-2:-1):e).split(`
4
+ `);return o.forEach((a,l)=>{We(a.endsWith("\r")?a.slice(0,-1):a,r,n,i),l<o.length-1&&(i[i.length-1]=i[i.length-1].replace(/ +$/,""));}),i}function We(e,t,n,r){if(n(e)<=t){r.push(e);return}let i=0,s=null;for(let[o,a]of Oe(e)){if(s!==null){if(n(e.slice(i,a))<=t){s=a;continue}r.push(e.slice(i,s)),i=o;}if(s=a,n(e.slice(i,a))<=t)continue;let l=i,u=Le(e.slice(l,a)).map(f=>l+f),p=0;for(let f=B(e,i,u,p,t,n);f!==null;)r.push(e.slice(i,u[f])),i=u[f],p=f+1,f=B(e,i,u,p,t,n);}r.push(e.slice(i));}function B(e,t,n,r,i,s){let o=r,a;for(let l=1;;l*=2){let u=Math.min(o+l,n.length-1);if(u===o)return null;if(s(e.slice(t,n[u]))>i){a=u;break}o=u;}for(;a-o>1;){let l=o+Math.floor((a-o)/2);s(e.slice(t,n[l]))>i?a=l:o=l;}return o}function Oe(e){let t=[],n=0;for(let r of e.split(" "))r.length>0&&t.push([n,n+r.length]),n+=r.length+1;return t}function _(e,t,n,r){let i=Math.max(n-1,0),s=r.valign==="top"?t:r.valign==="center"?t-i/2:t-i;return e+r.lineHeight*s}var He=96/72,U=1.2,$e=.8,G={left:"left",center:"center",right:"right"},Be={dashed:[4,2],dotted:[1,2],mediumDashed:[8,4],dashDot:[4,2,1,2],mediumDashDot:[8,4,2,4],dashDotDot:[4,2,1,2,1,2],mediumDashDotDot:[8,4,2,4,2,4],slantDashDot:[4,2,1,2]},z=new WeakMap;function Ve(e,t,n,r={x:0,y:0}){e.save(),e.setTransform(n,0,0,n,r.x,r.y),e.beginPath(),e.rect(0,0,t.width,t.height),e.clip(),e.clearRect(0,0,t.width,t.height);for(let i of t.commands)_e(e,i,n,r);e.restore();}function _e(e,t,n,r){switch(t.op){case "fillRect":v(e,t.clip,()=>{e.fillStyle=t.color,e.fillRect(t.x,t.y,t.w,t.h);});return;case "patternFill":v(e,t.clip,()=>Ge(e,t,n,r));return;case "line":v(e,t.clip,()=>Ue(e,t,n,r));return;case "path":v(e,t.clip,()=>ze(e,t));return;case "text":Ke(e,t);return}}function Ge(e,t,n,r){let i=z.get(e);i||(i=new Map,z.set(e,i));let s=`${t.pattern}/${t.fg}/${t.bg}/${n}`,o=i.get(s);if(!o){let u=typeof OffscreenCanvas>"u"?document.createElement("canvas"):new OffscreenCanvas(8,8);u.width=8,u.height=8;let p=u.getContext("2d"),f=p.createImageData(8,8),d=Number.parseInt(t.fg.slice(1),16),x=Number.parseInt(t.bg.slice(1),16),h=W[t.pattern];for(let g=0;g<8;g+=1)for(let b=0;b<8;b+=1){let m=h[g]&1<<b?d:x,y=(g*8+b)*4;f.data[y]=m>>16&255,f.data[y+1]=m>>8&255,f.data[y+2]=m&255,f.data[y+3]=255;}if(p.putImageData(f,0,0),o=e.createPattern(u,"repeat")??void 0,!o)return;i.size>=256&&i.clear(),i.set(s,o);}o.setTransform({a:1/n,b:0,c:0,d:1/n,e:(Math.round(t.originX*n+r.x)-r.x)/n,f:(Math.round(t.originY*n+r.y)-r.y)/n}),e.save(),e.imageSmoothingEnabled=false,e.fillStyle=o;let a=(Math.round(t.x*n+r.x)-r.x)/n,l=(Math.round(t.y*n+r.y)-r.y)/n;e.fillRect(a,l,(Math.round((t.x+t.w)*n+r.x)-r.x)/n-a,(Math.round((t.y+t.h)*n+r.y)-r.y)/n-l),e.restore();}function v(e,t,n){if(!t){n();return}e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),n(),e.restore();}function ze(e,t){e.beginPath();for(let n of t.commands)switch(n.type){case "move":e.moveTo(n.x,n.y);break;case "line":e.lineTo(n.x,n.y);break;case "quad":e.quadraticCurveTo(n.cpx,n.cpy,n.x,n.y);break;case "cubic":e.bezierCurveTo(n.cp1x,n.cp1y,n.cp2x,n.cp2y,n.x,n.y);break;case "close":e.closePath();break}e.fillStyle=t.fill,e.fill(),t.stroke&&(e.strokeStyle=t.stroke.color,e.lineWidth=t.stroke.width,e.setLineDash([]),e.stroke());}function Ue(e,t,n,r){e.strokeStyle=t.color,e.save(),e.lineCap="butt";let{x1:i,y1:s,x2:o,y2:a}=t,l=Math.max(1,Math.round(t.width*n)),u=t.style==="double"&&t.rail===void 0;if(t.style&&!u&&(s===a?(s=a=(Math.floor(s*n+r.y)+l%2/2-r.y)/n,i=(Math.round(i*n+r.x)-r.x)/n,o=(Math.round(o*n+r.x)-r.x)/n):i===o&&(i=o=(Math.floor(i*n+r.x)+l%2/2-r.x)/n,s=(Math.round(s*n+r.y)-r.y)/n,a=(Math.round(a*n+r.y)-r.y)/n)),t.style==="double"){let f=t.rail===void 0?Math.max(t.width*.8,.8):(t.width-t.rail)/2,d=Math.abs(s-a)<=Math.abs(i-o),[x,h]=d?[0,f]:[f,0];e.lineWidth=t.rail??Math.max(t.width*.6,.5),e.setLineDash([]),R(e,i-x,s-h,o-x,a-h),R(e,i+x,s+h,o+x,a+h),e.restore();return}e.lineWidth=t.style?l/n:t.width;let p=t.style?.startsWith("medium")?t.width/2:t.width;e.setLineDash(t.style?Be[t.style].map(f=>f*p):[]),R(e,i,s,o,a),e.restore();}function R(e,t,n,r,i){e.beginPath(),e.moveTo(t,n),e.lineTo(r,i),e.stroke();}function Ke(e,t){if(e.save(),t.clip&&(e.beginPath(),e.rect(t.clip.x,t.clip.y,t.clip.w,t.clip.h),e.clip()),e.fillStyle=t.color,e.font=Je(t),e.textBaseline="alphabetic",t.stacked)Ze(e,t);else if(t.rotationDeg!==void 0&&t.rotationDeg!==null)je(e,t,t.rotationDeg);else if(t.numberFormat)P(e,t,t.numberFormat,A);else if(t.wrap){let n=t.wrap,r=t.align??"left";e.textAlign=G[r];let i=V(t.text,n.width,s=>e.measureText(s).width);i.forEach((s,o)=>{A(e,{...t,y:_(t.y,o,i.length,n)},s,t.x,r);});}else {let n=t.align??"left";e.textAlign=G[n],A(e,t,t.text,t.x,n);}e.restore();}function qe(e,t,n){let r=n*U,i=Math.abs(t)*Math.PI/180,s=Math.abs(Math.cos(i)),o=Math.abs(Math.sin(i)),a=Number.POSITIVE_INFINITY;return s>1e-6&&(a=Math.min(a,(e.w-r*o)/s)),o>1e-6&&(a=Math.min(a,(e.h-r*s)/o)),Number.isFinite(a)||(a=Math.max(e.w,e.h)),Math.max(0,a)}function Ye(e){let t=Intl.Segmenter;if(typeof t=="function")try{return [...new t(void 0,{granularity:"grapheme"}).segment(e)].map(n=>n.segment)}catch{return [...e]}return [...e]}function je(e,t,n){let r=t.rotationBox??t.clip??{x:t.x,y:t.y,w:0,h:0},i=S(t),s=[{text:t.text,offset:0}],o=e.measureText(t.text).width;if(t.numberFormat){let k=qe(r,n,i),T=[];if(P(e,{...t,numberFormat:void 0},{...t.numberFormat,left:0,width:k},(D,I,c,E,N)=>{let L=e.measureText(c).width,Y=N==="right"?E-L:N==="center"?E-L/2:E;T.push({text:c,x:Y});}),T.length>0){let D=Math.min(...T.map(c=>c.x)),I=Math.max(...T.map(c=>c.x+e.measureText(c.text).width));s=T.map(c=>({text:c.text,offset:c.x-D})),o=Math.max(0,I-D);}}let a=e.measureText(t.text),l=(n===90?a.fontBoundingBoxAscent:void 0)??(a.actualBoundingBoxAscent||i*.8),u=(n===90?a.fontBoundingBoxDescent:void 0)??(a.actualBoundingBoxDescent||i*.2),p=l+u,f=-n*Math.PI/180,d=Math.cos(f),x=Math.sin(f),h=Math.abs(o*d)+Math.abs(p*x),g=Math.abs(o*x)+Math.abs(p*d),b=t.align??"left",m=b==="center"?r.x+(r.w-h)/2:b==="right"?r.x+r.w-h:r.x,y=t.rotationValign??"bottom",C=y==="top"?r.y:y==="center"?r.y+(r.h-g)/2:r.y+r.h-g,K=m+h/2,q=C+g/2;e.save(),e.translate(K,q),e.rotate(f),t.highlight&&(e.fillStyle=t.highlight,e.fillRect(-o/2-2,-p/2-1,o+4,p+2),e.fillStyle=t.color),e.textBaseline="alphabetic";let M=(l-u)/2;if(t.numberFormat){e.textAlign="left";for(let k of s)e.fillText(k.text,-o/2+k.offset,M);}else e.textAlign="center",e.fillText(t.text,0,M);let F=Math.max(i*.05,.5);e.fillStyle=t.color,(t.underline||t.dashedUnderline)&&e.fillRect(-o/2,M+i*.1,o,F),t.strike&&e.fillRect(-o/2,M-i*.26,o,F),e.restore();}function Ze(e,t){let n=t.rotationBox??t.clip??{x:t.x,y:t.y,w:0,h:0},r=S(t),i=r*U,s=r*$e,o=Ye(t.text),a=o.length*i,l=t.rotationValign??"bottom",u=l==="top"?n.y:l==="center"?n.y+(n.h-a)/2:n.y+n.h-a,p=t.align??"left",f=t.clip??n,d=Math.max(0,Math.floor((f.y-u)/i)),x=Math.min(o.length-1,Math.ceil((f.y+f.h-u)/i)-1);e.textAlign="left",e.textBaseline="alphabetic";for(let h=d;h<=x;h+=1){let g=o[h],b=e.measureText(g).width,m=p==="center"?n.x+(n.w-b)/2:p==="right"?n.x+n.w-b:n.x;if(m+b<=f.x||m>=f.x+f.w)continue;let y=u+h*i+s;t.highlight&&(e.fillStyle=t.highlight,e.fillRect(m-2,y-s-1,b+4,i+2),e.fillStyle=t.color),e.fillText(g,m,y);let C=Math.max(r*.05,.5);e.fillStyle=t.color,t.underline&&e.fillRect(m,y+r*.1,b,C),t.strike&&e.fillRect(m,y-r*.26,b,C),t.dashedUnderline&&(e.save(),e.strokeStyle=t.color,e.lineWidth=C,e.setLineDash([3,2]),R(e,m,y+r*.1,m+b,y+r*.1),e.restore());}}function A(e,t,n,r,i){t.highlight&&et(e,t,n,r,i),e.fillStyle=t.color,e.fillText(n,r,t.y),(t.underline||t.strike||t.dashedUnderline)&&Qe(e,t,n,r,i);}function Je(e){let t=e.italic?"italic ":"",n=e.bold?"bold ":"",r=e.fontFamily?e.chart?e.fontFamily:`"${e.fontFamily.replace(/"/g,'\\"')}", sans-serif`:"sans-serif";return `${t}${n}${S(e)}px ${r}`}function S(e){return e.fontSize*He}function Qe(e,t,n,r,i){let s=e.measureText(n).width,o=i==="right"?r-s:i==="center"?r-s/2:r,a=S(t),l=Math.max(a*.05,.5);e.fillStyle=t.color,t.underline&&e.fillRect(o,t.y+a*.1,s,l),t.strike&&e.fillRect(o,t.y-a*.26,s,l),t.dashedUnderline&&(e.save(),e.strokeStyle=t.color,e.lineWidth=l,e.setLineDash([3,2]),R(e,o,t.y+a*.1,o+s,t.y+a*.1),e.restore());}function et(e,t,n,r,i){let s=e.measureText(n),o=s.width,a=i==="right"?r-o:i==="center"?r-o/2:r,l=S(t),u=s.actualBoundingBoxAscent||l*.8,p=s.actualBoundingBoxDescent||l*.2;e.fillStyle=t.highlight,e.fillRect(a-2,t.y-u-1,o+4,u+p+2);}export{Ve as paintDisplayList};