@rosperitus/excelerate-reader 0.14.0 → 0.16.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/README.md +38 -0
- package/excelerate.d.ts +88 -3
- package/excelerate.js +48 -4
- package/excelerate_bg.wasm +0 -0
- package/package.json +21 -3
- package/web/excelerate.d.ts +749 -0
- package/web/excelerate.js +1381 -0
- package/web/excelerate_bg.wasm +0 -0
- package/web/excelerate_bg.wasm.d.ts +86 -0
- package/web/package.json +4 -0
|
@@ -0,0 +1,1381 @@
|
|
|
1
|
+
/* @ts-self-types="./excelerate.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A workbook.
|
|
5
|
+
*/
|
|
6
|
+
export class Book {
|
|
7
|
+
static __wrap(ptr) {
|
|
8
|
+
const obj = Object.create(Book.prototype);
|
|
9
|
+
obj.__wbg_ptr = ptr;
|
|
10
|
+
BookFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
11
|
+
return obj;
|
|
12
|
+
}
|
|
13
|
+
__destroy_into_raw() {
|
|
14
|
+
const ptr = this.__wbg_ptr;
|
|
15
|
+
this.__wbg_ptr = 0;
|
|
16
|
+
BookFinalization.unregister(this);
|
|
17
|
+
return ptr;
|
|
18
|
+
}
|
|
19
|
+
free() {
|
|
20
|
+
const ptr = this.__destroy_into_raw();
|
|
21
|
+
wasm.__wbg_book_free(ptr, 0);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The tab a reader opens the workbook on.
|
|
25
|
+
* @returns {number}
|
|
26
|
+
*/
|
|
27
|
+
activeSheet() {
|
|
28
|
+
const ret = wasm.book_activeSheet(this.__wbg_ptr);
|
|
29
|
+
return ret >>> 0;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Appends a sheet and returns its index.
|
|
33
|
+
* @param {string} title
|
|
34
|
+
* @returns {number}
|
|
35
|
+
*/
|
|
36
|
+
addSheet(title) {
|
|
37
|
+
const ptr0 = passStringToWasm0(title, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
38
|
+
const len0 = WASM_VECTOR_LEN;
|
|
39
|
+
const ret = wasm.book_addSheet(this.__wbg_ptr, ptr0, len0);
|
|
40
|
+
if (ret[2]) {
|
|
41
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
42
|
+
}
|
|
43
|
+
return ret[0] >>> 0;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The array formulas of a sheet, as the areas they cover: `["B2:B4"]`.
|
|
47
|
+
* The formula itself is on the top left cell of each.
|
|
48
|
+
* @param {number} sheet
|
|
49
|
+
* @returns {string[]}
|
|
50
|
+
*/
|
|
51
|
+
arrayFormulas(sheet) {
|
|
52
|
+
const ret = wasm.book_arrayFormulas(this.__wbg_ptr, sheet);
|
|
53
|
+
if (ret[3]) {
|
|
54
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
55
|
+
}
|
|
56
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]);
|
|
57
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
58
|
+
return v1;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The autofilter over a sheet, or `undefined` when it has none. What the
|
|
62
|
+
* filter hides is a property of each row - see `rowHidden`.
|
|
63
|
+
* @param {number} sheet
|
|
64
|
+
* @returns {SheetAutoFilter | undefined}
|
|
65
|
+
*/
|
|
66
|
+
autoFilter(sheet) {
|
|
67
|
+
const ret = wasm.book_autoFilter(this.__wbg_ptr, sheet);
|
|
68
|
+
if (ret[2]) {
|
|
69
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
70
|
+
}
|
|
71
|
+
return takeFromExternrefTable0(ret[0]);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Whether a cell is bold.
|
|
75
|
+
*
|
|
76
|
+
* The one flag, without building the rest of the style: a parser that
|
|
77
|
+
* looks for a header row asks this of every cell, and `cellStyle` would
|
|
78
|
+
* make it pay for the font, fill and four borders it never reads.
|
|
79
|
+
* @param {number} sheet
|
|
80
|
+
* @param {string} address
|
|
81
|
+
* @returns {boolean}
|
|
82
|
+
*/
|
|
83
|
+
cellBold(sheet, address) {
|
|
84
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
85
|
+
const len0 = WASM_VECTOR_LEN;
|
|
86
|
+
const ret = wasm.book_cellBold(this.__wbg_ptr, sheet, ptr0, len0);
|
|
87
|
+
if (ret[2]) {
|
|
88
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
89
|
+
}
|
|
90
|
+
return ret[0] !== 0;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The same by 1-based row and column.
|
|
94
|
+
* @param {number} sheet
|
|
95
|
+
* @param {number} row
|
|
96
|
+
* @param {number} column
|
|
97
|
+
* @returns {boolean}
|
|
98
|
+
*/
|
|
99
|
+
cellBoldAt(sheet, row, column) {
|
|
100
|
+
const ret = wasm.book_cellBoldAt(this.__wbg_ptr, sheet, row, column);
|
|
101
|
+
if (ret[2]) {
|
|
102
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
103
|
+
}
|
|
104
|
+
return ret[0] !== 0;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* How many non-empty cells the workbook holds, or one sheet of it.
|
|
108
|
+
* @param {number | null} [sheet]
|
|
109
|
+
* @returns {number}
|
|
110
|
+
*/
|
|
111
|
+
cellCount(sheet) {
|
|
112
|
+
const ret = wasm.book_cellCount(this.__wbg_ptr, isLikeNone(sheet) ? Number.MAX_SAFE_INTEGER : (sheet) >>> 0);
|
|
113
|
+
return ret >>> 0;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The indent of a cell, in Excel's indent steps (0 when it has none).
|
|
117
|
+
*
|
|
118
|
+
* Indent lives on the cell's style, and a spreadsheet only honours it for
|
|
119
|
+
* left, right and distributed alignment - but the number is returned as
|
|
120
|
+
* the file states it, whatever the alignment.
|
|
121
|
+
* @param {number} sheet
|
|
122
|
+
* @param {string} address
|
|
123
|
+
* @returns {number}
|
|
124
|
+
*/
|
|
125
|
+
cellIndent(sheet, address) {
|
|
126
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
127
|
+
const len0 = WASM_VECTOR_LEN;
|
|
128
|
+
const ret = wasm.book_cellIndent(this.__wbg_ptr, sheet, ptr0, len0);
|
|
129
|
+
if (ret[2]) {
|
|
130
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
131
|
+
}
|
|
132
|
+
return ret[0] >>> 0;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* The same by 1-based row and column.
|
|
136
|
+
* @param {number} sheet
|
|
137
|
+
* @param {number} row
|
|
138
|
+
* @param {number} column
|
|
139
|
+
* @returns {number}
|
|
140
|
+
*/
|
|
141
|
+
cellIndentAt(sheet, row, column) {
|
|
142
|
+
const ret = wasm.book_cellIndentAt(this.__wbg_ptr, sheet, row, column);
|
|
143
|
+
if (ret[2]) {
|
|
144
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
145
|
+
}
|
|
146
|
+
return ret[0] >>> 0;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* How a cell is painted: number format, font, fill, borders and text
|
|
150
|
+
* placement, as the file states them.
|
|
151
|
+
*
|
|
152
|
+
* A cell the file says nothing about answers with Excel's defaults, which
|
|
153
|
+
* is what Excel itself shows for it.
|
|
154
|
+
* @param {number} sheet
|
|
155
|
+
* @param {string} address
|
|
156
|
+
* @returns {CellStyle}
|
|
157
|
+
*/
|
|
158
|
+
cellStyle(sheet, address) {
|
|
159
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
160
|
+
const len0 = WASM_VECTOR_LEN;
|
|
161
|
+
const ret = wasm.book_cellStyle(this.__wbg_ptr, sheet, ptr0, len0);
|
|
162
|
+
if (ret[2]) {
|
|
163
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
164
|
+
}
|
|
165
|
+
return takeFromExternrefTable0(ret[0]);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* The same by 1-based row and column.
|
|
169
|
+
* @param {number} sheet
|
|
170
|
+
* @param {number} row
|
|
171
|
+
* @param {number} column
|
|
172
|
+
* @returns {CellStyle}
|
|
173
|
+
*/
|
|
174
|
+
cellStyleAt(sheet, row, column) {
|
|
175
|
+
const ret = wasm.book_cellStyleAt(this.__wbg_ptr, sheet, row, column);
|
|
176
|
+
if (ret[2]) {
|
|
177
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
178
|
+
}
|
|
179
|
+
return takeFromExternrefTable0(ret[0]);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The charts on a sheet. `kinds` names the plots drawn in each -
|
|
183
|
+
* `barChart`, `lineChart` - and a combination chart has more than one.
|
|
184
|
+
* @param {number} sheet
|
|
185
|
+
* @returns {SheetChart[]}
|
|
186
|
+
*/
|
|
187
|
+
charts(sheet) {
|
|
188
|
+
const ret = wasm.book_charts(this.__wbg_ptr, sheet);
|
|
189
|
+
if (ret[2]) {
|
|
190
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
191
|
+
}
|
|
192
|
+
return takeFromExternrefTable0(ret[0]);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Empties a cell, style and all.
|
|
196
|
+
* @param {number} sheet
|
|
197
|
+
* @param {string} address
|
|
198
|
+
*/
|
|
199
|
+
clear(sheet, address) {
|
|
200
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
201
|
+
const len0 = WASM_VECTOR_LEN;
|
|
202
|
+
const ret = wasm.book_clear(this.__wbg_ptr, sheet, ptr0, len0);
|
|
203
|
+
if (ret[1]) {
|
|
204
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* The same by 1-based row and column.
|
|
209
|
+
* @param {number} sheet
|
|
210
|
+
* @param {number} row
|
|
211
|
+
* @param {number} column
|
|
212
|
+
*/
|
|
213
|
+
clearAt(sheet, row, column) {
|
|
214
|
+
const ret = wasm.book_clearAt(this.__wbg_ptr, sheet, row, column);
|
|
215
|
+
if (ret[1]) {
|
|
216
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* The same for a column, named by its letters: `columnLevel(0, "C")`.
|
|
221
|
+
* @param {number} sheet
|
|
222
|
+
* @param {string} column
|
|
223
|
+
* @returns {number}
|
|
224
|
+
*/
|
|
225
|
+
columnLevel(sheet, column) {
|
|
226
|
+
const ptr0 = passStringToWasm0(column, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
227
|
+
const len0 = WASM_VECTOR_LEN;
|
|
228
|
+
const ret = wasm.book_columnLevel(this.__wbg_ptr, sheet, ptr0, len0);
|
|
229
|
+
if (ret[2]) {
|
|
230
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
231
|
+
}
|
|
232
|
+
return ret[0];
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* The width of a column in characters, or `undefined` when the sheet
|
|
236
|
+
* leaves it to the default. `column` is 1-based.
|
|
237
|
+
* @param {number} sheet
|
|
238
|
+
* @param {number} column
|
|
239
|
+
* @returns {number | undefined}
|
|
240
|
+
*/
|
|
241
|
+
columnWidth(sheet, column) {
|
|
242
|
+
const ret = wasm.book_columnWidth(this.__wbg_ptr, sheet, column);
|
|
243
|
+
if (ret[3]) {
|
|
244
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
245
|
+
}
|
|
246
|
+
return ret[0] === 0 ? undefined : ret[1];
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* The notes on a sheet, in address order.
|
|
250
|
+
* @param {number} sheet
|
|
251
|
+
* @returns {SheetComment[]}
|
|
252
|
+
*/
|
|
253
|
+
comments(sheet) {
|
|
254
|
+
const ret = wasm.book_comments(this.__wbg_ptr, sheet);
|
|
255
|
+
if (ret[2]) {
|
|
256
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
257
|
+
}
|
|
258
|
+
return takeFromExternrefTable0(ret[0]);
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* The conditional formatting of a sheet, block by block. The formatting
|
|
262
|
+
* each rule applies is not modelled here - it lives in the workbook's
|
|
263
|
+
* differential styles - but what the rule tests is.
|
|
264
|
+
* @param {number} sheet
|
|
265
|
+
* @returns {SheetConditionalFormat[]}
|
|
266
|
+
*/
|
|
267
|
+
conditionalFormats(sheet) {
|
|
268
|
+
const ret = wasm.book_conditionalFormats(this.__wbg_ptr, sheet);
|
|
269
|
+
if (ret[2]) {
|
|
270
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
271
|
+
}
|
|
272
|
+
return takeFromExternrefTable0(ret[0]);
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* The rules limiting what cells accept: the dropdown lists, the ranges,
|
|
276
|
+
* the dates.
|
|
277
|
+
* @param {number} sheet
|
|
278
|
+
* @returns {SheetValidation[]}
|
|
279
|
+
*/
|
|
280
|
+
dataValidations(sheet) {
|
|
281
|
+
const ret = wasm.book_dataValidations(this.__wbg_ptr, sheet);
|
|
282
|
+
if (ret[2]) {
|
|
283
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
284
|
+
}
|
|
285
|
+
return takeFromExternrefTable0(ret[0]);
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* The names the workbook defines: what `=Total` and `Print_Area` stand
|
|
289
|
+
* for. `sheet` is set on a name local to one sheet.
|
|
290
|
+
* @returns {WorkbookName[]}
|
|
291
|
+
*/
|
|
292
|
+
definedNames() {
|
|
293
|
+
const ret = wasm.book_definedNames(this.__wbg_ptr);
|
|
294
|
+
return ret;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* What Excel shows under File > Info: every text field is a string or
|
|
298
|
+
* `null`, dates in ISO 8601. `custom` lists the user's own fields with
|
|
299
|
+
* their type: `text`, `integer`, `number`, `boolean` or `date`.
|
|
300
|
+
* @returns {DocumentProperties}
|
|
301
|
+
*/
|
|
302
|
+
documentProperties() {
|
|
303
|
+
const ret = wasm.book_documentProperties(this.__wbg_ptr);
|
|
304
|
+
return ret;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* The other workbooks this one reads, in the order `[1]Sheet1!A1` counts
|
|
308
|
+
* them. A path is `undefined` where the file does not name one.
|
|
309
|
+
* @returns {any[]}
|
|
310
|
+
*/
|
|
311
|
+
externalBooks() {
|
|
312
|
+
const ret = wasm.book_externalBooks(this.__wbg_ptr);
|
|
313
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]);
|
|
314
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
315
|
+
return v1;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Reads a workbook and hands sheet `sheet` over row by row, without
|
|
319
|
+
* building its grid: `callback(row, data)` gets the 1-based row number
|
|
320
|
+
* and what `getRowAt` would answer for it, and the row is dropped once
|
|
321
|
+
* the callback returns.
|
|
322
|
+
*
|
|
323
|
+
* The workbook comes back whole but for that sheet's cells. Only xlsx
|
|
324
|
+
* streams; any other format is read whole and then handed over the same
|
|
325
|
+
* way, so the callback sees the same rows but nothing is saved.
|
|
326
|
+
* A callback that throws is not called again, and what it threw comes
|
|
327
|
+
* out of `forEachRow` once the read is over.
|
|
328
|
+
* @param {Uint8Array} bytes
|
|
329
|
+
* @param {string | null | undefined} name
|
|
330
|
+
* @param {number} sheet
|
|
331
|
+
* @param {Function} callback
|
|
332
|
+
* @param {boolean | null} [formatted]
|
|
333
|
+
* @returns {Book}
|
|
334
|
+
*/
|
|
335
|
+
static forEachRow(bytes, name, sheet, callback, formatted) {
|
|
336
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
337
|
+
const len0 = WASM_VECTOR_LEN;
|
|
338
|
+
var ptr1 = isLikeNone(name) ? 0 : passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
339
|
+
var len1 = WASM_VECTOR_LEN;
|
|
340
|
+
const ret = wasm.book_forEachRow(ptr0, len0, ptr1, len1, sheet, callback, isLikeNone(formatted) ? 0xFFFFFF : formatted ? 1 : 0);
|
|
341
|
+
if (ret[2]) {
|
|
342
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
343
|
+
}
|
|
344
|
+
return Book.__wrap(ret[0]);
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* The value at `address` on sheet `sheet`, as a JS number, string, boolean
|
|
348
|
+
* or `null`. A formula cell gives its cached result, not its text.
|
|
349
|
+
* @param {number} sheet
|
|
350
|
+
* @param {string} address
|
|
351
|
+
* @returns {CellValue}
|
|
352
|
+
*/
|
|
353
|
+
get(sheet, address) {
|
|
354
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
355
|
+
const len0 = WASM_VECTOR_LEN;
|
|
356
|
+
const ret = wasm.book_get(this.__wbg_ptr, sheet, ptr0, len0);
|
|
357
|
+
if (ret[2]) {
|
|
358
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
359
|
+
}
|
|
360
|
+
return takeFromExternrefTable0(ret[0]);
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* The same by 1-based row and column.
|
|
364
|
+
* @param {number} sheet
|
|
365
|
+
* @param {number} row
|
|
366
|
+
* @param {number} column
|
|
367
|
+
* @returns {CellValue}
|
|
368
|
+
*/
|
|
369
|
+
getAt(sheet, row, column) {
|
|
370
|
+
const ret = wasm.book_getAt(this.__wbg_ptr, sheet, row, column);
|
|
371
|
+
if (ret[2]) {
|
|
372
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
373
|
+
}
|
|
374
|
+
return takeFromExternrefTable0(ret[0]);
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* The cell as a spreadsheet would display it: the value run through its
|
|
378
|
+
* number format, so `0.256` under `0.0%` reads `25.6%`.
|
|
379
|
+
* @param {number} sheet
|
|
380
|
+
* @param {string} address
|
|
381
|
+
* @returns {string}
|
|
382
|
+
*/
|
|
383
|
+
getFormatted(sheet, address) {
|
|
384
|
+
let deferred3_0;
|
|
385
|
+
let deferred3_1;
|
|
386
|
+
try {
|
|
387
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
388
|
+
const len0 = WASM_VECTOR_LEN;
|
|
389
|
+
const ret = wasm.book_getFormatted(this.__wbg_ptr, sheet, ptr0, len0);
|
|
390
|
+
var ptr2 = ret[0];
|
|
391
|
+
var len2 = ret[1];
|
|
392
|
+
if (ret[3]) {
|
|
393
|
+
ptr2 = 0; len2 = 0;
|
|
394
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
395
|
+
}
|
|
396
|
+
deferred3_0 = ptr2;
|
|
397
|
+
deferred3_1 = len2;
|
|
398
|
+
return getStringFromWasm0(ptr2, len2);
|
|
399
|
+
} finally {
|
|
400
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* The same by 1-based row and column.
|
|
405
|
+
* @param {number} sheet
|
|
406
|
+
* @param {number} row
|
|
407
|
+
* @param {number} column
|
|
408
|
+
* @returns {string}
|
|
409
|
+
*/
|
|
410
|
+
getFormattedAt(sheet, row, column) {
|
|
411
|
+
let deferred2_0;
|
|
412
|
+
let deferred2_1;
|
|
413
|
+
try {
|
|
414
|
+
const ret = wasm.book_getFormattedAt(this.__wbg_ptr, sheet, row, column);
|
|
415
|
+
var ptr1 = ret[0];
|
|
416
|
+
var len1 = ret[1];
|
|
417
|
+
if (ret[3]) {
|
|
418
|
+
ptr1 = 0; len1 = 0;
|
|
419
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
420
|
+
}
|
|
421
|
+
deferred2_0 = ptr1;
|
|
422
|
+
deferred2_1 = len1;
|
|
423
|
+
return getStringFromWasm0(ptr1, len1);
|
|
424
|
+
} finally {
|
|
425
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* The formula text of a cell without its leading `=`, or `undefined` when
|
|
430
|
+
* the cell holds a plain value.
|
|
431
|
+
* @param {number} sheet
|
|
432
|
+
* @param {string} address
|
|
433
|
+
* @returns {string | undefined}
|
|
434
|
+
*/
|
|
435
|
+
getFormula(sheet, address) {
|
|
436
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
437
|
+
const len0 = WASM_VECTOR_LEN;
|
|
438
|
+
const ret = wasm.book_getFormula(this.__wbg_ptr, sheet, ptr0, len0);
|
|
439
|
+
let v2;
|
|
440
|
+
if (ret[0] !== 0) {
|
|
441
|
+
v2 = getStringFromWasm0(ret[0], ret[1]);
|
|
442
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
443
|
+
}
|
|
444
|
+
return v2;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* The same by 1-based row and column.
|
|
448
|
+
* @param {number} sheet
|
|
449
|
+
* @param {number} row
|
|
450
|
+
* @param {number} column
|
|
451
|
+
* @returns {string | undefined}
|
|
452
|
+
*/
|
|
453
|
+
getFormulaAt(sheet, row, column) {
|
|
454
|
+
const ret = wasm.book_getFormulaAt(this.__wbg_ptr, sheet, row, column);
|
|
455
|
+
let v1;
|
|
456
|
+
if (ret[0] !== 0) {
|
|
457
|
+
v1 = getStringFromWasm0(ret[0], ret[1]);
|
|
458
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
459
|
+
}
|
|
460
|
+
return v1;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* A rectangle of cells, row by row. One call across the boundary instead
|
|
464
|
+
* of one per cell, which is what makes reading a sheet worth doing.
|
|
465
|
+
* @param {number} sheet
|
|
466
|
+
* @param {string} range
|
|
467
|
+
* @returns {CellGrid}
|
|
468
|
+
*/
|
|
469
|
+
getRange(sheet, range) {
|
|
470
|
+
const ptr0 = passStringToWasm0(range, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
471
|
+
const len0 = WASM_VECTOR_LEN;
|
|
472
|
+
const ret = wasm.book_getRange(this.__wbg_ptr, sheet, ptr0, len0);
|
|
473
|
+
if (ret[2]) {
|
|
474
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
475
|
+
}
|
|
476
|
+
return takeFromExternrefTable0(ret[0]);
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* The same by numbers: the top-left cell, then how many rows and columns
|
|
480
|
+
* to take. `getRangeAt(0, 1, 1, 3, 2)` is `A1:B3`.
|
|
481
|
+
* @param {number} sheet
|
|
482
|
+
* @param {number} row
|
|
483
|
+
* @param {number} column
|
|
484
|
+
* @param {number} rows
|
|
485
|
+
* @param {number} columns
|
|
486
|
+
* @returns {CellGrid}
|
|
487
|
+
*/
|
|
488
|
+
getRangeAt(sheet, row, column, rows, columns) {
|
|
489
|
+
const ret = wasm.book_getRangeAt(this.__wbg_ptr, sheet, row, column, rows, columns);
|
|
490
|
+
if (ret[2]) {
|
|
491
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
492
|
+
}
|
|
493
|
+
return takeFromExternrefTable0(ret[0]);
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* The styles of a rectangle in one call: each distinct style once, and a
|
|
497
|
+
* grid of indexes into them. `cellStyle` per cell costs a crossing and a
|
|
498
|
+
* whole style object per cell; a formatted table of ten thousand cells
|
|
499
|
+
* usually has a dozen styles.
|
|
500
|
+
* @param {number} sheet
|
|
501
|
+
* @param {string} range
|
|
502
|
+
* @returns {RangeStyles}
|
|
503
|
+
*/
|
|
504
|
+
getRangeStyles(sheet, range) {
|
|
505
|
+
const ptr0 = passStringToWasm0(range, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
506
|
+
const len0 = WASM_VECTOR_LEN;
|
|
507
|
+
const ret = wasm.book_getRangeStyles(this.__wbg_ptr, sheet, ptr0, len0);
|
|
508
|
+
if (ret[2]) {
|
|
509
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
510
|
+
}
|
|
511
|
+
return takeFromExternrefTable0(ret[0]);
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* The same by numbers, as `getRangeAt` takes them.
|
|
515
|
+
* @param {number} sheet
|
|
516
|
+
* @param {number} row
|
|
517
|
+
* @param {number} column
|
|
518
|
+
* @param {number} rows
|
|
519
|
+
* @param {number} columns
|
|
520
|
+
* @returns {RangeStyles}
|
|
521
|
+
*/
|
|
522
|
+
getRangeStylesAt(sheet, row, column, rows, columns) {
|
|
523
|
+
const ret = wasm.book_getRangeStylesAt(this.__wbg_ptr, sheet, row, column, rows, columns);
|
|
524
|
+
if (ret[2]) {
|
|
525
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
526
|
+
}
|
|
527
|
+
return takeFromExternrefTable0(ret[0]);
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* The runs of a cell's formatted text: `{ text, font }` each, `font`
|
|
531
|
+
* naming only what the run changes about the cell's font, or `null` for
|
|
532
|
+
* a run in the cell's own. `null` for a cell without formatted text.
|
|
533
|
+
* @param {number} sheet
|
|
534
|
+
* @param {string} address
|
|
535
|
+
* @returns {TextRun[] | null}
|
|
536
|
+
*/
|
|
537
|
+
getRichText(sheet, address) {
|
|
538
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
539
|
+
const len0 = WASM_VECTOR_LEN;
|
|
540
|
+
const ret = wasm.book_getRichText(this.__wbg_ptr, sheet, ptr0, len0);
|
|
541
|
+
if (ret[2]) {
|
|
542
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
543
|
+
}
|
|
544
|
+
return takeFromExternrefTable0(ret[0]);
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* The same by 1-based row and column.
|
|
548
|
+
* @param {number} sheet
|
|
549
|
+
* @param {number} row
|
|
550
|
+
* @param {number} column
|
|
551
|
+
* @returns {TextRun[] | null}
|
|
552
|
+
*/
|
|
553
|
+
getRichTextAt(sheet, row, column) {
|
|
554
|
+
const ret = wasm.book_getRichTextAt(this.__wbg_ptr, sheet, row, column);
|
|
555
|
+
if (ret[2]) {
|
|
556
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
557
|
+
}
|
|
558
|
+
return takeFromExternrefTable0(ret[0]);
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* A whole row in one crossing of the boundary: values, displayed text,
|
|
562
|
+
* bold and indent, plus whether the row is hidden.
|
|
563
|
+
*
|
|
564
|
+
* The arrays run from column 1 to the last column this row has a cell in,
|
|
565
|
+
* so a row of ten cells costs one call rather than forty.
|
|
566
|
+
*
|
|
567
|
+
* `formatted` is what the number format makes of each value, and building
|
|
568
|
+
* it allocates a string per cell - which a caller reading values does not
|
|
569
|
+
* want to pay half a sheet over. Pass `false` and the field comes back
|
|
570
|
+
* `null`; `getFormattedAt` still answers for the cells that need it.
|
|
571
|
+
* @param {number} sheet
|
|
572
|
+
* @param {number} row
|
|
573
|
+
* @param {boolean | null} [formatted]
|
|
574
|
+
* @returns {SheetRow}
|
|
575
|
+
*/
|
|
576
|
+
getRowAt(sheet, row, formatted) {
|
|
577
|
+
const ret = wasm.book_getRowAt(this.__wbg_ptr, sheet, row, isLikeNone(formatted) ? 0xFFFFFF : formatted ? 1 : 0);
|
|
578
|
+
if (ret[2]) {
|
|
579
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
580
|
+
}
|
|
581
|
+
return takeFromExternrefTable0(ret[0]);
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* The hyperlinks of a sheet. `external` tells a URL from a jump inside
|
|
585
|
+
* the workbook.
|
|
586
|
+
* @param {number} sheet
|
|
587
|
+
* @returns {SheetHyperlink[]}
|
|
588
|
+
*/
|
|
589
|
+
hyperlinks(sheet) {
|
|
590
|
+
const ret = wasm.book_hyperlinks(this.__wbg_ptr, sheet);
|
|
591
|
+
if (ret[2]) {
|
|
592
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
593
|
+
}
|
|
594
|
+
return takeFromExternrefTable0(ret[0]);
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* The bytes of one picture, by its position in `images`.
|
|
598
|
+
* @param {number} sheet
|
|
599
|
+
* @param {number} index
|
|
600
|
+
* @returns {Uint8Array}
|
|
601
|
+
*/
|
|
602
|
+
imageData(sheet, index) {
|
|
603
|
+
const ret = wasm.book_imageData(this.__wbg_ptr, sheet, index);
|
|
604
|
+
if (ret[3]) {
|
|
605
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
606
|
+
}
|
|
607
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
608
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
609
|
+
return v1;
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* The pictures on a sheet, without their bytes: `imageData` fetches those
|
|
613
|
+
* for the one that is wanted.
|
|
614
|
+
* @param {number} sheet
|
|
615
|
+
* @returns {SheetImage[]}
|
|
616
|
+
*/
|
|
617
|
+
images(sheet) {
|
|
618
|
+
const ret = wasm.book_images(this.__wbg_ptr, sheet);
|
|
619
|
+
if (ret[2]) {
|
|
620
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
621
|
+
}
|
|
622
|
+
return takeFromExternrefTable0(ret[0]);
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* The merged areas of a sheet, as `"A1:C1"` strings in the order the file
|
|
626
|
+
* lists them.
|
|
627
|
+
* @param {number} sheet
|
|
628
|
+
* @returns {string[]}
|
|
629
|
+
*/
|
|
630
|
+
mergedRanges(sheet) {
|
|
631
|
+
const ret = wasm.book_mergedRanges(this.__wbg_ptr, sheet);
|
|
632
|
+
if (ret[3]) {
|
|
633
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
634
|
+
}
|
|
635
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]);
|
|
636
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
637
|
+
return v1;
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* The merged areas of a sheet as numbers: four per area, `[r1, c1, r2,
|
|
641
|
+
* c2]`, rows and columns 1-based.
|
|
642
|
+
*
|
|
643
|
+
* One typed array instead of a JS string per area, which is what a sheet
|
|
644
|
+
* carrying three hundred thousand of them needs.
|
|
645
|
+
* @param {number} sheet
|
|
646
|
+
* @returns {Uint32Array}
|
|
647
|
+
*/
|
|
648
|
+
mergedRangesAt(sheet) {
|
|
649
|
+
const ret = wasm.book_mergedRangesAt(this.__wbg_ptr, sheet);
|
|
650
|
+
if (ret[2]) {
|
|
651
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
652
|
+
}
|
|
653
|
+
return takeFromExternrefTable0(ret[0]);
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* A new workbook with one empty sheet.
|
|
657
|
+
*/
|
|
658
|
+
constructor() {
|
|
659
|
+
const ret = wasm.book_new();
|
|
660
|
+
this.__wbg_ptr = ret;
|
|
661
|
+
BookFinalization.register(this, this.__wbg_ptr, this);
|
|
662
|
+
return this;
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* The pivot reports laid out on a sheet. The numbers they show are cells
|
|
666
|
+
* like any others; this says where a report sits and how wide its axes
|
|
667
|
+
* are.
|
|
668
|
+
* @param {number} sheet
|
|
669
|
+
* @returns {SheetPivotTable[]}
|
|
670
|
+
*/
|
|
671
|
+
pivotTables(sheet) {
|
|
672
|
+
const ret = wasm.book_pivotTables(this.__wbg_ptr, sheet);
|
|
673
|
+
if (ret[2]) {
|
|
674
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
675
|
+
}
|
|
676
|
+
return takeFromExternrefTable0(ret[0]);
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Reads a workbook of any format this crate supports, working the format
|
|
680
|
+
* out from the bytes themselves.
|
|
681
|
+
*
|
|
682
|
+
* `name` is the file name they came from, if the caller has one: it
|
|
683
|
+
* settles what the bytes cannot say (a `.csv` against a `.html`) and names
|
|
684
|
+
* the sheet of a SYLK file. `password` opens a workbook saved with a
|
|
685
|
+
* password to open; without it only one encrypted to be opened
|
|
686
|
+
* read-only reads.
|
|
687
|
+
* @param {Uint8Array} bytes
|
|
688
|
+
* @param {string | null} [name]
|
|
689
|
+
* @param {number | null} [max_expanded]
|
|
690
|
+
* @param {Function | null} [on_progress]
|
|
691
|
+
* @param {string | null} [password]
|
|
692
|
+
* @returns {Book}
|
|
693
|
+
*/
|
|
694
|
+
static read(bytes, name, max_expanded, on_progress, password) {
|
|
695
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
696
|
+
const len0 = WASM_VECTOR_LEN;
|
|
697
|
+
var ptr1 = isLikeNone(name) ? 0 : passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
698
|
+
var len1 = WASM_VECTOR_LEN;
|
|
699
|
+
var ptr2 = isLikeNone(password) ? 0 : passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
700
|
+
var len2 = WASM_VECTOR_LEN;
|
|
701
|
+
const ret = wasm.book_read(ptr0, len0, ptr1, len1, !isLikeNone(max_expanded), isLikeNone(max_expanded) ? 0 : max_expanded, isLikeNone(on_progress) ? 0 : addToExternrefTable0(on_progress), ptr2, len2);
|
|
702
|
+
if (ret[2]) {
|
|
703
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
704
|
+
}
|
|
705
|
+
return Book.__wrap(ret[0]);
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Reads CSV with the guesses overridden: the delimiter, whether a row
|
|
709
|
+
* that produced no cell is skipped, whether an empty field becomes an
|
|
710
|
+
* empty string rather than no cell at all.
|
|
711
|
+
*
|
|
712
|
+
* `Book.read` guesses all of this from the bytes, which is right for a
|
|
713
|
+
* file of unknown origin; this is for one whose shape you already know.
|
|
714
|
+
* @param {Uint8Array} bytes
|
|
715
|
+
* @param {CsvOptions} options
|
|
716
|
+
* @returns {Book}
|
|
717
|
+
*/
|
|
718
|
+
static readCsv(bytes, options) {
|
|
719
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
720
|
+
const len0 = WASM_VECTOR_LEN;
|
|
721
|
+
const ret = wasm.book_readCsv(ptr0, len0, options);
|
|
722
|
+
if (ret[2]) {
|
|
723
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
724
|
+
}
|
|
725
|
+
return Book.__wrap(ret[0]);
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* Renames a sheet.
|
|
729
|
+
* @param {number} sheet
|
|
730
|
+
* @param {string} title
|
|
731
|
+
*/
|
|
732
|
+
renameSheet(sheet, title) {
|
|
733
|
+
const ptr0 = passStringToWasm0(title, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
734
|
+
const len0 = WASM_VECTOR_LEN;
|
|
735
|
+
const ret = wasm.book_renameSheet(this.__wbg_ptr, sheet, ptr0, len0);
|
|
736
|
+
if (ret[1]) {
|
|
737
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* The height of a row in points, or `undefined` when the sheet leaves it
|
|
742
|
+
* to the default. `row` is the number a user sees.
|
|
743
|
+
* @param {number} sheet
|
|
744
|
+
* @param {number} row
|
|
745
|
+
* @returns {number | undefined}
|
|
746
|
+
*/
|
|
747
|
+
rowHeight(sheet, row) {
|
|
748
|
+
const ret = wasm.book_rowHeight(this.__wbg_ptr, sheet, row);
|
|
749
|
+
if (ret[3]) {
|
|
750
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
751
|
+
}
|
|
752
|
+
return ret[0] === 0 ? undefined : ret[1];
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* Whether a row is hidden. `row` is the number a user sees.
|
|
756
|
+
* @param {number} sheet
|
|
757
|
+
* @param {number} row
|
|
758
|
+
* @returns {boolean}
|
|
759
|
+
*/
|
|
760
|
+
rowHidden(sheet, row) {
|
|
761
|
+
const ret = wasm.book_rowHidden(this.__wbg_ptr, sheet, row);
|
|
762
|
+
if (ret[2]) {
|
|
763
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
764
|
+
}
|
|
765
|
+
return ret[0] !== 0;
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* How deeply a row is grouped: 0 when it is not, 1 for the outermost
|
|
769
|
+
* group, and so on. `row` is the number a user sees.
|
|
770
|
+
* @param {number} sheet
|
|
771
|
+
* @param {number} row
|
|
772
|
+
* @returns {number}
|
|
773
|
+
*/
|
|
774
|
+
rowLevel(sheet, row) {
|
|
775
|
+
const ret = wasm.book_rowLevel(this.__wbg_ptr, sheet, row);
|
|
776
|
+
if (ret[2]) {
|
|
777
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
778
|
+
}
|
|
779
|
+
return ret[0];
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* Writes a value: a number, boolean, or string. A string starting with `=`
|
|
783
|
+
* becomes a formula.
|
|
784
|
+
* @param {number} sheet
|
|
785
|
+
* @param {string} address
|
|
786
|
+
* @param {CellValue} value
|
|
787
|
+
*/
|
|
788
|
+
set(sheet, address, value) {
|
|
789
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
790
|
+
const len0 = WASM_VECTOR_LEN;
|
|
791
|
+
const ret = wasm.book_set(this.__wbg_ptr, sheet, ptr0, len0, value);
|
|
792
|
+
if (ret[1]) {
|
|
793
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* Sets that tab.
|
|
798
|
+
* @param {number} sheet
|
|
799
|
+
*/
|
|
800
|
+
setActiveSheet(sheet) {
|
|
801
|
+
const ret = wasm.book_setActiveSheet(this.__wbg_ptr, sheet);
|
|
802
|
+
if (ret[1]) {
|
|
803
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* The same by 1-based row and column.
|
|
808
|
+
* @param {number} sheet
|
|
809
|
+
* @param {number} row
|
|
810
|
+
* @param {number} column
|
|
811
|
+
* @param {CellValue} value
|
|
812
|
+
*/
|
|
813
|
+
setAt(sheet, row, column, value) {
|
|
814
|
+
const ret = wasm.book_setAt(this.__wbg_ptr, sheet, row, column, value);
|
|
815
|
+
if (ret[1]) {
|
|
816
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* Writes a rectangle of values with `at` as its top-left corner. Rows may
|
|
821
|
+
* differ in length; a `null` leaves its cell empty.
|
|
822
|
+
* @param {number} sheet
|
|
823
|
+
* @param {string} at
|
|
824
|
+
* @param {CellGrid} values
|
|
825
|
+
*/
|
|
826
|
+
setRange(sheet, at, values) {
|
|
827
|
+
const ptr0 = passStringToWasm0(at, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
828
|
+
const len0 = WASM_VECTOR_LEN;
|
|
829
|
+
const ret = wasm.book_setRange(this.__wbg_ptr, sheet, ptr0, len0, values);
|
|
830
|
+
if (ret[1]) {
|
|
831
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* The same with the corner given as 1-based row and column.
|
|
836
|
+
* @param {number} sheet
|
|
837
|
+
* @param {number} row
|
|
838
|
+
* @param {number} column
|
|
839
|
+
* @param {CellGrid} values
|
|
840
|
+
*/
|
|
841
|
+
setRangeAt(sheet, row, column, values) {
|
|
842
|
+
const ret = wasm.book_setRangeAt(this.__wbg_ptr, sheet, row, column, values);
|
|
843
|
+
if (ret[1]) {
|
|
844
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
/**
|
|
848
|
+
* The drawn shapes of a sheet, text and all, with the look Excel shows:
|
|
849
|
+
* fill, outline and font are the shape's own with its style filling in
|
|
850
|
+
* the rest, colours resolved through the workbook theme.
|
|
851
|
+
* @param {number} sheet
|
|
852
|
+
* @returns {SheetShape[]}
|
|
853
|
+
*/
|
|
854
|
+
shapes(sheet) {
|
|
855
|
+
const ret = wasm.book_shapes(this.__wbg_ptr, sheet);
|
|
856
|
+
if (ret[2]) {
|
|
857
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
858
|
+
}
|
|
859
|
+
return takeFromExternrefTable0(ret[0]);
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* The tab index of a sheet by name, or `undefined` when there is none.
|
|
863
|
+
* Names are compared the way Excel does, ignoring case.
|
|
864
|
+
* @param {string} name
|
|
865
|
+
* @returns {number | undefined}
|
|
866
|
+
*/
|
|
867
|
+
sheetIndex(name) {
|
|
868
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
869
|
+
const len0 = WASM_VECTOR_LEN;
|
|
870
|
+
const ret = wasm.book_sheetIndex(this.__wbg_ptr, ptr0, len0);
|
|
871
|
+
return ret === Number.MAX_SAFE_INTEGER ? undefined : ret;
|
|
872
|
+
}
|
|
873
|
+
/**
|
|
874
|
+
* Sheet titles, in tab order.
|
|
875
|
+
* @returns {string[]}
|
|
876
|
+
*/
|
|
877
|
+
sheetNames() {
|
|
878
|
+
const ret = wasm.book_sheetNames(this.__wbg_ptr);
|
|
879
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]);
|
|
880
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
881
|
+
return v1;
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* Whether a sheet is locked, and whether the lock has a password.
|
|
885
|
+
* @param {number} sheet
|
|
886
|
+
* @returns {ProtectionInfo}
|
|
887
|
+
*/
|
|
888
|
+
sheetProtection(sheet) {
|
|
889
|
+
const ret = wasm.book_sheetProtection(this.__wbg_ptr, sheet);
|
|
890
|
+
if (ret[2]) {
|
|
891
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
892
|
+
}
|
|
893
|
+
return takeFromExternrefTable0(ret[0]);
|
|
894
|
+
}
|
|
895
|
+
/**
|
|
896
|
+
* How the sheet is frozen and shown.
|
|
897
|
+
* @param {number} sheet
|
|
898
|
+
* @returns {SheetViewInfo}
|
|
899
|
+
*/
|
|
900
|
+
sheetView(sheet) {
|
|
901
|
+
const ret = wasm.book_sheetView(this.__wbg_ptr, sheet);
|
|
902
|
+
if (ret[2]) {
|
|
903
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
904
|
+
}
|
|
905
|
+
return takeFromExternrefTable0(ret[0]);
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* Whether a sheet has a tab: `"visible"`, `"hidden"` or `"veryHidden"`.
|
|
909
|
+
*
|
|
910
|
+
* `sheetNames` lists every sheet, hidden ones included, because that is
|
|
911
|
+
* what the index of every other call counts.
|
|
912
|
+
* @param {number} sheet
|
|
913
|
+
* @returns {string}
|
|
914
|
+
*/
|
|
915
|
+
sheetVisibility(sheet) {
|
|
916
|
+
let deferred2_0;
|
|
917
|
+
let deferred2_1;
|
|
918
|
+
try {
|
|
919
|
+
const ret = wasm.book_sheetVisibility(this.__wbg_ptr, sheet);
|
|
920
|
+
var ptr1 = ret[0];
|
|
921
|
+
var len1 = ret[1];
|
|
922
|
+
if (ret[3]) {
|
|
923
|
+
ptr1 = 0; len1 = 0;
|
|
924
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
925
|
+
}
|
|
926
|
+
deferred2_0 = ptr1;
|
|
927
|
+
deferred2_1 = len1;
|
|
928
|
+
return getStringFromWasm0(ptr1, len1);
|
|
929
|
+
} finally {
|
|
930
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
/**
|
|
934
|
+
* The tables of a sheet: what a structured reference like `Sales[Amount]`
|
|
935
|
+
* names.
|
|
936
|
+
* @param {number} sheet
|
|
937
|
+
* @returns {SheetTable[]}
|
|
938
|
+
*/
|
|
939
|
+
tables(sheet) {
|
|
940
|
+
const ret = wasm.book_tables(this.__wbg_ptr, sheet);
|
|
941
|
+
if (ret[2]) {
|
|
942
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
943
|
+
}
|
|
944
|
+
return takeFromExternrefTable0(ret[0]);
|
|
945
|
+
}
|
|
946
|
+
/**
|
|
947
|
+
* The used range of a sheet as `A1:D9`, or `undefined` if it holds
|
|
948
|
+
* nothing. This is the rectangle to walk; the sheet itself is sparse.
|
|
949
|
+
* @param {number} sheet
|
|
950
|
+
* @returns {string | undefined}
|
|
951
|
+
*/
|
|
952
|
+
usedRange(sheet) {
|
|
953
|
+
const ret = wasm.book_usedRange(this.__wbg_ptr, sheet);
|
|
954
|
+
let v1;
|
|
955
|
+
if (ret[0] !== 0) {
|
|
956
|
+
v1 = getStringFromWasm0(ret[0], ret[1]);
|
|
957
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
958
|
+
}
|
|
959
|
+
return v1;
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* The used range of a sheet as `"A1:D20"` without walking the rows;
|
|
963
|
+
* `undefined` for an empty sheet.
|
|
964
|
+
*
|
|
965
|
+
* Rows are exact, columns an upper bound: removing a cell never narrows
|
|
966
|
+
* them. `usedRange` answers the same until a cell in an edge column is
|
|
967
|
+
* removed, and walks the rows after that to give the exact rectangle.
|
|
968
|
+
* @param {number} sheet
|
|
969
|
+
* @returns {string | undefined}
|
|
970
|
+
*/
|
|
971
|
+
usedRangeHint(sheet) {
|
|
972
|
+
const ret = wasm.book_usedRangeHint(this.__wbg_ptr, sheet);
|
|
973
|
+
if (ret[3]) {
|
|
974
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
975
|
+
}
|
|
976
|
+
let v1;
|
|
977
|
+
if (ret[0] !== 0) {
|
|
978
|
+
v1 = getStringFromWasm0(ret[0], ret[1]);
|
|
979
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
980
|
+
}
|
|
981
|
+
return v1;
|
|
982
|
+
}
|
|
983
|
+
/**
|
|
984
|
+
* Whether that password unlocks the sheet. `false` for a sheet with no
|
|
985
|
+
* password on it, and for a hash this crate cannot check.
|
|
986
|
+
* @param {number} sheet
|
|
987
|
+
* @param {string} password
|
|
988
|
+
* @returns {boolean}
|
|
989
|
+
*/
|
|
990
|
+
verifySheetPassword(sheet, password) {
|
|
991
|
+
const ptr0 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
992
|
+
const len0 = WASM_VECTOR_LEN;
|
|
993
|
+
const ret = wasm.book_verifySheetPassword(this.__wbg_ptr, sheet, ptr0, len0);
|
|
994
|
+
if (ret[2]) {
|
|
995
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
996
|
+
}
|
|
997
|
+
return ret[0] !== 0;
|
|
998
|
+
}
|
|
999
|
+
/**
|
|
1000
|
+
* Whether the workbook's structure is locked, and whether behind a
|
|
1001
|
+
* password.
|
|
1002
|
+
* @returns {ProtectionInfo}
|
|
1003
|
+
*/
|
|
1004
|
+
workbookProtection() {
|
|
1005
|
+
const ret = wasm.book_workbookProtection(this.__wbg_ptr);
|
|
1006
|
+
return ret;
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
if (Symbol.dispose) Book.prototype[Symbol.dispose] = Book.prototype.free;
|
|
1010
|
+
function __wbg_get_imports() {
|
|
1011
|
+
const import0 = {
|
|
1012
|
+
__proto__: null,
|
|
1013
|
+
__wbg_Error_408e67f47ca7b58b: function(arg0, arg1) {
|
|
1014
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
1015
|
+
return ret;
|
|
1016
|
+
},
|
|
1017
|
+
__wbg___wbindgen_boolean_get_c9c83ebd41b34df3: function(arg0) {
|
|
1018
|
+
const v = arg0;
|
|
1019
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
1020
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
1021
|
+
},
|
|
1022
|
+
__wbg___wbindgen_is_falsy_b7464e97ddc1b7a4: function(arg0) {
|
|
1023
|
+
const ret = !arg0;
|
|
1024
|
+
return ret;
|
|
1025
|
+
},
|
|
1026
|
+
__wbg___wbindgen_is_null_7d13f41e1a2d5140: function(arg0) {
|
|
1027
|
+
const ret = arg0 === null;
|
|
1028
|
+
return ret;
|
|
1029
|
+
},
|
|
1030
|
+
__wbg___wbindgen_is_undefined_6cff064c44e0d823: function(arg0) {
|
|
1031
|
+
const ret = arg0 === undefined;
|
|
1032
|
+
return ret;
|
|
1033
|
+
},
|
|
1034
|
+
__wbg___wbindgen_number_get_136b9679cab35cfb: function(arg0, arg1) {
|
|
1035
|
+
const obj = arg1;
|
|
1036
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
1037
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
1038
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1039
|
+
},
|
|
1040
|
+
__wbg___wbindgen_string_get_d154f1e671052120: function(arg0, arg1) {
|
|
1041
|
+
const obj = arg1;
|
|
1042
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
1043
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1044
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1045
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1046
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1047
|
+
},
|
|
1048
|
+
__wbg___wbindgen_throw_bb96b2010945f0bc: function(arg0, arg1) {
|
|
1049
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1050
|
+
},
|
|
1051
|
+
__wbg_call_0f2a9af232c18fd2: function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
1052
|
+
const ret = arg0.call(arg1, arg2, arg3);
|
|
1053
|
+
return ret;
|
|
1054
|
+
}, arguments); },
|
|
1055
|
+
__wbg_call_35dba3c747ad7521: function() { return handleError(function (arg0, arg1, arg2) {
|
|
1056
|
+
const ret = arg0.call(arg1, arg2);
|
|
1057
|
+
return ret;
|
|
1058
|
+
}, arguments); },
|
|
1059
|
+
__wbg_get_971a0c45d172643f: function() { return handleError(function (arg0, arg1) {
|
|
1060
|
+
const ret = Reflect.get(arg0, arg1);
|
|
1061
|
+
return ret;
|
|
1062
|
+
}, arguments); },
|
|
1063
|
+
__wbg_get_unchecked_e20b893aeafc3fca: function(arg0, arg1) {
|
|
1064
|
+
const ret = arg0[arg1 >>> 0];
|
|
1065
|
+
return ret;
|
|
1066
|
+
},
|
|
1067
|
+
__wbg_isArray_6339f732981044bf: function(arg0) {
|
|
1068
|
+
const ret = Array.isArray(arg0);
|
|
1069
|
+
return ret;
|
|
1070
|
+
},
|
|
1071
|
+
__wbg_length_ecfa2c63d3d0d82c: function(arg0) {
|
|
1072
|
+
const ret = arg0.length;
|
|
1073
|
+
return ret;
|
|
1074
|
+
},
|
|
1075
|
+
__wbg_message_c141d5e68716b595: function(arg0) {
|
|
1076
|
+
const ret = arg0.message;
|
|
1077
|
+
return ret;
|
|
1078
|
+
},
|
|
1079
|
+
__wbg_new_116be93542d39019: function() {
|
|
1080
|
+
const ret = new Array();
|
|
1081
|
+
return ret;
|
|
1082
|
+
},
|
|
1083
|
+
__wbg_new_ebe3e0f6837f0879: function() {
|
|
1084
|
+
const ret = new Object();
|
|
1085
|
+
return ret;
|
|
1086
|
+
},
|
|
1087
|
+
__wbg_new_from_slice_3eea173078478cfe: function(arg0, arg1) {
|
|
1088
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
1089
|
+
return ret;
|
|
1090
|
+
},
|
|
1091
|
+
__wbg_new_from_slice_8aed4f0384605526: function(arg0, arg1) {
|
|
1092
|
+
const ret = new Uint32Array(getArrayU32FromWasm0(arg0, arg1));
|
|
1093
|
+
return ret;
|
|
1094
|
+
},
|
|
1095
|
+
__wbg_now_8b265300afd5f2b9: function() {
|
|
1096
|
+
const ret = Date.now();
|
|
1097
|
+
return ret;
|
|
1098
|
+
},
|
|
1099
|
+
__wbg_push_adb0107829f02d75: function(arg0, arg1) {
|
|
1100
|
+
const ret = arg0.push(arg1);
|
|
1101
|
+
return ret;
|
|
1102
|
+
},
|
|
1103
|
+
__wbg_set_8155bb79a948541b: function() { return handleError(function (arg0, arg1, arg2) {
|
|
1104
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
1105
|
+
return ret;
|
|
1106
|
+
}, arguments); },
|
|
1107
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
1108
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
1109
|
+
const ret = arg0;
|
|
1110
|
+
return ret;
|
|
1111
|
+
},
|
|
1112
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
1113
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
1114
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
1115
|
+
return ret;
|
|
1116
|
+
},
|
|
1117
|
+
__wbindgen_init_externref_table: function() {
|
|
1118
|
+
const table = wasm.__wbindgen_externrefs;
|
|
1119
|
+
const offset = table.grow(4);
|
|
1120
|
+
table.set(0, undefined);
|
|
1121
|
+
table.set(offset + 0, undefined);
|
|
1122
|
+
table.set(offset + 1, null);
|
|
1123
|
+
table.set(offset + 2, true);
|
|
1124
|
+
table.set(offset + 3, false);
|
|
1125
|
+
},
|
|
1126
|
+
};
|
|
1127
|
+
return {
|
|
1128
|
+
__proto__: null,
|
|
1129
|
+
"./excelerate_bg.js": import0,
|
|
1130
|
+
};
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
const BookFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1134
|
+
? { register: () => {}, unregister: () => {} }
|
|
1135
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_book_free(ptr, 1));
|
|
1136
|
+
|
|
1137
|
+
function addToExternrefTable0(obj) {
|
|
1138
|
+
const idx = wasm.__externref_table_alloc();
|
|
1139
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
1140
|
+
return idx;
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
1144
|
+
ptr = ptr >>> 0;
|
|
1145
|
+
const mem = getDataViewMemory0();
|
|
1146
|
+
const result = [];
|
|
1147
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
1148
|
+
result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
|
|
1149
|
+
}
|
|
1150
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
1151
|
+
return result;
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
1155
|
+
ptr = ptr >>> 0;
|
|
1156
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
1160
|
+
ptr = ptr >>> 0;
|
|
1161
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
let cachedDataViewMemory0 = null;
|
|
1165
|
+
function getDataViewMemory0() {
|
|
1166
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
1167
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
1168
|
+
}
|
|
1169
|
+
return cachedDataViewMemory0;
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
function getStringFromWasm0(ptr, len) {
|
|
1173
|
+
return decodeText(ptr >>> 0, len);
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
let cachedUint32ArrayMemory0 = null;
|
|
1177
|
+
function getUint32ArrayMemory0() {
|
|
1178
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
1179
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
1180
|
+
}
|
|
1181
|
+
return cachedUint32ArrayMemory0;
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
let cachedUint8ArrayMemory0 = null;
|
|
1185
|
+
function getUint8ArrayMemory0() {
|
|
1186
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
1187
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
1188
|
+
}
|
|
1189
|
+
return cachedUint8ArrayMemory0;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
function handleError(f, args) {
|
|
1193
|
+
try {
|
|
1194
|
+
return f.apply(this, args);
|
|
1195
|
+
} catch (e) {
|
|
1196
|
+
const idx = addToExternrefTable0(e);
|
|
1197
|
+
wasm.__wbindgen_exn_store(idx);
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
function isLikeNone(x) {
|
|
1202
|
+
return x === undefined || x === null;
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
1206
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
1207
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
1208
|
+
WASM_VECTOR_LEN = arg.length;
|
|
1209
|
+
return ptr;
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
1213
|
+
if (realloc === undefined) {
|
|
1214
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
1215
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
1216
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
1217
|
+
WASM_VECTOR_LEN = buf.length;
|
|
1218
|
+
return ptr;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
let len = arg.length;
|
|
1222
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
1223
|
+
|
|
1224
|
+
const mem = getUint8ArrayMemory0();
|
|
1225
|
+
|
|
1226
|
+
let offset = 0;
|
|
1227
|
+
|
|
1228
|
+
for (; offset < len; offset++) {
|
|
1229
|
+
const code = arg.charCodeAt(offset);
|
|
1230
|
+
if (code > 0x7F) break;
|
|
1231
|
+
mem[ptr + offset] = code;
|
|
1232
|
+
}
|
|
1233
|
+
if (offset !== len) {
|
|
1234
|
+
if (offset !== 0) {
|
|
1235
|
+
arg = arg.slice(offset);
|
|
1236
|
+
}
|
|
1237
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
1238
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
1239
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
1240
|
+
|
|
1241
|
+
offset += ret.written;
|
|
1242
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
WASM_VECTOR_LEN = offset;
|
|
1246
|
+
return ptr;
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
function takeFromExternrefTable0(idx) {
|
|
1250
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
1251
|
+
wasm.__externref_table_dealloc(idx);
|
|
1252
|
+
return value;
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
1256
|
+
cachedTextDecoder.decode();
|
|
1257
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
1258
|
+
let numBytesDecoded = 0;
|
|
1259
|
+
function decodeText(ptr, len) {
|
|
1260
|
+
numBytesDecoded += len;
|
|
1261
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
1262
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
1263
|
+
cachedTextDecoder.decode();
|
|
1264
|
+
numBytesDecoded = len;
|
|
1265
|
+
}
|
|
1266
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
const cachedTextEncoder = new TextEncoder();
|
|
1270
|
+
|
|
1271
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
1272
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
1273
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
1274
|
+
view.set(buf);
|
|
1275
|
+
return {
|
|
1276
|
+
read: arg.length,
|
|
1277
|
+
written: buf.length
|
|
1278
|
+
};
|
|
1279
|
+
};
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
let WASM_VECTOR_LEN = 0;
|
|
1283
|
+
|
|
1284
|
+
let wasmModule, wasmInstance, wasm;
|
|
1285
|
+
function __wbg_finalize_init(instance, module) {
|
|
1286
|
+
wasmInstance = instance;
|
|
1287
|
+
wasm = instance.exports;
|
|
1288
|
+
wasmModule = module;
|
|
1289
|
+
cachedDataViewMemory0 = null;
|
|
1290
|
+
cachedUint32ArrayMemory0 = null;
|
|
1291
|
+
cachedUint8ArrayMemory0 = null;
|
|
1292
|
+
wasm.__wbindgen_start();
|
|
1293
|
+
return wasm;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
async function __wbg_load(module, imports) {
|
|
1297
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
1298
|
+
if (!module.ok) {
|
|
1299
|
+
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
1303
|
+
try {
|
|
1304
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
1305
|
+
} catch (e) {
|
|
1306
|
+
const validResponse = expectedResponseType(module.type);
|
|
1307
|
+
|
|
1308
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
1309
|
+
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", e);
|
|
1310
|
+
|
|
1311
|
+
} else { throw e; }
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
const bytes = await module.arrayBuffer();
|
|
1316
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
1317
|
+
} else {
|
|
1318
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
1319
|
+
|
|
1320
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
1321
|
+
return { instance, module };
|
|
1322
|
+
} else {
|
|
1323
|
+
return instance;
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
function expectedResponseType(type) {
|
|
1328
|
+
switch (type) {
|
|
1329
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
1330
|
+
}
|
|
1331
|
+
return false;
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
function initSync(module) {
|
|
1336
|
+
if (wasm !== undefined) return wasm;
|
|
1337
|
+
|
|
1338
|
+
|
|
1339
|
+
if (module !== undefined) {
|
|
1340
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
1341
|
+
({module} = module)
|
|
1342
|
+
} else {
|
|
1343
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
const imports = __wbg_get_imports();
|
|
1348
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
1349
|
+
module = new WebAssembly.Module(module);
|
|
1350
|
+
}
|
|
1351
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
1352
|
+
return __wbg_finalize_init(instance, module);
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
async function __wbg_init(module_or_path) {
|
|
1356
|
+
if (wasm !== undefined) return wasm;
|
|
1357
|
+
|
|
1358
|
+
|
|
1359
|
+
if (module_or_path !== undefined) {
|
|
1360
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
1361
|
+
({module_or_path} = module_or_path)
|
|
1362
|
+
} else {
|
|
1363
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
if (module_or_path === undefined) {
|
|
1368
|
+
module_or_path = new URL('excelerate_bg.wasm', import.meta.url);
|
|
1369
|
+
}
|
|
1370
|
+
const imports = __wbg_get_imports();
|
|
1371
|
+
|
|
1372
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
1373
|
+
module_or_path = fetch(module_or_path);
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
1377
|
+
|
|
1378
|
+
return __wbg_finalize_init(instance, module);
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
export { initSync, __wbg_init as default };
|