@genspectrum/dashboard-components 0.4.5 → 0.5.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 (52) hide show
  1. package/README.md +2 -2
  2. package/custom-elements.json +178 -102
  3. package/dist/dashboard-components.js +473 -289
  4. package/dist/dashboard-components.js.map +1 -1
  5. package/dist/genspectrum-components.d.ts +93 -57
  6. package/dist/style.css +53 -13
  7. package/package.json +5 -5
  8. package/src/preact/aggregatedData/aggregate-table.tsx +4 -2
  9. package/src/preact/dateRangeSelector/date-range-selector.tsx +3 -5
  10. package/src/preact/mutationComparison/mutation-comparison-venn.tsx +1 -1
  11. package/src/preact/mutationComparison/mutation-comparison.stories.tsx +18 -18
  12. package/src/preact/mutationComparison/mutation-comparison.tsx +6 -6
  13. package/src/preact/mutationComparison/queryMutationData.ts +4 -4
  14. package/src/preact/mutations/mutations.stories.tsx +3 -3
  15. package/src/preact/mutations/mutations.tsx +16 -6
  16. package/src/preact/mutations/queryMutations.ts +3 -3
  17. package/src/preact/prevalenceOverTime/__mockData__/{denominatorOneVariant.json → denominatorFilterOneDataset.json} +1 -1
  18. package/src/preact/prevalenceOverTime/__mockData__/{numeratorOneVariant.json → numeratorFilterOneDataset.json} +1 -1
  19. package/src/preact/prevalenceOverTime/prevalence-over-time-bar-chart.tsx +42 -5
  20. package/src/preact/prevalenceOverTime/prevalence-over-time-bubble-chart.tsx +26 -7
  21. package/src/preact/prevalenceOverTime/prevalence-over-time-line-chart.tsx +62 -28
  22. package/src/preact/prevalenceOverTime/prevalence-over-time.stories.tsx +26 -16
  23. package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +38 -11
  24. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage-chart.tsx +39 -7
  25. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.stories.tsx +10 -4
  26. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +19 -10
  27. package/src/preact/shared/charts/confideceInterval.ts +7 -2
  28. package/src/preact/shared/charts/getYAxisMax.ts +24 -0
  29. package/src/preact/shared/charts/getYAxisScale.ts +1 -3
  30. package/src/query/queryAggregateData.ts +3 -3
  31. package/src/query/queryInsertions.ts +7 -2
  32. package/src/query/querySubstitutionsOrDeletions.ts +2 -2
  33. package/src/web-components/input/gs-date-range-selector.tsx +1 -1
  34. package/src/web-components/input/gs-location-filter.tsx +1 -1
  35. package/src/web-components/input/gs-mutation-filter.tsx +1 -1
  36. package/src/web-components/input/gs-text-input.tsx +1 -1
  37. package/src/web-components/visualization/gs-aggregate.tsx +2 -2
  38. package/src/web-components/visualization/gs-mutation-comparison.stories.ts +12 -12
  39. package/src/web-components/visualization/gs-mutation-comparison.tsx +18 -19
  40. package/src/web-components/visualization/gs-mutations.stories.ts +4 -4
  41. package/src/web-components/visualization/gs-mutations.tsx +10 -11
  42. package/src/web-components/visualization/gs-prevalence-over-time.stories.ts +46 -35
  43. package/src/web-components/visualization/gs-prevalence-over-time.tsx +54 -20
  44. package/src/web-components/visualization/gs-relative-growth-advantage.stories.ts +32 -18
  45. package/src/web-components/visualization/gs-relative-growth-advantage.tsx +51 -13
  46. /package/src/preact/mutationComparison/__mockData__/{nucleotideMutationsOtherVariant.json → nucleotideMutationsOtherDataset.json} +0 -0
  47. /package/src/preact/mutationComparison/__mockData__/{nucleotideMutationsSomeVariant.json → nucleotideMutationsSomeDataset.json} +0 -0
  48. /package/src/preact/prevalenceOverTime/__mockData__/{denominator.json → denominatorFilter.json} +0 -0
  49. /package/src/preact/prevalenceOverTime/__mockData__/{numeratorEG.json → numeratorFilterEG.json} +0 -0
  50. /package/src/preact/prevalenceOverTime/__mockData__/{numeratorJN1.json → numeratorFilterJN1.json} +0 -0
  51. /package/src/preact/relativeGrowthAdvantage/__mockData__/{denominator.json → denominatorFilter.json} +0 -0
  52. /package/src/preact/relativeGrowthAdvantage/__mockData__/{numerator.json → numeratorFilter.json} +0 -0
@@ -546,17 +546,17 @@ function u$1(e2, t2, n3, o2, i2, u2) {
546
546
  if ("function" == typeof e2 && (a2 = e2.defaultProps)) for (c2 in a2) void 0 === p2[c2] && (p2[c2] = a2[c2]);
547
547
  return options.vnode && options.vnode(l2), l2;
548
548
  }
549
- var t, r, u, i, o = 0, f = [], c = [], e = options, a = e.__b, v = e.__r, l = e.diffed, m = e.__c, s = e.unmount, d = e.__;
550
- function h(n3, t2) {
551
- e.__h && e.__h(r, n3, o || t2), o = 0;
549
+ var t, r, u, i, o = 0, f = [], c = options, e = c.__b, a = c.__r, v = c.diffed, l = c.__c, m = c.unmount, s = c.__;
550
+ function d(n3, t2) {
551
+ c.__h && c.__h(r, n3, o || t2), o = 0;
552
552
  var u2 = r.__H || (r.__H = { __: [], __h: [] });
553
- return n3 >= u2.__.length && u2.__.push({ __V: c }), u2.__[n3];
553
+ return n3 >= u2.__.length && u2.__.push({}), u2.__[n3];
554
554
  }
555
- function p(n3) {
556
- return o = 1, y(D$1, n3);
555
+ function h(n3) {
556
+ return o = 1, p(D$1, n3);
557
557
  }
558
- function y(n3, u2, i2) {
559
- var o2 = h(t++, 2);
558
+ function p(n3, u2, i2) {
559
+ var o2 = d(t++, 2);
560
560
  if (o2.t = n3, !o2.__c && (o2.__ = [i2 ? i2(u2) : D$1(void 0, u2), function(n4) {
561
561
  var t2 = o2.__N ? o2.__N[0] : o2.__[0], r2 = o2.t(t2, n4);
562
562
  t2 !== r2 && (o2.__N = [r2, o2.__[1]], o2.__c.setState({}));
@@ -589,25 +589,25 @@ function y(n3, u2, i2) {
589
589
  }
590
590
  return o2.__N || o2.__;
591
591
  }
592
- function _(n3, u2) {
593
- var i2 = h(t++, 3);
594
- !e.__s && C(i2.__H, u2) && (i2.__ = n3, i2.i = u2, r.__H.__h.push(i2));
592
+ function y(n3, u2) {
593
+ var i2 = d(t++, 3);
594
+ !c.__s && C(i2.__H, u2) && (i2.__ = n3, i2.i = u2, r.__H.__h.push(i2));
595
595
  }
596
- function F(n3) {
597
- return o = 5, q(function() {
596
+ function A(n3) {
597
+ return o = 5, T(function() {
598
598
  return { current: n3 };
599
599
  }, []);
600
600
  }
601
- function q(n3, r2) {
602
- var u2 = h(t++, 7);
603
- return C(u2.__H, r2) ? (u2.__V = n3(), u2.i = r2, u2.__h = n3, u2.__V) : u2.__;
601
+ function T(n3, r2) {
602
+ var u2 = d(t++, 7);
603
+ return C(u2.__H, r2) && (u2.__ = n3(), u2.__H = r2, u2.__h = n3), u2.__;
604
604
  }
605
- function P(n3) {
606
- var u2 = r.context[n3.__c], i2 = h(t++, 9);
605
+ function x(n3) {
606
+ var u2 = r.context[n3.__c], i2 = d(t++, 9);
607
607
  return i2.c = n3, u2 ? (null == i2.__ && (i2.__ = true, u2.sub(r)), u2.props.value) : n3.__;
608
608
  }
609
609
  function b2(n3) {
610
- var u2 = h(t++, 10), i2 = p();
610
+ var u2 = d(t++, 10), i2 = h();
611
611
  return u2.__ = n3, r.componentDidCatch || (r.componentDidCatch = function(n4, t2) {
612
612
  u2.__ && u2.__(n4, t2), i2[1](n4);
613
613
  }), [i2[0], function() {
@@ -618,26 +618,26 @@ function j() {
618
618
  for (var n3; n3 = f.shift(); ) if (n3.__P && n3.__H) try {
619
619
  n3.__H.__h.forEach(z), n3.__H.__h.forEach(B), n3.__H.__h = [];
620
620
  } catch (t2) {
621
- n3.__H.__h = [], e.__e(t2, n3.__v);
621
+ n3.__H.__h = [], c.__e(t2, n3.__v);
622
622
  }
623
623
  }
624
- e.__b = function(n3) {
625
- r = null, a && a(n3);
626
- }, e.__ = function(n3, t2) {
627
- n3 && t2.__k && t2.__k.__m && (n3.__m = t2.__k.__m), d && d(n3, t2);
628
- }, e.__r = function(n3) {
629
- v && v(n3), t = 0;
624
+ c.__b = function(n3) {
625
+ r = null, e && e(n3);
626
+ }, c.__ = function(n3, t2) {
627
+ n3 && t2.__k && t2.__k.__m && (n3.__m = t2.__k.__m), s && s(n3, t2);
628
+ }, c.__r = function(n3) {
629
+ a && a(n3), t = 0;
630
630
  var i2 = (r = n3.__c).__H;
631
631
  i2 && (u === r ? (i2.__h = [], r.__h = [], i2.__.forEach(function(n4) {
632
- n4.__N && (n4.__ = n4.__N), n4.__V = c, n4.__N = n4.i = void 0;
632
+ n4.__N && (n4.__ = n4.__N), n4.i = n4.__N = void 0;
633
633
  })) : (i2.__h.forEach(z), i2.__h.forEach(B), i2.__h = [], t = 0)), u = r;
634
- }, e.diffed = function(n3) {
635
- l && l(n3);
634
+ }, c.diffed = function(n3) {
635
+ v && v(n3);
636
636
  var t2 = n3.__c;
637
- t2 && t2.__H && (t2.__H.__h.length && (1 !== f.push(t2) && i === e.requestAnimationFrame || ((i = e.requestAnimationFrame) || w)(j)), t2.__H.__.forEach(function(n4) {
638
- n4.i && (n4.__H = n4.i), n4.__V !== c && (n4.__ = n4.__V), n4.i = void 0, n4.__V = c;
637
+ t2 && t2.__H && (t2.__H.__h.length && (1 !== f.push(t2) && i === c.requestAnimationFrame || ((i = c.requestAnimationFrame) || w)(j)), t2.__H.__.forEach(function(n4) {
638
+ n4.i && (n4.__H = n4.i), n4.i = void 0;
639
639
  })), u = r = null;
640
- }, e.__c = function(n3, t2) {
640
+ }, c.__c = function(n3, t2) {
641
641
  t2.some(function(n4) {
642
642
  try {
643
643
  n4.__h.forEach(z), n4.__h = n4.__h.filter(function(n5) {
@@ -646,11 +646,11 @@ e.__b = function(n3) {
646
646
  } catch (r2) {
647
647
  t2.some(function(n5) {
648
648
  n5.__h && (n5.__h = []);
649
- }), t2 = [], e.__e(r2, n4.__v);
649
+ }), t2 = [], c.__e(r2, n4.__v);
650
650
  }
651
- }), m && m(n3, t2);
652
- }, e.unmount = function(n3) {
653
- s && s(n3);
651
+ }), l && l(n3, t2);
652
+ }, c.unmount = function(n3) {
653
+ m && m(n3);
654
654
  var t2, r2 = n3.__c;
655
655
  r2 && r2.__H && (r2.__H.__.forEach(function(n4) {
656
656
  try {
@@ -658,7 +658,7 @@ e.__b = function(n3) {
658
658
  } catch (n5) {
659
659
  t2 = n5;
660
660
  }
661
- }), r2.__H = void 0, t2 && e.__e(t2, r2.__v));
661
+ }), r2.__H = void 0, t2 && c.__e(t2, r2.__v));
662
662
  };
663
663
  var k = "function" == typeof requestAnimationFrame;
664
664
  function w(n3) {
@@ -748,8 +748,8 @@ const tableStyle = {
748
748
  };
749
749
  const Table = ({ data, columns, pageSize }) => {
750
750
  const pagination = typeof pageSize === "number" ? { limit: pageSize } : pageSize;
751
- const wrapper3 = F(null);
752
- _(() => {
751
+ const wrapper3 = A(null);
752
+ y(() => {
753
753
  if (wrapper3.current === null) {
754
754
  return;
755
755
  }
@@ -948,9 +948,9 @@ const MutationComparisonTable = ({
948
948
  return /* @__PURE__ */ u$1(Table, { data: tableData, columns: headers, pageSize });
949
949
  };
950
950
  const GsChart = ({ configuration }) => {
951
- const canvasRef = F(null);
952
- const chartRef = F(null);
953
- _(() => {
951
+ const canvasRef = A(null);
952
+ const chartRef = A(null);
953
+ y(() => {
954
954
  if (canvasRef.current === null) {
955
955
  return;
956
956
  }
@@ -971,10 +971,10 @@ const MutationComparisonVenn = ({
971
971
  data,
972
972
  proportionInterval
973
973
  }) => {
974
- const divRef = F(null);
974
+ const divRef = A(null);
975
975
  const noElementSelectedMessage = "You have no elements selected. Click in the venn diagram to select.";
976
- const [selectedDatasetIndex, setSelectedDatasetIndex] = p(null);
977
- const sets = q(
976
+ const [selectedDatasetIndex, setSelectedDatasetIndex] = h(null);
977
+ const sets = T(
978
978
  () => extractSets(
979
979
  data.content.map((mutationData) => ({
980
980
  displayName: mutationData.displayName,
@@ -990,7 +990,7 @@ const MutationComparisonVenn = ({
990
990
  ),
991
991
  [data, proportionInterval]
992
992
  );
993
- _(() => {
993
+ y(() => {
994
994
  if (divRef.current === null) {
995
995
  return;
996
996
  }
@@ -1002,7 +1002,7 @@ const MutationComparisonVenn = ({
1002
1002
  const label = sets.datasets[0].data[selectedDatasetIndex].label;
1003
1003
  divRef.current.innerText = `${label}: ${values.join(", ")}` || "";
1004
1004
  }, [divRef, selectedDatasetIndex, sets]);
1005
- const config = q(
1005
+ const config = T(
1006
1006
  () => ({
1007
1007
  type: "venn",
1008
1008
  data: sets,
@@ -1027,7 +1027,7 @@ const MutationComparisonVenn = ({
1027
1027
  }
1028
1028
  },
1029
1029
  events: ["click"],
1030
- onClick(_2, elements) {
1030
+ onClick(_, elements) {
1031
1031
  if (elements.length === 0) {
1032
1032
  setSelectedDatasetIndex(null);
1033
1033
  }
@@ -1053,7 +1053,7 @@ const MutationComparisonVenn = ({
1053
1053
  [sets]
1054
1054
  );
1055
1055
  if (data.content.length > 5) {
1056
- return /* @__PURE__ */ u$1("div", { children: "Too many variants to display. Maximum are five. " });
1056
+ return /* @__PURE__ */ u$1("div", { children: "Too many datasets to display. Maximum are five. " });
1057
1057
  }
1058
1058
  return /* @__PURE__ */ u$1("div", { className: "h-full flex flex-col", children: [
1059
1059
  /* @__PURE__ */ u$1("div", { className: "flex-1", children: /* @__PURE__ */ u$1(GsChart, { configuration: config }) }),
@@ -1110,8 +1110,8 @@ class SortOperator {
1110
1110
  };
1111
1111
  }
1112
1112
  }
1113
- function querySubstitutionsOrDeletions(variant, sequenceType, lapis, signal) {
1114
- const fetchData = new FetchSubstitutionsOrDeletionsOperator(variant, sequenceType, 0);
1113
+ function querySubstitutionsOrDeletions(lapisFilter, sequenceType, lapis, signal) {
1114
+ const fetchData = new FetchSubstitutionsOrDeletionsOperator(lapisFilter, sequenceType, 0);
1115
1115
  const sortData = new SortOperator(fetchData, (a2, b3) => {
1116
1116
  if (a2.mutation.segment !== b3.mutation.segment) {
1117
1117
  return (a2.mutation.segment ?? "").localeCompare(b3.mutation.segment ?? "");
@@ -1120,12 +1120,12 @@ function querySubstitutionsOrDeletions(variant, sequenceType, lapis, signal) {
1120
1120
  });
1121
1121
  return sortData.evaluate(lapis, signal);
1122
1122
  }
1123
- async function queryMutationData(variants, sequenceType, lapis) {
1123
+ async function queryMutationData(lapisFilters, sequenceType, lapis) {
1124
1124
  const mutationData = await Promise.all(
1125
- variants.map(async (variant) => {
1125
+ lapisFilters.map(async (filter) => {
1126
1126
  return {
1127
- displayName: variant.displayName,
1128
- data: (await querySubstitutionsOrDeletions(variant.lapisFilter, sequenceType, lapis)).content
1127
+ displayName: filter.displayName,
1128
+ data: (await querySubstitutionsOrDeletions(filter.lapisFilter, sequenceType, lapis)).content
1129
1129
  };
1130
1130
  })
1131
1131
  );
@@ -1152,8 +1152,8 @@ function filterMutationData(data, displayedSegments, displayedMutationTypes) {
1152
1152
  }
1153
1153
  const LapisUrlContext = createContext$1("");
1154
1154
  function useFloatingUi(referenceRef, floatingRef, middleware, placement) {
1155
- const cleanupRef = F(null);
1156
- _(() => {
1155
+ const cleanupRef = A(null);
1156
+ y(() => {
1157
1157
  if (!referenceRef.current || !floatingRef.current) {
1158
1158
  return;
1159
1159
  }
@@ -1163,8 +1163,8 @@ function useFloatingUi(referenceRef, floatingRef, middleware, placement) {
1163
1163
  computePosition(reference, floating, {
1164
1164
  placement,
1165
1165
  middleware
1166
- }).then(({ x, y: y2 }) => {
1167
- floating.style.left = `${x}px`;
1166
+ }).then(({ x: x2, y: y2 }) => {
1167
+ floating.style.left = `${x2}px`;
1168
1168
  floating.style.top = `${y2}px`;
1169
1169
  });
1170
1170
  };
@@ -1178,7 +1178,7 @@ function useFloatingUi(referenceRef, floatingRef, middleware, placement) {
1178
1178
  }, [placement, middleware, referenceRef, floatingRef]);
1179
1179
  }
1180
1180
  function useCloseOnClickOutside(floatingRef, referenceRef, setShowContent) {
1181
- _(() => {
1181
+ y(() => {
1182
1182
  const handleClickOutside = (event) => {
1183
1183
  const path = event.composedPath();
1184
1184
  if (floatingRef.current && !path.includes(floatingRef.current) && referenceRef.current && !path.includes(referenceRef.current)) {
@@ -1192,7 +1192,7 @@ function useCloseOnClickOutside(floatingRef, referenceRef, setShowContent) {
1192
1192
  }, [floatingRef, referenceRef, setShowContent]);
1193
1193
  }
1194
1194
  function useCloseOnEsc(setShowHelp) {
1195
- _(() => {
1195
+ y(() => {
1196
1196
  const handleKeyDown = (event) => {
1197
1197
  if (event.key === "Escape") {
1198
1198
  setShowHelp(false);
@@ -1206,9 +1206,9 @@ function useCloseOnEsc(setShowHelp) {
1206
1206
  }
1207
1207
  const dropdownClass = "z-10 absolute w-max top-0 left-0 bg-white p-4 border border-gray-200 shadow-lg rounded-md";
1208
1208
  const Dropdown = ({ children, buttonTitle, placement }) => {
1209
- const [showContent, setShowContent] = p(false);
1210
- const referenceRef = F(null);
1211
- const floatingRef = F(null);
1209
+ const [showContent, setShowContent] = h(false);
1210
+ const referenceRef = A(null);
1211
+ const floatingRef = A(null);
1212
1212
  useFloatingUi(referenceRef, floatingRef, [offset(4), shift(), flip()], placement);
1213
1213
  useCloseOnClickOutside(floatingRef, referenceRef, setShowContent);
1214
1214
  useCloseOnEsc(setShowContent);
@@ -1273,13 +1273,13 @@ const SegmentSelector = ({
1273
1273
  );
1274
1274
  };
1275
1275
  function useDisplayedSegments(sequenceType) {
1276
- const referenceGenome = P(ReferenceGenomeContext);
1276
+ const referenceGenome = x(ReferenceGenomeContext);
1277
1277
  const displayedSegments = getSegmentNames(referenceGenome, sequenceType).map((segment) => ({
1278
1278
  segment,
1279
1279
  label: segment,
1280
1280
  checked: true
1281
1281
  }));
1282
- return p(displayedSegments);
1282
+ return h(displayedSegments);
1283
1283
  }
1284
1284
  const CsvDownloadButton = ({
1285
1285
  label = "Download",
@@ -1323,7 +1323,7 @@ class UserFacingError extends Error {
1323
1323
  }
1324
1324
  const ErrorDisplay = ({ error }) => {
1325
1325
  console.error(error);
1326
- const ref = F(null);
1326
+ const ref = A(null);
1327
1327
  return /* @__PURE__ */ u$1("div", { className: "h-full w-full rounded-md border-2 border-gray-100 p-2 flex items-center justify-center flex-col", children: [
1328
1328
  /* @__PURE__ */ u$1("div", { className: "text-red-700 font-bold", children: "Error" }),
1329
1329
  /* @__PURE__ */ u$1("div", { children: [
@@ -1363,9 +1363,9 @@ const Headline = ({ heading, children }) => {
1363
1363
  return /* @__PURE__ */ u$1(ResizingHeadline, { heading, children });
1364
1364
  };
1365
1365
  const ResizingHeadline = ({ heading, children }) => {
1366
- const ref = F(null);
1367
- const [h1Height, setH1Height] = p("2rem");
1368
- _(() => {
1366
+ const ref = A(null);
1367
+ const [h1Height, setH1Height] = h("2rem");
1368
+ y(() => {
1369
1369
  if (ref.current) {
1370
1370
  const h1Height2 = ref.current.getBoundingClientRect().height;
1371
1371
  setH1Height(`${h1Height2}px`);
@@ -1384,9 +1384,9 @@ const ErrorBoundary = ({ size: size2, headline, children }) => {
1384
1384
  return /* @__PURE__ */ u$1(Fragment, { children });
1385
1385
  };
1386
1386
  const Info = ({ children, height }) => {
1387
- const [showHelp, setShowHelp] = p(false);
1388
- const referenceRef = F(null);
1389
- const floatingRef = F(null);
1387
+ const [showHelp, setShowHelp] = h(false);
1388
+ const referenceRef = A(null);
1389
+ const floatingRef = A(null);
1390
1390
  useFloatingUi(referenceRef, floatingRef, [
1391
1391
  offset(10),
1392
1392
  shift(),
@@ -1471,7 +1471,7 @@ const MinMaxRangeSlider = ({
1471
1471
  }) => {
1472
1472
  const sliderColor = "#C6C6C6";
1473
1473
  const rangeColor = "#387bbe";
1474
- const [zIndexTo, setZIndexTo] = p(0);
1474
+ const [zIndexTo, setZIndexTo] = h(0);
1475
1475
  const onMinChange = (event) => {
1476
1476
  const input = event.target;
1477
1477
  const minValue = Number(input.value);
@@ -1540,8 +1540,8 @@ const percentageInRange = (percentage) => {
1540
1540
  return percentage <= 100 && percentage >= 0;
1541
1541
  };
1542
1542
  const PercentInput = ({ percentage, setPercentage }) => {
1543
- const [internalPercentage, setInternalPercentage] = p(percentage);
1544
- _(() => {
1543
+ const [internalPercentage, setInternalPercentage] = h(percentage);
1544
+ y(() => {
1545
1545
  setInternalPercentage(percentage);
1546
1546
  }, [percentage]);
1547
1547
  const handleInputChange = (event) => {
@@ -1622,16 +1622,16 @@ const ProportionSelectorDropdown = ({
1622
1622
  ) });
1623
1623
  };
1624
1624
  const Tabs = ({ tabs, toolbar }) => {
1625
- const [activeTab, setActiveTab] = p(tabs[0].title);
1626
- const [heightOfTabs, setHeightOfTabs] = p("3rem");
1627
- const tabRef = F(null);
1625
+ const [activeTab, setActiveTab] = h(tabs[0].title);
1626
+ const [heightOfTabs, setHeightOfTabs] = h("3rem");
1627
+ const tabRef = A(null);
1628
1628
  const updateHeightOfTabs = () => {
1629
1629
  if (tabRef.current) {
1630
1630
  const heightOfTabs2 = tabRef.current.getBoundingClientRect().height;
1631
1631
  setHeightOfTabs(`${heightOfTabs2}px`);
1632
1632
  }
1633
1633
  };
1634
- _(() => {
1634
+ y(() => {
1635
1635
  updateHeightOfTabs();
1636
1636
  window.addEventListener("resize", updateHeightOfTabs);
1637
1637
  return () => {
@@ -1667,10 +1667,10 @@ const Tabs = ({ tabs, toolbar }) => {
1667
1667
  ] });
1668
1668
  };
1669
1669
  function useQuery(fetchDataCallback, dependencies = []) {
1670
- const [data, setData] = p(null);
1671
- const [error, setError] = p(null);
1672
- const [isLoading, setIsLoading] = p(true);
1673
- _(() => {
1670
+ const [data, setData] = h(null);
1671
+ const [error, setError] = h(null);
1672
+ const [isLoading, setIsLoading] = h(true);
1673
+ y(() => {
1674
1674
  const fetchData = async () => {
1675
1675
  setIsLoading(true);
1676
1676
  try {
@@ -1688,7 +1688,7 @@ function useQuery(fetchDataCallback, dependencies = []) {
1688
1688
  return { data, error, isLoading };
1689
1689
  }
1690
1690
  const MutationComparison = ({
1691
- variants,
1691
+ lapisFilters,
1692
1692
  sequenceType,
1693
1693
  views,
1694
1694
  width,
@@ -1700,7 +1700,7 @@ const MutationComparison = ({
1700
1700
  return /* @__PURE__ */ u$1(ErrorBoundary, { size: size2, headline, children: /* @__PURE__ */ u$1(ResizeContainer, { size: size2, children: /* @__PURE__ */ u$1(Headline, { heading: headline, children: /* @__PURE__ */ u$1(
1701
1701
  MutationComparisonInner,
1702
1702
  {
1703
- variants,
1703
+ lapisFilters,
1704
1704
  sequenceType,
1705
1705
  views,
1706
1706
  pageSize
@@ -1708,15 +1708,15 @@ const MutationComparison = ({
1708
1708
  ) }) }) });
1709
1709
  };
1710
1710
  const MutationComparisonInner = ({
1711
- variants,
1711
+ lapisFilters,
1712
1712
  sequenceType,
1713
1713
  views,
1714
1714
  pageSize
1715
1715
  }) => {
1716
- const lapis = P(LapisUrlContext);
1716
+ const lapis = x(LapisUrlContext);
1717
1717
  const { data, error, isLoading } = useQuery(async () => {
1718
- return queryMutationData(variants, sequenceType, lapis);
1719
- }, [variants, sequenceType, lapis]);
1718
+ return queryMutationData(lapisFilters, sequenceType, lapis);
1719
+ }, [lapisFilters, sequenceType, lapis]);
1720
1720
  if (isLoading) {
1721
1721
  return /* @__PURE__ */ u$1(LoadingDisplay, {});
1722
1722
  }
@@ -1742,13 +1742,13 @@ const MutationComparisonTabs = ({
1742
1742
  sequenceType,
1743
1743
  pageSize
1744
1744
  }) => {
1745
- const [proportionInterval, setProportionInterval] = p({ min: 0.5, max: 1 });
1746
- const [displayedMutationTypes, setDisplayedMutationTypes] = p([
1745
+ const [proportionInterval, setProportionInterval] = h({ min: 0.5, max: 1 });
1746
+ const [displayedMutationTypes, setDisplayedMutationTypes] = h([
1747
1747
  { label: "Substitutions", checked: true, type: "substitution" },
1748
1748
  { label: "Deletions", checked: true, type: "deletion" }
1749
1749
  ]);
1750
1750
  const [displayedSegments, setDisplayedSegments] = useDisplayedSegments(sequenceType);
1751
- const filteredData = q(
1751
+ const filteredData = T(
1752
1752
  () => filterMutationData(data, displayedSegments, displayedMutationTypes),
1753
1753
  [data, displayedSegments, displayedMutationTypes]
1754
1754
  );
@@ -2299,7 +2299,11 @@ html {
2299
2299
  }
2300
2300
 
2301
2301
  * {
2302
- scrollbar-color: currentColor transparent;
2302
+ scrollbar-color: color-mix(in oklch, currentColor 35%, transparent) transparent;
2303
+ }
2304
+
2305
+ *:hover {
2306
+ scrollbar-color: color-mix(in oklch, currentColor 60%, transparent) transparent;
2303
2307
  }
2304
2308
 
2305
2309
  :root {
@@ -2931,8 +2935,8 @@ html {
2931
2935
  appearance: none;
2932
2936
  height: 3rem;
2933
2937
  min-height: 3rem;
2934
- padding-left: 1rem;
2935
- padding-right: 2.5rem;
2938
+ padding-inline-start: 1rem;
2939
+ padding-inline-end: 2.5rem;
2936
2940
  font-size: 0.875rem;
2937
2941
  line-height: 1.25rem;
2938
2942
  line-height: 2;
@@ -2974,7 +2978,9 @@ html {
2974
2978
  display: grid;
2975
2979
  align-items: flex-end;
2976
2980
  }
2977
- .tabs-lifted:has(.tab-content[class^="rounded-"]) .tab:first-child:not(:is(.tab-active, [aria-selected="true"])), .tabs-lifted:has(.tab-content[class*=" rounded-"]) .tab:first-child:not(:is(.tab-active, [aria-selected="true"])) {
2981
+ .tabs-lifted:has(.tab-content[class^="rounded-"])
2982
+ .tab:first-child:not(:is(.tab-active, [aria-selected="true"])), .tabs-lifted:has(.tab-content[class*=" rounded-"])
2983
+ .tab:first-child:not(:is(.tab-active, [aria-selected="true"])) {
2978
2984
  border-bottom-color: transparent;
2979
2985
  }
2980
2986
  .tab {
@@ -3307,6 +3313,9 @@ input.tab:checked + .tab-content,
3307
3313
  margin-bottom: 0px;
3308
3314
  margin-inline-start: -1px;
3309
3315
  }
3316
+ .join > :where(*:not(:first-child)):is(.btn) {
3317
+ margin-inline-start: calc(var(--border-btn) * -1);
3318
+ }
3310
3319
  .loading {
3311
3320
  pointer-events: none;
3312
3321
  display: inline-block;
@@ -3812,7 +3821,7 @@ input.tab:checked + .tab-content,
3812
3821
  .tabs-boxed .tab {
3813
3822
  border-radius: var(--rounded-btn, 0.5rem);
3814
3823
  }
3815
- :is([dir="rtl"] .table) {
3824
+ .table:where([dir="rtl"], [dir="rtl"] *) {
3816
3825
  text-align: right;
3817
3826
  }
3818
3827
  .table :where(th, td) {
@@ -3828,7 +3837,7 @@ input.tab:checked + .tab-content,
3828
3837
  --tw-bg-opacity: 1;
3829
3838
  background-color: var(--fallback-b2,oklch(var(--b2)/var(--tw-bg-opacity)));
3830
3839
  }
3831
- .table :where(thead tr, tbody tr:not(:last-child),tbody tr:first-child:last-child) {
3840
+ .table :where(thead tr, tbody tr:not(:last-child), tbody tr:first-child:last-child) {
3832
3841
  border-bottom-width: 1px;
3833
3842
  --tw-border-opacity: 1;
3834
3843
  border-bottom-color: var(--fallback-b2,oklch(var(--b2)/var(--tw-border-opacity)));
@@ -4057,11 +4066,17 @@ input.tab:checked + .tab-content,
4057
4066
  margin-right: 0px;
4058
4067
  margin-top: -1px;
4059
4068
  }
4069
+ .join.join-vertical > :where(*:not(:first-child)):is(.btn) {
4070
+ margin-top: calc(var(--border-btn) * -1);
4071
+ }
4060
4072
  .join.join-horizontal > :where(*:not(:first-child)) {
4061
4073
  margin-top: 0px;
4062
4074
  margin-bottom: 0px;
4063
4075
  margin-inline-start: -1px;
4064
4076
  }
4077
+ .join.join-horizontal > :where(*:not(:first-child)):is(.btn) {
4078
+ margin-inline-start: calc(var(--border-btn) * -1);
4079
+ }
4065
4080
  .modal-top :where(.modal-box) {
4066
4081
  width: 100%;
4067
4082
  max-width: none;
@@ -4112,7 +4127,7 @@ input.tab:checked + .tab-content,
4112
4127
  content: "";
4113
4128
  margin-inline-start: -100%;
4114
4129
  }
4115
- :is([dir="rtl"] .steps-horizontal .step):before {
4130
+ .steps-horizontal .step:where([dir="rtl"], [dir="rtl"] *):before {
4116
4131
  --tw-translate-x: 0px;
4117
4132
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
4118
4133
  }
@@ -4131,7 +4146,7 @@ input.tab:checked + .tab-content,
4131
4146
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
4132
4147
  margin-inline-start: 50%;
4133
4148
  }
4134
- :is([dir="rtl"] .steps-vertical .step):before {
4149
+ .steps-vertical .step:where([dir="rtl"], [dir="rtl"] *):before {
4135
4150
  --tw-translate-x: 50%;
4136
4151
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
4137
4152
  }
@@ -4165,6 +4180,7 @@ input.tab:checked + .tab-content,
4165
4180
  }
4166
4181
  .tooltip:before {
4167
4182
  max-width: 20rem;
4183
+ white-space: normal;
4168
4184
  border-radius: 0.25rem;
4169
4185
  padding-left: 0.5rem;
4170
4186
  padding-right: 0.5rem;
@@ -4257,6 +4273,10 @@ input.tab:checked + .tab-content,
4257
4273
  margin-left: 0.25rem;
4258
4274
  margin-right: 0.25rem;
4259
4275
  }
4276
+ .mx-auto {
4277
+ margin-left: auto;
4278
+ margin-right: auto;
4279
+ }
4260
4280
  .my-1 {
4261
4281
  margin-top: 0.25rem;
4262
4282
  margin-bottom: 0.25rem;
@@ -4268,6 +4288,15 @@ input.tab:checked + .tab-content,
4268
4288
  .mb-2 {
4269
4289
  margin-bottom: 0.5rem;
4270
4290
  }
4291
+ .ml-2 {
4292
+ margin-left: 0.5rem;
4293
+ }
4294
+ .ml-2\\.5 {
4295
+ margin-left: 0.625rem;
4296
+ }
4297
+ .ml-3 {
4298
+ margin-left: 0.75rem;
4299
+ }
4271
4300
  .mr-2 {
4272
4301
  margin-right: 0.5rem;
4273
4302
  }
@@ -4301,12 +4330,12 @@ input.tab:checked + .tab-content,
4301
4330
  .w-32 {
4302
4331
  width: 8rem;
4303
4332
  }
4304
- .w-40 {
4305
- width: 10rem;
4306
- }
4307
4333
  .w-64 {
4308
4334
  width: 16rem;
4309
4335
  }
4336
+ .w-\\[7\\.5rem\\] {
4337
+ width: 7.5rem;
4338
+ }
4310
4339
  .w-full {
4311
4340
  width: 100%;
4312
4341
  }
@@ -4314,8 +4343,8 @@ input.tab:checked + .tab-content,
4314
4343
  width: -moz-max-content;
4315
4344
  width: max-content;
4316
4345
  }
4317
- .min-w-40 {
4318
- min-width: 10rem;
4346
+ .min-w-\\[7\\.5rem\\] {
4347
+ min-width: 7.5rem;
4319
4348
  }
4320
4349
  .max-w-screen-lg {
4321
4350
  max-width: 1024px;
@@ -4341,6 +4370,9 @@ input.tab:checked + .tab-content,
4341
4370
  .flex-wrap {
4342
4371
  flex-wrap: wrap;
4343
4372
  }
4373
+ .items-end {
4374
+ align-items: flex-end;
4375
+ }
4344
4376
  .items-center {
4345
4377
  align-items: center;
4346
4378
  }
@@ -4470,6 +4502,10 @@ input.tab:checked + .tab-content,
4470
4502
  .text-justify {
4471
4503
  text-align: justify;
4472
4504
  }
4505
+ .text-2xl {
4506
+ font-size: 1.5rem;
4507
+ line-height: 2rem;
4508
+ }
4473
4509
  .text-base {
4474
4510
  font-size: 1rem;
4475
4511
  line-height: 1.5rem;
@@ -4499,6 +4535,10 @@ input.tab:checked + .tab-content,
4499
4535
  .leading-5 {
4500
4536
  line-height: 1.25rem;
4501
4537
  }
4538
+ .text-\\[\\#606060\\] {
4539
+ --tw-text-opacity: 1;
4540
+ color: rgb(96 96 96 / var(--tw-text-opacity));
4541
+ }
4502
4542
  .text-blue-600 {
4503
4543
  --tw-text-opacity: 1;
4504
4544
  color: rgb(37 99 235 / var(--tw-text-opacity));
@@ -4628,7 +4668,7 @@ var __decorateClass$8 = (decorators, target, key, kind) => {
4628
4668
  let MutationComparisonComponent = class extends PreactLitAdapterWithGridJsStyles {
4629
4669
  constructor() {
4630
4670
  super(...arguments);
4631
- this.variants = [];
4671
+ this.lapisFilters = [];
4632
4672
  this.sequenceType = "nucleotide";
4633
4673
  this.views = ["table"];
4634
4674
  this.width = "100%";
@@ -4640,7 +4680,7 @@ let MutationComparisonComponent = class extends PreactLitAdapterWithGridJsStyles
4640
4680
  return /* @__PURE__ */ u$1(
4641
4681
  MutationComparison,
4642
4682
  {
4643
- variants: this.variants,
4683
+ lapisFilters: this.lapisFilters,
4644
4684
  sequenceType: this.sequenceType,
4645
4685
  views: this.views,
4646
4686
  width: this.width,
@@ -4653,7 +4693,7 @@ let MutationComparisonComponent = class extends PreactLitAdapterWithGridJsStyles
4653
4693
  };
4654
4694
  __decorateClass$8([
4655
4695
  n2({ type: Array })
4656
- ], MutationComparisonComponent.prototype, "variants", 2);
4696
+ ], MutationComparisonComponent.prototype, "lapisFilters", 2);
4657
4697
  __decorateClass$8([
4658
4698
  n2({ type: String })
4659
4699
  ], MutationComparisonComponent.prototype, "sequenceType", 2);
@@ -4899,8 +4939,8 @@ class FetchInsertionsOperator {
4899
4939
  return { content };
4900
4940
  }
4901
4941
  }
4902
- function queryInsertions(variant, sequenceType, lapis, signal) {
4903
- const fetchData = new FetchInsertionsOperator(variant, sequenceType);
4942
+ function queryInsertions(lapisFilter, sequenceType, lapis, signal) {
4943
+ const fetchData = new FetchInsertionsOperator(lapisFilter, sequenceType);
4904
4944
  const sortData = new SortOperator(fetchData, (a2, b3) => {
4905
4945
  if (a2.mutation.segment !== b3.mutation.segment) {
4906
4946
  return (a2.mutation.segment ?? "").localeCompare(b3.mutation.segment ?? "");
@@ -4909,9 +4949,9 @@ function queryInsertions(variant, sequenceType, lapis, signal) {
4909
4949
  });
4910
4950
  return sortData.evaluate(lapis, signal);
4911
4951
  }
4912
- async function queryMutationsData(variant, sequenceType, lapis) {
4913
- const substitutionsOrDeletions = (await querySubstitutionsOrDeletions(variant, sequenceType, lapis)).content;
4914
- const insertions = (await queryInsertions(variant, sequenceType, lapis)).content;
4952
+ async function queryMutationsData(lapisFilter, sequenceType, lapis) {
4953
+ const substitutionsOrDeletions = (await querySubstitutionsOrDeletions(lapisFilter, sequenceType, lapis)).content;
4954
+ const insertions = (await queryInsertions(lapisFilter, sequenceType, lapis)).content;
4915
4955
  return {
4916
4956
  substitutionsOrDeletions,
4917
4957
  insertions
@@ -4939,7 +4979,7 @@ function filterMutationsData(data, displayedSegments, displayedMutationTypes) {
4939
4979
  };
4940
4980
  }
4941
4981
  const Mutations = ({
4942
- variant,
4982
+ lapisFilter,
4943
4983
  sequenceType,
4944
4984
  views,
4945
4985
  width,
@@ -4948,13 +4988,26 @@ const Mutations = ({
4948
4988
  pageSize
4949
4989
  }) => {
4950
4990
  const size2 = { height, width };
4951
- return /* @__PURE__ */ u$1(ErrorBoundary, { size: size2, headline, children: /* @__PURE__ */ u$1(ResizeContainer, { size: size2, children: /* @__PURE__ */ u$1(Headline, { heading: headline, children: /* @__PURE__ */ u$1(MutationsInner, { variant, sequenceType, views, pageSize }) }) }) });
4991
+ return /* @__PURE__ */ u$1(ErrorBoundary, { size: size2, headline, children: /* @__PURE__ */ u$1(ResizeContainer, { size: size2, children: /* @__PURE__ */ u$1(Headline, { heading: headline, children: /* @__PURE__ */ u$1(
4992
+ MutationsInner,
4993
+ {
4994
+ lapisFilter,
4995
+ sequenceType,
4996
+ views,
4997
+ pageSize
4998
+ }
4999
+ ) }) }) });
4952
5000
  };
4953
- const MutationsInner = ({ variant, sequenceType, views, pageSize }) => {
4954
- const lapis = P(LapisUrlContext);
5001
+ const MutationsInner = ({
5002
+ lapisFilter,
5003
+ sequenceType,
5004
+ views,
5005
+ pageSize
5006
+ }) => {
5007
+ const lapis = x(LapisUrlContext);
4955
5008
  const { data, error, isLoading } = useQuery(async () => {
4956
- return queryMutationsData(variant, sequenceType, lapis);
4957
- }, [variant, sequenceType, lapis]);
5009
+ return queryMutationsData(lapisFilter, sequenceType, lapis);
5010
+ }, [lapisFilter, sequenceType, lapis]);
4958
5011
  if (isLoading) {
4959
5012
  return /* @__PURE__ */ u$1(LoadingDisplay, {});
4960
5013
  }
@@ -4967,9 +5020,9 @@ const MutationsInner = ({ variant, sequenceType, views, pageSize }) => {
4967
5020
  return /* @__PURE__ */ u$1(MutationsTabs, { mutationsData: data, sequenceType, views, pageSize });
4968
5021
  };
4969
5022
  const MutationsTabs = ({ mutationsData, sequenceType, views, pageSize }) => {
4970
- const [proportionInterval, setProportionInterval] = p({ min: 0.05, max: 1 });
5023
+ const [proportionInterval, setProportionInterval] = h({ min: 0.05, max: 1 });
4971
5024
  const [displayedSegments, setDisplayedSegments] = useDisplayedSegments(sequenceType);
4972
- const [displayedMutationTypes, setDisplayedMutationTypes] = p([
5025
+ const [displayedMutationTypes, setDisplayedMutationTypes] = h([
4973
5026
  { label: "Substitutions", checked: true, type: "substitution" },
4974
5027
  { label: "Deletions", checked: true, type: "deletion" }
4975
5028
  ]);
@@ -5090,7 +5143,7 @@ var __decorateClass$7 = (decorators, target, key, kind) => {
5090
5143
  let MutationsComponent = class extends PreactLitAdapterWithGridJsStyles {
5091
5144
  constructor() {
5092
5145
  super(...arguments);
5093
- this.variant = {};
5146
+ this.lapisFilter = {};
5094
5147
  this.sequenceType = "nucleotide";
5095
5148
  this.views = ["table", "grid"];
5096
5149
  this.width = "100%";
@@ -5102,7 +5155,7 @@ let MutationsComponent = class extends PreactLitAdapterWithGridJsStyles {
5102
5155
  return /* @__PURE__ */ u$1(
5103
5156
  Mutations,
5104
5157
  {
5105
- variant: this.variant,
5158
+ lapisFilter: this.lapisFilter,
5106
5159
  sequenceType: this.sequenceType,
5107
5160
  views: this.views,
5108
5161
  width: this.width,
@@ -5115,7 +5168,7 @@ let MutationsComponent = class extends PreactLitAdapterWithGridJsStyles {
5115
5168
  };
5116
5169
  __decorateClass$7([
5117
5170
  n2({ type: Object })
5118
- ], MutationsComponent.prototype, "variant", 2);
5171
+ ], MutationsComponent.prototype, "lapisFilter", 2);
5119
5172
  __decorateClass$7([
5120
5173
  n2({ type: String })
5121
5174
  ], MutationsComponent.prototype, "sequenceType", 2);
@@ -5213,7 +5266,23 @@ function wilson95PercentConfidenceInterval(observed, sample) {
5213
5266
  }
5214
5267
  const confidenceIntervalDataLabel = (value, lowerLimit, upperLimit, prefix) => {
5215
5268
  const label = prefix ? `${prefix}: ` : "";
5216
- return `${label}${value.toFixed(3)} (${lowerLimit.toFixed(3)} - ${upperLimit.toFixed(3)})`;
5269
+ return `${label}${value.toFixed(3)} (${lowerLimit == null ? void 0 : lowerLimit.toFixed(3)} - ${upperLimit == null ? void 0 : upperLimit.toFixed(3)})`;
5270
+ };
5271
+ const getYAxisMax = (maxInData2, axisMax) => {
5272
+ if (!axisMax) {
5273
+ return 1;
5274
+ }
5275
+ switch (axisMax) {
5276
+ case "limitTo1": {
5277
+ return maxInData2 > 1 ? 1 : maxInData2;
5278
+ }
5279
+ case "maxInData": {
5280
+ return maxInData2;
5281
+ }
5282
+ default: {
5283
+ return axisMax;
5284
+ }
5285
+ }
5217
5286
  };
5218
5287
  function getYAxisScale(scaleType) {
5219
5288
  switch (scaleType) {
@@ -5221,35 +5290,37 @@ function getYAxisScale(scaleType) {
5221
5290
  return { beginAtZero: true, type: "linear", min: 0, max: 1 };
5222
5291
  }
5223
5292
  case "logarithmic": {
5224
- return { type: "logarithmic" };
5293
+ return { type: "logarithmic", max: 1 };
5225
5294
  }
5226
5295
  case "logit":
5227
5296
  return { type: "logit" };
5228
- default:
5229
- return { beginAtZero: true, type: "linear" };
5230
5297
  }
5231
5298
  }
5232
5299
  Chart.register(...registerables, LogitScale, BarWithErrorBarsController, BarWithErrorBar);
5233
5300
  const PrevalenceOverTimeBarChart = ({
5234
5301
  data,
5235
5302
  yAxisScaleType,
5236
- confidenceIntervalMethod
5303
+ confidenceIntervalMethod,
5304
+ yAxisMaxConfig
5237
5305
  }) => {
5238
- var _a;
5306
+ const nullFirstData = data.map((variantData) => {
5307
+ return {
5308
+ content: variantData.content.sort(sortNullToBeginningThenByDate),
5309
+ displayName: variantData.displayName
5310
+ };
5311
+ });
5312
+ const datasets2 = nullFirstData.map((graphData, index) => getDataset$1(graphData, index, confidenceIntervalMethod));
5313
+ const maxY = yAxisScaleType !== "logit" ? getYAxisMax(maxInData(nullFirstData), yAxisMaxConfig == null ? void 0 : yAxisMaxConfig[yAxisScaleType]) : void 0;
5239
5314
  const config = {
5240
5315
  type: BarWithErrorBarsController.id,
5241
5316
  data: {
5242
- labels: ((_a = data[0]) == null ? void 0 : _a.content.map((dateRange) => {
5243
- var _a2;
5244
- return ((_a2 = dateRange.dateRange) == null ? void 0 : _a2.toString()) ?? "Unknown";
5245
- })) || [],
5246
- datasets: data.map((graphData, index) => datasets$1(graphData, index, confidenceIntervalMethod))
5317
+ datasets: datasets2
5247
5318
  },
5248
5319
  options: {
5249
5320
  maintainAspectRatio: false,
5250
5321
  animation: false,
5251
5322
  scales: {
5252
- y: getYAxisScale(yAxisScaleType)
5323
+ y: { ...getYAxisScale(yAxisScaleType), max: maxY }
5253
5324
  },
5254
5325
  plugins: {
5255
5326
  legend: {
@@ -5261,7 +5332,10 @@ const PrevalenceOverTimeBarChart = ({
5261
5332
  };
5262
5333
  return /* @__PURE__ */ u$1(GsChart, { configuration: config });
5263
5334
  };
5264
- const datasets$1 = (prevalenceOverTimeVariant, index, confidenceIntervalMethod) => {
5335
+ function sortNullToBeginningThenByDate(a2, b3) {
5336
+ return a2.dateRange === null ? -1 : b3.dateRange === null ? 1 : a2.dateRange.toString().localeCompare(b3.dateRange.toString());
5337
+ }
5338
+ const getDataset$1 = (prevalenceOverTimeVariant, index, confidenceIntervalMethod) => {
5265
5339
  const generalConfig = {
5266
5340
  borderWidth: 1,
5267
5341
  pointRadius: 0,
@@ -5273,16 +5347,22 @@ const datasets$1 = (prevalenceOverTimeVariant, index, confidenceIntervalMethod)
5273
5347
  case "wilson":
5274
5348
  return {
5275
5349
  ...generalConfig,
5276
- data: prevalenceOverTimeVariant.content.map((dataPoint) => ({
5277
- y: dataPoint.prevalence,
5278
- yMin: wilson95PercentConfidenceInterval(dataPoint.count, dataPoint.total).lowerLimit,
5279
- yMax: wilson95PercentConfidenceInterval(dataPoint.count, dataPoint.total).upperLimit
5280
- }))
5350
+ data: prevalenceOverTimeVariant.content.map((dataPoint) => {
5351
+ var _a;
5352
+ return {
5353
+ y: dataPoint.prevalence,
5354
+ yMin: wilson95PercentConfidenceInterval(dataPoint.count, dataPoint.total).lowerLimit,
5355
+ yMax: wilson95PercentConfidenceInterval(dataPoint.count, dataPoint.total).upperLimit,
5356
+ x: ((_a = dataPoint.dateRange) == null ? void 0 : _a.toString()) ?? "Unknown"
5357
+ };
5358
+ })
5281
5359
  };
5282
5360
  default:
5283
5361
  return {
5284
5362
  ...generalConfig,
5285
- data: prevalenceOverTimeVariant.content.map((dataPoint) => dataPoint.prevalence)
5363
+ data: prevalenceOverTimeVariant.content.map((dataPoint) => {
5364
+ return { y: dataPoint.prevalence, x: dataPoint.dateRange };
5365
+ })
5286
5366
  };
5287
5367
  }
5288
5368
  };
@@ -6163,17 +6243,28 @@ function getMinMaxNumber(values) {
6163
6243
  return [min, max];
6164
6244
  }
6165
6245
  Chart.register(...registerables, LogitScale);
6166
- const PrevalenceOverTimeBubbleChart = ({ data, yAxisScaleType }) => {
6167
- const firstDate = data[0].content[0].dateRange;
6168
- const total = data.map((graphData) => graphData.content.map((dataPoint) => dataPoint.total)).flat();
6246
+ const PrevalenceOverTimeBubbleChart = ({
6247
+ data,
6248
+ yAxisScaleType,
6249
+ yAxisMaxConfig
6250
+ }) => {
6251
+ const nonNullDateRangeData = data.map((variantData) => {
6252
+ return {
6253
+ content: variantData.content.filter((dataPoint) => dataPoint.dateRange !== null),
6254
+ displayName: variantData.displayName
6255
+ };
6256
+ });
6257
+ const firstDate = nonNullDateRangeData[0].content[0].dateRange;
6258
+ const total = nonNullDateRangeData.map((graphData) => graphData.content.map((dataPoint) => dataPoint.total)).flat();
6169
6259
  const [minTotal, maxTotal] = getMinMaxNumber(total);
6170
6260
  const scaleBubble = (value) => {
6171
6261
  return (value - minTotal) / (maxTotal - minTotal) * 4.5 + 0.5;
6172
6262
  };
6263
+ const maxY = yAxisScaleType !== "logit" ? getYAxisMax(maxInData(nonNullDateRangeData), yAxisMaxConfig == null ? void 0 : yAxisMaxConfig[yAxisScaleType]) : void 0;
6173
6264
  const config = {
6174
6265
  type: "bubble",
6175
6266
  data: {
6176
- datasets: data.map((graphData, index) => ({
6267
+ datasets: nonNullDateRangeData.map((graphData, index) => ({
6177
6268
  label: graphData.displayName,
6178
6269
  data: graphData.content.filter((dataPoint) => dataPoint.dateRange !== null).map((dataPoint) => ({
6179
6270
  x: minusTemporal(dataPoint.dateRange, firstDate),
@@ -6195,7 +6286,7 @@ const PrevalenceOverTimeBubbleChart = ({ data, yAxisScaleType }) => {
6195
6286
  callback: (value) => addUnit(firstDate, value).toString()
6196
6287
  }
6197
6288
  },
6198
- y: getYAxisScale(yAxisScaleType)
6289
+ y: { ...getYAxisScale(yAxisScaleType), max: maxY }
6199
6290
  },
6200
6291
  plugins: {
6201
6292
  legend: {
@@ -6207,12 +6298,12 @@ const PrevalenceOverTimeBubbleChart = ({ data, yAxisScaleType }) => {
6207
6298
  callbacks: {
6208
6299
  title: (context) => {
6209
6300
  var _a;
6210
- const dataset = data[context[0].datasetIndex];
6301
+ const dataset = nonNullDateRangeData[context[0].datasetIndex];
6211
6302
  const dataPoint = dataset.content[context[0].dataIndex];
6212
6303
  return (_a = dataPoint.dateRange) == null ? void 0 : _a.toString();
6213
6304
  },
6214
6305
  label: (context) => {
6215
- const dataset = data[context.datasetIndex];
6306
+ const dataset = nonNullDateRangeData[context.datasetIndex];
6216
6307
  const dataPoint = dataset.content[context.dataIndex];
6217
6308
  const percentage = (dataPoint.prevalence * 100).toFixed(2);
6218
6309
  const count = dataPoint.count.toFixed(0);
@@ -6230,25 +6321,27 @@ Chart.register(...registerables, LogitScale);
6230
6321
  const PrevalenceOverTimeLineChart = ({
6231
6322
  data,
6232
6323
  yAxisScaleType,
6233
- confidenceIntervalMethod
6324
+ confidenceIntervalMethod,
6325
+ yAxisMaxConfig
6234
6326
  }) => {
6235
- var _a;
6236
- const datasets2 = data.map((graphData, index) => getDataset(graphData, index, confidenceIntervalMethod)).flat();
6237
- const labels = ((_a = data[0]) == null ? void 0 : _a.content.map((dateRange) => {
6238
- var _a2;
6239
- return ((_a2 = dateRange.dateRange) == null ? void 0 : _a2.toString()) ?? "Unknown";
6240
- })) || [];
6327
+ const nonNullDateRangeData = data.map((variantData) => {
6328
+ return {
6329
+ content: variantData.content.filter((dataPoint) => dataPoint.dateRange !== null),
6330
+ displayName: variantData.displayName
6331
+ };
6332
+ });
6333
+ const datasets2 = nonNullDateRangeData.map((graphData, index) => getDataset(graphData, index, confidenceIntervalMethod)).flat();
6334
+ const maxY = yAxisScaleType !== "logit" ? getYAxisMax(maxInData(nonNullDateRangeData), yAxisMaxConfig == null ? void 0 : yAxisMaxConfig[yAxisScaleType]) : void 0;
6241
6335
  const config = {
6242
6336
  type: "line",
6243
6337
  data: {
6244
- labels,
6245
6338
  datasets: datasets2
6246
6339
  },
6247
6340
  options: {
6248
6341
  animation: false,
6249
6342
  maintainAspectRatio: false,
6250
6343
  scales: {
6251
- y: getYAxisScale(yAxisScaleType)
6344
+ y: { ...getYAxisScale(yAxisScaleType), max: maxY }
6252
6345
  },
6253
6346
  plugins: {
6254
6347
  legend: {
@@ -6274,9 +6367,13 @@ const getDataset = (prevalenceOverTimeVariant, dataIndex, confidenceIntervalMeth
6274
6367
  };
6275
6368
  const getDatasetCIUpper = (prevalenceOverTimeVariant, dataIndex) => ({
6276
6369
  label: `${prevalenceOverTimeVariant.displayName} CI upper`,
6277
- data: prevalenceOverTimeVariant.content.map(
6278
- (dataPoint) => wilson95PercentConfidenceInterval(dataPoint.count, dataPoint.total).upperLimit
6279
- ),
6370
+ data: prevalenceOverTimeVariant.content.map((dataPoint) => {
6371
+ var _a;
6372
+ return {
6373
+ y: wilson95PercentConfidenceInterval(dataPoint.count, dataPoint.total).upperLimit,
6374
+ x: (_a = dataPoint.dateRange) == null ? void 0 : _a.toString()
6375
+ };
6376
+ }),
6280
6377
  borderWidth: 0,
6281
6378
  pointRadius: 0,
6282
6379
  fill: "+1",
@@ -6284,9 +6381,13 @@ const getDatasetCIUpper = (prevalenceOverTimeVariant, dataIndex) => ({
6284
6381
  });
6285
6382
  const getDatasetCILower = (prevalenceOverTimeVariant, dataIndex) => ({
6286
6383
  label: `${prevalenceOverTimeVariant.displayName} CI lower`,
6287
- data: prevalenceOverTimeVariant.content.map(
6288
- (dataPoint) => wilson95PercentConfidenceInterval(dataPoint.count, dataPoint.total).lowerLimit
6289
- ),
6384
+ data: prevalenceOverTimeVariant.content.map((dataPoint) => {
6385
+ var _a;
6386
+ return {
6387
+ y: wilson95PercentConfidenceInterval(dataPoint.count, dataPoint.total).lowerLimit,
6388
+ x: (_a = dataPoint.dateRange) == null ? void 0 : _a.toString()
6389
+ };
6390
+ }),
6290
6391
  borderWidth: 0,
6291
6392
  pointRadius: 0,
6292
6393
  fill: "-1",
@@ -6294,7 +6395,16 @@ const getDatasetCILower = (prevalenceOverTimeVariant, dataIndex) => ({
6294
6395
  });
6295
6396
  const getDatasetLine = (prevalenceOverTimeVariant, dataIndex) => ({
6296
6397
  label: prevalenceOverTimeVariant.displayName,
6297
- data: prevalenceOverTimeVariant.content.map((dataPoint) => dataPoint.prevalence),
6398
+ data: prevalenceOverTimeVariant.content.map((dataPoint) => {
6399
+ var _a;
6400
+ const ciLimits = wilson95PercentConfidenceInterval(dataPoint.count, dataPoint.total);
6401
+ return {
6402
+ y: dataPoint.prevalence,
6403
+ x: (_a = dataPoint.dateRange) == null ? void 0 : _a.toString(),
6404
+ yCiUpper: ciLimits.upperLimit,
6405
+ yCiLower: ciLimits.lowerLimit
6406
+ };
6407
+ }),
6298
6408
  borderWidth: 1,
6299
6409
  pointRadius: 0,
6300
6410
  borderColor: singleGraphColorRGBAById(dataIndex),
@@ -6310,20 +6420,17 @@ const tooltip$1 = (confidenceIntervalMethod) => {
6310
6420
  return {
6311
6421
  ...generalConfig,
6312
6422
  filter: ({ datasetIndex }) => {
6313
- return datasetIndex % 3 === 1;
6423
+ return isNotCiIndex(datasetIndex);
6314
6424
  },
6315
6425
  callbacks: {
6316
6426
  label: (context) => {
6317
- if (context.datasetIndex % 3 === 1) {
6318
- const value = context.dataset.data[context.dataIndex];
6319
- const ciLower = context.dataset.data[context.dataIndex - 1];
6320
- const ciUpper = context.dataset.data[context.dataIndex + 1];
6321
- if (typeof value !== "number" || typeof ciLower !== "number" || typeof ciUpper !== "number") {
6322
- return "";
6323
- }
6324
- return confidenceIntervalDataLabel(value, ciLower, ciUpper, context.dataset.label);
6325
- }
6326
- return context.dataset.label;
6427
+ const dataPoint = context.dataset.data[context.dataIndex];
6428
+ return confidenceIntervalDataLabel(
6429
+ dataPoint.y,
6430
+ dataPoint.yCiLower,
6431
+ dataPoint.yCiUpper,
6432
+ context.dataset.label
6433
+ );
6327
6434
  }
6328
6435
  }
6329
6436
  };
@@ -6331,6 +6438,9 @@ const tooltip$1 = (confidenceIntervalMethod) => {
6331
6438
  return generalConfig;
6332
6439
  }
6333
6440
  };
6441
+ function isNotCiIndex(datasetIndex) {
6442
+ return datasetIndex % 3 === 1;
6443
+ }
6334
6444
  const PrevalenceOverTimeTable = ({ data, granularity, pageSize }) => {
6335
6445
  const getSplitColumns = (data2) => {
6336
6446
  return data2.map((dataset) => ({
@@ -6666,8 +6776,8 @@ const ScalingSelector = ({
6666
6776
  );
6667
6777
  };
6668
6778
  const PrevalenceOverTime = ({
6669
- numerator,
6670
- denominator,
6779
+ numeratorFilter,
6780
+ denominatorFilter,
6671
6781
  granularity,
6672
6782
  smoothingWindow,
6673
6783
  views,
@@ -6676,37 +6786,47 @@ const PrevalenceOverTime = ({
6676
6786
  height,
6677
6787
  headline = "Prevalence over time",
6678
6788
  lapisDateField,
6679
- pageSize
6789
+ pageSize,
6790
+ yAxisMaxConfig
6680
6791
  }) => {
6681
6792
  const size2 = { height, width };
6682
6793
  return /* @__PURE__ */ u$1(ErrorBoundary, { size: size2, headline, children: /* @__PURE__ */ u$1(ResizeContainer, { size: size2, children: /* @__PURE__ */ u$1(Headline, { heading: headline, children: /* @__PURE__ */ u$1(
6683
6794
  PrevalenceOverTimeInner,
6684
6795
  {
6685
- numerator,
6686
- denominator,
6796
+ numeratorFilter,
6797
+ denominatorFilter,
6687
6798
  granularity,
6688
6799
  smoothingWindow,
6689
6800
  views,
6690
6801
  confidenceIntervalMethods,
6691
6802
  lapisDateField,
6692
- pageSize
6803
+ pageSize,
6804
+ yAxisMaxConfig
6693
6805
  }
6694
6806
  ) }) }) });
6695
6807
  };
6696
6808
  const PrevalenceOverTimeInner = ({
6697
- numerator,
6698
- denominator,
6809
+ numeratorFilter,
6810
+ denominatorFilter,
6699
6811
  granularity,
6700
6812
  smoothingWindow,
6701
6813
  views,
6702
6814
  confidenceIntervalMethods,
6703
6815
  lapisDateField,
6704
- pageSize
6816
+ pageSize,
6817
+ yAxisMaxConfig
6705
6818
  }) => {
6706
- const lapis = P(LapisUrlContext);
6819
+ const lapis = x(LapisUrlContext);
6707
6820
  const { data, error, isLoading } = useQuery(
6708
- () => queryPrevalenceOverTime(numerator, denominator, granularity, smoothingWindow, lapis, lapisDateField),
6709
- [lapis, numerator, denominator, granularity, smoothingWindow]
6821
+ () => queryPrevalenceOverTime(
6822
+ numeratorFilter,
6823
+ denominatorFilter,
6824
+ granularity,
6825
+ smoothingWindow,
6826
+ lapis,
6827
+ lapisDateField
6828
+ ),
6829
+ [lapis, numeratorFilter, denominatorFilter, granularity, smoothingWindow]
6710
6830
  );
6711
6831
  if (isLoading) {
6712
6832
  return /* @__PURE__ */ u$1(LoadingDisplay, {});
@@ -6724,7 +6844,8 @@ const PrevalenceOverTimeInner = ({
6724
6844
  data,
6725
6845
  granularity,
6726
6846
  confidenceIntervalMethods,
6727
- pageSize
6847
+ pageSize,
6848
+ yAxisMaxConfig
6728
6849
  }
6729
6850
  );
6730
6851
  };
@@ -6733,10 +6854,11 @@ const PrevalenceOverTimeTabs = ({
6733
6854
  data,
6734
6855
  granularity,
6735
6856
  confidenceIntervalMethods,
6736
- pageSize
6857
+ pageSize,
6858
+ yAxisMaxConfig
6737
6859
  }) => {
6738
- const [yAxisScaleType, setYAxisScaleType] = p("linear");
6739
- const [confidenceIntervalMethod, setConfidenceIntervalMethod] = p(
6860
+ const [yAxisScaleType, setYAxisScaleType] = h("linear");
6861
+ const [confidenceIntervalMethod, setConfidenceIntervalMethod] = h(
6740
6862
  confidenceIntervalMethods.length > 0 ? confidenceIntervalMethods[0] : "none"
6741
6863
  );
6742
6864
  const getTab = (view) => {
@@ -6749,7 +6871,8 @@ const PrevalenceOverTimeTabs = ({
6749
6871
  {
6750
6872
  data,
6751
6873
  yAxisScaleType,
6752
- confidenceIntervalMethod
6874
+ confidenceIntervalMethod,
6875
+ yAxisMaxConfig
6753
6876
  }
6754
6877
  )
6755
6878
  };
@@ -6761,14 +6884,22 @@ const PrevalenceOverTimeTabs = ({
6761
6884
  {
6762
6885
  data,
6763
6886
  yAxisScaleType,
6764
- confidenceIntervalMethod
6887
+ confidenceIntervalMethod,
6888
+ yAxisMaxConfig
6765
6889
  }
6766
6890
  )
6767
6891
  };
6768
6892
  case "bubble":
6769
6893
  return {
6770
6894
  title: "Bubble",
6771
- content: /* @__PURE__ */ u$1(PrevalenceOverTimeBubbleChart, { data, yAxisScaleType })
6895
+ content: /* @__PURE__ */ u$1(
6896
+ PrevalenceOverTimeBubbleChart,
6897
+ {
6898
+ data,
6899
+ yAxisScaleType,
6900
+ yAxisMaxConfig
6901
+ }
6902
+ )
6772
6903
  };
6773
6904
  case "table":
6774
6905
  return {
@@ -6830,6 +6961,7 @@ const PrevalenceOverTimeInfo = () => {
6830
6961
  /* @__PURE__ */ u$1(InfoParagraph, { children: "Prevalence over time info." })
6831
6962
  ] });
6832
6963
  };
6964
+ const maxInData = (data) => Math.max(...data.flatMap((variant) => variant.content.map((dataPoint) => dataPoint.prevalence)));
6833
6965
  var __defProp$6 = Object.defineProperty;
6834
6966
  var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
6835
6967
  var __decorateClass$6 = (decorators, target, key, kind) => {
@@ -6843,8 +6975,8 @@ var __decorateClass$6 = (decorators, target, key, kind) => {
6843
6975
  let PrevalenceOverTimeComponent = class extends PreactLitAdapterWithGridJsStyles {
6844
6976
  constructor() {
6845
6977
  super(...arguments);
6846
- this.numerator = { displayName: "", lapisFilter: {} };
6847
- this.denominator = {};
6978
+ this.numeratorFilter = { displayName: "", lapisFilter: {} };
6979
+ this.denominatorFilter = {};
6848
6980
  this.granularity = "day";
6849
6981
  this.smoothingWindow = 0;
6850
6982
  this.views = ["bar", "line", "bubble", "table"];
@@ -6854,13 +6986,15 @@ let PrevalenceOverTimeComponent = class extends PreactLitAdapterWithGridJsStyles
6854
6986
  this.height = "700px";
6855
6987
  this.lapisDateField = "date";
6856
6988
  this.pageSize = false;
6989
+ this.yAxisMaxLinear = 1;
6990
+ this.yAxisMaxLogarithmic = 1;
6857
6991
  }
6858
6992
  render() {
6859
6993
  return /* @__PURE__ */ u$1(
6860
6994
  PrevalenceOverTime,
6861
6995
  {
6862
- numerator: this.numerator,
6863
- denominator: this.denominator,
6996
+ numeratorFilter: this.numeratorFilter,
6997
+ denominatorFilter: this.denominatorFilter,
6864
6998
  granularity: this.granularity,
6865
6999
  smoothingWindow: this.smoothingWindow,
6866
7000
  views: this.views,
@@ -6869,17 +7003,21 @@ let PrevalenceOverTimeComponent = class extends PreactLitAdapterWithGridJsStyles
6869
7003
  height: this.height,
6870
7004
  headline: this.headline,
6871
7005
  lapisDateField: this.lapisDateField,
6872
- pageSize: this.pageSize
7006
+ pageSize: this.pageSize,
7007
+ yAxisMaxConfig: {
7008
+ linear: this.yAxisMaxLinear,
7009
+ logarithmic: this.yAxisMaxLogarithmic
7010
+ }
6873
7011
  }
6874
7012
  );
6875
7013
  }
6876
7014
  };
6877
7015
  __decorateClass$6([
6878
7016
  n2({ type: Object })
6879
- ], PrevalenceOverTimeComponent.prototype, "numerator", 2);
7017
+ ], PrevalenceOverTimeComponent.prototype, "numeratorFilter", 2);
6880
7018
  __decorateClass$6([
6881
7019
  n2({ type: Object })
6882
- ], PrevalenceOverTimeComponent.prototype, "denominator", 2);
7020
+ ], PrevalenceOverTimeComponent.prototype, "denominatorFilter", 2);
6883
7021
  __decorateClass$6([
6884
7022
  n2({ type: String })
6885
7023
  ], PrevalenceOverTimeComponent.prototype, "granularity", 2);
@@ -6907,11 +7045,18 @@ __decorateClass$6([
6907
7045
  __decorateClass$6([
6908
7046
  n2({ type: Object })
6909
7047
  ], PrevalenceOverTimeComponent.prototype, "pageSize", 2);
7048
+ __decorateClass$6([
7049
+ n2({ type: String })
7050
+ ], PrevalenceOverTimeComponent.prototype, "yAxisMaxLinear", 2);
7051
+ __decorateClass$6([
7052
+ n2({ type: String })
7053
+ ], PrevalenceOverTimeComponent.prototype, "yAxisMaxLogarithmic", 2);
6910
7054
  PrevalenceOverTimeComponent = __decorateClass$6([
6911
7055
  t$2("gs-prevalence-over-time")
6912
7056
  ], PrevalenceOverTimeComponent);
6913
7057
  Chart.register(...registerables, LogitScale);
6914
- const RelativeGrowthAdvantageChart = ({ data, yAxisScaleType }) => {
7058
+ const RelativeGrowthAdvantageChart = ({ data, yAxisScaleType, yAxisMaxConfig }) => {
7059
+ const maxY = yAxisScaleType !== "logit" ? getYAxisMax(Math.max(...data.proportion), yAxisMaxConfig == null ? void 0 : yAxisMaxConfig[yAxisScaleType]) : void 0;
6915
7060
  const config = {
6916
7061
  type: "line",
6917
7062
  data: {
@@ -6922,7 +7067,7 @@ const RelativeGrowthAdvantageChart = ({ data, yAxisScaleType }) => {
6922
7067
  maintainAspectRatio: false,
6923
7068
  animation: false,
6924
7069
  scales: {
6925
- y: getYAxisScale(yAxisScaleType)
7070
+ y: { ...getYAxisScale(yAxisScaleType), max: maxY }
6926
7071
  },
6927
7072
  plugins: {
6928
7073
  legend: {
@@ -6932,17 +7077,38 @@ const RelativeGrowthAdvantageChart = ({ data, yAxisScaleType }) => {
6932
7077
  }
6933
7078
  }
6934
7079
  };
6935
- return /* @__PURE__ */ u$1("div", { className: "flex flex-col h-full", children: [
6936
- /* @__PURE__ */ u$1("div", { className: "flex-1", children: /* @__PURE__ */ u$1(GsChart, { configuration: config }) }),
6937
- /* @__PURE__ */ u$1("p", { children: [
6938
- "Advantage: ",
6939
- (data.params.fd.value * 100).toFixed(2),
6940
- "% (",
6941
- (data.params.fd.ciLower * 100).toFixed(2),
6942
- "% -",
6943
- " ",
6944
- (data.params.fd.ciUpper * 100).toFixed(2),
6945
- "%)"
7080
+ return /* @__PURE__ */ u$1("div", { className: "flex h-full flex-col", children: [
7081
+ /* @__PURE__ */ u$1(
7082
+ RelativeGrowthAdvantageDisplay,
7083
+ {
7084
+ relativeAdvantage: data.params.fd.value,
7085
+ relativeAdvantageLowerBound: data.params.fd.ciLower,
7086
+ relativeAdvantageUpperBound: data.params.fd.ciUpper
7087
+ }
7088
+ ),
7089
+ /* @__PURE__ */ u$1("div", { className: "flex-1", children: /* @__PURE__ */ u$1(GsChart, { configuration: config }) })
7090
+ ] });
7091
+ };
7092
+ const RelativeGrowthAdvantageDisplay = ({
7093
+ relativeAdvantage,
7094
+ relativeAdvantageLowerBound,
7095
+ relativeAdvantageUpperBound
7096
+ }) => {
7097
+ return /* @__PURE__ */ u$1("div", { class: "mx-auto flex items-end flex-wrap", children: [
7098
+ /* @__PURE__ */ u$1("span", { class: "text-[#606060]", children: "Relative advantage:" }),
7099
+ /* @__PURE__ */ u$1("div", { children: [
7100
+ /* @__PURE__ */ u$1("span", { class: "text-2xl ml-3", children: [
7101
+ " ",
7102
+ formatProportion(relativeAdvantage),
7103
+ " "
7104
+ ] }),
7105
+ /* @__PURE__ */ u$1("span", { class: "ml-2.5", children: [
7106
+ "(",
7107
+ formatProportion(relativeAdvantageLowerBound),
7108
+ " - ",
7109
+ formatProportion(relativeAdvantageUpperBound),
7110
+ ")"
7111
+ ] })
6946
7112
  ] })
6947
7113
  ] });
6948
7114
  };
@@ -7101,36 +7267,39 @@ const RelativeGrowthAdvantage = ({
7101
7267
  views,
7102
7268
  width,
7103
7269
  height,
7104
- numerator,
7105
- denominator,
7270
+ numeratorFilter,
7271
+ denominatorFilter,
7106
7272
  generationTime,
7107
7273
  headline = "Relative growth advantage",
7108
- lapisDateField
7274
+ lapisDateField,
7275
+ yAxisMaxConfig
7109
7276
  }) => {
7110
7277
  const size2 = { height, width };
7111
7278
  return /* @__PURE__ */ u$1(ErrorBoundary, { size: size2, headline, children: /* @__PURE__ */ u$1(ResizeContainer, { size: size2, children: /* @__PURE__ */ u$1(Headline, { heading: headline, children: /* @__PURE__ */ u$1(
7112
7279
  RelativeGrowthAdvantageInner,
7113
7280
  {
7114
7281
  views,
7115
- numerator,
7116
- denominator,
7282
+ numeratorFilter,
7283
+ denominatorFilter,
7117
7284
  generationTime,
7118
- lapisDateField
7285
+ lapisDateField,
7286
+ yAxisMaxConfig
7119
7287
  }
7120
7288
  ) }) }) });
7121
7289
  };
7122
7290
  const RelativeGrowthAdvantageInner = ({
7123
- numerator,
7124
- denominator,
7291
+ numeratorFilter,
7292
+ denominatorFilter,
7125
7293
  generationTime,
7126
7294
  views,
7127
- lapisDateField
7295
+ lapisDateField,
7296
+ yAxisMaxConfig
7128
7297
  }) => {
7129
- const lapis = P(LapisUrlContext);
7130
- const [yAxisScaleType, setYAxisScaleType] = p("linear");
7298
+ const lapis = x(LapisUrlContext);
7299
+ const [yAxisScaleType, setYAxisScaleType] = h("linear");
7131
7300
  const { data, error, isLoading } = useQuery(
7132
- () => queryRelativeGrowthAdvantage(numerator, denominator, generationTime, lapis, lapisDateField),
7133
- [lapis, numerator, denominator, generationTime, views]
7301
+ () => queryRelativeGrowthAdvantage(numeratorFilter, denominatorFilter, generationTime, lapis, lapisDateField),
7302
+ [lapis, numeratorFilter, denominatorFilter, generationTime, views]
7134
7303
  );
7135
7304
  if (isLoading) {
7136
7305
  return /* @__PURE__ */ u$1(LoadingDisplay, {});
@@ -7148,7 +7317,8 @@ const RelativeGrowthAdvantageInner = ({
7148
7317
  yAxisScaleType,
7149
7318
  setYAxisScaleType,
7150
7319
  views,
7151
- generationTime
7320
+ generationTime,
7321
+ yAxisMaxConfig
7152
7322
  }
7153
7323
  );
7154
7324
  };
@@ -7157,7 +7327,8 @@ const RelativeGrowthAdvantageTabs = ({
7157
7327
  yAxisScaleType,
7158
7328
  setYAxisScaleType,
7159
7329
  views,
7160
- generationTime
7330
+ generationTime,
7331
+ yAxisMaxConfig
7161
7332
  }) => {
7162
7333
  const getTab = (view) => {
7163
7334
  switch (view) {
@@ -7172,7 +7343,8 @@ const RelativeGrowthAdvantageTabs = ({
7172
7343
  observed: data.observedProportions,
7173
7344
  params: data.params
7174
7345
  },
7175
- yAxisScaleType
7346
+ yAxisScaleType,
7347
+ yAxisMaxConfig
7176
7348
  }
7177
7349
  )
7178
7350
  };
@@ -7233,37 +7405,43 @@ var __decorateClass$5 = (decorators, target, key, kind) => {
7233
7405
  let RelativeGrowthAdvantageComponent = class extends PreactLitAdapter {
7234
7406
  constructor() {
7235
7407
  super(...arguments);
7236
- this.numerator = {};
7237
- this.denominator = {};
7408
+ this.numeratorFilter = {};
7409
+ this.denominatorFilter = {};
7238
7410
  this.generationTime = 7;
7239
7411
  this.views = ["line"];
7240
7412
  this.headline = "Relative growth advantage";
7241
7413
  this.width = "100%";
7242
7414
  this.height = "700px";
7243
7415
  this.lapisDateField = "date";
7416
+ this.yAxisMaxLinear = 1;
7417
+ this.yAxisMaxLogarithmic = 1;
7244
7418
  }
7245
7419
  render() {
7246
7420
  return /* @__PURE__ */ u$1(
7247
7421
  RelativeGrowthAdvantage,
7248
7422
  {
7249
- numerator: this.numerator,
7250
- denominator: this.denominator,
7423
+ numeratorFilter: this.numeratorFilter,
7424
+ denominatorFilter: this.denominatorFilter,
7251
7425
  generationTime: this.generationTime,
7252
7426
  views: this.views,
7253
7427
  width: this.width,
7254
7428
  height: this.height,
7255
7429
  headline: this.headline,
7256
- lapisDateField: this.lapisDateField
7430
+ lapisDateField: this.lapisDateField,
7431
+ yAxisMaxConfig: {
7432
+ linear: this.yAxisMaxLinear,
7433
+ logarithmic: this.yAxisMaxLogarithmic
7434
+ }
7257
7435
  }
7258
7436
  );
7259
7437
  }
7260
7438
  };
7261
7439
  __decorateClass$5([
7262
7440
  n2({ type: Object })
7263
- ], RelativeGrowthAdvantageComponent.prototype, "numerator", 2);
7441
+ ], RelativeGrowthAdvantageComponent.prototype, "numeratorFilter", 2);
7264
7442
  __decorateClass$5([
7265
7443
  n2({ type: Object })
7266
- ], RelativeGrowthAdvantageComponent.prototype, "denominator", 2);
7444
+ ], RelativeGrowthAdvantageComponent.prototype, "denominatorFilter", 2);
7267
7445
  __decorateClass$5([
7268
7446
  n2({ type: Number })
7269
7447
  ], RelativeGrowthAdvantageComponent.prototype, "generationTime", 2);
@@ -7282,29 +7460,15 @@ __decorateClass$5([
7282
7460
  __decorateClass$5([
7283
7461
  n2({ type: String })
7284
7462
  ], RelativeGrowthAdvantageComponent.prototype, "lapisDateField", 2);
7463
+ __decorateClass$5([
7464
+ n2({ type: String })
7465
+ ], RelativeGrowthAdvantageComponent.prototype, "yAxisMaxLinear", 2);
7466
+ __decorateClass$5([
7467
+ n2({ type: String })
7468
+ ], RelativeGrowthAdvantageComponent.prototype, "yAxisMaxLogarithmic", 2);
7285
7469
  RelativeGrowthAdvantageComponent = __decorateClass$5([
7286
7470
  t$2("gs-relative-growth-advantage")
7287
7471
  ], RelativeGrowthAdvantageComponent);
7288
- const AggregateTable = ({ data, fields, pageSize }) => {
7289
- const headers = [
7290
- ...fields.map((field) => {
7291
- return {
7292
- name: field,
7293
- sort: true
7294
- };
7295
- }),
7296
- {
7297
- name: "count",
7298
- sort: true
7299
- },
7300
- {
7301
- name: "proportion",
7302
- sort: true,
7303
- formatter: (cell) => formatProportion(cell)
7304
- }
7305
- ];
7306
- return /* @__PURE__ */ u$1(Table, { data, columns: headers, pageSize });
7307
- };
7308
7472
  const compareAscending = (a2, b3) => {
7309
7473
  if (typeof a2 === "number" && typeof b3 === "number") {
7310
7474
  return a2 - b3;
@@ -7313,12 +7477,12 @@ const compareAscending = (a2, b3) => {
7313
7477
  const strB = b3 != null ? String(b3) : "";
7314
7478
  return strA.localeCompare(strB);
7315
7479
  };
7316
- async function queryAggregateData(variant, fields, lapis, initialSort = { field: "count", direction: "descending" }, signal) {
7480
+ async function queryAggregateData(lapisFilter, fields, lapis, initialSort = { field: "count", direction: "descending" }, signal) {
7317
7481
  const validSortFields = ["count", "proportion", ...fields];
7318
7482
  if (!validSortFields.includes(initialSort.field)) {
7319
7483
  throw new Error(`InitialSort field not in fields. Valid fields are: ${validSortFields.join(", ")}`);
7320
7484
  }
7321
- const fetchData = new FetchAggregatedOperator(variant, fields);
7485
+ const fetchData = new FetchAggregatedOperator(lapisFilter, fields);
7322
7486
  const sortData = new SortOperator(fetchData, (a2, b3) => {
7323
7487
  return initialSort.direction === "ascending" ? compareAscending(a2[initialSort.field], b3[initialSort.field]) : compareAscending(b3[initialSort.field], a2[initialSort.field]);
7324
7488
  });
@@ -7331,6 +7495,28 @@ async function queryAggregateData(variant, fields, lapis, initialSort = { field:
7331
7495
  })
7332
7496
  );
7333
7497
  }
7498
+ const AggregateTable = ({ data, fields, pageSize }) => {
7499
+ const headers = [
7500
+ ...fields.map((field) => {
7501
+ return {
7502
+ name: field,
7503
+ sort: {
7504
+ compare: compareAscending
7505
+ }
7506
+ };
7507
+ }),
7508
+ {
7509
+ name: "count",
7510
+ sort: true
7511
+ },
7512
+ {
7513
+ name: "proportion",
7514
+ sort: true,
7515
+ formatter: (cell) => formatProportion(cell)
7516
+ }
7517
+ ];
7518
+ return /* @__PURE__ */ u$1(Table, { data, columns: headers, pageSize });
7519
+ };
7334
7520
  const Aggregate = ({
7335
7521
  views,
7336
7522
  width,
@@ -7363,7 +7549,7 @@ const AggregateInner = ({
7363
7549
  initialSortDirection,
7364
7550
  pageSize
7365
7551
  }) => {
7366
- const lapis = P(LapisUrlContext);
7552
+ const lapis = x(LapisUrlContext);
7367
7553
  const { data, error, isLoading } = useQuery(async () => {
7368
7554
  return queryAggregateData(filter, fields, lapis, { field: initialSortField, direction: initialSortDirection });
7369
7555
  }, [filter, fields, lapis]);
@@ -7616,19 +7802,19 @@ const DateRangeSelectorInner = ({
7616
7802
  earliestDate,
7617
7803
  customSelectOptions
7618
7804
  );
7619
- const fromDatePickerRef = F(null);
7620
- const toDatePickerRef = F(null);
7621
- const divRef = F(null);
7622
- const [dateFromPicker, setDateFromPicker] = p(null);
7623
- const [dateToPicker, setDateToPicker] = p(null);
7624
- const [selectedDateRange, setSelectedDateRange] = p(
7805
+ const fromDatePickerRef = A(null);
7806
+ const toDatePickerRef = A(null);
7807
+ const divRef = A(null);
7808
+ const [dateFromPicker, setDateFromPicker] = h(null);
7809
+ const [dateToPicker, setDateToPicker] = h(null);
7810
+ const [selectedDateRange, setSelectedDateRange] = h(
7625
7811
  initialValues.initialSelectedDateRange
7626
7812
  );
7627
- const [selectedDates, setSelectedDates] = p({
7813
+ const [selectedDates, setSelectedDates] = h({
7628
7814
  dateFrom: initialValues.initialSelectedDateFrom,
7629
7815
  dateTo: initialValues.initialSelectedDateTo
7630
7816
  });
7631
- _(() => {
7817
+ y(() => {
7632
7818
  const commonConfig = {
7633
7819
  allowInput: true,
7634
7820
  dateFormat: "Y-m-d"
@@ -7707,7 +7893,7 @@ const DateRangeSelectorInner = ({
7707
7893
  {
7708
7894
  items: getSelectableOptions(customSelectOptions),
7709
7895
  selected: selectedDateRange,
7710
- selectStyle: "select-bordered rounded-none flex-grow w-40",
7896
+ selectStyle: "select-bordered rounded-none flex-grow min-w-[7.5rem]",
7711
7897
  onChange: (event) => {
7712
7898
  event.preventDefault();
7713
7899
  const select = event.target;
@@ -7720,9 +7906,8 @@ const DateRangeSelectorInner = ({
7720
7906
  /* @__PURE__ */ u$1(
7721
7907
  "input",
7722
7908
  {
7723
- class: "input input-bordered rounded-none flex-grow min-w-40",
7909
+ class: "input input-bordered rounded-none flex-grow w-[7.5rem]",
7724
7910
  type: "text",
7725
- size: 10,
7726
7911
  placeholder: "Date from",
7727
7912
  ref: fromDatePickerRef,
7728
7913
  onChange: onChangeDateFrom,
@@ -7732,9 +7917,8 @@ const DateRangeSelectorInner = ({
7732
7917
  /* @__PURE__ */ u$1(
7733
7918
  "input",
7734
7919
  {
7735
- class: "input input-bordered rounded-none flex-grow min-w-40",
7920
+ class: "input input-bordered rounded-none flex-grow w-[7.5rem]",
7736
7921
  type: "text",
7737
- size: 10,
7738
7922
  placeholder: "Date to",
7739
7923
  ref: toDatePickerRef,
7740
7924
  onChange: onChangeDateTo,
@@ -7805,7 +7989,7 @@ DateRangeSelectorComponent = __decorateClass$3([
7805
7989
  t$2("gs-date-range-selector")
7806
7990
  ], DateRangeSelectorComponent);
7807
7991
  async function fetchAutocompletionList(fields, lapis, signal) {
7808
- const toAncestorInHierarchyOverwriteValues = Array(fields.length - 1).fill(0).map((_2, i2) => i2 + 1).map((i2) => fields.slice(i2).reduce((acc, field) => ({ ...acc, [field]: null }), {}));
7992
+ const toAncestorInHierarchyOverwriteValues = Array(fields.length - 1).fill(0).map((_, i2) => i2 + 1).map((i2) => fields.slice(i2).reduce((acc, field) => ({ ...acc, [field]: null }), {}));
7809
7993
  const fetchAggregatedOperator = new FetchAggregatedOperator({}, fields);
7810
7994
  let data;
7811
7995
  try {
@@ -7857,10 +8041,10 @@ const LocationFilter = ({
7857
8041
  return /* @__PURE__ */ u$1(ErrorBoundary, { size: size2, children: /* @__PURE__ */ u$1(ResizeContainer, { size: size2, children: /* @__PURE__ */ u$1(LocationFilterInner, { initialValue, fields, placeholderText }) }) });
7858
8042
  };
7859
8043
  const LocationFilterInner = ({ initialValue, fields, placeholderText }) => {
7860
- const lapis = P(LapisUrlContext);
7861
- const [value, setValue] = p(initialValue ?? "");
7862
- const [unknownLocation, setUnknownLocation] = p(false);
7863
- const divRef = F(null);
8044
+ const lapis = x(LapisUrlContext);
8045
+ const [value, setValue] = h(initialValue ?? "");
8046
+ const [unknownLocation, setUnknownLocation] = h(false);
8047
+ const divRef = A(null);
7864
8048
  const { data, error, isLoading } = useQuery(() => fetchAutocompletionList(fields, lapis), [fields, lapis]);
7865
8049
  if (isLoading) {
7866
8050
  return /* @__PURE__ */ u$1(LoadingDisplay, {});
@@ -7981,8 +8165,8 @@ const TextInputInner = ({
7981
8165
  placeholderText,
7982
8166
  initialValue
7983
8167
  }) => {
7984
- const lapis = P(LapisUrlContext);
7985
- const inputRef = F(null);
8168
+ const lapis = x(LapisUrlContext);
8169
+ const inputRef = A(null);
7986
8170
  const { data, error, isLoading } = useQuery(() => fetchAutocompleteList(lapis, lapisField), [lapisField, lapis]);
7987
8171
  if (isLoading) {
7988
8172
  return /* @__PURE__ */ u$1(LoadingDisplay, {});
@@ -8074,7 +8258,7 @@ TextInputComponent = __decorateClass$1([
8074
8258
  t$2("gs-text-input")
8075
8259
  ], TextInputComponent);
8076
8260
  const ReferenceGenomesAwaiter = ({ children }) => {
8077
- const referenceGenome = P(ReferenceGenomeContext);
8261
+ const referenceGenome = x(ReferenceGenomeContext);
8078
8262
  if (isNotInitialized(referenceGenome)) {
8079
8263
  return /* @__PURE__ */ u$1("div", { className: "laoding loading-spinner loading-md", children: "Loading..." });
8080
8264
  }
@@ -8153,13 +8337,13 @@ const MutationFilter = ({ initialValue, width }) => {
8153
8337
  return /* @__PURE__ */ u$1(ErrorBoundary, { size: { height: "3.375rem", width }, children: /* @__PURE__ */ u$1("div", { style: width, children: /* @__PURE__ */ u$1(MutationFilterInner, { initialValue }) }) });
8154
8338
  };
8155
8339
  const MutationFilterInner = ({ initialValue }) => {
8156
- const referenceGenome = P(ReferenceGenomeContext);
8157
- const [selectedFilters, setSelectedFilters] = p(
8340
+ const referenceGenome = x(ReferenceGenomeContext);
8341
+ const [selectedFilters, setSelectedFilters] = h(
8158
8342
  getInitialState(initialValue, referenceGenome)
8159
8343
  );
8160
- const [inputValue, setInputValue] = p("");
8161
- const [isError, setIsError] = p(false);
8162
- const formRef = F(null);
8344
+ const [inputValue, setInputValue] = h("");
8345
+ const [isError, setIsError] = h(false);
8346
+ const formRef = A(null);
8163
8347
  const handleSubmit = (event) => {
8164
8348
  event.preventDefault();
8165
8349
  if (inputValue === "") {