@laminapdf/wasm 0.0.0-stage → 0.2.0-alpha.2

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,1257 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /** An error or warning (ADR 0026 §1). Errors are thrown as this object. */
5
+ export interface Diagnostic {
6
+ code: string;
7
+ kind: "input" | "io" | "unsupported" | "limit" | "security" | "usage" | "state" | "cancelled" | "internal";
8
+ message: string;
9
+ hint?: string;
10
+ didYouMean?: string[];
11
+ location?: { offset?: number; object?: number; streamOffset?: number; pageIndex?: number; id?: string };
12
+ data?: Record<string, unknown>;
13
+ docsUrl: string;
14
+ }
15
+
16
+
17
+ /**
18
+ * A conformance profile.
19
+ */
20
+ export type ProfileInit = "PDF/UA-1" | "PDF/A-2b" | "PDF/A-2u" | "PDF/A-3b";
21
+
22
+ /**
23
+ * A job's progress (`laminapdf::Step::Progress`).
24
+ */
25
+ export interface ProgressJs {
26
+ /**
27
+ * Work done so far (units of the phase).
28
+ */
29
+ done: number;
30
+ /**
31
+ * The total, when known.
32
+ */
33
+ total?: number;
34
+ /**
35
+ * The phase (`parse`, `layout`, `extract`, `render`, `write`, `sign`).
36
+ */
37
+ phase: string;
38
+ }
39
+
40
+ /**
41
+ * A list of ops with its schema version ([ADR 0006] §6): `{ "v": 1, "ops": [ … ] }`, used
42
+ * for saved op logs, batch processing and sync messages. Unknown fields are rejected, and so
43
+ * is a `v` this reader does not know; [`OpLog::from_json`] checks `v` before reading any op.
44
+ *
45
+ * ```
46
+ * use laminapdf_ops::OpLog;
47
+ *
48
+ * let log = OpLog::from_json(r#"{ "v": 1, "ops": [{ "op": "rotatePage", "args": { "page": "p3.0", "rotate": 180 } }] }"#)?;
49
+ * assert_eq!(log.ops().len(), 1);
50
+ * assert_eq!(OpLog::from_json(r#"{ "v": 2, "ops": [] }"#).map_err(|e| e.code()), Err("unsupported-version"));
51
+ * # Ok::<(), laminapdf_ops::Error>(())
52
+ * ```
53
+ *
54
+ * [ADR 0006]: https://github.com/laudebugs/laminapdf/blob/main/docs/decisions/0006-op-log-and-undo.md
55
+ */
56
+ export interface OpLog {
57
+ v: 1;
58
+ ops: Op[];
59
+ }
60
+
61
+ /**
62
+ * A page-label numbering style.
63
+ */
64
+ export type LabelStyleInit = "decimal" | "upperRoman" | "lowerRoman" | "upperLetters" | "lowerLetters";
65
+
66
+ /**
67
+ * An attached file's options.
68
+ */
69
+ export interface AttachmentInit {
70
+ /**
71
+ * How the file relates to the document (default `unspecified`).
72
+ */
73
+ relationship?: AfRelationshipInit;
74
+ /**
75
+ * `/Desc`, shown next to the file.
76
+ */
77
+ description?: string;
78
+ /**
79
+ * When the file last changed, a PDF date (default: the document's creation date).
80
+ */
81
+ modDate?: string;
82
+ }
83
+
84
+ /**
85
+ * An editing operation ([ADR 0006] §1): typed and semantic (it names things by
86
+ * [`LaminaPdfId`](laminapdf_model::LaminaPdfId), never by object reference), serialisable, and free
87
+ * of ambient inputs (a modification date is in the payload), so the same op on the same
88
+ * document gives the same result on every platform.
89
+ *
90
+ * Apply it inside a transaction ([`Tx::apply`](crate::Tx::apply)); its JSON form is
91
+ * adjacently tagged, `{ "op": "rotatePage", "args": { … } }`, and unknown ops and fields
92
+ * are rejected, never skipped.
93
+ *
94
+ * ```
95
+ * use laminapdf_ops::Op;
96
+ *
97
+ * let op: Op = serde_json::from_str(r#"{ "op": "rotatePage", "args": { "page": "p3.0", "rotate": 90 } }"#)?;
98
+ * assert_eq!(serde_json::to_string(&op)?, r#"{"op":"rotatePage","args":{"page":"p3.0","rotate":90}}"#);
99
+ * assert!(serde_json::from_str::<Op>(r#"{ "op": "explode", "args": {} }"#).is_err());
100
+ * # Ok::<(), serde_json::Error>(())
101
+ * ```
102
+ *
103
+ * [ADR 0006]: https://github.com/laudebugs/laminapdf/blob/main/docs/decisions/0006-op-log-and-undo.md
104
+ */
105
+ export type Op = { op: "setInfo"; args: SetInfo } | { op: "rotatePage"; args: RotatePage };
106
+
107
+ /**
108
+ * Changes to the Info dictionary's text entries. For each field, `None` leaves the entry
109
+ * alone, `Some(None)` removes it and `Some(Some(text))` sets it (encoded as
110
+ * PDFDocEncoding when it can be, else UTF-16BE, §7.9.2.2).
111
+ *
112
+ * On the wire an absent field is left alone and `null` clears: `{ "title": "Report",
113
+ * "author": null }`.
114
+ */
115
+ export interface InfoPatch {
116
+ /**
117
+ * `/Title`.
118
+ */
119
+ title?: string | null;
120
+ /**
121
+ * `/Author`.
122
+ */
123
+ author?: string | null;
124
+ /**
125
+ * `/Subject`.
126
+ */
127
+ subject?: string | null;
128
+ /**
129
+ * `/Keywords`.
130
+ */
131
+ keywords?: string | null;
132
+ /**
133
+ * `/Creator`: the application that created the original document.
134
+ */
135
+ creator?: string | null;
136
+ /**
137
+ * `/Producer`: the application that converted it to PDF.
138
+ */
139
+ producer?: string | null;
140
+ }
141
+
142
+ /**
143
+ * Edits the Info dictionary: applies `patch` and, when `at` is given, sets `/ModDate` to it.
144
+ * The date is part of the op, never read from a clock, so the same op gives the same bytes
145
+ * everywhere (ADR 0006 §1).
146
+ *
147
+ * An Info dictionary written directly in the trailer, or missing, becomes a new indirect
148
+ * object that the trailer's `/Info` points to (the first time the op changes something).
149
+ */
150
+ export interface SetInfo {
151
+ /**
152
+ * The entries to set or clear.
153
+ */
154
+ patch?: InfoPatch;
155
+ /**
156
+ * The modification date to record as `/ModDate`.
157
+ */
158
+ at?: string;
159
+ }
160
+
161
+ /**
162
+ * How a destination shows its page (§12.3.2.2).
163
+ */
164
+ export type FitInit = { type: "page" } | { type: "width"; top?: number } | { type: "height"; left?: number } | { type: "xyz"; left?: number; top?: number; zoom?: number } | { type: "rect"; x: number; y: number; width: number; height: number } | { type: "bounds" };
165
+
166
+ /**
167
+ * How a viewer lays pages out.
168
+ */
169
+ export type PageLayoutInit = "singlePage" | "oneColumn" | "twoColumnLeft" | "twoColumnRight" | "twoPageLeft" | "twoPageRight";
170
+
171
+ /**
172
+ * How an attached file relates to the document (`/AFRelationship`).
173
+ */
174
+ export type AfRelationshipInit = "source" | "data" | "alternative" | "supplement" | "unspecified";
175
+
176
+ /**
177
+ * How an undo or redo went (`laminapdf::UndoOutcome`).
178
+ */
179
+ export type UndoOutcomeJs = "applied" | "partial" | "skipped";
180
+
181
+ /**
182
+ * How viewers present the document when it opens.
183
+ */
184
+ export interface ViewerPreferencesInit {
185
+ /**
186
+ * Show the title, not the file name.
187
+ */
188
+ displayDocTitle?: boolean;
189
+ /**
190
+ * The panel shown.
191
+ */
192
+ pageMode?: PageModeInit;
193
+ /**
194
+ * The page layout.
195
+ */
196
+ pageLayout?: PageLayoutInit;
197
+ }
198
+
199
+ /**
200
+ * Object numbering in a full rewrite.
201
+ */
202
+ export type RenumberJs = "keep" | "compact";
203
+
204
+ /**
205
+ * One outline item and its children.
206
+ */
207
+ export interface OutlineEntryInit {
208
+ /**
209
+ * The title shown.
210
+ */
211
+ title: string;
212
+ /**
213
+ * Where it goes (none: a heading).
214
+ */
215
+ target?: LinkTargetInit;
216
+ /**
217
+ * Its children.
218
+ */
219
+ children?: OutlineEntryInit[];
220
+ /**
221
+ * Shown expanded.
222
+ */
223
+ open?: boolean;
224
+ /**
225
+ * The title's colour, RGB 0 to 1.
226
+ */
227
+ color?: [number, number, number];
228
+ /**
229
+ * Bold title.
230
+ */
231
+ bold?: boolean;
232
+ /**
233
+ * Italic title.
234
+ */
235
+ italic?: boolean;
236
+ }
237
+
238
+ /**
239
+ * One page's facts (`laminapdf::PageInfo`).
240
+ */
241
+ export interface PageInfoJs {
242
+ /**
243
+ * The 0-based index.
244
+ */
245
+ index: number;
246
+ /**
247
+ * The stable page ID (`p12.0`).
248
+ */
249
+ id: string;
250
+ /**
251
+ * Displayed width in points.
252
+ */
253
+ width: number;
254
+ /**
255
+ * Displayed height in points.
256
+ */
257
+ height: number;
258
+ /**
259
+ * `/Rotate` in degrees.
260
+ */
261
+ rotation: number;
262
+ /**
263
+ * The page label, when the document defines one (document text).
264
+ */
265
+ label?: string;
266
+ }
267
+
268
+ /**
269
+ * One page-label range, from page `start` (0-based) on.
270
+ */
271
+ export interface PageLabelInit {
272
+ /**
273
+ * The first page of the range.
274
+ */
275
+ start: number;
276
+ /**
277
+ * The numbering style (none: prefix only).
278
+ */
279
+ style?: LabelStyleInit;
280
+ /**
281
+ * A prefix.
282
+ */
283
+ prefix?: string;
284
+ /**
285
+ * The first number (default 1).
286
+ */
287
+ first?: number;
288
+ }
289
+
290
+ /**
291
+ * Options for `WasmDocument.openBytes`.
292
+ */
293
+ export interface OpenOptionsInit {
294
+ /**
295
+ * The user or owner password of an encrypted document.
296
+ */
297
+ password?: string;
298
+ /**
299
+ * Refuse files that need repair (`strict`).
300
+ */
301
+ strict?: boolean;
302
+ /**
303
+ * Resource limits (ADR 0003 §3); each one left out keeps its default.
304
+ */
305
+ limits?: LimitsInit;
306
+ }
307
+
308
+ /**
309
+ * Options for a new document: everything that would come from the environment is given,
310
+ * so the same calls give the same bytes.
311
+ */
312
+ export interface BuildOptionsInit {
313
+ /**
314
+ * The header version (default 1.7).
315
+ */
316
+ version?: PdfVersionInit;
317
+ /**
318
+ * The first `/ID` entry: 16 bytes as 32 hex digits (default: a content hash).
319
+ */
320
+ id?: string;
321
+ /**
322
+ * `/Producer`.
323
+ */
324
+ producer?: string;
325
+ /**
326
+ * `/CreationDate`, a PDF date (`D:20261030120000Z`).
327
+ */
328
+ creationDate?: string;
329
+ /**
330
+ * Flate-compress content streams (default `true`).
331
+ */
332
+ compress?: boolean;
333
+ /**
334
+ * A tagged document (structure tree, `/MarkInfo`) even before any element (default
335
+ * `false`; a page using `beginTag` or `beginArtifact` makes it tagged either way).
336
+ */
337
+ tagged?: boolean;
338
+ /**
339
+ * Conformance profiles: `PDF/UA-1` with at most one PDF/A profile. `finish` then fails
340
+ * with a coded error for each machine-checkable rule the document breaks.
341
+ */
342
+ profiles?: ProfileInit[];
343
+ }
344
+
345
+ /**
346
+ * Options for saving.
347
+ */
348
+ export interface SaveOptionsInit {
349
+ /**
350
+ * The mode (default `auto`).
351
+ */
352
+ mode?: SaveModeJs;
353
+ /**
354
+ * Save even when it invalidates signatures (removing them from the output).
355
+ */
356
+ invalidateSignatures?: boolean;
357
+ /**
358
+ * Write an encrypted document as a plaintext full rewrite.
359
+ */
360
+ removeEncryption?: boolean;
361
+ /**
362
+ * What an incremental save returns.
363
+ */
364
+ output?: OutputJs;
365
+ /**
366
+ * Numbering in a full rewrite.
367
+ */
368
+ renumber?: RenumberJs;
369
+ /**
370
+ * The cross-reference form.
371
+ */
372
+ xref?: XrefJs;
373
+ }
374
+
375
+ /**
376
+ * Sets a page's rotation to `rotate` (absolute, not relative to the current value).
377
+ *
378
+ * `/Rotate` is written on the page object itself, so a value inherited from a `/Pages`
379
+ * node is materialised on this page and its siblings keep theirs; an existing own entry
380
+ * keeps its position in the dictionary. The page object is changed, never replaced, so the
381
+ * page keeps its [`PageId`] and object number ([ADR 0005] §5). Nothing is written when the
382
+ * page already displays at `rotate` without an own entry.
383
+ *
384
+ * On the wire: `{ "op": "rotatePage", "args": { "page": "p12.0", "rotate": 90 } }`.
385
+ *
386
+ * [ADR 0005]: https://github.com/laudebugs/laminapdf/blob/main/docs/decisions/0005-document-model.md
387
+ */
388
+ export interface RotatePage {
389
+ /**
390
+ * The page.
391
+ */
392
+ page: string;
393
+ /**
394
+ * The rotation in degrees clockwise: 0, 90, 180 or 270.
395
+ */
396
+ rotate: 0 | 90 | 180 | 270;
397
+ }
398
+
399
+ /**
400
+ * The Info dictionary's text entries; absent ones are left out (document text).
401
+ */
402
+ export interface DocumentInfoJs {
403
+ /**
404
+ * `/Title`.
405
+ */
406
+ title?: string;
407
+ /**
408
+ * `/Author`.
409
+ */
410
+ author?: string;
411
+ /**
412
+ * `/Subject`.
413
+ */
414
+ subject?: string;
415
+ /**
416
+ * `/Keywords`.
417
+ */
418
+ keywords?: string;
419
+ /**
420
+ * `/Creator`.
421
+ */
422
+ creator?: string;
423
+ /**
424
+ * `/Producer`.
425
+ */
426
+ producer?: string;
427
+ }
428
+
429
+ /**
430
+ * The PDF version of a new document.
431
+ */
432
+ export type PdfVersionInit = "1.4" | "1.5" | "1.6" | "1.7" | "2.0";
433
+
434
+ /**
435
+ * The cross-reference form.
436
+ */
437
+ export type XrefJs = "stream" | "classic";
438
+
439
+ /**
440
+ * The document metadata (Info and XMP from the same values).
441
+ */
442
+ export interface MetadataInit {
443
+ /**
444
+ * Title.
445
+ */
446
+ title?: string;
447
+ /**
448
+ * Author.
449
+ */
450
+ author?: string;
451
+ /**
452
+ * Subject.
453
+ */
454
+ subject?: string;
455
+ /**
456
+ * Keywords.
457
+ */
458
+ keywords?: string;
459
+ /**
460
+ * Creator (the application that made the content).
461
+ */
462
+ creator?: string;
463
+ /**
464
+ * Producer.
465
+ */
466
+ producer?: string;
467
+ /**
468
+ * Creation date, a PDF date.
469
+ */
470
+ creationDate?: string;
471
+ /**
472
+ * Modification date, a PDF date.
473
+ */
474
+ modDate?: string;
475
+ }
476
+
477
+ /**
478
+ * The kind of change an op makes. The save planner checks it against `DocMDP` / `FieldMDP`
479
+ * permissions and the document's `SaveConstraint` ([ADR 0007]).
480
+ *
481
+ * [ADR 0007]: https://github.com/laudebugs/laminapdf/blob/main/docs/decisions/0007-save-planner.md
482
+ */
483
+ export type ModificationClass = "metadata" | "formFill" | "annotation" | "signature" | "pageStructure" | "content" | "document";
484
+
485
+ /**
486
+ * The pages an edit touched.
487
+ */
488
+ export interface EditedJs {
489
+ /**
490
+ * IDs of the pages whose content or attributes changed.
491
+ */
492
+ touchedPages: string[];
493
+ }
494
+
495
+ /**
496
+ * The panel a viewer opens with.
497
+ */
498
+ export type PageModeInit = "none" | "outlines" | "thumbnails" | "fullScreen" | "optionalContent" | "attachments";
499
+
500
+ /**
501
+ * The save mode (ADR 0007 §3).
502
+ */
503
+ export type SaveModeJs = "auto" | "incremental" | "fullRewrite";
504
+
505
+ /**
506
+ * What a save wrote (`laminapdf::SaveReport`).
507
+ */
508
+ export interface SaveReportJs {
509
+ /**
510
+ * Bytes written.
511
+ */
512
+ bytesWritten: number;
513
+ /**
514
+ * The mode used (`incremental` or `fullRewrite`).
515
+ */
516
+ mode: SaveModeJs;
517
+ /**
518
+ * Old → new object numbers, when a full rewrite renumbered.
519
+ */
520
+ renumbered?: Record<string, number>;
521
+ /**
522
+ * Where the appended revision starts, for an incremental save.
523
+ */
524
+ appendOffset?: number;
525
+ /**
526
+ * How many signatures the save invalidated (with `invalidateSignatures`).
527
+ */
528
+ invalidatedSignatures: number;
529
+ /**
530
+ * Whether encryption was removed.
531
+ */
532
+ encryptionRemoved: boolean;
533
+ }
534
+
535
+ /**
536
+ * What an incremental save returns.
537
+ */
538
+ export type OutputJs = "whole" | "appendedOnly";
539
+
540
+ /**
541
+ * Where a link or outline item goes.
542
+ */
543
+ export type LinkTargetInit = { type: "uri"; uri: string } | { type: "page"; index: number; fit?: FitInit } | { type: "named"; name: string };
544
+
545
+ /**
546
+ * `Limits` with every field optional (ADR 0003 §3; names as in Rust, camelCase).
547
+ */
548
+ export interface LimitsInit {
549
+ /**
550
+ *
551
+ */
552
+ maxNestingDepth?: number;
553
+ /**
554
+ *
555
+ */
556
+ maxStreamDecoded?: number;
557
+ /**
558
+ *
559
+ */
560
+ maxDecodedTotal?: number;
561
+ /**
562
+ *
563
+ */
564
+ maxFilterChain?: number;
565
+ /**
566
+ *
567
+ */
568
+ maxResolveDepth?: number;
569
+ /**
570
+ *
571
+ */
572
+ maxPageTreeDepth?: number;
573
+ /**
574
+ *
575
+ */
576
+ maxTreeDepth?: number;
577
+ /**
578
+ *
579
+ */
580
+ maxStringLength?: number;
581
+ /**
582
+ *
583
+ */
584
+ maxXrefSections?: number;
585
+ /**
586
+ *
587
+ */
588
+ maxObjectNumber?: number;
589
+ /**
590
+ *
591
+ */
592
+ maxWarnings?: number;
593
+ /**
594
+ *
595
+ */
596
+ maxContentOperators?: number;
597
+ /**
598
+ *
599
+ */
600
+ maxXobjectDepth?: number;
601
+ /**
602
+ *
603
+ */
604
+ maxImagePixels?: number;
605
+ /**
606
+ *
607
+ */
608
+ maxReadWindow?: number;
609
+ }
610
+
611
+
612
+ /**
613
+ * Builds a new document: pages, navigation and metadata, then [`WasmBuilder::finish`]
614
+ * gives a [`WasmDocument`] (unsaved; its save is a full rewrite).
615
+ */
616
+ export class WasmBuilder {
617
+ free(): void;
618
+ [Symbol.dispose](): void;
619
+ /**
620
+ * Attaches a file (`/EmbeddedFiles`, the catalog's `/AF`): `name`, its bytes and its MIME
621
+ * type. The same name again replaces the file.
622
+ *
623
+ * # Errors
624
+ * `builder-finished`; `invalid-argument` (a date that isn't a PDF date); `unknown-option`.
625
+ */
626
+ attach(name: string, bytes: Uint8Array, mime: string, options: AttachmentInit | undefined): void;
627
+ /**
628
+ * Defines the named destination `name`: page `index` shown as `fit` (default: the page).
629
+ *
630
+ * # Errors
631
+ * `builder-finished`; `invalid-argument` for a bad `fit`.
632
+ */
633
+ destination(name: string, index: number, fit: FitInit | undefined): void;
634
+ /**
635
+ * Writes the fonts, links, page tree, outline and metadata, and returns the document.
636
+ * The builder is finished afterwards, and so are its unfinished pages.
637
+ *
638
+ * # Errors
639
+ * `builder-finished`; `page-index-out-of-range`, `unknown-destination`,
640
+ * `invalid-page-labels`, `invalid-geometry`, `subset-failed`.
641
+ */
642
+ finish(): WasmDocument;
643
+ /**
644
+ * The natural language (`/Lang`), a BCP 47 tag.
645
+ *
646
+ * # Errors
647
+ * `builder-finished`.
648
+ */
649
+ lang(lang: string): void;
650
+ /**
651
+ * The metadata, written as the Info dictionary and an XMP packet.
652
+ *
653
+ * # Errors
654
+ * `builder-finished`; `invalid-argument` (a date that isn't a PDF date).
655
+ */
656
+ metadata(metadata: MetadataInit): void;
657
+ /**
658
+ * A builder for a new, empty document.
659
+ *
660
+ * # Errors
661
+ * `invalid-argument` / `unknown-option` for bad options.
662
+ */
663
+ constructor(options: BuildOptionsInit | undefined);
664
+ /**
665
+ * Adds outline items (with their children); returns their IDs in pre-order.
666
+ *
667
+ * # Errors
668
+ * `builder-finished`; `invalid-argument`; `limit-exceeded`.
669
+ */
670
+ outline(entries: OutlineEntryInit[]): string[];
671
+ /**
672
+ * The page labels, ranges by first page (checked at [`WasmBuilder::finish`]).
673
+ *
674
+ * # Errors
675
+ * `builder-finished`; `invalid-argument`.
676
+ */
677
+ pageLabels(ranges: PageLabelInit[]): void;
678
+ /**
679
+ * A page of `width` × `height` points, written by [`WasmPageBuilder::finish`].
680
+ */
681
+ page(width: number, height: number): WasmPageBuilder;
682
+ /**
683
+ * How viewers present the document when it opens.
684
+ *
685
+ * # Errors
686
+ * `builder-finished`; `invalid-argument`.
687
+ */
688
+ viewerPreferences(prefs: ViewerPreferencesInit): void;
689
+ }
690
+
691
+ /**
692
+ * An open PDF: read it, edit it with ops (with undo), save it. The binding of
693
+ * `laminapdf::Document`, method for method (F12).
694
+ */
695
+ export class WasmDocument {
696
+ private constructor();
697
+ free(): void;
698
+ [Symbol.dispose](): void;
699
+ /**
700
+ * Applies an op log (`{ "v": 1, "ops": [ … ] }`) as one transaction.
701
+ *
702
+ * # Errors
703
+ * `invalid-op-log`, `unsupported-version`; as [`WasmDocument::apply`].
704
+ */
705
+ applyLog(json: string): EditedJs;
706
+ /**
707
+ * Applies `ops` (the op JSON of ADR 0006 §6) in order, as one transaction.
708
+ *
709
+ * # Errors
710
+ * `invalid-argument` / `unknown-option` for a value that isn't an op; the first op's
711
+ * error (nothing is applied).
712
+ */
713
+ apply(ops: Op[]): EditedJs;
714
+ /**
715
+ * Whether there are changes no save has written yet.
716
+ */
717
+ hasUnsavedChanges(): boolean;
718
+ /**
719
+ * The Info dictionary's text entries.
720
+ *
721
+ * # Errors
722
+ * Reading errors.
723
+ */
724
+ info(): DocumentInfoJs;
725
+ /**
726
+ * Opens a document from its bytes.
727
+ *
728
+ * # Errors
729
+ * The §1 object: `not-pdf`, `password-required`, `wrong-password`, `limit-exceeded`, …;
730
+ * `invalid-argument` / `unknown-option` for bad options.
731
+ */
732
+ static openBytes(bytes: Uint8Array, options: OpenOptionsInit | undefined): WasmDocument;
733
+ /**
734
+ * Opens a document over a sparse source whose bytes arrive later. Until the source holds
735
+ * what a call needs, the call throws `data-pending` with `data.ranges` (`[offset, length]`
736
+ * pairs): supply them and call again. Lazy reads on the document can do the same.
737
+ *
738
+ * # Errors
739
+ * As `openBytes`, and `data-pending`.
740
+ */
741
+ static openSource(source: WasmSparseSource, options: OpenOptionsInit | undefined): WasmDocument;
742
+ /**
743
+ * A handle on the page with `id` (`p12.0`).
744
+ *
745
+ * # Errors
746
+ * `invalid-argument` for a malformed ID; `unknown-page`.
747
+ */
748
+ pageById(id: string): WasmPage;
749
+ /**
750
+ * The number of pages.
751
+ *
752
+ * # Errors
753
+ * Reading errors.
754
+ */
755
+ pageCount(): number;
756
+ /**
757
+ * Page `index`'s facts.
758
+ *
759
+ * # Errors
760
+ * `page-index-out-of-range`; reading errors.
761
+ */
762
+ pageInfo(index: number): PageInfoJs;
763
+ /**
764
+ * Every page's facts, in order (one page-tree walk).
765
+ *
766
+ * # Errors
767
+ * Reading errors.
768
+ */
769
+ pageInfos(): PageInfoJs[];
770
+ /**
771
+ * A handle on page `index` that follows the page by its ID (F2).
772
+ *
773
+ * # Errors
774
+ * `page-index-out-of-range`; reading errors.
775
+ */
776
+ page(index: number): WasmPage;
777
+ /**
778
+ * Rebases onto `bytes`, the output of a save whose rebase failed (`not-rebased`).
779
+ *
780
+ * # Errors
781
+ * `no-pending-save`; reading errors in `bytes`.
782
+ */
783
+ rebase(bytes: Uint8Array): void;
784
+ /**
785
+ * Redoes the newest undone transaction; `undefined` when there is nothing to redo.
786
+ *
787
+ * # Errors
788
+ * As [`WasmDocument::undo`].
789
+ */
790
+ redo(): UndoOutcomeJs | undefined;
791
+ /**
792
+ * A save as a job, stepped with a budget of work units (ADR 0028 §3, §4).
793
+ *
794
+ * # Errors
795
+ * `invalid-argument` / `unknown-option` for bad options.
796
+ */
797
+ saveJob(options: SaveOptionsInit | undefined): WasmSaveJob;
798
+ /**
799
+ * Saves and rebases onto the output, running to completion: `{ bytes, report }`.
800
+ *
801
+ * # Errors
802
+ * The save's errors (`would-invalidate-signatures`, `requires-rewrite`, …).
803
+ */
804
+ save(options: SaveOptionsInit | undefined): { bytes: Uint8Array<ArrayBuffer>; report: SaveReportJs };
805
+ /**
806
+ * Undoes the newest transaction; `undefined` when there is nothing to undo.
807
+ *
808
+ * # Errors
809
+ * `nested-transaction`, `saved-not-rebased`; reading errors.
810
+ */
811
+ undo(): UndoOutcomeJs | undefined;
812
+ /**
813
+ * A cursor over the warnings so far (build warnings first), each as the §1 object.
814
+ */
815
+ warnings(): WasmWarningCursor;
816
+ }
817
+
818
+ /**
819
+ * An image to draw (decoded or passed through once, shared by every use).
820
+ */
821
+ export class WasmImage {
822
+ private constructor();
823
+ free(): void;
824
+ [Symbol.dispose](): void;
825
+ /**
826
+ * A JPEG, passed through (`DCTDecode`).
827
+ *
828
+ * # Errors
829
+ * `invalid-image`, `unsupported-image`.
830
+ */
831
+ static jpeg(bytes: Uint8Array): WasmImage;
832
+ /**
833
+ * A PNG (alpha as an `/SMask`).
834
+ *
835
+ * # Errors
836
+ * `invalid-image`, `unsupported-image`, `image-too-large`.
837
+ */
838
+ static png(bytes: Uint8Array): WasmImage;
839
+ /**
840
+ * Raw 8-bit RGBA pixels, row by row.
841
+ *
842
+ * # Errors
843
+ * `invalid-image` when the length isn't `width × height × 4`.
844
+ */
845
+ static rgba(width: number, height: number, rgba: Uint8Array): WasmImage;
846
+ /**
847
+ * Height in pixels.
848
+ */
849
+ readonly height: number;
850
+ /**
851
+ * Width in pixels.
852
+ */
853
+ readonly width: number;
854
+ }
855
+
856
+ /**
857
+ * A page of a [`WasmDocument`], held by its ID (F2): moving pages doesn't retarget it.
858
+ */
859
+ export class WasmPage {
860
+ private constructor();
861
+ free(): void;
862
+ [Symbol.dispose](): void;
863
+ /**
864
+ * The page's current 0-based index.
865
+ *
866
+ * # Errors
867
+ * `unknown-page` when the page is gone; reading errors.
868
+ */
869
+ index(): number;
870
+ /**
871
+ * The page's facts now.
872
+ *
873
+ * # Errors
874
+ * As [`WasmPage::index`].
875
+ */
876
+ info(): PageInfoJs;
877
+ /**
878
+ * The page's stable ID (`p12.0`).
879
+ */
880
+ readonly id: string;
881
+ }
882
+
883
+ /**
884
+ * One page being drawn, in page space (points from the top-left, y down; ADR 0027).
885
+ * Invalid geometry is reported by [`WasmPageBuilder::finish`] (`invalid-geometry`).
886
+ */
887
+ export class WasmPageBuilder {
888
+ private constructor();
889
+ free(): void;
890
+ [Symbol.dispose](): void;
891
+ /**
892
+ * Opens an artifact until the matching `endTag`: `kind` is `layout`, `page`, `pagination`
893
+ * or `background`.
894
+ *
895
+ * # Errors
896
+ * `invalid-argument` for another kind.
897
+ */
898
+ beginArtifact(kind: string): void;
899
+ /**
900
+ * Opens a structure element until the matching `endTag`: `kind` names a standard type
901
+ * (`Document`, `Part`, `Sect`, `H1`–`H6`, `P`, `L`, `LI`, `Lbl`, `LBody`, `Table`, `TR`,
902
+ * `TH`, `TD`, `Figure`, `Caption`, `Link`, `Span`, `Quote`, `Note`, `Code`), the role of
903
+ * `custom` when given; `/Alt`, `/ActualText`, `/Lang`, `/E`; `scope` is `row`, `column` or
904
+ * `both` when given.
905
+ *
906
+ * # Errors
907
+ * `invalid-argument` for an unknown `kind` or `scope`.
908
+ */
909
+ beginTag(kind: string, custom?: string | null, alt?: string | null, actualText?: string | null, lang?: string | null, expansion?: string | null, scope?: string | null): void;
910
+ /**
911
+ * The blend mode, camelCase (`multiply`, `colorDodge`, …).
912
+ *
913
+ * # Errors
914
+ * `invalid-argument` for an unknown mode.
915
+ */
916
+ blendMode(mode: string): void;
917
+ /**
918
+ * Clips to `path` (with `rule`) until the next `restore`.
919
+ *
920
+ * # Errors
921
+ * As [`WasmPageBuilder::fill_path`].
922
+ */
923
+ clipPath(path: Float64Array, rule: string): void;
924
+ /**
925
+ * Ends the innermost open element or artifact (none open: nothing happens).
926
+ *
927
+ * # Errors
928
+ * `builder-finished`.
929
+ */
930
+ endTag(): void;
931
+ /**
932
+ * The fill colour as `#rrggbb` or `#rgb` (`DeviceRGB`).
933
+ *
934
+ * # Errors
935
+ * `invalid-color`.
936
+ */
937
+ fillColorHex(hex: string): void;
938
+ /**
939
+ * The colour fills use: 1 (gray), 3 (RGB) or 4 (CMYK) components, 0 to 1.
940
+ *
941
+ * # Errors
942
+ * `invalid-argument` for another number of components.
943
+ */
944
+ fillColor(components: Float64Array): void;
945
+ /**
946
+ * Fills `path` (the flat path encoding) with `rule` (`nonZero` or `evenOdd`).
947
+ *
948
+ * # Errors
949
+ * `invalid-argument` for a bad path or rule.
950
+ */
951
+ fillPath(path: Float64Array, rule: string): void;
952
+ /**
953
+ * Fills `path` with `rule`, then strokes it with the current stroke style.
954
+ *
955
+ * # Errors
956
+ * As [`WasmPageBuilder::fill_path`].
957
+ */
958
+ fillStrokePath(path: Float64Array, rule: string): void;
959
+ /**
960
+ * Writes the page into its builder: content stream, resources and page dictionary.
961
+ * Returns its page ID. The page is finished afterwards: every later call on it fails
962
+ * with `builder-finished`.
963
+ *
964
+ * # Errors
965
+ * `builder-finished` (the page or its builder already finished); `invalid-geometry` for
966
+ * the first invalid value drawn; `unknown-font` for a font from another builder.
967
+ */
968
+ finish(): string;
969
+ /**
970
+ * Draws `image` scaled into the rectangle.
971
+ *
972
+ * # Errors
973
+ * `builder-finished`.
974
+ */
975
+ image(image: WasmImage, x: number, y: number, width: number, height: number): void;
976
+ /**
977
+ * A link annotation over the rectangle, with `contents` as its alternate text.
978
+ *
979
+ * # Errors
980
+ * `invalid-argument` / `unknown-option` for a bad target.
981
+ */
982
+ link(x: number, y: number, width: number, height: number, target: LinkTargetInit, contents?: string | null): void;
983
+ /**
984
+ * Fill and stroke opacity, 0 to 1 (an `ExtGState`).
985
+ *
986
+ * # Errors
987
+ * `builder-finished`.
988
+ */
989
+ opacity(fill: number, stroke: number): void;
990
+ /**
991
+ * Restores the graphics state (`Q`); one without a matching save is ignored.
992
+ *
993
+ * # Errors
994
+ * `builder-finished`.
995
+ */
996
+ restore(): void;
997
+ /**
998
+ * `/Rotate`: 0, 90, 180 or 270 degrees.
999
+ *
1000
+ * # Errors
1001
+ * `invalid-argument` for another angle.
1002
+ */
1003
+ rotate(degrees: number): void;
1004
+ /**
1005
+ * Saves the graphics state (`q`).
1006
+ *
1007
+ * # Errors
1008
+ * `builder-finished` after [`WasmPageBuilder::finish`] (so does every drawing method).
1009
+ */
1010
+ save(): void;
1011
+ /**
1012
+ * `/CropBox`, `/BleedBox`, `/TrimBox` or `/ArtBox` (`kind`: `crop`, `bleed`, `trim`,
1013
+ * `art`), in the media box's page space.
1014
+ *
1015
+ * # Errors
1016
+ * `invalid-argument` for another kind.
1017
+ */
1018
+ setBox(kind: "crop" | "bleed" | "trim" | "art", x: number, y: number, width: number, height: number): void;
1019
+ /**
1020
+ * The stroke colour as `#rrggbb` or `#rgb`.
1021
+ *
1022
+ * # Errors
1023
+ * `invalid-color`.
1024
+ */
1025
+ strokeColorHex(hex: string): void;
1026
+ /**
1027
+ * The colour strokes use (as [`WasmPageBuilder::fill_color`]).
1028
+ *
1029
+ * # Errors
1030
+ * As [`WasmPageBuilder::fill_color`].
1031
+ */
1032
+ strokeColor(components: Float64Array): void;
1033
+ /**
1034
+ * Strokes `path` with the current stroke style.
1035
+ *
1036
+ * # Errors
1037
+ * `invalid-argument` for a bad path.
1038
+ */
1039
+ strokePath(path: Float64Array): void;
1040
+ /**
1041
+ * The style later strokes use: `width` (points), `cap` (`butt`, `round`, `square`),
1042
+ * `join` (`miter`, `round`, `bevel`), the miter limit and a dash pattern (empty: solid).
1043
+ *
1044
+ * # Errors
1045
+ * `invalid-argument` for an unknown cap or join.
1046
+ */
1047
+ strokeStyle(width: number, cap: string, join: string, miterLimit: number, dash: Float64Array, dashPhase: number): void;
1048
+ /**
1049
+ * Applies `[a, b, c, d, e, f]` (page space) to what is drawn next.
1050
+ *
1051
+ * # Errors
1052
+ * `invalid-argument` unless there are 6 numbers.
1053
+ */
1054
+ transform(m: Float64Array): void;
1055
+ /**
1056
+ * `/UserUnit`, for pages larger than 14,400 units.
1057
+ */
1058
+ userUnit(unit: number): void;
1059
+ }
1060
+
1061
+ /**
1062
+ * A save in progress (F10). Each `step` checks that the document is unchanged since the
1063
+ * job was created (`document-changed`).
1064
+ */
1065
+ export class WasmSaveJob {
1066
+ private constructor();
1067
+ free(): void;
1068
+ [Symbol.dispose](): void;
1069
+ /**
1070
+ * Stops the job: its next step fails with `cancelled`.
1071
+ */
1072
+ cancel(): void;
1073
+ /**
1074
+ * Runs at most `budget` work units: `{ state: "progress", done, total?, phase }` or
1075
+ * `{ state: "done", bytes, report }`.
1076
+ *
1077
+ * # Errors
1078
+ * `cancelled`, `document-changed`, `job-finished`, or the save's own errors.
1079
+ */
1080
+ step(budget: number): ({ state: "progress" } & ProgressJs) | { state: "done"; bytes: Uint8Array<ArrayBuffer>; report: SaveReportJs };
1081
+ }
1082
+
1083
+ /**
1084
+ * A PDF of known size whose bytes arrive later: give it to `WasmDocument.openSource`, and
1085
+ * after a `data-pending` error `supply` the ranges in its `data.ranges` and call again.
1086
+ */
1087
+ export class WasmSparseSource {
1088
+ free(): void;
1089
+ [Symbol.dispose](): void;
1090
+ /**
1091
+ * An empty source of `size` bytes holding at most `budget` bytes (no limit when omitted).
1092
+ *
1093
+ * # Errors
1094
+ * `invalid-argument` when a number isn't a whole number of bytes.
1095
+ */
1096
+ constructor(size: number, budget?: number | null);
1097
+ /**
1098
+ * Adds `bytes` at `offset` (bytes already held win over overlapping ones).
1099
+ *
1100
+ * # Errors
1101
+ * `invalid-argument` past the end; `source-budget-exceeded` over the budget.
1102
+ */
1103
+ supply(offset: number, bytes: Uint8Array): void;
1104
+ /**
1105
+ * What to fetch for the ranges a `data-pending` asked for (flat `[start, end, …]`): each
1106
+ * widened to blocks of `block` bytes (0: as asked) plus `readahead`, merged, minus what is
1107
+ * held, in the same flat form. The planning step of `laminapdf-source`'s `retry`, so every
1108
+ * loop plans the same way.
1109
+ *
1110
+ * # Errors
1111
+ * `invalid-argument` for an odd length or a value that isn't a whole number of bytes.
1112
+ */
1113
+ toFetch(asked: Float64Array, block: number, readahead: number): Float64Array;
1114
+ /**
1115
+ * The source's size in bytes.
1116
+ */
1117
+ readonly size: number;
1118
+ }
1119
+
1120
+ /**
1121
+ * The warnings of a document, read in batches (F8).
1122
+ */
1123
+ export class WasmWarningCursor {
1124
+ private constructor();
1125
+ free(): void;
1126
+ [Symbol.dispose](): void;
1127
+ /**
1128
+ * Up to `max` more warnings, each as the ADR 0026 §1 object; empty at the end.
1129
+ */
1130
+ nextBatch(max: number): Diagnostic[];
1131
+ /**
1132
+ * How many warnings are left.
1133
+ */
1134
+ remaining(): number;
1135
+ }
1136
+
1137
+ /**
1138
+ * Whether this module is the text module (fonts, `text`, `textBox`).
1139
+ */
1140
+ export function hasText(): boolean;
1141
+
1142
+ /**
1143
+ * The crate version (`@laminapdf/wasm`'s).
1144
+ */
1145
+ export function version(): string;
1146
+
1147
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
1148
+
1149
+ export interface InitOutput {
1150
+ readonly memory: WebAssembly.Memory;
1151
+ readonly __wbg_wasmbuilder_free: (a: number, b: number) => void;
1152
+ readonly __wbg_wasmdocument_free: (a: number, b: number) => void;
1153
+ readonly __wbg_wasmimage_free: (a: number, b: number) => void;
1154
+ readonly __wbg_wasmpage_free: (a: number, b: number) => void;
1155
+ readonly __wbg_wasmpagebuilder_free: (a: number, b: number) => void;
1156
+ readonly __wbg_wasmsavejob_free: (a: number, b: number) => void;
1157
+ readonly __wbg_wasmsparsesource_free: (a: number, b: number) => void;
1158
+ readonly __wbg_wasmwarningcursor_free: (a: number, b: number) => void;
1159
+ readonly hasText: () => number;
1160
+ readonly version: () => [number, number];
1161
+ readonly wasmbuilder_attach: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: any) => [number, number];
1162
+ readonly wasmbuilder_destination: (a: number, b: number, c: number, d: number, e: any) => [number, number];
1163
+ readonly wasmbuilder_finish: (a: number) => [number, number, number];
1164
+ readonly wasmbuilder_lang: (a: number, b: number, c: number) => [number, number];
1165
+ readonly wasmbuilder_metadata: (a: number, b: any) => [number, number];
1166
+ readonly wasmbuilder_new: (a: any) => [number, number, number];
1167
+ readonly wasmbuilder_outline: (a: number, b: any) => [number, number, number];
1168
+ readonly wasmbuilder_page: (a: number, b: number, c: number) => number;
1169
+ readonly wasmbuilder_pageLabels: (a: number, b: any) => [number, number];
1170
+ readonly wasmbuilder_viewerPreferences: (a: number, b: any) => [number, number];
1171
+ readonly wasmdocument_apply: (a: number, b: any) => [number, number, number];
1172
+ readonly wasmdocument_applyLog: (a: number, b: number, c: number) => [number, number, number];
1173
+ readonly wasmdocument_hasUnsavedChanges: (a: number) => number;
1174
+ readonly wasmdocument_info: (a: number) => [number, number, number];
1175
+ readonly wasmdocument_openBytes: (a: number, b: number, c: any) => [number, number, number];
1176
+ readonly wasmdocument_openSource: (a: number, b: any) => [number, number, number];
1177
+ readonly wasmdocument_page: (a: number, b: number) => [number, number, number];
1178
+ readonly wasmdocument_pageById: (a: number, b: number, c: number) => [number, number, number];
1179
+ readonly wasmdocument_pageCount: (a: number) => [number, number, number];
1180
+ readonly wasmdocument_pageInfo: (a: number, b: number) => [number, number, number];
1181
+ readonly wasmdocument_pageInfos: (a: number) => [number, number, number];
1182
+ readonly wasmdocument_rebase: (a: number, b: number, c: number) => [number, number];
1183
+ readonly wasmdocument_redo: (a: number) => [number, number, number];
1184
+ readonly wasmdocument_save: (a: number, b: any) => [number, number, number];
1185
+ readonly wasmdocument_saveJob: (a: number, b: any) => [number, number, number];
1186
+ readonly wasmdocument_undo: (a: number) => [number, number, number];
1187
+ readonly wasmdocument_warnings: (a: number) => number;
1188
+ readonly wasmimage_height: (a: number) => number;
1189
+ readonly wasmimage_jpeg: (a: number, b: number) => [number, number, number];
1190
+ readonly wasmimage_png: (a: number, b: number) => [number, number, number];
1191
+ readonly wasmimage_rgba: (a: number, b: number, c: number, d: number) => [number, number, number];
1192
+ readonly wasmimage_width: (a: number) => number;
1193
+ readonly wasmpage_id: (a: number) => [number, number];
1194
+ readonly wasmpage_index: (a: number) => [number, number, number];
1195
+ readonly wasmpage_info: (a: number) => [number, number, number];
1196
+ readonly wasmpagebuilder_beginArtifact: (a: number, b: number, c: number) => [number, number];
1197
+ readonly wasmpagebuilder_beginTag: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number) => [number, number];
1198
+ readonly wasmpagebuilder_blendMode: (a: number, b: number, c: number) => [number, number];
1199
+ readonly wasmpagebuilder_clipPath: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1200
+ readonly wasmpagebuilder_endTag: (a: number) => [number, number];
1201
+ readonly wasmpagebuilder_fillColor: (a: number, b: number, c: number) => [number, number];
1202
+ readonly wasmpagebuilder_fillColorHex: (a: number, b: number, c: number) => [number, number];
1203
+ readonly wasmpagebuilder_fillPath: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1204
+ readonly wasmpagebuilder_fillStrokePath: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1205
+ readonly wasmpagebuilder_finish: (a: number) => [number, number, number, number];
1206
+ readonly wasmpagebuilder_image: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1207
+ readonly wasmpagebuilder_link: (a: number, b: number, c: number, d: number, e: number, f: any, g: number, h: number) => [number, number];
1208
+ readonly wasmpagebuilder_opacity: (a: number, b: number, c: number) => [number, number];
1209
+ readonly wasmpagebuilder_restore: (a: number) => [number, number];
1210
+ readonly wasmpagebuilder_rotate: (a: number, b: number) => [number, number];
1211
+ readonly wasmpagebuilder_save: (a: number) => [number, number];
1212
+ readonly wasmpagebuilder_setBox: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
1213
+ readonly wasmpagebuilder_strokeColor: (a: number, b: number, c: number) => [number, number];
1214
+ readonly wasmpagebuilder_strokeColorHex: (a: number, b: number, c: number) => [number, number];
1215
+ readonly wasmpagebuilder_strokePath: (a: number, b: number, c: number) => [number, number];
1216
+ readonly wasmpagebuilder_strokeStyle: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
1217
+ readonly wasmpagebuilder_transform: (a: number, b: number, c: number) => [number, number];
1218
+ readonly wasmpagebuilder_userUnit: (a: number, b: number) => void;
1219
+ readonly wasmsavejob_cancel: (a: number) => void;
1220
+ readonly wasmsavejob_step: (a: number, b: number) => [number, number, number];
1221
+ readonly wasmsparsesource_new: (a: number, b: number, c: number) => [number, number, number];
1222
+ readonly wasmsparsesource_size: (a: number) => number;
1223
+ readonly wasmsparsesource_supply: (a: number, b: number, c: number, d: number) => [number, number];
1224
+ readonly wasmsparsesource_toFetch: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
1225
+ readonly wasmwarningcursor_nextBatch: (a: number, b: number) => any;
1226
+ readonly wasmwarningcursor_remaining: (a: number) => number;
1227
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
1228
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
1229
+ readonly __wbindgen_exn_store: (a: number) => void;
1230
+ readonly __externref_table_alloc: () => number;
1231
+ readonly __wbindgen_externrefs: WebAssembly.Table;
1232
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
1233
+ readonly __externref_table_dealloc: (a: number) => void;
1234
+ readonly __wbindgen_start: () => void;
1235
+ }
1236
+
1237
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
1238
+
1239
+ /**
1240
+ * Instantiates the given `module`, which can either be bytes or
1241
+ * a precompiled `WebAssembly.Module`.
1242
+ *
1243
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
1244
+ *
1245
+ * @returns {InitOutput}
1246
+ */
1247
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
1248
+
1249
+ /**
1250
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
1251
+ * for everything else, calls `WebAssembly.instantiate` directly.
1252
+ *
1253
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
1254
+ *
1255
+ * @returns {Promise<InitOutput>}
1256
+ */
1257
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;