@platforma-sdk/ui-vue 1.42.53 → 1.43.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.
Files changed (84) hide show
  1. package/.turbo/turbo-build.log +213 -207
  2. package/.turbo/turbo-type-check.log +1 -1
  3. package/CHANGELOG.md +20 -0
  4. package/dist/AgGridVue/useAgGridOptions.js +2 -3
  5. package/dist/AgGridVue/useAgGridOptions.js.map +1 -1
  6. package/dist/assets/multi-sequence-alignment.worker-Cm0gZp19.js +6 -0
  7. package/dist/assets/multi-sequence-alignment.worker-Cm0gZp19.js.map +1 -0
  8. package/dist/assets/phylogenetic-tree.worker-4CrExYEo.js +5 -0
  9. package/dist/assets/phylogenetic-tree.worker-4CrExYEo.js.map +1 -0
  10. package/dist/components/PlAgDataTable/PlAgRowCount.vue.js +2 -3
  11. package/dist/components/PlAgDataTable/PlAgRowCount.vue.js.map +1 -1
  12. package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.vue.js +11 -12
  13. package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.vue.js.map +1 -1
  14. package/dist/components/PlAgRowNumHeader.vue.js +8 -9
  15. package/dist/components/PlAgRowNumHeader.vue.js.map +1 -1
  16. package/dist/components/PlMultiSequenceAlignment/Consensus.vue.d.ts +1 -0
  17. package/dist/components/PlMultiSequenceAlignment/Consensus.vue2.js +48 -46
  18. package/dist/components/PlMultiSequenceAlignment/Consensus.vue2.js.map +1 -1
  19. package/dist/components/PlMultiSequenceAlignment/Consensus.vue3.js +5 -7
  20. package/dist/components/PlMultiSequenceAlignment/Consensus.vue3.js.map +1 -1
  21. package/dist/components/PlMultiSequenceAlignment/Legend.vue2.js +14 -13
  22. package/dist/components/PlMultiSequenceAlignment/Legend.vue2.js.map +1 -1
  23. package/dist/components/PlMultiSequenceAlignment/Legend.vue3.js +9 -8
  24. package/dist/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue.d.ts +16 -9
  25. package/dist/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue2.js +117 -85
  26. package/dist/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue2.js.map +1 -1
  27. package/dist/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue3.js +25 -18
  28. package/dist/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue3.js.map +1 -1
  29. package/dist/components/PlMultiSequenceAlignment/PhylogeneticTree.vue.d.ts +8 -0
  30. package/dist/components/PlMultiSequenceAlignment/PhylogeneticTree.vue.js +10 -0
  31. package/dist/components/PlMultiSequenceAlignment/PhylogeneticTree.vue.js.map +1 -0
  32. package/dist/components/PlMultiSequenceAlignment/PhylogeneticTree.vue2.js +77 -0
  33. package/dist/components/PlMultiSequenceAlignment/PhylogeneticTree.vue2.js.map +1 -0
  34. package/dist/components/PlMultiSequenceAlignment/PhylogeneticTree.vue3.js +9 -0
  35. package/dist/components/PlMultiSequenceAlignment/PhylogeneticTree.vue3.js.map +1 -0
  36. package/dist/components/PlMultiSequenceAlignment/PlMultiSequenceAlignment.vue.d.ts +26 -18
  37. package/dist/components/PlMultiSequenceAlignment/PlMultiSequenceAlignment.vue2.js +119 -120
  38. package/dist/components/PlMultiSequenceAlignment/PlMultiSequenceAlignment.vue2.js.map +1 -1
  39. package/dist/components/PlMultiSequenceAlignment/SeqLogo.vue.js +7 -124
  40. package/dist/components/PlMultiSequenceAlignment/SeqLogo.vue.js.map +1 -1
  41. package/dist/components/PlMultiSequenceAlignment/SeqLogo.vue2.js +124 -2
  42. package/dist/components/PlMultiSequenceAlignment/SeqLogo.vue2.js.map +1 -1
  43. package/dist/components/PlMultiSequenceAlignment/SeqLogo.vue3.js +9 -0
  44. package/dist/components/PlMultiSequenceAlignment/SeqLogo.vue3.js.map +1 -0
  45. package/dist/components/PlMultiSequenceAlignment/Toolbar.vue2.js +90 -90
  46. package/dist/components/PlMultiSequenceAlignment/Toolbar.vue2.js.map +1 -1
  47. package/dist/components/PlMultiSequenceAlignment/Toolbar.vue3.js +9 -7
  48. package/dist/components/PlMultiSequenceAlignment/cell-size.d.ts +4 -0
  49. package/dist/components/PlMultiSequenceAlignment/cell-size.js +8 -0
  50. package/dist/components/PlMultiSequenceAlignment/cell-size.js.map +1 -0
  51. package/dist/components/PlMultiSequenceAlignment/data.d.ts +15 -10
  52. package/dist/components/PlMultiSequenceAlignment/data.js +309 -202
  53. package/dist/components/PlMultiSequenceAlignment/data.js.map +1 -1
  54. package/dist/components/PlMultiSequenceAlignment/markup.js +9 -7
  55. package/dist/components/PlMultiSequenceAlignment/markup.js.map +1 -1
  56. package/dist/components/PlMultiSequenceAlignment/migrations.js +15 -13
  57. package/dist/components/PlMultiSequenceAlignment/migrations.js.map +1 -1
  58. package/dist/components/PlMultiSequenceAlignment/multi-sequence-alignment.worker.d.ts +6 -0
  59. package/dist/components/PlMultiSequenceAlignment/phylogenetic-tree.worker.d.ts +7 -0
  60. package/dist/components/PlMultiSequenceAlignment/settings.js +3 -4
  61. package/dist/components/PlMultiSequenceAlignment/settings.js.map +1 -1
  62. package/dist/index.js +25 -27
  63. package/dist/index.js.map +1 -1
  64. package/dist/lib.d.ts +1 -2
  65. package/package.json +6 -6
  66. package/src/components/PlMultiSequenceAlignment/Consensus.vue +38 -39
  67. package/src/components/PlMultiSequenceAlignment/Legend.vue +9 -9
  68. package/src/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue +222 -126
  69. package/src/components/PlMultiSequenceAlignment/PhylogeneticTree.vue +110 -0
  70. package/src/components/PlMultiSequenceAlignment/PlMultiSequenceAlignment.vue +28 -22
  71. package/src/components/PlMultiSequenceAlignment/SeqLogo.vue +77 -69
  72. package/src/components/PlMultiSequenceAlignment/Toolbar.vue +47 -39
  73. package/src/components/PlMultiSequenceAlignment/cell-size.ts +4 -0
  74. package/src/components/PlMultiSequenceAlignment/data.ts +361 -149
  75. package/src/components/PlMultiSequenceAlignment/markup.ts +10 -8
  76. package/src/components/PlMultiSequenceAlignment/migrations.ts +6 -1
  77. package/src/components/PlMultiSequenceAlignment/multi-sequence-alignment.worker.ts +54 -0
  78. package/src/components/PlMultiSequenceAlignment/phylogenetic-tree.worker.ts +89 -0
  79. package/src/components/PlMultiSequenceAlignment/settings.ts +1 -2
  80. package/src/lib.ts +1 -3
  81. package/dist/components/PlMultiSequenceAlignment/multi-sequence-alignment.d.ts +0 -7
  82. package/dist/components/PlMultiSequenceAlignment/multi-sequence-alignment.js +0 -51
  83. package/dist/components/PlMultiSequenceAlignment/multi-sequence-alignment.js.map +0 -1
  84. package/src/components/PlMultiSequenceAlignment/multi-sequence-alignment.ts +0 -101
@@ -1,264 +1,371 @@
1
- import { isJsonEqual as J } from "../../lib/util/helpers/dist/objects.js";
1
+ import { isJsonEqual as O } from "../../lib/util/helpers/dist/objects.js";
2
2
  import "../../lib/util/helpers/dist/test_timeouts.js";
3
- import { ensureError as G, getRawPlatformaInstance as H, readAnnotation as A, Annotation as g, canonicalizeJson as v, getAxisId as O, parseJson as S, isLabelColumn as N, matchAxisId as K, readAnnotationJson as j, isLinkerColumn as Q, createRowSelectionColumn as X, pTableValue as M } from "@platforma-sdk/model";
4
- import { ref as q, watch as Y } from "vue";
5
- import { highlightByChemicalProperties as Z } from "./chemical-properties.js";
6
- import { parseMarkup as tt, markupAlignedSequence as nt, highlightByMarkup as et } from "./markup.js";
7
- import { multiSequenceAlignment as rt } from "./multi-sequence-alignment.js";
8
- import { getResidueCounts as ot } from "./residue-counts.js";
9
- const C = () => H().pFrameDriver, E = 1e3, ht = k(
10
- at
11
- ), wt = k(
12
- st
13
- ), bt = k(
14
- it
15
- ), At = k(
16
- lt
3
+ import { ensureError as T, getRawPlatformaInstance as $, readAnnotation as C, Annotation as h, canonicalizeJson as v, getAxisId as S, parseJson as A, isLabelColumn as j, matchAxisId as B, readAnnotationJson as J, isLinkerColumn as N, createRowSelectionColumn as W, pTableValue as R } from "@platforma-sdk/model";
4
+ import { ref as M, watch as F, onWatcherCleanup as H } from "vue";
5
+ import { objectHash as I } from "../../objectHash.js";
6
+ import { highlightByChemicalProperties as V } from "./chemical-properties.js";
7
+ import { parseMarkup as z, highlightByMarkup as Q, markupAlignedSequence as Y } from "./markup.js";
8
+ import { getResidueCounts as Z } from "./residue-counts.js";
9
+ const x = () => $().pFrameDriver, D = 1e3, ge = E(
10
+ _
11
+ ), he = E(
12
+ G
13
+ ), be = E(
14
+ K
15
+ ), ve = E(
16
+ X
17
17
  );
18
- async function at({
19
- pFrame: l,
20
- sequenceColumnPredicate: r
21
- }) {
22
- if (!l) return;
23
- const n = (await C().listColumns(l)).values().filter((a) => r(a)).map(({ spec: a, columnId: f }) => ({
24
- label: A(a, g.Label) ?? "Unlabeled column",
25
- value: f
26
- })).toArray(), i = n.map(({ value: a }) => a);
27
- return { options: n, defaults: i };
18
+ async function _({ pFrame: n, sequenceColumnPredicate: r }) {
19
+ if (!n) return;
20
+ const o = (await x().listColumns(n)).values().filter((i) => r(i)).map(({ spec: i, columnId: c }) => ({
21
+ label: C(i, h.Label) ?? "Unlabeled column",
22
+ value: c
23
+ })).toArray(), t = o.map(({ value: i }) => i);
24
+ return { options: o, defaults: t };
28
25
  }
29
- async function st({
30
- pFrame: l,
31
- sequenceColumnIds: r
32
- }) {
33
- if (!l || !r) return;
34
- const m = C(), p = await m.listColumns(l), n = /* @__PURE__ */ new Map(), i = new Map(
35
- r.values().flatMap((e) => {
36
- const s = p.find(({ columnId: c }) => c === e);
37
- if (!s)
38
- throw new Error(`Couldn't find sequence column (ID: \`${e}\`).`);
39
- return s.spec.axesSpec.values().map((c) => [v(O(c)), c]);
26
+ async function G({ pFrame: n, sequenceColumnIds: r }) {
27
+ if (!n || !r) return;
28
+ const a = x(), e = await a.listColumns(n), o = new Map(
29
+ r.values().flatMap((s) => {
30
+ const u = e.find(({ columnId: m }) => m === s);
31
+ if (!u)
32
+ throw new Error(`Couldn't find sequence column (ID: \`${s}\`).`);
33
+ return u.spec.axesSpec.values().map((m) => [v(S(m)), m]);
40
34
  })
41
- );
42
- for (const [e, s] of i.entries()) {
43
- const c = S(e), h = p.find(
44
- ({ spec: x }) => N(x) && K(c, O(x.axesSpec[0]))
35
+ ), t = /* @__PURE__ */ new Map();
36
+ for (const [s, u] of o.entries()) {
37
+ const m = A(s), d = e.find(
38
+ ({ spec: p }) => j(p) && B(m, S(p.axesSpec[0]))
45
39
  );
46
- n.set(
47
- h ? v({ type: "column", id: h.columnId }) : v({ type: "axis", id: c }),
48
- A(h == null ? void 0 : h.spec, g.Label) ?? A(s, g.Label) ?? "Unlabeled axis"
40
+ t.set(
41
+ d ? v({ type: "column", id: d.columnId }) : v({ type: "axis", id: m }),
42
+ C(d == null ? void 0 : d.spec, h.Label) ?? C(u, h.Label) ?? "Unlabeled axis"
49
43
  );
50
44
  }
51
- const { hits: a } = await m.findColumns(l, {
45
+ const { hits: i } = await a.findColumns(n, {
52
46
  columnFilter: {},
53
- compatibleWith: i.keys().map((e) => S(e)).toArray(),
47
+ compatibleWith: o.keys().map((s) => A(s)).toArray(),
54
48
  strictlyCompatible: !1
55
49
  });
56
- for (const { columnId: e, spec: s } of a) {
57
- const c = v({ type: "column", id: e });
58
- n.has(c) || n.set(
59
- c,
60
- A(s, g.Label) ?? "Unlabeled column"
50
+ for (const { columnId: s, spec: u } of i) {
51
+ const m = v({
52
+ type: "column",
53
+ id: s
54
+ });
55
+ t.has(m) || t.set(
56
+ m,
57
+ C(u, h.Label) ?? "Unlabeled column"
61
58
  );
62
59
  }
63
- const f = n.entries().map(([e, s]) => ({ label: s, value: S(e) })).toArray(), d = f.values().filter(({ value: e }) => {
64
- if (e.type === "axis") return !0;
65
- const s = p.find(({ columnId: c }) => c === e.id);
66
- return s && N(s.spec);
67
- }).map(({ value: e }) => e).toArray();
68
- return { options: f, defaults: d };
60
+ const c = t.entries().map(([s, u]) => ({ label: u, value: A(s) })).toArray(), l = c.values().filter(({ value: s }) => {
61
+ if (s.type === "axis") return !0;
62
+ const u = e.find(({ columnId: m }) => m === s.id);
63
+ return u && j(u.spec);
64
+ }).map(({ value: s }) => s).toArray();
65
+ return { options: c, defaults: l };
69
66
  }
70
- async function it({
71
- pFrame: l,
72
- sequenceColumnIds: r
73
- }) {
74
- if (!l || (r == null ? void 0 : r.length) !== 1) return;
75
- const p = await C().listColumns(l), n = p.find(
76
- (i) => i.columnId === r[0]
67
+ async function K({ pFrame: n, sequenceColumnIds: r }) {
68
+ if (!n || !r) return;
69
+ const e = await x().listColumns(n), t = r.map((c) => {
70
+ const l = e.find((s) => s.columnId === c);
71
+ if (!l)
72
+ throw new Error(
73
+ `Couldn't find sequence column (ID: \`${r[0]}\`).`
74
+ );
75
+ return l;
76
+ }).flatMap(
77
+ (c) => e.filter(
78
+ (l) => J(l.spec, h.Sequence.IsAnnotation) && O(c.spec.axesSpec, l.spec.axesSpec) && Object.entries(c.spec.domain ?? {}).every(([s, u]) => {
79
+ var m;
80
+ return ((m = l.spec.domain) == null ? void 0 : m[s]) === u;
81
+ })
82
+ ).map((l) => ({ markupColumn: l, sequenceColumn: c }))
77
83
  );
78
- if (!n)
79
- throw new Error(
80
- `Couldn't find sequence column (ID: \`${r[0]}\`).`
81
- );
82
- return p.values().filter(
83
- (i) => !!j(i.spec, g.Sequence.IsAnnotation) && J(n.spec.axesSpec, i.spec.axesSpec) && Object.entries(n.spec.domain ?? {}).every(([a, f]) => {
84
- var d;
85
- return ((d = i.spec.domain) == null ? void 0 : d[a]) === f;
86
- })
87
- ).map(({ columnId: i, spec: a }) => ({
88
- value: i,
89
- label: A(a, g.Label) ?? "Unlabeled column"
84
+ return Map.groupBy(
85
+ t,
86
+ ({ markupColumn: c, sequenceColumn: l }) => {
87
+ const s = Object.fromEntries(
88
+ Object.entries(c.spec.domain ?? {}).filter(([u]) => {
89
+ var m;
90
+ return ((m = l.spec.domain) == null ? void 0 : m[u]) == null;
91
+ })
92
+ );
93
+ return v(s);
94
+ }
95
+ ).entries().map(([c, l]) => ({
96
+ label: Object.values(A(c)).join(", "),
97
+ value: l.map(({ markupColumn: s }) => s.columnId)
90
98
  })).toArray();
91
99
  }
92
- async function lt({
93
- pFrame: l,
100
+ async function X({
101
+ pFrame: n,
94
102
  sequenceColumnIds: r,
95
- labelColumnIds: m,
96
- selection: p,
97
- colorScheme: n,
98
- alignmentParams: i
99
- }) {
100
- var P;
101
- if (!l || !(r != null && r.length) || !m) return;
102
- const a = C(), f = await a.listColumns(l), d = f.filter((t) => Q(t.spec)), e = X({ selection: p });
103
+ labelColumnIds: a,
104
+ selection: e,
105
+ colorScheme: o,
106
+ alignmentParams: t,
107
+ shouldBuildPhylogeneticTree: i
108
+ }, c) {
109
+ var q;
110
+ if (!n || !(r != null && r.length) || !a) return;
111
+ const l = await ee({
112
+ pFrame: n,
113
+ sequenceColumnIds: r,
114
+ labelColumnIds: a,
115
+ selection: e,
116
+ colorScheme: o
117
+ }), s = ((q = l.at(0)) == null ? void 0 : q.data.data.length) ?? 0;
118
+ if (s < 2) return;
119
+ const u = s > D, m = te(r, l), d = ne(a, l), p = o.type === "markup" ? re(o.columnIds, l) : void 0, b = {}, y = await Promise.all(
120
+ m.map(async ({ name: w, rows: f }) => ({
121
+ name: w,
122
+ rows: await ae(
123
+ f,
124
+ JSON.parse(JSON.stringify(t)),
125
+ c
126
+ )
127
+ }))
128
+ );
129
+ let L;
130
+ if (i) {
131
+ L = await ie(
132
+ y,
133
+ c
134
+ );
135
+ const w = L.values().filter(({ id: f }) => f >= 0).map(({ id: f }) => f).toArray();
136
+ for (const f of y)
137
+ f.rows = w.map((g) => f.rows[g]);
138
+ for (const f of d)
139
+ f.rows = w.map((g) => f.rows[g]);
140
+ for (const f of p ?? [])
141
+ f.rows = w.map((g) => f.rows[g]);
142
+ }
143
+ return {
144
+ sequences: await Promise.all(
145
+ y.map(async ({ name: w, rows: f }, g) => {
146
+ const U = Z(f), k = oe({
147
+ colorScheme: o,
148
+ sequences: f,
149
+ residueCounts: U,
150
+ markup: p == null ? void 0 : p.at(g)
151
+ });
152
+ return k && Object.assign(b, k.legend), {
153
+ name: w,
154
+ rows: f,
155
+ residueCounts: U,
156
+ ...k && {
157
+ highlightImageUrl: await se(k.blob)
158
+ }
159
+ };
160
+ })
161
+ ),
162
+ labels: d,
163
+ ...Object.keys(b).length && {
164
+ highlightLegend: b
165
+ },
166
+ ...L && {
167
+ phylogeneticTree: L
168
+ },
169
+ exceedsLimit: u
170
+ };
171
+ }
172
+ async function ee({ pFrame: n, sequenceColumnIds: r, labelColumnIds: a, selection: e, colorScheme: o }) {
173
+ const t = x(), i = await t.listColumns(n), c = i.filter((p) => N(p.spec)), l = W({ selection: e });
103
174
  let s = {
104
175
  type: "inner",
105
- entries: r.map((t) => ({
176
+ entries: r.map((p) => ({
106
177
  type: "column",
107
- column: t
178
+ column: p
108
179
  }))
109
180
  };
110
- d.length > 0 && (s = {
181
+ c.length > 0 && (s = {
111
182
  type: "outer",
112
183
  primary: s,
113
- secondary: d.map(({ columnId: t }) => ({
184
+ secondary: c.map(({ columnId: p }) => ({
114
185
  type: "column",
115
- column: t
186
+ column: p
116
187
  }))
117
- }), e && (s = {
188
+ }), l && (s = {
118
189
  type: "inner",
119
190
  entries: [
120
191
  s,
121
192
  {
122
193
  type: "inlineColumn",
123
- column: e
194
+ column: l
124
195
  }
125
196
  ]
126
197
  });
127
- const c = m.flatMap((t) => t.type !== "column" ? [] : { type: "column", column: t.id });
128
- n.type === "markup" && c.push({ type: "column", column: n.columnId });
129
- const h = Array.from(
198
+ const u = a.flatMap((p) => p.type !== "column" ? [] : { type: "column", column: p.id });
199
+ if (o.type === "markup")
200
+ for (const p of o.columnIds)
201
+ u.push({ type: "column", column: p });
202
+ const m = Array.from(
130
203
  new Set(
131
- r.values().flatMap((t) => {
132
- const u = f.find(({ columnId: o }) => o === t);
133
- if (!u)
134
- throw new Error(`Couldn't find sequence column (ID: ${t})`);
135
- return u.spec.axesSpec.map((o) => v(O(o)));
204
+ r.values().flatMap((p) => {
205
+ const b = i.find(({ columnId: y }) => y === p);
206
+ if (!b)
207
+ throw new Error(`Couldn't find sequence column (ID: ${p})`);
208
+ return b.spec.axesSpec.map((y) => v(S(y)));
136
209
  })
137
210
  )
138
- ).sort().map((t) => ({
139
- column: { type: "axis", id: S(t) },
211
+ ).sort().map((p) => ({
212
+ column: { type: "axis", id: A(p) },
140
213
  ascending: !0,
141
214
  naAndAbsentAreLeastValues: !0
142
- })), x = {
215
+ })), d = {
143
216
  src: {
144
217
  type: "outer",
145
218
  primary: s,
146
- secondary: c
219
+ secondary: u
147
220
  },
148
221
  filters: [],
149
- sorting: h
150
- }, w = await a.calculateTableData(
151
- l,
152
- JSON.parse(JSON.stringify(x)),
222
+ sorting: m
223
+ };
224
+ return t.calculateTableData(
225
+ n,
226
+ JSON.parse(JSON.stringify(d)),
153
227
  {
154
228
  offset: 0,
155
229
  // +1 is a hack to check whether the selection is over the limit
156
- length: E + 1
230
+ length: D + 1
157
231
  }
158
232
  );
159
- let b = (w == null ? void 0 : w[0].data.data.length) ?? 0, I = !1;
160
- b > E && (b = E, I = !0);
161
- const R = r.map((t) => {
162
- const u = w.find(({ spec: o }) => o.id === t);
163
- if (!u)
164
- throw new Error(`Couldn't find sequence column (ID: \`${t}\`).`);
165
- return u;
166
- }), B = m.map((t) => {
167
- const u = w.find(({ spec: o }) => {
168
- if (t.type === "axis" && o.type === "axis")
169
- return J(t.id, o.id);
170
- if (t.type === "column" && o.type === "column")
171
- return t.id === o.id;
172
- });
173
- if (!u)
174
- throw new Error(`Couldn't find label column (ID: \`${t}\`).`);
175
- return u;
176
- }), T = await Promise.all(
177
- R.map(
178
- (t) => rt(
179
- Array.from(
180
- { length: b },
181
- (u, o) => {
182
- var y;
183
- return ((y = M(t.data, o, { na: "", absent: "" })) == null ? void 0 : y.toString()) ?? "";
184
- }
233
+ }
234
+ const te = (n, r) => n.map((a) => {
235
+ const e = r.find(({ spec: i }) => i.id === a);
236
+ if (!e)
237
+ throw new Error(`Couldn't find sequence column (ID: \`${a}\`).`);
238
+ const o = C(e.spec.spec, h.Label) ?? "Unlabeled column", t = e.data.data.keys().take(D).map(
239
+ (i) => {
240
+ var c;
241
+ return ((c = R(e.data, i, { absent: "", na: "" })) == null ? void 0 : c.toString()) ?? "";
242
+ }
243
+ ).toArray();
244
+ return { name: o, rows: t };
245
+ }), ne = (n, r) => n.map((a) => {
246
+ const e = r.find(({ spec: t }) => {
247
+ if (a.type === "axis" && t.type === "axis")
248
+ return O(a.id, t.id);
249
+ if (a.type === "column" && t.type === "column")
250
+ return a.id === t.id;
251
+ });
252
+ if (!e)
253
+ throw new Error(`Couldn't find label column (ID: \`${a}\`).`);
254
+ return { rows: e.data.data.keys().take(D).map(
255
+ (t) => {
256
+ var i;
257
+ return ((i = R(e.data, t, { absent: "", na: "" })) == null ? void 0 : i.toString()) ?? "";
258
+ }
259
+ ).toArray() };
260
+ }), re = (n, r) => n.map((a) => {
261
+ const e = r.find(({ spec: i }) => i.id === a);
262
+ if (!e)
263
+ throw new Error(`Couldn't find markup column (ID: \`${a}\`).`);
264
+ const o = J(
265
+ e.spec.spec,
266
+ h.Sequence.Annotation.Mapping
267
+ ) ?? {}, t = e.data.data.keys().take(D).map(
268
+ (i) => {
269
+ var c;
270
+ return z(
271
+ ((c = R(e.data, i, { absent: "", na: "" })) == null ? void 0 : c.toString()) ?? ""
272
+ );
273
+ }
274
+ ).toArray();
275
+ return { labels: o, rows: t };
276
+ }), ae = /* @__PURE__ */ (() => {
277
+ const n = /* @__PURE__ */ new Map();
278
+ return async (r, a, e) => {
279
+ const o = await I([r, a]);
280
+ let t = n.get(o);
281
+ return t || (t = await P(
282
+ new Worker(
283
+ new URL(
284
+ /* @vite-ignore */
285
+ "" + new URL("../../assets/multi-sequence-alignment.worker-Cm0gZp19.js", import.meta.url).href,
286
+ import.meta.url
185
287
  ),
186
- i
187
- )
188
- )
189
- ), $ = Array.from(
190
- { length: b },
191
- (t, u) => T.map((o) => o[u])
192
- ), V = R.map(
193
- (t) => A(t.spec.spec, g.Label) ?? "Unlabeled column"
194
- ), z = Array.from(
195
- { length: b },
196
- (t, u) => B.map(
197
- (o) => {
198
- var y;
199
- return ((y = M(o.data, u, { na: "", absent: "" })) == null ? void 0 : y.toString()) ?? "";
200
- }
201
- )
202
- ), D = $.map((t) => t.join(" ")), U = ot(D), L = {
203
- sequences: D,
204
- sequenceNames: V,
205
- labelRows: z,
206
- exceedsLimit: I,
207
- residueCounts: U
288
+ { type: "module" }
289
+ ),
290
+ { sequences: r, params: a },
291
+ e
292
+ ), n.set(o, t), t);
208
293
  };
294
+ })();
295
+ function oe({ colorScheme: n, sequences: r, residueCounts: a, markup: e }) {
296
+ var o;
209
297
  if (n.type === "chemical-properties")
210
- L.highlightImage = Z({
211
- sequences: D,
212
- residueCounts: U
213
- });
214
- else if (n.type === "markup") {
215
- const t = w.find(
216
- ({ spec: y }) => y.id === n.columnId
217
- );
218
- if (!t)
219
- throw new Error(
220
- `Couldn't find markup column (ID: \`${n.columnId}\`).`
221
- );
222
- const u = Array.from(
223
- { length: b },
224
- (y, _) => {
225
- var F;
226
- const W = tt(
227
- ((F = M(t.data, _, { na: "", absent: "" })) == null ? void 0 : F.toString()) ?? ""
228
- );
229
- return nt($[_][0], W);
230
- }
231
- ), o = j(t.spec.spec, g.Sequence.Annotation.Mapping) ?? {};
232
- L.highlightImage = et({
233
- markupRows: u,
234
- columnCount: ((P = D.at(0)) == null ? void 0 : P.length) ?? 0,
235
- labels: o
298
+ return V({ sequences: r, residueCounts: a });
299
+ if (n.type === "markup") {
300
+ if (!e)
301
+ throw new Error("Missing markup data.");
302
+ return Q({
303
+ markupRows: r.map((t, i) => {
304
+ const c = e.rows.at(i);
305
+ if (!c) throw new Error(`Missing markup for row ${i}.`);
306
+ return Y(t, c);
307
+ }),
308
+ columnCount: ((o = r.at(0)) == null ? void 0 : o.length) ?? 0,
309
+ labels: e.labels
236
310
  });
237
311
  }
238
- return L;
239
312
  }
240
- function k(l) {
241
- const r = q(), m = q(!0), p = q();
242
- let n;
243
- return (i) => (Y(i, async (a, f) => {
244
- if (J(a, f)) return;
245
- const d = n = Symbol();
313
+ const se = (n) => new Promise((r, a) => {
314
+ const e = new FileReader();
315
+ e.addEventListener("load", () => r(e.result)), e.addEventListener("error", () => a(e.error)), e.readAsDataURL(n);
316
+ }), ie = /* @__PURE__ */ (() => {
317
+ const n = /* @__PURE__ */ new Map();
318
+ return async (r, a) => {
319
+ var i;
320
+ const e = ((i = r.at(0)) == null ? void 0 : i.rows.keys().map((c) => r.map((l) => l.rows.at(c) ?? "").join("")).toArray()) ?? [], o = await I(e);
321
+ let t = n.get(o);
322
+ return t || (t = await P(
323
+ new Worker(
324
+ new URL(
325
+ /* @vite-ignore */
326
+ "" + new URL("../../assets/phylogenetic-tree.worker-4CrExYEo.js", import.meta.url).href,
327
+ import.meta.url
328
+ ),
329
+ { type: "module" }
330
+ ),
331
+ e,
332
+ a
333
+ ), n.set(o, t), t);
334
+ };
335
+ })(), P = (n, r, a) => new Promise((e, o) => {
336
+ n.addEventListener("message", ({ data: t }) => {
337
+ e(t), n.terminate();
338
+ }), n.addEventListener("error", ({ error: t, message: i }) => {
339
+ o(t ?? i), n.terminate();
340
+ }), a.addEventListener("abort", () => {
341
+ o(a.reason), n.terminate();
342
+ }), n.postMessage(r);
343
+ });
344
+ function E(n) {
345
+ const r = M(), a = M(!0), e = M();
346
+ let o;
347
+ return (t) => (F(t, async (i, c) => {
348
+ if (O(i, c)) return;
349
+ const l = new AbortController(), s = o = Symbol();
350
+ H(() => {
351
+ l.abort();
352
+ });
246
353
  try {
247
- p.value = void 0, m.value = !0;
248
- const e = await l(a);
249
- d === n && (r.value = e);
250
- } catch (e) {
251
- console.error(e), d === n && (p.value = G(e));
354
+ e.value = void 0, a.value = !0;
355
+ const u = await n(i, l.signal);
356
+ s === o && (r.value = u);
357
+ } catch (u) {
358
+ console.error(u), s === o && (e.value = T(u));
252
359
  } finally {
253
- d === n && (m.value = !1);
360
+ s === o && (a.value = !1);
254
361
  }
255
- }, { immediate: !0 }), { data: r, isLoading: m, error: p });
362
+ }, { immediate: !0 }), { data: r, isLoading: a, error: e });
256
363
  }
257
364
  export {
258
- E as sequenceLimit,
259
- wt as useLabelColumnsOptions,
260
- bt as useMarkupColumnsOptions,
261
- At as useMultipleAlignmentData,
262
- ht as useSequenceColumnsOptions
365
+ D as SEQUENCE_LIMIT,
366
+ he as useLabelColumnsOptions,
367
+ be as useMarkupColumnsOptions,
368
+ ve as useMultipleAlignmentData,
369
+ ge as useSequenceColumnsOptions
263
370
  };
264
371
  //# sourceMappingURL=data.js.map