@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 @@
1
+ "use strict";var f=Object.defineProperty;var l=(i,e,t)=>e in i?f(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var a=(i,e,t)=>l(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("../ownership/RaphNode.cjs"),p=Object.freeze(["action","machine","error"]),v=1024;class b{constructor(e){a(this,"_capacity",v);a(this,"_context","none");a(this,"_guards","failed");a(this,"_include",new Set(p));a(this,"_enabled",!1);a(this,"_events");a(this,"_eventStart",0);a(this,"_eventSize",0);a(this,"_sequence",0);a(this,"_operationSequence",0);a(this,"_machines");a(this,"trace");a(this,"machines");const t=e==null?void 0:e.trace;t!==void 0&&t!==!1&&(this._applyOptions(t),this._enabled=!0,this._ensureBuffer()),this.trace=Object.freeze({clear:()=>this.clear(),read:s=>this.read(s),start:s=>this.start(s),status:()=>this.status(),stop:()=>this.stop()}),this.machines=Object.freeze({list:()=>this.listMachines(),snapshot:s=>this.machineSnapshot(s)})}start(e){e!==void 0&&this._applyOptions(e),this._enabled=!0,this._ensureBuffer()}stop(){this._enabled=!1}clear(){var e;(e=this._events)==null||e.fill(void 0),this._eventStart=0,this._eventSize=0}read(e={}){const t=e.since??-1,s=e.limit??Number.POSITIVE_INFINITY;if(!Number.isFinite(s)&&s!==Number.POSITIVE_INFINITY)throw new TypeError("[Raph] Trace limit must be a positive integer.");if(s!==Number.POSITIVE_INFINITY&&(!Number.isInteger(s)||s<0))throw new TypeError("[Raph] Trace limit must be a positive integer.");const n=this._events;if(n===void 0||this._eventSize===0||s===0)return Object.freeze([]);const d=[];for(let r=0;r<this._eventSize;r++){const c=n[(this._eventStart+r)%this._capacity];if(!(c===void 0||c.sequence<=t)&&(d.push(c),d.length>=s))break}return Object.freeze(d)}status(){return Object.freeze({capacity:this._capacity,context:this._context,enabled:this._enabled,guards:this._guards,include:Object.freeze([...this._include]),size:this._eventSize})}nextOperationId(e){if(!(!this._enabled||!this._include.has(e)))return++this._operationSequence}traces(e){return this._enabled&&this._include.has(e)}record(e){if(!this._enabled||!this._include.has(e.kind)||e.guard!==void 0&&(this._guards==="none"||this._guards==="failed"&&e.guard!=="failed"))return;const t=Object.freeze({...e.causeId===void 0?{}:{causeId:e.causeId},...e.context===void 0||this._context==="none"?{}:{contextKeys:Object.freeze(Object.keys(e.context))},...e.details===void 0?{}:{details:Object.freeze({...e.details})},...e.guard===void 0?{}:{guard:e.guard},...e.operationId===void 0?{}:{operationId:e.operationId},...e.status===void 0?{}:{status:e.status},kind:e.kind,name:e.name,sequence:++this._sequence,timestamp:Date.now()}),s=this._ensureBuffer();if(this._eventSize<this._capacity){s[(this._eventStart+this._eventSize++)%this._capacity]=t;return}s[this._eventStart]=t,this._eventStart=(this._eventStart+1)%this._capacity}registerMachine(e){const t=this._machines??(this._machines=new Map);if(t.has(e.id))throw new Error(`[Raph] Machine diagnostic id "${e.id}" is already registered.`);return t.set(e.id,e),()=>{t.get(e.id)===e&&t.delete(e.id),t.size===0&&this._machines===t&&(this._machines=void 0)}}hasMachine(e){var t;return((t=this._machines)==null?void 0:t.has(e))??!1}listMachines(){var t;const e=[];for(const s of((t=this._machines)==null?void 0:t.values())??[]){const n=s.snapshot();e.push(Object.freeze({active:n.active,id:n.id,modelId:n.modelId,ownerId:n.ownerId,...n.parentId===void 0?{}:{parentId:n.parentId},revision:n.revision,status:n.status}))}return Object.freeze(e)}machineSnapshot(e){var t,s;return(s=(t=this._machines)==null?void 0:t.get(e))==null?void 0:s.snapshot()}get machineCount(){var e;return((e=this._machines)==null?void 0:e.size)??0}get traceSize(){return this._eventSize}get actorCount(){var t;let e=0;for(const s of((t=this._machines)==null?void 0:t.values())??[])e+=s.snapshot().actors.length;return e}machineTreeNodesByOwner(){var d;const e=[...((d=this._machines)==null?void 0:d.values())??[]],t=new Map(e.map(r=>[r.id,r])),s=new Map;for(const r of e){if(r.parentId===void 0||!t.has(r.parentId))continue;const c=s.get(r.parentId)??[];c.push(r),s.set(r.parentId,c)}const n=new Map;for(const r of e){if(r.parentId!==void 0&&t.has(r.parentId))continue;const c=n.get(r.ownerId)??[];c.push(_(r,s,!1)),n.set(r.ownerId,c)}return new Map([...n].map(([r,c])=>[r,Object.freeze(c)]))}_applyOptions(e){if(e.capacity!==void 0){if(!Number.isInteger(e.capacity)||e.capacity<=0)throw new TypeError("[Raph] Trace capacity must be a positive integer.");e.capacity!==this._capacity&&(this._capacity=e.capacity,this._events=void 0,this._eventStart=0,this._eventSize=0)}if(e.context!==void 0){if(e.context!=="none"&&e.context!=="keys")throw new TypeError('[Raph] Trace context must be "none" or "keys".');this._context=e.context}if(e.guards!==void 0){if(e.guards!=="none"&&e.guards!=="failed"&&e.guards!=="all")throw new TypeError('[Raph] Trace guards must be "none", "failed" or "all".');this._guards=e.guards}if(e.include!==void 0){const t=new Set;for(const s of e.include){if(s!=="action"&&s!=="machine"&&s!=="phase"&&s!=="error")throw new TypeError(`[Raph] Unsupported trace kind "${String(s)}".`);t.add(s)}this._include=t}}_ensureBuffer(){return this._events??(this._events=new Array(this._capacity))}}function o(i){const e=i instanceof h.RaphNode?i.children.map(o):[];return Object.freeze({children:Object.freeze(e),disposed:i.disposed,id:i.id,kind:i instanceof h.RaphNode?"node":"scope",resources:i._debugResourceCount(),sources:i._debugSourceCount()})}function u(i,e=new Map){const t=i instanceof h.RaphNode?i.children.map(n=>u(n,e)):[],s=i._debugResourceCount();return s!==0&&t.push(Object.freeze({children:Object.freeze([]),count:s,id:`${i.id}:resources`,kind:"resource"})),t.push(...e.get(i.id)??[]),Object.freeze({children:Object.freeze(t),disposed:i.disposed,id:i.id,kind:i instanceof h.RaphNode?"node":"scope"})}function _(i,e,t){const s=i.snapshot();return Object.freeze({children:Object.freeze((e.get(i.id)??[]).map(n=>_(n,e,!0))),id:s.id,kind:t?"actor":"machine",status:s.status})}exports.RaphDebugController=b;exports.createOwnerSnapshot=o;exports.createOwnerTree=u;
@@ -0,0 +1,297 @@
1
+ var u = Object.defineProperty;
2
+ var f = (i, e, t) => e in i ? u(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
+ var a = (i, e, t) => f(i, typeof e != "symbol" ? e + "" : e, t);
4
+ import { RaphNode as h } from "../ownership/RaphNode.js";
5
+ const _ = Object.freeze([
6
+ "action",
7
+ "machine",
8
+ "error"
9
+ ]), l = 1024;
10
+ class I {
11
+ /**
12
+ * Создаёт controller; ring buffer появляется только при включённом trace.
13
+ */
14
+ constructor(e) {
15
+ a(this, "_capacity", l);
16
+ a(this, "_context", "none");
17
+ a(this, "_guards", "failed");
18
+ a(this, "_include", new Set(_));
19
+ a(this, "_enabled", !1);
20
+ a(this, "_events");
21
+ a(this, "_eventStart", 0);
22
+ a(this, "_eventSize", 0);
23
+ a(this, "_sequence", 0);
24
+ a(this, "_operationSequence", 0);
25
+ a(this, "_machines");
26
+ a(this, "trace");
27
+ a(this, "machines");
28
+ const t = e == null ? void 0 : e.trace;
29
+ t !== void 0 && t !== !1 && (this._applyOptions(t), this._enabled = !0, this._ensureBuffer()), this.trace = Object.freeze({
30
+ clear: () => this.clear(),
31
+ read: (s) => this.read(s),
32
+ start: (s) => this.start(s),
33
+ status: () => this.status(),
34
+ stop: () => this.stop()
35
+ }), this.machines = Object.freeze({
36
+ list: () => this.listMachines(),
37
+ snapshot: (s) => this.machineSnapshot(s)
38
+ });
39
+ }
40
+ // ---------------------------------------------
41
+ // PUBLIC API
42
+ // ---------------------------------------------
43
+ /**
44
+ * Включает trace с текущими или явно переданными настройками.
45
+ */
46
+ start(e) {
47
+ e !== void 0 && this._applyOptions(e), this._enabled = !0, this._ensureBuffer();
48
+ }
49
+ /**
50
+ * Останавливает запись, сохраняя уже накопленные events.
51
+ */
52
+ stop() {
53
+ this._enabled = !1;
54
+ }
55
+ /**
56
+ * Удаляет все накопленные events, не меняя status trace.
57
+ */
58
+ clear() {
59
+ var e;
60
+ (e = this._events) == null || e.fill(void 0), this._eventStart = 0, this._eventSize = 0;
61
+ }
62
+ /**
63
+ * Формирует immutable chronological copy ring buffer.
64
+ */
65
+ read(e = {}) {
66
+ const t = e.since ?? -1, s = e.limit ?? Number.POSITIVE_INFINITY;
67
+ if (!Number.isFinite(s) && s !== Number.POSITIVE_INFINITY)
68
+ throw new TypeError("[Raph] Trace limit must be a positive integer.");
69
+ if (s !== Number.POSITIVE_INFINITY && (!Number.isInteger(s) || s < 0))
70
+ throw new TypeError("[Raph] Trace limit must be a positive integer.");
71
+ const n = this._events;
72
+ if (n === void 0 || this._eventSize === 0 || s === 0)
73
+ return Object.freeze([]);
74
+ const d = [];
75
+ for (let r = 0; r < this._eventSize; r++) {
76
+ const c = n[(this._eventStart + r) % this._capacity];
77
+ if (!(c === void 0 || c.sequence <= t) && (d.push(c), d.length >= s))
78
+ break;
79
+ }
80
+ return Object.freeze(d);
81
+ }
82
+ /**
83
+ * Возвращает текущую конфигурацию и заполнение buffer.
84
+ */
85
+ status() {
86
+ return Object.freeze({
87
+ capacity: this._capacity,
88
+ context: this._context,
89
+ enabled: this._enabled,
90
+ guards: this._guards,
91
+ include: Object.freeze([...this._include]),
92
+ size: this._eventSize
93
+ });
94
+ }
95
+ /**
96
+ * Выделяет operation ID только когда trace активен для этого kind.
97
+ * @internal
98
+ */
99
+ nextOperationId(e) {
100
+ if (!(!this._enabled || !this._include.has(e)))
101
+ return ++this._operationSequence;
102
+ }
103
+ /**
104
+ * Проверяет active trace path без выделения operation ID.
105
+ *
106
+ * @internal
107
+ */
108
+ traces(e) {
109
+ return this._enabled && this._include.has(e);
110
+ }
111
+ /**
112
+ * Записывает одно событие без allocations/timestamp на disabled path.
113
+ * @internal
114
+ */
115
+ record(e) {
116
+ if (!this._enabled || !this._include.has(e.kind) || e.guard !== void 0 && (this._guards === "none" || this._guards === "failed" && e.guard !== "failed"))
117
+ return;
118
+ const t = Object.freeze({
119
+ ...e.causeId === void 0 ? {} : { causeId: e.causeId },
120
+ ...e.context === void 0 || this._context === "none" ? {} : { contextKeys: Object.freeze(Object.keys(e.context)) },
121
+ ...e.details === void 0 ? {} : { details: Object.freeze({ ...e.details }) },
122
+ ...e.guard === void 0 ? {} : { guard: e.guard },
123
+ ...e.operationId === void 0 ? {} : { operationId: e.operationId },
124
+ ...e.status === void 0 ? {} : { status: e.status },
125
+ kind: e.kind,
126
+ name: e.name,
127
+ sequence: ++this._sequence,
128
+ timestamp: Date.now()
129
+ }), s = this._ensureBuffer();
130
+ if (this._eventSize < this._capacity) {
131
+ s[(this._eventStart + this._eventSize++) % this._capacity] = t;
132
+ return;
133
+ }
134
+ s[this._eventStart] = t, this._eventStart = (this._eventStart + 1) % this._capacity;
135
+ }
136
+ /**
137
+ * Регистрирует read-only machine projection без импорта machine engine в Runtime.
138
+ * @internal
139
+ */
140
+ registerMachine(e) {
141
+ const t = this._machines ?? (this._machines = /* @__PURE__ */ new Map());
142
+ if (t.has(e.id))
143
+ throw new Error(`[Raph] Machine diagnostic id "${e.id}" is already registered.`);
144
+ return t.set(e.id, e), () => {
145
+ t.get(e.id) === e && t.delete(e.id), t.size === 0 && this._machines === t && (this._machines = void 0);
146
+ };
147
+ }
148
+ /**
149
+ * Проверяет diagnostic identity без создания public snapshot.
150
+ *
151
+ * @internal
152
+ */
153
+ hasMachine(e) {
154
+ var t;
155
+ return ((t = this._machines) == null ? void 0 : t.has(e)) ?? !1;
156
+ }
157
+ /**
158
+ * Возвращает compact machine summaries без выполнения guards.
159
+ */
160
+ listMachines() {
161
+ var t;
162
+ const e = [];
163
+ for (const s of ((t = this._machines) == null ? void 0 : t.values()) ?? []) {
164
+ const n = s.snapshot();
165
+ e.push(Object.freeze({
166
+ active: n.active,
167
+ id: n.id,
168
+ modelId: n.modelId,
169
+ ownerId: n.ownerId,
170
+ ...n.parentId === void 0 ? {} : { parentId: n.parentId },
171
+ revision: n.revision,
172
+ status: n.status
173
+ }));
174
+ }
175
+ return Object.freeze(e);
176
+ }
177
+ /**
178
+ * Читает готовый machine snapshot; transition selection и guards не вызываются.
179
+ */
180
+ machineSnapshot(e) {
181
+ var t, s;
182
+ return (s = (t = this._machines) == null ? void 0 : t.get(e)) == null ? void 0 : s.snapshot();
183
+ }
184
+ /**
185
+ * Возвращает число зарегистрированных machines.
186
+ * @internal
187
+ */
188
+ get machineCount() {
189
+ var e;
190
+ return ((e = this._machines) == null ? void 0 : e.size) ?? 0;
191
+ }
192
+ /**
193
+ * Возвращает число текущих trace events.
194
+ * @internal
195
+ */
196
+ get traceSize() {
197
+ return this._eventSize;
198
+ }
199
+ /** Возвращает число child actors по уже готовым snapshots. @internal */
200
+ get actorCount() {
201
+ var t;
202
+ let e = 0;
203
+ for (const s of ((t = this._machines) == null ? void 0 : t.values()) ?? [])
204
+ e += s.snapshot().actors.length;
205
+ return e;
206
+ }
207
+ /** Группирует machine/actor ветви по фактическому lifecycle owner. @internal */
208
+ machineTreeNodesByOwner() {
209
+ var d;
210
+ const e = [...((d = this._machines) == null ? void 0 : d.values()) ?? []], t = new Map(e.map((r) => [r.id, r])), s = /* @__PURE__ */ new Map();
211
+ for (const r of e) {
212
+ if (r.parentId === void 0 || !t.has(r.parentId))
213
+ continue;
214
+ const c = s.get(r.parentId) ?? [];
215
+ c.push(r), s.set(r.parentId, c);
216
+ }
217
+ const n = /* @__PURE__ */ new Map();
218
+ for (const r of e) {
219
+ if (r.parentId !== void 0 && t.has(r.parentId))
220
+ continue;
221
+ const c = n.get(r.ownerId) ?? [];
222
+ c.push(o(r, s, !1)), n.set(r.ownerId, c);
223
+ }
224
+ return new Map([...n].map(([r, c]) => [r, Object.freeze(c)]));
225
+ }
226
+ // ---------------------------------------------
227
+ // PRIVATE
228
+ // ---------------------------------------------
229
+ _applyOptions(e) {
230
+ if (e.capacity !== void 0) {
231
+ if (!Number.isInteger(e.capacity) || e.capacity <= 0)
232
+ throw new TypeError("[Raph] Trace capacity must be a positive integer.");
233
+ e.capacity !== this._capacity && (this._capacity = e.capacity, this._events = void 0, this._eventStart = 0, this._eventSize = 0);
234
+ }
235
+ if (e.context !== void 0) {
236
+ if (e.context !== "none" && e.context !== "keys")
237
+ throw new TypeError('[Raph] Trace context must be "none" or "keys".');
238
+ this._context = e.context;
239
+ }
240
+ if (e.guards !== void 0) {
241
+ if (e.guards !== "none" && e.guards !== "failed" && e.guards !== "all")
242
+ throw new TypeError('[Raph] Trace guards must be "none", "failed" or "all".');
243
+ this._guards = e.guards;
244
+ }
245
+ if (e.include !== void 0) {
246
+ const t = /* @__PURE__ */ new Set();
247
+ for (const s of e.include) {
248
+ if (s !== "action" && s !== "machine" && s !== "phase" && s !== "error")
249
+ throw new TypeError(`[Raph] Unsupported trace kind "${String(s)}".`);
250
+ t.add(s);
251
+ }
252
+ this._include = t;
253
+ }
254
+ }
255
+ _ensureBuffer() {
256
+ return this._events ?? (this._events = new Array(this._capacity));
257
+ }
258
+ }
259
+ function p(i) {
260
+ const e = i instanceof h ? i.children.map(p) : [];
261
+ return Object.freeze({
262
+ children: Object.freeze(e),
263
+ disposed: i.disposed,
264
+ id: i.id,
265
+ kind: i instanceof h ? "node" : "scope",
266
+ resources: i._debugResourceCount(),
267
+ sources: i._debugSourceCount()
268
+ });
269
+ }
270
+ function v(i, e = /* @__PURE__ */ new Map()) {
271
+ const t = i instanceof h ? i.children.map((n) => v(n, e)) : [], s = i._debugResourceCount();
272
+ return s !== 0 && t.push(Object.freeze({
273
+ children: Object.freeze([]),
274
+ count: s,
275
+ id: `${i.id}:resources`,
276
+ kind: "resource"
277
+ })), t.push(...e.get(i.id) ?? []), Object.freeze({
278
+ children: Object.freeze(t),
279
+ disposed: i.disposed,
280
+ id: i.id,
281
+ kind: i instanceof h ? "node" : "scope"
282
+ });
283
+ }
284
+ function o(i, e, t) {
285
+ const s = i.snapshot();
286
+ return Object.freeze({
287
+ children: Object.freeze((e.get(i.id) ?? []).map((n) => o(n, e, !0))),
288
+ id: s.id,
289
+ kind: t ? "actor" : "machine",
290
+ status: s.status
291
+ });
292
+ }
293
+ export {
294
+ I as RaphDebugController,
295
+ p as createOwnerSnapshot,
296
+ v as createOwnerTree
297
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../api/errors.cjs");class e extends r.RaphError{}class o extends r.RaphError{}class a extends r.RaphError{}class p extends r.RaphError{}exports.RaphActionError=e;exports.RaphCrossRuntimeError=a;exports.RaphDisposedError=o;exports.RaphPhaseProcessError=p;
@@ -0,0 +1,15 @@
1
+ import { RaphError as r } from "../api/errors.js";
2
+ class o extends r {
3
+ }
4
+ class a extends r {
5
+ }
6
+ class p extends r {
7
+ }
8
+ class t extends r {
9
+ }
10
+ export {
11
+ o as RaphActionError,
12
+ p as RaphCrossRuntimeError,
13
+ a as RaphDisposedError,
14
+ t as RaphPhaseProcessError
15
+ };
@@ -0,0 +1 @@
1
+ "use strict";var f=Object.defineProperty;var l=(i,e,s)=>e in i?f(i,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[e]=s;var o=(i,e,s)=>l(i,typeof e!="symbol"?e+"":e,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("../errors.cjs");class d{constructor(e,s=null){o(this,"_registrations");o(this,"_children");o(this,"_selfPaused",!1);o(this,"_ancestorPauses",0);o(this,"_disposed",!1);o(this,"_releaseOwner");o(this,"_parent");if(this._owner=e,e._assertAlive(),(s==null?void 0:s.disposed)===!0)throw new _.RaphDisposedError("[Raph] Parent effect scope is disposed.");if(s!==null&&s._owner.runtime!==e.runtime)throw new TypeError("[Raph] Parent effect scope belongs to another runtime.");this._parent=s,s==null||s._addChild(this),this._ancestorPauses=(s==null?void 0:s.paused)===!0?1:0,this._releaseOwner=e.own(()=>this.dispose())}get paused(){return this._selfPaused||this._ancestorPauses!==0}get disposed(){return this._disposed}fork(e){return this._assertAlive(),new d(e,this)}effect(e,s,t){return this._assertAlive(),this._add(this._owner.runtime._effectRegistration(this._owner,e,s,t,this.paused))}watch(e,s,t,r){return this._assertAlive(),this._add(this._owner.runtime._watchRegistration(this._owner,e,s,t,r,this.paused))}pause(){this._assertAlive(),this._owner.runtime._runPhaseTransition(()=>this._pause())}resume(){this._assertAlive(),this._owner.runtime._runPhaseTransition(()=>this._resume())}_pause(){if(this._selfPaused)return;const e=this.paused;if(this._selfPaused=!0,e)return;const s=[];for(const t of this._registrations??[])try{t.registration.pause()}catch(r){s.push(r)}for(const t of this._children??[])try{t._changeAncestorPause(1)}catch(r){s.push(r)}n(s,"[Raph] Pausable effect scope pause failed.")}_resume(){if(!this._selfPaused||(this._selfPaused=!1,this.paused))return;const e=[];for(const s of this._registrations??[])try{s.registration.resume()}catch(t){e.push(t)}for(const s of this._children??[])try{s._changeAncestorPause(-1)}catch(t){e.push(t)}n(e,"[Raph] Pausable effect scope resume failed.")}dispose(){var t,r,a,u;if(this._disposed)return;this._disposed=!0;const e=this._owner.disposed,s=[];for(const h of[...this._children??[]])try{h.dispose()}catch(c){s.push(c)}(t=this._children)==null||t.clear(),this._children=void 0;for(const h of this._registrations??[])if(h.active=!1,!e)try{h.registration.dispose()}catch(c){s.push(c)}if((r=this._registrations)==null||r.clear(),this._registrations=void 0,(u=(a=this._parent)==null?void 0:a._children)==null||u.delete(this),!e)try{this._releaseOwner()}catch(h){s.push(h)}n(s,"[Raph] Pausable effect scope disposal failed.")}_add(e){if(this._disposed||this._owner.disposed)return e.dispose(),p;const s={active:!0,registration:e};return(this._registrations??(this._registrations=new Set)).add(s),()=>{var t;s.active&&(s.active=!1,(t=this._registrations)==null||t.delete(s),e.dispose())}}_assertAlive(){if(this._disposed||this._owner.disposed)throw new _.RaphDisposedError("[Raph] Pausable effect scope is disposed.")}_addChild(e){(this._children??(this._children=new Set)).add(e)}_changeAncestorPause(e){if(this._disposed)return;const s=this.paused;if(this._ancestorPauses+=e,this._ancestorPauses<0)throw this._ancestorPauses=0,new Error("[Raph] Effect scope ancestor pause state is unbalanced.");if(s===this.paused)return;const t=[];for(const r of this._registrations??[])try{this.paused?r.registration.pause():r.registration.resume()}catch(a){t.push(a)}for(const r of this._children??[])try{r._changeAncestorPause(e)}catch(a){t.push(a)}n(t,"[Raph] Pausable effect scope ancestor transition failed.")}}function n(i,e){if(i.length===1)throw i[0];if(i.length>1)throw new AggregateError(i,e)}function p(){}exports.RaphEffectScope=d;
@@ -0,0 +1,171 @@
1
+ var f = Object.defineProperty;
2
+ var l = (r, e, s) => e in r ? f(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s;
3
+ var o = (r, e, s) => l(r, typeof e != "symbol" ? e + "" : e, s);
4
+ import { RaphDisposedError as u } from "../errors.js";
5
+ class _ {
6
+ constructor(e, s = null) {
7
+ o(this, "_registrations");
8
+ o(this, "_children");
9
+ o(this, "_selfPaused", !1);
10
+ o(this, "_ancestorPauses", 0);
11
+ o(this, "_disposed", !1);
12
+ o(this, "_releaseOwner");
13
+ o(this, "_parent");
14
+ if (this._owner = e, e._assertAlive(), (s == null ? void 0 : s.disposed) === !0)
15
+ throw new u("[Raph] Parent effect scope is disposed.");
16
+ if (s !== null && s._owner.runtime !== e.runtime)
17
+ throw new TypeError("[Raph] Parent effect scope belongs to another runtime.");
18
+ this._parent = s, s == null || s._addChild(this), this._ancestorPauses = (s == null ? void 0 : s.paused) === !0 ? 1 : 0, this._releaseOwner = e.own(() => this.dispose());
19
+ }
20
+ get paused() {
21
+ return this._selfPaused || this._ancestorPauses !== 0;
22
+ }
23
+ get disposed() {
24
+ return this._disposed;
25
+ }
26
+ fork(e) {
27
+ return this._assertAlive(), new _(e, this);
28
+ }
29
+ effect(e, s, t) {
30
+ return this._assertAlive(), this._add(this._owner.runtime._effectRegistration(
31
+ this._owner,
32
+ e,
33
+ s,
34
+ t,
35
+ this.paused
36
+ ));
37
+ }
38
+ watch(e, s, t, i) {
39
+ return this._assertAlive(), this._add(this._owner.runtime._watchRegistration(
40
+ this._owner,
41
+ e,
42
+ s,
43
+ t,
44
+ i,
45
+ this.paused
46
+ ));
47
+ }
48
+ pause() {
49
+ this._assertAlive(), this._owner.runtime._runPhaseTransition(() => this._pause());
50
+ }
51
+ resume() {
52
+ this._assertAlive(), this._owner.runtime._runPhaseTransition(() => this._resume());
53
+ }
54
+ _pause() {
55
+ if (this._selfPaused)
56
+ return;
57
+ const e = this.paused;
58
+ if (this._selfPaused = !0, e)
59
+ return;
60
+ const s = [];
61
+ for (const t of this._registrations ?? [])
62
+ try {
63
+ t.registration.pause();
64
+ } catch (i) {
65
+ s.push(i);
66
+ }
67
+ for (const t of this._children ?? [])
68
+ try {
69
+ t._changeAncestorPause(1);
70
+ } catch (i) {
71
+ s.push(i);
72
+ }
73
+ n(s, "[Raph] Pausable effect scope pause failed.");
74
+ }
75
+ _resume() {
76
+ if (!this._selfPaused || (this._selfPaused = !1, this.paused))
77
+ return;
78
+ const e = [];
79
+ for (const s of this._registrations ?? [])
80
+ try {
81
+ s.registration.resume();
82
+ } catch (t) {
83
+ e.push(t);
84
+ }
85
+ for (const s of this._children ?? [])
86
+ try {
87
+ s._changeAncestorPause(-1);
88
+ } catch (t) {
89
+ e.push(t);
90
+ }
91
+ n(e, "[Raph] Pausable effect scope resume failed.");
92
+ }
93
+ dispose() {
94
+ var t, i, h, d;
95
+ if (this._disposed)
96
+ return;
97
+ this._disposed = !0;
98
+ const e = this._owner.disposed, s = [];
99
+ for (const a of [...this._children ?? []])
100
+ try {
101
+ a.dispose();
102
+ } catch (c) {
103
+ s.push(c);
104
+ }
105
+ (t = this._children) == null || t.clear(), this._children = void 0;
106
+ for (const a of this._registrations ?? [])
107
+ if (a.active = !1, !e)
108
+ try {
109
+ a.registration.dispose();
110
+ } catch (c) {
111
+ s.push(c);
112
+ }
113
+ if ((i = this._registrations) == null || i.clear(), this._registrations = void 0, (d = (h = this._parent) == null ? void 0 : h._children) == null || d.delete(this), !e)
114
+ try {
115
+ this._releaseOwner();
116
+ } catch (a) {
117
+ s.push(a);
118
+ }
119
+ n(s, "[Raph] Pausable effect scope disposal failed.");
120
+ }
121
+ _add(e) {
122
+ if (this._disposed || this._owner.disposed)
123
+ return e.dispose(), p;
124
+ const s = { active: !0, registration: e };
125
+ return (this._registrations ?? (this._registrations = /* @__PURE__ */ new Set())).add(s), () => {
126
+ var t;
127
+ s.active && (s.active = !1, (t = this._registrations) == null || t.delete(s), e.dispose());
128
+ };
129
+ }
130
+ _assertAlive() {
131
+ if (this._disposed || this._owner.disposed)
132
+ throw new u("[Raph] Pausable effect scope is disposed.");
133
+ }
134
+ _addChild(e) {
135
+ (this._children ?? (this._children = /* @__PURE__ */ new Set())).add(e);
136
+ }
137
+ _changeAncestorPause(e) {
138
+ if (this._disposed)
139
+ return;
140
+ const s = this.paused;
141
+ if (this._ancestorPauses += e, this._ancestorPauses < 0)
142
+ throw this._ancestorPauses = 0, new Error("[Raph] Effect scope ancestor pause state is unbalanced.");
143
+ if (s === this.paused)
144
+ return;
145
+ const t = [];
146
+ for (const i of this._registrations ?? [])
147
+ try {
148
+ this.paused ? i.registration.pause() : i.registration.resume();
149
+ } catch (h) {
150
+ t.push(h);
151
+ }
152
+ for (const i of this._children ?? [])
153
+ try {
154
+ i._changeAncestorPause(e);
155
+ } catch (h) {
156
+ t.push(h);
157
+ }
158
+ n(t, "[Raph] Pausable effect scope ancestor transition failed.");
159
+ }
160
+ }
161
+ function n(r, e) {
162
+ if (r.length === 1)
163
+ throw r[0];
164
+ if (r.length > 1)
165
+ throw new AggregateError(r, e);
166
+ }
167
+ function p() {
168
+ }
169
+ export {
170
+ _ as RaphEffectScope
171
+ };
@@ -0,0 +1 @@
1
+ "use strict";var b=Object.defineProperty;var y=(o,h,e)=>h in o?b(o,h,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[h]=e;var l=(o,h,e)=>y(o,typeof h!="symbol"?h+"":h,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../errors.cjs"),w=require("./RaphScope.cjs"),v=require("./throwDisposalErrors.cjs");let g=0;const _=Symbol("RaphProvisionalNode");class c extends w.RaphScope{constructor(e,t={},r,i){const s=r??(e instanceof c?e.runtime:e??void 0);if(s===void 0)throw new Error("[RaphNode] A root node requires an explicit runtime.");const n=e instanceof c?e:(e==null?void 0:e.root)??null;if(n!==null&&n.runtime!==s)throw new a.RaphCrossRuntimeError("[Raph] Parent belongs to another runtime.");n==null||n._assertAlive();const d=t.priority??0;p(d);super(t.id??`node-${g++}`,s);l(this,"priority");l(this,"_parent");l(this,"_children",[]);l(this,"_published");l(this,"api");l(this,"meta");l(this,"type");l(this,"_subtreeSourceIdentity",Object.freeze({}));this.priority=d,this._parent=n,this.meta={...t.meta},this.type=t.type??"default",this.api=Object.freeze({});const f=i===_;if(this._published=n===null||!f&&n._published,n!==null){const m=n._children.length;if(n._children.push(this),!this._published)return;s._notifyNodeStructure(this,{node:this,newIndex:m,newParent:n},[],u(this)),this._assertAlive()}}get node(){return this}get parent(){return this._parent}get children(){return this._children}addChild(e){if(this._assertAlive(),e._assertAlive(),e.runtime!==this.runtime)throw new a.RaphCrossRuntimeError("[Raph] Child belongs to another runtime.");if(this===e)throw new Error("[Raph] A node cannot become its own ancestor.");if(!e._published||!this._published)throw new Error("[Raph] A provisional node cannot be reparented before setup commits.");for(let t=this;t!==null;t=t.parent)if(t===e)throw new Error("[Raph] A node cannot become its own ancestor.");return e.parent===this?!0:this.runtime._runNodeMutation(()=>{this.runtime._assertNodeReparentAllowed(e,this);const t=u(e),r=e._parent,i=r==null?void 0:r._children.indexOf(e);r!==null&&i!==void 0&&i>=0&&r._children.splice(i,1),e._parent=this;const s=this._children.length;return this._children.push(e),this.runtime._notifyNodeStructure(e,{node:e,...r===null?{}:{oldParent:r},...i===void 0||i<0?{}:{oldIndex:i},newParent:this,newIndex:s},t,u(e)),!0})}reorderChildren(e){if(this._assertAlive(),e.length!==this._children.length||new Set(e).size!==e.length)throw new Error("[Raph] Child order must contain every direct child exactly once.");for(const t of e)if(t._assertAlive(),t._parent!==this)throw new Error("[Raph] Child order can contain only direct children of the node.");this.runtime._runNodeMutation(()=>{const t=new Map(this._children.map((r,i)=>[r,i]));this._children.splice(0,this._children.length,...e);for(let r=0;r<e.length;r++){const i=e[r],s=t.get(i);if(s===r)continue;const n=u(i);this.runtime._notifyNodeStructure(i,{node:i,oldParent:this,newParent:this,oldIndex:s,newIndex:r},n,n)}})}options(e){this._assertAlive(),e.meta!==void 0&&(this.meta={...e.meta}),e.priority!==void 0&&(p(e.priority),this.priority=e.priority),e.type!==void 0&&(this.type=e.type),this.touch(Object.freeze({options:Object.freeze({...e})}))}touch(e){this._assertAlive(),this.runtime._runNodeMutation(()=>this.runtime._notifyNodeTouch(this,e))}remove(){this.dispose()}dispose(){if(this._disposed||this._disposing)return;this._disposing=!0,this.runtime._beginOwnerDisposal();const e=[];try{for(const s of[...this._children])try{s.dispose()}catch(n){e.push(n)}this._children.length=0;const t=this._parent,r=u(this),i=t==null?void 0:t._children.indexOf(this);if(t!==null&&i!==void 0&&i>=0&&t._children.splice(i,1),this._parent=null,this._published)try{this.runtime._notifyNodeStructure(this,{node:this,...t===null?{}:{oldParent:t},...i===void 0||i<0?{}:{oldIndex:i}},r,[])}catch(s){e.push(s)}try{super.dispose()}catch(s){e.push(s)}this._published=!1;try{this.runtime._releaseNode(this)}catch(s){e.push(s)}}finally{try{this.runtime._endOwnerDisposal()}catch(t){e.push(t)}}v.throwDisposalErrors(e,`[Raph] Node "${this.id}" disposal failed.`)}_setApi(e){const t=typeof e=="object"&&e!==null?Object.freeze(e):e;Object.defineProperty(this,"api",{configurable:!1,enumerable:!0,value:t,writable:!1})}_publishCreation(){if(this._published)return;const e=this._parent;if(e===null||!e._published)return;this._published=!0;const t=e._children.indexOf(this);try{this.runtime._notifyNodeStructure(this,{node:this,newIndex:t,newParent:e},[],u(this));for(const r of this._children)r._publishCreation()}catch(r){throw this._published=!1,r}}_isPublished(){return this._published}}function N(o,h,e){return new c(o,h,e,_)}function u(o){const h=[];for(let e=o;e!==null;e=e.parent)h.push(e);return h}function p(o){if(!Number.isFinite(o))throw new TypeError("[Raph] Node priority must be finite.")}exports.RaphNode=c;exports.createProvisionalNode=N;