react-state-custom 1.0.7 → 1.0.9

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/index.es.js CHANGED
@@ -1,12 +1,12 @@
1
- var Ne = Object.defineProperty;
2
- var Ae = (e, t, r) => t in e ? Ne(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var Q = (e, t, r) => Ae(e, typeof t != "symbol" ? t + "" : t, r);
4
- import ke, { useMemo as z, useEffect as L, useState as U, useCallback as Me, Fragment as $e } from "react";
5
- function Ie(e) {
1
+ var Ae = Object.defineProperty;
2
+ var ke = (e, t, r) => t in e ? Ae(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var Q = (e, t, r) => ke(e, typeof t != "symbol" ? t + "" : t, r);
4
+ import Me, { useRef as $e, useMemo as z, useEffect as L, useState as U, useCallback as Ie, Fragment as xe } from "react";
5
+ function De(e) {
6
6
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
7
7
  }
8
8
  var Z = { exports: {} }, be;
9
- function xe() {
9
+ function Fe() {
10
10
  if (be) return Z.exports;
11
11
  be = 1;
12
12
  var e = typeof Reflect == "object" ? Reflect : null, t = e && typeof e.apply == "function" ? e.apply : function(a, o, l) {
@@ -28,7 +28,7 @@ function xe() {
28
28
  }
29
29
  Z.exports = n, Z.exports.once = N, n.EventEmitter = n, n.prototype._events = void 0, n.prototype._eventsCount = 0, n.prototype._maxListeners = void 0;
30
30
  var c = 10;
31
- function h(s) {
31
+ function d(s) {
32
32
  if (typeof s != "function")
33
33
  throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof s);
34
34
  }
@@ -56,12 +56,12 @@ function xe() {
56
56
  return p(this);
57
57
  }, n.prototype.emit = function(a) {
58
58
  for (var o = [], l = 1; l < arguments.length; l++) o.push(arguments[l]);
59
- var d = a === "error", _ = this._events;
59
+ var h = a === "error", _ = this._events;
60
60
  if (_ !== void 0)
61
- d = d && _.error === void 0;
62
- else if (!d)
61
+ h = h && _.error === void 0;
62
+ else if (!h)
63
63
  return !1;
64
- if (d) {
64
+ if (h) {
65
65
  var b;
66
66
  if (o.length > 0 && (b = o[0]), b instanceof Error)
67
67
  throw b;
@@ -74,19 +74,19 @@ function xe() {
74
74
  if (typeof A == "function")
75
75
  t(A, this, o);
76
76
  else
77
- for (var B = A.length, H = M(A, B), l = 0; l < B; ++l)
78
- t(H[l], this, o);
77
+ for (var B = A.length, V = M(A, B), l = 0; l < B; ++l)
78
+ t(V[l], this, o);
79
79
  return !0;
80
80
  };
81
81
  function v(s, a, o, l) {
82
- var d, _, b;
83
- if (h(o), _ = s._events, _ === void 0 ? (_ = s._events = /* @__PURE__ */ Object.create(null), s._eventsCount = 0) : (_.newListener !== void 0 && (s.emit(
82
+ var h, _, b;
83
+ if (d(o), _ = s._events, _ === void 0 ? (_ = s._events = /* @__PURE__ */ Object.create(null), s._eventsCount = 0) : (_.newListener !== void 0 && (s.emit(
84
84
  "newListener",
85
85
  a,
86
86
  o.listener ? o.listener : o
87
87
  ), _ = s._events), b = _[a]), b === void 0)
88
88
  b = _[a] = o, ++s._eventsCount;
89
- else if (typeof b == "function" ? b = _[a] = l ? [o, b] : [b, o] : l ? b.unshift(o) : b.push(o), d = p(s), d > 0 && b.length > d && !b.warned) {
89
+ else if (typeof b == "function" ? b = _[a] = l ? [o, b] : [b, o] : l ? b.unshift(o) : b.push(o), h = p(s), h > 0 && b.length > h && !b.warned) {
90
90
  b.warned = !0;
91
91
  var j = new Error("Possible EventEmitter memory leak detected. " + b.length + " " + String(a) + " listeners added. Use emitter.setMaxListeners() to increase limit");
92
92
  j.name = "MaxListenersExceededWarning", j.emitter = s, j.type = a, j.count = b.length, u(j);
@@ -102,22 +102,22 @@ function xe() {
102
102
  if (!this.fired)
103
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
104
  }
105
- function y(s, a, o) {
106
- var l = { fired: !1, wrapFn: void 0, target: s, type: a, listener: o }, d = g.bind(l);
107
- return d.listener = o, l.wrapFn = d, d;
105
+ function E(s, a, o) {
106
+ var l = { fired: !1, wrapFn: void 0, target: s, type: a, listener: o }, h = g.bind(l);
107
+ return h.listener = o, l.wrapFn = h, h;
108
108
  }
109
109
  n.prototype.once = function(a, o) {
110
- return h(o), this.on(a, y(this, a, o)), this;
110
+ return d(o), this.on(a, E(this, a, o)), this;
111
111
  }, n.prototype.prependOnceListener = function(a, o) {
112
- return h(o), this.prependListener(a, y(this, a, o)), this;
112
+ return d(o), this.prependListener(a, E(this, a, o)), this;
113
113
  }, n.prototype.removeListener = function(a, o) {
114
- var l, d, _, b, j;
115
- if (h(o), d = this._events, d === void 0)
114
+ var l, h, _, b, j;
115
+ if (d(o), h = this._events, h === void 0)
116
116
  return this;
117
- if (l = d[a], l === void 0)
117
+ if (l = h[a], l === void 0)
118
118
  return this;
119
119
  if (l === o || l.listener === o)
120
- --this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete d[a], d.removeListener && this.emit("removeListener", a, l.listener || o));
120
+ --this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete h[a], h.removeListener && this.emit("removeListener", a, l.listener || o));
121
121
  else if (typeof l != "function") {
122
122
  for (_ = -1, b = l.length - 1; b >= 0; b--)
123
123
  if (l[b] === o || l[b].listener === o) {
@@ -126,34 +126,34 @@ function xe() {
126
126
  }
127
127
  if (_ < 0)
128
128
  return this;
129
- _ === 0 ? l.shift() : E(l, _), l.length === 1 && (d[a] = l[0]), d.removeListener !== void 0 && this.emit("removeListener", a, j || o);
129
+ _ === 0 ? l.shift() : y(l, _), l.length === 1 && (h[a] = l[0]), h.removeListener !== void 0 && this.emit("removeListener", a, j || o);
130
130
  }
131
131
  return this;
132
132
  }, n.prototype.off = n.prototype.removeListener, n.prototype.removeAllListeners = function(a) {
133
- var o, l, d;
133
+ var o, l, h;
134
134
  if (l = this._events, l === void 0)
135
135
  return this;
136
136
  if (l.removeListener === void 0)
137
137
  return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : l[a] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete l[a]), this;
138
138
  if (arguments.length === 0) {
139
139
  var _ = Object.keys(l), b;
140
- for (d = 0; d < _.length; ++d)
141
- b = _[d], b !== "removeListener" && this.removeAllListeners(b);
140
+ for (h = 0; h < _.length; ++h)
141
+ b = _[h], b !== "removeListener" && this.removeAllListeners(b);
142
142
  return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
143
143
  }
144
144
  if (o = l[a], typeof o == "function")
145
145
  this.removeListener(a, o);
146
146
  else if (o !== void 0)
147
- for (d = o.length - 1; d >= 0; d--)
148
- this.removeListener(a, o[d]);
147
+ for (h = o.length - 1; h >= 0; h--)
148
+ this.removeListener(a, o[h]);
149
149
  return this;
150
150
  };
151
151
  function T(s, a, o) {
152
152
  var l = s._events;
153
153
  if (l === void 0)
154
154
  return [];
155
- var d = l[a];
156
- return d === void 0 ? [] : typeof d == "function" ? o ? [d.listener || d] : [d] : o ? O(d) : M(d, d.length);
155
+ var h = l[a];
156
+ return h === void 0 ? [] : typeof h == "function" ? o ? [h.listener || h] : [h] : o ? O(h) : M(h, h.length);
157
157
  }
158
158
  n.prototype.listeners = function(a) {
159
159
  return T(this, a, !0);
@@ -181,7 +181,7 @@ function xe() {
181
181
  o[l] = s[l];
182
182
  return o;
183
183
  }
184
- function E(s, a) {
184
+ function y(s, a) {
185
185
  for (; a + 1 < s.length; a++)
186
186
  s[a] = s[a + 1];
187
187
  s.pop();
@@ -193,13 +193,13 @@ function xe() {
193
193
  }
194
194
  function N(s, a) {
195
195
  return new Promise(function(o, l) {
196
- function d(b) {
196
+ function h(b) {
197
197
  s.removeListener(a, _), l(b);
198
198
  }
199
199
  function _() {
200
- typeof s.removeListener == "function" && s.removeListener("error", d), o([].slice.call(arguments));
200
+ typeof s.removeListener == "function" && s.removeListener("error", h), o([].slice.call(arguments));
201
201
  }
202
- D(s, a, _, { once: !0 }), a !== "error" && x(s, d, { once: !0 });
202
+ D(s, a, _, { once: !0 }), a !== "error" && x(s, h, { once: !0 });
203
203
  });
204
204
  }
205
205
  function x(s, a, o) {
@@ -209,61 +209,61 @@ function xe() {
209
209
  if (typeof s.on == "function")
210
210
  l.once ? s.once(a, o) : s.on(a, o);
211
211
  else if (typeof s.addEventListener == "function")
212
- s.addEventListener(a, function d(_) {
213
- l.once && s.removeEventListener(a, d), o(_);
212
+ s.addEventListener(a, function h(_) {
213
+ l.once && s.removeEventListener(a, h), o(_);
214
214
  });
215
215
  else
216
216
  throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof s);
217
217
  }
218
218
  return Z.exports;
219
219
  }
220
- var De = xe();
221
- const Fe = /* @__PURE__ */ Ie(De);
222
- var We = typeof global == "object" && global && global.Object === Object && global, ze = typeof self == "object" && self && self.Object === Object && self, re = We || ze || Function("return this")(), te = re.Symbol, Re = Object.prototype, Ye = Re.hasOwnProperty, Ge = Re.toString, q = te ? te.toStringTag : void 0;
223
- function Ue(e) {
224
- var t = Ye.call(e, q), r = e[q];
220
+ var We = Fe();
221
+ const ze = /* @__PURE__ */ De(We);
222
+ var Ye = typeof global == "object" && global && global.Object === Object && global, Ge = typeof self == "object" && self && self.Object === Object && self, re = Ye || Ge || Function("return this")(), te = re.Symbol, Se = Object.prototype, Ue = Se.hasOwnProperty, He = Se.toString, q = te ? te.toStringTag : void 0;
223
+ function Ve(e) {
224
+ var t = Ue.call(e, q), r = e[q];
225
225
  try {
226
226
  e[q] = void 0;
227
227
  var u = !0;
228
228
  } catch {
229
229
  }
230
- var f = Ge.call(e);
230
+ var f = He.call(e);
231
231
  return u && (t ? e[q] = r : delete e[q]), f;
232
232
  }
233
- var Ve = Object.prototype, He = Ve.toString;
234
- function qe(e) {
235
- return He.call(e);
233
+ var qe = Object.prototype, Je = qe.toString;
234
+ function Xe(e) {
235
+ return Je.call(e);
236
236
  }
237
- var Je = "[object Null]", Xe = "[object Undefined]", ge = te ? te.toStringTag : void 0;
238
- function Se(e) {
239
- return e == null ? e === void 0 ? Xe : Je : ge && ge in Object(e) ? Ue(e) : qe(e);
237
+ var Ke = "[object Null]", Be = "[object Undefined]", ge = te ? te.toStringTag : void 0;
238
+ function je(e) {
239
+ return e == null ? e === void 0 ? Be : Ke : ge && ge in Object(e) ? Ve(e) : Xe(e);
240
240
  }
241
- function Ke(e) {
242
- return e != null && typeof e == "object";
243
- }
244
- var Be = "[object Symbol]";
245
241
  function Qe(e) {
246
- return typeof e == "symbol" || Ke(e) && Se(e) == Be;
242
+ return e != null && typeof e == "object";
247
243
  }
248
- var Ze = /\s/;
244
+ var Ze = "[object Symbol]";
249
245
  function et(e) {
250
- for (var t = e.length; t-- && Ze.test(e.charAt(t)); )
246
+ return typeof e == "symbol" || Qe(e) && je(e) == Ze;
247
+ }
248
+ var tt = /\s/;
249
+ function rt(e) {
250
+ for (var t = e.length; t-- && tt.test(e.charAt(t)); )
251
251
  ;
252
252
  return t;
253
253
  }
254
- var tt = /^\s+/;
255
- function rt(e) {
256
- return e && e.slice(0, et(e) + 1).replace(tt, "");
254
+ var nt = /^\s+/;
255
+ function ot(e) {
256
+ return e && e.slice(0, rt(e) + 1).replace(nt, "");
257
257
  }
258
258
  function G(e) {
259
259
  var t = typeof e;
260
260
  return e != null && (t == "object" || t == "function");
261
261
  }
262
- var _e = NaN, nt = /^[-+]0x[0-9a-f]+$/i, ot = /^0b[01]+$/i, at = /^0o[0-7]+$/i, it = parseInt;
263
- function Ee(e) {
262
+ var _e = NaN, at = /^[-+]0x[0-9a-f]+$/i, it = /^0b[01]+$/i, st = /^0o[0-7]+$/i, ut = parseInt;
263
+ function ye(e) {
264
264
  if (typeof e == "number")
265
265
  return e;
266
- if (Qe(e))
266
+ if (et(e))
267
267
  return _e;
268
268
  if (G(e)) {
269
269
  var t = typeof e.valueOf == "function" ? e.valueOf() : e;
@@ -271,29 +271,29 @@ function Ee(e) {
271
271
  }
272
272
  if (typeof e != "string")
273
273
  return e === 0 ? e : +e;
274
- e = rt(e);
275
- var r = ot.test(e);
276
- return r || at.test(e) ? it(e.slice(2), r ? 2 : 8) : nt.test(e) ? _e : +e;
274
+ e = ot(e);
275
+ var r = it.test(e);
276
+ return r || st.test(e) ? ut(e.slice(2), r ? 2 : 8) : at.test(e) ? _e : +e;
277
277
  }
278
- var st = "[object AsyncFunction]", ut = "[object Function]", ct = "[object GeneratorFunction]", lt = "[object Proxy]";
279
- function ft(e) {
278
+ var ct = "[object AsyncFunction]", ft = "[object Function]", lt = "[object GeneratorFunction]", dt = "[object Proxy]";
279
+ function ht(e) {
280
280
  if (!G(e))
281
281
  return !1;
282
- var t = Se(e);
283
- return t == ut || t == ct || t == st || t == lt;
282
+ var t = je(e);
283
+ return t == ft || t == lt || t == ct || t == dt;
284
284
  }
285
- var ce = re["__core-js_shared__"], ye = function() {
285
+ var ce = re["__core-js_shared__"], Ee = function() {
286
286
  var e = /[^.]+$/.exec(ce && ce.keys && ce.keys.IE_PROTO || "");
287
287
  return e ? "Symbol(src)_1." + e : "";
288
288
  }();
289
- function dt(e) {
290
- return !!ye && ye in e;
289
+ function pt(e) {
290
+ return !!Ee && Ee in e;
291
291
  }
292
- var ht = Function.prototype, pt = ht.toString;
293
- function vt(e) {
292
+ var vt = Function.prototype, mt = vt.toString;
293
+ function bt(e) {
294
294
  if (e != null) {
295
295
  try {
296
- return pt.call(e);
296
+ return mt.call(e);
297
297
  } catch {
298
298
  }
299
299
  try {
@@ -303,51 +303,51 @@ function vt(e) {
303
303
  }
304
304
  return "";
305
305
  }
306
- var mt = /[\\^$.*+?()[\]{}|]/g, bt = /^\[object .+?Constructor\]$/, gt = Function.prototype, _t = Object.prototype, Et = gt.toString, yt = _t.hasOwnProperty, wt = RegExp(
307
- "^" + Et.call(yt).replace(mt, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
306
+ var gt = /[\\^$.*+?()[\]{}|]/g, _t = /^\[object .+?Constructor\]$/, yt = Function.prototype, Et = Object.prototype, wt = yt.toString, Tt = Et.hasOwnProperty, Ot = RegExp(
307
+ "^" + wt.call(Tt).replace(gt, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
308
308
  );
309
- function Tt(e) {
310
- if (!G(e) || dt(e))
309
+ function Rt(e) {
310
+ if (!G(e) || pt(e))
311
311
  return !1;
312
- var t = ft(e) ? wt : bt;
313
- return t.test(vt(e));
312
+ var t = ht(e) ? Ot : _t;
313
+ return t.test(bt(e));
314
314
  }
315
- function Ot(e, t) {
315
+ function St(e, t) {
316
316
  return e == null ? void 0 : e[t];
317
317
  }
318
- function je(e, t) {
319
- var r = Ot(e, t);
320
- return Tt(r) ? r : void 0;
318
+ function Ce(e, t) {
319
+ var r = St(e, t);
320
+ return Rt(r) ? r : void 0;
321
321
  }
322
- function Rt(e, t) {
322
+ function jt(e, t) {
323
323
  return e === t || e !== e && t !== t;
324
324
  }
325
- var K = je(Object, "create");
326
- function St() {
325
+ var K = Ce(Object, "create");
326
+ function Ct() {
327
327
  this.__data__ = K ? K(null) : {}, this.size = 0;
328
328
  }
329
- function jt(e) {
329
+ function Lt(e) {
330
330
  var t = this.has(e) && delete this.__data__[e];
331
331
  return this.size -= t ? 1 : 0, t;
332
332
  }
333
- var Ct = "__lodash_hash_undefined__", Lt = Object.prototype, Pt = Lt.hasOwnProperty;
334
- function Nt(e) {
333
+ var Pt = "__lodash_hash_undefined__", Nt = Object.prototype, At = Nt.hasOwnProperty;
334
+ function kt(e) {
335
335
  var t = this.__data__;
336
336
  if (K) {
337
337
  var r = t[e];
338
- return r === Ct ? void 0 : r;
338
+ return r === Pt ? void 0 : r;
339
339
  }
340
- return Pt.call(t, e) ? t[e] : void 0;
340
+ return At.call(t, e) ? t[e] : void 0;
341
341
  }
342
- var At = Object.prototype, kt = At.hasOwnProperty;
343
- function Mt(e) {
342
+ var Mt = Object.prototype, $t = Mt.hasOwnProperty;
343
+ function It(e) {
344
344
  var t = this.__data__;
345
- return K ? t[e] !== void 0 : kt.call(t, e);
345
+ return K ? t[e] !== void 0 : $t.call(t, e);
346
346
  }
347
- var $t = "__lodash_hash_undefined__";
348
- function It(e, t) {
347
+ var xt = "__lodash_hash_undefined__";
348
+ function Dt(e, t) {
349
349
  var r = this.__data__;
350
- return this.size += this.has(e) ? 0 : 1, r[e] = K && t === void 0 ? $t : t, this;
350
+ return this.size += this.has(e) ? 0 : 1, r[e] = K && t === void 0 ? xt : t, this;
351
351
  }
352
352
  function $(e) {
353
353
  var t = -1, r = e == null ? 0 : e.length;
@@ -356,78 +356,78 @@ function $(e) {
356
356
  this.set(u[0], u[1]);
357
357
  }
358
358
  }
359
- $.prototype.clear = St;
360
- $.prototype.delete = jt;
361
- $.prototype.get = Nt;
362
- $.prototype.has = Mt;
363
- $.prototype.set = It;
364
- function xt() {
359
+ $.prototype.clear = Ct;
360
+ $.prototype.delete = Lt;
361
+ $.prototype.get = kt;
362
+ $.prototype.has = It;
363
+ $.prototype.set = Dt;
364
+ function Ft() {
365
365
  this.__data__ = [], this.size = 0;
366
366
  }
367
367
  function ne(e, t) {
368
368
  for (var r = e.length; r--; )
369
- if (Rt(e[r][0], t))
369
+ if (jt(e[r][0], t))
370
370
  return r;
371
371
  return -1;
372
372
  }
373
- var Dt = Array.prototype, Ft = Dt.splice;
374
- function Wt(e) {
373
+ var Wt = Array.prototype, zt = Wt.splice;
374
+ function Yt(e) {
375
375
  var t = this.__data__, r = ne(t, e);
376
376
  if (r < 0)
377
377
  return !1;
378
378
  var u = t.length - 1;
379
- return r == u ? t.pop() : Ft.call(t, r, 1), --this.size, !0;
379
+ return r == u ? t.pop() : zt.call(t, r, 1), --this.size, !0;
380
380
  }
381
- function zt(e) {
381
+ function Gt(e) {
382
382
  var t = this.__data__, r = ne(t, e);
383
383
  return r < 0 ? void 0 : t[r][1];
384
384
  }
385
- function Yt(e) {
385
+ function Ut(e) {
386
386
  return ne(this.__data__, e) > -1;
387
387
  }
388
- function Gt(e, t) {
388
+ function Ht(e, t) {
389
389
  var r = this.__data__, u = ne(r, e);
390
390
  return u < 0 ? (++this.size, r.push([e, t])) : r[u][1] = t, this;
391
391
  }
392
- function V(e) {
392
+ function H(e) {
393
393
  var t = -1, r = e == null ? 0 : e.length;
394
394
  for (this.clear(); ++t < r; ) {
395
395
  var u = e[t];
396
396
  this.set(u[0], u[1]);
397
397
  }
398
398
  }
399
- V.prototype.clear = xt;
400
- V.prototype.delete = Wt;
401
- V.prototype.get = zt;
402
- V.prototype.has = Yt;
403
- V.prototype.set = Gt;
404
- var Ut = je(re, "Map");
405
- function Vt() {
399
+ H.prototype.clear = Ft;
400
+ H.prototype.delete = Yt;
401
+ H.prototype.get = Gt;
402
+ H.prototype.has = Ut;
403
+ H.prototype.set = Ht;
404
+ var Vt = Ce(re, "Map");
405
+ function qt() {
406
406
  this.size = 0, this.__data__ = {
407
407
  hash: new $(),
408
- map: new (Ut || V)(),
408
+ map: new (Vt || H)(),
409
409
  string: new $()
410
410
  };
411
411
  }
412
- function Ht(e) {
412
+ function Jt(e) {
413
413
  var t = typeof e;
414
414
  return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null;
415
415
  }
416
416
  function oe(e, t) {
417
417
  var r = e.__data__;
418
- return Ht(t) ? r[typeof t == "string" ? "string" : "hash"] : r.map;
418
+ return Jt(t) ? r[typeof t == "string" ? "string" : "hash"] : r.map;
419
419
  }
420
- function qt(e) {
420
+ function Xt(e) {
421
421
  var t = oe(this, e).delete(e);
422
422
  return this.size -= t ? 1 : 0, t;
423
423
  }
424
- function Jt(e) {
424
+ function Kt(e) {
425
425
  return oe(this, e).get(e);
426
426
  }
427
- function Xt(e) {
427
+ function Bt(e) {
428
428
  return oe(this, e).has(e);
429
429
  }
430
- function Kt(e, t) {
430
+ function Qt(e, t) {
431
431
  var r = oe(this, e), u = r.size;
432
432
  return r.set(e, t), this.size += r.size == u ? 0 : 1, this;
433
433
  }
@@ -438,15 +438,15 @@ function I(e) {
438
438
  this.set(u[0], u[1]);
439
439
  }
440
440
  }
441
- I.prototype.clear = Vt;
442
- I.prototype.delete = qt;
443
- I.prototype.get = Jt;
444
- I.prototype.has = Xt;
445
- I.prototype.set = Kt;
446
- var Bt = "Expected a function";
447
- function fe(e, t) {
441
+ I.prototype.clear = qt;
442
+ I.prototype.delete = Xt;
443
+ I.prototype.get = Kt;
444
+ I.prototype.has = Bt;
445
+ I.prototype.set = Qt;
446
+ var Zt = "Expected a function";
447
+ function le(e, t) {
448
448
  if (typeof e != "function" || t != null && typeof t != "function")
449
- throw new TypeError(Bt);
449
+ throw new TypeError(Zt);
450
450
  var r = function() {
451
451
  var u = arguments, f = t ? t.apply(this, u) : u[0], n = r.cache;
452
452
  if (n.has(f))
@@ -454,77 +454,89 @@ function fe(e, t) {
454
454
  var c = e.apply(this, u);
455
455
  return r.cache = n.set(f, c) || n, c;
456
456
  };
457
- return r.cache = new (fe.Cache || I)(), r;
457
+ return r.cache = new (le.Cache || I)(), r;
458
458
  }
459
- fe.Cache = I;
460
- var le = function() {
459
+ le.Cache = I;
460
+ var fe = function() {
461
461
  return re.Date.now();
462
- }, Qt = "Expected a function", Zt = Math.max, er = Math.min;
462
+ }, er = "Expected a function", tr = Math.max, rr = Math.min;
463
463
  function ae(e, t, r) {
464
- var u, f, n, c, h, p, v = 0, g = !1, y = !1, T = !0;
464
+ var u, f, n, c, d, p, v = 0, g = !1, E = !1, T = !0;
465
465
  if (typeof e != "function")
466
- throw new TypeError(Qt);
467
- t = Ee(t) || 0, G(r) && (g = !!r.leading, y = "maxWait" in r, n = y ? Zt(Ee(r.maxWait) || 0, t) : n, T = "trailing" in r ? !!r.trailing : T);
466
+ throw new TypeError(er);
467
+ t = ye(t) || 0, G(r) && (g = !!r.leading, E = "maxWait" in r, n = E ? tr(ye(r.maxWait) || 0, t) : n, T = "trailing" in r ? !!r.trailing : T);
468
468
  function C(o) {
469
- var l = u, d = f;
470
- return u = f = void 0, v = o, c = e.apply(d, l), c;
469
+ var l = u, h = f;
470
+ return u = f = void 0, v = o, c = e.apply(h, l), c;
471
471
  }
472
472
  function M(o) {
473
- return v = o, h = setTimeout(N, t), g ? C(o) : c;
473
+ return v = o, d = setTimeout(N, t), g ? C(o) : c;
474
474
  }
475
- function E(o) {
476
- var l = o - p, d = o - v, _ = t - l;
477
- return y ? er(_, n - d) : _;
475
+ function y(o) {
476
+ var l = o - p, h = o - v, _ = t - l;
477
+ return E ? rr(_, n - h) : _;
478
478
  }
479
479
  function O(o) {
480
- var l = o - p, d = o - v;
481
- return p === void 0 || l >= t || l < 0 || y && d >= n;
480
+ var l = o - p, h = o - v;
481
+ return p === void 0 || l >= t || l < 0 || E && h >= n;
482
482
  }
483
483
  function N() {
484
- var o = le();
484
+ var o = fe();
485
485
  if (O(o))
486
486
  return x(o);
487
- h = setTimeout(N, E(o));
487
+ d = setTimeout(N, y(o));
488
488
  }
489
489
  function x(o) {
490
- return h = void 0, T && u ? C(o) : (u = f = void 0, c);
490
+ return d = void 0, T && u ? C(o) : (u = f = void 0, c);
491
491
  }
492
492
  function D() {
493
- h !== void 0 && clearTimeout(h), v = 0, u = p = f = h = void 0;
493
+ d !== void 0 && clearTimeout(d), v = 0, u = p = f = d = void 0;
494
494
  }
495
495
  function s() {
496
- return h === void 0 ? c : x(le());
496
+ return d === void 0 ? c : x(fe());
497
497
  }
498
498
  function a() {
499
- var o = le(), l = O(o);
499
+ var o = fe(), l = O(o);
500
500
  if (u = arguments, f = this, p = o, l) {
501
- if (h === void 0)
501
+ if (d === void 0)
502
502
  return M(p);
503
- if (y)
504
- return clearTimeout(h), h = setTimeout(N, t), C(p);
503
+ if (E)
504
+ return clearTimeout(d), d = setTimeout(N, t), C(p);
505
505
  }
506
- return h === void 0 && (h = setTimeout(N, t)), c;
506
+ return d === void 0 && (d = setTimeout(N, t)), c;
507
507
  }
508
508
  return a.cancel = D, a.flush = s, a;
509
509
  }
510
- var tr = "Expected a function";
511
- function rr(e, t, r) {
510
+ var nr = "Expected a function";
511
+ function or(e, t, r) {
512
512
  var u = !0, f = !0;
513
513
  if (typeof e != "function")
514
- throw new TypeError(tr);
514
+ throw new TypeError(nr);
515
515
  return G(r) && (u = "leading" in r ? !!r.leading : u, f = "trailing" in r ? !!r.trailing : f), ae(e, t, {
516
516
  leading: u,
517
517
  maxWait: t,
518
518
  trailing: f
519
519
  });
520
520
  }
521
- class nr {
521
+ const we = () => Math.random().toString().slice(2), ar = (e) => {
522
+ const { current: { computedHash: t } } = $e({
523
+ get computedHash() {
524
+ let r = [], u = we();
525
+ return (f) => {
526
+ let n = !1;
527
+ return n = n || !f != !r, n = n || (f == null ? void 0 : f.length) != (r == null ? void 0 : r.length), n = n || f.some((c, d) => c != r[d]), r = f, n && (u = we()), u;
528
+ };
529
+ }
530
+ });
531
+ return t(e);
532
+ };
533
+ class ir {
522
534
  /**
523
535
  * Create a new Context instance.
524
536
  * @param name - The name of the context (for debugging).
525
537
  */
526
538
  constructor(t) {
527
- Q(this, "event", new Fe.EventEmitter());
539
+ Q(this, "event", new ze.EventEmitter());
528
540
  /**
529
541
  * The current data held by the context.
530
542
  */
@@ -553,10 +565,10 @@ class nr {
553
565
  const u = ({ value: f }) => {
554
566
  r(f);
555
567
  };
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);
568
+ return this.event.addListener(String(t), u), t in this.data && r(this.data[t]), () => (this.event.removeListener(String(t), u), void 0);
557
569
  }
558
570
  }
559
- const or = fe((e) => new nr(e)), Y = (e = "noname") => z(() => or(e), [e]), Ce = (e, ...t) => {
571
+ const sr = le((e) => new ir(e)), Y = (e = "noname") => z(() => sr(e), [e]), Le = (e, ...t) => {
560
572
  const r = new Error("[ctx] useRegistryChecker failed " + JSON.stringify({ names: t, ctx: (e == null ? void 0 : e.name) ?? "undefined" }));
561
573
  L(
562
574
  () => {
@@ -567,24 +579,24 @@ const or = fe((e) => new nr(e)), Y = (e = "noname") => z(() => or(e), [e]), Ce =
567
579
  },
568
580
  [e, t.length]
569
581
  );
570
- }, hr = (e, t, r) => {
582
+ }, mr = (e, t, r) => {
571
583
  L(() => {
572
584
  e && e.data[t] != r && e.publish(t, r);
573
- }, [t, r, e]), Ce(e, t);
574
- }, ar = (e, t, r = 0) => {
585
+ }, [t, r, e]), Le(e, t);
586
+ }, ur = (e, t, r = 0) => {
575
587
  const [{ value: u }, f] = U(() => {
576
588
  var n;
577
589
  return { value: (n = e == null ? void 0 : e.data) == null ? void 0 : n[t] };
578
590
  });
579
591
  return L(() => {
580
592
  if (e) {
581
- let n = r == 0 ? (h) => f({ value: h }) : ae((h) => f({ value: h }), r), c = e.subscribe(t, n);
593
+ let n = r == 0 ? (d) => f({ value: d }) : ae((d) => f({ value: d }), r), c = e.subscribe(t, n);
582
594
  return u != e.data[t] && f({ value: e.data[t] }), () => {
583
595
  c();
584
596
  };
585
597
  }
586
598
  }, [t, e]), e == null ? void 0 : e.data[t];
587
- }, pr = (e, t, r) => {
599
+ }, br = (e, t, r) => {
588
600
  const [, u] = U(0), f = z(
589
601
  () => r(e == null ? void 0 : e.data[t]),
590
602
  [r, e == null ? void 0 : e.data[t]]
@@ -594,17 +606,17 @@ const or = fe((e) => new nr(e)), Y = (e = "noname") => z(() => or(e), [e]), Ce =
594
606
  let n = f, c = () => {
595
607
  let p = r(e.data[t]);
596
608
  p != n && (n = p, u((v) => v + 1));
597
- }, h = e.subscribe(t, c);
598
- return c(), () => h();
609
+ }, d = e.subscribe(t, c);
610
+ return c(), () => d();
599
611
  }
600
612
  }, [t, e]), f;
601
- }, Le = (e, ...t) => {
613
+ }, Pe = (e, ...t) => {
602
614
  L(() => {
603
615
  if (e)
604
616
  for (let [r, u] of t)
605
617
  e.data[r] != u && e.publish(r, u);
606
- }, [e, ...t.flat()]), Ce(e, ...t.map((r) => r[0]));
607
- }, vr = (e, ...t) => {
618
+ }, [e, ar(t.flat())]), Le(e, ...t.map((r) => r[0]));
619
+ }, gr = (e, ...t) => {
608
620
  const [, r] = U(0), u = t.map((f) => {
609
621
  var n;
610
622
  return (n = e == null ? void 0 : e.data) == null ? void 0 : n[f];
@@ -619,13 +631,13 @@ const or = fe((e) => new nr(e)), Y = (e = "noname") => z(() => or(e), [e]), Ce =
619
631
  });
620
632
  t.some((v, g) => f[g] != p[g]) && (f = p, r((v) => v + 1));
621
633
  }, 1);
622
- let c = t.map((p) => e.subscribe(p, n)), h = setTimeout(n, 1);
634
+ let c = t.map((p) => e.subscribe(p, n)), d = setTimeout(n, 1);
623
635
  return () => {
624
- clearTimeout(h), n.cancel(), c.forEach((p) => p());
636
+ clearTimeout(d), n.cancel(), c.forEach((p) => p());
625
637
  };
626
638
  }
627
639
  }, [e, ...t]), Object.fromEntries(t.map((f, n) => [f, u[n]]));
628
- }, mr = (e, t = 100, ...r) => {
640
+ }, _r = (e, t = 100, ...r) => {
629
641
  const [, u] = U(0), f = r.map((n) => {
630
642
  var c;
631
643
  return (c = e == null ? void 0 : e.data) == null ? void 0 : c[n];
@@ -633,16 +645,16 @@ const or = fe((e) => new nr(e)), Y = (e = "noname") => z(() => or(e), [e]), Ce =
633
645
  return L(() => {
634
646
  if (e) {
635
647
  let n = f;
636
- const c = rr(() => {
648
+ const c = or(() => {
637
649
  let v = r.map((g) => {
638
- var y;
639
- return (y = e == null ? void 0 : e.data) == null ? void 0 : y[g];
650
+ var E;
651
+ return (E = e == null ? void 0 : e.data) == null ? void 0 : E[g];
640
652
  });
641
- r.some((g, y) => n[y] != v[y]) && (n = v, u((g) => g + 1));
653
+ r.some((g, E) => n[E] != v[E]) && (n = v, u((g) => g + 1));
642
654
  }, t);
643
- let h = r.map((v) => e.subscribe(v, c)), p = setTimeout(c, 1);
655
+ let d = r.map((v) => e.subscribe(v, c)), p = setTimeout(c, 1);
644
656
  return () => {
645
- clearTimeout(p), c.cancel(), h.forEach((v) => v());
657
+ clearTimeout(p), c.cancel(), d.forEach((v) => v());
646
658
  };
647
659
  }
648
660
  }, [e, ...r]), f;
@@ -657,17 +669,17 @@ var ee = { exports: {} }, J = {};
657
669
  * This source code is licensed under the MIT license found in the
658
670
  * LICENSE file in the root directory of this source tree.
659
671
  */
660
- var we;
661
- function ir() {
662
- if (we) return J;
663
- we = 1;
672
+ var Te;
673
+ function cr() {
674
+ if (Te) return J;
675
+ Te = 1;
664
676
  var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
665
677
  function r(u, f, n) {
666
678
  var c = null;
667
679
  if (n !== void 0 && (c = "" + n), f.key !== void 0 && (c = "" + f.key), "key" in f) {
668
680
  n = {};
669
- for (var h in f)
670
- h !== "key" && (n[h] = f[h]);
681
+ for (var d in f)
682
+ d !== "key" && (n[d] = f[d]);
671
683
  } else n = f;
672
684
  return f = n.ref, {
673
685
  $$typeof: e,
@@ -689,16 +701,16 @@ var X = {};
689
701
  * This source code is licensed under the MIT license found in the
690
702
  * LICENSE file in the root directory of this source tree.
691
703
  */
692
- var Te;
693
- function sr() {
694
- return Te || (Te = 1, process.env.NODE_ENV !== "production" && function() {
704
+ var Oe;
705
+ function fr() {
706
+ return Oe || (Oe = 1, process.env.NODE_ENV !== "production" && function() {
695
707
  function e(i) {
696
708
  if (i == null) return null;
697
709
  if (typeof i == "function")
698
710
  return i.$$typeof === b ? null : i.displayName || i.name || null;
699
711
  if (typeof i == "string") return i;
700
712
  switch (i) {
701
- case E:
713
+ case y:
702
714
  return "Fragment";
703
715
  case N:
704
716
  return "Profiler";
@@ -726,7 +738,7 @@ function sr() {
726
738
  return i = i.displayName, i || (i = m.displayName || m.name || "", i = i !== "" ? "ForwardRef(" + i + ")" : "ForwardRef"), i;
727
739
  case l:
728
740
  return m = i.displayName || null, m !== null ? m : e(i.type) || "Memo";
729
- case d:
741
+ case h:
730
742
  m = i._payload, i = i._init;
731
743
  try {
732
744
  return e(i(m));
@@ -756,8 +768,8 @@ function sr() {
756
768
  }
757
769
  }
758
770
  function u(i) {
759
- if (i === E) return "<>";
760
- if (typeof i == "object" && i !== null && i.$$typeof === d)
771
+ if (i === y) return "<>";
772
+ if (typeof i == "object" && i !== null && i.$$typeof === h)
761
773
  return "<...>";
762
774
  try {
763
775
  var m = e(i);
@@ -780,7 +792,7 @@ function sr() {
780
792
  }
781
793
  return i.key !== void 0;
782
794
  }
783
- function h(i, m) {
795
+ function d(i, m) {
784
796
  function w() {
785
797
  de || (de = !0, console.error(
786
798
  "%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)",
@@ -836,17 +848,17 @@ function sr() {
836
848
  if (R)
837
849
  if (B(S)) {
838
850
  for (R = 0; R < S.length; R++)
839
- y(S[R]);
851
+ E(S[R]);
840
852
  Object.freeze && Object.freeze(S);
841
853
  } else
842
854
  console.error(
843
855
  "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
856
  );
845
- else y(S);
857
+ else E(S);
846
858
  if (A.call(m, "key")) {
847
859
  S = e(i);
848
- var F = Object.keys(m).filter(function(Pe) {
849
- return Pe !== "key";
860
+ var F = Object.keys(m).filter(function(Ne) {
861
+ return Ne !== "key";
850
862
  });
851
863
  R = 0 < F.length ? "{key: someKey, " + F.join(": ..., ") + ": ...}" : "{key: someKey}", me[S + R] || (F = 0 < F.length ? "{" + F.join(": ..., ") + ": ...}" : "{}", console.error(
852
864
  `A props object containing a "key" prop is being spread into JSX:
@@ -866,7 +878,7 @@ React keys must be passed directly to JSX without using spread:
866
878
  for (var ue in m)
867
879
  ue !== "key" && (w[ue] = m[ue]);
868
880
  } else w = m;
869
- return S && h(
881
+ return S && d(
870
882
  w,
871
883
  typeof i == "function" ? i.displayName || i.name || "Unknown" : i
872
884
  ), v(
@@ -880,10 +892,10 @@ React keys must be passed directly to JSX without using spread:
880
892
  se
881
893
  );
882
894
  }
883
- function y(i) {
895
+ function E(i) {
884
896
  typeof i == "object" && i !== null && i.$$typeof === C && i._store && (i._store.validated = 1);
885
897
  }
886
- var T = ke, C = Symbol.for("react.transitional.element"), M = Symbol.for("react.portal"), E = Symbol.for("react.fragment"), O = Symbol.for("react.strict_mode"), N = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), D = Symbol.for("react.context"), s = Symbol.for("react.forward_ref"), a = Symbol.for("react.suspense"), o = Symbol.for("react.suspense_list"), l = Symbol.for("react.memo"), d = Symbol.for("react.lazy"), _ = Symbol.for("react.activity"), b = Symbol.for("react.client.reference"), j = T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, A = Object.prototype.hasOwnProperty, B = Array.isArray, H = console.createTask ? console.createTask : function() {
898
+ var T = Me, C = Symbol.for("react.transitional.element"), M = Symbol.for("react.portal"), y = Symbol.for("react.fragment"), O = Symbol.for("react.strict_mode"), N = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), D = Symbol.for("react.context"), s = Symbol.for("react.forward_ref"), a = Symbol.for("react.suspense"), o = Symbol.for("react.suspense_list"), l = Symbol.for("react.memo"), h = Symbol.for("react.lazy"), _ = Symbol.for("react.activity"), b = Symbol.for("react.client.reference"), j = T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, A = Object.prototype.hasOwnProperty, B = Array.isArray, V = console.createTask ? console.createTask : function() {
887
899
  return null;
888
900
  };
889
901
  T = {
@@ -894,8 +906,8 @@ React keys must be passed directly to JSX without using spread:
894
906
  var de, he = {}, pe = T["react-stack-bottom-frame"].bind(
895
907
  T,
896
908
  n
897
- )(), ve = H(u(n)), me = {};
898
- X.Fragment = E, X.jsx = function(i, m, w, R, k) {
909
+ )(), ve = V(u(n)), me = {};
910
+ X.Fragment = y, X.jsx = function(i, m, w, R, k) {
899
911
  var P = 1e4 > j.recentlyCreatedOwnerStacks++;
900
912
  return g(
901
913
  i,
@@ -905,7 +917,7 @@ React keys must be passed directly to JSX without using spread:
905
917
  R,
906
918
  k,
907
919
  P ? Error("react-stack-top-frame") : pe,
908
- P ? H(u(i)) : ve
920
+ P ? V(u(i)) : ve
909
921
  );
910
922
  }, X.jsxs = function(i, m, w, R, k) {
911
923
  var P = 1e4 > j.recentlyCreatedOwnerStacks++;
@@ -917,26 +929,26 @@ React keys must be passed directly to JSX without using spread:
917
929
  R,
918
930
  k,
919
931
  P ? Error("react-stack-top-frame") : pe,
920
- P ? H(u(i)) : ve
932
+ P ? V(u(i)) : ve
921
933
  );
922
934
  };
923
935
  }()), X;
924
936
  }
925
- var Oe;
926
- function ur() {
927
- return Oe || (Oe = 1, process.env.NODE_ENV === "production" ? ee.exports = ir() : ee.exports = sr()), ee.exports;
937
+ var Re;
938
+ function lr() {
939
+ return Re || (Re = 1, process.env.NODE_ENV === "production" ? ee.exports = cr() : ee.exports = fr()), ee.exports;
928
940
  }
929
- var W = ur();
930
- const br = (e, t) => {
941
+ var W = lr();
942
+ const yr = (e, t) => {
931
943
  const r = (n) => [
932
944
  e,
933
- ...Object.entries(n ?? {}).sort((c, h) => c[0].localeCompare(h[0])).flat()
945
+ ...Object.entries(n ?? {}).sort((c, d) => c[0].localeCompare(d[0])).flat()
934
946
  ].join("-");
935
947
  let u = /* @__PURE__ */ new Set();
936
948
  const f = (n) => {
937
- const c = r(n), h = Y(c), p = t(n), v = z(() => new Error().stack, []);
938
- return Le(
939
- h,
949
+ const c = r(n), d = Y(c), p = t(n), v = z(() => new Error().stack, []);
950
+ return Pe(
951
+ d,
940
952
  ...Object.entries(p)
941
953
  ), L(() => {
942
954
  if (u.has(c)) {
@@ -952,53 +964,53 @@ const br = (e, t) => {
952
964
  resolveCtxName: r,
953
965
  Root: f,
954
966
  useCtxStateStrict: (n) => {
955
- const c = r(n), h = z(() => new Error().stack, []);
967
+ const c = r(n), d = z(() => new Error().stack, []);
956
968
  return L(() => {
957
969
  if (!u.has(c)) {
958
970
  const p = new Error("RootContext [" + c + "] is not mounted");
959
- throw p.stack = h, p;
971
+ throw p.stack = d, p;
960
972
  }
961
973
  }, [c]), Y(c);
962
974
  },
963
975
  useCtxState: (n) => {
964
- const c = r(n), h = z(() => new Error().stack, []);
976
+ const c = r(n), d = z(() => new Error().stack, []);
965
977
  return L(() => {
966
978
  if (!u.has(c)) {
967
979
  const p = new Error("RootContext [" + c + "] is not mounted");
968
- p.stack = h;
980
+ p.stack = d;
969
981
  let v = setTimeout(() => console.error(p), 1e3);
970
982
  return () => clearTimeout(v);
971
983
  }
972
984
  }, [u.has(c)]), Y(c);
973
985
  }
974
986
  };
975
- }, cr = /* @__PURE__ */ function() {
987
+ }, dr = /* @__PURE__ */ function() {
976
988
  const e = /* @__PURE__ */ new WeakMap();
977
989
  return (t) => {
978
990
  let r = e.get(t);
979
991
  return r || e.set(t, r = ((t == null ? void 0 : t.name) ?? "") + Math.random().toString()), r;
980
992
  };
981
- }(), lr = (e) => [
993
+ }(), hr = (e) => [
982
994
  ...Object.entries(e ?? {}).sort((t, r) => t[0].localeCompare(r[0])).flat()
983
- ].join("-"), gr = ({ Wrapper: e = $e }) => {
984
- const t = Y("auto-ctx"), [r, u] = U({}), f = Me(
995
+ ].join("-"), Er = ({ Wrapper: e = xe }) => {
996
+ const t = Y("auto-ctx"), [r, u] = U({}), f = Ie(
985
997
  (n, c) => {
986
- const h = cr(n), p = lr(c);
998
+ const d = dr(n), p = hr(c);
987
999
  return u(({
988
- [h]: {
1000
+ [d]: {
989
1001
  Component: v = n,
990
1002
  subState: {
991
1003
  [p]: g = { params: c, counter: 0 },
992
- ...y
1004
+ ...E
993
1005
  } = {}
994
1006
  } = {},
995
1007
  ...T
996
1008
  }) => ({
997
1009
  ...T,
998
- [h]: {
1010
+ [d]: {
999
1011
  Component: v,
1000
1012
  subState: {
1001
- ...y,
1013
+ ...E,
1002
1014
  [p]: {
1003
1015
  ...g,
1004
1016
  counter: g.counter + 1
@@ -1006,20 +1018,20 @@ const br = (e, t) => {
1006
1018
  }
1007
1019
  }
1008
1020
  })), () => u(({
1009
- [h]: {
1021
+ [d]: {
1010
1022
  Component: v = n,
1011
1023
  subState: {
1012
1024
  [p]: g = { params: c, counter: 0 },
1013
- ...y
1025
+ ...E
1014
1026
  } = {}
1015
1027
  } = {},
1016
1028
  ...T
1017
1029
  }) => ({
1018
1030
  ...T,
1019
- [h]: {
1031
+ [d]: {
1020
1032
  Component: v,
1021
1033
  subState: {
1022
- ...y,
1034
+ ...E,
1023
1035
  ...g.counter > 1 ? {
1024
1036
  [p]: {
1025
1037
  ...g,
@@ -1032,48 +1044,48 @@ const br = (e, t) => {
1032
1044
  },
1033
1045
  []
1034
1046
  );
1035
- return Le(
1047
+ return Pe(
1036
1048
  t,
1037
1049
  ["subscribe", f],
1038
1050
  ["state", r]
1039
1051
  ), /* @__PURE__ */ W.jsx(W.Fragment, { children: Object.entries(r).flatMap(
1040
- ([n, { Component: c, subState: h }]) => Object.entries(h).map(([p, { counter: v, params: g }]) => ({ key: n + p, Component: c, params: g, counter: v })).filter((p) => p.counter > 0).map(({ key: p, params: v, Component: g }) => /* @__PURE__ */ W.jsx(e, { children: /* @__PURE__ */ W.jsx(g, { ...v }) }, p))
1052
+ ([n, { Component: c, subState: d }]) => Object.entries(d).map(([p, { counter: v, params: g }]) => ({ key: n + p, Component: c, params: g, counter: v })).filter((p) => p.counter > 0).map(({ key: p, params: v, Component: g }) => /* @__PURE__ */ W.jsx(e, { children: /* @__PURE__ */ W.jsx(g, { ...v }) }, p))
1041
1053
  ) });
1042
- }, _r = ({ Root: e, useCtxState: t, useCtxStateStrict: r, resolveCtxName: u }) => ({
1054
+ }, wr = ({ Root: e, useCtxState: t, useCtxStateStrict: r, resolveCtxName: u }) => ({
1043
1055
  useCtxState: (f) => {
1044
- const n = u(f), c = ar(Y("auto-ctx"), "subscribe");
1056
+ const n = u(f), c = ur(Y("auto-ctx"), "subscribe");
1045
1057
  return L(() => c == null ? void 0 : c(e, f), [c, n]), Y(n);
1046
1058
  }
1047
- }), Er = (e) => {
1059
+ }), Tr = (e) => {
1048
1060
  const [, t] = U(0), { proxy: r, finalGetter: u, openGetter: f, clean: n } = z(
1049
1061
  () => {
1050
- const c = /* @__PURE__ */ new Set(), h = {}, p = /* @__PURE__ */ new Map(), v = new Proxy(
1062
+ const c = /* @__PURE__ */ new Set(), d = {}, p = /* @__PURE__ */ new Map(), v = new Proxy(
1051
1063
  e == null ? void 0 : e.data,
1052
1064
  {
1053
- get(E, O) {
1065
+ get(y, O) {
1054
1066
  if (g)
1055
- return c.add(O), h[O] = E[O];
1067
+ return c.add(O), d[O] = y[O];
1056
1068
  throw new Error("now allow here");
1057
1069
  }
1058
1070
  }
1059
1071
  );
1060
- let g = !0, y = ae(() => {
1061
- [...c.values()].some((E) => {
1072
+ let g = !0, E = ae(() => {
1073
+ [...c.values()].some((y) => {
1062
1074
  var O;
1063
- return h[E] != ((O = e == null ? void 0 : e.data) == null ? void 0 : O[E]);
1064
- }) && t((E) => E + 1);
1075
+ return d[y] != ((O = e == null ? void 0 : e.data) == null ? void 0 : O[y]);
1076
+ }) && t((y) => y + 1);
1065
1077
  }, 0), T = () => {
1066
1078
  g = !0, c.clear();
1067
1079
  }, C = () => {
1068
- g = !1, [...c.values()].filter((E) => !p.has(E)).forEach((E) => {
1069
- p.set(E, e == null ? void 0 : e.subscribe(E, y));
1070
- }), [...p.keys()].filter((E) => !c.has(E)).forEach((E) => {
1071
- let O = p.get(E);
1072
- O == null || O(), p.delete(E);
1080
+ g = !1, [...c.values()].filter((y) => !p.has(y)).forEach((y) => {
1081
+ p.set(y, e == null ? void 0 : e.subscribe(y, E));
1082
+ }), [...p.keys()].filter((y) => !c.has(y)).forEach((y) => {
1083
+ let O = p.get(y);
1084
+ O == null || O(), p.delete(y);
1073
1085
  });
1074
1086
  };
1075
1087
  return { proxy: v, finalGetter: C, openGetter: T, clean: () => {
1076
- T(), C(), t((E) => E + 1);
1088
+ T(), C(), t((y) => y + 1);
1077
1089
  } };
1078
1090
  },
1079
1091
  [e]
@@ -1084,17 +1096,17 @@ const br = (e, t) => {
1084
1096
  ), r;
1085
1097
  };
1086
1098
  export {
1087
- gr as AutoRootCtx,
1088
- nr as Context,
1089
- _r as createAutoCtx,
1090
- br as createRootCtx,
1091
- or as getContext,
1099
+ Er as AutoRootCtx,
1100
+ ir as Context,
1101
+ wr as createAutoCtx,
1102
+ yr as createRootCtx,
1103
+ sr as getContext,
1092
1104
  Y as useDataContext,
1093
- hr as useDataSource,
1094
- Le as useDataSourceMultiple,
1095
- ar as useDataSubscribe,
1096
- vr as useDataSubscribeMultiple,
1097
- mr as useDataSubscribeMultipleWithDebounce,
1098
- pr as useDataSubscribeWithTransform,
1099
- Er as useQuickSubscribe
1105
+ mr as useDataSource,
1106
+ Pe as useDataSourceMultiple,
1107
+ ur as useDataSubscribe,
1108
+ gr as useDataSubscribeMultiple,
1109
+ _r as useDataSubscribeMultipleWithDebounce,
1110
+ br as useDataSubscribeWithTransform,
1111
+ Tr as useQuickSubscribe
1100
1112
  };
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(S,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],v):(S=typeof globalThis<"u"?globalThis:S||self,v(S.RState={},S.React))})(this,function(S,v){"use strict";var pn=Object.defineProperty;var vn=(S,v,W)=>v in S?pn(S,v,{enumerable:!0,configurable:!0,writable:!0,value:W}):S[v]=W;var ae=(S,v,W)=>vn(S,typeof v!="symbol"?v+"":v,W);function W(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Z={exports:{}},he;function Me(){if(he)return Z.exports;he=1;var e=typeof Reflect=="object"?Reflect:null,t=e&&typeof e.apply=="function"?e.apply:function(a,o,f){return Function.prototype.apply.call(a,o,f)},n;e&&typeof e.ownKeys=="function"?n=e.ownKeys:Object.getOwnPropertySymbols?n=function(a){return Object.getOwnPropertyNames(a).concat(Object.getOwnPropertySymbols(a))}:n=function(a){return Object.getOwnPropertyNames(a)};function u(i){console&&console.warn&&console.warn(i)}var l=Number.isNaN||function(a){return a!==a};function r(){r.init.call(this)}Z.exports=r,Z.exports.once=A,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._eventsCount=0,r.prototype._maxListeners=void 0;var c=10;function h(i){if(typeof i!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof i)}Object.defineProperty(r,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(i){if(typeof i!="number"||i<0||l(i))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+i+".");c=i}}),r.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},r.prototype.setMaxListeners=function(a){if(typeof a!="number"||a<0||l(a))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+a+".");return this._maxListeners=a,this};function p(i){return i._maxListeners===void 0?r.defaultMaxListeners:i._maxListeners}r.prototype.getMaxListeners=function(){return p(this)},r.prototype.emit=function(a){for(var o=[],f=1;f<arguments.length;f++)o.push(arguments[f]);var d=a==="error",E=this._events;if(E!==void 0)d=d&&E.error===void 0;else if(!d)return!1;if(d){var g;if(o.length>0&&(g=o[0]),g instanceof Error)throw g;var L=new Error("Unhandled error."+(g?" ("+g.message+")":""));throw L.context=g,L}var M=E[a];if(M===void 0)return!1;if(typeof M=="function")t(M,this,o);else for(var oe=M.length,Q=F(M,oe),f=0;f<oe;++f)t(Q[f],this,o);return!0};function m(i,a,o,f){var d,E,g;if(h(o),E=i._events,E===void 0?(E=i._events=Object.create(null),i._eventsCount=0):(E.newListener!==void 0&&(i.emit("newListener",a,o.listener?o.listener:o),E=i._events),g=E[a]),g===void 0)g=E[a]=o,++i._eventsCount;else if(typeof g=="function"?g=E[a]=f?[o,g]:[g,o]:f?g.unshift(o):g.push(o),d=p(i),d>0&&g.length>d&&!g.warned){g.warned=!0;var L=new Error("Possible EventEmitter memory leak detected. "+g.length+" "+String(a)+" listeners added. Use emitter.setMaxListeners() to increase limit");L.name="MaxListenersExceededWarning",L.emitter=i,L.type=a,L.count=g.length,u(L)}return i}r.prototype.addListener=function(a,o){return m(this,a,o,!1)},r.prototype.on=r.prototype.addListener,r.prototype.prependListener=function(a,o){return m(this,a,o,!0)};function _(){if(!this.fired)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)}function T(i,a,o){var f={fired:!1,wrapFn:void 0,target:i,type:a,listener:o},d=_.bind(f);return d.listener=o,f.wrapFn=d,d}r.prototype.once=function(a,o){return h(o),this.on(a,T(this,a,o)),this},r.prototype.prependOnceListener=function(a,o){return h(o),this.prependListener(a,T(this,a,o)),this},r.prototype.removeListener=function(a,o){var f,d,E,g,L;if(h(o),d=this._events,d===void 0)return this;if(f=d[a],f===void 0)return this;if(f===o||f.listener===o)--this._eventsCount===0?this._events=Object.create(null):(delete d[a],d.removeListener&&this.emit("removeListener",a,f.listener||o));else if(typeof f!="function"){for(E=-1,g=f.length-1;g>=0;g--)if(f[g]===o||f[g].listener===o){L=f[g].listener,E=g;break}if(E<0)return this;E===0?f.shift():y(f,E),f.length===1&&(d[a]=f[0]),d.removeListener!==void 0&&this.emit("removeListener",a,L||o)}return this},r.prototype.off=r.prototype.removeListener,r.prototype.removeAllListeners=function(a){var o,f,d;if(f=this._events,f===void 0)return this;if(f.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):f[a]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete f[a]),this;if(arguments.length===0){var E=Object.keys(f),g;for(d=0;d<E.length;++d)g=E[d],g!=="removeListener"&&this.removeAllListeners(g);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(o=f[a],typeof o=="function")this.removeListener(a,o);else if(o!==void 0)for(d=o.length-1;d>=0;d--)this.removeListener(a,o[d]);return this};function O(i,a,o){var f=i._events;if(f===void 0)return[];var d=f[a];return d===void 0?[]:typeof d=="function"?o?[d.listener||d]:[d]:o?R(d):F(d,d.length)}r.prototype.listeners=function(a){return O(this,a,!0)},r.prototype.rawListeners=function(a){return O(this,a,!1)},r.listenerCount=function(i,a){return typeof i.listenerCount=="function"?i.listenerCount(a):P.call(i,a)},r.prototype.listenerCount=P;function P(i){var a=this._events;if(a!==void 0){var o=a[i];if(typeof o=="function")return 1;if(o!==void 0)return o.length}return 0}r.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function F(i,a){for(var o=new Array(a),f=0;f<a;++f)o[f]=i[f];return o}function y(i,a){for(;a+1<i.length;a++)i[a]=i[a+1];i.pop()}function R(i){for(var a=new Array(i.length),o=0;o<a.length;++o)a[o]=i[o].listener||i[o];return a}function A(i,a){return new Promise(function(o,f){function d(g){i.removeListener(a,E),f(g)}function E(){typeof i.removeListener=="function"&&i.removeListener("error",d),o([].slice.call(arguments))}V(i,a,E,{once:!0}),a!=="error"&&U(i,d,{once:!0})})}function U(i,a,o){typeof i.on=="function"&&V(i,"error",a,o)}function V(i,a,o,f){if(typeof i.on=="function")f.once?i.once(a,o):i.on(a,o);else if(typeof i.addEventListener=="function")i.addEventListener(a,function d(E){f.once&&i.removeEventListener(a,d),o(E)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof i)}return Z.exports}var ke=Me();const De=W(ke);var Ie=typeof global=="object"&&global&&global.Object===Object&&global,xe=typeof self=="object"&&self&&self.Object===Object&&self,$=Ie||xe||Function("return this")(),q=$.Symbol,pe=Object.prototype,Fe=pe.hasOwnProperty,We=pe.toString,J=q?q.toStringTag:void 0;function ze(e){var t=Fe.call(e,J),n=e[J];try{e[J]=void 0;var u=!0}catch{}var l=We.call(e);return u&&(t?e[J]=n:delete e[J]),l}var Ye=Object.prototype,Ge=Ye.toString;function Ue(e){return Ge.call(e)}var Ve="[object Null]",He="[object Undefined]",ve=q?q.toStringTag:void 0;function me(e){return e==null?e===void 0?He:Ve:ve&&ve in Object(e)?ze(e):Ue(e)}function Je(e){return e!=null&&typeof e=="object"}var Xe="[object Symbol]";function Ke(e){return typeof e=="symbol"||Je(e)&&me(e)==Xe}var Be=/\s/;function Qe(e){for(var t=e.length;t--&&Be.test(e.charAt(t)););return t}var Ze=/^\s+/;function $e(e){return e&&e.slice(0,Qe(e)+1).replace(Ze,"")}function z(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var be=NaN,qe=/^[-+]0x[0-9a-f]+$/i,et=/^0b[01]+$/i,tt=/^0o[0-7]+$/i,nt=parseInt;function ge(e){if(typeof e=="number")return e;if(Ke(e))return be;if(z(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=z(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=$e(e);var n=et.test(e);return n||tt.test(e)?nt(e.slice(2),n?2:8):qe.test(e)?be:+e}var rt="[object AsyncFunction]",ot="[object Function]",at="[object GeneratorFunction]",st="[object Proxy]";function it(e){if(!z(e))return!1;var t=me(e);return t==ot||t==at||t==rt||t==st}var se=$["__core-js_shared__"],_e=function(){var e=/[^.]+$/.exec(se&&se.keys&&se.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function ut(e){return!!_e&&_e in e}var ct=Function.prototype,ft=ct.toString;function lt(e){if(e!=null){try{return ft.call(e)}catch{}try{return e+""}catch{}}return""}var dt=/[\\^$.*+?()[\]{}|]/g,ht=/^\[object .+?Constructor\]$/,pt=Function.prototype,vt=Object.prototype,mt=pt.toString,bt=vt.hasOwnProperty,gt=RegExp("^"+mt.call(bt).replace(dt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function _t(e){if(!z(e)||ut(e))return!1;var t=it(e)?gt:ht;return t.test(lt(e))}function Et(e,t){return e==null?void 0:e[t]}function Ee(e,t){var n=Et(e,t);return _t(n)?n:void 0}function yt(e,t){return e===t||e!==e&&t!==t}var X=Ee(Object,"create");function St(){this.__data__=X?X(null):{},this.size=0}function Tt(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var wt="__lodash_hash_undefined__",Ot=Object.prototype,Rt=Ot.hasOwnProperty;function Ct(e){var t=this.__data__;if(X){var n=t[e];return n===wt?void 0:n}return Rt.call(t,e)?t[e]:void 0}var jt=Object.prototype,Lt=jt.hasOwnProperty;function Pt(e){var t=this.__data__;return X?t[e]!==void 0:Lt.call(t,e)}var Nt="__lodash_hash_undefined__";function At(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=X&&t===void 0?Nt:t,this}function D(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var u=e[t];this.set(u[0],u[1])}}D.prototype.clear=St,D.prototype.delete=Tt,D.prototype.get=Ct,D.prototype.has=Pt,D.prototype.set=At;function Mt(){this.__data__=[],this.size=0}function ee(e,t){for(var n=e.length;n--;)if(yt(e[n][0],t))return n;return-1}var kt=Array.prototype,Dt=kt.splice;function It(e){var t=this.__data__,n=ee(t,e);if(n<0)return!1;var u=t.length-1;return n==u?t.pop():Dt.call(t,n,1),--this.size,!0}function xt(e){var t=this.__data__,n=ee(t,e);return n<0?void 0:t[n][1]}function Ft(e){return ee(this.__data__,e)>-1}function Wt(e,t){var n=this.__data__,u=ee(n,e);return u<0?(++this.size,n.push([e,t])):n[u][1]=t,this}function Y(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var u=e[t];this.set(u[0],u[1])}}Y.prototype.clear=Mt,Y.prototype.delete=It,Y.prototype.get=xt,Y.prototype.has=Ft,Y.prototype.set=Wt;var zt=Ee($,"Map");function Yt(){this.size=0,this.__data__={hash:new D,map:new(zt||Y),string:new D}}function Gt(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function te(e,t){var n=e.__data__;return Gt(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Ut(e){var t=te(this,e).delete(e);return this.size-=t?1:0,t}function Vt(e){return te(this,e).get(e)}function Ht(e){return te(this,e).has(e)}function Jt(e,t){var n=te(this,e),u=n.size;return n.set(e,t),this.size+=n.size==u?0:1,this}function I(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var u=e[t];this.set(u[0],u[1])}}I.prototype.clear=Yt,I.prototype.delete=Ut,I.prototype.get=Vt,I.prototype.has=Ht,I.prototype.set=Jt;var Xt="Expected a function";function ie(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Xt);var n=function(){var u=arguments,l=t?t.apply(this,u):u[0],r=n.cache;if(r.has(l))return r.get(l);var c=e.apply(this,u);return n.cache=r.set(l,c)||r,c};return n.cache=new(ie.Cache||I),n}ie.Cache=I;var ue=function(){return $.Date.now()},Kt="Expected a function",Bt=Math.max,Qt=Math.min;function ne(e,t,n){var u,l,r,c,h,p,m=0,_=!1,T=!1,O=!0;if(typeof e!="function")throw new TypeError(Kt);t=ge(t)||0,z(n)&&(_=!!n.leading,T="maxWait"in n,r=T?Bt(ge(n.maxWait)||0,t):r,O="trailing"in n?!!n.trailing:O);function P(o){var f=u,d=l;return u=l=void 0,m=o,c=e.apply(d,f),c}function F(o){return m=o,h=setTimeout(A,t),_?P(o):c}function y(o){var f=o-p,d=o-m,E=t-f;return T?Qt(E,r-d):E}function R(o){var f=o-p,d=o-m;return p===void 0||f>=t||f<0||T&&d>=r}function A(){var o=ue();if(R(o))return U(o);h=setTimeout(A,y(o))}function U(o){return h=void 0,O&&u?P(o):(u=l=void 0,c)}function V(){h!==void 0&&clearTimeout(h),m=0,u=p=l=h=void 0}function i(){return h===void 0?c:U(ue())}function a(){var o=ue(),f=R(o);if(u=arguments,l=this,p=o,f){if(h===void 0)return F(p);if(T)return clearTimeout(h),h=setTimeout(A,t),P(p)}return h===void 0&&(h=setTimeout(A,t)),c}return a.cancel=V,a.flush=i,a}var Zt="Expected a function";function $t(e,t,n){var u=!0,l=!0;if(typeof e!="function")throw new TypeError(Zt);return z(n)&&(u="leading"in n?!!n.leading:u,l="trailing"in n?!!n.trailing:l),ne(e,t,{leading:u,maxWait:t,trailing:l})}class ye{constructor(t){ae(this,"event",new De.EventEmitter);ae(this,"data",{});ae(this,"registry",new Set);this.name=t,console.log("[CONTEXT] %s",t),this.event.setMaxListeners(100)}publish(t,n){n!=this.data[t]&&(this.data[t]=n,this.event.emit(String(t),{value:n}))}subscribe(t,n){const u=({value:l})=>{n(l)};return this.event.addListener(String(t),u),console.log("listenerCount:",String(t),this.event.listenerCount(String(t))),t in this.data&&n(this.data[t]),()=>(this.event.removeListener(String(t),u),void 0)}}const Se=ie(e=>new ye(e)),x=(e="noname")=>v.useMemo(()=>Se(e),[e]),Te=(e,...t)=>{const n=new Error("[ctx] useRegistryChecker failed "+JSON.stringify({names:t,ctx:(e==null?void 0:e.name)??"undefined"}));v.useEffect(()=>{if(e)return t.some(u=>e.registry.has(u))&&console.error(n),t.forEach(u=>e.registry.add(u)),()=>{t.forEach(u=>e.registry.delete(u))}},[e,t.length])},qt=(e,t,n)=>{v.useEffect(()=>{e&&e.data[t]!=n&&e.publish(t,n)},[t,n,e]),Te(e,t)},we=(e,t,n=0)=>{const[{value:u},l]=v.useState(()=>{var r;return{value:(r=e==null?void 0:e.data)==null?void 0:r[t]}});return v.useEffect(()=>{if(e){let r=n==0?h=>l({value:h}):ne(h=>l({value:h}),n),c=e.subscribe(t,r);return u!=e.data[t]&&l({value:e.data[t]}),()=>{c()}}},[t,e]),e==null?void 0:e.data[t]},en=(e,t,n)=>{const[,u]=v.useState(0),l=v.useMemo(()=>n(e==null?void 0:e.data[t]),[n,e==null?void 0:e.data[t]]);return v.useEffect(()=>{if(e){let r=l,c=()=>{let p=n(e.data[t]);p!=r&&(r=p,u(m=>m+1))},h=e.subscribe(t,c);return c(),()=>h()}},[t,e]),l},ce=(e,...t)=>{v.useEffect(()=>{if(e)for(let[n,u]of t)e.data[n]!=u&&e.publish(n,u)},[e,...t.flat()]),Te(e,...t.map(n=>n[0]))},tn=(e,...t)=>{const[,n]=v.useState(0),u=t.map(l=>{var r;return(r=e==null?void 0:e.data)==null?void 0:r[l]});return v.useEffect(()=>{if(e){let l=u;const r=ne(()=>{let p=t.map(m=>{var _;return(_=e==null?void 0:e.data)==null?void 0:_[m]});t.some((m,_)=>l[_]!=p[_])&&(l=p,n(m=>m+1))},1);let c=t.map(p=>e.subscribe(p,r)),h=setTimeout(r,1);return()=>{clearTimeout(h),r.cancel(),c.forEach(p=>p())}}},[e,...t]),Object.fromEntries(t.map((l,r)=>[l,u[r]]))},nn=(e,t=100,...n)=>{const[,u]=v.useState(0),l=n.map(r=>{var c;return(c=e==null?void 0:e.data)==null?void 0:c[r]});return v.useEffect(()=>{if(e){let r=l;const c=$t(()=>{let m=n.map(_=>{var T;return(T=e==null?void 0:e.data)==null?void 0:T[_]});n.some((_,T)=>r[T]!=m[T])&&(r=m,u(_=>_+1))},t);let h=n.map(m=>e.subscribe(m,c)),p=setTimeout(c,1);return()=>{clearTimeout(p),c.cancel(),h.forEach(m=>m())}}},[e,...n]),l};var re={exports:{}},K={};/**
1
+ (function(T,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],v):(T=typeof globalThis<"u"?globalThis:T||self,v(T.RState={},T.React))})(this,function(T,v){"use strict";var mn=Object.defineProperty;var bn=(T,v,W)=>v in T?mn(T,v,{enumerable:!0,configurable:!0,writable:!0,value:W}):T[v]=W;var ae=(T,v,W)=>bn(T,typeof v!="symbol"?v+"":v,W);function W(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Z={exports:{}},he;function ke(){if(he)return Z.exports;he=1;var e=typeof Reflect=="object"?Reflect:null,t=e&&typeof e.apply=="function"?e.apply:function(a,o,l){return Function.prototype.apply.call(a,o,l)},n;e&&typeof e.ownKeys=="function"?n=e.ownKeys:Object.getOwnPropertySymbols?n=function(a){return Object.getOwnPropertyNames(a).concat(Object.getOwnPropertySymbols(a))}:n=function(a){return Object.getOwnPropertyNames(a)};function u(i){console&&console.warn&&console.warn(i)}var f=Number.isNaN||function(a){return a!==a};function r(){r.init.call(this)}Z.exports=r,Z.exports.once=A,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._eventsCount=0,r.prototype._maxListeners=void 0;var c=10;function d(i){if(typeof i!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof i)}Object.defineProperty(r,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(i){if(typeof i!="number"||i<0||f(i))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+i+".");c=i}}),r.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},r.prototype.setMaxListeners=function(a){if(typeof a!="number"||a<0||f(a))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+a+".");return this._maxListeners=a,this};function p(i){return i._maxListeners===void 0?r.defaultMaxListeners:i._maxListeners}r.prototype.getMaxListeners=function(){return p(this)},r.prototype.emit=function(a){for(var o=[],l=1;l<arguments.length;l++)o.push(arguments[l]);var h=a==="error",E=this._events;if(E!==void 0)h=h&&E.error===void 0;else if(!h)return!1;if(h){var g;if(o.length>0&&(g=o[0]),g instanceof Error)throw g;var L=new Error("Unhandled error."+(g?" ("+g.message+")":""));throw L.context=g,L}var M=E[a];if(M===void 0)return!1;if(typeof M=="function")t(M,this,o);else for(var oe=M.length,Q=F(M,oe),l=0;l<oe;++l)t(Q[l],this,o);return!0};function m(i,a,o,l){var h,E,g;if(d(o),E=i._events,E===void 0?(E=i._events=Object.create(null),i._eventsCount=0):(E.newListener!==void 0&&(i.emit("newListener",a,o.listener?o.listener:o),E=i._events),g=E[a]),g===void 0)g=E[a]=o,++i._eventsCount;else if(typeof g=="function"?g=E[a]=l?[o,g]:[g,o]:l?g.unshift(o):g.push(o),h=p(i),h>0&&g.length>h&&!g.warned){g.warned=!0;var L=new Error("Possible EventEmitter memory leak detected. "+g.length+" "+String(a)+" listeners added. Use emitter.setMaxListeners() to increase limit");L.name="MaxListenersExceededWarning",L.emitter=i,L.type=a,L.count=g.length,u(L)}return i}r.prototype.addListener=function(a,o){return m(this,a,o,!1)},r.prototype.on=r.prototype.addListener,r.prototype.prependListener=function(a,o){return m(this,a,o,!0)};function _(){if(!this.fired)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)}function S(i,a,o){var l={fired:!1,wrapFn:void 0,target:i,type:a,listener:o},h=_.bind(l);return h.listener=o,l.wrapFn=h,h}r.prototype.once=function(a,o){return d(o),this.on(a,S(this,a,o)),this},r.prototype.prependOnceListener=function(a,o){return d(o),this.prependListener(a,S(this,a,o)),this},r.prototype.removeListener=function(a,o){var l,h,E,g,L;if(d(o),h=this._events,h===void 0)return this;if(l=h[a],l===void 0)return this;if(l===o||l.listener===o)--this._eventsCount===0?this._events=Object.create(null):(delete h[a],h.removeListener&&this.emit("removeListener",a,l.listener||o));else if(typeof l!="function"){for(E=-1,g=l.length-1;g>=0;g--)if(l[g]===o||l[g].listener===o){L=l[g].listener,E=g;break}if(E<0)return this;E===0?l.shift():y(l,E),l.length===1&&(h[a]=l[0]),h.removeListener!==void 0&&this.emit("removeListener",a,L||o)}return this},r.prototype.off=r.prototype.removeListener,r.prototype.removeAllListeners=function(a){var o,l,h;if(l=this._events,l===void 0)return this;if(l.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):l[a]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete l[a]),this;if(arguments.length===0){var E=Object.keys(l),g;for(h=0;h<E.length;++h)g=E[h],g!=="removeListener"&&this.removeAllListeners(g);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(o=l[a],typeof o=="function")this.removeListener(a,o);else if(o!==void 0)for(h=o.length-1;h>=0;h--)this.removeListener(a,o[h]);return this};function O(i,a,o){var l=i._events;if(l===void 0)return[];var h=l[a];return h===void 0?[]:typeof h=="function"?o?[h.listener||h]:[h]:o?R(h):F(h,h.length)}r.prototype.listeners=function(a){return O(this,a,!0)},r.prototype.rawListeners=function(a){return O(this,a,!1)},r.listenerCount=function(i,a){return typeof i.listenerCount=="function"?i.listenerCount(a):P.call(i,a)},r.prototype.listenerCount=P;function P(i){var a=this._events;if(a!==void 0){var o=a[i];if(typeof o=="function")return 1;if(o!==void 0)return o.length}return 0}r.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function F(i,a){for(var o=new Array(a),l=0;l<a;++l)o[l]=i[l];return o}function y(i,a){for(;a+1<i.length;a++)i[a]=i[a+1];i.pop()}function R(i){for(var a=new Array(i.length),o=0;o<a.length;++o)a[o]=i[o].listener||i[o];return a}function A(i,a){return new Promise(function(o,l){function h(g){i.removeListener(a,E),l(g)}function E(){typeof i.removeListener=="function"&&i.removeListener("error",h),o([].slice.call(arguments))}H(i,a,E,{once:!0}),a!=="error"&&U(i,h,{once:!0})})}function U(i,a,o){typeof i.on=="function"&&H(i,"error",a,o)}function H(i,a,o,l){if(typeof i.on=="function")l.once?i.once(a,o):i.on(a,o);else if(typeof i.addEventListener=="function")i.addEventListener(a,function h(E){l.once&&i.removeEventListener(a,h),o(E)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof i)}return Z.exports}var De=ke();const Ie=W(De);var xe=typeof global=="object"&&global&&global.Object===Object&&global,Fe=typeof self=="object"&&self&&self.Object===Object&&self,$=xe||Fe||Function("return this")(),q=$.Symbol,pe=Object.prototype,We=pe.hasOwnProperty,ze=pe.toString,J=q?q.toStringTag:void 0;function Ye(e){var t=We.call(e,J),n=e[J];try{e[J]=void 0;var u=!0}catch{}var f=ze.call(e);return u&&(t?e[J]=n:delete e[J]),f}var Ge=Object.prototype,Ue=Ge.toString;function He(e){return Ue.call(e)}var Ve="[object Null]",Je="[object Undefined]",ve=q?q.toStringTag:void 0;function me(e){return e==null?e===void 0?Je:Ve:ve&&ve in Object(e)?Ye(e):He(e)}function Xe(e){return e!=null&&typeof e=="object"}var Ke="[object Symbol]";function Be(e){return typeof e=="symbol"||Xe(e)&&me(e)==Ke}var Qe=/\s/;function Ze(e){for(var t=e.length;t--&&Qe.test(e.charAt(t)););return t}var $e=/^\s+/;function qe(e){return e&&e.slice(0,Ze(e)+1).replace($e,"")}function z(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var be=NaN,et=/^[-+]0x[0-9a-f]+$/i,tt=/^0b[01]+$/i,nt=/^0o[0-7]+$/i,rt=parseInt;function ge(e){if(typeof e=="number")return e;if(Be(e))return be;if(z(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=z(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=qe(e);var n=tt.test(e);return n||nt.test(e)?rt(e.slice(2),n?2:8):et.test(e)?be:+e}var ot="[object AsyncFunction]",at="[object Function]",st="[object GeneratorFunction]",it="[object Proxy]";function ut(e){if(!z(e))return!1;var t=me(e);return t==at||t==st||t==ot||t==it}var se=$["__core-js_shared__"],_e=function(){var e=/[^.]+$/.exec(se&&se.keys&&se.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function ct(e){return!!_e&&_e in e}var ft=Function.prototype,lt=ft.toString;function dt(e){if(e!=null){try{return lt.call(e)}catch{}try{return e+""}catch{}}return""}var ht=/[\\^$.*+?()[\]{}|]/g,pt=/^\[object .+?Constructor\]$/,vt=Function.prototype,mt=Object.prototype,bt=vt.toString,gt=mt.hasOwnProperty,_t=RegExp("^"+bt.call(gt).replace(ht,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Et(e){if(!z(e)||ct(e))return!1;var t=ut(e)?_t:pt;return t.test(dt(e))}function yt(e,t){return e==null?void 0:e[t]}function Ee(e,t){var n=yt(e,t);return Et(n)?n:void 0}function Tt(e,t){return e===t||e!==e&&t!==t}var X=Ee(Object,"create");function St(){this.__data__=X?X(null):{},this.size=0}function wt(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Ot="__lodash_hash_undefined__",Rt=Object.prototype,Ct=Rt.hasOwnProperty;function jt(e){var t=this.__data__;if(X){var n=t[e];return n===Ot?void 0:n}return Ct.call(t,e)?t[e]:void 0}var Lt=Object.prototype,Pt=Lt.hasOwnProperty;function Nt(e){var t=this.__data__;return X?t[e]!==void 0:Pt.call(t,e)}var At="__lodash_hash_undefined__";function Mt(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=X&&t===void 0?At:t,this}function D(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var u=e[t];this.set(u[0],u[1])}}D.prototype.clear=St,D.prototype.delete=wt,D.prototype.get=jt,D.prototype.has=Nt,D.prototype.set=Mt;function kt(){this.__data__=[],this.size=0}function ee(e,t){for(var n=e.length;n--;)if(Tt(e[n][0],t))return n;return-1}var Dt=Array.prototype,It=Dt.splice;function xt(e){var t=this.__data__,n=ee(t,e);if(n<0)return!1;var u=t.length-1;return n==u?t.pop():It.call(t,n,1),--this.size,!0}function Ft(e){var t=this.__data__,n=ee(t,e);return n<0?void 0:t[n][1]}function Wt(e){return ee(this.__data__,e)>-1}function zt(e,t){var n=this.__data__,u=ee(n,e);return u<0?(++this.size,n.push([e,t])):n[u][1]=t,this}function Y(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var u=e[t];this.set(u[0],u[1])}}Y.prototype.clear=kt,Y.prototype.delete=xt,Y.prototype.get=Ft,Y.prototype.has=Wt,Y.prototype.set=zt;var Yt=Ee($,"Map");function Gt(){this.size=0,this.__data__={hash:new D,map:new(Yt||Y),string:new D}}function Ut(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function te(e,t){var n=e.__data__;return Ut(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Ht(e){var t=te(this,e).delete(e);return this.size-=t?1:0,t}function Vt(e){return te(this,e).get(e)}function Jt(e){return te(this,e).has(e)}function Xt(e,t){var n=te(this,e),u=n.size;return n.set(e,t),this.size+=n.size==u?0:1,this}function I(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var u=e[t];this.set(u[0],u[1])}}I.prototype.clear=Gt,I.prototype.delete=Ht,I.prototype.get=Vt,I.prototype.has=Jt,I.prototype.set=Xt;var Kt="Expected a function";function ie(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Kt);var n=function(){var u=arguments,f=t?t.apply(this,u):u[0],r=n.cache;if(r.has(f))return r.get(f);var c=e.apply(this,u);return n.cache=r.set(f,c)||r,c};return n.cache=new(ie.Cache||I),n}ie.Cache=I;var ue=function(){return $.Date.now()},Bt="Expected a function",Qt=Math.max,Zt=Math.min;function ne(e,t,n){var u,f,r,c,d,p,m=0,_=!1,S=!1,O=!0;if(typeof e!="function")throw new TypeError(Bt);t=ge(t)||0,z(n)&&(_=!!n.leading,S="maxWait"in n,r=S?Qt(ge(n.maxWait)||0,t):r,O="trailing"in n?!!n.trailing:O);function P(o){var l=u,h=f;return u=f=void 0,m=o,c=e.apply(h,l),c}function F(o){return m=o,d=setTimeout(A,t),_?P(o):c}function y(o){var l=o-p,h=o-m,E=t-l;return S?Zt(E,r-h):E}function R(o){var l=o-p,h=o-m;return p===void 0||l>=t||l<0||S&&h>=r}function A(){var o=ue();if(R(o))return U(o);d=setTimeout(A,y(o))}function U(o){return d=void 0,O&&u?P(o):(u=f=void 0,c)}function H(){d!==void 0&&clearTimeout(d),m=0,u=p=f=d=void 0}function i(){return d===void 0?c:U(ue())}function a(){var o=ue(),l=R(o);if(u=arguments,f=this,p=o,l){if(d===void 0)return F(p);if(S)return clearTimeout(d),d=setTimeout(A,t),P(p)}return d===void 0&&(d=setTimeout(A,t)),c}return a.cancel=H,a.flush=i,a}var $t="Expected a function";function qt(e,t,n){var u=!0,f=!0;if(typeof e!="function")throw new TypeError($t);return z(n)&&(u="leading"in n?!!n.leading:u,f="trailing"in n?!!n.trailing:f),ne(e,t,{leading:u,maxWait:t,trailing:f})}const ye=()=>Math.random().toString().slice(2),en=e=>{const{current:{computedHash:t}}=v.useRef({get computedHash(){let n=[],u=ye();return f=>{let r=!1;return r=r||!f!=!n,r=r||(f==null?void 0:f.length)!=(n==null?void 0:n.length),r=r||f.some((c,d)=>c!=n[d]),n=f,r&&(u=ye()),u}}});return t(e)};class Te{constructor(t){ae(this,"event",new Ie.EventEmitter);ae(this,"data",{});ae(this,"registry",new Set);this.name=t,console.log("[CONTEXT] %s",t),this.event.setMaxListeners(100)}publish(t,n){n!=this.data[t]&&(this.data[t]=n,this.event.emit(String(t),{value:n}))}subscribe(t,n){const u=({value:f})=>{n(f)};return this.event.addListener(String(t),u),t in this.data&&n(this.data[t]),()=>(this.event.removeListener(String(t),u),void 0)}}const Se=ie(e=>new Te(e)),x=(e="noname")=>v.useMemo(()=>Se(e),[e]),we=(e,...t)=>{const n=new Error("[ctx] useRegistryChecker failed "+JSON.stringify({names:t,ctx:(e==null?void 0:e.name)??"undefined"}));v.useEffect(()=>{if(e)return t.some(u=>e.registry.has(u))&&console.error(n),t.forEach(u=>e.registry.add(u)),()=>{t.forEach(u=>e.registry.delete(u))}},[e,t.length])},tn=(e,t,n)=>{v.useEffect(()=>{e&&e.data[t]!=n&&e.publish(t,n)},[t,n,e]),we(e,t)},Oe=(e,t,n=0)=>{const[{value:u},f]=v.useState(()=>{var r;return{value:(r=e==null?void 0:e.data)==null?void 0:r[t]}});return v.useEffect(()=>{if(e){let r=n==0?d=>f({value:d}):ne(d=>f({value:d}),n),c=e.subscribe(t,r);return u!=e.data[t]&&f({value:e.data[t]}),()=>{c()}}},[t,e]),e==null?void 0:e.data[t]},nn=(e,t,n)=>{const[,u]=v.useState(0),f=v.useMemo(()=>n(e==null?void 0:e.data[t]),[n,e==null?void 0:e.data[t]]);return v.useEffect(()=>{if(e){let r=f,c=()=>{let p=n(e.data[t]);p!=r&&(r=p,u(m=>m+1))},d=e.subscribe(t,c);return c(),()=>d()}},[t,e]),f},ce=(e,...t)=>{v.useEffect(()=>{if(e)for(let[n,u]of t)e.data[n]!=u&&e.publish(n,u)},[e,en(t.flat())]),we(e,...t.map(n=>n[0]))},rn=(e,...t)=>{const[,n]=v.useState(0),u=t.map(f=>{var r;return(r=e==null?void 0:e.data)==null?void 0:r[f]});return v.useEffect(()=>{if(e){let f=u;const r=ne(()=>{let p=t.map(m=>{var _;return(_=e==null?void 0:e.data)==null?void 0:_[m]});t.some((m,_)=>f[_]!=p[_])&&(f=p,n(m=>m+1))},1);let c=t.map(p=>e.subscribe(p,r)),d=setTimeout(r,1);return()=>{clearTimeout(d),r.cancel(),c.forEach(p=>p())}}},[e,...t]),Object.fromEntries(t.map((f,r)=>[f,u[r]]))},on=(e,t=100,...n)=>{const[,u]=v.useState(0),f=n.map(r=>{var c;return(c=e==null?void 0:e.data)==null?void 0:c[r]});return v.useEffect(()=>{if(e){let r=f;const c=qt(()=>{let m=n.map(_=>{var S;return(S=e==null?void 0:e.data)==null?void 0:S[_]});n.some((_,S)=>r[S]!=m[S])&&(r=m,u(_=>_+1))},t);let d=n.map(m=>e.subscribe(m,c)),p=setTimeout(c,1);return()=>{clearTimeout(p),c.cancel(),d.forEach(m=>m())}}},[e,...n]),f};var re={exports:{}},K={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Oe;function rn(){if(Oe)return K;Oe=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(u,l,r){var c=null;if(r!==void 0&&(c=""+r),l.key!==void 0&&(c=""+l.key),"key"in l){r={};for(var h in l)h!=="key"&&(r[h]=l[h])}else r=l;return l=r.ref,{$$typeof:e,type:u,key:c,ref:l!==void 0?l:null,props:r}}return K.Fragment=t,K.jsx=n,K.jsxs=n,K}var B={};/**
9
+ */var Re;function an(){if(Re)return K;Re=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(u,f,r){var c=null;if(r!==void 0&&(c=""+r),f.key!==void 0&&(c=""+f.key),"key"in f){r={};for(var d in f)d!=="key"&&(r[d]=f[d])}else r=f;return f=r.ref,{$$typeof:e,type:u,key:c,ref:f!==void 0?f:null,props:r}}return K.Fragment=t,K.jsx=n,K.jsxs=n,K}var B={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,9 +14,9 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Re;function on(){return Re||(Re=1,process.env.NODE_ENV!=="production"&&function(){function e(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===g?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case y:return"Fragment";case A:return"Profiler";case R:return"StrictMode";case a:return"Suspense";case o:return"SuspenseList";case E:return"Activity"}if(typeof s=="object")switch(typeof s.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),s.$$typeof){case F:return"Portal";case V:return(s.displayName||"Context")+".Provider";case U:return(s._context.displayName||"Context")+".Consumer";case i:var b=s.render;return s=s.displayName,s||(s=b.displayName||b.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case f:return b=s.displayName||null,b!==null?b:e(s.type)||"Memo";case d:b=s._payload,s=s._init;try{return e(s(b))}catch{}}return null}function t(s){return""+s}function n(s){try{t(s);var b=!1}catch{b=!0}if(b){b=console;var w=b.error,C=typeof Symbol=="function"&&Symbol.toStringTag&&s[Symbol.toStringTag]||s.constructor.name||"Object";return w.call(b,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",C),t(s)}}function u(s){if(s===y)return"<>";if(typeof s=="object"&&s!==null&&s.$$typeof===d)return"<...>";try{var b=e(s);return b?"<"+b+">":"<...>"}catch{return"<...>"}}function l(){var s=L.A;return s===null?null:s.getOwner()}function r(){return Error("react-stack-top-frame")}function c(s){if(M.call(s,"key")){var b=Object.getOwnPropertyDescriptor(s,"key").get;if(b&&b.isReactWarning)return!1}return s.key!==void 0}function h(s,b){function w(){je||(je=!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)",b))}w.isReactWarning=!0,Object.defineProperty(s,"key",{get:w,configurable:!0})}function p(){var s=e(this.type);return Le[s]||(Le[s]=!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.")),s=this.props.ref,s!==void 0?s:null}function m(s,b,w,C,k,N,fe,le){return w=N.ref,s={$$typeof:P,type:s,key:b,props:N,_owner:k},(w!==void 0?w:null)!==null?Object.defineProperty(s,"ref",{enumerable:!1,get:p}):Object.defineProperty(s,"ref",{enumerable:!1,value:null}),s._store={},Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(s,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(s,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:fe}),Object.defineProperty(s,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:le}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s}function _(s,b,w,C,k,N,fe,le){var j=b.children;if(j!==void 0)if(C)if(oe(j)){for(C=0;C<j.length;C++)T(j[C]);Object.freeze&&Object.freeze(j)}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 T(j);if(M.call(b,"key")){j=e(s);var H=Object.keys(b).filter(function(hn){return hn!=="key"});C=0<H.length?"{key: someKey, "+H.join(": ..., ")+": ...}":"{key: someKey}",Ae[j+C]||(H=0<H.length?"{"+H.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var Ce;function sn(){return Ce||(Ce=1,process.env.NODE_ENV!=="production"&&function(){function e(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===g?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case y:return"Fragment";case A:return"Profiler";case R:return"StrictMode";case a:return"Suspense";case o:return"SuspenseList";case E:return"Activity"}if(typeof s=="object")switch(typeof s.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),s.$$typeof){case F:return"Portal";case H:return(s.displayName||"Context")+".Provider";case U:return(s._context.displayName||"Context")+".Consumer";case i:var b=s.render;return s=s.displayName,s||(s=b.displayName||b.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case l:return b=s.displayName||null,b!==null?b:e(s.type)||"Memo";case h:b=s._payload,s=s._init;try{return e(s(b))}catch{}}return null}function t(s){return""+s}function n(s){try{t(s);var b=!1}catch{b=!0}if(b){b=console;var w=b.error,C=typeof Symbol=="function"&&Symbol.toStringTag&&s[Symbol.toStringTag]||s.constructor.name||"Object";return w.call(b,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",C),t(s)}}function u(s){if(s===y)return"<>";if(typeof s=="object"&&s!==null&&s.$$typeof===h)return"<...>";try{var b=e(s);return b?"<"+b+">":"<...>"}catch{return"<...>"}}function f(){var s=L.A;return s===null?null:s.getOwner()}function r(){return Error("react-stack-top-frame")}function c(s){if(M.call(s,"key")){var b=Object.getOwnPropertyDescriptor(s,"key").get;if(b&&b.isReactWarning)return!1}return s.key!==void 0}function d(s,b){function w(){Le||(Le=!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)",b))}w.isReactWarning=!0,Object.defineProperty(s,"key",{get:w,configurable:!0})}function p(){var s=e(this.type);return Pe[s]||(Pe[s]=!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.")),s=this.props.ref,s!==void 0?s:null}function m(s,b,w,C,k,N,fe,le){return w=N.ref,s={$$typeof:P,type:s,key:b,props:N,_owner:k},(w!==void 0?w:null)!==null?Object.defineProperty(s,"ref",{enumerable:!1,get:p}):Object.defineProperty(s,"ref",{enumerable:!1,value:null}),s._store={},Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(s,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(s,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:fe}),Object.defineProperty(s,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:le}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s}function _(s,b,w,C,k,N,fe,le){var j=b.children;if(j!==void 0)if(C)if(oe(j)){for(C=0;C<j.length;C++)S(j[C]);Object.freeze&&Object.freeze(j)}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 S(j);if(M.call(b,"key")){j=e(s);var V=Object.keys(b).filter(function(vn){return vn!=="key"});C=0<V.length?"{key: someKey, "+V.join(": ..., ")+": ...}":"{key: someKey}",Me[j+C]||(V=0<V.length?"{"+V.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
18
  let props = %s;
19
19
  <%s {...props} />
20
20
  React keys must be passed directly to JSX without using spread:
21
21
  let props = %s;
22
- <%s key={someKey} {...props} />`,C,j,H,j),Ae[j+C]=!0)}if(j=null,w!==void 0&&(n(w),j=""+w),c(b)&&(n(b.key),j=""+b.key),"key"in b){w={};for(var de in b)de!=="key"&&(w[de]=b[de])}else w=b;return j&&h(w,typeof s=="function"?s.displayName||s.name||"Unknown":s),m(s,j,N,k,l(),w,fe,le)}function T(s){typeof s=="object"&&s!==null&&s.$$typeof===P&&s._store&&(s._store.validated=1)}var O=v,P=Symbol.for("react.transitional.element"),F=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),U=Symbol.for("react.consumer"),V=Symbol.for("react.context"),i=Symbol.for("react.forward_ref"),a=Symbol.for("react.suspense"),o=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),E=Symbol.for("react.activity"),g=Symbol.for("react.client.reference"),L=O.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=Object.prototype.hasOwnProperty,oe=Array.isArray,Q=console.createTask?console.createTask:function(){return null};O={"react-stack-bottom-frame":function(s){return s()}};var je,Le={},Pe=O["react-stack-bottom-frame"].bind(O,r)(),Ne=Q(u(r)),Ae={};B.Fragment=y,B.jsx=function(s,b,w,C,k){var N=1e4>L.recentlyCreatedOwnerStacks++;return _(s,b,w,!1,C,k,N?Error("react-stack-top-frame"):Pe,N?Q(u(s)):Ne)},B.jsxs=function(s,b,w,C,k){var N=1e4>L.recentlyCreatedOwnerStacks++;return _(s,b,w,!0,C,k,N?Error("react-stack-top-frame"):Pe,N?Q(u(s)):Ne)}}()),B}var Ce;function an(){return Ce||(Ce=1,process.env.NODE_ENV==="production"?re.exports=rn():re.exports=on()),re.exports}var G=an();const sn=(e,t)=>{const n=r=>[e,...Object.entries(r??{}).sort((c,h)=>c[0].localeCompare(h[0])).flat()].join("-");let u=new Set;const l=r=>{const c=n(r),h=x(c),p=t(r),m=v.useMemo(()=>new Error().stack,[]);return ce(h,...Object.entries(p)),v.useEffect(()=>{if(u.has(c)){const _=new Error("RootContext "+c+" are mounted more than once");throw _.stack=m,_}return u.add(c),()=>{u.delete(c)}}),G.jsx(G.Fragment,{})};return l.displayName=`State[${(t==null?void 0:t.name)??"??"}]`,{resolveCtxName:n,Root:l,useCtxStateStrict:r=>{const c=n(r),h=v.useMemo(()=>new Error().stack,[]);return v.useEffect(()=>{if(!u.has(c)){const p=new Error("RootContext ["+c+"] is not mounted");throw p.stack=h,p}},[c]),x(c)},useCtxState:r=>{const c=n(r),h=v.useMemo(()=>new Error().stack,[]);return v.useEffect(()=>{if(!u.has(c)){const p=new Error("RootContext ["+c+"] is not mounted");p.stack=h;let m=setTimeout(()=>console.error(p),1e3);return()=>clearTimeout(m)}},[u.has(c)]),x(c)}}},un=function(){const e=new WeakMap;return t=>{let n=e.get(t);return n||e.set(t,n=((t==null?void 0:t.name)??"")+Math.random().toString()),n}}(),cn=e=>[...Object.entries(e??{}).sort((t,n)=>t[0].localeCompare(n[0])).flat()].join("-"),fn=({Wrapper:e=v.Fragment})=>{const t=x("auto-ctx"),[n,u]=v.useState({}),l=v.useCallback((r,c)=>{const h=un(r),p=cn(c);return u(({[h]:{Component:m=r,subState:{[p]:_={params:c,counter:0},...T}={}}={},...O})=>({...O,[h]:{Component:m,subState:{...T,[p]:{..._,counter:_.counter+1}}}})),()=>u(({[h]:{Component:m=r,subState:{[p]:_={params:c,counter:0},...T}={}}={},...O})=>({...O,[h]:{Component:m,subState:{...T,..._.counter>1?{[p]:{..._,counter:_.counter-1}}:{}}}}))},[]);return ce(t,["subscribe",l],["state",n]),G.jsx(G.Fragment,{children:Object.entries(n).flatMap(([r,{Component:c,subState:h}])=>Object.entries(h).map(([p,{counter:m,params:_}])=>({key:r+p,Component:c,params:_,counter:m})).filter(p=>p.counter>0).map(({key:p,params:m,Component:_})=>G.jsx(e,{children:G.jsx(_,{...m})},p)))})},ln=({Root:e,useCtxState:t,useCtxStateStrict:n,resolveCtxName:u})=>({useCtxState:l=>{const r=u(l),c=we(x("auto-ctx"),"subscribe");return v.useEffect(()=>c==null?void 0:c(e,l),[c,r]),x(r)}}),dn=e=>{const[,t]=v.useState(0),{proxy:n,finalGetter:u,openGetter:l,clean:r}=v.useMemo(()=>{const c=new Set,h={},p=new Map,m=new Proxy(e==null?void 0:e.data,{get(y,R){if(_)return c.add(R),h[R]=y[R];throw new Error("now allow here")}});let _=!0,T=ne(()=>{[...c.values()].some(y=>{var R;return h[y]!=((R=e==null?void 0:e.data)==null?void 0:R[y])})&&t(y=>y+1)},0),O=()=>{_=!0,c.clear()},P=()=>{_=!1,[...c.values()].filter(y=>!p.has(y)).forEach(y=>{p.set(y,e==null?void 0:e.subscribe(y,T))}),[...p.keys()].filter(y=>!c.has(y)).forEach(y=>{let R=p.get(y);R==null||R(),p.delete(y)})};return{proxy:m,finalGetter:P,openGetter:O,clean:()=>{O(),P(),t(y=>y+1)}}},[e]);return l(),setTimeout(u,0),v.useEffect(()=>()=>r(),[r]),n};S.AutoRootCtx=fn,S.Context=ye,S.createAutoCtx=ln,S.createRootCtx=sn,S.getContext=Se,S.useDataContext=x,S.useDataSource=qt,S.useDataSourceMultiple=ce,S.useDataSubscribe=we,S.useDataSubscribeMultiple=tn,S.useDataSubscribeMultipleWithDebounce=nn,S.useDataSubscribeWithTransform=en,S.useQuickSubscribe=dn,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})});
22
+ <%s key={someKey} {...props} />`,C,j,V,j),Me[j+C]=!0)}if(j=null,w!==void 0&&(n(w),j=""+w),c(b)&&(n(b.key),j=""+b.key),"key"in b){w={};for(var de in b)de!=="key"&&(w[de]=b[de])}else w=b;return j&&d(w,typeof s=="function"?s.displayName||s.name||"Unknown":s),m(s,j,N,k,f(),w,fe,le)}function S(s){typeof s=="object"&&s!==null&&s.$$typeof===P&&s._store&&(s._store.validated=1)}var O=v,P=Symbol.for("react.transitional.element"),F=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),U=Symbol.for("react.consumer"),H=Symbol.for("react.context"),i=Symbol.for("react.forward_ref"),a=Symbol.for("react.suspense"),o=Symbol.for("react.suspense_list"),l=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),E=Symbol.for("react.activity"),g=Symbol.for("react.client.reference"),L=O.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=Object.prototype.hasOwnProperty,oe=Array.isArray,Q=console.createTask?console.createTask:function(){return null};O={"react-stack-bottom-frame":function(s){return s()}};var Le,Pe={},Ne=O["react-stack-bottom-frame"].bind(O,r)(),Ae=Q(u(r)),Me={};B.Fragment=y,B.jsx=function(s,b,w,C,k){var N=1e4>L.recentlyCreatedOwnerStacks++;return _(s,b,w,!1,C,k,N?Error("react-stack-top-frame"):Ne,N?Q(u(s)):Ae)},B.jsxs=function(s,b,w,C,k){var N=1e4>L.recentlyCreatedOwnerStacks++;return _(s,b,w,!0,C,k,N?Error("react-stack-top-frame"):Ne,N?Q(u(s)):Ae)}}()),B}var je;function un(){return je||(je=1,process.env.NODE_ENV==="production"?re.exports=an():re.exports=sn()),re.exports}var G=un();const cn=(e,t)=>{const n=r=>[e,...Object.entries(r??{}).sort((c,d)=>c[0].localeCompare(d[0])).flat()].join("-");let u=new Set;const f=r=>{const c=n(r),d=x(c),p=t(r),m=v.useMemo(()=>new Error().stack,[]);return ce(d,...Object.entries(p)),v.useEffect(()=>{if(u.has(c)){const _=new Error("RootContext "+c+" are mounted more than once");throw _.stack=m,_}return u.add(c),()=>{u.delete(c)}}),G.jsx(G.Fragment,{})};return f.displayName=`State[${(t==null?void 0:t.name)??"??"}]`,{resolveCtxName:n,Root:f,useCtxStateStrict:r=>{const c=n(r),d=v.useMemo(()=>new Error().stack,[]);return v.useEffect(()=>{if(!u.has(c)){const p=new Error("RootContext ["+c+"] is not mounted");throw p.stack=d,p}},[c]),x(c)},useCtxState:r=>{const c=n(r),d=v.useMemo(()=>new Error().stack,[]);return v.useEffect(()=>{if(!u.has(c)){const p=new Error("RootContext ["+c+"] is not mounted");p.stack=d;let m=setTimeout(()=>console.error(p),1e3);return()=>clearTimeout(m)}},[u.has(c)]),x(c)}}},fn=function(){const e=new WeakMap;return t=>{let n=e.get(t);return n||e.set(t,n=((t==null?void 0:t.name)??"")+Math.random().toString()),n}}(),ln=e=>[...Object.entries(e??{}).sort((t,n)=>t[0].localeCompare(n[0])).flat()].join("-"),dn=({Wrapper:e=v.Fragment})=>{const t=x("auto-ctx"),[n,u]=v.useState({}),f=v.useCallback((r,c)=>{const d=fn(r),p=ln(c);return u(({[d]:{Component:m=r,subState:{[p]:_={params:c,counter:0},...S}={}}={},...O})=>({...O,[d]:{Component:m,subState:{...S,[p]:{..._,counter:_.counter+1}}}})),()=>u(({[d]:{Component:m=r,subState:{[p]:_={params:c,counter:0},...S}={}}={},...O})=>({...O,[d]:{Component:m,subState:{...S,..._.counter>1?{[p]:{..._,counter:_.counter-1}}:{}}}}))},[]);return ce(t,["subscribe",f],["state",n]),G.jsx(G.Fragment,{children:Object.entries(n).flatMap(([r,{Component:c,subState:d}])=>Object.entries(d).map(([p,{counter:m,params:_}])=>({key:r+p,Component:c,params:_,counter:m})).filter(p=>p.counter>0).map(({key:p,params:m,Component:_})=>G.jsx(e,{children:G.jsx(_,{...m})},p)))})},hn=({Root:e,useCtxState:t,useCtxStateStrict:n,resolveCtxName:u})=>({useCtxState:f=>{const r=u(f),c=Oe(x("auto-ctx"),"subscribe");return v.useEffect(()=>c==null?void 0:c(e,f),[c,r]),x(r)}}),pn=e=>{const[,t]=v.useState(0),{proxy:n,finalGetter:u,openGetter:f,clean:r}=v.useMemo(()=>{const c=new Set,d={},p=new Map,m=new Proxy(e==null?void 0:e.data,{get(y,R){if(_)return c.add(R),d[R]=y[R];throw new Error("now allow here")}});let _=!0,S=ne(()=>{[...c.values()].some(y=>{var R;return d[y]!=((R=e==null?void 0:e.data)==null?void 0:R[y])})&&t(y=>y+1)},0),O=()=>{_=!0,c.clear()},P=()=>{_=!1,[...c.values()].filter(y=>!p.has(y)).forEach(y=>{p.set(y,e==null?void 0:e.subscribe(y,S))}),[...p.keys()].filter(y=>!c.has(y)).forEach(y=>{let R=p.get(y);R==null||R(),p.delete(y)})};return{proxy:m,finalGetter:P,openGetter:O,clean:()=>{O(),P(),t(y=>y+1)}}},[e]);return f(),setTimeout(u,0),v.useEffect(()=>()=>r(),[r]),n};T.AutoRootCtx=dn,T.Context=Te,T.createAutoCtx=hn,T.createRootCtx=cn,T.getContext=Se,T.useDataContext=x,T.useDataSource=tn,T.useDataSourceMultiple=ce,T.useDataSubscribe=Oe,T.useDataSubscribeMultiple=rn,T.useDataSubscribeMultipleWithDebounce=on,T.useDataSubscribeWithTransform=nn,T.useQuickSubscribe=pn,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
@@ -0,0 +1 @@
1
+ export declare const useObjHash: (e: any[]) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-state-custom",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "A React library built with Vite and TypeScript",
5
5
  "type": "module",
6
6
  "main": "dist/index.umd.js",
@@ -1,6 +1,7 @@
1
1
  import event from "events"
2
2
  import { debounce, memoize, throttle } from "lodash-es"
3
3
  import { useEffect, useMemo, useState } from "react"
4
+ import { useObjHash } from "./useObjectHash"
4
5
 
5
6
 
6
7
 
@@ -54,7 +55,7 @@ export class Context<D> {
54
55
  listender(value)
55
56
  }
56
57
  this.event.addListener(String(key), listener)
57
- console.log("listenerCount:", String(key), this.event.listenerCount(String(key)))
58
+ // console.log("listenerCount:", String(key), this.event.listenerCount(String(key)))
58
59
 
59
60
  if (key in this.data) listender(this.data[key])
60
61
 
@@ -210,7 +211,7 @@ export const useDataSourceMultiple = <D, T extends readonly (keyof D)[]>(
210
211
  ctx.data[key] != value && ctx.publish(key, value)
211
212
  }
212
213
  }
213
- }, [ctx, ...entries.flat()])
214
+ }, [ctx, useObjHash(entries.flat())])
214
215
 
215
216
  useRegistryChecker(ctx, ...entries.map(e => e[0]) as any)
216
217
 
@@ -0,0 +1,30 @@
1
+ import { useRef } from "react"
2
+
3
+
4
+ const randomHash = () => Math.random().toString().slice(2)
5
+
6
+ export const useObjHash = (e: any[]): string => {
7
+
8
+ const { current: { computedHash } } = useRef({
9
+ get computedHash() {
10
+ let currentValues: any[] = []
11
+ let currentHash = randomHash()
12
+ return (e: any[]) => {
13
+ let isDiff = false
14
+
15
+ isDiff = isDiff || ((!e) != (!currentValues))
16
+ isDiff = isDiff || (e?.length != currentValues?.length);
17
+ isDiff = isDiff || (e.some((f, i) => f != currentValues[i]));
18
+
19
+ currentValues = e;
20
+ if (isDiff) {
21
+ currentHash = randomHash()
22
+ }
23
+
24
+ return currentHash
25
+ }
26
+ }
27
+ })
28
+
29
+ return computedHash(e)
30
+ }