@modelform/react-native 0.11.0 → 0.13.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.
@@ -1567,6 +1567,246 @@ function queryErrors(results) {
1567
1567
  return Object.entries(_nullishCoalesce(results, () => ( {}))).filter(([, r]) => r.error).map(([refId, r]) => `${refId}: ${r.error}`).join("\n");
1568
1568
  }
1569
1569
 
1570
+ // src/core/speech.ts
1571
+ var UNITS = {
1572
+ zero: 0,
1573
+ oh: 0,
1574
+ nought: 0,
1575
+ one: 1,
1576
+ two: 2,
1577
+ three: 3,
1578
+ four: 4,
1579
+ five: 5,
1580
+ six: 6,
1581
+ seven: 7,
1582
+ eight: 8,
1583
+ nine: 9,
1584
+ ten: 10,
1585
+ eleven: 11,
1586
+ twelve: 12,
1587
+ thirteen: 13,
1588
+ fourteen: 14,
1589
+ fifteen: 15,
1590
+ sixteen: 16,
1591
+ seventeen: 17,
1592
+ eighteen: 18,
1593
+ nineteen: 19
1594
+ };
1595
+ var TENS = { twenty: 20, thirty: 30, forty: 40, fifty: 50, sixty: 60, seventy: 70, eighty: 80, ninety: 90 };
1596
+ var SCALES = { hundred: 100, thousand: 1e3, million: 1e6 };
1597
+ var NEGATIVE = /* @__PURE__ */ new Set(["minus", "negative"]);
1598
+ var isNumberWord = (w) => w in UNITS || w in TENS || w in SCALES;
1599
+ function words(text) {
1600
+ return text.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g, "").replace(/(\d),(\d{3})\b/g, "$1$2").replace(/(\d),(\d)/g, "$1.$2").replace(/[^a-z0-9.:\s-]/g, " ").replace(/(?<![\d])-(?=\d)/g, " minus ").replace(/-/g, " ").replace(/\.(?!\d)/g, " ").split(/\s+/).filter(Boolean);
1601
+ }
1602
+ function wordsToInteger(ws) {
1603
+ if (!ws.length) return null;
1604
+ if (ws.some((w) => w in SCALES)) {
1605
+ let total = 0;
1606
+ let current = 0;
1607
+ for (const w of ws) {
1608
+ if (w in UNITS) current += UNITS[w];
1609
+ else if (w in TENS) current += TENS[w];
1610
+ else if (w === "hundred") current = (current || 1) * 100;
1611
+ else if (w in SCALES) {
1612
+ total += (current || 1) * SCALES[w];
1613
+ current = 0;
1614
+ } else return null;
1615
+ }
1616
+ return total + current;
1617
+ }
1618
+ const groups = [];
1619
+ for (let i = 0; i < ws.length; i++) {
1620
+ const w = ws[i];
1621
+ const next = ws[i + 1];
1622
+ const nextUnit = next != null && next in UNITS && UNITS[next] > 0 && UNITS[next] < 10;
1623
+ if (w in TENS) {
1624
+ groups.push(String(TENS[w] + (nextUnit ? UNITS[next] : 0)));
1625
+ if (nextUnit) i++;
1626
+ } else if (w === "oh" && nextUnit) {
1627
+ groups.push(`0${UNITS[next]}`);
1628
+ i++;
1629
+ } else if (w in UNITS) groups.push(String(UNITS[w]));
1630
+ else return null;
1631
+ }
1632
+ return Number(groups.map((g, i) => i === 0 ? g : g.padStart(2, "0")).join(""));
1633
+ }
1634
+ function parseSpokenNumber(text) {
1635
+ const ws = words(text);
1636
+ let i = 0;
1637
+ let sign = 1;
1638
+ for (; i < ws.length; i++) {
1639
+ const w = ws[i];
1640
+ if (NEGATIVE.has(w)) sign = -1;
1641
+ else if (/^\d/.test(w) || isNumberWord(w) || w === "a" && ws[i + 1] in SCALES || w === "point" && ws[i + 1] && (/^\d/.test(ws[i + 1]) || ws[i + 1] in UNITS)) break;
1642
+ else if (w !== "and") sign = 1;
1643
+ }
1644
+ if (i >= ws.length) return null;
1645
+ const digits = /^(\d+(?:\.\d+)?)$/.exec(ws[i]);
1646
+ if (digits) {
1647
+ let n = Number(digits[1]);
1648
+ const rest = ws.slice(i + 1);
1649
+ if (!digits[1].includes(".") && rest[0] === "point") n = Number(`${digits[1]}.${_nullishCoalesce(fractionDigits(rest.slice(1)), () => ( 0))}`);
1650
+ else if (rest[0] === "and" && rest[1] === "a" && rest[2] === "half") n += 0.5;
1651
+ return sign * n;
1652
+ }
1653
+ const whole = [];
1654
+ for (; i < ws.length; i++) {
1655
+ const w = ws[i];
1656
+ if (isNumberWord(w)) whole.push(w);
1657
+ else if (w === "a" && ws[i + 1] in SCALES) whole.push("one");
1658
+ else if (w === "and" && ws[i + 1] && isNumberWord(ws[i + 1]) && whole.some((x) => x in SCALES)) continue;
1659
+ else break;
1660
+ }
1661
+ const intPart = whole.length ? wordsToInteger(whole) : 0;
1662
+ if (intPart == null) return null;
1663
+ if (ws[i] === "point") {
1664
+ const frac = fractionDigits(ws.slice(i + 1));
1665
+ return frac == null ? sign * intPart : sign * Number(`${intPart}.${frac}`);
1666
+ }
1667
+ if (ws[i] === "and" && ws[i + 1] === "a" && ws[i + 2] === "half") return sign * (intPart + 0.5);
1668
+ if (ws[i] === "and" && ws[i + 1] === "a" && ws[i + 2] === "quarter") return sign * (intPart + 0.25);
1669
+ if (!whole.length) return null;
1670
+ return sign * intPart;
1671
+ }
1672
+ function fractionDigits(ws) {
1673
+ if (ws[0] && /^\d+$/.test(ws[0])) return ws[0];
1674
+ let out = "";
1675
+ for (let i = 0; i < ws.length; i++) {
1676
+ const w = ws[i];
1677
+ if (w in UNITS && UNITS[w] < 10) out += UNITS[w];
1678
+ else if (w in TENS) {
1679
+ const next = ws[i + 1];
1680
+ if (next in UNITS && UNITS[next] > 0 && UNITS[next] < 10) {
1681
+ out += TENS[w] + UNITS[next];
1682
+ i++;
1683
+ } else out += TENS[w];
1684
+ } else if (w in UNITS) out += UNITS[w];
1685
+ else break;
1686
+ }
1687
+ return out || null;
1688
+ }
1689
+ function parseSpokenDuration(text) {
1690
+ const clock = /(?:(\d+):)?(\d+):(\d{1,2})(?:\.(\d+))?|(\d+):(\d{1,2})(?:\.(\d+))?/.exec(text);
1691
+ if (clock) {
1692
+ if (clock[3] != null) {
1693
+ const [h, m, s, f] = [Number(_nullishCoalesce(clock[1], () => ( 0))), Number(clock[2]), Number(clock[3]), _nullishCoalesce(clock[4], () => ( "0"))];
1694
+ return clock[1] != null ? h * 3600 + m * 60 + s + Number(`0.${f}`) : m * 60 + s + Number(`0.${f}`);
1695
+ }
1696
+ }
1697
+ const lower = text.toLowerCase().replace(/\ban hour\b/g, "one hour").replace(/\ba minute\b/g, "one minute").replace(/(\S+) (hours?|minutes?) and a half/g, "$1 and a half $2");
1698
+ const parts = lower.split(/\b(hours?|hrs?|minutes?|mins?|seconds?|secs?)\b/);
1699
+ const scale = (unit) => unit.startsWith("h") ? 3600 : unit.startsWith("m") ? 60 : 1;
1700
+ let total = 0;
1701
+ let found = false;
1702
+ let last = 0;
1703
+ for (let i = 0; i < parts.length; i += 2) {
1704
+ const n = parseSpokenNumber(parts[i]);
1705
+ const unit = parts[i + 1];
1706
+ const s = unit != null ? scale(unit) : last === 3600 ? 60 : last === 60 ? 1 : 0;
1707
+ if (unit != null) last = s;
1708
+ if (n == null || !s) continue;
1709
+ total += n * s;
1710
+ found = true;
1711
+ }
1712
+ if (found) return Math.round(total * 100) / 100;
1713
+ return null;
1714
+ }
1715
+ var normalize = (s) => words(s).join(" ");
1716
+ var singular = (w) => w.length > 3 && w.endsWith("s") && !w.endsWith("ss") ? w.slice(0, -1) : w;
1717
+ var loose = (s) => normalize(s).split(" ").map(singular).join(" ");
1718
+ function matchChoices(text, choices2) {
1719
+ const said = ` ${loose(text)} `;
1720
+ const hits = [];
1721
+ const byLength = [...choices2].sort((a, b) => b.label.length - a.label.length);
1722
+ for (const c of byLength) {
1723
+ const label = loose(c.label);
1724
+ if (!label) continue;
1725
+ let from = 0;
1726
+ for (; ; ) {
1727
+ const at = said.indexOf(` ${label} `, from);
1728
+ if (at < 0) break;
1729
+ const end = at + label.length + 1;
1730
+ if (!hits.some((h) => at < h.end && end > h.at)) hits.push({ at, end, value: c.value });
1731
+ from = at + 1;
1732
+ }
1733
+ }
1734
+ if (!hits.length) {
1735
+ const n = parseSpokenNumber(text);
1736
+ const c = n == null ? void 0 : choices2.find((x) => x.value === n || Number(x.label) === n || x.value === String(n));
1737
+ return c ? [c.value] : [];
1738
+ }
1739
+ const seen = /* @__PURE__ */ new Set();
1740
+ return hits.sort((a, b) => a.at - b.at).map((h) => h.value).filter((v) => !seen.has(v) && seen.add(v));
1741
+ }
1742
+ var YES = /* @__PURE__ */ new Set(["yes", "yeah", "yep", "yup", "true", "on", "done", "did", "checked", "correct", "affirmative"]);
1743
+ var NO = /* @__PURE__ */ new Set(["no", "nope", "nah", "false", "off", "not", "didnt", "didn", "unchecked", "negative"]);
1744
+ function parseSpokenYesNo(text) {
1745
+ const ws = words(text.replace(/['’]/g, ""));
1746
+ if (ws.some((w) => NO.has(w))) return false;
1747
+ if (ws.some((w) => YES.has(w))) return true;
1748
+ return null;
1749
+ }
1750
+ function spokenValue(panel, said, current = null, choices2) {
1751
+ const text = said.trim();
1752
+ if (!text) return { problem: "Didn\u2019t hear anything" };
1753
+ const o = panel.options;
1754
+ const quoted = `\u201C${text}\u201D`;
1755
+ switch (panel.type) {
1756
+ case "input-text": {
1757
+ if (o.suggest || typeof current !== "string" || !current.trim()) return { value: text };
1758
+ return { value: `${current.trimEnd()} ${text}` };
1759
+ }
1760
+ case "input-number":
1761
+ case "input-rating": {
1762
+ const n = parseSpokenNumber(text);
1763
+ if (n == null) return { problem: `Heard ${quoted}, not a number` };
1764
+ const step = panel.type === "input-rating" ? 1 : _nullishCoalesce(o.step, () => ( 1));
1765
+ return { value: Number.isInteger(step) ? Math.round(n) : n };
1766
+ }
1767
+ case "input-slider": {
1768
+ const min = _nullishCoalesce(o.min, () => ( 0));
1769
+ const max = _nullishCoalesce(o.max, () => ( 10));
1770
+ const step = _nullishCoalesce(o.step, () => ( 1));
1771
+ if (_optionalChain([o, 'access', _154 => _154.labels, 'optionalAccess', _155 => _155.length])) {
1772
+ const [hit] = matchChoices(text, o.labels.map((label, i) => ({ label, value: i })));
1773
+ if (typeof hit === "number") {
1774
+ const raw = o.labels.length === 1 ? min : min + hit / (o.labels.length - 1) * (max - min);
1775
+ return { value: Number((Math.round((raw - min) / step) * step + min).toFixed((_nullishCoalesce(String(step).split(".")[1], () => ( ""))).length)) };
1776
+ }
1777
+ }
1778
+ const n = parseSpokenNumber(text);
1779
+ if (n == null) return { problem: `Heard ${quoted}, not a number` };
1780
+ return { value: Number.isInteger(step) ? Math.round(n) : n };
1781
+ }
1782
+ case "input-duration": {
1783
+ const s = _nullishCoalesce(parseSpokenDuration(text), () => ( parseSpokenNumber(text)));
1784
+ return s == null ? { problem: `Heard ${quoted}, not a time` } : { value: s };
1785
+ }
1786
+ case "input-select": {
1787
+ const options = _nullishCoalesce(_nullishCoalesce(choices2, () => ( o.choices)), () => ( []));
1788
+ const hits = matchChoices(text, options);
1789
+ if (!hits.length) return { problem: `Heard ${quoted}, not one of the choices` };
1790
+ if (!o.multi) return { value: hits[0] };
1791
+ const had = Array.isArray(current) ? current : current == null ? [] : [current];
1792
+ return { value: [...had, ...hits.filter((h) => !had.includes(h))] };
1793
+ }
1794
+ case "input-toggle": {
1795
+ const yes = parseSpokenYesNo(text);
1796
+ return yes == null ? { problem: `Heard ${quoted}, not yes or no` } : { value: yes };
1797
+ }
1798
+ default:
1799
+ return { problem: "This input doesn\u2019t take dictation" };
1800
+ }
1801
+ }
1802
+ var DICTATION_TYPES = ["input-number", "input-text", "input-select", "input-duration"];
1803
+ var takesDictation = (panel) => DICTATION_TYPES.includes(panel.type);
1804
+ function dictationHints(panel, choices2) {
1805
+ const out = (_nullishCoalesce(_nullishCoalesce(choices2, () => ( panel.options.choices)), () => ( []))).map((c) => c.label);
1806
+ if (panel.options.unit) out.push(panel.options.unit);
1807
+ return out;
1808
+ }
1809
+
1570
1810
  // src/core/local.ts
1571
1811
  var LOCAL_DATASOURCE_TYPE = "modelform-local";
1572
1812
  var LEGACY_LOCAL_DATASOURCE_TYPE = "dashkit-local";
@@ -1643,7 +1883,7 @@ function buildFrames(target, entries, request, label, siblings = []) {
1643
1883
  const fill = _nullishCoalesce(target.fillZero, () => ( (aggregate === "sum" || aggregate === "count")));
1644
1884
  ({ times, values } = bucketize(rows, aggregate, bucket, request.range, fill));
1645
1885
  }
1646
- const display = group == null ? name : _nullishCoalesce(_optionalChain([label, 'optionalCall', _154 => _154(labelKey, group)]), () => ( group));
1886
+ const display = group == null ? name : _nullishCoalesce(_optionalChain([label, 'optionalCall', _156 => _156(labelKey, group)]), () => ( group));
1647
1887
  return {
1648
1888
  name,
1649
1889
  refId: target.refId,
@@ -1699,7 +1939,7 @@ function bucketize(rows, aggregate, bucket, range, fillZero) {
1699
1939
  const keys = fillZero ? step.range(range.from, range.to) : [...sums.keys()].sort((a, b) => a - b);
1700
1940
  const values = keys.map((k) => {
1701
1941
  const vs = sums.get(k);
1702
- return _optionalChain([vs, 'optionalAccess', _155 => _155.length]) ? reduce2(vs, aggregate) : fillZero ? 0 : null;
1942
+ return _optionalChain([vs, 'optionalAccess', _157 => _157.length]) ? reduce2(vs, aggregate) : fillZero ? 0 : null;
1703
1943
  });
1704
1944
  return { times: keys, values };
1705
1945
  }
@@ -1780,17 +2020,17 @@ function parseGazetteer(json) {
1780
2020
  };
1781
2021
  if (Array.isArray(json)) {
1782
2022
  for (const item of json) {
1783
- const lat = Number(_nullishCoalesce(_optionalChain([item, 'optionalAccess', _156 => _156.latitude]), () => ( _optionalChain([item, 'optionalAccess', _157 => _157.lat]))));
1784
- const lon = Number(_nullishCoalesce(_nullishCoalesce(_optionalChain([item, 'optionalAccess', _158 => _158.longitude]), () => ( _optionalChain([item, 'optionalAccess', _159 => _159.lon]))), () => ( _optionalChain([item, 'optionalAccess', _160 => _160.lng]))));
2023
+ const lat = Number(_nullishCoalesce(_optionalChain([item, 'optionalAccess', _158 => _158.latitude]), () => ( _optionalChain([item, 'optionalAccess', _159 => _159.lat]))));
2024
+ const lon = Number(_nullishCoalesce(_nullishCoalesce(_optionalChain([item, 'optionalAccess', _160 => _160.longitude]), () => ( _optionalChain([item, 'optionalAccess', _161 => _161.lon]))), () => ( _optionalChain([item, 'optionalAccess', _162 => _162.lng]))));
1785
2025
  if (!Number.isFinite(lat) || !Number.isFinite(lon)) continue;
1786
2026
  const p = { lon, lat };
1787
2027
  add(item.key, p);
1788
2028
  for (const k of [..._nullishCoalesce(item.keys, () => ( [])), ..._nullishCoalesce(item.keywords, () => ( []))]) add(k, p);
1789
2029
  add(item.name, p);
1790
2030
  }
1791
- } else if (_optionalChain([json, 'optionalAccess', _161 => _161.type]) === "FeatureCollection") {
2031
+ } else if (_optionalChain([json, 'optionalAccess', _163 => _163.type]) === "FeatureCollection") {
1792
2032
  for (const f of _nullishCoalesce(json.features, () => ( []))) {
1793
- const p = featurePoint(_optionalChain([f, 'optionalAccess', _162 => _162.geometry]));
2033
+ const p = featurePoint(_optionalChain([f, 'optionalAccess', _164 => _164.geometry]));
1794
2034
  if (!p) continue;
1795
2035
  add(f.id, p);
1796
2036
  for (const v of Object.values(_nullishCoalesce(f.properties, () => ( {})))) if (typeof v === "string") add(v, p);
@@ -1799,7 +2039,7 @@ function parseGazetteer(json) {
1799
2039
  return { find: (key) => _nullishCoalesce(exact.get(key), () => ( folded.get(key.toLowerCase()))) };
1800
2040
  }
1801
2041
  function featurePoint(geometry) {
1802
- if (!_optionalChain([geometry, 'optionalAccess', _163 => _163.coordinates])) return void 0;
2042
+ if (!_optionalChain([geometry, 'optionalAccess', _165 => _165.coordinates])) return void 0;
1803
2043
  if (geometry.type === "Point") {
1804
2044
  const [lon, lat] = geometry.coordinates;
1805
2045
  return Number.isFinite(lon) && Number.isFinite(lat) ? { lon, lat } : void 0;
@@ -1828,7 +2068,7 @@ function loadGazetteer(path, ds) {
1828
2068
  const json = absolute ? fetch(path).then((r) => {
1829
2069
  if (!r.ok) throw new Error(`${r.status} ${r.statusText}`);
1830
2070
  return r.json();
1831
- }) : _optionalChain([ds, 'optionalAccess', _164 => _164.publicFile]) ? ds.publicFile(path) : Promise.reject(new Error(`${path} is served by Grafana, and this dashboard has no Grafana connection`));
2071
+ }) : _optionalChain([ds, 'optionalAccess', _166 => _166.publicFile]) ? ds.publicFile(path) : Promise.reject(new Error(`${path} is served by Grafana, and this dashboard has no Grafana connection`));
1832
2072
  const run2 = json.then(parseGazetteer);
1833
2073
  run2.catch(() => loaded.get(path) === run2 && loaded.delete(path));
1834
2074
  loaded.set(path, run2);
@@ -1868,7 +2108,7 @@ function macro(path, format3, ctx) {
1868
2108
  switch (head) {
1869
2109
  case "__from":
1870
2110
  case "__to": {
1871
- const ms = head === "__from" ? _optionalChain([ctx, 'access', _165 => _165.range, 'optionalAccess', _166 => _166.from]) : _optionalChain([ctx, 'access', _167 => _167.range, 'optionalAccess', _168 => _168.to]);
2111
+ const ms = head === "__from" ? _optionalChain([ctx, 'access', _167 => _167.range, 'optionalAccess', _168 => _168.from]) : _optionalChain([ctx, 'access', _169 => _169.range, 'optionalAccess', _170 => _170.to]);
1872
2112
  if (ms == null) return void 0;
1873
2113
  if (format3 === "date" || format3 === "date:iso") return new Date(ms).toISOString();
1874
2114
  if (format3 === "date:seconds") return String(Math.floor(ms / 1e3));
@@ -1905,13 +2145,13 @@ function macro(path, format3, ctx) {
1905
2145
  }
1906
2146
  return void 0;
1907
2147
  case "__series":
1908
- return rest[0] === "name" ? _nullishCoalesce(_nullishCoalesce(d.seriesName, () => ( _optionalChain([d, 'access', _169 => _169.frame, 'optionalAccess', _170 => _170.name]))), () => ( d.fieldName)) : void 0;
2148
+ return rest[0] === "name" ? _nullishCoalesce(_nullishCoalesce(d.seriesName, () => ( _optionalChain([d, 'access', _171 => _171.frame, 'optionalAccess', _172 => _172.name]))), () => ( d.fieldName)) : void 0;
1909
2149
  case "__data": {
1910
2150
  const m = /^fields(?:\.([\w-]+)|\["([^"]*)"\]|\[(\d+)\])/.exec(rest.join("."));
1911
2151
  if (!m || !d.frame || d.row == null) return void 0;
1912
2152
  const key = _nullishCoalesce(m[1], () => ( m[2]));
1913
- const f = key != null ? d.frame.fields.find((x) => x.name === key || _optionalChain([x, 'access', _171 => _171.config, 'optionalAccess', _172 => _172.displayName]) === key) : d.frame.fields[Number(m[3])];
1914
- const v = _optionalChain([f, 'optionalAccess', _173 => _173.values, 'access', _174 => _174[d.row]]);
2153
+ const f = key != null ? d.frame.fields.find((x) => x.name === key || _optionalChain([x, 'access', _173 => _173.config, 'optionalAccess', _174 => _174.displayName]) === key) : d.frame.fields[Number(m[3])];
2154
+ const v = _optionalChain([f, 'optionalAccess', _175 => _175.values, 'access', _176 => _176[d.row]]);
1915
2155
  if (v == null) return void 0;
1916
2156
  return f.type === "time" ? String(toMillis(v)) : String(v);
1917
2157
  }
@@ -1922,9 +2162,9 @@ function urlTime(raw, ms) {
1922
2162
  return raw.trim().startsWith("now") ? encodeURIComponent(raw.trim()) : String(ms);
1923
2163
  }
1924
2164
  function allVariables(ctx) {
1925
- const names = (_nullishCoalesce(_optionalChain([ctx, 'access', _175 => _175.dashboard, 'optionalAccess', _176 => _176.templating, 'optionalAccess', _177 => _177.list]), () => ( []))).filter((v) => v.type !== "adhoc").map((v) => v.name);
2165
+ const names = (_nullishCoalesce(_optionalChain([ctx, 'access', _177 => _177.dashboard, 'optionalAccess', _178 => _178.templating, 'optionalAccess', _179 => _179.list]), () => ( []))).filter((v) => v.type !== "adhoc").map((v) => v.name);
1926
2166
  return (names.length ? names : Object.keys(ctx.values)).flatMap((n) => {
1927
- const v = _nullishCoalesce(_optionalChain([ctx, 'access', _178 => _178.scoped, 'optionalAccess', _179 => _179[n], 'optionalAccess', _180 => _180.value]), () => ( ctx.values[n]));
2167
+ const v = _nullishCoalesce(_optionalChain([ctx, 'access', _180 => _180.scoped, 'optionalAccess', _181 => _181[n], 'optionalAccess', _182 => _182.value]), () => ( ctx.values[n]));
1928
2168
  return v == null ? [] : [queryParam(n, v)];
1929
2169
  }).join("&");
1930
2170
  }
@@ -1935,7 +2175,7 @@ function parseDashboardLink(href, grafanaUrl) {
1935
2175
  const base = grafanaUrl ? /^(?:[a-z][a-z0-9+.-]*:)?\/\/([^/?#]+)([^?#]*)/i.exec(grafanaUrl.trim()) : null;
1936
2176
  if (host && (!base || base[1].toLowerCase() !== host.toLowerCase())) return null;
1937
2177
  if (scheme && !/^https?:$/i.test(scheme)) return null;
1938
- const prefix = (_nullishCoalesce(_optionalChain([base, 'optionalAccess', _181 => _181[2]]), () => ( ""))).replace(/\/+$/, "");
2178
+ const prefix = (_nullishCoalesce(_optionalChain([base, 'optionalAccess', _183 => _183[2]]), () => ( ""))).replace(/\/+$/, "");
1939
2179
  const path = prefix && rawPath.startsWith(prefix + "/") ? rawPath.slice(prefix.length) : rawPath;
1940
2180
  const p = /^\/d\/([^/]+)(?:\/[^/]*)?\/?$/.exec(path);
1941
2181
  if (!p) return null;
@@ -1959,12 +2199,12 @@ function decode(s) {
1959
2199
  }
1960
2200
  }
1961
2201
  function applyDashboardLink(dashboard, target) {
1962
- const time = target.from || target.to ? { from: target.from || _optionalChain([dashboard, 'access', _182 => _182.time, 'optionalAccess', _183 => _183.from]) || "now-6h", to: target.to || _optionalChain([dashboard, 'access', _184 => _184.time, 'optionalAccess', _185 => _185.to]) || "now" } : dashboard.time;
1963
- const list = _optionalChain([dashboard, 'access', _186 => _186.templating, 'optionalAccess', _187 => _187.list, 'access', _188 => _188.map, 'call', _189 => _189((v) => {
2202
+ const time = target.from || target.to ? { from: target.from || _optionalChain([dashboard, 'access', _184 => _184.time, 'optionalAccess', _185 => _185.from]) || "now-6h", to: target.to || _optionalChain([dashboard, 'access', _186 => _186.time, 'optionalAccess', _187 => _187.to]) || "now" } : dashboard.time;
2203
+ const list = _optionalChain([dashboard, 'access', _188 => _188.templating, 'optionalAccess', _189 => _189.list, 'access', _190 => _190.map, 'call', _191 => _191((v) => {
1964
2204
  const values = target.vars[v.name];
1965
- if (!_optionalChain([values, 'optionalAccess', _190 => _190.length])) return v;
2205
+ if (!_optionalChain([values, 'optionalAccess', _192 => _192.length])) return v;
1966
2206
  const value = v.multi ? values : values[0];
1967
- const text = (Array.isArray(value) ? value : [value]).map((x) => x === "$__all" ? "All" : _nullishCoalesce(_optionalChain([v, 'access', _191 => _191.options, 'optionalAccess', _192 => _192.find, 'call', _193 => _193((o) => o.value === x), 'optionalAccess', _194 => _194.text]), () => ( x)));
2207
+ const text = (Array.isArray(value) ? value : [value]).map((x) => x === "$__all" ? "All" : _nullishCoalesce(_optionalChain([v, 'access', _193 => _193.options, 'optionalAccess', _194 => _194.find, 'call', _195 => _195((o) => o.value === x), 'optionalAccess', _196 => _196.text]), () => ( x)));
1968
2208
  return { ...v, current: { text: v.multi ? text : text[0], value } };
1969
2209
  })]);
1970
2210
  return { ...dashboard, time, templating: list ? { ...dashboard.templating, list } : dashboard.templating };
@@ -1981,8 +2221,9 @@ var app_schema_default = {
1981
2221
  type: "object",
1982
2222
  properties: {
1983
2223
  version: {
1984
- description: "Format version. Always 1 for now.",
1985
- const: 1
2224
+ type: "integer",
2225
+ description: "The oldest config format that can show this config: 1 unless it uses something newer (see MANIFEST_VERSION). An app that reads only older formats asks to be updated instead.",
2226
+ minimum: 1
1986
2227
  },
1987
2228
  title: {
1988
2229
  type: "string",
@@ -7452,8 +7693,9 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
7452
7693
  }
7453
7694
  }
7454
7695
  if (data.version !== void 0) {
7455
- if (1 !== data.version) {
7456
- const err5 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/const", keyword: "const", params: { allowedValue: 1 }, message: "must be equal to constant" };
7696
+ let data0 = data.version;
7697
+ if (!(typeof data0 == "number" && (!(data0 % 1) && !isNaN(data0)))) {
7698
+ const err5 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
7457
7699
  if (vErrors === null) {
7458
7700
  vErrors = [err5];
7459
7701
  } else {
@@ -7461,25 +7703,36 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
7461
7703
  }
7462
7704
  errors++;
7463
7705
  }
7706
+ if (typeof data0 == "number") {
7707
+ if (data0 < 1 || isNaN(data0)) {
7708
+ const err6 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
7709
+ if (vErrors === null) {
7710
+ vErrors = [err6];
7711
+ } else {
7712
+ vErrors.push(err6);
7713
+ }
7714
+ errors++;
7715
+ }
7716
+ }
7464
7717
  }
7465
7718
  if (data.title !== void 0) {
7466
7719
  let data1 = data.title;
7467
7720
  if (typeof data1 === "string") {
7468
7721
  if (func2(data1) < 1) {
7469
- const err6 = { instancePath: instancePath + "/title", schemaPath: "#/properties/title/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
7722
+ const err7 = { instancePath: instancePath + "/title", schemaPath: "#/properties/title/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
7470
7723
  if (vErrors === null) {
7471
- vErrors = [err6];
7724
+ vErrors = [err7];
7472
7725
  } else {
7473
- vErrors.push(err6);
7726
+ vErrors.push(err7);
7474
7727
  }
7475
7728
  errors++;
7476
7729
  }
7477
7730
  } else {
7478
- const err7 = { instancePath: instancePath + "/title", schemaPath: "#/properties/title/type", keyword: "type", params: { type: "string" }, message: "must be string" };
7731
+ const err8 = { instancePath: instancePath + "/title", schemaPath: "#/properties/title/type", keyword: "type", params: { type: "string" }, message: "must be string" };
7479
7732
  if (vErrors === null) {
7480
- vErrors = [err7];
7733
+ vErrors = [err8];
7481
7734
  } else {
7482
- vErrors.push(err7);
7735
+ vErrors.push(err8);
7483
7736
  }
7484
7737
  errors++;
7485
7738
  }
@@ -7488,11 +7741,11 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
7488
7741
  let data2 = data.tabs;
7489
7742
  if (Array.isArray(data2)) {
7490
7743
  if (data2.length < 1) {
7491
- const err8 = { instancePath: instancePath + "/tabs", schemaPath: "#/properties/tabs/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
7744
+ const err9 = { instancePath: instancePath + "/tabs", schemaPath: "#/properties/tabs/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
7492
7745
  if (vErrors === null) {
7493
- vErrors = [err8];
7746
+ vErrors = [err9];
7494
7747
  } else {
7495
- vErrors.push(err8);
7748
+ vErrors.push(err9);
7496
7749
  }
7497
7750
  errors++;
7498
7751
  }
@@ -7504,11 +7757,11 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
7504
7757
  }
7505
7758
  }
7506
7759
  } else {
7507
- const err9 = { instancePath: instancePath + "/tabs", schemaPath: "#/properties/tabs/type", keyword: "type", params: { type: "array" }, message: "must be array" };
7760
+ const err10 = { instancePath: instancePath + "/tabs", schemaPath: "#/properties/tabs/type", keyword: "type", params: { type: "array" }, message: "must be array" };
7508
7761
  if (vErrors === null) {
7509
- vErrors = [err9];
7762
+ vErrors = [err10];
7510
7763
  } else {
7511
- vErrors.push(err9);
7764
+ vErrors.push(err10);
7512
7765
  }
7513
7766
  errors++;
7514
7767
  }
@@ -7518,42 +7771,42 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
7518
7771
  if (data4 && typeof data4 == "object" && !Array.isArray(data4)) {
7519
7772
  for (const key1 in data4) {
7520
7773
  let data5 = data4[key1];
7521
- const _errs12 = errors;
7522
- let valid4 = false;
7523
7774
  const _errs13 = errors;
7775
+ let valid4 = false;
7776
+ const _errs14 = errors;
7524
7777
  if (typeof data5 !== "string") {
7525
- const err10 = { instancePath: instancePath + "/documents/" + key1.replace(/~/g, "~0").replace(/\//g, "~1"), schemaPath: "#/properties/documents/additionalProperties/anyOf/0/type", keyword: "type", params: { type: "string" }, message: "must be string" };
7778
+ const err11 = { instancePath: instancePath + "/documents/" + key1.replace(/~/g, "~0").replace(/\//g, "~1"), schemaPath: "#/properties/documents/additionalProperties/anyOf/0/type", keyword: "type", params: { type: "string" }, message: "must be string" };
7526
7779
  if (vErrors === null) {
7527
- vErrors = [err10];
7780
+ vErrors = [err11];
7528
7781
  } else {
7529
- vErrors.push(err10);
7782
+ vErrors.push(err11);
7530
7783
  }
7531
7784
  errors++;
7532
7785
  }
7533
- var _valid0 = _errs13 === errors;
7786
+ var _valid0 = _errs14 === errors;
7534
7787
  valid4 = valid4 || _valid0;
7535
7788
  if (!valid4) {
7536
- const _errs15 = errors;
7789
+ const _errs16 = errors;
7537
7790
  if (!validate36(data5, { instancePath: instancePath + "/documents/" + key1.replace(/~/g, "~0").replace(/\//g, "~1"), parentData: data4, parentDataProperty: key1, rootData })) {
7538
7791
  vErrors = vErrors === null ? validate36.errors : vErrors.concat(validate36.errors);
7539
7792
  errors = vErrors.length;
7540
7793
  }
7541
- var _valid0 = _errs15 === errors;
7794
+ var _valid0 = _errs16 === errors;
7542
7795
  valid4 = valid4 || _valid0;
7543
7796
  }
7544
7797
  if (!valid4) {
7545
- const err11 = { instancePath: instancePath + "/documents/" + key1.replace(/~/g, "~0").replace(/\//g, "~1"), schemaPath: "#/properties/documents/additionalProperties/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
7798
+ const err12 = { instancePath: instancePath + "/documents/" + key1.replace(/~/g, "~0").replace(/\//g, "~1"), schemaPath: "#/properties/documents/additionalProperties/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
7546
7799
  if (vErrors === null) {
7547
- vErrors = [err11];
7800
+ vErrors = [err12];
7548
7801
  } else {
7549
- vErrors.push(err11);
7802
+ vErrors.push(err12);
7550
7803
  }
7551
7804
  errors++;
7552
7805
  } else {
7553
- errors = _errs12;
7806
+ errors = _errs13;
7554
7807
  if (vErrors !== null) {
7555
- if (_errs12) {
7556
- vErrors.length = _errs12;
7808
+ if (_errs13) {
7809
+ vErrors.length = _errs13;
7557
7810
  } else {
7558
7811
  vErrors = null;
7559
7812
  }
@@ -7561,21 +7814,21 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
7561
7814
  }
7562
7815
  }
7563
7816
  } else {
7564
- const err12 = { instancePath: instancePath + "/documents", schemaPath: "#/properties/documents/type", keyword: "type", params: { type: "object" }, message: "must be object" };
7817
+ const err13 = { instancePath: instancePath + "/documents", schemaPath: "#/properties/documents/type", keyword: "type", params: { type: "object" }, message: "must be object" };
7565
7818
  if (vErrors === null) {
7566
- vErrors = [err12];
7819
+ vErrors = [err13];
7567
7820
  } else {
7568
- vErrors.push(err12);
7821
+ vErrors.push(err13);
7569
7822
  }
7570
7823
  errors++;
7571
7824
  }
7572
7825
  }
7573
7826
  } else {
7574
- const err13 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
7827
+ const err14 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
7575
7828
  if (vErrors === null) {
7576
- vErrors = [err13];
7829
+ vErrors = [err14];
7577
7830
  } else {
7578
- vErrors.push(err13);
7831
+ vErrors.push(err14);
7579
7832
  }
7580
7833
  errors++;
7581
7834
  }
@@ -8085,7 +8338,7 @@ function removeAt(root, pointer) {
8085
8338
  const segs = pointer.split("/").slice(1).map((s) => s.replace(/~1/g, "/").replace(/~0/g, "~"));
8086
8339
  const last = segs.pop();
8087
8340
  let parent = root;
8088
- for (const s of segs) parent = _optionalChain([parent, 'optionalAccess', _195 => _195[s]]);
8341
+ for (const s of segs) parent = _optionalChain([parent, 'optionalAccess', _197 => _197[s]]);
8089
8342
  if (Array.isArray(parent)) {
8090
8343
  parent.splice(Number(last), 1);
8091
8344
  return { array: parentOf(pointer), index: Number(last) };
@@ -8258,7 +8511,7 @@ var STANDARD = [
8258
8511
  ]
8259
8512
  }
8260
8513
  },
8261
- { path: field("color.fixedColor"), label: "Color", category: "Standard options", control: { kind: "color" }, showIf: (p) => _optionalChain([p, 'access', _196 => _196.fieldConfig, 'optionalAccess', _197 => _197.defaults, 'optionalAccess', _198 => _198.color, 'optionalAccess', _199 => _199.mode]) === "fixed" }
8514
+ { path: field("color.fixedColor"), label: "Color", category: "Standard options", control: { kind: "color" }, showIf: (p) => _optionalChain([p, 'access', _198 => _198.fieldConfig, 'optionalAccess', _199 => _199.defaults, 'optionalAccess', _200 => _200.color, 'optionalAccess', _201 => _201.mode]) === "fixed" }
8262
8515
  ];
8263
8516
  var THRESHOLDS = {
8264
8517
  path: field("thresholds"),
@@ -8284,7 +8537,7 @@ var CALC = {
8284
8537
  default: "lastNotNull",
8285
8538
  control: { kind: "select", choices: Object.entries(REDUCER_LABELS).map(([value, label]) => ({ label, value })) },
8286
8539
  stored: "string[]",
8287
- get: (p) => _optionalChain([p, 'access', _200 => _200.options, 'optionalAccess', _201 => _201.reduceOptions, 'optionalAccess', _202 => _202.calcs, 'optionalAccess', _203 => _203[0]]),
8540
+ get: (p) => _optionalChain([p, 'access', _202 => _202.options, 'optionalAccess', _203 => _203.reduceOptions, 'optionalAccess', _204 => _204.calcs, 'optionalAccess', _205 => _205[0]]),
8288
8541
  set: (p, v) => setOptionValue(p, "options.reduceOptions.calcs", v === void 0 ? void 0 : [v])
8289
8542
  };
8290
8543
  var LEGEND = {
@@ -8294,9 +8547,9 @@ var LEGEND = {
8294
8547
  help: "When there are two or more series.",
8295
8548
  default: true,
8296
8549
  control: { kind: "boolean" },
8297
- get: (p) => _optionalChain([p, 'access', _204 => _204.options, 'optionalAccess', _205 => _205.legend, 'optionalAccess', _206 => _206.showLegend]) !== false && _optionalChain([p, 'access', _207 => _207.options, 'optionalAccess', _208 => _208.legend, 'optionalAccess', _209 => _209.displayMode]) !== "hidden",
8550
+ get: (p) => _optionalChain([p, 'access', _206 => _206.options, 'optionalAccess', _207 => _207.legend, 'optionalAccess', _208 => _208.showLegend]) !== false && _optionalChain([p, 'access', _209 => _209.options, 'optionalAccess', _210 => _210.legend, 'optionalAccess', _211 => _211.displayMode]) !== "hidden",
8298
8551
  // Grafana's older displayMode "hidden" would otherwise keep it hidden.
8299
- set: (p, v) => setOptionValue(v ? setOptionValue(p, "options.legend.displayMode", _optionalChain([p, 'access', _210 => _210.options, 'optionalAccess', _211 => _211.legend, 'optionalAccess', _212 => _212.displayMode]) === "hidden" ? void 0 : _optionalChain([p, 'access', _213 => _213.options, 'optionalAccess', _214 => _214.legend, 'optionalAccess', _215 => _215.displayMode])) : p, "options.legend.showLegend", v ? void 0 : false)
8552
+ set: (p, v) => setOptionValue(v ? setOptionValue(p, "options.legend.displayMode", _optionalChain([p, 'access', _212 => _212.options, 'optionalAccess', _213 => _213.legend, 'optionalAccess', _214 => _214.displayMode]) === "hidden" ? void 0 : _optionalChain([p, 'access', _215 => _215.options, 'optionalAccess', _216 => _216.legend, 'optionalAccess', _217 => _217.displayMode])) : p, "options.legend.showLegend", v ? void 0 : false)
8300
8553
  };
8301
8554
  var AXIS_LABEL = { path: field("custom.axisLabel"), label: "Axis label", category: "Axis", control: { kind: "text" } };
8302
8555
  var AXIS_PLACEMENT = {
@@ -8550,7 +8803,7 @@ function overrideProperties(type) {
8550
8803
  return out;
8551
8804
  }
8552
8805
  function panelOverrides(panel) {
8553
- const o = _optionalChain([panel, 'access', _216 => _216.fieldConfig, 'optionalAccess', _217 => _217.overrides]);
8806
+ const o = _optionalChain([panel, 'access', _218 => _218.fieldConfig, 'optionalAccess', _219 => _219.overrides]);
8554
8807
  return Array.isArray(o) ? o : [];
8555
8808
  }
8556
8809
  function setOverrides(panel, overrides) {
@@ -8559,10 +8812,16 @@ function setOverrides(panel, overrides) {
8559
8812
 
8560
8813
  // src/core/manifest.ts
8561
8814
  var MANIFEST_VERSION = 1;
8815
+ var FORMAT_CHANGES = [];
8816
+ function requiredManifestVersion(bundle) {
8817
+ return Math.max(1, ...FORMAT_CHANGES.filter((c) => c.uses(bundle)).map((c) => c.version));
8818
+ }
8562
8819
  var isObject3 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
8563
8820
  var nonEmptyString = (v) => typeof v === "string" && v.trim() !== "";
8564
8821
  function validateManifest(json, file = "manifest") {
8565
8822
  const error = (path, message) => ({ severity: "error", path: `${file}: ${path}`, message });
8823
+ if (isObject3(json) && typeof json.version === "number" && json.version > MANIFEST_VERSION)
8824
+ return [{ ...error("version", `needs config format ${json.version}, and this app shows up to ${MANIFEST_VERSION}. Update the app to open it.`), code: "newer-version" }];
8566
8825
  const shape = manifestSchemaIssues(json).filter((i) => !/^documents\.[^.[]+[.[]/.test(i.path));
8567
8826
  if (shape.length) return shape.map((i) => error(i.path, i.message));
8568
8827
  const issues = [];
@@ -8592,7 +8851,7 @@ function prepareDashboard(json, file) {
8592
8851
  });
8593
8852
  dashboard.panels.forEach((p, i) => {
8594
8853
  for (const r of cleanPanelOptions(p)) removed.push({ path: `panels[${i}]${r.path}`, message: r.message });
8595
- _optionalChain([p, 'access', _218 => _218.panels, 'optionalAccess', _219 => _219.forEach, 'call', _220 => _220((child, j) => {
8854
+ _optionalChain([p, 'access', _220 => _220.panels, 'optionalAccess', _221 => _221.forEach, 'call', _222 => _222((child, j) => {
8596
8855
  for (const r of cleanPanelOptions(child)) removed.push({ path: `panels[${i}].panels[${j}]${r.path}`, message: r.message });
8597
8856
  })]);
8598
8857
  });
@@ -8615,7 +8874,7 @@ function groupIssues(dashboard) {
8615
8874
  for (const { p, at } of located2) if (isInputPanel(p) && !recordedAt.has(p.options.metric)) recordedAt.set(p.options.metric, at);
8616
8875
  for (const { p, at } of located2) {
8617
8876
  if (p.type !== INPUT_GROUP) continue;
8618
- const fields = _optionalChain([p, 'access', _221 => _221.options, 'optionalAccess', _222 => _222.fields]);
8877
+ const fields = _optionalChain([p, 'access', _223 => _223.options, 'optionalAccess', _224 => _224.fields]);
8619
8878
  if (!Array.isArray(fields) || !fields.length) {
8620
8879
  out.push({ path: `${at}.options.fields`, message: "a group needs at least one field" });
8621
8880
  continue;
@@ -8632,7 +8891,7 @@ function groupIssues(dashboard) {
8632
8891
  else recordedAt.set(metric, fat);
8633
8892
  mine.push(metric);
8634
8893
  });
8635
- const titleFrom = _optionalChain([p, 'access', _223 => _223.options, 'optionalAccess', _224 => _224.titleFrom]);
8894
+ const titleFrom = _optionalChain([p, 'access', _225 => _225.options, 'optionalAccess', _226 => _226.titleFrom]);
8636
8895
  if (titleFrom !== void 0 && !mine.includes(titleFrom)) out.push({ path: `${at}.options.titleFrom`, message: `must be the metric of one of the group\u2019s fields` });
8637
8896
  }
8638
8897
  return out;
@@ -8643,7 +8902,7 @@ function panelProblem(p) {
8643
8902
  const g = p.gridPos;
8644
8903
  if (!isObject3(g) || !["x", "y", "w", "h"].every((k) => typeof g[k] === "number"))
8645
8904
  return { at: ".gridPos", message: "must have numeric x, y, w and h", summary: "has no usable gridPos" };
8646
- if (p.type.startsWith("input-") && p.type !== INPUT_GROUP && !nonEmptyString(_optionalChain([p, 'access', _225 => _225.options, 'optionalAccess', _226 => _226.metric]))) {
8905
+ if (p.type.startsWith("input-") && p.type !== INPUT_GROUP && !nonEmptyString(_optionalChain([p, 'access', _227 => _227.options, 'optionalAccess', _228 => _228.metric]))) {
8647
8906
  const message = `${p.type} needs a metric to record to`;
8648
8907
  return { at: ".options.metric", message, summary: message };
8649
8908
  }
@@ -8719,17 +8978,17 @@ function resolveUrl(base, rel) {
8719
8978
  function httpFetchJson(options = {}) {
8720
8979
  const seen = /* @__PURE__ */ new Map();
8721
8980
  return async (url, { accept = "application/json", signal } = {}) => {
8722
- const extra = await _asyncNullishCoalesce(await _optionalChain([options, 'access', _227 => _227.headers, 'optionalCall', _228 => _228()]), async () => ( {}));
8981
+ const extra = await _asyncNullishCoalesce(await _optionalChain([options, 'access', _229 => _229.headers, 'optionalCall', _230 => _230()]), async () => ( {}));
8723
8982
  const key = JSON.stringify([url, accept, extra]);
8724
8983
  const last = seen.get(key);
8725
8984
  const get = (etag2) => fetch(url, { headers: { Accept: accept, ...extra, ...etag2 && { "If-None-Match": etag2 } }, cache: "no-store", signal });
8726
- const res = await get(_optionalChain([last, 'optionalAccess', _229 => _229.etag])).catch((e) => {
8727
- if (!last || _optionalChain([signal, 'optionalAccess', _230 => _230.aborted])) throw e;
8985
+ const res = await get(_optionalChain([last, 'optionalAccess', _231 => _231.etag])).catch((e) => {
8986
+ if (!last || _optionalChain([signal, 'optionalAccess', _232 => _232.aborted])) throw e;
8728
8987
  seen.delete(key);
8729
8988
  return get();
8730
8989
  });
8731
8990
  if (res.status === 304 && last) return last.json;
8732
- if (!res.ok) throw new Error(_nullishCoalesce(_optionalChain([options, 'access', _231 => _231.httpError, 'optionalCall', _232 => _232(res.status)]), () => ( `HTTP ${res.status}`)));
8991
+ if (!res.ok) throw new Error(_nullishCoalesce(_optionalChain([options, 'access', _233 => _233.httpError, 'optionalCall', _234 => _234(res.status)]), () => ( `HTTP ${res.status}`)));
8733
8992
  const json = JSON.parse(await res.text());
8734
8993
  const etag = res.headers.get("ETag");
8735
8994
  if (etag) seen.set(key, { etag, json });
@@ -8851,8 +9110,8 @@ var ConfigLoader = (_class2 = class {
8851
9110
  async start() {
8852
9111
  const { url, cache: cache2 } = this.options;
8853
9112
  if (!url) return;
8854
- const cached = await _optionalChain([cache2, 'optionalAccess', _233 => _233.read, 'call', _234 => _234(), 'access', _235 => _235.catch, 'call', _236 => _236(() => null)]);
8855
- const bundle = _optionalChain([cached, 'optionalAccess', _237 => _237.url]) === url ? revalidateBundle(cached.bundle) : void 0;
9113
+ const cached = await _optionalChain([cache2, 'optionalAccess', _235 => _235.read, 'call', _236 => _236(), 'access', _237 => _237.catch, 'call', _238 => _238(() => null)]);
9114
+ const bundle = _optionalChain([cached, 'optionalAccess', _239 => _239.url]) === url ? revalidateBundle(cached.bundle) : void 0;
8856
9115
  if (cached && bundle && !this.snapshot.fetchedAt) {
8857
9116
  this.lastJson = JSON.stringify(bundle);
8858
9117
  this.set({ bundle, source: "cache", fetchedAt: cached.fetchedAt, revision: cached.revision });
@@ -8881,21 +9140,22 @@ var ConfigLoader = (_class2 = class {
8881
9140
  const { bundle, issues, revision, unreachable } = result;
8882
9141
  if (!bundle) {
8883
9142
  const errors = issues.filter((i) => i.severity === "error").length;
8884
- const error = unreachable ? _optionalChain([issues, 'access', _238 => _238[0], 'optionalAccess', _239 => _239.message]) : errors === 1 ? "1 error" : `${errors} errors`;
9143
+ const needsUpdate = issues.some((i) => i.code === "newer-version");
9144
+ const error = unreachable ? _optionalChain([issues, 'access', _240 => _240[0], 'optionalAccess', _241 => _241.message]) : needsUpdate ? "a newer format" : errors === 1 ? "1 error" : `${errors} errors`;
8885
9145
  return this.set(
8886
- { loading: false, error, unreachable: !!unreachable, issues },
8887
- this.snapshot.loading || error !== this.snapshot.error || !!unreachable !== !!this.snapshot.unreachable || !sameIssues(issues, this.snapshot.issues)
9146
+ { loading: false, error, unreachable: !!unreachable, needsUpdate, issues },
9147
+ this.snapshot.loading || error !== this.snapshot.error || !!unreachable !== !!this.snapshot.unreachable || needsUpdate !== !!this.snapshot.needsUpdate || !sameIssues(issues, this.snapshot.issues)
8888
9148
  );
8889
9149
  }
8890
9150
  const json = JSON.stringify(bundle);
8891
9151
  const changed = json !== this.lastJson;
8892
9152
  this.lastJson = json;
8893
9153
  const fetchedAt = Date.now();
8894
- if (changed || revision !== this.snapshot.revision) _optionalChain([cache2, 'optionalAccess', _240 => _240.write, 'call', _241 => _241({ url, fetchedAt, bundle, revision }), 'access', _242 => _242.catch, 'call', _243 => _243(() => {
9154
+ if (changed || revision !== this.snapshot.revision) _optionalChain([cache2, 'optionalAccess', _242 => _242.write, 'call', _243 => _243({ url, fetchedAt, bundle, revision }), 'access', _244 => _244.catch, 'call', _245 => _245(() => {
8895
9155
  })]);
8896
9156
  this.set(
8897
- { ...changed && { bundle }, source: "remote", fetchedAt, revision, loading: false, error: void 0, unreachable: void 0, issues },
8898
- changed || revision !== this.snapshot.revision || this.snapshot.source !== "remote" || !!this.snapshot.error || this.snapshot.loading || !sameIssues(issues, this.snapshot.issues)
9157
+ { ...changed && { bundle }, source: "remote", fetchedAt, revision, loading: false, error: void 0, unreachable: void 0, needsUpdate: void 0, issues },
9158
+ changed || revision !== this.snapshot.revision || this.snapshot.source !== "remote" || !!this.snapshot.error || !!this.snapshot.needsUpdate || this.snapshot.loading || !sameIssues(issues, this.snapshot.issues)
8899
9159
  );
8900
9160
  } finally {
8901
9161
  clearTimeout(timer);
@@ -8908,7 +9168,7 @@ var ConfigLoader = (_class2 = class {
8908
9168
  /** Stops the loader: cancels a fetch in flight, and nothing it does afterwards changes the state or the cache. */
8909
9169
  dispose() {
8910
9170
  this.disposed = true;
8911
- _optionalChain([this, 'access', _244 => _244.controller, 'optionalAccess', _245 => _245.abort, 'call', _246 => _246()]);
9171
+ _optionalChain([this, 'access', _246 => _246.controller, 'optionalAccess', _247 => _247.abort, 'call', _248 => _248()]);
8912
9172
  this.listeners.clear();
8913
9173
  }
8914
9174
  /** `notify: false` drops the patch, so the snapshot only changes when listeners hear about it. */
@@ -8929,7 +9189,7 @@ function tabIdFor(title, taken) {
8929
9189
  }
8930
9190
  function screenOfType(type, from, docs) {
8931
9191
  const shown = from ? screenDocuments(from) : [];
8932
- const firstOf = (ids) => _nullishCoalesce(_nullishCoalesce(_optionalChain([shown, 'access', _247 => _247.find, 'call', _248 => _248((d) => ids.includes(d.id)), 'optionalAccess', _249 => _249.id]), () => ( ids[0])), () => ( ""));
9192
+ const firstOf = (ids) => _nullishCoalesce(_nullishCoalesce(_optionalChain([shown, 'access', _249 => _249.find, 'call', _250 => _250((d) => ids.includes(d.id)), 'optionalAccess', _251 => _251.id]), () => ( ids[0])), () => ( ""));
8933
9193
  switch (type) {
8934
9194
  case "dashboard":
8935
9195
  return { type, dashboard: firstOf(docs.dashboards) };
@@ -8942,7 +9202,7 @@ function screenOfType(type, from, docs) {
8942
9202
  }
8943
9203
  }
8944
9204
  function screenDocuments(screen) {
8945
- switch (_optionalChain([screen, 'optionalAccess', _250 => _250.type])) {
9205
+ switch (_optionalChain([screen, 'optionalAccess', _252 => _252.type])) {
8946
9206
  case "dashboard":
8947
9207
  return [{ id: screen.dashboard, kind: "dashboard" }];
8948
9208
  case "forms":
@@ -10357,8 +10617,8 @@ function removeNode(text, path) {
10357
10617
  const tree = parseTree2(text);
10358
10618
  const value = tree && findNodeAtLocation2(tree, path);
10359
10619
  if (!value) return text;
10360
- const node = _optionalChain([value, 'access', _251 => _251.parent, 'optionalAccess', _252 => _252.type]) === "property" ? value.parent : value;
10361
- const siblings = _nullishCoalesce(_optionalChain([node, 'access', _253 => _253.parent, 'optionalAccess', _254 => _254.children]), () => ( []));
10620
+ const node = _optionalChain([value, 'access', _253 => _253.parent, 'optionalAccess', _254 => _254.type]) === "property" ? value.parent : value;
10621
+ const siblings = _nullishCoalesce(_optionalChain([node, 'access', _255 => _255.parent, 'optionalAccess', _256 => _256.children]), () => ( []));
10362
10622
  const i = siblings.indexOf(node);
10363
10623
  const next = siblings[i + 1];
10364
10624
  const prev = siblings[i - 1];
@@ -10441,20 +10701,20 @@ function removeDocumentFromManifest(text, id) {
10441
10701
  const edits = [];
10442
10702
  const removedTabs = [];
10443
10703
  for (let i = tabs.length - 1; i >= 0; i--) {
10444
- const screen = _optionalChain([tabs, 'access', _255 => _255[i], 'optionalAccess', _256 => _256.screen]);
10704
+ const screen = _optionalChain([tabs, 'access', _257 => _257[i], 'optionalAccess', _258 => _258.screen]);
10445
10705
  const at = ["tabs", i, "screen"];
10446
10706
  const removeTab = () => {
10447
10707
  edits.push({ path: ["tabs", i], remove: true });
10448
10708
  removedTabs.unshift(_nullishCoalesce(tabs[i].title, () => ( tabs[i].id)));
10449
10709
  };
10450
- if (_optionalChain([screen, 'optionalAccess', _257 => _257.type]) === "dashboard" && screen.dashboard === id) removeTab();
10451
- else if (_optionalChain([screen, 'optionalAccess', _258 => _258.type]) === "forms" && Array.isArray(screen.forms) && screen.forms.includes(id)) {
10710
+ if (_optionalChain([screen, 'optionalAccess', _259 => _259.type]) === "dashboard" && screen.dashboard === id) removeTab();
10711
+ else if (_optionalChain([screen, 'optionalAccess', _260 => _260.type]) === "forms" && Array.isArray(screen.forms) && screen.forms.includes(id)) {
10452
10712
  if (screen.forms.every((f) => f === id)) removeTab();
10453
10713
  else for (let j = screen.forms.length - 1; j >= 0; j--) if (screen.forms[j] === id) edits.push({ path: [...at, "forms", j], remove: true });
10454
- } else if (_optionalChain([screen, 'optionalAccess', _259 => _259.type]) === "menu" && Array.isArray(screen.items))
10714
+ } else if (_optionalChain([screen, 'optionalAccess', _261 => _261.type]) === "menu" && Array.isArray(screen.items))
10455
10715
  for (let j = screen.items.length - 1; j >= 0; j--) {
10456
10716
  const item = screen.items[j];
10457
- if (_optionalChain([item, 'optionalAccess', _260 => _260.dashboard]) === id || _optionalChain([item, 'optionalAccess', _261 => _261.form]) === id) edits.push({ path: [...at, "items", j], remove: true });
10717
+ if (_optionalChain([item, 'optionalAccess', _262 => _262.dashboard]) === id || _optionalChain([item, 'optionalAccess', _263 => _263.form]) === id) edits.push({ path: [...at, "items", j], remove: true });
10458
10718
  }
10459
10719
  }
10460
10720
  if (tabs.length && removedTabs.length === tabs.length) throw new Error(`Every tab shows only "${id}". Add another tab first`);
@@ -10467,21 +10727,21 @@ function renameDocumentInManifest(text, from, to, path) {
10467
10727
  if (to !== from && to in manifest.documents) throw new Error(`There\u2019s already a document "${to}"`);
10468
10728
  const edits = [];
10469
10729
  (Array.isArray(manifest.tabs) ? manifest.tabs : []).forEach((tab, i) => {
10470
- const screen = _optionalChain([tab, 'optionalAccess', _262 => _262.screen]);
10730
+ const screen = _optionalChain([tab, 'optionalAccess', _264 => _264.screen]);
10471
10731
  const at = ["tabs", i, "screen"];
10472
- if (_optionalChain([screen, 'optionalAccess', _263 => _263.type]) === "dashboard" && screen.dashboard === from) edits.push({ path: [...at, "dashboard"], value: to });
10473
- if (_optionalChain([screen, 'optionalAccess', _264 => _264.type]) === "forms" && Array.isArray(screen.forms))
10732
+ if (_optionalChain([screen, 'optionalAccess', _265 => _265.type]) === "dashboard" && screen.dashboard === from) edits.push({ path: [...at, "dashboard"], value: to });
10733
+ if (_optionalChain([screen, 'optionalAccess', _266 => _266.type]) === "forms" && Array.isArray(screen.forms))
10474
10734
  screen.forms.forEach((f, j) => f === from && edits.push({ path: [...at, "forms", j], value: to }));
10475
- if (_optionalChain([screen, 'optionalAccess', _265 => _265.type]) === "menu" && Array.isArray(screen.items))
10735
+ if (_optionalChain([screen, 'optionalAccess', _267 => _267.type]) === "menu" && Array.isArray(screen.items))
10476
10736
  screen.items.forEach((item, j) => {
10477
- if (_optionalChain([item, 'optionalAccess', _266 => _266.dashboard]) === from) edits.push({ path: [...at, "items", j, "dashboard"], value: to });
10478
- if (_optionalChain([item, 'optionalAccess', _267 => _267.form]) === from) edits.push({ path: [...at, "items", j, "form"], value: to });
10737
+ if (_optionalChain([item, 'optionalAccess', _268 => _268.dashboard]) === from) edits.push({ path: [...at, "items", j, "dashboard"], value: to });
10738
+ if (_optionalChain([item, 'optionalAccess', _269 => _269.form]) === from) edits.push({ path: [...at, "items", j, "form"], value: to });
10479
10739
  });
10480
10740
  });
10481
10741
  if (path !== void 0) edits.push({ path: ["documents", from], value: path });
10482
10742
  let out = applyJsonEdits(text, edits);
10483
10743
  if (to !== from) {
10484
- const key = _optionalChain([findNodeAtLocation2, 'call', _268 => _268(parseTree2(out), ["documents", from]), 'optionalAccess', _269 => _269.parent, 'optionalAccess', _270 => _270.children, 'optionalAccess', _271 => _271[0]]);
10744
+ const key = _optionalChain([findNodeAtLocation2, 'call', _270 => _270(parseTree2(out), ["documents", from]), 'optionalAccess', _271 => _271.parent, 'optionalAccess', _272 => _272.children, 'optionalAccess', _273 => _273[0]]);
10485
10745
  if (key) out = out.slice(0, key.offset) + JSON.stringify(to) + out.slice(key.offset + key.length);
10486
10746
  }
10487
10747
  return out;
@@ -10502,7 +10762,7 @@ function inputs(text) {
10502
10762
  if (d)
10503
10763
  for (const p of d.panels.flatMap((x) => x.type === "row" ? [x, ..._nullishCoalesce(x.panels, () => ( []))] : [x])) {
10504
10764
  if (typeof p.id !== "number") continue;
10505
- if (isInputGroup(p)) p.options.fields.forEach((f, i) => typeof _optionalChain([f, 'optionalAccess', _272 => _272.options, 'optionalAccess', _273 => _273.metric]) === "string" && out.set(`${p.id}.${i}`, { metric: f.options.metric, title: f.title }));
10765
+ if (isInputGroup(p)) p.options.fields.forEach((f, i) => typeof _optionalChain([f, 'optionalAccess', _274 => _274.options, 'optionalAccess', _275 => _275.metric]) === "string" && out.set(`${p.id}.${i}`, { metric: f.options.metric, title: f.title }));
10506
10766
  else if (isInputPanel(p)) out.set(String(p.id), { metric: p.options.metric, title: p.title });
10507
10767
  }
10508
10768
  } catch (e15) {
@@ -10512,7 +10772,7 @@ function inputs(text) {
10512
10772
  function reads(text, metric) {
10513
10773
  const d = parse2(text);
10514
10774
  const panels = d ? d.panels.flatMap((p) => p.type === "row" ? [p, ..._nullishCoalesce(p.panels, () => ( []))] : [p]) : [];
10515
- return panels.some((p) => (_nullishCoalesce(_optionalChain([p, 'optionalAccess', _274 => _274.targets]), () => ( []))).some((t) => t.metric === metric));
10775
+ return panels.some((p) => (_nullishCoalesce(_optionalChain([p, 'optionalAccess', _276 => _276.targets]), () => ( []))).some((t) => t.metric === metric));
10516
10776
  }
10517
10777
  function metricChanges(before, after) {
10518
10778
  const merged = { ...before, ...after };
@@ -10527,7 +10787,7 @@ function metricChanges(before, after) {
10527
10787
  for (const [file, text] of Object.entries(after)) {
10528
10788
  const old = inputs(before[file]);
10529
10789
  for (const [id, input] of inputs(text))
10530
- if (_optionalChain([old, 'access', _275 => _275.get, 'call', _276 => _276(id), 'optionalAccess', _277 => _277.metric]) === metric && input.metric !== metric) rename ??= { metric, renamedTo: input.metric, file, input: input.title, readBy };
10790
+ if (_optionalChain([old, 'access', _277 => _277.get, 'call', _278 => _278(id), 'optionalAccess', _279 => _279.metric]) === metric && input.metric !== metric) rename ??= { metric, renamedTo: input.metric, file, input: input.title, readBy };
10531
10791
  }
10532
10792
  changes.push(_nullishCoalesce(rename, () => ( { metric, readBy })));
10533
10793
  }
@@ -10567,14 +10827,14 @@ function variableWithType(v, type) {
10567
10827
  }
10568
10828
  function currentFor(v, value) {
10569
10829
  const options = variableOptions({ ...v, current: void 0 });
10570
- const text = (x) => x === ALL ? "All" : _nullishCoalesce(_optionalChain([options, 'access', _278 => _278.find, 'call', _279 => _279((o) => o.value === x), 'optionalAccess', _280 => _280.text]), () => ( x));
10830
+ const text = (x) => x === ALL ? "All" : _nullishCoalesce(_optionalChain([options, 'access', _280 => _280.find, 'call', _281 => _281((o) => o.value === x), 'optionalAccess', _282 => _282.text]), () => ( x));
10571
10831
  return Array.isArray(value) ? { text: value.map(text), value } : { text: text(value), value };
10572
10832
  }
10573
10833
  function variableWithQuery(v, query) {
10574
10834
  const { options: _, current, ...rest } = v;
10575
10835
  const next = { ...rest, query };
10576
10836
  if (v.type === "textbox" || v.type === "constant") return { ...next, current: { text: query, value: query } };
10577
- const value = selectValue(next, _optionalChain([current, 'optionalAccess', _281 => _281.value]), variableOptions(next));
10837
+ const value = selectValue(next, _optionalChain([current, 'optionalAccess', _283 => _283.value]), variableOptions(next));
10578
10838
  return { ...next, current: currentFor(next, value) };
10579
10839
  }
10580
10840
  function variableWithCurrent(v, value) {
@@ -10584,13 +10844,13 @@ function variableWithFlags(v, flags) {
10584
10844
  const next = { ...v, ...flags };
10585
10845
  if (!next.multi) delete next.multi;
10586
10846
  if (!next.includeAll) delete next.includeAll;
10587
- const raw = _optionalChain([v, 'access', _282 => _282.current, 'optionalAccess', _283 => _283.value]);
10847
+ const raw = _optionalChain([v, 'access', _284 => _284.current, 'optionalAccess', _285 => _285.value]);
10588
10848
  const current = next.multi ? raw == null ? [] : Array.isArray(raw) ? raw : [raw] : Array.isArray(raw) ? raw[0] : raw;
10589
10849
  return variableWithCurrent(next, selectValue(next, current, variableOptions({ ...next, current: void 0 })));
10590
10850
  }
10591
10851
  var refers = (name, flags) => new RegExp(`\\$${name}\\b|\\$\\{${name}(:\\w+)?\\}|\\[\\[${name}(:\\w+)?\\]\\]`, flags);
10592
10852
  function allPanels2(dashboard) {
10593
- return (_nullishCoalesce(dashboard.panels, () => ( []))).flatMap((p) => _optionalChain([p, 'optionalAccess', _284 => _284.type]) === "row" ? [p, ..._nullishCoalesce(p.panels, () => ( []))] : [p]).filter((p) => p && typeof p === "object");
10853
+ return (_nullishCoalesce(dashboard.panels, () => ( []))).flatMap((p) => _optionalChain([p, 'optionalAccess', _286 => _286.type]) === "row" ? [p, ..._nullishCoalesce(p.panels, () => ( []))] : [p]).filter((p) => p && typeof p === "object");
10594
10854
  }
10595
10855
  function variableUses(dashboard, name) {
10596
10856
  const re = refers(name);
@@ -10662,7 +10922,7 @@ function locate(text, tree, path) {
10662
10922
  for (let n = segs.length; n >= 0; n--) {
10663
10923
  const node = findNodeAtLocation2(tree, segs.slice(0, n));
10664
10924
  if (!node) continue;
10665
- const key = _optionalChain([node, 'access', _285 => _285.parent, 'optionalAccess', _286 => _286.type]) === "property" ? _optionalChain([node, 'access', _287 => _287.parent, 'access', _288 => _288.children, 'optionalAccess', _289 => _289[0]]) : void 0;
10925
+ const key = _optionalChain([node, 'access', _287 => _287.parent, 'optionalAccess', _288 => _288.type]) === "property" ? _optionalChain([node, 'access', _289 => _289.parent, 'access', _290 => _290.children, 'optionalAccess', _291 => _291[0]]) : void 0;
10666
10926
  if ((node.type === "object" || node.type === "array") && key) return located(text, key.offset, key.length);
10667
10927
  if (node.type === "object" || node.type === "array") return located(text, node.offset, 1);
10668
10928
  return located(text, node.offset, node.length);
@@ -10796,7 +11056,7 @@ async function errorText(res) {
10796
11056
  }
10797
11057
  }
10798
11058
  async function authHeaders(token) {
10799
- const t = await _optionalChain([token, 'optionalCall', _290 => _290()]);
11059
+ const t = await _optionalChain([token, 'optionalCall', _292 => _292()]);
10800
11060
  return t ? { Authorization: `Bearer ${t}` } : {};
10801
11061
  }
10802
11062
  var HttpConfigFiles = (_class3 = class {
@@ -10902,14 +11162,14 @@ function fetchJsonWithToken(token) {
10902
11162
  return httpFetchJson({ headers: () => authHeaders(token), httpError: (status) => status === 401 ? "not signed in" : `HTTP ${status}` });
10903
11163
  }
10904
11164
  async function readConfigFiles(source) {
10905
- const all = await _optionalChain([source, 'access', _291 => _291.readAll, 'optionalCall', _292 => _292()]);
11165
+ const all = await _optionalChain([source, 'access', _293 => _293.readAll, 'optionalCall', _294 => _294()]);
10906
11166
  const read = all ? async (p) => {
10907
11167
  if (!(p in all)) throw new Error(NOT_FOUND);
10908
11168
  return all[p];
10909
11169
  } : (p) => source.read(p);
10910
11170
  const files = { [source.manifestPath]: await read(source.manifestPath) };
10911
11171
  const { value } = parseJsonText(files[source.manifestPath]);
10912
- const documents = _nullishCoalesce(_optionalChain([value, 'optionalAccess', _293 => _293.documents]), () => ( {}));
11172
+ const documents = _nullishCoalesce(_optionalChain([value, 'optionalAccess', _295 => _295.documents]), () => ( {}));
10913
11173
  const paths = [...new Set(Object.values(documents).filter((d) => typeof d === "string"))];
10914
11174
  await Promise.all(
10915
11175
  paths.map(async (p) => {
@@ -10963,7 +11223,7 @@ var CANVAS_ROW_HEADER = 32;
10963
11223
  function panelSize(panel, mode) {
10964
11224
  const p = pos(panel);
10965
11225
  if (mode === "grid") return { span: clampW(p.w), h: clampH(p.h) };
10966
- return { span: panelSpan(panel, "phone"), h: clampH(_nullishCoalesce(_optionalChain([panel, 'access', _294 => _294.mobile, 'optionalAccess', _295 => _295.h]), () => ( p.h))) };
11226
+ return { span: panelSpan(panel, "phone"), h: clampH(_nullishCoalesce(_optionalChain([panel, 'access', _296 => _296.mobile, 'optionalAccess', _297 => _297.h]), () => ( p.h))) };
10967
11227
  }
10968
11228
  function layoutCanvas(panels, order, mode, width, override) {
10969
11229
  return mode === "grid" ? layoutGridCanvas(panels, width, override) : layoutPhoneCanvas(panels, order, width, override);
@@ -10983,7 +11243,7 @@ function layoutGridCanvas(panels, width, override) {
10983
11243
  boxes = [...boxes];
10984
11244
  boxes[override.index] = b;
10985
11245
  }
10986
- const settled = settleBoxes(boxes, _optionalChain([override, 'optionalAccess', _296 => _296.index]));
11246
+ const settled = settleBoxes(boxes, _optionalChain([override, 'optionalAccess', _298 => _298.index]));
10987
11247
  const items = settled.map((b, index) => {
10988
11248
  const row = isRow(panels[index]);
10989
11249
  return { index, row, x: b.x * colW, y: gridOffsetPx(b.y), width: b.w * colW - CANVAS_GAP, height: row ? gridUnitsToPx(1) : gridUnitsToPx(b.h), span: b.w, h: b.h };
@@ -11027,12 +11287,12 @@ function layoutPhoneCanvas(panels, order, width, override) {
11027
11287
  y += CANVAS_ROW_HEADER + CANVAS_GAP;
11028
11288
  continue;
11029
11289
  }
11030
- if (mode === "phone" && _optionalChain([panel, 'access', _297 => _297.mobile, 'optionalAccess', _298 => _298.hidden])) {
11290
+ if (mode === "phone" && _optionalChain([panel, 'access', _299 => _299.mobile, 'optionalAccess', _300 => _300.hidden])) {
11031
11291
  hidden.push(index);
11032
11292
  continue;
11033
11293
  }
11034
11294
  const natural = panelSize(panel, mode);
11035
- const size = _optionalChain([override, 'optionalAccess', _299 => _299.index]) === index ? { span: clampW(_nullishCoalesce(override.span, () => ( natural.span))), h: clampH(_nullishCoalesce(override.h, () => ( natural.h))) } : natural;
11295
+ const size = _optionalChain([override, 'optionalAccess', _301 => _301.index]) === index ? { span: clampW(_nullishCoalesce(override.span, () => ( natural.span))), h: clampH(_nullishCoalesce(override.h, () => ( natural.h))) } : natural;
11036
11296
  if (used + size.span > GRID_COLUMNS) flush();
11037
11297
  line.push({ index, row: false, x: 0, y: 0, width: 0, height: 0, ...size });
11038
11298
  used += size.span;
@@ -11050,7 +11310,7 @@ function dropTarget(canvas, x, y, dragging) {
11050
11310
  for (const c of pool) if (distance(c) < distance(best)) best = c;
11051
11311
  const after = best.row ? y > best.y + best.height / 2 : x > best.x + best.width / 2;
11052
11312
  if (!after) return best.index;
11053
- return _nullishCoalesce(_optionalChain([items, 'access', _300 => _300[items.indexOf(best) + 1], 'optionalAccess', _301 => _301.index]), () => ( null));
11313
+ return _nullishCoalesce(_optionalChain([items, 'access', _302 => _302[items.indexOf(best) + 1], 'optionalAccess', _303 => _303.index]), () => ( null));
11054
11314
  }
11055
11315
  function movePanel(panels, index, before) {
11056
11316
  if (before === index) return panels;
@@ -11262,9 +11522,9 @@ var refers2 = (name) => new RegExp(`\\$${name}\\b|\\$\\{${name}(:\\w+)?\\}|\\[\\
11262
11522
  var withChildren = (p) => [p, ...isRow(p) ? _nullishCoalesce(p.panels, () => ( [])) : []];
11263
11523
  function panelMetrics(p) {
11264
11524
  const found = [];
11265
- if (isInputType(p.type) && typeof _optionalChain([p, 'access', _302 => _302.options, 'optionalAccess', _303 => _303.metric]) === "string") found.push(p.options.metric);
11266
- if (p.type === INPUT_GROUP && Array.isArray(_optionalChain([p, 'access', _304 => _304.options, 'optionalAccess', _305 => _305.fields]))) {
11267
- for (const f of p.options.fields) if (typeof _optionalChain([f, 'optionalAccess', _306 => _306.options, 'optionalAccess', _307 => _307.metric]) === "string") found.push(f.options.metric);
11525
+ if (isInputType(p.type) && typeof _optionalChain([p, 'access', _304 => _304.options, 'optionalAccess', _305 => _305.metric]) === "string") found.push(p.options.metric);
11526
+ if (p.type === INPUT_GROUP && Array.isArray(_optionalChain([p, 'access', _306 => _306.options, 'optionalAccess', _307 => _307.fields]))) {
11527
+ for (const f of p.options.fields) if (typeof _optionalChain([f, 'optionalAccess', _308 => _308.options, 'optionalAccess', _309 => _309.metric]) === "string") found.push(f.options.metric);
11268
11528
  }
11269
11529
  for (const t of _nullishCoalesce(p.targets, () => ( []))) if (typeof t.metric === "string" && t.metric && !t.metric.startsWith("$")) found.push(t.metric);
11270
11530
  return found;
@@ -11272,15 +11532,15 @@ function panelMetrics(p) {
11272
11532
  function renameMetrics(panels, map) {
11273
11533
  const rename = (p) => {
11274
11534
  let out = p;
11275
- if (isInputType(p.type) && typeof _optionalChain([p, 'access', _308 => _308.options, 'optionalAccess', _309 => _309.metric]) === "string" && map[p.options.metric]) out = { ...out, options: { ...out.options, metric: map[p.options.metric] } };
11276
- if (p.type === INPUT_GROUP && Array.isArray(_optionalChain([p, 'access', _310 => _310.options, 'optionalAccess', _311 => _311.fields]))) {
11535
+ if (isInputType(p.type) && typeof _optionalChain([p, 'access', _310 => _310.options, 'optionalAccess', _311 => _311.metric]) === "string" && map[p.options.metric]) out = { ...out, options: { ...out.options, metric: map[p.options.metric] } };
11536
+ if (p.type === INPUT_GROUP && Array.isArray(_optionalChain([p, 'access', _312 => _312.options, 'optionalAccess', _313 => _313.fields]))) {
11277
11537
  const to = (m) => typeof m === "string" && map[m] || m;
11278
- const fields = p.options.fields.map((f) => _optionalChain([f, 'optionalAccess', _312 => _312.options]) && to(f.options.metric) !== f.options.metric ? { ...f, options: { ...f.options, metric: to(f.options.metric) } } : f);
11538
+ const fields = p.options.fields.map((f) => _optionalChain([f, 'optionalAccess', _314 => _314.options]) && to(f.options.metric) !== f.options.metric ? { ...f, options: { ...f.options, metric: to(f.options.metric) } } : f);
11279
11539
  const titleFrom = to(p.options.titleFrom);
11280
11540
  out = { ...out, options: { ...out.options, fields, ...titleFrom !== void 0 && { titleFrom } } };
11281
11541
  }
11282
- if (_optionalChain([p, 'access', _313 => _313.targets, 'optionalAccess', _314 => _314.some, 'call', _315 => _315((t) => typeof t.metric === "string" && map[t.metric])])) out = { ...out, targets: p.targets.map((t) => typeof t.metric === "string" && map[t.metric] ? { ...t, metric: map[t.metric] } : t) };
11283
- if (_optionalChain([p, 'access', _316 => _316.panels, 'optionalAccess', _317 => _317.length])) out = { ...out, panels: p.panels.map(rename) };
11542
+ if (_optionalChain([p, 'access', _315 => _315.targets, 'optionalAccess', _316 => _316.some, 'call', _317 => _317((t) => typeof t.metric === "string" && map[t.metric])])) out = { ...out, targets: p.targets.map((t) => typeof t.metric === "string" && map[t.metric] ? { ...t, metric: map[t.metric] } : t) };
11543
+ if (_optionalChain([p, 'access', _318 => _318.panels, 'optionalAccess', _319 => _319.length])) out = { ...out, panels: p.panels.map(rename) };
11284
11544
  return out;
11285
11545
  };
11286
11546
  return panels.map(rename);
@@ -11300,7 +11560,7 @@ function copyPanels(dashboard, indices) {
11300
11560
  }
11301
11561
  }
11302
11562
  const chosen = order.filter((i) => picked.has(i)).map((i) => panels[i]);
11303
- return snippetOf(chosen, _nullishCoalesce(_optionalChain([dashboard, 'access', _318 => _318.templating, 'optionalAccess', _319 => _319.list]), () => ( [])));
11563
+ return snippetOf(chosen, _nullishCoalesce(_optionalChain([dashboard, 'access', _320 => _320.templating, 'optionalAccess', _321 => _321.list]), () => ( [])));
11304
11564
  }
11305
11565
  function snippetOf(panels, available) {
11306
11566
  const left = Math.min(...panels.map((p) => pos2(p).x));
@@ -11368,7 +11628,7 @@ var sameVariable = (a, b) => {
11368
11628
  return strip(a) === strip(b);
11369
11629
  };
11370
11630
  function previewPaste(dashboard, snippet) {
11371
- const { added, renamed } = mergeVariables(_nullishCoalesce(_optionalChain([dashboard, 'access', _320 => _320.templating, 'optionalAccess', _321 => _321.list]), () => ( [])), snippet.variables);
11631
+ const { added, renamed } = mergeVariables(_nullishCoalesce(_optionalChain([dashboard, 'access', _322 => _322.templating, 'optionalAccess', _323 => _323.list]), () => ( [])), snippet.variables);
11372
11632
  return { added, renamed };
11373
11633
  }
11374
11634
  function mergeVariables(existing, incoming) {
@@ -11405,7 +11665,7 @@ function pasteSnippet(dashboard, snippet, options = {}) {
11405
11665
  return true;
11406
11666
  };
11407
11667
  let incoming = snippet.panels.filter(keep).map((p) => p.panels ? { ...p, panels: p.panels.filter(keep) } : p);
11408
- const { variables, added, renamed } = mergeVariables(_nullishCoalesce(_optionalChain([dashboard, 'access', _322 => _322.templating, 'optionalAccess', _323 => _323.list]), () => ( [])), snippet.variables);
11668
+ const { variables, added, renamed } = mergeVariables(_nullishCoalesce(_optionalChain([dashboard, 'access', _324 => _324.templating, 'optionalAccess', _325 => _325.list]), () => ( [])), snippet.variables);
11409
11669
  for (const [from, to] of Object.entries(renamed)) incoming = renameVariableInPanels(incoming, from, to);
11410
11670
  if (options.metrics) incoming = renameMetrics(incoming, options.metrics);
11411
11671
  const after = options.after != null ? existing[options.after] : void 0;
@@ -11470,7 +11730,7 @@ function parseTemplate(text) {
11470
11730
  if (seen.has(d.id)) return { error: `Two documents are called "${d.id}"` };
11471
11731
  seen.add(d.id);
11472
11732
  const { dashboard, issues } = prepareDashboard(d.dashboard, d.id);
11473
- if (!dashboard) return { error: `"${d.id}" can\u2019t be shown: ${_nullishCoalesce(_optionalChain([issues, 'access', _324 => _324.find, 'call', _325 => _325((x) => x.severity === "error"), 'optionalAccess', _326 => _326.message]), () => ( "it isn\u2019t a dashboard"))}` };
11733
+ if (!dashboard) return { error: `"${d.id}" can\u2019t be shown: ${_nullishCoalesce(_optionalChain([issues, 'access', _326 => _326.find, 'call', _327 => _327((x) => x.severity === "error"), 'optionalAccess', _328 => _328.message]), () => ( "it isn\u2019t a dashboard"))}` };
11474
11734
  if (dashboard.kind && dashboard.kind !== d.kind) return { error: `"${d.id}" is listed as a ${d.kind} but says it\u2019s a ${dashboard.kind}` };
11475
11735
  documents.push({ kind: d.kind, id: d.id, dashboard });
11476
11736
  }
@@ -11548,9 +11808,9 @@ function applyTemplate(manifestText, paths, template, options = {}) {
11548
11808
  }
11549
11809
  const tabIds = (_nullishCoalesce(manifest.tabs, () => ( []))).map((t) => t.id);
11550
11810
  const added = [];
11551
- let at = _nullishCoalesce(_optionalChain([manifest, 'access', _327 => _327.tabs, 'optionalAccess', _328 => _328.length]), () => ( 0));
11811
+ let at = _nullishCoalesce(_optionalChain([manifest, 'access', _329 => _329.tabs, 'optionalAccess', _330 => _330.length]), () => ( 0));
11552
11812
  for (const tab of template.tabs) {
11553
- if (!_optionalChain([options, 'access', _329 => _329.tabs, 'optionalAccess', _330 => _330.includes, 'call', _331 => _331(tab.id)])) continue;
11813
+ if (!_optionalChain([options, 'access', _331 => _331.tabs, 'optionalAccess', _332 => _332.includes, 'call', _333 => _333(tab.id)])) continue;
11554
11814
  const screen = retarget(tab.screen, ids);
11555
11815
  if (!screen) continue;
11556
11816
  const id = tabIdFor(tab.id, tabIds);
@@ -11772,7 +12032,7 @@ function readTemplateAnswer(text) {
11772
12032
  );
11773
12033
  const kept = new Set(template.tabs.map((t) => t.id));
11774
12034
  for (const [i, tab] of (Array.isArray(raw.tabs) ? raw.tabs : []).entries()) {
11775
- const id = _optionalChain([tab, 'optionalAccess', _332 => _332.id]);
12035
+ const id = _optionalChain([tab, 'optionalAccess', _334 => _334.id]);
11776
12036
  if (typeof id !== "string" || !kept.has(id)) warnings.push(`tabs[${i}] was left out: it needs an id, a title and a screen showing only this template\u2019s documents`);
11777
12037
  }
11778
12038
  const kinds = new Map(template.documents.map((d) => [d.id, d.kind]));
@@ -11820,9 +12080,9 @@ function readDocumentAnswer(text, kind) {
11820
12080
  return { error: e.message };
11821
12081
  }
11822
12082
  const wrapper = json;
11823
- if (_optionalChain([wrapper, 'optionalAccess', _333 => _333.$modelform]) === "template") {
12083
+ if (_optionalChain([wrapper, 'optionalAccess', _335 => _335.$modelform]) === "template") {
11824
12084
  if (!Array.isArray(wrapper.documents) || wrapper.documents.length !== 1) return { error: `That\u2019s a template, not one ${kind}` };
11825
- json = _optionalChain([wrapper, 'access', _334 => _334.documents, 'access', _335 => _335[0], 'optionalAccess', _336 => _336.dashboard]);
12085
+ json = _optionalChain([wrapper, 'access', _336 => _336.documents, 'access', _337 => _337[0], 'optionalAccess', _338 => _338.dashboard]);
11826
12086
  }
11827
12087
  if (!json || typeof json !== "object" || Array.isArray(json)) return { error: `That isn\u2019t a ${kind}` };
11828
12088
  const raw = json;
@@ -11861,8 +12121,8 @@ function documentChanges(before, after) {
11861
12121
  const what = [];
11862
12122
  if (was.title !== p.title) what.push("title");
11863
12123
  if (was.type !== p.type) what.push("type");
11864
- if (_optionalChain([was, 'access', _337 => _337.gridPos, 'optionalAccess', _338 => _338.x]) !== _optionalChain([p, 'access', _339 => _339.gridPos, 'optionalAccess', _340 => _340.x]) || _optionalChain([was, 'access', _341 => _341.gridPos, 'optionalAccess', _342 => _342.y]) !== _optionalChain([p, 'access', _343 => _343.gridPos, 'optionalAccess', _344 => _344.y])) what.push("position");
11865
- if (_optionalChain([was, 'access', _345 => _345.gridPos, 'optionalAccess', _346 => _346.w]) !== _optionalChain([p, 'access', _347 => _347.gridPos, 'optionalAccess', _348 => _348.w]) || _optionalChain([was, 'access', _349 => _349.gridPos, 'optionalAccess', _350 => _350.h]) !== _optionalChain([p, 'access', _351 => _351.gridPos, 'optionalAccess', _352 => _352.h])) what.push("size");
12124
+ if (_optionalChain([was, 'access', _339 => _339.gridPos, 'optionalAccess', _340 => _340.x]) !== _optionalChain([p, 'access', _341 => _341.gridPos, 'optionalAccess', _342 => _342.x]) || _optionalChain([was, 'access', _343 => _343.gridPos, 'optionalAccess', _344 => _344.y]) !== _optionalChain([p, 'access', _345 => _345.gridPos, 'optionalAccess', _346 => _346.y])) what.push("position");
12125
+ if (_optionalChain([was, 'access', _347 => _347.gridPos, 'optionalAccess', _348 => _348.w]) !== _optionalChain([p, 'access', _349 => _349.gridPos, 'optionalAccess', _350 => _350.w]) || _optionalChain([was, 'access', _351 => _351.gridPos, 'optionalAccess', _352 => _352.h]) !== _optionalChain([p, 'access', _353 => _353.gridPos, 'optionalAccess', _354 => _354.h])) what.push("size");
11866
12126
  if (!same(was.options, p.options)) what.push("options");
11867
12127
  if (!same(was.targets, p.targets) || !same(was.datasource, p.datasource) || !same(was.transformations, p.transformations)) what.push("queries");
11868
12128
  if (!same(was.fieldConfig, p.fieldConfig)) what.push("field config");
@@ -12110,4 +12370,13 @@ function documentChanges(before, after) {
12110
12370
 
12111
12371
 
12112
12372
 
12113
- exports.frameLength = frameLength; exports.timeField = timeField; exports.numberFields = numberFields; exports.fieldDisplayName = fieldDisplayName; exports.toSeries = toSeries; exports.toXYSeries = toXYSeries; exports.uniqueNames = uniqueNames; exports.toMillis = toMillis; exports.parseTime = parseTime; exports.parseRange = parseRange; exports.addTime = addTime; exports.startOf = startOf; exports.parseDuration = parseDuration; exports.calculateInterval = calculateInterval; exports.formatDuration = formatDuration; exports.TIME_PRESETS = TIME_PRESETS; exports.RELATIVE_RANGES = RELATIVE_RANGES; exports.parseLocalDateTime = parseLocalDateTime; exports.formatLocalDateTime = formatLocalDateTime; exports.timeExprError = timeExprError; exports.describeRange = describeRange; exports.zoomRange = zoomRange; exports.ALL = ALL; exports.initialVariableValues = initialVariableValues; exports.variableOptions = variableOptions; exports.variableInfo = variableInfo; exports.visibleVariables = visibleVariables; exports.isSqlDatasource = isSqlDatasource; exports.framesToOptions = framesToOptions; exports.refineOptions = refineOptions; exports.selectValue = selectValue; exports.variableReferences = variableReferences; exports.interpolate = interpolate; exports.queryParam = queryParam; exports.interpolateDeep = interpolateDeep; exports.resolveTimezone = resolveTimezone; exports.valueText = valueText; exports.GRID_COLUMNS = GRID_COLUMNS; exports.gridUnitsToPx = gridUnitsToPx; exports.gridOffsetPx = gridOffsetPx; exports.compactGrid = compactGrid; exports.isRow = isRow; exports.layoutDashboard = layoutDashboard; exports.repeatOptions = repeatOptions; exports.panelKey = panelKey; exports.panelSpan = panelSpan; exports.applyTransformations = applyTransformations; exports.DASHBOARD_DS = DASHBOARD_DS; exports.dashboardSourceIds = dashboardSourceIds; exports.panelHasQueries = panelHasQueries; exports.queryPanel = queryPanel; exports.normalizeRef = normalizeRef; exports.refreshedVariables = refreshedVariables; exports.variableDependents = variableDependents; exports.variableOrder = variableOrder; exports.resolveVariables = resolveVariables; exports.REDUCER_LABELS = REDUCER_LABELS; exports.isReducer = isReducer; exports.reduce = reduce; exports.INPUT_OPTION_KEYS = INPUT_OPTION_KEYS; exports.INPUT_TYPES = INPUT_TYPES; exports.isInputType = isInputType; exports.isInputPanel = isInputPanel; exports.INPUT_GROUP = INPUT_GROUP; exports.isFormPanelType = isFormPanelType; exports.isInputGroup = isInputGroup; exports.GROUP_FIELD_TYPES = GROUP_FIELD_TYPES; exports.groupFields = groupFields; exports.inputPanels = inputPanels; exports.documentKind = documentKind; exports.inputGroups = inputGroups; exports.plainInputPanels = plainInputPanels; exports.parseClockDigits = parseClockDigits; exports.formatClock = formatClock; exports.toEntries = toEntries; exports.newSaveId = newSaveId; exports.isEmptyItem = isEmptyItem; exports.groupToEntries = groupToEntries; exports.entriesToItems = entriesToItems; exports.groupProblems = groupProblems; exports.sameSave = sameSave; exports.inputProblem = inputProblem; exports.entryToInputValue = entryToInputValue; exports.textSuggestions = textSuggestions; exports.entriesSavedWith = entriesSavedWith; exports.formatValue = formatValue; exports.thresholdStep = thresholdStep; exports.NAMED_COLORS = NAMED_COLORS; exports.resolveColor = resolveColor; exports.SERIES_PALETTE = SERIES_PALETTE; exports.seriesColor = seriesColor; exports.mappedResult = mappedResult; exports.formatDisplay = formatDisplay; exports.valueColor = valueColor; exports.resolveFieldConfig = resolveFieldConfig; exports.fieldMatches = fieldMatches; exports.GrafanaError = GrafanaError; exports.GrafanaClient = GrafanaClient; exports.GrafanaDataSource = GrafanaDataSource; exports.fromWire = fromWire; exports.LOCAL_DATASOURCE_TYPE = LOCAL_DATASOURCE_TYPE; exports.isLocalDatasource = isLocalDatasource; exports.LocalDataSource = LocalDataSource; exports.groupField = groupField; exports.buildFrames = buildFrames; exports.MemoryEntryStore = MemoryEntryStore; exports.DEFAULT_GAZETTEER = DEFAULT_GAZETTEER; exports.parseGazetteer = parseGazetteer; exports.loadGazetteer = loadGazetteer; exports.resolveLinks = resolveLinks; exports.parseDashboardLink = parseDashboardLink; exports.applyDashboardLink = applyDashboardLink; exports.appSchema = appSchema; exports.dashboardSchema = dashboardSchema; exports.pointerToPath = pointerToPath; exports.manifestSchemaIssues = manifestSchemaIssues; exports.dashboardSchemaIssues = dashboardSchemaIssues; exports.cleanDashboard = cleanDashboard; exports.MAPPING_TYPES = MAPPING_TYPES; exports.SPECIAL_MATCHES = SPECIAL_MATCHES; exports.mappingRows = mappingRows; exports.rowsToMappings = rowsToMappings; exports.mappingRow = mappingRow; exports.mappingProblem = mappingProblem; exports.OPTION_CATEGORIES = OPTION_CATEGORIES; exports.UNIT_CHOICES = UNIT_CHOICES; exports.panelOptions = panelOptions; exports.getPath = getPath; exports.optionValue = optionValue; exports.setOption = setOption; exports.setOptionValue = setOptionValue; exports.cleanPanelOptions = cleanPanelOptions; exports.OVERRIDE_MATCHERS = OVERRIDE_MATCHERS; exports.overrideProperties = overrideProperties; exports.panelOverrides = panelOverrides; exports.setOverrides = setOverrides; exports.MANIFEST_VERSION = MANIFEST_VERSION; exports.validateManifest = validateManifest; exports.prepareDashboard = prepareDashboard; exports.validateDashboard = validateDashboard2; exports.validateBundle = validateBundle; exports.resolveUrl = resolveUrl; exports.httpFetchJson = httpFetchJson; exports.defaultFetchJson = defaultFetchJson; exports.BUNDLE_TYPE = BUNDLE_TYPE; exports.BUNDLE_ACCEPT = BUNDLE_ACCEPT; exports.isBundleResponse = isBundleResponse; exports.bundleRoot = bundleRoot; exports.assembleFromResponse = assembleFromResponse; exports.assembleBundle = assembleBundle; exports.fetchBundle = fetchBundle; exports.revalidateBundle = revalidateBundle; exports.ConfigLoader = ConfigLoader; exports.tabIdFor = tabIdFor; exports.screenOfType = screenOfType; exports.screenDocuments = screenDocuments; exports.documentUses = documentUses; exports.stringifyCompact = stringifyCompact; exports.applyJsonEdits = applyJsonEdits; exports.diffJson = diffJson; exports.documentIdFor = documentIdFor; exports.removeDocumentFromManifest = removeDocumentFromManifest; exports.renameDocumentInManifest = renameDocumentInManifest; exports.metricChanges = metricChanges; exports.REFRESH_CHOICES = REFRESH_CHOICES; exports.EDITABLE_VARIABLE_TYPES = EDITABLE_VARIABLE_TYPES; exports.isEditableVariableType = isEditableVariableType; exports.variableNameError = variableNameError; exports.newVariable = newVariable; exports.variableWithType = variableWithType; exports.variableWithQuery = variableWithQuery; exports.variableWithCurrent = variableWithCurrent; exports.variableWithFlags = variableWithFlags; exports.variableUses = variableUses; exports.renameVariableInPanels = renameVariableInPanels; exports.lineColumn = lineColumn; exports.parseJsonText = parseJsonText; exports.splitPath = splitPath; exports.locate = locate; exports.checkFiles = checkFiles; exports.bundleFromFiles = bundleFromFiles; exports.formatJsonText = formatJsonText; exports.setJsonValue = setJsonValue; exports.PANEL_TYPES = PANEL_TYPES; exports.newPanel = newPanel; exports.newDocument = newDocument; exports.SaveConflictError = SaveConflictError; exports.HttpConfigFiles = HttpConfigFiles; exports.fetchJsonWithToken = fetchJsonWithToken; exports.readConfigFiles = readConfigFiles; exports.readingOrder = readingOrder; exports.repack = repack; exports.CANVAS_GAP = CANVAS_GAP; exports.CANVAS_ROW_HEADER = CANVAS_ROW_HEADER; exports.panelSize = panelSize; exports.layoutCanvas = layoutCanvas; exports.dropTarget = dropTarget; exports.movePanel = movePanel; exports.resizePanel = resizePanel; exports.setHiddenOnPhones = setHiddenOnPhones; exports.nextPanelId = nextPanelId; exports.insertPanel = insertPanel; exports.duplicatePanel = duplicatePanel; exports.removePanel = removePanel; exports.expandRow = expandRow; exports.collapseRow = collapseRow; exports.settleLayout = settleLayout; exports.placePanel = placePanel; exports.snapToGrid = snapToGrid; exports.panelEdits = panelEdits; exports.sampleEntries = sampleEntries; exports.SNIPPET_VERSION = SNIPPET_VERSION; exports.panelMetrics = panelMetrics; exports.renameMetrics = renameMetrics; exports.copyPanels = copyPanels; exports.parseSnippet = parseSnippet; exports.previewPaste = previewPaste; exports.pasteSnippet = pasteSnippet; exports.TEMPLATE_VERSION = TEMPLATE_VERSION; exports.makeTemplate = makeTemplate; exports.parseTemplate = parseTemplate; exports.templateNeeds = templateNeeds; exports.applyTemplate = applyTemplate; exports.DOCUMENT_GUIDE = DOCUMENT_GUIDE; exports.AUTHORING_GUIDE = AUTHORING_GUIDE; exports.EXAMPLE_TEMPLATE = EXAMPLE_TEMPLATE; exports.templatePrompt = templatePrompt; exports.jsonFromAnswer = jsonFromAnswer; exports.readTemplateAnswer = readTemplateAnswer; exports.fixTemplatePrompt = fixTemplatePrompt; exports.documentPrompt = documentPrompt; exports.readDocumentAnswer = readDocumentAnswer; exports.fixDocumentPrompt = fixDocumentPrompt; exports.documentChanges = documentChanges;
12373
+
12374
+
12375
+
12376
+
12377
+
12378
+
12379
+
12380
+
12381
+
12382
+ exports.frameLength = frameLength; exports.timeField = timeField; exports.numberFields = numberFields; exports.fieldDisplayName = fieldDisplayName; exports.toSeries = toSeries; exports.toXYSeries = toXYSeries; exports.uniqueNames = uniqueNames; exports.toMillis = toMillis; exports.parseTime = parseTime; exports.parseRange = parseRange; exports.addTime = addTime; exports.startOf = startOf; exports.parseDuration = parseDuration; exports.calculateInterval = calculateInterval; exports.formatDuration = formatDuration; exports.TIME_PRESETS = TIME_PRESETS; exports.RELATIVE_RANGES = RELATIVE_RANGES; exports.parseLocalDateTime = parseLocalDateTime; exports.formatLocalDateTime = formatLocalDateTime; exports.timeExprError = timeExprError; exports.describeRange = describeRange; exports.zoomRange = zoomRange; exports.ALL = ALL; exports.initialVariableValues = initialVariableValues; exports.variableOptions = variableOptions; exports.variableInfo = variableInfo; exports.visibleVariables = visibleVariables; exports.isSqlDatasource = isSqlDatasource; exports.framesToOptions = framesToOptions; exports.refineOptions = refineOptions; exports.selectValue = selectValue; exports.variableReferences = variableReferences; exports.interpolate = interpolate; exports.queryParam = queryParam; exports.interpolateDeep = interpolateDeep; exports.resolveTimezone = resolveTimezone; exports.valueText = valueText; exports.GRID_COLUMNS = GRID_COLUMNS; exports.gridUnitsToPx = gridUnitsToPx; exports.gridOffsetPx = gridOffsetPx; exports.compactGrid = compactGrid; exports.isRow = isRow; exports.layoutDashboard = layoutDashboard; exports.repeatOptions = repeatOptions; exports.panelKey = panelKey; exports.panelSpan = panelSpan; exports.applyTransformations = applyTransformations; exports.DASHBOARD_DS = DASHBOARD_DS; exports.dashboardSourceIds = dashboardSourceIds; exports.panelHasQueries = panelHasQueries; exports.queryPanel = queryPanel; exports.normalizeRef = normalizeRef; exports.refreshedVariables = refreshedVariables; exports.variableDependents = variableDependents; exports.variableOrder = variableOrder; exports.resolveVariables = resolveVariables; exports.REDUCER_LABELS = REDUCER_LABELS; exports.isReducer = isReducer; exports.reduce = reduce; exports.INPUT_OPTION_KEYS = INPUT_OPTION_KEYS; exports.INPUT_TYPES = INPUT_TYPES; exports.isInputType = isInputType; exports.isInputPanel = isInputPanel; exports.INPUT_GROUP = INPUT_GROUP; exports.isFormPanelType = isFormPanelType; exports.isInputGroup = isInputGroup; exports.GROUP_FIELD_TYPES = GROUP_FIELD_TYPES; exports.groupFields = groupFields; exports.inputPanels = inputPanels; exports.documentKind = documentKind; exports.inputGroups = inputGroups; exports.plainInputPanels = plainInputPanels; exports.parseClockDigits = parseClockDigits; exports.formatClock = formatClock; exports.toEntries = toEntries; exports.newSaveId = newSaveId; exports.isEmptyItem = isEmptyItem; exports.groupToEntries = groupToEntries; exports.entriesToItems = entriesToItems; exports.groupProblems = groupProblems; exports.sameSave = sameSave; exports.inputProblem = inputProblem; exports.entryToInputValue = entryToInputValue; exports.textSuggestions = textSuggestions; exports.entriesSavedWith = entriesSavedWith; exports.formatValue = formatValue; exports.thresholdStep = thresholdStep; exports.NAMED_COLORS = NAMED_COLORS; exports.resolveColor = resolveColor; exports.SERIES_PALETTE = SERIES_PALETTE; exports.seriesColor = seriesColor; exports.mappedResult = mappedResult; exports.formatDisplay = formatDisplay; exports.valueColor = valueColor; exports.resolveFieldConfig = resolveFieldConfig; exports.fieldMatches = fieldMatches; exports.GrafanaError = GrafanaError; exports.GrafanaClient = GrafanaClient; exports.GrafanaDataSource = GrafanaDataSource; exports.fromWire = fromWire; exports.parseSpokenNumber = parseSpokenNumber; exports.parseSpokenDuration = parseSpokenDuration; exports.matchChoices = matchChoices; exports.parseSpokenYesNo = parseSpokenYesNo; exports.spokenValue = spokenValue; exports.DICTATION_TYPES = DICTATION_TYPES; exports.takesDictation = takesDictation; exports.dictationHints = dictationHints; exports.LOCAL_DATASOURCE_TYPE = LOCAL_DATASOURCE_TYPE; exports.isLocalDatasource = isLocalDatasource; exports.LocalDataSource = LocalDataSource; exports.groupField = groupField; exports.buildFrames = buildFrames; exports.MemoryEntryStore = MemoryEntryStore; exports.DEFAULT_GAZETTEER = DEFAULT_GAZETTEER; exports.parseGazetteer = parseGazetteer; exports.loadGazetteer = loadGazetteer; exports.resolveLinks = resolveLinks; exports.parseDashboardLink = parseDashboardLink; exports.applyDashboardLink = applyDashboardLink; exports.appSchema = appSchema; exports.dashboardSchema = dashboardSchema; exports.pointerToPath = pointerToPath; exports.manifestSchemaIssues = manifestSchemaIssues; exports.dashboardSchemaIssues = dashboardSchemaIssues; exports.cleanDashboard = cleanDashboard; exports.MAPPING_TYPES = MAPPING_TYPES; exports.SPECIAL_MATCHES = SPECIAL_MATCHES; exports.mappingRows = mappingRows; exports.rowsToMappings = rowsToMappings; exports.mappingRow = mappingRow; exports.mappingProblem = mappingProblem; exports.OPTION_CATEGORIES = OPTION_CATEGORIES; exports.UNIT_CHOICES = UNIT_CHOICES; exports.panelOptions = panelOptions; exports.getPath = getPath; exports.optionValue = optionValue; exports.setOption = setOption; exports.setOptionValue = setOptionValue; exports.cleanPanelOptions = cleanPanelOptions; exports.OVERRIDE_MATCHERS = OVERRIDE_MATCHERS; exports.overrideProperties = overrideProperties; exports.panelOverrides = panelOverrides; exports.setOverrides = setOverrides; exports.MANIFEST_VERSION = MANIFEST_VERSION; exports.requiredManifestVersion = requiredManifestVersion; exports.validateManifest = validateManifest; exports.prepareDashboard = prepareDashboard; exports.validateDashboard = validateDashboard2; exports.validateBundle = validateBundle; exports.resolveUrl = resolveUrl; exports.httpFetchJson = httpFetchJson; exports.defaultFetchJson = defaultFetchJson; exports.BUNDLE_TYPE = BUNDLE_TYPE; exports.BUNDLE_ACCEPT = BUNDLE_ACCEPT; exports.isBundleResponse = isBundleResponse; exports.bundleRoot = bundleRoot; exports.assembleFromResponse = assembleFromResponse; exports.assembleBundle = assembleBundle; exports.fetchBundle = fetchBundle; exports.revalidateBundle = revalidateBundle; exports.ConfigLoader = ConfigLoader; exports.tabIdFor = tabIdFor; exports.screenOfType = screenOfType; exports.screenDocuments = screenDocuments; exports.documentUses = documentUses; exports.stringifyCompact = stringifyCompact; exports.applyJsonEdits = applyJsonEdits; exports.diffJson = diffJson; exports.documentIdFor = documentIdFor; exports.removeDocumentFromManifest = removeDocumentFromManifest; exports.renameDocumentInManifest = renameDocumentInManifest; exports.metricChanges = metricChanges; exports.REFRESH_CHOICES = REFRESH_CHOICES; exports.EDITABLE_VARIABLE_TYPES = EDITABLE_VARIABLE_TYPES; exports.isEditableVariableType = isEditableVariableType; exports.variableNameError = variableNameError; exports.newVariable = newVariable; exports.variableWithType = variableWithType; exports.variableWithQuery = variableWithQuery; exports.variableWithCurrent = variableWithCurrent; exports.variableWithFlags = variableWithFlags; exports.variableUses = variableUses; exports.renameVariableInPanels = renameVariableInPanels; exports.lineColumn = lineColumn; exports.parseJsonText = parseJsonText; exports.splitPath = splitPath; exports.locate = locate; exports.checkFiles = checkFiles; exports.bundleFromFiles = bundleFromFiles; exports.formatJsonText = formatJsonText; exports.setJsonValue = setJsonValue; exports.PANEL_TYPES = PANEL_TYPES; exports.newPanel = newPanel; exports.newDocument = newDocument; exports.SaveConflictError = SaveConflictError; exports.HttpConfigFiles = HttpConfigFiles; exports.fetchJsonWithToken = fetchJsonWithToken; exports.readConfigFiles = readConfigFiles; exports.readingOrder = readingOrder; exports.repack = repack; exports.CANVAS_GAP = CANVAS_GAP; exports.CANVAS_ROW_HEADER = CANVAS_ROW_HEADER; exports.panelSize = panelSize; exports.layoutCanvas = layoutCanvas; exports.dropTarget = dropTarget; exports.movePanel = movePanel; exports.resizePanel = resizePanel; exports.setHiddenOnPhones = setHiddenOnPhones; exports.nextPanelId = nextPanelId; exports.insertPanel = insertPanel; exports.duplicatePanel = duplicatePanel; exports.removePanel = removePanel; exports.expandRow = expandRow; exports.collapseRow = collapseRow; exports.settleLayout = settleLayout; exports.placePanel = placePanel; exports.snapToGrid = snapToGrid; exports.panelEdits = panelEdits; exports.sampleEntries = sampleEntries; exports.SNIPPET_VERSION = SNIPPET_VERSION; exports.panelMetrics = panelMetrics; exports.renameMetrics = renameMetrics; exports.copyPanels = copyPanels; exports.parseSnippet = parseSnippet; exports.previewPaste = previewPaste; exports.pasteSnippet = pasteSnippet; exports.TEMPLATE_VERSION = TEMPLATE_VERSION; exports.makeTemplate = makeTemplate; exports.parseTemplate = parseTemplate; exports.templateNeeds = templateNeeds; exports.applyTemplate = applyTemplate; exports.DOCUMENT_GUIDE = DOCUMENT_GUIDE; exports.AUTHORING_GUIDE = AUTHORING_GUIDE; exports.EXAMPLE_TEMPLATE = EXAMPLE_TEMPLATE; exports.templatePrompt = templatePrompt; exports.jsonFromAnswer = jsonFromAnswer; exports.readTemplateAnswer = readTemplateAnswer; exports.fixTemplatePrompt = fixTemplatePrompt; exports.documentPrompt = documentPrompt; exports.readDocumentAnswer = readDocumentAnswer; exports.fixDocumentPrompt = fixDocumentPrompt; exports.documentChanges = documentChanges;