@quillmark/wasm 0.67.0 → 0.69.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/node-esm/wasm.js DELETED
@@ -1,1477 +0,0 @@
1
- /* @ts-self-types="./wasm.d.ts" */
2
- import { readFileSync } from 'node:fs';
3
-
4
-
5
- /**
6
- * Typed in-memory Quillmark document.
7
- *
8
- * Created via `Document.fromMarkdown(markdown)`. Exposes:
9
- * - `quillRef` (string)
10
- * - `frontmatter` (JS object/Record)
11
- * - `body` (string)
12
- * - `cards` (array of Card objects)
13
- * - `warnings` (array of Diagnostic objects)
14
- *
15
- * `toMarkdown()` emits canonical Quillmark Markdown that round-trips back to
16
- * an equal `Document` by value and by type.
17
- */
18
- export class Document {
19
- static __wrap(ptr) {
20
- ptr = ptr >>> 0;
21
- const obj = Object.create(Document.prototype);
22
- obj.__wbg_ptr = ptr;
23
- DocumentFinalization.register(obj, obj.__wbg_ptr, obj);
24
- return obj;
25
- }
26
- __destroy_into_raw() {
27
- const ptr = this.__wbg_ptr;
28
- this.__wbg_ptr = 0;
29
- DocumentFinalization.unregister(this);
30
- return ptr;
31
- }
32
- free() {
33
- const ptr = this.__destroy_into_raw();
34
- wasm.__wbg_document_free(ptr, 0);
35
- }
36
- /**
37
- * Number of composable cards (excludes the main card).
38
- *
39
- * O(1). Use this to validate indices before calling card mutators
40
- * instead of allocating the full `cards` array.
41
- * @returns {number}
42
- */
43
- get cardCount() {
44
- const ret = wasm.document_cardCount(this.__wbg_ptr);
45
- return ret >>> 0;
46
- }
47
- /**
48
- * Ordered list of composable card blocks as typed `Card` objects.
49
- * @returns {Card[]}
50
- */
51
- get cards() {
52
- const ret = wasm.document_cards(this.__wbg_ptr);
53
- return takeObject(ret);
54
- }
55
- /**
56
- * Return a fresh `Document` handle with the same parse state.
57
- *
58
- * Mutations on the returned handle do not affect the original and
59
- * vice versa. Parse-time warnings are snapshotted alongside the
60
- * document — they describe the original parse, not the edit
61
- * history of either handle.
62
- * @returns {Document}
63
- */
64
- clone() {
65
- const ret = wasm.document_clone(this.__wbg_ptr);
66
- return Document.__wrap(ret);
67
- }
68
- /**
69
- * Structural equality against another `Document`.
70
- *
71
- * Compares `main` and `cards` by value (matching core's [`PartialEq`]).
72
- * Parse-time `warnings` are intentionally excluded — they describe the
73
- * source text, not the document's content.
74
- *
75
- * Use this to debounce upstream prop updates: keep the last parsed
76
- * `Document` and compare instead of re-parsing on every keystroke.
77
- * @param {Document} other
78
- * @returns {boolean}
79
- */
80
- equals(other) {
81
- _assertClass(other, Document);
82
- const ret = wasm.document_equals(this.__wbg_ptr, other.__wbg_ptr);
83
- return ret !== 0;
84
- }
85
- /**
86
- * Parse markdown into a typed Document.
87
- *
88
- * Returns the document with any parse-time warnings accessible via `.warnings`.
89
- * Throws on parse errors.
90
- * @param {string} markdown
91
- * @returns {Document}
92
- */
93
- static fromMarkdown(markdown) {
94
- try {
95
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
96
- const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
97
- const len0 = WASM_VECTOR_LEN;
98
- wasm.document_fromMarkdown(retptr, ptr0, len0);
99
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
100
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
101
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
102
- if (r2) {
103
- throw takeObject(r1);
104
- }
105
- return Document.__wrap(r0);
106
- } finally {
107
- wasm.__wbindgen_add_to_stack_pointer(16);
108
- }
109
- }
110
- /**
111
- * Insert a card at the given index.
112
- *
113
- * `index` must be in `0..=cards.length`. Out-of-range throws an `Error`.
114
- *
115
- * Mutators never modify `warnings`.
116
- * @param {number} index
117
- * @param {CardInput} card
118
- */
119
- insertCard(index, card) {
120
- try {
121
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
122
- wasm.document_insertCard(retptr, this.__wbg_ptr, index, addHeapObject(card));
123
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
124
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
125
- if (r1) {
126
- throw takeObject(r0);
127
- }
128
- } finally {
129
- wasm.__wbindgen_add_to_stack_pointer(16);
130
- }
131
- }
132
- /**
133
- * The document's main (entry) card.
134
- *
135
- * Carries the QUILL sentinel, the document-level frontmatter, and the
136
- * global body. Frontmatter/body reads and mutations go through this
137
- * handle — there are no document-level shortcuts after the rework.
138
- *
139
- * Allocates and serializes on each call — cache locally if read in a hot loop.
140
- * @returns {Card}
141
- */
142
- get main() {
143
- const ret = wasm.document_main(this.__wbg_ptr);
144
- return takeObject(ret);
145
- }
146
- /**
147
- * Move the card at `from` to position `to`.
148
- *
149
- * `from == to` is a no-op. Both indices must be in `0..cards.length`.
150
- * Out-of-range throws an `Error`.
151
- *
152
- * Mutators never modify `warnings`.
153
- * @param {number} from
154
- * @param {number} to
155
- */
156
- moveCard(from, to) {
157
- try {
158
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
159
- wasm.document_moveCard(retptr, this.__wbg_ptr, from, to);
160
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
161
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
162
- if (r1) {
163
- throw takeObject(r0);
164
- }
165
- } finally {
166
- wasm.__wbindgen_add_to_stack_pointer(16);
167
- }
168
- }
169
- /**
170
- * Append a card to the end of the card list.
171
- *
172
- * `card` must be a JS object with a `tag` string field and optional
173
- * `fields` (object) and `body` (string).
174
- *
175
- * Throws an `Error` if `card.tag` is not a valid tag name.
176
- *
177
- * Mutators never modify `warnings`.
178
- * @param {CardInput} card
179
- */
180
- pushCard(card) {
181
- try {
182
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
183
- wasm.document_pushCard(retptr, this.__wbg_ptr, addHeapObject(card));
184
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
185
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
186
- if (r1) {
187
- throw takeObject(r0);
188
- }
189
- } finally {
190
- wasm.__wbindgen_add_to_stack_pointer(16);
191
- }
192
- }
193
- /**
194
- * The QUILL reference string (e.g. `"usaf_memo@0.1"`).
195
- * @returns {string}
196
- */
197
- get quillRef() {
198
- let deferred1_0;
199
- let deferred1_1;
200
- try {
201
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
202
- wasm.document_quillRef(retptr, this.__wbg_ptr);
203
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
204
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
205
- deferred1_0 = r0;
206
- deferred1_1 = r1;
207
- return getStringFromWasm0(r0, r1);
208
- } finally {
209
- wasm.__wbindgen_add_to_stack_pointer(16);
210
- wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
211
- }
212
- }
213
- /**
214
- * Remove the card at `index` and return it, or `undefined` if out of range.
215
- *
216
- * Mutators never modify `warnings`.
217
- * @param {number} index
218
- * @returns {Card | undefined}
219
- */
220
- removeCard(index) {
221
- const ret = wasm.document_removeCard(this.__wbg_ptr, index);
222
- return takeObject(ret);
223
- }
224
- /**
225
- * Remove a frontmatter field on the card at `index`, returning the
226
- * removed value or `undefined` if the field was absent.
227
- *
228
- * Throws if `index` is out of range, `name` is reserved, or `name` does
229
- * not match `[a-z_][a-z0-9_]*`.
230
- *
231
- * Mutators never modify `warnings`.
232
- * @param {number} index
233
- * @param {string} name
234
- * @returns {any}
235
- */
236
- removeCardField(index, name) {
237
- try {
238
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
239
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
240
- const len0 = WASM_VECTOR_LEN;
241
- wasm.document_removeCardField(retptr, this.__wbg_ptr, index, ptr0, len0);
242
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
243
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
244
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
245
- if (r2) {
246
- throw takeObject(r1);
247
- }
248
- return takeObject(r0);
249
- } finally {
250
- wasm.__wbindgen_add_to_stack_pointer(16);
251
- }
252
- }
253
- /**
254
- * Remove a frontmatter field on the main card, returning the removed value or `undefined`.
255
- *
256
- * Throws an `Error` whose message includes the `EditError` variant name
257
- * and details if `name` is reserved (`BODY`, `CARDS`, `QUILL`, `CARD`)
258
- * or does not match `[a-z_][a-z0-9_]*`. Absence of an otherwise-valid
259
- * name returns `undefined`.
260
- *
261
- * Mutators never modify `warnings`.
262
- * @param {string} name
263
- * @returns {any}
264
- */
265
- removeField(name) {
266
- try {
267
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
268
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
269
- const len0 = WASM_VECTOR_LEN;
270
- wasm.document_removeField(retptr, this.__wbg_ptr, ptr0, len0);
271
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
272
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
273
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
274
- if (r2) {
275
- throw takeObject(r1);
276
- }
277
- return takeObject(r0);
278
- } finally {
279
- wasm.__wbindgen_add_to_stack_pointer(16);
280
- }
281
- }
282
- /**
283
- * Replace the main card's body (the global Markdown body).
284
- *
285
- * Mutators never modify `warnings`.
286
- * @param {string} body
287
- */
288
- replaceBody(body) {
289
- const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
290
- const len0 = WASM_VECTOR_LEN;
291
- wasm.document_replaceBody(this.__wbg_ptr, ptr0, len0);
292
- }
293
- /**
294
- * Replace the tag of the composable card at `index`.
295
- *
296
- * Mutates only the sentinel — the card's frontmatter and body are
297
- * untouched. Schema-aware migration (clearing orphan fields, applying
298
- * new defaults) is the caller's responsibility; `setCardTag` is a
299
- * structural primitive.
300
- *
301
- * Throws if `index` is out of range or if `newTag` does not match
302
- * `[a-z_][a-z0-9_]*`.
303
- *
304
- * Mutators never modify `warnings`.
305
- * @param {number} index
306
- * @param {string} new_tag
307
- */
308
- setCardTag(index, new_tag) {
309
- try {
310
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
311
- const ptr0 = passStringToWasm0(new_tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
312
- const len0 = WASM_VECTOR_LEN;
313
- wasm.document_setCardTag(retptr, this.__wbg_ptr, index, ptr0, len0);
314
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
315
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
316
- if (r1) {
317
- throw takeObject(r0);
318
- }
319
- } finally {
320
- wasm.__wbindgen_add_to_stack_pointer(16);
321
- }
322
- }
323
- /**
324
- * Update a frontmatter field on the main card.
325
- *
326
- * Convenience method: equivalent to `doc.mainMut().setField(name, value)`.
327
- * Clears any existing `!fill` marker on the field.
328
- *
329
- * Throws an `Error` whose message includes the `EditError` variant name and
330
- * details if `name` is reserved (`BODY`, `CARDS`, `QUILL`, `CARD`) or does
331
- * not match `[a-z_][a-z0-9_]*`.
332
- *
333
- * Mutators never modify `warnings`.
334
- * @param {string} name
335
- * @param {any} value
336
- */
337
- setField(name, value) {
338
- try {
339
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
340
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
341
- const len0 = WASM_VECTOR_LEN;
342
- wasm.document_setField(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(value));
343
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
344
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
345
- if (r1) {
346
- throw takeObject(r0);
347
- }
348
- } finally {
349
- wasm.__wbindgen_add_to_stack_pointer(16);
350
- }
351
- }
352
- /**
353
- * Update a frontmatter field on the main card AND mark it as `!fill`.
354
- *
355
- * Convenience method: equivalent to `doc.mainMut().setFill(name, value)`.
356
- *
357
- * Throws on invalid name (see [`setField`](Document::set_field)).
358
- *
359
- * Mutators never modify `warnings`.
360
- * @param {string} name
361
- * @param {any} value
362
- */
363
- setFill(name, value) {
364
- try {
365
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
366
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
367
- const len0 = WASM_VECTOR_LEN;
368
- wasm.document_setFill(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(value));
369
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
370
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
371
- if (r1) {
372
- throw takeObject(r0);
373
- }
374
- } finally {
375
- wasm.__wbindgen_add_to_stack_pointer(16);
376
- }
377
- }
378
- /**
379
- * Replace the QUILL reference string.
380
- *
381
- * Throws if `ref_str` is not a valid `QuillReference`.
382
- *
383
- * Mutators never modify `warnings`.
384
- * @param {string} ref_str
385
- */
386
- setQuillRef(ref_str) {
387
- try {
388
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
389
- const ptr0 = passStringToWasm0(ref_str, wasm.__wbindgen_export, wasm.__wbindgen_export2);
390
- const len0 = WASM_VECTOR_LEN;
391
- wasm.document_setQuillRef(retptr, this.__wbg_ptr, ptr0, len0);
392
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
393
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
394
- if (r1) {
395
- throw takeObject(r0);
396
- }
397
- } finally {
398
- wasm.__wbindgen_add_to_stack_pointer(16);
399
- }
400
- }
401
- /**
402
- * Emit canonical Quillmark Markdown.
403
- *
404
- * Returns the document serialised as a Quillmark Markdown string.
405
- * The output is type-fidelity round-trip safe: re-parsing the result
406
- * produces a `Document` equal to `self` by value and by type.
407
- * @returns {string}
408
- */
409
- toMarkdown() {
410
- let deferred1_0;
411
- let deferred1_1;
412
- try {
413
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
414
- wasm.document_toMarkdown(retptr, this.__wbg_ptr);
415
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
416
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
417
- deferred1_0 = r0;
418
- deferred1_1 = r1;
419
- return getStringFromWasm0(r0, r1);
420
- } finally {
421
- wasm.__wbindgen_add_to_stack_pointer(16);
422
- wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
423
- }
424
- }
425
- /**
426
- * Replace the body of the card at `index`.
427
- *
428
- * Throws if `index` is out of range.
429
- *
430
- * Mutators never modify `warnings`.
431
- * @param {number} index
432
- * @param {string} body
433
- */
434
- updateCardBody(index, body) {
435
- try {
436
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
437
- const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
438
- const len0 = WASM_VECTOR_LEN;
439
- wasm.document_updateCardBody(retptr, this.__wbg_ptr, index, ptr0, len0);
440
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
441
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
442
- if (r1) {
443
- throw takeObject(r0);
444
- }
445
- } finally {
446
- wasm.__wbindgen_add_to_stack_pointer(16);
447
- }
448
- }
449
- /**
450
- * Update a field on the card at `index`.
451
- *
452
- * Convenience method: equivalent to `doc.card_mut(index)?.set_field(name, value)`.
453
- *
454
- * Throws if `index` is out of range, `name` is reserved or invalid, or
455
- * `value` cannot be serialized.
456
- *
457
- * Mutators never modify `warnings`.
458
- * @param {number} index
459
- * @param {string} name
460
- * @param {any} value
461
- */
462
- updateCardField(index, name, value) {
463
- try {
464
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
465
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
466
- const len0 = WASM_VECTOR_LEN;
467
- wasm.document_updateCardField(retptr, this.__wbg_ptr, index, ptr0, len0, addHeapObject(value));
468
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
469
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
470
- if (r1) {
471
- throw takeObject(r0);
472
- }
473
- } finally {
474
- wasm.__wbindgen_add_to_stack_pointer(16);
475
- }
476
- }
477
- /**
478
- * Non-fatal parse-time warnings as an array of typed `Diagnostic` objects.
479
- * @returns {Diagnostic[]}
480
- */
481
- get warnings() {
482
- const ret = wasm.document_warnings(this.__wbg_ptr);
483
- return takeObject(ret);
484
- }
485
- }
486
- if (Symbol.dispose) Document.prototype[Symbol.dispose] = Document.prototype.free;
487
-
488
- /**
489
- * Opaque, shareable Quill handle.
490
- */
491
- export class Quill {
492
- static __wrap(ptr) {
493
- ptr = ptr >>> 0;
494
- const obj = Object.create(Quill.prototype);
495
- obj.__wbg_ptr = ptr;
496
- QuillFinalization.register(obj, obj.__wbg_ptr, obj);
497
- return obj;
498
- }
499
- __destroy_into_raw() {
500
- const ptr = this.__wbg_ptr;
501
- this.__wbg_ptr = 0;
502
- QuillFinalization.unregister(this);
503
- return ptr;
504
- }
505
- free() {
506
- const ptr = this.__destroy_into_raw();
507
- wasm.__wbg_quill_free(ptr, 0);
508
- }
509
- /**
510
- * The resolved backend identifier (e.g. `"typst"`).
511
- * @returns {string}
512
- */
513
- get backendId() {
514
- let deferred1_0;
515
- let deferred1_1;
516
- try {
517
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
518
- wasm.quill_backendId(retptr, this.__wbg_ptr);
519
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
520
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
521
- deferred1_0 = r0;
522
- deferred1_1 = r1;
523
- return getStringFromWasm0(r0, r1);
524
- } finally {
525
- wasm.__wbindgen_add_to_stack_pointer(16);
526
- wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
527
- }
528
- }
529
- /**
530
- * A blank form for a card of the given type — no document values supplied.
531
- *
532
- * Returns `null` if `cardType` is not declared in this quill's schema.
533
- * Otherwise returns a plain JS object shaped like a single entry in
534
- * [`Form::cards`].
535
- *
536
- * [`Form::cards`]: quillmark::form::Form::cards
537
- * @param {string} card_type
538
- * @returns {any}
539
- */
540
- blankCard(card_type) {
541
- try {
542
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
543
- const ptr0 = passStringToWasm0(card_type, wasm.__wbindgen_export, wasm.__wbindgen_export2);
544
- const len0 = WASM_VECTOR_LEN;
545
- wasm.quill_blankCard(retptr, this.__wbg_ptr, ptr0, len0);
546
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
547
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
548
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
549
- if (r2) {
550
- throw takeObject(r1);
551
- }
552
- return takeObject(r0);
553
- } finally {
554
- wasm.__wbindgen_add_to_stack_pointer(16);
555
- }
556
- }
557
- /**
558
- * A blank form for the main card — no document values supplied.
559
- *
560
- * Returns a plain JS object with the same shape as one entry in
561
- * [`Form::main`]. Every declared field's `source` is `"default"` (when
562
- * the schema declares a default) or `"missing"`.
563
- *
564
- * [`Form::main`]: quillmark::form::Form::main
565
- * @returns {any}
566
- */
567
- blankMain() {
568
- try {
569
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
570
- wasm.quill_blankMain(retptr, this.__wbg_ptr);
571
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
572
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
573
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
574
- if (r2) {
575
- throw takeObject(r1);
576
- }
577
- return takeObject(r0);
578
- } finally {
579
- wasm.__wbindgen_add_to_stack_pointer(16);
580
- }
581
- }
582
- /**
583
- * The schema-aware form view of `doc`.
584
- *
585
- * Returns a plain JS object (not a class) that is immediately
586
- * `JSON.stringify`-able. The shape mirrors [`Form`]:
587
- *
588
- * ```json
589
- * {
590
- * "main": { "schema": {...}, "values": { "field": {...} } },
591
- * "cards": [ ... ],
592
- * "diagnostics": [ ... ]
593
- * }
594
- * ```
595
- *
596
- * **Snapshot semantics.** This is a read-only snapshot of the document
597
- * at call time. Subsequent edits to `doc` require calling `form` again.
598
- *
599
- * [`Form`]: quillmark::form::Form
600
- * @param {Document} doc
601
- * @returns {any}
602
- */
603
- form(doc) {
604
- try {
605
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
606
- _assertClass(doc, Document);
607
- wasm.quill_form(retptr, this.__wbg_ptr, doc.__wbg_ptr);
608
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
609
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
610
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
611
- if (r2) {
612
- throw takeObject(r1);
613
- }
614
- return takeObject(r0);
615
- } finally {
616
- wasm.__wbindgen_add_to_stack_pointer(16);
617
- }
618
- }
619
- /**
620
- * Read-only snapshot of the loaded quill's engine info and declared schema.
621
- *
622
- * Returns a plain JS object with:
623
- * - `schema` — the quill's public schema contract, identical to
624
- * `QuillConfig::public_schema()`. Top-level keys: `name`, `main`,
625
- * optional `card_types` (map keyed by card name, omitted when empty),
626
- * optional `example`. `main` and each card under `card_types` share
627
- * the same shape: `fields` (map keyed by field name), optional
628
- * `title`, `description`, `ui`.
629
- * - `backend`, `version`, `author`, `description` — quill identity
630
- * declared in `Quill.yaml`'s `quill:` section. `description` describes
631
- * the quill itself; if the author also declared `main.description` (the
632
- * schema description of the entry-point card), it lives at
633
- * `schema.main.description` and is independent.
634
- * - `supportedFormats` — output formats the backend produces, as
635
- * lowercase strings.
636
- * - Any additional unstructured keys declared under `quill:`.
637
- *
638
- * Consumers that need validation run their own validator against
639
- * `metadata.schema`.
640
- *
641
- * Equivalent by value for the lifetime of the handle; the quill is
642
- * immutable once constructed.
643
- * @returns {any}
644
- */
645
- get metadata() {
646
- const ret = wasm.quill_metadata(this.__wbg_ptr);
647
- return takeObject(ret);
648
- }
649
- /**
650
- * Open an iterative render session for page-selective rendering.
651
- * @param {Document} doc
652
- * @returns {RenderSession}
653
- */
654
- open(doc) {
655
- try {
656
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
657
- _assertClass(doc, Document);
658
- wasm.quill_open(retptr, this.__wbg_ptr, doc.__wbg_ptr);
659
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
660
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
661
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
662
- if (r2) {
663
- throw takeObject(r1);
664
- }
665
- return RenderSession.__wrap(r0);
666
- } finally {
667
- wasm.__wbindgen_add_to_stack_pointer(16);
668
- }
669
- }
670
- /**
671
- * Render a document to final artifacts.
672
- * @param {Document} doc
673
- * @param {RenderOptions | null} [opts]
674
- * @returns {RenderResult}
675
- */
676
- render(doc, opts) {
677
- try {
678
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
679
- _assertClass(doc, Document);
680
- wasm.quill_render(retptr, this.__wbg_ptr, doc.__wbg_ptr, isLikeNone(opts) ? 0 : addHeapObject(opts));
681
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
682
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
683
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
684
- if (r2) {
685
- throw takeObject(r1);
686
- }
687
- return takeObject(r0);
688
- } finally {
689
- wasm.__wbindgen_add_to_stack_pointer(16);
690
- }
691
- }
692
- }
693
- if (Symbol.dispose) Quill.prototype[Symbol.dispose] = Quill.prototype.free;
694
-
695
- /**
696
- * Quillmark WASM Engine
697
- */
698
- export class Quillmark {
699
- __destroy_into_raw() {
700
- const ptr = this.__wbg_ptr;
701
- this.__wbg_ptr = 0;
702
- QuillmarkFinalization.unregister(this);
703
- return ptr;
704
- }
705
- free() {
706
- const ptr = this.__destroy_into_raw();
707
- wasm.__wbg_quillmark_free(ptr, 0);
708
- }
709
- /**
710
- * JavaScript constructor: `new Quillmark()`
711
- */
712
- constructor() {
713
- const ret = wasm.quillmark_new();
714
- this.__wbg_ptr = ret >>> 0;
715
- QuillmarkFinalization.register(this, this.__wbg_ptr, this);
716
- return this;
717
- }
718
- /**
719
- * Load a quill from a file tree and attach the appropriate backend.
720
- *
721
- * Accepts either a `Map<string, Uint8Array>` or a plain object
722
- * (`Record<string, Uint8Array>`). Plain objects are walked via
723
- * `Object.entries` at the boundary; the Rust side sees a single
724
- * canonical shape.
725
- * @param {Map<string, Uint8Array>} tree
726
- * @returns {Quill}
727
- */
728
- quill(tree) {
729
- try {
730
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
731
- wasm.quillmark_quill(retptr, this.__wbg_ptr, addHeapObject(tree));
732
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
733
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
734
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
735
- if (r2) {
736
- throw takeObject(r1);
737
- }
738
- return Quill.__wrap(r0);
739
- } finally {
740
- wasm.__wbindgen_add_to_stack_pointer(16);
741
- }
742
- }
743
- }
744
- if (Symbol.dispose) Quillmark.prototype[Symbol.dispose] = Quillmark.prototype.free;
745
-
746
- export class RenderSession {
747
- static __wrap(ptr) {
748
- ptr = ptr >>> 0;
749
- const obj = Object.create(RenderSession.prototype);
750
- obj.__wbg_ptr = ptr;
751
- RenderSessionFinalization.register(obj, obj.__wbg_ptr, obj);
752
- return obj;
753
- }
754
- __destroy_into_raw() {
755
- const ptr = this.__wbg_ptr;
756
- this.__wbg_ptr = 0;
757
- RenderSessionFinalization.unregister(this);
758
- return ptr;
759
- }
760
- free() {
761
- const ptr = this.__destroy_into_raw();
762
- wasm.__wbg_rendersession_free(ptr, 0);
763
- }
764
- /**
765
- * The backend that produced this session (e.g. `"typst"`).
766
- * @returns {string}
767
- */
768
- get backendId() {
769
- let deferred1_0;
770
- let deferred1_1;
771
- try {
772
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
773
- wasm.rendersession_backendId(retptr, this.__wbg_ptr);
774
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
775
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
776
- deferred1_0 = r0;
777
- deferred1_1 = r1;
778
- return getStringFromWasm0(r0, r1);
779
- } finally {
780
- wasm.__wbindgen_add_to_stack_pointer(16);
781
- wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
782
- }
783
- }
784
- /**
785
- * Number of pages in this render session.
786
- *
787
- * Stable for the lifetime of the session — the underlying compiled
788
- * document is an immutable snapshot.
789
- * @returns {number}
790
- */
791
- get pageCount() {
792
- const ret = wasm.rendersession_pageCount(this.__wbg_ptr);
793
- return ret >>> 0;
794
- }
795
- /**
796
- * Page dimensions in Typst points (1 pt = 1/72 inch).
797
- *
798
- * Stable for a given `page` across the session's lifetime — the
799
- * compiled document is an immutable snapshot, so callers can cache
800
- * results.
801
- *
802
- * Throws if the underlying backend has no canvas painter (i.e. is not
803
- * the Typst backend) or if `page` is out of range.
804
- * @param {number} page
805
- * @returns {PageSize}
806
- */
807
- pageSize(page) {
808
- try {
809
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
810
- wasm.rendersession_pageSize(retptr, this.__wbg_ptr, page);
811
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
812
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
813
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
814
- if (r2) {
815
- throw takeObject(r1);
816
- }
817
- return takeObject(r0);
818
- } finally {
819
- wasm.__wbindgen_add_to_stack_pointer(16);
820
- }
821
- }
822
- /**
823
- * Paint `page` into a 2D canvas context.
824
- *
825
- * `scale` multiplies Typst's natural 72 ppi (1 pt → 1 device pixel at
826
- * `scale = 1`). Typical usage:
827
- * `scale = (window.devicePixelRatio || 1) * userZoom`.
828
- *
829
- * The caller must size `ctx.canvas` so that
830
- * `canvas.width === round(widthPt * scale)` and `canvas.height ===
831
- * round(heightPt * scale)` *before* calling `paint`. Setting
832
- * `canvas.width` / `canvas.height` clears the backing store, which is
833
- * the recommended way to handle page-to-page transitions; if you
834
- * reuse a canvas without resizing, call
835
- * `ctx.clearRect(0, 0, canvas.width, canvas.height)` first to avoid
836
- * stale pixels showing through transparent regions.
837
- *
838
- * `paint` writes into the backing store at origin `(0, 0)` and does
839
- * not clear outside the rendered region.
840
- *
841
- * Throws if the backend does not support canvas preview (the message
842
- * includes the resolved `backendId` for debugging), or if `page` is
843
- * out of range.
844
- * @param {CanvasRenderingContext2D} ctx
845
- * @param {number} page
846
- * @param {number} scale
847
- */
848
- paint(ctx, page, scale) {
849
- try {
850
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
851
- wasm.rendersession_paint(retptr, this.__wbg_ptr, addBorrowedObject(ctx), page, scale);
852
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
853
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
854
- if (r1) {
855
- throw takeObject(r0);
856
- }
857
- } finally {
858
- wasm.__wbindgen_add_to_stack_pointer(16);
859
- heap[stack_pointer++] = undefined;
860
- }
861
- }
862
- /**
863
- * Render all or selected pages from this session.
864
- * @param {RenderOptions | null} [opts]
865
- * @returns {RenderResult}
866
- */
867
- render(opts) {
868
- try {
869
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
870
- wasm.rendersession_render(retptr, this.__wbg_ptr, isLikeNone(opts) ? 0 : addHeapObject(opts));
871
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
872
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
873
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
874
- if (r2) {
875
- throw takeObject(r1);
876
- }
877
- return takeObject(r0);
878
- } finally {
879
- wasm.__wbindgen_add_to_stack_pointer(16);
880
- }
881
- }
882
- /**
883
- * Session-level warnings attached at `quill.open(...)` time.
884
- *
885
- * Snapshot of any non-fatal diagnostics emitted while opening the
886
- * session (e.g. version compatibility shims). Stable across the
887
- * session's lifetime. These are also appended to
888
- * [`RenderResult.warnings`] on every `render()` call; the accessor
889
- * surfaces them to canvas-preview consumers that don't go through
890
- * `render()`.
891
- * @returns {Diagnostic[]}
892
- */
893
- get warnings() {
894
- const ret = wasm.rendersession_warnings(this.__wbg_ptr);
895
- return takeObject(ret);
896
- }
897
- }
898
- if (Symbol.dispose) RenderSession.prototype[Symbol.dispose] = RenderSession.prototype.free;
899
-
900
- /**
901
- * Initialize the WASM module with panic hooks for better error messages
902
- */
903
- export function init() {
904
- wasm.init();
905
- }
906
- function __wbg_get_imports() {
907
- const import0 = {
908
- __proto__: null,
909
- __wbg_Error_960c155d3d49e4c2: function(arg0, arg1) {
910
- const ret = Error(getStringFromWasm0(arg0, arg1));
911
- return addHeapObject(ret);
912
- },
913
- __wbg_Number_32bf70a599af1d4b: function(arg0) {
914
- const ret = Number(getObject(arg0));
915
- return ret;
916
- },
917
- __wbg_String_8564e559799eccda: function(arg0, arg1) {
918
- const ret = String(getObject(arg1));
919
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
920
- const len1 = WASM_VECTOR_LEN;
921
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
922
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
923
- },
924
- __wbg_String_b51de6b05a10845b: function(arg0, arg1) {
925
- const ret = String(getObject(arg1));
926
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
927
- const len1 = WASM_VECTOR_LEN;
928
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
929
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
930
- },
931
- __wbg___wbindgen_bigint_get_as_i64_3d3aba5d616c6a51: function(arg0, arg1) {
932
- const v = getObject(arg1);
933
- const ret = typeof(v) === 'bigint' ? v : undefined;
934
- getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
935
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
936
- },
937
- __wbg___wbindgen_boolean_get_6ea149f0a8dcc5ff: function(arg0) {
938
- const v = getObject(arg0);
939
- const ret = typeof(v) === 'boolean' ? v : undefined;
940
- return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
941
- },
942
- __wbg___wbindgen_debug_string_ab4b34d23d6778bd: function(arg0, arg1) {
943
- const ret = debugString(getObject(arg1));
944
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
945
- const len1 = WASM_VECTOR_LEN;
946
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
947
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
948
- },
949
- __wbg___wbindgen_in_a5d8b22e52b24dd1: function(arg0, arg1) {
950
- const ret = getObject(arg0) in getObject(arg1);
951
- return ret;
952
- },
953
- __wbg___wbindgen_is_bigint_ec25c7f91b4d9e93: function(arg0) {
954
- const ret = typeof(getObject(arg0)) === 'bigint';
955
- return ret;
956
- },
957
- __wbg___wbindgen_is_function_3baa9db1a987f47d: function(arg0) {
958
- const ret = typeof(getObject(arg0)) === 'function';
959
- return ret;
960
- },
961
- __wbg___wbindgen_is_null_52ff4ec04186736f: function(arg0) {
962
- const ret = getObject(arg0) === null;
963
- return ret;
964
- },
965
- __wbg___wbindgen_is_object_63322ec0cd6ea4ef: function(arg0) {
966
- const val = getObject(arg0);
967
- const ret = typeof(val) === 'object' && val !== null;
968
- return ret;
969
- },
970
- __wbg___wbindgen_is_string_6df3bf7ef1164ed3: function(arg0) {
971
- const ret = typeof(getObject(arg0)) === 'string';
972
- return ret;
973
- },
974
- __wbg___wbindgen_is_undefined_29a43b4d42920abd: function(arg0) {
975
- const ret = getObject(arg0) === undefined;
976
- return ret;
977
- },
978
- __wbg___wbindgen_jsval_eq_d3465d8a07697228: function(arg0, arg1) {
979
- const ret = getObject(arg0) === getObject(arg1);
980
- return ret;
981
- },
982
- __wbg___wbindgen_jsval_loose_eq_cac3565e89b4134c: function(arg0, arg1) {
983
- const ret = getObject(arg0) == getObject(arg1);
984
- return ret;
985
- },
986
- __wbg___wbindgen_number_get_c7f42aed0525c451: function(arg0, arg1) {
987
- const obj = getObject(arg1);
988
- const ret = typeof(obj) === 'number' ? obj : undefined;
989
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
990
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
991
- },
992
- __wbg___wbindgen_string_get_7ed5322991caaec5: function(arg0, arg1) {
993
- const obj = getObject(arg1);
994
- const ret = typeof(obj) === 'string' ? obj : undefined;
995
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
996
- var len1 = WASM_VECTOR_LEN;
997
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
998
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
999
- },
1000
- __wbg___wbindgen_throw_6b64449b9b9ed33c: function(arg0, arg1) {
1001
- throw new Error(getStringFromWasm0(arg0, arg1));
1002
- },
1003
- __wbg_call_14b169f759b26747: function() { return handleError(function (arg0, arg1) {
1004
- const ret = getObject(arg0).call(getObject(arg1));
1005
- return addHeapObject(ret);
1006
- }, arguments); },
1007
- __wbg_done_9158f7cc8751ba32: function(arg0) {
1008
- const ret = getObject(arg0).done;
1009
- return ret;
1010
- },
1011
- __wbg_entries_2bf997cf82353e47: function(arg0) {
1012
- const ret = getObject(arg0).entries();
1013
- return addHeapObject(ret);
1014
- },
1015
- __wbg_entries_e0b73aa8571ddb56: function(arg0) {
1016
- const ret = Object.entries(getObject(arg0));
1017
- return addHeapObject(ret);
1018
- },
1019
- __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
1020
- let deferred0_0;
1021
- let deferred0_1;
1022
- try {
1023
- deferred0_0 = arg0;
1024
- deferred0_1 = arg1;
1025
- console.error(getStringFromWasm0(arg0, arg1));
1026
- } finally {
1027
- wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
1028
- }
1029
- },
1030
- __wbg_from_0dbf29f09e7fb200: function(arg0) {
1031
- const ret = Array.from(getObject(arg0));
1032
- return addHeapObject(ret);
1033
- },
1034
- __wbg_getRandomValues_3f44b700395062e5: function() { return handleError(function (arg0, arg1) {
1035
- globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
1036
- }, arguments); },
1037
- __wbg_getTime_da7c55f52b71e8c6: function(arg0) {
1038
- const ret = getObject(arg0).getTime();
1039
- return ret;
1040
- },
1041
- __wbg_getUTCDate_5cd8b68e971333f7: function(arg0) {
1042
- const ret = getObject(arg0).getUTCDate();
1043
- return ret;
1044
- },
1045
- __wbg_getUTCFullYear_f3b3950a0ccb9165: function(arg0) {
1046
- const ret = getObject(arg0).getUTCFullYear();
1047
- return ret;
1048
- },
1049
- __wbg_getUTCMonth_62fa72a7522ef806: function(arg0) {
1050
- const ret = getObject(arg0).getUTCMonth();
1051
- return ret;
1052
- },
1053
- __wbg_get_1affdbdd5573b16a: function() { return handleError(function (arg0, arg1) {
1054
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
1055
- return addHeapObject(ret);
1056
- }, arguments); },
1057
- __wbg_get_8360291721e2339f: function(arg0, arg1) {
1058
- const ret = getObject(arg0)[arg1 >>> 0];
1059
- return addHeapObject(ret);
1060
- },
1061
- __wbg_get_unchecked_17f53dad852b9588: function(arg0, arg1) {
1062
- const ret = getObject(arg0)[arg1 >>> 0];
1063
- return addHeapObject(ret);
1064
- },
1065
- __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
1066
- const ret = getObject(arg0)[getObject(arg1)];
1067
- return addHeapObject(ret);
1068
- },
1069
- __wbg_get_with_ref_key_f64427178466f623: function(arg0, arg1) {
1070
- const ret = getObject(arg0)[getObject(arg1)];
1071
- return addHeapObject(ret);
1072
- },
1073
- __wbg_instanceof_ArrayBuffer_7c8433c6ed14ffe3: function(arg0) {
1074
- let result;
1075
- try {
1076
- result = getObject(arg0) instanceof ArrayBuffer;
1077
- } catch (_) {
1078
- result = false;
1079
- }
1080
- const ret = result;
1081
- return ret;
1082
- },
1083
- __wbg_instanceof_Map_1b76fd4635be43eb: function(arg0) {
1084
- let result;
1085
- try {
1086
- result = getObject(arg0) instanceof Map;
1087
- } catch (_) {
1088
- result = false;
1089
- }
1090
- const ret = result;
1091
- return ret;
1092
- },
1093
- __wbg_instanceof_Uint8Array_152ba1f289edcf3f: function(arg0) {
1094
- let result;
1095
- try {
1096
- result = getObject(arg0) instanceof Uint8Array;
1097
- } catch (_) {
1098
- result = false;
1099
- }
1100
- const ret = result;
1101
- return ret;
1102
- },
1103
- __wbg_isArray_c3109d14ffc06469: function(arg0) {
1104
- const ret = Array.isArray(getObject(arg0));
1105
- return ret;
1106
- },
1107
- __wbg_isSafeInteger_4fc213d1989d6d2a: function(arg0) {
1108
- const ret = Number.isSafeInteger(getObject(arg0));
1109
- return ret;
1110
- },
1111
- __wbg_iterator_013bc09ec998c2a7: function() {
1112
- const ret = Symbol.iterator;
1113
- return addHeapObject(ret);
1114
- },
1115
- __wbg_length_3d4ecd04bd8d22f1: function(arg0) {
1116
- const ret = getObject(arg0).length;
1117
- return ret;
1118
- },
1119
- __wbg_length_9f1775224cf1d815: function(arg0) {
1120
- const ret = getObject(arg0).length;
1121
- return ret;
1122
- },
1123
- __wbg_new_0_4d657201ced14de3: function() {
1124
- const ret = new Date();
1125
- return addHeapObject(ret);
1126
- },
1127
- __wbg_new_0c7403db6e782f19: function(arg0) {
1128
- const ret = new Uint8Array(getObject(arg0));
1129
- return addHeapObject(ret);
1130
- },
1131
- __wbg_new_227d7c05414eb861: function() {
1132
- const ret = new Error();
1133
- return addHeapObject(ret);
1134
- },
1135
- __wbg_new_34d45cc8e36aaead: function() {
1136
- const ret = new Map();
1137
- return addHeapObject(ret);
1138
- },
1139
- __wbg_new_5e360d2ff7b9e1c3: function(arg0, arg1) {
1140
- const ret = new Error(getStringFromWasm0(arg0, arg1));
1141
- return addHeapObject(ret);
1142
- },
1143
- __wbg_new_682678e2f47e32bc: function() {
1144
- const ret = new Array();
1145
- return addHeapObject(ret);
1146
- },
1147
- __wbg_new_7913666fe5070684: function(arg0) {
1148
- const ret = new Date(getObject(arg0));
1149
- return addHeapObject(ret);
1150
- },
1151
- __wbg_new_aa8d0fa9762c29bd: function() {
1152
- const ret = new Object();
1153
- return addHeapObject(ret);
1154
- },
1155
- __wbg_new_with_u8_clamped_array_and_sh_fe957411824b5158: function() { return handleError(function (arg0, arg1, arg2, arg3) {
1156
- const ret = new ImageData(getClampedArrayU8FromWasm0(arg0, arg1), arg2 >>> 0, arg3 >>> 0);
1157
- return addHeapObject(ret);
1158
- }, arguments); },
1159
- __wbg_next_0340c4ae324393c3: function() { return handleError(function (arg0) {
1160
- const ret = getObject(arg0).next();
1161
- return addHeapObject(ret);
1162
- }, arguments); },
1163
- __wbg_next_7646edaa39458ef7: function(arg0) {
1164
- const ret = getObject(arg0).next;
1165
- return addHeapObject(ret);
1166
- },
1167
- __wbg_now_a9b7df1cbee90986: function() {
1168
- const ret = Date.now();
1169
- return ret;
1170
- },
1171
- __wbg_prototypesetcall_a6b02eb00b0f4ce2: function(arg0, arg1, arg2) {
1172
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
1173
- },
1174
- __wbg_putImageData_c810e62ea70e761d: function() { return handleError(function (arg0, arg1, arg2, arg3) {
1175
- getObject(arg0).putImageData(getObject(arg1), arg2, arg3);
1176
- }, arguments); },
1177
- __wbg_set_022bee52d0b05b19: function() { return handleError(function (arg0, arg1, arg2) {
1178
- const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
1179
- return ret;
1180
- }, arguments); },
1181
- __wbg_set_3bf1de9fab0cd644: function(arg0, arg1, arg2) {
1182
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1183
- },
1184
- __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
1185
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1186
- },
1187
- __wbg_set_f071dbb3bd088e0e: function(arg0, arg1, arg2) {
1188
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1189
- },
1190
- __wbg_set_fde2cec06c23692b: function(arg0, arg1, arg2) {
1191
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
1192
- return addHeapObject(ret);
1193
- },
1194
- __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
1195
- const ret = getObject(arg1).stack;
1196
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1197
- const len1 = WASM_VECTOR_LEN;
1198
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1199
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1200
- },
1201
- __wbg_value_ee3a06f4579184fa: function(arg0) {
1202
- const ret = getObject(arg0).value;
1203
- return addHeapObject(ret);
1204
- },
1205
- __wbindgen_cast_0000000000000001: function(arg0) {
1206
- // Cast intrinsic for `F64 -> Externref`.
1207
- const ret = arg0;
1208
- return addHeapObject(ret);
1209
- },
1210
- __wbindgen_cast_0000000000000002: function(arg0) {
1211
- // Cast intrinsic for `I64 -> Externref`.
1212
- const ret = arg0;
1213
- return addHeapObject(ret);
1214
- },
1215
- __wbindgen_cast_0000000000000003: function(arg0, arg1) {
1216
- // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
1217
- const ret = getArrayU8FromWasm0(arg0, arg1);
1218
- return addHeapObject(ret);
1219
- },
1220
- __wbindgen_cast_0000000000000004: function(arg0, arg1) {
1221
- // Cast intrinsic for `Ref(String) -> Externref`.
1222
- const ret = getStringFromWasm0(arg0, arg1);
1223
- return addHeapObject(ret);
1224
- },
1225
- __wbindgen_cast_0000000000000005: function(arg0) {
1226
- // Cast intrinsic for `U64 -> Externref`.
1227
- const ret = BigInt.asUintN(64, arg0);
1228
- return addHeapObject(ret);
1229
- },
1230
- __wbindgen_object_clone_ref: function(arg0) {
1231
- const ret = getObject(arg0);
1232
- return addHeapObject(ret);
1233
- },
1234
- __wbindgen_object_drop_ref: function(arg0) {
1235
- takeObject(arg0);
1236
- },
1237
- };
1238
- return {
1239
- __proto__: null,
1240
- "./wasm_bg.js": import0,
1241
- };
1242
- }
1243
-
1244
- const DocumentFinalization = (typeof FinalizationRegistry === 'undefined')
1245
- ? { register: () => {}, unregister: () => {} }
1246
- : new FinalizationRegistry(ptr => wasm.__wbg_document_free(ptr >>> 0, 1));
1247
- const QuillFinalization = (typeof FinalizationRegistry === 'undefined')
1248
- ? { register: () => {}, unregister: () => {} }
1249
- : new FinalizationRegistry(ptr => wasm.__wbg_quill_free(ptr >>> 0, 1));
1250
- const QuillmarkFinalization = (typeof FinalizationRegistry === 'undefined')
1251
- ? { register: () => {}, unregister: () => {} }
1252
- : new FinalizationRegistry(ptr => wasm.__wbg_quillmark_free(ptr >>> 0, 1));
1253
- const RenderSessionFinalization = (typeof FinalizationRegistry === 'undefined')
1254
- ? { register: () => {}, unregister: () => {} }
1255
- : new FinalizationRegistry(ptr => wasm.__wbg_rendersession_free(ptr >>> 0, 1));
1256
-
1257
- function addHeapObject(obj) {
1258
- if (heap_next === heap.length) heap.push(heap.length + 1);
1259
- const idx = heap_next;
1260
- heap_next = heap[idx];
1261
-
1262
- heap[idx] = obj;
1263
- return idx;
1264
- }
1265
-
1266
- function _assertClass(instance, klass) {
1267
- if (!(instance instanceof klass)) {
1268
- throw new Error(`expected instance of ${klass.name}`);
1269
- }
1270
- }
1271
-
1272
- function addBorrowedObject(obj) {
1273
- if (stack_pointer == 1) throw new Error('out of js stack');
1274
- heap[--stack_pointer] = obj;
1275
- return stack_pointer;
1276
- }
1277
-
1278
- function debugString(val) {
1279
- // primitive types
1280
- const type = typeof val;
1281
- if (type == 'number' || type == 'boolean' || val == null) {
1282
- return `${val}`;
1283
- }
1284
- if (type == 'string') {
1285
- return `"${val}"`;
1286
- }
1287
- if (type == 'symbol') {
1288
- const description = val.description;
1289
- if (description == null) {
1290
- return 'Symbol';
1291
- } else {
1292
- return `Symbol(${description})`;
1293
- }
1294
- }
1295
- if (type == 'function') {
1296
- const name = val.name;
1297
- if (typeof name == 'string' && name.length > 0) {
1298
- return `Function(${name})`;
1299
- } else {
1300
- return 'Function';
1301
- }
1302
- }
1303
- // objects
1304
- if (Array.isArray(val)) {
1305
- const length = val.length;
1306
- let debug = '[';
1307
- if (length > 0) {
1308
- debug += debugString(val[0]);
1309
- }
1310
- for(let i = 1; i < length; i++) {
1311
- debug += ', ' + debugString(val[i]);
1312
- }
1313
- debug += ']';
1314
- return debug;
1315
- }
1316
- // Test for built-in
1317
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1318
- let className;
1319
- if (builtInMatches && builtInMatches.length > 1) {
1320
- className = builtInMatches[1];
1321
- } else {
1322
- // Failed to match the standard '[object ClassName]'
1323
- return toString.call(val);
1324
- }
1325
- if (className == 'Object') {
1326
- // we're a user defined class or Object
1327
- // JSON.stringify avoids problems with cycles, and is generally much
1328
- // easier than looping through ownProperties of `val`.
1329
- try {
1330
- return 'Object(' + JSON.stringify(val) + ')';
1331
- } catch (_) {
1332
- return 'Object';
1333
- }
1334
- }
1335
- // errors
1336
- if (val instanceof Error) {
1337
- return `${val.name}: ${val.message}\n${val.stack}`;
1338
- }
1339
- // TODO we could test for more things here, like `Set`s and `Map`s.
1340
- return className;
1341
- }
1342
-
1343
- function dropObject(idx) {
1344
- if (idx < 1028) return;
1345
- heap[idx] = heap_next;
1346
- heap_next = idx;
1347
- }
1348
-
1349
- function getArrayU8FromWasm0(ptr, len) {
1350
- ptr = ptr >>> 0;
1351
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1352
- }
1353
-
1354
- function getClampedArrayU8FromWasm0(ptr, len) {
1355
- ptr = ptr >>> 0;
1356
- return getUint8ClampedArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1357
- }
1358
-
1359
- let cachedDataViewMemory0 = null;
1360
- function getDataViewMemory0() {
1361
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1362
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1363
- }
1364
- return cachedDataViewMemory0;
1365
- }
1366
-
1367
- function getStringFromWasm0(ptr, len) {
1368
- ptr = ptr >>> 0;
1369
- return decodeText(ptr, len);
1370
- }
1371
-
1372
- let cachedUint8ArrayMemory0 = null;
1373
- function getUint8ArrayMemory0() {
1374
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1375
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1376
- }
1377
- return cachedUint8ArrayMemory0;
1378
- }
1379
-
1380
- let cachedUint8ClampedArrayMemory0 = null;
1381
- function getUint8ClampedArrayMemory0() {
1382
- if (cachedUint8ClampedArrayMemory0 === null || cachedUint8ClampedArrayMemory0.byteLength === 0) {
1383
- cachedUint8ClampedArrayMemory0 = new Uint8ClampedArray(wasm.memory.buffer);
1384
- }
1385
- return cachedUint8ClampedArrayMemory0;
1386
- }
1387
-
1388
- function getObject(idx) { return heap[idx]; }
1389
-
1390
- function handleError(f, args) {
1391
- try {
1392
- return f.apply(this, args);
1393
- } catch (e) {
1394
- wasm.__wbindgen_export3(addHeapObject(e));
1395
- }
1396
- }
1397
-
1398
- let heap = new Array(1024).fill(undefined);
1399
- heap.push(undefined, null, true, false);
1400
-
1401
- let heap_next = heap.length;
1402
-
1403
- function isLikeNone(x) {
1404
- return x === undefined || x === null;
1405
- }
1406
-
1407
- function passStringToWasm0(arg, malloc, realloc) {
1408
- if (realloc === undefined) {
1409
- const buf = cachedTextEncoder.encode(arg);
1410
- const ptr = malloc(buf.length, 1) >>> 0;
1411
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1412
- WASM_VECTOR_LEN = buf.length;
1413
- return ptr;
1414
- }
1415
-
1416
- let len = arg.length;
1417
- let ptr = malloc(len, 1) >>> 0;
1418
-
1419
- const mem = getUint8ArrayMemory0();
1420
-
1421
- let offset = 0;
1422
-
1423
- for (; offset < len; offset++) {
1424
- const code = arg.charCodeAt(offset);
1425
- if (code > 0x7F) break;
1426
- mem[ptr + offset] = code;
1427
- }
1428
- if (offset !== len) {
1429
- if (offset !== 0) {
1430
- arg = arg.slice(offset);
1431
- }
1432
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1433
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1434
- const ret = cachedTextEncoder.encodeInto(arg, view);
1435
-
1436
- offset += ret.written;
1437
- ptr = realloc(ptr, len, offset, 1) >>> 0;
1438
- }
1439
-
1440
- WASM_VECTOR_LEN = offset;
1441
- return ptr;
1442
- }
1443
-
1444
- let stack_pointer = 1024;
1445
-
1446
- function takeObject(idx) {
1447
- const ret = getObject(idx);
1448
- dropObject(idx);
1449
- return ret;
1450
- }
1451
-
1452
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1453
- cachedTextDecoder.decode();
1454
- function decodeText(ptr, len) {
1455
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1456
- }
1457
-
1458
- const cachedTextEncoder = new TextEncoder();
1459
-
1460
- if (!('encodeInto' in cachedTextEncoder)) {
1461
- cachedTextEncoder.encodeInto = function (arg, view) {
1462
- const buf = cachedTextEncoder.encode(arg);
1463
- view.set(buf);
1464
- return {
1465
- read: arg.length,
1466
- written: buf.length
1467
- };
1468
- };
1469
- }
1470
-
1471
- let WASM_VECTOR_LEN = 0;
1472
-
1473
- const wasmUrl = new URL('wasm_bg.wasm', import.meta.url);
1474
- const wasmBytes = readFileSync(wasmUrl);
1475
- const wasmModule = new WebAssembly.Module(wasmBytes);
1476
- let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
1477
- wasm.__wbindgen_start();