@genome-spy/core 0.58.1 → 0.60.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 (117) hide show
  1. package/dist/bundle/{index-DwLfOHEk.js → index-5ajWdKly.js} +1 -1
  2. package/dist/bundle/{index-vgGDWUPz.js → index-B03-Om4z.js} +1 -1
  3. package/dist/bundle/index-Bg7C4Xat.js +2750 -0
  4. package/dist/bundle/{index-CalimFw3.js → index-C3QR8Lv6.js} +79 -79
  5. package/dist/bundle/{index-DKe9Bhvi.js → index-g8iXgW0W.js} +1 -1
  6. package/dist/bundle/index.es.js +6554 -6011
  7. package/dist/bundle/index.js +189 -164
  8. package/dist/bundle/{long-BviWyoZx.js → long-B-FASCSo.js} +45 -45
  9. package/dist/schema.json +312 -25
  10. package/dist/src/data/collector.d.ts.map +1 -1
  11. package/dist/src/data/collector.js +1 -0
  12. package/dist/src/data/flowNode.d.ts.map +1 -1
  13. package/dist/src/data/sources/dataSource.d.ts.map +1 -1
  14. package/dist/src/data/sources/dataUtils.d.ts +2 -1
  15. package/dist/src/data/sources/dataUtils.d.ts.map +1 -1
  16. package/dist/src/data/sources/dataUtils.js +3 -4
  17. package/dist/src/data/sources/inlineSource.d.ts +8 -0
  18. package/dist/src/data/sources/inlineSource.d.ts.map +1 -1
  19. package/dist/src/data/sources/inlineSource.js +17 -1
  20. package/dist/src/data/sources/urlSource.d.ts +1 -0
  21. package/dist/src/data/sources/urlSource.d.ts.map +1 -1
  22. package/dist/src/data/sources/urlSource.js +33 -4
  23. package/dist/src/data/transforms/identifier.d.ts.map +1 -1
  24. package/dist/src/data/transforms/measureText.js +1 -1
  25. package/dist/src/data/transforms/regexFold.d.ts.map +1 -1
  26. package/dist/src/data/transforms/regexFold.js +10 -0
  27. package/dist/src/data/transforms/regexFold.test.js +13 -0
  28. package/dist/src/encoder/encoder.d.ts +1 -1
  29. package/dist/src/fonts/bmFontManager.js +2 -2
  30. package/dist/src/fonts/bmFontMetrics.d.ts.map +1 -1
  31. package/dist/src/genomeSpy.d.ts.map +1 -1
  32. package/dist/src/genomeSpy.js +39 -19
  33. package/dist/src/gl/arrayBuilder.d.ts.map +1 -1
  34. package/dist/src/gl/colorUtils.d.ts +4 -0
  35. package/dist/src/gl/colorUtils.d.ts.map +1 -1
  36. package/dist/src/gl/colorUtils.js +8 -0
  37. package/dist/src/gl/glslScaleGenerator.d.ts +1 -1
  38. package/dist/src/gl/glslScaleGenerator.d.ts.map +1 -1
  39. package/dist/src/gl/glslScaleGenerator.js +1 -9
  40. package/dist/src/gl/includes/common.glsl.js +1 -1
  41. package/dist/src/gl/webGLHelper.d.ts +1 -1
  42. package/dist/src/gl/webGLHelper.d.ts.map +1 -1
  43. package/dist/src/marks/link.d.ts.map +1 -1
  44. package/dist/src/marks/link.js +9 -1
  45. package/dist/src/marks/mark.d.ts +8 -0
  46. package/dist/src/marks/mark.d.ts.map +1 -1
  47. package/dist/src/marks/mark.js +101 -3
  48. package/dist/src/marks/point.d.ts +1 -1
  49. package/dist/src/marks/point.d.ts.map +1 -1
  50. package/dist/src/marks/point.fragment.glsl.js +1 -1
  51. package/dist/src/marks/point.vertex.glsl.js +1 -1
  52. package/dist/src/marks/rect.common.glsl.js +1 -1
  53. package/dist/src/marks/rect.d.ts.map +1 -1
  54. package/dist/src/marks/rect.fragment.glsl.js +1 -1
  55. package/dist/src/marks/rect.js +41 -0
  56. package/dist/src/marks/rect.vertex.glsl.js +1 -1
  57. package/dist/src/selection/selection.d.ts +27 -2
  58. package/dist/src/selection/selection.d.ts.map +1 -1
  59. package/dist/src/selection/selection.js +53 -3
  60. package/dist/src/spec/data.d.ts +18 -1
  61. package/dist/src/spec/mark.d.ts +58 -1
  62. package/dist/src/spec/parameter.d.ts +71 -31
  63. package/dist/src/spec/sampleView.d.ts +12 -1
  64. package/dist/src/spec/view.d.ts +9 -2
  65. package/dist/src/styles/genome-spy.css.d.ts +1 -1
  66. package/dist/src/styles/genome-spy.css.d.ts.map +1 -1
  67. package/dist/src/styles/genome-spy.css.js +12 -1
  68. package/dist/src/styles/genome-spy.scss +19 -1
  69. package/dist/src/types/selectionTypes.d.ts +4 -7
  70. package/dist/src/types/viewContext.d.ts +0 -15
  71. package/dist/src/utils/expression.d.ts.map +1 -1
  72. package/dist/src/utils/expression.js +4 -0
  73. package/dist/src/utils/indexer.d.ts +0 -2
  74. package/dist/src/utils/indexer.d.ts.map +1 -1
  75. package/dist/src/utils/reservationMap.d.ts +4 -4
  76. package/dist/src/utils/reservationMap.d.ts.map +1 -1
  77. package/dist/src/utils/scaleNull.d.ts +0 -2
  78. package/dist/src/utils/scaleNull.d.ts.map +1 -1
  79. package/dist/src/utils/trees.d.ts +2 -2
  80. package/dist/src/utils/ui/tooltip.d.ts +6 -10
  81. package/dist/src/utils/ui/tooltip.d.ts.map +1 -1
  82. package/dist/src/utils/ui/tooltip.js +74 -42
  83. package/dist/src/view/concatView.d.ts +1 -1
  84. package/dist/src/view/concatView.d.ts.map +1 -1
  85. package/dist/src/view/concatView.js +1 -1
  86. package/dist/src/view/gridView/gridChild.d.ts +53 -0
  87. package/dist/src/view/gridView/gridChild.d.ts.map +1 -0
  88. package/dist/src/view/gridView/gridChild.js +753 -0
  89. package/dist/src/view/gridView/gridView.d.ts +64 -0
  90. package/dist/src/view/gridView/gridView.d.ts.map +1 -0
  91. package/dist/src/view/{gridView.js → gridView/gridView.js} +40 -595
  92. package/dist/src/view/gridView/scrollbar.d.ts +32 -0
  93. package/dist/src/view/gridView/scrollbar.d.ts.map +1 -0
  94. package/dist/src/view/gridView/scrollbar.js +186 -0
  95. package/dist/src/view/gridView/selectionRect.d.ts +10 -0
  96. package/dist/src/view/gridView/selectionRect.d.ts.map +1 -0
  97. package/dist/src/view/gridView/selectionRect.js +182 -0
  98. package/dist/src/view/layout/rectangle.d.ts +11 -1
  99. package/dist/src/view/layout/rectangle.d.ts.map +1 -1
  100. package/dist/src/view/layout/rectangle.js +22 -2
  101. package/dist/src/view/layout/rectangle.test.js +12 -0
  102. package/dist/src/view/paramMediator.d.ts.map +1 -1
  103. package/dist/src/view/paramMediator.js +11 -2
  104. package/dist/src/view/scaleResolution.d.ts +1 -0
  105. package/dist/src/view/scaleResolution.d.ts.map +1 -1
  106. package/dist/src/view/scaleResolution.js +43 -33
  107. package/dist/src/view/testUtils.d.ts.map +1 -1
  108. package/dist/src/view/testUtils.js +0 -4
  109. package/dist/src/view/view.d.ts +6 -0
  110. package/dist/src/view/view.d.ts.map +1 -1
  111. package/dist/src/view/view.js +19 -0
  112. package/dist/src/view/viewFactory.d.ts.map +1 -1
  113. package/dist/src/view/viewFactory.js +13 -1
  114. package/package.json +2 -2
  115. package/dist/bundle/index-DS2hvLgl.js +0 -3425
  116. package/dist/src/view/gridView.d.ts +0 -135
  117. package/dist/src/view/gridView.d.ts.map +0 -1
@@ -0,0 +1,2750 @@
1
+ import { b as z } from "./index-BftNdA0O.js";
2
+ import { A as pt, L as vt } from "./index-CCJIjehY.js";
3
+ import { L as un } from "./__vite-browser-external-C--ziKoh.js";
4
+ import { R as hn } from "./remoteFile-BuaqFGWk.js";
5
+ const _t = BigInt(32);
6
+ function dn(t, n, e) {
7
+ const i = +!!e, o = +!e;
8
+ return BigInt(t.getInt32(n, e) * o + t.getInt32(n + 4, e) * i) << _t | BigInt(t.getUint32(n, e) * i + t.getUint32(n + 4, e) * o);
9
+ }
10
+ function bn(t, n, e) {
11
+ const i = t.getUint32(n, e), o = t.getUint32(n + 4, e), r = +!!e, s = +!e;
12
+ return BigInt(i * s + o * r) << _t | BigInt(i * r + o * s);
13
+ }
14
+ "getBigInt64" in DataView || (DataView.prototype.getBigInt64 = function(t, n) {
15
+ return dn(this, t, n);
16
+ });
17
+ "getBigUint64" in DataView || (DataView.prototype.getBigUint64 = function(t, n) {
18
+ return bn(this, t, n);
19
+ });
20
+ class j {
21
+ constructor(n) {
22
+ this.ranges = n;
23
+ }
24
+ get min() {
25
+ return this.ranges[0].min;
26
+ }
27
+ get max() {
28
+ return this.ranges.at(-1).max;
29
+ }
30
+ contains(n) {
31
+ for (const e of this.ranges)
32
+ if (e.min <= n && e.max >= n)
33
+ return !0;
34
+ return !1;
35
+ }
36
+ isContiguous() {
37
+ return this.ranges.length > 1;
38
+ }
39
+ getRanges() {
40
+ return this.ranges.map((n) => new j([{ min: n.min, max: n.max }]));
41
+ }
42
+ toString() {
43
+ return this.ranges.map((n) => `[${n.min}-${n.max}]`).join(",");
44
+ }
45
+ union(n) {
46
+ const e = [...this.getRanges(), ...n.getRanges()].sort((r, s) => r.min < s.min ? -1 : r.min > s.min ? 1 : r.max < s.max ? -1 : s.max > r.max ? 1 : 0), i = [];
47
+ let o = e[0];
48
+ for (const r of e)
49
+ r.min > o.max + 1 ? (i.push(o), o = r) : r.max > o.max && (o = new j([{ min: o.min, max: r.max }]));
50
+ return i.push(o), i.length === 1 ? i[0] : new j(i);
51
+ }
52
+ }
53
+ /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
54
+ function K(t) {
55
+ let n = t.length;
56
+ for (; --n >= 0; )
57
+ t[n] = 0;
58
+ }
59
+ const gn = 3, wn = 258, kt = 29, mn = 256, yn = mn + 1 + kt, xt = 30, pn = 512, vn = new Array((yn + 2) * 2);
60
+ K(vn);
61
+ const _n = new Array(xt * 2);
62
+ K(_n);
63
+ const kn = new Array(pn);
64
+ K(kn);
65
+ const xn = new Array(wn - gn + 1);
66
+ K(xn);
67
+ const En = new Array(kt);
68
+ K(En);
69
+ const Sn = new Array(xt);
70
+ K(Sn);
71
+ const In = (t, n, e, i) => {
72
+ let o = t & 65535 | 0, r = t >>> 16 & 65535 | 0, s = 0;
73
+ for (; e !== 0; ) {
74
+ s = e > 2e3 ? 2e3 : e, e -= s;
75
+ do
76
+ o = o + n[i++] | 0, r = r + o | 0;
77
+ while (--s);
78
+ o %= 65521, r %= 65521;
79
+ }
80
+ return o | r << 16 | 0;
81
+ };
82
+ var Be = In;
83
+ const On = () => {
84
+ let t, n = [];
85
+ for (var e = 0; e < 256; e++) {
86
+ t = e;
87
+ for (var i = 0; i < 8; i++)
88
+ t = t & 1 ? 3988292384 ^ t >>> 1 : t >>> 1;
89
+ n[e] = t;
90
+ }
91
+ return n;
92
+ }, Bn = new Uint32Array(On()), An = (t, n, e, i) => {
93
+ const o = Bn, r = i + e;
94
+ t ^= -1;
95
+ for (let s = i; s < r; s++)
96
+ t = t >>> 8 ^ o[(t ^ n[s]) & 255];
97
+ return t ^ -1;
98
+ };
99
+ var P = An, Ae = {
100
+ 2: "need dictionary",
101
+ /* Z_NEED_DICT 2 */
102
+ 1: "stream end",
103
+ /* Z_STREAM_END 1 */
104
+ 0: "",
105
+ /* Z_OK 0 */
106
+ "-1": "file error",
107
+ /* Z_ERRNO (-1) */
108
+ "-2": "stream error",
109
+ /* Z_STREAM_ERROR (-2) */
110
+ "-3": "data error",
111
+ /* Z_DATA_ERROR (-3) */
112
+ "-4": "insufficient memory",
113
+ /* Z_MEM_ERROR (-4) */
114
+ "-5": "buffer error",
115
+ /* Z_BUF_ERROR (-5) */
116
+ "-6": "incompatible version"
117
+ /* Z_VERSION_ERROR (-6) */
118
+ }, Et = {
119
+ /* Allowed flush values; see deflate() and inflate() below for details */
120
+ Z_NO_FLUSH: 0,
121
+ Z_FINISH: 4,
122
+ Z_BLOCK: 5,
123
+ Z_TREES: 6,
124
+ /* Return codes for the compression/decompression functions. Negative values
125
+ * are errors, positive values are used for special but normal events.
126
+ */
127
+ Z_OK: 0,
128
+ Z_STREAM_END: 1,
129
+ Z_NEED_DICT: 2,
130
+ Z_STREAM_ERROR: -2,
131
+ Z_DATA_ERROR: -3,
132
+ Z_MEM_ERROR: -4,
133
+ Z_BUF_ERROR: -5,
134
+ /* The deflate compression method */
135
+ Z_DEFLATED: 8
136
+ //Z_NULL: null // Use -1 or null inline, depending on var type
137
+ };
138
+ const Tn = (t, n) => Object.prototype.hasOwnProperty.call(t, n);
139
+ var Un = function(t) {
140
+ const n = Array.prototype.slice.call(arguments, 1);
141
+ for (; n.length; ) {
142
+ const e = n.shift();
143
+ if (e) {
144
+ if (typeof e != "object")
145
+ throw new TypeError(e + "must be non-object");
146
+ for (const i in e)
147
+ Tn(e, i) && (t[i] = e[i]);
148
+ }
149
+ }
150
+ return t;
151
+ }, Rn = (t) => {
152
+ let n = 0;
153
+ for (let i = 0, o = t.length; i < o; i++)
154
+ n += t[i].length;
155
+ const e = new Uint8Array(n);
156
+ for (let i = 0, o = 0, r = t.length; i < r; i++) {
157
+ let s = t[i];
158
+ e.set(s, o), o += s.length;
159
+ }
160
+ return e;
161
+ }, St = {
162
+ assign: Un,
163
+ flattenChunks: Rn
164
+ };
165
+ let It = !0;
166
+ try {
167
+ String.fromCharCode.apply(null, new Uint8Array(1));
168
+ } catch {
169
+ It = !1;
170
+ }
171
+ const Q = new Uint8Array(256);
172
+ for (let t = 0; t < 256; t++)
173
+ Q[t] = t >= 252 ? 6 : t >= 248 ? 5 : t >= 240 ? 4 : t >= 224 ? 3 : t >= 192 ? 2 : 1;
174
+ Q[254] = Q[254] = 1;
175
+ var Dn = (t) => {
176
+ if (typeof TextEncoder == "function" && TextEncoder.prototype.encode)
177
+ return new TextEncoder().encode(t);
178
+ let n, e, i, o, r, s = t.length, f = 0;
179
+ for (o = 0; o < s; o++)
180
+ e = t.charCodeAt(o), (e & 64512) === 55296 && o + 1 < s && (i = t.charCodeAt(o + 1), (i & 64512) === 56320 && (e = 65536 + (e - 55296 << 10) + (i - 56320), o++)), f += e < 128 ? 1 : e < 2048 ? 2 : e < 65536 ? 3 : 4;
181
+ for (n = new Uint8Array(f), r = 0, o = 0; r < f; o++)
182
+ e = t.charCodeAt(o), (e & 64512) === 55296 && o + 1 < s && (i = t.charCodeAt(o + 1), (i & 64512) === 56320 && (e = 65536 + (e - 55296 << 10) + (i - 56320), o++)), e < 128 ? n[r++] = e : e < 2048 ? (n[r++] = 192 | e >>> 6, n[r++] = 128 | e & 63) : e < 65536 ? (n[r++] = 224 | e >>> 12, n[r++] = 128 | e >>> 6 & 63, n[r++] = 128 | e & 63) : (n[r++] = 240 | e >>> 18, n[r++] = 128 | e >>> 12 & 63, n[r++] = 128 | e >>> 6 & 63, n[r++] = 128 | e & 63);
183
+ return n;
184
+ };
185
+ const Nn = (t, n) => {
186
+ if (n < 65534 && t.subarray && It)
187
+ return String.fromCharCode.apply(null, t.length === n ? t : t.subarray(0, n));
188
+ let e = "";
189
+ for (let i = 0; i < n; i++)
190
+ e += String.fromCharCode(t[i]);
191
+ return e;
192
+ };
193
+ var Cn = (t, n) => {
194
+ const e = n || t.length;
195
+ if (typeof TextDecoder == "function" && TextDecoder.prototype.decode)
196
+ return new TextDecoder().decode(t.subarray(0, n));
197
+ let i, o;
198
+ const r = new Array(e * 2);
199
+ for (o = 0, i = 0; i < e; ) {
200
+ let s = t[i++];
201
+ if (s < 128) {
202
+ r[o++] = s;
203
+ continue;
204
+ }
205
+ let f = Q[s];
206
+ if (f > 4) {
207
+ r[o++] = 65533, i += f - 1;
208
+ continue;
209
+ }
210
+ for (s &= f === 2 ? 31 : f === 3 ? 15 : 7; f > 1 && i < e; )
211
+ s = s << 6 | t[i++] & 63, f--;
212
+ if (f > 1) {
213
+ r[o++] = 65533;
214
+ continue;
215
+ }
216
+ s < 65536 ? r[o++] = s : (s -= 65536, r[o++] = 55296 | s >> 10 & 1023, r[o++] = 56320 | s & 1023);
217
+ }
218
+ return Nn(r, o);
219
+ }, Ln = (t, n) => {
220
+ n = n || t.length, n > t.length && (n = t.length);
221
+ let e = n - 1;
222
+ for (; e >= 0 && (t[e] & 192) === 128; )
223
+ e--;
224
+ return e < 0 || e === 0 ? n : e + Q[t[e]] > n ? e : n;
225
+ }, Te = {
226
+ string2buf: Dn,
227
+ buf2string: Cn,
228
+ utf8border: Ln
229
+ };
230
+ function Pn() {
231
+ this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0;
232
+ }
233
+ var Fn = Pn;
234
+ const ne = 16209, Mn = 16191;
235
+ var zn = function(n, e) {
236
+ let i, o, r, s, f, u, a, c, v, d, l, h, w, _, k, x, I, g, E, O, m, S, b, p;
237
+ const y = n.state;
238
+ i = n.next_in, b = n.input, o = i + (n.avail_in - 5), r = n.next_out, p = n.output, s = r - (e - n.avail_out), f = r + (n.avail_out - 257), u = y.dmax, a = y.wsize, c = y.whave, v = y.wnext, d = y.window, l = y.hold, h = y.bits, w = y.lencode, _ = y.distcode, k = (1 << y.lenbits) - 1, x = (1 << y.distbits) - 1;
239
+ e:
240
+ do {
241
+ h < 15 && (l += b[i++] << h, h += 8, l += b[i++] << h, h += 8), I = w[l & k];
242
+ t:
243
+ for (; ; ) {
244
+ if (g = I >>> 24, l >>>= g, h -= g, g = I >>> 16 & 255, g === 0)
245
+ p[r++] = I & 65535;
246
+ else if (g & 16) {
247
+ E = I & 65535, g &= 15, g && (h < g && (l += b[i++] << h, h += 8), E += l & (1 << g) - 1, l >>>= g, h -= g), h < 15 && (l += b[i++] << h, h += 8, l += b[i++] << h, h += 8), I = _[l & x];
248
+ n:
249
+ for (; ; ) {
250
+ if (g = I >>> 24, l >>>= g, h -= g, g = I >>> 16 & 255, g & 16) {
251
+ if (O = I & 65535, g &= 15, h < g && (l += b[i++] << h, h += 8, h < g && (l += b[i++] << h, h += 8)), O += l & (1 << g) - 1, O > u) {
252
+ n.msg = "invalid distance too far back", y.mode = ne;
253
+ break e;
254
+ }
255
+ if (l >>>= g, h -= g, g = r - s, O > g) {
256
+ if (g = O - g, g > c && y.sane) {
257
+ n.msg = "invalid distance too far back", y.mode = ne;
258
+ break e;
259
+ }
260
+ if (m = 0, S = d, v === 0) {
261
+ if (m += a - g, g < E) {
262
+ E -= g;
263
+ do
264
+ p[r++] = d[m++];
265
+ while (--g);
266
+ m = r - O, S = p;
267
+ }
268
+ } else if (v < g) {
269
+ if (m += a + v - g, g -= v, g < E) {
270
+ E -= g;
271
+ do
272
+ p[r++] = d[m++];
273
+ while (--g);
274
+ if (m = 0, v < E) {
275
+ g = v, E -= g;
276
+ do
277
+ p[r++] = d[m++];
278
+ while (--g);
279
+ m = r - O, S = p;
280
+ }
281
+ }
282
+ } else if (m += v - g, g < E) {
283
+ E -= g;
284
+ do
285
+ p[r++] = d[m++];
286
+ while (--g);
287
+ m = r - O, S = p;
288
+ }
289
+ for (; E > 2; )
290
+ p[r++] = S[m++], p[r++] = S[m++], p[r++] = S[m++], E -= 3;
291
+ E && (p[r++] = S[m++], E > 1 && (p[r++] = S[m++]));
292
+ } else {
293
+ m = r - O;
294
+ do
295
+ p[r++] = p[m++], p[r++] = p[m++], p[r++] = p[m++], E -= 3;
296
+ while (E > 2);
297
+ E && (p[r++] = p[m++], E > 1 && (p[r++] = p[m++]));
298
+ }
299
+ } else if (g & 64) {
300
+ n.msg = "invalid distance code", y.mode = ne;
301
+ break e;
302
+ } else {
303
+ I = _[(I & 65535) + (l & (1 << g) - 1)];
304
+ continue n;
305
+ }
306
+ break;
307
+ }
308
+ } else if (g & 64)
309
+ if (g & 32) {
310
+ y.mode = Mn;
311
+ break e;
312
+ } else {
313
+ n.msg = "invalid literal/length code", y.mode = ne;
314
+ break e;
315
+ }
316
+ else {
317
+ I = w[(I & 65535) + (l & (1 << g) - 1)];
318
+ continue t;
319
+ }
320
+ break;
321
+ }
322
+ } while (i < o && r < f);
323
+ E = h >> 3, i -= E, h -= E << 3, l &= (1 << h) - 1, n.next_in = i, n.next_out = r, n.avail_in = i < o ? 5 + (o - i) : 5 - (i - o), n.avail_out = r < f ? 257 + (f - r) : 257 - (r - f), y.hold = l, y.bits = h;
324
+ };
325
+ const G = 15, Fe = 852, Me = 592, ze = 0, we = 1, Ze = 2, Zn = new Uint16Array([
326
+ /* Length codes 257..285 base */
327
+ 3,
328
+ 4,
329
+ 5,
330
+ 6,
331
+ 7,
332
+ 8,
333
+ 9,
334
+ 10,
335
+ 11,
336
+ 13,
337
+ 15,
338
+ 17,
339
+ 19,
340
+ 23,
341
+ 27,
342
+ 31,
343
+ 35,
344
+ 43,
345
+ 51,
346
+ 59,
347
+ 67,
348
+ 83,
349
+ 99,
350
+ 115,
351
+ 131,
352
+ 163,
353
+ 195,
354
+ 227,
355
+ 258,
356
+ 0,
357
+ 0
358
+ ]), $n = new Uint8Array([
359
+ /* Length codes 257..285 extra */
360
+ 16,
361
+ 16,
362
+ 16,
363
+ 16,
364
+ 16,
365
+ 16,
366
+ 16,
367
+ 16,
368
+ 17,
369
+ 17,
370
+ 17,
371
+ 17,
372
+ 18,
373
+ 18,
374
+ 18,
375
+ 18,
376
+ 19,
377
+ 19,
378
+ 19,
379
+ 19,
380
+ 20,
381
+ 20,
382
+ 20,
383
+ 20,
384
+ 21,
385
+ 21,
386
+ 21,
387
+ 21,
388
+ 16,
389
+ 72,
390
+ 78
391
+ ]), Hn = new Uint16Array([
392
+ /* Distance codes 0..29 base */
393
+ 1,
394
+ 2,
395
+ 3,
396
+ 4,
397
+ 5,
398
+ 7,
399
+ 9,
400
+ 13,
401
+ 17,
402
+ 25,
403
+ 33,
404
+ 49,
405
+ 65,
406
+ 97,
407
+ 129,
408
+ 193,
409
+ 257,
410
+ 385,
411
+ 513,
412
+ 769,
413
+ 1025,
414
+ 1537,
415
+ 2049,
416
+ 3073,
417
+ 4097,
418
+ 6145,
419
+ 8193,
420
+ 12289,
421
+ 16385,
422
+ 24577,
423
+ 0,
424
+ 0
425
+ ]), Vn = new Uint8Array([
426
+ /* Distance codes 0..29 extra */
427
+ 16,
428
+ 16,
429
+ 16,
430
+ 16,
431
+ 17,
432
+ 17,
433
+ 18,
434
+ 18,
435
+ 19,
436
+ 19,
437
+ 20,
438
+ 20,
439
+ 21,
440
+ 21,
441
+ 22,
442
+ 22,
443
+ 23,
444
+ 23,
445
+ 24,
446
+ 24,
447
+ 25,
448
+ 25,
449
+ 26,
450
+ 26,
451
+ 27,
452
+ 27,
453
+ 28,
454
+ 28,
455
+ 29,
456
+ 29,
457
+ 64,
458
+ 64
459
+ ]), Gn = (t, n, e, i, o, r, s, f) => {
460
+ const u = f.bits;
461
+ let a = 0, c = 0, v = 0, d = 0, l = 0, h = 0, w = 0, _ = 0, k = 0, x = 0, I, g, E, O, m, S = null, b;
462
+ const p = new Uint16Array(G + 1), y = new Uint16Array(G + 1);
463
+ let T = null, D, U, B;
464
+ for (a = 0; a <= G; a++)
465
+ p[a] = 0;
466
+ for (c = 0; c < i; c++)
467
+ p[n[e + c]]++;
468
+ for (l = u, d = G; d >= 1 && p[d] === 0; d--)
469
+ ;
470
+ if (l > d && (l = d), d === 0)
471
+ return o[r++] = 1 << 24 | 64 << 16 | 0, o[r++] = 1 << 24 | 64 << 16 | 0, f.bits = 1, 0;
472
+ for (v = 1; v < d && p[v] === 0; v++)
473
+ ;
474
+ for (l < v && (l = v), _ = 1, a = 1; a <= G; a++)
475
+ if (_ <<= 1, _ -= p[a], _ < 0)
476
+ return -1;
477
+ if (_ > 0 && (t === ze || d !== 1))
478
+ return -1;
479
+ for (y[1] = 0, a = 1; a < G; a++)
480
+ y[a + 1] = y[a] + p[a];
481
+ for (c = 0; c < i; c++)
482
+ n[e + c] !== 0 && (s[y[n[e + c]]++] = c);
483
+ if (t === ze ? (S = T = s, b = 20) : t === we ? (S = Zn, T = $n, b = 257) : (S = Hn, T = Vn, b = 0), x = 0, c = 0, a = v, m = r, h = l, w = 0, E = -1, k = 1 << l, O = k - 1, t === we && k > Fe || t === Ze && k > Me)
484
+ return 1;
485
+ for (; ; ) {
486
+ D = a - w, s[c] + 1 < b ? (U = 0, B = s[c]) : s[c] >= b ? (U = T[s[c] - b], B = S[s[c] - b]) : (U = 96, B = 0), I = 1 << a - w, g = 1 << h, v = g;
487
+ do
488
+ g -= I, o[m + (x >> w) + g] = D << 24 | U << 16 | B | 0;
489
+ while (g !== 0);
490
+ for (I = 1 << a - 1; x & I; )
491
+ I >>= 1;
492
+ if (I !== 0 ? (x &= I - 1, x += I) : x = 0, c++, --p[a] === 0) {
493
+ if (a === d)
494
+ break;
495
+ a = n[e + s[c]];
496
+ }
497
+ if (a > l && (x & O) !== E) {
498
+ for (w === 0 && (w = l), m += v, h = a - w, _ = 1 << h; h + w < d && (_ -= p[h + w], !(_ <= 0)); )
499
+ h++, _ <<= 1;
500
+ if (k += 1 << h, t === we && k > Fe || t === Ze && k > Me)
501
+ return 1;
502
+ E = x & O, o[E] = l << 24 | h << 16 | m - r | 0;
503
+ }
504
+ }
505
+ return x !== 0 && (o[m + x] = a - w << 24 | 64 << 16 | 0), f.bits = l, 0;
506
+ };
507
+ var J = Gn;
508
+ const jn = 0, Ot = 1, Bt = 2, {
509
+ Z_FINISH: $e,
510
+ Z_BLOCK: Yn,
511
+ Z_TREES: re,
512
+ Z_OK: H,
513
+ Z_STREAM_END: Kn,
514
+ Z_NEED_DICT: Wn,
515
+ Z_STREAM_ERROR: C,
516
+ Z_DATA_ERROR: At,
517
+ Z_MEM_ERROR: Tt,
518
+ Z_BUF_ERROR: Xn,
519
+ Z_DEFLATED: He
520
+ } = Et, le = 16180, Ve = 16181, Ge = 16182, je = 16183, Ye = 16184, Ke = 16185, We = 16186, Xe = 16187, Je = 16188, Qe = 16189, ce = 16190, F = 16191, me = 16192, qe = 16193, ye = 16194, et = 16195, tt = 16196, nt = 16197, rt = 16198, ie = 16199, oe = 16200, it = 16201, ot = 16202, at = 16203, st = 16204, ct = 16205, pe = 16206, ft = 16207, lt = 16208, A = 16209, Ut = 16210, Rt = 16211, Jn = 852, Qn = 592, qn = 15, er = qn, ut = (t) => (t >>> 24 & 255) + (t >>> 8 & 65280) + ((t & 65280) << 8) + ((t & 255) << 24);
521
+ function tr() {
522
+ this.strm = null, this.mode = 0, this.last = !1, this.wrap = 0, this.havedict = !1, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new Uint16Array(320), this.work = new Uint16Array(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0;
523
+ }
524
+ const V = (t) => {
525
+ if (!t)
526
+ return 1;
527
+ const n = t.state;
528
+ return !n || n.strm !== t || n.mode < le || n.mode > Rt ? 1 : 0;
529
+ }, Dt = (t) => {
530
+ if (V(t))
531
+ return C;
532
+ const n = t.state;
533
+ return t.total_in = t.total_out = n.total = 0, t.msg = "", n.wrap && (t.adler = n.wrap & 1), n.mode = le, n.last = 0, n.havedict = 0, n.flags = -1, n.dmax = 32768, n.head = null, n.hold = 0, n.bits = 0, n.lencode = n.lendyn = new Int32Array(Jn), n.distcode = n.distdyn = new Int32Array(Qn), n.sane = 1, n.back = -1, H;
534
+ }, Nt = (t) => {
535
+ if (V(t))
536
+ return C;
537
+ const n = t.state;
538
+ return n.wsize = 0, n.whave = 0, n.wnext = 0, Dt(t);
539
+ }, Ct = (t, n) => {
540
+ let e;
541
+ if (V(t))
542
+ return C;
543
+ const i = t.state;
544
+ return n < 0 ? (e = 0, n = -n) : (e = (n >> 4) + 5, n < 48 && (n &= 15)), n && (n < 8 || n > 15) ? C : (i.window !== null && i.wbits !== n && (i.window = null), i.wrap = e, i.wbits = n, Nt(t));
545
+ }, Lt = (t, n) => {
546
+ if (!t)
547
+ return C;
548
+ const e = new tr();
549
+ t.state = e, e.strm = t, e.window = null, e.mode = le;
550
+ const i = Ct(t, n);
551
+ return i !== H && (t.state = null), i;
552
+ }, nr = (t) => Lt(t, er);
553
+ let ht = !0, ve, _e;
554
+ const rr = (t) => {
555
+ if (ht) {
556
+ ve = new Int32Array(512), _e = new Int32Array(32);
557
+ let n = 0;
558
+ for (; n < 144; )
559
+ t.lens[n++] = 8;
560
+ for (; n < 256; )
561
+ t.lens[n++] = 9;
562
+ for (; n < 280; )
563
+ t.lens[n++] = 7;
564
+ for (; n < 288; )
565
+ t.lens[n++] = 8;
566
+ for (J(Ot, t.lens, 0, 288, ve, 0, t.work, { bits: 9 }), n = 0; n < 32; )
567
+ t.lens[n++] = 5;
568
+ J(Bt, t.lens, 0, 32, _e, 0, t.work, { bits: 5 }), ht = !1;
569
+ }
570
+ t.lencode = ve, t.lenbits = 9, t.distcode = _e, t.distbits = 5;
571
+ }, Pt = (t, n, e, i) => {
572
+ let o;
573
+ const r = t.state;
574
+ return r.window === null && (r.wsize = 1 << r.wbits, r.wnext = 0, r.whave = 0, r.window = new Uint8Array(r.wsize)), i >= r.wsize ? (r.window.set(n.subarray(e - r.wsize, e), 0), r.wnext = 0, r.whave = r.wsize) : (o = r.wsize - r.wnext, o > i && (o = i), r.window.set(n.subarray(e - i, e - i + o), r.wnext), i -= o, i ? (r.window.set(n.subarray(e - i, e), 0), r.wnext = i, r.whave = r.wsize) : (r.wnext += o, r.wnext === r.wsize && (r.wnext = 0), r.whave < r.wsize && (r.whave += o))), 0;
575
+ }, ir = (t, n) => {
576
+ let e, i, o, r, s, f, u, a, c, v, d, l, h, w, _ = 0, k, x, I, g, E, O, m, S;
577
+ const b = new Uint8Array(4);
578
+ let p, y;
579
+ const T = (
580
+ /* permutation of code lengths */
581
+ new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15])
582
+ );
583
+ if (V(t) || !t.output || !t.input && t.avail_in !== 0)
584
+ return C;
585
+ e = t.state, e.mode === F && (e.mode = me), s = t.next_out, o = t.output, u = t.avail_out, r = t.next_in, i = t.input, f = t.avail_in, a = e.hold, c = e.bits, v = f, d = u, S = H;
586
+ e:
587
+ for (; ; )
588
+ switch (e.mode) {
589
+ case le:
590
+ if (e.wrap === 0) {
591
+ e.mode = me;
592
+ break;
593
+ }
594
+ for (; c < 16; ) {
595
+ if (f === 0)
596
+ break e;
597
+ f--, a += i[r++] << c, c += 8;
598
+ }
599
+ if (e.wrap & 2 && a === 35615) {
600
+ e.wbits === 0 && (e.wbits = 15), e.check = 0, b[0] = a & 255, b[1] = a >>> 8 & 255, e.check = P(e.check, b, 2, 0), a = 0, c = 0, e.mode = Ve;
601
+ break;
602
+ }
603
+ if (e.head && (e.head.done = !1), !(e.wrap & 1) || /* check if zlib header allowed */
604
+ (((a & 255) << 8) + (a >> 8)) % 31) {
605
+ t.msg = "incorrect header check", e.mode = A;
606
+ break;
607
+ }
608
+ if ((a & 15) !== He) {
609
+ t.msg = "unknown compression method", e.mode = A;
610
+ break;
611
+ }
612
+ if (a >>>= 4, c -= 4, m = (a & 15) + 8, e.wbits === 0 && (e.wbits = m), m > 15 || m > e.wbits) {
613
+ t.msg = "invalid window size", e.mode = A;
614
+ break;
615
+ }
616
+ e.dmax = 1 << e.wbits, e.flags = 0, t.adler = e.check = 1, e.mode = a & 512 ? Qe : F, a = 0, c = 0;
617
+ break;
618
+ case Ve:
619
+ for (; c < 16; ) {
620
+ if (f === 0)
621
+ break e;
622
+ f--, a += i[r++] << c, c += 8;
623
+ }
624
+ if (e.flags = a, (e.flags & 255) !== He) {
625
+ t.msg = "unknown compression method", e.mode = A;
626
+ break;
627
+ }
628
+ if (e.flags & 57344) {
629
+ t.msg = "unknown header flags set", e.mode = A;
630
+ break;
631
+ }
632
+ e.head && (e.head.text = a >> 8 & 1), e.flags & 512 && e.wrap & 4 && (b[0] = a & 255, b[1] = a >>> 8 & 255, e.check = P(e.check, b, 2, 0)), a = 0, c = 0, e.mode = Ge;
633
+ /* falls through */
634
+ case Ge:
635
+ for (; c < 32; ) {
636
+ if (f === 0)
637
+ break e;
638
+ f--, a += i[r++] << c, c += 8;
639
+ }
640
+ e.head && (e.head.time = a), e.flags & 512 && e.wrap & 4 && (b[0] = a & 255, b[1] = a >>> 8 & 255, b[2] = a >>> 16 & 255, b[3] = a >>> 24 & 255, e.check = P(e.check, b, 4, 0)), a = 0, c = 0, e.mode = je;
641
+ /* falls through */
642
+ case je:
643
+ for (; c < 16; ) {
644
+ if (f === 0)
645
+ break e;
646
+ f--, a += i[r++] << c, c += 8;
647
+ }
648
+ e.head && (e.head.xflags = a & 255, e.head.os = a >> 8), e.flags & 512 && e.wrap & 4 && (b[0] = a & 255, b[1] = a >>> 8 & 255, e.check = P(e.check, b, 2, 0)), a = 0, c = 0, e.mode = Ye;
649
+ /* falls through */
650
+ case Ye:
651
+ if (e.flags & 1024) {
652
+ for (; c < 16; ) {
653
+ if (f === 0)
654
+ break e;
655
+ f--, a += i[r++] << c, c += 8;
656
+ }
657
+ e.length = a, e.head && (e.head.extra_len = a), e.flags & 512 && e.wrap & 4 && (b[0] = a & 255, b[1] = a >>> 8 & 255, e.check = P(e.check, b, 2, 0)), a = 0, c = 0;
658
+ } else e.head && (e.head.extra = null);
659
+ e.mode = Ke;
660
+ /* falls through */
661
+ case Ke:
662
+ if (e.flags & 1024 && (l = e.length, l > f && (l = f), l && (e.head && (m = e.head.extra_len - e.length, e.head.extra || (e.head.extra = new Uint8Array(e.head.extra_len)), e.head.extra.set(
663
+ i.subarray(
664
+ r,
665
+ // extra field is limited to 65536 bytes
666
+ // - no need for additional size check
667
+ r + l
668
+ ),
669
+ /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/
670
+ m
671
+ )), e.flags & 512 && e.wrap & 4 && (e.check = P(e.check, i, l, r)), f -= l, r += l, e.length -= l), e.length))
672
+ break e;
673
+ e.length = 0, e.mode = We;
674
+ /* falls through */
675
+ case We:
676
+ if (e.flags & 2048) {
677
+ if (f === 0)
678
+ break e;
679
+ l = 0;
680
+ do
681
+ m = i[r + l++], e.head && m && e.length < 65536 && (e.head.name += String.fromCharCode(m));
682
+ while (m && l < f);
683
+ if (e.flags & 512 && e.wrap & 4 && (e.check = P(e.check, i, l, r)), f -= l, r += l, m)
684
+ break e;
685
+ } else e.head && (e.head.name = null);
686
+ e.length = 0, e.mode = Xe;
687
+ /* falls through */
688
+ case Xe:
689
+ if (e.flags & 4096) {
690
+ if (f === 0)
691
+ break e;
692
+ l = 0;
693
+ do
694
+ m = i[r + l++], e.head && m && e.length < 65536 && (e.head.comment += String.fromCharCode(m));
695
+ while (m && l < f);
696
+ if (e.flags & 512 && e.wrap & 4 && (e.check = P(e.check, i, l, r)), f -= l, r += l, m)
697
+ break e;
698
+ } else e.head && (e.head.comment = null);
699
+ e.mode = Je;
700
+ /* falls through */
701
+ case Je:
702
+ if (e.flags & 512) {
703
+ for (; c < 16; ) {
704
+ if (f === 0)
705
+ break e;
706
+ f--, a += i[r++] << c, c += 8;
707
+ }
708
+ if (e.wrap & 4 && a !== (e.check & 65535)) {
709
+ t.msg = "header crc mismatch", e.mode = A;
710
+ break;
711
+ }
712
+ a = 0, c = 0;
713
+ }
714
+ e.head && (e.head.hcrc = e.flags >> 9 & 1, e.head.done = !0), t.adler = e.check = 0, e.mode = F;
715
+ break;
716
+ case Qe:
717
+ for (; c < 32; ) {
718
+ if (f === 0)
719
+ break e;
720
+ f--, a += i[r++] << c, c += 8;
721
+ }
722
+ t.adler = e.check = ut(a), a = 0, c = 0, e.mode = ce;
723
+ /* falls through */
724
+ case ce:
725
+ if (e.havedict === 0)
726
+ return t.next_out = s, t.avail_out = u, t.next_in = r, t.avail_in = f, e.hold = a, e.bits = c, Wn;
727
+ t.adler = e.check = 1, e.mode = F;
728
+ /* falls through */
729
+ case F:
730
+ if (n === Yn || n === re)
731
+ break e;
732
+ /* falls through */
733
+ case me:
734
+ if (e.last) {
735
+ a >>>= c & 7, c -= c & 7, e.mode = pe;
736
+ break;
737
+ }
738
+ for (; c < 3; ) {
739
+ if (f === 0)
740
+ break e;
741
+ f--, a += i[r++] << c, c += 8;
742
+ }
743
+ switch (e.last = a & 1, a >>>= 1, c -= 1, a & 3) {
744
+ case 0:
745
+ e.mode = qe;
746
+ break;
747
+ case 1:
748
+ if (rr(e), e.mode = ie, n === re) {
749
+ a >>>= 2, c -= 2;
750
+ break e;
751
+ }
752
+ break;
753
+ case 2:
754
+ e.mode = tt;
755
+ break;
756
+ case 3:
757
+ t.msg = "invalid block type", e.mode = A;
758
+ }
759
+ a >>>= 2, c -= 2;
760
+ break;
761
+ case qe:
762
+ for (a >>>= c & 7, c -= c & 7; c < 32; ) {
763
+ if (f === 0)
764
+ break e;
765
+ f--, a += i[r++] << c, c += 8;
766
+ }
767
+ if ((a & 65535) !== (a >>> 16 ^ 65535)) {
768
+ t.msg = "invalid stored block lengths", e.mode = A;
769
+ break;
770
+ }
771
+ if (e.length = a & 65535, a = 0, c = 0, e.mode = ye, n === re)
772
+ break e;
773
+ /* falls through */
774
+ case ye:
775
+ e.mode = et;
776
+ /* falls through */
777
+ case et:
778
+ if (l = e.length, l) {
779
+ if (l > f && (l = f), l > u && (l = u), l === 0)
780
+ break e;
781
+ o.set(i.subarray(r, r + l), s), f -= l, r += l, u -= l, s += l, e.length -= l;
782
+ break;
783
+ }
784
+ e.mode = F;
785
+ break;
786
+ case tt:
787
+ for (; c < 14; ) {
788
+ if (f === 0)
789
+ break e;
790
+ f--, a += i[r++] << c, c += 8;
791
+ }
792
+ if (e.nlen = (a & 31) + 257, a >>>= 5, c -= 5, e.ndist = (a & 31) + 1, a >>>= 5, c -= 5, e.ncode = (a & 15) + 4, a >>>= 4, c -= 4, e.nlen > 286 || e.ndist > 30) {
793
+ t.msg = "too many length or distance symbols", e.mode = A;
794
+ break;
795
+ }
796
+ e.have = 0, e.mode = nt;
797
+ /* falls through */
798
+ case nt:
799
+ for (; e.have < e.ncode; ) {
800
+ for (; c < 3; ) {
801
+ if (f === 0)
802
+ break e;
803
+ f--, a += i[r++] << c, c += 8;
804
+ }
805
+ e.lens[T[e.have++]] = a & 7, a >>>= 3, c -= 3;
806
+ }
807
+ for (; e.have < 19; )
808
+ e.lens[T[e.have++]] = 0;
809
+ if (e.lencode = e.lendyn, e.lenbits = 7, p = { bits: e.lenbits }, S = J(jn, e.lens, 0, 19, e.lencode, 0, e.work, p), e.lenbits = p.bits, S) {
810
+ t.msg = "invalid code lengths set", e.mode = A;
811
+ break;
812
+ }
813
+ e.have = 0, e.mode = rt;
814
+ /* falls through */
815
+ case rt:
816
+ for (; e.have < e.nlen + e.ndist; ) {
817
+ for (; _ = e.lencode[a & (1 << e.lenbits) - 1], k = _ >>> 24, x = _ >>> 16 & 255, I = _ & 65535, !(k <= c); ) {
818
+ if (f === 0)
819
+ break e;
820
+ f--, a += i[r++] << c, c += 8;
821
+ }
822
+ if (I < 16)
823
+ a >>>= k, c -= k, e.lens[e.have++] = I;
824
+ else {
825
+ if (I === 16) {
826
+ for (y = k + 2; c < y; ) {
827
+ if (f === 0)
828
+ break e;
829
+ f--, a += i[r++] << c, c += 8;
830
+ }
831
+ if (a >>>= k, c -= k, e.have === 0) {
832
+ t.msg = "invalid bit length repeat", e.mode = A;
833
+ break;
834
+ }
835
+ m = e.lens[e.have - 1], l = 3 + (a & 3), a >>>= 2, c -= 2;
836
+ } else if (I === 17) {
837
+ for (y = k + 3; c < y; ) {
838
+ if (f === 0)
839
+ break e;
840
+ f--, a += i[r++] << c, c += 8;
841
+ }
842
+ a >>>= k, c -= k, m = 0, l = 3 + (a & 7), a >>>= 3, c -= 3;
843
+ } else {
844
+ for (y = k + 7; c < y; ) {
845
+ if (f === 0)
846
+ break e;
847
+ f--, a += i[r++] << c, c += 8;
848
+ }
849
+ a >>>= k, c -= k, m = 0, l = 11 + (a & 127), a >>>= 7, c -= 7;
850
+ }
851
+ if (e.have + l > e.nlen + e.ndist) {
852
+ t.msg = "invalid bit length repeat", e.mode = A;
853
+ break;
854
+ }
855
+ for (; l--; )
856
+ e.lens[e.have++] = m;
857
+ }
858
+ }
859
+ if (e.mode === A)
860
+ break;
861
+ if (e.lens[256] === 0) {
862
+ t.msg = "invalid code -- missing end-of-block", e.mode = A;
863
+ break;
864
+ }
865
+ if (e.lenbits = 9, p = { bits: e.lenbits }, S = J(Ot, e.lens, 0, e.nlen, e.lencode, 0, e.work, p), e.lenbits = p.bits, S) {
866
+ t.msg = "invalid literal/lengths set", e.mode = A;
867
+ break;
868
+ }
869
+ if (e.distbits = 6, e.distcode = e.distdyn, p = { bits: e.distbits }, S = J(Bt, e.lens, e.nlen, e.ndist, e.distcode, 0, e.work, p), e.distbits = p.bits, S) {
870
+ t.msg = "invalid distances set", e.mode = A;
871
+ break;
872
+ }
873
+ if (e.mode = ie, n === re)
874
+ break e;
875
+ /* falls through */
876
+ case ie:
877
+ e.mode = oe;
878
+ /* falls through */
879
+ case oe:
880
+ if (f >= 6 && u >= 258) {
881
+ t.next_out = s, t.avail_out = u, t.next_in = r, t.avail_in = f, e.hold = a, e.bits = c, zn(t, d), s = t.next_out, o = t.output, u = t.avail_out, r = t.next_in, i = t.input, f = t.avail_in, a = e.hold, c = e.bits, e.mode === F && (e.back = -1);
882
+ break;
883
+ }
884
+ for (e.back = 0; _ = e.lencode[a & (1 << e.lenbits) - 1], k = _ >>> 24, x = _ >>> 16 & 255, I = _ & 65535, !(k <= c); ) {
885
+ if (f === 0)
886
+ break e;
887
+ f--, a += i[r++] << c, c += 8;
888
+ }
889
+ if (x && !(x & 240)) {
890
+ for (g = k, E = x, O = I; _ = e.lencode[O + ((a & (1 << g + E) - 1) >> g)], k = _ >>> 24, x = _ >>> 16 & 255, I = _ & 65535, !(g + k <= c); ) {
891
+ if (f === 0)
892
+ break e;
893
+ f--, a += i[r++] << c, c += 8;
894
+ }
895
+ a >>>= g, c -= g, e.back += g;
896
+ }
897
+ if (a >>>= k, c -= k, e.back += k, e.length = I, x === 0) {
898
+ e.mode = ct;
899
+ break;
900
+ }
901
+ if (x & 32) {
902
+ e.back = -1, e.mode = F;
903
+ break;
904
+ }
905
+ if (x & 64) {
906
+ t.msg = "invalid literal/length code", e.mode = A;
907
+ break;
908
+ }
909
+ e.extra = x & 15, e.mode = it;
910
+ /* falls through */
911
+ case it:
912
+ if (e.extra) {
913
+ for (y = e.extra; c < y; ) {
914
+ if (f === 0)
915
+ break e;
916
+ f--, a += i[r++] << c, c += 8;
917
+ }
918
+ e.length += a & (1 << e.extra) - 1, a >>>= e.extra, c -= e.extra, e.back += e.extra;
919
+ }
920
+ e.was = e.length, e.mode = ot;
921
+ /* falls through */
922
+ case ot:
923
+ for (; _ = e.distcode[a & (1 << e.distbits) - 1], k = _ >>> 24, x = _ >>> 16 & 255, I = _ & 65535, !(k <= c); ) {
924
+ if (f === 0)
925
+ break e;
926
+ f--, a += i[r++] << c, c += 8;
927
+ }
928
+ if (!(x & 240)) {
929
+ for (g = k, E = x, O = I; _ = e.distcode[O + ((a & (1 << g + E) - 1) >> g)], k = _ >>> 24, x = _ >>> 16 & 255, I = _ & 65535, !(g + k <= c); ) {
930
+ if (f === 0)
931
+ break e;
932
+ f--, a += i[r++] << c, c += 8;
933
+ }
934
+ a >>>= g, c -= g, e.back += g;
935
+ }
936
+ if (a >>>= k, c -= k, e.back += k, x & 64) {
937
+ t.msg = "invalid distance code", e.mode = A;
938
+ break;
939
+ }
940
+ e.offset = I, e.extra = x & 15, e.mode = at;
941
+ /* falls through */
942
+ case at:
943
+ if (e.extra) {
944
+ for (y = e.extra; c < y; ) {
945
+ if (f === 0)
946
+ break e;
947
+ f--, a += i[r++] << c, c += 8;
948
+ }
949
+ e.offset += a & (1 << e.extra) - 1, a >>>= e.extra, c -= e.extra, e.back += e.extra;
950
+ }
951
+ if (e.offset > e.dmax) {
952
+ t.msg = "invalid distance too far back", e.mode = A;
953
+ break;
954
+ }
955
+ e.mode = st;
956
+ /* falls through */
957
+ case st:
958
+ if (u === 0)
959
+ break e;
960
+ if (l = d - u, e.offset > l) {
961
+ if (l = e.offset - l, l > e.whave && e.sane) {
962
+ t.msg = "invalid distance too far back", e.mode = A;
963
+ break;
964
+ }
965
+ l > e.wnext ? (l -= e.wnext, h = e.wsize - l) : h = e.wnext - l, l > e.length && (l = e.length), w = e.window;
966
+ } else
967
+ w = o, h = s - e.offset, l = e.length;
968
+ l > u && (l = u), u -= l, e.length -= l;
969
+ do
970
+ o[s++] = w[h++];
971
+ while (--l);
972
+ e.length === 0 && (e.mode = oe);
973
+ break;
974
+ case ct:
975
+ if (u === 0)
976
+ break e;
977
+ o[s++] = e.length, u--, e.mode = oe;
978
+ break;
979
+ case pe:
980
+ if (e.wrap) {
981
+ for (; c < 32; ) {
982
+ if (f === 0)
983
+ break e;
984
+ f--, a |= i[r++] << c, c += 8;
985
+ }
986
+ if (d -= u, t.total_out += d, e.total += d, e.wrap & 4 && d && (t.adler = e.check = /*UPDATE_CHECK(state.check, put - _out, _out);*/
987
+ e.flags ? P(e.check, o, d, s - d) : Be(e.check, o, d, s - d)), d = u, e.wrap & 4 && (e.flags ? a : ut(a)) !== e.check) {
988
+ t.msg = "incorrect data check", e.mode = A;
989
+ break;
990
+ }
991
+ a = 0, c = 0;
992
+ }
993
+ e.mode = ft;
994
+ /* falls through */
995
+ case ft:
996
+ if (e.wrap && e.flags) {
997
+ for (; c < 32; ) {
998
+ if (f === 0)
999
+ break e;
1000
+ f--, a += i[r++] << c, c += 8;
1001
+ }
1002
+ if (e.wrap & 4 && a !== (e.total & 4294967295)) {
1003
+ t.msg = "incorrect length check", e.mode = A;
1004
+ break;
1005
+ }
1006
+ a = 0, c = 0;
1007
+ }
1008
+ e.mode = lt;
1009
+ /* falls through */
1010
+ case lt:
1011
+ S = Kn;
1012
+ break e;
1013
+ case A:
1014
+ S = At;
1015
+ break e;
1016
+ case Ut:
1017
+ return Tt;
1018
+ case Rt:
1019
+ /* falls through */
1020
+ default:
1021
+ return C;
1022
+ }
1023
+ return t.next_out = s, t.avail_out = u, t.next_in = r, t.avail_in = f, e.hold = a, e.bits = c, (e.wsize || d !== t.avail_out && e.mode < A && (e.mode < pe || n !== $e)) && Pt(t, t.output, t.next_out, d - t.avail_out), v -= t.avail_in, d -= t.avail_out, t.total_in += v, t.total_out += d, e.total += d, e.wrap & 4 && d && (t.adler = e.check = /*UPDATE_CHECK(state.check, strm.next_out - _out, _out);*/
1024
+ e.flags ? P(e.check, o, d, t.next_out - d) : Be(e.check, o, d, t.next_out - d)), t.data_type = e.bits + (e.last ? 64 : 0) + (e.mode === F ? 128 : 0) + (e.mode === ie || e.mode === ye ? 256 : 0), (v === 0 && d === 0 || n === $e) && S === H && (S = Xn), S;
1025
+ }, or = (t) => {
1026
+ if (V(t))
1027
+ return C;
1028
+ let n = t.state;
1029
+ return n.window && (n.window = null), t.state = null, H;
1030
+ }, ar = (t, n) => {
1031
+ if (V(t))
1032
+ return C;
1033
+ const e = t.state;
1034
+ return e.wrap & 2 ? (e.head = n, n.done = !1, H) : C;
1035
+ }, sr = (t, n) => {
1036
+ const e = n.length;
1037
+ let i, o, r;
1038
+ return V(t) || (i = t.state, i.wrap !== 0 && i.mode !== ce) ? C : i.mode === ce && (o = 1, o = Be(o, n, e, 0), o !== i.check) ? At : (r = Pt(t, n, e, e), r ? (i.mode = Ut, Tt) : (i.havedict = 1, H));
1039
+ };
1040
+ var cr = Nt, fr = Ct, lr = Dt, ur = nr, hr = Lt, dr = ir, br = or, gr = ar, wr = sr, mr = "pako inflate (from Nodeca project)", M = {
1041
+ inflateReset: cr,
1042
+ inflateReset2: fr,
1043
+ inflateResetKeep: lr,
1044
+ inflateInit: ur,
1045
+ inflateInit2: hr,
1046
+ inflate: dr,
1047
+ inflateEnd: br,
1048
+ inflateGetHeader: gr,
1049
+ inflateSetDictionary: wr,
1050
+ inflateInfo: mr
1051
+ };
1052
+ function yr() {
1053
+ this.text = 0, this.time = 0, this.xflags = 0, this.os = 0, this.extra = null, this.extra_len = 0, this.name = "", this.comment = "", this.hcrc = 0, this.done = !1;
1054
+ }
1055
+ var pr = yr;
1056
+ const Ft = Object.prototype.toString, {
1057
+ Z_NO_FLUSH: vr,
1058
+ Z_FINISH: _r,
1059
+ Z_OK: q,
1060
+ Z_STREAM_END: ke,
1061
+ Z_NEED_DICT: xe,
1062
+ Z_STREAM_ERROR: kr,
1063
+ Z_DATA_ERROR: dt,
1064
+ Z_MEM_ERROR: xr
1065
+ } = Et;
1066
+ function ue(t) {
1067
+ this.options = St.assign({
1068
+ chunkSize: 1024 * 64,
1069
+ windowBits: 15,
1070
+ to: ""
1071
+ }, t || {});
1072
+ const n = this.options;
1073
+ n.raw && n.windowBits >= 0 && n.windowBits < 16 && (n.windowBits = -n.windowBits, n.windowBits === 0 && (n.windowBits = -15)), n.windowBits >= 0 && n.windowBits < 16 && !(t && t.windowBits) && (n.windowBits += 32), n.windowBits > 15 && n.windowBits < 48 && (n.windowBits & 15 || (n.windowBits |= 15)), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new Fn(), this.strm.avail_out = 0;
1074
+ let e = M.inflateInit2(
1075
+ this.strm,
1076
+ n.windowBits
1077
+ );
1078
+ if (e !== q)
1079
+ throw new Error(Ae[e]);
1080
+ if (this.header = new pr(), M.inflateGetHeader(this.strm, this.header), n.dictionary && (typeof n.dictionary == "string" ? n.dictionary = Te.string2buf(n.dictionary) : Ft.call(n.dictionary) === "[object ArrayBuffer]" && (n.dictionary = new Uint8Array(n.dictionary)), n.raw && (e = M.inflateSetDictionary(this.strm, n.dictionary), e !== q)))
1081
+ throw new Error(Ae[e]);
1082
+ }
1083
+ ue.prototype.push = function(t, n) {
1084
+ const e = this.strm, i = this.options.chunkSize, o = this.options.dictionary;
1085
+ let r, s, f;
1086
+ if (this.ended) return !1;
1087
+ for (n === ~~n ? s = n : s = n === !0 ? _r : vr, Ft.call(t) === "[object ArrayBuffer]" ? e.input = new Uint8Array(t) : e.input = t, e.next_in = 0, e.avail_in = e.input.length; ; ) {
1088
+ for (e.avail_out === 0 && (e.output = new Uint8Array(i), e.next_out = 0, e.avail_out = i), r = M.inflate(e, s), r === xe && o && (r = M.inflateSetDictionary(e, o), r === q ? r = M.inflate(e, s) : r === dt && (r = xe)); e.avail_in > 0 && r === ke && e.state.wrap > 0 && t[e.next_in] !== 0; )
1089
+ M.inflateReset(e), r = M.inflate(e, s);
1090
+ switch (r) {
1091
+ case kr:
1092
+ case dt:
1093
+ case xe:
1094
+ case xr:
1095
+ return this.onEnd(r), this.ended = !0, !1;
1096
+ }
1097
+ if (f = e.avail_out, e.next_out && (e.avail_out === 0 || r === ke))
1098
+ if (this.options.to === "string") {
1099
+ let u = Te.utf8border(e.output, e.next_out), a = e.next_out - u, c = Te.buf2string(e.output, u);
1100
+ e.next_out = a, e.avail_out = i - a, a && e.output.set(e.output.subarray(u, u + a), 0), this.onData(c);
1101
+ } else
1102
+ this.onData(e.output.length === e.next_out ? e.output : e.output.subarray(0, e.next_out));
1103
+ if (!(r === q && f === 0)) {
1104
+ if (r === ke)
1105
+ return r = M.inflateEnd(this.strm), this.onEnd(r), this.ended = !0, !0;
1106
+ if (e.avail_in === 0) break;
1107
+ }
1108
+ }
1109
+ return !0;
1110
+ };
1111
+ ue.prototype.onData = function(t) {
1112
+ this.chunks.push(t);
1113
+ };
1114
+ ue.prototype.onEnd = function(t) {
1115
+ t === q && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = St.flattenChunks(this.chunks)), this.chunks = [], this.err = t, this.msg = this.strm.msg;
1116
+ };
1117
+ function Er(t, n) {
1118
+ const e = new ue(n);
1119
+ if (e.push(t), e.err) throw e.msg || Ae[e.err];
1120
+ return e.result;
1121
+ }
1122
+ function Sr(t, n) {
1123
+ return n = n || {}, n.raw = !0, Er(t, n);
1124
+ }
1125
+ var Ir = Sr, Or = {
1126
+ inflateRaw: Ir
1127
+ };
1128
+ const { inflateRaw: Br } = Or;
1129
+ var Ar = Br;
1130
+ function Tr(t) {
1131
+ return Ar(t.subarray(2));
1132
+ }
1133
+ class Ur extends Error {
1134
+ constructor(n) {
1135
+ super(n), this.code = "ERR_ABORTED";
1136
+ }
1137
+ }
1138
+ function Rr(t) {
1139
+ t.sort((o, r) => o.offset - r.offset);
1140
+ const n = [];
1141
+ let e, i;
1142
+ for (const o of t)
1143
+ e && i && o.offset - i <= 2e3 ? (e.length = e.length + o.length - i + o.offset, e.blocks.push(o)) : n.push(e = {
1144
+ blocks: [o],
1145
+ length: o.length,
1146
+ offset: o.offset
1147
+ }), i = e.offset + e.length;
1148
+ return n;
1149
+ }
1150
+ function ae(t) {
1151
+ if (t && t.aborted)
1152
+ if (typeof DOMException > "u") {
1153
+ const n = new Ur("aborted");
1154
+ throw n.code = "ERR_ABORTED", n;
1155
+ } else
1156
+ throw new DOMException("aborted", "AbortError");
1157
+ }
1158
+ const Ee = typeof TextDecoder < "u" ? new TextDecoder("utf8") : void 0;
1159
+ function Se(t, n, e, i) {
1160
+ return t < i && n >= e;
1161
+ }
1162
+ class Mt {
1163
+ constructor(n, e, i, o, r, s) {
1164
+ if (this.bbi = n, this.refsByName = e, this.cirTreeOffset = i, this.isBigEndian = o, this.isCompressed = r, this.blockType = s, this.featureCache = new pt({
1165
+ cache: new vt({ maxSize: 1e3 }),
1166
+ fill: async (f, u) => {
1167
+ const a = f.length, c = f.offset, { buffer: v } = await this.bbi.read(z.Buffer.alloc(a), 0, a, c, {
1168
+ signal: u
1169
+ });
1170
+ return v;
1171
+ }
1172
+ }), !(i >= 0))
1173
+ throw new Error("invalid cirTreeOffset!");
1174
+ }
1175
+ async readWigData(n, e, i, o, r) {
1176
+ try {
1177
+ const { refsByName: s, bbi: f, cirTreeOffset: u, isBigEndian: a } = this, c = s[n];
1178
+ c === void 0 && o.complete();
1179
+ const v = { chrId: c, start: e, end: i };
1180
+ this.cirTreePromise || (this.cirTreePromise = f.read(z.Buffer.alloc(48), 0, 48, u, r));
1181
+ const { buffer: d } = await this.cirTreePromise, l = a ? d.readUInt32BE(4) : d.readUInt32LE(4);
1182
+ let h = [], w = 0;
1183
+ const _ = !0, k = (E, O, m) => {
1184
+ try {
1185
+ const b = E.subarray(O), p = new DataView(b.buffer, b.byteOffset, b.length);
1186
+ let y = 0;
1187
+ const T = p.getUint8(y);
1188
+ y += 2;
1189
+ const D = p.getUint16(y, _);
1190
+ if (y += 2, T === 1) {
1191
+ const U = [];
1192
+ for (let B = 0; B < D; B++) {
1193
+ const N = p.getUint32(y, _);
1194
+ y += 4;
1195
+ const Z = p.getUint32(y, _);
1196
+ y += 4;
1197
+ const he = p.getUint32(y, _);
1198
+ y += 4;
1199
+ const de = p.getUint32(y, _);
1200
+ y += 4;
1201
+ const be = Number(p.getBigUint64(y, _));
1202
+ y += 8;
1203
+ const ge = Number(p.getBigUint64(y, _));
1204
+ y += 8, U.push({
1205
+ startChrom: N,
1206
+ startBase: Z,
1207
+ endBase: de,
1208
+ endChrom: he,
1209
+ blockOffset: be,
1210
+ blockSize: ge,
1211
+ offset: y
1212
+ });
1213
+ }
1214
+ h = h.concat(U.filter((B) => x(B)).map((B) => ({
1215
+ offset: B.blockOffset,
1216
+ length: B.blockSize
1217
+ })));
1218
+ } else if (T === 0) {
1219
+ const U = [];
1220
+ for (let N = 0; N < D; N++) {
1221
+ const Z = p.getUint32(y, _);
1222
+ y += 4;
1223
+ const he = p.getUint32(y, _);
1224
+ y += 4;
1225
+ const de = p.getUint32(y, _);
1226
+ y += 4;
1227
+ const be = p.getUint32(y, _);
1228
+ y += 4;
1229
+ const ge = Number(p.getBigUint64(y, _));
1230
+ y += 8, U.push({
1231
+ startChrom: Z,
1232
+ startBase: he,
1233
+ endChrom: de,
1234
+ endBase: be,
1235
+ blockOffset: ge,
1236
+ offset: y
1237
+ });
1238
+ }
1239
+ const B = U.filter((N) => x(N)).map((N) => N.blockOffset);
1240
+ B.length > 0 && g(B, m + 1);
1241
+ }
1242
+ } catch (S) {
1243
+ o.error(S);
1244
+ }
1245
+ }, x = (E) => {
1246
+ const { startChrom: O, startBase: m, endChrom: S, endBase: b } = E;
1247
+ return (O < c || O === c && m <= i) && (S > c || S === c && b >= e);
1248
+ }, I = async (E, O, m) => {
1249
+ try {
1250
+ const S = O.max - O.min, b = O.min, p = await this.featureCache.get(`${S}_${b}`, { length: S, offset: b }, r == null ? void 0 : r.signal);
1251
+ for (const y of E)
1252
+ O.contains(y) && (k(p, y - b, m), w -= 1, w === 0 && this.readFeatures(o, h, {
1253
+ ...r,
1254
+ request: v
1255
+ }).catch((T) => {
1256
+ o.error(T);
1257
+ }));
1258
+ } catch (S) {
1259
+ o.error(S);
1260
+ }
1261
+ }, g = (E, O) => {
1262
+ try {
1263
+ w += E.length;
1264
+ const m = 4 + l * 32;
1265
+ let S = new j([
1266
+ {
1267
+ min: E[0],
1268
+ max: E[0] + m
1269
+ }
1270
+ ]);
1271
+ for (let b = 1; b < E.length; b += 1) {
1272
+ const p = new j([
1273
+ {
1274
+ min: E[b],
1275
+ max: E[b] + m
1276
+ }
1277
+ ]);
1278
+ S = S.union(p);
1279
+ }
1280
+ S.getRanges().map((b) => I(E, b, O));
1281
+ } catch (m) {
1282
+ o.error(m);
1283
+ }
1284
+ };
1285
+ g([Number(u) + 48], 1);
1286
+ return;
1287
+ } catch (s) {
1288
+ o.error(s);
1289
+ }
1290
+ }
1291
+ parseSummaryBlock(n, e, i) {
1292
+ const o = [];
1293
+ let r = e;
1294
+ const s = new DataView(n.buffer, n.byteOffset, n.length);
1295
+ for (; r < n.byteLength; ) {
1296
+ const f = s.getUint32(r, !0);
1297
+ r += 4;
1298
+ const u = s.getUint32(r, !0);
1299
+ r += 4;
1300
+ const a = s.getUint32(r, !0);
1301
+ r += 4;
1302
+ const c = s.getUint32(r, !0);
1303
+ r += 4;
1304
+ const v = s.getFloat32(r, !0);
1305
+ r += 4;
1306
+ const d = s.getFloat32(r, !0);
1307
+ r += 4;
1308
+ const l = s.getFloat32(r, !0);
1309
+ r += 4, r += 4, (!i || f === i.chrId && Se(u, a, i.start, i.end)) && o.push({
1310
+ start: u,
1311
+ end: a,
1312
+ maxScore: d,
1313
+ minScore: v,
1314
+ summary: !0,
1315
+ score: l / (c || 1)
1316
+ });
1317
+ }
1318
+ return o;
1319
+ }
1320
+ parseBigBedBlock(n, e, i, o) {
1321
+ var r;
1322
+ const s = [];
1323
+ let f = e;
1324
+ const u = !0, a = n, c = new DataView(a.buffer, a.byteOffset, a.length);
1325
+ for (; f < n.byteLength; ) {
1326
+ const v = f, d = c.getUint32(f, u);
1327
+ f += 4;
1328
+ const l = c.getInt32(f, u);
1329
+ f += 4;
1330
+ const h = c.getInt32(f, u);
1331
+ f += 4;
1332
+ let w = f;
1333
+ for (; w < n.length && n[w] !== 0; w++)
1334
+ ;
1335
+ const _ = n.subarray(f, w), k = (r = Ee == null ? void 0 : Ee.decode(_)) !== null && r !== void 0 ? r : _.toString();
1336
+ f = w + 1, s.push({
1337
+ chromId: d,
1338
+ start: l,
1339
+ end: h,
1340
+ rest: k,
1341
+ uniqueId: `bb-${i + v}`
1342
+ });
1343
+ }
1344
+ return o ? s.filter((v) => Se(v.start, v.end, o.start, o.end)) : s;
1345
+ }
1346
+ parseBigWigBlock(n, e, i) {
1347
+ const o = n.subarray(e), r = new DataView(o.buffer, o.byteOffset, o.length);
1348
+ let s = 0;
1349
+ s += 4;
1350
+ const f = r.getInt32(s, !0);
1351
+ s += 8;
1352
+ const u = r.getUint32(s, !0);
1353
+ s += 4;
1354
+ const a = r.getUint32(s, !0);
1355
+ s += 4;
1356
+ const c = r.getUint8(s);
1357
+ s += 2;
1358
+ const v = r.getUint16(s, !0);
1359
+ s += 2;
1360
+ const d = new Array(v);
1361
+ switch (c) {
1362
+ case 1: {
1363
+ for (let l = 0; l < v; l++) {
1364
+ const h = r.getInt32(s, !0);
1365
+ s += 4;
1366
+ const w = r.getInt32(s, !0);
1367
+ s += 4;
1368
+ const _ = r.getFloat32(s, !0);
1369
+ s += 4, d[l] = {
1370
+ start: h,
1371
+ end: w,
1372
+ score: _
1373
+ };
1374
+ }
1375
+ break;
1376
+ }
1377
+ case 2: {
1378
+ for (let l = 0; l < v; l++) {
1379
+ const h = r.getInt32(s, !0);
1380
+ s += 4;
1381
+ const w = r.getFloat32(s, !0);
1382
+ s += 4, d[l] = {
1383
+ score: w,
1384
+ start: h,
1385
+ end: h + a
1386
+ };
1387
+ }
1388
+ break;
1389
+ }
1390
+ case 3: {
1391
+ for (let l = 0; l < v; l++) {
1392
+ const h = r.getFloat32(s, !0);
1393
+ s += 4;
1394
+ const w = f + l * u;
1395
+ d[l] = {
1396
+ score: h,
1397
+ start: w,
1398
+ end: w + a
1399
+ };
1400
+ }
1401
+ break;
1402
+ }
1403
+ }
1404
+ return i ? d.filter((l) => Se(l.start, l.end, i.start, i.end)) : d;
1405
+ }
1406
+ async readFeatures(n, e, i = {}) {
1407
+ try {
1408
+ const { blockType: o, isCompressed: r } = this, { signal: s, request: f } = i, u = Rr(e);
1409
+ ae(s), await Promise.all(u.map(async (a) => {
1410
+ ae(s);
1411
+ const { length: c, offset: v } = a, d = await this.featureCache.get(`${c}_${v}`, a, s);
1412
+ for (const l of a.blocks) {
1413
+ ae(s);
1414
+ let h = Number(l.offset) - Number(a.offset), w = d;
1415
+ switch (r && (w = Tr(d.subarray(h)), h = 0), ae(s), o) {
1416
+ case "summary": {
1417
+ n.next(this.parseSummaryBlock(w, h, f));
1418
+ break;
1419
+ }
1420
+ case "bigwig": {
1421
+ n.next(this.parseBigWigBlock(w, h, f));
1422
+ break;
1423
+ }
1424
+ case "bigbed": {
1425
+ n.next(this.parseBigBedBlock(w, h, Number(l.offset) * 256, f));
1426
+ break;
1427
+ }
1428
+ default:
1429
+ console.warn(`Don't know what to do with ${o}`);
1430
+ }
1431
+ }
1432
+ })), n.complete();
1433
+ } catch (o) {
1434
+ n.error(o);
1435
+ }
1436
+ }
1437
+ }
1438
+ var Ue = function(t, n) {
1439
+ return Ue = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, i) {
1440
+ e.__proto__ = i;
1441
+ } || function(e, i) {
1442
+ for (var o in i) Object.prototype.hasOwnProperty.call(i, o) && (e[o] = i[o]);
1443
+ }, Ue(t, n);
1444
+ };
1445
+ function Ne(t, n) {
1446
+ if (typeof n != "function" && n !== null)
1447
+ throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
1448
+ Ue(t, n);
1449
+ function e() {
1450
+ this.constructor = t;
1451
+ }
1452
+ t.prototype = n === null ? Object.create(n) : (e.prototype = n.prototype, new e());
1453
+ }
1454
+ function Dr(t, n, e, i) {
1455
+ function o(r) {
1456
+ return r instanceof e ? r : new e(function(s) {
1457
+ s(r);
1458
+ });
1459
+ }
1460
+ return new (e || (e = Promise))(function(r, s) {
1461
+ function f(c) {
1462
+ try {
1463
+ a(i.next(c));
1464
+ } catch (v) {
1465
+ s(v);
1466
+ }
1467
+ }
1468
+ function u(c) {
1469
+ try {
1470
+ a(i.throw(c));
1471
+ } catch (v) {
1472
+ s(v);
1473
+ }
1474
+ }
1475
+ function a(c) {
1476
+ c.done ? r(c.value) : o(c.value).then(f, u);
1477
+ }
1478
+ a((i = i.apply(t, n || [])).next());
1479
+ });
1480
+ }
1481
+ function zt(t, n) {
1482
+ var e = { label: 0, sent: function() {
1483
+ if (r[0] & 1) throw r[1];
1484
+ return r[1];
1485
+ }, trys: [], ops: [] }, i, o, r, s = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
1486
+ return s.next = f(0), s.throw = f(1), s.return = f(2), typeof Symbol == "function" && (s[Symbol.iterator] = function() {
1487
+ return this;
1488
+ }), s;
1489
+ function f(a) {
1490
+ return function(c) {
1491
+ return u([a, c]);
1492
+ };
1493
+ }
1494
+ function u(a) {
1495
+ if (i) throw new TypeError("Generator is already executing.");
1496
+ for (; s && (s = 0, a[0] && (e = 0)), e; ) try {
1497
+ if (i = 1, o && (r = a[0] & 2 ? o.return : a[0] ? o.throw || ((r = o.return) && r.call(o), 0) : o.next) && !(r = r.call(o, a[1])).done) return r;
1498
+ switch (o = 0, r && (a = [a[0] & 2, r.value]), a[0]) {
1499
+ case 0:
1500
+ case 1:
1501
+ r = a;
1502
+ break;
1503
+ case 4:
1504
+ return e.label++, { value: a[1], done: !1 };
1505
+ case 5:
1506
+ e.label++, o = a[1], a = [0];
1507
+ continue;
1508
+ case 7:
1509
+ a = e.ops.pop(), e.trys.pop();
1510
+ continue;
1511
+ default:
1512
+ if (r = e.trys, !(r = r.length > 0 && r[r.length - 1]) && (a[0] === 6 || a[0] === 2)) {
1513
+ e = 0;
1514
+ continue;
1515
+ }
1516
+ if (a[0] === 3 && (!r || a[1] > r[0] && a[1] < r[3])) {
1517
+ e.label = a[1];
1518
+ break;
1519
+ }
1520
+ if (a[0] === 6 && e.label < r[1]) {
1521
+ e.label = r[1], r = a;
1522
+ break;
1523
+ }
1524
+ if (r && e.label < r[2]) {
1525
+ e.label = r[2], e.ops.push(a);
1526
+ break;
1527
+ }
1528
+ r[2] && e.ops.pop(), e.trys.pop();
1529
+ continue;
1530
+ }
1531
+ a = n.call(t, e);
1532
+ } catch (c) {
1533
+ a = [6, c], o = 0;
1534
+ } finally {
1535
+ i = r = 0;
1536
+ }
1537
+ if (a[0] & 5) throw a[1];
1538
+ return { value: a[0] ? a[1] : void 0, done: !0 };
1539
+ }
1540
+ }
1541
+ function ee(t) {
1542
+ var n = typeof Symbol == "function" && Symbol.iterator, e = n && t[n], i = 0;
1543
+ if (e) return e.call(t);
1544
+ if (t && typeof t.length == "number") return {
1545
+ next: function() {
1546
+ return t && i >= t.length && (t = void 0), { value: t && t[i++], done: !t };
1547
+ }
1548
+ };
1549
+ throw new TypeError(n ? "Object is not iterable." : "Symbol.iterator is not defined.");
1550
+ }
1551
+ function Re(t, n) {
1552
+ var e = typeof Symbol == "function" && t[Symbol.iterator];
1553
+ if (!e) return t;
1554
+ var i = e.call(t), o, r = [], s;
1555
+ try {
1556
+ for (; (n === void 0 || n-- > 0) && !(o = i.next()).done; ) r.push(o.value);
1557
+ } catch (f) {
1558
+ s = { error: f };
1559
+ } finally {
1560
+ try {
1561
+ o && !o.done && (e = i.return) && e.call(i);
1562
+ } finally {
1563
+ if (s) throw s.error;
1564
+ }
1565
+ }
1566
+ return r;
1567
+ }
1568
+ function De(t, n, e) {
1569
+ if (e || arguments.length === 2) for (var i = 0, o = n.length, r; i < o; i++)
1570
+ (r || !(i in n)) && (r || (r = Array.prototype.slice.call(n, 0, i)), r[i] = n[i]);
1571
+ return t.concat(r || Array.prototype.slice.call(n));
1572
+ }
1573
+ function Y(t) {
1574
+ return this instanceof Y ? (this.v = t, this) : new Y(t);
1575
+ }
1576
+ function Nr(t, n, e) {
1577
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
1578
+ var i = e.apply(t, n || []), o, r = [];
1579
+ return o = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), f("next"), f("throw"), f("return", s), o[Symbol.asyncIterator] = function() {
1580
+ return this;
1581
+ }, o;
1582
+ function s(l) {
1583
+ return function(h) {
1584
+ return Promise.resolve(h).then(l, v);
1585
+ };
1586
+ }
1587
+ function f(l, h) {
1588
+ i[l] && (o[l] = function(w) {
1589
+ return new Promise(function(_, k) {
1590
+ r.push([l, w, _, k]) > 1 || u(l, w);
1591
+ });
1592
+ }, h && (o[l] = h(o[l])));
1593
+ }
1594
+ function u(l, h) {
1595
+ try {
1596
+ a(i[l](h));
1597
+ } catch (w) {
1598
+ d(r[0][3], w);
1599
+ }
1600
+ }
1601
+ function a(l) {
1602
+ l.value instanceof Y ? Promise.resolve(l.value.v).then(c, v) : d(r[0][2], l);
1603
+ }
1604
+ function c(l) {
1605
+ u("next", l);
1606
+ }
1607
+ function v(l) {
1608
+ u("throw", l);
1609
+ }
1610
+ function d(l, h) {
1611
+ l(h), r.shift(), r.length && u(r[0][0], r[0][1]);
1612
+ }
1613
+ }
1614
+ function Cr(t) {
1615
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
1616
+ var n = t[Symbol.asyncIterator], e;
1617
+ return n ? n.call(t) : (t = typeof ee == "function" ? ee(t) : t[Symbol.iterator](), e = {}, i("next"), i("throw"), i("return"), e[Symbol.asyncIterator] = function() {
1618
+ return this;
1619
+ }, e);
1620
+ function i(r) {
1621
+ e[r] = t[r] && function(s) {
1622
+ return new Promise(function(f, u) {
1623
+ s = t[r](s), o(f, u, s.done, s.value);
1624
+ });
1625
+ };
1626
+ }
1627
+ function o(r, s, f, u) {
1628
+ Promise.resolve(u).then(function(a) {
1629
+ r({ value: a, done: f });
1630
+ }, s);
1631
+ }
1632
+ }
1633
+ function R(t) {
1634
+ return typeof t == "function";
1635
+ }
1636
+ function Zt(t) {
1637
+ var n = function(i) {
1638
+ Error.call(i), i.stack = new Error().stack;
1639
+ }, e = t(n);
1640
+ return e.prototype = Object.create(Error.prototype), e.prototype.constructor = e, e;
1641
+ }
1642
+ var Ie = Zt(function(t) {
1643
+ return function(e) {
1644
+ t(this), this.message = e ? e.length + ` errors occurred during unsubscription:
1645
+ ` + e.map(function(i, o) {
1646
+ return o + 1 + ") " + i.toString();
1647
+ }).join(`
1648
+ `) : "", this.name = "UnsubscriptionError", this.errors = e;
1649
+ };
1650
+ });
1651
+ function bt(t, n) {
1652
+ if (t) {
1653
+ var e = t.indexOf(n);
1654
+ 0 <= e && t.splice(e, 1);
1655
+ }
1656
+ }
1657
+ var Ce = function() {
1658
+ function t(n) {
1659
+ this.initialTeardown = n, this.closed = !1, this._parentage = null, this._finalizers = null;
1660
+ }
1661
+ return t.prototype.unsubscribe = function() {
1662
+ var n, e, i, o, r;
1663
+ if (!this.closed) {
1664
+ this.closed = !0;
1665
+ var s = this._parentage;
1666
+ if (s)
1667
+ if (this._parentage = null, Array.isArray(s))
1668
+ try {
1669
+ for (var f = ee(s), u = f.next(); !u.done; u = f.next()) {
1670
+ var a = u.value;
1671
+ a.remove(this);
1672
+ }
1673
+ } catch (w) {
1674
+ n = { error: w };
1675
+ } finally {
1676
+ try {
1677
+ u && !u.done && (e = f.return) && e.call(f);
1678
+ } finally {
1679
+ if (n) throw n.error;
1680
+ }
1681
+ }
1682
+ else
1683
+ s.remove(this);
1684
+ var c = this.initialTeardown;
1685
+ if (R(c))
1686
+ try {
1687
+ c();
1688
+ } catch (w) {
1689
+ r = w instanceof Ie ? w.errors : [w];
1690
+ }
1691
+ var v = this._finalizers;
1692
+ if (v) {
1693
+ this._finalizers = null;
1694
+ try {
1695
+ for (var d = ee(v), l = d.next(); !l.done; l = d.next()) {
1696
+ var h = l.value;
1697
+ try {
1698
+ gt(h);
1699
+ } catch (w) {
1700
+ r = r ?? [], w instanceof Ie ? r = De(De([], Re(r)), Re(w.errors)) : r.push(w);
1701
+ }
1702
+ }
1703
+ } catch (w) {
1704
+ i = { error: w };
1705
+ } finally {
1706
+ try {
1707
+ l && !l.done && (o = d.return) && o.call(d);
1708
+ } finally {
1709
+ if (i) throw i.error;
1710
+ }
1711
+ }
1712
+ }
1713
+ if (r)
1714
+ throw new Ie(r);
1715
+ }
1716
+ }, t.prototype.add = function(n) {
1717
+ var e;
1718
+ if (n && n !== this)
1719
+ if (this.closed)
1720
+ gt(n);
1721
+ else {
1722
+ if (n instanceof t) {
1723
+ if (n.closed || n._hasParent(this))
1724
+ return;
1725
+ n._addParent(this);
1726
+ }
1727
+ (this._finalizers = (e = this._finalizers) !== null && e !== void 0 ? e : []).push(n);
1728
+ }
1729
+ }, t.prototype._hasParent = function(n) {
1730
+ var e = this._parentage;
1731
+ return e === n || Array.isArray(e) && e.includes(n);
1732
+ }, t.prototype._addParent = function(n) {
1733
+ var e = this._parentage;
1734
+ this._parentage = Array.isArray(e) ? (e.push(n), e) : e ? [e, n] : n;
1735
+ }, t.prototype._removeParent = function(n) {
1736
+ var e = this._parentage;
1737
+ e === n ? this._parentage = null : Array.isArray(e) && bt(e, n);
1738
+ }, t.prototype.remove = function(n) {
1739
+ var e = this._finalizers;
1740
+ e && bt(e, n), n instanceof t && n._removeParent(this);
1741
+ }, t.EMPTY = function() {
1742
+ var n = new t();
1743
+ return n.closed = !0, n;
1744
+ }(), t;
1745
+ }();
1746
+ Ce.EMPTY;
1747
+ function $t(t) {
1748
+ return t instanceof Ce || t && "closed" in t && R(t.remove) && R(t.add) && R(t.unsubscribe);
1749
+ }
1750
+ function gt(t) {
1751
+ R(t) ? t() : t.unsubscribe();
1752
+ }
1753
+ var Lr = {
1754
+ Promise: void 0
1755
+ }, Pr = {
1756
+ setTimeout: function(t, n) {
1757
+ for (var e = [], i = 2; i < arguments.length; i++)
1758
+ e[i - 2] = arguments[i];
1759
+ return setTimeout.apply(void 0, De([t, n], Re(e)));
1760
+ },
1761
+ clearTimeout: function(t) {
1762
+ return clearTimeout(t);
1763
+ },
1764
+ delegate: void 0
1765
+ };
1766
+ function Ht(t) {
1767
+ Pr.setTimeout(function() {
1768
+ throw t;
1769
+ });
1770
+ }
1771
+ function wt() {
1772
+ }
1773
+ function Fr(t) {
1774
+ t();
1775
+ }
1776
+ var Le = function(t) {
1777
+ Ne(n, t);
1778
+ function n(e) {
1779
+ var i = t.call(this) || this;
1780
+ return i.isStopped = !1, e ? (i.destination = e, $t(e) && e.add(i)) : i.destination = Zr, i;
1781
+ }
1782
+ return n.create = function(e, i, o) {
1783
+ return new fe(e, i, o);
1784
+ }, n.prototype.next = function(e) {
1785
+ this.isStopped || this._next(e);
1786
+ }, n.prototype.error = function(e) {
1787
+ this.isStopped || (this.isStopped = !0, this._error(e));
1788
+ }, n.prototype.complete = function() {
1789
+ this.isStopped || (this.isStopped = !0, this._complete());
1790
+ }, n.prototype.unsubscribe = function() {
1791
+ this.closed || (this.isStopped = !0, t.prototype.unsubscribe.call(this), this.destination = null);
1792
+ }, n.prototype._next = function(e) {
1793
+ this.destination.next(e);
1794
+ }, n.prototype._error = function(e) {
1795
+ try {
1796
+ this.destination.error(e);
1797
+ } finally {
1798
+ this.unsubscribe();
1799
+ }
1800
+ }, n.prototype._complete = function() {
1801
+ try {
1802
+ this.destination.complete();
1803
+ } finally {
1804
+ this.unsubscribe();
1805
+ }
1806
+ }, n;
1807
+ }(Ce), Mr = function() {
1808
+ function t(n) {
1809
+ this.partialObserver = n;
1810
+ }
1811
+ return t.prototype.next = function(n) {
1812
+ var e = this.partialObserver;
1813
+ if (e.next)
1814
+ try {
1815
+ e.next(n);
1816
+ } catch (i) {
1817
+ se(i);
1818
+ }
1819
+ }, t.prototype.error = function(n) {
1820
+ var e = this.partialObserver;
1821
+ if (e.error)
1822
+ try {
1823
+ e.error(n);
1824
+ } catch (i) {
1825
+ se(i);
1826
+ }
1827
+ else
1828
+ se(n);
1829
+ }, t.prototype.complete = function() {
1830
+ var n = this.partialObserver;
1831
+ if (n.complete)
1832
+ try {
1833
+ n.complete();
1834
+ } catch (e) {
1835
+ se(e);
1836
+ }
1837
+ }, t;
1838
+ }(), fe = function(t) {
1839
+ Ne(n, t);
1840
+ function n(e, i, o) {
1841
+ var r = t.call(this) || this, s;
1842
+ return R(e) || !e ? s = {
1843
+ next: e ?? void 0,
1844
+ error: i ?? void 0,
1845
+ complete: o ?? void 0
1846
+ } : s = e, r.destination = new Mr(s), r;
1847
+ }
1848
+ return n;
1849
+ }(Le);
1850
+ function se(t) {
1851
+ Ht(t);
1852
+ }
1853
+ function zr(t) {
1854
+ throw t;
1855
+ }
1856
+ var Zr = {
1857
+ closed: !0,
1858
+ next: wt,
1859
+ error: zr,
1860
+ complete: wt
1861
+ }, Pe = function() {
1862
+ return typeof Symbol == "function" && Symbol.observable || "@@observable";
1863
+ }();
1864
+ function Vt(t) {
1865
+ return t;
1866
+ }
1867
+ function $r(t) {
1868
+ return t.length === 0 ? Vt : t.length === 1 ? t[0] : function(e) {
1869
+ return t.reduce(function(i, o) {
1870
+ return o(i);
1871
+ }, e);
1872
+ };
1873
+ }
1874
+ var L = function() {
1875
+ function t(n) {
1876
+ n && (this._subscribe = n);
1877
+ }
1878
+ return t.prototype.lift = function(n) {
1879
+ var e = new t();
1880
+ return e.source = this, e.operator = n, e;
1881
+ }, t.prototype.subscribe = function(n, e, i) {
1882
+ var o = this, r = Vr(n) ? n : new fe(n, e, i);
1883
+ return Fr(function() {
1884
+ var s = o, f = s.operator, u = s.source;
1885
+ r.add(f ? f.call(r, u) : u ? o._subscribe(r) : o._trySubscribe(r));
1886
+ }), r;
1887
+ }, t.prototype._trySubscribe = function(n) {
1888
+ try {
1889
+ return this._subscribe(n);
1890
+ } catch (e) {
1891
+ n.error(e);
1892
+ }
1893
+ }, t.prototype.forEach = function(n, e) {
1894
+ var i = this;
1895
+ return e = mt(e), new e(function(o, r) {
1896
+ var s = new fe({
1897
+ next: function(f) {
1898
+ try {
1899
+ n(f);
1900
+ } catch (u) {
1901
+ r(u), s.unsubscribe();
1902
+ }
1903
+ },
1904
+ error: r,
1905
+ complete: o
1906
+ });
1907
+ i.subscribe(s);
1908
+ });
1909
+ }, t.prototype._subscribe = function(n) {
1910
+ var e;
1911
+ return (e = this.source) === null || e === void 0 ? void 0 : e.subscribe(n);
1912
+ }, t.prototype[Pe] = function() {
1913
+ return this;
1914
+ }, t.prototype.pipe = function() {
1915
+ for (var n = [], e = 0; e < arguments.length; e++)
1916
+ n[e] = arguments[e];
1917
+ return $r(n)(this);
1918
+ }, t.prototype.toPromise = function(n) {
1919
+ var e = this;
1920
+ return n = mt(n), new n(function(i, o) {
1921
+ var r;
1922
+ e.subscribe(function(s) {
1923
+ return r = s;
1924
+ }, function(s) {
1925
+ return o(s);
1926
+ }, function() {
1927
+ return i(r);
1928
+ });
1929
+ });
1930
+ }, t.create = function(n) {
1931
+ return new t(n);
1932
+ }, t;
1933
+ }();
1934
+ function mt(t) {
1935
+ var n;
1936
+ return (n = t ?? Lr.Promise) !== null && n !== void 0 ? n : Promise;
1937
+ }
1938
+ function Hr(t) {
1939
+ return t && R(t.next) && R(t.error) && R(t.complete);
1940
+ }
1941
+ function Vr(t) {
1942
+ return t && t instanceof Le || Hr(t) && $t(t);
1943
+ }
1944
+ function Gr(t) {
1945
+ return R(t == null ? void 0 : t.lift);
1946
+ }
1947
+ function W(t) {
1948
+ return function(n) {
1949
+ if (Gr(n))
1950
+ return n.lift(function(e) {
1951
+ try {
1952
+ return t(e, this);
1953
+ } catch (i) {
1954
+ this.error(i);
1955
+ }
1956
+ });
1957
+ throw new TypeError("Unable to lift unknown Observable type");
1958
+ };
1959
+ }
1960
+ function te(t, n, e, i, o) {
1961
+ return new jr(t, n, e, i, o);
1962
+ }
1963
+ var jr = function(t) {
1964
+ Ne(n, t);
1965
+ function n(e, i, o, r, s, f) {
1966
+ var u = t.call(this, e) || this;
1967
+ return u.onFinalize = s, u.shouldUnsubscribe = f, u._next = i ? function(a) {
1968
+ try {
1969
+ i(a);
1970
+ } catch (c) {
1971
+ e.error(c);
1972
+ }
1973
+ } : t.prototype._next, u._error = r ? function(a) {
1974
+ try {
1975
+ r(a);
1976
+ } catch (c) {
1977
+ e.error(c);
1978
+ } finally {
1979
+ this.unsubscribe();
1980
+ }
1981
+ } : t.prototype._error, u._complete = o ? function() {
1982
+ try {
1983
+ o();
1984
+ } catch (a) {
1985
+ e.error(a);
1986
+ } finally {
1987
+ this.unsubscribe();
1988
+ }
1989
+ } : t.prototype._complete, u;
1990
+ }
1991
+ return n.prototype.unsubscribe = function() {
1992
+ var e;
1993
+ if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
1994
+ var i = this.closed;
1995
+ t.prototype.unsubscribe.call(this), !i && ((e = this.onFinalize) === null || e === void 0 || e.call(this));
1996
+ }
1997
+ }, n;
1998
+ }(Le), Yr = new L(function(t) {
1999
+ return t.complete();
2000
+ });
2001
+ function Kr(t) {
2002
+ return t && R(t.schedule);
2003
+ }
2004
+ function Gt(t) {
2005
+ return t[t.length - 1];
2006
+ }
2007
+ function Wr(t) {
2008
+ return Kr(Gt(t)) ? t.pop() : void 0;
2009
+ }
2010
+ function Xr(t, n) {
2011
+ return typeof Gt(t) == "number" ? t.pop() : n;
2012
+ }
2013
+ var jt = function(t) {
2014
+ return t && typeof t.length == "number" && typeof t != "function";
2015
+ };
2016
+ function Yt(t) {
2017
+ return R(t == null ? void 0 : t.then);
2018
+ }
2019
+ function Kt(t) {
2020
+ return R(t[Pe]);
2021
+ }
2022
+ function Wt(t) {
2023
+ return Symbol.asyncIterator && R(t == null ? void 0 : t[Symbol.asyncIterator]);
2024
+ }
2025
+ function Xt(t) {
2026
+ return new TypeError("You provided " + (t !== null && typeof t == "object" ? "an invalid object" : "'" + t + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
2027
+ }
2028
+ function Jr() {
2029
+ return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
2030
+ }
2031
+ var Jt = Jr();
2032
+ function Qt(t) {
2033
+ return R(t == null ? void 0 : t[Jt]);
2034
+ }
2035
+ function qt(t) {
2036
+ return Nr(this, arguments, function() {
2037
+ var e, i, o, r;
2038
+ return zt(this, function(s) {
2039
+ switch (s.label) {
2040
+ case 0:
2041
+ e = t.getReader(), s.label = 1;
2042
+ case 1:
2043
+ s.trys.push([1, , 9, 10]), s.label = 2;
2044
+ case 2:
2045
+ return [4, Y(e.read())];
2046
+ case 3:
2047
+ return i = s.sent(), o = i.value, r = i.done, r ? [4, Y(void 0)] : [3, 5];
2048
+ case 4:
2049
+ return [2, s.sent()];
2050
+ case 5:
2051
+ return [4, Y(o)];
2052
+ case 6:
2053
+ return [4, s.sent()];
2054
+ case 7:
2055
+ return s.sent(), [3, 2];
2056
+ case 8:
2057
+ return [3, 10];
2058
+ case 9:
2059
+ return e.releaseLock(), [7];
2060
+ case 10:
2061
+ return [2];
2062
+ }
2063
+ });
2064
+ });
2065
+ }
2066
+ function en(t) {
2067
+ return R(t == null ? void 0 : t.getReader);
2068
+ }
2069
+ function X(t) {
2070
+ if (t instanceof L)
2071
+ return t;
2072
+ if (t != null) {
2073
+ if (Kt(t))
2074
+ return Qr(t);
2075
+ if (jt(t))
2076
+ return qr(t);
2077
+ if (Yt(t))
2078
+ return ei(t);
2079
+ if (Wt(t))
2080
+ return tn(t);
2081
+ if (Qt(t))
2082
+ return ti(t);
2083
+ if (en(t))
2084
+ return ni(t);
2085
+ }
2086
+ throw Xt(t);
2087
+ }
2088
+ function Qr(t) {
2089
+ return new L(function(n) {
2090
+ var e = t[Pe]();
2091
+ if (R(e.subscribe))
2092
+ return e.subscribe(n);
2093
+ throw new TypeError("Provided object does not correctly implement Symbol.observable");
2094
+ });
2095
+ }
2096
+ function qr(t) {
2097
+ return new L(function(n) {
2098
+ for (var e = 0; e < t.length && !n.closed; e++)
2099
+ n.next(t[e]);
2100
+ n.complete();
2101
+ });
2102
+ }
2103
+ function ei(t) {
2104
+ return new L(function(n) {
2105
+ t.then(function(e) {
2106
+ n.closed || (n.next(e), n.complete());
2107
+ }, function(e) {
2108
+ return n.error(e);
2109
+ }).then(null, Ht);
2110
+ });
2111
+ }
2112
+ function ti(t) {
2113
+ return new L(function(n) {
2114
+ var e, i;
2115
+ try {
2116
+ for (var o = ee(t), r = o.next(); !r.done; r = o.next()) {
2117
+ var s = r.value;
2118
+ if (n.next(s), n.closed)
2119
+ return;
2120
+ }
2121
+ } catch (f) {
2122
+ e = { error: f };
2123
+ } finally {
2124
+ try {
2125
+ r && !r.done && (i = o.return) && i.call(o);
2126
+ } finally {
2127
+ if (e) throw e.error;
2128
+ }
2129
+ }
2130
+ n.complete();
2131
+ });
2132
+ }
2133
+ function tn(t) {
2134
+ return new L(function(n) {
2135
+ ri(t, n).catch(function(e) {
2136
+ return n.error(e);
2137
+ });
2138
+ });
2139
+ }
2140
+ function ni(t) {
2141
+ return tn(qt(t));
2142
+ }
2143
+ function ri(t, n) {
2144
+ var e, i, o, r;
2145
+ return Dr(this, void 0, void 0, function() {
2146
+ var s, f;
2147
+ return zt(this, function(u) {
2148
+ switch (u.label) {
2149
+ case 0:
2150
+ u.trys.push([0, 5, 6, 11]), e = Cr(t), u.label = 1;
2151
+ case 1:
2152
+ return [4, e.next()];
2153
+ case 2:
2154
+ if (i = u.sent(), !!i.done) return [3, 4];
2155
+ if (s = i.value, n.next(s), n.closed)
2156
+ return [2];
2157
+ u.label = 3;
2158
+ case 3:
2159
+ return [3, 1];
2160
+ case 4:
2161
+ return [3, 11];
2162
+ case 5:
2163
+ return f = u.sent(), o = { error: f }, [3, 11];
2164
+ case 6:
2165
+ return u.trys.push([6, , 9, 10]), i && !i.done && (r = e.return) ? [4, r.call(e)] : [3, 8];
2166
+ case 7:
2167
+ u.sent(), u.label = 8;
2168
+ case 8:
2169
+ return [3, 10];
2170
+ case 9:
2171
+ if (o) throw o.error;
2172
+ return [7];
2173
+ case 10:
2174
+ return [7];
2175
+ case 11:
2176
+ return n.complete(), [2];
2177
+ }
2178
+ });
2179
+ });
2180
+ }
2181
+ function $(t, n, e, i, o) {
2182
+ i === void 0 && (i = 0), o === void 0 && (o = !1);
2183
+ var r = n.schedule(function() {
2184
+ e(), o ? t.add(this.schedule(null, i)) : this.unsubscribe();
2185
+ }, i);
2186
+ if (t.add(r), !o)
2187
+ return r;
2188
+ }
2189
+ function nn(t, n) {
2190
+ return n === void 0 && (n = 0), W(function(e, i) {
2191
+ e.subscribe(te(i, function(o) {
2192
+ return $(i, t, function() {
2193
+ return i.next(o);
2194
+ }, n);
2195
+ }, function() {
2196
+ return $(i, t, function() {
2197
+ return i.complete();
2198
+ }, n);
2199
+ }, function(o) {
2200
+ return $(i, t, function() {
2201
+ return i.error(o);
2202
+ }, n);
2203
+ }));
2204
+ });
2205
+ }
2206
+ function rn(t, n) {
2207
+ return n === void 0 && (n = 0), W(function(e, i) {
2208
+ i.add(t.schedule(function() {
2209
+ return e.subscribe(i);
2210
+ }, n));
2211
+ });
2212
+ }
2213
+ function ii(t, n) {
2214
+ return X(t).pipe(rn(n), nn(n));
2215
+ }
2216
+ function oi(t, n) {
2217
+ return X(t).pipe(rn(n), nn(n));
2218
+ }
2219
+ function ai(t, n) {
2220
+ return new L(function(e) {
2221
+ var i = 0;
2222
+ return n.schedule(function() {
2223
+ i === t.length ? e.complete() : (e.next(t[i++]), e.closed || this.schedule());
2224
+ });
2225
+ });
2226
+ }
2227
+ function si(t, n) {
2228
+ return new L(function(e) {
2229
+ var i;
2230
+ return $(e, n, function() {
2231
+ i = t[Jt](), $(e, n, function() {
2232
+ var o, r, s;
2233
+ try {
2234
+ o = i.next(), r = o.value, s = o.done;
2235
+ } catch (f) {
2236
+ e.error(f);
2237
+ return;
2238
+ }
2239
+ s ? e.complete() : e.next(r);
2240
+ }, 0, !0);
2241
+ }), function() {
2242
+ return R(i == null ? void 0 : i.return) && i.return();
2243
+ };
2244
+ });
2245
+ }
2246
+ function on(t, n) {
2247
+ if (!t)
2248
+ throw new Error("Iterable cannot be null");
2249
+ return new L(function(e) {
2250
+ $(e, n, function() {
2251
+ var i = t[Symbol.asyncIterator]();
2252
+ $(e, n, function() {
2253
+ i.next().then(function(o) {
2254
+ o.done ? e.complete() : e.next(o.value);
2255
+ });
2256
+ }, 0, !0);
2257
+ });
2258
+ });
2259
+ }
2260
+ function ci(t, n) {
2261
+ return on(qt(t), n);
2262
+ }
2263
+ function fi(t, n) {
2264
+ if (t != null) {
2265
+ if (Kt(t))
2266
+ return ii(t, n);
2267
+ if (jt(t))
2268
+ return ai(t, n);
2269
+ if (Yt(t))
2270
+ return oi(t, n);
2271
+ if (Wt(t))
2272
+ return on(t, n);
2273
+ if (Qt(t))
2274
+ return si(t, n);
2275
+ if (en(t))
2276
+ return ci(t, n);
2277
+ }
2278
+ throw Xt(t);
2279
+ }
2280
+ function li(t, n) {
2281
+ return n ? fi(t, n) : X(t);
2282
+ }
2283
+ var ui = Zt(function(t) {
2284
+ return function() {
2285
+ t(this), this.name = "EmptyError", this.message = "no elements in sequence";
2286
+ };
2287
+ });
2288
+ function an(t, n) {
2289
+ return new Promise(function(e, i) {
2290
+ var o = new fe({
2291
+ next: function(r) {
2292
+ e(r), o.unsubscribe();
2293
+ },
2294
+ error: i,
2295
+ complete: function() {
2296
+ i(new ui());
2297
+ }
2298
+ });
2299
+ t.subscribe(o);
2300
+ });
2301
+ }
2302
+ function sn(t, n) {
2303
+ return W(function(e, i) {
2304
+ var o = 0;
2305
+ e.subscribe(te(i, function(r) {
2306
+ i.next(t.call(n, r, o++));
2307
+ }));
2308
+ });
2309
+ }
2310
+ function hi(t, n, e, i, o, r, s, f) {
2311
+ var u = [], a = 0, c = 0, v = !1, d = function() {
2312
+ v && !u.length && !a && n.complete();
2313
+ }, l = function(w) {
2314
+ return a < i ? h(w) : u.push(w);
2315
+ }, h = function(w) {
2316
+ a++;
2317
+ var _ = !1;
2318
+ X(e(w, c++)).subscribe(te(n, function(k) {
2319
+ n.next(k);
2320
+ }, function() {
2321
+ _ = !0;
2322
+ }, void 0, function() {
2323
+ if (_)
2324
+ try {
2325
+ a--;
2326
+ for (var k = function() {
2327
+ var x = u.shift();
2328
+ s || h(x);
2329
+ }; u.length && a < i; )
2330
+ k();
2331
+ d();
2332
+ } catch (x) {
2333
+ n.error(x);
2334
+ }
2335
+ }));
2336
+ };
2337
+ return t.subscribe(te(n, l, function() {
2338
+ v = !0, d();
2339
+ })), function() {
2340
+ };
2341
+ }
2342
+ function cn(t, n, e) {
2343
+ return e === void 0 && (e = 1 / 0), R(n) ? cn(function(i, o) {
2344
+ return sn(function(r, s) {
2345
+ return n(i, r, o, s);
2346
+ })(X(t(i, o)));
2347
+ }, e) : (typeof n == "number" && (e = n), W(function(i, o) {
2348
+ return hi(i, o, t, e);
2349
+ }));
2350
+ }
2351
+ function di(t) {
2352
+ return t === void 0 && (t = 1 / 0), cn(Vt, t);
2353
+ }
2354
+ function bi() {
2355
+ for (var t = [], n = 0; n < arguments.length; n++)
2356
+ t[n] = arguments[n];
2357
+ var e = Wr(t), i = Xr(t, 1 / 0), o = t;
2358
+ return o.length ? o.length === 1 ? X(o[0]) : di(i)(li(o, e)) : Yr;
2359
+ }
2360
+ function gi(t, n, e, i, o) {
2361
+ return function(r, s) {
2362
+ var f = e, u = n, a = 0;
2363
+ r.subscribe(te(s, function(c) {
2364
+ var v = a++;
2365
+ u = f ? t(u, c, v) : (f = !0, c);
2366
+ }, function() {
2367
+ f && s.next(u), s.complete();
2368
+ }));
2369
+ };
2370
+ }
2371
+ function fn(t, n) {
2372
+ return W(gi(t, n, arguments.length >= 2, !1, !0));
2373
+ }
2374
+ var wi = function(t, n) {
2375
+ return t.push(n), t;
2376
+ };
2377
+ function mi() {
2378
+ return W(function(t, n) {
2379
+ fn(wi, [])(t).subscribe(n);
2380
+ });
2381
+ }
2382
+ const yt = -2003829722, Oe = -2021002517;
2383
+ class ln {
2384
+ getHeader(n) {
2385
+ return this.headerP || (this.headerP = this._getHeader(n).catch((e) => {
2386
+ throw this.headerP = void 0, e;
2387
+ })), this.headerP;
2388
+ }
2389
+ /*
2390
+ * @param filehandle - a filehandle from generic-filehandle or implementing
2391
+ * something similar to the node10 fs.promises API
2392
+ *
2393
+ * @param path - a Local file path as a string
2394
+ *
2395
+ * @param url - a URL string
2396
+ *
2397
+ * @param renameRefSeqs - an optional method to rename the internal reference
2398
+ * sequences using a mapping function
2399
+ */
2400
+ constructor(n) {
2401
+ const { filehandle: e, renameRefSeqs: i = (s) => s, path: o, url: r } = n;
2402
+ if (this.renameRefSeqs = i, e)
2403
+ this.bbi = e;
2404
+ else if (r)
2405
+ this.bbi = new hn(r);
2406
+ else if (o)
2407
+ this.bbi = new un(o);
2408
+ else
2409
+ throw new Error("no file given");
2410
+ }
2411
+ async _getHeader(n) {
2412
+ const e = await this._getMainHeader(n), i = await this._readChromTree(e, n);
2413
+ return { ...e, ...i };
2414
+ }
2415
+ async _getMainHeader(n, e = 2e3) {
2416
+ const { buffer: o } = await this.bbi.read(z.Buffer.alloc(e), 0, e, 0, n), r = this._isBigEndian(o), s = o, f = new DataView(s.buffer, s.byteOffset, s.length);
2417
+ let u = 0;
2418
+ const a = f.getInt32(u, !0);
2419
+ u += 4;
2420
+ const c = f.getUint16(u, !0);
2421
+ u += 2;
2422
+ const v = f.getUint16(u, !0);
2423
+ u += 2;
2424
+ const d = Number(f.getBigUint64(u, !0));
2425
+ u += 8;
2426
+ const l = Number(f.getBigUint64(u, !0));
2427
+ u += 8;
2428
+ const h = Number(f.getBigUint64(u, !0));
2429
+ u += 8;
2430
+ const w = f.getUint16(u, !0);
2431
+ u += 2;
2432
+ const _ = f.getUint16(u, !0);
2433
+ u += 2;
2434
+ const k = Number(f.getBigUint64(u, !0));
2435
+ u += 8;
2436
+ const x = Number(f.getBigUint64(u, !0));
2437
+ u += 8;
2438
+ const I = f.getUint32(u, !0);
2439
+ u += 4;
2440
+ const g = Number(f.getBigUint64(u, !0));
2441
+ u += 8;
2442
+ const E = [];
2443
+ for (let S = 0; S < v; S++) {
2444
+ const b = f.getUint32(u, !0);
2445
+ u += 4;
2446
+ const p = f.getUint32(u, !0);
2447
+ u += 4;
2448
+ const y = Number(f.getBigUint64(u, !0));
2449
+ u += 8;
2450
+ const T = Number(f.getBigUint64(u, !0));
2451
+ u += 8, E.push({ reductionLevel: b, reserved: p, dataOffset: y, indexOffset: T });
2452
+ }
2453
+ const O = a === Oe ? "bigbed" : "bigwig";
2454
+ if (k > e || x > e - 8 * 5)
2455
+ return this._getMainHeader(n, e * 2);
2456
+ let m;
2457
+ if (x) {
2458
+ const S = o.subarray(Number(x));
2459
+ let b = 0;
2460
+ const p = new DataView(S.buffer, S.byteOffset, S.length), y = Number(p.getBigUint64(b, !0));
2461
+ b += 8;
2462
+ const T = p.getFloat64(b, !0);
2463
+ b += 8;
2464
+ const D = p.getFloat64(b, !0);
2465
+ b += 8;
2466
+ const U = p.getFloat64(b, !0);
2467
+ b += 8;
2468
+ const B = p.getFloat64(b, !0);
2469
+ b += 8, m = {
2470
+ scoreMin: T,
2471
+ scoreMax: D,
2472
+ scoreSum: U,
2473
+ scoreSumSquares: B,
2474
+ basesCovered: y
2475
+ };
2476
+ } else
2477
+ throw new Error("no stats");
2478
+ return {
2479
+ zoomLevels: E,
2480
+ magic: a,
2481
+ extHeaderOffset: g,
2482
+ numZoomLevels: v,
2483
+ fieldCount: w,
2484
+ totalSummary: m,
2485
+ definedFieldCount: _,
2486
+ uncompressBufSize: I,
2487
+ asOffset: k,
2488
+ chromTreeOffset: d,
2489
+ totalSummaryOffset: x,
2490
+ unzoomedDataOffset: l,
2491
+ unzoomedIndexOffset: h,
2492
+ fileType: O,
2493
+ version: c,
2494
+ isBigEndian: r,
2495
+ autoSql: k ? o.subarray(k, o.indexOf(0, k)).toString() : ""
2496
+ };
2497
+ }
2498
+ _isBigEndian(n) {
2499
+ let e = n.readInt32LE(0);
2500
+ if (e === yt || e === Oe)
2501
+ return !1;
2502
+ if (e = n.readInt32BE(0), e === yt || e === Oe)
2503
+ return !0;
2504
+ throw new Error("not a BigWig/BigBed file");
2505
+ }
2506
+ // todo: add progress if long running
2507
+ async _readChromTree(n, e) {
2508
+ const o = !n.isBigEndian, r = [], s = {};
2509
+ let f = n.unzoomedDataOffset;
2510
+ const u = n.chromTreeOffset;
2511
+ for (; f % 4 !== 0; )
2512
+ f += 1;
2513
+ const a = f - u, { buffer: c } = await this.bbi.read(z.Buffer.alloc(a), 0, a, Number(u), e), v = c, d = new DataView(v.buffer, v.byteOffset, v.length);
2514
+ let l = 0;
2515
+ l += 4, l += 4;
2516
+ const h = d.getUint32(l, o);
2517
+ l += 4, l += 4, l += 8;
2518
+ const w = 32, _ = async (k) => {
2519
+ let x = k;
2520
+ if (x >= c.length)
2521
+ throw new Error("reading beyond end of buffer");
2522
+ const I = d.getUint8(x);
2523
+ x += 2;
2524
+ const g = d.getUint16(x, o);
2525
+ if (x += 2, I)
2526
+ for (let E = 0; E < g; E++) {
2527
+ const O = c.subarray(x, x + h).toString().replaceAll("\0", "");
2528
+ x += h;
2529
+ const m = d.getUint32(x, o);
2530
+ x += 4;
2531
+ const S = d.getUint32(x, o);
2532
+ x += 4;
2533
+ const b = { name: O, id: m, length: S };
2534
+ s[this.renameRefSeqs(O)] = m, r[m] = b;
2535
+ }
2536
+ else {
2537
+ const E = [];
2538
+ for (let O = 0; O < g; O++) {
2539
+ x += h;
2540
+ const m = Number(d.getBigUint64(x, o));
2541
+ x += 8, E.push(_(Number(m) - Number(u)));
2542
+ }
2543
+ await Promise.all(E);
2544
+ }
2545
+ };
2546
+ return await _(w), {
2547
+ refsByName: s,
2548
+ refsByNumber: r
2549
+ };
2550
+ }
2551
+ /*
2552
+ * fetches the "unzoomed" view of the bigwig data. this is the default for bigbed
2553
+ * @param abortSignal - a signal to optionally abort this operation
2554
+ */
2555
+ async getUnzoomedView(n) {
2556
+ const { unzoomedIndexOffset: e, refsByName: i, uncompressBufSize: o, isBigEndian: r, fileType: s } = await this.getHeader(n);
2557
+ return new Mt(this.bbi, i, e, r, o > 0, s);
2558
+ }
2559
+ /**
2560
+ * Gets features from a BigWig file
2561
+ *
2562
+ * @param refName - The chromosome name
2563
+ * @param start - The start of a region
2564
+ * @param end - The end of a region
2565
+ * @param opts - An object containing basesPerSpan (e.g. pixels per basepair) or scale used to infer the zoomLevel to use
2566
+ */
2567
+ async getFeatureStream(n, e, i, o) {
2568
+ await this.getHeader(o);
2569
+ const r = this.renameRefSeqs(n);
2570
+ let s;
2571
+ const { basesPerSpan: f, scale: u } = o || {};
2572
+ return f ? s = await this.getView(1 / f, o) : u ? s = await this.getView(u, o) : s = await this.getView(1, o), new L((a) => {
2573
+ s.readWigData(r, e, i, a, o).catch((c) => {
2574
+ a.error(c);
2575
+ });
2576
+ });
2577
+ }
2578
+ async getFeatures(n, e, i, o) {
2579
+ const r = await this.getFeatureStream(n, e, i, o);
2580
+ return (await an(r.pipe(mi()))).flat();
2581
+ }
2582
+ }
2583
+ class xi extends ln {
2584
+ /**
2585
+ * Retrieves a BlockView of a specific zoomLevel
2586
+ *
2587
+ * @param scale - number
2588
+ *
2589
+ * @param opts - An object containing basesPerSpan (e.g. pixels per basepair)
2590
+ * or scale used to infer the zoomLevel to use
2591
+ */
2592
+ async getView(n, e) {
2593
+ const { zoomLevels: i, refsByName: o, isBigEndian: r, uncompressBufSize: s } = await this.getHeader(e), f = 1 / n, u = i.length - 1;
2594
+ for (let a = u; a >= 0; a -= 1) {
2595
+ const c = i[a];
2596
+ if (c && c.reductionLevel <= 2 * f)
2597
+ return new Mt(this.bbi, o, c.indexOffset, r, s > 0, "summary");
2598
+ }
2599
+ return this.getUnzoomedView(e);
2600
+ }
2601
+ }
2602
+ function yi(t) {
2603
+ return t.filter((n) => !!n);
2604
+ }
2605
+ class Ei extends ln {
2606
+ constructor() {
2607
+ super(...arguments), this.readIndicesCache = new pt({
2608
+ cache: new vt({ maxSize: 1 }),
2609
+ fill: (n, e) => this._readIndices({ ...n, signal: e })
2610
+ });
2611
+ }
2612
+ readIndices(n = {}) {
2613
+ const { signal: e, ...i } = n;
2614
+ return this.readIndicesCache.get(JSON.stringify(i), n, e);
2615
+ }
2616
+ /*
2617
+ * retrieve unzoomed view for any scale
2618
+ */
2619
+ async getView(n, e) {
2620
+ return this.getUnzoomedView(e);
2621
+ }
2622
+ /*
2623
+ * parse the bigbed extraIndex fields
2624
+ *
2625
+ *
2626
+ * @return a Promise for an array of Index data structure since there can be
2627
+ * multiple extraIndexes in a bigbed, see bedToBigBed documentation
2628
+ */
2629
+ async _readIndices(n) {
2630
+ const { extHeaderOffset: e, isBigEndian: i } = await this.getHeader(n), { buffer: o } = await this.bbi.read(z.Buffer.alloc(64), 0, 64, Number(e)), r = !i, s = o, f = new DataView(s.buffer, s.byteOffset, s.length);
2631
+ let u = 0;
2632
+ u += 2;
2633
+ const a = f.getUint16(u, r);
2634
+ u += 2;
2635
+ const c = Number(f.getBigUint64(u, r));
2636
+ if (u += 8, a === 0)
2637
+ return [];
2638
+ const v = 20, d = v * a, { buffer: l } = await this.bbi.read(z.Buffer.alloc(d), 0, d, Number(c)), h = [];
2639
+ for (let w = 0; w < a; w += 1) {
2640
+ const _ = l.subarray(w * v), k = new DataView(_.buffer, _.byteOffset, _.length);
2641
+ let x = 0;
2642
+ const I = k.getInt16(x, r);
2643
+ x += 2;
2644
+ const g = k.getInt16(x, r);
2645
+ x += 2;
2646
+ const E = Number(k.getBigUint64(x, r));
2647
+ x += 12;
2648
+ const O = k.getInt16(x, r);
2649
+ h.push({ type: I, fieldcount: g, offset: Number(E), field: O });
2650
+ }
2651
+ return h;
2652
+ }
2653
+ /*
2654
+ * perform a search in the bigbed extraIndex to find which blocks in the
2655
+ * bigbed data to look for the actual feature data
2656
+ *
2657
+ * @param name - the name to search for
2658
+ * @param opts - a SearchOptions argument with optional signal
2659
+ * @return a Promise for an array of bigbed block Loc entries
2660
+ */
2661
+ async searchExtraIndexBlocks(n, e = {}) {
2662
+ const { isBigEndian: i } = await this.getHeader(e), o = await this.readIndices(e);
2663
+ if (o.length === 0)
2664
+ return [];
2665
+ const r = o.map(async (s) => {
2666
+ const { offset: f, field: u } = s, { buffer: a } = await this.bbi.read(z.Buffer.alloc(32), 0, 32, f, e), c = !i, v = a, d = new DataView(v.buffer, v.byteOffset, v.length);
2667
+ let l = 0;
2668
+ l += 4;
2669
+ const h = d.getInt32(l, c);
2670
+ l += 4;
2671
+ const w = d.getInt32(l, c);
2672
+ l += 4;
2673
+ const _ = d.getInt32(l, c);
2674
+ l += 4, l += 8;
2675
+ const k = async (I) => {
2676
+ const g = Number(I), E = 4 + h * (w + _), { buffer: O } = await this.bbi.read(z.Buffer.alloc(E), 0, E, g, e), m = O, S = new DataView(m.buffer, m.byteOffset, m.length);
2677
+ let b = 0;
2678
+ const p = S.getInt8(b);
2679
+ b += 2;
2680
+ const y = S.getInt16(b, c);
2681
+ b += 2;
2682
+ const T = [];
2683
+ if (p === 0) {
2684
+ const D = [];
2685
+ for (let B = 0; B < y; B++) {
2686
+ const N = m.subarray(b, b + w).toString().replaceAll("\0", "");
2687
+ b += w;
2688
+ const Z = Number(S.getBigUint64(b, c));
2689
+ b += 8, D.push({ key: N, offset: Z });
2690
+ }
2691
+ let U = 0;
2692
+ for (const { key: B, offset: N } of D) {
2693
+ if (n.localeCompare(B) < 0 && U)
2694
+ return k(U);
2695
+ U = N;
2696
+ }
2697
+ return k(U);
2698
+ } else if (p === 1) {
2699
+ for (let D = 0; D < y; D++) {
2700
+ const U = m.subarray(b, b + w).toString().replaceAll("\0", "");
2701
+ b += w;
2702
+ const B = Number(S.getBigUint64(b, c));
2703
+ b += 8;
2704
+ const N = S.getUint32(b, c);
2705
+ b += 4;
2706
+ const Z = S.getUint32(b, c);
2707
+ b += 4, T.push({ key: U, offset: B, length: N, reserved: Z });
2708
+ }
2709
+ for (const D of T)
2710
+ if (D.key === n)
2711
+ return { ...D, field: u };
2712
+ return;
2713
+ }
2714
+ };
2715
+ return k(f + 32);
2716
+ });
2717
+ return yi(await Promise.all(r));
2718
+ }
2719
+ /*
2720
+ * retrieve the features from the bigbed data that were found through the
2721
+ * lookup of the extraIndex note that there can be multiple extraIndex, see
2722
+ * the BigBed specification and the -extraIndex argument to bedToBigBed
2723
+ *
2724
+ * @param name - the name to search for
2725
+ * @param opts - a SearchOptions argument with optional signal
2726
+ * @return a Promise for an array of Feature
2727
+ */
2728
+ async searchExtraIndex(n, e = {}) {
2729
+ const i = await this.searchExtraIndexBlocks(n, e);
2730
+ if (i.length === 0)
2731
+ return [];
2732
+ const o = await this.getUnzoomedView(e), r = i.map((f) => new L((u) => {
2733
+ o.readFeatures(u, [f], e).catch((a) => {
2734
+ u.error(a);
2735
+ });
2736
+ }).pipe(fn((u, a) => u.concat(a)), sn((u) => {
2737
+ for (const a of u)
2738
+ a.field = f.field;
2739
+ return u;
2740
+ })));
2741
+ return (await an(bi(...r))).filter((f) => {
2742
+ var u;
2743
+ return ((u = f.rest) === null || u === void 0 ? void 0 : u.split(" ")[(f.field || 0) - 3]) === n;
2744
+ });
2745
+ }
2746
+ }
2747
+ export {
2748
+ Ei as BigBed,
2749
+ xi as BigWig
2750
+ };