docling.rs-wasm 0.50.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/LICENSE +21 -0
- package/README.md +77 -0
- package/bundler/docling_wasm.d.ts +132 -0
- package/bundler/docling_wasm.js +9 -0
- package/bundler/docling_wasm_bg.js +825 -0
- package/bundler/docling_wasm_bg.wasm +0 -0
- package/bundler/docling_wasm_bg.wasm.d.ts +33 -0
- package/package.json +50 -0
- package/web/docling_wasm.d.ts +190 -0
- package/web/docling_wasm.js +926 -0
- package/web/docling_wasm_bg.wasm +0 -0
- package/web/docling_wasm_bg.wasm.d.ts +33 -0
|
@@ -0,0 +1,825 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A digital PDF being converted page by page. Construct it from the file's
|
|
3
|
+
* bytes (the text layer is parsed once, in Rust), then feed the rasterized
|
|
4
|
+
* pages in order.
|
|
5
|
+
*/
|
|
6
|
+
export class DigitalConverter {
|
|
7
|
+
__destroy_into_raw() {
|
|
8
|
+
const ptr = this.__wbg_ptr;
|
|
9
|
+
this.__wbg_ptr = 0;
|
|
10
|
+
DigitalConverterFinalization.unregister(this);
|
|
11
|
+
return ptr;
|
|
12
|
+
}
|
|
13
|
+
free() {
|
|
14
|
+
const ptr = this.__destroy_into_raw();
|
|
15
|
+
wasm.__wbg_digitalconverter_free(ptr, 0);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* [`add_page`](Self::add_page) with TableFormer for the table regions whose
|
|
19
|
+
* geometric reconstruction looks unreliable.
|
|
20
|
+
* @param {number} index
|
|
21
|
+
* @param {Uint8Array} rgba
|
|
22
|
+
* @param {number} px_w
|
|
23
|
+
* @param {number} px_h
|
|
24
|
+
* @param {number} scale
|
|
25
|
+
* @param {any} layout
|
|
26
|
+
* @param {any} tf
|
|
27
|
+
* @param {any | null} [rec]
|
|
28
|
+
* @returns {Promise<void>}
|
|
29
|
+
*/
|
|
30
|
+
addPageTf(index, rgba, px_w, px_h, scale, layout, tf, rec) {
|
|
31
|
+
const ptr0 = passArray8ToWasm0(rgba, wasm.__wbindgen_malloc);
|
|
32
|
+
const len0 = WASM_VECTOR_LEN;
|
|
33
|
+
const ret = wasm.digitalconverter_addPageTf(this.__wbg_ptr, index, ptr0, len0, px_w, px_h, scale, layout, tf, isLikeNone(rec) ? 0 : addToExternrefTable0(rec));
|
|
34
|
+
return ret;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Convert page `index` (0-based) given its rendered bitmap: layout
|
|
38
|
+
* detection plus geometric tables. `scale` is the raster's pixels per PDF
|
|
39
|
+
* point (2.0 for pdf.js `{scale: 2}`). With `rec` (and a dictionary at
|
|
40
|
+
* construction), embedded raster pictures that carry no text cells are
|
|
41
|
+
* OCR'd — the text a digital page's images hide from its text layer.
|
|
42
|
+
* @param {number} index
|
|
43
|
+
* @param {Uint8Array} rgba
|
|
44
|
+
* @param {number} px_w
|
|
45
|
+
* @param {number} px_h
|
|
46
|
+
* @param {number} scale
|
|
47
|
+
* @param {any} layout
|
|
48
|
+
* @param {any | null} [rec]
|
|
49
|
+
* @returns {Promise<void>}
|
|
50
|
+
*/
|
|
51
|
+
add_page(index, rgba, px_w, px_h, scale, layout, rec) {
|
|
52
|
+
const ptr0 = passArray8ToWasm0(rgba, wasm.__wbindgen_malloc);
|
|
53
|
+
const len0 = WASM_VECTOR_LEN;
|
|
54
|
+
const ret = wasm.digitalconverter_add_page(this.__wbg_ptr, index, ptr0, len0, px_w, px_h, scale, layout, isLikeNone(rec) ? 0 : addToExternrefTable0(rec));
|
|
55
|
+
return ret;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Assemble the converted pages into a document and render it as `"md"`
|
|
59
|
+
* (default), `"json"` or `"doclang"`, with `images` picking how pictures
|
|
60
|
+
* render in Markdown. Resets the converter.
|
|
61
|
+
* @param {string} name
|
|
62
|
+
* @param {string | null} [to]
|
|
63
|
+
* @param {string | null} [images]
|
|
64
|
+
* @returns {string}
|
|
65
|
+
*/
|
|
66
|
+
finish(name, to, images) {
|
|
67
|
+
let deferred5_0;
|
|
68
|
+
let deferred5_1;
|
|
69
|
+
try {
|
|
70
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
71
|
+
const len0 = WASM_VECTOR_LEN;
|
|
72
|
+
var ptr1 = isLikeNone(to) ? 0 : passStringToWasm0(to, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
73
|
+
var len1 = WASM_VECTOR_LEN;
|
|
74
|
+
var ptr2 = isLikeNone(images) ? 0 : passStringToWasm0(images, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
75
|
+
var len2 = WASM_VECTOR_LEN;
|
|
76
|
+
const ret = wasm.digitalconverter_finish(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
77
|
+
var ptr4 = ret[0];
|
|
78
|
+
var len4 = ret[1];
|
|
79
|
+
if (ret[3]) {
|
|
80
|
+
ptr4 = 0; len4 = 0;
|
|
81
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
82
|
+
}
|
|
83
|
+
deferred5_0 = ptr4;
|
|
84
|
+
deferred5_1 = len4;
|
|
85
|
+
return getStringFromWasm0(ptr4, len4);
|
|
86
|
+
} finally {
|
|
87
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Parse the PDF's text layer. Fails when there is none — the caller should
|
|
92
|
+
* fall back to the scanned pipeline, exactly as the demo page does.
|
|
93
|
+
* `dict` (optional) is the recognition dictionary text; with it and a
|
|
94
|
+
* `RecSession` on `add_page`, embedded raster pictures get OCR'd too.
|
|
95
|
+
* @param {Uint8Array} bytes
|
|
96
|
+
* @param {string | null} [dict]
|
|
97
|
+
*/
|
|
98
|
+
constructor(bytes, dict) {
|
|
99
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
100
|
+
const len0 = WASM_VECTOR_LEN;
|
|
101
|
+
var ptr1 = isLikeNone(dict) ? 0 : passStringToWasm0(dict, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
102
|
+
var len1 = WASM_VECTOR_LEN;
|
|
103
|
+
const ret = wasm.digitalconverter_new(ptr0, len0, ptr1, len1);
|
|
104
|
+
if (ret[2]) {
|
|
105
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
106
|
+
}
|
|
107
|
+
this.__wbg_ptr = ret[0];
|
|
108
|
+
DigitalConverterFinalization.register(this, this.__wbg_ptr, this);
|
|
109
|
+
return this;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Pages the text parser found.
|
|
113
|
+
* @returns {number}
|
|
114
|
+
*/
|
|
115
|
+
page_count() {
|
|
116
|
+
const ret = wasm.digitalconverter_page_count(this.__wbg_ptr);
|
|
117
|
+
return ret >>> 0;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Install the recognition dictionary after construction — the host probes
|
|
121
|
+
* the text layer first (the constructor throws on a scan) and only then
|
|
122
|
+
* fetches the recognition model + dictionary.
|
|
123
|
+
* @param {string} dict
|
|
124
|
+
*/
|
|
125
|
+
setDict(dict) {
|
|
126
|
+
const ptr0 = passStringToWasm0(dict, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
127
|
+
const len0 = WASM_VECTOR_LEN;
|
|
128
|
+
wasm.digitalconverter_setDict(this.__wbg_ptr, ptr0, len0);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (Symbol.dispose) DigitalConverter.prototype[Symbol.dispose] = DigitalConverter.prototype.free;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Multi-page scanned-document converter (lite profile). Feed pages in
|
|
135
|
+
* order, then [`finish`](Self::finish) — cross-page paragraph continuations
|
|
136
|
+
* merge exactly like the native pipeline.
|
|
137
|
+
*/
|
|
138
|
+
export class ScannedConverter {
|
|
139
|
+
__destroy_into_raw() {
|
|
140
|
+
const ptr = this.__wbg_ptr;
|
|
141
|
+
this.__wbg_ptr = 0;
|
|
142
|
+
ScannedConverterFinalization.unregister(this);
|
|
143
|
+
return ptr;
|
|
144
|
+
}
|
|
145
|
+
free() {
|
|
146
|
+
const ptr = this.__destroy_into_raw();
|
|
147
|
+
wasm.__wbg_scannedconverter_free(ptr, 0);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Convert one page with TableFormer (#157 stage 3): table regions get the
|
|
151
|
+
* ONNX table-structure model + docling's cell matcher instead of the
|
|
152
|
+
* geometric reconstruction. `tf` is the JS-side session over the encoder /
|
|
153
|
+
* decoder / bbox graphs.
|
|
154
|
+
* @param {Uint8Array} rgba
|
|
155
|
+
* @param {number} px_w
|
|
156
|
+
* @param {number} px_h
|
|
157
|
+
* @param {number} scale
|
|
158
|
+
* @param {any} layout
|
|
159
|
+
* @param {any} rec
|
|
160
|
+
* @param {any} tf
|
|
161
|
+
* @returns {Promise<void>}
|
|
162
|
+
*/
|
|
163
|
+
addPageTf(rgba, px_w, px_h, scale, layout, rec, tf) {
|
|
164
|
+
const ptr0 = passArray8ToWasm0(rgba, wasm.__wbindgen_malloc);
|
|
165
|
+
const len0 = WASM_VECTOR_LEN;
|
|
166
|
+
const ret = wasm.scannedconverter_addPageTf(this.__wbg_ptr, ptr0, len0, px_w, px_h, scale, layout, rec, tf);
|
|
167
|
+
return ret;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Convert one page (lite profile — geometric tables): `rgba` is the
|
|
171
|
+
* rendered bitmap (canvas ImageData), `scale` its pixels-per-PDF-point
|
|
172
|
+
* (2.0 for pdf.js `{scale: 2}`; 1.0 for a standalone image).
|
|
173
|
+
* @param {Uint8Array} rgba
|
|
174
|
+
* @param {number} px_w
|
|
175
|
+
* @param {number} px_h
|
|
176
|
+
* @param {number} scale
|
|
177
|
+
* @param {any} layout
|
|
178
|
+
* @param {any} rec
|
|
179
|
+
* @returns {Promise<void>}
|
|
180
|
+
*/
|
|
181
|
+
add_page(rgba, px_w, px_h, scale, layout, rec) {
|
|
182
|
+
const ptr0 = passArray8ToWasm0(rgba, wasm.__wbindgen_malloc);
|
|
183
|
+
const len0 = WASM_VECTOR_LEN;
|
|
184
|
+
const ret = wasm.scannedconverter_add_page(this.__wbg_ptr, ptr0, len0, px_w, px_h, scale, layout, rec);
|
|
185
|
+
return ret;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Assemble the accumulated pages into the final document and render it
|
|
189
|
+
* as `"md"` (default), `"json"` or `"doclang"` — the same three the
|
|
190
|
+
* declarative [`crate::convert`] entry point offers. `images` picks how
|
|
191
|
+
* cropped figures render in Markdown (`"placeholder"` | `"embedded"`),
|
|
192
|
+
* like [`crate::convert`]. Resets the converter.
|
|
193
|
+
* @param {string} name
|
|
194
|
+
* @param {string | null} [to]
|
|
195
|
+
* @param {string | null} [images]
|
|
196
|
+
* @returns {string}
|
|
197
|
+
*/
|
|
198
|
+
finish(name, to, images) {
|
|
199
|
+
let deferred5_0;
|
|
200
|
+
let deferred5_1;
|
|
201
|
+
try {
|
|
202
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
203
|
+
const len0 = WASM_VECTOR_LEN;
|
|
204
|
+
var ptr1 = isLikeNone(to) ? 0 : passStringToWasm0(to, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
205
|
+
var len1 = WASM_VECTOR_LEN;
|
|
206
|
+
var ptr2 = isLikeNone(images) ? 0 : passStringToWasm0(images, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
207
|
+
var len2 = WASM_VECTOR_LEN;
|
|
208
|
+
const ret = wasm.scannedconverter_finish(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
209
|
+
var ptr4 = ret[0];
|
|
210
|
+
var len4 = ret[1];
|
|
211
|
+
if (ret[3]) {
|
|
212
|
+
ptr4 = 0; len4 = 0;
|
|
213
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
214
|
+
}
|
|
215
|
+
deferred5_0 = ptr4;
|
|
216
|
+
deferred5_1 = len4;
|
|
217
|
+
return getStringFromWasm0(ptr4, len4);
|
|
218
|
+
} finally {
|
|
219
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* `dict` is the recognition dictionary text (`en_dict.txt` for the
|
|
224
|
+
* default English model).
|
|
225
|
+
* @param {string} dict
|
|
226
|
+
*/
|
|
227
|
+
constructor(dict) {
|
|
228
|
+
const ptr0 = passStringToWasm0(dict, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
229
|
+
const len0 = WASM_VECTOR_LEN;
|
|
230
|
+
const ret = wasm.scannedconverter_new(ptr0, len0);
|
|
231
|
+
this.__wbg_ptr = ret;
|
|
232
|
+
ScannedConverterFinalization.register(this, this.__wbg_ptr, this);
|
|
233
|
+
return this;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Number of pages converted so far (progress display).
|
|
237
|
+
* @returns {number}
|
|
238
|
+
*/
|
|
239
|
+
page_count() {
|
|
240
|
+
const ret = wasm.scannedconverter_page_count(this.__wbg_ptr);
|
|
241
|
+
return ret >>> 0;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
if (Symbol.dispose) ScannedConverter.prototype[Symbol.dispose] = ScannedConverter.prototype.free;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Convert a document (as bytes + filename, the extension drives format
|
|
248
|
+
* detection) to `to`: `"md"` (Markdown, default), `"json"` (docling-core's
|
|
249
|
+
* `DoclingDocument` wire format, schema 1.10.0) or `"doclang"` (docling's
|
|
250
|
+
* DocLang XML serialization).
|
|
251
|
+
*
|
|
252
|
+
* `images` controls how pictures render in Markdown — `"placeholder"`
|
|
253
|
+
* (default) or `"embedded"` (base64 data URIs), the same option
|
|
254
|
+
* docling-serve exposes. `max_pages` converts only a PDF's first N pages
|
|
255
|
+
* (issue #80's window, first pinned to 1); other formats ignore it.
|
|
256
|
+
* @param {Uint8Array} bytes
|
|
257
|
+
* @param {string} filename
|
|
258
|
+
* @param {string | null} [to]
|
|
259
|
+
* @param {string | null} [images]
|
|
260
|
+
* @param {number | null} [max_pages]
|
|
261
|
+
* @returns {string}
|
|
262
|
+
*/
|
|
263
|
+
export function convert(bytes, filename, to, images, max_pages) {
|
|
264
|
+
let deferred6_0;
|
|
265
|
+
let deferred6_1;
|
|
266
|
+
try {
|
|
267
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
268
|
+
const len0 = WASM_VECTOR_LEN;
|
|
269
|
+
const ptr1 = passStringToWasm0(filename, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
270
|
+
const len1 = WASM_VECTOR_LEN;
|
|
271
|
+
var ptr2 = isLikeNone(to) ? 0 : passStringToWasm0(to, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
272
|
+
var len2 = WASM_VECTOR_LEN;
|
|
273
|
+
var ptr3 = isLikeNone(images) ? 0 : passStringToWasm0(images, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
274
|
+
var len3 = WASM_VECTOR_LEN;
|
|
275
|
+
const ret = wasm.convert(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, isLikeNone(max_pages) ? Number.MAX_SAFE_INTEGER : (max_pages) >>> 0);
|
|
276
|
+
var ptr5 = ret[0];
|
|
277
|
+
var len5 = ret[1];
|
|
278
|
+
if (ret[3]) {
|
|
279
|
+
ptr5 = 0; len5 = 0;
|
|
280
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
281
|
+
}
|
|
282
|
+
deferred6_0 = ptr5;
|
|
283
|
+
deferred6_1 = len5;
|
|
284
|
+
return getStringFromWasm0(ptr5, len5);
|
|
285
|
+
} finally {
|
|
286
|
+
wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* One-shot scanned-image conversion through the full lite profile (layout +
|
|
292
|
+
* OCR + assembly) — the browser counterpart of the native image path
|
|
293
|
+
* (a standalone image is its own page at scale 1).
|
|
294
|
+
* @param {Uint8Array} bytes
|
|
295
|
+
* @param {string} name
|
|
296
|
+
* @param {string} dict
|
|
297
|
+
* @param {any} layout
|
|
298
|
+
* @param {any} rec
|
|
299
|
+
* @param {string | null} [to]
|
|
300
|
+
* @param {string | null} [images]
|
|
301
|
+
* @returns {Promise<string>}
|
|
302
|
+
*/
|
|
303
|
+
export function convert_scanned_image(bytes, name, dict, layout, rec, to, images) {
|
|
304
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
305
|
+
const len0 = WASM_VECTOR_LEN;
|
|
306
|
+
const ptr1 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
307
|
+
const len1 = WASM_VECTOR_LEN;
|
|
308
|
+
const ptr2 = passStringToWasm0(dict, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
309
|
+
const len2 = WASM_VECTOR_LEN;
|
|
310
|
+
var ptr3 = isLikeNone(to) ? 0 : passStringToWasm0(to, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
311
|
+
var len3 = WASM_VECTOR_LEN;
|
|
312
|
+
var ptr4 = isLikeNone(images) ? 0 : passStringToWasm0(images, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
313
|
+
var len4 = WASM_VECTOR_LEN;
|
|
314
|
+
const ret = wasm.convert_scanned_image(ptr0, len0, ptr1, len1, ptr2, len2, layout, rec, ptr3, len3, ptr4, len4);
|
|
315
|
+
return ret;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* OCR a scanned image entirely in the browser: `bytes` is the image file
|
|
320
|
+
* (PNG/JPEG/…), `dict` the recognition dictionary text (`en_dict.txt` for
|
|
321
|
+
* the default English model), `session` the JS inference wrapper. Returns
|
|
322
|
+
* Markdown (default) or docling JSON per `to`, one paragraph per recognized
|
|
323
|
+
* line.
|
|
324
|
+
* @param {Uint8Array} bytes
|
|
325
|
+
* @param {string} dict
|
|
326
|
+
* @param {any} session
|
|
327
|
+
* @param {string | null} [to]
|
|
328
|
+
* @returns {Promise<string>}
|
|
329
|
+
*/
|
|
330
|
+
export function ocr_image(bytes, dict, session, to) {
|
|
331
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
332
|
+
const len0 = WASM_VECTOR_LEN;
|
|
333
|
+
const ptr1 = passStringToWasm0(dict, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
334
|
+
const len1 = WASM_VECTOR_LEN;
|
|
335
|
+
var ptr2 = isLikeNone(to) ? 0 : passStringToWasm0(to, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
336
|
+
var len2 = WASM_VECTOR_LEN;
|
|
337
|
+
const ret = wasm.ocr_image(ptr0, len0, ptr1, len1, session, ptr2, len2);
|
|
338
|
+
return ret;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export function start() {
|
|
342
|
+
wasm.start();
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* The file extensions this build can convert, as a JSON string array —
|
|
347
|
+
* handy for an `<input accept=…>` filter. PDF converts via its embedded
|
|
348
|
+
* text layer (`pdf-text`); the remaining ML formats (images, audio, METS)
|
|
349
|
+
* are excluded: they are not compiled into the wasm build.
|
|
350
|
+
* @returns {string}
|
|
351
|
+
*/
|
|
352
|
+
export function supported_extensions() {
|
|
353
|
+
let deferred1_0;
|
|
354
|
+
let deferred1_1;
|
|
355
|
+
try {
|
|
356
|
+
const ret = wasm.supported_extensions();
|
|
357
|
+
deferred1_0 = ret[0];
|
|
358
|
+
deferred1_1 = ret[1];
|
|
359
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
360
|
+
} finally {
|
|
361
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* The docling.rs version this module was built from.
|
|
367
|
+
* @returns {string}
|
|
368
|
+
*/
|
|
369
|
+
export function version() {
|
|
370
|
+
let deferred1_0;
|
|
371
|
+
let deferred1_1;
|
|
372
|
+
try {
|
|
373
|
+
const ret = wasm.version();
|
|
374
|
+
deferred1_0 = ret[0];
|
|
375
|
+
deferred1_1 = ret[1];
|
|
376
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
377
|
+
} finally {
|
|
378
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
export function __wbg_Error_92b29b0548f8b746(arg0, arg1) {
|
|
382
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
383
|
+
return ret;
|
|
384
|
+
}
|
|
385
|
+
export function __wbg___wbindgen_debug_string_c25d447a39f5578f(arg0, arg1) {
|
|
386
|
+
const ret = debugString(arg1);
|
|
387
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
388
|
+
const len1 = WASM_VECTOR_LEN;
|
|
389
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
390
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
391
|
+
}
|
|
392
|
+
export function __wbg___wbindgen_is_function_1ff95bcc5517c252(arg0) {
|
|
393
|
+
const ret = typeof(arg0) === 'function';
|
|
394
|
+
return ret;
|
|
395
|
+
}
|
|
396
|
+
export function __wbg___wbindgen_is_undefined_c05833b95a3cf397(arg0) {
|
|
397
|
+
const ret = arg0 === undefined;
|
|
398
|
+
return ret;
|
|
399
|
+
}
|
|
400
|
+
export function __wbg___wbindgen_number_get_394265ed1e1b84ee(arg0, arg1) {
|
|
401
|
+
const obj = arg1;
|
|
402
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
403
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
404
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
405
|
+
}
|
|
406
|
+
export function __wbg___wbindgen_throw_344f42d3211c4765(arg0, arg1) {
|
|
407
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
408
|
+
}
|
|
409
|
+
export function __wbg__wbg_cb_unref_fffb441def202758(arg0) {
|
|
410
|
+
arg0._wbg_cb_unref();
|
|
411
|
+
}
|
|
412
|
+
export function __wbg_bbox_7b30625648740567() { return handleError(function (arg0, arg1, arg2) {
|
|
413
|
+
const ret = arg0.bbox(arg1, arg2 >>> 0);
|
|
414
|
+
return ret;
|
|
415
|
+
}, arguments); }
|
|
416
|
+
export function __wbg_call_a6e5c5dce5018821() { return handleError(function (arg0, arg1, arg2) {
|
|
417
|
+
const ret = arg0.call(arg1, arg2);
|
|
418
|
+
return ret;
|
|
419
|
+
}, arguments); }
|
|
420
|
+
export function __wbg_encode_d65d9f1985abdb0e() { return handleError(function (arg0, arg1) {
|
|
421
|
+
const ret = arg0.encode(arg1);
|
|
422
|
+
return ret;
|
|
423
|
+
}, arguments); }
|
|
424
|
+
export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
|
|
425
|
+
let deferred0_0;
|
|
426
|
+
let deferred0_1;
|
|
427
|
+
try {
|
|
428
|
+
deferred0_0 = arg0;
|
|
429
|
+
deferred0_1 = arg1;
|
|
430
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
431
|
+
} finally {
|
|
432
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
export function __wbg_getRandomValues_cc7f052a444bb2ce() { return handleError(function (arg0, arg1) {
|
|
436
|
+
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
437
|
+
}, arguments); }
|
|
438
|
+
export function __wbg_get_507a50627bffa49b(arg0, arg1) {
|
|
439
|
+
const ret = arg0[arg1 >>> 0];
|
|
440
|
+
return ret;
|
|
441
|
+
}
|
|
442
|
+
export function __wbg_get_78f252d074a84d0b() { return handleError(function (arg0, arg1) {
|
|
443
|
+
const ret = Reflect.get(arg0, arg1);
|
|
444
|
+
return ret;
|
|
445
|
+
}, arguments); }
|
|
446
|
+
export function __wbg_instanceof_Float32Array_0734a24e43081e98(arg0) {
|
|
447
|
+
let result;
|
|
448
|
+
try {
|
|
449
|
+
result = arg0 instanceof Float32Array;
|
|
450
|
+
} catch (_) {
|
|
451
|
+
result = false;
|
|
452
|
+
}
|
|
453
|
+
const ret = result;
|
|
454
|
+
return ret;
|
|
455
|
+
}
|
|
456
|
+
export function __wbg_isArray_0677c962b281d01a(arg0) {
|
|
457
|
+
const ret = Array.isArray(arg0);
|
|
458
|
+
return ret;
|
|
459
|
+
}
|
|
460
|
+
export function __wbg_length_370319915dc99107(arg0) {
|
|
461
|
+
const ret = arg0.length;
|
|
462
|
+
return ret;
|
|
463
|
+
}
|
|
464
|
+
export function __wbg_length_98f10d1e2f4ea968(arg0) {
|
|
465
|
+
const ret = arg0.length;
|
|
466
|
+
return ret;
|
|
467
|
+
}
|
|
468
|
+
export function __wbg_new_227d7c05414eb861() {
|
|
469
|
+
const ret = new Error();
|
|
470
|
+
return ret;
|
|
471
|
+
}
|
|
472
|
+
export function __wbg_new_from_slice_ddf8b82c4d6af38e(arg0, arg1) {
|
|
473
|
+
const ret = new Float32Array(getArrayF32FromWasm0(arg0, arg1));
|
|
474
|
+
return ret;
|
|
475
|
+
}
|
|
476
|
+
export function __wbg_new_typed_1824d93f294193e5(arg0, arg1) {
|
|
477
|
+
try {
|
|
478
|
+
var state0 = {a: arg0, b: arg1};
|
|
479
|
+
var cb0 = (arg0, arg1) => {
|
|
480
|
+
const a = state0.a;
|
|
481
|
+
state0.a = 0;
|
|
482
|
+
try {
|
|
483
|
+
return wasm_bindgen_c5dab95b9564c094___convert__closures_____invoke___js_sys_29633ec172849407___Function_fn_wasm_bindgen_c5dab95b9564c094___JsValue_____wasm_bindgen_c5dab95b9564c094___sys__Undefined___js_sys_29633ec172849407___Function_fn_wasm_bindgen_c5dab95b9564c094___JsValue_____wasm_bindgen_c5dab95b9564c094___sys__Undefined_______true_(a, state0.b, arg0, arg1);
|
|
484
|
+
} finally {
|
|
485
|
+
state0.a = a;
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
const ret = new Promise(cb0);
|
|
489
|
+
return ret;
|
|
490
|
+
} finally {
|
|
491
|
+
state0.a = 0;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
export function __wbg_prototypesetcall_ba9c9a7197c11933(arg0, arg1, arg2) {
|
|
495
|
+
Float32Array.prototype.set.call(getArrayF32FromWasm0(arg0, arg1), arg2);
|
|
496
|
+
}
|
|
497
|
+
export function __wbg_queueMicrotask_0ab5b2d2393e99b9(arg0) {
|
|
498
|
+
const ret = arg0.queueMicrotask;
|
|
499
|
+
return ret;
|
|
500
|
+
}
|
|
501
|
+
export function __wbg_queueMicrotask_6a09b7bc46549209(arg0) {
|
|
502
|
+
queueMicrotask(arg0);
|
|
503
|
+
}
|
|
504
|
+
export function __wbg_resolve_2191a4dfe481c25b(arg0) {
|
|
505
|
+
const ret = Promise.resolve(arg0);
|
|
506
|
+
return ret;
|
|
507
|
+
}
|
|
508
|
+
export function __wbg_run_6876dac5c80bce06() { return handleError(function (arg0, arg1) {
|
|
509
|
+
const ret = arg0.run(arg1);
|
|
510
|
+
return ret;
|
|
511
|
+
}, arguments); }
|
|
512
|
+
export function __wbg_run_d0e3da4a3c776751() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
513
|
+
const ret = arg0.run(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0, arg4);
|
|
514
|
+
return ret;
|
|
515
|
+
}, arguments); }
|
|
516
|
+
export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
|
|
517
|
+
const ret = arg1.stack;
|
|
518
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
519
|
+
const len1 = WASM_VECTOR_LEN;
|
|
520
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
521
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
522
|
+
}
|
|
523
|
+
export function __wbg_static_accessor_GLOBAL_4ef717fb391d88b7() {
|
|
524
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
525
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
526
|
+
}
|
|
527
|
+
export function __wbg_static_accessor_GLOBAL_THIS_8d1badc68b5a74f4() {
|
|
528
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
529
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
530
|
+
}
|
|
531
|
+
export function __wbg_static_accessor_SELF_146583524fe1469b() {
|
|
532
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
533
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
534
|
+
}
|
|
535
|
+
export function __wbg_static_accessor_WINDOW_f2829a2234d7819e() {
|
|
536
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
537
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
538
|
+
}
|
|
539
|
+
export function __wbg_step_dbfdccc97b964fea() { return handleError(function (arg0, arg1) {
|
|
540
|
+
const ret = arg0.step(arg1);
|
|
541
|
+
return ret;
|
|
542
|
+
}, arguments); }
|
|
543
|
+
export function __wbg_then_16d107c451e9905d(arg0, arg1, arg2) {
|
|
544
|
+
const ret = arg0.then(arg1, arg2);
|
|
545
|
+
return ret;
|
|
546
|
+
}
|
|
547
|
+
export function __wbg_then_6ec10ae38b3e92f7(arg0, arg1) {
|
|
548
|
+
const ret = arg0.then(arg1);
|
|
549
|
+
return ret;
|
|
550
|
+
}
|
|
551
|
+
export function __wbindgen_cast_0000000000000001(arg0, arg1) {
|
|
552
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 76, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
553
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_c5dab95b9564c094___convert__closures_____invoke___wasm_bindgen_c5dab95b9564c094___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_c5dab95b9564c094___JsError___true_);
|
|
554
|
+
return ret;
|
|
555
|
+
}
|
|
556
|
+
export function __wbindgen_cast_0000000000000002(arg0, arg1) {
|
|
557
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
558
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
559
|
+
return ret;
|
|
560
|
+
}
|
|
561
|
+
export function __wbindgen_init_externref_table() {
|
|
562
|
+
const table = wasm.__wbindgen_externrefs;
|
|
563
|
+
const offset = table.grow(4);
|
|
564
|
+
table.set(0, undefined);
|
|
565
|
+
table.set(offset + 0, undefined);
|
|
566
|
+
table.set(offset + 1, null);
|
|
567
|
+
table.set(offset + 2, true);
|
|
568
|
+
table.set(offset + 3, false);
|
|
569
|
+
}
|
|
570
|
+
function wasm_bindgen_c5dab95b9564c094___convert__closures_____invoke___wasm_bindgen_c5dab95b9564c094___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_c5dab95b9564c094___JsError___true_(arg0, arg1, arg2) {
|
|
571
|
+
const ret = wasm.wasm_bindgen_c5dab95b9564c094___convert__closures_____invoke___wasm_bindgen_c5dab95b9564c094___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_c5dab95b9564c094___JsError___true_(arg0, arg1, arg2);
|
|
572
|
+
if (ret[1]) {
|
|
573
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
function wasm_bindgen_c5dab95b9564c094___convert__closures_____invoke___js_sys_29633ec172849407___Function_fn_wasm_bindgen_c5dab95b9564c094___JsValue_____wasm_bindgen_c5dab95b9564c094___sys__Undefined___js_sys_29633ec172849407___Function_fn_wasm_bindgen_c5dab95b9564c094___JsValue_____wasm_bindgen_c5dab95b9564c094___sys__Undefined_______true_(arg0, arg1, arg2, arg3) {
|
|
578
|
+
wasm.wasm_bindgen_c5dab95b9564c094___convert__closures_____invoke___js_sys_29633ec172849407___Function_fn_wasm_bindgen_c5dab95b9564c094___JsValue_____wasm_bindgen_c5dab95b9564c094___sys__Undefined___js_sys_29633ec172849407___Function_fn_wasm_bindgen_c5dab95b9564c094___JsValue_____wasm_bindgen_c5dab95b9564c094___sys__Undefined_______true_(arg0, arg1, arg2, arg3);
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
const DigitalConverterFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
582
|
+
? { register: () => {}, unregister: () => {} }
|
|
583
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_digitalconverter_free(ptr, 1));
|
|
584
|
+
const ScannedConverterFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
585
|
+
? { register: () => {}, unregister: () => {} }
|
|
586
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_scannedconverter_free(ptr, 1));
|
|
587
|
+
|
|
588
|
+
function addToExternrefTable0(obj) {
|
|
589
|
+
const idx = wasm.__externref_table_alloc();
|
|
590
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
591
|
+
return idx;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
595
|
+
? { register: () => {}, unregister: () => {} }
|
|
596
|
+
: new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
|
|
597
|
+
|
|
598
|
+
function debugString(val) {
|
|
599
|
+
// primitive types
|
|
600
|
+
const type = typeof val;
|
|
601
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
602
|
+
return `${val}`;
|
|
603
|
+
}
|
|
604
|
+
if (type == 'string') {
|
|
605
|
+
return `"${val}"`;
|
|
606
|
+
}
|
|
607
|
+
if (type == 'symbol') {
|
|
608
|
+
const description = val.description;
|
|
609
|
+
if (description == null) {
|
|
610
|
+
return 'Symbol';
|
|
611
|
+
} else {
|
|
612
|
+
return `Symbol(${description})`;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
if (type == 'function') {
|
|
616
|
+
const name = val.name;
|
|
617
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
618
|
+
return `Function(${name})`;
|
|
619
|
+
} else {
|
|
620
|
+
return 'Function';
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
// objects
|
|
624
|
+
if (Array.isArray(val)) {
|
|
625
|
+
const length = val.length;
|
|
626
|
+
let debug = '[';
|
|
627
|
+
if (length > 0) {
|
|
628
|
+
debug += debugString(val[0]);
|
|
629
|
+
}
|
|
630
|
+
for(let i = 1; i < length; i++) {
|
|
631
|
+
debug += ', ' + debugString(val[i]);
|
|
632
|
+
}
|
|
633
|
+
debug += ']';
|
|
634
|
+
return debug;
|
|
635
|
+
}
|
|
636
|
+
// Test for built-in
|
|
637
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
638
|
+
let className;
|
|
639
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
640
|
+
className = builtInMatches[1];
|
|
641
|
+
} else {
|
|
642
|
+
// Failed to match the standard '[object ClassName]'
|
|
643
|
+
return toString.call(val);
|
|
644
|
+
}
|
|
645
|
+
if (className == 'Object') {
|
|
646
|
+
// we're a user defined class or Object
|
|
647
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
648
|
+
// easier than looping through ownProperties of `val`.
|
|
649
|
+
try {
|
|
650
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
651
|
+
} catch (_) {
|
|
652
|
+
return 'Object';
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
// errors
|
|
656
|
+
if (val instanceof Error) {
|
|
657
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
658
|
+
}
|
|
659
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
660
|
+
return className;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
function getArrayF32FromWasm0(ptr, len) {
|
|
664
|
+
ptr = ptr >>> 0;
|
|
665
|
+
return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
669
|
+
ptr = ptr >>> 0;
|
|
670
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
let cachedDataViewMemory0 = null;
|
|
674
|
+
function getDataViewMemory0() {
|
|
675
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
676
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
677
|
+
}
|
|
678
|
+
return cachedDataViewMemory0;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
let cachedFloat32ArrayMemory0 = null;
|
|
682
|
+
function getFloat32ArrayMemory0() {
|
|
683
|
+
if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
|
|
684
|
+
cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
|
|
685
|
+
}
|
|
686
|
+
return cachedFloat32ArrayMemory0;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
function getStringFromWasm0(ptr, len) {
|
|
690
|
+
return decodeText(ptr >>> 0, len);
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
let cachedUint8ArrayMemory0 = null;
|
|
694
|
+
function getUint8ArrayMemory0() {
|
|
695
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
696
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
697
|
+
}
|
|
698
|
+
return cachedUint8ArrayMemory0;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
function handleError(f, args) {
|
|
702
|
+
try {
|
|
703
|
+
return f.apply(this, args);
|
|
704
|
+
} catch (e) {
|
|
705
|
+
const idx = addToExternrefTable0(e);
|
|
706
|
+
wasm.__wbindgen_exn_store(idx);
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
function isLikeNone(x) {
|
|
711
|
+
return x === undefined || x === null;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
function makeMutClosure(arg0, arg1, f) {
|
|
715
|
+
const state = { a: arg0, b: arg1, cnt: 1 };
|
|
716
|
+
const real = (...args) => {
|
|
717
|
+
|
|
718
|
+
// First up with a closure we increment the internal reference
|
|
719
|
+
// count. This ensures that the Rust closure environment won't
|
|
720
|
+
// be deallocated while we're invoking it.
|
|
721
|
+
state.cnt++;
|
|
722
|
+
const a = state.a;
|
|
723
|
+
state.a = 0;
|
|
724
|
+
try {
|
|
725
|
+
return f(a, state.b, ...args);
|
|
726
|
+
} finally {
|
|
727
|
+
state.a = a;
|
|
728
|
+
real._wbg_cb_unref();
|
|
729
|
+
}
|
|
730
|
+
};
|
|
731
|
+
real._wbg_cb_unref = () => {
|
|
732
|
+
if (--state.cnt === 0) {
|
|
733
|
+
wasm.__wbindgen_destroy_closure(state.a, state.b);
|
|
734
|
+
state.a = 0;
|
|
735
|
+
CLOSURE_DTORS.unregister(state);
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
739
|
+
return real;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
743
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
744
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
745
|
+
WASM_VECTOR_LEN = arg.length;
|
|
746
|
+
return ptr;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
750
|
+
if (realloc === undefined) {
|
|
751
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
752
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
753
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
754
|
+
WASM_VECTOR_LEN = buf.length;
|
|
755
|
+
return ptr;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
let len = arg.length;
|
|
759
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
760
|
+
|
|
761
|
+
const mem = getUint8ArrayMemory0();
|
|
762
|
+
|
|
763
|
+
let offset = 0;
|
|
764
|
+
|
|
765
|
+
for (; offset < len; offset++) {
|
|
766
|
+
const code = arg.charCodeAt(offset);
|
|
767
|
+
if (code > 0x7F) break;
|
|
768
|
+
mem[ptr + offset] = code;
|
|
769
|
+
}
|
|
770
|
+
if (offset !== len) {
|
|
771
|
+
if (offset !== 0) {
|
|
772
|
+
arg = arg.slice(offset);
|
|
773
|
+
}
|
|
774
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
775
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
776
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
777
|
+
|
|
778
|
+
offset += ret.written;
|
|
779
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
WASM_VECTOR_LEN = offset;
|
|
783
|
+
return ptr;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
function takeFromExternrefTable0(idx) {
|
|
787
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
788
|
+
wasm.__externref_table_dealloc(idx);
|
|
789
|
+
return value;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
793
|
+
cachedTextDecoder.decode();
|
|
794
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
795
|
+
let numBytesDecoded = 0;
|
|
796
|
+
function decodeText(ptr, len) {
|
|
797
|
+
numBytesDecoded += len;
|
|
798
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
799
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
800
|
+
cachedTextDecoder.decode();
|
|
801
|
+
numBytesDecoded = len;
|
|
802
|
+
}
|
|
803
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
const cachedTextEncoder = new TextEncoder();
|
|
807
|
+
|
|
808
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
809
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
810
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
811
|
+
view.set(buf);
|
|
812
|
+
return {
|
|
813
|
+
read: arg.length,
|
|
814
|
+
written: buf.length
|
|
815
|
+
};
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
let WASM_VECTOR_LEN = 0;
|
|
820
|
+
|
|
821
|
+
|
|
822
|
+
let wasm;
|
|
823
|
+
export function __wbg_set_wasm(val) {
|
|
824
|
+
wasm = val;
|
|
825
|
+
}
|