@iyulab/unpdf 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +87 -0
- package/package.json +30 -0
- package/unpdf_wasm.d.ts +28 -0
- package/unpdf_wasm.js +9 -0
- package/unpdf_wasm_bg.js +345 -0
- package/unpdf_wasm_bg.wasm +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 iyulab
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# @iyulab/unpdf
|
|
2
|
+
|
|
3
|
+
High-performance PDF extraction to Markdown, text, and JSON — WebAssembly build.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @iyulab/unpdf
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Browser / Bundler (webpack, vite)
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import init, { parse, ParseOptions } from '@iyulab/unpdf';
|
|
17
|
+
|
|
18
|
+
await init();
|
|
19
|
+
|
|
20
|
+
const response = await fetch('document.pdf');
|
|
21
|
+
const bytes = new Uint8Array(await response.arrayBuffer());
|
|
22
|
+
|
|
23
|
+
const doc = parse(bytes);
|
|
24
|
+
console.log(doc.toMarkdown());
|
|
25
|
+
console.log(doc.toText());
|
|
26
|
+
console.log(`Pages: ${doc.pageCount()}`);
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### With Options
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
import init, { parseWithOptions, ParseOptions } from '@iyulab/unpdf';
|
|
33
|
+
|
|
34
|
+
await init();
|
|
35
|
+
|
|
36
|
+
const opts = new ParseOptions()
|
|
37
|
+
.lenient()
|
|
38
|
+
.withPassword("secret")
|
|
39
|
+
.withPages(1, 5);
|
|
40
|
+
|
|
41
|
+
const doc = parseWithOptions(bytes, opts);
|
|
42
|
+
console.log(doc.toMarkdown());
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Node.js
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
const { parse } = require('@iyulab/unpdf');
|
|
49
|
+
const fs = require('fs');
|
|
50
|
+
|
|
51
|
+
const bytes = fs.readFileSync('document.pdf');
|
|
52
|
+
const doc = parse(new Uint8Array(bytes));
|
|
53
|
+
console.log(doc.toText());
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## API
|
|
57
|
+
|
|
58
|
+
### Functions
|
|
59
|
+
|
|
60
|
+
| Function | Signature | Description |
|
|
61
|
+
|----------|-----------|-------------|
|
|
62
|
+
| `parse` | `(data: Uint8Array) => PdfDocument` | PDF 바이트 파싱 |
|
|
63
|
+
| `parseWithOptions` | `(data: Uint8Array, opts: ParseOptions) => PdfDocument` | 옵션 지정 파싱 |
|
|
64
|
+
|
|
65
|
+
### PdfDocument
|
|
66
|
+
|
|
67
|
+
| Method | Returns | Description |
|
|
68
|
+
|--------|---------|-------------|
|
|
69
|
+
| `toMarkdown()` | `string` | Markdown 변환 |
|
|
70
|
+
| `toText()` | `string` | Plain text 변환 |
|
|
71
|
+
| `toJson()` | `string` | JSON 변환 |
|
|
72
|
+
| `pageCount()` | `number` | 총 페이지 수 |
|
|
73
|
+
| `metadata()` | `string` | 메타데이터 JSON |
|
|
74
|
+
|
|
75
|
+
### ParseOptions
|
|
76
|
+
|
|
77
|
+
| Method | Description |
|
|
78
|
+
|--------|-------------|
|
|
79
|
+
| `new()` | 기본 옵션 생성 |
|
|
80
|
+
| `lenient()` | 오류 무시 모드 |
|
|
81
|
+
| `textOnly()` | 텍스트만 추출 |
|
|
82
|
+
| `withPassword(pw: string)` | 비밀번호 설정 |
|
|
83
|
+
| `withPages(from: number, to: number)` | 페이지 범위 설정 (1-indexed) |
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@iyulab/unpdf",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"description": "High-performance PDF extraction to Markdown, text, and JSON (WebAssembly)",
|
|
5
|
+
"version": "0.7.0",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/iyulab/unpdf"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"unpdf_wasm_bg.wasm",
|
|
13
|
+
"unpdf_wasm.js",
|
|
14
|
+
"unpdf_wasm_bg.js",
|
|
15
|
+
"unpdf_wasm.d.ts"
|
|
16
|
+
],
|
|
17
|
+
"main": "unpdf_wasm.js",
|
|
18
|
+
"types": "unpdf_wasm.d.ts",
|
|
19
|
+
"sideEffects": [
|
|
20
|
+
"./unpdf_wasm.js",
|
|
21
|
+
"./snippets/*"
|
|
22
|
+
],
|
|
23
|
+
"keywords": [
|
|
24
|
+
"pdf",
|
|
25
|
+
"markdown",
|
|
26
|
+
"wasm",
|
|
27
|
+
"webassembly",
|
|
28
|
+
"text-extraction"
|
|
29
|
+
]
|
|
30
|
+
}
|
package/unpdf_wasm.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class ParseOptions {
|
|
5
|
+
free(): void;
|
|
6
|
+
[Symbol.dispose](): void;
|
|
7
|
+
lenient(): ParseOptions;
|
|
8
|
+
constructor();
|
|
9
|
+
textOnly(): ParseOptions;
|
|
10
|
+
withPages(from: number, to: number): ParseOptions;
|
|
11
|
+
withPassword(password: string): ParseOptions;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class PdfDocument {
|
|
15
|
+
private constructor();
|
|
16
|
+
free(): void;
|
|
17
|
+
[Symbol.dispose](): void;
|
|
18
|
+
static fromBytes(data: Uint8Array): PdfDocument;
|
|
19
|
+
metadata(): string;
|
|
20
|
+
pageCount(): number;
|
|
21
|
+
toJson(): string;
|
|
22
|
+
toMarkdown(): string;
|
|
23
|
+
toText(): string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function parse(data: Uint8Array): PdfDocument;
|
|
27
|
+
|
|
28
|
+
export function parseWithOptions(data: Uint8Array, opts: ParseOptions): PdfDocument;
|
package/unpdf_wasm.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* @ts-self-types="./unpdf_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
import * as wasm from "./unpdf_wasm_bg.wasm";
|
|
4
|
+
import { __wbg_set_wasm } from "./unpdf_wasm_bg.js";
|
|
5
|
+
__wbg_set_wasm(wasm);
|
|
6
|
+
wasm.__wbindgen_start();
|
|
7
|
+
export {
|
|
8
|
+
ParseOptions, PdfDocument, parse, parseWithOptions
|
|
9
|
+
} from "./unpdf_wasm_bg.js";
|
package/unpdf_wasm_bg.js
ADDED
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
export class ParseOptions {
|
|
2
|
+
static __wrap(ptr) {
|
|
3
|
+
ptr = ptr >>> 0;
|
|
4
|
+
const obj = Object.create(ParseOptions.prototype);
|
|
5
|
+
obj.__wbg_ptr = ptr;
|
|
6
|
+
ParseOptionsFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
7
|
+
return obj;
|
|
8
|
+
}
|
|
9
|
+
__destroy_into_raw() {
|
|
10
|
+
const ptr = this.__wbg_ptr;
|
|
11
|
+
this.__wbg_ptr = 0;
|
|
12
|
+
ParseOptionsFinalization.unregister(this);
|
|
13
|
+
return ptr;
|
|
14
|
+
}
|
|
15
|
+
free() {
|
|
16
|
+
const ptr = this.__destroy_into_raw();
|
|
17
|
+
wasm.__wbg_parseoptions_free(ptr, 0);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @returns {ParseOptions}
|
|
21
|
+
*/
|
|
22
|
+
lenient() {
|
|
23
|
+
const ptr = this.__destroy_into_raw();
|
|
24
|
+
const ret = wasm.parseoptions_lenient(ptr);
|
|
25
|
+
return ParseOptions.__wrap(ret);
|
|
26
|
+
}
|
|
27
|
+
constructor() {
|
|
28
|
+
const ret = wasm.parseoptions_new();
|
|
29
|
+
this.__wbg_ptr = ret >>> 0;
|
|
30
|
+
ParseOptionsFinalization.register(this, this.__wbg_ptr, this);
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @returns {ParseOptions}
|
|
35
|
+
*/
|
|
36
|
+
textOnly() {
|
|
37
|
+
const ptr = this.__destroy_into_raw();
|
|
38
|
+
const ret = wasm.parseoptions_textOnly(ptr);
|
|
39
|
+
return ParseOptions.__wrap(ret);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @param {number} from
|
|
43
|
+
* @param {number} to
|
|
44
|
+
* @returns {ParseOptions}
|
|
45
|
+
*/
|
|
46
|
+
withPages(from, to) {
|
|
47
|
+
const ptr = this.__destroy_into_raw();
|
|
48
|
+
const ret = wasm.parseoptions_withPages(ptr, from, to);
|
|
49
|
+
return ParseOptions.__wrap(ret);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* @param {string} password
|
|
53
|
+
* @returns {ParseOptions}
|
|
54
|
+
*/
|
|
55
|
+
withPassword(password) {
|
|
56
|
+
const ptr = this.__destroy_into_raw();
|
|
57
|
+
const ptr0 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
58
|
+
const len0 = WASM_VECTOR_LEN;
|
|
59
|
+
const ret = wasm.parseoptions_withPassword(ptr, ptr0, len0);
|
|
60
|
+
return ParseOptions.__wrap(ret);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (Symbol.dispose) ParseOptions.prototype[Symbol.dispose] = ParseOptions.prototype.free;
|
|
64
|
+
|
|
65
|
+
export class PdfDocument {
|
|
66
|
+
static __wrap(ptr) {
|
|
67
|
+
ptr = ptr >>> 0;
|
|
68
|
+
const obj = Object.create(PdfDocument.prototype);
|
|
69
|
+
obj.__wbg_ptr = ptr;
|
|
70
|
+
PdfDocumentFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
71
|
+
return obj;
|
|
72
|
+
}
|
|
73
|
+
__destroy_into_raw() {
|
|
74
|
+
const ptr = this.__wbg_ptr;
|
|
75
|
+
this.__wbg_ptr = 0;
|
|
76
|
+
PdfDocumentFinalization.unregister(this);
|
|
77
|
+
return ptr;
|
|
78
|
+
}
|
|
79
|
+
free() {
|
|
80
|
+
const ptr = this.__destroy_into_raw();
|
|
81
|
+
wasm.__wbg_pdfdocument_free(ptr, 0);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* @param {Uint8Array} data
|
|
85
|
+
* @returns {PdfDocument}
|
|
86
|
+
*/
|
|
87
|
+
static fromBytes(data) {
|
|
88
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
89
|
+
const len0 = WASM_VECTOR_LEN;
|
|
90
|
+
const ret = wasm.pdfdocument_fromBytes(ptr0, len0);
|
|
91
|
+
if (ret[2]) {
|
|
92
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
93
|
+
}
|
|
94
|
+
return PdfDocument.__wrap(ret[0]);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* @returns {string}
|
|
98
|
+
*/
|
|
99
|
+
metadata() {
|
|
100
|
+
let deferred2_0;
|
|
101
|
+
let deferred2_1;
|
|
102
|
+
try {
|
|
103
|
+
const ret = wasm.pdfdocument_metadata(this.__wbg_ptr);
|
|
104
|
+
var ptr1 = ret[0];
|
|
105
|
+
var len1 = ret[1];
|
|
106
|
+
if (ret[3]) {
|
|
107
|
+
ptr1 = 0; len1 = 0;
|
|
108
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
109
|
+
}
|
|
110
|
+
deferred2_0 = ptr1;
|
|
111
|
+
deferred2_1 = len1;
|
|
112
|
+
return getStringFromWasm0(ptr1, len1);
|
|
113
|
+
} finally {
|
|
114
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* @returns {number}
|
|
119
|
+
*/
|
|
120
|
+
pageCount() {
|
|
121
|
+
const ret = wasm.pdfdocument_pageCount(this.__wbg_ptr);
|
|
122
|
+
return ret >>> 0;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* @returns {string}
|
|
126
|
+
*/
|
|
127
|
+
toJson() {
|
|
128
|
+
let deferred2_0;
|
|
129
|
+
let deferred2_1;
|
|
130
|
+
try {
|
|
131
|
+
const ret = wasm.pdfdocument_toJson(this.__wbg_ptr);
|
|
132
|
+
var ptr1 = ret[0];
|
|
133
|
+
var len1 = ret[1];
|
|
134
|
+
if (ret[3]) {
|
|
135
|
+
ptr1 = 0; len1 = 0;
|
|
136
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
137
|
+
}
|
|
138
|
+
deferred2_0 = ptr1;
|
|
139
|
+
deferred2_1 = len1;
|
|
140
|
+
return getStringFromWasm0(ptr1, len1);
|
|
141
|
+
} finally {
|
|
142
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* @returns {string}
|
|
147
|
+
*/
|
|
148
|
+
toMarkdown() {
|
|
149
|
+
let deferred2_0;
|
|
150
|
+
let deferred2_1;
|
|
151
|
+
try {
|
|
152
|
+
const ret = wasm.pdfdocument_toMarkdown(this.__wbg_ptr);
|
|
153
|
+
var ptr1 = ret[0];
|
|
154
|
+
var len1 = ret[1];
|
|
155
|
+
if (ret[3]) {
|
|
156
|
+
ptr1 = 0; len1 = 0;
|
|
157
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
158
|
+
}
|
|
159
|
+
deferred2_0 = ptr1;
|
|
160
|
+
deferred2_1 = len1;
|
|
161
|
+
return getStringFromWasm0(ptr1, len1);
|
|
162
|
+
} finally {
|
|
163
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* @returns {string}
|
|
168
|
+
*/
|
|
169
|
+
toText() {
|
|
170
|
+
let deferred2_0;
|
|
171
|
+
let deferred2_1;
|
|
172
|
+
try {
|
|
173
|
+
const ret = wasm.pdfdocument_toText(this.__wbg_ptr);
|
|
174
|
+
var ptr1 = ret[0];
|
|
175
|
+
var len1 = ret[1];
|
|
176
|
+
if (ret[3]) {
|
|
177
|
+
ptr1 = 0; len1 = 0;
|
|
178
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
179
|
+
}
|
|
180
|
+
deferred2_0 = ptr1;
|
|
181
|
+
deferred2_1 = len1;
|
|
182
|
+
return getStringFromWasm0(ptr1, len1);
|
|
183
|
+
} finally {
|
|
184
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (Symbol.dispose) PdfDocument.prototype[Symbol.dispose] = PdfDocument.prototype.free;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* @param {Uint8Array} data
|
|
192
|
+
* @returns {PdfDocument}
|
|
193
|
+
*/
|
|
194
|
+
export function parse(data) {
|
|
195
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
196
|
+
const len0 = WASM_VECTOR_LEN;
|
|
197
|
+
const ret = wasm.parse(ptr0, len0);
|
|
198
|
+
if (ret[2]) {
|
|
199
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
200
|
+
}
|
|
201
|
+
return PdfDocument.__wrap(ret[0]);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* @param {Uint8Array} data
|
|
206
|
+
* @param {ParseOptions} opts
|
|
207
|
+
* @returns {PdfDocument}
|
|
208
|
+
*/
|
|
209
|
+
export function parseWithOptions(data, opts) {
|
|
210
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
211
|
+
const len0 = WASM_VECTOR_LEN;
|
|
212
|
+
_assertClass(opts, ParseOptions);
|
|
213
|
+
const ret = wasm.parseWithOptions(ptr0, len0, opts.__wbg_ptr);
|
|
214
|
+
if (ret[2]) {
|
|
215
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
216
|
+
}
|
|
217
|
+
return PdfDocument.__wrap(ret[0]);
|
|
218
|
+
}
|
|
219
|
+
export function __wbg___wbindgen_throw_6ddd609b62940d55(arg0, arg1) {
|
|
220
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
221
|
+
}
|
|
222
|
+
export function __wbindgen_cast_0000000000000001(arg0, arg1) {
|
|
223
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
224
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
225
|
+
return ret;
|
|
226
|
+
}
|
|
227
|
+
export function __wbindgen_init_externref_table() {
|
|
228
|
+
const table = wasm.__wbindgen_externrefs;
|
|
229
|
+
const offset = table.grow(4);
|
|
230
|
+
table.set(0, undefined);
|
|
231
|
+
table.set(offset + 0, undefined);
|
|
232
|
+
table.set(offset + 1, null);
|
|
233
|
+
table.set(offset + 2, true);
|
|
234
|
+
table.set(offset + 3, false);
|
|
235
|
+
}
|
|
236
|
+
const ParseOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
237
|
+
? { register: () => {}, unregister: () => {} }
|
|
238
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_parseoptions_free(ptr >>> 0, 1));
|
|
239
|
+
const PdfDocumentFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
240
|
+
? { register: () => {}, unregister: () => {} }
|
|
241
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_pdfdocument_free(ptr >>> 0, 1));
|
|
242
|
+
|
|
243
|
+
function _assertClass(instance, klass) {
|
|
244
|
+
if (!(instance instanceof klass)) {
|
|
245
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function getStringFromWasm0(ptr, len) {
|
|
250
|
+
ptr = ptr >>> 0;
|
|
251
|
+
return decodeText(ptr, len);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
let cachedUint8ArrayMemory0 = null;
|
|
255
|
+
function getUint8ArrayMemory0() {
|
|
256
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
257
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
258
|
+
}
|
|
259
|
+
return cachedUint8ArrayMemory0;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
263
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
264
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
265
|
+
WASM_VECTOR_LEN = arg.length;
|
|
266
|
+
return ptr;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
270
|
+
if (realloc === undefined) {
|
|
271
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
272
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
273
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
274
|
+
WASM_VECTOR_LEN = buf.length;
|
|
275
|
+
return ptr;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
let len = arg.length;
|
|
279
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
280
|
+
|
|
281
|
+
const mem = getUint8ArrayMemory0();
|
|
282
|
+
|
|
283
|
+
let offset = 0;
|
|
284
|
+
|
|
285
|
+
for (; offset < len; offset++) {
|
|
286
|
+
const code = arg.charCodeAt(offset);
|
|
287
|
+
if (code > 0x7F) break;
|
|
288
|
+
mem[ptr + offset] = code;
|
|
289
|
+
}
|
|
290
|
+
if (offset !== len) {
|
|
291
|
+
if (offset !== 0) {
|
|
292
|
+
arg = arg.slice(offset);
|
|
293
|
+
}
|
|
294
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
295
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
296
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
297
|
+
|
|
298
|
+
offset += ret.written;
|
|
299
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
WASM_VECTOR_LEN = offset;
|
|
303
|
+
return ptr;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function takeFromExternrefTable0(idx) {
|
|
307
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
308
|
+
wasm.__externref_table_dealloc(idx);
|
|
309
|
+
return value;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
313
|
+
cachedTextDecoder.decode();
|
|
314
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
315
|
+
let numBytesDecoded = 0;
|
|
316
|
+
function decodeText(ptr, len) {
|
|
317
|
+
numBytesDecoded += len;
|
|
318
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
319
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
320
|
+
cachedTextDecoder.decode();
|
|
321
|
+
numBytesDecoded = len;
|
|
322
|
+
}
|
|
323
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
const cachedTextEncoder = new TextEncoder();
|
|
327
|
+
|
|
328
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
329
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
330
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
331
|
+
view.set(buf);
|
|
332
|
+
return {
|
|
333
|
+
read: arg.length,
|
|
334
|
+
written: buf.length
|
|
335
|
+
};
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
let WASM_VECTOR_LEN = 0;
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
let wasm;
|
|
343
|
+
export function __wbg_set_wasm(val) {
|
|
344
|
+
wasm = val;
|
|
345
|
+
}
|
|
Binary file
|