ueca-react 1.0.7 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +109 -119
  3. package/dist/index.d.ts +266 -4
  4. package/dist/ueca-react.js +1453 -0
  5. package/docs/Arrays and Reactivity in UECA-React.md +158 -0
  6. package/docs/Automatic onChange Events in UECA-React.md +142 -0
  7. package/docs/Automatic onChanging Events in UECA-React.md +157 -0
  8. package/docs/Automatic onPropChange and onPropChanging Events in UECA-React.md +112 -0
  9. package/docs/Component Extension in UECA-React.md +275 -0
  10. package/docs/Component IDs in UECA-React.md +181 -0
  11. package/docs/{component-intergation-model.md → Component Integration Model in UECA-React.md } +4 -3
  12. package/docs/{component-mental-model.md → Component Mental Model in UECA-React.md } +4 -3
  13. package/docs/Introduction to UECA-React Components.md +190 -0
  14. package/docs/Introduction to UECA-React.md +24 -0
  15. package/docs/Lifecycle Hooks in UECA-React.md +237 -0
  16. package/docs/Message Bus in UECA-React.md +260 -0
  17. package/docs/Model Caching in UECA-React.md +144 -0
  18. package/docs/Property Bindings in UECA-React.md +191 -0
  19. package/docs/State Management in UECA-React.md +128 -0
  20. package/docs/Technology of UECA-React.md +45 -0
  21. package/docs/Tracing in UECA-React.md +110 -0
  22. package/docs/code-template.md +53 -27
  23. package/docs/index.md +31 -11
  24. package/package.json +68 -72
  25. package/dist/componentModel.d.ts +0 -127
  26. package/dist/componentModel.js +0 -772
  27. package/dist/dynamicContent.d.ts +0 -22
  28. package/dist/dynamicContent.js +0 -80
  29. package/dist/index.js +0 -29
  30. package/dist/messageBus.d.ts +0 -46
  31. package/dist/messageBus.js +0 -141
  32. package/dist/utils.d.ts +0 -8
  33. package/dist/utils.js +0 -52
  34. package/docs/base-concepts.md +0 -192
  35. package/docs/bindings-overview.md +0 -164
  36. package/docs/general-code-structure.md +0 -177
  37. package/docs/introduction.md +0 -56
  38. package/docs/message-bus.md +0 -177
  39. package/docs/technology.md +0 -45
@@ -0,0 +1,1453 @@
1
+ import * as $ from "react";
2
+ import Le from "react";
3
+ import * as d from "mobx";
4
+ import * as B from "mobx-react";
5
+ var L = { exports: {} }, j = {};
6
+ /**
7
+ * @license React
8
+ * react-jsx-runtime.production.js
9
+ *
10
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
11
+ *
12
+ * This source code is licensed under the MIT license found in the
13
+ * LICENSE file in the root directory of this source tree.
14
+ */
15
+ var be;
16
+ function We() {
17
+ if (be) return j;
18
+ be = 1;
19
+ var n = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
20
+ function t(i, r, o) {
21
+ var c = null;
22
+ if (o !== void 0 && (c = "" + o), r.key !== void 0 && (c = "" + r.key), "key" in r) {
23
+ o = {};
24
+ for (var a in r)
25
+ a !== "key" && (o[a] = r[a]);
26
+ } else o = r;
27
+ return r = o.ref, {
28
+ $$typeof: n,
29
+ type: i,
30
+ key: c,
31
+ ref: r !== void 0 ? r : null,
32
+ props: o
33
+ };
34
+ }
35
+ return j.Fragment = e, j.jsx = t, j.jsxs = t, j;
36
+ }
37
+ var S = {};
38
+ /**
39
+ * @license React
40
+ * react-jsx-runtime.development.js
41
+ *
42
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
43
+ *
44
+ * This source code is licensed under the MIT license found in the
45
+ * LICENSE file in the root directory of this source tree.
46
+ */
47
+ var $e;
48
+ function Ve() {
49
+ return $e || ($e = 1, process.env.NODE_ENV !== "production" && (function() {
50
+ function n(s) {
51
+ if (s == null) return null;
52
+ if (typeof s == "function")
53
+ return s.$$typeof === De ? null : s.displayName || s.name || null;
54
+ if (typeof s == "string") return s;
55
+ switch (s) {
56
+ case H:
57
+ return "Fragment";
58
+ case ke:
59
+ return "Profiler";
60
+ case Pe:
61
+ return "StrictMode";
62
+ case je:
63
+ return "Suspense";
64
+ case Se:
65
+ return "SuspenseList";
66
+ case xe:
67
+ return "Activity";
68
+ }
69
+ if (typeof s == "object")
70
+ switch (typeof s.tag == "number" && console.error(
71
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
72
+ ), s.$$typeof) {
73
+ case Oe:
74
+ return "Portal";
75
+ case Ie:
76
+ return (s.displayName || "Context") + ".Provider";
77
+ case Te:
78
+ return (s._context.displayName || "Context") + ".Consumer";
79
+ case Be:
80
+ var l = s.render;
81
+ return s = s.displayName, s || (s = l.displayName || l.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s;
82
+ case Ae:
83
+ return l = s.displayName || null, l !== null ? l : n(s.type) || "Memo";
84
+ case de:
85
+ l = s._payload, s = s._init;
86
+ try {
87
+ return n(s(l));
88
+ } catch {
89
+ }
90
+ }
91
+ return null;
92
+ }
93
+ function e(s) {
94
+ return "" + s;
95
+ }
96
+ function t(s) {
97
+ try {
98
+ e(s);
99
+ var l = !1;
100
+ } catch {
101
+ l = !0;
102
+ }
103
+ if (l) {
104
+ l = console;
105
+ var _ = l.error, m = typeof Symbol == "function" && Symbol.toStringTag && s[Symbol.toStringTag] || s.constructor.name || "Object";
106
+ return _.call(
107
+ l,
108
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
109
+ m
110
+ ), e(s);
111
+ }
112
+ }
113
+ function i(s) {
114
+ if (s === H) return "<>";
115
+ if (typeof s == "object" && s !== null && s.$$typeof === de)
116
+ return "<...>";
117
+ try {
118
+ var l = n(s);
119
+ return l ? "<" + l + ">" : "<...>";
120
+ } catch {
121
+ return "<...>";
122
+ }
123
+ }
124
+ function r() {
125
+ var s = K.A;
126
+ return s === null ? null : s.getOwner();
127
+ }
128
+ function o() {
129
+ return Error("react-stack-top-frame");
130
+ }
131
+ function c(s) {
132
+ if (ue.call(s, "key")) {
133
+ var l = Object.getOwnPropertyDescriptor(s, "key").get;
134
+ if (l && l.isReactWarning) return !1;
135
+ }
136
+ return s.key !== void 0;
137
+ }
138
+ function a(s, l) {
139
+ function _() {
140
+ _e || (_e = !0, console.error(
141
+ "%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)",
142
+ l
143
+ ));
144
+ }
145
+ _.isReactWarning = !0, Object.defineProperty(s, "key", {
146
+ get: _,
147
+ configurable: !0
148
+ });
149
+ }
150
+ function u() {
151
+ var s = n(this.type);
152
+ return fe[s] || (fe[s] = !0, console.error(
153
+ "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."
154
+ )), s = this.props.ref, s !== void 0 ? s : null;
155
+ }
156
+ function R(s, l, _, m, M, v, Q, ee) {
157
+ return _ = v.ref, s = {
158
+ $$typeof: le,
159
+ type: s,
160
+ key: l,
161
+ props: v,
162
+ _owner: M
163
+ }, (_ !== void 0 ? _ : null) !== null ? Object.defineProperty(s, "ref", {
164
+ enumerable: !1,
165
+ get: u
166
+ }) : Object.defineProperty(s, "ref", { enumerable: !1, value: null }), s._store = {}, Object.defineProperty(s._store, "validated", {
167
+ configurable: !1,
168
+ enumerable: !1,
169
+ writable: !0,
170
+ value: 0
171
+ }), Object.defineProperty(s, "_debugInfo", {
172
+ configurable: !1,
173
+ enumerable: !1,
174
+ writable: !0,
175
+ value: null
176
+ }), Object.defineProperty(s, "_debugStack", {
177
+ configurable: !1,
178
+ enumerable: !1,
179
+ writable: !0,
180
+ value: Q
181
+ }), Object.defineProperty(s, "_debugTask", {
182
+ configurable: !1,
183
+ enumerable: !1,
184
+ writable: !0,
185
+ value: ee
186
+ }), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
187
+ }
188
+ function ce(s, l, _, m, M, v, Q, ee) {
189
+ var g = l.children;
190
+ if (g !== void 0)
191
+ if (m)
192
+ if (Ne(g)) {
193
+ for (m = 0; m < g.length; m++)
194
+ he(g[m]);
195
+ Object.freeze && Object.freeze(g);
196
+ } else
197
+ console.error(
198
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
199
+ );
200
+ else he(g);
201
+ if (ue.call(l, "key")) {
202
+ g = n(s);
203
+ var P = Object.keys(l).filter(function(Fe) {
204
+ return Fe !== "key";
205
+ });
206
+ m = 0 < P.length ? "{key: someKey, " + P.join(": ..., ") + ": ...}" : "{key: someKey}", pe[g + m] || (P = 0 < P.length ? "{" + P.join(": ..., ") + ": ...}" : "{}", console.error(
207
+ `A props object containing a "key" prop is being spread into JSX:
208
+ let props = %s;
209
+ <%s {...props} />
210
+ React keys must be passed directly to JSX without using spread:
211
+ let props = %s;
212
+ <%s key={someKey} {...props} />`,
213
+ m,
214
+ g,
215
+ P,
216
+ g
217
+ ), pe[g + m] = !0);
218
+ }
219
+ if (g = null, _ !== void 0 && (t(_), g = "" + _), c(l) && (t(l.key), g = "" + l.key), "key" in l) {
220
+ _ = {};
221
+ for (var te in l)
222
+ te !== "key" && (_[te] = l[te]);
223
+ } else _ = l;
224
+ return g && a(
225
+ _,
226
+ typeof s == "function" ? s.displayName || s.name || "Unknown" : s
227
+ ), R(
228
+ s,
229
+ g,
230
+ v,
231
+ M,
232
+ r(),
233
+ _,
234
+ Q,
235
+ ee
236
+ );
237
+ }
238
+ function he(s) {
239
+ typeof s == "object" && s !== null && s.$$typeof === le && s._store && (s._store.validated = 1);
240
+ }
241
+ var F = Le, le = Symbol.for("react.transitional.element"), Oe = Symbol.for("react.portal"), H = Symbol.for("react.fragment"), Pe = Symbol.for("react.strict_mode"), ke = Symbol.for("react.profiler"), Te = Symbol.for("react.consumer"), Ie = Symbol.for("react.context"), Be = Symbol.for("react.forward_ref"), je = Symbol.for("react.suspense"), Se = Symbol.for("react.suspense_list"), Ae = Symbol.for("react.memo"), de = Symbol.for("react.lazy"), xe = Symbol.for("react.activity"), De = Symbol.for("react.client.reference"), K = F.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, ue = Object.prototype.hasOwnProperty, Ne = Array.isArray, Z = console.createTask ? console.createTask : function() {
242
+ return null;
243
+ };
244
+ F = {
245
+ react_stack_bottom_frame: function(s) {
246
+ return s();
247
+ }
248
+ };
249
+ var _e, fe = {}, me = F.react_stack_bottom_frame.bind(
250
+ F,
251
+ o
252
+ )(), ge = Z(i(o)), pe = {};
253
+ S.Fragment = H, S.jsx = function(s, l, _, m, M) {
254
+ var v = 1e4 > K.recentlyCreatedOwnerStacks++;
255
+ return ce(
256
+ s,
257
+ l,
258
+ _,
259
+ !1,
260
+ m,
261
+ M,
262
+ v ? Error("react-stack-top-frame") : me,
263
+ v ? Z(i(s)) : ge
264
+ );
265
+ }, S.jsxs = function(s, l, _, m, M) {
266
+ var v = 1e4 > K.recentlyCreatedOwnerStacks++;
267
+ return ce(
268
+ s,
269
+ l,
270
+ _,
271
+ !0,
272
+ m,
273
+ M,
274
+ v ? Error("react-stack-top-frame") : me,
275
+ v ? Z(i(s)) : ge
276
+ );
277
+ };
278
+ })()), S;
279
+ }
280
+ var ve;
281
+ function ze() {
282
+ return ve || (ve = 1, process.env.NODE_ENV === "production" ? L.exports = We() : L.exports = Ve()), L.exports;
283
+ }
284
+ var p = ze();
285
+ function lt(n) {
286
+ if (n)
287
+ return JSON.parse(JSON.stringify(n));
288
+ }
289
+ function b(n) {
290
+ return typeof n > "u";
291
+ }
292
+ function Ye(n) {
293
+ return n === null;
294
+ }
295
+ function X(n) {
296
+ return typeof n == "string";
297
+ }
298
+ function dt(n) {
299
+ return typeof n == "number";
300
+ }
301
+ function ut(n) {
302
+ return typeof n == "boolean";
303
+ }
304
+ function T(n) {
305
+ return Array.isArray(n);
306
+ }
307
+ function f(n) {
308
+ return typeof n == "function";
309
+ }
310
+ function O(n) {
311
+ return n !== null && typeof n == "object";
312
+ }
313
+ function Ue(n) {
314
+ return n instanceof Map;
315
+ }
316
+ function ie(n) {
317
+ return typeof n == "symbol";
318
+ }
319
+ function ye(n, e) {
320
+ if (n === e)
321
+ return !0;
322
+ if (O(n) && O(e)) {
323
+ const t = Object.keys(n), i = Object.keys(e);
324
+ if (t.length !== i.length)
325
+ return !1;
326
+ for (const r of t)
327
+ if (!i.includes(r) || !ye(n[r], e[r]))
328
+ return !1;
329
+ return !0;
330
+ }
331
+ return !1;
332
+ }
333
+ function k(n, e) {
334
+ return n.filter((t) => e.includes(t));
335
+ }
336
+ function _t(n) {
337
+ return n.condition ? /* @__PURE__ */ p.jsx(p.Fragment, { children: oe(n.children) }) : null;
338
+ }
339
+ function oe(n) {
340
+ if (f(n)) {
341
+ const e = B.observer(n);
342
+ return /* @__PURE__ */ p.jsx(e, {});
343
+ }
344
+ if (N(n)) {
345
+ const e = n;
346
+ return /* @__PURE__ */ p.jsx(e, {});
347
+ }
348
+ return n;
349
+ }
350
+ const ft = B.observer((n) => n.render === !1 ? null : /* @__PURE__ */ p.jsx(p.Fragment, { children: oe(n.node) }));
351
+ function x(n, e = "Invalid condition") {
352
+ if (n)
353
+ throw Error(e);
354
+ }
355
+ function mt(n, e) {
356
+ if (!n)
357
+ throw Error(e || "Invalid condition");
358
+ }
359
+ async function gt(n) {
360
+ await new Promise((e) => setTimeout(e, n));
361
+ }
362
+ function pt(n) {
363
+ return f(n) ? B.observer(n) : d.observable(n);
364
+ }
365
+ function C(n) {
366
+ return !!(n && O(n) && Object.keys(n).length === 2 && f(n[0]) && (f(n[1]) || b(n[1])));
367
+ }
368
+ function qe(n) {
369
+ return C(n) && b(n[1]);
370
+ }
371
+ function D(n) {
372
+ return C(n) && f(n[1]);
373
+ }
374
+ function Je(n, e) {
375
+ return [
376
+ n ? () => {
377
+ let i;
378
+ try {
379
+ i = n();
380
+ } catch (r) {
381
+ h(r.message, "error");
382
+ }
383
+ return i;
384
+ } : void 0,
385
+ e ? (i) => {
386
+ try {
387
+ e(i);
388
+ } catch (r) {
389
+ h(r.message, "error");
390
+ }
391
+ } : void 0
392
+ ];
393
+ }
394
+ function Xe(n, e) {
395
+ return [
396
+ () => {
397
+ let i;
398
+ try {
399
+ i = n();
400
+ } catch (r) {
401
+ h(r.message, "error");
402
+ }
403
+ return i || h(`Attempt to get bound property "${e.toString()}" of undefined`, "warn"), i ? i[e] : void 0;
404
+ },
405
+ (i) => {
406
+ let r;
407
+ try {
408
+ r = n();
409
+ } catch (o) {
410
+ h(o.message, "error");
411
+ }
412
+ r ? r[e] = i : h(`Attempt to set bound property "${e.toString()}" of undefined`, "warn");
413
+ }
414
+ ];
415
+ }
416
+ function we(n, e) {
417
+ if (f(n) && (f(e) || e === void 0))
418
+ return Je(n, e);
419
+ if (f(n) && X(e))
420
+ return Xe(n, e);
421
+ throw new Error("Invalid arguments for bind()");
422
+ }
423
+ class G {
424
+ _target;
425
+ _name;
426
+ constructor(e, t) {
427
+ this._target = e, this._name = t;
428
+ }
429
+ }
430
+ const W = { Deep: 0, Shallow: 1, Reference: 2 };
431
+ class w extends G {
432
+ _observableKind = W.Deep;
433
+ //@MobX.observable
434
+ _value = void 0;
435
+ //@MobX.observable.shallow
436
+ _valueShallow = void 0;
437
+ //@MobX.observable.ref
438
+ _valueRef = void 0;
439
+ //@MobX.observable.ref
440
+ _forceReactionToggle = void 0;
441
+ _onValueChangeReactionDisposer;
442
+ _structBindingReactionDisposer;
443
+ _paramsBindingReactionDisposer;
444
+ constructor(e, t) {
445
+ super(e, t), d.makeObservable(this, {
446
+ _value: d.observable,
447
+ _valueShallow: d.observable.shallow,
448
+ _valueRef: d.observable.ref,
449
+ _forceReactionToggle: d.observable.ref,
450
+ _forceReaction: d.action
451
+ });
452
+ }
453
+ initBindings() {
454
+ this._setupOnValueChangeReaction(), this._setupStructBindingReaction(), this._setupParamsBindingReaction();
455
+ }
456
+ deinitBindings() {
457
+ this._onValueChangeReactionDisposer?.(), this._onValueChangeReactionDisposer = void 0, this._structBindingReactionDisposer?.(), this._structBindingReactionDisposer = void 0, this._paramsBindingReactionDisposer?.(), this._paramsBindingReactionDisposer = void 0;
458
+ }
459
+ get value() {
460
+ return this._getObservable();
461
+ }
462
+ set value(e) {
463
+ if (C(e))
464
+ throw Error("Attempt to assign binding as a value");
465
+ d.runInAction(() => {
466
+ this._paramsBinding || this._structBinding ? this._modelIsNew() ? this._setValue(e) : (this._structBinding && D(this._structBinding) && (this._structBinding[1]?.(e), e = this._structBinding[0]?.()), this._paramsBinding && D(this._paramsBinding) && this._paramsBinding[1]?.(e)) : this._setValue(e);
467
+ });
468
+ }
469
+ _setValue(e) {
470
+ let t = this._getObservable();
471
+ T(t) && (t = t.slice());
472
+ const i = this._target;
473
+ if (!w._isEqual(e, t)) {
474
+ if (!this._modelIsNew() && !i.changeNotifyDisabled()) {
475
+ const r = this._name;
476
+ this._structOnPropChanging && (e = this._structOnPropChanging(r, e, t), x(e instanceof Promise, "Asynchronous OnPropChanging event is not allowed"));
477
+ let o = this._getStructOnChangingEvent(r);
478
+ if (o && (e = o(e, t), x(e instanceof Promise, "Asynchronous OnChanging<Prop> event is not allowed")), this._customOnPropChanging && (e = this._customOnPropChanging(r, e, t), x(e instanceof Promise, "Asynchronous OnPropChanging event is not allowed")), o = this._getCustomOnChangingEvent(r), o && (e = o(e, t), x(e instanceof Promise, "Asynchronous OnChanging<Prop> event is not allowed")), w._isEqual(e, t)) {
479
+ setTimeout(() => this._forceReaction());
480
+ return;
481
+ }
482
+ }
483
+ this._setObservable(e);
484
+ }
485
+ }
486
+ _setupStructBindingReaction() {
487
+ if (this._structBindingReactionDisposer?.(), this._structBindingReactionDisposer = void 0, !this._structBinding)
488
+ return;
489
+ const e = this._name, t = this._target, i = (r) => {
490
+ try {
491
+ r = this._structBinding[0](), this._paramsBindingReactionDisposer && D(this._paramsBinding) && (this._paramsBinding[1](r), r = this._paramsBinding[0]()), this._setValue(r);
492
+ } catch (o) {
493
+ h(`Struct binding error: ${e}.set(${A(r)}) model=#${t.birthMark()} path=${t.htmlId()}
494
+ ${o}`, "error");
495
+ }
496
+ };
497
+ this._structBindingReactionDisposer = d.reaction(
498
+ () => {
499
+ let r = this._structBinding[0]();
500
+ return T(r) && (r = r.slice()), [r, this._forceReactionToggle];
501
+ },
502
+ ([r]) => i(r),
503
+ {
504
+ name: `Struct binding model=#${t.birthMark()} path=${t.htmlId()}.${e}`,
505
+ fireImmediately: !0
506
+ }
507
+ );
508
+ }
509
+ _setupParamsBindingReaction() {
510
+ if (this._paramsBindingReactionDisposer?.(), this._paramsBindingReactionDisposer = void 0, !this._paramsBinding)
511
+ return;
512
+ const e = this._name, t = this._target, i = (r) => {
513
+ try {
514
+ this._structBindingReactionDisposer && D(this._structBinding) && (this._structBinding[1](r), r = this._structBinding[0]()), this._setValue(r);
515
+ } catch (o) {
516
+ h(`Param binding error: ${e}.set(${A(r)}) model=#${t.birthMark()} path=${t.htmlId()}${o}`, "error");
517
+ }
518
+ };
519
+ this._paramsBindingReactionDisposer = d.reaction(
520
+ () => {
521
+ let r = this._paramsBinding[0]();
522
+ return T(r) && (r = r.slice()), [r, this._forceReactionToggle];
523
+ },
524
+ ([r]) => i(r),
525
+ {
526
+ name: `Param binding model=#${t.birthMark()} path=${t.htmlId()}.${e}`,
527
+ fireImmediately: !0
528
+ }
529
+ );
530
+ }
531
+ _setupOnValueChangeReaction() {
532
+ this._onValueChangeReactionDisposer?.(), this._onValueChangeReactionDisposer = void 0;
533
+ const e = this._name, t = this._target;
534
+ this._onValueChangeReactionDisposer = d.reaction(
535
+ () => {
536
+ let i = this._getObservable();
537
+ return T(i) && (i = i.slice()), [i, this._forceReactionToggle];
538
+ },
539
+ ([i], [r]) => {
540
+ try {
541
+ if (this._modelIsNew())
542
+ throw Error("???");
543
+ if (w._isEqual(i, r))
544
+ return;
545
+ h(`change prop model=#${t.birthMark()} path=${t.htmlId()}[${e}] ${A(r)}➝${A(i)}`), t.changeNotifyDisabled() || (this._structOnPropChange?.(e, i, r), this._getStructOnChangeEvent(e)?.(i, r), this._customOnPropChange?.(e, i, r), this._getCustomOnChangeEvent(e)?.(i, r));
546
+ } catch (o) {
547
+ h(`Prop change error: ${e}.set(${A(i)}) model=#${t.birthMark()} path=${t.htmlId()}
548
+ ${o}`, "error");
549
+ }
550
+ },
551
+ { name: `Prop change model=#${t.birthMark()} path=${t.htmlId()}.${e}` }
552
+ );
553
+ }
554
+ get _structBinding() {
555
+ const e = this._name, t = this._target;
556
+ if (C(t.$.__struct.props?.[e]))
557
+ return t.$.__struct.props[e];
558
+ }
559
+ get _paramsBinding() {
560
+ const e = this._name, t = this._target;
561
+ if (C(t.$.__params?.[e]))
562
+ return t.$.__params[e];
563
+ }
564
+ get _structOnPropChanging() {
565
+ return this._target.$.__struct.events?.onPropChanging;
566
+ }
567
+ get _structOnPropChange() {
568
+ return this._target.$.__struct.events?.onPropChange;
569
+ }
570
+ _getStructOnChangingEvent(e) {
571
+ return this._target.$.__struct.events?.[`onChanging${V(e)}`];
572
+ }
573
+ _getStructOnChangeEvent(e) {
574
+ return this._target.$.__struct.events?.[`onChange${V(e)}`];
575
+ }
576
+ get _customOnPropChanging() {
577
+ const e = this._target.onPropChanging;
578
+ if (e instanceof E)
579
+ return e.event;
580
+ }
581
+ get _customOnPropChange() {
582
+ const e = this._target.onPropChange;
583
+ if (e instanceof E)
584
+ return e.event;
585
+ }
586
+ _getCustomOnChangingEvent(e) {
587
+ const t = this._target[`onChanging${V(e)}`];
588
+ if (t instanceof E)
589
+ return t.event;
590
+ }
591
+ _getCustomOnChangeEvent(e) {
592
+ const t = this._target[`onChange${V(e)}`];
593
+ if (t instanceof E)
594
+ return t.event;
595
+ }
596
+ _modelIsNew() {
597
+ return !this._target.$.__status.initPhase;
598
+ }
599
+ // @MobX.action
600
+ _forceReaction() {
601
+ this._forceReactionToggle = !this._forceReactionToggle;
602
+ }
603
+ _getObservable() {
604
+ return [this._value, this._valueShallow, this._valueRef, this._forceReactionToggle][this._observableKind];
605
+ }
606
+ _setObservable(e) {
607
+ this._getObservable(), d.transaction(() => {
608
+ const t = this._prepareValueToObserve(e, this._name);
609
+ t.observable === "ref" ? (this._value = void 0, this._valueShallow = void 0, this._valueRef = t.value, this._observableKind = W.Reference) : t.observable === "shallow" ? (this._value = void 0, this._valueRef = void 0, this._valueShallow = t.value, this._observableKind = W.Shallow) : (this._valueShallow = void 0, this._valueRef = void 0, this._value = t.value, this._observableKind = W.Deep);
610
+ });
611
+ }
612
+ _prepareObjectToObserve(e) {
613
+ if (d.isObservable(e)) return { value: e, observable: "ref" };
614
+ const t = Object.keys(e).reduce((r, o) => {
615
+ if (d.isObservableProp(e, o)) return r;
616
+ const c = this._prepareValueToObserve(e[o], o);
617
+ return e[o] = c.value, c.observable === "ref" ? r[o] = d.observable.ref : c.observable === "shallow" ? r[o] = d.observable.shallow : r[o] = d.observable.deep, r;
618
+ }, {});
619
+ return { value: d.observable(e, t), observable: "ref" };
620
+ }
621
+ _prepareValueToObserve(e, t) {
622
+ if (U(e))
623
+ return { value: e, observable: "ref" };
624
+ if (T(e) || Ue(e))
625
+ return { value: e, observable: "shallow" };
626
+ if (at(e) || Y(e) || N(e))
627
+ return { value: e, observable: "ref" };
628
+ if (f(e)) {
629
+ if (ae(t) && !w._isWrappedView(e)) {
630
+ const i = B.observer(e), r = (o) => /* @__PURE__ */ p.jsx(i, { ...o });
631
+ r.__ueca_ViewFn = e, e = r;
632
+ }
633
+ return { value: e, observable: "ref" };
634
+ } else if (O(e))
635
+ return this._prepareObjectToObserve(e);
636
+ return { value: e, observable: "deep" };
637
+ }
638
+ static _isEqual(e, t) {
639
+ return Y(e) || Y(t) || N(e) || N(t) || U(e) || U(t) ? e === t : f(e) || f(t) ? (w._isWrappedView(e) && (e = e.__ueca_ViewFn), w._isWrappedView(t) && (t = t.__ueca_ViewFn), e === t) : ye(e, t);
640
+ }
641
+ static _isWrappedView(e) {
642
+ return f(e) && Reflect.has(e, "__ueca_ViewFn");
643
+ }
644
+ }
645
+ class re extends G {
646
+ //@MobX.observable.ref
647
+ child;
648
+ constructor(e, t, i) {
649
+ super(e, t), d.makeObservable(this, {
650
+ child: d.observable.ref
651
+ }), this.child = i;
652
+ }
653
+ }
654
+ class se extends G {
655
+ method;
656
+ constructor(e, t, i) {
657
+ if (super(e, t), ae(t)) {
658
+ const r = B.observer(i);
659
+ this.method = (o) => /* @__PURE__ */ p.jsx(r, { ...o });
660
+ } else
661
+ this.method = i;
662
+ }
663
+ }
664
+ class E extends G {
665
+ // @MobX.observable.ref
666
+ _event;
667
+ constructor(e, t) {
668
+ super(e, t), d.makeObservable(this, {
669
+ _event: d.observable.ref
670
+ });
671
+ }
672
+ //@MobX.computed ??? This was not used. TODO: delete it?
673
+ get event() {
674
+ const e = this._target.$.__struct.events?.[this._name];
675
+ return e && !Ce(this._name, this._target.$.__struct) && !Ge(this._name, this._target.$.__struct) ? async (...i) => {
676
+ const r = this._target.$.__status.baseResult;
677
+ try {
678
+ let o = await e(...i);
679
+ return this._event && (this._target.$.__status.baseResult = o, o = await this._event(...i)), o;
680
+ } finally {
681
+ this._target.$.__status.baseResult = r;
682
+ }
683
+ } : this._event;
684
+ }
685
+ // TODO: Why does this code break MobX reactions?
686
+ // public get event() {
687
+ // const structEvent = (this._target.$.__struct.events as AnyObject)?.[this._name] as AnyMethod;
688
+ // if (structEvent && !isPropChangingEvent(this._name, this._target.$.__struct)) {
689
+ // const chainedEvent = async (...args: unknown[]) => {
690
+ // const baseResult = this._target.$.__status.baseResult;
691
+ // try {
692
+ // let res: unknown;
693
+ // await MobX.runInAction(async () => {
694
+ // res = await structEvent(...args);
695
+ // });
696
+ // this._target.$.__status.baseResult = res;
697
+ // if (this._event) {
698
+ // this._target.$.__status.baseResult = res;
699
+ // await MobX.runInAction(async () => {
700
+ // res = await this._event(...args);
701
+ // });
702
+ // }
703
+ // return res;
704
+ // } finally {
705
+ // this._target.$.__status.baseResult = baseResult;
706
+ // }
707
+ // }
708
+ // return chainedEvent;
709
+ // }
710
+ // return this._event;
711
+ // };
712
+ set event(e) {
713
+ this._event = e;
714
+ }
715
+ }
716
+ function ae(n) {
717
+ return n?.endsWith("View");
718
+ }
719
+ function Ce(n, e) {
720
+ if (n === "onPropChanging")
721
+ return !0;
722
+ if (!n.startsWith("onChanging"))
723
+ return !1;
724
+ let t = n.substring(10);
725
+ return t = t[0].toLowerCase() + t.slice(1), !!Reflect.has(e.props, t);
726
+ }
727
+ function Ge(n, e) {
728
+ if (n === "onPropChange")
729
+ return !0;
730
+ if (!n.startsWith("onChange"))
731
+ return !1;
732
+ let t = n.substring(8);
733
+ return t = t[0].toLowerCase() + t.slice(1), !!Reflect.has(e.props, t);
734
+ }
735
+ class He {
736
+ _registry;
737
+ name;
738
+ constructor(e) {
739
+ this.name = e, this._registry = /* @__PURE__ */ new Map();
740
+ }
741
+ subscribe(e) {
742
+ const t = e.$.__struct.messages;
743
+ t && Object.keys(t).forEach((i) => {
744
+ let r = this._registry.get(i);
745
+ r || (r = /* @__PURE__ */ new Set(), this._registry.set(i, r)), r.add(e);
746
+ });
747
+ }
748
+ unsubscribe(e) {
749
+ const t = e.$.__struct.messages;
750
+ if (!t)
751
+ return;
752
+ const i = [];
753
+ Object.keys(t).forEach((r) => {
754
+ const o = this._registry.get(r);
755
+ o && (o.delete(e), o.size || i.push(r));
756
+ }), i.forEach((r) => {
757
+ this._registry.delete(r);
758
+ });
759
+ }
760
+ async broadcast(e, t, i) {
761
+ const r = this._registry.get(t);
762
+ if (!r || !r.size)
763
+ return h(`MessageBus (${this.name}): no subscribers for message "${t}"`, "warn"), [];
764
+ const o = [];
765
+ for (const c of r) {
766
+ if (!(b(e) || Ye(e) || e === "")) if (X(e)) {
767
+ if (e && c.fullId() != e)
768
+ continue;
769
+ } else if (e instanceof RegExp) {
770
+ if (!e.test(c.fullId()))
771
+ continue;
772
+ } else
773
+ break;
774
+ const a = c.$.__struct.messages?.[t];
775
+ if (a) {
776
+ const u = a(i);
777
+ o.push(u);
778
+ }
779
+ }
780
+ return await Promise.all(o);
781
+ }
782
+ async castTo(e, t, i) {
783
+ const r = await this.broadcast(e, t, i);
784
+ return r?.length > 1 && h(`MessageBus (${this.name}): Ambiguous unicast by message "${t}"`, "warn"), r ? r[0] : void 0;
785
+ }
786
+ async unicast(e, t) {
787
+ return await this.castTo("", e, t);
788
+ }
789
+ /**
790
+ * @deprecated Use the `unicast` function instead.
791
+ */
792
+ async getAsync(e, t) {
793
+ return await this.unicast(e, t);
794
+ }
795
+ /**
796
+ * @deprecated Use the `unicast` function instead.
797
+ */
798
+ async postAsync(e, t) {
799
+ return await this.unicast(e, t);
800
+ }
801
+ }
802
+ const Ke = "messagebus.post";
803
+ function Ze() {
804
+ const n = new He("Default Message Bus");
805
+ return window.addEventListener(Ke, e), n;
806
+ function e(t) {
807
+ n.broadcast(null, t.detail.message, t.detail.params);
808
+ }
809
+ }
810
+ const Re = Ze(), Qe = $.createContext(Re);
811
+ function bt() {
812
+ return Re;
813
+ }
814
+ function et(n) {
815
+ return tt($.useContext(Qe), n);
816
+ }
817
+ function tt(n, e) {
818
+ return $.useEffect(
819
+ () => (n.subscribe(e), () => n.unsubscribe(e)),
820
+ // it never changes bus or model
821
+ // eslint-disable-next-line react-hooks/exhaustive-deps
822
+ []
823
+ ), n;
824
+ }
825
+ d._getGlobalState().allowStateChanges = !0;
826
+ class q {
827
+ // Add index signature to allow dynamic property assignment
828
+ _privateMembers;
829
+ _birthMark;
830
+ _disableOnChangeCount = 0;
831
+ _bus;
832
+ // @MobX.observable
833
+ _renderToggle;
834
+ constructor(e) {
835
+ d.makeObservable(this, {
836
+ _renderToggle: d.observable,
837
+ View: d.computed,
838
+ BaseView: d.computed,
839
+ clearModelCache: d.action,
840
+ invalidateView: d.action,
841
+ _assignParams: d.action,
842
+ _constr: d.action,
843
+ _init: d.action,
844
+ _mount: d.action,
845
+ _unmount: d.action,
846
+ _deinit: d.action,
847
+ _draw: d.action,
848
+ _erase: d.action,
849
+ _deleteMember: d.action
850
+ }), q._checkUniqueNamesInStructSections(e), this._privateMembers = {
851
+ __status: {
852
+ initPhase: void 0,
853
+ mountPhase: void 0,
854
+ cached: !1,
855
+ initCount: 0,
856
+ mountCount: 0,
857
+ baseResult: void 0
858
+ },
859
+ __struct: void 0,
860
+ __params: void 0,
861
+ __owner: void 0,
862
+ __dynamicChildrenIds: [],
863
+ __staticChildrenCache: void 0,
864
+ __proxy: void 0,
865
+ __settersInProgress: [],
866
+ __assignParams: void 0,
867
+ __initializeModel: void 0
868
+ }, e = { ...e }, this._birthMark = Math.round(Math.random() * 1e6).toString(), this.$.__struct = e, this.$.__dynamicChildrenIds = [], this.$.__staticChildrenCache = [], this.$.__settersInProgress = [], this.$.__assignParams = this._assignParams.bind(this), this.$.__initializeModel = this._initializeModel.bind(this);
869
+ for (const t in e.props) {
870
+ if (t.startsWith("__")) {
871
+ this[t] = e.props[t], delete e.props[t];
872
+ continue;
873
+ }
874
+ const i = new w(this, t), r = e.props[t];
875
+ f(r) && (e.props[t] = we(r, void 0)), C(e.props[t]) ? ae(t) ? i.value = z : i.value = void 0 : i.value = e.props[t], this[t] = i;
876
+ }
877
+ for (const t in e.children) {
878
+ const i = new re(this, t, e.children[t]);
879
+ i.child.$.__owner = this, i.child.disableOnChange(), i.child.id = t, i.child.enableOnChange(), this[t] = i;
880
+ }
881
+ for (const t in e.methods) {
882
+ const i = e.methods[t];
883
+ this[t] = new se(this, t, i);
884
+ }
885
+ for (const t in e.events) {
886
+ if (t.startsWith("onChanging") || t.startsWith("onChange") || t === "onPropChanging" || t === "onPropChange")
887
+ return;
888
+ this[t] = new E(this, t);
889
+ }
890
+ this._renderToggle = void 0;
891
+ }
892
+ get $() {
893
+ return this._privateMembers;
894
+ }
895
+ get bus() {
896
+ return this._bus;
897
+ }
898
+ // @MobX.computed
899
+ get View() {
900
+ return this._view();
901
+ }
902
+ // @MobX.computed
903
+ get BaseView() {
904
+ return this._view(!0);
905
+ }
906
+ disableOnChange() {
907
+ this._disableOnChangeCount++;
908
+ }
909
+ enableOnChange() {
910
+ if (this._disableOnChangeCount === 0)
911
+ throw new Error("enableOnChange() requires disableOnChange() pair");
912
+ this._disableOnChangeCount--;
913
+ }
914
+ changeNotifyDisabled() {
915
+ return this._disableOnChangeCount > 0;
916
+ }
917
+ birthMark() {
918
+ return this._birthMark;
919
+ }
920
+ fullId() {
921
+ let e = "";
922
+ return this.$.__owner && (e = this.$.__owner.fullId() + "."), e + (this.id?.value ?? "<empty>");
923
+ }
924
+ //@computed
925
+ htmlId() {
926
+ const e = this.fullId();
927
+ return e === "<empty>" ? void 0 : window.hashHtmlId ? q._getHashCode(e) : e;
928
+ }
929
+ //@computed
930
+ getChildrenModels(e) {
931
+ const t = [];
932
+ if (!e || e === "static")
933
+ for (const i in this.$.__struct.children)
934
+ t.push(this.$.__proxy[i]);
935
+ return (!e || e === "dynamic") && this.$.__dynamicChildrenIds.forEach((i) => t.push(this.$.__proxy[i])), t;
936
+ }
937
+ //@MobX.action
938
+ clearModelCache() {
939
+ for (const e of this.$.__dynamicChildrenIds) {
940
+ const t = this.$.__proxy[e];
941
+ if (t && (h(`uncache dynamic model=#${t.birthMark()} path=${t.htmlId()} cache=#${this.birthMark()}`), this._deleteMember(e), t.$.__status.cached = !1, t.$.__staticChildrenCache.length)) {
942
+ for (const i of t.$.__staticChildrenCache) {
943
+ if (!i) return;
944
+ h(`uncache static model=#${i.birthMark()} path=${i.htmlId()} cache=#${t.birthMark}`), i.$.__status.cached = !1;
945
+ }
946
+ for (const i of t.$.__staticChildrenCache) {
947
+ if (!i) return;
948
+ i.clearModelCache();
949
+ }
950
+ this.$.__staticChildrenCache.splice(0);
951
+ }
952
+ }
953
+ this.$.__dynamicChildrenIds.splice(0);
954
+ }
955
+ //@MobX.action
956
+ invalidateView() {
957
+ this._renderToggle = !this._renderToggle;
958
+ }
959
+ _view(e = !1) {
960
+ const t = B.observer(((i) => {
961
+ const r = !b(this._renderToggle) && (b(i?.render) || i.render), o = r ? this.$.__proxy : void 0;
962
+ r && this.$.__status.mountCount++, $.useEffect(() => (r && b(this.$.__status.mountPhase) && this._mount(), () => {
963
+ r && this.$.__status.mountCount--, this.$.__status.mountCount || this._unmount();
964
+ }));
965
+ const c = (a) => {
966
+ const u = e ? o?.$.__struct.BaseView : o?.$.__struct.View;
967
+ return $.useLayoutEffect(() => {
968
+ if (a && u)
969
+ return this._draw(), () => {
970
+ this._erase();
971
+ };
972
+ }), a && u ? (h(`render view model=#${o?.birthMark()} path=${o?.htmlId()}`), u(i)) : null;
973
+ };
974
+ return r ? /* @__PURE__ */ p.jsx(nt, { componentModel: o, children: /* @__PURE__ */ p.jsx(Me.Provider, { value: ct(o), children: c(!0) }) }) : c(!1);
975
+ }).bind(this));
976
+ return ((i) => /* @__PURE__ */ p.jsx(t, { ...i }));
977
+ }
978
+ //@MobX.action // TODO: remove the attribute?
979
+ _assignParams(e) {
980
+ e = { ...e }, delete e.cacheable;
981
+ for (const t in this.$.__struct.props)
982
+ if (f(e[t]) && Reflect.has(e, t)) {
983
+ const i = e[t];
984
+ e[t] = we(i, void 0);
985
+ }
986
+ this.$.__params = e;
987
+ for (const t in e)
988
+ t === "constr" || t === "init" || t === "deinit" || t === "mount" || t === "unmount" || t === "draw" || t === "erase" || C(e[t]) || (this.$.__proxy[t] = e[t]);
989
+ }
990
+ _initBindings() {
991
+ for (const e in this.$.__struct.props)
992
+ this[e]?.initBindings();
993
+ }
994
+ _deInitBindings() {
995
+ for (const e in this.$.__struct.props)
996
+ this[e]?.deinitBindings();
997
+ }
998
+ //@MobX.action
999
+ async _constr() {
1000
+ this.$.__status.initPhase = "constructing";
1001
+ try {
1002
+ const e = this.$.__proxy;
1003
+ h(`constr model=#${e.birthMark()} path=${e.htmlId()}`), await this.$.__struct.constr?.(this.$.__proxy), await this.$.__params?.constr?.(this.$.__proxy);
1004
+ } finally {
1005
+ this.$.__status.initPhase = "constructed";
1006
+ }
1007
+ }
1008
+ //@MobX.action
1009
+ async _init(e) {
1010
+ if (this.$.__status.initPhase || await this._constr(), this._assignParams(e), this.$.__status.initPhase === "constructed") {
1011
+ this.$.__status.initPhase = "initializing";
1012
+ try {
1013
+ const t = this.$.__proxy;
1014
+ h(`init model=#${t.birthMark()} path=${t.htmlId()}`), this._initBindings(), await this.$.__struct.init?.(t), await this.$.__params?.init?.(t);
1015
+ } finally {
1016
+ this.$.__status.initPhase = "initialized";
1017
+ try {
1018
+ this.$.__status.mountPhase === "init-mount" && await this._mount();
1019
+ } finally {
1020
+ b(this._renderToggle) && this.invalidateView();
1021
+ }
1022
+ }
1023
+ }
1024
+ }
1025
+ //@MobX.action
1026
+ async _mount() {
1027
+ if (this.$.__status.mountPhase === "mounted")
1028
+ return;
1029
+ if (this.$.__status.initPhase != "initialized") {
1030
+ this.$.__status.mountPhase = "init-mount";
1031
+ return;
1032
+ }
1033
+ this.$.__status.mountPhase = "mounting";
1034
+ const e = this.$.__proxy;
1035
+ h(`mount model=#${e.birthMark()} path=${e.htmlId()}`), await this.$.__struct.mount?.(e), await this.$.__params?.mount?.(e), this.$.__status.mountPhase = "mounted";
1036
+ }
1037
+ //@MobX.action
1038
+ async _unmount() {
1039
+ if (this.$.__status.mountPhase == "mounted") {
1040
+ this.$.__status.mountPhase = "unmounting";
1041
+ try {
1042
+ const e = this.$.__proxy;
1043
+ h(`unmount model=#${e.birthMark()} path=${e.htmlId()}`), await this.$.__params?.unmount?.(e), await this.$.__struct.unmount?.(e);
1044
+ } finally {
1045
+ this.$.__status.mountPhase = void 0, this.$.__status.initPhase === "unmount-deinit" && (this.$.__status.initPhase = "initialized", await this._deinit());
1046
+ }
1047
+ }
1048
+ }
1049
+ //@MobX.action
1050
+ async _deinit() {
1051
+ if (this.$.__status.initCount--, !this.$.__status.initCount && this.$.__status.initPhase === "initialized") {
1052
+ if (this.$.__status.mountPhase === "mounted" || this.$.__status.mountPhase === "unmounting") {
1053
+ this.$.__status.initCount++, this.$.__status.initPhase = "unmount-deinit";
1054
+ return;
1055
+ }
1056
+ this.$.__status.initPhase = "deinitializing";
1057
+ try {
1058
+ const e = this.$.__proxy;
1059
+ h(`deinit model=#${e.birthMark()} path=${e.htmlId()}`), this._renderToggle = void 0, await this.$.__params?.deinit?.(e), await this.$.__struct.deinit?.(e), this._deInitBindings();
1060
+ } finally {
1061
+ this.$.__status.initPhase = "constructed";
1062
+ }
1063
+ }
1064
+ }
1065
+ //@MobX.action
1066
+ async _draw() {
1067
+ const e = this.$.__proxy;
1068
+ await this.$.__struct.draw?.(e), await this.$.__params?.draw?.(e);
1069
+ }
1070
+ //@MobX.action
1071
+ async _erase() {
1072
+ const e = this.$.__proxy;
1073
+ await this.$.__params?.erase?.(e), await this.$.__struct.erase?.(e);
1074
+ }
1075
+ //@MobX.action
1076
+ _deleteMember(e) {
1077
+ let t = !1;
1078
+ return Reflect.has(this, e) && (delete this[e], t = !0), Reflect.has(this, e) && (delete this[e], t = !0), t;
1079
+ }
1080
+ _initializeModel(e) {
1081
+ this.$.__status.initCount++, this._bus = et(this), $.useEffect(() => (this._init(e), () => {
1082
+ this._deinit();
1083
+ }));
1084
+ }
1085
+ static _getHashCode(e) {
1086
+ const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";
1087
+ let i = "";
1088
+ const r = Array.from(e).reduce((o, c) => Math.imul(31, o) + c.charCodeAt(0) | 0, 0);
1089
+ for (let o = 0; o < 32; o += 6)
1090
+ i += t.charAt(r >>> o & 63);
1091
+ return i;
1092
+ }
1093
+ static _checkUniqueNamesInStructSections(e) {
1094
+ const t = k(Object.keys(e.props ?? {}), Object.keys(e.children ?? {}));
1095
+ if (t.concat(k(Object.keys(e.props ?? {}), Object.keys(e.methods ?? {}))), t.concat(k(Object.keys(e.props ?? {}), Object.keys(e.events ?? {}))), t.concat(k(Object.keys(e.children ?? {}), Object.keys(e.methods ?? {}))), t.concat(k(Object.keys(e.children ?? {}), Object.keys(e.events ?? {}))), t.concat(k(Object.keys(e.methods ?? {}), Object.keys(e.events ?? {}))), t.length > 0)
1096
+ throw new Error(`The component structure${e.props?.id ? " " + e.props.id + " " : ""}contains not unique members: ${t}`);
1097
+ }
1098
+ }
1099
+ class nt extends $.PureComponent {
1100
+ _retryStarted = !1;
1101
+ _retriesLeft;
1102
+ constructor(e) {
1103
+ super(e), this.state = { renderingFailed: !1 }, this._retriesLeft = e.maxRenderRetries, b(this._retriesLeft) && (this._retriesLeft = 1);
1104
+ }
1105
+ static getDerivedStateFromError(e) {
1106
+ return { renderingFailed: !0, error: e };
1107
+ }
1108
+ componentDidCatch(e) {
1109
+ this._retriesLeft === 0 && (this.props.componentModel && h(`JSX Rendering Error model=#${this.props.componentModel.birthMark()} path=${this.props.componentModel.htmlId()}
1110
+ ${e}`, "error"), this.props?.onRenderError?.(e));
1111
+ }
1112
+ render() {
1113
+ if (!this.state.renderingFailed)
1114
+ return /* @__PURE__ */ p.jsx(p.Fragment, { children: oe(this.props.children) });
1115
+ let e = null;
1116
+ if (this._retriesLeft > 0)
1117
+ this._retryStarted || (setTimeout(() => {
1118
+ this._retriesLeft--, this._retryStarted = !1, this.setState({ renderingFailed: !1 });
1119
+ }), this._retryStarted = !0);
1120
+ else if (y.traceLog) {
1121
+ const t = {
1122
+ display: "flex",
1123
+ placeContent: "center",
1124
+ fontSize: "large",
1125
+ minWidth: "fit-content",
1126
+ minHeight: "fit-content",
1127
+ overflow: "overlay",
1128
+ backgroundColor: "red",
1129
+ color: "yellow"
1130
+ };
1131
+ e = /* @__PURE__ */ p.jsx("div", { style: t, title: this._getErrorTitleInfo(), children: "⚠" });
1132
+ }
1133
+ return e;
1134
+ }
1135
+ _getErrorTitleInfo() {
1136
+ let e = "";
1137
+ return this.props.description && (e = `${e}• Description
1138
+ ${this.props.description}
1139
+
1140
+ `), this.props.componentModel && (e = `${e}• UECA Component
1141
+ model: #${this.props.componentModel.birthMark()}
1142
+ path: ${this.props.componentModel.htmlId()}
1143
+
1144
+ `), this.state.error && (e = `${e}• Error Details
1145
+ ${this.state.error?.message}`), `JSX RENDERING ERROR
1146
+
1147
+ ${e}`;
1148
+ }
1149
+ }
1150
+ class J {
1151
+ constructor(e) {
1152
+ const t = new q(e), i = new Proxy(t, { get: J._get, set: J._set });
1153
+ return t.$.__proxy = i, i;
1154
+ }
1155
+ static _get(e, t) {
1156
+ if (ie(t) && t === rt || t === I)
1157
+ return e[I];
1158
+ let i = e[t];
1159
+ return i instanceof w ? i = i.value : i instanceof se ? i = i.method : i instanceof E ? i = i.event : i instanceof re ? i = i.child : f(i) && (i = i.bind(e)), i;
1160
+ }
1161
+ static _set(e, t, i) {
1162
+ if (ie(t) || t === I)
1163
+ return !1;
1164
+ if (e.$.__settersInProgress.indexOf(t) !== -1)
1165
+ return !0;
1166
+ e.$.__settersInProgress.push(t);
1167
+ try {
1168
+ if (e[t] instanceof w)
1169
+ e[t].value = i;
1170
+ else if (e[t] instanceof E)
1171
+ b(i) || f(i) ? e[t].event = i : console.error(`Attempt to assign non-function value to event "${t}"`);
1172
+ else if (f(i)) {
1173
+ const r = new E(e, t);
1174
+ r.event = i, e[t] = r;
1175
+ } else {
1176
+ if (e[t] instanceof se || e[t] instanceof re)
1177
+ return !1;
1178
+ e[t] = i;
1179
+ }
1180
+ } finally {
1181
+ e.$.__settersInProgress.pop();
1182
+ }
1183
+ return !0;
1184
+ }
1185
+ }
1186
+ function it(n, e) {
1187
+ const t = new J(n);
1188
+ return t.$.__assignParams(e), t;
1189
+ }
1190
+ const I = "$", rt = Symbol(I), z = () => /* @__PURE__ */ p.jsx(p.Fragment, {});
1191
+ function $t(n, e, t, i) {
1192
+ i || (i = st);
1193
+ const r = i(ot(n, e, () => r), t);
1194
+ return r;
1195
+ }
1196
+ function st(n, e) {
1197
+ const t = Ee();
1198
+ let i = !0;
1199
+ const [r] = $.useState(() => (i = !1, o()));
1200
+ if (!r)
1201
+ throw Error("BUG: Component model is undefined");
1202
+ return i && h(`use React cached model=#${r.birthMark()} path=${r.htmlId()} cache=React.useState()`), r.$.__initializeModel(e), r;
1203
+ function o() {
1204
+ const a = c();
1205
+ let u = t?.staticModelsTrap?.getNextCachedModel();
1206
+ const R = u === null;
1207
+ return u ? t.staticModelsTrap && u != t.staticModelsTrap.owner && (h(`use cached static model=#${u.birthMark()} path=${u.htmlId()} cache=#${t.staticModelsTrap.owner?.birthMark()}`), u.cacheable && h(`remove cached static model=#${u.birthMark()} path=${u.htmlId()} cache=#${t.staticModelsTrap.owner?.birthMark()}`)) : (x(!n.props), n.props.cacheable = a, u = it(n, e ?? {}), h(`create model=#${u.birthMark()} path=${u.htmlId()}`), u.fullId() || h("Set a default id in the struct of the component model hook", "warn"), t?.staticModelsTrap && a && (t.staticModelsTrap.cacheModel(a ? u : null, R), R && h(`recache static model=#${u.birthMark()} path=${u.htmlId()} cache=#${t.staticModelsTrap.owner?.birthMark()}`))), u;
1208
+ }
1209
+ function c() {
1210
+ if (y.modelCacheMode == "no-cache")
1211
+ return !1;
1212
+ let a;
1213
+ return b(e?.cacheable) || (C(e.cacheable) ? h('Bindings are not permitted for the property "cacheable"', "error") : a = e.cacheable), b(a) && !b(n.props?.cacheable) && (C(n.props.cacheable) ? h('Bindings are not permitted for the property "cacheable"', "error") : a = n.props.cacheable), b(a) && y.modelCacheMode == "auto-cache" && (a = !0), !!a;
1214
+ }
1215
+ }
1216
+ function ot(n, e, t) {
1217
+ e || (e = {});
1218
+ const i = {
1219
+ props: {
1220
+ ...n.props,
1221
+ ...e.props
1222
+ },
1223
+ children: {
1224
+ ...n.children,
1225
+ ...e.children
1226
+ },
1227
+ // TODO: Chain the methods
1228
+ methods: {
1229
+ ...n.methods,
1230
+ ...e.methods
1231
+ },
1232
+ // TODO: Chain the events
1233
+ events: {
1234
+ ...n.events,
1235
+ ...e.events
1236
+ },
1237
+ messages: {
1238
+ ...n.messages,
1239
+ ...e.messages
1240
+ },
1241
+ View: e.View && e.View !== z ? e.View : n.View ? n.View : z,
1242
+ BaseView: n.View ?? z
1243
+ };
1244
+ if (n.methods && e.methods)
1245
+ for (const r in i.methods)
1246
+ Reflect.has(n.methods, r) && Reflect.has(e.methods, r) && (i.methods[r] = async (...o) => {
1247
+ const c = t(), a = c.$.__status.baseResult;
1248
+ try {
1249
+ c.$.__status.baseResult = await n.methods[r](...o), await e.methods[r](...o);
1250
+ } finally {
1251
+ c.$.__status.baseResult = a;
1252
+ }
1253
+ });
1254
+ if (n.events && e.events) {
1255
+ for (const r in i.events)
1256
+ if (Reflect.has(n.events, r) && Reflect.has(e.events, r)) {
1257
+ let o;
1258
+ r === "onPropChanging" ? o = (c, a, u) => (a = n.events[r](c, a, u), a = e.events[r](c, a, u), a) : Ce(r, i) ? o = (c, a) => (c = n.events[r](c, a), c = e.events[r](c, a), c) : o = async (...c) => {
1259
+ const a = t(), u = a.$.__status.baseResult;
1260
+ try {
1261
+ let R = await n.events[r](...c);
1262
+ return a.$.__status.baseResult = R, R = await e.events[r](...c), R;
1263
+ } finally {
1264
+ a.$.__status.baseResult = u;
1265
+ }
1266
+ }, i.events[r] = o;
1267
+ }
1268
+ }
1269
+ return e?.constr ? i.constr = async () => {
1270
+ await n.constr?.(t()), await e.constr?.(t());
1271
+ } : i.constr = n.constr, e?.init ? i.init = async () => {
1272
+ await n.init?.(t()), await e.init?.(t());
1273
+ } : i.init = n.init, e?.deinit ? i.deinit = async () => {
1274
+ await e.deinit?.(t()), await n.deinit?.(t());
1275
+ } : i.deinit = n.deinit, e?.mount ? i.mount = async () => {
1276
+ await n.mount?.(t()), await e.mount?.(t());
1277
+ } : i.mount = n.mount, e?.unmount ? i.unmount = async () => {
1278
+ await e.unmount?.(t()), await n.unmount?.(t());
1279
+ } : i.unmount = n.unmount, e?.draw ? i.draw = async () => {
1280
+ await n.draw?.(t()), await e.draw?.(t());
1281
+ } : i.draw = n.draw, e?.erase ? i.erase = async () => {
1282
+ await e.erase?.(t()), await n.erase?.(t());
1283
+ } : i.erase = n.erase, i;
1284
+ }
1285
+ function A(n) {
1286
+ return U(n) ? `[model #${n.birthMark()}]` : D(n) ? "[binding_rw]" : qe(n) ? "[binding_ro]" : Y(n) ? "[jsx]" : N(n) ? `[()=>jsx${n.displayName ? " " + n.displayName : ""}]` : T(n) ? `[array ${n.length}]` : f(n) ? `[funct${n.name ? " " + n.name : ""}]` : O(n) ? "[object]" : X(n) ? n.length > 32 ? `"${n.substring(0, 31)}... [${n.length}]"` : `"${n}"` : n;
1287
+ }
1288
+ function at(n) {
1289
+ return n instanceof Element;
1290
+ }
1291
+ function Y(n) {
1292
+ return $.isValidElement(n);
1293
+ }
1294
+ function N(n) {
1295
+ return ie(n?.$$typeof) && n.$$typeof.description === "react.memo";
1296
+ }
1297
+ function U(n) {
1298
+ return O(n) && Reflect.has(n, I) && O(n[I]) && Reflect.has(n, "birthMark") && f(n.birthMark) && Reflect.has(n, "fullId") && f(n.fullId) && Reflect.has(n, "htmlId") && f(n.htmlId);
1299
+ }
1300
+ function V(n) {
1301
+ return n.replace(/^./, n[0].toUpperCase());
1302
+ }
1303
+ function ct(n) {
1304
+ const e = {
1305
+ owner: n,
1306
+ cacheModel: (t) => {
1307
+ if (!t.id) {
1308
+ h(`Can't cache dynamic model=#${t.birthMark()}, "id" is empty.`, "error");
1309
+ return;
1310
+ }
1311
+ if (t.$.__owner && t.$.__owner !== e.owner) {
1312
+ h(`Can't cache dynamic model=#${t.birthMark()} because it belongs to other model=#${t.$.__owner.birthMark()}`, "error");
1313
+ return;
1314
+ }
1315
+ const i = e.getCachedModel(t.id);
1316
+ if (i) {
1317
+ i != t && h(`Can't cache dynamic model=#${t.birthMark()}. Id "${t.id}" already in cache=#${e.owner.birthMark()}.`, "error");
1318
+ return;
1319
+ }
1320
+ t.$.__owner || (t.$.__owner = e.owner);
1321
+ const r = e.owner;
1322
+ if (r[t.id])
1323
+ r[t.id] !== t && h(`Can't cache dynamic model=#${t.birthMark()}. Id "${t.id}" already exists in cache=#${e.owner.birthMark()}.`, "error");
1324
+ else if (t.$.__struct.props.cacheable) {
1325
+ if (e.owner.$.__dynamicChildrenIds.indexOf(t.id) != -1)
1326
+ throw Error(`Can't cache dynamic model=#${t.birthMark()} in cache=#${t.$.__owner.birthMark()}. Id "${t.id}" already registered.`);
1327
+ h(`cache dynamic model=#${t.birthMark()} path=${t.htmlId()} cache=#${e.owner.birthMark()}`), r[t.id] = t, e.owner.$.__dynamicChildrenIds.push(t.id), t.$.__status.cached = !0;
1328
+ }
1329
+ },
1330
+ getCachedModel: (t) => {
1331
+ const r = e.owner[t];
1332
+ if (r && !r.$.__status.cached)
1333
+ throw Error("Dynamic cache corrution");
1334
+ return r;
1335
+ }
1336
+ };
1337
+ return e;
1338
+ }
1339
+ const Me = $.createContext(void 0);
1340
+ function Ee() {
1341
+ return $.useContext(Me);
1342
+ }
1343
+ function ne(n) {
1344
+ const e = {
1345
+ models: n,
1346
+ pointer: -1,
1347
+ getNextCachedModel: () => {
1348
+ if (e.pointer === e.models.length - 1 || (e.pointer++, !e.models[e.pointer]))
1349
+ return;
1350
+ const t = e.models[e.pointer];
1351
+ if (!t.$.__status.cached)
1352
+ throw Error("Static cache corrution");
1353
+ return t.cacheable || (e.models[e.pointer] = null, t.$.__status.cached = !1), t;
1354
+ },
1355
+ cacheModel: (t, i) => {
1356
+ if (i) {
1357
+ if (e.pointer >= 0 && e.pointer < e.models.length) {
1358
+ const r = e.models[e.pointer];
1359
+ r && (r.$.__status.cached = !1, r.cacheable = !1), e.models[e.pointer] = t;
1360
+ }
1361
+ } else
1362
+ e.models.push(t), e.pointer++;
1363
+ t && (t.$.__status.cached = !0);
1364
+ }
1365
+ };
1366
+ return e;
1367
+ }
1368
+ $.createContext(void 0);
1369
+ function vt(n) {
1370
+ return (t) => {
1371
+ h(`FC begin hook=${n.name}`);
1372
+ const i = Ee();
1373
+ let r;
1374
+ if (i) {
1375
+ if (i.staticModelsTrap)
1376
+ throw Error(`Hook "${n.name}" called recursively.`);
1377
+ X(t.id) && t.id ? (r = i.getCachedModel(t.id), r ? (i.staticModelsTrap = ne(r.$.__staticChildrenCache), i.staticModelsTrap.owner = r, h(`use cached dynamic model=#${r.birthMark()} path=${r.htmlId()} cache=#${i.owner.birthMark()}`)) : i.staticModelsTrap = ne([])) : (i.staticModelsTrap = ne([]), h('Set property "id" in JSX for caching the model by the parent component.', "warn"));
1378
+ }
1379
+ const o = n(t);
1380
+ let c = !1;
1381
+ if (r) {
1382
+ if (r != o) throw Error("The cached models don't match");
1383
+ c = !0;
1384
+ } else
1385
+ r = o, !t.id && r.id === n.name && (r.id = void 0), i && r.id && r.id === t.id && (c = i.getCachedModel(r.id) === r, !c && r.cacheable && i.cacheModel(r));
1386
+ if (i?.staticModelsTrap) {
1387
+ if (r.$.__staticChildrenCache.length && i.staticModelsTrap.models.length && r.$.__staticChildrenCache != i.staticModelsTrap.models)
1388
+ throw Error("something's wrong");
1389
+ t.id && !c && (r.$.__staticChildrenCache = i.staticModelsTrap.models, y.traceLog && r.$.__staticChildrenCache.forEach((a) => {
1390
+ a && (a.$.__owner || (a.$.__owner = r), h(`cache static model=#${a.birthMark()} path=${a.htmlId()} cache=#${r.birthMark()}`));
1391
+ })), i.staticModelsTrap = void 0;
1392
+ }
1393
+ return h(`FC end hook=${n.name}`), r.View();
1394
+ };
1395
+ }
1396
+ window.addEventListener("unhandledrejection", (n) => {
1397
+ y.errorHandler && (n.preventDefault(), y.errorHandler(n.reason));
1398
+ });
1399
+ window.addEventListener("error", (n) => {
1400
+ y.errorHandler && (n.preventDefault(), y.errorHandler(n.error));
1401
+ });
1402
+ const y = {
1403
+ traceLog: !1,
1404
+ hashHtmlId: !1,
1405
+ modelCacheMode: "auto-cache"
1406
+ };
1407
+ function h(n, e = "info") {
1408
+ if (y.traceLog)
1409
+ switch (e) {
1410
+ case "warn":
1411
+ console.warn(n);
1412
+ break;
1413
+ case "error":
1414
+ console.error(n);
1415
+ break;
1416
+ default:
1417
+ console.debug(n);
1418
+ }
1419
+ }
1420
+ window.UECA = y;
1421
+ export {
1422
+ rt as $,
1423
+ I as $name,
1424
+ _t as IF,
1425
+ ft as RenderNode,
1426
+ we as bind,
1427
+ Xe as bindProp,
1428
+ lt as clone,
1429
+ bt as defaultMessageBus,
1430
+ x as errorIf,
1431
+ mt as errorIfNot,
1432
+ vt as getFC,
1433
+ y as globalSettings,
1434
+ k as intersection,
1435
+ T as isArray,
1436
+ ut as isBoolean,
1437
+ U as isComponentModel,
1438
+ ye as isEqual,
1439
+ f as isFunction,
1440
+ Ue as isMap,
1441
+ Ye as isNull,
1442
+ dt as isNumber,
1443
+ O as isObject,
1444
+ X as isString,
1445
+ ie as isSymbol,
1446
+ b as isUndefined,
1447
+ pt as observe,
1448
+ oe as renderNode,
1449
+ gt as sleep,
1450
+ st as useComponent,
1451
+ $t as useExtendedComponent,
1452
+ et as useMessaging
1453
+ };