@yoltra/devtools-ui 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,65 +1,47 @@
1
- import Re, { createContext as ve, useState as k, useRef as A, useCallback as O, useEffect as M, useContext as be, useMemo as Oe } from "react";
2
- import { DevtoolsRole as b, PROTOCOL_VERSION as K } from "@yoltra/devtools-protocol";
3
- const H = () => {
4
- }, de = ve({
1
+ import Re, { createContext as be, useState as A, useRef as I, useCallback as O, useEffect as M, useContext as ve, useMemo as Oe } from "react";
2
+ import { DevtoolsRole as v, PROTOCOL_VERSION as K } from "@yoltra/devtools-protocol";
3
+ const W = () => {
4
+ }, de = be({
5
5
  status: "disconnected",
6
6
  extensionId: "",
7
- send: H,
8
- subscribe: () => H,
9
- disconnect: H,
10
- reconnect: H
7
+ send: W,
8
+ subscribe: () => W,
9
+ disconnect: W,
10
+ reconnect: W
11
11
  });
12
- var X = { exports: {} }, L = {};
13
- /**
14
- * @license React
15
- * react-jsx-runtime.production.js
16
- *
17
- * Copyright (c) Meta Platforms, Inc. and affiliates.
18
- *
19
- * This source code is licensed under the MIT license found in the
20
- * LICENSE file in the root directory of this source tree.
21
- */
22
- var ie;
23
- function ye() {
24
- if (ie) return L;
25
- ie = 1;
26
- var e = Symbol.for("react.transitional.element"), s = Symbol.for("react.fragment");
27
- function r(o, t, c) {
28
- var i = null;
29
- if (c !== void 0 && (i = "" + c), t.key !== void 0 && (i = "" + t.key), "key" in t) {
12
+ var H = { exports: {} }, Y = {};
13
+ var ae;
14
+ function _e() {
15
+ if (ae) return Y;
16
+ ae = 1;
17
+ var t = /* @__PURE__ */ Symbol.for("react.transitional.element"), o = /* @__PURE__ */ Symbol.for("react.fragment");
18
+ function n(s, e, c) {
19
+ var a = null;
20
+ if (c !== void 0 && (a = "" + c), e.key !== void 0 && (a = "" + e.key), "key" in e) {
30
21
  c = {};
31
- for (var a in t)
32
- a !== "key" && (c[a] = t[a]);
33
- } else c = t;
34
- return t = c.ref, {
35
- $$typeof: e,
36
- type: o,
37
- key: i,
38
- ref: t !== void 0 ? t : null,
22
+ for (var i in e)
23
+ i !== "key" && (c[i] = e[i]);
24
+ } else c = e;
25
+ return e = c.ref, {
26
+ $$typeof: t,
27
+ type: s,
28
+ key: a,
29
+ ref: e !== void 0 ? e : null,
39
30
  props: c
40
31
  };
41
32
  }
42
- return L.Fragment = s, L.jsx = r, L.jsxs = r, L;
33
+ return Y.Fragment = o, Y.jsx = n, Y.jsxs = n, Y;
43
34
  }
44
35
  var U = {};
45
- /**
46
- * @license React
47
- * react-jsx-runtime.development.js
48
- *
49
- * Copyright (c) Meta Platforms, Inc. and affiliates.
50
- *
51
- * This source code is licensed under the MIT license found in the
52
- * LICENSE file in the root directory of this source tree.
53
- */
54
- var ae;
55
- function _e() {
56
- return ae || (ae = 1, process.env.NODE_ENV !== "production" && (function() {
57
- function e(n) {
58
- if (n == null) return null;
59
- if (typeof n == "function")
60
- return n.$$typeof === he ? null : n.displayName || n.name || null;
61
- if (typeof n == "string") return n;
62
- switch (n) {
36
+ var ie;
37
+ function ye() {
38
+ return ie || (ie = 1, process.env.NODE_ENV !== "production" && (function() {
39
+ function t(r) {
40
+ if (r == null) return null;
41
+ if (typeof r == "function")
42
+ return r.$$typeof === he ? null : r.displayName || r.name || null;
43
+ if (typeof r == "string") return r;
44
+ switch (r) {
63
45
  case N:
64
46
  return "Fragment";
65
47
  case R:
@@ -73,236 +55,236 @@ function _e() {
73
55
  case Se:
74
56
  return "Activity";
75
57
  }
76
- if (typeof n == "object")
77
- switch (typeof n.tag == "number" && console.error(
58
+ if (typeof r == "object")
59
+ switch (typeof r.tag == "number" && console.error(
78
60
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
79
- ), n.$$typeof) {
61
+ ), r.$$typeof) {
80
62
  case T:
81
63
  return "Portal";
82
64
  case g:
83
- return (n.displayName || "Context") + ".Provider";
65
+ return (r.displayName || "Context") + ".Provider";
84
66
  case x:
85
- return (n._context.displayName || "Context") + ".Consumer";
86
- case I:
87
- var f = n.render;
88
- return n = n.displayName, n || (n = f.displayName || f.name || "", n = n !== "" ? "ForwardRef(" + n + ")" : "ForwardRef"), n;
67
+ return (r._context.displayName || "Context") + ".Consumer";
68
+ case k:
69
+ var f = r.render;
70
+ return r = r.displayName, r || (r = f.displayName || f.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
89
71
  case C:
90
- return f = n.displayName || null, f !== null ? f : e(n.type) || "Memo";
91
- case V:
92
- f = n._payload, n = n._init;
72
+ return f = r.displayName || null, f !== null ? f : t(r.type) || "Memo";
73
+ case L:
74
+ f = r._payload, r = r._init;
93
75
  try {
94
- return e(n(f));
76
+ return t(r(f));
95
77
  } catch {
96
78
  }
97
79
  }
98
80
  return null;
99
81
  }
100
- function s(n) {
101
- return "" + n;
82
+ function o(r) {
83
+ return "" + r;
102
84
  }
103
- function r(n) {
85
+ function n(r) {
104
86
  try {
105
- s(n);
87
+ o(r);
106
88
  var f = !1;
107
89
  } catch {
108
90
  f = !0;
109
91
  }
110
92
  if (f) {
111
93
  f = console;
112
- var p = f.error, y = typeof Symbol == "function" && Symbol.toStringTag && n[Symbol.toStringTag] || n.constructor.name || "Object";
94
+ var p = f.error, _ = typeof Symbol == "function" && Symbol.toStringTag && r[Symbol.toStringTag] || r.constructor.name || "Object";
113
95
  return p.call(
114
96
  f,
115
97
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
116
- y
117
- ), s(n);
98
+ _
99
+ ), o(r);
118
100
  }
119
101
  }
120
- function o(n) {
121
- if (n === N) return "<>";
122
- if (typeof n == "object" && n !== null && n.$$typeof === V)
102
+ function s(r) {
103
+ if (r === N) return "<>";
104
+ if (typeof r == "object" && r !== null && r.$$typeof === L)
123
105
  return "<...>";
124
106
  try {
125
- var f = e(n);
107
+ var f = t(r);
126
108
  return f ? "<" + f + ">" : "<...>";
127
109
  } catch {
128
110
  return "<...>";
129
111
  }
130
112
  }
131
- function t() {
132
- var n = J.A;
133
- return n === null ? null : n.getOwner();
113
+ function e() {
114
+ var r = $.A;
115
+ return r === null ? null : r.getOwner();
134
116
  }
135
117
  function c() {
136
118
  return Error("react-stack-top-frame");
137
119
  }
138
- function i(n) {
139
- if (te.call(n, "key")) {
140
- var f = Object.getOwnPropertyDescriptor(n, "key").get;
120
+ function a(r) {
121
+ if (te.call(r, "key")) {
122
+ var f = Object.getOwnPropertyDescriptor(r, "key").get;
141
123
  if (f && f.isReactWarning) return !1;
142
124
  }
143
- return n.key !== void 0;
125
+ return r.key !== void 0;
144
126
  }
145
- function a(n, f) {
127
+ function i(r, f) {
146
128
  function p() {
147
129
  re || (re = !0, console.error(
148
130
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
149
131
  f
150
132
  ));
151
133
  }
152
- p.isReactWarning = !0, Object.defineProperty(n, "key", {
134
+ p.isReactWarning = !0, Object.defineProperty(r, "key", {
153
135
  get: p,
154
136
  configurable: !0
155
137
  });
156
138
  }
157
- function u() {
158
- var n = e(this.type);
159
- return ne[n] || (ne[n] = !0, console.error(
139
+ function l() {
140
+ var r = t(this.type);
141
+ return ne[r] || (ne[r] = !0, console.error(
160
142
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
161
- )), n = this.props.ref, n !== void 0 ? n : null;
143
+ )), r = this.props.ref, r !== void 0 ? r : null;
162
144
  }
163
- function S(n, f, p, y, D, P, W, G) {
164
- return p = P.ref, n = {
165
- $$typeof: v,
166
- type: n,
145
+ function S(r, f, p, _, D, P, q, G) {
146
+ return p = P.ref, r = {
147
+ $$typeof: b,
148
+ type: r,
167
149
  key: f,
168
150
  props: P,
169
151
  _owner: D
170
- }, (p !== void 0 ? p : null) !== null ? Object.defineProperty(n, "ref", {
152
+ }, (p !== void 0 ? p : null) !== null ? Object.defineProperty(r, "ref", {
171
153
  enumerable: !1,
172
- get: u
173
- }) : Object.defineProperty(n, "ref", { enumerable: !1, value: null }), n._store = {}, Object.defineProperty(n._store, "validated", {
154
+ get: l
155
+ }) : Object.defineProperty(r, "ref", { enumerable: !1, value: null }), r._store = {}, Object.defineProperty(r._store, "validated", {
174
156
  configurable: !1,
175
157
  enumerable: !1,
176
158
  writable: !0,
177
159
  value: 0
178
- }), Object.defineProperty(n, "_debugInfo", {
160
+ }), Object.defineProperty(r, "_debugInfo", {
179
161
  configurable: !1,
180
162
  enumerable: !1,
181
163
  writable: !0,
182
164
  value: null
183
- }), Object.defineProperty(n, "_debugStack", {
165
+ }), Object.defineProperty(r, "_debugStack", {
184
166
  configurable: !1,
185
167
  enumerable: !1,
186
168
  writable: !0,
187
- value: W
188
- }), Object.defineProperty(n, "_debugTask", {
169
+ value: q
170
+ }), Object.defineProperty(r, "_debugTask", {
189
171
  configurable: !1,
190
172
  enumerable: !1,
191
173
  writable: !0,
192
174
  value: G
193
- }), Object.freeze && (Object.freeze(n.props), Object.freeze(n)), n;
175
+ }), Object.freeze && (Object.freeze(r.props), Object.freeze(r)), r;
194
176
  }
195
- function l(n, f, p, y, D, P, W, G) {
196
- var _ = f.children;
197
- if (_ !== void 0)
198
- if (y)
199
- if (Te(_)) {
200
- for (y = 0; y < _.length; y++)
201
- h(_[y]);
202
- Object.freeze && Object.freeze(_);
177
+ function u(r, f, p, _, D, P, q, G) {
178
+ var y = f.children;
179
+ if (y !== void 0)
180
+ if (_)
181
+ if (Te(y)) {
182
+ for (_ = 0; _ < y.length; _++)
183
+ h(y[_]);
184
+ Object.freeze && Object.freeze(y);
203
185
  } else
204
186
  console.error(
205
187
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
206
188
  );
207
- else h(_);
189
+ else h(y);
208
190
  if (te.call(f, "key")) {
209
- _ = e(n);
210
- var Y = Object.keys(f).filter(function(me) {
191
+ y = t(r);
192
+ var V = Object.keys(f).filter(function(me) {
211
193
  return me !== "key";
212
194
  });
213
- y = 0 < Y.length ? "{key: someKey, " + Y.join(": ..., ") + ": ...}" : "{key: someKey}", ce[_ + y] || (Y = 0 < Y.length ? "{" + Y.join(": ..., ") + ": ...}" : "{}", console.error(
195
+ _ = 0 < V.length ? "{key: someKey, " + V.join(": ..., ") + ": ...}" : "{key: someKey}", ce[y + _] || (V = 0 < V.length ? "{" + V.join(": ..., ") + ": ...}" : "{}", console.error(
214
196
  `A props object containing a "key" prop is being spread into JSX:
215
197
  let props = %s;
216
198
  <%s {...props} />
217
199
  React keys must be passed directly to JSX without using spread:
218
200
  let props = %s;
219
201
  <%s key={someKey} {...props} />`,
220
- y,
221
202
  _,
222
- Y,
223
- _
224
- ), ce[_ + y] = !0);
203
+ y,
204
+ V,
205
+ y
206
+ ), ce[y + _] = !0);
225
207
  }
226
- if (_ = null, p !== void 0 && (r(p), _ = "" + p), i(f) && (r(f.key), _ = "" + f.key), "key" in f) {
208
+ if (y = null, p !== void 0 && (n(p), y = "" + p), a(f) && (n(f.key), y = "" + f.key), "key" in f) {
227
209
  p = {};
228
210
  for (var B in f)
229
211
  B !== "key" && (p[B] = f[B]);
230
212
  } else p = f;
231
- return _ && a(
213
+ return y && i(
232
214
  p,
233
- typeof n == "function" ? n.displayName || n.name || "Unknown" : n
215
+ typeof r == "function" ? r.displayName || r.name || "Unknown" : r
234
216
  ), S(
235
- n,
236
- _,
217
+ r,
218
+ y,
237
219
  P,
238
220
  D,
239
- t(),
221
+ e(),
240
222
  p,
241
- W,
223
+ q,
242
224
  G
243
225
  );
244
226
  }
245
- function h(n) {
246
- typeof n == "object" && n !== null && n.$$typeof === v && n._store && (n._store.validated = 1);
227
+ function h(r) {
228
+ typeof r == "object" && r !== null && r.$$typeof === b && r._store && (r._store.validated = 1);
247
229
  }
248
- var m = Re, v = Symbol.for("react.transitional.element"), T = Symbol.for("react.portal"), N = Symbol.for("react.fragment"), E = Symbol.for("react.strict_mode"), R = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), g = Symbol.for("react.context"), I = Symbol.for("react.forward_ref"), d = Symbol.for("react.suspense"), w = Symbol.for("react.suspense_list"), C = Symbol.for("react.memo"), V = Symbol.for("react.lazy"), Se = Symbol.for("react.activity"), he = Symbol.for("react.client.reference"), J = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, te = Object.prototype.hasOwnProperty, Te = Array.isArray, q = console.createTask ? console.createTask : function() {
230
+ var m = Re, b = /* @__PURE__ */ Symbol.for("react.transitional.element"), T = /* @__PURE__ */ Symbol.for("react.portal"), N = /* @__PURE__ */ Symbol.for("react.fragment"), E = /* @__PURE__ */ Symbol.for("react.strict_mode"), R = /* @__PURE__ */ Symbol.for("react.profiler"), x = /* @__PURE__ */ Symbol.for("react.consumer"), g = /* @__PURE__ */ Symbol.for("react.context"), k = /* @__PURE__ */ Symbol.for("react.forward_ref"), d = /* @__PURE__ */ Symbol.for("react.suspense"), w = /* @__PURE__ */ Symbol.for("react.suspense_list"), C = /* @__PURE__ */ Symbol.for("react.memo"), L = /* @__PURE__ */ Symbol.for("react.lazy"), Se = /* @__PURE__ */ Symbol.for("react.activity"), he = /* @__PURE__ */ Symbol.for("react.client.reference"), $ = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, te = Object.prototype.hasOwnProperty, Te = Array.isArray, J = console.createTask ? console.createTask : function() {
249
231
  return null;
250
232
  };
251
233
  m = {
252
- react_stack_bottom_frame: function(n) {
253
- return n();
234
+ react_stack_bottom_frame: function(r) {
235
+ return r();
254
236
  }
255
237
  };
256
- var re, ne = {}, se = m.react_stack_bottom_frame.bind(
238
+ var re, ne = {}, oe = m.react_stack_bottom_frame.bind(
257
239
  m,
258
240
  c
259
- )(), oe = q(o(c)), ce = {};
260
- U.Fragment = N, U.jsx = function(n, f, p, y, D) {
261
- var P = 1e4 > J.recentlyCreatedOwnerStacks++;
262
- return l(
263
- n,
241
+ )(), se = J(s(c)), ce = {};
242
+ U.Fragment = N, U.jsx = function(r, f, p, _, D) {
243
+ var P = 1e4 > $.recentlyCreatedOwnerStacks++;
244
+ return u(
245
+ r,
264
246
  f,
265
247
  p,
266
248
  !1,
267
- y,
249
+ _,
268
250
  D,
269
- P ? Error("react-stack-top-frame") : se,
270
- P ? q(o(n)) : oe
251
+ P ? Error("react-stack-top-frame") : oe,
252
+ P ? J(s(r)) : se
271
253
  );
272
- }, U.jsxs = function(n, f, p, y, D) {
273
- var P = 1e4 > J.recentlyCreatedOwnerStacks++;
274
- return l(
275
- n,
254
+ }, U.jsxs = function(r, f, p, _, D) {
255
+ var P = 1e4 > $.recentlyCreatedOwnerStacks++;
256
+ return u(
257
+ r,
276
258
  f,
277
259
  p,
278
260
  !0,
279
- y,
261
+ _,
280
262
  D,
281
- P ? Error("react-stack-top-frame") : se,
282
- P ? q(o(n)) : oe
263
+ P ? Error("react-stack-top-frame") : oe,
264
+ P ? J(s(r)) : se
283
265
  );
284
266
  };
285
267
  })()), U;
286
268
  }
287
269
  var ue;
288
270
  function Ne() {
289
- return ue || (ue = 1, process.env.NODE_ENV === "production" ? X.exports = ye() : X.exports = _e()), X.exports;
271
+ return ue || (ue = 1, process.env.NODE_ENV === "production" ? H.exports = _e() : H.exports = ye()), H.exports;
290
272
  }
291
- var Ie = Ne();
292
- const Ae = {
273
+ var ke = Ne();
274
+ const Ie = {
293
275
  timeTravel: !0,
294
276
  eventReplay: !0,
295
277
  stateExplorer: !0,
296
278
  eventEmit: !0,
297
279
  performanceMetrics: !0
298
- }, ke = 750, xe = 3e4;
299
- function Le({
300
- config: e,
301
- children: s
280
+ }, Ae = 750, xe = 3e4;
281
+ function Ye({
282
+ config: t,
283
+ children: o
302
284
  }) {
303
- const [r, o] = k("disconnected"), t = A(null), c = A(/* @__PURE__ */ new Set()), i = A(0), a = A(null), u = A(crypto.randomUUID()), S = A(e);
304
- S.current = e;
305
- const l = O(() => {
285
+ const [n, s] = A("disconnected"), e = I(null), c = I(/* @__PURE__ */ new Set()), a = I(0), i = I(null), l = I(crypto.randomUUID()), S = I(t);
286
+ S.current = t;
287
+ const u = O(() => {
306
288
  const E = S.current, x = `ws://${E.host ?? "localhost"}:${E.port}`, g = E.WebSocket ?? (typeof globalThis.WebSocket < "u" ? globalThis.WebSocket : void 0);
307
289
  if (!g) {
308
290
  console.error(
@@ -310,430 +292,430 @@ function Le({
310
292
  );
311
293
  return;
312
294
  }
313
- o("connecting");
295
+ s("connecting");
314
296
  try {
315
- const I = new g(x);
316
- t.current = I, I.onopen = () => {
317
- i.current = 0;
297
+ const k = new g(x);
298
+ e.current = k, k.onopen = () => {
299
+ a.current = 0;
318
300
  const d = JSON.stringify({
319
301
  type: "HANDSHAKE_REQUEST",
320
302
  protocolVersion: K,
321
- role: b.EXTENSION,
303
+ role: v.EXTENSION,
322
304
  extension: {
323
- id: u.current,
305
+ id: l.current,
324
306
  name: E.extensionName ?? "DevTools UI",
325
- capabilities: Ae
307
+ capabilities: Ie
326
308
  }
327
309
  });
328
- I.send(d);
329
- }, I.onmessage = (d) => {
310
+ k.send(d);
311
+ }, k.onmessage = (d) => {
330
312
  try {
331
313
  const w = typeof d.data == "string" ? d.data : String(d.data), C = JSON.parse(w);
332
314
  if (C.type === "HANDSHAKE_RESPONSE") {
333
- C.success ? o("connected") : I.close();
315
+ C.success ? s("connected") : k.close();
334
316
  return;
335
317
  }
336
- c.current.forEach((V) => V(C));
318
+ c.current.forEach((L) => L(C));
337
319
  } catch {
338
320
  }
339
- }, I.onclose = () => {
340
- t.current = null, o("disconnected");
321
+ }, k.onclose = () => {
322
+ e.current = null, s("disconnected");
341
323
  const d = E.autoReconnect ?? !0, w = E.maxReconnectAttempts ?? 1 / 0;
342
- if (d && i.current < w) {
343
- const C = i.current++, V = Math.min(
344
- ke * Math.pow(2, C) + Math.random() * 500,
324
+ if (d && a.current < w) {
325
+ const C = a.current++, L = Math.min(
326
+ Ae * Math.pow(2, C) + Math.random() * 500,
345
327
  xe
346
328
  );
347
- a.current = setTimeout(l, V);
329
+ i.current = setTimeout(u, L);
348
330
  }
349
- }, I.onerror = () => {
331
+ }, k.onerror = () => {
350
332
  };
351
333
  } catch {
352
- o("disconnected");
334
+ s("disconnected");
353
335
  }
354
336
  }, []), h = O(() => {
355
- a.current && (clearTimeout(a.current), a.current = null), i.current = 1 / 0, t.current?.close(), t.current = null, o("disconnected");
337
+ i.current && (clearTimeout(i.current), i.current = null), a.current = 1 / 0, e.current?.close(), e.current = null, s("disconnected");
356
338
  }, []), m = O(() => {
357
- i.current = 0, t.current?.close(), t.current = null, l();
358
- }, [l]), v = O((E) => {
359
- const R = t.current;
339
+ a.current = 0, e.current?.close(), e.current = null, u();
340
+ }, [u]), b = O((E) => {
341
+ const R = e.current;
360
342
  R && R.readyState === 1 && R.send(JSON.stringify(E));
361
343
  }, []), T = O((E) => (c.current.add(E), () => {
362
344
  c.current.delete(E);
363
345
  }), []);
364
- M(() => (l(), () => {
365
- a.current && clearTimeout(a.current), i.current = 1 / 0, t.current?.close();
366
- }), [l]);
346
+ M(() => (u(), () => {
347
+ i.current && clearTimeout(i.current), a.current = 1 / 0, e.current?.close();
348
+ }), [u]);
367
349
  const N = {
368
- status: r,
369
- extensionId: u.current,
370
- send: v,
350
+ status: n,
351
+ extensionId: l.current,
352
+ send: b,
371
353
  subscribe: T,
372
354
  disconnect: h,
373
355
  reconnect: m
374
356
  };
375
- return /* @__PURE__ */ Ie.jsx(de.Provider, { value: N, children: s });
357
+ return /* @__PURE__ */ ke.jsx(de.Provider, { value: N, children: o });
376
358
  }
377
359
  function j() {
378
- return be(de);
360
+ return ve(de);
379
361
  }
380
- function Ue(e) {
381
- const { send: s, extensionId: r } = j();
362
+ function Ue(t) {
363
+ const { send: o, extensionId: n } = j();
382
364
  return { emit: O(
383
- (t, c, i) => {
384
- e && s({
365
+ (e, c, a) => {
366
+ t && o({
385
367
  type: "EMIT_TO_STORE",
386
- storeId: e,
387
- event: { channel: t, type: c, payload: i },
368
+ storeId: t,
369
+ event: { channel: e, type: c, payload: a },
388
370
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
389
- sourceId: r,
390
- sourceRole: b.EXTENSION
371
+ sourceId: n,
372
+ sourceRole: v.EXTENSION
391
373
  });
392
374
  },
393
- [e, s, r]
375
+ [t, o, n]
394
376
  ) };
395
377
  }
396
378
  const we = 2e3;
397
- function Fe(e, s) {
398
- const { subscribe: r } = j(), o = s?.maxEntries ?? we, t = A(/* @__PURE__ */ new Map()), c = A(o);
399
- c.current = o;
400
- const [, i] = k(0);
401
- M(() => r((l) => {
402
- if (l.type !== "STORE_EVENT") return;
403
- const h = l.storeId, m = {
404
- event: l.event,
379
+ function Fe(t, o) {
380
+ const { subscribe: n } = j(), s = o?.maxEntries ?? we, e = I(/* @__PURE__ */ new Map()), c = I(s);
381
+ c.current = s;
382
+ const [, a] = A(0);
383
+ M(() => n((u) => {
384
+ if (u.type !== "STORE_EVENT") return;
385
+ const h = u.storeId, m = {
386
+ event: u.event,
405
387
  storeId: h,
406
- patches: l.patches,
407
- snapshotVersion: l.snapshotVersion,
408
- committed: l.committed,
409
- timestamp: l.timestamp
410
- }, T = [...t.current.get(h) ?? [], m];
411
- t.current.set(
388
+ patches: u.patches,
389
+ snapshotVersion: u.snapshotVersion,
390
+ committed: u.committed,
391
+ timestamp: u.timestamp
392
+ }, T = [...e.current.get(h) ?? [], m];
393
+ e.current.set(
412
394
  h,
413
395
  T.length > c.current ? T.slice(T.length - c.current) : T
414
- ), i((N) => N + 1);
415
- }), [r]);
416
- const a = O(() => {
417
- e && (t.current.delete(e), i((S) => S + 1));
418
- }, [e]);
419
- return { entries: e ? t.current.get(e) ?? [] : [], clear: a };
396
+ ), a((N) => N + 1);
397
+ }), [n]);
398
+ const i = O(() => {
399
+ t && (e.current.delete(t), a((S) => S + 1));
400
+ }, [t]);
401
+ return { entries: t ? e.current.get(t) ?? [] : [], clear: i };
420
402
  }
421
- function He(e) {
422
- const { send: s, extensionId: r } = j();
403
+ function We(t) {
404
+ const { send: o, extensionId: n } = j();
423
405
  return { replay: O(
424
- (t, c) => {
425
- e && s({
406
+ (e, c) => {
407
+ t && o({
426
408
  type: "EVENT_REPLAY",
427
- storeId: e,
428
- snapshot: t,
429
- events: c.map((i) => ({
430
- id: i.event.id,
431
- channel: i.event.channel,
432
- type: i.event.type,
433
- payload: i.event.payload
409
+ storeId: t,
410
+ snapshot: e,
411
+ events: c.map((a) => ({
412
+ id: a.event.id,
413
+ channel: a.event.channel,
414
+ type: a.event.type,
415
+ payload: a.event.payload
434
416
  })),
435
417
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
436
- sourceId: r,
437
- sourceRole: b.EXTENSION
418
+ sourceId: n,
419
+ sourceRole: v.EXTENSION
438
420
  });
439
421
  },
440
- [e, s, r]
422
+ [t, o, n]
441
423
  ) };
442
424
  }
443
- function Xe(e, s) {
444
- const { send: r, subscribe: o, extensionId: t } = j(), [c, i] = k(null), [a, u] = k(!1), S = s?.refreshIntervalMs ?? 2e3, l = A(null), h = O(() => {
445
- e && (u(!0), r({
425
+ function He(t, o) {
426
+ const { send: n, subscribe: s, extensionId: e } = j(), [c, a] = A(null), [i, l] = A(!1), S = o?.refreshIntervalMs ?? 2e3, u = I(null), h = O(() => {
427
+ t && (l(!0), n({
446
428
  type: "REQUEST_METRICS",
447
- storeId: e,
429
+ storeId: t,
448
430
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
449
- sourceId: t,
450
- sourceRole: b.EXTENSION
431
+ sourceId: e,
432
+ sourceRole: v.EXTENSION
451
433
  }));
452
- }, [e, r, t]);
434
+ }, [t, n, e]);
453
435
  return M(() => {
454
- if (!e) {
455
- i(null);
436
+ if (!t) {
437
+ a(null);
456
438
  return;
457
439
  }
458
440
  h();
459
- const m = o((v) => {
460
- v.type === "STORE_METRICS" && v.storeId === e && (i(v.metrics), u(!1));
441
+ const m = s((b) => {
442
+ b.type === "STORE_METRICS" && b.storeId === t && (a(b.metrics), l(!1));
461
443
  });
462
- return S > 0 && (l.current = setInterval(h, S)), () => {
463
- m(), l.current && (clearInterval(l.current), l.current = null);
444
+ return S > 0 && (u.current = setInterval(h, S)), () => {
445
+ m(), u.current && (clearInterval(u.current), u.current = null);
464
446
  };
465
- }, [e, o, h, S]), { metrics: c, loading: a, refresh: h };
447
+ }, [t, s, h, S]), { metrics: c, loading: i, refresh: h };
466
448
  }
467
- function $e() {
468
- const { subscribe: e } = j(), [s, r] = k([]);
469
- return M(() => e((t) => {
470
- switch (t.type) {
449
+ function Xe() {
450
+ const { subscribe: t } = j(), [o, n] = A([]);
451
+ return M(() => t((e) => {
452
+ switch (e.type) {
471
453
  case "STORE_REGISTRY":
472
- r(t.stores);
454
+ n(e.stores);
473
455
  break;
474
456
  case "STORE_CONNECTED":
475
- r((c) => c.some((a) => a.id === t.store.id) ? c.map(
476
- (a) => a.id === t.store.id ? { ...a, status: "connected" } : a
457
+ n((c) => c.some((i) => i.id === e.store.id) ? c.map(
458
+ (i) => i.id === e.store.id ? { ...i, status: "connected" } : i
477
459
  ) : [
478
460
  ...c,
479
461
  {
480
- id: t.store.id,
481
- name: t.store.name,
462
+ id: e.store.id,
463
+ name: e.store.name,
482
464
  status: "connected",
483
- capabilities: t.store.capabilities,
484
- connectedAt: t.timestamp
465
+ capabilities: e.store.capabilities,
466
+ connectedAt: e.timestamp
485
467
  }
486
468
  ]);
487
469
  break;
488
470
  case "STORE_DISCONNECTED":
489
- r(
471
+ n(
490
472
  (c) => c.map(
491
- (i) => i.id === t.storeId ? { ...i, status: "disconnected" } : i
473
+ (a) => a.id === e.storeId ? { ...a, status: "disconnected" } : a
492
474
  )
493
475
  );
494
476
  break;
495
477
  }
496
- }), [e]), s;
478
+ }), [t]), o;
497
479
  }
498
- function Z(e, s) {
499
- let r = e;
500
- for (const o of s) {
501
- const t = Ce(o.path);
502
- switch (o.op) {
480
+ function Z(t, o) {
481
+ let n = t;
482
+ for (const s of o) {
483
+ const e = Ce(s.path);
484
+ switch (s.op) {
503
485
  case "add":
504
- r = ee(r, t, o.value, !0);
486
+ n = ee(n, e, s.value, !0);
505
487
  break;
506
488
  case "replace":
507
- r = ee(r, t, o.value, !1);
489
+ n = ee(n, e, s.value, !1);
508
490
  break;
509
491
  case "remove":
510
- r = pe(r, t);
492
+ n = pe(n, e);
511
493
  break;
512
494
  }
513
495
  }
514
- return r;
496
+ return n;
515
497
  }
516
- function Ce(e) {
517
- return e === "" || e === "/" ? [] : e.slice(1).split("/").map((s) => s.replace(/~1/g, "/").replace(/~0/g, "~"));
498
+ function Ce(t) {
499
+ return t === "" || t === "/" ? [] : t.slice(1).split("/").map((o) => o.replace(/~1/g, "/").replace(/~0/g, "~"));
518
500
  }
519
501
  const Ee = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
520
- function ee(e, s, r, o) {
521
- if (s.length === 0) return r;
522
- const t = Array.isArray(e) ? [...e] : { ...e }, [c, ...i] = s;
523
- if (Ee.has(c)) return t;
524
- if (i.length === 0)
525
- if (o && Array.isArray(t)) {
526
- const a = c === "-" ? t.length : Number(c);
527
- Number.isInteger(a) && a >= 0 && a <= t.length ? t.splice(a, 0, r) : t[c] = r;
502
+ function ee(t, o, n, s) {
503
+ if (o.length === 0) return n;
504
+ const e = Array.isArray(t) ? [...t] : { ...t }, [c, ...a] = o;
505
+ if (Ee.has(c)) return e;
506
+ if (a.length === 0)
507
+ if (s && Array.isArray(e)) {
508
+ const i = c === "-" ? e.length : Number(c);
509
+ Number.isInteger(i) && i >= 0 && i <= e.length ? e.splice(i, 0, n) : e[c] = n;
528
510
  } else
529
- t[c] = r;
511
+ e[c] = n;
530
512
  else
531
- t[c] = ee(t[c] ?? {}, i, r, o);
532
- return t;
513
+ e[c] = ee(e[c] ?? {}, a, n, s);
514
+ return e;
533
515
  }
534
- function pe(e, s) {
535
- if (s.length === 0) return;
536
- const r = Array.isArray(e) ? [...e] : { ...e }, [o, ...t] = s;
537
- return Ee.has(o) || (t.length === 0 ? Array.isArray(r) ? r.splice(Number(o), 1) : delete r[o] : r[o] = pe(r[o], t)), r;
516
+ function pe(t, o) {
517
+ if (o.length === 0) return;
518
+ const n = Array.isArray(t) ? [...t] : { ...t }, [s, ...e] = o;
519
+ return Ee.has(s) || (e.length === 0 ? Array.isArray(n) ? n.splice(Number(s), 1) : delete n[s] : n[s] = pe(n[s], e)), n;
538
520
  }
539
- function ge(e) {
540
- const s = e.scheduler ?? {
541
- setInterval: (t, c) => setInterval(t, c),
542
- clearInterval: (t) => clearInterval(t)
521
+ function ge(t) {
522
+ const o = t.scheduler ?? {
523
+ setInterval: (e, c) => setInterval(e, c),
524
+ clearInterval: (e) => clearInterval(e)
543
525
  };
544
- let r = s.setInterval(() => {
545
- if (e.isSettled()) {
546
- o();
526
+ let n = o.setInterval(() => {
527
+ if (t.isSettled()) {
528
+ s();
547
529
  return;
548
530
  }
549
- e.request();
550
- }, e.intervalMs);
551
- function o() {
552
- r !== null && (s.clearInterval(r), r = null);
531
+ t.request();
532
+ }, t.intervalMs);
533
+ function s() {
534
+ n !== null && (o.clearInterval(n), n = null);
553
535
  }
554
- return o;
536
+ return s;
555
537
  }
556
538
  const Pe = 1500;
557
- function Je(e) {
558
- const { send: s, subscribe: r, extensionId: o } = j(), [t, c] = k(null), [i, a] = k(0), [u, S] = k(!1), l = A(0), h = A([]), m = A(null), v = O(() => {
539
+ function $e(t) {
540
+ const { send: o, subscribe: n, extensionId: s } = j(), [e, c] = A(null), [a, i] = A(0), [l, S] = A(!1), u = I(0), h = I([]), m = I(null), b = O(() => {
559
541
  m.current?.(), m.current = null;
560
542
  }, []), T = O(() => {
561
- e && (S(!0), s({
543
+ t && (S(!0), o({
562
544
  type: "REQUEST_STATE",
563
- storeId: e,
545
+ storeId: t,
564
546
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
565
- sourceId: o,
566
- sourceRole: b.EXTENSION
547
+ sourceId: s,
548
+ sourceRole: v.EXTENSION
567
549
  }));
568
- }, [e, s, o]);
550
+ }, [t, o, s]);
569
551
  return M(() => {
570
- if (!e) {
571
- c(null), a(0), l.current = 0;
552
+ if (!t) {
553
+ c(null), i(0), u.current = 0;
572
554
  return;
573
555
  }
574
556
  T(), m.current = ge({
575
557
  request: T,
576
- isSettled: () => l.current !== 0,
558
+ isSettled: () => u.current !== 0,
577
559
  intervalMs: Pe
578
560
  });
579
- const N = r((E) => {
580
- if (E.type === "STATE_SNAPSHOT" && E.storeId === e) {
581
- v(), c(E.state), a(E.version), l.current = E.version, S(!1);
561
+ const N = n((E) => {
562
+ if (E.type === "STATE_SNAPSHOT" && E.storeId === t) {
563
+ b(), c(E.state), i(E.version), u.current = E.version, S(!1);
582
564
  const R = h.current.filter((x) => x.version > E.version).sort((x, g) => x.version - g.version);
583
565
  if (h.current = [], R.length > 0) {
584
566
  c((g) => {
585
- let I = g;
567
+ let k = g;
586
568
  for (const d of R)
587
- I = Z(I, d.patches);
588
- return I;
569
+ k = Z(k, d.patches);
570
+ return k;
589
571
  });
590
572
  const x = R[R.length - 1].version;
591
- a(x), l.current = x;
573
+ i(x), u.current = x;
592
574
  }
593
575
  return;
594
576
  }
595
- if (E.type === "STORE_EVENT" && E.storeId === e && E.committed) {
596
- if (l.current === 0) {
577
+ if (E.type === "STORE_EVENT" && E.storeId === t && E.committed) {
578
+ if (u.current === 0) {
597
579
  h.current.push({
598
580
  patches: E.patches,
599
581
  version: E.snapshotVersion
600
582
  });
601
583
  return;
602
584
  }
603
- if (E.snapshotVersion <= l.current)
585
+ if (E.snapshotVersion <= u.current)
604
586
  return;
605
- c((R) => Z(R, E.patches)), a(E.snapshotVersion), l.current = E.snapshotVersion;
587
+ c((R) => Z(R, E.patches)), i(E.snapshotVersion), u.current = E.snapshotVersion;
606
588
  }
607
589
  });
608
590
  return () => {
609
- N(), v(), h.current = [];
591
+ N(), b(), h.current = [];
610
592
  };
611
- }, [e, r, T, v]), { state: t, version: i, loading: u, refresh: T };
593
+ }, [t, n, T, b]), { state: e, version: a, loading: l, refresh: T };
612
594
  }
613
- function qe(e) {
614
- const { send: s, subscribe: r, extensionId: o } = j(), [t, c] = k(null), [i, a] = k(!1), u = O(() => {
615
- e && (a(!0), s({
595
+ function Je(t) {
596
+ const { send: o, subscribe: n, extensionId: s } = j(), [e, c] = A(null), [a, i] = A(!1), l = O(() => {
597
+ t && (i(!0), o({
616
598
  type: "REQUEST_SUBSCRIPTIONS",
617
- storeId: e,
599
+ storeId: t,
618
600
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
619
- sourceId: o,
620
- sourceRole: b.EXTENSION
601
+ sourceId: s,
602
+ sourceRole: v.EXTENSION
621
603
  }));
622
- }, [e, s, o]);
604
+ }, [t, o, s]);
623
605
  return M(() => {
624
- if (!e) {
606
+ if (!t) {
625
607
  c(null);
626
608
  return;
627
609
  }
628
- return u(), r((l) => {
629
- l.type === "STORE_SUBSCRIPTIONS" && l.storeId === e && (c({
630
- atomic: l.atomic,
631
- event: l.event,
632
- coarse: l.coarse,
633
- effects: l.effects,
634
- middleware: l.middleware,
635
- reducers: l.reducers
636
- }), a(!1));
610
+ return l(), n((u) => {
611
+ u.type === "STORE_SUBSCRIPTIONS" && u.storeId === t && (c({
612
+ atomic: u.atomic,
613
+ event: u.event,
614
+ coarse: u.coarse,
615
+ effects: u.effects,
616
+ middleware: u.middleware,
617
+ reducers: u.reducers
618
+ }), i(!1));
637
619
  });
638
- }, [e, r, u]), { data: t, loading: i, refresh: u };
620
+ }, [t, n, l]), { data: e, loading: a, refresh: l };
639
621
  }
640
- function le(e, s) {
641
- const { isTimeTraveling: r, currentIndex: o, entryCount: t } = s, c = t - 1;
642
- if (e === "back") {
643
- const u = (r ? o : c) - 1;
644
- return u >= 0 ? { kind: "jump", index: u } : { kind: "none" };
622
+ function le(t, o) {
623
+ const { isTimeTraveling: n, currentIndex: s, entryCount: e } = o, c = e - 1;
624
+ if (t === "back") {
625
+ const l = (n ? s : c) - 1;
626
+ return l >= 0 ? { kind: "jump", index: l } : { kind: "none" };
645
627
  }
646
- if (!r) return { kind: "none" };
647
- const i = o + 1;
648
- return i > c ? { kind: "resume" } : { kind: "jump", index: i };
628
+ if (!n) return { kind: "none" };
629
+ const a = s + 1;
630
+ return a > c ? { kind: "resume" } : { kind: "jump", index: a };
649
631
  }
650
- function De(e) {
651
- const { baseline: s, entries: r, index: o, cache: t } = e;
652
- if (s === null) return { state: null, cache: null };
653
- let c = 0, i = s.state;
654
- t !== null && t.index <= o && r[t.index] === t.marker && (c = t.index + 1, i = t.state);
655
- for (let u = c; u <= o; u++) {
656
- const S = r[u];
632
+ function De(t) {
633
+ const { baseline: o, entries: n, index: s, cache: e } = t;
634
+ if (o === null) return { state: null, cache: null };
635
+ let c = 0, a = o.state;
636
+ e !== null && e.index <= s && n[e.index] === e.marker && (c = e.index + 1, a = e.state);
637
+ for (let l = c; l <= s; l++) {
638
+ const S = n[l];
657
639
  if (S === void 0) break;
658
- S.snapshotVersion <= s.version || (i = Z(i, S.patches));
640
+ S.snapshotVersion <= o.version || (a = Z(a, S.patches));
659
641
  }
660
- const a = r[o];
642
+ const i = n[s];
661
643
  return {
662
- state: i,
663
- cache: o >= 0 && a !== void 0 ? { index: o, state: i, marker: a } : null
644
+ state: a,
645
+ cache: s >= 0 && i !== void 0 ? { index: s, state: a, marker: i } : null
664
646
  };
665
647
  }
666
- function We(e, s, r = !0) {
667
- const { send: o, subscribe: t, extensionId: c } = j(), [i, a] = k(-1), [u, S] = k(!1), [l, h] = k(null), m = A(null), v = A(null);
648
+ function qe(t, o, n = !0) {
649
+ const { send: s, subscribe: e, extensionId: c } = j(), [a, i] = A(-1), [l, S] = A(!1), [u, h] = A(null), m = I(null), b = I(null);
668
650
  M(() => {
669
- if (m.current = null, v.current = null, h(null), !!e)
670
- return t((d) => {
671
- d.type === "STATE_SNAPSHOT" && d.storeId === e && m.current === null && (m.current = { state: d.state, version: d.version });
651
+ if (m.current = null, b.current = null, h(null), !!t)
652
+ return e((d) => {
653
+ d.type === "STATE_SNAPSHOT" && d.storeId === t && m.current === null && (m.current = { state: d.state, version: d.version });
672
654
  });
673
- }, [e, t]);
655
+ }, [t, e]);
674
656
  const T = O(
675
657
  (d) => {
676
658
  const { state: w, cache: C } = De({
677
659
  baseline: m.current,
678
- entries: s,
660
+ entries: o,
679
661
  index: d,
680
- cache: v.current
662
+ cache: b.current
681
663
  });
682
- return v.current = C, w;
664
+ return b.current = C, w;
683
665
  },
684
- [s]
666
+ [o]
685
667
  ), N = O(
686
668
  (d) => {
687
- if (!e || !r || d < 0 || d >= s.length) return;
688
- h((C) => C ?? s.length), a(d), S(!0);
689
- const w = s[d];
690
- o({
669
+ if (!t || !n || d < 0 || d >= o.length) return;
670
+ h((C) => C ?? o.length), i(d), S(!0);
671
+ const w = o[d];
672
+ s({
691
673
  type: "TIME_TRAVEL",
692
- storeId: e,
674
+ storeId: t,
693
675
  state: T(d),
694
676
  snapshotVersion: w.snapshotVersion,
695
677
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
696
678
  sourceId: c,
697
- sourceRole: b.EXTENSION
679
+ sourceRole: v.EXTENSION
698
680
  });
699
681
  },
700
- [e, s, o, T, r, c]
682
+ [t, o, s, T, n, c]
701
683
  ), E = O(() => {
702
- if (S(!1), a(-1), h(null), r && e && s.length > 0) {
703
- const d = s.length - 1, w = s[d];
704
- o({
684
+ if (S(!1), i(-1), h(null), n && t && o.length > 0) {
685
+ const d = o.length - 1, w = o[d];
686
+ s({
705
687
  type: "TIME_TRAVEL",
706
- storeId: e,
688
+ storeId: t,
707
689
  state: T(d),
708
690
  snapshotVersion: w.snapshotVersion,
709
691
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
710
692
  sourceId: c,
711
- sourceRole: b.EXTENSION
693
+ sourceRole: v.EXTENSION
712
694
  });
713
695
  }
714
- }, [e, s, o, T, r, c]), R = l ?? s.length, x = O(() => {
696
+ }, [t, o, s, T, n, c]), R = u ?? o.length, x = O(() => {
715
697
  const d = le("back", {
716
- isTimeTraveling: u,
717
- currentIndex: i,
698
+ isTimeTraveling: l,
699
+ currentIndex: a,
718
700
  entryCount: R
719
701
  });
720
702
  d.kind === "jump" && N(d.index);
721
- }, [u, i, R, N]), g = O(() => {
703
+ }, [l, a, R, N]), g = O(() => {
722
704
  const d = le("forward", {
723
- isTimeTraveling: u,
724
- currentIndex: i,
705
+ isTimeTraveling: l,
706
+ currentIndex: a,
725
707
  entryCount: R
726
708
  });
727
709
  d.kind === "jump" ? N(d.index) : d.kind === "resume" && E();
728
- }, [u, i, R, N, E]), I = Oe(
729
- () => T(u ? i : s.length - 1),
730
- [T, u, i, s.length]
710
+ }, [l, a, R, N, E]), k = Oe(
711
+ () => T(l ? a : o.length - 1),
712
+ [T, l, a, o.length]
731
713
  );
732
714
  return {
733
- currentIndex: i,
734
- isTimeTraveling: u,
735
- previewState: I,
736
- frameCount: l,
715
+ currentIndex: a,
716
+ isTimeTraveling: l,
717
+ previewState: k,
718
+ frameCount: u,
737
719
  jumpTo: N,
738
720
  stepBack: x,
739
721
  stepForward: g,
@@ -741,145 +723,156 @@ function We(e, s, r = !0) {
741
723
  };
742
724
  }
743
725
  const z = 0, Q = 1, je = 2, F = 3;
744
- function $() {
726
+ function X() {
745
727
  return {
746
728
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
747
729
  sourceId: "loopback-hub",
748
- sourceRole: b.HUB
730
+ sourceRole: v.HUB
749
731
  };
750
732
  }
751
- function fe(e) {
752
- return e.split(".")[0] ?? "0";
733
+ function fe(t) {
734
+ return t.split(".")[0] ?? "0";
753
735
  }
754
736
  class Me {
755
737
  constructor() {
756
738
  this.peers = /* @__PURE__ */ new Set();
757
739
  }
758
- add(s) {
759
- const r = { role: null, id: null, deliver: s, closed: !1 };
760
- return this.peers.add(r), r;
740
+ add(o) {
741
+ const n = { role: null, id: null, deliver: o, closed: !1 };
742
+ return this.peers.add(n), n;
761
743
  }
762
- remove(s) {
763
- if (this.peers.delete(s) && (s.closed = !0, s.role === b.STORE && s.id)) {
764
- const r = JSON.stringify({
744
+ remove(o) {
745
+ if (this.peers.delete(o) && (o.closed = !0, o.role === v.STORE && o.id)) {
746
+ const n = JSON.stringify({
765
747
  type: "STORE_DISCONNECTED",
766
- storeId: s.id,
748
+ storeId: o.id,
767
749
  reason: "disconnected",
768
- ...$()
750
+ ...X()
769
751
  });
770
- this.eachExtension((o) => o.deliver(r));
752
+ this.eachExtension((s) => s.deliver(n));
771
753
  }
772
754
  }
773
- receive(s, r) {
774
- if (s.closed) return;
775
- let o;
755
+ receive(o, n) {
756
+ if (o.closed) return;
757
+ let s;
776
758
  try {
777
- o = JSON.parse(r);
759
+ s = JSON.parse(n);
778
760
  } catch {
779
761
  return;
780
762
  }
781
- if (!(o === null || typeof o != "object" || typeof o.type != "string")) {
782
- if (s.role === null) {
783
- this.handshake(s, o);
763
+ if (!(s === null || typeof s != "object" || typeof s.type != "string")) {
764
+ if (o.role === null) {
765
+ this.handshake(o, s);
784
766
  return;
785
767
  }
786
- if (s.role === b.STORE)
787
- this.eachExtension((t) => t.deliver(r));
788
- else if (typeof o.storeId == "string")
789
- for (const t of this.peers)
790
- t.role === b.STORE && t.id === o.storeId && t.deliver(r);
768
+ if (o.role === v.STORE)
769
+ this.eachExtension((e) => e.deliver(n));
770
+ else if (typeof s.storeId == "string")
771
+ for (const e of this.peers)
772
+ e.role === v.STORE && e.id === s.storeId && e.deliver(n);
791
773
  }
792
774
  }
793
- handshake(s, r) {
794
- if (r.type !== "HANDSHAKE_REQUEST") return;
795
- const o = r.role, t = o === b.STORE ? r.store?.id : o === b.EXTENSION ? r.extension?.id : void 0, i = fe(String(r.protocolVersion ?? "")) === fe(K) && typeof t == "string";
796
- if (s.deliver(
775
+ handshake(o, n) {
776
+ if (n.type !== "HANDSHAKE_REQUEST") return;
777
+ const s = n.role, e = s === v.STORE ? n.store?.id : s === v.EXTENSION ? n.extension?.id : void 0, a = fe(String(n.protocolVersion ?? "")) === fe(K) && typeof e == "string";
778
+ if (o.deliver(
797
779
  JSON.stringify({
798
780
  type: "HANDSHAKE_RESPONSE",
799
- success: i,
781
+ success: a,
800
782
  // `negotiatedVersion`, the name the interface and the real hub use. This sent
801
783
  // `protocolVersion` instead — harmless only for as long as nothing reads it, and the
802
784
  // moment something did, the embedded panel would have failed where the real hub worked,
803
785
  // in the one path with no server to inspect.
804
786
  negotiatedVersion: K,
805
- ...$(),
806
- ...i ? {} : { error: "Loopback handshake rejected (version or id mismatch)" }
787
+ ...X(),
788
+ ...a ? {} : { error: "Loopback handshake rejected (version or id mismatch)" }
807
789
  })
808
- ), !!i)
809
- if (s.role = o, s.id = t, o === b.STORE) {
810
- s.storeInfo = { name: r.store?.name ?? t, capabilities: r.store?.capabilities };
811
- const a = JSON.stringify({
790
+ ), !!a)
791
+ if (o.role = s, o.id = e, s === v.STORE) {
792
+ o.storeInfo = { name: n.store?.name ?? e, capabilities: n.store?.capabilities };
793
+ const i = JSON.stringify({
812
794
  type: "STORE_CONNECTED",
813
- store: { id: t, name: s.storeInfo.name, capabilities: s.storeInfo.capabilities },
814
- ...$()
795
+ store: { id: e, name: o.storeInfo.name, capabilities: o.storeInfo.capabilities },
796
+ ...X()
815
797
  });
816
- this.eachExtension((u) => u.deliver(a));
798
+ this.eachExtension((l) => l.deliver(i));
817
799
  } else {
818
- const a = [...this.peers].filter((u) => u.role === b.STORE && u.storeInfo).map((u) => ({
819
- id: u.id,
820
- name: u.storeInfo.name,
800
+ const i = [...this.peers].filter((l) => l.role === v.STORE && l.storeInfo).map((l) => ({
801
+ id: l.id,
802
+ name: l.storeInfo.name,
821
803
  status: "connected",
822
- capabilities: u.storeInfo.capabilities,
804
+ capabilities: l.storeInfo.capabilities,
823
805
  connectedAt: (/* @__PURE__ */ new Date()).toISOString()
824
806
  }));
825
- s.deliver(JSON.stringify({ type: "STORE_REGISTRY", stores: a, ...$() }));
807
+ o.deliver(JSON.stringify({ type: "STORE_REGISTRY", stores: i, ...X() }));
826
808
  }
827
809
  }
828
- eachExtension(s) {
829
- for (const r of this.peers) r.role === b.EXTENSION && s(r);
810
+ eachExtension(o) {
811
+ for (const n of this.peers) n.role === v.EXTENSION && o(n);
830
812
  }
831
813
  }
832
814
  function Ge() {
833
- const e = new Me(), s = (t, c) => {
834
- let i = z;
835
- const a = e.add((u) => c.onMessage(u));
815
+ const t = new Me(), o = (s, e) => {
816
+ let c = z;
817
+ const a = t.add((i) => e.onMessage(i));
836
818
  return queueMicrotask(() => {
837
- i = Q, c.onOpen();
819
+ c = Q, e.onOpen();
838
820
  }), {
839
821
  get readyState() {
840
- return i;
822
+ return c;
841
823
  },
842
- send: (u) => e.receive(a, u),
824
+ send: (i) => t.receive(a, i),
843
825
  close: () => {
844
- i !== F && (i = F, e.remove(a), c.onClose());
826
+ c !== F && (c = F, t.remove(a), e.onClose());
845
827
  },
846
828
  dispose: () => {
847
829
  a.closed = !0;
848
830
  }
849
831
  };
850
- }, o = class o {
851
- constructor(c) {
852
- this.onopen = null, this.onmessage = null, this.onclose = null, this.onerror = null, this.readyState = z, this.peer = e.add((i) => this.onmessage?.({ data: i })), queueMicrotask(() => {
832
+ };
833
+ class n {
834
+ constructor(e) {
835
+ this.onopen = null, this.onmessage = null, this.onclose = null, this.onerror = null, this.readyState = z, this.peer = t.add((c) => this.onmessage?.({ data: c })), queueMicrotask(() => {
853
836
  this.readyState = Q, this.onopen?.();
854
837
  });
855
838
  }
856
- send(c) {
857
- e.receive(this.peer, c);
839
+ static {
840
+ this.CONNECTING = z;
841
+ }
842
+ static {
843
+ this.OPEN = Q;
844
+ }
845
+ static {
846
+ this.CLOSING = je;
847
+ }
848
+ static {
849
+ this.CLOSED = F;
850
+ }
851
+ send(e) {
852
+ t.receive(this.peer, e);
858
853
  }
859
854
  close() {
860
- this.readyState !== F && (this.readyState = F, e.remove(this.peer), this.onclose?.());
855
+ this.readyState !== F && (this.readyState = F, t.remove(this.peer), this.onclose?.());
861
856
  }
862
- };
863
- o.CONNECTING = z, o.OPEN = Q, o.CLOSING = je, o.CLOSED = F;
864
- let r = o;
857
+ }
865
858
  return {
866
- agentSocketFactory: s,
867
- WebSocket: r
859
+ agentSocketFactory: o,
860
+ WebSocket: n
868
861
  };
869
862
  }
870
863
  export {
871
864
  de as HubContext,
872
- Le as HubProvider,
865
+ Ye as HubProvider,
873
866
  Z as applyPatches,
874
867
  Ge as createLoopbackHub,
875
868
  Ue as useEventEmitter,
876
869
  Fe as useEventLog,
877
- He as useEventReplay,
870
+ We as useEventReplay,
878
871
  j as useHubConnection,
879
- Xe as useStoreMetrics,
880
- $e as useStoreRegistry,
881
- Je as useStoreState,
882
- qe as useStoreSubscriptions,
883
- We as useTimeTravel
872
+ He as useStoreMetrics,
873
+ Xe as useStoreRegistry,
874
+ $e as useStoreState,
875
+ Je as useStoreSubscriptions,
876
+ qe as useTimeTravel
884
877
  };
885
878
  //# sourceMappingURL=devtools-ui.mjs.map