react-shared-states 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +328 -677
- package/dist/main.min.js +8 -16
- package/package.json +3 -5
package/dist/main.js
CHANGED
|
@@ -1,746 +1,397 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-shared-states v1.0.
|
|
2
|
+
* react-shared-states v1.0.1
|
|
3
3
|
* (c) Hichem Taboukouyout
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
* Github: github.com/HichemTab-tech/react-shared-states
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
var
|
|
8
|
+
import oe, { createContext as ie, useMemo as le, useContext as ue, useSyncExternalStore as J } from "react";
|
|
9
|
+
var S = { exports: {} }, R = {};
|
|
10
10
|
/**
|
|
11
11
|
* @license React
|
|
12
|
-
* react-jsx-runtime.production.
|
|
12
|
+
* react-jsx-runtime.production.js
|
|
13
13
|
*
|
|
14
|
-
* Copyright (c)
|
|
14
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
15
|
*
|
|
16
16
|
* This source code is licensed under the MIT license found in the
|
|
17
17
|
* LICENSE file in the root directory of this source tree.
|
|
18
18
|
*/
|
|
19
|
-
var
|
|
20
|
-
function
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
var
|
|
24
|
-
function
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
var U;
|
|
20
|
+
function ce() {
|
|
21
|
+
if (U) return R;
|
|
22
|
+
U = 1;
|
|
23
|
+
var s = Symbol.for("react.transitional.element"), r = Symbol.for("react.fragment");
|
|
24
|
+
function t(n, i, g) {
|
|
25
|
+
var l = null;
|
|
26
|
+
if (g !== void 0 && (l = "" + g), i.key !== void 0 && (l = "" + i.key), "key" in i) {
|
|
27
|
+
g = {};
|
|
28
|
+
for (var m in i)
|
|
29
|
+
m !== "key" && (g[m] = i[m]);
|
|
30
|
+
} else g = i;
|
|
31
|
+
return i = g.ref, {
|
|
32
|
+
$$typeof: s,
|
|
33
|
+
type: n,
|
|
34
|
+
key: l,
|
|
35
|
+
ref: i !== void 0 ? i : null,
|
|
36
|
+
props: g
|
|
37
|
+
};
|
|
30
38
|
}
|
|
31
|
-
return
|
|
39
|
+
return R.Fragment = r, R.jsx = t, R.jsxs = t, R;
|
|
32
40
|
}
|
|
33
|
-
var
|
|
41
|
+
var x = {};
|
|
34
42
|
/**
|
|
35
43
|
* @license React
|
|
36
44
|
* react-jsx-runtime.development.js
|
|
37
45
|
*
|
|
38
|
-
* Copyright (c)
|
|
46
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
39
47
|
*
|
|
40
48
|
* This source code is licensed under the MIT license found in the
|
|
41
49
|
* LICENSE file in the root directory of this source tree.
|
|
42
50
|
*/
|
|
43
|
-
var
|
|
44
|
-
function
|
|
45
|
-
return
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (
|
|
49
|
-
return null;
|
|
50
|
-
|
|
51
|
-
return typeof r == "function" ? r : null;
|
|
52
|
-
}
|
|
53
|
-
var L = l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
54
|
-
function E(e) {
|
|
55
|
-
{
|
|
56
|
-
for (var r = arguments.length, n = new Array(r > 1 ? r - 1 : 0), o = 1; o < r; o++)
|
|
57
|
-
n[o - 1] = arguments[o];
|
|
58
|
-
Ie("error", e, n);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
function Ie(e, r, n) {
|
|
62
|
-
{
|
|
63
|
-
var o = L.ReactDebugCurrentFrame, f = o.getStackAddendum();
|
|
64
|
-
f !== "" && (r += "%s", n = n.concat([f]));
|
|
65
|
-
var c = n.map(function(u) {
|
|
66
|
-
return String(u);
|
|
67
|
-
});
|
|
68
|
-
c.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, c);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
var $e = !1, De = !1, We = !1, Ye = !1, Me = !1, re;
|
|
72
|
-
re = Symbol.for("react.module.reference");
|
|
73
|
-
function ke(e) {
|
|
74
|
-
return !!(typeof e == "string" || typeof e == "function" || e === a || e === P || Me || e === b || e === m || e === S || Ye || e === M || $e || De || We || typeof e == "object" && e !== null && (e.$$typeof === j || e.$$typeof === C || e.$$typeof === v || e.$$typeof === T || e.$$typeof === d || // This needs to include all possible module reference object
|
|
75
|
-
// types supported by any Flight configuration anywhere since
|
|
76
|
-
// we don't know which Flight build this will end up being used
|
|
77
|
-
// with.
|
|
78
|
-
e.$$typeof === re || e.getModuleId !== void 0));
|
|
79
|
-
}
|
|
80
|
-
function Ue(e, r, n) {
|
|
81
|
-
var o = e.displayName;
|
|
82
|
-
if (o)
|
|
83
|
-
return o;
|
|
84
|
-
var f = r.displayName || r.name || "";
|
|
85
|
-
return f !== "" ? n + "(" + f + ")" : n;
|
|
86
|
-
}
|
|
87
|
-
function te(e) {
|
|
88
|
-
return e.displayName || "Context";
|
|
89
|
-
}
|
|
90
|
-
function w(e) {
|
|
91
|
-
if (e == null)
|
|
92
|
-
return null;
|
|
93
|
-
if (typeof e.tag == "number" && E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
94
|
-
return e.displayName || e.name || null;
|
|
95
|
-
if (typeof e == "string")
|
|
96
|
-
return e;
|
|
51
|
+
var y;
|
|
52
|
+
function fe() {
|
|
53
|
+
return y || (y = 1, process.env.NODE_ENV !== "production" && function() {
|
|
54
|
+
function s(e) {
|
|
55
|
+
if (e == null) return null;
|
|
56
|
+
if (typeof e == "function")
|
|
57
|
+
return e.$$typeof === ne ? null : e.displayName || e.name || null;
|
|
58
|
+
if (typeof e == "string") return e;
|
|
97
59
|
switch (e) {
|
|
98
|
-
case
|
|
60
|
+
case A:
|
|
99
61
|
return "Fragment";
|
|
100
|
-
case
|
|
101
|
-
return "Portal";
|
|
102
|
-
case P:
|
|
62
|
+
case D:
|
|
103
63
|
return "Profiler";
|
|
104
|
-
case
|
|
64
|
+
case B:
|
|
105
65
|
return "StrictMode";
|
|
106
|
-
case
|
|
66
|
+
case K:
|
|
107
67
|
return "Suspense";
|
|
108
|
-
case
|
|
68
|
+
case ee:
|
|
109
69
|
return "SuspenseList";
|
|
70
|
+
case te:
|
|
71
|
+
return "Activity";
|
|
110
72
|
}
|
|
111
73
|
if (typeof e == "object")
|
|
112
|
-
switch (
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return
|
|
119
|
-
case
|
|
120
|
-
return
|
|
121
|
-
case
|
|
122
|
-
var
|
|
123
|
-
return
|
|
124
|
-
case
|
|
125
|
-
|
|
74
|
+
switch (typeof e.tag == "number" && console.error(
|
|
75
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
76
|
+
), e.$$typeof) {
|
|
77
|
+
case X:
|
|
78
|
+
return "Portal";
|
|
79
|
+
case Z:
|
|
80
|
+
return (e.displayName || "Context") + ".Provider";
|
|
81
|
+
case H:
|
|
82
|
+
return (e._context.displayName || "Context") + ".Consumer";
|
|
83
|
+
case Q:
|
|
84
|
+
var a = e.render;
|
|
85
|
+
return e = e.displayName, e || (e = a.displayName || a.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
86
|
+
case re:
|
|
87
|
+
return a = e.displayName || null, a !== null ? a : s(e.type) || "Memo";
|
|
88
|
+
case F:
|
|
89
|
+
a = e._payload, e = e._init;
|
|
126
90
|
try {
|
|
127
|
-
return
|
|
91
|
+
return s(e(a));
|
|
128
92
|
} catch {
|
|
129
|
-
return null;
|
|
130
93
|
}
|
|
131
|
-
}
|
|
132
94
|
}
|
|
133
95
|
return null;
|
|
134
96
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
fe.__reactDisabledLog = !0;
|
|
139
|
-
function Be() {
|
|
140
|
-
{
|
|
141
|
-
if ($ === 0) {
|
|
142
|
-
ne = console.log, ae = console.info, ie = console.warn, oe = console.error, se = console.group, ue = console.groupCollapsed, le = console.groupEnd;
|
|
143
|
-
var e = {
|
|
144
|
-
configurable: !0,
|
|
145
|
-
enumerable: !0,
|
|
146
|
-
value: fe,
|
|
147
|
-
writable: !0
|
|
148
|
-
};
|
|
149
|
-
Object.defineProperties(console, {
|
|
150
|
-
info: e,
|
|
151
|
-
log: e,
|
|
152
|
-
warn: e,
|
|
153
|
-
error: e,
|
|
154
|
-
group: e,
|
|
155
|
-
groupCollapsed: e,
|
|
156
|
-
groupEnd: e
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
$++;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
function Je() {
|
|
163
|
-
{
|
|
164
|
-
if ($--, $ === 0) {
|
|
165
|
-
var e = {
|
|
166
|
-
configurable: !0,
|
|
167
|
-
enumerable: !0,
|
|
168
|
-
writable: !0
|
|
169
|
-
};
|
|
170
|
-
Object.defineProperties(console, {
|
|
171
|
-
log: A({}, e, {
|
|
172
|
-
value: ne
|
|
173
|
-
}),
|
|
174
|
-
info: A({}, e, {
|
|
175
|
-
value: ae
|
|
176
|
-
}),
|
|
177
|
-
warn: A({}, e, {
|
|
178
|
-
value: ie
|
|
179
|
-
}),
|
|
180
|
-
error: A({}, e, {
|
|
181
|
-
value: oe
|
|
182
|
-
}),
|
|
183
|
-
group: A({}, e, {
|
|
184
|
-
value: se
|
|
185
|
-
}),
|
|
186
|
-
groupCollapsed: A({}, e, {
|
|
187
|
-
value: ue
|
|
188
|
-
}),
|
|
189
|
-
groupEnd: A({}, e, {
|
|
190
|
-
value: le
|
|
191
|
-
})
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
$ < 0 && E("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
var N = L.ReactCurrentDispatcher, K;
|
|
198
|
-
function k(e, r, n) {
|
|
199
|
-
{
|
|
200
|
-
if (K === void 0)
|
|
201
|
-
try {
|
|
202
|
-
throw Error();
|
|
203
|
-
} catch (f) {
|
|
204
|
-
var o = f.stack.trim().match(/\n( *(at )?)/);
|
|
205
|
-
K = o && o[1] || "";
|
|
206
|
-
}
|
|
207
|
-
return `
|
|
208
|
-
` + K + e;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
var G = !1, U;
|
|
212
|
-
{
|
|
213
|
-
var qe = typeof WeakMap == "function" ? WeakMap : Map;
|
|
214
|
-
U = new qe();
|
|
97
|
+
function r(e) {
|
|
98
|
+
return "" + e;
|
|
215
99
|
}
|
|
216
|
-
function
|
|
217
|
-
if (!e || G)
|
|
218
|
-
return "";
|
|
219
|
-
{
|
|
220
|
-
var n = U.get(e);
|
|
221
|
-
if (n !== void 0)
|
|
222
|
-
return n;
|
|
223
|
-
}
|
|
224
|
-
var o;
|
|
225
|
-
G = !0;
|
|
226
|
-
var f = Error.prepareStackTrace;
|
|
227
|
-
Error.prepareStackTrace = void 0;
|
|
228
|
-
var c;
|
|
229
|
-
c = N.current, N.current = null, Be();
|
|
100
|
+
function t(e) {
|
|
230
101
|
try {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
if (Object.defineProperty(u.prototype, "props", {
|
|
236
|
-
set: function() {
|
|
237
|
-
throw Error();
|
|
238
|
-
}
|
|
239
|
-
}), typeof Reflect == "object" && Reflect.construct) {
|
|
240
|
-
try {
|
|
241
|
-
Reflect.construct(u, []);
|
|
242
|
-
} catch (x) {
|
|
243
|
-
o = x;
|
|
244
|
-
}
|
|
245
|
-
Reflect.construct(e, [], u);
|
|
246
|
-
} else {
|
|
247
|
-
try {
|
|
248
|
-
u.call();
|
|
249
|
-
} catch (x) {
|
|
250
|
-
o = x;
|
|
251
|
-
}
|
|
252
|
-
e.call(u.prototype);
|
|
253
|
-
}
|
|
254
|
-
} else {
|
|
255
|
-
try {
|
|
256
|
-
throw Error();
|
|
257
|
-
} catch (x) {
|
|
258
|
-
o = x;
|
|
259
|
-
}
|
|
260
|
-
e();
|
|
261
|
-
}
|
|
262
|
-
} catch (x) {
|
|
263
|
-
if (x && o && typeof x.stack == "string") {
|
|
264
|
-
for (var s = x.stack.split(`
|
|
265
|
-
`), _ = o.stack.split(`
|
|
266
|
-
`), p = s.length - 1, h = _.length - 1; p >= 1 && h >= 0 && s[p] !== _[h]; )
|
|
267
|
-
h--;
|
|
268
|
-
for (; p >= 1 && h >= 0; p--, h--)
|
|
269
|
-
if (s[p] !== _[h]) {
|
|
270
|
-
if (p !== 1 || h !== 1)
|
|
271
|
-
do
|
|
272
|
-
if (p--, h--, h < 0 || s[p] !== _[h]) {
|
|
273
|
-
var O = `
|
|
274
|
-
` + s[p].replace(" at new ", " at ");
|
|
275
|
-
return e.displayName && O.includes("<anonymous>") && (O = O.replace("<anonymous>", e.displayName)), typeof e == "function" && U.set(e, O), O;
|
|
276
|
-
}
|
|
277
|
-
while (p >= 1 && h >= 0);
|
|
278
|
-
break;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
} finally {
|
|
282
|
-
G = !1, N.current = c, Je(), Error.prepareStackTrace = f;
|
|
283
|
-
}
|
|
284
|
-
var I = e ? e.displayName || e.name : "", F = I ? k(I) : "";
|
|
285
|
-
return typeof e == "function" && U.set(e, F), F;
|
|
286
|
-
}
|
|
287
|
-
function Ne(e, r, n) {
|
|
288
|
-
return ce(e, !1);
|
|
289
|
-
}
|
|
290
|
-
function Ke(e) {
|
|
291
|
-
var r = e.prototype;
|
|
292
|
-
return !!(r && r.isReactComponent);
|
|
293
|
-
}
|
|
294
|
-
function B(e, r, n) {
|
|
295
|
-
if (e == null)
|
|
296
|
-
return "";
|
|
297
|
-
if (typeof e == "function")
|
|
298
|
-
return ce(e, Ke(e));
|
|
299
|
-
if (typeof e == "string")
|
|
300
|
-
return k(e);
|
|
301
|
-
switch (e) {
|
|
302
|
-
case m:
|
|
303
|
-
return k("Suspense");
|
|
304
|
-
case S:
|
|
305
|
-
return k("SuspenseList");
|
|
306
|
-
}
|
|
307
|
-
if (typeof e == "object")
|
|
308
|
-
switch (e.$$typeof) {
|
|
309
|
-
case d:
|
|
310
|
-
return Ne(e.render);
|
|
311
|
-
case C:
|
|
312
|
-
return B(e.type, r, n);
|
|
313
|
-
case j: {
|
|
314
|
-
var o = e, f = o._payload, c = o._init;
|
|
315
|
-
try {
|
|
316
|
-
return B(c(f), r, n);
|
|
317
|
-
} catch {
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
return "";
|
|
322
|
-
}
|
|
323
|
-
var D = Object.prototype.hasOwnProperty, de = {}, ve = L.ReactDebugCurrentFrame;
|
|
324
|
-
function J(e) {
|
|
325
|
-
if (e) {
|
|
326
|
-
var r = e._owner, n = B(e.type, e._source, r ? r.type : null);
|
|
327
|
-
ve.setExtraStackFrame(n);
|
|
328
|
-
} else
|
|
329
|
-
ve.setExtraStackFrame(null);
|
|
330
|
-
}
|
|
331
|
-
function Ge(e, r, n, o, f) {
|
|
332
|
-
{
|
|
333
|
-
var c = Function.call.bind(D);
|
|
334
|
-
for (var u in e)
|
|
335
|
-
if (c(e, u)) {
|
|
336
|
-
var s = void 0;
|
|
337
|
-
try {
|
|
338
|
-
if (typeof e[u] != "function") {
|
|
339
|
-
var _ = Error((o || "React class") + ": " + n + " type `" + u + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[u] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
340
|
-
throw _.name = "Invariant Violation", _;
|
|
341
|
-
}
|
|
342
|
-
s = e[u](r, u, o, n, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
343
|
-
} catch (p) {
|
|
344
|
-
s = p;
|
|
345
|
-
}
|
|
346
|
-
s && !(s instanceof Error) && (J(f), E("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", o || "React class", n, u, typeof s), J(null)), s instanceof Error && !(s.message in de) && (de[s.message] = !0, J(f), E("Failed %s type: %s", n, s.message), J(null));
|
|
347
|
-
}
|
|
102
|
+
r(e);
|
|
103
|
+
var a = !1;
|
|
104
|
+
} catch {
|
|
105
|
+
a = !0;
|
|
348
106
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
return n;
|
|
107
|
+
if (a) {
|
|
108
|
+
a = console;
|
|
109
|
+
var o = a.error, c = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
110
|
+
return o.call(
|
|
111
|
+
a,
|
|
112
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
113
|
+
c
|
|
114
|
+
), r(e);
|
|
358
115
|
}
|
|
359
116
|
}
|
|
360
|
-
function
|
|
117
|
+
function n(e) {
|
|
118
|
+
if (e === A) return "<>";
|
|
119
|
+
if (typeof e == "object" && e !== null && e.$$typeof === F)
|
|
120
|
+
return "<...>";
|
|
361
121
|
try {
|
|
362
|
-
|
|
122
|
+
var a = s(e);
|
|
123
|
+
return a ? "<" + a + ">" : "<...>";
|
|
363
124
|
} catch {
|
|
364
|
-
return
|
|
125
|
+
return "<...>";
|
|
365
126
|
}
|
|
366
127
|
}
|
|
367
|
-
function
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
function ge(e) {
|
|
371
|
-
if (He(e))
|
|
372
|
-
return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Xe(e)), pe(e);
|
|
128
|
+
function i() {
|
|
129
|
+
var e = O.A;
|
|
130
|
+
return e === null ? null : e.getOwner();
|
|
373
131
|
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
ref: !0,
|
|
377
|
-
__self: !0,
|
|
378
|
-
__source: !0
|
|
379
|
-
}, be, Ee;
|
|
380
|
-
function Qe(e) {
|
|
381
|
-
if (D.call(e, "ref")) {
|
|
382
|
-
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
383
|
-
if (r && r.isReactWarning)
|
|
384
|
-
return !1;
|
|
385
|
-
}
|
|
386
|
-
return e.ref !== void 0;
|
|
132
|
+
function g() {
|
|
133
|
+
return Error("react-stack-top-frame");
|
|
387
134
|
}
|
|
388
|
-
function
|
|
389
|
-
if (
|
|
390
|
-
var
|
|
391
|
-
if (
|
|
392
|
-
return !1;
|
|
135
|
+
function l(e) {
|
|
136
|
+
if (V.call(e, "key")) {
|
|
137
|
+
var a = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
138
|
+
if (a && a.isReactWarning) return !1;
|
|
393
139
|
}
|
|
394
140
|
return e.key !== void 0;
|
|
395
141
|
}
|
|
396
|
-
function
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
be || (be = !0, E("%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://reactjs.org/link/special-props)", r));
|
|
403
|
-
};
|
|
404
|
-
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
405
|
-
get: n,
|
|
406
|
-
configurable: !0
|
|
407
|
-
});
|
|
142
|
+
function m(e, a) {
|
|
143
|
+
function o() {
|
|
144
|
+
k || (k = !0, console.error(
|
|
145
|
+
"%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)",
|
|
146
|
+
a
|
|
147
|
+
));
|
|
408
148
|
}
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
// This tag allows us to uniquely identify this as a React Element
|
|
424
|
-
$$typeof: t,
|
|
425
|
-
// Built-in properties that belong on the element
|
|
149
|
+
o.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
150
|
+
get: o,
|
|
151
|
+
configurable: !0
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
function b() {
|
|
155
|
+
var e = s(this.type);
|
|
156
|
+
return $[e] || ($[e] = !0, console.error(
|
|
157
|
+
"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."
|
|
158
|
+
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
159
|
+
}
|
|
160
|
+
function v(e, a, o, c, h, E, w, j) {
|
|
161
|
+
return o = E.ref, e = {
|
|
162
|
+
$$typeof: Y,
|
|
426
163
|
type: e,
|
|
427
|
-
key:
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
164
|
+
key: a,
|
|
165
|
+
props: E,
|
|
166
|
+
_owner: h
|
|
167
|
+
}, (o !== void 0 ? o : null) !== null ? Object.defineProperty(e, "ref", {
|
|
168
|
+
enumerable: !1,
|
|
169
|
+
get: b
|
|
170
|
+
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
434
171
|
configurable: !1,
|
|
435
172
|
enumerable: !1,
|
|
436
173
|
writable: !0,
|
|
437
|
-
value:
|
|
438
|
-
}), Object.defineProperty(
|
|
174
|
+
value: 0
|
|
175
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
439
176
|
configurable: !1,
|
|
440
177
|
enumerable: !1,
|
|
441
|
-
writable: !
|
|
442
|
-
value:
|
|
443
|
-
}), Object.defineProperty(
|
|
178
|
+
writable: !0,
|
|
179
|
+
value: null
|
|
180
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
444
181
|
configurable: !1,
|
|
445
182
|
enumerable: !1,
|
|
446
|
-
writable: !
|
|
447
|
-
value:
|
|
448
|
-
}), Object.
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
}
|
|
476
|
-
var H;
|
|
477
|
-
H = !1;
|
|
478
|
-
function Z(e) {
|
|
479
|
-
return typeof e == "object" && e !== null && e.$$typeof === t;
|
|
480
|
-
}
|
|
481
|
-
function Re() {
|
|
482
|
-
{
|
|
483
|
-
if (X.current) {
|
|
484
|
-
var e = w(X.current.type);
|
|
485
|
-
if (e)
|
|
486
|
-
return `
|
|
487
|
-
|
|
488
|
-
Check the render method of \`` + e + "`.";
|
|
489
|
-
}
|
|
490
|
-
return "";
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
function or(e) {
|
|
494
|
-
return "";
|
|
495
|
-
}
|
|
496
|
-
var me = {};
|
|
497
|
-
function sr(e) {
|
|
498
|
-
{
|
|
499
|
-
var r = Re();
|
|
500
|
-
if (!r) {
|
|
501
|
-
var n = typeof e == "string" ? e : e.displayName || e.name;
|
|
502
|
-
n && (r = `
|
|
503
|
-
|
|
504
|
-
Check the top-level render call using <` + n + ">.");
|
|
505
|
-
}
|
|
506
|
-
return r;
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
function xe(e, r) {
|
|
510
|
-
{
|
|
511
|
-
if (!e._store || e._store.validated || e.key != null)
|
|
512
|
-
return;
|
|
513
|
-
e._store.validated = !0;
|
|
514
|
-
var n = sr(r);
|
|
515
|
-
if (me[n])
|
|
516
|
-
return;
|
|
517
|
-
me[n] = !0;
|
|
518
|
-
var o = "";
|
|
519
|
-
e && e._owner && e._owner !== X.current && (o = " It was passed a child from " + w(e._owner.type) + "."), V(e), E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, o), V(null);
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
function ye(e, r) {
|
|
523
|
-
{
|
|
524
|
-
if (typeof e != "object")
|
|
525
|
-
return;
|
|
526
|
-
if (z(e))
|
|
527
|
-
for (var n = 0; n < e.length; n++) {
|
|
528
|
-
var o = e[n];
|
|
529
|
-
Z(o) && xe(o, r);
|
|
530
|
-
}
|
|
531
|
-
else if (Z(e))
|
|
532
|
-
e._store && (e._store.validated = !0);
|
|
533
|
-
else if (e) {
|
|
534
|
-
var f = Ve(e);
|
|
535
|
-
if (typeof f == "function" && f !== e.entries)
|
|
536
|
-
for (var c = f.call(e), u; !(u = c.next()).done; )
|
|
537
|
-
Z(u.value) && xe(u.value, r);
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
function ur(e) {
|
|
542
|
-
{
|
|
543
|
-
var r = e.type;
|
|
544
|
-
if (r == null || typeof r == "string")
|
|
545
|
-
return;
|
|
546
|
-
var n;
|
|
547
|
-
if (typeof r == "function")
|
|
548
|
-
n = r.propTypes;
|
|
549
|
-
else if (typeof r == "object" && (r.$$typeof === d || // Note: Memo only checks outer props here.
|
|
550
|
-
// Inner props are checked in the reconciler.
|
|
551
|
-
r.$$typeof === C))
|
|
552
|
-
n = r.propTypes;
|
|
553
|
-
else
|
|
554
|
-
return;
|
|
555
|
-
if (n) {
|
|
556
|
-
var o = w(r);
|
|
557
|
-
Ge(n, e.props, "prop", o, e);
|
|
558
|
-
} else if (r.PropTypes !== void 0 && !H) {
|
|
559
|
-
H = !0;
|
|
560
|
-
var f = w(r);
|
|
561
|
-
E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", f || "Unknown");
|
|
562
|
-
}
|
|
563
|
-
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
function lr(e) {
|
|
567
|
-
{
|
|
568
|
-
for (var r = Object.keys(e.props), n = 0; n < r.length; n++) {
|
|
569
|
-
var o = r[n];
|
|
570
|
-
if (o !== "children" && o !== "key") {
|
|
571
|
-
V(e), E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", o), V(null);
|
|
572
|
-
break;
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
e.ref !== null && (V(e), E("Invalid attribute `ref` supplied to `React.Fragment`."), V(null));
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
var Se = {};
|
|
579
|
-
function Te(e, r, n, o, f, c) {
|
|
580
|
-
{
|
|
581
|
-
var u = ke(e);
|
|
582
|
-
if (!u) {
|
|
583
|
-
var s = "";
|
|
584
|
-
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (s += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
585
|
-
var _ = or();
|
|
586
|
-
_ ? s += _ : s += Re();
|
|
587
|
-
var p;
|
|
588
|
-
e === null ? p = "null" : z(e) ? p = "array" : e !== void 0 && e.$$typeof === t ? (p = "<" + (w(e.type) || "Unknown") + " />", s = " Did you accidentally export a JSX literal instead of a component?") : p = typeof e, E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", p, s);
|
|
589
|
-
}
|
|
590
|
-
var h = ir(e, r, n, f, c);
|
|
591
|
-
if (h == null)
|
|
592
|
-
return h;
|
|
593
|
-
if (u) {
|
|
594
|
-
var O = r.children;
|
|
595
|
-
if (O !== void 0)
|
|
596
|
-
if (o)
|
|
597
|
-
if (z(O)) {
|
|
598
|
-
for (var I = 0; I < O.length; I++)
|
|
599
|
-
ye(O[I], e);
|
|
600
|
-
Object.freeze && Object.freeze(O);
|
|
601
|
-
} else
|
|
602
|
-
E("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
603
|
-
else
|
|
604
|
-
ye(O, e);
|
|
605
|
-
}
|
|
606
|
-
if (D.call(r, "key")) {
|
|
607
|
-
var F = w(e), x = Object.keys(r).filter(function(gr) {
|
|
608
|
-
return gr !== "key";
|
|
609
|
-
}), Q = x.length > 0 ? "{key: someKey, " + x.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
610
|
-
if (!Se[F + Q]) {
|
|
611
|
-
var pr = x.length > 0 ? "{" + x.join(": ..., ") + ": ...}" : "{}";
|
|
612
|
-
E(`A props object containing a "key" prop is being spread into JSX:
|
|
183
|
+
writable: !0,
|
|
184
|
+
value: w
|
|
185
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
186
|
+
configurable: !1,
|
|
187
|
+
enumerable: !1,
|
|
188
|
+
writable: !0,
|
|
189
|
+
value: j
|
|
190
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
191
|
+
}
|
|
192
|
+
function L(e, a, o, c, h, E, w, j) {
|
|
193
|
+
var f = a.children;
|
|
194
|
+
if (f !== void 0)
|
|
195
|
+
if (c)
|
|
196
|
+
if (ae(f)) {
|
|
197
|
+
for (c = 0; c < f.length; c++)
|
|
198
|
+
N(f[c]);
|
|
199
|
+
Object.freeze && Object.freeze(f);
|
|
200
|
+
} else
|
|
201
|
+
console.error(
|
|
202
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
203
|
+
);
|
|
204
|
+
else N(f);
|
|
205
|
+
if (V.call(a, "key")) {
|
|
206
|
+
f = s(e);
|
|
207
|
+
var _ = Object.keys(a).filter(function(se) {
|
|
208
|
+
return se !== "key";
|
|
209
|
+
});
|
|
210
|
+
c = 0 < _.length ? "{key: someKey, " + _.join(": ..., ") + ": ...}" : "{key: someKey}", W[f + c] || (_ = 0 < _.length ? "{" + _.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
211
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
613
212
|
let props = %s;
|
|
614
213
|
<%s {...props} />
|
|
615
214
|
React keys must be passed directly to JSX without using spread:
|
|
616
215
|
let props = %s;
|
|
617
|
-
<%s key={someKey} {...props} />`,
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
216
|
+
<%s key={someKey} {...props} />`,
|
|
217
|
+
c,
|
|
218
|
+
f,
|
|
219
|
+
_,
|
|
220
|
+
f
|
|
221
|
+
), W[f + c] = !0);
|
|
621
222
|
}
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
return
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
223
|
+
if (f = null, o !== void 0 && (t(o), f = "" + o), l(a) && (t(a.key), f = "" + a.key), "key" in a) {
|
|
224
|
+
o = {};
|
|
225
|
+
for (var C in a)
|
|
226
|
+
C !== "key" && (o[C] = a[C]);
|
|
227
|
+
} else o = a;
|
|
228
|
+
return f && m(
|
|
229
|
+
o,
|
|
230
|
+
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
231
|
+
), v(
|
|
232
|
+
e,
|
|
233
|
+
f,
|
|
234
|
+
E,
|
|
235
|
+
h,
|
|
236
|
+
i(),
|
|
237
|
+
o,
|
|
238
|
+
w,
|
|
239
|
+
j
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
function N(e) {
|
|
243
|
+
typeof e == "object" && e !== null && e.$$typeof === Y && e._store && (e._store.validated = 1);
|
|
244
|
+
}
|
|
245
|
+
var T = oe, Y = Symbol.for("react.transitional.element"), X = Symbol.for("react.portal"), A = Symbol.for("react.fragment"), B = Symbol.for("react.strict_mode"), D = Symbol.for("react.profiler"), H = Symbol.for("react.consumer"), Z = Symbol.for("react.context"), Q = Symbol.for("react.forward_ref"), K = Symbol.for("react.suspense"), ee = Symbol.for("react.suspense_list"), re = Symbol.for("react.memo"), F = Symbol.for("react.lazy"), te = Symbol.for("react.activity"), ne = Symbol.for("react.client.reference"), O = T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, V = Object.prototype.hasOwnProperty, ae = Array.isArray, P = console.createTask ? console.createTask : function() {
|
|
246
|
+
return null;
|
|
247
|
+
};
|
|
248
|
+
T = {
|
|
249
|
+
react_stack_bottom_frame: function(e) {
|
|
250
|
+
return e();
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
var k, $ = {}, I = T.react_stack_bottom_frame.bind(
|
|
254
|
+
T,
|
|
255
|
+
g
|
|
256
|
+
)(), M = P(n(g)), W = {};
|
|
257
|
+
x.Fragment = A, x.jsx = function(e, a, o, c, h) {
|
|
258
|
+
var E = 1e4 > O.recentlyCreatedOwnerStacks++;
|
|
259
|
+
return L(
|
|
260
|
+
e,
|
|
261
|
+
a,
|
|
262
|
+
o,
|
|
263
|
+
!1,
|
|
264
|
+
c,
|
|
265
|
+
h,
|
|
266
|
+
E ? Error("react-stack-top-frame") : I,
|
|
267
|
+
E ? P(n(e)) : M
|
|
268
|
+
);
|
|
269
|
+
}, x.jsxs = function(e, a, o, c, h) {
|
|
270
|
+
var E = 1e4 > O.recentlyCreatedOwnerStacks++;
|
|
271
|
+
return L(
|
|
272
|
+
e,
|
|
273
|
+
a,
|
|
274
|
+
o,
|
|
275
|
+
!0,
|
|
276
|
+
c,
|
|
277
|
+
h,
|
|
278
|
+
E ? Error("react-stack-top-frame") : I,
|
|
279
|
+
E ? P(n(e)) : M
|
|
280
|
+
);
|
|
281
|
+
};
|
|
282
|
+
}()), x;
|
|
632
283
|
}
|
|
633
|
-
var
|
|
634
|
-
function
|
|
635
|
-
return
|
|
284
|
+
var q;
|
|
285
|
+
function de() {
|
|
286
|
+
return q || (q = 1, process.env.NODE_ENV === "production" ? S.exports = ce() : S.exports = fe()), S.exports;
|
|
636
287
|
}
|
|
637
|
-
var
|
|
638
|
-
const
|
|
639
|
-
class
|
|
288
|
+
var ge = de();
|
|
289
|
+
const z = ie(void 0), _e = ({ children: s, scopeName: r }) => (r || (r = le(() => Math.random().toString(36).substring(2, 15), [])), /* @__PURE__ */ ge.jsx(z.Provider, { value: { scopeName: r }, children: s })), pe = () => ue(z);
|
|
290
|
+
class u {
|
|
640
291
|
data = /* @__PURE__ */ new Map();
|
|
641
292
|
defaultValue() {
|
|
642
293
|
return {};
|
|
643
294
|
}
|
|
644
|
-
addListener(
|
|
645
|
-
this.data.has(
|
|
295
|
+
addListener(r, t, n) {
|
|
296
|
+
this.data.has(u.prefix(r, t)) || this.data.set(u.prefix(r, t), {
|
|
646
297
|
...this.defaultValue,
|
|
647
298
|
listeners: []
|
|
648
|
-
}), this.data.get(
|
|
299
|
+
}), this.data.get(u.prefix(r, t)).listeners.push(n);
|
|
649
300
|
}
|
|
650
|
-
removeListener(
|
|
651
|
-
this.data.has(
|
|
301
|
+
removeListener(r, t, n) {
|
|
302
|
+
this.data.has(u.prefix(r, t)) && (this.data.get(u.prefix(r, t)).listeners = this.data.get(u.prefix(r, t)).listeners.filter((i) => i !== n));
|
|
652
303
|
}
|
|
653
|
-
callListeners(
|
|
654
|
-
this.data.has(
|
|
304
|
+
callListeners(r, t) {
|
|
305
|
+
this.data.has(u.prefix(r, t)) && this.data.get(u.prefix(r, t)).listeners.forEach((n) => n());
|
|
655
306
|
}
|
|
656
|
-
init(
|
|
657
|
-
this.data.has(
|
|
658
|
-
...
|
|
307
|
+
init(r, t, n) {
|
|
308
|
+
this.data.has(u.prefix(r, t)) || this.data.set(u.prefix(r, t), {
|
|
309
|
+
...n,
|
|
659
310
|
listeners: []
|
|
660
311
|
});
|
|
661
312
|
}
|
|
662
|
-
clearAll(
|
|
663
|
-
|
|
664
|
-
|
|
313
|
+
clearAll(r = !1) {
|
|
314
|
+
r || this.data.forEach((t) => {
|
|
315
|
+
t.listeners.forEach((n) => n());
|
|
665
316
|
}), this.data.clear();
|
|
666
317
|
}
|
|
667
|
-
clear(
|
|
668
|
-
|
|
318
|
+
clear(r, t, n = !1) {
|
|
319
|
+
n || this.callListeners(r, t), this.data.delete(u.prefix(r, t));
|
|
669
320
|
}
|
|
670
|
-
get(
|
|
671
|
-
let
|
|
672
|
-
if (
|
|
673
|
-
return this.data.get(
|
|
321
|
+
get(r, t) {
|
|
322
|
+
let n = this.has(r, t);
|
|
323
|
+
if (n)
|
|
324
|
+
return this.data.get(n);
|
|
674
325
|
}
|
|
675
|
-
setValue(
|
|
676
|
-
this.data.has(
|
|
677
|
-
...this.data.get(
|
|
678
|
-
...
|
|
326
|
+
setValue(r, t, n) {
|
|
327
|
+
this.data.has(u.prefix(r, t)) && this.data.set(u.prefix(r, t), {
|
|
328
|
+
...this.data.get(u.prefix(r, t)),
|
|
329
|
+
...n
|
|
679
330
|
});
|
|
680
331
|
}
|
|
681
|
-
has(
|
|
682
|
-
return this.data.has(
|
|
332
|
+
has(r, t) {
|
|
333
|
+
return this.data.has(u.prefix(r, t)) ? u.prefix(r, t) : this.data.has(u.prefix(r, "_global")) ? u.prefix(r, "_global") : void 0;
|
|
683
334
|
}
|
|
684
|
-
static prefix(
|
|
685
|
-
return `${
|
|
335
|
+
static prefix(r, t) {
|
|
336
|
+
return `${t}_${r}`;
|
|
686
337
|
}
|
|
687
338
|
}
|
|
688
|
-
const
|
|
689
|
-
const
|
|
339
|
+
const G = (s) => {
|
|
340
|
+
const r = pe();
|
|
690
341
|
return {
|
|
691
|
-
prefix:
|
|
342
|
+
prefix: s ?? r?.scopeName ?? "_global"
|
|
692
343
|
};
|
|
693
344
|
};
|
|
694
|
-
class
|
|
345
|
+
class be extends u {
|
|
695
346
|
defaultValue() {
|
|
696
347
|
return { value: void 0 };
|
|
697
348
|
}
|
|
698
|
-
init(
|
|
699
|
-
super.init(
|
|
349
|
+
init(r, t, n) {
|
|
350
|
+
super.init(r, t, { value: n });
|
|
700
351
|
}
|
|
701
|
-
setValue(
|
|
702
|
-
super.setValue(
|
|
352
|
+
setValue(r, t, n) {
|
|
353
|
+
super.setValue(r, t, { value: n });
|
|
703
354
|
}
|
|
704
355
|
}
|
|
705
|
-
class
|
|
706
|
-
get(
|
|
707
|
-
const
|
|
708
|
-
return
|
|
356
|
+
class me {
|
|
357
|
+
get(r, t = "_global") {
|
|
358
|
+
const n = t || "_global";
|
|
359
|
+
return p.get(r, n)?.value;
|
|
709
360
|
}
|
|
710
|
-
set(
|
|
711
|
-
const
|
|
712
|
-
|
|
361
|
+
set(r, t, n = "_global") {
|
|
362
|
+
const i = n || "_global";
|
|
363
|
+
p.setValue(r, i, { value: t });
|
|
713
364
|
}
|
|
714
365
|
clearAll() {
|
|
715
|
-
|
|
366
|
+
p.clearAll();
|
|
716
367
|
}
|
|
717
|
-
clear(
|
|
718
|
-
const
|
|
719
|
-
|
|
368
|
+
clear(r, t = "_global") {
|
|
369
|
+
const n = t || "_global";
|
|
370
|
+
p.clear(r, n);
|
|
720
371
|
}
|
|
721
|
-
has(
|
|
722
|
-
const
|
|
723
|
-
return !!
|
|
372
|
+
has(r, t = "_global") {
|
|
373
|
+
const n = t || "_global";
|
|
374
|
+
return !!p.has(r, n);
|
|
724
375
|
}
|
|
725
376
|
getAll() {
|
|
726
|
-
return
|
|
377
|
+
return p.data;
|
|
727
378
|
}
|
|
728
379
|
}
|
|
729
|
-
const
|
|
730
|
-
const { prefix:
|
|
731
|
-
|
|
732
|
-
const
|
|
733
|
-
|
|
734
|
-
}), () =>
|
|
380
|
+
const Re = new me(), p = new be(), xe = (s, r, t) => {
|
|
381
|
+
const { prefix: n } = G(t);
|
|
382
|
+
p.init(s, n, r);
|
|
383
|
+
const i = J((l) => (p.init(s, n, r), p.addListener(s, n, l), () => {
|
|
384
|
+
p.removeListener(s, n, l);
|
|
385
|
+
}), () => p.get(s, n)?.value);
|
|
735
386
|
return [
|
|
736
|
-
|
|
737
|
-
(
|
|
738
|
-
const
|
|
739
|
-
|
|
387
|
+
i,
|
|
388
|
+
(l) => {
|
|
389
|
+
const m = typeof l == "function" ? l(p.get(s, n)?.value) : l;
|
|
390
|
+
m !== i && (p.setValue(s, n, m), p.callListeners(s, n));
|
|
740
391
|
}
|
|
741
392
|
];
|
|
742
393
|
};
|
|
743
|
-
class
|
|
394
|
+
class Ee extends u {
|
|
744
395
|
defaultValue() {
|
|
745
396
|
return {
|
|
746
397
|
fnState: {
|
|
@@ -750,71 +401,71 @@ class Or extends g {
|
|
|
750
401
|
}
|
|
751
402
|
};
|
|
752
403
|
}
|
|
753
|
-
init(
|
|
754
|
-
super.init(
|
|
404
|
+
init(r, t) {
|
|
405
|
+
super.init(r, t, this.defaultValue());
|
|
755
406
|
}
|
|
756
|
-
setValue(
|
|
757
|
-
super.setValue(
|
|
407
|
+
setValue(r, t, n) {
|
|
408
|
+
super.setValue(r, t, n);
|
|
758
409
|
}
|
|
759
410
|
}
|
|
760
|
-
class
|
|
761
|
-
get(
|
|
762
|
-
const
|
|
763
|
-
return
|
|
411
|
+
class ve {
|
|
412
|
+
get(r, t = "_global") {
|
|
413
|
+
const n = t || "_global";
|
|
414
|
+
return d.get(r, n)?.fnState;
|
|
764
415
|
}
|
|
765
|
-
set(
|
|
766
|
-
const
|
|
767
|
-
|
|
416
|
+
set(r, t, n = "_global") {
|
|
417
|
+
const i = n || "_global";
|
|
418
|
+
d.setValue(r, i, t);
|
|
768
419
|
}
|
|
769
420
|
clearAll() {
|
|
770
|
-
|
|
421
|
+
d.clearAll();
|
|
771
422
|
}
|
|
772
|
-
clear(
|
|
773
|
-
const
|
|
774
|
-
|
|
423
|
+
clear(r, t = "_global") {
|
|
424
|
+
const n = t || "_global";
|
|
425
|
+
d.clear(r, n);
|
|
775
426
|
}
|
|
776
|
-
has(
|
|
777
|
-
const
|
|
778
|
-
return !!
|
|
427
|
+
has(r, t = "_global") {
|
|
428
|
+
const n = t || "_global";
|
|
429
|
+
return !!d.has(r, n);
|
|
779
430
|
}
|
|
780
431
|
getAll() {
|
|
781
|
-
return
|
|
432
|
+
return d.data;
|
|
782
433
|
}
|
|
783
434
|
}
|
|
784
|
-
const
|
|
785
|
-
const { prefix:
|
|
786
|
-
|
|
787
|
-
const
|
|
788
|
-
|
|
789
|
-
}), () =>
|
|
790
|
-
const
|
|
791
|
-
if (!
|
|
792
|
-
|
|
435
|
+
const Te = new ve(), d = new Ee(), Se = (s, r, t) => {
|
|
436
|
+
const { prefix: n } = G(t);
|
|
437
|
+
d.init(s, n);
|
|
438
|
+
const i = J((l) => (d.init(s, n), d.addListener(s, n, l), () => {
|
|
439
|
+
d.removeListener(s, n, l);
|
|
440
|
+
}), () => d.get(s, n).fnState), g = async (l, ...m) => {
|
|
441
|
+
const b = d.get(s, n);
|
|
442
|
+
if (!l && (b.fnState.isLoading || b.fnState.results !== void 0)) return b.fnState;
|
|
443
|
+
b.fnState = { ...b.fnState, isLoading: !0, error: void 0 }, console.log(d.get(s, n)?.fnState.isLoading), b.listeners.forEach((v) => v());
|
|
793
444
|
try {
|
|
794
|
-
const
|
|
795
|
-
|
|
796
|
-
} catch (
|
|
797
|
-
|
|
445
|
+
const v = await r(...m);
|
|
446
|
+
b.fnState = { results: v, isLoading: !1, error: void 0 };
|
|
447
|
+
} catch (v) {
|
|
448
|
+
b.fnState = { ...b.fnState, isLoading: !1, error: v };
|
|
798
449
|
}
|
|
799
|
-
|
|
450
|
+
b.listeners.forEach((v) => v());
|
|
800
451
|
};
|
|
801
452
|
return {
|
|
802
|
-
state:
|
|
803
|
-
trigger: (...
|
|
804
|
-
|
|
453
|
+
state: i,
|
|
454
|
+
trigger: (...l) => {
|
|
455
|
+
g(!1, ...l);
|
|
805
456
|
},
|
|
806
|
-
forceTrigger: (...
|
|
807
|
-
|
|
457
|
+
forceTrigger: (...l) => {
|
|
458
|
+
g(!0, ...l);
|
|
808
459
|
},
|
|
809
460
|
clear: () => {
|
|
810
|
-
|
|
461
|
+
d.clear(s, n), d.init(s, n);
|
|
811
462
|
}
|
|
812
463
|
};
|
|
813
464
|
};
|
|
814
465
|
export {
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
466
|
+
_e as SharedStatesProvider,
|
|
467
|
+
Te as sharedFunctionsApi,
|
|
468
|
+
Re as sharedStatesApi,
|
|
469
|
+
Se as useSharedFunction,
|
|
470
|
+
xe as useSharedState
|
|
820
471
|
};
|
package/dist/main.min.js
CHANGED
|
@@ -1,37 +1,29 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-shared-states v1.0.
|
|
2
|
+
* react-shared-states v1.0.1
|
|
3
3
|
* (c) Hichem Taboukouyout
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
* Github: github.com/HichemTab-tech/react-shared-states
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
(function(
|
|
8
|
+
(function(h,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],m):(h=typeof globalThis<"u"?globalThis:h||self,m(h.ReactSharedStates={},h.React))})(this,function(h,m){"use strict";var A={exports:{}},x={};/**
|
|
9
9
|
* @license React
|
|
10
|
-
* react-jsx-runtime.production.
|
|
10
|
+
* react-jsx-runtime.production.js
|
|
11
11
|
*
|
|
12
|
-
* Copyright (c)
|
|
12
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the MIT license found in the
|
|
15
15
|
* LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/var
|
|
16
|
+
*/var F;function q(){if(F)return x;F=1;var s=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,i,g){var u=null;if(g!==void 0&&(u=""+g),i.key!==void 0&&(u=""+i.key),"key"in i){g={};for(var v in i)v!=="key"&&(g[v]=i[v])}else g=i;return i=g.ref,{$$typeof:s,type:n,key:u,ref:i!==void 0?i:null,props:g}}return x.Fragment=t,x.jsx=r,x.jsxs=r,x}var T={};/**
|
|
17
17
|
* @license React
|
|
18
18
|
* react-jsx-runtime.development.js
|
|
19
19
|
*
|
|
20
|
-
* Copyright (c)
|
|
20
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
21
21
|
*
|
|
22
22
|
* This source code is licensed under the MIT license found in the
|
|
23
23
|
* LICENSE file in the root directory of this source tree.
|
|
24
|
-
*/var
|
|
25
|
-
`+X+e}}var q=!1,N;{var ir=typeof WeakMap=="function"?WeakMap:Map;N=new ir}function Ee(e,r){if(!e||q)return"";{var n=N.get(e);if(n!==void 0)return n}var o;q=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var c;c=z.current,z.current=null,nr();try{if(r){var u=function(){throw Error()};if(Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(u,[])}catch(y){o=y}Reflect.construct(e,[],u)}else{try{u.call()}catch(y){o=y}e.call(u.prototype)}}else{try{throw Error()}catch(y){o=y}e()}}catch(y){if(y&&o&&typeof y.stack=="string"){for(var s=y.stack.split(`
|
|
26
|
-
`),_=o.stack.split(`
|
|
27
|
-
`),g=s.length-1,h=_.length-1;g>=1&&h>=0&&s[g]!==_[h];)h--;for(;g>=1&&h>=0;g--,h--)if(s[g]!==_[h]){if(g!==1||h!==1)do if(g--,h--,h<0||s[g]!==_[h]){var O=`
|
|
28
|
-
`+s[g].replace(" at new "," at ");return e.displayName&&O.includes("<anonymous>")&&(O=O.replace("<anonymous>",e.displayName)),typeof e=="function"&&N.set(e,O),O}while(g>=1&&h>=0);break}}}finally{q=!1,z.current=c,ar(),Error.prepareStackTrace=f}var W=e?e.displayName||e.name:"",V=W?J(W):"";return typeof e=="function"&&N.set(e,V),V}function or(e,r,n){return Ee(e,!1)}function sr(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function K(e,r,n){if(e==null)return"";if(typeof e=="function")return Ee(e,sr(e));if(typeof e=="string")return J(e);switch(e){case S:return J("Suspense");case x:return J("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case d:return or(e.render);case w:return K(e.type,r,n);case F:{var o=e,f=o._payload,c=o._init;try{return K(c(f),r,n)}catch{}}}return""}var U=Object.prototype.hasOwnProperty,Re={},_e=I.ReactDebugCurrentFrame;function G(e){if(e){var r=e._owner,n=K(e.type,e._source,r?r.type:null);_e.setExtraStackFrame(n)}else _e.setExtraStackFrame(null)}function ur(e,r,n,o,f){{var c=Function.call.bind(U);for(var u in e)if(c(e,u)){var s=void 0;try{if(typeof e[u]!="function"){var _=Error((o||"React class")+": "+n+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw _.name="Invariant Violation",_}s=e[u](r,u,o,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(g){s=g}s&&!(s instanceof Error)&&(G(f),R("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",o||"React class",n,u,typeof s),G(null)),s instanceof Error&&!(s.message in Re)&&(Re[s.message]=!0,G(f),R("Failed %s type: %s",n,s.message),G(null))}}}var lr=Array.isArray;function H(e){return lr(e)}function fr(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,n=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n}}function cr(e){try{return me(e),!1}catch{return!0}}function me(e){return""+e}function Se(e){if(cr(e))return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",fr(e)),me(e)}var ye=I.ReactCurrentOwner,dr={key:!0,ref:!0,__self:!0,__source:!0},xe,Te;function vr(e){if(U.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function pr(e){if(U.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function gr(e,r){typeof e.ref=="string"&&ye.current}function hr(e,r){{var n=function(){xe||(xe=!0,R("%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://reactjs.org/link/special-props)",r))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}}function br(e,r){{var n=function(){Te||(Te=!0,R("%s: `ref` 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://reactjs.org/link/special-props)",r))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}}var Er=function(e,r,n,o,f,c,u){var s={$$typeof:t,type:e,key:r,ref:n,props:u,_owner:c};return s._store={},Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(s,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(s,"_source",{configurable:!1,enumerable:!1,writable:!1,value:f}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s};function Rr(e,r,n,o,f){{var c,u={},s=null,_=null;n!==void 0&&(Se(n),s=""+n),pr(r)&&(Se(r.key),s=""+r.key),vr(r)&&(_=r.ref,gr(r,f));for(c in r)U.call(r,c)&&!dr.hasOwnProperty(c)&&(u[c]=r[c]);if(e&&e.defaultProps){var g=e.defaultProps;for(c in g)u[c]===void 0&&(u[c]=g[c])}if(s||_){var h=typeof e=="function"?e.displayName||e.name||"Unknown":e;s&&hr(u,h),_&&br(u,h)}return Er(e,s,_,f,o,ye.current,u)}}var Z=I.ReactCurrentOwner,Oe=I.ReactDebugCurrentFrame;function D(e){if(e){var r=e._owner,n=K(e.type,e._source,r?r.type:null);Oe.setExtraStackFrame(n)}else Oe.setExtraStackFrame(null)}var Q;Q=!1;function ee(e){return typeof e=="object"&&e!==null&&e.$$typeof===t}function Pe(){{if(Z.current){var e=A(Z.current.type);if(e)return`
|
|
29
|
-
|
|
30
|
-
Check the render method of \``+e+"`."}return""}}function _r(e){return""}var Ce={};function mr(e){{var r=Pe();if(!r){var n=typeof e=="string"?e:e.displayName||e.name;n&&(r=`
|
|
31
|
-
|
|
32
|
-
Check the top-level render call using <`+n+">.")}return r}}function we(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var n=mr(r);if(Ce[n])return;Ce[n]=!0;var o="";e&&e._owner&&e._owner!==Z.current&&(o=" It was passed a child from "+A(e._owner.type)+"."),D(e),R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,o),D(null)}}function je(e,r){{if(typeof e!="object")return;if(H(e))for(var n=0;n<e.length;n++){var o=e[n];ee(o)&&we(o,r)}else if(ee(e))e._store&&(e._store.validated=!0);else if(e){var f=ze(e);if(typeof f=="function"&&f!==e.entries)for(var c=f.call(e),u;!(u=c.next()).done;)ee(u.value)&&we(u.value,r)}}}function Sr(e){{var r=e.type;if(r==null||typeof r=="string")return;var n;if(typeof r=="function")n=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===d||r.$$typeof===w))n=r.propTypes;else return;if(n){var o=A(r);ur(n,e.props,"prop",o,e)}else if(r.PropTypes!==void 0&&!Q){Q=!0;var f=A(r);R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",f||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function yr(e){{for(var r=Object.keys(e.props),n=0;n<r.length;n++){var o=r[n];if(o!=="children"&&o!=="key"){D(e),R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",o),D(null);break}}e.ref!==null&&(D(e),R("Invalid attribute `ref` supplied to `React.Fragment`."),D(null))}}var Ae={};function Fe(e,r,n,o,f,c){{var u=rr(e);if(!u){var s="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(s+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var _=_r();_?s+=_:s+=Pe();var g;e===null?g="null":H(e)?g="array":e!==void 0&&e.$$typeof===t?(g="<"+(A(e.type)||"Unknown")+" />",s=" Did you accidentally export a JSX literal instead of a component?"):g=typeof e,R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",g,s)}var h=Rr(e,r,n,f,c);if(h==null)return h;if(u){var O=r.children;if(O!==void 0)if(o)if(H(O)){for(var W=0;W<O.length;W++)je(O[W],e);Object.freeze&&Object.freeze(O)}else R("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else je(O,e)}if(U.call(r,"key")){var V=A(e),y=Object.keys(r).filter(function(wr){return wr!=="key"}),re=y.length>0?"{key: someKey, "+y.join(": ..., ")+": ...}":"{key: someKey}";if(!Ae[V+re]){var Cr=y.length>0?"{"+y.join(": ..., ")+": ...}":"{}";R(`A props object containing a "key" prop is being spread into JSX:
|
|
24
|
+
*/var Y;function D(){return Y||(Y=1,process.env.NODE_ENV!=="production"&&function(){function s(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ve?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case O:return"Fragment";case ce:return"Profiler";case ue:return"StrictMode";case ge:return"Suspense";case be:return"SuspenseList";case me:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case le:return"Portal";case de:return(e.displayName||"Context")+".Provider";case fe:return(e._context.displayName||"Context")+".Consumer";case pe:var a=e.render;return e=e.displayName,e||(e=a.displayName||a.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case he:return a=e.displayName||null,a!==null?a:s(e.type)||"Memo";case U:a=e._payload,e=e._init;try{return s(e(a))}catch{}}return null}function t(e){return""+e}function r(e){try{t(e);var a=!1}catch{a=!0}if(a){a=console;var o=a.error,c=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return o.call(a,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",c),t(e)}}function n(e){if(e===O)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===U)return"<...>";try{var a=s(e);return a?"<"+a+">":"<...>"}catch{return"<...>"}}function i(){var e=w.A;return e===null?null:e.getOwner()}function g(){return Error("react-stack-top-frame")}function u(e){if(J.call(e,"key")){var a=Object.getOwnPropertyDescriptor(e,"key").get;if(a&&a.isReactWarning)return!1}return e.key!==void 0}function v(e,a){function o(){z||(z=!0,console.error("%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)",a))}o.isReactWarning=!0,Object.defineProperty(e,"key",{get:o,configurable:!0})}function b(){var e=s(this.type);return G[e]||(G[e]=!0,console.error("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.")),e=this.props.ref,e!==void 0?e:null}function _(e,a,o,c,R,E,C,L){return o=E.ref,e={$$typeof:W,type:e,key:a,props:E,_owner:R},(o!==void 0?o:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:b}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:C}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:L}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function M(e,a,o,c,R,E,C,L){var f=a.children;if(f!==void 0)if(c)if(Ee(f)){for(c=0;c<f.length;c++)y(f[c]);Object.freeze&&Object.freeze(f)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else y(f);if(J.call(a,"key")){f=s(e);var S=Object.keys(a).filter(function(_e){return _e!=="key"});c=0<S.length?"{key: someKey, "+S.join(": ..., ")+": ...}":"{key: someKey}",B[f+c]||(S=0<S.length?"{"+S.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
33
25
|
let props = %s;
|
|
34
26
|
<%s {...props} />
|
|
35
27
|
React keys must be passed directly to JSX without using spread:
|
|
36
28
|
let props = %s;
|
|
37
|
-
<%s key={someKey} {...props} />`,
|
|
29
|
+
<%s key={someKey} {...props} />`,c,f,S,f),B[f+c]=!0)}if(f=null,o!==void 0&&(r(o),f=""+o),u(a)&&(r(a.key),f=""+a.key),"key"in a){o={};for(var N in a)N!=="key"&&(o[N]=a[N])}else o=a;return f&&v(o,typeof e=="function"?e.displayName||e.name||"Unknown":e),_(e,f,E,R,i(),o,C,L)}function y(e){typeof e=="object"&&e!==null&&e.$$typeof===W&&e._store&&(e._store.validated=1)}var P=m,W=Symbol.for("react.transitional.element"),le=Symbol.for("react.portal"),O=Symbol.for("react.fragment"),ue=Symbol.for("react.strict_mode"),ce=Symbol.for("react.profiler"),fe=Symbol.for("react.consumer"),de=Symbol.for("react.context"),pe=Symbol.for("react.forward_ref"),ge=Symbol.for("react.suspense"),be=Symbol.for("react.suspense_list"),he=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),me=Symbol.for("react.activity"),ve=Symbol.for("react.client.reference"),w=P.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=Object.prototype.hasOwnProperty,Ee=Array.isArray,j=console.createTask?console.createTask:function(){return null};P={react_stack_bottom_frame:function(e){return e()}};var z,G={},X=P.react_stack_bottom_frame.bind(P,g)(),$=j(n(g)),B={};T.Fragment=O,T.jsx=function(e,a,o,c,R){var E=1e4>w.recentlyCreatedOwnerStacks++;return M(e,a,o,!1,c,R,E?Error("react-stack-top-frame"):X,E?j(n(e)):$)},T.jsxs=function(e,a,o,c,R){var E=1e4>w.recentlyCreatedOwnerStacks++;return M(e,a,o,!0,c,R,E?Error("react-stack-top-frame"):X,E?j(n(e)):$)}}()),T}var V;function H(){return V||(V=1,process.env.NODE_ENV==="production"?A.exports=q():A.exports=D()),A.exports}var Z=H();const k=m.createContext(void 0),Q=({children:s,scopeName:t})=>(t||(t=m.useMemo(()=>Math.random().toString(36).substring(2,15),[])),Z.jsx(k.Provider,{value:{scopeName:t},children:s})),K=()=>m.useContext(k);class l{data=new Map;defaultValue(){return{}}addListener(t,r,n){this.data.has(l.prefix(t,r))||this.data.set(l.prefix(t,r),{...this.defaultValue,listeners:[]}),this.data.get(l.prefix(t,r)).listeners.push(n)}removeListener(t,r,n){this.data.has(l.prefix(t,r))&&(this.data.get(l.prefix(t,r)).listeners=this.data.get(l.prefix(t,r)).listeners.filter(i=>i!==n))}callListeners(t,r){this.data.has(l.prefix(t,r))&&this.data.get(l.prefix(t,r)).listeners.forEach(n=>n())}init(t,r,n){this.data.has(l.prefix(t,r))||this.data.set(l.prefix(t,r),{...n,listeners:[]})}clearAll(t=!1){t||this.data.forEach(r=>{r.listeners.forEach(n=>n())}),this.data.clear()}clear(t,r,n=!1){n||this.callListeners(t,r),this.data.delete(l.prefix(t,r))}get(t,r){let n=this.has(t,r);if(n)return this.data.get(n)}setValue(t,r,n){this.data.has(l.prefix(t,r))&&this.data.set(l.prefix(t,r),{...this.data.get(l.prefix(t,r)),...n})}has(t,r){return this.data.has(l.prefix(t,r))?l.prefix(t,r):this.data.has(l.prefix(t,"_global"))?l.prefix(t,"_global"):void 0}static prefix(t,r){return`${r}_${t}`}}const I=s=>{const t=K();return{prefix:s??t?.scopeName??"_global"}};class ee extends l{defaultValue(){return{value:void 0}}init(t,r,n){super.init(t,r,{value:n})}setValue(t,r,n){super.setValue(t,r,{value:n})}}class te{get(t,r="_global"){const n=r||"_global";return p.get(t,n)?.value}set(t,r,n="_global"){const i=n||"_global";p.setValue(t,i,{value:r})}clearAll(){p.clearAll()}clear(t,r="_global"){const n=r||"_global";p.clear(t,n)}has(t,r="_global"){const n=r||"_global";return!!p.has(t,n)}getAll(){return p.data}}const re=new te,p=new ee,ne=(s,t,r)=>{const{prefix:n}=I(r);p.init(s,n,t);const i=m.useSyncExternalStore(u=>(p.init(s,n,t),p.addListener(s,n,u),()=>{p.removeListener(s,n,u)}),()=>p.get(s,n)?.value);return[i,u=>{const v=typeof u=="function"?u(p.get(s,n)?.value):u;v!==i&&(p.setValue(s,n,v),p.callListeners(s,n))}]};class ae extends l{defaultValue(){return{fnState:{results:void 0,isLoading:!1,error:void 0}}}init(t,r){super.init(t,r,this.defaultValue())}setValue(t,r,n){super.setValue(t,r,n)}}class se{get(t,r="_global"){const n=r||"_global";return d.get(t,n)?.fnState}set(t,r,n="_global"){const i=n||"_global";d.setValue(t,i,r)}clearAll(){d.clearAll()}clear(t,r="_global"){const n=r||"_global";d.clear(t,n)}has(t,r="_global"){const n=r||"_global";return!!d.has(t,n)}getAll(){return d.data}}const oe=new se,d=new ae,ie=(s,t,r)=>{const{prefix:n}=I(r);d.init(s,n);const i=m.useSyncExternalStore(u=>(d.init(s,n),d.addListener(s,n,u),()=>{d.removeListener(s,n,u)}),()=>d.get(s,n).fnState),g=async(u,...v)=>{const b=d.get(s,n);if(!u&&(b.fnState.isLoading||b.fnState.results!==void 0))return b.fnState;b.fnState={...b.fnState,isLoading:!0,error:void 0},console.log(d.get(s,n)?.fnState.isLoading),b.listeners.forEach(_=>_());try{const _=await t(...v);b.fnState={results:_,isLoading:!1,error:void 0}}catch(_){b.fnState={...b.fnState,isLoading:!1,error:_}}b.listeners.forEach(_=>_())};return{state:i,trigger:(...u)=>{g(!1,...u)},forceTrigger:(...u)=>{g(!0,...u)},clear:()=>{d.clear(s,n),d.init(s,n)}}};h.SharedStatesProvider=Q,h.sharedFunctionsApi=oe,h.sharedStatesApi=re,h.useSharedFunction=ie,h.useSharedState=ne,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-shared-states",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Global state made as simple as useState, with zero config, built-in async caching, and automatic scoping.",
|
|
6
6
|
"keywords": [
|
|
@@ -15,10 +15,6 @@
|
|
|
15
15
|
"main": "dist/main.js",
|
|
16
16
|
"module": "dist/main.esm.js",
|
|
17
17
|
"types": "dist/index.d.ts",
|
|
18
|
-
"peerDependencies": {
|
|
19
|
-
"react": "^18.3.1",
|
|
20
|
-
"react-dom": "^18.3.1"
|
|
21
|
-
},
|
|
22
18
|
"author": "Hichem Taboukouyout <hichem.taboukouyout@hichemtab-tech.me>",
|
|
23
19
|
"repository": {
|
|
24
20
|
"type": "git",
|
|
@@ -34,6 +30,8 @@
|
|
|
34
30
|
"@types/react": "^19.1.11",
|
|
35
31
|
"@types/react-dom": "^19.1.7",
|
|
36
32
|
"@vitejs/plugin-react": "^5.0.1",
|
|
33
|
+
"react": "^19.1.1",
|
|
34
|
+
"react-dom": "^19.1.1",
|
|
37
35
|
"typescript": "^5.9.2",
|
|
38
36
|
"vite": "^7.1.3",
|
|
39
37
|
"vite-plugin-banner": "^0.8.1",
|