@raphy-js/raph 1.0.0-dev.18

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 (186) hide show
  1. package/LICENSE +202 -0
  2. package/dist/api/Raph.d.ts +97 -0
  3. package/dist/api/RaphFacadeSession.d.ts +90 -0
  4. package/dist/api/RaphReactivityInstance.d.ts +72 -0
  5. package/dist/api/errors.d.ts +25 -0
  6. package/dist/api/types.d.ts +170 -0
  7. package/dist/core-CyilRD7s.js +1055 -0
  8. package/dist/core-ugchZNqC.cjs +1 -0
  9. package/dist/debug/api/Raph.cjs +1 -0
  10. package/dist/debug/api/Raph.js +421 -0
  11. package/dist/debug/api/RaphFacadeSession.cjs +1 -0
  12. package/dist/debug/api/RaphFacadeSession.js +306 -0
  13. package/dist/debug/api/RaphReactivityInstance.cjs +1 -0
  14. package/dist/debug/api/RaphReactivityInstance.js +149 -0
  15. package/dist/debug/api/errors.cjs +1 -0
  16. package/dist/debug/api/errors.js +17 -0
  17. package/dist/debug/api/types.cjs +1 -0
  18. package/dist/debug/api/types.js +1 -0
  19. package/dist/debug/path/DataPath.cjs +1 -0
  20. package/dist/debug/path/DataPath.js +394 -0
  21. package/dist/debug/path/PathRouter.cjs +1 -0
  22. package/dist/debug/path/PathRouter.js +86 -0
  23. package/dist/debug/path/RaphKernel.cjs +1 -0
  24. package/dist/debug/path/RaphKernel.js +687 -0
  25. package/dist/debug/path/data-path.types.cjs +1 -0
  26. package/dist/debug/path/data-path.types.js +1 -0
  27. package/dist/debug/path/data-path.utils.cjs +1 -0
  28. package/dist/debug/path/data-path.utils.js +56 -0
  29. package/dist/debug/path/derived/DerivedRegistry.cjs +1 -0
  30. package/dist/debug/path/derived/DerivedRegistry.js +157 -0
  31. package/dist/debug/path/derived/RaphDerivedHandle.cjs +1 -0
  32. package/dist/debug/path/derived/RaphDerivedHandle.js +125 -0
  33. package/dist/debug/path/derived/derived-collection.types.cjs +1 -0
  34. package/dist/debug/path/derived/derived-collection.types.js +1 -0
  35. package/dist/debug/path/derived/derived-collection.utils.cjs +1 -0
  36. package/dist/debug/path/derived/derived-collection.utils.js +179 -0
  37. package/dist/debug/path/derived/derived-strategy.types.cjs +1 -0
  38. package/dist/debug/path/derived/derived-strategy.types.js +1 -0
  39. package/dist/debug/path/derived/derived-strategy.utils.cjs +1 -0
  40. package/dist/debug/path/derived/derived-strategy.utils.js +20 -0
  41. package/dist/debug/path/meta/MetaController.cjs +1 -0
  42. package/dist/debug/path/meta/MetaController.js +214 -0
  43. package/dist/debug/path/meta/RaphMeta.cjs +1 -0
  44. package/dist/debug/path/meta/RaphMeta.js +68 -0
  45. package/dist/debug/path/meta/RaphMetaStore.cjs +1 -0
  46. package/dist/debug/path/meta/RaphMetaStore.js +184 -0
  47. package/dist/debug/path/meta/meta.types.cjs +1 -0
  48. package/dist/debug/path/meta/meta.types.js +1 -0
  49. package/dist/debug/path/path.types.cjs +1 -0
  50. package/dist/debug/path/path.types.js +1 -0
  51. package/dist/debug/path/pathSegmentKey.cjs +1 -0
  52. package/dist/debug/path/pathSegmentKey.js +12 -0
  53. package/dist/debug/path/storage/AdapterPathStore.cjs +1 -0
  54. package/dist/debug/path/storage/AdapterPathStore.js +133 -0
  55. package/dist/debug/path/storage/DefaultDataAdapter.cjs +1 -0
  56. package/dist/debug/path/storage/DefaultDataAdapter.js +356 -0
  57. package/dist/debug/path/storage/PathEventHub.cjs +1 -0
  58. package/dist/debug/path/storage/PathEventHub.js +148 -0
  59. package/dist/debug/path/storage/PathStore.cjs +1 -0
  60. package/dist/debug/path/storage/PathStore.js +326 -0
  61. package/dist/debug/path/storage/createDataDraft.cjs +1 -0
  62. package/dist/debug/path/storage/createDataDraft.js +71 -0
  63. package/dist/debug/path/storage/data-adapter.types.cjs +1 -0
  64. package/dist/debug/path/storage/data-adapter.types.js +1 -0
  65. package/dist/debug/reactivity/engine.cjs +1 -0
  66. package/dist/debug/reactivity/engine.js +1305 -0
  67. package/dist/debug/reactivity/reactive-object.cjs +1 -0
  68. package/dist/debug/reactivity/reactive-object.js +280 -0
  69. package/dist/debug/reactivity/scope.cjs +1 -0
  70. package/dist/debug/reactivity/scope.js +274 -0
  71. package/dist/debug/reactivity/types.cjs +1 -0
  72. package/dist/debug/reactivity/types.js +1 -0
  73. package/dist/debug/reactivity/watch.cjs +1 -0
  74. package/dist/debug/reactivity/watch.js +64 -0
  75. package/dist/debug/runtime/RaphRuntime.cjs +1 -0
  76. package/dist/debug/runtime/RaphRuntime.js +979 -0
  77. package/dist/debug/runtime/diagnostics/RaphDebug.cjs +1 -0
  78. package/dist/debug/runtime/diagnostics/RaphDebug.js +297 -0
  79. package/dist/debug/runtime/errors.cjs +1 -0
  80. package/dist/debug/runtime/errors.js +15 -0
  81. package/dist/debug/runtime/ownership/RaphEffectScope.cjs +1 -0
  82. package/dist/debug/runtime/ownership/RaphEffectScope.js +171 -0
  83. package/dist/debug/runtime/ownership/RaphNode.cjs +1 -0
  84. package/dist/debug/runtime/ownership/RaphNode.js +206 -0
  85. package/dist/debug/runtime/ownership/RaphScope.cjs +1 -0
  86. package/dist/debug/runtime/ownership/RaphScope.js +101 -0
  87. package/dist/debug/runtime/ownership/parent-graph.types.cjs +1 -0
  88. package/dist/debug/runtime/ownership/parent-graph.types.js +1 -0
  89. package/dist/debug/runtime/ownership/parentGraph.cjs +1 -0
  90. package/dist/debug/runtime/ownership/parentGraph.js +10 -0
  91. package/dist/debug/runtime/ownership/throwDisposalErrors.cjs +1 -0
  92. package/dist/debug/runtime/ownership/throwDisposalErrors.js +9 -0
  93. package/dist/debug/runtime/phases/RaphFrameLoop.cjs +1 -0
  94. package/dist/debug/runtime/phases/RaphFrameLoop.js +106 -0
  95. package/dist/debug/runtime/phases/RaphPhasePipeline.cjs +1 -0
  96. package/dist/debug/runtime/phases/RaphPhasePipeline.js +587 -0
  97. package/dist/debug/runtime/phases/orderPhaseTasks.cjs +1 -0
  98. package/dist/debug/runtime/phases/orderPhaseTasks.js +59 -0
  99. package/dist/debug/runtime/phases/phase.types.cjs +1 -0
  100. package/dist/debug/runtime/phases/phase.types.js +8 -0
  101. package/dist/debug/runtime/reactivity/PathHandle.cjs +1 -0
  102. package/dist/debug/runtime/reactivity/PathHandle.js +175 -0
  103. package/dist/debug/runtime/reactivity/RaphMetaSource.cjs +1 -0
  104. package/dist/debug/runtime/reactivity/RaphMetaSource.js +112 -0
  105. package/dist/debug/runtime/reactivity/RaphWorkGraph.cjs +1 -0
  106. package/dist/debug/runtime/reactivity/RaphWorkGraph.js +995 -0
  107. package/dist/debug/runtime/reactivity/RuntimeReactivity.cjs +1 -0
  108. package/dist/debug/runtime/reactivity/RuntimeReactivity.js +156 -0
  109. package/dist/debug/runtime/reactivity/RuntimeWatch.cjs +1 -0
  110. package/dist/debug/runtime/reactivity/RuntimeWatch.js +88 -0
  111. package/dist/debug/runtime/reactivity/runtime-reactivity.types.cjs +1 -0
  112. package/dist/debug/runtime/reactivity/runtime-reactivity.types.js +1 -0
  113. package/dist/entrypoints/machine-testing.d.ts +2 -0
  114. package/dist/entrypoints/machine.d.ts +5 -0
  115. package/dist/entrypoints/path.d.ts +14 -0
  116. package/dist/entrypoints/reactivity.d.ts +1 -0
  117. package/dist/entrypoints/runtime.d.ts +17 -0
  118. package/dist/index.cjs +1 -0
  119. package/dist/index.js +48 -0
  120. package/dist/machine/compiler.d.ts +71 -0
  121. package/dist/machine/core.d.ts +50 -0
  122. package/dist/machine/persistence.d.ts +5 -0
  123. package/dist/machine/runtime.d.ts +4 -0
  124. package/dist/machine/testing.d.ts +43 -0
  125. package/dist/machine/types.d.ts +155 -0
  126. package/dist/machine-testing.cjs +1 -0
  127. package/dist/machine-testing.js +188 -0
  128. package/dist/machine.cjs +1 -0
  129. package/dist/machine.js +837 -0
  130. package/dist/main.d.ts +20 -0
  131. package/dist/path/DataPath.d.ts +73 -0
  132. package/dist/path/PathRouter.d.ts +21 -0
  133. package/dist/path/RaphKernel.d.ts +169 -0
  134. package/dist/path/data-path.types.d.ts +34 -0
  135. package/dist/path/data-path.utils.d.ts +9 -0
  136. package/dist/path/derived/DerivedRegistry.d.ts +67 -0
  137. package/dist/path/derived/RaphDerivedHandle.d.ts +97 -0
  138. package/dist/path/derived/derived-collection.types.d.ts +12 -0
  139. package/dist/path/derived/derived-collection.utils.d.ts +20 -0
  140. package/dist/path/derived/derived-strategy.types.d.ts +12 -0
  141. package/dist/path/derived/derived-strategy.utils.d.ts +4 -0
  142. package/dist/path/meta/MetaController.d.ts +85 -0
  143. package/dist/path/meta/RaphMeta.d.ts +45 -0
  144. package/dist/path/meta/RaphMetaStore.d.ts +45 -0
  145. package/dist/path/meta/meta.types.d.ts +31 -0
  146. package/dist/path/path.types.d.ts +27 -0
  147. package/dist/path/pathSegmentKey.d.ts +2 -0
  148. package/dist/path/storage/AdapterPathStore.d.ts +45 -0
  149. package/dist/path/storage/DefaultDataAdapter.d.ts +63 -0
  150. package/dist/path/storage/PathEventHub.d.ts +48 -0
  151. package/dist/path/storage/PathStore.d.ts +51 -0
  152. package/dist/path/storage/createDataDraft.d.ts +4 -0
  153. package/dist/path/storage/data-adapter.types.d.ts +17 -0
  154. package/dist/path.cjs +1 -0
  155. package/dist/path.js +18 -0
  156. package/dist/raph.cjs +1 -0
  157. package/dist/raph.js +48 -0
  158. package/dist/reactivity/engine.d.ts +393 -0
  159. package/dist/reactivity/reactive-object.d.ts +36 -0
  160. package/dist/reactivity/scope.d.ts +146 -0
  161. package/dist/reactivity/types.d.ts +175 -0
  162. package/dist/reactivity/watch.d.ts +15 -0
  163. package/dist/reactivity.cjs +1 -0
  164. package/dist/reactivity.js +14 -0
  165. package/dist/runtime/RaphRuntime.d.ts +225 -0
  166. package/dist/runtime/diagnostics/RaphDebug.d.ts +239 -0
  167. package/dist/runtime/errors.d.ts +21 -0
  168. package/dist/runtime/ownership/RaphEffectScope.d.ts +29 -0
  169. package/dist/runtime/ownership/RaphNode.d.ts +40 -0
  170. package/dist/runtime/ownership/RaphScope.d.ts +38 -0
  171. package/dist/runtime/ownership/parent-graph.types.d.ts +4 -0
  172. package/dist/runtime/ownership/parentGraph.d.ts +3 -0
  173. package/dist/runtime/ownership/throwDisposalErrors.d.ts +1 -0
  174. package/dist/runtime/phases/RaphFrameLoop.d.ts +51 -0
  175. package/dist/runtime/phases/RaphPhasePipeline.d.ts +79 -0
  176. package/dist/runtime/phases/orderPhaseTasks.d.ts +6 -0
  177. package/dist/runtime/phases/phase.types.d.ts +92 -0
  178. package/dist/runtime/reactivity/PathHandle.d.ts +80 -0
  179. package/dist/runtime/reactivity/RaphMetaSource.d.ts +32 -0
  180. package/dist/runtime/reactivity/RaphWorkGraph.d.ts +171 -0
  181. package/dist/runtime/reactivity/RuntimeReactivity.d.ts +45 -0
  182. package/dist/runtime/reactivity/RuntimeWatch.d.ts +34 -0
  183. package/dist/runtime/reactivity/runtime-reactivity.types.d.ts +11 -0
  184. package/dist/runtime.cjs +1 -0
  185. package/dist/runtime.js +23 -0
  186. package/package.json +141 -0
@@ -0,0 +1,56 @@
1
+ import { DataPath as n } from "./DataPath.js";
2
+ const f = 2e4;
3
+ let a, s;
4
+ function g(e, r) {
5
+ if (!(r != null && r.vars)) {
6
+ const c = a == null ? void 0 : a.get(e);
7
+ if (c !== void 0)
8
+ return c;
9
+ }
10
+ if (typeof e != "string")
11
+ return i(e, r);
12
+ const t = n._parseExactString(e, r);
13
+ if (!(r != null && r.vars)) {
14
+ const c = a ?? (a = /* @__PURE__ */ new Map());
15
+ c.size >= f && c.clear(), c.set(e, t);
16
+ }
17
+ return t;
18
+ }
19
+ function M(e) {
20
+ const r = s == null ? void 0 : s.get(e);
21
+ if (r !== void 0)
22
+ return r;
23
+ if (typeof e != "string")
24
+ return u(e);
25
+ const t = n._parseMaskString(e), c = s ?? (s = /* @__PURE__ */ new Map());
26
+ return c.size >= f && c.clear(), c.set(e, t), t;
27
+ }
28
+ function d(e) {
29
+ if (e.segments.length === 0)
30
+ return ["*"];
31
+ const r = [`${e.canonical}.*`];
32
+ for (let t = 1; t < e.segments.length; t++)
33
+ r.push(n._renderSegments(e.segments.slice(0, t)));
34
+ return r;
35
+ }
36
+ function i(e, r) {
37
+ const t = n.from(e, r)._asExact();
38
+ if (e instanceof n && !(r != null && r.vars)) {
39
+ const c = a ?? (a = /* @__PURE__ */ new Map());
40
+ c.size >= f && c.clear(), c.set(e, t);
41
+ }
42
+ return t;
43
+ }
44
+ function u(e) {
45
+ const r = n.from(e)._asMask();
46
+ if (e instanceof n) {
47
+ const t = s ?? (s = /* @__PURE__ */ new Map());
48
+ t.size >= f && t.clear(), t.set(e, r);
49
+ }
50
+ return r;
51
+ }
52
+ export {
53
+ g as parseDataPath,
54
+ M as parsePathMask,
55
+ d as pathRelationMasks
56
+ };
@@ -0,0 +1 @@
1
+ "use strict";var h=Object.defineProperty;var _=(r,e,t)=>e in r?h(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var d=(r,e,t)=>_(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../data-path.utils.cjs"),u=require("../PathRouter.cjs"),f=require("./derived-collection.utils.cjs"),g=2e4;class v{constructor(){d(this,"_router");d(this,"_handles");d(this,"_matches");d(this,"_pending");d(this,"_collections");d(this,"_counter",0)}get size(){var e;return((e=this._handles)==null?void 0:e.size)??0}get pending(){return this._pending}nextId(){return`derived-${this._counter++}`}has(e){var t;return((t=this._handles)==null?void 0:t.has(e))??!1}values(){var e;return((e=this._handles)==null?void 0:e.values())??[][Symbol.iterator]()}state(e){var t;return(t=this._collections)==null?void 0:t.get(e)}register(e,t,i){(this._handles??(this._handles=new Map)).set(e.id,e),i!==void 0&&(this._collections??(this._collections=new Map)).set(e,{from:t,kind:i.kind,key:i.key,initialized:!1,full:!0,keys:new Set,sourceIndex:void 0,targetIndex:void 0});const n=this._router??(this._router=new u.PathRouter);this._matches=void 0,e._attachRoutes(l.pathRelationMasks(t).map(s=>n.add(l.parsePathMask(s),e)))}remove(e){var i,o,n;const t=this._handles;(t==null?void 0:t.get(e.id))===e&&(t.delete(e.id),e._detachRoutes(),this._matches=void 0,(i=this._pending)==null||i.delete(e),(o=this._collections)==null||o.delete(e),((n=this._collections)==null?void 0:n.size)===0&&(this._collections=void 0),t.size===0&&(this._handles=void 0,this._router=void 0,this._pending=void 0))}queue(e){var o;const t=this._matching(e);if(t.length===0)return;const i=this._pending??(this._pending=new Set);for(const n of t){if(n.paused||n.disposed)continue;const s=(o=this._collections)==null?void 0:o.get(n);if(s!==void 0&&s.initialized&&!s.full){const c=f.collectionMutationImpact(s.from,s.key,e);c.kind==="full"?(s.full=!0,s.keys.clear()):s.keys.add(c.key)}i.add(n)}}queueReplacement(e,t){var n;const i=this._matching(e);if(i.length===0)return;const o=this._pending??(this._pending=new Set);for(const s of i){if(s.paused||s.disposed)continue;const c=(n=this._collections)==null?void 0:n.get(s);if(c!==void 0&&c.initialized&&!c.full&&c.from.canonical===e.canonical)for(const a of t)c.keys.add(a);else c!==void 0&&(c.full=!0,c.keys.clear());o.add(s)}}clearPendingIfEmpty(){var e;((e=this._pending)==null?void 0:e.size)===0&&(this._pending=void 0)}dispose(){if(this._handles!==void 0)for(const e of this._handles.values())e._disposeFromKernel();this._handles=void 0,this._router=void 0,this._matches=void 0,this._pending=void 0,this._collections=void 0}_matching(e){var n;const t=this._router;if(t===void 0)return[];let i=(n=this._matches)==null?void 0:n.get(e.canonical);if(i!==void 0)return i;i=[...e.segments.length===0?t.matchAll():t.match(e.segments)];const o=this._matches??(this._matches=new Map);return o.size>=g&&o.clear(),o.set(e.canonical,i),i}}exports.DerivedRegistry=v;
@@ -0,0 +1,157 @@
1
+ var a = Object.defineProperty;
2
+ var h = (l, e, t) => e in l ? a(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
3
+ var d = (l, e, t) => h(l, typeof e != "symbol" ? e + "" : e, t);
4
+ import { pathRelationMasks as _, parsePathMask as u } from "../data-path.utils.js";
5
+ import { PathRouter as f } from "../PathRouter.js";
6
+ import { collectionMutationImpact as m } from "./derived-collection.utils.js";
7
+ const g = 2e4;
8
+ class z {
9
+ constructor() {
10
+ // Хранят routes, handles и инкрементальное состояние materialized derived.
11
+ d(this, "_router");
12
+ d(this, "_handles");
13
+ d(this, "_matches");
14
+ d(this, "_pending");
15
+ d(this, "_collections");
16
+ // Формирует локальные идентификаторы derived без глобального shared state.
17
+ d(this, "_counter", 0);
18
+ }
19
+ /**
20
+ * Возвращает число зарегистрированных записей.
21
+ */
22
+ get size() {
23
+ var e;
24
+ return ((e = this._handles) == null ? void 0 : e.size) ?? 0;
25
+ }
26
+ /**
27
+ * Возвращает очередь derived-вычислений, ожидающих стабилизации.
28
+ */
29
+ get pending() {
30
+ return this._pending;
31
+ }
32
+ /**
33
+ * Выделяет следующий стабильный идентификатор registry.
34
+ */
35
+ nextId() {
36
+ return `derived-${this._counter++}`;
37
+ }
38
+ /**
39
+ * Проверяет наличие derived handle с указанным id.
40
+ */
41
+ has(e) {
42
+ var t;
43
+ return ((t = this._handles) == null ? void 0 : t.has(e)) ?? !1;
44
+ }
45
+ /**
46
+ * Возвращает зарегистрированные derived handles.
47
+ */
48
+ values() {
49
+ var e;
50
+ return ((e = this._handles) == null ? void 0 : e.values()) ?? [][Symbol.iterator]();
51
+ }
52
+ /**
53
+ * Возвращает внутреннее состояние зарегистрированного handle.
54
+ */
55
+ state(e) {
56
+ var t;
57
+ return (t = this._collections) == null ? void 0 : t.get(e);
58
+ }
59
+ /**
60
+ * Регистрирует derived handle и его зависимости.
61
+ */
62
+ register(e, t, i) {
63
+ (this._handles ?? (this._handles = /* @__PURE__ */ new Map())).set(e.id, e), i !== void 0 && (this._collections ?? (this._collections = /* @__PURE__ */ new Map())).set(e, {
64
+ from: t,
65
+ kind: i.kind,
66
+ key: i.key,
67
+ initialized: !1,
68
+ full: !0,
69
+ keys: /* @__PURE__ */ new Set(),
70
+ sourceIndex: void 0,
71
+ targetIndex: void 0
72
+ });
73
+ const n = this._router ?? (this._router = new f());
74
+ this._matches = void 0, e._attachRoutes(_(t).map(
75
+ (s) => n.add(u(s), e)
76
+ ));
77
+ }
78
+ /**
79
+ * Удаляет регистрацию и связанные pending-записи.
80
+ */
81
+ remove(e) {
82
+ var i, o, n;
83
+ const t = this._handles;
84
+ (t == null ? void 0 : t.get(e.id)) === e && (t.delete(e.id), e._detachRoutes(), this._matches = void 0, (i = this._pending) == null || i.delete(e), (o = this._collections) == null || o.delete(e), ((n = this._collections) == null ? void 0 : n.size) === 0 && (this._collections = void 0), t.size === 0 && (this._handles = void 0, this._router = void 0, this._pending = void 0));
85
+ }
86
+ /**
87
+ * Добавляет derived handle в очередь пересчёта.
88
+ */
89
+ queue(e) {
90
+ var o;
91
+ const t = this._matching(e);
92
+ if (t.length === 0)
93
+ return;
94
+ const i = this._pending ?? (this._pending = /* @__PURE__ */ new Set());
95
+ for (const n of t) {
96
+ if (n.paused || n.disposed)
97
+ continue;
98
+ const s = (o = this._collections) == null ? void 0 : o.get(n);
99
+ if (s !== void 0 && s.initialized && !s.full) {
100
+ const c = m(s.from, s.key, e);
101
+ c.kind === "full" ? (s.full = !0, s.keys.clear()) : s.keys.add(c.key);
102
+ }
103
+ i.add(n);
104
+ }
105
+ }
106
+ /**
107
+ * Запоминает полную замену, которую нужно применить при стабилизации.
108
+ */
109
+ queueReplacement(e, t) {
110
+ var n;
111
+ const i = this._matching(e);
112
+ if (i.length === 0)
113
+ return;
114
+ const o = this._pending ?? (this._pending = /* @__PURE__ */ new Set());
115
+ for (const s of i) {
116
+ if (s.paused || s.disposed)
117
+ continue;
118
+ const c = (n = this._collections) == null ? void 0 : n.get(s);
119
+ if (c !== void 0 && c.initialized && !c.full && c.from.canonical === e.canonical)
120
+ for (const r of t)
121
+ c.keys.add(r);
122
+ else c !== void 0 && (c.full = !0, c.keys.clear());
123
+ o.add(s);
124
+ }
125
+ }
126
+ /**
127
+ * Сбрасывает pending-состояние после опустошения очереди.
128
+ */
129
+ clearPendingIfEmpty() {
130
+ var e;
131
+ ((e = this._pending) == null ? void 0 : e.size) === 0 && (this._pending = void 0);
132
+ }
133
+ /**
134
+ * Освобождает все handles и очищает derived registry.
135
+ */
136
+ dispose() {
137
+ if (this._handles !== void 0)
138
+ for (const e of this._handles.values())
139
+ e._disposeFromKernel();
140
+ this._handles = void 0, this._router = void 0, this._matches = void 0, this._pending = void 0, this._collections = void 0;
141
+ }
142
+ _matching(e) {
143
+ var n;
144
+ const t = this._router;
145
+ if (t === void 0)
146
+ return [];
147
+ let i = (n = this._matches) == null ? void 0 : n.get(e.canonical);
148
+ if (i !== void 0)
149
+ return i;
150
+ i = [...e.segments.length === 0 ? t.matchAll() : t.match(e.segments)];
151
+ const o = this._matches ?? (this._matches = /* @__PURE__ */ new Map());
152
+ return o.size >= g && o.clear(), o.set(e.canonical, i), i;
153
+ }
154
+ }
155
+ export {
156
+ z as DerivedRegistry
157
+ };
@@ -0,0 +1 @@
1
+ "use strict";var o=Object.defineProperty;var d=(r,e,t)=>e in r?o(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var s=(r,e,t)=>d(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class a extends Error{constructor(e){super(`[Raph] Derived target is read-only: "${e}".`),this.name="RaphDerivedTargetWriteError"}}class h{constructor(e,t,i){s(this,"id");s(this,"options");s(this,"_kernel");s(this,"_removeRoutes");s(this,"_paused",!1);s(this,"_disposed",!1);s(this,"_status","idle");s(this,"_lastError",null);this._kernel=e,this.id=t,this.options=i}get paused(){return this._paused}get disposed(){return this._disposed}get status(){return this._status}get lastError(){return this._lastError}_recordSuccess(){this._status="success",this._lastError=null}_recordFailure(e){this._status="error",this._lastError=e instanceof Error?e:new Error(String(e))}pause(){this._assertAlive(),this._paused=!0}resume(){this._assertAlive(),this._paused=!1,this.recompute()}recompute(){this._assertAlive(),this._kernel._recomputeDerived(this)}dispose(){this._disposed||(this._disposed=!0,this._kernel._removeDerived(this),this.options.disposeTarget==="delete"&&this._kernel.delete(this.options.to))}_attachRoutes(e){this._removeRoutes=e}_detachRoutes(){const e=this._removeRoutes;if(this._removeRoutes=void 0,e!==void 0)for(const t of e)t()}_disposeFromKernel(){this._disposed=!0,this._removeRoutes=void 0}_assertAlive(){if(this._disposed)throw new Error(`[Raph] Derived "${this.id}" is disposed.`)}}exports.RaphDerivedHandle=h;exports.RaphDerivedTargetWriteError=a;
@@ -0,0 +1,125 @@
1
+ var o = Object.defineProperty;
2
+ var d = (r, e, t) => e in r ? o(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var s = (r, e, t) => d(r, typeof e != "symbol" ? e + "" : e, t);
4
+ class h extends Error {
5
+ /**
6
+ * Создаёт ошибку с canonical path защищённого derived target.
7
+ */
8
+ constructor(e) {
9
+ super(`[Raph] Derived target is read-only: "${e}".`), this.name = "RaphDerivedTargetWriteError";
10
+ }
11
+ }
12
+ class u {
13
+ /**
14
+ * Создаёт internal handle, которым управляет owning Kernel.
15
+ * @internal
16
+ */
17
+ constructor(e, t, i) {
18
+ // Публикуют identity и immutable параметры materialized dependency.
19
+ s(this, "id");
20
+ s(this, "options");
21
+ // Связывают handle с owning Kernel и зарегистрированными source routes.
22
+ s(this, "_kernel");
23
+ s(this, "_removeRoutes");
24
+ // Хранят lifecycle и результат последнего вычисления.
25
+ s(this, "_paused", !1);
26
+ s(this, "_disposed", !1);
27
+ s(this, "_status", "idle");
28
+ s(this, "_lastError", null);
29
+ this._kernel = e, this.id = t, this.options = i;
30
+ }
31
+ /**
32
+ * Показывает, приостановлено ли derived-вычисление.
33
+ */
34
+ get paused() {
35
+ return this._paused;
36
+ }
37
+ /**
38
+ * Показывает, освобождён ли derived handle.
39
+ */
40
+ get disposed() {
41
+ return this._disposed;
42
+ }
43
+ /**
44
+ * Возвращает состояние последнего derived-пересчёта.
45
+ */
46
+ get status() {
47
+ return this._status;
48
+ }
49
+ /**
50
+ * Возвращает последнюю ошибку derived-пересчёта либо null.
51
+ */
52
+ get lastError() {
53
+ return this._lastError;
54
+ }
55
+ /**
56
+ * Фиксирует успешное завершение derived-пересчёта.
57
+ * @internal
58
+ */
59
+ _recordSuccess() {
60
+ this._status = "success", this._lastError = null;
61
+ }
62
+ /**
63
+ * Фиксирует ошибку derived-пересчёта без потери handle.
64
+ * @internal
65
+ */
66
+ _recordFailure(e) {
67
+ this._status = "error", this._lastError = e instanceof Error ? e : new Error(String(e));
68
+ }
69
+ /**
70
+ * Приостанавливает автоматические пересчёты без освобождения handle.
71
+ */
72
+ pause() {
73
+ this._assertAlive(), this._paused = !0;
74
+ }
75
+ /**
76
+ * Возобновляет пересчёты и синхронизирует устаревший target.
77
+ */
78
+ resume() {
79
+ this._assertAlive(), this._paused = !1, this.recompute();
80
+ }
81
+ /**
82
+ * Принудительно пересчитывает derived target.
83
+ */
84
+ recompute() {
85
+ this._assertAlive(), this._kernel._recomputeDerived(this);
86
+ }
87
+ /**
88
+ * Удаляет derived registration и применяет выбранную политику target cleanup.
89
+ */
90
+ dispose() {
91
+ this._disposed || (this._disposed = !0, this._kernel._removeDerived(this), this.options.disposeTarget === "delete" && this._kernel.delete(this.options.to));
92
+ }
93
+ /**
94
+ * Сохраняет disposers source routes текущей стратегии.
95
+ * @internal
96
+ */
97
+ _attachRoutes(e) {
98
+ this._removeRoutes = e;
99
+ }
100
+ /**
101
+ * Отсоединяет все source routes текущей стратегии.
102
+ * @internal
103
+ */
104
+ _detachRoutes() {
105
+ const e = this._removeRoutes;
106
+ if (this._removeRoutes = void 0, e !== void 0)
107
+ for (const t of e)
108
+ t();
109
+ }
110
+ /**
111
+ * Помечает handle освобождённым после cleanup owning Kernel.
112
+ * @internal
113
+ */
114
+ _disposeFromKernel() {
115
+ this._disposed = !0, this._removeRoutes = void 0;
116
+ }
117
+ _assertAlive() {
118
+ if (this._disposed)
119
+ throw new Error(`[Raph] Derived "${this.id}" is disposed.`);
120
+ }
121
+ }
122
+ export {
123
+ u as RaphDerivedHandle,
124
+ h as RaphDerivedTargetWriteError
125
+ };
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("../data-path.utils.cjs");function m(e,t,i){if(i.segments.length<=e.segments.length)return{kind:"full"};for(let o=0;o<e.segments.length;o++)if(!$(e.segments[o],i.segments[o]))return{kind:"full"};const r=i.segments[e.segments.length];if((r==null?void 0:r.kind)!=="selector"||r.key!==t||typeof r.value!="string"&&typeof r.value!="number")return{kind:"full"};const n=i.segments[e.segments.length+1];return(n==null?void 0:n.kind)==="key"&&n.key===t?{kind:"full"}:{kind:"key",key:r.value}}function k(e,t,i){const r=p.parseDataPath(e).canonical,n=typeof i=="number"?String(i):JSON.stringify(i);return`${r}[${t}=${n}]`}function g(e,t,i,r){if(!Array.isArray(i)||!Array.isArray(r))throw f(e,"requires array source and output");if(i.length!==r.length)throw f(e,"must preserve collection cardinality");const n=a(i,t,"source"),o=a(r,t,"output");for(let s=0;s<n.length;s++)if(n[s]!==o[s])throw f(e,"must preserve key order")}function h(e,t,i,r){if(!Array.isArray(r))throw f(e,"incremental compute must return an array");if(i.length!==r.length)throw f(e,"incremental compute must preserve cardinality");const n=a(r,t,"output");for(let o=0;o<i.length;o++)if(i[o]!==n[o])throw f(e,"incremental compute must preserve key order")}function w(e,t,i,r){if(!Array.isArray(i)||!Array.isArray(r))throw u(e,"requires array source and output");d(e,"output must be an ordered subset of source",a(i,t,"source"),a(r,t,"output"))}function b(e,t,i,r){if(!Array.isArray(r))throw u(e,"incremental compute must return an array");d(e,"incremental output must be an ordered subset of input",i,a(r,t,"output"))}function a(e,t,i){const r=new Set,n=[];for(let o=0;o<e.length;o++){if(!(o in e)){n.push(void 0);continue}const s=e[o];if(!y(s))throw new TypeError(`[Raph] ${i} collection items must be objects.`);const c=s[t];if(typeof c!="string"&&typeof c!="number")throw new TypeError(`[Raph] ${i} item key "${t}" must be a string or number.`);if(r.has(c))throw new TypeError(`[Raph] Duplicate ${i} key: "${String(c)}".`);r.add(c),n.push(c)}return n}function A(e,t,i){const r=a(e,t,i),n=new Map;for(let o=0;o<r.length;o++){const s=r[o];s!==void 0&&n.set(s,o)}return n}function x(e,t,i,r){for(const n of r){const o=i.get(n);if(o===void 0)return!0;const s=e[o];if(!y(s)||s[t]!==n)return!0}return!1}function f(e,t){return new TypeError(`[Raph] collectionByKey derived "${e}" ${t}.`)}function u(e,t){return new TypeError(`[Raph] filterByKey derived "${e}" ${t}.`)}function E(e){return l(e,new WeakMap)}function d(e,t,i,r){const n=new Map;for(let s=0;s<i.length;s++){const c=i[s];c!==void 0&&n.set(c,s)}let o=-1;for(const s of r){if(s===void 0)continue;const c=n.get(s);if(c===void 0||c<=o)throw u(e,t);o=c}}function l(e,t){if(e===null||typeof e!="object")return e;const i=t.get(e);if(i!==void 0)return i;if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(e instanceof Map){const n=new Map;t.set(e,n);for(const[o,s]of e)n.set(l(o,t),l(s,t));return n}if(e instanceof Set){const n=new Set;t.set(e,n);for(const o of e)n.add(l(o,t));return n}if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return structuredClone(e);if(Array.isArray(e)){const n=[];t.set(e,n);for(let o=0;o<e.length;o++)o in e&&(n[o]=l(e[o],t));return n}const r=Object.create(Object.getPrototypeOf(e));t.set(e,r);for(const n of Reflect.ownKeys(e))r[n]=l(e[n],t);return r}function $(e,t){return e.kind!==t.kind?!1:e.kind==="key"&&t.kind==="key"?e.key===t.key:e.kind==="index"&&t.kind==="index"?e.index===t.index:e.kind==="selector"&&t.kind==="selector"&&e.key===t.key&&Object.is(e.value,t.value)}function y(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}exports.cloneMaterializedValue=E;exports.collectionError=f;exports.collectionIndex=A;exports.collectionKeys=a;exports.collectionMutationImpact=m;exports.filterError=u;exports.indexesAreStale=x;exports.keyedPath=k;exports.validateFullCollection=g;exports.validateFullFilter=w;exports.validateIncrementalCollection=h;exports.validateIncrementalFilter=b;
@@ -0,0 +1,179 @@
1
+ import { parseDataPath as p } from "../data-path.utils.js";
2
+ function g(e, t, i) {
3
+ if (i.segments.length <= e.segments.length)
4
+ return { kind: "full" };
5
+ for (let o = 0; o < e.segments.length; o++)
6
+ if (!m(e.segments[o], i.segments[o]))
7
+ return { kind: "full" };
8
+ const r = i.segments[e.segments.length];
9
+ if ((r == null ? void 0 : r.kind) !== "selector" || r.key !== t || typeof r.value != "string" && typeof r.value != "number")
10
+ return { kind: "full" };
11
+ const n = i.segments[e.segments.length + 1];
12
+ return (n == null ? void 0 : n.kind) === "key" && n.key === t ? { kind: "full" } : { kind: "key", key: r.value };
13
+ }
14
+ function h(e, t, i) {
15
+ const r = p(e).canonical, n = typeof i == "number" ? String(i) : JSON.stringify(i);
16
+ return `${r}[${t}=${n}]`;
17
+ }
18
+ function w(e, t, i, r) {
19
+ if (!Array.isArray(i) || !Array.isArray(r))
20
+ throw a(e, "requires array source and output");
21
+ if (i.length !== r.length)
22
+ throw a(e, "must preserve collection cardinality");
23
+ const n = f(i, t, "source"), o = f(r, t, "output");
24
+ for (let s = 0; s < n.length; s++)
25
+ if (n[s] !== o[s])
26
+ throw a(e, "must preserve key order");
27
+ }
28
+ function A(e, t, i, r) {
29
+ if (!Array.isArray(r))
30
+ throw a(e, "incremental compute must return an array");
31
+ if (i.length !== r.length)
32
+ throw a(e, "incremental compute must preserve cardinality");
33
+ const n = f(r, t, "output");
34
+ for (let o = 0; o < i.length; o++)
35
+ if (i[o] !== n[o])
36
+ throw a(e, "incremental compute must preserve key order");
37
+ }
38
+ function b(e, t, i, r) {
39
+ if (!Array.isArray(i) || !Array.isArray(r))
40
+ throw y(e, "requires array source and output");
41
+ d(
42
+ e,
43
+ "output must be an ordered subset of source",
44
+ f(i, t, "source"),
45
+ f(r, t, "output")
46
+ );
47
+ }
48
+ function x(e, t, i, r) {
49
+ if (!Array.isArray(r))
50
+ throw y(e, "incremental compute must return an array");
51
+ d(
52
+ e,
53
+ "incremental output must be an ordered subset of input",
54
+ i,
55
+ f(r, t, "output")
56
+ );
57
+ }
58
+ function f(e, t, i) {
59
+ const r = /* @__PURE__ */ new Set(), n = [];
60
+ for (let o = 0; o < e.length; o++) {
61
+ if (!(o in e)) {
62
+ n.push(void 0);
63
+ continue;
64
+ }
65
+ const s = e[o];
66
+ if (!l(s))
67
+ throw new TypeError(`[Raph] ${i} collection items must be objects.`);
68
+ const c = s[t];
69
+ if (typeof c != "string" && typeof c != "number")
70
+ throw new TypeError(`[Raph] ${i} item key "${t}" must be a string or number.`);
71
+ if (r.has(c))
72
+ throw new TypeError(`[Raph] Duplicate ${i} key: "${String(c)}".`);
73
+ r.add(c), n.push(c);
74
+ }
75
+ return n;
76
+ }
77
+ function $(e, t, i) {
78
+ const r = f(e, t, i), n = /* @__PURE__ */ new Map();
79
+ for (let o = 0; o < r.length; o++) {
80
+ const s = r[o];
81
+ s !== void 0 && n.set(s, o);
82
+ }
83
+ return n;
84
+ }
85
+ function E(e, t, i, r) {
86
+ for (const n of r) {
87
+ const o = i.get(n);
88
+ if (o === void 0)
89
+ return !0;
90
+ const s = e[o];
91
+ if (!l(s) || s[t] !== n)
92
+ return !0;
93
+ }
94
+ return !1;
95
+ }
96
+ function a(e, t) {
97
+ return new TypeError(`[Raph] collectionByKey derived "${e}" ${t}.`);
98
+ }
99
+ function y(e, t) {
100
+ return new TypeError(`[Raph] filterByKey derived "${e}" ${t}.`);
101
+ }
102
+ function R(e) {
103
+ return u(e, /* @__PURE__ */ new WeakMap());
104
+ }
105
+ function d(e, t, i, r) {
106
+ const n = /* @__PURE__ */ new Map();
107
+ for (let s = 0; s < i.length; s++) {
108
+ const c = i[s];
109
+ c !== void 0 && n.set(c, s);
110
+ }
111
+ let o = -1;
112
+ for (const s of r) {
113
+ if (s === void 0)
114
+ continue;
115
+ const c = n.get(s);
116
+ if (c === void 0 || c <= o)
117
+ throw y(e, t);
118
+ o = c;
119
+ }
120
+ }
121
+ function u(e, t) {
122
+ if (e === null || typeof e != "object")
123
+ return e;
124
+ const i = t.get(e);
125
+ if (i !== void 0)
126
+ return i;
127
+ if (e instanceof Date)
128
+ return new Date(e.getTime());
129
+ if (e instanceof RegExp)
130
+ return new RegExp(e.source, e.flags);
131
+ if (e instanceof Map) {
132
+ const n = /* @__PURE__ */ new Map();
133
+ t.set(e, n);
134
+ for (const [o, s] of e)
135
+ n.set(u(o, t), u(s, t));
136
+ return n;
137
+ }
138
+ if (e instanceof Set) {
139
+ const n = /* @__PURE__ */ new Set();
140
+ t.set(e, n);
141
+ for (const o of e)
142
+ n.add(u(o, t));
143
+ return n;
144
+ }
145
+ if (e instanceof ArrayBuffer || ArrayBuffer.isView(e))
146
+ return structuredClone(e);
147
+ if (Array.isArray(e)) {
148
+ const n = [];
149
+ t.set(e, n);
150
+ for (let o = 0; o < e.length; o++)
151
+ o in e && (n[o] = u(e[o], t));
152
+ return n;
153
+ }
154
+ const r = Object.create(Object.getPrototypeOf(e));
155
+ t.set(e, r);
156
+ for (const n of Reflect.ownKeys(e))
157
+ r[n] = u(e[n], t);
158
+ return r;
159
+ }
160
+ function m(e, t) {
161
+ return e.kind !== t.kind ? !1 : e.kind === "key" && t.kind === "key" ? e.key === t.key : e.kind === "index" && t.kind === "index" ? e.index === t.index : e.kind === "selector" && t.kind === "selector" && e.key === t.key && Object.is(e.value, t.value);
162
+ }
163
+ function l(e) {
164
+ return typeof e == "object" && e !== null && !Array.isArray(e);
165
+ }
166
+ export {
167
+ R as cloneMaterializedValue,
168
+ a as collectionError,
169
+ $ as collectionIndex,
170
+ f as collectionKeys,
171
+ g as collectionMutationImpact,
172
+ y as filterError,
173
+ E as indexesAreStale,
174
+ h as keyedPath,
175
+ w as validateFullCollection,
176
+ b as validateFullFilter,
177
+ A as validateIncrementalCollection,
178
+ x as validateIncrementalFilter
179
+ };
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function t(){return Object.freeze({kind:"full"})}function n(r){const e=String(r??"").trim();if(e.length===0)throw new TypeError("[Raph] collectionByKey requires a non-empty key.");return Object.freeze({kind:"collection-by-key",key:e})}function i(r){const e=String(r??"").trim();if(e.length===0)throw new TypeError("[Raph] filterByKey requires a non-empty key.");return Object.freeze({kind:"filter-by-key",key:e})}exports.collectionByKey=n;exports.filterByKey=i;exports.full=t;
@@ -0,0 +1,20 @@
1
+ function n() {
2
+ return Object.freeze({ kind: "full" });
3
+ }
4
+ function t(r) {
5
+ const e = String(r ?? "").trim();
6
+ if (e.length === 0)
7
+ throw new TypeError("[Raph] collectionByKey requires a non-empty key.");
8
+ return Object.freeze({ kind: "collection-by-key", key: e });
9
+ }
10
+ function i(r) {
11
+ const e = String(r ?? "").trim();
12
+ if (e.length === 0)
13
+ throw new TypeError("[Raph] filterByKey requires a non-empty key.");
14
+ return Object.freeze({ kind: "filter-by-key", key: e });
15
+ }
16
+ export {
17
+ t as collectionByKey,
18
+ i as filterByKey,
19
+ n as full
20
+ };
@@ -0,0 +1 @@
1
+ "use strict";var v=Object.defineProperty;var p=(d,e,t)=>e in d?v(d,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):d[e]=t;var l=(d,e,t)=>p(d,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../DataPath.cjs"),g=require("../PathRouter.cjs"),m=require("./RaphMeta.cjs"),_=require("./RaphMetaStore.cjs");class b{constructor(e,t,r){l(this,"_facade");l(this,"_store");l(this,"_router");l(this,"_pending");l(this,"_publishing",!1);l(this,"_watcherCount",0);l(this,"_deferredWatcherCount",0);this._kernel=e,this._ownerExists=t,this._publicationDeferred=r}get facade(){return this._facade??(this._facade=new m.RaphMeta(this._kernel))}get size(){var e;return((e=this._store)==null?void 0:e.size)??0}get hasWatchers(){return this._router!==void 0}get hasDeferredWatchers(){return this._deferredWatcherCount!==0}get(e,t){var r;return(r=this._store)==null?void 0:r.get(e,t)}has(e,t){var r;return((r=this._store)==null?void 0:r.has(e,t))??!1}set(e,t,r,i){(this._store??(this._store=new _.RaphMetaStore)).set(e,t,r),this.record("set",e,t,"explicit",i)}merge(e,t,r,i){(this._store??(this._store=new _.RaphMetaStore)).merge(e,t,r),this.record("merge",e,t,"explicit",i)}delete(e,t,r){var i;return(i=this._store)!=null&&i.delete(e,t)?(this.record("delete",e,t??null,"explicit",r),!0):!1}deleteSubtree(e,t){const r=this._store;if(r!==void 0)for(const i of r.deleteSubtree(e))this.record("delete",i,null,t)}pruneMissing(e,t){const r=this._store;if(r===void 0||r.size===0)return;const n=e.segments().findIndex(s=>s.kind==="index"||s.kind==="selector"),c=n===-1?e:f.DataPath.fromPlain({segs:e.toPlain().segs.slice(0,n)});for(const s of r.pruneMissing(c,o=>this._ownerExists(o)))this.record("delete",s,null,t)}watch(e,t,r={},i){const n=Array.isArray(e)?e:[e];if(n.length===0)throw new TypeError("[RaphMeta] watch requires at least one mask.");const c=new Map;for(const a of n){const u=f.DataPath.from(a,r)._asMask();c.set(u.canonical,u)}const s={active:!0,callback:t,afterPublish:i,...r.namespace===void 0?{}:{namespace:r.namespace}},o=this._router??(this._router=new g.PathRouter),h=[...c.values()].map(a=>o.add(a,s));return this._watcherCount++,i!==void 0&&this._deferredWatcherCount++,w(()=>{s.active=!1,s.callback=void 0,s.afterPublish=void 0;for(const a of h)a();this._watcherCount--,i!==void 0&&this._deferredWatcherCount--,this._watcherCount===0&&(this._router=void 0)})}record(e,t,r,i,n){(this._pending??(this._pending=[])).push({event:{kind:e,path:t,namespace:r,cause:i},invalidate:(n==null?void 0:n.invalidate)??!0}),!this._publicationDeferred()&&!this._publishing&&this.publish()}publish(){const e=this._pending;if(e===void 0||e.length===0||this._publishing)return;const t=[],r=new Map;this._publishing=!0;try{for(;e.length!==0;){const i=e.splice(0),n=this._router;if(n===void 0)continue;const c=new Map;for(const s of i){const o=s.event;for(const h of n.match(o.path._asExact().segments)){if(h.namespace!==void 0&&o.namespace!==null&&h.namespace!==o.namespace)continue;const a=c.get(h);a===void 0?c.set(h,{events:[o],invalidate:s.invalidate}):(a.events.push(o),s.invalidate&&(a.invalidate=!0))}}for(const[s,o]of c){if(!s.active||s.callback===void 0)continue;const h=s.afterPublish;h!==void 0&&r.set(h,(r.get(h)??!1)||o.invalidate);try{s.callback({events:o.events})}catch(a){t.push(a)}}}}finally{this._publishing=!1}for(const[i,n]of r)try{i(n)}catch(c){t.push(c)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"[RaphMeta] Multiple watchers failed.")}dispose(){var e;(e=this._store)==null||e.clear(),this._store=void 0,this._facade=void 0,this._router=void 0,this._pending=void 0,this._watcherCount=0,this._deferredWatcherCount=0}}function w(d){let e=d;return()=>{const t=e;e=void 0,t==null||t()}}exports.MetaController=b;