docs-i18n 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/admin/app/lib/auth-client.ts +1 -1
  2. package/admin/app/lib/auth.server.ts +51 -1
  3. package/admin/app/server.ts +4 -1
  4. package/admin/dist/client/assets/{auth-client-DqJZaFZR.js → auth-client-ChAoRxRf.js} +1 -1
  5. package/admin/dist/client/assets/{login-CQjkiBAF.js → login-DpI70f1L.js} +1 -1
  6. package/admin/dist/client/assets/{main-bc5tcdGg.js → main-HccfHTVt.js} +2 -2
  7. package/admin/dist/client/assets/{routes-CTPOG_v1.js → routes-D1wZzUqP.js} +1 -1
  8. package/admin/dist/server/assets/Match-BeWrYoSG.js +3236 -0
  9. package/admin/dist/server/assets/{__tanstack-start-server-fn-resolver-D1Ni2lpa.js → __tanstack-start-server-fn-resolver-SG4WUVWE.js} +27 -27
  10. package/admin/dist/server/assets/{_tanstack-start-manifest_v-BgMVPPt2.js → _tanstack-start-manifest_v-CZNmyv5h.js} +4 -4
  11. package/admin/dist/server/assets/{adapter-DjXlUL1J.js → adapter-Btzrjxp2.js} +1 -1
  12. package/admin/dist/server/assets/auth-Hlc_ErDZ.js +40 -0
  13. package/admin/dist/server/assets/{auth-client-CoUpyQIM.js → auth-client-DZADgYlJ.js} +3 -3
  14. package/admin/dist/server/assets/auth.server-C-Ece-zJ.js +2 -0
  15. package/admin/dist/server/assets/{auth.server-BLVDnTCZ.js → auth.server-C5kH0jex.js} +53 -12
  16. package/admin/dist/server/assets/{bun-sqlite-dialect-C8OaCWSL-BNNY-FoT.js → bun-sqlite-dialect-C8OaCWSL-kcfNhLVL.js} +2 -2
  17. package/admin/dist/server/assets/{compiled-query-CnFG_BVV.js → compiled-query-BniCsfyw.js} +1 -1
  18. package/admin/dist/server/assets/createServerFn-CAF9Kl7K.js +370 -0
  19. package/admin/dist/server/assets/{createServerRpc-Cyyxq9HQ.js → createServerRpc-D1Slsi4e.js} +1 -1
  20. package/admin/dist/server/assets/{d1-sqlite-dialect-sYHNqBte-Bjz-cybU.js → d1-sqlite-dialect-sYHNqBte-DH7CDIkk.js} +2 -2
  21. package/admin/dist/server/assets/{dist-BnKtYOU0.js → dist-3sjmTS6w.js} +1 -6
  22. package/admin/dist/server/assets/{dist-CUzFWZag.js → dist-B_54zSkq.js} +8 -8
  23. package/admin/dist/server/assets/dist-CaR9v9w1.js +2 -0
  24. package/admin/dist/server/assets/{dist-C3-e8E2B.js → dist-D3NMliQC.js} +2 -2
  25. package/admin/dist/server/assets/{error-codes-BhMTGvV6.js → error-codes-Dw4P_cJu.js} +1 -1
  26. package/admin/dist/server/assets/init-CSXxGq7r.js +2 -0
  27. package/admin/dist/server/assets/{init-SZW7wW3l.js → init-QOUAlWr8.js} +3 -3
  28. package/admin/dist/server/assets/{jobs-DVAdIxgN.js → jobs-CcwecqaK.js} +5 -5
  29. package/admin/dist/server/assets/{kysely-adapter-YC8RFPyc.js → kysely-adapter-DZDLFHLq.js} +1 -1
  30. package/admin/dist/server/assets/{login-SqzTMYOZ.js → login-BMn8hY2z.js} +2 -2
  31. package/admin/dist/server/assets/{misc-D0n9L-9D.js → misc-leinq0id.js} +5 -5
  32. package/admin/dist/server/assets/{models-CoviNHUP.js → models-DTJbdHu7.js} +2 -2
  33. package/admin/dist/server/assets/{node-sqlite-dialect-BJIaP6lL.js → node-sqlite-dialect-CTaKW6AP.js} +2 -2
  34. package/admin/dist/server/assets/request-response-Bj40K48O.js +589 -0
  35. package/admin/dist/server/assets/{router-noqexgr0.js → router-B4k1eDGl.js} +4 -4
  36. package/admin/dist/server/assets/{routes-CLdSUfb7.js → routes-D0bCl8P2.js} +4 -8
  37. package/admin/dist/server/assets/{routes-BG89QZ0_.js → routes-ef6kOTX8.js} +4 -4
  38. package/admin/dist/server/assets/{sqlite-adapter-CL2EidjD.js → sqlite-adapter-C24CHMIE.js} +1 -1
  39. package/admin/dist/server/assets/{status-BYF_y9fT.js → status-Bdrqzx_H.js} +2 -2
  40. package/admin/dist/server/assets/status-C_h82YTJ.js +2 -0
  41. package/admin/dist/server/assets/{status-C-jmHj1T.js → status-VBCTGlIL.js} +4 -4
  42. package/admin/dist/server/server.js +77 -4234
  43. package/admin/server/functions/auth.ts +0 -48
  44. package/admin/vite.config.ts +9 -5
  45. package/dist/{assemble-S3MWVLBI.js → assemble-FKIKC5I4.js} +3 -3
  46. package/dist/{chunk-JHBSHTXC.js → chunk-HUBYJOX7.js} +1 -1
  47. package/dist/{chunk-CLYUAWZE.js → chunk-KC3IKBKF.js} +1 -1
  48. package/dist/{chunk-PNKVD2UK.js → chunk-KFQGP6VL.js} +7 -0
  49. package/dist/cli.js +16 -21
  50. package/dist/{pipeline-3XGFR4QL.js → pipeline-6F7CLVOH.js} +5 -5
  51. package/dist/{rescan-7XDHUNH5.js → rescan-RQQNQJPE.js} +2 -2
  52. package/dist/{runner-KUGSO4CL.js → runner-SO4OYQWW.js} +1 -1
  53. package/dist/{status-NX47XZIU.js → status-AVK3JWVT.js} +1 -1
  54. package/dist/{translate-AGUNMZMQ.js → translate-AMKKSZ63.js} +3 -3
  55. package/dist/{upload-KYKJVERO.js → upload-7XWK5UTZ.js} +86 -4
  56. package/package.json +1 -1
  57. package/template/dist/client/assets/{Doc-CbmLeLjl.js → Doc-BKO69_nz.js} +1 -1
  58. package/template/dist/client/assets/{DocsLayout-ERG7nrAc.js → DocsLayout-BGugXxEQ.js} +1 -1
  59. package/template/dist/client/assets/{FileTabs-CCynw0nL.js → FileTabs-4fZriOj4.js} +1 -1
  60. package/template/dist/client/assets/{Footer-l6Y8-ltB.js → Footer-DYh1AfWA.js} +1 -1
  61. package/template/dist/client/assets/{FrameworkContent-pNf68F7f.js → FrameworkContent-rVvjxASn.js} +1 -1
  62. package/template/dist/client/assets/{MarkdownHeadingContext-6I862CKH.js → MarkdownHeadingContext-CdvUDZFU.js} +4 -4
  63. package/template/dist/client/assets/{PostNotFound-ScC0039d.js → PostNotFound-WoSYGsGu.js} +1 -1
  64. package/template/dist/client/assets/{_basePickBy-B-GcvGxW.js → _basePickBy-Dd7GuR7A.js} +1 -1
  65. package/template/dist/client/assets/{_baseUniq-C1WySGZQ.js → _baseUniq-DMxQLGFI.js} +1 -1
  66. package/template/dist/client/assets/_lang-3AqGszEy.js +1 -0
  67. package/template/dist/client/assets/_lang._project-COkrIqzH.js +1 -0
  68. package/template/dist/client/assets/_lang._project._version-B8vRZczu.js +1 -0
  69. package/template/dist/client/assets/{_lang._project._version.docs-aw08dKvN.js → _lang._project._version.docs-DokNGgvU.js} +1 -1
  70. package/template/dist/client/assets/{_lang._project._version.docs._-B4Vb_S0V.js → _lang._project._version.docs._-CXCNZzOb.js} +1 -1
  71. package/template/dist/client/assets/_lang._project._version.docs._-DR0WSQEb.js +1 -0
  72. package/template/dist/client/assets/_lang._project._version.docs.framework._framework._-C_Grro8r.js +1 -0
  73. package/template/dist/client/assets/{_lang._project._version.docs.framework._framework.index-DInYPTXM.js → _lang._project._version.docs.framework._framework.index-DsYjXRdj.js} +1 -1
  74. package/template/dist/client/assets/{_lang._project._version.docs.framework.index-B7EvJmBI.js → _lang._project._version.docs.framework.index-DQX1lBi3.js} +1 -1
  75. package/template/dist/client/assets/{_lang._project.docs-4oX3ADgu.js → _lang._project.docs-DsYQj9jI.js} +1 -1
  76. package/template/dist/client/assets/_lang._project.docs._-DlM_D6DD.js +1 -0
  77. package/template/dist/client/assets/{_lang._project.docs._-emq0IsQw.js → _lang._project.docs._-l2tTjx80.js} +1 -1
  78. package/template/dist/client/assets/_lang.blog-CEwEtalL.js +1 -0
  79. package/template/dist/client/assets/_lang.blog-D6YGC3tK.js +1 -0
  80. package/template/dist/client/assets/_lang.blog._-DgHu4oLy.js +1 -0
  81. package/template/dist/client/assets/{_lang.blog._-DErizs7q.js → _lang.blog._-Umz18sQE.js} +1 -1
  82. package/template/dist/client/assets/_lang.blog.index-C8LKUFtD.js +1 -0
  83. package/template/dist/client/assets/{_lang.blog.index-DZDuDkQr.js → _lang.blog.index-DzUqpOBE.js} +1 -1
  84. package/template/dist/client/assets/{_lang.docs-CQK0rfqt.js → _lang.docs-CUh3R7DD.js} +1 -1
  85. package/template/dist/client/assets/{_lang.docs._-BiCvgeV1.js → _lang.docs._-DlgTPy3s.js} +1 -1
  86. package/template/dist/client/assets/_lang.docs._-DmaQE7lx.js +1 -0
  87. package/template/dist/client/assets/_lang.docs.framework._framework._-B4C4uDFp.js +1 -0
  88. package/template/dist/client/assets/{_lang.docs.framework._framework.index-Bu5p5Q_r.js → _lang.docs.framework._framework.index-DTg6Xd3p.js} +1 -1
  89. package/template/dist/client/assets/{_lang.docs.framework.index-uTDFLagP.js → _lang.docs.framework.index-BQ2enasl.js} +1 -1
  90. package/template/dist/client/assets/{arc-C16C7aa3.js → arc-DGPgC_QF.js} +1 -1
  91. package/template/dist/client/assets/{architectureDiagram-2XIMDMQ5-DgSSDH9Z.js → architectureDiagram-2XIMDMQ5-yI53_GAi.js} +1 -1
  92. package/template/dist/client/assets/{blockDiagram-WCTKOSBZ-Bs8e58Or.js → blockDiagram-WCTKOSBZ-C3tr24zy.js} +1 -1
  93. package/template/dist/client/assets/{c4Diagram-IC4MRINW-DsGaAPtm.js → c4Diagram-IC4MRINW-DOA-mowm.js} +1 -1
  94. package/template/dist/client/assets/channel-DzZD7dUQ.js +1 -0
  95. package/template/dist/client/assets/{chunk-4BX2VUAB-BQdq93Vq.js → chunk-4BX2VUAB-B6NSnNJJ.js} +1 -1
  96. package/template/dist/client/assets/{chunk-55IACEB6-zjp4uUiZ.js → chunk-55IACEB6-CWYwArBH.js} +1 -1
  97. package/template/dist/client/assets/{chunk-FMBD7UC4-CEdYlBOF.js → chunk-FMBD7UC4-DSyn2wIW.js} +1 -1
  98. package/template/dist/client/assets/{chunk-JSJVCQXG-CVkDw9ls.js → chunk-JSJVCQXG-D83nm5W0.js} +1 -1
  99. package/template/dist/client/assets/{chunk-KX2RTZJC--1vKv-mr.js → chunk-KX2RTZJC-DD7fN9e9.js} +1 -1
  100. package/template/dist/client/assets/{chunk-NQ4KR5QH-Cpo-W18l.js → chunk-NQ4KR5QH-C3YlYiU5.js} +1 -1
  101. package/template/dist/client/assets/{chunk-QZHKN3VN-BizWJuB4.js → chunk-QZHKN3VN-B7wBEuCG.js} +1 -1
  102. package/template/dist/client/assets/{chunk-WL4C6EOR-6lLYa9R1.js → chunk-WL4C6EOR-ByA1FloT.js} +1 -1
  103. package/template/dist/client/assets/classDiagram-VBA2DB6C-CRozKaUD.js +1 -0
  104. package/template/dist/client/assets/classDiagram-v2-RAHNMMFH-CRozKaUD.js +1 -0
  105. package/template/dist/client/assets/clone-CGnOEl4E.js +1 -0
  106. package/template/dist/client/assets/{cose-bilkent-S5V4N54A-CaD0EGPJ.js → cose-bilkent-S5V4N54A-nt_sXfWc.js} +1 -1
  107. package/template/dist/client/assets/{dagre-KLK3FWXG-h4F9WtDQ.js → dagre-KLK3FWXG-DUsyMTPd.js} +1 -1
  108. package/template/dist/client/assets/{diagram-E7M64L7V-CBUSWzH5.js → diagram-E7M64L7V-D5SAypX0.js} +1 -1
  109. package/template/dist/client/assets/{diagram-IFDJBPK2-C5oMubv0.js → diagram-IFDJBPK2-WhP5c8Vz.js} +1 -1
  110. package/template/dist/client/assets/{diagram-P4PSJMXO-DdPwwhHR.js → diagram-P4PSJMXO-AMrwIlhf.js} +1 -1
  111. package/template/dist/client/assets/{erDiagram-INFDFZHY-0U5A-RF0.js → erDiagram-INFDFZHY-BxifSpCV.js} +1 -1
  112. package/template/dist/client/assets/{flowDiagram-PKNHOUZH-CXN3pvSW.js → flowDiagram-PKNHOUZH-BMAowE9I.js} +1 -1
  113. package/template/dist/client/assets/{ganttDiagram-A5KZAMGK-DlovlSO7.js → ganttDiagram-A5KZAMGK-Bay-0iRq.js} +1 -1
  114. package/template/dist/client/assets/{gitGraphDiagram-K3NZZRJ6-Bo-Jjy7v.js → gitGraphDiagram-K3NZZRJ6-Va91W3gw.js} +1 -1
  115. package/template/dist/client/assets/{graph-C0TauvuO.js → graph-CbBYObK_.js} +1 -1
  116. package/template/dist/client/assets/{index-iATq4LEm.js → index-CF6qz2tX.js} +1 -1
  117. package/template/dist/client/assets/{infoDiagram-LFFYTUFH-BbvPzztn.js → infoDiagram-LFFYTUFH-Byd5C-4U.js} +1 -1
  118. package/template/dist/client/assets/{ishikawaDiagram-PHBUUO56-DKCMONMO.js → ishikawaDiagram-PHBUUO56-DxOKnE1v.js} +1 -1
  119. package/template/dist/client/assets/{journeyDiagram-4ABVD52K-D9NP_vvu.js → journeyDiagram-4ABVD52K-IRmt7RI4.js} +1 -1
  120. package/template/dist/client/assets/{kanban-definition-K7BYSVSG-X-u_nWxK.js → kanban-definition-K7BYSVSG-BjTVXn-R.js} +1 -1
  121. package/template/dist/client/assets/{layout-IeRzBrUX.js → layout-Bbx6A0bC.js} +1 -1
  122. package/template/dist/client/assets/{linear-DEzVUeiK.js → linear-Df2eAW4A.js} +1 -1
  123. package/template/dist/client/assets/{main-Csj9i19C.js → main-DqZtiCro.js} +2 -2
  124. package/template/dist/client/assets/{mermaid.core-CCnh2DG0.js → mermaid.core-BIoiBcAA.js} +4 -4
  125. package/template/dist/client/assets/{mindmap-definition-YRQLILUH-DgyN4Ft-.js → mindmap-definition-YRQLILUH-Btzz0iIP.js} +1 -1
  126. package/template/dist/client/assets/ordinal-Cboi1Yqb.js +1 -0
  127. package/template/dist/client/assets/{pieDiagram-SKSYHLDU-DDVqU_2Q.js → pieDiagram-SKSYHLDU-C2amrGtU.js} +1 -1
  128. package/template/dist/client/assets/{quadrantDiagram-337W2JSQ-BeUxMqle.js → quadrantDiagram-337W2JSQ-EVgH9VuN.js} +1 -1
  129. package/template/dist/client/assets/{react-os8EX6z1.js → react-qvbbiZob.js} +1 -1
  130. package/template/dist/client/assets/{requirementDiagram-Z7DCOOCP-CpzdlyEd.js → requirementDiagram-Z7DCOOCP-BkYPbRis.js} +1 -1
  131. package/template/dist/client/assets/{sankeyDiagram-WA2Y5GQK-CmSWF6XU.js → sankeyDiagram-WA2Y5GQK-B5EIaP-h.js} +1 -1
  132. package/template/dist/client/assets/{sequenceDiagram-2WXFIKYE-DarofLka.js → sequenceDiagram-2WXFIKYE-BC33VGOc.js} +1 -1
  133. package/template/dist/client/assets/{stateDiagram-RAJIS63D-CEio2h-7.js → stateDiagram-RAJIS63D-DiKvWUYb.js} +1 -1
  134. package/template/dist/client/assets/stateDiagram-v2-FVOUBMTO-DjKMPYGe.js +1 -0
  135. package/template/dist/client/assets/{timeline-definition-YZTLITO2-By_Wk6uc.js → timeline-definition-YZTLITO2-QiFlgbRA.js} +1 -1
  136. package/template/dist/client/assets/{treemap-KZPCXAKY-mKcaMbv9.js → treemap-KZPCXAKY-BOYbyS9G.js} +1 -1
  137. package/template/dist/client/assets/{vennDiagram-LZ73GAT5-Dx_Fh7nH.js → vennDiagram-LZ73GAT5-CqmW7j4r.js} +1 -1
  138. package/template/dist/client/assets/{xychartDiagram-JWTSCODW-DSAwWbBw.js → xychartDiagram-JWTSCODW-gj6oWX8l.js} +1 -1
  139. package/template/dist/server/assets/{Doc-B8TJBEmx.js → Doc-9tJiX5y6.js} +3 -3
  140. package/template/dist/server/assets/{DocsLayout-CnWgvk8u.js → DocsLayout-BTjhU_W5.js} +2 -2
  141. package/template/dist/server/assets/{Footer-WapWK45U.js → Footer-CefTi2yh.js} +1 -1
  142. package/template/dist/server/assets/{FrameworkContent-gzqT-Q1n.js → FrameworkContent-BkJvuP04.js} +2 -2
  143. package/template/dist/server/assets/{MarkdownHeadingContext-Iyk66Y4x.js → MarkdownHeadingContext-37oQpb36.js} +3 -3
  144. package/template/dist/server/assets/{PostNotFound-GKdNuzsX.js → PostNotFound-BqBZf83v.js} +1 -1
  145. package/template/dist/server/assets/{_basePickBy-DJ9gzwF8.js → _basePickBy-DZ3TPUta.js} +2 -2
  146. package/template/dist/server/assets/{_baseUniq-CezmbvU2.js → _baseUniq-DKicWTQT.js} +1 -1
  147. package/template/dist/server/assets/{_lang._project._version.docs-BOZ34yW7.js → _lang._project._version.docs-U-t4mk5_.js} +3 -3
  148. package/template/dist/server/assets/{_lang._project._version.docs._-5W2jN7Re.js → _lang._project._version.docs._-DMgnElWM.js} +5 -5
  149. package/template/dist/server/assets/{_lang._project._version.docs.framework._framework._-DeN_oA8l.js → _lang._project._version.docs.framework._framework._-kBw_9L-F.js} +5 -5
  150. package/template/dist/server/assets/{_lang._project._version.docs.framework._framework.index-jWKDCQSE.js → _lang._project._version.docs.framework._framework.index-Bsyj0DD5.js} +1 -1
  151. package/template/dist/server/assets/{_lang._project._version.docs.framework.index-DOT4MtjZ.js → _lang._project._version.docs.framework.index-CmLAP_Io.js} +1 -1
  152. package/template/dist/server/assets/{_lang._project.docs-r4V9TXuu.js → _lang._project.docs-Bb4ZZ_jr.js} +3 -3
  153. package/template/dist/server/assets/{_lang._project.docs._-Bge7JaYE.js → _lang._project.docs._-ChrpJ61j.js} +5 -5
  154. package/template/dist/server/assets/{_lang.blog-DJOfiyA8.js → _lang.blog-8j6IvzvQ.js} +2 -2
  155. package/template/dist/server/assets/{_lang.blog._-yJSqbX08.js → _lang.blog._-BPzP97Ac.js} +2 -2
  156. package/template/dist/server/assets/{_lang.blog.index-CrdyROhK.js → _lang.blog._-DNX8UglA.js} +2 -2
  157. package/template/dist/server/assets/{_lang.blog.index-Df_6_IKx.js → _lang.blog.index-CeZnMJBi.js} +1 -1
  158. package/template/dist/server/assets/{_lang.blog._-C7iqMj9O.js → _lang.blog.index-DzVKqoC4.js} +2 -2
  159. package/template/dist/server/assets/{_lang.docs-Jwt4deTW.js → _lang.docs-B4StnHMb.js} +3 -3
  160. package/template/dist/server/assets/{_lang.docs._-D_DdKLAV.js → _lang.docs._--c0In1AT.js} +5 -5
  161. package/template/dist/server/assets/{_lang.docs.framework._framework._-BkQaZ_1f.js → _lang.docs.framework._framework._-Be0U7cDg.js} +5 -5
  162. package/template/dist/server/assets/{_lang.docs.framework._framework.index-BLx8p8IS.js → _lang.docs.framework._framework.index-BZ512aSk.js} +1 -1
  163. package/template/dist/server/assets/{_lang.docs.framework.index-BytQ_q8T.js → _lang.docs.framework.index-U8z3j4kz.js} +1 -1
  164. package/template/dist/server/assets/{_tanstack-start-manifest_v-RX6ItZ5S.js → _tanstack-start-manifest_v-DXpQ8503.js} +1 -1
  165. package/template/dist/server/assets/{arc-BwftnT5H.js → arc-B4h6h_n6.js} +1 -1
  166. package/template/dist/server/assets/{architecture-PBZL5I3N-KbDVC6gM.js → architecture-PBZL5I3N-CUwqLXkR.js} +6 -6
  167. package/template/dist/server/assets/{architectureDiagram-2XIMDMQ5-BoLvWxb3.js → architectureDiagram-2XIMDMQ5-CuCoxdBe.js} +6 -6
  168. package/template/dist/server/assets/{blockDiagram-WCTKOSBZ-GPFcXs-f.js → blockDiagram-WCTKOSBZ-D5PsUOim.js} +6 -6
  169. package/template/dist/server/assets/{c4Diagram-IC4MRINW-EQwQCspo.js → c4Diagram-IC4MRINW-CXy5xO3o.js} +2 -2
  170. package/template/dist/server/assets/{channel-CxvwuPH7.js → channel-D0l-mWaF.js} +1 -1
  171. package/template/dist/server/assets/{chunk-4BX2VUAB-DUgcw5ei.js → chunk-4BX2VUAB-M7FVHMss.js} +1 -1
  172. package/template/dist/server/assets/{chunk-55IACEB6-Cn15uD91.js → chunk-55IACEB6-D_gDAje5.js} +1 -1
  173. package/template/dist/server/assets/{chunk-FMBD7UC4-Ck3iyLPu.js → chunk-FMBD7UC4-B5Bebx-Y.js} +1 -1
  174. package/template/dist/server/assets/{chunk-JSJVCQXG-VAT8yncE.js → chunk-JSJVCQXG-DxBkq-uB.js} +1 -1
  175. package/template/dist/server/assets/{chunk-KX2RTZJC-B1bd2VmA.js → chunk-KX2RTZJC-BMHm1EGi.js} +1 -1
  176. package/template/dist/server/assets/{chunk-NQ4KR5QH-CR67GG9C.js → chunk-NQ4KR5QH-Cp28pTwT.js} +3 -3
  177. package/template/dist/server/assets/{chunk-QZHKN3VN-B9SSazM4.js → chunk-QZHKN3VN-Bq5GZqaR.js} +1 -1
  178. package/template/dist/server/assets/{chunk-WL4C6EOR-DZ4Pjuao.js → chunk-WL4C6EOR-C9Nj5GdW.js} +5 -5
  179. package/template/dist/server/assets/{classDiagram-VBA2DB6C-CA6_4Wb2.js → classDiagram-VBA2DB6C-CUchv9T5.js} +6 -6
  180. package/template/dist/server/assets/{classDiagram-v2-RAHNMMFH-CA6_4Wb2.js → classDiagram-v2-RAHNMMFH-CUchv9T5.js} +6 -6
  181. package/template/dist/server/assets/{clone-DJHP_iVy.js → clone-CJcTi58S.js} +1 -1
  182. package/template/dist/server/assets/{cose-bilkent-S5V4N54A-DtU-cN6W.js → cose-bilkent-S5V4N54A-CxvCMhN_.js} +1 -1
  183. package/template/dist/server/assets/{dagre-KLK3FWXG-yZYrVU4p.js → dagre-KLK3FWXG-B5bQP7FL.js} +6 -6
  184. package/template/dist/server/assets/{diagram-E7M64L7V-8Yyz0aw0.js → diagram-E7M64L7V-NjHca90S.js} +8 -8
  185. package/template/dist/server/assets/{diagram-IFDJBPK2-DcxFYI3M.js → diagram-IFDJBPK2-CoTCfBKd.js} +6 -6
  186. package/template/dist/server/assets/{diagram-P4PSJMXO-CehxUcI0.js → diagram-P4PSJMXO-DHvGgYjH.js} +6 -6
  187. package/template/dist/server/assets/{erDiagram-INFDFZHY-Bu2p1_Pj.js → erDiagram-INFDFZHY-01crajKr.js} +4 -4
  188. package/template/dist/server/assets/{flowDiagram-PKNHOUZH-B_eKR7I0.js → flowDiagram-PKNHOUZH-BkUQ_vxg.js} +6 -6
  189. package/template/dist/server/assets/{ganttDiagram-A5KZAMGK-DP6YEZof.js → ganttDiagram-A5KZAMGK-DvrO-w2P.js} +2 -2
  190. package/template/dist/server/assets/{gitGraph-HDMCJU4V-Bt0qhVL4.js → gitGraph-HDMCJU4V-h9JNaxB7.js} +6 -6
  191. package/template/dist/server/assets/{gitGraphDiagram-K3NZZRJ6-DwvkdYrg.js → gitGraphDiagram-K3NZZRJ6-BoKm6Fm-.js} +7 -7
  192. package/template/dist/server/assets/{graph-BVFNe_k5.js → graph-BoxbfI7Z.js} +2 -2
  193. package/template/dist/server/assets/{index-DvBGSZeA.js → index-Jfzi6SZW.js} +2 -2
  194. package/template/dist/server/assets/{info-3K5VOQVL-CFejRnvB.js → info-3K5VOQVL-DgaSHqkS.js} +6 -6
  195. package/template/dist/server/assets/{infoDiagram-LFFYTUFH-D0v9uyXI.js → infoDiagram-LFFYTUFH-DgV5W8-I.js} +5 -5
  196. package/template/dist/server/assets/{ishikawaDiagram-PHBUUO56-DZumspL4.js → ishikawaDiagram-PHBUUO56-CqlMQ0Fq.js} +1 -1
  197. package/template/dist/server/assets/{journeyDiagram-4ABVD52K-nRp_-qZp.js → journeyDiagram-4ABVD52K-D6ySTub8.js} +4 -4
  198. package/template/dist/server/assets/{kanban-definition-K7BYSVSG-BMKyyzjt.js → kanban-definition-K7BYSVSG-BT8m7Cwk.js} +2 -2
  199. package/template/dist/server/assets/{layout-mpiN5R-5.js → layout-CkYcErfn.js} +4 -4
  200. package/template/dist/server/assets/{linear-CqNYgjEx.js → linear-F_0dWGZL.js} +1 -1
  201. package/template/dist/server/assets/{mermaid-parser.core-B8Uu3QZY.js → mermaid-parser.core-q5MdUJuo.js} +11 -11
  202. package/template/dist/server/assets/{mermaid.core-BI3nMhNO.js → mermaid.core-DOWTODR1.js} +31 -31
  203. package/template/dist/server/assets/{mindmap-definition-YRQLILUH-DCoFqLPh.js → mindmap-definition-YRQLILUH-BQxlQqn-.js} +3 -3
  204. package/template/dist/server/assets/{ordinal-Bcam90FY.js → ordinal-CxptdPJm.js} +1 -1
  205. package/template/dist/server/assets/{packet-RMMSAZCW-djgonfKN.js → packet-RMMSAZCW-D8FkLZuP.js} +6 -6
  206. package/template/dist/server/assets/{pie-UPGHQEXC-Dug2t-PE.js → pie-UPGHQEXC-Diw2fHLk.js} +6 -6
  207. package/template/dist/server/assets/{pieDiagram-SKSYHLDU-CS0_hW4w.js → pieDiagram-SKSYHLDU-B1J4UJZ7.js} +8 -8
  208. package/template/dist/server/assets/{quadrantDiagram-337W2JSQ-BpQNM0zu.js → quadrantDiagram-337W2JSQ-BvjKLapg.js} +2 -2
  209. package/template/dist/server/assets/{radar-KQ55EAFF-3ir2W9Wi.js → radar-KQ55EAFF-CcBdPU3n.js} +6 -6
  210. package/template/dist/server/assets/{requirementDiagram-Z7DCOOCP-D92RyjV4.js → requirementDiagram-Z7DCOOCP-Bgr_wnAs.js} +3 -3
  211. package/template/dist/server/assets/{router-DPPgDicW.js → router-DxwPl-Dc.js} +18 -18
  212. package/template/dist/server/assets/{sankeyDiagram-WA2Y5GQK-DCPRB-xO.js → sankeyDiagram-WA2Y5GQK-B0UwtyW3.js} +2 -2
  213. package/template/dist/server/assets/{sequenceDiagram-2WXFIKYE-C1ab2VvU.js → sequenceDiagram-2WXFIKYE-BbxQJHjO.js} +3 -3
  214. package/template/dist/server/assets/{stateDiagram-RAJIS63D-GhG1G3ff.js → stateDiagram-RAJIS63D-Cg-uJ_UO.js} +8 -8
  215. package/template/dist/server/assets/{stateDiagram-v2-FVOUBMTO-C-KtMadV.js → stateDiagram-v2-FVOUBMTO-BWVPrqfa.js} +4 -4
  216. package/template/dist/server/assets/{timeline-definition-YZTLITO2-DyfAQCd4.js → timeline-definition-YZTLITO2-DCSJT2WT.js} +2 -2
  217. package/template/dist/server/assets/{treemap-KZPCXAKY-Cn0Cw4Cl.js → treemap-KZPCXAKY-a0nhlKgx.js} +6 -6
  218. package/template/dist/server/assets/{vennDiagram-LZ73GAT5-D2Ak5JUa.js → vennDiagram-LZ73GAT5-Bk2HQEQq.js} +1 -1
  219. package/template/dist/server/assets/{xychartDiagram-JWTSCODW-DqoBOs1L.js → xychartDiagram-JWTSCODW-C4svHkt_.js} +3 -3
  220. package/template/dist/server/server.js +9 -9
  221. package/admin/dist/server/assets/auth-dSAIPjBw.js +0 -72
  222. package/template/dist/client/assets/_lang-B3tRf7os.js +0 -1
  223. package/template/dist/client/assets/_lang._project-CH0inpmY.js +0 -1
  224. package/template/dist/client/assets/_lang._project._version-CESvrqds.js +0 -1
  225. package/template/dist/client/assets/_lang._project._version.docs._-BexMyJr9.js +0 -1
  226. package/template/dist/client/assets/_lang._project._version.docs.framework._framework._-BbQgUWTH.js +0 -1
  227. package/template/dist/client/assets/_lang._project.docs._-R9bOn492.js +0 -1
  228. package/template/dist/client/assets/_lang.blog-BViCs72M.js +0 -1
  229. package/template/dist/client/assets/_lang.blog-DhVkwYEk.js +0 -1
  230. package/template/dist/client/assets/_lang.blog._-BHdaHDBU.js +0 -1
  231. package/template/dist/client/assets/_lang.blog.index-CELEUrkj.js +0 -1
  232. package/template/dist/client/assets/_lang.docs._-axvS_dfl.js +0 -1
  233. package/template/dist/client/assets/_lang.docs.framework._framework._-D2FAQ0gW.js +0 -1
  234. package/template/dist/client/assets/channel-Clrp6Lr4.js +0 -1
  235. package/template/dist/client/assets/classDiagram-VBA2DB6C-Beq6_jEy.js +0 -1
  236. package/template/dist/client/assets/classDiagram-v2-RAHNMMFH-Beq6_jEy.js +0 -1
  237. package/template/dist/client/assets/clone-BbBu6MzK.js +0 -1
  238. package/template/dist/client/assets/ordinal-BENe2yWM.js +0 -1
  239. package/template/dist/client/assets/stateDiagram-v2-FVOUBMTO-CbfK0_BD.js +0 -1
  240. /package/admin/dist/server/assets/{error-CASJ5tIm.js → error-CxLURp5B.js} +0 -0
  241. /package/admin/dist/server/assets/{job-manager-D9Ab9hgu.js → job-manager-3L0YHdRR.js} +0 -0
  242. /package/admin/dist/server/assets/{migrator-ZpVZslbq.js → migrator-6o36lk3A.js} +0 -0
  243. /package/admin/dist/server/assets/{start-BiybVoR2.js → start-BYRsG6Vf.js} +0 -0
  244. /package/admin/dist/server/assets/{string-B4XlckmJ.js → string-Dgr41sRK.js} +0 -0
  245. /package/admin/dist/server/assets/{useNavigate-0H08s_Q2.js → useNavigate-CDLfQmZd.js} +0 -0
@@ -0,0 +1,3236 @@
1
+ import { i as __toESM } from "./chunk-CNvmzFzq.js";
2
+ import { l as require_react, r as require_jsx_runtime, t as useRouter } from "./useRouter-BXJvr8to.js";
3
+ import { A as decodePath, B as replaceEqualDeep, C as processRouteMasks, D as DEFAULT_PROTOCOL_ALLOWLIST, E as invariant, F as isDangerousProtocol, L as isPromise, M as encodePathLikeUrl, N as escapeHtml, O as arraysEqual, P as functionalUpdate, R as last, S as findSingleMatch, T as createLRUCache, _ as trimPath, a as matchContext, b as findFlatMatch, c as rootRouteId, d as compileDecodeCharMap, g as resolvePath, j as deepEqual, k as createControlledPromise, l as isNotFound, m as joinPaths, o as ClientOnly, p as interpolatePath, r as useStore, u as cleanPath, w as processRouteTree, x as findRouteMatch, y as trimPathRight, z as nullReplaceEqualDeep } from "./__tanstack-start-server-fn-resolver-SG4WUVWE.js";
4
+ import { g as redirect, m as isRedirect } from "./createServerFn-CAF9Kl7K.js";
5
+ //#region ../../node_modules/.bun/@tanstack+router-core@1.168.3/node_modules/@tanstack/router-core/dist/esm/scroll-restoration.js
6
+ function getSafeSessionStorage() {
7
+ try {
8
+ if (typeof window !== "undefined" && typeof window.sessionStorage === "object") return window.sessionStorage;
9
+ } catch {}
10
+ }
11
+ /** SessionStorage key used to persist scroll restoration state. */
12
+ /** SessionStorage key used to store scroll positions across navigations. */
13
+ /** SessionStorage key used to store scroll positions across navigations. */
14
+ var storageKey = "tsr-scroll-restoration-v1_3";
15
+ function createScrollRestorationCache() {
16
+ const safeSessionStorage = getSafeSessionStorage();
17
+ if (!safeSessionStorage) return null;
18
+ const persistedState = safeSessionStorage.getItem(storageKey);
19
+ let state = persistedState ? JSON.parse(persistedState) : {};
20
+ return {
21
+ state,
22
+ set: (updater) => {
23
+ state = functionalUpdate(updater, state) || state;
24
+ try {
25
+ safeSessionStorage.setItem(storageKey, JSON.stringify(state));
26
+ } catch {
27
+ console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.");
28
+ }
29
+ }
30
+ };
31
+ }
32
+ createScrollRestorationCache();
33
+ /**
34
+ * The default `getKey` function for `useScrollRestoration`.
35
+ * It returns the `key` from the location state or the `href` of the location.
36
+ *
37
+ * The `location.href` is used as a fallback to support the use case where the location state is not available like the initial render.
38
+ */
39
+ /**
40
+ * Default scroll restoration cache key: location state key or full href.
41
+ */
42
+ var defaultGetScrollRestorationKey = (location) => {
43
+ return location.state.__TSR_key || location.href;
44
+ };
45
+ function restoreScroll({ storageKey, key, behavior, shouldScrollRestoration, scrollToTopSelectors, location }) {
46
+ let byKey;
47
+ try {
48
+ byKey = JSON.parse(sessionStorage.getItem(storageKey) || "{}");
49
+ } catch (error) {
50
+ console.error(error);
51
+ return;
52
+ }
53
+ const resolvedKey = key || window.history.state?.__TSR_key;
54
+ const elementEntries = byKey[resolvedKey];
55
+ scroll: {
56
+ if (shouldScrollRestoration && elementEntries && Object.keys(elementEntries).length > 0) {
57
+ for (const elementSelector in elementEntries) {
58
+ const entry = elementEntries[elementSelector];
59
+ if (elementSelector === "window") window.scrollTo({
60
+ top: entry.scrollY,
61
+ left: entry.scrollX,
62
+ behavior
63
+ });
64
+ else if (elementSelector) {
65
+ const element = document.querySelector(elementSelector);
66
+ if (element) {
67
+ element.scrollLeft = entry.scrollX;
68
+ element.scrollTop = entry.scrollY;
69
+ }
70
+ }
71
+ }
72
+ break scroll;
73
+ }
74
+ const hash = (location ?? window.location).hash.split("#", 2)[1];
75
+ if (hash) {
76
+ const hashScrollIntoViewOptions = window.history.state?.__hashScrollIntoViewOptions ?? true;
77
+ if (hashScrollIntoViewOptions) {
78
+ const el = document.getElementById(hash);
79
+ if (el) el.scrollIntoView(hashScrollIntoViewOptions);
80
+ }
81
+ break scroll;
82
+ }
83
+ const scrollOptions = {
84
+ top: 0,
85
+ left: 0,
86
+ behavior
87
+ };
88
+ window.scrollTo(scrollOptions);
89
+ if (scrollToTopSelectors) for (const selector of scrollToTopSelectors) {
90
+ if (selector === "window") continue;
91
+ const element = typeof selector === "function" ? selector() : document.querySelector(selector);
92
+ if (element) element.scrollTo(scrollOptions);
93
+ }
94
+ }
95
+ }
96
+ /**
97
+ * @private
98
+ * Handles hash-based scrolling after navigation completes.
99
+ * To be used in framework-specific <Transitioner> components during the onResolved event.
100
+ *
101
+ * Provides hash scrolling for programmatic navigation when default browser handling is prevented.
102
+ * @param router The router instance containing current location and state
103
+ */
104
+ /**
105
+ * @private
106
+ * Handles hash-based scrolling after navigation completes.
107
+ * To be used in framework-specific Transitioners.
108
+ */
109
+ function handleHashScroll(router) {
110
+ if (typeof document !== "undefined" && document.querySelector) {
111
+ const location = router.stores.location.state;
112
+ const hashScrollIntoViewOptions = location.state.__hashScrollIntoViewOptions ?? true;
113
+ if (hashScrollIntoViewOptions && location.hash !== "") {
114
+ const el = document.getElementById(location.hash);
115
+ if (el) el.scrollIntoView(hashScrollIntoViewOptions);
116
+ }
117
+ }
118
+ }
119
+ //#endregion
120
+ //#region ../../node_modules/.bun/@tanstack+router-core@1.168.3/node_modules/@tanstack/router-core/dist/esm/qss.js
121
+ /**
122
+ * Program is a reimplementation of the `qss` package:
123
+ * Copyright (c) Luke Edwards luke.edwards05@gmail.com, MIT License
124
+ * https://github.com/lukeed/qss/blob/master/license.md
125
+ *
126
+ * This reimplementation uses modern browser APIs
127
+ * (namely URLSearchParams) and TypeScript while still
128
+ * maintaining the original functionality and interface.
129
+ *
130
+ * Update: this implementation has also been mangled to
131
+ * fit exactly our use-case (single value per key in encoding).
132
+ */
133
+ /**
134
+ * Encodes an object into a query string.
135
+ * @param obj - The object to encode into a query string.
136
+ * @param stringify - An optional custom stringify function.
137
+ * @returns The encoded query string.
138
+ * @example
139
+ * ```
140
+ * // Example input: encode({ token: 'foo', key: 'value' })
141
+ * // Expected output: "token=foo&key=value"
142
+ * ```
143
+ */
144
+ function encode(obj, stringify = String) {
145
+ const result = new URLSearchParams();
146
+ for (const key in obj) {
147
+ const val = obj[key];
148
+ if (val !== void 0) result.set(key, stringify(val));
149
+ }
150
+ return result.toString();
151
+ }
152
+ /**
153
+ * Converts a string value to its appropriate type (string, number, boolean).
154
+ * @param mix - The string value to convert.
155
+ * @returns The converted value.
156
+ * @example
157
+ * // Example input: toValue("123")
158
+ * // Expected output: 123
159
+ */
160
+ function toValue(str) {
161
+ if (!str) return "";
162
+ if (str === "false") return false;
163
+ if (str === "true") return true;
164
+ return +str * 0 === 0 && +str + "" === str ? +str : str;
165
+ }
166
+ /**
167
+ * Decodes a query string into an object.
168
+ * @param str - The query string to decode.
169
+ * @returns The decoded key-value pairs in an object format.
170
+ * @example
171
+ * // Example input: decode("token=foo&key=value")
172
+ * // Expected output: { "token": "foo", "key": "value" }
173
+ */
174
+ function decode(str) {
175
+ const searchParams = new URLSearchParams(str);
176
+ const result = Object.create(null);
177
+ for (const [key, value] of searchParams.entries()) {
178
+ const previousValue = result[key];
179
+ if (previousValue == null) result[key] = toValue(value);
180
+ else if (Array.isArray(previousValue)) previousValue.push(toValue(value));
181
+ else result[key] = [previousValue, toValue(value)];
182
+ }
183
+ return result;
184
+ }
185
+ //#endregion
186
+ //#region ../../node_modules/.bun/@tanstack+router-core@1.168.3/node_modules/@tanstack/router-core/dist/esm/searchParams.js
187
+ /** Default `parseSearch` that strips leading '?' and JSON-parses values. */
188
+ var defaultParseSearch = parseSearchWith(JSON.parse);
189
+ /** Default `stringifySearch` using JSON.stringify for complex values. */
190
+ var defaultStringifySearch = stringifySearchWith(JSON.stringify, JSON.parse);
191
+ /**
192
+ * Build a `parseSearch` function using a provided JSON-like parser.
193
+ *
194
+ * The returned function strips a leading `?`, decodes values, and attempts to
195
+ * JSON-parse string values using the given `parser`.
196
+ *
197
+ * @param parser Function to parse a string value (e.g. `JSON.parse`).
198
+ * @returns A `parseSearch` function compatible with `Router` options.
199
+ * @link https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization
200
+ */
201
+ function parseSearchWith(parser) {
202
+ return (searchStr) => {
203
+ if (searchStr[0] === "?") searchStr = searchStr.substring(1);
204
+ const query = decode(searchStr);
205
+ for (const key in query) {
206
+ const value = query[key];
207
+ if (typeof value === "string") try {
208
+ query[key] = parser(value);
209
+ } catch (_err) {}
210
+ }
211
+ return query;
212
+ };
213
+ }
214
+ /**
215
+ * Build a `stringifySearch` function using a provided serializer.
216
+ *
217
+ * Non-primitive values are serialized with `stringify`. If a `parser` is
218
+ * supplied, string values that are parseable are re-serialized to ensure
219
+ * symmetry with `parseSearch`.
220
+ *
221
+ * @param stringify Function to serialize a value (e.g. `JSON.stringify`).
222
+ * @param parser Optional parser to detect parseable strings.
223
+ * @returns A `stringifySearch` function compatible with `Router` options.
224
+ * @link https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization
225
+ */
226
+ function stringifySearchWith(stringify, parser) {
227
+ const hasParser = typeof parser === "function";
228
+ function stringifyValue(val) {
229
+ if (typeof val === "object" && val !== null) try {
230
+ return stringify(val);
231
+ } catch (_err) {}
232
+ else if (hasParser && typeof val === "string") try {
233
+ parser(val);
234
+ return stringify(val);
235
+ } catch (_err) {}
236
+ return val;
237
+ }
238
+ return (search) => {
239
+ const searchStr = encode(search, stringifyValue);
240
+ return searchStr ? `?${searchStr}` : "";
241
+ };
242
+ }
243
+ //#endregion
244
+ //#region ../../node_modules/.bun/@tanstack+router-core@1.168.3/node_modules/@tanstack/router-core/dist/esm/rewrite.js
245
+ /** Compose multiple rewrite pairs into a single in/out rewrite. */
246
+ /** Compose multiple rewrite pairs into a single in/out rewrite. */
247
+ function composeRewrites(rewrites) {
248
+ return {
249
+ input: ({ url }) => {
250
+ for (const rewrite of rewrites) url = executeRewriteInput(rewrite, url);
251
+ return url;
252
+ },
253
+ output: ({ url }) => {
254
+ for (let i = rewrites.length - 1; i >= 0; i--) url = executeRewriteOutput(rewrites[i], url);
255
+ return url;
256
+ }
257
+ };
258
+ }
259
+ /** Create a rewrite pair that strips/adds a basepath on input/output. */
260
+ /** Create a rewrite pair that strips/adds a basepath on input/output. */
261
+ function rewriteBasepath(opts) {
262
+ const trimmedBasepath = trimPath(opts.basepath);
263
+ const normalizedBasepath = `/${trimmedBasepath}`;
264
+ const normalizedBasepathWithSlash = `${normalizedBasepath}/`;
265
+ const checkBasepath = opts.caseSensitive ? normalizedBasepath : normalizedBasepath.toLowerCase();
266
+ const checkBasepathWithSlash = opts.caseSensitive ? normalizedBasepathWithSlash : normalizedBasepathWithSlash.toLowerCase();
267
+ return {
268
+ input: ({ url }) => {
269
+ const pathname = opts.caseSensitive ? url.pathname : url.pathname.toLowerCase();
270
+ if (pathname === checkBasepath) url.pathname = "/";
271
+ else if (pathname.startsWith(checkBasepathWithSlash)) url.pathname = url.pathname.slice(normalizedBasepath.length);
272
+ return url;
273
+ },
274
+ output: ({ url }) => {
275
+ url.pathname = joinPaths([
276
+ "/",
277
+ trimmedBasepath,
278
+ url.pathname
279
+ ]);
280
+ return url;
281
+ }
282
+ };
283
+ }
284
+ /** Execute a location input rewrite if provided. */
285
+ /** Execute a location input rewrite if provided. */
286
+ function executeRewriteInput(rewrite, url) {
287
+ const res = rewrite?.input?.({ url });
288
+ if (res) {
289
+ if (typeof res === "string") return new URL(res);
290
+ else if (res instanceof URL) return res;
291
+ }
292
+ return url;
293
+ }
294
+ /** Execute a location output rewrite if provided. */
295
+ /** Execute a location output rewrite if provided. */
296
+ function executeRewriteOutput(rewrite, url) {
297
+ const res = rewrite?.output?.({ url });
298
+ if (res) {
299
+ if (typeof res === "string") return new URL(res);
300
+ else if (res instanceof URL) return res;
301
+ }
302
+ return url;
303
+ }
304
+ //#endregion
305
+ //#region ../../node_modules/.bun/@tanstack+router-core@1.168.3/node_modules/@tanstack/router-core/dist/esm/stores.js
306
+ /** SSR non-reactive createMutableStore */
307
+ function createNonReactiveMutableStore(initialValue) {
308
+ let value = initialValue;
309
+ return {
310
+ get state() {
311
+ return value;
312
+ },
313
+ setState(updater) {
314
+ value = updater(value);
315
+ }
316
+ };
317
+ }
318
+ /** SSR non-reactive createReadonlyStore */
319
+ function createNonReactiveReadonlyStore(read) {
320
+ return { get state() {
321
+ return read();
322
+ } };
323
+ }
324
+ function createRouterStores(initialState, config) {
325
+ const { createMutableStore, createReadonlyStore, batch, init } = config;
326
+ const activeMatchStoresById = /* @__PURE__ */ new Map();
327
+ const pendingMatchStoresById = /* @__PURE__ */ new Map();
328
+ const cachedMatchStoresById = /* @__PURE__ */ new Map();
329
+ const status = createMutableStore(initialState.status);
330
+ const loadedAt = createMutableStore(initialState.loadedAt);
331
+ const isLoading = createMutableStore(initialState.isLoading);
332
+ const isTransitioning = createMutableStore(initialState.isTransitioning);
333
+ const location = createMutableStore(initialState.location);
334
+ const resolvedLocation = createMutableStore(initialState.resolvedLocation);
335
+ const statusCode = createMutableStore(initialState.statusCode);
336
+ const redirect = createMutableStore(initialState.redirect);
337
+ const matchesId = createMutableStore([]);
338
+ const pendingMatchesId = createMutableStore([]);
339
+ const cachedMatchesId = createMutableStore([]);
340
+ const activeMatchesSnapshot = createReadonlyStore(() => readPoolMatches(activeMatchStoresById, matchesId.state));
341
+ const pendingMatchesSnapshot = createReadonlyStore(() => readPoolMatches(pendingMatchStoresById, pendingMatchesId.state));
342
+ const cachedMatchesSnapshot = createReadonlyStore(() => readPoolMatches(cachedMatchStoresById, cachedMatchesId.state));
343
+ const firstMatchId = createReadonlyStore(() => matchesId.state[0]);
344
+ const hasPendingMatches = createReadonlyStore(() => matchesId.state.some((matchId) => {
345
+ return activeMatchStoresById.get(matchId)?.state.status === "pending";
346
+ }));
347
+ const matchRouteReactivity = createReadonlyStore(() => ({
348
+ locationHref: location.state.href,
349
+ resolvedLocationHref: resolvedLocation.state?.href,
350
+ status: status.state
351
+ }));
352
+ const __store = createReadonlyStore(() => ({
353
+ status: status.state,
354
+ loadedAt: loadedAt.state,
355
+ isLoading: isLoading.state,
356
+ isTransitioning: isTransitioning.state,
357
+ matches: activeMatchesSnapshot.state,
358
+ location: location.state,
359
+ resolvedLocation: resolvedLocation.state,
360
+ statusCode: statusCode.state,
361
+ redirect: redirect.state
362
+ }));
363
+ const matchStoreByRouteIdCache = createLRUCache(64);
364
+ function getMatchStoreByRouteId(routeId) {
365
+ let cached = matchStoreByRouteIdCache.get(routeId);
366
+ if (!cached) {
367
+ cached = createReadonlyStore(() => {
368
+ const ids = matchesId.state;
369
+ for (const id of ids) {
370
+ const matchStore = activeMatchStoresById.get(id);
371
+ if (matchStore && matchStore.routeId === routeId) return matchStore.state;
372
+ }
373
+ });
374
+ matchStoreByRouteIdCache.set(routeId, cached);
375
+ }
376
+ return cached;
377
+ }
378
+ const store = {
379
+ status,
380
+ loadedAt,
381
+ isLoading,
382
+ isTransitioning,
383
+ location,
384
+ resolvedLocation,
385
+ statusCode,
386
+ redirect,
387
+ matchesId,
388
+ pendingMatchesId,
389
+ cachedMatchesId,
390
+ activeMatchesSnapshot,
391
+ pendingMatchesSnapshot,
392
+ cachedMatchesSnapshot,
393
+ firstMatchId,
394
+ hasPendingMatches,
395
+ matchRouteReactivity,
396
+ activeMatchStoresById,
397
+ pendingMatchStoresById,
398
+ cachedMatchStoresById,
399
+ __store,
400
+ getMatchStoreByRouteId,
401
+ setActiveMatches,
402
+ setPendingMatches,
403
+ setCachedMatches
404
+ };
405
+ setActiveMatches(initialState.matches);
406
+ init?.(store);
407
+ function setActiveMatches(nextMatches) {
408
+ reconcileMatchPool(nextMatches, activeMatchStoresById, matchesId, createMutableStore, batch);
409
+ }
410
+ function setPendingMatches(nextMatches) {
411
+ reconcileMatchPool(nextMatches, pendingMatchStoresById, pendingMatchesId, createMutableStore, batch);
412
+ }
413
+ function setCachedMatches(nextMatches) {
414
+ reconcileMatchPool(nextMatches, cachedMatchStoresById, cachedMatchesId, createMutableStore, batch);
415
+ }
416
+ return store;
417
+ }
418
+ function readPoolMatches(pool, ids) {
419
+ const matches = [];
420
+ for (const id of ids) {
421
+ const matchStore = pool.get(id);
422
+ if (matchStore) matches.push(matchStore.state);
423
+ }
424
+ return matches;
425
+ }
426
+ function reconcileMatchPool(nextMatches, pool, idStore, createMutableStore, batch) {
427
+ const nextIds = nextMatches.map((d) => d.id);
428
+ const nextIdSet = new Set(nextIds);
429
+ batch(() => {
430
+ for (const id of pool.keys()) if (!nextIdSet.has(id)) pool.delete(id);
431
+ for (const nextMatch of nextMatches) {
432
+ const existing = pool.get(nextMatch.id);
433
+ if (!existing) {
434
+ const matchStore = createMutableStore(nextMatch);
435
+ matchStore.routeId = nextMatch.routeId;
436
+ pool.set(nextMatch.id, matchStore);
437
+ continue;
438
+ }
439
+ existing.routeId = nextMatch.routeId;
440
+ if (existing.state !== nextMatch) existing.setState(() => nextMatch);
441
+ }
442
+ if (!arraysEqual(idStore.state, nextIds)) idStore.setState(() => nextIds);
443
+ });
444
+ }
445
+ //#endregion
446
+ //#region ../../node_modules/.bun/@tanstack+router-core@1.168.3/node_modules/@tanstack/router-core/dist/esm/load-matches.js
447
+ var triggerOnReady = (inner) => {
448
+ if (!inner.rendered) {
449
+ inner.rendered = true;
450
+ return inner.onReady?.();
451
+ }
452
+ };
453
+ var resolvePreload = (inner, matchId) => {
454
+ return !!(inner.preload && !inner.router.stores.activeMatchStoresById.has(matchId));
455
+ };
456
+ /**
457
+ * Builds the accumulated context from router options and all matches up to (and optionally including) the given index.
458
+ * Merges __routeContext and __beforeLoadContext from each match.
459
+ */
460
+ var buildMatchContext = (inner, index, includeCurrentMatch = true) => {
461
+ const context = { ...inner.router.options.context ?? {} };
462
+ const end = includeCurrentMatch ? index : index - 1;
463
+ for (let i = 0; i <= end; i++) {
464
+ const innerMatch = inner.matches[i];
465
+ if (!innerMatch) continue;
466
+ const m = inner.router.getMatch(innerMatch.id);
467
+ if (!m) continue;
468
+ Object.assign(context, m.__routeContext, m.__beforeLoadContext);
469
+ }
470
+ return context;
471
+ };
472
+ var getNotFoundBoundaryIndex = (inner, err) => {
473
+ if (!inner.matches.length) return;
474
+ const requestedRouteId = err.routeId;
475
+ const matchedRootIndex = inner.matches.findIndex((m) => m.routeId === inner.router.routeTree.id);
476
+ const rootIndex = matchedRootIndex >= 0 ? matchedRootIndex : 0;
477
+ let startIndex = requestedRouteId ? inner.matches.findIndex((match) => match.routeId === requestedRouteId) : inner.firstBadMatchIndex ?? inner.matches.length - 1;
478
+ if (startIndex < 0) startIndex = rootIndex;
479
+ for (let i = startIndex; i >= 0; i--) {
480
+ const match = inner.matches[i];
481
+ if (inner.router.looseRoutesById[match.routeId].options.notFoundComponent) return i;
482
+ }
483
+ return requestedRouteId ? startIndex : rootIndex;
484
+ };
485
+ var handleRedirectAndNotFound = (inner, match, err) => {
486
+ if (!isRedirect(err) && !isNotFound(err)) return;
487
+ if (isRedirect(err) && err.redirectHandled && !err.options.reloadDocument) throw err;
488
+ if (match) {
489
+ match._nonReactive.beforeLoadPromise?.resolve();
490
+ match._nonReactive.loaderPromise?.resolve();
491
+ match._nonReactive.beforeLoadPromise = void 0;
492
+ match._nonReactive.loaderPromise = void 0;
493
+ match._nonReactive.error = err;
494
+ inner.updateMatch(match.id, (prev) => ({
495
+ ...prev,
496
+ status: isRedirect(err) ? "redirected" : prev.status === "pending" ? "success" : prev.status,
497
+ context: buildMatchContext(inner, match.index),
498
+ isFetching: false,
499
+ error: err
500
+ }));
501
+ if (isNotFound(err) && !err.routeId) err.routeId = match.routeId;
502
+ match._nonReactive.loadPromise?.resolve();
503
+ }
504
+ if (isRedirect(err)) {
505
+ inner.rendered = true;
506
+ err.options._fromLocation = inner.location;
507
+ err.redirectHandled = true;
508
+ err = inner.router.resolveRedirect(err);
509
+ }
510
+ throw err;
511
+ };
512
+ var shouldSkipLoader = (inner, matchId) => {
513
+ const match = inner.router.getMatch(matchId);
514
+ if (!match) return true;
515
+ if (match.ssr === false) return true;
516
+ return false;
517
+ };
518
+ var syncMatchContext = (inner, matchId, index) => {
519
+ const nextContext = buildMatchContext(inner, index);
520
+ inner.updateMatch(matchId, (prev) => {
521
+ return {
522
+ ...prev,
523
+ context: nextContext
524
+ };
525
+ });
526
+ };
527
+ var handleSerialError = (inner, index, err, routerCode) => {
528
+ const { id: matchId, routeId } = inner.matches[index];
529
+ const route = inner.router.looseRoutesById[routeId];
530
+ if (err instanceof Promise) throw err;
531
+ err.routerCode = routerCode;
532
+ inner.firstBadMatchIndex ??= index;
533
+ handleRedirectAndNotFound(inner, inner.router.getMatch(matchId), err);
534
+ try {
535
+ route.options.onError?.(err);
536
+ } catch (errorHandlerErr) {
537
+ err = errorHandlerErr;
538
+ handleRedirectAndNotFound(inner, inner.router.getMatch(matchId), err);
539
+ }
540
+ inner.updateMatch(matchId, (prev) => {
541
+ prev._nonReactive.beforeLoadPromise?.resolve();
542
+ prev._nonReactive.beforeLoadPromise = void 0;
543
+ prev._nonReactive.loadPromise?.resolve();
544
+ return {
545
+ ...prev,
546
+ error: err,
547
+ status: "error",
548
+ isFetching: false,
549
+ updatedAt: Date.now(),
550
+ abortController: new AbortController()
551
+ };
552
+ });
553
+ if (!inner.preload && !isRedirect(err) && !isNotFound(err)) inner.serialError ??= err;
554
+ };
555
+ var isBeforeLoadSsr = (inner, matchId, index, route) => {
556
+ const existingMatch = inner.router.getMatch(matchId);
557
+ const parentMatchId = inner.matches[index - 1]?.id;
558
+ const parentMatch = parentMatchId ? inner.router.getMatch(parentMatchId) : void 0;
559
+ if (inner.router.isShell()) {
560
+ existingMatch.ssr = route.id === rootRouteId;
561
+ return;
562
+ }
563
+ if (parentMatch?.ssr === false) {
564
+ existingMatch.ssr = false;
565
+ return;
566
+ }
567
+ const parentOverride = (tempSsr) => {
568
+ if (tempSsr === true && parentMatch?.ssr === "data-only") return "data-only";
569
+ return tempSsr;
570
+ };
571
+ const defaultSsr = inner.router.options.defaultSsr ?? true;
572
+ if (route.options.ssr === void 0) {
573
+ existingMatch.ssr = parentOverride(defaultSsr);
574
+ return;
575
+ }
576
+ if (typeof route.options.ssr !== "function") {
577
+ existingMatch.ssr = parentOverride(route.options.ssr);
578
+ return;
579
+ }
580
+ const { search, params } = existingMatch;
581
+ const ssrFnContext = {
582
+ search: makeMaybe(search, existingMatch.searchError),
583
+ params: makeMaybe(params, existingMatch.paramsError),
584
+ location: inner.location,
585
+ matches: inner.matches.map((match) => ({
586
+ index: match.index,
587
+ pathname: match.pathname,
588
+ fullPath: match.fullPath,
589
+ staticData: match.staticData,
590
+ id: match.id,
591
+ routeId: match.routeId,
592
+ search: makeMaybe(match.search, match.searchError),
593
+ params: makeMaybe(match.params, match.paramsError),
594
+ ssr: match.ssr
595
+ }))
596
+ };
597
+ const tempSsr = route.options.ssr(ssrFnContext);
598
+ if (isPromise(tempSsr)) return tempSsr.then((ssr) => {
599
+ existingMatch.ssr = parentOverride(ssr ?? defaultSsr);
600
+ });
601
+ existingMatch.ssr = parentOverride(tempSsr ?? defaultSsr);
602
+ };
603
+ var setupPendingTimeout = (inner, matchId, route, match) => {
604
+ if (match._nonReactive.pendingTimeout !== void 0) return;
605
+ route.options.pendingMs ?? inner.router.options.defaultPendingMs;
606
+ if (!!(inner.onReady && false));
607
+ };
608
+ var preBeforeLoadSetup = (inner, matchId, route) => {
609
+ const existingMatch = inner.router.getMatch(matchId);
610
+ if (!existingMatch._nonReactive.beforeLoadPromise && !existingMatch._nonReactive.loaderPromise) return;
611
+ setupPendingTimeout(inner, matchId, route, existingMatch);
612
+ const then = () => {
613
+ const match = inner.router.getMatch(matchId);
614
+ if (match.preload && (match.status === "redirected" || match.status === "notFound")) handleRedirectAndNotFound(inner, match, match.error);
615
+ };
616
+ return existingMatch._nonReactive.beforeLoadPromise ? existingMatch._nonReactive.beforeLoadPromise.then(then) : then();
617
+ };
618
+ var executeBeforeLoad = (inner, matchId, index, route) => {
619
+ const match = inner.router.getMatch(matchId);
620
+ let prevLoadPromise = match._nonReactive.loadPromise;
621
+ match._nonReactive.loadPromise = createControlledPromise(() => {
622
+ prevLoadPromise?.resolve();
623
+ prevLoadPromise = void 0;
624
+ });
625
+ const { paramsError, searchError } = match;
626
+ if (paramsError) handleSerialError(inner, index, paramsError, "PARSE_PARAMS");
627
+ if (searchError) handleSerialError(inner, index, searchError, "VALIDATE_SEARCH");
628
+ setupPendingTimeout(inner, matchId, route, match);
629
+ const abortController = new AbortController();
630
+ let isPending = false;
631
+ const pending = () => {
632
+ if (isPending) return;
633
+ isPending = true;
634
+ inner.updateMatch(matchId, (prev) => ({
635
+ ...prev,
636
+ isFetching: "beforeLoad",
637
+ fetchCount: prev.fetchCount + 1,
638
+ abortController
639
+ }));
640
+ };
641
+ const resolve = () => {
642
+ match._nonReactive.beforeLoadPromise?.resolve();
643
+ match._nonReactive.beforeLoadPromise = void 0;
644
+ inner.updateMatch(matchId, (prev) => ({
645
+ ...prev,
646
+ isFetching: false
647
+ }));
648
+ };
649
+ if (!route.options.beforeLoad) {
650
+ inner.router.batch(() => {
651
+ pending();
652
+ resolve();
653
+ });
654
+ return;
655
+ }
656
+ match._nonReactive.beforeLoadPromise = createControlledPromise();
657
+ const context = {
658
+ ...buildMatchContext(inner, index, false),
659
+ ...match.__routeContext
660
+ };
661
+ const { search, params, cause } = match;
662
+ const preload = resolvePreload(inner, matchId);
663
+ const beforeLoadFnContext = {
664
+ search,
665
+ abortController,
666
+ params,
667
+ preload,
668
+ context,
669
+ location: inner.location,
670
+ navigate: (opts) => inner.router.navigate({
671
+ ...opts,
672
+ _fromLocation: inner.location
673
+ }),
674
+ buildLocation: inner.router.buildLocation,
675
+ cause: preload ? "preload" : cause,
676
+ matches: inner.matches,
677
+ routeId: route.id,
678
+ ...inner.router.options.additionalContext
679
+ };
680
+ const updateContext = (beforeLoadContext) => {
681
+ if (beforeLoadContext === void 0) {
682
+ inner.router.batch(() => {
683
+ pending();
684
+ resolve();
685
+ });
686
+ return;
687
+ }
688
+ if (isRedirect(beforeLoadContext) || isNotFound(beforeLoadContext)) {
689
+ pending();
690
+ handleSerialError(inner, index, beforeLoadContext, "BEFORE_LOAD");
691
+ }
692
+ inner.router.batch(() => {
693
+ pending();
694
+ inner.updateMatch(matchId, (prev) => ({
695
+ ...prev,
696
+ __beforeLoadContext: beforeLoadContext
697
+ }));
698
+ resolve();
699
+ });
700
+ };
701
+ let beforeLoadContext;
702
+ try {
703
+ beforeLoadContext = route.options.beforeLoad(beforeLoadFnContext);
704
+ if (isPromise(beforeLoadContext)) {
705
+ pending();
706
+ return beforeLoadContext.catch((err) => {
707
+ handleSerialError(inner, index, err, "BEFORE_LOAD");
708
+ }).then(updateContext);
709
+ }
710
+ } catch (err) {
711
+ pending();
712
+ handleSerialError(inner, index, err, "BEFORE_LOAD");
713
+ }
714
+ updateContext(beforeLoadContext);
715
+ };
716
+ var handleBeforeLoad = (inner, index) => {
717
+ const { id: matchId, routeId } = inner.matches[index];
718
+ const route = inner.router.looseRoutesById[routeId];
719
+ const serverSsr = () => {
720
+ {
721
+ const maybePromise = isBeforeLoadSsr(inner, matchId, index, route);
722
+ if (isPromise(maybePromise)) return maybePromise.then(queueExecution);
723
+ }
724
+ return queueExecution();
725
+ };
726
+ const execute = () => executeBeforeLoad(inner, matchId, index, route);
727
+ const queueExecution = () => {
728
+ if (shouldSkipLoader(inner, matchId)) return;
729
+ const result = preBeforeLoadSetup(inner, matchId, route);
730
+ return isPromise(result) ? result.then(execute) : execute();
731
+ };
732
+ return serverSsr();
733
+ };
734
+ var executeHead = (inner, matchId, route) => {
735
+ const match = inner.router.getMatch(matchId);
736
+ if (!match) return;
737
+ if (!route.options.head && !route.options.scripts && !route.options.headers) return;
738
+ const assetContext = {
739
+ ssr: inner.router.options.ssr,
740
+ matches: inner.matches,
741
+ match,
742
+ params: match.params,
743
+ loaderData: match.loaderData
744
+ };
745
+ return Promise.all([
746
+ route.options.head?.(assetContext),
747
+ route.options.scripts?.(assetContext),
748
+ route.options.headers?.(assetContext)
749
+ ]).then(([headFnContent, scripts, headers]) => {
750
+ return {
751
+ meta: headFnContent?.meta,
752
+ links: headFnContent?.links,
753
+ headScripts: headFnContent?.scripts,
754
+ headers,
755
+ scripts,
756
+ styles: headFnContent?.styles
757
+ };
758
+ });
759
+ };
760
+ var getLoaderContext = (inner, matchPromises, matchId, index, route) => {
761
+ const parentMatchPromise = matchPromises[index - 1];
762
+ const { params, loaderDeps, abortController, cause } = inner.router.getMatch(matchId);
763
+ const context = buildMatchContext(inner, index);
764
+ const preload = resolvePreload(inner, matchId);
765
+ return {
766
+ params,
767
+ deps: loaderDeps,
768
+ preload: !!preload,
769
+ parentMatchPromise,
770
+ abortController,
771
+ context,
772
+ location: inner.location,
773
+ navigate: (opts) => inner.router.navigate({
774
+ ...opts,
775
+ _fromLocation: inner.location
776
+ }),
777
+ cause: preload ? "preload" : cause,
778
+ route,
779
+ ...inner.router.options.additionalContext
780
+ };
781
+ };
782
+ var runLoader = async (inner, matchPromises, matchId, index, route) => {
783
+ try {
784
+ const match = inner.router.getMatch(matchId);
785
+ try {
786
+ if (match.ssr === true) loadRouteChunk(route);
787
+ const routeLoader = route.options.loader;
788
+ const loader = typeof routeLoader === "function" ? routeLoader : routeLoader?.handler;
789
+ const loaderResult = loader?.(getLoaderContext(inner, matchPromises, matchId, index, route));
790
+ const loaderResultIsPromise = !!loader && isPromise(loaderResult);
791
+ if (!!(loaderResultIsPromise || route._lazyPromise || route._componentsPromise || route.options.head || route.options.scripts || route.options.headers || match._nonReactive.minPendingPromise)) inner.updateMatch(matchId, (prev) => ({
792
+ ...prev,
793
+ isFetching: "loader"
794
+ }));
795
+ if (loader) {
796
+ const loaderData = loaderResultIsPromise ? await loaderResult : loaderResult;
797
+ handleRedirectAndNotFound(inner, inner.router.getMatch(matchId), loaderData);
798
+ if (loaderData !== void 0) inner.updateMatch(matchId, (prev) => ({
799
+ ...prev,
800
+ loaderData
801
+ }));
802
+ }
803
+ if (route._lazyPromise) await route._lazyPromise;
804
+ const pendingPromise = match._nonReactive.minPendingPromise;
805
+ if (pendingPromise) await pendingPromise;
806
+ if (route._componentsPromise) await route._componentsPromise;
807
+ inner.updateMatch(matchId, (prev) => ({
808
+ ...prev,
809
+ error: void 0,
810
+ context: buildMatchContext(inner, index),
811
+ status: "success",
812
+ isFetching: false,
813
+ updatedAt: Date.now()
814
+ }));
815
+ } catch (e) {
816
+ let error = e;
817
+ if (error?.name === "AbortError") {
818
+ if (match.abortController.signal.aborted) {
819
+ match._nonReactive.loaderPromise?.resolve();
820
+ match._nonReactive.loaderPromise = void 0;
821
+ return;
822
+ }
823
+ inner.updateMatch(matchId, (prev) => ({
824
+ ...prev,
825
+ status: prev.status === "pending" ? "success" : prev.status,
826
+ isFetching: false,
827
+ context: buildMatchContext(inner, index)
828
+ }));
829
+ return;
830
+ }
831
+ const pendingPromise = match._nonReactive.minPendingPromise;
832
+ if (pendingPromise) await pendingPromise;
833
+ if (isNotFound(e)) await route.options.notFoundComponent?.preload?.();
834
+ handleRedirectAndNotFound(inner, inner.router.getMatch(matchId), e);
835
+ try {
836
+ route.options.onError?.(e);
837
+ } catch (onErrorError) {
838
+ error = onErrorError;
839
+ handleRedirectAndNotFound(inner, inner.router.getMatch(matchId), onErrorError);
840
+ }
841
+ if (!isRedirect(error) && !isNotFound(error)) await loadRouteChunk(route, ["errorComponent"]);
842
+ inner.updateMatch(matchId, (prev) => ({
843
+ ...prev,
844
+ error,
845
+ context: buildMatchContext(inner, index),
846
+ status: "error",
847
+ isFetching: false
848
+ }));
849
+ }
850
+ } catch (err) {
851
+ const match = inner.router.getMatch(matchId);
852
+ if (match) match._nonReactive.loaderPromise = void 0;
853
+ handleRedirectAndNotFound(inner, match, err);
854
+ }
855
+ };
856
+ var loadRouteMatch = async (inner, matchPromises, index) => {
857
+ async function handleLoader(preload, prevMatch, previousRouteMatchId, match, route) {
858
+ const age = Date.now() - prevMatch.updatedAt;
859
+ const staleAge = preload ? route.options.preloadStaleTime ?? inner.router.options.defaultPreloadStaleTime ?? 3e4 : route.options.staleTime ?? inner.router.options.defaultStaleTime ?? 0;
860
+ const shouldReloadOption = route.options.shouldReload;
861
+ const shouldReload = typeof shouldReloadOption === "function" ? shouldReloadOption(getLoaderContext(inner, matchPromises, matchId, index, route)) : shouldReloadOption;
862
+ const { status, invalid } = match;
863
+ const staleMatchShouldReload = age >= staleAge && (!!inner.forceStaleReload || match.cause === "enter" || previousRouteMatchId !== void 0 && previousRouteMatchId !== match.id);
864
+ loaderShouldRunAsync = status === "success" && (invalid || (shouldReload ?? staleMatchShouldReload));
865
+ if (preload && route.options.preload === false) {} else if (loaderShouldRunAsync && !inner.sync && shouldReloadInBackground) {
866
+ loaderIsRunningAsync = true;
867
+ (async () => {
868
+ try {
869
+ await runLoader(inner, matchPromises, matchId, index, route);
870
+ const match = inner.router.getMatch(matchId);
871
+ match._nonReactive.loaderPromise?.resolve();
872
+ match._nonReactive.loadPromise?.resolve();
873
+ match._nonReactive.loaderPromise = void 0;
874
+ match._nonReactive.loadPromise = void 0;
875
+ } catch (err) {
876
+ if (isRedirect(err)) await inner.router.navigate(err.options);
877
+ }
878
+ })();
879
+ } else if (status !== "success" || loaderShouldRunAsync) await runLoader(inner, matchPromises, matchId, index, route);
880
+ else syncMatchContext(inner, matchId, index);
881
+ }
882
+ const { id: matchId, routeId } = inner.matches[index];
883
+ let loaderShouldRunAsync = false;
884
+ let loaderIsRunningAsync = false;
885
+ const route = inner.router.looseRoutesById[routeId];
886
+ const routeLoader = route.options.loader;
887
+ const shouldReloadInBackground = ((typeof routeLoader === "function" ? void 0 : routeLoader?.staleReloadMode) ?? inner.router.options.defaultStaleReloadMode) !== "blocking";
888
+ if (shouldSkipLoader(inner, matchId)) {
889
+ if (!inner.router.getMatch(matchId)) return inner.matches[index];
890
+ syncMatchContext(inner, matchId, index);
891
+ return inner.router.getMatch(matchId);
892
+ } else {
893
+ const prevMatch = inner.router.getMatch(matchId);
894
+ const activeIdAtIndex = inner.router.stores.matchesId.state[index];
895
+ const previousRouteMatchId = (activeIdAtIndex && inner.router.stores.activeMatchStoresById.get(activeIdAtIndex) || null)?.routeId === routeId ? activeIdAtIndex : inner.router.stores.activeMatchesSnapshot.state.find((d) => d.routeId === routeId)?.id;
896
+ const preload = resolvePreload(inner, matchId);
897
+ if (prevMatch._nonReactive.loaderPromise) {
898
+ if (prevMatch.status === "success" && !inner.sync && !prevMatch.preload && shouldReloadInBackground) return prevMatch;
899
+ await prevMatch._nonReactive.loaderPromise;
900
+ const match = inner.router.getMatch(matchId);
901
+ const error = match._nonReactive.error || match.error;
902
+ if (error) handleRedirectAndNotFound(inner, match, error);
903
+ if (match.status === "pending") await handleLoader(preload, prevMatch, previousRouteMatchId, match, route);
904
+ } else {
905
+ const nextPreload = preload && !inner.router.stores.activeMatchStoresById.has(matchId);
906
+ const match = inner.router.getMatch(matchId);
907
+ match._nonReactive.loaderPromise = createControlledPromise();
908
+ if (nextPreload !== match.preload) inner.updateMatch(matchId, (prev) => ({
909
+ ...prev,
910
+ preload: nextPreload
911
+ }));
912
+ await handleLoader(preload, prevMatch, previousRouteMatchId, match, route);
913
+ }
914
+ }
915
+ const match = inner.router.getMatch(matchId);
916
+ if (!loaderIsRunningAsync) {
917
+ match._nonReactive.loaderPromise?.resolve();
918
+ match._nonReactive.loadPromise?.resolve();
919
+ match._nonReactive.loadPromise = void 0;
920
+ }
921
+ clearTimeout(match._nonReactive.pendingTimeout);
922
+ match._nonReactive.pendingTimeout = void 0;
923
+ if (!loaderIsRunningAsync) match._nonReactive.loaderPromise = void 0;
924
+ match._nonReactive.dehydrated = void 0;
925
+ const nextIsFetching = loaderIsRunningAsync ? match.isFetching : false;
926
+ if (nextIsFetching !== match.isFetching || match.invalid !== false) {
927
+ inner.updateMatch(matchId, (prev) => ({
928
+ ...prev,
929
+ isFetching: nextIsFetching,
930
+ invalid: false
931
+ }));
932
+ return inner.router.getMatch(matchId);
933
+ } else return match;
934
+ };
935
+ async function loadMatches(arg) {
936
+ const inner = arg;
937
+ const matchPromises = [];
938
+ let beforeLoadNotFound;
939
+ for (let i = 0; i < inner.matches.length; i++) {
940
+ try {
941
+ const beforeLoad = handleBeforeLoad(inner, i);
942
+ if (isPromise(beforeLoad)) await beforeLoad;
943
+ } catch (err) {
944
+ if (isRedirect(err)) throw err;
945
+ if (isNotFound(err)) beforeLoadNotFound = err;
946
+ else if (!inner.preload) throw err;
947
+ break;
948
+ }
949
+ if (inner.serialError) break;
950
+ }
951
+ const baseMaxIndexExclusive = inner.firstBadMatchIndex ?? inner.matches.length;
952
+ const boundaryIndex = beforeLoadNotFound && !inner.preload ? getNotFoundBoundaryIndex(inner, beforeLoadNotFound) : void 0;
953
+ const maxIndexExclusive = beforeLoadNotFound && inner.preload ? 0 : boundaryIndex !== void 0 ? Math.min(boundaryIndex + 1, baseMaxIndexExclusive) : baseMaxIndexExclusive;
954
+ let firstNotFound;
955
+ let firstUnhandledRejection;
956
+ for (let i = 0; i < maxIndexExclusive; i++) matchPromises.push(loadRouteMatch(inner, matchPromises, i));
957
+ try {
958
+ await Promise.all(matchPromises);
959
+ } catch {
960
+ const settled = await Promise.allSettled(matchPromises);
961
+ for (const result of settled) {
962
+ if (result.status !== "rejected") continue;
963
+ const reason = result.reason;
964
+ if (isRedirect(reason)) throw reason;
965
+ if (isNotFound(reason)) firstNotFound ??= reason;
966
+ else firstUnhandledRejection ??= reason;
967
+ }
968
+ if (firstUnhandledRejection !== void 0) throw firstUnhandledRejection;
969
+ }
970
+ const notFoundToThrow = firstNotFound ?? (beforeLoadNotFound && !inner.preload ? beforeLoadNotFound : void 0);
971
+ let headMaxIndex = inner.serialError ? inner.firstBadMatchIndex ?? 0 : inner.matches.length - 1;
972
+ if (!notFoundToThrow && beforeLoadNotFound && inner.preload) return inner.matches;
973
+ if (notFoundToThrow) {
974
+ const renderedBoundaryIndex = getNotFoundBoundaryIndex(inner, notFoundToThrow);
975
+ if (renderedBoundaryIndex === void 0) invariant();
976
+ const boundaryMatch = inner.matches[renderedBoundaryIndex];
977
+ const boundaryRoute = inner.router.looseRoutesById[boundaryMatch.routeId];
978
+ const defaultNotFoundComponent = inner.router.options?.defaultNotFoundComponent;
979
+ if (!boundaryRoute.options.notFoundComponent && defaultNotFoundComponent) boundaryRoute.options.notFoundComponent = defaultNotFoundComponent;
980
+ notFoundToThrow.routeId = boundaryMatch.routeId;
981
+ const boundaryIsRoot = boundaryMatch.routeId === inner.router.routeTree.id;
982
+ inner.updateMatch(boundaryMatch.id, (prev) => ({
983
+ ...prev,
984
+ ...boundaryIsRoot ? {
985
+ status: "success",
986
+ globalNotFound: true,
987
+ error: void 0
988
+ } : {
989
+ status: "notFound",
990
+ error: notFoundToThrow
991
+ },
992
+ isFetching: false
993
+ }));
994
+ headMaxIndex = renderedBoundaryIndex;
995
+ await loadRouteChunk(boundaryRoute, ["notFoundComponent"]);
996
+ } else if (!inner.preload) {
997
+ const rootMatch = inner.matches[0];
998
+ if (!rootMatch.globalNotFound) {
999
+ if (inner.router.getMatch(rootMatch.id)?.globalNotFound) inner.updateMatch(rootMatch.id, (prev) => ({
1000
+ ...prev,
1001
+ globalNotFound: false,
1002
+ error: void 0
1003
+ }));
1004
+ }
1005
+ }
1006
+ if (inner.serialError && inner.firstBadMatchIndex !== void 0) {
1007
+ const errorRoute = inner.router.looseRoutesById[inner.matches[inner.firstBadMatchIndex].routeId];
1008
+ await loadRouteChunk(errorRoute, ["errorComponent"]);
1009
+ }
1010
+ for (let i = 0; i <= headMaxIndex; i++) {
1011
+ const { id: matchId, routeId } = inner.matches[i];
1012
+ const route = inner.router.looseRoutesById[routeId];
1013
+ try {
1014
+ const headResult = executeHead(inner, matchId, route);
1015
+ if (headResult) {
1016
+ const head = await headResult;
1017
+ inner.updateMatch(matchId, (prev) => ({
1018
+ ...prev,
1019
+ ...head
1020
+ }));
1021
+ }
1022
+ } catch (err) {
1023
+ console.error(`Error executing head for route ${routeId}:`, err);
1024
+ }
1025
+ }
1026
+ const readyPromise = triggerOnReady(inner);
1027
+ if (isPromise(readyPromise)) await readyPromise;
1028
+ if (notFoundToThrow) throw notFoundToThrow;
1029
+ if (inner.serialError && !inner.preload && !inner.onReady) throw inner.serialError;
1030
+ return inner.matches;
1031
+ }
1032
+ function preloadRouteComponents(route, componentTypesToLoad) {
1033
+ const preloads = componentTypesToLoad.map((type) => route.options[type]?.preload?.()).filter(Boolean);
1034
+ if (preloads.length === 0) return void 0;
1035
+ return Promise.all(preloads);
1036
+ }
1037
+ function loadRouteChunk(route, componentTypesToLoad = componentTypes) {
1038
+ if (!route._lazyLoaded && route._lazyPromise === void 0) if (route.lazyFn) route._lazyPromise = route.lazyFn().then((lazyRoute) => {
1039
+ const { id: _id, ...options } = lazyRoute.options;
1040
+ Object.assign(route.options, options);
1041
+ route._lazyLoaded = true;
1042
+ route._lazyPromise = void 0;
1043
+ });
1044
+ else route._lazyLoaded = true;
1045
+ const runAfterLazy = () => route._componentsLoaded ? void 0 : componentTypesToLoad === componentTypes ? (() => {
1046
+ if (route._componentsPromise === void 0) {
1047
+ const componentsPromise = preloadRouteComponents(route, componentTypes);
1048
+ if (componentsPromise) route._componentsPromise = componentsPromise.then(() => {
1049
+ route._componentsLoaded = true;
1050
+ route._componentsPromise = void 0;
1051
+ });
1052
+ else route._componentsLoaded = true;
1053
+ }
1054
+ return route._componentsPromise;
1055
+ })() : preloadRouteComponents(route, componentTypesToLoad);
1056
+ return route._lazyPromise ? route._lazyPromise.then(runAfterLazy) : runAfterLazy();
1057
+ }
1058
+ function makeMaybe(value, error) {
1059
+ if (error) return {
1060
+ status: "error",
1061
+ error
1062
+ };
1063
+ return {
1064
+ status: "success",
1065
+ value
1066
+ };
1067
+ }
1068
+ function routeNeedsPreload(route) {
1069
+ for (const componentType of componentTypes) if (route.options[componentType]?.preload) return true;
1070
+ return false;
1071
+ }
1072
+ var componentTypes = [
1073
+ "component",
1074
+ "errorComponent",
1075
+ "pendingComponent",
1076
+ "notFoundComponent"
1077
+ ];
1078
+ //#endregion
1079
+ //#region ../../node_modules/.bun/@tanstack+history@1.161.6/node_modules/@tanstack/history/dist/esm/index.js
1080
+ var stateIndexKey = "__TSR_index";
1081
+ function createHistory(opts) {
1082
+ let location = opts.getLocation();
1083
+ const subscribers = /* @__PURE__ */ new Set();
1084
+ const notify = (action) => {
1085
+ location = opts.getLocation();
1086
+ subscribers.forEach((subscriber) => subscriber({
1087
+ location,
1088
+ action
1089
+ }));
1090
+ };
1091
+ const handleIndexChange = (action) => {
1092
+ if (opts.notifyOnIndexChange ?? true) notify(action);
1093
+ else location = opts.getLocation();
1094
+ };
1095
+ const tryNavigation = async ({ task, navigateOpts, ...actionInfo }) => {
1096
+ if (navigateOpts?.ignoreBlocker ?? false) {
1097
+ task();
1098
+ return;
1099
+ }
1100
+ const blockers = opts.getBlockers?.() ?? [];
1101
+ const isPushOrReplace = actionInfo.type === "PUSH" || actionInfo.type === "REPLACE";
1102
+ if (typeof document !== "undefined" && blockers.length && isPushOrReplace) for (const blocker of blockers) {
1103
+ const nextLocation = parseHref(actionInfo.path, actionInfo.state);
1104
+ if (await blocker.blockerFn({
1105
+ currentLocation: location,
1106
+ nextLocation,
1107
+ action: actionInfo.type
1108
+ })) {
1109
+ opts.onBlocked?.();
1110
+ return;
1111
+ }
1112
+ }
1113
+ task();
1114
+ };
1115
+ return {
1116
+ get location() {
1117
+ return location;
1118
+ },
1119
+ get length() {
1120
+ return opts.getLength();
1121
+ },
1122
+ subscribers,
1123
+ subscribe: (cb) => {
1124
+ subscribers.add(cb);
1125
+ return () => {
1126
+ subscribers.delete(cb);
1127
+ };
1128
+ },
1129
+ push: (path, state, navigateOpts) => {
1130
+ const currentIndex = location.state[stateIndexKey];
1131
+ state = assignKeyAndIndex(currentIndex + 1, state);
1132
+ tryNavigation({
1133
+ task: () => {
1134
+ opts.pushState(path, state);
1135
+ notify({ type: "PUSH" });
1136
+ },
1137
+ navigateOpts,
1138
+ type: "PUSH",
1139
+ path,
1140
+ state
1141
+ });
1142
+ },
1143
+ replace: (path, state, navigateOpts) => {
1144
+ const currentIndex = location.state[stateIndexKey];
1145
+ state = assignKeyAndIndex(currentIndex, state);
1146
+ tryNavigation({
1147
+ task: () => {
1148
+ opts.replaceState(path, state);
1149
+ notify({ type: "REPLACE" });
1150
+ },
1151
+ navigateOpts,
1152
+ type: "REPLACE",
1153
+ path,
1154
+ state
1155
+ });
1156
+ },
1157
+ go: (index, navigateOpts) => {
1158
+ tryNavigation({
1159
+ task: () => {
1160
+ opts.go(index);
1161
+ handleIndexChange({
1162
+ type: "GO",
1163
+ index
1164
+ });
1165
+ },
1166
+ navigateOpts,
1167
+ type: "GO"
1168
+ });
1169
+ },
1170
+ back: (navigateOpts) => {
1171
+ tryNavigation({
1172
+ task: () => {
1173
+ opts.back(navigateOpts?.ignoreBlocker ?? false);
1174
+ handleIndexChange({ type: "BACK" });
1175
+ },
1176
+ navigateOpts,
1177
+ type: "BACK"
1178
+ });
1179
+ },
1180
+ forward: (navigateOpts) => {
1181
+ tryNavigation({
1182
+ task: () => {
1183
+ opts.forward(navigateOpts?.ignoreBlocker ?? false);
1184
+ handleIndexChange({ type: "FORWARD" });
1185
+ },
1186
+ navigateOpts,
1187
+ type: "FORWARD"
1188
+ });
1189
+ },
1190
+ canGoBack: () => location.state[stateIndexKey] !== 0,
1191
+ createHref: (str) => opts.createHref(str),
1192
+ block: (blocker) => {
1193
+ if (!opts.setBlockers) return () => {};
1194
+ const blockers = opts.getBlockers?.() ?? [];
1195
+ opts.setBlockers([...blockers, blocker]);
1196
+ return () => {
1197
+ const blockers = opts.getBlockers?.() ?? [];
1198
+ opts.setBlockers?.(blockers.filter((b) => b !== blocker));
1199
+ };
1200
+ },
1201
+ flush: () => opts.flush?.(),
1202
+ destroy: () => opts.destroy?.(),
1203
+ notify
1204
+ };
1205
+ }
1206
+ function assignKeyAndIndex(index, state) {
1207
+ if (!state) state = {};
1208
+ const key = createRandomKey();
1209
+ return {
1210
+ ...state,
1211
+ key,
1212
+ __TSR_key: key,
1213
+ [stateIndexKey]: index
1214
+ };
1215
+ }
1216
+ /**
1217
+ * Create an in-memory history implementation.
1218
+ * Ideal for server rendering, tests, and non-DOM environments.
1219
+ * @link https://tanstack.com/router/latest/docs/framework/react/guide/history-types
1220
+ */
1221
+ function createMemoryHistory(opts = { initialEntries: ["/"] }) {
1222
+ const entries = opts.initialEntries;
1223
+ let index = opts.initialIndex ? Math.min(Math.max(opts.initialIndex, 0), entries.length - 1) : entries.length - 1;
1224
+ const states = entries.map((_entry, index) => assignKeyAndIndex(index, void 0));
1225
+ const getLocation = () => parseHref(entries[index], states[index]);
1226
+ let blockers = [];
1227
+ const _getBlockers = () => blockers;
1228
+ const _setBlockers = (newBlockers) => blockers = newBlockers;
1229
+ return createHistory({
1230
+ getLocation,
1231
+ getLength: () => entries.length,
1232
+ pushState: (path, state) => {
1233
+ if (index < entries.length - 1) {
1234
+ entries.splice(index + 1);
1235
+ states.splice(index + 1);
1236
+ }
1237
+ states.push(state);
1238
+ entries.push(path);
1239
+ index = Math.max(entries.length - 1, 0);
1240
+ },
1241
+ replaceState: (path, state) => {
1242
+ states[index] = state;
1243
+ entries[index] = path;
1244
+ },
1245
+ back: () => {
1246
+ index = Math.max(index - 1, 0);
1247
+ },
1248
+ forward: () => {
1249
+ index = Math.min(index + 1, entries.length - 1);
1250
+ },
1251
+ go: (n) => {
1252
+ index = Math.min(Math.max(index + n, 0), entries.length - 1);
1253
+ },
1254
+ createHref: (path) => path,
1255
+ getBlockers: _getBlockers,
1256
+ setBlockers: _setBlockers
1257
+ });
1258
+ }
1259
+ /**
1260
+ * Sanitize a path to prevent open redirect vulnerabilities.
1261
+ * Removes control characters and collapses leading double slashes.
1262
+ */
1263
+ function sanitizePath(path) {
1264
+ let sanitized = path.replace(/[\x00-\x1f\x7f]/g, "");
1265
+ if (sanitized.startsWith("//")) sanitized = "/" + sanitized.replace(/^\/+/, "");
1266
+ return sanitized;
1267
+ }
1268
+ function parseHref(href, state) {
1269
+ const sanitizedHref = sanitizePath(href);
1270
+ const hashIndex = sanitizedHref.indexOf("#");
1271
+ const searchIndex = sanitizedHref.indexOf("?");
1272
+ const addedKey = createRandomKey();
1273
+ return {
1274
+ href: sanitizedHref,
1275
+ pathname: sanitizedHref.substring(0, hashIndex > 0 ? searchIndex > 0 ? Math.min(hashIndex, searchIndex) : hashIndex : searchIndex > 0 ? searchIndex : sanitizedHref.length),
1276
+ hash: hashIndex > -1 ? sanitizedHref.substring(hashIndex) : "",
1277
+ search: searchIndex > -1 ? sanitizedHref.slice(searchIndex, hashIndex === -1 ? void 0 : hashIndex) : "",
1278
+ state: state || {
1279
+ [stateIndexKey]: 0,
1280
+ key: addedKey,
1281
+ __TSR_key: addedKey
1282
+ }
1283
+ };
1284
+ }
1285
+ function createRandomKey() {
1286
+ return (Math.random() + 1).toString(36).substring(7);
1287
+ }
1288
+ //#endregion
1289
+ //#region ../../node_modules/.bun/@tanstack+router-core@1.168.3/node_modules/@tanstack/router-core/dist/esm/router.js
1290
+ /**
1291
+ * Compute whether path, href or hash changed between previous and current
1292
+ * resolved locations.
1293
+ */
1294
+ function getLocationChangeInfo(location, resolvedLocation) {
1295
+ const fromLocation = resolvedLocation;
1296
+ const toLocation = location;
1297
+ return {
1298
+ fromLocation,
1299
+ toLocation,
1300
+ pathChanged: fromLocation?.pathname !== toLocation.pathname,
1301
+ hrefChanged: fromLocation?.href !== toLocation.href,
1302
+ hashChanged: fromLocation?.hash !== toLocation.hash
1303
+ };
1304
+ }
1305
+ /**
1306
+ * Core, framework-agnostic router engine that powers TanStack Router.
1307
+ *
1308
+ * Provides navigation, matching, loading, preloading, caching and event APIs
1309
+ * used by framework adapters (React/Solid). Prefer framework helpers like
1310
+ * `createRouter` in app code.
1311
+ *
1312
+ * @link https://tanstack.com/router/latest/docs/framework/react/api/router/RouterType
1313
+ */
1314
+ var RouterCore = class {
1315
+ /**
1316
+ * @deprecated Use the `createRouter` function instead
1317
+ */
1318
+ constructor(options, getStoreConfig) {
1319
+ this.tempLocationKey = `${Math.round(Math.random() * 1e7)}`;
1320
+ this.resetNextScroll = true;
1321
+ this.shouldViewTransition = void 0;
1322
+ this.isViewTransitionTypesSupported = void 0;
1323
+ this.subscribers = /* @__PURE__ */ new Set();
1324
+ this.isScrollRestoring = false;
1325
+ this.isScrollRestorationSetup = false;
1326
+ this.startTransition = (fn) => fn();
1327
+ this.update = (newOptions) => {
1328
+ const prevOptions = this.options;
1329
+ const prevBasepath = this.basepath ?? prevOptions?.basepath ?? "/";
1330
+ const basepathWasUnset = this.basepath === void 0;
1331
+ const prevRewriteOption = prevOptions?.rewrite;
1332
+ this.options = {
1333
+ ...prevOptions,
1334
+ ...newOptions
1335
+ };
1336
+ this.isServer = this.options.isServer ?? typeof document === "undefined";
1337
+ this.protocolAllowlist = new Set(this.options.protocolAllowlist);
1338
+ if (this.options.pathParamsAllowedCharacters) this.pathParamsDecoder = compileDecodeCharMap(this.options.pathParamsAllowedCharacters);
1339
+ if (!this.history || this.options.history && this.options.history !== this.history) if (!this.options.history) {} else this.history = this.options.history;
1340
+ this.origin = this.options.origin;
1341
+ if (!this.origin) this.origin = "http://localhost";
1342
+ if (this.history) this.updateLatestLocation();
1343
+ if (this.options.routeTree !== this.routeTree) {
1344
+ this.routeTree = this.options.routeTree;
1345
+ let processRouteTreeResult;
1346
+ if (globalThis.__TSR_CACHE__ && globalThis.__TSR_CACHE__.routeTree === this.routeTree) {
1347
+ const cached = globalThis.__TSR_CACHE__;
1348
+ this.resolvePathCache = cached.resolvePathCache;
1349
+ processRouteTreeResult = cached.processRouteTreeResult;
1350
+ } else {
1351
+ this.resolvePathCache = createLRUCache(1e3);
1352
+ processRouteTreeResult = this.buildRouteTree();
1353
+ if (globalThis.__TSR_CACHE__ === void 0) globalThis.__TSR_CACHE__ = {
1354
+ routeTree: this.routeTree,
1355
+ processRouteTreeResult,
1356
+ resolvePathCache: this.resolvePathCache
1357
+ };
1358
+ }
1359
+ this.setRoutes(processRouteTreeResult);
1360
+ }
1361
+ if (!this.stores && this.latestLocation) {
1362
+ const config = this.getStoreConfig(this);
1363
+ this.batch = config.batch;
1364
+ this.stores = createRouterStores(getInitialRouterState(this.latestLocation), config);
1365
+ }
1366
+ let needsLocationUpdate = false;
1367
+ const nextBasepath = this.options.basepath ?? "/";
1368
+ const nextRewriteOption = this.options.rewrite;
1369
+ if (basepathWasUnset || prevBasepath !== nextBasepath || prevRewriteOption !== nextRewriteOption) {
1370
+ this.basepath = nextBasepath;
1371
+ const rewrites = [];
1372
+ const trimmed = trimPath(nextBasepath);
1373
+ if (trimmed && trimmed !== "/") rewrites.push(rewriteBasepath({ basepath: nextBasepath }));
1374
+ if (nextRewriteOption) rewrites.push(nextRewriteOption);
1375
+ this.rewrite = rewrites.length === 0 ? void 0 : rewrites.length === 1 ? rewrites[0] : composeRewrites(rewrites);
1376
+ if (this.history) this.updateLatestLocation();
1377
+ needsLocationUpdate = true;
1378
+ }
1379
+ if (needsLocationUpdate && this.stores) this.stores.location.setState(() => this.latestLocation);
1380
+ if (typeof window !== "undefined" && "CSS" in window && typeof window.CSS?.supports === "function") this.isViewTransitionTypesSupported = window.CSS.supports("selector(:active-view-transition-type(a)");
1381
+ };
1382
+ this.updateLatestLocation = () => {
1383
+ this.latestLocation = this.parseLocation(this.history.location, this.latestLocation);
1384
+ };
1385
+ this.buildRouteTree = () => {
1386
+ const result = processRouteTree(this.routeTree, this.options.caseSensitive, (route, i) => {
1387
+ route.init({ originalIndex: i });
1388
+ });
1389
+ if (this.options.routeMasks) processRouteMasks(this.options.routeMasks, result.processedTree);
1390
+ return result;
1391
+ };
1392
+ this.subscribe = (eventType, fn) => {
1393
+ const listener = {
1394
+ eventType,
1395
+ fn
1396
+ };
1397
+ this.subscribers.add(listener);
1398
+ return () => {
1399
+ this.subscribers.delete(listener);
1400
+ };
1401
+ };
1402
+ this.emit = (routerEvent) => {
1403
+ this.subscribers.forEach((listener) => {
1404
+ if (listener.eventType === routerEvent.type) listener.fn(routerEvent);
1405
+ });
1406
+ };
1407
+ this.parseLocation = (locationToParse, previousLocation) => {
1408
+ const parse = ({ pathname, search, hash, href, state }) => {
1409
+ if (!this.rewrite && !/[ \x00-\x1f\x7f\u0080-\uffff]/.test(pathname)) {
1410
+ const parsedSearch = this.options.parseSearch(search);
1411
+ const searchStr = this.options.stringifySearch(parsedSearch);
1412
+ return {
1413
+ href: pathname + searchStr + hash,
1414
+ publicHref: href,
1415
+ pathname: decodePath(pathname).path,
1416
+ external: false,
1417
+ searchStr,
1418
+ search: nullReplaceEqualDeep(previousLocation?.search, parsedSearch),
1419
+ hash: decodePath(hash.slice(1)).path,
1420
+ state: replaceEqualDeep(previousLocation?.state, state)
1421
+ };
1422
+ }
1423
+ const fullUrl = new URL(href, this.origin);
1424
+ const url = executeRewriteInput(this.rewrite, fullUrl);
1425
+ const parsedSearch = this.options.parseSearch(url.search);
1426
+ const searchStr = this.options.stringifySearch(parsedSearch);
1427
+ url.search = searchStr;
1428
+ return {
1429
+ href: url.href.replace(url.origin, ""),
1430
+ publicHref: href,
1431
+ pathname: decodePath(url.pathname).path,
1432
+ external: !!this.rewrite && url.origin !== this.origin,
1433
+ searchStr,
1434
+ search: nullReplaceEqualDeep(previousLocation?.search, parsedSearch),
1435
+ hash: decodePath(url.hash.slice(1)).path,
1436
+ state: replaceEqualDeep(previousLocation?.state, state)
1437
+ };
1438
+ };
1439
+ const location = parse(locationToParse);
1440
+ const { __tempLocation, __tempKey } = location.state;
1441
+ if (__tempLocation && (!__tempKey || __tempKey === this.tempLocationKey)) {
1442
+ const parsedTempLocation = parse(__tempLocation);
1443
+ parsedTempLocation.state.key = location.state.key;
1444
+ parsedTempLocation.state.__TSR_key = location.state.__TSR_key;
1445
+ delete parsedTempLocation.state.__tempLocation;
1446
+ return {
1447
+ ...parsedTempLocation,
1448
+ maskedLocation: location
1449
+ };
1450
+ }
1451
+ return location;
1452
+ };
1453
+ this.resolvePathWithBase = (from, path) => {
1454
+ return resolvePath({
1455
+ base: from,
1456
+ to: cleanPath(path),
1457
+ trailingSlash: this.options.trailingSlash,
1458
+ cache: this.resolvePathCache
1459
+ });
1460
+ };
1461
+ this.matchRoutes = (pathnameOrNext, locationSearchOrOpts, opts) => {
1462
+ if (typeof pathnameOrNext === "string") return this.matchRoutesInternal({
1463
+ pathname: pathnameOrNext,
1464
+ search: locationSearchOrOpts
1465
+ }, opts);
1466
+ return this.matchRoutesInternal(pathnameOrNext, locationSearchOrOpts);
1467
+ };
1468
+ this.getMatchedRoutes = (pathname) => {
1469
+ return getMatchedRoutes({
1470
+ pathname,
1471
+ routesById: this.routesById,
1472
+ processedTree: this.processedTree
1473
+ });
1474
+ };
1475
+ this.cancelMatch = (id) => {
1476
+ const match = this.getMatch(id);
1477
+ if (!match) return;
1478
+ match.abortController.abort();
1479
+ clearTimeout(match._nonReactive.pendingTimeout);
1480
+ match._nonReactive.pendingTimeout = void 0;
1481
+ };
1482
+ this.cancelMatches = () => {
1483
+ this.stores.pendingMatchesId.state.forEach((matchId) => {
1484
+ this.cancelMatch(matchId);
1485
+ });
1486
+ this.stores.matchesId.state.forEach((matchId) => {
1487
+ if (this.stores.pendingMatchStoresById.has(matchId)) return;
1488
+ const match = this.stores.activeMatchStoresById.get(matchId)?.state;
1489
+ if (!match) return;
1490
+ if (match.status === "pending" || match.isFetching === "loader") this.cancelMatch(matchId);
1491
+ });
1492
+ };
1493
+ this.buildLocation = (opts) => {
1494
+ const build = (dest = {}) => {
1495
+ const currentLocation = dest._fromLocation || this.pendingBuiltLocation || this.latestLocation;
1496
+ const lightweightResult = this.matchRoutesLightweight(currentLocation);
1497
+ if (dest.from && false);
1498
+ const defaultedFromPath = dest.unsafeRelative === "path" ? currentLocation.pathname : dest.from ?? lightweightResult.fullPath;
1499
+ const fromPath = this.resolvePathWithBase(defaultedFromPath, ".");
1500
+ const fromSearch = lightweightResult.search;
1501
+ const fromParams = Object.assign(Object.create(null), lightweightResult.params);
1502
+ const nextTo = dest.to ? this.resolvePathWithBase(fromPath, `${dest.to}`) : this.resolvePathWithBase(fromPath, ".");
1503
+ const nextParams = dest.params === false || dest.params === null ? Object.create(null) : (dest.params ?? true) === true ? fromParams : Object.assign(fromParams, functionalUpdate(dest.params, fromParams));
1504
+ const destMatchResult = this.getMatchedRoutes(nextTo);
1505
+ let destRoutes = destMatchResult.matchedRoutes;
1506
+ if ((!destMatchResult.foundRoute || destMatchResult.foundRoute.path !== "/" && destMatchResult.routeParams["**"]) && this.options.notFoundRoute) destRoutes = [...destRoutes, this.options.notFoundRoute];
1507
+ if (Object.keys(nextParams).length > 0) for (const route of destRoutes) {
1508
+ const fn = route.options.params?.stringify ?? route.options.stringifyParams;
1509
+ if (fn) try {
1510
+ Object.assign(nextParams, fn(nextParams));
1511
+ } catch {}
1512
+ }
1513
+ const nextPathname = opts.leaveParams ? nextTo : decodePath(interpolatePath({
1514
+ path: nextTo,
1515
+ params: nextParams,
1516
+ decoder: this.pathParamsDecoder,
1517
+ server: this.isServer
1518
+ }).interpolatedPath).path;
1519
+ let nextSearch = fromSearch;
1520
+ if (opts._includeValidateSearch && this.options.search?.strict) {
1521
+ const validatedSearch = {};
1522
+ destRoutes.forEach((route) => {
1523
+ if (route.options.validateSearch) try {
1524
+ Object.assign(validatedSearch, validateSearch(route.options.validateSearch, {
1525
+ ...validatedSearch,
1526
+ ...nextSearch
1527
+ }));
1528
+ } catch {}
1529
+ });
1530
+ nextSearch = validatedSearch;
1531
+ }
1532
+ nextSearch = applySearchMiddleware({
1533
+ search: nextSearch,
1534
+ dest,
1535
+ destRoutes,
1536
+ _includeValidateSearch: opts._includeValidateSearch
1537
+ });
1538
+ nextSearch = nullReplaceEqualDeep(fromSearch, nextSearch);
1539
+ const searchStr = this.options.stringifySearch(nextSearch);
1540
+ const hash = dest.hash === true ? currentLocation.hash : dest.hash ? functionalUpdate(dest.hash, currentLocation.hash) : void 0;
1541
+ const hashStr = hash ? `#${hash}` : "";
1542
+ let nextState = dest.state === true ? currentLocation.state : dest.state ? functionalUpdate(dest.state, currentLocation.state) : {};
1543
+ nextState = replaceEqualDeep(currentLocation.state, nextState);
1544
+ const fullPath = `${nextPathname}${searchStr}${hashStr}`;
1545
+ let href;
1546
+ let publicHref;
1547
+ let external = false;
1548
+ if (this.rewrite) {
1549
+ const url = new URL(fullPath, this.origin);
1550
+ const rewrittenUrl = executeRewriteOutput(this.rewrite, url);
1551
+ href = url.href.replace(url.origin, "");
1552
+ if (rewrittenUrl.origin !== this.origin) {
1553
+ publicHref = rewrittenUrl.href;
1554
+ external = true;
1555
+ } else publicHref = rewrittenUrl.pathname + rewrittenUrl.search + rewrittenUrl.hash;
1556
+ } else {
1557
+ href = encodePathLikeUrl(fullPath);
1558
+ publicHref = href;
1559
+ }
1560
+ return {
1561
+ publicHref,
1562
+ href,
1563
+ pathname: nextPathname,
1564
+ search: nextSearch,
1565
+ searchStr,
1566
+ state: nextState,
1567
+ hash: hash ?? "",
1568
+ external,
1569
+ unmaskOnReload: dest.unmaskOnReload
1570
+ };
1571
+ };
1572
+ const buildWithMatches = (dest = {}, maskedDest) => {
1573
+ const next = build(dest);
1574
+ let maskedNext = maskedDest ? build(maskedDest) : void 0;
1575
+ if (!maskedNext) {
1576
+ const params = Object.create(null);
1577
+ if (this.options.routeMasks) {
1578
+ const match = findFlatMatch(next.pathname, this.processedTree);
1579
+ if (match) {
1580
+ Object.assign(params, match.rawParams);
1581
+ const { from: _from, params: maskParams, ...maskProps } = match.route;
1582
+ const nextParams = maskParams === false || maskParams === null ? Object.create(null) : (maskParams ?? true) === true ? params : Object.assign(params, functionalUpdate(maskParams, params));
1583
+ maskedDest = {
1584
+ from: opts.from,
1585
+ ...maskProps,
1586
+ params: nextParams
1587
+ };
1588
+ maskedNext = build(maskedDest);
1589
+ }
1590
+ }
1591
+ }
1592
+ if (maskedNext) next.maskedLocation = maskedNext;
1593
+ return next;
1594
+ };
1595
+ if (opts.mask) return buildWithMatches(opts, {
1596
+ from: opts.from,
1597
+ ...opts.mask
1598
+ });
1599
+ return buildWithMatches(opts);
1600
+ };
1601
+ this.commitLocation = async ({ viewTransition, ignoreBlocker, ...next }) => {
1602
+ const isSameState = () => {
1603
+ const ignoredProps = [
1604
+ "key",
1605
+ "__TSR_key",
1606
+ "__TSR_index",
1607
+ "__hashScrollIntoViewOptions"
1608
+ ];
1609
+ ignoredProps.forEach((prop) => {
1610
+ next.state[prop] = this.latestLocation.state[prop];
1611
+ });
1612
+ const isEqual = deepEqual(next.state, this.latestLocation.state);
1613
+ ignoredProps.forEach((prop) => {
1614
+ delete next.state[prop];
1615
+ });
1616
+ return isEqual;
1617
+ };
1618
+ const isSameUrl = trimPathRight(this.latestLocation.href) === trimPathRight(next.href);
1619
+ let previousCommitPromise = this.commitLocationPromise;
1620
+ this.commitLocationPromise = createControlledPromise(() => {
1621
+ previousCommitPromise?.resolve();
1622
+ previousCommitPromise = void 0;
1623
+ });
1624
+ if (isSameUrl && isSameState()) this.load();
1625
+ else {
1626
+ let { maskedLocation, hashScrollIntoView, ...nextHistory } = next;
1627
+ if (maskedLocation) {
1628
+ nextHistory = {
1629
+ ...maskedLocation,
1630
+ state: {
1631
+ ...maskedLocation.state,
1632
+ __tempKey: void 0,
1633
+ __tempLocation: {
1634
+ ...nextHistory,
1635
+ search: nextHistory.searchStr,
1636
+ state: {
1637
+ ...nextHistory.state,
1638
+ __tempKey: void 0,
1639
+ __tempLocation: void 0,
1640
+ __TSR_key: void 0,
1641
+ key: void 0
1642
+ }
1643
+ }
1644
+ }
1645
+ };
1646
+ if (nextHistory.unmaskOnReload ?? this.options.unmaskOnReload ?? false) nextHistory.state.__tempKey = this.tempLocationKey;
1647
+ }
1648
+ nextHistory.state.__hashScrollIntoViewOptions = hashScrollIntoView ?? this.options.defaultHashScrollIntoView ?? true;
1649
+ this.shouldViewTransition = viewTransition;
1650
+ this.history[next.replace ? "replace" : "push"](nextHistory.publicHref, nextHistory.state, { ignoreBlocker });
1651
+ }
1652
+ this.resetNextScroll = next.resetScroll ?? true;
1653
+ if (!this.history.subscribers.size) this.load();
1654
+ return this.commitLocationPromise;
1655
+ };
1656
+ this.buildAndCommitLocation = ({ replace, resetScroll, hashScrollIntoView, viewTransition, ignoreBlocker, href, ...rest } = {}) => {
1657
+ if (href) {
1658
+ const currentIndex = this.history.location.state.__TSR_index;
1659
+ const parsed = parseHref(href, { __TSR_index: replace ? currentIndex : currentIndex + 1 });
1660
+ const hrefUrl = new URL(parsed.pathname, this.origin);
1661
+ rest.to = executeRewriteInput(this.rewrite, hrefUrl).pathname;
1662
+ rest.search = this.options.parseSearch(parsed.search);
1663
+ rest.hash = parsed.hash.slice(1);
1664
+ }
1665
+ const location = this.buildLocation({
1666
+ ...rest,
1667
+ _includeValidateSearch: true
1668
+ });
1669
+ this.pendingBuiltLocation = location;
1670
+ const commitPromise = this.commitLocation({
1671
+ ...location,
1672
+ viewTransition,
1673
+ replace,
1674
+ resetScroll,
1675
+ hashScrollIntoView,
1676
+ ignoreBlocker
1677
+ });
1678
+ Promise.resolve().then(() => {
1679
+ if (this.pendingBuiltLocation === location) this.pendingBuiltLocation = void 0;
1680
+ });
1681
+ return commitPromise;
1682
+ };
1683
+ this.navigate = async ({ to, reloadDocument, href, publicHref, ...rest }) => {
1684
+ let hrefIsUrl = false;
1685
+ if (href) try {
1686
+ new URL(`${href}`);
1687
+ hrefIsUrl = true;
1688
+ } catch {}
1689
+ if (hrefIsUrl && !reloadDocument) reloadDocument = true;
1690
+ if (reloadDocument) {
1691
+ if (to !== void 0 || !href) {
1692
+ const location = this.buildLocation({
1693
+ to,
1694
+ ...rest
1695
+ });
1696
+ href = href ?? location.publicHref;
1697
+ publicHref = publicHref ?? location.publicHref;
1698
+ }
1699
+ const reloadHref = !hrefIsUrl && publicHref ? publicHref : href;
1700
+ if (isDangerousProtocol(reloadHref, this.protocolAllowlist)) return Promise.resolve();
1701
+ if (!rest.ignoreBlocker) {
1702
+ const blockers = this.history.getBlockers?.() ?? [];
1703
+ for (const blocker of blockers) if (blocker?.blockerFn) {
1704
+ if (await blocker.blockerFn({
1705
+ currentLocation: this.latestLocation,
1706
+ nextLocation: this.latestLocation,
1707
+ action: "PUSH"
1708
+ })) return Promise.resolve();
1709
+ }
1710
+ }
1711
+ if (rest.replace) window.location.replace(reloadHref);
1712
+ else window.location.href = reloadHref;
1713
+ return Promise.resolve();
1714
+ }
1715
+ return this.buildAndCommitLocation({
1716
+ ...rest,
1717
+ href,
1718
+ to,
1719
+ _isNavigate: true
1720
+ });
1721
+ };
1722
+ this.beforeLoad = () => {
1723
+ this.cancelMatches();
1724
+ this.updateLatestLocation();
1725
+ {
1726
+ const nextLocation = this.buildLocation({
1727
+ to: this.latestLocation.pathname,
1728
+ search: true,
1729
+ params: true,
1730
+ hash: true,
1731
+ state: true,
1732
+ _includeValidateSearch: true
1733
+ });
1734
+ if (this.latestLocation.publicHref !== nextLocation.publicHref) {
1735
+ const href = this.getParsedLocationHref(nextLocation);
1736
+ if (nextLocation.external) throw redirect({ href });
1737
+ else throw redirect({
1738
+ href,
1739
+ _builtLocation: nextLocation
1740
+ });
1741
+ }
1742
+ }
1743
+ const pendingMatches = this.matchRoutes(this.latestLocation);
1744
+ const nextCachedMatches = this.stores.cachedMatchesSnapshot.state.filter((d) => !pendingMatches.some((e) => e.id === d.id));
1745
+ this.batch(() => {
1746
+ this.stores.status.setState(() => "pending");
1747
+ this.stores.statusCode.setState(() => 200);
1748
+ this.stores.isLoading.setState(() => true);
1749
+ this.stores.location.setState(() => this.latestLocation);
1750
+ this.stores.setPendingMatches(pendingMatches);
1751
+ this.stores.setCachedMatches(nextCachedMatches);
1752
+ });
1753
+ };
1754
+ this.load = async (opts) => {
1755
+ let redirect;
1756
+ let notFound;
1757
+ let loadPromise;
1758
+ const previousLocation = this.stores.resolvedLocation.state ?? this.stores.location.state;
1759
+ loadPromise = new Promise((resolve) => {
1760
+ this.startTransition(async () => {
1761
+ try {
1762
+ this.beforeLoad();
1763
+ const next = this.latestLocation;
1764
+ const prevLocation = this.stores.resolvedLocation.state;
1765
+ const locationChangeInfo = getLocationChangeInfo(next, prevLocation);
1766
+ if (!this.stores.redirect.state) this.emit({
1767
+ type: "onBeforeNavigate",
1768
+ ...locationChangeInfo
1769
+ });
1770
+ this.emit({
1771
+ type: "onBeforeLoad",
1772
+ ...locationChangeInfo
1773
+ });
1774
+ await loadMatches({
1775
+ router: this,
1776
+ sync: opts?.sync,
1777
+ forceStaleReload: previousLocation.href === next.href,
1778
+ matches: this.stores.pendingMatchesSnapshot.state,
1779
+ location: next,
1780
+ updateMatch: this.updateMatch,
1781
+ onReady: async () => {
1782
+ this.startTransition(() => {
1783
+ this.startViewTransition(async () => {
1784
+ let exitingMatches = null;
1785
+ let hookExitingMatches = null;
1786
+ let hookEnteringMatches = null;
1787
+ let hookStayingMatches = null;
1788
+ this.batch(() => {
1789
+ const pendingMatches = this.stores.pendingMatchesSnapshot.state;
1790
+ const mountPending = pendingMatches.length;
1791
+ const currentMatches = this.stores.activeMatchesSnapshot.state;
1792
+ exitingMatches = mountPending ? currentMatches.filter((match) => !this.stores.pendingMatchStoresById.has(match.id)) : null;
1793
+ const pendingRouteIds = /* @__PURE__ */ new Set();
1794
+ for (const s of this.stores.pendingMatchStoresById.values()) if (s.routeId) pendingRouteIds.add(s.routeId);
1795
+ const activeRouteIds = /* @__PURE__ */ new Set();
1796
+ for (const s of this.stores.activeMatchStoresById.values()) if (s.routeId) activeRouteIds.add(s.routeId);
1797
+ hookExitingMatches = mountPending ? currentMatches.filter((match) => !pendingRouteIds.has(match.routeId)) : null;
1798
+ hookEnteringMatches = mountPending ? pendingMatches.filter((match) => !activeRouteIds.has(match.routeId)) : null;
1799
+ hookStayingMatches = mountPending ? pendingMatches.filter((match) => activeRouteIds.has(match.routeId)) : currentMatches;
1800
+ this.stores.isLoading.setState(() => false);
1801
+ this.stores.loadedAt.setState(() => Date.now());
1802
+ /**
1803
+ * When committing new matches, cache any exiting matches that are still usable.
1804
+ * Routes that resolved with `status: 'error'` or `status: 'notFound'` are
1805
+ * deliberately excluded from `cachedMatches` so that subsequent invalidations
1806
+ * or reloads re-run their loaders instead of reusing the failed/not-found data.
1807
+ */
1808
+ if (mountPending) {
1809
+ this.stores.setActiveMatches(pendingMatches);
1810
+ this.stores.setPendingMatches([]);
1811
+ this.stores.setCachedMatches([...this.stores.cachedMatchesSnapshot.state, ...exitingMatches.filter((d) => d.status !== "error" && d.status !== "notFound" && d.status !== "redirected")]);
1812
+ this.clearExpiredCache();
1813
+ }
1814
+ });
1815
+ for (const [matches, hook] of [
1816
+ [hookExitingMatches, "onLeave"],
1817
+ [hookEnteringMatches, "onEnter"],
1818
+ [hookStayingMatches, "onStay"]
1819
+ ]) {
1820
+ if (!matches) continue;
1821
+ for (const match of matches) this.looseRoutesById[match.routeId].options[hook]?.(match);
1822
+ }
1823
+ });
1824
+ });
1825
+ }
1826
+ });
1827
+ } catch (err) {
1828
+ if (isRedirect(err)) redirect = err;
1829
+ else if (isNotFound(err)) notFound = err;
1830
+ const nextStatusCode = redirect ? redirect.status : notFound ? 404 : this.stores.activeMatchesSnapshot.state.some((d) => d.status === "error") ? 500 : 200;
1831
+ this.batch(() => {
1832
+ this.stores.statusCode.setState(() => nextStatusCode);
1833
+ this.stores.redirect.setState(() => redirect);
1834
+ });
1835
+ }
1836
+ if (this.latestLoadPromise === loadPromise) {
1837
+ this.commitLocationPromise?.resolve();
1838
+ this.latestLoadPromise = void 0;
1839
+ this.commitLocationPromise = void 0;
1840
+ }
1841
+ resolve();
1842
+ });
1843
+ });
1844
+ this.latestLoadPromise = loadPromise;
1845
+ await loadPromise;
1846
+ while (this.latestLoadPromise && loadPromise !== this.latestLoadPromise) await this.latestLoadPromise;
1847
+ let newStatusCode = void 0;
1848
+ if (this.hasNotFoundMatch()) newStatusCode = 404;
1849
+ else if (this.stores.activeMatchesSnapshot.state.some((d) => d.status === "error")) newStatusCode = 500;
1850
+ if (newStatusCode !== void 0) this.stores.statusCode.setState(() => newStatusCode);
1851
+ };
1852
+ this.startViewTransition = (fn) => {
1853
+ const shouldViewTransition = this.shouldViewTransition ?? this.options.defaultViewTransition;
1854
+ this.shouldViewTransition = void 0;
1855
+ if (shouldViewTransition && typeof document !== "undefined" && "startViewTransition" in document && typeof document.startViewTransition === "function") {
1856
+ let startViewTransitionParams;
1857
+ if (typeof shouldViewTransition === "object" && this.isViewTransitionTypesSupported) {
1858
+ const next = this.latestLocation;
1859
+ const prevLocation = this.stores.resolvedLocation.state;
1860
+ const resolvedViewTransitionTypes = typeof shouldViewTransition.types === "function" ? shouldViewTransition.types(getLocationChangeInfo(next, prevLocation)) : shouldViewTransition.types;
1861
+ if (resolvedViewTransitionTypes === false) {
1862
+ fn();
1863
+ return;
1864
+ }
1865
+ startViewTransitionParams = {
1866
+ update: fn,
1867
+ types: resolvedViewTransitionTypes
1868
+ };
1869
+ } else startViewTransitionParams = fn;
1870
+ document.startViewTransition(startViewTransitionParams);
1871
+ } else fn();
1872
+ };
1873
+ this.updateMatch = (id, updater) => {
1874
+ this.startTransition(() => {
1875
+ const pendingMatch = this.stores.pendingMatchStoresById.get(id);
1876
+ if (pendingMatch) {
1877
+ pendingMatch.setState(updater);
1878
+ return;
1879
+ }
1880
+ const activeMatch = this.stores.activeMatchStoresById.get(id);
1881
+ if (activeMatch) {
1882
+ activeMatch.setState(updater);
1883
+ return;
1884
+ }
1885
+ const cachedMatch = this.stores.cachedMatchStoresById.get(id);
1886
+ if (cachedMatch) {
1887
+ const next = updater(cachedMatch.state);
1888
+ if (next.status === "redirected") {
1889
+ if (this.stores.cachedMatchStoresById.delete(id)) this.stores.cachedMatchesId.setState((prev) => prev.filter((matchId) => matchId !== id));
1890
+ } else cachedMatch.setState(() => next);
1891
+ }
1892
+ });
1893
+ };
1894
+ this.getMatch = (matchId) => {
1895
+ return this.stores.cachedMatchStoresById.get(matchId)?.state ?? this.stores.pendingMatchStoresById.get(matchId)?.state ?? this.stores.activeMatchStoresById.get(matchId)?.state;
1896
+ };
1897
+ this.invalidate = (opts) => {
1898
+ const invalidate = (d) => {
1899
+ if (opts?.filter?.(d) ?? true) return {
1900
+ ...d,
1901
+ invalid: true,
1902
+ ...opts?.forcePending || d.status === "error" || d.status === "notFound" ? {
1903
+ status: "pending",
1904
+ error: void 0
1905
+ } : void 0
1906
+ };
1907
+ return d;
1908
+ };
1909
+ this.batch(() => {
1910
+ this.stores.setActiveMatches(this.stores.activeMatchesSnapshot.state.map(invalidate));
1911
+ this.stores.setCachedMatches(this.stores.cachedMatchesSnapshot.state.map(invalidate));
1912
+ this.stores.setPendingMatches(this.stores.pendingMatchesSnapshot.state.map(invalidate));
1913
+ });
1914
+ this.shouldViewTransition = false;
1915
+ return this.load({ sync: opts?.sync });
1916
+ };
1917
+ this.getParsedLocationHref = (location) => {
1918
+ return location.publicHref || "/";
1919
+ };
1920
+ this.resolveRedirect = (redirect) => {
1921
+ const locationHeader = redirect.headers.get("Location");
1922
+ if (!redirect.options.href || redirect.options._builtLocation) {
1923
+ const location = redirect.options._builtLocation ?? this.buildLocation(redirect.options);
1924
+ const href = this.getParsedLocationHref(location);
1925
+ redirect.options.href = href;
1926
+ redirect.headers.set("Location", href);
1927
+ } else if (locationHeader) try {
1928
+ const url = new URL(locationHeader);
1929
+ if (this.origin && url.origin === this.origin) {
1930
+ const href = url.pathname + url.search + url.hash;
1931
+ redirect.options.href = href;
1932
+ redirect.headers.set("Location", href);
1933
+ }
1934
+ } catch {}
1935
+ if (redirect.options.href && !redirect.options._builtLocation && isDangerousProtocol(redirect.options.href, this.protocolAllowlist)) throw new Error("Redirect blocked: unsafe protocol");
1936
+ if (!redirect.headers.get("Location")) redirect.headers.set("Location", redirect.options.href);
1937
+ return redirect;
1938
+ };
1939
+ this.clearCache = (opts) => {
1940
+ const filter = opts?.filter;
1941
+ if (filter !== void 0) this.stores.setCachedMatches(this.stores.cachedMatchesSnapshot.state.filter((m) => !filter(m)));
1942
+ else this.stores.setCachedMatches([]);
1943
+ };
1944
+ this.clearExpiredCache = () => {
1945
+ const now = Date.now();
1946
+ const filter = (d) => {
1947
+ const route = this.looseRoutesById[d.routeId];
1948
+ if (!route.options.loader) return true;
1949
+ const gcTime = (d.preload ? route.options.preloadGcTime ?? this.options.defaultPreloadGcTime : route.options.gcTime ?? this.options.defaultGcTime) ?? 300 * 1e3;
1950
+ if (d.status === "error") return true;
1951
+ return now - d.updatedAt >= gcTime;
1952
+ };
1953
+ this.clearCache({ filter });
1954
+ };
1955
+ this.loadRouteChunk = loadRouteChunk;
1956
+ this.preloadRoute = async (opts) => {
1957
+ const next = opts._builtLocation ?? this.buildLocation(opts);
1958
+ let matches = this.matchRoutes(next, {
1959
+ throwOnError: true,
1960
+ preload: true,
1961
+ dest: opts
1962
+ });
1963
+ const activeMatchIds = new Set([...this.stores.matchesId.state, ...this.stores.pendingMatchesId.state]);
1964
+ const loadedMatchIds = new Set([...activeMatchIds, ...this.stores.cachedMatchesId.state]);
1965
+ const matchesToCache = matches.filter((match) => !loadedMatchIds.has(match.id));
1966
+ if (matchesToCache.length) {
1967
+ const cachedMatches = this.stores.cachedMatchesSnapshot.state;
1968
+ this.stores.setCachedMatches([...cachedMatches, ...matchesToCache]);
1969
+ }
1970
+ try {
1971
+ matches = await loadMatches({
1972
+ router: this,
1973
+ matches,
1974
+ location: next,
1975
+ preload: true,
1976
+ updateMatch: (id, updater) => {
1977
+ if (activeMatchIds.has(id)) matches = matches.map((d) => d.id === id ? updater(d) : d);
1978
+ else this.updateMatch(id, updater);
1979
+ }
1980
+ });
1981
+ return matches;
1982
+ } catch (err) {
1983
+ if (isRedirect(err)) {
1984
+ if (err.options.reloadDocument) return;
1985
+ return await this.preloadRoute({
1986
+ ...err.options,
1987
+ _fromLocation: next
1988
+ });
1989
+ }
1990
+ if (!isNotFound(err)) console.error(err);
1991
+ return;
1992
+ }
1993
+ };
1994
+ this.matchRoute = (location, opts) => {
1995
+ const matchLocation = {
1996
+ ...location,
1997
+ to: location.to ? this.resolvePathWithBase(location.from || "", location.to) : void 0,
1998
+ params: location.params || {},
1999
+ leaveParams: true
2000
+ };
2001
+ const next = this.buildLocation(matchLocation);
2002
+ if (opts?.pending && this.stores.status.state !== "pending") return false;
2003
+ const baseLocation = (opts?.pending === void 0 ? !this.stores.isLoading.state : opts.pending) ? this.latestLocation : this.stores.resolvedLocation.state || this.stores.location.state;
2004
+ const match = findSingleMatch(next.pathname, opts?.caseSensitive ?? false, opts?.fuzzy ?? false, baseLocation.pathname, this.processedTree);
2005
+ if (!match) return false;
2006
+ if (location.params) {
2007
+ if (!deepEqual(match.rawParams, location.params, { partial: true })) return false;
2008
+ }
2009
+ if (opts?.includeSearch ?? true) return deepEqual(baseLocation.search, next.search, { partial: true }) ? match.rawParams : false;
2010
+ return match.rawParams;
2011
+ };
2012
+ this.hasNotFoundMatch = () => {
2013
+ return this.stores.activeMatchesSnapshot.state.some((d) => d.status === "notFound" || d.globalNotFound);
2014
+ };
2015
+ this.getStoreConfig = getStoreConfig;
2016
+ this.update({
2017
+ defaultPreloadDelay: 50,
2018
+ defaultPendingMs: 1e3,
2019
+ defaultPendingMinMs: 500,
2020
+ context: void 0,
2021
+ ...options,
2022
+ caseSensitive: options.caseSensitive ?? false,
2023
+ notFoundMode: options.notFoundMode ?? "fuzzy",
2024
+ stringifySearch: options.stringifySearch ?? defaultStringifySearch,
2025
+ parseSearch: options.parseSearch ?? defaultParseSearch,
2026
+ protocolAllowlist: options.protocolAllowlist ?? DEFAULT_PROTOCOL_ALLOWLIST
2027
+ });
2028
+ if (typeof document !== "undefined") self.__TSR_ROUTER__ = this;
2029
+ }
2030
+ isShell() {
2031
+ return !!this.options.isShell;
2032
+ }
2033
+ isPrerendering() {
2034
+ return !!this.options.isPrerendering;
2035
+ }
2036
+ get state() {
2037
+ return this.stores.__store.state;
2038
+ }
2039
+ setRoutes({ routesById, routesByPath, processedTree }) {
2040
+ this.routesById = routesById;
2041
+ this.routesByPath = routesByPath;
2042
+ this.processedTree = processedTree;
2043
+ const notFoundRoute = this.options.notFoundRoute;
2044
+ if (notFoundRoute) {
2045
+ notFoundRoute.init({ originalIndex: 99999999999 });
2046
+ this.routesById[notFoundRoute.id] = notFoundRoute;
2047
+ }
2048
+ }
2049
+ get looseRoutesById() {
2050
+ return this.routesById;
2051
+ }
2052
+ getParentContext(parentMatch) {
2053
+ return !parentMatch?.id ? this.options.context ?? void 0 : parentMatch.context ?? this.options.context ?? void 0;
2054
+ }
2055
+ matchRoutesInternal(next, opts) {
2056
+ const matchedRoutesResult = this.getMatchedRoutes(next.pathname);
2057
+ const { foundRoute, routeParams, parsedParams } = matchedRoutesResult;
2058
+ let { matchedRoutes } = matchedRoutesResult;
2059
+ let isGlobalNotFound = false;
2060
+ if (foundRoute ? foundRoute.path !== "/" && routeParams["**"] : trimPathRight(next.pathname)) if (this.options.notFoundRoute) matchedRoutes = [...matchedRoutes, this.options.notFoundRoute];
2061
+ else isGlobalNotFound = true;
2062
+ const globalNotFoundRouteId = isGlobalNotFound ? findGlobalNotFoundRouteId(this.options.notFoundMode, matchedRoutes) : void 0;
2063
+ const matches = new Array(matchedRoutes.length);
2064
+ const previousActiveMatchesByRouteId = /* @__PURE__ */ new Map();
2065
+ for (const store of this.stores.activeMatchStoresById.values()) if (store.routeId) previousActiveMatchesByRouteId.set(store.routeId, store.state);
2066
+ for (let index = 0; index < matchedRoutes.length; index++) {
2067
+ const route = matchedRoutes[index];
2068
+ const parentMatch = matches[index - 1];
2069
+ let preMatchSearch;
2070
+ let strictMatchSearch;
2071
+ let searchError;
2072
+ {
2073
+ const parentSearch = parentMatch?.search ?? next.search;
2074
+ const parentStrictSearch = parentMatch?._strictSearch ?? void 0;
2075
+ try {
2076
+ const strictSearch = validateSearch(route.options.validateSearch, { ...parentSearch }) ?? void 0;
2077
+ preMatchSearch = {
2078
+ ...parentSearch,
2079
+ ...strictSearch
2080
+ };
2081
+ strictMatchSearch = {
2082
+ ...parentStrictSearch,
2083
+ ...strictSearch
2084
+ };
2085
+ searchError = void 0;
2086
+ } catch (err) {
2087
+ let searchParamError = err;
2088
+ if (!(err instanceof SearchParamError)) searchParamError = new SearchParamError(err.message, { cause: err });
2089
+ if (opts?.throwOnError) throw searchParamError;
2090
+ preMatchSearch = parentSearch;
2091
+ strictMatchSearch = {};
2092
+ searchError = searchParamError;
2093
+ }
2094
+ }
2095
+ const loaderDeps = route.options.loaderDeps?.({ search: preMatchSearch }) ?? "";
2096
+ const loaderDepsHash = loaderDeps ? JSON.stringify(loaderDeps) : "";
2097
+ const { interpolatedPath, usedParams } = interpolatePath({
2098
+ path: route.fullPath,
2099
+ params: routeParams,
2100
+ decoder: this.pathParamsDecoder,
2101
+ server: this.isServer
2102
+ });
2103
+ const matchId = route.id + interpolatedPath + loaderDepsHash;
2104
+ const existingMatch = this.getMatch(matchId);
2105
+ const previousMatch = previousActiveMatchesByRouteId.get(route.id);
2106
+ const strictParams = existingMatch?._strictParams ?? usedParams;
2107
+ let paramsError = void 0;
2108
+ if (!existingMatch) try {
2109
+ extractStrictParams(route, usedParams, parsedParams, strictParams);
2110
+ } catch (err) {
2111
+ if (isNotFound(err) || isRedirect(err)) paramsError = err;
2112
+ else paramsError = new PathParamError(err.message, { cause: err });
2113
+ if (opts?.throwOnError) throw paramsError;
2114
+ }
2115
+ Object.assign(routeParams, strictParams);
2116
+ const cause = previousMatch ? "stay" : "enter";
2117
+ let match;
2118
+ if (existingMatch) match = {
2119
+ ...existingMatch,
2120
+ cause,
2121
+ params: previousMatch?.params ?? routeParams,
2122
+ _strictParams: strictParams,
2123
+ search: previousMatch ? nullReplaceEqualDeep(previousMatch.search, preMatchSearch) : nullReplaceEqualDeep(existingMatch.search, preMatchSearch),
2124
+ _strictSearch: strictMatchSearch
2125
+ };
2126
+ else {
2127
+ const status = route.options.loader || route.options.beforeLoad || route.lazyFn || routeNeedsPreload(route) ? "pending" : "success";
2128
+ match = {
2129
+ id: matchId,
2130
+ ssr: void 0,
2131
+ index,
2132
+ routeId: route.id,
2133
+ params: previousMatch?.params ?? routeParams,
2134
+ _strictParams: strictParams,
2135
+ pathname: interpolatedPath,
2136
+ updatedAt: Date.now(),
2137
+ search: previousMatch ? nullReplaceEqualDeep(previousMatch.search, preMatchSearch) : preMatchSearch,
2138
+ _strictSearch: strictMatchSearch,
2139
+ searchError: void 0,
2140
+ status,
2141
+ isFetching: false,
2142
+ error: void 0,
2143
+ paramsError,
2144
+ __routeContext: void 0,
2145
+ _nonReactive: { loadPromise: createControlledPromise() },
2146
+ __beforeLoadContext: void 0,
2147
+ context: {},
2148
+ abortController: new AbortController(),
2149
+ fetchCount: 0,
2150
+ cause,
2151
+ loaderDeps: previousMatch ? replaceEqualDeep(previousMatch.loaderDeps, loaderDeps) : loaderDeps,
2152
+ invalid: false,
2153
+ preload: false,
2154
+ links: void 0,
2155
+ scripts: void 0,
2156
+ headScripts: void 0,
2157
+ meta: void 0,
2158
+ staticData: route.options.staticData || {},
2159
+ fullPath: route.fullPath
2160
+ };
2161
+ }
2162
+ if (!opts?.preload) match.globalNotFound = globalNotFoundRouteId === route.id;
2163
+ match.searchError = searchError;
2164
+ const parentContext = this.getParentContext(parentMatch);
2165
+ match.context = {
2166
+ ...parentContext,
2167
+ ...match.__routeContext,
2168
+ ...match.__beforeLoadContext
2169
+ };
2170
+ matches[index] = match;
2171
+ }
2172
+ for (let index = 0; index < matches.length; index++) {
2173
+ const match = matches[index];
2174
+ const route = this.looseRoutesById[match.routeId];
2175
+ const existingMatch = this.getMatch(match.id);
2176
+ const previousMatch = previousActiveMatchesByRouteId.get(match.routeId);
2177
+ match.params = previousMatch ? nullReplaceEqualDeep(previousMatch.params, routeParams) : routeParams;
2178
+ if (!existingMatch) {
2179
+ const parentMatch = matches[index - 1];
2180
+ const parentContext = this.getParentContext(parentMatch);
2181
+ if (route.options.context) {
2182
+ const contextFnContext = {
2183
+ deps: match.loaderDeps,
2184
+ params: match.params,
2185
+ context: parentContext ?? {},
2186
+ location: next,
2187
+ navigate: (opts) => this.navigate({
2188
+ ...opts,
2189
+ _fromLocation: next
2190
+ }),
2191
+ buildLocation: this.buildLocation,
2192
+ cause: match.cause,
2193
+ abortController: match.abortController,
2194
+ preload: !!match.preload,
2195
+ matches,
2196
+ routeId: route.id
2197
+ };
2198
+ match.__routeContext = route.options.context(contextFnContext) ?? void 0;
2199
+ }
2200
+ match.context = {
2201
+ ...parentContext,
2202
+ ...match.__routeContext,
2203
+ ...match.__beforeLoadContext
2204
+ };
2205
+ }
2206
+ }
2207
+ return matches;
2208
+ }
2209
+ /**
2210
+ * Lightweight route matching for buildLocation.
2211
+ * Only computes fullPath, accumulated search, and params - skipping expensive
2212
+ * operations like AbortController, ControlledPromise, loaderDeps, and full match objects.
2213
+ */
2214
+ matchRoutesLightweight(location) {
2215
+ const { matchedRoutes, routeParams, parsedParams } = this.getMatchedRoutes(location.pathname);
2216
+ const lastRoute = last(matchedRoutes);
2217
+ const accumulatedSearch = { ...location.search };
2218
+ for (const route of matchedRoutes) try {
2219
+ Object.assign(accumulatedSearch, validateSearch(route.options.validateSearch, accumulatedSearch));
2220
+ } catch {}
2221
+ const lastStateMatchId = last(this.stores.matchesId.state);
2222
+ const lastStateMatch = lastStateMatchId && this.stores.activeMatchStoresById.get(lastStateMatchId)?.state;
2223
+ const canReuseParams = lastStateMatch && lastStateMatch.routeId === lastRoute.id && lastStateMatch.pathname === location.pathname;
2224
+ let params;
2225
+ if (canReuseParams) params = lastStateMatch.params;
2226
+ else {
2227
+ const strictParams = Object.assign(Object.create(null), routeParams);
2228
+ for (const route of matchedRoutes) try {
2229
+ extractStrictParams(route, routeParams, parsedParams ?? {}, strictParams);
2230
+ } catch {}
2231
+ params = strictParams;
2232
+ }
2233
+ return {
2234
+ matchedRoutes,
2235
+ fullPath: lastRoute.fullPath,
2236
+ search: accumulatedSearch,
2237
+ params
2238
+ };
2239
+ }
2240
+ };
2241
+ /** Error thrown when search parameter validation fails. */
2242
+ var SearchParamError = class extends Error {};
2243
+ /** Error thrown when path parameter parsing/validation fails. */
2244
+ var PathParamError = class extends Error {};
2245
+ /** Create an initial RouterState from a parsed location. */
2246
+ function getInitialRouterState(location) {
2247
+ return {
2248
+ loadedAt: 0,
2249
+ isLoading: false,
2250
+ isTransitioning: false,
2251
+ status: "idle",
2252
+ resolvedLocation: void 0,
2253
+ location,
2254
+ matches: [],
2255
+ statusCode: 200
2256
+ };
2257
+ }
2258
+ function validateSearch(validateSearch, input) {
2259
+ if (validateSearch == null) return {};
2260
+ if ("~standard" in validateSearch) {
2261
+ const result = validateSearch["~standard"].validate(input);
2262
+ if (result instanceof Promise) throw new SearchParamError("Async validation not supported");
2263
+ if (result.issues) throw new SearchParamError(JSON.stringify(result.issues, void 0, 2), { cause: result });
2264
+ return result.value;
2265
+ }
2266
+ if ("parse" in validateSearch) return validateSearch.parse(input);
2267
+ if (typeof validateSearch === "function") return validateSearch(input);
2268
+ return {};
2269
+ }
2270
+ /**
2271
+ * Build the matched route chain and extract params for a pathname.
2272
+ * Falls back to the root route if no specific route is found.
2273
+ */
2274
+ function getMatchedRoutes({ pathname, routesById, processedTree }) {
2275
+ const routeParams = Object.create(null);
2276
+ const trimmedPath = trimPathRight(pathname);
2277
+ let foundRoute = void 0;
2278
+ let parsedParams = void 0;
2279
+ const match = findRouteMatch(trimmedPath, processedTree, true);
2280
+ if (match) {
2281
+ foundRoute = match.route;
2282
+ Object.assign(routeParams, match.rawParams);
2283
+ parsedParams = Object.assign(Object.create(null), match.parsedParams);
2284
+ }
2285
+ return {
2286
+ matchedRoutes: match?.branch || [routesById["__root__"]],
2287
+ routeParams,
2288
+ foundRoute,
2289
+ parsedParams
2290
+ };
2291
+ }
2292
+ /**
2293
+ * TODO: once caches are persisted across requests on the server,
2294
+ * we can cache the built middleware chain using `last(destRoutes)` as the key
2295
+ */
2296
+ function applySearchMiddleware({ search, dest, destRoutes, _includeValidateSearch }) {
2297
+ return buildMiddlewareChain(destRoutes)(search, dest, _includeValidateSearch ?? false);
2298
+ }
2299
+ function buildMiddlewareChain(destRoutes) {
2300
+ const context = {
2301
+ dest: null,
2302
+ _includeValidateSearch: false,
2303
+ middlewares: []
2304
+ };
2305
+ for (const route of destRoutes) {
2306
+ if ("search" in route.options) {
2307
+ if (route.options.search?.middlewares) context.middlewares.push(...route.options.search.middlewares);
2308
+ } else if (route.options.preSearchFilters || route.options.postSearchFilters) {
2309
+ const legacyMiddleware = ({ search, next }) => {
2310
+ let nextSearch = search;
2311
+ if ("preSearchFilters" in route.options && route.options.preSearchFilters) nextSearch = route.options.preSearchFilters.reduce((prev, next) => next(prev), search);
2312
+ const result = next(nextSearch);
2313
+ if ("postSearchFilters" in route.options && route.options.postSearchFilters) return route.options.postSearchFilters.reduce((prev, next) => next(prev), result);
2314
+ return result;
2315
+ };
2316
+ context.middlewares.push(legacyMiddleware);
2317
+ }
2318
+ if (route.options.validateSearch) {
2319
+ const validate = ({ search, next }) => {
2320
+ const result = next(search);
2321
+ if (!context._includeValidateSearch) return result;
2322
+ try {
2323
+ return {
2324
+ ...result,
2325
+ ...validateSearch(route.options.validateSearch, result) ?? void 0
2326
+ };
2327
+ } catch {
2328
+ return result;
2329
+ }
2330
+ };
2331
+ context.middlewares.push(validate);
2332
+ }
2333
+ }
2334
+ const final = ({ search }) => {
2335
+ const dest = context.dest;
2336
+ if (!dest.search) return {};
2337
+ if (dest.search === true) return search;
2338
+ return functionalUpdate(dest.search, search);
2339
+ };
2340
+ context.middlewares.push(final);
2341
+ const applyNext = (index, currentSearch, middlewares) => {
2342
+ if (index >= middlewares.length) return currentSearch;
2343
+ const middleware = middlewares[index];
2344
+ const next = (newSearch) => {
2345
+ return applyNext(index + 1, newSearch, middlewares);
2346
+ };
2347
+ return middleware({
2348
+ search: currentSearch,
2349
+ next
2350
+ });
2351
+ };
2352
+ return function middleware(search, dest, _includeValidateSearch) {
2353
+ context.dest = dest;
2354
+ context._includeValidateSearch = _includeValidateSearch;
2355
+ return applyNext(0, search, context.middlewares);
2356
+ };
2357
+ }
2358
+ function findGlobalNotFoundRouteId(notFoundMode, routes) {
2359
+ if (notFoundMode !== "root") for (let i = routes.length - 1; i >= 0; i--) {
2360
+ const route = routes[i];
2361
+ if (route.children) return route.id;
2362
+ }
2363
+ return rootRouteId;
2364
+ }
2365
+ function extractStrictParams(route, referenceParams, parsedParams, accumulatedParams) {
2366
+ const parseParams = route.options.params?.parse ?? route.options.parseParams;
2367
+ if (parseParams) if (route.options.skipRouteOnParseError) {
2368
+ for (const key in referenceParams) if (key in parsedParams) accumulatedParams[key] = parsedParams[key];
2369
+ } else {
2370
+ const result = parseParams(accumulatedParams);
2371
+ Object.assign(accumulatedParams, result);
2372
+ }
2373
+ }
2374
+ //#endregion
2375
+ //#region ../../node_modules/.bun/@tanstack+router-core@1.168.3/node_modules/@tanstack/router-core/dist/esm/manifest.js
2376
+ function getAssetCrossOrigin(assetCrossOrigin, kind) {
2377
+ if (!assetCrossOrigin) return;
2378
+ if (typeof assetCrossOrigin === "string") return assetCrossOrigin;
2379
+ return assetCrossOrigin[kind];
2380
+ }
2381
+ function resolveManifestAssetLink(link) {
2382
+ if (typeof link === "string") return {
2383
+ href: link,
2384
+ crossOrigin: void 0
2385
+ };
2386
+ return link;
2387
+ }
2388
+ //#endregion
2389
+ //#region ../../node_modules/.bun/@tanstack+react-router@1.168.3+bf16f8eded5e12ee/node_modules/@tanstack/react-router/dist/esm/CatchBoundary.js
2390
+ var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
2391
+ var import_jsx_runtime = require_jsx_runtime();
2392
+ function CatchBoundary(props) {
2393
+ const errorComponent = props.errorComponent ?? ErrorComponent;
2394
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CatchBoundaryImpl, {
2395
+ getResetKey: props.getResetKey,
2396
+ onCatch: props.onCatch,
2397
+ children: ({ error, reset }) => {
2398
+ if (error) return import_react.createElement(errorComponent, {
2399
+ error,
2400
+ reset
2401
+ });
2402
+ return props.children;
2403
+ }
2404
+ });
2405
+ }
2406
+ var CatchBoundaryImpl = class extends import_react.Component {
2407
+ constructor(..._args) {
2408
+ super(..._args);
2409
+ this.state = { error: null };
2410
+ }
2411
+ static getDerivedStateFromProps(props) {
2412
+ return { resetKey: props.getResetKey() };
2413
+ }
2414
+ static getDerivedStateFromError(error) {
2415
+ return { error };
2416
+ }
2417
+ reset() {
2418
+ this.setState({ error: null });
2419
+ }
2420
+ componentDidUpdate(prevProps, prevState) {
2421
+ if (prevState.error && prevState.resetKey !== this.state.resetKey) this.reset();
2422
+ }
2423
+ componentDidCatch(error, errorInfo) {
2424
+ if (this.props.onCatch) this.props.onCatch(error, errorInfo);
2425
+ }
2426
+ render() {
2427
+ return this.props.children({
2428
+ error: this.state.resetKey !== this.props.getResetKey() ? null : this.state.error,
2429
+ reset: () => {
2430
+ this.reset();
2431
+ }
2432
+ });
2433
+ }
2434
+ };
2435
+ function ErrorComponent({ error }) {
2436
+ const [show, setShow] = import_react.useState(false);
2437
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2438
+ style: {
2439
+ padding: ".5rem",
2440
+ maxWidth: "100%"
2441
+ },
2442
+ children: [
2443
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2444
+ style: {
2445
+ display: "flex",
2446
+ alignItems: "center",
2447
+ gap: ".5rem"
2448
+ },
2449
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", {
2450
+ style: { fontSize: "1rem" },
2451
+ children: "Something went wrong!"
2452
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
2453
+ style: {
2454
+ appearance: "none",
2455
+ fontSize: ".6em",
2456
+ border: "1px solid currentColor",
2457
+ padding: ".1rem .2rem",
2458
+ fontWeight: "bold",
2459
+ borderRadius: ".25rem"
2460
+ },
2461
+ onClick: () => setShow((d) => !d),
2462
+ children: show ? "Hide Error" : "Show Error"
2463
+ })]
2464
+ }),
2465
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { height: ".25rem" } }),
2466
+ show ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
2467
+ style: {
2468
+ fontSize: ".7em",
2469
+ border: "1px solid red",
2470
+ borderRadius: ".25rem",
2471
+ padding: ".3rem",
2472
+ color: "red",
2473
+ overflow: "auto"
2474
+ },
2475
+ children: error.message ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: error.message }) : null
2476
+ }) }) : null
2477
+ ]
2478
+ });
2479
+ }
2480
+ //#endregion
2481
+ //#region ../../node_modules/.bun/@tanstack+store@0.9.2/node_modules/@tanstack/store/dist/esm/alien.js
2482
+ var ReactiveFlags = /* @__PURE__ */ ((ReactiveFlags2) => {
2483
+ ReactiveFlags2[ReactiveFlags2["None"] = 0] = "None";
2484
+ ReactiveFlags2[ReactiveFlags2["Mutable"] = 1] = "Mutable";
2485
+ ReactiveFlags2[ReactiveFlags2["Watching"] = 2] = "Watching";
2486
+ ReactiveFlags2[ReactiveFlags2["RecursedCheck"] = 4] = "RecursedCheck";
2487
+ ReactiveFlags2[ReactiveFlags2["Recursed"] = 8] = "Recursed";
2488
+ ReactiveFlags2[ReactiveFlags2["Dirty"] = 16] = "Dirty";
2489
+ ReactiveFlags2[ReactiveFlags2["Pending"] = 32] = "Pending";
2490
+ return ReactiveFlags2;
2491
+ })(ReactiveFlags || {});
2492
+ function createReactiveSystem({ update, notify, unwatched }) {
2493
+ return {
2494
+ link: link2,
2495
+ unlink: unlink2,
2496
+ propagate: propagate2,
2497
+ checkDirty: checkDirty2,
2498
+ shallowPropagate: shallowPropagate2
2499
+ };
2500
+ function link2(dep, sub, version) {
2501
+ const prevDep = sub.depsTail;
2502
+ if (prevDep !== void 0 && prevDep.dep === dep) return;
2503
+ const nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
2504
+ if (nextDep !== void 0 && nextDep.dep === dep) {
2505
+ nextDep.version = version;
2506
+ sub.depsTail = nextDep;
2507
+ return;
2508
+ }
2509
+ const prevSub = dep.subsTail;
2510
+ if (prevSub !== void 0 && prevSub.version === version && prevSub.sub === sub) return;
2511
+ const newLink = sub.depsTail = dep.subsTail = {
2512
+ version,
2513
+ dep,
2514
+ sub,
2515
+ prevDep,
2516
+ nextDep,
2517
+ prevSub,
2518
+ nextSub: void 0
2519
+ };
2520
+ if (nextDep !== void 0) nextDep.prevDep = newLink;
2521
+ if (prevDep !== void 0) prevDep.nextDep = newLink;
2522
+ else sub.deps = newLink;
2523
+ if (prevSub !== void 0) prevSub.nextSub = newLink;
2524
+ else dep.subs = newLink;
2525
+ }
2526
+ function unlink2(link3, sub = link3.sub) {
2527
+ const dep = link3.dep;
2528
+ const prevDep = link3.prevDep;
2529
+ const nextDep = link3.nextDep;
2530
+ const nextSub = link3.nextSub;
2531
+ const prevSub = link3.prevSub;
2532
+ if (nextDep !== void 0) nextDep.prevDep = prevDep;
2533
+ else sub.depsTail = prevDep;
2534
+ if (prevDep !== void 0) prevDep.nextDep = nextDep;
2535
+ else sub.deps = nextDep;
2536
+ if (nextSub !== void 0) nextSub.prevSub = prevSub;
2537
+ else dep.subsTail = prevSub;
2538
+ if (prevSub !== void 0) prevSub.nextSub = nextSub;
2539
+ else if ((dep.subs = nextSub) === void 0) unwatched(dep);
2540
+ return nextDep;
2541
+ }
2542
+ function propagate2(link3) {
2543
+ let next = link3.nextSub;
2544
+ let stack;
2545
+ top: do {
2546
+ const sub = link3.sub;
2547
+ let flags = sub.flags;
2548
+ if (!(flags & 60)) sub.flags = flags | 32;
2549
+ else if (!(flags & 12)) flags = 0;
2550
+ else if (!(flags & 4)) sub.flags = flags & -9 | 32;
2551
+ else if (!(flags & 48) && isValidLink(link3, sub)) {
2552
+ sub.flags = flags | 40;
2553
+ flags &= 1;
2554
+ } else flags = 0;
2555
+ if (flags & 2) notify(sub);
2556
+ if (flags & 1) {
2557
+ const subSubs = sub.subs;
2558
+ if (subSubs !== void 0) {
2559
+ const nextSub = (link3 = subSubs).nextSub;
2560
+ if (nextSub !== void 0) {
2561
+ stack = {
2562
+ value: next,
2563
+ prev: stack
2564
+ };
2565
+ next = nextSub;
2566
+ }
2567
+ continue;
2568
+ }
2569
+ }
2570
+ if ((link3 = next) !== void 0) {
2571
+ next = link3.nextSub;
2572
+ continue;
2573
+ }
2574
+ while (stack !== void 0) {
2575
+ link3 = stack.value;
2576
+ stack = stack.prev;
2577
+ if (link3 !== void 0) {
2578
+ next = link3.nextSub;
2579
+ continue top;
2580
+ }
2581
+ }
2582
+ break;
2583
+ } while (true);
2584
+ }
2585
+ function checkDirty2(link3, sub) {
2586
+ let stack;
2587
+ let checkDepth = 0;
2588
+ let dirty = false;
2589
+ top: do {
2590
+ const dep = link3.dep;
2591
+ const flags = dep.flags;
2592
+ if (sub.flags & 16) dirty = true;
2593
+ else if ((flags & 17) === 17) {
2594
+ if (update(dep)) {
2595
+ const subs = dep.subs;
2596
+ if (subs.nextSub !== void 0) shallowPropagate2(subs);
2597
+ dirty = true;
2598
+ }
2599
+ } else if ((flags & 33) === 33) {
2600
+ if (link3.nextSub !== void 0 || link3.prevSub !== void 0) stack = {
2601
+ value: link3,
2602
+ prev: stack
2603
+ };
2604
+ link3 = dep.deps;
2605
+ sub = dep;
2606
+ ++checkDepth;
2607
+ continue;
2608
+ }
2609
+ if (!dirty) {
2610
+ const nextDep = link3.nextDep;
2611
+ if (nextDep !== void 0) {
2612
+ link3 = nextDep;
2613
+ continue;
2614
+ }
2615
+ }
2616
+ while (checkDepth--) {
2617
+ const firstSub = sub.subs;
2618
+ const hasMultipleSubs = firstSub.nextSub !== void 0;
2619
+ if (hasMultipleSubs) {
2620
+ link3 = stack.value;
2621
+ stack = stack.prev;
2622
+ } else link3 = firstSub;
2623
+ if (dirty) {
2624
+ if (update(sub)) {
2625
+ if (hasMultipleSubs) shallowPropagate2(firstSub);
2626
+ sub = link3.sub;
2627
+ continue;
2628
+ }
2629
+ dirty = false;
2630
+ } else sub.flags &= -33;
2631
+ sub = link3.sub;
2632
+ const nextDep = link3.nextDep;
2633
+ if (nextDep !== void 0) {
2634
+ link3 = nextDep;
2635
+ continue top;
2636
+ }
2637
+ }
2638
+ return dirty;
2639
+ } while (true);
2640
+ }
2641
+ function shallowPropagate2(link3) {
2642
+ do {
2643
+ const sub = link3.sub;
2644
+ const flags = sub.flags;
2645
+ if ((flags & 48) === 32) {
2646
+ sub.flags = flags | 16;
2647
+ if ((flags & 6) === 2) notify(sub);
2648
+ }
2649
+ } while ((link3 = link3.nextSub) !== void 0);
2650
+ }
2651
+ function isValidLink(checkLink, sub) {
2652
+ let link3 = sub.depsTail;
2653
+ while (link3 !== void 0) {
2654
+ if (link3 === checkLink) return true;
2655
+ link3 = link3.prevDep;
2656
+ }
2657
+ return false;
2658
+ }
2659
+ }
2660
+ var batchDepth = 0;
2661
+ var notifyIndex$1 = 0;
2662
+ var queuedLength = 0;
2663
+ var queued = [];
2664
+ var { link: link$1, unlink: unlink$1, propagate: propagate$1, checkDirty: checkDirty$1, shallowPropagate: shallowPropagate$1 } = createReactiveSystem({
2665
+ update(node) {
2666
+ if (node.depsTail !== void 0) return updateComputed(node);
2667
+ else return updateSignal(node);
2668
+ },
2669
+ notify(effect2) {
2670
+ let insertIndex = queuedLength;
2671
+ let firstInsertedIndex = insertIndex;
2672
+ do {
2673
+ queued[insertIndex++] = effect2;
2674
+ effect2.flags &= -3;
2675
+ effect2 = effect2.subs?.sub;
2676
+ if (effect2 === void 0 || !(effect2.flags & 2)) break;
2677
+ } while (true);
2678
+ queuedLength = insertIndex;
2679
+ while (firstInsertedIndex < --insertIndex) {
2680
+ const left = queued[firstInsertedIndex];
2681
+ queued[firstInsertedIndex++] = queued[insertIndex];
2682
+ queued[insertIndex] = left;
2683
+ }
2684
+ },
2685
+ unwatched(node) {
2686
+ if (!(node.flags & 1)) effectScopeOper.call(node);
2687
+ else if (node.depsTail !== void 0) {
2688
+ node.depsTail = void 0;
2689
+ node.flags = 17;
2690
+ purgeDeps$1(node);
2691
+ }
2692
+ }
2693
+ });
2694
+ function getBatchDepth() {
2695
+ return batchDepth;
2696
+ }
2697
+ function startBatch() {
2698
+ ++batchDepth;
2699
+ }
2700
+ function endBatch() {
2701
+ if (!--batchDepth) flush$1();
2702
+ }
2703
+ function updateComputed(c) {
2704
+ c.depsTail = void 0;
2705
+ c.flags = 5;
2706
+ try {
2707
+ const oldValue = c.value;
2708
+ return oldValue !== (c.value = c.getter(oldValue));
2709
+ } finally {
2710
+ c.flags &= -5;
2711
+ purgeDeps$1(c);
2712
+ }
2713
+ }
2714
+ function updateSignal(s) {
2715
+ s.flags = 1;
2716
+ return s.currentValue !== (s.currentValue = s.pendingValue);
2717
+ }
2718
+ function run(e) {
2719
+ const flags = e.flags;
2720
+ if (flags & 16 || flags & 32 && checkDirty$1(e.deps, e)) {
2721
+ e.depsTail = void 0;
2722
+ e.flags = 6;
2723
+ try {
2724
+ e.fn();
2725
+ } finally {
2726
+ e.flags &= -5;
2727
+ purgeDeps$1(e);
2728
+ }
2729
+ } else e.flags = 2;
2730
+ }
2731
+ function flush$1() {
2732
+ try {
2733
+ while (notifyIndex$1 < queuedLength) {
2734
+ const effect2 = queued[notifyIndex$1];
2735
+ queued[notifyIndex$1++] = void 0;
2736
+ run(effect2);
2737
+ }
2738
+ } finally {
2739
+ while (notifyIndex$1 < queuedLength) {
2740
+ const effect2 = queued[notifyIndex$1];
2741
+ queued[notifyIndex$1++] = void 0;
2742
+ effect2.flags |= 10;
2743
+ }
2744
+ notifyIndex$1 = 0;
2745
+ queuedLength = 0;
2746
+ }
2747
+ }
2748
+ function effectScopeOper() {
2749
+ this.depsTail = void 0;
2750
+ this.flags = 0;
2751
+ purgeDeps$1(this);
2752
+ const sub = this.subs;
2753
+ if (sub !== void 0) unlink$1(sub);
2754
+ }
2755
+ function purgeDeps$1(sub) {
2756
+ const depsTail = sub.depsTail;
2757
+ let dep = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
2758
+ while (dep !== void 0) dep = unlink$1(dep, sub);
2759
+ }
2760
+ //#endregion
2761
+ //#region ../../node_modules/.bun/@tanstack+store@0.9.2/node_modules/@tanstack/store/dist/esm/atom.js
2762
+ function toObserver(nextHandler, errorHandler, completionHandler) {
2763
+ const isObserver = typeof nextHandler === "object";
2764
+ const self = isObserver ? nextHandler : void 0;
2765
+ return {
2766
+ next: (isObserver ? nextHandler.next : nextHandler)?.bind(self),
2767
+ error: (isObserver ? nextHandler.error : errorHandler)?.bind(self),
2768
+ complete: (isObserver ? nextHandler.complete : completionHandler)?.bind(self)
2769
+ };
2770
+ }
2771
+ var queuedEffects = [];
2772
+ var cycle = 0;
2773
+ var { link, unlink, propagate, checkDirty, shallowPropagate } = createReactiveSystem({
2774
+ update(atom) {
2775
+ return atom._update();
2776
+ },
2777
+ notify(effect2) {
2778
+ queuedEffects[queuedEffectsLength++] = effect2;
2779
+ effect2.flags &= ~ReactiveFlags.Watching;
2780
+ },
2781
+ unwatched(atom) {
2782
+ if (atom.depsTail !== void 0) {
2783
+ atom.depsTail = void 0;
2784
+ atom.flags = ReactiveFlags.Mutable | ReactiveFlags.Dirty;
2785
+ purgeDeps(atom);
2786
+ }
2787
+ }
2788
+ });
2789
+ var notifyIndex = 0;
2790
+ var queuedEffectsLength = 0;
2791
+ var activeSub;
2792
+ function purgeDeps(sub) {
2793
+ const depsTail = sub.depsTail;
2794
+ let dep = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
2795
+ while (dep !== void 0) dep = unlink(dep, sub);
2796
+ }
2797
+ function flush() {
2798
+ if (getBatchDepth() > 0) return;
2799
+ while (notifyIndex < queuedEffectsLength) {
2800
+ const effect2 = queuedEffects[notifyIndex];
2801
+ queuedEffects[notifyIndex++] = void 0;
2802
+ effect2.notify();
2803
+ }
2804
+ notifyIndex = 0;
2805
+ queuedEffectsLength = 0;
2806
+ }
2807
+ function createAtom(valueOrFn, options) {
2808
+ const isComputed = typeof valueOrFn === "function";
2809
+ const getter = valueOrFn;
2810
+ const atom = {
2811
+ _snapshot: isComputed ? void 0 : valueOrFn,
2812
+ subs: void 0,
2813
+ subsTail: void 0,
2814
+ deps: void 0,
2815
+ depsTail: void 0,
2816
+ flags: isComputed ? ReactiveFlags.None : ReactiveFlags.Mutable,
2817
+ get() {
2818
+ if (activeSub !== void 0) link(atom, activeSub, cycle);
2819
+ return atom._snapshot;
2820
+ },
2821
+ subscribe(observerOrFn) {
2822
+ const obs = toObserver(observerOrFn);
2823
+ const observed = { current: false };
2824
+ const e = effect(() => {
2825
+ atom.get();
2826
+ if (!observed.current) observed.current = true;
2827
+ else obs.next?.(atom._snapshot);
2828
+ });
2829
+ return { unsubscribe: () => {
2830
+ e.stop();
2831
+ } };
2832
+ },
2833
+ _update(getValue) {
2834
+ const prevSub = activeSub;
2835
+ const compare = options?.compare ?? Object.is;
2836
+ if (isComputed) {
2837
+ activeSub = atom;
2838
+ ++cycle;
2839
+ atom.depsTail = void 0;
2840
+ } else if (getValue === void 0) return false;
2841
+ if (isComputed) atom.flags = ReactiveFlags.Mutable | ReactiveFlags.RecursedCheck;
2842
+ try {
2843
+ const oldValue = atom._snapshot;
2844
+ const newValue = typeof getValue === "function" ? getValue(oldValue) : getValue === void 0 && isComputed ? getter(oldValue) : getValue;
2845
+ if (oldValue === void 0 || !compare(oldValue, newValue)) {
2846
+ atom._snapshot = newValue;
2847
+ return true;
2848
+ }
2849
+ return false;
2850
+ } finally {
2851
+ activeSub = prevSub;
2852
+ if (isComputed) atom.flags &= ~ReactiveFlags.RecursedCheck;
2853
+ purgeDeps(atom);
2854
+ }
2855
+ }
2856
+ };
2857
+ if (isComputed) {
2858
+ atom.flags = ReactiveFlags.Mutable | ReactiveFlags.Dirty;
2859
+ atom.get = function() {
2860
+ const flags = atom.flags;
2861
+ if (flags & ReactiveFlags.Dirty || flags & ReactiveFlags.Pending && checkDirty(atom.deps, atom)) {
2862
+ if (atom._update()) {
2863
+ const subs = atom.subs;
2864
+ if (subs !== void 0) shallowPropagate(subs);
2865
+ }
2866
+ } else if (flags & ReactiveFlags.Pending) atom.flags = flags & ~ReactiveFlags.Pending;
2867
+ if (activeSub !== void 0) link(atom, activeSub, cycle);
2868
+ return atom._snapshot;
2869
+ };
2870
+ } else atom.set = function(valueOrFn2) {
2871
+ if (atom._update(valueOrFn2)) {
2872
+ const subs = atom.subs;
2873
+ if (subs !== void 0) {
2874
+ propagate(subs);
2875
+ shallowPropagate(subs);
2876
+ flush();
2877
+ }
2878
+ }
2879
+ };
2880
+ return atom;
2881
+ }
2882
+ function effect(fn) {
2883
+ const run = () => {
2884
+ const prevSub = activeSub;
2885
+ activeSub = effectObj;
2886
+ ++cycle;
2887
+ effectObj.depsTail = void 0;
2888
+ effectObj.flags = ReactiveFlags.Watching | ReactiveFlags.RecursedCheck;
2889
+ try {
2890
+ return fn();
2891
+ } finally {
2892
+ activeSub = prevSub;
2893
+ effectObj.flags &= ~ReactiveFlags.RecursedCheck;
2894
+ purgeDeps(effectObj);
2895
+ }
2896
+ };
2897
+ const effectObj = {
2898
+ deps: void 0,
2899
+ depsTail: void 0,
2900
+ subs: void 0,
2901
+ subsTail: void 0,
2902
+ flags: ReactiveFlags.Watching | ReactiveFlags.RecursedCheck,
2903
+ notify() {
2904
+ const flags = this.flags;
2905
+ if (flags & ReactiveFlags.Dirty || flags & ReactiveFlags.Pending && checkDirty(this.deps, this)) run();
2906
+ else this.flags = ReactiveFlags.Watching;
2907
+ },
2908
+ stop() {
2909
+ this.flags = ReactiveFlags.None;
2910
+ this.depsTail = void 0;
2911
+ purgeDeps(this);
2912
+ }
2913
+ };
2914
+ run();
2915
+ return effectObj;
2916
+ }
2917
+ //#endregion
2918
+ //#region ../../node_modules/.bun/@tanstack+store@0.9.2/node_modules/@tanstack/store/dist/esm/batch.js
2919
+ function batch(fn) {
2920
+ try {
2921
+ startBatch();
2922
+ fn();
2923
+ } finally {
2924
+ endBatch();
2925
+ flush();
2926
+ }
2927
+ }
2928
+ //#endregion
2929
+ //#region ../../node_modules/.bun/@tanstack+react-router@1.168.3+bf16f8eded5e12ee/node_modules/@tanstack/react-router/dist/esm/not-found.js
2930
+ function CatchNotFound(props) {
2931
+ const router = useRouter();
2932
+ {
2933
+ const resetKey = `not-found-${router.stores.location.state.pathname}-${router.stores.status.state}`;
2934
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CatchBoundary, {
2935
+ getResetKey: () => resetKey,
2936
+ onCatch: (error, errorInfo) => {
2937
+ if (isNotFound(error)) props.onCatch?.(error, errorInfo);
2938
+ else throw error;
2939
+ },
2940
+ errorComponent: ({ error }) => {
2941
+ if (isNotFound(error)) return props.fallback?.(error);
2942
+ else throw error;
2943
+ },
2944
+ children: props.children
2945
+ });
2946
+ }
2947
+ const resetKey = `not-found-${useStore(router.stores.location, (location) => location.pathname)}-${useStore(router.stores.status, (status) => status)}`;
2948
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CatchBoundary, {
2949
+ getResetKey: () => resetKey,
2950
+ onCatch: (error, errorInfo) => {
2951
+ if (isNotFound(error)) props.onCatch?.(error, errorInfo);
2952
+ else throw error;
2953
+ },
2954
+ errorComponent: ({ error }) => {
2955
+ if (isNotFound(error)) return props.fallback?.(error);
2956
+ else throw error;
2957
+ },
2958
+ children: props.children
2959
+ });
2960
+ }
2961
+ function DefaultGlobalNotFound() {
2962
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Not Found" });
2963
+ }
2964
+ //#endregion
2965
+ //#region ../../node_modules/.bun/@tanstack+react-router@1.168.3+bf16f8eded5e12ee/node_modules/@tanstack/react-router/dist/esm/ScriptOnce.js
2966
+ /**
2967
+ * Server-only helper to emit a script tag exactly once during SSR.
2968
+ */
2969
+ function ScriptOnce({ children }) {
2970
+ const router = useRouter();
2971
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("script", {
2972
+ nonce: router.options.ssr?.nonce,
2973
+ dangerouslySetInnerHTML: { __html: children + ";document.currentScript.remove()" }
2974
+ });
2975
+ }
2976
+ //#endregion
2977
+ //#region ../../node_modules/.bun/@tanstack+react-router@1.168.3+bf16f8eded5e12ee/node_modules/@tanstack/react-router/dist/esm/SafeFragment.js
2978
+ function SafeFragment(props) {
2979
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: props.children });
2980
+ }
2981
+ //#endregion
2982
+ //#region ../../node_modules/.bun/@tanstack+react-router@1.168.3+bf16f8eded5e12ee/node_modules/@tanstack/react-router/dist/esm/renderRouteNotFound.js
2983
+ /**
2984
+ * Renders a not found component for a route when no matching route is found.
2985
+ *
2986
+ * @param router - The router instance containing the route configuration
2987
+ * @param route - The route that triggered the not found state
2988
+ * @param data - Additional data to pass to the not found component
2989
+ * @returns The rendered not found component or a default fallback component
2990
+ */
2991
+ function renderRouteNotFound(router, route, data) {
2992
+ if (!route.options.notFoundComponent) {
2993
+ if (router.options.defaultNotFoundComponent) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(router.options.defaultNotFoundComponent, { ...data });
2994
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultGlobalNotFound, {});
2995
+ }
2996
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(route.options.notFoundComponent, { ...data });
2997
+ }
2998
+ //#endregion
2999
+ //#region ../../node_modules/.bun/@tanstack+react-router@1.168.3+bf16f8eded5e12ee/node_modules/@tanstack/react-router/dist/esm/scroll-restoration.js
3000
+ function ScrollRestoration() {
3001
+ const router = useRouter();
3002
+ if (!router.isScrollRestoring || false) return null;
3003
+ if (typeof router.options.scrollRestoration === "function") {
3004
+ if (!router.options.scrollRestoration({ location: router.latestLocation })) return null;
3005
+ }
3006
+ const userKey = (router.options.getScrollRestorationKey || defaultGetScrollRestorationKey)(router.latestLocation);
3007
+ const resolvedKey = userKey !== defaultGetScrollRestorationKey(router.latestLocation) ? userKey : void 0;
3008
+ const restoreScrollOptions = {
3009
+ storageKey,
3010
+ shouldScrollRestoration: true
3011
+ };
3012
+ if (resolvedKey) restoreScrollOptions.key = resolvedKey;
3013
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScriptOnce, { children: `(${restoreScroll.toString()})(${escapeHtml(JSON.stringify(restoreScrollOptions))})` });
3014
+ }
3015
+ //#endregion
3016
+ //#region ../../node_modules/.bun/@tanstack+react-router@1.168.3+bf16f8eded5e12ee/node_modules/@tanstack/react-router/dist/esm/Match.js
3017
+ var Match = import_react.memo(function MatchImpl({ matchId }) {
3018
+ const router = useRouter();
3019
+ {
3020
+ const match = router.stores.activeMatchStoresById.get(matchId)?.state;
3021
+ if (!match) invariant();
3022
+ const routeId = match.routeId;
3023
+ const parentRouteId = router.routesById[routeId].parentRoute?.id;
3024
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MatchView, {
3025
+ router,
3026
+ matchId,
3027
+ resetKey: router.stores.loadedAt.state,
3028
+ matchState: {
3029
+ routeId,
3030
+ ssr: match.ssr,
3031
+ _displayPending: match._displayPending,
3032
+ parentRouteId
3033
+ }
3034
+ });
3035
+ }
3036
+ const matchStore = router.stores.activeMatchStoresById.get(matchId);
3037
+ if (!matchStore) invariant();
3038
+ const resetKey = useStore(router.stores.loadedAt, (loadedAt) => loadedAt);
3039
+ const match = useStore(matchStore, (value) => value);
3040
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MatchView, {
3041
+ router,
3042
+ matchId,
3043
+ resetKey,
3044
+ matchState: import_react.useMemo(() => {
3045
+ const routeId = match.routeId;
3046
+ const parentRouteId = router.routesById[routeId].parentRoute?.id;
3047
+ return {
3048
+ routeId,
3049
+ ssr: match.ssr,
3050
+ _displayPending: match._displayPending,
3051
+ parentRouteId
3052
+ };
3053
+ }, [
3054
+ match._displayPending,
3055
+ match.routeId,
3056
+ match.ssr,
3057
+ router.routesById
3058
+ ])
3059
+ });
3060
+ });
3061
+ function MatchView({ router, matchId, resetKey, matchState }) {
3062
+ const route = router.routesById[matchState.routeId];
3063
+ const PendingComponent = route.options.pendingComponent ?? router.options.defaultPendingComponent;
3064
+ const pendingElement = PendingComponent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PendingComponent, {}) : null;
3065
+ const routeErrorComponent = route.options.errorComponent ?? router.options.defaultErrorComponent;
3066
+ const routeOnCatch = route.options.onCatch ?? router.options.defaultOnCatch;
3067
+ const routeNotFoundComponent = route.isRoot ? route.options.notFoundComponent ?? router.options.notFoundRoute?.options.component : route.options.notFoundComponent;
3068
+ const resolvedNoSsr = matchState.ssr === false || matchState.ssr === "data-only";
3069
+ const ResolvedSuspenseBoundary = (!route.isRoot || route.options.wrapInSuspense || resolvedNoSsr) && (route.options.wrapInSuspense ?? PendingComponent ?? (route.options.errorComponent?.preload || resolvedNoSsr)) ? import_react.Suspense : SafeFragment;
3070
+ const ResolvedCatchBoundary = routeErrorComponent ? CatchBoundary : SafeFragment;
3071
+ const ResolvedNotFoundBoundary = routeNotFoundComponent ? CatchNotFound : SafeFragment;
3072
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(route.isRoot ? route.options.shellComponent ?? SafeFragment : SafeFragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(matchContext.Provider, {
3073
+ value: matchId,
3074
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ResolvedSuspenseBoundary, {
3075
+ fallback: pendingElement,
3076
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ResolvedCatchBoundary, {
3077
+ getResetKey: () => resetKey,
3078
+ errorComponent: routeErrorComponent || ErrorComponent,
3079
+ onCatch: (error, errorInfo) => {
3080
+ if (isNotFound(error)) throw error;
3081
+ routeOnCatch?.(error, errorInfo);
3082
+ },
3083
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ResolvedNotFoundBoundary, {
3084
+ fallback: (error) => {
3085
+ if (!routeNotFoundComponent || error.routeId && error.routeId !== matchState.routeId || !error.routeId && !route.isRoot) throw error;
3086
+ return import_react.createElement(routeNotFoundComponent, error);
3087
+ },
3088
+ children: resolvedNoSsr || matchState._displayPending ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClientOnly, {
3089
+ fallback: pendingElement,
3090
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MatchInner, { matchId })
3091
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MatchInner, { matchId })
3092
+ })
3093
+ })
3094
+ })
3095
+ }), matchState.parentRouteId === "__root__" && router.options.scrollRestoration ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(OnRendered, {}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScrollRestoration, {})] }) : null] });
3096
+ }
3097
+ function OnRendered() {
3098
+ const router = useRouter();
3099
+ const prevLocationRef = import_react.useRef(void 0);
3100
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("script", {
3101
+ suppressHydrationWarning: true,
3102
+ ref: (el) => {
3103
+ if (el && (prevLocationRef.current === void 0 || prevLocationRef.current.href !== router.latestLocation.href)) {
3104
+ router.emit({
3105
+ type: "onRendered",
3106
+ ...getLocationChangeInfo(router.stores.location.state, router.stores.resolvedLocation.state)
3107
+ });
3108
+ prevLocationRef.current = router.latestLocation;
3109
+ }
3110
+ }
3111
+ }, router.latestLocation.state.__TSR_key);
3112
+ }
3113
+ var MatchInner = import_react.memo(function MatchInnerImpl({ matchId }) {
3114
+ const router = useRouter();
3115
+ {
3116
+ const match = router.stores.activeMatchStoresById.get(matchId)?.state;
3117
+ if (!match) invariant();
3118
+ const routeId = match.routeId;
3119
+ const route = router.routesById[routeId];
3120
+ const remountDeps = (router.routesById[routeId].options.remountDeps ?? router.options.defaultRemountDeps)?.({
3121
+ routeId,
3122
+ loaderDeps: match.loaderDeps,
3123
+ params: match._strictParams,
3124
+ search: match._strictSearch
3125
+ });
3126
+ const key = remountDeps ? JSON.stringify(remountDeps) : void 0;
3127
+ const Comp = route.options.component ?? router.options.defaultComponent;
3128
+ const out = Comp ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Comp, {}, key) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Outlet, {});
3129
+ if (match._displayPending) throw router.getMatch(match.id)?._nonReactive.displayPendingPromise;
3130
+ if (match._forcePending) throw router.getMatch(match.id)?._nonReactive.minPendingPromise;
3131
+ if (match.status === "pending") throw router.getMatch(match.id)?._nonReactive.loadPromise;
3132
+ if (match.status === "notFound") {
3133
+ if (!isNotFound(match.error)) invariant();
3134
+ return renderRouteNotFound(router, route, match.error);
3135
+ }
3136
+ if (match.status === "redirected") {
3137
+ if (!isRedirect(match.error)) invariant();
3138
+ throw router.getMatch(match.id)?._nonReactive.loadPromise;
3139
+ }
3140
+ if (match.status === "error") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)((route.options.errorComponent ?? router.options.defaultErrorComponent) || ErrorComponent, {
3141
+ error: match.error,
3142
+ reset: void 0,
3143
+ info: { componentStack: "" }
3144
+ });
3145
+ return out;
3146
+ }
3147
+ const matchStore = router.stores.activeMatchStoresById.get(matchId);
3148
+ if (!matchStore) invariant();
3149
+ const match = useStore(matchStore, (value) => value);
3150
+ const routeId = match.routeId;
3151
+ const route = router.routesById[routeId];
3152
+ const key = import_react.useMemo(() => {
3153
+ const remountDeps = (router.routesById[routeId].options.remountDeps ?? router.options.defaultRemountDeps)?.({
3154
+ routeId,
3155
+ loaderDeps: match.loaderDeps,
3156
+ params: match._strictParams,
3157
+ search: match._strictSearch
3158
+ });
3159
+ return remountDeps ? JSON.stringify(remountDeps) : void 0;
3160
+ }, [
3161
+ routeId,
3162
+ match.loaderDeps,
3163
+ match._strictParams,
3164
+ match._strictSearch,
3165
+ router.options.defaultRemountDeps,
3166
+ router.routesById
3167
+ ]);
3168
+ const out = import_react.useMemo(() => {
3169
+ const Comp = route.options.component ?? router.options.defaultComponent;
3170
+ if (Comp) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Comp, {}, key);
3171
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Outlet, {});
3172
+ }, [
3173
+ key,
3174
+ route.options.component,
3175
+ router.options.defaultComponent
3176
+ ]);
3177
+ if (match._displayPending) throw router.getMatch(match.id)?._nonReactive.displayPendingPromise;
3178
+ if (match._forcePending) throw router.getMatch(match.id)?._nonReactive.minPendingPromise;
3179
+ if (match.status === "pending") {
3180
+ if (route.options.pendingMinMs ?? router.options.defaultPendingMinMs) {
3181
+ const routerMatch = router.getMatch(match.id);
3182
+ if (routerMatch && !routerMatch._nonReactive.minPendingPromise) {}
3183
+ }
3184
+ throw router.getMatch(match.id)?._nonReactive.loadPromise;
3185
+ }
3186
+ if (match.status === "notFound") {
3187
+ if (!isNotFound(match.error)) invariant();
3188
+ return renderRouteNotFound(router, route, match.error);
3189
+ }
3190
+ if (match.status === "redirected") {
3191
+ if (!isRedirect(match.error)) invariant();
3192
+ throw router.getMatch(match.id)?._nonReactive.loadPromise;
3193
+ }
3194
+ if (match.status === "error") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)((route.options.errorComponent ?? router.options.defaultErrorComponent) || ErrorComponent, {
3195
+ error: match.error,
3196
+ reset: void 0,
3197
+ info: { componentStack: "" }
3198
+ });
3199
+ return out;
3200
+ });
3201
+ /**
3202
+ * Render the next child match in the route tree. Typically used inside
3203
+ * a route component to render nested routes.
3204
+ *
3205
+ * @link https://tanstack.com/router/latest/docs/framework/react/api/router/outletComponent
3206
+ */
3207
+ var Outlet = import_react.memo(function OutletImpl() {
3208
+ const router = useRouter();
3209
+ const matchId = import_react.useContext(matchContext);
3210
+ let routeId;
3211
+ let parentGlobalNotFound = false;
3212
+ let childMatchId;
3213
+ {
3214
+ const matches = router.stores.activeMatchesSnapshot.state;
3215
+ const parentIndex = matchId ? matches.findIndex((match) => match.id === matchId) : -1;
3216
+ const parentMatch = parentIndex >= 0 ? matches[parentIndex] : void 0;
3217
+ routeId = parentMatch?.routeId;
3218
+ parentGlobalNotFound = parentMatch?.globalNotFound ?? false;
3219
+ childMatchId = parentIndex >= 0 ? matches[parentIndex + 1]?.id : void 0;
3220
+ }
3221
+ const route = routeId ? router.routesById[routeId] : void 0;
3222
+ const pendingElement = router.options.defaultPendingComponent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(router.options.defaultPendingComponent, {}) : null;
3223
+ if (parentGlobalNotFound) {
3224
+ if (!route) invariant();
3225
+ return renderRouteNotFound(router, route, void 0);
3226
+ }
3227
+ if (!childMatchId) return null;
3228
+ const nextMatch = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Match, { matchId: childMatchId });
3229
+ if (routeId === "__root__") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, {
3230
+ fallback: pendingElement,
3231
+ children: nextMatch
3232
+ });
3233
+ return nextMatch;
3234
+ });
3235
+ //#endregion
3236
+ export { handleHashScroll as _, createAtom as a, ErrorComponent as c, RouterCore as d, getLocationChangeInfo as f, executeRewriteInput as g, createNonReactiveReadonlyStore as h, batch as i, getAssetCrossOrigin as l, createNonReactiveMutableStore as m, Outlet as n, toObserver as o, createMemoryHistory as p, SafeFragment as r, CatchBoundary as s, Match as t, resolveManifestAssetLink as u };