@modelform/react-native 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -9,10 +9,12 @@ import {
9
9
  DEFAULT_GAZETTEER,
10
10
  EDITABLE_VARIABLE_TYPES,
11
11
  GRID_COLUMNS,
12
+ GROUP_FIELD_TYPES,
12
13
  GrafanaClient,
13
14
  GrafanaDataSource,
14
15
  GrafanaError,
15
16
  HttpConfigFiles,
17
+ INPUT_GROUP,
16
18
  INPUT_OPTION_KEYS,
17
19
  INPUT_TYPES,
18
20
  LOCAL_DATASOURCE_TYPE,
@@ -63,6 +65,7 @@ import {
63
65
  dropTarget,
64
66
  duplicatePanel,
65
67
  entriesSavedWith,
68
+ entriesToItems,
66
69
  entryToInputValue,
67
70
  expandRow,
68
71
  fetchBundle,
@@ -81,8 +84,12 @@ import {
81
84
  getPath,
82
85
  gridOffsetPx,
83
86
  gridUnitsToPx,
87
+ groupFields,
88
+ groupProblems,
89
+ groupToEntries,
84
90
  httpFetchJson,
85
91
  initialVariableValues,
92
+ inputGroups,
86
93
  inputPanels,
87
94
  inputProblem,
88
95
  insertPanel,
@@ -90,6 +97,9 @@ import {
90
97
  interpolateDeep,
91
98
  isBundleResponse,
92
99
  isEditableVariableType,
100
+ isEmptyItem,
101
+ isFormPanelType,
102
+ isInputGroup,
93
103
  isInputPanel,
94
104
  isInputType,
95
105
  isLocalDatasource,
@@ -111,6 +121,7 @@ import {
111
121
  movePanel,
112
122
  newDocument,
113
123
  newPanel,
124
+ newSaveId,
114
125
  newVariable,
115
126
  nextPanelId,
116
127
  normalizeRef,
@@ -137,6 +148,7 @@ import {
137
148
  parseTime,
138
149
  pasteSnippet,
139
150
  placePanel,
151
+ plainInputPanels,
140
152
  pointerToPath,
141
153
  prepareDashboard,
142
154
  previewPaste,
@@ -163,6 +175,7 @@ import {
163
175
  resolveVariables,
164
176
  revalidateBundle,
165
177
  rowsToMappings,
178
+ sameSave,
166
179
  sampleEntries,
167
180
  screenDocuments,
168
181
  screenOfType,
@@ -207,7 +220,7 @@ import {
207
220
  variableWithType,
208
221
  visibleVariables,
209
222
  zoomRange
210
- } from "./chunk-5SGVTAFJ.mjs";
223
+ } from "./chunk-BW6HKFAB.mjs";
211
224
 
212
225
  // src/ui/theme.tsx
213
226
  import { createContext, useContext } from "react";
@@ -559,15 +572,15 @@ function usePanelLinks(panel) {
559
572
  }
560
573
 
561
574
  // src/ui/DashboardView.tsx
562
- import { useCallback as useCallback3, useContext as useContext4, useMemo as useMemo8, useRef as useRef4, useState as useState10 } from "react";
575
+ import { useCallback as useCallback3, useContext as useContext4, useMemo as useMemo9, useRef as useRef4, useState as useState10 } from "react";
563
576
  import {
564
577
  ActivityIndicator,
565
- Pressable as Pressable11,
578
+ Pressable as Pressable12,
566
579
  RefreshControl,
567
- ScrollView as ScrollView5,
568
- StyleSheet as StyleSheet13,
569
- Text as Text12,
570
- View as View12,
580
+ ScrollView as ScrollView6,
581
+ StyleSheet as StyleSheet14,
582
+ Text as Text13,
583
+ View as View13,
571
584
  useWindowDimensions
572
585
  } from "react-native";
573
586
  import { useSafeAreaInsets as useSafeAreaInsets4 } from "react-native-safe-area-context";
@@ -593,6 +606,7 @@ var RenderBoundary = class extends Component {
593
606
 
594
607
  // src/ui/inputs/formContext.ts
595
608
  import { createContext as createContext3, useContext as useContext3 } from "react";
609
+ var groupKey = (g) => g.id != null ? `#${g.id}` : groupFields(g).map((f) => f.options.metric).join("|");
596
610
  var InputFormContext = createContext3(null);
597
611
  function useInputForm() {
598
612
  const v = useContext3(InputFormContext);
@@ -600,6 +614,10 @@ function useInputForm() {
600
614
  return v;
601
615
  }
602
616
 
617
+ // src/ui/inputs/InputGroup.tsx
618
+ import { useMemo as useMemo2 } from "react";
619
+ import { Pressable as Pressable6, ScrollView as ScrollView4, StyleSheet as StyleSheet7, Text as Text7, View as View6 } from "react-native";
620
+
603
621
  // src/ui/inputs/InputPanels.tsx
604
622
  import { useEffect as useEffect2, useState as useState5 } from "react";
605
623
  import { Platform, Pressable as Pressable5, ScrollView as ScrollView3, StyleSheet as StyleSheet6, Switch, Text as Text6, TextInput as TextInput2, View as View5 } from "react-native";
@@ -1762,22 +1780,116 @@ var styles6 = StyleSheet6.create({
1762
1780
  counterBtnText: { color: "#fff", fontSize: 18, fontWeight: "700" }
1763
1781
  });
1764
1782
 
1783
+ // src/ui/inputs/InputGroup.tsx
1784
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1785
+ function titleText(v) {
1786
+ if (v == null || v === "") return void 0;
1787
+ if (Array.isArray(v)) return v.length ? v.join(", ") : void 0;
1788
+ return typeof v === "boolean" ? void 0 : String(v);
1789
+ }
1790
+ function InputGroupBody({ panel }) {
1791
+ const theme = useDashTheme();
1792
+ const form = useInputForm();
1793
+ const group = form.group?.(panel);
1794
+ if (!group) return null;
1795
+ const label = panel.options.itemTitle || "Item";
1796
+ return /* @__PURE__ */ jsxs7(ScrollView4, { style: styles7.fill, contentContainerStyle: styles7.list, nestedScrollEnabled: true, keyboardShouldPersistTaps: "handled", children: [
1797
+ group.items.map((item, i) => {
1798
+ const named = panel.options.titleFrom ? titleText(item.values[panel.options.titleFrom]) : void 0;
1799
+ return /* @__PURE__ */ jsx9(ItemCard, { panel, group, form, index: i, title: named ?? `${label} ${i + 1}`, last: i === group.items.length - 1 }, item.key);
1800
+ }),
1801
+ group.canAdd && /* @__PURE__ */ jsx9(
1802
+ Pressable6,
1803
+ {
1804
+ onPress: group.add,
1805
+ accessibilityRole: "button",
1806
+ style: ({ pressed }) => [styles7.add, { borderColor: theme.accent, opacity: pressed ? 0.7 : 1 }],
1807
+ children: /* @__PURE__ */ jsxs7(Text7, { style: { color: theme.accent, fontWeight: "600" }, children: [
1808
+ "+ ",
1809
+ panel.options.addLabel || `Add ${label.toLowerCase()}`
1810
+ ] })
1811
+ }
1812
+ )
1813
+ ] });
1814
+ }
1815
+ function ItemCard({ panel, group, form, index, title, last }) {
1816
+ const theme = useDashTheme();
1817
+ const fields = useMemo2(() => groupFields(panel), [panel]);
1818
+ const item = group.items[index];
1819
+ const scoped = useMemo2(
1820
+ () => ({
1821
+ ...form,
1822
+ value: (m) => item.values[m] ?? null,
1823
+ setValue: (m, v) => group.setValue(index, m, v),
1824
+ isDirty: (m) => item.edited.includes(m),
1825
+ problem: (m) => group.fieldProblem(index, m)
1826
+ }),
1827
+ [form, group, index, item]
1828
+ );
1829
+ const button = (text, onPress, a11y, disabled = false) => /* @__PURE__ */ jsx9(
1830
+ Pressable6,
1831
+ {
1832
+ onPress,
1833
+ disabled,
1834
+ accessibilityRole: "button",
1835
+ accessibilityLabel: a11y,
1836
+ hitSlop: 6,
1837
+ style: ({ pressed }) => [styles7.iconBtn, { opacity: disabled ? 0.3 : pressed ? 0.6 : 1 }],
1838
+ children: /* @__PURE__ */ jsx9(Text7, { style: { color: theme.textSecondary, fontSize: 15 }, children: text })
1839
+ }
1840
+ );
1841
+ return /* @__PURE__ */ jsxs7(View6, { style: [styles7.item, { borderColor: theme.border }], children: [
1842
+ /* @__PURE__ */ jsxs7(View6, { style: styles7.itemHeader, children: [
1843
+ /* @__PURE__ */ jsx9(Text7, { style: [styles7.itemTitle, { color: theme.text }], numberOfLines: 1, children: title }),
1844
+ button("\u2191", () => group.move(index, -1), `Move ${title} up`, index === 0),
1845
+ button("\u2193", () => group.move(index, 1), `Move ${title} down`, last),
1846
+ button("\u29C9", () => group.duplicate(index), `Duplicate ${title}`, !group.canAdd),
1847
+ button("\u2715", () => group.remove(index), `Remove ${title}`)
1848
+ ] }),
1849
+ /* @__PURE__ */ jsx9(InputFormContext.Provider, { value: scoped, children: /* @__PURE__ */ jsx9(View6, { style: styles7.fields, children: fields.map((f) => {
1850
+ const problem = scoped.problem?.(f.options.metric);
1851
+ return /* @__PURE__ */ jsxs7(View6, { style: [styles7.field, { width: `${Math.min(24, Math.max(1, f.gridPos.w)) / 24 * 100}%` }], children: [
1852
+ /* @__PURE__ */ jsxs7(View6, { style: styles7.fieldHeader, children: [
1853
+ !!f.title && /* @__PURE__ */ jsx9(Text7, { style: [styles7.fieldTitle, { color: theme.textSecondary }], numberOfLines: 1, children: f.title }),
1854
+ !!problem && /* @__PURE__ */ jsx9(Text7, { style: [styles7.problem, { color: theme.danger }], numberOfLines: 1, accessibilityRole: "alert", children: problem })
1855
+ ] }),
1856
+ /* @__PURE__ */ jsx9(View6, { style: styles7.fieldBody, children: /* @__PURE__ */ jsx9(InputPanelBody, { panel: f }) })
1857
+ ] }, f.options.metric);
1858
+ }) }) })
1859
+ ] });
1860
+ }
1861
+ var styles7 = StyleSheet7.create({
1862
+ fill: { flex: 1 },
1863
+ list: { gap: 8, paddingBottom: 4 },
1864
+ item: { borderWidth: 1, borderRadius: 8, padding: 8, gap: 6 },
1865
+ itemHeader: { flexDirection: "row", alignItems: "center", gap: 4 },
1866
+ itemTitle: { flex: 1, fontSize: 14, fontWeight: "600" },
1867
+ iconBtn: { width: 28, height: 28, alignItems: "center", justifyContent: "center" },
1868
+ fields: { flexDirection: "row", flexWrap: "wrap", marginHorizontal: -4 },
1869
+ field: { paddingHorizontal: 4, paddingVertical: 4, gap: 4 },
1870
+ fieldHeader: { flexDirection: "row", gap: 6, alignItems: "baseline" },
1871
+ fieldTitle: { flex: 1, fontSize: 12, fontWeight: "600" },
1872
+ problem: { fontSize: 11, fontWeight: "600", flexShrink: 1 },
1873
+ fieldBody: { minHeight: 44 },
1874
+ add: { borderWidth: 1, borderStyle: "dashed", borderRadius: 8, paddingVertical: 10, alignItems: "center" }
1875
+ });
1876
+
1765
1877
  // src/ui/panels/GaugePanels.tsx
1766
- import { useMemo as useMemo3 } from "react";
1767
- import { Pressable as Pressable7, StyleSheet as StyleSheet8, Text as Text8, View as View7 } from "react-native";
1878
+ import { useMemo as useMemo4 } from "react";
1879
+ import { Pressable as Pressable8, StyleSheet as StyleSheet9, Text as Text9, View as View8 } from "react-native";
1768
1880
  import Svg5, { Path as Path5 } from "react-native-svg";
1769
1881
 
1770
1882
  // src/ui/panels/StatPanel.tsx
1771
- import { useMemo as useMemo2 } from "react";
1772
- import { Pressable as Pressable6, StyleSheet as StyleSheet7, Text as Text7, View as View6 } from "react-native";
1883
+ import { useMemo as useMemo3 } from "react";
1884
+ import { Pressable as Pressable7, StyleSheet as StyleSheet8, Text as Text8, View as View7 } from "react-native";
1773
1885
  import Svg4, { Path as Path4 } from "react-native-svg";
1774
- import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1886
+ import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
1775
1887
  function StatPanel({ panel, frames }) {
1776
1888
  const theme = useDashTheme();
1777
- const values = useMemo2(() => reducedValues(panel, frames, theme.scheme), [panel, frames, theme.scheme]);
1778
- if (!values.length) return /* @__PURE__ */ jsx9(NoData, {});
1889
+ const values = useMemo3(() => reducedValues(panel, frames, theme.scheme), [panel, frames, theme.scheme]);
1890
+ if (!values.length) return /* @__PURE__ */ jsx10(NoData, {});
1779
1891
  const horizontal = panel.options?.orientation === "horizontal";
1780
- return /* @__PURE__ */ jsx9(View6, { style: [styles7.grid, { flexDirection: horizontal ? "column" : "row" }], children: values.map((v) => /* @__PURE__ */ jsx9(StatTile, { v, showName: values.length > 1, panel }, v.key)) });
1892
+ return /* @__PURE__ */ jsx10(View7, { style: [styles8.grid, { flexDirection: horizontal ? "column" : "row" }], children: values.map((v) => /* @__PURE__ */ jsx10(StatTile, { v, showName: values.length > 1, panel }, v.key)) });
1781
1893
  }
1782
1894
  function StatTile({ v, showName, panel }) {
1783
1895
  const theme = useDashTheme();
@@ -1787,25 +1899,25 @@ function StatTile({ v, showName, panel }) {
1787
1899
  const fontSize = Math.max(18, Math.min(56, size.height * (graph ? 0.4 : 0.5), size.width / 4.5));
1788
1900
  const { resolve, openLinks } = usePanelLinks(panel);
1789
1901
  const hasLinks = !!v.config.links?.length;
1790
- return /* @__PURE__ */ jsxs7(
1791
- Pressable6,
1902
+ return /* @__PURE__ */ jsxs8(
1903
+ Pressable7,
1792
1904
  {
1793
1905
  onLayout,
1794
1906
  disabled: !hasLinks,
1795
1907
  onPress: () => openLinks(valueLinks(panel, v, resolve), v.name),
1796
1908
  accessibilityRole: hasLinks ? "link" : void 0,
1797
1909
  style: ({ pressed }) => [
1798
- styles7.tile,
1910
+ styles8.tile,
1799
1911
  // With a sparkline, the number sits in the top half so the line runs beneath it.
1800
1912
  graph && { justifyContent: "flex-start", paddingTop: 4 },
1801
1913
  colorMode === "background" && { backgroundColor: withAlpha(v.stateColor, 0.14) },
1802
1914
  pressed && { opacity: 0.7 }
1803
1915
  ],
1804
1916
  children: [
1805
- colorMode !== "none" && /* @__PURE__ */ jsx9(View6, { style: [styles7.accent, { backgroundColor: v.stateColor }] }),
1806
- graph && size.width > 0 && /* @__PURE__ */ jsx9(Sparkline, { values: v.sparkline, width: size.width, height: size.height * 0.4, color: v.stateColor }),
1807
- showName && /* @__PURE__ */ jsx9(Text7, { style: [styles7.name, { color: theme.textSecondary }], numberOfLines: 1, children: v.name }),
1808
- /* @__PURE__ */ jsx9(Text7, { style: [styles7.value, { color: theme.text, fontSize }], numberOfLines: 1, adjustsFontSizeToFit: true, children: v.text })
1917
+ colorMode !== "none" && /* @__PURE__ */ jsx10(View7, { style: [styles8.accent, { backgroundColor: v.stateColor }] }),
1918
+ graph && size.width > 0 && /* @__PURE__ */ jsx10(Sparkline, { values: v.sparkline, width: size.width, height: size.height * 0.4, color: v.stateColor }),
1919
+ showName && /* @__PURE__ */ jsx10(Text8, { style: [styles8.name, { color: theme.textSecondary }], numberOfLines: 1, children: v.name }),
1920
+ /* @__PURE__ */ jsx10(Text8, { style: [styles8.value, { color: theme.text, fontSize }], numberOfLines: 1, adjustsFontSizeToFit: true, children: v.text })
1809
1921
  ]
1810
1922
  }
1811
1923
  );
@@ -1820,16 +1932,16 @@ function Sparkline({ values, width, height, color }) {
1820
1932
  values.forEach((v, i) => {
1821
1933
  if (v != null) line += `${line ? "L" : "M"}${x(i)},${y(v)}`;
1822
1934
  });
1823
- return /* @__PURE__ */ jsxs7(Svg4, { width, height, style: styles7.spark, children: [
1824
- /* @__PURE__ */ jsx9(Path4, { d: `${line}L${width},${height}L0,${height}Z`, fill: color, opacity: 0.1 }),
1825
- /* @__PURE__ */ jsx9(Path4, { d: line, stroke: color, strokeWidth: 2, fill: "none", strokeLinejoin: "round" })
1935
+ return /* @__PURE__ */ jsxs8(Svg4, { width, height, style: styles8.spark, children: [
1936
+ /* @__PURE__ */ jsx10(Path4, { d: `${line}L${width},${height}L0,${height}Z`, fill: color, opacity: 0.1 }),
1937
+ /* @__PURE__ */ jsx10(Path4, { d: line, stroke: color, strokeWidth: 2, fill: "none", strokeLinejoin: "round" })
1826
1938
  ] });
1827
1939
  }
1828
1940
  function withAlpha(hex, alpha) {
1829
1941
  if (!/^#[0-9a-f]{6}$/i.test(hex)) return hex;
1830
1942
  return `${hex}${Math.round(alpha * 255).toString(16).padStart(2, "0")}`;
1831
1943
  }
1832
- var styles7 = StyleSheet7.create({
1944
+ var styles8 = StyleSheet8.create({
1833
1945
  grid: { flex: 1, gap: 8 },
1834
1946
  tile: { flex: 1, justifyContent: "center", paddingLeft: 12, borderRadius: 6, overflow: "hidden" },
1835
1947
  accent: { position: "absolute", left: 0, top: 6, bottom: 6, width: 3, borderRadius: 2 },
@@ -1839,13 +1951,13 @@ var styles7 = StyleSheet7.create({
1839
1951
  });
1840
1952
 
1841
1953
  // src/ui/panels/GaugePanels.tsx
1842
- import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
1954
+ import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
1843
1955
  var SWEEP = 240;
1844
1956
  function GaugePanel({ panel, frames }) {
1845
1957
  const theme = useDashTheme();
1846
- const values = useMemo3(() => reducedValues(panel, frames, theme.scheme), [panel, frames, theme.scheme]);
1847
- if (!values.length) return /* @__PURE__ */ jsx10(NoData, {});
1848
- return /* @__PURE__ */ jsx10(View7, { style: styles8.row, children: values.map((v) => /* @__PURE__ */ jsx10(Gauge, { v, showName: values.length > 1, panel }, v.key)) });
1958
+ const values = useMemo4(() => reducedValues(panel, frames, theme.scheme), [panel, frames, theme.scheme]);
1959
+ if (!values.length) return /* @__PURE__ */ jsx11(NoData, {});
1960
+ return /* @__PURE__ */ jsx11(View8, { style: styles9.row, children: values.map((v) => /* @__PURE__ */ jsx11(Gauge, { v, showName: values.length > 1, panel }, v.key)) });
1849
1961
  }
1850
1962
  function Gauge({ v, showName, panel }) {
1851
1963
  const theme = useDashTheme();
@@ -1860,22 +1972,22 @@ function Gauge({ v, showName, panel }) {
1860
1972
  const r = d / 2 - stroke;
1861
1973
  const cx = size.width / 2;
1862
1974
  const cy = size.height / 2 + d * 0.08;
1863
- return /* @__PURE__ */ jsxs8(
1864
- Pressable7,
1975
+ return /* @__PURE__ */ jsxs9(
1976
+ Pressable8,
1865
1977
  {
1866
- style: ({ pressed }) => [styles8.fill, pressed && { opacity: 0.7 }],
1978
+ style: ({ pressed }) => [styles9.fill, pressed && { opacity: 0.7 }],
1867
1979
  onLayout,
1868
1980
  disabled: !hasLinks,
1869
1981
  onPress: () => openLinks(valueLinks(panel, v, resolve), v.name),
1870
1982
  accessibilityRole: hasLinks ? "link" : void 0,
1871
1983
  children: [
1872
- size.width > 0 && r > 0 && /* @__PURE__ */ jsxs8(Svg5, { width: size.width, height: size.height, children: [
1873
- /* @__PURE__ */ jsx10(Path5, { d: arc(cx, cy, r, 0, 1), stroke: withAlpha(v.stateColor, 0.18), strokeWidth: stroke, fill: "none", strokeLinecap: "round" }),
1874
- frac > 0 && /* @__PURE__ */ jsx10(Path5, { d: arc(cx, cy, r, 0, frac), stroke: v.stateColor, strokeWidth: stroke, fill: "none", strokeLinecap: "round" })
1984
+ size.width > 0 && r > 0 && /* @__PURE__ */ jsxs9(Svg5, { width: size.width, height: size.height, children: [
1985
+ /* @__PURE__ */ jsx11(Path5, { d: arc(cx, cy, r, 0, 1), stroke: withAlpha(v.stateColor, 0.18), strokeWidth: stroke, fill: "none", strokeLinecap: "round" }),
1986
+ frac > 0 && /* @__PURE__ */ jsx11(Path5, { d: arc(cx, cy, r, 0, frac), stroke: v.stateColor, strokeWidth: stroke, fill: "none", strokeLinecap: "round" })
1875
1987
  ] }),
1876
- /* @__PURE__ */ jsxs8(View7, { style: [StyleSheet8.absoluteFill, styles8.center, { top: d * 0.12 }], pointerEvents: "none", children: [
1877
- /* @__PURE__ */ jsx10(Text8, { style: [styles8.value, { color: theme.text, fontSize: Math.max(14, d * 0.18) }], numberOfLines: 1, adjustsFontSizeToFit: true, children: v.text }),
1878
- showName && /* @__PURE__ */ jsx10(Text8, { style: [styles8.name, { color: theme.textSecondary }], numberOfLines: 1, children: v.name })
1988
+ /* @__PURE__ */ jsxs9(View8, { style: [StyleSheet9.absoluteFill, styles9.center, { top: d * 0.12 }], pointerEvents: "none", children: [
1989
+ /* @__PURE__ */ jsx11(Text9, { style: [styles9.value, { color: theme.text, fontSize: Math.max(14, d * 0.18) }], numberOfLines: 1, adjustsFontSizeToFit: true, children: v.text }),
1990
+ showName && /* @__PURE__ */ jsx11(Text9, { style: [styles9.name, { color: theme.textSecondary }], numberOfLines: 1, children: v.name })
1879
1991
  ] })
1880
1992
  ]
1881
1993
  }
@@ -1891,35 +2003,35 @@ function arc(cx, cy, r, a, b) {
1891
2003
  }
1892
2004
  function BarGaugePanel({ panel, frames }) {
1893
2005
  const theme = useDashTheme();
1894
- const values = useMemo3(() => reducedValues(panel, frames, theme.scheme), [panel, frames, theme.scheme]);
2006
+ const values = useMemo4(() => reducedValues(panel, frames, theme.scheme), [panel, frames, theme.scheme]);
1895
2007
  const { resolve, openLinks } = usePanelLinks(panel);
1896
- if (!values.length) return /* @__PURE__ */ jsx10(NoData, {});
1897
- return /* @__PURE__ */ jsx10(View7, { style: styles8.bars, children: values.map((v) => {
2008
+ if (!values.length) return /* @__PURE__ */ jsx11(NoData, {});
2009
+ return /* @__PURE__ */ jsx11(View8, { style: styles9.bars, children: values.map((v) => {
1898
2010
  const min = v.config.min ?? 0;
1899
2011
  const max = v.config.max ?? Math.max(...values.map((o) => o.value ?? 0), 1);
1900
2012
  const frac = v.value == null ? 0 : Math.min(1, Math.max(0, (v.value - min) / (max - min || 1)));
1901
2013
  const color = v.config.thresholds || v.mapped?.color ? v.stateColor : resolveColor(v.config.color?.fixedColor, v.color);
1902
2014
  const hasLinks = !!v.config.links?.length;
1903
- return /* @__PURE__ */ jsxs8(
1904
- Pressable7,
2015
+ return /* @__PURE__ */ jsxs9(
2016
+ Pressable8,
1905
2017
  {
1906
- style: ({ pressed }) => [styles8.barRow, pressed && { opacity: 0.7 }],
2018
+ style: ({ pressed }) => [styles9.barRow, pressed && { opacity: 0.7 }],
1907
2019
  disabled: !hasLinks,
1908
2020
  onPress: () => openLinks(valueLinks(panel, v, resolve), v.name),
1909
2021
  accessibilityRole: hasLinks ? "link" : void 0,
1910
2022
  children: [
1911
- /* @__PURE__ */ jsxs8(View7, { style: styles8.barLabels, children: [
1912
- /* @__PURE__ */ jsx10(Text8, { style: [styles8.name, { color: theme.textSecondary }], numberOfLines: 1, children: v.name }),
1913
- /* @__PURE__ */ jsx10(Text8, { style: [styles8.barValue, { color: theme.text }], children: v.text })
2023
+ /* @__PURE__ */ jsxs9(View8, { style: styles9.barLabels, children: [
2024
+ /* @__PURE__ */ jsx11(Text9, { style: [styles9.name, { color: theme.textSecondary }], numberOfLines: 1, children: v.name }),
2025
+ /* @__PURE__ */ jsx11(Text9, { style: [styles9.barValue, { color: theme.text }], children: v.text })
1914
2026
  ] }),
1915
- /* @__PURE__ */ jsx10(View7, { style: [styles8.track, { backgroundColor: withAlpha(color, 0.18) }], children: /* @__PURE__ */ jsx10(View7, { style: [styles8.meter, { width: `${frac * 100}%`, backgroundColor: color }] }) })
2027
+ /* @__PURE__ */ jsx11(View8, { style: [styles9.track, { backgroundColor: withAlpha(color, 0.18) }], children: /* @__PURE__ */ jsx11(View8, { style: [styles9.meter, { width: `${frac * 100}%`, backgroundColor: color }] }) })
1916
2028
  ]
1917
2029
  },
1918
2030
  v.key
1919
2031
  );
1920
2032
  }) });
1921
2033
  }
1922
- var styles8 = StyleSheet8.create({
2034
+ var styles9 = StyleSheet9.create({
1923
2035
  fill: { flex: 1 },
1924
2036
  row: { flex: 1, flexDirection: "row", gap: 8 },
1925
2037
  center: { alignItems: "center", justifyContent: "center" },
@@ -1934,8 +2046,8 @@ var styles8 = StyleSheet8.create({
1934
2046
  });
1935
2047
 
1936
2048
  // src/ui/panels/GeomapPanel.tsx
1937
- import { useEffect as useEffect3, useMemo as useMemo4, useRef as useRef2, useState as useState6 } from "react";
1938
- import { Image, PixelRatio, Pressable as Pressable8, StyleSheet as StyleSheet9, Text as Text9, View as View8 } from "react-native";
2049
+ import { useEffect as useEffect3, useMemo as useMemo5, useRef as useRef2, useState as useState6 } from "react";
2050
+ import { Image, PixelRatio, Pressable as Pressable9, StyleSheet as StyleSheet10, Text as Text10, View as View9 } from "react-native";
1939
2051
  import Svg6, { Path as Path6, Text as SvgText2 } from "react-native-svg";
1940
2052
 
1941
2053
  // src/ui/geomap.ts
@@ -2352,7 +2464,7 @@ function heatmapCells(px, py, weights, radius, blur, width, height, cell = 4) {
2352
2464
  }
2353
2465
 
2354
2466
  // src/ui/panels/GeomapPanel.tsx
2355
- import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
2467
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
2356
2468
  var HIT_PX = 24;
2357
2469
  var DRAG_PX = 6;
2358
2470
  var MAX_LABELS = 300;
@@ -2361,15 +2473,15 @@ function GeomapPanel({ panel, frames }) {
2361
2473
  const [size, onLayout] = useLayout();
2362
2474
  const retina = PixelRatio.get() > 1;
2363
2475
  const { gazetteers, error } = useGazetteers(panel, frames);
2364
- const layers = useMemo4(() => geomapLayers(panel, frames, theme.scheme, retina, gazetteers), [panel, frames, theme.scheme, retina, gazetteers]);
2365
- const home = useMemo4(() => initialView(panel, layers, size.width, size.height), [panel, layers, size.width, size.height]);
2476
+ const layers = useMemo5(() => geomapLayers(panel, frames, theme.scheme, retina, gazetteers), [panel, frames, theme.scheme, retina, gazetteers]);
2477
+ const home = useMemo5(() => initialView(panel, layers, size.width, size.height), [panel, layers, size.width, size.height]);
2366
2478
  const [moved, setMoved] = useState6(null);
2367
2479
  const [picked, setPicked] = useState6(null);
2368
2480
  const links = usePanelLinks(panel);
2369
2481
  const view = moved ?? home;
2370
2482
  const [minZoom, maxZoom] = zoomLimits(panel);
2371
2483
  const zoomTo = (v, zoom) => setMoved({ ...v, zoom: Math.min(maxZoom, Math.max(minZoom, zoom)) });
2372
- const screen = useMemo4(() => {
2484
+ const screen = useMemo5(() => {
2373
2485
  const at = screenProjector(view, size.width, size.height);
2374
2486
  return new Map(
2375
2487
  layers.map((l) => [
@@ -2447,14 +2559,14 @@ function GeomapPanel({ panel, frames }) {
2447
2559
  const attribution = [...new Set(layers.flatMap((l) => l.type === "tiles" && l.source.attribution ? [l.source.attribution] : []))].join(" ");
2448
2560
  const legend = layers.flatMap((l) => l.type === "markers" || l.type === "route" ? l.legend : []);
2449
2561
  const ready = size.width > 0 && size.height > 0;
2450
- return /* @__PURE__ */ jsxs9(View8, { style: styles9.fill, children: [
2451
- /* @__PURE__ */ jsxs9(View8, { style: [styles9.fill, styles9.map, { backgroundColor: theme.grid }], onLayout, ...responder, children: [
2562
+ return /* @__PURE__ */ jsxs10(View9, { style: styles10.fill, children: [
2563
+ /* @__PURE__ */ jsxs10(View9, { style: [styles10.fill, styles10.map, { backgroundColor: theme.grid }], onLayout, ...responder, children: [
2452
2564
  ready && // Nothing inside takes touches, so locationX/Y are always relative to the map.
2453
- /* @__PURE__ */ jsxs9(View8, { pointerEvents: "none", style: StyleSheet9.absoluteFill, children: [
2565
+ /* @__PURE__ */ jsxs10(View9, { pointerEvents: "none", style: StyleSheet10.absoluteFill, children: [
2454
2566
  layers.map(
2455
- (l) => l.type === "tiles" ? /* @__PURE__ */ jsx11(Tiles, { layer: l, view, width: size.width, height: size.height }, l.key) : /* @__PURE__ */ jsx11(DataLayerSvg, { layer: l, screen: screen.get(l.key) ?? [], width: size.width, height: size.height, textColor: theme.text }, l.key)
2567
+ (l) => l.type === "tiles" ? /* @__PURE__ */ jsx12(Tiles, { layer: l, view, width: size.width, height: size.height }, l.key) : /* @__PURE__ */ jsx12(DataLayerSvg, { layer: l, screen: screen.get(l.key) ?? [], width: size.width, height: size.height, textColor: theme.text }, l.key)
2456
2568
  ),
2457
- shown && /* @__PURE__ */ jsx11(Svg6, { width: size.width, height: size.height, style: StyleSheet9.absoluteFill, children: /* @__PURE__ */ jsx11(
2569
+ shown && /* @__PURE__ */ jsx12(Svg6, { width: size.width, height: size.height, style: StyleSheet10.absoluteFill, children: /* @__PURE__ */ jsx12(
2458
2570
  Path6,
2459
2571
  {
2460
2572
  d: symbolPath("circle", shown.px, shown.py, Math.max(shown.layer.type === "markers" ? shown.radius + 2 : 5, 5)),
@@ -2464,7 +2576,7 @@ function GeomapPanel({ panel, frames }) {
2464
2576
  }
2465
2577
  ) })
2466
2578
  ] }),
2467
- shown && /* @__PURE__ */ jsx11(
2579
+ shown && /* @__PURE__ */ jsx12(
2468
2580
  RowTooltip,
2469
2581
  {
2470
2582
  at: { x: shown.px, y: shown.py },
@@ -2476,15 +2588,15 @@ function GeomapPanel({ panel, frames }) {
2476
2588
  onOpenLink: (l) => links.openLinks([l])
2477
2589
  }
2478
2590
  ),
2479
- controls.showZoom !== false && /* @__PURE__ */ jsxs9(View8, { style: styles9.zoom, children: [
2480
- /* @__PURE__ */ jsx11(MapButton, { label: "+", onPress: () => zoomTo(view, Math.round(view.zoom) + 1) }),
2481
- /* @__PURE__ */ jsx11(MapButton, { label: "\u2212", onPress: () => zoomTo(view, Math.round(view.zoom) - 1) }),
2482
- moved && /* @__PURE__ */ jsx11(MapButton, { label: "\u27F2", onPress: () => setMoved(null) })
2591
+ controls.showZoom !== false && /* @__PURE__ */ jsxs10(View9, { style: styles10.zoom, children: [
2592
+ /* @__PURE__ */ jsx12(MapButton, { label: "+", onPress: () => zoomTo(view, Math.round(view.zoom) + 1) }),
2593
+ /* @__PURE__ */ jsx12(MapButton, { label: "\u2212", onPress: () => zoomTo(view, Math.round(view.zoom) - 1) }),
2594
+ moved && /* @__PURE__ */ jsx12(MapButton, { label: "\u27F2", onPress: () => setMoved(null) })
2483
2595
  ] }),
2484
- error ? /* @__PURE__ */ jsx11(Text9, { pointerEvents: "none", style: [styles9.error, { color: theme.danger, backgroundColor: theme.surface }], numberOfLines: 2, children: error }) : null,
2485
- controls.showAttribution !== false && attribution ? /* @__PURE__ */ jsx11(Text9, { pointerEvents: "none", style: [styles9.attribution, { color: theme.textSecondary, backgroundColor: theme.surface }], numberOfLines: 1, children: attribution }) : null
2596
+ error ? /* @__PURE__ */ jsx12(Text10, { pointerEvents: "none", style: [styles10.error, { color: theme.danger, backgroundColor: theme.surface }], numberOfLines: 2, children: error }) : null,
2597
+ controls.showAttribution !== false && attribution ? /* @__PURE__ */ jsx12(Text10, { pointerEvents: "none", style: [styles10.attribution, { color: theme.textSecondary, backgroundColor: theme.surface }], numberOfLines: 1, children: attribution }) : null
2486
2598
  ] }),
2487
- legend.length > 0 && /* @__PURE__ */ jsx11(Legend, { items: legend })
2599
+ legend.length > 0 && /* @__PURE__ */ jsx12(Legend, { items: legend })
2488
2600
  ] });
2489
2601
  }
2490
2602
  var NONE = {};
@@ -2519,13 +2631,13 @@ function useGazetteers(panel, frames) {
2519
2631
  }
2520
2632
  function MapButton({ label, onPress }) {
2521
2633
  const theme = useDashTheme();
2522
- return /* @__PURE__ */ jsx11(Pressable8, { onPress, hitSlop: 4, style: [styles9.button, { backgroundColor: theme.surface, borderColor: theme.border }], children: /* @__PURE__ */ jsx11(Text9, { style: [styles9.buttonText, { color: theme.text }], children: label }) });
2634
+ return /* @__PURE__ */ jsx12(Pressable9, { onPress, hitSlop: 4, style: [styles10.button, { backgroundColor: theme.surface, borderColor: theme.border }], children: /* @__PURE__ */ jsx12(Text10, { style: [styles10.buttonText, { color: theme.text }], children: label }) });
2523
2635
  }
2524
2636
  function Tiles({ layer, view, width, height }) {
2525
2637
  const tiles = visibleTiles(layer.source, view, width, height);
2526
- return /* @__PURE__ */ jsx11(View8, { style: [StyleSheet9.absoluteFill, { opacity: layer.opacity }], children: tiles.map((t) => (
2638
+ return /* @__PURE__ */ jsx12(View9, { style: [StyleSheet10.absoluteFill, { opacity: layer.opacity }], children: tiles.map((t) => (
2527
2639
  // Half a pixel of overlap hides seams between scaled tiles.
2528
- /* @__PURE__ */ jsx11(
2640
+ /* @__PURE__ */ jsx12(
2529
2641
  Image,
2530
2642
  {
2531
2643
  source: { uri: t.url },
@@ -2537,17 +2649,17 @@ function Tiles({ layer, view, width, height }) {
2537
2649
  )) });
2538
2650
  }
2539
2651
  function DataLayerSvg({ layer, screen, width, height, textColor }) {
2540
- const body = useMemo4(() => {
2652
+ const body = useMemo5(() => {
2541
2653
  if (layer.type === "heatmap") {
2542
2654
  const px = screen.flatMap((s) => s.px);
2543
2655
  const py = screen.flatMap((s) => s.py);
2544
2656
  const weights = layer.points.flatMap((p) => p.sizes);
2545
- return heatmapCells(px, py, weights, layer.radius, layer.blur, width, height).map((c) => /* @__PURE__ */ jsx11(Path6, { d: c.d, fill: c.color, fillOpacity: c.opacity }, c.color));
2657
+ return heatmapCells(px, py, weights, layer.radius, layer.blur, width, height).map((c) => /* @__PURE__ */ jsx12(Path6, { d: c.d, fill: c.color, fillOpacity: c.opacity }, c.color));
2546
2658
  }
2547
2659
  if (layer.type === "route") return routePaths(layer, screen);
2548
2660
  return markerPaths(layer, screen, width, height, textColor);
2549
2661
  }, [layer, screen, width, height, textColor]);
2550
- return /* @__PURE__ */ jsx11(Svg6, { width, height, style: [StyleSheet9.absoluteFill, { opacity: layer.opacity }], children: body });
2662
+ return /* @__PURE__ */ jsx12(Svg6, { width, height, style: [StyleSheet10.absoluteFill, { opacity: layer.opacity }], children: body });
2551
2663
  }
2552
2664
  function markerPaths(layer, screen, width, height, textColor) {
2553
2665
  const byColor = /* @__PURE__ */ new Map();
@@ -2562,7 +2674,7 @@ function markerPaths(layer, screen, width, height, textColor) {
2562
2674
  const label = p.labels?.[i];
2563
2675
  if (label && labels.length < MAX_LABELS)
2564
2676
  labels.push(
2565
- /* @__PURE__ */ jsx11(
2677
+ /* @__PURE__ */ jsx12(
2566
2678
  SvgText2,
2567
2679
  {
2568
2680
  x: px[i] + layer.labelOffset[0],
@@ -2579,7 +2691,7 @@ function markerPaths(layer, screen, width, height, textColor) {
2579
2691
  });
2580
2692
  const outline = layer.symbol === "cross" || layer.symbol === "x";
2581
2693
  return [
2582
- ...[...byColor].map(([color, parts]) => /* @__PURE__ */ jsx11(Path6, { d: parts.join(""), fill: outline ? "none" : color, fillOpacity: layer.fillOpacity, stroke: color, strokeWidth: outline ? 2 : 1 }, color)),
2694
+ ...[...byColor].map(([color, parts]) => /* @__PURE__ */ jsx12(Path6, { d: parts.join(""), fill: outline ? "none" : color, fillOpacity: layer.fillOpacity, stroke: color, strokeWidth: outline ? 2 : 1 }, color)),
2583
2695
  ...labels
2584
2696
  ];
2585
2697
  }
@@ -2592,7 +2704,7 @@ function routePaths(layer, screen) {
2592
2704
  parts.push(`M${px[i]},${py[i]}L${px[i + 1]},${py[i + 1]}`);
2593
2705
  }
2594
2706
  });
2595
- return [...byColor].map(([color, parts]) => /* @__PURE__ */ jsx11(Path6, { d: parts.join(""), stroke: color, strokeWidth: layer.lineWidth, strokeLinecap: "round", fill: "none" }, color));
2707
+ return [...byColor].map(([color, parts]) => /* @__PURE__ */ jsx12(Path6, { d: parts.join(""), stroke: color, strokeWidth: layer.lineWidth, strokeLinecap: "round", fill: "none" }, color));
2596
2708
  }
2597
2709
  function resolvePicked(layers, screen, picked) {
2598
2710
  const layer = layers.find((l) => l.key === picked.layer);
@@ -2610,7 +2722,7 @@ function resolvePicked(layers, screen, picked) {
2610
2722
  py: s.py[picked.index]
2611
2723
  };
2612
2724
  }
2613
- var styles9 = StyleSheet9.create({
2725
+ var styles10 = StyleSheet10.create({
2614
2726
  fill: { flex: 1 },
2615
2727
  map: { overflow: "hidden", borderRadius: 4 },
2616
2728
  zoom: { position: "absolute", top: 6, left: 6, gap: 4 },
@@ -2618,7 +2730,7 @@ var styles9 = StyleSheet9.create({
2618
2730
  width: 28,
2619
2731
  height: 28,
2620
2732
  borderRadius: 4,
2621
- borderWidth: StyleSheet9.hairlineWidth,
2733
+ borderWidth: StyleSheet10.hairlineWidth,
2622
2734
  alignItems: "center",
2623
2735
  justifyContent: "center"
2624
2736
  },
@@ -2628,8 +2740,8 @@ var styles9 = StyleSheet9.create({
2628
2740
  });
2629
2741
 
2630
2742
  // src/ui/panels/OtherPanels.tsx
2631
- import { useMemo as useMemo5, useState as useState7 } from "react";
2632
- import { Pressable as Pressable9, ScrollView as ScrollView4, StyleSheet as StyleSheet10, Text as Text10, View as View9 } from "react-native";
2743
+ import { useMemo as useMemo6, useState as useState7 } from "react";
2744
+ import { Pressable as Pressable10, ScrollView as ScrollView5, StyleSheet as StyleSheet11, Text as Text11, View as View10 } from "react-native";
2633
2745
  import Svg7, { Path as Path7 } from "react-native-svg";
2634
2746
 
2635
2747
  // src/ui/table.ts
@@ -2768,15 +2880,15 @@ function sortedRows(columns, length, sort) {
2768
2880
  var compareText = typeof Intl !== "undefined" && typeof Intl.Collator === "function" ? new Intl.Collator(void 0, { numeric: true, sensitivity: "base" }).compare : (a, b) => a < b ? -1 : a > b ? 1 : 0;
2769
2881
 
2770
2882
  // src/ui/panels/OtherPanels.tsx
2771
- import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
2883
+ import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
2772
2884
  function PieChartPanel({ panel, frames }) {
2773
2885
  const theme = useDashTheme();
2774
2886
  const [size, onLayout] = useLayout();
2775
- const values = useMemo5(
2887
+ const values = useMemo6(
2776
2888
  () => reducedValues(panel, frames, theme.scheme).filter((v) => (v.value ?? 0) > 0),
2777
2889
  [panel, frames, theme.scheme]
2778
2890
  );
2779
- if (!values.length) return /* @__PURE__ */ jsx12(NoData, {});
2891
+ if (!values.length) return /* @__PURE__ */ jsx13(NoData, {});
2780
2892
  const total = values.reduce((a, v) => a + (v.value ?? 0), 0);
2781
2893
  const r = Math.min(size.width, size.height) / 2 - 2;
2782
2894
  const inner = panel.options?.pieType === "pie" ? 0 : r * 0.62;
@@ -2790,9 +2902,9 @@ function PieChartPanel({ panel, frames }) {
2790
2902
  slices.push({ key: v.key, d: donutSlice(cx, cy, r, inner, angle + gap / 2, angle + sweep - gap / 2), color: v.color });
2791
2903
  angle += sweep;
2792
2904
  }
2793
- return /* @__PURE__ */ jsxs10(View9, { style: styles10.fill, children: [
2794
- /* @__PURE__ */ jsx12(View9, { style: styles10.fill, onLayout, children: r > 0 && /* @__PURE__ */ jsx12(Svg7, { width: size.width, height: size.height, children: slices.map((s) => /* @__PURE__ */ jsx12(Path7, { d: s.d, fill: s.color }, s.key)) }) }),
2795
- /* @__PURE__ */ jsx12(
2905
+ return /* @__PURE__ */ jsxs11(View10, { style: styles11.fill, children: [
2906
+ /* @__PURE__ */ jsx13(View10, { style: styles11.fill, onLayout, children: r > 0 && /* @__PURE__ */ jsx13(Svg7, { width: size.width, height: size.height, children: slices.map((s) => /* @__PURE__ */ jsx13(Path7, { d: s.d, fill: s.color }, s.key)) }) }),
2907
+ /* @__PURE__ */ jsx13(
2796
2908
  Legend,
2797
2909
  {
2798
2910
  items: values.map((v) => ({
@@ -2816,27 +2928,27 @@ function TablePanel({ panel, frames }) {
2816
2928
  const theme = useDashTheme();
2817
2929
  const { resolve, openLinks } = usePanelLinks(panel);
2818
2930
  const frame = frames[0];
2819
- const columns = useMemo5(() => frame ? tableColumns(panel, frame, frames.length > 1) : [], [panel, frame, frames.length]);
2931
+ const columns = useMemo6(() => frame ? tableColumns(panel, frame, frames.length > 1) : [], [panel, frame, frames.length]);
2820
2932
  const [tapped, setSort] = useState7();
2821
2933
  const sort = tapped === void 0 ? initialSort(panel, columns) : tapped;
2822
- const order = useMemo5(() => sortedRows(columns, frame ? frameLength(frame) : 0, sort), [columns, frame, sort]);
2823
- if (!frame || !frameLength(frame)) return /* @__PURE__ */ jsx12(NoData, {});
2934
+ const order = useMemo6(() => sortedRows(columns, frame ? frameLength(frame) : 0, sort), [columns, frame, sort]);
2935
+ if (!frame || !frameLength(frame)) return /* @__PURE__ */ jsx13(NoData, {});
2824
2936
  const shown = order.slice(0, 500);
2825
2937
  const rowColumn = columns.find((c) => c.applyToRow);
2826
2938
  const footer = tableFooter(columns);
2827
- return /* @__PURE__ */ jsx12(ScrollView4, { horizontal: true, children: /* @__PURE__ */ jsxs10(View9, { style: styles10.fill, children: [
2828
- /* @__PURE__ */ jsxs10(ScrollView4, { nestedScrollEnabled: true, style: styles10.fill, children: [
2829
- /* @__PURE__ */ jsx12(View9, { style: [styles10.tr, { borderBottomColor: theme.border }], children: columns.map((c) => {
2939
+ return /* @__PURE__ */ jsx13(ScrollView5, { horizontal: true, children: /* @__PURE__ */ jsxs11(View10, { style: styles11.fill, children: [
2940
+ /* @__PURE__ */ jsxs11(ScrollView5, { nestedScrollEnabled: true, style: styles11.fill, children: [
2941
+ /* @__PURE__ */ jsx13(View10, { style: [styles11.tr, { borderBottomColor: theme.border }], children: columns.map((c) => {
2830
2942
  const active = sort?.key === c.key;
2831
- return /* @__PURE__ */ jsx12(
2832
- Pressable9,
2943
+ return /* @__PURE__ */ jsx13(
2944
+ Pressable10,
2833
2945
  {
2834
2946
  onPress: () => setSort(nextSort(sort, c.key)),
2835
2947
  accessibilityRole: "button",
2836
2948
  accessibilityLabel: `Sort by ${c.name}`,
2837
2949
  accessibilityState: { selected: active },
2838
2950
  style: { width: c.width },
2839
- children: /* @__PURE__ */ jsxs10(Text10, { style: [styles10.th, { color: active ? theme.text : theme.textSecondary, textAlign: c.align }], numberOfLines: 2, children: [
2951
+ children: /* @__PURE__ */ jsxs11(Text11, { style: [styles11.th, { color: active ? theme.text : theme.textSecondary, textAlign: c.align }], numberOfLines: 2, children: [
2840
2952
  c.name,
2841
2953
  active ? sort.desc ? " \u2193" : " \u2191" : ""
2842
2954
  ] })
@@ -2846,14 +2958,14 @@ function TablePanel({ panel, frames }) {
2846
2958
  }) }),
2847
2959
  shown.map((i) => {
2848
2960
  const rowBg = rowColumn ? cellDisplay(rowColumn, rowColumn.field.values[i], theme.accent).background : void 0;
2849
- return /* @__PURE__ */ jsx12(View9, { style: [styles10.tr, { borderBottomColor: theme.grid }, rowBg ? { backgroundColor: rowBg } : null], children: columns.map((c) => {
2961
+ return /* @__PURE__ */ jsx13(View10, { style: [styles11.tr, { borderBottomColor: theme.grid }, rowBg ? { backgroundColor: rowBg } : null], children: columns.map((c) => {
2850
2962
  const d = cellDisplay(c, c.field.values[i], theme.accent);
2851
2963
  const bg = d.background ?? rowBg;
2852
2964
  const linked = !!c.config.links?.length;
2853
2965
  const color = d.color ?? (bg ? contrastText(bg, theme.text) : linked ? theme.accent : theme.text);
2854
- const cellStyle = [styles10.td, { width: c.width }, d.background ? { backgroundColor: d.background } : null];
2855
- return /* @__PURE__ */ jsxs10(
2856
- Pressable9,
2966
+ const cellStyle = [styles11.td, { width: c.width }, d.background ? { backgroundColor: d.background } : null];
2967
+ return /* @__PURE__ */ jsxs11(
2968
+ Pressable10,
2857
2969
  {
2858
2970
  disabled: !linked,
2859
2971
  onPress: () => openLinks(
@@ -2863,8 +2975,8 @@ function TablePanel({ panel, frames }) {
2863
2975
  accessibilityRole: linked ? "link" : void 0,
2864
2976
  style: ({ pressed }) => [cellStyle, pressed && { opacity: 0.6 }],
2865
2977
  children: [
2866
- d.gauge != null && /* @__PURE__ */ jsx12(View9, { style: [styles10.gaugeTrack, { backgroundColor: theme.grid }], children: /* @__PURE__ */ jsx12(View9, { style: [styles10.gaugeFill, { width: `${d.gauge * 100}%`, backgroundColor: d.gaugeColor ?? theme.accent }] }) }),
2867
- /* @__PURE__ */ jsx12(Text10, { style: [styles10.cellText, { color, textAlign: c.align }, c.field.type === "number" && styles10.num], numberOfLines: c.wrap ? void 0 : 1, children: d.text })
2978
+ d.gauge != null && /* @__PURE__ */ jsx13(View10, { style: [styles11.gaugeTrack, { backgroundColor: theme.grid }], children: /* @__PURE__ */ jsx13(View10, { style: [styles11.gaugeFill, { width: `${d.gauge * 100}%`, backgroundColor: d.gaugeColor ?? theme.accent }] }) }),
2979
+ /* @__PURE__ */ jsx13(Text11, { style: [styles11.cellText, { color, textAlign: c.align }, c.field.type === "number" && styles11.num], numberOfLines: c.wrap ? void 0 : 1, children: d.text })
2868
2980
  ]
2869
2981
  },
2870
2982
  c.key
@@ -2872,8 +2984,8 @@ function TablePanel({ panel, frames }) {
2872
2984
  }) }, i);
2873
2985
  })
2874
2986
  ] }),
2875
- footer && /* @__PURE__ */ jsx12(View9, { style: [styles10.tr, styles10.footer, { borderTopColor: theme.border }], children: columns.map((c, ci) => /* @__PURE__ */ jsx12(View9, { style: [styles10.td, { width: c.width }], children: footer[ci].map((line, li) => /* @__PURE__ */ jsxs10(Text10, { style: [styles10.cellText, styles10.footerText, { color: theme.text, textAlign: c.align }], numberOfLines: 1, children: [
2876
- line.label ? /* @__PURE__ */ jsx12(Text10, { style: { color: theme.textMuted, fontWeight: "400" }, children: `${line.label} ` }) : null,
2987
+ footer && /* @__PURE__ */ jsx13(View10, { style: [styles11.tr, styles11.footer, { borderTopColor: theme.border }], children: columns.map((c, ci) => /* @__PURE__ */ jsx13(View10, { style: [styles11.td, { width: c.width }], children: footer[ci].map((line, li) => /* @__PURE__ */ jsxs11(Text11, { style: [styles11.cellText, styles11.footerText, { color: theme.text, textAlign: c.align }], numberOfLines: 1, children: [
2988
+ line.label ? /* @__PURE__ */ jsx13(Text11, { style: { color: theme.textMuted, fontWeight: "400" }, children: `${line.label} ` }) : null,
2877
2989
  line.text
2878
2990
  ] }, li)) }, c.key)) })
2879
2991
  ] }) });
@@ -2883,24 +2995,24 @@ function TextPanel({ panel }) {
2883
2995
  const raw = panel.options?.content;
2884
2996
  const content = typeof raw === "string" ? raw : "";
2885
2997
  const text = panel.options?.mode === "html" ? content.replace(/<[^>]+>/g, "") : content;
2886
- return /* @__PURE__ */ jsx12(ScrollView4, { children: text.split(/\n{2,}/).map((block, i) => {
2998
+ return /* @__PURE__ */ jsx13(ScrollView5, { children: text.split(/\n{2,}/).map((block, i) => {
2887
2999
  const heading = /^#{1,6}\s+/.test(block);
2888
- return /* @__PURE__ */ jsx12(Text10, { style: [styles10.para, { color: heading ? theme.text : theme.textSecondary }, heading && styles10.heading], children: block.replace(/^#{1,6}\s+/, "").replace(/\*\*(.+?)\*\*/g, "$1").replace(/\[(.+?)\]\(.+?\)/g, "$1") }, i);
3000
+ return /* @__PURE__ */ jsx13(Text11, { style: [styles11.para, { color: heading ? theme.text : theme.textSecondary }, heading && styles11.heading], children: block.replace(/^#{1,6}\s+/, "").replace(/\*\*(.+?)\*\*/g, "$1").replace(/\[(.+?)\]\(.+?\)/g, "$1") }, i);
2889
3001
  }) });
2890
3002
  }
2891
3003
  function BarChartPanel({ panel, frames, width }) {
2892
3004
  const theme = useDashTheme();
2893
3005
  const [plot, onPlotLayout] = useLayout();
2894
- const values = useMemo5(() => reducedValues(panel, frames, theme.scheme), [panel, frames, theme.scheme]);
3006
+ const values = useMemo6(() => reducedValues(panel, frames, theme.scheme), [panel, frames, theme.scheme]);
2895
3007
  const frame = frames[0];
2896
3008
  const category = frame && barCategory(panel, frame);
2897
- if (!frame || !values.length) return /* @__PURE__ */ jsx12(NoData, {});
3009
+ if (!frame || !values.length) return /* @__PURE__ */ jsx13(NoData, {});
2898
3010
  const xField = panel.options?.xField;
2899
- if (xField && !category) return /* @__PURE__ */ jsx12(NoData, { message: `No field named \u201C${String(xField)}\u201D` });
3011
+ if (xField && !category) return /* @__PURE__ */ jsx13(NoData, { message: `No field named \u201C${String(xField)}\u201D` });
2900
3012
  const allNumeric = frame.fields.filter((f) => f.type === "number");
2901
3013
  const at = (f) => values[allNumeric.indexOf(f)];
2902
3014
  const numeric = category ? allNumeric.filter((f) => f !== category) : [];
2903
- if (category && !numeric.length) return /* @__PURE__ */ jsx12(NoData, { message: `No number fields to draw besides \u201C${category.name}\u201D` });
3015
+ if (category && !numeric.length) return /* @__PURE__ */ jsx13(NoData, { message: `No number fields to draw besides \u201C${category.name}\u201D` });
2904
3016
  const fields = category ? numeric.map((f) => ({ key: f.name, name: at(f)?.name ?? f.name, color: at(f)?.color ?? theme.accent, config: at(f)?.config ?? {}, values: f.values.map(num2) })) : [{ key: "reduced", name: "", color: theme.accent, config: values[0].config, values: values.map((v) => v.value) }];
2905
3017
  const labels = category ? categoryLabels(category) : values.map((v) => v.name);
2906
3018
  const colorAt = (fi, i) => category ? fields[fi].color : values[i].color;
@@ -2915,34 +3027,34 @@ function BarChartPanel({ panel, frames, width }) {
2915
3027
  const gridAxis = left ?? right;
2916
3028
  const plotW = width - (left ? AXIS_W : 0) - (right ? AXIS_W : 0);
2917
3029
  const every = Math.max(1, Math.ceil(labels.length / Math.max(1, Math.floor(plotW / 44))));
2918
- const axisColumn = (axis) => /* @__PURE__ */ jsx12(View9, { style: [styles10.axis, axis.side === "left" ? styles10.axisLeft : styles10.axisRight], children: plot.height > 0 && axis.ticks.map((t) => /* @__PURE__ */ jsx12(
2919
- Text10,
3030
+ const axisColumn = (axis) => /* @__PURE__ */ jsx13(View10, { style: [styles11.axis, axis.side === "left" ? styles11.axisLeft : styles11.axisRight], children: plot.height > 0 && axis.ticks.map((t) => /* @__PURE__ */ jsx13(
3031
+ Text11,
2920
3032
  {
2921
- style: [styles10.tick, { color: theme.textMuted, top: plot.height * (1 - barFraction(axis, t)) - 7 }, axis.side === "left" ? styles10.tickLeft : styles10.tickRight],
3033
+ style: [styles11.tick, { color: theme.textMuted, top: plot.height * (1 - barFraction(axis, t)) - 7 }, axis.side === "left" ? styles11.tickLeft : styles11.tickRight],
2922
3034
  numberOfLines: 1,
2923
3035
  children: formatValue(t, { ...axis.config, decimals: tickDecimals(axis.ticks) })
2924
3036
  },
2925
3037
  t
2926
3038
  )) });
2927
- return /* @__PURE__ */ jsxs10(View9, { style: styles10.fill, children: [
2928
- (left?.label || right?.label) && /* @__PURE__ */ jsxs10(View9, { style: styles10.axisLabels, children: [
2929
- /* @__PURE__ */ jsx12(Text10, { style: [styles10.axisLabel, { color: theme.textMuted }], children: left?.label ?? "" }),
2930
- /* @__PURE__ */ jsx12(Text10, { style: [styles10.axisLabel, { color: theme.textMuted }], children: right?.label ?? "" })
3039
+ return /* @__PURE__ */ jsxs11(View10, { style: styles11.fill, children: [
3040
+ (left?.label || right?.label) && /* @__PURE__ */ jsxs11(View10, { style: styles11.axisLabels, children: [
3041
+ /* @__PURE__ */ jsx13(Text11, { style: [styles11.axisLabel, { color: theme.textMuted }], children: left?.label ?? "" }),
3042
+ /* @__PURE__ */ jsx13(Text11, { style: [styles11.axisLabel, { color: theme.textMuted }], children: right?.label ?? "" })
2931
3043
  ] }),
2932
- /* @__PURE__ */ jsxs10(View9, { style: styles10.barRow, children: [
3044
+ /* @__PURE__ */ jsxs11(View10, { style: styles11.barRow, children: [
2933
3045
  left && axisColumn(left),
2934
- /* @__PURE__ */ jsxs10(View9, { style: styles10.fill, onLayout: onPlotLayout, children: [
2935
- gridAxis && plot.height > 0 && gridAxis.ticks.map((t) => /* @__PURE__ */ jsx12(View9, { style: [styles10.gridLine, { backgroundColor: theme.grid, top: plot.height * (1 - barFraction(gridAxis, t)) }] }, t)),
2936
- /* @__PURE__ */ jsx12(View9, { style: styles10.barchart, children: labels.map((_, i) => /* @__PURE__ */ jsx12(View9, { style: styles10.barStack, children: fields.map((f, fi) => {
3046
+ /* @__PURE__ */ jsxs11(View10, { style: styles11.fill, onLayout: onPlotLayout, children: [
3047
+ gridAxis && plot.height > 0 && gridAxis.ticks.map((t) => /* @__PURE__ */ jsx13(View10, { style: [styles11.gridLine, { backgroundColor: theme.grid, top: plot.height * (1 - barFraction(gridAxis, t)) }] }, t)),
3048
+ /* @__PURE__ */ jsx13(View10, { style: styles11.barchart, children: labels.map((_, i) => /* @__PURE__ */ jsx13(View10, { style: styles11.barStack, children: fields.map((f, fi) => {
2937
3049
  const axis = axisOf(fi);
2938
3050
  const base = barFraction(axis, Math.min(Math.max(0, axis.bottom), axis.top));
2939
3051
  const end = barFraction(axis, f.values[i] ?? 0);
2940
- return /* @__PURE__ */ jsx12(View9, { style: styles10.barSlot, children: /* @__PURE__ */ jsx12(
2941
- View9,
3052
+ return /* @__PURE__ */ jsx13(View10, { style: styles11.barSlot, children: /* @__PURE__ */ jsx13(
3053
+ View10,
2942
3054
  {
2943
3055
  style: [
2944
- styles10.bar,
2945
- end < base && styles10.barDown,
3056
+ styles11.bar,
3057
+ end < base && styles11.barDown,
2946
3058
  { bottom: `${Math.min(base, end) * 100}%`, height: `${Math.abs(end - base) * 100}%`, backgroundColor: colorAt(fi, i) }
2947
3059
  ]
2948
3060
  }
@@ -2951,8 +3063,8 @@ function BarChartPanel({ panel, frames, width }) {
2951
3063
  ] }),
2952
3064
  right && axisColumn(right)
2953
3065
  ] }),
2954
- /* @__PURE__ */ jsx12(View9, { style: [styles10.barLabels, { marginLeft: left ? AXIS_W : 0, marginRight: right ? AXIS_W : 0 }], children: labels.map((label, i) => /* @__PURE__ */ jsx12(Text10, { style: [styles10.barLabel, { color: theme.textMuted }], numberOfLines: 1, children: i % every === 0 ? label : " " }, i)) }),
2955
- category && fields.length > 1 && /* @__PURE__ */ jsx12(Legend, { items: fields })
3066
+ /* @__PURE__ */ jsx13(View10, { style: [styles11.barLabels, { marginLeft: left ? AXIS_W : 0, marginRight: right ? AXIS_W : 0 }], children: labels.map((label, i) => /* @__PURE__ */ jsx13(Text11, { style: [styles11.barLabel, { color: theme.textMuted }], numberOfLines: 1, children: i % every === 0 ? label : " " }, i)) }),
3067
+ category && fields.length > 1 && /* @__PURE__ */ jsx13(Legend, { items: fields })
2956
3068
  ] });
2957
3069
  }
2958
3070
  var AXIS_W = 40;
@@ -2962,15 +3074,15 @@ function num2(v) {
2962
3074
  return Number.isFinite(n) ? n : null;
2963
3075
  }
2964
3076
  function UnsupportedPanel({ panel }) {
2965
- return /* @__PURE__ */ jsx12(NoData, { message: `"${panel.type}" panels aren't supported yet` });
3077
+ return /* @__PURE__ */ jsx13(NoData, { message: `"${panel.type}" panels aren't supported yet` });
2966
3078
  }
2967
- var styles10 = StyleSheet10.create({
3079
+ var styles11 = StyleSheet11.create({
2968
3080
  fill: { flex: 1 },
2969
- tr: { flexDirection: "row", borderBottomWidth: StyleSheet10.hairlineWidth },
3081
+ tr: { flexDirection: "row", borderBottomWidth: StyleSheet11.hairlineWidth },
2970
3082
  th: { paddingVertical: 6, paddingHorizontal: 6, fontSize: 12, fontWeight: "600" },
2971
3083
  td: { paddingVertical: 6, paddingHorizontal: 6, justifyContent: "center" },
2972
3084
  cellText: { fontSize: 12 },
2973
- footer: { borderBottomWidth: 0, borderTopWidth: StyleSheet10.hairlineWidth },
3085
+ footer: { borderBottomWidth: 0, borderTopWidth: StyleSheet11.hairlineWidth },
2974
3086
  footerText: { fontWeight: "600", fontVariant: ["tabular-nums"] },
2975
3087
  gaugeTrack: { position: "absolute", left: 6, right: 6, bottom: 3, height: 3, borderRadius: 2, overflow: "hidden" },
2976
3088
  gaugeFill: { height: "100%", borderRadius: 2 },
@@ -2986,7 +3098,7 @@ var styles10 = StyleSheet10.create({
2986
3098
  barDown: { borderTopLeftRadius: 0, borderTopRightRadius: 0, borderBottomLeftRadius: 4, borderBottomRightRadius: 4 },
2987
3099
  barLabels: { flexDirection: "row", gap: 2 },
2988
3100
  barLabel: { flex: 1, fontSize: 10, marginTop: 4, textAlign: "center" },
2989
- gridLine: { position: "absolute", left: 0, right: 0, height: StyleSheet10.hairlineWidth },
3101
+ gridLine: { position: "absolute", left: 0, right: 0, height: StyleSheet11.hairlineWidth },
2990
3102
  axis: { width: AXIS_W },
2991
3103
  axisLeft: { paddingRight: 6 },
2992
3104
  axisRight: { paddingLeft: 6 },
@@ -2998,10 +3110,10 @@ var styles10 = StyleSheet10.create({
2998
3110
  });
2999
3111
 
3000
3112
  // src/ui/panels/TimeSeriesPanel.tsx
3001
- import { useId, useMemo as useMemo6, useRef as useRef3, useState as useState8 } from "react";
3002
- import { Pressable as Pressable10, StyleSheet as StyleSheet11, Text as Text11, View as View10 } from "react-native";
3113
+ import { useId, useMemo as useMemo7, useRef as useRef3, useState as useState8 } from "react";
3114
+ import { Pressable as Pressable11, StyleSheet as StyleSheet12, Text as Text12, View as View11 } from "react-native";
3003
3115
  import Svg8, { Circle, ClipPath, Defs, G, Line, Path as Path8, Rect, Text as SvgText3 } from "react-native-svg";
3004
- import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
3116
+ import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
3005
3117
  var BASE_PAD = { top: 8, right: 8, bottom: 20, left: 44 };
3006
3118
  var BAR_MAX = 24;
3007
3119
  function TimeSeriesPanel({ panel, frames }) {
@@ -3018,11 +3130,11 @@ function TimeSeriesPanel({ panel, frames }) {
3018
3130
  const clipId = `plot${id.replace(/[^a-zA-Z0-9]/g, "")}`;
3019
3131
  const [touching, setTouching] = useState8(false);
3020
3132
  const numericX = panel.type === "trend";
3021
- const { series, xConfig } = useMemo6(
3133
+ const { series, xConfig } = useMemo7(
3022
3134
  () => numericX ? styledXYSeries(panel, frames, theme.scheme) : { series: styledSeries(panel, frames, theme.scheme), xConfig: {} },
3023
3135
  [numericX, panel, frames, theme.scheme]
3024
3136
  );
3025
- if (!series.length || series.every((s) => s.values.every((v) => v == null))) return /* @__PURE__ */ jsx13(NoData, {});
3137
+ if (!series.length || series.every((s) => s.values.every((v) => v == null))) return /* @__PURE__ */ jsx14(NoData, {});
3026
3138
  const style = (s) => s.config.custom?.drawStyle ?? (panel.type === "graph" && panel.bars ? "bars" : "line");
3027
3139
  const anyBars = series.some((s) => style(s) === "bars");
3028
3140
  const anyFill = series.some((s) => (s.config.custom?.fillOpacity ?? 0) > 0);
@@ -3081,11 +3193,11 @@ function TimeSeriesPanel({ panel, frames }) {
3081
3193
  )
3082
3194
  ) : [];
3083
3195
  const isPinned = !!hover && pinned === id;
3084
- return /* @__PURE__ */ jsxs11(View10, { style: styles11.fill, children: [
3085
- /* @__PURE__ */ jsx13(
3086
- View10,
3196
+ return /* @__PURE__ */ jsxs12(View11, { style: styles12.fill, children: [
3197
+ /* @__PURE__ */ jsx14(
3198
+ View11,
3087
3199
  {
3088
- style: styles11.fill,
3200
+ style: styles12.fill,
3089
3201
  onStartShouldSetResponderCapture: twoFingers,
3090
3202
  onMoveShouldSetResponderCapture: twoFingers,
3091
3203
  onResponderTerminationRequest: () => false,
@@ -3097,10 +3209,10 @@ function TimeSeriesPanel({ panel, frames }) {
3097
3209
  onResponderMove: onPinchMove,
3098
3210
  onResponderRelease: () => onPinchEnd(true),
3099
3211
  onResponderTerminate: () => onPinchEnd(false),
3100
- children: /* @__PURE__ */ jsxs11(
3101
- View10,
3212
+ children: /* @__PURE__ */ jsxs12(
3213
+ View11,
3102
3214
  {
3103
- style: styles11.fill,
3215
+ style: styles12.fill,
3104
3216
  onLayout,
3105
3217
  onStartShouldSetResponder: () => true,
3106
3218
  onResponderGrant: (e) => {
@@ -3120,12 +3232,12 @@ function TimeSeriesPanel({ panel, frames }) {
3120
3232
  setHoverX(null);
3121
3233
  },
3122
3234
  children: [
3123
- size.width > 0 && /* @__PURE__ */ jsxs11(Svg8, { width: size.width, height: size.height, children: [
3124
- ticks.map((t) => /* @__PURE__ */ jsxs11(G, { children: [
3125
- /* @__PURE__ */ jsx13(Line, { x1: PAD.left, x2: PAD.left + plotW, y1: y(t), y2: y(t), stroke: theme.grid, strokeWidth: 1 }),
3126
- /* @__PURE__ */ jsx13(SvgText3, { x: PAD.left - 6, y: y(t) + 3, fontSize: 10, fill: theme.textMuted, textAnchor: "end", children: formatValue(t, { ...unitConfig, decimals: tickDecimals(ticks) }) })
3235
+ size.width > 0 && /* @__PURE__ */ jsxs12(Svg8, { width: size.width, height: size.height, children: [
3236
+ ticks.map((t) => /* @__PURE__ */ jsxs12(G, { children: [
3237
+ /* @__PURE__ */ jsx14(Line, { x1: PAD.left, x2: PAD.left + plotW, y1: y(t), y2: y(t), stroke: theme.grid, strokeWidth: 1 }),
3238
+ /* @__PURE__ */ jsx14(SvgText3, { x: PAD.left - 6, y: y(t) + 3, fontSize: 10, fill: theme.textMuted, textAnchor: "end", children: formatValue(t, { ...unitConfig, decimals: tickDecimals(ticks) }) })
3127
3239
  ] }, t)),
3128
- xTicks.map((t) => /* @__PURE__ */ jsx13(
3240
+ xTicks.map((t) => /* @__PURE__ */ jsx14(
3129
3241
  SvgText3,
3130
3242
  {
3131
3243
  x: x(t),
@@ -3137,65 +3249,65 @@ function TimeSeriesPanel({ panel, frames }) {
3137
3249
  },
3138
3250
  t
3139
3251
  )),
3140
- /* @__PURE__ */ jsx13(AxisTitles, { x: xTitle, y: yTitle, plot: { left: PAD.left, top: PAD.top, width: plotW, height: plotH }, height: size.height }),
3141
- /* @__PURE__ */ jsx13(Defs, { children: /* @__PURE__ */ jsx13(ClipPath, { id: clipId, children: /* @__PURE__ */ jsx13(Rect, { x: PAD.left - 6, y: 0, width: plotW + 12, height: size.height }) }) }),
3142
- /* @__PURE__ */ jsxs11(G, { clipPath: `url(#${clipId})`, children: [
3252
+ /* @__PURE__ */ jsx14(AxisTitles, { x: xTitle, y: yTitle, plot: { left: PAD.left, top: PAD.top, width: plotW, height: plotH }, height: size.height }),
3253
+ /* @__PURE__ */ jsx14(Defs, { children: /* @__PURE__ */ jsx14(ClipPath, { id: clipId, children: /* @__PURE__ */ jsx14(Rect, { x: PAD.left - 6, y: 0, width: plotW + 12, height: size.height }) }) }),
3254
+ /* @__PURE__ */ jsxs12(G, { clipPath: `url(#${clipId})`, children: [
3143
3255
  barSeries.map(
3144
3256
  (s, si) => s.times.map((t, i) => {
3145
3257
  const v = s.values[i];
3146
3258
  if (v == null || t < xFrom || t > xTo) return null;
3147
3259
  const left = x(t) - groupW / 2 + si * (groupW / barSeries.length);
3148
- return /* @__PURE__ */ jsx13(Path8, { d: barPath(left, barW, y(Math.max(v, 0)), y(Math.min(v, 0)), v >= 0), fill: s.color }, `${s.key}-${i}`);
3260
+ return /* @__PURE__ */ jsx14(Path8, { d: barPath(left, barW, y(Math.max(v, 0)), y(Math.min(v, 0)), v >= 0), fill: s.color }, `${s.key}-${i}`);
3149
3261
  })
3150
3262
  ),
3151
3263
  series.filter((s) => style(s) !== "bars").map((s) => {
3152
3264
  const fill = (s.config.custom?.fillOpacity ?? 0) / 100;
3153
3265
  const showPoints = style(s) === "points" || s.config.custom?.showPoints === "always" || s.config.custom?.showPoints !== "never" && s.times.length <= plotW / 14;
3154
3266
  const segs = segments(s, x, y, s.config.custom?.lineInterpolation === "stepAfter");
3155
- return /* @__PURE__ */ jsxs11(G, { children: [
3156
- fill > 0 && segs.map((seg, i) => /* @__PURE__ */ jsx13(Path8, { d: `${seg.d}L${seg.lastX},${y(Math.max(yMin, 0))}L${seg.firstX},${y(Math.max(yMin, 0))}Z`, fill: s.color, opacity: fill }, `f${i}`)),
3157
- style(s) !== "points" && segs.map((seg, i) => /* @__PURE__ */ jsx13(Path8, { d: seg.d, stroke: s.color, strokeWidth: s.config.custom?.lineWidth ?? 2, fill: "none", strokeLinejoin: "round", strokeLinecap: "round" }, `l${i}`)),
3267
+ return /* @__PURE__ */ jsxs12(G, { children: [
3268
+ fill > 0 && segs.map((seg, i) => /* @__PURE__ */ jsx14(Path8, { d: `${seg.d}L${seg.lastX},${y(Math.max(yMin, 0))}L${seg.firstX},${y(Math.max(yMin, 0))}Z`, fill: s.color, opacity: fill }, `f${i}`)),
3269
+ style(s) !== "points" && segs.map((seg, i) => /* @__PURE__ */ jsx14(Path8, { d: seg.d, stroke: s.color, strokeWidth: s.config.custom?.lineWidth ?? 2, fill: "none", strokeLinejoin: "round", strokeLinecap: "round" }, `l${i}`)),
3158
3270
  showPoints && s.times.map(
3159
- (t, i) => s.values[i] == null ? null : /* @__PURE__ */ jsx13(Circle, { cx: x(t), cy: y(s.values[i]), r: 4, fill: s.color, stroke: theme.surface, strokeWidth: 2 }, i)
3271
+ (t, i) => s.values[i] == null ? null : /* @__PURE__ */ jsx14(Circle, { cx: x(t), cy: y(s.values[i]), r: 4, fill: s.color, stroke: theme.surface, strokeWidth: 2 }, i)
3160
3272
  )
3161
3273
  ] }, s.key);
3162
3274
  }),
3163
- hover && /* @__PURE__ */ jsxs11(G, { children: [
3164
- /* @__PURE__ */ jsx13(Line, { x1: x(hover.time), x2: x(hover.time), y1: PAD.top, y2: PAD.top + plotH, stroke: theme.textMuted, strokeWidth: 1 }),
3275
+ hover && /* @__PURE__ */ jsxs12(G, { children: [
3276
+ /* @__PURE__ */ jsx14(Line, { x1: x(hover.time), x2: x(hover.time), y1: PAD.top, y2: PAD.top + plotH, stroke: theme.textMuted, strokeWidth: 1 }),
3165
3277
  hover.rows.map(
3166
- (r) => r.value == null ? null : /* @__PURE__ */ jsx13(Circle, { cx: x(r.time), cy: y(r.value), r: 5, fill: r.color, stroke: theme.surface, strokeWidth: 2 }, r.key)
3278
+ (r) => r.value == null ? null : /* @__PURE__ */ jsx14(Circle, { cx: x(r.time), cy: y(r.value), r: 5, fill: r.color, stroke: theme.surface, strokeWidth: 2 }, r.key)
3167
3279
  )
3168
3280
  ] })
3169
3281
  ] })
3170
3282
  ] }),
3171
- xZoom && !preview && /* @__PURE__ */ jsx13(
3172
- Pressable10,
3283
+ xZoom && !preview && /* @__PURE__ */ jsx14(
3284
+ Pressable11,
3173
3285
  {
3174
3286
  onPress: () => setXZoom(null),
3175
3287
  accessibilityRole: "button",
3176
3288
  hitSlop: 8,
3177
- style: ({ pressed }) => [styles11.reset, { backgroundColor: theme.surface, borderColor: theme.border }, pressed && { opacity: 0.7 }],
3178
- children: /* @__PURE__ */ jsx13(Text11, { style: [styles11.resetText, { color: theme.accent }], children: "Reset zoom" })
3289
+ style: ({ pressed }) => [styles12.reset, { backgroundColor: theme.surface, borderColor: theme.border }, pressed && { opacity: 0.7 }],
3290
+ children: /* @__PURE__ */ jsx14(Text12, { style: [styles12.resetText, { color: theme.accent }], children: "Reset zoom" })
3179
3291
  }
3180
3292
  ),
3181
- hover && /* @__PURE__ */ jsxs11(
3182
- View10,
3293
+ hover && /* @__PURE__ */ jsxs12(
3294
+ View11,
3183
3295
  {
3184
3296
  pointerEvents: isPinned ? "auto" : "none",
3185
3297
  onStartShouldSetResponder: () => isPinned,
3186
3298
  style: [
3187
- styles11.tooltip,
3299
+ styles12.tooltip,
3188
3300
  { backgroundColor: theme.surface, borderColor: theme.border },
3189
3301
  x(hover.time) > size.width / 2 ? { right: size.width - x(hover.time) + 8 } : { left: x(hover.time) + 8 }
3190
3302
  ],
3191
3303
  children: [
3192
- /* @__PURE__ */ jsx13(Text11, { style: [styles11.tooltipTime, { color: theme.textMuted }], children: numericX ? formatValue(hover.time, xConfig) : formatTooltipTime(hover.time) }),
3193
- hover.rows.map((r) => /* @__PURE__ */ jsxs11(View10, { style: styles11.tooltipRow, children: [
3194
- /* @__PURE__ */ jsx13(View10, { style: [styles11.swatch, { backgroundColor: r.color }] }),
3195
- /* @__PURE__ */ jsx13(Text11, { style: [styles11.tooltipName, { color: theme.textSecondary }], numberOfLines: 1, children: r.name }),
3196
- /* @__PURE__ */ jsx13(Text11, { style: [styles11.tooltipValue, { color: theme.text }], children: formatValue(r.value, r.config) })
3304
+ /* @__PURE__ */ jsx14(Text12, { style: [styles12.tooltipTime, { color: theme.textMuted }], children: numericX ? formatValue(hover.time, xConfig) : formatTooltipTime(hover.time) }),
3305
+ hover.rows.map((r) => /* @__PURE__ */ jsxs12(View11, { style: styles12.tooltipRow, children: [
3306
+ /* @__PURE__ */ jsx14(View11, { style: [styles12.swatch, { backgroundColor: r.color }] }),
3307
+ /* @__PURE__ */ jsx14(Text12, { style: [styles12.tooltipName, { color: theme.textSecondary }], numberOfLines: 1, children: r.name }),
3308
+ /* @__PURE__ */ jsx14(Text12, { style: [styles12.tooltipValue, { color: theme.text }], children: formatValue(r.value, r.config) })
3197
3309
  ] }, r.key)),
3198
- isPinned && /* @__PURE__ */ jsx13(TooltipLinks, { links: hoverLinks, onOpen: (l) => openLinks([l]) })
3310
+ isPinned && /* @__PURE__ */ jsx14(TooltipLinks, { links: hoverLinks, onOpen: (l) => openLinks([l]) })
3199
3311
  ]
3200
3312
  }
3201
3313
  )
@@ -3204,7 +3316,7 @@ function TimeSeriesPanel({ panel, frames }) {
3204
3316
  )
3205
3317
  }
3206
3318
  ),
3207
- showLegend(panel, series.length) && /* @__PURE__ */ jsx13(Legend, { items: series })
3319
+ showLegend(panel, series.length) && /* @__PURE__ */ jsx14(Legend, { items: series })
3208
3320
  ] });
3209
3321
  }
3210
3322
  function segments(s, x, y, step = false) {
@@ -3293,7 +3405,7 @@ function linkData(r, frames, xField) {
3293
3405
  time: xField === void 0 ? r.time : void 0
3294
3406
  };
3295
3407
  }
3296
- var styles11 = StyleSheet11.create({
3408
+ var styles12 = StyleSheet12.create({
3297
3409
  fill: { flex: 1 },
3298
3410
  tooltip: {
3299
3411
  position: "absolute",
@@ -3301,7 +3413,7 @@ var styles11 = StyleSheet11.create({
3301
3413
  paddingHorizontal: 8,
3302
3414
  paddingVertical: 6,
3303
3415
  borderRadius: 6,
3304
- borderWidth: StyleSheet11.hairlineWidth,
3416
+ borderWidth: StyleSheet12.hairlineWidth,
3305
3417
  maxWidth: 220,
3306
3418
  shadowColor: "#000",
3307
3419
  shadowOpacity: 0.12,
@@ -3309,7 +3421,7 @@ var styles11 = StyleSheet11.create({
3309
3421
  shadowOffset: { width: 0, height: 2 },
3310
3422
  elevation: 3
3311
3423
  },
3312
- reset: { position: "absolute", top: 4, right: 8, paddingHorizontal: 8, paddingVertical: 3, borderRadius: 6, borderWidth: StyleSheet11.hairlineWidth },
3424
+ reset: { position: "absolute", top: 4, right: 8, paddingHorizontal: 8, paddingVertical: 3, borderRadius: 6, borderWidth: StyleSheet12.hairlineWidth },
3313
3425
  resetText: { fontSize: 11, fontWeight: "600" },
3314
3426
  tooltipTime: { fontSize: 11, marginBottom: 3 },
3315
3427
  tooltipRow: { flexDirection: "row", alignItems: "center", gap: 6 },
@@ -3319,8 +3431,8 @@ var styles11 = StyleSheet11.create({
3319
3431
  });
3320
3432
 
3321
3433
  // src/ui/panels/XYChartPanel.tsx
3322
- import { useId as useId2, useMemo as useMemo7, useState as useState9 } from "react";
3323
- import { StyleSheet as StyleSheet12, View as View11 } from "react-native";
3434
+ import { useId as useId2, useMemo as useMemo8, useState as useState9 } from "react";
3435
+ import { StyleSheet as StyleSheet13, View as View12 } from "react-native";
3324
3436
  import Svg9, { Circle as Circle2, G as G2, Line as Line2, Path as Path9, Text as SvgText4 } from "react-native-svg";
3325
3437
 
3326
3438
  // src/ui/xychart.ts
@@ -3452,7 +3564,7 @@ function xyDomain(values, config) {
3452
3564
  }
3453
3565
 
3454
3566
  // src/ui/panels/XYChartPanel.tsx
3455
- import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
3567
+ import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
3456
3568
  var AXIS = { left: 44, bottom: 20 };
3457
3569
  var EDGE = 8;
3458
3570
  var HIT_PX2 = 32;
@@ -3464,7 +3576,7 @@ function XYChartPanel({ panel, frames }) {
3464
3576
  const id = useId2();
3465
3577
  const { pinned, setPinned } = useDashboard();
3466
3578
  const { resolve, openLinks } = usePanelLinks(panel);
3467
- const series = useMemo7(() => xySeries(panel, frames, theme.scheme), [panel, frames, theme.scheme]);
3579
+ const series = useMemo8(() => xySeries(panel, frames, theme.scheme), [panel, frames, theme.scheme]);
3468
3580
  const first = series[0];
3469
3581
  const showX = first?.xConfig.custom?.axisPlacement !== "hidden";
3470
3582
  const showY = first?.yConfig.custom?.axisPlacement !== "hidden";
@@ -3478,7 +3590,7 @@ function XYChartPanel({ panel, frames }) {
3478
3590
  };
3479
3591
  const plotW = Math.max(0, size.width - pad.left - pad.right);
3480
3592
  const plotH = Math.max(0, size.height - pad.top - pad.bottom);
3481
- const layout = useMemo7(() => {
3593
+ const layout = useMemo8(() => {
3482
3594
  if (!first) return null;
3483
3595
  const [x0, x1] = xyDomain(series.map((s) => s.xs), first.xConfig);
3484
3596
  const [y0, y1] = xyDomain(series.map((s) => s.ys), first.yConfig);
@@ -3487,7 +3599,7 @@ function XYChartPanel({ panel, frames }) {
3487
3599
  const points = series.map((s) => ({ px: s.xs.map(x), py: s.ys.map(y) }));
3488
3600
  return { x, y, x0, x1, y0, y1, points, paths: series.map((s, i) => drawSeries(s, points[i].px, points[i].py)) };
3489
3601
  }, [series, first, pad.left, pad.top, plotW, plotH]);
3490
- if (!first || !layout || series.every((s) => !s.rows.length)) return /* @__PURE__ */ jsx14(NoData, {});
3602
+ if (!first || !layout || series.every((s) => !s.rows.length)) return /* @__PURE__ */ jsx15(NoData, {});
3491
3603
  const xTicks = showX ? axisTicks(layout.x0, layout.x1, plotW < 220 ? 2 : plotW < 400 ? 3 : 5) : [];
3492
3604
  const yTicks = showY ? axisTicks(layout.y0, layout.y1, plotH < 100 ? 2 : 4) : [];
3493
3605
  const gridX = first.xConfig.custom?.axisGridShow !== false;
@@ -3496,11 +3608,11 @@ function XYChartPanel({ panel, frames }) {
3496
3608
  const hoverLinks = hover ? rowLinks(panel, hover.series.frame, hover.series.rows[hover.index], frames.length > 1, resolve) : [];
3497
3609
  const isPinned = !!hover && pinned === id;
3498
3610
  const legendItems = series.filter((s) => !s.yConfig.custom?.hideFrom?.legend);
3499
- return /* @__PURE__ */ jsxs12(View11, { style: styles12.fill, children: [
3500
- /* @__PURE__ */ jsxs12(
3501
- View11,
3611
+ return /* @__PURE__ */ jsxs13(View12, { style: styles13.fill, children: [
3612
+ /* @__PURE__ */ jsxs13(
3613
+ View12,
3502
3614
  {
3503
- style: styles12.fill,
3615
+ style: styles13.fill,
3504
3616
  onLayout,
3505
3617
  onStartShouldSetResponder: () => true,
3506
3618
  onResponderGrant: (e) => {
@@ -3519,14 +3631,14 @@ function XYChartPanel({ panel, frames }) {
3519
3631
  setTouch(null);
3520
3632
  },
3521
3633
  children: [
3522
- size.width > 0 && /* @__PURE__ */ jsxs12(Svg9, { width: size.width, height: size.height, children: [
3523
- yTicks.map((t) => /* @__PURE__ */ jsxs12(G2, { children: [
3524
- gridY && /* @__PURE__ */ jsx14(Line2, { x1: pad.left, x2: pad.left + plotW, y1: layout.y(t), y2: layout.y(t), stroke: theme.grid, strokeWidth: 1 }),
3525
- /* @__PURE__ */ jsx14(SvgText4, { x: pad.left - 6, y: layout.y(t) + 3, fontSize: 10, fill: theme.textMuted, textAnchor: "end", children: formatValue(t, { ...first.yConfig, decimals: first.yConfig.decimals ?? tickDecimals(yTicks) }) })
3634
+ size.width > 0 && /* @__PURE__ */ jsxs13(Svg9, { width: size.width, height: size.height, children: [
3635
+ yTicks.map((t) => /* @__PURE__ */ jsxs13(G2, { children: [
3636
+ gridY && /* @__PURE__ */ jsx15(Line2, { x1: pad.left, x2: pad.left + plotW, y1: layout.y(t), y2: layout.y(t), stroke: theme.grid, strokeWidth: 1 }),
3637
+ /* @__PURE__ */ jsx15(SvgText4, { x: pad.left - 6, y: layout.y(t) + 3, fontSize: 10, fill: theme.textMuted, textAnchor: "end", children: formatValue(t, { ...first.yConfig, decimals: first.yConfig.decimals ?? tickDecimals(yTicks) }) })
3526
3638
  ] }, `y${t}`)),
3527
- xTicks.map((t) => /* @__PURE__ */ jsxs12(G2, { children: [
3528
- gridX && /* @__PURE__ */ jsx14(Line2, { x1: layout.x(t), x2: layout.x(t), y1: pad.top, y2: pad.top + plotH, stroke: theme.grid, strokeWidth: 1 }),
3529
- /* @__PURE__ */ jsx14(
3639
+ xTicks.map((t) => /* @__PURE__ */ jsxs13(G2, { children: [
3640
+ gridX && /* @__PURE__ */ jsx15(Line2, { x1: layout.x(t), x2: layout.x(t), y1: pad.top, y2: pad.top + plotH, stroke: theme.grid, strokeWidth: 1 }),
3641
+ /* @__PURE__ */ jsx15(
3530
3642
  SvgText4,
3531
3643
  {
3532
3644
  x: layout.x(t),
@@ -3538,12 +3650,12 @@ function XYChartPanel({ panel, frames }) {
3538
3650
  }
3539
3651
  )
3540
3652
  ] }, `x${t}`)),
3541
- /* @__PURE__ */ jsx14(AxisTitles, { x: xTitle, y: yTitle, plot: { left: pad.left, top: pad.top, width: plotW, height: plotH }, height: size.height }),
3542
- series.map((s, si) => /* @__PURE__ */ jsxs12(G2, { children: [
3543
- layout.paths[si].line && /* @__PURE__ */ jsx14(Path9, { d: layout.paths[si].line, stroke: s.color, strokeWidth: s.lineWidth, fill: "none", strokeLinejoin: "round" }),
3544
- layout.paths[si].dots.map(([color, d]) => /* @__PURE__ */ jsx14(Path9, { d, fill: color }, color))
3653
+ /* @__PURE__ */ jsx15(AxisTitles, { x: xTitle, y: yTitle, plot: { left: pad.left, top: pad.top, width: plotW, height: plotH }, height: size.height }),
3654
+ series.map((s, si) => /* @__PURE__ */ jsxs13(G2, { children: [
3655
+ layout.paths[si].line && /* @__PURE__ */ jsx15(Path9, { d: layout.paths[si].line, stroke: s.color, strokeWidth: s.lineWidth, fill: "none", strokeLinejoin: "round" }),
3656
+ layout.paths[si].dots.map(([color, d]) => /* @__PURE__ */ jsx15(Path9, { d, fill: color }, color))
3545
3657
  ] }, s.key)),
3546
- hover && /* @__PURE__ */ jsx14(
3658
+ hover && /* @__PURE__ */ jsx15(
3547
3659
  Circle2,
3548
3660
  {
3549
3661
  cx: hover.px,
@@ -3555,7 +3667,7 @@ function XYChartPanel({ panel, frames }) {
3555
3667
  }
3556
3668
  )
3557
3669
  ] }),
3558
- hover && /* @__PURE__ */ jsx14(
3670
+ hover && /* @__PURE__ */ jsx15(
3559
3671
  RowTooltip,
3560
3672
  {
3561
3673
  at: { x: hover.px, y: hover.py },
@@ -3570,7 +3682,7 @@ function XYChartPanel({ panel, frames }) {
3570
3682
  ]
3571
3683
  }
3572
3684
  ),
3573
- showLegend(panel, legendItems.length) && /* @__PURE__ */ jsx14(Legend, { items: legendItems })
3685
+ showLegend(panel, legendItems.length) && /* @__PURE__ */ jsx15(Legend, { items: legendItems })
3574
3686
  ] });
3575
3687
  }
3576
3688
  function drawSeries(s, px, py) {
@@ -3604,7 +3716,7 @@ function nearestPoint(series, points, at) {
3604
3716
  });
3605
3717
  return best;
3606
3718
  }
3607
- var styles12 = StyleSheet12.create({
3719
+ var styles13 = StyleSheet13.create({
3608
3720
  fill: { flex: 1 }
3609
3721
  });
3610
3722
 
@@ -3632,7 +3744,7 @@ function panelComponent(type) {
3632
3744
  }
3633
3745
 
3634
3746
  // src/ui/DashboardView.tsx
3635
- import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
3747
+ import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
3636
3748
  var GAP = 8;
3637
3749
  var SIDE = 12;
3638
3750
  var TITLE_H = 28;
@@ -3646,7 +3758,7 @@ function DashboardView({ mode = "auto", header, footer, refreshable }) {
3646
3758
  const insets = useSafeAreaInsets4();
3647
3759
  const width = (measured.width || window.width) - insets.left - insets.right;
3648
3760
  const layoutMode = mode === "auto" ? width >= TABLET_WIDTH ? "grid" : "phone" : mode;
3649
- const sections = useMemo8(
3761
+ const sections = useMemo9(
3650
3762
  () => layoutDashboard(dashboard, layoutMode, { values: variables, info: variableInfo2 }),
3651
3763
  [dashboard, layoutMode, variables, variableInfo2]
3652
3764
  );
@@ -3655,39 +3767,39 @@ function DashboardView({ mode = "auto", header, footer, refreshable }) {
3655
3767
  const maxPanelH = Math.max(MIN_PANEL_H, viewportH - SIDE * 2);
3656
3768
  const contentW = width - SIDE * 2;
3657
3769
  const canRefresh = refreshable ?? dashboard.panels.some((p) => panelHasQueries(p) || p.panels?.some(panelHasQueries));
3658
- return /* @__PURE__ */ jsxs13(View12, { style: [styles13.fill, { backgroundColor: theme.background }], onLayout, children: [
3659
- width > 0 && /* @__PURE__ */ jsxs13(
3660
- ScrollView5,
3770
+ return /* @__PURE__ */ jsxs14(View13, { style: [styles14.fill, { backgroundColor: theme.background }], onLayout, children: [
3771
+ width > 0 && /* @__PURE__ */ jsxs14(
3772
+ ScrollView6,
3661
3773
  {
3662
3774
  onScroll,
3663
3775
  onScrollBeginDrag: () => setPinned(null),
3664
3776
  onLayout: onViewportLayout,
3665
3777
  scrollEventThrottle: 100,
3666
- contentContainerStyle: [styles13.content, { paddingLeft: SIDE + insets.left, paddingRight: SIDE + insets.right }],
3778
+ contentContainerStyle: [styles14.content, { paddingLeft: SIDE + insets.left, paddingRight: SIDE + insets.right }],
3667
3779
  keyboardShouldPersistTaps: "handled",
3668
- refreshControl: canRefresh ? /* @__PURE__ */ jsx15(RefreshControl, { refreshing: false, onRefresh: refresh }) : void 0,
3780
+ refreshControl: canRefresh ? /* @__PURE__ */ jsx16(RefreshControl, { refreshing: false, onRefresh: refresh }) : void 0,
3669
3781
  children: [
3670
3782
  header,
3671
3783
  sections.map((section) => {
3672
3784
  const collapsed = toggled[section.key] ?? section.collapsed;
3673
- return /* @__PURE__ */ jsxs13(View12, { style: styles13.section, onLayout: (e) => onSectionLayout(section.key, e), children: [
3674
- section.row && /* @__PURE__ */ jsxs13(
3675
- Pressable11,
3785
+ return /* @__PURE__ */ jsxs14(View13, { style: styles14.section, onLayout: (e) => onSectionLayout(section.key, e), children: [
3786
+ section.row && /* @__PURE__ */ jsxs14(
3787
+ Pressable12,
3676
3788
  {
3677
3789
  onPress: () => setToggled((t) => ({ ...t, [section.key]: !collapsed })),
3678
- style: styles13.rowHeader,
3790
+ style: styles14.rowHeader,
3679
3791
  accessibilityRole: "button",
3680
3792
  accessibilityState: { expanded: !collapsed },
3681
3793
  children: [
3682
- /* @__PURE__ */ jsx15(Text12, { style: [styles13.chevron, { color: theme.textMuted }], children: collapsed ? "\u25B8" : "\u25BE" }),
3683
- /* @__PURE__ */ jsx15(Text12, { style: [styles13.rowTitle, { color: theme.text }], numberOfLines: 2, children: interpolate(section.row.title ?? "", { values: variables, info: variableInfo2, scoped: section.row.scopedVars, timezone: dashboard.timezone }) })
3794
+ /* @__PURE__ */ jsx16(Text13, { style: [styles14.chevron, { color: theme.textMuted }], children: collapsed ? "\u25B8" : "\u25BE" }),
3795
+ /* @__PURE__ */ jsx16(Text13, { style: [styles14.rowTitle, { color: theme.text }], numberOfLines: 2, children: interpolate(section.row.title ?? "", { values: variables, info: variableInfo2, scoped: section.row.scopedVars, timezone: dashboard.timezone }) })
3684
3796
  ]
3685
3797
  }
3686
3798
  ),
3687
- !collapsed && layoutMode === "grid" && /* @__PURE__ */ jsx15(GridSection, { grid: section.grid, width: contentW, maxPanelH, deferred: !seen.has(section.key) }),
3688
- !collapsed && layoutMode === "phone" && section.rows.map((row, ri) => /* @__PURE__ */ jsx15(View12, { style: styles13.row, children: row.cells.map((cell) => {
3799
+ !collapsed && layoutMode === "grid" && /* @__PURE__ */ jsx16(GridSection, { grid: section.grid, width: contentW, maxPanelH, deferred: !seen.has(section.key) }),
3800
+ !collapsed && layoutMode === "phone" && section.rows.map((row, ri) => /* @__PURE__ */ jsx16(View13, { style: styles14.row, children: row.cells.map((cell) => {
3689
3801
  const w = (contentW + GAP) * (cell.span / GRID_COLUMNS) - GAP;
3690
- return /* @__PURE__ */ jsx15(PanelCard, { panel: cell.panel, width: w, height: Math.min(gridUnitsToPx(row.h), maxPanelH), deferred: !seen.has(section.key) }, cell.key);
3802
+ return /* @__PURE__ */ jsx16(PanelCard, { panel: cell.panel, width: w, height: Math.min(gridUnitsToPx(row.h), maxPanelH), deferred: !seen.has(section.key) }, cell.key);
3691
3803
  }) }, ri))
3692
3804
  ] }, section.key);
3693
3805
  })
@@ -3701,7 +3813,7 @@ function GridSection({ grid, width, maxPanelH, deferred }) {
3701
3813
  const colW = (width + GAP) / GRID_COLUMNS;
3702
3814
  const tallest = Math.max(0, ...grid.cells.map((c) => gridUnitsToPx(c.h)));
3703
3815
  const scale = tallest > maxPanelH ? maxPanelH / tallest : 1;
3704
- return /* @__PURE__ */ jsx15(View12, { style: { height: gridUnitsToPx(grid.h) * scale }, children: grid.cells.map((cell) => /* @__PURE__ */ jsx15(View12, { style: [styles13.gridCell, { left: cell.x * colW, top: gridOffsetPx(cell.y) * scale }], children: /* @__PURE__ */ jsx15(PanelCard, { panel: cell.panel, width: cell.w * colW - GAP, height: gridUnitsToPx(cell.h) * scale, deferred }) }, cell.key)) });
3816
+ return /* @__PURE__ */ jsx16(View13, { style: { height: gridUnitsToPx(grid.h) * scale }, children: grid.cells.map((cell) => /* @__PURE__ */ jsx16(View13, { style: [styles14.gridCell, { left: cell.x * colW, top: gridOffsetPx(cell.y) * scale }], children: /* @__PURE__ */ jsx16(PanelCard, { panel: cell.panel, width: cell.w * colW - GAP, height: gridUnitsToPx(cell.h) * scale, deferred }) }, cell.key)) });
3705
3817
  }
3706
3818
  function useSeenSections(viewportHeight) {
3707
3819
  const [seen, setSeen] = useState10(/* @__PURE__ */ new Set());
@@ -3746,43 +3858,44 @@ function useSeenSections(viewportHeight) {
3746
3858
  }
3747
3859
  function PanelCard(props) {
3748
3860
  const { panel, width, height } = props;
3749
- return /* @__PURE__ */ jsx15(RenderBoundary, { resetKeys: [panel, width, height], fallback: (error) => /* @__PURE__ */ jsx15(PanelError, { panel, width, height, error }), children: /* @__PURE__ */ jsx15(PanelCardContent, { ...props }) });
3861
+ return /* @__PURE__ */ jsx16(RenderBoundary, { resetKeys: [panel, width, height], fallback: (error) => /* @__PURE__ */ jsx16(PanelError, { panel, width, height, error }), children: /* @__PURE__ */ jsx16(PanelCardContent, { ...props }) });
3750
3862
  }
3751
3863
  function PanelError({ panel, width, height, error }) {
3752
3864
  const theme = useDashTheme();
3753
- return /* @__PURE__ */ jsxs13(View12, { style: [styles13.card, { width, height, backgroundColor: theme.surface, borderColor: theme.danger }], accessibilityRole: "alert", children: [
3754
- !!panel.title && /* @__PURE__ */ jsx15(Text12, { style: [styles13.title, styles13.errorTitle, { color: theme.text }], numberOfLines: 1, children: panel.title }),
3755
- /* @__PURE__ */ jsx15(Text12, { style: [styles13.errorText, { color: theme.danger }], children: "This panel couldn\u2019t be shown." }),
3756
- /* @__PURE__ */ jsx15(Text12, { style: [styles13.errorText, { color: theme.textMuted }], numberOfLines: 3, children: error.message })
3865
+ return /* @__PURE__ */ jsxs14(View13, { style: [styles14.card, { width, height, backgroundColor: theme.surface, borderColor: theme.danger }], accessibilityRole: "alert", children: [
3866
+ !!panel.title && /* @__PURE__ */ jsx16(Text13, { style: [styles14.title, styles14.errorTitle, { color: theme.text }], numberOfLines: 1, children: panel.title }),
3867
+ /* @__PURE__ */ jsx16(Text13, { style: [styles14.errorText, { color: theme.danger }], children: "This panel couldn\u2019t be shown." }),
3868
+ /* @__PURE__ */ jsx16(Text13, { style: [styles14.errorText, { color: theme.textMuted }], numberOfLines: 3, children: error.message })
3757
3869
  ] });
3758
3870
  }
3759
3871
  function PanelCardContent({ panel, width, height, deferred }) {
3760
3872
  const theme = useDashTheme();
3761
3873
  const { dashboard, variables, variableInfo: variableInfo2 } = useDashboard();
3762
3874
  const { resolve, openLinks } = usePanelLinks(panel);
3763
- const input = isInputPanel(panel);
3875
+ const group = isInputGroup(panel);
3876
+ const input = isInputPanel(panel) || group;
3764
3877
  const form = useContext4(InputFormContext);
3765
- const problem = input ? form?.problem?.(panel.options.metric) : void 0;
3878
+ const problem = group ? form?.group?.(panel)?.problem : isInputPanel(panel) ? form?.problem?.(panel.options.metric) : void 0;
3766
3879
  const hasLinks = !!panel.links?.length;
3767
3880
  const hasTitle = !!panel.title || hasLinks || !!problem;
3768
3881
  const title = panel.title ? interpolate(panel.title, { values: variables, info: variableInfo2, scoped: panel.scopedVars, timezone: dashboard.timezone }) : "";
3769
- return /* @__PURE__ */ jsxs13(View12, { style: [styles13.card, { width, height, backgroundColor: theme.surface, borderColor: theme.border }], children: [
3770
- hasTitle && /* @__PURE__ */ jsxs13(View12, { style: styles13.titleRow, children: [
3771
- /* @__PURE__ */ jsx15(Text12, { style: [styles13.title, { color: theme.text }], numberOfLines: 1, children: title }),
3772
- !!problem && /* @__PURE__ */ jsx15(Text12, { style: [styles13.problem, { color: theme.danger }], numberOfLines: 1, accessibilityRole: "alert", children: problem }),
3773
- hasLinks && /* @__PURE__ */ jsx15(
3774
- Pressable11,
3882
+ return /* @__PURE__ */ jsxs14(View13, { style: [styles14.card, { width, height, backgroundColor: theme.surface, borderColor: theme.border }], children: [
3883
+ hasTitle && /* @__PURE__ */ jsxs14(View13, { style: styles14.titleRow, children: [
3884
+ /* @__PURE__ */ jsx16(Text13, { style: [styles14.title, { color: theme.text }], numberOfLines: 1, children: title }),
3885
+ !!problem && /* @__PURE__ */ jsx16(Text13, { style: [styles14.problem, { color: theme.danger }], numberOfLines: 1, accessibilityRole: "alert", children: problem }),
3886
+ hasLinks && /* @__PURE__ */ jsx16(
3887
+ Pressable12,
3775
3888
  {
3776
3889
  onPress: () => openLinks(resolve(panel.links), title || void 0),
3777
3890
  accessibilityRole: "button",
3778
3891
  accessibilityLabel: panel.links.length === 1 ? panel.links[0].title || "Open link" : "Panel links",
3779
3892
  hitSlop: 10,
3780
- style: ({ pressed }) => [styles13.titleLink, pressed && { opacity: 0.6 }],
3781
- children: /* @__PURE__ */ jsx15(LinkIcon, { color: theme.textMuted })
3893
+ style: ({ pressed }) => [styles14.titleLink, pressed && { opacity: 0.6 }],
3894
+ children: /* @__PURE__ */ jsx16(LinkIcon, { color: theme.textMuted })
3782
3895
  }
3783
3896
  )
3784
3897
  ] }),
3785
- /* @__PURE__ */ jsx15(View12, { style: styles13.body, children: deferred && !input ? null : input ? /* @__PURE__ */ jsx15(InputPanelBody, { panel }) : /* @__PURE__ */ jsx15(DataPanelBody, { panel, width: width - 24, height: height - (hasTitle ? TITLE_H : 0) - 16 }) })
3898
+ /* @__PURE__ */ jsx16(View13, { style: styles14.body, children: deferred && !input ? null : input ? group ? /* @__PURE__ */ jsx16(InputGroupBody, { panel }) : /* @__PURE__ */ jsx16(InputPanelBody, { panel }) : /* @__PURE__ */ jsx16(DataPanelBody, { panel, width: width - 24, height: height - (hasTitle ? TITLE_H : 0) - 16 }) })
3786
3899
  ] });
3787
3900
  }
3788
3901
  function DataPanelBody({ panel, width, height }) {
@@ -3791,14 +3904,14 @@ function DataPanelBody({ panel, width, height }) {
3791
3904
  const data = usePanelData(panel, width, needsData);
3792
3905
  const Component2 = panelComponent(panel.type);
3793
3906
  if (needsData && data.error) {
3794
- return /* @__PURE__ */ jsx15(View12, { style: styles13.center, children: /* @__PURE__ */ jsx15(Text12, { style: [styles13.error, { color: theme.danger }], numberOfLines: 4, children: data.error }) });
3907
+ return /* @__PURE__ */ jsx16(View13, { style: styles14.center, children: /* @__PURE__ */ jsx16(Text13, { style: [styles14.error, { color: theme.danger }], numberOfLines: 4, children: data.error }) });
3795
3908
  }
3796
3909
  if (needsData && data.loading && !data.frames.length) {
3797
- return /* @__PURE__ */ jsx15(View12, { style: styles13.center, children: /* @__PURE__ */ jsx15(ActivityIndicator, { color: theme.textMuted }) });
3910
+ return /* @__PURE__ */ jsx16(View13, { style: styles14.center, children: /* @__PURE__ */ jsx16(ActivityIndicator, { color: theme.textMuted }) });
3798
3911
  }
3799
- return /* @__PURE__ */ jsx15(Component2, { panel, frames: data.frames, width, height });
3912
+ return /* @__PURE__ */ jsx16(Component2, { panel, frames: data.frames, width, height });
3800
3913
  }
3801
- var styles13 = StyleSheet13.create({
3914
+ var styles14 = StyleSheet14.create({
3802
3915
  fill: { flex: 1 },
3803
3916
  content: { padding: SIDE, paddingBottom: 32, gap: GAP },
3804
3917
  section: { gap: GAP },
@@ -3807,7 +3920,7 @@ var styles13 = StyleSheet13.create({
3807
3920
  rowTitle: { fontSize: 15, fontWeight: "600" },
3808
3921
  row: { flexDirection: "row", gap: GAP },
3809
3922
  gridCell: { position: "absolute" },
3810
- card: { borderRadius: 10, borderWidth: StyleSheet13.hairlineWidth, paddingHorizontal: 12, paddingVertical: 8, overflow: "hidden" },
3923
+ card: { borderRadius: 10, borderWidth: StyleSheet14.hairlineWidth, paddingHorizontal: 12, paddingVertical: 8, overflow: "hidden" },
3811
3924
  titleRow: { flexDirection: "row", alignItems: "flex-start", gap: 8, height: TITLE_H - 8, marginBottom: 8 },
3812
3925
  title: { flex: 1, fontSize: 13, fontWeight: "600" },
3813
3926
  titleLink: { paddingTop: 1 },
@@ -3820,9 +3933,9 @@ var styles13 = StyleSheet13.create({
3820
3933
  });
3821
3934
 
3822
3935
  // src/ui/inputs/InputForm.tsx
3823
- import { useCallback as useCallback4, useEffect as useEffect4, useMemo as useMemo9, useState as useState11 } from "react";
3824
- import { Pressable as Pressable12, StyleSheet as StyleSheet14, Text as Text13, View as View13 } from "react-native";
3825
- import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
3936
+ import { useCallback as useCallback4, useEffect as useEffect4, useMemo as useMemo10, useState as useState11 } from "react";
3937
+ import { Pressable as Pressable13, StyleSheet as StyleSheet15, Text as Text14, View as View14 } from "react-native";
3938
+ import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
3826
3939
  var NO_CHOICES = {};
3827
3940
  var NO_DEFAULTS = {};
3828
3941
  function savedValues(panels, entries) {
@@ -3833,12 +3946,36 @@ function savedValues(panels, entries) {
3833
3946
  }
3834
3947
  return values;
3835
3948
  }
3949
+ async function lastItems(store, group) {
3950
+ const metrics = groupFields(group).map((f) => f.options.metric);
3951
+ const latest = (await Promise.all(metrics.map((m) => store.latest(m)))).filter((e) => !!e).sort((a, b) => b.ts - a.ts)[0];
3952
+ if (!latest) return [];
3953
+ return entriesToItems(group, sameSave(latest, await store.list({ metrics, from: latest.ts, to: latest.ts })));
3954
+ }
3955
+ function freshItem(group, position, last) {
3956
+ const item = {};
3957
+ for (const f of groupFields(group)) {
3958
+ const d = f.options.default;
3959
+ const v = d === "last" ? last?.[position]?.[f.options.metric] : d;
3960
+ if (v !== void 0 && v !== null) item[f.options.metric] = v;
3961
+ }
3962
+ return item;
3963
+ }
3964
+ function baseItems(group, editing, last) {
3965
+ const start = group.options.start;
3966
+ const values = editing ? entriesToItems(group, editing) : start === "last" && last?.length ? last : Array.from({ length: typeof start === "number" ? Math.max(0, start) : 1 }, (_, i) => freshItem(group, i, last));
3967
+ return values.map((v, i) => ({ key: `b${i}`, values: v, edited: [] }));
3968
+ }
3969
+ var nextItemKey = 1;
3836
3970
  function InputForm({ dashboard, store, onSaved, choices = NO_CHOICES, header, timestamp, defaults: given = NO_DEFAULTS, beforeSave, editing }) {
3837
3971
  const theme = useDashTheme();
3838
- const panels = useMemo9(() => inputPanels(dashboard), [dashboard]);
3839
- const saved = useMemo9(() => editing ? savedValues(panels, editing) : NO_DEFAULTS, [panels, editing]);
3972
+ const panels = useMemo10(() => plainInputPanels(dashboard), [dashboard]);
3973
+ const groups = useMemo10(() => inputGroups(dashboard), [dashboard]);
3974
+ const saved = useMemo10(() => editing ? savedValues(panels, editing) : NO_DEFAULTS, [panels, editing]);
3840
3975
  const [defaults, setDefaults] = useState11({});
3841
3976
  const [edits, setEdits] = useState11({});
3977
+ const [last, setLast] = useState11({});
3978
+ const [groupEdits, setGroupEdits] = useState11({});
3842
3979
  const [offsetMs, setOffsetMs] = useState11(0);
3843
3980
  const [status, setStatus] = useState11(null);
3844
3981
  const [checked, setChecked] = useState11(false);
@@ -3852,7 +3989,15 @@ function InputForm({ dashboard, store, onSaved, choices = NO_CHOICES, header, ti
3852
3989
  if (d === "last") next[p.options.metric] = entryToInputValue(p, await store.latest(p.options.metric));
3853
3990
  else if (d !== void 0) next[p.options.metric] = d;
3854
3991
  }
3855
- if (mine === run) setDefaults(next);
3992
+ const lastNext = {};
3993
+ for (const g of groups) {
3994
+ const wanted = g.options.start === "last" || groupFields(g).some((f) => f.options.default === "last");
3995
+ if (wanted) lastNext[groupKey(g)] = await lastItems(store, g);
3996
+ }
3997
+ if (mine === run) {
3998
+ setDefaults(next);
3999
+ setLast(lastNext);
4000
+ }
3856
4001
  };
3857
4002
  load();
3858
4003
  const unsubscribe = store.subscribe(load);
@@ -3860,8 +4005,10 @@ function InputForm({ dashboard, store, onSaved, choices = NO_CHOICES, header, ti
3860
4005
  run = -1;
3861
4006
  unsubscribe();
3862
4007
  };
3863
- }, [panels, store]);
3864
- const state = useMemo9(() => {
4008
+ }, [panels, groups, store]);
4009
+ const base = useMemo10(() => Object.fromEntries(groups.map((g) => [groupKey(g), baseItems(g, editing, last[groupKey(g)])])), [groups, editing, last]);
4010
+ const itemsOf = useCallback4((g) => groupEdits[groupKey(g)] ?? base[groupKey(g)] ?? [], [groupEdits, base]);
4011
+ const state = useMemo10(() => {
3865
4012
  const value = (m) => m in edits ? edits[m] : m in saved ? saved[m] : m in given ? given[m] : defaults[m] ?? null;
3866
4013
  return {
3867
4014
  value,
@@ -3875,65 +4022,123 @@ function InputForm({ dashboard, store, onSaved, choices = NO_CHOICES, header, ti
3875
4022
  problem: (m) => {
3876
4023
  const p = panels.find((x) => x.options.metric === m);
3877
4024
  return p && (checked || m in edits) ? inputProblem(p, value(m)) : void 0;
3878
- }
4025
+ },
4026
+ group: (g) => groupState(g, itemsOf(g), last[groupKey(g)], checked || groupKey(g) in groupEdits, (update) => {
4027
+ setStatus(null);
4028
+ setGroupEdits((all) => ({ ...all, [groupKey(g)]: update(all[groupKey(g)] ?? base[groupKey(g)] ?? []) }));
4029
+ })
3879
4030
  };
3880
- }, [edits, saved, defaults, given, store, choices, panels, checked]);
3881
- const dirty = Object.keys(edits).length;
4031
+ }, [edits, saved, defaults, given, store, choices, panels, checked, itemsOf, last, groupEdits, base]);
4032
+ const dirty = Object.keys(edits).length + groups.reduce((n, g) => n + groupChanges(base[groupKey(g)] ?? [], groupEdits[groupKey(g)]), 0);
4033
+ const recordedGroups = useCallback4(
4034
+ () => groups.filter((g) => editing || groupKey(g) in groupEdits || groupFields(g).some((f) => f.options.record === "always")),
4035
+ [groups, editing, groupEdits]
4036
+ );
3882
4037
  const save = useCallback4(async () => {
3883
4038
  const problems = panels.flatMap((p) => {
3884
4039
  const problem = inputProblem(p, state.value(p.options.metric));
3885
4040
  return problem ? [`${p.title || p.options.metric}: ${problem.toLowerCase()}`] : [];
3886
4041
  });
4042
+ for (const g of recordedGroups()) problems.push(...groupProblems(g, itemsOf(g).map((i) => i.values)));
3887
4043
  if (problems.length) {
3888
4044
  setChecked(true);
3889
4045
  setStatus(problems.length === 1 ? `Can\u2019t save. ${problems[0]}` : `Can\u2019t save: ${problems.length} fields need fixing`);
3890
4046
  return;
3891
4047
  }
3892
4048
  const ts = editing?.[0]?.ts ?? (header !== void 0 ? timestamp?.() ?? Date.now() : Date.now() + offsetMs);
3893
- const entries = panels.filter((p) => editing || p.options.metric in edits || p.options.record === "always").flatMap((p) => toEntries(p, state.value(p.options.metric), ts));
4049
+ const saveId = editing?.find((e) => e.save)?.save ?? newSaveId();
4050
+ const entries = [
4051
+ ...panels.filter((p) => editing || p.options.metric in edits || p.options.record === "always").flatMap((p) => toEntries(p, state.value(p.options.metric), ts, { save: saveId })),
4052
+ ...recordedGroups().flatMap((g) => groupToEntries(g, itemsOf(g).map((i) => i.values), ts, saveId))
4053
+ ];
3894
4054
  if (!entries.length) return;
3895
4055
  const extra = beforeSave ? await beforeSave(ts) : [];
3896
4056
  if (!extra) return;
3897
4057
  const added = editing ? await replace(store, editing.map((e) => e.id), [...entries, ...extra]) : await store.add([...entries, ...extra]);
3898
4058
  setEdits({});
4059
+ setGroupEdits({});
3899
4060
  setChecked(false);
3900
4061
  setOffsetMs(0);
3901
4062
  setStatus(`Saved ${added.length} ${added.length === 1 ? "value" : "values"}`);
3902
4063
  onSaved?.(added.length, added);
3903
- }, [panels, edits, state, offsetMs, store, onSaved, header, timestamp, beforeSave, editing]);
3904
- return /* @__PURE__ */ jsx16(InputFormContext.Provider, { value: state, children: /* @__PURE__ */ jsx16(DashboardProvider, { dashboard, children: /* @__PURE__ */ jsx16(
4064
+ }, [panels, edits, state, offsetMs, store, onSaved, header, timestamp, beforeSave, editing, recordedGroups, itemsOf]);
4065
+ return /* @__PURE__ */ jsx17(InputFormContext.Provider, { value: state, children: /* @__PURE__ */ jsx17(DashboardProvider, { dashboard, children: /* @__PURE__ */ jsx17(
3905
4066
  DashboardView,
3906
4067
  {
3907
- header: header !== void 0 ? header : /* @__PURE__ */ jsx16(TimestampPicker, { offsetMs, onChange: setOffsetMs }),
3908
- footer: /* @__PURE__ */ jsxs14(View13, { style: [styles14.footer, { backgroundColor: theme.surface, borderTopColor: theme.border }], children: [
3909
- /* @__PURE__ */ jsx16(Text13, { style: [styles14.status, { color: status?.startsWith("Can\u2019t") ? theme.danger : theme.textSecondary }], children: status ?? (dirty ? `${dirty} unsaved ${dirty === 1 ? "change" : "changes"}` : "Nothing to save") }),
3910
- dirty > 0 && /* @__PURE__ */ jsx16(
3911
- Pressable12,
4068
+ header: header !== void 0 ? header : /* @__PURE__ */ jsx17(TimestampPicker, { offsetMs, onChange: setOffsetMs }),
4069
+ footer: /* @__PURE__ */ jsxs15(View14, { style: [styles15.footer, { backgroundColor: theme.surface, borderTopColor: theme.border }], children: [
4070
+ /* @__PURE__ */ jsx17(Text14, { style: [styles15.status, { color: status?.startsWith("Can\u2019t") ? theme.danger : theme.textSecondary }], children: status ?? (dirty ? `${dirty} unsaved ${dirty === 1 ? "change" : "changes"}` : "Nothing to save") }),
4071
+ dirty > 0 && /* @__PURE__ */ jsx17(
4072
+ Pressable13,
3912
4073
  {
3913
4074
  onPress: () => {
3914
4075
  setEdits({});
4076
+ setGroupEdits({});
3915
4077
  setChecked(false);
3916
4078
  setStatus(null);
3917
4079
  },
3918
- style: styles14.secondary,
4080
+ style: styles15.secondary,
3919
4081
  accessibilityRole: "button",
3920
- children: /* @__PURE__ */ jsx16(Text13, { style: { color: theme.textSecondary, fontWeight: "500" }, children: "Discard" })
4082
+ children: /* @__PURE__ */ jsx17(Text14, { style: { color: theme.textSecondary, fontWeight: "500" }, children: "Discard" })
3921
4083
  }
3922
4084
  ),
3923
- /* @__PURE__ */ jsx16(
3924
- Pressable12,
4085
+ /* @__PURE__ */ jsx17(
4086
+ Pressable13,
3925
4087
  {
3926
4088
  onPress: save,
3927
4089
  disabled: !dirty,
3928
4090
  accessibilityRole: "button",
3929
- style: ({ pressed }) => [styles14.save, { backgroundColor: theme.accent, opacity: !dirty ? 0.4 : pressed ? 0.8 : 1 }],
3930
- children: /* @__PURE__ */ jsx16(Text13, { style: styles14.saveText, children: "Save" })
4091
+ style: ({ pressed }) => [styles15.save, { backgroundColor: theme.accent, opacity: !dirty ? 0.4 : pressed ? 0.8 : 1 }],
4092
+ children: /* @__PURE__ */ jsx17(Text14, { style: styles15.saveText, children: "Save" })
3931
4093
  }
3932
4094
  )
3933
4095
  ] })
3934
4096
  }
3935
4097
  ) }) });
3936
4098
  }
4099
+ function groupChanges(base, items) {
4100
+ if (!items) return 0;
4101
+ const baseKeys = new Set(base.map((i) => i.key));
4102
+ const keys = new Set(items.map((i) => i.key));
4103
+ const edited = items.reduce((n, i) => n + (baseKeys.has(i.key) ? i.edited.length : 0), 0);
4104
+ const added = items.filter((i) => !baseKeys.has(i.key)).length;
4105
+ const removed = base.filter((i) => !keys.has(i.key)).length;
4106
+ const moved = edited + added + removed === 0 && items.some((i, n) => base[n]?.key !== i.key) ? 1 : 0;
4107
+ return edited + added + removed + moved;
4108
+ }
4109
+ function groupState(group, items, last, showProblems, update) {
4110
+ const fields = groupFields(group);
4111
+ const { max } = group.options;
4112
+ const fresh = (position) => ({ key: `n${nextItemKey++}`, values: freshItem(group, position, last), edited: [] });
4113
+ const filled = items.filter((i) => !isEmptyItem(group, i.values)).length;
4114
+ const { min } = group.options;
4115
+ return {
4116
+ items: items.map((i) => ({ key: i.key, values: i.values, edited: i.edited })),
4117
+ canAdd: typeof max !== "number" || items.length < max,
4118
+ problem: showProblems && typeof min === "number" && filled < min ? `At least ${min}` : void 0,
4119
+ add: () => update((all) => typeof max === "number" && all.length >= max ? all : [...all, fresh(all.length)]),
4120
+ duplicate: (index) => update(
4121
+ (all) => typeof max === "number" && all.length >= max ? all : [...all.slice(0, index + 1), { key: `n${nextItemKey++}`, values: { ...all[index].values }, edited: Object.keys(all[index].values) }, ...all.slice(index + 1)]
4122
+ ),
4123
+ remove: (index) => update((all) => all.filter((_, i) => i !== index)),
4124
+ move: (index, by) => update((all) => {
4125
+ const to = index + by;
4126
+ if (to < 0 || to >= all.length) return all;
4127
+ const next = [...all];
4128
+ [next[index], next[to]] = [next[to], next[index]];
4129
+ return next;
4130
+ }),
4131
+ setValue: (index, metric, v) => update(
4132
+ (all) => all.map((item, i) => i === index ? { ...item, values: { ...item.values, [metric]: v }, edited: item.edited.includes(metric) ? item.edited : [...item.edited, metric] } : item)
4133
+ ),
4134
+ fieldProblem: (index, metric) => {
4135
+ const item = items[index];
4136
+ const field = fields.find((f) => f.options.metric === metric);
4137
+ if (!item || !field || isEmptyItem(group, item.values)) return void 0;
4138
+ return showProblems || item.edited.includes(metric) ? inputProblem(field, item.values[metric] ?? null) : void 0;
4139
+ }
4140
+ };
4141
+ }
3937
4142
  async function replace(store, ids, entries) {
3938
4143
  if (store.replace) return store.replace(ids, entries);
3939
4144
  for (const id of ids) await store.remove(id);
@@ -3949,26 +4154,26 @@ function TimestampPicker({ offsetMs, onChange }) {
3949
4154
  }, []);
3950
4155
  const when = new Date(now + offsetMs);
3951
4156
  const step = (ms) => () => onChange(Math.min(0, offsetMs + ms));
3952
- return /* @__PURE__ */ jsxs14(View13, { style: [styles14.when, { backgroundColor: theme.surface, borderColor: theme.border }], children: [
3953
- /* @__PURE__ */ jsxs14(View13, { style: { flex: 1 }, children: [
3954
- /* @__PURE__ */ jsx16(Text13, { style: [styles14.whenLabel, { color: theme.textMuted }], children: "Recording for" }),
3955
- /* @__PURE__ */ jsx16(Text13, { style: [styles14.whenValue, { color: theme.text }], children: offsetMs === 0 ? "Now" : when.toLocaleString(void 0, { weekday: "short", month: "short", day: "numeric", hour: "numeric", minute: "2-digit" }) })
4157
+ return /* @__PURE__ */ jsxs15(View14, { style: [styles15.when, { backgroundColor: theme.surface, borderColor: theme.border }], children: [
4158
+ /* @__PURE__ */ jsxs15(View14, { style: { flex: 1 }, children: [
4159
+ /* @__PURE__ */ jsx17(Text14, { style: [styles15.whenLabel, { color: theme.textMuted }], children: "Recording for" }),
4160
+ /* @__PURE__ */ jsx17(Text14, { style: [styles15.whenValue, { color: theme.text }], children: offsetMs === 0 ? "Now" : when.toLocaleString(void 0, { weekday: "short", month: "short", day: "numeric", hour: "numeric", minute: "2-digit" }) })
3956
4161
  ] }),
3957
4162
  [
3958
4163
  ["\u22121d", -24 * HOUR],
3959
4164
  ["\u22121h", -HOUR],
3960
4165
  ["+1h", HOUR]
3961
- ].map(([label, ms]) => /* @__PURE__ */ jsx16(Pressable12, { onPress: step(ms), style: [styles14.stepBtn, { borderColor: theme.border }], accessibilityRole: "button", children: /* @__PURE__ */ jsx16(Text13, { style: { color: theme.text, fontSize: 13 }, children: label }) }, label)),
3962
- offsetMs !== 0 && /* @__PURE__ */ jsx16(Pressable12, { onPress: () => onChange(0), style: [styles14.stepBtn, { borderColor: theme.accent }], accessibilityRole: "button", children: /* @__PURE__ */ jsx16(Text13, { style: { color: theme.accent, fontSize: 13, fontWeight: "600" }, children: "Now" }) })
4166
+ ].map(([label, ms]) => /* @__PURE__ */ jsx17(Pressable13, { onPress: step(ms), style: [styles15.stepBtn, { borderColor: theme.border }], accessibilityRole: "button", children: /* @__PURE__ */ jsx17(Text14, { style: { color: theme.text, fontSize: 13 }, children: label }) }, label)),
4167
+ offsetMs !== 0 && /* @__PURE__ */ jsx17(Pressable13, { onPress: () => onChange(0), style: [styles15.stepBtn, { borderColor: theme.accent }], accessibilityRole: "button", children: /* @__PURE__ */ jsx17(Text14, { style: { color: theme.accent, fontSize: 13, fontWeight: "600" }, children: "Now" }) })
3963
4168
  ] });
3964
4169
  }
3965
- var styles14 = StyleSheet14.create({
3966
- footer: { flexDirection: "row", alignItems: "center", gap: 12, paddingHorizontal: 16, paddingVertical: 10, borderTopWidth: StyleSheet14.hairlineWidth },
4170
+ var styles15 = StyleSheet15.create({
4171
+ footer: { flexDirection: "row", alignItems: "center", gap: 12, paddingHorizontal: 16, paddingVertical: 10, borderTopWidth: StyleSheet15.hairlineWidth },
3967
4172
  status: { flex: 1, fontSize: 13 },
3968
4173
  secondary: { paddingHorizontal: 8, paddingVertical: 10 },
3969
4174
  save: { paddingHorizontal: 22, paddingVertical: 10, borderRadius: 8 },
3970
4175
  saveText: { color: "#fff", fontWeight: "600", fontSize: 15 },
3971
- when: { flexDirection: "row", alignItems: "center", gap: 6, padding: 12, borderRadius: 10, borderWidth: StyleSheet14.hairlineWidth },
4176
+ when: { flexDirection: "row", alignItems: "center", gap: 6, padding: 12, borderRadius: 10, borderWidth: StyleSheet15.hairlineWidth },
3972
4177
  whenLabel: { fontSize: 11 },
3973
4178
  whenValue: { fontSize: 15, fontWeight: "600" },
3974
4179
  stepBtn: { paddingHorizontal: 10, paddingVertical: 6, borderRadius: 6, borderWidth: 1 }
@@ -3990,10 +4195,12 @@ export {
3990
4195
  DashboardView,
3991
4196
  EDITABLE_VARIABLE_TYPES,
3992
4197
  GRID_COLUMNS,
4198
+ GROUP_FIELD_TYPES,
3993
4199
  GrafanaClient,
3994
4200
  GrafanaDataSource,
3995
4201
  GrafanaError,
3996
4202
  HttpConfigFiles,
4203
+ INPUT_GROUP,
3997
4204
  INPUT_OPTION_KEYS,
3998
4205
  INPUT_TYPES,
3999
4206
  InputForm,
@@ -4051,6 +4258,7 @@ export {
4051
4258
  dropTarget,
4052
4259
  duplicatePanel,
4053
4260
  entriesSavedWith,
4261
+ entriesToItems,
4054
4262
  entryToInputValue,
4055
4263
  expandRow,
4056
4264
  fetchBundle,
@@ -4069,8 +4277,13 @@ export {
4069
4277
  getPath,
4070
4278
  gridOffsetPx,
4071
4279
  gridUnitsToPx,
4280
+ groupFields,
4281
+ groupKey,
4282
+ groupProblems,
4283
+ groupToEntries,
4072
4284
  httpFetchJson,
4073
4285
  initialVariableValues,
4286
+ inputGroups,
4074
4287
  inputPanels,
4075
4288
  inputProblem,
4076
4289
  insertPanel,
@@ -4078,6 +4291,9 @@ export {
4078
4291
  interpolateDeep,
4079
4292
  isBundleResponse,
4080
4293
  isEditableVariableType,
4294
+ isEmptyItem,
4295
+ isFormPanelType,
4296
+ isInputGroup,
4081
4297
  isInputPanel,
4082
4298
  isInputType,
4083
4299
  isLocalDatasource,
@@ -4100,6 +4316,7 @@ export {
4100
4316
  movePanel,
4101
4317
  newDocument,
4102
4318
  newPanel,
4319
+ newSaveId,
4103
4320
  newVariable,
4104
4321
  nextPanelId,
4105
4322
  normalizeRef,
@@ -4126,6 +4343,7 @@ export {
4126
4343
  parseTime,
4127
4344
  pasteSnippet,
4128
4345
  placePanel,
4346
+ plainInputPanels,
4129
4347
  pointerToPath,
4130
4348
  prepareDashboard,
4131
4349
  previewPaste,
@@ -4153,6 +4371,7 @@ export {
4153
4371
  resolveVariables,
4154
4372
  revalidateBundle,
4155
4373
  rowsToMappings,
4374
+ sameSave,
4156
4375
  sampleEntries,
4157
4376
  screenDocuments,
4158
4377
  screenOfType,