@omniviewdev/runtime 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
- var it = Object.defineProperty;
2
- var at = (t, e, n) => e in t ? it(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var T = (t, e, n) => at(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { jsx as A, jsxs as X } from "react/jsx-runtime";
5
- import b, { useContext as Y, createContext as re, useState as q, useCallback as k, useSyncExternalStore as ct, useRef as W, useEffect as G, useMemo as ut } from "react";
6
- import { Link as lt, useNavigate as dt, useLocation as ft, createMemoryRouter as pt, RouterProvider as yt } from "react-router-dom";
7
- import { P as gt, G as ht, V as mt, S as St, a as Ie, U as _t, R as wt, b as Et, c as De, d as Ct, L as bt, e as vt, f as Rt, g as Ft, h as It, i as Dt, j as Pt, C as Ot, k as Tt, l as At, m as xt, n as Nt, Q as Lt, o as kt, p as Ee, q as Mt, r as Pe, F as $t, s as Ut, t as Oe, D as Te, u as qt, v as Wt, w as Gt, x as Ae, y as jt, z as Qt, A as xe, B as Kt, E as Bt, H as Ht, I as zt, J as Yt, K as Jt, M as Zt, N as Xt, O as Vt } from "./graphservice-CXr8ZCEY.js";
8
- import { P as en, W as tn, S as nn, C as rn, L as sn, F as on, a as an, U as Ne, D as Le, G as cn, b as ke, c as Me, A as $e } from "./models-BvR5jdms.js";
9
- import { useQueryClient as j, useMutation as P, useQuery as O, keepPreviousData as Ue, useQueries as un } from "@tanstack/react-query";
10
- import { useToast as ln } from "@omniviewdev/base-ui";
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 A = (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 b, { useContext as Y, createContext as re, useState as G, useCallback as L, useSyncExternalStore as ut, useRef as q, useEffect as U, useMemo as lt } from "react";
6
+ import { Link as dt, useNavigate as ft, useLocation as pt, createMemoryRouter as yt, RouterProvider as gt } from "react-router-dom";
7
+ 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 xt, l as Dt, m as Nt, n as kt, Q as Lt, o as Mt, p as Ce, q as $t, r as Te, F as qt, s as Ut, t as Ae, D as xe, u as Wt, v as Gt, w as jt, x as De, 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-5kuEPkCT.js";
8
+ 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 $e, A as qe } from "./models-B97zjrHu.js";
9
+ import { useQueryClient as j, useMutation as T, useQuery as O, keepPreviousData as Ue, useQueries as dn } from "@tanstack/react-query";
10
+ import { useToast as fn } from "@omniviewdev/base-ui";
11
11
  import "./index-D2mKAO8s.js";
12
- import { O as x, a as qe, b as ae } from "./events-DDTGFACO.js";
13
- import { w as dn } from "./legacyEnum-DORXlU_y.js";
12
+ import { O as D, a as We, b as ae } from "./events-DDTGFACO.js";
13
+ import { w as pn } from "./legacyEnum-DORXlU_y.js";
14
14
  const ye = b.createContext(void 0), $ = {
15
15
  // Plugin
16
16
  PLUGIN_NOT_FOUND: "omniview:plugin/not-found",
@@ -42,7 +42,7 @@ const ye = b.createContext(void 0), $ = {
42
42
  VALIDATION: "omniview:validation",
43
43
  NOT_IMPLEMENTED: "omniview:not-implemented"
44
44
  };
45
- function fn(t) {
45
+ function yn(t) {
46
46
  switch (t) {
47
47
  case "NOT_FOUND":
48
48
  return { typeUri: $.RESOURCE_NOT_FOUND, status: 404 };
@@ -78,7 +78,7 @@ function Q(t) {
78
78
  if (typeof n.type == "string" && typeof n.title == "string" && typeof n.status == "number" && typeof n.detail == "string")
79
79
  return n;
80
80
  if (typeof n.code == "string" && typeof n.title == "string" && typeof n.message == "string") {
81
- const { typeUri: r, status: s } = fn(n.code);
81
+ const { typeUri: r, status: s } = yn(n.code);
82
82
  return {
83
83
  type: r,
84
84
  title: n.title,
@@ -96,10 +96,10 @@ function Q(t) {
96
96
  detail: e
97
97
  };
98
98
  }
99
- function We(t) {
99
+ function Ge(t) {
100
100
  return t == null ? !1 : (typeof t == "string" ? t : t instanceof Error ? t.message : String(t)) === "cancelled" ? !0 : Q(t).type === $.CANCELLED;
101
101
  }
102
- function pn(t) {
102
+ function gn(t) {
103
103
  switch (t.type) {
104
104
  case "navigate":
105
105
  return {
@@ -136,7 +136,7 @@ function pn(t) {
136
136
  };
137
137
  }
138
138
  }
139
- function Ge(t, e) {
139
+ function je(t, e) {
140
140
  var s, i;
141
141
  const n = [
142
142
  t.detail,
@@ -147,46 +147,46 @@ function Ge(t, e) {
147
147
  message: e || (t.title !== "Error" ? t.title : "Operation failed"),
148
148
  status: "error",
149
149
  details: n,
150
- actions: (i = t.actions) == null ? void 0 : i.map(pn)
150
+ actions: (i = t.actions) == null ? void 0 : i.map(gn)
151
151
  };
152
152
  }
153
153
  function z(t, e, n) {
154
- if (We(e)) return;
154
+ if (Ge(e)) return;
155
155
  const r = Q(e);
156
- t(Ge(r, n));
156
+ t(je(r, n));
157
157
  }
158
- function L(t, e) {
158
+ function k(t, e) {
159
159
  return (n) => {
160
- if (We(n)) return;
160
+ if (Ge(n)) return;
161
161
  const r = Q(n);
162
- t(Ge(r, r.title !== "Error" ? r.title : e));
162
+ t(je(r, r.title !== "Error" ? r.title : e));
163
163
  };
164
164
  }
165
- function Br(t) {
166
- const { children: e, pluginId: n } = t, [r, s] = b.useState({}), [i, o] = b.useState(new en()), [a, c] = b.useState(!1), [l, u] = b.useState(null);
165
+ function zr(t) {
166
+ const { children: e, pluginId: n } = t, [r, s] = b.useState({}), [i, o] = b.useState(new nn()), [a, c] = b.useState(!1), [l, u] = b.useState(null);
167
167
  console.debug("[PluginContextProvider] render", { pluginId: n, metaLoaded: a, metaError: !!l });
168
- const y = () => {
169
- n === void 0 || n === "" || (console.debug(`[PluginContextProvider] fetching settings for "${n}"`), gt(n).then((d) => {
168
+ const p = () => {
169
+ n === void 0 || n === "" || (console.debug(`[PluginContextProvider] fetching settings for "${n}"`), ht(n).then((d) => {
170
170
  console.debug(`[PluginContextProvider] settings loaded for "${n}"`, Object.keys(d)), s(d);
171
171
  }).catch((d) => {
172
- const p = Q(d);
173
- console.error(`[PluginContextProvider] error fetching settings for "${n}":`, p.detail);
172
+ const y = Q(d);
173
+ console.error(`[PluginContextProvider] error fetching settings for "${n}":`, y.detail);
174
174
  }));
175
175
  }, f = () => {
176
176
  if (n === void 0 || n === "") {
177
177
  console.debug("[PluginContextProvider] skipping meta fetch — empty pluginId");
178
178
  return;
179
179
  }
180
- console.debug(`[PluginContextProvider] fetching meta for "${n}"`), u(null), ht(n).then((d) => {
180
+ console.debug(`[PluginContextProvider] fetching meta for "${n}"`), u(null), mt(n).then((d) => {
181
181
  console.debug(`[PluginContextProvider] meta loaded for "${n}"`, { name: d == null ? void 0 : d.name, version: d == null ? void 0 : d.version }), o(d), c(!0);
182
182
  }).catch((d) => {
183
- const p = Q(d);
184
- console.error(`[PluginContextProvider] error fetching meta for "${n}":`, p.detail), u(p.detail), c(!1);
183
+ const y = Q(d);
184
+ console.error(`[PluginContextProvider] error fetching meta for "${n}":`, y.detail), u(y.detail), c(!1);
185
185
  });
186
186
  };
187
187
  return b.useEffect(() => {
188
- console.debug(`[PluginContextProvider] useEffect — pluginId changed to "${n}"`), y(), f();
189
- }, [n]), l ? /* @__PURE__ */ A("div", { style: {
188
+ console.debug(`[PluginContextProvider] useEffect — pluginId changed to "${n}"`), p(), f();
189
+ }, [n]), l ? /* @__PURE__ */ x("div", { style: {
190
190
  display: "flex",
191
191
  flex: 1,
192
192
  alignItems: "center",
@@ -203,14 +203,14 @@ function Br(t) {
203
203
  }, children: [
204
204
  /* @__PURE__ */ X("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 12 }, children: [
205
205
  /* @__PURE__ */ X("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "#EF4444", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
206
- /* @__PURE__ */ A("circle", { cx: "12", cy: "12", r: "10" }),
207
- /* @__PURE__ */ A("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
208
- /* @__PURE__ */ A("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
206
+ /* @__PURE__ */ x("circle", { cx: "12", cy: "12", r: "10" }),
207
+ /* @__PURE__ */ x("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
208
+ /* @__PURE__ */ x("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
209
209
  ] }),
210
- /* @__PURE__ */ A("span", { style: { fontSize: 14, fontWeight: 600, color: "#FECACA" }, children: "Plugin failed to load" })
210
+ /* @__PURE__ */ x("span", { style: { fontSize: 14, fontWeight: 600, color: "#FECACA" }, children: "Plugin failed to load" })
211
211
  ] }),
212
- /* @__PURE__ */ A("p", { style: { fontSize: 13, color: "#A1A1AA", margin: "0 0 16px" }, children: l }),
213
- /* @__PURE__ */ A(
212
+ /* @__PURE__ */ x("p", { style: { fontSize: 13, color: "#A1A1AA", margin: "0 0 16px" }, children: l }),
213
+ /* @__PURE__ */ x(
214
214
  "button",
215
215
  {
216
216
  onClick: () => f(),
@@ -227,13 +227,13 @@ function Br(t) {
227
227
  children: "Retry"
228
228
  }
229
229
  )
230
- ] }) }) : a ? /* @__PURE__ */ A(ye.Provider, { value: { pluginId: n, settings: r, meta: i }, children: e }) : /* @__PURE__ */ X("div", { style: {
230
+ ] }) }) : a ? /* @__PURE__ */ x(ye.Provider, { value: { pluginId: n, settings: r, meta: i }, children: e }) : /* @__PURE__ */ X("div", { style: {
231
231
  display: "flex",
232
232
  flex: 1,
233
233
  alignItems: "center",
234
234
  justifyContent: "center"
235
235
  }, children: [
236
- /* @__PURE__ */ A("div", { style: {
236
+ /* @__PURE__ */ x("div", { style: {
237
237
  width: 24,
238
238
  height: 24,
239
239
  border: "2px solid #3F3F46",
@@ -241,7 +241,7 @@ function Br(t) {
241
241
  borderRadius: "50%",
242
242
  animation: "plugin-spin 0.8s linear infinite"
243
243
  } }),
244
- /* @__PURE__ */ A("style", { children: "@keyframes plugin-spin { to { transform: rotate(360deg); } }" })
244
+ /* @__PURE__ */ x("style", { children: "@keyframes plugin-spin { to { transform: rotate(360deg); } }" })
245
245
  ] });
246
246
  }
247
247
  function ge() {
@@ -250,12 +250,12 @@ function ge() {
250
250
  throw new Error("usePluginContext must be used within a PluginContextProvider");
251
251
  return t;
252
252
  }
253
- function Hr() {
253
+ function Yr() {
254
254
  return ge().settings;
255
255
  }
256
- const je = re(void 0), zr = ({ children: t }) => {
257
- const [e, n] = q({}), r = () => {
258
- mt().then((i) => {
256
+ const Qe = re(void 0), Jr = ({ children: t }) => {
257
+ const [e, n] = G({}), r = () => {
258
+ St().then((i) => {
259
259
  console.log("Fetched settings:", i), n(i);
260
260
  }).catch((i) => {
261
261
  console.error("Error fetching settings:", i);
@@ -267,8 +267,8 @@ const je = re(void 0), zr = ({ children: t }) => {
267
267
  const s = () => {
268
268
  r();
269
269
  };
270
- return /* @__PURE__ */ A(je.Provider, { value: { settings: e, reload: s }, children: t });
271
- }, yn = {
270
+ return /* @__PURE__ */ x(Qe.Provider, { value: { settings: e, reload: s }, children: t });
271
+ }, hn = {
272
272
  height: 32,
273
273
  focused: 0,
274
274
  tabs: [],
@@ -292,7 +292,7 @@ const je = re(void 0), zr = ({ children: t }) => {
292
292
  },
293
293
  fullscreenDrawer: () => {
294
294
  }
295
- }, gn = b.createContext(yn), hn = re(void 0), mn = b.createContext(void 0), Qe = b.createContext(void 0), Sn = 3e4, Yr = ({ children: t }) => {
295
+ }, mn = b.createContext(hn), Sn = re(void 0), _n = b.createContext(void 0), Ke = b.createContext(void 0), En = 3e4, Zr = ({ children: t }) => {
296
296
  const [e, n] = b.useState([]), r = b.useCallback((a) => {
297
297
  n((c) => [a, ...c]);
298
298
  }, []), s = b.useCallback((a, c) => {
@@ -306,7 +306,7 @@ const je = re(void 0), zr = ({ children: t }) => {
306
306
  const a = [];
307
307
  for (const c of e)
308
308
  if (c.status === "completed" || c.status === "error") {
309
- const l = Date.now() - (c.completedAt ?? c.startedAt), u = Math.max(0, Sn - l);
309
+ const l = Date.now() - (c.completedAt ?? c.startedAt), u = Math.max(0, En - l);
310
310
  a.push(setTimeout(() => i(c.id), u));
311
311
  }
312
312
  return () => a.forEach(clearTimeout);
@@ -315,7 +315,7 @@ const je = re(void 0), zr = ({ children: t }) => {
315
315
  () => ({ operations: e, addOperation: r, updateOperation: s, removeOperation: i }),
316
316
  [e, r, s, i]
317
317
  );
318
- return /* @__PURE__ */ A(Qe.Provider, { value: o, children: t });
318
+ return /* @__PURE__ */ x(Ke.Provider, { value: o, children: t });
319
319
  };
320
320
  var de = function(t, e) {
321
321
  return de = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
@@ -324,7 +324,7 @@ var de = function(t, e) {
324
324
  for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (n[s] = r[s]);
325
325
  }, de(t, e);
326
326
  };
327
- function _n(t, e) {
327
+ function wn(t, e) {
328
328
  if (typeof e != "function" && e !== null)
329
329
  throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
330
330
  de(t, e);
@@ -333,28 +333,28 @@ function _n(t, e) {
333
333
  }
334
334
  t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
335
335
  }
336
- var ce = "Invariant Violation", Ce = Object.setPrototypeOf, wn = Ce === void 0 ? function(t, e) {
336
+ var ce = "Invariant Violation", be = Object.setPrototypeOf, Cn = be === void 0 ? function(t, e) {
337
337
  return t.__proto__ = e, t;
338
- } : Ce, En = (
338
+ } : be, bn = (
339
339
  /** @class */
340
340
  function(t) {
341
- _n(e, t);
341
+ wn(e, t);
342
342
  function e(n) {
343
343
  n === void 0 && (n = ce);
344
344
  var r = t.call(this, typeof n == "number" ? ce + ": " + n + " (see https://github.com/apollographql/invariant-packages)" : n) || this;
345
- return r.framesToPop = 1, r.name = ce, wn(r, e.prototype), r;
345
+ return r.framesToPop = 1, r.name = ce, Cn(r, e.prototype), r;
346
346
  }
347
347
  return e;
348
348
  }(Error)
349
349
  );
350
350
  function fe(t, e) {
351
351
  if (!t)
352
- throw new En(e);
352
+ throw new bn(e);
353
353
  }
354
- var Ke = ["debug", "log", "warn", "error", "silent"], Cn = Ke.indexOf("log");
354
+ var He = ["debug", "log", "warn", "error", "silent"], vn = He.indexOf("log");
355
355
  function V(t) {
356
356
  return function() {
357
- if (Ke.indexOf(t) >= Cn) {
357
+ if (He.indexOf(t) >= vn) {
358
358
  var e = console[t] || console.log;
359
359
  return e.apply(console, arguments);
360
360
  }
@@ -363,9 +363,9 @@ function V(t) {
363
363
  (function(t) {
364
364
  t.debug = V("debug"), t.log = V("log"), t.warn = V("warn"), t.error = V("error");
365
365
  })(fe || (fe = {}));
366
- const Be = re(void 0), bn = () => Y(Be);
367
- function Jr(t) {
368
- const e = bn(), n = b.useRef(null), r = e == null ? void 0 : e.getExtensionPoint(t), s = k(
366
+ const Be = re(void 0), Rn = () => Y(Be);
367
+ function Xr(t) {
368
+ const e = Rn(), n = b.useRef(null), r = e == null ? void 0 : e.getExtensionPoint(t), s = L(
369
369
  (o) => {
370
370
  const a = [];
371
371
  return e && a.push(e.subscribe(o)), r && a.push(r.subscribe(o)), () => {
@@ -374,7 +374,7 @@ function Jr(t) {
374
374
  };
375
375
  },
376
376
  [e, t, r]
377
- ), i = k(() => {
377
+ ), i = L(() => {
378
378
  const o = e == null ? void 0 : e.getExtensionPoint(t);
379
379
  if (!o) {
380
380
  if (n.current && n.current.store === void 0)
@@ -388,30 +388,30 @@ function Jr(t) {
388
388
  const c = {};
389
389
  return n.current = { store: o, version: o.version, sentinel: c }, c;
390
390
  }, [e, t]);
391
- return ct(s, i), e == null ? void 0 : e.getExtensionPoint(t);
391
+ return ut(s, i), e == null ? void 0 : e.getExtensionPoint(t);
392
392
  }
393
- const Zr = ({ registry: t, children: e }) => {
393
+ const Vr = ({ registry: t, children: e }) => {
394
394
  const n = b.useRef(t);
395
395
  return fe(
396
396
  n.current === t,
397
397
  "You can't change the extension registry after it has been rendered"
398
- ), /* @__PURE__ */ A(Be.Provider, { value: n.current, children: e });
398
+ ), /* @__PURE__ */ x(Be.Provider, { value: n.current, children: e });
399
399
  }, ue = (t) => {
400
400
  if (!t || typeof t != "string")
401
401
  throw new TypeError(`extensionName is required to be a string and can't be: "${t}" (${typeof t})`);
402
402
  return t.trim();
403
403
  };
404
- class vn {
404
+ class Fn {
405
405
  constructor(e) {
406
- T(this, "id");
407
- T(this, "mode");
408
- T(this, "_pluginId");
409
- T(this, "_version", 0);
410
- T(this, "_contributions", /* @__PURE__ */ new Map());
411
- T(this, "_lookupCache", /* @__PURE__ */ new Map());
412
- T(this, "_matcher");
413
- T(this, "_select");
414
- T(this, "_listeners", /* @__PURE__ */ new Set());
406
+ A(this, "id");
407
+ A(this, "mode");
408
+ A(this, "_pluginId");
409
+ A(this, "_version", 0);
410
+ A(this, "_contributions", /* @__PURE__ */ new Map());
411
+ A(this, "_lookupCache", /* @__PURE__ */ new Map());
412
+ A(this, "_matcher");
413
+ A(this, "_select");
414
+ A(this, "_listeners", /* @__PURE__ */ new Set());
415
415
  this.id = e.id, this.mode = e.mode ?? "multiple", this._pluginId = e.pluginId, this._matcher = e.matcher, this._select = e.select;
416
416
  }
417
417
  get pluginId() {
@@ -521,11 +521,11 @@ class vn {
521
521
  e();
522
522
  }
523
523
  }
524
- class Xr {
524
+ class es {
525
525
  constructor(e) {
526
- T(this, "_stores", /* @__PURE__ */ new Map());
527
- T(this, "_storeUnsubs", /* @__PURE__ */ new Map());
528
- T(this, "_listeners", /* @__PURE__ */ new Set());
526
+ A(this, "_stores", /* @__PURE__ */ new Map());
527
+ A(this, "_storeUnsubs", /* @__PURE__ */ new Map());
528
+ A(this, "_listeners", /* @__PURE__ */ new Set());
529
529
  if (e != null && e.initialStores)
530
530
  for (const n of e.initialStores)
531
531
  this.addExtensionPoint(n);
@@ -542,7 +542,7 @@ class Xr {
542
542
  `Extension point "${n}" already exists (owned by "${s.pluginId ?? "unknown"}")`
543
543
  );
544
544
  }
545
- const r = new vn({ ...e, id: n });
545
+ const r = new Fn({ ...e, id: n });
546
546
  this._stores.set(n, r), this._storeUnsubs.set(n, r.subscribe(() => this._notify())), this._notify();
547
547
  }
548
548
  /**
@@ -597,42 +597,42 @@ class Xr {
597
597
  e();
598
598
  }
599
599
  }
600
- const He = re(void 0), Rn = {
600
+ const ze = re(void 0), In = {
601
601
  default: "info",
602
602
  info: "info",
603
603
  success: "success",
604
604
  warning: "warning",
605
605
  error: "danger"
606
- }, Vr = ({ children: t }) => {
607
- const { toast: e } = ln(), [n, r] = b.useState([]), s = (o) => {
606
+ }, ts = ({ children: t }) => {
607
+ const { toast: e } = fn(), [n, r] = b.useState([]), s = (o) => {
608
608
  r((a) => [...a, o]);
609
609
  }, i = (o, a, c) => {
610
610
  const l = typeof o == "object";
611
- let u = "", y = "info", f, d = 5e3, p;
611
+ let u = "", p = "info", f, d = 5e3, y;
612
612
  if (l) {
613
613
  if (u = o.message, o.showOnce) {
614
614
  if (n.includes(u))
615
615
  return;
616
616
  s(u);
617
617
  }
618
- y = o.status, f = o.details, d = o.autoHideDuration ?? 5e3, p = o.actions;
618
+ p = o.status, f = o.details, d = o.autoHideDuration ?? 5e3, y = o.actions;
619
619
  } else
620
- u = o, y = a, f = c;
620
+ u = o, p = a, f = c;
621
621
  e(f ?? u, {
622
- severity: Rn[y] ?? "info",
622
+ severity: In[p] ?? "info",
623
623
  title: f ? u : void 0,
624
624
  duration: d,
625
- action: p == null ? void 0 : p[0]
625
+ action: y == null ? void 0 : y[0]
626
626
  });
627
627
  };
628
- return /* @__PURE__ */ A(He.Provider, { value: { showSnackbar: i }, children: t });
629
- }, U = () => {
630
- const t = Y(He);
628
+ return /* @__PURE__ */ x(ze.Provider, { value: { showSnackbar: i }, children: t });
629
+ }, W = () => {
630
+ const t = Y(ze);
631
631
  if (t === void 0)
632
632
  throw new Error("useCustomSnackbar must be used within a CustomSnackbarProvider");
633
633
  return t;
634
634
  };
635
- function D(t) {
635
+ function P(t) {
636
636
  const e = Y(ye), n = (e == null ? void 0 : e.pluginId) ?? t;
637
637
  if (!n)
638
638
  throw new Error(
@@ -640,39 +640,39 @@ function D(t) {
640
640
  );
641
641
  return n;
642
642
  }
643
- const es = ({ pluginID: t, connectionID: e }) => {
644
- const n = D(t), r = j(), { showSnackbar: s } = U(), i = [n, "connection", "detail", e], { mutateAsync: o } = P({
645
- mutationFn: async () => St(n, e),
646
- onSuccess(y) {
647
- r.setQueryData(i, y), r.invalidateQueries({
643
+ const ns = ({ pluginID: t, connectionID: e }) => {
644
+ const n = P(t), r = j(), { showSnackbar: s } = W(), i = [n, "connection", "detail", e], { mutateAsync: o } = T({
645
+ mutationFn: async () => _t(n, e),
646
+ onSuccess(p) {
647
+ r.setQueryData(i, p), r.invalidateQueries({
648
648
  queryKey: ["EDITOR_SCHEMAS", n, e]
649
649
  });
650
650
  },
651
- onError: L(s, "Failed to start connection")
652
- }), { mutateAsync: a } = P({
653
- mutationFn: async () => Ie(n, e),
654
- onSuccess(y) {
655
- r.setQueryData(i, y);
651
+ onError: k(s, "Failed to start connection")
652
+ }), { mutateAsync: a } = T({
653
+ mutationFn: async () => Pe(n, e),
654
+ onSuccess(p) {
655
+ r.setQueryData(i, p);
656
656
  },
657
- onError: L(s, "Failed to stop connection")
658
- }), { mutateAsync: c } = P({
659
- mutationFn: async (y) => _t(n, y),
660
- onSuccess(y, { name: f }) {
661
- s({ message: `Connection ${f} successfully updated`, status: "success" }), r.setQueryData(i, y), r.setQueriesData(
657
+ onError: k(s, "Failed to stop connection")
658
+ }), { mutateAsync: c } = T({
659
+ mutationFn: async (p) => Et(n, p),
660
+ onSuccess(p, { name: f }) {
661
+ s({ message: `Connection ${f} successfully updated`, status: "success" }), r.setQueryData(i, p), r.setQueriesData(
662
662
  { queryKey: [n, "connection", "list"] },
663
- (d) => d == null ? void 0 : d.map((p) => p.id === e ? y : p)
663
+ (d) => d == null ? void 0 : d.map((y) => y.id === e ? p : y)
664
664
  );
665
665
  },
666
- onError: L(s, "Failed to update connection")
667
- }), { mutateAsync: l } = P({
666
+ onError: k(s, "Failed to update connection")
667
+ }), { mutateAsync: l } = T({
668
668
  mutationFn: async () => wt(n, e),
669
669
  onSuccess() {
670
670
  s({ message: "Connection successfully removed", status: "success" }), r.setQueryData(i, void 0), r.setQueriesData(
671
671
  { queryKey: [n, "connection", "list"] },
672
- (y) => y == null ? void 0 : y.filter((f) => f.id !== e)
672
+ (p) => p == null ? void 0 : p.filter((f) => f.id !== e)
673
673
  );
674
674
  },
675
- onError: L(s, "Failed to remove connection")
675
+ onError: k(s, "Failed to remove connection")
676
676
  });
677
677
  return {
678
678
  /**
@@ -680,7 +680,7 @@ const es = ({ pluginID: t, connectionID: e }) => {
680
680
  */
681
681
  connection: O({
682
682
  queryKey: i,
683
- queryFn: async () => Et(n, e)
683
+ queryFn: async () => Ct(n, e)
684
684
  }),
685
685
  /**
686
686
  * Start the connection
@@ -699,19 +699,19 @@ const es = ({ pluginID: t, connectionID: e }) => {
699
699
  */
700
700
  deleteConnection: l
701
701
  };
702
- }, Fn = (t) => [t, "connection", "list"], ts = ({ plugin: t }) => {
703
- const e = D(t), n = j(), { showSnackbar: r } = U(), s = Fn(e), { mutateAsync: i } = P({
704
- mutationFn: async (l) => De(e, l.id),
705
- onError: L(r, "Failed to start connection watch")
706
- }), { mutateAsync: o } = P({
707
- mutationFn: async (l) => Ct(e, l.id),
708
- onError: L(r, "Failed to stop connection watch")
702
+ }, Pn = (t) => [t, "connection", "list"], rs = ({ plugin: t }) => {
703
+ const e = P(t), n = j(), { showSnackbar: r } = W(), s = Pn(e), { mutateAsync: i } = T({
704
+ mutationFn: async (l) => Oe(e, l.id),
705
+ onError: k(r, "Failed to start connection watch")
706
+ }), { mutateAsync: o } = T({
707
+ mutationFn: async (l) => bt(e, l.id),
708
+ onError: k(r, "Failed to stop connection watch")
709
709
  }), a = b.useCallback((l) => {
710
710
  const u = l.data;
711
711
  console.log("got update to connections", u), n.setQueryData(s, u);
712
712
  }, [n, s]);
713
713
  return b.useEffect(() => {
714
- const l = x(`${e}/connection/sync`, a);
714
+ const l = D(`${e}/connection/sync`, a);
715
715
  return () => {
716
716
  l();
717
717
  };
@@ -720,9 +720,9 @@ const es = ({ pluginID: t, connectionID: e }) => {
720
720
  queryKey: s,
721
721
  queryFn: async () => {
722
722
  try {
723
- return await bt(e);
723
+ return await vt(e);
724
724
  } catch (l) {
725
- console.log(l), L(r, "Failed to load connections")(l);
725
+ console.log(l), k(r, "Failed to load connections")(l);
726
726
  }
727
727
  return [];
728
728
  },
@@ -732,18 +732,18 @@ const es = ({ pluginID: t, connectionID: e }) => {
732
732
  startWatch: i,
733
733
  stopWatch: o
734
734
  };
735
- }, ns = ({ pluginID: t, connectionID: e }) => {
736
- const n = D(t);
735
+ }, ss = ({ pluginID: t, connectionID: e }) => {
736
+ const n = P(t);
737
737
  return {
738
738
  /**
739
739
  * Get the connection
740
740
  */
741
741
  namespaces: O({
742
742
  queryKey: [n, "connection", "namespaces", e],
743
- queryFn: async () => vt(n, e)
743
+ queryFn: async () => Rt(n, e)
744
744
  })
745
745
  };
746
- }, F = dn(tn, "WatchState");
746
+ }, F = pn(rn, "WatchState");
747
747
  function pe(t) {
748
748
  const e = Object.values(t.states), n = e.length;
749
749
  let r = 0, s = 0, i = 0, o = 0;
@@ -768,17 +768,17 @@ function pe(t) {
768
768
  function ne(t) {
769
769
  return t.watchedTotal > 0 && t.doneCount >= t.watchedTotal;
770
770
  }
771
- function ze(t) {
771
+ function Ye(t) {
772
772
  return t.some((e) => !ne(e));
773
773
  }
774
- function Ye(t) {
774
+ function Je(t) {
775
775
  const e = t.reduce((r, s) => r + s.watchedTotal, 0);
776
776
  return e === 0 ? 0 : t.reduce((r, s) => r + s.doneCount, 0) / e;
777
777
  }
778
778
  function he(t) {
779
779
  return `${t.pluginId}/${t.connection}`;
780
780
  }
781
- function Je(t, e) {
781
+ function Ze(t, e) {
782
782
  const n = he(e);
783
783
  t.has(n) || t.set(n, {
784
784
  states: {},
@@ -788,34 +788,34 @@ function Je(t, e) {
788
788
  const r = t.get(n);
789
789
  return r.states[e.resourceKey] = e.state, r;
790
790
  }
791
- function rs() {
792
- const [t, e] = q(/* @__PURE__ */ new Set()), [n, r] = q({}), [s, i] = q(/* @__PURE__ */ new Map()), o = W(/* @__PURE__ */ new Map()), [a, c] = q(/* @__PURE__ */ new Map());
793
- G(() => {
794
- const g = x("plugin/crash_recovery_failed", (R) => {
795
- const w = R.data, S = w == null ? void 0 : w.pluginID;
796
- S && c((E) => {
797
- const I = new Map(E);
798
- return I.set(S, w.error ?? "Crash recovery failed"), I;
791
+ function os() {
792
+ 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());
793
+ U(() => {
794
+ const g = D("plugin/crash_recovery_failed", (R) => {
795
+ const E = R.data, S = E == null ? void 0 : E.pluginID;
796
+ S && c((w) => {
797
+ const I = new Map(w);
798
+ return I.set(S, E.error ?? "Crash recovery failed"), I;
799
799
  });
800
- }), v = x("plugin/recovered", (R) => {
801
- const w = R.data, S = w == null ? void 0 : w.pluginID;
802
- S && c((E) => {
803
- if (!E.has(S)) return E;
804
- const I = new Map(E);
800
+ }), v = D("plugin/recovered", (R) => {
801
+ const E = R.data, S = E == null ? void 0 : E.pluginID;
802
+ S && c((w) => {
803
+ if (!w.has(S)) return w;
804
+ const I = new Map(w);
805
805
  return I.delete(S), I;
806
806
  });
807
807
  });
808
808
  return () => {
809
809
  g(), v();
810
810
  };
811
- }, []), G(() => {
812
- Rt().then((g) => {
811
+ }, []), U(() => {
812
+ Ft().then((g) => {
813
813
  if (!g) return;
814
- const v = {}, R = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Map();
815
- for (const [S, E] of Object.entries(g))
816
- if (E) {
817
- v[S] = E.map((I) => I.connection);
818
- for (const I of E) {
814
+ const v = {}, R = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Map();
815
+ for (const [S, w] of Object.entries(g))
816
+ if (w) {
817
+ v[S] = w.map((I) => I.connection);
818
+ for (const I of w) {
819
819
  if (!I.started) continue;
820
820
  const M = `${S}/${I.connection.id}`;
821
821
  R.add(M);
@@ -825,118 +825,118 @@ function rs() {
825
825
  states: {}
826
826
  };
827
827
  if (I.resources)
828
- for (const [ie, ot] of Object.entries(I.resources))
829
- N.states[ie] = ot;
830
- o.current.set(M, N), w.set(M, pe(N));
828
+ for (const [ie, it] of Object.entries(I.resources))
829
+ N.states[ie] = it;
830
+ o.current.set(M, N), E.set(M, pe(N));
831
831
  }
832
832
  }
833
- r(v), e(R), i(w);
833
+ r(v), e(R), i(E);
834
834
  }).catch(() => {
835
835
  });
836
- }, []), G(() => x("connection/status", (v) => {
837
- const R = v.data, w = `${R.pluginID}/${R.connectionID}`;
836
+ }, []), U(() => D("connection/status", (v) => {
837
+ const R = v.data, E = `${R.pluginID}/${R.connectionID}`;
838
838
  R.status === "DISCONNECTED" ? (e((S) => {
839
- const E = new Set(S);
840
- return E.delete(w), E;
839
+ const w = new Set(S);
840
+ return w.delete(E), w;
841
841
  }), i((S) => {
842
- const E = new Map(S);
843
- return E.delete(w), E;
844
- }), o.current.delete(w)) : e((S) => {
845
- const E = new Set(S);
846
- return E.add(w), E;
847
- }), It().then((S) => {
842
+ const w = new Map(S);
843
+ return w.delete(E), w;
844
+ }), o.current.delete(E)) : e((S) => {
845
+ const w = new Set(S);
846
+ return w.add(E), w;
847
+ }), Pt().then((S) => {
848
848
  if (!S) return;
849
- const E = {};
849
+ const w = {};
850
850
  for (const [I, M] of Object.entries(S))
851
- M != null && (E[I] = M);
852
- r(E);
851
+ M != null && (w[I] = M);
852
+ r(w);
853
853
  }).catch(() => {
854
854
  });
855
855
  }), []);
856
- const l = k((g) => {
856
+ const l = L((g) => {
857
857
  const v = g.data, R = he(v);
858
- e((E) => {
859
- if (E.has(R)) return E;
860
- const I = new Set(E);
858
+ e((w) => {
859
+ if (w.has(R)) return w;
860
+ const I = new Set(w);
861
861
  return I.add(R), I;
862
862
  });
863
- const w = Je(o.current, v), S = pe(w);
864
- i((E) => {
865
- const I = new Map(E);
863
+ const E = Ze(o.current, v), S = pe(E);
864
+ i((w) => {
865
+ const I = new Map(w);
866
866
  return I.set(R, S), I;
867
867
  });
868
868
  }, []);
869
- G(() => x("watch/STATE", l), [l]);
870
- const u = k(async (g, v) => {
871
- await Ie(g, v);
872
- }, []), y = k(async (g, v) => {
873
- await De(g, v);
874
- }, []), f = k(async (g) => {
869
+ U(() => D("watch/STATE", l), [l]);
870
+ const u = L(async (g, v) => {
871
+ await Pe(g, v);
872
+ }, []), p = L(async (g, v) => {
873
+ await Oe(g, v);
874
+ }, []), f = L(async (g) => {
875
875
  const v = a.get(g);
876
876
  c((R) => {
877
877
  if (!R.has(g)) return R;
878
- const w = new Map(R);
879
- return w.delete(g), w;
878
+ const E = new Map(R);
879
+ return E.delete(g), E;
880
880
  });
881
881
  try {
882
- await Ft(g);
882
+ await It(g);
883
883
  } catch (R) {
884
- throw c((w) => {
885
- const S = new Map(w);
884
+ throw c((E) => {
885
+ const S = new Map(E);
886
886
  return S.set(g, v ?? "Reload failed"), S;
887
887
  }), R;
888
888
  }
889
889
  }, [a]), d = [];
890
890
  for (const g of t) {
891
- const [v, R] = g.split("/", 2), S = (n[v] ?? []).find((ie) => ie.id === R), E = s.get(g), I = E != null && !ne(E), M = E != null && E.errorCount > 0, N = a.get(v);
891
+ const [v, R] = g.split("/", 2), S = (n[v] ?? []).find((ie) => ie.id === R), w = s.get(g), I = w != null && !ne(w), M = w != null && w.errorCount > 0, N = a.get(v);
892
892
  d.push({
893
893
  pluginID: v,
894
894
  connectionID: R,
895
895
  name: (S == null ? void 0 : S.name) ?? R,
896
896
  avatar: (S == null ? void 0 : S.avatar) ?? "",
897
897
  isStarted: !0,
898
- sync: E,
898
+ sync: w,
899
899
  isSyncing: I,
900
900
  hasErrors: M || N != null,
901
901
  pluginFailed: N != null,
902
902
  pluginError: N
903
903
  });
904
904
  }
905
- const p = /* @__PURE__ */ new Map();
905
+ const y = /* @__PURE__ */ new Map();
906
906
  for (const g of d) {
907
- const v = p.get(g.pluginID) ?? [];
908
- v.push(g), p.set(g.pluginID, v);
907
+ const v = y.get(g.pluginID) ?? [];
908
+ v.push(g), y.set(g.pluginID, v);
909
909
  }
910
910
  const _ = Array.from(s.values()), C = d.filter((g) => g.isSyncing), h = d.filter((g) => g.hasErrors), m = d.filter((g) => g.pluginFailed);
911
911
  return {
912
912
  entries: d,
913
- grouped: p,
913
+ grouped: y,
914
914
  connectedCount: d.length,
915
915
  syncingCount: C.length,
916
916
  errorCount: h.length,
917
917
  failedCount: m.length,
918
- hasSyncing: ze(_),
919
- aggregateProgress: Ye(_),
918
+ hasSyncing: Ye(_),
919
+ aggregateProgress: Je(_),
920
920
  disconnect: u,
921
- retryWatch: y,
921
+ retryWatch: p,
922
922
  retryPlugin: f
923
923
  };
924
924
  }
925
- function In(t, e) {
925
+ function On(t, e) {
926
926
  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;
927
927
  }
928
- function ss(t, e, n) {
929
- const r = D(t), s = j(), i = [r, "data", e], o = O({
928
+ function is(t, e, n) {
929
+ const r = P(t), s = j(), i = [r, "data", e], o = O({
930
930
  queryKey: i,
931
931
  queryFn: async () => {
932
- const c = await Dt(r, e);
933
- return c == null ? n : In(c, n) ? c : (console.warn(
932
+ const c = await Ot(r, e);
933
+ return c == null ? n : On(c, n) ? c : (console.warn(
934
934
  `[usePluginData] stored value for "${e}" has unexpected type (expected ${Array.isArray(n) ? "array" : typeof n}, got ${Array.isArray(c) ? "array" : typeof c}). Using default.`
935
935
  ), n);
936
936
  }
937
- }), a = P({
937
+ }), a = T({
938
938
  mutationFn: async (c) => {
939
- await Pt(r, e, c);
939
+ await Tt(r, e, c);
940
940
  },
941
941
  onMutate: async (c) => {
942
942
  await s.cancelQueries({ queryKey: i });
@@ -958,19 +958,19 @@ function ss(t, e, n) {
958
958
  isLoading: o.isLoading
959
959
  };
960
960
  }
961
- const os = () => {
962
- const t = Y(hn);
961
+ const as = () => {
962
+ const t = Y(Sn);
963
963
  if (!t) throw new Error("useRightDrawer must be used within a RightDrawerProvider");
964
964
  return t;
965
- }, Ze = () => {
966
- const t = Y(gn);
965
+ }, Xe = () => {
966
+ const t = Y(mn);
967
967
  if (t === void 0)
968
968
  throw new Error("useBottomDrawer must be used within a BottomDrawerProvider");
969
969
  return t;
970
- }, is = ({ pluginID: t }) => {
971
- const e = D(t), { showSnackbar: n } = U(), { createTab: r, updateTab: s } = Ze();
970
+ }, cs = ({ pluginID: t }) => {
971
+ const e = P(t), { showSnackbar: n } = W(), { createTab: r, updateTab: s } = Xe();
972
972
  return {
973
- createSession: P({
973
+ createSession: T({
974
974
  mutationFn: async ({ connectionID: o, icon: a, label: c, opts: l }) => {
975
975
  const u = `pending-${crypto.randomUUID()}`;
976
976
  r({
@@ -985,13 +985,13 @@ const os = () => {
985
985
  opts: { ...l }
986
986
  }
987
987
  });
988
- const y = nn.createFrom({
988
+ const p = sn.createFrom({
989
989
  command: ["/bin/bash"],
990
990
  tty: !0,
991
991
  ...l
992
992
  });
993
993
  try {
994
- const f = await Ot(e, o, y);
994
+ const f = await At(e, o, p);
995
995
  if (!f) throw new Error("Failed to create session: null response");
996
996
  s(
997
997
  { id: u },
@@ -1013,65 +1013,65 @@ const os = () => {
1013
1013
  }
1014
1014
  }).mutateAsync
1015
1015
  };
1016
- }, as = ({ pluginID: t }) => {
1017
- const e = D(t), { showSnackbar: n } = U(), { createTab: r } = Ze(), s = P({
1016
+ }, us = ({ pluginID: t }) => {
1017
+ const e = P(t), { showSnackbar: n } = W(), { createTab: r } = Xe(), s = T({
1018
1018
  mutationFn: async ({
1019
1019
  connectionID: o,
1020
1020
  resourceKey: a,
1021
1021
  resourceID: c,
1022
1022
  resourceData: l,
1023
1023
  icon: u,
1024
- label: y,
1024
+ label: p,
1025
1025
  target: f,
1026
1026
  follow: d = !0,
1027
- tailLines: p = 1e3,
1027
+ tailLines: y = 1e3,
1028
1028
  params: _
1029
1029
  }) => {
1030
- const C = rn.createFrom({
1030
+ const C = on.createFrom({
1031
1031
  resource_key: a,
1032
1032
  resource_id: c,
1033
1033
  resource_data: l,
1034
- options: sn.createFrom({
1034
+ options: an.createFrom({
1035
1035
  target: f ?? "",
1036
1036
  follow: d,
1037
1037
  include_previous: !1,
1038
1038
  include_timestamps: !0,
1039
- tail_lines: p,
1039
+ tail_lines: y,
1040
1040
  since_seconds: 0,
1041
1041
  limit_bytes: 0,
1042
1042
  include_source_events: !0,
1043
1043
  params: _ ?? {}
1044
1044
  })
1045
- }), h = await Tt(e, o, C);
1045
+ }), h = await xt(e, o, C);
1046
1046
  if (!h) throw new Error("Failed to create log session: null response");
1047
1047
  return r({
1048
1048
  id: h.id,
1049
- title: y ?? `Logs ${h.id.substring(0, 8)}`,
1049
+ title: p ?? `Logs ${h.id.substring(0, 8)}`,
1050
1050
  variant: "logs",
1051
1051
  icon: u ?? "LuLogs"
1052
1052
  }), h;
1053
1053
  },
1054
- onError: L(n, "Failed to start log session")
1055
- }), i = P({
1054
+ onError: k(n, "Failed to start log session")
1055
+ }), i = T({
1056
1056
  mutationFn: async (o) => {
1057
- await At(o);
1057
+ await Dt(o);
1058
1058
  },
1059
- onError: L(n, "Failed to close log session")
1059
+ onError: k(n, "Failed to close log session")
1060
1060
  });
1061
1061
  return {
1062
1062
  createLogSession: s.mutateAsync,
1063
1063
  closeLogSession: i.mutateAsync
1064
1064
  };
1065
- }, cs = () => O({
1065
+ }, ls = () => O({
1066
1066
  queryKey: ["metric", "providers"],
1067
- queryFn: xt,
1067
+ queryFn: Nt,
1068
1068
  staleTime: 3e4
1069
- }), Dn = (t) => O({
1069
+ }), Tn = (t) => O({
1070
1070
  queryKey: ["metric", "providers", t],
1071
- queryFn: () => Nt(t),
1071
+ queryFn: () => kt(t),
1072
1072
  enabled: !!t,
1073
1073
  staleTime: 3e4
1074
- }), us = (t) => {
1074
+ }), ds = (t) => {
1075
1075
  var C, h;
1076
1076
  const {
1077
1077
  connectionID: e,
@@ -1086,9 +1086,9 @@ const os = () => {
1086
1086
  refreshInterval: l = 0,
1087
1087
  enabled: u = !0
1088
1088
  } = t, {
1089
- data: y,
1089
+ data: p,
1090
1090
  isLoading: f
1091
- } = Dn(n), d = y ?? [], p = c ? Math.max(
1091
+ } = Tn(n), d = p ?? [], y = c ? Math.max(
1092
1092
  Math.floor((c.end.getTime() - c.start.getTime()) / 250),
1093
1093
  15e3
1094
1094
  ) * 1e6 : 0, _ = O({
@@ -1115,7 +1115,7 @@ const os = () => {
1115
1115
  a,
1116
1116
  ((c == null ? void 0 : c.start) ?? /* @__PURE__ */ new Date(0)).toISOString(),
1117
1117
  ((c == null ? void 0 : c.end) ?? /* @__PURE__ */ new Date(0)).toISOString(),
1118
- p
1118
+ y
1119
1119
  ), g = {};
1120
1120
  for (const [v, R] of Object.entries(m))
1121
1121
  R != null && (g[v] = R);
@@ -1135,7 +1135,7 @@ const os = () => {
1135
1135
  error: _.error,
1136
1136
  refetch: _.refetch
1137
1137
  };
1138
- }, ls = (t) => {
1138
+ }, fs = (t) => {
1139
1139
  const {
1140
1140
  pluginID: e,
1141
1141
  connectionID: n,
@@ -1146,10 +1146,10 @@ const os = () => {
1146
1146
  metricIDs: a = [],
1147
1147
  interval: c = 1e4,
1148
1148
  enabled: l = !0
1149
- } = t, u = D(e), [y, f] = q(null), [d, p] = q(null), [_, C] = q(!1), [h, m] = q(null), g = W(null), v = k(async () => {
1149
+ } = t, u = P(e), [p, f] = G(null), [d, y] = G(null), [_, C] = G(!1), [h, m] = G(null), g = q(null), v = L(async () => {
1150
1150
  if (!(!l || !u || !n || !r || !s))
1151
1151
  try {
1152
- const w = await kt(u, n, {
1152
+ const E = await Mt(u, n, {
1153
1153
  resource_key: r,
1154
1154
  resource_id: s,
1155
1155
  resource_namespace: i,
@@ -1158,8 +1158,8 @@ const os = () => {
1158
1158
  interval: c * 1e6
1159
1159
  // ms to nanoseconds for Go time.Duration
1160
1160
  });
1161
- p(w), C(!0), m(null);
1162
- const S = x(`core/metrics/data/${w}`, (I) => {
1161
+ y(E), C(!0), m(null);
1162
+ const S = D(`core/metrics/data/${E}`, (I) => {
1163
1163
  const M = I.data;
1164
1164
  try {
1165
1165
  const N = JSON.parse(M);
@@ -1167,7 +1167,7 @@ const os = () => {
1167
1167
  } catch (N) {
1168
1168
  console.error("Failed to parse metric stream data:", N);
1169
1169
  }
1170
- }), E = x(`core/metrics/error/${w}`, (I) => {
1170
+ }), w = D(`core/metrics/error/${E}`, (I) => {
1171
1171
  const M = I.data;
1172
1172
  try {
1173
1173
  const N = JSON.parse(M);
@@ -1177,78 +1177,78 @@ const os = () => {
1177
1177
  }
1178
1178
  });
1179
1179
  g.current = () => {
1180
- S(), E();
1180
+ S(), w();
1181
1181
  };
1182
- } catch (w) {
1183
- m(w instanceof Error ? w.message : String(w));
1182
+ } catch (E) {
1183
+ m(E instanceof Error ? E.message : String(E));
1184
1184
  }
1185
- }, [u, n, r, s, i, a, c, l]), R = k(async () => {
1185
+ }, [u, n, r, s, i, a, c, l]), R = L(async () => {
1186
1186
  if (d)
1187
1187
  try {
1188
- await Ee(d);
1189
- } catch (w) {
1190
- console.error("Failed to unsubscribe:", w);
1188
+ await Ce(d);
1189
+ } catch (E) {
1190
+ console.error("Failed to unsubscribe:", E);
1191
1191
  }
1192
- g.current && (g.current(), g.current = null), p(null), C(!1);
1192
+ g.current && (g.current(), g.current = null), y(null), C(!1);
1193
1193
  }, [d]);
1194
- return G(() => () => {
1195
- d && Ee(d).catch(console.error), g.current && g.current();
1194
+ return U(() => () => {
1195
+ d && Ce(d).catch(console.error), g.current && g.current();
1196
1196
  }, [d]), {
1197
- data: y,
1197
+ data: p,
1198
1198
  subscriptionID: d,
1199
1199
  isStreaming: _,
1200
1200
  error: h,
1201
1201
  start: v,
1202
1202
  stop: R
1203
1203
  };
1204
- }, H = ["networker", "portforward", "all-sessions"];
1205
- function ds() {
1206
- const { showSnackbar: t } = U(), e = j(), n = O({
1207
- queryKey: [...H],
1208
- queryFn: async () => Mt().catch((i) => {
1204
+ }, B = ["networker", "portforward", "all-sessions"];
1205
+ function ps() {
1206
+ const { showSnackbar: t } = W(), e = j(), n = O({
1207
+ queryKey: [...B],
1208
+ queryFn: async () => $t().catch((i) => {
1209
1209
  if (Q(i).detail.includes("not found")) return [];
1210
1210
  throw i;
1211
1211
  }),
1212
1212
  retry: !1
1213
1213
  });
1214
- G(() => {
1215
- const i = x("core/networker/portforward/created", () => {
1216
- e.invalidateQueries({ queryKey: [...H] });
1217
- }), o = x("core/networker/portforward/closed", () => {
1218
- e.invalidateQueries({ queryKey: [...H] });
1214
+ U(() => {
1215
+ const i = D("core/networker/portforward/created", () => {
1216
+ e.invalidateQueries({ queryKey: [...B] });
1217
+ }), o = D("core/networker/portforward/closed", () => {
1218
+ e.invalidateQueries({ queryKey: [...B] });
1219
1219
  });
1220
1220
  return () => {
1221
1221
  i(), o();
1222
1222
  };
1223
1223
  }, [e]);
1224
- const r = n.data ?? [], s = P({
1225
- mutationFn: async (i) => Pe(i),
1226
- onError: L(t, "Failed to close port forwarding session"),
1224
+ const r = n.data ?? [], s = T({
1225
+ mutationFn: async (i) => Te(i),
1226
+ onError: k(t, "Failed to close port forwarding session"),
1227
1227
  onSuccess: async () => {
1228
- await e.invalidateQueries({ queryKey: [...H] });
1228
+ await e.invalidateQueries({ queryKey: [...B] });
1229
1229
  }
1230
1230
  });
1231
1231
  return {
1232
1232
  sessions: n,
1233
1233
  activeSessions: r,
1234
1234
  closeSession: s.mutateAsync,
1235
- openInBrowser: (i) => qe(`http://localhost:${i}`)
1235
+ openInBrowser: (i) => We(`http://localhost:${i}`)
1236
1236
  };
1237
1237
  }
1238
- function fs({ pluginID: t, connectionID: e, resourceID: n }) {
1239
- const r = D(t), s = ["networker", "portforward", "sessions", r, e, n], { showSnackbar: i } = U(), o = j(), a = O({
1238
+ function ys({ pluginID: t, connectionID: e, resourceID: n }) {
1239
+ const r = P(t), s = ["networker", "portforward", "sessions", r, e, n], { showSnackbar: i } = W(), o = j(), a = O({
1240
1240
  queryKey: s,
1241
- queryFn: async () => $t(r, e, on.createFrom({
1241
+ queryFn: async () => qt(r, e, cn.createFrom({
1242
1242
  resource_id: n,
1243
1243
  connection_id: e
1244
1244
  })).catch((u) => {
1245
- const y = Q(u);
1246
- return y.detail.includes("not found") ? [] : (i({ message: "Failed to fetch port forward sessions", status: "error", details: y.detail }), []);
1245
+ const p = Q(u);
1246
+ return p.detail.includes("not found") ? [] : (i({ message: "Failed to fetch port forward sessions", status: "error", details: p.detail }), []);
1247
1247
  }),
1248
1248
  retry: !1
1249
- }), c = P({
1249
+ }), c = T({
1250
1250
  mutationFn: async ({ opts: u }) => {
1251
- const y = an.createFrom({
1251
+ const p = un.createFrom({
1252
1252
  local_port: u.localPort || 0,
1253
1253
  remote_port: u.remotePort,
1254
1254
  protocol: u.protocol || "TCP",
@@ -1262,24 +1262,24 @@ function fs({ pluginID: t, connectionID: e, resourceID: n }) {
1262
1262
  },
1263
1263
  labels: u.labels ?? {},
1264
1264
  params: u.parameters ?? {}
1265
- }), f = await Ut(r, e, y);
1265
+ }), f = await Ut(r, e, p);
1266
1266
  if (!f) throw new Error("Failed to start port forwarding: null response");
1267
- return u.openInBrowser && qe(`http://localhost:${f.local_port}`), f;
1267
+ return u.openInBrowser && We(`http://localhost:${f.local_port}`), f;
1268
1268
  },
1269
- onError: L(i, "Failed to start port forwarding session"),
1269
+ onError: k(i, "Failed to start port forwarding session"),
1270
1270
  onSuccess: async () => {
1271
1271
  await Promise.all([
1272
1272
  o.invalidateQueries({ queryKey: s }),
1273
- o.invalidateQueries({ queryKey: [...H] })
1273
+ o.invalidateQueries({ queryKey: [...B] })
1274
1274
  ]);
1275
1275
  }
1276
- }), l = P({
1277
- mutationFn: async ({ opts: u }) => Pe(u.sessionID),
1278
- onError: L(i, "Failed to close port forwarding session"),
1276
+ }), l = T({
1277
+ mutationFn: async ({ opts: u }) => Te(u.sessionID),
1278
+ onError: k(i, "Failed to close port forwarding session"),
1279
1279
  onSuccess: async () => {
1280
1280
  await Promise.all([
1281
1281
  o.invalidateQueries({ queryKey: s }),
1282
- o.invalidateQueries({ queryKey: [...H] })
1282
+ o.invalidateQueries({ queryKey: [...B] })
1283
1283
  ]);
1284
1284
  }
1285
1285
  });
@@ -1289,19 +1289,19 @@ function fs({ pluginID: t, connectionID: e, resourceID: n }) {
1289
1289
  close: l.mutateAsync
1290
1290
  };
1291
1291
  }
1292
- const ps = () => {
1293
- const t = b.useContext(mn);
1292
+ const gs = () => {
1293
+ const t = b.useContext(_n);
1294
1294
  if (!t) throw new Error("useConfirmationModal must be used within a ConfirmationModalProvider");
1295
1295
  return t;
1296
- }, ys = ({
1296
+ }, hs = ({
1297
1297
  pluginID: t,
1298
1298
  connectionID: e,
1299
1299
  resourceKey: n,
1300
1300
  resourceID: r,
1301
1301
  namespace: s = ""
1302
1302
  }) => {
1303
- const i = D(t), o = j(), { showSnackbar: a } = U(), c = ["RESOURCE", i, e, n, r, s], { mutateAsync: l } = P({
1304
- mutationFn: async (f) => Oe(i, e, n, Ne.createFrom({
1303
+ const i = P(t), o = j(), { showSnackbar: a } = W(), c = ["RESOURCE", i, e, n, r, s], { mutateAsync: l } = T({
1304
+ mutationFn: async (f) => Ae(i, e, n, ke.createFrom({
1305
1305
  input: f.input,
1306
1306
  id: r,
1307
1307
  namespace: s
@@ -1309,9 +1309,9 @@ const ps = () => {
1309
1309
  onSuccess: async () => {
1310
1310
  a(`Resource ${r} updated`, "success"), await o.invalidateQueries({ queryKey: c });
1311
1311
  },
1312
- onError: L(a, `Failed to update resource ${r}`)
1313
- }), { mutateAsync: u } = P({
1314
- mutationFn: async (f = {}) => Te(i, e, n, Le.createFrom({
1312
+ onError: k(a, `Failed to update resource ${r}`)
1313
+ }), { mutateAsync: u } = T({
1314
+ mutationFn: async (f = {}) => xe(i, e, n, Le.createFrom({
1315
1315
  id: r,
1316
1316
  namespace: s,
1317
1317
  gracePeriodSeconds: f.gracePeriodSeconds
@@ -1319,7 +1319,7 @@ const ps = () => {
1319
1319
  onSuccess: async () => {
1320
1320
  a(`Resource ${r} deleted`, "success"), await o.invalidateQueries({ queryKey: c });
1321
1321
  },
1322
- onError: L(a, `Failed to delete resource ${r}`)
1322
+ onError: k(a, `Failed to delete resource ${r}`)
1323
1323
  });
1324
1324
  return {
1325
1325
  /**
@@ -1328,7 +1328,7 @@ const ps = () => {
1328
1328
  */
1329
1329
  resource: O({
1330
1330
  queryKey: c,
1331
- queryFn: async () => qt(i, e, n, cn.createFrom({
1331
+ queryFn: async () => Wt(i, e, n, ln.createFrom({
1332
1332
  id: r,
1333
1333
  namespace: s
1334
1334
  })),
@@ -1349,7 +1349,7 @@ const ps = () => {
1349
1349
  */
1350
1350
  remove: u
1351
1351
  };
1352
- }, gs = (t) => {
1352
+ }, ms = (t) => {
1353
1353
  const e = ["component", t.plugin, t.resource, t.area];
1354
1354
  return {
1355
1355
  /**
@@ -1358,31 +1358,31 @@ const ps = () => {
1358
1358
  */
1359
1359
  component: O({
1360
1360
  queryKey: e,
1361
- queryFn: async () => Wt(t)
1361
+ queryFn: async () => Gt(t)
1362
1362
  })
1363
1363
  };
1364
- }, hs = ({ pluginID: t, connectionID: e }) => {
1365
- const n = D(t);
1364
+ }, Ss = ({ pluginID: t, connectionID: e }) => {
1365
+ const n = P(t);
1366
1366
  return {
1367
1367
  /**
1368
1368
  * The resource groups for the given plugin and connection.
1369
1369
  */
1370
1370
  groups: O({
1371
1371
  queryKey: [n, "resource_groups", "list"],
1372
- queryFn: async () => Gt(n, e),
1372
+ queryFn: async () => jt(n, e),
1373
1373
  retry: !1
1374
1374
  })
1375
1375
  };
1376
- }, ms = ({
1376
+ }, _s = ({
1377
1377
  pluginID: t,
1378
1378
  connectionID: e,
1379
1379
  searches: n
1380
1380
  }) => {
1381
- const r = D(t), s = (o) => [r, e, o.key, o.namespaces, "list"];
1382
- return un({
1381
+ const r = P(t), s = (o) => [r, e, o.key, o.namespaces, "list"];
1382
+ return dn({
1383
1383
  queries: n.map((o) => ({
1384
1384
  queryKey: s(o),
1385
- queryFn: async () => Ae(r, e, o.key, ke.createFrom({
1385
+ queryFn: async () => De(r, e, o.key, Me.createFrom({
1386
1386
  order: [{ field: "name", descending: !1 }],
1387
1387
  pagination: { page: 1, pageSize: 200 },
1388
1388
  namespaces: o.namespaces
@@ -1390,40 +1390,40 @@ const ps = () => {
1390
1390
  retry: !1
1391
1391
  }))
1392
1392
  });
1393
- }, Ss = ({ pluginID: t, resourceKey: e }) => {
1394
- const n = D(t);
1393
+ }, Es = ({ pluginID: t, resourceKey: e }) => {
1394
+ const n = P(t);
1395
1395
  return {
1396
1396
  /**
1397
1397
  * The current settings from the provider.
1398
1398
  */
1399
1399
  resourceType: O({
1400
1400
  queryKey: [n, "resources", e],
1401
- queryFn: async () => jt(n, e),
1401
+ queryFn: async () => Qt(n, e),
1402
1402
  retry: !1
1403
1403
  })
1404
1404
  };
1405
- }, _s = ({ pluginID: t, connectionID: e }) => {
1406
- const n = D(t);
1405
+ }, ws = ({ pluginID: t, connectionID: e }) => {
1406
+ const n = P(t);
1407
1407
  return {
1408
1408
  /**
1409
1409
  * The resource types for the given plugin and connection.
1410
1410
  */
1411
1411
  types: O({
1412
1412
  queryKey: [n, "resources", "list", e],
1413
- queryFn: async () => Qt(n, e),
1413
+ queryFn: async () => Kt(n, e),
1414
1414
  retry: !1
1415
1415
  })
1416
1416
  };
1417
1417
  };
1418
1418
  var ee = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1419
- function Pn(t) {
1419
+ function An(t) {
1420
1420
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
1421
1421
  }
1422
- var On = "Expected a function", Xe = "__lodash_hash_undefined__", Tn = "[object Function]", An = "[object GeneratorFunction]", xn = "[object Symbol]", Nn = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Ln = /^\w*$/, kn = /^\./, Mn = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, $n = /[\\^$.*+?()[\]{}|]/g, Un = /\\(\\)?/g, qn = /^\[object .+?Constructor\]$/, Wn = typeof ee == "object" && ee && ee.Object === Object && ee, Gn = typeof self == "object" && self && self.Object === Object && self, me = Wn || Gn || Function("return this")();
1423
- function jn(t, e) {
1422
+ var xn = "Expected a function", Ve = "__lodash_hash_undefined__", Dn = "[object Function]", Nn = "[object GeneratorFunction]", kn = "[object Symbol]", Ln = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Mn = /^\w*$/, $n = /^\./, qn = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, Un = /[\\^$.*+?()[\]{}|]/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")();
1423
+ function Kn(t, e) {
1424
1424
  return t == null ? void 0 : t[e];
1425
1425
  }
1426
- function Qn(t) {
1426
+ function Hn(t) {
1427
1427
  var e = !1;
1428
1428
  if (t != null && typeof t.toString != "function")
1429
1429
  try {
@@ -1432,12 +1432,12 @@ function Qn(t) {
1432
1432
  }
1433
1433
  return e;
1434
1434
  }
1435
- var Kn = Array.prototype, Bn = Function.prototype, Ve = Object.prototype, le = me["__core-js_shared__"], be = function() {
1435
+ var Bn = Array.prototype, zn = Function.prototype, et = Object.prototype, le = me["__core-js_shared__"], ve = function() {
1436
1436
  var t = /[^.]+$/.exec(le && le.keys && le.keys.IE_PROTO || "");
1437
1437
  return t ? "Symbol(src)_1." + t : "";
1438
- }(), et = Bn.toString, Se = Ve.hasOwnProperty, tt = Ve.toString, Hn = RegExp(
1439
- "^" + et.call(Se).replace($n, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
1440
- ), ve = me.Symbol, zn = Kn.splice, Yn = nt(me, "Map"), Z = nt(Object, "create"), Re = ve ? ve.prototype : void 0, Fe = Re ? Re.toString : void 0;
1438
+ }(), tt = zn.toString, Se = et.hasOwnProperty, nt = et.toString, Yn = RegExp(
1439
+ "^" + tt.call(Se).replace(Un, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
1440
+ ), 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;
1441
1441
  function K(t) {
1442
1442
  var e = -1, n = t ? t.length : 0;
1443
1443
  for (this.clear(); ++e < n; ) {
@@ -1445,33 +1445,33 @@ function K(t) {
1445
1445
  this.set(r[0], r[1]);
1446
1446
  }
1447
1447
  }
1448
- function Jn() {
1448
+ function Xn() {
1449
1449
  this.__data__ = Z ? Z(null) : {};
1450
1450
  }
1451
- function Zn(t) {
1451
+ function Vn(t) {
1452
1452
  return this.has(t) && delete this.__data__[t];
1453
1453
  }
1454
- function Xn(t) {
1454
+ function er(t) {
1455
1455
  var e = this.__data__;
1456
1456
  if (Z) {
1457
1457
  var n = e[t];
1458
- return n === Xe ? void 0 : n;
1458
+ return n === Ve ? void 0 : n;
1459
1459
  }
1460
1460
  return Se.call(e, t) ? e[t] : void 0;
1461
1461
  }
1462
- function Vn(t) {
1462
+ function tr(t) {
1463
1463
  var e = this.__data__;
1464
1464
  return Z ? e[t] !== void 0 : Se.call(e, t);
1465
1465
  }
1466
- function er(t, e) {
1466
+ function nr(t, e) {
1467
1467
  var n = this.__data__;
1468
- return n[t] = Z && e === void 0 ? Xe : e, this;
1468
+ return n[t] = Z && e === void 0 ? Ve : e, this;
1469
1469
  }
1470
- K.prototype.clear = Jn;
1471
- K.prototype.delete = Zn;
1472
- K.prototype.get = Xn;
1473
- K.prototype.has = Vn;
1474
- K.prototype.set = er;
1470
+ K.prototype.clear = Xn;
1471
+ K.prototype.delete = Vn;
1472
+ K.prototype.get = er;
1473
+ K.prototype.has = tr;
1474
+ K.prototype.set = nr;
1475
1475
  function J(t) {
1476
1476
  var e = -1, n = t ? t.length : 0;
1477
1477
  for (this.clear(); ++e < n; ) {
@@ -1479,130 +1479,130 @@ function J(t) {
1479
1479
  this.set(r[0], r[1]);
1480
1480
  }
1481
1481
  }
1482
- function tr() {
1482
+ function rr() {
1483
1483
  this.__data__ = [];
1484
1484
  }
1485
- function nr(t) {
1485
+ function sr(t) {
1486
1486
  var e = this.__data__, n = se(e, t);
1487
1487
  if (n < 0)
1488
1488
  return !1;
1489
1489
  var r = e.length - 1;
1490
- return n == r ? e.pop() : zn.call(e, n, 1), !0;
1490
+ return n == r ? e.pop() : Jn.call(e, n, 1), !0;
1491
1491
  }
1492
- function rr(t) {
1492
+ function or(t) {
1493
1493
  var e = this.__data__, n = se(e, t);
1494
1494
  return n < 0 ? void 0 : e[n][1];
1495
1495
  }
1496
- function sr(t) {
1496
+ function ir(t) {
1497
1497
  return se(this.__data__, t) > -1;
1498
1498
  }
1499
- function or(t, e) {
1499
+ function ar(t, e) {
1500
1500
  var n = this.__data__, r = se(n, t);
1501
1501
  return r < 0 ? n.push([t, e]) : n[r][1] = e, this;
1502
1502
  }
1503
- J.prototype.clear = tr;
1504
- J.prototype.delete = nr;
1505
- J.prototype.get = rr;
1506
- J.prototype.has = sr;
1507
- J.prototype.set = or;
1508
- function B(t) {
1503
+ J.prototype.clear = rr;
1504
+ J.prototype.delete = sr;
1505
+ J.prototype.get = or;
1506
+ J.prototype.has = ir;
1507
+ J.prototype.set = ar;
1508
+ function H(t) {
1509
1509
  var e = -1, n = t ? t.length : 0;
1510
1510
  for (this.clear(); ++e < n; ) {
1511
1511
  var r = t[e];
1512
1512
  this.set(r[0], r[1]);
1513
1513
  }
1514
1514
  }
1515
- function ir() {
1515
+ function cr() {
1516
1516
  this.__data__ = {
1517
1517
  hash: new K(),
1518
- map: new (Yn || J)(),
1518
+ map: new (Zn || J)(),
1519
1519
  string: new K()
1520
1520
  };
1521
1521
  }
1522
- function ar(t) {
1522
+ function ur(t) {
1523
1523
  return oe(this, t).delete(t);
1524
1524
  }
1525
- function cr(t) {
1525
+ function lr(t) {
1526
1526
  return oe(this, t).get(t);
1527
1527
  }
1528
- function ur(t) {
1528
+ function dr(t) {
1529
1529
  return oe(this, t).has(t);
1530
1530
  }
1531
- function lr(t, e) {
1531
+ function fr(t, e) {
1532
1532
  return oe(this, t).set(t, e), this;
1533
1533
  }
1534
- B.prototype.clear = ir;
1535
- B.prototype.delete = ar;
1536
- B.prototype.get = cr;
1537
- B.prototype.has = ur;
1538
- B.prototype.set = lr;
1534
+ H.prototype.clear = cr;
1535
+ H.prototype.delete = ur;
1536
+ H.prototype.get = lr;
1537
+ H.prototype.has = dr;
1538
+ H.prototype.set = fr;
1539
1539
  function se(t, e) {
1540
1540
  for (var n = t.length; n--; )
1541
- if (Er(t[n][0], e))
1541
+ if (br(t[n][0], e))
1542
1542
  return n;
1543
1543
  return -1;
1544
1544
  }
1545
- function dr(t, e) {
1546
- e = gr(e, t) ? [e] : yr(e);
1545
+ function pr(t, e) {
1546
+ e = mr(e, t) ? [e] : hr(e);
1547
1547
  for (var n = 0, r = e.length; t != null && n < r; )
1548
- t = t[_r(e[n++])];
1548
+ t = t[wr(e[n++])];
1549
1549
  return n && n == r ? t : void 0;
1550
1550
  }
1551
- function fr(t) {
1552
- if (!st(t) || mr(t))
1551
+ function yr(t) {
1552
+ if (!ot(t) || _r(t))
1553
1553
  return !1;
1554
- var e = Cr(t) || Qn(t) ? Hn : qn;
1555
- return e.test(wr(t));
1554
+ var e = vr(t) || Hn(t) ? Yn : Gn;
1555
+ return e.test(Cr(t));
1556
1556
  }
1557
- function pr(t) {
1557
+ function gr(t) {
1558
1558
  if (typeof t == "string")
1559
1559
  return t;
1560
- if (we(t))
1561
- return Fe ? Fe.call(t) : "";
1560
+ if (Ee(t))
1561
+ return Ie ? Ie.call(t) : "";
1562
1562
  var e = t + "";
1563
1563
  return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
1564
1564
  }
1565
- function yr(t) {
1566
- return rt(t) ? t : Sr(t);
1565
+ function hr(t) {
1566
+ return st(t) ? t : Er(t);
1567
1567
  }
1568
1568
  function oe(t, e) {
1569
1569
  var n = t.__data__;
1570
- return hr(e) ? n[typeof e == "string" ? "string" : "hash"] : n.map;
1570
+ return Sr(e) ? n[typeof e == "string" ? "string" : "hash"] : n.map;
1571
1571
  }
1572
- function nt(t, e) {
1573
- var n = jn(t, e);
1574
- return fr(n) ? n : void 0;
1572
+ function rt(t, e) {
1573
+ var n = Kn(t, e);
1574
+ return yr(n) ? n : void 0;
1575
1575
  }
1576
- function gr(t, e) {
1577
- if (rt(t))
1576
+ function mr(t, e) {
1577
+ if (st(t))
1578
1578
  return !1;
1579
1579
  var n = typeof t;
1580
- return n == "number" || n == "symbol" || n == "boolean" || t == null || we(t) ? !0 : Ln.test(t) || !Nn.test(t) || e != null && t in Object(e);
1580
+ return n == "number" || n == "symbol" || n == "boolean" || t == null || Ee(t) ? !0 : Mn.test(t) || !Ln.test(t) || e != null && t in Object(e);
1581
1581
  }
1582
- function hr(t) {
1582
+ function Sr(t) {
1583
1583
  var e = typeof t;
1584
1584
  return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
1585
1585
  }
1586
- function mr(t) {
1587
- return !!be && be in t;
1586
+ function _r(t) {
1587
+ return !!ve && ve in t;
1588
1588
  }
1589
- var Sr = _e(function(t) {
1590
- t = vr(t);
1589
+ var Er = _e(function(t) {
1590
+ t = Fr(t);
1591
1591
  var e = [];
1592
- return kn.test(t) && e.push(""), t.replace(Mn, function(n, r, s, i) {
1593
- e.push(s ? i.replace(Un, "$1") : r || n);
1592
+ return $n.test(t) && e.push(""), t.replace(qn, function(n, r, s, i) {
1593
+ e.push(s ? i.replace(Wn, "$1") : r || n);
1594
1594
  }), e;
1595
1595
  });
1596
- function _r(t) {
1597
- if (typeof t == "string" || we(t))
1596
+ function wr(t) {
1597
+ if (typeof t == "string" || Ee(t))
1598
1598
  return t;
1599
1599
  var e = t + "";
1600
1600
  return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
1601
1601
  }
1602
- function wr(t) {
1602
+ function Cr(t) {
1603
1603
  if (t != null) {
1604
1604
  try {
1605
- return et.call(t);
1605
+ return tt.call(t);
1606
1606
  } catch {
1607
1607
  }
1608
1608
  try {
@@ -1614,7 +1614,7 @@ function wr(t) {
1614
1614
  }
1615
1615
  function _e(t, e) {
1616
1616
  if (typeof t != "function" || e && typeof e != "function")
1617
- throw new TypeError(On);
1617
+ throw new TypeError(xn);
1618
1618
  var n = function() {
1619
1619
  var r = arguments, s = e ? e.apply(this, r) : r[0], i = n.cache;
1620
1620
  if (i.has(s))
@@ -1622,37 +1622,37 @@ function _e(t, e) {
1622
1622
  var o = t.apply(this, r);
1623
1623
  return n.cache = i.set(s, o), o;
1624
1624
  };
1625
- return n.cache = new (_e.Cache || B)(), n;
1625
+ return n.cache = new (_e.Cache || H)(), n;
1626
1626
  }
1627
- _e.Cache = B;
1628
- function Er(t, e) {
1627
+ _e.Cache = H;
1628
+ function br(t, e) {
1629
1629
  return t === e || t !== t && e !== e;
1630
1630
  }
1631
- var rt = Array.isArray;
1632
- function Cr(t) {
1633
- var e = st(t) ? tt.call(t) : "";
1634
- return e == Tn || e == An;
1631
+ var st = Array.isArray;
1632
+ function vr(t) {
1633
+ var e = ot(t) ? nt.call(t) : "";
1634
+ return e == Dn || e == Nn;
1635
1635
  }
1636
- function st(t) {
1636
+ function ot(t) {
1637
1637
  var e = typeof t;
1638
1638
  return !!t && (e == "object" || e == "function");
1639
1639
  }
1640
- function br(t) {
1640
+ function Rr(t) {
1641
1641
  return !!t && typeof t == "object";
1642
1642
  }
1643
- function we(t) {
1644
- return typeof t == "symbol" || br(t) && tt.call(t) == xn;
1643
+ function Ee(t) {
1644
+ return typeof t == "symbol" || Rr(t) && nt.call(t) == kn;
1645
1645
  }
1646
- function vr(t) {
1647
- return t == null ? "" : pr(t);
1646
+ function Fr(t) {
1647
+ return t == null ? "" : gr(t);
1648
1648
  }
1649
- function Rr(t, e, n) {
1650
- var r = t == null ? void 0 : dr(t, e);
1649
+ function Ir(t, e, n) {
1650
+ var r = t == null ? void 0 : pr(t, e);
1651
1651
  return r === void 0 ? n : r;
1652
1652
  }
1653
- var Fr = Rr;
1654
- const te = /* @__PURE__ */ Pn(Fr);
1655
- function Ir(t, e, n) {
1653
+ var Pr = Ir;
1654
+ const te = /* @__PURE__ */ An(Pr);
1655
+ function Or(t, e, n) {
1656
1656
  const r = t ?? { result: [], success: !0, totalCount: 0 }, s = [...r.result ?? []];
1657
1657
  for (const i of e) {
1658
1658
  const o = te(i.payload.data, n);
@@ -1675,47 +1675,47 @@ function Ir(t, e, n) {
1675
1675
  }
1676
1676
  return { ...r, result: s };
1677
1677
  }
1678
- function Dr(t, e, n, r, s, i) {
1679
- const o = (i == null ? void 0 : i.syncWindowMs) ?? 500, a = W([]), c = W(null), l = W(null), u = W(s);
1678
+ function Tr(t, e, n, r, s, i) {
1679
+ const o = (i == null ? void 0 : i.syncWindowMs) ?? 500, a = q([]), c = q(null), l = q(null), u = q(s);
1680
1680
  u.current = s;
1681
- const y = k(() => {
1681
+ const p = L(() => {
1682
1682
  const d = a.current;
1683
1683
  if (a.current = [], c.current = null, l.current = null, !(d.length === 0 || !r)) {
1684
1684
  t.setQueryData(
1685
1685
  e,
1686
- (p) => Ir(p, d, r)
1686
+ (y) => Or(y, d, r)
1687
1687
  );
1688
- for (const p of d)
1689
- (p.type === "ADD" || p.type === "UPDATE") && t.setQueryData(
1690
- n(p.payload.id, p.payload.namespace),
1691
- { result: p.payload.data }
1688
+ for (const y of d)
1689
+ (y.type === "ADD" || y.type === "UPDATE") && t.setQueryData(
1690
+ n(y.payload.id, y.payload.namespace),
1691
+ { result: y.payload.data }
1692
1692
  );
1693
1693
  }
1694
- }, [t, e, n, r]), f = k(
1694
+ }, [t, e, n, r]), f = L(
1695
1695
  (d) => {
1696
- a.current.push(d), !(c.current !== null || l.current !== null) && (u.current === 1 ? c.current = setTimeout(y, o) : l.current = requestAnimationFrame(y));
1696
+ a.current.push(d), !(c.current !== null || l.current !== null) && (u.current === 1 ? c.current = setTimeout(p, o) : l.current = requestAnimationFrame(p));
1697
1697
  },
1698
- [y, o]
1698
+ [p, o]
1699
1699
  );
1700
- return G(() => () => {
1700
+ return U(() => () => {
1701
1701
  c.current !== null && (clearTimeout(c.current), c.current = null), l.current !== null && (cancelAnimationFrame(l.current), l.current = null);
1702
1702
  }, []), f;
1703
1703
  }
1704
- const ws = ({
1704
+ const Cs = ({
1705
1705
  pluginID: t,
1706
1706
  connectionID: e,
1707
1707
  resourceKey: n,
1708
1708
  idAccessor: r,
1709
1709
  namespaces: s
1710
1710
  }) => {
1711
- const i = D(t), o = j(), { showSnackbar: a } = U(), c = b.useMemo(() => s ?? [], [s]), l = b.useMemo(
1711
+ const i = P(t), o = j(), { showSnackbar: a } = W(), c = b.useMemo(() => s ?? [], [s]), l = b.useMemo(
1712
1712
  () => [i, e, n, c, "list"],
1713
1713
  [i, e, n, c]
1714
1714
  ), u = b.useCallback(
1715
1715
  (C, h) => [i, e, n, h, C],
1716
1716
  [i, e, n]
1717
- ), { mutateAsync: y } = P({
1718
- mutationFn: async (C) => xe(i, e, n, Me.createFrom({
1717
+ ), { mutateAsync: p } = T({
1718
+ mutationFn: async (C) => Ne(i, e, n, $e.createFrom({
1719
1719
  input: C.input,
1720
1720
  namespace: C.namespace ?? (c.length === 1 ? c[0] : "")
1721
1721
  })),
@@ -1727,38 +1727,38 @@ const ws = ({
1727
1727
  const g = m ? `Resource ${m} created` : "Resource created";
1728
1728
  a(g, "success"), await o.invalidateQueries({ queryKey: l });
1729
1729
  },
1730
- onError: L(a, "Failed to create resource")
1730
+ onError: k(a, "Failed to create resource")
1731
1731
  }), f = O({
1732
1732
  queryKey: l,
1733
- queryFn: async () => Ae(i, e, n, ke.createFrom({
1733
+ queryFn: async () => De(i, e, n, Me.createFrom({
1734
1734
  order: [{ field: "name", descending: !1 }],
1735
1735
  pagination: { page: 1, pageSize: 200 },
1736
1736
  namespaces: c
1737
1737
  })),
1738
1738
  placeholderData: (C, h) => C,
1739
1739
  retry: !1
1740
- }), [d, p] = b.useState(
1740
+ }), [d, y] = b.useState(
1741
1741
  F.WatchStateIdle
1742
1742
  );
1743
- b.useEffect(() => x(
1743
+ b.useEffect(() => D(
1744
1744
  `${i}/${e}/watch/STATE`,
1745
1745
  (h) => {
1746
1746
  const m = h.data;
1747
- m.resourceKey === n && p(m.state);
1747
+ m.resourceKey === n && y(m.state);
1748
1748
  }
1749
1749
  ), [i, e, n]);
1750
- const _ = Dr(o, l, u, r, d);
1750
+ const _ = Tr(o, l, u, r, d);
1751
1751
  return b.useEffect(() => {
1752
1752
  if (!r)
1753
1753
  return;
1754
- Kt(i, e, n);
1755
- const C = x(
1754
+ Ht(i, e, n);
1755
+ const C = D(
1756
1756
  `${i}/${e}/${n}/ADD`,
1757
1757
  (g) => _({ type: "ADD", payload: g.data })
1758
- ), h = x(
1758
+ ), h = D(
1759
1759
  `${i}/${e}/${n}/UPDATE`,
1760
1760
  (g) => _({ type: "UPDATE", payload: g.data })
1761
- ), m = x(
1761
+ ), m = D(
1762
1762
  `${i}/${e}/${n}/DELETE`,
1763
1763
  (g) => _({ type: "DELETE", payload: g.data })
1764
1764
  );
@@ -1778,7 +1778,7 @@ const ws = ({
1778
1778
  *
1779
1779
  * @params opts Optional parameters to pass to the resource create operation
1780
1780
  */
1781
- create: y,
1781
+ create: p,
1782
1782
  /** Current watch state for this resource type */
1783
1783
  watchState: d,
1784
1784
  /** Whether the watch is currently syncing */
@@ -1788,13 +1788,13 @@ const ws = ({
1788
1788
  /** Whether the watch encountered an error */
1789
1789
  watchError: d === F.WatchStateError
1790
1790
  };
1791
- }, Es = ({ pluginID: t }) => {
1792
- const e = D(t), { showSnackbar: n } = U(), r = P({
1793
- mutationFn: async ({ opts: o, input: a }) => xe(
1791
+ }, bs = ({ pluginID: t }) => {
1792
+ const e = P(t), { showSnackbar: n } = W(), r = T({
1793
+ mutationFn: async ({ opts: o, input: a }) => Ne(
1794
1794
  e,
1795
1795
  o.connectionID,
1796
1796
  o.resourceKey,
1797
- Me.createFrom({
1797
+ $e.createFrom({
1798
1798
  input: a.input,
1799
1799
  namespace: a.namespace ?? o.namespace ?? ""
1800
1800
  })
@@ -1805,12 +1805,12 @@ const ws = ({
1805
1805
  onError(o, { opts: a }) {
1806
1806
  z(n, o, `Failed to create resource ${a.resourceID}`);
1807
1807
  }
1808
- }), s = P({
1809
- mutationFn: async ({ opts: o, input: a }) => Oe(
1808
+ }), s = T({
1809
+ mutationFn: async ({ opts: o, input: a }) => Ae(
1810
1810
  e,
1811
1811
  o.connectionID,
1812
1812
  o.resourceKey,
1813
- Ne.createFrom({
1813
+ ke.createFrom({
1814
1814
  input: a.input,
1815
1815
  id: o.resourceID,
1816
1816
  namespace: o.namespace ?? ""
@@ -1822,8 +1822,8 @@ const ws = ({
1822
1822
  onError(o, { opts: a }) {
1823
1823
  z(n, o, `Failed to update resource ${a.resourceID}`);
1824
1824
  }
1825
- }), i = P({
1826
- mutationFn: async ({ opts: o, input: a }) => Te(
1825
+ }), i = T({
1826
+ mutationFn: async ({ opts: o, input: a }) => xe(
1827
1827
  e,
1828
1828
  o.connectionID,
1829
1829
  o.resourceKey,
@@ -1845,15 +1845,15 @@ const ws = ({
1845
1845
  update: s.mutateAsync,
1846
1846
  remove: i.mutateAsync
1847
1847
  };
1848
- }, Cs = ({
1848
+ }, vs = ({
1849
1849
  pluginID: t,
1850
1850
  connectionID: e,
1851
1851
  resourceKey: n,
1852
1852
  enabled: r = !0
1853
1853
  }) => {
1854
- const s = D(t), i = O({
1854
+ const s = P(t), i = O({
1855
1855
  queryKey: ["RESOURCE_ACTIONS", s, e, n],
1856
- queryFn: () => Ht(s, e, n),
1856
+ queryFn: () => zt(s, e, n),
1857
1857
  enabled: r && !!s && !!e && !!n,
1858
1858
  staleTime: 5 * 60 * 1e3
1859
1859
  // actions don't change often
@@ -1863,18 +1863,18 @@ const ws = ({
1863
1863
  isLoading: i.isLoading,
1864
1864
  error: i.error
1865
1865
  };
1866
- }, bs = ({
1866
+ }, Rs = ({
1867
1867
  pluginID: t,
1868
1868
  connectionID: e,
1869
1869
  resourceKey: n
1870
1870
  }) => {
1871
- const r = D(t), s = j(), { showSnackbar: i } = U(), o = P({
1872
- mutationFn: async ({ actionID: a, id: c = "", namespace: l = "", params: u = {} }) => zt(
1871
+ const r = P(t), s = j(), { showSnackbar: i } = W(), o = T({
1872
+ mutationFn: async ({ actionID: a, id: c = "", namespace: l = "", params: u = {} }) => Yt(
1873
1873
  r,
1874
1874
  e,
1875
1875
  n,
1876
1876
  a,
1877
- $e.createFrom({ id: c, namespace: l, params: u })
1877
+ qe.createFrom({ id: c, namespace: l, params: u })
1878
1878
  ),
1879
1879
  onSuccess: (a) => {
1880
1880
  a != null && a.message && i(a.message, "success"), s.invalidateQueries({
@@ -1890,14 +1890,14 @@ const ws = ({
1890
1890
  isExecuting: o.isPending,
1891
1891
  error: o.error
1892
1892
  };
1893
- }, vs = ({
1893
+ }, Fs = ({
1894
1894
  pluginID: t,
1895
1895
  connectionID: e,
1896
1896
  enabled: n = !0
1897
1897
  }) => {
1898
- const r = D(t), s = O({
1898
+ const r = P(t), s = O({
1899
1899
  queryKey: ["EDITOR_SCHEMAS", r, e],
1900
- queryFn: () => Yt(r, e),
1900
+ queryFn: () => Jt(r, e),
1901
1901
  enabled: n && !!r && !!e,
1902
1902
  staleTime: 10 * 60 * 1e3,
1903
1903
  // schemas are fairly stable per connection
@@ -1909,29 +1909,29 @@ const ws = ({
1909
1909
  error: s.error,
1910
1910
  refetch: s.refetch
1911
1911
  };
1912
- }, Rs = ({
1912
+ }, Is = ({
1913
1913
  pluginID: t,
1914
1914
  connectionID: e,
1915
1915
  enabled: n = !0
1916
1916
  }) => {
1917
- const r = D(t), s = j(), i = [r, e, "watch-state"], o = W([]), a = W(!1), c = k((f) => {
1917
+ const r = P(t), s = j(), i = [r, e, "watch-state"], o = q([]), a = q(!1), c = L((f) => {
1918
1918
  s.setQueryData(i, (d) => {
1919
1919
  if (!d) return d;
1920
- const p = { ...d.resources, [f.resourceKey]: f.state }, _ = { ...d.resourceCounts, [f.resourceKey]: f.resourceCount };
1920
+ const y = { ...d.resources, [f.resourceKey]: f.state }, _ = { ...d.resourceCounts, [f.resourceKey]: f.resourceCount };
1921
1921
  let C = 0, h = 0;
1922
- for (const m of Object.values(p))
1922
+ for (const m of Object.values(y))
1923
1923
  m === F.WatchStateSynced && C++, (m === F.WatchStateError || m === F.WatchStateFailed) && h++;
1924
- return { ...d, resources: p, resourceCounts: _, totalResources: Object.keys(p).length, syncedCount: C, errorCount: h };
1924
+ return { ...d, resources: y, resourceCounts: _, totalResources: Object.keys(y).length, syncedCount: C, errorCount: h };
1925
1925
  });
1926
1926
  }, [s, r, e]), l = O({
1927
1927
  queryKey: i,
1928
1928
  queryFn: async () => {
1929
- const f = await Jt(r, e);
1929
+ const f = await Zt(r, e);
1930
1930
  if (!f) throw new Error("Failed to get watch state: null response");
1931
1931
  const d = {};
1932
- let p = 0, _ = 0;
1932
+ let y = 0, _ = 0;
1933
1933
  for (const [h, m] of Object.entries(f.resources ?? {}))
1934
- m != null && (d[h] = m, m === F.WatchStateSynced && p++, m === F.WatchStateError && _++);
1934
+ m != null && (d[h] = m, m === F.WatchStateSynced && y++, m === F.WatchStateError && _++);
1935
1935
  const C = {};
1936
1936
  for (const [h, m] of Object.entries(f.resourceCounts ?? {}))
1937
1937
  m != null && (C[h] = m);
@@ -1940,7 +1940,7 @@ const ws = ({
1940
1940
  resources: d,
1941
1941
  resourceCounts: C,
1942
1942
  totalResources: Object.keys(d).length,
1943
- syncedCount: p,
1943
+ syncedCount: y,
1944
1944
  errorCount: _
1945
1945
  };
1946
1946
  },
@@ -1948,28 +1948,28 @@ const ws = ({
1948
1948
  refetchInterval: (f) => {
1949
1949
  const d = f.state.data;
1950
1950
  if (!d || d.totalResources === 0) return 3e3;
1951
- let p = 0;
1951
+ let y = 0;
1952
1952
  for (const _ of Object.values(d.resources))
1953
- (_ === F.WatchStateSynced || _ === F.WatchStateError || _ === F.WatchStateStopped || _ === F.WatchStateFailed || _ === F.WatchStateForbidden || _ === F.WatchStateSkipped) && p++;
1954
- return p >= d.totalResources ? !1 : 3e3;
1953
+ (_ === F.WatchStateSynced || _ === F.WatchStateError || _ === F.WatchStateStopped || _ === F.WatchStateFailed || _ === F.WatchStateForbidden || _ === F.WatchStateSkipped) && y++;
1954
+ return y >= d.totalResources ? !1 : 3e3;
1955
1955
  }
1956
1956
  });
1957
- G(() => {
1957
+ U(() => {
1958
1958
  if (!l.data || a.current) return;
1959
1959
  a.current = !0;
1960
1960
  const f = o.current;
1961
1961
  o.current = [];
1962
1962
  for (const d of f)
1963
1963
  c(d);
1964
- }, [l.data, c]), G(() => {
1964
+ }, [l.data, c]), U(() => {
1965
1965
  if (!n || !r || !e)
1966
1966
  return;
1967
1967
  a.current = !1, o.current = [];
1968
- const f = x(
1968
+ const f = D(
1969
1969
  `${r}/${e}/watch/STATE`,
1970
1970
  (d) => {
1971
- const p = d.data;
1972
- a.current ? c(p) : o.current.push(p);
1971
+ const y = d.data;
1972
+ a.current ? c(y) : o.current.push(y);
1973
1973
  }
1974
1974
  );
1975
1975
  return () => {
@@ -1977,47 +1977,47 @@ const ws = ({
1977
1977
  };
1978
1978
  }, [r, e, n, c]);
1979
1979
  const u = l.data;
1980
- let y = 0;
1980
+ let p = 0;
1981
1981
  if (u != null && u.resources)
1982
1982
  for (const f of Object.values(u.resources))
1983
- (f === F.WatchStateSynced || f === F.WatchStateError || f === F.WatchStateStopped || f === F.WatchStateFailed || f === F.WatchStateForbidden || f === F.WatchStateSkipped) && y++;
1983
+ (f === F.WatchStateSynced || f === F.WatchStateError || f === F.WatchStateStopped || f === F.WatchStateFailed || f === F.WatchStateForbidden || f === F.WatchStateSkipped) && p++;
1984
1984
  return {
1985
1985
  /** Full summary query result */
1986
1986
  summary: l,
1987
1987
  /** Get the state of a specific resource type's watch */
1988
1988
  getResourceState: (f) => u == null ? void 0 : u.resources[f],
1989
1989
  /** Whether all registered watches have reached a terminal state */
1990
- isFullySynced: u ? u.totalResources > 0 && y === u.totalResources : !1,
1990
+ isFullySynced: u ? u.totalResources > 0 && p === u.totalResources : !1,
1991
1991
  /** Sync progress as a 0-1 fraction (terminal states / total) */
1992
- syncProgress: u && u.totalResources > 0 ? y / u.totalResources : 0,
1992
+ syncProgress: u && u.totalResources > 0 ? p / u.totalResources : 0,
1993
1993
  /** Number of watches that encountered errors */
1994
1994
  errorCount: (u == null ? void 0 : u.errorCount) ?? 0
1995
1995
  };
1996
- }, Fs = () => {
1997
- const [t, e] = q(/* @__PURE__ */ new Map()), n = W(/* @__PURE__ */ new Map()), r = W(/* @__PURE__ */ new Map()), s = k((l) => {
1998
- const u = l.data, y = he(u), f = Je(n.current, u), d = pe(f);
1999
- if (e((p) => {
2000
- const _ = new Map(p);
2001
- return _.set(y, d), _;
2002
- }), r.current.has(y) && (clearTimeout(r.current.get(y)), r.current.delete(y)), ne(d)) {
2003
- const p = setTimeout(() => {
1996
+ }, Ps = () => {
1997
+ const [t, e] = G(/* @__PURE__ */ new Map()), n = q(/* @__PURE__ */ new Map()), r = q(/* @__PURE__ */ new Map()), s = L((l) => {
1998
+ const u = l.data, p = he(u), f = Ze(n.current, u), d = pe(f);
1999
+ if (e((y) => {
2000
+ const _ = new Map(y);
2001
+ return _.set(p, d), _;
2002
+ }), r.current.has(p) && (clearTimeout(r.current.get(p)), r.current.delete(p)), ne(d)) {
2003
+ const y = setTimeout(() => {
2004
2004
  e((_) => {
2005
2005
  const C = new Map(_);
2006
- return C.delete(y), C;
2007
- }), n.current.delete(y), r.current.delete(y);
2006
+ return C.delete(p), C;
2007
+ }), n.current.delete(p), r.current.delete(p);
2008
2008
  }, 5e3);
2009
- r.current.set(y, p);
2009
+ r.current.set(p, y);
2010
2010
  }
2011
2011
  }, []);
2012
- G(() => {
2013
- const l = x("watch/STATE", s);
2012
+ U(() => {
2013
+ const l = D("watch/STATE", s);
2014
2014
  return () => {
2015
2015
  l();
2016
2016
  for (const u of r.current.values())
2017
2017
  clearTimeout(u);
2018
2018
  };
2019
2019
  }, [s]);
2020
- const i = Array.from(t.values()), o = ze(i), a = i.find((l) => !ne(l)) ?? i[0] ?? null, c = Ye(i);
2020
+ const i = Array.from(t.values()), o = Ye(i), a = i.find((l) => !ne(l)) ?? i[0] ?? null, c = Je(i);
2021
2021
  return {
2022
2022
  /** All tracked syncs */
2023
2023
  syncs: i,
@@ -2028,76 +2028,95 @@ const ws = ({
2028
2028
  /** Aggregate progress across all connections (0-1) */
2029
2029
  aggregateProgress: c
2030
2030
  };
2031
- }, Pr = () => {
2032
- const t = b.useContext(Qe);
2031
+ }, Ar = () => {
2032
+ const t = b.useContext(Ke);
2033
2033
  if (!t) throw new Error("useOperations must be used within an OperationsProvider");
2034
2034
  return t;
2035
- }, Is = ({
2035
+ }, Os = ({
2036
2036
  pluginID: t,
2037
2037
  connectionID: e,
2038
2038
  resourceKey: n
2039
2039
  }) => {
2040
- const r = D(t), { showSnackbar: s } = U(), { addOperation: i, updateOperation: o } = Pr(), a = b.useRef([]);
2040
+ const r = P(t), { showSnackbar: s } = W(), { addOperation: i, updateOperation: o } = Ar(), a = b.useRef([]);
2041
2041
  return b.useEffect(() => () => {
2042
2042
  a.current.forEach((l) => l());
2043
2043
  }, []), { startStreamAction: b.useCallback(
2044
- async ({ actionID: l, id: u, namespace: y, label: f, params: d = {} }) => {
2044
+ async ({ actionID: l, id: u, namespace: p, label: f, params: d = {} }) => {
2045
2045
  try {
2046
- const p = await Zt(
2046
+ const y = await Xt(
2047
2047
  r,
2048
2048
  e,
2049
2049
  n,
2050
2050
  l,
2051
- $e.createFrom({ id: u, namespace: y, params: d })
2051
+ qe.createFrom({ id: u, namespace: p, params: d })
2052
2052
  );
2053
2053
  i({
2054
- id: p,
2054
+ id: y,
2055
2055
  label: f,
2056
2056
  resourceKey: n,
2057
2057
  resourceName: u,
2058
- namespace: y,
2058
+ namespace: p,
2059
2059
  connectionID: e,
2060
2060
  status: "running",
2061
2061
  startedAt: Date.now()
2062
2062
  });
2063
- const _ = `action/stream/${p}`, C = x(_, (h) => {
2064
- var g, v, R, w;
2063
+ const _ = `action/stream/${y}`, C = D(_, (h) => {
2064
+ var g, v, R, E;
2065
2065
  const m = h.data;
2066
2066
  switch (m.type) {
2067
2067
  case "progress": {
2068
2068
  const S = m.data ?? {};
2069
- o(p, {
2069
+ o(y, {
2070
2070
  message: S.message,
2071
2071
  progress: S.ready !== void 0 && S.desired !== void 0 ? { ready: S.ready, desired: S.desired } : void 0
2072
2072
  });
2073
2073
  break;
2074
2074
  }
2075
2075
  case "complete":
2076
- o(p, {
2076
+ o(y, {
2077
2077
  status: "completed",
2078
2078
  message: ((g = m.data) == null ? void 0 : g.message) ?? "Completed",
2079
2079
  completedAt: Date.now()
2080
2080
  }), s(((v = m.data) == null ? void 0 : v.message) ?? f + " completed", "success"), ae(_);
2081
2081
  break;
2082
2082
  case "error":
2083
- o(p, {
2083
+ o(y, {
2084
2084
  status: "error",
2085
2085
  message: ((R = m.data) == null ? void 0 : R.message) ?? "Failed",
2086
2086
  completedAt: Date.now()
2087
- }), s(((w = m.data) == null ? void 0 : w.message) ?? f + " failed", "error"), ae(_);
2087
+ }), s(((E = m.data) == null ? void 0 : E.message) ?? f + " failed", "error"), ae(_);
2088
2088
  break;
2089
2089
  }
2090
2090
  });
2091
2091
  return a.current.push(() => {
2092
2092
  C(), ae(_);
2093
- }), p;
2094
- } catch (p) {
2095
- throw z(s, p, `Failed to start "${l}"`), p;
2093
+ }), y;
2094
+ } catch (y) {
2095
+ throw z(s, y, `Failed to start "${l}"`), y;
2096
2096
  }
2097
2097
  },
2098
2098
  [r, e, n, i, o, s]
2099
2099
  ) };
2100
- }, Or = 1e4, Tr = {
2100
+ };
2101
+ function xr(t, e) {
2102
+ return `${t}/${e}/graph/CHANGED`;
2103
+ }
2104
+ function we(t, e, n, r) {
2105
+ const s = j(), i = q(n);
2106
+ i.current = n;
2107
+ const o = JSON.stringify(n);
2108
+ U(() => {
2109
+ if (!r || !t || !e)
2110
+ return;
2111
+ const a = D(xr(t, e), () => {
2112
+ s.invalidateQueries({ queryKey: i.current, exact: !0 });
2113
+ });
2114
+ return () => {
2115
+ a();
2116
+ };
2117
+ }, [s, t, e, o, r]);
2118
+ }
2119
+ const Dr = {
2101
2120
  owns: { outgoing: "Owns", incoming: "Owned by" },
2102
2121
  runs_on: { outgoing: "Runs on", incoming: "Running here" },
2103
2122
  uses: { outgoing: "Uses", incoming: "Used by" },
@@ -2106,19 +2125,19 @@ const ws = ({
2106
2125
  member_of: { outgoing: "Member of", incoming: "Members" },
2107
2126
  selects: { outgoing: "Selects", incoming: "Selected by" }
2108
2127
  };
2109
- function Ds(t, e) {
2110
- const n = Tr[t];
2128
+ function Ts(t, e) {
2129
+ const n = Dr[t];
2111
2130
  if (n)
2112
2131
  return n[e];
2113
2132
  const r = t.replace(/_/g, " ");
2114
2133
  return e === "outgoing" ? r : `${r} (incoming)`;
2115
2134
  }
2116
- function Ar(t, e) {
2135
+ function Nr(t, e) {
2117
2136
  return t.pluginId === e.pluginId && t.connectionId === e.connectionId && t.resourceKey === e.resourceKey && t.id === e.id && (t.namespace ?? "") === (e.namespace ?? "");
2118
2137
  }
2119
- function xr(t, e) {
2138
+ function kr(t, e) {
2120
2139
  return e.map((n) => {
2121
- const r = Ar(n.source, t);
2140
+ const r = Nr(n.source, t);
2122
2141
  return {
2123
2142
  resource: r ? n.target : n.source,
2124
2143
  type: n.type,
@@ -2127,7 +2146,7 @@ function xr(t, e) {
2127
2146
  };
2128
2147
  });
2129
2148
  }
2130
- const Ps = ({
2149
+ const As = ({
2131
2150
  pluginID: t,
2132
2151
  connectionID: e,
2133
2152
  resourceKey: n,
@@ -2136,31 +2155,33 @@ const Ps = ({
2136
2155
  direction: i = "both",
2137
2156
  relationshipType: o,
2138
2157
  enabled: a = !0,
2139
- refetchInterval: c = Or
2158
+ refetchInterval: c = !1
2140
2159
  }) => {
2141
- const l = D(t), u = O({
2142
- queryKey: ["RESOURCE_RELATED", l, e, n, s, r, i, o ?? null],
2143
- queryFn: async () => Xt(l, e, n, s, r, i, o ?? null),
2144
- enabled: a && !!l && !!e && !!n && !!r,
2160
+ const l = P(t), u = ["RESOURCE_RELATED", l, e, n, s, r, i, o ?? null], p = a && !!l && !!e && !!n && !!r;
2161
+ we(l, e, u, p);
2162
+ const f = O({
2163
+ queryKey: u,
2164
+ queryFn: async () => Vt(l, e, n, s, r, i, o ?? null),
2165
+ enabled: p,
2145
2166
  refetchInterval: c
2146
- }), y = {
2167
+ }), d = {
2147
2168
  pluginId: l,
2148
2169
  connectionId: e,
2149
2170
  resourceKey: n,
2150
2171
  id: r,
2151
2172
  namespace: s
2152
- }, f = u.data ?? [];
2173
+ }, y = f.data ?? [];
2153
2174
  return {
2154
2175
  /** One entry per edge, from the viewed resource's side. */
2155
- related: xr(y, f),
2176
+ related: kr(d, y),
2156
2177
  /** The raw graph edges. */
2157
- edges: f,
2158
- isLoading: u.isLoading,
2159
- isFetching: u.isFetching,
2160
- error: u.error,
2161
- refetch: u.refetch
2178
+ edges: y,
2179
+ isLoading: f.isLoading,
2180
+ isFetching: f.isFetching,
2181
+ error: f.error,
2182
+ refetch: f.refetch
2162
2183
  };
2163
- }, Os = ({
2184
+ }, xs = ({
2164
2185
  pluginID: t,
2165
2186
  connectionID: e,
2166
2187
  resourceKey: n,
@@ -2168,54 +2189,80 @@ const Ps = ({
2168
2189
  namespace: s = "",
2169
2190
  maxDepth: i = 3,
2170
2191
  enabled: o = !0,
2171
- refetchInterval: a = 1e4
2192
+ refetchInterval: a = !1
2172
2193
  }) => {
2173
- const c = D(t), l = O({
2174
- queryKey: ["RESOURCE_DEPENDENCY_TREE", c, e, n, s, r, i],
2175
- queryFn: async () => Vt(c, e, n, s, r, i),
2176
- enabled: o && !!c && !!e && !!n && !!r,
2194
+ const c = P(t), l = ["RESOURCE_DEPENDENCY_TREE", c, e, n, s, r, i], u = o && !!c && !!e && !!n && !!r;
2195
+ we(c, e, l, u);
2196
+ const p = O({
2197
+ queryKey: l,
2198
+ queryFn: async () => en(c, e, n, s, r, i),
2199
+ enabled: u,
2177
2200
  refetchInterval: a
2178
2201
  });
2179
2202
  return {
2180
- tree: l.data ?? null,
2181
- isLoading: l.isLoading,
2182
- isFetching: l.isFetching,
2183
- error: l.error,
2184
- refetch: l.refetch
2203
+ tree: p.data ?? null,
2204
+ isLoading: p.isLoading,
2205
+ isFetching: p.isFetching,
2206
+ error: p.error,
2207
+ refetch: p.refetch
2208
+ };
2209
+ }, Ds = ({
2210
+ pluginID: t,
2211
+ connectionID: e,
2212
+ resourceKey: n,
2213
+ resourceID: r,
2214
+ namespace: s = "",
2215
+ upDepth: i = 2,
2216
+ downDepth: o = 3,
2217
+ enabled: a = !0
2218
+ }) => {
2219
+ const c = P(t), l = ["RESOURCE_GRAPH", c, e, n, s, r, i, o], u = a && !!c && !!e && !!n && !!r;
2220
+ we(c, e, l, u);
2221
+ const p = O({
2222
+ queryKey: l,
2223
+ queryFn: async () => tn(c, e, n, s, r, i, o),
2224
+ enabled: u
2225
+ });
2226
+ return {
2227
+ graph: p.data ?? null,
2228
+ isLoading: p.isLoading,
2229
+ isFetching: p.isFetching,
2230
+ error: p.error,
2231
+ refetch: p.refetch
2185
2232
  };
2186
- }, Ts = () => {
2187
- const t = b.useContext(je);
2233
+ }, Ns = () => {
2234
+ const t = b.useContext(Qe);
2188
2235
  if (!t)
2189
2236
  throw new Error("useSettings must be used within a SettingsProvider");
2190
2237
  return t;
2191
- }, As = ({ to: t, withinContext: e, ...n }) => {
2238
+ }, ks = ({ to: t, withinContext: e, ...n }) => {
2192
2239
  const { pluginId: r } = ge();
2193
2240
  r || console.error("Link used outside of a plugin context");
2194
2241
  const s = `/_plugin/${r}${t.startsWith("/") ? "" : "/"}${t}`;
2195
- return b.useMemo(() => /* @__PURE__ */ A(lt, { style: { textDecoration: "none", color: "inherit" }, ...n, to: s }), [n, s]);
2242
+ return b.useMemo(() => /* @__PURE__ */ x(dt, { style: { textDecoration: "none", color: "inherit" }, ...n, to: s }), [n, s]);
2196
2243
  };
2197
- function xs() {
2198
- const t = dt(), e = ft(), { pluginId: n } = ge();
2244
+ function Ls() {
2245
+ const t = ft(), e = pt(), { pluginId: n } = ge();
2199
2246
  n || console.error("usePluginRouter used outside of a plugin context");
2200
- const r = `/_plugin/${n}`, s = e.pathname.startsWith(r) ? e.pathname.slice(r.length) || "/" : e.pathname, i = k((o, a) => {
2247
+ const r = `/_plugin/${n}`, s = e.pathname.startsWith(r) ? e.pathname.slice(r.length) || "/" : e.pathname, i = L((o, a) => {
2201
2248
  const { ...c } = a ?? {};
2202
2249
  o.startsWith("/") ? t(`${r}${o}`, c) : t(o, c);
2203
2250
  }, [t, r]);
2204
- return ut(() => ({
2251
+ return lt(() => ({
2205
2252
  location: e,
2206
2253
  navigate: i,
2207
2254
  pluginPath: s
2208
2255
  }), [e, i, s]);
2209
2256
  }
2210
- class Ns {
2257
+ class Ms {
2211
2258
  }
2212
- class Ls {
2259
+ class $s {
2213
2260
  constructor() {
2214
- T(this, "_extensions");
2261
+ A(this, "_extensions");
2215
2262
  /**
2216
2263
  * The root component to render for the application window.
2217
2264
  */
2218
- T(this, "root");
2265
+ A(this, "root");
2219
2266
  /**
2220
2267
  * Various pages to render under the root component. These can be navigated to using
2221
2268
  * the built-in navigation system both programatically and through Links.
@@ -2245,8 +2292,8 @@ class Ls {
2245
2292
  * ```
2246
2293
  *
2247
2294
  */
2248
- T(this, "pages");
2249
- T(this, "_routes");
2295
+ A(this, "pages");
2296
+ A(this, "_routes");
2250
2297
  }
2251
2298
  get extensions() {
2252
2299
  return this._extensions || [];
@@ -2268,9 +2315,9 @@ class Ls {
2268
2315
  */
2269
2316
  get Window() {
2270
2317
  if (!this._routes && this.root)
2271
- return /* @__PURE__ */ A(this.root, {});
2272
- const e = pt(this._routes || []);
2273
- return /* @__PURE__ */ A(yt, { router: e });
2318
+ return /* @__PURE__ */ x(this.root, {});
2319
+ const e = yt(this._routes || []);
2320
+ return /* @__PURE__ */ x(gt, { router: e });
2274
2321
  }
2275
2322
  /**
2276
2323
  * Register extension points for other plugins to extend the functionality
@@ -2302,88 +2349,91 @@ class Ls {
2302
2349
  return this._routes = e, this;
2303
2350
  }
2304
2351
  }
2305
- var Nr = /* @__PURE__ */ ((t) => (t.MISSING_MANIFEST = "MISSING_MANIFEST", t.MISSING_PLUGIN = "MISSING_PLUGIN", t.MISSING_ENTRYPOINT = "MISSING_ENTRYPOINT", t))(Nr || {});
2306
- const ks = (t) => {
2352
+ var Lr = /* @__PURE__ */ ((t) => (t.MISSING_MANIFEST = "MISSING_MANIFEST", t.MISSING_PLUGIN = "MISSING_PLUGIN", t.MISSING_ENTRYPOINT = "MISSING_ENTRYPOINT", t))(Lr || {});
2353
+ const qs = (t) => {
2307
2354
  const e = t.split("::");
2308
2355
  return e.length === 1 ? { group: "core", version: "", kind: e[0] } : {
2309
2356
  group: e[0] || "core",
2310
2357
  version: e[1] || "",
2311
2358
  kind: e[2] || e[0]
2312
2359
  };
2313
- }, Ms = (t) => !t || t === "core" ? "Core" : t.charAt(0).toUpperCase() + t.slice(1);
2360
+ }, Us = (t) => !t || t === "core" ? "Core" : t.charAt(0).toUpperCase() + t.slice(1);
2314
2361
  export {
2315
- H as ALL_SESSIONS_KEY,
2316
- gn as BottomDrawerContext,
2317
- mn as ConfirmationModalContext,
2362
+ B as ALL_SESSIONS_KEY,
2363
+ mn as BottomDrawerContext,
2364
+ _n as ConfirmationModalContext,
2318
2365
  $ as ErrorTypes,
2319
- Xr as ExtensionPointRegistry,
2320
- vn as ExtensionPointStore,
2321
- Zr as ExtensionProvider,
2322
- As as Link,
2323
- Qe as OperationsContext,
2324
- Yr as OperationsProvider,
2366
+ es as ExtensionPointRegistry,
2367
+ Fn as ExtensionPointStore,
2368
+ Vr as ExtensionProvider,
2369
+ ks as Link,
2370
+ Ke as OperationsContext,
2371
+ Zr as OperationsProvider,
2325
2372
  ye as PluginContext,
2326
- Br as PluginContextProvider,
2327
- Nr as PluginErrorCode,
2328
- Ls as PluginWindow,
2329
- Ns as PluginWindowRootProps,
2330
- hn as RightDrawerContext,
2331
- je as SettingsContext,
2332
- zr as SettingsProvider,
2333
- Vr as SnackbarProvider,
2373
+ zr as PluginContextProvider,
2374
+ Lr as PluginErrorCode,
2375
+ $s as PluginWindow,
2376
+ Ms as PluginWindowRootProps,
2377
+ Sn as RightDrawerContext,
2378
+ Qe as SettingsContext,
2379
+ Jr as SettingsProvider,
2380
+ ts as SnackbarProvider,
2334
2381
  F as WatchState,
2335
- pn as actionToSnackbar,
2336
- Ir as applyBatch,
2337
- Fn as connectionListQueryKey,
2338
- L as createErrorHandler,
2339
- yn as defaultState,
2340
- Ms as formatGroup,
2341
- We as isCancelledError,
2382
+ gn as actionToSnackbar,
2383
+ Or as applyBatch,
2384
+ Pn as connectionListQueryKey,
2385
+ k as createErrorHandler,
2386
+ hn as defaultState,
2387
+ Us as formatGroup,
2388
+ xr as graphChangedEvent,
2389
+ Ge as isCancelledError,
2342
2390
  Q as parseAppError,
2343
- ks as parseResourceKey,
2344
- Ds as relationshipLabel,
2391
+ qs as parseResourceKey,
2392
+ Ts as relationshipLabel,
2345
2393
  z as showAppError,
2346
- xr as toRelatedResources,
2347
- Fs as useActiveSyncs,
2348
- Ze as useBottomDrawer,
2349
- ps as useConfirmationModal,
2350
- es as useConnection,
2351
- ns as useConnectionNamespaces,
2352
- rs as useConnectionStatus,
2353
- ts as useConnections,
2354
- Os as useDependencyTree,
2355
- vs as useEditorSchemas,
2356
- Dr as useEventBatcher,
2357
- is as useExec,
2358
- bs as useExecuteAction,
2359
- Jr as useExtensionPoint,
2360
- bn as useExtensionRegistry,
2361
- as as useLogs,
2362
- cs as useMetricProviders,
2363
- Dn as useMetricProvidersForResource,
2364
- ls as useMetricStream,
2365
- Pr as useOperations,
2394
+ kr as toRelatedResources,
2395
+ Ps as useActiveSyncs,
2396
+ Xe as useBottomDrawer,
2397
+ gs as useConfirmationModal,
2398
+ ns as useConnection,
2399
+ ss as useConnectionNamespaces,
2400
+ os as useConnectionStatus,
2401
+ rs as useConnections,
2402
+ xs as useDependencyTree,
2403
+ Fs as useEditorSchemas,
2404
+ Tr as useEventBatcher,
2405
+ cs as useExec,
2406
+ Rs as useExecuteAction,
2407
+ Xr as useExtensionPoint,
2408
+ Rn as useExtensionRegistry,
2409
+ us as useLogs,
2410
+ ls as useMetricProviders,
2411
+ Tn as useMetricProvidersForResource,
2412
+ fs as useMetricStream,
2413
+ Ar as useOperations,
2366
2414
  ge as usePluginContext,
2367
- ss as usePluginData,
2368
- xs as usePluginRouter,
2369
- Hr as usePluginSettings,
2370
- ds as usePortForwardSessions,
2371
- Ps as useRelatedResources,
2372
- D as useResolvedPluginId,
2373
- ys as useResource,
2374
- Cs as useResourceActions,
2375
- gs as useResourceAreaComponent,
2376
- hs as useResourceGroups,
2377
- us as useResourceMetrics,
2378
- Es as useResourceMutations,
2379
- fs as useResourcePortForwarder,
2380
- ms as useResourceSearch,
2381
- Ss as useResourceType,
2382
- _s as useResourceTypes,
2383
- ws as useResources,
2384
- os as useRightDrawer,
2385
- Ts as useSettings,
2386
- U as useSnackbar,
2387
- Is as useStreamAction,
2388
- Rs as useWatchState
2415
+ is as usePluginData,
2416
+ Ls as usePluginRouter,
2417
+ Yr as usePluginSettings,
2418
+ ps as usePortForwardSessions,
2419
+ we as useRefetchOnGraphChange,
2420
+ As as useRelatedResources,
2421
+ P as useResolvedPluginId,
2422
+ hs as useResource,
2423
+ vs as useResourceActions,
2424
+ ms as useResourceAreaComponent,
2425
+ Ds as useResourceGraph,
2426
+ Ss as useResourceGroups,
2427
+ ds as useResourceMetrics,
2428
+ bs as useResourceMutations,
2429
+ ys as useResourcePortForwarder,
2430
+ _s as useResourceSearch,
2431
+ Es as useResourceType,
2432
+ ws as useResourceTypes,
2433
+ Cs as useResources,
2434
+ as as useRightDrawer,
2435
+ Ns as useSettings,
2436
+ W as useSnackbar,
2437
+ Os as useStreamAction,
2438
+ Is as useWatchState
2389
2439
  };