@genome-spy/core 0.65.0 → 0.66.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle/browser-BRemItdO.js +138 -0
- package/dist/bundle/{index-CD7FLu9x.js → index-BatuyGAI.js} +23 -21
- package/dist/bundle/{index-C0llXMqm.js → index-ByuE8dvu.js} +140 -88
- package/dist/bundle/index-Cq3QFUxX.js +1781 -0
- package/dist/bundle/index-D28m8tSW.js +1607 -0
- package/dist/bundle/index-DbJ0oeYM.js +631 -0
- package/dist/bundle/index.es.js +17587 -16593
- package/dist/bundle/index.js +214 -212
- package/dist/bundle/{inflate-DRgHi_KK.js → inflate-GtwLkvSP.js} +222 -224
- package/dist/bundle/unzip-NywezaRR.js +1492 -0
- package/dist/schema.json +13 -3
- package/dist/src/config/scaleDefaults.d.ts +8 -0
- package/dist/src/config/scaleDefaults.d.ts.map +1 -0
- package/dist/src/config/scaleDefaults.js +45 -0
- package/dist/src/data/flowInit.js +2 -2
- package/dist/src/data/sources/lazy/axisTickSource.js +1 -1
- package/dist/src/data/sources/lazy/singleAxisLazySource.d.ts +1 -1
- package/dist/src/data/sources/lazy/singleAxisLazySource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/singleAxisLazySource.js +10 -3
- package/dist/src/data/sources/lazy/singleAxisWindowedSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/singleAxisWindowedSource.js +5 -1
- package/dist/src/data/transforms/filterScoredLabels.d.ts +1 -1
- package/dist/src/data/transforms/filterScoredLabels.d.ts.map +1 -1
- package/dist/src/data/transforms/filterScoredLabels.js +1 -1
- package/dist/src/data/transforms/linearizeGenomicCoordinate.d.ts.map +1 -1
- package/dist/src/data/transforms/linearizeGenomicCoordinate.js +2 -1
- package/dist/src/encoder/encoder.d.ts +1 -1
- package/dist/src/encoder/encoder.d.ts.map +1 -1
- package/dist/src/encoder/encoder.js +1 -1
- package/dist/src/genome/scaleLocus.d.ts +39 -0
- package/dist/src/genome/scaleLocus.d.ts.map +1 -1
- package/dist/src/genome/scaleLocus.js +76 -0
- package/dist/src/genomeSpy/canvasExport.d.ts +19 -0
- package/dist/src/genomeSpy/canvasExport.d.ts.map +1 -0
- package/dist/src/genomeSpy/canvasExport.js +66 -0
- package/dist/src/genomeSpy/containerUi.d.ts +17 -0
- package/dist/src/genomeSpy/containerUi.d.ts.map +1 -0
- package/dist/src/genomeSpy/containerUi.js +78 -0
- package/dist/src/genomeSpy/eventListenerRegistry.d.ts +19 -0
- package/dist/src/genomeSpy/eventListenerRegistry.d.ts.map +1 -0
- package/dist/src/genomeSpy/eventListenerRegistry.js +38 -0
- package/dist/src/genomeSpy/inputBindingManager.d.ts +14 -0
- package/dist/src/genomeSpy/inputBindingManager.d.ts.map +1 -0
- package/dist/src/genomeSpy/inputBindingManager.js +63 -0
- package/dist/src/genomeSpy/interactionController.d.ts +40 -0
- package/dist/src/genomeSpy/interactionController.d.ts.map +1 -0
- package/dist/src/genomeSpy/interactionController.js +371 -0
- package/dist/src/genomeSpy/keyboardListenerManager.d.ts +10 -0
- package/dist/src/genomeSpy/keyboardListenerManager.d.ts.map +1 -0
- package/dist/src/genomeSpy/keyboardListenerManager.js +31 -0
- package/dist/src/genomeSpy/loadingIndicatorManager.d.ts +15 -0
- package/dist/src/genomeSpy/loadingIndicatorManager.d.ts.map +1 -0
- package/dist/src/genomeSpy/loadingIndicatorManager.js +92 -0
- package/dist/src/genomeSpy/renderCoordinator.d.ts +22 -0
- package/dist/src/genomeSpy/renderCoordinator.d.ts.map +1 -0
- package/dist/src/genomeSpy/renderCoordinator.js +118 -0
- package/dist/src/genomeSpy/viewContextFactory.d.ts +18 -0
- package/dist/src/genomeSpy/viewContextFactory.d.ts.map +1 -0
- package/dist/src/genomeSpy/viewContextFactory.js +79 -0
- package/dist/src/genomeSpy/viewDataInit.d.ts +12 -0
- package/dist/src/genomeSpy/viewDataInit.d.ts.map +1 -0
- package/dist/src/genomeSpy/viewDataInit.js +41 -0
- package/dist/src/genomeSpy/viewHierarchyConfig.d.ts +14 -0
- package/dist/src/genomeSpy/viewHierarchyConfig.d.ts.map +1 -0
- package/dist/src/genomeSpy/viewHierarchyConfig.js +24 -0
- package/dist/src/genomeSpy/viewHighlight.d.ts +5 -0
- package/dist/src/genomeSpy/viewHighlight.d.ts.map +1 -0
- package/dist/src/genomeSpy/viewHighlight.js +30 -0
- package/dist/src/genomeSpy.d.ts +16 -71
- package/dist/src/genomeSpy.d.ts.map +1 -1
- package/dist/src/genomeSpy.js +179 -745
- package/dist/src/gl/glslScaleGenerator.d.ts +1 -1
- package/dist/src/gl/webGLHelper.d.ts +2 -2
- package/dist/src/gl/webGLHelper.d.ts.map +1 -1
- package/dist/src/gl/webGLHelper.js +4 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -12
- package/dist/src/marks/mark.d.ts.map +1 -1
- package/dist/src/marks/mark.js +4 -2
- package/dist/src/{view → scales}/axisResolution.d.ts +9 -16
- package/dist/src/scales/axisResolution.d.ts.map +1 -0
- package/dist/src/{view → scales}/axisResolution.js +29 -18
- package/dist/src/scales/axisResolution.test.d.ts.map +1 -0
- package/dist/src/scales/scaleDomainAggregator.d.ts +57 -0
- package/dist/src/scales/scaleDomainAggregator.d.ts.map +1 -0
- package/dist/src/scales/scaleDomainAggregator.js +162 -0
- package/dist/src/scales/scaleDomainAggregator.test.d.ts +2 -0
- package/dist/src/scales/scaleDomainAggregator.test.d.ts.map +1 -0
- package/dist/src/scales/scaleInstanceManager.d.ts +40 -0
- package/dist/src/scales/scaleInstanceManager.d.ts.map +1 -0
- package/dist/src/scales/scaleInstanceManager.js +313 -0
- package/dist/src/scales/scaleInstanceManager.test.d.ts +2 -0
- package/dist/src/scales/scaleInstanceManager.test.d.ts.map +1 -0
- package/dist/src/scales/scaleInteractionController.d.ts +73 -0
- package/dist/src/scales/scaleInteractionController.d.ts.map +1 -0
- package/dist/src/scales/scaleInteractionController.js +336 -0
- package/dist/src/scales/scaleInteractionController.test.d.ts +2 -0
- package/dist/src/scales/scaleInteractionController.test.d.ts.map +1 -0
- package/dist/src/scales/scalePropsResolver.d.ts +23 -0
- package/dist/src/scales/scalePropsResolver.d.ts.map +1 -0
- package/dist/src/scales/scalePropsResolver.js +74 -0
- package/dist/src/{view → scales}/scaleResolution.d.ts +52 -35
- package/dist/src/scales/scaleResolution.d.ts.map +1 -0
- package/dist/src/scales/scaleResolution.js +658 -0
- package/dist/src/scales/scaleResolution.test.d.ts.map +1 -0
- package/dist/src/scales/scaleResolutionConstants.d.ts +6 -0
- package/dist/src/scales/scaleResolutionConstants.d.ts.map +1 -0
- package/dist/src/scales/scaleResolutionConstants.js +5 -0
- package/dist/src/scales/scaleRules.d.ts +16 -0
- package/dist/src/scales/scaleRules.d.ts.map +1 -0
- package/dist/src/scales/scaleRules.js +103 -0
- package/dist/src/scales/scaleRules.test.d.ts +2 -0
- package/dist/src/scales/scaleRules.test.d.ts.map +1 -0
- package/dist/src/spec/channel.d.ts +13 -18
- package/dist/src/spec/scale.d.ts +6 -0
- package/dist/src/types/embedApi.d.ts +5 -0
- package/dist/src/types/scaleResolutionApi.d.ts +1 -1
- package/dist/src/view/concatView.d.ts +18 -0
- package/dist/src/view/concatView.d.ts.map +1 -1
- package/dist/src/view/concatView.js +73 -0
- package/dist/src/view/concatView.test.d.ts +2 -0
- package/dist/src/view/concatView.test.d.ts.map +1 -0
- package/dist/src/view/containerMutationHelper.d.ts +74 -0
- package/dist/src/view/containerMutationHelper.d.ts.map +1 -0
- package/dist/src/view/containerMutationHelper.js +114 -0
- package/dist/src/view/containerView.d.ts +0 -7
- package/dist/src/view/containerView.d.ts.map +1 -1
- package/dist/src/view/containerView.js +0 -10
- package/dist/src/view/facetView.d.ts.map +1 -1
- package/dist/src/view/facetView.js +0 -15
- package/dist/src/view/gridView/gridChild.d.ts +11 -0
- package/dist/src/view/gridView/gridChild.d.ts.map +1 -1
- package/dist/src/view/gridView/gridChild.js +32 -6
- package/dist/src/view/gridView/gridView.d.ts +39 -1
- package/dist/src/view/gridView/gridView.d.ts.map +1 -1
- package/dist/src/view/gridView/gridView.js +106 -48
- package/dist/src/view/gridView/gridView.test.d.ts +2 -0
- package/dist/src/view/gridView/gridView.test.d.ts.map +1 -0
- package/dist/src/view/gridView/scrollbar.d.ts +39 -8
- package/dist/src/view/gridView/scrollbar.d.ts.map +1 -1
- package/dist/src/view/gridView/scrollbar.js +184 -69
- package/dist/src/view/layerView.d.ts +14 -0
- package/dist/src/view/layerView.d.ts.map +1 -1
- package/dist/src/view/layerView.js +66 -0
- package/dist/src/view/layerView.test.d.ts +2 -0
- package/dist/src/view/layerView.test.d.ts.map +1 -0
- package/dist/src/view/testUtils.d.ts.map +1 -1
- package/dist/src/view/testUtils.js +2 -1
- package/dist/src/view/unitView.d.ts.map +1 -1
- package/dist/src/view/unitView.js +24 -34
- package/dist/src/view/view.d.ts +6 -6
- package/dist/src/view/view.d.ts.map +1 -1
- package/dist/src/view/view.js +4 -4
- package/package.json +2 -2
- package/dist/bundle/browser-txUcLy2H.js +0 -123
- package/dist/bundle/index-BQpbYrv4.js +0 -1712
- package/dist/bundle/index-BhtHKLUo.js +0 -73
- package/dist/bundle/index-CCe8rnZz.js +0 -716
- package/dist/bundle/index-DhcU-Gk-.js +0 -1487
- package/dist/src/data/collector.test.js +0 -138
- package/dist/src/data/dataFlow.test.js +0 -38
- package/dist/src/data/flow.test.js +0 -81
- package/dist/src/data/flowInit.test.js +0 -413
- package/dist/src/data/flowNode.test.js +0 -50
- package/dist/src/data/flowOptimizer.test.js +0 -209
- package/dist/src/data/formats/fasta.test.js +0 -27
- package/dist/src/data/sources/inlineSource.test.js +0 -63
- package/dist/src/data/sources/sequenceSource.test.js +0 -81
- package/dist/src/data/transforms/aggregate.test.js +0 -134
- package/dist/src/data/transforms/clone.test.js +0 -11
- package/dist/src/data/transforms/coverage.test.js +0 -238
- package/dist/src/data/transforms/filter.test.js +0 -20
- package/dist/src/data/transforms/flatten.test.js +0 -96
- package/dist/src/data/transforms/flattenDelimited.test.js +0 -90
- package/dist/src/data/transforms/flattenSequence.test.js +0 -34
- package/dist/src/data/transforms/formula.test.js +0 -25
- package/dist/src/data/transforms/identifier.test.js +0 -92
- package/dist/src/data/transforms/pileup.test.js +0 -70
- package/dist/src/data/transforms/project.test.js +0 -32
- package/dist/src/data/transforms/regexExtract.test.js +0 -70
- package/dist/src/data/transforms/regexFold.test.js +0 -201
- package/dist/src/data/transforms/sample.test.js +0 -38
- package/dist/src/data/transforms/stack.test.js +0 -91
- package/dist/src/encoder/accessor.test.js +0 -162
- package/dist/src/encoder/encoder.test.js +0 -105
- package/dist/src/genome/genome.test.js +0 -268
- package/dist/src/genome/genomes.test.js +0 -8
- package/dist/src/genome/scaleIndex.test.js +0 -78
- package/dist/src/genome/scaleLocus.test.js +0 -4
- package/dist/src/scale/scale.test.js +0 -326
- package/dist/src/scale/ticks.test.js +0 -46
- package/dist/src/selection/selection.test.js +0 -14
- package/dist/src/utils/addBaseUrl.test.js +0 -30
- package/dist/src/utils/binnedIndex.test.js +0 -201
- package/dist/src/utils/cloner.test.js +0 -35
- package/dist/src/utils/coalesce.test.js +0 -16
- package/dist/src/utils/concatIterables.test.js +0 -8
- package/dist/src/utils/domainArray.test.js +0 -130
- package/dist/src/utils/indexer.test.js +0 -49
- package/dist/src/utils/interactionEvent.test.js +0 -35
- package/dist/src/utils/iterateNestedMaps.test.js +0 -33
- package/dist/src/utils/kWayMerge.test.js +0 -30
- package/dist/src/utils/mergeObjects.test.js +0 -42
- package/dist/src/utils/numberExtractor.test.js +0 -6
- package/dist/src/utils/propertyCacher.test.js +0 -89
- package/dist/src/utils/propertyCoalescer.test.js +0 -25
- package/dist/src/utils/radixSort.test.js +0 -51
- package/dist/src/utils/reservationMap.test.js +0 -20
- package/dist/src/utils/ringBuffer.test.js +0 -39
- package/dist/src/utils/topK.test.js +0 -54
- package/dist/src/utils/trees.test.js +0 -135
- package/dist/src/utils/url.test.js +0 -28
- package/dist/src/utils/variableTools.test.js +0 -13
- package/dist/src/view/axisResolution.d.ts.map +0 -1
- package/dist/src/view/axisResolution.test.d.ts.map +0 -1
- package/dist/src/view/axisResolution.test.js +0 -206
- package/dist/src/view/flowBuilder.test.js +0 -125
- package/dist/src/view/gridView/selectionRect.test.js +0 -87
- package/dist/src/view/layout/flexLayout.test.js +0 -323
- package/dist/src/view/layout/grid.test.js +0 -71
- package/dist/src/view/layout/rectangle.test.js +0 -192
- package/dist/src/view/paramMediator.test.js +0 -282
- package/dist/src/view/scaleResolution.d.ts.map +0 -1
- package/dist/src/view/scaleResolution.js +0 -1059
- package/dist/src/view/scaleResolution.test.d.ts.map +0 -1
- package/dist/src/view/scaleResolution.test.js +0 -645
- package/dist/src/view/view.test.js +0 -245
- package/dist/src/view/viewDispose.test.js +0 -110
- package/dist/src/view/viewFactory.test.js +0 -25
- package/dist/src/view/viewUtils.test.js +0 -87
- /package/dist/src/{view → scales}/axisResolution.test.d.ts +0 -0
- /package/dist/src/{view → scales}/scaleResolution.test.d.ts +0 -0
|
@@ -0,0 +1,1781 @@
|
|
|
1
|
+
var Ne = Object.defineProperty;
|
|
2
|
+
var Le = (t, r, e) => r in t ? Ne(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
|
|
3
|
+
var E = (t, r, e) => Le(t, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
+
import { RemoteFile as Me, LocalFile as He } from "./browser-BRemItdO.js";
|
|
5
|
+
import { A as le } from "./AbortablePromiseCache-CcuMrnn7.js";
|
|
6
|
+
import { i as $e } from "./inflate-GtwLkvSP.js";
|
|
7
|
+
const he = BigInt(32);
|
|
8
|
+
function je(t, r, e) {
|
|
9
|
+
const n = +!!e, i = +!e;
|
|
10
|
+
return BigInt(t.getInt32(r, e) * i + t.getInt32(r + 4, e) * n) << he | BigInt(t.getUint32(r, e) * n + t.getUint32(r + 4, e) * i);
|
|
11
|
+
}
|
|
12
|
+
function Ge(t, r, e) {
|
|
13
|
+
const n = t.getUint32(r, e), i = t.getUint32(r + 4, e), o = +!!e, s = +!e;
|
|
14
|
+
return BigInt(n * s + i * o) << he | BigInt(n * o + i * s);
|
|
15
|
+
}
|
|
16
|
+
"getBigInt64" in DataView || (DataView.prototype.getBigInt64 = function(t, r) {
|
|
17
|
+
return je(this, t, r);
|
|
18
|
+
});
|
|
19
|
+
"getBigUint64" in DataView || (DataView.prototype.getBigUint64 = function(t, r) {
|
|
20
|
+
return Ge(this, t, r);
|
|
21
|
+
});
|
|
22
|
+
var K = function(t, r) {
|
|
23
|
+
return K = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, n) {
|
|
24
|
+
e.__proto__ = n;
|
|
25
|
+
} || function(e, n) {
|
|
26
|
+
for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (e[i] = n[i]);
|
|
27
|
+
}, K(t, r);
|
|
28
|
+
};
|
|
29
|
+
function te(t, r) {
|
|
30
|
+
if (typeof r != "function" && r !== null)
|
|
31
|
+
throw new TypeError("Class extends value " + String(r) + " is not a constructor or null");
|
|
32
|
+
K(t, r);
|
|
33
|
+
function e() {
|
|
34
|
+
this.constructor = t;
|
|
35
|
+
}
|
|
36
|
+
t.prototype = r === null ? Object.create(r) : (e.prototype = r.prototype, new e());
|
|
37
|
+
}
|
|
38
|
+
function We(t, r, e, n) {
|
|
39
|
+
function i(o) {
|
|
40
|
+
return o instanceof e ? o : new e(function(s) {
|
|
41
|
+
s(o);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return new (e || (e = Promise))(function(o, s) {
|
|
45
|
+
function u(d) {
|
|
46
|
+
try {
|
|
47
|
+
c(n.next(d));
|
|
48
|
+
} catch (y) {
|
|
49
|
+
s(y);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function a(d) {
|
|
53
|
+
try {
|
|
54
|
+
c(n.throw(d));
|
|
55
|
+
} catch (y) {
|
|
56
|
+
s(y);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function c(d) {
|
|
60
|
+
d.done ? o(d.value) : i(d.value).then(u, a);
|
|
61
|
+
}
|
|
62
|
+
c((n = n.apply(t, r || [])).next());
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function de(t, r) {
|
|
66
|
+
var e = { label: 0, sent: function() {
|
|
67
|
+
if (o[0] & 1) throw o[1];
|
|
68
|
+
return o[1];
|
|
69
|
+
}, trys: [], ops: [] }, n, i, o, s = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
|
|
70
|
+
return s.next = u(0), s.throw = u(1), s.return = u(2), typeof Symbol == "function" && (s[Symbol.iterator] = function() {
|
|
71
|
+
return this;
|
|
72
|
+
}), s;
|
|
73
|
+
function u(c) {
|
|
74
|
+
return function(d) {
|
|
75
|
+
return a([c, d]);
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function a(c) {
|
|
79
|
+
if (n) throw new TypeError("Generator is already executing.");
|
|
80
|
+
for (; s && (s = 0, c[0] && (e = 0)), e; ) try {
|
|
81
|
+
if (n = 1, i && (o = c[0] & 2 ? i.return : c[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, c[1])).done) return o;
|
|
82
|
+
switch (i = 0, o && (c = [c[0] & 2, o.value]), c[0]) {
|
|
83
|
+
case 0:
|
|
84
|
+
case 1:
|
|
85
|
+
o = c;
|
|
86
|
+
break;
|
|
87
|
+
case 4:
|
|
88
|
+
return e.label++, { value: c[1], done: !1 };
|
|
89
|
+
case 5:
|
|
90
|
+
e.label++, i = c[1], c = [0];
|
|
91
|
+
continue;
|
|
92
|
+
case 7:
|
|
93
|
+
c = e.ops.pop(), e.trys.pop();
|
|
94
|
+
continue;
|
|
95
|
+
default:
|
|
96
|
+
if (o = e.trys, !(o = o.length > 0 && o[o.length - 1]) && (c[0] === 6 || c[0] === 2)) {
|
|
97
|
+
e = 0;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (c[0] === 3 && (!o || c[1] > o[0] && c[1] < o[3])) {
|
|
101
|
+
e.label = c[1];
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
if (c[0] === 6 && e.label < o[1]) {
|
|
105
|
+
e.label = o[1], o = c;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
if (o && e.label < o[2]) {
|
|
109
|
+
e.label = o[2], e.ops.push(c);
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
o[2] && e.ops.pop(), e.trys.pop();
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
c = r.call(t, e);
|
|
116
|
+
} catch (d) {
|
|
117
|
+
c = [6, d], i = 0;
|
|
118
|
+
} finally {
|
|
119
|
+
n = o = 0;
|
|
120
|
+
}
|
|
121
|
+
if (c[0] & 5) throw c[1];
|
|
122
|
+
return { value: c[0] ? c[1] : void 0, done: !0 };
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function M(t) {
|
|
126
|
+
var r = typeof Symbol == "function" && Symbol.iterator, e = r && t[r], n = 0;
|
|
127
|
+
if (e) return e.call(t);
|
|
128
|
+
if (t && typeof t.length == "number") return {
|
|
129
|
+
next: function() {
|
|
130
|
+
return t && n >= t.length && (t = void 0), { value: t && t[n++], done: !t };
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
throw new TypeError(r ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
134
|
+
}
|
|
135
|
+
function X(t, r) {
|
|
136
|
+
var e = typeof Symbol == "function" && t[Symbol.iterator];
|
|
137
|
+
if (!e) return t;
|
|
138
|
+
var n = e.call(t), i, o = [], s;
|
|
139
|
+
try {
|
|
140
|
+
for (; (r === void 0 || r-- > 0) && !(i = n.next()).done; ) o.push(i.value);
|
|
141
|
+
} catch (u) {
|
|
142
|
+
s = { error: u };
|
|
143
|
+
} finally {
|
|
144
|
+
try {
|
|
145
|
+
i && !i.done && (e = n.return) && e.call(n);
|
|
146
|
+
} finally {
|
|
147
|
+
if (s) throw s.error;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return o;
|
|
151
|
+
}
|
|
152
|
+
function ee(t, r, e) {
|
|
153
|
+
if (e || arguments.length === 2) for (var n = 0, i = r.length, o; n < i; n++)
|
|
154
|
+
(o || !(n in r)) && (o || (o = Array.prototype.slice.call(r, 0, n)), o[n] = r[n]);
|
|
155
|
+
return t.concat(o || Array.prototype.slice.call(r));
|
|
156
|
+
}
|
|
157
|
+
function R(t) {
|
|
158
|
+
return this instanceof R ? (this.v = t, this) : new R(t);
|
|
159
|
+
}
|
|
160
|
+
function qe(t, r, e) {
|
|
161
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
162
|
+
var n = e.apply(t, r || []), i, o = [];
|
|
163
|
+
return i = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), u("next"), u("throw"), u("return", s), i[Symbol.asyncIterator] = function() {
|
|
164
|
+
return this;
|
|
165
|
+
}, i;
|
|
166
|
+
function s(f) {
|
|
167
|
+
return function(m) {
|
|
168
|
+
return Promise.resolve(m).then(f, y);
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function u(f, m) {
|
|
172
|
+
n[f] && (i[f] = function(l) {
|
|
173
|
+
return new Promise(function(v, b) {
|
|
174
|
+
o.push([f, l, v, b]) > 1 || a(f, l);
|
|
175
|
+
});
|
|
176
|
+
}, m && (i[f] = m(i[f])));
|
|
177
|
+
}
|
|
178
|
+
function a(f, m) {
|
|
179
|
+
try {
|
|
180
|
+
c(n[f](m));
|
|
181
|
+
} catch (l) {
|
|
182
|
+
g(o[0][3], l);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function c(f) {
|
|
186
|
+
f.value instanceof R ? Promise.resolve(f.value.v).then(d, y) : g(o[0][2], f);
|
|
187
|
+
}
|
|
188
|
+
function d(f) {
|
|
189
|
+
a("next", f);
|
|
190
|
+
}
|
|
191
|
+
function y(f) {
|
|
192
|
+
a("throw", f);
|
|
193
|
+
}
|
|
194
|
+
function g(f, m) {
|
|
195
|
+
f(m), o.shift(), o.length && a(o[0][0], o[0][1]);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function Ye(t) {
|
|
199
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
200
|
+
var r = t[Symbol.asyncIterator], e;
|
|
201
|
+
return r ? r.call(t) : (t = typeof M == "function" ? M(t) : t[Symbol.iterator](), e = {}, n("next"), n("throw"), n("return"), e[Symbol.asyncIterator] = function() {
|
|
202
|
+
return this;
|
|
203
|
+
}, e);
|
|
204
|
+
function n(o) {
|
|
205
|
+
e[o] = t[o] && function(s) {
|
|
206
|
+
return new Promise(function(u, a) {
|
|
207
|
+
s = t[o](s), i(u, a, s.done, s.value);
|
|
208
|
+
});
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function i(o, s, u, a) {
|
|
212
|
+
Promise.resolve(a).then(function(c) {
|
|
213
|
+
o({ value: c, done: u });
|
|
214
|
+
}, s);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
function O(t) {
|
|
218
|
+
return typeof t == "function";
|
|
219
|
+
}
|
|
220
|
+
function me(t) {
|
|
221
|
+
var r = function(n) {
|
|
222
|
+
Error.call(n), n.stack = new Error().stack;
|
|
223
|
+
}, e = t(r);
|
|
224
|
+
return e.prototype = Object.create(Error.prototype), e.prototype.constructor = e, e;
|
|
225
|
+
}
|
|
226
|
+
var Y = me(function(t) {
|
|
227
|
+
return function(e) {
|
|
228
|
+
t(this), this.message = e ? e.length + ` errors occurred during unsubscription:
|
|
229
|
+
` + e.map(function(n, i) {
|
|
230
|
+
return i + 1 + ") " + n.toString();
|
|
231
|
+
}).join(`
|
|
232
|
+
`) : "", this.name = "UnsubscriptionError", this.errors = e;
|
|
233
|
+
};
|
|
234
|
+
});
|
|
235
|
+
function oe(t, r) {
|
|
236
|
+
if (t) {
|
|
237
|
+
var e = t.indexOf(r);
|
|
238
|
+
0 <= e && t.splice(e, 1);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
var re = (function() {
|
|
242
|
+
function t(r) {
|
|
243
|
+
this.initialTeardown = r, this.closed = !1, this._parentage = null, this._finalizers = null;
|
|
244
|
+
}
|
|
245
|
+
return t.prototype.unsubscribe = function() {
|
|
246
|
+
var r, e, n, i, o;
|
|
247
|
+
if (!this.closed) {
|
|
248
|
+
this.closed = !0;
|
|
249
|
+
var s = this._parentage;
|
|
250
|
+
if (s)
|
|
251
|
+
if (this._parentage = null, Array.isArray(s))
|
|
252
|
+
try {
|
|
253
|
+
for (var u = M(s), a = u.next(); !a.done; a = u.next()) {
|
|
254
|
+
var c = a.value;
|
|
255
|
+
c.remove(this);
|
|
256
|
+
}
|
|
257
|
+
} catch (l) {
|
|
258
|
+
r = { error: l };
|
|
259
|
+
} finally {
|
|
260
|
+
try {
|
|
261
|
+
a && !a.done && (e = u.return) && e.call(u);
|
|
262
|
+
} finally {
|
|
263
|
+
if (r) throw r.error;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
else
|
|
267
|
+
s.remove(this);
|
|
268
|
+
var d = this.initialTeardown;
|
|
269
|
+
if (O(d))
|
|
270
|
+
try {
|
|
271
|
+
d();
|
|
272
|
+
} catch (l) {
|
|
273
|
+
o = l instanceof Y ? l.errors : [l];
|
|
274
|
+
}
|
|
275
|
+
var y = this._finalizers;
|
|
276
|
+
if (y) {
|
|
277
|
+
this._finalizers = null;
|
|
278
|
+
try {
|
|
279
|
+
for (var g = M(y), f = g.next(); !f.done; f = g.next()) {
|
|
280
|
+
var m = f.value;
|
|
281
|
+
try {
|
|
282
|
+
se(m);
|
|
283
|
+
} catch (l) {
|
|
284
|
+
o = o ?? [], l instanceof Y ? o = ee(ee([], X(o)), X(l.errors)) : o.push(l);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
} catch (l) {
|
|
288
|
+
n = { error: l };
|
|
289
|
+
} finally {
|
|
290
|
+
try {
|
|
291
|
+
f && !f.done && (i = g.return) && i.call(g);
|
|
292
|
+
} finally {
|
|
293
|
+
if (n) throw n.error;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
if (o)
|
|
298
|
+
throw new Y(o);
|
|
299
|
+
}
|
|
300
|
+
}, t.prototype.add = function(r) {
|
|
301
|
+
var e;
|
|
302
|
+
if (r && r !== this)
|
|
303
|
+
if (this.closed)
|
|
304
|
+
se(r);
|
|
305
|
+
else {
|
|
306
|
+
if (r instanceof t) {
|
|
307
|
+
if (r.closed || r._hasParent(this))
|
|
308
|
+
return;
|
|
309
|
+
r._addParent(this);
|
|
310
|
+
}
|
|
311
|
+
(this._finalizers = (e = this._finalizers) !== null && e !== void 0 ? e : []).push(r);
|
|
312
|
+
}
|
|
313
|
+
}, t.prototype._hasParent = function(r) {
|
|
314
|
+
var e = this._parentage;
|
|
315
|
+
return e === r || Array.isArray(e) && e.includes(r);
|
|
316
|
+
}, t.prototype._addParent = function(r) {
|
|
317
|
+
var e = this._parentage;
|
|
318
|
+
this._parentage = Array.isArray(e) ? (e.push(r), e) : e ? [e, r] : r;
|
|
319
|
+
}, t.prototype._removeParent = function(r) {
|
|
320
|
+
var e = this._parentage;
|
|
321
|
+
e === r ? this._parentage = null : Array.isArray(e) && oe(e, r);
|
|
322
|
+
}, t.prototype.remove = function(r) {
|
|
323
|
+
var e = this._finalizers;
|
|
324
|
+
e && oe(e, r), r instanceof t && r._removeParent(this);
|
|
325
|
+
}, t.EMPTY = (function() {
|
|
326
|
+
var r = new t();
|
|
327
|
+
return r.closed = !0, r;
|
|
328
|
+
})(), t;
|
|
329
|
+
})();
|
|
330
|
+
re.EMPTY;
|
|
331
|
+
function ge(t) {
|
|
332
|
+
return t instanceof re || t && "closed" in t && O(t.remove) && O(t.add) && O(t.unsubscribe);
|
|
333
|
+
}
|
|
334
|
+
function se(t) {
|
|
335
|
+
O(t) ? t() : t.unsubscribe();
|
|
336
|
+
}
|
|
337
|
+
var Qe = {
|
|
338
|
+
Promise: void 0
|
|
339
|
+
}, Je = {
|
|
340
|
+
setTimeout: function(t, r) {
|
|
341
|
+
for (var e = [], n = 2; n < arguments.length; n++)
|
|
342
|
+
e[n - 2] = arguments[n];
|
|
343
|
+
return setTimeout.apply(void 0, ee([t, r], X(e)));
|
|
344
|
+
},
|
|
345
|
+
clearTimeout: function(t) {
|
|
346
|
+
return clearTimeout(t);
|
|
347
|
+
},
|
|
348
|
+
delegate: void 0
|
|
349
|
+
};
|
|
350
|
+
function ye(t) {
|
|
351
|
+
Je.setTimeout(function() {
|
|
352
|
+
throw t;
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
function ce() {
|
|
356
|
+
}
|
|
357
|
+
function Ze(t) {
|
|
358
|
+
t();
|
|
359
|
+
}
|
|
360
|
+
var ne = (function(t) {
|
|
361
|
+
te(r, t);
|
|
362
|
+
function r(e) {
|
|
363
|
+
var n = t.call(this) || this;
|
|
364
|
+
return n.isStopped = !1, e ? (n.destination = e, ge(e) && e.add(n)) : n.destination = et, n;
|
|
365
|
+
}
|
|
366
|
+
return r.create = function(e, n, i) {
|
|
367
|
+
return new G(e, n, i);
|
|
368
|
+
}, r.prototype.next = function(e) {
|
|
369
|
+
this.isStopped || this._next(e);
|
|
370
|
+
}, r.prototype.error = function(e) {
|
|
371
|
+
this.isStopped || (this.isStopped = !0, this._error(e));
|
|
372
|
+
}, r.prototype.complete = function() {
|
|
373
|
+
this.isStopped || (this.isStopped = !0, this._complete());
|
|
374
|
+
}, r.prototype.unsubscribe = function() {
|
|
375
|
+
this.closed || (this.isStopped = !0, t.prototype.unsubscribe.call(this), this.destination = null);
|
|
376
|
+
}, r.prototype._next = function(e) {
|
|
377
|
+
this.destination.next(e);
|
|
378
|
+
}, r.prototype._error = function(e) {
|
|
379
|
+
try {
|
|
380
|
+
this.destination.error(e);
|
|
381
|
+
} finally {
|
|
382
|
+
this.unsubscribe();
|
|
383
|
+
}
|
|
384
|
+
}, r.prototype._complete = function() {
|
|
385
|
+
try {
|
|
386
|
+
this.destination.complete();
|
|
387
|
+
} finally {
|
|
388
|
+
this.unsubscribe();
|
|
389
|
+
}
|
|
390
|
+
}, r;
|
|
391
|
+
})(re), Ke = (function() {
|
|
392
|
+
function t(r) {
|
|
393
|
+
this.partialObserver = r;
|
|
394
|
+
}
|
|
395
|
+
return t.prototype.next = function(r) {
|
|
396
|
+
var e = this.partialObserver;
|
|
397
|
+
if (e.next)
|
|
398
|
+
try {
|
|
399
|
+
e.next(r);
|
|
400
|
+
} catch (n) {
|
|
401
|
+
$(n);
|
|
402
|
+
}
|
|
403
|
+
}, t.prototype.error = function(r) {
|
|
404
|
+
var e = this.partialObserver;
|
|
405
|
+
if (e.error)
|
|
406
|
+
try {
|
|
407
|
+
e.error(r);
|
|
408
|
+
} catch (n) {
|
|
409
|
+
$(n);
|
|
410
|
+
}
|
|
411
|
+
else
|
|
412
|
+
$(r);
|
|
413
|
+
}, t.prototype.complete = function() {
|
|
414
|
+
var r = this.partialObserver;
|
|
415
|
+
if (r.complete)
|
|
416
|
+
try {
|
|
417
|
+
r.complete();
|
|
418
|
+
} catch (e) {
|
|
419
|
+
$(e);
|
|
420
|
+
}
|
|
421
|
+
}, t;
|
|
422
|
+
})(), G = (function(t) {
|
|
423
|
+
te(r, t);
|
|
424
|
+
function r(e, n, i) {
|
|
425
|
+
var o = t.call(this) || this, s;
|
|
426
|
+
return O(e) || !e ? s = {
|
|
427
|
+
next: e ?? void 0,
|
|
428
|
+
error: n ?? void 0,
|
|
429
|
+
complete: i ?? void 0
|
|
430
|
+
} : s = e, o.destination = new Ke(s), o;
|
|
431
|
+
}
|
|
432
|
+
return r;
|
|
433
|
+
})(ne);
|
|
434
|
+
function $(t) {
|
|
435
|
+
ye(t);
|
|
436
|
+
}
|
|
437
|
+
function Xe(t) {
|
|
438
|
+
throw t;
|
|
439
|
+
}
|
|
440
|
+
var et = {
|
|
441
|
+
closed: !0,
|
|
442
|
+
next: ce,
|
|
443
|
+
error: Xe,
|
|
444
|
+
complete: ce
|
|
445
|
+
}, ie = (function() {
|
|
446
|
+
return typeof Symbol == "function" && Symbol.observable || "@@observable";
|
|
447
|
+
})();
|
|
448
|
+
function be(t) {
|
|
449
|
+
return t;
|
|
450
|
+
}
|
|
451
|
+
function tt(t) {
|
|
452
|
+
return t.length === 0 ? be : t.length === 1 ? t[0] : function(e) {
|
|
453
|
+
return t.reduce(function(n, i) {
|
|
454
|
+
return i(n);
|
|
455
|
+
}, e);
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
var P = (function() {
|
|
459
|
+
function t(r) {
|
|
460
|
+
r && (this._subscribe = r);
|
|
461
|
+
}
|
|
462
|
+
return t.prototype.lift = function(r) {
|
|
463
|
+
var e = new t();
|
|
464
|
+
return e.source = this, e.operator = r, e;
|
|
465
|
+
}, t.prototype.subscribe = function(r, e, n) {
|
|
466
|
+
var i = this, o = nt(r) ? r : new G(r, e, n);
|
|
467
|
+
return Ze(function() {
|
|
468
|
+
var s = i, u = s.operator, a = s.source;
|
|
469
|
+
o.add(u ? u.call(o, a) : a ? i._subscribe(o) : i._trySubscribe(o));
|
|
470
|
+
}), o;
|
|
471
|
+
}, t.prototype._trySubscribe = function(r) {
|
|
472
|
+
try {
|
|
473
|
+
return this._subscribe(r);
|
|
474
|
+
} catch (e) {
|
|
475
|
+
r.error(e);
|
|
476
|
+
}
|
|
477
|
+
}, t.prototype.forEach = function(r, e) {
|
|
478
|
+
var n = this;
|
|
479
|
+
return e = ae(e), new e(function(i, o) {
|
|
480
|
+
var s = new G({
|
|
481
|
+
next: function(u) {
|
|
482
|
+
try {
|
|
483
|
+
r(u);
|
|
484
|
+
} catch (a) {
|
|
485
|
+
o(a), s.unsubscribe();
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
error: o,
|
|
489
|
+
complete: i
|
|
490
|
+
});
|
|
491
|
+
n.subscribe(s);
|
|
492
|
+
});
|
|
493
|
+
}, t.prototype._subscribe = function(r) {
|
|
494
|
+
var e;
|
|
495
|
+
return (e = this.source) === null || e === void 0 ? void 0 : e.subscribe(r);
|
|
496
|
+
}, t.prototype[ie] = function() {
|
|
497
|
+
return this;
|
|
498
|
+
}, t.prototype.pipe = function() {
|
|
499
|
+
for (var r = [], e = 0; e < arguments.length; e++)
|
|
500
|
+
r[e] = arguments[e];
|
|
501
|
+
return tt(r)(this);
|
|
502
|
+
}, t.prototype.toPromise = function(r) {
|
|
503
|
+
var e = this;
|
|
504
|
+
return r = ae(r), new r(function(n, i) {
|
|
505
|
+
var o;
|
|
506
|
+
e.subscribe(function(s) {
|
|
507
|
+
return o = s;
|
|
508
|
+
}, function(s) {
|
|
509
|
+
return i(s);
|
|
510
|
+
}, function() {
|
|
511
|
+
return n(o);
|
|
512
|
+
});
|
|
513
|
+
});
|
|
514
|
+
}, t.create = function(r) {
|
|
515
|
+
return new t(r);
|
|
516
|
+
}, t;
|
|
517
|
+
})();
|
|
518
|
+
function ae(t) {
|
|
519
|
+
var r;
|
|
520
|
+
return (r = t ?? Qe.Promise) !== null && r !== void 0 ? r : Promise;
|
|
521
|
+
}
|
|
522
|
+
function rt(t) {
|
|
523
|
+
return t && O(t.next) && O(t.error) && O(t.complete);
|
|
524
|
+
}
|
|
525
|
+
function nt(t) {
|
|
526
|
+
return t && t instanceof ne || rt(t) && ge(t);
|
|
527
|
+
}
|
|
528
|
+
function it(t) {
|
|
529
|
+
return O(t == null ? void 0 : t.lift);
|
|
530
|
+
}
|
|
531
|
+
function N(t) {
|
|
532
|
+
return function(r) {
|
|
533
|
+
if (it(r))
|
|
534
|
+
return r.lift(function(e) {
|
|
535
|
+
try {
|
|
536
|
+
return t(e, this);
|
|
537
|
+
} catch (n) {
|
|
538
|
+
this.error(n);
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
throw new TypeError("Unable to lift unknown Observable type");
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
function H(t, r, e, n, i) {
|
|
545
|
+
return new ot(t, r, e, n, i);
|
|
546
|
+
}
|
|
547
|
+
var ot = (function(t) {
|
|
548
|
+
te(r, t);
|
|
549
|
+
function r(e, n, i, o, s, u) {
|
|
550
|
+
var a = t.call(this, e) || this;
|
|
551
|
+
return a.onFinalize = s, a.shouldUnsubscribe = u, a._next = n ? function(c) {
|
|
552
|
+
try {
|
|
553
|
+
n(c);
|
|
554
|
+
} catch (d) {
|
|
555
|
+
e.error(d);
|
|
556
|
+
}
|
|
557
|
+
} : t.prototype._next, a._error = o ? function(c) {
|
|
558
|
+
try {
|
|
559
|
+
o(c);
|
|
560
|
+
} catch (d) {
|
|
561
|
+
e.error(d);
|
|
562
|
+
} finally {
|
|
563
|
+
this.unsubscribe();
|
|
564
|
+
}
|
|
565
|
+
} : t.prototype._error, a._complete = i ? function() {
|
|
566
|
+
try {
|
|
567
|
+
i();
|
|
568
|
+
} catch (c) {
|
|
569
|
+
e.error(c);
|
|
570
|
+
} finally {
|
|
571
|
+
this.unsubscribe();
|
|
572
|
+
}
|
|
573
|
+
} : t.prototype._complete, a;
|
|
574
|
+
}
|
|
575
|
+
return r.prototype.unsubscribe = function() {
|
|
576
|
+
var e;
|
|
577
|
+
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
|
|
578
|
+
var n = this.closed;
|
|
579
|
+
t.prototype.unsubscribe.call(this), !n && ((e = this.onFinalize) === null || e === void 0 || e.call(this));
|
|
580
|
+
}
|
|
581
|
+
}, r;
|
|
582
|
+
})(ne), st = new P(function(t) {
|
|
583
|
+
return t.complete();
|
|
584
|
+
});
|
|
585
|
+
function ct(t) {
|
|
586
|
+
return t && O(t.schedule);
|
|
587
|
+
}
|
|
588
|
+
function pe(t) {
|
|
589
|
+
return t[t.length - 1];
|
|
590
|
+
}
|
|
591
|
+
function at(t) {
|
|
592
|
+
return ct(pe(t)) ? t.pop() : void 0;
|
|
593
|
+
}
|
|
594
|
+
function ut(t, r) {
|
|
595
|
+
return typeof pe(t) == "number" ? t.pop() : r;
|
|
596
|
+
}
|
|
597
|
+
var we = (function(t) {
|
|
598
|
+
return t && typeof t.length == "number" && typeof t != "function";
|
|
599
|
+
});
|
|
600
|
+
function ve(t) {
|
|
601
|
+
return O(t == null ? void 0 : t.then);
|
|
602
|
+
}
|
|
603
|
+
function Se(t) {
|
|
604
|
+
return O(t[ie]);
|
|
605
|
+
}
|
|
606
|
+
function xe(t) {
|
|
607
|
+
return Symbol.asyncIterator && O(t == null ? void 0 : t[Symbol.asyncIterator]);
|
|
608
|
+
}
|
|
609
|
+
function Ie(t) {
|
|
610
|
+
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.");
|
|
611
|
+
}
|
|
612
|
+
function ft() {
|
|
613
|
+
return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
|
|
614
|
+
}
|
|
615
|
+
var Be = ft();
|
|
616
|
+
function Ue(t) {
|
|
617
|
+
return O(t == null ? void 0 : t[Be]);
|
|
618
|
+
}
|
|
619
|
+
function Oe(t) {
|
|
620
|
+
return qe(this, arguments, function() {
|
|
621
|
+
var e, n, i, o;
|
|
622
|
+
return de(this, function(s) {
|
|
623
|
+
switch (s.label) {
|
|
624
|
+
case 0:
|
|
625
|
+
e = t.getReader(), s.label = 1;
|
|
626
|
+
case 1:
|
|
627
|
+
s.trys.push([1, , 9, 10]), s.label = 2;
|
|
628
|
+
case 2:
|
|
629
|
+
return [4, R(e.read())];
|
|
630
|
+
case 3:
|
|
631
|
+
return n = s.sent(), i = n.value, o = n.done, o ? [4, R(void 0)] : [3, 5];
|
|
632
|
+
case 4:
|
|
633
|
+
return [2, s.sent()];
|
|
634
|
+
case 5:
|
|
635
|
+
return [4, R(i)];
|
|
636
|
+
case 6:
|
|
637
|
+
return [4, s.sent()];
|
|
638
|
+
case 7:
|
|
639
|
+
return s.sent(), [3, 2];
|
|
640
|
+
case 8:
|
|
641
|
+
return [3, 10];
|
|
642
|
+
case 9:
|
|
643
|
+
return e.releaseLock(), [7];
|
|
644
|
+
case 10:
|
|
645
|
+
return [2];
|
|
646
|
+
}
|
|
647
|
+
});
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
function ke(t) {
|
|
651
|
+
return O(t == null ? void 0 : t.getReader);
|
|
652
|
+
}
|
|
653
|
+
function L(t) {
|
|
654
|
+
if (t instanceof P)
|
|
655
|
+
return t;
|
|
656
|
+
if (t != null) {
|
|
657
|
+
if (Se(t))
|
|
658
|
+
return lt(t);
|
|
659
|
+
if (we(t))
|
|
660
|
+
return ht(t);
|
|
661
|
+
if (ve(t))
|
|
662
|
+
return dt(t);
|
|
663
|
+
if (xe(t))
|
|
664
|
+
return Ee(t);
|
|
665
|
+
if (Ue(t))
|
|
666
|
+
return mt(t);
|
|
667
|
+
if (ke(t))
|
|
668
|
+
return gt(t);
|
|
669
|
+
}
|
|
670
|
+
throw Ie(t);
|
|
671
|
+
}
|
|
672
|
+
function lt(t) {
|
|
673
|
+
return new P(function(r) {
|
|
674
|
+
var e = t[ie]();
|
|
675
|
+
if (O(e.subscribe))
|
|
676
|
+
return e.subscribe(r);
|
|
677
|
+
throw new TypeError("Provided object does not correctly implement Symbol.observable");
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
function ht(t) {
|
|
681
|
+
return new P(function(r) {
|
|
682
|
+
for (var e = 0; e < t.length && !r.closed; e++)
|
|
683
|
+
r.next(t[e]);
|
|
684
|
+
r.complete();
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
function dt(t) {
|
|
688
|
+
return new P(function(r) {
|
|
689
|
+
t.then(function(e) {
|
|
690
|
+
r.closed || (r.next(e), r.complete());
|
|
691
|
+
}, function(e) {
|
|
692
|
+
return r.error(e);
|
|
693
|
+
}).then(null, ye);
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
function mt(t) {
|
|
697
|
+
return new P(function(r) {
|
|
698
|
+
var e, n;
|
|
699
|
+
try {
|
|
700
|
+
for (var i = M(t), o = i.next(); !o.done; o = i.next()) {
|
|
701
|
+
var s = o.value;
|
|
702
|
+
if (r.next(s), r.closed)
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
} catch (u) {
|
|
706
|
+
e = { error: u };
|
|
707
|
+
} finally {
|
|
708
|
+
try {
|
|
709
|
+
o && !o.done && (n = i.return) && n.call(i);
|
|
710
|
+
} finally {
|
|
711
|
+
if (e) throw e.error;
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
r.complete();
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
function Ee(t) {
|
|
718
|
+
return new P(function(r) {
|
|
719
|
+
yt(t, r).catch(function(e) {
|
|
720
|
+
return r.error(e);
|
|
721
|
+
});
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
function gt(t) {
|
|
725
|
+
return Ee(Oe(t));
|
|
726
|
+
}
|
|
727
|
+
function yt(t, r) {
|
|
728
|
+
var e, n, i, o;
|
|
729
|
+
return We(this, void 0, void 0, function() {
|
|
730
|
+
var s, u;
|
|
731
|
+
return de(this, function(a) {
|
|
732
|
+
switch (a.label) {
|
|
733
|
+
case 0:
|
|
734
|
+
a.trys.push([0, 5, 6, 11]), e = Ye(t), a.label = 1;
|
|
735
|
+
case 1:
|
|
736
|
+
return [4, e.next()];
|
|
737
|
+
case 2:
|
|
738
|
+
if (n = a.sent(), !!n.done) return [3, 4];
|
|
739
|
+
if (s = n.value, r.next(s), r.closed)
|
|
740
|
+
return [2];
|
|
741
|
+
a.label = 3;
|
|
742
|
+
case 3:
|
|
743
|
+
return [3, 1];
|
|
744
|
+
case 4:
|
|
745
|
+
return [3, 11];
|
|
746
|
+
case 5:
|
|
747
|
+
return u = a.sent(), i = { error: u }, [3, 11];
|
|
748
|
+
case 6:
|
|
749
|
+
return a.trys.push([6, , 9, 10]), n && !n.done && (o = e.return) ? [4, o.call(e)] : [3, 8];
|
|
750
|
+
case 7:
|
|
751
|
+
a.sent(), a.label = 8;
|
|
752
|
+
case 8:
|
|
753
|
+
return [3, 10];
|
|
754
|
+
case 9:
|
|
755
|
+
if (i) throw i.error;
|
|
756
|
+
return [7];
|
|
757
|
+
case 10:
|
|
758
|
+
return [7];
|
|
759
|
+
case 11:
|
|
760
|
+
return r.complete(), [2];
|
|
761
|
+
}
|
|
762
|
+
});
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
function z(t, r, e, n, i) {
|
|
766
|
+
n === void 0 && (n = 0), i === void 0 && (i = !1);
|
|
767
|
+
var o = r.schedule(function() {
|
|
768
|
+
e(), i ? t.add(this.schedule(null, n)) : this.unsubscribe();
|
|
769
|
+
}, n);
|
|
770
|
+
if (t.add(o), !i)
|
|
771
|
+
return o;
|
|
772
|
+
}
|
|
773
|
+
function Te(t, r) {
|
|
774
|
+
return r === void 0 && (r = 0), N(function(e, n) {
|
|
775
|
+
e.subscribe(H(n, function(i) {
|
|
776
|
+
return z(n, t, function() {
|
|
777
|
+
return n.next(i);
|
|
778
|
+
}, r);
|
|
779
|
+
}, function() {
|
|
780
|
+
return z(n, t, function() {
|
|
781
|
+
return n.complete();
|
|
782
|
+
}, r);
|
|
783
|
+
}, function(i) {
|
|
784
|
+
return z(n, t, function() {
|
|
785
|
+
return n.error(i);
|
|
786
|
+
}, r);
|
|
787
|
+
}));
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
function _e(t, r) {
|
|
791
|
+
return r === void 0 && (r = 0), N(function(e, n) {
|
|
792
|
+
n.add(t.schedule(function() {
|
|
793
|
+
return e.subscribe(n);
|
|
794
|
+
}, r));
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
function bt(t, r) {
|
|
798
|
+
return L(t).pipe(_e(r), Te(r));
|
|
799
|
+
}
|
|
800
|
+
function pt(t, r) {
|
|
801
|
+
return L(t).pipe(_e(r), Te(r));
|
|
802
|
+
}
|
|
803
|
+
function wt(t, r) {
|
|
804
|
+
return new P(function(e) {
|
|
805
|
+
var n = 0;
|
|
806
|
+
return r.schedule(function() {
|
|
807
|
+
n === t.length ? e.complete() : (e.next(t[n++]), e.closed || this.schedule());
|
|
808
|
+
});
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
function vt(t, r) {
|
|
812
|
+
return new P(function(e) {
|
|
813
|
+
var n;
|
|
814
|
+
return z(e, r, function() {
|
|
815
|
+
n = t[Be](), z(e, r, function() {
|
|
816
|
+
var i, o, s;
|
|
817
|
+
try {
|
|
818
|
+
i = n.next(), o = i.value, s = i.done;
|
|
819
|
+
} catch (u) {
|
|
820
|
+
e.error(u);
|
|
821
|
+
return;
|
|
822
|
+
}
|
|
823
|
+
s ? e.complete() : e.next(o);
|
|
824
|
+
}, 0, !0);
|
|
825
|
+
}), function() {
|
|
826
|
+
return O(n == null ? void 0 : n.return) && n.return();
|
|
827
|
+
};
|
|
828
|
+
});
|
|
829
|
+
}
|
|
830
|
+
function Ce(t, r) {
|
|
831
|
+
if (!t)
|
|
832
|
+
throw new Error("Iterable cannot be null");
|
|
833
|
+
return new P(function(e) {
|
|
834
|
+
z(e, r, function() {
|
|
835
|
+
var n = t[Symbol.asyncIterator]();
|
|
836
|
+
z(e, r, function() {
|
|
837
|
+
n.next().then(function(i) {
|
|
838
|
+
i.done ? e.complete() : e.next(i.value);
|
|
839
|
+
});
|
|
840
|
+
}, 0, !0);
|
|
841
|
+
});
|
|
842
|
+
});
|
|
843
|
+
}
|
|
844
|
+
function St(t, r) {
|
|
845
|
+
return Ce(Oe(t), r);
|
|
846
|
+
}
|
|
847
|
+
function xt(t, r) {
|
|
848
|
+
if (t != null) {
|
|
849
|
+
if (Se(t))
|
|
850
|
+
return bt(t, r);
|
|
851
|
+
if (we(t))
|
|
852
|
+
return wt(t, r);
|
|
853
|
+
if (ve(t))
|
|
854
|
+
return pt(t, r);
|
|
855
|
+
if (xe(t))
|
|
856
|
+
return Ce(t, r);
|
|
857
|
+
if (Ue(t))
|
|
858
|
+
return vt(t, r);
|
|
859
|
+
if (ke(t))
|
|
860
|
+
return St(t, r);
|
|
861
|
+
}
|
|
862
|
+
throw Ie(t);
|
|
863
|
+
}
|
|
864
|
+
function It(t, r) {
|
|
865
|
+
return r ? xt(t, r) : L(t);
|
|
866
|
+
}
|
|
867
|
+
var Bt = me(function(t) {
|
|
868
|
+
return function() {
|
|
869
|
+
t(this), this.name = "EmptyError", this.message = "no elements in sequence";
|
|
870
|
+
};
|
|
871
|
+
});
|
|
872
|
+
function Pe(t, r) {
|
|
873
|
+
return new Promise(function(e, n) {
|
|
874
|
+
var i = new G({
|
|
875
|
+
next: function(o) {
|
|
876
|
+
e(o), i.unsubscribe();
|
|
877
|
+
},
|
|
878
|
+
error: n,
|
|
879
|
+
complete: function() {
|
|
880
|
+
n(new Bt());
|
|
881
|
+
}
|
|
882
|
+
});
|
|
883
|
+
t.subscribe(i);
|
|
884
|
+
});
|
|
885
|
+
}
|
|
886
|
+
function Ve(t, r) {
|
|
887
|
+
return N(function(e, n) {
|
|
888
|
+
var i = 0;
|
|
889
|
+
e.subscribe(H(n, function(o) {
|
|
890
|
+
n.next(t.call(r, o, i++));
|
|
891
|
+
}));
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
function Ut(t, r, e, n, i, o, s, u) {
|
|
895
|
+
var a = [], c = 0, d = 0, y = !1, g = function() {
|
|
896
|
+
y && !a.length && !c && r.complete();
|
|
897
|
+
}, f = function(l) {
|
|
898
|
+
return c < n ? m(l) : a.push(l);
|
|
899
|
+
}, m = function(l) {
|
|
900
|
+
c++;
|
|
901
|
+
var v = !1;
|
|
902
|
+
L(e(l, d++)).subscribe(H(r, function(b) {
|
|
903
|
+
r.next(b);
|
|
904
|
+
}, function() {
|
|
905
|
+
v = !0;
|
|
906
|
+
}, void 0, function() {
|
|
907
|
+
if (v)
|
|
908
|
+
try {
|
|
909
|
+
c--;
|
|
910
|
+
for (var b = function() {
|
|
911
|
+
var S = a.shift();
|
|
912
|
+
s || m(S);
|
|
913
|
+
}; a.length && c < n; )
|
|
914
|
+
b();
|
|
915
|
+
g();
|
|
916
|
+
} catch (S) {
|
|
917
|
+
r.error(S);
|
|
918
|
+
}
|
|
919
|
+
}));
|
|
920
|
+
};
|
|
921
|
+
return t.subscribe(H(r, f, function() {
|
|
922
|
+
y = !0, g();
|
|
923
|
+
})), function() {
|
|
924
|
+
};
|
|
925
|
+
}
|
|
926
|
+
function Ae(t, r, e) {
|
|
927
|
+
return e === void 0 && (e = 1 / 0), O(r) ? Ae(function(n, i) {
|
|
928
|
+
return Ve(function(o, s) {
|
|
929
|
+
return r(n, o, i, s);
|
|
930
|
+
})(L(t(n, i)));
|
|
931
|
+
}, e) : (typeof r == "number" && (e = r), N(function(n, i) {
|
|
932
|
+
return Ut(n, i, t, e);
|
|
933
|
+
}));
|
|
934
|
+
}
|
|
935
|
+
function Ot(t) {
|
|
936
|
+
return t === void 0 && (t = 1 / 0), Ae(be, t);
|
|
937
|
+
}
|
|
938
|
+
function kt() {
|
|
939
|
+
for (var t = [], r = 0; r < arguments.length; r++)
|
|
940
|
+
t[r] = arguments[r];
|
|
941
|
+
var e = at(t), n = ut(t, 1 / 0), i = t;
|
|
942
|
+
return i.length ? i.length === 1 ? L(i[0]) : Ot(n)(It(i, e)) : st;
|
|
943
|
+
}
|
|
944
|
+
function Et(t, r, e, n, i) {
|
|
945
|
+
return function(o, s) {
|
|
946
|
+
var u = e, a = r, c = 0;
|
|
947
|
+
o.subscribe(H(s, function(d) {
|
|
948
|
+
var y = c++;
|
|
949
|
+
a = u ? t(a, d, y) : (u = !0, d);
|
|
950
|
+
}, (function() {
|
|
951
|
+
u && s.next(a), s.complete();
|
|
952
|
+
})));
|
|
953
|
+
};
|
|
954
|
+
}
|
|
955
|
+
function ze(t, r) {
|
|
956
|
+
return N(Et(t, r, arguments.length >= 2, !1, !0));
|
|
957
|
+
}
|
|
958
|
+
var Tt = function(t, r) {
|
|
959
|
+
return t.push(r), t;
|
|
960
|
+
};
|
|
961
|
+
function _t() {
|
|
962
|
+
return N(function(t, r) {
|
|
963
|
+
ze(Tt, [])(t).subscribe(r);
|
|
964
|
+
});
|
|
965
|
+
}
|
|
966
|
+
function Ct(t) {
|
|
967
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
968
|
+
}
|
|
969
|
+
var Q, ue;
|
|
970
|
+
function Pt() {
|
|
971
|
+
if (ue) return Q;
|
|
972
|
+
ue = 1;
|
|
973
|
+
class t {
|
|
974
|
+
constructor(e = {}) {
|
|
975
|
+
if (!(e.maxSize && e.maxSize > 0))
|
|
976
|
+
throw new TypeError("`maxSize` must be a number greater than 0");
|
|
977
|
+
this.maxSize = e.maxSize, this.cache = /* @__PURE__ */ new Map(), this.oldCache = /* @__PURE__ */ new Map(), this._size = 0;
|
|
978
|
+
}
|
|
979
|
+
_set(e, n) {
|
|
980
|
+
this.cache.set(e, n), this._size++, this._size >= this.maxSize && (this._size = 0, this.oldCache = this.cache, this.cache = /* @__PURE__ */ new Map());
|
|
981
|
+
}
|
|
982
|
+
get(e) {
|
|
983
|
+
if (this.cache.has(e))
|
|
984
|
+
return this.cache.get(e);
|
|
985
|
+
if (this.oldCache.has(e)) {
|
|
986
|
+
const n = this.oldCache.get(e);
|
|
987
|
+
return this.oldCache.delete(e), this._set(e, n), n;
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
set(e, n) {
|
|
991
|
+
return this.cache.has(e) ? this.cache.set(e, n) : this._set(e, n), this;
|
|
992
|
+
}
|
|
993
|
+
has(e) {
|
|
994
|
+
return this.cache.has(e) || this.oldCache.has(e);
|
|
995
|
+
}
|
|
996
|
+
peek(e) {
|
|
997
|
+
if (this.cache.has(e))
|
|
998
|
+
return this.cache.get(e);
|
|
999
|
+
if (this.oldCache.has(e))
|
|
1000
|
+
return this.oldCache.get(e);
|
|
1001
|
+
}
|
|
1002
|
+
delete(e) {
|
|
1003
|
+
const n = this.cache.delete(e);
|
|
1004
|
+
return n && this._size--, this.oldCache.delete(e) || n;
|
|
1005
|
+
}
|
|
1006
|
+
clear() {
|
|
1007
|
+
this.cache.clear(), this.oldCache.clear(), this._size = 0;
|
|
1008
|
+
}
|
|
1009
|
+
*keys() {
|
|
1010
|
+
for (const [e] of this)
|
|
1011
|
+
yield e;
|
|
1012
|
+
}
|
|
1013
|
+
*values() {
|
|
1014
|
+
for (const [, e] of this)
|
|
1015
|
+
yield e;
|
|
1016
|
+
}
|
|
1017
|
+
*[Symbol.iterator]() {
|
|
1018
|
+
for (const e of this.cache)
|
|
1019
|
+
yield e;
|
|
1020
|
+
for (const e of this.oldCache) {
|
|
1021
|
+
const [n] = e;
|
|
1022
|
+
this.cache.has(n) || (yield e);
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
get size() {
|
|
1026
|
+
let e = 0;
|
|
1027
|
+
for (const n of this.oldCache.keys())
|
|
1028
|
+
this.cache.has(n) || e++;
|
|
1029
|
+
return this._size + e;
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
return Q = t, Q;
|
|
1033
|
+
}
|
|
1034
|
+
var Vt = Pt();
|
|
1035
|
+
const Fe = /* @__PURE__ */ Ct(Vt);
|
|
1036
|
+
class D {
|
|
1037
|
+
constructor(r) {
|
|
1038
|
+
E(this, "ranges");
|
|
1039
|
+
this.ranges = r;
|
|
1040
|
+
}
|
|
1041
|
+
get min() {
|
|
1042
|
+
return this.ranges[0].min;
|
|
1043
|
+
}
|
|
1044
|
+
get max() {
|
|
1045
|
+
return this.ranges.at(-1).max;
|
|
1046
|
+
}
|
|
1047
|
+
contains(r) {
|
|
1048
|
+
for (const e of this.ranges)
|
|
1049
|
+
if (e.min <= r && e.max >= r)
|
|
1050
|
+
return !0;
|
|
1051
|
+
return !1;
|
|
1052
|
+
}
|
|
1053
|
+
isContiguous() {
|
|
1054
|
+
return this.ranges.length > 1;
|
|
1055
|
+
}
|
|
1056
|
+
getRanges() {
|
|
1057
|
+
return this.ranges.map((r) => new D([{ min: r.min, max: r.max }]));
|
|
1058
|
+
}
|
|
1059
|
+
toString() {
|
|
1060
|
+
return this.ranges.map((r) => `[${r.min}-${r.max}]`).join(",");
|
|
1061
|
+
}
|
|
1062
|
+
union(r) {
|
|
1063
|
+
const e = [...this.getRanges(), ...r.getRanges()].sort((o, s) => o.min < s.min ? -1 : o.min > s.min ? 1 : o.max < s.max ? -1 : s.max > o.max ? 1 : 0), n = [];
|
|
1064
|
+
let i = e[0];
|
|
1065
|
+
for (const o of e)
|
|
1066
|
+
o.min > i.max + 1 ? (n.push(i), i = o) : o.max > i.max && (i = new D([{ min: i.min, max: o.max }]));
|
|
1067
|
+
return n.push(i), n.length === 1 ? n[0] : new D(n);
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
function At(t) {
|
|
1071
|
+
return $e(t.subarray(2), void 0);
|
|
1072
|
+
}
|
|
1073
|
+
class zt extends Error {
|
|
1074
|
+
constructor(e) {
|
|
1075
|
+
super(e);
|
|
1076
|
+
E(this, "code");
|
|
1077
|
+
this.code = "ERR_ABORTED";
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
function Ft(t) {
|
|
1081
|
+
t.sort((i, o) => i.offset - o.offset);
|
|
1082
|
+
const r = [];
|
|
1083
|
+
let e, n;
|
|
1084
|
+
for (const i of t)
|
|
1085
|
+
e && n && i.offset - n <= 2e3 ? (e.length = e.length + i.length - n + i.offset, e.blocks.push(i)) : r.push(e = {
|
|
1086
|
+
blocks: [i],
|
|
1087
|
+
length: i.length,
|
|
1088
|
+
offset: i.offset
|
|
1089
|
+
}), n = e.offset + e.length;
|
|
1090
|
+
return r;
|
|
1091
|
+
}
|
|
1092
|
+
function j(t) {
|
|
1093
|
+
if (t && t.aborted)
|
|
1094
|
+
if (typeof DOMException > "u") {
|
|
1095
|
+
const r = new zt("aborted");
|
|
1096
|
+
throw r.code = "ERR_ABORTED", r;
|
|
1097
|
+
} else
|
|
1098
|
+
throw new DOMException("aborted", "AbortError");
|
|
1099
|
+
}
|
|
1100
|
+
const J = typeof TextDecoder < "u" ? new TextDecoder("utf8") : void 0;
|
|
1101
|
+
function Z(t, r, e, n) {
|
|
1102
|
+
return t < n && r >= e;
|
|
1103
|
+
}
|
|
1104
|
+
class Re {
|
|
1105
|
+
constructor(r, e, n, i, o) {
|
|
1106
|
+
E(this, "bbi");
|
|
1107
|
+
E(this, "refsByName");
|
|
1108
|
+
E(this, "cirTreeOffset");
|
|
1109
|
+
E(this, "isCompressed");
|
|
1110
|
+
E(this, "blockType");
|
|
1111
|
+
E(this, "cirTreePromise");
|
|
1112
|
+
E(this, "featureCache", new le({
|
|
1113
|
+
cache: new Fe({ maxSize: 1e3 }),
|
|
1114
|
+
fill: async ({ length: r, offset: e }, n) => this.bbi.read(r, e, { signal: n })
|
|
1115
|
+
}));
|
|
1116
|
+
if (this.bbi = r, this.refsByName = e, this.cirTreeOffset = n, this.isCompressed = i, this.blockType = o, !(n >= 0))
|
|
1117
|
+
throw new Error("invalid cirTreeOffset!");
|
|
1118
|
+
}
|
|
1119
|
+
async readWigData(r, e, n, i, o) {
|
|
1120
|
+
try {
|
|
1121
|
+
const s = this.refsByName[r];
|
|
1122
|
+
s === void 0 && i.complete();
|
|
1123
|
+
const u = { chrId: s, start: e, end: n };
|
|
1124
|
+
this.cirTreePromise || (this.cirTreePromise = this.bbi.read(48, this.cirTreeOffset, o));
|
|
1125
|
+
const a = await this.cirTreePromise, d = new DataView(a.buffer).getUint32(4, !0);
|
|
1126
|
+
let y = [], g = 0;
|
|
1127
|
+
const f = (b, S, B) => {
|
|
1128
|
+
try {
|
|
1129
|
+
const p = b.subarray(S), w = new DataView(p.buffer, p.byteOffset, p.length);
|
|
1130
|
+
let h = 0;
|
|
1131
|
+
const U = w.getUint8(h);
|
|
1132
|
+
h += 2;
|
|
1133
|
+
const T = w.getUint16(h, !0);
|
|
1134
|
+
if (h += 2, U === 1) {
|
|
1135
|
+
const _ = [];
|
|
1136
|
+
for (let I = 0; I < T; I++) {
|
|
1137
|
+
const k = w.getUint32(h, !0);
|
|
1138
|
+
h += 4;
|
|
1139
|
+
const C = w.getUint32(h, !0);
|
|
1140
|
+
h += 4;
|
|
1141
|
+
const V = w.getUint32(h, !0);
|
|
1142
|
+
h += 4;
|
|
1143
|
+
const A = w.getUint32(h, !0);
|
|
1144
|
+
h += 4;
|
|
1145
|
+
const W = Number(w.getBigUint64(h, !0));
|
|
1146
|
+
h += 8;
|
|
1147
|
+
const q = Number(w.getBigUint64(h, !0));
|
|
1148
|
+
h += 8, _.push({
|
|
1149
|
+
startChrom: k,
|
|
1150
|
+
startBase: C,
|
|
1151
|
+
endBase: A,
|
|
1152
|
+
endChrom: V,
|
|
1153
|
+
blockOffset: W,
|
|
1154
|
+
blockSize: q,
|
|
1155
|
+
offset: h
|
|
1156
|
+
});
|
|
1157
|
+
}
|
|
1158
|
+
y = y.concat(_.filter((I) => m(I)).map((I) => ({
|
|
1159
|
+
offset: I.blockOffset,
|
|
1160
|
+
length: I.blockSize
|
|
1161
|
+
})));
|
|
1162
|
+
} else if (U === 0) {
|
|
1163
|
+
const _ = [];
|
|
1164
|
+
for (let k = 0; k < T; k++) {
|
|
1165
|
+
const C = w.getUint32(h, !0);
|
|
1166
|
+
h += 4;
|
|
1167
|
+
const V = w.getUint32(h, !0);
|
|
1168
|
+
h += 4;
|
|
1169
|
+
const A = w.getUint32(h, !0);
|
|
1170
|
+
h += 4;
|
|
1171
|
+
const W = w.getUint32(h, !0);
|
|
1172
|
+
h += 4;
|
|
1173
|
+
const q = Number(w.getBigUint64(h, !0));
|
|
1174
|
+
h += 8, _.push({
|
|
1175
|
+
startChrom: C,
|
|
1176
|
+
startBase: V,
|
|
1177
|
+
endChrom: A,
|
|
1178
|
+
endBase: W,
|
|
1179
|
+
blockOffset: q,
|
|
1180
|
+
offset: h
|
|
1181
|
+
});
|
|
1182
|
+
}
|
|
1183
|
+
const I = _.filter((k) => m(k)).map((k) => k.blockOffset);
|
|
1184
|
+
I.length > 0 && v(I, B + 1);
|
|
1185
|
+
}
|
|
1186
|
+
} catch (x) {
|
|
1187
|
+
i.error(x);
|
|
1188
|
+
}
|
|
1189
|
+
}, m = (b) => {
|
|
1190
|
+
const { startChrom: S, startBase: B, endChrom: x, endBase: p } = b;
|
|
1191
|
+
return (S < s || S === s && B <= n) && (x > s || x === s && p >= e);
|
|
1192
|
+
}, l = async (b, S, B) => {
|
|
1193
|
+
try {
|
|
1194
|
+
const x = S.max - S.min, p = S.min, w = await this.featureCache.get(`${x}_${p}`, { length: x, offset: p }, o == null ? void 0 : o.signal);
|
|
1195
|
+
for (const h of b)
|
|
1196
|
+
S.contains(h) && (f(w, h - p, B), g -= 1, g === 0 && this.readFeatures(i, y, {
|
|
1197
|
+
...o,
|
|
1198
|
+
request: u
|
|
1199
|
+
}).catch((U) => {
|
|
1200
|
+
i.error(U);
|
|
1201
|
+
}));
|
|
1202
|
+
} catch (x) {
|
|
1203
|
+
i.error(x);
|
|
1204
|
+
}
|
|
1205
|
+
}, v = (b, S) => {
|
|
1206
|
+
try {
|
|
1207
|
+
g += b.length;
|
|
1208
|
+
const B = 4 + d * 32;
|
|
1209
|
+
let x = new D([
|
|
1210
|
+
{
|
|
1211
|
+
min: b[0],
|
|
1212
|
+
max: b[0] + B
|
|
1213
|
+
}
|
|
1214
|
+
]);
|
|
1215
|
+
for (let p = 1; p < b.length; p += 1) {
|
|
1216
|
+
const w = new D([
|
|
1217
|
+
{
|
|
1218
|
+
min: b[p],
|
|
1219
|
+
max: b[p] + B
|
|
1220
|
+
}
|
|
1221
|
+
]);
|
|
1222
|
+
x = x.union(w);
|
|
1223
|
+
}
|
|
1224
|
+
x.getRanges().map((p) => l(b, p, S));
|
|
1225
|
+
} catch (B) {
|
|
1226
|
+
i.error(B);
|
|
1227
|
+
}
|
|
1228
|
+
};
|
|
1229
|
+
v([this.cirTreeOffset + 48], 1);
|
|
1230
|
+
return;
|
|
1231
|
+
} catch (s) {
|
|
1232
|
+
i.error(s);
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
parseSummaryBlock(r, e, n) {
|
|
1236
|
+
const i = [];
|
|
1237
|
+
let o = e;
|
|
1238
|
+
const s = new DataView(r.buffer, r.byteOffset, r.length);
|
|
1239
|
+
for (; o < r.byteLength; ) {
|
|
1240
|
+
const u = s.getUint32(o, !0);
|
|
1241
|
+
o += 4;
|
|
1242
|
+
const a = s.getUint32(o, !0);
|
|
1243
|
+
o += 4;
|
|
1244
|
+
const c = s.getUint32(o, !0);
|
|
1245
|
+
o += 4;
|
|
1246
|
+
const d = s.getUint32(o, !0);
|
|
1247
|
+
o += 4;
|
|
1248
|
+
const y = s.getFloat32(o, !0);
|
|
1249
|
+
o += 4;
|
|
1250
|
+
const g = s.getFloat32(o, !0);
|
|
1251
|
+
o += 4;
|
|
1252
|
+
const f = s.getFloat32(o, !0);
|
|
1253
|
+
o += 4, o += 4, (!n || u === n.chrId && Z(a, c, n.start, n.end)) && i.push({
|
|
1254
|
+
start: a,
|
|
1255
|
+
end: c,
|
|
1256
|
+
maxScore: g,
|
|
1257
|
+
minScore: y,
|
|
1258
|
+
summary: !0,
|
|
1259
|
+
score: f / (d || 1)
|
|
1260
|
+
});
|
|
1261
|
+
}
|
|
1262
|
+
return i;
|
|
1263
|
+
}
|
|
1264
|
+
parseBigBedBlock(r, e, n, i) {
|
|
1265
|
+
const o = [];
|
|
1266
|
+
let s = e;
|
|
1267
|
+
const u = r, a = new DataView(u.buffer, u.byteOffset, u.length);
|
|
1268
|
+
for (; s < r.byteLength; ) {
|
|
1269
|
+
const c = s, d = a.getUint32(s, !0);
|
|
1270
|
+
s += 4;
|
|
1271
|
+
const y = a.getInt32(s, !0);
|
|
1272
|
+
s += 4;
|
|
1273
|
+
const g = a.getInt32(s, !0);
|
|
1274
|
+
s += 4;
|
|
1275
|
+
let f = s;
|
|
1276
|
+
for (; f < r.length && r[f] !== 0; f++)
|
|
1277
|
+
;
|
|
1278
|
+
const m = r.subarray(s, f), l = (J == null ? void 0 : J.decode(m)) ?? m.toString();
|
|
1279
|
+
s = f + 1, o.push({
|
|
1280
|
+
chromId: d,
|
|
1281
|
+
start: y,
|
|
1282
|
+
end: g,
|
|
1283
|
+
rest: l,
|
|
1284
|
+
uniqueId: `bb-${n + c}`
|
|
1285
|
+
});
|
|
1286
|
+
}
|
|
1287
|
+
return i ? o.filter((c) => Z(c.start, c.end, i.start, i.end)) : o;
|
|
1288
|
+
}
|
|
1289
|
+
parseBigWigBlock(r, e, n) {
|
|
1290
|
+
const i = r.subarray(e), o = new DataView(i.buffer, i.byteOffset, i.length);
|
|
1291
|
+
let s = 0;
|
|
1292
|
+
s += 4;
|
|
1293
|
+
const u = o.getInt32(s, !0);
|
|
1294
|
+
s += 8;
|
|
1295
|
+
const a = o.getUint32(s, !0);
|
|
1296
|
+
s += 4;
|
|
1297
|
+
const c = o.getUint32(s, !0);
|
|
1298
|
+
s += 4;
|
|
1299
|
+
const d = o.getUint8(s);
|
|
1300
|
+
s += 2;
|
|
1301
|
+
const y = o.getUint16(s, !0);
|
|
1302
|
+
s += 2;
|
|
1303
|
+
const g = new Array(y);
|
|
1304
|
+
switch (d) {
|
|
1305
|
+
case 1: {
|
|
1306
|
+
for (let f = 0; f < y; f++) {
|
|
1307
|
+
const m = o.getInt32(s, !0);
|
|
1308
|
+
s += 4;
|
|
1309
|
+
const l = o.getInt32(s, !0);
|
|
1310
|
+
s += 4;
|
|
1311
|
+
const v = o.getFloat32(s, !0);
|
|
1312
|
+
s += 4, g[f] = {
|
|
1313
|
+
start: m,
|
|
1314
|
+
end: l,
|
|
1315
|
+
score: v
|
|
1316
|
+
};
|
|
1317
|
+
}
|
|
1318
|
+
break;
|
|
1319
|
+
}
|
|
1320
|
+
case 2: {
|
|
1321
|
+
for (let f = 0; f < y; f++) {
|
|
1322
|
+
const m = o.getInt32(s, !0);
|
|
1323
|
+
s += 4;
|
|
1324
|
+
const l = o.getFloat32(s, !0);
|
|
1325
|
+
s += 4, g[f] = {
|
|
1326
|
+
score: l,
|
|
1327
|
+
start: m,
|
|
1328
|
+
end: m + c
|
|
1329
|
+
};
|
|
1330
|
+
}
|
|
1331
|
+
break;
|
|
1332
|
+
}
|
|
1333
|
+
case 3: {
|
|
1334
|
+
for (let f = 0; f < y; f++) {
|
|
1335
|
+
const m = o.getFloat32(s, !0);
|
|
1336
|
+
s += 4;
|
|
1337
|
+
const l = u + f * a;
|
|
1338
|
+
g[f] = {
|
|
1339
|
+
score: m,
|
|
1340
|
+
start: l,
|
|
1341
|
+
end: l + c
|
|
1342
|
+
};
|
|
1343
|
+
}
|
|
1344
|
+
break;
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
return n ? g.filter((f) => Z(f.start, f.end, n.start, n.end)) : g;
|
|
1348
|
+
}
|
|
1349
|
+
async readFeatures(r, e, n = {}) {
|
|
1350
|
+
try {
|
|
1351
|
+
const { blockType: i, isCompressed: o } = this, { signal: s, request: u } = n, a = Ft(e);
|
|
1352
|
+
j(s), await Promise.all(a.map(async (c) => {
|
|
1353
|
+
j(s);
|
|
1354
|
+
const { length: d, offset: y } = c, g = await this.featureCache.get(`${d}_${y}`, c, s);
|
|
1355
|
+
for (const f of c.blocks) {
|
|
1356
|
+
j(s);
|
|
1357
|
+
let m = g.subarray(f.offset - c.offset);
|
|
1358
|
+
switch (o && (m = At(m)), j(s), i) {
|
|
1359
|
+
case "summary": {
|
|
1360
|
+
r.next(this.parseSummaryBlock(m, 0, u));
|
|
1361
|
+
break;
|
|
1362
|
+
}
|
|
1363
|
+
case "bigwig": {
|
|
1364
|
+
r.next(this.parseBigWigBlock(m, 0, u));
|
|
1365
|
+
break;
|
|
1366
|
+
}
|
|
1367
|
+
case "bigbed": {
|
|
1368
|
+
r.next(this.parseBigBedBlock(m, 0, f.offset * 256, u));
|
|
1369
|
+
break;
|
|
1370
|
+
}
|
|
1371
|
+
default:
|
|
1372
|
+
console.warn(`Don't know what to do with ${i}`);
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
})), r.complete();
|
|
1376
|
+
} catch (i) {
|
|
1377
|
+
r.error(i);
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
const Rt = -2003829722, fe = -2021002517;
|
|
1382
|
+
function F(t) {
|
|
1383
|
+
return new DataView(t.buffer, t.byteOffset, t.length);
|
|
1384
|
+
}
|
|
1385
|
+
class De {
|
|
1386
|
+
/*
|
|
1387
|
+
* @param filehandle - a filehandle from generic-filehandle2
|
|
1388
|
+
*
|
|
1389
|
+
* @param path - a Local file path as a string
|
|
1390
|
+
*
|
|
1391
|
+
* @param url - a URL string
|
|
1392
|
+
*
|
|
1393
|
+
* @param renameRefSeqs - an optional method to rename the internal reference
|
|
1394
|
+
* sequences using a mapping function
|
|
1395
|
+
*/
|
|
1396
|
+
constructor(r) {
|
|
1397
|
+
E(this, "bbi");
|
|
1398
|
+
E(this, "headerP");
|
|
1399
|
+
E(this, "renameRefSeqs");
|
|
1400
|
+
const { filehandle: e, renameRefSeqs: n = (s) => s, path: i, url: o } = r;
|
|
1401
|
+
if (this.renameRefSeqs = n, e)
|
|
1402
|
+
this.bbi = e;
|
|
1403
|
+
else if (o)
|
|
1404
|
+
this.bbi = new Me(o);
|
|
1405
|
+
else if (i)
|
|
1406
|
+
this.bbi = new He(i);
|
|
1407
|
+
else
|
|
1408
|
+
throw new Error("no file given");
|
|
1409
|
+
}
|
|
1410
|
+
getHeader(r) {
|
|
1411
|
+
return this.headerP || (this.headerP = this._getHeader(r).catch((e) => {
|
|
1412
|
+
throw this.headerP = void 0, e;
|
|
1413
|
+
})), this.headerP;
|
|
1414
|
+
}
|
|
1415
|
+
async _getHeader(r) {
|
|
1416
|
+
const e = await this._getMainHeader(r), n = await this._readChromTree(e, r);
|
|
1417
|
+
return {
|
|
1418
|
+
...e,
|
|
1419
|
+
...n
|
|
1420
|
+
};
|
|
1421
|
+
}
|
|
1422
|
+
async _getMainHeader(r, e = 2e3) {
|
|
1423
|
+
const n = await this.bbi.read(e, 0, r), i = F(n), o = i.getInt32(0, !0);
|
|
1424
|
+
if (o !== Rt && o !== fe)
|
|
1425
|
+
throw new Error("not a BigWig/BigBed file");
|
|
1426
|
+
let s = 0;
|
|
1427
|
+
const u = i.getInt32(s, !0);
|
|
1428
|
+
s += 4;
|
|
1429
|
+
const a = i.getUint16(s, !0);
|
|
1430
|
+
s += 2;
|
|
1431
|
+
const c = i.getUint16(s, !0);
|
|
1432
|
+
s += 2;
|
|
1433
|
+
const d = Number(i.getBigUint64(s, !0));
|
|
1434
|
+
s += 8;
|
|
1435
|
+
const y = Number(i.getBigUint64(s, !0));
|
|
1436
|
+
s += 8;
|
|
1437
|
+
const g = Number(i.getBigUint64(s, !0));
|
|
1438
|
+
s += 8;
|
|
1439
|
+
const f = i.getUint16(s, !0);
|
|
1440
|
+
s += 2;
|
|
1441
|
+
const m = i.getUint16(s, !0);
|
|
1442
|
+
s += 2;
|
|
1443
|
+
const l = Number(i.getBigUint64(s, !0));
|
|
1444
|
+
s += 8;
|
|
1445
|
+
const v = Number(i.getBigUint64(s, !0));
|
|
1446
|
+
s += 8;
|
|
1447
|
+
const b = i.getUint32(s, !0);
|
|
1448
|
+
s += 4;
|
|
1449
|
+
const S = Number(i.getBigUint64(s, !0));
|
|
1450
|
+
s += 8;
|
|
1451
|
+
const B = [];
|
|
1452
|
+
for (let h = 0; h < c; h++) {
|
|
1453
|
+
const U = i.getUint32(s, !0);
|
|
1454
|
+
s += 4;
|
|
1455
|
+
const T = i.getUint32(s, !0);
|
|
1456
|
+
s += 4;
|
|
1457
|
+
const _ = Number(i.getBigUint64(s, !0));
|
|
1458
|
+
s += 8;
|
|
1459
|
+
const I = Number(i.getBigUint64(s, !0));
|
|
1460
|
+
s += 8, B.push({
|
|
1461
|
+
reductionLevel: U,
|
|
1462
|
+
reserved: T,
|
|
1463
|
+
dataOffset: _,
|
|
1464
|
+
indexOffset: I
|
|
1465
|
+
});
|
|
1466
|
+
}
|
|
1467
|
+
const x = u === fe ? "bigbed" : "bigwig";
|
|
1468
|
+
if (l > e || v > e - 40)
|
|
1469
|
+
return this._getMainHeader(r, e * 2);
|
|
1470
|
+
let p;
|
|
1471
|
+
if (v) {
|
|
1472
|
+
const h = n.subarray(v);
|
|
1473
|
+
let U = 0;
|
|
1474
|
+
const T = F(h), _ = Number(T.getBigUint64(U, !0));
|
|
1475
|
+
U += 8;
|
|
1476
|
+
const I = T.getFloat64(U, !0);
|
|
1477
|
+
U += 8;
|
|
1478
|
+
const k = T.getFloat64(U, !0);
|
|
1479
|
+
U += 8;
|
|
1480
|
+
const C = T.getFloat64(U, !0);
|
|
1481
|
+
U += 8;
|
|
1482
|
+
const V = T.getFloat64(U, !0);
|
|
1483
|
+
U += 8, p = {
|
|
1484
|
+
scoreMin: I,
|
|
1485
|
+
scoreMax: k,
|
|
1486
|
+
scoreSum: C,
|
|
1487
|
+
scoreSumSquares: V,
|
|
1488
|
+
basesCovered: _
|
|
1489
|
+
};
|
|
1490
|
+
} else
|
|
1491
|
+
throw new Error("no stats");
|
|
1492
|
+
const w = new TextDecoder("utf8");
|
|
1493
|
+
return {
|
|
1494
|
+
zoomLevels: B,
|
|
1495
|
+
magic: u,
|
|
1496
|
+
extHeaderOffset: S,
|
|
1497
|
+
numZoomLevels: c,
|
|
1498
|
+
fieldCount: f,
|
|
1499
|
+
totalSummary: p,
|
|
1500
|
+
definedFieldCount: m,
|
|
1501
|
+
uncompressBufSize: b,
|
|
1502
|
+
asOffset: l,
|
|
1503
|
+
chromTreeOffset: d,
|
|
1504
|
+
totalSummaryOffset: v,
|
|
1505
|
+
unzoomedDataOffset: y,
|
|
1506
|
+
unzoomedIndexOffset: g,
|
|
1507
|
+
fileType: x,
|
|
1508
|
+
version: a,
|
|
1509
|
+
autoSql: l ? w.decode(n.subarray(l, n.indexOf(0, l))) : ""
|
|
1510
|
+
};
|
|
1511
|
+
}
|
|
1512
|
+
async _readChromTree(r, e) {
|
|
1513
|
+
const n = [], i = {}, o = r.chromTreeOffset, s = F(await this.bbi.read(32, o, e));
|
|
1514
|
+
let u = 0;
|
|
1515
|
+
u += 4, u += 4;
|
|
1516
|
+
const a = s.getUint32(u, !0);
|
|
1517
|
+
u += 4;
|
|
1518
|
+
const c = s.getUint32(u, !0);
|
|
1519
|
+
u += 4, u += 8;
|
|
1520
|
+
const d = new TextDecoder("utf8"), y = async (g) => {
|
|
1521
|
+
const f = await this.bbi.read(4, g), m = F(f);
|
|
1522
|
+
let l = 0;
|
|
1523
|
+
const v = m.getUint8(l);
|
|
1524
|
+
l += 1, l += 1;
|
|
1525
|
+
const b = m.getUint16(l, !0);
|
|
1526
|
+
if (l += 2, v) {
|
|
1527
|
+
const S = await this.bbi.read(b * (a + c), g + l), B = F(S);
|
|
1528
|
+
l = 0;
|
|
1529
|
+
for (let x = 0; x < b; x++) {
|
|
1530
|
+
const p = d.decode(S.subarray(l, l + a)).replaceAll("\0", "");
|
|
1531
|
+
l += a;
|
|
1532
|
+
const w = B.getUint32(l, !0);
|
|
1533
|
+
l += 4;
|
|
1534
|
+
const h = B.getUint32(l, !0);
|
|
1535
|
+
l += 4, i[this.renameRefSeqs(p)] = w, n[w] = {
|
|
1536
|
+
name: p,
|
|
1537
|
+
id: w,
|
|
1538
|
+
length: h
|
|
1539
|
+
};
|
|
1540
|
+
}
|
|
1541
|
+
} else {
|
|
1542
|
+
const S = [], B = F(await this.bbi.read(b * (a + 8), g + l));
|
|
1543
|
+
l = 0;
|
|
1544
|
+
for (let x = 0; x < b; x++) {
|
|
1545
|
+
l += a;
|
|
1546
|
+
const p = Number(B.getBigUint64(l, !0));
|
|
1547
|
+
l += 8, S.push(y(p));
|
|
1548
|
+
}
|
|
1549
|
+
await Promise.all(S);
|
|
1550
|
+
}
|
|
1551
|
+
};
|
|
1552
|
+
return await y(o + 32), {
|
|
1553
|
+
refsByName: i,
|
|
1554
|
+
refsByNumber: n
|
|
1555
|
+
};
|
|
1556
|
+
}
|
|
1557
|
+
/*
|
|
1558
|
+
* fetches the "unzoomed" view of the bigwig data. this is the default for bigbed
|
|
1559
|
+
* @param abortSignal - a signal to optionally abort this operation
|
|
1560
|
+
*/
|
|
1561
|
+
async getUnzoomedView(r) {
|
|
1562
|
+
const { unzoomedIndexOffset: e, refsByName: n, uncompressBufSize: i, fileType: o } = await this.getHeader(r);
|
|
1563
|
+
return new Re(this.bbi, n, e, i > 0, o);
|
|
1564
|
+
}
|
|
1565
|
+
/**
|
|
1566
|
+
* Gets features from a BigWig file
|
|
1567
|
+
*
|
|
1568
|
+
* @param refName - The chromosome name
|
|
1569
|
+
*
|
|
1570
|
+
* @param start - The start of a region
|
|
1571
|
+
*
|
|
1572
|
+
* @param end - The end of a region
|
|
1573
|
+
*
|
|
1574
|
+
* @param opts - An object containing basesPerSpan (e.g. pixels per basepair)
|
|
1575
|
+
* or scale used to infer the zoomLevel to use
|
|
1576
|
+
*/
|
|
1577
|
+
async getFeatureStream(r, e, n, i) {
|
|
1578
|
+
await this.getHeader(i);
|
|
1579
|
+
const o = this.renameRefSeqs(r);
|
|
1580
|
+
let s;
|
|
1581
|
+
const { basesPerSpan: u, scale: a } = i || {};
|
|
1582
|
+
return u ? s = await this.getView(1 / u, i) : a ? s = await this.getView(a, i) : s = await this.getView(1, i), new P((c) => {
|
|
1583
|
+
s.readWigData(o, e, n, c, i).catch((d) => {
|
|
1584
|
+
c.error(d);
|
|
1585
|
+
});
|
|
1586
|
+
});
|
|
1587
|
+
}
|
|
1588
|
+
async getFeatures(r, e, n, i) {
|
|
1589
|
+
const o = await this.getFeatureStream(r, e, n, i);
|
|
1590
|
+
return (await Pe(o.pipe(_t()))).flat();
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
class $t extends De {
|
|
1594
|
+
/**
|
|
1595
|
+
* Retrieves a BlockView of a specific zoomLevel
|
|
1596
|
+
*
|
|
1597
|
+
* @param scale - number
|
|
1598
|
+
*
|
|
1599
|
+
* @param opts - An object containing basesPerSpan (e.g. pixels per basepair)
|
|
1600
|
+
* or scale used to infer the zoomLevel to use
|
|
1601
|
+
*/
|
|
1602
|
+
async getView(r, e) {
|
|
1603
|
+
const { zoomLevels: n, refsByName: i, uncompressBufSize: o } = await this.getHeader(e), s = 1 / r, u = n.length - 1;
|
|
1604
|
+
for (let a = u; a >= 0; a -= 1) {
|
|
1605
|
+
const c = n[a];
|
|
1606
|
+
if (c && c.reductionLevel <= 2 * s)
|
|
1607
|
+
return new Re(this.bbi, i, c.indexOffset, o > 0, "summary");
|
|
1608
|
+
}
|
|
1609
|
+
return this.getUnzoomedView(e);
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
function Dt(t) {
|
|
1613
|
+
return t.filter((r) => !!r);
|
|
1614
|
+
}
|
|
1615
|
+
class jt extends De {
|
|
1616
|
+
constructor() {
|
|
1617
|
+
super(...arguments);
|
|
1618
|
+
E(this, "readIndicesCache", new le({
|
|
1619
|
+
cache: new Fe({ maxSize: 1 }),
|
|
1620
|
+
fill: (e, n) => this._readIndices({ ...e, signal: n })
|
|
1621
|
+
}));
|
|
1622
|
+
}
|
|
1623
|
+
readIndices(e = {}) {
|
|
1624
|
+
const { signal: n, ...i } = e;
|
|
1625
|
+
return this.readIndicesCache.get(JSON.stringify(i), e, n);
|
|
1626
|
+
}
|
|
1627
|
+
/*
|
|
1628
|
+
* retrieve unzoomed view for any scale
|
|
1629
|
+
*/
|
|
1630
|
+
async getView(e, n) {
|
|
1631
|
+
return this.getUnzoomedView(n);
|
|
1632
|
+
}
|
|
1633
|
+
/*
|
|
1634
|
+
* parse the bigbed extraIndex fields
|
|
1635
|
+
*
|
|
1636
|
+
*
|
|
1637
|
+
* @return a Promise for an array of Index data structure since there can be
|
|
1638
|
+
* multiple extraIndexes in a bigbed, see bedToBigBed documentation
|
|
1639
|
+
*/
|
|
1640
|
+
async _readIndices(e) {
|
|
1641
|
+
const { extHeaderOffset: n } = await this.getHeader(e), i = await this.bbi.read(64, n), o = new DataView(i.buffer, i.byteOffset, i.length);
|
|
1642
|
+
let s = 0;
|
|
1643
|
+
s += 2;
|
|
1644
|
+
const u = o.getUint16(s, !0);
|
|
1645
|
+
s += 2;
|
|
1646
|
+
const a = Number(o.getBigUint64(s, !0));
|
|
1647
|
+
if (s += 8, u === 0)
|
|
1648
|
+
return [];
|
|
1649
|
+
const c = 20, d = c * u, y = await this.bbi.read(d, a), g = [];
|
|
1650
|
+
for (let f = 0; f < u; f += 1) {
|
|
1651
|
+
const m = y.subarray(f * c), l = new DataView(m.buffer, m.byteOffset, m.length);
|
|
1652
|
+
let v = 0;
|
|
1653
|
+
const b = l.getInt16(v, !0);
|
|
1654
|
+
v += 2;
|
|
1655
|
+
const S = l.getInt16(v, !0);
|
|
1656
|
+
v += 2;
|
|
1657
|
+
const B = Number(l.getBigUint64(v, !0));
|
|
1658
|
+
v += 12;
|
|
1659
|
+
const x = l.getInt16(v, !0);
|
|
1660
|
+
g.push({
|
|
1661
|
+
type: b,
|
|
1662
|
+
fieldcount: S,
|
|
1663
|
+
offset: B,
|
|
1664
|
+
field: x
|
|
1665
|
+
});
|
|
1666
|
+
}
|
|
1667
|
+
return g;
|
|
1668
|
+
}
|
|
1669
|
+
/*
|
|
1670
|
+
* perform a search in the bigbed extraIndex to find which blocks in the
|
|
1671
|
+
* bigbed data to look for the actual feature data
|
|
1672
|
+
*
|
|
1673
|
+
* @param name - the name to search for
|
|
1674
|
+
*
|
|
1675
|
+
* @param opts - a SearchOptions argument with optional signal
|
|
1676
|
+
*
|
|
1677
|
+
* @return a Promise for an array of bigbed block Loc entries
|
|
1678
|
+
*/
|
|
1679
|
+
async searchExtraIndexBlocks(e, n = {}) {
|
|
1680
|
+
const i = await this.readIndices(n);
|
|
1681
|
+
if (i.length === 0)
|
|
1682
|
+
return [];
|
|
1683
|
+
const o = new TextDecoder("utf8"), s = i.map(async (u) => {
|
|
1684
|
+
const { offset: a, field: c } = u, d = await this.bbi.read(32, a, n), y = new DataView(d.buffer, d.byteOffset, d.length);
|
|
1685
|
+
let g = 0;
|
|
1686
|
+
g += 4;
|
|
1687
|
+
const f = y.getInt32(g, !0);
|
|
1688
|
+
g += 4;
|
|
1689
|
+
const m = y.getInt32(g, !0);
|
|
1690
|
+
g += 4;
|
|
1691
|
+
const l = y.getInt32(g, !0);
|
|
1692
|
+
g += 4, g += 8;
|
|
1693
|
+
const v = async (b) => {
|
|
1694
|
+
const S = b, B = 4 + f * (m + l), p = await this.bbi.read(B, S, n), w = new DataView(p.buffer, p.byteOffset, p.length);
|
|
1695
|
+
let h = 0;
|
|
1696
|
+
const U = w.getInt8(h);
|
|
1697
|
+
h += 2;
|
|
1698
|
+
const T = w.getInt16(h, !0);
|
|
1699
|
+
h += 2;
|
|
1700
|
+
const _ = [];
|
|
1701
|
+
if (U === 0) {
|
|
1702
|
+
const I = [];
|
|
1703
|
+
for (let C = 0; C < T; C++) {
|
|
1704
|
+
const V = o.decode(p.subarray(h, h + m)).replaceAll("\0", "");
|
|
1705
|
+
h += m;
|
|
1706
|
+
const A = Number(w.getBigUint64(h, !0));
|
|
1707
|
+
h += 8, I.push({
|
|
1708
|
+
key: V,
|
|
1709
|
+
offset: A
|
|
1710
|
+
});
|
|
1711
|
+
}
|
|
1712
|
+
let k = 0;
|
|
1713
|
+
for (const { key: C, offset: V } of I) {
|
|
1714
|
+
if (e.localeCompare(C) < 0 && k)
|
|
1715
|
+
return v(k);
|
|
1716
|
+
k = V;
|
|
1717
|
+
}
|
|
1718
|
+
return v(k);
|
|
1719
|
+
} else if (U === 1) {
|
|
1720
|
+
for (let I = 0; I < T; I++) {
|
|
1721
|
+
const k = o.decode(p.subarray(h, h + m)).replaceAll("\0", "");
|
|
1722
|
+
h += m;
|
|
1723
|
+
const C = Number(w.getBigUint64(h, !0));
|
|
1724
|
+
h += 8;
|
|
1725
|
+
const V = w.getUint32(h, !0);
|
|
1726
|
+
h += 4;
|
|
1727
|
+
const A = w.getUint32(h, !0);
|
|
1728
|
+
h += 4, _.push({
|
|
1729
|
+
key: k,
|
|
1730
|
+
offset: C,
|
|
1731
|
+
length: V,
|
|
1732
|
+
reserved: A
|
|
1733
|
+
});
|
|
1734
|
+
}
|
|
1735
|
+
for (const I of _)
|
|
1736
|
+
if (I.key === e)
|
|
1737
|
+
return {
|
|
1738
|
+
...I,
|
|
1739
|
+
field: c
|
|
1740
|
+
};
|
|
1741
|
+
return;
|
|
1742
|
+
}
|
|
1743
|
+
};
|
|
1744
|
+
return v(a + 32);
|
|
1745
|
+
});
|
|
1746
|
+
return Dt(await Promise.all(s));
|
|
1747
|
+
}
|
|
1748
|
+
/*
|
|
1749
|
+
* retrieve the features from the bigbed data that were found through the
|
|
1750
|
+
* lookup of the extraIndex note that there can be multiple extraIndex, see
|
|
1751
|
+
* the BigBed specification and the -extraIndex argument to bedToBigBed
|
|
1752
|
+
*
|
|
1753
|
+
* @param name - the name to search for
|
|
1754
|
+
*
|
|
1755
|
+
* @param opts - options object with optional AboutSignal
|
|
1756
|
+
*
|
|
1757
|
+
* @return array of Feature
|
|
1758
|
+
*/
|
|
1759
|
+
async searchExtraIndex(e, n = {}) {
|
|
1760
|
+
const i = await this.searchExtraIndexBlocks(e, n);
|
|
1761
|
+
if (i.length === 0)
|
|
1762
|
+
return [];
|
|
1763
|
+
const o = await this.getUnzoomedView(n), s = i.map((a) => new P((c) => {
|
|
1764
|
+
o.readFeatures(c, [a], n).catch((d) => {
|
|
1765
|
+
c.error(d);
|
|
1766
|
+
});
|
|
1767
|
+
}).pipe(ze((c, d) => c.concat(d)), Ve((c) => {
|
|
1768
|
+
for (const d of c)
|
|
1769
|
+
d.field = a.field;
|
|
1770
|
+
return c;
|
|
1771
|
+
})));
|
|
1772
|
+
return (await Pe(kt(...s))).filter((a) => {
|
|
1773
|
+
var c;
|
|
1774
|
+
return ((c = a.rest) == null ? void 0 : c.split(" ")[(a.field || 0) - 3]) === e;
|
|
1775
|
+
});
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
export {
|
|
1779
|
+
jt as BigBed,
|
|
1780
|
+
$t as BigWig
|
|
1781
|
+
};
|