libbitsub 1.4.0 → 1.5.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/README.md +2 -0
- package/dist/ts/renderers.d.ts.map +1 -1
- package/dist/ts/renderers.js +0 -1
- package/dist/ts/renderers.js.map +1 -1
- package/dist/ts/webgpu-renderer.d.ts.map +1 -1
- package/dist/ts/webgpu-renderer.js +20 -15
- package/dist/ts/webgpu-renderer.js.map +1 -1
- package/dist/ts/worker.d.ts.map +1 -1
- package/dist/ts/worker.js +0 -2
- package/dist/ts/worker.js.map +1 -1
- package/package.json +6 -4
- package/pkg/README.md +2 -0
- package/pkg/libbitsub.d.ts +317 -296
- package/pkg/libbitsub.js +403 -405
- package/pkg/libbitsub_bg.wasm +0 -0
- package/pkg/package.json +1 -1
package/pkg/libbitsub.js
CHANGED
|
@@ -1,131 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
4
|
-
ptr = ptr >>> 0;
|
|
5
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
let cachedDataViewMemory0 = null;
|
|
9
|
-
function getDataViewMemory0() {
|
|
10
|
-
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
11
|
-
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
12
|
-
}
|
|
13
|
-
return cachedDataViewMemory0;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function getStringFromWasm0(ptr, len) {
|
|
17
|
-
ptr = ptr >>> 0;
|
|
18
|
-
return decodeText(ptr, len);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
let cachedUint8ArrayMemory0 = null;
|
|
22
|
-
function getUint8ArrayMemory0() {
|
|
23
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
24
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
25
|
-
}
|
|
26
|
-
return cachedUint8ArrayMemory0;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
30
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
31
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
32
|
-
WASM_VECTOR_LEN = arg.length;
|
|
33
|
-
return ptr;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
37
|
-
if (realloc === undefined) {
|
|
38
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
39
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
40
|
-
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
41
|
-
WASM_VECTOR_LEN = buf.length;
|
|
42
|
-
return ptr;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
let len = arg.length;
|
|
46
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
47
|
-
|
|
48
|
-
const mem = getUint8ArrayMemory0();
|
|
49
|
-
|
|
50
|
-
let offset = 0;
|
|
51
|
-
|
|
52
|
-
for (; offset < len; offset++) {
|
|
53
|
-
const code = arg.charCodeAt(offset);
|
|
54
|
-
if (code > 0x7F) break;
|
|
55
|
-
mem[ptr + offset] = code;
|
|
56
|
-
}
|
|
57
|
-
if (offset !== len) {
|
|
58
|
-
if (offset !== 0) {
|
|
59
|
-
arg = arg.slice(offset);
|
|
60
|
-
}
|
|
61
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
62
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
63
|
-
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
64
|
-
|
|
65
|
-
offset += ret.written;
|
|
66
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
WASM_VECTOR_LEN = offset;
|
|
70
|
-
return ptr;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
74
|
-
cachedTextDecoder.decode();
|
|
75
|
-
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
76
|
-
let numBytesDecoded = 0;
|
|
77
|
-
function decodeText(ptr, len) {
|
|
78
|
-
numBytesDecoded += len;
|
|
79
|
-
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
80
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
81
|
-
cachedTextDecoder.decode();
|
|
82
|
-
numBytesDecoded = len;
|
|
83
|
-
}
|
|
84
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const cachedTextEncoder = new TextEncoder();
|
|
88
|
-
|
|
89
|
-
if (!('encodeInto' in cachedTextEncoder)) {
|
|
90
|
-
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
91
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
92
|
-
view.set(buf);
|
|
93
|
-
return {
|
|
94
|
-
read: arg.length,
|
|
95
|
-
written: buf.length
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
let WASM_VECTOR_LEN = 0;
|
|
101
|
-
|
|
102
|
-
const PgsParserFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
103
|
-
? { register: () => {}, unregister: () => {} }
|
|
104
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_pgsparser_free(ptr >>> 0, 1));
|
|
105
|
-
|
|
106
|
-
const RenderResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
107
|
-
? { register: () => {}, unregister: () => {} }
|
|
108
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_renderresult_free(ptr >>> 0, 1));
|
|
109
|
-
|
|
110
|
-
const SubtitleCompositionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
111
|
-
? { register: () => {}, unregister: () => {} }
|
|
112
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_subtitlecomposition_free(ptr >>> 0, 1));
|
|
113
|
-
|
|
114
|
-
const SubtitleFrameFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
115
|
-
? { register: () => {}, unregister: () => {} }
|
|
116
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_subtitleframe_free(ptr >>> 0, 1));
|
|
117
|
-
|
|
118
|
-
const SubtitleRendererFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
119
|
-
? { register: () => {}, unregister: () => {} }
|
|
120
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_subtitlerenderer_free(ptr >>> 0, 1));
|
|
121
|
-
|
|
122
|
-
const VobSubFrameFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
123
|
-
? { register: () => {}, unregister: () => {} }
|
|
124
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_vobsubframe_free(ptr >>> 0, 1));
|
|
125
|
-
|
|
126
|
-
const VobSubParserFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
127
|
-
? { register: () => {}, unregister: () => {} }
|
|
128
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_vobsubparser_free(ptr >>> 0, 1));
|
|
1
|
+
/* @ts-self-types="./libbitsub.d.ts" */
|
|
129
2
|
|
|
130
3
|
/**
|
|
131
4
|
* PGS subtitle parser and renderer exposed to JavaScript.
|
|
@@ -148,22 +21,12 @@ export class PgsParser {
|
|
|
148
21
|
wasm.pgsparser_clearCache(this.__wbg_ptr);
|
|
149
22
|
}
|
|
150
23
|
/**
|
|
151
|
-
* Get
|
|
152
|
-
* @returns {
|
|
153
|
-
*/
|
|
154
|
-
getTimestamps() {
|
|
155
|
-
const ret = wasm.pgsparser_getTimestamps(this.__wbg_ptr);
|
|
156
|
-
return ret;
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Render subtitle at the given index and return RGBA data.
|
|
160
|
-
* Returns null if index is invalid or no subtitle data.
|
|
161
|
-
* @param {number} index
|
|
162
|
-
* @returns {SubtitleFrame | undefined}
|
|
24
|
+
* Get the number of display sets.
|
|
25
|
+
* @returns {number}
|
|
163
26
|
*/
|
|
164
|
-
|
|
165
|
-
const ret = wasm.
|
|
166
|
-
return ret
|
|
27
|
+
get count() {
|
|
28
|
+
const ret = wasm.pgsparser_count(this.__wbg_ptr);
|
|
29
|
+
return ret >>> 0;
|
|
167
30
|
}
|
|
168
31
|
/**
|
|
169
32
|
* Find the display set index for a given timestamp in milliseconds.
|
|
@@ -174,6 +37,14 @@ export class PgsParser {
|
|
|
174
37
|
const ret = wasm.pgsparser_findIndexAtTimestamp(this.__wbg_ptr, time_ms);
|
|
175
38
|
return ret;
|
|
176
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Get all timestamps in milliseconds as a Float64Array.
|
|
42
|
+
* @returns {Float64Array}
|
|
43
|
+
*/
|
|
44
|
+
getTimestamps() {
|
|
45
|
+
const ret = wasm.pgsparser_getTimestamps(this.__wbg_ptr);
|
|
46
|
+
return ret;
|
|
47
|
+
}
|
|
177
48
|
/**
|
|
178
49
|
* Create a new PGS parser.
|
|
179
50
|
*/
|
|
@@ -183,14 +54,6 @@ export class PgsParser {
|
|
|
183
54
|
PgsParserFinalization.register(this, this.__wbg_ptr, this);
|
|
184
55
|
return this;
|
|
185
56
|
}
|
|
186
|
-
/**
|
|
187
|
-
* Get the number of display sets.
|
|
188
|
-
* @returns {number}
|
|
189
|
-
*/
|
|
190
|
-
get count() {
|
|
191
|
-
const ret = wasm.pgsparser_count(this.__wbg_ptr);
|
|
192
|
-
return ret >>> 0;
|
|
193
|
-
}
|
|
194
57
|
/**
|
|
195
58
|
* Parse a PGS file from binary data.
|
|
196
59
|
* Returns the number of display sets parsed.
|
|
@@ -203,6 +66,16 @@ export class PgsParser {
|
|
|
203
66
|
const ret = wasm.pgsparser_parse(this.__wbg_ptr, ptr0, len0);
|
|
204
67
|
return ret >>> 0;
|
|
205
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Render subtitle at the given index and return RGBA data.
|
|
71
|
+
* Returns null if index is invalid or no subtitle data.
|
|
72
|
+
* @param {number} index
|
|
73
|
+
* @returns {SubtitleFrame | undefined}
|
|
74
|
+
*/
|
|
75
|
+
renderAtIndex(index) {
|
|
76
|
+
const ret = wasm.pgsparser_renderAtIndex(this.__wbg_ptr, index);
|
|
77
|
+
return ret === 0 ? undefined : SubtitleFrame.__wrap(ret);
|
|
78
|
+
}
|
|
206
79
|
}
|
|
207
80
|
if (Symbol.dispose) PgsParser.prototype[Symbol.dispose] = PgsParser.prototype.free;
|
|
208
81
|
|
|
@@ -228,26 +101,39 @@ export class RenderResult {
|
|
|
228
101
|
wasm.__wbg_renderresult_free(ptr, 0);
|
|
229
102
|
}
|
|
230
103
|
/**
|
|
104
|
+
* Get the number of composition elements.
|
|
231
105
|
* @returns {number}
|
|
232
106
|
*/
|
|
233
|
-
get
|
|
234
|
-
const ret = wasm.
|
|
235
|
-
return ret;
|
|
107
|
+
get compositionCount() {
|
|
108
|
+
const ret = wasm.renderresult_compositionCount(this.__wbg_ptr);
|
|
109
|
+
return ret >>> 0;
|
|
236
110
|
}
|
|
237
111
|
/**
|
|
112
|
+
* Get composition height at index.
|
|
113
|
+
* @param {number} index
|
|
238
114
|
* @returns {number}
|
|
239
115
|
*/
|
|
240
|
-
|
|
241
|
-
const ret = wasm.
|
|
116
|
+
getCompositionHeight(index) {
|
|
117
|
+
const ret = wasm.renderresult_getCompositionHeight(this.__wbg_ptr, index);
|
|
242
118
|
return ret;
|
|
243
119
|
}
|
|
244
120
|
/**
|
|
245
|
-
* Get
|
|
121
|
+
* Get composition RGBA data at index.
|
|
122
|
+
* @param {number} index
|
|
123
|
+
* @returns {Uint8Array}
|
|
124
|
+
*/
|
|
125
|
+
getCompositionRgba(index) {
|
|
126
|
+
const ret = wasm.renderresult_getCompositionRgba(this.__wbg_ptr, index);
|
|
127
|
+
return ret;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Get composition width at index.
|
|
131
|
+
* @param {number} index
|
|
246
132
|
* @returns {number}
|
|
247
133
|
*/
|
|
248
|
-
|
|
249
|
-
const ret = wasm.
|
|
250
|
-
return ret
|
|
134
|
+
getCompositionWidth(index) {
|
|
135
|
+
const ret = wasm.renderresult_getCompositionWidth(this.__wbg_ptr, index);
|
|
136
|
+
return ret;
|
|
251
137
|
}
|
|
252
138
|
/**
|
|
253
139
|
* Get composition X position at index.
|
|
@@ -268,30 +154,17 @@ export class RenderResult {
|
|
|
268
154
|
return ret;
|
|
269
155
|
}
|
|
270
156
|
/**
|
|
271
|
-
* Get composition RGBA data at index.
|
|
272
|
-
* @param {number} index
|
|
273
|
-
* @returns {Uint8Array}
|
|
274
|
-
*/
|
|
275
|
-
getCompositionRgba(index) {
|
|
276
|
-
const ret = wasm.renderresult_getCompositionRgba(this.__wbg_ptr, index);
|
|
277
|
-
return ret;
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Get composition width at index.
|
|
281
|
-
* @param {number} index
|
|
282
157
|
* @returns {number}
|
|
283
158
|
*/
|
|
284
|
-
|
|
285
|
-
const ret = wasm.
|
|
159
|
+
get screenHeight() {
|
|
160
|
+
const ret = wasm.renderresult_screenHeight(this.__wbg_ptr);
|
|
286
161
|
return ret;
|
|
287
162
|
}
|
|
288
163
|
/**
|
|
289
|
-
* Get composition height at index.
|
|
290
|
-
* @param {number} index
|
|
291
164
|
* @returns {number}
|
|
292
165
|
*/
|
|
293
|
-
|
|
294
|
-
const ret = wasm.
|
|
166
|
+
get screenWidth() {
|
|
167
|
+
const ret = wasm.renderresult_screenWidth(this.__wbg_ptr);
|
|
295
168
|
return ret;
|
|
296
169
|
}
|
|
297
170
|
}
|
|
@@ -319,17 +192,18 @@ export class SubtitleComposition {
|
|
|
319
192
|
wasm.__wbg_subtitlecomposition_free(ptr, 0);
|
|
320
193
|
}
|
|
321
194
|
/**
|
|
322
|
-
*
|
|
195
|
+
* Get RGBA pixel data as Uint8Array.
|
|
196
|
+
* @returns {Uint8Array}
|
|
323
197
|
*/
|
|
324
|
-
|
|
325
|
-
const ret = wasm.
|
|
198
|
+
getRgba() {
|
|
199
|
+
const ret = wasm.subtitlecomposition_getRgba(this.__wbg_ptr);
|
|
326
200
|
return ret;
|
|
327
201
|
}
|
|
328
202
|
/**
|
|
329
203
|
* @returns {number}
|
|
330
204
|
*/
|
|
331
|
-
get
|
|
332
|
-
const ret = wasm.
|
|
205
|
+
get height() {
|
|
206
|
+
const ret = wasm.subtitlecomposition_height(this.__wbg_ptr);
|
|
333
207
|
return ret;
|
|
334
208
|
}
|
|
335
209
|
/**
|
|
@@ -342,16 +216,15 @@ export class SubtitleComposition {
|
|
|
342
216
|
/**
|
|
343
217
|
* @returns {number}
|
|
344
218
|
*/
|
|
345
|
-
get
|
|
346
|
-
const ret = wasm.
|
|
219
|
+
get x() {
|
|
220
|
+
const ret = wasm.subtitlecomposition_x(this.__wbg_ptr);
|
|
347
221
|
return ret;
|
|
348
222
|
}
|
|
349
223
|
/**
|
|
350
|
-
*
|
|
351
|
-
* @returns {Uint8Array}
|
|
224
|
+
* @returns {number}
|
|
352
225
|
*/
|
|
353
|
-
|
|
354
|
-
const ret = wasm.
|
|
226
|
+
get y() {
|
|
227
|
+
const ret = wasm.subtitlecomposition_y(this.__wbg_ptr);
|
|
355
228
|
return ret;
|
|
356
229
|
}
|
|
357
230
|
}
|
|
@@ -393,6 +266,14 @@ export class SubtitleFrame {
|
|
|
393
266
|
const ptr = this.__destroy_into_raw();
|
|
394
267
|
wasm.__wbg_subtitleframe_free(ptr, 0);
|
|
395
268
|
}
|
|
269
|
+
/**
|
|
270
|
+
* Get the number of compositions.
|
|
271
|
+
* @returns {number}
|
|
272
|
+
*/
|
|
273
|
+
get compositionCount() {
|
|
274
|
+
const ret = wasm.renderresult_compositionCount(this.__wbg_ptr);
|
|
275
|
+
return ret >>> 0;
|
|
276
|
+
}
|
|
396
277
|
/**
|
|
397
278
|
* Get a composition by index.
|
|
398
279
|
* @param {number} index
|
|
@@ -403,12 +284,11 @@ export class SubtitleFrame {
|
|
|
403
284
|
return ret === 0 ? undefined : SubtitleComposition.__wrap(ret);
|
|
404
285
|
}
|
|
405
286
|
/**
|
|
406
|
-
* Get the number of compositions.
|
|
407
287
|
* @returns {number}
|
|
408
288
|
*/
|
|
409
|
-
get
|
|
410
|
-
const ret = wasm.
|
|
411
|
-
return ret
|
|
289
|
+
get height() {
|
|
290
|
+
const ret = wasm.renderresult_screenHeight(this.__wbg_ptr);
|
|
291
|
+
return ret;
|
|
412
292
|
}
|
|
413
293
|
/**
|
|
414
294
|
* @returns {number}
|
|
@@ -417,13 +297,6 @@ export class SubtitleFrame {
|
|
|
417
297
|
const ret = wasm.renderresult_screenWidth(this.__wbg_ptr);
|
|
418
298
|
return ret;
|
|
419
299
|
}
|
|
420
|
-
/**
|
|
421
|
-
* @returns {number}
|
|
422
|
-
*/
|
|
423
|
-
get height() {
|
|
424
|
-
const ret = wasm.renderresult_screenHeight(this.__wbg_ptr);
|
|
425
|
-
return ret;
|
|
426
|
-
}
|
|
427
300
|
}
|
|
428
301
|
if (Symbol.dispose) SubtitleFrame.prototype[Symbol.dispose] = SubtitleFrame.prototype.free;
|
|
429
302
|
|
|
@@ -448,16 +321,35 @@ export class SubtitleRenderer {
|
|
|
448
321
|
wasm.subtitlerenderer_clearCache(this.__wbg_ptr);
|
|
449
322
|
}
|
|
450
323
|
/**
|
|
451
|
-
*
|
|
452
|
-
* @
|
|
453
|
-
* @param {Uint8Array} sub_data
|
|
324
|
+
* Get the number of subtitle entries.
|
|
325
|
+
* @returns {number}
|
|
454
326
|
*/
|
|
455
|
-
|
|
456
|
-
const
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
327
|
+
get count() {
|
|
328
|
+
const ret = wasm.subtitlerenderer_count(this.__wbg_ptr);
|
|
329
|
+
return ret >>> 0;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Dispose of all resources.
|
|
333
|
+
*/
|
|
334
|
+
dispose() {
|
|
335
|
+
wasm.subtitlerenderer_dispose(this.__wbg_ptr);
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Find the subtitle index for a given timestamp in milliseconds.
|
|
339
|
+
* @param {number} time_ms
|
|
340
|
+
* @returns {number}
|
|
341
|
+
*/
|
|
342
|
+
findIndexAtTimestamp(time_ms) {
|
|
343
|
+
const ret = wasm.subtitlerenderer_findIndexAtTimestamp(this.__wbg_ptr, time_ms);
|
|
344
|
+
return ret;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Get the current subtitle format.
|
|
348
|
+
* @returns {SubtitleFormat | undefined}
|
|
349
|
+
*/
|
|
350
|
+
get format() {
|
|
351
|
+
const ret = wasm.subtitlerenderer_format(this.__wbg_ptr);
|
|
352
|
+
return ret === 2 ? undefined : ret;
|
|
461
353
|
}
|
|
462
354
|
/**
|
|
463
355
|
* Get all timestamps in milliseconds.
|
|
@@ -468,14 +360,27 @@ export class SubtitleRenderer {
|
|
|
468
360
|
return ret;
|
|
469
361
|
}
|
|
470
362
|
/**
|
|
471
|
-
*
|
|
472
|
-
*
|
|
473
|
-
* @
|
|
474
|
-
* @returns {RenderResult | undefined}
|
|
363
|
+
* Load PGS subtitle data.
|
|
364
|
+
* @param {Uint8Array} data
|
|
365
|
+
* @returns {number}
|
|
475
366
|
*/
|
|
476
|
-
|
|
477
|
-
const
|
|
478
|
-
|
|
367
|
+
loadPgs(data) {
|
|
368
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
369
|
+
const len0 = WASM_VECTOR_LEN;
|
|
370
|
+
const ret = wasm.subtitlerenderer_loadPgs(this.__wbg_ptr, ptr0, len0);
|
|
371
|
+
return ret >>> 0;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Load VobSub subtitle data from IDX and SUB.
|
|
375
|
+
* @param {string} idx_content
|
|
376
|
+
* @param {Uint8Array} sub_data
|
|
377
|
+
*/
|
|
378
|
+
loadVobSub(idx_content, sub_data) {
|
|
379
|
+
const ptr0 = passStringToWasm0(idx_content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
380
|
+
const len0 = WASM_VECTOR_LEN;
|
|
381
|
+
const ptr1 = passArray8ToWasm0(sub_data, wasm.__wbindgen_malloc);
|
|
382
|
+
const len1 = WASM_VECTOR_LEN;
|
|
383
|
+
wasm.subtitlerenderer_loadVobSub(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
479
384
|
}
|
|
480
385
|
/**
|
|
481
386
|
* Load VobSub from SUB file only.
|
|
@@ -486,24 +391,6 @@ export class SubtitleRenderer {
|
|
|
486
391
|
const len0 = WASM_VECTOR_LEN;
|
|
487
392
|
wasm.subtitlerenderer_loadVobSubOnly(this.__wbg_ptr, ptr0, len0);
|
|
488
393
|
}
|
|
489
|
-
/**
|
|
490
|
-
* Render subtitle at the given timestamp in seconds.
|
|
491
|
-
* @param {number} time_seconds
|
|
492
|
-
* @returns {RenderResult | undefined}
|
|
493
|
-
*/
|
|
494
|
-
renderAtTimestamp(time_seconds) {
|
|
495
|
-
const ret = wasm.subtitlerenderer_renderAtTimestamp(this.__wbg_ptr, time_seconds);
|
|
496
|
-
return ret === 0 ? undefined : RenderResult.__wrap(ret);
|
|
497
|
-
}
|
|
498
|
-
/**
|
|
499
|
-
* Find the subtitle index for a given timestamp in milliseconds.
|
|
500
|
-
* @param {number} time_ms
|
|
501
|
-
* @returns {number}
|
|
502
|
-
*/
|
|
503
|
-
findIndexAtTimestamp(time_ms) {
|
|
504
|
-
const ret = wasm.subtitlerenderer_findIndexAtTimestamp(this.__wbg_ptr, time_ms);
|
|
505
|
-
return ret;
|
|
506
|
-
}
|
|
507
394
|
/**
|
|
508
395
|
* Create a new subtitle renderer.
|
|
509
396
|
*/
|
|
@@ -514,37 +401,23 @@ export class SubtitleRenderer {
|
|
|
514
401
|
return this;
|
|
515
402
|
}
|
|
516
403
|
/**
|
|
517
|
-
*
|
|
518
|
-
*
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
const ret = wasm.subtitlerenderer_count(this.__wbg_ptr);
|
|
522
|
-
return ret >>> 0;
|
|
523
|
-
}
|
|
524
|
-
/**
|
|
525
|
-
* Get the current subtitle format.
|
|
526
|
-
* @returns {SubtitleFormat | undefined}
|
|
527
|
-
*/
|
|
528
|
-
get format() {
|
|
529
|
-
const ret = wasm.subtitlerenderer_format(this.__wbg_ptr);
|
|
530
|
-
return ret === 2 ? undefined : ret;
|
|
531
|
-
}
|
|
532
|
-
/**
|
|
533
|
-
* Dispose of all resources.
|
|
404
|
+
* Render subtitle at the given index.
|
|
405
|
+
* Returns a unified RenderResult or null.
|
|
406
|
+
* @param {number} index
|
|
407
|
+
* @returns {RenderResult | undefined}
|
|
534
408
|
*/
|
|
535
|
-
|
|
536
|
-
wasm.
|
|
409
|
+
renderAtIndex(index) {
|
|
410
|
+
const ret = wasm.subtitlerenderer_renderAtIndex(this.__wbg_ptr, index);
|
|
411
|
+
return ret === 0 ? undefined : RenderResult.__wrap(ret);
|
|
537
412
|
}
|
|
538
413
|
/**
|
|
539
|
-
*
|
|
540
|
-
* @param {
|
|
541
|
-
* @returns {
|
|
414
|
+
* Render subtitle at the given timestamp in seconds.
|
|
415
|
+
* @param {number} time_seconds
|
|
416
|
+
* @returns {RenderResult | undefined}
|
|
542
417
|
*/
|
|
543
|
-
|
|
544
|
-
const
|
|
545
|
-
|
|
546
|
-
const ret = wasm.subtitlerenderer_loadPgs(this.__wbg_ptr, ptr0, len0);
|
|
547
|
-
return ret >>> 0;
|
|
418
|
+
renderAtTimestamp(time_seconds) {
|
|
419
|
+
const ret = wasm.subtitlerenderer_renderAtTimestamp(this.__wbg_ptr, time_seconds);
|
|
420
|
+
return ret === 0 ? undefined : RenderResult.__wrap(ret);
|
|
548
421
|
}
|
|
549
422
|
}
|
|
550
423
|
if (Symbol.dispose) SubtitleRenderer.prototype[Symbol.dispose] = SubtitleRenderer.prototype.free;
|
|
@@ -571,31 +444,32 @@ export class VobSubFrame {
|
|
|
571
444
|
wasm.__wbg_vobsubframe_free(ptr, 0);
|
|
572
445
|
}
|
|
573
446
|
/**
|
|
574
|
-
*
|
|
447
|
+
* Get RGBA pixel data as Uint8Array.
|
|
448
|
+
* @returns {Uint8Array}
|
|
575
449
|
*/
|
|
576
|
-
|
|
577
|
-
const ret = wasm.
|
|
450
|
+
getRgba() {
|
|
451
|
+
const ret = wasm.vobsubframe_getRgba(this.__wbg_ptr);
|
|
578
452
|
return ret;
|
|
579
453
|
}
|
|
580
454
|
/**
|
|
581
455
|
* @returns {number}
|
|
582
456
|
*/
|
|
583
|
-
get
|
|
584
|
-
const ret = wasm.
|
|
457
|
+
get height() {
|
|
458
|
+
const ret = wasm.vobsubframe_height(this.__wbg_ptr);
|
|
585
459
|
return ret;
|
|
586
460
|
}
|
|
587
461
|
/**
|
|
588
462
|
* @returns {number}
|
|
589
463
|
*/
|
|
590
|
-
get
|
|
591
|
-
const ret = wasm.
|
|
464
|
+
get screenHeight() {
|
|
465
|
+
const ret = wasm.vobsubframe_screenHeight(this.__wbg_ptr);
|
|
592
466
|
return ret;
|
|
593
467
|
}
|
|
594
468
|
/**
|
|
595
469
|
* @returns {number}
|
|
596
470
|
*/
|
|
597
|
-
get
|
|
598
|
-
const ret = wasm.
|
|
471
|
+
get screenWidth() {
|
|
472
|
+
const ret = wasm.vobsubframe_screenWidth(this.__wbg_ptr);
|
|
599
473
|
return ret;
|
|
600
474
|
}
|
|
601
475
|
/**
|
|
@@ -608,16 +482,15 @@ export class VobSubFrame {
|
|
|
608
482
|
/**
|
|
609
483
|
* @returns {number}
|
|
610
484
|
*/
|
|
611
|
-
get
|
|
612
|
-
const ret = wasm.
|
|
485
|
+
get x() {
|
|
486
|
+
const ret = wasm.vobsubframe_x(this.__wbg_ptr);
|
|
613
487
|
return ret;
|
|
614
488
|
}
|
|
615
489
|
/**
|
|
616
|
-
*
|
|
617
|
-
* @returns {Uint8Array}
|
|
490
|
+
* @returns {number}
|
|
618
491
|
*/
|
|
619
|
-
|
|
620
|
-
const ret = wasm.
|
|
492
|
+
get y() {
|
|
493
|
+
const ret = wasm.vobsubframe_y(this.__wbg_ptr);
|
|
621
494
|
return ret;
|
|
622
495
|
}
|
|
623
496
|
}
|
|
@@ -643,6 +516,14 @@ export class VobSubParser {
|
|
|
643
516
|
clearCache() {
|
|
644
517
|
wasm.vobsubparser_clearCache(this.__wbg_ptr);
|
|
645
518
|
}
|
|
519
|
+
/**
|
|
520
|
+
* Get the number of subtitle entries.
|
|
521
|
+
* @returns {number}
|
|
522
|
+
*/
|
|
523
|
+
get count() {
|
|
524
|
+
const ret = wasm.vobsubparser_count(this.__wbg_ptr);
|
|
525
|
+
return ret >>> 0;
|
|
526
|
+
}
|
|
646
527
|
/**
|
|
647
528
|
* Check if debanding is enabled.
|
|
648
529
|
* @returns {boolean}
|
|
@@ -651,6 +532,22 @@ export class VobSubParser {
|
|
|
651
532
|
const ret = wasm.vobsubparser_debandEnabled(this.__wbg_ptr);
|
|
652
533
|
return ret !== 0;
|
|
653
534
|
}
|
|
535
|
+
/**
|
|
536
|
+
* Dispose of all resources.
|
|
537
|
+
*/
|
|
538
|
+
dispose() {
|
|
539
|
+
wasm.vobsubparser_dispose(this.__wbg_ptr);
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Find the subtitle index for a given timestamp in milliseconds.
|
|
543
|
+
* Returns -1 if no subtitle should be displayed at this time.
|
|
544
|
+
* @param {number} time_ms
|
|
545
|
+
* @returns {number}
|
|
546
|
+
*/
|
|
547
|
+
findIndexAtTimestamp(time_ms) {
|
|
548
|
+
const ret = wasm.vobsubparser_findIndexAtTimestamp(this.__wbg_ptr, time_ms);
|
|
549
|
+
return ret;
|
|
550
|
+
}
|
|
654
551
|
/**
|
|
655
552
|
* Get all timestamps in milliseconds as a Float64Array.
|
|
656
553
|
* @returns {Float64Array}
|
|
@@ -671,22 +568,6 @@ export class VobSubParser {
|
|
|
671
568
|
const len1 = WASM_VECTOR_LEN;
|
|
672
569
|
wasm.vobsubparser_loadFromData(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
673
570
|
}
|
|
674
|
-
/**
|
|
675
|
-
* Render subtitle at the given index and return RGBA data.
|
|
676
|
-
* @param {number} index
|
|
677
|
-
* @returns {VobSubFrame | undefined}
|
|
678
|
-
*/
|
|
679
|
-
renderAtIndex(index) {
|
|
680
|
-
const ret = wasm.vobsubparser_renderAtIndex(this.__wbg_ptr, index);
|
|
681
|
-
return ret === 0 ? undefined : VobSubFrame.__wrap(ret);
|
|
682
|
-
}
|
|
683
|
-
/**
|
|
684
|
-
* Set the deband sample range in pixels (default: 15).
|
|
685
|
-
* @param {number} range
|
|
686
|
-
*/
|
|
687
|
-
setDebandRange(range) {
|
|
688
|
-
wasm.vobsubparser_setDebandRange(this.__wbg_ptr, range);
|
|
689
|
-
}
|
|
690
571
|
/**
|
|
691
572
|
* Load VobSub from SUB file only (scans for timestamps).
|
|
692
573
|
* @param {Uint8Array} sub_data
|
|
@@ -696,30 +577,6 @@ export class VobSubParser {
|
|
|
696
577
|
const len0 = WASM_VECTOR_LEN;
|
|
697
578
|
wasm.vobsubparser_loadFromSubOnly(this.__wbg_ptr, ptr0, len0);
|
|
698
579
|
}
|
|
699
|
-
/**
|
|
700
|
-
* Enable or disable debanding.
|
|
701
|
-
* @param {boolean} enabled
|
|
702
|
-
*/
|
|
703
|
-
setDebandEnabled(enabled) {
|
|
704
|
-
wasm.vobsubparser_setDebandEnabled(this.__wbg_ptr, enabled);
|
|
705
|
-
}
|
|
706
|
-
/**
|
|
707
|
-
* Set the deband threshold (0.0-255.0, default: 64.0).
|
|
708
|
-
* @param {number} threshold
|
|
709
|
-
*/
|
|
710
|
-
setDebandThreshold(threshold) {
|
|
711
|
-
wasm.vobsubparser_setDebandThreshold(this.__wbg_ptr, threshold);
|
|
712
|
-
}
|
|
713
|
-
/**
|
|
714
|
-
* Find the subtitle index for a given timestamp in milliseconds.
|
|
715
|
-
* Returns -1 if no subtitle should be displayed at this time.
|
|
716
|
-
* @param {number} time_ms
|
|
717
|
-
* @returns {number}
|
|
718
|
-
*/
|
|
719
|
-
findIndexAtTimestamp(time_ms) {
|
|
720
|
-
const ret = wasm.vobsubparser_findIndexAtTimestamp(this.__wbg_ptr, time_ms);
|
|
721
|
-
return ret;
|
|
722
|
-
}
|
|
723
580
|
/**
|
|
724
581
|
* Create a new VobSub parser.
|
|
725
582
|
*/
|
|
@@ -730,18 +587,34 @@ export class VobSubParser {
|
|
|
730
587
|
return this;
|
|
731
588
|
}
|
|
732
589
|
/**
|
|
733
|
-
*
|
|
734
|
-
* @
|
|
590
|
+
* Render subtitle at the given index and return RGBA data.
|
|
591
|
+
* @param {number} index
|
|
592
|
+
* @returns {VobSubFrame | undefined}
|
|
735
593
|
*/
|
|
736
|
-
|
|
737
|
-
const ret = wasm.
|
|
738
|
-
return ret
|
|
594
|
+
renderAtIndex(index) {
|
|
595
|
+
const ret = wasm.vobsubparser_renderAtIndex(this.__wbg_ptr, index);
|
|
596
|
+
return ret === 0 ? undefined : VobSubFrame.__wrap(ret);
|
|
739
597
|
}
|
|
740
598
|
/**
|
|
741
|
-
*
|
|
599
|
+
* Enable or disable debanding.
|
|
600
|
+
* @param {boolean} enabled
|
|
742
601
|
*/
|
|
743
|
-
|
|
744
|
-
wasm.
|
|
602
|
+
setDebandEnabled(enabled) {
|
|
603
|
+
wasm.vobsubparser_setDebandEnabled(this.__wbg_ptr, enabled);
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* Set the deband sample range in pixels (default: 15).
|
|
607
|
+
* @param {number} range
|
|
608
|
+
*/
|
|
609
|
+
setDebandRange(range) {
|
|
610
|
+
wasm.vobsubparser_setDebandRange(this.__wbg_ptr, range);
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Set the deband threshold (0.0-255.0, default: 64.0).
|
|
614
|
+
* @param {number} threshold
|
|
615
|
+
*/
|
|
616
|
+
setDebandThreshold(threshold) {
|
|
617
|
+
wasm.vobsubparser_setDebandThreshold(this.__wbg_ptr, threshold);
|
|
745
618
|
}
|
|
746
619
|
}
|
|
747
620
|
if (Symbol.dispose) VobSubParser.prototype[Symbol.dispose] = VobSubParser.prototype.free;
|
|
@@ -753,7 +626,202 @@ export function init() {
|
|
|
753
626
|
wasm.init();
|
|
754
627
|
}
|
|
755
628
|
|
|
756
|
-
|
|
629
|
+
function __wbg_get_imports() {
|
|
630
|
+
const import0 = {
|
|
631
|
+
__proto__: null,
|
|
632
|
+
__wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
|
|
633
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
634
|
+
},
|
|
635
|
+
__wbg_error_7534b8e9a36f1ab4: function(arg0, arg1) {
|
|
636
|
+
let deferred0_0;
|
|
637
|
+
let deferred0_1;
|
|
638
|
+
try {
|
|
639
|
+
deferred0_0 = arg0;
|
|
640
|
+
deferred0_1 = arg1;
|
|
641
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
642
|
+
} finally {
|
|
643
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
644
|
+
}
|
|
645
|
+
},
|
|
646
|
+
__wbg_length_32ed9a279acd054c: function(arg0) {
|
|
647
|
+
const ret = arg0.length;
|
|
648
|
+
return ret;
|
|
649
|
+
},
|
|
650
|
+
__wbg_new_8a6f238a6ece86ea: function() {
|
|
651
|
+
const ret = new Error();
|
|
652
|
+
return ret;
|
|
653
|
+
},
|
|
654
|
+
__wbg_new_from_slice_a3d2629dc1826784: function(arg0, arg1) {
|
|
655
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
656
|
+
return ret;
|
|
657
|
+
},
|
|
658
|
+
__wbg_new_with_length_6523745c0bd32809: function(arg0) {
|
|
659
|
+
const ret = new Float64Array(arg0 >>> 0);
|
|
660
|
+
return ret;
|
|
661
|
+
},
|
|
662
|
+
__wbg_new_with_length_a2c39cbe88fd8ff1: function(arg0) {
|
|
663
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
664
|
+
return ret;
|
|
665
|
+
},
|
|
666
|
+
__wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
|
|
667
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
668
|
+
},
|
|
669
|
+
__wbg_set_index_78a85f2e336ce120: function(arg0, arg1, arg2) {
|
|
670
|
+
arg0[arg1 >>> 0] = arg2;
|
|
671
|
+
},
|
|
672
|
+
__wbg_stack_0ed75d68575b0f3c: function(arg0, arg1) {
|
|
673
|
+
const ret = arg1.stack;
|
|
674
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
675
|
+
const len1 = WASM_VECTOR_LEN;
|
|
676
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
677
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
678
|
+
},
|
|
679
|
+
__wbindgen_init_externref_table: function() {
|
|
680
|
+
const table = wasm.__wbindgen_externrefs;
|
|
681
|
+
const offset = table.grow(4);
|
|
682
|
+
table.set(0, undefined);
|
|
683
|
+
table.set(offset + 0, undefined);
|
|
684
|
+
table.set(offset + 1, null);
|
|
685
|
+
table.set(offset + 2, true);
|
|
686
|
+
table.set(offset + 3, false);
|
|
687
|
+
},
|
|
688
|
+
};
|
|
689
|
+
return {
|
|
690
|
+
__proto__: null,
|
|
691
|
+
"./libbitsub_bg.js": import0,
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
const PgsParserFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
696
|
+
? { register: () => {}, unregister: () => {} }
|
|
697
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_pgsparser_free(ptr >>> 0, 1));
|
|
698
|
+
const RenderResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
699
|
+
? { register: () => {}, unregister: () => {} }
|
|
700
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_renderresult_free(ptr >>> 0, 1));
|
|
701
|
+
const SubtitleCompositionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
702
|
+
? { register: () => {}, unregister: () => {} }
|
|
703
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_subtitlecomposition_free(ptr >>> 0, 1));
|
|
704
|
+
const SubtitleFrameFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
705
|
+
? { register: () => {}, unregister: () => {} }
|
|
706
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_subtitleframe_free(ptr >>> 0, 1));
|
|
707
|
+
const SubtitleRendererFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
708
|
+
? { register: () => {}, unregister: () => {} }
|
|
709
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_subtitlerenderer_free(ptr >>> 0, 1));
|
|
710
|
+
const VobSubFrameFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
711
|
+
? { register: () => {}, unregister: () => {} }
|
|
712
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_vobsubframe_free(ptr >>> 0, 1));
|
|
713
|
+
const VobSubParserFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
714
|
+
? { register: () => {}, unregister: () => {} }
|
|
715
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_vobsubparser_free(ptr >>> 0, 1));
|
|
716
|
+
|
|
717
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
718
|
+
ptr = ptr >>> 0;
|
|
719
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
let cachedDataViewMemory0 = null;
|
|
723
|
+
function getDataViewMemory0() {
|
|
724
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
725
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
726
|
+
}
|
|
727
|
+
return cachedDataViewMemory0;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
function getStringFromWasm0(ptr, len) {
|
|
731
|
+
ptr = ptr >>> 0;
|
|
732
|
+
return decodeText(ptr, len);
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
let cachedUint8ArrayMemory0 = null;
|
|
736
|
+
function getUint8ArrayMemory0() {
|
|
737
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
738
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
739
|
+
}
|
|
740
|
+
return cachedUint8ArrayMemory0;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
744
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
745
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
746
|
+
WASM_VECTOR_LEN = arg.length;
|
|
747
|
+
return ptr;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
751
|
+
if (realloc === undefined) {
|
|
752
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
753
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
754
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
755
|
+
WASM_VECTOR_LEN = buf.length;
|
|
756
|
+
return ptr;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
let len = arg.length;
|
|
760
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
761
|
+
|
|
762
|
+
const mem = getUint8ArrayMemory0();
|
|
763
|
+
|
|
764
|
+
let offset = 0;
|
|
765
|
+
|
|
766
|
+
for (; offset < len; offset++) {
|
|
767
|
+
const code = arg.charCodeAt(offset);
|
|
768
|
+
if (code > 0x7F) break;
|
|
769
|
+
mem[ptr + offset] = code;
|
|
770
|
+
}
|
|
771
|
+
if (offset !== len) {
|
|
772
|
+
if (offset !== 0) {
|
|
773
|
+
arg = arg.slice(offset);
|
|
774
|
+
}
|
|
775
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
776
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
777
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
778
|
+
|
|
779
|
+
offset += ret.written;
|
|
780
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
WASM_VECTOR_LEN = offset;
|
|
784
|
+
return ptr;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
788
|
+
cachedTextDecoder.decode();
|
|
789
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
790
|
+
let numBytesDecoded = 0;
|
|
791
|
+
function decodeText(ptr, len) {
|
|
792
|
+
numBytesDecoded += len;
|
|
793
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
794
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
795
|
+
cachedTextDecoder.decode();
|
|
796
|
+
numBytesDecoded = len;
|
|
797
|
+
}
|
|
798
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
const cachedTextEncoder = new TextEncoder();
|
|
802
|
+
|
|
803
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
804
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
805
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
806
|
+
view.set(buf);
|
|
807
|
+
return {
|
|
808
|
+
read: arg.length,
|
|
809
|
+
written: buf.length
|
|
810
|
+
};
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
let WASM_VECTOR_LEN = 0;
|
|
815
|
+
|
|
816
|
+
let wasmModule, wasm;
|
|
817
|
+
function __wbg_finalize_init(instance, module) {
|
|
818
|
+
wasm = instance.exports;
|
|
819
|
+
wasmModule = module;
|
|
820
|
+
cachedDataViewMemory0 = null;
|
|
821
|
+
cachedUint8ArrayMemory0 = null;
|
|
822
|
+
wasm.__wbindgen_start();
|
|
823
|
+
return wasm;
|
|
824
|
+
}
|
|
757
825
|
|
|
758
826
|
async function __wbg_load(module, imports) {
|
|
759
827
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
@@ -761,14 +829,12 @@ async function __wbg_load(module, imports) {
|
|
|
761
829
|
try {
|
|
762
830
|
return await WebAssembly.instantiateStreaming(module, imports);
|
|
763
831
|
} catch (e) {
|
|
764
|
-
const validResponse = module.ok &&
|
|
832
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
765
833
|
|
|
766
834
|
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
767
835
|
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);
|
|
768
836
|
|
|
769
|
-
} else {
|
|
770
|
-
throw e;
|
|
771
|
-
}
|
|
837
|
+
} else { throw e; }
|
|
772
838
|
}
|
|
773
839
|
}
|
|
774
840
|
|
|
@@ -783,87 +849,20 @@ async function __wbg_load(module, imports) {
|
|
|
783
849
|
return instance;
|
|
784
850
|
}
|
|
785
851
|
}
|
|
786
|
-
}
|
|
787
852
|
|
|
788
|
-
function
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
|
|
792
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
793
|
-
};
|
|
794
|
-
imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
|
|
795
|
-
let deferred0_0;
|
|
796
|
-
let deferred0_1;
|
|
797
|
-
try {
|
|
798
|
-
deferred0_0 = arg0;
|
|
799
|
-
deferred0_1 = arg1;
|
|
800
|
-
console.error(getStringFromWasm0(arg0, arg1));
|
|
801
|
-
} finally {
|
|
802
|
-
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
853
|
+
function expectedResponseType(type) {
|
|
854
|
+
switch (type) {
|
|
855
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
803
856
|
}
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
const ret = arg0.length;
|
|
807
|
-
return ret;
|
|
808
|
-
};
|
|
809
|
-
imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
|
|
810
|
-
const ret = new Error();
|
|
811
|
-
return ret;
|
|
812
|
-
};
|
|
813
|
-
imports.wbg.__wbg_new_from_slice_f9c22b9153b26992 = function(arg0, arg1) {
|
|
814
|
-
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
815
|
-
return ret;
|
|
816
|
-
};
|
|
817
|
-
imports.wbg.__wbg_new_with_length_806b9e5b8290af7c = function(arg0) {
|
|
818
|
-
const ret = new Float64Array(arg0 >>> 0);
|
|
819
|
-
return ret;
|
|
820
|
-
};
|
|
821
|
-
imports.wbg.__wbg_new_with_length_aa5eaf41d35235e5 = function(arg0) {
|
|
822
|
-
const ret = new Uint8Array(arg0 >>> 0);
|
|
823
|
-
return ret;
|
|
824
|
-
};
|
|
825
|
-
imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
|
|
826
|
-
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
827
|
-
};
|
|
828
|
-
imports.wbg.__wbg_set_index_021489b2916af13e = function(arg0, arg1, arg2) {
|
|
829
|
-
arg0[arg1 >>> 0] = arg2;
|
|
830
|
-
};
|
|
831
|
-
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
|
|
832
|
-
const ret = arg1.stack;
|
|
833
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
834
|
-
const len1 = WASM_VECTOR_LEN;
|
|
835
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
836
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
837
|
-
};
|
|
838
|
-
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
839
|
-
const table = wasm.__wbindgen_externrefs;
|
|
840
|
-
const offset = table.grow(4);
|
|
841
|
-
table.set(0, undefined);
|
|
842
|
-
table.set(offset + 0, undefined);
|
|
843
|
-
table.set(offset + 1, null);
|
|
844
|
-
table.set(offset + 2, true);
|
|
845
|
-
table.set(offset + 3, false);
|
|
846
|
-
};
|
|
847
|
-
|
|
848
|
-
return imports;
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
function __wbg_finalize_init(instance, module) {
|
|
852
|
-
wasm = instance.exports;
|
|
853
|
-
__wbg_init.__wbindgen_wasm_module = module;
|
|
854
|
-
cachedDataViewMemory0 = null;
|
|
855
|
-
cachedUint8ArrayMemory0 = null;
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
wasm.__wbindgen_start();
|
|
859
|
-
return wasm;
|
|
857
|
+
return false;
|
|
858
|
+
}
|
|
860
859
|
}
|
|
861
860
|
|
|
862
861
|
function initSync(module) {
|
|
863
862
|
if (wasm !== undefined) return wasm;
|
|
864
863
|
|
|
865
864
|
|
|
866
|
-
if (
|
|
865
|
+
if (module !== undefined) {
|
|
867
866
|
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
868
867
|
({module} = module)
|
|
869
868
|
} else {
|
|
@@ -883,7 +882,7 @@ async function __wbg_init(module_or_path) {
|
|
|
883
882
|
if (wasm !== undefined) return wasm;
|
|
884
883
|
|
|
885
884
|
|
|
886
|
-
if (
|
|
885
|
+
if (module_or_path !== undefined) {
|
|
887
886
|
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
888
887
|
({module_or_path} = module_or_path)
|
|
889
888
|
} else {
|
|
@@ -891,7 +890,7 @@ async function __wbg_init(module_or_path) {
|
|
|
891
890
|
}
|
|
892
891
|
}
|
|
893
892
|
|
|
894
|
-
if (
|
|
893
|
+
if (module_or_path === undefined) {
|
|
895
894
|
module_or_path = new URL('libbitsub_bg.wasm', import.meta.url);
|
|
896
895
|
}
|
|
897
896
|
const imports = __wbg_get_imports();
|
|
@@ -905,5 +904,4 @@ async function __wbg_init(module_or_path) {
|
|
|
905
904
|
return __wbg_finalize_init(instance, module);
|
|
906
905
|
}
|
|
907
906
|
|
|
908
|
-
export { initSync };
|
|
909
|
-
export default __wbg_init;
|
|
907
|
+
export { initSync, __wbg_init as default };
|