react-state-custom 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1013 @@
1
+ var Pe = Object.defineProperty;
2
+ var Ne = (e, t, r) => t in e ? Pe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var K = (e, t, r) => Ne(e, typeof t != "symbol" ? t + "" : t, r);
4
+ import Ae, { useMemo as H, useEffect as P, useState as J } from "react";
5
+ function Ie(e) {
6
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
7
+ }
8
+ var B = { exports: {} }, ve;
9
+ function $e() {
10
+ if (ve) return B.exports;
11
+ ve = 1;
12
+ var e = typeof Reflect == "object" ? Reflect : null, t = e && typeof e.apply == "function" ? e.apply : function(o, n, f) {
13
+ return Function.prototype.apply.call(o, n, f);
14
+ }, r;
15
+ e && typeof e.ownKeys == "function" ? r = e.ownKeys : Object.getOwnPropertySymbols ? r = function(o) {
16
+ return Object.getOwnPropertyNames(o).concat(Object.getOwnPropertySymbols(o));
17
+ } : r = function(o) {
18
+ return Object.getOwnPropertyNames(o);
19
+ };
20
+ function u(s) {
21
+ console && console.warn && console.warn(s);
22
+ }
23
+ var l = Number.isNaN || function(o) {
24
+ return o !== o;
25
+ };
26
+ function a() {
27
+ a.init.call(this);
28
+ }
29
+ B.exports = a, B.exports.once = N, a.EventEmitter = a, a.prototype._events = void 0, a.prototype._eventsCount = 0, a.prototype._maxListeners = void 0;
30
+ var d = 10;
31
+ function h(s) {
32
+ if (typeof s != "function")
33
+ throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof s);
34
+ }
35
+ Object.defineProperty(a, "defaultMaxListeners", {
36
+ enumerable: !0,
37
+ get: function() {
38
+ return d;
39
+ },
40
+ set: function(s) {
41
+ if (typeof s != "number" || s < 0 || l(s))
42
+ throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + s + ".");
43
+ d = s;
44
+ }
45
+ }), a.init = function() {
46
+ (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
47
+ }, a.prototype.setMaxListeners = function(o) {
48
+ if (typeof o != "number" || o < 0 || l(o))
49
+ throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + o + ".");
50
+ return this._maxListeners = o, this;
51
+ };
52
+ function m(s) {
53
+ return s._maxListeners === void 0 ? a.defaultMaxListeners : s._maxListeners;
54
+ }
55
+ a.prototype.getMaxListeners = function() {
56
+ return m(this);
57
+ }, a.prototype.emit = function(o) {
58
+ for (var n = [], f = 1; f < arguments.length; f++) n.push(arguments[f]);
59
+ var c = o === "error", b = this._events;
60
+ if (b !== void 0)
61
+ c = c && b.error === void 0;
62
+ else if (!c)
63
+ return !1;
64
+ if (c) {
65
+ var v;
66
+ if (n.length > 0 && (v = n[0]), v instanceof Error)
67
+ throw v;
68
+ var S = new Error("Unhandled error." + (v ? " (" + v.message + ")" : ""));
69
+ throw S.context = v, S;
70
+ }
71
+ var A = b[o];
72
+ if (A === void 0)
73
+ return !1;
74
+ if (typeof A == "function")
75
+ t(A, this, n);
76
+ else
77
+ for (var X = A.length, Y = $(A, X), f = 0; f < X; ++f)
78
+ t(Y[f], this, n);
79
+ return !0;
80
+ };
81
+ function _(s, o, n, f) {
82
+ var c, b, v;
83
+ if (h(n), b = s._events, b === void 0 ? (b = s._events = /* @__PURE__ */ Object.create(null), s._eventsCount = 0) : (b.newListener !== void 0 && (s.emit(
84
+ "newListener",
85
+ o,
86
+ n.listener ? n.listener : n
87
+ ), b = s._events), v = b[o]), v === void 0)
88
+ v = b[o] = n, ++s._eventsCount;
89
+ else if (typeof v == "function" ? v = b[o] = f ? [n, v] : [v, n] : f ? v.unshift(n) : v.push(n), c = m(s), c > 0 && v.length > c && !v.warned) {
90
+ v.warned = !0;
91
+ var S = new Error("Possible EventEmitter memory leak detected. " + v.length + " " + String(o) + " listeners added. Use emitter.setMaxListeners() to increase limit");
92
+ S.name = "MaxListenersExceededWarning", S.emitter = s, S.type = o, S.count = v.length, u(S);
93
+ }
94
+ return s;
95
+ }
96
+ a.prototype.addListener = function(o, n) {
97
+ return _(this, o, n, !1);
98
+ }, a.prototype.on = a.prototype.addListener, a.prototype.prependListener = function(o, n) {
99
+ return _(this, o, n, !0);
100
+ };
101
+ function y() {
102
+ if (!this.fired)
103
+ return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
104
+ }
105
+ function T(s, o, n) {
106
+ var f = { fired: !1, wrapFn: void 0, target: s, type: o, listener: n }, c = y.bind(f);
107
+ return c.listener = n, f.wrapFn = c, c;
108
+ }
109
+ a.prototype.once = function(o, n) {
110
+ return h(n), this.on(o, T(this, o, n)), this;
111
+ }, a.prototype.prependOnceListener = function(o, n) {
112
+ return h(n), this.prependListener(o, T(this, o, n)), this;
113
+ }, a.prototype.removeListener = function(o, n) {
114
+ var f, c, b, v, S;
115
+ if (h(n), c = this._events, c === void 0)
116
+ return this;
117
+ if (f = c[o], f === void 0)
118
+ return this;
119
+ if (f === n || f.listener === n)
120
+ --this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete c[o], c.removeListener && this.emit("removeListener", o, f.listener || n));
121
+ else if (typeof f != "function") {
122
+ for (b = -1, v = f.length - 1; v >= 0; v--)
123
+ if (f[v] === n || f[v].listener === n) {
124
+ S = f[v].listener, b = v;
125
+ break;
126
+ }
127
+ if (b < 0)
128
+ return this;
129
+ b === 0 ? f.shift() : g(f, b), f.length === 1 && (c[o] = f[0]), c.removeListener !== void 0 && this.emit("removeListener", o, S || n);
130
+ }
131
+ return this;
132
+ }, a.prototype.off = a.prototype.removeListener, a.prototype.removeAllListeners = function(o) {
133
+ var n, f, c;
134
+ if (f = this._events, f === void 0)
135
+ return this;
136
+ if (f.removeListener === void 0)
137
+ return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : f[o] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete f[o]), this;
138
+ if (arguments.length === 0) {
139
+ var b = Object.keys(f), v;
140
+ for (c = 0; c < b.length; ++c)
141
+ v = b[c], v !== "removeListener" && this.removeAllListeners(v);
142
+ return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
143
+ }
144
+ if (n = f[o], typeof n == "function")
145
+ this.removeListener(o, n);
146
+ else if (n !== void 0)
147
+ for (c = n.length - 1; c >= 0; c--)
148
+ this.removeListener(o, n[c]);
149
+ return this;
150
+ };
151
+ function j(s, o, n) {
152
+ var f = s._events;
153
+ if (f === void 0)
154
+ return [];
155
+ var c = f[o];
156
+ return c === void 0 ? [] : typeof c == "function" ? n ? [c.listener || c] : [c] : n ? w(c) : $(c, c.length);
157
+ }
158
+ a.prototype.listeners = function(o) {
159
+ return j(this, o, !0);
160
+ }, a.prototype.rawListeners = function(o) {
161
+ return j(this, o, !1);
162
+ }, a.listenerCount = function(s, o) {
163
+ return typeof s.listenerCount == "function" ? s.listenerCount(o) : C.call(s, o);
164
+ }, a.prototype.listenerCount = C;
165
+ function C(s) {
166
+ var o = this._events;
167
+ if (o !== void 0) {
168
+ var n = o[s];
169
+ if (typeof n == "function")
170
+ return 1;
171
+ if (n !== void 0)
172
+ return n.length;
173
+ }
174
+ return 0;
175
+ }
176
+ a.prototype.eventNames = function() {
177
+ return this._eventsCount > 0 ? r(this._events) : [];
178
+ };
179
+ function $(s, o) {
180
+ for (var n = new Array(o), f = 0; f < o; ++f)
181
+ n[f] = s[f];
182
+ return n;
183
+ }
184
+ function g(s, o) {
185
+ for (; o + 1 < s.length; o++)
186
+ s[o] = s[o + 1];
187
+ s.pop();
188
+ }
189
+ function w(s) {
190
+ for (var o = new Array(s.length), n = 0; n < o.length; ++n)
191
+ o[n] = s[n].listener || s[n];
192
+ return o;
193
+ }
194
+ function N(s, o) {
195
+ return new Promise(function(n, f) {
196
+ function c(v) {
197
+ s.removeListener(o, b), f(v);
198
+ }
199
+ function b() {
200
+ typeof s.removeListener == "function" && s.removeListener("error", c), n([].slice.call(arguments));
201
+ }
202
+ D(s, o, b, { once: !0 }), o !== "error" && F(s, c, { once: !0 });
203
+ });
204
+ }
205
+ function F(s, o, n) {
206
+ typeof s.on == "function" && D(s, "error", o, n);
207
+ }
208
+ function D(s, o, n, f) {
209
+ if (typeof s.on == "function")
210
+ f.once ? s.once(o, n) : s.on(o, n);
211
+ else if (typeof s.addEventListener == "function")
212
+ s.addEventListener(o, function c(b) {
213
+ f.once && s.removeEventListener(o, c), n(b);
214
+ });
215
+ else
216
+ throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof s);
217
+ }
218
+ return B.exports;
219
+ }
220
+ var Me = $e();
221
+ const ke = /* @__PURE__ */ Ie(Me);
222
+ var Fe = typeof global == "object" && global && global.Object === Object && global, De = typeof self == "object" && self && self.Object === Object && self, ee = Fe || De || Function("return this")(), Z = ee.Symbol, Re = Object.prototype, We = Re.hasOwnProperty, xe = Re.toString, G = Z ? Z.toStringTag : void 0;
223
+ function ze(e) {
224
+ var t = We.call(e, G), r = e[G];
225
+ try {
226
+ e[G] = void 0;
227
+ var u = !0;
228
+ } catch {
229
+ }
230
+ var l = xe.call(e);
231
+ return u && (t ? e[G] = r : delete e[G]), l;
232
+ }
233
+ var Ye = Object.prototype, Ge = Ye.toString;
234
+ function Ue(e) {
235
+ return Ge.call(e);
236
+ }
237
+ var Ve = "[object Null]", He = "[object Undefined]", me = Z ? Z.toStringTag : void 0;
238
+ function Se(e) {
239
+ return e == null ? e === void 0 ? He : Ve : me && me in Object(e) ? ze(e) : Ue(e);
240
+ }
241
+ function qe(e) {
242
+ return e != null && typeof e == "object";
243
+ }
244
+ var Je = "[object Symbol]";
245
+ function Xe(e) {
246
+ return typeof e == "symbol" || qe(e) && Se(e) == Je;
247
+ }
248
+ var Ke = /\s/;
249
+ function Be(e) {
250
+ for (var t = e.length; t-- && Ke.test(e.charAt(t)); )
251
+ ;
252
+ return t;
253
+ }
254
+ var Qe = /^\s+/;
255
+ function Ze(e) {
256
+ return e && e.slice(0, Be(e) + 1).replace(Qe, "");
257
+ }
258
+ function x(e) {
259
+ var t = typeof e;
260
+ return e != null && (t == "object" || t == "function");
261
+ }
262
+ var be = NaN, et = /^[-+]0x[0-9a-f]+$/i, tt = /^0b[01]+$/i, rt = /^0o[0-7]+$/i, nt = parseInt;
263
+ function _e(e) {
264
+ if (typeof e == "number")
265
+ return e;
266
+ if (Xe(e))
267
+ return be;
268
+ if (x(e)) {
269
+ var t = typeof e.valueOf == "function" ? e.valueOf() : e;
270
+ e = x(t) ? t + "" : t;
271
+ }
272
+ if (typeof e != "string")
273
+ return e === 0 ? e : +e;
274
+ e = Ze(e);
275
+ var r = tt.test(e);
276
+ return r || rt.test(e) ? nt(e.slice(2), r ? 2 : 8) : et.test(e) ? be : +e;
277
+ }
278
+ var ot = "[object AsyncFunction]", it = "[object Function]", at = "[object GeneratorFunction]", st = "[object Proxy]";
279
+ function ut(e) {
280
+ if (!x(e))
281
+ return !1;
282
+ var t = Se(e);
283
+ return t == it || t == at || t == ot || t == st;
284
+ }
285
+ var se = ee["__core-js_shared__"], ge = function() {
286
+ var e = /[^.]+$/.exec(se && se.keys && se.keys.IE_PROTO || "");
287
+ return e ? "Symbol(src)_1." + e : "";
288
+ }();
289
+ function ft(e) {
290
+ return !!ge && ge in e;
291
+ }
292
+ var lt = Function.prototype, ct = lt.toString;
293
+ function dt(e) {
294
+ if (e != null) {
295
+ try {
296
+ return ct.call(e);
297
+ } catch {
298
+ }
299
+ try {
300
+ return e + "";
301
+ } catch {
302
+ }
303
+ }
304
+ return "";
305
+ }
306
+ var ht = /[\\^$.*+?()[\]{}|]/g, pt = /^\[object .+?Constructor\]$/, vt = Function.prototype, mt = Object.prototype, bt = vt.toString, _t = mt.hasOwnProperty, gt = RegExp(
307
+ "^" + bt.call(_t).replace(ht, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
308
+ );
309
+ function Et(e) {
310
+ if (!x(e) || ft(e))
311
+ return !1;
312
+ var t = ut(e) ? gt : pt;
313
+ return t.test(dt(e));
314
+ }
315
+ function yt(e, t) {
316
+ return e == null ? void 0 : e[t];
317
+ }
318
+ function je(e, t) {
319
+ var r = yt(e, t);
320
+ return Et(r) ? r : void 0;
321
+ }
322
+ function Tt(e, t) {
323
+ return e === t || e !== e && t !== t;
324
+ }
325
+ var q = je(Object, "create");
326
+ function wt() {
327
+ this.__data__ = q ? q(null) : {}, this.size = 0;
328
+ }
329
+ function Ot(e) {
330
+ var t = this.has(e) && delete this.__data__[e];
331
+ return this.size -= t ? 1 : 0, t;
332
+ }
333
+ var Rt = "__lodash_hash_undefined__", St = Object.prototype, jt = St.hasOwnProperty;
334
+ function Ct(e) {
335
+ var t = this.__data__;
336
+ if (q) {
337
+ var r = t[e];
338
+ return r === Rt ? void 0 : r;
339
+ }
340
+ return jt.call(t, e) ? t[e] : void 0;
341
+ }
342
+ var Lt = Object.prototype, Pt = Lt.hasOwnProperty;
343
+ function Nt(e) {
344
+ var t = this.__data__;
345
+ return q ? t[e] !== void 0 : Pt.call(t, e);
346
+ }
347
+ var At = "__lodash_hash_undefined__";
348
+ function It(e, t) {
349
+ var r = this.__data__;
350
+ return this.size += this.has(e) ? 0 : 1, r[e] = q && t === void 0 ? At : t, this;
351
+ }
352
+ function M(e) {
353
+ var t = -1, r = e == null ? 0 : e.length;
354
+ for (this.clear(); ++t < r; ) {
355
+ var u = e[t];
356
+ this.set(u[0], u[1]);
357
+ }
358
+ }
359
+ M.prototype.clear = wt;
360
+ M.prototype.delete = Ot;
361
+ M.prototype.get = Ct;
362
+ M.prototype.has = Nt;
363
+ M.prototype.set = It;
364
+ function $t() {
365
+ this.__data__ = [], this.size = 0;
366
+ }
367
+ function te(e, t) {
368
+ for (var r = e.length; r--; )
369
+ if (Tt(e[r][0], t))
370
+ return r;
371
+ return -1;
372
+ }
373
+ var Mt = Array.prototype, kt = Mt.splice;
374
+ function Ft(e) {
375
+ var t = this.__data__, r = te(t, e);
376
+ if (r < 0)
377
+ return !1;
378
+ var u = t.length - 1;
379
+ return r == u ? t.pop() : kt.call(t, r, 1), --this.size, !0;
380
+ }
381
+ function Dt(e) {
382
+ var t = this.__data__, r = te(t, e);
383
+ return r < 0 ? void 0 : t[r][1];
384
+ }
385
+ function Wt(e) {
386
+ return te(this.__data__, e) > -1;
387
+ }
388
+ function xt(e, t) {
389
+ var r = this.__data__, u = te(r, e);
390
+ return u < 0 ? (++this.size, r.push([e, t])) : r[u][1] = t, this;
391
+ }
392
+ function z(e) {
393
+ var t = -1, r = e == null ? 0 : e.length;
394
+ for (this.clear(); ++t < r; ) {
395
+ var u = e[t];
396
+ this.set(u[0], u[1]);
397
+ }
398
+ }
399
+ z.prototype.clear = $t;
400
+ z.prototype.delete = Ft;
401
+ z.prototype.get = Dt;
402
+ z.prototype.has = Wt;
403
+ z.prototype.set = xt;
404
+ var zt = je(ee, "Map");
405
+ function Yt() {
406
+ this.size = 0, this.__data__ = {
407
+ hash: new M(),
408
+ map: new (zt || z)(),
409
+ string: new M()
410
+ };
411
+ }
412
+ function Gt(e) {
413
+ var t = typeof e;
414
+ return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null;
415
+ }
416
+ function re(e, t) {
417
+ var r = e.__data__;
418
+ return Gt(t) ? r[typeof t == "string" ? "string" : "hash"] : r.map;
419
+ }
420
+ function Ut(e) {
421
+ var t = re(this, e).delete(e);
422
+ return this.size -= t ? 1 : 0, t;
423
+ }
424
+ function Vt(e) {
425
+ return re(this, e).get(e);
426
+ }
427
+ function Ht(e) {
428
+ return re(this, e).has(e);
429
+ }
430
+ function qt(e, t) {
431
+ var r = re(this, e), u = r.size;
432
+ return r.set(e, t), this.size += r.size == u ? 0 : 1, this;
433
+ }
434
+ function k(e) {
435
+ var t = -1, r = e == null ? 0 : e.length;
436
+ for (this.clear(); ++t < r; ) {
437
+ var u = e[t];
438
+ this.set(u[0], u[1]);
439
+ }
440
+ }
441
+ k.prototype.clear = Yt;
442
+ k.prototype.delete = Ut;
443
+ k.prototype.get = Vt;
444
+ k.prototype.has = Ht;
445
+ k.prototype.set = qt;
446
+ var Jt = "Expected a function";
447
+ function fe(e, t) {
448
+ if (typeof e != "function" || t != null && typeof t != "function")
449
+ throw new TypeError(Jt);
450
+ var r = function() {
451
+ var u = arguments, l = t ? t.apply(this, u) : u[0], a = r.cache;
452
+ if (a.has(l))
453
+ return a.get(l);
454
+ var d = e.apply(this, u);
455
+ return r.cache = a.set(l, d) || a, d;
456
+ };
457
+ return r.cache = new (fe.Cache || k)(), r;
458
+ }
459
+ fe.Cache = k;
460
+ var ue = function() {
461
+ return ee.Date.now();
462
+ }, Xt = "Expected a function", Kt = Math.max, Bt = Math.min;
463
+ function ne(e, t, r) {
464
+ var u, l, a, d, h, m, _ = 0, y = !1, T = !1, j = !0;
465
+ if (typeof e != "function")
466
+ throw new TypeError(Xt);
467
+ t = _e(t) || 0, x(r) && (y = !!r.leading, T = "maxWait" in r, a = T ? Kt(_e(r.maxWait) || 0, t) : a, j = "trailing" in r ? !!r.trailing : j);
468
+ function C(n) {
469
+ var f = u, c = l;
470
+ return u = l = void 0, _ = n, d = e.apply(c, f), d;
471
+ }
472
+ function $(n) {
473
+ return _ = n, h = setTimeout(N, t), y ? C(n) : d;
474
+ }
475
+ function g(n) {
476
+ var f = n - m, c = n - _, b = t - f;
477
+ return T ? Bt(b, a - c) : b;
478
+ }
479
+ function w(n) {
480
+ var f = n - m, c = n - _;
481
+ return m === void 0 || f >= t || f < 0 || T && c >= a;
482
+ }
483
+ function N() {
484
+ var n = ue();
485
+ if (w(n))
486
+ return F(n);
487
+ h = setTimeout(N, g(n));
488
+ }
489
+ function F(n) {
490
+ return h = void 0, j && u ? C(n) : (u = l = void 0, d);
491
+ }
492
+ function D() {
493
+ h !== void 0 && clearTimeout(h), _ = 0, u = m = l = h = void 0;
494
+ }
495
+ function s() {
496
+ return h === void 0 ? d : F(ue());
497
+ }
498
+ function o() {
499
+ var n = ue(), f = w(n);
500
+ if (u = arguments, l = this, m = n, f) {
501
+ if (h === void 0)
502
+ return $(m);
503
+ if (T)
504
+ return clearTimeout(h), h = setTimeout(N, t), C(m);
505
+ }
506
+ return h === void 0 && (h = setTimeout(N, t)), d;
507
+ }
508
+ return o.cancel = D, o.flush = s, o;
509
+ }
510
+ var Qt = "Expected a function";
511
+ function Zt(e, t, r) {
512
+ var u = !0, l = !0;
513
+ if (typeof e != "function")
514
+ throw new TypeError(Qt);
515
+ return x(r) && (u = "leading" in r ? !!r.leading : u, l = "trailing" in r ? !!r.trailing : l), ne(e, t, {
516
+ leading: u,
517
+ maxWait: t,
518
+ trailing: l
519
+ });
520
+ }
521
+ class er {
522
+ /**
523
+ * Create a new Context instance.
524
+ * @param name - The name of the context (for debugging).
525
+ */
526
+ constructor(t) {
527
+ K(this, "event", new ke.EventEmitter());
528
+ /**
529
+ * The current data held by the context.
530
+ */
531
+ K(this, "data", {});
532
+ /**
533
+ * Registry for tracking active keys (for duplicate detection).
534
+ */
535
+ K(this, "registry", /* @__PURE__ */ new Set());
536
+ this.name = t, console.log("[CONTEXT] %s", t), this.event.setMaxListeners(100);
537
+ }
538
+ /**
539
+ * Publish a value to the context and notify subscribers if it changed.
540
+ * @param key - The key to update.
541
+ * @param value - The new value.
542
+ */
543
+ publish(t, r) {
544
+ r != this.data[t] && (this.data[t] = r, this.event.emit(String(t), { value: r }));
545
+ }
546
+ /**
547
+ * Subscribe to changes for a specific key in the context.
548
+ * @param key - The key to subscribe to.
549
+ * @param listender - Callback invoked with the new value.
550
+ * @returns Unsubscribe function.
551
+ */
552
+ subscribe(t, r) {
553
+ const u = ({ value: l }) => {
554
+ r(l);
555
+ };
556
+ return this.event.addListener(String(t), u), console.log("listenerCount:", String(t), this.event.listenerCount(String(t))), t in this.data && r(this.data[t]), () => (this.event.removeListener(String(t), u), void 0);
557
+ }
558
+ }
559
+ const tr = fe((e) => new er(e)), Ee = (e = "noname") => H(() => tr(e), [e]), Ce = (e, ...t) => {
560
+ const r = new Error("[ctx] useRegistryChecker failed " + JSON.stringify({ names: t, ctx: (e == null ? void 0 : e.name) ?? "undefined" }));
561
+ P(
562
+ () => {
563
+ if (e)
564
+ return t.some((u) => e.registry.has(u)) && console.error(r), t.forEach((u) => e.registry.add(u)), () => {
565
+ t.forEach((u) => e.registry.delete(u));
566
+ };
567
+ },
568
+ [e, t.length]
569
+ );
570
+ }, ur = (e, t, r) => {
571
+ P(() => {
572
+ e && e.data[t] != r && e.publish(t, r);
573
+ }, [t, r, e]), Ce(e, t);
574
+ }, fr = (e, t, r = 0) => {
575
+ const [{ value: u }, l] = J(() => {
576
+ var a;
577
+ return { value: (a = e == null ? void 0 : e.data) == null ? void 0 : a[t] };
578
+ });
579
+ return P(() => {
580
+ if (e) {
581
+ let a = r == 0 ? (h) => l({ value: h }) : ne((h) => l({ value: h }), r), d = e.subscribe(t, a);
582
+ return u != e.data[t] && l({ value: e.data[t] }), () => {
583
+ d();
584
+ };
585
+ }
586
+ }, [t, e]), e == null ? void 0 : e.data[t];
587
+ }, lr = (e, t, r) => {
588
+ const [, u] = J(0), l = H(
589
+ () => r(e == null ? void 0 : e.data[t]),
590
+ [r, e == null ? void 0 : e.data[t]]
591
+ );
592
+ return P(() => {
593
+ if (e) {
594
+ let a = l, d = () => {
595
+ let m = r(e.data[t]);
596
+ m != a && (a = m, u((_) => _ + 1));
597
+ }, h = e.subscribe(t, d);
598
+ return d(), () => h();
599
+ }
600
+ }, [t, e]), l;
601
+ }, rr = (e, ...t) => {
602
+ P(() => {
603
+ if (e)
604
+ for (let [r, u] of t)
605
+ e.data[r] != u && e.publish(r, u);
606
+ }, [e, ...t.flat()]), Ce(e, ...t.map((r) => r[0]));
607
+ }, cr = (e, ...t) => {
608
+ const [, r] = J(0), u = t.map((l) => {
609
+ var a;
610
+ return (a = e == null ? void 0 : e.data) == null ? void 0 : a[l];
611
+ });
612
+ return P(() => {
613
+ if (e) {
614
+ let l = u;
615
+ const a = ne(() => {
616
+ let m = t.map((_) => {
617
+ var y;
618
+ return (y = e == null ? void 0 : e.data) == null ? void 0 : y[_];
619
+ });
620
+ t.some((_, y) => l[y] != m[y]) && (l = m, r((_) => _ + 1));
621
+ }, 1);
622
+ let d = t.map((m) => e.subscribe(m, a)), h = setTimeout(a, 1);
623
+ return () => {
624
+ clearTimeout(h), a.cancel(), d.forEach((m) => m());
625
+ };
626
+ }
627
+ }, [e, ...t]), Object.fromEntries(t.map((l, a) => [l, u[a]]));
628
+ }, dr = (e, t = 100, ...r) => {
629
+ const [, u] = J(0), l = r.map((a) => {
630
+ var d;
631
+ return (d = e == null ? void 0 : e.data) == null ? void 0 : d[a];
632
+ });
633
+ return P(() => {
634
+ if (e) {
635
+ let a = l;
636
+ const d = Zt(() => {
637
+ let _ = r.map((y) => {
638
+ var T;
639
+ return (T = e == null ? void 0 : e.data) == null ? void 0 : T[y];
640
+ });
641
+ r.some((y, T) => a[T] != _[T]) && (a = _, u((y) => y + 1));
642
+ }, t);
643
+ let h = r.map((_) => e.subscribe(_, d)), m = setTimeout(d, 1);
644
+ return () => {
645
+ clearTimeout(m), d.cancel(), h.forEach((_) => _());
646
+ };
647
+ }
648
+ }, [e, ...r]), l;
649
+ };
650
+ var Q = { exports: {} }, U = {};
651
+ /**
652
+ * @license React
653
+ * react-jsx-runtime.production.js
654
+ *
655
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
656
+ *
657
+ * This source code is licensed under the MIT license found in the
658
+ * LICENSE file in the root directory of this source tree.
659
+ */
660
+ var ye;
661
+ function nr() {
662
+ if (ye) return U;
663
+ ye = 1;
664
+ var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
665
+ function r(u, l, a) {
666
+ var d = null;
667
+ if (a !== void 0 && (d = "" + a), l.key !== void 0 && (d = "" + l.key), "key" in l) {
668
+ a = {};
669
+ for (var h in l)
670
+ h !== "key" && (a[h] = l[h]);
671
+ } else a = l;
672
+ return l = a.ref, {
673
+ $$typeof: e,
674
+ type: u,
675
+ key: d,
676
+ ref: l !== void 0 ? l : null,
677
+ props: a
678
+ };
679
+ }
680
+ return U.Fragment = t, U.jsx = r, U.jsxs = r, U;
681
+ }
682
+ var V = {};
683
+ /**
684
+ * @license React
685
+ * react-jsx-runtime.development.js
686
+ *
687
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
688
+ *
689
+ * This source code is licensed under the MIT license found in the
690
+ * LICENSE file in the root directory of this source tree.
691
+ */
692
+ var Te;
693
+ function or() {
694
+ return Te || (Te = 1, process.env.NODE_ENV !== "production" && function() {
695
+ function e(i) {
696
+ if (i == null) return null;
697
+ if (typeof i == "function")
698
+ return i.$$typeof === v ? null : i.displayName || i.name || null;
699
+ if (typeof i == "string") return i;
700
+ switch (i) {
701
+ case g:
702
+ return "Fragment";
703
+ case N:
704
+ return "Profiler";
705
+ case w:
706
+ return "StrictMode";
707
+ case o:
708
+ return "Suspense";
709
+ case n:
710
+ return "SuspenseList";
711
+ case b:
712
+ return "Activity";
713
+ }
714
+ if (typeof i == "object")
715
+ switch (typeof i.tag == "number" && console.error(
716
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
717
+ ), i.$$typeof) {
718
+ case $:
719
+ return "Portal";
720
+ case D:
721
+ return (i.displayName || "Context") + ".Provider";
722
+ case F:
723
+ return (i._context.displayName || "Context") + ".Consumer";
724
+ case s:
725
+ var p = i.render;
726
+ return i = i.displayName, i || (i = p.displayName || p.name || "", i = i !== "" ? "ForwardRef(" + i + ")" : "ForwardRef"), i;
727
+ case f:
728
+ return p = i.displayName || null, p !== null ? p : e(i.type) || "Memo";
729
+ case c:
730
+ p = i._payload, i = i._init;
731
+ try {
732
+ return e(i(p));
733
+ } catch {
734
+ }
735
+ }
736
+ return null;
737
+ }
738
+ function t(i) {
739
+ return "" + i;
740
+ }
741
+ function r(i) {
742
+ try {
743
+ t(i);
744
+ var p = !1;
745
+ } catch {
746
+ p = !0;
747
+ }
748
+ if (p) {
749
+ p = console;
750
+ var E = p.error, O = typeof Symbol == "function" && Symbol.toStringTag && i[Symbol.toStringTag] || i.constructor.name || "Object";
751
+ return E.call(
752
+ p,
753
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
754
+ O
755
+ ), t(i);
756
+ }
757
+ }
758
+ function u(i) {
759
+ if (i === g) return "<>";
760
+ if (typeof i == "object" && i !== null && i.$$typeof === c)
761
+ return "<...>";
762
+ try {
763
+ var p = e(i);
764
+ return p ? "<" + p + ">" : "<...>";
765
+ } catch {
766
+ return "<...>";
767
+ }
768
+ }
769
+ function l() {
770
+ var i = S.A;
771
+ return i === null ? null : i.getOwner();
772
+ }
773
+ function a() {
774
+ return Error("react-stack-top-frame");
775
+ }
776
+ function d(i) {
777
+ if (A.call(i, "key")) {
778
+ var p = Object.getOwnPropertyDescriptor(i, "key").get;
779
+ if (p && p.isReactWarning) return !1;
780
+ }
781
+ return i.key !== void 0;
782
+ }
783
+ function h(i, p) {
784
+ function E() {
785
+ le || (le = !0, console.error(
786
+ "%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)",
787
+ p
788
+ ));
789
+ }
790
+ E.isReactWarning = !0, Object.defineProperty(i, "key", {
791
+ get: E,
792
+ configurable: !0
793
+ });
794
+ }
795
+ function m() {
796
+ var i = e(this.type);
797
+ return ce[i] || (ce[i] = !0, console.error(
798
+ "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."
799
+ )), i = this.props.ref, i !== void 0 ? i : null;
800
+ }
801
+ function _(i, p, E, O, I, L, oe, ie) {
802
+ return E = L.ref, i = {
803
+ $$typeof: C,
804
+ type: i,
805
+ key: p,
806
+ props: L,
807
+ _owner: I
808
+ }, (E !== void 0 ? E : null) !== null ? Object.defineProperty(i, "ref", {
809
+ enumerable: !1,
810
+ get: m
811
+ }) : Object.defineProperty(i, "ref", { enumerable: !1, value: null }), i._store = {}, Object.defineProperty(i._store, "validated", {
812
+ configurable: !1,
813
+ enumerable: !1,
814
+ writable: !0,
815
+ value: 0
816
+ }), Object.defineProperty(i, "_debugInfo", {
817
+ configurable: !1,
818
+ enumerable: !1,
819
+ writable: !0,
820
+ value: null
821
+ }), Object.defineProperty(i, "_debugStack", {
822
+ configurable: !1,
823
+ enumerable: !1,
824
+ writable: !0,
825
+ value: oe
826
+ }), Object.defineProperty(i, "_debugTask", {
827
+ configurable: !1,
828
+ enumerable: !1,
829
+ writable: !0,
830
+ value: ie
831
+ }), Object.freeze && (Object.freeze(i.props), Object.freeze(i)), i;
832
+ }
833
+ function y(i, p, E, O, I, L, oe, ie) {
834
+ var R = p.children;
835
+ if (R !== void 0)
836
+ if (O)
837
+ if (X(R)) {
838
+ for (O = 0; O < R.length; O++)
839
+ T(R[O]);
840
+ Object.freeze && Object.freeze(R);
841
+ } else
842
+ console.error(
843
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
844
+ );
845
+ else T(R);
846
+ if (A.call(p, "key")) {
847
+ R = e(i);
848
+ var W = Object.keys(p).filter(function(Le) {
849
+ return Le !== "key";
850
+ });
851
+ O = 0 < W.length ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}", pe[R + O] || (W = 0 < W.length ? "{" + W.join(": ..., ") + ": ...}" : "{}", console.error(
852
+ `A props object containing a "key" prop is being spread into JSX:
853
+ let props = %s;
854
+ <%s {...props} />
855
+ React keys must be passed directly to JSX without using spread:
856
+ let props = %s;
857
+ <%s key={someKey} {...props} />`,
858
+ O,
859
+ R,
860
+ W,
861
+ R
862
+ ), pe[R + O] = !0);
863
+ }
864
+ if (R = null, E !== void 0 && (r(E), R = "" + E), d(p) && (r(p.key), R = "" + p.key), "key" in p) {
865
+ E = {};
866
+ for (var ae in p)
867
+ ae !== "key" && (E[ae] = p[ae]);
868
+ } else E = p;
869
+ return R && h(
870
+ E,
871
+ typeof i == "function" ? i.displayName || i.name || "Unknown" : i
872
+ ), _(
873
+ i,
874
+ R,
875
+ L,
876
+ I,
877
+ l(),
878
+ E,
879
+ oe,
880
+ ie
881
+ );
882
+ }
883
+ function T(i) {
884
+ typeof i == "object" && i !== null && i.$$typeof === C && i._store && (i._store.validated = 1);
885
+ }
886
+ var j = Ae, C = Symbol.for("react.transitional.element"), $ = Symbol.for("react.portal"), g = Symbol.for("react.fragment"), w = Symbol.for("react.strict_mode"), N = Symbol.for("react.profiler"), F = Symbol.for("react.consumer"), D = Symbol.for("react.context"), s = Symbol.for("react.forward_ref"), o = Symbol.for("react.suspense"), n = Symbol.for("react.suspense_list"), f = Symbol.for("react.memo"), c = Symbol.for("react.lazy"), b = Symbol.for("react.activity"), v = Symbol.for("react.client.reference"), S = j.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, A = Object.prototype.hasOwnProperty, X = Array.isArray, Y = console.createTask ? console.createTask : function() {
887
+ return null;
888
+ };
889
+ j = {
890
+ "react-stack-bottom-frame": function(i) {
891
+ return i();
892
+ }
893
+ };
894
+ var le, ce = {}, de = j["react-stack-bottom-frame"].bind(
895
+ j,
896
+ a
897
+ )(), he = Y(u(a)), pe = {};
898
+ V.Fragment = g, V.jsx = function(i, p, E, O, I) {
899
+ var L = 1e4 > S.recentlyCreatedOwnerStacks++;
900
+ return y(
901
+ i,
902
+ p,
903
+ E,
904
+ !1,
905
+ O,
906
+ I,
907
+ L ? Error("react-stack-top-frame") : de,
908
+ L ? Y(u(i)) : he
909
+ );
910
+ }, V.jsxs = function(i, p, E, O, I) {
911
+ var L = 1e4 > S.recentlyCreatedOwnerStacks++;
912
+ return y(
913
+ i,
914
+ p,
915
+ E,
916
+ !0,
917
+ O,
918
+ I,
919
+ L ? Error("react-stack-top-frame") : de,
920
+ L ? Y(u(i)) : he
921
+ );
922
+ };
923
+ }()), V;
924
+ }
925
+ var we;
926
+ function ir() {
927
+ return we || (we = 1, process.env.NODE_ENV === "production" ? Q.exports = nr() : Q.exports = or()), Q.exports;
928
+ }
929
+ var Oe = ir();
930
+ const hr = (e, t) => {
931
+ const r = (l) => [
932
+ e,
933
+ ...Object.entries(l ?? {}).sort((a, d) => a[0].localeCompare(d[0])).flat()
934
+ ].join("-");
935
+ let u = !1;
936
+ return {
937
+ Root: (l) => {
938
+ const a = Ee(r(l)), d = t(l), h = H(() => new Error().stack, []);
939
+ return rr(
940
+ a,
941
+ ...Object.entries(d)
942
+ ), P(() => {
943
+ if (u == !0) {
944
+ const m = new Error("RootContext " + r(l) + " are mounted more than once");
945
+ throw m.stack = h, m;
946
+ }
947
+ return u = !0, () => {
948
+ u = !1;
949
+ };
950
+ }), /* @__PURE__ */ Oe.jsx(Oe.Fragment, {});
951
+ },
952
+ useCtxState: (l) => {
953
+ const a = H(() => new Error().stack, []);
954
+ return P(() => {
955
+ if (!u) {
956
+ const d = new Error("RootContext [" + r(l) + "] is not mounted");
957
+ throw d.stack = a, d;
958
+ }
959
+ }, [u]), Ee(r(l));
960
+ }
961
+ };
962
+ }, pr = (e) => {
963
+ const [, t] = J(0), { proxy: r, finalGetter: u, openGetter: l, clean: a } = H(
964
+ () => {
965
+ const d = /* @__PURE__ */ new Set(), h = {}, m = /* @__PURE__ */ new Map(), _ = new Proxy(
966
+ e == null ? void 0 : e.data,
967
+ {
968
+ get(g, w) {
969
+ if (y)
970
+ return d.add(w), h[w] = g[w];
971
+ throw new Error("now allow here");
972
+ }
973
+ }
974
+ );
975
+ let y = !0, T = ne(() => {
976
+ [...d.values()].some((g) => {
977
+ var w;
978
+ return h[g] != ((w = e == null ? void 0 : e.data) == null ? void 0 : w[g]);
979
+ }) && t((g) => g + 1);
980
+ }, 0), j = () => {
981
+ y = !0, d.clear();
982
+ }, C = () => {
983
+ y = !1, [...d.values()].filter((g) => !m.has(g)).forEach((g) => {
984
+ m.set(g, e == null ? void 0 : e.subscribe(g, T));
985
+ }), [...m.keys()].filter((g) => !d.has(g)).forEach((g) => {
986
+ let w = m.get(g);
987
+ w == null || w(), m.delete(g);
988
+ });
989
+ };
990
+ return { proxy: _, finalGetter: C, openGetter: j, clean: () => {
991
+ j(), C(), t((g) => g + 1);
992
+ } };
993
+ },
994
+ []
995
+ );
996
+ return l(), setTimeout(u, 0), P(
997
+ () => () => a(),
998
+ [a]
999
+ ), r;
1000
+ };
1001
+ export {
1002
+ er as Context,
1003
+ hr as createRootCtx,
1004
+ tr as getContext,
1005
+ Ee as useDataContext,
1006
+ ur as useDataSource,
1007
+ rr as useDataSourceMultiple,
1008
+ fr as useDataSubscribe,
1009
+ cr as useDataSubscribeMultiple,
1010
+ dr as useDataSubscribeMultipleWithDebounce,
1011
+ lr as useDataSubscribeWithTransform,
1012
+ pr as useQuickSubscribe
1013
+ };