@laminapdf/wasm 0.0.0-stage → 0.2.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -2
- package/dist/lamina_pdf_base.d.ts +1268 -0
- package/dist/lamina_pdf_base.js +1718 -0
- package/dist/lamina_pdf_base.wasm +0 -0
- package/dist/lamina_pdf_extract.d.ts +1450 -0
- package/dist/lamina_pdf_extract.js +1808 -0
- package/dist/lamina_pdf_extract.wasm +0 -0
- package/dist/lamina_pdf_render_hayro.d.ts +114 -0
- package/dist/lamina_pdf_render_hayro.js +459 -0
- package/dist/lamina_pdf_render_hayro.wasm +0 -0
- package/dist/lamina_pdf_text.d.ts +1692 -0
- package/dist/lamina_pdf_text.js +1973 -0
- package/dist/lamina_pdf_text.wasm +0 -0
- package/package.json +60 -3
|
Binary file
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A document open in hayro.
|
|
6
|
+
*/
|
|
7
|
+
export class HayroDocument {
|
|
8
|
+
private constructor();
|
|
9
|
+
free(): void;
|
|
10
|
+
[Symbol.dispose](): void;
|
|
11
|
+
/**
|
|
12
|
+
* Opens `input` (moved into the document; hayro borrows it, no second copy). The limits
|
|
13
|
+
* are the JS `RenderLimits`, applied as given (0 pixels refuses every render).
|
|
14
|
+
*
|
|
15
|
+
* # Errors
|
|
16
|
+
* The render errors of opening, thrown as ADR 0026 §1 objects.
|
|
17
|
+
*/
|
|
18
|
+
static open(input: InputBuffer, password: string | null | undefined, max_render_pixels: number, max_render_side: number, max_input_bytes: number): HayroDocument;
|
|
19
|
+
/**
|
|
20
|
+
* The number of pages.
|
|
21
|
+
*/
|
|
22
|
+
pageCount(): number;
|
|
23
|
+
/**
|
|
24
|
+
* Page `index`'s `[width, height, rotate]` (displayed points, `/Rotate` in degrees).
|
|
25
|
+
*
|
|
26
|
+
* # Errors
|
|
27
|
+
* `page-index-out-of-range`.
|
|
28
|
+
*/
|
|
29
|
+
page(index: number): Float32Array;
|
|
30
|
+
/**
|
|
31
|
+
* The request's geometry: `[pageWidth, pageHeight, x, y, width, height]` in pixels.
|
|
32
|
+
*
|
|
33
|
+
* # Errors
|
|
34
|
+
* `invalid-argument`, `render-too-large`, `page-index-out-of-range`.
|
|
35
|
+
*/
|
|
36
|
+
plan(page: number, scale: number, x: number, y: number, width: number, height: number, rotation: number, flags: number, background?: number | null): Uint32Array;
|
|
37
|
+
/**
|
|
38
|
+
* Renders the request into `out` (exactly `width × height × 4` bytes, straight RGBA).
|
|
39
|
+
*
|
|
40
|
+
* # Errors
|
|
41
|
+
* As [`HayroDocument::plan`], plus `render-failed` and `invalid-argument` for a wrong size.
|
|
42
|
+
*/
|
|
43
|
+
render(page: number, scale: number, x: number, y: number, width: number, height: number, rotation: number, flags: number, background: number | null | undefined, out: Uint8Array): void;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The input, filled chunk by chunk from JS so the whole file is never copied twice: the
|
|
48
|
+
* wrapper reads its `RenderSource` in 64 KiB pieces straight into this buffer, which `open` then
|
|
49
|
+
* moves into the document (hayro borrows it).
|
|
50
|
+
*/
|
|
51
|
+
export class InputBuffer {
|
|
52
|
+
free(): void;
|
|
53
|
+
[Symbol.dispose](): void;
|
|
54
|
+
/**
|
|
55
|
+
* A zeroed buffer of `len` bytes, reserved fallibly: in this `panic = "abort"` module a
|
|
56
|
+
* failed allocation must be an error, not a trap that breaks the instance.
|
|
57
|
+
*
|
|
58
|
+
* # Errors
|
|
59
|
+
* `render-too-large` when the module's memory can't grow by `len` bytes.
|
|
60
|
+
*/
|
|
61
|
+
constructor(len: number);
|
|
62
|
+
/**
|
|
63
|
+
* Copies `chunk` to `offset`.
|
|
64
|
+
*
|
|
65
|
+
* # Errors
|
|
66
|
+
* `invalid-argument` when the chunk doesn't fit.
|
|
67
|
+
*/
|
|
68
|
+
write(offset: number, chunk: Uint8Array): void;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
72
|
+
|
|
73
|
+
export interface InitOutput {
|
|
74
|
+
readonly memory: WebAssembly.Memory;
|
|
75
|
+
readonly __wbg_hayrodocument_free: (a: number, b: number) => void;
|
|
76
|
+
readonly __wbg_inputbuffer_free: (a: number, b: number) => void;
|
|
77
|
+
readonly hayrodocument_open: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
78
|
+
readonly hayrodocument_page: (a: number, b: number) => [number, number, number, number];
|
|
79
|
+
readonly hayrodocument_pageCount: (a: number) => number;
|
|
80
|
+
readonly hayrodocument_plan: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number, number];
|
|
81
|
+
readonly hayrodocument_render: (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: any) => [number, number];
|
|
82
|
+
readonly inputbuffer_new: (a: number) => [number, number, number];
|
|
83
|
+
readonly inputbuffer_write: (a: number, b: number, c: number, d: number) => [number, number];
|
|
84
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
85
|
+
readonly __externref_table_alloc: () => number;
|
|
86
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
87
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
88
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
89
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
90
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
91
|
+
readonly __wbindgen_start: () => void;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
98
|
+
* a precompiled `WebAssembly.Module`.
|
|
99
|
+
*
|
|
100
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
101
|
+
*
|
|
102
|
+
* @returns {InitOutput}
|
|
103
|
+
*/
|
|
104
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
108
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
109
|
+
*
|
|
110
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
111
|
+
*
|
|
112
|
+
* @returns {Promise<InitOutput>}
|
|
113
|
+
*/
|
|
114
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
/* @ts-self-types="./lamina_pdf_render_hayro.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A document open in hayro.
|
|
5
|
+
*/
|
|
6
|
+
export class HayroDocument {
|
|
7
|
+
static __wrap(ptr) {
|
|
8
|
+
const obj = Object.create(HayroDocument.prototype);
|
|
9
|
+
obj.__wbg_ptr = ptr;
|
|
10
|
+
HayroDocumentFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
11
|
+
return obj;
|
|
12
|
+
}
|
|
13
|
+
__destroy_into_raw() {
|
|
14
|
+
const ptr = this.__wbg_ptr;
|
|
15
|
+
this.__wbg_ptr = 0;
|
|
16
|
+
HayroDocumentFinalization.unregister(this);
|
|
17
|
+
return ptr;
|
|
18
|
+
}
|
|
19
|
+
free() {
|
|
20
|
+
const ptr = this.__destroy_into_raw();
|
|
21
|
+
wasm.__wbg_hayrodocument_free(ptr, 0);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Opens `input` (moved into the document; hayro borrows it, no second copy). The limits
|
|
25
|
+
* are the JS `RenderLimits`, applied as given (0 pixels refuses every render).
|
|
26
|
+
*
|
|
27
|
+
* # Errors
|
|
28
|
+
* The render errors of opening, thrown as ADR 0026 §1 objects.
|
|
29
|
+
* @param {InputBuffer} input
|
|
30
|
+
* @param {string | null | undefined} password
|
|
31
|
+
* @param {number} max_render_pixels
|
|
32
|
+
* @param {number} max_render_side
|
|
33
|
+
* @param {number} max_input_bytes
|
|
34
|
+
* @returns {HayroDocument}
|
|
35
|
+
*/
|
|
36
|
+
static open(input, password, max_render_pixels, max_render_side, max_input_bytes) {
|
|
37
|
+
_assertClass(input, InputBuffer);
|
|
38
|
+
var ptr0 = input.__destroy_into_raw();
|
|
39
|
+
var ptr1 = isLikeNone(password) ? 0 : passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
40
|
+
var len1 = WASM_VECTOR_LEN;
|
|
41
|
+
const ret = wasm.hayrodocument_open(ptr0, ptr1, len1, max_render_pixels, max_render_side, max_input_bytes);
|
|
42
|
+
if (ret[2]) {
|
|
43
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
44
|
+
}
|
|
45
|
+
return HayroDocument.__wrap(ret[0]);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The number of pages.
|
|
49
|
+
* @returns {number}
|
|
50
|
+
*/
|
|
51
|
+
pageCount() {
|
|
52
|
+
const ret = wasm.hayrodocument_pageCount(this.__wbg_ptr);
|
|
53
|
+
return ret >>> 0;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Page `index`'s `[width, height, rotate]` (displayed points, `/Rotate` in degrees).
|
|
57
|
+
*
|
|
58
|
+
* # Errors
|
|
59
|
+
* `page-index-out-of-range`.
|
|
60
|
+
* @param {number} index
|
|
61
|
+
* @returns {Float32Array}
|
|
62
|
+
*/
|
|
63
|
+
page(index) {
|
|
64
|
+
const ret = wasm.hayrodocument_page(this.__wbg_ptr, index);
|
|
65
|
+
if (ret[3]) {
|
|
66
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
67
|
+
}
|
|
68
|
+
var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
69
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
70
|
+
return v1;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The request's geometry: `[pageWidth, pageHeight, x, y, width, height]` in pixels.
|
|
74
|
+
*
|
|
75
|
+
* # Errors
|
|
76
|
+
* `invalid-argument`, `render-too-large`, `page-index-out-of-range`.
|
|
77
|
+
* @param {number} page
|
|
78
|
+
* @param {number} scale
|
|
79
|
+
* @param {number} x
|
|
80
|
+
* @param {number} y
|
|
81
|
+
* @param {number} width
|
|
82
|
+
* @param {number} height
|
|
83
|
+
* @param {number} rotation
|
|
84
|
+
* @param {number} flags
|
|
85
|
+
* @param {number | null} [background]
|
|
86
|
+
* @returns {Uint32Array}
|
|
87
|
+
*/
|
|
88
|
+
plan(page, scale, x, y, width, height, rotation, flags, background) {
|
|
89
|
+
const ret = wasm.hayrodocument_plan(this.__wbg_ptr, page, scale, x, y, width, height, rotation, flags, isLikeNone(background) ? Number.MAX_SAFE_INTEGER : (background) >>> 0);
|
|
90
|
+
if (ret[3]) {
|
|
91
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
92
|
+
}
|
|
93
|
+
var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
94
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
95
|
+
return v1;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Renders the request into `out` (exactly `width × height × 4` bytes, straight RGBA).
|
|
99
|
+
*
|
|
100
|
+
* # Errors
|
|
101
|
+
* As [`HayroDocument::plan`], plus `render-failed` and `invalid-argument` for a wrong size.
|
|
102
|
+
* @param {number} page
|
|
103
|
+
* @param {number} scale
|
|
104
|
+
* @param {number} x
|
|
105
|
+
* @param {number} y
|
|
106
|
+
* @param {number} width
|
|
107
|
+
* @param {number} height
|
|
108
|
+
* @param {number} rotation
|
|
109
|
+
* @param {number} flags
|
|
110
|
+
* @param {number | null | undefined} background
|
|
111
|
+
* @param {Uint8Array} out
|
|
112
|
+
*/
|
|
113
|
+
render(page, scale, x, y, width, height, rotation, flags, background, out) {
|
|
114
|
+
var ptr0 = passArray8ToWasm0(out, wasm.__wbindgen_malloc);
|
|
115
|
+
var len0 = WASM_VECTOR_LEN;
|
|
116
|
+
const ret = wasm.hayrodocument_render(this.__wbg_ptr, page, scale, x, y, width, height, rotation, flags, isLikeNone(background) ? Number.MAX_SAFE_INTEGER : (background) >>> 0, ptr0, len0, out);
|
|
117
|
+
if (ret[1]) {
|
|
118
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (Symbol.dispose) HayroDocument.prototype[Symbol.dispose] = HayroDocument.prototype.free;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The input, filled chunk by chunk from JS so the whole file is never copied twice: the
|
|
126
|
+
* wrapper reads its `RenderSource` in 64 KiB pieces straight into this buffer, which `open` then
|
|
127
|
+
* moves into the document (hayro borrows it).
|
|
128
|
+
*/
|
|
129
|
+
export class InputBuffer {
|
|
130
|
+
__destroy_into_raw() {
|
|
131
|
+
const ptr = this.__wbg_ptr;
|
|
132
|
+
this.__wbg_ptr = 0;
|
|
133
|
+
InputBufferFinalization.unregister(this);
|
|
134
|
+
return ptr;
|
|
135
|
+
}
|
|
136
|
+
free() {
|
|
137
|
+
const ptr = this.__destroy_into_raw();
|
|
138
|
+
wasm.__wbg_inputbuffer_free(ptr, 0);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* A zeroed buffer of `len` bytes, reserved fallibly: in this `panic = "abort"` module a
|
|
142
|
+
* failed allocation must be an error, not a trap that breaks the instance.
|
|
143
|
+
*
|
|
144
|
+
* # Errors
|
|
145
|
+
* `render-too-large` when the module's memory can't grow by `len` bytes.
|
|
146
|
+
* @param {number} len
|
|
147
|
+
*/
|
|
148
|
+
constructor(len) {
|
|
149
|
+
const ret = wasm.inputbuffer_new(len);
|
|
150
|
+
if (ret[2]) {
|
|
151
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
152
|
+
}
|
|
153
|
+
this.__wbg_ptr = ret[0];
|
|
154
|
+
InputBufferFinalization.register(this, this.__wbg_ptr, this);
|
|
155
|
+
return this;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Copies `chunk` to `offset`.
|
|
159
|
+
*
|
|
160
|
+
* # Errors
|
|
161
|
+
* `invalid-argument` when the chunk doesn't fit.
|
|
162
|
+
* @param {number} offset
|
|
163
|
+
* @param {Uint8Array} chunk
|
|
164
|
+
*/
|
|
165
|
+
write(offset, chunk) {
|
|
166
|
+
const ptr0 = passArray8ToWasm0(chunk, wasm.__wbindgen_malloc);
|
|
167
|
+
const len0 = WASM_VECTOR_LEN;
|
|
168
|
+
const ret = wasm.inputbuffer_write(this.__wbg_ptr, offset, ptr0, len0);
|
|
169
|
+
if (ret[1]) {
|
|
170
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (Symbol.dispose) InputBuffer.prototype[Symbol.dispose] = InputBuffer.prototype.free;
|
|
175
|
+
function __wbg_get_imports() {
|
|
176
|
+
const import0 = {
|
|
177
|
+
__proto__: null,
|
|
178
|
+
__wbg___wbindgen_copy_to_typed_array_88899a52af046901: function(arg0, arg1, arg2) {
|
|
179
|
+
new Uint8Array(arg2.buffer, arg2.byteOffset, arg2.byteLength).set(getArrayU8FromWasm0(arg0, arg1));
|
|
180
|
+
},
|
|
181
|
+
__wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
|
|
182
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
183
|
+
},
|
|
184
|
+
__wbg_new_343a093a3c2ffb4e: function(arg0, arg1) {
|
|
185
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
186
|
+
return ret;
|
|
187
|
+
},
|
|
188
|
+
__wbg_parse_0fc53dead14b3b42: function() { return handleError(function (arg0, arg1) {
|
|
189
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
190
|
+
return ret;
|
|
191
|
+
}, arguments); },
|
|
192
|
+
__wbindgen_init_externref_table: function() {
|
|
193
|
+
const table = wasm.__wbindgen_externrefs;
|
|
194
|
+
const offset = table.grow(4);
|
|
195
|
+
table.set(0, undefined);
|
|
196
|
+
table.set(offset + 0, undefined);
|
|
197
|
+
table.set(offset + 1, null);
|
|
198
|
+
table.set(offset + 2, true);
|
|
199
|
+
table.set(offset + 3, false);
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
return {
|
|
203
|
+
__proto__: null,
|
|
204
|
+
"./lamina_pdf_render_hayro_bg.js": import0,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const HayroDocumentFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
209
|
+
? { register: () => {}, unregister: () => {} }
|
|
210
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_hayrodocument_free(ptr, 1));
|
|
211
|
+
const InputBufferFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
212
|
+
? { register: () => {}, unregister: () => {} }
|
|
213
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_inputbuffer_free(ptr, 1));
|
|
214
|
+
|
|
215
|
+
function addToExternrefTable0(obj) {
|
|
216
|
+
const idx = wasm.__externref_table_alloc();
|
|
217
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
218
|
+
return idx;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function _assertClass(instance, klass) {
|
|
222
|
+
if (!(instance instanceof klass)) {
|
|
223
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function getArrayF32FromWasm0(ptr, len) {
|
|
228
|
+
ptr = ptr >>> 0;
|
|
229
|
+
return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
233
|
+
ptr = ptr >>> 0;
|
|
234
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
238
|
+
ptr = ptr >>> 0;
|
|
239
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
let cachedFloat32ArrayMemory0 = null;
|
|
243
|
+
function getFloat32ArrayMemory0() {
|
|
244
|
+
if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
|
|
245
|
+
cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
|
|
246
|
+
}
|
|
247
|
+
return cachedFloat32ArrayMemory0;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function getStringFromWasm0(ptr, len) {
|
|
251
|
+
return decodeText(ptr >>> 0, len);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
let cachedUint32ArrayMemory0 = null;
|
|
255
|
+
function getUint32ArrayMemory0() {
|
|
256
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
257
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
258
|
+
}
|
|
259
|
+
return cachedUint32ArrayMemory0;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
let cachedUint8ArrayMemory0 = null;
|
|
263
|
+
function getUint8ArrayMemory0() {
|
|
264
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
265
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
266
|
+
}
|
|
267
|
+
return cachedUint8ArrayMemory0;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function handleError(f, args) {
|
|
271
|
+
try {
|
|
272
|
+
return f.apply(this, args);
|
|
273
|
+
} catch (e) {
|
|
274
|
+
const idx = addToExternrefTable0(e);
|
|
275
|
+
wasm.__wbindgen_exn_store(idx);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function isLikeNone(x) {
|
|
280
|
+
return x === undefined || x === null;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
284
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
285
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
286
|
+
WASM_VECTOR_LEN = arg.length;
|
|
287
|
+
return ptr;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
291
|
+
if (realloc === undefined) {
|
|
292
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
293
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
294
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
295
|
+
WASM_VECTOR_LEN = buf.length;
|
|
296
|
+
return ptr;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
let len = arg.length;
|
|
300
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
301
|
+
|
|
302
|
+
const mem = getUint8ArrayMemory0();
|
|
303
|
+
|
|
304
|
+
let offset = 0;
|
|
305
|
+
|
|
306
|
+
for (; offset < len; offset++) {
|
|
307
|
+
const code = arg.charCodeAt(offset);
|
|
308
|
+
if (code > 0x7F) break;
|
|
309
|
+
mem[ptr + offset] = code;
|
|
310
|
+
}
|
|
311
|
+
if (offset !== len) {
|
|
312
|
+
if (offset !== 0) {
|
|
313
|
+
arg = arg.slice(offset);
|
|
314
|
+
}
|
|
315
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
316
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
317
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
318
|
+
|
|
319
|
+
offset += ret.written;
|
|
320
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
WASM_VECTOR_LEN = offset;
|
|
324
|
+
return ptr;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function takeFromExternrefTable0(idx) {
|
|
328
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
329
|
+
wasm.__externref_table_dealloc(idx);
|
|
330
|
+
return value;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
334
|
+
cachedTextDecoder.decode();
|
|
335
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
336
|
+
let numBytesDecoded = 0;
|
|
337
|
+
function decodeText(ptr, len) {
|
|
338
|
+
numBytesDecoded += len;
|
|
339
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
340
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
341
|
+
cachedTextDecoder.decode();
|
|
342
|
+
numBytesDecoded = len;
|
|
343
|
+
}
|
|
344
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
const cachedTextEncoder = new TextEncoder();
|
|
348
|
+
|
|
349
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
350
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
351
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
352
|
+
view.set(buf);
|
|
353
|
+
return {
|
|
354
|
+
read: arg.length,
|
|
355
|
+
written: buf.length
|
|
356
|
+
};
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
let WASM_VECTOR_LEN = 0;
|
|
361
|
+
|
|
362
|
+
let wasmModule, wasmInstance, wasm;
|
|
363
|
+
function __wbg_finalize_init(instance, module) {
|
|
364
|
+
wasmInstance = instance;
|
|
365
|
+
wasm = instance.exports;
|
|
366
|
+
wasmModule = module;
|
|
367
|
+
cachedFloat32ArrayMemory0 = null;
|
|
368
|
+
cachedUint32ArrayMemory0 = null;
|
|
369
|
+
cachedUint8ArrayMemory0 = null;
|
|
370
|
+
wasm.__wbindgen_start();
|
|
371
|
+
return wasm;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
async function __wbg_load(module, imports) {
|
|
375
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
376
|
+
if (!module.ok) {
|
|
377
|
+
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
381
|
+
try {
|
|
382
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
383
|
+
} catch (e) {
|
|
384
|
+
const validResponse = expectedResponseType(module.type);
|
|
385
|
+
|
|
386
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
387
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
388
|
+
|
|
389
|
+
} else { throw e; }
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
const bytes = await module.arrayBuffer();
|
|
394
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
395
|
+
} else {
|
|
396
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
397
|
+
|
|
398
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
399
|
+
return { instance, module };
|
|
400
|
+
} else {
|
|
401
|
+
return instance;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
function expectedResponseType(type) {
|
|
406
|
+
switch (type) {
|
|
407
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
408
|
+
}
|
|
409
|
+
return false;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
function initSync(module) {
|
|
414
|
+
if (wasm !== undefined) return wasm;
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
if (module !== undefined) {
|
|
418
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
419
|
+
({module} = module)
|
|
420
|
+
} else {
|
|
421
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
const imports = __wbg_get_imports();
|
|
426
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
427
|
+
module = new WebAssembly.Module(module);
|
|
428
|
+
}
|
|
429
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
430
|
+
return __wbg_finalize_init(instance, module);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
async function __wbg_init(module_or_path) {
|
|
434
|
+
if (wasm !== undefined) return wasm;
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
if (module_or_path !== undefined) {
|
|
438
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
439
|
+
({module_or_path} = module_or_path)
|
|
440
|
+
} else {
|
|
441
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
if (module_or_path === undefined) {
|
|
446
|
+
module_or_path = new URL('lamina_pdf_render_hayro.wasm', import.meta.url);
|
|
447
|
+
}
|
|
448
|
+
const imports = __wbg_get_imports();
|
|
449
|
+
|
|
450
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
451
|
+
module_or_path = fetch(module_or_path);
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
455
|
+
|
|
456
|
+
return __wbg_finalize_init(instance, module);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|