@gmod/cram 7.0.2 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/cram-bundle.js +1 -1
  2. package/dist/cramFile/codecs/beta.js +27 -3
  3. package/dist/cramFile/codecs/beta.js.map +1 -1
  4. package/dist/cramFile/codecs/external.d.ts +1 -0
  5. package/dist/cramFile/codecs/external.js +15 -0
  6. package/dist/cramFile/codecs/external.js.map +1 -1
  7. package/dist/cramFile/codecs/gamma.js +44 -8
  8. package/dist/cramFile/codecs/gamma.js.map +1 -1
  9. package/dist/cramFile/codecs/getBits.js +18 -2
  10. package/dist/cramFile/codecs/getBits.js.map +1 -1
  11. package/dist/cramFile/codecs/huffman.js +37 -3
  12. package/dist/cramFile/codecs/huffman.js.map +1 -1
  13. package/dist/cramFile/codecs/subexp.js +37 -15
  14. package/dist/cramFile/codecs/subexp.js.map +1 -1
  15. package/dist/cramFile/file.d.ts +1 -1
  16. package/dist/cramFile/file.js +1 -1
  17. package/dist/cramFile/file.js.map +1 -1
  18. package/dist/cramFile/record.d.ts +12 -1
  19. package/dist/cramFile/record.js +18 -5
  20. package/dist/cramFile/record.js.map +1 -1
  21. package/dist/cramFile/slice/decodeRecord.d.ts +4 -3
  22. package/dist/cramFile/slice/decodeRecord.js +95 -53
  23. package/dist/cramFile/slice/decodeRecord.js.map +1 -1
  24. package/dist/cramFile/slice/index.d.ts +3 -3
  25. package/dist/cramFile/slice/index.js +63 -8
  26. package/dist/cramFile/slice/index.js.map +1 -1
  27. package/dist/indexedCramFile.d.ts +3 -3
  28. package/dist/indexedCramFile.js +12 -9
  29. package/dist/indexedCramFile.js.map +1 -1
  30. package/dist/wasm/noodles-cram/noodles_cram_wasm.d.ts +1 -0
  31. package/dist/wasm/noodles-cram/noodles_cram_wasm.js +44 -0
  32. package/dist/wasm/noodles-cram/noodles_cram_wasm.js.map +1 -0
  33. package/dist/wasm/noodles-cram/noodles_cram_wasm_bg.d.ts +94 -0
  34. package/dist/wasm/noodles-cram/noodles_cram_wasm_bg.js +578 -0
  35. package/dist/wasm/noodles-cram/noodles_cram_wasm_bg.js.map +1 -0
  36. package/esm/cramFile/codecs/beta.js +27 -3
  37. package/esm/cramFile/codecs/beta.js.map +1 -1
  38. package/esm/cramFile/codecs/external.d.ts +1 -0
  39. package/esm/cramFile/codecs/external.js +15 -0
  40. package/esm/cramFile/codecs/external.js.map +1 -1
  41. package/esm/cramFile/codecs/gamma.js +43 -7
  42. package/esm/cramFile/codecs/gamma.js.map +1 -1
  43. package/esm/cramFile/codecs/getBits.js +18 -2
  44. package/esm/cramFile/codecs/getBits.js.map +1 -1
  45. package/esm/cramFile/codecs/huffman.js +37 -3
  46. package/esm/cramFile/codecs/huffman.js.map +1 -1
  47. package/esm/cramFile/codecs/subexp.js +36 -14
  48. package/esm/cramFile/codecs/subexp.js.map +1 -1
  49. package/esm/cramFile/file.d.ts +1 -1
  50. package/esm/cramFile/file.js +1 -1
  51. package/esm/cramFile/file.js.map +1 -1
  52. package/esm/cramFile/record.d.ts +12 -1
  53. package/esm/cramFile/record.js +17 -4
  54. package/esm/cramFile/record.js.map +1 -1
  55. package/esm/cramFile/slice/decodeRecord.d.ts +4 -3
  56. package/esm/cramFile/slice/decodeRecord.js +95 -53
  57. package/esm/cramFile/slice/decodeRecord.js.map +1 -1
  58. package/esm/cramFile/slice/index.d.ts +3 -3
  59. package/esm/cramFile/slice/index.js +30 -8
  60. package/esm/cramFile/slice/index.js.map +1 -1
  61. package/esm/indexedCramFile.d.ts +3 -3
  62. package/esm/indexedCramFile.js +12 -9
  63. package/esm/indexedCramFile.js.map +1 -1
  64. package/esm/wasm/noodles-cram/noodles_cram_wasm.d.ts +1 -0
  65. package/esm/wasm/noodles-cram/noodles_cram_wasm.js +6 -0
  66. package/esm/wasm/noodles-cram/noodles_cram_wasm.js.map +1 -0
  67. package/esm/wasm/noodles-cram/noodles_cram_wasm_bg.d.ts +94 -0
  68. package/esm/wasm/noodles-cram/noodles_cram_wasm_bg.js +529 -0
  69. package/esm/wasm/noodles-cram/noodles_cram_wasm_bg.js.map +1 -0
  70. package/package.json +13 -11
  71. package/src/cramFile/codecs/beta.ts +38 -4
  72. package/src/cramFile/codecs/external.ts +25 -0
  73. package/src/cramFile/codecs/gamma.ts +54 -12
  74. package/src/cramFile/codecs/getBits.ts +21 -2
  75. package/src/cramFile/codecs/huffman.ts +45 -3
  76. package/src/cramFile/codecs/subexp.ts +53 -16
  77. package/src/cramFile/file.ts +1 -1
  78. package/src/cramFile/record.ts +26 -11
  79. package/src/cramFile/slice/decodeRecord.ts +107 -55
  80. package/src/cramFile/slice/index.ts +51 -9
  81. package/src/indexedCramFile.ts +35 -27
  82. package/src/wasm/noodles-cram/.gitignore +1 -0
  83. package/src/wasm/noodles-cram/noodles_cram_wasm.d.ts +42 -0
  84. package/src/wasm/noodles-cram/noodles_cram_wasm.js +5 -0
  85. package/src/wasm/noodles-cram/noodles_cram_wasm_bg.js +541 -0
  86. package/src/wasm/noodles-cram/noodles_cram_wasm_bg.wasm +0 -0
  87. package/src/wasm/noodles-cram/noodles_cram_wasm_bg.wasm.d.ts +18 -0
  88. package/src/wasm/noodles-cram/package.json +17 -0
@@ -0,0 +1,94 @@
1
+ export function __wbg_set_wasm(val: any): void;
2
+ /**
3
+ * Get the byte position where the header ends (first data container starts)
4
+ *
5
+ * # Arguments
6
+ * * `data` - The CRAM file data (only needs first ~64KB typically)
7
+ * @param {Uint8Array} data
8
+ * @returns {bigint}
9
+ */
10
+ export function get_header_length(data: Uint8Array): bigint;
11
+ export function init_panic_hook(): void;
12
+ /**
13
+ * @param {Uint8Array} data
14
+ * @returns {any}
15
+ */
16
+ export function parse_crai_index(data: Uint8Array): any;
17
+ /**
18
+ * @param {Uint8Array} data
19
+ * @returns {any}
20
+ */
21
+ export function parse_cram_file(data: Uint8Array): any;
22
+ /**
23
+ * Parse a CRAM file with reference sequences provided
24
+ *
25
+ * # Arguments
26
+ * * `data` - The CRAM file data as bytes
27
+ * * `references` - Array of {name: string, sequence: string} objects
28
+ * @param {Uint8Array} data
29
+ * @param {any} references
30
+ * @returns {any}
31
+ */
32
+ export function parse_cram_file_with_references(data: Uint8Array, references: any): any;
33
+ /**
34
+ * Parse records from a specific region of a CRAM file
35
+ *
36
+ * This function is designed for indexed access. It takes:
37
+ * - header_data: The CRAM file from start up to the first data container
38
+ * - container_data: The bytes of the container(s) to parse
39
+ * - references: Reference sequences needed for decoding
40
+ *
41
+ * # Arguments
42
+ * * `header_data` - Bytes from file start through header container
43
+ * * `container_data` - Bytes of the data container(s) to parse
44
+ * * `references` - Array of {name: string, sequence: string} objects
45
+ * @param {Uint8Array} header_data
46
+ * @param {Uint8Array} container_data
47
+ * @param {any} references
48
+ * @returns {any}
49
+ */
50
+ export function parse_cram_records_from_container(header_data: Uint8Array, container_data: Uint8Array, references: any): any;
51
+ /**
52
+ * @param {Uint8Array} data
53
+ * @returns {any}
54
+ */
55
+ export function parse_header(data: Uint8Array): any;
56
+ export function __wbg_Error_52673b7de5a0ca89(arg0: any, arg1: any): Error;
57
+ export function __wbg_String_8f0eb39a4a4c2f66(arg0: any, arg1: any): void;
58
+ export function __wbg___wbindgen_boolean_get_dea25b33882b895b(arg0: any): 0 | 1 | 16777215;
59
+ export function __wbg___wbindgen_debug_string_adfb662ae34724b6(arg0: any, arg1: any): void;
60
+ export function __wbg___wbindgen_in_0d3e1e8f0c669317(arg0: any, arg1: any): boolean;
61
+ export function __wbg___wbindgen_is_function_8d400b8b1af978cd(arg0: any): boolean;
62
+ export function __wbg___wbindgen_is_object_ce774f3490692386(arg0: any): boolean;
63
+ export function __wbg___wbindgen_is_undefined_f6b95eab589e0269(arg0: any): boolean;
64
+ export function __wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d(arg0: any, arg1: any): boolean;
65
+ export function __wbg___wbindgen_number_get_9619185a74197f95(arg0: any, arg1: any): void;
66
+ export function __wbg___wbindgen_string_get_a2a31e16edf96e42(arg0: any, arg1: any): void;
67
+ export function __wbg___wbindgen_throw_dd24417ed36fc46e(arg0: any, arg1: any): void;
68
+ export function __wbg_call_abb4ff46ce38be40(...args: any[]): any;
69
+ export function __wbg_done_62ea16af4ce34b24(arg0: any): any;
70
+ export function __wbg_error_7534b8e9a36f1ab4(arg0: any, arg1: any): void;
71
+ export function __wbg_get_6b7bd52aca3f9671(arg0: any, arg1: any): any;
72
+ export function __wbg_get_af9dab7e9603ea93(...args: any[]): any;
73
+ export function __wbg_get_with_ref_key_1dc361bd10053bfe(arg0: any, arg1: any): any;
74
+ export function __wbg_instanceof_ArrayBuffer_f3320d2419cd0355(arg0: any): boolean;
75
+ export function __wbg_instanceof_Uint8Array_da54ccc9d3e09434(arg0: any): boolean;
76
+ export function __wbg_isArray_51fd9e6422c0a395(arg0: any): arg0 is any[];
77
+ export function __wbg_iterator_27b7c8b35ab3e86b(): symbol;
78
+ export function __wbg_length_22ac23eaec9d8053(arg0: any): any;
79
+ export function __wbg_length_d45040a40c570362(arg0: any): any;
80
+ export function __wbg_new_1ba21ce319a06297(): Object;
81
+ export function __wbg_new_25f239778d6112b9(): any[];
82
+ export function __wbg_new_6421f6084cc5bc5a(arg0: any): Uint8Array<any>;
83
+ export function __wbg_new_8a6f238a6ece86ea(): Error;
84
+ export function __wbg_next_138a17bbf04e926c(arg0: any): any;
85
+ export function __wbg_next_3cfe5c0fe2a4cc53(...args: any[]): any;
86
+ export function __wbg_prototypesetcall_dfe9b766cdc1f1fd(arg0: any, arg1: any, arg2: any): void;
87
+ export function __wbg_set_3f1d0b984ed272ed(arg0: any, arg1: any, arg2: any): void;
88
+ export function __wbg_set_7df433eea03a5c14(arg0: any, arg1: any, arg2: any): void;
89
+ export function __wbg_stack_0ed75d68575b0f3c(arg0: any, arg1: any): void;
90
+ export function __wbg_value_57b7b035e117f7ee(arg0: any): any;
91
+ export function __wbindgen_cast_2241b6af4c4b2941(arg0: any, arg1: any): string;
92
+ export function __wbindgen_cast_4625c577ab2ec9ee(arg0: any): bigint;
93
+ export function __wbindgen_cast_d6cd19b81560fd6e(arg0: any): any;
94
+ export function __wbindgen_init_externref_table(): void;
@@ -0,0 +1,578 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.__wbg_set_wasm = __wbg_set_wasm;
4
+ exports.get_header_length = get_header_length;
5
+ exports.init_panic_hook = init_panic_hook;
6
+ exports.parse_crai_index = parse_crai_index;
7
+ exports.parse_cram_file = parse_cram_file;
8
+ exports.parse_cram_file_with_references = parse_cram_file_with_references;
9
+ exports.parse_cram_records_from_container = parse_cram_records_from_container;
10
+ exports.parse_header = parse_header;
11
+ exports.__wbg_Error_52673b7de5a0ca89 = __wbg_Error_52673b7de5a0ca89;
12
+ exports.__wbg_String_8f0eb39a4a4c2f66 = __wbg_String_8f0eb39a4a4c2f66;
13
+ exports.__wbg___wbindgen_boolean_get_dea25b33882b895b = __wbg___wbindgen_boolean_get_dea25b33882b895b;
14
+ exports.__wbg___wbindgen_debug_string_adfb662ae34724b6 = __wbg___wbindgen_debug_string_adfb662ae34724b6;
15
+ exports.__wbg___wbindgen_in_0d3e1e8f0c669317 = __wbg___wbindgen_in_0d3e1e8f0c669317;
16
+ exports.__wbg___wbindgen_is_function_8d400b8b1af978cd = __wbg___wbindgen_is_function_8d400b8b1af978cd;
17
+ exports.__wbg___wbindgen_is_object_ce774f3490692386 = __wbg___wbindgen_is_object_ce774f3490692386;
18
+ exports.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = __wbg___wbindgen_is_undefined_f6b95eab589e0269;
19
+ exports.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = __wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d;
20
+ exports.__wbg___wbindgen_number_get_9619185a74197f95 = __wbg___wbindgen_number_get_9619185a74197f95;
21
+ exports.__wbg___wbindgen_string_get_a2a31e16edf96e42 = __wbg___wbindgen_string_get_a2a31e16edf96e42;
22
+ exports.__wbg___wbindgen_throw_dd24417ed36fc46e = __wbg___wbindgen_throw_dd24417ed36fc46e;
23
+ exports.__wbg_call_abb4ff46ce38be40 = __wbg_call_abb4ff46ce38be40;
24
+ exports.__wbg_done_62ea16af4ce34b24 = __wbg_done_62ea16af4ce34b24;
25
+ exports.__wbg_error_7534b8e9a36f1ab4 = __wbg_error_7534b8e9a36f1ab4;
26
+ exports.__wbg_get_6b7bd52aca3f9671 = __wbg_get_6b7bd52aca3f9671;
27
+ exports.__wbg_get_af9dab7e9603ea93 = __wbg_get_af9dab7e9603ea93;
28
+ exports.__wbg_get_with_ref_key_1dc361bd10053bfe = __wbg_get_with_ref_key_1dc361bd10053bfe;
29
+ exports.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = __wbg_instanceof_ArrayBuffer_f3320d2419cd0355;
30
+ exports.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = __wbg_instanceof_Uint8Array_da54ccc9d3e09434;
31
+ exports.__wbg_isArray_51fd9e6422c0a395 = __wbg_isArray_51fd9e6422c0a395;
32
+ exports.__wbg_iterator_27b7c8b35ab3e86b = __wbg_iterator_27b7c8b35ab3e86b;
33
+ exports.__wbg_length_22ac23eaec9d8053 = __wbg_length_22ac23eaec9d8053;
34
+ exports.__wbg_length_d45040a40c570362 = __wbg_length_d45040a40c570362;
35
+ exports.__wbg_new_1ba21ce319a06297 = __wbg_new_1ba21ce319a06297;
36
+ exports.__wbg_new_25f239778d6112b9 = __wbg_new_25f239778d6112b9;
37
+ exports.__wbg_new_6421f6084cc5bc5a = __wbg_new_6421f6084cc5bc5a;
38
+ exports.__wbg_new_8a6f238a6ece86ea = __wbg_new_8a6f238a6ece86ea;
39
+ exports.__wbg_next_138a17bbf04e926c = __wbg_next_138a17bbf04e926c;
40
+ exports.__wbg_next_3cfe5c0fe2a4cc53 = __wbg_next_3cfe5c0fe2a4cc53;
41
+ exports.__wbg_prototypesetcall_dfe9b766cdc1f1fd = __wbg_prototypesetcall_dfe9b766cdc1f1fd;
42
+ exports.__wbg_set_3f1d0b984ed272ed = __wbg_set_3f1d0b984ed272ed;
43
+ exports.__wbg_set_7df433eea03a5c14 = __wbg_set_7df433eea03a5c14;
44
+ exports.__wbg_stack_0ed75d68575b0f3c = __wbg_stack_0ed75d68575b0f3c;
45
+ exports.__wbg_value_57b7b035e117f7ee = __wbg_value_57b7b035e117f7ee;
46
+ exports.__wbindgen_cast_2241b6af4c4b2941 = __wbindgen_cast_2241b6af4c4b2941;
47
+ exports.__wbindgen_cast_4625c577ab2ec9ee = __wbindgen_cast_4625c577ab2ec9ee;
48
+ exports.__wbindgen_cast_d6cd19b81560fd6e = __wbindgen_cast_d6cd19b81560fd6e;
49
+ exports.__wbindgen_init_externref_table = __wbindgen_init_externref_table;
50
+ let wasm;
51
+ function __wbg_set_wasm(val) {
52
+ wasm = val;
53
+ }
54
+ function addToExternrefTable0(obj) {
55
+ const idx = wasm.__externref_table_alloc();
56
+ wasm.__wbindgen_externrefs.set(idx, obj);
57
+ return idx;
58
+ }
59
+ function debugString(val) {
60
+ // primitive types
61
+ const type = typeof val;
62
+ if (type == 'number' || type == 'boolean' || val == null) {
63
+ return `${val}`;
64
+ }
65
+ if (type == 'string') {
66
+ return `"${val}"`;
67
+ }
68
+ if (type == 'symbol') {
69
+ const description = val.description;
70
+ if (description == null) {
71
+ return 'Symbol';
72
+ }
73
+ else {
74
+ return `Symbol(${description})`;
75
+ }
76
+ }
77
+ if (type == 'function') {
78
+ const name = val.name;
79
+ if (typeof name == 'string' && name.length > 0) {
80
+ return `Function(${name})`;
81
+ }
82
+ else {
83
+ return 'Function';
84
+ }
85
+ }
86
+ // objects
87
+ if (Array.isArray(val)) {
88
+ const length = val.length;
89
+ let debug = '[';
90
+ if (length > 0) {
91
+ debug += debugString(val[0]);
92
+ }
93
+ for (let i = 1; i < length; i++) {
94
+ debug += ', ' + debugString(val[i]);
95
+ }
96
+ debug += ']';
97
+ return debug;
98
+ }
99
+ // Test for built-in
100
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
101
+ let className;
102
+ if (builtInMatches && builtInMatches.length > 1) {
103
+ className = builtInMatches[1];
104
+ }
105
+ else {
106
+ // Failed to match the standard '[object ClassName]'
107
+ return toString.call(val);
108
+ }
109
+ if (className == 'Object') {
110
+ // we're a user defined class or Object
111
+ // JSON.stringify avoids problems with cycles, and is generally much
112
+ // easier than looping through ownProperties of `val`.
113
+ try {
114
+ return 'Object(' + JSON.stringify(val) + ')';
115
+ }
116
+ catch (_) {
117
+ return 'Object';
118
+ }
119
+ }
120
+ // errors
121
+ if (val instanceof Error) {
122
+ return `${val.name}: ${val.message}\n${val.stack}`;
123
+ }
124
+ // TODO we could test for more things here, like `Set`s and `Map`s.
125
+ return className;
126
+ }
127
+ function getArrayU8FromWasm0(ptr, len) {
128
+ ptr = ptr >>> 0;
129
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
130
+ }
131
+ let cachedDataViewMemory0 = null;
132
+ function getDataViewMemory0() {
133
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
134
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
135
+ }
136
+ return cachedDataViewMemory0;
137
+ }
138
+ function getStringFromWasm0(ptr, len) {
139
+ ptr = ptr >>> 0;
140
+ return decodeText(ptr, len);
141
+ }
142
+ let cachedUint8ArrayMemory0 = null;
143
+ function getUint8ArrayMemory0() {
144
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
145
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
146
+ }
147
+ return cachedUint8ArrayMemory0;
148
+ }
149
+ function handleError(f, args) {
150
+ try {
151
+ return f.apply(this, args);
152
+ }
153
+ catch (e) {
154
+ const idx = addToExternrefTable0(e);
155
+ wasm.__wbindgen_exn_store(idx);
156
+ }
157
+ }
158
+ function isLikeNone(x) {
159
+ return x === undefined || x === null;
160
+ }
161
+ function passArray8ToWasm0(arg, malloc) {
162
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
163
+ getUint8ArrayMemory0().set(arg, ptr / 1);
164
+ WASM_VECTOR_LEN = arg.length;
165
+ return ptr;
166
+ }
167
+ function passStringToWasm0(arg, malloc, realloc) {
168
+ if (realloc === undefined) {
169
+ const buf = cachedTextEncoder.encode(arg);
170
+ const ptr = malloc(buf.length, 1) >>> 0;
171
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
172
+ WASM_VECTOR_LEN = buf.length;
173
+ return ptr;
174
+ }
175
+ let len = arg.length;
176
+ let ptr = malloc(len, 1) >>> 0;
177
+ const mem = getUint8ArrayMemory0();
178
+ let offset = 0;
179
+ for (; offset < len; offset++) {
180
+ const code = arg.charCodeAt(offset);
181
+ if (code > 0x7F)
182
+ break;
183
+ mem[ptr + offset] = code;
184
+ }
185
+ if (offset !== len) {
186
+ if (offset !== 0) {
187
+ arg = arg.slice(offset);
188
+ }
189
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
190
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
191
+ const ret = cachedTextEncoder.encodeInto(arg, view);
192
+ offset += ret.written;
193
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
194
+ }
195
+ WASM_VECTOR_LEN = offset;
196
+ return ptr;
197
+ }
198
+ function takeFromExternrefTable0(idx) {
199
+ const value = wasm.__wbindgen_externrefs.get(idx);
200
+ wasm.__externref_table_dealloc(idx);
201
+ return value;
202
+ }
203
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
204
+ cachedTextDecoder.decode();
205
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
206
+ let numBytesDecoded = 0;
207
+ function decodeText(ptr, len) {
208
+ numBytesDecoded += len;
209
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
210
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
211
+ cachedTextDecoder.decode();
212
+ numBytesDecoded = len;
213
+ }
214
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
215
+ }
216
+ const cachedTextEncoder = new TextEncoder();
217
+ if (!('encodeInto' in cachedTextEncoder)) {
218
+ cachedTextEncoder.encodeInto = function (arg, view) {
219
+ const buf = cachedTextEncoder.encode(arg);
220
+ view.set(buf);
221
+ return {
222
+ read: arg.length,
223
+ written: buf.length
224
+ };
225
+ };
226
+ }
227
+ let WASM_VECTOR_LEN = 0;
228
+ /**
229
+ * Get the byte position where the header ends (first data container starts)
230
+ *
231
+ * # Arguments
232
+ * * `data` - The CRAM file data (only needs first ~64KB typically)
233
+ * @param {Uint8Array} data
234
+ * @returns {bigint}
235
+ */
236
+ function get_header_length(data) {
237
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
238
+ const len0 = WASM_VECTOR_LEN;
239
+ const ret = wasm.get_header_length(ptr0, len0);
240
+ if (ret[2]) {
241
+ throw takeFromExternrefTable0(ret[1]);
242
+ }
243
+ return BigInt.asUintN(64, ret[0]);
244
+ }
245
+ function init_panic_hook() {
246
+ wasm.init_panic_hook();
247
+ }
248
+ /**
249
+ * @param {Uint8Array} data
250
+ * @returns {any}
251
+ */
252
+ function parse_crai_index(data) {
253
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
254
+ const len0 = WASM_VECTOR_LEN;
255
+ const ret = wasm.parse_crai_index(ptr0, len0);
256
+ if (ret[2]) {
257
+ throw takeFromExternrefTable0(ret[1]);
258
+ }
259
+ return takeFromExternrefTable0(ret[0]);
260
+ }
261
+ /**
262
+ * @param {Uint8Array} data
263
+ * @returns {any}
264
+ */
265
+ function parse_cram_file(data) {
266
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
267
+ const len0 = WASM_VECTOR_LEN;
268
+ const ret = wasm.parse_cram_file(ptr0, len0);
269
+ if (ret[2]) {
270
+ throw takeFromExternrefTable0(ret[1]);
271
+ }
272
+ return takeFromExternrefTable0(ret[0]);
273
+ }
274
+ /**
275
+ * Parse a CRAM file with reference sequences provided
276
+ *
277
+ * # Arguments
278
+ * * `data` - The CRAM file data as bytes
279
+ * * `references` - Array of {name: string, sequence: string} objects
280
+ * @param {Uint8Array} data
281
+ * @param {any} references
282
+ * @returns {any}
283
+ */
284
+ function parse_cram_file_with_references(data, references) {
285
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
286
+ const len0 = WASM_VECTOR_LEN;
287
+ const ret = wasm.parse_cram_file_with_references(ptr0, len0, references);
288
+ if (ret[2]) {
289
+ throw takeFromExternrefTable0(ret[1]);
290
+ }
291
+ return takeFromExternrefTable0(ret[0]);
292
+ }
293
+ /**
294
+ * Parse records from a specific region of a CRAM file
295
+ *
296
+ * This function is designed for indexed access. It takes:
297
+ * - header_data: The CRAM file from start up to the first data container
298
+ * - container_data: The bytes of the container(s) to parse
299
+ * - references: Reference sequences needed for decoding
300
+ *
301
+ * # Arguments
302
+ * * `header_data` - Bytes from file start through header container
303
+ * * `container_data` - Bytes of the data container(s) to parse
304
+ * * `references` - Array of {name: string, sequence: string} objects
305
+ * @param {Uint8Array} header_data
306
+ * @param {Uint8Array} container_data
307
+ * @param {any} references
308
+ * @returns {any}
309
+ */
310
+ function parse_cram_records_from_container(header_data, container_data, references) {
311
+ const ptr0 = passArray8ToWasm0(header_data, wasm.__wbindgen_malloc);
312
+ const len0 = WASM_VECTOR_LEN;
313
+ const ptr1 = passArray8ToWasm0(container_data, wasm.__wbindgen_malloc);
314
+ const len1 = WASM_VECTOR_LEN;
315
+ const ret = wasm.parse_cram_records_from_container(ptr0, len0, ptr1, len1, references);
316
+ if (ret[2]) {
317
+ throw takeFromExternrefTable0(ret[1]);
318
+ }
319
+ return takeFromExternrefTable0(ret[0]);
320
+ }
321
+ /**
322
+ * @param {Uint8Array} data
323
+ * @returns {any}
324
+ */
325
+ function parse_header(data) {
326
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
327
+ const len0 = WASM_VECTOR_LEN;
328
+ const ret = wasm.parse_header(ptr0, len0);
329
+ if (ret[2]) {
330
+ throw takeFromExternrefTable0(ret[1]);
331
+ }
332
+ return takeFromExternrefTable0(ret[0]);
333
+ }
334
+ function __wbg_Error_52673b7de5a0ca89(arg0, arg1) {
335
+ const ret = Error(getStringFromWasm0(arg0, arg1));
336
+ return ret;
337
+ }
338
+ ;
339
+ function __wbg_String_8f0eb39a4a4c2f66(arg0, arg1) {
340
+ const ret = String(arg1);
341
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
342
+ const len1 = WASM_VECTOR_LEN;
343
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
344
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
345
+ }
346
+ ;
347
+ function __wbg___wbindgen_boolean_get_dea25b33882b895b(arg0) {
348
+ const v = arg0;
349
+ const ret = typeof (v) === 'boolean' ? v : undefined;
350
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
351
+ }
352
+ ;
353
+ function __wbg___wbindgen_debug_string_adfb662ae34724b6(arg0, arg1) {
354
+ const ret = debugString(arg1);
355
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
356
+ const len1 = WASM_VECTOR_LEN;
357
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
358
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
359
+ }
360
+ ;
361
+ function __wbg___wbindgen_in_0d3e1e8f0c669317(arg0, arg1) {
362
+ const ret = arg0 in arg1;
363
+ return ret;
364
+ }
365
+ ;
366
+ function __wbg___wbindgen_is_function_8d400b8b1af978cd(arg0) {
367
+ const ret = typeof (arg0) === 'function';
368
+ return ret;
369
+ }
370
+ ;
371
+ function __wbg___wbindgen_is_object_ce774f3490692386(arg0) {
372
+ const val = arg0;
373
+ const ret = typeof (val) === 'object' && val !== null;
374
+ return ret;
375
+ }
376
+ ;
377
+ function __wbg___wbindgen_is_undefined_f6b95eab589e0269(arg0) {
378
+ const ret = arg0 === undefined;
379
+ return ret;
380
+ }
381
+ ;
382
+ function __wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d(arg0, arg1) {
383
+ const ret = arg0 == arg1;
384
+ return ret;
385
+ }
386
+ ;
387
+ function __wbg___wbindgen_number_get_9619185a74197f95(arg0, arg1) {
388
+ const obj = arg1;
389
+ const ret = typeof (obj) === 'number' ? obj : undefined;
390
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
391
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
392
+ }
393
+ ;
394
+ function __wbg___wbindgen_string_get_a2a31e16edf96e42(arg0, arg1) {
395
+ const obj = arg1;
396
+ const ret = typeof (obj) === 'string' ? obj : undefined;
397
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
398
+ var len1 = WASM_VECTOR_LEN;
399
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
400
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
401
+ }
402
+ ;
403
+ function __wbg___wbindgen_throw_dd24417ed36fc46e(arg0, arg1) {
404
+ throw new Error(getStringFromWasm0(arg0, arg1));
405
+ }
406
+ ;
407
+ function __wbg_call_abb4ff46ce38be40() {
408
+ return handleError(function (arg0, arg1) {
409
+ const ret = arg0.call(arg1);
410
+ return ret;
411
+ }, arguments);
412
+ }
413
+ ;
414
+ function __wbg_done_62ea16af4ce34b24(arg0) {
415
+ const ret = arg0.done;
416
+ return ret;
417
+ }
418
+ ;
419
+ function __wbg_error_7534b8e9a36f1ab4(arg0, arg1) {
420
+ let deferred0_0;
421
+ let deferred0_1;
422
+ try {
423
+ deferred0_0 = arg0;
424
+ deferred0_1 = arg1;
425
+ console.error(getStringFromWasm0(arg0, arg1));
426
+ }
427
+ finally {
428
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
429
+ }
430
+ }
431
+ ;
432
+ function __wbg_get_6b7bd52aca3f9671(arg0, arg1) {
433
+ const ret = arg0[arg1 >>> 0];
434
+ return ret;
435
+ }
436
+ ;
437
+ function __wbg_get_af9dab7e9603ea93() {
438
+ return handleError(function (arg0, arg1) {
439
+ const ret = Reflect.get(arg0, arg1);
440
+ return ret;
441
+ }, arguments);
442
+ }
443
+ ;
444
+ function __wbg_get_with_ref_key_1dc361bd10053bfe(arg0, arg1) {
445
+ const ret = arg0[arg1];
446
+ return ret;
447
+ }
448
+ ;
449
+ function __wbg_instanceof_ArrayBuffer_f3320d2419cd0355(arg0) {
450
+ let result;
451
+ try {
452
+ result = arg0 instanceof ArrayBuffer;
453
+ }
454
+ catch (_) {
455
+ result = false;
456
+ }
457
+ const ret = result;
458
+ return ret;
459
+ }
460
+ ;
461
+ function __wbg_instanceof_Uint8Array_da54ccc9d3e09434(arg0) {
462
+ let result;
463
+ try {
464
+ result = arg0 instanceof Uint8Array;
465
+ }
466
+ catch (_) {
467
+ result = false;
468
+ }
469
+ const ret = result;
470
+ return ret;
471
+ }
472
+ ;
473
+ function __wbg_isArray_51fd9e6422c0a395(arg0) {
474
+ const ret = Array.isArray(arg0);
475
+ return ret;
476
+ }
477
+ ;
478
+ function __wbg_iterator_27b7c8b35ab3e86b() {
479
+ const ret = Symbol.iterator;
480
+ return ret;
481
+ }
482
+ ;
483
+ function __wbg_length_22ac23eaec9d8053(arg0) {
484
+ const ret = arg0.length;
485
+ return ret;
486
+ }
487
+ ;
488
+ function __wbg_length_d45040a40c570362(arg0) {
489
+ const ret = arg0.length;
490
+ return ret;
491
+ }
492
+ ;
493
+ function __wbg_new_1ba21ce319a06297() {
494
+ const ret = new Object();
495
+ return ret;
496
+ }
497
+ ;
498
+ function __wbg_new_25f239778d6112b9() {
499
+ const ret = new Array();
500
+ return ret;
501
+ }
502
+ ;
503
+ function __wbg_new_6421f6084cc5bc5a(arg0) {
504
+ const ret = new Uint8Array(arg0);
505
+ return ret;
506
+ }
507
+ ;
508
+ function __wbg_new_8a6f238a6ece86ea() {
509
+ const ret = new Error();
510
+ return ret;
511
+ }
512
+ ;
513
+ function __wbg_next_138a17bbf04e926c(arg0) {
514
+ const ret = arg0.next;
515
+ return ret;
516
+ }
517
+ ;
518
+ function __wbg_next_3cfe5c0fe2a4cc53() {
519
+ return handleError(function (arg0) {
520
+ const ret = arg0.next();
521
+ return ret;
522
+ }, arguments);
523
+ }
524
+ ;
525
+ function __wbg_prototypesetcall_dfe9b766cdc1f1fd(arg0, arg1, arg2) {
526
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
527
+ }
528
+ ;
529
+ function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
530
+ arg0[arg1] = arg2;
531
+ }
532
+ ;
533
+ function __wbg_set_7df433eea03a5c14(arg0, arg1, arg2) {
534
+ arg0[arg1 >>> 0] = arg2;
535
+ }
536
+ ;
537
+ function __wbg_stack_0ed75d68575b0f3c(arg0, arg1) {
538
+ const ret = arg1.stack;
539
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
540
+ const len1 = WASM_VECTOR_LEN;
541
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
542
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
543
+ }
544
+ ;
545
+ function __wbg_value_57b7b035e117f7ee(arg0) {
546
+ const ret = arg0.value;
547
+ return ret;
548
+ }
549
+ ;
550
+ function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
551
+ // Cast intrinsic for `Ref(String) -> Externref`.
552
+ const ret = getStringFromWasm0(arg0, arg1);
553
+ return ret;
554
+ }
555
+ ;
556
+ function __wbindgen_cast_4625c577ab2ec9ee(arg0) {
557
+ // Cast intrinsic for `U64 -> Externref`.
558
+ const ret = BigInt.asUintN(64, arg0);
559
+ return ret;
560
+ }
561
+ ;
562
+ function __wbindgen_cast_d6cd19b81560fd6e(arg0) {
563
+ // Cast intrinsic for `F64 -> Externref`.
564
+ const ret = arg0;
565
+ return ret;
566
+ }
567
+ ;
568
+ function __wbindgen_init_externref_table() {
569
+ const table = wasm.__wbindgen_externrefs;
570
+ const offset = table.grow(4);
571
+ table.set(0, undefined);
572
+ table.set(offset + 0, undefined);
573
+ table.set(offset + 1, null);
574
+ table.set(offset + 2, true);
575
+ table.set(offset + 3, false);
576
+ }
577
+ ;
578
+ //# sourceMappingURL=noodles_cram_wasm_bg.js.map