@camstack/addon-training 0.1.14 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/_stub.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import "./virtualExposes-0m8NqEDE.mjs";
2
- import { a as e, i as t, o as n, r } from "./virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_training_page__remoteEntry_js-C2QFAzPJ.mjs";
2
+ import { a as e, i as t, o as n, r } from "./virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_training_page__remoteEntry_js-Dr6mcPCX.mjs";
3
3
  import { S as i, _ as a, b as o, c as s, d as c, f as l, g as u, h as d, i as f, l as p, m, n as h, p as g, r as _, t as v, u as y, v as b, x, y as S } from "./_virtual_mf___mfe_internal__addon_training_page__loadShare__react__loadShare__.js-DeDbF7NI.mjs";
4
4
  import { a as C, c as w, d as T, f as E, g as D, h as O, i as k, l as A, m as j, n as M, o as N, p as P, r as ee, s as F, t as te, u as ne } from "./responsive-Dy5RAD1s.mjs";
5
5
  import { c as I, d as re, l as ie, s as L, u as ae } from "./scene-monitor-copy-7HImRbA5.mjs";
6
- import { a as oe, i as se, n as ce, r as le } from "./player-overlays-BT-6fK9N.mjs";
6
+ import { a as oe, i as se, n as ce, r as le } from "./player-overlays-BmIRDhL0.mjs";
7
7
  import { i as ue, n as de, r as fe, t as pe } from "./square-DoPBhbZN.mjs";
8
8
  import { t as me } from "./grid-2x2-Bl3xw1w7.mjs";
9
9
  import { t as he } from "./trash-2-BwunNgLf.mjs";
@@ -12045,7 +12045,8 @@ var Op = hs("relative fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 m
12045
12045
  width: {
12046
12046
  sm: "max-w-sm",
12047
12047
  md: "max-w-md",
12048
- lg: "max-w-lg"
12048
+ lg: "max-w-lg",
12049
+ xl: "max-w-4xl"
12049
12050
  },
12050
12051
  scroll: {
12051
12052
  content: "overflow-y-auto",
@@ -12072,6 +12073,11 @@ var Op = hs("relative fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 m
12072
12073
  width: "lg",
12073
12074
  class: "md:w-[calc(100vw-2rem)] md:max-w-lg"
12074
12075
  },
12076
+ {
12077
+ placement: "sheet-on-mobile",
12078
+ width: "xl",
12079
+ class: "md:w-[calc(100vw-2rem)] md:max-w-4xl"
12080
+ },
12075
12081
  {
12076
12082
  scroll: "body",
12077
12083
  placement: "sheet-on-mobile",
@@ -12965,8 +12971,8 @@ function rm({ deviceId: e }) {
12965
12971
  //#region ../ui-library/src/widgets/host-widgets.ts
12966
12972
  i();
12967
12973
  var im = {
12968
- "host/motion-zones-grid": f(() => import("./MotionZonesSettings-DKtYdHUO.mjs").then((e) => ({ default: e.MotionZonesSettings }))),
12969
- "host/privacy-mask-grid": f(() => import("./PrivacyMaskSettings-BvLUVz86.mjs").then((e) => ({ default: e.PrivacyMaskSettings }))),
12974
+ "host/motion-zones-grid": f(() => import("./MotionZonesSettings-CboUjtEf.mjs").then((e) => ({ default: e.MotionZonesSettings }))),
12975
+ "host/privacy-mask-grid": f(() => import("./PrivacyMaskSettings-f61zjbA5.mjs").then((e) => ({ default: e.PrivacyMaskSettings }))),
12970
12976
  "host/ptz-panel": Qf,
12971
12977
  "host/navigation-panel": Wf,
12972
12978
  "host/consumables-panel": Ju,
@@ -27589,26 +27595,128 @@ _(function({ tree: e, agents: t, getCellState: n, onCellClick: r, selectedCell:
27589
27595
  });
27590
27596
  }), i(), i(), i(), i(), i(), i();
27591
27597
  //#endregion
27592
- //#region ../ui-library/src/composites/page-header.tsx
27593
- function Xk({ title: e, subtitle: t, actions: n, className: r }) {
27598
+ //#region ../ui-library/src/composites/page-shell.tsx
27599
+ function Xk({ icon: e, title: t, subtitle: n, actions: r, nav: i, className: a, children: o }) {
27600
+ let s = !!t || n != null || r != null, c = s || i != null;
27594
27601
  return /* @__PURE__ */ H("div", {
27595
- className: J("flex flex-col gap-2 mb-3 sm:flex-row sm:items-center sm:justify-between", r),
27596
- children: [/* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V("h1", {
27597
- className: "text-sm font-semibold text-foreground",
27598
- children: e
27599
- }), t && /* @__PURE__ */ V("p", {
27600
- className: "text-foreground-subtle text-xs",
27601
- children: t
27602
- })] }), n && /* @__PURE__ */ V("div", {
27603
- className: "flex items-center gap-2 flex-wrap",
27604
- children: n
27605
- })]
27602
+ className: J("space-y-4 overflow-x-clip p-2 sm:p-4", a),
27603
+ children: [c && /* @__PURE__ */ H("div", {
27604
+ className: "space-y-3",
27605
+ children: [s && /* @__PURE__ */ H("div", {
27606
+ className: "flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4",
27607
+ children: [/* @__PURE__ */ H("div", {
27608
+ className: "min-w-0",
27609
+ children: [t !== void 0 && t !== "" && /* @__PURE__ */ H("h1", {
27610
+ className: "flex items-center gap-2 text-lg font-semibold text-foreground",
27611
+ children: [e !== void 0 && /* @__PURE__ */ V(e, {
27612
+ className: "h-4 w-4 shrink-0 text-foreground-subtle",
27613
+ "aria-hidden": !0
27614
+ }), t]
27615
+ }), n != null && /* @__PURE__ */ V("p", {
27616
+ className: "mt-0.5 text-xs text-foreground-subtle",
27617
+ children: n
27618
+ })]
27619
+ }), r != null && /* @__PURE__ */ V("div", {
27620
+ className: "flex shrink-0 flex-wrap items-center gap-2",
27621
+ children: r
27622
+ })]
27623
+ }), i]
27624
+ }), o]
27606
27625
  });
27607
27626
  }
27608
27627
  //#endregion
27628
+ //#region ../ui-library/src/composites/item-form-dialog.tsx
27629
+ function Zk({ open: e, onClose: t, title: n, icon: r, error: i, width: a = "lg", children: o, footer: s, testId: c }) {
27630
+ return e ? /* @__PURE__ */ V(Dp, {
27631
+ open: !0,
27632
+ onOpenChange: (e) => !e && t(),
27633
+ children: /* @__PURE__ */ H(kp, {
27634
+ width: a,
27635
+ placement: "sheet-on-mobile",
27636
+ scroll: "body",
27637
+ "data-testid": c,
27638
+ children: [
27639
+ /* @__PURE__ */ H("div", {
27640
+ className: "mb-3 flex shrink-0 items-center justify-between gap-2",
27641
+ children: [/* @__PURE__ */ H("h3", {
27642
+ className: "flex min-w-0 items-center gap-2 text-sm font-semibold text-foreground",
27643
+ children: [r !== void 0 && /* @__PURE__ */ V(r, {
27644
+ className: "h-4 w-4 shrink-0 text-foreground-subtle",
27645
+ "aria-hidden": !0
27646
+ }), /* @__PURE__ */ V("span", {
27647
+ className: "truncate",
27648
+ children: n
27649
+ })]
27650
+ }), /* @__PURE__ */ V(X, {
27651
+ size: "sm",
27652
+ variant: "ghost",
27653
+ type: "button",
27654
+ onClick: t,
27655
+ children: "Cancel"
27656
+ })]
27657
+ }),
27658
+ i != null && i !== "" && /* @__PURE__ */ V("div", {
27659
+ className: "mb-3 shrink-0 rounded-md border border-danger/40 bg-danger/10 px-3 py-2 text-xs text-danger",
27660
+ children: i
27661
+ }),
27662
+ /* @__PURE__ */ V(jp, {
27663
+ className: "pr-1",
27664
+ children: o
27665
+ }),
27666
+ s != null && /* @__PURE__ */ V(Mp, {
27667
+ className: "mt-3 shrink-0",
27668
+ children: s
27669
+ })
27670
+ ]
27671
+ })
27672
+ }) : null;
27673
+ }
27674
+ //#endregion
27675
+ //#region ../ui-library/src/hooks/use-url-query.ts
27676
+ i();
27677
+ function Qk(e) {
27678
+ return new URLSearchParams(window.location.search).get(e);
27679
+ }
27680
+ function $k(e, t) {
27681
+ let n = new URLSearchParams(window.location.search);
27682
+ t === null || t === "" ? n.delete(e) : n.set(e, t);
27683
+ let r = n.toString(), i = r ? `${window.location.pathname}?${r}` : window.location.pathname;
27684
+ window.history.replaceState(null, "", i);
27685
+ }
27686
+ function eA(e) {
27687
+ let [t, n] = a(() => Qk(e));
27688
+ return y(() => {
27689
+ let t = () => n(Qk(e));
27690
+ return window.addEventListener("popstate", t), () => window.removeEventListener("popstate", t);
27691
+ }, [e]), [t, s((t) => {
27692
+ $k(e, t), n(t);
27693
+ }, [e])];
27694
+ }
27695
+ //#endregion
27696
+ //#region ../ui-library/src/composites/use-item-form-url.ts
27697
+ i();
27698
+ function tA(e = {}) {
27699
+ let t = e.newKey ?? "new", n = e.editKey ?? "edit", [r, i] = eA(t), [a, o] = eA(n);
27700
+ return {
27701
+ state: m(() => a !== null && a !== "" ? {
27702
+ mode: "edit",
27703
+ id: a
27704
+ } : r === "1" ? { mode: "new" } : { mode: "closed" }, [a, r]),
27705
+ openNew: s(() => {
27706
+ o(null), i("1");
27707
+ }, [o, i]),
27708
+ openEdit: s((e) => {
27709
+ i(null), o(e);
27710
+ }, [o, i]),
27711
+ close: s(() => {
27712
+ i(null), o(null);
27713
+ }, [o, i])
27714
+ };
27715
+ }
27716
+ //#endregion
27609
27717
  //#region ../ui-library/src/composites/provider-entries/AddProviderEntryDialog.tsx
27610
27718
  i(), i();
27611
- function Zk({ open: e, onOpenChange: t, types: n, onCreate: r, submitting: i = !1, title: o = "Add provider entry", description: s = "Pick a provider type and name this credential set." }) {
27719
+ function nA({ open: e, onOpenChange: t, types: n, onCreate: r, submitting: i = !1, title: o = "Add provider entry", description: s = "Pick a provider type and name this credential set." }) {
27612
27720
  let l = c(), u = c(), [d, f] = a(""), [p, m] = a("");
27613
27721
  y(() => {
27614
27722
  e && (f(n[0]?.typeId ?? ""), m(""));
@@ -27640,7 +27748,7 @@ function Zk({ open: e, onOpenChange: t, types: n, onCreate: r, submitting: i = !
27640
27748
  children: "Provider type"
27641
27749
  }), /* @__PURE__ */ H("div", {
27642
27750
  className: "flex items-center gap-2",
27643
- children: [/* @__PURE__ */ V(Qk, { url: n.find((e) => e.typeId === d)?.iconUrl ?? null }), /* @__PURE__ */ V(Qu, {
27751
+ children: [/* @__PURE__ */ V(rA, { url: n.find((e) => e.typeId === d)?.iconUrl ?? null }), /* @__PURE__ */ V(Qu, {
27644
27752
  id: l,
27645
27753
  "aria-label": "Provider type",
27646
27754
  className: "flex-1",
@@ -27692,7 +27800,7 @@ function Zk({ open: e, onOpenChange: t, types: n, onCreate: r, submitting: i = !
27692
27800
  })
27693
27801
  });
27694
27802
  }
27695
- function Qk({ url: e }) {
27803
+ function rA({ url: e }) {
27696
27804
  return e === null ? /* @__PURE__ */ V("span", {
27697
27805
  className: J("inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md", "border border-border bg-surface text-[10px] text-foreground-subtle"),
27698
27806
  "aria-hidden": !0,
@@ -27705,31 +27813,31 @@ function Qk({ url: e }) {
27705
27813
  }
27706
27814
  //#endregion
27707
27815
  //#region ../ui-library/src/composites/provider-entries/ProviderEntryPills.tsx
27708
- var $k = J(M, "min-w-0 max-w-full gap-1.5 py-1 pl-1 pr-2.5 text-xs font-normal", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40"), eA = J(te, "font-medium"), tA = ee, nA = {
27816
+ var iA = J(M, "min-w-0 max-w-full gap-1.5 py-1 pl-1 pr-2.5 text-xs font-normal", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40"), aA = J(te, "font-medium"), oA = ee, sA = {
27709
27817
  ok: "bg-success",
27710
27818
  warning: "bg-warning",
27711
27819
  error: "bg-danger",
27712
27820
  unknown: "border border-foreground-subtle bg-transparent"
27713
- }, rA = {
27821
+ }, cA = {
27714
27822
  ok: "OK",
27715
27823
  warning: "Warning",
27716
27824
  error: "Error",
27717
27825
  unknown: "Unknown"
27718
27826
  };
27719
- function iA({ label: e, entries: t, selectedEntryId: n, onSelect: r, onAdd: i, addLabel: a = "Add provider" }) {
27827
+ function lA({ label: e, entries: t, selectedEntryId: n, onSelect: r, onAdd: i, addLabel: a = "Add provider" }) {
27720
27828
  return /* @__PURE__ */ V("nav", {
27721
27829
  "aria-label": e,
27722
27830
  className: "min-w-0",
27723
27831
  children: /* @__PURE__ */ H("div", {
27724
27832
  className: "flex min-w-0 flex-wrap items-center gap-1.5",
27725
- children: [t.map((e) => /* @__PURE__ */ V(aA, {
27833
+ children: [t.map((e) => /* @__PURE__ */ V(uA, {
27726
27834
  entry: e,
27727
27835
  current: e.entryId === n,
27728
27836
  onSelect: r
27729
27837
  }, e.entryId)), i !== void 0 && /* @__PURE__ */ H("button", {
27730
27838
  type: "button",
27731
27839
  onClick: i,
27732
- className: J($k, "border-dashed border-border pl-2 text-foreground-subtle", "hover:border-primary/50 hover:text-foreground"),
27840
+ className: J(iA, "border-dashed border-border pl-2 text-foreground-subtle", "hover:border-primary/50 hover:text-foreground"),
27733
27841
  children: [/* @__PURE__ */ V(Gr, {
27734
27842
  className: "h-3.5 w-3.5 shrink-0",
27735
27843
  "aria-hidden": !0
@@ -27741,32 +27849,32 @@ function iA({ label: e, entries: t, selectedEntryId: n, onSelect: r, onAdd: i, a
27741
27849
  })
27742
27850
  });
27743
27851
  }
27744
- function aA({ entry: e, current: t, onSelect: n }) {
27852
+ function uA({ entry: e, current: t, onSelect: n }) {
27745
27853
  let r = e.status === "ok";
27746
27854
  return /* @__PURE__ */ H("button", {
27747
27855
  type: "button",
27748
27856
  "aria-current": t ? "true" : void 0,
27749
27857
  "data-testid": `provider-entry-pill-${e.entryId}`,
27750
27858
  onClick: () => n(e.entryId),
27751
- className: J($k, t ? eA : tA),
27859
+ className: J(iA, t ? aA : oA),
27752
27860
  children: [
27753
- /* @__PURE__ */ V(oA, { url: e.iconUrl }),
27861
+ /* @__PURE__ */ V(dA, { url: e.iconUrl }),
27754
27862
  /* @__PURE__ */ V("span", {
27755
27863
  className: "truncate",
27756
27864
  children: e.name
27757
27865
  }),
27758
27866
  /* @__PURE__ */ V("span", {
27759
- className: J("h-1.5 w-1.5 shrink-0 rounded-full", nA[e.status]),
27867
+ className: J("h-1.5 w-1.5 shrink-0 rounded-full", sA[e.status]),
27760
27868
  "aria-hidden": !0
27761
27869
  }),
27762
27870
  /* @__PURE__ */ V("span", {
27763
27871
  className: r ? "sr-only" : "shrink-0 text-[10px] font-normal text-foreground-subtle",
27764
- children: rA[e.status]
27872
+ children: cA[e.status]
27765
27873
  })
27766
27874
  ]
27767
27875
  });
27768
27876
  }
27769
- function oA({ url: e }) {
27877
+ function dA({ url: e }) {
27770
27878
  return e === null ? /* @__PURE__ */ V("span", {
27771
27879
  className: "inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-surface text-[9px] text-foreground-subtle",
27772
27880
  "aria-hidden": !0,
@@ -27782,7 +27890,7 @@ function oA({ url: e }) {
27782
27890
  i(), i(), i();
27783
27891
  //#endregion
27784
27892
  //#region ../ui-library/src/composites/stat-card.tsx
27785
- function sA({ value: e, label: t, icon: n, subtext: r, valueClassName: i, trend: a, className: o }) {
27893
+ function fA({ value: e, label: t, icon: n, subtext: r, valueClassName: i, trend: a, className: o }) {
27786
27894
  return /* @__PURE__ */ H("div", {
27787
27895
  className: J("rounded-lg border border-border bg-surface p-2 sm:p-2.5 min-w-0", o),
27788
27896
  children: [
@@ -27820,7 +27928,7 @@ function sA({ value: e, label: t, icon: n, subtext: r, valueClassName: i, trend:
27820
27928
  //#endregion
27821
27929
  //#region ../ui-library/src/composites/step-inspector/step-inspector-panel.tsx
27822
27930
  i(), i();
27823
- function cA({ dirtyCount: e, saving: t, status: n, error: r, onSave: i, onDiscard: a, scope: o }) {
27931
+ function pA({ dirtyCount: e, saving: t, status: n, error: r, onSave: i, onDiscard: a, scope: o }) {
27824
27932
  let s = e > 0, c = t ? "Saving…" : s ? `${e} unsaved change${e === 1 ? "" : "s"}` : n === "saved" ? "Saved" : n === "error" ? r ?? "Save failed" : "No unsaved changes";
27825
27933
  return /* @__PURE__ */ H("footer", {
27826
27934
  className: "shrink-0 space-y-2 border-t border-border bg-surface px-4 py-2 pb-[max(0.5rem,env(safe-area-inset-bottom))] md:pb-2",
@@ -27893,16 +28001,16 @@ _(function({ title: e, subtitle: t, headerActions: n, headerExtra: r, leading: i
27893
28001
  className: "min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-3",
27894
28002
  children: s
27895
28003
  }),
27896
- a !== void 0 && /* @__PURE__ */ V(cA, { ...a })
28004
+ a !== void 0 && /* @__PURE__ */ V(pA, { ...a })
27897
28005
  ]
27898
28006
  });
27899
28007
  }), i(), i(), i();
27900
28008
  //#endregion
27901
28009
  //#region ../ui-library/src/composites/device-picker/device-picker-model.ts
27902
- function lA(e, t) {
28010
+ function mA(e, t) {
27903
28011
  return typeof e == "number" && typeof t == "number" ? e - t : String(e).localeCompare(String(t));
27904
28012
  }
27905
- function uA(e) {
28013
+ function hA(e) {
27906
28014
  return `${[
27907
28015
  e.name,
27908
28016
  e.location ?? "",
@@ -27910,29 +28018,29 @@ function uA(e) {
27910
28018
  e.detail ?? ""
27911
28019
  ].join(" ")} ${String(e.id)}`.toLowerCase();
27912
28020
  }
27913
- function dA(e) {
28021
+ function gA(e) {
27914
28022
  return e.trim().toLowerCase().split(/\s+/).filter((e) => e.length > 0);
27915
28023
  }
27916
- function fA(e, t) {
27917
- let n = dA(t);
28024
+ function _A(e, t) {
28025
+ let n = gA(t);
27918
28026
  return n.length === 0 ? e : e.filter((e) => {
27919
- let t = uA(e);
28027
+ let t = hA(e);
27920
28028
  return n.every((e) => t.includes(e));
27921
28029
  });
27922
28030
  }
27923
- function pA(e, t) {
28031
+ function vA(e, t) {
27924
28032
  return e === t ? 0 : e === null ? 1 : t === null ? -1 : e.localeCompare(t);
27925
28033
  }
27926
- function mA(e) {
28034
+ function yA(e) {
27927
28035
  return e == null || e.trim() === "" ? null : e;
27928
28036
  }
27929
- function hA(e, t) {
28037
+ function bA(e, t) {
27930
28038
  return `${e ?? ""}|${t ?? ""}`;
27931
28039
  }
27932
- function gA(e, t) {
28040
+ function xA(e, t) {
27933
28041
  let n = new Set(t), r = /* @__PURE__ */ new Map();
27934
28042
  for (let t of e) {
27935
- let e = mA(t.type), n = mA(t.location), i = hA(e, n), a = r.get(i);
28043
+ let e = yA(t.type), n = yA(t.location), i = bA(e, n), a = r.get(i);
27936
28044
  a === void 0 ? r.set(i, {
27937
28045
  type: e,
27938
28046
  location: n,
@@ -27941,7 +28049,7 @@ function gA(e, t) {
27941
28049
  }
27942
28050
  let i = [];
27943
28051
  for (let [e, t] of r) {
27944
- let r = [...t.devices].sort((e, t) => e.name.localeCompare(t.name) || lA(e.id, t.id));
28052
+ let r = [...t.devices].sort((e, t) => e.name.localeCompare(t.name) || mA(e.id, t.id));
27945
28053
  i.push({
27946
28054
  key: e,
27947
28055
  type: t.type,
@@ -27950,16 +28058,16 @@ function gA(e, t) {
27950
28058
  selectedCount: r.filter((e) => n.has(e.id)).length
27951
28059
  });
27952
28060
  }
27953
- return i.sort((e, t) => pA(e.type, t.type) || pA(e.location, t.location));
28061
+ return i.sort((e, t) => vA(e.type, t.type) || vA(e.location, t.location));
27954
28062
  }
27955
- function _A(e, t, n) {
28063
+ function SA(e, t, n) {
27956
28064
  let r = t.get(e.key);
27957
28065
  return r === void 0 ? n || e.selectedCount > 0 ? !0 : e.devices.length <= 8 : r;
27958
28066
  }
27959
- function vA(e, t, n, r) {
28067
+ function CA(e, t, n, r) {
27960
28068
  let i = new Set(t), a = [];
27961
28069
  for (let t of e) {
27962
- let e = _A(t, n, r);
28070
+ let e = SA(t, n, r);
27963
28071
  if (a.push({
27964
28072
  kind: "header",
27965
28073
  key: `h:${t.key}`,
@@ -27975,19 +28083,19 @@ function vA(e, t, n, r) {
27975
28083
  }
27976
28084
  return a;
27977
28085
  }
27978
- function yA(e, t) {
28086
+ function wA(e, t) {
27979
28087
  return e.includes(t) ? e.filter((e) => e !== t) : [...e, t];
27980
28088
  }
27981
- function bA(e, t) {
28089
+ function TA(e, t) {
27982
28090
  let n = [...e], r = new Set(e);
27983
28091
  for (let e of t.devices) r.has(e.id) || n.push(e.id);
27984
28092
  return n;
27985
28093
  }
27986
- function xA(e, t) {
28094
+ function EA(e, t) {
27987
28095
  let n = new Set(t.devices.map((e) => e.id));
27988
28096
  return e.filter((e) => !n.has(e));
27989
28097
  }
27990
- function SA(e, t) {
28098
+ function DA(e, t) {
27991
28099
  return t || e.length <= 6 ? {
27992
28100
  shown: e,
27993
28101
  hidden: 0
@@ -27996,51 +28104,51 @@ function SA(e, t) {
27996
28104
  hidden: e.length - 6
27997
28105
  };
27998
28106
  }
27999
- function CA(e, t) {
28107
+ function OA(e, t) {
28000
28108
  let n = Math.max(0, Math.min(e.length, t));
28001
28109
  return {
28002
28110
  rows: e.slice(0, n),
28003
28111
  remaining: e.length - n
28004
28112
  };
28005
28113
  }
28006
- var wA = [
28114
+ var kA = [
28007
28115
  "zone",
28008
28116
  "location",
28009
28117
  "none"
28010
- ], TA = "zone";
28011
- function EA(e) {
28012
- return e === "zone" || e === "location" || e === "none" ? e : TA;
28118
+ ], AA = "zone";
28119
+ function jA(e) {
28120
+ return e === "zone" || e === "location" || e === "none" ? e : AA;
28013
28121
  }
28014
- function DA(e) {
28122
+ function MA(e) {
28015
28123
  return e.trim().toLowerCase();
28016
28124
  }
28017
- var OA = 1, kA = 2;
28018
- function AA(e, t) {
28019
- return e.name.localeCompare(t.name) || lA(e.id, t.id);
28125
+ var NA = 1, PA = 2;
28126
+ function FA(e, t) {
28127
+ return e.name.localeCompare(t.name) || mA(e.id, t.id);
28020
28128
  }
28021
- function jA(e) {
28129
+ function IA(e) {
28022
28130
  return e.kind === "zone" || e.kind === "location" ? e.label : "";
28023
28131
  }
28024
- var MA = {
28132
+ var LA = {
28025
28133
  key: "-location",
28026
28134
  heading: { kind: "no-location" },
28027
- rank: kA
28028
- }, NA = {
28135
+ rank: PA
28136
+ }, RA = {
28029
28137
  key: "-zone",
28030
28138
  heading: { kind: "no-zone" },
28031
- rank: OA
28139
+ rank: NA
28032
28140
  };
28033
- function PA(e) {
28141
+ function zA(e) {
28034
28142
  let t = /* @__PURE__ */ new Map();
28035
28143
  for (let n of e) for (let e of n.locationKeys) {
28036
- let r = DA(e);
28144
+ let r = MA(e);
28037
28145
  t.has(r) || t.set(r, n);
28038
28146
  }
28039
28147
  return t;
28040
28148
  }
28041
- function FA(e) {
28042
- return e === null ? MA : {
28043
- key: `l:${DA(e)}`,
28149
+ function BA(e) {
28150
+ return e === null ? LA : {
28151
+ key: `l:${MA(e)}`,
28044
28152
  heading: {
28045
28153
  kind: "location",
28046
28154
  label: e.trim()
@@ -28048,10 +28156,10 @@ function FA(e) {
28048
28156
  rank: 0
28049
28157
  };
28050
28158
  }
28051
- function IA(e, t) {
28052
- if (e === null) return MA;
28053
- let n = t.get(DA(e));
28054
- return n === void 0 ? NA : {
28159
+ function VA(e, t) {
28160
+ if (e === null) return LA;
28161
+ let n = t.get(MA(e));
28162
+ return n === void 0 ? RA : {
28055
28163
  key: `z:${n.zoneKey}`,
28056
28164
  heading: {
28057
28165
  kind: "zone",
@@ -28060,8 +28168,8 @@ function IA(e, t) {
28060
28168
  rank: 0
28061
28169
  };
28062
28170
  }
28063
- function LA(e, t, n, r) {
28064
- let i = new Set(t), a = [...e].sort(AA), o = (e) => e.filter((e) => i.has(e.id)).length;
28171
+ function HA(e, t, n, r) {
28172
+ let i = new Set(t), a = [...e].sort(FA), o = (e) => e.filter((e) => i.has(e.id)).length;
28065
28173
  if (n === "none") return {
28066
28174
  groupBy: n,
28067
28175
  fallback: null,
@@ -28074,9 +28182,9 @@ function LA(e, t, n, r) {
28074
28182
  selectedCount: o(a)
28075
28183
  }]
28076
28184
  };
28077
- let s = n === "zone" && r.state !== "answered" ? r.state : null, c = s === null ? n : "location", l = r.state === "answered" ? PA(r.zones) : /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
28185
+ let s = n === "zone" && r.state !== "answered" ? r.state : null, c = s === null ? n : "location", l = r.state === "answered" ? zA(r.zones) : /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
28078
28186
  for (let e of a) {
28079
- let t = mA(e.location), n = c === "zone" ? IA(t, l) : FA(t), r = u.get(n.key);
28187
+ let t = yA(e.location), n = c === "zone" ? VA(t, l) : BA(t), r = u.get(n.key);
28080
28188
  r === void 0 ? u.set(n.key, {
28081
28189
  heading: n.heading,
28082
28190
  rank: n.rank,
@@ -28087,7 +28195,7 @@ function LA(e, t, n, r) {
28087
28195
  groupBy: c,
28088
28196
  fallback: s,
28089
28197
  flat: !1,
28090
- groups: [...u].sort(([, e], [, t]) => e.rank - t.rank || jA(e.heading).localeCompare(jA(t.heading))).map(([e, t]) => ({
28198
+ groups: [...u].sort(([, e], [, t]) => e.rank - t.rank || IA(e.heading).localeCompare(IA(t.heading))).map(([e, t]) => ({
28091
28199
  key: e,
28092
28200
  type: null,
28093
28201
  location: t.heading.kind === "location" ? t.heading.label : null,
@@ -28097,8 +28205,8 @@ function LA(e, t, n, r) {
28097
28205
  }))
28098
28206
  };
28099
28207
  }
28100
- function RA(e, t, n, r) {
28101
- if (!e.flat) return vA(e.groups, t, n, r);
28208
+ function UA(e, t, n, r) {
28209
+ if (!e.flat) return CA(e.groups, t, n, r);
28102
28210
  let i = new Set(t), a = [];
28103
28211
  for (let t of e.groups) for (let e of t.devices) a.push({
28104
28212
  kind: "device",
@@ -28109,53 +28217,53 @@ function RA(e, t, n, r) {
28109
28217
  });
28110
28218
  return a;
28111
28219
  }
28112
- function zA(e, t) {
28220
+ function WA(e, t) {
28113
28221
  return {
28114
- location: t === "location" ? null : mA(e.location),
28115
- type: mA(e.type)
28222
+ location: t === "location" ? null : yA(e.location),
28223
+ type: yA(e.type)
28116
28224
  };
28117
28225
  }
28118
- var BA = "(none)", VA = {
28226
+ var GA = "(none)", KA = {
28119
28227
  query: "",
28120
28228
  types: [],
28121
28229
  zones: [],
28122
28230
  locations: []
28123
- }, HA = {
28124
- key: BA,
28231
+ }, qA = {
28232
+ key: GA,
28125
28233
  label: null
28126
28234
  };
28127
- function UA(e, t, n) {
28235
+ function JA(e, t, n) {
28128
28236
  if (t === "type") {
28129
- let t = mA(e.type);
28130
- return t === null ? HA : {
28237
+ let t = yA(e.type);
28238
+ return t === null ? qA : {
28131
28239
  key: t,
28132
28240
  label: t
28133
28241
  };
28134
28242
  }
28135
- let r = mA(e.location);
28136
- if (r === null) return HA;
28243
+ let r = yA(e.location);
28244
+ if (r === null) return qA;
28137
28245
  if (t === "location") return {
28138
- key: DA(r),
28246
+ key: MA(r),
28139
28247
  label: r.trim()
28140
28248
  };
28141
- if (n.state !== "answered") return HA;
28142
- let i = PA(n.zones).get(DA(r));
28143
- return i === void 0 ? HA : {
28249
+ if (n.state !== "answered") return qA;
28250
+ let i = zA(n.zones).get(MA(r));
28251
+ return i === void 0 ? qA : {
28144
28252
  key: i.zoneKey,
28145
28253
  label: i.label
28146
28254
  };
28147
28255
  }
28148
- function WA(e, t, n) {
28149
- return UA(e, t, n).key;
28256
+ function YA(e, t, n) {
28257
+ return JA(e, t, n).key;
28150
28258
  }
28151
- function GA(e, t) {
28259
+ function XA(e, t) {
28152
28260
  return e.key === "(none)" || t.key === "(none)" ? e.key === t.key ? 0 : e.key === "(none)" ? 1 : -1 : (e.label ?? "").localeCompare(t.label ?? "");
28153
28261
  }
28154
- function KA(e, t, n, r) {
28262
+ function ZA(e, t, n, r) {
28155
28263
  if (t === "zone" && r.state !== "answered") return [];
28156
28264
  let i = /* @__PURE__ */ new Map();
28157
28265
  for (let n of e) {
28158
- let e = UA(n, t, r), a = i.get(e.key);
28266
+ let e = JA(n, t, r), a = i.get(e.key);
28159
28267
  a === void 0 ? i.set(e.key, {
28160
28268
  label: e.label,
28161
28269
  count: 1
@@ -28171,59 +28279,59 @@ function KA(e, t, n, r) {
28171
28279
  label: t.label,
28172
28280
  count: t.count
28173
28281
  });
28174
- return a.sort(GA);
28282
+ return a.sort(XA);
28175
28283
  }
28176
- function qA(e, t) {
28284
+ function QA(e, t) {
28177
28285
  return e.zones.length > 0 && t.state !== "answered";
28178
28286
  }
28179
- function JA(e, t, n, r) {
28180
- return n.length === 0 ? e : e.filter((e) => n.includes(WA(e, t, r)));
28287
+ function $A(e, t, n, r) {
28288
+ return n.length === 0 ? e : e.filter((e) => n.includes(YA(e, t, r)));
28181
28289
  }
28182
- function YA(e, t, n) {
28183
- let r = JA(fA(e, t.query), "type", t.types, n);
28184
- return JA(n.state === "answered" ? JA(r, "zone", t.zones, n) : r, "location", t.locations, n);
28290
+ function ej(e, t, n) {
28291
+ let r = $A(_A(e, t.query), "type", t.types, n);
28292
+ return $A(n.state === "answered" ? $A(r, "zone", t.zones, n) : r, "location", t.locations, n);
28185
28293
  }
28186
- function XA(e, t) {
28294
+ function tj(e, t) {
28187
28295
  return e.includes(t) ? e.filter((e) => e !== t) : [...e, t];
28188
28296
  }
28189
- function ZA(e) {
28297
+ function nj(e) {
28190
28298
  return e.query.trim() !== "" || e.types.length > 0 || e.zones.length > 0 || e.locations.length > 0;
28191
28299
  }
28192
- function QA() {
28193
- return VA;
28300
+ function rj() {
28301
+ return KA;
28194
28302
  }
28195
- function $A(e, t, n) {
28303
+ function ij(e, t, n) {
28196
28304
  let r = new Set(t.map((e) => e.id)), i = new Set(n.map((e) => e.id));
28197
28305
  return e.filter((e) => r.has(e) && !i.has(e)).length;
28198
28306
  }
28199
- function ej(e, t) {
28307
+ function aj(e, t) {
28200
28308
  return e.length >= 2 || t.length > 0;
28201
28309
  }
28202
28310
  //#endregion
28203
28311
  //#region ../ui-library/src/composites/device-picker/device-filter-bar.tsx
28204
28312
  i();
28205
- function tj(e) {
28313
+ function oj(e) {
28206
28314
  if (e === null) return "No type";
28207
28315
  let t = e.replaceAll("-", " ");
28208
28316
  return t.charAt(0).toUpperCase() + t.slice(1);
28209
28317
  }
28210
- var nj = {
28318
+ var sj = {
28211
28319
  zone: "Zone",
28212
28320
  location: "Location",
28213
28321
  none: "None"
28214
- }, rj = {
28322
+ }, cj = {
28215
28323
  type: "Type",
28216
28324
  zone: "Zone",
28217
28325
  location: "Location"
28218
- }, ij = {
28326
+ }, lj = {
28219
28327
  type: "No type",
28220
28328
  zone: "No zone",
28221
28329
  location: "No location"
28222
28330
  };
28223
- function aj(e, t) {
28224
- return t.key === "(none)" || t.label === null ? ij[e] : e === "type" ? tj(t.label) : t.label;
28331
+ function uj(e, t) {
28332
+ return t.key === "(none)" || t.label === null ? lj[e] : e === "type" ? oj(t.label) : t.label;
28225
28333
  }
28226
- function oj({ grouping: e }) {
28334
+ function dj({ grouping: e }) {
28227
28335
  return /* @__PURE__ */ H("div", {
28228
28336
  className: "mb-1.5",
28229
28337
  children: [/* @__PURE__ */ H("div", {
@@ -28233,7 +28341,7 @@ function oj({ grouping: e }) {
28233
28341
  children: [/* @__PURE__ */ V("span", {
28234
28342
  className: "mr-1 font-semibold uppercase tracking-wide",
28235
28343
  children: "Group by"
28236
- }), wA.map((t) => {
28344
+ }), kA.map((t) => {
28237
28345
  let n = t === e.groupBy;
28238
28346
  return /* @__PURE__ */ V("button", {
28239
28347
  type: "button",
@@ -28241,7 +28349,7 @@ function oj({ grouping: e }) {
28241
28349
  "aria-checked": n,
28242
28350
  onClick: () => e.onGroupByChange(t),
28243
28351
  className: n ? "rounded-md border border-primary bg-primary/10 px-1.5 py-0.5 text-[11px] text-primary" : "rounded-md border border-border px-1.5 py-0.5 text-[11px] text-foreground-subtle hover:bg-surface-hover",
28244
- children: nj[t]
28352
+ children: sj[t]
28245
28353
  }, t);
28246
28354
  })]
28247
28355
  }), e.fallback !== null && /* @__PURE__ */ V("p", {
@@ -28251,8 +28359,8 @@ function oj({ grouping: e }) {
28251
28359
  })]
28252
28360
  });
28253
28361
  }
28254
- function sj({ facet: e, options: t, chosen: n, onChange: r, unavailable: i, disabled: a }) {
28255
- let o = rj[e], s = i === void 0 ? n.length === 0 ? "All" : `${String(n.length)} selected` : i;
28362
+ function fj({ facet: e, options: t, chosen: n, onChange: r, unavailable: i, disabled: a }) {
28363
+ let o = cj[e], s = i === void 0 ? n.length === 0 ? "All" : `${String(n.length)} selected` : i;
28256
28364
  return /* @__PURE__ */ V("div", {
28257
28365
  "data-testid": `picker-filter-${e}`,
28258
28366
  children: /* @__PURE__ */ H(fg, { children: [/* @__PURE__ */ H(pg, {
@@ -28266,13 +28374,13 @@ function sj({ facet: e, options: t, chosen: n, onChange: r, unavailable: i, disa
28266
28374
  }), /* @__PURE__ */ V(mg, {
28267
28375
  className: "min-w-[200px] max-h-[40vh] overflow-y-auto p-1",
28268
28376
  children: t.map((t) => {
28269
- let i = aj(e, t);
28377
+ let i = uj(e, t);
28270
28378
  return /* @__PURE__ */ H("label", {
28271
28379
  className: "flex cursor-pointer items-center gap-2 px-2 py-1 text-xs text-foreground hover:bg-surface-hover",
28272
28380
  children: [
28273
28381
  /* @__PURE__ */ V(tg, {
28274
28382
  checked: n.includes(t.key),
28275
- onChange: () => r(XA(n, t.key)),
28383
+ onChange: () => r(tj(n, t.key)),
28276
28384
  "aria-label": i
28277
28385
  }),
28278
28386
  /* @__PURE__ */ V("span", {
@@ -28293,11 +28401,11 @@ function sj({ facet: e, options: t, chosen: n, onChange: r, unavailable: i, disa
28293
28401
  })] })
28294
28402
  });
28295
28403
  }
28296
- function cj(e) {
28404
+ function pj(e) {
28297
28405
  if (e.state === "pending") return "loading zones…";
28298
28406
  if (e.state === "failed") return "zones unavailable";
28299
28407
  }
28300
- function lj({ filters: e, onFiltersChange: t, typeOptions: n, zoneOptions: r, locationOptions: i, zones: o, grouping: s, searchPlaceholder: c, searchLabel: l, disabled: d = !1 }) {
28408
+ function mj({ filters: e, onFiltersChange: t, typeOptions: n, zoneOptions: r, locationOptions: i, zones: o, grouping: s, searchPlaceholder: c, searchLabel: l, disabled: d = !1 }) {
28301
28409
  let [f, p] = a(e.query), m = u({
28302
28410
  filters: e,
28303
28411
  onFiltersChange: t
@@ -28313,12 +28421,12 @@ function lj({ filters: e, onFiltersChange: t, typeOptions: n, zoneOptions: r, lo
28313
28421
  }), 200);
28314
28422
  return () => clearTimeout(e);
28315
28423
  }, [f]);
28316
- let h = cj(o), g = h !== void 0 || ej(r, e.zones), _ = ZA(e) || f.trim() !== "";
28424
+ let h = pj(o), g = h !== void 0 || aj(r, e.zones), _ = nj(e) || f.trim() !== "";
28317
28425
  return /* @__PURE__ */ H("div", {
28318
28426
  className: "space-y-1.5",
28319
28427
  "data-testid": "device-filter-bar",
28320
28428
  children: [
28321
- s !== void 0 && /* @__PURE__ */ V(oj, { grouping: s }),
28429
+ s !== void 0 && /* @__PURE__ */ V(dj, { grouping: s }),
28322
28430
  /* @__PURE__ */ H("div", {
28323
28431
  className: ll,
28324
28432
  children: [/* @__PURE__ */ V(li, { className: "h-3.5 w-3.5 shrink-0 text-foreground-subtle" }), /* @__PURE__ */ V("input", {
@@ -28333,7 +28441,7 @@ function lj({ filters: e, onFiltersChange: t, typeOptions: n, zoneOptions: r, lo
28333
28441
  /* @__PURE__ */ H("div", {
28334
28442
  className: "flex flex-wrap items-center gap-1",
28335
28443
  children: [
28336
- ej(n, e.types) && /* @__PURE__ */ V(sj, {
28444
+ aj(n, e.types) && /* @__PURE__ */ V(fj, {
28337
28445
  facet: "type",
28338
28446
  options: n,
28339
28447
  chosen: e.types,
@@ -28343,7 +28451,7 @@ function lj({ filters: e, onFiltersChange: t, typeOptions: n, zoneOptions: r, lo
28343
28451
  }),
28344
28452
  disabled: d
28345
28453
  }),
28346
- g && /* @__PURE__ */ V(sj, {
28454
+ g && /* @__PURE__ */ V(fj, {
28347
28455
  facet: "zone",
28348
28456
  options: r,
28349
28457
  chosen: e.zones,
@@ -28354,7 +28462,7 @@ function lj({ filters: e, onFiltersChange: t, typeOptions: n, zoneOptions: r, lo
28354
28462
  ...h === void 0 ? {} : { unavailable: h },
28355
28463
  disabled: d
28356
28464
  }),
28357
- ej(i, e.locations) && /* @__PURE__ */ V(sj, {
28465
+ aj(i, e.locations) && /* @__PURE__ */ V(fj, {
28358
28466
  facet: "location",
28359
28467
  options: i,
28360
28468
  chosen: e.locations,
@@ -28368,13 +28476,13 @@ function lj({ filters: e, onFiltersChange: t, typeOptions: n, zoneOptions: r, lo
28368
28476
  variant: "ghost",
28369
28477
  "data-testid": "picker-reset-filters",
28370
28478
  onClick: () => {
28371
- p(""), t(QA());
28479
+ p(""), t(rj());
28372
28480
  },
28373
28481
  children: "Reset filters"
28374
28482
  })
28375
28483
  ]
28376
28484
  }),
28377
- qA(e, o) && /* @__PURE__ */ V("p", {
28485
+ QA(e, o) && /* @__PURE__ */ V("p", {
28378
28486
  className: "text-[10px] text-foreground-subtle",
28379
28487
  "data-testid": "picker-zone-filter-paused",
28380
28488
  children: "Zone filter paused — zones not loaded"
@@ -28384,7 +28492,7 @@ function lj({ filters: e, onFiltersChange: t, typeOptions: n, zoneOptions: r, lo
28384
28492
  }
28385
28493
  //#endregion
28386
28494
  //#region ../ui-library/src/composites/device-picker/device-parent.ts
28387
- function uj(e) {
28495
+ function hj(e) {
28388
28496
  let t = /* @__PURE__ */ new Map();
28389
28497
  for (let n of e) t.set(n.id, n.name);
28390
28498
  let n = /* @__PURE__ */ new Map();
@@ -28394,19 +28502,19 @@ function uj(e) {
28394
28502
  }
28395
28503
  return n;
28396
28504
  }
28397
- function dj(e) {
28505
+ function gj(e) {
28398
28506
  if (!(e === void 0 || e.length === 0)) return `in ${e}`;
28399
28507
  }
28400
- function fj(e) {
28508
+ function _j(e) {
28401
28509
  let t = e.filter((e) => typeof e.id == "number");
28402
28510
  if (t.length === 0) return e;
28403
- let n = uj(t.map((e) => ({
28511
+ let n = hj(t.map((e) => ({
28404
28512
  id: e.id,
28405
28513
  name: e.name,
28406
28514
  parentDeviceId: e.parentDeviceId ?? null
28407
28515
  }))), r = !1, i = e.map((e) => {
28408
28516
  if (e.detail !== void 0 || typeof e.id != "number") return e;
28409
- let t = dj(n.get(e.id));
28517
+ let t = gj(n.get(e.id));
28410
28518
  return t === void 0 ? e : (r = !0, {
28411
28519
  ...e,
28412
28520
  detail: t
@@ -28417,34 +28525,34 @@ function fj(e) {
28417
28525
  //#endregion
28418
28526
  //#region ../ui-library/src/composites/device-picker/device-picker-grouping.ts
28419
28527
  i();
28420
- var pj = "camstack.admin.device-picker.group-by", mj = [["deviceManager", "listSiteZones"], "device-picker"], hj = 6e4;
28421
- function gj() {
28528
+ var vj = "camstack.admin.device-picker.group-by", yj = [["deviceManager", "listSiteZones"], "device-picker"], bj = 6e4;
28529
+ function xj() {
28422
28530
  try {
28423
28531
  let e = globalThis.localStorage?.getItem("camstack.admin.device-picker.group-by") ?? null;
28424
- return e === null ? TA : EA(e);
28532
+ return e === null ? AA : jA(e);
28425
28533
  } catch {
28426
- return TA;
28534
+ return AA;
28427
28535
  }
28428
28536
  }
28429
- function _j(e) {
28537
+ function Sj(e) {
28430
28538
  try {
28431
- globalThis.localStorage?.setItem(pj, e);
28539
+ globalThis.localStorage?.setItem(vj, e);
28432
28540
  } catch {}
28433
28541
  }
28434
- function vj() {
28435
- let [e, t] = a(gj);
28542
+ function Cj() {
28543
+ let [e, t] = a(xj);
28436
28544
  return {
28437
28545
  groupBy: e,
28438
28546
  setGroupBy: (e) => {
28439
- t(e), _j(e);
28547
+ t(e), Sj(e);
28440
28548
  }
28441
28549
  };
28442
28550
  }
28443
- function yj(e) {
28551
+ function wj(e) {
28444
28552
  let t = j().trpcClient, { data: n, isError: r } = ct({
28445
- queryKey: mj,
28553
+ queryKey: yj,
28446
28554
  enabled: e,
28447
- staleTime: hj,
28555
+ staleTime: bj,
28448
28556
  queryFn: () => t.deviceManager.listSiteZones.query()
28449
28557
  });
28450
28558
  return m(() => n === void 0 ? r ? { state: "failed" } : { state: "pending" } : {
@@ -28454,10 +28562,10 @@ function yj(e) {
28454
28562
  }
28455
28563
  //#endregion
28456
28564
  //#region ../ui-library/src/composites/device-picker/device-selection.ts
28457
- function bj(e) {
28565
+ function Tj(e) {
28458
28566
  return e.data === void 0 ? e.isError ? "failed" : "pending" : "answered";
28459
28567
  }
28460
- function xj(e, t, n) {
28568
+ function Ej(e, t, n) {
28461
28569
  if (n !== "answered" || t === void 0) return e.map((e) => ({
28462
28570
  id: e,
28463
28571
  removed: !1
@@ -28475,19 +28583,19 @@ function xj(e, t, n) {
28475
28583
  };
28476
28584
  });
28477
28585
  }
28478
- function Sj(e, t, n, r) {
28586
+ function Dj(e, t, n, r) {
28479
28587
  let i = new Set((t ?? []).map((e) => e.id));
28480
- return xj(e.filter((e) => !i.has(e)), n, r);
28588
+ return Ej(e.filter((e) => !i.has(e)), n, r);
28481
28589
  }
28482
- function Cj(e, t, n) {
28590
+ function Oj(e, t, n) {
28483
28591
  return e === "answered" && t === 0 && n === 0;
28484
28592
  }
28485
- function wj(e, t, n) {
28593
+ function kj(e, t, n) {
28486
28594
  return e && t === 0 && n;
28487
28595
  }
28488
28596
  //#endregion
28489
28597
  //#region ../ui-library/src/composites/device-picker/device-selection-rows.tsx
28490
- var Tj = {
28598
+ var Aj = {
28491
28599
  camera: "cameras",
28492
28600
  device: "devices",
28493
28601
  node: "nodes",
@@ -28497,7 +28605,7 @@ var Tj = {
28497
28605
  face: "faces",
28498
28606
  calendar: "calendars"
28499
28607
  };
28500
- function Ej(e, t = "device") {
28608
+ function jj(e, t = "device") {
28501
28609
  let n = String(e.id);
28502
28610
  switch (t) {
28503
28611
  case "node": return e.removed ? `Node ${n} — unknown to the hub` : e.name ?? `Node ${n}`;
@@ -28510,7 +28618,7 @@ function Ej(e, t = "device") {
28510
28618
  case "device": return e.removed ? `Device #${n} — removed` : e.name ?? `Device #${n}`;
28511
28619
  }
28512
28620
  }
28513
- function Dj({ noun: e = "camera" }) {
28621
+ function Mj({ noun: e = "camera" }) {
28514
28622
  return /* @__PURE__ */ H("p", {
28515
28623
  className: "mt-1 text-[11px] text-warning",
28516
28624
  "data-testid": "devices-widen-warning",
@@ -28518,12 +28626,12 @@ function Dj({ noun: e = "camera" }) {
28518
28626
  "No ",
28519
28627
  e,
28520
28628
  " selected: the rule will apply to ALL ",
28521
- Tj[e],
28629
+ Aj[e],
28522
28630
  "."
28523
28631
  ]
28524
28632
  });
28525
28633
  }
28526
- function Oj({ noun: e = "cameras" }) {
28634
+ function Nj({ noun: e = "cameras" }) {
28527
28635
  return /* @__PURE__ */ H("p", {
28528
28636
  className: "text-[11px] text-foreground-subtle",
28529
28637
  children: [
@@ -28533,7 +28641,7 @@ function Oj({ noun: e = "cameras" }) {
28533
28641
  ]
28534
28642
  });
28535
28643
  }
28536
- function kj({ noun: e = "devices" }) {
28644
+ function Pj({ noun: e = "devices" }) {
28537
28645
  return /* @__PURE__ */ H("p", {
28538
28646
  className: "text-[11px] text-warning",
28539
28647
  children: [
@@ -28546,7 +28654,7 @@ function kj({ noun: e = "devices" }) {
28546
28654
  //#endregion
28547
28655
  //#region ../ui-library/src/composites/device-picker/DevicePicker.tsx
28548
28656
  i();
28549
- function Aj(e) {
28657
+ function Fj(e) {
28550
28658
  switch (e.kind) {
28551
28659
  case "zone":
28552
28660
  case "location": return e.label;
@@ -28554,14 +28662,14 @@ function Aj(e) {
28554
28662
  case "no-location": return "No location";
28555
28663
  }
28556
28664
  }
28557
- function jj(e) {
28558
- return e.heading === void 0 ? `${tj(e.type)} · ${e.location ?? "No room"}` : Aj(e.heading);
28665
+ function Ij(e) {
28666
+ return e.heading === void 0 ? `${oj(e.type)} · ${e.location ?? "No room"}` : Fj(e.heading);
28559
28667
  }
28560
- function Mj(e) {
28668
+ function Lj(e) {
28561
28669
  return e === "camera" || e === "device";
28562
28670
  }
28563
- function Nj(e, t, n, r) {
28564
- let i = new Map(t.map((e) => [e.id, e.name])), a = new Map(Sj(e, t, n.devices, n.state).map((e) => [e.id, e]));
28671
+ function Rj(e, t, n, r) {
28672
+ let i = new Map(t.map((e) => [e.id, e.name])), a = new Map(Dj(e, t, n.devices, n.state).map((e) => [e.id, e]));
28565
28673
  return e.map((e) => {
28566
28674
  let t = i.get(e);
28567
28675
  if (t !== void 0) return {
@@ -28575,34 +28683,34 @@ function Nj(e, t, n, r) {
28575
28683
  };
28576
28684
  return {
28577
28685
  id: e,
28578
- label: Ej(n, r),
28686
+ label: jj(n, r),
28579
28687
  removed: n.removed
28580
28688
  };
28581
28689
  });
28582
28690
  }
28583
- function Pj(e, t) {
28584
- let n = Tj[e];
28691
+ function zj(e, t) {
28692
+ let n = Aj[e];
28585
28693
  return t ? e === "camera" || e === "device" ? "No cameras available — the rule applies to all devices." : `No ${n} available — the rule applies to every ${e}.` : `No ${n} available.`;
28586
28694
  }
28587
- function Fj({ devices: e, listState: t, fleet: n, value: r, onChange: i, emptyMeansAll: o = !1, savedHadDevices: s = !1, noun: c = "camera", groupTitle: l = jj, emptyLabel: u, annotate: d, disabled: f = !1, testId: p, showAll: h = !1 }) {
28588
- let g = m(() => fj(e), [e]), _ = n ?? {
28695
+ function Bj({ devices: e, listState: t, fleet: n, value: r, onChange: i, emptyMeansAll: o = !1, savedHadDevices: s = !1, noun: c = "camera", groupTitle: l = Ij, emptyLabel: u, annotate: d, disabled: f = !1, testId: p, showAll: h = !1 }) {
28696
+ let g = m(() => _j(e), [e]), _ = n ?? {
28589
28697
  state: t,
28590
28698
  devices: t === "answered" ? g : void 0
28591
28699
  }, [v, y] = a(!1), [b, x] = a(!1), [S, C] = a(s || r.length > 0);
28592
28700
  r.length > 0 && !S && C(!0);
28593
- let w = Nj(r, g, _, c), T = SA(w, b || h), E = v || h, D = wj(o, r.length, S), O = Tj[c];
28594
- return t === "answered" && Cj(t, g.length, r.length) ? /* @__PURE__ */ H("div", {
28701
+ let w = Rj(r, g, _, c), T = DA(w, b || h), E = v || h, D = kj(o, r.length, S), O = Aj[c];
28702
+ return t === "answered" && Oj(t, g.length, r.length) ? /* @__PURE__ */ H("div", {
28595
28703
  "data-testid": p,
28596
28704
  children: [/* @__PURE__ */ V("p", {
28597
28705
  className: "text-[10px] text-foreground-subtle mt-0.5",
28598
- children: Pj(c, o)
28599
- }), D && /* @__PURE__ */ V(Dj, { noun: c })]
28706
+ children: zj(c, o)
28707
+ }), D && /* @__PURE__ */ V(Mj, { noun: c })]
28600
28708
  }) : /* @__PURE__ */ H("div", {
28601
28709
  className: "mt-1 space-y-1.5",
28602
28710
  "data-testid": p,
28603
28711
  children: [
28604
- t === "pending" && /* @__PURE__ */ V(Oj, { noun: O }),
28605
- t === "failed" && /* @__PURE__ */ V(kj, { noun: c === "camera" ? "devices" : O }),
28712
+ t === "pending" && /* @__PURE__ */ V(Nj, { noun: O }),
28713
+ t === "failed" && /* @__PURE__ */ V(Pj, { noun: c === "camera" ? "devices" : O }),
28606
28714
  /* @__PURE__ */ H("div", {
28607
28715
  className: "flex flex-wrap items-center gap-1",
28608
28716
  children: [
@@ -28641,7 +28749,7 @@ function Fj({ devices: e, listState: t, fleet: n, value: r, onChange: i, emptyMe
28641
28749
  })
28642
28750
  ]
28643
28751
  }),
28644
- E && t === "answered" && (Mj(c) ? /* @__PURE__ */ V(Ij, {
28752
+ E && t === "answered" && (Lj(c) ? /* @__PURE__ */ V(Vj, {
28645
28753
  devices: g,
28646
28754
  value: r,
28647
28755
  onChange: i,
@@ -28650,7 +28758,7 @@ function Fj({ devices: e, listState: t, fleet: n, value: r, onChange: i, emptyMe
28650
28758
  noun: c,
28651
28759
  disabled: f,
28652
28760
  showAll: h
28653
- }) : /* @__PURE__ */ V(zj, {
28761
+ }) : /* @__PURE__ */ V(Wj, {
28654
28762
  devices: g,
28655
28763
  value: r,
28656
28764
  onChange: i,
@@ -28660,13 +28768,13 @@ function Fj({ devices: e, listState: t, fleet: n, value: r, onChange: i, emptyMe
28660
28768
  disabled: f,
28661
28769
  showAll: h
28662
28770
  })),
28663
- D && /* @__PURE__ */ V(Dj, { noun: c })
28771
+ D && /* @__PURE__ */ V(Mj, { noun: c })
28664
28772
  ]
28665
28773
  });
28666
28774
  }
28667
- function Ij(e) {
28668
- let { groupBy: t, setGroupBy: n } = vj(), r = yj(!0);
28669
- return /* @__PURE__ */ V(zj, {
28775
+ function Vj(e) {
28776
+ let { groupBy: t, setGroupBy: n } = Cj(), r = wj(!0);
28777
+ return /* @__PURE__ */ V(Wj, {
28670
28778
  ...e,
28671
28779
  grouping: {
28672
28780
  groupBy: t,
@@ -28675,52 +28783,52 @@ function Ij(e) {
28675
28783
  }
28676
28784
  });
28677
28785
  }
28678
- function Lj(e) {
28786
+ function Hj(e) {
28679
28787
  return e === "camera" || e === "device" ? "Search by name, room or type…" : e === "class" ? "Search by class or category…" : e === "zone" ? "Search by camera or zone…" : "Search by name or id…";
28680
28788
  }
28681
- var Rj = {
28789
+ var Uj = {
28682
28790
  state: "answered",
28683
28791
  zones: []
28684
28792
  };
28685
- function zj({ devices: e, value: t, onChange: n, annotate: r, groupTitle: i, noun: o, disabled: s, showAll: c, grouping: l }) {
28686
- let [u, d] = a(VA), [f, p] = a(/* @__PURE__ */ new Map()), [h, g] = a(60), _ = c || dA(u.query).length > 0, v = l?.groupBy, y = l?.zones ?? Rj, b = m(() => YA(e, u, y), [
28793
+ function Wj({ devices: e, value: t, onChange: n, annotate: r, groupTitle: i, noun: o, disabled: s, showAll: c, grouping: l }) {
28794
+ let [u, d] = a(KA), [f, p] = a(/* @__PURE__ */ new Map()), [h, g] = a(60), _ = c || gA(u.query).length > 0, v = l?.groupBy, y = l?.zones ?? Uj, b = m(() => ej(e, u, y), [
28687
28795
  e,
28688
28796
  u,
28689
28797
  y
28690
- ]), x = m(() => v === void 0 ? null : LA(b, t, v, y), [
28798
+ ]), x = m(() => v === void 0 ? null : HA(b, t, v, y), [
28691
28799
  b,
28692
28800
  t,
28693
28801
  v,
28694
28802
  y
28695
- ]), S = m(() => x === null ? vA(gA(b, t), t, f, _) : RA(x, t, f, _), [
28803
+ ]), S = m(() => x === null ? CA(xA(b, t), t, f, _) : UA(x, t, f, _), [
28696
28804
  x,
28697
28805
  b,
28698
28806
  t,
28699
28807
  f,
28700
28808
  _
28701
- ]), C = x?.groupBy ?? null, w = m(() => KA(e, "type", u.types, y), [
28809
+ ]), C = x?.groupBy ?? null, w = m(() => ZA(e, "type", u.types, y), [
28702
28810
  e,
28703
28811
  u.types,
28704
28812
  y
28705
- ]), T = m(() => KA(e, "zone", u.zones, y), [
28813
+ ]), T = m(() => ZA(e, "zone", u.zones, y), [
28706
28814
  e,
28707
28815
  u.zones,
28708
28816
  y
28709
- ]), E = m(() => l === void 0 ? [] : KA(e, "location", u.locations, y), [
28817
+ ]), E = m(() => l === void 0 ? [] : ZA(e, "location", u.locations, y), [
28710
28818
  e,
28711
28819
  u.locations,
28712
28820
  y,
28713
28821
  l
28714
- ]), D = m(() => $A(t, e, b), [
28822
+ ]), D = m(() => ij(t, e, b), [
28715
28823
  e,
28716
28824
  t,
28717
28825
  b
28718
- ]), O = CA(S, c ? S.length : h), k = (e, t) => p((n) => new Map([...n, [e.key, !t]]));
28826
+ ]), O = OA(S, c ? S.length : h), k = (e, t) => p((n) => new Map([...n, [e.key, !t]]));
28719
28827
  return /* @__PURE__ */ H("div", {
28720
28828
  className: "rounded-md border border-border bg-surface p-2",
28721
28829
  "data-testid": "device-picker-panel",
28722
28830
  children: [
28723
- /* @__PURE__ */ V(lj, {
28831
+ /* @__PURE__ */ V(mj, {
28724
28832
  filters: u,
28725
28833
  onFiltersChange: (e) => {
28726
28834
  d(e), g(60);
@@ -28734,8 +28842,8 @@ function zj({ devices: e, value: t, onChange: n, annotate: r, groupTitle: i, nou
28734
28842
  onGroupByChange: l.onGroupByChange,
28735
28843
  fallback: x?.fallback ?? null
28736
28844
  } },
28737
- searchPlaceholder: Lj(o),
28738
- searchLabel: o === "camera" || o === "device" ? "Search devices" : `Search ${Tj[o]}`,
28845
+ searchPlaceholder: Hj(o),
28846
+ searchLabel: o === "camera" || o === "device" ? "Search devices" : `Search ${Aj[o]}`,
28739
28847
  disabled: s
28740
28848
  }),
28741
28849
  /* @__PURE__ */ H("p", {
@@ -28755,7 +28863,7 @@ function zj({ devices: e, value: t, onChange: n, annotate: r, groupTitle: i, nou
28755
28863
  }) : /* @__PURE__ */ H("div", {
28756
28864
  className: c ? "mt-1" : "mt-1 max-h-72 overflow-y-auto",
28757
28865
  "data-testid": "device-picker-rows",
28758
- children: [O.rows.map((e) => /* @__PURE__ */ V(Vj, {
28866
+ children: [O.rows.map((e) => /* @__PURE__ */ V(Kj, {
28759
28867
  row: e,
28760
28868
  value: t,
28761
28869
  onChange: n,
@@ -28785,16 +28893,16 @@ function zj({ devices: e, value: t, onChange: n, annotate: r, groupTitle: i, nou
28785
28893
  ]
28786
28894
  });
28787
28895
  }
28788
- function Bj(e, t) {
28896
+ function Gj(e, t) {
28789
28897
  if (t === null) return e.detail;
28790
- let n = zA(e, t), r = [
28898
+ let n = WA(e, t), r = [
28791
28899
  n.location,
28792
- n.type === null ? null : tj(n.type),
28900
+ n.type === null ? null : oj(n.type),
28793
28901
  e.detail ?? null
28794
28902
  ].filter((e) => e !== null);
28795
28903
  return r.length > 0 ? r.join(" · ") : void 0;
28796
28904
  }
28797
- function Vj({ row: e, value: t, onChange: n, onToggleGroup: r, annotate: i, groupTitle: a, groupBy: o, disabled: s }) {
28905
+ function Kj({ row: e, value: t, onChange: n, onToggleGroup: r, annotate: i, groupTitle: a, groupBy: o, disabled: s }) {
28798
28906
  if (e.kind === "header") {
28799
28907
  let { group: i, expanded: o } = e;
28800
28908
  return /* @__PURE__ */ H("div", {
@@ -28828,20 +28936,20 @@ function Vj({ row: e, value: t, onChange: n, onToggleGroup: r, annotate: i, grou
28828
28936
  type: "button",
28829
28937
  disabled: s,
28830
28938
  className: "text-[10px] text-primary hover:underline disabled:opacity-50",
28831
- onClick: () => n(bA(t, i)),
28939
+ onClick: () => n(TA(t, i)),
28832
28940
  children: "All"
28833
28941
  }),
28834
28942
  /* @__PURE__ */ V("button", {
28835
28943
  type: "button",
28836
28944
  disabled: s,
28837
28945
  className: "text-[10px] text-foreground-subtle hover:underline disabled:opacity-50",
28838
- onClick: () => n(xA(t, i)),
28946
+ onClick: () => n(EA(t, i)),
28839
28947
  children: "Clear"
28840
28948
  })
28841
28949
  ]
28842
28950
  });
28843
28951
  }
28844
- let c = i?.(e.device.id), l = Bj(e.device, o);
28952
+ let c = i?.(e.device.id), l = Gj(e.device, o);
28845
28953
  return /* @__PURE__ */ H("label", {
28846
28954
  className: "flex cursor-pointer items-center gap-2.5 px-3 py-1 text-xs text-foreground hover:bg-surface-hover",
28847
28955
  "data-testid": "device-picker-row",
@@ -28849,7 +28957,7 @@ function Vj({ row: e, value: t, onChange: n, onToggleGroup: r, annotate: i, grou
28849
28957
  type: "checkbox",
28850
28958
  checked: e.selected,
28851
28959
  disabled: s,
28852
- onChange: () => n(yA(t, e.device.id)),
28960
+ onChange: () => n(wA(t, e.device.id)),
28853
28961
  className: "accent-primary",
28854
28962
  "data-device-id": String(e.device.id)
28855
28963
  }), /* @__PURE__ */ H("span", {
@@ -28871,45 +28979,24 @@ function Vj({ row: e, value: t, onChange: n, onToggleGroup: r, annotate: i, grou
28871
28979
  })]
28872
28980
  });
28873
28981
  }
28874
- //#endregion
28875
- //#region ../ui-library/src/hooks/use-url-query.ts
28876
- i(), i(), O("camstack:zone-editing", null), i();
28877
- function Hj(e) {
28878
- return new URLSearchParams(window.location.search).get(e);
28879
- }
28880
- function Uj(e, t) {
28881
- let n = new URLSearchParams(window.location.search);
28882
- t === null || t === "" ? n.delete(e) : n.set(e, t);
28883
- let r = n.toString(), i = r ? `${window.location.pathname}?${r}` : window.location.pathname;
28884
- window.history.replaceState(null, "", i);
28885
- }
28886
- function Wj(e) {
28887
- let [t, n] = a(() => Hj(e));
28888
- return y(() => {
28889
- let t = () => n(Hj(e));
28890
- return window.addEventListener("popstate", t), () => window.removeEventListener("popstate", t);
28891
- }, [e]), [t, s((t) => {
28892
- Uj(e, t), n(t);
28893
- }, [e])];
28894
- }
28895
- i(), i(), i(), i(), i(), f(() => import("./MaskShapeCanvas-Kfg9dl6B.mjs").then((e) => ({ default: e.MaskShapeCanvas }))), f(() => import("./MotionZonesSettings-DKtYdHUO.mjs").then((e) => ({ default: e.MotionZonesSettings }))), f(() => import("./SceneMonitorEditor-rFYGkGHV.mjs").then((e) => ({ default: e.SceneMonitorEditor }))), f(() => import("./PrivacyMaskSettings-BvLUVz86.mjs").then((e) => ({ default: e.PrivacyMaskSettings })));
28982
+ i(), i(), O("camstack:zone-editing", null), i(), i(), i(), i(), i(), f(() => import("./MaskShapeCanvas-Kfg9dl6B.mjs").then((e) => ({ default: e.MaskShapeCanvas }))), f(() => import("./MotionZonesSettings-CboUjtEf.mjs").then((e) => ({ default: e.MotionZonesSettings }))), f(() => import("./SceneMonitorEditor-rFYGkGHV.mjs").then((e) => ({ default: e.SceneMonitorEditor }))), f(() => import("./PrivacyMaskSettings-f61zjbA5.mjs").then((e) => ({ default: e.PrivacyMaskSettings })));
28896
28983
  //#endregion
28897
28984
  //#region src/page/frames/lib/retrain-assist-defaults.ts
28898
- var Gj = "object-detection";
28899
- function Kj(e, t) {
28985
+ var qj = "object-detection";
28986
+ function Jj(e, t) {
28900
28987
  for (let n of e) {
28901
28988
  if (n.addonId === t) return n;
28902
- let e = n.children === void 0 ? void 0 : Kj(n.children, t);
28989
+ let e = n.children === void 0 ? void 0 : Jj(n.children, t);
28903
28990
  if (e !== void 0) return e;
28904
28991
  }
28905
28992
  }
28906
- function qj(e, t) {
28993
+ function Yj(e, t) {
28907
28994
  for (let n of e.slots) {
28908
28995
  let e = n.addons.find((e) => e.id === t);
28909
28996
  if (e !== void 0) return e;
28910
28997
  }
28911
28998
  }
28912
- function Jj(e) {
28999
+ function Xj(e) {
28913
29000
  let { status: t, nodeDevices: n, schema: r, resolvedSteps: i } = e;
28914
29001
  if (t === void 0) return {
28915
29002
  kind: "unknown",
@@ -28933,7 +29020,7 @@ function Jj(e) {
28933
29020
  kind: "unknown",
28934
29021
  gap: "device-unknown"
28935
29022
  };
28936
- let s = qj(r, Gj);
29023
+ let s = Yj(r, qj);
28937
29024
  if (s === void 0) return {
28938
29025
  kind: "unknown",
28939
29026
  gap: "step-unknown"
@@ -28941,8 +29028,8 @@ function Jj(e) {
28941
29028
  let c = Zh({
28942
29029
  catalog: s,
28943
29030
  device: o,
28944
- override: Kj(i, Gj)?.modelId,
28945
- base: o.steps?.[Gj]?.modelId
29031
+ override: Jj(i, qj)?.modelId,
29032
+ base: o.steps?.[qj]?.modelId
28946
29033
  });
28947
29034
  return c === void 0 ? {
28948
29035
  kind: "unknown",
@@ -28954,11 +29041,11 @@ function Jj(e) {
28954
29041
  minScore: s.models.find((e) => e.id === c)?.defaultConfidence ?? s.defaultConfidence
28955
29042
  };
28956
29043
  }
28957
- function Yj(e, t) {
29044
+ function Zj(e, t) {
28958
29045
  let n = Math.max(0, Math.min(e.x + e.w, t.x + t.w) - Math.max(e.x, t.x)) * Math.max(0, Math.min(e.y + e.h, t.y + t.h) - Math.max(e.y, t.y)), r = e.w * e.h + t.w * t.h - n;
28959
29046
  return r > 0 ? n / r : 0;
28960
29047
  }
28961
- function Xj(e, t) {
29048
+ function Qj(e, t) {
28962
29049
  let n = e.nextKey;
28963
29050
  return {
28964
29051
  boxes: t.map((e) => {
@@ -28971,7 +29058,7 @@ function Xj(e, t) {
28971
29058
  nextKey: n
28972
29059
  };
28973
29060
  }
28974
- function Zj(e) {
29061
+ function $j(e) {
28975
29062
  return {
28976
29063
  bbox: e.bbox,
28977
29064
  macroClass: e.macroClass,
@@ -28984,7 +29071,7 @@ function Zj(e) {
28984
29071
  draft: !1
28985
29072
  };
28986
29073
  }
28987
- function Qj(e) {
29074
+ function eM(e) {
28988
29075
  return e.map((e) => ({
28989
29076
  bbox: e.bbox,
28990
29077
  macroClass: e.macroClass,
@@ -28998,23 +29085,23 @@ function Qj(e) {
28998
29085
  note: e.basis === "subject-box" ? "The box the pipeline recorded on this very frame." : `The pipeline's track position ${String(Math.round(e.deltaMs))} ms from this frame.`
28999
29086
  }));
29000
29087
  }
29001
- var $j = {
29088
+ var tM = {
29002
29089
  boxes: [],
29003
29090
  selectedKey: null,
29004
29091
  nextKey: 0
29005
29092
  };
29006
- function eM(e, t) {
29007
- let n = Xj($j, e.map(Zj));
29008
- return tM({
29093
+ function nM(e, t) {
29094
+ let n = Qj(tM, e.map($j));
29095
+ return rM({
29009
29096
  boxes: n.boxes,
29010
29097
  selectedKey: null,
29011
29098
  nextKey: n.nextKey
29012
- }, Qj(t)).state;
29099
+ }, eM(t)).state;
29013
29100
  }
29014
- function tM(e, t) {
29101
+ function rM(e, t) {
29015
29102
  let n = [], r = 0;
29016
29103
  for (let i of t) {
29017
- if ([...e.boxes, ...n].some((e) => Yj(e.bbox, i.bbox) >= .8)) {
29104
+ if ([...e.boxes, ...n].some((e) => Zj(e.bbox, i.bbox) >= .8)) {
29018
29105
  r += 1;
29019
29106
  continue;
29020
29107
  }
@@ -29023,7 +29110,7 @@ function tM(e, t) {
29023
29110
  draft: !0
29024
29111
  });
29025
29112
  }
29026
- let i = Xj(e, n);
29113
+ let i = Qj(e, n);
29027
29114
  return {
29028
29115
  state: {
29029
29116
  ...e,
@@ -29033,8 +29120,8 @@ function tM(e, t) {
29033
29120
  skipped: r
29034
29121
  };
29035
29122
  }
29036
- function nM(e, t, n) {
29037
- let r = Xj(e, [{
29123
+ function iM(e, t, n) {
29124
+ let r = Qj(e, [{
29038
29125
  bbox: t,
29039
29126
  macroClass: n,
29040
29127
  kind: "subject",
@@ -29047,26 +29134,26 @@ function nM(e, t, n) {
29047
29134
  nextKey: r.nextKey
29048
29135
  };
29049
29136
  }
29050
- function rM(e, t, n) {
29137
+ function aM(e, t, n) {
29051
29138
  return {
29052
29139
  ...e,
29053
29140
  boxes: e.boxes.map((e) => e.key === t ? n(e) : e)
29054
29141
  };
29055
29142
  }
29056
- function iM(e, t, n) {
29057
- return rM(e, t, (e) => ({
29143
+ function oM(e, t, n) {
29144
+ return aM(e, t, (e) => ({
29058
29145
  ...e,
29059
29146
  ...n,
29060
29147
  draft: !1
29061
29148
  }));
29062
29149
  }
29063
- function aM(e, t) {
29064
- return rM(e, t, (e) => ({
29150
+ function sM(e, t) {
29151
+ return aM(e, t, (e) => ({
29065
29152
  ...e,
29066
29153
  draft: !1
29067
29154
  }));
29068
29155
  }
29069
- function oM(e) {
29156
+ function cM(e) {
29070
29157
  return {
29071
29158
  ...e,
29072
29159
  boxes: e.boxes.map((e) => e.draft ? {
@@ -29075,27 +29162,27 @@ function oM(e) {
29075
29162
  } : e)
29076
29163
  };
29077
29164
  }
29078
- function sM(e, t) {
29079
- return rM(e, t, (e) => ({
29165
+ function lM(e, t) {
29166
+ return aM(e, t, (e) => ({
29080
29167
  ...e,
29081
29168
  kind: e.kind === "model_error" ? "subject" : "model_error",
29082
29169
  draft: !1
29083
29170
  }));
29084
29171
  }
29085
- function cM(e, t) {
29172
+ function uM(e, t) {
29086
29173
  return {
29087
29174
  ...e,
29088
29175
  boxes: e.boxes.filter((e) => e.key !== t),
29089
29176
  selectedKey: e.selectedKey === t ? null : e.selectedKey
29090
29177
  };
29091
29178
  }
29092
- function lM(e, t) {
29179
+ function dM(e, t) {
29093
29180
  return {
29094
29181
  ...e,
29095
29182
  selectedKey: t
29096
29183
  };
29097
29184
  }
29098
- function uM(e, t) {
29185
+ function fM(e, t) {
29099
29186
  return {
29100
29187
  ...e,
29101
29188
  boxes: e.boxes.map((e) => {
@@ -29107,7 +29194,7 @@ function uM(e, t) {
29107
29194
  })
29108
29195
  };
29109
29196
  }
29110
- function dM(e, t) {
29197
+ function pM(e, t) {
29111
29198
  return new Map(e.map((e) => [e.ref, {
29112
29199
  verdict: e.verdict,
29113
29200
  reason: e.reason,
@@ -29115,16 +29202,16 @@ function dM(e, t) {
29115
29202
  ...e.suggestedClass === void 0 ? {} : { suggestedClass: e.suggestedClass }
29116
29203
  }]));
29117
29204
  }
29118
- function fM(e) {
29205
+ function mM(e) {
29119
29206
  return e.boxes.filter((e) => e.draft).length;
29120
29207
  }
29121
- function pM(e) {
29208
+ function hM(e) {
29122
29209
  let t = e?.trim();
29123
29210
  return t === void 0 || t === "" ? void 0 : t;
29124
29211
  }
29125
- function mM(e) {
29212
+ function gM(e) {
29126
29213
  return e.boxes.filter((e) => !e.draft).map((e) => {
29127
- let t = pM(e.label), n = pM(e.subLabel);
29214
+ let t = hM(e.label), n = hM(e.subLabel);
29128
29215
  return {
29129
29216
  bbox: e.bbox,
29130
29217
  macroClass: e.macroClass,
@@ -29139,29 +29226,29 @@ function mM(e) {
29139
29226
  }
29140
29227
  //#endregion
29141
29228
  //#region src/page/frames/RetrainAnnotationEditor.tsx
29142
- var hM = [
29229
+ var _M = [
29143
29230
  "person",
29144
29231
  "vehicle",
29145
29232
  "animal",
29146
29233
  "package",
29147
29234
  "face",
29148
29235
  "plate"
29149
- ], gM = new Set(hM), _M = {
29236
+ ], vM = new Set(_M), yM = {
29150
29237
  operator: "drawn",
29151
29238
  pipeline: "pipeline",
29152
29239
  assist: "detector",
29153
29240
  llm: "AI vision"
29154
29241
  };
29155
- function vM(e) {
29242
+ function bM(e) {
29156
29243
  let t = e?.trim().toLowerCase();
29157
- return t === void 0 || t === "" ? null : gM.has(t) ? `"${t}" is a macro class, not a label — person / postman / Marco are three different tiers` : null;
29244
+ return t === void 0 || t === "" ? null : vM.has(t) ? `"${t}" is a macro class, not a label — person / postman / Marco are three different tiers` : null;
29158
29245
  }
29159
- function yM(e) {
29246
+ function xM(e) {
29160
29247
  if (e.source === "operator") return null;
29161
- let t = [_M[e.source]];
29248
+ let t = [yM[e.source]];
29162
29249
  return e.assistModelId !== void 0 && t.push(e.assistModelId), e.assistScore !== void 0 && t.push(e.assistScore.toFixed(2)), t.join(" · ");
29163
29250
  }
29164
- function bM({ boxes: e, selectedKey: t, onSelect: n, onChange: r, onAccept: i, onToggleModelError: a, onDelete: o }) {
29251
+ function SM({ boxes: e, selectedKey: t, onSelect: n, onChange: r, onAccept: i, onToggleModelError: a, onDelete: o }) {
29165
29252
  return e.length === 0 ? /* @__PURE__ */ H("p", {
29166
29253
  className: "text-[11px] text-foreground-subtle p-3",
29167
29254
  children: [
@@ -29173,7 +29260,7 @@ function bM({ boxes: e, selectedKey: t, onSelect: n, onChange: r, onAccept: i, o
29173
29260
  }) : /* @__PURE__ */ V("ul", {
29174
29261
  className: "divide-y divide-border",
29175
29262
  children: e.map((e) => {
29176
- let s = e.key === t, c = vM(e.label), l = vM(e.subLabel), u = yM(e);
29263
+ let s = e.key === t, c = bM(e.label), l = bM(e.subLabel), u = xM(e);
29177
29264
  return /* @__PURE__ */ H("li", {
29178
29265
  "data-testid": `retrain-row-${e.key}`,
29179
29266
  className: `p-2.5 space-y-1.5 ${s ? "bg-surface-hover" : ""}`,
@@ -29191,12 +29278,12 @@ function bM({ boxes: e, selectedKey: t, onSelect: n, onChange: r, onAccept: i, o
29191
29278
  className: "w-28",
29192
29279
  "aria-label": "Class",
29193
29280
  value: e.macroClass,
29194
- options: hM.map((e) => ({
29281
+ options: _M.map((e) => ({
29195
29282
  value: e,
29196
29283
  label: e
29197
29284
  })),
29198
29285
  onChange: (t) => {
29199
- let n = hM.find((e) => e === t.target.value);
29286
+ let n = _M.find((e) => e === t.target.value);
29200
29287
  n !== void 0 && r(e.key, { macroClass: n });
29201
29288
  }
29202
29289
  }),
@@ -29288,15 +29375,15 @@ function bM({ boxes: e, selectedKey: t, onSelect: n, onChange: r, onAccept: i, o
29288
29375
  })
29289
29376
  });
29290
29377
  }
29291
- function xM(e) {
29292
- return e.filter((e) => !e.draft).every((e) => vM(e.label) === null && vM(e.subLabel) === null && gM.has(e.macroClass));
29378
+ function CM(e) {
29379
+ return e.filter((e) => !e.draft).every((e) => bM(e.label) === null && bM(e.subLabel) === null && vM.has(e.macroClass));
29293
29380
  }
29294
29381
  //#endregion
29295
29382
  //#region src/page/frames/lib/retrain-teacher.ts
29296
- var SM = .25;
29297
- function CM(e, t) {
29383
+ var wM = .25;
29384
+ function TM(e, t) {
29298
29385
  if (e === void 0) return [];
29299
- let n = e.selectedEngine.format, r = e.slots.flatMap((e) => e.addons).find((e) => e.id === Gj);
29386
+ let n = e.selectedEngine.format, r = e.slots.flatMap((e) => e.addons).find((e) => e.id === qj);
29300
29387
  if (r === void 0) return [];
29301
29388
  let i = r.models.filter((e) => e.legacy !== !0 && e.provider === void 0).flatMap((e) => {
29302
29389
  let t = e.formats[n];
@@ -29310,7 +29397,7 @@ function CM(e, t) {
29310
29397
  }
29311
29398
  //#endregion
29312
29399
  //#region src/page/frames/frame-address.ts
29313
- function wM(e) {
29400
+ function EM(e) {
29314
29401
  return {
29315
29402
  deviceId: e.deviceId,
29316
29403
  ...e.trackId === void 0 ? {} : { trackId: e.trackId },
@@ -29320,7 +29407,7 @@ function wM(e) {
29320
29407
  //#endregion
29321
29408
  //#region src/page/frames/RetrainAssistPanel.tsx
29322
29409
  i();
29323
- var TM = [
29410
+ var DM = [
29324
29411
  {
29325
29412
  value: "teacher",
29326
29413
  label: "Bigger detector"
@@ -29333,19 +29420,19 @@ var TM = [
29333
29420
  value: "both",
29334
29421
  label: "Both"
29335
29422
  }
29336
- ], EM = [
29423
+ ], OM = [
29337
29424
  "person",
29338
29425
  "vehicle",
29339
29426
  "animal",
29340
29427
  "package"
29341
- ], DM = [
29428
+ ], kM = [
29342
29429
  "person",
29343
29430
  "vehicle",
29344
29431
  "animal",
29345
29432
  "package",
29346
29433
  "face",
29347
29434
  "plate"
29348
- ], OM = {
29435
+ ], AM = {
29349
29436
  "unknown-frame": "The frame is no longer in the dataset.",
29350
29437
  "unreadable-frame": "The frame copy could not be read.",
29351
29438
  "unknown-profile": "That AI profile no longer exists.",
@@ -29355,13 +29442,13 @@ var TM = [
29355
29442
  "llm-error": "The AI model call failed.",
29356
29443
  "malformed-answer": "The AI answered in a shape that cannot be trusted, so nothing was drawn."
29357
29444
  };
29358
- function kM({ frame: e, history: t, detector: n, schema: r, setNotice: i }) {
29359
- let o = rc({}, { retry: !1 }), s = Qs(), c = ic(), [l, d] = a("teacher"), f = m(() => CM(r, n.kind === "resolved" ? n.modelId : void 0), [r, n]), [p, h] = a(null), g = f.find((e) => e.modelId === p) ?? f[0], [_, v] = a(SM), [y, b] = a(null), x = (o.data ?? []).find((e) => e.id === y) ?? o.data?.[0], [S, C] = a(EM), [w, T] = a(!1), [E, D] = a(!1), O = u(t.editor);
29445
+ function jM({ frame: e, history: t, detector: n, schema: r, setNotice: i }) {
29446
+ let o = rc({}, { retry: !1 }), s = Qs(), c = ic(), [l, d] = a("teacher"), f = m(() => TM(r, n.kind === "resolved" ? n.modelId : void 0), [r, n]), [p, h] = a(null), g = f.find((e) => e.modelId === p) ?? f[0], [_, v] = a(wM), [y, b] = a(null), x = (o.data ?? []).find((e) => e.id === y) ?? o.data?.[0], [S, C] = a(OM), [w, T] = a(!1), [E, D] = a(!1), O = u(t.editor);
29360
29447
  O.current = t.editor;
29361
29448
  let k = l !== "llm", A = l !== "teacher", j = n.kind === "resolved" && g !== void 0, M = x !== void 0 && S.length > 0, N = (!k || j) && (!A || M), P = async () => {
29362
29449
  if (n.kind !== "resolved" || g === void 0) return "";
29363
29450
  let r = await s.mutateAsync({
29364
- ...wM(e),
29451
+ ...EM(e),
29365
29452
  subject: {
29366
29453
  kind: "objects",
29367
29454
  modelId: g.modelId,
@@ -29370,7 +29457,7 @@ function kM({ frame: e, history: t, detector: n, schema: r, setNotice: i }) {
29370
29457
  nodeId: n.nodeId
29371
29458
  });
29372
29459
  if (r.kind === "refused") return `${g.name} refused: ${r.reason}${r.detail === void 0 ? "" : ` — ${r.detail}`}.`;
29373
- let i = tM(O.current, r.proposals.map((e) => ({
29460
+ let i = rM(O.current, r.proposals.map((e) => ({
29374
29461
  bbox: e.bbox,
29375
29462
  macroClass: e.macroClass,
29376
29463
  ...e.label === void 0 ? {} : { label: e.label },
@@ -29387,7 +29474,7 @@ function kM({ frame: e, history: t, detector: n, schema: r, setNotice: i }) {
29387
29474
  }, ee = async (n) => {
29388
29475
  if (x === void 0) return "";
29389
29476
  let r = O.current, i = await c.mutateAsync({
29390
- ...wM(e),
29477
+ ...EM(e),
29391
29478
  profileId: x.id,
29392
29479
  classes: [...S],
29393
29480
  boxes: r.boxes.slice(0, 50).map((e) => ({
@@ -29398,7 +29485,7 @@ function kM({ frame: e, history: t, detector: n, schema: r, setNotice: i }) {
29398
29485
  })),
29399
29486
  allowCloud: n
29400
29487
  });
29401
- if (i.kind === "refused") return `${OM[i.reason] ?? i.reason}${i.detail === void 0 ? "" : ` (${i.detail})`}`;
29488
+ if (i.kind === "refused") return `${AM[i.reason] ?? i.reason}${i.detail === void 0 ? "" : ` (${i.detail})`}`;
29402
29489
  let a = i.proposals.map((e) => ({
29403
29490
  bbox: e.bbox,
29404
29491
  macroClass: e.macroClass,
@@ -29409,8 +29496,8 @@ function kM({ frame: e, history: t, detector: n, schema: r, setNotice: i }) {
29409
29496
  ...e.assistScore === void 0 ? {} : { assistScore: e.assistScore },
29410
29497
  draft: !0,
29411
29498
  note: `${i.model}: ${e.reason}`
29412
- })), o = dM(i.reviews, i.model), s = tM(O.current, a);
29413
- t.setEditor((e) => uM(tM(e, a).state, o));
29499
+ })), o = pM(i.reviews, i.model), s = rM(O.current, a);
29500
+ t.setEditor((e) => fM(rM(e, a).state, o));
29414
29501
  let l = i.proposals.length - s.skipped, u = i.reviews.filter((e) => e.verdict !== "confirmed").length;
29415
29502
  return `${x.name}: ${String(l)} new draft${l === 1 ? "" : "s"}, ${String(u)} box${u === 1 ? "" : "es"} questioned${i.rejected > 0 ? `, ${String(i.rejected)} unusable item${i.rejected === 1 ? "" : "s"} dropped` : ""}.`;
29416
29503
  }, F = async (e) => {
@@ -29439,12 +29526,12 @@ function kM({ frame: e, history: t, detector: n, schema: r, setNotice: i }) {
29439
29526
  className: "w-36",
29440
29527
  "aria-label": "Assist engine",
29441
29528
  value: l,
29442
- options: TM.map((e) => ({
29529
+ options: DM.map((e) => ({
29443
29530
  value: e.value,
29444
29531
  label: e.label
29445
29532
  })),
29446
29533
  onChange: (e) => {
29447
- let t = TM.find((t) => t.value === e.target.value);
29534
+ let t = DM.find((t) => t.value === e.target.value);
29448
29535
  t !== void 0 && d(t.value);
29449
29536
  }
29450
29537
  }),
@@ -29530,7 +29617,7 @@ function kM({ frame: e, history: t, detector: n, schema: r, setNotice: i }) {
29530
29617
  children: [/* @__PURE__ */ V("span", {
29531
29618
  className: "text-foreground-subtle",
29532
29619
  children: "Look for:"
29533
- }), DM.map((e) => {
29620
+ }), kM.map((e) => {
29534
29621
  let t = S.includes(e);
29535
29622
  return /* @__PURE__ */ V("button", {
29536
29623
  type: "button",
@@ -29566,7 +29653,7 @@ function kM({ frame: e, history: t, detector: n, schema: r, setNotice: i }) {
29566
29653
  }
29567
29654
  //#endregion
29568
29655
  //#region src/page/frames/lib/retrain-boxes.ts
29569
- function AM(e, t, n, r) {
29656
+ function MM(e, t, n, r) {
29570
29657
  if (!(e > 0) || !(t > 0) || !(n > 0) || !(r > 0)) return null;
29571
29658
  let i = Math.min(e / n, t / r), a = n * i, o = r * i;
29572
29659
  return {
@@ -29576,7 +29663,7 @@ function AM(e, t, n, r) {
29576
29663
  height: o
29577
29664
  };
29578
29665
  }
29579
- function jM(e, t) {
29666
+ function NM(e, t) {
29580
29667
  return {
29581
29668
  x: Math.min(e.x, t.x),
29582
29669
  y: Math.min(e.y, t.y),
@@ -29584,11 +29671,11 @@ function jM(e, t) {
29584
29671
  h: Math.abs(t.y - e.y)
29585
29672
  };
29586
29673
  }
29587
- var MM = .01;
29588
- function NM(e) {
29674
+ var PM = .01;
29675
+ function FM(e) {
29589
29676
  return e.w >= .01 && e.h >= .01;
29590
29677
  }
29591
- function PM(e, t) {
29678
+ function IM(e, t) {
29592
29679
  let n = -1, r = Infinity;
29593
29680
  return e.forEach((e, i) => {
29594
29681
  if (!(t.x >= e.x && t.x <= e.x + e.w && t.y >= e.y && t.y <= e.y + e.h)) return;
@@ -29596,7 +29683,7 @@ function PM(e, t) {
29596
29683
  a < r && (n = i, r = a);
29597
29684
  }), n;
29598
29685
  }
29599
- var FM = [
29686
+ var LM = [
29600
29687
  "nw",
29601
29688
  "n",
29602
29689
  "ne",
@@ -29606,7 +29693,7 @@ var FM = [
29606
29693
  "sw",
29607
29694
  "w"
29608
29695
  ];
29609
- function IM(e, t, n) {
29696
+ function RM(e, t, n) {
29610
29697
  return {
29611
29698
  x: Math.min(Math.max(0, e.x + t), Math.max(0, 1 - e.w)),
29612
29699
  y: Math.min(Math.max(0, e.y + n), Math.max(0, 1 - e.h)),
@@ -29614,9 +29701,9 @@ function IM(e, t, n) {
29614
29701
  h: e.h
29615
29702
  };
29616
29703
  }
29617
- function LM(e, t, n, r) {
29704
+ function zM(e, t, n, r) {
29618
29705
  if (n) {
29619
- let e = Math.min(Math.max(0, r), t - MM);
29706
+ let e = Math.min(Math.max(0, r), t - PM);
29620
29707
  return {
29621
29708
  start: e,
29622
29709
  size: t - e
@@ -29624,14 +29711,14 @@ function LM(e, t, n, r) {
29624
29711
  }
29625
29712
  return {
29626
29713
  start: e,
29627
- size: Math.max(Math.min(1, r), e + MM) - e
29714
+ size: Math.max(Math.min(1, r), e + PM) - e
29628
29715
  };
29629
29716
  }
29630
- function RM(e, t, n) {
29631
- let r = t.includes("w") || t.includes("e") ? LM(e.x, e.x + e.w, t.includes("w"), n.x) : {
29717
+ function BM(e, t, n) {
29718
+ let r = t.includes("w") || t.includes("e") ? zM(e.x, e.x + e.w, t.includes("w"), n.x) : {
29632
29719
  start: e.x,
29633
29720
  size: e.w
29634
- }, i = t.includes("n") || t.includes("s") ? LM(e.y, e.y + e.h, t.includes("n"), n.y) : {
29721
+ }, i = t.includes("n") || t.includes("s") ? zM(e.y, e.y + e.h, t.includes("n"), n.y) : {
29635
29722
  start: e.y,
29636
29723
  size: e.h
29637
29724
  };
@@ -29642,44 +29729,44 @@ function RM(e, t, n) {
29642
29729
  h: i.size
29643
29730
  };
29644
29731
  }
29645
- function zM(e, t) {
29732
+ function VM(e, t) {
29646
29733
  return {
29647
29734
  x: t.includes("w") ? e.x : t.includes("e") ? e.x + e.w : e.x + e.w / 2,
29648
29735
  y: t.includes("n") ? e.y : t.includes("s") ? e.y + e.h : e.y + e.h / 2
29649
29736
  };
29650
29737
  }
29651
- function BM(e, t, n) {
29738
+ function HM(e, t, n) {
29652
29739
  let r = (e, t, n) => Math.abs(e - t) <= n, i = r(t.x, e.x, n.x), a = r(t.x, e.x + e.w, n.x), o = r(t.y, e.y, n.y), s = r(t.y, e.y + e.h, n.y), c = t.x >= e.x - n.x && t.x <= e.x + e.w + n.x, l = t.y >= e.y - n.y && t.y <= e.y + e.h + n.y;
29653
29740
  return !c || !l ? null : o && i ? "nw" : o && a ? "ne" : s && i ? "sw" : s && a ? "se" : o ? "n" : s ? "s" : i ? "w" : a ? "e" : t.x >= e.x && t.x <= e.x + e.w && t.y >= e.y && t.y <= e.y + e.h ? "body" : null;
29654
29741
  }
29655
29742
  //#endregion
29656
29743
  //#region src/page/frames/lib/retrain-zoom.ts
29657
- var VM = {
29744
+ var UM = {
29658
29745
  x: 0,
29659
29746
  y: 0,
29660
29747
  w: 1,
29661
29748
  h: 1
29662
- }, HM = 1.5;
29663
- function UM(e, t, n) {
29749
+ }, WM = 1.5;
29750
+ function GM(e, t, n) {
29664
29751
  return e < t ? t : e > n ? n : e;
29665
29752
  }
29666
- function WM(e) {
29753
+ function KM(e) {
29667
29754
  return 1 / e.w;
29668
29755
  }
29669
- function GM(e, t, n, r) {
29756
+ function qM(e, t, n, r) {
29670
29757
  return {
29671
- x: UM(r.x + (e - n.left) / n.width * r.w, 0, 1),
29672
- y: UM(r.y + (t - n.top) / n.height * r.h, 0, 1)
29758
+ x: GM(r.x + (e - n.left) / n.width * r.w, 0, 1),
29759
+ y: GM(r.y + (t - n.top) / n.height * r.h, 0, 1)
29673
29760
  };
29674
29761
  }
29675
- function KM(e, t, n) {
29762
+ function JM(e, t, n) {
29676
29763
  return {
29677
29764
  x: t.left + (e.x - n.x) / n.w * t.width,
29678
29765
  y: t.top + (e.y - n.y) / n.h * t.height
29679
29766
  };
29680
29767
  }
29681
- function qM(e, t, n) {
29682
- let r = KM(e, t, n);
29768
+ function YM(e, t, n) {
29769
+ let r = JM(e, t, n);
29683
29770
  return {
29684
29771
  left: r.x,
29685
29772
  top: r.y,
@@ -29687,7 +29774,7 @@ function qM(e, t, n) {
29687
29774
  height: e.h / n.h * t.height
29688
29775
  };
29689
29776
  }
29690
- function JM(e, t) {
29777
+ function XM(e, t) {
29691
29778
  return {
29692
29779
  left: e.left - t.x / t.w * e.width,
29693
29780
  top: e.top - t.y / t.h * e.height,
@@ -29695,24 +29782,24 @@ function JM(e, t) {
29695
29782
  height: e.height / t.h
29696
29783
  };
29697
29784
  }
29698
- function YM(e, t, n) {
29699
- let r = UM(e.w / n, 1 / 16, 1), i = r / e.w;
29785
+ function ZM(e, t, n) {
29786
+ let r = GM(e.w / n, 1 / 16, 1), i = r / e.w;
29700
29787
  return {
29701
- x: UM(t.x - (t.x - e.x) * i, 0, 1 - r),
29702
- y: UM(t.y - (t.y - e.y) * i, 0, 1 - r),
29788
+ x: GM(t.x - (t.x - e.x) * i, 0, 1 - r),
29789
+ y: GM(t.y - (t.y - e.y) * i, 0, 1 - r),
29703
29790
  w: r,
29704
29791
  h: r
29705
29792
  };
29706
29793
  }
29707
- function XM(e, t, n) {
29794
+ function QM(e, t, n) {
29708
29795
  return {
29709
- x: UM(e.x + t, 0, 1 - e.w),
29710
- y: UM(e.y + n, 0, 1 - e.h),
29796
+ x: GM(e.x + t, 0, 1 - e.w),
29797
+ y: GM(e.y + n, 0, 1 - e.h),
29711
29798
  w: e.w,
29712
29799
  h: e.h
29713
29800
  };
29714
29801
  }
29715
- function ZM(e) {
29802
+ function $M(e) {
29716
29803
  return {
29717
29804
  x: e.x + e.w / 2,
29718
29805
  y: e.y + e.h / 2
@@ -29720,7 +29807,7 @@ function ZM(e) {
29720
29807
  }
29721
29808
  //#endregion
29722
29809
  //#region src/page/frames/lib/retrain-shortcuts.ts
29723
- var QM = [
29810
+ var eN = [
29724
29811
  "person",
29725
29812
  "vehicle",
29726
29813
  "animal",
@@ -29728,12 +29815,12 @@ var QM = [
29728
29815
  "face",
29729
29816
  "plate"
29730
29817
  ];
29731
- function $M(e) {
29818
+ function tN(e) {
29732
29819
  if (typeof e != "object" || !e || !("tagName" in e)) return !1;
29733
29820
  let t = String(e.tagName).toUpperCase();
29734
29821
  return t === "INPUT" || t === "TEXTAREA" || t === "SELECT" ? !0 : "isContentEditable" in e && e.isContentEditable === !0;
29735
29822
  }
29736
- function eN(e) {
29823
+ function nN(e) {
29737
29824
  let t = e.ctrlKey || e.metaKey, n = e.key.toLowerCase();
29738
29825
  if (t && !e.altKey) return n === "s" && !e.shiftKey ? { kind: "save" } : e.typing ? null : n === "z" ? e.shiftKey ? { kind: "redo" } : { kind: "undo" } : n === "y" && !e.shiftKey ? { kind: "redo" } : null;
29739
29826
  if (e.typing || t || e.altKey) return null;
@@ -29752,8 +29839,8 @@ function eN(e) {
29752
29839
  default: break;
29753
29840
  }
29754
29841
  let r = Number.parseInt(e.key, 10);
29755
- if (Number.isInteger(r) && r >= 1 && r <= QM.length) {
29756
- let e = QM[r - 1];
29842
+ if (Number.isInteger(r) && r >= 1 && r <= eN.length) {
29843
+ let e = eN[r - 1];
29757
29844
  return e === void 0 ? null : {
29758
29845
  kind: "set-class",
29759
29846
  macroClass: e
@@ -29761,7 +29848,7 @@ function eN(e) {
29761
29848
  }
29762
29849
  return n === "a" ? e.shiftKey ? { kind: "accept-all" } : { kind: "accept" } : n === "e" && !e.shiftKey ? { kind: "toggle-model-error" } : n === "c" && !e.shiftKey ? { kind: "toggle-complete" } : null;
29763
29850
  }
29764
- var tN = [
29851
+ var rN = [
29765
29852
  {
29766
29853
  keys: "← / →",
29767
29854
  does: "Previous / next frame"
@@ -29830,13 +29917,13 @@ var tN = [
29830
29917
  //#endregion
29831
29918
  //#region src/page/frames/RetrainCanvas.tsx
29832
29919
  i();
29833
- var nN = .0015, rN = {
29920
+ var iN = .0015, aN = {
29834
29921
  pipeline: "var(--color-foreground-muted)",
29835
29922
  assist: "var(--color-info)",
29836
29923
  llm: "var(--color-warning)",
29837
29924
  operator: "var(--color-success)"
29838
29925
  };
29839
- function iN(e, t) {
29926
+ function oN(e, t) {
29840
29927
  return e.kind === "model_error" ? {
29841
29928
  color: "var(--color-danger)",
29842
29929
  dashed: !0,
@@ -29846,7 +29933,7 @@ function iN(e, t) {
29846
29933
  dashed: e.draft,
29847
29934
  opacity: 1
29848
29935
  } : e.draft ? {
29849
- color: rN[e.source],
29936
+ color: aN[e.source],
29850
29937
  dashed: !0,
29851
29938
  opacity: .8
29852
29939
  } : {
@@ -29855,16 +29942,16 @@ function iN(e, t) {
29855
29942
  opacity: 1
29856
29943
  };
29857
29944
  }
29858
- function aN(e, t) {
29945
+ function sN(e, t) {
29859
29946
  return Math.hypot(e.x - t.x, e.y - t.y);
29860
29947
  }
29861
- function oN(e, t) {
29948
+ function cN(e, t) {
29862
29949
  return {
29863
29950
  x: (e.x + t.x) / 2,
29864
29951
  y: (e.y + t.y) / 2
29865
29952
  };
29866
29953
  }
29867
- function sN({ imageSrc: e, imageWidth: t, imageHeight: n, boxes: r, selectedKey: i, viewport: o, onViewportChange: c, panMode: l, onSelect: d, onDraw: f, onGestureStart: p, onGestureBox: m, onGestureEnd: h }) {
29954
+ function lN({ imageSrc: e, imageWidth: t, imageHeight: n, boxes: r, selectedKey: i, viewport: o, onViewportChange: c, panMode: l, onSelect: d, onDraw: f, onGestureStart: p, onGestureBox: m, onGestureEnd: h }) {
29868
29955
  let _ = u(null), [v, b] = a({
29869
29956
  w: 0,
29870
29957
  h: 0
@@ -29882,10 +29969,10 @@ function sN({ imageSrc: e, imageWidth: t, imageHeight: n, boxes: r, selectedKey:
29882
29969
  n.disconnect();
29883
29970
  };
29884
29971
  }, []);
29885
- let D = AM(v.w, v.h, t, n);
29972
+ let D = MM(v.w, v.h, t, n);
29886
29973
  y(() => {
29887
29974
  let e = (e) => {
29888
- e.key !== " " || $M(e.target) || (e.preventDefault(), w(!0));
29975
+ e.key !== " " || tN(e.target) || (e.preventDefault(), w(!0));
29889
29976
  }, t = (e) => {
29890
29977
  e.key === " " && w(!1);
29891
29978
  };
@@ -29910,7 +29997,7 @@ function sN({ imageSrc: e, imageWidth: t, imageHeight: n, boxes: r, selectedKey:
29910
29997
  if (n === null) return;
29911
29998
  t.preventDefault();
29912
29999
  let a = e.getBoundingClientRect();
29913
- i(YM(r, GM(t.clientX - a.left, t.clientY - a.top, n, r), Math.exp(-t.deltaY * nN)));
30000
+ i(ZM(r, qM(t.clientX - a.left, t.clientY - a.top, n, r), Math.exp(-t.deltaY * iN)));
29914
30001
  };
29915
30002
  return e.addEventListener("wheel", t, { passive: !1 }), () => {
29916
30003
  e.removeEventListener("wheel", t);
@@ -29922,7 +30009,7 @@ function sN({ imageSrc: e, imageWidth: t, imageHeight: n, boxes: r, selectedKey:
29922
30009
  x: e.clientX - (t?.left ?? 0),
29923
30010
  y: e.clientY - (t?.top ?? 0)
29924
30011
  };
29925
- }, []), A = s((e) => D === null ? null : GM(e.x, e.y, D, o), [D, o]), j = s(() => {
30012
+ }, []), A = s((e) => D === null ? null : qM(e.x, e.y, D, o), [D, o]), j = s(() => {
29926
30013
  let e = E.current;
29927
30014
  (e.mode === "move" || e.mode === "resize") && h(), e.mode === "draw" && S(null), E.current = { mode: "none" };
29928
30015
  }, [h]), M = (e) => {
@@ -29932,11 +30019,11 @@ function sN({ imageSrc: e, imageWidth: t, imageHeight: n, boxes: r, selectedKey:
29932
30019
  j();
29933
30020
  let [e, t] = [...T.current.values()];
29934
30021
  if (e === void 0 || t === void 0) return;
29935
- let n = oN(e, t);
30022
+ let n = cN(e, t);
29936
30023
  E.current = {
29937
30024
  mode: "pinch",
29938
- startDistance: Math.max(1, aN(e, t)),
29939
- anchor: GM(n.x, n.y, D, o),
30025
+ startDistance: Math.max(1, sN(e, t)),
30026
+ anchor: qM(n.x, n.y, D, o),
29940
30027
  from: o
29941
30028
  };
29942
30029
  return;
@@ -29951,12 +30038,12 @@ function sN({ imageSrc: e, imageWidth: t, imageHeight: n, boxes: r, selectedKey:
29951
30038
  return;
29952
30039
  }
29953
30040
  if (e.button !== 0) return;
29954
- let n = GM(t.x, t.y, D, o), a = {
30041
+ let n = qM(t.x, t.y, D, o), a = {
29955
30042
  x: 12 / D.width * o.w,
29956
30043
  y: 12 / D.height * o.h
29957
30044
  }, s = r.find((e) => e.key === i);
29958
30045
  if (s !== void 0) {
29959
- let e = BM(s.bbox, n, a);
30046
+ let e = HM(s.bbox, n, a);
29960
30047
  if (e !== null && e !== "body") {
29961
30048
  p(), E.current = {
29962
30049
  mode: "resize",
@@ -29967,7 +30054,7 @@ function sN({ imageSrc: e, imageWidth: t, imageHeight: n, boxes: r, selectedKey:
29967
30054
  return;
29968
30055
  }
29969
30056
  }
29970
- let c = r[PM(r.map((e) => e.bbox), n)];
30057
+ let c = r[IM(r.map((e) => e.bbox), n)];
29971
30058
  if (c !== void 0) {
29972
30059
  c.key !== i && d(c.key), p(), E.current = {
29973
30060
  mode: "move",
@@ -29980,7 +30067,7 @@ function sN({ imageSrc: e, imageWidth: t, imageHeight: n, boxes: r, selectedKey:
29980
30067
  E.current = {
29981
30068
  mode: "draw",
29982
30069
  start: n
29983
- }, S(jM(n, n));
30070
+ }, S(NM(n, n));
29984
30071
  }, N = (e) => {
29985
30072
  if (!T.current.has(e.pointerId) || D === null) return;
29986
30073
  let t = k(e);
@@ -29990,28 +30077,28 @@ function sN({ imageSrc: e, imageWidth: t, imageHeight: n, boxes: r, selectedKey:
29990
30077
  case "pinch": {
29991
30078
  let [e, t] = [...T.current.values()];
29992
30079
  if (e === void 0 || t === void 0) return;
29993
- let r = YM(n.from, n.anchor, aN(e, t) / n.startDistance), i = oN(e, t), a = GM(i.x, i.y, D, r);
29994
- c(XM(r, n.anchor.x - a.x, n.anchor.y - a.y));
30080
+ let r = ZM(n.from, n.anchor, sN(e, t) / n.startDistance), i = cN(e, t), a = qM(i.x, i.y, D, r);
30081
+ c(QM(r, n.anchor.x - a.x, n.anchor.y - a.y));
29995
30082
  return;
29996
30083
  }
29997
30084
  case "pan": {
29998
30085
  let e = (t.x - n.startPx.x) / D.width * n.from.w, r = (t.y - n.startPx.y) / D.height * n.from.h;
29999
- c(XM(n.from, -e, -r));
30086
+ c(QM(n.from, -e, -r));
30000
30087
  return;
30001
30088
  }
30002
30089
  case "move": {
30003
- let e = GM(t.x, t.y, D, o);
30004
- m(n.key, IM(n.from, e.x - n.start.x, e.y - n.start.y));
30090
+ let e = qM(t.x, t.y, D, o);
30091
+ m(n.key, RM(n.from, e.x - n.start.x, e.y - n.start.y));
30005
30092
  return;
30006
30093
  }
30007
30094
  case "resize": {
30008
- let e = GM(t.x, t.y, D, o);
30009
- m(n.key, RM(n.from, n.handle, e));
30095
+ let e = qM(t.x, t.y, D, o);
30096
+ m(n.key, BM(n.from, n.handle, e));
30010
30097
  return;
30011
30098
  }
30012
30099
  case "draw": {
30013
- let e = GM(t.x, t.y, D, o);
30014
- S(jM(n.start, e));
30100
+ let e = qM(t.x, t.y, D, o);
30101
+ S(NM(n.start, e));
30015
30102
  return;
30016
30103
  }
30017
30104
  default: return;
@@ -30025,12 +30112,12 @@ function sN({ imageSrc: e, imageWidth: t, imageHeight: n, boxes: r, selectedKey:
30025
30112
  return;
30026
30113
  }
30027
30114
  if (t.mode === "draw") {
30028
- let n = A(k(e)), r = n === null ? null : jM(t.start, n);
30029
- S(null), E.current = { mode: "none" }, r !== null && NM(r) ? f(r) : d(null);
30115
+ let n = A(k(e)), r = n === null ? null : NM(t.start, n);
30116
+ S(null), E.current = { mode: "none" }, r !== null && FM(r) ? f(r) : d(null);
30030
30117
  return;
30031
30118
  }
30032
30119
  j();
30033
- }, ee = r.find((e) => e.key === i), F = C || l, te = D === null ? null : JM(D, o);
30120
+ }, ee = r.find((e) => e.key === i), F = C || l, te = D === null ? null : XM(D, o);
30034
30121
  return /* @__PURE__ */ H("div", {
30035
30122
  ref: _,
30036
30123
  "data-testid": "retrain-canvas",
@@ -30049,7 +30136,7 @@ function sN({ imageSrc: e, imageWidth: t, imageHeight: n, boxes: r, selectedKey:
30049
30136
  style: te
30050
30137
  }),
30051
30138
  D !== null && r.map((e) => {
30052
- let t = qM(e.bbox, D, o), n = e.key === i, r = iN(e, n);
30139
+ let t = YM(e.bbox, D, o), n = e.key === i, r = oN(e, n);
30053
30140
  return /* @__PURE__ */ V("div", {
30054
30141
  "data-testid": `retrain-box-${e.key}`,
30055
30142
  "data-draft": e.draft ? "true" : "false",
@@ -30075,8 +30162,8 @@ function sN({ imageSrc: e, imageWidth: t, imageHeight: n, boxes: r, selectedKey:
30075
30162
  })
30076
30163
  }, e.key);
30077
30164
  }),
30078
- D !== null && ee !== void 0 && FM.map((e) => {
30079
- let t = KM(zM(ee.bbox, e), D, o);
30165
+ D !== null && ee !== void 0 && LM.map((e) => {
30166
+ let t = JM(VM(ee.bbox, e), D, o);
30080
30167
  return /* @__PURE__ */ V("div", {
30081
30168
  "data-testid": `retrain-handle-${e}`,
30082
30169
  className: "absolute h-2.5 w-2.5 -translate-x-1/2 -translate-y-1/2 rounded-sm border border-background bg-primary pointer-events-none",
@@ -30088,7 +30175,7 @@ function sN({ imageSrc: e, imageWidth: t, imageHeight: n, boxes: r, selectedKey:
30088
30175
  }),
30089
30176
  x !== null && D !== null && /* @__PURE__ */ V("div", {
30090
30177
  className: "absolute border border-dashed border-primary pointer-events-none",
30091
- style: qM(x, D, o)
30178
+ style: YM(x, D, o)
30092
30179
  })
30093
30180
  ]
30094
30181
  });
@@ -30096,19 +30183,19 @@ function sN({ imageSrc: e, imageWidth: t, imageHeight: n, boxes: r, selectedKey:
30096
30183
  //#endregion
30097
30184
  //#region src/page/frames/RetrainCanvasToolbar.tsx
30098
30185
  i();
30099
- function cN() {
30100
- let [e, t] = a(VM), [n, r] = a(!1);
30186
+ function uN() {
30187
+ let [e, t] = a(UM), [n, r] = a(!1);
30101
30188
  return {
30102
30189
  viewport: e,
30103
30190
  setViewport: t,
30104
30191
  zoomIn: s(() => {
30105
- t((e) => YM(e, ZM(e), HM));
30192
+ t((e) => ZM(e, $M(e), WM));
30106
30193
  }, []),
30107
30194
  zoomOut: s(() => {
30108
- t((e) => YM(e, ZM(e), 1 / HM));
30195
+ t((e) => ZM(e, $M(e), 1 / WM));
30109
30196
  }, []),
30110
30197
  fit: s(() => {
30111
- t(VM);
30198
+ t(UM);
30112
30199
  }, []),
30113
30200
  panMode: n,
30114
30201
  togglePan: s(() => {
@@ -30116,8 +30203,8 @@ function cN() {
30116
30203
  }, [])
30117
30204
  };
30118
30205
  }
30119
- function lN({ view: e, canUndo: t, canRedo: n, onUndo: r, onRedo: i }) {
30120
- let a = WM(e.viewport);
30206
+ function dN({ view: e, canUndo: t, canRedo: n, onUndo: r, onRedo: i }) {
30207
+ let a = KM(e.viewport);
30121
30208
  return /* @__PURE__ */ H("div", {
30122
30209
  className: "flex items-center gap-1 px-2 py-1 border-b border-border bg-surface",
30123
30210
  children: [
@@ -30183,7 +30270,7 @@ function lN({ view: e, canUndo: t, canRedo: n, onUndo: r, onRedo: i }) {
30183
30270
  children: "Keyboard and gestures"
30184
30271
  }), /* @__PURE__ */ V("table", {
30185
30272
  className: "w-full text-[11px]",
30186
- children: /* @__PURE__ */ V("tbody", { children: tN.map((e) => /* @__PURE__ */ H("tr", {
30273
+ children: /* @__PURE__ */ V("tbody", { children: rN.map((e) => /* @__PURE__ */ H("tr", {
30187
30274
  className: "align-top",
30188
30275
  children: [/* @__PURE__ */ V("td", {
30189
30276
  className: "py-0.5 pr-2 font-mono whitespace-nowrap text-foreground",
@@ -30198,7 +30285,7 @@ function lN({ view: e, canUndo: t, canRedo: n, onUndo: r, onRedo: i }) {
30198
30285
  ]
30199
30286
  });
30200
30287
  }
30201
- function uN(e) {
30288
+ function fN(e) {
30202
30289
  return {
30203
30290
  past: [],
30204
30291
  present: e,
@@ -30206,25 +30293,25 @@ function uN(e) {
30206
30293
  gestureBase: null
30207
30294
  };
30208
30295
  }
30209
- function dN(e, t) {
30296
+ function pN(e, t) {
30210
30297
  let n = [...e, t];
30211
30298
  return n.length > 100 ? n.slice(n.length - 100) : n;
30212
30299
  }
30213
- function fN(e, t) {
30300
+ function mN(e, t) {
30214
30301
  return t === e.present ? e : {
30215
- past: dN(e.past, e.present),
30302
+ past: pN(e.past, e.present),
30216
30303
  present: t,
30217
30304
  future: [],
30218
30305
  gestureBase: null
30219
30306
  };
30220
30307
  }
30221
- function pN(e, t) {
30308
+ function hN(e, t) {
30222
30309
  return {
30223
30310
  ...e,
30224
30311
  present: t
30225
30312
  };
30226
30313
  }
30227
- function mN(e) {
30314
+ function gN(e) {
30228
30315
  let t = e.past[e.past.length - 1];
30229
30316
  return t === void 0 ? e : {
30230
30317
  past: e.past.slice(0, -1),
@@ -30233,68 +30320,68 @@ function mN(e) {
30233
30320
  gestureBase: null
30234
30321
  };
30235
30322
  }
30236
- function hN(e) {
30323
+ function _N(e) {
30237
30324
  let [t, ...n] = e.future;
30238
30325
  return t === void 0 ? e : {
30239
- past: dN(e.past, e.present),
30326
+ past: pN(e.past, e.present),
30240
30327
  present: t,
30241
30328
  future: n,
30242
30329
  gestureBase: null
30243
30330
  };
30244
30331
  }
30245
- function gN(e) {
30332
+ function vN(e) {
30246
30333
  return {
30247
30334
  ...e,
30248
30335
  gestureBase: e.present
30249
30336
  };
30250
30337
  }
30251
- function _N(e, t) {
30338
+ function yN(e, t) {
30252
30339
  return {
30253
30340
  ...e,
30254
30341
  present: t
30255
30342
  };
30256
30343
  }
30257
- function vN(e) {
30344
+ function bN(e) {
30258
30345
  let t = e.gestureBase;
30259
30346
  return t === null ? e : t === e.present ? {
30260
30347
  ...e,
30261
30348
  gestureBase: null
30262
30349
  } : {
30263
- past: dN(e.past, t),
30350
+ past: pN(e.past, t),
30264
30351
  present: e.present,
30265
30352
  future: [],
30266
30353
  gestureBase: null
30267
30354
  };
30268
30355
  }
30269
- function yN(e) {
30356
+ function xN(e) {
30270
30357
  return e.past.length > 0;
30271
30358
  }
30272
- function bN(e) {
30359
+ function SN(e) {
30273
30360
  return e.future.length > 0;
30274
30361
  }
30275
30362
  //#endregion
30276
30363
  //#region src/page/frames/use-retrain-editor-history.ts
30277
30364
  i();
30278
- function xN(e, t) {
30365
+ function CN(e, t) {
30279
30366
  return typeof e == "function" ? e(t) : e;
30280
30367
  }
30281
- function SN(e) {
30282
- let [t, n] = a(() => uN(e())), r = s((e) => {
30283
- n((t) => fN(t, xN(e, t.present)));
30368
+ function wN(e) {
30369
+ let [t, n] = a(() => fN(e())), r = s((e) => {
30370
+ n((t) => mN(t, CN(e, t.present)));
30284
30371
  }, []), i = s((e) => {
30285
- n(uN(e));
30372
+ n(fN(e));
30286
30373
  }, []), o = s((e) => {
30287
- n((t) => pN(t, xN(e, t.present)));
30374
+ n((t) => hN(t, CN(e, t.present)));
30288
30375
  }, []), c = s(() => {
30289
- n((e) => gN(e));
30376
+ n((e) => vN(e));
30290
30377
  }, []), l = s((e) => {
30291
- n((t) => _N(t, xN(e, t.present)));
30378
+ n((t) => yN(t, CN(e, t.present)));
30292
30379
  }, []), u = s(() => {
30293
- n((e) => vN(e));
30380
+ n((e) => bN(e));
30294
30381
  }, []), d = s(() => {
30295
- n((e) => mN(e));
30382
+ n((e) => gN(e));
30296
30383
  }, []), f = s(() => {
30297
- n((e) => hN(e));
30384
+ n((e) => _N(e));
30298
30385
  }, []);
30299
30386
  return {
30300
30387
  editor: t.present,
@@ -30306,20 +30393,20 @@ function SN(e) {
30306
30393
  endGesture: u,
30307
30394
  undo: d,
30308
30395
  redo: f,
30309
- canUndo: yN(t),
30310
- canRedo: bN(t)
30396
+ canUndo: xN(t),
30397
+ canRedo: SN(t)
30311
30398
  };
30312
30399
  }
30313
30400
  //#endregion
30314
30401
  //#region src/page/frames/use-retrain-shortcuts.ts
30315
30402
  i();
30316
- function CN(e, t) {
30403
+ function TN(e, t) {
30317
30404
  let n = e.boxes.length;
30318
30405
  if (n === 0) return null;
30319
30406
  let r = e.boxes.findIndex((t) => t.key === e.selectedKey), i = r < 0 ? t === 1 ? 0 : n - 1 : (r + t + n) % n;
30320
30407
  return e.boxes[i]?.key ?? null;
30321
30408
  }
30322
- function wN(e, t) {
30409
+ function EN(e, t) {
30323
30410
  let { history: n } = t, r = n.editor.selectedKey;
30324
30411
  switch (e.kind) {
30325
30412
  case "next-frame": return t.onNextFrame();
@@ -30331,39 +30418,39 @@ function wN(e, t) {
30331
30418
  case "zoom-in": return t.onZoomIn(), !0;
30332
30419
  case "zoom-out": return t.onZoomOut(), !0;
30333
30420
  case "zoom-fit": return t.onZoomFit(), !0;
30334
- case "accept-all": return n.setEditor((e) => oM(e)), !0;
30421
+ case "accept-all": return n.setEditor((e) => cM(e)), !0;
30335
30422
  case "select-next":
30336
30423
  case "select-prev": {
30337
- let t = CN(n.editor, e.kind === "select-next" ? 1 : -1);
30338
- return t === null ? !1 : (n.selectOnly((e) => lM(e, t)), !0);
30424
+ let t = TN(n.editor, e.kind === "select-next" ? 1 : -1);
30425
+ return t === null ? !1 : (n.selectOnly((e) => dM(e, t)), !0);
30339
30426
  }
30340
- case "deselect": return r === null ? !1 : (n.selectOnly((e) => lM(e, null)), !0);
30427
+ case "deselect": return r === null ? !1 : (n.selectOnly((e) => dM(e, null)), !0);
30341
30428
  default: break;
30342
30429
  }
30343
30430
  if (r === null) return !1;
30344
30431
  switch (e.kind) {
30345
- case "delete": return n.setEditor((e) => cM(e, r)), !0;
30346
- case "set-class": return n.setEditor((t) => iM(t, r, { macroClass: e.macroClass })), !0;
30347
- case "accept": return n.setEditor((e) => aM(e, r)), !0;
30348
- case "toggle-model-error": return n.setEditor((e) => sM(e, r)), !0;
30432
+ case "delete": return n.setEditor((e) => uM(e, r)), !0;
30433
+ case "set-class": return n.setEditor((t) => oM(t, r, { macroClass: e.macroClass })), !0;
30434
+ case "accept": return n.setEditor((e) => sM(e, r)), !0;
30435
+ case "toggle-model-error": return n.setEditor((e) => lM(e, r)), !0;
30349
30436
  default: return !1;
30350
30437
  }
30351
30438
  }
30352
- function TN(e, t) {
30439
+ function DN(e, t) {
30353
30440
  let n = u(t);
30354
30441
  n.current = t, y(() => {
30355
30442
  if (!e) return;
30356
30443
  let t = (e) => {
30357
30444
  if (e.defaultPrevented || e.isComposing) return;
30358
- let t = eN({
30445
+ let t = nN({
30359
30446
  key: e.key,
30360
30447
  ctrlKey: e.ctrlKey,
30361
30448
  metaKey: e.metaKey,
30362
30449
  shiftKey: e.shiftKey,
30363
30450
  altKey: e.altKey,
30364
- typing: $M(e.target)
30451
+ typing: tN(e.target)
30365
30452
  });
30366
- t !== null && wN(t, n.current) && e.preventDefault();
30453
+ t !== null && EN(t, n.current) && e.preventDefault();
30367
30454
  };
30368
30455
  return window.addEventListener("keydown", t), () => {
30369
30456
  window.removeEventListener("keydown", t);
@@ -30373,7 +30460,7 @@ function TN(e, t) {
30373
30460
  //#endregion
30374
30461
  //#region src/page/frames/RetrainWorkbench.tsx
30375
30462
  i();
30376
- var EN = "person", DN = {
30463
+ var ON = "person", kN = {
30377
30464
  pending: "Reading which detector this camera runs…",
30378
30465
  "placement-unreadable": "The detection stage of this camera could not be read, so the model it runs is unknown — not absent.",
30379
30466
  "detection-off": "This camera runs no object detector, so there is no proposal to mirror.",
@@ -30382,8 +30469,8 @@ var EN = "person", DN = {
30382
30469
  "step-unknown": "That node carries no object-detection step in its catalog.",
30383
30470
  "no-model": "No object-detection model on that accelerator can be resolved for this camera."
30384
30471
  };
30385
- function ON({ frames: e, activeFrameId: t, onActiveFrame: n, onFramesChanged: r, onSaved: i, setNotice: o }) {
30386
- let c = e.find((e) => e.frameId === t), l = c?.deviceId ?? null, d = SN(() => eM([], [])), { editor: f, setEditor: p, resetEditor: h, selectOnly: g } = d, _ = cN(), v = $s({ frameIds: [t] }), b = Zs({ frameId: t }), x = Qs(), S = ec(), C = nc(), w = pc({ deviceIds: l === null ? [] : [l] }, {
30472
+ function AN({ frames: e, activeFrameId: t, onActiveFrame: n, onFramesChanged: r, onSaved: i, setNotice: o }) {
30473
+ let c = e.find((e) => e.frameId === t), l = c?.deviceId ?? null, d = wN(() => nM([], [])), { editor: f, setEditor: p, resetEditor: h, selectOnly: g } = d, _ = uN(), v = $s({ frameIds: [t] }), b = Zs({ frameId: t }), x = Qs(), S = ec(), C = nc(), w = pc({ deviceIds: l === null ? [] : [l] }, {
30387
30474
  enabled: l !== null,
30388
30475
  staleTime: 3e4
30389
30476
  }), T = w.data?.[0]?.detection?.nodeId ?? null, E = dc({ nodeId: T ?? "" }, {
@@ -30395,7 +30482,7 @@ function ON({ frames: e, activeFrameId: t, onActiveFrame: n, onFramesChanged: r,
30395
30482
  }), O = fc({ deviceId: l ?? 0 }, {
30396
30483
  enabled: l !== null,
30397
30484
  staleTime: 3e4
30398
- }), k = m(() => Jj({
30485
+ }), k = m(() => Xj({
30399
30486
  status: w.data?.[0],
30400
30487
  nodeDevices: E.data,
30401
30488
  schema: D.data,
@@ -30417,7 +30504,7 @@ function ON({ frames: e, activeFrameId: t, onActiveFrame: n, onFramesChanged: r,
30417
30504
  y(() => {
30418
30505
  _.fit();
30419
30506
  let { stored: e, copy: n } = A.current;
30420
- h(eM((e ?? []).filter((e) => e.mediaKey === t), n?.pipelineBoxes ?? []));
30507
+ h(nM((e ?? []).filter((e) => e.mediaKey === t), n?.pipelineBoxes ?? []));
30421
30508
  }, [
30422
30509
  t,
30423
30510
  v.dataUpdatedAt,
@@ -30427,7 +30514,7 @@ function ON({ frames: e, activeFrameId: t, onActiveFrame: n, onFramesChanged: r,
30427
30514
  ]);
30428
30515
  let M = s(async (e) => {
30429
30516
  c !== void 0 && (await C.mutateAsync({
30430
- ...wM(c),
30517
+ ...EM(c),
30431
30518
  complete: e
30432
30519
  }), await r());
30433
30520
  }, [
@@ -30437,11 +30524,11 @@ function ON({ frames: e, activeFrameId: t, onActiveFrame: n, onFramesChanged: r,
30437
30524
  ]), N = s(async (e) => {
30438
30525
  if (c === void 0) return;
30439
30526
  if (o(null), k.kind !== "resolved") {
30440
- o(DN[k.gap]);
30527
+ o(kN[k.gap]);
30441
30528
  return;
30442
30529
  }
30443
30530
  let t = await x.mutateAsync({
30444
- ...wM(c),
30531
+ ...EM(c),
30445
30532
  subject: e === "package" ? { kind: "package" } : {
30446
30533
  kind: "objects",
30447
30534
  modelId: k.modelId,
@@ -30453,7 +30540,7 @@ function ON({ frames: e, activeFrameId: t, onActiveFrame: n, onFramesChanged: r,
30453
30540
  o(t.reason === "no-zone" ? "A package proposal runs on the zone crop only — this camera has no zone, and running the detector on the whole frame at 0.35 proposes furniture." : `The pipeline refused: ${t.reason}${t.detail === void 0 ? "" : ` — ${t.detail}`}`);
30454
30541
  return;
30455
30542
  }
30456
- let n = tM(f, t.proposals.map((e) => ({
30543
+ let n = rM(f, t.proposals.map((e) => ({
30457
30544
  bbox: e.bbox,
30458
30545
  macroClass: e.macroClass,
30459
30546
  ...e.label === void 0 ? {} : { label: e.label },
@@ -30472,15 +30559,15 @@ function ON({ frames: e, activeFrameId: t, onActiveFrame: n, onFramesChanged: r,
30472
30559
  p,
30473
30560
  o
30474
30561
  ]), P = s((e) => {
30475
- p((t) => nM(t, e, EN));
30562
+ p((t) => iM(t, e, ON));
30476
30563
  }, [p]), [ee, F] = a(!1), te = s(async () => {
30477
30564
  if (c === void 0) return;
30478
- let e = fM(f);
30565
+ let e = mM(f);
30479
30566
  F(!0);
30480
30567
  try {
30481
30568
  await S.mutateAsync({
30482
- ...wM(c),
30483
- annotations: [...mM(f)]
30569
+ ...EM(c),
30570
+ annotations: [...gM(f)]
30484
30571
  }), await v.refetch();
30485
30572
  } finally {
30486
30573
  F(!1);
@@ -30493,11 +30580,11 @@ function ON({ frames: e, activeFrameId: t, onActiveFrame: n, onFramesChanged: r,
30493
30580
  v,
30494
30581
  i,
30495
30582
  o
30496
- ]), ne = b.data, I = xM(f.boxes) && c !== void 0, re = fM(f), ie = e.map((e) => e.frameId), L = (e) => {
30583
+ ]), ne = b.data, I = CM(f.boxes) && c !== void 0, re = mM(f), ie = e.map((e) => e.frameId), L = (e) => {
30497
30584
  let r = ie.indexOf(t), i = ie[r + e];
30498
30585
  return r < 0 || i === void 0 ? !1 : (n(i), !0);
30499
30586
  };
30500
- return TN(!ee, {
30587
+ return DN(!ee, {
30501
30588
  history: d,
30502
30589
  onNextFrame: () => L(1),
30503
30590
  onPrevFrame: () => L(-1),
@@ -30511,7 +30598,7 @@ function ON({ frames: e, activeFrameId: t, onActiveFrame: n, onFramesChanged: r,
30511
30598
  "aria-busy": ee,
30512
30599
  children: [/* @__PURE__ */ H("div", {
30513
30600
  className: "rounded-md border border-border overflow-hidden flex flex-col",
30514
- children: [/* @__PURE__ */ V(lN, {
30601
+ children: [/* @__PURE__ */ V(dN, {
30515
30602
  view: _,
30516
30603
  canUndo: d.canUndo,
30517
30604
  canRedo: d.canRedo,
@@ -30520,7 +30607,7 @@ function ON({ frames: e, activeFrameId: t, onActiveFrame: n, onFramesChanged: r,
30520
30607
  }), ne === void 0 ? /* @__PURE__ */ H("div", {
30521
30608
  className: "flex items-center gap-2 p-6 text-xs text-foreground-subtle",
30522
30609
  children: [/* @__PURE__ */ V(dr, { className: "h-3.5 w-3.5 animate-spin" }), "Loading the frame…"]
30523
- }) : /* @__PURE__ */ V(sN, {
30610
+ }) : /* @__PURE__ */ V(lN, {
30524
30611
  imageSrc: `data:image/jpeg;base64,${ne.base64}`,
30525
30612
  imageWidth: ne.width,
30526
30613
  imageHeight: ne.height,
@@ -30530,12 +30617,12 @@ function ON({ frames: e, activeFrameId: t, onActiveFrame: n, onFramesChanged: r,
30530
30617
  onViewportChange: _.setViewport,
30531
30618
  panMode: _.panMode,
30532
30619
  onSelect: (e) => {
30533
- g((t) => lM(t, e));
30620
+ g((t) => dM(t, e));
30534
30621
  },
30535
30622
  onDraw: P,
30536
30623
  onGestureStart: d.beginGesture,
30537
30624
  onGestureBox: (e, t) => {
30538
- d.updateGesture((n) => iM(n, e, { bbox: t }));
30625
+ d.updateGesture((n) => oM(n, e, { bbox: t }));
30539
30626
  },
30540
30627
  onGestureEnd: d.endGesture
30541
30628
  })]
@@ -30577,9 +30664,9 @@ function ON({ frames: e, activeFrameId: t, onActiveFrame: n, onFramesChanged: r,
30577
30664
  }),
30578
30665
  /* @__PURE__ */ V("div", {
30579
30666
  className: "px-3 py-1 border-b border-border text-[11px] text-foreground-subtle",
30580
- children: k.kind === "resolved" ? `Proposals come from ${k.modelId} at ${k.minScore.toFixed(2)}, on ${k.nodeId} — what this camera really runs.` : DN[k.gap]
30667
+ children: k.kind === "resolved" ? `Proposals come from ${k.modelId} at ${k.minScore.toFixed(2)}, on ${k.nodeId} — what this camera really runs.` : kN[k.gap]
30581
30668
  }),
30582
- c !== void 0 && /* @__PURE__ */ V(kM, {
30669
+ c !== void 0 && /* @__PURE__ */ V(jM, {
30583
30670
  frame: c,
30584
30671
  history: d,
30585
30672
  detector: k,
@@ -30588,23 +30675,23 @@ function ON({ frames: e, activeFrameId: t, onActiveFrame: n, onFramesChanged: r,
30588
30675
  }),
30589
30676
  /* @__PURE__ */ V("div", {
30590
30677
  className: "flex-1 overflow-y-auto",
30591
- children: /* @__PURE__ */ V(bM, {
30678
+ children: /* @__PURE__ */ V(SM, {
30592
30679
  boxes: f.boxes,
30593
30680
  selectedKey: f.selectedKey,
30594
30681
  onSelect: (e) => {
30595
- g((t) => lM(t, e));
30682
+ g((t) => dM(t, e));
30596
30683
  },
30597
30684
  onChange: (e, t) => {
30598
- p((n) => iM(n, e, t));
30685
+ p((n) => oM(n, e, t));
30599
30686
  },
30600
30687
  onAccept: (e) => {
30601
- p((t) => aM(t, e));
30688
+ p((t) => sM(t, e));
30602
30689
  },
30603
30690
  onToggleModelError: (e) => {
30604
- p((t) => sM(t, e));
30691
+ p((t) => lM(t, e));
30605
30692
  },
30606
30693
  onDelete: (e) => {
30607
- p((t) => cM(t, e));
30694
+ p((t) => uM(t, e));
30608
30695
  }
30609
30696
  })
30610
30697
  }),
@@ -30637,7 +30724,7 @@ function ON({ frames: e, activeFrameId: t, onActiveFrame: n, onFramesChanged: r,
30637
30724
  variant: "secondary",
30638
30725
  size: "sm",
30639
30726
  onClick: () => {
30640
- p((e) => oM(e));
30727
+ p((e) => cM(e));
30641
30728
  },
30642
30729
  children: [/* @__PURE__ */ V(qt, { className: "h-3 w-3" }), /* @__PURE__ */ V("span", {
30643
30730
  className: "ml-1",
@@ -30664,7 +30751,7 @@ function ON({ frames: e, activeFrameId: t, onActiveFrame: n, onFramesChanged: r,
30664
30751
  //#endregion
30665
30752
  //#region src/page/frames/CorpusAnnotateOverlay.tsx
30666
30753
  i();
30667
- function kN({ open: e, frames: t, activeFrameId: n, onActiveFrame: r, onClose: i, onFramesChanged: o, onSaved: s }) {
30754
+ function jN({ open: e, frames: t, activeFrameId: n, onActiveFrame: r, onClose: i, onFramesChanged: o, onSaved: s }) {
30668
30755
  let [c, l] = a(null);
30669
30756
  return y(() => {
30670
30757
  l(null);
@@ -30692,7 +30779,7 @@ function kN({ open: e, frames: t, activeFrameId: n, onActiveFrame: r, onClose: i
30692
30779
  })
30693
30780
  }), /* @__PURE__ */ V(jp, {
30694
30781
  className: "flex min-h-0 flex-1 flex-col overflow-y-auto p-3 sm:p-4",
30695
- children: /* @__PURE__ */ V(ON, {
30782
+ children: /* @__PURE__ */ V(AN, {
30696
30783
  frames: t,
30697
30784
  activeFrameId: n,
30698
30785
  onActiveFrame: r,
@@ -30707,7 +30794,7 @@ function kN({ open: e, frames: t, activeFrameId: n, onActiveFrame: r, onClose: i
30707
30794
  //#endregion
30708
30795
  //#region src/page/frames/RetrainCollectionsList.tsx
30709
30796
  i();
30710
- function AN({ collections: e, isLoading: t, selectedId: n, onSelect: r, onCreate: i, onRename: o, onDelete: s }) {
30797
+ function MN({ collections: e, isLoading: t, selectedId: n, onSelect: r, onCreate: i, onRename: o, onDelete: s }) {
30711
30798
  let [c, l] = a(""), [u, d] = a(null), [f, p] = a(null), m = async () => {
30712
30799
  let e = await i(c);
30713
30800
  d(e), e === null && l("");
@@ -30815,19 +30902,19 @@ function AN({ collections: e, isLoading: t, selectedId: n, onSelect: r, onCreate
30815
30902
  }
30816
30903
  //#endregion
30817
30904
  //#region src/page/frames/CorpusCollectionsSection.tsx
30818
- var jN = {
30905
+ var NN = {
30819
30906
  "empty-name": "Give the collection a name.",
30820
30907
  "duplicate-name": "A collection with that name already exists.",
30821
30908
  "unknown-collection": "That collection no longer exists."
30822
30909
  };
30823
- function MN({ collections: e, isLoading: t, selectedId: n, onSelect: r, onCreate: i, onRename: a, onDelete: o }) {
30910
+ function PN({ collections: e, isLoading: t, selectedId: n, onSelect: r, onCreate: i, onRename: a, onDelete: o }) {
30824
30911
  return /* @__PURE__ */ V(xg, {
30825
30912
  headingId: "corpus-collections-heading",
30826
30913
  title: "Collections",
30827
30914
  testId: "corpus-collections",
30828
30915
  children: /* @__PURE__ */ V("div", {
30829
30916
  className: C,
30830
- children: /* @__PURE__ */ V(AN, {
30917
+ children: /* @__PURE__ */ V(MN, {
30831
30918
  collections: e ?? [],
30832
30919
  isLoading: t,
30833
30920
  selectedId: n,
@@ -30841,8 +30928,8 @@ function MN({ collections: e, isLoading: t, selectedId: n, onSelect: r, onCreate
30841
30928
  }
30842
30929
  //#endregion
30843
30930
  //#region src/page/frames/lib/authed-download.ts
30844
- var NN = "camstack_admin_token", PN = 6e4;
30845
- function FN(e) {
30931
+ var FN = "camstack_admin_token", IN = 6e4;
30932
+ function LN(e) {
30846
30933
  if (e === null) return null;
30847
30934
  let t = /filename\*=UTF-8''([^;]+)/i.exec(e);
30848
30935
  if (t?.[1] !== void 0) try {
@@ -30850,20 +30937,20 @@ function FN(e) {
30850
30937
  } catch {}
30851
30938
  return /filename="?([^";]+)"?/i.exec(e)?.[1]?.trim() ?? null;
30852
30939
  }
30853
- async function IN(e, t) {
30854
- let n = localStorage.getItem(NN), r = {};
30940
+ async function RN(e, t) {
30941
+ let n = localStorage.getItem(FN), r = {};
30855
30942
  n !== null && (r.Authorization = `Bearer ${n}`);
30856
30943
  let i = await fetch(e, { headers: r });
30857
30944
  if (!i.ok) throw Error(`download failed: ${String(i.status)}`);
30858
- let a = await i.blob(), o = FN(i.headers.get("content-disposition")) ?? t, s = URL.createObjectURL(a), c = document.createElement("a");
30945
+ let a = await i.blob(), o = LN(i.headers.get("content-disposition")) ?? t, s = URL.createObjectURL(a), c = document.createElement("a");
30859
30946
  c.href = s, c.download = o, c.click(), setTimeout(() => {
30860
30947
  URL.revokeObjectURL(s);
30861
- }, PN);
30948
+ }, IN);
30862
30949
  }
30863
30950
  //#endregion
30864
30951
  //#region src/page/frames/CorpusFilterBar.tsx
30865
30952
  i();
30866
- var LN = [
30953
+ var zN = [
30867
30954
  {
30868
30955
  value: void 0,
30869
30956
  label: "All"
@@ -30880,7 +30967,7 @@ var LN = [
30880
30967
  value: "complete",
30881
30968
  label: "Complete"
30882
30969
  }
30883
- ], RN = [
30970
+ ], BN = [
30884
30971
  "person",
30885
30972
  "vehicle",
30886
30973
  "animal",
@@ -30888,10 +30975,10 @@ var LN = [
30888
30975
  "face",
30889
30976
  "plate"
30890
30977
  ];
30891
- function zN(e) {
30978
+ function VN(e) {
30892
30979
  return e ?? "all";
30893
30980
  }
30894
- function BN({ filter: e, onChange: t, cameraItems: n, camerasListState: r, collections: i, collectionsPending: o }) {
30981
+ function HN({ filter: e, onChange: t, cameraItems: n, camerasListState: r, collections: i, collectionsPending: o }) {
30895
30982
  let s = tc(m(() => ({
30896
30983
  ...e.workState === void 0 ? {} : { workState: e.workState },
30897
30984
  ...e.deviceIds.length > 0 ? { deviceIds: [...e.deviceIds] } : {},
@@ -30915,7 +31002,7 @@ function BN({ filter: e, onChange: t, cameraItems: n, camerasListState: r, colle
30915
31002
  if (s.data !== void 0) {
30916
31003
  l(!0), d(null);
30917
31004
  try {
30918
- await IN(I(s.data.url), "camstack-retrain-export.tar");
31005
+ await RN(I(s.data.url), "camstack-retrain-export.tar");
30919
31006
  } catch (e) {
30920
31007
  d(e instanceof Error ? e.message : String(e));
30921
31008
  } finally {
@@ -30935,8 +31022,8 @@ function BN({ filter: e, onChange: t, cameraItems: n, camerasListState: r, colle
30935
31022
  role: "group",
30936
31023
  "aria-label": "Work state",
30937
31024
  "data-testid": "corpus-work-state-filter",
30938
- children: LN.map((t) => {
30939
- let n = zN(e.workState) === zN(t.value);
31025
+ children: zN.map((t) => {
31026
+ let n = VN(e.workState) === VN(t.value);
30940
31027
  return /* @__PURE__ */ V("button", {
30941
31028
  type: "button",
30942
31029
  "aria-pressed": n,
@@ -30945,12 +31032,12 @@ function BN({ filter: e, onChange: t, cameraItems: n, camerasListState: r, colle
30945
31032
  },
30946
31033
  className: J(M, "px-2", n ? te : ee),
30947
31034
  children: t.label
30948
- }, zN(t.value));
31035
+ }, VN(t.value));
30949
31036
  })
30950
31037
  }),
30951
31038
  /* @__PURE__ */ V("div", {
30952
31039
  className: "min-w-0 flex-1 basis-full sm:basis-64",
30953
- children: /* @__PURE__ */ V(Fj, {
31040
+ children: /* @__PURE__ */ V(Bj, {
30954
31041
  devices: n,
30955
31042
  listState: r,
30956
31043
  value: e.deviceIds,
@@ -30996,7 +31083,7 @@ function BN({ filter: e, onChange: t, cameraItems: n, camerasListState: r, colle
30996
31083
  role: "group",
30997
31084
  "aria-label": "Annotated classes",
30998
31085
  "data-testid": "corpus-class-filter",
30999
- children: RN.map((t) => {
31086
+ children: BN.map((t) => {
31000
31087
  let n = e.classes.includes(t);
31001
31088
  return /* @__PURE__ */ V("button", {
31002
31089
  type: "button",
@@ -31019,7 +31106,7 @@ function BN({ filter: e, onChange: t, cameraItems: n, camerasListState: r, colle
31019
31106
  }
31020
31107
  //#endregion
31021
31108
  //#region src/page/frames/corpus-frame-badge.ts
31022
- function VN(e) {
31109
+ function UN(e) {
31023
31110
  switch (e) {
31024
31111
  case "unannotated": return {
31025
31112
  label: "To do",
@@ -31037,13 +31124,13 @@ function VN(e) {
31037
31124
  }
31038
31125
  //#endregion
31039
31126
  //#region src/page/frames/CorpusFrameGrid.tsx
31040
- var HN = [
31127
+ var WN = [
31041
31128
  25,
31042
31129
  50,
31043
31130
  100
31044
31131
  ];
31045
- function UN({ frame: e, cameraName: t, onOpen: n }) {
31046
- let r = Zs({ frameId: e.frameId }), i = VN(e.workState), a = r.data === void 0 ? void 0 : `data:image/jpeg;base64,${r.data.base64}`;
31132
+ function GN({ frame: e, cameraName: t, onOpen: n }) {
31133
+ let r = Zs({ frameId: e.frameId }), i = UN(e.workState), a = r.data === void 0 ? void 0 : `data:image/jpeg;base64,${r.data.base64}`;
31047
31134
  return /* @__PURE__ */ H("button", {
31048
31135
  type: "button",
31049
31136
  className: "group flex min-w-0 flex-col overflow-hidden rounded-md border border-border bg-surface text-left hover:border-primary/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/40",
@@ -31071,7 +31158,7 @@ function UN({ frame: e, cameraName: t, onOpen: n }) {
31071
31158
  })]
31072
31159
  });
31073
31160
  }
31074
- function WN({ frames: e, total: t, page: n, pageSize: r, isLoading: i, isError: a, deviceNames: o, onPageChange: s, onPageSizeChange: c, onOpenFrame: l }) {
31161
+ function KN({ frames: e, total: t, page: n, pageSize: r, isLoading: i, isError: a, deviceNames: o, onPageChange: s, onPageSizeChange: c, onOpenFrame: l }) {
31075
31162
  let u = e !== void 0 && t !== void 0;
31076
31163
  return /* @__PURE__ */ H("div", {
31077
31164
  className: "space-y-3",
@@ -31093,7 +31180,7 @@ function WN({ frames: e, total: t, page: n, pageSize: r, isLoading: i, isError:
31093
31180
  }) : null,
31094
31181
  u && e.length > 0 ? /* @__PURE__ */ V("div", {
31095
31182
  className: "grid grid-cols-2 gap-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5",
31096
- children: e.map((e) => /* @__PURE__ */ V(UN, {
31183
+ children: e.map((e) => /* @__PURE__ */ V(GN, {
31097
31184
  frame: e,
31098
31185
  cameraName: o.get(e.deviceId) ?? `Camera ${String(e.deviceId)}`,
31099
31186
  onOpen: () => {
@@ -31105,7 +31192,7 @@ function WN({ frames: e, total: t, page: n, pageSize: r, isLoading: i, isError:
31105
31192
  className: "flex flex-wrap items-center justify-between gap-2",
31106
31193
  children: [/* @__PURE__ */ V(kk, {
31107
31194
  value: r,
31108
- options: HN,
31195
+ options: WN,
31109
31196
  onChange: c,
31110
31197
  ariaLabel: "Frames per page"
31111
31198
  }), /* @__PURE__ */ V(md, {
@@ -31122,18 +31209,18 @@ function WN({ frames: e, total: t, page: n, pageSize: r, isLoading: i, isError:
31122
31209
  //#endregion
31123
31210
  //#region src/page/frames/CorpusKpiBar.tsx
31124
31211
  i();
31125
- var GN = 8;
31126
- function KN(e, t) {
31212
+ var qN = 8;
31213
+ function JN(e, t) {
31127
31214
  return t.get(e) ?? `Camera ${String(e)}`;
31128
31215
  }
31129
- function qN(e) {
31216
+ function YN(e) {
31130
31217
  return e === null ? "—" : `${(e * 100).toFixed(0)}%`;
31131
31218
  }
31132
- function JN(e) {
31219
+ function XN(e) {
31133
31220
  return [...e].toSorted((e, t) => t.unannotated === e.unannotated ? e.deviceId - t.deviceId : t.unannotated - e.unannotated);
31134
31221
  }
31135
- function YN({ kpi: e, isLoading: t, isError: n, deviceNames: r, onSelectCamera: i }) {
31136
- let [o, s] = a(!1), c = m(() => e === void 0 ? [] : JN(e.cameras), [e]), l = o ? c : c.slice(0, GN);
31222
+ function ZN({ kpi: e, isLoading: t, isError: n, deviceNames: r, onSelectCamera: i }) {
31223
+ let [o, s] = a(!1), c = m(() => e === void 0 ? [] : XN(e.cameras), [e]), l = o ? c : c.slice(0, qN);
31137
31224
  return /* @__PURE__ */ H("div", {
31138
31225
  className: "space-y-3",
31139
31226
  "data-testid": "corpus-kpi-bar",
@@ -31155,22 +31242,22 @@ function YN({ kpi: e, isLoading: t, isError: n, deviceNames: r, onSelectCamera:
31155
31242
  e === void 0 ? null : /* @__PURE__ */ H("div", {
31156
31243
  className: k,
31157
31244
  children: [
31158
- /* @__PURE__ */ V(sA, {
31245
+ /* @__PURE__ */ V(fA, {
31159
31246
  icon: Yn,
31160
31247
  label: "Total frames",
31161
31248
  value: e.total
31162
31249
  }),
31163
- /* @__PURE__ */ V(sA, {
31250
+ /* @__PURE__ */ V(fA, {
31164
31251
  icon: en,
31165
31252
  label: "Unannotated",
31166
31253
  value: e.unannotated
31167
31254
  }),
31168
- /* @__PURE__ */ V(sA, {
31255
+ /* @__PURE__ */ V(fA, {
31169
31256
  icon: Lr,
31170
31257
  label: "Annotated",
31171
31258
  value: e.annotated
31172
31259
  }),
31173
- /* @__PURE__ */ V(sA, {
31260
+ /* @__PURE__ */ V(fA, {
31174
31261
  icon: $t,
31175
31262
  label: "Complete",
31176
31263
  value: e.complete
@@ -31204,10 +31291,10 @@ function YN({ kpi: e, isLoading: t, isError: n, deviceNames: r, onSelectCamera:
31204
31291
  className: "flex items-center justify-between gap-2",
31205
31292
  children: [/* @__PURE__ */ V("span", {
31206
31293
  className: "min-w-0 truncate font-medium text-foreground",
31207
- children: KN(e.deviceId, r)
31294
+ children: JN(e.deviceId, r)
31208
31295
  }), /* @__PURE__ */ V("span", {
31209
31296
  className: "shrink-0 text-foreground-muted",
31210
- children: qN(e.pctOfCorpus)
31297
+ children: YN(e.pctOfCorpus)
31211
31298
  })]
31212
31299
  }),
31213
31300
  /* @__PURE__ */ H("div", {
@@ -31230,7 +31317,7 @@ function YN({ kpi: e, isLoading: t, isError: n, deviceNames: r, onSelectCamera:
31230
31317
  }) }, e.deviceId);
31231
31318
  })
31232
31319
  }),
31233
- !o && c.length > GN ? /* @__PURE__ */ H(X, {
31320
+ !o && c.length > qN ? /* @__PURE__ */ H(X, {
31234
31321
  type: "button",
31235
31322
  variant: "ghost",
31236
31323
  size: "sm",
@@ -31251,11 +31338,11 @@ function YN({ kpi: e, isLoading: t, isError: n, deviceNames: r, onSelectCamera:
31251
31338
  }
31252
31339
  //#endregion
31253
31340
  //#region src/page/frames/corpus-filter-url.ts
31254
- var XN = new Set([
31341
+ var QN = new Set([
31255
31342
  "unannotated",
31256
31343
  "annotated",
31257
31344
  "complete"
31258
- ]), ZN = new Set([
31345
+ ]), $N = new Set([
31259
31346
  "person",
31260
31347
  "vehicle",
31261
31348
  "animal",
@@ -31263,72 +31350,72 @@ var XN = new Set([
31263
31350
  "face",
31264
31351
  "plate"
31265
31352
  ]);
31266
- function QN(e) {
31353
+ function eP(e) {
31267
31354
  return e === null || e.trim() === "" ? [] : e.split(",").map((e) => e.trim()).filter((e) => e.length > 0);
31268
31355
  }
31269
- function $N(e) {
31356
+ function tP(e) {
31270
31357
  let t = [];
31271
- for (let n of QN(e)) {
31358
+ for (let n of eP(e)) {
31272
31359
  let e = Number.parseInt(n, 10);
31273
31360
  Number.isInteger(e) && e > 0 && !t.includes(e) && t.push(e);
31274
31361
  }
31275
31362
  return t;
31276
31363
  }
31277
- function eP(e) {
31278
- return ZN.has(e);
31364
+ function nP(e) {
31365
+ return $N.has(e);
31279
31366
  }
31280
- function tP(e) {
31281
- return XN.has(e);
31367
+ function rP(e) {
31368
+ return QN.has(e);
31282
31369
  }
31283
- function nP(e) {
31370
+ function iP(e) {
31284
31371
  let t = [];
31285
- for (let n of QN(e)) !eP(n) || t.includes(n) || t.push(n);
31372
+ for (let n of eP(e)) !nP(n) || t.includes(n) || t.push(n);
31286
31373
  return t;
31287
31374
  }
31288
- function rP(e) {
31289
- if (!(e === null || e === "")) return tP(e) ? e : void 0;
31375
+ function aP(e) {
31376
+ if (!(e === null || e === "")) return rP(e) ? e : void 0;
31290
31377
  }
31291
- function iP(e) {
31378
+ function oP(e) {
31292
31379
  if (e === null || e === "") return 1;
31293
31380
  let t = Number.parseInt(e, 10);
31294
31381
  return Number.isInteger(t) && t >= 1 ? t : 1;
31295
31382
  }
31296
- function aP(e) {
31383
+ function sP(e) {
31297
31384
  let t = e.get("collection")?.trim() ?? "";
31298
31385
  return {
31299
- workState: rP(e.get("workState")),
31300
- deviceIds: $N(e.get("camera")),
31386
+ workState: aP(e.get("workState")),
31387
+ deviceIds: tP(e.get("camera")),
31301
31388
  collectionId: t.length > 0 ? t : void 0,
31302
- classes: nP(e.get("class")),
31303
- page: iP(e.get("page"))
31389
+ classes: iP(e.get("class")),
31390
+ page: oP(e.get("page"))
31304
31391
  };
31305
31392
  }
31306
- function oP(e, t) {
31393
+ function cP(e, t) {
31307
31394
  t.workState === void 0 ? e.delete("workState") : e.set("workState", t.workState), t.deviceIds.length === 0 ? e.delete("camera") : e.set("camera", t.deviceIds.join(",")), t.collectionId === void 0 || t.collectionId === "" ? e.delete("collection") : e.set("collection", t.collectionId), t.classes.length === 0 ? e.delete("class") : e.set("class", t.classes.join(",")), t.page <= 1 ? e.delete("page") : e.set("page", String(t.page));
31308
31395
  }
31309
- function sP(e) {
31396
+ function lP(e) {
31310
31397
  if (typeof window > "u") return;
31311
31398
  let t = new URL(window.location.href);
31312
- oP(t.searchParams, e), window.history.replaceState({}, "", t.toString());
31399
+ cP(t.searchParams, e), window.history.replaceState({}, "", t.toString());
31313
31400
  }
31314
31401
  //#endregion
31315
31402
  //#region src/page/frames/FramesSection.tsx
31316
31403
  i();
31317
- var cP = [
31404
+ var uP = [
31318
31405
  25,
31319
31406
  50,
31320
31407
  100
31321
31408
  ];
31322
- function lP() {
31409
+ function dP() {
31323
31410
  return typeof window > "u" ? {
31324
31411
  workState: void 0,
31325
31412
  deviceIds: [],
31326
31413
  collectionId: void 0,
31327
31414
  classes: [],
31328
31415
  page: 1
31329
- } : aP(new URLSearchParams(window.location.search));
31416
+ } : sP(new URLSearchParams(window.location.search));
31330
31417
  }
31331
- function uP(e, t) {
31418
+ function fP(e, t) {
31332
31419
  return {
31333
31420
  page: e.page,
31334
31421
  pageSize: t,
@@ -31338,13 +31425,13 @@ function uP(e, t) {
31338
31425
  ...e.classes.length > 0 ? { classes: [...e.classes] } : {}
31339
31426
  };
31340
31427
  }
31341
- function dP() {
31342
- let [e, t] = a(lP), [n, r] = Dk({
31428
+ function pP() {
31429
+ let [e, t] = a(dP), [n, r] = Dk({
31343
31430
  storageKey: "training-corpus-page-size",
31344
- options: cP,
31431
+ options: uP,
31345
31432
  defaultSize: 50
31346
31433
  }), [i, o] = a(null), c = s((e) => {
31347
- t(e), sP(e);
31434
+ t(e), lP(e);
31348
31435
  }, []), l = Bs({
31349
31436
  projection: "slim",
31350
31437
  isCamera: !0
@@ -31357,7 +31444,7 @@ function dP() {
31357
31444
  name: e.name,
31358
31445
  type: e.type,
31359
31446
  location: typeof e.location == "string" ? e.location : null
31360
- })), [l.data]), f = bj(l), p = Xs({}), h = Ys(uP(e, n)), g = oc({}), _ = ac(), v = sc(), b = cc();
31447
+ })), [l.data]), f = Tj(l), p = Xs({}), h = Ys(fP(e, n)), g = oc({}), _ = ac(), v = sc(), b = cc();
31361
31448
  y(() => {
31362
31449
  let t = h.data?.total;
31363
31450
  if (t === void 0) return;
@@ -31380,7 +31467,7 @@ function dP() {
31380
31467
  });
31381
31468
  }, [e, c]), S = s(async (t) => {
31382
31469
  let n = await _.mutateAsync({ name: t });
31383
- return await g.refetch(), n.kind === "refused" ? jN[n.reason] ?? n.reason : (c({
31470
+ return await g.refetch(), n.kind === "refused" ? NN[n.reason] ?? n.reason : (c({
31384
31471
  ...e,
31385
31472
  collectionId: n.collection.id,
31386
31473
  page: 1
@@ -31395,7 +31482,7 @@ function dP() {
31395
31482
  id: e,
31396
31483
  name: t
31397
31484
  });
31398
- return await g.refetch(), n.kind === "refused" ? jN[n.reason] ?? n.reason : null;
31485
+ return await g.refetch(), n.kind === "refused" ? NN[n.reason] ?? n.reason : null;
31399
31486
  }, [v, g]), w = s(async (t) => {
31400
31487
  await b.mutateAsync({ id: t }), e.collectionId === t && c({
31401
31488
  ...e,
@@ -31418,14 +31505,14 @@ function dP() {
31418
31505
  className: "space-y-4",
31419
31506
  "data-testid": "frames-section",
31420
31507
  children: [
31421
- /* @__PURE__ */ V(YN, {
31508
+ /* @__PURE__ */ V(ZN, {
31422
31509
  kpi: p.data,
31423
31510
  isLoading: p.isLoading,
31424
31511
  isError: p.isError,
31425
31512
  deviceNames: u,
31426
31513
  onSelectCamera: x
31427
31514
  }),
31428
- /* @__PURE__ */ V(MN, {
31515
+ /* @__PURE__ */ V(PN, {
31429
31516
  collections: g.data,
31430
31517
  isLoading: g.isLoading,
31431
31518
  selectedId: e.collectionId ?? null,
@@ -31440,7 +31527,7 @@ function dP() {
31440
31527
  onRename: C,
31441
31528
  onDelete: w
31442
31529
  }),
31443
- /* @__PURE__ */ V(BN, {
31530
+ /* @__PURE__ */ V(HN, {
31444
31531
  filter: e,
31445
31532
  onChange: c,
31446
31533
  cameraItems: d,
@@ -31448,7 +31535,7 @@ function dP() {
31448
31535
  collections: g.data,
31449
31536
  collectionsPending: g.isLoading && g.data === void 0
31450
31537
  }),
31451
- /* @__PURE__ */ V(WN, {
31538
+ /* @__PURE__ */ V(KN, {
31452
31539
  frames: h.data?.frames,
31453
31540
  total: h.data?.total,
31454
31541
  page: e.page,
@@ -31470,7 +31557,7 @@ function dP() {
31470
31557
  },
31471
31558
  onOpenFrame: T
31472
31559
  }),
31473
- i === null ? null : /* @__PURE__ */ V(kN, {
31560
+ i === null ? null : /* @__PURE__ */ V(jN, {
31474
31561
  open: !0,
31475
31562
  frames: D,
31476
31563
  activeFrameId: i,
@@ -31484,7 +31571,7 @@ function dP() {
31484
31571
  }
31485
31572
  //#endregion
31486
31573
  //#region src/page/view-model.ts
31487
- var fP = [
31574
+ var mP = [
31488
31575
  "uploading",
31489
31576
  "submitted",
31490
31577
  "starting",
@@ -31493,7 +31580,7 @@ var fP = [
31493
31580
  "ready",
31494
31581
  "registered",
31495
31582
  "canary"
31496
- ], pP = {
31583
+ ], hP = {
31497
31584
  queued: "Queued",
31498
31585
  uploading: "Uploading",
31499
31586
  submitted: "Submitted",
@@ -31509,7 +31596,7 @@ var fP = [
31509
31596
  lost: "Lost",
31510
31597
  expired: "Expired",
31511
31598
  discarded: "Discarded"
31512
- }, mP = new Set([
31599
+ }, gP = new Set([
31513
31600
  "ready",
31514
31601
  "registered",
31515
31602
  "canary",
@@ -31519,64 +31606,64 @@ var fP = [
31519
31606
  "expired",
31520
31607
  "discarded"
31521
31608
  ]);
31522
- function hP(e) {
31523
- return mP.has(e);
31609
+ function _P(e) {
31610
+ return gP.has(e);
31524
31611
  }
31525
- function gP(e) {
31526
- return e.some((e) => !hP(e.state));
31612
+ function vP(e) {
31613
+ return e.some((e) => !_P(e.state));
31527
31614
  }
31528
- function _P(e) {
31529
- let t = fP.indexOf(e.state);
31615
+ function yP(e) {
31616
+ let t = mP.indexOf(e.state);
31530
31617
  if (t >= 0) return t;
31531
- if (e.artifacts !== null || e.registeredModelIds.length > 0) return fP.indexOf("ready");
31618
+ if (e.artifacts !== null || e.registeredModelIds.length > 0) return mP.indexOf("ready");
31532
31619
  switch (e.provider.state) {
31533
- case "succeeded": return fP.indexOf("collecting");
31620
+ case "succeeded": return mP.indexOf("collecting");
31534
31621
  case "running":
31535
31622
  case "failed":
31536
- case "cancelled": return fP.indexOf("running");
31537
- case "starting": return fP.indexOf("starting");
31538
- case "pending": return fP.indexOf("submitted");
31623
+ case "cancelled": return mP.indexOf("running");
31624
+ case "starting": return mP.indexOf("starting");
31625
+ case "pending": return mP.indexOf("submitted");
31539
31626
  default: return 0;
31540
31627
  }
31541
31628
  }
31542
- function vP(e) {
31543
- if (e.state === "queued") return fP.map((e) => ({
31629
+ function bP(e) {
31630
+ if (e.state === "queued") return mP.map((e) => ({
31544
31631
  state: e,
31545
- label: pP[e],
31632
+ label: hP[e],
31546
31633
  status: "todo"
31547
31634
  }));
31548
- let t = !fP.includes(e.state), n = _P(e);
31549
- return fP.map((r, i) => {
31635
+ let t = !mP.includes(e.state), n = yP(e);
31636
+ return mP.map((r, i) => {
31550
31637
  let a = "todo";
31551
31638
  return i < n ? a = "done" : i === n && (a = t && e.state !== "expired" ? "failed" : "current"), {
31552
31639
  state: r,
31553
- label: pP[r],
31640
+ label: hP[r],
31554
31641
  status: a
31555
31642
  };
31556
31643
  });
31557
31644
  }
31558
- function yP(e, t) {
31645
+ function xP(e, t) {
31559
31646
  let n = `$${e.toFixed(2)}`;
31560
31647
  return t ? `≈ ${n}` : n;
31561
31648
  }
31562
- function bP(e) {
31649
+ function SP(e) {
31563
31650
  let t = Math.max(0, Math.round(e));
31564
31651
  return t < 60 ? `${String(t)} s` : t < 3600 ? `${String(Math.floor(t / 60))} min ${String(t % 60)} s` : `${String(Math.floor(t / 3600))} h ${String(Math.floor(t % 3600 / 60))} min`;
31565
31652
  }
31566
- function xP(e) {
31653
+ function CP(e) {
31567
31654
  return e < 1024 * 1024 ? `${(e / 1024).toFixed(0)} KB` : e < 1024 ** 3 ? `${(e / 1024 ** 2).toFixed(1)} MB` : `${(e / 1024 ** 3).toFixed(2)} GB`;
31568
31655
  }
31569
- function SP(e) {
31656
+ function wP(e) {
31570
31657
  return e == null ? "—" : `${(e * 100).toFixed(1)}%`;
31571
31658
  }
31572
- function CP(e, t) {
31659
+ function TP(e, t) {
31573
31660
  let n = e.provider.startedAt;
31574
31661
  return n === null ? null : ((e.provider.endedAt ?? t) - n) / 1e3;
31575
31662
  }
31576
- function wP(e, t) {
31663
+ function EP(e, t) {
31577
31664
  return e?.classes[t] ?? null;
31578
31665
  }
31579
- function TP(e) {
31666
+ function DP(e) {
31580
31667
  let t = e.evaluation;
31581
31668
  return t === void 0 ? [] : [...new Set([
31582
31669
  ...Object.keys(t.baseline?.classes ?? {}),
@@ -31584,12 +31671,12 @@ function TP(e) {
31584
31671
  ...Object.keys(t.candidateInt8?.classes ?? {})
31585
31672
  ])].toSorted().map((e) => ({
31586
31673
  cls: e,
31587
- baseline: wP(t.baseline, e),
31588
- candidate: wP(t.candidate, e),
31589
- int8: wP(t.candidateInt8, e)
31674
+ baseline: EP(t.baseline, e),
31675
+ candidate: EP(t.candidate, e),
31676
+ int8: EP(t.candidateInt8, e)
31590
31677
  }));
31591
31678
  }
31592
- function EP(e) {
31679
+ function OP(e) {
31593
31680
  let t = e.evaluation?.recallDeltaByCamera ?? {}, n = [];
31594
31681
  for (let [e, r] of Object.entries(t)) for (let [t, i] of Object.entries(r)) {
31595
31682
  let r = i < -.01 ? "worse" : i > .01 ? "better" : "same";
@@ -31602,17 +31689,17 @@ function EP(e) {
31602
31689
  }
31603
31690
  return n.toSorted((e, t) => e.cls.localeCompare(t.cls) || e.deviceId - t.deviceId);
31604
31691
  }
31605
- function DP(e) {
31692
+ function kP(e) {
31606
31693
  return e === "ready" || e === "registered" || e === "canary" ? "success" : e === "failed" || e === "lost" ? "danger" : e === "cancelling" || e === "cancelled" || e === "expired" || e === "discarded" ? "default" : "info";
31607
31694
  }
31608
31695
  //#endregion
31609
31696
  //#region src/page/ComparisonTable.tsx
31610
- var OP = {
31697
+ var AP = {
31611
31698
  better: "text-success",
31612
31699
  worse: "text-danger",
31613
31700
  same: "text-foreground-muted"
31614
31701
  };
31615
- function kP({ c: e }) {
31702
+ function jP({ c: e }) {
31616
31703
  if (e === null) return /* @__PURE__ */ V("td", {
31617
31704
  className: "px-2 py-1 text-foreground-subtle",
31618
31705
  children: "—"
@@ -31622,26 +31709,26 @@ function kP({ c: e }) {
31622
31709
  className: "px-2 py-1 text-foreground",
31623
31710
  children: [
31624
31711
  "P ",
31625
- SP(e.precision),
31712
+ wP(e.precision),
31626
31713
  " · R ",
31627
- SP(e.recall),
31714
+ wP(e.recall),
31628
31715
  " · AP50 ",
31629
- SP(e.ap50),
31716
+ wP(e.ap50),
31630
31717
  /* @__PURE__ */ H("span", {
31631
31718
  className: "block text-xs text-foreground-subtle",
31632
31719
  children: [
31633
31720
  "floor ",
31634
31721
  e.floor === null ? "—" : e.floor.toFixed(2),
31635
31722
  " · night R ",
31636
- SP(t),
31723
+ wP(t),
31637
31724
  n
31638
31725
  ]
31639
31726
  })
31640
31727
  ]
31641
31728
  });
31642
31729
  }
31643
- function AP({ result: e, cameraName: t }) {
31644
- let n = TP(e), r = EP(e), i = n.some((e) => e.int8 !== null);
31730
+ function MP({ result: e, cameraName: t }) {
31731
+ let n = DP(e), r = OP(e), i = n.some((e) => e.int8 !== null);
31645
31732
  return n.length === 0 ? /* @__PURE__ */ V("p", {
31646
31733
  className: "text-sm text-foreground-muted",
31647
31734
  children: "No held-out evaluation in this result."
@@ -31682,16 +31769,16 @@ function AP({ result: e, cameraName: t }) {
31682
31769
  ")"
31683
31770
  ]
31684
31771
  }),
31685
- /* @__PURE__ */ V(kP, { c: e.baseline }),
31686
- /* @__PURE__ */ V(kP, { c: e.candidate }),
31687
- i && /* @__PURE__ */ V(kP, { c: e.int8 })
31772
+ /* @__PURE__ */ V(jP, { c: e.baseline }),
31773
+ /* @__PURE__ */ V(jP, { c: e.candidate }),
31774
+ i && /* @__PURE__ */ V(jP, { c: e.int8 })
31688
31775
  ]
31689
31776
  }, e.cls)) })]
31690
31777
  }), r.length > 0 && /* @__PURE__ */ V("ul", {
31691
31778
  className: "flex flex-wrap gap-x-4 gap-y-1 text-xs",
31692
31779
  "aria-label": "Recall change per camera",
31693
31780
  children: r.map((e) => /* @__PURE__ */ H("li", {
31694
- className: OP[e.tone],
31781
+ className: AP[e.tone],
31695
31782
  children: [
31696
31783
  t(e.deviceId),
31697
31784
  " ",
@@ -31708,10 +31795,10 @@ function AP({ result: e, cameraName: t }) {
31708
31795
  //#endregion
31709
31796
  //#region src/page/use-async.ts
31710
31797
  i();
31711
- function jP(e) {
31798
+ function NP(e) {
31712
31799
  return e instanceof Error ? e.message : String(e);
31713
31800
  }
31714
- function MP(e, t, n = {}) {
31801
+ function PP(e, t, n = {}) {
31715
31802
  let [r, i] = a({ status: "pending" }), [o, c] = a(0), l = u(e);
31716
31803
  l.current = e;
31717
31804
  let d = s(() => c((e) => e + 1), []);
@@ -31725,7 +31812,7 @@ function MP(e, t, n = {}) {
31725
31812
  }).catch((t) => {
31726
31813
  e && i({
31727
31814
  status: "error",
31728
- error: jP(t)
31815
+ error: NP(t)
31729
31816
  });
31730
31817
  }), () => {
31731
31818
  e = !1;
@@ -31749,13 +31836,13 @@ function MP(e, t, n = {}) {
31749
31836
  //#endregion
31750
31837
  //#region src/page/ResultPanel.tsx
31751
31838
  i();
31752
- function NP({ job: e, trpc: t, onChanged: n, cameraName: r }) {
31753
- let i = Bl(), o = MP(() => t.training.getJobResult.query({ id: e.id }), [e.id, e.state]), s = MP(async () => (await t.deviceManager.listAll.query({ slim: !0 })).filter((e) => e.type === "camera"), []), [c, l] = a([]), [u, d] = a(!1), [f, p] = a(null), m = async (e) => {
31839
+ function FP({ job: e, trpc: t, onChanged: n, cameraName: r }) {
31840
+ let i = Bl(), o = PP(() => t.training.getJobResult.query({ id: e.id }), [e.id, e.state]), s = PP(async () => (await t.deviceManager.listAll.query({ slim: !0 })).filter((e) => e.type === "camera"), []), [c, l] = a([]), [u, d] = a(!1), [f, p] = a(null), m = async (e) => {
31754
31841
  d(!0), p(null);
31755
31842
  try {
31756
31843
  await e(), n();
31757
31844
  } catch (e) {
31758
- p(jP(e));
31845
+ p(NP(e));
31759
31846
  } finally {
31760
31847
  d(!1);
31761
31848
  }
@@ -31797,7 +31884,7 @@ function NP({ job: e, trpc: t, onChanged: n, cameraName: r }) {
31797
31884
  className: "space-y-3 border-t border-border pt-3",
31798
31885
  "data-testid": "result-panel",
31799
31886
  children: [
31800
- /* @__PURE__ */ V(AP, {
31887
+ /* @__PURE__ */ V(MP, {
31801
31888
  result: y,
31802
31889
  cameraName: r
31803
31890
  }),
@@ -31824,7 +31911,7 @@ function NP({ job: e, trpc: t, onChanged: n, cameraName: r }) {
31824
31911
  children: [
31825
31912
  b.length,
31826
31913
  " files, ",
31827
- xP(b.reduce((e, t) => e + t.bytes, 0)),
31914
+ CP(b.reduce((e, t) => e + t.bytes, 0)),
31828
31915
  " · ",
31829
31916
  y.licence
31830
31917
  ]
@@ -31932,12 +32019,12 @@ function NP({ job: e, trpc: t, onChanged: n, cameraName: r }) {
31932
32019
  }
31933
32020
  //#endregion
31934
32021
  //#region src/page/Sparkline.tsx
31935
- function PP(e, t, n) {
32022
+ function IP(e, t, n) {
31936
32023
  if (e.length === 0) return "";
31937
32024
  let r = Math.max(...e, 1e-4), i = e.length > 1 ? t / (e.length - 1) : 0;
31938
32025
  return e.map((e, t) => `${t === 0 ? "M" : "L"}${(t * i).toFixed(1)},${(n - e / r * n).toFixed(1)}`).join(" ");
31939
32026
  }
31940
- function FP({ series: e, width: t = 160, height: n = 32 }) {
32027
+ function LP({ series: e, width: t = 160, height: n = 32 }) {
31941
32028
  let r = e.map((e) => e.map50 ?? 0);
31942
32029
  if (r.length < 2) return /* @__PURE__ */ V("span", {
31943
32030
  className: "text-xs text-foreground-subtle",
@@ -31953,7 +32040,7 @@ function FP({ series: e, width: t = 160, height: n = 32 }) {
31953
32040
  viewBox: `0 0 ${String(t)} ${String(n)}`,
31954
32041
  "aria-label": "mAP50 per epoch",
31955
32042
  children: /* @__PURE__ */ V("path", {
31956
- d: PP(r, t, n),
32043
+ d: IP(r, t, n),
31957
32044
  fill: "none",
31958
32045
  stroke: "currentColor",
31959
32046
  strokeWidth: 1.5
@@ -31967,13 +32054,13 @@ function FP({ series: e, width: t = 160, height: n = 32 }) {
31967
32054
  //#endregion
31968
32055
  //#region src/page/JobCard.tsx
31969
32056
  i();
31970
- var IP = {
32057
+ var RP = {
31971
32058
  done: "bg-primary/15 text-primary",
31972
32059
  current: "bg-primary text-primary-foreground",
31973
32060
  failed: "bg-danger text-white",
31974
32061
  todo: "bg-surface-hover text-foreground-subtle"
31975
32062
  };
31976
- function LP({ lines: e }) {
32063
+ function zP({ lines: e }) {
31977
32064
  let t = u(null);
31978
32065
  return y(() => {
31979
32066
  t.current !== null && (t.current.scrollTop = t.current.scrollHeight);
@@ -31984,8 +32071,8 @@ function LP({ lines: e }) {
31984
32071
  children: e.join("\n")
31985
32072
  });
31986
32073
  }
31987
- function RP({ job: e, trpc: t, onChanged: n, cameraName: r, collectionName: i }) {
31988
- let o = Bl(), [s, c] = a(null), l = CP(e, Date.now()), { epoch: u, epochs: d, etaSec: f, series: p } = e.progress, m = e.state === "ready" || e.state === "registered" || e.state === "canary", h = e.request.selection.collectionIds.map((e) => i(e)), g = async () => {
32074
+ function BP({ job: e, trpc: t, onChanged: n, cameraName: r, collectionName: i }) {
32075
+ let o = Bl(), [s, c] = a(null), l = TP(e, Date.now()), { epoch: u, epochs: d, etaSec: f, series: p } = e.progress, m = e.state === "ready" || e.state === "registered" || e.state === "canary", h = e.request.selection.collectionIds.map((e) => i(e)), g = async () => {
31989
32076
  if (await o({
31990
32077
  title: "Cancel this job?",
31991
32078
  message: "The cloud job is stopped and its dataset deleted. What it spent so far is not refunded.",
@@ -31994,7 +32081,7 @@ function RP({ job: e, trpc: t, onChanged: n, cameraName: r, collectionName: i })
31994
32081
  })) try {
31995
32082
  await t.training.cancelJob.mutate({ id: e.id }), n();
31996
32083
  } catch (e) {
31997
- c(jP(e));
32084
+ c(NP(e));
31998
32085
  }
31999
32086
  };
32000
32087
  return /* @__PURE__ */ H(kd, {
@@ -32009,10 +32096,10 @@ function RP({ job: e, trpc: t, onChanged: n, cameraName: r, collectionName: i })
32009
32096
  children: e.name
32010
32097
  }),
32011
32098
  /* @__PURE__ */ V(al, {
32012
- variant: DP(e.state),
32013
- children: pP[e.state]
32099
+ variant: kP(e.state),
32100
+ children: hP[e.state]
32014
32101
  }),
32015
- e.stage !== null && !hP(e.state) && /* @__PURE__ */ V(al, {
32102
+ e.stage !== null && !_P(e.state) && /* @__PURE__ */ V(al, {
32016
32103
  variant: "info",
32017
32104
  children: e.stage
32018
32105
  }),
@@ -32027,7 +32114,7 @@ function RP({ job: e, trpc: t, onChanged: n, cameraName: r, collectionName: i })
32027
32114
  new Date(e.createdAt).toLocaleString()
32028
32115
  ]
32029
32116
  }),
32030
- !hP(e.state) && e.state !== "cancelling" && /* @__PURE__ */ V(X, {
32117
+ !_P(e.state) && e.state !== "cancelling" && /* @__PURE__ */ V(X, {
32031
32118
  variant: "outline",
32032
32119
  className: "ml-auto",
32033
32120
  onClick: () => void g(),
@@ -32047,10 +32134,10 @@ function RP({ job: e, trpc: t, onChanged: n, cameraName: r, collectionName: i })
32047
32134
  /* @__PURE__ */ V("ol", {
32048
32135
  className: "flex flex-wrap gap-1",
32049
32136
  "aria-label": "Job progress",
32050
- children: vP(e).map((t) => /* @__PURE__ */ V("li", {
32051
- className: `rounded-full px-2 py-0.5 text-xs ${IP[t.status]}`,
32137
+ children: bP(e).map((t) => /* @__PURE__ */ V("li", {
32138
+ className: `rounded-full px-2 py-0.5 text-xs ${RP[t.status]}`,
32052
32139
  "aria-current": t.status === "current" ? "step" : void 0,
32053
- children: t.status === "failed" ? `${t.label} — ${pP[e.state]}` : t.label
32140
+ children: t.status === "failed" ? `${t.label} — ${hP[e.state]}` : t.label
32054
32141
  }, t.state))
32055
32142
  }),
32056
32143
  e.failure !== null && /* @__PURE__ */ H("p", {
@@ -32082,17 +32169,17 @@ function RP({ job: e, trpc: t, onChanged: n, cameraName: r, collectionName: i })
32082
32169
  u,
32083
32170
  " / ",
32084
32171
  d,
32085
- f !== null && !hP(e.state) ? ` · about ${bP(f)} left` : ""
32172
+ f !== null && !_P(e.state) ? ` · about ${SP(f)} left` : ""
32086
32173
  ]
32087
32174
  })]
32088
32175
  }),
32089
- /* @__PURE__ */ V(FP, { series: p }),
32176
+ /* @__PURE__ */ V(LP, { series: p }),
32090
32177
  /* @__PURE__ */ H("p", {
32091
32178
  className: "text-xs text-foreground-muted",
32092
32179
  children: [
32093
- l !== null && `Ran ${bP(l)} · `,
32180
+ l !== null && `Ran ${SP(l)} · `,
32094
32181
  "Cost ",
32095
- yP(e.provider.costUsd, e.provider.costIsEstimate),
32182
+ xP(e.provider.costUsd, e.provider.costIsEstimate),
32096
32183
  " of $",
32097
32184
  e.maxCostUsd.toFixed(2),
32098
32185
  " cap",
@@ -32100,12 +32187,12 @@ function RP({ job: e, trpc: t, onChanged: n, cameraName: r, collectionName: i })
32100
32187
  e.artifacts !== null && ` · result kept on the hub until ${new Date(e.artifacts.expiresAt).toLocaleDateString()}`
32101
32188
  ]
32102
32189
  }),
32103
- /* @__PURE__ */ V(LP, { lines: e.logTail }),
32190
+ /* @__PURE__ */ V(zP, { lines: e.logTail }),
32104
32191
  s !== null && /* @__PURE__ */ V("p", {
32105
32192
  className: "text-sm text-danger",
32106
32193
  children: s
32107
32194
  }),
32108
- m && /* @__PURE__ */ V(NP, {
32195
+ m && /* @__PURE__ */ V(FP, {
32109
32196
  job: e,
32110
32197
  trpc: t,
32111
32198
  onChanged: n,
@@ -32116,7 +32203,7 @@ function RP({ job: e, trpc: t, onChanged: n, cameraName: r, collectionName: i })
32116
32203
  }
32117
32204
  //#endregion
32118
32205
  //#region src/page/cluster-root-model-rows.ts
32119
- function zP(e) {
32206
+ function VP(e) {
32120
32207
  for (let t of e.slots) for (let e of t.addons) if (e.id === "object-detection") return typeof e.defaultModelId != "string" || e.defaultModelId.length === 0 ? null : {
32121
32208
  defaultModelId: e.defaultModelId,
32122
32209
  ...e.defaultModelIdByFormat === void 0 ? {} : { defaultModelIdByFormat: e.defaultModelIdByFormat },
@@ -32129,10 +32216,10 @@ function zP(e) {
32129
32216
  };
32130
32217
  return null;
32131
32218
  }
32132
- function BP(e) {
32219
+ function HP(e) {
32133
32220
  let t = [];
32134
32221
  for (let n of e) {
32135
- let e = zP(n.schema);
32222
+ let e = VP(n.schema);
32136
32223
  e !== null && t.push({
32137
32224
  nodeId: n.nodeId,
32138
32225
  devices: n.devices,
@@ -32141,8 +32228,8 @@ function BP(e) {
32141
32228
  }
32142
32229
  return t;
32143
32230
  }
32144
- function VP(e, t) {
32145
- let n = Ag(BP(t)), r = jg(n);
32231
+ function UP(e, t) {
32232
+ let n = Ag(HP(t)), r = jg(n);
32146
32233
  return {
32147
32234
  models: e.map((e) => ({
32148
32235
  modelId: e.modelId,
@@ -32155,7 +32242,7 @@ function VP(e, t) {
32155
32242
  }
32156
32243
  //#endregion
32157
32244
  //#region src/page/PlanSummary.tsx
32158
- function HP({ plan: e, cameraName: t }) {
32245
+ function WP({ plan: e, cameraName: t }) {
32159
32246
  let { split: n, estimate: r } = e;
32160
32247
  return /* @__PURE__ */ H("div", {
32161
32248
  className: "space-y-2 text-sm",
@@ -32201,14 +32288,14 @@ function HP({ plan: e, cameraName: t }) {
32201
32288
  ] }),
32202
32289
  /* @__PURE__ */ H("span", { children: [
32203
32290
  "GPU time: ",
32204
- bP(r.gpuSecondsLow),
32291
+ SP(r.gpuSecondsLow),
32205
32292
  " –",
32206
32293
  " ",
32207
- bP(r.gpuSecondsHigh)
32294
+ SP(r.gpuSecondsHigh)
32208
32295
  ] }),
32209
32296
  /* @__PURE__ */ H("span", { children: [
32210
32297
  "Upload: about ",
32211
- xP(r.datasetBytes),
32298
+ CP(r.datasetBytes),
32212
32299
  ", ",
32213
32300
  r.uploadMinutesAt20Mbps,
32214
32301
  " min at 20 Mbit/s"
@@ -32228,16 +32315,16 @@ function HP({ plan: e, cameraName: t }) {
32228
32315
  }
32229
32316
  //#endregion
32230
32317
  //#region src/page/plan-form.ts
32231
- var UP = {
32318
+ var GP = {
32232
32319
  quick: "Quick — 15 epochs",
32233
32320
  standard: "Standard — 40 epochs",
32234
32321
  thorough: "Thorough — 80 epochs, nothing frozen"
32235
- }, WP = {
32322
+ }, KP = {
32236
32323
  complete: "Complete frames only",
32237
32324
  annotated_or_complete: "Annotated or complete",
32238
32325
  any_annotated: "Any annotated (incl. hard negatives)"
32239
32326
  };
32240
- function GP(e) {
32327
+ function qP(e) {
32241
32328
  let t = e.baseModelIds[0];
32242
32329
  if (e.collectionIds.length === 0 || e.entryId === "" || e.gpuType === "" || t === void 0) return null;
32243
32330
  let n = e.freeze.trim() === "" ? null : Number(e.freeze);
@@ -32255,7 +32342,7 @@ function GP(e) {
32255
32342
  holdoutCameras: e.holdoutCameras.length > 0 ? [...e.holdoutCameras] : null
32256
32343
  };
32257
32344
  }
32258
- function KP(e, t) {
32345
+ function JP(e, t) {
32259
32346
  return {
32260
32347
  ...e,
32261
32348
  entryId: t.entryId,
@@ -32263,7 +32350,7 @@ function KP(e, t) {
32263
32350
  region: t.defaults.region
32264
32351
  };
32265
32352
  }
32266
- var qP = {
32353
+ var YP = {
32267
32354
  collectionIds: [],
32268
32355
  workState: "complete",
32269
32356
  entryId: "",
@@ -32277,24 +32364,24 @@ var qP = {
32277
32364
  //#endregion
32278
32365
  //#region src/page/NewJobSection.tsx
32279
32366
  i();
32280
- function JP(e) {
32367
+ function XP(e) {
32281
32368
  if (typeof e != "object" || !e) return !1;
32282
32369
  let t = Reflect.get(e, "slots");
32283
32370
  return Array.isArray(t);
32284
32371
  }
32285
- function YP(e) {
32372
+ function ZP(e) {
32286
32373
  if (typeof e != "object" || !e) return [];
32287
32374
  let t = Reflect.get(e, "devices");
32288
32375
  return Array.isArray(t) ? t.flatMap((e) => {
32289
- let t = XP(e);
32376
+ let t = QP(e);
32290
32377
  return t === null ? [] : [t];
32291
32378
  }) : [];
32292
32379
  }
32293
- function XP(e) {
32380
+ function QP(e) {
32294
32381
  if (typeof e != "object" || !e) return null;
32295
32382
  let t = Reflect.get(e, "key"), n = Reflect.get(e, "backend"), r = Reflect.get(e, "device"), i = Reflect.get(e, "enabled"), a = Reflect.get(e, "format");
32296
32383
  if (typeof t != "string" || typeof n != "string" || typeof r != "string" || typeof i != "boolean" || typeof a != "string") return null;
32297
- let o = Reflect.get(e, "defaultModelId"), s = ZP(Reflect.get(e, "steps"));
32384
+ let o = Reflect.get(e, "defaultModelId"), s = $P(Reflect.get(e, "steps"));
32298
32385
  return {
32299
32386
  key: t,
32300
32387
  backend: n,
@@ -32305,7 +32392,7 @@ function XP(e) {
32305
32392
  ...s === void 0 ? {} : { steps: s }
32306
32393
  };
32307
32394
  }
32308
- function ZP(e) {
32395
+ function $P(e) {
32309
32396
  if (typeof e != "object" || !e) return;
32310
32397
  let t = {};
32311
32398
  for (let [n, r] of Object.entries(e)) {
@@ -32315,8 +32402,8 @@ function ZP(e) {
32315
32402
  }
32316
32403
  return t;
32317
32404
  }
32318
- function QP({ trpc: e, providers: t, baseModels: n, collections: r, cameraName: i, onStarted: o }) {
32319
- let s = Bl(), { nodes: c } = Da(), l = m(() => c.filter((e) => e.isOnline).map((e) => e.id), [c]), u = l.join("\0"), [d, f] = a(qP), [p, h] = a(""), [g, _] = a(""), [v, b] = a(""), [x, S] = a(null), [w, T] = a(!1), [E, D] = a(!1), O = MP(async () => {
32405
+ function eF({ trpc: e, providers: t, baseModels: n, collections: r, cameraName: i, onStarted: o }) {
32406
+ let s = Bl(), { nodes: c } = Da(), l = m(() => c.filter((e) => e.isOnline).map((e) => e.id), [c]), u = l.join("\0"), [d, f] = a(YP), [p, h] = a(""), [g, _] = a(""), [v, b] = a(""), [x, S] = a(null), [w, T] = a(!1), [E, D] = a(!1), O = PP(async () => {
32320
32407
  if (n.length === 0) return {
32321
32408
  models: [],
32322
32409
  clusterRootModelIds: []
@@ -32325,14 +32412,14 @@ function QP({ trpc: e, providers: t, baseModels: n, collections: r, cameraName:
32325
32412
  return await Promise.all(l.map(async (n) => {
32326
32413
  try {
32327
32414
  let [r, i] = await Promise.all([e.pipelineOrchestrator.getNodeInferenceDevices.query({ nodeId: n }), e.pipelineExecutor.getSchema.query({ nodeId: n })]);
32328
- if (!JP(i)) return;
32415
+ if (!XP(i)) return;
32329
32416
  t.push({
32330
32417
  nodeId: n,
32331
- devices: YP(r),
32418
+ devices: ZP(r),
32332
32419
  schema: i
32333
32420
  });
32334
32421
  } catch {}
32335
- })), VP(n, t);
32422
+ })), UP(n, t);
32336
32423
  }, [u, n.map((e) => e.modelId).join("\0")]), k = O.state.status === "ok" ? O.state.data.models : n.map((e) => ({
32337
32424
  modelId: e.modelId,
32338
32425
  label: e.label,
@@ -32345,7 +32432,7 @@ function QP({ trpc: e, providers: t, baseModels: n, collections: r, cameraName:
32345
32432
  ...e,
32346
32433
  holdoutCameras: []
32347
32434
  }, r = t.find((e) => e.configured) ?? t[0];
32348
- return n.entryId === "" && r !== void 0 && (n = KP(n, r)), n;
32435
+ return n.entryId === "" && r !== void 0 && (n = JP(n, r)), n;
32349
32436
  });
32350
32437
  }, [t]), y(() => {
32351
32438
  if (E || O.state.status !== "ok") return;
@@ -32359,7 +32446,7 @@ function QP({ trpc: e, providers: t, baseModels: n, collections: r, cameraName:
32359
32446
  k,
32360
32447
  E
32361
32448
  ]);
32362
- let j = GP(d), M = MP(async () => j === null ? null : e.training.planJob.query(j), [JSON.stringify(j)]), N = M.state.status === "ok" ? M.state.data : null;
32449
+ let j = qP(d), M = PP(async () => j === null ? null : e.training.planJob.query(j), [JSON.stringify(j)]), N = M.state.status === "ok" ? M.state.data : null;
32363
32450
  y(() => {
32364
32451
  N?.defaults != null && (_(N.defaults.maxCostUsd.toFixed(2)), b((N.defaults.maxRuntimeSec / 3600).toFixed(1)));
32365
32452
  }, [N?.defaults?.maxCostUsd, N?.defaults?.maxRuntimeSec]);
@@ -32390,7 +32477,7 @@ function QP({ trpc: e, providers: t, baseModels: n, collections: r, cameraName:
32390
32477
  });
32391
32478
  t.kind === "refused" ? S(`Refused (${t.reason}): ${t.detail}`) : o();
32392
32479
  } catch (e) {
32393
- S(jP(e));
32480
+ S(NP(e));
32394
32481
  } finally {
32395
32482
  T(!1);
32396
32483
  }
@@ -32417,7 +32504,7 @@ function QP({ trpc: e, providers: t, baseModels: n, collections: r, cameraName:
32417
32504
  value: d.entryId,
32418
32505
  onChange: (e) => {
32419
32506
  let n = t.find((t) => t.entryId === e.target.value);
32420
- n !== void 0 && f((e) => KP(e, n));
32507
+ n !== void 0 && f((e) => JP(e, n));
32421
32508
  },
32422
32509
  options: t.map((e) => ({
32423
32510
  value: e.entryId,
@@ -32461,9 +32548,9 @@ function QP({ trpc: e, providers: t, baseModels: n, collections: r, cameraName:
32461
32548
  let t = e.target.value;
32462
32549
  (t === "complete" || t === "annotated_or_complete" || t === "any_annotated") && I({ workState: t });
32463
32550
  },
32464
- options: Object.keys(WP).map((e) => ({
32551
+ options: Object.keys(KP).map((e) => ({
32465
32552
  value: e,
32466
- label: WP[e]
32553
+ label: KP[e]
32467
32554
  }))
32468
32555
  })]
32469
32556
  }),
@@ -32488,7 +32575,7 @@ function QP({ trpc: e, providers: t, baseModels: n, collections: r, cameraName:
32488
32575
  children: [/* @__PURE__ */ V("span", { children: "Preset" }), /* @__PURE__ */ V(Qu, {
32489
32576
  value: d.preset,
32490
32577
  onChange: (e) => I({ preset: e.target.value === "quick" ? "quick" : e.target.value === "thorough" ? "thorough" : "standard" }),
32491
- options: Object.entries(UP).map(([e, t]) => ({
32578
+ options: Object.entries(GP).map(([e, t]) => ({
32492
32579
  value: e,
32493
32580
  label: t
32494
32581
  }))
@@ -32543,7 +32630,7 @@ function QP({ trpc: e, providers: t, baseModels: n, collections: r, cameraName:
32543
32630
  className: "text-sm text-danger",
32544
32631
  children: ["Could not plan: ", M.state.error]
32545
32632
  }),
32546
- N !== null && /* @__PURE__ */ V(HP, {
32633
+ N !== null && /* @__PURE__ */ V(WP, {
32547
32634
  plan: N,
32548
32635
  cameraName: i
32549
32636
  }),
@@ -32593,7 +32680,7 @@ function QP({ trpc: e, providers: t, baseModels: n, collections: r, cameraName:
32593
32680
  }
32594
32681
  //#endregion
32595
32682
  //#region src/page/SectionState.tsx
32596
- function $P({ state: e, empty: t, emptyAction: n, children: r }) {
32683
+ function tF({ state: e, empty: t, emptyAction: n, children: r }) {
32597
32684
  return e.status === "pending" ? /* @__PURE__ */ V($u, { className: "h-16 w-full" }) : e.status === "error" ? /* @__PURE__ */ H("p", {
32598
32685
  className: "text-sm text-danger",
32599
32686
  children: ["Could not load: ", e.error]
@@ -32609,17 +32696,17 @@ function $P({ state: e, empty: t, emptyAction: n, children: r }) {
32609
32696
  //#endregion
32610
32697
  //#region src/page/JobsSection.tsx
32611
32698
  i();
32612
- var eF = "all";
32613
- function tF(e) {
32699
+ var nF = "all";
32700
+ function rF(e) {
32614
32701
  let t = new Map((e ?? []).map((e) => [e.id, e.name]));
32615
32702
  return (e) => t.get(e) ?? e;
32616
32703
  }
32617
- function nF({ trpc: e, providers: t, baseModels: n, collections: r, jobs: i, onJobsReload: o, cameraName: s, depsPending: c, depsError: l }) {
32618
- let [u, d] = a(eF), f = m(() => tF(r), [r]), p = m(() => {
32704
+ function iF({ trpc: e, providers: t, baseModels: n, collections: r, jobs: i, onJobsReload: o, cameraName: s, depsPending: c, depsError: l }) {
32705
+ let [u, d] = a(nF), f = m(() => rF(r), [r]), p = m(() => {
32619
32706
  if (i.status !== "ok") return [];
32620
32707
  let e = new Set(i.data.map((e) => e.state));
32621
- return Object.keys(pP).filter((t) => e.has(t));
32622
- }, [i]), h = m(() => i.status === "ok" ? u === eF ? i.data : i.data.filter((e) => e.state === u) : [], [i, u]);
32708
+ return Object.keys(hP).filter((t) => e.has(t));
32709
+ }, [i]), h = m(() => i.status === "ok" ? u === nF ? i.data : i.data.filter((e) => e.state === u) : [], [i, u]);
32623
32710
  return /* @__PURE__ */ H("div", {
32624
32711
  className: "space-y-4",
32625
32712
  children: [c ? /* @__PURE__ */ V(xg, {
@@ -32642,7 +32729,7 @@ function nF({ trpc: e, providers: t, baseModels: n, collections: r, jobs: i, onJ
32642
32729
  message: l ?? "Providers, base models, or collections are unavailable."
32643
32730
  })
32644
32731
  })
32645
- }) : /* @__PURE__ */ V(QP, {
32732
+ }) : /* @__PURE__ */ V(eF, {
32646
32733
  trpc: e,
32647
32734
  providers: t,
32648
32735
  baseModels: n,
@@ -32661,9 +32748,9 @@ function nF({ trpc: e, providers: t, baseModels: n, collections: r, jobs: i, onJ
32661
32748
  className: "flex min-w-0 flex-wrap items-center gap-1.5",
32662
32749
  children: [/* @__PURE__ */ V("button", {
32663
32750
  type: "button",
32664
- "aria-pressed": u === eF,
32665
- className: J(M, u === eF ? te : ee),
32666
- onClick: () => d(eF),
32751
+ "aria-pressed": u === nF,
32752
+ className: J(M, u === nF ? te : ee),
32753
+ onClick: () => d(nF),
32667
32754
  children: "All"
32668
32755
  }), p.map((e) => /* @__PURE__ */ V("button", {
32669
32756
  type: "button",
@@ -32671,10 +32758,10 @@ function nF({ trpc: e, providers: t, baseModels: n, collections: r, jobs: i, onJ
32671
32758
  "data-testid": `jobs-filter-${e}`,
32672
32759
  className: J(M, u === e ? te : ee),
32673
32760
  onClick: () => d(e),
32674
- children: pP[e]
32761
+ children: hP[e]
32675
32762
  }, e))]
32676
32763
  })
32677
- }) : null, /* @__PURE__ */ V($P, {
32764
+ }) : null, /* @__PURE__ */ V(tF, {
32678
32765
  state: i,
32679
32766
  empty: "No training job yet.",
32680
32767
  children: () => h.length === 0 ? /* @__PURE__ */ V("p", {
@@ -32682,7 +32769,7 @@ function nF({ trpc: e, providers: t, baseModels: n, collections: r, jobs: i, onJ
32682
32769
  children: "No jobs match this state filter."
32683
32770
  }) : /* @__PURE__ */ V("div", {
32684
32771
  className: "space-y-3",
32685
- children: h.map((t) => /* @__PURE__ */ V(RP, {
32772
+ children: h.map((t) => /* @__PURE__ */ V(BP, {
32686
32773
  job: t,
32687
32774
  trpc: e,
32688
32775
  onChanged: o,
@@ -32697,36 +32784,36 @@ function nF({ trpc: e, providers: t, baseModels: n, collections: r, jobs: i, onJ
32697
32784
  }
32698
32785
  //#endregion
32699
32786
  //#region src/page/provider-icon-url.ts
32700
- function rF(e, t) {
32787
+ function aF(e, t) {
32701
32788
  let n = t.trim();
32702
32789
  return n.length === 0 || n.includes("..") ? null : I(`/api/addon-assets/${encodeURIComponent(e)}/${n}`);
32703
32790
  }
32704
32791
  //#endregion
32705
32792
  //#region src/page/ProviderSection.tsx
32706
32793
  i();
32707
- function iF(e) {
32794
+ function oF(e) {
32708
32795
  return e ? "ok" : "warning";
32709
32796
  }
32710
- function aF(e) {
32797
+ function sF(e) {
32711
32798
  return e.map((e) => `${e.typeId}\0${e.label}\0${e.addonId}\0${e.iconAsset}`).join("\n");
32712
32799
  }
32713
- function oF(e) {
32800
+ function cF(e) {
32714
32801
  return e.map((e) => ({
32715
32802
  typeId: e.typeId,
32716
32803
  label: e.label,
32717
- iconUrl: rF(e.addonId, e.iconAsset)
32804
+ iconUrl: aF(e.addonId, e.iconAsset)
32718
32805
  }));
32719
32806
  }
32720
- function sF(e) {
32807
+ function lF(e) {
32721
32808
  return e.map((e) => ({
32722
32809
  entryId: e.entryId,
32723
32810
  name: e.name,
32724
32811
  typeId: e.typeId,
32725
- iconUrl: rF(e.addonId, e.iconAsset),
32726
- status: iF(e.configured)
32812
+ iconUrl: aF(e.addonId, e.iconAsset),
32813
+ status: oF(e.configured)
32727
32814
  }));
32728
32815
  }
32729
- function cF({ state: e }) {
32816
+ function uF({ state: e }) {
32730
32817
  if (e.kind === "idle") return null;
32731
32818
  if (e.kind === "running") return /* @__PURE__ */ V("span", {
32732
32819
  className: "text-xs text-foreground-subtle",
@@ -32745,15 +32832,15 @@ function cF({ state: e }) {
32745
32832
  children: [t.reason ?? "refused", t.detail === void 0 ? "" : `: ${t.detail}`]
32746
32833
  });
32747
32834
  }
32748
- function lF({ entry: e, trpc: t }) {
32749
- let [n, r] = a({ kind: "idle" });
32835
+ function dF({ entry: e, trpc: t, onEdit: n }) {
32836
+ let [r, i] = a({ kind: "idle" });
32750
32837
  y(() => {
32751
- r({ kind: "idle" });
32838
+ i({ kind: "idle" });
32752
32839
  }, [e.entryId]);
32753
- let i = async () => {
32754
- r({ kind: "running" });
32840
+ let o = async () => {
32841
+ i({ kind: "running" });
32755
32842
  try {
32756
- r({
32843
+ i({
32757
32844
  kind: "done",
32758
32845
  check: await t.trainingProvider.validateCredentials.mutate({
32759
32846
  entryId: e.entryId,
@@ -32761,14 +32848,14 @@ function lF({ entry: e, trpc: t }) {
32761
32848
  })
32762
32849
  });
32763
32850
  } catch (e) {
32764
- r({
32851
+ i({
32765
32852
  kind: "error",
32766
- message: jP(e)
32853
+ message: NP(e)
32767
32854
  });
32768
32855
  }
32769
- }, o = e.defaults;
32856
+ };
32770
32857
  return /* @__PURE__ */ H("div", {
32771
- className: "space-y-4",
32858
+ className: "space-y-3",
32772
32859
  "data-testid": `provider-entry-body-${e.entryId}`,
32773
32860
  children: [
32774
32861
  /* @__PURE__ */ H("div", {
@@ -32789,122 +32876,136 @@ function lF({ entry: e, trpc: t }) {
32789
32876
  /* @__PURE__ */ V(X, {
32790
32877
  variant: "secondary",
32791
32878
  className: "ml-auto",
32792
- disabled: !e.configured || n.kind === "running",
32793
- onClick: () => void i(),
32794
- children: "Test"
32795
- })
32796
- ]
32797
- }),
32798
- /* @__PURE__ */ V(cF, { state: n }),
32799
- /* @__PURE__ */ H("section", {
32800
- className: "space-y-2",
32801
- "aria-labelledby": "provider-about-heading",
32802
- children: [
32803
- /* @__PURE__ */ V("h3", {
32804
- id: "provider-about-heading",
32805
- className: "text-sm font-medium text-foreground",
32806
- children: "About"
32807
- }),
32808
- /* @__PURE__ */ V("p", {
32809
- className: "text-sm text-foreground-muted",
32810
- children: e.dataResidencyNote
32811
- }),
32812
- e.freeTierNote === void 0 ? null : /* @__PURE__ */ V("p", {
32813
- className: "text-xs text-foreground-muted",
32814
- children: e.freeTierNote
32879
+ onClick: n,
32880
+ children: "Edit"
32815
32881
  }),
32816
- /* @__PURE__ */ H("p", {
32817
- className: "text-xs text-foreground-muted",
32818
- children: [
32819
- "Defaults: ",
32820
- o.gpuType,
32821
- ", region ",
32822
- o.region === "" ? "any" : o.region,
32823
- ", cost cap $",
32824
- o.costCapUsd.toFixed(2),
32825
- ", runtime ≤",
32826
- " ",
32827
- (o.maxRuntimeSec / 3600).toFixed(1),
32828
- " h, a failed job's dataset kept",
32829
- " ",
32830
- o.failedDatasetGraceHours,
32831
- " h."
32832
- ]
32882
+ /* @__PURE__ */ V(X, {
32883
+ variant: "secondary",
32884
+ disabled: !e.configured || r.kind === "running",
32885
+ onClick: () => void o(),
32886
+ children: "Test"
32833
32887
  })
32834
32888
  ]
32835
32889
  }),
32836
- /* @__PURE__ */ H("section", {
32837
- className: "space-y-2",
32838
- "aria-labelledby": "provider-settings-heading",
32839
- children: [
32840
- /* @__PURE__ */ V("h3", {
32841
- id: "provider-settings-heading",
32842
- className: "text-sm font-medium text-foreground",
32843
- children: "Settings"
32844
- }),
32845
- /* @__PURE__ */ V("p", {
32846
- className: "text-xs text-foreground-subtle",
32847
- children: "Credentials and per-entry defaults for this provider. Secrets stay in the keychain."
32848
- }),
32849
- /* @__PURE__ */ V(Wh, {
32850
- trpc: t,
32851
- addonId: e.addonId,
32852
- nodeId: "hub"
32853
- })
32854
- ]
32890
+ /* @__PURE__ */ V(uF, { state: r }),
32891
+ /* @__PURE__ */ V("p", {
32892
+ className: "text-xs text-foreground-subtle",
32893
+ children: "Credentials and defaults open in the editor — editing never remounts this strip."
32855
32894
  })
32856
32895
  ]
32857
32896
  });
32858
32897
  }
32859
- function uF({ trpc: e, navigate: t }) {
32860
- let n = Xu("training-provider"), [r, i] = Wj("entry"), [o, c] = a(!1), [l, d] = a(!1), [f, p] = a(null), h = MP(() => e.trainingProvider.describe.query({}), []), g = MP(() => e.trainingProvider.describeTypes.query({}), []), _ = g.state.status === "ok" ? g.state.data : null, v = _ === null ? "" : aF(_), b = u(_);
32861
- b.current = _;
32862
- let x = m(() => {
32863
- let e = b.current;
32864
- return e === null ? [] : oF(e);
32865
- }, [v]), S = m(() => {
32866
- let e = /* @__PURE__ */ new Map(), t = b.current;
32898
+ function fF({ entry: e, trpc: t }) {
32899
+ let n = e.defaults;
32900
+ return /* @__PURE__ */ H("div", {
32901
+ className: "space-y-4",
32902
+ children: [/* @__PURE__ */ H("section", {
32903
+ className: "space-y-2",
32904
+ "aria-labelledby": "provider-about-heading",
32905
+ children: [
32906
+ /* @__PURE__ */ V("h3", {
32907
+ id: "provider-about-heading",
32908
+ className: "text-sm font-medium text-foreground",
32909
+ children: "About"
32910
+ }),
32911
+ /* @__PURE__ */ V("p", {
32912
+ className: "text-sm text-foreground-muted",
32913
+ children: e.dataResidencyNote
32914
+ }),
32915
+ e.freeTierNote === void 0 ? null : /* @__PURE__ */ V("p", {
32916
+ className: "text-xs text-foreground-muted",
32917
+ children: e.freeTierNote
32918
+ }),
32919
+ /* @__PURE__ */ H("p", {
32920
+ className: "text-xs text-foreground-muted",
32921
+ children: [
32922
+ "Defaults: ",
32923
+ n.gpuType,
32924
+ ", region ",
32925
+ n.region === "" ? "any" : n.region,
32926
+ ", cost cap $",
32927
+ n.costCapUsd.toFixed(2),
32928
+ ", runtime ≤",
32929
+ " ",
32930
+ (n.maxRuntimeSec / 3600).toFixed(1),
32931
+ " h, a failed job's dataset kept",
32932
+ " ",
32933
+ n.failedDatasetGraceHours,
32934
+ " h."
32935
+ ]
32936
+ })
32937
+ ]
32938
+ }), /* @__PURE__ */ H("section", {
32939
+ className: "space-y-2",
32940
+ "aria-labelledby": "provider-settings-heading",
32941
+ children: [
32942
+ /* @__PURE__ */ V("h3", {
32943
+ id: "provider-settings-heading",
32944
+ className: "text-sm font-medium text-foreground",
32945
+ children: "Settings"
32946
+ }),
32947
+ /* @__PURE__ */ V("p", {
32948
+ className: "text-xs text-foreground-subtle",
32949
+ children: "Credentials and per-entry defaults for this provider (including plan / tier notes when the provider exposes them). Secrets stay in the keychain."
32950
+ }),
32951
+ /* @__PURE__ */ V(Wh, {
32952
+ trpc: t,
32953
+ addonId: e.addonId,
32954
+ nodeId: "hub"
32955
+ })
32956
+ ]
32957
+ })]
32958
+ });
32959
+ }
32960
+ function pF({ trpc: e, navigate: t }) {
32961
+ let n = Xu("training-provider"), [r, i] = eA("entry"), o = tA({ editKey: "editEntry" }), [c, l] = a(!1), [d, f] = a(!1), [p, h] = a(null), g = PP(() => e.trainingProvider.describe.query({}), []), _ = PP(() => e.trainingProvider.describeTypes.query({}), []), v = _.state.status === "ok" ? _.state.data : null, b = v === null ? "" : sF(v), x = u(v);
32962
+ x.current = v;
32963
+ let S = m(() => {
32964
+ let e = x.current;
32965
+ return e === null ? [] : cF(e);
32966
+ }, [b]), w = m(() => {
32967
+ let e = /* @__PURE__ */ new Map(), t = x.current;
32867
32968
  if (t !== null) for (let n of t) e.set(n.typeId, n);
32868
32969
  return e;
32869
- }, [v]), w = m(() => h.state.status === "ok" ? sF(h.state.data) : [], [h.state]), T = m(() => {
32870
- if (h.state.status !== "ok") return null;
32871
- let e = h.state.data;
32970
+ }, [b]), T = m(() => g.state.status === "ok" ? lF(g.state.data) : [], [g.state]), E = m(() => {
32971
+ if (g.state.status !== "ok") return null;
32972
+ let e = g.state.data;
32872
32973
  return e.length === 0 ? null : r !== null && e.some((e) => e.entryId === r) ? r : e[0]?.entryId ?? null;
32873
- }, [h.state, r]);
32974
+ }, [g.state, r]);
32874
32975
  y(() => {
32875
- T !== null && r !== T && i(T);
32976
+ E !== null && r !== E && i(E);
32876
32977
  }, [
32877
- T,
32978
+ E,
32878
32979
  r,
32879
32980
  i
32880
32981
  ]);
32881
- let E = h.state.status === "ok" ? h.state.data.find((e) => e.entryId === T) ?? null : null, D = s((e) => {
32982
+ let D = g.state.status === "ok" ? g.state.data.find((e) => e.entryId === E) ?? null : null, O = s((e) => {
32882
32983
  i(e);
32883
- }, [i]), O = s(async (t) => {
32884
- let n = S.get(t.typeId);
32984
+ }, [i]), k = s(async (t) => {
32985
+ let n = w.get(t.typeId);
32885
32986
  if (n === void 0) {
32886
- p("That provider type is no longer available.");
32987
+ h("That provider type is no longer available.");
32887
32988
  return;
32888
32989
  }
32889
- d(!0), p(null);
32990
+ f(!0), h(null);
32890
32991
  try {
32891
32992
  let r = await e.trainingProvider.createEntry.mutate({
32892
32993
  typeId: t.typeId,
32893
32994
  name: t.name,
32894
32995
  addonId: n.addonId
32895
32996
  });
32896
- c(!1), i(r.entryId), h.reload(), g.reload();
32997
+ l(!1), i(r.entryId), g.reload(), _.reload();
32897
32998
  } catch (e) {
32898
- p(jP(e));
32999
+ h(NP(e));
32899
33000
  } finally {
32900
- d(!1);
33001
+ f(!1);
32901
33002
  }
32902
33003
  }, [
32903
- h,
33004
+ g,
32904
33005
  i,
32905
33006
  e,
32906
- S,
32907
- g
33007
+ w,
33008
+ _
32908
33009
  ]);
32909
33010
  if (n === "pending") return /* @__PURE__ */ V(xg, {
32910
33011
  headingId: "training-providers-heading",
@@ -32941,59 +33042,72 @@ function uF({ trpc: e, navigate: t }) {
32941
33042
  })
32942
33043
  })
32943
33044
  });
32944
- let k = g.state.status === "ok", A = g.state.status === "error", j = h.state.status === "pending", M = h.state.status === "error";
33045
+ let A = _.state.status === "ok", j = _.state.status === "error", M = g.state.status === "pending", N = g.state.status === "error";
32945
33046
  return /* @__PURE__ */ V(xg, {
32946
33047
  headingId: "training-providers-heading",
32947
33048
  title: "Providers",
32948
33049
  children: /* @__PURE__ */ H("div", {
32949
33050
  className: `${C} space-y-4`,
32950
33051
  children: [
32951
- j ? /* @__PURE__ */ V($u, { className: "h-10 w-full" }) : null,
32952
- M ? /* @__PURE__ */ H("p", {
33052
+ M ? /* @__PURE__ */ V($u, { className: "h-10 w-full" }) : null,
33053
+ N ? /* @__PURE__ */ H("p", {
32953
33054
  className: "text-sm text-danger",
32954
- children: ["Could not load entries: ", h.state.error]
33055
+ children: ["Could not load entries: ", g.state.error]
32955
33056
  }) : null,
32956
- !j && !M ? /* @__PURE__ */ H(U, { children: [
32957
- /* @__PURE__ */ V(iA, {
33057
+ !M && !N ? /* @__PURE__ */ H(U, { children: [
33058
+ /* @__PURE__ */ V(lA, {
32958
33059
  label: "Training providers",
32959
- entries: w,
32960
- selectedEntryId: T,
32961
- onSelect: D,
32962
- onAdd: k ? () => {
32963
- p(null), c(!0);
33060
+ entries: T,
33061
+ selectedEntryId: E,
33062
+ onSelect: O,
33063
+ onAdd: A ? () => {
33064
+ h(null), l(!0);
32964
33065
  } : void 0,
32965
33066
  addLabel: "Add provider"
32966
33067
  }),
32967
- !k && !A ? /* @__PURE__ */ V("p", {
33068
+ !A && !j ? /* @__PURE__ */ V("p", {
32968
33069
  className: "text-xs text-foreground-subtle",
32969
33070
  children: "Loading provider types…"
32970
33071
  }) : null,
32971
- A ? /* @__PURE__ */ H("p", {
33072
+ j ? /* @__PURE__ */ H("p", {
32972
33073
  className: "text-sm text-danger",
32973
- children: ["Could not load types: ", g.state.error]
33074
+ children: ["Could not load types: ", _.state.error]
32974
33075
  }) : null,
32975
- w.length === 0 ? /* @__PURE__ */ V("p", {
33076
+ T.length === 0 ? /* @__PURE__ */ V("p", {
32976
33077
  className: "text-sm text-foreground-muted",
32977
33078
  children: "No provider entries yet. Add one to store credentials and run cloud jobs."
32978
33079
  }) : null
32979
33080
  ] }) : null,
32980
- E === null ? null : /* @__PURE__ */ V(lF, {
32981
- entry: E,
32982
- trpc: e
33081
+ D === null ? null : /* @__PURE__ */ V(dF, {
33082
+ entry: D,
33083
+ trpc: e,
33084
+ onEdit: () => o.openEdit(D.entryId)
32983
33085
  }),
32984
- f === null ? null : /* @__PURE__ */ V("p", {
33086
+ D === null ? null : /* @__PURE__ */ V(Zk, {
33087
+ open: o.state.mode === "edit" && o.state.id === D.entryId,
33088
+ onClose: () => o.close(),
33089
+ title: `Edit ${D.name}`,
33090
+ icon: fn,
33091
+ width: "xl",
33092
+ testId: "provider-entry-editor",
33093
+ children: /* @__PURE__ */ V(fF, {
33094
+ entry: D,
33095
+ trpc: e
33096
+ })
33097
+ }),
33098
+ p === null ? null : /* @__PURE__ */ V("p", {
32985
33099
  className: "text-sm text-danger",
32986
33100
  role: "alert",
32987
- children: f
33101
+ children: p
32988
33102
  }),
32989
- k ? /* @__PURE__ */ V(Zk, {
32990
- open: o,
32991
- onOpenChange: c,
32992
- types: x,
32993
- onCreate: O,
32994
- submitting: l,
33103
+ A ? /* @__PURE__ */ V(nA, {
33104
+ open: c,
33105
+ onOpenChange: l,
33106
+ types: S,
33107
+ onCreate: k,
33108
+ submitting: d,
32995
33109
  title: "Add provider entry",
32996
- description: "Pick a provider type and name this credential set."
33110
+ description: "Pick a provider type and name this credential set. Add creates an entry here; installing a new provider addon is via Addons → training-provider."
32997
33111
  }) : null
32998
33112
  ]
32999
33113
  })
@@ -33001,35 +33115,32 @@ function uF({ trpc: e, navigate: t }) {
33001
33115
  }
33002
33116
  //#endregion
33003
33117
  //#region src/page/training-tab.ts
33004
- function dF(e) {
33118
+ function mF(e) {
33005
33119
  let t = new URLSearchParams(e.startsWith("?") ? e.slice(1) : e).get("tab");
33006
33120
  return t === "jobs" || t === "providers" || t === "frames" ? t : "frames";
33007
33121
  }
33008
33122
  //#endregion
33009
33123
  //#region src/page.tsx
33010
33124
  i();
33011
- var fF = 5e3;
33012
- function pF(e) {
33125
+ var hF = 5e3;
33126
+ function gF(e) {
33013
33127
  let t = new URL(window.location.href);
33014
33128
  t.searchParams.set("tab", e), window.history.replaceState({}, "", t.toString());
33015
33129
  }
33016
- function mF({ trpc: e, navigate: t }) {
33017
- let [n, r] = a(() => typeof window > "u" ? "frames" : dF(window.location.search)), i = s((e) => {
33018
- r(e), pF(e);
33019
- }, []), o = MP(() => e.trainingProvider.describe.query({}), []), c = MP(() => e.training.listBaseModels.query({}), []), l = MP(() => e.pipelineAnalytics.listRetrainCollections.query({}), []), u = MP(() => e.deviceManager.listAll.query({ projection: "slim" }), []), d = MP(() => e.training.listJobs.query({}), [], {
33020
- pollMs: fF,
33021
- poll: gP
33130
+ function _F({ trpc: e, navigate: t }) {
33131
+ let [n, r] = a(() => typeof window > "u" ? "frames" : mF(window.location.search)), i = s((e) => {
33132
+ r(e), gF(e);
33133
+ }, []), o = PP(() => e.trainingProvider.describe.query({}), []), c = PP(() => e.training.listBaseModels.query({}), []), l = PP(() => e.pipelineAnalytics.listRetrainCollections.query({}), []), u = PP(() => e.deviceManager.listAll.query({ projection: "slim" }), []), d = PP(() => e.training.listJobs.query({}), [], {
33134
+ pollMs: hF,
33135
+ poll: vP
33022
33136
  }), f = m(() => new Map(u.state.status === "ok" ? u.state.data.map((e) => [e.id, e.name]) : []), [u.state]), p = s((e) => f.get(e) ?? `#${String(e)}`, [f]), h = o.state.status === "pending" || c.state.status === "pending" || l.state.status === "pending", g = (() => {
33023
33137
  let e = [];
33024
33138
  return o.state.status === "error" && e.push(`providers: ${o.state.error}`), c.state.status === "error" && e.push(`base models: ${c.state.error}`), l.state.status === "error" && e.push(`collections: ${l.state.error}`), e.length > 0 ? e.join("; ") : null;
33025
33139
  })();
33026
- return /* @__PURE__ */ H("div", {
33027
- className: "space-y-4 p-2 sm:p-4",
33140
+ return /* @__PURE__ */ H(Xk, {
33141
+ title: "Training",
33142
+ subtitle: "Annotate the retrain corpus, run cloud fine-tunes on your GPU account, and configure providers.",
33028
33143
  children: [
33029
- /* @__PURE__ */ V(Xk, {
33030
- title: "Training",
33031
- subtitle: "Annotate the retrain corpus, run cloud fine-tunes on your GPU account, and configure providers."
33032
- }),
33033
33144
  /* @__PURE__ */ V(_g, {
33034
33145
  value: n,
33035
33146
  onValueChange: (e) => {
@@ -33050,12 +33161,12 @@ function mF({ trpc: e, navigate: t }) {
33050
33161
  })
33051
33162
  ] })
33052
33163
  }),
33053
- n === "frames" ? /* @__PURE__ */ V(dP, {}) : null,
33054
- n === "providers" ? /* @__PURE__ */ V(uF, {
33164
+ n === "frames" ? /* @__PURE__ */ V(pP, {}) : null,
33165
+ n === "providers" ? /* @__PURE__ */ V(pF, {
33055
33166
  trpc: e,
33056
33167
  navigate: t
33057
33168
  }) : null,
33058
- n === "jobs" ? /* @__PURE__ */ V(nF, {
33169
+ n === "jobs" ? /* @__PURE__ */ V(iF, {
33059
33170
  trpc: e,
33060
33171
  providers: o.state.status === "ok" ? o.state.data : null,
33061
33172
  baseModels: c.state.status === "ok" ? c.state.data : null,
@@ -33070,4 +33181,4 @@ function mF({ trpc: e, navigate: t }) {
33070
33181
  });
33071
33182
  }
33072
33183
  //#endregion
33073
- export { fF as JOB_POLL_MS, mF as default, dF as readTrainingTab };
33184
+ export { hF as JOB_POLL_MS, _F as default, mF as readTrainingTab };