@omniviewdev/runtime 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/api.cjs +1 -1
  2. package/dist/api.js +16 -16
  3. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/apperror/index.d.ts +1 -0
  4. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/apperror/models.d.ts +58 -0
  5. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/index.d.ts +1 -1
  6. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/models.d.ts +25 -0
  7. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/servicewrapper.d.ts +2 -0
  8. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/settings/servicewrapper.d.ts +1 -0
  9. package/dist/bindings/github.com/omniviewdev/omniview/internal/settings/servicewrapper.d.ts +4 -0
  10. package/dist/bindings/github.com/omniviewdev/plugin-sdk/settings/index.d.ts +1 -1
  11. package/dist/bindings/github.com/omniviewdev/plugin-sdk/settings/models.d.ts +14 -0
  12. package/dist/{calls-BmUnjINC.js → calls-C1yoW06C.js} +60 -60
  13. package/dist/{calls-DZctVyoQ.cjs → calls-DUhq86Ki.cjs} +1 -1
  14. package/dist/context/operations/OperationsContext.d.ts +1 -1
  15. package/dist/errors/parseAppError.d.ts +1 -14
  16. package/dist/errors/types.d.ts +13 -2
  17. package/dist/{events-DDTGFACO.js → events-Bcx6NsMp.js} +1 -2
  18. package/dist/{events-BTiuwc-0.cjs → events-CtgYnKmS.cjs} +1 -1
  19. package/dist/graphservice-1J8q3eeL.cjs +1 -0
  20. package/dist/graphservice-CUg1PUsC.js +852 -0
  21. package/dist/hooks/resource/useEventBatcher.d.ts +4 -3
  22. package/dist/hooks/resource/useStreamAction.d.ts +3 -6
  23. package/dist/hooks/snackbar/useSnackbar.d.ts +2 -0
  24. package/dist/index.cjs +4 -2
  25. package/dist/index.js +1075 -1002
  26. package/dist/{models-D-vu7j83.js → models-4EtitZnM.js} +379 -361
  27. package/dist/models-BQsuB2Lj.cjs +1 -0
  28. package/dist/{models-8-4Ny_ft.cjs → models-BpVWHqlF.cjs} +1 -1
  29. package/dist/{models-BlTzZkmp.js → models-C5sf8GNY.js} +1 -1
  30. package/dist/models.cjs +1 -1
  31. package/dist/models.js +48 -47
  32. package/dist/runtime.cjs +1 -1
  33. package/dist/runtime.js +3 -3
  34. package/package.json +3 -3
  35. package/dist/graphservice-Cb7rr7SB.cjs +0 -1
  36. package/dist/graphservice-DloOtC_7.js +0 -739
  37. package/dist/models-CGYstu7u.cjs +0 -1
package/dist/index.js CHANGED
@@ -1,17 +1,17 @@
1
- var at = Object.defineProperty;
2
- var ct = (t, e, n) => e in t ? at(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var D = (t, e, n) => ct(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { jsx as x, jsxs as X } from "react/jsx-runtime";
5
- import w, { useContext as Y, createContext as re, useState as G, useRef as q, useCallback as k, useSyncExternalStore as ut, useEffect as $, useMemo as lt } from "react";
6
- import { Link as dt, useNavigate as ft, useLocation as pt, createMemoryRouter as gt, RouterProvider as yt } from "react-router-dom";
1
+ var pt = Object.defineProperty;
2
+ var gt = (t, e, n) => e in t ? pt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var x = (t, e, n) => gt(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { jsx as A, jsxs as H } from "react/jsx-runtime";
5
+ import C, { useContext as J, createContext as ae, useState as j, useRef as M, useCallback as U, useSyncExternalStore as ht, useEffect as W, useMemo as yt } from "react";
6
+ import { Link as mt, useNavigate as Et, useLocation as St, createMemoryRouter as _t, RouterProvider as Ct } from "react-router-dom";
7
7
  import "./index-D2mKAO8s.js";
8
- import { P as ht, G as mt, V as St, S as _t, a as Pe, U as Et, R as wt, b as Ct, c as Oe, d as bt, L as vt, e as Rt, f as Ft, g as It, h as Pt, i as Ot, j as Tt, C as At, k as Dt, l as xt, m as Nt, n as kt, Q as Lt, o as Mt, p as Ce, q as qt, r as Te, F as Ut, s as $t, t as Ae, D as De, u as Wt, v as Gt, w as jt, x as xe, y as Qt, z as Kt, A as Ne, B as Ht, E as Bt, H as zt, I as Yt, J as Jt, K as Zt, M as Xt, N as Vt, O as en, T as tn } from "./graphservice-DloOtC_7.js";
9
- import { P as nn, W as rn, S as sn, C as on, L as an, F as cn, a as un, U as ke, D as Le, G as ln, b as Me, c as qe, A as Ue } from "./models-D-vu7j83.js";
10
- import { O, a as $e, b as ae } from "./events-DDTGFACO.js";
11
- import { useQueryClient as j, useMutation as A, useQuery as T, keepPreviousData as We, useQueries as dn } from "@tanstack/react-query";
12
- import { useToast as fn } from "@omniviewdev/base-ui";
13
- import { w as pn } from "./legacyEnum-DORXlU_y.js";
14
- const ge = w.createContext(void 0), U = {
8
+ import { P as wt, G as vt, V as bt, S as Rt, a as Le, U as It, R as Ot, b as At, c as Ue, d as Tt, L as Ft, e as Dt, f as Nt, g as Pt, h as xt, i as Lt, j as Ut, C as kt, k as qt, l as Mt, m as $t, n as Wt, Q as Gt, o as jt, p as Oe, q as Qt, r as ke, F as Kt, s as Ht, t as qe, D as Me, u as Bt, v as zt, w as Vt, x as $e, y as Yt, z as Jt, A as We, B as Xt, E as Zt, H as en, I as tn, J as nn, K as rn, M as Ae, N as sn, O as on, T as an, W as cn, X as un } from "./graphservice-CUg1PUsC.js";
9
+ import { P as ln, W as dn, S as fn, C as pn, L as gn, F as hn, a as yn, U as Ge, D as je, G as mn, b as Qe, c as Ke, A as He } from "./models-4EtitZnM.js";
10
+ import { O as D, a as Be } from "./events-Bcx6NsMp.js";
11
+ import { useQueryClient as K, useMutation as P, useQuery as N, keepPreviousData as ze, useQueries as En } from "@tanstack/react-query";
12
+ import { useToast as Sn, Button as ee } from "@omniviewdev/base-ui";
13
+ import { w as _n } from "./legacyEnum-DORXlU_y.js";
14
+ const Se = C.createContext(void 0), F = {
15
15
  // Plugin
16
16
  PLUGIN_NOT_FOUND: "omniview:plugin/not-found",
17
17
  PLUGIN_NOT_LOADED: "omniview:plugin/not-loaded",
@@ -30,11 +30,14 @@ const ge = w.createContext(void 0), U = {
30
30
  RESOURCE_UNAUTHORIZED: "omniview:resource/unauthorized",
31
31
  RESOURCE_CONFLICT: "omniview:resource/conflict",
32
32
  RESOURCE_TIMEOUT: "omniview:resource/timeout",
33
+ RESOURCE_LIMIT: "omniview:resource/limit",
34
+ RESOURCE_CONTINUATION_EXPIRED: "omniview:resource/continuation-expired",
35
+ RESOURCE_RESET_REQUIRED: "omniview:resource/reset-required",
36
+ RESOURCE_PARTIAL: "omniview:resource/partial",
37
+ RESOURCE_PROVIDER_ERROR: "omniview:resource/provider-error",
33
38
  // Connection
34
39
  CONNECTION_NOT_FOUND: "omniview:connection/not-found",
35
40
  CONNECTION_FAILED: "omniview:connection/failed",
36
- RESOURCE_CONNECTION_ERROR: "omniview:resource/connection-error",
37
- RESOURCE_CERTIFICATE_ERROR: "omniview:resource/certificate-error",
38
41
  // Session
39
42
  SESSION_NOT_FOUND: "omniview:session/not-found",
40
43
  SESSION_FAILED: "omniview:session/failed",
@@ -43,65 +46,88 @@ const ge = w.createContext(void 0), U = {
43
46
  INTERNAL: "omniview:internal",
44
47
  VALIDATION: "omniview:validation",
45
48
  NOT_IMPLEMENTED: "omniview:not-implemented"
49
+ }, Te = {
50
+ INVALID_REQUEST: [F.VALIDATION, 400, "correctRequest"],
51
+ UNSUPPORTED: [F.NOT_IMPLEMENTED, 501, "refreshContract"],
52
+ FORBIDDEN: [F.RESOURCE_FORBIDDEN, 403, "none"],
53
+ UNAUTHORIZED: [F.RESOURCE_UNAUTHORIZED, 401, "none"],
54
+ NOT_FOUND: [F.RESOURCE_NOT_FOUND, 404, "none"],
55
+ CONFLICT: [F.RESOURCE_CONFLICT, 409, "refreshContract"],
56
+ ALREADY_EXISTS: [F.RESOURCE_CONFLICT, 409, "refreshContract"],
57
+ CANCELLED: [F.CANCELLED, 499, "none"],
58
+ TIMEOUT: [F.RESOURCE_TIMEOUT, 408, "none"],
59
+ UNAVAILABLE: [F.CONNECTION_FAILED, 503, "reconnect"],
60
+ CONNECTION_ERROR: [F.CONNECTION_FAILED, 503, "reconnect"],
61
+ CERTIFICATE_ERROR: [F.CONNECTION_FAILED, 502, "reconnect"],
62
+ RESOURCE_LIMIT: [F.RESOURCE_LIMIT, 429, "correctRequest"],
63
+ CONTINUATION_EXPIRED: [F.RESOURCE_CONTINUATION_EXPIRED, 410, "restartQuery"],
64
+ RESET_REQUIRED: [F.RESOURCE_RESET_REQUIRED, 409, "restartQuery"],
65
+ PARTIAL_RESULT: [F.RESOURCE_PARTIAL, 422, "none"],
66
+ PROVIDER_ERROR: [F.RESOURCE_PROVIDER_ERROR, 502, "none"],
67
+ INTERNAL: [F.INTERNAL, 500, "none"]
46
68
  };
47
- function gn(t) {
48
- switch (t) {
49
- case "NOT_FOUND":
50
- return { typeUri: U.RESOURCE_NOT_FOUND, status: 404 };
51
- case "FORBIDDEN":
52
- return { typeUri: U.RESOURCE_FORBIDDEN, status: 403 };
53
- case "UNAUTHORIZED":
54
- return { typeUri: U.RESOURCE_UNAUTHORIZED, status: 401 };
55
- case "CONFLICT":
56
- case "ALREADY_EXISTS":
57
- return { typeUri: U.RESOURCE_CONFLICT, status: 409 };
58
- case "TIMEOUT":
59
- return { typeUri: U.RESOURCE_TIMEOUT, status: 408 };
60
- case "CONNECTION_ERROR":
61
- return { typeUri: U.RESOURCE_CONNECTION_ERROR, status: 503 };
62
- case "CERTIFICATE_ERROR":
63
- return { typeUri: U.RESOURCE_CERTIFICATE_ERROR, status: 502 };
64
- default:
65
- return { typeUri: U.INTERNAL, status: 500 };
66
- }
69
+ function de(t) {
70
+ return typeof t == "object" && t !== null ? t : void 0;
67
71
  }
68
- function Q(t) {
69
- if (t == null)
70
- return {
71
- type: U.INTERNAL,
72
- title: "Unknown error",
73
- status: 500,
74
- detail: "An unknown error occurred."
75
- };
76
- let e;
77
- if (typeof t == "string" ? e = t : t instanceof Error ? e = t.message : e = String(t), e.startsWith("{"))
72
+ function $(t, e) {
73
+ return typeof t == "string" && t.length > 0 && t.length <= e;
74
+ }
75
+ function fe() {
76
+ return { type: F.CANCELLED, code: "CANCELLED", title: "Cancelled", status: 499, detail: "The operation was cancelled.", recovery: "none" };
77
+ }
78
+ function se(t, e) {
79
+ if (e > 4) return;
80
+ if (t === "cancelled") return fe();
81
+ if (typeof t == "string") {
82
+ const r = t.trim();
83
+ if (!r.startsWith("{")) return;
78
84
  try {
79
- const n = JSON.parse(e);
80
- if (typeof n.type == "string" && typeof n.title == "string" && typeof n.status == "number" && typeof n.detail == "string")
81
- return n;
82
- if (typeof n.code == "string" && typeof n.title == "string" && typeof n.message == "string") {
83
- const { typeUri: r, status: s } = gn(n.code);
84
- return {
85
- type: r,
86
- title: n.title,
87
- status: s,
88
- detail: n.message,
89
- suggestions: Array.isArray(n.suggestions) ? n.suggestions : void 0
90
- };
91
- }
85
+ return se(JSON.parse(r), e + 1);
92
86
  } catch {
87
+ return;
93
88
  }
94
- return {
95
- type: U.INTERNAL,
96
- title: "Error",
89
+ }
90
+ const n = de(t);
91
+ if (n) {
92
+ if (n.name === "AbortError" || n.name === "CancelError") return fe();
93
+ if ($(n.type, 256) && $(n.title, 256) && typeof n.status == "number" && Number.isInteger(n.status) && n.status >= 100 && n.status <= 599 && typeof n.detail == "string" && n.detail.length <= 4096) {
94
+ const r = { type: n.type, title: n.title, status: n.status, detail: n.detail };
95
+ $(n.code, 64) && (r.code = n.code), $(n.requestId, 256) && (r.requestId = n.requestId), $(n.instance, 512) && (r.instance = n.instance), Array.isArray(n.suggestions) && (r.suggestions = n.suggestions.filter((i) => $(i, 512)).slice(0, 8)), Array.isArray(n.actions) && (r.actions = n.actions.filter((i) => {
96
+ const o = de(i);
97
+ return !!o && ["navigate", "retry", "open-url", "copy"].includes(String(o.type)) && $(o.label, 256) && (o.target === void 0 || $(o.target, 4096));
98
+ }).slice(0, 8)), ["correctRequest", "refreshContract", "restartQuery", "reconnect", "none"].includes(String(n.recovery)) && (r.recovery = n.recovery);
99
+ const s = de(n.location);
100
+ return (s == null ? void 0 : s.unit) === "utf8-byte" && typeof s.start == "number" && typeof s.end == "number" && Number.isSafeInteger(s.start) && Number.isSafeInteger(s.end) && s.start >= 0 && s.end >= s.start && (r.location = { start: s.start, end: s.end, unit: "utf8-byte" }), r;
101
+ }
102
+ if (typeof n.code == "string" && typeof n.title == "string" && typeof n.message == "string") {
103
+ let r = n.code;
104
+ if (r === "PERMISSION_DENIED" && (r = "FORBIDDEN"), ["INVALID_INPUT", "FILTER_UNKNOWN_FIELD", "FILTER_INVALID_OPERATOR"].includes(r) && (r = "INVALID_REQUEST"), Object.prototype.hasOwnProperty.call(Te, r) || (r = "INTERNAL"), r === "CANCELLED") return fe();
105
+ const [s, i, o] = Te[r], a = r === "FORBIDDEN" || r === "UNAUTHORIZED" || r === "INTERNAL" || r === "PROVIDER_ERROR";
106
+ return {
107
+ type: s,
108
+ status: i,
109
+ code: r,
110
+ recovery: o,
111
+ title: a ? r === "FORBIDDEN" ? "Access denied" : r === "UNAUTHORIZED" ? "Authentication required" : "Operation failed" : $(n.title, 256) ? n.title : "Operation failed",
112
+ detail: a ? "The operation could not be completed." : $(n.message, 4096) ? n.message : "The operation could not be completed.",
113
+ ...!a && Array.isArray(n.suggestions) ? { suggestions: n.suggestions.filter((c) => $(c, 512)).slice(0, 8) } : {}
114
+ };
115
+ }
116
+ return se(n.message, e + 1) ?? se(n.cause, e + 1);
117
+ }
118
+ }
119
+ function Q(t) {
120
+ return se(t, 0) ?? {
121
+ type: F.INTERNAL,
122
+ title: t == null ? "Unknown error" : "Error",
97
123
  status: 500,
98
- detail: e
124
+ detail: t == null ? "An unknown error occurred." : "The operation could not be completed."
99
125
  };
100
126
  }
101
- function Ge(t) {
102
- return t == null ? !1 : (typeof t == "string" ? t : t instanceof Error ? t.message : String(t)) === "cancelled" ? !0 : Q(t).type === U.CANCELLED;
127
+ function oe(t) {
128
+ return Q(t).type === F.CANCELLED;
103
129
  }
104
- function yn(t) {
130
+ function Cn(t) {
105
131
  switch (t.type) {
106
132
  case "navigate":
107
133
  return {
@@ -138,7 +164,7 @@ function yn(t) {
138
164
  };
139
165
  }
140
166
  }
141
- function je(t, e) {
167
+ function Ve(t, e) {
142
168
  var s, i;
143
169
  const n = [
144
170
  t.detail,
@@ -149,73 +175,73 @@ function je(t, e) {
149
175
  message: e || (t.title !== "Error" ? t.title : "Operation failed"),
150
176
  status: "error",
151
177
  details: n,
152
- actions: (i = t.actions) == null ? void 0 : i.map(yn)
178
+ actions: (i = t.actions) == null ? void 0 : i.map(Cn)
153
179
  };
154
180
  }
155
- function z(t, e, n) {
156
- if (Ge(e)) return;
181
+ function B(t, e, n) {
182
+ if (oe(e)) return;
157
183
  const r = Q(e);
158
- t(je(r, n));
184
+ t(Ve(r, n));
159
185
  }
160
- function L(t, e) {
186
+ function k(t, e) {
161
187
  return (n) => {
162
- if (Ge(n)) return;
188
+ if (oe(n)) return;
163
189
  const r = Q(n);
164
- t(je(r, r.title !== "Error" ? r.title : e));
190
+ t(Ve(r, r.title !== "Error" ? r.title : e));
165
191
  };
166
192
  }
167
- function zr(t) {
168
- const { children: e, pluginId: n } = t, [r, s] = w.useState({}), [i, o] = w.useState(new nn()), [a, c] = w.useState(!1), [l, u] = w.useState(null), f = w.useRef(0), d = w.useRef(0);
193
+ function es(t) {
194
+ const { children: e, pluginId: n } = t, [r, s] = C.useState({}), [i, o] = C.useState(new ln()), [a, c] = C.useState(!1), [l, u] = C.useState(null), d = C.useRef(0), g = C.useRef(0);
169
195
  console.debug("[PluginContextProvider] render", { pluginId: n, metaLoaded: a, metaError: !!l });
170
- const p = w.useCallback(() => {
196
+ const h = C.useCallback(() => {
171
197
  if (n === void 0 || n === "")
172
198
  return;
173
- const S = ++f.current;
174
- console.debug(`[PluginContextProvider] fetching settings for "${n}"`), ht(n).then((m) => {
175
- S === f.current && (console.debug(`[PluginContextProvider] settings loaded for "${n}"`, Object.keys(m)), s(m));
176
- }).catch((m) => {
177
- if (S !== f.current) return;
178
- const y = Q(m);
179
- console.error(`[PluginContextProvider] error fetching settings for "${n}":`, y.detail);
199
+ const y = ++d.current;
200
+ console.debug(`[PluginContextProvider] fetching settings for "${n}"`), wt(n).then((f) => {
201
+ y === d.current && (console.debug(`[PluginContextProvider] settings loaded for "${n}"`, Object.keys(f)), s(f));
202
+ }).catch((f) => {
203
+ if (y !== d.current) return;
204
+ const p = Q(f);
205
+ console.error(`[PluginContextProvider] error fetching settings for "${n}":`, p.detail);
180
206
  });
181
- }, [n]), g = w.useCallback(() => {
207
+ }, [n]), E = C.useCallback(() => {
182
208
  if (n === void 0 || n === "") {
183
209
  console.debug("[PluginContextProvider] skipping meta fetch — empty pluginId");
184
210
  return;
185
211
  }
186
- const S = ++d.current;
187
- console.debug(`[PluginContextProvider] fetching meta for "${n}"`), u(null), mt(n).then((m) => {
188
- S === d.current && (console.debug(`[PluginContextProvider] meta loaded for "${n}"`, { name: m == null ? void 0 : m.name, version: m == null ? void 0 : m.version }), o(m), c(!0));
189
- }).catch((m) => {
190
- if (S !== d.current) return;
191
- const y = Q(m);
192
- console.error(`[PluginContextProvider] error fetching meta for "${n}":`, y.detail), u(y.detail), c(!1);
212
+ const y = ++g.current;
213
+ console.debug(`[PluginContextProvider] fetching meta for "${n}"`), u(null), vt(n).then((f) => {
214
+ y === g.current && (console.debug(`[PluginContextProvider] meta loaded for "${n}"`, { name: f == null ? void 0 : f.name, version: f == null ? void 0 : f.version }), o(f), c(!0));
215
+ }).catch((f) => {
216
+ if (y !== g.current) return;
217
+ const p = Q(f);
218
+ console.error(`[PluginContextProvider] error fetching meta for "${n}":`, p.detail), u(p.detail), c(!1);
193
219
  });
194
220
  }, [n]);
195
- return w.useEffect(() => {
221
+ return C.useEffect(() => {
196
222
  if (a) return;
197
- const S = () => {
198
- p(), g();
199
- }, m = [
200
- O("plugin/init_complete", S),
201
- O("plugin/dev_install_complete", (y) => {
202
- var _;
203
- ((_ = y.data) == null ? void 0 : _.id) === n && S();
223
+ const y = () => {
224
+ h(), E();
225
+ }, f = [
226
+ D("plugin/init_complete", y),
227
+ D("plugin/dev_install_complete", (p) => {
228
+ var w;
229
+ ((w = p.data) == null ? void 0 : w.id) === n && y();
204
230
  }),
205
- O("plugin/inventory_changed", S)
231
+ D("plugin/inventory_changed", y)
206
232
  ];
207
233
  return () => {
208
- for (const y of m) y();
234
+ for (const p of f) p();
209
235
  };
210
- }, [n, a, p, g]), w.useEffect(() => (console.debug(`[PluginContextProvider] useEffect — pluginId changed to "${n}"`), c(!1), u(null), s({}), p(), g(), () => {
211
- ++f.current, ++d.current;
212
- }), [n, p, g]), l ? /* @__PURE__ */ x("div", { style: {
236
+ }, [n, a, h, E]), C.useEffect(() => (console.debug(`[PluginContextProvider] useEffect — pluginId changed to "${n}"`), c(!1), u(null), s({}), h(), E(), () => {
237
+ ++d.current, ++g.current;
238
+ }), [n, h, E]), l ? /* @__PURE__ */ A("div", { style: {
213
239
  display: "flex",
214
240
  flex: 1,
215
241
  alignItems: "center",
216
242
  justifyContent: "center",
217
243
  padding: 24
218
- }, children: /* @__PURE__ */ X("div", { style: {
244
+ }, children: /* @__PURE__ */ H("div", { style: {
219
245
  maxWidth: 480,
220
246
  width: "100%",
221
247
  border: "1px solid #7F1D1D",
@@ -224,19 +250,19 @@ function zr(t) {
224
250
  padding: 20,
225
251
  fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
226
252
  }, children: [
227
- /* @__PURE__ */ X("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 12 }, children: [
228
- /* @__PURE__ */ X("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "#EF4444", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
229
- /* @__PURE__ */ x("circle", { cx: "12", cy: "12", r: "10" }),
230
- /* @__PURE__ */ x("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
231
- /* @__PURE__ */ x("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
253
+ /* @__PURE__ */ H("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 12 }, children: [
254
+ /* @__PURE__ */ H("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "#EF4444", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
255
+ /* @__PURE__ */ A("circle", { cx: "12", cy: "12", r: "10" }),
256
+ /* @__PURE__ */ A("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
257
+ /* @__PURE__ */ A("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
232
258
  ] }),
233
- /* @__PURE__ */ x("span", { style: { fontSize: 14, fontWeight: 600, color: "#FECACA" }, children: "Plugin failed to load" })
259
+ /* @__PURE__ */ A("span", { style: { fontSize: 14, fontWeight: 600, color: "#FECACA" }, children: "Plugin failed to load" })
234
260
  ] }),
235
- /* @__PURE__ */ x("p", { style: { fontSize: 13, color: "#A1A1AA", margin: "0 0 16px" }, children: l }),
236
- /* @__PURE__ */ x(
261
+ /* @__PURE__ */ A("p", { style: { fontSize: 13, color: "#A1A1AA", margin: "0 0 16px" }, children: l }),
262
+ /* @__PURE__ */ A(
237
263
  "button",
238
264
  {
239
- onClick: () => g(),
265
+ onClick: () => E(),
240
266
  style: {
241
267
  background: "transparent",
242
268
  color: "#F87171",
@@ -250,13 +276,13 @@ function zr(t) {
250
276
  children: "Retry"
251
277
  }
252
278
  )
253
- ] }) }) : a ? /* @__PURE__ */ x(ge.Provider, { value: { pluginId: n, settings: r, meta: i }, children: e }) : /* @__PURE__ */ X("div", { style: {
279
+ ] }) }) : a ? /* @__PURE__ */ A(Se.Provider, { value: { pluginId: n, settings: r, meta: i }, children: e }) : /* @__PURE__ */ H("div", { style: {
254
280
  display: "flex",
255
281
  flex: 1,
256
282
  alignItems: "center",
257
283
  justifyContent: "center"
258
284
  }, children: [
259
- /* @__PURE__ */ x("div", { style: {
285
+ /* @__PURE__ */ A("div", { style: {
260
286
  width: 24,
261
287
  height: 24,
262
288
  border: "2px solid #3F3F46",
@@ -264,38 +290,38 @@ function zr(t) {
264
290
  borderRadius: "50%",
265
291
  animation: "plugin-spin 0.8s linear infinite"
266
292
  } }),
267
- /* @__PURE__ */ x("style", { children: "@keyframes plugin-spin { to { transform: rotate(360deg); } }" })
293
+ /* @__PURE__ */ A("style", { children: "@keyframes plugin-spin { to { transform: rotate(360deg); } }" })
268
294
  ] });
269
295
  }
270
- function ye() {
271
- const t = Y(ge);
296
+ function _e() {
297
+ const t = J(Se);
272
298
  if (!t)
273
299
  throw new Error("usePluginContext must be used within a PluginContextProvider");
274
300
  return t;
275
301
  }
276
- function Yr() {
277
- return ye().settings;
302
+ function ts() {
303
+ return _e().settings;
278
304
  }
279
- const Qe = re(void 0), Jr = ({ children: t }) => {
280
- const [e, n] = G({}), r = q(0), s = k(() => {
305
+ const Ye = ae(void 0), ns = ({ children: t }) => {
306
+ const [e, n] = j({}), r = M(0), s = U(() => {
281
307
  const o = r.current + 1;
282
- r.current = o, St().then((a) => {
308
+ r.current = o, bt().then((a) => {
283
309
  o === r.current && n(a);
284
310
  }).catch((a) => {
285
311
  o === r.current && console.error("Error fetching settings:", a);
286
312
  });
287
313
  }, []);
288
- w.useEffect(() => {
289
- const o = O("settings/changed", () => s());
314
+ C.useEffect(() => {
315
+ const o = D("settings/changed", () => s());
290
316
  return s(), () => {
291
317
  r.current += 1, o();
292
318
  };
293
319
  }, [s]);
294
- const i = k(() => {
320
+ const i = U(() => {
295
321
  s();
296
322
  }, [s]);
297
- return /* @__PURE__ */ x(Qe.Provider, { value: { settings: e, reload: i }, children: t });
298
- }, hn = {
323
+ return /* @__PURE__ */ A(Ye.Provider, { value: { settings: e, reload: i }, children: t });
324
+ }, wn = {
299
325
  height: 32,
300
326
  focused: 0,
301
327
  tabs: [],
@@ -319,80 +345,80 @@ const Qe = re(void 0), Jr = ({ children: t }) => {
319
345
  },
320
346
  fullscreenDrawer: () => {
321
347
  }
322
- }, mn = w.createContext(hn), Sn = re(void 0), _n = w.createContext(void 0), Ke = w.createContext(void 0), En = 3e4, Zr = ({ children: t }) => {
323
- const [e, n] = w.useState([]), r = w.useCallback((a) => {
348
+ }, vn = C.createContext(wn), bn = ae(void 0), Rn = C.createContext(void 0), Je = C.createContext(void 0), In = 3e4, rs = ({ children: t }) => {
349
+ const [e, n] = C.useState([]), r = C.useCallback((a) => {
324
350
  n((c) => [a, ...c]);
325
- }, []), s = w.useCallback((a, c) => {
351
+ }, []), s = C.useCallback((a, c) => {
326
352
  n(
327
353
  (l) => l.map((u) => u.id === a ? { ...u, ...c } : u)
328
354
  );
329
- }, []), i = w.useCallback((a) => {
355
+ }, []), i = C.useCallback((a) => {
330
356
  n((c) => c.filter((l) => l.id !== a));
331
357
  }, []);
332
- w.useEffect(() => {
358
+ C.useEffect(() => {
333
359
  const a = [];
334
360
  for (const c of e)
335
- if (c.status === "completed" || c.status === "error") {
336
- const l = Date.now() - (c.completedAt ?? c.startedAt), u = Math.max(0, En - l);
361
+ if (c.status !== "running") {
362
+ const l = Date.now() - (c.completedAt ?? c.startedAt), u = Math.max(0, In - l);
337
363
  a.push(setTimeout(() => i(c.id), u));
338
364
  }
339
365
  return () => a.forEach(clearTimeout);
340
366
  }, [e, i]);
341
- const o = w.useMemo(
367
+ const o = C.useMemo(
342
368
  () => ({ operations: e, addOperation: r, updateOperation: s, removeOperation: i }),
343
369
  [e, r, s, i]
344
370
  );
345
- return /* @__PURE__ */ x(Ke.Provider, { value: o, children: t });
371
+ return /* @__PURE__ */ A(Je.Provider, { value: o, children: t });
346
372
  };
347
- var de = function(t, e) {
348
- return de = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
373
+ var ye = function(t, e) {
374
+ return ye = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
349
375
  n.__proto__ = r;
350
376
  } || function(n, r) {
351
377
  for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (n[s] = r[s]);
352
- }, de(t, e);
378
+ }, ye(t, e);
353
379
  };
354
- function wn(t, e) {
380
+ function On(t, e) {
355
381
  if (typeof e != "function" && e !== null)
356
382
  throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
357
- de(t, e);
383
+ ye(t, e);
358
384
  function n() {
359
385
  this.constructor = t;
360
386
  }
361
387
  t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
362
388
  }
363
- var ce = "Invariant Violation", be = Object.setPrototypeOf, Cn = be === void 0 ? function(t, e) {
389
+ var pe = "Invariant Violation", Fe = Object.setPrototypeOf, An = Fe === void 0 ? function(t, e) {
364
390
  return t.__proto__ = e, t;
365
- } : be, bn = (
391
+ } : Fe, Tn = (
366
392
  /** @class */
367
393
  function(t) {
368
- wn(e, t);
394
+ On(e, t);
369
395
  function e(n) {
370
- n === void 0 && (n = ce);
371
- var r = t.call(this, typeof n == "number" ? ce + ": " + n + " (see https://github.com/apollographql/invariant-packages)" : n) || this;
372
- return r.framesToPop = 1, r.name = ce, Cn(r, e.prototype), r;
396
+ n === void 0 && (n = pe);
397
+ var r = t.call(this, typeof n == "number" ? pe + ": " + n + " (see https://github.com/apollographql/invariant-packages)" : n) || this;
398
+ return r.framesToPop = 1, r.name = pe, An(r, e.prototype), r;
373
399
  }
374
400
  return e;
375
401
  }(Error)
376
402
  );
377
- function fe(t, e) {
403
+ function me(t, e) {
378
404
  if (!t)
379
- throw new bn(e);
405
+ throw new Tn(e);
380
406
  }
381
- var He = ["debug", "log", "warn", "error", "silent"], vn = He.indexOf("log");
382
- function V(t) {
407
+ var Xe = ["debug", "log", "warn", "error", "silent"], Fn = Xe.indexOf("log");
408
+ function te(t) {
383
409
  return function() {
384
- if (He.indexOf(t) >= vn) {
410
+ if (Xe.indexOf(t) >= Fn) {
385
411
  var e = console[t] || console.log;
386
412
  return e.apply(console, arguments);
387
413
  }
388
414
  };
389
415
  }
390
416
  (function(t) {
391
- t.debug = V("debug"), t.log = V("log"), t.warn = V("warn"), t.error = V("error");
392
- })(fe || (fe = {}));
393
- const Be = re(void 0), Rn = () => Y(Be);
394
- function Xr(t) {
395
- const e = Rn(), n = w.useRef(null), r = e == null ? void 0 : e.getExtensionPoint(t), s = k(
417
+ t.debug = te("debug"), t.log = te("log"), t.warn = te("warn"), t.error = te("error");
418
+ })(me || (me = {}));
419
+ const Ze = ae(void 0), Dn = () => J(Ze);
420
+ function ss(t) {
421
+ const e = Dn(), n = C.useRef(null), r = e == null ? void 0 : e.getExtensionPoint(t), s = U(
396
422
  (o) => {
397
423
  const a = [];
398
424
  return e && a.push(e.subscribe(o)), r && a.push(r.subscribe(o)), () => {
@@ -401,7 +427,7 @@ function Xr(t) {
401
427
  };
402
428
  },
403
429
  [e, t, r]
404
- ), i = k(() => {
430
+ ), i = U(() => {
405
431
  const o = e == null ? void 0 : e.getExtensionPoint(t);
406
432
  if (!o) {
407
433
  if (n.current && n.current.store === void 0)
@@ -415,30 +441,30 @@ function Xr(t) {
415
441
  const c = {};
416
442
  return n.current = { store: o, version: o.version, sentinel: c }, c;
417
443
  }, [e, t]);
418
- return ut(s, i), e == null ? void 0 : e.getExtensionPoint(t);
444
+ return ht(s, i), e == null ? void 0 : e.getExtensionPoint(t);
419
445
  }
420
- const Vr = ({ registry: t, children: e }) => {
421
- const n = w.useRef(t);
422
- return fe(
446
+ const os = ({ registry: t, children: e }) => {
447
+ const n = C.useRef(t);
448
+ return me(
423
449
  n.current === t,
424
450
  "You can't change the extension registry after it has been rendered"
425
- ), /* @__PURE__ */ x(Be.Provider, { value: n.current, children: e });
426
- }, ue = (t) => {
451
+ ), /* @__PURE__ */ A(Ze.Provider, { value: n.current, children: e });
452
+ }, ge = (t) => {
427
453
  if (!t || typeof t != "string")
428
454
  throw new TypeError(`extensionName is required to be a string and can't be: "${t}" (${typeof t})`);
429
455
  return t.trim();
430
456
  };
431
- class Fn {
457
+ class Nn {
432
458
  constructor(e) {
433
- D(this, "id");
434
- D(this, "mode");
435
- D(this, "_pluginId");
436
- D(this, "_version", 0);
437
- D(this, "_contributions", /* @__PURE__ */ new Map());
438
- D(this, "_lookupCache", /* @__PURE__ */ new Map());
439
- D(this, "_matcher");
440
- D(this, "_select");
441
- D(this, "_listeners", /* @__PURE__ */ new Set());
459
+ x(this, "id");
460
+ x(this, "mode");
461
+ x(this, "_pluginId");
462
+ x(this, "_version", 0);
463
+ x(this, "_contributions", /* @__PURE__ */ new Map());
464
+ x(this, "_lookupCache", /* @__PURE__ */ new Map());
465
+ x(this, "_matcher");
466
+ x(this, "_select");
467
+ x(this, "_listeners", /* @__PURE__ */ new Set());
442
468
  this.id = e.id, this.mode = e.mode ?? "multiple", this._pluginId = e.pluginId, this._matcher = e.matcher, this._select = e.select;
443
469
  }
444
470
  get pluginId() {
@@ -548,11 +574,11 @@ class Fn {
548
574
  e();
549
575
  }
550
576
  }
551
- class es {
577
+ class is {
552
578
  constructor(e) {
553
- D(this, "_stores", /* @__PURE__ */ new Map());
554
- D(this, "_storeUnsubs", /* @__PURE__ */ new Map());
555
- D(this, "_listeners", /* @__PURE__ */ new Set());
579
+ x(this, "_stores", /* @__PURE__ */ new Map());
580
+ x(this, "_storeUnsubs", /* @__PURE__ */ new Map());
581
+ x(this, "_listeners", /* @__PURE__ */ new Set());
556
582
  if (e != null && e.initialStores)
557
583
  for (const n of e.initialStores)
558
584
  this.addExtensionPoint(n);
@@ -562,28 +588,28 @@ class es {
562
588
  * Throws if the extension point ID already exists.
563
589
  */
564
590
  addExtensionPoint(e) {
565
- const n = ue(e.id);
591
+ const n = ge(e.id);
566
592
  if (this._stores.has(n)) {
567
593
  const s = this._stores.get(n);
568
594
  throw new Error(
569
595
  `Extension point "${n}" already exists (owned by "${s.pluginId ?? "unknown"}")`
570
596
  );
571
597
  }
572
- const r = new Fn({ ...e, id: n });
598
+ const r = new Nn({ ...e, id: n });
573
599
  this._stores.set(n, r), this._storeUnsubs.set(n, r.subscribe(() => this._notify())), this._notify();
574
600
  }
575
601
  /**
576
602
  * Get an extension point store by ID.
577
603
  */
578
604
  getExtensionPoint(e) {
579
- const n = ue(e);
605
+ const n = ge(e);
580
606
  return this._stores.get(n);
581
607
  }
582
608
  /**
583
609
  * Check if an extension point exists.
584
610
  */
585
611
  hasExtensionPoint(e) {
586
- const n = ue(e);
612
+ const n = ge(e);
587
613
  return this._stores.has(n);
588
614
  }
589
615
  /**
@@ -624,90 +650,151 @@ class es {
624
650
  e();
625
651
  }
626
652
  }
627
- const ze = re(void 0), In = {
653
+ const et = ae(void 0), Pn = {
628
654
  default: "info",
629
655
  info: "info",
630
656
  success: "success",
631
657
  warning: "warning",
632
658
  error: "danger"
633
- }, ts = ({ children: t }) => {
634
- const { toast: e } = fn(), [n, r] = w.useState([]), s = (o) => {
635
- r((a) => [...a, o]);
636
- }, i = (o, a, c) => {
637
- const l = typeof o == "object";
638
- let u = "", f = "info", d, p = 5e3, g;
639
- if (l) {
640
- if (u = o.message, o.showOnce) {
641
- if (n.includes(u))
659
+ }, as = ({ children: t }) => {
660
+ const { toast: e } = Sn(), [n, r] = C.useState([]), [s, i] = C.useState([]), [o, a] = C.useState(!1), [c, l] = C.useState(), [u, d] = C.useState(""), g = C.useRef(Date.now()), h = (y) => {
661
+ r((f) => [...f, y]);
662
+ }, E = (y, f, p) => {
663
+ const w = typeof y == "object";
664
+ let m = "", v = "info", b, S = 5e3, _;
665
+ if (w) {
666
+ if (m = y.message, y.showOnce) {
667
+ if (n.includes(m))
642
668
  return;
643
- s(u);
669
+ h(m);
644
670
  }
645
- f = o.status, d = o.details, p = o.autoHideDuration ?? 5e3, g = o.actions;
671
+ v = y.status, b = y.details, S = y.autoHideDuration ?? 5e3, _ = y.actions;
646
672
  } else
647
- u = o, f = a, d = c;
648
- e(d ?? u, {
649
- severity: In[f] ?? "info",
650
- title: d ? u : void 0,
651
- duration: p,
652
- action: g == null ? void 0 : g[0]
673
+ m = y, v = f, b = p;
674
+ let R;
675
+ if (v === "error") {
676
+ const O = {
677
+ id: ++g.current,
678
+ message: m,
679
+ details: b,
680
+ created: (/* @__PURE__ */ new Date()).toISOString(),
681
+ actions: _
682
+ };
683
+ i((q) => [...q, O].slice(-20)), R = { label: "Details", onClick: () => {
684
+ l(O.id), a(!0);
685
+ } };
686
+ }
687
+ e(v === "error" ? m : b ?? m, {
688
+ severity: Pn[v] ?? "info",
689
+ title: v !== "error" && b ? m : void 0,
690
+ duration: S,
691
+ action: R ?? (_ == null ? void 0 : _[0])
653
692
  });
654
693
  };
655
- return /* @__PURE__ */ x(ze.Provider, { value: { showSnackbar: i }, children: t });
656
- }, W = () => {
657
- const t = Y(ze);
694
+ return /* @__PURE__ */ H(et.Provider, { value: { showSnackbar: E, openNotifications: () => a(!0), notificationCount: s.length }, children: [
695
+ t,
696
+ o && /* @__PURE__ */ H("aside", { "aria-label": "Notifications", style: {
697
+ position: "fixed",
698
+ right: 16,
699
+ bottom: 64,
700
+ zIndex: 1400,
701
+ width: "min(600px, calc(100vw - 32px))",
702
+ maxHeight: "70vh",
703
+ overflow: "auto",
704
+ padding: 16,
705
+ background: "var(--ov-color-bg-surface, #202020)",
706
+ color: "var(--ov-color-fg-default, #eee)",
707
+ border: "1px solid currentColor",
708
+ borderRadius: 8
709
+ }, children: [
710
+ /* @__PURE__ */ A("h2", { children: "Notifications" }),
711
+ /* @__PURE__ */ A(ee, { size: "sm", variant: "ghost", onClick: () => a(!1), children: "Close" }),
712
+ /* @__PURE__ */ A(ee, { size: "sm", variant: "ghost", onClick: () => {
713
+ i([]), l(void 0), d("");
714
+ }, children: "Clear history" }),
715
+ s.length === 0 && /* @__PURE__ */ A("p", { children: "No recent errors." }),
716
+ s.slice().reverse().map((y) => {
717
+ var f;
718
+ return /* @__PURE__ */ H("details", { open: c === y.id, onToggle: (p) => {
719
+ p.currentTarget.open && l(y.id);
720
+ }, children: [
721
+ /* @__PURE__ */ H("summary", { children: [
722
+ y.message,
723
+ " — ",
724
+ /* @__PURE__ */ A("time", { dateTime: y.created, children: new Date(y.created).toLocaleString() })
725
+ ] }),
726
+ /* @__PURE__ */ A("pre", { style: { whiteSpace: "pre-wrap", overflowWrap: "anywhere", userSelect: "text" }, children: y.details || y.message }),
727
+ /* @__PURE__ */ A(ee, { size: "sm", variant: "ghost", onClick: async () => {
728
+ d("");
729
+ try {
730
+ await navigator.clipboard.writeText(`${y.message}
731
+ ${y.created}
732
+ ${y.details ?? ""}`);
733
+ } catch {
734
+ d("Copy failed. Select the diagnostic text and copy it manually.");
735
+ }
736
+ }, children: "Copy details" }),
737
+ (f = y.actions) == null ? void 0 : f.map((p, w) => /* @__PURE__ */ A(ee, { size: "sm", variant: "ghost", onClick: p.onClick, children: p.label }, `${p.label}-${w}`))
738
+ ] }, y.id);
739
+ }),
740
+ u && /* @__PURE__ */ A("p", { role: "status", children: u })
741
+ ] })
742
+ ] });
743
+ }, G = () => {
744
+ const t = J(et);
658
745
  if (t === void 0)
659
746
  throw new Error("useCustomSnackbar must be used within a CustomSnackbarProvider");
660
747
  return t;
661
748
  };
662
- function P(t) {
663
- const e = Y(ge), n = (e == null ? void 0 : e.pluginId) ?? t;
749
+ function T(t) {
750
+ const e = J(Se), n = (e == null ? void 0 : e.pluginId) ?? t;
664
751
  if (!n)
665
752
  throw new Error(
666
753
  "pluginID must be provided either via PluginContext or as an explicit parameter"
667
754
  );
668
755
  return n;
669
756
  }
670
- const ns = ({ pluginID: t, connectionID: e }) => {
671
- const n = P(t), r = j(), { showSnackbar: s } = W(), i = [n, "connection", "detail", e], { mutateAsync: o } = A({
672
- mutationFn: async () => _t(n, e),
673
- onSuccess(f) {
674
- r.setQueryData(i, f), r.invalidateQueries({
757
+ const cs = ({ pluginID: t, connectionID: e }) => {
758
+ const n = T(t), r = K(), { showSnackbar: s } = G(), i = [n, "connection", "detail", e], { mutateAsync: o } = P({
759
+ mutationFn: async () => Rt(n, e),
760
+ onSuccess(d) {
761
+ r.setQueryData(i, d), r.invalidateQueries({
675
762
  queryKey: ["EDITOR_SCHEMAS", n, e]
676
763
  });
677
764
  },
678
- onError: L(s, "Failed to start connection")
679
- }), { mutateAsync: a } = A({
680
- mutationFn: async () => Pe(n, e),
681
- onSuccess(f) {
682
- r.setQueryData(i, f);
765
+ onError: k(s, "Failed to start connection")
766
+ }), { mutateAsync: a } = P({
767
+ mutationFn: async () => Le(n, e),
768
+ onSuccess(d) {
769
+ r.setQueryData(i, d);
683
770
  },
684
- onError: L(s, "Failed to stop connection")
685
- }), { mutateAsync: c } = A({
686
- mutationFn: async (f) => Et(n, f),
687
- onSuccess(f, { name: d }) {
688
- s({ message: `Connection ${d} successfully updated`, status: "success" }), r.setQueryData(i, f), r.setQueriesData(
771
+ onError: k(s, "Failed to stop connection")
772
+ }), { mutateAsync: c } = P({
773
+ mutationFn: async (d) => It(n, d),
774
+ onSuccess(d, { name: g }) {
775
+ s({ message: `Connection ${g} successfully updated`, status: "success" }), r.setQueryData(i, d), r.setQueriesData(
689
776
  { queryKey: [n, "connection", "list"] },
690
- (p) => p == null ? void 0 : p.map((g) => g.id === e ? f : g)
777
+ (h) => h == null ? void 0 : h.map((E) => E.id === e ? d : E)
691
778
  );
692
779
  },
693
- onError: L(s, "Failed to update connection")
694
- }), { mutateAsync: l } = A({
695
- mutationFn: async () => wt(n, e),
780
+ onError: k(s, "Failed to update connection")
781
+ }), { mutateAsync: l } = P({
782
+ mutationFn: async () => Ot(n, e),
696
783
  onSuccess() {
697
784
  s({ message: "Connection successfully removed", status: "success" }), r.setQueryData(i, void 0), r.setQueriesData(
698
785
  { queryKey: [n, "connection", "list"] },
699
- (f) => f == null ? void 0 : f.filter((d) => d.id !== e)
786
+ (d) => d == null ? void 0 : d.filter((g) => g.id !== e)
700
787
  );
701
788
  },
702
- onError: L(s, "Failed to remove connection")
789
+ onError: k(s, "Failed to remove connection")
703
790
  });
704
791
  return {
705
792
  /**
706
793
  * Get the connection
707
794
  */
708
- connection: T({
795
+ connection: N({
709
796
  queryKey: i,
710
- queryFn: async () => Ct(n, e)
797
+ queryFn: async () => At(n, e)
711
798
  }),
712
799
  /**
713
800
  * Start the connection
@@ -726,58 +813,58 @@ const ns = ({ pluginID: t, connectionID: e }) => {
726
813
  */
727
814
  deleteConnection: l
728
815
  };
729
- }, Pn = (t) => [t, "connection", "list"], rs = ({ plugin: t }) => {
730
- const e = P(t), n = j(), { showSnackbar: r } = W(), s = Pn(e), { mutateAsync: i } = A({
731
- mutationFn: async (l) => Oe(e, l.id),
732
- onError: L(r, "Failed to start connection watch")
733
- }), { mutateAsync: o } = A({
734
- mutationFn: async (l) => bt(e, l.id),
735
- onError: L(r, "Failed to stop connection watch")
736
- }), a = w.useCallback((l) => {
816
+ }, xn = (t) => [t, "connection", "list"], us = ({ plugin: t }) => {
817
+ const e = T(t), n = K(), { showSnackbar: r } = G(), s = xn(e), { mutateAsync: i } = P({
818
+ mutationFn: async (l) => Ue(e, l.id),
819
+ onError: k(r, "Failed to start connection watch")
820
+ }), { mutateAsync: o } = P({
821
+ mutationFn: async (l) => Tt(e, l.id),
822
+ onError: k(r, "Failed to stop connection watch")
823
+ }), a = C.useCallback((l) => {
737
824
  const u = l.data;
738
825
  console.log("got update to connections", u), n.setQueryData(s, u);
739
826
  }, [n, s]);
740
- return w.useEffect(() => {
741
- const l = O(`${e}/connection/sync`, a);
827
+ return C.useEffect(() => {
828
+ const l = D(`${e}/connection/sync`, a);
742
829
  return () => {
743
830
  l();
744
831
  };
745
832
  }, [e, a]), {
746
- connections: T({
833
+ connections: N({
747
834
  queryKey: s,
748
835
  queryFn: async () => {
749
836
  try {
750
- return await vt(e);
837
+ return await Ft(e);
751
838
  } catch (l) {
752
- console.log(l), L(r, "Failed to load connections")(l);
839
+ console.log(l), k(r, "Failed to load connections")(l);
753
840
  }
754
841
  return [];
755
842
  },
756
843
  staleTime: 3e4,
757
- placeholderData: We
844
+ placeholderData: ze
758
845
  }),
759
846
  startWatch: i,
760
847
  stopWatch: o
761
848
  };
762
- }, ss = ({ pluginID: t, connectionID: e }) => {
763
- const n = P(t);
849
+ }, ls = ({ pluginID: t, connectionID: e }) => {
850
+ const n = T(t);
764
851
  return {
765
852
  /**
766
853
  * Get the connection
767
854
  */
768
- namespaces: T({
855
+ namespaces: N({
769
856
  queryKey: [n, "connection", "namespaces", e],
770
- queryFn: async () => Rt(n, e)
857
+ queryFn: async () => Dt(n, e)
771
858
  })
772
859
  };
773
- }, F = pn(rn, "WatchState");
774
- function pe(t) {
860
+ }, I = _n(dn, "WatchState");
861
+ function Ee(t) {
775
862
  const e = Object.values(t.states), n = e.length;
776
863
  let r = 0, s = 0, i = 0, o = 0;
777
864
  for (const u of e)
778
- u === F.WatchStateSynced && r++, (u === F.WatchStateError || u === F.WatchStateFailed) && s++, u === F.WatchStateForbidden && i++, u === F.WatchStateSkipped && o++;
865
+ u === I.WatchStateSynced && r++, (u === I.WatchStateError || u === I.WatchStateFailed) && s++, u === I.WatchStateForbidden && i++, u === I.WatchStateSkipped && o++;
779
866
  const a = n - o, c = e.filter(
780
- (u) => u === F.WatchStateSynced || u === F.WatchStateError || u === F.WatchStateStopped || u === F.WatchStateFailed || u === F.WatchStateForbidden
867
+ (u) => u === I.WatchStateSynced || u === I.WatchStateError || u === I.WatchStateStopped || u === I.WatchStateFailed || u === I.WatchStateForbidden
781
868
  ).length, l = a > 0 ? c / a : 0;
782
869
  return {
783
870
  pluginID: t.pluginID,
@@ -792,21 +879,21 @@ function pe(t) {
792
879
  progress: l
793
880
  };
794
881
  }
795
- function ne(t) {
882
+ function ie(t) {
796
883
  return t.watchedTotal > 0 && t.doneCount >= t.watchedTotal;
797
884
  }
798
- function Ye(t) {
799
- return t.some((e) => !ne(e));
885
+ function tt(t) {
886
+ return t.some((e) => !ie(e));
800
887
  }
801
- function Je(t) {
888
+ function nt(t) {
802
889
  const e = t.reduce((r, s) => r + s.watchedTotal, 0);
803
890
  return e === 0 ? 0 : t.reduce((r, s) => r + s.doneCount, 0) / e;
804
891
  }
805
- function he(t) {
892
+ function Ce(t) {
806
893
  return `${t.pluginId}/${t.connection}`;
807
894
  }
808
- function Ze(t, e) {
809
- const n = he(e);
895
+ function rt(t, e) {
896
+ const n = Ce(e);
810
897
  t.has(n) || t.set(n, {
811
898
  states: {},
812
899
  pluginID: e.pluginId,
@@ -815,155 +902,155 @@ function Ze(t, e) {
815
902
  const r = t.get(n);
816
903
  return r.states[e.resourceKey] = e.state, r;
817
904
  }
818
- function os() {
819
- const [t, e] = G(/* @__PURE__ */ new Set()), [n, r] = G({}), [s, i] = G(/* @__PURE__ */ new Map()), o = q(/* @__PURE__ */ new Map()), [a, c] = G(/* @__PURE__ */ new Map());
820
- $(() => {
821
- const h = O("plugin/crash_recovery_failed", (R) => {
822
- const C = R.data, E = C == null ? void 0 : C.pluginID;
823
- E && c((b) => {
824
- const I = new Map(b);
825
- return I.set(E, C.error ?? "Crash recovery failed"), I;
905
+ function ds() {
906
+ const [t, e] = j(/* @__PURE__ */ new Set()), [n, r] = j({}), [s, i] = j(/* @__PURE__ */ new Map()), o = M(/* @__PURE__ */ new Map()), [a, c] = j(/* @__PURE__ */ new Map());
907
+ W(() => {
908
+ const m = D("plugin/crash_recovery_failed", (b) => {
909
+ const S = b.data, _ = S == null ? void 0 : S.pluginID;
910
+ _ && c((R) => {
911
+ const O = new Map(R);
912
+ return O.set(_, S.error ?? "Crash recovery failed"), O;
826
913
  });
827
- }), v = O("plugin/recovered", (R) => {
828
- const C = R.data, E = C == null ? void 0 : C.pluginID;
829
- E && c((b) => {
830
- if (!b.has(E)) return b;
831
- const I = new Map(b);
832
- return I.delete(E), I;
914
+ }), v = D("plugin/recovered", (b) => {
915
+ const S = b.data, _ = S == null ? void 0 : S.pluginID;
916
+ _ && c((R) => {
917
+ if (!R.has(_)) return R;
918
+ const O = new Map(R);
919
+ return O.delete(_), O;
833
920
  });
834
921
  });
835
922
  return () => {
836
- h(), v();
923
+ m(), v();
837
924
  };
838
- }, []), $(() => {
839
- Ft().then((h) => {
840
- if (!h) return;
841
- const v = {}, R = /* @__PURE__ */ new Set(), C = /* @__PURE__ */ new Map();
842
- for (const [E, b] of Object.entries(h))
843
- if (b) {
844
- v[E] = b.map((I) => I.connection);
845
- for (const I of b) {
846
- if (!I.started) continue;
847
- const M = `${E}/${I.connection.id}`;
848
- R.add(M);
849
- const N = {
850
- pluginID: E,
851
- connectionID: I.connection.id,
925
+ }, []), W(() => {
926
+ Nt().then((m) => {
927
+ if (!m) return;
928
+ const v = {}, b = /* @__PURE__ */ new Set(), S = /* @__PURE__ */ new Map();
929
+ for (const [_, R] of Object.entries(m))
930
+ if (R) {
931
+ v[_] = R.map((O) => O.connection);
932
+ for (const O of R) {
933
+ if (!O.started) continue;
934
+ const q = `${_}/${O.connection.id}`;
935
+ b.add(q);
936
+ const L = {
937
+ pluginID: _,
938
+ connectionID: O.connection.id,
852
939
  states: {}
853
940
  };
854
- if (I.resources)
855
- for (const [ie, it] of Object.entries(I.resources))
856
- N.states[ie] = it;
857
- o.current.set(M, N), C.set(M, pe(N));
941
+ if (O.resources)
942
+ for (const [le, ft] of Object.entries(O.resources))
943
+ L.states[le] = ft;
944
+ o.current.set(q, L), S.set(q, Ee(L));
858
945
  }
859
946
  }
860
- r(v), e(R), i(C);
947
+ r(v), e(b), i(S);
861
948
  }).catch(() => {
862
949
  });
863
- }, []), $(() => O("connection/status", (v) => {
864
- const R = v.data, C = `${R.pluginID}/${R.connectionID}`;
865
- R.status === "DISCONNECTED" ? (e((E) => {
866
- const b = new Set(E);
867
- return b.delete(C), b;
868
- }), i((E) => {
869
- const b = new Map(E);
870
- return b.delete(C), b;
871
- }), o.current.delete(C)) : e((E) => {
872
- const b = new Set(E);
873
- return b.add(C), b;
874
- }), Pt().then((E) => {
875
- if (!E) return;
876
- const b = {};
877
- for (const [I, M] of Object.entries(E))
878
- M != null && (b[I] = M);
879
- r(b);
950
+ }, []), W(() => D("connection/status", (v) => {
951
+ const b = v.data, S = `${b.pluginID}/${b.connectionID}`;
952
+ b.status === "DISCONNECTED" ? (e((_) => {
953
+ const R = new Set(_);
954
+ return R.delete(S), R;
955
+ }), i((_) => {
956
+ const R = new Map(_);
957
+ return R.delete(S), R;
958
+ }), o.current.delete(S)) : e((_) => {
959
+ const R = new Set(_);
960
+ return R.add(S), R;
961
+ }), xt().then((_) => {
962
+ if (!_) return;
963
+ const R = {};
964
+ for (const [O, q] of Object.entries(_))
965
+ q != null && (R[O] = q);
966
+ r(R);
880
967
  }).catch(() => {
881
968
  });
882
969
  }), []);
883
- const l = k((h) => {
884
- const v = h.data, R = he(v);
885
- e((b) => {
886
- if (b.has(R)) return b;
887
- const I = new Set(b);
888
- return I.add(R), I;
970
+ const l = U((m) => {
971
+ const v = m.data, b = Ce(v);
972
+ e((R) => {
973
+ if (R.has(b)) return R;
974
+ const O = new Set(R);
975
+ return O.add(b), O;
889
976
  });
890
- const C = Ze(o.current, v), E = pe(C);
891
- i((b) => {
892
- const I = new Map(b);
893
- return I.set(R, E), I;
977
+ const S = rt(o.current, v), _ = Ee(S);
978
+ i((R) => {
979
+ const O = new Map(R);
980
+ return O.set(b, _), O;
894
981
  });
895
982
  }, []);
896
- $(() => O("watch/STATE", l), [l]);
897
- const u = k(async (h, v) => {
898
- await Pe(h, v);
899
- }, []), f = k(async (h, v) => {
900
- await Oe(h, v);
901
- }, []), d = k(async (h) => {
902
- const v = a.get(h);
903
- c((R) => {
904
- if (!R.has(h)) return R;
905
- const C = new Map(R);
906
- return C.delete(h), C;
983
+ W(() => D("watch/STATE", l), [l]);
984
+ const u = U(async (m, v) => {
985
+ await Le(m, v);
986
+ }, []), d = U(async (m, v) => {
987
+ await Ue(m, v);
988
+ }, []), g = U(async (m) => {
989
+ const v = a.get(m);
990
+ c((b) => {
991
+ if (!b.has(m)) return b;
992
+ const S = new Map(b);
993
+ return S.delete(m), S;
907
994
  });
908
995
  try {
909
- await It(h);
910
- } catch (R) {
911
- throw c((C) => {
912
- const E = new Map(C);
913
- return E.set(h, v ?? "Reload failed"), E;
914
- }), R;
996
+ await Pt(m);
997
+ } catch (b) {
998
+ throw c((S) => {
999
+ const _ = new Map(S);
1000
+ return _.set(m, v ?? "Reload failed"), _;
1001
+ }), b;
915
1002
  }
916
- }, [a]), p = [];
917
- for (const h of t) {
918
- const [v, R] = h.split("/", 2), E = (n[v] ?? []).find((ie) => ie.id === R), b = s.get(h), I = b != null && !ne(b), M = b != null && b.errorCount > 0, N = a.get(v);
919
- p.push({
1003
+ }, [a]), h = [];
1004
+ for (const m of t) {
1005
+ const [v, b] = m.split("/", 2), _ = (n[v] ?? []).find((le) => le.id === b), R = s.get(m), O = R != null && !ie(R), q = R != null && R.errorCount > 0, L = a.get(v);
1006
+ h.push({
920
1007
  pluginID: v,
921
- connectionID: R,
922
- name: (E == null ? void 0 : E.name) ?? R,
923
- avatar: (E == null ? void 0 : E.avatar) ?? "",
1008
+ connectionID: b,
1009
+ name: (_ == null ? void 0 : _.name) ?? b,
1010
+ avatar: (_ == null ? void 0 : _.avatar) ?? "",
924
1011
  isStarted: !0,
925
- sync: b,
926
- isSyncing: I,
927
- hasErrors: M || N != null,
928
- pluginFailed: N != null,
929
- pluginError: N
1012
+ sync: R,
1013
+ isSyncing: O,
1014
+ hasErrors: q || L != null,
1015
+ pluginFailed: L != null,
1016
+ pluginError: L
930
1017
  });
931
1018
  }
932
- const g = /* @__PURE__ */ new Map();
933
- for (const h of p) {
934
- const v = g.get(h.pluginID) ?? [];
935
- v.push(h), g.set(h.pluginID, v);
1019
+ const E = /* @__PURE__ */ new Map();
1020
+ for (const m of h) {
1021
+ const v = E.get(m.pluginID) ?? [];
1022
+ v.push(m), E.set(m.pluginID, v);
936
1023
  }
937
- const S = Array.from(s.values()), m = p.filter((h) => h.isSyncing), y = p.filter((h) => h.hasErrors), _ = p.filter((h) => h.pluginFailed);
1024
+ const y = Array.from(s.values()), f = h.filter((m) => m.isSyncing), p = h.filter((m) => m.hasErrors), w = h.filter((m) => m.pluginFailed);
938
1025
  return {
939
- entries: p,
940
- grouped: g,
941
- connectedCount: p.length,
942
- syncingCount: m.length,
943
- errorCount: y.length,
944
- failedCount: _.length,
945
- hasSyncing: Ye(S),
946
- aggregateProgress: Je(S),
1026
+ entries: h,
1027
+ grouped: E,
1028
+ connectedCount: h.length,
1029
+ syncingCount: f.length,
1030
+ errorCount: p.length,
1031
+ failedCount: w.length,
1032
+ hasSyncing: tt(y),
1033
+ aggregateProgress: nt(y),
947
1034
  disconnect: u,
948
- retryWatch: f,
949
- retryPlugin: d
1035
+ retryWatch: d,
1036
+ retryPlugin: g
950
1037
  };
951
1038
  }
952
- function On(t, e) {
1039
+ function Ln(t, e) {
953
1040
  return e === null ? t === null : Array.isArray(e) ? Array.isArray(t) : typeof e == "object" ? typeof t == "object" && t !== null && !Array.isArray(t) : typeof t == typeof e;
954
1041
  }
955
- function is(t, e, n) {
956
- const r = P(t), s = j(), i = [r, "data", e], o = T({
1042
+ function fs(t, e, n) {
1043
+ const r = T(t), s = K(), i = [r, "data", e], o = N({
957
1044
  queryKey: i,
958
1045
  queryFn: async () => {
959
- const c = await Ot(r, e);
960
- return c == null ? n : On(c, n) ? c : (console.warn(
1046
+ const c = await Lt(r, e);
1047
+ return c == null ? n : Ln(c, n) ? c : (console.warn(
961
1048
  `[usePluginData] stored value for "${e}" has unexpected type (expected ${Array.isArray(n) ? "array" : typeof n}, got ${Array.isArray(c) ? "array" : typeof c}). Using default.`
962
1049
  ), n);
963
1050
  }
964
- }), a = A({
1051
+ }), a = P({
965
1052
  mutationFn: async (c) => {
966
- await Tt(r, e, c);
1053
+ await Ut(r, e, c);
967
1054
  },
968
1055
  onMutate: async (c) => {
969
1056
  await s.cancelQueries({ queryKey: i });
@@ -985,19 +1072,19 @@ function is(t, e, n) {
985
1072
  isLoading: o.isLoading
986
1073
  };
987
1074
  }
988
- const as = () => {
989
- const t = Y(Sn);
1075
+ const ps = () => {
1076
+ const t = J(bn);
990
1077
  if (!t) throw new Error("useRightDrawer must be used within a RightDrawerProvider");
991
1078
  return t;
992
- }, Xe = () => {
993
- const t = Y(mn);
1079
+ }, st = () => {
1080
+ const t = J(vn);
994
1081
  if (t === void 0)
995
1082
  throw new Error("useBottomDrawer must be used within a BottomDrawerProvider");
996
1083
  return t;
997
- }, cs = ({ pluginID: t }) => {
998
- const e = P(t), { showSnackbar: n } = W(), { createTab: r, updateTab: s } = Xe();
1084
+ }, gs = ({ pluginID: t }) => {
1085
+ const e = T(t), { showSnackbar: n } = G(), { createTab: r, updateTab: s } = st();
999
1086
  return {
1000
- createSession: A({
1087
+ createSession: P({
1001
1088
  mutationFn: async ({ connectionID: o, icon: a, label: c, opts: l }) => {
1002
1089
  const u = `pending-${crypto.randomUUID()}`;
1003
1090
  r({
@@ -1012,94 +1099,94 @@ const as = () => {
1012
1099
  opts: { ...l }
1013
1100
  }
1014
1101
  });
1015
- const f = sn.createFrom({
1102
+ const d = fn.createFrom({
1016
1103
  command: ["/bin/bash"],
1017
1104
  tty: !0,
1018
1105
  ...l
1019
1106
  });
1020
1107
  try {
1021
- const d = await At(e, o, f);
1022
- if (!d) throw new Error("Failed to create session: null response");
1108
+ const g = await kt(e, o, d);
1109
+ if (!g) throw new Error("Failed to create session: null response");
1023
1110
  s(
1024
1111
  { id: u },
1025
1112
  {
1026
- id: d.id,
1027
- title: c ?? `Session ${d.id.substring(0, 8)}`,
1113
+ id: g.id,
1114
+ title: c ?? `Session ${g.id.substring(0, 8)}`,
1028
1115
  properties: { status: "connected", pluginID: e, connectionID: o, opts: { ...l } }
1029
1116
  }
1030
1117
  );
1031
- } catch (d) {
1032
- const p = Q(d);
1118
+ } catch (g) {
1119
+ const h = Q(g);
1033
1120
  s(
1034
1121
  { id: u },
1035
1122
  {
1036
- properties: { status: "error", error: p.detail, pluginID: e, connectionID: o, opts: { ...l } }
1123
+ properties: { status: "error", error: h.detail, pluginID: e, connectionID: o, opts: { ...l } }
1037
1124
  }
1038
- ), z(n, d, "Failed to start session");
1125
+ ), B(n, g, "Failed to start session");
1039
1126
  }
1040
1127
  }
1041
1128
  }).mutateAsync
1042
1129
  };
1043
- }, us = ({ pluginID: t }) => {
1044
- const e = P(t), { showSnackbar: n } = W(), { createTab: r } = Xe(), s = A({
1130
+ }, hs = ({ pluginID: t }) => {
1131
+ const e = T(t), { showSnackbar: n } = G(), { createTab: r } = st(), s = P({
1045
1132
  mutationFn: async ({
1046
1133
  connectionID: o,
1047
1134
  resourceKey: a,
1048
1135
  resourceID: c,
1049
1136
  resourceData: l,
1050
1137
  icon: u,
1051
- label: f,
1052
- target: d,
1053
- follow: p = !0,
1054
- tailLines: g = 1e3,
1055
- params: S
1138
+ label: d,
1139
+ target: g,
1140
+ follow: h = !0,
1141
+ tailLines: E = 1e3,
1142
+ params: y
1056
1143
  }) => {
1057
- const m = on.createFrom({
1144
+ const f = pn.createFrom({
1058
1145
  resource_key: a,
1059
1146
  resource_id: c,
1060
1147
  resource_data: l,
1061
- options: an.createFrom({
1062
- target: d ?? "",
1063
- follow: p,
1148
+ options: gn.createFrom({
1149
+ target: g ?? "",
1150
+ follow: h,
1064
1151
  include_previous: !1,
1065
1152
  include_timestamps: !0,
1066
- tail_lines: g,
1153
+ tail_lines: E,
1067
1154
  since_seconds: 0,
1068
1155
  limit_bytes: 0,
1069
1156
  include_source_events: !0,
1070
- params: S ?? {}
1157
+ params: y ?? {}
1071
1158
  })
1072
- }), y = await Dt(e, o, m);
1073
- if (!y) throw new Error("Failed to create log session: null response");
1159
+ }), p = await qt(e, o, f);
1160
+ if (!p) throw new Error("Failed to create log session: null response");
1074
1161
  return r({
1075
- id: y.id,
1076
- title: f ?? `Logs ${y.id.substring(0, 8)}`,
1162
+ id: p.id,
1163
+ title: d ?? `Logs ${p.id.substring(0, 8)}`,
1077
1164
  variant: "logs",
1078
1165
  icon: u ?? "LuLogs"
1079
- }), y;
1166
+ }), p;
1080
1167
  },
1081
- onError: L(n, "Failed to start log session")
1082
- }), i = A({
1168
+ onError: k(n, "Failed to start log session")
1169
+ }), i = P({
1083
1170
  mutationFn: async (o) => {
1084
- await xt(o);
1171
+ await Mt(o);
1085
1172
  },
1086
- onError: L(n, "Failed to close log session")
1173
+ onError: k(n, "Failed to close log session")
1087
1174
  });
1088
1175
  return {
1089
1176
  createLogSession: s.mutateAsync,
1090
1177
  closeLogSession: i.mutateAsync
1091
1178
  };
1092
- }, ls = () => T({
1179
+ }, ys = () => N({
1093
1180
  queryKey: ["metric", "providers"],
1094
- queryFn: Nt,
1181
+ queryFn: $t,
1095
1182
  staleTime: 3e4
1096
- }), Tn = (t) => T({
1183
+ }), Un = (t) => N({
1097
1184
  queryKey: ["metric", "providers", t],
1098
- queryFn: () => kt(t),
1185
+ queryFn: () => Wt(t),
1099
1186
  enabled: !!t,
1100
1187
  staleTime: 3e4
1101
- }), ds = (t) => {
1102
- var m, y;
1188
+ }), ms = (t) => {
1189
+ var f, p;
1103
1190
  const {
1104
1191
  connectionID: e,
1105
1192
  resourceKey: n,
@@ -1113,12 +1200,12 @@ const as = () => {
1113
1200
  refreshInterval: l = 0,
1114
1201
  enabled: u = !0
1115
1202
  } = t, {
1116
- data: f,
1117
- isLoading: d
1118
- } = Tn(n), p = f ?? [], g = c ? Math.max(
1203
+ data: d,
1204
+ isLoading: g
1205
+ } = Un(n), h = d ?? [], E = c ? Math.max(
1119
1206
  Math.floor((c.end.getTime() - c.start.getTime()) / 250),
1120
1207
  15e3
1121
- ) * 1e6 : 0, S = T({
1208
+ ) * 1e6 : 0, y = N({
1122
1209
  queryKey: [
1123
1210
  "metric",
1124
1211
  "query",
@@ -1128,11 +1215,11 @@ const as = () => {
1128
1215
  s,
1129
1216
  o,
1130
1217
  a,
1131
- (m = c == null ? void 0 : c.start) == null ? void 0 : m.getTime(),
1132
- (y = c == null ? void 0 : c.end) == null ? void 0 : y.getTime()
1218
+ (f = c == null ? void 0 : c.start) == null ? void 0 : f.getTime(),
1219
+ (p = c == null ? void 0 : c.end) == null ? void 0 : p.getTime()
1133
1220
  ],
1134
1221
  queryFn: async () => {
1135
- const _ = await Lt(
1222
+ const w = await Gt(
1136
1223
  e,
1137
1224
  n,
1138
1225
  r,
@@ -1142,27 +1229,27 @@ const as = () => {
1142
1229
  a,
1143
1230
  ((c == null ? void 0 : c.start) ?? /* @__PURE__ */ new Date(0)).toISOString(),
1144
1231
  ((c == null ? void 0 : c.end) ?? /* @__PURE__ */ new Date(0)).toISOString(),
1145
- g
1146
- ), h = {};
1147
- for (const [v, R] of Object.entries(_))
1148
- R != null && (h[v] = R);
1149
- return h;
1232
+ E
1233
+ ), m = {};
1234
+ for (const [v, b] of Object.entries(w))
1235
+ b != null && (m[v] = b);
1236
+ return m;
1150
1237
  },
1151
- enabled: u && !!e && !!n && (n.startsWith("cluster::") || !!r) && p.length > 0,
1238
+ enabled: u && !!e && !!n && (n.startsWith("cluster::") || !!r) && h.length > 0,
1152
1239
  refetchInterval: l > 0 ? l : void 0,
1153
1240
  staleTime: 5e3,
1154
1241
  // Keep previous data visible while fetching new data (e.g. on time range change)
1155
1242
  // to prevent the chart from blinking empty.
1156
- placeholderData: We
1243
+ placeholderData: ze
1157
1244
  });
1158
1245
  return {
1159
- data: S.data ?? void 0,
1160
- providers: p,
1161
- isLoading: d || S.isLoading,
1162
- error: S.error,
1163
- refetch: S.refetch
1246
+ data: y.data ?? void 0,
1247
+ providers: h,
1248
+ isLoading: g || y.isLoading,
1249
+ error: y.error,
1250
+ refetch: y.refetch
1164
1251
  };
1165
- }, fs = (t) => {
1252
+ }, Es = (t) => {
1166
1253
  const {
1167
1254
  pluginID: e,
1168
1255
  connectionID: n,
@@ -1173,10 +1260,10 @@ const as = () => {
1173
1260
  metricIDs: a = [],
1174
1261
  interval: c = 1e4,
1175
1262
  enabled: l = !0
1176
- } = t, u = P(e), [f, d] = G(null), [p, g] = G(null), [S, m] = G(!1), [y, _] = G(null), h = q(null), v = k(async () => {
1263
+ } = t, u = T(e), [d, g] = j(null), [h, E] = j(null), [y, f] = j(!1), [p, w] = j(null), m = M(null), v = U(async () => {
1177
1264
  if (!(!l || !u || !n || !r || !s))
1178
1265
  try {
1179
- const C = await Mt(u, n, {
1266
+ const S = await jt(u, n, {
1180
1267
  resource_key: r,
1181
1268
  resource_id: s,
1182
1269
  resource_namespace: i,
@@ -1185,97 +1272,97 @@ const as = () => {
1185
1272
  interval: c * 1e6
1186
1273
  // ms to nanoseconds for Go time.Duration
1187
1274
  });
1188
- g(C), m(!0), _(null);
1189
- const E = O(`core/metrics/data/${C}`, (I) => {
1190
- const M = I.data;
1275
+ E(S), f(!0), w(null);
1276
+ const _ = D(`core/metrics/data/${S}`, (O) => {
1277
+ const q = O.data;
1191
1278
  try {
1192
- const N = JSON.parse(M);
1193
- N.results && d(N.results);
1194
- } catch (N) {
1195
- console.error("Failed to parse metric stream data:", N);
1279
+ const L = JSON.parse(q);
1280
+ L.results && g(L.results);
1281
+ } catch (L) {
1282
+ console.error("Failed to parse metric stream data:", L);
1196
1283
  }
1197
- }), b = O(`core/metrics/error/${C}`, (I) => {
1198
- const M = I.data;
1284
+ }), R = D(`core/metrics/error/${S}`, (O) => {
1285
+ const q = O.data;
1199
1286
  try {
1200
- const N = JSON.parse(M);
1201
- _(N.error || "Unknown error");
1287
+ const L = JSON.parse(q);
1288
+ w(L.error || "Unknown error");
1202
1289
  } catch {
1203
- _("Failed to parse metric stream error");
1290
+ w("Failed to parse metric stream error");
1204
1291
  }
1205
1292
  });
1206
- h.current = () => {
1207
- E(), b();
1293
+ m.current = () => {
1294
+ _(), R();
1208
1295
  };
1209
- } catch (C) {
1210
- _(C instanceof Error ? C.message : String(C));
1296
+ } catch (S) {
1297
+ w(S instanceof Error ? S.message : String(S));
1211
1298
  }
1212
- }, [u, n, r, s, i, a, c, l]), R = k(async () => {
1213
- if (p)
1299
+ }, [u, n, r, s, i, a, c, l]), b = U(async () => {
1300
+ if (h)
1214
1301
  try {
1215
- await Ce(p);
1216
- } catch (C) {
1217
- console.error("Failed to unsubscribe:", C);
1302
+ await Oe(h);
1303
+ } catch (S) {
1304
+ console.error("Failed to unsubscribe:", S);
1218
1305
  }
1219
- h.current && (h.current(), h.current = null), g(null), m(!1);
1220
- }, [p]);
1221
- return $(() => () => {
1222
- p && Ce(p).catch(console.error), h.current && h.current();
1223
- }, [p]), {
1224
- data: f,
1225
- subscriptionID: p,
1226
- isStreaming: S,
1227
- error: y,
1306
+ m.current && (m.current(), m.current = null), E(null), f(!1);
1307
+ }, [h]);
1308
+ return W(() => () => {
1309
+ h && Oe(h).catch(console.error), m.current && m.current();
1310
+ }, [h]), {
1311
+ data: d,
1312
+ subscriptionID: h,
1313
+ isStreaming: y,
1314
+ error: p,
1228
1315
  start: v,
1229
- stop: R
1316
+ stop: b
1230
1317
  };
1231
- }, B = ["networker", "portforward", "all-sessions"];
1232
- function ps() {
1233
- const { showSnackbar: t } = W(), e = j(), n = T({
1234
- queryKey: [...B],
1235
- queryFn: async () => qt().catch((i) => {
1318
+ }, Y = ["networker", "portforward", "all-sessions"];
1319
+ function Ss() {
1320
+ const { showSnackbar: t } = G(), e = K(), n = N({
1321
+ queryKey: [...Y],
1322
+ queryFn: async () => Qt().catch((i) => {
1236
1323
  if (Q(i).detail.includes("not found")) return [];
1237
1324
  throw i;
1238
1325
  }),
1239
1326
  retry: !1
1240
1327
  });
1241
- $(() => {
1242
- const i = O("core/networker/portforward/created", () => {
1243
- e.invalidateQueries({ queryKey: [...B] });
1244
- }), o = O("core/networker/portforward/closed", () => {
1245
- e.invalidateQueries({ queryKey: [...B] });
1328
+ W(() => {
1329
+ const i = D("core/networker/portforward/created", () => {
1330
+ e.invalidateQueries({ queryKey: [...Y] });
1331
+ }), o = D("core/networker/portforward/closed", () => {
1332
+ e.invalidateQueries({ queryKey: [...Y] });
1246
1333
  });
1247
1334
  return () => {
1248
1335
  i(), o();
1249
1336
  };
1250
1337
  }, [e]);
1251
- const r = n.data ?? [], s = A({
1252
- mutationFn: async (i) => Te(i),
1253
- onError: L(t, "Failed to close port forwarding session"),
1338
+ const r = n.data ?? [], s = P({
1339
+ mutationFn: async (i) => ke(i),
1340
+ onError: k(t, "Failed to close port forwarding session"),
1254
1341
  onSuccess: async () => {
1255
- await e.invalidateQueries({ queryKey: [...B] });
1342
+ await e.invalidateQueries({ queryKey: [...Y] });
1256
1343
  }
1257
1344
  });
1258
1345
  return {
1259
1346
  sessions: n,
1260
1347
  activeSessions: r,
1261
1348
  closeSession: s.mutateAsync,
1262
- openInBrowser: (i) => $e(`http://localhost:${i}`)
1349
+ openInBrowser: (i) => Be(`http://localhost:${i}`)
1263
1350
  };
1264
1351
  }
1265
- function gs({ pluginID: t, connectionID: e, resourceID: n }) {
1266
- const r = P(t), s = ["networker", "portforward", "sessions", r, e, n], { showSnackbar: i } = W(), o = j(), a = T({
1352
+ function _s({ pluginID: t, connectionID: e, resourceID: n }) {
1353
+ const r = T(t), s = ["networker", "portforward", "sessions", r, e, n], { showSnackbar: i } = G(), o = K(), a = N({
1267
1354
  queryKey: s,
1268
- queryFn: async () => Ut(r, e, cn.createFrom({
1355
+ queryFn: async () => Kt(r, e, hn.createFrom({
1269
1356
  resource_id: n,
1270
1357
  connection_id: e
1271
1358
  })).catch((u) => {
1272
- const f = Q(u);
1273
- return f.detail.includes("not found") ? [] : (i({ message: "Failed to fetch port forward sessions", status: "error", details: f.detail }), []);
1359
+ const d = Q(u);
1360
+ return d.detail.includes("not found") ? [] : (i({ message: "Failed to fetch port forward sessions", status: "error", details: d.detail }), []);
1274
1361
  }),
1275
1362
  retry: !1
1276
- }), c = A({
1363
+ }), c = P({
1277
1364
  mutationFn: async ({ opts: u }) => {
1278
- const f = un.createFrom({
1365
+ const d = yn.createFrom({
1279
1366
  local_port: u.localPort || 0,
1280
1367
  remote_port: u.remotePort,
1281
1368
  protocol: u.protocol || "TCP",
@@ -1289,24 +1376,24 @@ function gs({ pluginID: t, connectionID: e, resourceID: n }) {
1289
1376
  },
1290
1377
  labels: u.labels ?? {},
1291
1378
  params: u.parameters ?? {}
1292
- }), d = await $t(r, e, f);
1293
- if (!d) throw new Error("Failed to start port forwarding: null response");
1294
- return u.openInBrowser && $e(`http://localhost:${d.local_port}`), d;
1379
+ }), g = await Ht(r, e, d);
1380
+ if (!g) throw new Error("Failed to start port forwarding: null response");
1381
+ return u.openInBrowser && Be(`http://localhost:${g.local_port}`), g;
1295
1382
  },
1296
- onError: L(i, "Failed to start port forwarding session"),
1383
+ onError: k(i, "Failed to start port forwarding session"),
1297
1384
  onSuccess: async () => {
1298
1385
  await Promise.all([
1299
1386
  o.invalidateQueries({ queryKey: s }),
1300
- o.invalidateQueries({ queryKey: [...B] })
1387
+ o.invalidateQueries({ queryKey: [...Y] })
1301
1388
  ]);
1302
1389
  }
1303
- }), l = A({
1304
- mutationFn: async ({ opts: u }) => Te(u.sessionID),
1305
- onError: L(i, "Failed to close port forwarding session"),
1390
+ }), l = P({
1391
+ mutationFn: async ({ opts: u }) => ke(u.sessionID),
1392
+ onError: k(i, "Failed to close port forwarding session"),
1306
1393
  onSuccess: async () => {
1307
1394
  await Promise.all([
1308
1395
  o.invalidateQueries({ queryKey: s }),
1309
- o.invalidateQueries({ queryKey: [...B] })
1396
+ o.invalidateQueries({ queryKey: [...Y] })
1310
1397
  ]);
1311
1398
  }
1312
1399
  });
@@ -1316,46 +1403,46 @@ function gs({ pluginID: t, connectionID: e, resourceID: n }) {
1316
1403
  close: l.mutateAsync
1317
1404
  };
1318
1405
  }
1319
- const ys = () => {
1320
- const t = w.useContext(_n);
1406
+ const Cs = () => {
1407
+ const t = C.useContext(Rn);
1321
1408
  if (!t) throw new Error("useConfirmationModal must be used within a ConfirmationModalProvider");
1322
1409
  return t;
1323
- }, hs = ({
1410
+ }, ws = ({
1324
1411
  pluginID: t,
1325
1412
  connectionID: e,
1326
1413
  resourceKey: n,
1327
1414
  resourceID: r,
1328
1415
  namespace: s = ""
1329
1416
  }) => {
1330
- const i = P(t), o = j(), { showSnackbar: a } = W(), c = ["RESOURCE", i, e, n, r, s], { mutateAsync: l } = A({
1331
- mutationFn: async (d) => Ae(i, e, n, ke.createFrom({
1332
- input: d.input,
1417
+ const i = T(t), o = K(), { showSnackbar: a } = G(), c = ["RESOURCE", i, e, n, r, s], { mutateAsync: l } = P({
1418
+ mutationFn: async (g) => qe(i, e, n, Ge.createFrom({
1419
+ input: g.input,
1333
1420
  id: r,
1334
1421
  namespace: s
1335
1422
  })),
1336
1423
  onSuccess: async () => {
1337
1424
  a(`Resource ${r} updated`, "success"), await o.invalidateQueries({ queryKey: c });
1338
1425
  },
1339
- onError: L(a, `Failed to update resource ${r}`)
1340
- }), { mutateAsync: u } = A({
1341
- mutationFn: async (d = {}) => De(i, e, n, Le.createFrom({
1426
+ onError: k(a, `Failed to update resource ${r}`)
1427
+ }), { mutateAsync: u } = P({
1428
+ mutationFn: async (g = {}) => Me(i, e, n, je.createFrom({
1342
1429
  id: r,
1343
1430
  namespace: s,
1344
- gracePeriodSeconds: d.gracePeriodSeconds
1431
+ gracePeriodSeconds: g.gracePeriodSeconds
1345
1432
  })),
1346
1433
  onSuccess: async () => {
1347
1434
  a(`Resource ${r} deleted`, "success"), await o.invalidateQueries({ queryKey: c });
1348
1435
  },
1349
- onError: L(a, `Failed to delete resource ${r}`)
1436
+ onError: k(a, `Failed to delete resource ${r}`)
1350
1437
  });
1351
1438
  return {
1352
1439
  /**
1353
1440
  * Fetch result for the resource. The client will automatically cache the result, and update the cache
1354
1441
  * when the resource is updated or deleted via the returned update and remove mutation functions.
1355
1442
  */
1356
- resource: T({
1443
+ resource: N({
1357
1444
  queryKey: c,
1358
- queryFn: async () => Wt(i, e, n, ln.createFrom({
1445
+ queryFn: async () => Bt(i, e, n, mn.createFrom({
1359
1446
  id: r,
1360
1447
  namespace: s
1361
1448
  })),
@@ -1376,40 +1463,40 @@ const ys = () => {
1376
1463
  */
1377
1464
  remove: u
1378
1465
  };
1379
- }, ms = (t) => {
1466
+ }, vs = (t) => {
1380
1467
  const e = ["component", t.plugin, t.resource, t.area];
1381
1468
  return {
1382
1469
  /**
1383
1470
  * Fetch result for the resource. The client will automatically cache the result, and update the cache
1384
1471
  * when the resource is updated or deleted via the returned update and remove mutation functions.
1385
1472
  */
1386
- component: T({
1473
+ component: N({
1387
1474
  queryKey: e,
1388
- queryFn: async () => Gt(t)
1475
+ queryFn: async () => zt(t)
1389
1476
  })
1390
1477
  };
1391
- }, Ss = ({ pluginID: t, connectionID: e }) => {
1392
- const n = P(t);
1478
+ }, bs = ({ pluginID: t, connectionID: e }) => {
1479
+ const n = T(t);
1393
1480
  return {
1394
1481
  /**
1395
1482
  * The resource groups for the given plugin and connection.
1396
1483
  */
1397
- groups: T({
1484
+ groups: N({
1398
1485
  queryKey: [n, "resource_groups", "list"],
1399
- queryFn: async () => jt(n, e),
1486
+ queryFn: async () => Vt(n, e),
1400
1487
  retry: !1
1401
1488
  })
1402
1489
  };
1403
- }, _s = ({
1490
+ }, Rs = ({
1404
1491
  pluginID: t,
1405
1492
  connectionID: e,
1406
1493
  searches: n
1407
1494
  }) => {
1408
- const r = P(t), s = (o) => [r, e, o.key, o.namespaces, "list"];
1409
- return dn({
1495
+ const r = T(t), s = (o) => [r, e, o.key, o.namespaces, "list"];
1496
+ return En({
1410
1497
  queries: n.map((o) => ({
1411
1498
  queryKey: s(o),
1412
- queryFn: async () => xe(r, e, o.key, Me.createFrom({
1499
+ queryFn: async () => $e(r, e, o.key, Qe.createFrom({
1413
1500
  order: [{ field: "name", descending: !1 }],
1414
1501
  pagination: { page: 1, pageSize: 200 },
1415
1502
  namespaces: o.namespaces
@@ -1417,40 +1504,40 @@ const ys = () => {
1417
1504
  retry: !1
1418
1505
  }))
1419
1506
  });
1420
- }, Es = ({ pluginID: t, resourceKey: e }) => {
1421
- const n = P(t);
1507
+ }, Is = ({ pluginID: t, resourceKey: e }) => {
1508
+ const n = T(t);
1422
1509
  return {
1423
1510
  /**
1424
1511
  * The current settings from the provider.
1425
1512
  */
1426
- resourceType: T({
1513
+ resourceType: N({
1427
1514
  queryKey: [n, "resources", e],
1428
- queryFn: async () => Qt(n, e),
1515
+ queryFn: async () => Yt(n, e),
1429
1516
  retry: !1
1430
1517
  })
1431
1518
  };
1432
- }, ws = ({ pluginID: t, connectionID: e }) => {
1433
- const n = P(t);
1519
+ }, Os = ({ pluginID: t, connectionID: e }) => {
1520
+ const n = T(t);
1434
1521
  return {
1435
1522
  /**
1436
1523
  * The resource types for the given plugin and connection.
1437
1524
  */
1438
- types: T({
1525
+ types: N({
1439
1526
  queryKey: [n, "resources", "list", e],
1440
- queryFn: async () => Kt(n, e),
1527
+ queryFn: async () => Jt(n, e),
1441
1528
  retry: !1
1442
1529
  })
1443
1530
  };
1444
1531
  };
1445
- var ee = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1446
- function An(t) {
1532
+ var ne = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1533
+ function kn(t) {
1447
1534
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
1448
1535
  }
1449
- var Dn = "Expected a function", Ve = "__lodash_hash_undefined__", xn = "[object Function]", Nn = "[object GeneratorFunction]", kn = "[object Symbol]", Ln = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Mn = /^\w*$/, qn = /^\./, Un = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, $n = /[\\^$.*+?()[\]{}|]/g, Wn = /\\(\\)?/g, Gn = /^\[object .+?Constructor\]$/, jn = typeof ee == "object" && ee && ee.Object === Object && ee, Qn = typeof self == "object" && self && self.Object === Object && self, me = jn || Qn || Function("return this")();
1450
- function Kn(t, e) {
1536
+ var qn = "Expected a function", ot = "__lodash_hash_undefined__", Mn = "[object Function]", $n = "[object GeneratorFunction]", Wn = "[object Symbol]", Gn = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, jn = /^\w*$/, Qn = /^\./, Kn = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, Hn = /[\\^$.*+?()[\]{}|]/g, Bn = /\\(\\)?/g, zn = /^\[object .+?Constructor\]$/, Vn = typeof ne == "object" && ne && ne.Object === Object && ne, Yn = typeof self == "object" && self && self.Object === Object && self, we = Vn || Yn || Function("return this")();
1537
+ function Jn(t, e) {
1451
1538
  return t == null ? void 0 : t[e];
1452
1539
  }
1453
- function Hn(t) {
1540
+ function Xn(t) {
1454
1541
  var e = !1;
1455
1542
  if (t != null && typeof t.toString != "function")
1456
1543
  try {
@@ -1459,177 +1546,177 @@ function Hn(t) {
1459
1546
  }
1460
1547
  return e;
1461
1548
  }
1462
- var Bn = Array.prototype, zn = Function.prototype, et = Object.prototype, le = me["__core-js_shared__"], ve = function() {
1463
- var t = /[^.]+$/.exec(le && le.keys && le.keys.IE_PROTO || "");
1549
+ var Zn = Array.prototype, er = Function.prototype, it = Object.prototype, he = we["__core-js_shared__"], De = function() {
1550
+ var t = /[^.]+$/.exec(he && he.keys && he.keys.IE_PROTO || "");
1464
1551
  return t ? "Symbol(src)_1." + t : "";
1465
- }(), tt = zn.toString, Se = et.hasOwnProperty, nt = et.toString, Yn = RegExp(
1466
- "^" + tt.call(Se).replace($n, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
1467
- ), Re = me.Symbol, Jn = Bn.splice, Zn = rt(me, "Map"), Z = rt(Object, "create"), Fe = Re ? Re.prototype : void 0, Ie = Fe ? Fe.toString : void 0;
1468
- function K(t) {
1552
+ }(), at = er.toString, ve = it.hasOwnProperty, ct = it.toString, tr = RegExp(
1553
+ "^" + at.call(ve).replace(Hn, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
1554
+ ), Ne = we.Symbol, nr = Zn.splice, rr = ut(we, "Map"), Z = ut(Object, "create"), Pe = Ne ? Ne.prototype : void 0, xe = Pe ? Pe.toString : void 0;
1555
+ function z(t) {
1469
1556
  var e = -1, n = t ? t.length : 0;
1470
1557
  for (this.clear(); ++e < n; ) {
1471
1558
  var r = t[e];
1472
1559
  this.set(r[0], r[1]);
1473
1560
  }
1474
1561
  }
1475
- function Xn() {
1562
+ function sr() {
1476
1563
  this.__data__ = Z ? Z(null) : {};
1477
1564
  }
1478
- function Vn(t) {
1565
+ function or(t) {
1479
1566
  return this.has(t) && delete this.__data__[t];
1480
1567
  }
1481
- function er(t) {
1568
+ function ir(t) {
1482
1569
  var e = this.__data__;
1483
1570
  if (Z) {
1484
1571
  var n = e[t];
1485
- return n === Ve ? void 0 : n;
1572
+ return n === ot ? void 0 : n;
1486
1573
  }
1487
- return Se.call(e, t) ? e[t] : void 0;
1574
+ return ve.call(e, t) ? e[t] : void 0;
1488
1575
  }
1489
- function tr(t) {
1576
+ function ar(t) {
1490
1577
  var e = this.__data__;
1491
- return Z ? e[t] !== void 0 : Se.call(e, t);
1578
+ return Z ? e[t] !== void 0 : ve.call(e, t);
1492
1579
  }
1493
- function nr(t, e) {
1580
+ function cr(t, e) {
1494
1581
  var n = this.__data__;
1495
- return n[t] = Z && e === void 0 ? Ve : e, this;
1496
- }
1497
- K.prototype.clear = Xn;
1498
- K.prototype.delete = Vn;
1499
- K.prototype.get = er;
1500
- K.prototype.has = tr;
1501
- K.prototype.set = nr;
1502
- function J(t) {
1582
+ return n[t] = Z && e === void 0 ? ot : e, this;
1583
+ }
1584
+ z.prototype.clear = sr;
1585
+ z.prototype.delete = or;
1586
+ z.prototype.get = ir;
1587
+ z.prototype.has = ar;
1588
+ z.prototype.set = cr;
1589
+ function X(t) {
1503
1590
  var e = -1, n = t ? t.length : 0;
1504
1591
  for (this.clear(); ++e < n; ) {
1505
1592
  var r = t[e];
1506
1593
  this.set(r[0], r[1]);
1507
1594
  }
1508
1595
  }
1509
- function rr() {
1596
+ function ur() {
1510
1597
  this.__data__ = [];
1511
1598
  }
1512
- function sr(t) {
1513
- var e = this.__data__, n = se(e, t);
1599
+ function lr(t) {
1600
+ var e = this.__data__, n = ce(e, t);
1514
1601
  if (n < 0)
1515
1602
  return !1;
1516
1603
  var r = e.length - 1;
1517
- return n == r ? e.pop() : Jn.call(e, n, 1), !0;
1604
+ return n == r ? e.pop() : nr.call(e, n, 1), !0;
1518
1605
  }
1519
- function or(t) {
1520
- var e = this.__data__, n = se(e, t);
1606
+ function dr(t) {
1607
+ var e = this.__data__, n = ce(e, t);
1521
1608
  return n < 0 ? void 0 : e[n][1];
1522
1609
  }
1523
- function ir(t) {
1524
- return se(this.__data__, t) > -1;
1610
+ function fr(t) {
1611
+ return ce(this.__data__, t) > -1;
1525
1612
  }
1526
- function ar(t, e) {
1527
- var n = this.__data__, r = se(n, t);
1613
+ function pr(t, e) {
1614
+ var n = this.__data__, r = ce(n, t);
1528
1615
  return r < 0 ? n.push([t, e]) : n[r][1] = e, this;
1529
1616
  }
1530
- J.prototype.clear = rr;
1531
- J.prototype.delete = sr;
1532
- J.prototype.get = or;
1533
- J.prototype.has = ir;
1534
- J.prototype.set = ar;
1535
- function H(t) {
1617
+ X.prototype.clear = ur;
1618
+ X.prototype.delete = lr;
1619
+ X.prototype.get = dr;
1620
+ X.prototype.has = fr;
1621
+ X.prototype.set = pr;
1622
+ function V(t) {
1536
1623
  var e = -1, n = t ? t.length : 0;
1537
1624
  for (this.clear(); ++e < n; ) {
1538
1625
  var r = t[e];
1539
1626
  this.set(r[0], r[1]);
1540
1627
  }
1541
1628
  }
1542
- function cr() {
1629
+ function gr() {
1543
1630
  this.__data__ = {
1544
- hash: new K(),
1545
- map: new (Zn || J)(),
1546
- string: new K()
1631
+ hash: new z(),
1632
+ map: new (rr || X)(),
1633
+ string: new z()
1547
1634
  };
1548
1635
  }
1549
- function ur(t) {
1550
- return oe(this, t).delete(t);
1636
+ function hr(t) {
1637
+ return ue(this, t).delete(t);
1551
1638
  }
1552
- function lr(t) {
1553
- return oe(this, t).get(t);
1639
+ function yr(t) {
1640
+ return ue(this, t).get(t);
1554
1641
  }
1555
- function dr(t) {
1556
- return oe(this, t).has(t);
1642
+ function mr(t) {
1643
+ return ue(this, t).has(t);
1557
1644
  }
1558
- function fr(t, e) {
1559
- return oe(this, t).set(t, e), this;
1645
+ function Er(t, e) {
1646
+ return ue(this, t).set(t, e), this;
1560
1647
  }
1561
- H.prototype.clear = cr;
1562
- H.prototype.delete = ur;
1563
- H.prototype.get = lr;
1564
- H.prototype.has = dr;
1565
- H.prototype.set = fr;
1566
- function se(t, e) {
1648
+ V.prototype.clear = gr;
1649
+ V.prototype.delete = hr;
1650
+ V.prototype.get = yr;
1651
+ V.prototype.has = mr;
1652
+ V.prototype.set = Er;
1653
+ function ce(t, e) {
1567
1654
  for (var n = t.length; n--; )
1568
- if (br(t[n][0], e))
1655
+ if (Tr(t[n][0], e))
1569
1656
  return n;
1570
1657
  return -1;
1571
1658
  }
1572
- function pr(t, e) {
1573
- e = mr(e, t) ? [e] : hr(e);
1659
+ function Sr(t, e) {
1660
+ e = vr(e, t) ? [e] : wr(e);
1574
1661
  for (var n = 0, r = e.length; t != null && n < r; )
1575
- t = t[wr(e[n++])];
1662
+ t = t[Or(e[n++])];
1576
1663
  return n && n == r ? t : void 0;
1577
1664
  }
1578
- function gr(t) {
1579
- if (!ot(t) || _r(t))
1665
+ function _r(t) {
1666
+ if (!dt(t) || Rr(t))
1580
1667
  return !1;
1581
- var e = vr(t) || Hn(t) ? Yn : Gn;
1582
- return e.test(Cr(t));
1668
+ var e = Fr(t) || Xn(t) ? tr : zn;
1669
+ return e.test(Ar(t));
1583
1670
  }
1584
- function yr(t) {
1671
+ function Cr(t) {
1585
1672
  if (typeof t == "string")
1586
1673
  return t;
1587
- if (Ee(t))
1588
- return Ie ? Ie.call(t) : "";
1674
+ if (Re(t))
1675
+ return xe ? xe.call(t) : "";
1589
1676
  var e = t + "";
1590
1677
  return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
1591
1678
  }
1592
- function hr(t) {
1593
- return st(t) ? t : Er(t);
1679
+ function wr(t) {
1680
+ return lt(t) ? t : Ir(t);
1594
1681
  }
1595
- function oe(t, e) {
1682
+ function ue(t, e) {
1596
1683
  var n = t.__data__;
1597
- return Sr(e) ? n[typeof e == "string" ? "string" : "hash"] : n.map;
1684
+ return br(e) ? n[typeof e == "string" ? "string" : "hash"] : n.map;
1598
1685
  }
1599
- function rt(t, e) {
1600
- var n = Kn(t, e);
1601
- return gr(n) ? n : void 0;
1686
+ function ut(t, e) {
1687
+ var n = Jn(t, e);
1688
+ return _r(n) ? n : void 0;
1602
1689
  }
1603
- function mr(t, e) {
1604
- if (st(t))
1690
+ function vr(t, e) {
1691
+ if (lt(t))
1605
1692
  return !1;
1606
1693
  var n = typeof t;
1607
- return n == "number" || n == "symbol" || n == "boolean" || t == null || Ee(t) ? !0 : Mn.test(t) || !Ln.test(t) || e != null && t in Object(e);
1694
+ return n == "number" || n == "symbol" || n == "boolean" || t == null || Re(t) ? !0 : jn.test(t) || !Gn.test(t) || e != null && t in Object(e);
1608
1695
  }
1609
- function Sr(t) {
1696
+ function br(t) {
1610
1697
  var e = typeof t;
1611
1698
  return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
1612
1699
  }
1613
- function _r(t) {
1614
- return !!ve && ve in t;
1700
+ function Rr(t) {
1701
+ return !!De && De in t;
1615
1702
  }
1616
- var Er = _e(function(t) {
1617
- t = Fr(t);
1703
+ var Ir = be(function(t) {
1704
+ t = Nr(t);
1618
1705
  var e = [];
1619
- return qn.test(t) && e.push(""), t.replace(Un, function(n, r, s, i) {
1620
- e.push(s ? i.replace(Wn, "$1") : r || n);
1706
+ return Qn.test(t) && e.push(""), t.replace(Kn, function(n, r, s, i) {
1707
+ e.push(s ? i.replace(Bn, "$1") : r || n);
1621
1708
  }), e;
1622
1709
  });
1623
- function wr(t) {
1624
- if (typeof t == "string" || Ee(t))
1710
+ function Or(t) {
1711
+ if (typeof t == "string" || Re(t))
1625
1712
  return t;
1626
1713
  var e = t + "";
1627
1714
  return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
1628
1715
  }
1629
- function Cr(t) {
1716
+ function Ar(t) {
1630
1717
  if (t != null) {
1631
1718
  try {
1632
- return tt.call(t);
1719
+ return at.call(t);
1633
1720
  } catch {
1634
1721
  }
1635
1722
  try {
@@ -1639,9 +1726,9 @@ function Cr(t) {
1639
1726
  }
1640
1727
  return "";
1641
1728
  }
1642
- function _e(t, e) {
1729
+ function be(t, e) {
1643
1730
  if (typeof t != "function" || e && typeof e != "function")
1644
- throw new TypeError(Dn);
1731
+ throw new TypeError(qn);
1645
1732
  var n = function() {
1646
1733
  var r = arguments, s = e ? e.apply(this, r) : r[0], i = n.cache;
1647
1734
  if (i.has(s))
@@ -1649,52 +1736,52 @@ function _e(t, e) {
1649
1736
  var o = t.apply(this, r);
1650
1737
  return n.cache = i.set(s, o), o;
1651
1738
  };
1652
- return n.cache = new (_e.Cache || H)(), n;
1739
+ return n.cache = new (be.Cache || V)(), n;
1653
1740
  }
1654
- _e.Cache = H;
1655
- function br(t, e) {
1741
+ be.Cache = V;
1742
+ function Tr(t, e) {
1656
1743
  return t === e || t !== t && e !== e;
1657
1744
  }
1658
- var st = Array.isArray;
1659
- function vr(t) {
1660
- var e = ot(t) ? nt.call(t) : "";
1661
- return e == xn || e == Nn;
1745
+ var lt = Array.isArray;
1746
+ function Fr(t) {
1747
+ var e = dt(t) ? ct.call(t) : "";
1748
+ return e == Mn || e == $n;
1662
1749
  }
1663
- function ot(t) {
1750
+ function dt(t) {
1664
1751
  var e = typeof t;
1665
1752
  return !!t && (e == "object" || e == "function");
1666
1753
  }
1667
- function Rr(t) {
1754
+ function Dr(t) {
1668
1755
  return !!t && typeof t == "object";
1669
1756
  }
1670
- function Ee(t) {
1671
- return typeof t == "symbol" || Rr(t) && nt.call(t) == kn;
1757
+ function Re(t) {
1758
+ return typeof t == "symbol" || Dr(t) && ct.call(t) == Wn;
1672
1759
  }
1673
- function Fr(t) {
1674
- return t == null ? "" : yr(t);
1760
+ function Nr(t) {
1761
+ return t == null ? "" : Cr(t);
1675
1762
  }
1676
- function Ir(t, e, n) {
1677
- var r = t == null ? void 0 : pr(t, e);
1763
+ function Pr(t, e, n) {
1764
+ var r = t == null ? void 0 : Sr(t, e);
1678
1765
  return r === void 0 ? n : r;
1679
1766
  }
1680
- var Pr = Ir;
1681
- const te = /* @__PURE__ */ An(Pr);
1682
- function Or(t, e, n) {
1767
+ var xr = Pr;
1768
+ const re = /* @__PURE__ */ kn(xr);
1769
+ function Lr(t, e, n) {
1683
1770
  const r = t ?? { result: [], success: !0, totalCount: 0 }, s = [...r.result ?? []];
1684
1771
  for (const i of e) {
1685
- const o = te(i.payload.data, n);
1772
+ const o = re(i.payload.data, n);
1686
1773
  switch (i.type) {
1687
1774
  case "ADD": {
1688
- s.findIndex((c) => te(c, n) === o) === -1 && s.push(i.payload.data);
1775
+ s.findIndex((c) => re(c, n) === o) === -1 && s.push(i.payload.data);
1689
1776
  break;
1690
1777
  }
1691
1778
  case "UPDATE": {
1692
- const a = s.findIndex((c) => te(c, n) === o);
1779
+ const a = s.findIndex((c) => re(c, n) === o);
1693
1780
  a !== -1 && (s[a] = i.payload.data);
1694
1781
  break;
1695
1782
  }
1696
1783
  case "DELETE": {
1697
- const a = s.findIndex((c) => te(c, n) === o);
1784
+ const a = s.findIndex((c) => re(c, n) === o);
1698
1785
  a !== -1 && s.splice(a, 1);
1699
1786
  break;
1700
1787
  }
@@ -1702,126 +1789,126 @@ function Or(t, e, n) {
1702
1789
  }
1703
1790
  return { ...r, result: s };
1704
1791
  }
1705
- function Tr(t, e, n, r, s, i) {
1706
- const o = (i == null ? void 0 : i.syncWindowMs) ?? 500, a = q([]), c = q(null), l = q(null), u = q(s);
1792
+ function Ur(t, e, n, r, s, i) {
1793
+ const o = (i == null ? void 0 : i.syncWindowMs) ?? 500, a = M([]), c = M(null), l = M(null), u = M(s);
1707
1794
  u.current = s;
1708
- const f = k(() => {
1709
- const p = a.current;
1710
- if (a.current = [], c.current = null, l.current = null, !(p.length === 0 || !r)) {
1795
+ const d = U(() => {
1796
+ const h = a.current;
1797
+ if (a.current = [], c.current !== null && (clearTimeout(c.current), c.current = null), l.current !== null && (cancelAnimationFrame(l.current), l.current = null), !(h.length === 0 || !r)) {
1711
1798
  t.setQueryData(
1712
1799
  e,
1713
- (g) => Or(g, p, r)
1800
+ (E) => Lr(E, h, r)
1714
1801
  );
1715
- for (const g of p)
1716
- (g.type === "ADD" || g.type === "UPDATE") && t.setQueryData(
1717
- n(g.payload.id, g.payload.namespace),
1718
- { result: g.payload.data }
1802
+ for (const E of h)
1803
+ (E.type === "ADD" || E.type === "UPDATE") && t.setQueryData(
1804
+ n(E.payload.id, E.payload.namespace),
1805
+ { result: E.payload.data }
1719
1806
  );
1720
1807
  }
1721
- }, [t, e, n, r]), d = k(
1722
- (p) => {
1723
- a.current.push(p), !(c.current !== null || l.current !== null) && (u.current === 1 ? c.current = setTimeout(f, o) : l.current = requestAnimationFrame(f));
1808
+ }, [t, e, n, r]), g = U(
1809
+ (h) => {
1810
+ a.current.push(h), !(c.current !== null || l.current !== null) && (c.current = setTimeout(d, o), u.current !== 1 && (l.current = requestAnimationFrame(d)));
1724
1811
  },
1725
- [f, o]
1812
+ [d, o]
1726
1813
  );
1727
- return $(() => () => {
1814
+ return W(() => () => {
1728
1815
  c.current !== null && (clearTimeout(c.current), c.current = null), l.current !== null && (cancelAnimationFrame(l.current), l.current = null);
1729
- }, []), d;
1816
+ }, []), g;
1730
1817
  }
1731
- const Cs = ({
1818
+ const As = ({
1732
1819
  pluginID: t,
1733
1820
  connectionID: e,
1734
1821
  resourceKey: n,
1735
1822
  idAccessor: r,
1736
1823
  namespaces: s
1737
1824
  }) => {
1738
- const i = P(t), o = j(), { showSnackbar: a } = W(), c = w.useMemo(() => s ?? [], [s]), l = w.useMemo(
1825
+ const i = T(t), o = K(), { showSnackbar: a } = G(), c = C.useMemo(() => s ?? [], [s]), l = C.useMemo(
1739
1826
  () => [i, e, n, c, "list"],
1740
1827
  [i, e, n, c]
1741
- ), u = w.useCallback(
1742
- (m, y) => [i, e, n, y, m],
1828
+ ), u = C.useCallback(
1829
+ (f, p) => [i, e, n, p, f],
1743
1830
  [i, e, n]
1744
- ), { mutateAsync: f } = A({
1745
- mutationFn: async (m) => Ne(i, e, n, qe.createFrom({
1746
- input: m.input,
1747
- namespace: m.namespace ?? (c.length === 1 ? c[0] : "")
1831
+ ), { mutateAsync: d } = P({
1832
+ mutationFn: async (f) => We(i, e, n, Ke.createFrom({
1833
+ input: f.input,
1834
+ namespace: f.namespace ?? (c.length === 1 ? c[0] : "")
1748
1835
  })),
1749
- onSuccess: async (m) => {
1836
+ onSuccess: async (f) => {
1750
1837
  var v;
1751
- const y = m == null ? void 0 : m.result;
1752
- let _ = "";
1753
- (v = y == null ? void 0 : y.metadata) != null && v.name ? _ = y.metadata.name : y != null && y.id ? _ = y.id : y != null && y.name ? _ = y.name : y != null && y.ID ? _ = y.ID : y != null && y.Name && (_ = y.Name);
1754
- const h = _ ? `Resource ${_} created` : "Resource created";
1755
- a(h, "success"), await o.invalidateQueries({ queryKey: l });
1838
+ const p = f == null ? void 0 : f.result;
1839
+ let w = "";
1840
+ (v = p == null ? void 0 : p.metadata) != null && v.name ? w = p.metadata.name : p != null && p.id ? w = p.id : p != null && p.name ? w = p.name : p != null && p.ID ? w = p.ID : p != null && p.Name && (w = p.Name);
1841
+ const m = w ? `Resource ${w} created` : "Resource created";
1842
+ a(m, "success"), await o.invalidateQueries({ queryKey: l });
1756
1843
  },
1757
- onError: L(a, "Failed to create resource")
1758
- }), d = T({
1844
+ onError: k(a, "Failed to create resource")
1845
+ }), g = N({
1759
1846
  queryKey: l,
1760
- queryFn: async () => xe(i, e, n, Me.createFrom({
1847
+ queryFn: async () => $e(i, e, n, Qe.createFrom({
1761
1848
  order: [{ field: "name", descending: !1 }],
1762
1849
  pagination: { page: 1, pageSize: 200 },
1763
1850
  namespaces: c
1764
1851
  })),
1765
- placeholderData: (m, y) => m,
1852
+ placeholderData: (f, p) => f,
1766
1853
  retry: !1
1767
- }), [p, g] = w.useState(
1768
- F.WatchStateIdle
1854
+ }), [h, E] = C.useState(
1855
+ I.WatchStateIdle
1769
1856
  );
1770
- w.useEffect(() => O(
1857
+ C.useEffect(() => D(
1771
1858
  `${i}/${e}/watch/STATE`,
1772
- (y) => {
1773
- const _ = y.data;
1774
- _.resourceKey === n && g(_.state);
1859
+ (p) => {
1860
+ const w = p.data;
1861
+ w.resourceKey === n && E(w.state);
1775
1862
  }
1776
1863
  ), [i, e, n]);
1777
- const S = Tr(o, l, u, r, p);
1778
- return w.useEffect(() => {
1864
+ const y = Ur(o, l, u, r, h);
1865
+ return C.useEffect(() => {
1779
1866
  if (!r)
1780
1867
  return;
1781
- Ht(i, e, n);
1782
- const m = O(
1868
+ Xt(i, e, n);
1869
+ const f = D(
1783
1870
  `${i}/${e}/${n}/ADD`,
1784
- (h) => S({ type: "ADD", payload: h.data })
1785
- ), y = O(
1871
+ (m) => y({ type: "ADD", payload: m.data })
1872
+ ), p = D(
1786
1873
  `${i}/${e}/${n}/UPDATE`,
1787
- (h) => S({ type: "UPDATE", payload: h.data })
1788
- ), _ = O(
1874
+ (m) => y({ type: "UPDATE", payload: m.data })
1875
+ ), w = D(
1789
1876
  `${i}/${e}/${n}/DELETE`,
1790
- (h) => S({ type: "DELETE", payload: h.data })
1877
+ (m) => y({ type: "DELETE", payload: m.data })
1791
1878
  );
1792
1879
  return () => {
1793
- m(), y(), _(), Bt(i, e, n);
1880
+ f(), p(), w(), Zt(i, e, n);
1794
1881
  };
1795
- }, [i, e, n, S]), {
1882
+ }, [i, e, n, y]), {
1796
1883
  /**
1797
1884
  * Fetch result for the resource. The client will automatically cache the result, and update the cache
1798
1885
  * when the resources are updated or deleted via the returned create and remove mutation functions, or
1799
1886
  * the per-resource hook mutation functions.
1800
1887
  */
1801
- resources: d,
1888
+ resources: g,
1802
1889
  /**
1803
1890
  * Create a new resource. A set of optional parameters can be passed to customize the create behavior,
1804
1891
  * which if specified, will add additional default behavior set via the hook options.
1805
1892
  *
1806
1893
  * @params opts Optional parameters to pass to the resource create operation
1807
1894
  */
1808
- create: f,
1895
+ create: d,
1809
1896
  /** Current watch state for this resource type */
1810
- watchState: p,
1897
+ watchState: h,
1811
1898
  /** Whether the watch is currently syncing */
1812
- isSyncing: p === F.WatchStateSyncing,
1899
+ isSyncing: h === I.WatchStateSyncing,
1813
1900
  /** Whether the watch has fully synced */
1814
- isSynced: p === F.WatchStateSynced,
1901
+ isSynced: h === I.WatchStateSynced,
1815
1902
  /** Whether the watch encountered an error */
1816
- watchError: p === F.WatchStateError
1903
+ watchError: h === I.WatchStateError
1817
1904
  };
1818
- }, bs = ({ pluginID: t }) => {
1819
- const e = P(t), { showSnackbar: n } = W(), r = A({
1820
- mutationFn: async ({ opts: o, input: a }) => Ne(
1905
+ }, Ts = ({ pluginID: t }) => {
1906
+ const e = T(t), { showSnackbar: n } = G(), r = P({
1907
+ mutationFn: async ({ opts: o, input: a }) => We(
1821
1908
  e,
1822
1909
  o.connectionID,
1823
1910
  o.resourceKey,
1824
- qe.createFrom({
1911
+ Ke.createFrom({
1825
1912
  input: a.input,
1826
1913
  namespace: a.namespace ?? o.namespace ?? ""
1827
1914
  })
@@ -1830,14 +1917,14 @@ const Cs = ({
1830
1917
  n(`Resource ${a.resourceID} created`, "success");
1831
1918
  },
1832
1919
  onError(o, { opts: a }) {
1833
- z(n, o, `Failed to create resource ${a.resourceID}`);
1920
+ B(n, o, `Failed to create resource ${a.resourceID}`);
1834
1921
  }
1835
- }), s = A({
1836
- mutationFn: async ({ opts: o, input: a }) => Ae(
1922
+ }), s = P({
1923
+ mutationFn: async ({ opts: o, input: a }) => qe(
1837
1924
  e,
1838
1925
  o.connectionID,
1839
1926
  o.resourceKey,
1840
- ke.createFrom({
1927
+ Ge.createFrom({
1841
1928
  input: a.input,
1842
1929
  id: o.resourceID,
1843
1930
  namespace: o.namespace ?? ""
@@ -1847,14 +1934,14 @@ const Cs = ({
1847
1934
  n(`Resource ${a.resourceID} updated`, "success");
1848
1935
  },
1849
1936
  onError(o, { opts: a }) {
1850
- z(n, o, `Failed to update resource ${a.resourceID}`);
1937
+ B(n, o, `Failed to update resource ${a.resourceID}`);
1851
1938
  }
1852
- }), i = A({
1853
- mutationFn: async ({ opts: o, input: a }) => De(
1939
+ }), i = P({
1940
+ mutationFn: async ({ opts: o, input: a }) => Me(
1854
1941
  e,
1855
1942
  o.connectionID,
1856
1943
  o.resourceKey,
1857
- Le.createFrom({
1944
+ je.createFrom({
1858
1945
  id: o.resourceID,
1859
1946
  namespace: o.namespace ?? "",
1860
1947
  gracePeriodSeconds: a.gracePeriodSeconds
@@ -1864,7 +1951,7 @@ const Cs = ({
1864
1951
  n(`Resource ${a.resourceID} deleted`, "success");
1865
1952
  },
1866
1953
  onError(o, { opts: a }) {
1867
- z(n, o, `Failed to delete resource ${a.resourceID}`);
1954
+ B(n, o, `Failed to delete resource ${a.resourceID}`);
1868
1955
  }
1869
1956
  });
1870
1957
  return {
@@ -1872,15 +1959,15 @@ const Cs = ({
1872
1959
  update: s.mutateAsync,
1873
1960
  remove: i.mutateAsync
1874
1961
  };
1875
- }, vs = ({
1962
+ }, Fs = ({
1876
1963
  pluginID: t,
1877
1964
  connectionID: e,
1878
1965
  resourceKey: n,
1879
1966
  enabled: r = !0
1880
1967
  }) => {
1881
- const s = P(t), i = T({
1968
+ const s = T(t), i = N({
1882
1969
  queryKey: ["RESOURCE_ACTIONS", s, e, n],
1883
- queryFn: () => zt(s, e, n),
1970
+ queryFn: () => en(s, e, n),
1884
1971
  enabled: r && !!s && !!e && !!n,
1885
1972
  staleTime: 5 * 60 * 1e3
1886
1973
  // actions don't change often
@@ -1890,18 +1977,18 @@ const Cs = ({
1890
1977
  isLoading: i.isLoading,
1891
1978
  error: i.error
1892
1979
  };
1893
- }, Rs = ({
1980
+ }, Ds = ({
1894
1981
  pluginID: t,
1895
1982
  connectionID: e,
1896
1983
  resourceKey: n
1897
1984
  }) => {
1898
- const r = P(t), s = j(), { showSnackbar: i } = W(), o = A({
1899
- mutationFn: async ({ actionID: a, id: c = "", namespace: l = "", params: u = {} }) => Yt(
1985
+ const r = T(t), s = K(), { showSnackbar: i } = G(), o = P({
1986
+ mutationFn: async ({ actionID: a, id: c = "", namespace: l = "", params: u = {} }) => tn(
1900
1987
  r,
1901
1988
  e,
1902
1989
  n,
1903
1990
  a,
1904
- Ue.createFrom({ id: c, namespace: l, params: u })
1991
+ He.createFrom({ id: c, namespace: l, params: u })
1905
1992
  ),
1906
1993
  onSuccess: (a) => {
1907
1994
  a != null && a.message && i(a.message, "success"), s.invalidateQueries({
@@ -1909,7 +1996,7 @@ const Cs = ({
1909
1996
  });
1910
1997
  },
1911
1998
  onError: (a, c) => {
1912
- z(i, a, `Failed to execute action "${c.actionID}"`);
1999
+ B(i, a, `Failed to execute action "${c.actionID}"`);
1913
2000
  }
1914
2001
  });
1915
2002
  return {
@@ -1917,14 +2004,14 @@ const Cs = ({
1917
2004
  isExecuting: o.isPending,
1918
2005
  error: o.error
1919
2006
  };
1920
- }, Fs = ({
2007
+ }, Ns = ({
1921
2008
  pluginID: t,
1922
2009
  connectionID: e,
1923
2010
  enabled: n = !0
1924
2011
  }) => {
1925
- const r = P(t), s = T({
2012
+ const r = T(t), s = N({
1926
2013
  queryKey: ["EDITOR_SCHEMAS", r, e],
1927
- queryFn: () => Jt(r, e),
2014
+ queryFn: () => nn(r, e),
1928
2015
  enabled: n && !!r && !!e,
1929
2016
  staleTime: 10 * 60 * 1e3,
1930
2017
  // schemas are fairly stable per connection
@@ -1936,115 +2023,115 @@ const Cs = ({
1936
2023
  error: s.error,
1937
2024
  refetch: s.refetch
1938
2025
  };
1939
- }, Is = ({
2026
+ }, Ps = ({
1940
2027
  pluginID: t,
1941
2028
  connectionID: e,
1942
2029
  enabled: n = !0
1943
2030
  }) => {
1944
- const r = P(t), s = j(), i = [r, e, "watch-state"], o = q([]), a = q(!1), c = k((d) => {
1945
- s.setQueryData(i, (p) => {
1946
- if (!p) return p;
1947
- const g = { ...p.resources, [d.resourceKey]: d.state }, S = { ...p.resourceCounts, [d.resourceKey]: d.resourceCount };
1948
- let m = 0, y = 0;
1949
- for (const _ of Object.values(g))
1950
- _ === F.WatchStateSynced && m++, (_ === F.WatchStateError || _ === F.WatchStateFailed) && y++;
1951
- return { ...p, resources: g, resourceCounts: S, totalResources: Object.keys(g).length, syncedCount: m, errorCount: y };
2031
+ const r = T(t), s = K(), i = [r, e, "watch-state"], o = M([]), a = M(!1), c = U((g) => {
2032
+ s.setQueryData(i, (h) => {
2033
+ if (!h) return h;
2034
+ const E = { ...h.resources, [g.resourceKey]: g.state }, y = { ...h.resourceCounts, [g.resourceKey]: g.resourceCount };
2035
+ let f = 0, p = 0;
2036
+ for (const w of Object.values(E))
2037
+ w === I.WatchStateSynced && f++, (w === I.WatchStateError || w === I.WatchStateFailed) && p++;
2038
+ return { ...h, resources: E, resourceCounts: y, totalResources: Object.keys(E).length, syncedCount: f, errorCount: p };
1952
2039
  });
1953
- }, [s, r, e]), l = T({
2040
+ }, [s, r, e]), l = N({
1954
2041
  queryKey: i,
1955
2042
  queryFn: async () => {
1956
- const d = await Zt(r, e);
1957
- if (!d) throw new Error("Failed to get watch state: null response");
1958
- const p = {};
1959
- let g = 0, S = 0;
1960
- for (const [y, _] of Object.entries(d.resources ?? {}))
1961
- _ != null && (p[y] = _, _ === F.WatchStateSynced && g++, _ === F.WatchStateError && S++);
1962
- const m = {};
1963
- for (const [y, _] of Object.entries(d.resourceCounts ?? {}))
1964
- _ != null && (m[y] = _);
2043
+ const g = await rn(r, e);
2044
+ if (!g) throw new Error("Failed to get watch state: null response");
2045
+ const h = {};
2046
+ let E = 0, y = 0;
2047
+ for (const [p, w] of Object.entries(g.resources ?? {}))
2048
+ w != null && (h[p] = w, w === I.WatchStateSynced && E++, w === I.WatchStateError && y++);
2049
+ const f = {};
2050
+ for (const [p, w] of Object.entries(g.resourceCounts ?? {}))
2051
+ w != null && (f[p] = w);
1965
2052
  return {
1966
- connection: d.connectionId,
1967
- resources: p,
1968
- resourceCounts: m,
1969
- totalResources: Object.keys(p).length,
1970
- syncedCount: g,
1971
- errorCount: S
2053
+ connection: g.connectionId,
2054
+ resources: h,
2055
+ resourceCounts: f,
2056
+ totalResources: Object.keys(h).length,
2057
+ syncedCount: E,
2058
+ errorCount: y
1972
2059
  };
1973
2060
  },
1974
2061
  enabled: n && !!r && !!e,
1975
- refetchInterval: (d) => {
1976
- const p = d.state.data;
1977
- if (!p || p.totalResources === 0) return 3e3;
1978
- let g = 0;
1979
- for (const S of Object.values(p.resources))
1980
- (S === F.WatchStateSynced || S === F.WatchStateError || S === F.WatchStateStopped || S === F.WatchStateFailed || S === F.WatchStateForbidden || S === F.WatchStateSkipped) && g++;
1981
- return g >= p.totalResources ? !1 : 3e3;
2062
+ refetchInterval: (g) => {
2063
+ const h = g.state.data;
2064
+ if (!h || h.totalResources === 0) return 3e3;
2065
+ let E = 0;
2066
+ for (const y of Object.values(h.resources))
2067
+ (y === I.WatchStateSynced || y === I.WatchStateError || y === I.WatchStateStopped || y === I.WatchStateFailed || y === I.WatchStateForbidden || y === I.WatchStateSkipped) && E++;
2068
+ return E >= h.totalResources ? !1 : 3e3;
1982
2069
  }
1983
2070
  });
1984
- $(() => {
2071
+ W(() => {
1985
2072
  if (!l.data || a.current) return;
1986
2073
  a.current = !0;
1987
- const d = o.current;
2074
+ const g = o.current;
1988
2075
  o.current = [];
1989
- for (const p of d)
1990
- c(p);
1991
- }, [l.data, c]), $(() => {
2076
+ for (const h of g)
2077
+ c(h);
2078
+ }, [l.data, c]), W(() => {
1992
2079
  if (!n || !r || !e)
1993
2080
  return;
1994
2081
  a.current = !1, o.current = [];
1995
- const d = O(
2082
+ const g = D(
1996
2083
  `${r}/${e}/watch/STATE`,
1997
- (p) => {
1998
- const g = p.data;
1999
- a.current ? c(g) : o.current.push(g);
2084
+ (h) => {
2085
+ const E = h.data;
2086
+ a.current ? c(E) : o.current.push(E);
2000
2087
  }
2001
2088
  );
2002
2089
  return () => {
2003
- d(), a.current = !1, o.current = [];
2090
+ g(), a.current = !1, o.current = [];
2004
2091
  };
2005
2092
  }, [r, e, n, c]);
2006
2093
  const u = l.data;
2007
- let f = 0;
2094
+ let d = 0;
2008
2095
  if (u != null && u.resources)
2009
- for (const d of Object.values(u.resources))
2010
- (d === F.WatchStateSynced || d === F.WatchStateError || d === F.WatchStateStopped || d === F.WatchStateFailed || d === F.WatchStateForbidden || d === F.WatchStateSkipped) && f++;
2096
+ for (const g of Object.values(u.resources))
2097
+ (g === I.WatchStateSynced || g === I.WatchStateError || g === I.WatchStateStopped || g === I.WatchStateFailed || g === I.WatchStateForbidden || g === I.WatchStateSkipped) && d++;
2011
2098
  return {
2012
2099
  /** Full summary query result */
2013
2100
  summary: l,
2014
2101
  /** Get the state of a specific resource type's watch */
2015
- getResourceState: (d) => u == null ? void 0 : u.resources[d],
2102
+ getResourceState: (g) => u == null ? void 0 : u.resources[g],
2016
2103
  /** Whether all registered watches have reached a terminal state */
2017
- isFullySynced: u ? u.totalResources > 0 && f === u.totalResources : !1,
2104
+ isFullySynced: u ? u.totalResources > 0 && d === u.totalResources : !1,
2018
2105
  /** Sync progress as a 0-1 fraction (terminal states / total) */
2019
- syncProgress: u && u.totalResources > 0 ? f / u.totalResources : 0,
2106
+ syncProgress: u && u.totalResources > 0 ? d / u.totalResources : 0,
2020
2107
  /** Number of watches that encountered errors */
2021
2108
  errorCount: (u == null ? void 0 : u.errorCount) ?? 0
2022
2109
  };
2023
- }, Ps = () => {
2024
- const [t, e] = G(/* @__PURE__ */ new Map()), n = q(/* @__PURE__ */ new Map()), r = q(/* @__PURE__ */ new Map()), s = k((l) => {
2025
- const u = l.data, f = he(u), d = Ze(n.current, u), p = pe(d);
2026
- if (e((g) => {
2027
- const S = new Map(g);
2028
- return S.set(f, p), S;
2029
- }), r.current.has(f) && (clearTimeout(r.current.get(f)), r.current.delete(f)), ne(p)) {
2030
- const g = setTimeout(() => {
2031
- e((S) => {
2032
- const m = new Map(S);
2033
- return m.delete(f), m;
2034
- }), n.current.delete(f), r.current.delete(f);
2110
+ }, xs = () => {
2111
+ const [t, e] = j(/* @__PURE__ */ new Map()), n = M(/* @__PURE__ */ new Map()), r = M(/* @__PURE__ */ new Map()), s = U((l) => {
2112
+ const u = l.data, d = Ce(u), g = rt(n.current, u), h = Ee(g);
2113
+ if (e((E) => {
2114
+ const y = new Map(E);
2115
+ return y.set(d, h), y;
2116
+ }), r.current.has(d) && (clearTimeout(r.current.get(d)), r.current.delete(d)), ie(h)) {
2117
+ const E = setTimeout(() => {
2118
+ e((y) => {
2119
+ const f = new Map(y);
2120
+ return f.delete(d), f;
2121
+ }), n.current.delete(d), r.current.delete(d);
2035
2122
  }, 5e3);
2036
- r.current.set(f, g);
2123
+ r.current.set(d, E);
2037
2124
  }
2038
2125
  }, []);
2039
- $(() => {
2040
- const l = O("watch/STATE", s);
2126
+ W(() => {
2127
+ const l = D("watch/STATE", s);
2041
2128
  return () => {
2042
2129
  l();
2043
2130
  for (const u of r.current.values())
2044
2131
  clearTimeout(u);
2045
2132
  };
2046
2133
  }, [s]);
2047
- const i = Array.from(t.values()), o = Ye(i), a = i.find((l) => !ne(l)) ?? i[0] ?? null, c = Je(i);
2134
+ const i = Array.from(t.values()), o = tt(i), a = i.find((l) => !ie(l)) ?? i[0] ?? null, c = nt(i);
2048
2135
  return {
2049
2136
  /** All tracked syncs */
2050
2137
  syncs: i,
@@ -2055,87 +2142,73 @@ const Cs = ({
2055
2142
  /** Aggregate progress across all connections (0-1) */
2056
2143
  aggregateProgress: c
2057
2144
  };
2058
- }, Ar = () => {
2059
- const t = w.useContext(Ke);
2145
+ }, kr = () => {
2146
+ const t = C.useContext(Je);
2060
2147
  if (!t) throw new Error("useOperations must be used within an OperationsProvider");
2061
2148
  return t;
2062
- }, Os = ({
2063
- pluginID: t,
2064
- connectionID: e,
2065
- resourceKey: n
2066
- }) => {
2067
- const r = P(t), { showSnackbar: s } = W(), { addOperation: i, updateOperation: o } = Ar(), a = w.useRef([]);
2068
- return w.useEffect(() => () => {
2069
- a.current.forEach((l) => l());
2070
- }, []), { startStreamAction: w.useCallback(
2071
- async ({ actionID: l, id: u, namespace: f, label: d, params: p = {} }) => {
2072
- try {
2073
- const g = await Xt(
2074
- r,
2075
- e,
2076
- n,
2077
- l,
2078
- Ue.createFrom({ id: u, namespace: f, params: p })
2079
- );
2080
- i({
2081
- id: g,
2082
- label: d,
2083
- resourceKey: n,
2084
- resourceName: u,
2085
- namespace: f,
2086
- connectionID: e,
2087
- status: "running",
2088
- startedAt: Date.now()
2089
- });
2090
- const S = `action/stream/${g}`, m = O(S, (y) => {
2091
- var h, v, R, C;
2092
- const _ = y.data;
2093
- switch (_.type) {
2094
- case "progress": {
2095
- const E = _.data ?? {};
2096
- o(g, {
2097
- message: E.message,
2098
- progress: E.ready !== void 0 && E.desired !== void 0 ? { ready: E.ready, desired: E.desired } : void 0
2099
- });
2100
- break;
2101
- }
2102
- case "complete":
2103
- o(g, {
2104
- status: "completed",
2105
- message: ((h = _.data) == null ? void 0 : h.message) ?? "Completed",
2106
- completedAt: Date.now()
2107
- }), s(((v = _.data) == null ? void 0 : v.message) ?? d + " completed", "success"), ae(S);
2108
- break;
2109
- case "error":
2110
- o(g, {
2111
- status: "error",
2112
- message: ((R = _.data) == null ? void 0 : R.message) ?? "Failed",
2113
- completedAt: Date.now()
2114
- }), s(((C = _.data) == null ? void 0 : C.message) ?? d + " failed", "error"), ae(S);
2115
- break;
2116
- }
2117
- });
2118
- return a.current.push(() => {
2119
- m(), ae(S);
2120
- }), g;
2121
- } catch (g) {
2122
- throw z(s, g, `Failed to start "${l}"`), g;
2123
- }
2124
- },
2125
- [r, e, n, i, o, s]
2126
- ) };
2149
+ }, Ls = ({ pluginID: t, connectionID: e, resourceKey: n }) => {
2150
+ const r = T(t), { showSnackbar: s } = G(), { addOperation: i, updateOperation: o } = kr(), a = C.useRef(/* @__PURE__ */ new Set()), c = C.useCallback((d, g = !1) => {
2151
+ var h, E, y;
2152
+ d.disposed || (d.disposed = !0, (h = d.unsubscribe) == null || h.call(d), (E = d.open) == null || E.cancel(), (y = d.attach) == null || y.cancel(), d.handle && (Ae(d.handle).catch(() => {
2153
+ }), g && o(d.handle, { status: "cancelled", message: "Cancelled", completedAt: Date.now() })), a.current.delete(d));
2154
+ }, [o]);
2155
+ C.useEffect(() => () => {
2156
+ for (const d of a.current) c(d, !0);
2157
+ }, [r, e, n, c]);
2158
+ const l = C.useCallback(async ({ actionID: d, id: g, namespace: h, label: E, params: y = {} }) => {
2159
+ const f = { disposed: !1, terminal: !1, sequence: 0 };
2160
+ a.current.add(f);
2161
+ try {
2162
+ f.open = sn(r, e, n, d, He.createFrom({ id: g, namespace: h, params: y }));
2163
+ const p = await f.open;
2164
+ if (f.open = void 0, f.disposed)
2165
+ return Ae(p).catch(() => {
2166
+ }), p;
2167
+ f.handle = p, i({ id: p, label: E, resourceKey: n, resourceName: g, namespace: h, connectionID: e, status: "running", startedAt: Date.now() });
2168
+ const w = (v) => {
2169
+ if (f.disposed || !Number.isSafeInteger(v.sequence) || v.sequence <= f.sequence) return;
2170
+ f.sequence = v.sequence;
2171
+ const b = v.event, S = b.data ?? {};
2172
+ if (b.type === "error") {
2173
+ f.terminal = !0;
2174
+ const _ = Q(b.error);
2175
+ o(p, { status: oe(_) ? "cancelled" : "error", message: _.title, completedAt: Date.now() }), B(s, _, E), c(f);
2176
+ } else if (b.type === "complete") {
2177
+ f.terminal = !0;
2178
+ const _ = typeof S.message == "string" ? S.message : `${E} completed`;
2179
+ o(p, { status: "completed", message: _, completedAt: Date.now() }), s(_, "success"), c(f);
2180
+ } else
2181
+ o(p, {
2182
+ message: typeof S.message == "string" ? S.message : void 0,
2183
+ progress: typeof S.ready == "number" && typeof S.desired == "number" ? { ready: S.ready, desired: S.desired } : void 0
2184
+ });
2185
+ };
2186
+ f.unsubscribe = D(`action/stream/${p}`, (v) => w(v.data)), f.attach = on(p);
2187
+ const m = await f.attach;
2188
+ return f.attach = void 0, w(m), p;
2189
+ } catch (p) {
2190
+ if (f.terminal && f.handle) return f.handle;
2191
+ throw f.disposed || (f.handle && o(f.handle, { status: oe(p) ? "cancelled" : "error", message: Q(p).title, completedAt: Date.now() }), B(s, p, `Failed to start "${d}"`)), c(f), p;
2192
+ }
2193
+ }, [r, e, n, i, o, s, c]), u = C.useCallback((d) => {
2194
+ for (const g of a.current) if (g.handle === d) {
2195
+ c(g, !0);
2196
+ return;
2197
+ }
2198
+ }, [c]);
2199
+ return { startStreamAction: l, cancelStreamAction: u };
2127
2200
  };
2128
- function Dr(t, e) {
2201
+ function qr(t, e) {
2129
2202
  return `${t}/${e}/graph/CHANGED`;
2130
2203
  }
2131
- function we(t, e, n, r) {
2132
- const s = j(), i = q(n);
2204
+ function Ie(t, e, n, r) {
2205
+ const s = K(), i = M(n);
2133
2206
  i.current = n;
2134
2207
  const o = JSON.stringify(n);
2135
- $(() => {
2208
+ W(() => {
2136
2209
  if (!r || !t || !e)
2137
2210
  return;
2138
- const a = O(Dr(t, e), () => {
2211
+ const a = D(qr(t, e), () => {
2139
2212
  s.invalidateQueries({ queryKey: i.current, exact: !0 });
2140
2213
  });
2141
2214
  return () => {
@@ -2143,7 +2216,7 @@ function we(t, e, n, r) {
2143
2216
  };
2144
2217
  }, [s, t, e, o, r]);
2145
2218
  }
2146
- const xr = {
2219
+ const Mr = {
2147
2220
  owns: { outgoing: "Owns", incoming: "Owned by" },
2148
2221
  runs_on: { outgoing: "Runs on", incoming: "Running here" },
2149
2222
  uses: { outgoing: "Uses", incoming: "Used by" },
@@ -2152,19 +2225,19 @@ const xr = {
2152
2225
  member_of: { outgoing: "Member of", incoming: "Members" },
2153
2226
  selects: { outgoing: "Selects", incoming: "Selected by" }
2154
2227
  };
2155
- function Ts(t, e) {
2156
- const n = xr[t];
2228
+ function Us(t, e) {
2229
+ const n = Mr[t];
2157
2230
  if (n)
2158
2231
  return n[e];
2159
2232
  const r = t.replace(/_/g, " ");
2160
2233
  return e === "outgoing" ? r : `${r} (incoming)`;
2161
2234
  }
2162
- function Nr(t, e) {
2235
+ function $r(t, e) {
2163
2236
  return t.pluginId === e.pluginId && t.connectionId === e.connectionId && t.resourceKey === e.resourceKey && t.id === e.id && (t.namespace ?? "") === (e.namespace ?? "");
2164
2237
  }
2165
- function kr(t, e) {
2238
+ function Wr(t, e) {
2166
2239
  return e.map((n) => {
2167
- const r = Nr(n.source, t);
2240
+ const r = $r(n.source, t);
2168
2241
  return {
2169
2242
  resource: r ? n.target : n.source,
2170
2243
  type: n.type,
@@ -2173,7 +2246,7 @@ function kr(t, e) {
2173
2246
  };
2174
2247
  });
2175
2248
  }
2176
- const As = ({
2249
+ const ks = ({
2177
2250
  pluginID: t,
2178
2251
  connectionID: e,
2179
2252
  resourceKey: n,
@@ -2184,31 +2257,31 @@ const As = ({
2184
2257
  enabled: a = !0,
2185
2258
  refetchInterval: c = !1
2186
2259
  }) => {
2187
- const l = P(t), u = ["RESOURCE_RELATED", l, e, n, s, r, i, o ?? null], f = a && !!l && !!e && !!n && !!r;
2188
- we(l, e, u, f);
2189
- const d = T({
2260
+ const l = T(t), u = ["RESOURCE_RELATED", l, e, n, s, r, i, o ?? null], d = a && !!l && !!e && !!n && !!r;
2261
+ Ie(l, e, u, d);
2262
+ const g = N({
2190
2263
  queryKey: u,
2191
- queryFn: async () => Vt(l, e, n, s, r, i, o ?? null),
2192
- enabled: f,
2264
+ queryFn: async () => an(l, e, n, s, r, i, o ?? null),
2265
+ enabled: d,
2193
2266
  refetchInterval: c
2194
- }), p = {
2267
+ }), h = {
2195
2268
  pluginId: l,
2196
2269
  connectionId: e,
2197
2270
  resourceKey: n,
2198
2271
  id: r,
2199
2272
  namespace: s
2200
- }, g = d.data ?? [];
2273
+ }, E = g.data ?? [];
2201
2274
  return {
2202
2275
  /** One entry per edge, from the viewed resource's side. */
2203
- related: kr(p, g),
2276
+ related: Wr(h, E),
2204
2277
  /** The raw graph edges. */
2205
- edges: g,
2206
- isLoading: d.isLoading,
2207
- isFetching: d.isFetching,
2208
- error: d.error,
2209
- refetch: d.refetch
2278
+ edges: E,
2279
+ isLoading: g.isLoading,
2280
+ isFetching: g.isFetching,
2281
+ error: g.error,
2282
+ refetch: g.refetch
2210
2283
  };
2211
- }, Ds = ({
2284
+ }, qs = ({
2212
2285
  pluginID: t,
2213
2286
  connectionID: e,
2214
2287
  resourceKey: n,
@@ -2218,22 +2291,22 @@ const As = ({
2218
2291
  enabled: o = !0,
2219
2292
  refetchInterval: a = !1
2220
2293
  }) => {
2221
- const c = P(t), l = ["RESOURCE_DEPENDENCY_TREE", c, e, n, s, r, i], u = o && !!c && !!e && !!n && !!r;
2222
- we(c, e, l, u);
2223
- const f = T({
2294
+ const c = T(t), l = ["RESOURCE_DEPENDENCY_TREE", c, e, n, s, r, i], u = o && !!c && !!e && !!n && !!r;
2295
+ Ie(c, e, l, u);
2296
+ const d = N({
2224
2297
  queryKey: l,
2225
- queryFn: async () => en(c, e, n, s, r, i),
2298
+ queryFn: async () => cn(c, e, n, s, r, i),
2226
2299
  enabled: u,
2227
2300
  refetchInterval: a
2228
2301
  });
2229
2302
  return {
2230
- tree: f.data ?? null,
2231
- isLoading: f.isLoading,
2232
- isFetching: f.isFetching,
2233
- error: f.error,
2234
- refetch: f.refetch
2303
+ tree: d.data ?? null,
2304
+ isLoading: d.isLoading,
2305
+ isFetching: d.isFetching,
2306
+ error: d.error,
2307
+ refetch: d.refetch
2235
2308
  };
2236
- }, xs = ({
2309
+ }, Ms = ({
2237
2310
  pluginID: t,
2238
2311
  connectionID: e,
2239
2312
  resourceKey: n,
@@ -2243,53 +2316,53 @@ const As = ({
2243
2316
  downDepth: o = 3,
2244
2317
  enabled: a = !0
2245
2318
  }) => {
2246
- const c = P(t), l = ["RESOURCE_GRAPH", c, e, n, s, r, i, o], u = a && !!c && !!e && !!n && !!r;
2247
- we(c, e, l, u);
2248
- const f = T({
2319
+ const c = T(t), l = ["RESOURCE_GRAPH", c, e, n, s, r, i, o], u = a && !!c && !!e && !!n && !!r;
2320
+ Ie(c, e, l, u);
2321
+ const d = N({
2249
2322
  queryKey: l,
2250
- queryFn: async () => tn(c, e, n, s, r, i, o),
2323
+ queryFn: async () => un(c, e, n, s, r, i, o),
2251
2324
  enabled: u
2252
2325
  });
2253
2326
  return {
2254
- graph: f.data ?? null,
2255
- isLoading: f.isLoading,
2256
- isFetching: f.isFetching,
2257
- error: f.error,
2258
- refetch: f.refetch
2327
+ graph: d.data ?? null,
2328
+ isLoading: d.isLoading,
2329
+ isFetching: d.isFetching,
2330
+ error: d.error,
2331
+ refetch: d.refetch
2259
2332
  };
2260
- }, Ns = () => {
2261
- const t = w.useContext(Qe);
2333
+ }, $s = () => {
2334
+ const t = C.useContext(Ye);
2262
2335
  if (!t)
2263
2336
  throw new Error("useSettings must be used within a SettingsProvider");
2264
2337
  return t;
2265
- }, ks = ({ to: t, withinContext: e, ...n }) => {
2266
- const { pluginId: r } = ye();
2338
+ }, Ws = ({ to: t, withinContext: e, ...n }) => {
2339
+ const { pluginId: r } = _e();
2267
2340
  r || console.error("Link used outside of a plugin context");
2268
2341
  const s = `/_plugin/${r}${t.startsWith("/") ? "" : "/"}${t}`;
2269
- return w.useMemo(() => /* @__PURE__ */ x(dt, { style: { textDecoration: "none", color: "inherit" }, ...n, to: s }), [n, s]);
2342
+ return C.useMemo(() => /* @__PURE__ */ A(mt, { style: { textDecoration: "none", color: "inherit" }, ...n, to: s }), [n, s]);
2270
2343
  };
2271
- function Ls() {
2272
- const t = ft(), e = pt(), { pluginId: n } = ye();
2344
+ function Gs() {
2345
+ const t = Et(), e = St(), { pluginId: n } = _e();
2273
2346
  n || console.error("usePluginRouter used outside of a plugin context");
2274
- const r = `/_plugin/${n}`, s = e.pathname.startsWith(r) ? e.pathname.slice(r.length) || "/" : e.pathname, i = k((o, a) => {
2347
+ const r = `/_plugin/${n}`, s = e.pathname.startsWith(r) ? e.pathname.slice(r.length) || "/" : e.pathname, i = U((o, a) => {
2275
2348
  const { ...c } = a ?? {};
2276
2349
  o.startsWith("/") ? t(`${r}${o}`, c) : t(o, c);
2277
2350
  }, [t, r]);
2278
- return lt(() => ({
2351
+ return yt(() => ({
2279
2352
  location: e,
2280
2353
  navigate: i,
2281
2354
  pluginPath: s
2282
2355
  }), [e, i, s]);
2283
2356
  }
2284
- class Ms {
2357
+ class js {
2285
2358
  }
2286
- class qs {
2359
+ class Qs {
2287
2360
  constructor() {
2288
- D(this, "_extensions");
2361
+ x(this, "_extensions");
2289
2362
  /**
2290
2363
  * The root component to render for the application window.
2291
2364
  */
2292
- D(this, "root");
2365
+ x(this, "root");
2293
2366
  /**
2294
2367
  * Various pages to render under the root component. These can be navigated to using
2295
2368
  * the built-in navigation system both programatically and through Links.
@@ -2319,8 +2392,8 @@ class qs {
2319
2392
  * ```
2320
2393
  *
2321
2394
  */
2322
- D(this, "pages");
2323
- D(this, "_routes");
2395
+ x(this, "pages");
2396
+ x(this, "_routes");
2324
2397
  }
2325
2398
  get extensions() {
2326
2399
  return this._extensions || [];
@@ -2342,9 +2415,9 @@ class qs {
2342
2415
  */
2343
2416
  get Window() {
2344
2417
  if (!this._routes && this.root)
2345
- return /* @__PURE__ */ x(this.root, {});
2346
- const e = gt(this._routes || []);
2347
- return /* @__PURE__ */ x(yt, { router: e });
2418
+ return /* @__PURE__ */ A(this.root, {});
2419
+ const e = _t(this._routes || []);
2420
+ return /* @__PURE__ */ A(Ct, { router: e });
2348
2421
  }
2349
2422
  /**
2350
2423
  * Register extension points for other plugins to extend the functionality
@@ -2376,91 +2449,91 @@ class qs {
2376
2449
  return this._routes = e, this;
2377
2450
  }
2378
2451
  }
2379
- var Lr = /* @__PURE__ */ ((t) => (t.MISSING_MANIFEST = "MISSING_MANIFEST", t.MISSING_PLUGIN = "MISSING_PLUGIN", t.MISSING_ENTRYPOINT = "MISSING_ENTRYPOINT", t))(Lr || {});
2380
- const Us = (t) => {
2452
+ var Gr = /* @__PURE__ */ ((t) => (t.MISSING_MANIFEST = "MISSING_MANIFEST", t.MISSING_PLUGIN = "MISSING_PLUGIN", t.MISSING_ENTRYPOINT = "MISSING_ENTRYPOINT", t))(Gr || {});
2453
+ const Ks = (t) => {
2381
2454
  const e = t.split("::");
2382
2455
  return e.length === 1 ? { group: "core", version: "", kind: e[0] } : {
2383
2456
  group: e[0] || "core",
2384
2457
  version: e[1] || "",
2385
2458
  kind: e[2] || e[0]
2386
2459
  };
2387
- }, $s = (t) => !t || t === "core" ? "Core" : t.charAt(0).toUpperCase() + t.slice(1);
2460
+ }, Hs = (t) => !t || t === "core" ? "Core" : t.charAt(0).toUpperCase() + t.slice(1);
2388
2461
  export {
2389
- B as ALL_SESSIONS_KEY,
2390
- mn as BottomDrawerContext,
2391
- _n as ConfirmationModalContext,
2392
- U as ErrorTypes,
2393
- es as ExtensionPointRegistry,
2394
- Fn as ExtensionPointStore,
2395
- Vr as ExtensionProvider,
2396
- ks as Link,
2397
- Ke as OperationsContext,
2398
- Zr as OperationsProvider,
2399
- ge as PluginContext,
2400
- zr as PluginContextProvider,
2401
- Lr as PluginErrorCode,
2402
- qs as PluginWindow,
2403
- Ms as PluginWindowRootProps,
2404
- Sn as RightDrawerContext,
2405
- Qe as SettingsContext,
2406
- Jr as SettingsProvider,
2407
- ts as SnackbarProvider,
2408
- F as WatchState,
2409
- yn as actionToSnackbar,
2410
- Or as applyBatch,
2411
- Pn as connectionListQueryKey,
2412
- L as createErrorHandler,
2413
- hn as defaultState,
2414
- $s as formatGroup,
2415
- Dr as graphChangedEvent,
2416
- Ge as isCancelledError,
2462
+ Y as ALL_SESSIONS_KEY,
2463
+ vn as BottomDrawerContext,
2464
+ Rn as ConfirmationModalContext,
2465
+ F as ErrorTypes,
2466
+ is as ExtensionPointRegistry,
2467
+ Nn as ExtensionPointStore,
2468
+ os as ExtensionProvider,
2469
+ Ws as Link,
2470
+ Je as OperationsContext,
2471
+ rs as OperationsProvider,
2472
+ Se as PluginContext,
2473
+ es as PluginContextProvider,
2474
+ Gr as PluginErrorCode,
2475
+ Qs as PluginWindow,
2476
+ js as PluginWindowRootProps,
2477
+ bn as RightDrawerContext,
2478
+ Ye as SettingsContext,
2479
+ ns as SettingsProvider,
2480
+ as as SnackbarProvider,
2481
+ I as WatchState,
2482
+ Cn as actionToSnackbar,
2483
+ Lr as applyBatch,
2484
+ xn as connectionListQueryKey,
2485
+ k as createErrorHandler,
2486
+ wn as defaultState,
2487
+ Hs as formatGroup,
2488
+ qr as graphChangedEvent,
2489
+ oe as isCancelledError,
2417
2490
  Q as parseAppError,
2418
- Us as parseResourceKey,
2419
- Ts as relationshipLabel,
2420
- z as showAppError,
2421
- kr as toRelatedResources,
2422
- Ps as useActiveSyncs,
2423
- Xe as useBottomDrawer,
2424
- ys as useConfirmationModal,
2425
- ns as useConnection,
2426
- ss as useConnectionNamespaces,
2427
- os as useConnectionStatus,
2428
- rs as useConnections,
2429
- Ds as useDependencyTree,
2430
- Fs as useEditorSchemas,
2431
- Tr as useEventBatcher,
2432
- cs as useExec,
2433
- Rs as useExecuteAction,
2434
- Xr as useExtensionPoint,
2435
- Rn as useExtensionRegistry,
2436
- us as useLogs,
2437
- ls as useMetricProviders,
2438
- Tn as useMetricProvidersForResource,
2439
- fs as useMetricStream,
2440
- Ar as useOperations,
2441
- ye as usePluginContext,
2442
- is as usePluginData,
2443
- Ls as usePluginRouter,
2444
- Yr as usePluginSettings,
2445
- ps as usePortForwardSessions,
2446
- we as useRefetchOnGraphChange,
2447
- As as useRelatedResources,
2448
- P as useResolvedPluginId,
2449
- hs as useResource,
2450
- vs as useResourceActions,
2451
- ms as useResourceAreaComponent,
2452
- xs as useResourceGraph,
2453
- Ss as useResourceGroups,
2454
- ds as useResourceMetrics,
2455
- bs as useResourceMutations,
2456
- gs as useResourcePortForwarder,
2457
- _s as useResourceSearch,
2458
- Es as useResourceType,
2459
- ws as useResourceTypes,
2460
- Cs as useResources,
2461
- as as useRightDrawer,
2462
- Ns as useSettings,
2463
- W as useSnackbar,
2464
- Os as useStreamAction,
2465
- Is as useWatchState
2491
+ Ks as parseResourceKey,
2492
+ Us as relationshipLabel,
2493
+ B as showAppError,
2494
+ Wr as toRelatedResources,
2495
+ xs as useActiveSyncs,
2496
+ st as useBottomDrawer,
2497
+ Cs as useConfirmationModal,
2498
+ cs as useConnection,
2499
+ ls as useConnectionNamespaces,
2500
+ ds as useConnectionStatus,
2501
+ us as useConnections,
2502
+ qs as useDependencyTree,
2503
+ Ns as useEditorSchemas,
2504
+ Ur as useEventBatcher,
2505
+ gs as useExec,
2506
+ Ds as useExecuteAction,
2507
+ ss as useExtensionPoint,
2508
+ Dn as useExtensionRegistry,
2509
+ hs as useLogs,
2510
+ ys as useMetricProviders,
2511
+ Un as useMetricProvidersForResource,
2512
+ Es as useMetricStream,
2513
+ kr as useOperations,
2514
+ _e as usePluginContext,
2515
+ fs as usePluginData,
2516
+ Gs as usePluginRouter,
2517
+ ts as usePluginSettings,
2518
+ Ss as usePortForwardSessions,
2519
+ Ie as useRefetchOnGraphChange,
2520
+ ks as useRelatedResources,
2521
+ T as useResolvedPluginId,
2522
+ ws as useResource,
2523
+ Fs as useResourceActions,
2524
+ vs as useResourceAreaComponent,
2525
+ Ms as useResourceGraph,
2526
+ bs as useResourceGroups,
2527
+ ms as useResourceMetrics,
2528
+ Ts as useResourceMutations,
2529
+ _s as useResourcePortForwarder,
2530
+ Rs as useResourceSearch,
2531
+ Is as useResourceType,
2532
+ Os as useResourceTypes,
2533
+ As as useResources,
2534
+ ps as useRightDrawer,
2535
+ $s as useSettings,
2536
+ G as useSnackbar,
2537
+ Ls as useStreamAction,
2538
+ Ps as useWatchState
2466
2539
  };