@modelform/react-native 0.4.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,
@@ -31,12 +33,14 @@ import {
31
33
  SNIPPET_VERSION,
32
34
  SPECIAL_MATCHES,
33
35
  SaveConflictError,
36
+ TEMPLATE_VERSION,
34
37
  TIME_PRESETS,
35
38
  UNIT_CHOICES,
36
39
  addTime,
37
40
  appSchema,
38
41
  applyDashboardLink,
39
42
  applyJsonEdits,
43
+ applyTemplate,
40
44
  applyTransformations,
41
45
  assembleBundle,
42
46
  assembleFromResponse,
@@ -61,6 +65,7 @@ import {
61
65
  dropTarget,
62
66
  duplicatePanel,
63
67
  entriesSavedWith,
68
+ entriesToItems,
64
69
  entryToInputValue,
65
70
  expandRow,
66
71
  fetchBundle,
@@ -79,8 +84,12 @@ import {
79
84
  getPath,
80
85
  gridOffsetPx,
81
86
  gridUnitsToPx,
87
+ groupFields,
88
+ groupProblems,
89
+ groupToEntries,
82
90
  httpFetchJson,
83
91
  initialVariableValues,
92
+ inputGroups,
84
93
  inputPanels,
85
94
  inputProblem,
86
95
  insertPanel,
@@ -88,6 +97,9 @@ import {
88
97
  interpolateDeep,
89
98
  isBundleResponse,
90
99
  isEditableVariableType,
100
+ isEmptyItem,
101
+ isFormPanelType,
102
+ isInputGroup,
91
103
  isInputPanel,
92
104
  isInputType,
93
105
  isLocalDatasource,
@@ -99,6 +111,7 @@ import {
99
111
  lineColumn,
100
112
  loadGazetteer,
101
113
  locate,
114
+ makeTemplate,
102
115
  manifestSchemaIssues,
103
116
  mappedResult,
104
117
  mappingProblem,
@@ -108,6 +121,7 @@ import {
108
121
  movePanel,
109
122
  newDocument,
110
123
  newPanel,
124
+ newSaveId,
111
125
  newVariable,
112
126
  nextPanelId,
113
127
  normalizeRef,
@@ -117,6 +131,7 @@ import {
117
131
  panelEdits,
118
132
  panelHasQueries,
119
133
  panelKey,
134
+ panelMetrics,
120
135
  panelOptions,
121
136
  panelOverrides,
122
137
  panelSize,
@@ -129,9 +144,11 @@ import {
129
144
  parseLocalDateTime,
130
145
  parseRange,
131
146
  parseSnippet,
147
+ parseTemplate,
132
148
  parseTime,
133
149
  pasteSnippet,
134
150
  placePanel,
151
+ plainInputPanels,
135
152
  pointerToPath,
136
153
  prepareDashboard,
137
154
  previewPaste,
@@ -145,6 +162,7 @@ import {
145
162
  removeDocumentFromManifest,
146
163
  removePanel,
147
164
  renameDocumentInManifest,
165
+ renameMetrics,
148
166
  renameVariableInPanels,
149
167
  repack,
150
168
  repeatOptions,
@@ -157,6 +175,7 @@ import {
157
175
  resolveVariables,
158
176
  revalidateBundle,
159
177
  rowsToMappings,
178
+ sameSave,
160
179
  sampleEntries,
161
180
  screenDocuments,
162
181
  screenOfType,
@@ -173,6 +192,7 @@ import {
173
192
  startOf,
174
193
  stringifyCompact,
175
194
  tabIdFor,
195
+ templateNeeds,
176
196
  textSuggestions,
177
197
  thresholdStep,
178
198
  timeExprError,
@@ -200,7 +220,7 @@ import {
200
220
  variableWithType,
201
221
  visibleVariables,
202
222
  zoomRange
203
- } from "./chunk-ATRMUHKJ.mjs";
223
+ } from "./chunk-BW6HKFAB.mjs";
204
224
 
205
225
  // src/ui/theme.tsx
206
226
  import { createContext, useContext } from "react";
@@ -552,15 +572,15 @@ function usePanelLinks(panel) {
552
572
  }
553
573
 
554
574
  // src/ui/DashboardView.tsx
555
- 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";
556
576
  import {
557
577
  ActivityIndicator,
558
- Pressable as Pressable11,
578
+ Pressable as Pressable12,
559
579
  RefreshControl,
560
- ScrollView as ScrollView5,
561
- StyleSheet as StyleSheet13,
562
- Text as Text12,
563
- View as View12,
580
+ ScrollView as ScrollView6,
581
+ StyleSheet as StyleSheet14,
582
+ Text as Text13,
583
+ View as View13,
564
584
  useWindowDimensions
565
585
  } from "react-native";
566
586
  import { useSafeAreaInsets as useSafeAreaInsets4 } from "react-native-safe-area-context";
@@ -586,6 +606,7 @@ var RenderBoundary = class extends Component {
586
606
 
587
607
  // src/ui/inputs/formContext.ts
588
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("|");
589
610
  var InputFormContext = createContext3(null);
590
611
  function useInputForm() {
591
612
  const v = useContext3(InputFormContext);
@@ -593,6 +614,10 @@ function useInputForm() {
593
614
  return v;
594
615
  }
595
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
+
596
621
  // src/ui/inputs/InputPanels.tsx
597
622
  import { useEffect as useEffect2, useState as useState5 } from "react";
598
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";
@@ -1755,22 +1780,116 @@ var styles6 = StyleSheet6.create({
1755
1780
  counterBtnText: { color: "#fff", fontSize: 18, fontWeight: "700" }
1756
1781
  });
1757
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
+
1758
1877
  // src/ui/panels/GaugePanels.tsx
1759
- import { useMemo as useMemo3 } from "react";
1760
- 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";
1761
1880
  import Svg5, { Path as Path5 } from "react-native-svg";
1762
1881
 
1763
1882
  // src/ui/panels/StatPanel.tsx
1764
- import { useMemo as useMemo2 } from "react";
1765
- 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";
1766
1885
  import Svg4, { Path as Path4 } from "react-native-svg";
1767
- import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1886
+ import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
1768
1887
  function StatPanel({ panel, frames }) {
1769
1888
  const theme = useDashTheme();
1770
- const values = useMemo2(() => reducedValues(panel, frames, theme.scheme), [panel, frames, theme.scheme]);
1771
- 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, {});
1772
1891
  const horizontal = panel.options?.orientation === "horizontal";
1773
- 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)) });
1774
1893
  }
1775
1894
  function StatTile({ v, showName, panel }) {
1776
1895
  const theme = useDashTheme();
@@ -1780,25 +1899,25 @@ function StatTile({ v, showName, panel }) {
1780
1899
  const fontSize = Math.max(18, Math.min(56, size.height * (graph ? 0.4 : 0.5), size.width / 4.5));
1781
1900
  const { resolve, openLinks } = usePanelLinks(panel);
1782
1901
  const hasLinks = !!v.config.links?.length;
1783
- return /* @__PURE__ */ jsxs7(
1784
- Pressable6,
1902
+ return /* @__PURE__ */ jsxs8(
1903
+ Pressable7,
1785
1904
  {
1786
1905
  onLayout,
1787
1906
  disabled: !hasLinks,
1788
1907
  onPress: () => openLinks(valueLinks(panel, v, resolve), v.name),
1789
1908
  accessibilityRole: hasLinks ? "link" : void 0,
1790
1909
  style: ({ pressed }) => [
1791
- styles7.tile,
1910
+ styles8.tile,
1792
1911
  // With a sparkline, the number sits in the top half so the line runs beneath it.
1793
1912
  graph && { justifyContent: "flex-start", paddingTop: 4 },
1794
1913
  colorMode === "background" && { backgroundColor: withAlpha(v.stateColor, 0.14) },
1795
1914
  pressed && { opacity: 0.7 }
1796
1915
  ],
1797
1916
  children: [
1798
- colorMode !== "none" && /* @__PURE__ */ jsx9(View6, { style: [styles7.accent, { backgroundColor: v.stateColor }] }),
1799
- graph && size.width > 0 && /* @__PURE__ */ jsx9(Sparkline, { values: v.sparkline, width: size.width, height: size.height * 0.4, color: v.stateColor }),
1800
- showName && /* @__PURE__ */ jsx9(Text7, { style: [styles7.name, { color: theme.textSecondary }], numberOfLines: 1, children: v.name }),
1801
- /* @__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 })
1802
1921
  ]
1803
1922
  }
1804
1923
  );
@@ -1813,16 +1932,16 @@ function Sparkline({ values, width, height, color }) {
1813
1932
  values.forEach((v, i) => {
1814
1933
  if (v != null) line += `${line ? "L" : "M"}${x(i)},${y(v)}`;
1815
1934
  });
1816
- return /* @__PURE__ */ jsxs7(Svg4, { width, height, style: styles7.spark, children: [
1817
- /* @__PURE__ */ jsx9(Path4, { d: `${line}L${width},${height}L0,${height}Z`, fill: color, opacity: 0.1 }),
1818
- /* @__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" })
1819
1938
  ] });
1820
1939
  }
1821
1940
  function withAlpha(hex, alpha) {
1822
1941
  if (!/^#[0-9a-f]{6}$/i.test(hex)) return hex;
1823
1942
  return `${hex}${Math.round(alpha * 255).toString(16).padStart(2, "0")}`;
1824
1943
  }
1825
- var styles7 = StyleSheet7.create({
1944
+ var styles8 = StyleSheet8.create({
1826
1945
  grid: { flex: 1, gap: 8 },
1827
1946
  tile: { flex: 1, justifyContent: "center", paddingLeft: 12, borderRadius: 6, overflow: "hidden" },
1828
1947
  accent: { position: "absolute", left: 0, top: 6, bottom: 6, width: 3, borderRadius: 2 },
@@ -1832,13 +1951,13 @@ var styles7 = StyleSheet7.create({
1832
1951
  });
1833
1952
 
1834
1953
  // src/ui/panels/GaugePanels.tsx
1835
- import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
1954
+ import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
1836
1955
  var SWEEP = 240;
1837
1956
  function GaugePanel({ panel, frames }) {
1838
1957
  const theme = useDashTheme();
1839
- const values = useMemo3(() => reducedValues(panel, frames, theme.scheme), [panel, frames, theme.scheme]);
1840
- if (!values.length) return /* @__PURE__ */ jsx10(NoData, {});
1841
- 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)) });
1842
1961
  }
1843
1962
  function Gauge({ v, showName, panel }) {
1844
1963
  const theme = useDashTheme();
@@ -1853,22 +1972,22 @@ function Gauge({ v, showName, panel }) {
1853
1972
  const r = d / 2 - stroke;
1854
1973
  const cx = size.width / 2;
1855
1974
  const cy = size.height / 2 + d * 0.08;
1856
- return /* @__PURE__ */ jsxs8(
1857
- Pressable7,
1975
+ return /* @__PURE__ */ jsxs9(
1976
+ Pressable8,
1858
1977
  {
1859
- style: ({ pressed }) => [styles8.fill, pressed && { opacity: 0.7 }],
1978
+ style: ({ pressed }) => [styles9.fill, pressed && { opacity: 0.7 }],
1860
1979
  onLayout,
1861
1980
  disabled: !hasLinks,
1862
1981
  onPress: () => openLinks(valueLinks(panel, v, resolve), v.name),
1863
1982
  accessibilityRole: hasLinks ? "link" : void 0,
1864
1983
  children: [
1865
- size.width > 0 && r > 0 && /* @__PURE__ */ jsxs8(Svg5, { width: size.width, height: size.height, children: [
1866
- /* @__PURE__ */ jsx10(Path5, { d: arc(cx, cy, r, 0, 1), stroke: withAlpha(v.stateColor, 0.18), strokeWidth: stroke, fill: "none", strokeLinecap: "round" }),
1867
- 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" })
1868
1987
  ] }),
1869
- /* @__PURE__ */ jsxs8(View7, { style: [StyleSheet8.absoluteFill, styles8.center, { top: d * 0.12 }], pointerEvents: "none", children: [
1870
- /* @__PURE__ */ jsx10(Text8, { style: [styles8.value, { color: theme.text, fontSize: Math.max(14, d * 0.18) }], numberOfLines: 1, adjustsFontSizeToFit: true, children: v.text }),
1871
- 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 })
1872
1991
  ] })
1873
1992
  ]
1874
1993
  }
@@ -1884,35 +2003,35 @@ function arc(cx, cy, r, a, b) {
1884
2003
  }
1885
2004
  function BarGaugePanel({ panel, frames }) {
1886
2005
  const theme = useDashTheme();
1887
- 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]);
1888
2007
  const { resolve, openLinks } = usePanelLinks(panel);
1889
- if (!values.length) return /* @__PURE__ */ jsx10(NoData, {});
1890
- 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) => {
1891
2010
  const min = v.config.min ?? 0;
1892
2011
  const max = v.config.max ?? Math.max(...values.map((o) => o.value ?? 0), 1);
1893
2012
  const frac = v.value == null ? 0 : Math.min(1, Math.max(0, (v.value - min) / (max - min || 1)));
1894
2013
  const color = v.config.thresholds || v.mapped?.color ? v.stateColor : resolveColor(v.config.color?.fixedColor, v.color);
1895
2014
  const hasLinks = !!v.config.links?.length;
1896
- return /* @__PURE__ */ jsxs8(
1897
- Pressable7,
2015
+ return /* @__PURE__ */ jsxs9(
2016
+ Pressable8,
1898
2017
  {
1899
- style: ({ pressed }) => [styles8.barRow, pressed && { opacity: 0.7 }],
2018
+ style: ({ pressed }) => [styles9.barRow, pressed && { opacity: 0.7 }],
1900
2019
  disabled: !hasLinks,
1901
2020
  onPress: () => openLinks(valueLinks(panel, v, resolve), v.name),
1902
2021
  accessibilityRole: hasLinks ? "link" : void 0,
1903
2022
  children: [
1904
- /* @__PURE__ */ jsxs8(View7, { style: styles8.barLabels, children: [
1905
- /* @__PURE__ */ jsx10(Text8, { style: [styles8.name, { color: theme.textSecondary }], numberOfLines: 1, children: v.name }),
1906
- /* @__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 })
1907
2026
  ] }),
1908
- /* @__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 }] }) })
1909
2028
  ]
1910
2029
  },
1911
2030
  v.key
1912
2031
  );
1913
2032
  }) });
1914
2033
  }
1915
- var styles8 = StyleSheet8.create({
2034
+ var styles9 = StyleSheet9.create({
1916
2035
  fill: { flex: 1 },
1917
2036
  row: { flex: 1, flexDirection: "row", gap: 8 },
1918
2037
  center: { alignItems: "center", justifyContent: "center" },
@@ -1927,8 +2046,8 @@ var styles8 = StyleSheet8.create({
1927
2046
  });
1928
2047
 
1929
2048
  // src/ui/panels/GeomapPanel.tsx
1930
- import { useEffect as useEffect3, useMemo as useMemo4, useRef as useRef2, useState as useState6 } from "react";
1931
- 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";
1932
2051
  import Svg6, { Path as Path6, Text as SvgText2 } from "react-native-svg";
1933
2052
 
1934
2053
  // src/ui/geomap.ts
@@ -2345,7 +2464,7 @@ function heatmapCells(px, py, weights, radius, blur, width, height, cell = 4) {
2345
2464
  }
2346
2465
 
2347
2466
  // src/ui/panels/GeomapPanel.tsx
2348
- import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
2467
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
2349
2468
  var HIT_PX = 24;
2350
2469
  var DRAG_PX = 6;
2351
2470
  var MAX_LABELS = 300;
@@ -2354,15 +2473,15 @@ function GeomapPanel({ panel, frames }) {
2354
2473
  const [size, onLayout] = useLayout();
2355
2474
  const retina = PixelRatio.get() > 1;
2356
2475
  const { gazetteers, error } = useGazetteers(panel, frames);
2357
- const layers = useMemo4(() => geomapLayers(panel, frames, theme.scheme, retina, gazetteers), [panel, frames, theme.scheme, retina, gazetteers]);
2358
- 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]);
2359
2478
  const [moved, setMoved] = useState6(null);
2360
2479
  const [picked, setPicked] = useState6(null);
2361
2480
  const links = usePanelLinks(panel);
2362
2481
  const view = moved ?? home;
2363
2482
  const [minZoom, maxZoom] = zoomLimits(panel);
2364
2483
  const zoomTo = (v, zoom) => setMoved({ ...v, zoom: Math.min(maxZoom, Math.max(minZoom, zoom)) });
2365
- const screen = useMemo4(() => {
2484
+ const screen = useMemo5(() => {
2366
2485
  const at = screenProjector(view, size.width, size.height);
2367
2486
  return new Map(
2368
2487
  layers.map((l) => [
@@ -2440,14 +2559,14 @@ function GeomapPanel({ panel, frames }) {
2440
2559
  const attribution = [...new Set(layers.flatMap((l) => l.type === "tiles" && l.source.attribution ? [l.source.attribution] : []))].join(" ");
2441
2560
  const legend = layers.flatMap((l) => l.type === "markers" || l.type === "route" ? l.legend : []);
2442
2561
  const ready = size.width > 0 && size.height > 0;
2443
- return /* @__PURE__ */ jsxs9(View8, { style: styles9.fill, children: [
2444
- /* @__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: [
2445
2564
  ready && // Nothing inside takes touches, so locationX/Y are always relative to the map.
2446
- /* @__PURE__ */ jsxs9(View8, { pointerEvents: "none", style: StyleSheet9.absoluteFill, children: [
2565
+ /* @__PURE__ */ jsxs10(View9, { pointerEvents: "none", style: StyleSheet10.absoluteFill, children: [
2447
2566
  layers.map(
2448
- (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)
2449
2568
  ),
2450
- 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(
2451
2570
  Path6,
2452
2571
  {
2453
2572
  d: symbolPath("circle", shown.px, shown.py, Math.max(shown.layer.type === "markers" ? shown.radius + 2 : 5, 5)),
@@ -2457,7 +2576,7 @@ function GeomapPanel({ panel, frames }) {
2457
2576
  }
2458
2577
  ) })
2459
2578
  ] }),
2460
- shown && /* @__PURE__ */ jsx11(
2579
+ shown && /* @__PURE__ */ jsx12(
2461
2580
  RowTooltip,
2462
2581
  {
2463
2582
  at: { x: shown.px, y: shown.py },
@@ -2469,15 +2588,15 @@ function GeomapPanel({ panel, frames }) {
2469
2588
  onOpenLink: (l) => links.openLinks([l])
2470
2589
  }
2471
2590
  ),
2472
- controls.showZoom !== false && /* @__PURE__ */ jsxs9(View8, { style: styles9.zoom, children: [
2473
- /* @__PURE__ */ jsx11(MapButton, { label: "+", onPress: () => zoomTo(view, Math.round(view.zoom) + 1) }),
2474
- /* @__PURE__ */ jsx11(MapButton, { label: "\u2212", onPress: () => zoomTo(view, Math.round(view.zoom) - 1) }),
2475
- 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) })
2476
2595
  ] }),
2477
- error ? /* @__PURE__ */ jsx11(Text9, { pointerEvents: "none", style: [styles9.error, { color: theme.danger, backgroundColor: theme.surface }], numberOfLines: 2, children: error }) : null,
2478
- 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
2479
2598
  ] }),
2480
- legend.length > 0 && /* @__PURE__ */ jsx11(Legend, { items: legend })
2599
+ legend.length > 0 && /* @__PURE__ */ jsx12(Legend, { items: legend })
2481
2600
  ] });
2482
2601
  }
2483
2602
  var NONE = {};
@@ -2512,13 +2631,13 @@ function useGazetteers(panel, frames) {
2512
2631
  }
2513
2632
  function MapButton({ label, onPress }) {
2514
2633
  const theme = useDashTheme();
2515
- 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 }) });
2516
2635
  }
2517
2636
  function Tiles({ layer, view, width, height }) {
2518
2637
  const tiles = visibleTiles(layer.source, view, width, height);
2519
- 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) => (
2520
2639
  // Half a pixel of overlap hides seams between scaled tiles.
2521
- /* @__PURE__ */ jsx11(
2640
+ /* @__PURE__ */ jsx12(
2522
2641
  Image,
2523
2642
  {
2524
2643
  source: { uri: t.url },
@@ -2530,17 +2649,17 @@ function Tiles({ layer, view, width, height }) {
2530
2649
  )) });
2531
2650
  }
2532
2651
  function DataLayerSvg({ layer, screen, width, height, textColor }) {
2533
- const body = useMemo4(() => {
2652
+ const body = useMemo5(() => {
2534
2653
  if (layer.type === "heatmap") {
2535
2654
  const px = screen.flatMap((s) => s.px);
2536
2655
  const py = screen.flatMap((s) => s.py);
2537
2656
  const weights = layer.points.flatMap((p) => p.sizes);
2538
- 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));
2539
2658
  }
2540
2659
  if (layer.type === "route") return routePaths(layer, screen);
2541
2660
  return markerPaths(layer, screen, width, height, textColor);
2542
2661
  }, [layer, screen, width, height, textColor]);
2543
- 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 });
2544
2663
  }
2545
2664
  function markerPaths(layer, screen, width, height, textColor) {
2546
2665
  const byColor = /* @__PURE__ */ new Map();
@@ -2555,7 +2674,7 @@ function markerPaths(layer, screen, width, height, textColor) {
2555
2674
  const label = p.labels?.[i];
2556
2675
  if (label && labels.length < MAX_LABELS)
2557
2676
  labels.push(
2558
- /* @__PURE__ */ jsx11(
2677
+ /* @__PURE__ */ jsx12(
2559
2678
  SvgText2,
2560
2679
  {
2561
2680
  x: px[i] + layer.labelOffset[0],
@@ -2572,7 +2691,7 @@ function markerPaths(layer, screen, width, height, textColor) {
2572
2691
  });
2573
2692
  const outline = layer.symbol === "cross" || layer.symbol === "x";
2574
2693
  return [
2575
- ...[...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)),
2576
2695
  ...labels
2577
2696
  ];
2578
2697
  }
@@ -2585,7 +2704,7 @@ function routePaths(layer, screen) {
2585
2704
  parts.push(`M${px[i]},${py[i]}L${px[i + 1]},${py[i + 1]}`);
2586
2705
  }
2587
2706
  });
2588
- 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));
2589
2708
  }
2590
2709
  function resolvePicked(layers, screen, picked) {
2591
2710
  const layer = layers.find((l) => l.key === picked.layer);
@@ -2603,7 +2722,7 @@ function resolvePicked(layers, screen, picked) {
2603
2722
  py: s.py[picked.index]
2604
2723
  };
2605
2724
  }
2606
- var styles9 = StyleSheet9.create({
2725
+ var styles10 = StyleSheet10.create({
2607
2726
  fill: { flex: 1 },
2608
2727
  map: { overflow: "hidden", borderRadius: 4 },
2609
2728
  zoom: { position: "absolute", top: 6, left: 6, gap: 4 },
@@ -2611,7 +2730,7 @@ var styles9 = StyleSheet9.create({
2611
2730
  width: 28,
2612
2731
  height: 28,
2613
2732
  borderRadius: 4,
2614
- borderWidth: StyleSheet9.hairlineWidth,
2733
+ borderWidth: StyleSheet10.hairlineWidth,
2615
2734
  alignItems: "center",
2616
2735
  justifyContent: "center"
2617
2736
  },
@@ -2621,8 +2740,8 @@ var styles9 = StyleSheet9.create({
2621
2740
  });
2622
2741
 
2623
2742
  // src/ui/panels/OtherPanels.tsx
2624
- import { useMemo as useMemo5, useState as useState7 } from "react";
2625
- 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";
2626
2745
  import Svg7, { Path as Path7 } from "react-native-svg";
2627
2746
 
2628
2747
  // src/ui/table.ts
@@ -2761,15 +2880,15 @@ function sortedRows(columns, length, sort) {
2761
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;
2762
2881
 
2763
2882
  // src/ui/panels/OtherPanels.tsx
2764
- import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
2883
+ import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
2765
2884
  function PieChartPanel({ panel, frames }) {
2766
2885
  const theme = useDashTheme();
2767
2886
  const [size, onLayout] = useLayout();
2768
- const values = useMemo5(
2887
+ const values = useMemo6(
2769
2888
  () => reducedValues(panel, frames, theme.scheme).filter((v) => (v.value ?? 0) > 0),
2770
2889
  [panel, frames, theme.scheme]
2771
2890
  );
2772
- if (!values.length) return /* @__PURE__ */ jsx12(NoData, {});
2891
+ if (!values.length) return /* @__PURE__ */ jsx13(NoData, {});
2773
2892
  const total = values.reduce((a, v) => a + (v.value ?? 0), 0);
2774
2893
  const r = Math.min(size.width, size.height) / 2 - 2;
2775
2894
  const inner = panel.options?.pieType === "pie" ? 0 : r * 0.62;
@@ -2783,9 +2902,9 @@ function PieChartPanel({ panel, frames }) {
2783
2902
  slices.push({ key: v.key, d: donutSlice(cx, cy, r, inner, angle + gap / 2, angle + sweep - gap / 2), color: v.color });
2784
2903
  angle += sweep;
2785
2904
  }
2786
- return /* @__PURE__ */ jsxs10(View9, { style: styles10.fill, children: [
2787
- /* @__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)) }) }),
2788
- /* @__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(
2789
2908
  Legend,
2790
2909
  {
2791
2910
  items: values.map((v) => ({
@@ -2809,27 +2928,27 @@ function TablePanel({ panel, frames }) {
2809
2928
  const theme = useDashTheme();
2810
2929
  const { resolve, openLinks } = usePanelLinks(panel);
2811
2930
  const frame = frames[0];
2812
- 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]);
2813
2932
  const [tapped, setSort] = useState7();
2814
2933
  const sort = tapped === void 0 ? initialSort(panel, columns) : tapped;
2815
- const order = useMemo5(() => sortedRows(columns, frame ? frameLength(frame) : 0, sort), [columns, frame, sort]);
2816
- 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, {});
2817
2936
  const shown = order.slice(0, 500);
2818
2937
  const rowColumn = columns.find((c) => c.applyToRow);
2819
2938
  const footer = tableFooter(columns);
2820
- return /* @__PURE__ */ jsx12(ScrollView4, { horizontal: true, children: /* @__PURE__ */ jsxs10(View9, { style: styles10.fill, children: [
2821
- /* @__PURE__ */ jsxs10(ScrollView4, { nestedScrollEnabled: true, style: styles10.fill, children: [
2822
- /* @__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) => {
2823
2942
  const active = sort?.key === c.key;
2824
- return /* @__PURE__ */ jsx12(
2825
- Pressable9,
2943
+ return /* @__PURE__ */ jsx13(
2944
+ Pressable10,
2826
2945
  {
2827
2946
  onPress: () => setSort(nextSort(sort, c.key)),
2828
2947
  accessibilityRole: "button",
2829
2948
  accessibilityLabel: `Sort by ${c.name}`,
2830
2949
  accessibilityState: { selected: active },
2831
2950
  style: { width: c.width },
2832
- 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: [
2833
2952
  c.name,
2834
2953
  active ? sort.desc ? " \u2193" : " \u2191" : ""
2835
2954
  ] })
@@ -2839,14 +2958,14 @@ function TablePanel({ panel, frames }) {
2839
2958
  }) }),
2840
2959
  shown.map((i) => {
2841
2960
  const rowBg = rowColumn ? cellDisplay(rowColumn, rowColumn.field.values[i], theme.accent).background : void 0;
2842
- 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) => {
2843
2962
  const d = cellDisplay(c, c.field.values[i], theme.accent);
2844
2963
  const bg = d.background ?? rowBg;
2845
2964
  const linked = !!c.config.links?.length;
2846
2965
  const color = d.color ?? (bg ? contrastText(bg, theme.text) : linked ? theme.accent : theme.text);
2847
- const cellStyle = [styles10.td, { width: c.width }, d.background ? { backgroundColor: d.background } : null];
2848
- return /* @__PURE__ */ jsxs10(
2849
- Pressable9,
2966
+ const cellStyle = [styles11.td, { width: c.width }, d.background ? { backgroundColor: d.background } : null];
2967
+ return /* @__PURE__ */ jsxs11(
2968
+ Pressable10,
2850
2969
  {
2851
2970
  disabled: !linked,
2852
2971
  onPress: () => openLinks(
@@ -2856,8 +2975,8 @@ function TablePanel({ panel, frames }) {
2856
2975
  accessibilityRole: linked ? "link" : void 0,
2857
2976
  style: ({ pressed }) => [cellStyle, pressed && { opacity: 0.6 }],
2858
2977
  children: [
2859
- 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 }] }) }),
2860
- /* @__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 })
2861
2980
  ]
2862
2981
  },
2863
2982
  c.key
@@ -2865,8 +2984,8 @@ function TablePanel({ panel, frames }) {
2865
2984
  }) }, i);
2866
2985
  })
2867
2986
  ] }),
2868
- 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: [
2869
- 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,
2870
2989
  line.text
2871
2990
  ] }, li)) }, c.key)) })
2872
2991
  ] }) });
@@ -2876,24 +2995,24 @@ function TextPanel({ panel }) {
2876
2995
  const raw = panel.options?.content;
2877
2996
  const content = typeof raw === "string" ? raw : "";
2878
2997
  const text = panel.options?.mode === "html" ? content.replace(/<[^>]+>/g, "") : content;
2879
- 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) => {
2880
2999
  const heading = /^#{1,6}\s+/.test(block);
2881
- 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);
2882
3001
  }) });
2883
3002
  }
2884
3003
  function BarChartPanel({ panel, frames, width }) {
2885
3004
  const theme = useDashTheme();
2886
3005
  const [plot, onPlotLayout] = useLayout();
2887
- 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]);
2888
3007
  const frame = frames[0];
2889
3008
  const category = frame && barCategory(panel, frame);
2890
- if (!frame || !values.length) return /* @__PURE__ */ jsx12(NoData, {});
3009
+ if (!frame || !values.length) return /* @__PURE__ */ jsx13(NoData, {});
2891
3010
  const xField = panel.options?.xField;
2892
- 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` });
2893
3012
  const allNumeric = frame.fields.filter((f) => f.type === "number");
2894
3013
  const at = (f) => values[allNumeric.indexOf(f)];
2895
3014
  const numeric = category ? allNumeric.filter((f) => f !== category) : [];
2896
- 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` });
2897
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) }];
2898
3017
  const labels = category ? categoryLabels(category) : values.map((v) => v.name);
2899
3018
  const colorAt = (fi, i) => category ? fields[fi].color : values[i].color;
@@ -2908,34 +3027,34 @@ function BarChartPanel({ panel, frames, width }) {
2908
3027
  const gridAxis = left ?? right;
2909
3028
  const plotW = width - (left ? AXIS_W : 0) - (right ? AXIS_W : 0);
2910
3029
  const every = Math.max(1, Math.ceil(labels.length / Math.max(1, Math.floor(plotW / 44))));
2911
- 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(
2912
- 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,
2913
3032
  {
2914
- 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],
2915
3034
  numberOfLines: 1,
2916
3035
  children: formatValue(t, { ...axis.config, decimals: tickDecimals(axis.ticks) })
2917
3036
  },
2918
3037
  t
2919
3038
  )) });
2920
- return /* @__PURE__ */ jsxs10(View9, { style: styles10.fill, children: [
2921
- (left?.label || right?.label) && /* @__PURE__ */ jsxs10(View9, { style: styles10.axisLabels, children: [
2922
- /* @__PURE__ */ jsx12(Text10, { style: [styles10.axisLabel, { color: theme.textMuted }], children: left?.label ?? "" }),
2923
- /* @__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 ?? "" })
2924
3043
  ] }),
2925
- /* @__PURE__ */ jsxs10(View9, { style: styles10.barRow, children: [
3044
+ /* @__PURE__ */ jsxs11(View10, { style: styles11.barRow, children: [
2926
3045
  left && axisColumn(left),
2927
- /* @__PURE__ */ jsxs10(View9, { style: styles10.fill, onLayout: onPlotLayout, children: [
2928
- 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)),
2929
- /* @__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) => {
2930
3049
  const axis = axisOf(fi);
2931
3050
  const base = barFraction(axis, Math.min(Math.max(0, axis.bottom), axis.top));
2932
3051
  const end = barFraction(axis, f.values[i] ?? 0);
2933
- return /* @__PURE__ */ jsx12(View9, { style: styles10.barSlot, children: /* @__PURE__ */ jsx12(
2934
- View9,
3052
+ return /* @__PURE__ */ jsx13(View10, { style: styles11.barSlot, children: /* @__PURE__ */ jsx13(
3053
+ View10,
2935
3054
  {
2936
3055
  style: [
2937
- styles10.bar,
2938
- end < base && styles10.barDown,
3056
+ styles11.bar,
3057
+ end < base && styles11.barDown,
2939
3058
  { bottom: `${Math.min(base, end) * 100}%`, height: `${Math.abs(end - base) * 100}%`, backgroundColor: colorAt(fi, i) }
2940
3059
  ]
2941
3060
  }
@@ -2944,8 +3063,8 @@ function BarChartPanel({ panel, frames, width }) {
2944
3063
  ] }),
2945
3064
  right && axisColumn(right)
2946
3065
  ] }),
2947
- /* @__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)) }),
2948
- 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 })
2949
3068
  ] });
2950
3069
  }
2951
3070
  var AXIS_W = 40;
@@ -2955,15 +3074,15 @@ function num2(v) {
2955
3074
  return Number.isFinite(n) ? n : null;
2956
3075
  }
2957
3076
  function UnsupportedPanel({ panel }) {
2958
- 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` });
2959
3078
  }
2960
- var styles10 = StyleSheet10.create({
3079
+ var styles11 = StyleSheet11.create({
2961
3080
  fill: { flex: 1 },
2962
- tr: { flexDirection: "row", borderBottomWidth: StyleSheet10.hairlineWidth },
3081
+ tr: { flexDirection: "row", borderBottomWidth: StyleSheet11.hairlineWidth },
2963
3082
  th: { paddingVertical: 6, paddingHorizontal: 6, fontSize: 12, fontWeight: "600" },
2964
3083
  td: { paddingVertical: 6, paddingHorizontal: 6, justifyContent: "center" },
2965
3084
  cellText: { fontSize: 12 },
2966
- footer: { borderBottomWidth: 0, borderTopWidth: StyleSheet10.hairlineWidth },
3085
+ footer: { borderBottomWidth: 0, borderTopWidth: StyleSheet11.hairlineWidth },
2967
3086
  footerText: { fontWeight: "600", fontVariant: ["tabular-nums"] },
2968
3087
  gaugeTrack: { position: "absolute", left: 6, right: 6, bottom: 3, height: 3, borderRadius: 2, overflow: "hidden" },
2969
3088
  gaugeFill: { height: "100%", borderRadius: 2 },
@@ -2979,7 +3098,7 @@ var styles10 = StyleSheet10.create({
2979
3098
  barDown: { borderTopLeftRadius: 0, borderTopRightRadius: 0, borderBottomLeftRadius: 4, borderBottomRightRadius: 4 },
2980
3099
  barLabels: { flexDirection: "row", gap: 2 },
2981
3100
  barLabel: { flex: 1, fontSize: 10, marginTop: 4, textAlign: "center" },
2982
- gridLine: { position: "absolute", left: 0, right: 0, height: StyleSheet10.hairlineWidth },
3101
+ gridLine: { position: "absolute", left: 0, right: 0, height: StyleSheet11.hairlineWidth },
2983
3102
  axis: { width: AXIS_W },
2984
3103
  axisLeft: { paddingRight: 6 },
2985
3104
  axisRight: { paddingLeft: 6 },
@@ -2991,10 +3110,10 @@ var styles10 = StyleSheet10.create({
2991
3110
  });
2992
3111
 
2993
3112
  // src/ui/panels/TimeSeriesPanel.tsx
2994
- import { useId, useMemo as useMemo6, useRef as useRef3, useState as useState8 } from "react";
2995
- 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";
2996
3115
  import Svg8, { Circle, ClipPath, Defs, G, Line, Path as Path8, Rect, Text as SvgText3 } from "react-native-svg";
2997
- import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
3116
+ import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
2998
3117
  var BASE_PAD = { top: 8, right: 8, bottom: 20, left: 44 };
2999
3118
  var BAR_MAX = 24;
3000
3119
  function TimeSeriesPanel({ panel, frames }) {
@@ -3011,11 +3130,11 @@ function TimeSeriesPanel({ panel, frames }) {
3011
3130
  const clipId = `plot${id.replace(/[^a-zA-Z0-9]/g, "")}`;
3012
3131
  const [touching, setTouching] = useState8(false);
3013
3132
  const numericX = panel.type === "trend";
3014
- const { series, xConfig } = useMemo6(
3133
+ const { series, xConfig } = useMemo7(
3015
3134
  () => numericX ? styledXYSeries(panel, frames, theme.scheme) : { series: styledSeries(panel, frames, theme.scheme), xConfig: {} },
3016
3135
  [numericX, panel, frames, theme.scheme]
3017
3136
  );
3018
- 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, {});
3019
3138
  const style = (s) => s.config.custom?.drawStyle ?? (panel.type === "graph" && panel.bars ? "bars" : "line");
3020
3139
  const anyBars = series.some((s) => style(s) === "bars");
3021
3140
  const anyFill = series.some((s) => (s.config.custom?.fillOpacity ?? 0) > 0);
@@ -3074,11 +3193,11 @@ function TimeSeriesPanel({ panel, frames }) {
3074
3193
  )
3075
3194
  ) : [];
3076
3195
  const isPinned = !!hover && pinned === id;
3077
- return /* @__PURE__ */ jsxs11(View10, { style: styles11.fill, children: [
3078
- /* @__PURE__ */ jsx13(
3079
- View10,
3196
+ return /* @__PURE__ */ jsxs12(View11, { style: styles12.fill, children: [
3197
+ /* @__PURE__ */ jsx14(
3198
+ View11,
3080
3199
  {
3081
- style: styles11.fill,
3200
+ style: styles12.fill,
3082
3201
  onStartShouldSetResponderCapture: twoFingers,
3083
3202
  onMoveShouldSetResponderCapture: twoFingers,
3084
3203
  onResponderTerminationRequest: () => false,
@@ -3090,10 +3209,10 @@ function TimeSeriesPanel({ panel, frames }) {
3090
3209
  onResponderMove: onPinchMove,
3091
3210
  onResponderRelease: () => onPinchEnd(true),
3092
3211
  onResponderTerminate: () => onPinchEnd(false),
3093
- children: /* @__PURE__ */ jsxs11(
3094
- View10,
3212
+ children: /* @__PURE__ */ jsxs12(
3213
+ View11,
3095
3214
  {
3096
- style: styles11.fill,
3215
+ style: styles12.fill,
3097
3216
  onLayout,
3098
3217
  onStartShouldSetResponder: () => true,
3099
3218
  onResponderGrant: (e) => {
@@ -3113,12 +3232,12 @@ function TimeSeriesPanel({ panel, frames }) {
3113
3232
  setHoverX(null);
3114
3233
  },
3115
3234
  children: [
3116
- size.width > 0 && /* @__PURE__ */ jsxs11(Svg8, { width: size.width, height: size.height, children: [
3117
- ticks.map((t) => /* @__PURE__ */ jsxs11(G, { children: [
3118
- /* @__PURE__ */ jsx13(Line, { x1: PAD.left, x2: PAD.left + plotW, y1: y(t), y2: y(t), stroke: theme.grid, strokeWidth: 1 }),
3119
- /* @__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) }) })
3120
3239
  ] }, t)),
3121
- xTicks.map((t) => /* @__PURE__ */ jsx13(
3240
+ xTicks.map((t) => /* @__PURE__ */ jsx14(
3122
3241
  SvgText3,
3123
3242
  {
3124
3243
  x: x(t),
@@ -3130,65 +3249,65 @@ function TimeSeriesPanel({ panel, frames }) {
3130
3249
  },
3131
3250
  t
3132
3251
  )),
3133
- /* @__PURE__ */ jsx13(AxisTitles, { x: xTitle, y: yTitle, plot: { left: PAD.left, top: PAD.top, width: plotW, height: plotH }, height: size.height }),
3134
- /* @__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 }) }) }),
3135
- /* @__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: [
3136
3255
  barSeries.map(
3137
3256
  (s, si) => s.times.map((t, i) => {
3138
3257
  const v = s.values[i];
3139
3258
  if (v == null || t < xFrom || t > xTo) return null;
3140
3259
  const left = x(t) - groupW / 2 + si * (groupW / barSeries.length);
3141
- 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}`);
3142
3261
  })
3143
3262
  ),
3144
3263
  series.filter((s) => style(s) !== "bars").map((s) => {
3145
3264
  const fill = (s.config.custom?.fillOpacity ?? 0) / 100;
3146
3265
  const showPoints = style(s) === "points" || s.config.custom?.showPoints === "always" || s.config.custom?.showPoints !== "never" && s.times.length <= plotW / 14;
3147
3266
  const segs = segments(s, x, y, s.config.custom?.lineInterpolation === "stepAfter");
3148
- return /* @__PURE__ */ jsxs11(G, { children: [
3149
- 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}`)),
3150
- 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}`)),
3151
3270
  showPoints && s.times.map(
3152
- (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)
3153
3272
  )
3154
3273
  ] }, s.key);
3155
3274
  }),
3156
- hover && /* @__PURE__ */ jsxs11(G, { children: [
3157
- /* @__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 }),
3158
3277
  hover.rows.map(
3159
- (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)
3160
3279
  )
3161
3280
  ] })
3162
3281
  ] })
3163
3282
  ] }),
3164
- xZoom && !preview && /* @__PURE__ */ jsx13(
3165
- Pressable10,
3283
+ xZoom && !preview && /* @__PURE__ */ jsx14(
3284
+ Pressable11,
3166
3285
  {
3167
3286
  onPress: () => setXZoom(null),
3168
3287
  accessibilityRole: "button",
3169
3288
  hitSlop: 8,
3170
- style: ({ pressed }) => [styles11.reset, { backgroundColor: theme.surface, borderColor: theme.border }, pressed && { opacity: 0.7 }],
3171
- 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" })
3172
3291
  }
3173
3292
  ),
3174
- hover && /* @__PURE__ */ jsxs11(
3175
- View10,
3293
+ hover && /* @__PURE__ */ jsxs12(
3294
+ View11,
3176
3295
  {
3177
3296
  pointerEvents: isPinned ? "auto" : "none",
3178
3297
  onStartShouldSetResponder: () => isPinned,
3179
3298
  style: [
3180
- styles11.tooltip,
3299
+ styles12.tooltip,
3181
3300
  { backgroundColor: theme.surface, borderColor: theme.border },
3182
3301
  x(hover.time) > size.width / 2 ? { right: size.width - x(hover.time) + 8 } : { left: x(hover.time) + 8 }
3183
3302
  ],
3184
3303
  children: [
3185
- /* @__PURE__ */ jsx13(Text11, { style: [styles11.tooltipTime, { color: theme.textMuted }], children: numericX ? formatValue(hover.time, xConfig) : formatTooltipTime(hover.time) }),
3186
- hover.rows.map((r) => /* @__PURE__ */ jsxs11(View10, { style: styles11.tooltipRow, children: [
3187
- /* @__PURE__ */ jsx13(View10, { style: [styles11.swatch, { backgroundColor: r.color }] }),
3188
- /* @__PURE__ */ jsx13(Text11, { style: [styles11.tooltipName, { color: theme.textSecondary }], numberOfLines: 1, children: r.name }),
3189
- /* @__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) })
3190
3309
  ] }, r.key)),
3191
- isPinned && /* @__PURE__ */ jsx13(TooltipLinks, { links: hoverLinks, onOpen: (l) => openLinks([l]) })
3310
+ isPinned && /* @__PURE__ */ jsx14(TooltipLinks, { links: hoverLinks, onOpen: (l) => openLinks([l]) })
3192
3311
  ]
3193
3312
  }
3194
3313
  )
@@ -3197,7 +3316,7 @@ function TimeSeriesPanel({ panel, frames }) {
3197
3316
  )
3198
3317
  }
3199
3318
  ),
3200
- showLegend(panel, series.length) && /* @__PURE__ */ jsx13(Legend, { items: series })
3319
+ showLegend(panel, series.length) && /* @__PURE__ */ jsx14(Legend, { items: series })
3201
3320
  ] });
3202
3321
  }
3203
3322
  function segments(s, x, y, step = false) {
@@ -3286,7 +3405,7 @@ function linkData(r, frames, xField) {
3286
3405
  time: xField === void 0 ? r.time : void 0
3287
3406
  };
3288
3407
  }
3289
- var styles11 = StyleSheet11.create({
3408
+ var styles12 = StyleSheet12.create({
3290
3409
  fill: { flex: 1 },
3291
3410
  tooltip: {
3292
3411
  position: "absolute",
@@ -3294,7 +3413,7 @@ var styles11 = StyleSheet11.create({
3294
3413
  paddingHorizontal: 8,
3295
3414
  paddingVertical: 6,
3296
3415
  borderRadius: 6,
3297
- borderWidth: StyleSheet11.hairlineWidth,
3416
+ borderWidth: StyleSheet12.hairlineWidth,
3298
3417
  maxWidth: 220,
3299
3418
  shadowColor: "#000",
3300
3419
  shadowOpacity: 0.12,
@@ -3302,7 +3421,7 @@ var styles11 = StyleSheet11.create({
3302
3421
  shadowOffset: { width: 0, height: 2 },
3303
3422
  elevation: 3
3304
3423
  },
3305
- 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 },
3306
3425
  resetText: { fontSize: 11, fontWeight: "600" },
3307
3426
  tooltipTime: { fontSize: 11, marginBottom: 3 },
3308
3427
  tooltipRow: { flexDirection: "row", alignItems: "center", gap: 6 },
@@ -3312,8 +3431,8 @@ var styles11 = StyleSheet11.create({
3312
3431
  });
3313
3432
 
3314
3433
  // src/ui/panels/XYChartPanel.tsx
3315
- import { useId as useId2, useMemo as useMemo7, useState as useState9 } from "react";
3316
- 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";
3317
3436
  import Svg9, { Circle as Circle2, G as G2, Line as Line2, Path as Path9, Text as SvgText4 } from "react-native-svg";
3318
3437
 
3319
3438
  // src/ui/xychart.ts
@@ -3445,7 +3564,7 @@ function xyDomain(values, config) {
3445
3564
  }
3446
3565
 
3447
3566
  // src/ui/panels/XYChartPanel.tsx
3448
- import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
3567
+ import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
3449
3568
  var AXIS = { left: 44, bottom: 20 };
3450
3569
  var EDGE = 8;
3451
3570
  var HIT_PX2 = 32;
@@ -3457,7 +3576,7 @@ function XYChartPanel({ panel, frames }) {
3457
3576
  const id = useId2();
3458
3577
  const { pinned, setPinned } = useDashboard();
3459
3578
  const { resolve, openLinks } = usePanelLinks(panel);
3460
- 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]);
3461
3580
  const first = series[0];
3462
3581
  const showX = first?.xConfig.custom?.axisPlacement !== "hidden";
3463
3582
  const showY = first?.yConfig.custom?.axisPlacement !== "hidden";
@@ -3471,7 +3590,7 @@ function XYChartPanel({ panel, frames }) {
3471
3590
  };
3472
3591
  const plotW = Math.max(0, size.width - pad.left - pad.right);
3473
3592
  const plotH = Math.max(0, size.height - pad.top - pad.bottom);
3474
- const layout = useMemo7(() => {
3593
+ const layout = useMemo8(() => {
3475
3594
  if (!first) return null;
3476
3595
  const [x0, x1] = xyDomain(series.map((s) => s.xs), first.xConfig);
3477
3596
  const [y0, y1] = xyDomain(series.map((s) => s.ys), first.yConfig);
@@ -3480,7 +3599,7 @@ function XYChartPanel({ panel, frames }) {
3480
3599
  const points = series.map((s) => ({ px: s.xs.map(x), py: s.ys.map(y) }));
3481
3600
  return { x, y, x0, x1, y0, y1, points, paths: series.map((s, i) => drawSeries(s, points[i].px, points[i].py)) };
3482
3601
  }, [series, first, pad.left, pad.top, plotW, plotH]);
3483
- 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, {});
3484
3603
  const xTicks = showX ? axisTicks(layout.x0, layout.x1, plotW < 220 ? 2 : plotW < 400 ? 3 : 5) : [];
3485
3604
  const yTicks = showY ? axisTicks(layout.y0, layout.y1, plotH < 100 ? 2 : 4) : [];
3486
3605
  const gridX = first.xConfig.custom?.axisGridShow !== false;
@@ -3489,11 +3608,11 @@ function XYChartPanel({ panel, frames }) {
3489
3608
  const hoverLinks = hover ? rowLinks(panel, hover.series.frame, hover.series.rows[hover.index], frames.length > 1, resolve) : [];
3490
3609
  const isPinned = !!hover && pinned === id;
3491
3610
  const legendItems = series.filter((s) => !s.yConfig.custom?.hideFrom?.legend);
3492
- return /* @__PURE__ */ jsxs12(View11, { style: styles12.fill, children: [
3493
- /* @__PURE__ */ jsxs12(
3494
- View11,
3611
+ return /* @__PURE__ */ jsxs13(View12, { style: styles13.fill, children: [
3612
+ /* @__PURE__ */ jsxs13(
3613
+ View12,
3495
3614
  {
3496
- style: styles12.fill,
3615
+ style: styles13.fill,
3497
3616
  onLayout,
3498
3617
  onStartShouldSetResponder: () => true,
3499
3618
  onResponderGrant: (e) => {
@@ -3512,14 +3631,14 @@ function XYChartPanel({ panel, frames }) {
3512
3631
  setTouch(null);
3513
3632
  },
3514
3633
  children: [
3515
- size.width > 0 && /* @__PURE__ */ jsxs12(Svg9, { width: size.width, height: size.height, children: [
3516
- yTicks.map((t) => /* @__PURE__ */ jsxs12(G2, { children: [
3517
- gridY && /* @__PURE__ */ jsx14(Line2, { x1: pad.left, x2: pad.left + plotW, y1: layout.y(t), y2: layout.y(t), stroke: theme.grid, strokeWidth: 1 }),
3518
- /* @__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) }) })
3519
3638
  ] }, `y${t}`)),
3520
- xTicks.map((t) => /* @__PURE__ */ jsxs12(G2, { children: [
3521
- gridX && /* @__PURE__ */ jsx14(Line2, { x1: layout.x(t), x2: layout.x(t), y1: pad.top, y2: pad.top + plotH, stroke: theme.grid, strokeWidth: 1 }),
3522
- /* @__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(
3523
3642
  SvgText4,
3524
3643
  {
3525
3644
  x: layout.x(t),
@@ -3531,12 +3650,12 @@ function XYChartPanel({ panel, frames }) {
3531
3650
  }
3532
3651
  )
3533
3652
  ] }, `x${t}`)),
3534
- /* @__PURE__ */ jsx14(AxisTitles, { x: xTitle, y: yTitle, plot: { left: pad.left, top: pad.top, width: plotW, height: plotH }, height: size.height }),
3535
- series.map((s, si) => /* @__PURE__ */ jsxs12(G2, { children: [
3536
- layout.paths[si].line && /* @__PURE__ */ jsx14(Path9, { d: layout.paths[si].line, stroke: s.color, strokeWidth: s.lineWidth, fill: "none", strokeLinejoin: "round" }),
3537
- 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))
3538
3657
  ] }, s.key)),
3539
- hover && /* @__PURE__ */ jsx14(
3658
+ hover && /* @__PURE__ */ jsx15(
3540
3659
  Circle2,
3541
3660
  {
3542
3661
  cx: hover.px,
@@ -3548,7 +3667,7 @@ function XYChartPanel({ panel, frames }) {
3548
3667
  }
3549
3668
  )
3550
3669
  ] }),
3551
- hover && /* @__PURE__ */ jsx14(
3670
+ hover && /* @__PURE__ */ jsx15(
3552
3671
  RowTooltip,
3553
3672
  {
3554
3673
  at: { x: hover.px, y: hover.py },
@@ -3563,7 +3682,7 @@ function XYChartPanel({ panel, frames }) {
3563
3682
  ]
3564
3683
  }
3565
3684
  ),
3566
- showLegend(panel, legendItems.length) && /* @__PURE__ */ jsx14(Legend, { items: legendItems })
3685
+ showLegend(panel, legendItems.length) && /* @__PURE__ */ jsx15(Legend, { items: legendItems })
3567
3686
  ] });
3568
3687
  }
3569
3688
  function drawSeries(s, px, py) {
@@ -3597,7 +3716,7 @@ function nearestPoint(series, points, at) {
3597
3716
  });
3598
3717
  return best;
3599
3718
  }
3600
- var styles12 = StyleSheet12.create({
3719
+ var styles13 = StyleSheet13.create({
3601
3720
  fill: { flex: 1 }
3602
3721
  });
3603
3722
 
@@ -3625,7 +3744,7 @@ function panelComponent(type) {
3625
3744
  }
3626
3745
 
3627
3746
  // src/ui/DashboardView.tsx
3628
- import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
3747
+ import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
3629
3748
  var GAP = 8;
3630
3749
  var SIDE = 12;
3631
3750
  var TITLE_H = 28;
@@ -3639,7 +3758,7 @@ function DashboardView({ mode = "auto", header, footer, refreshable }) {
3639
3758
  const insets = useSafeAreaInsets4();
3640
3759
  const width = (measured.width || window.width) - insets.left - insets.right;
3641
3760
  const layoutMode = mode === "auto" ? width >= TABLET_WIDTH ? "grid" : "phone" : mode;
3642
- const sections = useMemo8(
3761
+ const sections = useMemo9(
3643
3762
  () => layoutDashboard(dashboard, layoutMode, { values: variables, info: variableInfo2 }),
3644
3763
  [dashboard, layoutMode, variables, variableInfo2]
3645
3764
  );
@@ -3648,39 +3767,39 @@ function DashboardView({ mode = "auto", header, footer, refreshable }) {
3648
3767
  const maxPanelH = Math.max(MIN_PANEL_H, viewportH - SIDE * 2);
3649
3768
  const contentW = width - SIDE * 2;
3650
3769
  const canRefresh = refreshable ?? dashboard.panels.some((p) => panelHasQueries(p) || p.panels?.some(panelHasQueries));
3651
- return /* @__PURE__ */ jsxs13(View12, { style: [styles13.fill, { backgroundColor: theme.background }], onLayout, children: [
3652
- width > 0 && /* @__PURE__ */ jsxs13(
3653
- ScrollView5,
3770
+ return /* @__PURE__ */ jsxs14(View13, { style: [styles14.fill, { backgroundColor: theme.background }], onLayout, children: [
3771
+ width > 0 && /* @__PURE__ */ jsxs14(
3772
+ ScrollView6,
3654
3773
  {
3655
3774
  onScroll,
3656
3775
  onScrollBeginDrag: () => setPinned(null),
3657
3776
  onLayout: onViewportLayout,
3658
3777
  scrollEventThrottle: 100,
3659
- contentContainerStyle: [styles13.content, { paddingLeft: SIDE + insets.left, paddingRight: SIDE + insets.right }],
3778
+ contentContainerStyle: [styles14.content, { paddingLeft: SIDE + insets.left, paddingRight: SIDE + insets.right }],
3660
3779
  keyboardShouldPersistTaps: "handled",
3661
- refreshControl: canRefresh ? /* @__PURE__ */ jsx15(RefreshControl, { refreshing: false, onRefresh: refresh }) : void 0,
3780
+ refreshControl: canRefresh ? /* @__PURE__ */ jsx16(RefreshControl, { refreshing: false, onRefresh: refresh }) : void 0,
3662
3781
  children: [
3663
3782
  header,
3664
3783
  sections.map((section) => {
3665
3784
  const collapsed = toggled[section.key] ?? section.collapsed;
3666
- return /* @__PURE__ */ jsxs13(View12, { style: styles13.section, onLayout: (e) => onSectionLayout(section.key, e), children: [
3667
- section.row && /* @__PURE__ */ jsxs13(
3668
- Pressable11,
3785
+ return /* @__PURE__ */ jsxs14(View13, { style: styles14.section, onLayout: (e) => onSectionLayout(section.key, e), children: [
3786
+ section.row && /* @__PURE__ */ jsxs14(
3787
+ Pressable12,
3669
3788
  {
3670
3789
  onPress: () => setToggled((t) => ({ ...t, [section.key]: !collapsed })),
3671
- style: styles13.rowHeader,
3790
+ style: styles14.rowHeader,
3672
3791
  accessibilityRole: "button",
3673
3792
  accessibilityState: { expanded: !collapsed },
3674
3793
  children: [
3675
- /* @__PURE__ */ jsx15(Text12, { style: [styles13.chevron, { color: theme.textMuted }], children: collapsed ? "\u25B8" : "\u25BE" }),
3676
- /* @__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 }) })
3677
3796
  ]
3678
3797
  }
3679
3798
  ),
3680
- !collapsed && layoutMode === "grid" && /* @__PURE__ */ jsx15(GridSection, { grid: section.grid, width: contentW, maxPanelH, deferred: !seen.has(section.key) }),
3681
- !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) => {
3682
3801
  const w = (contentW + GAP) * (cell.span / GRID_COLUMNS) - GAP;
3683
- 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);
3684
3803
  }) }, ri))
3685
3804
  ] }, section.key);
3686
3805
  })
@@ -3694,7 +3813,7 @@ function GridSection({ grid, width, maxPanelH, deferred }) {
3694
3813
  const colW = (width + GAP) / GRID_COLUMNS;
3695
3814
  const tallest = Math.max(0, ...grid.cells.map((c) => gridUnitsToPx(c.h)));
3696
3815
  const scale = tallest > maxPanelH ? maxPanelH / tallest : 1;
3697
- 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)) });
3698
3817
  }
3699
3818
  function useSeenSections(viewportHeight) {
3700
3819
  const [seen, setSeen] = useState10(/* @__PURE__ */ new Set());
@@ -3739,43 +3858,44 @@ function useSeenSections(viewportHeight) {
3739
3858
  }
3740
3859
  function PanelCard(props) {
3741
3860
  const { panel, width, height } = props;
3742
- 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 }) });
3743
3862
  }
3744
3863
  function PanelError({ panel, width, height, error }) {
3745
3864
  const theme = useDashTheme();
3746
- return /* @__PURE__ */ jsxs13(View12, { style: [styles13.card, { width, height, backgroundColor: theme.surface, borderColor: theme.danger }], accessibilityRole: "alert", children: [
3747
- !!panel.title && /* @__PURE__ */ jsx15(Text12, { style: [styles13.title, styles13.errorTitle, { color: theme.text }], numberOfLines: 1, children: panel.title }),
3748
- /* @__PURE__ */ jsx15(Text12, { style: [styles13.errorText, { color: theme.danger }], children: "This panel couldn\u2019t be shown." }),
3749
- /* @__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 })
3750
3869
  ] });
3751
3870
  }
3752
3871
  function PanelCardContent({ panel, width, height, deferred }) {
3753
3872
  const theme = useDashTheme();
3754
3873
  const { dashboard, variables, variableInfo: variableInfo2 } = useDashboard();
3755
3874
  const { resolve, openLinks } = usePanelLinks(panel);
3756
- const input = isInputPanel(panel);
3875
+ const group = isInputGroup(panel);
3876
+ const input = isInputPanel(panel) || group;
3757
3877
  const form = useContext4(InputFormContext);
3758
- 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;
3759
3879
  const hasLinks = !!panel.links?.length;
3760
3880
  const hasTitle = !!panel.title || hasLinks || !!problem;
3761
3881
  const title = panel.title ? interpolate(panel.title, { values: variables, info: variableInfo2, scoped: panel.scopedVars, timezone: dashboard.timezone }) : "";
3762
- return /* @__PURE__ */ jsxs13(View12, { style: [styles13.card, { width, height, backgroundColor: theme.surface, borderColor: theme.border }], children: [
3763
- hasTitle && /* @__PURE__ */ jsxs13(View12, { style: styles13.titleRow, children: [
3764
- /* @__PURE__ */ jsx15(Text12, { style: [styles13.title, { color: theme.text }], numberOfLines: 1, children: title }),
3765
- !!problem && /* @__PURE__ */ jsx15(Text12, { style: [styles13.problem, { color: theme.danger }], numberOfLines: 1, accessibilityRole: "alert", children: problem }),
3766
- hasLinks && /* @__PURE__ */ jsx15(
3767
- 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,
3768
3888
  {
3769
3889
  onPress: () => openLinks(resolve(panel.links), title || void 0),
3770
3890
  accessibilityRole: "button",
3771
3891
  accessibilityLabel: panel.links.length === 1 ? panel.links[0].title || "Open link" : "Panel links",
3772
3892
  hitSlop: 10,
3773
- style: ({ pressed }) => [styles13.titleLink, pressed && { opacity: 0.6 }],
3774
- children: /* @__PURE__ */ jsx15(LinkIcon, { color: theme.textMuted })
3893
+ style: ({ pressed }) => [styles14.titleLink, pressed && { opacity: 0.6 }],
3894
+ children: /* @__PURE__ */ jsx16(LinkIcon, { color: theme.textMuted })
3775
3895
  }
3776
3896
  )
3777
3897
  ] }),
3778
- /* @__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 }) })
3779
3899
  ] });
3780
3900
  }
3781
3901
  function DataPanelBody({ panel, width, height }) {
@@ -3784,14 +3904,14 @@ function DataPanelBody({ panel, width, height }) {
3784
3904
  const data = usePanelData(panel, width, needsData);
3785
3905
  const Component2 = panelComponent(panel.type);
3786
3906
  if (needsData && data.error) {
3787
- 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 }) });
3788
3908
  }
3789
3909
  if (needsData && data.loading && !data.frames.length) {
3790
- 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 }) });
3791
3911
  }
3792
- return /* @__PURE__ */ jsx15(Component2, { panel, frames: data.frames, width, height });
3912
+ return /* @__PURE__ */ jsx16(Component2, { panel, frames: data.frames, width, height });
3793
3913
  }
3794
- var styles13 = StyleSheet13.create({
3914
+ var styles14 = StyleSheet14.create({
3795
3915
  fill: { flex: 1 },
3796
3916
  content: { padding: SIDE, paddingBottom: 32, gap: GAP },
3797
3917
  section: { gap: GAP },
@@ -3800,7 +3920,7 @@ var styles13 = StyleSheet13.create({
3800
3920
  rowTitle: { fontSize: 15, fontWeight: "600" },
3801
3921
  row: { flexDirection: "row", gap: GAP },
3802
3922
  gridCell: { position: "absolute" },
3803
- 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" },
3804
3924
  titleRow: { flexDirection: "row", alignItems: "flex-start", gap: 8, height: TITLE_H - 8, marginBottom: 8 },
3805
3925
  title: { flex: 1, fontSize: 13, fontWeight: "600" },
3806
3926
  titleLink: { paddingTop: 1 },
@@ -3813,9 +3933,9 @@ var styles13 = StyleSheet13.create({
3813
3933
  });
3814
3934
 
3815
3935
  // src/ui/inputs/InputForm.tsx
3816
- import { useCallback as useCallback4, useEffect as useEffect4, useMemo as useMemo9, useState as useState11 } from "react";
3817
- import { Pressable as Pressable12, StyleSheet as StyleSheet14, Text as Text13, View as View13 } from "react-native";
3818
- 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";
3819
3939
  var NO_CHOICES = {};
3820
3940
  var NO_DEFAULTS = {};
3821
3941
  function savedValues(panels, entries) {
@@ -3826,12 +3946,36 @@ function savedValues(panels, entries) {
3826
3946
  }
3827
3947
  return values;
3828
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;
3829
3970
  function InputForm({ dashboard, store, onSaved, choices = NO_CHOICES, header, timestamp, defaults: given = NO_DEFAULTS, beforeSave, editing }) {
3830
3971
  const theme = useDashTheme();
3831
- const panels = useMemo9(() => inputPanels(dashboard), [dashboard]);
3832
- 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]);
3833
3975
  const [defaults, setDefaults] = useState11({});
3834
3976
  const [edits, setEdits] = useState11({});
3977
+ const [last, setLast] = useState11({});
3978
+ const [groupEdits, setGroupEdits] = useState11({});
3835
3979
  const [offsetMs, setOffsetMs] = useState11(0);
3836
3980
  const [status, setStatus] = useState11(null);
3837
3981
  const [checked, setChecked] = useState11(false);
@@ -3845,7 +3989,15 @@ function InputForm({ dashboard, store, onSaved, choices = NO_CHOICES, header, ti
3845
3989
  if (d === "last") next[p.options.metric] = entryToInputValue(p, await store.latest(p.options.metric));
3846
3990
  else if (d !== void 0) next[p.options.metric] = d;
3847
3991
  }
3848
- 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
+ }
3849
4001
  };
3850
4002
  load();
3851
4003
  const unsubscribe = store.subscribe(load);
@@ -3853,8 +4005,10 @@ function InputForm({ dashboard, store, onSaved, choices = NO_CHOICES, header, ti
3853
4005
  run = -1;
3854
4006
  unsubscribe();
3855
4007
  };
3856
- }, [panels, store]);
3857
- 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(() => {
3858
4012
  const value = (m) => m in edits ? edits[m] : m in saved ? saved[m] : m in given ? given[m] : defaults[m] ?? null;
3859
4013
  return {
3860
4014
  value,
@@ -3868,65 +4022,123 @@ function InputForm({ dashboard, store, onSaved, choices = NO_CHOICES, header, ti
3868
4022
  problem: (m) => {
3869
4023
  const p = panels.find((x) => x.options.metric === m);
3870
4024
  return p && (checked || m in edits) ? inputProblem(p, value(m)) : void 0;
3871
- }
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
+ })
3872
4030
  };
3873
- }, [edits, saved, defaults, given, store, choices, panels, checked]);
3874
- 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
+ );
3875
4037
  const save = useCallback4(async () => {
3876
4038
  const problems = panels.flatMap((p) => {
3877
4039
  const problem = inputProblem(p, state.value(p.options.metric));
3878
4040
  return problem ? [`${p.title || p.options.metric}: ${problem.toLowerCase()}`] : [];
3879
4041
  });
4042
+ for (const g of recordedGroups()) problems.push(...groupProblems(g, itemsOf(g).map((i) => i.values)));
3880
4043
  if (problems.length) {
3881
4044
  setChecked(true);
3882
4045
  setStatus(problems.length === 1 ? `Can\u2019t save. ${problems[0]}` : `Can\u2019t save: ${problems.length} fields need fixing`);
3883
4046
  return;
3884
4047
  }
3885
4048
  const ts = editing?.[0]?.ts ?? (header !== void 0 ? timestamp?.() ?? Date.now() : Date.now() + offsetMs);
3886
- 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
+ ];
3887
4054
  if (!entries.length) return;
3888
4055
  const extra = beforeSave ? await beforeSave(ts) : [];
3889
4056
  if (!extra) return;
3890
4057
  const added = editing ? await replace(store, editing.map((e) => e.id), [...entries, ...extra]) : await store.add([...entries, ...extra]);
3891
4058
  setEdits({});
4059
+ setGroupEdits({});
3892
4060
  setChecked(false);
3893
4061
  setOffsetMs(0);
3894
4062
  setStatus(`Saved ${added.length} ${added.length === 1 ? "value" : "values"}`);
3895
4063
  onSaved?.(added.length, added);
3896
- }, [panels, edits, state, offsetMs, store, onSaved, header, timestamp, beforeSave, editing]);
3897
- 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(
3898
4066
  DashboardView,
3899
4067
  {
3900
- header: header !== void 0 ? header : /* @__PURE__ */ jsx16(TimestampPicker, { offsetMs, onChange: setOffsetMs }),
3901
- footer: /* @__PURE__ */ jsxs14(View13, { style: [styles14.footer, { backgroundColor: theme.surface, borderTopColor: theme.border }], children: [
3902
- /* @__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") }),
3903
- dirty > 0 && /* @__PURE__ */ jsx16(
3904
- 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,
3905
4073
  {
3906
4074
  onPress: () => {
3907
4075
  setEdits({});
4076
+ setGroupEdits({});
3908
4077
  setChecked(false);
3909
4078
  setStatus(null);
3910
4079
  },
3911
- style: styles14.secondary,
4080
+ style: styles15.secondary,
3912
4081
  accessibilityRole: "button",
3913
- 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" })
3914
4083
  }
3915
4084
  ),
3916
- /* @__PURE__ */ jsx16(
3917
- Pressable12,
4085
+ /* @__PURE__ */ jsx17(
4086
+ Pressable13,
3918
4087
  {
3919
4088
  onPress: save,
3920
4089
  disabled: !dirty,
3921
4090
  accessibilityRole: "button",
3922
- style: ({ pressed }) => [styles14.save, { backgroundColor: theme.accent, opacity: !dirty ? 0.4 : pressed ? 0.8 : 1 }],
3923
- 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" })
3924
4093
  }
3925
4094
  )
3926
4095
  ] })
3927
4096
  }
3928
4097
  ) }) });
3929
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
+ }
3930
4142
  async function replace(store, ids, entries) {
3931
4143
  if (store.replace) return store.replace(ids, entries);
3932
4144
  for (const id of ids) await store.remove(id);
@@ -3942,26 +4154,26 @@ function TimestampPicker({ offsetMs, onChange }) {
3942
4154
  }, []);
3943
4155
  const when = new Date(now + offsetMs);
3944
4156
  const step = (ms) => () => onChange(Math.min(0, offsetMs + ms));
3945
- return /* @__PURE__ */ jsxs14(View13, { style: [styles14.when, { backgroundColor: theme.surface, borderColor: theme.border }], children: [
3946
- /* @__PURE__ */ jsxs14(View13, { style: { flex: 1 }, children: [
3947
- /* @__PURE__ */ jsx16(Text13, { style: [styles14.whenLabel, { color: theme.textMuted }], children: "Recording for" }),
3948
- /* @__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" }) })
3949
4161
  ] }),
3950
4162
  [
3951
4163
  ["\u22121d", -24 * HOUR],
3952
4164
  ["\u22121h", -HOUR],
3953
4165
  ["+1h", HOUR]
3954
- ].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)),
3955
- 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" }) })
3956
4168
  ] });
3957
4169
  }
3958
- var styles14 = StyleSheet14.create({
3959
- 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 },
3960
4172
  status: { flex: 1, fontSize: 13 },
3961
4173
  secondary: { paddingHorizontal: 8, paddingVertical: 10 },
3962
4174
  save: { paddingHorizontal: 22, paddingVertical: 10, borderRadius: 8 },
3963
4175
  saveText: { color: "#fff", fontWeight: "600", fontSize: 15 },
3964
- 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 },
3965
4177
  whenLabel: { fontSize: 11 },
3966
4178
  whenValue: { fontSize: 15, fontWeight: "600" },
3967
4179
  stepBtn: { paddingHorizontal: 10, paddingVertical: 6, borderRadius: 6, borderWidth: 1 }
@@ -3983,10 +4195,12 @@ export {
3983
4195
  DashboardView,
3984
4196
  EDITABLE_VARIABLE_TYPES,
3985
4197
  GRID_COLUMNS,
4198
+ GROUP_FIELD_TYPES,
3986
4199
  GrafanaClient,
3987
4200
  GrafanaDataSource,
3988
4201
  GrafanaError,
3989
4202
  HttpConfigFiles,
4203
+ INPUT_GROUP,
3990
4204
  INPUT_OPTION_KEYS,
3991
4205
  INPUT_TYPES,
3992
4206
  InputForm,
@@ -4011,12 +4225,14 @@ export {
4011
4225
  SNIPPET_VERSION,
4012
4226
  SPECIAL_MATCHES,
4013
4227
  SaveConflictError,
4228
+ TEMPLATE_VERSION,
4014
4229
  TIME_PRESETS,
4015
4230
  UNIT_CHOICES,
4016
4231
  addTime,
4017
4232
  appSchema,
4018
4233
  applyDashboardLink,
4019
4234
  applyJsonEdits,
4235
+ applyTemplate,
4020
4236
  applyTransformations,
4021
4237
  assembleBundle,
4022
4238
  assembleFromResponse,
@@ -4042,6 +4258,7 @@ export {
4042
4258
  dropTarget,
4043
4259
  duplicatePanel,
4044
4260
  entriesSavedWith,
4261
+ entriesToItems,
4045
4262
  entryToInputValue,
4046
4263
  expandRow,
4047
4264
  fetchBundle,
@@ -4060,8 +4277,13 @@ export {
4060
4277
  getPath,
4061
4278
  gridOffsetPx,
4062
4279
  gridUnitsToPx,
4280
+ groupFields,
4281
+ groupKey,
4282
+ groupProblems,
4283
+ groupToEntries,
4063
4284
  httpFetchJson,
4064
4285
  initialVariableValues,
4286
+ inputGroups,
4065
4287
  inputPanels,
4066
4288
  inputProblem,
4067
4289
  insertPanel,
@@ -4069,6 +4291,9 @@ export {
4069
4291
  interpolateDeep,
4070
4292
  isBundleResponse,
4071
4293
  isEditableVariableType,
4294
+ isEmptyItem,
4295
+ isFormPanelType,
4296
+ isInputGroup,
4072
4297
  isInputPanel,
4073
4298
  isInputType,
4074
4299
  isLocalDatasource,
@@ -4081,6 +4306,7 @@ export {
4081
4306
  lineColumn,
4082
4307
  loadGazetteer,
4083
4308
  locate,
4309
+ makeTemplate,
4084
4310
  manifestSchemaIssues,
4085
4311
  mappedResult,
4086
4312
  mappingProblem,
@@ -4090,6 +4316,7 @@ export {
4090
4316
  movePanel,
4091
4317
  newDocument,
4092
4318
  newPanel,
4319
+ newSaveId,
4093
4320
  newVariable,
4094
4321
  nextPanelId,
4095
4322
  normalizeRef,
@@ -4099,6 +4326,7 @@ export {
4099
4326
  panelEdits,
4100
4327
  panelHasQueries,
4101
4328
  panelKey,
4329
+ panelMetrics,
4102
4330
  panelOptions,
4103
4331
  panelOverrides,
4104
4332
  panelSize,
@@ -4111,9 +4339,11 @@ export {
4111
4339
  parseLocalDateTime,
4112
4340
  parseRange,
4113
4341
  parseSnippet,
4342
+ parseTemplate,
4114
4343
  parseTime,
4115
4344
  pasteSnippet,
4116
4345
  placePanel,
4346
+ plainInputPanels,
4117
4347
  pointerToPath,
4118
4348
  prepareDashboard,
4119
4349
  previewPaste,
@@ -4128,6 +4358,7 @@ export {
4128
4358
  removeDocumentFromManifest,
4129
4359
  removePanel,
4130
4360
  renameDocumentInManifest,
4361
+ renameMetrics,
4131
4362
  renameVariableInPanels,
4132
4363
  repack,
4133
4364
  repeatOptions,
@@ -4140,6 +4371,7 @@ export {
4140
4371
  resolveVariables,
4141
4372
  revalidateBundle,
4142
4373
  rowsToMappings,
4374
+ sameSave,
4143
4375
  sampleEntries,
4144
4376
  screenDocuments,
4145
4377
  screenOfType,
@@ -4156,6 +4388,7 @@ export {
4156
4388
  startOf,
4157
4389
  stringifyCompact,
4158
4390
  tabIdFor,
4391
+ templateNeeds,
4159
4392
  textSuggestions,
4160
4393
  thresholdStep,
4161
4394
  timeExprError,