@databio/gtars 0.5.2 → 0.5.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/gtars_js.js CHANGED
@@ -1,214 +1,77 @@
1
- let wasm;
1
+ /* @ts-self-types="./gtars_js.d.ts" */
2
2
 
3
- let cachedUint8ArrayMemory0 = null;
4
-
5
- function getUint8ArrayMemory0() {
6
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
7
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
8
- }
9
- return cachedUint8ArrayMemory0;
10
- }
11
-
12
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
13
-
14
- cachedTextDecoder.decode();
15
-
16
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
17
- let numBytesDecoded = 0;
18
- function decodeText(ptr, len) {
19
- numBytesDecoded += len;
20
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
21
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
22
- cachedTextDecoder.decode();
23
- numBytesDecoded = len;
24
- }
25
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
26
- }
27
-
28
- function getStringFromWasm0(ptr, len) {
29
- ptr = ptr >>> 0;
30
- return decodeText(ptr, len);
31
- }
32
-
33
- let WASM_VECTOR_LEN = 0;
34
-
35
- const cachedTextEncoder = new TextEncoder();
36
-
37
- if (!('encodeInto' in cachedTextEncoder)) {
38
- cachedTextEncoder.encodeInto = function (arg, view) {
39
- const buf = cachedTextEncoder.encode(arg);
40
- view.set(buf);
41
- return {
42
- read: arg.length,
43
- written: buf.length
44
- };
3
+ export class BedClassificationOutput {
4
+ static __wrap(ptr) {
5
+ ptr = ptr >>> 0;
6
+ const obj = Object.create(BedClassificationOutput.prototype);
7
+ obj.__wbg_ptr = ptr;
8
+ BedClassificationOutputFinalization.register(obj, obj.__wbg_ptr, obj);
9
+ return obj;
45
10
  }
46
- }
47
-
48
- function passStringToWasm0(arg, malloc, realloc) {
49
-
50
- if (realloc === undefined) {
51
- const buf = cachedTextEncoder.encode(arg);
52
- const ptr = malloc(buf.length, 1) >>> 0;
53
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
54
- WASM_VECTOR_LEN = buf.length;
11
+ __destroy_into_raw() {
12
+ const ptr = this.__wbg_ptr;
13
+ this.__wbg_ptr = 0;
14
+ BedClassificationOutputFinalization.unregister(this);
55
15
  return ptr;
56
16
  }
57
-
58
- let len = arg.length;
59
- let ptr = malloc(len, 1) >>> 0;
60
-
61
- const mem = getUint8ArrayMemory0();
62
-
63
- let offset = 0;
64
-
65
- for (; offset < len; offset++) {
66
- const code = arg.charCodeAt(offset);
67
- if (code > 0x7F) break;
68
- mem[ptr + offset] = code;
69
- }
70
-
71
- if (offset !== len) {
72
- if (offset !== 0) {
73
- arg = arg.slice(offset);
74
- }
75
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
76
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
77
- const ret = cachedTextEncoder.encodeInto(arg, view);
78
-
79
- offset += ret.written;
80
- ptr = realloc(ptr, len, offset, 1) >>> 0;
81
- }
82
-
83
- WASM_VECTOR_LEN = offset;
84
- return ptr;
85
- }
86
-
87
- let cachedDataViewMemory0 = null;
88
-
89
- function getDataViewMemory0() {
90
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
91
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
92
- }
93
- return cachedDataViewMemory0;
94
- }
95
-
96
- function isLikeNone(x) {
97
- return x === undefined || x === null;
98
- }
99
-
100
- function debugString(val) {
101
- // primitive types
102
- const type = typeof val;
103
- if (type == 'number' || type == 'boolean' || val == null) {
104
- return `${val}`;
105
- }
106
- if (type == 'string') {
107
- return `"${val}"`;
108
- }
109
- if (type == 'symbol') {
110
- const description = val.description;
111
- if (description == null) {
112
- return 'Symbol';
113
- } else {
114
- return `Symbol(${description})`;
115
- }
116
- }
117
- if (type == 'function') {
118
- const name = val.name;
119
- if (typeof name == 'string' && name.length > 0) {
120
- return `Function(${name})`;
121
- } else {
122
- return 'Function';
123
- }
17
+ free() {
18
+ const ptr = this.__destroy_into_raw();
19
+ wasm.__wbg_bedclassificationoutput_free(ptr, 0);
124
20
  }
125
- // objects
126
- if (Array.isArray(val)) {
127
- const length = val.length;
128
- let debug = '[';
129
- if (length > 0) {
130
- debug += debugString(val[0]);
131
- }
132
- for(let i = 1; i < length; i++) {
133
- debug += ', ' + debugString(val[i]);
21
+ /**
22
+ * @returns {string}
23
+ */
24
+ get bed_compliance() {
25
+ let deferred1_0;
26
+ let deferred1_1;
27
+ try {
28
+ const ret = wasm.bedclassificationoutput_bed_compliance(this.__wbg_ptr);
29
+ deferred1_0 = ret[0];
30
+ deferred1_1 = ret[1];
31
+ return getStringFromWasm0(ret[0], ret[1]);
32
+ } finally {
33
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
134
34
  }
135
- debug += ']';
136
- return debug;
137
35
  }
138
- // Test for built-in
139
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
140
- let className;
141
- if (builtInMatches && builtInMatches.length > 1) {
142
- className = builtInMatches[1];
143
- } else {
144
- // Failed to match the standard '[object ClassName]'
145
- return toString.call(val);
36
+ /**
37
+ * @returns {number}
38
+ */
39
+ get compliant_columns() {
40
+ const ret = wasm.bedclassificationoutput_compliant_columns(this.__wbg_ptr);
41
+ return ret >>> 0;
146
42
  }
147
- if (className == 'Object') {
148
- // we're a user defined class or Object
149
- // JSON.stringify avoids problems with cycles, and is generally much
150
- // easier than looping through ownProperties of `val`.
43
+ /**
44
+ * @returns {string}
45
+ */
46
+ get data_format() {
47
+ let deferred1_0;
48
+ let deferred1_1;
151
49
  try {
152
- return 'Object(' + JSON.stringify(val) + ')';
153
- } catch (_) {
154
- return 'Object';
50
+ const ret = wasm.bedclassificationoutput_data_format(this.__wbg_ptr);
51
+ deferred1_0 = ret[0];
52
+ deferred1_1 = ret[1];
53
+ return getStringFromWasm0(ret[0], ret[1]);
54
+ } finally {
55
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
155
56
  }
156
57
  }
157
- // errors
158
- if (val instanceof Error) {
159
- return `${val.name}: ${val.message}\n${val.stack}`;
160
- }
161
- // TODO we could test for more things here, like `Set`s and `Map`s.
162
- return className;
163
- }
164
-
165
- function addToExternrefTable0(obj) {
166
- const idx = wasm.__externref_table_alloc();
167
- wasm.__wbindgen_externrefs.set(idx, obj);
168
- return idx;
169
- }
170
-
171
- function handleError(f, args) {
172
- try {
173
- return f.apply(this, args);
174
- } catch (e) {
175
- const idx = addToExternrefTable0(e);
176
- wasm.__wbindgen_exn_store(idx);
58
+ /**
59
+ * @returns {number}
60
+ */
61
+ get non_compliant_columns() {
62
+ const ret = wasm.bedclassificationoutput_non_compliant_columns(this.__wbg_ptr);
63
+ return ret >>> 0;
177
64
  }
178
65
  }
179
-
180
- function getArrayU8FromWasm0(ptr, len) {
181
- ptr = ptr >>> 0;
182
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
183
- }
184
-
185
- function takeFromExternrefTable0(idx) {
186
- const value = wasm.__wbindgen_externrefs.get(idx);
187
- wasm.__externref_table_dealloc(idx);
188
- return value;
189
- }
190
- /**
191
- * @param {string} name
192
- */
193
- export function greet(name) {
194
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
195
- const len0 = WASM_VECTOR_LEN;
196
- wasm.greet(ptr0, len0);
197
- }
198
-
199
- const ChromosomeStatisticsFinalization = (typeof FinalizationRegistry === 'undefined')
200
- ? { register: () => {}, unregister: () => {} }
201
- : new FinalizationRegistry(ptr => wasm.__wbg_chromosomestatistics_free(ptr >>> 0, 1));
66
+ if (Symbol.dispose) BedClassificationOutput.prototype[Symbol.dispose] = BedClassificationOutput.prototype.free;
202
67
 
203
68
  export class ChromosomeStatistics {
204
-
205
69
  __destroy_into_raw() {
206
70
  const ptr = this.__wbg_ptr;
207
71
  this.__wbg_ptr = 0;
208
72
  ChromosomeStatisticsFinalization.unregister(this);
209
73
  return ptr;
210
74
  }
211
-
212
75
  free() {
213
76
  const ptr = this.__destroy_into_raw();
214
77
  wasm.__wbg_chromosomestatistics_free(ptr, 0);
@@ -231,86 +94,76 @@ export class ChromosomeStatistics {
231
94
  /**
232
95
  * @returns {number}
233
96
  */
234
- get start_nucleotide_position() {
235
- const ret = wasm.chromosomestatistics_start_nucleotide_position(this.__wbg_ptr);
97
+ get end_nucleotide_position() {
98
+ const ret = wasm.chromosomestatistics_end_nucleotide_position(this.__wbg_ptr);
236
99
  return ret >>> 0;
237
100
  }
238
101
  /**
239
102
  * @returns {number}
240
103
  */
241
- get end_nucleotide_position() {
242
- const ret = wasm.chromosomestatistics_end_nucleotide_position(this.__wbg_ptr);
104
+ get maximum_region_length() {
105
+ const ret = wasm.chromosomestatistics_maximum_region_length(this.__wbg_ptr);
243
106
  return ret >>> 0;
244
107
  }
245
108
  /**
246
109
  * @returns {number}
247
110
  */
248
- get number_of_regions() {
249
- const ret = wasm.chromosomestatistics_number_of_regions(this.__wbg_ptr);
250
- return ret >>> 0;
111
+ get mean_region_length() {
112
+ const ret = wasm.chromosomestatistics_mean_region_length(this.__wbg_ptr);
113
+ return ret;
251
114
  }
252
115
  /**
253
116
  * @returns {number}
254
117
  */
255
- get minimum_region_length() {
256
- const ret = wasm.chromosomestatistics_minimum_region_length(this.__wbg_ptr);
257
- return ret >>> 0;
118
+ get median_region_length() {
119
+ const ret = wasm.chromosomestatistics_median_region_length(this.__wbg_ptr);
120
+ return ret;
258
121
  }
259
122
  /**
260
123
  * @returns {number}
261
124
  */
262
- get maximum_region_length() {
263
- const ret = wasm.chromosomestatistics_maximum_region_length(this.__wbg_ptr);
125
+ get minimum_region_length() {
126
+ const ret = wasm.bedclassificationoutput_compliant_columns(this.__wbg_ptr);
264
127
  return ret >>> 0;
265
128
  }
266
129
  /**
267
130
  * @returns {number}
268
131
  */
269
- get mean_region_length() {
270
- const ret = wasm.chromosomestatistics_mean_region_length(this.__wbg_ptr);
271
- return ret;
132
+ get number_of_regions() {
133
+ const ret = wasm.chromosomestatistics_number_of_regions(this.__wbg_ptr);
134
+ return ret >>> 0;
272
135
  }
273
136
  /**
274
137
  * @returns {number}
275
138
  */
276
- get median_region_length() {
277
- const ret = wasm.chromosomestatistics_median_region_length(this.__wbg_ptr);
278
- return ret;
279
- }
280
- }
139
+ get start_nucleotide_position() {
140
+ const ret = wasm.chromosomestatistics_start_nucleotide_position(this.__wbg_ptr);
141
+ return ret >>> 0;
142
+ }
143
+ }
281
144
  if (Symbol.dispose) ChromosomeStatistics.prototype[Symbol.dispose] = ChromosomeStatistics.prototype.free;
282
145
 
283
- const OverlapperFinalization = (typeof FinalizationRegistry === 'undefined')
284
- ? { register: () => {}, unregister: () => {} }
285
- : new FinalizationRegistry(ptr => wasm.__wbg_overlapper_free(ptr >>> 0, 1));
286
-
287
146
  export class Overlapper {
288
-
289
147
  __destroy_into_raw() {
290
148
  const ptr = this.__wbg_ptr;
291
149
  this.__wbg_ptr = 0;
292
150
  OverlapperFinalization.unregister(this);
293
151
  return ptr;
294
152
  }
295
-
296
153
  free() {
297
154
  const ptr = this.__destroy_into_raw();
298
155
  wasm.__wbg_overlapper_free(ptr, 0);
299
156
  }
300
157
  /**
301
- * @param {any} universe
302
- * @param {string} backend
158
+ * @param {any} regions
159
+ * @returns {any}
303
160
  */
304
- constructor(universe, backend) {
305
- const ptr0 = passStringToWasm0(backend, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
306
- const len0 = WASM_VECTOR_LEN;
307
- const ret = wasm.overlapper_new(universe, ptr0, len0);
161
+ find(regions) {
162
+ const ret = wasm.overlapper_find(this.__wbg_ptr, regions);
308
163
  if (ret[2]) {
309
164
  throw takeFromExternrefTable0(ret[1]);
310
165
  }
311
- this.__wbg_ptr = ret[0] >>> 0;
312
- OverlapperFinalization.register(this, this.__wbg_ptr, this);
313
- return this;
166
+ return takeFromExternrefTable0(ret[0]);
314
167
  }
315
168
  /**
316
169
  * @returns {string}
@@ -328,32 +181,30 @@ export class Overlapper {
328
181
  }
329
182
  }
330
183
  /**
331
- * @param {any} regions
332
- * @returns {any}
184
+ * @param {any} universe
185
+ * @param {string} backend
333
186
  */
334
- find(regions) {
335
- const ret = wasm.overlapper_find(this.__wbg_ptr, regions);
187
+ constructor(universe, backend) {
188
+ const ptr0 = passStringToWasm0(backend, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
189
+ const len0 = WASM_VECTOR_LEN;
190
+ const ret = wasm.overlapper_new(universe, ptr0, len0);
336
191
  if (ret[2]) {
337
192
  throw takeFromExternrefTable0(ret[1]);
338
193
  }
339
- return takeFromExternrefTable0(ret[0]);
194
+ this.__wbg_ptr = ret[0] >>> 0;
195
+ OverlapperFinalization.register(this, this.__wbg_ptr, this);
196
+ return this;
340
197
  }
341
198
  }
342
199
  if (Symbol.dispose) Overlapper.prototype[Symbol.dispose] = Overlapper.prototype.free;
343
200
 
344
- const RegionDistributionFinalization = (typeof FinalizationRegistry === 'undefined')
345
- ? { register: () => {}, unregister: () => {} }
346
- : new FinalizationRegistry(ptr => wasm.__wbg_regiondistribution_free(ptr >>> 0, 1));
347
-
348
201
  export class RegionDistribution {
349
-
350
202
  __destroy_into_raw() {
351
203
  const ptr = this.__wbg_ptr;
352
204
  this.__wbg_ptr = 0;
353
205
  RegionDistributionFinalization.unregister(this);
354
206
  return ptr;
355
207
  }
356
-
357
208
  free() {
358
209
  const ptr = this.__destroy_into_raw();
359
210
  wasm.__wbg_regiondistribution_free(ptr, 0);
@@ -361,55 +212,48 @@ export class RegionDistribution {
361
212
  }
362
213
  if (Symbol.dispose) RegionDistribution.prototype[Symbol.dispose] = RegionDistribution.prototype.free;
363
214
 
364
- const RegionSetFinalization = (typeof FinalizationRegistry === 'undefined')
365
- ? { register: () => {}, unregister: () => {} }
366
- : new FinalizationRegistry(ptr => wasm.__wbg_regionset_free(ptr >>> 0, 1));
367
-
368
215
  export class RegionSet {
369
-
370
216
  __destroy_into_raw() {
371
217
  const ptr = this.__wbg_ptr;
372
218
  this.__wbg_ptr = 0;
373
219
  RegionSetFinalization.unregister(this);
374
220
  return ptr;
375
221
  }
376
-
377
222
  free() {
378
223
  const ptr = this.__destroy_into_raw();
379
224
  wasm.__wbg_regionset_free(ptr, 0);
380
225
  }
381
226
  /**
382
- * @param {any} regions
227
+ * @returns {any}
383
228
  */
384
- constructor(regions) {
385
- const ret = wasm.regionset_new(regions);
229
+ chromosomeStatistics() {
230
+ const ret = wasm.regionset_chromosomeStatistics(this.__wbg_ptr);
386
231
  if (ret[2]) {
387
232
  throw takeFromExternrefTable0(ret[1]);
388
233
  }
389
- this.__wbg_ptr = ret[0] >>> 0;
390
- RegionSetFinalization.register(this, this.__wbg_ptr, this);
391
- return this;
392
- }
393
- /**
394
- * @returns {number}
395
- */
396
- get numberOfRegions() {
397
- const ret = wasm.regionset_numberOfRegions(this.__wbg_ptr);
398
- return ret;
234
+ return takeFromExternrefTable0(ret[0]);
399
235
  }
400
236
  /**
401
- * @returns {number}
237
+ * @returns {BedClassificationOutput}
402
238
  */
403
- get meanRegionWidth() {
404
- const ret = wasm.regionset_meanRegionWidth(this.__wbg_ptr);
405
- return ret;
239
+ get classify() {
240
+ const ret = wasm.regionset_classify(this.__wbg_ptr);
241
+ return BedClassificationOutput.__wrap(ret);
406
242
  }
407
243
  /**
408
- * @returns {number}
244
+ * @returns {string}
409
245
  */
410
- get nucleotidesLength() {
411
- const ret = wasm.regionset_nucleotidesLength(this.__wbg_ptr);
412
- return ret;
246
+ get firstRegion() {
247
+ let deferred1_0;
248
+ let deferred1_1;
249
+ try {
250
+ const ret = wasm.regionset_firstRegion(this.__wbg_ptr);
251
+ deferred1_0 = ret[0];
252
+ deferred1_1 = ret[1];
253
+ return getStringFromWasm0(ret[0], ret[1]);
254
+ } finally {
255
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
256
+ }
413
257
  }
414
258
  /**
415
259
  * @returns {string}
@@ -427,14 +271,37 @@ export class RegionSet {
427
271
  }
428
272
  }
429
273
  /**
430
- * @returns {any}
274
+ * @returns {number}
431
275
  */
432
- chromosomeStatistics() {
433
- const ret = wasm.regionset_chromosomeStatistics(this.__wbg_ptr);
276
+ get meanRegionWidth() {
277
+ const ret = wasm.regionset_meanRegionWidth(this.__wbg_ptr);
278
+ return ret;
279
+ }
280
+ /**
281
+ * @param {any} regions
282
+ */
283
+ constructor(regions) {
284
+ const ret = wasm.regionset_new(regions);
434
285
  if (ret[2]) {
435
286
  throw takeFromExternrefTable0(ret[1]);
436
287
  }
437
- return takeFromExternrefTable0(ret[0]);
288
+ this.__wbg_ptr = ret[0] >>> 0;
289
+ RegionSetFinalization.register(this, this.__wbg_ptr, this);
290
+ return this;
291
+ }
292
+ /**
293
+ * @returns {number}
294
+ */
295
+ get nucleotidesLength() {
296
+ const ret = wasm.regionset_nucleotidesLength(this.__wbg_ptr);
297
+ return ret;
298
+ }
299
+ /**
300
+ * @returns {number}
301
+ */
302
+ get numberOfRegions() {
303
+ const ret = wasm.regionset_numberOfRegions(this.__wbg_ptr);
304
+ return ret;
438
305
  }
439
306
  /**
440
307
  * @param {number} n_bins
@@ -450,44 +317,67 @@ export class RegionSet {
450
317
  }
451
318
  if (Symbol.dispose) RegionSet.prototype[Symbol.dispose] = RegionSet.prototype.free;
452
319
 
453
- const TokenizerFinalization = (typeof FinalizationRegistry === 'undefined')
454
- ? { register: () => {}, unregister: () => {} }
455
- : new FinalizationRegistry(ptr => wasm.__wbg_tokenizer_free(ptr >>> 0, 1));
456
-
457
320
  export class Tokenizer {
458
-
459
321
  __destroy_into_raw() {
460
322
  const ptr = this.__wbg_ptr;
461
323
  this.__wbg_ptr = 0;
462
324
  TokenizerFinalization.unregister(this);
463
325
  return ptr;
464
326
  }
465
-
466
327
  free() {
467
328
  const ptr = this.__destroy_into_raw();
468
329
  wasm.__wbg_tokenizer_free(ptr, 0);
469
330
  }
470
331
  /**
471
- * @param {any} universe
472
- * @param {string} backend
332
+ * @returns {string}
473
333
  */
474
- constructor(universe, backend) {
475
- const ptr0 = passStringToWasm0(backend, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
476
- const len0 = WASM_VECTOR_LEN;
477
- const ret = wasm.tokenizer_new(universe, ptr0, len0);
478
- if (ret[2]) {
479
- throw takeFromExternrefTable0(ret[1]);
334
+ get bosToken() {
335
+ let deferred1_0;
336
+ let deferred1_1;
337
+ try {
338
+ const ret = wasm.tokenizer_bosToken(this.__wbg_ptr);
339
+ deferred1_0 = ret[0];
340
+ deferred1_1 = ret[1];
341
+ return getStringFromWasm0(ret[0], ret[1]);
342
+ } finally {
343
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
480
344
  }
481
- this.__wbg_ptr = ret[0] >>> 0;
482
- TokenizerFinalization.register(this, this.__wbg_ptr, this);
483
- return this;
484
345
  }
485
346
  /**
486
- * @param {any} regions
347
+ * @returns {number}
348
+ */
349
+ get bosTokenId() {
350
+ const ret = wasm.tokenizer_bosTokenId(this.__wbg_ptr);
351
+ return ret >>> 0;
352
+ }
353
+ /**
354
+ * @returns {string}
355
+ */
356
+ get clsToken() {
357
+ let deferred1_0;
358
+ let deferred1_1;
359
+ try {
360
+ const ret = wasm.tokenizer_clsToken(this.__wbg_ptr);
361
+ deferred1_0 = ret[0];
362
+ deferred1_1 = ret[1];
363
+ return getStringFromWasm0(ret[0], ret[1]);
364
+ } finally {
365
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
366
+ }
367
+ }
368
+ /**
369
+ * @returns {number}
370
+ */
371
+ get clsTokenId() {
372
+ const ret = wasm.tokenizer_clsTokenId(this.__wbg_ptr);
373
+ return ret >>> 0;
374
+ }
375
+ /**
376
+ * @param {any} ids
487
377
  * @returns {any}
488
378
  */
489
- tokenize(regions) {
490
- const ret = wasm.tokenizer_tokenize(this.__wbg_ptr, regions);
379
+ decode(ids) {
380
+ const ret = wasm.tokenizer_decode(this.__wbg_ptr, ids);
491
381
  if (ret[2]) {
492
382
  throw takeFromExternrefTable0(ret[1]);
493
383
  }
@@ -505,24 +395,52 @@ export class Tokenizer {
505
395
  return takeFromExternrefTable0(ret[0]);
506
396
  }
507
397
  /**
508
- * @param {any} ids
398
+ * @returns {string}
399
+ */
400
+ get eosToken() {
401
+ let deferred1_0;
402
+ let deferred1_1;
403
+ try {
404
+ const ret = wasm.tokenizer_eosToken(this.__wbg_ptr);
405
+ deferred1_0 = ret[0];
406
+ deferred1_1 = ret[1];
407
+ return getStringFromWasm0(ret[0], ret[1]);
408
+ } finally {
409
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
410
+ }
411
+ }
412
+ /**
413
+ * @returns {number}
414
+ */
415
+ get eosTokenId() {
416
+ const ret = wasm.tokenizer_eosTokenId(this.__wbg_ptr);
417
+ return ret >>> 0;
418
+ }
419
+ /**
509
420
  * @returns {any}
510
421
  */
511
- decode(ids) {
512
- const ret = wasm.tokenizer_decode(this.__wbg_ptr, ids);
422
+ getVocab() {
423
+ const ret = wasm.tokenizer_getVocab(this.__wbg_ptr);
513
424
  if (ret[2]) {
514
425
  throw takeFromExternrefTable0(ret[1]);
515
426
  }
516
427
  return takeFromExternrefTable0(ret[0]);
517
428
  }
429
+ /**
430
+ * @returns {number}
431
+ */
432
+ get length() {
433
+ const ret = wasm.tokenizer_length(this.__wbg_ptr);
434
+ return ret >>> 0;
435
+ }
518
436
  /**
519
437
  * @returns {string}
520
438
  */
521
- get unkToken() {
439
+ get maskToken() {
522
440
  let deferred1_0;
523
441
  let deferred1_1;
524
442
  try {
525
- const ret = wasm.tokenizer_unkToken(this.__wbg_ptr);
443
+ const ret = wasm.tokenizer_maskToken(this.__wbg_ptr);
526
444
  deferred1_0 = ret[0];
527
445
  deferred1_1 = ret[1];
528
446
  return getStringFromWasm0(ret[0], ret[1]);
@@ -530,6 +448,28 @@ export class Tokenizer {
530
448
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
531
449
  }
532
450
  }
451
+ /**
452
+ * @returns {number}
453
+ */
454
+ get maskTokenId() {
455
+ const ret = wasm.tokenizer_maskTokenId(this.__wbg_ptr);
456
+ return ret >>> 0;
457
+ }
458
+ /**
459
+ * @param {any} universe
460
+ * @param {string} backend
461
+ */
462
+ constructor(universe, backend) {
463
+ const ptr0 = passStringToWasm0(backend, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
464
+ const len0 = WASM_VECTOR_LEN;
465
+ const ret = wasm.tokenizer_new(universe, ptr0, len0);
466
+ if (ret[2]) {
467
+ throw takeFromExternrefTable0(ret[1]);
468
+ }
469
+ this.__wbg_ptr = ret[0] >>> 0;
470
+ TokenizerFinalization.register(this, this.__wbg_ptr, this);
471
+ return this;
472
+ }
533
473
  /**
534
474
  * @returns {string}
535
475
  */
@@ -545,14 +485,21 @@ export class Tokenizer {
545
485
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
546
486
  }
547
487
  }
488
+ /**
489
+ * @returns {number}
490
+ */
491
+ get padTokenId() {
492
+ const ret = wasm.tokenizer_padTokenId(this.__wbg_ptr);
493
+ return ret >>> 0;
494
+ }
548
495
  /**
549
496
  * @returns {string}
550
497
  */
551
- get maskToken() {
498
+ get sepToken() {
552
499
  let deferred1_0;
553
500
  let deferred1_1;
554
501
  try {
555
- const ret = wasm.tokenizer_maskToken(this.__wbg_ptr);
502
+ const ret = wasm.tokenizer_sepToken(this.__wbg_ptr);
556
503
  deferred1_0 = ret[0];
557
504
  deferred1_1 = ret[1];
558
505
  return getStringFromWasm0(ret[0], ret[1]);
@@ -561,58 +508,41 @@ export class Tokenizer {
561
508
  }
562
509
  }
563
510
  /**
564
- * @returns {string}
511
+ * @returns {number}
565
512
  */
566
- get clsToken() {
567
- let deferred1_0;
568
- let deferred1_1;
569
- try {
570
- const ret = wasm.tokenizer_clsToken(this.__wbg_ptr);
571
- deferred1_0 = ret[0];
572
- deferred1_1 = ret[1];
573
- return getStringFromWasm0(ret[0], ret[1]);
574
- } finally {
575
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
576
- }
513
+ get sepTokenId() {
514
+ const ret = wasm.tokenizer_sepTokenId(this.__wbg_ptr);
515
+ return ret >>> 0;
577
516
  }
578
517
  /**
579
- * @returns {string}
518
+ * @returns {any}
580
519
  */
581
- get bosToken() {
582
- let deferred1_0;
583
- let deferred1_1;
584
- try {
585
- const ret = wasm.tokenizer_bosToken(this.__wbg_ptr);
586
- deferred1_0 = ret[0];
587
- deferred1_1 = ret[1];
588
- return getStringFromWasm0(ret[0], ret[1]);
589
- } finally {
590
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
520
+ specialTokensMap() {
521
+ const ret = wasm.tokenizer_specialTokensMap(this.__wbg_ptr);
522
+ if (ret[2]) {
523
+ throw takeFromExternrefTable0(ret[1]);
591
524
  }
525
+ return takeFromExternrefTable0(ret[0]);
592
526
  }
593
527
  /**
594
- * @returns {string}
528
+ * @param {any} regions
529
+ * @returns {any}
595
530
  */
596
- get eosToken() {
597
- let deferred1_0;
598
- let deferred1_1;
599
- try {
600
- const ret = wasm.tokenizer_eosToken(this.__wbg_ptr);
601
- deferred1_0 = ret[0];
602
- deferred1_1 = ret[1];
603
- return getStringFromWasm0(ret[0], ret[1]);
604
- } finally {
605
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
531
+ tokenize(regions) {
532
+ const ret = wasm.tokenizer_tokenize(this.__wbg_ptr, regions);
533
+ if (ret[2]) {
534
+ throw takeFromExternrefTable0(ret[1]);
606
535
  }
536
+ return takeFromExternrefTable0(ret[0]);
607
537
  }
608
538
  /**
609
539
  * @returns {string}
610
540
  */
611
- get sepToken() {
541
+ get unkToken() {
612
542
  let deferred1_0;
613
543
  let deferred1_1;
614
544
  try {
615
- const ret = wasm.tokenizer_sepToken(this.__wbg_ptr);
545
+ const ret = wasm.tokenizer_unkToken(this.__wbg_ptr);
616
546
  deferred1_0 = ret[0];
617
547
  deferred1_1 = ret[1];
618
548
  return getStringFromWasm0(ret[0], ret[1]);
@@ -623,324 +553,466 @@ export class Tokenizer {
623
553
  /**
624
554
  * @returns {number}
625
555
  */
626
- get padTokenId() {
627
- const ret = wasm.tokenizer_padTokenId(this.__wbg_ptr);
556
+ get unkTokenId() {
557
+ const ret = wasm.tokenizer_unkTokenId(this.__wbg_ptr);
628
558
  return ret >>> 0;
629
559
  }
630
560
  /**
631
561
  * @returns {number}
632
562
  */
633
- get maskTokenId() {
634
- const ret = wasm.tokenizer_maskTokenId(this.__wbg_ptr);
563
+ get vocabSize() {
564
+ const ret = wasm.tokenizer_length(this.__wbg_ptr);
635
565
  return ret >>> 0;
636
566
  }
637
- /**
638
- * @returns {number}
639
- */
640
- get clsTokenId() {
641
- const ret = wasm.tokenizer_clsTokenId(this.__wbg_ptr);
642
- return ret >>> 0;
567
+ }
568
+ if (Symbol.dispose) Tokenizer.prototype[Symbol.dispose] = Tokenizer.prototype.free;
569
+
570
+ /**
571
+ * @param {string} name
572
+ */
573
+ export function greet(name) {
574
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
575
+ const len0 = WASM_VECTOR_LEN;
576
+ wasm.greet(ptr0, len0);
577
+ }
578
+
579
+ function __wbg_get_imports() {
580
+ const import0 = {
581
+ __proto__: null,
582
+ __wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
583
+ const ret = Error(getStringFromWasm0(arg0, arg1));
584
+ return ret;
585
+ },
586
+ __wbg_String_fed4d24b68977888: function(arg0, arg1) {
587
+ const ret = String(arg1);
588
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
589
+ const len1 = WASM_VECTOR_LEN;
590
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
591
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
592
+ },
593
+ __wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25: function(arg0) {
594
+ const v = arg0;
595
+ const ret = typeof(v) === 'boolean' ? v : undefined;
596
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
597
+ },
598
+ __wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {
599
+ const ret = debugString(arg1);
600
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
601
+ const len1 = WASM_VECTOR_LEN;
602
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
603
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
604
+ },
605
+ __wbg___wbindgen_is_function_0095a73b8b156f76: function(arg0) {
606
+ const ret = typeof(arg0) === 'function';
607
+ return ret;
608
+ },
609
+ __wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {
610
+ const val = arg0;
611
+ const ret = typeof(val) === 'object' && val !== null;
612
+ return ret;
613
+ },
614
+ __wbg___wbindgen_is_string_cd444516edc5b180: function(arg0) {
615
+ const ret = typeof(arg0) === 'string';
616
+ return ret;
617
+ },
618
+ __wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811: function(arg0, arg1) {
619
+ const ret = arg0 == arg1;
620
+ return ret;
621
+ },
622
+ __wbg___wbindgen_number_get_8ff4255516ccad3e: function(arg0, arg1) {
623
+ const obj = arg1;
624
+ const ret = typeof(obj) === 'number' ? obj : undefined;
625
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
626
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
627
+ },
628
+ __wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
629
+ const obj = arg1;
630
+ const ret = typeof(obj) === 'string' ? obj : undefined;
631
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
632
+ var len1 = WASM_VECTOR_LEN;
633
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
634
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
635
+ },
636
+ __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
637
+ throw new Error(getStringFromWasm0(arg0, arg1));
638
+ },
639
+ __wbg_alert_a95ce7722f153d07: function(arg0, arg1) {
640
+ alert(getStringFromWasm0(arg0, arg1));
641
+ },
642
+ __wbg_call_389efe28435a9388: function() { return handleError(function (arg0, arg1) {
643
+ const ret = arg0.call(arg1);
644
+ return ret;
645
+ }, arguments); },
646
+ __wbg_done_57b39ecd9addfe81: function(arg0) {
647
+ const ret = arg0.done;
648
+ return ret;
649
+ },
650
+ __wbg_get_9b94d73e6221f75c: function(arg0, arg1) {
651
+ const ret = arg0[arg1 >>> 0];
652
+ return ret;
653
+ },
654
+ __wbg_get_b3ed3ad4be2bc8ac: function() { return handleError(function (arg0, arg1) {
655
+ const ret = Reflect.get(arg0, arg1);
656
+ return ret;
657
+ }, arguments); },
658
+ __wbg_instanceof_ArrayBuffer_c367199e2fa2aa04: function(arg0) {
659
+ let result;
660
+ try {
661
+ result = arg0 instanceof ArrayBuffer;
662
+ } catch (_) {
663
+ result = false;
664
+ }
665
+ const ret = result;
666
+ return ret;
667
+ },
668
+ __wbg_instanceof_Uint8Array_9b9075935c74707c: function(arg0) {
669
+ let result;
670
+ try {
671
+ result = arg0 instanceof Uint8Array;
672
+ } catch (_) {
673
+ result = false;
674
+ }
675
+ const ret = result;
676
+ return ret;
677
+ },
678
+ __wbg_isArray_d314bb98fcf08331: function(arg0) {
679
+ const ret = Array.isArray(arg0);
680
+ return ret;
681
+ },
682
+ __wbg_isSafeInteger_bfbc7332a9768d2a: function(arg0) {
683
+ const ret = Number.isSafeInteger(arg0);
684
+ return ret;
685
+ },
686
+ __wbg_iterator_6ff6560ca1568e55: function() {
687
+ const ret = Symbol.iterator;
688
+ return ret;
689
+ },
690
+ __wbg_length_32ed9a279acd054c: function(arg0) {
691
+ const ret = arg0.length;
692
+ return ret;
693
+ },
694
+ __wbg_length_35a7bace40f36eac: function(arg0) {
695
+ const ret = arg0.length;
696
+ return ret;
697
+ },
698
+ __wbg_new_361308b2356cecd0: function() {
699
+ const ret = new Object();
700
+ return ret;
701
+ },
702
+ __wbg_new_3eb36ae241fe6f44: function() {
703
+ const ret = new Array();
704
+ return ret;
705
+ },
706
+ __wbg_new_dca287b076112a51: function() {
707
+ const ret = new Map();
708
+ return ret;
709
+ },
710
+ __wbg_new_dd2b680c8bf6ae29: function(arg0) {
711
+ const ret = new Uint8Array(arg0);
712
+ return ret;
713
+ },
714
+ __wbg_next_3482f54c49e8af19: function() { return handleError(function (arg0) {
715
+ const ret = arg0.next();
716
+ return ret;
717
+ }, arguments); },
718
+ __wbg_next_418f80d8f5303233: function(arg0) {
719
+ const ret = arg0.next;
720
+ return ret;
721
+ },
722
+ __wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
723
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
724
+ },
725
+ __wbg_set_1eb0999cf5d27fc8: function(arg0, arg1, arg2) {
726
+ const ret = arg0.set(arg1, arg2);
727
+ return ret;
728
+ },
729
+ __wbg_set_3fda3bac07393de4: function(arg0, arg1, arg2) {
730
+ arg0[arg1] = arg2;
731
+ },
732
+ __wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {
733
+ arg0[arg1 >>> 0] = arg2;
734
+ },
735
+ __wbg_value_0546255b415e96c1: function(arg0) {
736
+ const ret = arg0.value;
737
+ return ret;
738
+ },
739
+ __wbindgen_cast_0000000000000001: function(arg0) {
740
+ // Cast intrinsic for `F64 -> Externref`.
741
+ const ret = arg0;
742
+ return ret;
743
+ },
744
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
745
+ // Cast intrinsic for `Ref(String) -> Externref`.
746
+ const ret = getStringFromWasm0(arg0, arg1);
747
+ return ret;
748
+ },
749
+ __wbindgen_init_externref_table: function() {
750
+ const table = wasm.__wbindgen_externrefs;
751
+ const offset = table.grow(4);
752
+ table.set(0, undefined);
753
+ table.set(offset + 0, undefined);
754
+ table.set(offset + 1, null);
755
+ table.set(offset + 2, true);
756
+ table.set(offset + 3, false);
757
+ },
758
+ };
759
+ return {
760
+ __proto__: null,
761
+ "./gtars_js_bg.js": import0,
762
+ };
763
+ }
764
+
765
+ const BedClassificationOutputFinalization = (typeof FinalizationRegistry === 'undefined')
766
+ ? { register: () => {}, unregister: () => {} }
767
+ : new FinalizationRegistry(ptr => wasm.__wbg_bedclassificationoutput_free(ptr >>> 0, 1));
768
+ const ChromosomeStatisticsFinalization = (typeof FinalizationRegistry === 'undefined')
769
+ ? { register: () => {}, unregister: () => {} }
770
+ : new FinalizationRegistry(ptr => wasm.__wbg_chromosomestatistics_free(ptr >>> 0, 1));
771
+ const OverlapperFinalization = (typeof FinalizationRegistry === 'undefined')
772
+ ? { register: () => {}, unregister: () => {} }
773
+ : new FinalizationRegistry(ptr => wasm.__wbg_overlapper_free(ptr >>> 0, 1));
774
+ const RegionDistributionFinalization = (typeof FinalizationRegistry === 'undefined')
775
+ ? { register: () => {}, unregister: () => {} }
776
+ : new FinalizationRegistry(ptr => wasm.__wbg_regiondistribution_free(ptr >>> 0, 1));
777
+ const RegionSetFinalization = (typeof FinalizationRegistry === 'undefined')
778
+ ? { register: () => {}, unregister: () => {} }
779
+ : new FinalizationRegistry(ptr => wasm.__wbg_regionset_free(ptr >>> 0, 1));
780
+ const TokenizerFinalization = (typeof FinalizationRegistry === 'undefined')
781
+ ? { register: () => {}, unregister: () => {} }
782
+ : new FinalizationRegistry(ptr => wasm.__wbg_tokenizer_free(ptr >>> 0, 1));
783
+
784
+ function addToExternrefTable0(obj) {
785
+ const idx = wasm.__externref_table_alloc();
786
+ wasm.__wbindgen_externrefs.set(idx, obj);
787
+ return idx;
788
+ }
789
+
790
+ function debugString(val) {
791
+ // primitive types
792
+ const type = typeof val;
793
+ if (type == 'number' || type == 'boolean' || val == null) {
794
+ return `${val}`;
643
795
  }
644
- /**
645
- * @returns {number}
646
- */
647
- get bosTokenId() {
648
- const ret = wasm.tokenizer_bosTokenId(this.__wbg_ptr);
649
- return ret >>> 0;
796
+ if (type == 'string') {
797
+ return `"${val}"`;
650
798
  }
651
- /**
652
- * @returns {number}
653
- */
654
- get eosTokenId() {
655
- const ret = wasm.tokenizer_eosTokenId(this.__wbg_ptr);
656
- return ret >>> 0;
799
+ if (type == 'symbol') {
800
+ const description = val.description;
801
+ if (description == null) {
802
+ return 'Symbol';
803
+ } else {
804
+ return `Symbol(${description})`;
805
+ }
657
806
  }
658
- /**
659
- * @returns {number}
660
- */
661
- get sepTokenId() {
662
- const ret = wasm.tokenizer_sepTokenId(this.__wbg_ptr);
663
- return ret >>> 0;
807
+ if (type == 'function') {
808
+ const name = val.name;
809
+ if (typeof name == 'string' && name.length > 0) {
810
+ return `Function(${name})`;
811
+ } else {
812
+ return 'Function';
813
+ }
664
814
  }
665
- /**
666
- * @returns {number}
667
- */
668
- get unkTokenId() {
669
- const ret = wasm.tokenizer_unkTokenId(this.__wbg_ptr);
670
- return ret >>> 0;
815
+ // objects
816
+ if (Array.isArray(val)) {
817
+ const length = val.length;
818
+ let debug = '[';
819
+ if (length > 0) {
820
+ debug += debugString(val[0]);
821
+ }
822
+ for(let i = 1; i < length; i++) {
823
+ debug += ', ' + debugString(val[i]);
824
+ }
825
+ debug += ']';
826
+ return debug;
671
827
  }
672
- /**
673
- * @returns {number}
674
- */
675
- get vocabSize() {
676
- const ret = wasm.tokenizer_length(this.__wbg_ptr);
677
- return ret >>> 0;
828
+ // Test for built-in
829
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
830
+ let className;
831
+ if (builtInMatches && builtInMatches.length > 1) {
832
+ className = builtInMatches[1];
833
+ } else {
834
+ // Failed to match the standard '[object ClassName]'
835
+ return toString.call(val);
678
836
  }
679
- /**
680
- * @returns {any}
681
- */
682
- specialTokensMap() {
683
- const ret = wasm.tokenizer_specialTokensMap(this.__wbg_ptr);
684
- if (ret[2]) {
685
- throw takeFromExternrefTable0(ret[1]);
837
+ if (className == 'Object') {
838
+ // we're a user defined class or Object
839
+ // JSON.stringify avoids problems with cycles, and is generally much
840
+ // easier than looping through ownProperties of `val`.
841
+ try {
842
+ return 'Object(' + JSON.stringify(val) + ')';
843
+ } catch (_) {
844
+ return 'Object';
686
845
  }
687
- return takeFromExternrefTable0(ret[0]);
688
846
  }
689
- /**
690
- * @returns {any}
691
- */
692
- getVocab() {
693
- const ret = wasm.tokenizer_getVocab(this.__wbg_ptr);
694
- if (ret[2]) {
695
- throw takeFromExternrefTable0(ret[1]);
847
+ // errors
848
+ if (val instanceof Error) {
849
+ return `${val.name}: ${val.message}\n${val.stack}`;
850
+ }
851
+ // TODO we could test for more things here, like `Set`s and `Map`s.
852
+ return className;
853
+ }
854
+
855
+ function getArrayU8FromWasm0(ptr, len) {
856
+ ptr = ptr >>> 0;
857
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
858
+ }
859
+
860
+ let cachedDataViewMemory0 = null;
861
+ function getDataViewMemory0() {
862
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
863
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
864
+ }
865
+ return cachedDataViewMemory0;
866
+ }
867
+
868
+ function getStringFromWasm0(ptr, len) {
869
+ ptr = ptr >>> 0;
870
+ return decodeText(ptr, len);
871
+ }
872
+
873
+ let cachedUint8ArrayMemory0 = null;
874
+ function getUint8ArrayMemory0() {
875
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
876
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
877
+ }
878
+ return cachedUint8ArrayMemory0;
879
+ }
880
+
881
+ function handleError(f, args) {
882
+ try {
883
+ return f.apply(this, args);
884
+ } catch (e) {
885
+ const idx = addToExternrefTable0(e);
886
+ wasm.__wbindgen_exn_store(idx);
887
+ }
888
+ }
889
+
890
+ function isLikeNone(x) {
891
+ return x === undefined || x === null;
892
+ }
893
+
894
+ function passStringToWasm0(arg, malloc, realloc) {
895
+ if (realloc === undefined) {
896
+ const buf = cachedTextEncoder.encode(arg);
897
+ const ptr = malloc(buf.length, 1) >>> 0;
898
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
899
+ WASM_VECTOR_LEN = buf.length;
900
+ return ptr;
901
+ }
902
+
903
+ let len = arg.length;
904
+ let ptr = malloc(len, 1) >>> 0;
905
+
906
+ const mem = getUint8ArrayMemory0();
907
+
908
+ let offset = 0;
909
+
910
+ for (; offset < len; offset++) {
911
+ const code = arg.charCodeAt(offset);
912
+ if (code > 0x7F) break;
913
+ mem[ptr + offset] = code;
914
+ }
915
+ if (offset !== len) {
916
+ if (offset !== 0) {
917
+ arg = arg.slice(offset);
696
918
  }
697
- return takeFromExternrefTable0(ret[0]);
919
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
920
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
921
+ const ret = cachedTextEncoder.encodeInto(arg, view);
922
+
923
+ offset += ret.written;
924
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
698
925
  }
699
- /**
700
- * @returns {number}
701
- */
702
- get length() {
703
- const ret = wasm.tokenizer_length(this.__wbg_ptr);
704
- return ret >>> 0;
926
+
927
+ WASM_VECTOR_LEN = offset;
928
+ return ptr;
929
+ }
930
+
931
+ function takeFromExternrefTable0(idx) {
932
+ const value = wasm.__wbindgen_externrefs.get(idx);
933
+ wasm.__externref_table_dealloc(idx);
934
+ return value;
935
+ }
936
+
937
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
938
+ cachedTextDecoder.decode();
939
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
940
+ let numBytesDecoded = 0;
941
+ function decodeText(ptr, len) {
942
+ numBytesDecoded += len;
943
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
944
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
945
+ cachedTextDecoder.decode();
946
+ numBytesDecoded = len;
705
947
  }
948
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
949
+ }
950
+
951
+ const cachedTextEncoder = new TextEncoder();
952
+
953
+ if (!('encodeInto' in cachedTextEncoder)) {
954
+ cachedTextEncoder.encodeInto = function (arg, view) {
955
+ const buf = cachedTextEncoder.encode(arg);
956
+ view.set(buf);
957
+ return {
958
+ read: arg.length,
959
+ written: buf.length
960
+ };
961
+ };
706
962
  }
707
- if (Symbol.dispose) Tokenizer.prototype[Symbol.dispose] = Tokenizer.prototype.free;
708
963
 
709
- const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
964
+ let WASM_VECTOR_LEN = 0;
965
+
966
+ let wasmModule, wasm;
967
+ function __wbg_finalize_init(instance, module) {
968
+ wasm = instance.exports;
969
+ wasmModule = module;
970
+ cachedDataViewMemory0 = null;
971
+ cachedUint8ArrayMemory0 = null;
972
+ wasm.__wbindgen_start();
973
+ return wasm;
974
+ }
710
975
 
711
976
  async function __wbg_load(module, imports) {
712
977
  if (typeof Response === 'function' && module instanceof Response) {
713
978
  if (typeof WebAssembly.instantiateStreaming === 'function') {
714
979
  try {
715
980
  return await WebAssembly.instantiateStreaming(module, imports);
716
-
717
981
  } catch (e) {
718
- const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
982
+ const validResponse = module.ok && expectedResponseType(module.type);
719
983
 
720
984
  if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
721
985
  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);
722
986
 
723
- } else {
724
- throw e;
725
- }
987
+ } else { throw e; }
726
988
  }
727
989
  }
728
990
 
729
991
  const bytes = await module.arrayBuffer();
730
992
  return await WebAssembly.instantiate(bytes, imports);
731
-
732
993
  } else {
733
994
  const instance = await WebAssembly.instantiate(module, imports);
734
995
 
735
996
  if (instance instanceof WebAssembly.Instance) {
736
997
  return { instance, module };
737
-
738
998
  } else {
739
999
  return instance;
740
1000
  }
741
1001
  }
742
- }
743
1002
 
744
- function __wbg_get_imports() {
745
- const imports = {};
746
- imports.wbg = {};
747
- imports.wbg.__wbg_Error_e83987f665cf5504 = function(arg0, arg1) {
748
- const ret = Error(getStringFromWasm0(arg0, arg1));
749
- return ret;
750
- };
751
- imports.wbg.__wbg_String_fed4d24b68977888 = function(arg0, arg1) {
752
- const ret = String(arg1);
753
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
754
- const len1 = WASM_VECTOR_LEN;
755
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
756
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
757
- };
758
- imports.wbg.__wbg___wbindgen_boolean_get_6d5a1ee65bab5f68 = function(arg0) {
759
- const v = arg0;
760
- const ret = typeof(v) === 'boolean' ? v : undefined;
761
- return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
762
- };
763
- imports.wbg.__wbg___wbindgen_debug_string_df47ffb5e35e6763 = function(arg0, arg1) {
764
- const ret = debugString(arg1);
765
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
766
- const len1 = WASM_VECTOR_LEN;
767
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
768
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
769
- };
770
- imports.wbg.__wbg___wbindgen_is_function_ee8a6c5833c90377 = function(arg0) {
771
- const ret = typeof(arg0) === 'function';
772
- return ret;
773
- };
774
- imports.wbg.__wbg___wbindgen_is_object_c818261d21f283a4 = function(arg0) {
775
- const val = arg0;
776
- const ret = typeof(val) === 'object' && val !== null;
777
- return ret;
778
- };
779
- imports.wbg.__wbg___wbindgen_is_string_fbb76cb2940daafd = function(arg0) {
780
- const ret = typeof(arg0) === 'string';
781
- return ret;
782
- };
783
- imports.wbg.__wbg___wbindgen_jsval_loose_eq_b664b38a2f582147 = function(arg0, arg1) {
784
- const ret = arg0 == arg1;
785
- return ret;
786
- };
787
- imports.wbg.__wbg___wbindgen_number_get_a20bf9b85341449d = function(arg0, arg1) {
788
- const obj = arg1;
789
- const ret = typeof(obj) === 'number' ? obj : undefined;
790
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
791
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
792
- };
793
- imports.wbg.__wbg___wbindgen_string_get_e4f06c90489ad01b = function(arg0, arg1) {
794
- const obj = arg1;
795
- const ret = typeof(obj) === 'string' ? obj : undefined;
796
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
797
- var len1 = WASM_VECTOR_LEN;
798
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
799
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
800
- };
801
- imports.wbg.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
802
- throw new Error(getStringFromWasm0(arg0, arg1));
803
- };
804
- imports.wbg.__wbg_alert_bc6302c5a36a6d7f = function(arg0, arg1) {
805
- alert(getStringFromWasm0(arg0, arg1));
806
- };
807
- imports.wbg.__wbg_call_e762c39fa8ea36bf = function() { return handleError(function (arg0, arg1) {
808
- const ret = arg0.call(arg1);
809
- return ret;
810
- }, arguments) };
811
- imports.wbg.__wbg_done_2042aa2670fb1db1 = function(arg0) {
812
- const ret = arg0.done;
813
- return ret;
814
- };
815
- imports.wbg.__wbg_get_7bed016f185add81 = function(arg0, arg1) {
816
- const ret = arg0[arg1 >>> 0];
817
- return ret;
818
- };
819
- imports.wbg.__wbg_get_efcb449f58ec27c2 = function() { return handleError(function (arg0, arg1) {
820
- const ret = Reflect.get(arg0, arg1);
821
- return ret;
822
- }, arguments) };
823
- imports.wbg.__wbg_instanceof_ArrayBuffer_70beb1189ca63b38 = function(arg0) {
824
- let result;
825
- try {
826
- result = arg0 instanceof ArrayBuffer;
827
- } catch (_) {
828
- result = false;
829
- }
830
- const ret = result;
831
- return ret;
832
- };
833
- imports.wbg.__wbg_instanceof_Uint8Array_20c8e73002f7af98 = function(arg0) {
834
- let result;
835
- try {
836
- result = arg0 instanceof Uint8Array;
837
- } catch (_) {
838
- result = false;
1003
+ function expectedResponseType(type) {
1004
+ switch (type) {
1005
+ case 'basic': case 'cors': case 'default': return true;
839
1006
  }
840
- const ret = result;
841
- return ret;
842
- };
843
- imports.wbg.__wbg_isArray_96e0af9891d0945d = function(arg0) {
844
- const ret = Array.isArray(arg0);
845
- return ret;
846
- };
847
- imports.wbg.__wbg_isSafeInteger_d216eda7911dde36 = function(arg0) {
848
- const ret = Number.isSafeInteger(arg0);
849
- return ret;
850
- };
851
- imports.wbg.__wbg_iterator_e5822695327a3c39 = function() {
852
- const ret = Symbol.iterator;
853
- return ret;
854
- };
855
- imports.wbg.__wbg_length_69bca3cb64fc8748 = function(arg0) {
856
- const ret = arg0.length;
857
- return ret;
858
- };
859
- imports.wbg.__wbg_length_cdd215e10d9dd507 = function(arg0) {
860
- const ret = arg0.length;
861
- return ret;
862
- };
863
- imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
864
- const ret = new Object();
865
- return ret;
866
- };
867
- imports.wbg.__wbg_new_5a79be3ab53b8aa5 = function(arg0) {
868
- const ret = new Uint8Array(arg0);
869
- return ret;
870
- };
871
- imports.wbg.__wbg_new_68651c719dcda04e = function() {
872
- const ret = new Map();
873
- return ret;
874
- };
875
- imports.wbg.__wbg_new_e17d9f43105b08be = function() {
876
- const ret = new Array();
877
- return ret;
878
- };
879
- imports.wbg.__wbg_next_020810e0ae8ebcb0 = function() { return handleError(function (arg0) {
880
- const ret = arg0.next();
881
- return ret;
882
- }, arguments) };
883
- imports.wbg.__wbg_next_2c826fe5dfec6b6a = function(arg0) {
884
- const ret = arg0.next;
885
- return ret;
886
- };
887
- imports.wbg.__wbg_prototypesetcall_2a6620b6922694b2 = function(arg0, arg1, arg2) {
888
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
889
- };
890
- imports.wbg.__wbg_set_3fda3bac07393de4 = function(arg0, arg1, arg2) {
891
- arg0[arg1] = arg2;
892
- };
893
- imports.wbg.__wbg_set_907fb406c34a251d = function(arg0, arg1, arg2) {
894
- const ret = arg0.set(arg1, arg2);
895
- return ret;
896
- };
897
- imports.wbg.__wbg_set_c213c871859d6500 = function(arg0, arg1, arg2) {
898
- arg0[arg1 >>> 0] = arg2;
899
- };
900
- imports.wbg.__wbg_value_692627309814bb8c = function(arg0) {
901
- const ret = arg0.value;
902
- return ret;
903
- };
904
- imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
905
- // Cast intrinsic for `Ref(String) -> Externref`.
906
- const ret = getStringFromWasm0(arg0, arg1);
907
- return ret;
908
- };
909
- imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
910
- // Cast intrinsic for `F64 -> Externref`.
911
- const ret = arg0;
912
- return ret;
913
- };
914
- imports.wbg.__wbindgen_init_externref_table = function() {
915
- const table = wasm.__wbindgen_externrefs;
916
- const offset = table.grow(4);
917
- table.set(0, undefined);
918
- table.set(offset + 0, undefined);
919
- table.set(offset + 1, null);
920
- table.set(offset + 2, true);
921
- table.set(offset + 3, false);
922
- ;
923
- };
924
-
925
- return imports;
926
- }
927
-
928
- function __wbg_finalize_init(instance, module) {
929
- wasm = instance.exports;
930
- __wbg_init.__wbindgen_wasm_module = module;
931
- cachedDataViewMemory0 = null;
932
- cachedUint8ArrayMemory0 = null;
933
-
934
-
935
- wasm.__wbindgen_start();
936
- return wasm;
1007
+ return false;
1008
+ }
937
1009
  }
938
1010
 
939
1011
  function initSync(module) {
940
1012
  if (wasm !== undefined) return wasm;
941
1013
 
942
1014
 
943
- if (typeof module !== 'undefined') {
1015
+ if (module !== undefined) {
944
1016
  if (Object.getPrototypeOf(module) === Object.prototype) {
945
1017
  ({module} = module)
946
1018
  } else {
@@ -949,13 +1021,10 @@ function initSync(module) {
949
1021
  }
950
1022
 
951
1023
  const imports = __wbg_get_imports();
952
-
953
1024
  if (!(module instanceof WebAssembly.Module)) {
954
1025
  module = new WebAssembly.Module(module);
955
1026
  }
956
-
957
1027
  const instance = new WebAssembly.Instance(module, imports);
958
-
959
1028
  return __wbg_finalize_init(instance, module);
960
1029
  }
961
1030
 
@@ -963,7 +1032,7 @@ async function __wbg_init(module_or_path) {
963
1032
  if (wasm !== undefined) return wasm;
964
1033
 
965
1034
 
966
- if (typeof module_or_path !== 'undefined') {
1035
+ if (module_or_path !== undefined) {
967
1036
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
968
1037
  ({module_or_path} = module_or_path)
969
1038
  } else {
@@ -971,7 +1040,7 @@ async function __wbg_init(module_or_path) {
971
1040
  }
972
1041
  }
973
1042
 
974
- if (typeof module_or_path === 'undefined') {
1043
+ if (module_or_path === undefined) {
975
1044
  module_or_path = new URL('gtars_js_bg.wasm', import.meta.url);
976
1045
  }
977
1046
  const imports = __wbg_get_imports();
@@ -985,5 +1054,4 @@ async function __wbg_init(module_or_path) {
985
1054
  return __wbg_finalize_init(instance, module);
986
1055
  }
987
1056
 
988
- export { initSync };
989
- export default __wbg_init;
1057
+ export { initSync, __wbg_init as default };