@askrjs/askr 0.0.51 → 0.0.53

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 (651) hide show
  1. package/README.md +5 -1
  2. package/dist/{runtime/scheduler.js → access-Bg4RJNC8.js} +190 -20
  3. package/dist/actions/index.d.ts +2 -0
  4. package/dist/actions/index.js +103 -0
  5. package/dist/{common/attr-names.js → attr-names-CjhzmHOn.js} +1 -3
  6. package/dist/benchmark.d.ts +7 -4
  7. package/dist/benchmark.js +63 -13
  8. package/dist/boot/index.d.ts +62 -4
  9. package/dist/boot/index.js +1 -194
  10. package/dist/boot-j2KoN6ss.js +647 -0
  11. package/dist/cleanup-COv77su2.js +487 -0
  12. package/dist/component-internal-B3z7GXlD.js +614 -0
  13. package/dist/component-lifecycle-CO4hXlP4.js +357 -0
  14. package/dist/{runtime/component-scope.js → component-scope-CC3cojX9.js} +35 -9
  15. package/dist/component-scope-CvPba6O6.d.ts +12 -0
  16. package/dist/components/index.d.ts +17 -2
  17. package/dist/components/index.js +39 -1
  18. package/dist/compose-ref-Cc_YkUpM.js +92 -0
  19. package/dist/{foundations/utilities/compose-ref.d.ts → compose-ref-Cizq72-x.d.ts} +1 -2
  20. package/dist/control/index.d.ts +1 -3
  21. package/dist/control/index.js +1 -3
  22. package/dist/control-BQvNVfAd.d.ts +436 -0
  23. package/dist/control-BYyLTFyw.js +165 -0
  24. package/dist/control-Bf4Wkdvv.d.ts +9 -0
  25. package/dist/{common/control.js → control-DhFRTIoE.js} +1 -3
  26. package/dist/data/index.d.ts +2 -6
  27. package/dist/data/index.js +4 -5
  28. package/dist/data-DnxnDxD-.js +559 -0
  29. package/dist/{data/data-runtime.js → data-runtime-SJ1BSUvk.js} +35 -36
  30. package/dist/deferred-lKE8uR0z.js +386 -0
  31. package/dist/effect-BwnIvLah.js +260 -0
  32. package/dist/fastlane-Dw8SOBr9.js +343 -0
  33. package/dist/for-internal-BKf_Tnv1.js +1563 -0
  34. package/dist/foundations/icon/index.d.ts +68 -2
  35. package/dist/foundations/icon/index.js +85 -1
  36. package/dist/foundations/index.d.ts +2 -5
  37. package/dist/foundations/index.js +2 -5
  38. package/dist/foundations/interactions/index.d.ts +264 -6
  39. package/dist/foundations/interactions/index.js +1 -6
  40. package/dist/foundations/state/index.d.ts +32 -1
  41. package/dist/foundations/state/index.js +78 -1
  42. package/dist/foundations/structures/index.d.ts +2 -7
  43. package/dist/foundations/structures/index.js +2 -7
  44. package/dist/foundations/utilities/index.d.ts +2 -6
  45. package/dist/foundations/utilities/index.js +2 -5
  46. package/dist/fx/index.d.ts +190 -3
  47. package/dist/fx/index.js +454 -4
  48. package/dist/index-31Uoz_NS.d.ts +239 -0
  49. package/dist/index-Bki2rqcr.d.ts +233 -0
  50. package/dist/index-BnU0NPwM.d.ts +101 -0
  51. package/dist/index-D73jgYx1.d.ts +48 -0
  52. package/dist/{runtime/runtime.d.ts → index-R2JJIbM-.d.ts} +31 -9
  53. package/dist/index-SJXJkssx.d.ts +44 -0
  54. package/dist/index.d.ts +8 -13
  55. package/dist/index.js +150 -17
  56. package/dist/interactions-w7gQN4ha.js +280 -0
  57. package/dist/{data/invalidation-listeners.js → invalidation-listeners-Des3AHYs.js} +1 -3
  58. package/dist/{common/props.d.ts → jsx-CP0gmYwJ.d.ts} +17 -6
  59. package/dist/{common/jsx.js → jsx-CUpRxrLH.js} +1 -3
  60. package/dist/jsx-dev-runtime.d.ts +17 -5
  61. package/dist/jsx-dev-runtime.js +3 -10
  62. package/dist/jsx-runtime-92bV2hSa.d.ts +34 -0
  63. package/dist/jsx-runtime-BVVgDSdq.d.ts +1 -0
  64. package/dist/jsx-runtime.d.ts +3 -22
  65. package/dist/jsx-runtime.js +17 -20
  66. package/dist/{runtime/lifecycle-operations.js → lifecycle-operations-D9va7GOU.js} +9 -11
  67. package/dist/navigate-BVDCzOuB.d.ts +34 -0
  68. package/dist/navigate-CmPLSXyw.js +1449 -0
  69. package/dist/{runtime/portal.js → portal-CyU3Ucf2.js} +124 -35
  70. package/dist/query-registry-CQIT4mXr.js +73 -0
  71. package/dist/{common/render-context.js → render-context-Clw3rFiO.js} +14 -8
  72. package/dist/renderer-DzPjeLby.js +6197 -0
  73. package/dist/resource-operation-CEzfpnDk.js +276 -0
  74. package/dist/resources/index.d.ts +42 -3
  75. package/dist/resources/index.js +3 -4
  76. package/dist/{common/route-activity.js → route-activity-CNJfpwx-.js} +1 -3
  77. package/dist/route-matching-vJpvLVbX.js +515 -0
  78. package/dist/router/index.d.ts +166 -14
  79. package/dist/router/index.js +150 -12
  80. package/dist/{common/router.d.ts → router-CeYvjj5_.d.ts} +72 -29
  81. package/dist/{common/router-internal.js → router-internal-BC0w1_xk.js} +1 -3
  82. package/dist/{runtime/scheduler.d.ts → scheduler-CmLO4Dfm.d.ts} +1 -4
  83. package/dist/{runtime/selector.js → selector-DafVYzV4.js} +35 -20
  84. package/dist/{runtime/snapshot-source.js → snapshot-source-BB42xgwb.js} +1 -3
  85. package/dist/ssg/index.d.ts +252 -4
  86. package/dist/ssg/index.js +857 -1
  87. package/dist/ssr/index.d.ts +225 -8
  88. package/dist/ssr/index.js +3 -6
  89. package/dist/{common/ssr.js → ssr-CbQO5xd3.js} +1 -3
  90. package/dist/ssr-D3t80Rc0.js +1413 -0
  91. package/dist/{runtime/state.js → state-DPl8lffD.js} +4 -8
  92. package/dist/structures-DUB3HchX.js +221 -0
  93. package/dist/testing/index.d.ts +4 -4
  94. package/dist/testing/index.js +2 -7
  95. package/dist/{jsx/types.d.ts → types-DnQVG4ZY.d.ts} +2 -6
  96. package/dist/{foundations/utilities/use-id.js → utilities-C_CGX4Dz.js} +1 -3
  97. package/dist/{ssr/verify-hydration.js → verify-hydration-io9ahUeq.js} +2 -4
  98. package/dist/{common/vnode.js → vnode-CGMJYPMB.js} +2 -4
  99. package/package.json +63 -45
  100. package/dist/bench/components/benchmark-row.d.ts +0 -20
  101. package/dist/bench/components/benchmark-row.d.ts.map +0 -1
  102. package/dist/bench/components/benchmark-row.js +0 -42
  103. package/dist/bench/components/benchmark-row.js.map +0 -1
  104. package/dist/bench/components/benchmark-table.js +0 -25
  105. package/dist/bench/components/benchmark-table.js.map +0 -1
  106. package/dist/benchmark.d.ts.map +0 -1
  107. package/dist/benchmark.js.map +0 -1
  108. package/dist/bin/askr-ssg.d.ts +0 -28
  109. package/dist/bin/askr-ssg.d.ts.map +0 -1
  110. package/dist/bin/askr-ssg.js +0 -171
  111. package/dist/bin/askr-ssg.js.map +0 -1
  112. package/dist/boot/hydration.js +0 -140
  113. package/dist/boot/hydration.js.map +0 -1
  114. package/dist/boot/index.d.ts.map +0 -1
  115. package/dist/boot/index.js.map +0 -1
  116. package/dist/boot/root-lifecycle.d.ts +0 -15
  117. package/dist/boot/root-lifecycle.d.ts.map +0 -1
  118. package/dist/boot/root-lifecycle.js +0 -205
  119. package/dist/boot/root-lifecycle.js.map +0 -1
  120. package/dist/boot/route-startup.js +0 -45
  121. package/dist/boot/route-startup.js.map +0 -1
  122. package/dist/boot/types.d.ts +0 -62
  123. package/dist/boot/types.d.ts.map +0 -1
  124. package/dist/common/attr-names.js.map +0 -1
  125. package/dist/common/component.d.ts +0 -19
  126. package/dist/common/component.d.ts.map +0 -1
  127. package/dist/common/control.d.ts +0 -13
  128. package/dist/common/control.d.ts.map +0 -1
  129. package/dist/common/control.js.map +0 -1
  130. package/dist/common/env.js +0 -47
  131. package/dist/common/env.js.map +0 -1
  132. package/dist/common/error-boundary.d.ts +0 -16
  133. package/dist/common/error-boundary.d.ts.map +0 -1
  134. package/dist/common/invariant.js +0 -17
  135. package/dist/common/invariant.js.map +0 -1
  136. package/dist/common/jsx.d.ts +0 -23
  137. package/dist/common/jsx.d.ts.map +0 -1
  138. package/dist/common/jsx.js.map +0 -1
  139. package/dist/common/logger.js +0 -36
  140. package/dist/common/logger.js.map +0 -1
  141. package/dist/common/promise.js +0 -8
  142. package/dist/common/promise.js.map +0 -1
  143. package/dist/common/props.d.ts.map +0 -1
  144. package/dist/common/render-context.js.map +0 -1
  145. package/dist/common/route-activity.js.map +0 -1
  146. package/dist/common/router-internal.js.map +0 -1
  147. package/dist/common/router.d.ts.map +0 -1
  148. package/dist/common/ssr-errors.d.ts +0 -11
  149. package/dist/common/ssr-errors.d.ts.map +0 -1
  150. package/dist/common/ssr-errors.js +0 -16
  151. package/dist/common/ssr-errors.js.map +0 -1
  152. package/dist/common/ssr.d.ts +0 -42
  153. package/dist/common/ssr.d.ts.map +0 -1
  154. package/dist/common/ssr.js.map +0 -1
  155. package/dist/common/vnode.d.ts +0 -22
  156. package/dist/common/vnode.d.ts.map +0 -1
  157. package/dist/common/vnode.js.map +0 -1
  158. package/dist/components/error-boundary.d.ts +0 -15
  159. package/dist/components/error-boundary.d.ts.map +0 -1
  160. package/dist/components/error-boundary.js +0 -43
  161. package/dist/components/error-boundary.js.map +0 -1
  162. package/dist/components/link.d.ts +0 -68
  163. package/dist/components/link.d.ts.map +0 -1
  164. package/dist/components/link.js +0 -76
  165. package/dist/components/link.js.map +0 -1
  166. package/dist/control/case.d.ts +0 -19
  167. package/dist/control/case.d.ts.map +0 -1
  168. package/dist/control/case.js +0 -70
  169. package/dist/control/case.js.map +0 -1
  170. package/dist/control/for.d.ts +0 -24
  171. package/dist/control/for.d.ts.map +0 -1
  172. package/dist/control/for.js +0 -63
  173. package/dist/control/for.js.map +0 -1
  174. package/dist/control/shared.d.ts +0 -9
  175. package/dist/control/shared.d.ts.map +0 -1
  176. package/dist/control/shared.js +0 -20
  177. package/dist/control/shared.js.map +0 -1
  178. package/dist/control/show.d.ts +0 -15
  179. package/dist/control/show.d.ts.map +0 -1
  180. package/dist/control/show.js +0 -34
  181. package/dist/control/show.js.map +0 -1
  182. package/dist/data/data-runtime.d.ts +0 -28
  183. package/dist/data/data-runtime.d.ts.map +0 -1
  184. package/dist/data/data-runtime.js.map +0 -1
  185. package/dist/data/invalidation-listeners.js.map +0 -1
  186. package/dist/data/invalidation.d.ts +0 -9
  187. package/dist/data/invalidation.d.ts.map +0 -1
  188. package/dist/data/invalidation.js +0 -27
  189. package/dist/data/invalidation.js.map +0 -1
  190. package/dist/data/mutation-cell.d.ts +0 -28
  191. package/dist/data/mutation-cell.d.ts.map +0 -1
  192. package/dist/data/mutation-cell.js +0 -132
  193. package/dist/data/mutation-cell.js.map +0 -1
  194. package/dist/data/query-cell.d.ts +0 -46
  195. package/dist/data/query-cell.d.ts.map +0 -1
  196. package/dist/data/query-cell.js +0 -290
  197. package/dist/data/query-cell.js.map +0 -1
  198. package/dist/data/query-key.js +0 -42
  199. package/dist/data/query-key.js.map +0 -1
  200. package/dist/data/shared.js +0 -21
  201. package/dist/data/shared.js.map +0 -1
  202. package/dist/data/testing.js +0 -2
  203. package/dist/data/types.d.ts +0 -161
  204. package/dist/data/types.d.ts.map +0 -1
  205. package/dist/foundations/icon/icon.d.ts +0 -53
  206. package/dist/foundations/icon/icon.d.ts.map +0 -1
  207. package/dist/foundations/icon/icon.js +0 -88
  208. package/dist/foundations/icon/icon.js.map +0 -1
  209. package/dist/foundations/icon/icon.types.d.ts +0 -22
  210. package/dist/foundations/icon/icon.types.d.ts.map +0 -1
  211. package/dist/foundations/interactions/dismissable.d.ts +0 -72
  212. package/dist/foundations/interactions/dismissable.d.ts.map +0 -1
  213. package/dist/foundations/interactions/dismissable.js +0 -26
  214. package/dist/foundations/interactions/dismissable.js.map +0 -1
  215. package/dist/foundations/interactions/focusable.d.ts +0 -22
  216. package/dist/foundations/interactions/focusable.d.ts.map +0 -1
  217. package/dist/foundations/interactions/focusable.js +0 -18
  218. package/dist/foundations/interactions/focusable.js.map +0 -1
  219. package/dist/foundations/interactions/hoverable.d.ts +0 -26
  220. package/dist/foundations/interactions/hoverable.d.ts.map +0 -1
  221. package/dist/foundations/interactions/hoverable.js +0 -15
  222. package/dist/foundations/interactions/hoverable.js.map +0 -1
  223. package/dist/foundations/interactions/interaction-policy.d.ts +0 -50
  224. package/dist/foundations/interactions/interaction-policy.d.ts.map +0 -1
  225. package/dist/foundations/interactions/interaction-policy.js +0 -122
  226. package/dist/foundations/interactions/interaction-policy.js.map +0 -1
  227. package/dist/foundations/interactions/pressable.d.ts +0 -61
  228. package/dist/foundations/interactions/pressable.d.ts.map +0 -1
  229. package/dist/foundations/interactions/pressable.js +0 -51
  230. package/dist/foundations/interactions/pressable.js.map +0 -1
  231. package/dist/foundations/interactions/roving-focus.d.ts +0 -52
  232. package/dist/foundations/interactions/roving-focus.d.ts.map +0 -1
  233. package/dist/foundations/interactions/roving-focus.js +0 -71
  234. package/dist/foundations/interactions/roving-focus.js.map +0 -1
  235. package/dist/foundations/state/controllable.d.ts +0 -33
  236. package/dist/foundations/state/controllable.d.ts.map +0 -1
  237. package/dist/foundations/state/controllable.js +0 -82
  238. package/dist/foundations/state/controllable.js.map +0 -1
  239. package/dist/foundations/structures/collection.d.ts +0 -52
  240. package/dist/foundations/structures/collection.d.ts.map +0 -1
  241. package/dist/foundations/structures/collection.js +0 -51
  242. package/dist/foundations/structures/collection.js.map +0 -1
  243. package/dist/foundations/structures/layer.d.ts +0 -81
  244. package/dist/foundations/structures/layer.d.ts.map +0 -1
  245. package/dist/foundations/structures/layer.js +0 -81
  246. package/dist/foundations/structures/layer.js.map +0 -1
  247. package/dist/foundations/structures/layout.d.ts +0 -33
  248. package/dist/foundations/structures/layout.d.ts.map +0 -1
  249. package/dist/foundations/structures/layout.js +0 -13
  250. package/dist/foundations/structures/layout.js.map +0 -1
  251. package/dist/foundations/structures/portal.d.ts +0 -2
  252. package/dist/foundations/structures/portal.js +0 -3
  253. package/dist/foundations/structures/presence.d.ts +0 -37
  254. package/dist/foundations/structures/presence.d.ts.map +0 -1
  255. package/dist/foundations/structures/presence.js +0 -39
  256. package/dist/foundations/structures/presence.js.map +0 -1
  257. package/dist/foundations/structures/slot.d.ts +0 -35
  258. package/dist/foundations/structures/slot.d.ts.map +0 -1
  259. package/dist/foundations/structures/slot.js +0 -41
  260. package/dist/foundations/structures/slot.js.map +0 -1
  261. package/dist/foundations/utilities/aria.d.ts +0 -16
  262. package/dist/foundations/utilities/aria.d.ts.map +0 -1
  263. package/dist/foundations/utilities/aria.js +0 -17
  264. package/dist/foundations/utilities/aria.js.map +0 -1
  265. package/dist/foundations/utilities/compose-handlers.d.ts +0 -37
  266. package/dist/foundations/utilities/compose-handlers.d.ts.map +0 -1
  267. package/dist/foundations/utilities/compose-handlers.js +0 -20
  268. package/dist/foundations/utilities/compose-handlers.js.map +0 -1
  269. package/dist/foundations/utilities/compose-ref.d.ts.map +0 -1
  270. package/dist/foundations/utilities/compose-ref.js +0 -18
  271. package/dist/foundations/utilities/compose-ref.js.map +0 -1
  272. package/dist/foundations/utilities/event-types.d.ts +0 -20
  273. package/dist/foundations/utilities/event-types.d.ts.map +0 -1
  274. package/dist/foundations/utilities/merge-props.d.ts +0 -5
  275. package/dist/foundations/utilities/merge-props.d.ts.map +0 -1
  276. package/dist/foundations/utilities/merge-props.js +0 -49
  277. package/dist/foundations/utilities/merge-props.js.map +0 -1
  278. package/dist/foundations/utilities/use-id.d.ts +0 -32
  279. package/dist/foundations/utilities/use-id.d.ts.map +0 -1
  280. package/dist/foundations/utilities/use-id.js.map +0 -1
  281. package/dist/fx/fx.d.ts +0 -33
  282. package/dist/fx/fx.d.ts.map +0 -1
  283. package/dist/fx/fx.js +0 -213
  284. package/dist/fx/fx.js.map +0 -1
  285. package/dist/fx/noop.js +0 -9
  286. package/dist/fx/noop.js.map +0 -1
  287. package/dist/fx/timing.d.ts +0 -159
  288. package/dist/fx/timing.d.ts.map +0 -1
  289. package/dist/fx/timing.js +0 -243
  290. package/dist/fx/timing.js.map +0 -1
  291. package/dist/index.js.map +0 -1
  292. package/dist/jsx/index.d.ts +0 -2
  293. package/dist/jsx/index.js +0 -4
  294. package/dist/jsx/types.d.ts.map +0 -1
  295. package/dist/jsx/types.js +0 -2
  296. package/dist/jsx/utils.d.ts +0 -5
  297. package/dist/jsx/utils.d.ts.map +0 -1
  298. package/dist/jsx/utils.js +0 -19
  299. package/dist/jsx/utils.js.map +0 -1
  300. package/dist/jsx-dev-runtime.d.ts.map +0 -1
  301. package/dist/jsx-dev-runtime.js.map +0 -1
  302. package/dist/jsx-runtime.d.ts.map +0 -1
  303. package/dist/jsx-runtime.js.map +0 -1
  304. package/dist/jsx-runtime2.d.ts +0 -3
  305. package/dist/jsx-runtime2.js +0 -4
  306. package/dist/renderer/attributes.js +0 -232
  307. package/dist/renderer/attributes.js.map +0 -1
  308. package/dist/renderer/boundaries.js +0 -266
  309. package/dist/renderer/boundaries.js.map +0 -1
  310. package/dist/renderer/child-shape.js +0 -85
  311. package/dist/renderer/child-shape.js.map +0 -1
  312. package/dist/renderer/children-fastpath.js +0 -149
  313. package/dist/renderer/children-fastpath.js.map +0 -1
  314. package/dist/renderer/children.js +0 -160
  315. package/dist/renderer/children.js.map +0 -1
  316. package/dist/renderer/cleanup.js +0 -210
  317. package/dist/renderer/cleanup.js.map +0 -1
  318. package/dist/renderer/component-host-cleanup.js +0 -68
  319. package/dist/renderer/component-host-cleanup.js.map +0 -1
  320. package/dist/renderer/component-host-instances.js +0 -65
  321. package/dist/renderer/component-host-instances.js.map +0 -1
  322. package/dist/renderer/component-host.js +0 -247
  323. package/dist/renderer/component-host.js.map +0 -1
  324. package/dist/renderer/dom-host.js +0 -13
  325. package/dist/renderer/dom-host.js.map +0 -1
  326. package/dist/renderer/dom-internal.js +0 -186
  327. package/dist/renderer/dom-internal.js.map +0 -1
  328. package/dist/renderer/dom.js +0 -10
  329. package/dist/renderer/element-children.js +0 -279
  330. package/dist/renderer/element-children.js.map +0 -1
  331. package/dist/renderer/env.js +0 -2
  332. package/dist/renderer/error-boundary-dom.js +0 -78
  333. package/dist/renderer/error-boundary-dom.js.map +0 -1
  334. package/dist/renderer/evaluate-dom-range.js +0 -85
  335. package/dist/renderer/evaluate-dom-range.js.map +0 -1
  336. package/dist/renderer/evaluate-reconcile.js +0 -282
  337. package/dist/renderer/evaluate-reconcile.js.map +0 -1
  338. package/dist/renderer/evaluate.js +0 -84
  339. package/dist/renderer/evaluate.js.map +0 -1
  340. package/dist/renderer/fastpath.js +0 -150
  341. package/dist/renderer/fastpath.js.map +0 -1
  342. package/dist/renderer/for-commit-dom-map.js +0 -83
  343. package/dist/renderer/for-commit-dom-map.js.map +0 -1
  344. package/dist/renderer/for-commit-removal.js +0 -36
  345. package/dist/renderer/for-commit-removal.js.map +0 -1
  346. package/dist/renderer/for-commit-reorder.js +0 -89
  347. package/dist/renderer/for-commit-reorder.js.map +0 -1
  348. package/dist/renderer/for-commit.js +0 -314
  349. package/dist/renderer/for-commit.js.map +0 -1
  350. package/dist/renderer/index.js +0 -38
  351. package/dist/renderer/index.js.map +0 -1
  352. package/dist/renderer/keyed-children.js +0 -32
  353. package/dist/renderer/keyed-children.js.map +0 -1
  354. package/dist/renderer/keyed.js +0 -167
  355. package/dist/renderer/keyed.js.map +0 -1
  356. package/dist/renderer/namespaces.js +0 -23
  357. package/dist/renderer/namespaces.js.map +0 -1
  358. package/dist/renderer/prop-bindings.js +0 -280
  359. package/dist/renderer/prop-bindings.js.map +0 -1
  360. package/dist/renderer/reactive-child-dom.js +0 -133
  361. package/dist/renderer/reactive-child-dom.js.map +0 -1
  362. package/dist/renderer/reactive-child-sources.js +0 -184
  363. package/dist/renderer/reactive-child-sources.js.map +0 -1
  364. package/dist/renderer/reactive-children.js +0 -294
  365. package/dist/renderer/reactive-children.js.map +0 -1
  366. package/dist/renderer/reconcile-commit.js +0 -38
  367. package/dist/renderer/reconcile-commit.js.map +0 -1
  368. package/dist/renderer/reconcile-fastpaths.js +0 -107
  369. package/dist/renderer/reconcile-fastpaths.js.map +0 -1
  370. package/dist/renderer/reconcile-resolution.js +0 -187
  371. package/dist/renderer/reconcile-resolution.js.map +0 -1
  372. package/dist/renderer/reconcile.js +0 -39
  373. package/dist/renderer/reconcile.js.map +0 -1
  374. package/dist/renderer/retained-element-rollback.js +0 -277
  375. package/dist/renderer/retained-element-rollback.js.map +0 -1
  376. package/dist/renderer/stable-patch.js +0 -81
  377. package/dist/renderer/stable-patch.js.map +0 -1
  378. package/dist/renderer/static-reuse.js +0 -96
  379. package/dist/renderer/static-reuse.js.map +0 -1
  380. package/dist/renderer/types.js +0 -2
  381. package/dist/renderer/utils.js +0 -256
  382. package/dist/renderer/utils.js.map +0 -1
  383. package/dist/router/access.js +0 -36
  384. package/dist/router/access.js.map +0 -1
  385. package/dist/router/activity.d.ts +0 -10
  386. package/dist/router/activity.d.ts.map +0 -1
  387. package/dist/router/activity.js +0 -87
  388. package/dist/router/activity.js.map +0 -1
  389. package/dist/router/authoring.d.ts +0 -22
  390. package/dist/router/authoring.d.ts.map +0 -1
  391. package/dist/router/authoring.js +0 -198
  392. package/dist/router/authoring.js.map +0 -1
  393. package/dist/router/internal-types.d.ts +0 -31
  394. package/dist/router/internal-types.d.ts.map +0 -1
  395. package/dist/router/lazy.d.ts +0 -19
  396. package/dist/router/lazy.d.ts.map +0 -1
  397. package/dist/router/lazy.js +0 -52
  398. package/dist/router/lazy.js.map +0 -1
  399. package/dist/router/manifest.d.ts +0 -10
  400. package/dist/router/manifest.d.ts.map +0 -1
  401. package/dist/router/manifest.js +0 -49
  402. package/dist/router/manifest.js.map +0 -1
  403. package/dist/router/match.js +0 -122
  404. package/dist/router/match.js.map +0 -1
  405. package/dist/router/navigate.d.ts +0 -11
  406. package/dist/router/navigate.d.ts.map +0 -1
  407. package/dist/router/navigate.js +0 -76
  408. package/dist/router/navigate.js.map +0 -1
  409. package/dist/router/navigation-registry.d.ts +0 -32
  410. package/dist/router/navigation-registry.d.ts.map +0 -1
  411. package/dist/router/navigation-registry.js +0 -105
  412. package/dist/router/navigation-registry.js.map +0 -1
  413. package/dist/router/navigation-scroll.d.ts +0 -14
  414. package/dist/router/navigation-scroll.d.ts.map +0 -1
  415. package/dist/router/navigation-scroll.js +0 -93
  416. package/dist/router/navigation-scroll.js.map +0 -1
  417. package/dist/router/navigation-targets.d.ts +0 -31
  418. package/dist/router/navigation-targets.d.ts.map +0 -1
  419. package/dist/router/navigation-targets.js +0 -255
  420. package/dist/router/navigation-targets.js.map +0 -1
  421. package/dist/router/policy.d.ts +0 -28
  422. package/dist/router/policy.d.ts.map +0 -1
  423. package/dist/router/policy.js +0 -132
  424. package/dist/router/policy.js.map +0 -1
  425. package/dist/router/rendering.d.ts +0 -10
  426. package/dist/router/rendering.d.ts.map +0 -1
  427. package/dist/router/rendering.js +0 -46
  428. package/dist/router/rendering.js.map +0 -1
  429. package/dist/router/resolution.d.ts +0 -4
  430. package/dist/router/resolution.d.ts.map +0 -1
  431. package/dist/router/resolution.js +0 -86
  432. package/dist/router/resolution.js.map +0 -1
  433. package/dist/router/route-context.js +0 -79
  434. package/dist/router/route-context.js.map +0 -1
  435. package/dist/router/route-matching.d.ts +0 -20
  436. package/dist/router/route-matching.d.ts.map +0 -1
  437. package/dist/router/route-matching.js +0 -175
  438. package/dist/router/route-matching.js.map +0 -1
  439. package/dist/router/route-query.d.ts +0 -17
  440. package/dist/router/route-query.d.ts.map +0 -1
  441. package/dist/router/route-query.js +0 -47
  442. package/dist/router/route-query.js.map +0 -1
  443. package/dist/router/route.d.ts +0 -8
  444. package/dist/router/route.js +0 -10
  445. package/dist/router/store.d.ts +0 -50
  446. package/dist/router/store.d.ts.map +0 -1
  447. package/dist/router/store.js +0 -171
  448. package/dist/router/store.js.map +0 -1
  449. package/dist/router/testing.js +0 -4
  450. package/dist/runtime/access.d.ts +0 -20
  451. package/dist/runtime/access.d.ts.map +0 -1
  452. package/dist/runtime/access.js +0 -45
  453. package/dist/runtime/access.js.map +0 -1
  454. package/dist/runtime/child-scope.d.ts +0 -22
  455. package/dist/runtime/child-scope.d.ts.map +0 -1
  456. package/dist/runtime/child-scope.js +0 -87
  457. package/dist/runtime/child-scope.js.map +0 -1
  458. package/dist/runtime/component-cleanup.d.ts +0 -16
  459. package/dist/runtime/component-cleanup.d.ts.map +0 -1
  460. package/dist/runtime/component-cleanup.js +0 -70
  461. package/dist/runtime/component-cleanup.js.map +0 -1
  462. package/dist/runtime/component-commit.js +0 -165
  463. package/dist/runtime/component-commit.js.map +0 -1
  464. package/dist/runtime/component-facade.d.ts +0 -5
  465. package/dist/runtime/component-facade.js +0 -4
  466. package/dist/runtime/component-internal.d.ts +0 -100
  467. package/dist/runtime/component-internal.d.ts.map +0 -1
  468. package/dist/runtime/component-internal.js +0 -219
  469. package/dist/runtime/component-internal.js.map +0 -1
  470. package/dist/runtime/component-lifecycle.d.ts +0 -49
  471. package/dist/runtime/component-lifecycle.d.ts.map +0 -1
  472. package/dist/runtime/component-lifecycle.js +0 -176
  473. package/dist/runtime/component-lifecycle.js.map +0 -1
  474. package/dist/runtime/component-scope.d.ts +0 -55
  475. package/dist/runtime/component-scope.d.ts.map +0 -1
  476. package/dist/runtime/component-scope.js.map +0 -1
  477. package/dist/runtime/component.d.ts +0 -5
  478. package/dist/runtime/component.js +0 -5
  479. package/dist/runtime/context.d.ts +0 -69
  480. package/dist/runtime/context.d.ts.map +0 -1
  481. package/dist/runtime/context.js +0 -210
  482. package/dist/runtime/context.js.map +0 -1
  483. package/dist/runtime/control.d.ts +0 -43
  484. package/dist/runtime/control.d.ts.map +0 -1
  485. package/dist/runtime/control.js +0 -126
  486. package/dist/runtime/control.js.map +0 -1
  487. package/dist/runtime/derive.d.ts +0 -17
  488. package/dist/runtime/derive.d.ts.map +0 -1
  489. package/dist/runtime/derive.js +0 -142
  490. package/dist/runtime/derive.js.map +0 -1
  491. package/dist/runtime/dev-namespace.d.ts +0 -31
  492. package/dist/runtime/dev-namespace.d.ts.map +0 -1
  493. package/dist/runtime/dev-namespace.js +0 -57
  494. package/dist/runtime/dev-namespace.js.map +0 -1
  495. package/dist/runtime/effect.d.ts +0 -32
  496. package/dist/runtime/effect.d.ts.map +0 -1
  497. package/dist/runtime/effect.js +0 -177
  498. package/dist/runtime/effect.js.map +0 -1
  499. package/dist/runtime/error-boundary.d.ts +0 -5
  500. package/dist/runtime/error-boundary.d.ts.map +0 -1
  501. package/dist/runtime/error-boundary.js +0 -31
  502. package/dist/runtime/error-boundary.js.map +0 -1
  503. package/dist/runtime/events.d.ts +0 -58
  504. package/dist/runtime/events.d.ts.map +0 -1
  505. package/dist/runtime/events.js +0 -204
  506. package/dist/runtime/events.js.map +0 -1
  507. package/dist/runtime/execution-model.d.ts +0 -7
  508. package/dist/runtime/execution-model.d.ts.map +0 -1
  509. package/dist/runtime/execution-model.js +0 -15
  510. package/dist/runtime/execution-model.js.map +0 -1
  511. package/dist/runtime/fastlane.d.ts +0 -34
  512. package/dist/runtime/fastlane.d.ts.map +0 -1
  513. package/dist/runtime/fastlane.js +0 -175
  514. package/dist/runtime/fastlane.js.map +0 -1
  515. package/dist/runtime/for-bench.d.ts +0 -41
  516. package/dist/runtime/for-bench.d.ts.map +0 -1
  517. package/dist/runtime/for-bench.js +0 -171
  518. package/dist/runtime/for-bench.js.map +0 -1
  519. package/dist/runtime/for-internal.d.ts +0 -43
  520. package/dist/runtime/for-internal.d.ts.map +0 -1
  521. package/dist/runtime/for-internal.js +0 -98
  522. package/dist/runtime/for-internal.js.map +0 -1
  523. package/dist/runtime/for-reconcile.d.ts +0 -8
  524. package/dist/runtime/for-reconcile.d.ts.map +0 -1
  525. package/dist/runtime/for-reconcile.js +0 -389
  526. package/dist/runtime/for-reconcile.js.map +0 -1
  527. package/dist/runtime/for-scopes.d.ts +0 -26
  528. package/dist/runtime/for-scopes.d.ts.map +0 -1
  529. package/dist/runtime/for-scopes.js +0 -160
  530. package/dist/runtime/for-scopes.js.map +0 -1
  531. package/dist/runtime/for-signals.d.ts +0 -30
  532. package/dist/runtime/for-signals.d.ts.map +0 -1
  533. package/dist/runtime/for-signals.js +0 -139
  534. package/dist/runtime/for-signals.js.map +0 -1
  535. package/dist/runtime/for-types.d.ts +0 -9
  536. package/dist/runtime/for-types.d.ts.map +0 -1
  537. package/dist/runtime/for.d.ts +0 -4
  538. package/dist/runtime/for.js +0 -5
  539. package/dist/runtime/index.d.ts +0 -24
  540. package/dist/runtime/index.js +0 -31
  541. package/dist/runtime/lifecycle-operations.d.ts +0 -31
  542. package/dist/runtime/lifecycle-operations.d.ts.map +0 -1
  543. package/dist/runtime/lifecycle-operations.js.map +0 -1
  544. package/dist/runtime/operations.d.ts +0 -3
  545. package/dist/runtime/operations.js +0 -3
  546. package/dist/runtime/perf-metrics.d.ts +0 -26
  547. package/dist/runtime/perf-metrics.d.ts.map +0 -1
  548. package/dist/runtime/perf-metrics.js +0 -70
  549. package/dist/runtime/perf-metrics.js.map +0 -1
  550. package/dist/runtime/portal.d.ts +0 -22
  551. package/dist/runtime/portal.d.ts.map +0 -1
  552. package/dist/runtime/portal.js.map +0 -1
  553. package/dist/runtime/readable.d.ts +0 -29
  554. package/dist/runtime/readable.d.ts.map +0 -1
  555. package/dist/runtime/readable.js +0 -159
  556. package/dist/runtime/readable.js.map +0 -1
  557. package/dist/runtime/resource-cell.js +0 -114
  558. package/dist/runtime/resource-cell.js.map +0 -1
  559. package/dist/runtime/resource-operation.d.ts +0 -13
  560. package/dist/runtime/resource-operation.d.ts.map +0 -1
  561. package/dist/runtime/resource-operation.js +0 -170
  562. package/dist/runtime/resource-operation.js.map +0 -1
  563. package/dist/runtime/runtime.d.ts.map +0 -1
  564. package/dist/runtime/runtime.js +0 -59
  565. package/dist/runtime/runtime.js.map +0 -1
  566. package/dist/runtime/scheduler.d.ts.map +0 -1
  567. package/dist/runtime/scheduler.js.map +0 -1
  568. package/dist/runtime/selector-store.js +0 -24
  569. package/dist/runtime/selector-store.js.map +0 -1
  570. package/dist/runtime/selector.d.ts +0 -11
  571. package/dist/runtime/selector.d.ts.map +0 -1
  572. package/dist/runtime/selector.js.map +0 -1
  573. package/dist/runtime/snapshot-source.d.ts +0 -10
  574. package/dist/runtime/snapshot-source.d.ts.map +0 -1
  575. package/dist/runtime/snapshot-source.js.map +0 -1
  576. package/dist/runtime/state.d.ts +0 -55
  577. package/dist/runtime/state.d.ts.map +0 -1
  578. package/dist/runtime/state.js.map +0 -1
  579. package/dist/ssg/batch-render.js +0 -103
  580. package/dist/ssg/batch-render.js.map +0 -1
  581. package/dist/ssg/create-static-gen.d.ts +0 -64
  582. package/dist/ssg/create-static-gen.d.ts.map +0 -1
  583. package/dist/ssg/create-static-gen.js +0 -199
  584. package/dist/ssg/create-static-gen.js.map +0 -1
  585. package/dist/ssg/generate-metadata.js +0 -94
  586. package/dist/ssg/generate-metadata.js.map +0 -1
  587. package/dist/ssg/generation-plan.js +0 -70
  588. package/dist/ssg/generation-plan.js.map +0 -1
  589. package/dist/ssg/incremental-manifest.js +0 -56
  590. package/dist/ssg/incremental-manifest.js.map +0 -1
  591. package/dist/ssg/resolve-ssg-data.js +0 -105
  592. package/dist/ssg/resolve-ssg-data.js.map +0 -1
  593. package/dist/ssg/route-utils.js +0 -24
  594. package/dist/ssg/route-utils.js.map +0 -1
  595. package/dist/ssg/static-routes.js +0 -102
  596. package/dist/ssg/static-routes.js.map +0 -1
  597. package/dist/ssg/types.d.ts +0 -189
  598. package/dist/ssg/types.d.ts.map +0 -1
  599. package/dist/ssg/write-static-files.js +0 -73
  600. package/dist/ssg/write-static-files.js.map +0 -1
  601. package/dist/ssr/attrs.js +0 -94
  602. package/dist/ssr/attrs.js.map +0 -1
  603. package/dist/ssr/boundaries.js +0 -113
  604. package/dist/ssr/boundaries.js.map +0 -1
  605. package/dist/ssr/component-runtime.js +0 -111
  606. package/dist/ssr/component-runtime.js.map +0 -1
  607. package/dist/ssr/context.d.ts +0 -50
  608. package/dist/ssr/context.d.ts.map +0 -1
  609. package/dist/ssr/context.js +0 -91
  610. package/dist/ssr/context.js.map +0 -1
  611. package/dist/ssr/errors.d.ts +0 -10
  612. package/dist/ssr/errors.d.ts.map +0 -1
  613. package/dist/ssr/errors.js +0 -14
  614. package/dist/ssr/errors.js.map +0 -1
  615. package/dist/ssr/escape.js +0 -193
  616. package/dist/ssr/escape.js.map +0 -1
  617. package/dist/ssr/hydration-data.js +0 -10
  618. package/dist/ssr/hydration-data.js.map +0 -1
  619. package/dist/ssr/hydration-verify.d.ts +0 -12
  620. package/dist/ssr/hydration-verify.d.ts.map +0 -1
  621. package/dist/ssr/hydration-verify.js +0 -144
  622. package/dist/ssr/hydration-verify.js.map +0 -1
  623. package/dist/ssr/index-internal.d.ts +0 -15
  624. package/dist/ssr/index-internal.d.ts.map +0 -1
  625. package/dist/ssr/index-internal.js +0 -19
  626. package/dist/ssr/index-internal.js.map +0 -1
  627. package/dist/ssr/render-keys.js +0 -16
  628. package/dist/ssr/render-keys.js.map +0 -1
  629. package/dist/ssr/render-resolved.d.ts +0 -20
  630. package/dist/ssr/render-resolved.d.ts.map +0 -1
  631. package/dist/ssr/render-resolved.js +0 -35
  632. package/dist/ssr/render-resolved.js.map +0 -1
  633. package/dist/ssr/render-sync.d.ts +0 -21
  634. package/dist/ssr/render-sync.d.ts.map +0 -1
  635. package/dist/ssr/render-sync.js +0 -275
  636. package/dist/ssr/render-sync.js.map +0 -1
  637. package/dist/ssr/route-policy-resolution.js +0 -78
  638. package/dist/ssr/route-policy-resolution.js.map +0 -1
  639. package/dist/ssr/route-render.d.ts +0 -77
  640. package/dist/ssr/route-render.d.ts.map +0 -1
  641. package/dist/ssr/route-render.js +0 -120
  642. package/dist/ssr/route-render.js.map +0 -1
  643. package/dist/ssr/sink.d.ts +0 -26
  644. package/dist/ssr/sink.d.ts.map +0 -1
  645. package/dist/ssr/sink.js +0 -86
  646. package/dist/ssr/sink.js.map +0 -1
  647. package/dist/ssr/types.d.ts +0 -23
  648. package/dist/ssr/types.d.ts.map +0 -1
  649. package/dist/ssr/verify-hydration.js.map +0 -1
  650. package/dist/testing/index.d.ts.map +0 -1
  651. package/dist/testing/index.js.map +0 -1
@@ -0,0 +1,1449 @@
1
+ import { b as isDevelopmentEnvironment, r as flushRuntimeScheduler, v as logger, x as isProductionEnvironment } from "./access-Bg4RJNC8.js";
2
+ import { f as notifyReadableReaders, i as cleanupReadableSubscriptionSources, l as markReactivePropsDirtySource, p as recordReadableRead, u as markReadableDerivedSubscribersDirty } from "./fastlane-Dw8SOBr9.js";
3
+ import { n as Fragment, t as ELEMENT_TYPE } from "./jsx-CUpRxrLH.js";
4
+ import { r as mountComponent } from "./component-internal-B3z7GXlD.js";
5
+ import { d as getCurrentAppRenderRuntime, f as getCurrentComponentInstance } from "./component-scope-CC3cojX9.js";
6
+ import { g as cleanupComponentGeneration, h as cleanupComponent, i as beginLifecycleCommitBatch, l as flushLifecycleCommitBatch, m as isPromiseLike, o as discardLifecycleCommitBatch, s as drainLifecycleCommitErrors } from "./component-lifecycle-CO4hXlP4.js";
7
+ import { _ as teardownNodeSubtree } from "./cleanup-COv77su2.js";
8
+ import { n as getActiveRenderContext } from "./render-context-Clw3rFiO.js";
9
+ import { n as syncRouteActivitySnapshot } from "./route-activity-CNJfpwx-.js";
10
+ import { r as clearDefaultPortalForInstance, t as DefaultPortal } from "./portal-CyU3Ucf2.js";
11
+ import { A as insertRecordSorted, C as getCurrentPathPrefix, D as getRoutes, E as getRouteRecords, F as snapshotRouteState, I as computeRank, L as normalizeRouteSegmentName, M as pushRegistrationScope, N as restoreRouteState, O as hasActivePageScope, P as setDefaultRouteAuthOptions, R as parseSegments, S as getCurrentPageScope, T as getDefaultRouteAuthOptions, _ as getCurrentInheritedAuthRequirements, a as resolveRouteFromRoutes, b as getCurrentLayoutChain, c as deepFreeze, f as addRouteToStores, g as getActiveRoutes, j as lockRouteRegistration, l as makeQuery, m as clearRouteState, n as computeMatchesFromRoutes, p as assertRouteRegistrationUnlocked, r as computeRouteActivityMatches, u as parseLocation, v as getCurrentInheritedMeta, w as getCurrentScopeKind, x as getCurrentPageChain, y as getCurrentInheritedPolicies } from "./route-matching-vJpvLVbX.js";
12
+ import { d as hasRouteRenderData, f as resolveRouteRequest, l as getRouteRenderContext, u as getRouteRenderData, y as createRouteHandler } from "./deferred-lKE8uR0z.js";
13
+ import { allOf } from "@askrjs/auth";
14
+ //#region src/runtime/execution-model.ts
15
+ const EXECUTION_MODEL_KEY = Symbol.for("__ASKR_EXECUTION_MODEL__");
16
+ function getExecutionModel() {
17
+ return globalThis[EXECUTION_MODEL_KEY];
18
+ }
19
+ function assertExecutionModel(model) {
20
+ const g = globalThis;
21
+ const cur = g[EXECUTION_MODEL_KEY];
22
+ if (cur && cur !== model) throw new Error(`[Askr] mixing execution models is not allowed (current: ${cur}, attempted: ${model}). Choose exactly one: createSPA, createSSR, or createIslands.`);
23
+ if (!cur) g[EXECUTION_MODEL_KEY] = model;
24
+ }
25
+ //#endregion
26
+ //#region src/router/access.ts
27
+ function compileNodePolicies(node) {
28
+ return node.policies ? [...node.policies] : [];
29
+ }
30
+ //#endregion
31
+ //#region src/router/authoring.ts
32
+ function validateRoutePath(path) {
33
+ if (!path.startsWith("/")) throw new Error(`Route path must begin with "/". Got: "${path}"`);
34
+ if (/\/{2,}/.test(path)) throw new Error("Route path cannot contain consecutive slashes.");
35
+ if (/:([^/{}]+)/.test(path)) {
36
+ const suggested = path.replace(/:([^/{}]+)/g, "{$1}");
37
+ throw new Error(`Route parameter syntax uses {name} interpolation, not :name. Use "${suggested}" instead of "${path}".`);
38
+ }
39
+ const segments = path.split("/").filter(Boolean);
40
+ const seenParamNames = /* @__PURE__ */ new Set();
41
+ for (let index = 0; index < segments.length; index++) {
42
+ const segment = segments[index];
43
+ if (segment === "*") continue;
44
+ const hasOpenBrace = segment.includes("{");
45
+ const hasCloseBrace = segment.includes("}");
46
+ if (!hasOpenBrace && !hasCloseBrace) continue;
47
+ if (!(segment.startsWith("{") && segment.endsWith("}"))) throw new Error("Route parameter segments must use complete {name} interpolation.");
48
+ const rawParamName = normalizeRouteSegmentName(segment.slice(1, -1));
49
+ const isSplat = rawParamName.startsWith("*");
50
+ const paramName = isSplat ? normalizeRouteSegmentName(rawParamName.slice(1)) : rawParamName;
51
+ if (!paramName) throw new Error(isSplat ? "Route splat parameter name cannot be empty." : "Route parameter name cannot be empty.");
52
+ if (isSplat && paramName === "*") throw new Error("Route named splat parameter name cannot be \"*\".");
53
+ if (isSplat && index !== segments.length - 1) throw new Error("Route named splat parameters must be the final segment.");
54
+ if (seenParamNames.has(paramName)) throw new Error(`Route path cannot reuse duplicate parameter name "${paramName}".`);
55
+ seenParamNames.add(paramName);
56
+ }
57
+ }
58
+ function normalizeAbsoluteRoutePath(path) {
59
+ if (!path || path === "/") return "/";
60
+ return (path.endsWith("/") ? path.slice(0, -1) : path) || "/";
61
+ }
62
+ function joinRoutePaths(prefix, path) {
63
+ const normalizedPrefix = normalizeAbsoluteRoutePath(prefix || "/");
64
+ const normalizedPath = path.replace(/^\/+|\/+$/g, "");
65
+ if (!normalizedPath) return normalizedPrefix;
66
+ return normalizedPrefix === "/" ? `/${normalizedPath}` : `${normalizedPrefix}/${normalizedPath}`;
67
+ }
68
+ function resolvePageScopePath(path) {
69
+ if (!path) throw new Error("page(path, Component, fn) requires a non-empty path.");
70
+ if (path.startsWith("/")) {
71
+ validateRoutePath(path);
72
+ return normalizeAbsoluteRoutePath(path);
73
+ }
74
+ return joinRoutePaths(getCurrentPathPrefix(), path);
75
+ }
76
+ function resolveIndexPath() {
77
+ return normalizeAbsoluteRoutePath(getCurrentPathPrefix() || "/");
78
+ }
79
+ function resolveRouteRegistrationPath(path) {
80
+ if (path.startsWith("/")) {
81
+ if (hasActivePageScope()) throw new Error(`Child route paths inside page() must be relative. Use "${path.slice(1)}" instead of "${path}".`);
82
+ validateRoutePath(path);
83
+ return normalizeAbsoluteRoutePath(path);
84
+ }
85
+ const prefix = getCurrentPathPrefix();
86
+ if (!prefix) throw new Error(`Route path must begin with "/". Got: "${path}"`);
87
+ return joinRoutePaths(prefix, path);
88
+ }
89
+ function pushGroupScope(options, fn) {
90
+ const policies = compileNodePolicies(options);
91
+ pushRegistrationScope({
92
+ kind: "group",
93
+ pathPrefix: getCurrentPathPrefix(),
94
+ layout: options.layout,
95
+ auth: options.auth,
96
+ policies,
97
+ meta: options.meta
98
+ }, fn);
99
+ }
100
+ function pushPageScope(path, Component, options, fn) {
101
+ if (hasActivePageScope()) throw new Error("page() cannot be nested inside another page(). Use route() for child leaves or group() for inherited behavior inside the existing page scope.");
102
+ const policies = compileNodePolicies(options);
103
+ pushRegistrationScope({
104
+ kind: "page",
105
+ pathPrefix: resolvePageScopePath(path),
106
+ page: Component,
107
+ hasIndex: false,
108
+ auth: options.auth,
109
+ policies,
110
+ meta: options.meta
111
+ }, fn);
112
+ }
113
+ function normalizeRouteOptions(options) {
114
+ if (!options) return;
115
+ const loader = options.loader;
116
+ const preload = options.preload;
117
+ const policies = compileNodePolicies(options);
118
+ if (!loader && !preload && !options.entries && policies.length === 0 && !options.title && !options.namespace && !options.search && !options.meta && !options.actions && options.auth === void 0) return;
119
+ return {
120
+ ...loader ? { loader } : {},
121
+ ...preload ? { preload } : {},
122
+ ...options.entries ? { entries: options.entries } : {},
123
+ ...options.auth !== void 0 ? { auth: options.auth } : {},
124
+ ...policies.length > 0 ? { policies } : {},
125
+ ...options.title ? { title: options.title } : {},
126
+ ...options.namespace ? { namespace: options.namespace } : {},
127
+ ...options.search ? { search: options.search } : {},
128
+ ...options.meta ? { meta: options.meta } : {},
129
+ ...options.actions ? { actions: options.actions } : {}
130
+ };
131
+ }
132
+ function registerRouteAtResolvedPath(path, Component, options, metadata) {
133
+ validateRoutePath(path);
134
+ const chain = getCurrentLayoutChain();
135
+ const pageChain = getCurrentPageChain();
136
+ const segments = parseSegments(path);
137
+ const rank = computeRank(segments);
138
+ const isFallback = metadata?.isFallback ?? path === "/*";
139
+ const comp = Component;
140
+ const normalizedOptions = normalizeRouteOptions(options);
141
+ const policies = [...getCurrentInheritedPolicies(), ...normalizedOptions?.policies ?? []];
142
+ const authRequirements = [...getCurrentInheritedAuthRequirements(), ...normalizedOptions?.auth ? [normalizedOptions.auth] : []];
143
+ const auth = authRequirements.length === 0 ? void 0 : authRequirements.length === 1 ? authRequirements[0] : allOf(...authRequirements);
144
+ const metaChain = [...getCurrentInheritedMeta(), ...normalizedOptions?.meta ? [normalizedOptions.meta] : []];
145
+ const handler = createRouteHandler(comp, pageChain, chain);
146
+ const renderHandler = createRouteHandler(comp, pageChain, chain, true);
147
+ insertRecordSorted({
148
+ path,
149
+ component: comp,
150
+ segments,
151
+ rank,
152
+ layoutChain: chain,
153
+ pageChain,
154
+ options: normalizedOptions ? {
155
+ ...normalizedOptions,
156
+ ...auth ? { auth } : {},
157
+ ...policies.length > 0 ? { policies } : {}
158
+ } : policies.length > 0 ? {
159
+ policies,
160
+ ...auth ? { auth } : {}
161
+ } : auth ? { auth } : {},
162
+ ...metaChain.length > 0 ? { metaChain } : {},
163
+ isFallback,
164
+ handler,
165
+ renderHandler,
166
+ ...metadata?.fallbackPrefix ? { fallbackPrefix: metadata.fallbackPrefix } : {}
167
+ });
168
+ addRouteToStores({
169
+ path,
170
+ handler,
171
+ namespace: normalizedOptions?.namespace ?? options?.namespace,
172
+ ...metadata?.fallbackPrefix ? { fallbackPrefix: metadata.fallbackPrefix } : {}
173
+ });
174
+ }
175
+ function group(options, fn) {
176
+ pushGroupScope(options, fn);
177
+ }
178
+ function page(path, Component, optionsOrFn, maybeFn) {
179
+ const options = typeof optionsOrFn === "function" ? {} : optionsOrFn;
180
+ const fn = typeof optionsOrFn === "function" ? optionsOrFn : maybeFn;
181
+ if (typeof Component !== "function") throw new Error("page(path, Component, fn) requires a component function as the second argument.");
182
+ if (typeof fn !== "function") throw new Error("page(path, Component, fn) requires a route definition callback as the final argument.");
183
+ pushPageScope(path, Component, options, fn);
184
+ }
185
+ function index(Component, options) {
186
+ const pageScope = getCurrentPageScope();
187
+ if (pageScope?.hasIndex) throw new Error("page() cannot declare multiple index routes.");
188
+ if (pageScope) pageScope.hasIndex = true;
189
+ registerRouteAtResolvedPath(resolveIndexPath(), Component, options);
190
+ }
191
+ function fallback(Component) {
192
+ if (hasActivePageScope()) {
193
+ if (getCurrentScopeKind() !== "page") throw new Error("fallback() inside page() must be declared directly in the page scope, not inside nested group().");
194
+ registerRouteAtResolvedPath(`${getCurrentPathPrefix()}/*`, Component, void 0, {
195
+ isFallback: true,
196
+ fallbackPrefix: getCurrentPathPrefix()
197
+ });
198
+ return;
199
+ }
200
+ if (!(getCurrentInheritedPolicies().length === 0 && getCurrentInheritedAuthRequirements().length === 0)) throw new Error("fallback() can only be registered at the root scope. Use route(\"/*\", Component) if you need compatibility behavior.");
201
+ registerRouteAtResolvedPath("/*", Component, void 0, {
202
+ isFallback: true,
203
+ fallbackPrefix: "/"
204
+ });
205
+ }
206
+ function registerRoutes(definition, options = {}) {
207
+ setDefaultRouteAuthOptions(options.auth);
208
+ definition();
209
+ }
210
+ function route(path, Component, options) {
211
+ if (typeof path === "undefined") throw new Error("route() is only for route registration. Use currentRoute() inside components.");
212
+ if (getExecutionModel() === "islands") throw new Error("Routes are not supported with islands. Use createSPA (client) or createSSR (server) instead.");
213
+ const currentInst = getCurrentComponentInstance();
214
+ if (currentInst && currentInst.ssr) throw new Error("route() cannot be called during SSR rendering. Register routes at module load time instead.");
215
+ assertRouteRegistrationUnlocked();
216
+ if (typeof Component !== "function") throw new Error("route(path, Component) requires a component function as the second argument. Passing JSX elements or VNodes directly is not supported.");
217
+ if (options?.search && options.search.kind !== "object") throw new Error("route search must be an object schema.");
218
+ registerRouteAtResolvedPath(resolveRouteRegistrationPath(path), Component, options);
219
+ return Object.freeze({
220
+ path: resolveRouteRegistrationPath(path),
221
+ ...options?.search ? { searchSchema: options.search } : {}
222
+ });
223
+ }
224
+ //#endregion
225
+ //#region src/common/app-render-runtime.ts
226
+ const stagedRouteLocations = /* @__PURE__ */ new WeakMap();
227
+ function createAppRenderRuntime(input = {}) {
228
+ return {
229
+ framework: Object.freeze({ ...input.framework }),
230
+ route: input.route,
231
+ hasRoute: input.hasRoute ?? false
232
+ };
233
+ }
234
+ function stageAppRenderRouteLocation(runtime, href) {
235
+ stagedRouteLocations.set(runtime, href);
236
+ }
237
+ function getStagedAppRenderRouteLocation(runtime) {
238
+ return runtime ? stagedRouteLocations.get(runtime) : void 0;
239
+ }
240
+ function clearStagedAppRenderRouteLocation(runtime) {
241
+ if (runtime) stagedRouteLocations.delete(runtime);
242
+ }
243
+ //#endregion
244
+ //#region src/router/activity.ts
245
+ let currentRouteSnapshot = buildRouteSnapshot("/", "", "");
246
+ const currentRouteSource = (() => currentRouteSnapshot);
247
+ currentRouteSource._readers = /* @__PURE__ */ new Map();
248
+ let serverLocation = null;
249
+ function setServerLocation(url) {
250
+ serverLocation = url;
251
+ if (url) {
252
+ const parsed = parseLocation(url);
253
+ syncRouteActivitySnapshot(parsed.pathname, computeMatchesFromRoutes(parsed.pathname, getActiveRoutes()));
254
+ return;
255
+ }
256
+ syncRouteActivitySnapshot(currentRouteSnapshot.path, currentRouteSnapshot.matches);
257
+ }
258
+ function buildRouteSnapshot(pathname, search, hash) {
259
+ const query = makeQuery(search);
260
+ const matches = computeMatchesFromRoutes(pathname, getActiveRoutes());
261
+ return Object.freeze({
262
+ path: pathname,
263
+ params: deepFreeze({ ...matches[0]?.params }),
264
+ query,
265
+ hash: hash || null,
266
+ matches: Object.freeze(matches)
267
+ });
268
+ }
269
+ function setCurrentRouteSnapshot(pathname, search, hash, activityMatches) {
270
+ currentRouteSnapshot = buildRouteSnapshot(pathname, search, hash);
271
+ syncRouteActivitySnapshot(pathname, activityMatches ?? currentRouteSnapshot.matches);
272
+ const instance = getCurrentComponentInstance();
273
+ markReadableDerivedSubscribersDirty(currentRouteSource);
274
+ markReactivePropsDirtySource(currentRouteSource);
275
+ notifyReadableReaders(currentRouteSource, instance);
276
+ }
277
+ function readCurrentRouteLocation() {
278
+ const renderContext = getActiveRenderContext();
279
+ if (renderContext?.url) return parseLocation(renderContext.url);
280
+ const stagedRouteLocation = getStagedAppRenderRouteLocation(getCurrentAppRenderRuntime());
281
+ if (stagedRouteLocation) return parseLocation(stagedRouteLocation);
282
+ if (typeof window !== "undefined" && window.location) return {
283
+ pathname: window.location.pathname || "/",
284
+ search: window.location.search || "",
285
+ hash: window.location.hash || ""
286
+ };
287
+ if (serverLocation) return parseLocation(serverLocation);
288
+ return {
289
+ pathname: currentRouteSnapshot.path,
290
+ search: "",
291
+ hash: currentRouteSnapshot.hash ?? ""
292
+ };
293
+ }
294
+ function readCurrentRouteSnapshot() {
295
+ if (!getCurrentComponentInstance()) throw new Error("currentRoute() can only be called during component render execution. Call currentRoute() from inside your component function.");
296
+ const { pathname, search, hash } = readCurrentRouteLocation();
297
+ const query = makeQuery(search);
298
+ const matches = computeMatchesFromRoutes(pathname, getActiveRoutes());
299
+ const params = deepFreeze({ ...getActiveRenderContext()?.params ?? matches[0]?.params ?? {} });
300
+ return Object.freeze({
301
+ path: pathname,
302
+ params,
303
+ query,
304
+ hash: hash || null,
305
+ matches: Object.freeze(matches)
306
+ });
307
+ }
308
+ function currentRoute() {
309
+ const instance = getCurrentComponentInstance();
310
+ if (!instance) throw new Error("currentRoute() can only be called during component render execution. Call currentRoute() from inside your component function.");
311
+ if (typeof window === "undefined" || instance.ssr) return readCurrentRouteSnapshot();
312
+ recordReadableRead(currentRouteSource);
313
+ return readCurrentRouteSnapshot();
314
+ }
315
+ function syncCurrentRouteSnapshot(pathname, search, hash, activityMatches) {
316
+ setCurrentRouteSnapshot(pathname, search, hash, activityMatches);
317
+ }
318
+ //#endregion
319
+ //#region src/router/lazy.ts
320
+ const pendingLazy = /* @__PURE__ */ new Set();
321
+ const registryLazyImports = /* @__PURE__ */ new WeakMap();
322
+ const manifestLazyImports = /* @__PURE__ */ new WeakMap();
323
+ function lazy(factory) {
324
+ let resolved = null;
325
+ let loadError = null;
326
+ const promise = factory().then((mod) => {
327
+ resolved = typeof mod === "function" ? mod : mod.default;
328
+ pendingLazy.delete(promise);
329
+ }, (err) => {
330
+ loadError = err;
331
+ pendingLazy.delete(promise);
332
+ });
333
+ pendingLazy.add(promise);
334
+ return ((params) => {
335
+ if (loadError) throw loadError;
336
+ if (!resolved) throw new Error("lazy() component used before it was resolved. Await createSPA() / hydrateSPA() to ensure all chunks load first.");
337
+ return resolved(params);
338
+ });
339
+ }
340
+ function _snapshotLazy() {
341
+ return [...pendingLazy];
342
+ }
343
+ function _snapshotRouteSourceLazy(source) {
344
+ const imports = /* @__PURE__ */ new Set();
345
+ if (source.registry) for (const lazyImport of registryLazyImports.get(source.registry) ?? []) imports.add(lazyImport);
346
+ const manifest = source.manifest ?? source.registry?.manifest;
347
+ if (manifest) for (const lazyImport of manifestLazyImports.get(manifest) ?? []) imports.add(lazyImport);
348
+ return [...imports];
349
+ }
350
+ function _drainLazy(additionalPending = []) {
351
+ const combined = /* @__PURE__ */ new Set([...additionalPending, ...pendingLazy]);
352
+ if (combined.size === 0) return Promise.resolve();
353
+ return Promise.allSettled(combined).then(() => void 0);
354
+ }
355
+ function associateRouteSourceLazy(registry, manifest, lazyImports) {
356
+ if (lazyImports.length === 0) return;
357
+ registryLazyImports.set(registry, lazyImports);
358
+ manifestLazyImports.set(manifest, lazyImports);
359
+ }
360
+ function clearPendingLazy() {
361
+ pendingLazy.clear();
362
+ }
363
+ function restorePendingLazy(lazyImports) {
364
+ pendingLazy.clear();
365
+ for (const lazyImport of lazyImports) pendingLazy.add(lazyImport);
366
+ }
367
+ //#endregion
368
+ //#region src/router/manifest.ts
369
+ function getManifest() {
370
+ const auth = getDefaultRouteAuthOptions();
371
+ return {
372
+ records: [...getRouteRecords()],
373
+ ...auth ? { auth } : {}
374
+ };
375
+ }
376
+ function _applyManifest(manifest) {
377
+ setDefaultRouteAuthOptions(manifest.auth);
378
+ for (const record of manifest.records) {
379
+ insertRecordSorted(record);
380
+ addRouteToStores({
381
+ path: record.path,
382
+ handler: record.handler,
383
+ namespace: record.options.namespace,
384
+ ..."fallbackPrefix" in record && typeof record.fallbackPrefix === "string" ? { fallbackPrefix: record.fallbackPrefix } : {}
385
+ });
386
+ }
387
+ }
388
+ function clearRoutes() {
389
+ clearRouteState();
390
+ clearPendingLazy();
391
+ }
392
+ function createRouteRegistry(definition, options = {}) {
393
+ const previous = snapshotRouteState();
394
+ const previousLazy = _snapshotLazy();
395
+ clearRoutes();
396
+ try {
397
+ registerRoutes(definition, options);
398
+ const manifest = getManifest();
399
+ const registry = Object.freeze({
400
+ manifest,
401
+ routes: getRoutes()
402
+ });
403
+ associateRouteSourceLazy(registry, manifest, _snapshotLazy());
404
+ return registry;
405
+ } finally {
406
+ restoreRouteState(previous);
407
+ restorePendingLazy(previousLazy);
408
+ }
409
+ }
410
+ //#endregion
411
+ //#region src/router/navigation-registry.ts
412
+ let currentInstance = null;
413
+ let currentPathname = "/";
414
+ let currentHref = "/";
415
+ let navigationRegistryHost = null;
416
+ const registeredApps = [];
417
+ function configureNavigationRegistryHost(host) {
418
+ navigationRegistryHost = host;
419
+ }
420
+ function getCurrentPathname() {
421
+ return currentPathname;
422
+ }
423
+ function getCurrentHref() {
424
+ return currentHref;
425
+ }
426
+ function setCurrentRouteLocation(pathname, href) {
427
+ currentPathname = pathname;
428
+ currentHref = href;
429
+ }
430
+ function getWindowHref$1() {
431
+ if (typeof window === "undefined") return currentHref;
432
+ return `${window.location.pathname}${window.location.search}${window.location.hash}`;
433
+ }
434
+ function parseTargetUrl(path) {
435
+ const pathname = window.location.pathname || "/";
436
+ const search = window.location.search || "";
437
+ const hash = window.location.hash || "";
438
+ const href = typeof window.location.href === "string" ? window.location.href : "";
439
+ const base = href && href !== "about:blank" && !href.startsWith("about:") && !href.startsWith("data:") ? href : `http://localhost${pathname}${search}${hash}`;
440
+ return new URL(path, base);
441
+ }
442
+ function getRegisteredAppsSnapshot() {
443
+ return [...registeredApps];
444
+ }
445
+ function hasRegisteredApps() {
446
+ return registeredApps.length > 0;
447
+ }
448
+ function syncAppRegistrationLocation(app, pathname, href) {
449
+ app.pathname = pathname;
450
+ app.href = href;
451
+ }
452
+ function collectRouteActivityMatches(pathname, apps = registeredApps) {
453
+ const matches = [];
454
+ const seenPaths = /* @__PURE__ */ new Set();
455
+ for (const app of apps) {
456
+ const appMatches = computeRouteActivityMatches(pathname, {
457
+ manifest: app.manifest,
458
+ routes: app.routes
459
+ });
460
+ for (const match of appMatches) {
461
+ if (seenPaths.has(match.path)) continue;
462
+ seenPaths.add(match.path);
463
+ matches.push(match);
464
+ }
465
+ }
466
+ return matches;
467
+ }
468
+ function syncRegisteredRouteSnapshot() {
469
+ if (typeof window === "undefined") return;
470
+ const pathname = window.location.pathname || "/";
471
+ syncCurrentRouteSnapshot(pathname, window.location.search || "", window.location.hash || "", collectRouteActivityMatches(pathname));
472
+ }
473
+ function registerAppInstance(instance, path, source = {}) {
474
+ const existingIndex = registeredApps.findIndex((app) => app.instance === instance);
475
+ const registration = {
476
+ instance,
477
+ pathname: path,
478
+ href: getWindowHref$1(),
479
+ ...source
480
+ };
481
+ if (existingIndex >= 0) registeredApps[existingIndex] = registration;
482
+ else registeredApps.push(registration);
483
+ currentInstance = instance;
484
+ currentPathname = path;
485
+ currentHref = getWindowHref$1();
486
+ syncRegisteredRouteSnapshot();
487
+ if (isProductionEnvironment()) lockRouteRegistration();
488
+ }
489
+ function unregisterAppInstance(instance) {
490
+ const existingIndex = registeredApps.findIndex((app) => app.instance === instance);
491
+ if (existingIndex >= 0) registeredApps.splice(existingIndex, 1);
492
+ syncRegisteredRouteSnapshot();
493
+ if (currentInstance !== instance) return;
494
+ const nextApp = registeredApps.length > 0 ? registeredApps[registeredApps.length - 1] : null;
495
+ currentInstance = nextApp?.instance ?? null;
496
+ if (nextApp) {
497
+ currentPathname = nextApp.pathname;
498
+ currentHref = nextApp.href;
499
+ syncRegisteredRouteSnapshot();
500
+ return;
501
+ }
502
+ navigationRegistryHost?.cancelRouteRequests();
503
+ currentPathname = "/";
504
+ currentHref = "/";
505
+ if (typeof window === "undefined") syncCurrentRouteSnapshot("/", "", "", []);
506
+ }
507
+ //#endregion
508
+ //#region src/router/navigation-scroll.ts
509
+ const DEFAULT_SCROLL_RESTORATION = {
510
+ enabled: true,
511
+ navigation: "top",
512
+ history: "restore"
513
+ };
514
+ let scrollRestorationOptions = { ...DEFAULT_SCROLL_RESTORATION };
515
+ const scrollPositions = /* @__PURE__ */ new Map();
516
+ function getWindowHref() {
517
+ if (typeof window === "undefined") return "/";
518
+ return `${window.location.pathname}${window.location.search}${window.location.hash}`;
519
+ }
520
+ function normalizeScrollRestorationOptions(options) {
521
+ if (options === false) return {
522
+ enabled: false,
523
+ navigation: DEFAULT_SCROLL_RESTORATION.navigation,
524
+ history: DEFAULT_SCROLL_RESTORATION.history
525
+ };
526
+ if (options === true || options === void 0) return { ...DEFAULT_SCROLL_RESTORATION };
527
+ return {
528
+ enabled: true,
529
+ navigation: options.navigation ?? DEFAULT_SCROLL_RESTORATION.navigation,
530
+ history: options.history ?? DEFAULT_SCROLL_RESTORATION.history
531
+ };
532
+ }
533
+ function readScrollPosition() {
534
+ if (typeof window === "undefined") return {
535
+ x: 0,
536
+ y: 0
537
+ };
538
+ return {
539
+ x: typeof window.scrollX === "number" ? window.scrollX : typeof window.pageXOffset === "number" ? window.pageXOffset : 0,
540
+ y: typeof window.scrollY === "number" ? window.scrollY : typeof window.pageYOffset === "number" ? window.pageYOffset : 0
541
+ };
542
+ }
543
+ function writeHistoryScrollPosition(href, position) {
544
+ if (typeof window === "undefined" || getWindowHref() !== href) return;
545
+ if (typeof window.history?.replaceState !== "function") return;
546
+ const state = window.history.state && typeof window.history.state === "object" ? window.history.state : {};
547
+ window.history.replaceState({
548
+ ...state,
549
+ path: href,
550
+ scroll: position
551
+ }, "", href);
552
+ }
553
+ function saveScrollPosition(href) {
554
+ if (!scrollRestorationOptions.enabled || typeof window === "undefined") return;
555
+ const position = readScrollPosition();
556
+ scrollPositions.set(href, position);
557
+ writeHistoryScrollPosition(href, position);
558
+ }
559
+ function scrollToPosition(position) {
560
+ if (typeof window === "undefined" || typeof window.scrollTo !== "function") return;
561
+ window.scrollTo(position.x, position.y);
562
+ }
563
+ function applyNavigationScroll(behavior) {
564
+ const nextBehavior = behavior ?? scrollRestorationOptions.navigation;
565
+ if (!scrollRestorationOptions.enabled || nextBehavior === "preserve") return;
566
+ scrollToPosition({
567
+ x: 0,
568
+ y: 0
569
+ });
570
+ }
571
+ function applyHistoryScroll(href, state) {
572
+ if (!scrollRestorationOptions.enabled) return;
573
+ if (scrollRestorationOptions.history === "preserve") return;
574
+ if (scrollRestorationOptions.history === "top") {
575
+ scrollToPosition({
576
+ x: 0,
577
+ y: 0
578
+ });
579
+ return;
580
+ }
581
+ const fromState = state && typeof state === "object" && "scroll" in state ? state.scroll : void 0;
582
+ scrollToPosition((fromState && typeof fromState.x === "number" && typeof fromState.y === "number" ? {
583
+ x: fromState.x,
584
+ y: fromState.y
585
+ } : scrollPositions.get(href)) ?? {
586
+ x: 0,
587
+ y: 0
588
+ });
589
+ }
590
+ function configureScrollRestoration(options) {
591
+ scrollRestorationOptions = normalizeScrollRestorationOptions(options);
592
+ if (typeof window === "undefined") return;
593
+ if ("scrollRestoration" in window.history) try {
594
+ window.history.scrollRestoration = scrollRestorationOptions.enabled ? "manual" : "auto";
595
+ } catch {}
596
+ }
597
+ //#endregion
598
+ //#region src/router/metadata.ts
599
+ function freezeMeta(meta) {
600
+ if (meta.openGraph) Object.freeze(meta.openGraph);
601
+ if (meta.links) {
602
+ for (const link of meta.links) Object.freeze(link);
603
+ Object.freeze(meta.links);
604
+ }
605
+ if (Array.isArray(meta.jsonLd)) Object.freeze(meta.jsonLd);
606
+ if (meta.html) Object.freeze(meta.html);
607
+ return Object.freeze(meta);
608
+ }
609
+ function mergeMeta(current, next) {
610
+ return {
611
+ ...current.title !== void 0 ? { title: current.title } : {},
612
+ ...current.description !== void 0 ? { description: current.description } : {},
613
+ ...current.canonical !== void 0 ? { canonical: current.canonical } : {},
614
+ ...current.robots !== void 0 ? { robots: current.robots } : {},
615
+ ...next.title !== void 0 ? { title: next.title } : {},
616
+ ...next.description !== void 0 ? { description: next.description } : {},
617
+ ...next.canonical !== void 0 ? { canonical: next.canonical } : {},
618
+ ...next.robots !== void 0 ? { robots: next.robots } : {},
619
+ ...current.openGraph || next.openGraph ? { openGraph: {
620
+ ...current.openGraph,
621
+ ...next.openGraph
622
+ } } : {},
623
+ ...current.links || next.links ? { links: [...current.links ?? [], ...next.links ?? []] } : {},
624
+ ...current.jsonLd || next.jsonLd ? { jsonLd: [...current.jsonLd === void 0 ? [] : Array.isArray(current.jsonLd) ? current.jsonLd : [current.jsonLd], ...next.jsonLd === void 0 ? [] : Array.isArray(next.jsonLd) ? next.jsonLd : [next.jsonLd]] } : {},
625
+ ...current.html || next.html ? { html: {
626
+ ...current.html,
627
+ ...next.html
628
+ } } : {}
629
+ };
630
+ }
631
+ function metadataSources(record) {
632
+ if (record.metaChain) return record.metaChain;
633
+ return record.options.meta ? [record.options.meta] : [];
634
+ }
635
+ async function resolveRouteMeta(record, context) {
636
+ let resolved = record.options.title ? { title: record.options.title } : {};
637
+ for (const source of metadataSources(record)) {
638
+ const next = typeof source === "function" ? await source(context) : source;
639
+ resolved = mergeMeta(resolved, next);
640
+ }
641
+ return freezeMeta(resolved);
642
+ }
643
+ /** Replace only Askr-owned head nodes after a successful client navigation. */
644
+ function reconcileRouteMeta(meta, target = document) {
645
+ for (const node of Array.from(target.head.querySelectorAll("[data-askr-head]"))) node.remove();
646
+ const template = target.createElement("template");
647
+ template.innerHTML = serializeRouteMeta(meta);
648
+ target.head.append(template.content);
649
+ if (meta.html?.lang) target.documentElement.setAttribute("lang", meta.html.lang);
650
+ if (meta.html?.dir) target.documentElement.setAttribute("dir", meta.html.dir);
651
+ }
652
+ function escapeAttribute(value) {
653
+ return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
654
+ }
655
+ function escapeText(value) {
656
+ return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
657
+ }
658
+ function ownedAttribute() {
659
+ return " data-askr-head=\"\"";
660
+ }
661
+ function serializeLink(link) {
662
+ const entries = Object.entries(link).filter(([name]) => /^[a-zA-Z][a-zA-Z0-9:_-]*$/.test(name)).sort(([left], [right]) => {
663
+ const order = (name) => name === "rel" ? 0 : name === "href" ? 1 : 2;
664
+ return order(left) - order(right) || left.localeCompare(right);
665
+ });
666
+ return `<link${ownedAttribute()}${entries.map(([name, value]) => ` ${name}="${escapeAttribute(value)}"`).join("")}>`;
667
+ }
668
+ function serializeJsonLd(value) {
669
+ const json = JSON.stringify(value).replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/&/g, "\\u0026").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
670
+ return `<script${ownedAttribute()} type="application/ld+json">${json}<\/script>`;
671
+ }
672
+ function serializeRouteMeta(meta) {
673
+ const output = [];
674
+ if (meta.title !== void 0) output.push(`<title${ownedAttribute()}>${escapeText(meta.title)}</title>`);
675
+ if (meta.description !== void 0) output.push(`<meta${ownedAttribute()} name="description" content="${escapeAttribute(meta.description)}">`);
676
+ if (meta.canonical !== void 0) output.push(`<link${ownedAttribute()} rel="canonical" href="${escapeAttribute(meta.canonical)}">`);
677
+ if (meta.robots !== void 0) output.push(`<meta${ownedAttribute()} name="robots" content="${escapeAttribute(meta.robots)}">`);
678
+ for (const [property, content] of Object.entries(meta.openGraph ?? {}).sort(([left], [right]) => left.localeCompare(right))) {
679
+ const name = property.startsWith("og:") ? property : `og:${property}`;
680
+ output.push(`<meta${ownedAttribute()} property="${escapeAttribute(name)}" content="${escapeAttribute(content)}">`);
681
+ }
682
+ for (const link of meta.links ?? []) output.push(serializeLink(link));
683
+ if (meta.jsonLd !== void 0) {
684
+ const values = Array.isArray(meta.jsonLd) ? meta.jsonLd : [meta.jsonLd];
685
+ for (const value of values) output.push(serializeJsonLd(value));
686
+ }
687
+ return output.join("");
688
+ }
689
+ //#endregion
690
+ //#region src/router/navigation-targets.ts
691
+ const MAX_NAVIGATION_REDIRECTS = 20;
692
+ let activeRouteRequestId = 0;
693
+ let activeRouteRequestController = null;
694
+ function beginRouteRequest() {
695
+ activeRouteRequestId += 1;
696
+ activeRouteRequestController?.abort();
697
+ activeRouteRequestController = new AbortController();
698
+ return {
699
+ id: activeRouteRequestId,
700
+ signal: activeRouteRequestController.signal
701
+ };
702
+ }
703
+ function isStaleRouteRequest(requestId) {
704
+ return requestId !== activeRouteRequestId;
705
+ }
706
+ function cancelRouteRequests() {
707
+ activeRouteRequestId += 1;
708
+ activeRouteRequestController?.abort();
709
+ activeRouteRequestController = null;
710
+ }
711
+ function isRenderResult(result) {
712
+ return result !== null && result.kind === "render";
713
+ }
714
+ function createNavigationTarget(app, resolved) {
715
+ if (!isRenderResult(resolved) || !resolved.record) return {
716
+ app,
717
+ resolved
718
+ };
719
+ if (!Boolean(resolved.record.options.title || resolved.record.options.meta || resolved.record.metaChain?.length)) return {
720
+ app,
721
+ resolved
722
+ };
723
+ const context = getRouteRenderContext(resolved);
724
+ if (!context) return {
725
+ app,
726
+ resolved
727
+ };
728
+ return resolveRouteMeta(resolved.record, context).then((metadata) => ({
729
+ app,
730
+ resolved,
731
+ metadata
732
+ }));
733
+ }
734
+ function reconcileNavigationMetadata(targets) {
735
+ for (let index = targets.length - 1; index >= 0; index -= 1) {
736
+ const metadata = targets[index]?.metadata;
737
+ if (metadata) {
738
+ reconcileRouteMeta(metadata);
739
+ return;
740
+ }
741
+ }
742
+ }
743
+ function getRedirectHistoryMode(replace) {
744
+ return replace === false ? "push" : "replace";
745
+ }
746
+ function getNavigationHistoryMode(options) {
747
+ if (options.history) return options.history;
748
+ return options.replace ? "replace" : "push";
749
+ }
750
+ function createDeniedResolvedRoute(status) {
751
+ return {
752
+ handler: () => ({
753
+ type: "div",
754
+ props: { "data-route-denied": String(status) },
755
+ children: [String(status)]
756
+ }),
757
+ params: {}
758
+ };
759
+ }
760
+ function bindResolvedRouteHandler(resolved) {
761
+ return () => resolved.handler(resolved.params);
762
+ }
763
+ function wrapRootRouteHandler(componentFn) {
764
+ const wrappedFn = (props, ctx) => {
765
+ const out = componentFn(props, ctx);
766
+ if (isPromiseLike(out)) throw new Error("Async components are not supported. Components must return synchronously.");
767
+ const portalVNode = {
768
+ $$typeof: ELEMENT_TYPE,
769
+ type: DefaultPortal,
770
+ props: { __askrAutoDefaultPortal: true },
771
+ key: "__default_portal"
772
+ };
773
+ return {
774
+ $$typeof: ELEMENT_TYPE,
775
+ type: Fragment,
776
+ props: { children: out === void 0 || out === null ? [portalVNode] : [out, portalVNode] }
777
+ };
778
+ };
779
+ Object.defineProperty(wrappedFn, "name", { value: componentFn.name || "Component" });
780
+ return wrappedFn;
781
+ }
782
+ function flattenLifecycleErrors(error, result) {
783
+ if (error instanceof AggregateError) {
784
+ for (const nested of error.errors) flattenLifecycleErrors(nested, result);
785
+ return;
786
+ }
787
+ result.push(error);
788
+ }
789
+ function reportRouteCleanupErrors(errors) {
790
+ for (const error of errors) {
791
+ const flattened = [];
792
+ flattenLifecycleErrors(error, flattened);
793
+ for (const cleanupError of flattened.length > 0 ? flattened : [error]) logger.error("[Askr] route cleanup failed:", cleanupError);
794
+ }
795
+ }
796
+ function captureRouteDom(root) {
797
+ if (!root) return null;
798
+ const nodes = [];
799
+ const visit = (node) => {
800
+ nodes.push({
801
+ node,
802
+ children: Array.from(node.childNodes),
803
+ attributes: node instanceof Element ? Array.from(node.attributes).map((attribute) => [attribute.name, attribute.value]) : null,
804
+ nodeValue: node.nodeValue
805
+ });
806
+ for (const child of Array.from(node.childNodes)) visit(child);
807
+ };
808
+ visit(root);
809
+ return {
810
+ root,
811
+ nodes
812
+ };
813
+ }
814
+ function collectProvisionalRouteNodes(snapshot) {
815
+ const originalNodes = new Set(snapshot.nodes.map((entry) => entry.node));
816
+ const provisional = [];
817
+ const visit = (node) => {
818
+ if (!originalNodes.has(node)) {
819
+ provisional.push(node);
820
+ return;
821
+ }
822
+ for (const child of Array.from(node.childNodes)) visit(child);
823
+ };
824
+ for (const child of Array.from(snapshot.root.childNodes)) visit(child);
825
+ return provisional;
826
+ }
827
+ function restoreRouteDom(snapshot) {
828
+ if (!snapshot) return [];
829
+ const errors = [];
830
+ for (const node of collectProvisionalRouteNodes(snapshot)) try {
831
+ teardownNodeSubtree(node, { strict: true });
832
+ } catch (error) {
833
+ errors.push(error);
834
+ }
835
+ for (const entry of snapshot.nodes) {
836
+ const { node, attributes } = entry;
837
+ try {
838
+ if (attributes && node instanceof Element) {
839
+ const expected = new Map(attributes);
840
+ for (const attribute of Array.from(node.attributes)) if (!expected.has(attribute.name)) node.removeAttribute(attribute.name);
841
+ for (const [name, value] of attributes) if (node.getAttribute(name) !== value) node.setAttribute(name, value);
842
+ } else if (!(node instanceof Element)) node.nodeValue = entry.nodeValue;
843
+ if (node instanceof Element || node instanceof DocumentFragment) node.replaceChildren(...entry.children);
844
+ } catch (error) {
845
+ errors.push(error);
846
+ }
847
+ }
848
+ return errors;
849
+ }
850
+ function collectHostInstances(root) {
851
+ const instances = [];
852
+ const seen = /* @__PURE__ */ new Set();
853
+ const pending = [root];
854
+ while (pending.length > 0) {
855
+ const node = pending.pop();
856
+ const host = node;
857
+ for (const instance of host.__ASKR_INSTANCES ?? []) if (!seen.has(instance)) {
858
+ seen.add(instance);
859
+ instances.push(instance);
860
+ }
861
+ if (host.__ASKR_INSTANCE && !seen.has(host.__ASKR_INSTANCE)) {
862
+ seen.add(host.__ASKR_INSTANCE);
863
+ instances.push(host.__ASKR_INSTANCE);
864
+ }
865
+ for (let child = node.lastChild; child; child = child.previousSibling) pending.push(child);
866
+ }
867
+ return instances;
868
+ }
869
+ function captureDeferredRouteCleanup(instance) {
870
+ return {
871
+ instance,
872
+ previousOwnershipGeneration: instance._ownershipGeneration,
873
+ previousFn: instance.fn,
874
+ previousProps: instance.props,
875
+ previousExpectedStateIndices: instance.expectedStateIndices,
876
+ previousFirstRenderComplete: instance.firstRenderComplete,
877
+ previousStateIndexCheck: instance.stateIndexCheck,
878
+ previousErrorBoundaryState: instance.errorBoundaryState,
879
+ previousTarget: instance.target,
880
+ previousDom: captureRouteDom(instance.target),
881
+ previousStateValues: instance.stateValues,
882
+ previousCleanupFns: instance.cleanupFns,
883
+ previousOwnedChildScopes: instance._ownedChildScopes,
884
+ previousAbortController: instance.abortController,
885
+ previousMountOperations: instance.mountOperations,
886
+ previousCommitOperations: instance.commitOperations,
887
+ previousLifecycleSlots: instance.lifecycleSlots,
888
+ previousLifecycleGeneration: instance.lifecycleGeneration,
889
+ previousEvaluationGeneration: instance.evaluationGeneration,
890
+ previousHasPendingUpdate: instance.hasPendingUpdate,
891
+ previousNotifyUpdate: instance.notifyUpdate,
892
+ previousPlaceholder: instance._placeholder,
893
+ previousMounted: instance.mounted,
894
+ previousCurrentRenderToken: instance._currentRenderToken,
895
+ previousLastRenderToken: instance.lastRenderToken,
896
+ previousPendingReadSources: instance._pendingReadSources,
897
+ previousPendingReadSourceVersions: instance._pendingReadSourceVersions,
898
+ previousLastReadSources: instance._lastReadSources,
899
+ previousReaderEntries: Array.from(instance._lastReadSources ?? []).map((source) => ({
900
+ source,
901
+ reader: source._readers?.get(instance)
902
+ })),
903
+ previousAppRenderRuntime: instance._appRenderRuntime,
904
+ previousInstances: instance.target ? collectHostInstances(instance.target) : [],
905
+ previousDisposed: false
906
+ };
907
+ }
908
+ function restoreDeferredRouteInstance(deferred) {
909
+ const instance = deferred.instance;
910
+ const errors = [];
911
+ const activeGeneration = instance._ownershipGeneration;
912
+ const activeReadSources = instance._lastReadSources;
913
+ if (activeGeneration !== deferred.previousOwnershipGeneration) {
914
+ try {
915
+ cleanupReadableSubscriptionSources(instance, activeReadSources, activeGeneration);
916
+ } catch (error) {
917
+ errors.push(error);
918
+ }
919
+ instance._lastReadSources = void 0;
920
+ try {
921
+ cleanupComponent(instance);
922
+ } catch (error) {
923
+ errors.push(error);
924
+ }
925
+ }
926
+ errors.push(...restoreRouteDom(deferred.previousDom));
927
+ instance.fn = deferred.previousFn;
928
+ instance._ownershipGeneration = deferred.previousOwnershipGeneration;
929
+ instance.props = deferred.previousProps;
930
+ instance.expectedStateIndices = deferred.previousExpectedStateIndices;
931
+ instance.firstRenderComplete = deferred.previousFirstRenderComplete;
932
+ instance.stateIndexCheck = deferred.previousStateIndexCheck;
933
+ instance.errorBoundaryState = deferred.previousErrorBoundaryState;
934
+ instance.target = deferred.previousTarget;
935
+ instance.stateValues = deferred.previousStateValues;
936
+ instance.cleanupFns = deferred.previousCleanupFns;
937
+ instance._ownedChildScopes = deferred.previousOwnedChildScopes;
938
+ instance.abortController = deferred.previousAbortController;
939
+ instance.mountOperations = deferred.previousMountOperations;
940
+ instance.commitOperations = deferred.previousCommitOperations;
941
+ instance.lifecycleSlots = deferred.previousLifecycleSlots;
942
+ instance.lifecycleGeneration = deferred.previousLifecycleGeneration;
943
+ instance.evaluationGeneration = deferred.previousEvaluationGeneration;
944
+ instance.hasPendingUpdate = deferred.previousHasPendingUpdate;
945
+ instance.notifyUpdate = deferred.previousNotifyUpdate;
946
+ instance._placeholder = deferred.previousPlaceholder;
947
+ instance.mounted = deferred.previousMounted;
948
+ instance._currentRenderToken = deferred.previousCurrentRenderToken;
949
+ instance.lastRenderToken = deferred.previousLastRenderToken;
950
+ instance._pendingReadSources = deferred.previousPendingReadSources;
951
+ instance._pendingReadSourceVersions = deferred.previousPendingReadSourceVersions;
952
+ instance._lastReadSources = deferred.previousLastReadSources;
953
+ instance._appRenderRuntime = deferred.previousAppRenderRuntime;
954
+ const previousSources = new Set(deferred.previousReaderEntries.map(({ source }) => source));
955
+ for (const source of activeReadSources ?? []) {
956
+ if (previousSources.has(source)) continue;
957
+ if ((source._readers?.get(instance))?.generation === activeGeneration) {
958
+ if (source._readers?.delete(instance) && false);
959
+ }
960
+ }
961
+ for (const { source, reader } of deferred.previousReaderEntries) {
962
+ if (!reader) {
963
+ if (source._readers?.delete(instance) && false);
964
+ continue;
965
+ }
966
+ let readers = source._readers;
967
+ if (!readers) {
968
+ readers = /* @__PURE__ */ new Map();
969
+ source._readers = readers;
970
+ }
971
+ readers.has(instance);
972
+ readers.set(instance, reader);
973
+ }
974
+ return errors;
975
+ }
976
+ function restoreDeferredRouteInstances(deferredCleanups) {
977
+ const errors = [];
978
+ for (let index = deferredCleanups.length - 1; index >= 0; index -= 1) errors.push(...restoreDeferredRouteInstance(deferredCleanups[index]));
979
+ if (errors.length > 0) reportRouteCleanupErrors(errors);
980
+ }
981
+ function cleanupDeferredRouteInstance(deferred) {
982
+ const errors = [];
983
+ const instance = deferred.instance;
984
+ if (!deferred.previousDisposed) {
985
+ deferred.previousDisposed = true;
986
+ try {
987
+ cleanupComponentGeneration(instance, {
988
+ ownershipGeneration: deferred.previousOwnershipGeneration,
989
+ cleanupFns: deferred.previousCleanupFns,
990
+ ownedChildScopes: deferred.previousOwnedChildScopes,
991
+ abortController: deferred.previousAbortController,
992
+ readSources: deferred.previousLastReadSources
993
+ });
994
+ } catch (error) {
995
+ errors.push(error);
996
+ }
997
+ }
998
+ const root = instance.target;
999
+ const liveInstances = root ? new Set(collectHostInstances(root)) : /* @__PURE__ */ new Set();
1000
+ for (let index = deferred.previousInstances.length - 1; index >= 0; index--) {
1001
+ const previous = deferred.previousInstances[index];
1002
+ if (previous === instance || liveInstances.has(previous)) continue;
1003
+ try {
1004
+ cleanupComponent(previous);
1005
+ } catch (error) {
1006
+ errors.push(error);
1007
+ }
1008
+ }
1009
+ return errors;
1010
+ }
1011
+ function remountResolvedRoute(instance, resolved, pathname, href, existingSnapshot) {
1012
+ const deferredCleanup = existingSnapshot ?? captureDeferredRouteCleanup(instance);
1013
+ clearDefaultPortalForInstance(instance);
1014
+ instance.fn = wrapRootRouteHandler(bindResolvedRouteHandler(resolved));
1015
+ instance.props = {};
1016
+ instance._ownershipGeneration = {};
1017
+ instance.stateValues = [];
1018
+ instance.expectedStateIndices = [];
1019
+ instance.firstRenderComplete = false;
1020
+ instance.stateIndexCheck = -1;
1021
+ instance.evaluationGeneration++;
1022
+ instance.lifecycleGeneration++;
1023
+ instance.notifyUpdate = null;
1024
+ instance.mountOperations = [];
1025
+ instance.commitOperations = [];
1026
+ instance.lifecycleSlots = [];
1027
+ instance.cleanupFns = [];
1028
+ instance._ownedChildScopes = /* @__PURE__ */ new Set();
1029
+ instance._placeholder = void 0;
1030
+ instance.hasPendingUpdate = false;
1031
+ instance._currentRenderToken = void 0;
1032
+ instance.lastRenderToken = 0;
1033
+ instance._pendingReadSources = void 0;
1034
+ instance._lastReadSources = void 0;
1035
+ instance.abortController = null;
1036
+ mountComponent(instance);
1037
+ setCurrentRouteLocation(pathname, href);
1038
+ return deferredCleanup;
1039
+ }
1040
+ function rerenderResolvedRoute(instance, pathname, href) {
1041
+ setCurrentRouteLocation(pathname, href);
1042
+ instance._enqueueRun?.();
1043
+ return true;
1044
+ }
1045
+ function resolveAppRouteRequest(app, pathname, href, signal) {
1046
+ if (app.manifest) return resolveRouteRequest(href, {
1047
+ manifest: app.manifest,
1048
+ auth: app.auth,
1049
+ signal
1050
+ });
1051
+ if (app.routes) {
1052
+ const resolved = resolveRouteFromRoutes(pathname, app.routes);
1053
+ if (!resolved) return null;
1054
+ return {
1055
+ kind: "render",
1056
+ handler: resolved.handler,
1057
+ params: resolved.params
1058
+ };
1059
+ }
1060
+ return resolveRouteRequest(href, {
1061
+ auth: app.auth,
1062
+ signal
1063
+ });
1064
+ }
1065
+ function getResolvedRouteHandler(resolved) {
1066
+ if (!resolved) throw new Error("[Askr] cannot prepare an unmatched navigation target");
1067
+ if (resolved.kind === "deny") return createDeniedResolvedRoute(resolved.status);
1068
+ if (!isRenderResult(resolved)) throw new Error("[Askr] cannot prepare a redirect as a destination root");
1069
+ return {
1070
+ handler: resolved.handler,
1071
+ params: resolved.params
1072
+ };
1073
+ }
1074
+ function updateRouteRuntime(instance, resolved, href) {
1075
+ const current = instance._appRenderRuntime;
1076
+ const runtime = createAppRenderRuntime({
1077
+ framework: current?.framework,
1078
+ route: resolved?.kind === "render" ? getRouteRenderData(resolved) : void 0,
1079
+ hasRoute: resolved?.kind === "render" && hasRouteRenderData(resolved)
1080
+ });
1081
+ stageAppRenderRouteLocation(runtime, href);
1082
+ instance._appRenderRuntime = runtime;
1083
+ }
1084
+ function clearStagedRouteLocations(targets) {
1085
+ for (const target of targets) clearStagedAppRenderRouteLocation(target.app.instance._appRenderRuntime);
1086
+ }
1087
+ function resolveNavigationTargetsForApps(pathname, href, signal) {
1088
+ const apps = getRegisteredAppsSnapshot();
1089
+ if (apps.length === 1) {
1090
+ const app = apps[0];
1091
+ const resolved = resolveAppRouteRequest(app, pathname, href, signal);
1092
+ if (isPromiseLike(resolved)) return Promise.resolve(resolved).then((next) => {
1093
+ const target = createNavigationTarget(app, next);
1094
+ return isPromiseLike(target) ? Promise.resolve(target).then((ready) => [ready]) : [target];
1095
+ });
1096
+ const target = createNavigationTarget(app, resolved);
1097
+ return isPromiseLike(target) ? Promise.resolve(target).then((next) => [next]) : [target];
1098
+ }
1099
+ const syncTargets = [];
1100
+ const pendingTargets = [];
1101
+ for (const app of apps) {
1102
+ const resolved = resolveAppRouteRequest(app, pathname, href, signal);
1103
+ if (isPromiseLike(resolved)) {
1104
+ pendingTargets.push(Promise.resolve(resolved).then((next) => createNavigationTarget(app, next)));
1105
+ continue;
1106
+ }
1107
+ const target = createNavigationTarget(app, resolved);
1108
+ if (isPromiseLike(target)) pendingTargets.push(Promise.resolve(target));
1109
+ else syncTargets.push(target);
1110
+ }
1111
+ if (pendingTargets.length === 0) return syncTargets;
1112
+ return Promise.all([...syncTargets.map((target) => Promise.resolve(target)), ...pendingTargets]);
1113
+ }
1114
+ function applyNavigationTargets(requestId, path, options, redirectState, pathname, href, targets, navigateWithRedirectState) {
1115
+ if (isStaleRouteRequest(requestId)) return;
1116
+ const previousPathname = getCurrentPathname();
1117
+ const previousHref = getCurrentHref();
1118
+ for (const target of targets) {
1119
+ const resolved = target.resolved;
1120
+ if (!resolved || resolved.kind !== "redirect") continue;
1121
+ const redirectTarget = parseTargetUrl(resolved.to);
1122
+ const redirectHref = `${redirectTarget.pathname}${redirectTarget.search}${redirectTarget.hash}`;
1123
+ if (redirectHref === href) {
1124
+ if (isDevelopmentEnvironment()) logger.warn(`Navigation guard redirected to the same path: ${redirectHref}`);
1125
+ return;
1126
+ }
1127
+ if (redirectState.visited.has(redirectHref)) throw new Error(`[Askr] Navigation redirect cycle detected at ${redirectHref}.`);
1128
+ if (redirectState.redirects >= MAX_NAVIGATION_REDIRECTS) throw new Error(`[Askr] Navigation redirect limit exceeded (${MAX_NAVIGATION_REDIRECTS}).`);
1129
+ redirectState.visited.add(redirectHref);
1130
+ redirectState.redirects++;
1131
+ navigateWithRedirectState(redirectHref, { history: getRedirectHistoryMode(resolved.replace) }, redirectState);
1132
+ return;
1133
+ }
1134
+ const matchedTargets = targets.filter((target) => target.resolved !== null);
1135
+ if (matchedTargets.length === 0) {
1136
+ if (isDevelopmentEnvironment()) logger.warn(`No route found for path: ${path}`);
1137
+ return;
1138
+ }
1139
+ if (isStaleRouteRequest(requestId)) return;
1140
+ const samePathTargets = [];
1141
+ const rootsToPrepare = [];
1142
+ for (const target of matchedTargets) {
1143
+ const resolved = target.resolved;
1144
+ if (resolved.kind === "redirect") continue;
1145
+ if (pathname === target.app.pathname && isRenderResult(resolved)) {
1146
+ samePathTargets.push(target);
1147
+ continue;
1148
+ }
1149
+ rootsToPrepare.push(target);
1150
+ }
1151
+ const rollbackSnapshots = matchedTargets.map((target) => captureDeferredRouteCleanup(target.app.instance));
1152
+ const rollbackSnapshotByInstance = new Map(rollbackSnapshots.map((snapshot) => [snapshot.instance, snapshot]));
1153
+ const deferredCleanups = [];
1154
+ const cleanupErrors = [];
1155
+ const previousAppLocations = matchedTargets.map((target) => ({
1156
+ app: target.app,
1157
+ pathname: target.app.pathname,
1158
+ href: target.app.href
1159
+ }));
1160
+ const restoreOnExit = () => {
1161
+ if (!navigationBatchClosed) {
1162
+ discardLifecycleCommitBatch(navigationBatch);
1163
+ navigationBatchClosed = true;
1164
+ }
1165
+ restoreDeferredRouteInstances(rollbackSnapshots);
1166
+ for (const previous of previousAppLocations) {
1167
+ previous.app.pathname = previous.pathname;
1168
+ previous.app.href = previous.href;
1169
+ }
1170
+ setCurrentRouteLocation(previousPathname, previousHref);
1171
+ };
1172
+ const navigationBatch = beginLifecycleCommitBatch();
1173
+ let navigationBatchClosed = false;
1174
+ try {
1175
+ for (const target of rootsToPrepare) {
1176
+ if (isStaleRouteRequest(requestId)) {
1177
+ restoreOnExit();
1178
+ return;
1179
+ }
1180
+ updateRouteRuntime(target.app.instance, target.resolved, href);
1181
+ const deferredCleanup = remountResolvedRoute(target.app.instance, getResolvedRouteHandler(target.resolved), pathname, href, rollbackSnapshotByInstance.get(target.app.instance));
1182
+ deferredCleanups.push(deferredCleanup);
1183
+ }
1184
+ if (isStaleRouteRequest(requestId)) {
1185
+ restoreOnExit();
1186
+ return;
1187
+ }
1188
+ flushRuntimeScheduler();
1189
+ cleanupErrors.push(...drainLifecycleCommitErrors());
1190
+ if (isStaleRouteRequest(requestId)) {
1191
+ restoreOnExit();
1192
+ return;
1193
+ }
1194
+ for (const target of samePathTargets) {
1195
+ if (isStaleRouteRequest(requestId)) {
1196
+ restoreOnExit();
1197
+ return;
1198
+ }
1199
+ updateRouteRuntime(target.app.instance, target.resolved, href);
1200
+ rerenderResolvedRoute(target.app.instance, pathname, href);
1201
+ }
1202
+ flushRuntimeScheduler();
1203
+ cleanupErrors.push(...drainLifecycleCommitErrors());
1204
+ if (isStaleRouteRequest(requestId)) {
1205
+ restoreOnExit();
1206
+ return;
1207
+ }
1208
+ flushLifecycleCommitBatch(navigationBatch);
1209
+ navigationBatchClosed = true;
1210
+ cleanupErrors.push(...drainLifecycleCommitErrors());
1211
+ for (const target of matchedTargets) if (target.resolved && target.resolved.kind !== "redirect") syncAppRegistrationLocation(target.app, pathname, href);
1212
+ if (isStaleRouteRequest(requestId)) {
1213
+ restoreOnExit();
1214
+ return;
1215
+ }
1216
+ saveScrollPosition(previousHref);
1217
+ const historyMethod = getNavigationHistoryMode(options) === "replace" ? "replaceState" : "pushState";
1218
+ window.history[historyMethod]({ path: href }, "", href);
1219
+ setCurrentRouteLocation(pathname, href);
1220
+ clearStagedRouteLocations(matchedTargets);
1221
+ syncRegisteredRouteSnapshot();
1222
+ reconcileNavigationMetadata(matchedTargets);
1223
+ if (pathname !== previousPathname) applyNavigationScroll(options.scroll);
1224
+ for (const deferredCleanup of deferredCleanups) cleanupErrors.push(...cleanupDeferredRouteInstance(deferredCleanup));
1225
+ for (const error of cleanupErrors) reportRouteCleanupErrors([error]);
1226
+ } catch (error) {
1227
+ restoreOnExit();
1228
+ logger.error("[Askr] navigation failed:", error);
1229
+ throw error;
1230
+ }
1231
+ }
1232
+ function applyPopStateNavigationTargets(requestId, previousHref, previousState, pathname, href, state, targets, navigate) {
1233
+ if (isStaleRouteRequest(requestId)) return;
1234
+ const matchedTargets = targets.filter((target) => target.resolved !== null);
1235
+ if (matchedTargets.length === 0) {
1236
+ if (isDevelopmentEnvironment()) logger.warn(`No route found for path: ${pathname}`);
1237
+ return;
1238
+ }
1239
+ for (const target of matchedTargets) {
1240
+ const resolved = target.resolved;
1241
+ if (resolved.kind !== "redirect") continue;
1242
+ navigate(resolved.to, { history: getRedirectHistoryMode(resolved.replace) });
1243
+ return;
1244
+ }
1245
+ const samePathTargets = [];
1246
+ const rootsToPrepare = [];
1247
+ for (const target of matchedTargets) {
1248
+ const resolved = target.resolved;
1249
+ if (pathname === target.app.pathname && isRenderResult(resolved)) {
1250
+ samePathTargets.push(target);
1251
+ continue;
1252
+ }
1253
+ if (resolved.kind === "redirect") continue;
1254
+ rootsToPrepare.push(target);
1255
+ }
1256
+ const previousPathname = getCurrentPathname();
1257
+ const rollbackSnapshots = matchedTargets.map((target) => captureDeferredRouteCleanup(target.app.instance));
1258
+ const rollbackSnapshotByInstance = new Map(rollbackSnapshots.map((snapshot) => [snapshot.instance, snapshot]));
1259
+ const deferredCleanups = [];
1260
+ const cleanupErrors = [];
1261
+ const previousAppLocations = matchedTargets.map((target) => ({
1262
+ app: target.app,
1263
+ pathname: target.app.pathname,
1264
+ href: target.app.href
1265
+ }));
1266
+ const restoreOnExit = () => {
1267
+ if (!navigationBatchClosed) {
1268
+ discardLifecycleCommitBatch(navigationBatch);
1269
+ navigationBatchClosed = true;
1270
+ }
1271
+ restoreDeferredRouteInstances(rollbackSnapshots);
1272
+ for (const previous of previousAppLocations) {
1273
+ previous.app.pathname = previous.pathname;
1274
+ previous.app.href = previous.href;
1275
+ }
1276
+ setCurrentRouteLocation(previousPathname, previousHref);
1277
+ };
1278
+ const navigationBatch = beginLifecycleCommitBatch();
1279
+ let navigationBatchClosed = false;
1280
+ try {
1281
+ for (const target of rootsToPrepare) {
1282
+ if (isStaleRouteRequest(requestId)) {
1283
+ restoreOnExit();
1284
+ return;
1285
+ }
1286
+ updateRouteRuntime(target.app.instance, target.resolved, href);
1287
+ const deferredCleanup = remountResolvedRoute(target.app.instance, getResolvedRouteHandler(target.resolved), pathname, href, rollbackSnapshotByInstance.get(target.app.instance));
1288
+ deferredCleanups.push(deferredCleanup);
1289
+ }
1290
+ if (isStaleRouteRequest(requestId)) {
1291
+ restoreOnExit();
1292
+ return;
1293
+ }
1294
+ flushRuntimeScheduler();
1295
+ cleanupErrors.push(...drainLifecycleCommitErrors());
1296
+ if (isStaleRouteRequest(requestId)) {
1297
+ restoreOnExit();
1298
+ return;
1299
+ }
1300
+ for (const target of samePathTargets) {
1301
+ if (isStaleRouteRequest(requestId)) {
1302
+ restoreOnExit();
1303
+ return;
1304
+ }
1305
+ updateRouteRuntime(target.app.instance, target.resolved, href);
1306
+ rerenderResolvedRoute(target.app.instance, pathname, href);
1307
+ }
1308
+ flushRuntimeScheduler();
1309
+ cleanupErrors.push(...drainLifecycleCommitErrors());
1310
+ if (isStaleRouteRequest(requestId)) {
1311
+ restoreOnExit();
1312
+ return;
1313
+ }
1314
+ flushLifecycleCommitBatch(navigationBatch);
1315
+ navigationBatchClosed = true;
1316
+ cleanupErrors.push(...drainLifecycleCommitErrors());
1317
+ for (const target of matchedTargets) if (target.resolved && target.resolved.kind !== "redirect") syncAppRegistrationLocation(target.app, pathname, href);
1318
+ if (isStaleRouteRequest(requestId)) {
1319
+ restoreOnExit();
1320
+ return;
1321
+ }
1322
+ setCurrentRouteLocation(pathname, href);
1323
+ clearStagedRouteLocations(matchedTargets);
1324
+ syncRegisteredRouteSnapshot();
1325
+ reconcileNavigationMetadata(matchedTargets);
1326
+ applyHistoryScroll(href, state);
1327
+ for (const deferredCleanup of deferredCleanups) cleanupErrors.push(...cleanupDeferredRouteInstance(deferredCleanup));
1328
+ for (const error of cleanupErrors) reportRouteCleanupErrors([error]);
1329
+ } catch (error) {
1330
+ restoreOnExit();
1331
+ try {
1332
+ window.history.replaceState(previousState, "", previousHref);
1333
+ syncRegisteredRouteSnapshot();
1334
+ } catch (rollbackError) {
1335
+ logger.error("[Askr] failed to restore URL after popstate failure:", rollbackError);
1336
+ }
1337
+ throw error;
1338
+ }
1339
+ }
1340
+ //#endregion
1341
+ //#region src/router/route-query.ts
1342
+ function getRouteQueryHistoryMode(options) {
1343
+ if (options.history) return options.history;
1344
+ return options.replace === false ? "push" : "replace";
1345
+ }
1346
+ function setRouteQueryValue(searchParams, key, value) {
1347
+ searchParams.delete(key);
1348
+ if (Array.isArray(value)) {
1349
+ for (const entry of value) {
1350
+ if (entry === null || entry === void 0) continue;
1351
+ searchParams.append(key, String(entry));
1352
+ }
1353
+ return;
1354
+ }
1355
+ if (value === null || value === void 0) return;
1356
+ searchParams.set(key, String(value));
1357
+ }
1358
+ function applyRouteQueryUpdates(searchParams, updates) {
1359
+ if (typeof updates === "function") {
1360
+ updates(searchParams);
1361
+ return;
1362
+ }
1363
+ for (const [key, value] of Object.entries(updates)) setRouteQueryValue(searchParams, key, value);
1364
+ }
1365
+ function updateRouteQuery(updates, options = {}) {
1366
+ if (typeof window === "undefined") return;
1367
+ const url = parseTargetUrl(getWindowHref$1());
1368
+ applyRouteQueryUpdates(url.searchParams, updates);
1369
+ const href = `${url.pathname}${url.search}${url.hash}`;
1370
+ if (href === getWindowHref$1()) return;
1371
+ const historyMode = getRouteQueryHistoryMode(options);
1372
+ if (historyMode === "push") saveScrollPosition(getCurrentHref());
1373
+ const state = window.history.state && typeof window.history.state === "object" ? window.history.state : {};
1374
+ window.history[historyMode === "replace" ? "replaceState" : "pushState"]({
1375
+ ...state,
1376
+ path: href
1377
+ }, "", href);
1378
+ setCurrentRouteLocation(url.pathname, href);
1379
+ for (const app of getRegisteredAppsSnapshot()) syncAppRegistrationLocation(app, url.pathname, href);
1380
+ syncRegisteredRouteSnapshot();
1381
+ }
1382
+ //#endregion
1383
+ //#region src/router/navigate.ts
1384
+ /**
1385
+ * Client-side navigation with History API
1386
+ */
1387
+ let navigationInitialized = false;
1388
+ configureNavigationRegistryHost({ cancelRouteRequests });
1389
+ function navigate(path, options = {}) {
1390
+ if (typeof window === "undefined") return;
1391
+ const initialTarget = parseTargetUrl(path);
1392
+ navigateWithRedirectState(path, options, {
1393
+ redirects: 0,
1394
+ visited: /* @__PURE__ */ new Set([`${initialTarget.pathname}${initialTarget.search}${initialTarget.hash}`])
1395
+ });
1396
+ }
1397
+ function navigateWithRedirectState(path, options, redirectState) {
1398
+ if (typeof window === "undefined") return;
1399
+ const request = beginRouteRequest();
1400
+ const target = parseTargetUrl(path);
1401
+ const pathname = target.pathname;
1402
+ const href = `${target.pathname}${target.search}${target.hash}`;
1403
+ const resolvedTargets = resolveNavigationTargetsForApps(pathname, href, request.signal);
1404
+ if (isPromiseLike(resolvedTargets)) {
1405
+ Promise.resolve(resolvedTargets).then((targets) => {
1406
+ if (isStaleRouteRequest(request.id)) return;
1407
+ try {
1408
+ applyNavigationTargets(request.id, path, options, redirectState, pathname, href, targets, navigateWithRedirectState);
1409
+ } catch (error) {
1410
+ logger.error("[Askr] navigation failed:", error);
1411
+ }
1412
+ }, (error) => {
1413
+ logger.error("[Askr] navigation failed:", error);
1414
+ });
1415
+ return;
1416
+ }
1417
+ applyNavigationTargets(request.id, path, options, redirectState, pathname, href, resolvedTargets, navigateWithRedirectState);
1418
+ }
1419
+ function handlePopState(event) {
1420
+ const request = beginRouteRequest();
1421
+ const previousHref = getCurrentHref();
1422
+ const pathname = window.location.pathname;
1423
+ const href = `${window.location.pathname}${window.location.search}${window.location.hash}`;
1424
+ if (!hasRegisteredApps()) return;
1425
+ const applyResolved = (targets) => {
1426
+ try {
1427
+ applyPopStateNavigationTargets(request.id, previousHref, { path: previousHref }, pathname, href, event.state, targets, navigate);
1428
+ } catch (error) {
1429
+ logger.error("[Askr] popstate navigation failed:", error);
1430
+ }
1431
+ };
1432
+ const resolvedTargets = resolveNavigationTargetsForApps(pathname, href, request.signal);
1433
+ if (isPromiseLike(resolvedTargets)) {
1434
+ Promise.resolve(resolvedTargets).then((next) => {
1435
+ applyResolved(next);
1436
+ }, (error) => {
1437
+ logger.error("[Askr] popstate navigation failed:", error);
1438
+ });
1439
+ return;
1440
+ }
1441
+ applyResolved(resolvedTargets);
1442
+ }
1443
+ function initializeNavigation() {
1444
+ if (typeof window === "undefined" || navigationInitialized) return;
1445
+ navigationInitialized = true;
1446
+ window.addEventListener("popstate", handlePopState);
1447
+ }
1448
+ //#endregion
1449
+ export { index as C, assertExecutionModel as D, route as E, group as S, registerRoutes as T, lazy as _, resolveRouteMeta as a, createAppRenderRuntime as b, registerAppInstance as c, clearRoutes as d, createRouteRegistry as f, _snapshotRouteSourceLazy as g, _snapshotLazy as h, reconcileRouteMeta as i, unregisterAppInstance as l, _drainLazy as m, navigate as n, serializeRouteMeta as o, getManifest as p, updateRouteQuery as r, configureScrollRestoration as s, initializeNavigation as t, _applyManifest as u, currentRoute as v, page as w, fallback as x, setServerLocation as y };