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