@raphy-js/dom 0.0.0-stage → 1.0.0-dev.88

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 (175) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +187 -2
  3. package/dist/DOMBlueprintMaterializer-C-icNhvm.cjs +1 -0
  4. package/dist/DOMBlueprintMaterializer-CxzM_TX5.js +201 -0
  5. package/dist/FullDOMOperations-BOlf0_0L.js +2781 -0
  6. package/dist/FullDOMOperations-Dschwj33.cjs +1 -0
  7. package/dist/api/renderer.d.ts +12 -0
  8. package/dist/applicationIdentity-CHbuUlsE.cjs +1 -0
  9. package/dist/applicationIdentity-DjVgpsQq.js +11 -0
  10. package/dist/bind-BEmkQdaL.cjs +1 -0
  11. package/dist/bind-OakIMWpC.js +52 -0
  12. package/dist/binding/DOMValueWriter.d.ts +59 -0
  13. package/dist/binding/materializeComponentProps.d.ts +38 -0
  14. package/dist/binding/mountDOMBinding.d.ts +9 -0
  15. package/dist/binding/mountDOMProps.d.ts +22 -0
  16. package/dist/capture.cjs +1 -0
  17. package/dist/capture.d.ts +7 -0
  18. package/dist/capture.js +166 -0
  19. package/dist/channels-Bs8GHVWn.cjs +1 -0
  20. package/dist/channels-DqAQt-NH.js +33 -0
  21. package/dist/compact/hydration.cjs +1 -0
  22. package/dist/compact/hydration.d.ts +9 -0
  23. package/dist/compact/hydration.js +12 -0
  24. package/dist/compact/index.d.ts +19 -0
  25. package/dist/compact/targetRuntime.d.ts +1 -0
  26. package/dist/compact.cjs +1 -0
  27. package/dist/compact.js +34 -0
  28. package/dist/contracts/freezeGeneratedContract.d.ts +5 -0
  29. package/dist/contracts/manifest.json +25 -0
  30. package/dist/contracts/node.cjs +1 -0
  31. package/dist/contracts/node.contract.json +36889 -0
  32. package/dist/contracts/node.d.ts +6 -0
  33. package/dist/contracts/node.js +19 -0
  34. package/dist/contracts/stylesheet.cjs +1 -0
  35. package/dist/contracts/stylesheet.contract.json +11887 -0
  36. package/dist/contracts/stylesheet.d.ts +6 -0
  37. package/dist/contracts/stylesheet.js +22 -0
  38. package/dist/createDOMDataEventInput-B82pnIav.cjs +1 -0
  39. package/dist/createDOMDataEventInput-BDX50jhu.js +3010 -0
  40. package/dist/createDOMNodeRuntime-BHcsbeO1.cjs +1 -0
  41. package/dist/createDOMNodeRuntime-DIKOUQP7.js +3006 -0
  42. package/dist/createHydrationRenderer-C7srF-66.js +289 -0
  43. package/dist/createHydrationRenderer-DKybWTj4.cjs +1 -0
  44. package/dist/elementRef-D8Ir8tXA.cjs +1 -0
  45. package/dist/elementRef-YPBBElV9.js +32 -0
  46. package/dist/event/DOMEventHub.d.ts +303 -0
  47. package/dist/freezeGeneratedContract-0EZt85o4.js +10 -0
  48. package/dist/freezeGeneratedContract-g_Op1hGY.cjs +1 -0
  49. package/dist/hydration/HydrationEvents.d.ts +20 -0
  50. package/dist/hydration/HydrationSession.d.ts +107 -0
  51. package/dist/hydration/HydrationStream.d.ts +30 -0
  52. package/dist/hydration/activateHydration.d.ts +2 -0
  53. package/dist/hydration/createHydrationRenderer.d.ts +25 -0
  54. package/dist/hydration/index.d.ts +8 -0
  55. package/dist/hydration.cjs +1 -0
  56. package/dist/hydration.js +12 -0
  57. package/dist/index.cjs +1 -0
  58. package/dist/index.d.ts +22 -0
  59. package/dist/index.js +24 -0
  60. package/dist/interaction/clipboard.d.ts +2 -0
  61. package/dist/interaction/contextAction.d.ts +3 -0
  62. package/dist/interaction/contracts/node.cjs +1 -0
  63. package/dist/interaction/contracts/node.d.ts +15 -0
  64. package/dist/interaction/contracts/node.js +60 -0
  65. package/dist/interaction/dragDrop.d.ts +13 -0
  66. package/dist/interaction/focus.d.ts +4 -0
  67. package/dist/interaction/geometry.d.ts +39 -0
  68. package/dist/interaction/hover.d.ts +4 -0
  69. package/dist/interaction/index.d.ts +2 -0
  70. package/dist/interaction/interaction.d.ts +4 -0
  71. package/dist/interaction/internal/DOMInputModality.d.ts +20 -0
  72. package/dist/interaction/internal/DOMInteraction.types.d.ts +29 -0
  73. package/dist/interaction/internal/applicationIdentity.d.ts +3 -0
  74. package/dist/interaction/internal/dragDataTransfer.d.ts +4 -0
  75. package/dist/interaction/internal/solvePosition.d.ts +5 -0
  76. package/dist/interaction/keyboard.d.ts +3 -0
  77. package/dist/interaction/move.d.ts +3 -0
  78. package/dist/interaction/nativeDragDrop.d.ts +18 -0
  79. package/dist/interaction/outside.d.ts +3 -0
  80. package/dist/interaction/press.d.ts +3 -0
  81. package/dist/interaction/profile.cjs +1 -0
  82. package/dist/interaction/profile.d.ts +2 -0
  83. package/dist/interaction/profile.js +48 -0
  84. package/dist/interaction/rovingFocus.d.ts +4 -0
  85. package/dist/interaction/runtime.d.ts +7 -0
  86. package/dist/interaction/textEditing.d.ts +4 -0
  87. package/dist/interaction.cjs +1 -0
  88. package/dist/interaction.js +1603 -0
  89. package/dist/internal/dev.d.ts +20 -0
  90. package/dist/motion/channels.d.ts +5 -0
  91. package/dist/motion/index.d.ts +8 -0
  92. package/dist/motion-scroll/index.d.ts +19 -0
  93. package/dist/motion-scroll.cjs +1 -0
  94. package/dist/motion-scroll.js +169 -0
  95. package/dist/motion.cjs +1 -0
  96. package/dist/motion.js +187 -0
  97. package/dist/operations.cjs +1 -0
  98. package/dist/operations.d.ts +3 -0
  99. package/dist/operations.js +10 -0
  100. package/dist/profile/DOMProfile.d.ts +4 -0
  101. package/dist/profile/index.d.ts +1 -0
  102. package/dist/profile.cjs +1 -0
  103. package/dist/profile.js +23 -0
  104. package/dist/renderer/DOMEffectScope.d.ts +13 -0
  105. package/dist/renderer/DOMPresentation.d.ts +8 -0
  106. package/dist/renderer/DOMRenderer.d.ts +35 -0
  107. package/dist/renderer/DOMRenderer.types.d.ts +12 -0
  108. package/dist/renderer/DOMRendererExtension.types.d.ts +33 -0
  109. package/dist/renderer/DOMRuntimeProfile.d.ts +15 -0
  110. package/dist/renderer/DOMTargetRuntime.d.ts +1 -0
  111. package/dist/renderer/createDOMTargetRuntime.d.ts +3 -0
  112. package/dist/renderer/installAuxiliaryViews.d.ts +8 -0
  113. package/dist/renderer/installDOMRendererExtensions.d.ts +10 -0
  114. package/dist/renderer/resolveDOMMountTarget.d.ts +7 -0
  115. package/dist/renderer-4Wbid5nE.js +30 -0
  116. package/dist/renderer-DHK3lLG-.cjs +1 -0
  117. package/dist/resolveDOMMountTarget-C75JWc5x.cjs +1 -0
  118. package/dist/resolveDOMMountTarget-D944H05N.js +19 -0
  119. package/dist/runtime.cjs +1 -0
  120. package/dist/runtime.d.ts +21 -0
  121. package/dist/runtime.js +25 -0
  122. package/dist/serialization.cjs +1 -0
  123. package/dist/serialization.d.ts +4 -0
  124. package/dist/serialization.js +118 -0
  125. package/dist/stylesheet/DOMStyleManager.d.ts +95 -0
  126. package/dist/stylesheet/DOMStyleReferenceName.d.ts +2 -0
  127. package/dist/stylesheet/DOMStylesheetRuntime.d.ts +25 -0
  128. package/dist/stylesheet/acquireInstanceStylesheets.d.ts +4 -0
  129. package/dist/stylesheet/scopeDOMSelector.d.ts +2 -0
  130. package/dist/stylesheet/serializeDOMStyleValue.d.ts +3 -0
  131. package/dist/targetRuntime-C67QmOgE.cjs +1 -0
  132. package/dist/targetRuntime-C_OdmS5w.js +5 -0
  133. package/dist/template/AdvancedDOMMaterializer.d.ts +14 -0
  134. package/dist/template/AsyncDOMMaterializer.d.ts +4 -0
  135. package/dist/template/BoundaryDOMMaterializer.d.ts +10 -0
  136. package/dist/template/DOMHostPlan.d.ts +4 -0
  137. package/dist/template/DOMNode.types.d.ts +192 -0
  138. package/dist/template/DOMNodeRuntime.d.ts +1 -0
  139. package/dist/template/binding/DOMBinding.types.d.ts +44 -0
  140. package/dist/template/binding/bind.d.ts +16 -0
  141. package/dist/template/blueprint/DOMBlueprintAddressing.d.ts +23 -0
  142. package/dist/template/blueprint/DOMBlueprintMaterializer.d.ts +3 -0
  143. package/dist/template/blueprint/DOMBlueprintMaterializer.types.d.ts +15 -0
  144. package/dist/template/blueprint/DOMHostBlueprint.d.ts +102 -0
  145. package/dist/template/blueprint/DOMHostBlueprintCache.d.ts +86 -0
  146. package/dist/template/blueprint/createDOMDataEventInput.d.ts +5 -0
  147. package/dist/template/blueprint/mountDOMHostBlueprint.d.ts +45 -0
  148. package/dist/template/createDOMNodeRuntime.d.ts +3 -0
  149. package/dist/template/each/mountEach.d.ts +5 -0
  150. package/dist/template/each/mountPureEach.d.ts +22 -0
  151. package/dist/template/error/DOMInvocation.d.ts +58 -0
  152. package/dist/template/error/DOMOperationError.d.ts +25 -0
  153. package/dist/template/html/DOMRawHtmlNode.types.d.ts +21 -0
  154. package/dist/template/html/rawHtml.d.ts +5 -0
  155. package/dist/template/keep-alive/DOMKeepAliveNode.types.d.ts +10 -0
  156. package/dist/template/keep-alive/keepAlive.d.ts +4 -0
  157. package/dist/template/mount/DOMMountTransaction.d.ts +63 -0
  158. package/dist/template/mountNode.d.ts +173 -0
  159. package/dist/template/normalizeChildren.d.ts +5 -0
  160. package/dist/template/operations/DOMOperations.d.ts +56 -0
  161. package/dist/template/operations/FullDOMOperations.d.ts +6 -0
  162. package/dist/template/page/DOMHead.d.ts +7 -0
  163. package/dist/template/page/PageNodePlan.d.ts +31 -0
  164. package/dist/template/ref/DOMElementRef.types.d.ts +7 -0
  165. package/dist/template/ref/componentRefGuard.d.ts +6 -0
  166. package/dist/template/ref/elementRef.d.ts +9 -0
  167. package/dist/template/structural/range/DOMRange.d.ts +145 -0
  168. package/dist/template/teleport/DOMTeleportNode.types.d.ts +8 -0
  169. package/dist/template/teleport/teleport.d.ts +4 -0
  170. package/dist/template/transition/DOMTransitionCoordinator.d.ts +32 -0
  171. package/dist/template/transition/DOMTransitionNode.types.d.ts +30 -0
  172. package/dist/template/transition/transition.d.ts +4 -0
  173. package/dist/template/value/DOMValueDescriptor.types.d.ts +34 -0
  174. package/dist/template/value/valueDescriptors.d.ts +13 -0
  175. package/package.json +157 -4
@@ -0,0 +1,2781 @@
1
+ import { E as Yt, l as Xt, t as Jt, u as Qt, v as St, i as Ye, x as Zt, y as xt, n as Tt, q as Ne, z as ot, A as et, B as en, C as tn, F as ht, G as Re, I as he, h as Te, g as Me, J as $e, a as Ae, K as Le, L as mt, M as nn, H as on, N as rn, e as vt, r as sn, s as an, c as cn, O as ln, P as un, k as yt, Q as dn, R as fn, S as pn } from "./createDOMDataEventInput-BDX50jhu.js";
2
+ import { dynamic as hn, text as mn, isNodeDynamicValue as vn, getComponentModelListenerMetadata as yn, RegionOutletBlock as wn, getComponentSlotStyleScope as gn, RaphEffectScope as wt, BranchBlock as _t, waitForOwnedPromise as bn, node as On, KeyedListBlock as Ct } from "@raphy-js/core";
3
+ import { i as En } from "./bind-OakIMWpC.js";
4
+ const Bt = 1, It = 2, At = 4, rt = 8, Lt = 16, Pt = 32, kn = /* @__PURE__ */ new Set([
5
+ "a",
6
+ "b",
7
+ "div",
8
+ "em",
9
+ "footer",
10
+ "h1",
11
+ "h2",
12
+ "h3",
13
+ "h4",
14
+ "h5",
15
+ "h6",
16
+ "header",
17
+ "i",
18
+ "li",
19
+ "main",
20
+ "ol",
21
+ "p",
22
+ "section",
23
+ "span",
24
+ "strong",
25
+ "table",
26
+ "tbody",
27
+ "td",
28
+ "th",
29
+ "thead",
30
+ "tr",
31
+ "ul"
32
+ ]);
33
+ class Mn {
34
+ /**
35
+ * Назначает все поля в одном порядке.
36
+ */
37
+ constructor(t, n, r, a) {
38
+ this.definition = t, this.supported = n, this.slots = r, this.kinds = a;
39
+ }
40
+ }
41
+ class tt {
42
+ /**
43
+ * Назначает все поля в одном порядке, чтобы экземпляры разделяли одну форму объекта.
44
+ */
45
+ constructor(t, n) {
46
+ this.definition = t, this.kind = "host-blueprint", this.values = n;
47
+ }
48
+ }
49
+ tt._shapeAnchor = new tt(void 0, []);
50
+ const gt = /* @__PURE__ */ new WeakMap();
51
+ let nt;
52
+ function Dn(e) {
53
+ const t = nt;
54
+ if (t !== void 0 && t.definition === e)
55
+ return t;
56
+ let n = gt.get(e);
57
+ return n === void 0 && (n = Ht(e), gt.set(e, n)), nt = n, n;
58
+ }
59
+ function Nn() {
60
+ nt = void 0;
61
+ }
62
+ function Ht(e) {
63
+ const t = /* @__PURE__ */ new Map(), n = it(e.root, e.slotCount, t), r = n ? [...t.keys()].sort((a, s) => a - s) : [];
64
+ return new Mn(
65
+ e,
66
+ n,
67
+ r,
68
+ r.map((a) => t.get(a))
69
+ );
70
+ }
71
+ function Ut(e, t) {
72
+ const n = e.slots, r = e.kinds;
73
+ for (let a = 0; a < n.length; a++) {
74
+ const s = t[n[a]], u = r[a];
75
+ if ((u & rt) !== 0 && typeof s != "function" || (u & Pt) !== 0 && typeof s != "function" && s !== null && s !== void 0 || (u & At) !== 0 && typeof s != "string" && typeof s != "number" || (u & Bt) !== 0 && !In(s) || (u & It) !== 0 && !Ot(s) || (u & Lt) !== 0 && (!Ot(s) || vn(s)))
76
+ return !1;
77
+ }
78
+ return !0;
79
+ }
80
+ function go(e, t) {
81
+ const n = Dn(e);
82
+ if (!n.supported)
83
+ return;
84
+ const r = [...t], a = Ut(n, r);
85
+ if (Ye && Rn(e, r) !== a)
86
+ throw new Error("[RaphyDOM] Host blueprint slot kinds do not match its definition.");
87
+ if (!a)
88
+ return;
89
+ const s = new tt(e, Ye ? Object.freeze(r) : r);
90
+ return Ye ? Object.freeze(s) : s;
91
+ }
92
+ function Rn(e, t) {
93
+ const n = Ht(e);
94
+ return n.supported && Ut(n, t);
95
+ }
96
+ function Sn(e) {
97
+ return it(e.root, e.slotCount, null);
98
+ }
99
+ function bo(e) {
100
+ const t = (n) => {
101
+ const r = n.inputs.length === 0 ? Yt : {};
102
+ for (const s of n.inputs) {
103
+ if (s.kind === "literal") {
104
+ r[s.name] = s.value;
105
+ continue;
106
+ }
107
+ const u = e.values[s.slot];
108
+ r[s.name] = s.mode === "dynamic" ? hn(u) : s.mode === "event" ? Xt(u, s.options) : s.mode === "data-event" ? Jt(u, s.options, e.values[s.data]) : u;
109
+ }
110
+ const a = n.children.map((s) => {
111
+ if (s.kind === "host")
112
+ return t(s);
113
+ if (s.kind === "text")
114
+ return s.value;
115
+ const u = e.values[s.slot];
116
+ return s.mode === "reactive" ? mn(u) : u;
117
+ });
118
+ return {
119
+ children: Qt(a),
120
+ kind: "element",
121
+ props: r,
122
+ ref: null,
123
+ tag: n.nodeKind
124
+ };
125
+ };
126
+ return t(e.definition.root);
127
+ }
128
+ function Tn(e) {
129
+ return typeof e == "object" && e !== null && "kind" in e && e.kind === "text" && "read" in e && typeof e.read == "function";
130
+ }
131
+ function it(e, t, n) {
132
+ if (!kn.has(e.nodeKind))
133
+ return !1;
134
+ const r = /* @__PURE__ */ new Set();
135
+ for (const a of e.inputs) {
136
+ if (r.has(a.name) || !An(a.name))
137
+ return !1;
138
+ if (r.add(a.name), a.kind === "literal") {
139
+ if (!Ln(a.name, a.value))
140
+ return !1;
141
+ continue;
142
+ }
143
+ const s = _n(a.name, a.mode, a.options);
144
+ if (s === 0 || !bt(a.slot, s, t, n) || (a.mode === "data-event" ? !zt(a.data, t) : a.data !== void 0))
145
+ return !1;
146
+ }
147
+ for (const a of e.children)
148
+ if (a.kind !== "text") {
149
+ if (a.kind === "text-slot") {
150
+ const s = Cn(a.mode);
151
+ if (s === 0 || !bt(a.slot, s, t, n))
152
+ return !1;
153
+ } else if (!it(a, t, n))
154
+ return !1;
155
+ }
156
+ return !0;
157
+ }
158
+ function _n(e, t, n) {
159
+ switch (t) {
160
+ case void 0:
161
+ return It;
162
+ case "dynamic":
163
+ return rt;
164
+ case "value":
165
+ return Lt;
166
+ case "event":
167
+ case "data-event":
168
+ return St(e) && Bn(n) ? Pt : 0;
169
+ default:
170
+ return 0;
171
+ }
172
+ }
173
+ function Cn(e) {
174
+ switch (e) {
175
+ case void 0:
176
+ return Bt;
177
+ case "static":
178
+ return At;
179
+ case "reactive":
180
+ return rt;
181
+ default:
182
+ return 0;
183
+ }
184
+ }
185
+ function Bn(e) {
186
+ if (e === void 0)
187
+ return !0;
188
+ if (typeof e != "object" || e === null)
189
+ return !1;
190
+ const t = e;
191
+ return !(t.passive === !0 && t.prevent === !0);
192
+ }
193
+ function bt(e, t, n, r) {
194
+ return zt(e, n) ? (r?.set(e, (r.get(e) ?? 0) | t), !0) : !1;
195
+ }
196
+ function zt(e, t) {
197
+ return Number.isInteger(e) && e >= 0 && e < t;
198
+ }
199
+ function In(e) {
200
+ return typeof e == "string" || typeof e == "number" || Tn(e);
201
+ }
202
+ function Ot(e) {
203
+ return typeof e == "function" ? yn(e) === null : typeof e != "object" || e === null ? !0 : !En(e) && !Zt(e);
204
+ }
205
+ function An(e) {
206
+ return e === "data-r-scope" || e === "data-r-slotted" || e === "ref" ? !1 : e === "class" || e === "id" || e === "role" || e === "title" || e === "href" || e === "style" || e.startsWith("data-") || e.startsWith("aria-") || St(e);
207
+ }
208
+ function Ln(e, t) {
209
+ return e === "class" || e === "id" || e === "role" || e === "title" ? typeof t == "string" || t === null : !!(e.startsWith("data-") || e.startsWith("aria-"));
210
+ }
211
+ const Pn = 0, st = 1, Ke = 2, at = 3, ct = 4, lt = 5, ut = 6, dt = 7, qe = 2;
212
+ function Hn(e) {
213
+ const t = Un(e), n = [], r = [], a = [void 0, void 0];
214
+ let s = [];
215
+ for (const u of e) {
216
+ let M = s, S = -1, B = We(s, u);
217
+ for (let q = 0; q < qe; q++) {
218
+ const ae = a[q];
219
+ ae !== void 0 && We(ae, u) < B && (B = We(ae, u), M = ae, S = q === 0 ? lt : dt);
220
+ }
221
+ We([], u) < B && (M = [], S = Pn), S !== -1 && n.push(S), zn(n, M, u, t, a), r.push(n.length), s = u;
222
+ }
223
+ return { steps: n, stepEnds: r };
224
+ }
225
+ function Un(e) {
226
+ const t = /* @__PURE__ */ new Set();
227
+ for (let n = 1; n < e.length; n++) {
228
+ const r = e[n - 1], a = ft(r, e[n]);
229
+ if (a === r.length)
230
+ continue;
231
+ const s = a + 1 <= qe ? a + 1 : a;
232
+ s >= 1 && s <= qe && t.add(Wt(r, s));
233
+ }
234
+ return t;
235
+ }
236
+ function zn(e, t, n, r, a) {
237
+ const s = ft(t, n);
238
+ let u = s;
239
+ if (s < t.length) {
240
+ for (let M = t.length - 1; M > s; M--)
241
+ e.push(at);
242
+ for (let M = t[s]; M < n[s]; M++)
243
+ e.push(Ke);
244
+ u = s + 1, Et(e, n, u, r, a);
245
+ }
246
+ for (; u < n.length; ) {
247
+ e.push(st);
248
+ for (let M = n[u]; M > 0; M--)
249
+ e.push(Ke);
250
+ u++, Et(e, n, u, r, a);
251
+ }
252
+ }
253
+ function Et(e, t, n, r, a) {
254
+ n > qe || !r.has(Wt(t, n)) || (e.push(n === 1 ? ct : ut), a[n - 1] = t.slice(0, n));
255
+ }
256
+ function We(e, t) {
257
+ const n = ft(e, t);
258
+ let r = 0, a = n;
259
+ if (n < e.length) {
260
+ if (n >= t.length || t[n] < e[n])
261
+ return Number.POSITIVE_INFINITY;
262
+ r = e.length - n - 1 + t[n] - e[n], a = n + 1;
263
+ }
264
+ for (; a < t.length; a++)
265
+ r += 1 + t[a];
266
+ return r;
267
+ }
268
+ function ft(e, t) {
269
+ let n = 0;
270
+ for (; n < e.length && n < t.length && e[n] === t[n]; )
271
+ n++;
272
+ return n;
273
+ }
274
+ function Wt(e, t) {
275
+ return e.slice(0, t).join(",");
276
+ }
277
+ const Pe = 0, pt = 1, Ft = 2, Wn = 3, Xe = 0, Je = 1, kt = 2;
278
+ class Oo {
279
+ // Document, в котором создаются prototypes и их клоны, и источник native event names.
280
+ _document;
281
+ _eventNames;
282
+ _applicationScopeId;
283
+ // Prototype и программа одной definition отдельно для каждого style scope.
284
+ _prepared;
285
+ // Последняя выданная форма: строки одного списка получают её без lookup.
286
+ _lastDefinition;
287
+ _lastStyleScopeId;
288
+ _lastPrepared;
289
+ /**
290
+ * Создаёт пустой cache одного renderer instance.
291
+ */
292
+ constructor(t, n, r) {
293
+ this._document = t, this._eventNames = n, this._applicationScopeId = r, this._prepared = /* @__PURE__ */ new WeakMap(), this._lastDefinition = void 0, this._lastStyleScopeId = void 0, this._lastPrepared = void 0;
294
+ }
295
+ // ---------------------------------------------
296
+ // PUBLIC API
297
+ // ---------------------------------------------
298
+ /**
299
+ * Возвращает подготовленную форму, создавая её при первом обращении.
300
+ */
301
+ get(t, n) {
302
+ const r = this._lastPrepared;
303
+ return r !== void 0 && t === this._lastDefinition && n === this._lastStyleScopeId ? r : this._resolve(t, n);
304
+ }
305
+ /** Creates one literal instance directly, without retaining or cloning its DOM. */
306
+ materializeLiteral(t, n) {
307
+ if (t.slotCount !== 0)
308
+ throw new TypeError("[RaphyDOM] Direct literal materialization requires a zero-slot host blueprint.");
309
+ return this._prepare(t, n).prototype;
310
+ }
311
+ /**
312
+ * Освобождает prototypes вместе с renderer, который ими владеет.
313
+ *
314
+ * Вместе с ними забывается и общая для module запись последней проверенной
315
+ * definition: после освобождения renderer его формы ничто не удерживает.
316
+ * Живой renderer держит definition и prototype последней выданной формы до
317
+ * следующей формы либо до собственного освобождения.
318
+ */
319
+ dispose() {
320
+ this._prepared = /* @__PURE__ */ new WeakMap(), this._lastDefinition = void 0, this._lastStyleScopeId = void 0, this._lastPrepared = void 0, Nn();
321
+ }
322
+ // ---------------------------------------------
323
+ // PRIVATE
324
+ // ---------------------------------------------
325
+ /**
326
+ * Находит форму в cache renderer либо подготавливает её и запоминает как последнюю.
327
+ */
328
+ _resolve(t, n) {
329
+ let r = this._prepared.get(t), a = r?.get(n);
330
+ return a === void 0 && (a = this._prepare(t, n), r === void 0 && (r = /* @__PURE__ */ new Map(), this._prepared.set(t, r)), r.set(n, a)), this._lastDefinition = t, this._lastStyleScopeId = n, this._lastPrepared = a, a;
331
+ }
332
+ /**
333
+ * Создаёт prototype и программу slots проверенной формы и сверяет их между собой.
334
+ */
335
+ _prepare(t, n) {
336
+ if (!Sn(t))
337
+ throw new TypeError("[RaphyDOM] Host blueprint definition cannot be cloned; its plan must come from hostBlueprint().");
338
+ const r = {
339
+ dataSlots: [],
340
+ eventNames: [],
341
+ kinds: [],
342
+ modes: [],
343
+ names: [],
344
+ options: [],
345
+ paths: [],
346
+ slots: []
347
+ }, a = this._prepareHost(t.root, n, [], r), s = Hn(r.paths), u = {
348
+ prototype: a,
349
+ kinds: r.kinds,
350
+ modes: r.modes,
351
+ slots: r.slots,
352
+ names: r.names,
353
+ eventNames: r.eventNames,
354
+ options: r.options,
355
+ dataSlots: r.dataSlots,
356
+ steps: s.steps,
357
+ stepEnds: s.stepEnds,
358
+ getters: Mt(r.modes, Je),
359
+ undeclared: Mt(r.modes, Xe)
360
+ };
361
+ return Vn(u, r.paths), u;
362
+ }
363
+ /**
364
+ * Создаёт element одного host с literal inputs и добавляет записи его slots.
365
+ */
366
+ _prepareHost(t, n, r, a) {
367
+ const s = this._document.createElement(t.nodeKind);
368
+ n !== void 0 && s.setAttribute("data-r-scope", n), this._applicationScopeId !== void 0 && s.setAttribute("data-r-scope", [n, this._applicationScopeId].filter(Boolean).join(" "));
369
+ for (const u of t.inputs) {
370
+ if (u.kind === "literal") {
371
+ jn(s, u.name, u.value);
372
+ continue;
373
+ }
374
+ const M = u.mode === void 0 ? Xe : u.mode === "dynamic" ? Je : kt, S = xt(s, u.name, null);
375
+ S === "class" ? Fe(a, r, pt, M, u.slot, u.name, "", void 0, -1) : S === "listener" ? Fe(
376
+ a,
377
+ r,
378
+ Ft,
379
+ M,
380
+ u.slot,
381
+ u.name,
382
+ this._eventNames.resolveEventName(u.name),
383
+ // Options объявляют только modes 'event' и 'data-event'; запись хранит
384
+ // замороженный record самой definition, общий для всех экземпляров.
385
+ u.mode === "event" || u.mode === "data-event" ? u.options : void 0,
386
+ // Data объявляет только mode 'data-event': handler такой записи общий
387
+ // для экземпляров и получает значение этого slot первым аргументом.
388
+ u.mode === "data-event" ? u.data : -1
389
+ ) : Fe(a, r, Wn, M, u.slot, u.name, "", void 0, -1);
390
+ }
391
+ for (let u = 0; u < t.children.length; u++) {
392
+ const M = t.children[u];
393
+ r.push(u), M.kind === "host" ? s.appendChild(this._prepareHost(M, n, r, a)) : M.kind === "text" ? s.appendChild(this._document.createTextNode(M.value)) : (s.appendChild(this._document.createTextNode("")), Fe(
394
+ a,
395
+ r,
396
+ Pe,
397
+ M.mode === void 0 ? Xe : M.mode === "reactive" ? Je : kt,
398
+ M.slot,
399
+ "",
400
+ "",
401
+ void 0,
402
+ -1
403
+ )), r.pop();
404
+ }
405
+ return s;
406
+ }
407
+ }
408
+ function Fn(e, t) {
409
+ let n = e;
410
+ for (let r = 0; r < t.length; r++) {
411
+ let a = n.firstChild;
412
+ for (let s = t[r]; s > 0 && a !== null; s--)
413
+ a = a.nextSibling;
414
+ if (a === null)
415
+ throw new Error("[RaphyDOM] Host blueprint clone does not match its definition.");
416
+ n = a;
417
+ }
418
+ return n;
419
+ }
420
+ function Mt(e, t) {
421
+ let n = 0;
422
+ for (const r of e)
423
+ r === t && n++;
424
+ return n;
425
+ }
426
+ function Fe(e, t, n, r, a, s, u, M, S) {
427
+ e.kinds.push(n), e.modes.push(r), e.slots.push(a), e.names.push(s), e.eventNames.push(u), e.options.push(M), e.dataSlots.push(S), e.paths.push([...t]);
428
+ }
429
+ function Vn(e, t) {
430
+ const { kinds: n, prototype: r, stepEnds: a, steps: s } = e;
431
+ let u = r, M = r, S = r, B = 0;
432
+ for (let q = 0; q < n.length; q++) {
433
+ const ae = a[q];
434
+ for (; B < ae && u !== null; )
435
+ switch (s[B++]) {
436
+ case st:
437
+ u = u.firstChild;
438
+ break;
439
+ case Ke:
440
+ u = u.nextSibling;
441
+ break;
442
+ case at:
443
+ u = u.parentNode;
444
+ break;
445
+ case ct:
446
+ M = u;
447
+ break;
448
+ case lt:
449
+ u = M;
450
+ break;
451
+ case ut:
452
+ S = u;
453
+ break;
454
+ case dt:
455
+ u = S;
456
+ break;
457
+ default:
458
+ u = r;
459
+ }
460
+ const le = n[q];
461
+ if (u === null || u !== Fn(r, t[q]) || u.nodeType !== (le === Pe ? 3 : 1) || le === pt && u.hasAttribute("class"))
462
+ throw new Error("[RaphyDOM] Host blueprint program does not match its prototype.");
463
+ }
464
+ }
465
+ function jn(e, t, n) {
466
+ if (n === null)
467
+ return;
468
+ const r = t === "class" ? Tt(n) : String(n);
469
+ (t !== "class" || r.length !== 0) && e.setAttribute(t, r);
470
+ }
471
+ function $n(e, t, n, r, a, s, u) {
472
+ const M = Ne(e.ownerDocument);
473
+ if (M?.owns(e)) {
474
+ const B = e, q = e;
475
+ if ((t === "checked" ? B.checked !== B.defaultChecked : e.localName === "select" ? [...q.options].some(
476
+ (le) => le.selected !== le.defaultSelected
477
+ ) : B.value !== B.defaultValue) && !ot(e)) {
478
+ const le = t === "checked" ? n.mode === "option" ? B.checked ? n.options.option : n.source.peek() : B.checked : n.mode === "multiple" ? [...q.selectedOptions].map((oe) => oe.value) : n.mode === "number" ? B.value === "" || Number.isNaN(B.valueAsNumber) ? null : B.valueAsNumber : n.options.trim === !0 ? B.value.trim() : B.value;
479
+ r.runtime.action("@raphy-js/dom:adopt-control", () => n.source.set(le))(), M.controlsChanged = !0;
480
+ }
481
+ }
482
+ const S = {
483
+ binding: n,
484
+ element: e,
485
+ eventHub: s,
486
+ effectScope: a,
487
+ handleError: u,
488
+ owner: r,
489
+ property: t
490
+ };
491
+ if (t === "value") {
492
+ Kn(S);
493
+ return;
494
+ }
495
+ if (t === "checked") {
496
+ qn(S);
497
+ return;
498
+ }
499
+ throw new TypeError(
500
+ `[RaphyDOM] bind() cannot control DOM property "${t}".`
501
+ );
502
+ }
503
+ function Kn(e) {
504
+ const { binding: t, element: n } = e;
505
+ if (n instanceof HTMLSelectElement) {
506
+ if (t.mode === "multiple") {
507
+ Jn(e, n);
508
+ return;
509
+ }
510
+ if (He(t, "auto", "select value"), n.multiple)
511
+ throw new TypeError(
512
+ "[RaphyDOM] Multiple select requires bind(source, { multiple: true })."
513
+ );
514
+ Qe(e, n, "change");
515
+ return;
516
+ }
517
+ if (n instanceof HTMLTextAreaElement) {
518
+ He(t, "auto", "textarea value"), Qe(e, n, "input");
519
+ return;
520
+ }
521
+ if (!(n instanceof HTMLInputElement))
522
+ throw new TypeError(
523
+ "[RaphyDOM] value bind() requires input, textarea, or select."
524
+ );
525
+ if (n.type === "file")
526
+ throw new TypeError(
527
+ "[RaphyDOM] File input value cannot be controlled by bind()."
528
+ );
529
+ if (n.type === "checkbox" || n.type === "radio")
530
+ throw new TypeError(
531
+ `[RaphyDOM] Input type "${n.type}" must bind checked, not value.`
532
+ );
533
+ if (t.mode === "number") {
534
+ if (n.type !== "number" && n.type !== "range")
535
+ throw new TypeError(
536
+ '[RaphyDOM] Number bind() requires input type "number" or "range".'
537
+ );
538
+ Gn(e, n);
539
+ return;
540
+ }
541
+ He(t, "auto", "input value"), Qe(e, n, "input");
542
+ }
543
+ function qn(e) {
544
+ const { binding: t, element: n } = e;
545
+ if (!(n instanceof HTMLInputElement))
546
+ throw new TypeError("[RaphyDOM] checked bind() requires an input element.");
547
+ if (n.type === "checkbox") {
548
+ He(t, "auto", "checkbox checked"), Yn(e, n);
549
+ return;
550
+ }
551
+ if (n.type === "radio") {
552
+ He(t, "option", "radio checked"), Xn(e, n);
553
+ return;
554
+ }
555
+ throw new TypeError(
556
+ `[RaphyDOM] Input type "${n.type}" cannot bind checked.`
557
+ );
558
+ }
559
+ function Qe(e, t, n) {
560
+ const r = Vt(e.binding, n), a = e.binding.options.trim === !0;
561
+ if (a && t instanceof HTMLSelectElement)
562
+ throw new TypeError("[RaphyDOM] Select binding does not accept trim.");
563
+ let s = Ne(t.ownerDocument) !== void 0 && ot(t);
564
+ const u = Ue(e, () => {
565
+ const S = e.binding.source.get();
566
+ if (typeof S != "string")
567
+ throw new TypeError(
568
+ "[RaphyDOM] Text binding source must contain a string."
569
+ );
570
+ !s && t.value !== S && $t(t, S);
571
+ }), M = () => {
572
+ u() && e.binding.source.set(a ? t.value.trim() : t.value);
573
+ };
574
+ if (r === "input" && !(t instanceof HTMLSelectElement)) {
575
+ De(e, "compositionstart", () => {
576
+ s = !0;
577
+ }), De(e, "compositionend", () => {
578
+ s = !1, M();
579
+ }), De(e, r, (S) => {
580
+ !s && !jt(S) && M();
581
+ });
582
+ return;
583
+ }
584
+ De(e, r, M);
585
+ }
586
+ function Gn(e, t) {
587
+ const n = Vt(e.binding, "input");
588
+ let r = Ne(t.ownerDocument) !== void 0 && ot(t);
589
+ const a = Ue(e, () => {
590
+ const u = e.binding.source.get();
591
+ if (u !== null && (typeof u != "number" || !Number.isFinite(u)))
592
+ throw new TypeError(
593
+ "[RaphyDOM] Number binding source must contain a finite number or null."
594
+ );
595
+ if (t.type === "range" && u === null)
596
+ throw new TypeError(
597
+ "[RaphyDOM] Range binding source cannot contain null."
598
+ );
599
+ const M = u === null ? "" : String(u);
600
+ !r && t.value !== M && $t(t, M);
601
+ }), s = () => {
602
+ if (!a())
603
+ return;
604
+ const u = t.value === "" || Number.isNaN(t.valueAsNumber) ? null : t.valueAsNumber;
605
+ e.binding.source.set(u);
606
+ };
607
+ if (n === "input") {
608
+ De(e, "compositionstart", () => {
609
+ r = !0;
610
+ }), De(e, "compositionend", () => {
611
+ r = !1, s();
612
+ }), De(e, n, (u) => {
613
+ !r && !jt(u) && s();
614
+ });
615
+ return;
616
+ }
617
+ De(e, n, s);
618
+ }
619
+ function Yn(e, t) {
620
+ const n = Ue(e, () => {
621
+ const r = e.binding.source.get();
622
+ if (typeof r != "boolean")
623
+ throw new TypeError(
624
+ "[RaphyDOM] Checkbox binding source must contain a boolean."
625
+ );
626
+ t.checked !== r && (t.checked = r);
627
+ });
628
+ De(e, "change", () => {
629
+ n() && e.binding.source.set(t.checked);
630
+ });
631
+ }
632
+ function Xn(e, t) {
633
+ const n = e.binding.options.option;
634
+ let r = Ne(t.ownerDocument)?.owns(t) === !0 && !t.checked && t.defaultChecked;
635
+ const a = Ue(e, () => {
636
+ const s = Object.is(e.binding.source.get(), n);
637
+ if (r) {
638
+ r = !1;
639
+ return;
640
+ }
641
+ t.checked !== s && (t.checked = s);
642
+ });
643
+ De(e, "change", () => {
644
+ a() && t.checked && e.binding.source.set(n);
645
+ });
646
+ }
647
+ function Jn(e, t) {
648
+ if (!t.multiple)
649
+ throw new TypeError(
650
+ "[RaphyDOM] Multiple binding requires select with multiple: true."
651
+ );
652
+ const n = Ue(e, () => {
653
+ const r = e.binding.source.get();
654
+ xn(r);
655
+ const a = new Set(r);
656
+ for (const s of t.options) {
657
+ const u = a.has(s.value);
658
+ s.selected !== u && (s.selected = u);
659
+ }
660
+ });
661
+ De(e, "change", () => {
662
+ n() && e.binding.source.set(
663
+ Object.freeze(
664
+ Array.from(t.selectedOptions, (r) => r.value)
665
+ )
666
+ );
667
+ });
668
+ }
669
+ function Ue(e, t) {
670
+ let n = !1;
671
+ const r = (a) => {
672
+ if (a) {
673
+ n = !0;
674
+ return;
675
+ }
676
+ try {
677
+ t();
678
+ } catch (s) {
679
+ if (!e.handleError(s, `element-bind:${e.property}`))
680
+ throw s;
681
+ }
682
+ };
683
+ try {
684
+ et(
685
+ e.effectScope,
686
+ e.binding.source,
687
+ (a) => {
688
+ r(
689
+ a.causes.some(
690
+ (s) => Qn(s, e.binding.source)
691
+ )
692
+ );
693
+ },
694
+ { initial: "sync" }
695
+ );
696
+ } catch (a) {
697
+ if (!Zn(a))
698
+ throw a;
699
+ en(
700
+ e.effectScope,
701
+ () => r(!1),
702
+ tn
703
+ );
704
+ }
705
+ return () => !n;
706
+ }
707
+ function Qn(e, t) {
708
+ return e.source === t && e.kind === "structure" && typeof e.metadata == "object" && e.metadata !== null && Reflect.get(e.metadata, "disposed") === !0;
709
+ }
710
+ function Zn(e) {
711
+ return e instanceof TypeError && e.message === "[Raph] Unsupported or ownerless granular watch source.";
712
+ }
713
+ function De(e, t, n) {
714
+ e.eventHub.createInternalWriter(
715
+ e.element,
716
+ t,
717
+ e.owner,
718
+ (a) => e.handleError(
719
+ a,
720
+ `element-bind:${e.property}:${t}`
721
+ )
722
+ ).write(n);
723
+ }
724
+ function He(e, t, n) {
725
+ if (e.mode !== t)
726
+ throw new TypeError(
727
+ `[RaphyDOM] ${n} does not support bind() mode "${e.mode}".`
728
+ );
729
+ }
730
+ function xn(e) {
731
+ if (!Array.isArray(e) || e.some((t) => typeof t != "string"))
732
+ throw new TypeError(
733
+ "[RaphyDOM] Multiple select binding source must contain a string array."
734
+ );
735
+ }
736
+ function Vt(e, t) {
737
+ const n = e.options.event;
738
+ return n === "change" || n === "input" ? n : t;
739
+ }
740
+ function jt(e) {
741
+ return Reflect.get(e, "isComposing") === !0;
742
+ }
743
+ function $t(e, t) {
744
+ if (e instanceof HTMLSelectElement) {
745
+ e.value = t;
746
+ return;
747
+ }
748
+ const r = e.ownerDocument.activeElement === e, a = r ? e.selectionStart : null, s = r ? e.selectionEnd : null, u = r ? e.selectionDirection : null;
749
+ if (e.value = t, !(a === null || s === null))
750
+ try {
751
+ e.setSelectionRange(
752
+ Math.min(a, t.length),
753
+ Math.min(s, t.length),
754
+ u ?? void 0
755
+ );
756
+ } catch {
757
+ }
758
+ }
759
+ class eo {
760
+ _incoming = null;
761
+ _leaves = /* @__PURE__ */ new Set();
762
+ /** Регистрирует последний materialized transition как входящую ветку. */
763
+ register(t) {
764
+ this._incoming = t;
765
+ }
766
+ /** Убирает завершившийся/отменённый enter из роли входящей ветки. */
767
+ completeEnter(t) {
768
+ this._incoming === t && (this._incoming = null);
769
+ }
770
+ /** Для out-in ждёт все уже начатые leave одной structural boundary. */
771
+ waitBeforeEnter(t) {
772
+ return t.mode !== "out-in" || this._leaves.size === 0 ? null : Promise.all([...this._leaves]).then(() => {
773
+ });
774
+ }
775
+ /** Для in-out удерживает старый inert range до завершения нового enter. */
776
+ waitBeforeLeave(t) {
777
+ const n = this._incoming;
778
+ return n !== null && n !== t && n.mode === "in-out" ? n.entered : null;
779
+ }
780
+ /** Делает leave видимым для последующего out-in enter. */
781
+ trackLeave(t) {
782
+ this._leaves.add(t), t.finally(() => this._leaves.delete(t));
783
+ }
784
+ }
785
+ const Dt = /* @__PURE__ */ new WeakMap();
786
+ function to(e, t) {
787
+ let n = e;
788
+ for (; n !== null && n.type !== "raphy-branch-block"; )
789
+ n = n.parent;
790
+ if (n === null)
791
+ return null;
792
+ let r = Dt.get(n);
793
+ r === void 0 && (r = /* @__PURE__ */ new Map(), Dt.set(n, r));
794
+ let a = r.get(t);
795
+ return a === void 0 && (a = new eo(), r.set(t, a)), a;
796
+ }
797
+ function no(e) {
798
+ const { componentInstances: t, MountContext: n, rethrowUnhandledDOMOperationError: r, mountChildren: a, rangeElements: s, mountComponent: u, removeDOMOutputWithOutcome: M, registerHydratingEffect: S, ownDOMOutput: B, runMountTransaction: q, runTemplateOperation: ae, captureDOMError: le, scheduleUnhandledAsyncError: oe } = e;
799
+ function h(i, o) {
800
+ const l = he.anchored(o.env.document, "raphy:teleport"), d = typeof i.target == "string" ? o.env.document.querySelector(i.target) : i.target;
801
+ if (d === null)
802
+ throw new Error(
803
+ `[RaphyDOM] Teleport target "${String(i.target)}" was not found.`
804
+ );
805
+ if (d.ownerDocument !== o.env.document)
806
+ throw new Error(
807
+ "[RaphyDOM] Teleport target must belong to the application document."
808
+ );
809
+ const w = o.env.eventHub.retainBoundary(d);
810
+ o.ownerNode.own(w);
811
+ const y = o.env.styleManager.retainBoundary(d);
812
+ o.ownerNode.own(y);
813
+ const p = o.env.styleManager.createValueBoundary(
814
+ o.env.styleValues,
815
+ !0
816
+ );
817
+ try {
818
+ p.refresh(), Le(
819
+ o.effectScope,
820
+ () => {
821
+ try {
822
+ p.refresh();
823
+ } catch (x) {
824
+ r(
825
+ o,
826
+ x,
827
+ "style-value-scope-update"
828
+ );
829
+ }
830
+ },
831
+ { initial: "scheduled" }
832
+ );
833
+ const C = Ne(o.env.document), Y = C?.portal(d, l.first), X = () => a(
834
+ i.content,
835
+ new n(
836
+ {
837
+ ...o.env,
838
+ namespace: re(d),
839
+ styleValueBoundary: p
840
+ },
841
+ o.effectScope,
842
+ o.ownerNode,
843
+ o.transaction
844
+ ),
845
+ "raphy:teleport:content"
846
+ ), j = Y === void 0 ? X() : Y.run(X);
847
+ return Y !== void 0 && (Y.remaining(), C.track(Y.ready())), j.onRemoved(() => p.dispose()), o.ownerNode.disposed || (l.adopt(j), (Y === void 0 || j.parentNode !== d) && j.moveBefore(d, null)), l;
848
+ } catch (C) {
849
+ throw p.dispose(), C;
850
+ }
851
+ }
852
+ function T(i, o) {
853
+ const l = a(i.content, o, "raphy:transition");
854
+ if (o.ownerNode.disposed)
855
+ return l;
856
+ const d = () => {
857
+ const m = typeof i.options.name == "function" ? i.options.name() : i.options.name ?? "raphy";
858
+ if (typeof m != "string" || m.trim().length === 0)
859
+ throw new TypeError(
860
+ "[RaphyDOM] Dynamic transition name must not be empty."
861
+ );
862
+ return m;
863
+ }, w = to(
864
+ o.ownerNode,
865
+ d()
866
+ );
867
+ let y;
868
+ const C = {
869
+ entered: new Promise((m) => {
870
+ y = m;
871
+ }),
872
+ mode: i.options.mode ?? "simultaneous"
873
+ };
874
+ w?.register(C);
875
+ let Y = !1, X = !1, j = !1, x = null;
876
+ const N = () => {
877
+ X || (X = !0, w?.completeEnter(C), y());
878
+ };
879
+ queueMicrotask(() => {
880
+ if (o.ownerNode.disposed || l.parentNode === null)
881
+ return;
882
+ const m = w?.waitBeforeEnter(C) ?? null, A = l.parentNode, I = l.last.nextSibling;
883
+ if (m !== null) {
884
+ const g = o.env.document.createDocumentFragment();
885
+ l.moveBefore(g, null);
886
+ }
887
+ const W = () => {
888
+ if (o.ownerNode.disposed || l.parentNode === null) {
889
+ N();
890
+ return;
891
+ }
892
+ if (m !== null) {
893
+ if (I !== null && I.parentNode !== A) {
894
+ N();
895
+ return;
896
+ }
897
+ l.moveBefore(A, I);
898
+ }
899
+ Y = !0;
900
+ const g = s(l), E = d();
901
+ if (D(g)) {
902
+ $(
903
+ o,
904
+ i.options.beforeEnter,
905
+ g,
906
+ "transition-before-enter"
907
+ ), $(
908
+ o,
909
+ i.options.afterEnter,
910
+ g,
911
+ "transition-after-enter"
912
+ ), N();
913
+ return;
914
+ }
915
+ $(
916
+ o,
917
+ i.options.beforeEnter,
918
+ g,
919
+ "transition-before-enter"
920
+ ), de(
921
+ g,
922
+ [`${E}-enter-from`, `${E}-enter-active`],
923
+ []
924
+ );
925
+ let k = !1;
926
+ x = () => {
927
+ k || (k = !0, ne(g, E, "enter"), j && $(
928
+ o,
929
+ i.options.enterCancelled,
930
+ g,
931
+ "transition-enter-cancelled"
932
+ ), N());
933
+ }, F(() => {
934
+ if (k)
935
+ return;
936
+ de(
937
+ g,
938
+ [`${E}-enter-to`],
939
+ [`${E}-enter-from`]
940
+ );
941
+ const K = V(
942
+ g,
943
+ i.options.duration,
944
+ "enter"
945
+ );
946
+ G(K, () => {
947
+ k || (ne(g, E, "enter"), k = !0, x = null, $(
948
+ o,
949
+ i.options.afterEnter,
950
+ g,
951
+ "transition-after-enter"
952
+ ), N());
953
+ });
954
+ });
955
+ };
956
+ m === null ? W() : m.then(W);
957
+ }), l.setMoveHandler(() => {
958
+ const m = s(l);
959
+ if (m.length === 0 || D(m))
960
+ return;
961
+ const A = d();
962
+ $(
963
+ o,
964
+ i.options.beforeMove,
965
+ m,
966
+ "transition-before-move"
967
+ ), de(m, [`${A}-move`], []), G(
968
+ V(m, i.options.duration, "move"),
969
+ () => {
970
+ de(m, [], [`${A}-move`]), $(
971
+ o,
972
+ i.options.afterMove,
973
+ m,
974
+ "transition-after-move"
975
+ );
976
+ }
977
+ );
978
+ });
979
+ let U = null;
980
+ return l.setRemovalHandler(
981
+ (m) => {
982
+ if (j = x !== null, x?.(), x = null, !Y) {
983
+ j = !0, N(), m();
984
+ return;
985
+ }
986
+ const A = l.parentNode;
987
+ if (A === null) {
988
+ m();
989
+ return;
990
+ }
991
+ l.moveBefore(A, null);
992
+ const I = s(l), W = d();
993
+ ie(I);
994
+ let g, E = !1;
995
+ const k = new Promise((me) => {
996
+ g = me;
997
+ }), K = () => {
998
+ E || (E = !0, g());
999
+ }, se = () => {
1000
+ if (!E) {
1001
+ if ($(
1002
+ o,
1003
+ i.options.beforeLeave,
1004
+ I,
1005
+ "transition-before-leave"
1006
+ ), D(I)) {
1007
+ m(), $(
1008
+ o,
1009
+ i.options.afterLeave,
1010
+ I,
1011
+ "transition-after-leave"
1012
+ ), K();
1013
+ return;
1014
+ }
1015
+ de(
1016
+ I,
1017
+ [`${W}-leave-from`, `${W}-leave-active`],
1018
+ []
1019
+ ), F(() => {
1020
+ E || (de(
1021
+ I,
1022
+ [`${W}-leave-to`],
1023
+ [`${W}-leave-from`]
1024
+ ), G(
1025
+ V(I, i.options.duration, "leave"),
1026
+ () => {
1027
+ E || (ne(I, W, "leave"), m(), $(
1028
+ o,
1029
+ i.options.afterLeave,
1030
+ I,
1031
+ "transition-after-leave"
1032
+ ), K());
1033
+ }
1034
+ ));
1035
+ });
1036
+ }
1037
+ };
1038
+ U = () => {
1039
+ E || (ne(I, W, "leave"), $(
1040
+ o,
1041
+ i.options.leaveCancelled,
1042
+ I,
1043
+ "transition-leave-cancelled"
1044
+ ), K());
1045
+ }, w?.trackLeave(k);
1046
+ const fe = w?.waitBeforeLeave(C) ?? null;
1047
+ fe === null ? se() : fe.then(se);
1048
+ },
1049
+ () => {
1050
+ j = x !== null, x?.(), x = null, N(), U?.(), U = null;
1051
+ }
1052
+ ), l;
1053
+ }
1054
+ function z(i, o) {
1055
+ const l = he.anchored(o.env.document, "raphy:keep-alive"), d = o.ownerNode.runtime.node(
1056
+ {
1057
+ parent: o.ownerNode,
1058
+ type: "raphy-keep-alive-cache"
1059
+ },
1060
+ () => {
1061
+ }
1062
+ ), w = o.effectScope instanceof wt ? o.effectScope.fork(d) : new wt(d), y = [];
1063
+ let p = null, C = 0;
1064
+ const Y = (N) => {
1065
+ ce(N.node, !0, (U) => o.env.host.deactivateComponent(U)), N.scope.pause(), N.output.moveBefore(N.parked, null);
1066
+ }, X = (N, U = !0) => {
1067
+ U && N.output.moveBefore(l.parentNode, l.last), N.scope.resume(), ce(N.node, !1, (m) => o.env.host.activateComponent(m)), N.lastUsed = ++C;
1068
+ }, j = () => {
1069
+ if (i.max !== void 0)
1070
+ for (; y.length > i.max; ) {
1071
+ const N = y.filter((m) => m !== p);
1072
+ if (N.length === 0)
1073
+ return;
1074
+ let U = N[0];
1075
+ for (const m of N.slice(1))
1076
+ m.lastUsed < U.lastUsed && (U = m);
1077
+ y.splice(y.indexOf(U), 1), U.output.remove(!0), U.node.dispose();
1078
+ }
1079
+ }, x = (N, U) => {
1080
+ const m = d.runtime.node(
1081
+ {
1082
+ parent: d,
1083
+ type: "raphy-keep-alive-entry"
1084
+ },
1085
+ () => {
1086
+ }
1087
+ );
1088
+ let A;
1089
+ try {
1090
+ const I = w.fork(m);
1091
+ A = o.transaction.open ? o.transaction : new nn();
1092
+ const W = u(
1093
+ {
1094
+ definition: N,
1095
+ kind: "component",
1096
+ props: i.component.props,
1097
+ ref: i.component.ref,
1098
+ slots: i.component.slots,
1099
+ view: null
1100
+ },
1101
+ new n(o.env, I, m, A)
1102
+ );
1103
+ m._ownCompletedCleanup(
1104
+ () => M(
1105
+ W,
1106
+ o.env.host,
1107
+ o.env.ownerComponent,
1108
+ !0
1109
+ )
1110
+ ), l.adopt(W);
1111
+ const g = A !== o.transaction;
1112
+ g && W.moveBefore(l.parentNode, l.last);
1113
+ const E = g ? A.commit(o.env.host) : void 0, k = {
1114
+ definition: N,
1115
+ key: U,
1116
+ lastUsed: ++C,
1117
+ node: m,
1118
+ output: W,
1119
+ parked: o.env.document.createDocumentFragment(),
1120
+ scope: I
1121
+ };
1122
+ return y.push(k), { entry: k, completion: E, inserted: g };
1123
+ } catch (I) {
1124
+ const W = A?.open && A !== o.transaction ? A.abortAndTakeCompleted(I) : void 0;
1125
+ let g;
1126
+ try {
1127
+ m.dispose();
1128
+ } catch (E) {
1129
+ g = { error: E };
1130
+ }
1131
+ if (W !== void 0) {
1132
+ const E = g === void 0 ? W : {
1133
+ prior: W.prior,
1134
+ interrupted: {
1135
+ error: new AggregateError(
1136
+ [W.interrupted.error, g.error],
1137
+ "[RaphyDOM] Keep-alive materialization and cleanup failed."
1138
+ )
1139
+ }
1140
+ };
1141
+ mt(E, (k) => r(
1142
+ o,
1143
+ k,
1144
+ "keep-alive-update",
1145
+ !0
1146
+ ));
1147
+ }
1148
+ throw g !== void 0 ? I instanceof Me || I instanceof Te ? new Me(
1149
+ new AggregateError(
1150
+ [
1151
+ I instanceof Me ? I.error : I.captured.report.error,
1152
+ g.error
1153
+ ],
1154
+ "[RaphyDOM] Keep-alive materialization and cleanup failed."
1155
+ )
1156
+ ) : new AggregateError(
1157
+ [I, g.error],
1158
+ "[RaphyDOM] Keep-alive materialization and cleanup failed."
1159
+ ) : I;
1160
+ }
1161
+ };
1162
+ return d._ownCompletedCleanup(() => {
1163
+ const N = [];
1164
+ for (const m of y.splice(0)) {
1165
+ const A = M(
1166
+ m.output,
1167
+ o.env.host,
1168
+ o.env.ownerComponent,
1169
+ !0
1170
+ );
1171
+ A !== void 0 && N.push(A);
1172
+ }
1173
+ p = null;
1174
+ const U = M(
1175
+ l,
1176
+ o.env.host,
1177
+ o.env.ownerComponent,
1178
+ !0
1179
+ );
1180
+ return U !== void 0 && N.push(U), Q(
1181
+ N,
1182
+ "[RaphyDOM] Keep-alive cache cleanup failed."
1183
+ );
1184
+ }), S(
1185
+ l,
1186
+ o,
1187
+ w,
1188
+ () => {
1189
+ let N;
1190
+ try {
1191
+ const U = i.component.readDefinition(), m = i.component.key();
1192
+ if (U == null) {
1193
+ p !== null && (Y(p), p = null);
1194
+ return;
1195
+ }
1196
+ if (p?.definition === U && Object.is(p.key, m)) {
1197
+ p.lastUsed = ++C;
1198
+ return;
1199
+ }
1200
+ const A = y.find(
1201
+ (g) => g.definition === U && Object.is(g.key, m)
1202
+ ), I = A === void 0 ? d.runtime.untracked(() => x(U, m)) : void 0, W = A ?? I.entry;
1203
+ N = I?.completion, N?.interrupted !== void 0 ? (y.splice(y.indexOf(W), 1), W.node.dispose()) : (p !== null && Y(p), p = W, X(W, !I?.inserted), j());
1204
+ } catch (U) {
1205
+ if (N === void 0) {
1206
+ r(
1207
+ o,
1208
+ U,
1209
+ "keep-alive-update"
1210
+ );
1211
+ return;
1212
+ }
1213
+ N = {
1214
+ prior: N.prior,
1215
+ interrupted: {
1216
+ error: N.interrupted === void 0 ? U : new AggregateError(
1217
+ [N.interrupted.error, U],
1218
+ "[RaphyDOM] Keep-alive mount and rollback failed."
1219
+ )
1220
+ }
1221
+ };
1222
+ }
1223
+ N !== void 0 && mt(N, (U) => r(
1224
+ o,
1225
+ U,
1226
+ "keep-alive-update",
1227
+ !0
1228
+ ));
1229
+ },
1230
+ { initial: "sync" }
1231
+ ), l;
1232
+ }
1233
+ function Q(i, o) {
1234
+ if (i.length === 0)
1235
+ return;
1236
+ if (i.length === 1)
1237
+ return i[0];
1238
+ const l = i.map((p) => p.error), d = i.flatMap(
1239
+ (p) => p.completed === void 0 ? [] : [p.completed.error]
1240
+ ), w = i.some((p) => p.hasUnrouted), y = new AggregateError(l, o);
1241
+ return {
1242
+ error: y,
1243
+ hasUnrouted: w,
1244
+ ...d.length === 0 ? {} : {
1245
+ completed: {
1246
+ error: w ? d.length === 1 ? d[0] : new AggregateError(d, o) : y
1247
+ }
1248
+ }
1249
+ };
1250
+ }
1251
+ function _(i, o) {
1252
+ const l = o.env.ownerComponent.findRegion(i.identity);
1253
+ if (l === void 0) {
1254
+ const p = typeof i.identity == "string" ? i.identity : i.identity.id;
1255
+ throw new Error(
1256
+ `[RaphyDOM] Contribution "${String(i.key)}" has no ancestor Region "${p}".`
1257
+ );
1258
+ }
1259
+ const d = ht(i.props, (p) => o.ownerNode.computed(p)), w = l.register(
1260
+ o.env.ownerComponent,
1261
+ o.ownerNode,
1262
+ i.key,
1263
+ d.initial,
1264
+ i.order(),
1265
+ i.render,
1266
+ i.templates
1267
+ ), y = he.anchored(o.env.document, "raphy:contribution");
1268
+ B(w.node, y, o);
1269
+ for (const p of d.bindings)
1270
+ et(
1271
+ o.effectScope,
1272
+ p.source,
1273
+ () => {
1274
+ try {
1275
+ w.updateProps(p.source.get(), p.replace);
1276
+ } catch (C) {
1277
+ r(
1278
+ o,
1279
+ C,
1280
+ "contribution-props-update"
1281
+ );
1282
+ }
1283
+ },
1284
+ { initial: "scheduled" }
1285
+ );
1286
+ return Le(
1287
+ o.effectScope,
1288
+ () => {
1289
+ try {
1290
+ w.updateOrder(i.order());
1291
+ } catch (p) {
1292
+ r(
1293
+ o,
1294
+ p,
1295
+ "contribution-order-update"
1296
+ );
1297
+ }
1298
+ },
1299
+ { initial: "scheduled" }
1300
+ ), y;
1301
+ }
1302
+ function Z(i, o) {
1303
+ const l = o.env.ownerComponent.getDeclaredRegion(i.identity);
1304
+ if (l === void 0) {
1305
+ const X = typeof i.identity == "string" ? i.identity : i.identity.id;
1306
+ throw new Error(`[RaphyDOM] Component does not declare Region "${X}".`);
1307
+ }
1308
+ const d = ht(i.context, (X) => o.ownerNode.computed(X)), w = new wn(
1309
+ o.ownerNode,
1310
+ l,
1311
+ d.initial
1312
+ ), y = Re(o.effectScope, w.node), p = he.anchored(o.env.document, "raphy:region"), C = /* @__PURE__ */ new Map(), Y = /* @__PURE__ */ new WeakSet();
1313
+ w.node._ownCompletedCleanup(() => {
1314
+ const X = [];
1315
+ for (const x of C.values())
1316
+ if (!x.node.disposed) {
1317
+ const N = x.node._disposeForOwner();
1318
+ N !== void 0 && X.push(N);
1319
+ }
1320
+ C.clear();
1321
+ const j = M(
1322
+ p,
1323
+ o.env.host,
1324
+ o.env.ownerComponent
1325
+ );
1326
+ return j !== void 0 && X.push(j), Q(
1327
+ X,
1328
+ "[RaphyDOM] Region outlet cleanup failed."
1329
+ );
1330
+ });
1331
+ for (const X of d.bindings)
1332
+ et(
1333
+ y,
1334
+ X.source,
1335
+ () => {
1336
+ try {
1337
+ w.updateContext(X.source.get(), X.replace);
1338
+ } catch (j) {
1339
+ r(
1340
+ o,
1341
+ j,
1342
+ "region-context-update"
1343
+ );
1344
+ }
1345
+ },
1346
+ { initial: "scheduled" }
1347
+ );
1348
+ return S(
1349
+ p,
1350
+ o,
1351
+ y,
1352
+ () => {
1353
+ const X = { unhandled: null };
1354
+ try {
1355
+ const j = l.entries();
1356
+ q(o, "region-reconcile", (x) => {
1357
+ w.node.runtime.untracked(() => {
1358
+ const N = new Set(j.map((m) => m.node));
1359
+ for (const [m, A] of C)
1360
+ (!N.has(m) || m.disposed) && (C.delete(m), A.node.disposed || A.node.dispose());
1361
+ for (const m of j) {
1362
+ if (C.has(m.node) || Y.has(m.node) || m.node.disposed)
1363
+ continue;
1364
+ let A;
1365
+ if (m.node.runtime.node(
1366
+ {
1367
+ parent: m.node,
1368
+ type: "raphy-region-contribution-render"
1369
+ },
1370
+ (W) => {
1371
+ A = W;
1372
+ }
1373
+ ), A === void 0)
1374
+ throw new Error(
1375
+ "[RaphyDOM] Region contribution render owner was not created."
1376
+ );
1377
+ const I = m.sourceComponent;
1378
+ try {
1379
+ const W = A, g = Object.freeze({
1380
+ ...i.templates,
1381
+ ...m.templates
1382
+ }), E = Object.freeze({
1383
+ contribution: m.props,
1384
+ key: m.key,
1385
+ region: w.context,
1386
+ templates: g
1387
+ }), k = m.render ?? i.render, K = gn(k) ?? o.env.styleScopeId, se = new n(
1388
+ {
1389
+ ...o.env,
1390
+ componentRoot: !0,
1391
+ ownerComponent: I,
1392
+ styleScopeId: K
1393
+ },
1394
+ W,
1395
+ A,
1396
+ x
1397
+ ), fe = a(
1398
+ ae(
1399
+ o.env.targetRuntime,
1400
+ K,
1401
+ () => k(E)
1402
+ ),
1403
+ se,
1404
+ "raphy:region:contribution"
1405
+ );
1406
+ if (A.disposed)
1407
+ return;
1408
+ B(A, fe, se), C.set(m.node, {
1409
+ node: A,
1410
+ output: fe
1411
+ }), p.adopt(fe), fe.moveBefore(p.parentNode, p.last);
1412
+ } catch (W) {
1413
+ if (W instanceof Te) {
1414
+ try {
1415
+ A.dispose();
1416
+ } catch (k) {
1417
+ throw new Me(
1418
+ new AggregateError(
1419
+ [W.captured.report.error, k],
1420
+ "[RaphyDOM] Region materialization and cleanup failed."
1421
+ )
1422
+ );
1423
+ }
1424
+ if (Y.add(m.node), w.node.disposed)
1425
+ throw W;
1426
+ continue;
1427
+ }
1428
+ if (W instanceof Me) {
1429
+ let k = W.error;
1430
+ try {
1431
+ A.dispose();
1432
+ } catch (K) {
1433
+ k = new AggregateError(
1434
+ [k, K],
1435
+ "[RaphyDOM] Region materialization and cleanup failed."
1436
+ );
1437
+ }
1438
+ Y.add(m.node), X.unhandled = { error: k };
1439
+ return;
1440
+ }
1441
+ A.dispose(), Y.add(m.node);
1442
+ const g = $e(
1443
+ I,
1444
+ m.node,
1445
+ W,
1446
+ {
1447
+ layer: "renderer",
1448
+ operation: "region-reconcile",
1449
+ phase: Ae
1450
+ }
1451
+ ), E = o.env.host.captureError(
1452
+ g.component,
1453
+ g.owner,
1454
+ g.cause,
1455
+ g.source
1456
+ );
1457
+ if (!E.handled) {
1458
+ X.unhandled = { error: E.report.error };
1459
+ return;
1460
+ }
1461
+ if (w.node.disposed)
1462
+ return;
1463
+ }
1464
+ }
1465
+ let U = p.last;
1466
+ for (let m = j.length - 1; m >= 0; m--) {
1467
+ const A = j[m].node;
1468
+ if (A.disposed || Y.has(A))
1469
+ continue;
1470
+ const I = C.get(A);
1471
+ if (I === void 0)
1472
+ throw new Error(
1473
+ "[RaphyDOM] Region contribution is missing its DOM range."
1474
+ );
1475
+ I.output.last.nextSibling !== U && (I.output.moveBefore(p.parentNode, U), I.output.notifyMove()), U = I.output.first;
1476
+ }
1477
+ });
1478
+ });
1479
+ } catch (j) {
1480
+ r(o, j, "region-reconcile");
1481
+ }
1482
+ if (X.unhandled !== null)
1483
+ throw X.unhandled.error;
1484
+ },
1485
+ {
1486
+ initial: Ne(o.env.document) === void 0 ? "sync" : "scheduled"
1487
+ }
1488
+ ), p;
1489
+ }
1490
+ function re(i) {
1491
+ const o = "namespaceURI" in i ? i.namespaceURI : null;
1492
+ return o === "http://www.w3.org/2000/svg" ? "svg" : o === "http://www.w3.org/1998/Math/MathML" ? "mathml" : "html";
1493
+ }
1494
+ function ce(i, o, l) {
1495
+ const d = (w) => {
1496
+ const y = t.get(w);
1497
+ !o && y !== void 0 && l(y);
1498
+ for (const p of w.children)
1499
+ d(p);
1500
+ o && y !== void 0 && l(y);
1501
+ };
1502
+ d(i);
1503
+ }
1504
+ function $(i, o, l, d) {
1505
+ if (o !== void 0)
1506
+ try {
1507
+ o(Object.freeze({ elements: l }));
1508
+ } catch (w) {
1509
+ const y = le(w, i, {
1510
+ layer: "renderer",
1511
+ operation: d
1512
+ });
1513
+ y.handled || oe(y.report.error);
1514
+ }
1515
+ }
1516
+ function de(i, o, l) {
1517
+ for (const d of i)
1518
+ l.length !== 0 && d.classList.remove(...l), o.length !== 0 && d.classList.add(...o);
1519
+ }
1520
+ function ne(i, o, l) {
1521
+ de(
1522
+ i,
1523
+ [],
1524
+ [`${o}-${l}-active`, `${o}-${l}-from`, `${o}-${l}-to`]
1525
+ );
1526
+ }
1527
+ function ie(i) {
1528
+ for (const o of i)
1529
+ Reflect.set(o, "inert", !0), o.setAttribute("aria-hidden", "true"), (o instanceof HTMLElement || o instanceof SVGElement) && (o.style.pointerEvents = "none");
1530
+ }
1531
+ function D(i) {
1532
+ return i[0]?.ownerDocument.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches === !0;
1533
+ }
1534
+ function F(i) {
1535
+ if (typeof globalThis.requestAnimationFrame == "function") {
1536
+ globalThis.requestAnimationFrame(
1537
+ () => globalThis.requestAnimationFrame(i)
1538
+ );
1539
+ return;
1540
+ }
1541
+ setTimeout(i, 16);
1542
+ }
1543
+ function G(i, o) {
1544
+ i <= 0 ? queueMicrotask(o) : setTimeout(o, i);
1545
+ }
1546
+ function V(i, o, l) {
1547
+ if (typeof o == "number")
1548
+ return Math.max(0, o);
1549
+ if (o !== void 0)
1550
+ return Math.max(0, o[l] ?? 0);
1551
+ let d = 0;
1552
+ for (const w of i) {
1553
+ const y = w.ownerDocument.defaultView;
1554
+ if (y === null)
1555
+ continue;
1556
+ const p = y.getComputedStyle(w);
1557
+ d = Math.max(
1558
+ d,
1559
+ H(p.transitionDuration, p.transitionDelay),
1560
+ H(p.animationDuration, p.animationDelay)
1561
+ );
1562
+ }
1563
+ return d;
1564
+ }
1565
+ function H(i, o) {
1566
+ const l = i.split(",").map(f), d = o.split(",").map(f);
1567
+ let w = 0;
1568
+ for (let y = 0; y < l.length; y++)
1569
+ w = Math.max(
1570
+ w,
1571
+ l[y] + (d[y % d.length] ?? 0)
1572
+ );
1573
+ return w;
1574
+ }
1575
+ function f(i) {
1576
+ const o = i.trim();
1577
+ return o.endsWith("ms") ? Number.parseFloat(o) || 0 : o.endsWith("s") ? (Number.parseFloat(o) || 0) * 1e3 : 0;
1578
+ }
1579
+ return Object.freeze({ teleport: h, transition: T, keepAlive: z, contribution: _, region: Z });
1580
+ }
1581
+ function oo(e) {
1582
+ const { MountContext: t, mountChildren: n, runTemplateOperation: r, runMountTransaction: a, rethrowUnhandledDOMOperationError: s, ownDOMOutput: u, rangeElements: M, clearDOMBranchForTransaction: S, selectDOMBranch: B } = e;
1583
+ function q(oe, h) {
1584
+ const T = he.anchored(h.env.document, "raphy:client-only"), z = Ne(h.env.document);
1585
+ if (z?.owns(T.first))
1586
+ z.skip(T.first);
1587
+ else {
1588
+ const _ = n(
1589
+ r(
1590
+ h.env.targetRuntime,
1591
+ h.env.styleScopeId,
1592
+ oe.fallback
1593
+ ),
1594
+ h,
1595
+ "raphy:client-only:fallback"
1596
+ );
1597
+ T.adopt(_), _.moveBefore(T.parentNode, T.last);
1598
+ }
1599
+ const Q = bn(
1600
+ h.ownerNode,
1601
+ Promise.resolve().then(
1602
+ () => r(
1603
+ h.env.targetRuntime,
1604
+ h.env.styleScopeId,
1605
+ oe.load
1606
+ )
1607
+ )
1608
+ ).then((_) => {
1609
+ h.ownerNode.disposed || T.parentNode === null || a(h, "client-only", (Z) => {
1610
+ const re = r(
1611
+ h.env.targetRuntime,
1612
+ h.env.styleScopeId,
1613
+ () => {
1614
+ const $ = typeof _ == "object" && _ !== null && "default" in _ ? Reflect.get(_, "default") : _;
1615
+ return typeof $ == "object" && $ !== null && "template" in $ ? On($) : typeof $ == "function" ? $() : $;
1616
+ }
1617
+ ), ce = n(
1618
+ re,
1619
+ new t(
1620
+ h.env,
1621
+ h.effectScope,
1622
+ h.ownerNode,
1623
+ Z
1624
+ ),
1625
+ "raphy:client-only:content"
1626
+ );
1627
+ T.clear(), T.adopt(ce), ce.moveBefore(T.parentNode, T.last);
1628
+ });
1629
+ });
1630
+ return z === void 0 ? Q.catch((_) => {
1631
+ h.ownerNode.disposed || s(
1632
+ h,
1633
+ _,
1634
+ "client-only-load",
1635
+ !0
1636
+ );
1637
+ }) : z.track(Q), u(h.ownerNode, T, h), T;
1638
+ }
1639
+ function ae(oe, h) {
1640
+ const T = he.anchored(
1641
+ h.env.document,
1642
+ "raphy:hydration-boundary"
1643
+ ), z = Ne(h.env.document), Q = (F) => {
1644
+ const G = r(
1645
+ h.env.targetRuntime,
1646
+ h.env.styleScopeId,
1647
+ oe.content
1648
+ ), V = n(
1649
+ G,
1650
+ new t(
1651
+ h.env,
1652
+ h.effectScope,
1653
+ h.ownerNode,
1654
+ F
1655
+ ),
1656
+ "raphy:hydration-boundary:content"
1657
+ );
1658
+ T.adopt(V), V.moveBefore(T.parentNode, T.last);
1659
+ };
1660
+ if (u(h.ownerNode, T, h), z === void 0 || oe.strategy === "eager" || !z.owns(T.first))
1661
+ return Q(h.transaction), T;
1662
+ const _ = z.defer(T.first), Z = [];
1663
+ let re = !1, ce = !1;
1664
+ const $ = [], de = () => {
1665
+ for (const F of Z.splice(0))
1666
+ F();
1667
+ z.cleanups.delete(ne);
1668
+ };
1669
+ function ne() {
1670
+ ce = !0, de(), _.dispose();
1671
+ for (const F of $)
1672
+ vt(F);
1673
+ $.length = 0;
1674
+ }
1675
+ h.ownerNode.own(ne), T.onRemoved(ne), z.cleanups.add(ne);
1676
+ const ie = () => {
1677
+ if (re || ce || h.ownerNode.disposed || T.parentNode === null)
1678
+ return;
1679
+ re = !0;
1680
+ const F = (async () => {
1681
+ if (_.run(() => a(h, "hydrate-boundary", Q)), _.remaining(), await _.ready(), !ce) {
1682
+ de();
1683
+ for (const G of $.splice(0))
1684
+ h.ownerNode.disposed ? vt(G) : sn(G);
1685
+ }
1686
+ })();
1687
+ z.track(
1688
+ F.catch((G) => {
1689
+ ne(), s(
1690
+ h,
1691
+ G,
1692
+ "hydrate-boundary",
1693
+ !0
1694
+ );
1695
+ })
1696
+ );
1697
+ }, D = h.env.document.defaultView;
1698
+ if (oe.strategy === "idle")
1699
+ if (typeof D.requestIdleCallback == "function") {
1700
+ const F = D.requestIdleCallback(ie);
1701
+ Z.push(() => D.cancelIdleCallback(F));
1702
+ } else {
1703
+ const F = D.setTimeout(ie, 1);
1704
+ Z.push(() => D.clearTimeout(F));
1705
+ }
1706
+ else if (oe.strategy === "visible") {
1707
+ const F = M(T)[0];
1708
+ if (F !== void 0 && typeof D.IntersectionObserver == "function") {
1709
+ const G = new D.IntersectionObserver((V) => {
1710
+ V.some((H) => H.isIntersecting) && ie();
1711
+ });
1712
+ G.observe(F), Z.push(() => G.disconnect());
1713
+ } else {
1714
+ const G = D.setTimeout(ie, 1);
1715
+ Z.push(() => D.clearTimeout(G));
1716
+ }
1717
+ } else {
1718
+ const F = T.parentNode, G = (V) => {
1719
+ !(V.target instanceof D.Element) || ce || !M(T).some(
1720
+ (f) => f === V.target || f.contains(V.target)
1721
+ ) || (an(V), $.push(cn(V)), ie());
1722
+ };
1723
+ for (const V of on)
1724
+ F.addEventListener(V, G, !0), Z.push(() => F.removeEventListener(V, G, !0));
1725
+ }
1726
+ return T;
1727
+ }
1728
+ function le(oe, h) {
1729
+ const T = he.anchored(
1730
+ h.env.document,
1731
+ "raphy:error-boundary"
1732
+ ), z = Ne(h.env.document);
1733
+ let Q = z?.nextLabel() === "raphy:error-boundary:fallback" ? z.defer(T.first) : void 0;
1734
+ const _ = new _t(
1735
+ h.ownerNode
1736
+ ), Z = Re(h.effectScope, _.node);
1737
+ u(_.node, T, h);
1738
+ let re, ce = !1, $ = null;
1739
+ const de = () => {
1740
+ const G = $;
1741
+ return $ = null, G;
1742
+ }, ne = (G, V) => {
1743
+ if (!V.handled)
1744
+ return V;
1745
+ try {
1746
+ const H = () => a(h, "error-fallback", (f) => {
1747
+ S(
1748
+ _,
1749
+ h,
1750
+ f,
1751
+ "error-boundary-dispose"
1752
+ ), B(
1753
+ _,
1754
+ h,
1755
+ f,
1756
+ "error-fallback",
1757
+ "fallback",
1758
+ V.report,
1759
+ (i) => {
1760
+ const o = Re(Z, i.node), l = n(
1761
+ r(
1762
+ h.env.targetRuntime,
1763
+ h.env.styleScopeId,
1764
+ () => oe.fallback({
1765
+ error: V.report.error,
1766
+ report: V.report,
1767
+ reset: re
1768
+ })
1769
+ ),
1770
+ new t(
1771
+ h.env,
1772
+ o,
1773
+ i.node,
1774
+ f
1775
+ ),
1776
+ "raphy:error-boundary:fallback"
1777
+ );
1778
+ i.node.disposed || (u(i.node, l, h), T.adopt(l), l.moveBefore(T.parentNode, T.last));
1779
+ }
1780
+ );
1781
+ });
1782
+ if (Q === void 0)
1783
+ H();
1784
+ else {
1785
+ const f = Q;
1786
+ Q = void 0, f.run(H), f.remaining(), z.track(f.ready());
1787
+ }
1788
+ return V;
1789
+ } catch (H) {
1790
+ if (H instanceof Te)
1791
+ return H.captured;
1792
+ if (H instanceof Me)
1793
+ return Object.freeze({
1794
+ handled: !1,
1795
+ report: Object.freeze({
1796
+ ...V.report,
1797
+ error: H.error
1798
+ })
1799
+ });
1800
+ const f = $e(
1801
+ G.component,
1802
+ _.node,
1803
+ H,
1804
+ { layer: "renderer", operation: "error-fallback" }
1805
+ );
1806
+ return h.env.host.captureError(
1807
+ f.component,
1808
+ f.owner,
1809
+ f.cause,
1810
+ f.source
1811
+ );
1812
+ }
1813
+ }, ie = (G, V, H, f) => {
1814
+ const i = $e(G, V, H, f), o = h.env.host.captureError(
1815
+ i.component,
1816
+ i.owner,
1817
+ i.cause,
1818
+ i.source,
1819
+ { caught: !0 }
1820
+ );
1821
+ return ce && o.handled ? ($ ??= { captured: o, failure: i }, new ln(o, _.node)) : ne(i, o);
1822
+ }, D = (G) => {
1823
+ a(h, "error-boundary-content", (V) => {
1824
+ G && S(
1825
+ _,
1826
+ h,
1827
+ V,
1828
+ "error-boundary-reset"
1829
+ ), B(
1830
+ _,
1831
+ h,
1832
+ V,
1833
+ "error-boundary-content",
1834
+ "content",
1835
+ void 0,
1836
+ (H) => {
1837
+ const f = Re(Z, H.node);
1838
+ h.env.host.registerErrorBoundary(
1839
+ H.node,
1840
+ ie
1841
+ );
1842
+ const i = n(
1843
+ r(
1844
+ h.env.targetRuntime,
1845
+ h.env.styleScopeId,
1846
+ oe.content
1847
+ ),
1848
+ new t(h.env, f, H.node, V),
1849
+ "raphy:error-boundary:content"
1850
+ );
1851
+ H.node.disposed || (u(H.node, i, h), T.adopt(i), i.moveBefore(T.parentNode, T.last));
1852
+ }
1853
+ ), $ !== null && S(
1854
+ _,
1855
+ h,
1856
+ V,
1857
+ "error-boundary-dispose"
1858
+ );
1859
+ });
1860
+ }, F = (G, V = !1) => {
1861
+ let H = null;
1862
+ ce = !0;
1863
+ try {
1864
+ D(V);
1865
+ } catch (l) {
1866
+ H = { error: l };
1867
+ } finally {
1868
+ ce = !1;
1869
+ }
1870
+ let f = de();
1871
+ if (H?.error instanceof Te) {
1872
+ if (_.disposed || f === null)
1873
+ throw H.error;
1874
+ H = null;
1875
+ }
1876
+ let i = null;
1877
+ if (H?.error instanceof Me) {
1878
+ if (f === null)
1879
+ throw H.error;
1880
+ i = H.error, H = null;
1881
+ }
1882
+ if (_.disposed) {
1883
+ if (H !== null) {
1884
+ const l = H.error instanceof rn ? H.error.cause : H.error;
1885
+ if (l instanceof Me)
1886
+ throw l;
1887
+ }
1888
+ return;
1889
+ }
1890
+ if (H !== null) {
1891
+ const l = $e(
1892
+ h.env.ownerComponent,
1893
+ _.node,
1894
+ H.error,
1895
+ { layer: "renderer", operation: G }
1896
+ ), d = h.env.host.captureError(
1897
+ l.component,
1898
+ l.owner,
1899
+ l.cause,
1900
+ l.source,
1901
+ { caught: !0 }
1902
+ );
1903
+ f ??= { captured: d, failure: l };
1904
+ }
1905
+ if (f === null)
1906
+ return;
1907
+ const o = ne(f.failure, f.captured);
1908
+ if (!o.handled)
1909
+ throw new Me(
1910
+ i === null ? o.report.error : new AggregateError(
1911
+ [i.error, o.report.error],
1912
+ "[RaphyDOM] Content cleanup and error fallback failed."
1913
+ )
1914
+ );
1915
+ if (i !== null)
1916
+ throw i;
1917
+ if (_.disposed)
1918
+ throw new Te(o);
1919
+ };
1920
+ return re = () => {
1921
+ un(() => {
1922
+ F("error-boundary-reset", !0);
1923
+ });
1924
+ }, Q === void 0 ? F("error-boundary-content") : z.suspend(() => F("error-boundary-content")), T;
1925
+ }
1926
+ return Object.freeze({ mountClientOnly: q, mountHydrationBoundary: ae, mountErrorBoundary: le });
1927
+ }
1928
+ const ro = /* @__PURE__ */ new WeakMap();
1929
+ function io(e) {
1930
+ if (typeof e == "function")
1931
+ return ro.get(e)?._inspect();
1932
+ }
1933
+ const so = 0, Nt = 1, Ze = 2, Ce = [], ao = (e) => ({ parent: e, type: "raphy-keyed-list-entry" }), Ve = 16, je = Symbol("raphy.dom.each.pure.none"), Rt = Symbol("raphy.dom.each.pure.unwritten");
1934
+ function co(e, t) {
1935
+ const { captureDOMError: n, rethrowUnhandledDOMOperationError: r } = e;
1936
+ function a(S, B) {
1937
+ const q = S.rows;
1938
+ if (!(q === void 0 || !S.reactive || S.empty !== void 0 || B.namespace !== "html" || B.styleValueBoundary !== void 0 || B.hostBlueprintCache === void 0 || Ne(B.document) !== void 0))
1939
+ return q;
1940
+ }
1941
+ return function(B, q) {
1942
+ const ae = q.env, le = a(B, ae);
1943
+ if (le === void 0)
1944
+ return t(B, q);
1945
+ const oe = ae.hostBlueprintCache.prepare(le.blueprint, ae.styleScopeId);
1946
+ if (oe === void 0)
1947
+ return t(B, q);
1948
+ const h = new Ct(q.ownerNode), T = h.node, z = T.runtime.untracked(() => s(oe, le, T, q));
1949
+ return z === void 0 ? (T.dispose(), t(B, q)) : M(B, q, oe, z, h);
1950
+ };
1951
+ function s(S, B, q, ae) {
1952
+ const le = [], oe = /* @__PURE__ */ new Map();
1953
+ let h = 0;
1954
+ const T = S.kinds;
1955
+ for (let Q = 0; Q < T.length; Q++) {
1956
+ const _ = T[Q], Z = B.slots[S.slots[Q]];
1957
+ if (_ === Ft) {
1958
+ if (Z.kind !== "value")
1959
+ return;
1960
+ const re = S.options[Q];
1961
+ if (re !== void 0 && Object.keys(re).some((F) => F !== "eventless"))
1962
+ return;
1963
+ const ce = S.eventNames[Q], $ = ae.env.eventHub.normalizeRowHandler(Z.value, ce);
1964
+ if ($ === void 0)
1965
+ continue;
1966
+ const de = S.dataSlots[Q], ne = de < 0 ? void 0 : B.slots[de];
1967
+ if (ne !== void 0 && ne.kind === "selected")
1968
+ return;
1969
+ const ie = {
1970
+ path: lo(S, Q),
1971
+ handler: $,
1972
+ eventless: re?.eventless === !0,
1973
+ data: ne === void 0 ? void 0 : ne.kind === "value" ? () => ne.value === void 0 ? yt : ne.value : (F) => {
1974
+ const G = ne.read(F.item);
1975
+ return G === void 0 ? yt : G;
1976
+ }
1977
+ }, D = oe.get(ce);
1978
+ D === void 0 ? oe.set(ce, [ie]) : D.push(ie);
1979
+ continue;
1980
+ }
1981
+ if (_ !== Pe && _ !== pt)
1982
+ return;
1983
+ if (Z.kind === "selected") {
1984
+ const re = io(Z.select());
1985
+ if (re === void 0)
1986
+ return;
1987
+ le.push({ index: Q, kind: _, write: Ze, slot: Z, cell: h, selector: re, map: Z.map }), h += 2;
1988
+ continue;
1989
+ }
1990
+ if (Z.kind === "item") {
1991
+ le.push({ index: Q, kind: _, write: Nt, slot: Z, cell: h, selector: void 0, map: void 0 }), h += 2;
1992
+ continue;
1993
+ }
1994
+ le.push({ index: Q, kind: _, write: so, slot: Z, cell: -1, selector: void 0, map: void 0 });
1995
+ }
1996
+ const z = [];
1997
+ for (const [Q, _] of oe) {
1998
+ const Z = ae.env.eventHub.createRowRouter(Q, q, ae, u, _);
1999
+ if (Z === void 0)
2000
+ return;
2001
+ z.push(Z);
2002
+ }
2003
+ return { writes: le, cells: h, events: z };
2004
+ }
2005
+ function u(S, B, q) {
2006
+ return n(B, S, { layer: "renderer", operation: q, phase: Ae }).handled;
2007
+ }
2008
+ function M(S, B, q, ae, le) {
2009
+ const oe = B.env, h = oe.document, T = oe.eventHub, z = he.anchored(h, "raphy:each"), Q = le.node, _ = Q.runtime, Z = Re(B.effectScope, Q), re = ae.writes, ce = ae.events, $ = ae.cells, de = q.prototype, ne = S.key, ie = re.filter((c) => c.write === Nt);
2010
+ let D = [], F = null;
2011
+ const G = () => {
2012
+ if (F === null) {
2013
+ F = /* @__PURE__ */ new Map();
2014
+ for (const c of D)
2015
+ F.set(c.key, c);
2016
+ }
2017
+ return F;
2018
+ }, V = (c, b) => Kt(q, c, b), H = (c, b, R) => {
2019
+ const v = Tt(R);
2020
+ return v !== b && (v.length === 0 ? c.removeAttribute("class") : c.setAttribute("class", v)), v;
2021
+ }, f = (c) => c == null ? "" : String(c), i = (c, b, R) => {
2022
+ const v = c.cells, O = v[b.cell] ??= V(c.el, b.index);
2023
+ if (b.kind === Pe) {
2024
+ const P = f(R);
2025
+ v[b.cell + 1] !== P && (O.data = P, v[b.cell + 1] = P);
2026
+ } else
2027
+ v[b.cell + 1] = H(O, v[b.cell + 1], R);
2028
+ };
2029
+ let o, l;
2030
+ const d = () => {
2031
+ const c = o, b = l;
2032
+ for (let R = 0; R < ie.length; R++) {
2033
+ const v = ie[R];
2034
+ i(c, v, v.slot.read(b));
2035
+ }
2036
+ }, w = (c, b) => {
2037
+ if (ie.length === 0)
2038
+ return !1;
2039
+ o = c, l = b;
2040
+ try {
2041
+ return _._probeReads(d);
2042
+ } finally {
2043
+ o = void 0, l = void 0;
2044
+ }
2045
+ }, y = (c) => {
2046
+ const b = _.node(ao(Q), () => {
2047
+ });
2048
+ c.owner = b, Le(Re(Z, b), () => {
2049
+ const R = c.item;
2050
+ for (let v = 0; v < ie.length; v++) {
2051
+ const O = ie[v];
2052
+ i(c, O, O.slot.read(R));
2053
+ }
2054
+ }, { initial: "sync" });
2055
+ }, p = (c, b) => {
2056
+ if (c.item = b, c.owner !== void 0) {
2057
+ c.owner.dispose(), c.owner = void 0, y(c);
2058
+ return;
2059
+ }
2060
+ w(c, b) && y(c);
2061
+ }, C = (c) => {
2062
+ const b = h.createDocumentFragment(), R = [];
2063
+ for (let O = 0; O < c; O++) {
2064
+ const P = de.cloneNode(!0);
2065
+ for (const J of re)
2066
+ R.push(V(P, J.index));
2067
+ b.appendChild(P);
2068
+ }
2069
+ const v = [];
2070
+ return v.length = R.length, v.fill(Rt), { fragment: b, size: c, nodes: R, last: v };
2071
+ };
2072
+ let Y = null, X = null, j, x = Ce, N = Ce, U = 0;
2073
+ const m = [], A = () => {
2074
+ const c = j, b = c.nodes, R = c.last;
2075
+ let v = 0;
2076
+ for (let O = 0; O < c.size; O++) {
2077
+ const P = x[U + O], J = N[U + O];
2078
+ for (let te = 0; te < re.length; te++, v++) {
2079
+ const ye = re[te], ke = ye.slot, _e = ye.write === Ze ? ye.map(ye.selector.test(J)) : ke.kind === "value" ? ke.value : ke.read(P), be = b[v];
2080
+ let pe;
2081
+ ye.kind === Pe ? (pe = f(_e), R[v] !== pe && (be.data = pe)) : pe = H(be, R[v] === Rt ? "" : R[v], _e), R[v] = pe, m[v] = pe;
2082
+ }
2083
+ }
2084
+ };
2085
+ let I;
2086
+ const W = () => {
2087
+ for (let c = 0; c < ie.length; c++)
2088
+ ie[c].slot.read(I);
2089
+ }, g = (c) => {
2090
+ I = c;
2091
+ try {
2092
+ return _._probeReads(W);
2093
+ } finally {
2094
+ I = void 0;
2095
+ }
2096
+ }, E = (c, b, R, v, O, P) => {
2097
+ const J = c.fragment.cloneNode(!0);
2098
+ let te = J.firstChild, ye = 0;
2099
+ for (let ke = b; te !== null; ke++) {
2100
+ const _e = $ === 0 ? Ce : [];
2101
+ $ !== 0 && (_e.length = $);
2102
+ for (let pe = 0; pe < re.length; pe++, ye++) {
2103
+ const ze = re[pe];
2104
+ ze.cell >= 0 && (_e[ze.cell + 1] = m[ye]);
2105
+ }
2106
+ const be = { item: R[ke], key: v[ke], el: te, cells: _e, owner: void 0 };
2107
+ for (let pe = 0; pe < ce.length; pe++)
2108
+ T.writeRowEvent(te, ce[pe], fn, be);
2109
+ F?.set(be.key, be), O.push(be), P && g(be.item) && y(be), te = te.nextSibling;
2110
+ }
2111
+ return J;
2112
+ }, k = (c, b, R, v, O) => {
2113
+ j = c, x = b, N = R, U = v;
2114
+ let P;
2115
+ try {
2116
+ P = _._probeReads(A);
2117
+ } finally {
2118
+ j = void 0, x = Ce, N = Ce;
2119
+ }
2120
+ return E(c, v, b, R, O, P && ie.length !== 0);
2121
+ }, K = (c, b) => {
2122
+ const R = [];
2123
+ return Y ??= C(1), k(Y, [c], [b], 0, R), R[0];
2124
+ }, se = (c, b, R, v, O, P, J) => {
2125
+ let te = R;
2126
+ for (; v - te >= Ve; )
2127
+ X ??= C(Ve), P.insertBefore(k(X, c, b, te, O), J), te += Ve;
2128
+ if (te < v)
2129
+ for (Y ??= C(1); te < v; te++)
2130
+ P.insertBefore(k(Y, c, b, te, O), J);
2131
+ }, fe = (c) => c.firstChild === z.first && c.lastChild === z.last, me = (c) => {
2132
+ const b = c.parentNode;
2133
+ if (b === null || c === h.body || c === h.documentElement)
2134
+ return null;
2135
+ const R = h.activeElement;
2136
+ return R !== null && c.contains(R) || typeof c.getAnimations == "function" && c.getAnimations().length !== 0 ? null : b;
2137
+ }, Ee = (c, b, R, v, O, P) => {
2138
+ const J = z.parentNode, te = D.length === 0 && v - R >= Ve && fe(J) ? me(J) : null;
2139
+ if (te !== null) {
2140
+ const ke = J.nextSibling;
2141
+ te.removeChild(J), se(c, b, R, v, O, J, P), te.insertBefore(J, ke);
2142
+ return;
2143
+ }
2144
+ const ye = h.createDocumentFragment();
2145
+ se(c, b, R, v, O, ye, null), J.insertBefore(ye, P);
2146
+ }, Oe = (c) => {
2147
+ c.owner !== void 0 && (c.owner.dispose(), c.owner = void 0);
2148
+ }, Be = () => {
2149
+ const c = z.parentNode;
2150
+ for (const b of D)
2151
+ Oe(b);
2152
+ if (c !== null && fe(c)) {
2153
+ const b = z.first, R = z.last;
2154
+ c.textContent = "", c.appendChild(b), c.appendChild(R);
2155
+ } else
2156
+ for (const b of D)
2157
+ b.el.remove();
2158
+ D = [], F = null;
2159
+ }, Ie = (c) => {
2160
+ Oe(c), F?.delete(c.key), c.el.remove();
2161
+ }, ee = (c, b, R) => {
2162
+ let v = b[R];
2163
+ return v === void 0 && !(R in b) && (v = ne(c[R], R), b[R] = v), v;
2164
+ }, ge = (c) => {
2165
+ const b = c.length, R = D.length;
2166
+ if (b === 0) {
2167
+ R !== 0 && Be();
2168
+ return;
2169
+ }
2170
+ const v = [];
2171
+ if (R === 0) {
2172
+ for (let ue = 0; ue < b; ue++)
2173
+ ee(c, v, ue);
2174
+ xe(v);
2175
+ const L = [];
2176
+ Ee(c, v, 0, b, L, z.last), D = L;
2177
+ return;
2178
+ }
2179
+ let O = 0, P = R - 1, J = b - 1;
2180
+ for (; ; ) {
2181
+ for (; O <= P && O <= J; ) {
2182
+ const L = D[O], ue = c[O];
2183
+ if (L.item !== ue) {
2184
+ if (L.key !== ee(c, v, O))
2185
+ break;
2186
+ p(L, ue);
2187
+ }
2188
+ O++;
2189
+ }
2190
+ for (; O <= P && O <= J; ) {
2191
+ const L = D[P], ue = c[J];
2192
+ if (L.item !== ue) {
2193
+ if (L.key !== ee(c, v, J))
2194
+ break;
2195
+ p(L, ue);
2196
+ }
2197
+ P--, J--;
2198
+ }
2199
+ if (O < P && O < J && D[O].key === ee(c, v, J) && D[P].key === ee(c, v, O)) {
2200
+ const L = D[O], ue = D[P], Se = z.parentNode, ve = ue.el.nextSibling;
2201
+ Se.insertBefore(ue.el, L.el), Se.insertBefore(L.el, ve), D[O] = ue, D[P] = L;
2202
+ continue;
2203
+ }
2204
+ break;
2205
+ }
2206
+ if (O > P && O > J)
2207
+ return;
2208
+ if (O > P) {
2209
+ for (let ve = O; ve <= J; ve++)
2210
+ ee(c, v, ve);
2211
+ xe(v.slice(O, J + 1));
2212
+ const L = G();
2213
+ for (let ve = O; ve <= J; ve++)
2214
+ if (L.has(v[ve]))
2215
+ throw new Error(`[Raphy] Duplicate keyed-list key "${String(v[ve])}".`);
2216
+ const ue = P + 1 < R ? D[P + 1].el : z.last, Se = [];
2217
+ Ee(c, v, O, J + 1, Se, ue), D.splice(O, 0, ...Se);
2218
+ return;
2219
+ }
2220
+ if (O > J) {
2221
+ for (let L = O; L <= P; L++)
2222
+ Ie(D[L]);
2223
+ D.splice(O, P - O + 1);
2224
+ return;
2225
+ }
2226
+ const te = /* @__PURE__ */ new Set();
2227
+ for (let L = O; L <= J; L++)
2228
+ te.add(ee(c, v, L));
2229
+ te.size !== J - O + 1 && xe(v.slice(O, J + 1));
2230
+ const ye = G();
2231
+ let ke = 0;
2232
+ for (let L = O; L <= P; L++) {
2233
+ const ue = D[L];
2234
+ te.has(ue.key) ? ke++ : Ie(ue);
2235
+ }
2236
+ if (ke === 0 && O === 0 && P === R - 1) {
2237
+ Be();
2238
+ const L = [];
2239
+ Ee(c, v, 0, b, L, z.last), D = L;
2240
+ return;
2241
+ }
2242
+ let be = P + 1 < R ? D[P + 1].el : z.last;
2243
+ for (let L = O; L <= P; L++)
2244
+ if (te.has(D[L].key)) {
2245
+ be = D[L].el;
2246
+ break;
2247
+ }
2248
+ const pe = D.slice(0, O), ze = z.parentNode;
2249
+ for (let L = O; L <= J; L++) {
2250
+ const ue = c[L], Se = v[L];
2251
+ let ve = ye.get(Se);
2252
+ ve === void 0 ? ve = K(ue, Se) : ve.item !== ue && p(ve, ue), pe.push(ve);
2253
+ const Ge = ve.el;
2254
+ Ge === be ? be = Ge.nextSibling : ze.insertBefore(Ge, be);
2255
+ }
2256
+ for (let L = P + 1; L < R; L++)
2257
+ pe.push(D[L]);
2258
+ D = pe;
2259
+ };
2260
+ let we = Ce;
2261
+ const qt = () => {
2262
+ const c = we;
2263
+ we = Ce;
2264
+ try {
2265
+ ge(c);
2266
+ } catch (b) {
2267
+ throw Be(), b;
2268
+ }
2269
+ }, Gt = () => {
2270
+ try {
2271
+ const c = S.read();
2272
+ if (!Array.isArray(c))
2273
+ throw new TypeError("[RaphyDOM] each() source must return an array.");
2274
+ we = c, _.untracked(qt);
2275
+ } catch (c) {
2276
+ r(B, c, "each-update", !1);
2277
+ }
2278
+ };
2279
+ Q.own(() => {
2280
+ for (const c of D)
2281
+ Oe(c), c.el.remove();
2282
+ D = [], F = null, z.remove();
2283
+ }), dn(B.transaction, B.ownerNode, Gt, (c) => Le(Z, c, { initial: "sync" }));
2284
+ for (const c of re) {
2285
+ if (c.write !== Ze)
2286
+ continue;
2287
+ const b = c.selector, R = c.map;
2288
+ let v = je, O = je;
2289
+ const P = (te) => {
2290
+ const ye = D.length === 0 ? void 0 : G().get(te);
2291
+ ye !== void 0 && i(ye, c, R(b.test(te)));
2292
+ }, J = () => {
2293
+ P(v), P(O);
2294
+ };
2295
+ Le(Z, () => {
2296
+ const te = b.read();
2297
+ if (v !== je && !Object.is(v, te)) {
2298
+ O = te;
2299
+ try {
2300
+ _.untracked(J);
2301
+ } finally {
2302
+ O = je;
2303
+ }
2304
+ }
2305
+ v = te;
2306
+ }, { initial: "sync" });
2307
+ }
2308
+ return z;
2309
+ }
2310
+ }
2311
+ function xe(e) {
2312
+ let t = !0;
2313
+ for (let r = 1; r < e.length; r++) {
2314
+ const a = e[r - 1], s = e[r];
2315
+ if (typeof a != "number" || typeof s != "number" || !(s > a)) {
2316
+ t = !1;
2317
+ break;
2318
+ }
2319
+ }
2320
+ if (t)
2321
+ return;
2322
+ const n = /* @__PURE__ */ new Set();
2323
+ for (const r of e) {
2324
+ if (n.has(r))
2325
+ throw new Error(`[Raphy] Duplicate keyed-list key "${String(r)}".`);
2326
+ n.add(r);
2327
+ }
2328
+ }
2329
+ function Kt(e, t, n) {
2330
+ const r = e.steps, a = e.stepEnds[n];
2331
+ let s = t, u = t, M = t;
2332
+ for (let S = 0; S < a; S++)
2333
+ switch (r[S]) {
2334
+ case st:
2335
+ s = s.firstChild;
2336
+ break;
2337
+ case Ke:
2338
+ s = s.nextSibling;
2339
+ break;
2340
+ case at:
2341
+ s = s.parentNode;
2342
+ break;
2343
+ case ct:
2344
+ u = s;
2345
+ break;
2346
+ case lt:
2347
+ s = u;
2348
+ break;
2349
+ case ut:
2350
+ M = s;
2351
+ break;
2352
+ case dt:
2353
+ s = M;
2354
+ break;
2355
+ default:
2356
+ s = t;
2357
+ }
2358
+ return s;
2359
+ }
2360
+ function lo(e, t) {
2361
+ const n = e.prototype, r = [];
2362
+ let a = Kt(e, n, t);
2363
+ for (; a !== n; ) {
2364
+ const s = a.parentNode;
2365
+ r.unshift(Array.prototype.indexOf.call(s.childNodes, a)), a = s;
2366
+ }
2367
+ return r;
2368
+ }
2369
+ function uo(e) {
2370
+ const { MountContext: t, captureDOMCleanupError: n, captureDOMError: r, clearDOMBranchForTransaction: a, materializeElement: s, materializeHostBlueprint: u, mountChildren: M, mountKeyedItem: S, ownDOMOutput: B, registerHydratingEffect: q, rethrowUnhandledDOMOperationError: ae, runMountTransaction: le, runTemplateOperation: oe, selectDOMBranch: h } = e, T = 1073741823, z = -1;
2371
+ function Q(f, i) {
2372
+ const o = i.env, l = he.anchored(o.document, "raphy:each"), d = new Ct(i.ownerNode), w = Re(i.effectScope, d.node), y = f.empty === void 0 ? null : new _t(d.node);
2373
+ let p = 0, C = f.empty === void 0 && o.namespace === "html";
2374
+ const Y = f.immutableKeys === !0;
2375
+ let X = null;
2376
+ const j = [];
2377
+ let x = 0, N = 0, U = 0;
2378
+ const m = (g, E) => {
2379
+ const k = g.payload;
2380
+ if (k === void 0)
2381
+ return E;
2382
+ g.payload = void 0;
2383
+ try {
2384
+ if (p !== 0 && k instanceof he)
2385
+ p--, k.remove();
2386
+ else {
2387
+ const K = k;
2388
+ l.removeNode(
2389
+ K,
2390
+ K.nodeType === 1 ? () => o.styleValueBoundary?.detach(K) : void 0
2391
+ );
2392
+ }
2393
+ } catch (K) {
2394
+ (E ??= []).push(K);
2395
+ try {
2396
+ k instanceof he ? k.remove(!0) : (k.remove(), k.nodeType === 1 && o.styleValueBoundary?.detach(k));
2397
+ } catch (se) {
2398
+ se !== K && E.push(se);
2399
+ }
2400
+ }
2401
+ return E;
2402
+ }, A = (g, E, k) => {
2403
+ let K;
2404
+ const se = d.lastPatch, fe = se.kind;
2405
+ if (fe === "clear" || fe === "replace")
2406
+ K = $(
2407
+ l,
2408
+ g,
2409
+ se,
2410
+ m,
2411
+ C
2412
+ );
2413
+ else if (fe === "remove" || fe === "general") {
2414
+ const me = se.removed;
2415
+ for (let Ee = 0; Ee < me.length; Ee++) {
2416
+ const Oe = g[me[Ee]];
2417
+ Oe !== void 0 && Oe.node.disposed && (K = m(Oe, K));
2418
+ }
2419
+ }
2420
+ if (x !== E) {
2421
+ if (k)
2422
+ for (let me = E; me < x; me++) {
2423
+ const Ee = j[me];
2424
+ Ee.node.disposed && (K = m(Ee, K));
2425
+ }
2426
+ j.fill(void 0, E, x), x = E;
2427
+ }
2428
+ return K;
2429
+ };
2430
+ d.node._ownCompletedCleanup(() => {
2431
+ const g = d.entries;
2432
+ let E;
2433
+ for (let k = 0; k < g.length; k++)
2434
+ E = m(g[k], E);
2435
+ try {
2436
+ l.remove();
2437
+ } catch (k) {
2438
+ (E ??= []).push(k);
2439
+ }
2440
+ if (E !== void 0) {
2441
+ const k = n(
2442
+ ce(E),
2443
+ o.host,
2444
+ o.ownerComponent,
2445
+ { layer: "renderer", operation: "dom-output-dispose" }
2446
+ );
2447
+ if (!k.handled)
2448
+ return {
2449
+ error: k.report.error,
2450
+ hasUnrouted: !1,
2451
+ completed: { error: k.report.error }
2452
+ };
2453
+ }
2454
+ });
2455
+ const I = (g) => {
2456
+ const E = oe(
2457
+ o.targetRuntime,
2458
+ o.styleScopeId,
2459
+ () => f.render(
2460
+ () => g.value.get(),
2461
+ () => g.index.get()
2462
+ )
2463
+ ), k = new t(
2464
+ o,
2465
+ Re(w, g.node),
2466
+ g.node,
2467
+ X
2468
+ );
2469
+ let K = null;
2470
+ if (typeof E == "object" && E !== null) {
2471
+ const se = E.kind;
2472
+ se === "element" ? (C = !1, K = s(E, k)) : se === "host-blueprint" && (K = u(
2473
+ E,
2474
+ k
2475
+ ));
2476
+ }
2477
+ if (K === null) {
2478
+ C = !1;
2479
+ const se = S(E, k);
2480
+ if (g.node.disposed)
2481
+ return;
2482
+ if (K = se.plainNode(), K === null) {
2483
+ g.payload = se, p++, j[x++] = g, l.adopt(se), se.moveBefore(l.parentNode, l.last);
2484
+ return;
2485
+ }
2486
+ }
2487
+ g.payload = K, j[x++] = g, (Ne(o.document) === void 0 || K.parentNode !== l.parentNode) && l.parentNode.insertBefore(K, l.last);
2488
+ }, W = () => {
2489
+ try {
2490
+ const g = f.read();
2491
+ if (!Array.isArray(g))
2492
+ throw new TypeError("[RaphyDOM] each() source must return an array.");
2493
+ le(i, "each-update", (E) => {
2494
+ d.node.runtime.untracked(() => {
2495
+ const k = d.entries, K = X;
2496
+ X = E;
2497
+ const se = x, fe = U === N, me = N + 1 & T;
2498
+ N = me;
2499
+ const Ee = (ee) => pn(
2500
+ (ge, we) => d._reconcileWithRollbackFailure(
2501
+ g,
2502
+ f.key,
2503
+ ge,
2504
+ Y,
2505
+ we
2506
+ ),
2507
+ ee,
2508
+ (ge, we) => r(
2509
+ ge,
2510
+ new t(o, w, we.node, E),
2511
+ {
2512
+ layer: "renderer",
2513
+ operation: "each-update",
2514
+ phase: Ae
2515
+ }
2516
+ )
2517
+ );
2518
+ let Oe;
2519
+ try {
2520
+ Oe = Ee(I);
2521
+ } catch (ee) {
2522
+ X = K;
2523
+ const ge = A(
2524
+ k,
2525
+ se,
2526
+ !0
2527
+ );
2528
+ if (fe && N === me && d.entries === k && (U = me), ge !== void 0) {
2529
+ const we = n(
2530
+ ce([
2531
+ ee instanceof Me ? ee.error : ee instanceof Te ? ee.captured.report.error : ee,
2532
+ ...ge
2533
+ ]),
2534
+ o.host,
2535
+ o.ownerComponent,
2536
+ {
2537
+ layer: "renderer",
2538
+ operation: "each-update",
2539
+ phase: Ae
2540
+ }
2541
+ );
2542
+ if (!we.handled)
2543
+ throw new Me(we.report.error);
2544
+ if (!(ee instanceof Me) && !(ee instanceof Te))
2545
+ throw new Te(we);
2546
+ }
2547
+ throw ee;
2548
+ }
2549
+ X = K;
2550
+ const Be = A(
2551
+ k,
2552
+ se,
2553
+ !1
2554
+ );
2555
+ if (Be !== void 0) {
2556
+ const ee = n(
2557
+ ce(Be),
2558
+ o.host,
2559
+ o.ownerComponent,
2560
+ {
2561
+ layer: "renderer",
2562
+ operation: "each-update",
2563
+ phase: Ae
2564
+ }
2565
+ );
2566
+ ee.handled || E.deferCompletedFailure(ee.report.error);
2567
+ }
2568
+ const Ie = fe && N === me;
2569
+ if (Ie || (Oe = d.entries), Oe.length === 0)
2570
+ f.empty !== void 0 && h(
2571
+ y,
2572
+ i,
2573
+ E,
2574
+ "each-update",
2575
+ "empty",
2576
+ !0,
2577
+ (ee) => {
2578
+ const ge = Re(w, ee.node), we = M(
2579
+ oe(
2580
+ o.targetRuntime,
2581
+ o.styleScopeId,
2582
+ f.empty
2583
+ ),
2584
+ new t(o, ge, ee.node, E),
2585
+ "raphy:each:empty"
2586
+ );
2587
+ ee.node.disposed || (B(ee.node, we, i), l.adopt(we), we.moveBefore(l.parentNode, l.last));
2588
+ }
2589
+ );
2590
+ else if (!Ie)
2591
+ y !== null && a(
2592
+ y,
2593
+ i,
2594
+ E,
2595
+ "each-update"
2596
+ ), V(
2597
+ Oe,
2598
+ l.parentNode,
2599
+ l.last,
2600
+ p === 0
2601
+ );
2602
+ else {
2603
+ const ee = d.lastPatch, ge = ee.kind;
2604
+ ge !== "unchanged" && (y !== null && a(
2605
+ y,
2606
+ i,
2607
+ E,
2608
+ "each-update"
2609
+ ), ge === "swap" ? F(
2610
+ k,
2611
+ ee.swapA,
2612
+ ee.swapB,
2613
+ l.parentNode,
2614
+ l.last
2615
+ ) : ge === "general" && G(
2616
+ Oe,
2617
+ ee.prefix,
2618
+ ee.suffix,
2619
+ ee.sources,
2620
+ l.parentNode,
2621
+ l.last,
2622
+ p === 0
2623
+ ));
2624
+ }
2625
+ U = N === me ? me : z;
2626
+ });
2627
+ });
2628
+ } catch (g) {
2629
+ ae(
2630
+ i,
2631
+ g,
2632
+ "each-update",
2633
+ !f.reactive
2634
+ );
2635
+ }
2636
+ };
2637
+ return f.reactive ? q(l, i, w, W, {
2638
+ initial: "sync"
2639
+ }) : W(), l;
2640
+ }
2641
+ const _ = 0, Z = 1, re = 2;
2642
+ function ce(f) {
2643
+ return f.length === 1 ? f[0] : new AggregateError(f, "[RaphyDOM] Keyed-list row removal failed.");
2644
+ }
2645
+ function $(f, i, o, l, d) {
2646
+ if (d && o.kind === "clear") {
2647
+ const p = de(f, i);
2648
+ if (p !== null)
2649
+ return p;
2650
+ }
2651
+ let w;
2652
+ const y = i.length - o.suffix;
2653
+ for (let p = o.prefix; p < y; p++) {
2654
+ const C = i[p];
2655
+ C.node.disposed && (w = l(C, w));
2656
+ }
2657
+ return w;
2658
+ }
2659
+ function de(f, i) {
2660
+ const o = i.length;
2661
+ if (o === 0 || !f.canClearParent())
2662
+ return null;
2663
+ let l = f.first.nextSibling;
2664
+ for (let d = 0; d < o; d++) {
2665
+ const w = i[d];
2666
+ if (l === null || w.payload !== l || !w.node.disposed)
2667
+ return null;
2668
+ l = l.nextSibling;
2669
+ }
2670
+ if (l !== f.last)
2671
+ return null;
2672
+ for (let d = 0; d < o; d++)
2673
+ i[d].payload = void 0;
2674
+ try {
2675
+ f.clearParent();
2676
+ } catch (d) {
2677
+ return [d];
2678
+ }
2679
+ }
2680
+ function ne(f) {
2681
+ const i = f.payload;
2682
+ if (i === void 0)
2683
+ throw new Error("[RaphyDOM] Keyed-list entry is missing its DOM range.");
2684
+ return i;
2685
+ }
2686
+ function ie(f) {
2687
+ return f instanceof he ? f.first : f;
2688
+ }
2689
+ function D(f, i, o) {
2690
+ if (f instanceof he) {
2691
+ f.last.nextSibling !== o && (f.moveBefore(i, o), f.notifyMove());
2692
+ return;
2693
+ }
2694
+ f.nextSibling !== o && he.moveNode(f, i, o);
2695
+ }
2696
+ function F(f, i, o, l, d) {
2697
+ const w = ne(f[i]), y = ne(f[o]);
2698
+ if (o === i + 1) {
2699
+ D(y, l, ie(w));
2700
+ return;
2701
+ }
2702
+ const p = ne(f[i + 1]), C = o + 1 === f.length ? null : ne(f[o + 1]);
2703
+ D(
2704
+ w,
2705
+ l,
2706
+ C === null ? d : ie(C)
2707
+ ), D(y, l, ie(p));
2708
+ }
2709
+ function G(f, i, o, l, d, w, y) {
2710
+ const p = H(l);
2711
+ let C = w;
2712
+ if (o !== 0) {
2713
+ const Y = ne(f[f.length - o]);
2714
+ C = y ? Y : ie(Y);
2715
+ }
2716
+ for (let Y = p.length - 1; Y >= 0; Y--) {
2717
+ const X = p[Y], j = ne(f[i + Y]);
2718
+ if (y || !(j instanceof he)) {
2719
+ const x = j;
2720
+ X !== re && x.nextSibling !== C && he.moveNode(x, d, C), C = x;
2721
+ } else
2722
+ X !== re && j.last.nextSibling !== C && (j.moveBefore(d, C), X === Z && j.notifyMove()), C = j.first;
2723
+ }
2724
+ }
2725
+ function V(f, i, o, l) {
2726
+ let d = o;
2727
+ for (let w = f.length - 1; w >= 0; w--) {
2728
+ const y = ne(f[w]);
2729
+ if (l || !(y instanceof he)) {
2730
+ const p = y;
2731
+ p.nextSibling !== d && he.moveNode(p, i, d), d = p;
2732
+ } else
2733
+ y.last.nextSibling !== d && (y.moveBefore(i, d), y.notifyMove()), d = y.first;
2734
+ }
2735
+ }
2736
+ function H(f) {
2737
+ const i = [], o = [], l = [];
2738
+ for (let w = 0; w < f.length; w++) {
2739
+ const y = f[w];
2740
+ if (y < 0) {
2741
+ i.push(_), l.push(-1);
2742
+ continue;
2743
+ }
2744
+ i.push(Z);
2745
+ let p = 0, C = o.length;
2746
+ for (; p < C; ) {
2747
+ const Y = p + C >> 1;
2748
+ f[o[Y]] < y ? p = Y + 1 : C = Y;
2749
+ }
2750
+ l.push(p === 0 ? -1 : o[p - 1]), o[p] = w;
2751
+ }
2752
+ let d = o.length === 0 ? -1 : o[o.length - 1];
2753
+ for (; d !== -1; )
2754
+ i[d] = re, d = l[d];
2755
+ return i;
2756
+ }
2757
+ return co(e, Q);
2758
+ }
2759
+ const fo = /* @__PURE__ */ Object.freeze({ kind: "each", create: uo }), po = /* @__PURE__ */ Object.freeze({ kind: "binding", mount: $n }), ho = /* @__PURE__ */ Object.freeze({ kind: "advanced", create: no }), mo = /* @__PURE__ */ Object.freeze({ kind: "boundaries", create: oo }), Eo = /* @__PURE__ */ Object.freeze([fo, po, ho, mo]);
2760
+ export {
2761
+ ho as A,
2762
+ po as B,
2763
+ at as D,
2764
+ fo as E,
2765
+ Eo as F,
2766
+ mo as a,
2767
+ Ke as b,
2768
+ go as c,
2769
+ st as d,
2770
+ Pe as e,
2771
+ Je as f,
2772
+ Xe as g,
2773
+ pt as h,
2774
+ Ft as i,
2775
+ dt as j,
2776
+ ut as k,
2777
+ lt as l,
2778
+ ct as m,
2779
+ Oo as n,
2780
+ bo as r
2781
+ };