@genome-spy/core 0.69.0 → 0.70.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 (46) hide show
  1. package/dist/bundle/{AbortablePromiseCache-CcuMrnn7.js → AbortablePromiseCache-Dj0vzLnp.js} +4 -4
  2. package/dist/bundle/{browser-BRemItdO.js → browser-0iNU5Wit.js} +33 -33
  3. package/dist/bundle/index-BYsZN7b0.js +1597 -0
  4. package/dist/bundle/{index-Cq3QFUxX.js → index-C3kClAEN.js} +583 -593
  5. package/dist/bundle/{index-D-w7Mmt9.js → index-C7wOh6y1.js} +138 -140
  6. package/dist/bundle/index-CRaQAuki.js +326 -0
  7. package/dist/bundle/{index-D74H8TTz.js → index-D9v1PCj9.js} +1 -2
  8. package/dist/bundle/{index-BatuyGAI.js → index-GDOuv_D5.js} +75 -80
  9. package/dist/bundle/{index-DbJ0oeYM.js → index-Gt44EOIH.js} +160 -163
  10. package/dist/bundle/index.es.js +8802 -9058
  11. package/dist/bundle/index.js +123 -165
  12. package/dist/bundle/{unzip-NywezaRR.js → unzip-Bac01w6X.js} +1 -1
  13. package/dist/src/gl/colorUtils.d.ts +2 -1
  14. package/dist/src/gl/colorUtils.d.ts.map +1 -1
  15. package/dist/src/gl/colorUtils.js +15 -3
  16. package/dist/src/gl/colorUtils.test.d.ts +2 -0
  17. package/dist/src/gl/colorUtils.test.d.ts.map +1 -0
  18. package/dist/src/gl/webGLHelper.d.ts.map +1 -1
  19. package/dist/src/gl/webGLHelper.js +2 -1
  20. package/dist/src/index.d.ts.map +1 -1
  21. package/dist/src/index.js +2 -5
  22. package/dist/src/marks/mark.d.ts +0 -2
  23. package/dist/src/marks/mark.d.ts.map +1 -1
  24. package/dist/src/marks/mark.js +0 -8
  25. package/dist/src/marks/rect.d.ts.map +1 -1
  26. package/dist/src/marks/rect.js +0 -8
  27. package/dist/src/utils/deepEqual.d.ts +14 -0
  28. package/dist/src/utils/deepEqual.d.ts.map +1 -0
  29. package/dist/src/utils/deepEqual.js +63 -0
  30. package/dist/src/utils/deepEqual.test.d.ts +2 -0
  31. package/dist/src/utils/deepEqual.test.d.ts.map +1 -0
  32. package/dist/src/utils/fetchUtils.d.ts +27 -0
  33. package/dist/src/utils/fetchUtils.d.ts.map +1 -0
  34. package/dist/src/utils/fetchUtils.js +47 -0
  35. package/dist/src/utils/fetchUtils.test.d.ts +2 -0
  36. package/dist/src/utils/fetchUtils.test.d.ts.map +1 -0
  37. package/dist/src/utils/url.d.ts +12 -0
  38. package/dist/src/utils/url.d.ts.map +1 -1
  39. package/dist/src/utils/url.js +45 -0
  40. package/dist/src/view/view.d.ts.map +1 -1
  41. package/dist/src/view/view.js +24 -6
  42. package/dist/src/view/viewUtils.d.ts.map +1 -1
  43. package/dist/src/view/viewUtils.js +4 -5
  44. package/package.json +2 -2
  45. package/dist/bundle/index-ByuE8dvu.js +0 -332
  46. package/dist/bundle/index-D28m8tSW.js +0 -1607
@@ -0,0 +1,326 @@
1
+ const _ = /%([0-9A-Fa-f]{2})/g, b = /^\s*##\s*(\S+)\s*(.*)/, C = /\r?\n$/, p = /\s+/, m = /\D/g;
2
+ function f(n) {
3
+ return n.includes("%") ? n.replaceAll(_, (e, r) => String.fromCharCode(parseInt(r, 16))) : n;
4
+ }
5
+ function v(n) {
6
+ if (!n.length || n === ".")
7
+ return {};
8
+ const e = {};
9
+ let r = n;
10
+ r.endsWith(`
11
+ `) && (r = r.slice(0, r.endsWith(`\r
12
+ `) ? -2 : -1));
13
+ for (const t of r.split(";")) {
14
+ const i = t.indexOf("=");
15
+ if (i === -1)
16
+ continue;
17
+ const s = t.slice(i + 1);
18
+ if (!s.length)
19
+ continue;
20
+ const o = t.slice(0, i).trim();
21
+ let c = e[o];
22
+ c || (c = [], e[o] = c);
23
+ for (const l of s.split(","))
24
+ c.push(f(l.trim()));
25
+ }
26
+ return e;
27
+ }
28
+ function F(n) {
29
+ if (!n.length || n === ".")
30
+ return {};
31
+ const e = {};
32
+ let r = n;
33
+ r.endsWith(`
34
+ `) && (r = r.slice(0, r.endsWith(`\r
35
+ `) ? -2 : -1));
36
+ for (const t of r.split(";")) {
37
+ const i = t.indexOf("=");
38
+ if (i === -1)
39
+ continue;
40
+ const s = t.slice(i + 1);
41
+ if (!s.length)
42
+ continue;
43
+ const o = t.slice(0, i).trim();
44
+ let c = e[o];
45
+ c || (c = [], e[o] = c);
46
+ for (const l of s.split(","))
47
+ c.push(l.trim());
48
+ }
49
+ return e;
50
+ }
51
+ function y(n) {
52
+ return d(n.split(" "));
53
+ }
54
+ function a(n) {
55
+ return n === "." || n === "" || n === void 0 ? null : n;
56
+ }
57
+ function d(n) {
58
+ const e = a(n[0]), r = a(n[1]), t = a(n[2]), i = a(n[3]), s = a(n[4]), o = a(n[5]), c = a(n[6]), l = a(n[7]), u = a(n[8]);
59
+ return {
60
+ seq_id: e ? f(e) : null,
61
+ source: r ? f(r) : null,
62
+ type: t ? f(t) : null,
63
+ start: i === null ? null : parseInt(i, 10),
64
+ end: s === null ? null : parseInt(s, 10),
65
+ score: o === null ? null : parseFloat(o),
66
+ strand: c,
67
+ phase: l,
68
+ attributes: u === null ? null : v(u)
69
+ };
70
+ }
71
+ function R(n) {
72
+ const e = a(n[0]), r = a(n[1]), t = a(n[2]), i = a(n[3]), s = a(n[4]), o = a(n[5]), c = a(n[6]), l = a(n[7]), u = a(n[8]);
73
+ return {
74
+ seq_id: e,
75
+ source: r,
76
+ type: t,
77
+ start: i === null ? null : parseInt(i, 10),
78
+ end: s === null ? null : parseInt(s, 10),
79
+ score: o === null ? null : parseFloat(o),
80
+ strand: c,
81
+ phase: l,
82
+ attributes: u === null ? null : F(u)
83
+ };
84
+ }
85
+ function g(n) {
86
+ const e = b.exec(n);
87
+ if (!e)
88
+ return null;
89
+ const [, r] = e;
90
+ let [, , t] = e;
91
+ const i = { directive: r };
92
+ if (t.length && (t = t.replace(C, ""), i.value = t), r === "sequence-region") {
93
+ const s = t.split(p, 3);
94
+ return {
95
+ ...i,
96
+ seq_id: s[0],
97
+ start: s[1]?.replaceAll(m, ""),
98
+ end: s[2]?.replaceAll(m, "")
99
+ };
100
+ } else if (r === "genome-build") {
101
+ const [s, o] = t.split(p, 2);
102
+ return {
103
+ ...i,
104
+ source: s,
105
+ buildName: o
106
+ };
107
+ }
108
+ return i;
109
+ }
110
+ const k = /^\s*[^#\s>]/, I = /^\s*(#+)(.*)/, L = /^\s*$/, D = /^\s*>/, A = /\r?\n?$/g;
111
+ class h {
112
+ featureCallback;
113
+ endCallback;
114
+ commentCallback;
115
+ errorCallback;
116
+ disableDerivesFromReferences;
117
+ directiveCallback;
118
+ bufferSize;
119
+ eof = !1;
120
+ lineNumber = 0;
121
+ // features that we have to keep on hand for now because they
122
+ // might be referenced by something else
123
+ _underConstructionTopLevel = [];
124
+ // index of the above by ID
125
+ _underConstructionById = {};
126
+ _completedReferences = {};
127
+ // features that reference something we have not seen yet
128
+ // structured as:
129
+ // { 'some_id' : {
130
+ // 'Parent' : [ orphans that have a Parent attr referencing it ],
131
+ // 'Derives_from' : [ orphans that have a Derives_from attr referencing it ],
132
+ // }
133
+ // }
134
+ _underConstructionOrphans = {};
135
+ constructor(e) {
136
+ const r = () => {
137
+ };
138
+ this.featureCallback = e.featureCallback || r, this.endCallback = e.endCallback || r, this.commentCallback = e.commentCallback || r, this.errorCallback = e.errorCallback || r, this.directiveCallback = e.directiveCallback || r, this.disableDerivesFromReferences = e.disableDerivesFromReferences || !1, this.bufferSize = e.bufferSize === void 0 ? 1 / 0 : e.bufferSize;
139
+ }
140
+ addLine(e) {
141
+ if (this.eof)
142
+ return;
143
+ if (this.lineNumber += 1, k.test(e)) {
144
+ this._bufferLine(e);
145
+ return;
146
+ }
147
+ const r = I.exec(e);
148
+ if (r) {
149
+ const [, t] = r;
150
+ let [, , i] = r;
151
+ if (t.length === 3)
152
+ this._emitAllUnderConstructionFeatures();
153
+ else if (t.length === 2) {
154
+ const s = g(e);
155
+ s && (s.directive === "FASTA" ? (this._emitAllUnderConstructionFeatures(), this.eof = !0) : this._emitItem(s));
156
+ } else
157
+ this._emitItem({ comment: i.trimStart() });
158
+ } else if (!L.test(e)) if (D.test(e))
159
+ this._emitAllUnderConstructionFeatures(), this.eof = !0;
160
+ else {
161
+ const t = e.replaceAll(A, "");
162
+ throw new Error(`GFF3 parse error. Cannot parse '${t}'.`);
163
+ }
164
+ }
165
+ addParsedFeatureLine(e) {
166
+ this.eof || (this.lineNumber += 1, this._bufferParsedLine(e));
167
+ }
168
+ finish() {
169
+ this._emitAllUnderConstructionFeatures(), this.endCallback();
170
+ }
171
+ _emitItem(e) {
172
+ Array.isArray(e) ? this.featureCallback(e) : "directive" in e ? this.directiveCallback(e) : "comment" in e && this.commentCallback(e);
173
+ }
174
+ _enforceBufferSizeLimit(e = 0) {
175
+ const r = (t) => {
176
+ t && Array.isArray(t) && t[0].attributes?.ID?.[0] && (t[0].attributes.ID.forEach((s) => {
177
+ delete this._underConstructionById[s], delete this._completedReferences[s];
178
+ }), t.forEach((s) => {
179
+ s.child_features && s.child_features.forEach((o) => {
180
+ r(o);
181
+ }), s.derived_features && s.derived_features.forEach((o) => {
182
+ r(o);
183
+ });
184
+ }));
185
+ };
186
+ for (; this._underConstructionTopLevel.length + e > this.bufferSize; ) {
187
+ const t = this._underConstructionTopLevel.shift();
188
+ t && (this._emitItem(t), r(t));
189
+ }
190
+ }
191
+ /**
192
+ * return all under-construction features, called when we know
193
+ * there will be no additional data to attach to them
194
+ */
195
+ _emitAllUnderConstructionFeatures() {
196
+ this._underConstructionTopLevel.forEach(this._emitItem.bind(this)), this._underConstructionTopLevel = [], this._underConstructionById = {}, this._completedReferences = {};
197
+ const e = Object.keys(this._underConstructionOrphans);
198
+ if (e.length)
199
+ throw new Error(`some features reference other features that do not exist in the file (or in the same '###' scope). ${e.join(",")}`);
200
+ }
201
+ _bufferLine(e) {
202
+ this._bufferParsedLine(y(e));
203
+ }
204
+ _bufferParsedLine(e) {
205
+ const r = e;
206
+ r.child_features = [], r.derived_features = [];
207
+ const t = r.attributes?.ID || [], i = r.attributes?.Parent || [], s = this.disableDerivesFromReferences ? [] : r.attributes?.Derives_from || [];
208
+ if (!t.length && !i.length && !s.length) {
209
+ this._emitItem([r]);
210
+ return;
211
+ }
212
+ let o;
213
+ t.forEach((c) => {
214
+ const l = this._underConstructionById[c];
215
+ l ? (l[l.length - 1].type !== r.type && this._parseError(`multi-line feature "${c}" has inconsistent types: "${r.type}", "${l[l.length - 1].type}"`), l.push(r), o = l) : (o = [r], this._enforceBufferSizeLimit(1), !i.length && !s.length && this._underConstructionTopLevel.push(o), this._underConstructionById[c] = o, this._resolveReferencesTo(o, c));
216
+ }), this._resolveReferencesFrom(
217
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
218
+ o || [r],
219
+ { Parent: i, Derives_from: s },
220
+ t
221
+ );
222
+ }
223
+ _resolveReferencesTo(e, r) {
224
+ const t = this._underConstructionOrphans[r];
225
+ if (t) {
226
+ for (const i of e)
227
+ i.child_features.push(...t.Parent), i.derived_features.push(...t.Derives_from);
228
+ delete this._underConstructionOrphans[r];
229
+ }
230
+ }
231
+ _parseError(e) {
232
+ this.eof = !0, this.errorCallback(`${this.lineNumber}: ${e}`);
233
+ }
234
+ _resolveReferencesFrom(e, r, t) {
235
+ for (const i of r.Parent) {
236
+ const s = this._underConstructionById[i];
237
+ if (s) {
238
+ let o = !1;
239
+ for (const c of t) {
240
+ const l = `Parent,${i}`, u = this._completedReferences[c] || (this._completedReferences[c] = {});
241
+ u[l] && (o = !0), u[l] = !0;
242
+ }
243
+ if (!o)
244
+ for (const c of s)
245
+ c.child_features.push(e);
246
+ } else {
247
+ let o = this._underConstructionOrphans[i];
248
+ o || (o = { Parent: [], Derives_from: [] }, this._underConstructionOrphans[i] = o), o.Parent.push(e);
249
+ }
250
+ }
251
+ for (const i of r.Derives_from) {
252
+ const s = this._underConstructionById[i];
253
+ if (s) {
254
+ let o = !1;
255
+ for (const c of t) {
256
+ const l = `Derives_from,${i}`, u = this._completedReferences[c] || (this._completedReferences[c] = {});
257
+ u[l] && (o = !0), u[l] = !0;
258
+ }
259
+ if (!o)
260
+ for (const c of s)
261
+ c.derived_features.push(e);
262
+ } else {
263
+ let o = this._underConstructionOrphans[i];
264
+ o || (o = { Parent: [], Derives_from: [] }, this._underConstructionOrphans[i] = o), o.Derives_from.push(e);
265
+ }
266
+ }
267
+ }
268
+ }
269
+ function x(n) {
270
+ const e = [], r = new h({
271
+ featureCallback: (t) => e.push(t),
272
+ disableDerivesFromReferences: !0,
273
+ errorCallback: (t) => {
274
+ throw new Error(t);
275
+ }
276
+ });
277
+ for (const t of n.split(/\r?\n/))
278
+ r.addLine(t);
279
+ return r.finish(), e;
280
+ }
281
+ function w(n) {
282
+ const e = [], r = new h({
283
+ featureCallback: (t) => e.push(t),
284
+ disableDerivesFromReferences: !0,
285
+ errorCallback: (t) => {
286
+ throw new Error(t);
287
+ }
288
+ });
289
+ for (const t of n)
290
+ r.addLine(t);
291
+ return r.finish(), e;
292
+ }
293
+ function S(n) {
294
+ const e = [], r = new h({
295
+ featureCallback: (t) => e.push(t),
296
+ disableDerivesFromReferences: !0,
297
+ errorCallback: (t) => {
298
+ throw new Error(t);
299
+ }
300
+ });
301
+ for (const t of n) {
302
+ const i = d(t.fields);
303
+ t.lineHash !== void 0 && (i.attributes || (i.attributes = {}), i.attributes._lineHash = [String(t.lineHash)]), r.addParsedFeatureLine(i);
304
+ }
305
+ return r.finish(), e;
306
+ }
307
+ function E(n, e) {
308
+ const r = [], t = new h({
309
+ featureCallback: (s) => r.push(s),
310
+ disableDerivesFromReferences: !0,
311
+ errorCallback: (s) => {
312
+ throw new Error(s);
313
+ }
314
+ }), i = e ? d : R;
315
+ for (const s of n) {
316
+ const o = i(s.fields);
317
+ s.lineHash !== void 0 && (o.attributes || (o.attributes = {}), o.attributes._lineHash = [String(s.lineHash)]), t.addParsedFeatureLine(o);
318
+ }
319
+ return t.finish(), r;
320
+ }
321
+ export {
322
+ w as parseArraySync,
323
+ S as parseRecordsSync,
324
+ E as parseRecordsSyncFast,
325
+ x as parseStringSync
326
+ };
@@ -453,8 +453,7 @@ function Y(s) {
453
453
  }
454
454
  const Mt = { ".": 0, "-": -1, "+": 1 };
455
455
  function jt(s) {
456
- var m;
457
- return s.length >= 12 && !Number.isNaN(Number.parseInt(s[9], 10)) && ((m = s[10]) == null ? void 0 : m.split(",").filter((t) => !!t).length) === Number.parseInt(s[9], 10);
456
+ return s.length >= 12 && !Number.isNaN(Number.parseInt(s[9], 10)) && s[10]?.split(",").filter((m) => !!m).length === Number.parseInt(s[9], 10);
458
457
  }
459
458
  class _t {
460
459
  constructor(m = {}) {
@@ -1,22 +1,19 @@
1
- var _ = Object.defineProperty;
2
- var I = (r, e, t) => e in r ? _(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var h = (r, e, t) => I(r, typeof e != "symbol" ? e + "" : e, t);
4
- import { LocalFile as d } from "./browser-BRemItdO.js";
5
- import { I as b, Z as F } from "./inflate-GtwLkvSP.js";
6
- const w = 65536, S = w * w;
7
- function g(r, e = 0) {
8
- const t = r[e] | r[e + 1] << 8 | r[e + 2] << 16 | r[e + 3] << 24;
9
- return ((r[e + 4] | r[e + 5] << 8 | r[e + 6] << 16 | r[e + 7] << 24) >>> 0) * S + (t >>> 0);
1
+ import { LocalFile as d } from "./browser-0iNU5Wit.js";
2
+ import { I as y, Z as _ } from "./inflate-GtwLkvSP.js";
3
+ const g = 65536, I = g * g;
4
+ function u(i, e = 0) {
5
+ const t = i[e] | i[e + 1] << 8 | i[e + 2] << 16 | i[e + 3] << 24;
6
+ return ((i[e + 4] | i[e + 5] << 8 | i[e + 6] << 16 | i[e + 7] << 24) >>> 0) * I + (t >>> 0);
10
7
  }
11
- const u = 1;
12
- function m(r, e, t) {
13
- const n = e[u], s = t ? t[u] : 1 / 0;
14
- return n <= r && s > r ? 0 : n < r ? -1 : 1;
8
+ const f = 1;
9
+ function w(i, e, t) {
10
+ const n = e[f], s = t ? t[f] : 1 / 0;
11
+ return n <= i && s > i ? 0 : n < i ? -1 : 1;
15
12
  }
16
- class B {
13
+ class b {
14
+ filehandle;
15
+ index;
17
16
  constructor({ filehandle: e }) {
18
- h(this, "filehandle");
19
- h(this, "index");
20
17
  this.filehandle = e;
21
18
  }
22
19
  _getIndex() {
@@ -25,7 +22,7 @@ class B {
25
22
  })), this.index;
26
23
  }
27
24
  async _readIndex() {
28
- const e = await this.filehandle.read(8, 0), t = g(e);
25
+ const e = await this.filehandle.read(8, 0), t = u(e);
29
26
  if (!t)
30
27
  return [[0, 0]];
31
28
  const n = new Array(t + 1);
@@ -33,9 +30,9 @@ class B {
33
30
  const s = 16 * t;
34
31
  if (s > Number.MAX_SAFE_INTEGER)
35
32
  throw new TypeError("integer overflow");
36
- const i = await this.filehandle.read(s, 8);
33
+ const r = await this.filehandle.read(s, 8);
37
34
  for (let a = 0; a < t; a += 1) {
38
- const o = g(i, a * 16), c = g(i, a * 16 + 8);
35
+ const o = u(r, a * 16), c = u(r, a * 16 + 8);
39
36
  n[a + 1] = [o, c];
40
37
  }
41
38
  return n;
@@ -47,79 +44,78 @@ class B {
47
44
  const n = t + e;
48
45
  if (e === 0)
49
46
  return [];
50
- const s = await this._getIndex(), i = [];
51
- let a = 0, o = s.length - 1, c = Math.floor(s.length / 2), l = m(t, s[c], s[c + 1]);
47
+ const s = await this._getIndex(), r = [];
48
+ let a = 0, o = s.length - 1, c = Math.floor(s.length / 2), l = w(t, s[c], s[c + 1]);
52
49
  for (; l !== 0; )
53
- l > 0 ? o = c - 1 : l < 0 && (a = c + 1), c = Math.ceil((o - a) / 2) + a, l = m(t, s[c], s[c + 1]);
54
- i.push(s[c]);
55
- let f = c + 1;
56
- for (; f < s.length && (i.push(s[f]), !(s[f][u] >= n)); f += 1)
50
+ l > 0 ? o = c - 1 : l < 0 && (a = c + 1), c = Math.ceil((o - a) / 2) + a, l = w(t, s[c], s[c + 1]);
51
+ r.push(s[c]);
52
+ let h = c + 1;
53
+ for (; h < s.length && (r.push(s[h]), !(s[h][f] >= n)); h += 1)
57
54
  ;
58
- return i[i.length - 1][u] < n && i.push([]), i;
55
+ return r[r.length - 1][f] < n && r.push([]), r;
59
56
  }
60
57
  }
61
- function E(r) {
58
+ function F(i) {
62
59
  let e = 0;
63
- for (const t of r)
60
+ for (const t of i)
64
61
  e += t.length;
65
62
  return e;
66
63
  }
67
- function y(r, e) {
68
- const t = new Uint8Array(e ?? E(r));
64
+ function x(i, e) {
65
+ const t = new Uint8Array(e ?? F(i));
69
66
  let n = 0;
70
- for (const s of r)
67
+ for (const s of i)
71
68
  t.set(s, n), n += s.length;
72
69
  return t;
73
70
  }
74
- async function k(r) {
71
+ async function S(i) {
75
72
  try {
76
73
  let e, t = 0, n;
77
74
  const s = [];
78
- let i = 0;
75
+ let r = 0;
79
76
  do {
80
- const a = r.subarray(t);
81
- if (n = new b(void 0), { strm: e } = n, n.push(a, F), n.err)
77
+ const a = i.subarray(t);
78
+ if (n = new y(void 0), { strm: e } = n, n.push(a, _), n.err)
82
79
  throw new Error(n.msg);
83
80
  t += e.next_in;
84
81
  const o = n.result;
85
- s.push(o), i += o.length;
82
+ s.push(o), r += o.length;
86
83
  } while (e.avail_in);
87
- return y(s, i);
84
+ return x(s, r);
88
85
  } catch (e) {
89
86
  throw /incorrect header check/.exec(`${e}`) ? new Error("problem decompressing block: incorrect gzip header check") : e;
90
87
  }
91
88
  }
92
- class p {
89
+ class m {
90
+ filehandle;
91
+ gzi;
93
92
  constructor({ filehandle: e, gziFilehandle: t }) {
94
- h(this, "filehandle");
95
- h(this, "gzi");
96
- this.filehandle = e, this.gzi = new B({
93
+ this.filehandle = e, this.gzi = new b({
97
94
  filehandle: t
98
95
  });
99
96
  }
100
97
  async _readAndUncompressBlock(e, t) {
101
98
  let n = t;
102
99
  n || (n = (await this.filehandle.stat()).size);
103
- const s = n - e, i = await this.filehandle.read(s, e);
104
- return k(i);
100
+ const s = n - e, r = await this.filehandle.read(s, e);
101
+ return S(r);
105
102
  }
106
103
  async read(e, t) {
107
104
  const n = await this.gzi.getRelevantBlocksForRead(e, t), s = [];
108
- for (let i = 0; i < n.length - 1; i += 1) {
109
- const a = await this._readAndUncompressBlock(n[i][0], n[i + 1][0]), [, o] = n[i], c = o >= t ? 0 : t - o, l = Math.min(t + e, o + a.length) - o;
105
+ for (let r = 0; r < n.length - 1; r += 1) {
106
+ const a = await this._readAndUncompressBlock(n[r][0], n[r + 1][0]), [, o] = n[r], c = o >= t ? 0 : t - o, l = Math.min(t + e, o + a.length) - o;
110
107
  c >= 0 && c < a.length && s.push(a.subarray(c, l));
111
108
  }
112
- return y(s);
109
+ return x(s);
113
110
  }
114
111
  }
115
- function x(r, e) {
116
- return r.offset + r.lineBytes * Math.floor(e / r.lineLength) + e % r.lineLength;
112
+ function p(i, e) {
113
+ return i.offset + i.lineBytes * Math.floor(e / i.lineLength) + e % i.lineLength;
117
114
  }
118
- async function z(r, e = {}) {
115
+ async function B(i, e = {}) {
119
116
  const t = new TextDecoder("utf8");
120
- return Object.fromEntries(t.decode(await r.readFile(e)).split(/\r?\n/).map((n) => n.trim()).filter((n) => !!n).map((n) => n.split(" ")).map((n) => {
121
- var s;
122
- if ((s = n[0]) != null && s.startsWith(">"))
117
+ return Object.fromEntries(t.decode(await i.readFile(e)).split(/\r?\n/).map((n) => n.trim()).filter((n) => !!n).map((n) => n.split(" ")).map((n) => {
118
+ if (n[0]?.startsWith(">"))
123
119
  throw new Error("found > in sequence name, might have supplied FASTA file for the FASTA index");
124
120
  return [
125
121
  n[0],
@@ -135,7 +131,7 @@ async function z(r, e = {}) {
135
131
  ];
136
132
  }));
137
133
  }
138
- class N {
134
+ class E {
139
135
  constructor({ fasta: e, fai: t, path: n, faiPath: s }) {
140
136
  if (e)
141
137
  this.fasta = e;
@@ -153,7 +149,7 @@ class N {
153
149
  throw new Error("Need to pass filehandle for or path to localfile");
154
150
  }
155
151
  async _getIndexes(e) {
156
- return this.indexes || (this.indexes = z(this.fai, e).catch((t) => {
152
+ return this.indexes || (this.indexes = B(this.fai, e).catch((t) => {
157
153
  throw this.indexes = void 0, t;
158
154
  })), this.indexes;
159
155
  }
@@ -182,8 +178,7 @@ class N {
182
178
  * sequence name
183
179
  */
184
180
  async getSequenceSize(e, t) {
185
- var s;
186
- return (s = (await this._getIndexes(t))[e]) == null ? void 0 : s.length;
181
+ return (await this._getIndexes(t))[e]?.length;
187
182
  }
188
183
  /**
189
184
  * @param name
@@ -199,48 +194,48 @@ class N {
199
194
  * @param max
200
195
  */
201
196
  async getResiduesByName(e, t, n, s) {
202
- const i = (await this._getIndexes(s))[e];
203
- return i ? this._fetchFromIndexEntry(i, t, n, s) : void 0;
197
+ const r = (await this._getIndexes(s))[e];
198
+ return r ? this._fetchFromIndexEntry(r, t, n, s) : void 0;
204
199
  }
205
200
  //alias for getResiduesByName
206
201
  async getSequence(e, t, n, s) {
207
202
  return this.getResiduesByName(e, t, n, s);
208
203
  }
209
204
  async _fetchFromIndexEntry(e, t = 0, n, s) {
210
- let i = n;
205
+ let r = n;
211
206
  if (t < 0)
212
207
  throw new TypeError("regionStart cannot be less than 0");
213
- if ((i === void 0 || i > e.length) && (i = e.length), t >= i)
208
+ if ((r === void 0 || r > e.length) && (r = e.length), t >= r)
214
209
  return "";
215
- const a = x(e, t), o = x(e, i) - a, l = new TextDecoder("utf8").decode(await this.fasta.read(o, a, s)).replace(/\s+/g, "");
210
+ const a = p(e, t), o = p(e, r) - a, l = new TextDecoder("utf8").decode(await this.fasta.read(o, a, s)).replace(/\s+/g, "");
216
211
  if (/[^\x20-\x7e]/.test(l.slice(0, 1e3)))
217
212
  throw new Error("Non-ASCII characters detected in sequence. The file may be gzip compressed. Use BgzipIndexedFasta for bgzip files, or decompress the file.");
218
213
  return l;
219
214
  }
220
215
  }
221
- class O extends N {
222
- constructor({ fasta: e, path: t, fai: n, faiPath: s, gzi: i, gziPath: a }) {
223
- super({ fasta: e, path: t, fai: n, faiPath: s }), e && i ? this.fasta = new p({
216
+ class A extends E {
217
+ constructor({ fasta: e, path: t, fai: n, faiPath: s, gzi: r, gziPath: a }) {
218
+ super({ fasta: e, path: t, fai: n, faiPath: s }), e && r ? this.fasta = new m({
224
219
  filehandle: e,
225
- gziFilehandle: i
226
- }) : t && a && (this.fasta = new p({
220
+ gziFilehandle: r
221
+ }) : t && a && (this.fasta = new m({
227
222
  filehandle: new d(t),
228
223
  gziFilehandle: new d(a)
229
224
  }));
230
225
  }
231
226
  }
232
- function A(r) {
233
- return r.split(">").filter((e) => /\S/.test(e)).map((e) => {
227
+ function k(i) {
228
+ return i.split(">").filter((e) => /\S/.test(e)).map((e) => {
234
229
  const [t, ...n] = e.split(`
235
- `), [s, ...i] = t.split(" "), a = n.join("").replace(/\s/g, "");
230
+ `), [s, ...r] = t.split(" "), a = n.join("").replace(/\s/g, "");
236
231
  return {
237
232
  id: s,
238
- description: i.join(" "),
233
+ description: r.join(" "),
239
234
  sequence: a
240
235
  };
241
236
  });
242
237
  }
243
- class R {
238
+ class q {
244
239
  constructor({ fasta: e, path: t }) {
245
240
  if (e)
246
241
  this.fasta = e;
@@ -249,23 +244,23 @@ class R {
249
244
  else
250
245
  throw new Error("Need to pass fasta or path");
251
246
  this.data = this.fasta.readFile().then((n) => {
252
- const i = new TextDecoder("utf8").decode(n);
253
- return A(i);
247
+ const r = new TextDecoder("utf8").decode(n);
248
+ return k(r);
254
249
  });
255
250
  }
256
251
  async fetch(e, t, n) {
257
- const i = (await this.data).find((o) => o.id === e), a = n - t;
258
- if (!i)
252
+ const r = (await this.data).find((o) => o.id === e), a = n - t;
253
+ if (!r)
259
254
  throw new Error(`no sequence with id ${e} exists`);
260
- return i.sequence.slice(t, a);
255
+ return r.sequence.slice(t, a);
261
256
  }
262
257
  async getSequenceNames() {
263
258
  return (await this.data).map((t) => t.id);
264
259
  }
265
260
  }
266
261
  export {
267
- O as BgzipIndexedFasta,
268
- R as FetchableSmallFasta,
269
- N as IndexedFasta,
270
- A as parseSmallFasta
262
+ A as BgzipIndexedFasta,
263
+ q as FetchableSmallFasta,
264
+ E as IndexedFasta,
265
+ k as parseSmallFasta
271
266
  };