@databio/gtars 0.5.1 → 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,215 +1,185 @@
1
- let wasm;
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 = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
13
-
14
- if (typeof TextDecoder !== 'undefined') { 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 = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
22
- cachedTextDecoder.decode();
23
- numBytesDecoded = len;
1
+ /* @ts-self-types="./gtars_js.d.ts" */
2
+
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;
24
10
  }
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 = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
36
-
37
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
38
- ? function (arg, view) {
39
- return cachedTextEncoder.encodeInto(arg, view);
40
- }
41
- : function (arg, view) {
42
- const buf = cachedTextEncoder.encode(arg);
43
- view.set(buf);
44
- return {
45
- read: arg.length,
46
- written: buf.length
47
- };
48
- });
49
-
50
- function passStringToWasm0(arg, malloc, realloc) {
51
-
52
- if (realloc === undefined) {
53
- const buf = cachedTextEncoder.encode(arg);
54
- const ptr = malloc(buf.length, 1) >>> 0;
55
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
56
- WASM_VECTOR_LEN = buf.length;
11
+ __destroy_into_raw() {
12
+ const ptr = this.__wbg_ptr;
13
+ this.__wbg_ptr = 0;
14
+ BedClassificationOutputFinalization.unregister(this);
57
15
  return ptr;
58
16
  }
59
-
60
- let len = arg.length;
61
- let ptr = malloc(len, 1) >>> 0;
62
-
63
- const mem = getUint8ArrayMemory0();
64
-
65
- let offset = 0;
66
-
67
- for (; offset < len; offset++) {
68
- const code = arg.charCodeAt(offset);
69
- if (code > 0x7F) break;
70
- mem[ptr + offset] = code;
17
+ free() {
18
+ const ptr = this.__destroy_into_raw();
19
+ wasm.__wbg_bedclassificationoutput_free(ptr, 0);
71
20
  }
72
-
73
- if (offset !== len) {
74
- if (offset !== 0) {
75
- arg = arg.slice(offset);
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);
76
34
  }
77
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
78
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
79
- const ret = encodeString(arg, view);
80
-
81
- offset += ret.written;
82
- ptr = realloc(ptr, len, offset, 1) >>> 0;
83
35
  }
84
-
85
- WASM_VECTOR_LEN = offset;
86
- return ptr;
87
- }
88
-
89
- let cachedDataViewMemory0 = null;
90
-
91
- function getDataViewMemory0() {
92
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
93
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
36
+ /**
37
+ * @returns {number}
38
+ */
39
+ get compliant_columns() {
40
+ const ret = wasm.bedclassificationoutput_compliant_columns(this.__wbg_ptr);
41
+ return ret >>> 0;
94
42
  }
95
- return cachedDataViewMemory0;
96
- }
97
-
98
- function addToExternrefTable0(obj) {
99
- const idx = wasm.__externref_table_alloc();
100
- wasm.__wbindgen_export_4.set(idx, obj);
101
- return idx;
102
- }
103
-
104
- function handleError(f, args) {
105
- try {
106
- return f.apply(this, args);
107
- } catch (e) {
108
- const idx = addToExternrefTable0(e);
109
- wasm.__wbindgen_exn_store(idx);
43
+ /**
44
+ * @returns {string}
45
+ */
46
+ get data_format() {
47
+ let deferred1_0;
48
+ let deferred1_1;
49
+ try {
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);
56
+ }
57
+ }
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;
110
64
  }
111
65
  }
66
+ if (Symbol.dispose) BedClassificationOutput.prototype[Symbol.dispose] = BedClassificationOutput.prototype.free;
112
67
 
113
- function debugString(val) {
114
- // primitive types
115
- const type = typeof val;
116
- if (type == 'number' || type == 'boolean' || val == null) {
117
- return `${val}`;
68
+ export class ChromosomeStatistics {
69
+ __destroy_into_raw() {
70
+ const ptr = this.__wbg_ptr;
71
+ this.__wbg_ptr = 0;
72
+ ChromosomeStatisticsFinalization.unregister(this);
73
+ return ptr;
118
74
  }
119
- if (type == 'string') {
120
- return `"${val}"`;
75
+ free() {
76
+ const ptr = this.__destroy_into_raw();
77
+ wasm.__wbg_chromosomestatistics_free(ptr, 0);
121
78
  }
122
- if (type == 'symbol') {
123
- const description = val.description;
124
- if (description == null) {
125
- return 'Symbol';
126
- } else {
127
- return `Symbol(${description})`;
79
+ /**
80
+ * @returns {string}
81
+ */
82
+ get chromosome() {
83
+ let deferred1_0;
84
+ let deferred1_1;
85
+ try {
86
+ const ret = wasm.chromosomestatistics_chromosome(this.__wbg_ptr);
87
+ deferred1_0 = ret[0];
88
+ deferred1_1 = ret[1];
89
+ return getStringFromWasm0(ret[0], ret[1]);
90
+ } finally {
91
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
128
92
  }
129
93
  }
130
- if (type == 'function') {
131
- const name = val.name;
132
- if (typeof name == 'string' && name.length > 0) {
133
- return `Function(${name})`;
134
- } else {
135
- return 'Function';
136
- }
94
+ /**
95
+ * @returns {number}
96
+ */
97
+ get end_nucleotide_position() {
98
+ const ret = wasm.chromosomestatistics_end_nucleotide_position(this.__wbg_ptr);
99
+ return ret >>> 0;
137
100
  }
138
- // objects
139
- if (Array.isArray(val)) {
140
- const length = val.length;
141
- let debug = '[';
142
- if (length > 0) {
143
- debug += debugString(val[0]);
144
- }
145
- for(let i = 1; i < length; i++) {
146
- debug += ', ' + debugString(val[i]);
147
- }
148
- debug += ']';
149
- return debug;
101
+ /**
102
+ * @returns {number}
103
+ */
104
+ get maximum_region_length() {
105
+ const ret = wasm.chromosomestatistics_maximum_region_length(this.__wbg_ptr);
106
+ return ret >>> 0;
150
107
  }
151
- // Test for built-in
152
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
153
- let className;
154
- if (builtInMatches && builtInMatches.length > 1) {
155
- className = builtInMatches[1];
156
- } else {
157
- // Failed to match the standard '[object ClassName]'
158
- return toString.call(val);
108
+ /**
109
+ * @returns {number}
110
+ */
111
+ get mean_region_length() {
112
+ const ret = wasm.chromosomestatistics_mean_region_length(this.__wbg_ptr);
113
+ return ret;
159
114
  }
160
- if (className == 'Object') {
161
- // we're a user defined class or Object
162
- // JSON.stringify avoids problems with cycles, and is generally much
163
- // easier than looping through ownProperties of `val`.
164
- try {
165
- return 'Object(' + JSON.stringify(val) + ')';
166
- } catch (_) {
167
- return 'Object';
168
- }
115
+ /**
116
+ * @returns {number}
117
+ */
118
+ get median_region_length() {
119
+ const ret = wasm.chromosomestatistics_median_region_length(this.__wbg_ptr);
120
+ return ret;
169
121
  }
170
- // errors
171
- if (val instanceof Error) {
172
- return `${val.name}: ${val.message}\n${val.stack}`;
122
+ /**
123
+ * @returns {number}
124
+ */
125
+ get minimum_region_length() {
126
+ const ret = wasm.bedclassificationoutput_compliant_columns(this.__wbg_ptr);
127
+ return ret >>> 0;
128
+ }
129
+ /**
130
+ * @returns {number}
131
+ */
132
+ get number_of_regions() {
133
+ const ret = wasm.chromosomestatistics_number_of_regions(this.__wbg_ptr);
134
+ return ret >>> 0;
135
+ }
136
+ /**
137
+ * @returns {number}
138
+ */
139
+ get start_nucleotide_position() {
140
+ const ret = wasm.chromosomestatistics_start_nucleotide_position(this.__wbg_ptr);
141
+ return ret >>> 0;
173
142
  }
174
- // TODO we could test for more things here, like `Set`s and `Map`s.
175
- return className;
176
- }
177
-
178
- function isLikeNone(x) {
179
- return x === undefined || x === null;
180
- }
181
-
182
- function takeFromExternrefTable0(idx) {
183
- const value = wasm.__wbindgen_export_4.get(idx);
184
- wasm.__externref_table_dealloc(idx);
185
- return value;
186
- }
187
- /**
188
- * @param {string} name
189
- */
190
- export function greet(name) {
191
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
192
- const len0 = WASM_VECTOR_LEN;
193
- wasm.greet(ptr0, len0);
194
143
  }
195
-
196
- const OverlapperFinalization = (typeof FinalizationRegistry === 'undefined')
197
- ? { register: () => {}, unregister: () => {} }
198
- : new FinalizationRegistry(ptr => wasm.__wbg_overlapper_free(ptr >>> 0, 1));
144
+ if (Symbol.dispose) ChromosomeStatistics.prototype[Symbol.dispose] = ChromosomeStatistics.prototype.free;
199
145
 
200
146
  export class Overlapper {
201
-
202
147
  __destroy_into_raw() {
203
148
  const ptr = this.__wbg_ptr;
204
149
  this.__wbg_ptr = 0;
205
150
  OverlapperFinalization.unregister(this);
206
151
  return ptr;
207
152
  }
208
-
209
153
  free() {
210
154
  const ptr = this.__destroy_into_raw();
211
155
  wasm.__wbg_overlapper_free(ptr, 0);
212
156
  }
157
+ /**
158
+ * @param {any} regions
159
+ * @returns {any}
160
+ */
161
+ find(regions) {
162
+ const ret = wasm.overlapper_find(this.__wbg_ptr, regions);
163
+ if (ret[2]) {
164
+ throw takeFromExternrefTable0(ret[1]);
165
+ }
166
+ return takeFromExternrefTable0(ret[0]);
167
+ }
168
+ /**
169
+ * @returns {string}
170
+ */
171
+ get_backend() {
172
+ let deferred1_0;
173
+ let deferred1_1;
174
+ try {
175
+ const ret = wasm.overlapper_get_backend(this.__wbg_ptr);
176
+ deferred1_0 = ret[0];
177
+ deferred1_1 = ret[1];
178
+ return getStringFromWasm0(ret[0], ret[1]);
179
+ } finally {
180
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
181
+ }
182
+ }
213
183
  /**
214
184
  * @param {any} universe
215
185
  * @param {string} backend
@@ -225,14 +195,59 @@ export class Overlapper {
225
195
  OverlapperFinalization.register(this, this.__wbg_ptr, this);
226
196
  return this;
227
197
  }
198
+ }
199
+ if (Symbol.dispose) Overlapper.prototype[Symbol.dispose] = Overlapper.prototype.free;
200
+
201
+ export class RegionDistribution {
202
+ __destroy_into_raw() {
203
+ const ptr = this.__wbg_ptr;
204
+ this.__wbg_ptr = 0;
205
+ RegionDistributionFinalization.unregister(this);
206
+ return ptr;
207
+ }
208
+ free() {
209
+ const ptr = this.__destroy_into_raw();
210
+ wasm.__wbg_regiondistribution_free(ptr, 0);
211
+ }
212
+ }
213
+ if (Symbol.dispose) RegionDistribution.prototype[Symbol.dispose] = RegionDistribution.prototype.free;
214
+
215
+ export class RegionSet {
216
+ __destroy_into_raw() {
217
+ const ptr = this.__wbg_ptr;
218
+ this.__wbg_ptr = 0;
219
+ RegionSetFinalization.unregister(this);
220
+ return ptr;
221
+ }
222
+ free() {
223
+ const ptr = this.__destroy_into_raw();
224
+ wasm.__wbg_regionset_free(ptr, 0);
225
+ }
226
+ /**
227
+ * @returns {any}
228
+ */
229
+ chromosomeStatistics() {
230
+ const ret = wasm.regionset_chromosomeStatistics(this.__wbg_ptr);
231
+ if (ret[2]) {
232
+ throw takeFromExternrefTable0(ret[1]);
233
+ }
234
+ return takeFromExternrefTable0(ret[0]);
235
+ }
236
+ /**
237
+ * @returns {BedClassificationOutput}
238
+ */
239
+ get classify() {
240
+ const ret = wasm.regionset_classify(this.__wbg_ptr);
241
+ return BedClassificationOutput.__wrap(ret);
242
+ }
228
243
  /**
229
244
  * @returns {string}
230
245
  */
231
- get_backend() {
246
+ get firstRegion() {
232
247
  let deferred1_0;
233
248
  let deferred1_1;
234
249
  try {
235
- const ret = wasm.overlapper_get_backend(this.__wbg_ptr);
250
+ const ret = wasm.regionset_firstRegion(this.__wbg_ptr);
236
251
  deferred1_0 = ret[0];
237
252
  deferred1_1 = ret[1];
238
253
  return getStringFromWasm0(ret[0], ret[1]);
@@ -240,79 +255,140 @@ export class Overlapper {
240
255
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
241
256
  }
242
257
  }
258
+ /**
259
+ * @returns {string}
260
+ */
261
+ get identifier() {
262
+ let deferred1_0;
263
+ let deferred1_1;
264
+ try {
265
+ const ret = wasm.regionset_identifier(this.__wbg_ptr);
266
+ deferred1_0 = ret[0];
267
+ deferred1_1 = ret[1];
268
+ return getStringFromWasm0(ret[0], ret[1]);
269
+ } finally {
270
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
271
+ }
272
+ }
273
+ /**
274
+ * @returns {number}
275
+ */
276
+ get meanRegionWidth() {
277
+ const ret = wasm.regionset_meanRegionWidth(this.__wbg_ptr);
278
+ return ret;
279
+ }
243
280
  /**
244
281
  * @param {any} regions
282
+ */
283
+ constructor(regions) {
284
+ const ret = wasm.regionset_new(regions);
285
+ if (ret[2]) {
286
+ throw takeFromExternrefTable0(ret[1]);
287
+ }
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;
305
+ }
306
+ /**
307
+ * @param {number} n_bins
245
308
  * @returns {any}
246
309
  */
247
- find(regions) {
248
- const ret = wasm.overlapper_find(this.__wbg_ptr, regions);
310
+ regionDistribution(n_bins) {
311
+ const ret = wasm.regionset_regionDistribution(this.__wbg_ptr, n_bins);
249
312
  if (ret[2]) {
250
313
  throw takeFromExternrefTable0(ret[1]);
251
314
  }
252
315
  return takeFromExternrefTable0(ret[0]);
253
316
  }
254
317
  }
255
-
256
- const TokenizerFinalization = (typeof FinalizationRegistry === 'undefined')
257
- ? { register: () => {}, unregister: () => {} }
258
- : new FinalizationRegistry(ptr => wasm.__wbg_tokenizer_free(ptr >>> 0, 1));
318
+ if (Symbol.dispose) RegionSet.prototype[Symbol.dispose] = RegionSet.prototype.free;
259
319
 
260
320
  export class Tokenizer {
261
-
262
321
  __destroy_into_raw() {
263
322
  const ptr = this.__wbg_ptr;
264
323
  this.__wbg_ptr = 0;
265
324
  TokenizerFinalization.unregister(this);
266
325
  return ptr;
267
326
  }
268
-
269
327
  free() {
270
328
  const ptr = this.__destroy_into_raw();
271
329
  wasm.__wbg_tokenizer_free(ptr, 0);
272
330
  }
273
331
  /**
274
- * @param {any} universe
275
- * @param {string} backend
332
+ * @returns {string}
333
+ */
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);
344
+ }
345
+ }
346
+ /**
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}
276
355
  */
277
- constructor(universe, backend) {
278
- const ptr0 = passStringToWasm0(backend, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
279
- const len0 = WASM_VECTOR_LEN;
280
- const ret = wasm.tokenizer_new(universe, ptr0, len0);
281
- if (ret[2]) {
282
- throw takeFromExternrefTable0(ret[1]);
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);
283
366
  }
284
- this.__wbg_ptr = ret[0] >>> 0;
285
- TokenizerFinalization.register(this, this.__wbg_ptr, this);
286
- return this;
287
367
  }
288
368
  /**
289
- * @param {any} regions
290
- * @returns {any}
369
+ * @returns {number}
291
370
  */
292
- tokenize(regions) {
293
- const ret = wasm.tokenizer_tokenize(this.__wbg_ptr, regions);
294
- if (ret[2]) {
295
- throw takeFromExternrefTable0(ret[1]);
296
- }
297
- return takeFromExternrefTable0(ret[0]);
371
+ get clsTokenId() {
372
+ const ret = wasm.tokenizer_clsTokenId(this.__wbg_ptr);
373
+ return ret >>> 0;
298
374
  }
299
375
  /**
300
- * @param {any} tokens
376
+ * @param {any} ids
301
377
  * @returns {any}
302
378
  */
303
- encode(tokens) {
304
- const ret = wasm.tokenizer_encode(this.__wbg_ptr, tokens);
379
+ decode(ids) {
380
+ const ret = wasm.tokenizer_decode(this.__wbg_ptr, ids);
305
381
  if (ret[2]) {
306
382
  throw takeFromExternrefTable0(ret[1]);
307
383
  }
308
384
  return takeFromExternrefTable0(ret[0]);
309
385
  }
310
386
  /**
311
- * @param {any} ids
387
+ * @param {any} tokens
312
388
  * @returns {any}
313
389
  */
314
- decode(ids) {
315
- const ret = wasm.tokenizer_decode(this.__wbg_ptr, ids);
390
+ encode(tokens) {
391
+ const ret = wasm.tokenizer_encode(this.__wbg_ptr, tokens);
316
392
  if (ret[2]) {
317
393
  throw takeFromExternrefTable0(ret[1]);
318
394
  }
@@ -321,11 +397,11 @@ export class Tokenizer {
321
397
  /**
322
398
  * @returns {string}
323
399
  */
324
- get unkToken() {
400
+ get eosToken() {
325
401
  let deferred1_0;
326
402
  let deferred1_1;
327
403
  try {
328
- const ret = wasm.tokenizer_unkToken(this.__wbg_ptr);
404
+ const ret = wasm.tokenizer_eosToken(this.__wbg_ptr);
329
405
  deferred1_0 = ret[0];
330
406
  deferred1_1 = ret[1];
331
407
  return getStringFromWasm0(ret[0], ret[1]);
@@ -334,19 +410,28 @@ export class Tokenizer {
334
410
  }
335
411
  }
336
412
  /**
337
- * @returns {string}
413
+ * @returns {number}
338
414
  */
339
- get padToken() {
340
- let deferred1_0;
341
- let deferred1_1;
342
- try {
343
- const ret = wasm.tokenizer_padToken(this.__wbg_ptr);
344
- deferred1_0 = ret[0];
345
- deferred1_1 = ret[1];
346
- return getStringFromWasm0(ret[0], ret[1]);
347
- } finally {
348
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
415
+ get eosTokenId() {
416
+ const ret = wasm.tokenizer_eosTokenId(this.__wbg_ptr);
417
+ return ret >>> 0;
418
+ }
419
+ /**
420
+ * @returns {any}
421
+ */
422
+ getVocab() {
423
+ const ret = wasm.tokenizer_getVocab(this.__wbg_ptr);
424
+ if (ret[2]) {
425
+ throw takeFromExternrefTable0(ret[1]);
349
426
  }
427
+ return takeFromExternrefTable0(ret[0]);
428
+ }
429
+ /**
430
+ * @returns {number}
431
+ */
432
+ get length() {
433
+ const ret = wasm.tokenizer_length(this.__wbg_ptr);
434
+ return ret >>> 0;
350
435
  }
351
436
  /**
352
437
  * @returns {string}
@@ -364,28 +449,35 @@ export class Tokenizer {
364
449
  }
365
450
  }
366
451
  /**
367
- * @returns {string}
452
+ * @returns {number}
368
453
  */
369
- get clsToken() {
370
- let deferred1_0;
371
- let deferred1_1;
372
- try {
373
- const ret = wasm.tokenizer_clsToken(this.__wbg_ptr);
374
- deferred1_0 = ret[0];
375
- deferred1_1 = ret[1];
376
- return getStringFromWasm0(ret[0], ret[1]);
377
- } finally {
378
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
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]);
379
468
  }
469
+ this.__wbg_ptr = ret[0] >>> 0;
470
+ TokenizerFinalization.register(this, this.__wbg_ptr, this);
471
+ return this;
380
472
  }
381
473
  /**
382
474
  * @returns {string}
383
475
  */
384
- get bosToken() {
476
+ get padToken() {
385
477
  let deferred1_0;
386
478
  let deferred1_1;
387
479
  try {
388
- const ret = wasm.tokenizer_bosToken(this.__wbg_ptr);
480
+ const ret = wasm.tokenizer_padToken(this.__wbg_ptr);
389
481
  deferred1_0 = ret[0];
390
482
  deferred1_1 = ret[1];
391
483
  return getStringFromWasm0(ret[0], ret[1]);
@@ -393,14 +485,21 @@ export class Tokenizer {
393
485
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
394
486
  }
395
487
  }
488
+ /**
489
+ * @returns {number}
490
+ */
491
+ get padTokenId() {
492
+ const ret = wasm.tokenizer_padTokenId(this.__wbg_ptr);
493
+ return ret >>> 0;
494
+ }
396
495
  /**
397
496
  * @returns {string}
398
497
  */
399
- get eosToken() {
498
+ get sepToken() {
400
499
  let deferred1_0;
401
500
  let deferred1_1;
402
501
  try {
403
- const ret = wasm.tokenizer_eosToken(this.__wbg_ptr);
502
+ const ret = wasm.tokenizer_sepToken(this.__wbg_ptr);
404
503
  deferred1_0 = ret[0];
405
504
  deferred1_1 = ret[1];
406
505
  return getStringFromWasm0(ret[0], ret[1]);
@@ -408,14 +507,42 @@ export class Tokenizer {
408
507
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
409
508
  }
410
509
  }
510
+ /**
511
+ * @returns {number}
512
+ */
513
+ get sepTokenId() {
514
+ const ret = wasm.tokenizer_sepTokenId(this.__wbg_ptr);
515
+ return ret >>> 0;
516
+ }
517
+ /**
518
+ * @returns {any}
519
+ */
520
+ specialTokensMap() {
521
+ const ret = wasm.tokenizer_specialTokensMap(this.__wbg_ptr);
522
+ if (ret[2]) {
523
+ throw takeFromExternrefTable0(ret[1]);
524
+ }
525
+ return takeFromExternrefTable0(ret[0]);
526
+ }
527
+ /**
528
+ * @param {any} regions
529
+ * @returns {any}
530
+ */
531
+ tokenize(regions) {
532
+ const ret = wasm.tokenizer_tokenize(this.__wbg_ptr, regions);
533
+ if (ret[2]) {
534
+ throw takeFromExternrefTable0(ret[1]);
535
+ }
536
+ return takeFromExternrefTable0(ret[0]);
537
+ }
411
538
  /**
412
539
  * @returns {string}
413
540
  */
414
- get sepToken() {
541
+ get unkToken() {
415
542
  let deferred1_0;
416
543
  let deferred1_1;
417
544
  try {
418
- const ret = wasm.tokenizer_sepToken(this.__wbg_ptr);
545
+ const ret = wasm.tokenizer_unkToken(this.__wbg_ptr);
419
546
  deferred1_0 = ret[0];
420
547
  deferred1_1 = ret[1];
421
548
  return getStringFromWasm0(ret[0], ret[1]);
@@ -426,333 +553,466 @@ export class Tokenizer {
426
553
  /**
427
554
  * @returns {number}
428
555
  */
429
- get padTokenId() {
430
- const ret = wasm.tokenizer_padTokenId(this.__wbg_ptr);
556
+ get unkTokenId() {
557
+ const ret = wasm.tokenizer_unkTokenId(this.__wbg_ptr);
431
558
  return ret >>> 0;
432
559
  }
433
560
  /**
434
561
  * @returns {number}
435
562
  */
436
- get maskTokenId() {
437
- const ret = wasm.tokenizer_maskTokenId(this.__wbg_ptr);
563
+ get vocabSize() {
564
+ const ret = wasm.tokenizer_length(this.__wbg_ptr);
438
565
  return ret >>> 0;
439
566
  }
440
- /**
441
- * @returns {number}
442
- */
443
- get clsTokenId() {
444
- const ret = wasm.tokenizer_clsTokenId(this.__wbg_ptr);
445
- 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}`;
795
+ }
796
+ if (type == 'string') {
797
+ return `"${val}"`;
798
+ }
799
+ if (type == 'symbol') {
800
+ const description = val.description;
801
+ if (description == null) {
802
+ return 'Symbol';
803
+ } else {
804
+ return `Symbol(${description})`;
805
+ }
806
+ }
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
+ }
814
+ }
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;
827
+ }
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);
836
+ }
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';
845
+ }
446
846
  }
447
- /**
448
- * @returns {number}
449
- */
450
- get bosTokenId() {
451
- const ret = wasm.tokenizer_bosTokenId(this.__wbg_ptr);
452
- return ret >>> 0;
847
+ // errors
848
+ if (val instanceof Error) {
849
+ return `${val.name}: ${val.message}\n${val.stack}`;
453
850
  }
454
- /**
455
- * @returns {number}
456
- */
457
- get eosTokenId() {
458
- const ret = wasm.tokenizer_eosTokenId(this.__wbg_ptr);
459
- return ret >>> 0;
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);
460
864
  }
461
- /**
462
- * @returns {number}
463
- */
464
- get sepTokenId() {
465
- const ret = wasm.tokenizer_sepTokenId(this.__wbg_ptr);
466
- return ret >>> 0;
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);
467
877
  }
468
- /**
469
- * @returns {number}
470
- */
471
- get unkTokenId() {
472
- const ret = wasm.tokenizer_unkTokenId(this.__wbg_ptr);
473
- return ret >>> 0;
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);
474
887
  }
475
- /**
476
- * @returns {number}
477
- */
478
- get vocabSize() {
479
- const ret = wasm.tokenizer_length(this.__wbg_ptr);
480
- return ret >>> 0;
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;
481
901
  }
482
- /**
483
- * @returns {any}
484
- */
485
- specialTokensMap() {
486
- const ret = wasm.tokenizer_specialTokensMap(this.__wbg_ptr);
487
- if (ret[2]) {
488
- throw takeFromExternrefTable0(ret[1]);
489
- }
490
- return takeFromExternrefTable0(ret[0]);
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;
491
914
  }
492
- /**
493
- * @returns {any}
494
- */
495
- getVocab() {
496
- const ret = wasm.tokenizer_getVocab(this.__wbg_ptr);
497
- if (ret[2]) {
498
- throw takeFromExternrefTable0(ret[1]);
915
+ if (offset !== len) {
916
+ if (offset !== 0) {
917
+ arg = arg.slice(offset);
499
918
  }
500
- 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;
501
925
  }
502
- /**
503
- * @returns {number}
504
- */
505
- get length() {
506
- const ret = wasm.tokenizer_length(this.__wbg_ptr);
507
- 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;
508
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
+ };
509
962
  }
510
963
 
511
- 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
+ }
512
975
 
513
976
  async function __wbg_load(module, imports) {
514
977
  if (typeof Response === 'function' && module instanceof Response) {
515
978
  if (typeof WebAssembly.instantiateStreaming === 'function') {
516
979
  try {
517
980
  return await WebAssembly.instantiateStreaming(module, imports);
518
-
519
981
  } catch (e) {
520
- const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
982
+ const validResponse = module.ok && expectedResponseType(module.type);
521
983
 
522
984
  if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
523
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);
524
986
 
525
- } else {
526
- throw e;
527
- }
987
+ } else { throw e; }
528
988
  }
529
989
  }
530
990
 
531
991
  const bytes = await module.arrayBuffer();
532
992
  return await WebAssembly.instantiate(bytes, imports);
533
-
534
993
  } else {
535
994
  const instance = await WebAssembly.instantiate(module, imports);
536
995
 
537
996
  if (instance instanceof WebAssembly.Instance) {
538
997
  return { instance, module };
539
-
540
998
  } else {
541
999
  return instance;
542
1000
  }
543
1001
  }
544
- }
545
1002
 
546
- function __wbg_get_imports() {
547
- const imports = {};
548
- imports.wbg = {};
549
- imports.wbg.__wbg_Error_0497d5bdba9362e5 = function(arg0, arg1) {
550
- const ret = Error(getStringFromWasm0(arg0, arg1));
551
- return ret;
552
- };
553
- imports.wbg.__wbg_String_fed4d24b68977888 = function(arg0, arg1) {
554
- const ret = String(arg1);
555
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
556
- const len1 = WASM_VECTOR_LEN;
557
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
558
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
559
- };
560
- imports.wbg.__wbg_alert_549ac717be43f76f = function(arg0, arg1) {
561
- alert(getStringFromWasm0(arg0, arg1));
562
- };
563
- imports.wbg.__wbg_buffer_a1a27a0dfa70165d = function(arg0) {
564
- const ret = arg0.buffer;
565
- return ret;
566
- };
567
- imports.wbg.__wbg_call_fbe8be8bf6436ce5 = function() { return handleError(function (arg0, arg1) {
568
- const ret = arg0.call(arg1);
569
- return ret;
570
- }, arguments) };
571
- imports.wbg.__wbg_done_4d01f352bade43b7 = function(arg0) {
572
- const ret = arg0.done;
573
- return ret;
574
- };
575
- imports.wbg.__wbg_get_92470be87867c2e5 = function() { return handleError(function (arg0, arg1) {
576
- const ret = Reflect.get(arg0, arg1);
577
- return ret;
578
- }, arguments) };
579
- imports.wbg.__wbg_get_a131a44bd1eb6979 = function(arg0, arg1) {
580
- const ret = arg0[arg1 >>> 0];
581
- return ret;
582
- };
583
- imports.wbg.__wbg_instanceof_ArrayBuffer_a8b6f580b363f2bc = function(arg0) {
584
- let result;
585
- try {
586
- result = arg0 instanceof ArrayBuffer;
587
- } catch (_) {
588
- result = false;
589
- }
590
- const ret = result;
591
- return ret;
592
- };
593
- imports.wbg.__wbg_instanceof_Uint8Array_ca460677bc155827 = function(arg0) {
594
- let result;
595
- try {
596
- result = arg0 instanceof Uint8Array;
597
- } catch (_) {
598
- result = false;
1003
+ function expectedResponseType(type) {
1004
+ switch (type) {
1005
+ case 'basic': case 'cors': case 'default': return true;
599
1006
  }
600
- const ret = result;
601
- return ret;
602
- };
603
- imports.wbg.__wbg_isArray_5f090bed72bd4f89 = function(arg0) {
604
- const ret = Array.isArray(arg0);
605
- return ret;
606
- };
607
- imports.wbg.__wbg_isSafeInteger_90d7c4674047d684 = function(arg0) {
608
- const ret = Number.isSafeInteger(arg0);
609
- return ret;
610
- };
611
- imports.wbg.__wbg_iterator_4068add5b2aef7a6 = function() {
612
- const ret = Symbol.iterator;
613
- return ret;
614
- };
615
- imports.wbg.__wbg_length_ab6d22b5ead75c72 = function(arg0) {
616
- const ret = arg0.length;
617
- return ret;
618
- };
619
- imports.wbg.__wbg_length_f00ec12454a5d9fd = function(arg0) {
620
- const ret = arg0.length;
621
- return ret;
622
- };
623
- imports.wbg.__wbg_new_07b483f72211fd66 = function() {
624
- const ret = new Object();
625
- return ret;
626
- };
627
- imports.wbg.__wbg_new_58353953ad2097cc = function() {
628
- const ret = new Array();
629
- return ret;
630
- };
631
- imports.wbg.__wbg_new_a979b4b45bd55c7f = function() {
632
- const ret = new Map();
633
- return ret;
634
- };
635
- imports.wbg.__wbg_new_e52b3efaaa774f96 = function(arg0) {
636
- const ret = new Uint8Array(arg0);
637
- return ret;
638
- };
639
- imports.wbg.__wbg_next_8bb824d217961b5d = function(arg0) {
640
- const ret = arg0.next;
641
- return ret;
642
- };
643
- imports.wbg.__wbg_next_e2da48d8fff7439a = function() { return handleError(function (arg0) {
644
- const ret = arg0.next();
645
- return ret;
646
- }, arguments) };
647
- imports.wbg.__wbg_set_3fda3bac07393de4 = function(arg0, arg1, arg2) {
648
- arg0[arg1] = arg2;
649
- };
650
- imports.wbg.__wbg_set_7422acbe992d64ab = function(arg0, arg1, arg2) {
651
- arg0[arg1 >>> 0] = arg2;
652
- };
653
- imports.wbg.__wbg_set_d6bdfd275fb8a4ce = function(arg0, arg1, arg2) {
654
- const ret = arg0.set(arg1, arg2);
655
- return ret;
656
- };
657
- imports.wbg.__wbg_set_fe4e79d1ed3b0e9b = function(arg0, arg1, arg2) {
658
- arg0.set(arg1, arg2 >>> 0);
659
- };
660
- imports.wbg.__wbg_value_17b896954e14f896 = function(arg0) {
661
- const ret = arg0.value;
662
- return ret;
663
- };
664
- imports.wbg.__wbindgen_boolean_get = function(arg0) {
665
- const v = arg0;
666
- const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
667
- return ret;
668
- };
669
- imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
670
- const ret = debugString(arg1);
671
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
672
- const len1 = WASM_VECTOR_LEN;
673
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
674
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
675
- };
676
- imports.wbg.__wbindgen_init_externref_table = function() {
677
- const table = wasm.__wbindgen_export_4;
678
- const offset = table.grow(4);
679
- table.set(0, undefined);
680
- table.set(offset + 0, undefined);
681
- table.set(offset + 1, null);
682
- table.set(offset + 2, true);
683
- table.set(offset + 3, false);
684
- ;
685
- };
686
- imports.wbg.__wbindgen_is_function = function(arg0) {
687
- const ret = typeof(arg0) === 'function';
688
- return ret;
689
- };
690
- imports.wbg.__wbindgen_is_object = function(arg0) {
691
- const val = arg0;
692
- const ret = typeof(val) === 'object' && val !== null;
693
- return ret;
694
- };
695
- imports.wbg.__wbindgen_is_string = function(arg0) {
696
- const ret = typeof(arg0) === 'string';
697
- return ret;
698
- };
699
- imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
700
- const ret = arg0 == arg1;
701
- return ret;
702
- };
703
- imports.wbg.__wbindgen_memory = function() {
704
- const ret = wasm.memory;
705
- return ret;
706
- };
707
- imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
708
- const obj = arg1;
709
- const ret = typeof(obj) === 'number' ? obj : undefined;
710
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
711
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
712
- };
713
- imports.wbg.__wbindgen_number_new = function(arg0) {
714
- const ret = arg0;
715
- return ret;
716
- };
717
- imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
718
- const obj = arg1;
719
- const ret = typeof(obj) === 'string' ? obj : undefined;
720
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
721
- var len1 = WASM_VECTOR_LEN;
722
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
723
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
724
- };
725
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
726
- const ret = getStringFromWasm0(arg0, arg1);
727
- return ret;
728
- };
729
- imports.wbg.__wbindgen_throw = function(arg0, arg1) {
730
- throw new Error(getStringFromWasm0(arg0, arg1));
731
- };
732
-
733
- return imports;
734
- }
735
-
736
- function __wbg_init_memory(imports, memory) {
737
-
738
- }
739
-
740
- function __wbg_finalize_init(instance, module) {
741
- wasm = instance.exports;
742
- __wbg_init.__wbindgen_wasm_module = module;
743
- cachedDataViewMemory0 = null;
744
- cachedUint8ArrayMemory0 = null;
745
-
746
-
747
- wasm.__wbindgen_start();
748
- return wasm;
1007
+ return false;
1008
+ }
749
1009
  }
750
1010
 
751
1011
  function initSync(module) {
752
1012
  if (wasm !== undefined) return wasm;
753
1013
 
754
1014
 
755
- if (typeof module !== 'undefined') {
1015
+ if (module !== undefined) {
756
1016
  if (Object.getPrototypeOf(module) === Object.prototype) {
757
1017
  ({module} = module)
758
1018
  } else {
@@ -761,15 +1021,10 @@ function initSync(module) {
761
1021
  }
762
1022
 
763
1023
  const imports = __wbg_get_imports();
764
-
765
- __wbg_init_memory(imports);
766
-
767
1024
  if (!(module instanceof WebAssembly.Module)) {
768
1025
  module = new WebAssembly.Module(module);
769
1026
  }
770
-
771
1027
  const instance = new WebAssembly.Instance(module, imports);
772
-
773
1028
  return __wbg_finalize_init(instance, module);
774
1029
  }
775
1030
 
@@ -777,7 +1032,7 @@ async function __wbg_init(module_or_path) {
777
1032
  if (wasm !== undefined) return wasm;
778
1033
 
779
1034
 
780
- if (typeof module_or_path !== 'undefined') {
1035
+ if (module_or_path !== undefined) {
781
1036
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
782
1037
  ({module_or_path} = module_or_path)
783
1038
  } else {
@@ -785,7 +1040,7 @@ async function __wbg_init(module_or_path) {
785
1040
  }
786
1041
  }
787
1042
 
788
- if (typeof module_or_path === 'undefined') {
1043
+ if (module_or_path === undefined) {
789
1044
  module_or_path = new URL('gtars_js_bg.wasm', import.meta.url);
790
1045
  }
791
1046
  const imports = __wbg_get_imports();
@@ -794,12 +1049,9 @@ async function __wbg_init(module_or_path) {
794
1049
  module_or_path = fetch(module_or_path);
795
1050
  }
796
1051
 
797
- __wbg_init_memory(imports);
798
-
799
1052
  const { instance, module } = await __wbg_load(await module_or_path, imports);
800
1053
 
801
1054
  return __wbg_finalize_init(instance, module);
802
1055
  }
803
1056
 
804
- export { initSync };
805
- export default __wbg_init;
1057
+ export { initSync, __wbg_init as default };