@quillmark/wasm 0.88.0 → 0.90.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.
@@ -0,0 +1,1496 @@
1
+ /**
2
+ * Typed in-memory Quillmark document.
3
+ */
4
+ export class Document {
5
+ static __wrap(ptr) {
6
+ ptr = ptr >>> 0;
7
+ const obj = Object.create(Document.prototype);
8
+ obj.__wbg_ptr = ptr;
9
+ DocumentFinalization.register(obj, obj.__wbg_ptr, obj);
10
+ return obj;
11
+ }
12
+ __destroy_into_raw() {
13
+ const ptr = this.__wbg_ptr;
14
+ this.__wbg_ptr = 0;
15
+ DocumentFinalization.unregister(this);
16
+ return ptr;
17
+ }
18
+ free() {
19
+ const ptr = this.__destroy_into_raw();
20
+ wasm.__wbg_document_free(ptr, 0);
21
+ }
22
+ /**
23
+ * Authoring-ergonomics header introducing a blueprint to an LLM/MCP
24
+ * consumer for the given `quillName`. Surfaced verbatim by every binding
25
+ * so the wording stays uniform across CLI / Python / MCP.
26
+ * @param {string} quill_name
27
+ * @returns {string}
28
+ */
29
+ static blueprintInstruction(quill_name) {
30
+ let deferred2_0;
31
+ let deferred2_1;
32
+ try {
33
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
34
+ const ptr0 = passStringToWasm0(quill_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
35
+ const len0 = WASM_VECTOR_LEN;
36
+ wasm.document_blueprintInstruction(retptr, ptr0, len0);
37
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
38
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
39
+ deferred2_0 = r0;
40
+ deferred2_1 = r1;
41
+ return getStringFromWasm0(r0, r1);
42
+ } finally {
43
+ wasm.__wbindgen_add_to_stack_pointer(16);
44
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
45
+ }
46
+ }
47
+ /**
48
+ * Number of composable cards (excludes the main card). O(1).
49
+ * @returns {number}
50
+ */
51
+ get cardCount() {
52
+ const ret = wasm.document_cardCount(this.__wbg_ptr);
53
+ return ret >>> 0;
54
+ }
55
+ /**
56
+ * @returns {Card[]}
57
+ */
58
+ get cards() {
59
+ const ret = wasm.document_cards(this.__wbg_ptr);
60
+ return takeObject(ret);
61
+ }
62
+ /**
63
+ * @returns {Document}
64
+ */
65
+ clone() {
66
+ const ret = wasm.document_clone(this.__wbg_ptr);
67
+ return Document.__wrap(ret);
68
+ }
69
+ /**
70
+ * Schema version this build writes via [`toJson`](Document::to_json).
71
+ * Tracks the `Document` model version (not the running crate version):
72
+ * the tag advances only when the wire format changes, not on every release.
73
+ * @returns {string}
74
+ */
75
+ static currentSchemaVersion() {
76
+ let deferred1_0;
77
+ let deferred1_1;
78
+ try {
79
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
80
+ wasm.document_currentSchemaVersion(retptr);
81
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
82
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
83
+ deferred1_0 = r0;
84
+ deferred1_1 = r1;
85
+ return getStringFromWasm0(r0, r1);
86
+ } finally {
87
+ wasm.__wbindgen_add_to_stack_pointer(16);
88
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
89
+ }
90
+ }
91
+ /**
92
+ * Structural equality (parse-time `warnings` excluded). Use to debounce
93
+ * upstream prop updates instead of re-parsing on every keystroke.
94
+ * @param {Document} other
95
+ * @returns {boolean}
96
+ */
97
+ equals(other) {
98
+ _assertClass(other, Document);
99
+ const ret = wasm.document_equals(this.__wbg_ptr, other.__wbg_ptr);
100
+ return ret !== 0;
101
+ }
102
+ /**
103
+ * Render a Diagnostic as the canonical pretty-printed text every binding
104
+ * shows (CLI, Python, MCP). Single source of truth so a Diagnostic looks
105
+ * identical no matter which consumer surfaces it.
106
+ * @param {Diagnostic} diag
107
+ * @returns {string}
108
+ */
109
+ static formatDiagnostic(diag) {
110
+ let deferred1_0;
111
+ let deferred1_1;
112
+ try {
113
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
114
+ wasm.document_formatDiagnostic(retptr, addHeapObject(diag));
115
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
116
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
117
+ deferred1_0 = r0;
118
+ deferred1_1 = r1;
119
+ return getStringFromWasm0(r0, r1);
120
+ } finally {
121
+ wasm.__wbindgen_add_to_stack_pointer(16);
122
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
123
+ }
124
+ }
125
+ /**
126
+ * Authoring-format rules for the card-yaml markdown surface — the same
127
+ * text every binding (CLI, Python, MCP) shows so callers reading errors
128
+ * from one binding can use the rules from any other. Read once at
129
+ * startup and cache; the value never changes between calls.
130
+ * @returns {string}
131
+ */
132
+ static formatRules() {
133
+ let deferred1_0;
134
+ let deferred1_1;
135
+ try {
136
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
137
+ wasm.document_formatRules(retptr);
138
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
139
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
140
+ deferred1_0 = r0;
141
+ deferred1_1 = r1;
142
+ return getStringFromWasm0(r0, r1);
143
+ } finally {
144
+ wasm.__wbindgen_add_to_stack_pointer(16);
145
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
146
+ }
147
+ }
148
+ /**
149
+ * Reconstruct a `Document` from a versioned storage DTO string produced
150
+ * by [`toJson`](Document::to_json). Unknown `schema` tags are rejected.
151
+ * The result carries no parse-time warnings (`.warnings` is always empty).
152
+ *
153
+ * Throws if `json` is not a valid storage DTO (malformed JSON, unknown
154
+ * `schema`, missing fields, or unparseable quill reference).
155
+ * @param {string} json
156
+ * @returns {Document}
157
+ */
158
+ static fromJson(json) {
159
+ try {
160
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
161
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
162
+ const len0 = WASM_VECTOR_LEN;
163
+ wasm.document_fromJson(retptr, ptr0, len0);
164
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
165
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
166
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
167
+ if (r2) {
168
+ throw takeObject(r1);
169
+ }
170
+ return Document.__wrap(r0);
171
+ } finally {
172
+ wasm.__wbindgen_add_to_stack_pointer(16);
173
+ }
174
+ }
175
+ /**
176
+ * Parse markdown into a typed Document. Throws on parse errors.
177
+ * @param {string} markdown
178
+ * @returns {Document}
179
+ */
180
+ static fromMarkdown(markdown) {
181
+ try {
182
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
183
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
184
+ const len0 = WASM_VECTOR_LEN;
185
+ wasm.document_fromMarkdown(retptr, ptr0, len0);
186
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
187
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
188
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
189
+ if (r2) {
190
+ throw takeObject(r1);
191
+ }
192
+ return Document.__wrap(r0);
193
+ } finally {
194
+ wasm.__wbindgen_add_to_stack_pointer(16);
195
+ }
196
+ }
197
+ /**
198
+ * Insert a card at `index` (must be in `0..=cards.length`). Accepts a
199
+ * `Card` (see [`pushCard`](Self::push_card)).
200
+ * @param {number} index
201
+ * @param {Card} card
202
+ */
203
+ insertCard(index, card) {
204
+ try {
205
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
206
+ wasm.document_insertCard(retptr, this.__wbg_ptr, index, addHeapObject(card));
207
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
208
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
209
+ if (r1) {
210
+ throw takeObject(r0);
211
+ }
212
+ } finally {
213
+ wasm.__wbindgen_add_to_stack_pointer(16);
214
+ }
215
+ }
216
+ /**
217
+ * The document's main (entry) card. Allocates and serializes on each
218
+ * call — cache locally if read in a hot loop.
219
+ * @returns {Card}
220
+ */
221
+ get main() {
222
+ const ret = wasm.document_main(this.__wbg_ptr);
223
+ return takeObject(ret);
224
+ }
225
+ /**
226
+ * Build a fresh `Card` from a kind and a flat field map — the ergonomic
227
+ * constructor for `pushCard` / `insertCard`. `fields` is an optional
228
+ * `Record<string, unknown>` (each entry becomes a card field, in
229
+ * insertion order); `body` defaults to `""`. Kind validity is checked by
230
+ * `pushCard` / `insertCard`, not here.
231
+ * @param {string} kind
232
+ * @param {Record<string, unknown>} [fields]
233
+ * @param {string} [body]
234
+ * @returns {Card}
235
+ */
236
+ static makeCard(kind, fields, body) {
237
+ try {
238
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
239
+ const ptr0 = passStringToWasm0(kind, wasm.__wbindgen_export, wasm.__wbindgen_export2);
240
+ const len0 = WASM_VECTOR_LEN;
241
+ var ptr1 = isLikeNone(body) ? 0 : passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
242
+ var len1 = WASM_VECTOR_LEN;
243
+ wasm.document_makeCard(retptr, ptr0, len0, isLikeNone(fields) ? 0 : addHeapObject(fields), ptr1, len1);
244
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
245
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
246
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
247
+ if (r2) {
248
+ throw takeObject(r1);
249
+ }
250
+ return takeObject(r0);
251
+ } finally {
252
+ wasm.__wbindgen_add_to_stack_pointer(16);
253
+ }
254
+ }
255
+ /**
256
+ * Move the card at `from` to position `to`. `from == to` is a no-op.
257
+ * @param {number} from
258
+ * @param {number} to
259
+ */
260
+ moveCard(from, to) {
261
+ try {
262
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
263
+ wasm.document_moveCard(retptr, this.__wbg_ptr, from, to);
264
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
265
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
266
+ if (r1) {
267
+ throw takeObject(r0);
268
+ }
269
+ } finally {
270
+ wasm.__wbindgen_add_to_stack_pointer(16);
271
+ }
272
+ }
273
+ /**
274
+ * Append a card to the end of the card list. Accepts a `Card` (the shape
275
+ * returned by `cards` / `removeCard` / `quill.seedCard`); build a fresh
276
+ * one with [`Document.makeCard`](Document::make_card). Throws if
277
+ * `card.kind` is not a valid kind name.
278
+ * @param {Card} card
279
+ */
280
+ pushCard(card) {
281
+ try {
282
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
283
+ wasm.document_pushCard(retptr, this.__wbg_ptr, addHeapObject(card));
284
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
285
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
286
+ if (r1) {
287
+ throw takeObject(r0);
288
+ }
289
+ } finally {
290
+ wasm.__wbindgen_add_to_stack_pointer(16);
291
+ }
292
+ }
293
+ /**
294
+ * @returns {string}
295
+ */
296
+ get quillRef() {
297
+ let deferred1_0;
298
+ let deferred1_1;
299
+ try {
300
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
301
+ wasm.document_quillRef(retptr, this.__wbg_ptr);
302
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
303
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
304
+ deferred1_0 = r0;
305
+ deferred1_1 = r1;
306
+ return getStringFromWasm0(r0, r1);
307
+ } finally {
308
+ wasm.__wbindgen_add_to_stack_pointer(16);
309
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
310
+ }
311
+ }
312
+ /**
313
+ * The canonical `$quill` reference grammar as author-facing text. Single
314
+ * source of truth (CLI, Python, MCP): drive schema `describe` and
315
+ * validation messages from this instead of re-stating the rule — it
316
+ * matches the `hint` on `parse::invalid_quill_reference`. Cache it; the
317
+ * value never changes.
318
+ * @returns {string}
319
+ */
320
+ static quillRefHint() {
321
+ let deferred1_0;
322
+ let deferred1_1;
323
+ try {
324
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
325
+ wasm.document_quillRefHint(retptr);
326
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
327
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
328
+ deferred1_0 = r0;
329
+ deferred1_1 = r1;
330
+ return getStringFromWasm0(r0, r1);
331
+ } finally {
332
+ wasm.__wbindgen_add_to_stack_pointer(16);
333
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
334
+ }
335
+ }
336
+ /**
337
+ * @param {number} index
338
+ * @returns {Card | undefined}
339
+ */
340
+ removeCard(index) {
341
+ const ret = wasm.document_removeCard(this.__wbg_ptr, index);
342
+ return takeObject(ret);
343
+ }
344
+ /**
345
+ * Remove the `$ext` map from the composable card at `index` *entirely*,
346
+ * returning the previous map or `undefined`. Throws if out of range.
347
+ * Prefer `removeCardExtNamespace` to clear only one consumer's slot.
348
+ * @param {number} index
349
+ * @returns {Record<string, unknown> | undefined}
350
+ */
351
+ removeCardExt(index) {
352
+ try {
353
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
354
+ wasm.document_removeCardExt(retptr, this.__wbg_ptr, index);
355
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
356
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
357
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
358
+ if (r2) {
359
+ throw takeObject(r1);
360
+ }
361
+ return takeObject(r0);
362
+ } finally {
363
+ wasm.__wbindgen_add_to_stack_pointer(16);
364
+ }
365
+ }
366
+ /**
367
+ * Remove `namespace` from the composable card's `$ext` map, returning the
368
+ * value stored there or `undefined`; clears `$ext` entirely once empty.
369
+ * The card-indexed twin of `removeExtNamespace`. Throws if out of range.
370
+ * @param {number} index
371
+ * @param {string} namespace
372
+ * @returns {any}
373
+ */
374
+ removeCardExtNamespace(index, namespace) {
375
+ try {
376
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
377
+ const ptr0 = passStringToWasm0(namespace, wasm.__wbindgen_export, wasm.__wbindgen_export2);
378
+ const len0 = WASM_VECTOR_LEN;
379
+ wasm.document_removeCardExtNamespace(retptr, this.__wbg_ptr, index, ptr0, len0);
380
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
381
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
382
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
383
+ if (r2) {
384
+ throw takeObject(r1);
385
+ }
386
+ return takeObject(r0);
387
+ } finally {
388
+ wasm.__wbindgen_add_to_stack_pointer(16);
389
+ }
390
+ }
391
+ /**
392
+ * Remove a field on the card at `index`. Returns the removed value or
393
+ * `undefined`. Throws if `index` is out of range or `name` is invalid.
394
+ * @param {number} index
395
+ * @param {string} name
396
+ * @returns {any}
397
+ */
398
+ removeCardField(index, name) {
399
+ try {
400
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
401
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
402
+ const len0 = WASM_VECTOR_LEN;
403
+ wasm.document_removeCardField(retptr, this.__wbg_ptr, index, ptr0, len0);
404
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
405
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
406
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
407
+ if (r2) {
408
+ throw takeObject(r1);
409
+ }
410
+ return takeObject(r0);
411
+ } finally {
412
+ wasm.__wbindgen_add_to_stack_pointer(16);
413
+ }
414
+ }
415
+ /**
416
+ * Remove the `$ext` map from the main card *entirely*, returning the
417
+ * previous map or `undefined`. This is a blunt escape hatch that discards
418
+ * every namespace at once — prefer `removeExtNamespace` to clear only your
419
+ * own slot while leaving sibling consumers' state intact.
420
+ * @returns {Record<string, unknown> | undefined}
421
+ */
422
+ removeExt() {
423
+ const ret = wasm.document_removeExt(this.__wbg_ptr);
424
+ return takeObject(ret);
425
+ }
426
+ /**
427
+ * Remove `namespace` from the main card's `$ext` map, returning the value
428
+ * stored there or `undefined`. This is the recommended way to clear `$ext`
429
+ * state: sibling namespaces survive, and when the last namespace is removed
430
+ * the `$ext` entry is dropped entirely (not left as `$ext: {}`).
431
+ * @param {string} namespace
432
+ * @returns {any}
433
+ */
434
+ removeExtNamespace(namespace) {
435
+ const ptr0 = passStringToWasm0(namespace, wasm.__wbindgen_export, wasm.__wbindgen_export2);
436
+ const len0 = WASM_VECTOR_LEN;
437
+ const ret = wasm.document_removeExtNamespace(this.__wbg_ptr, ptr0, len0);
438
+ return takeObject(ret);
439
+ }
440
+ /**
441
+ * Remove a payload field on the main card, returning the removed value or
442
+ * `undefined`. Throws if `name` does not match `[a-z_][a-z0-9_]*`.
443
+ * @param {string} name
444
+ * @returns {any}
445
+ */
446
+ removeField(name) {
447
+ try {
448
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
449
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
450
+ const len0 = WASM_VECTOR_LEN;
451
+ wasm.document_removeField(retptr, this.__wbg_ptr, ptr0, len0);
452
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
453
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
454
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
455
+ if (r2) {
456
+ throw takeObject(r1);
457
+ }
458
+ return takeObject(r0);
459
+ } finally {
460
+ wasm.__wbindgen_add_to_stack_pointer(16);
461
+ }
462
+ }
463
+ /**
464
+ * @param {string} body
465
+ */
466
+ replaceBody(body) {
467
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
468
+ const len0 = WASM_VECTOR_LEN;
469
+ wasm.document_replaceBody(this.__wbg_ptr, ptr0, len0);
470
+ }
471
+ /**
472
+ * Read the `schema` version tag from a raw storage DTO string without a
473
+ * full parse, or `undefined`. Returns unknown future versions as-is —
474
+ * useful to distinguish "build too old" from "payload corrupt" when
475
+ * `fromJson` throws.
476
+ * @param {string} json
477
+ * @returns {string | undefined}
478
+ */
479
+ static schemaVersionOf(json) {
480
+ try {
481
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
482
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
483
+ const len0 = WASM_VECTOR_LEN;
484
+ wasm.document_schemaVersionOf(retptr, ptr0, len0);
485
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
486
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
487
+ let v2;
488
+ if (r0 !== 0) {
489
+ v2 = getStringFromWasm0(r0, r1).slice();
490
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
491
+ }
492
+ return v2;
493
+ } finally {
494
+ wasm.__wbindgen_add_to_stack_pointer(16);
495
+ }
496
+ }
497
+ /**
498
+ * Replace the `$ext` map on the composable card at `index`. Throws if out
499
+ * of range or `value` is not a plain object. Named to mirror `setExt` on
500
+ * the main card; `setCardExtNamespace` is the sibling-safe alternative.
501
+ * @param {number} index
502
+ * @param {any} value
503
+ */
504
+ setCardExt(index, value) {
505
+ try {
506
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
507
+ wasm.document_setCardExt(retptr, this.__wbg_ptr, index, addHeapObject(value));
508
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
509
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
510
+ if (r1) {
511
+ throw takeObject(r0);
512
+ }
513
+ } finally {
514
+ wasm.__wbindgen_add_to_stack_pointer(16);
515
+ }
516
+ }
517
+ /**
518
+ * Merge `value` into the composable card's `$ext` map under `namespace`,
519
+ * preserving sibling namespaces. The card-indexed twin of `setExtNamespace`.
520
+ * Throws if out of range or `value` cannot be serialized.
521
+ * @param {number} index
522
+ * @param {string} namespace
523
+ * @param {any} value
524
+ */
525
+ setCardExtNamespace(index, namespace, value) {
526
+ try {
527
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
528
+ const ptr0 = passStringToWasm0(namespace, wasm.__wbindgen_export, wasm.__wbindgen_export2);
529
+ const len0 = WASM_VECTOR_LEN;
530
+ wasm.document_setCardExtNamespace(retptr, this.__wbg_ptr, index, ptr0, len0, addHeapObject(value));
531
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
532
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
533
+ if (r1) {
534
+ throw takeObject(r0);
535
+ }
536
+ } finally {
537
+ wasm.__wbindgen_add_to_stack_pointer(16);
538
+ }
539
+ }
540
+ /**
541
+ * Replace the kind of the card at `index`. Payload and body are untouched;
542
+ * schema-aware migration is the caller's responsibility.
543
+ * Throws if `index` is out of range or `newKind` is invalid.
544
+ * @param {number} index
545
+ * @param {string} new_kind
546
+ */
547
+ setCardKind(index, new_kind) {
548
+ try {
549
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
550
+ const ptr0 = passStringToWasm0(new_kind, wasm.__wbindgen_export, wasm.__wbindgen_export2);
551
+ const len0 = WASM_VECTOR_LEN;
552
+ wasm.document_setCardKind(retptr, this.__wbg_ptr, index, ptr0, len0);
553
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
554
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
555
+ if (r1) {
556
+ throw takeObject(r0);
557
+ }
558
+ } finally {
559
+ wasm.__wbindgen_add_to_stack_pointer(16);
560
+ }
561
+ }
562
+ /**
563
+ * Replace the opaque `$ext` map on the main card. `value` must be a plain
564
+ * object; throws otherwise. `$ext` carries out-of-band consumer state and
565
+ * never reaches the rendered output. Pass `{}` to record an explicit
566
+ * empty `$ext`.
567
+ * @param {any} value
568
+ */
569
+ setExt(value) {
570
+ try {
571
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
572
+ wasm.document_setExt(retptr, this.__wbg_ptr, addHeapObject(value));
573
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
574
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
575
+ if (r1) {
576
+ throw takeObject(r0);
577
+ }
578
+ } finally {
579
+ wasm.__wbindgen_add_to_stack_pointer(16);
580
+ }
581
+ }
582
+ /**
583
+ * Merge `value` into the main card's `$ext` map under `namespace`, creating
584
+ * the map when absent and replacing any existing value at that key. Sibling
585
+ * namespaces are preserved, so independent consumers (`$ext.presentation`,
586
+ * `$ext.agent`, …) don't clobber each other.
587
+ * @param {string} namespace
588
+ * @param {any} value
589
+ */
590
+ setExtNamespace(namespace, value) {
591
+ try {
592
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
593
+ const ptr0 = passStringToWasm0(namespace, wasm.__wbindgen_export, wasm.__wbindgen_export2);
594
+ const len0 = WASM_VECTOR_LEN;
595
+ wasm.document_setExtNamespace(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(value));
596
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
597
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
598
+ if (r1) {
599
+ throw takeObject(r0);
600
+ }
601
+ } finally {
602
+ wasm.__wbindgen_add_to_stack_pointer(16);
603
+ }
604
+ }
605
+ /**
606
+ * Update a payload field on the main card. Clears any existing `!fill` marker.
607
+ *
608
+ * Throws if `name` does not match `[a-z_][a-z0-9_]*`.
609
+ * @param {string} name
610
+ * @param {any} value
611
+ */
612
+ setField(name, value) {
613
+ try {
614
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
615
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
616
+ const len0 = WASM_VECTOR_LEN;
617
+ wasm.document_setField(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(value));
618
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
619
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
620
+ if (r1) {
621
+ throw takeObject(r0);
622
+ }
623
+ } finally {
624
+ wasm.__wbindgen_add_to_stack_pointer(16);
625
+ }
626
+ }
627
+ /**
628
+ * Update a payload field on the main card and mark it as `!fill`.
629
+ * Throws on invalid name (see [`setField`](Document::set_field)).
630
+ * @param {string} name
631
+ * @param {any} value
632
+ */
633
+ setFill(name, value) {
634
+ try {
635
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
636
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
637
+ const len0 = WASM_VECTOR_LEN;
638
+ wasm.document_setFill(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(value));
639
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
640
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
641
+ if (r1) {
642
+ throw takeObject(r0);
643
+ }
644
+ } finally {
645
+ wasm.__wbindgen_add_to_stack_pointer(16);
646
+ }
647
+ }
648
+ /**
649
+ * Replace the QUILL reference string. Throws if `ref_str` is invalid.
650
+ * @param {string} ref_str
651
+ */
652
+ setQuillRef(ref_str) {
653
+ try {
654
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
655
+ const ptr0 = passStringToWasm0(ref_str, wasm.__wbindgen_export, wasm.__wbindgen_export2);
656
+ const len0 = WASM_VECTOR_LEN;
657
+ wasm.document_setQuillRef(retptr, this.__wbg_ptr, ptr0, len0);
658
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
659
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
660
+ if (r1) {
661
+ throw takeObject(r0);
662
+ }
663
+ } finally {
664
+ wasm.__wbindgen_add_to_stack_pointer(16);
665
+ }
666
+ }
667
+ /**
668
+ * Serialize this document to a versioned storage DTO string.
669
+ *
670
+ * Prefer this over `toMarkdown` for persistence across restarts or crate
671
+ * upgrades — the wire format is frozen per `schema` version. Parse-time
672
+ * `warnings` are excluded from the DTO.
673
+ *
674
+ * Output is **byte-deterministic** within a `schema` version: equal
675
+ * documents produce byte-equal output, safe for content-hash use cases.
676
+ * @returns {string}
677
+ */
678
+ toJson() {
679
+ let deferred1_0;
680
+ let deferred1_1;
681
+ try {
682
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
683
+ wasm.document_toJson(retptr, this.__wbg_ptr);
684
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
685
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
686
+ deferred1_0 = r0;
687
+ deferred1_1 = r1;
688
+ return getStringFromWasm0(r0, r1);
689
+ } finally {
690
+ wasm.__wbindgen_add_to_stack_pointer(16);
691
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
692
+ }
693
+ }
694
+ /**
695
+ * Emit canonical Quillmark Markdown. Round-trip safe: re-parsing the
696
+ * result produces a `Document` equal to `self` by value and by type.
697
+ * @returns {string}
698
+ */
699
+ toMarkdown() {
700
+ let deferred1_0;
701
+ let deferred1_1;
702
+ try {
703
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
704
+ wasm.document_toMarkdown(retptr, this.__wbg_ptr);
705
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
706
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
707
+ deferred1_0 = r0;
708
+ deferred1_1 = r1;
709
+ return getStringFromWasm0(r0, r1);
710
+ } finally {
711
+ wasm.__wbindgen_add_to_stack_pointer(16);
712
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
713
+ }
714
+ }
715
+ /**
716
+ * Like [`fromJson`](Document::from_json) but returns `undefined` instead
717
+ * of throwing when `json` is not a valid storage DTO — use to
718
+ * discriminate format without exceptions as control flow.
719
+ * `undefined` means "not a storage DTO"; `fromMarkdown` still throws on
720
+ * genuinely malformed markdown.
721
+ * @param {string} json
722
+ * @returns {Document | undefined}
723
+ */
724
+ static tryFromJson(json) {
725
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
726
+ const len0 = WASM_VECTOR_LEN;
727
+ const ret = wasm.document_tryFromJson(ptr0, len0);
728
+ return ret === 0 ? undefined : Document.__wrap(ret);
729
+ }
730
+ /**
731
+ * Replace the body of the card at `index`. Throws if out of range.
732
+ * @param {number} index
733
+ * @param {string} body
734
+ */
735
+ updateCardBody(index, body) {
736
+ try {
737
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
738
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
739
+ const len0 = WASM_VECTOR_LEN;
740
+ wasm.document_updateCardBody(retptr, this.__wbg_ptr, index, ptr0, len0);
741
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
742
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
743
+ if (r1) {
744
+ throw takeObject(r0);
745
+ }
746
+ } finally {
747
+ wasm.__wbindgen_add_to_stack_pointer(16);
748
+ }
749
+ }
750
+ /**
751
+ * Update a field on the card at `index`.
752
+ * Throws if `index` is out of range, `name` is reserved or invalid.
753
+ * @param {number} index
754
+ * @param {string} name
755
+ * @param {any} value
756
+ */
757
+ updateCardField(index, name, value) {
758
+ try {
759
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
760
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
761
+ const len0 = WASM_VECTOR_LEN;
762
+ wasm.document_updateCardField(retptr, this.__wbg_ptr, index, ptr0, len0, addHeapObject(value));
763
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
764
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
765
+ if (r1) {
766
+ throw takeObject(r0);
767
+ }
768
+ } finally {
769
+ wasm.__wbindgen_add_to_stack_pointer(16);
770
+ }
771
+ }
772
+ /**
773
+ * @returns {Diagnostic[]}
774
+ */
775
+ get warnings() {
776
+ const ret = wasm.document_warnings(this.__wbg_ptr);
777
+ return takeObject(ret);
778
+ }
779
+ }
780
+ if (Symbol.dispose) Document.prototype[Symbol.dispose] = Document.prototype.free;
781
+
782
+ export class Quill {
783
+ static __wrap(ptr) {
784
+ ptr = ptr >>> 0;
785
+ const obj = Object.create(Quill.prototype);
786
+ obj.__wbg_ptr = ptr;
787
+ QuillFinalization.register(obj, obj.__wbg_ptr, obj);
788
+ return obj;
789
+ }
790
+ __destroy_into_raw() {
791
+ const ptr = this.__wbg_ptr;
792
+ this.__wbg_ptr = 0;
793
+ QuillFinalization.unregister(this);
794
+ return ptr;
795
+ }
796
+ free() {
797
+ const ptr = this.__destroy_into_raw();
798
+ wasm.__wbg_quill_free(ptr, 0);
799
+ }
800
+ /**
801
+ * The *declared* backend identifier (`config.backend`, e.g. `"typst"`).
802
+ * Intent, not a resolved capability — capability (`supportedFormats` /
803
+ * `supportsCanvas`) is read from the engine.
804
+ * @returns {string}
805
+ */
806
+ get backendId() {
807
+ let deferred1_0;
808
+ let deferred1_1;
809
+ try {
810
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
811
+ wasm.quill_backendId(retptr, this.__wbg_ptr);
812
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
813
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
814
+ deferred1_0 = r0;
815
+ deferred1_1 = r1;
816
+ return getStringFromWasm0(r0, r1);
817
+ } finally {
818
+ wasm.__wbindgen_add_to_stack_pointer(16);
819
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
820
+ }
821
+ }
822
+ /**
823
+ * @returns {string}
824
+ */
825
+ get blueprint() {
826
+ let deferred1_0;
827
+ let deferred1_1;
828
+ try {
829
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
830
+ wasm.quill_blueprint(retptr, this.__wbg_ptr);
831
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
832
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
833
+ deferred1_0 = r0;
834
+ deferred1_1 = r1;
835
+ return getStringFromWasm0(r0, r1);
836
+ } finally {
837
+ wasm.__wbindgen_add_to_stack_pointer(16);
838
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
839
+ }
840
+ }
841
+ /**
842
+ * Build a quill from a file tree. Pure — no backend, no engine; the
843
+ * declared backend is resolved later, at render time.
844
+ *
845
+ * Accepts either a `Map<string, Uint8Array>` or a plain object
846
+ * (`Record<string, Uint8Array>`). Plain objects are walked via
847
+ * `Object.entries` at the boundary; the Rust side sees a single
848
+ * canonical shape.
849
+ * @param {Map<string, Uint8Array>} tree
850
+ * @returns {Quill}
851
+ */
852
+ static fromTree(tree) {
853
+ try {
854
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
855
+ wasm.quill_fromTree(retptr, addHeapObject(tree));
856
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
857
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
858
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
859
+ if (r2) {
860
+ throw takeObject(r1);
861
+ }
862
+ return Quill.__wrap(r0);
863
+ } finally {
864
+ wasm.__wbindgen_add_to_stack_pointer(16);
865
+ }
866
+ }
867
+ /**
868
+ * Identity snapshot of the `quill:` section of `Quill.yaml` plus any extra
869
+ * `quill:` keys. Pure config — the backend's output formats are a
870
+ * resolved-backend capability read from the engine
871
+ * (`Quillmark.supportedFormats`), not part of this snapshot.
872
+ * @returns {QuillMetadata}
873
+ */
874
+ get metadata() {
875
+ const ret = wasm.quill_metadata(this.__wbg_ptr);
876
+ return takeObject(ret);
877
+ }
878
+ /**
879
+ * Document schema for the quill: the user-fillable fields plus their
880
+ * `ui` hints (group / order / showWhen). The single field-metadata
881
+ * surface — drives form editors and LLM/MCP consumers alike. Returns the
882
+ * `QuillSchema` shape.
883
+ * @returns {QuillSchema}
884
+ */
885
+ get schema() {
886
+ const ret = wasm.quill_schema(this.__wbg_ptr);
887
+ return takeObject(ret);
888
+ }
889
+ /**
890
+ * Seed a starter composable `Card` of the given kind (carries `$kind`),
891
+ * committing its fields' `example:` values and leaving every other field
892
+ * absent. Returns `undefined` if `cardKind` is not declared in this
893
+ * quill's schema, else a `Card` that feeds straight into
894
+ * `Document.pushCard` / `insertCard`.
895
+ * @param {string} card_kind
896
+ * @returns {Card | undefined}
897
+ */
898
+ seedCard(card_kind) {
899
+ const ptr0 = passStringToWasm0(card_kind, wasm.__wbindgen_export, wasm.__wbindgen_export2);
900
+ const len0 = WASM_VECTOR_LEN;
901
+ const ret = wasm.quill_seedCard(this.__wbg_ptr, ptr0, len0);
902
+ return takeObject(ret);
903
+ }
904
+ /**
905
+ * Seed a starter `Document` from the schema — the main card plus one
906
+ * instance of each composable card kind, each committing its fields'
907
+ * `example:` values and leaving every other field absent (interpolated at
908
+ * render: `default:`, else type-empty zero). Illustration-first: a field
909
+ * with both an `example` and a `default` renders its example. See
910
+ * `prose/canon/SCHEMAS.md` § "Document seeding".
911
+ * @returns {Document}
912
+ */
913
+ seedDocument() {
914
+ const ret = wasm.quill_seedDocument(this.__wbg_ptr);
915
+ return Document.__wrap(ret);
916
+ }
917
+ /**
918
+ * Seed a starter main `Card` (carries `$quill`) from the schema — the
919
+ * `$kind: main` card of [`seedDocument`](Self::seed_document) in
920
+ * isolation, committing each field's `example:` value. Returns the same
921
+ * `Card` shape as the `Document.main` getter.
922
+ * @returns {Card}
923
+ */
924
+ seedMain() {
925
+ const ret = wasm.quill_seedMain(this.__wbg_ptr);
926
+ return takeObject(ret);
927
+ }
928
+ /**
929
+ * Flatten this quill back into its canonical file tree — the inverse of
930
+ * [`fromTree`](Self::from_tree). Round-trips: `Quill.fromTree(q.toTree())`
931
+ * reproduces an equivalent quill.
932
+ *
933
+ * This is how a quill crosses a WASM linear-memory boundary as data: a
934
+ * `Quill` built in one build (e.g. the Typst-less `@quillmark/wasm/core`)
935
+ * cannot be passed to an engine in another (separate linear memories), so
936
+ * `@quillmark/wasm/runtime` re-feeds this tree to the backend build's
937
+ * `Quill.fromTree` on demand. Keys are `"/"`-joined relative paths,
938
+ * matching what `fromTree` accepts.
939
+ * @returns {Map<string, Uint8Array>}
940
+ */
941
+ toTree() {
942
+ const ret = wasm.quill_toTree(this.__wbg_ptr);
943
+ return takeObject(ret);
944
+ }
945
+ /**
946
+ * Validate `doc` against this quill's schema, returning every diagnostic
947
+ * (an empty array when the document is valid).
948
+ *
949
+ * Forwards the canonical `validation::*` diagnostics — same `code`,
950
+ * `path`, and `hint` the engine emits — including the non-fatal
951
+ * `validation::field_absent` completeness signal that `render` demotes.
952
+ * Field values, defaults, and order are not part of this surface: read
953
+ * them from the `Document` payload and `Quill.schema` (fields carry
954
+ * `ui.order`).
955
+ * @param {Document} doc
956
+ * @returns {Diagnostic[]}
957
+ */
958
+ validate(doc) {
959
+ try {
960
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
961
+ _assertClass(doc, Document);
962
+ wasm.quill_validate(retptr, this.__wbg_ptr, doc.__wbg_ptr);
963
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
964
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
965
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
966
+ if (r2) {
967
+ throw takeObject(r1);
968
+ }
969
+ return takeObject(r0);
970
+ } finally {
971
+ wasm.__wbindgen_add_to_stack_pointer(16);
972
+ }
973
+ }
974
+ }
975
+ if (Symbol.dispose) Quill.prototype[Symbol.dispose] = Quill.prototype.free;
976
+
977
+ /**
978
+ * Initialize the WASM module with panic hooks for better error messages
979
+ */
980
+ export function init() {
981
+ wasm.init();
982
+ }
983
+ export function __wbg_Error_960c155d3d49e4c2(arg0, arg1) {
984
+ const ret = Error(getStringFromWasm0(arg0, arg1));
985
+ return addHeapObject(ret);
986
+ }
987
+ export function __wbg_String_8564e559799eccda(arg0, arg1) {
988
+ const ret = String(getObject(arg1));
989
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
990
+ const len1 = WASM_VECTOR_LEN;
991
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
992
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
993
+ }
994
+ export function __wbg_String_b51de6b05a10845b(arg0, arg1) {
995
+ const ret = String(getObject(arg1));
996
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
997
+ const len1 = WASM_VECTOR_LEN;
998
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
999
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1000
+ }
1001
+ export function __wbg___wbindgen_bigint_get_as_i64_3d3aba5d616c6a51(arg0, arg1) {
1002
+ const v = getObject(arg1);
1003
+ const ret = typeof(v) === 'bigint' ? v : undefined;
1004
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
1005
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1006
+ }
1007
+ export function __wbg___wbindgen_boolean_get_6ea149f0a8dcc5ff(arg0) {
1008
+ const v = getObject(arg0);
1009
+ const ret = typeof(v) === 'boolean' ? v : undefined;
1010
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
1011
+ }
1012
+ export function __wbg___wbindgen_debug_string_ab4b34d23d6778bd(arg0, arg1) {
1013
+ const ret = debugString(getObject(arg1));
1014
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1015
+ const len1 = WASM_VECTOR_LEN;
1016
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1017
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1018
+ }
1019
+ export function __wbg___wbindgen_in_a5d8b22e52b24dd1(arg0, arg1) {
1020
+ const ret = getObject(arg0) in getObject(arg1);
1021
+ return ret;
1022
+ }
1023
+ export function __wbg___wbindgen_is_bigint_ec25c7f91b4d9e93(arg0) {
1024
+ const ret = typeof(getObject(arg0)) === 'bigint';
1025
+ return ret;
1026
+ }
1027
+ export function __wbg___wbindgen_is_function_3baa9db1a987f47d(arg0) {
1028
+ const ret = typeof(getObject(arg0)) === 'function';
1029
+ return ret;
1030
+ }
1031
+ export function __wbg___wbindgen_is_null_52ff4ec04186736f(arg0) {
1032
+ const ret = getObject(arg0) === null;
1033
+ return ret;
1034
+ }
1035
+ export function __wbg___wbindgen_is_object_63322ec0cd6ea4ef(arg0) {
1036
+ const val = getObject(arg0);
1037
+ const ret = typeof(val) === 'object' && val !== null;
1038
+ return ret;
1039
+ }
1040
+ export function __wbg___wbindgen_is_string_6df3bf7ef1164ed3(arg0) {
1041
+ const ret = typeof(getObject(arg0)) === 'string';
1042
+ return ret;
1043
+ }
1044
+ export function __wbg___wbindgen_is_undefined_29a43b4d42920abd(arg0) {
1045
+ const ret = getObject(arg0) === undefined;
1046
+ return ret;
1047
+ }
1048
+ export function __wbg___wbindgen_jsval_eq_d3465d8a07697228(arg0, arg1) {
1049
+ const ret = getObject(arg0) === getObject(arg1);
1050
+ return ret;
1051
+ }
1052
+ export function __wbg___wbindgen_jsval_loose_eq_cac3565e89b4134c(arg0, arg1) {
1053
+ const ret = getObject(arg0) == getObject(arg1);
1054
+ return ret;
1055
+ }
1056
+ export function __wbg___wbindgen_number_get_c7f42aed0525c451(arg0, arg1) {
1057
+ const obj = getObject(arg1);
1058
+ const ret = typeof(obj) === 'number' ? obj : undefined;
1059
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1060
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1061
+ }
1062
+ export function __wbg___wbindgen_string_get_7ed5322991caaec5(arg0, arg1) {
1063
+ const obj = getObject(arg1);
1064
+ const ret = typeof(obj) === 'string' ? obj : undefined;
1065
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1066
+ var len1 = WASM_VECTOR_LEN;
1067
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1068
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1069
+ }
1070
+ export function __wbg___wbindgen_throw_6b64449b9b9ed33c(arg0, arg1) {
1071
+ throw new Error(getStringFromWasm0(arg0, arg1));
1072
+ }
1073
+ export function __wbg_call_14b169f759b26747() { return handleError(function (arg0, arg1) {
1074
+ const ret = getObject(arg0).call(getObject(arg1));
1075
+ return addHeapObject(ret);
1076
+ }, arguments); }
1077
+ export function __wbg_done_9158f7cc8751ba32(arg0) {
1078
+ const ret = getObject(arg0).done;
1079
+ return ret;
1080
+ }
1081
+ export function __wbg_entries_2bf997cf82353e47(arg0) {
1082
+ const ret = getObject(arg0).entries();
1083
+ return addHeapObject(ret);
1084
+ }
1085
+ export function __wbg_entries_e0b73aa8571ddb56(arg0) {
1086
+ const ret = Object.entries(getObject(arg0));
1087
+ return addHeapObject(ret);
1088
+ }
1089
+ export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
1090
+ let deferred0_0;
1091
+ let deferred0_1;
1092
+ try {
1093
+ deferred0_0 = arg0;
1094
+ deferred0_1 = arg1;
1095
+ console.error(getStringFromWasm0(arg0, arg1));
1096
+ } finally {
1097
+ wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
1098
+ }
1099
+ }
1100
+ export function __wbg_from_0dbf29f09e7fb200(arg0) {
1101
+ const ret = Array.from(getObject(arg0));
1102
+ return addHeapObject(ret);
1103
+ }
1104
+ export function __wbg_getRandomValues_3f44b700395062e5() { return handleError(function (arg0, arg1) {
1105
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
1106
+ }, arguments); }
1107
+ export function __wbg_get_1affdbdd5573b16a() { return handleError(function (arg0, arg1) {
1108
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
1109
+ return addHeapObject(ret);
1110
+ }, arguments); }
1111
+ export function __wbg_get_8360291721e2339f(arg0, arg1) {
1112
+ const ret = getObject(arg0)[arg1 >>> 0];
1113
+ return addHeapObject(ret);
1114
+ }
1115
+ export function __wbg_get_unchecked_17f53dad852b9588(arg0, arg1) {
1116
+ const ret = getObject(arg0)[arg1 >>> 0];
1117
+ return addHeapObject(ret);
1118
+ }
1119
+ export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
1120
+ const ret = getObject(arg0)[getObject(arg1)];
1121
+ return addHeapObject(ret);
1122
+ }
1123
+ export function __wbg_get_with_ref_key_f64427178466f623(arg0, arg1) {
1124
+ const ret = getObject(arg0)[getObject(arg1)];
1125
+ return addHeapObject(ret);
1126
+ }
1127
+ export function __wbg_instanceof_ArrayBuffer_7c8433c6ed14ffe3(arg0) {
1128
+ let result;
1129
+ try {
1130
+ result = getObject(arg0) instanceof ArrayBuffer;
1131
+ } catch (_) {
1132
+ result = false;
1133
+ }
1134
+ const ret = result;
1135
+ return ret;
1136
+ }
1137
+ export function __wbg_instanceof_Map_1b76fd4635be43eb(arg0) {
1138
+ let result;
1139
+ try {
1140
+ result = getObject(arg0) instanceof Map;
1141
+ } catch (_) {
1142
+ result = false;
1143
+ }
1144
+ const ret = result;
1145
+ return ret;
1146
+ }
1147
+ export function __wbg_instanceof_Object_7c99480a1cdfb911(arg0) {
1148
+ let result;
1149
+ try {
1150
+ result = getObject(arg0) instanceof Object;
1151
+ } catch (_) {
1152
+ result = false;
1153
+ }
1154
+ const ret = result;
1155
+ return ret;
1156
+ }
1157
+ export function __wbg_instanceof_Uint8Array_152ba1f289edcf3f(arg0) {
1158
+ let result;
1159
+ try {
1160
+ result = getObject(arg0) instanceof Uint8Array;
1161
+ } catch (_) {
1162
+ result = false;
1163
+ }
1164
+ const ret = result;
1165
+ return ret;
1166
+ }
1167
+ export function __wbg_isArray_c3109d14ffc06469(arg0) {
1168
+ const ret = Array.isArray(getObject(arg0));
1169
+ return ret;
1170
+ }
1171
+ export function __wbg_isSafeInteger_4fc213d1989d6d2a(arg0) {
1172
+ const ret = Number.isSafeInteger(getObject(arg0));
1173
+ return ret;
1174
+ }
1175
+ export function __wbg_iterator_013bc09ec998c2a7() {
1176
+ const ret = Symbol.iterator;
1177
+ return addHeapObject(ret);
1178
+ }
1179
+ export function __wbg_keys_2fd1bfdda7e278ca(arg0) {
1180
+ const ret = Object.keys(getObject(arg0));
1181
+ return addHeapObject(ret);
1182
+ }
1183
+ export function __wbg_length_3d4ecd04bd8d22f1(arg0) {
1184
+ const ret = getObject(arg0).length;
1185
+ return ret;
1186
+ }
1187
+ export function __wbg_length_9f1775224cf1d815(arg0) {
1188
+ const ret = getObject(arg0).length;
1189
+ return ret;
1190
+ }
1191
+ export function __wbg_new_0c7403db6e782f19(arg0) {
1192
+ const ret = new Uint8Array(getObject(arg0));
1193
+ return addHeapObject(ret);
1194
+ }
1195
+ export function __wbg_new_227d7c05414eb861() {
1196
+ const ret = new Error();
1197
+ return addHeapObject(ret);
1198
+ }
1199
+ export function __wbg_new_34d45cc8e36aaead() {
1200
+ const ret = new Map();
1201
+ return addHeapObject(ret);
1202
+ }
1203
+ export function __wbg_new_5e360d2ff7b9e1c3(arg0, arg1) {
1204
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
1205
+ return addHeapObject(ret);
1206
+ }
1207
+ export function __wbg_new_682678e2f47e32bc() {
1208
+ const ret = new Array();
1209
+ return addHeapObject(ret);
1210
+ }
1211
+ export function __wbg_new_aa8d0fa9762c29bd() {
1212
+ const ret = new Object();
1213
+ return addHeapObject(ret);
1214
+ }
1215
+ export function __wbg_new_from_slice_b5ea43e23f6008c0(arg0, arg1) {
1216
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
1217
+ return addHeapObject(ret);
1218
+ }
1219
+ export function __wbg_next_0340c4ae324393c3() { return handleError(function (arg0) {
1220
+ const ret = getObject(arg0).next();
1221
+ return addHeapObject(ret);
1222
+ }, arguments); }
1223
+ export function __wbg_next_7646edaa39458ef7(arg0) {
1224
+ const ret = getObject(arg0).next;
1225
+ return addHeapObject(ret);
1226
+ }
1227
+ export function __wbg_prototypesetcall_a6b02eb00b0f4ce2(arg0, arg1, arg2) {
1228
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
1229
+ }
1230
+ export function __wbg_set_022bee52d0b05b19() { return handleError(function (arg0, arg1, arg2) {
1231
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
1232
+ return ret;
1233
+ }, arguments); }
1234
+ export function __wbg_set_3bf1de9fab0cd644(arg0, arg1, arg2) {
1235
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1236
+ }
1237
+ export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
1238
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1239
+ }
1240
+ export function __wbg_set_fde2cec06c23692b(arg0, arg1, arg2) {
1241
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
1242
+ return addHeapObject(ret);
1243
+ }
1244
+ export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
1245
+ const ret = getObject(arg1).stack;
1246
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1247
+ const len1 = WASM_VECTOR_LEN;
1248
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1249
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1250
+ }
1251
+ export function __wbg_value_ee3a06f4579184fa(arg0) {
1252
+ const ret = getObject(arg0).value;
1253
+ return addHeapObject(ret);
1254
+ }
1255
+ export function __wbindgen_cast_0000000000000001(arg0) {
1256
+ // Cast intrinsic for `F64 -> Externref`.
1257
+ const ret = arg0;
1258
+ return addHeapObject(ret);
1259
+ }
1260
+ export function __wbindgen_cast_0000000000000002(arg0) {
1261
+ // Cast intrinsic for `I64 -> Externref`.
1262
+ const ret = arg0;
1263
+ return addHeapObject(ret);
1264
+ }
1265
+ export function __wbindgen_cast_0000000000000003(arg0, arg1) {
1266
+ // Cast intrinsic for `Ref(String) -> Externref`.
1267
+ const ret = getStringFromWasm0(arg0, arg1);
1268
+ return addHeapObject(ret);
1269
+ }
1270
+ export function __wbindgen_cast_0000000000000004(arg0) {
1271
+ // Cast intrinsic for `U64 -> Externref`.
1272
+ const ret = BigInt.asUintN(64, arg0);
1273
+ return addHeapObject(ret);
1274
+ }
1275
+ export function __wbindgen_object_clone_ref(arg0) {
1276
+ const ret = getObject(arg0);
1277
+ return addHeapObject(ret);
1278
+ }
1279
+ export function __wbindgen_object_drop_ref(arg0) {
1280
+ takeObject(arg0);
1281
+ }
1282
+ const DocumentFinalization = (typeof FinalizationRegistry === 'undefined')
1283
+ ? { register: () => {}, unregister: () => {} }
1284
+ : new FinalizationRegistry(ptr => wasm.__wbg_document_free(ptr >>> 0, 1));
1285
+ const QuillFinalization = (typeof FinalizationRegistry === 'undefined')
1286
+ ? { register: () => {}, unregister: () => {} }
1287
+ : new FinalizationRegistry(ptr => wasm.__wbg_quill_free(ptr >>> 0, 1));
1288
+
1289
+ function addHeapObject(obj) {
1290
+ if (heap_next === heap.length) heap.push(heap.length + 1);
1291
+ const idx = heap_next;
1292
+ heap_next = heap[idx];
1293
+
1294
+ heap[idx] = obj;
1295
+ return idx;
1296
+ }
1297
+
1298
+ function _assertClass(instance, klass) {
1299
+ if (!(instance instanceof klass)) {
1300
+ throw new Error(`expected instance of ${klass.name}`);
1301
+ }
1302
+ }
1303
+
1304
+ function debugString(val) {
1305
+ // primitive types
1306
+ const type = typeof val;
1307
+ if (type == 'number' || type == 'boolean' || val == null) {
1308
+ return `${val}`;
1309
+ }
1310
+ if (type == 'string') {
1311
+ return `"${val}"`;
1312
+ }
1313
+ if (type == 'symbol') {
1314
+ const description = val.description;
1315
+ if (description == null) {
1316
+ return 'Symbol';
1317
+ } else {
1318
+ return `Symbol(${description})`;
1319
+ }
1320
+ }
1321
+ if (type == 'function') {
1322
+ const name = val.name;
1323
+ if (typeof name == 'string' && name.length > 0) {
1324
+ return `Function(${name})`;
1325
+ } else {
1326
+ return 'Function';
1327
+ }
1328
+ }
1329
+ // objects
1330
+ if (Array.isArray(val)) {
1331
+ const length = val.length;
1332
+ let debug = '[';
1333
+ if (length > 0) {
1334
+ debug += debugString(val[0]);
1335
+ }
1336
+ for(let i = 1; i < length; i++) {
1337
+ debug += ', ' + debugString(val[i]);
1338
+ }
1339
+ debug += ']';
1340
+ return debug;
1341
+ }
1342
+ // Test for built-in
1343
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1344
+ let className;
1345
+ if (builtInMatches && builtInMatches.length > 1) {
1346
+ className = builtInMatches[1];
1347
+ } else {
1348
+ // Failed to match the standard '[object ClassName]'
1349
+ return toString.call(val);
1350
+ }
1351
+ if (className == 'Object') {
1352
+ // we're a user defined class or Object
1353
+ // JSON.stringify avoids problems with cycles, and is generally much
1354
+ // easier than looping through ownProperties of `val`.
1355
+ try {
1356
+ return 'Object(' + JSON.stringify(val) + ')';
1357
+ } catch (_) {
1358
+ return 'Object';
1359
+ }
1360
+ }
1361
+ // errors
1362
+ if (val instanceof Error) {
1363
+ return `${val.name}: ${val.message}\n${val.stack}`;
1364
+ }
1365
+ // TODO we could test for more things here, like `Set`s and `Map`s.
1366
+ return className;
1367
+ }
1368
+
1369
+ function dropObject(idx) {
1370
+ if (idx < 1028) return;
1371
+ heap[idx] = heap_next;
1372
+ heap_next = idx;
1373
+ }
1374
+
1375
+ function getArrayU8FromWasm0(ptr, len) {
1376
+ ptr = ptr >>> 0;
1377
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1378
+ }
1379
+
1380
+ let cachedDataViewMemory0 = null;
1381
+ function getDataViewMemory0() {
1382
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1383
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1384
+ }
1385
+ return cachedDataViewMemory0;
1386
+ }
1387
+
1388
+ function getStringFromWasm0(ptr, len) {
1389
+ ptr = ptr >>> 0;
1390
+ return decodeText(ptr, len);
1391
+ }
1392
+
1393
+ let cachedUint8ArrayMemory0 = null;
1394
+ function getUint8ArrayMemory0() {
1395
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1396
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1397
+ }
1398
+ return cachedUint8ArrayMemory0;
1399
+ }
1400
+
1401
+ function getObject(idx) { return heap[idx]; }
1402
+
1403
+ function handleError(f, args) {
1404
+ try {
1405
+ return f.apply(this, args);
1406
+ } catch (e) {
1407
+ wasm.__wbindgen_export3(addHeapObject(e));
1408
+ }
1409
+ }
1410
+
1411
+ let heap = new Array(1024).fill(undefined);
1412
+ heap.push(undefined, null, true, false);
1413
+
1414
+ let heap_next = heap.length;
1415
+
1416
+ function isLikeNone(x) {
1417
+ return x === undefined || x === null;
1418
+ }
1419
+
1420
+ function passStringToWasm0(arg, malloc, realloc) {
1421
+ if (realloc === undefined) {
1422
+ const buf = cachedTextEncoder.encode(arg);
1423
+ const ptr = malloc(buf.length, 1) >>> 0;
1424
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1425
+ WASM_VECTOR_LEN = buf.length;
1426
+ return ptr;
1427
+ }
1428
+
1429
+ let len = arg.length;
1430
+ let ptr = malloc(len, 1) >>> 0;
1431
+
1432
+ const mem = getUint8ArrayMemory0();
1433
+
1434
+ let offset = 0;
1435
+
1436
+ for (; offset < len; offset++) {
1437
+ const code = arg.charCodeAt(offset);
1438
+ if (code > 0x7F) break;
1439
+ mem[ptr + offset] = code;
1440
+ }
1441
+ if (offset !== len) {
1442
+ if (offset !== 0) {
1443
+ arg = arg.slice(offset);
1444
+ }
1445
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1446
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1447
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1448
+
1449
+ offset += ret.written;
1450
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1451
+ }
1452
+
1453
+ WASM_VECTOR_LEN = offset;
1454
+ return ptr;
1455
+ }
1456
+
1457
+ function takeObject(idx) {
1458
+ const ret = getObject(idx);
1459
+ dropObject(idx);
1460
+ return ret;
1461
+ }
1462
+
1463
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1464
+ cachedTextDecoder.decode();
1465
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1466
+ let numBytesDecoded = 0;
1467
+ function decodeText(ptr, len) {
1468
+ numBytesDecoded += len;
1469
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1470
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1471
+ cachedTextDecoder.decode();
1472
+ numBytesDecoded = len;
1473
+ }
1474
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1475
+ }
1476
+
1477
+ const cachedTextEncoder = new TextEncoder();
1478
+
1479
+ if (!('encodeInto' in cachedTextEncoder)) {
1480
+ cachedTextEncoder.encodeInto = function (arg, view) {
1481
+ const buf = cachedTextEncoder.encode(arg);
1482
+ view.set(buf);
1483
+ return {
1484
+ read: arg.length,
1485
+ written: buf.length
1486
+ };
1487
+ };
1488
+ }
1489
+
1490
+ let WASM_VECTOR_LEN = 0;
1491
+
1492
+
1493
+ let wasm;
1494
+ export function __wbg_set_wasm(val) {
1495
+ wasm = val;
1496
+ }