@mcp-fe/react-tools 0.1.1 → 0.1.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/index.mjs +424 -1899
- package/package.json +6 -5
package/index.mjs
CHANGED
|
@@ -1,1238 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var v = /* @__PURE__ */ Symbol.for("react.transitional.element"), n = /* @__PURE__ */ Symbol.for("react.portal"), s = /* @__PURE__ */ Symbol.for("react.fragment"), a = /* @__PURE__ */ Symbol.for("react.strict_mode"), u = /* @__PURE__ */ Symbol.for("react.profiler"), d = /* @__PURE__ */ Symbol.for("react.consumer"), y = /* @__PURE__ */ Symbol.for("react.context"), b = /* @__PURE__ */ Symbol.for("react.forward_ref"), O = /* @__PURE__ */ Symbol.for("react.suspense"), I = /* @__PURE__ */ Symbol.for("react.memo"), m = /* @__PURE__ */ Symbol.for("react.lazy"), k = /* @__PURE__ */ Symbol.for("react.activity"), L = Symbol.iterator;
|
|
7
|
-
function $(t) {
|
|
8
|
-
return t === null || typeof t != "object" ? null : (t = L && t[L] || t["@@iterator"], typeof t == "function" ? t : null);
|
|
9
|
-
}
|
|
10
|
-
var U = {
|
|
11
|
-
isMounted: function() {
|
|
12
|
-
return !1;
|
|
13
|
-
},
|
|
14
|
-
enqueueForceUpdate: function() {
|
|
15
|
-
},
|
|
16
|
-
enqueueReplaceState: function() {
|
|
17
|
-
},
|
|
18
|
-
enqueueSetState: function() {
|
|
19
|
-
}
|
|
20
|
-
}, D = Object.assign, F = {};
|
|
21
|
-
function H(t, o, l) {
|
|
22
|
-
this.props = t, this.context = o, this.refs = F, this.updater = l || U;
|
|
23
|
-
}
|
|
24
|
-
H.prototype.isReactComponent = {}, H.prototype.setState = function(t, o) {
|
|
25
|
-
if (typeof t != "object" && typeof t != "function" && t != null)
|
|
26
|
-
throw Error(
|
|
27
|
-
"takes an object of state variables to update or a function which returns an object of state variables."
|
|
28
|
-
);
|
|
29
|
-
this.updater.enqueueSetState(this, t, o, "setState");
|
|
30
|
-
}, H.prototype.forceUpdate = function(t) {
|
|
31
|
-
this.updater.enqueueForceUpdate(this, t, "forceUpdate");
|
|
32
|
-
};
|
|
33
|
-
function N() {
|
|
34
|
-
}
|
|
35
|
-
N.prototype = H.prototype;
|
|
36
|
-
function G(t, o, l) {
|
|
37
|
-
this.props = t, this.context = o, this.refs = F, this.updater = l || U;
|
|
38
|
-
}
|
|
39
|
-
var X = G.prototype = new N();
|
|
40
|
-
X.constructor = G, D(X, H.prototype), X.isPureReactComponent = !0;
|
|
41
|
-
var x = Array.isArray;
|
|
42
|
-
function se() {
|
|
43
|
-
}
|
|
44
|
-
var W = { H: null, A: null, T: null, S: null }, ue = Object.prototype.hasOwnProperty;
|
|
45
|
-
function z(t, o, l) {
|
|
46
|
-
var f = l.ref;
|
|
47
|
-
return {
|
|
48
|
-
$$typeof: v,
|
|
49
|
-
type: t,
|
|
50
|
-
key: o,
|
|
51
|
-
ref: f !== void 0 ? f : null,
|
|
52
|
-
props: l
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function te(t, o) {
|
|
56
|
-
return z(t.type, o, t.props);
|
|
57
|
-
}
|
|
58
|
-
function ie(t) {
|
|
59
|
-
return typeof t == "object" && t !== null && t.$$typeof === v;
|
|
60
|
-
}
|
|
61
|
-
function A(t) {
|
|
62
|
-
var o = { "=": "=0", ":": "=2" };
|
|
63
|
-
return "$" + t.replace(/[=:]/g, function(l) {
|
|
64
|
-
return o[l];
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
var re = /\/+/g;
|
|
68
|
-
function V(t, o) {
|
|
69
|
-
return typeof t == "object" && t !== null && t.key != null ? A("" + t.key) : o.toString(36);
|
|
70
|
-
}
|
|
71
|
-
function Q(t) {
|
|
72
|
-
switch (t.status) {
|
|
73
|
-
case "fulfilled":
|
|
74
|
-
return t.value;
|
|
75
|
-
case "rejected":
|
|
76
|
-
throw t.reason;
|
|
77
|
-
default:
|
|
78
|
-
switch (typeof t.status == "string" ? t.then(se, se) : (t.status = "pending", t.then(
|
|
79
|
-
function(o) {
|
|
80
|
-
t.status === "pending" && (t.status = "fulfilled", t.value = o);
|
|
81
|
-
},
|
|
82
|
-
function(o) {
|
|
83
|
-
t.status === "pending" && (t.status = "rejected", t.reason = o);
|
|
84
|
-
}
|
|
85
|
-
)), t.status) {
|
|
86
|
-
case "fulfilled":
|
|
87
|
-
return t.value;
|
|
88
|
-
case "rejected":
|
|
89
|
-
throw t.reason;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
throw t;
|
|
93
|
-
}
|
|
94
|
-
function q(t, o, l, f, _) {
|
|
95
|
-
var S = typeof t;
|
|
96
|
-
(S === "undefined" || S === "boolean") && (t = null);
|
|
97
|
-
var p = !1;
|
|
98
|
-
if (t === null) p = !0;
|
|
99
|
-
else
|
|
100
|
-
switch (S) {
|
|
101
|
-
case "bigint":
|
|
102
|
-
case "string":
|
|
103
|
-
case "number":
|
|
104
|
-
p = !0;
|
|
105
|
-
break;
|
|
106
|
-
case "object":
|
|
107
|
-
switch (t.$$typeof) {
|
|
108
|
-
case v:
|
|
109
|
-
case n:
|
|
110
|
-
p = !0;
|
|
111
|
-
break;
|
|
112
|
-
case m:
|
|
113
|
-
return p = t._init, q(
|
|
114
|
-
p(t._payload),
|
|
115
|
-
o,
|
|
116
|
-
l,
|
|
117
|
-
f,
|
|
118
|
-
_
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
if (p)
|
|
123
|
-
return _ = _(t), p = f === "" ? "." + V(t, 0) : f, x(_) ? (l = "", p != null && (l = p.replace(re, "$&/") + "/"), q(_, o, l, "", function(ee) {
|
|
124
|
-
return ee;
|
|
125
|
-
})) : _ != null && (ie(_) && (_ = te(
|
|
126
|
-
_,
|
|
127
|
-
l + (_.key == null || t && t.key === _.key ? "" : ("" + _.key).replace(
|
|
128
|
-
re,
|
|
129
|
-
"$&/"
|
|
130
|
-
) + "/") + p
|
|
131
|
-
)), o.push(_)), 1;
|
|
132
|
-
p = 0;
|
|
133
|
-
var Y = f === "" ? "." : f + ":";
|
|
134
|
-
if (x(t))
|
|
135
|
-
for (var j = 0; j < t.length; j++)
|
|
136
|
-
f = t[j], S = Y + V(f, j), p += q(
|
|
137
|
-
f,
|
|
138
|
-
o,
|
|
139
|
-
l,
|
|
140
|
-
S,
|
|
141
|
-
_
|
|
142
|
-
);
|
|
143
|
-
else if (j = $(t), typeof j == "function")
|
|
144
|
-
for (t = j.call(t), j = 0; !(f = t.next()).done; )
|
|
145
|
-
f = f.value, S = Y + V(f, j++), p += q(
|
|
146
|
-
f,
|
|
147
|
-
o,
|
|
148
|
-
l,
|
|
149
|
-
S,
|
|
150
|
-
_
|
|
151
|
-
);
|
|
152
|
-
else if (S === "object") {
|
|
153
|
-
if (typeof t.then == "function")
|
|
154
|
-
return q(
|
|
155
|
-
Q(t),
|
|
156
|
-
o,
|
|
157
|
-
l,
|
|
158
|
-
f,
|
|
159
|
-
_
|
|
160
|
-
);
|
|
161
|
-
throw o = String(t), Error(
|
|
162
|
-
"Objects are not valid as a React child (found: " + (o === "[object Object]" ? "object with keys {" + Object.keys(t).join(", ") + "}" : o) + "). If you meant to render a collection of children, use an array instead."
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
return p;
|
|
166
|
-
}
|
|
167
|
-
function K(t, o, l) {
|
|
168
|
-
if (t == null) return t;
|
|
169
|
-
var f = [], _ = 0;
|
|
170
|
-
return q(t, f, "", "", function(S) {
|
|
171
|
-
return o.call(l, S, _++);
|
|
172
|
-
}), f;
|
|
173
|
-
}
|
|
174
|
-
function ne(t) {
|
|
175
|
-
if (t._status === -1) {
|
|
176
|
-
var o = t._result;
|
|
177
|
-
o = o(), o.then(
|
|
178
|
-
function(l) {
|
|
179
|
-
(t._status === 0 || t._status === -1) && (t._status = 1, t._result = l);
|
|
180
|
-
},
|
|
181
|
-
function(l) {
|
|
182
|
-
(t._status === 0 || t._status === -1) && (t._status = 2, t._result = l);
|
|
183
|
-
}
|
|
184
|
-
), t._status === -1 && (t._status = 0, t._result = o);
|
|
185
|
-
}
|
|
186
|
-
if (t._status === 1) return t._result.default;
|
|
187
|
-
throw t._result;
|
|
188
|
-
}
|
|
189
|
-
var Z = typeof reportError == "function" ? reportError : function(t) {
|
|
190
|
-
if (typeof window == "object" && typeof window.ErrorEvent == "function") {
|
|
191
|
-
var o = new window.ErrorEvent("error", {
|
|
192
|
-
bubbles: !0,
|
|
193
|
-
cancelable: !0,
|
|
194
|
-
message: typeof t == "object" && t !== null && typeof t.message == "string" ? String(t.message) : String(t),
|
|
195
|
-
error: t
|
|
196
|
-
});
|
|
197
|
-
if (!window.dispatchEvent(o)) return;
|
|
198
|
-
} else if (typeof process == "object" && typeof process.emit == "function") {
|
|
199
|
-
process.emit("uncaughtException", t);
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
console.error(t);
|
|
203
|
-
}, ae = {
|
|
204
|
-
map: K,
|
|
205
|
-
forEach: function(t, o, l) {
|
|
206
|
-
K(
|
|
207
|
-
t,
|
|
208
|
-
function() {
|
|
209
|
-
o.apply(this, arguments);
|
|
210
|
-
},
|
|
211
|
-
l
|
|
212
|
-
);
|
|
213
|
-
},
|
|
214
|
-
count: function(t) {
|
|
215
|
-
var o = 0;
|
|
216
|
-
return K(t, function() {
|
|
217
|
-
o++;
|
|
218
|
-
}), o;
|
|
219
|
-
},
|
|
220
|
-
toArray: function(t) {
|
|
221
|
-
return K(t, function(o) {
|
|
222
|
-
return o;
|
|
223
|
-
}) || [];
|
|
224
|
-
},
|
|
225
|
-
only: function(t) {
|
|
226
|
-
if (!ie(t))
|
|
227
|
-
throw Error(
|
|
228
|
-
"React.Children.only expected to receive a single React element child."
|
|
229
|
-
);
|
|
230
|
-
return t;
|
|
231
|
-
}
|
|
232
|
-
};
|
|
233
|
-
return g.Activity = k, g.Children = ae, g.Component = H, g.Fragment = s, g.Profiler = u, g.PureComponent = G, g.StrictMode = a, g.Suspense = O, g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = W, g.__COMPILER_RUNTIME = {
|
|
234
|
-
__proto__: null,
|
|
235
|
-
c: function(t) {
|
|
236
|
-
return W.H.useMemoCache(t);
|
|
237
|
-
}
|
|
238
|
-
}, g.cache = function(t) {
|
|
239
|
-
return function() {
|
|
240
|
-
return t.apply(null, arguments);
|
|
241
|
-
};
|
|
242
|
-
}, g.cacheSignal = function() {
|
|
243
|
-
return null;
|
|
244
|
-
}, g.cloneElement = function(t, o, l) {
|
|
245
|
-
if (t == null)
|
|
246
|
-
throw Error(
|
|
247
|
-
"The argument must be a React element, but you passed " + t + "."
|
|
248
|
-
);
|
|
249
|
-
var f = D({}, t.props), _ = t.key;
|
|
250
|
-
if (o != null)
|
|
251
|
-
for (S in o.key !== void 0 && (_ = "" + o.key), o)
|
|
252
|
-
!ue.call(o, S) || S === "key" || S === "__self" || S === "__source" || S === "ref" && o.ref === void 0 || (f[S] = o[S]);
|
|
253
|
-
var S = arguments.length - 2;
|
|
254
|
-
if (S === 1) f.children = l;
|
|
255
|
-
else if (1 < S) {
|
|
256
|
-
for (var p = Array(S), Y = 0; Y < S; Y++)
|
|
257
|
-
p[Y] = arguments[Y + 2];
|
|
258
|
-
f.children = p;
|
|
259
|
-
}
|
|
260
|
-
return z(t.type, _, f);
|
|
261
|
-
}, g.createContext = function(t) {
|
|
262
|
-
return t = {
|
|
263
|
-
$$typeof: y,
|
|
264
|
-
_currentValue: t,
|
|
265
|
-
_currentValue2: t,
|
|
266
|
-
_threadCount: 0,
|
|
267
|
-
Provider: null,
|
|
268
|
-
Consumer: null
|
|
269
|
-
}, t.Provider = t, t.Consumer = {
|
|
270
|
-
$$typeof: d,
|
|
271
|
-
_context: t
|
|
272
|
-
}, t;
|
|
273
|
-
}, g.createElement = function(t, o, l) {
|
|
274
|
-
var f, _ = {}, S = null;
|
|
275
|
-
if (o != null)
|
|
276
|
-
for (f in o.key !== void 0 && (S = "" + o.key), o)
|
|
277
|
-
ue.call(o, f) && f !== "key" && f !== "__self" && f !== "__source" && (_[f] = o[f]);
|
|
278
|
-
var p = arguments.length - 2;
|
|
279
|
-
if (p === 1) _.children = l;
|
|
280
|
-
else if (1 < p) {
|
|
281
|
-
for (var Y = Array(p), j = 0; j < p; j++)
|
|
282
|
-
Y[j] = arguments[j + 2];
|
|
283
|
-
_.children = Y;
|
|
284
|
-
}
|
|
285
|
-
if (t && t.defaultProps)
|
|
286
|
-
for (f in p = t.defaultProps, p)
|
|
287
|
-
_[f] === void 0 && (_[f] = p[f]);
|
|
288
|
-
return z(t, S, _);
|
|
289
|
-
}, g.createRef = function() {
|
|
290
|
-
return { current: null };
|
|
291
|
-
}, g.forwardRef = function(t) {
|
|
292
|
-
return { $$typeof: b, render: t };
|
|
293
|
-
}, g.isValidElement = ie, g.lazy = function(t) {
|
|
294
|
-
return {
|
|
295
|
-
$$typeof: m,
|
|
296
|
-
_payload: { _status: -1, _result: t },
|
|
297
|
-
_init: ne
|
|
298
|
-
};
|
|
299
|
-
}, g.memo = function(t, o) {
|
|
300
|
-
return {
|
|
301
|
-
$$typeof: I,
|
|
302
|
-
type: t,
|
|
303
|
-
compare: o === void 0 ? null : o
|
|
304
|
-
};
|
|
305
|
-
}, g.startTransition = function(t) {
|
|
306
|
-
var o = W.T, l = {};
|
|
307
|
-
W.T = l;
|
|
308
|
-
try {
|
|
309
|
-
var f = t(), _ = W.S;
|
|
310
|
-
_ !== null && _(l, f), typeof f == "object" && f !== null && typeof f.then == "function" && f.then(se, Z);
|
|
311
|
-
} catch (S) {
|
|
312
|
-
Z(S);
|
|
313
|
-
} finally {
|
|
314
|
-
o !== null && l.types !== null && (o.types = l.types), W.T = o;
|
|
315
|
-
}
|
|
316
|
-
}, g.unstable_useCacheRefresh = function() {
|
|
317
|
-
return W.H.useCacheRefresh();
|
|
318
|
-
}, g.use = function(t) {
|
|
319
|
-
return W.H.use(t);
|
|
320
|
-
}, g.useActionState = function(t, o, l) {
|
|
321
|
-
return W.H.useActionState(t, o, l);
|
|
322
|
-
}, g.useCallback = function(t, o) {
|
|
323
|
-
return W.H.useCallback(t, o);
|
|
324
|
-
}, g.useContext = function(t) {
|
|
325
|
-
return W.H.useContext(t);
|
|
326
|
-
}, g.useDebugValue = function() {
|
|
327
|
-
}, g.useDeferredValue = function(t, o) {
|
|
328
|
-
return W.H.useDeferredValue(t, o);
|
|
329
|
-
}, g.useEffect = function(t, o) {
|
|
330
|
-
return W.H.useEffect(t, o);
|
|
331
|
-
}, g.useEffectEvent = function(t) {
|
|
332
|
-
return W.H.useEffectEvent(t);
|
|
333
|
-
}, g.useId = function() {
|
|
334
|
-
return W.H.useId();
|
|
335
|
-
}, g.useImperativeHandle = function(t, o, l) {
|
|
336
|
-
return W.H.useImperativeHandle(t, o, l);
|
|
337
|
-
}, g.useInsertionEffect = function(t, o) {
|
|
338
|
-
return W.H.useInsertionEffect(t, o);
|
|
339
|
-
}, g.useLayoutEffect = function(t, o) {
|
|
340
|
-
return W.H.useLayoutEffect(t, o);
|
|
341
|
-
}, g.useMemo = function(t, o) {
|
|
342
|
-
return W.H.useMemo(t, o);
|
|
343
|
-
}, g.useOptimistic = function(t, o) {
|
|
344
|
-
return W.H.useOptimistic(t, o);
|
|
345
|
-
}, g.useReducer = function(t, o, l) {
|
|
346
|
-
return W.H.useReducer(t, o, l);
|
|
347
|
-
}, g.useRef = function(t) {
|
|
348
|
-
return W.H.useRef(t);
|
|
349
|
-
}, g.useState = function(t) {
|
|
350
|
-
return W.H.useState(t);
|
|
351
|
-
}, g.useSyncExternalStore = function(t, o, l) {
|
|
352
|
-
return W.H.useSyncExternalStore(
|
|
353
|
-
t,
|
|
354
|
-
o,
|
|
355
|
-
l
|
|
356
|
-
);
|
|
357
|
-
}, g.useTransition = function() {
|
|
358
|
-
return W.H.useTransition();
|
|
359
|
-
}, g.version = "19.2.3", g;
|
|
360
|
-
}
|
|
361
|
-
var he = { exports: {} };
|
|
362
|
-
he.exports;
|
|
363
|
-
var He;
|
|
364
|
-
function et() {
|
|
365
|
-
return He || (He = 1, (function(v, n) {
|
|
366
|
-
process.env.NODE_ENV !== "production" && (function() {
|
|
367
|
-
function s(e, r) {
|
|
368
|
-
Object.defineProperty(d.prototype, e, {
|
|
369
|
-
get: function() {
|
|
370
|
-
console.warn(
|
|
371
|
-
"%s(...) is deprecated in plain JavaScript React classes. %s",
|
|
372
|
-
r[0],
|
|
373
|
-
r[1]
|
|
374
|
-
);
|
|
375
|
-
}
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
function a(e) {
|
|
379
|
-
return e === null || typeof e != "object" ? null : (e = Ce && e[Ce] || e["@@iterator"], typeof e == "function" ? e : null);
|
|
380
|
-
}
|
|
381
|
-
function u(e, r) {
|
|
382
|
-
e = (e = e.constructor) && (e.displayName || e.name) || "ReactClass";
|
|
383
|
-
var i = e + "." + r;
|
|
384
|
-
Se[i] || (console.error(
|
|
385
|
-
"Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",
|
|
386
|
-
r,
|
|
387
|
-
e
|
|
388
|
-
), Se[i] = !0);
|
|
389
|
-
}
|
|
390
|
-
function d(e, r, i) {
|
|
391
|
-
this.props = e, this.context = r, this.refs = me, this.updater = i || be;
|
|
392
|
-
}
|
|
393
|
-
function y() {
|
|
394
|
-
}
|
|
395
|
-
function b(e, r, i) {
|
|
396
|
-
this.props = e, this.context = r, this.refs = me, this.updater = i || be;
|
|
397
|
-
}
|
|
398
|
-
function O() {
|
|
399
|
-
}
|
|
400
|
-
function I(e) {
|
|
401
|
-
return "" + e;
|
|
402
|
-
}
|
|
403
|
-
function m(e) {
|
|
404
|
-
try {
|
|
405
|
-
I(e);
|
|
406
|
-
var r = !1;
|
|
407
|
-
} catch {
|
|
408
|
-
r = !0;
|
|
409
|
-
}
|
|
410
|
-
if (r) {
|
|
411
|
-
r = console;
|
|
412
|
-
var i = r.error, c = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
413
|
-
return i.call(
|
|
414
|
-
r,
|
|
415
|
-
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
416
|
-
c
|
|
417
|
-
), I(e);
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
function k(e) {
|
|
421
|
-
if (e == null) return null;
|
|
422
|
-
if (typeof e == "function")
|
|
423
|
-
return e.$$typeof === Qe ? null : e.displayName || e.name || null;
|
|
424
|
-
if (typeof e == "string") return e;
|
|
425
|
-
switch (e) {
|
|
426
|
-
case t:
|
|
427
|
-
return "Fragment";
|
|
428
|
-
case l:
|
|
429
|
-
return "Profiler";
|
|
430
|
-
case o:
|
|
431
|
-
return "StrictMode";
|
|
432
|
-
case p:
|
|
433
|
-
return "Suspense";
|
|
434
|
-
case Y:
|
|
435
|
-
return "SuspenseList";
|
|
436
|
-
case Re:
|
|
437
|
-
return "Activity";
|
|
438
|
-
}
|
|
439
|
-
if (typeof e == "object")
|
|
440
|
-
switch (typeof e.tag == "number" && console.error(
|
|
441
|
-
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
442
|
-
), e.$$typeof) {
|
|
443
|
-
case ae:
|
|
444
|
-
return "Portal";
|
|
445
|
-
case _:
|
|
446
|
-
return e.displayName || "Context";
|
|
447
|
-
case f:
|
|
448
|
-
return (e._context.displayName || "Context") + ".Consumer";
|
|
449
|
-
case S:
|
|
450
|
-
var r = e.render;
|
|
451
|
-
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
452
|
-
case j:
|
|
453
|
-
return r = e.displayName || null, r !== null ? r : k(e.type) || "Memo";
|
|
454
|
-
case ee:
|
|
455
|
-
r = e._payload, e = e._init;
|
|
456
|
-
try {
|
|
457
|
-
return k(e(r));
|
|
458
|
-
} catch {
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
return null;
|
|
462
|
-
}
|
|
463
|
-
function L(e) {
|
|
464
|
-
if (e === t) return "<>";
|
|
465
|
-
if (typeof e == "object" && e !== null && e.$$typeof === ee)
|
|
466
|
-
return "<...>";
|
|
467
|
-
try {
|
|
468
|
-
var r = k(e);
|
|
469
|
-
return r ? "<" + r + ">" : "<...>";
|
|
470
|
-
} catch {
|
|
471
|
-
return "<...>";
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
function $() {
|
|
475
|
-
var e = w.A;
|
|
476
|
-
return e === null ? null : e.getOwner();
|
|
477
|
-
}
|
|
478
|
-
function U() {
|
|
479
|
-
return Error("react-stack-top-frame");
|
|
480
|
-
}
|
|
481
|
-
function D(e) {
|
|
482
|
-
if (pe.call(e, "key")) {
|
|
483
|
-
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
484
|
-
if (r && r.isReactWarning) return !1;
|
|
485
|
-
}
|
|
486
|
-
return e.key !== void 0;
|
|
487
|
-
}
|
|
488
|
-
function F(e, r) {
|
|
489
|
-
function i() {
|
|
490
|
-
Oe || (Oe = !0, console.error(
|
|
491
|
-
"%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)",
|
|
492
|
-
r
|
|
493
|
-
));
|
|
494
|
-
}
|
|
495
|
-
i.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
496
|
-
get: i,
|
|
497
|
-
configurable: !0
|
|
498
|
-
});
|
|
499
|
-
}
|
|
500
|
-
function H() {
|
|
501
|
-
var e = k(this.type);
|
|
502
|
-
return Ne[e] || (Ne[e] = !0, console.error(
|
|
503
|
-
"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."
|
|
504
|
-
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
505
|
-
}
|
|
506
|
-
function N(e, r, i, c, h, R) {
|
|
507
|
-
var T = i.ref;
|
|
508
|
-
return e = {
|
|
509
|
-
$$typeof: Z,
|
|
510
|
-
type: e,
|
|
511
|
-
key: r,
|
|
512
|
-
props: i,
|
|
513
|
-
_owner: c
|
|
514
|
-
}, (T !== void 0 ? T : null) !== null ? Object.defineProperty(e, "ref", {
|
|
515
|
-
enumerable: !1,
|
|
516
|
-
get: H
|
|
517
|
-
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
518
|
-
configurable: !1,
|
|
519
|
-
enumerable: !1,
|
|
520
|
-
writable: !0,
|
|
521
|
-
value: 0
|
|
522
|
-
}), Object.defineProperty(e, "_debugInfo", {
|
|
523
|
-
configurable: !1,
|
|
524
|
-
enumerable: !1,
|
|
525
|
-
writable: !0,
|
|
526
|
-
value: null
|
|
527
|
-
}), Object.defineProperty(e, "_debugStack", {
|
|
528
|
-
configurable: !1,
|
|
529
|
-
enumerable: !1,
|
|
530
|
-
writable: !0,
|
|
531
|
-
value: h
|
|
532
|
-
}), Object.defineProperty(e, "_debugTask", {
|
|
533
|
-
configurable: !1,
|
|
534
|
-
enumerable: !1,
|
|
535
|
-
writable: !0,
|
|
536
|
-
value: R
|
|
537
|
-
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
538
|
-
}
|
|
539
|
-
function G(e, r) {
|
|
540
|
-
return r = N(
|
|
541
|
-
e.type,
|
|
542
|
-
r,
|
|
543
|
-
e.props,
|
|
544
|
-
e._owner,
|
|
545
|
-
e._debugStack,
|
|
546
|
-
e._debugTask
|
|
547
|
-
), e._store && (r._store.validated = e._store.validated), r;
|
|
548
|
-
}
|
|
549
|
-
function X(e) {
|
|
550
|
-
x(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === ee && (e._payload.status === "fulfilled" ? x(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
551
|
-
}
|
|
552
|
-
function x(e) {
|
|
553
|
-
return typeof e == "object" && e !== null && e.$$typeof === Z;
|
|
554
|
-
}
|
|
555
|
-
function se(e) {
|
|
556
|
-
var r = { "=": "=0", ":": "=2" };
|
|
557
|
-
return "$" + e.replace(/[=:]/g, function(i) {
|
|
558
|
-
return r[i];
|
|
559
|
-
});
|
|
560
|
-
}
|
|
561
|
-
function W(e, r) {
|
|
562
|
-
return typeof e == "object" && e !== null && e.key != null ? (m(e.key), se("" + e.key)) : r.toString(36);
|
|
563
|
-
}
|
|
564
|
-
function ue(e) {
|
|
565
|
-
switch (e.status) {
|
|
566
|
-
case "fulfilled":
|
|
567
|
-
return e.value;
|
|
568
|
-
case "rejected":
|
|
569
|
-
throw e.reason;
|
|
570
|
-
default:
|
|
571
|
-
switch (typeof e.status == "string" ? e.then(O, O) : (e.status = "pending", e.then(
|
|
572
|
-
function(r) {
|
|
573
|
-
e.status === "pending" && (e.status = "fulfilled", e.value = r);
|
|
574
|
-
},
|
|
575
|
-
function(r) {
|
|
576
|
-
e.status === "pending" && (e.status = "rejected", e.reason = r);
|
|
577
|
-
}
|
|
578
|
-
)), e.status) {
|
|
579
|
-
case "fulfilled":
|
|
580
|
-
return e.value;
|
|
581
|
-
case "rejected":
|
|
582
|
-
throw e.reason;
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
throw e;
|
|
586
|
-
}
|
|
587
|
-
function z(e, r, i, c, h) {
|
|
588
|
-
var R = typeof e;
|
|
589
|
-
(R === "undefined" || R === "boolean") && (e = null);
|
|
590
|
-
var T = !1;
|
|
591
|
-
if (e === null) T = !0;
|
|
592
|
-
else
|
|
593
|
-
switch (R) {
|
|
594
|
-
case "bigint":
|
|
595
|
-
case "string":
|
|
596
|
-
case "number":
|
|
597
|
-
T = !0;
|
|
598
|
-
break;
|
|
599
|
-
case "object":
|
|
600
|
-
switch (e.$$typeof) {
|
|
601
|
-
case Z:
|
|
602
|
-
case ae:
|
|
603
|
-
T = !0;
|
|
604
|
-
break;
|
|
605
|
-
case ee:
|
|
606
|
-
return T = e._init, z(
|
|
607
|
-
T(e._payload),
|
|
608
|
-
r,
|
|
609
|
-
i,
|
|
610
|
-
c,
|
|
611
|
-
h
|
|
612
|
-
);
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
if (T) {
|
|
616
|
-
T = e, h = h(T);
|
|
617
|
-
var P = c === "" ? "." + W(T, 0) : c;
|
|
618
|
-
return Ae(h) ? (i = "", P != null && (i = P.replace(Ie, "$&/") + "/"), z(h, r, i, "", function(oe) {
|
|
619
|
-
return oe;
|
|
620
|
-
})) : h != null && (x(h) && (h.key != null && (T && T.key === h.key || m(h.key)), i = G(
|
|
621
|
-
h,
|
|
622
|
-
i + (h.key == null || T && T.key === h.key ? "" : ("" + h.key).replace(
|
|
623
|
-
Ie,
|
|
624
|
-
"$&/"
|
|
625
|
-
) + "/") + P
|
|
626
|
-
), c !== "" && T != null && x(T) && T.key == null && T._store && !T._store.validated && (i._store.validated = 2), h = i), r.push(h)), 1;
|
|
627
|
-
}
|
|
628
|
-
if (T = 0, P = c === "" ? "." : c + ":", Ae(e))
|
|
629
|
-
for (var C = 0; C < e.length; C++)
|
|
630
|
-
c = e[C], R = P + W(c, C), T += z(
|
|
631
|
-
c,
|
|
632
|
-
r,
|
|
633
|
-
i,
|
|
634
|
-
R,
|
|
635
|
-
h
|
|
636
|
-
);
|
|
637
|
-
else if (C = a(e), typeof C == "function")
|
|
638
|
-
for (C === e.entries && (je || console.warn(
|
|
639
|
-
"Using Maps as children is not supported. Use an array of keyed ReactElements instead."
|
|
640
|
-
), je = !0), e = C.call(e), C = 0; !(c = e.next()).done; )
|
|
641
|
-
c = c.value, R = P + W(c, C++), T += z(
|
|
642
|
-
c,
|
|
643
|
-
r,
|
|
644
|
-
i,
|
|
645
|
-
R,
|
|
646
|
-
h
|
|
647
|
-
);
|
|
648
|
-
else if (R === "object") {
|
|
649
|
-
if (typeof e.then == "function")
|
|
650
|
-
return z(
|
|
651
|
-
ue(e),
|
|
652
|
-
r,
|
|
653
|
-
i,
|
|
654
|
-
c,
|
|
655
|
-
h
|
|
656
|
-
);
|
|
657
|
-
throw r = String(e), Error(
|
|
658
|
-
"Objects are not valid as a React child (found: " + (r === "[object Object]" ? "object with keys {" + Object.keys(e).join(", ") + "}" : r) + "). If you meant to render a collection of children, use an array instead."
|
|
659
|
-
);
|
|
660
|
-
}
|
|
661
|
-
return T;
|
|
662
|
-
}
|
|
663
|
-
function te(e, r, i) {
|
|
664
|
-
if (e == null) return e;
|
|
665
|
-
var c = [], h = 0;
|
|
666
|
-
return z(e, c, "", "", function(R) {
|
|
667
|
-
return r.call(i, R, h++);
|
|
668
|
-
}), c;
|
|
669
|
-
}
|
|
670
|
-
function ie(e) {
|
|
671
|
-
if (e._status === -1) {
|
|
672
|
-
var r = e._ioInfo;
|
|
673
|
-
r != null && (r.start = r.end = performance.now()), r = e._result;
|
|
674
|
-
var i = r();
|
|
675
|
-
if (i.then(
|
|
676
|
-
function(h) {
|
|
677
|
-
if (e._status === 0 || e._status === -1) {
|
|
678
|
-
e._status = 1, e._result = h;
|
|
679
|
-
var R = e._ioInfo;
|
|
680
|
-
R != null && (R.end = performance.now()), i.status === void 0 && (i.status = "fulfilled", i.value = h);
|
|
681
|
-
}
|
|
682
|
-
},
|
|
683
|
-
function(h) {
|
|
684
|
-
if (e._status === 0 || e._status === -1) {
|
|
685
|
-
e._status = 2, e._result = h;
|
|
686
|
-
var R = e._ioInfo;
|
|
687
|
-
R != null && (R.end = performance.now()), i.status === void 0 && (i.status = "rejected", i.reason = h);
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
), r = e._ioInfo, r != null) {
|
|
691
|
-
r.value = i;
|
|
692
|
-
var c = i.displayName;
|
|
693
|
-
typeof c == "string" && (r.name = c);
|
|
694
|
-
}
|
|
695
|
-
e._status === -1 && (e._status = 0, e._result = i);
|
|
696
|
-
}
|
|
697
|
-
if (e._status === 1)
|
|
698
|
-
return r = e._result, r === void 0 && console.error(
|
|
699
|
-
`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
700
|
-
|
|
701
|
-
Your code should look like:
|
|
702
|
-
const MyComponent = lazy(() => import('./MyComponent'))
|
|
703
|
-
|
|
704
|
-
Did you accidentally put curly braces around the import?`,
|
|
705
|
-
r
|
|
706
|
-
), "default" in r || console.error(
|
|
707
|
-
`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
708
|
-
|
|
709
|
-
Your code should look like:
|
|
710
|
-
const MyComponent = lazy(() => import('./MyComponent'))`,
|
|
711
|
-
r
|
|
712
|
-
), r.default;
|
|
713
|
-
throw e._result;
|
|
714
|
-
}
|
|
715
|
-
function A() {
|
|
716
|
-
var e = w.H;
|
|
717
|
-
return e === null && console.error(
|
|
718
|
-
`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
719
|
-
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
720
|
-
2. You might be breaking the Rules of Hooks
|
|
721
|
-
3. You might have more than one copy of React in the same app
|
|
722
|
-
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`
|
|
723
|
-
), e;
|
|
724
|
-
}
|
|
725
|
-
function re() {
|
|
726
|
-
w.asyncTransitions--;
|
|
727
|
-
}
|
|
728
|
-
function V(e) {
|
|
729
|
-
if (ge === null)
|
|
730
|
-
try {
|
|
731
|
-
var r = ("require" + Math.random()).slice(0, 7);
|
|
732
|
-
ge = (v && v[r]).call(
|
|
733
|
-
v,
|
|
734
|
-
"timers"
|
|
735
|
-
).setImmediate;
|
|
736
|
-
} catch {
|
|
737
|
-
ge = function(c) {
|
|
738
|
-
Le === !1 && (Le = !0, typeof MessageChannel > "u" && console.error(
|
|
739
|
-
"This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."
|
|
740
|
-
));
|
|
741
|
-
var h = new MessageChannel();
|
|
742
|
-
h.port1.onmessage = c, h.port2.postMessage(void 0);
|
|
743
|
-
};
|
|
744
|
-
}
|
|
745
|
-
return ge(e);
|
|
746
|
-
}
|
|
747
|
-
function Q(e) {
|
|
748
|
-
return 1 < e.length && typeof AggregateError == "function" ? new AggregateError(e) : e[0];
|
|
749
|
-
}
|
|
750
|
-
function q(e, r) {
|
|
751
|
-
r !== ve - 1 && console.error(
|
|
752
|
-
"You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "
|
|
753
|
-
), ve = r;
|
|
754
|
-
}
|
|
755
|
-
function K(e, r, i) {
|
|
756
|
-
var c = w.actQueue;
|
|
757
|
-
if (c !== null)
|
|
758
|
-
if (c.length !== 0)
|
|
759
|
-
try {
|
|
760
|
-
ne(c), V(function() {
|
|
761
|
-
return K(e, r, i);
|
|
762
|
-
});
|
|
763
|
-
return;
|
|
764
|
-
} catch (h) {
|
|
765
|
-
w.thrownErrors.push(h);
|
|
766
|
-
}
|
|
767
|
-
else w.actQueue = null;
|
|
768
|
-
0 < w.thrownErrors.length ? (c = Q(w.thrownErrors), w.thrownErrors.length = 0, i(c)) : r(e);
|
|
769
|
-
}
|
|
770
|
-
function ne(e) {
|
|
771
|
-
if (!Te) {
|
|
772
|
-
Te = !0;
|
|
773
|
-
var r = 0;
|
|
774
|
-
try {
|
|
775
|
-
for (; r < e.length; r++) {
|
|
776
|
-
var i = e[r];
|
|
777
|
-
do {
|
|
778
|
-
w.didUsePromise = !1;
|
|
779
|
-
var c = i(!1);
|
|
780
|
-
if (c !== null) {
|
|
781
|
-
if (w.didUsePromise) {
|
|
782
|
-
e[r] = i, e.splice(0, r);
|
|
783
|
-
return;
|
|
784
|
-
}
|
|
785
|
-
i = c;
|
|
786
|
-
} else break;
|
|
787
|
-
} while (!0);
|
|
788
|
-
}
|
|
789
|
-
e.length = 0;
|
|
790
|
-
} catch (h) {
|
|
791
|
-
e.splice(0, r + 1), w.thrownErrors.push(h);
|
|
792
|
-
} finally {
|
|
793
|
-
Te = !1;
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
798
|
-
var Z = /* @__PURE__ */ Symbol.for("react.transitional.element"), ae = /* @__PURE__ */ Symbol.for("react.portal"), t = /* @__PURE__ */ Symbol.for("react.fragment"), o = /* @__PURE__ */ Symbol.for("react.strict_mode"), l = /* @__PURE__ */ Symbol.for("react.profiler"), f = /* @__PURE__ */ Symbol.for("react.consumer"), _ = /* @__PURE__ */ Symbol.for("react.context"), S = /* @__PURE__ */ Symbol.for("react.forward_ref"), p = /* @__PURE__ */ Symbol.for("react.suspense"), Y = /* @__PURE__ */ Symbol.for("react.suspense_list"), j = /* @__PURE__ */ Symbol.for("react.memo"), ee = /* @__PURE__ */ Symbol.for("react.lazy"), Re = /* @__PURE__ */ Symbol.for("react.activity"), Ce = Symbol.iterator, Se = {}, be = {
|
|
799
|
-
isMounted: function() {
|
|
800
|
-
return !1;
|
|
801
|
-
},
|
|
802
|
-
enqueueForceUpdate: function(e) {
|
|
803
|
-
u(e, "forceUpdate");
|
|
804
|
-
},
|
|
805
|
-
enqueueReplaceState: function(e) {
|
|
806
|
-
u(e, "replaceState");
|
|
807
|
-
},
|
|
808
|
-
enqueueSetState: function(e) {
|
|
809
|
-
u(e, "setState");
|
|
810
|
-
}
|
|
811
|
-
}, We = Object.assign, me = {};
|
|
812
|
-
Object.freeze(me), d.prototype.isReactComponent = {}, d.prototype.setState = function(e, r) {
|
|
813
|
-
if (typeof e != "object" && typeof e != "function" && e != null)
|
|
814
|
-
throw Error(
|
|
815
|
-
"takes an object of state variables to update or a function which returns an object of state variables."
|
|
816
|
-
);
|
|
817
|
-
this.updater.enqueueSetState(this, e, r, "setState");
|
|
818
|
-
}, d.prototype.forceUpdate = function(e) {
|
|
819
|
-
this.updater.enqueueForceUpdate(this, e, "forceUpdate");
|
|
820
|
-
};
|
|
821
|
-
var B = {
|
|
822
|
-
isMounted: [
|
|
823
|
-
"isMounted",
|
|
824
|
-
"Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."
|
|
825
|
-
],
|
|
826
|
-
replaceState: [
|
|
827
|
-
"replaceState",
|
|
828
|
-
"Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."
|
|
829
|
-
]
|
|
830
|
-
};
|
|
831
|
-
for (le in B)
|
|
832
|
-
B.hasOwnProperty(le) && s(le, B[le]);
|
|
833
|
-
y.prototype = d.prototype, B = b.prototype = new y(), B.constructor = b, We(B, d.prototype), B.isPureReactComponent = !0;
|
|
834
|
-
var Ae = Array.isArray, Qe = /* @__PURE__ */ Symbol.for("react.client.reference"), w = {
|
|
835
|
-
H: null,
|
|
836
|
-
A: null,
|
|
837
|
-
T: null,
|
|
838
|
-
S: null,
|
|
839
|
-
actQueue: null,
|
|
840
|
-
asyncTransitions: 0,
|
|
841
|
-
isBatchingLegacy: !1,
|
|
842
|
-
didScheduleLegacyUpdate: !1,
|
|
843
|
-
didUsePromise: !1,
|
|
844
|
-
thrownErrors: [],
|
|
845
|
-
getCurrentStack: null,
|
|
846
|
-
recentlyCreatedOwnerStacks: 0
|
|
847
|
-
}, pe = Object.prototype.hasOwnProperty, Pe = console.createTask ? console.createTask : function() {
|
|
848
|
-
return null;
|
|
849
|
-
};
|
|
850
|
-
B = {
|
|
851
|
-
react_stack_bottom_frame: function(e) {
|
|
852
|
-
return e();
|
|
853
|
-
}
|
|
854
|
-
};
|
|
855
|
-
var Oe, Me, Ne = {}, Ke = B.react_stack_bottom_frame.bind(
|
|
856
|
-
B,
|
|
857
|
-
U
|
|
858
|
-
)(), Xe = Pe(L(U)), je = !1, Ie = /\/+/g, Ue = typeof reportError == "function" ? reportError : function(e) {
|
|
859
|
-
if (typeof window == "object" && typeof window.ErrorEvent == "function") {
|
|
860
|
-
var r = new window.ErrorEvent("error", {
|
|
861
|
-
bubbles: !0,
|
|
862
|
-
cancelable: !0,
|
|
863
|
-
message: typeof e == "object" && e !== null && typeof e.message == "string" ? String(e.message) : String(e),
|
|
864
|
-
error: e
|
|
865
|
-
});
|
|
866
|
-
if (!window.dispatchEvent(r)) return;
|
|
867
|
-
} else if (typeof process == "object" && typeof process.emit == "function") {
|
|
868
|
-
process.emit("uncaughtException", e);
|
|
869
|
-
return;
|
|
870
|
-
}
|
|
871
|
-
console.error(e);
|
|
872
|
-
}, Le = !1, ge = null, ve = 0, ye = !1, Te = !1, De = typeof queueMicrotask == "function" ? function(e) {
|
|
873
|
-
queueMicrotask(function() {
|
|
874
|
-
return queueMicrotask(e);
|
|
875
|
-
});
|
|
876
|
-
} : V;
|
|
877
|
-
B = Object.freeze({
|
|
878
|
-
__proto__: null,
|
|
879
|
-
c: function(e) {
|
|
880
|
-
return A().useMemoCache(e);
|
|
881
|
-
}
|
|
882
|
-
});
|
|
883
|
-
var le = {
|
|
884
|
-
map: te,
|
|
885
|
-
forEach: function(e, r, i) {
|
|
886
|
-
te(
|
|
887
|
-
e,
|
|
888
|
-
function() {
|
|
889
|
-
r.apply(this, arguments);
|
|
890
|
-
},
|
|
891
|
-
i
|
|
892
|
-
);
|
|
893
|
-
},
|
|
894
|
-
count: function(e) {
|
|
895
|
-
var r = 0;
|
|
896
|
-
return te(e, function() {
|
|
897
|
-
r++;
|
|
898
|
-
}), r;
|
|
899
|
-
},
|
|
900
|
-
toArray: function(e) {
|
|
901
|
-
return te(e, function(r) {
|
|
902
|
-
return r;
|
|
903
|
-
}) || [];
|
|
904
|
-
},
|
|
905
|
-
only: function(e) {
|
|
906
|
-
if (!x(e))
|
|
907
|
-
throw Error(
|
|
908
|
-
"React.Children.only expected to receive a single React element child."
|
|
909
|
-
);
|
|
910
|
-
return e;
|
|
911
|
-
}
|
|
912
|
-
};
|
|
913
|
-
n.Activity = Re, n.Children = le, n.Component = d, n.Fragment = t, n.Profiler = l, n.PureComponent = b, n.StrictMode = o, n.Suspense = p, n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = w, n.__COMPILER_RUNTIME = B, n.act = function(e) {
|
|
914
|
-
var r = w.actQueue, i = ve;
|
|
915
|
-
ve++;
|
|
916
|
-
var c = w.actQueue = r !== null ? r : [], h = !1;
|
|
917
|
-
try {
|
|
918
|
-
var R = e();
|
|
919
|
-
} catch (C) {
|
|
920
|
-
w.thrownErrors.push(C);
|
|
921
|
-
}
|
|
922
|
-
if (0 < w.thrownErrors.length)
|
|
923
|
-
throw q(r, i), e = Q(w.thrownErrors), w.thrownErrors.length = 0, e;
|
|
924
|
-
if (R !== null && typeof R == "object" && typeof R.then == "function") {
|
|
925
|
-
var T = R;
|
|
926
|
-
return De(function() {
|
|
927
|
-
h || ye || (ye = !0, console.error(
|
|
928
|
-
"You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"
|
|
929
|
-
));
|
|
930
|
-
}), {
|
|
931
|
-
then: function(C, oe) {
|
|
932
|
-
h = !0, T.then(
|
|
933
|
-
function(ce) {
|
|
934
|
-
if (q(r, i), i === 0) {
|
|
935
|
-
try {
|
|
936
|
-
ne(c), V(function() {
|
|
937
|
-
return K(
|
|
938
|
-
ce,
|
|
939
|
-
C,
|
|
940
|
-
oe
|
|
941
|
-
);
|
|
942
|
-
});
|
|
943
|
-
} catch (Je) {
|
|
944
|
-
w.thrownErrors.push(Je);
|
|
945
|
-
}
|
|
946
|
-
if (0 < w.thrownErrors.length) {
|
|
947
|
-
var Ve = Q(
|
|
948
|
-
w.thrownErrors
|
|
949
|
-
);
|
|
950
|
-
w.thrownErrors.length = 0, oe(Ve);
|
|
951
|
-
}
|
|
952
|
-
} else C(ce);
|
|
953
|
-
},
|
|
954
|
-
function(ce) {
|
|
955
|
-
q(r, i), 0 < w.thrownErrors.length && (ce = Q(
|
|
956
|
-
w.thrownErrors
|
|
957
|
-
), w.thrownErrors.length = 0), oe(ce);
|
|
958
|
-
}
|
|
959
|
-
);
|
|
960
|
-
}
|
|
961
|
-
};
|
|
962
|
-
}
|
|
963
|
-
var P = R;
|
|
964
|
-
if (q(r, i), i === 0 && (ne(c), c.length !== 0 && De(function() {
|
|
965
|
-
h || ye || (ye = !0, console.error(
|
|
966
|
-
"A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"
|
|
967
|
-
));
|
|
968
|
-
}), w.actQueue = null), 0 < w.thrownErrors.length)
|
|
969
|
-
throw e = Q(w.thrownErrors), w.thrownErrors.length = 0, e;
|
|
970
|
-
return {
|
|
971
|
-
then: function(C, oe) {
|
|
972
|
-
h = !0, i === 0 ? (w.actQueue = c, V(function() {
|
|
973
|
-
return K(
|
|
974
|
-
P,
|
|
975
|
-
C,
|
|
976
|
-
oe
|
|
977
|
-
);
|
|
978
|
-
})) : C(P);
|
|
979
|
-
}
|
|
980
|
-
};
|
|
981
|
-
}, n.cache = function(e) {
|
|
982
|
-
return function() {
|
|
983
|
-
return e.apply(null, arguments);
|
|
984
|
-
};
|
|
985
|
-
}, n.cacheSignal = function() {
|
|
986
|
-
return null;
|
|
987
|
-
}, n.captureOwnerStack = function() {
|
|
988
|
-
var e = w.getCurrentStack;
|
|
989
|
-
return e === null ? null : e();
|
|
990
|
-
}, n.cloneElement = function(e, r, i) {
|
|
991
|
-
if (e == null)
|
|
992
|
-
throw Error(
|
|
993
|
-
"The argument must be a React element, but you passed " + e + "."
|
|
994
|
-
);
|
|
995
|
-
var c = We({}, e.props), h = e.key, R = e._owner;
|
|
996
|
-
if (r != null) {
|
|
997
|
-
var T;
|
|
998
|
-
e: {
|
|
999
|
-
if (pe.call(r, "ref") && (T = Object.getOwnPropertyDescriptor(
|
|
1000
|
-
r,
|
|
1001
|
-
"ref"
|
|
1002
|
-
).get) && T.isReactWarning) {
|
|
1003
|
-
T = !1;
|
|
1004
|
-
break e;
|
|
1005
|
-
}
|
|
1006
|
-
T = r.ref !== void 0;
|
|
1007
|
-
}
|
|
1008
|
-
T && (R = $()), D(r) && (m(r.key), h = "" + r.key);
|
|
1009
|
-
for (P in r)
|
|
1010
|
-
!pe.call(r, P) || P === "key" || P === "__self" || P === "__source" || P === "ref" && r.ref === void 0 || (c[P] = r[P]);
|
|
1011
|
-
}
|
|
1012
|
-
var P = arguments.length - 2;
|
|
1013
|
-
if (P === 1) c.children = i;
|
|
1014
|
-
else if (1 < P) {
|
|
1015
|
-
T = Array(P);
|
|
1016
|
-
for (var C = 0; C < P; C++)
|
|
1017
|
-
T[C] = arguments[C + 2];
|
|
1018
|
-
c.children = T;
|
|
1019
|
-
}
|
|
1020
|
-
for (c = N(
|
|
1021
|
-
e.type,
|
|
1022
|
-
h,
|
|
1023
|
-
c,
|
|
1024
|
-
R,
|
|
1025
|
-
e._debugStack,
|
|
1026
|
-
e._debugTask
|
|
1027
|
-
), h = 2; h < arguments.length; h++)
|
|
1028
|
-
X(arguments[h]);
|
|
1029
|
-
return c;
|
|
1030
|
-
}, n.createContext = function(e) {
|
|
1031
|
-
return e = {
|
|
1032
|
-
$$typeof: _,
|
|
1033
|
-
_currentValue: e,
|
|
1034
|
-
_currentValue2: e,
|
|
1035
|
-
_threadCount: 0,
|
|
1036
|
-
Provider: null,
|
|
1037
|
-
Consumer: null
|
|
1038
|
-
}, e.Provider = e, e.Consumer = {
|
|
1039
|
-
$$typeof: f,
|
|
1040
|
-
_context: e
|
|
1041
|
-
}, e._currentRenderer = null, e._currentRenderer2 = null, e;
|
|
1042
|
-
}, n.createElement = function(e, r, i) {
|
|
1043
|
-
for (var c = 2; c < arguments.length; c++)
|
|
1044
|
-
X(arguments[c]);
|
|
1045
|
-
c = {};
|
|
1046
|
-
var h = null;
|
|
1047
|
-
if (r != null)
|
|
1048
|
-
for (C in Me || !("__self" in r) || "key" in r || (Me = !0, console.warn(
|
|
1049
|
-
"Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform"
|
|
1050
|
-
)), D(r) && (m(r.key), h = "" + r.key), r)
|
|
1051
|
-
pe.call(r, C) && C !== "key" && C !== "__self" && C !== "__source" && (c[C] = r[C]);
|
|
1052
|
-
var R = arguments.length - 2;
|
|
1053
|
-
if (R === 1) c.children = i;
|
|
1054
|
-
else if (1 < R) {
|
|
1055
|
-
for (var T = Array(R), P = 0; P < R; P++)
|
|
1056
|
-
T[P] = arguments[P + 2];
|
|
1057
|
-
Object.freeze && Object.freeze(T), c.children = T;
|
|
1058
|
-
}
|
|
1059
|
-
if (e && e.defaultProps)
|
|
1060
|
-
for (C in R = e.defaultProps, R)
|
|
1061
|
-
c[C] === void 0 && (c[C] = R[C]);
|
|
1062
|
-
h && F(
|
|
1063
|
-
c,
|
|
1064
|
-
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
1065
|
-
);
|
|
1066
|
-
var C = 1e4 > w.recentlyCreatedOwnerStacks++;
|
|
1067
|
-
return N(
|
|
1068
|
-
e,
|
|
1069
|
-
h,
|
|
1070
|
-
c,
|
|
1071
|
-
$(),
|
|
1072
|
-
C ? Error("react-stack-top-frame") : Ke,
|
|
1073
|
-
C ? Pe(L(e)) : Xe
|
|
1074
|
-
);
|
|
1075
|
-
}, n.createRef = function() {
|
|
1076
|
-
var e = { current: null };
|
|
1077
|
-
return Object.seal(e), e;
|
|
1078
|
-
}, n.forwardRef = function(e) {
|
|
1079
|
-
e != null && e.$$typeof === j ? console.error(
|
|
1080
|
-
"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."
|
|
1081
|
-
) : typeof e != "function" ? console.error(
|
|
1082
|
-
"forwardRef requires a render function but was given %s.",
|
|
1083
|
-
e === null ? "null" : typeof e
|
|
1084
|
-
) : e.length !== 0 && e.length !== 2 && console.error(
|
|
1085
|
-
"forwardRef render functions accept exactly two parameters: props and ref. %s",
|
|
1086
|
-
e.length === 1 ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined."
|
|
1087
|
-
), e != null && e.defaultProps != null && console.error(
|
|
1088
|
-
"forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?"
|
|
1089
|
-
);
|
|
1090
|
-
var r = { $$typeof: S, render: e }, i;
|
|
1091
|
-
return Object.defineProperty(r, "displayName", {
|
|
1092
|
-
enumerable: !1,
|
|
1093
|
-
configurable: !0,
|
|
1094
|
-
get: function() {
|
|
1095
|
-
return i;
|
|
1096
|
-
},
|
|
1097
|
-
set: function(c) {
|
|
1098
|
-
i = c, e.name || e.displayName || (Object.defineProperty(e, "name", { value: c }), e.displayName = c);
|
|
1099
|
-
}
|
|
1100
|
-
}), r;
|
|
1101
|
-
}, n.isValidElement = x, n.lazy = function(e) {
|
|
1102
|
-
e = { _status: -1, _result: e };
|
|
1103
|
-
var r = {
|
|
1104
|
-
$$typeof: ee,
|
|
1105
|
-
_payload: e,
|
|
1106
|
-
_init: ie
|
|
1107
|
-
}, i = {
|
|
1108
|
-
name: "lazy",
|
|
1109
|
-
start: -1,
|
|
1110
|
-
end: -1,
|
|
1111
|
-
value: null,
|
|
1112
|
-
owner: null,
|
|
1113
|
-
debugStack: Error("react-stack-top-frame"),
|
|
1114
|
-
debugTask: console.createTask ? console.createTask("lazy()") : null
|
|
1115
|
-
};
|
|
1116
|
-
return e._ioInfo = i, r._debugInfo = [{ awaited: i }], r;
|
|
1117
|
-
}, n.memo = function(e, r) {
|
|
1118
|
-
e == null && console.error(
|
|
1119
|
-
"memo: The first argument must be a component. Instead received: %s",
|
|
1120
|
-
e === null ? "null" : typeof e
|
|
1121
|
-
), r = {
|
|
1122
|
-
$$typeof: j,
|
|
1123
|
-
type: e,
|
|
1124
|
-
compare: r === void 0 ? null : r
|
|
1125
|
-
};
|
|
1126
|
-
var i;
|
|
1127
|
-
return Object.defineProperty(r, "displayName", {
|
|
1128
|
-
enumerable: !1,
|
|
1129
|
-
configurable: !0,
|
|
1130
|
-
get: function() {
|
|
1131
|
-
return i;
|
|
1132
|
-
},
|
|
1133
|
-
set: function(c) {
|
|
1134
|
-
i = c, e.name || e.displayName || (Object.defineProperty(e, "name", { value: c }), e.displayName = c);
|
|
1135
|
-
}
|
|
1136
|
-
}), r;
|
|
1137
|
-
}, n.startTransition = function(e) {
|
|
1138
|
-
var r = w.T, i = {};
|
|
1139
|
-
i._updatedFibers = /* @__PURE__ */ new Set(), w.T = i;
|
|
1140
|
-
try {
|
|
1141
|
-
var c = e(), h = w.S;
|
|
1142
|
-
h !== null && h(i, c), typeof c == "object" && c !== null && typeof c.then == "function" && (w.asyncTransitions++, c.then(re, re), c.then(O, Ue));
|
|
1143
|
-
} catch (R) {
|
|
1144
|
-
Ue(R);
|
|
1145
|
-
} finally {
|
|
1146
|
-
r === null && i._updatedFibers && (e = i._updatedFibers.size, i._updatedFibers.clear(), 10 < e && console.warn(
|
|
1147
|
-
"Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."
|
|
1148
|
-
)), r !== null && i.types !== null && (r.types !== null && r.types !== i.types && console.error(
|
|
1149
|
-
"We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."
|
|
1150
|
-
), r.types = i.types), w.T = r;
|
|
1151
|
-
}
|
|
1152
|
-
}, n.unstable_useCacheRefresh = function() {
|
|
1153
|
-
return A().useCacheRefresh();
|
|
1154
|
-
}, n.use = function(e) {
|
|
1155
|
-
return A().use(e);
|
|
1156
|
-
}, n.useActionState = function(e, r, i) {
|
|
1157
|
-
return A().useActionState(
|
|
1158
|
-
e,
|
|
1159
|
-
r,
|
|
1160
|
-
i
|
|
1161
|
-
);
|
|
1162
|
-
}, n.useCallback = function(e, r) {
|
|
1163
|
-
return A().useCallback(e, r);
|
|
1164
|
-
}, n.useContext = function(e) {
|
|
1165
|
-
var r = A();
|
|
1166
|
-
return e.$$typeof === f && console.error(
|
|
1167
|
-
"Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"
|
|
1168
|
-
), r.useContext(e);
|
|
1169
|
-
}, n.useDebugValue = function(e, r) {
|
|
1170
|
-
return A().useDebugValue(e, r);
|
|
1171
|
-
}, n.useDeferredValue = function(e, r) {
|
|
1172
|
-
return A().useDeferredValue(e, r);
|
|
1173
|
-
}, n.useEffect = function(e, r) {
|
|
1174
|
-
return e == null && console.warn(
|
|
1175
|
-
"React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"
|
|
1176
|
-
), A().useEffect(e, r);
|
|
1177
|
-
}, n.useEffectEvent = function(e) {
|
|
1178
|
-
return A().useEffectEvent(e);
|
|
1179
|
-
}, n.useId = function() {
|
|
1180
|
-
return A().useId();
|
|
1181
|
-
}, n.useImperativeHandle = function(e, r, i) {
|
|
1182
|
-
return A().useImperativeHandle(e, r, i);
|
|
1183
|
-
}, n.useInsertionEffect = function(e, r) {
|
|
1184
|
-
return e == null && console.warn(
|
|
1185
|
-
"React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"
|
|
1186
|
-
), A().useInsertionEffect(e, r);
|
|
1187
|
-
}, n.useLayoutEffect = function(e, r) {
|
|
1188
|
-
return e == null && console.warn(
|
|
1189
|
-
"React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"
|
|
1190
|
-
), A().useLayoutEffect(e, r);
|
|
1191
|
-
}, n.useMemo = function(e, r) {
|
|
1192
|
-
return A().useMemo(e, r);
|
|
1193
|
-
}, n.useOptimistic = function(e, r) {
|
|
1194
|
-
return A().useOptimistic(e, r);
|
|
1195
|
-
}, n.useReducer = function(e, r, i) {
|
|
1196
|
-
return A().useReducer(e, r, i);
|
|
1197
|
-
}, n.useRef = function(e) {
|
|
1198
|
-
return A().useRef(e);
|
|
1199
|
-
}, n.useState = function(e) {
|
|
1200
|
-
return A().useState(e);
|
|
1201
|
-
}, n.useSyncExternalStore = function(e, r, i) {
|
|
1202
|
-
return A().useSyncExternalStore(
|
|
1203
|
-
e,
|
|
1204
|
-
r,
|
|
1205
|
-
i
|
|
1206
|
-
);
|
|
1207
|
-
}, n.useTransition = function() {
|
|
1208
|
-
return A().useTransition();
|
|
1209
|
-
}, n.version = "19.2.3", typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
1210
|
-
})();
|
|
1211
|
-
})(he, he.exports)), he.exports;
|
|
1212
|
-
}
|
|
1213
|
-
var xe;
|
|
1214
|
-
function Ge() {
|
|
1215
|
-
return xe || (xe = 1, process.env.NODE_ENV === "production" ? ke.exports = Ze() : ke.exports = et()), ke.exports;
|
|
1216
|
-
}
|
|
1217
|
-
var M = Ge();
|
|
1218
|
-
const tt = typeof process < "u" && process.env?.NODE_ENV === "production", ze = typeof process < "u" && process.env?.MCP_DEBUG, _e = ze === "true" || !tt && ze !== "false", E = {
|
|
1219
|
-
log: (...v) => {
|
|
1220
|
-
_e && console.log(...v);
|
|
1
|
+
import { useState as R, useRef as v, useEffect as w, useCallback as C, createContext as x, useContext as U } from "react";
|
|
2
|
+
import { jsx as z } from "react/jsx-runtime";
|
|
3
|
+
const N = typeof process < "u" && process.env?.NODE_ENV === "production", I = typeof process < "u" && process.env?.MCP_DEBUG, m = I === "true" || !N && I !== "false", i = {
|
|
4
|
+
log: (...c) => {
|
|
5
|
+
m && console.log(...c);
|
|
1221
6
|
},
|
|
1222
|
-
debug: (...
|
|
1223
|
-
|
|
7
|
+
debug: (...c) => {
|
|
8
|
+
m && console.debug(...c);
|
|
1224
9
|
},
|
|
1225
|
-
info: (...
|
|
1226
|
-
console.info(...
|
|
10
|
+
info: (...c) => {
|
|
11
|
+
console.info(...c);
|
|
1227
12
|
},
|
|
1228
|
-
error: (...
|
|
1229
|
-
console.error(...
|
|
13
|
+
error: (...c) => {
|
|
14
|
+
console.error(...c);
|
|
1230
15
|
},
|
|
1231
|
-
warn: (...
|
|
1232
|
-
|
|
16
|
+
warn: (...c) => {
|
|
17
|
+
m && console.warn(...c);
|
|
1233
18
|
}
|
|
1234
19
|
};
|
|
1235
|
-
class
|
|
20
|
+
class _ {
|
|
1236
21
|
// Configurable worker script URLs (defaults kept for backward compatibility)
|
|
1237
22
|
sharedWorkerUrl = "/mcp-shared-worker.js";
|
|
1238
23
|
serviceWorkerUrl = "/mcp-service-worker.js";
|
|
@@ -1260,35 +45,35 @@ class rt {
|
|
|
1260
45
|
toolChangeListeners = /* @__PURE__ */ new Map();
|
|
1261
46
|
// Initialize and choose worker implementation (prefer SharedWorker)
|
|
1262
47
|
// Accept either a ServiceWorkerRegistration OR WorkerInitOptions to configure URLs
|
|
1263
|
-
async init(
|
|
1264
|
-
|
|
1265
|
-
hasOptions: !!
|
|
48
|
+
async init(e) {
|
|
49
|
+
i.log("[WorkerClient] init() called", {
|
|
50
|
+
hasOptions: !!e,
|
|
1266
51
|
currentWorkerType: this.workerType,
|
|
1267
52
|
initInProgress: !!this.initPromise,
|
|
1268
53
|
timestamp: Date.now()
|
|
1269
54
|
});
|
|
1270
|
-
let
|
|
1271
|
-
const
|
|
1272
|
-
if (
|
|
1273
|
-
|
|
1274
|
-
else if (
|
|
1275
|
-
const
|
|
1276
|
-
|
|
55
|
+
let r;
|
|
56
|
+
const t = e;
|
|
57
|
+
if (t && typeof t.scope == "string")
|
|
58
|
+
r = e, i.log("[WorkerClient] Using explicit ServiceWorker registration");
|
|
59
|
+
else if (e) {
|
|
60
|
+
const o = e;
|
|
61
|
+
i.log("[WorkerClient] Using WorkerClientInitOptions:", o), o.sharedWorkerUrl && (this.sharedWorkerUrl = o.sharedWorkerUrl), o.serviceWorkerUrl && (this.serviceWorkerUrl = o.serviceWorkerUrl), o.backendWsUrl && (this.backendWsUrl = o.backendWsUrl);
|
|
1277
62
|
}
|
|
1278
63
|
return this.initPromise ? this.initPromise.then(async () => {
|
|
1279
|
-
|
|
64
|
+
r && this.workerType !== "service" && await this.init(r);
|
|
1280
65
|
}) : (this.initPromise = (async () => {
|
|
1281
66
|
try {
|
|
1282
|
-
if (
|
|
1283
|
-
this.serviceWorkerRegistration =
|
|
67
|
+
if (r) {
|
|
68
|
+
this.serviceWorkerRegistration = r, this.workerType = "service", i.info(
|
|
1284
69
|
"[WorkerClient] Using ServiceWorker (explicit registration)"
|
|
1285
70
|
);
|
|
1286
71
|
try {
|
|
1287
|
-
const
|
|
72
|
+
const s = {
|
|
1288
73
|
type: "INIT",
|
|
1289
74
|
backendUrl: this.backendWsUrl
|
|
1290
75
|
};
|
|
1291
|
-
this.pendingAuthToken && (
|
|
76
|
+
this.pendingAuthToken && (s.token = this.pendingAuthToken), this.serviceWorkerRegistration.active ? this.serviceWorkerRegistration.active.postMessage(s) : "serviceWorker" in navigator && navigator.serviceWorker.controller && navigator.serviceWorker.controller.postMessage(s);
|
|
1292
77
|
} catch {
|
|
1293
78
|
}
|
|
1294
79
|
return;
|
|
@@ -1308,21 +93,21 @@ class rt {
|
|
|
1308
93
|
* @private
|
|
1309
94
|
*/
|
|
1310
95
|
markAsInitialized() {
|
|
1311
|
-
this.isInitialized = !0,
|
|
96
|
+
this.isInitialized = !0, i.log(
|
|
1312
97
|
"[WorkerClient] Worker initialized, processing pending operations"
|
|
1313
|
-
), this.initResolvers.forEach((
|
|
1314
|
-
const
|
|
1315
|
-
this.pendingRegistrations = [],
|
|
1316
|
-
async ({ name:
|
|
98
|
+
), this.initResolvers.forEach((r) => r()), this.initResolvers = [];
|
|
99
|
+
const e = [...this.pendingRegistrations];
|
|
100
|
+
this.pendingRegistrations = [], e.forEach(
|
|
101
|
+
async ({ name: r, description: t, inputSchema: o, handler: s, resolve: a, reject: h }) => {
|
|
1317
102
|
try {
|
|
1318
103
|
await this.registerToolInternal(
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
),
|
|
1324
|
-
} catch (
|
|
1325
|
-
|
|
104
|
+
r,
|
|
105
|
+
t,
|
|
106
|
+
o,
|
|
107
|
+
s
|
|
108
|
+
), a();
|
|
109
|
+
} catch (u) {
|
|
110
|
+
h(u instanceof Error ? u : new Error(String(u)));
|
|
1326
111
|
}
|
|
1327
112
|
}
|
|
1328
113
|
);
|
|
@@ -1338,8 +123,8 @@ class rt {
|
|
|
1338
123
|
await this.initPromise;
|
|
1339
124
|
return;
|
|
1340
125
|
}
|
|
1341
|
-
return new Promise((
|
|
1342
|
-
this.initResolvers.push(
|
|
126
|
+
return new Promise((e) => {
|
|
127
|
+
this.initResolvers.push(e);
|
|
1343
128
|
});
|
|
1344
129
|
}
|
|
1345
130
|
/**
|
|
@@ -1354,54 +139,54 @@ class rt {
|
|
|
1354
139
|
try {
|
|
1355
140
|
this.sharedWorker = new SharedWorker(this.sharedWorkerUrl, {
|
|
1356
141
|
type: "module"
|
|
1357
|
-
}), this.sharedWorkerPort = this.sharedWorker.port, this.sharedWorkerPort.start(), await new Promise((
|
|
1358
|
-
let
|
|
1359
|
-
const
|
|
1360
|
-
if (!
|
|
1361
|
-
const
|
|
1362
|
-
|
|
142
|
+
}), this.sharedWorkerPort = this.sharedWorker.port, this.sharedWorkerPort.start(), await new Promise((r, t) => {
|
|
143
|
+
let o = !1;
|
|
144
|
+
const s = setTimeout(() => {
|
|
145
|
+
if (!o) {
|
|
146
|
+
const h = this.sharedWorkerPort;
|
|
147
|
+
h && (h.onmessage = null), t(new Error("SharedWorker initialization timeout"));
|
|
1363
148
|
}
|
|
1364
|
-
}, 2e3),
|
|
1365
|
-
if (!
|
|
1366
|
-
return clearTimeout(
|
|
1367
|
-
|
|
149
|
+
}, 2e3), a = this.sharedWorkerPort;
|
|
150
|
+
if (!a)
|
|
151
|
+
return clearTimeout(s), t(new Error("SharedWorker port not available"));
|
|
152
|
+
a.onmessage = (h) => {
|
|
1368
153
|
try {
|
|
1369
|
-
const
|
|
1370
|
-
|
|
154
|
+
const u = h.data;
|
|
155
|
+
u && u.type === "CONNECTION_STATUS" && (clearTimeout(s), o = !0, this.workerType = "shared", a.onmessage = null, r(!0));
|
|
1371
156
|
} catch {
|
|
1372
157
|
}
|
|
1373
158
|
};
|
|
1374
159
|
});
|
|
1375
|
-
const
|
|
1376
|
-
if (
|
|
160
|
+
const e = this.sharedWorkerPort;
|
|
161
|
+
if (e) {
|
|
1377
162
|
try {
|
|
1378
|
-
const
|
|
163
|
+
const r = {
|
|
1379
164
|
type: "INIT",
|
|
1380
165
|
backendUrl: this.backendWsUrl
|
|
1381
166
|
};
|
|
1382
|
-
this.pendingAuthToken && (
|
|
1383
|
-
} catch (
|
|
1384
|
-
|
|
167
|
+
this.pendingAuthToken && (r.token = this.pendingAuthToken), e.postMessage(r), this.pendingAuthToken = null;
|
|
168
|
+
} catch (r) {
|
|
169
|
+
i.warn(
|
|
1385
170
|
"[WorkerClient] Failed to send INIT to SharedWorker port:",
|
|
1386
|
-
|
|
171
|
+
r
|
|
1387
172
|
);
|
|
1388
173
|
}
|
|
1389
|
-
|
|
174
|
+
e.onmessage = (r) => {
|
|
1390
175
|
try {
|
|
1391
|
-
const
|
|
1392
|
-
if (
|
|
1393
|
-
const
|
|
1394
|
-
this.connectionStatusCallbacks.forEach((
|
|
176
|
+
const t = r.data;
|
|
177
|
+
if (t && t.type === "CONNECTION_STATUS") {
|
|
178
|
+
const o = !!t.connected;
|
|
179
|
+
this.connectionStatusCallbacks.forEach((s) => {
|
|
1395
180
|
try {
|
|
1396
|
-
|
|
181
|
+
s(o);
|
|
1397
182
|
} catch {
|
|
1398
183
|
}
|
|
1399
184
|
});
|
|
1400
|
-
} else
|
|
1401
|
-
(
|
|
1402
|
-
|
|
185
|
+
} else t && t.type === "CALL_TOOL" && this.handleToolCall(t.toolName, t.args, t.callId).catch(
|
|
186
|
+
(o) => {
|
|
187
|
+
i.error(
|
|
1403
188
|
"[WorkerClient] Failed to handle tool call:",
|
|
1404
|
-
|
|
189
|
+
o
|
|
1405
190
|
);
|
|
1406
191
|
}
|
|
1407
192
|
);
|
|
@@ -1409,20 +194,20 @@ class rt {
|
|
|
1409
194
|
}
|
|
1410
195
|
};
|
|
1411
196
|
}
|
|
1412
|
-
return
|
|
1413
|
-
} catch (
|
|
1414
|
-
return
|
|
197
|
+
return i.info("[WorkerClient] Using SharedWorker"), !0;
|
|
198
|
+
} catch (e) {
|
|
199
|
+
return i.warn(
|
|
1415
200
|
"[WorkerClient] SharedWorker not available, falling back to ServiceWorker:",
|
|
1416
|
-
|
|
201
|
+
e
|
|
1417
202
|
), !1;
|
|
1418
203
|
}
|
|
1419
204
|
}
|
|
1420
205
|
async initServiceWorkerFallback() {
|
|
1421
206
|
if ("serviceWorker" in navigator)
|
|
1422
207
|
try {
|
|
1423
|
-
const
|
|
1424
|
-
if (
|
|
1425
|
-
this.serviceWorkerRegistration =
|
|
208
|
+
const e = await navigator.serviceWorker.getRegistration();
|
|
209
|
+
if (e) {
|
|
210
|
+
this.serviceWorkerRegistration = e, this.workerType = "service", i.info(
|
|
1426
211
|
"[WorkerClient] Using existing ServiceWorker registration"
|
|
1427
212
|
);
|
|
1428
213
|
return;
|
|
@@ -1431,160 +216,160 @@ class rt {
|
|
|
1431
216
|
this.serviceWorkerUrl
|
|
1432
217
|
), this.workerType = "service", "serviceWorker" in navigator && navigator.serviceWorker.addEventListener(
|
|
1433
218
|
"message",
|
|
1434
|
-
(
|
|
219
|
+
(r) => {
|
|
1435
220
|
try {
|
|
1436
|
-
const
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
).catch((
|
|
1442
|
-
|
|
221
|
+
const t = r.data;
|
|
222
|
+
t && t.type === "CALL_TOOL" && this.handleToolCall(
|
|
223
|
+
t.toolName,
|
|
224
|
+
t.args,
|
|
225
|
+
t.callId
|
|
226
|
+
).catch((o) => {
|
|
227
|
+
i.error(
|
|
1443
228
|
"[WorkerClient] Failed to handle tool call:",
|
|
1444
|
-
|
|
229
|
+
o
|
|
1445
230
|
);
|
|
1446
231
|
});
|
|
1447
|
-
} catch (
|
|
1448
|
-
|
|
232
|
+
} catch (t) {
|
|
233
|
+
i.error(
|
|
1449
234
|
"[WorkerClient] Error processing ServiceWorker message:",
|
|
1450
|
-
|
|
235
|
+
t
|
|
1451
236
|
);
|
|
1452
237
|
}
|
|
1453
238
|
}
|
|
1454
|
-
),
|
|
239
|
+
), i.info("[WorkerClient] Using MCP ServiceWorker (fallback)");
|
|
1455
240
|
try {
|
|
1456
|
-
const
|
|
241
|
+
const r = {
|
|
1457
242
|
type: "INIT",
|
|
1458
243
|
backendUrl: this.backendWsUrl
|
|
1459
244
|
};
|
|
1460
|
-
this.pendingAuthToken && (
|
|
245
|
+
this.pendingAuthToken && (r.token = this.pendingAuthToken), this.serviceWorkerRegistration.active ? this.serviceWorkerRegistration.active.postMessage(r) : "serviceWorker" in navigator && navigator.serviceWorker.controller && navigator.serviceWorker.controller.postMessage(r), this.pendingAuthToken = null;
|
|
1461
246
|
} catch {
|
|
1462
247
|
}
|
|
1463
|
-
} catch (
|
|
1464
|
-
throw
|
|
248
|
+
} catch (e) {
|
|
249
|
+
throw i.error("[WorkerClient] Failed to register ServiceWorker:", e), e;
|
|
1465
250
|
}
|
|
1466
251
|
else
|
|
1467
252
|
throw new Error("Neither SharedWorker nor ServiceWorker is supported");
|
|
1468
253
|
}
|
|
1469
254
|
// Low-level request that expects a reply via MessageChannel
|
|
1470
|
-
async request(
|
|
1471
|
-
if (
|
|
1472
|
-
type:
|
|
1473
|
-
payload:
|
|
1474
|
-
timeoutMs:
|
|
255
|
+
async request(e, r, t = 5e3) {
|
|
256
|
+
if (i.log("[WorkerClient] Request started:", {
|
|
257
|
+
type: e,
|
|
258
|
+
payload: r,
|
|
259
|
+
timeoutMs: t,
|
|
1475
260
|
workerType: this.workerType,
|
|
1476
261
|
hasSharedWorkerPort: !!this.sharedWorkerPort,
|
|
1477
262
|
hasServiceWorkerReg: !!this.serviceWorkerRegistration
|
|
1478
263
|
}), this.workerType === "shared" && this.sharedWorkerPort)
|
|
1479
|
-
return new Promise((
|
|
1480
|
-
const
|
|
1481
|
-
const
|
|
1482
|
-
|
|
1483
|
-
type:
|
|
1484
|
-
requestId:
|
|
1485
|
-
elapsed:
|
|
1486
|
-
timeoutMs:
|
|
1487
|
-
}),
|
|
1488
|
-
},
|
|
1489
|
-
|
|
264
|
+
return new Promise((o, s) => {
|
|
265
|
+
const a = new MessageChannel(), h = Math.random().toString(36).substring(7), u = Date.now(), g = setTimeout(() => {
|
|
266
|
+
const l = Date.now() - u;
|
|
267
|
+
i.error("[WorkerClient] Request timeout:", {
|
|
268
|
+
type: e,
|
|
269
|
+
requestId: h,
|
|
270
|
+
elapsed: l,
|
|
271
|
+
timeoutMs: t
|
|
272
|
+
}), a.port1.onmessage = null, s(new Error("Request timeout"));
|
|
273
|
+
}, t);
|
|
274
|
+
a.port1.onmessage = (l) => {
|
|
1490
275
|
try {
|
|
1491
|
-
const
|
|
1492
|
-
|
|
1493
|
-
type:
|
|
1494
|
-
requestId:
|
|
1495
|
-
elapsed:
|
|
1496
|
-
success:
|
|
1497
|
-
}), clearTimeout(
|
|
1498
|
-
} catch (
|
|
1499
|
-
clearTimeout(
|
|
1500
|
-
|
|
276
|
+
const n = Date.now() - u;
|
|
277
|
+
i.log("[WorkerClient] Request response received:", {
|
|
278
|
+
type: e,
|
|
279
|
+
requestId: h,
|
|
280
|
+
elapsed: n,
|
|
281
|
+
success: l.data?.success
|
|
282
|
+
}), clearTimeout(g), l.data && l.data.success ? o(l.data) : l.data && l.data.success === !1 ? s(new Error(l.data.error || "Worker error")) : o(l.data);
|
|
283
|
+
} catch (n) {
|
|
284
|
+
clearTimeout(g), a.port1.onmessage = null, s(
|
|
285
|
+
n instanceof Error ? n : new Error(String(n))
|
|
1501
286
|
);
|
|
1502
287
|
}
|
|
1503
288
|
};
|
|
1504
289
|
try {
|
|
1505
|
-
const
|
|
1506
|
-
if (!
|
|
1507
|
-
return clearTimeout(
|
|
1508
|
-
|
|
1509
|
-
type:
|
|
1510
|
-
requestId:
|
|
1511
|
-
}),
|
|
1512
|
-
} catch (
|
|
1513
|
-
clearTimeout(
|
|
290
|
+
const l = this.sharedWorkerPort;
|
|
291
|
+
if (!l)
|
|
292
|
+
return clearTimeout(g), i.error("[WorkerClient] SharedWorker port not available"), s(new Error("SharedWorker port not available"));
|
|
293
|
+
i.log("[WorkerClient] Posting message to SharedWorker:", {
|
|
294
|
+
type: e,
|
|
295
|
+
requestId: h
|
|
296
|
+
}), l.postMessage({ type: e, ...r || {} }, [a.port2]);
|
|
297
|
+
} catch (l) {
|
|
298
|
+
clearTimeout(g), i.error("[WorkerClient] Failed to post message:", l), s(l instanceof Error ? l : new Error(String(l)));
|
|
1514
299
|
}
|
|
1515
300
|
});
|
|
1516
301
|
if (this.workerType === "service" && this.serviceWorkerRegistration) {
|
|
1517
|
-
const
|
|
1518
|
-
if (!
|
|
1519
|
-
if (!
|
|
302
|
+
const o = this.serviceWorkerRegistration;
|
|
303
|
+
if (!o) throw new Error("Service worker registration missing");
|
|
304
|
+
if (!o.active && (i.log("[WorkerClient] ServiceWorker not active, waiting..."), await navigator.serviceWorker.ready, !o.active))
|
|
1520
305
|
throw new Error("Service worker not active");
|
|
1521
|
-
return new Promise((
|
|
1522
|
-
const
|
|
1523
|
-
const
|
|
1524
|
-
|
|
1525
|
-
type:
|
|
1526
|
-
requestId:
|
|
1527
|
-
elapsed:
|
|
1528
|
-
timeoutMs:
|
|
1529
|
-
}),
|
|
1530
|
-
},
|
|
1531
|
-
|
|
306
|
+
return new Promise((s, a) => {
|
|
307
|
+
const h = new MessageChannel(), u = Math.random().toString(36).substring(7), g = Date.now(), l = setTimeout(() => {
|
|
308
|
+
const n = Date.now() - g;
|
|
309
|
+
i.error("[WorkerClient] ServiceWorker request timeout:", {
|
|
310
|
+
type: e,
|
|
311
|
+
requestId: u,
|
|
312
|
+
elapsed: n,
|
|
313
|
+
timeoutMs: t
|
|
314
|
+
}), h.port1.onmessage = null, a(new Error("Request timeout"));
|
|
315
|
+
}, t);
|
|
316
|
+
h.port1.onmessage = (n) => {
|
|
1532
317
|
try {
|
|
1533
|
-
const
|
|
1534
|
-
|
|
1535
|
-
type:
|
|
1536
|
-
requestId:
|
|
1537
|
-
elapsed:
|
|
1538
|
-
success:
|
|
1539
|
-
}), clearTimeout(
|
|
1540
|
-
} catch (
|
|
1541
|
-
clearTimeout(
|
|
1542
|
-
|
|
318
|
+
const W = Date.now() - g;
|
|
319
|
+
i.log("[WorkerClient] ServiceWorker response received:", {
|
|
320
|
+
type: e,
|
|
321
|
+
requestId: u,
|
|
322
|
+
elapsed: W,
|
|
323
|
+
success: n.data?.success
|
|
324
|
+
}), clearTimeout(l), n.data && n.data.success ? s(n.data) : n.data && n.data.success === !1 ? a(new Error(n.data.error || "Worker error")) : s(n.data);
|
|
325
|
+
} catch (W) {
|
|
326
|
+
clearTimeout(l), h.port1.onmessage = null, a(
|
|
327
|
+
W instanceof Error ? W : new Error(String(W))
|
|
1543
328
|
);
|
|
1544
329
|
}
|
|
1545
330
|
};
|
|
1546
331
|
try {
|
|
1547
|
-
const
|
|
1548
|
-
if (!
|
|
1549
|
-
return clearTimeout(
|
|
332
|
+
const n = o.active;
|
|
333
|
+
if (!n)
|
|
334
|
+
return clearTimeout(l), i.error(
|
|
1550
335
|
"[WorkerClient] ServiceWorker active instance not available"
|
|
1551
|
-
),
|
|
336
|
+
), a(
|
|
1552
337
|
new Error("Service worker active instance not available")
|
|
1553
338
|
);
|
|
1554
|
-
|
|
1555
|
-
type:
|
|
1556
|
-
requestId:
|
|
1557
|
-
}),
|
|
1558
|
-
} catch (
|
|
1559
|
-
clearTimeout(
|
|
339
|
+
i.log("[WorkerClient] Posting message to ServiceWorker:", {
|
|
340
|
+
type: e,
|
|
341
|
+
requestId: u
|
|
342
|
+
}), n.postMessage({ type: e, ...r || {} }, [h.port2]);
|
|
343
|
+
} catch (n) {
|
|
344
|
+
clearTimeout(l), i.error(
|
|
1560
345
|
"[WorkerClient] Failed to post message to ServiceWorker:",
|
|
1561
|
-
|
|
1562
|
-
),
|
|
346
|
+
n
|
|
347
|
+
), a(n instanceof Error ? n : new Error(String(n)));
|
|
1563
348
|
}
|
|
1564
349
|
});
|
|
1565
350
|
}
|
|
1566
351
|
throw new Error("No worker registered");
|
|
1567
352
|
}
|
|
1568
353
|
// Fire-and-forget postMessage (no response expected)
|
|
1569
|
-
async post(
|
|
354
|
+
async post(e, r) {
|
|
1570
355
|
if (this.workerType === "shared" && this.sharedWorkerPort) {
|
|
1571
356
|
try {
|
|
1572
|
-
this.sharedWorkerPort.postMessage({ type:
|
|
1573
|
-
} catch (
|
|
1574
|
-
|
|
357
|
+
this.sharedWorkerPort.postMessage({ type: e, ...r || {} });
|
|
358
|
+
} catch (t) {
|
|
359
|
+
i.error("[WorkerClient] Failed to post to SharedWorker:", t);
|
|
1575
360
|
}
|
|
1576
361
|
return;
|
|
1577
362
|
}
|
|
1578
363
|
if (this.workerType === "service" && this.serviceWorkerRegistration?.active) {
|
|
1579
364
|
try {
|
|
1580
365
|
this.serviceWorkerRegistration.active.postMessage({
|
|
1581
|
-
type:
|
|
1582
|
-
...
|
|
366
|
+
type: e,
|
|
367
|
+
...r || {}
|
|
1583
368
|
});
|
|
1584
|
-
} catch (
|
|
1585
|
-
|
|
369
|
+
} catch (t) {
|
|
370
|
+
i.error(
|
|
1586
371
|
"[WorkerClient] Failed to post to ServiceWorker (active):",
|
|
1587
|
-
|
|
372
|
+
t
|
|
1588
373
|
);
|
|
1589
374
|
}
|
|
1590
375
|
return;
|
|
@@ -1592,80 +377,80 @@ class rt {
|
|
|
1592
377
|
if ("serviceWorker" in navigator && navigator.serviceWorker.controller) {
|
|
1593
378
|
try {
|
|
1594
379
|
navigator.serviceWorker.controller.postMessage({
|
|
1595
|
-
type:
|
|
1596
|
-
...
|
|
380
|
+
type: e,
|
|
381
|
+
...r || {}
|
|
1597
382
|
});
|
|
1598
|
-
} catch (
|
|
1599
|
-
|
|
383
|
+
} catch (t) {
|
|
384
|
+
i.error(
|
|
1600
385
|
"[WorkerClient] Failed to post to ServiceWorker.controller:",
|
|
1601
|
-
|
|
386
|
+
t
|
|
1602
387
|
);
|
|
1603
388
|
}
|
|
1604
389
|
return;
|
|
1605
390
|
}
|
|
1606
|
-
if (
|
|
1607
|
-
const
|
|
1608
|
-
typeof
|
|
391
|
+
if (e === "SET_AUTH_TOKEN" && r) {
|
|
392
|
+
const t = r.token;
|
|
393
|
+
typeof t == "string" && (this.pendingAuthToken = t);
|
|
1609
394
|
}
|
|
1610
395
|
}
|
|
1611
|
-
sendAuthTokenToServiceWorker(
|
|
396
|
+
sendAuthTokenToServiceWorker(e) {
|
|
1612
397
|
if (this.serviceWorkerRegistration?.active)
|
|
1613
398
|
try {
|
|
1614
399
|
this.serviceWorkerRegistration.active.postMessage({
|
|
1615
400
|
type: "SET_AUTH_TOKEN",
|
|
1616
|
-
token:
|
|
401
|
+
token: e
|
|
1617
402
|
});
|
|
1618
|
-
} catch (
|
|
403
|
+
} catch (r) {
|
|
1619
404
|
console.error(
|
|
1620
405
|
"[WorkerClient] Failed to send auth token to ServiceWorker:",
|
|
1621
|
-
|
|
406
|
+
r
|
|
1622
407
|
);
|
|
1623
408
|
}
|
|
1624
409
|
else if ("serviceWorker" in navigator && navigator.serviceWorker.controller)
|
|
1625
410
|
try {
|
|
1626
411
|
navigator.serviceWorker.controller.postMessage({
|
|
1627
412
|
type: "SET_AUTH_TOKEN",
|
|
1628
|
-
token:
|
|
413
|
+
token: e
|
|
1629
414
|
});
|
|
1630
|
-
} catch (
|
|
415
|
+
} catch (r) {
|
|
1631
416
|
console.error(
|
|
1632
417
|
"[WorkerClient] Failed to send auth token to ServiceWorker.controller:",
|
|
1633
|
-
|
|
418
|
+
r
|
|
1634
419
|
);
|
|
1635
420
|
}
|
|
1636
421
|
else
|
|
1637
|
-
this.pendingAuthToken =
|
|
422
|
+
this.pendingAuthToken = e;
|
|
1638
423
|
}
|
|
1639
424
|
// Subscription API for consumers to listen for connection status updates
|
|
1640
|
-
onConnectionStatus(
|
|
1641
|
-
this.connectionStatusCallbacks.add(
|
|
425
|
+
onConnectionStatus(e) {
|
|
426
|
+
this.connectionStatusCallbacks.add(e);
|
|
1642
427
|
}
|
|
1643
|
-
offConnectionStatus(
|
|
1644
|
-
this.connectionStatusCallbacks.delete(
|
|
428
|
+
offConnectionStatus(e) {
|
|
429
|
+
this.connectionStatusCallbacks.delete(e);
|
|
1645
430
|
}
|
|
1646
431
|
async getConnectionStatus() {
|
|
1647
432
|
try {
|
|
1648
|
-
const
|
|
433
|
+
const e = await this.request(
|
|
1649
434
|
"GET_CONNECTION_STATUS",
|
|
1650
435
|
void 0,
|
|
1651
436
|
2e3
|
|
1652
437
|
);
|
|
1653
|
-
return
|
|
438
|
+
return e && typeof e == "object" && "connected" in e ? !!e.connected : !!e?.connected;
|
|
1654
439
|
} catch {
|
|
1655
440
|
return !1;
|
|
1656
441
|
}
|
|
1657
442
|
}
|
|
1658
|
-
setAuthToken(
|
|
1659
|
-
if (this.pendingAuthToken =
|
|
443
|
+
setAuthToken(e) {
|
|
444
|
+
if (this.pendingAuthToken = e, this.workerType === "shared" && this.sharedWorkerPort)
|
|
1660
445
|
try {
|
|
1661
|
-
this.sharedWorkerPort.postMessage({ type: "SET_AUTH_TOKEN", token:
|
|
1662
|
-
} catch (
|
|
1663
|
-
|
|
446
|
+
this.sharedWorkerPort.postMessage({ type: "SET_AUTH_TOKEN", token: e }), this.pendingAuthToken = null;
|
|
447
|
+
} catch (r) {
|
|
448
|
+
i.error(
|
|
1664
449
|
"[WorkerClient] Failed to set auth token on SharedWorker:",
|
|
1665
|
-
|
|
450
|
+
r
|
|
1666
451
|
);
|
|
1667
452
|
}
|
|
1668
|
-
else this.workerType === "service" && (this.sendAuthTokenToServiceWorker(
|
|
453
|
+
else this.workerType === "service" && (this.sendAuthTokenToServiceWorker(e), this.pendingAuthToken = null);
|
|
1669
454
|
}
|
|
1670
455
|
/**
|
|
1671
456
|
* Register a custom MCP tool dynamically
|
|
@@ -1715,17 +500,17 @@ class rt {
|
|
|
1715
500
|
* );
|
|
1716
501
|
* ```
|
|
1717
502
|
*/
|
|
1718
|
-
async registerTool(
|
|
1719
|
-
return this.isInitialized ? this.registerToolInternal(
|
|
1720
|
-
`[WorkerClient] Queueing tool registration '${
|
|
1721
|
-
), new Promise((
|
|
503
|
+
async registerTool(e, r, t, o) {
|
|
504
|
+
return this.isInitialized ? this.registerToolInternal(e, r, t, o) : (i.log(
|
|
505
|
+
`[WorkerClient] Queueing tool registration '${e}' (worker not initialized yet)`
|
|
506
|
+
), new Promise((s, a) => {
|
|
1722
507
|
this.pendingRegistrations.push({
|
|
1723
|
-
name:
|
|
1724
|
-
description:
|
|
1725
|
-
inputSchema:
|
|
1726
|
-
handler:
|
|
1727
|
-
resolve:
|
|
1728
|
-
reject:
|
|
508
|
+
name: e,
|
|
509
|
+
description: r,
|
|
510
|
+
inputSchema: t,
|
|
511
|
+
handler: o,
|
|
512
|
+
resolve: s,
|
|
513
|
+
reject: a
|
|
1729
514
|
});
|
|
1730
515
|
}));
|
|
1731
516
|
}
|
|
@@ -1733,93 +518,93 @@ class rt {
|
|
|
1733
518
|
* Internal method to register tool (assumes worker is initialized)
|
|
1734
519
|
* @private
|
|
1735
520
|
*/
|
|
1736
|
-
async registerToolInternal(
|
|
1737
|
-
const
|
|
1738
|
-
if (
|
|
1739
|
-
|
|
1740
|
-
`[WorkerClient] Incremented ref count for '${
|
|
1741
|
-
), this.toolHandlers.set(
|
|
521
|
+
async registerToolInternal(e, r, t, o) {
|
|
522
|
+
const s = this.toolRegistry.get(e);
|
|
523
|
+
if (s) {
|
|
524
|
+
s.refCount++, i.log(
|
|
525
|
+
`[WorkerClient] Incremented ref count for '${e}': ${s.refCount}`
|
|
526
|
+
), this.toolHandlers.set(e, o), this.notifyToolChange(e);
|
|
1742
527
|
return;
|
|
1743
528
|
}
|
|
1744
|
-
this.toolHandlers.set(
|
|
1745
|
-
name:
|
|
1746
|
-
description:
|
|
1747
|
-
inputSchema:
|
|
529
|
+
this.toolHandlers.set(e, o), await this.request("REGISTER_TOOL", {
|
|
530
|
+
name: e,
|
|
531
|
+
description: r,
|
|
532
|
+
inputSchema: t,
|
|
1748
533
|
handlerType: "proxy"
|
|
1749
534
|
// Tell worker this is a proxy handler
|
|
1750
|
-
}), this.toolRegistry.set(
|
|
535
|
+
}), this.toolRegistry.set(e, {
|
|
1751
536
|
refCount: 1,
|
|
1752
|
-
description:
|
|
1753
|
-
inputSchema:
|
|
537
|
+
description: r,
|
|
538
|
+
inputSchema: t,
|
|
1754
539
|
isRegistered: !0
|
|
1755
|
-
}),
|
|
1756
|
-
`[WorkerClient] Registered tool '${
|
|
1757
|
-
), this.notifyToolChange(
|
|
540
|
+
}), i.log(
|
|
541
|
+
`[WorkerClient] Registered tool '${e}' with main-thread handler`
|
|
542
|
+
), this.notifyToolChange(e);
|
|
1758
543
|
}
|
|
1759
544
|
/**
|
|
1760
545
|
* Unregister a previously registered MCP tool
|
|
1761
546
|
* @param name - Tool name to unregister
|
|
1762
547
|
* @returns Promise that resolves to true if tool was found and removed
|
|
1763
548
|
*/
|
|
1764
|
-
async unregisterTool(
|
|
1765
|
-
const
|
|
1766
|
-
if (!
|
|
1767
|
-
return
|
|
1768
|
-
if (
|
|
1769
|
-
`[WorkerClient] Decremented ref count for '${
|
|
1770
|
-
),
|
|
1771
|
-
this.toolHandlers.delete(
|
|
1772
|
-
const
|
|
549
|
+
async unregisterTool(e) {
|
|
550
|
+
const r = this.toolRegistry.get(e);
|
|
551
|
+
if (!r)
|
|
552
|
+
return i.warn(`[WorkerClient] Cannot unregister '${e}': not found`), !1;
|
|
553
|
+
if (r.refCount--, i.log(
|
|
554
|
+
`[WorkerClient] Decremented ref count for '${e}': ${r.refCount}`
|
|
555
|
+
), r.refCount <= 0) {
|
|
556
|
+
this.toolHandlers.delete(e);
|
|
557
|
+
const t = await this.request(
|
|
1773
558
|
"UNREGISTER_TOOL",
|
|
1774
|
-
{ name:
|
|
559
|
+
{ name: e }
|
|
1775
560
|
);
|
|
1776
|
-
return this.toolRegistry.delete(
|
|
561
|
+
return this.toolRegistry.delete(e), i.log(`[WorkerClient] Unregistered tool '${e}'`), this.notifyToolChange(e), t?.success ?? !1;
|
|
1777
562
|
}
|
|
1778
|
-
return this.notifyToolChange(
|
|
563
|
+
return this.notifyToolChange(e), !0;
|
|
1779
564
|
}
|
|
1780
565
|
/**
|
|
1781
566
|
* Subscribe to tool changes for a specific tool
|
|
1782
567
|
* Returns unsubscribe function
|
|
1783
568
|
*/
|
|
1784
|
-
onToolChange(
|
|
1785
|
-
this.toolChangeListeners.has(
|
|
1786
|
-
const
|
|
1787
|
-
|
|
1788
|
-
const
|
|
1789
|
-
return
|
|
1790
|
-
refCount:
|
|
1791
|
-
isRegistered:
|
|
569
|
+
onToolChange(e, r) {
|
|
570
|
+
this.toolChangeListeners.has(e) || this.toolChangeListeners.set(e, /* @__PURE__ */ new Set());
|
|
571
|
+
const t = this.toolChangeListeners.get(e);
|
|
572
|
+
t.add(r);
|
|
573
|
+
const o = this.toolRegistry.get(e);
|
|
574
|
+
return r(o ? {
|
|
575
|
+
refCount: o.refCount,
|
|
576
|
+
isRegistered: o.isRegistered
|
|
1792
577
|
} : null), () => {
|
|
1793
|
-
|
|
578
|
+
t.delete(r), t.size === 0 && this.toolChangeListeners.delete(e);
|
|
1794
579
|
};
|
|
1795
580
|
}
|
|
1796
581
|
/**
|
|
1797
582
|
* Notify all listeners about tool changes
|
|
1798
583
|
* @private
|
|
1799
584
|
*/
|
|
1800
|
-
notifyToolChange(
|
|
1801
|
-
const
|
|
1802
|
-
if (!
|
|
1803
|
-
const
|
|
1804
|
-
refCount:
|
|
1805
|
-
isRegistered:
|
|
585
|
+
notifyToolChange(e) {
|
|
586
|
+
const r = this.toolChangeListeners.get(e);
|
|
587
|
+
if (!r || r.size === 0) return;
|
|
588
|
+
const t = this.toolRegistry.get(e), o = t ? {
|
|
589
|
+
refCount: t.refCount,
|
|
590
|
+
isRegistered: t.isRegistered
|
|
1806
591
|
} : null;
|
|
1807
|
-
|
|
592
|
+
r.forEach((s) => {
|
|
1808
593
|
try {
|
|
1809
|
-
|
|
1810
|
-
} catch (
|
|
1811
|
-
|
|
594
|
+
s(o);
|
|
595
|
+
} catch (a) {
|
|
596
|
+
i.error("[WorkerClient] Error in tool change listener:", a);
|
|
1812
597
|
}
|
|
1813
598
|
});
|
|
1814
599
|
}
|
|
1815
600
|
/**
|
|
1816
601
|
* Get tool info from registry
|
|
1817
602
|
*/
|
|
1818
|
-
getToolInfo(
|
|
1819
|
-
const
|
|
1820
|
-
return
|
|
1821
|
-
refCount:
|
|
1822
|
-
isRegistered:
|
|
603
|
+
getToolInfo(e) {
|
|
604
|
+
const r = this.toolRegistry.get(e);
|
|
605
|
+
return r ? {
|
|
606
|
+
refCount: r.refCount,
|
|
607
|
+
isRegistered: r.isRegistered
|
|
1823
608
|
} : null;
|
|
1824
609
|
}
|
|
1825
610
|
/**
|
|
@@ -1827,34 +612,34 @@ class rt {
|
|
|
1827
612
|
*/
|
|
1828
613
|
getRegisteredTools() {
|
|
1829
614
|
return Array.from(this.toolRegistry.keys()).filter(
|
|
1830
|
-
(
|
|
615
|
+
(e) => this.toolRegistry.get(e)?.isRegistered
|
|
1831
616
|
);
|
|
1832
617
|
}
|
|
1833
618
|
/**
|
|
1834
619
|
* Check if a tool is registered
|
|
1835
620
|
*/
|
|
1836
|
-
isToolRegistered(
|
|
1837
|
-
return this.toolRegistry.get(
|
|
621
|
+
isToolRegistered(e) {
|
|
622
|
+
return this.toolRegistry.get(e)?.isRegistered ?? !1;
|
|
1838
623
|
}
|
|
1839
624
|
/**
|
|
1840
625
|
* Handle tool call from worker - execute handler in main thread and return result
|
|
1841
626
|
* @private
|
|
1842
627
|
*/
|
|
1843
|
-
async handleToolCall(
|
|
1844
|
-
|
|
1845
|
-
callId:
|
|
1846
|
-
args:
|
|
628
|
+
async handleToolCall(e, r, t) {
|
|
629
|
+
i.log(`[WorkerClient] Handling tool call: ${e}`, {
|
|
630
|
+
callId: t,
|
|
631
|
+
args: r
|
|
1847
632
|
});
|
|
1848
633
|
try {
|
|
1849
|
-
const
|
|
1850
|
-
if (!
|
|
1851
|
-
throw new Error(`Tool handler not found: ${
|
|
1852
|
-
const
|
|
1853
|
-
this.sendToolCallResult(
|
|
1854
|
-
} catch (
|
|
1855
|
-
|
|
634
|
+
const o = this.toolHandlers.get(e);
|
|
635
|
+
if (!o)
|
|
636
|
+
throw new Error(`Tool handler not found: ${e}`);
|
|
637
|
+
const s = await o(r);
|
|
638
|
+
this.sendToolCallResult(t, { success: !0, result: s });
|
|
639
|
+
} catch (o) {
|
|
640
|
+
i.error(`[WorkerClient] Tool call failed: ${e}`, o), this.sendToolCallResult(t, {
|
|
1856
641
|
success: !1,
|
|
1857
|
-
error:
|
|
642
|
+
error: o instanceof Error ? o.message : "Unknown error"
|
|
1858
643
|
});
|
|
1859
644
|
}
|
|
1860
645
|
}
|
|
@@ -1862,473 +647,213 @@ class rt {
|
|
|
1862
647
|
* Send tool call result back to worker
|
|
1863
648
|
* @private
|
|
1864
649
|
*/
|
|
1865
|
-
sendToolCallResult(
|
|
1866
|
-
const
|
|
650
|
+
sendToolCallResult(e, r) {
|
|
651
|
+
const t = {
|
|
1867
652
|
type: "TOOL_CALL_RESULT",
|
|
1868
|
-
callId:
|
|
1869
|
-
success:
|
|
1870
|
-
result:
|
|
1871
|
-
error:
|
|
653
|
+
callId: e,
|
|
654
|
+
success: r.success,
|
|
655
|
+
result: r.result,
|
|
656
|
+
error: r.error
|
|
1872
657
|
};
|
|
1873
658
|
if (this.workerType === "shared" && this.sharedWorkerPort)
|
|
1874
659
|
try {
|
|
1875
|
-
this.sharedWorkerPort.postMessage(
|
|
1876
|
-
} catch (
|
|
1877
|
-
|
|
660
|
+
this.sharedWorkerPort.postMessage(t);
|
|
661
|
+
} catch (o) {
|
|
662
|
+
i.error(
|
|
1878
663
|
"[WorkerClient] Failed to send result to SharedWorker:",
|
|
1879
|
-
|
|
664
|
+
o
|
|
1880
665
|
);
|
|
1881
666
|
}
|
|
1882
667
|
else if (this.workerType === "service" && this.serviceWorkerRegistration?.active)
|
|
1883
668
|
try {
|
|
1884
|
-
this.serviceWorkerRegistration.active.postMessage(
|
|
1885
|
-
} catch (
|
|
1886
|
-
|
|
669
|
+
this.serviceWorkerRegistration.active.postMessage(t);
|
|
670
|
+
} catch (o) {
|
|
671
|
+
i.error(
|
|
1887
672
|
"[WorkerClient] Failed to send result to ServiceWorker:",
|
|
1888
|
-
|
|
673
|
+
o
|
|
1889
674
|
);
|
|
1890
675
|
}
|
|
1891
676
|
}
|
|
1892
677
|
}
|
|
1893
|
-
const
|
|
1894
|
-
function
|
|
678
|
+
const T = new _();
|
|
679
|
+
function b(c) {
|
|
1895
680
|
const {
|
|
1896
|
-
name:
|
|
1897
|
-
description:
|
|
1898
|
-
inputSchema:
|
|
1899
|
-
handler:
|
|
1900
|
-
autoRegister:
|
|
1901
|
-
autoUnregister:
|
|
1902
|
-
} =
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
}, [
|
|
1906
|
-
const
|
|
1907
|
-
const
|
|
681
|
+
name: e,
|
|
682
|
+
description: r,
|
|
683
|
+
inputSchema: t,
|
|
684
|
+
handler: o,
|
|
685
|
+
autoRegister: s = !0,
|
|
686
|
+
autoUnregister: a = !0
|
|
687
|
+
} = c, [h, u] = R(null), g = v(o), l = v(e), n = v(r), W = v(t), P = v(!0), k = v(!1);
|
|
688
|
+
w(() => {
|
|
689
|
+
g.current = o, l.current = e, n.current = r, W.current = t;
|
|
690
|
+
}, [o, e, r, t]);
|
|
691
|
+
const f = C(async (d) => g.current(d), []), y = C(async () => {
|
|
692
|
+
const d = l.current, p = n.current, A = W.current;
|
|
1908
693
|
try {
|
|
1909
|
-
await
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
),
|
|
1915
|
-
} catch (
|
|
694
|
+
await T.registerTool(
|
|
695
|
+
d,
|
|
696
|
+
p,
|
|
697
|
+
A,
|
|
698
|
+
f
|
|
699
|
+
), k.current = !0, console.log(`[useMCPTool] Registered tool '${d}'`);
|
|
700
|
+
} catch (M) {
|
|
1916
701
|
throw console.error(
|
|
1917
|
-
`[useMCPTool] Failed to register tool '${
|
|
1918
|
-
|
|
1919
|
-
),
|
|
702
|
+
`[useMCPTool] Failed to register tool '${d}':`,
|
|
703
|
+
M
|
|
704
|
+
), M;
|
|
1920
705
|
}
|
|
1921
|
-
}, [
|
|
1922
|
-
const
|
|
706
|
+
}, [f]), S = C(async () => {
|
|
707
|
+
const d = l.current;
|
|
1923
708
|
try {
|
|
1924
|
-
await
|
|
1925
|
-
} catch (
|
|
709
|
+
await T.unregisterTool(d), k.current = !1, console.log(`[useMCPTool] Unregistered tool '${d}'`);
|
|
710
|
+
} catch (p) {
|
|
1926
711
|
console.error(
|
|
1927
|
-
`[useMCPTool] Failed to unregister tool '${
|
|
1928
|
-
|
|
712
|
+
`[useMCPTool] Failed to unregister tool '${d}':`,
|
|
713
|
+
p
|
|
1929
714
|
);
|
|
1930
715
|
}
|
|
1931
716
|
}, []);
|
|
1932
|
-
return
|
|
1933
|
-
|
|
1934
|
-
}), [
|
|
717
|
+
return w(() => T.onToolChange(e, (p) => {
|
|
718
|
+
u(p);
|
|
719
|
+
}), [e]), w(() => (s && y().catch((d) => {
|
|
1935
720
|
console.error(
|
|
1936
|
-
`[useMCPTool] Auto-register failed for '${
|
|
1937
|
-
|
|
721
|
+
`[useMCPTool] Auto-register failed for '${e}':`,
|
|
722
|
+
d
|
|
1938
723
|
);
|
|
1939
724
|
}), () => {
|
|
1940
|
-
|
|
725
|
+
P.current = !1, a && k.current && S().catch((d) => {
|
|
1941
726
|
console.error(
|
|
1942
|
-
`[useMCPTool] Auto-unregister failed for '${
|
|
1943
|
-
|
|
727
|
+
`[useMCPTool] Auto-unregister failed for '${e}':`,
|
|
728
|
+
d
|
|
1944
729
|
);
|
|
1945
730
|
});
|
|
1946
|
-
}), [
|
|
1947
|
-
isRegistered:
|
|
1948
|
-
refCount:
|
|
1949
|
-
register:
|
|
1950
|
-
unregister:
|
|
731
|
+
}), [e]), {
|
|
732
|
+
isRegistered: h?.isRegistered ?? !1,
|
|
733
|
+
refCount: h?.refCount ?? 0,
|
|
734
|
+
register: y,
|
|
735
|
+
unregister: S
|
|
1951
736
|
};
|
|
1952
737
|
}
|
|
1953
|
-
function
|
|
1954
|
-
return
|
|
738
|
+
function O(c) {
|
|
739
|
+
return T.isToolRegistered(c);
|
|
1955
740
|
}
|
|
1956
|
-
function
|
|
1957
|
-
return
|
|
741
|
+
function $() {
|
|
742
|
+
return T.getRegisteredTools();
|
|
1958
743
|
}
|
|
1959
|
-
function
|
|
1960
|
-
return
|
|
744
|
+
function q(c) {
|
|
745
|
+
return T.getToolInfo(c);
|
|
1961
746
|
}
|
|
1962
|
-
function
|
|
1963
|
-
const
|
|
1964
|
-
const
|
|
747
|
+
function D(c, e, r, t) {
|
|
748
|
+
const o = C(async () => {
|
|
749
|
+
const s = await r();
|
|
1965
750
|
return {
|
|
1966
751
|
content: [
|
|
1967
752
|
{
|
|
1968
753
|
type: "text",
|
|
1969
|
-
text: JSON.stringify(
|
|
754
|
+
text: JSON.stringify(s, null, 2)
|
|
1970
755
|
}
|
|
1971
756
|
]
|
|
1972
757
|
};
|
|
1973
|
-
}, [
|
|
1974
|
-
return
|
|
1975
|
-
name:
|
|
1976
|
-
description:
|
|
758
|
+
}, [r]);
|
|
759
|
+
return b({
|
|
760
|
+
name: c,
|
|
761
|
+
description: e,
|
|
1977
762
|
inputSchema: {
|
|
1978
763
|
type: "object",
|
|
1979
764
|
properties: {}
|
|
1980
765
|
},
|
|
1981
|
-
handler:
|
|
1982
|
-
...
|
|
766
|
+
handler: o,
|
|
767
|
+
...t
|
|
1983
768
|
});
|
|
1984
769
|
}
|
|
1985
|
-
function
|
|
1986
|
-
const
|
|
1987
|
-
async (
|
|
1988
|
-
const
|
|
770
|
+
function H(c, e, r, t, o) {
|
|
771
|
+
const s = C(
|
|
772
|
+
async (a) => {
|
|
773
|
+
const h = await t(a);
|
|
1989
774
|
return {
|
|
1990
775
|
content: [
|
|
1991
776
|
{
|
|
1992
777
|
type: "text",
|
|
1993
|
-
text: JSON.stringify(
|
|
778
|
+
text: JSON.stringify(h, null, 2)
|
|
1994
779
|
}
|
|
1995
780
|
]
|
|
1996
781
|
};
|
|
1997
782
|
},
|
|
1998
|
-
[
|
|
783
|
+
[t]
|
|
1999
784
|
);
|
|
2000
|
-
return
|
|
2001
|
-
name:
|
|
2002
|
-
description:
|
|
785
|
+
return b({
|
|
786
|
+
name: c,
|
|
787
|
+
description: e,
|
|
2003
788
|
inputSchema: {
|
|
2004
789
|
type: "object",
|
|
2005
|
-
properties:
|
|
2006
|
-
...
|
|
790
|
+
properties: r,
|
|
791
|
+
...o?.required && { required: o.required }
|
|
2007
792
|
},
|
|
2008
|
-
handler:
|
|
2009
|
-
autoRegister:
|
|
2010
|
-
autoUnregister:
|
|
793
|
+
handler: s,
|
|
794
|
+
autoRegister: o?.autoRegister,
|
|
795
|
+
autoUnregister: o?.autoUnregister
|
|
2011
796
|
});
|
|
2012
797
|
}
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
if (d !== void 0 && (y = "" + d), u.key !== void 0 && (y = "" + u.key), "key" in u) {
|
|
2022
|
-
d = {};
|
|
2023
|
-
for (var b in u)
|
|
2024
|
-
b !== "key" && (d[b] = u[b]);
|
|
2025
|
-
} else d = u;
|
|
2026
|
-
return u = d.ref, {
|
|
2027
|
-
$$typeof: v,
|
|
2028
|
-
type: a,
|
|
2029
|
-
key: y,
|
|
2030
|
-
ref: u !== void 0 ? u : null,
|
|
2031
|
-
props: d
|
|
2032
|
-
};
|
|
2033
|
-
}
|
|
2034
|
-
return fe.Fragment = n, fe.jsx = s, fe.jsxs = s, fe;
|
|
2035
|
-
}
|
|
2036
|
-
var de = {};
|
|
2037
|
-
var $e;
|
|
2038
|
-
function ot() {
|
|
2039
|
-
return $e || ($e = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
2040
|
-
function v(t) {
|
|
2041
|
-
if (t == null) return null;
|
|
2042
|
-
if (typeof t == "function")
|
|
2043
|
-
return t.$$typeof === ie ? null : t.displayName || t.name || null;
|
|
2044
|
-
if (typeof t == "string") return t;
|
|
2045
|
-
switch (t) {
|
|
2046
|
-
case F:
|
|
2047
|
-
return "Fragment";
|
|
2048
|
-
case N:
|
|
2049
|
-
return "Profiler";
|
|
2050
|
-
case H:
|
|
2051
|
-
return "StrictMode";
|
|
2052
|
-
case se:
|
|
2053
|
-
return "Suspense";
|
|
2054
|
-
case W:
|
|
2055
|
-
return "SuspenseList";
|
|
2056
|
-
case te:
|
|
2057
|
-
return "Activity";
|
|
2058
|
-
}
|
|
2059
|
-
if (typeof t == "object")
|
|
2060
|
-
switch (typeof t.tag == "number" && console.error(
|
|
2061
|
-
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
2062
|
-
), t.$$typeof) {
|
|
2063
|
-
case D:
|
|
2064
|
-
return "Portal";
|
|
2065
|
-
case X:
|
|
2066
|
-
return t.displayName || "Context";
|
|
2067
|
-
case G:
|
|
2068
|
-
return (t._context.displayName || "Context") + ".Consumer";
|
|
2069
|
-
case x:
|
|
2070
|
-
var o = t.render;
|
|
2071
|
-
return t = t.displayName, t || (t = o.displayName || o.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
|
|
2072
|
-
case ue:
|
|
2073
|
-
return o = t.displayName || null, o !== null ? o : v(t.type) || "Memo";
|
|
2074
|
-
case z:
|
|
2075
|
-
o = t._payload, t = t._init;
|
|
2076
|
-
try {
|
|
2077
|
-
return v(t(o));
|
|
2078
|
-
} catch {
|
|
2079
|
-
}
|
|
2080
|
-
}
|
|
2081
|
-
return null;
|
|
2082
|
-
}
|
|
2083
|
-
function n(t) {
|
|
2084
|
-
return "" + t;
|
|
2085
|
-
}
|
|
2086
|
-
function s(t) {
|
|
2087
|
-
try {
|
|
2088
|
-
n(t);
|
|
2089
|
-
var o = !1;
|
|
2090
|
-
} catch {
|
|
2091
|
-
o = !0;
|
|
2092
|
-
}
|
|
2093
|
-
if (o) {
|
|
2094
|
-
o = console;
|
|
2095
|
-
var l = o.error, f = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
|
|
2096
|
-
return l.call(
|
|
2097
|
-
o,
|
|
2098
|
-
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
2099
|
-
f
|
|
2100
|
-
), n(t);
|
|
2101
|
-
}
|
|
2102
|
-
}
|
|
2103
|
-
function a(t) {
|
|
2104
|
-
if (t === F) return "<>";
|
|
2105
|
-
if (typeof t == "object" && t !== null && t.$$typeof === z)
|
|
2106
|
-
return "<...>";
|
|
2107
|
-
try {
|
|
2108
|
-
var o = v(t);
|
|
2109
|
-
return o ? "<" + o + ">" : "<...>";
|
|
2110
|
-
} catch {
|
|
2111
|
-
return "<...>";
|
|
2112
|
-
}
|
|
2113
|
-
}
|
|
2114
|
-
function u() {
|
|
2115
|
-
var t = A.A;
|
|
2116
|
-
return t === null ? null : t.getOwner();
|
|
2117
|
-
}
|
|
2118
|
-
function d() {
|
|
2119
|
-
return Error("react-stack-top-frame");
|
|
2120
|
-
}
|
|
2121
|
-
function y(t) {
|
|
2122
|
-
if (re.call(t, "key")) {
|
|
2123
|
-
var o = Object.getOwnPropertyDescriptor(t, "key").get;
|
|
2124
|
-
if (o && o.isReactWarning) return !1;
|
|
2125
|
-
}
|
|
2126
|
-
return t.key !== void 0;
|
|
2127
|
-
}
|
|
2128
|
-
function b(t, o) {
|
|
2129
|
-
function l() {
|
|
2130
|
-
q || (q = !0, console.error(
|
|
2131
|
-
"%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)",
|
|
2132
|
-
o
|
|
2133
|
-
));
|
|
2134
|
-
}
|
|
2135
|
-
l.isReactWarning = !0, Object.defineProperty(t, "key", {
|
|
2136
|
-
get: l,
|
|
2137
|
-
configurable: !0
|
|
2138
|
-
});
|
|
2139
|
-
}
|
|
2140
|
-
function O() {
|
|
2141
|
-
var t = v(this.type);
|
|
2142
|
-
return K[t] || (K[t] = !0, console.error(
|
|
2143
|
-
"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."
|
|
2144
|
-
)), t = this.props.ref, t !== void 0 ? t : null;
|
|
2145
|
-
}
|
|
2146
|
-
function I(t, o, l, f, _, S) {
|
|
2147
|
-
var p = l.ref;
|
|
2148
|
-
return t = {
|
|
2149
|
-
$$typeof: U,
|
|
2150
|
-
type: t,
|
|
2151
|
-
key: o,
|
|
2152
|
-
props: l,
|
|
2153
|
-
_owner: f
|
|
2154
|
-
}, (p !== void 0 ? p : null) !== null ? Object.defineProperty(t, "ref", {
|
|
2155
|
-
enumerable: !1,
|
|
2156
|
-
get: O
|
|
2157
|
-
}) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
|
|
2158
|
-
configurable: !1,
|
|
2159
|
-
enumerable: !1,
|
|
2160
|
-
writable: !0,
|
|
2161
|
-
value: 0
|
|
2162
|
-
}), Object.defineProperty(t, "_debugInfo", {
|
|
2163
|
-
configurable: !1,
|
|
2164
|
-
enumerable: !1,
|
|
2165
|
-
writable: !0,
|
|
2166
|
-
value: null
|
|
2167
|
-
}), Object.defineProperty(t, "_debugStack", {
|
|
2168
|
-
configurable: !1,
|
|
2169
|
-
enumerable: !1,
|
|
2170
|
-
writable: !0,
|
|
2171
|
-
value: _
|
|
2172
|
-
}), Object.defineProperty(t, "_debugTask", {
|
|
2173
|
-
configurable: !1,
|
|
2174
|
-
enumerable: !1,
|
|
2175
|
-
writable: !0,
|
|
2176
|
-
value: S
|
|
2177
|
-
}), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
|
|
2178
|
-
}
|
|
2179
|
-
function m(t, o, l, f, _, S) {
|
|
2180
|
-
var p = o.children;
|
|
2181
|
-
if (p !== void 0)
|
|
2182
|
-
if (f)
|
|
2183
|
-
if (V(p)) {
|
|
2184
|
-
for (f = 0; f < p.length; f++)
|
|
2185
|
-
k(p[f]);
|
|
2186
|
-
Object.freeze && Object.freeze(p);
|
|
2187
|
-
} else
|
|
2188
|
-
console.error(
|
|
2189
|
-
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
2190
|
-
);
|
|
2191
|
-
else k(p);
|
|
2192
|
-
if (re.call(o, "key")) {
|
|
2193
|
-
p = v(t);
|
|
2194
|
-
var Y = Object.keys(o).filter(function(ee) {
|
|
2195
|
-
return ee !== "key";
|
|
2196
|
-
});
|
|
2197
|
-
f = 0 < Y.length ? "{key: someKey, " + Y.join(": ..., ") + ": ...}" : "{key: someKey}", ae[p + f] || (Y = 0 < Y.length ? "{" + Y.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
2198
|
-
`A props object containing a "key" prop is being spread into JSX:
|
|
2199
|
-
let props = %s;
|
|
2200
|
-
<%s {...props} />
|
|
2201
|
-
React keys must be passed directly to JSX without using spread:
|
|
2202
|
-
let props = %s;
|
|
2203
|
-
<%s key={someKey} {...props} />`,
|
|
2204
|
-
f,
|
|
2205
|
-
p,
|
|
2206
|
-
Y,
|
|
2207
|
-
p
|
|
2208
|
-
), ae[p + f] = !0);
|
|
2209
|
-
}
|
|
2210
|
-
if (p = null, l !== void 0 && (s(l), p = "" + l), y(o) && (s(o.key), p = "" + o.key), "key" in o) {
|
|
2211
|
-
l = {};
|
|
2212
|
-
for (var j in o)
|
|
2213
|
-
j !== "key" && (l[j] = o[j]);
|
|
2214
|
-
} else l = o;
|
|
2215
|
-
return p && b(
|
|
2216
|
-
l,
|
|
2217
|
-
typeof t == "function" ? t.displayName || t.name || "Unknown" : t
|
|
2218
|
-
), I(
|
|
2219
|
-
t,
|
|
2220
|
-
p,
|
|
2221
|
-
l,
|
|
2222
|
-
u(),
|
|
2223
|
-
_,
|
|
2224
|
-
S
|
|
2225
|
-
);
|
|
2226
|
-
}
|
|
2227
|
-
function k(t) {
|
|
2228
|
-
L(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === z && (t._payload.status === "fulfilled" ? L(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
|
|
2229
|
-
}
|
|
2230
|
-
function L(t) {
|
|
2231
|
-
return typeof t == "object" && t !== null && t.$$typeof === U;
|
|
2232
|
-
}
|
|
2233
|
-
var $ = Ge(), U = /* @__PURE__ */ Symbol.for("react.transitional.element"), D = /* @__PURE__ */ Symbol.for("react.portal"), F = /* @__PURE__ */ Symbol.for("react.fragment"), H = /* @__PURE__ */ Symbol.for("react.strict_mode"), N = /* @__PURE__ */ Symbol.for("react.profiler"), G = /* @__PURE__ */ Symbol.for("react.consumer"), X = /* @__PURE__ */ Symbol.for("react.context"), x = /* @__PURE__ */ Symbol.for("react.forward_ref"), se = /* @__PURE__ */ Symbol.for("react.suspense"), W = /* @__PURE__ */ Symbol.for("react.suspense_list"), ue = /* @__PURE__ */ Symbol.for("react.memo"), z = /* @__PURE__ */ Symbol.for("react.lazy"), te = /* @__PURE__ */ Symbol.for("react.activity"), ie = /* @__PURE__ */ Symbol.for("react.client.reference"), A = $.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, re = Object.prototype.hasOwnProperty, V = Array.isArray, Q = console.createTask ? console.createTask : function() {
|
|
2234
|
-
return null;
|
|
2235
|
-
};
|
|
2236
|
-
$ = {
|
|
2237
|
-
react_stack_bottom_frame: function(t) {
|
|
2238
|
-
return t();
|
|
2239
|
-
}
|
|
2240
|
-
};
|
|
2241
|
-
var q, K = {}, ne = $.react_stack_bottom_frame.bind(
|
|
2242
|
-
$,
|
|
2243
|
-
d
|
|
2244
|
-
)(), Z = Q(a(d)), ae = {};
|
|
2245
|
-
de.Fragment = F, de.jsx = function(t, o, l) {
|
|
2246
|
-
var f = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
2247
|
-
return m(
|
|
2248
|
-
t,
|
|
2249
|
-
o,
|
|
2250
|
-
l,
|
|
2251
|
-
!1,
|
|
2252
|
-
f ? Error("react-stack-top-frame") : ne,
|
|
2253
|
-
f ? Q(a(t)) : Z
|
|
2254
|
-
);
|
|
2255
|
-
}, de.jsxs = function(t, o, l) {
|
|
2256
|
-
var f = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
2257
|
-
return m(
|
|
2258
|
-
t,
|
|
2259
|
-
o,
|
|
2260
|
-
l,
|
|
2261
|
-
!0,
|
|
2262
|
-
f ? Error("react-stack-top-frame") : ne,
|
|
2263
|
-
f ? Q(a(t)) : Z
|
|
2264
|
-
);
|
|
2265
|
-
};
|
|
2266
|
-
})()), de;
|
|
2267
|
-
}
|
|
2268
|
-
var Fe;
|
|
2269
|
-
function st() {
|
|
2270
|
-
return Fe || (Fe = 1, process.env.NODE_ENV === "production" ? Ee.exports = nt() : Ee.exports = ot()), Ee.exports;
|
|
2271
|
-
}
|
|
2272
|
-
var it = st();
|
|
2273
|
-
const we = M.createContext(null);
|
|
2274
|
-
function dt({
|
|
2275
|
-
children: v,
|
|
2276
|
-
autoInit: n = !0,
|
|
2277
|
-
backendWsUrl: s = "ws://localhost:3001",
|
|
2278
|
-
initOptions: a,
|
|
2279
|
-
onInitialized: u,
|
|
2280
|
-
onInitError: d
|
|
798
|
+
const E = x(null);
|
|
799
|
+
function G({
|
|
800
|
+
children: c,
|
|
801
|
+
autoInit: e = !0,
|
|
802
|
+
backendWsUrl: r = "ws://localhost:3001",
|
|
803
|
+
initOptions: t,
|
|
804
|
+
onInitialized: o,
|
|
805
|
+
onInitError: s
|
|
2281
806
|
}) {
|
|
2282
|
-
const [
|
|
2283
|
-
async (
|
|
2284
|
-
if (
|
|
807
|
+
const [a, h] = R(!1), [u, g] = R(!1), [l] = R([]), n = C(
|
|
808
|
+
async (k) => {
|
|
809
|
+
if (a) {
|
|
2285
810
|
console.log("[MCPToolsProvider] Already initialized");
|
|
2286
811
|
return;
|
|
2287
812
|
}
|
|
2288
813
|
try {
|
|
2289
|
-
const
|
|
2290
|
-
console.log("[MCPToolsProvider] Initializing worker client...",
|
|
2291
|
-
const
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
}), console.log("[MCPToolsProvider] Worker client initialized"),
|
|
2295
|
-
} catch (
|
|
2296
|
-
throw console.error("[MCPToolsProvider] Initialization failed:",
|
|
2297
|
-
|
|
2298
|
-
),
|
|
814
|
+
const f = k || t || { backendWsUrl: r };
|
|
815
|
+
console.log("[MCPToolsProvider] Initializing worker client...", f), await T.init(f), h(!0);
|
|
816
|
+
const y = await T.getConnectionStatus();
|
|
817
|
+
g(y), T.onConnectionStatus((S) => {
|
|
818
|
+
g(S);
|
|
819
|
+
}), console.log("[MCPToolsProvider] Worker client initialized"), o?.();
|
|
820
|
+
} catch (f) {
|
|
821
|
+
throw console.error("[MCPToolsProvider] Initialization failed:", f), s?.(
|
|
822
|
+
f instanceof Error ? f : new Error(String(f))
|
|
823
|
+
), f;
|
|
2299
824
|
}
|
|
2300
825
|
},
|
|
2301
|
-
[
|
|
2302
|
-
),
|
|
2303
|
-
const
|
|
2304
|
-
return
|
|
826
|
+
[a, t, r, o, s]
|
|
827
|
+
), W = C(async () => {
|
|
828
|
+
const k = await T.getConnectionStatus();
|
|
829
|
+
return g(k), k;
|
|
2305
830
|
}, []);
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
console.error("[MCPToolsProvider] Auto-init failed:",
|
|
831
|
+
w(() => {
|
|
832
|
+
e && n().catch((k) => {
|
|
833
|
+
console.error("[MCPToolsProvider] Auto-init failed:", k);
|
|
2309
834
|
});
|
|
2310
|
-
}, [
|
|
2311
|
-
if (!
|
|
2312
|
-
const
|
|
835
|
+
}, [e, n]), w(() => {
|
|
836
|
+
if (!a) return;
|
|
837
|
+
const k = setInterval(() => {
|
|
2313
838
|
}, 5e3);
|
|
2314
|
-
return () => clearInterval(
|
|
2315
|
-
}, [
|
|
2316
|
-
const
|
|
2317
|
-
isInitialized:
|
|
2318
|
-
isConnected:
|
|
2319
|
-
registeredTools:
|
|
2320
|
-
initialize:
|
|
2321
|
-
getConnectionStatus:
|
|
839
|
+
return () => clearInterval(k);
|
|
840
|
+
}, [a]);
|
|
841
|
+
const P = {
|
|
842
|
+
isInitialized: a,
|
|
843
|
+
isConnected: u,
|
|
844
|
+
registeredTools: l,
|
|
845
|
+
initialize: n,
|
|
846
|
+
getConnectionStatus: W
|
|
2322
847
|
};
|
|
2323
|
-
return /* @__PURE__ */
|
|
848
|
+
return /* @__PURE__ */ z(E.Provider, { value: P, children: c });
|
|
2324
849
|
}
|
|
2325
|
-
function
|
|
2326
|
-
const
|
|
2327
|
-
if (!
|
|
850
|
+
function K(c = !1) {
|
|
851
|
+
const e = U(E);
|
|
852
|
+
if (!e && c)
|
|
2328
853
|
throw new Error(
|
|
2329
854
|
"useMCPToolsContext must be used within MCPToolsProvider. Either wrap your component tree with <MCPToolsProvider> or set strict=false."
|
|
2330
855
|
);
|
|
2331
|
-
return
|
|
856
|
+
return e || {
|
|
2332
857
|
isInitialized: !1,
|
|
2333
858
|
isConnected: !1,
|
|
2334
859
|
registeredTools: [],
|
|
@@ -2338,17 +863,17 @@ function ht(v = !1) {
|
|
|
2338
863
|
getConnectionStatus: async () => !1
|
|
2339
864
|
};
|
|
2340
865
|
}
|
|
2341
|
-
function
|
|
2342
|
-
return
|
|
866
|
+
function J() {
|
|
867
|
+
return U(E) !== null;
|
|
2343
868
|
}
|
|
2344
869
|
export {
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
870
|
+
G as MCPToolsProvider,
|
|
871
|
+
$ as getRegisteredTools,
|
|
872
|
+
q as getToolInfo,
|
|
873
|
+
O as isToolRegistered,
|
|
874
|
+
J as useHasMCPProvider,
|
|
875
|
+
H as useMCPAction,
|
|
876
|
+
D as useMCPGetter,
|
|
877
|
+
b as useMCPTool,
|
|
878
|
+
K as useMCPToolsContext
|
|
2354
879
|
};
|