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
@@ -1,2421 +1,12 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./assets/chunk-CNvmzFzq.js";
2
2
  import { l as require_react, n as routerContext, r as require_jsx_runtime, t as useRouter } from "./assets/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, n as require_react_dom, o as ClientOnly, p as interpolatePath, r as useStore, t as getServerFnById, u as cleanPath, w as processRouteTree, x as findRouteMatch, y as trimPathRight, z as nullReplaceEqualDeep } from "./assets/__tanstack-start-server-fn-resolver-D1Ni2lpa.js";
4
- import { n as getAuth } from "./assets/auth.server-BLVDnTCZ.js";
3
+ import { A as decodePath, E as invariant, T as createLRUCache, a as matchContext, c as rootRouteId, l as isNotFound, n as require_react_dom, t as getServerFnById } from "./assets/__tanstack-start-server-fn-resolver-SG4WUVWE.js";
4
+ import { c as ErrorComponent, g as executeRewriteInput, p as createMemoryHistory, r as SafeFragment, s as CatchBoundary, t as Match, u as resolveManifestAssetLink } from "./assets/Match-BeWrYoSG.js";
5
+ import { a as createNullProtoObject, c as TSS_CONTENT_TYPE_FRAMED_VERSIONED, d as X_TSS_RAW_RESPONSE, f as X_TSS_SERIALIZED, h as isResolvedRedirect, i as runWithStartContext, l as TSS_FORMDATA_CONTEXT, m as isRedirect, n as flattenMiddlewares, o as safeObjectMerge, p as mergeHeaders, r as getStartOptions, s as FrameType, u as TSS_SERVER_FUNCTION } from "./assets/createServerFn-CAF9Kl7K.js";
6
+ import { n as getResponse, r as requestHandler } from "./assets/request-response-Bj40K48O.js";
7
+ import { n as getAuth, t as ensureMigrations } from "./assets/auth.server-C5kH0jex.js";
5
8
  import { ReadableStream as ReadableStream$1 } from "node:stream/web";
6
9
  import { PassThrough, Readable } from "node:stream";
7
- import { AsyncLocalStorage } from "node:async_hooks";
8
- //#region ../../node_modules/.bun/@tanstack+router-core@1.168.3/node_modules/@tanstack/router-core/dist/esm/scroll-restoration.js
9
- function getSafeSessionStorage() {
10
- try {
11
- if (typeof window !== "undefined" && typeof window.sessionStorage === "object") return window.sessionStorage;
12
- } catch {}
13
- }
14
- /** SessionStorage key used to persist scroll restoration state. */
15
- /** SessionStorage key used to store scroll positions across navigations. */
16
- /** SessionStorage key used to store scroll positions across navigations. */
17
- var storageKey = "tsr-scroll-restoration-v1_3";
18
- function createScrollRestorationCache() {
19
- const safeSessionStorage = getSafeSessionStorage();
20
- if (!safeSessionStorage) return null;
21
- const persistedState = safeSessionStorage.getItem(storageKey);
22
- let state = persistedState ? JSON.parse(persistedState) : {};
23
- return {
24
- state,
25
- set: (updater) => {
26
- state = functionalUpdate(updater, state) || state;
27
- try {
28
- safeSessionStorage.setItem(storageKey, JSON.stringify(state));
29
- } catch {
30
- console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.");
31
- }
32
- }
33
- };
34
- }
35
- createScrollRestorationCache();
36
- /**
37
- * The default `getKey` function for `useScrollRestoration`.
38
- * It returns the `key` from the location state or the `href` of the location.
39
- *
40
- * The `location.href` is used as a fallback to support the use case where the location state is not available like the initial render.
41
- */
42
- /**
43
- * Default scroll restoration cache key: location state key or full href.
44
- */
45
- var defaultGetScrollRestorationKey = (location) => {
46
- return location.state.__TSR_key || location.href;
47
- };
48
- function restoreScroll({ storageKey, key, behavior, shouldScrollRestoration, scrollToTopSelectors, location }) {
49
- let byKey;
50
- try {
51
- byKey = JSON.parse(sessionStorage.getItem(storageKey) || "{}");
52
- } catch (error) {
53
- console.error(error);
54
- return;
55
- }
56
- const resolvedKey = key || window.history.state?.__TSR_key;
57
- const elementEntries = byKey[resolvedKey];
58
- scroll: {
59
- if (shouldScrollRestoration && elementEntries && Object.keys(elementEntries).length > 0) {
60
- for (const elementSelector in elementEntries) {
61
- const entry = elementEntries[elementSelector];
62
- if (elementSelector === "window") window.scrollTo({
63
- top: entry.scrollY,
64
- left: entry.scrollX,
65
- behavior
66
- });
67
- else if (elementSelector) {
68
- const element = document.querySelector(elementSelector);
69
- if (element) {
70
- element.scrollLeft = entry.scrollX;
71
- element.scrollTop = entry.scrollY;
72
- }
73
- }
74
- }
75
- break scroll;
76
- }
77
- const hash = (location ?? window.location).hash.split("#", 2)[1];
78
- if (hash) {
79
- const hashScrollIntoViewOptions = window.history.state?.__hashScrollIntoViewOptions ?? true;
80
- if (hashScrollIntoViewOptions) {
81
- const el = document.getElementById(hash);
82
- if (el) el.scrollIntoView(hashScrollIntoViewOptions);
83
- }
84
- break scroll;
85
- }
86
- const scrollOptions = {
87
- top: 0,
88
- left: 0,
89
- behavior
90
- };
91
- window.scrollTo(scrollOptions);
92
- if (scrollToTopSelectors) for (const selector of scrollToTopSelectors) {
93
- if (selector === "window") continue;
94
- const element = typeof selector === "function" ? selector() : document.querySelector(selector);
95
- if (element) element.scrollTo(scrollOptions);
96
- }
97
- }
98
- }
99
- //#endregion
100
- //#region ../../node_modules/.bun/@tanstack+router-core@1.168.3/node_modules/@tanstack/router-core/dist/esm/qss.js
101
- /**
102
- * Program is a reimplementation of the `qss` package:
103
- * Copyright (c) Luke Edwards luke.edwards05@gmail.com, MIT License
104
- * https://github.com/lukeed/qss/blob/master/license.md
105
- *
106
- * This reimplementation uses modern browser APIs
107
- * (namely URLSearchParams) and TypeScript while still
108
- * maintaining the original functionality and interface.
109
- *
110
- * Update: this implementation has also been mangled to
111
- * fit exactly our use-case (single value per key in encoding).
112
- */
113
- /**
114
- * Encodes an object into a query string.
115
- * @param obj - The object to encode into a query string.
116
- * @param stringify - An optional custom stringify function.
117
- * @returns The encoded query string.
118
- * @example
119
- * ```
120
- * // Example input: encode({ token: 'foo', key: 'value' })
121
- * // Expected output: "token=foo&key=value"
122
- * ```
123
- */
124
- function encode(obj, stringify = String) {
125
- const result = new URLSearchParams();
126
- for (const key in obj) {
127
- const val = obj[key];
128
- if (val !== void 0) result.set(key, stringify(val));
129
- }
130
- return result.toString();
131
- }
132
- /**
133
- * Converts a string value to its appropriate type (string, number, boolean).
134
- * @param mix - The string value to convert.
135
- * @returns The converted value.
136
- * @example
137
- * // Example input: toValue("123")
138
- * // Expected output: 123
139
- */
140
- function toValue(str) {
141
- if (!str) return "";
142
- if (str === "false") return false;
143
- if (str === "true") return true;
144
- return +str * 0 === 0 && +str + "" === str ? +str : str;
145
- }
146
- /**
147
- * Decodes a query string into an object.
148
- * @param str - The query string to decode.
149
- * @returns The decoded key-value pairs in an object format.
150
- * @example
151
- * // Example input: decode("token=foo&key=value")
152
- * // Expected output: { "token": "foo", "key": "value" }
153
- */
154
- function decode(str) {
155
- const searchParams = new URLSearchParams(str);
156
- const result = Object.create(null);
157
- for (const [key, value] of searchParams.entries()) {
158
- const previousValue = result[key];
159
- if (previousValue == null) result[key] = toValue(value);
160
- else if (Array.isArray(previousValue)) previousValue.push(toValue(value));
161
- else result[key] = [previousValue, toValue(value)];
162
- }
163
- return result;
164
- }
165
- //#endregion
166
- //#region ../../node_modules/.bun/@tanstack+router-core@1.168.3/node_modules/@tanstack/router-core/dist/esm/searchParams.js
167
- /** Default `parseSearch` that strips leading '?' and JSON-parses values. */
168
- var defaultParseSearch = parseSearchWith(JSON.parse);
169
- /** Default `stringifySearch` using JSON.stringify for complex values. */
170
- var defaultStringifySearch = stringifySearchWith(JSON.stringify, JSON.parse);
171
- /**
172
- * Build a `parseSearch` function using a provided JSON-like parser.
173
- *
174
- * The returned function strips a leading `?`, decodes values, and attempts to
175
- * JSON-parse string values using the given `parser`.
176
- *
177
- * @param parser Function to parse a string value (e.g. `JSON.parse`).
178
- * @returns A `parseSearch` function compatible with `Router` options.
179
- * @link https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization
180
- */
181
- function parseSearchWith(parser) {
182
- return (searchStr) => {
183
- if (searchStr[0] === "?") searchStr = searchStr.substring(1);
184
- const query = decode(searchStr);
185
- for (const key in query) {
186
- const value = query[key];
187
- if (typeof value === "string") try {
188
- query[key] = parser(value);
189
- } catch (_err) {}
190
- }
191
- return query;
192
- };
193
- }
194
- /**
195
- * Build a `stringifySearch` function using a provided serializer.
196
- *
197
- * Non-primitive values are serialized with `stringify`. If a `parser` is
198
- * supplied, string values that are parseable are re-serialized to ensure
199
- * symmetry with `parseSearch`.
200
- *
201
- * @param stringify Function to serialize a value (e.g. `JSON.stringify`).
202
- * @param parser Optional parser to detect parseable strings.
203
- * @returns A `stringifySearch` function compatible with `Router` options.
204
- * @link https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization
205
- */
206
- function stringifySearchWith(stringify, parser) {
207
- const hasParser = typeof parser === "function";
208
- function stringifyValue(val) {
209
- if (typeof val === "object" && val !== null) try {
210
- return stringify(val);
211
- } catch (_err) {}
212
- else if (hasParser && typeof val === "string") try {
213
- parser(val);
214
- return stringify(val);
215
- } catch (_err) {}
216
- return val;
217
- }
218
- return (search) => {
219
- const searchStr = encode(search, stringifyValue);
220
- return searchStr ? `?${searchStr}` : "";
221
- };
222
- }
223
- //#endregion
224
- //#region ../../node_modules/.bun/@tanstack+router-core@1.168.3/node_modules/@tanstack/router-core/dist/esm/redirect.js
225
- /**
226
- * Create a redirect Response understood by TanStack Router.
227
- *
228
- * Use from route `loader`/`beforeLoad` or server functions to trigger a
229
- * navigation. If `throw: true` is set, the redirect is thrown instead of
230
- * returned. When an absolute `href` is supplied and `reloadDocument` is not
231
- * set, a full-document navigation is inferred.
232
- *
233
- * @param opts Options for the redirect. Common fields:
234
- * - `href`: absolute URL for external redirects; infers `reloadDocument`.
235
- * - `statusCode`: HTTP status code to use (defaults to 307).
236
- * - `headers`: additional headers to include on the Response.
237
- * - Standard navigation options like `to`, `params`, `search`, `replace`,
238
- * and `reloadDocument` for internal redirects.
239
- * @returns A Response augmented with router navigation options.
240
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/redirectFunction
241
- */
242
- function redirect(opts) {
243
- opts.statusCode = opts.statusCode || opts.code || 307;
244
- if (!opts._builtLocation && !opts.reloadDocument && typeof opts.href === "string") try {
245
- new URL(opts.href);
246
- opts.reloadDocument = true;
247
- } catch {}
248
- const headers = new Headers(opts.headers);
249
- if (opts.href && headers.get("Location") === null) headers.set("Location", opts.href);
250
- const response = new Response(null, {
251
- status: opts.statusCode,
252
- headers
253
- });
254
- response.options = opts;
255
- if (opts.throw) throw response;
256
- return response;
257
- }
258
- /** Check whether a value is a TanStack Router redirect Response. */
259
- /** Check whether a value is a TanStack Router redirect Response. */
260
- function isRedirect(obj) {
261
- return obj instanceof Response && !!obj.options;
262
- }
263
- /** True if value is a redirect with a resolved `href` location. */
264
- /** True if value is a redirect with a resolved `href` location. */
265
- function isResolvedRedirect(obj) {
266
- return isRedirect(obj) && !!obj.options.href;
267
- }
268
- /** Parse a serialized redirect object back into a redirect Response. */
269
- /** Parse a serialized redirect object back into a redirect Response. */
270
- function parseRedirect(obj) {
271
- if (obj !== null && typeof obj === "object" && obj.isSerializedRedirect) return redirect(obj);
272
- }
273
- //#endregion
274
- //#region ../../node_modules/.bun/@tanstack+router-core@1.168.3/node_modules/@tanstack/router-core/dist/esm/rewrite.js
275
- /** Compose multiple rewrite pairs into a single in/out rewrite. */
276
- /** Compose multiple rewrite pairs into a single in/out rewrite. */
277
- function composeRewrites(rewrites) {
278
- return {
279
- input: ({ url }) => {
280
- for (const rewrite of rewrites) url = executeRewriteInput(rewrite, url);
281
- return url;
282
- },
283
- output: ({ url }) => {
284
- for (let i = rewrites.length - 1; i >= 0; i--) url = executeRewriteOutput(rewrites[i], url);
285
- return url;
286
- }
287
- };
288
- }
289
- /** Create a rewrite pair that strips/adds a basepath on input/output. */
290
- /** Create a rewrite pair that strips/adds a basepath on input/output. */
291
- function rewriteBasepath(opts) {
292
- const trimmedBasepath = trimPath(opts.basepath);
293
- const normalizedBasepath = `/${trimmedBasepath}`;
294
- const normalizedBasepathWithSlash = `${normalizedBasepath}/`;
295
- const checkBasepath = opts.caseSensitive ? normalizedBasepath : normalizedBasepath.toLowerCase();
296
- const checkBasepathWithSlash = opts.caseSensitive ? normalizedBasepathWithSlash : normalizedBasepathWithSlash.toLowerCase();
297
- return {
298
- input: ({ url }) => {
299
- const pathname = opts.caseSensitive ? url.pathname : url.pathname.toLowerCase();
300
- if (pathname === checkBasepath) url.pathname = "/";
301
- else if (pathname.startsWith(checkBasepathWithSlash)) url.pathname = url.pathname.slice(normalizedBasepath.length);
302
- return url;
303
- },
304
- output: ({ url }) => {
305
- url.pathname = joinPaths([
306
- "/",
307
- trimmedBasepath,
308
- url.pathname
309
- ]);
310
- return url;
311
- }
312
- };
313
- }
314
- /** Execute a location input rewrite if provided. */
315
- /** Execute a location input rewrite if provided. */
316
- function executeRewriteInput(rewrite, url) {
317
- const res = rewrite?.input?.({ url });
318
- if (res) {
319
- if (typeof res === "string") return new URL(res);
320
- else if (res instanceof URL) return res;
321
- }
322
- return url;
323
- }
324
- /** Execute a location output rewrite if provided. */
325
- /** Execute a location output rewrite if provided. */
326
- function executeRewriteOutput(rewrite, url) {
327
- const res = rewrite?.output?.({ url });
328
- if (res) {
329
- if (typeof res === "string") return new URL(res);
330
- else if (res instanceof URL) return res;
331
- }
332
- return url;
333
- }
334
- //#endregion
335
- //#region ../../node_modules/.bun/@tanstack+router-core@1.168.3/node_modules/@tanstack/router-core/dist/esm/stores.js
336
- /** SSR non-reactive createMutableStore */
337
- function createNonReactiveMutableStore(initialValue) {
338
- let value = initialValue;
339
- return {
340
- get state() {
341
- return value;
342
- },
343
- setState(updater) {
344
- value = updater(value);
345
- }
346
- };
347
- }
348
- /** SSR non-reactive createReadonlyStore */
349
- function createNonReactiveReadonlyStore(read) {
350
- return { get state() {
351
- return read();
352
- } };
353
- }
354
- function createRouterStores(initialState, config) {
355
- const { createMutableStore, createReadonlyStore, batch, init } = config;
356
- const activeMatchStoresById = /* @__PURE__ */ new Map();
357
- const pendingMatchStoresById = /* @__PURE__ */ new Map();
358
- const cachedMatchStoresById = /* @__PURE__ */ new Map();
359
- const status = createMutableStore(initialState.status);
360
- const loadedAt = createMutableStore(initialState.loadedAt);
361
- const isLoading = createMutableStore(initialState.isLoading);
362
- const isTransitioning = createMutableStore(initialState.isTransitioning);
363
- const location = createMutableStore(initialState.location);
364
- const resolvedLocation = createMutableStore(initialState.resolvedLocation);
365
- const statusCode = createMutableStore(initialState.statusCode);
366
- const redirect = createMutableStore(initialState.redirect);
367
- const matchesId = createMutableStore([]);
368
- const pendingMatchesId = createMutableStore([]);
369
- const cachedMatchesId = createMutableStore([]);
370
- const activeMatchesSnapshot = createReadonlyStore(() => readPoolMatches(activeMatchStoresById, matchesId.state));
371
- const pendingMatchesSnapshot = createReadonlyStore(() => readPoolMatches(pendingMatchStoresById, pendingMatchesId.state));
372
- const cachedMatchesSnapshot = createReadonlyStore(() => readPoolMatches(cachedMatchStoresById, cachedMatchesId.state));
373
- const firstMatchId = createReadonlyStore(() => matchesId.state[0]);
374
- const hasPendingMatches = createReadonlyStore(() => matchesId.state.some((matchId) => {
375
- return activeMatchStoresById.get(matchId)?.state.status === "pending";
376
- }));
377
- const matchRouteReactivity = createReadonlyStore(() => ({
378
- locationHref: location.state.href,
379
- resolvedLocationHref: resolvedLocation.state?.href,
380
- status: status.state
381
- }));
382
- const __store = createReadonlyStore(() => ({
383
- status: status.state,
384
- loadedAt: loadedAt.state,
385
- isLoading: isLoading.state,
386
- isTransitioning: isTransitioning.state,
387
- matches: activeMatchesSnapshot.state,
388
- location: location.state,
389
- resolvedLocation: resolvedLocation.state,
390
- statusCode: statusCode.state,
391
- redirect: redirect.state
392
- }));
393
- const matchStoreByRouteIdCache = createLRUCache(64);
394
- function getMatchStoreByRouteId(routeId) {
395
- let cached = matchStoreByRouteIdCache.get(routeId);
396
- if (!cached) {
397
- cached = createReadonlyStore(() => {
398
- const ids = matchesId.state;
399
- for (const id of ids) {
400
- const matchStore = activeMatchStoresById.get(id);
401
- if (matchStore && matchStore.routeId === routeId) return matchStore.state;
402
- }
403
- });
404
- matchStoreByRouteIdCache.set(routeId, cached);
405
- }
406
- return cached;
407
- }
408
- const store = {
409
- status,
410
- loadedAt,
411
- isLoading,
412
- isTransitioning,
413
- location,
414
- resolvedLocation,
415
- statusCode,
416
- redirect,
417
- matchesId,
418
- pendingMatchesId,
419
- cachedMatchesId,
420
- activeMatchesSnapshot,
421
- pendingMatchesSnapshot,
422
- cachedMatchesSnapshot,
423
- firstMatchId,
424
- hasPendingMatches,
425
- matchRouteReactivity,
426
- activeMatchStoresById,
427
- pendingMatchStoresById,
428
- cachedMatchStoresById,
429
- __store,
430
- getMatchStoreByRouteId,
431
- setActiveMatches,
432
- setPendingMatches,
433
- setCachedMatches
434
- };
435
- setActiveMatches(initialState.matches);
436
- init?.(store);
437
- function setActiveMatches(nextMatches) {
438
- reconcileMatchPool(nextMatches, activeMatchStoresById, matchesId, createMutableStore, batch);
439
- }
440
- function setPendingMatches(nextMatches) {
441
- reconcileMatchPool(nextMatches, pendingMatchStoresById, pendingMatchesId, createMutableStore, batch);
442
- }
443
- function setCachedMatches(nextMatches) {
444
- reconcileMatchPool(nextMatches, cachedMatchStoresById, cachedMatchesId, createMutableStore, batch);
445
- }
446
- return store;
447
- }
448
- function readPoolMatches(pool, ids) {
449
- const matches = [];
450
- for (const id of ids) {
451
- const matchStore = pool.get(id);
452
- if (matchStore) matches.push(matchStore.state);
453
- }
454
- return matches;
455
- }
456
- function reconcileMatchPool(nextMatches, pool, idStore, createMutableStore, batch) {
457
- const nextIds = nextMatches.map((d) => d.id);
458
- const nextIdSet = new Set(nextIds);
459
- batch(() => {
460
- for (const id of pool.keys()) if (!nextIdSet.has(id)) pool.delete(id);
461
- for (const nextMatch of nextMatches) {
462
- const existing = pool.get(nextMatch.id);
463
- if (!existing) {
464
- const matchStore = createMutableStore(nextMatch);
465
- matchStore.routeId = nextMatch.routeId;
466
- pool.set(nextMatch.id, matchStore);
467
- continue;
468
- }
469
- existing.routeId = nextMatch.routeId;
470
- if (existing.state !== nextMatch) existing.setState(() => nextMatch);
471
- }
472
- if (!arraysEqual(idStore.state, nextIds)) idStore.setState(() => nextIds);
473
- });
474
- }
475
- //#endregion
476
- //#region ../../node_modules/.bun/@tanstack+router-core@1.168.3/node_modules/@tanstack/router-core/dist/esm/load-matches.js
477
- var triggerOnReady = (inner) => {
478
- if (!inner.rendered) {
479
- inner.rendered = true;
480
- return inner.onReady?.();
481
- }
482
- };
483
- var resolvePreload = (inner, matchId) => {
484
- return !!(inner.preload && !inner.router.stores.activeMatchStoresById.has(matchId));
485
- };
486
- /**
487
- * Builds the accumulated context from router options and all matches up to (and optionally including) the given index.
488
- * Merges __routeContext and __beforeLoadContext from each match.
489
- */
490
- var buildMatchContext = (inner, index, includeCurrentMatch = true) => {
491
- const context = { ...inner.router.options.context ?? {} };
492
- const end = includeCurrentMatch ? index : index - 1;
493
- for (let i = 0; i <= end; i++) {
494
- const innerMatch = inner.matches[i];
495
- if (!innerMatch) continue;
496
- const m = inner.router.getMatch(innerMatch.id);
497
- if (!m) continue;
498
- Object.assign(context, m.__routeContext, m.__beforeLoadContext);
499
- }
500
- return context;
501
- };
502
- var getNotFoundBoundaryIndex = (inner, err) => {
503
- if (!inner.matches.length) return;
504
- const requestedRouteId = err.routeId;
505
- const matchedRootIndex = inner.matches.findIndex((m) => m.routeId === inner.router.routeTree.id);
506
- const rootIndex = matchedRootIndex >= 0 ? matchedRootIndex : 0;
507
- let startIndex = requestedRouteId ? inner.matches.findIndex((match) => match.routeId === requestedRouteId) : inner.firstBadMatchIndex ?? inner.matches.length - 1;
508
- if (startIndex < 0) startIndex = rootIndex;
509
- for (let i = startIndex; i >= 0; i--) {
510
- const match = inner.matches[i];
511
- if (inner.router.looseRoutesById[match.routeId].options.notFoundComponent) return i;
512
- }
513
- return requestedRouteId ? startIndex : rootIndex;
514
- };
515
- var handleRedirectAndNotFound = (inner, match, err) => {
516
- if (!isRedirect(err) && !isNotFound(err)) return;
517
- if (isRedirect(err) && err.redirectHandled && !err.options.reloadDocument) throw err;
518
- if (match) {
519
- match._nonReactive.beforeLoadPromise?.resolve();
520
- match._nonReactive.loaderPromise?.resolve();
521
- match._nonReactive.beforeLoadPromise = void 0;
522
- match._nonReactive.loaderPromise = void 0;
523
- match._nonReactive.error = err;
524
- inner.updateMatch(match.id, (prev) => ({
525
- ...prev,
526
- status: isRedirect(err) ? "redirected" : prev.status === "pending" ? "success" : prev.status,
527
- context: buildMatchContext(inner, match.index),
528
- isFetching: false,
529
- error: err
530
- }));
531
- if (isNotFound(err) && !err.routeId) err.routeId = match.routeId;
532
- match._nonReactive.loadPromise?.resolve();
533
- }
534
- if (isRedirect(err)) {
535
- inner.rendered = true;
536
- err.options._fromLocation = inner.location;
537
- err.redirectHandled = true;
538
- err = inner.router.resolveRedirect(err);
539
- }
540
- throw err;
541
- };
542
- var shouldSkipLoader = (inner, matchId) => {
543
- const match = inner.router.getMatch(matchId);
544
- if (!match) return true;
545
- if (match.ssr === false) return true;
546
- return false;
547
- };
548
- var syncMatchContext = (inner, matchId, index) => {
549
- const nextContext = buildMatchContext(inner, index);
550
- inner.updateMatch(matchId, (prev) => {
551
- return {
552
- ...prev,
553
- context: nextContext
554
- };
555
- });
556
- };
557
- var handleSerialError = (inner, index, err, routerCode) => {
558
- const { id: matchId, routeId } = inner.matches[index];
559
- const route = inner.router.looseRoutesById[routeId];
560
- if (err instanceof Promise) throw err;
561
- err.routerCode = routerCode;
562
- inner.firstBadMatchIndex ??= index;
563
- handleRedirectAndNotFound(inner, inner.router.getMatch(matchId), err);
564
- try {
565
- route.options.onError?.(err);
566
- } catch (errorHandlerErr) {
567
- err = errorHandlerErr;
568
- handleRedirectAndNotFound(inner, inner.router.getMatch(matchId), err);
569
- }
570
- inner.updateMatch(matchId, (prev) => {
571
- prev._nonReactive.beforeLoadPromise?.resolve();
572
- prev._nonReactive.beforeLoadPromise = void 0;
573
- prev._nonReactive.loadPromise?.resolve();
574
- return {
575
- ...prev,
576
- error: err,
577
- status: "error",
578
- isFetching: false,
579
- updatedAt: Date.now(),
580
- abortController: new AbortController()
581
- };
582
- });
583
- if (!inner.preload && !isRedirect(err) && !isNotFound(err)) inner.serialError ??= err;
584
- };
585
- var isBeforeLoadSsr = (inner, matchId, index, route) => {
586
- const existingMatch = inner.router.getMatch(matchId);
587
- const parentMatchId = inner.matches[index - 1]?.id;
588
- const parentMatch = parentMatchId ? inner.router.getMatch(parentMatchId) : void 0;
589
- if (inner.router.isShell()) {
590
- existingMatch.ssr = route.id === rootRouteId;
591
- return;
592
- }
593
- if (parentMatch?.ssr === false) {
594
- existingMatch.ssr = false;
595
- return;
596
- }
597
- const parentOverride = (tempSsr) => {
598
- if (tempSsr === true && parentMatch?.ssr === "data-only") return "data-only";
599
- return tempSsr;
600
- };
601
- const defaultSsr = inner.router.options.defaultSsr ?? true;
602
- if (route.options.ssr === void 0) {
603
- existingMatch.ssr = parentOverride(defaultSsr);
604
- return;
605
- }
606
- if (typeof route.options.ssr !== "function") {
607
- existingMatch.ssr = parentOverride(route.options.ssr);
608
- return;
609
- }
610
- const { search, params } = existingMatch;
611
- const ssrFnContext = {
612
- search: makeMaybe(search, existingMatch.searchError),
613
- params: makeMaybe(params, existingMatch.paramsError),
614
- location: inner.location,
615
- matches: inner.matches.map((match) => ({
616
- index: match.index,
617
- pathname: match.pathname,
618
- fullPath: match.fullPath,
619
- staticData: match.staticData,
620
- id: match.id,
621
- routeId: match.routeId,
622
- search: makeMaybe(match.search, match.searchError),
623
- params: makeMaybe(match.params, match.paramsError),
624
- ssr: match.ssr
625
- }))
626
- };
627
- const tempSsr = route.options.ssr(ssrFnContext);
628
- if (isPromise(tempSsr)) return tempSsr.then((ssr) => {
629
- existingMatch.ssr = parentOverride(ssr ?? defaultSsr);
630
- });
631
- existingMatch.ssr = parentOverride(tempSsr ?? defaultSsr);
632
- };
633
- var setupPendingTimeout = (inner, matchId, route, match) => {
634
- if (match._nonReactive.pendingTimeout !== void 0) return;
635
- route.options.pendingMs ?? inner.router.options.defaultPendingMs;
636
- if (!!(inner.onReady && false));
637
- };
638
- var preBeforeLoadSetup = (inner, matchId, route) => {
639
- const existingMatch = inner.router.getMatch(matchId);
640
- if (!existingMatch._nonReactive.beforeLoadPromise && !existingMatch._nonReactive.loaderPromise) return;
641
- setupPendingTimeout(inner, matchId, route, existingMatch);
642
- const then = () => {
643
- const match = inner.router.getMatch(matchId);
644
- if (match.preload && (match.status === "redirected" || match.status === "notFound")) handleRedirectAndNotFound(inner, match, match.error);
645
- };
646
- return existingMatch._nonReactive.beforeLoadPromise ? existingMatch._nonReactive.beforeLoadPromise.then(then) : then();
647
- };
648
- var executeBeforeLoad = (inner, matchId, index, route) => {
649
- const match = inner.router.getMatch(matchId);
650
- let prevLoadPromise = match._nonReactive.loadPromise;
651
- match._nonReactive.loadPromise = createControlledPromise(() => {
652
- prevLoadPromise?.resolve();
653
- prevLoadPromise = void 0;
654
- });
655
- const { paramsError, searchError } = match;
656
- if (paramsError) handleSerialError(inner, index, paramsError, "PARSE_PARAMS");
657
- if (searchError) handleSerialError(inner, index, searchError, "VALIDATE_SEARCH");
658
- setupPendingTimeout(inner, matchId, route, match);
659
- const abortController = new AbortController();
660
- let isPending = false;
661
- const pending = () => {
662
- if (isPending) return;
663
- isPending = true;
664
- inner.updateMatch(matchId, (prev) => ({
665
- ...prev,
666
- isFetching: "beforeLoad",
667
- fetchCount: prev.fetchCount + 1,
668
- abortController
669
- }));
670
- };
671
- const resolve = () => {
672
- match._nonReactive.beforeLoadPromise?.resolve();
673
- match._nonReactive.beforeLoadPromise = void 0;
674
- inner.updateMatch(matchId, (prev) => ({
675
- ...prev,
676
- isFetching: false
677
- }));
678
- };
679
- if (!route.options.beforeLoad) {
680
- inner.router.batch(() => {
681
- pending();
682
- resolve();
683
- });
684
- return;
685
- }
686
- match._nonReactive.beforeLoadPromise = createControlledPromise();
687
- const context = {
688
- ...buildMatchContext(inner, index, false),
689
- ...match.__routeContext
690
- };
691
- const { search, params, cause } = match;
692
- const preload = resolvePreload(inner, matchId);
693
- const beforeLoadFnContext = {
694
- search,
695
- abortController,
696
- params,
697
- preload,
698
- context,
699
- location: inner.location,
700
- navigate: (opts) => inner.router.navigate({
701
- ...opts,
702
- _fromLocation: inner.location
703
- }),
704
- buildLocation: inner.router.buildLocation,
705
- cause: preload ? "preload" : cause,
706
- matches: inner.matches,
707
- routeId: route.id,
708
- ...inner.router.options.additionalContext
709
- };
710
- const updateContext = (beforeLoadContext) => {
711
- if (beforeLoadContext === void 0) {
712
- inner.router.batch(() => {
713
- pending();
714
- resolve();
715
- });
716
- return;
717
- }
718
- if (isRedirect(beforeLoadContext) || isNotFound(beforeLoadContext)) {
719
- pending();
720
- handleSerialError(inner, index, beforeLoadContext, "BEFORE_LOAD");
721
- }
722
- inner.router.batch(() => {
723
- pending();
724
- inner.updateMatch(matchId, (prev) => ({
725
- ...prev,
726
- __beforeLoadContext: beforeLoadContext
727
- }));
728
- resolve();
729
- });
730
- };
731
- let beforeLoadContext;
732
- try {
733
- beforeLoadContext = route.options.beforeLoad(beforeLoadFnContext);
734
- if (isPromise(beforeLoadContext)) {
735
- pending();
736
- return beforeLoadContext.catch((err) => {
737
- handleSerialError(inner, index, err, "BEFORE_LOAD");
738
- }).then(updateContext);
739
- }
740
- } catch (err) {
741
- pending();
742
- handleSerialError(inner, index, err, "BEFORE_LOAD");
743
- }
744
- updateContext(beforeLoadContext);
745
- };
746
- var handleBeforeLoad = (inner, index) => {
747
- const { id: matchId, routeId } = inner.matches[index];
748
- const route = inner.router.looseRoutesById[routeId];
749
- const serverSsr = () => {
750
- {
751
- const maybePromise = isBeforeLoadSsr(inner, matchId, index, route);
752
- if (isPromise(maybePromise)) return maybePromise.then(queueExecution);
753
- }
754
- return queueExecution();
755
- };
756
- const execute = () => executeBeforeLoad(inner, matchId, index, route);
757
- const queueExecution = () => {
758
- if (shouldSkipLoader(inner, matchId)) return;
759
- const result = preBeforeLoadSetup(inner, matchId, route);
760
- return isPromise(result) ? result.then(execute) : execute();
761
- };
762
- return serverSsr();
763
- };
764
- var executeHead = (inner, matchId, route) => {
765
- const match = inner.router.getMatch(matchId);
766
- if (!match) return;
767
- if (!route.options.head && !route.options.scripts && !route.options.headers) return;
768
- const assetContext = {
769
- ssr: inner.router.options.ssr,
770
- matches: inner.matches,
771
- match,
772
- params: match.params,
773
- loaderData: match.loaderData
774
- };
775
- return Promise.all([
776
- route.options.head?.(assetContext),
777
- route.options.scripts?.(assetContext),
778
- route.options.headers?.(assetContext)
779
- ]).then(([headFnContent, scripts, headers]) => {
780
- return {
781
- meta: headFnContent?.meta,
782
- links: headFnContent?.links,
783
- headScripts: headFnContent?.scripts,
784
- headers,
785
- scripts,
786
- styles: headFnContent?.styles
787
- };
788
- });
789
- };
790
- var getLoaderContext = (inner, matchPromises, matchId, index, route) => {
791
- const parentMatchPromise = matchPromises[index - 1];
792
- const { params, loaderDeps, abortController, cause } = inner.router.getMatch(matchId);
793
- const context = buildMatchContext(inner, index);
794
- const preload = resolvePreload(inner, matchId);
795
- return {
796
- params,
797
- deps: loaderDeps,
798
- preload: !!preload,
799
- parentMatchPromise,
800
- abortController,
801
- context,
802
- location: inner.location,
803
- navigate: (opts) => inner.router.navigate({
804
- ...opts,
805
- _fromLocation: inner.location
806
- }),
807
- cause: preload ? "preload" : cause,
808
- route,
809
- ...inner.router.options.additionalContext
810
- };
811
- };
812
- var runLoader = async (inner, matchPromises, matchId, index, route) => {
813
- try {
814
- const match = inner.router.getMatch(matchId);
815
- try {
816
- if (match.ssr === true) loadRouteChunk(route);
817
- const routeLoader = route.options.loader;
818
- const loader = typeof routeLoader === "function" ? routeLoader : routeLoader?.handler;
819
- const loaderResult = loader?.(getLoaderContext(inner, matchPromises, matchId, index, route));
820
- const loaderResultIsPromise = !!loader && isPromise(loaderResult);
821
- if (!!(loaderResultIsPromise || route._lazyPromise || route._componentsPromise || route.options.head || route.options.scripts || route.options.headers || match._nonReactive.minPendingPromise)) inner.updateMatch(matchId, (prev) => ({
822
- ...prev,
823
- isFetching: "loader"
824
- }));
825
- if (loader) {
826
- const loaderData = loaderResultIsPromise ? await loaderResult : loaderResult;
827
- handleRedirectAndNotFound(inner, inner.router.getMatch(matchId), loaderData);
828
- if (loaderData !== void 0) inner.updateMatch(matchId, (prev) => ({
829
- ...prev,
830
- loaderData
831
- }));
832
- }
833
- if (route._lazyPromise) await route._lazyPromise;
834
- const pendingPromise = match._nonReactive.minPendingPromise;
835
- if (pendingPromise) await pendingPromise;
836
- if (route._componentsPromise) await route._componentsPromise;
837
- inner.updateMatch(matchId, (prev) => ({
838
- ...prev,
839
- error: void 0,
840
- context: buildMatchContext(inner, index),
841
- status: "success",
842
- isFetching: false,
843
- updatedAt: Date.now()
844
- }));
845
- } catch (e) {
846
- let error = e;
847
- if (error?.name === "AbortError") {
848
- if (match.abortController.signal.aborted) {
849
- match._nonReactive.loaderPromise?.resolve();
850
- match._nonReactive.loaderPromise = void 0;
851
- return;
852
- }
853
- inner.updateMatch(matchId, (prev) => ({
854
- ...prev,
855
- status: prev.status === "pending" ? "success" : prev.status,
856
- isFetching: false,
857
- context: buildMatchContext(inner, index)
858
- }));
859
- return;
860
- }
861
- const pendingPromise = match._nonReactive.minPendingPromise;
862
- if (pendingPromise) await pendingPromise;
863
- if (isNotFound(e)) await route.options.notFoundComponent?.preload?.();
864
- handleRedirectAndNotFound(inner, inner.router.getMatch(matchId), e);
865
- try {
866
- route.options.onError?.(e);
867
- } catch (onErrorError) {
868
- error = onErrorError;
869
- handleRedirectAndNotFound(inner, inner.router.getMatch(matchId), onErrorError);
870
- }
871
- if (!isRedirect(error) && !isNotFound(error)) await loadRouteChunk(route, ["errorComponent"]);
872
- inner.updateMatch(matchId, (prev) => ({
873
- ...prev,
874
- error,
875
- context: buildMatchContext(inner, index),
876
- status: "error",
877
- isFetching: false
878
- }));
879
- }
880
- } catch (err) {
881
- const match = inner.router.getMatch(matchId);
882
- if (match) match._nonReactive.loaderPromise = void 0;
883
- handleRedirectAndNotFound(inner, match, err);
884
- }
885
- };
886
- var loadRouteMatch = async (inner, matchPromises, index) => {
887
- async function handleLoader(preload, prevMatch, previousRouteMatchId, match, route) {
888
- const age = Date.now() - prevMatch.updatedAt;
889
- const staleAge = preload ? route.options.preloadStaleTime ?? inner.router.options.defaultPreloadStaleTime ?? 3e4 : route.options.staleTime ?? inner.router.options.defaultStaleTime ?? 0;
890
- const shouldReloadOption = route.options.shouldReload;
891
- const shouldReload = typeof shouldReloadOption === "function" ? shouldReloadOption(getLoaderContext(inner, matchPromises, matchId, index, route)) : shouldReloadOption;
892
- const { status, invalid } = match;
893
- const staleMatchShouldReload = age >= staleAge && (!!inner.forceStaleReload || match.cause === "enter" || previousRouteMatchId !== void 0 && previousRouteMatchId !== match.id);
894
- loaderShouldRunAsync = status === "success" && (invalid || (shouldReload ?? staleMatchShouldReload));
895
- if (preload && route.options.preload === false) {} else if (loaderShouldRunAsync && !inner.sync && shouldReloadInBackground) {
896
- loaderIsRunningAsync = true;
897
- (async () => {
898
- try {
899
- await runLoader(inner, matchPromises, matchId, index, route);
900
- const match = inner.router.getMatch(matchId);
901
- match._nonReactive.loaderPromise?.resolve();
902
- match._nonReactive.loadPromise?.resolve();
903
- match._nonReactive.loaderPromise = void 0;
904
- match._nonReactive.loadPromise = void 0;
905
- } catch (err) {
906
- if (isRedirect(err)) await inner.router.navigate(err.options);
907
- }
908
- })();
909
- } else if (status !== "success" || loaderShouldRunAsync) await runLoader(inner, matchPromises, matchId, index, route);
910
- else syncMatchContext(inner, matchId, index);
911
- }
912
- const { id: matchId, routeId } = inner.matches[index];
913
- let loaderShouldRunAsync = false;
914
- let loaderIsRunningAsync = false;
915
- const route = inner.router.looseRoutesById[routeId];
916
- const routeLoader = route.options.loader;
917
- const shouldReloadInBackground = ((typeof routeLoader === "function" ? void 0 : routeLoader?.staleReloadMode) ?? inner.router.options.defaultStaleReloadMode) !== "blocking";
918
- if (shouldSkipLoader(inner, matchId)) {
919
- if (!inner.router.getMatch(matchId)) return inner.matches[index];
920
- syncMatchContext(inner, matchId, index);
921
- return inner.router.getMatch(matchId);
922
- } else {
923
- const prevMatch = inner.router.getMatch(matchId);
924
- const activeIdAtIndex = inner.router.stores.matchesId.state[index];
925
- const previousRouteMatchId = (activeIdAtIndex && inner.router.stores.activeMatchStoresById.get(activeIdAtIndex) || null)?.routeId === routeId ? activeIdAtIndex : inner.router.stores.activeMatchesSnapshot.state.find((d) => d.routeId === routeId)?.id;
926
- const preload = resolvePreload(inner, matchId);
927
- if (prevMatch._nonReactive.loaderPromise) {
928
- if (prevMatch.status === "success" && !inner.sync && !prevMatch.preload && shouldReloadInBackground) return prevMatch;
929
- await prevMatch._nonReactive.loaderPromise;
930
- const match = inner.router.getMatch(matchId);
931
- const error = match._nonReactive.error || match.error;
932
- if (error) handleRedirectAndNotFound(inner, match, error);
933
- if (match.status === "pending") await handleLoader(preload, prevMatch, previousRouteMatchId, match, route);
934
- } else {
935
- const nextPreload = preload && !inner.router.stores.activeMatchStoresById.has(matchId);
936
- const match = inner.router.getMatch(matchId);
937
- match._nonReactive.loaderPromise = createControlledPromise();
938
- if (nextPreload !== match.preload) inner.updateMatch(matchId, (prev) => ({
939
- ...prev,
940
- preload: nextPreload
941
- }));
942
- await handleLoader(preload, prevMatch, previousRouteMatchId, match, route);
943
- }
944
- }
945
- const match = inner.router.getMatch(matchId);
946
- if (!loaderIsRunningAsync) {
947
- match._nonReactive.loaderPromise?.resolve();
948
- match._nonReactive.loadPromise?.resolve();
949
- match._nonReactive.loadPromise = void 0;
950
- }
951
- clearTimeout(match._nonReactive.pendingTimeout);
952
- match._nonReactive.pendingTimeout = void 0;
953
- if (!loaderIsRunningAsync) match._nonReactive.loaderPromise = void 0;
954
- match._nonReactive.dehydrated = void 0;
955
- const nextIsFetching = loaderIsRunningAsync ? match.isFetching : false;
956
- if (nextIsFetching !== match.isFetching || match.invalid !== false) {
957
- inner.updateMatch(matchId, (prev) => ({
958
- ...prev,
959
- isFetching: nextIsFetching,
960
- invalid: false
961
- }));
962
- return inner.router.getMatch(matchId);
963
- } else return match;
964
- };
965
- async function loadMatches(arg) {
966
- const inner = arg;
967
- const matchPromises = [];
968
- let beforeLoadNotFound;
969
- for (let i = 0; i < inner.matches.length; i++) {
970
- try {
971
- const beforeLoad = handleBeforeLoad(inner, i);
972
- if (isPromise(beforeLoad)) await beforeLoad;
973
- } catch (err) {
974
- if (isRedirect(err)) throw err;
975
- if (isNotFound(err)) beforeLoadNotFound = err;
976
- else if (!inner.preload) throw err;
977
- break;
978
- }
979
- if (inner.serialError) break;
980
- }
981
- const baseMaxIndexExclusive = inner.firstBadMatchIndex ?? inner.matches.length;
982
- const boundaryIndex = beforeLoadNotFound && !inner.preload ? getNotFoundBoundaryIndex(inner, beforeLoadNotFound) : void 0;
983
- const maxIndexExclusive = beforeLoadNotFound && inner.preload ? 0 : boundaryIndex !== void 0 ? Math.min(boundaryIndex + 1, baseMaxIndexExclusive) : baseMaxIndexExclusive;
984
- let firstNotFound;
985
- let firstUnhandledRejection;
986
- for (let i = 0; i < maxIndexExclusive; i++) matchPromises.push(loadRouteMatch(inner, matchPromises, i));
987
- try {
988
- await Promise.all(matchPromises);
989
- } catch {
990
- const settled = await Promise.allSettled(matchPromises);
991
- for (const result of settled) {
992
- if (result.status !== "rejected") continue;
993
- const reason = result.reason;
994
- if (isRedirect(reason)) throw reason;
995
- if (isNotFound(reason)) firstNotFound ??= reason;
996
- else firstUnhandledRejection ??= reason;
997
- }
998
- if (firstUnhandledRejection !== void 0) throw firstUnhandledRejection;
999
- }
1000
- const notFoundToThrow = firstNotFound ?? (beforeLoadNotFound && !inner.preload ? beforeLoadNotFound : void 0);
1001
- let headMaxIndex = inner.serialError ? inner.firstBadMatchIndex ?? 0 : inner.matches.length - 1;
1002
- if (!notFoundToThrow && beforeLoadNotFound && inner.preload) return inner.matches;
1003
- if (notFoundToThrow) {
1004
- const renderedBoundaryIndex = getNotFoundBoundaryIndex(inner, notFoundToThrow);
1005
- if (renderedBoundaryIndex === void 0) invariant();
1006
- const boundaryMatch = inner.matches[renderedBoundaryIndex];
1007
- const boundaryRoute = inner.router.looseRoutesById[boundaryMatch.routeId];
1008
- const defaultNotFoundComponent = inner.router.options?.defaultNotFoundComponent;
1009
- if (!boundaryRoute.options.notFoundComponent && defaultNotFoundComponent) boundaryRoute.options.notFoundComponent = defaultNotFoundComponent;
1010
- notFoundToThrow.routeId = boundaryMatch.routeId;
1011
- const boundaryIsRoot = boundaryMatch.routeId === inner.router.routeTree.id;
1012
- inner.updateMatch(boundaryMatch.id, (prev) => ({
1013
- ...prev,
1014
- ...boundaryIsRoot ? {
1015
- status: "success",
1016
- globalNotFound: true,
1017
- error: void 0
1018
- } : {
1019
- status: "notFound",
1020
- error: notFoundToThrow
1021
- },
1022
- isFetching: false
1023
- }));
1024
- headMaxIndex = renderedBoundaryIndex;
1025
- await loadRouteChunk(boundaryRoute, ["notFoundComponent"]);
1026
- } else if (!inner.preload) {
1027
- const rootMatch = inner.matches[0];
1028
- if (!rootMatch.globalNotFound) {
1029
- if (inner.router.getMatch(rootMatch.id)?.globalNotFound) inner.updateMatch(rootMatch.id, (prev) => ({
1030
- ...prev,
1031
- globalNotFound: false,
1032
- error: void 0
1033
- }));
1034
- }
1035
- }
1036
- if (inner.serialError && inner.firstBadMatchIndex !== void 0) {
1037
- const errorRoute = inner.router.looseRoutesById[inner.matches[inner.firstBadMatchIndex].routeId];
1038
- await loadRouteChunk(errorRoute, ["errorComponent"]);
1039
- }
1040
- for (let i = 0; i <= headMaxIndex; i++) {
1041
- const { id: matchId, routeId } = inner.matches[i];
1042
- const route = inner.router.looseRoutesById[routeId];
1043
- try {
1044
- const headResult = executeHead(inner, matchId, route);
1045
- if (headResult) {
1046
- const head = await headResult;
1047
- inner.updateMatch(matchId, (prev) => ({
1048
- ...prev,
1049
- ...head
1050
- }));
1051
- }
1052
- } catch (err) {
1053
- console.error(`Error executing head for route ${routeId}:`, err);
1054
- }
1055
- }
1056
- const readyPromise = triggerOnReady(inner);
1057
- if (isPromise(readyPromise)) await readyPromise;
1058
- if (notFoundToThrow) throw notFoundToThrow;
1059
- if (inner.serialError && !inner.preload && !inner.onReady) throw inner.serialError;
1060
- return inner.matches;
1061
- }
1062
- function preloadRouteComponents(route, componentTypesToLoad) {
1063
- const preloads = componentTypesToLoad.map((type) => route.options[type]?.preload?.()).filter(Boolean);
1064
- if (preloads.length === 0) return void 0;
1065
- return Promise.all(preloads);
1066
- }
1067
- function loadRouteChunk(route, componentTypesToLoad = componentTypes) {
1068
- if (!route._lazyLoaded && route._lazyPromise === void 0) if (route.lazyFn) route._lazyPromise = route.lazyFn().then((lazyRoute) => {
1069
- const { id: _id, ...options } = lazyRoute.options;
1070
- Object.assign(route.options, options);
1071
- route._lazyLoaded = true;
1072
- route._lazyPromise = void 0;
1073
- });
1074
- else route._lazyLoaded = true;
1075
- const runAfterLazy = () => route._componentsLoaded ? void 0 : componentTypesToLoad === componentTypes ? (() => {
1076
- if (route._componentsPromise === void 0) {
1077
- const componentsPromise = preloadRouteComponents(route, componentTypes);
1078
- if (componentsPromise) route._componentsPromise = componentsPromise.then(() => {
1079
- route._componentsLoaded = true;
1080
- route._componentsPromise = void 0;
1081
- });
1082
- else route._componentsLoaded = true;
1083
- }
1084
- return route._componentsPromise;
1085
- })() : preloadRouteComponents(route, componentTypesToLoad);
1086
- return route._lazyPromise ? route._lazyPromise.then(runAfterLazy) : runAfterLazy();
1087
- }
1088
- function makeMaybe(value, error) {
1089
- if (error) return {
1090
- status: "error",
1091
- error
1092
- };
1093
- return {
1094
- status: "success",
1095
- value
1096
- };
1097
- }
1098
- function routeNeedsPreload(route) {
1099
- for (const componentType of componentTypes) if (route.options[componentType]?.preload) return true;
1100
- return false;
1101
- }
1102
- var componentTypes = [
1103
- "component",
1104
- "errorComponent",
1105
- "pendingComponent",
1106
- "notFoundComponent"
1107
- ];
1108
- //#endregion
1109
- //#region ../../node_modules/.bun/@tanstack+history@1.161.6/node_modules/@tanstack/history/dist/esm/index.js
1110
- var stateIndexKey = "__TSR_index";
1111
- function createHistory(opts) {
1112
- let location = opts.getLocation();
1113
- const subscribers = /* @__PURE__ */ new Set();
1114
- const notify = (action) => {
1115
- location = opts.getLocation();
1116
- subscribers.forEach((subscriber) => subscriber({
1117
- location,
1118
- action
1119
- }));
1120
- };
1121
- const handleIndexChange = (action) => {
1122
- if (opts.notifyOnIndexChange ?? true) notify(action);
1123
- else location = opts.getLocation();
1124
- };
1125
- const tryNavigation = async ({ task, navigateOpts, ...actionInfo }) => {
1126
- if (navigateOpts?.ignoreBlocker ?? false) {
1127
- task();
1128
- return;
1129
- }
1130
- const blockers = opts.getBlockers?.() ?? [];
1131
- const isPushOrReplace = actionInfo.type === "PUSH" || actionInfo.type === "REPLACE";
1132
- if (typeof document !== "undefined" && blockers.length && isPushOrReplace) for (const blocker of blockers) {
1133
- const nextLocation = parseHref(actionInfo.path, actionInfo.state);
1134
- if (await blocker.blockerFn({
1135
- currentLocation: location,
1136
- nextLocation,
1137
- action: actionInfo.type
1138
- })) {
1139
- opts.onBlocked?.();
1140
- return;
1141
- }
1142
- }
1143
- task();
1144
- };
1145
- return {
1146
- get location() {
1147
- return location;
1148
- },
1149
- get length() {
1150
- return opts.getLength();
1151
- },
1152
- subscribers,
1153
- subscribe: (cb) => {
1154
- subscribers.add(cb);
1155
- return () => {
1156
- subscribers.delete(cb);
1157
- };
1158
- },
1159
- push: (path, state, navigateOpts) => {
1160
- const currentIndex = location.state[stateIndexKey];
1161
- state = assignKeyAndIndex(currentIndex + 1, state);
1162
- tryNavigation({
1163
- task: () => {
1164
- opts.pushState(path, state);
1165
- notify({ type: "PUSH" });
1166
- },
1167
- navigateOpts,
1168
- type: "PUSH",
1169
- path,
1170
- state
1171
- });
1172
- },
1173
- replace: (path, state, navigateOpts) => {
1174
- const currentIndex = location.state[stateIndexKey];
1175
- state = assignKeyAndIndex(currentIndex, state);
1176
- tryNavigation({
1177
- task: () => {
1178
- opts.replaceState(path, state);
1179
- notify({ type: "REPLACE" });
1180
- },
1181
- navigateOpts,
1182
- type: "REPLACE",
1183
- path,
1184
- state
1185
- });
1186
- },
1187
- go: (index, navigateOpts) => {
1188
- tryNavigation({
1189
- task: () => {
1190
- opts.go(index);
1191
- handleIndexChange({
1192
- type: "GO",
1193
- index
1194
- });
1195
- },
1196
- navigateOpts,
1197
- type: "GO"
1198
- });
1199
- },
1200
- back: (navigateOpts) => {
1201
- tryNavigation({
1202
- task: () => {
1203
- opts.back(navigateOpts?.ignoreBlocker ?? false);
1204
- handleIndexChange({ type: "BACK" });
1205
- },
1206
- navigateOpts,
1207
- type: "BACK"
1208
- });
1209
- },
1210
- forward: (navigateOpts) => {
1211
- tryNavigation({
1212
- task: () => {
1213
- opts.forward(navigateOpts?.ignoreBlocker ?? false);
1214
- handleIndexChange({ type: "FORWARD" });
1215
- },
1216
- navigateOpts,
1217
- type: "FORWARD"
1218
- });
1219
- },
1220
- canGoBack: () => location.state[stateIndexKey] !== 0,
1221
- createHref: (str) => opts.createHref(str),
1222
- block: (blocker) => {
1223
- if (!opts.setBlockers) return () => {};
1224
- const blockers = opts.getBlockers?.() ?? [];
1225
- opts.setBlockers([...blockers, blocker]);
1226
- return () => {
1227
- const blockers = opts.getBlockers?.() ?? [];
1228
- opts.setBlockers?.(blockers.filter((b) => b !== blocker));
1229
- };
1230
- },
1231
- flush: () => opts.flush?.(),
1232
- destroy: () => opts.destroy?.(),
1233
- notify
1234
- };
1235
- }
1236
- function assignKeyAndIndex(index, state) {
1237
- if (!state) state = {};
1238
- const key = createRandomKey();
1239
- return {
1240
- ...state,
1241
- key,
1242
- __TSR_key: key,
1243
- [stateIndexKey]: index
1244
- };
1245
- }
1246
- /**
1247
- * Create an in-memory history implementation.
1248
- * Ideal for server rendering, tests, and non-DOM environments.
1249
- * @link https://tanstack.com/router/latest/docs/framework/react/guide/history-types
1250
- */
1251
- function createMemoryHistory(opts = { initialEntries: ["/"] }) {
1252
- const entries = opts.initialEntries;
1253
- let index = opts.initialIndex ? Math.min(Math.max(opts.initialIndex, 0), entries.length - 1) : entries.length - 1;
1254
- const states = entries.map((_entry, index) => assignKeyAndIndex(index, void 0));
1255
- const getLocation = () => parseHref(entries[index], states[index]);
1256
- let blockers = [];
1257
- const _getBlockers = () => blockers;
1258
- const _setBlockers = (newBlockers) => blockers = newBlockers;
1259
- return createHistory({
1260
- getLocation,
1261
- getLength: () => entries.length,
1262
- pushState: (path, state) => {
1263
- if (index < entries.length - 1) {
1264
- entries.splice(index + 1);
1265
- states.splice(index + 1);
1266
- }
1267
- states.push(state);
1268
- entries.push(path);
1269
- index = Math.max(entries.length - 1, 0);
1270
- },
1271
- replaceState: (path, state) => {
1272
- states[index] = state;
1273
- entries[index] = path;
1274
- },
1275
- back: () => {
1276
- index = Math.max(index - 1, 0);
1277
- },
1278
- forward: () => {
1279
- index = Math.min(index + 1, entries.length - 1);
1280
- },
1281
- go: (n) => {
1282
- index = Math.min(Math.max(index + n, 0), entries.length - 1);
1283
- },
1284
- createHref: (path) => path,
1285
- getBlockers: _getBlockers,
1286
- setBlockers: _setBlockers
1287
- });
1288
- }
1289
- /**
1290
- * Sanitize a path to prevent open redirect vulnerabilities.
1291
- * Removes control characters and collapses leading double slashes.
1292
- */
1293
- function sanitizePath(path) {
1294
- let sanitized = path.replace(/[\x00-\x1f\x7f]/g, "");
1295
- if (sanitized.startsWith("//")) sanitized = "/" + sanitized.replace(/^\/+/, "");
1296
- return sanitized;
1297
- }
1298
- function parseHref(href, state) {
1299
- const sanitizedHref = sanitizePath(href);
1300
- const hashIndex = sanitizedHref.indexOf("#");
1301
- const searchIndex = sanitizedHref.indexOf("?");
1302
- const addedKey = createRandomKey();
1303
- return {
1304
- href: sanitizedHref,
1305
- pathname: sanitizedHref.substring(0, hashIndex > 0 ? searchIndex > 0 ? Math.min(hashIndex, searchIndex) : hashIndex : searchIndex > 0 ? searchIndex : sanitizedHref.length),
1306
- hash: hashIndex > -1 ? sanitizedHref.substring(hashIndex) : "",
1307
- search: searchIndex > -1 ? sanitizedHref.slice(searchIndex, hashIndex === -1 ? void 0 : hashIndex) : "",
1308
- state: state || {
1309
- [stateIndexKey]: 0,
1310
- key: addedKey,
1311
- __TSR_key: addedKey
1312
- }
1313
- };
1314
- }
1315
- function createRandomKey() {
1316
- return (Math.random() + 1).toString(36).substring(7);
1317
- }
1318
- //#endregion
1319
- //#region ../../node_modules/.bun/@tanstack+router-core@1.168.3/node_modules/@tanstack/router-core/dist/esm/router.js
1320
- /**
1321
- * Compute whether path, href or hash changed between previous and current
1322
- * resolved locations.
1323
- */
1324
- function getLocationChangeInfo(location, resolvedLocation) {
1325
- const fromLocation = resolvedLocation;
1326
- const toLocation = location;
1327
- return {
1328
- fromLocation,
1329
- toLocation,
1330
- pathChanged: fromLocation?.pathname !== toLocation.pathname,
1331
- hrefChanged: fromLocation?.href !== toLocation.href,
1332
- hashChanged: fromLocation?.hash !== toLocation.hash
1333
- };
1334
- }
1335
- /**
1336
- * Core, framework-agnostic router engine that powers TanStack Router.
1337
- *
1338
- * Provides navigation, matching, loading, preloading, caching and event APIs
1339
- * used by framework adapters (React/Solid). Prefer framework helpers like
1340
- * `createRouter` in app code.
1341
- *
1342
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/RouterType
1343
- */
1344
- var RouterCore = class {
1345
- /**
1346
- * @deprecated Use the `createRouter` function instead
1347
- */
1348
- constructor(options, getStoreConfig) {
1349
- this.tempLocationKey = `${Math.round(Math.random() * 1e7)}`;
1350
- this.resetNextScroll = true;
1351
- this.shouldViewTransition = void 0;
1352
- this.isViewTransitionTypesSupported = void 0;
1353
- this.subscribers = /* @__PURE__ */ new Set();
1354
- this.isScrollRestoring = false;
1355
- this.isScrollRestorationSetup = false;
1356
- this.startTransition = (fn) => fn();
1357
- this.update = (newOptions) => {
1358
- const prevOptions = this.options;
1359
- const prevBasepath = this.basepath ?? prevOptions?.basepath ?? "/";
1360
- const basepathWasUnset = this.basepath === void 0;
1361
- const prevRewriteOption = prevOptions?.rewrite;
1362
- this.options = {
1363
- ...prevOptions,
1364
- ...newOptions
1365
- };
1366
- this.isServer = this.options.isServer ?? typeof document === "undefined";
1367
- this.protocolAllowlist = new Set(this.options.protocolAllowlist);
1368
- if (this.options.pathParamsAllowedCharacters) this.pathParamsDecoder = compileDecodeCharMap(this.options.pathParamsAllowedCharacters);
1369
- if (!this.history || this.options.history && this.options.history !== this.history) if (!this.options.history) {} else this.history = this.options.history;
1370
- this.origin = this.options.origin;
1371
- if (!this.origin) this.origin = "http://localhost";
1372
- if (this.history) this.updateLatestLocation();
1373
- if (this.options.routeTree !== this.routeTree) {
1374
- this.routeTree = this.options.routeTree;
1375
- let processRouteTreeResult;
1376
- if (globalThis.__TSR_CACHE__ && globalThis.__TSR_CACHE__.routeTree === this.routeTree) {
1377
- const cached = globalThis.__TSR_CACHE__;
1378
- this.resolvePathCache = cached.resolvePathCache;
1379
- processRouteTreeResult = cached.processRouteTreeResult;
1380
- } else {
1381
- this.resolvePathCache = createLRUCache(1e3);
1382
- processRouteTreeResult = this.buildRouteTree();
1383
- if (globalThis.__TSR_CACHE__ === void 0) globalThis.__TSR_CACHE__ = {
1384
- routeTree: this.routeTree,
1385
- processRouteTreeResult,
1386
- resolvePathCache: this.resolvePathCache
1387
- };
1388
- }
1389
- this.setRoutes(processRouteTreeResult);
1390
- }
1391
- if (!this.stores && this.latestLocation) {
1392
- const config = this.getStoreConfig(this);
1393
- this.batch = config.batch;
1394
- this.stores = createRouterStores(getInitialRouterState(this.latestLocation), config);
1395
- }
1396
- let needsLocationUpdate = false;
1397
- const nextBasepath = this.options.basepath ?? "/";
1398
- const nextRewriteOption = this.options.rewrite;
1399
- if (basepathWasUnset || prevBasepath !== nextBasepath || prevRewriteOption !== nextRewriteOption) {
1400
- this.basepath = nextBasepath;
1401
- const rewrites = [];
1402
- const trimmed = trimPath(nextBasepath);
1403
- if (trimmed && trimmed !== "/") rewrites.push(rewriteBasepath({ basepath: nextBasepath }));
1404
- if (nextRewriteOption) rewrites.push(nextRewriteOption);
1405
- this.rewrite = rewrites.length === 0 ? void 0 : rewrites.length === 1 ? rewrites[0] : composeRewrites(rewrites);
1406
- if (this.history) this.updateLatestLocation();
1407
- needsLocationUpdate = true;
1408
- }
1409
- if (needsLocationUpdate && this.stores) this.stores.location.setState(() => this.latestLocation);
1410
- if (typeof window !== "undefined" && "CSS" in window && typeof window.CSS?.supports === "function") this.isViewTransitionTypesSupported = window.CSS.supports("selector(:active-view-transition-type(a)");
1411
- };
1412
- this.updateLatestLocation = () => {
1413
- this.latestLocation = this.parseLocation(this.history.location, this.latestLocation);
1414
- };
1415
- this.buildRouteTree = () => {
1416
- const result = processRouteTree(this.routeTree, this.options.caseSensitive, (route, i) => {
1417
- route.init({ originalIndex: i });
1418
- });
1419
- if (this.options.routeMasks) processRouteMasks(this.options.routeMasks, result.processedTree);
1420
- return result;
1421
- };
1422
- this.subscribe = (eventType, fn) => {
1423
- const listener = {
1424
- eventType,
1425
- fn
1426
- };
1427
- this.subscribers.add(listener);
1428
- return () => {
1429
- this.subscribers.delete(listener);
1430
- };
1431
- };
1432
- this.emit = (routerEvent) => {
1433
- this.subscribers.forEach((listener) => {
1434
- if (listener.eventType === routerEvent.type) listener.fn(routerEvent);
1435
- });
1436
- };
1437
- this.parseLocation = (locationToParse, previousLocation) => {
1438
- const parse = ({ pathname, search, hash, href, state }) => {
1439
- if (!this.rewrite && !/[ \x00-\x1f\x7f\u0080-\uffff]/.test(pathname)) {
1440
- const parsedSearch = this.options.parseSearch(search);
1441
- const searchStr = this.options.stringifySearch(parsedSearch);
1442
- return {
1443
- href: pathname + searchStr + hash,
1444
- publicHref: href,
1445
- pathname: decodePath(pathname).path,
1446
- external: false,
1447
- searchStr,
1448
- search: nullReplaceEqualDeep(previousLocation?.search, parsedSearch),
1449
- hash: decodePath(hash.slice(1)).path,
1450
- state: replaceEqualDeep(previousLocation?.state, state)
1451
- };
1452
- }
1453
- const fullUrl = new URL(href, this.origin);
1454
- const url = executeRewriteInput(this.rewrite, fullUrl);
1455
- const parsedSearch = this.options.parseSearch(url.search);
1456
- const searchStr = this.options.stringifySearch(parsedSearch);
1457
- url.search = searchStr;
1458
- return {
1459
- href: url.href.replace(url.origin, ""),
1460
- publicHref: href,
1461
- pathname: decodePath(url.pathname).path,
1462
- external: !!this.rewrite && url.origin !== this.origin,
1463
- searchStr,
1464
- search: nullReplaceEqualDeep(previousLocation?.search, parsedSearch),
1465
- hash: decodePath(url.hash.slice(1)).path,
1466
- state: replaceEqualDeep(previousLocation?.state, state)
1467
- };
1468
- };
1469
- const location = parse(locationToParse);
1470
- const { __tempLocation, __tempKey } = location.state;
1471
- if (__tempLocation && (!__tempKey || __tempKey === this.tempLocationKey)) {
1472
- const parsedTempLocation = parse(__tempLocation);
1473
- parsedTempLocation.state.key = location.state.key;
1474
- parsedTempLocation.state.__TSR_key = location.state.__TSR_key;
1475
- delete parsedTempLocation.state.__tempLocation;
1476
- return {
1477
- ...parsedTempLocation,
1478
- maskedLocation: location
1479
- };
1480
- }
1481
- return location;
1482
- };
1483
- this.resolvePathWithBase = (from, path) => {
1484
- return resolvePath({
1485
- base: from,
1486
- to: cleanPath(path),
1487
- trailingSlash: this.options.trailingSlash,
1488
- cache: this.resolvePathCache
1489
- });
1490
- };
1491
- this.matchRoutes = (pathnameOrNext, locationSearchOrOpts, opts) => {
1492
- if (typeof pathnameOrNext === "string") return this.matchRoutesInternal({
1493
- pathname: pathnameOrNext,
1494
- search: locationSearchOrOpts
1495
- }, opts);
1496
- return this.matchRoutesInternal(pathnameOrNext, locationSearchOrOpts);
1497
- };
1498
- this.getMatchedRoutes = (pathname) => {
1499
- return getMatchedRoutes({
1500
- pathname,
1501
- routesById: this.routesById,
1502
- processedTree: this.processedTree
1503
- });
1504
- };
1505
- this.cancelMatch = (id) => {
1506
- const match = this.getMatch(id);
1507
- if (!match) return;
1508
- match.abortController.abort();
1509
- clearTimeout(match._nonReactive.pendingTimeout);
1510
- match._nonReactive.pendingTimeout = void 0;
1511
- };
1512
- this.cancelMatches = () => {
1513
- this.stores.pendingMatchesId.state.forEach((matchId) => {
1514
- this.cancelMatch(matchId);
1515
- });
1516
- this.stores.matchesId.state.forEach((matchId) => {
1517
- if (this.stores.pendingMatchStoresById.has(matchId)) return;
1518
- const match = this.stores.activeMatchStoresById.get(matchId)?.state;
1519
- if (!match) return;
1520
- if (match.status === "pending" || match.isFetching === "loader") this.cancelMatch(matchId);
1521
- });
1522
- };
1523
- this.buildLocation = (opts) => {
1524
- const build = (dest = {}) => {
1525
- const currentLocation = dest._fromLocation || this.pendingBuiltLocation || this.latestLocation;
1526
- const lightweightResult = this.matchRoutesLightweight(currentLocation);
1527
- if (dest.from && false);
1528
- const defaultedFromPath = dest.unsafeRelative === "path" ? currentLocation.pathname : dest.from ?? lightweightResult.fullPath;
1529
- const fromPath = this.resolvePathWithBase(defaultedFromPath, ".");
1530
- const fromSearch = lightweightResult.search;
1531
- const fromParams = Object.assign(Object.create(null), lightweightResult.params);
1532
- const nextTo = dest.to ? this.resolvePathWithBase(fromPath, `${dest.to}`) : this.resolvePathWithBase(fromPath, ".");
1533
- const nextParams = dest.params === false || dest.params === null ? Object.create(null) : (dest.params ?? true) === true ? fromParams : Object.assign(fromParams, functionalUpdate(dest.params, fromParams));
1534
- const destMatchResult = this.getMatchedRoutes(nextTo);
1535
- let destRoutes = destMatchResult.matchedRoutes;
1536
- if ((!destMatchResult.foundRoute || destMatchResult.foundRoute.path !== "/" && destMatchResult.routeParams["**"]) && this.options.notFoundRoute) destRoutes = [...destRoutes, this.options.notFoundRoute];
1537
- if (Object.keys(nextParams).length > 0) for (const route of destRoutes) {
1538
- const fn = route.options.params?.stringify ?? route.options.stringifyParams;
1539
- if (fn) try {
1540
- Object.assign(nextParams, fn(nextParams));
1541
- } catch {}
1542
- }
1543
- const nextPathname = opts.leaveParams ? nextTo : decodePath(interpolatePath({
1544
- path: nextTo,
1545
- params: nextParams,
1546
- decoder: this.pathParamsDecoder,
1547
- server: this.isServer
1548
- }).interpolatedPath).path;
1549
- let nextSearch = fromSearch;
1550
- if (opts._includeValidateSearch && this.options.search?.strict) {
1551
- const validatedSearch = {};
1552
- destRoutes.forEach((route) => {
1553
- if (route.options.validateSearch) try {
1554
- Object.assign(validatedSearch, validateSearch(route.options.validateSearch, {
1555
- ...validatedSearch,
1556
- ...nextSearch
1557
- }));
1558
- } catch {}
1559
- });
1560
- nextSearch = validatedSearch;
1561
- }
1562
- nextSearch = applySearchMiddleware({
1563
- search: nextSearch,
1564
- dest,
1565
- destRoutes,
1566
- _includeValidateSearch: opts._includeValidateSearch
1567
- });
1568
- nextSearch = nullReplaceEqualDeep(fromSearch, nextSearch);
1569
- const searchStr = this.options.stringifySearch(nextSearch);
1570
- const hash = dest.hash === true ? currentLocation.hash : dest.hash ? functionalUpdate(dest.hash, currentLocation.hash) : void 0;
1571
- const hashStr = hash ? `#${hash}` : "";
1572
- let nextState = dest.state === true ? currentLocation.state : dest.state ? functionalUpdate(dest.state, currentLocation.state) : {};
1573
- nextState = replaceEqualDeep(currentLocation.state, nextState);
1574
- const fullPath = `${nextPathname}${searchStr}${hashStr}`;
1575
- let href;
1576
- let publicHref;
1577
- let external = false;
1578
- if (this.rewrite) {
1579
- const url = new URL(fullPath, this.origin);
1580
- const rewrittenUrl = executeRewriteOutput(this.rewrite, url);
1581
- href = url.href.replace(url.origin, "");
1582
- if (rewrittenUrl.origin !== this.origin) {
1583
- publicHref = rewrittenUrl.href;
1584
- external = true;
1585
- } else publicHref = rewrittenUrl.pathname + rewrittenUrl.search + rewrittenUrl.hash;
1586
- } else {
1587
- href = encodePathLikeUrl(fullPath);
1588
- publicHref = href;
1589
- }
1590
- return {
1591
- publicHref,
1592
- href,
1593
- pathname: nextPathname,
1594
- search: nextSearch,
1595
- searchStr,
1596
- state: nextState,
1597
- hash: hash ?? "",
1598
- external,
1599
- unmaskOnReload: dest.unmaskOnReload
1600
- };
1601
- };
1602
- const buildWithMatches = (dest = {}, maskedDest) => {
1603
- const next = build(dest);
1604
- let maskedNext = maskedDest ? build(maskedDest) : void 0;
1605
- if (!maskedNext) {
1606
- const params = Object.create(null);
1607
- if (this.options.routeMasks) {
1608
- const match = findFlatMatch(next.pathname, this.processedTree);
1609
- if (match) {
1610
- Object.assign(params, match.rawParams);
1611
- const { from: _from, params: maskParams, ...maskProps } = match.route;
1612
- const nextParams = maskParams === false || maskParams === null ? Object.create(null) : (maskParams ?? true) === true ? params : Object.assign(params, functionalUpdate(maskParams, params));
1613
- maskedDest = {
1614
- from: opts.from,
1615
- ...maskProps,
1616
- params: nextParams
1617
- };
1618
- maskedNext = build(maskedDest);
1619
- }
1620
- }
1621
- }
1622
- if (maskedNext) next.maskedLocation = maskedNext;
1623
- return next;
1624
- };
1625
- if (opts.mask) return buildWithMatches(opts, {
1626
- from: opts.from,
1627
- ...opts.mask
1628
- });
1629
- return buildWithMatches(opts);
1630
- };
1631
- this.commitLocation = async ({ viewTransition, ignoreBlocker, ...next }) => {
1632
- const isSameState = () => {
1633
- const ignoredProps = [
1634
- "key",
1635
- "__TSR_key",
1636
- "__TSR_index",
1637
- "__hashScrollIntoViewOptions"
1638
- ];
1639
- ignoredProps.forEach((prop) => {
1640
- next.state[prop] = this.latestLocation.state[prop];
1641
- });
1642
- const isEqual = deepEqual(next.state, this.latestLocation.state);
1643
- ignoredProps.forEach((prop) => {
1644
- delete next.state[prop];
1645
- });
1646
- return isEqual;
1647
- };
1648
- const isSameUrl = trimPathRight(this.latestLocation.href) === trimPathRight(next.href);
1649
- let previousCommitPromise = this.commitLocationPromise;
1650
- this.commitLocationPromise = createControlledPromise(() => {
1651
- previousCommitPromise?.resolve();
1652
- previousCommitPromise = void 0;
1653
- });
1654
- if (isSameUrl && isSameState()) this.load();
1655
- else {
1656
- let { maskedLocation, hashScrollIntoView, ...nextHistory } = next;
1657
- if (maskedLocation) {
1658
- nextHistory = {
1659
- ...maskedLocation,
1660
- state: {
1661
- ...maskedLocation.state,
1662
- __tempKey: void 0,
1663
- __tempLocation: {
1664
- ...nextHistory,
1665
- search: nextHistory.searchStr,
1666
- state: {
1667
- ...nextHistory.state,
1668
- __tempKey: void 0,
1669
- __tempLocation: void 0,
1670
- __TSR_key: void 0,
1671
- key: void 0
1672
- }
1673
- }
1674
- }
1675
- };
1676
- if (nextHistory.unmaskOnReload ?? this.options.unmaskOnReload ?? false) nextHistory.state.__tempKey = this.tempLocationKey;
1677
- }
1678
- nextHistory.state.__hashScrollIntoViewOptions = hashScrollIntoView ?? this.options.defaultHashScrollIntoView ?? true;
1679
- this.shouldViewTransition = viewTransition;
1680
- this.history[next.replace ? "replace" : "push"](nextHistory.publicHref, nextHistory.state, { ignoreBlocker });
1681
- }
1682
- this.resetNextScroll = next.resetScroll ?? true;
1683
- if (!this.history.subscribers.size) this.load();
1684
- return this.commitLocationPromise;
1685
- };
1686
- this.buildAndCommitLocation = ({ replace, resetScroll, hashScrollIntoView, viewTransition, ignoreBlocker, href, ...rest } = {}) => {
1687
- if (href) {
1688
- const currentIndex = this.history.location.state.__TSR_index;
1689
- const parsed = parseHref(href, { __TSR_index: replace ? currentIndex : currentIndex + 1 });
1690
- const hrefUrl = new URL(parsed.pathname, this.origin);
1691
- rest.to = executeRewriteInput(this.rewrite, hrefUrl).pathname;
1692
- rest.search = this.options.parseSearch(parsed.search);
1693
- rest.hash = parsed.hash.slice(1);
1694
- }
1695
- const location = this.buildLocation({
1696
- ...rest,
1697
- _includeValidateSearch: true
1698
- });
1699
- this.pendingBuiltLocation = location;
1700
- const commitPromise = this.commitLocation({
1701
- ...location,
1702
- viewTransition,
1703
- replace,
1704
- resetScroll,
1705
- hashScrollIntoView,
1706
- ignoreBlocker
1707
- });
1708
- Promise.resolve().then(() => {
1709
- if (this.pendingBuiltLocation === location) this.pendingBuiltLocation = void 0;
1710
- });
1711
- return commitPromise;
1712
- };
1713
- this.navigate = async ({ to, reloadDocument, href, publicHref, ...rest }) => {
1714
- let hrefIsUrl = false;
1715
- if (href) try {
1716
- new URL(`${href}`);
1717
- hrefIsUrl = true;
1718
- } catch {}
1719
- if (hrefIsUrl && !reloadDocument) reloadDocument = true;
1720
- if (reloadDocument) {
1721
- if (to !== void 0 || !href) {
1722
- const location = this.buildLocation({
1723
- to,
1724
- ...rest
1725
- });
1726
- href = href ?? location.publicHref;
1727
- publicHref = publicHref ?? location.publicHref;
1728
- }
1729
- const reloadHref = !hrefIsUrl && publicHref ? publicHref : href;
1730
- if (isDangerousProtocol(reloadHref, this.protocolAllowlist)) return Promise.resolve();
1731
- if (!rest.ignoreBlocker) {
1732
- const blockers = this.history.getBlockers?.() ?? [];
1733
- for (const blocker of blockers) if (blocker?.blockerFn) {
1734
- if (await blocker.blockerFn({
1735
- currentLocation: this.latestLocation,
1736
- nextLocation: this.latestLocation,
1737
- action: "PUSH"
1738
- })) return Promise.resolve();
1739
- }
1740
- }
1741
- if (rest.replace) window.location.replace(reloadHref);
1742
- else window.location.href = reloadHref;
1743
- return Promise.resolve();
1744
- }
1745
- return this.buildAndCommitLocation({
1746
- ...rest,
1747
- href,
1748
- to,
1749
- _isNavigate: true
1750
- });
1751
- };
1752
- this.beforeLoad = () => {
1753
- this.cancelMatches();
1754
- this.updateLatestLocation();
1755
- {
1756
- const nextLocation = this.buildLocation({
1757
- to: this.latestLocation.pathname,
1758
- search: true,
1759
- params: true,
1760
- hash: true,
1761
- state: true,
1762
- _includeValidateSearch: true
1763
- });
1764
- if (this.latestLocation.publicHref !== nextLocation.publicHref) {
1765
- const href = this.getParsedLocationHref(nextLocation);
1766
- if (nextLocation.external) throw redirect({ href });
1767
- else throw redirect({
1768
- href,
1769
- _builtLocation: nextLocation
1770
- });
1771
- }
1772
- }
1773
- const pendingMatches = this.matchRoutes(this.latestLocation);
1774
- const nextCachedMatches = this.stores.cachedMatchesSnapshot.state.filter((d) => !pendingMatches.some((e) => e.id === d.id));
1775
- this.batch(() => {
1776
- this.stores.status.setState(() => "pending");
1777
- this.stores.statusCode.setState(() => 200);
1778
- this.stores.isLoading.setState(() => true);
1779
- this.stores.location.setState(() => this.latestLocation);
1780
- this.stores.setPendingMatches(pendingMatches);
1781
- this.stores.setCachedMatches(nextCachedMatches);
1782
- });
1783
- };
1784
- this.load = async (opts) => {
1785
- let redirect;
1786
- let notFound;
1787
- let loadPromise;
1788
- const previousLocation = this.stores.resolvedLocation.state ?? this.stores.location.state;
1789
- loadPromise = new Promise((resolve) => {
1790
- this.startTransition(async () => {
1791
- try {
1792
- this.beforeLoad();
1793
- const next = this.latestLocation;
1794
- const prevLocation = this.stores.resolvedLocation.state;
1795
- const locationChangeInfo = getLocationChangeInfo(next, prevLocation);
1796
- if (!this.stores.redirect.state) this.emit({
1797
- type: "onBeforeNavigate",
1798
- ...locationChangeInfo
1799
- });
1800
- this.emit({
1801
- type: "onBeforeLoad",
1802
- ...locationChangeInfo
1803
- });
1804
- await loadMatches({
1805
- router: this,
1806
- sync: opts?.sync,
1807
- forceStaleReload: previousLocation.href === next.href,
1808
- matches: this.stores.pendingMatchesSnapshot.state,
1809
- location: next,
1810
- updateMatch: this.updateMatch,
1811
- onReady: async () => {
1812
- this.startTransition(() => {
1813
- this.startViewTransition(async () => {
1814
- let exitingMatches = null;
1815
- let hookExitingMatches = null;
1816
- let hookEnteringMatches = null;
1817
- let hookStayingMatches = null;
1818
- this.batch(() => {
1819
- const pendingMatches = this.stores.pendingMatchesSnapshot.state;
1820
- const mountPending = pendingMatches.length;
1821
- const currentMatches = this.stores.activeMatchesSnapshot.state;
1822
- exitingMatches = mountPending ? currentMatches.filter((match) => !this.stores.pendingMatchStoresById.has(match.id)) : null;
1823
- const pendingRouteIds = /* @__PURE__ */ new Set();
1824
- for (const s of this.stores.pendingMatchStoresById.values()) if (s.routeId) pendingRouteIds.add(s.routeId);
1825
- const activeRouteIds = /* @__PURE__ */ new Set();
1826
- for (const s of this.stores.activeMatchStoresById.values()) if (s.routeId) activeRouteIds.add(s.routeId);
1827
- hookExitingMatches = mountPending ? currentMatches.filter((match) => !pendingRouteIds.has(match.routeId)) : null;
1828
- hookEnteringMatches = mountPending ? pendingMatches.filter((match) => !activeRouteIds.has(match.routeId)) : null;
1829
- hookStayingMatches = mountPending ? pendingMatches.filter((match) => activeRouteIds.has(match.routeId)) : currentMatches;
1830
- this.stores.isLoading.setState(() => false);
1831
- this.stores.loadedAt.setState(() => Date.now());
1832
- /**
1833
- * When committing new matches, cache any exiting matches that are still usable.
1834
- * Routes that resolved with `status: 'error'` or `status: 'notFound'` are
1835
- * deliberately excluded from `cachedMatches` so that subsequent invalidations
1836
- * or reloads re-run their loaders instead of reusing the failed/not-found data.
1837
- */
1838
- if (mountPending) {
1839
- this.stores.setActiveMatches(pendingMatches);
1840
- this.stores.setPendingMatches([]);
1841
- this.stores.setCachedMatches([...this.stores.cachedMatchesSnapshot.state, ...exitingMatches.filter((d) => d.status !== "error" && d.status !== "notFound" && d.status !== "redirected")]);
1842
- this.clearExpiredCache();
1843
- }
1844
- });
1845
- for (const [matches, hook] of [
1846
- [hookExitingMatches, "onLeave"],
1847
- [hookEnteringMatches, "onEnter"],
1848
- [hookStayingMatches, "onStay"]
1849
- ]) {
1850
- if (!matches) continue;
1851
- for (const match of matches) this.looseRoutesById[match.routeId].options[hook]?.(match);
1852
- }
1853
- });
1854
- });
1855
- }
1856
- });
1857
- } catch (err) {
1858
- if (isRedirect(err)) redirect = err;
1859
- else if (isNotFound(err)) notFound = err;
1860
- const nextStatusCode = redirect ? redirect.status : notFound ? 404 : this.stores.activeMatchesSnapshot.state.some((d) => d.status === "error") ? 500 : 200;
1861
- this.batch(() => {
1862
- this.stores.statusCode.setState(() => nextStatusCode);
1863
- this.stores.redirect.setState(() => redirect);
1864
- });
1865
- }
1866
- if (this.latestLoadPromise === loadPromise) {
1867
- this.commitLocationPromise?.resolve();
1868
- this.latestLoadPromise = void 0;
1869
- this.commitLocationPromise = void 0;
1870
- }
1871
- resolve();
1872
- });
1873
- });
1874
- this.latestLoadPromise = loadPromise;
1875
- await loadPromise;
1876
- while (this.latestLoadPromise && loadPromise !== this.latestLoadPromise) await this.latestLoadPromise;
1877
- let newStatusCode = void 0;
1878
- if (this.hasNotFoundMatch()) newStatusCode = 404;
1879
- else if (this.stores.activeMatchesSnapshot.state.some((d) => d.status === "error")) newStatusCode = 500;
1880
- if (newStatusCode !== void 0) this.stores.statusCode.setState(() => newStatusCode);
1881
- };
1882
- this.startViewTransition = (fn) => {
1883
- const shouldViewTransition = this.shouldViewTransition ?? this.options.defaultViewTransition;
1884
- this.shouldViewTransition = void 0;
1885
- if (shouldViewTransition && typeof document !== "undefined" && "startViewTransition" in document && typeof document.startViewTransition === "function") {
1886
- let startViewTransitionParams;
1887
- if (typeof shouldViewTransition === "object" && this.isViewTransitionTypesSupported) {
1888
- const next = this.latestLocation;
1889
- const prevLocation = this.stores.resolvedLocation.state;
1890
- const resolvedViewTransitionTypes = typeof shouldViewTransition.types === "function" ? shouldViewTransition.types(getLocationChangeInfo(next, prevLocation)) : shouldViewTransition.types;
1891
- if (resolvedViewTransitionTypes === false) {
1892
- fn();
1893
- return;
1894
- }
1895
- startViewTransitionParams = {
1896
- update: fn,
1897
- types: resolvedViewTransitionTypes
1898
- };
1899
- } else startViewTransitionParams = fn;
1900
- document.startViewTransition(startViewTransitionParams);
1901
- } else fn();
1902
- };
1903
- this.updateMatch = (id, updater) => {
1904
- this.startTransition(() => {
1905
- const pendingMatch = this.stores.pendingMatchStoresById.get(id);
1906
- if (pendingMatch) {
1907
- pendingMatch.setState(updater);
1908
- return;
1909
- }
1910
- const activeMatch = this.stores.activeMatchStoresById.get(id);
1911
- if (activeMatch) {
1912
- activeMatch.setState(updater);
1913
- return;
1914
- }
1915
- const cachedMatch = this.stores.cachedMatchStoresById.get(id);
1916
- if (cachedMatch) {
1917
- const next = updater(cachedMatch.state);
1918
- if (next.status === "redirected") {
1919
- if (this.stores.cachedMatchStoresById.delete(id)) this.stores.cachedMatchesId.setState((prev) => prev.filter((matchId) => matchId !== id));
1920
- } else cachedMatch.setState(() => next);
1921
- }
1922
- });
1923
- };
1924
- this.getMatch = (matchId) => {
1925
- return this.stores.cachedMatchStoresById.get(matchId)?.state ?? this.stores.pendingMatchStoresById.get(matchId)?.state ?? this.stores.activeMatchStoresById.get(matchId)?.state;
1926
- };
1927
- this.invalidate = (opts) => {
1928
- const invalidate = (d) => {
1929
- if (opts?.filter?.(d) ?? true) return {
1930
- ...d,
1931
- invalid: true,
1932
- ...opts?.forcePending || d.status === "error" || d.status === "notFound" ? {
1933
- status: "pending",
1934
- error: void 0
1935
- } : void 0
1936
- };
1937
- return d;
1938
- };
1939
- this.batch(() => {
1940
- this.stores.setActiveMatches(this.stores.activeMatchesSnapshot.state.map(invalidate));
1941
- this.stores.setCachedMatches(this.stores.cachedMatchesSnapshot.state.map(invalidate));
1942
- this.stores.setPendingMatches(this.stores.pendingMatchesSnapshot.state.map(invalidate));
1943
- });
1944
- this.shouldViewTransition = false;
1945
- return this.load({ sync: opts?.sync });
1946
- };
1947
- this.getParsedLocationHref = (location) => {
1948
- return location.publicHref || "/";
1949
- };
1950
- this.resolveRedirect = (redirect) => {
1951
- const locationHeader = redirect.headers.get("Location");
1952
- if (!redirect.options.href || redirect.options._builtLocation) {
1953
- const location = redirect.options._builtLocation ?? this.buildLocation(redirect.options);
1954
- const href = this.getParsedLocationHref(location);
1955
- redirect.options.href = href;
1956
- redirect.headers.set("Location", href);
1957
- } else if (locationHeader) try {
1958
- const url = new URL(locationHeader);
1959
- if (this.origin && url.origin === this.origin) {
1960
- const href = url.pathname + url.search + url.hash;
1961
- redirect.options.href = href;
1962
- redirect.headers.set("Location", href);
1963
- }
1964
- } catch {}
1965
- if (redirect.options.href && !redirect.options._builtLocation && isDangerousProtocol(redirect.options.href, this.protocolAllowlist)) throw new Error("Redirect blocked: unsafe protocol");
1966
- if (!redirect.headers.get("Location")) redirect.headers.set("Location", redirect.options.href);
1967
- return redirect;
1968
- };
1969
- this.clearCache = (opts) => {
1970
- const filter = opts?.filter;
1971
- if (filter !== void 0) this.stores.setCachedMatches(this.stores.cachedMatchesSnapshot.state.filter((m) => !filter(m)));
1972
- else this.stores.setCachedMatches([]);
1973
- };
1974
- this.clearExpiredCache = () => {
1975
- const now = Date.now();
1976
- const filter = (d) => {
1977
- const route = this.looseRoutesById[d.routeId];
1978
- if (!route.options.loader) return true;
1979
- const gcTime = (d.preload ? route.options.preloadGcTime ?? this.options.defaultPreloadGcTime : route.options.gcTime ?? this.options.defaultGcTime) ?? 300 * 1e3;
1980
- if (d.status === "error") return true;
1981
- return now - d.updatedAt >= gcTime;
1982
- };
1983
- this.clearCache({ filter });
1984
- };
1985
- this.loadRouteChunk = loadRouteChunk;
1986
- this.preloadRoute = async (opts) => {
1987
- const next = opts._builtLocation ?? this.buildLocation(opts);
1988
- let matches = this.matchRoutes(next, {
1989
- throwOnError: true,
1990
- preload: true,
1991
- dest: opts
1992
- });
1993
- const activeMatchIds = new Set([...this.stores.matchesId.state, ...this.stores.pendingMatchesId.state]);
1994
- const loadedMatchIds = new Set([...activeMatchIds, ...this.stores.cachedMatchesId.state]);
1995
- const matchesToCache = matches.filter((match) => !loadedMatchIds.has(match.id));
1996
- if (matchesToCache.length) {
1997
- const cachedMatches = this.stores.cachedMatchesSnapshot.state;
1998
- this.stores.setCachedMatches([...cachedMatches, ...matchesToCache]);
1999
- }
2000
- try {
2001
- matches = await loadMatches({
2002
- router: this,
2003
- matches,
2004
- location: next,
2005
- preload: true,
2006
- updateMatch: (id, updater) => {
2007
- if (activeMatchIds.has(id)) matches = matches.map((d) => d.id === id ? updater(d) : d);
2008
- else this.updateMatch(id, updater);
2009
- }
2010
- });
2011
- return matches;
2012
- } catch (err) {
2013
- if (isRedirect(err)) {
2014
- if (err.options.reloadDocument) return;
2015
- return await this.preloadRoute({
2016
- ...err.options,
2017
- _fromLocation: next
2018
- });
2019
- }
2020
- if (!isNotFound(err)) console.error(err);
2021
- return;
2022
- }
2023
- };
2024
- this.matchRoute = (location, opts) => {
2025
- const matchLocation = {
2026
- ...location,
2027
- to: location.to ? this.resolvePathWithBase(location.from || "", location.to) : void 0,
2028
- params: location.params || {},
2029
- leaveParams: true
2030
- };
2031
- const next = this.buildLocation(matchLocation);
2032
- if (opts?.pending && this.stores.status.state !== "pending") return false;
2033
- const baseLocation = (opts?.pending === void 0 ? !this.stores.isLoading.state : opts.pending) ? this.latestLocation : this.stores.resolvedLocation.state || this.stores.location.state;
2034
- const match = findSingleMatch(next.pathname, opts?.caseSensitive ?? false, opts?.fuzzy ?? false, baseLocation.pathname, this.processedTree);
2035
- if (!match) return false;
2036
- if (location.params) {
2037
- if (!deepEqual(match.rawParams, location.params, { partial: true })) return false;
2038
- }
2039
- if (opts?.includeSearch ?? true) return deepEqual(baseLocation.search, next.search, { partial: true }) ? match.rawParams : false;
2040
- return match.rawParams;
2041
- };
2042
- this.hasNotFoundMatch = () => {
2043
- return this.stores.activeMatchesSnapshot.state.some((d) => d.status === "notFound" || d.globalNotFound);
2044
- };
2045
- this.getStoreConfig = getStoreConfig;
2046
- this.update({
2047
- defaultPreloadDelay: 50,
2048
- defaultPendingMs: 1e3,
2049
- defaultPendingMinMs: 500,
2050
- context: void 0,
2051
- ...options,
2052
- caseSensitive: options.caseSensitive ?? false,
2053
- notFoundMode: options.notFoundMode ?? "fuzzy",
2054
- stringifySearch: options.stringifySearch ?? defaultStringifySearch,
2055
- parseSearch: options.parseSearch ?? defaultParseSearch,
2056
- protocolAllowlist: options.protocolAllowlist ?? DEFAULT_PROTOCOL_ALLOWLIST
2057
- });
2058
- if (typeof document !== "undefined") self.__TSR_ROUTER__ = this;
2059
- }
2060
- isShell() {
2061
- return !!this.options.isShell;
2062
- }
2063
- isPrerendering() {
2064
- return !!this.options.isPrerendering;
2065
- }
2066
- get state() {
2067
- return this.stores.__store.state;
2068
- }
2069
- setRoutes({ routesById, routesByPath, processedTree }) {
2070
- this.routesById = routesById;
2071
- this.routesByPath = routesByPath;
2072
- this.processedTree = processedTree;
2073
- const notFoundRoute = this.options.notFoundRoute;
2074
- if (notFoundRoute) {
2075
- notFoundRoute.init({ originalIndex: 99999999999 });
2076
- this.routesById[notFoundRoute.id] = notFoundRoute;
2077
- }
2078
- }
2079
- get looseRoutesById() {
2080
- return this.routesById;
2081
- }
2082
- getParentContext(parentMatch) {
2083
- return !parentMatch?.id ? this.options.context ?? void 0 : parentMatch.context ?? this.options.context ?? void 0;
2084
- }
2085
- matchRoutesInternal(next, opts) {
2086
- const matchedRoutesResult = this.getMatchedRoutes(next.pathname);
2087
- const { foundRoute, routeParams, parsedParams } = matchedRoutesResult;
2088
- let { matchedRoutes } = matchedRoutesResult;
2089
- let isGlobalNotFound = false;
2090
- if (foundRoute ? foundRoute.path !== "/" && routeParams["**"] : trimPathRight(next.pathname)) if (this.options.notFoundRoute) matchedRoutes = [...matchedRoutes, this.options.notFoundRoute];
2091
- else isGlobalNotFound = true;
2092
- const globalNotFoundRouteId = isGlobalNotFound ? findGlobalNotFoundRouteId(this.options.notFoundMode, matchedRoutes) : void 0;
2093
- const matches = new Array(matchedRoutes.length);
2094
- const previousActiveMatchesByRouteId = /* @__PURE__ */ new Map();
2095
- for (const store of this.stores.activeMatchStoresById.values()) if (store.routeId) previousActiveMatchesByRouteId.set(store.routeId, store.state);
2096
- for (let index = 0; index < matchedRoutes.length; index++) {
2097
- const route = matchedRoutes[index];
2098
- const parentMatch = matches[index - 1];
2099
- let preMatchSearch;
2100
- let strictMatchSearch;
2101
- let searchError;
2102
- {
2103
- const parentSearch = parentMatch?.search ?? next.search;
2104
- const parentStrictSearch = parentMatch?._strictSearch ?? void 0;
2105
- try {
2106
- const strictSearch = validateSearch(route.options.validateSearch, { ...parentSearch }) ?? void 0;
2107
- preMatchSearch = {
2108
- ...parentSearch,
2109
- ...strictSearch
2110
- };
2111
- strictMatchSearch = {
2112
- ...parentStrictSearch,
2113
- ...strictSearch
2114
- };
2115
- searchError = void 0;
2116
- } catch (err) {
2117
- let searchParamError = err;
2118
- if (!(err instanceof SearchParamError)) searchParamError = new SearchParamError(err.message, { cause: err });
2119
- if (opts?.throwOnError) throw searchParamError;
2120
- preMatchSearch = parentSearch;
2121
- strictMatchSearch = {};
2122
- searchError = searchParamError;
2123
- }
2124
- }
2125
- const loaderDeps = route.options.loaderDeps?.({ search: preMatchSearch }) ?? "";
2126
- const loaderDepsHash = loaderDeps ? JSON.stringify(loaderDeps) : "";
2127
- const { interpolatedPath, usedParams } = interpolatePath({
2128
- path: route.fullPath,
2129
- params: routeParams,
2130
- decoder: this.pathParamsDecoder,
2131
- server: this.isServer
2132
- });
2133
- const matchId = route.id + interpolatedPath + loaderDepsHash;
2134
- const existingMatch = this.getMatch(matchId);
2135
- const previousMatch = previousActiveMatchesByRouteId.get(route.id);
2136
- const strictParams = existingMatch?._strictParams ?? usedParams;
2137
- let paramsError = void 0;
2138
- if (!existingMatch) try {
2139
- extractStrictParams(route, usedParams, parsedParams, strictParams);
2140
- } catch (err) {
2141
- if (isNotFound(err) || isRedirect(err)) paramsError = err;
2142
- else paramsError = new PathParamError(err.message, { cause: err });
2143
- if (opts?.throwOnError) throw paramsError;
2144
- }
2145
- Object.assign(routeParams, strictParams);
2146
- const cause = previousMatch ? "stay" : "enter";
2147
- let match;
2148
- if (existingMatch) match = {
2149
- ...existingMatch,
2150
- cause,
2151
- params: previousMatch?.params ?? routeParams,
2152
- _strictParams: strictParams,
2153
- search: previousMatch ? nullReplaceEqualDeep(previousMatch.search, preMatchSearch) : nullReplaceEqualDeep(existingMatch.search, preMatchSearch),
2154
- _strictSearch: strictMatchSearch
2155
- };
2156
- else {
2157
- const status = route.options.loader || route.options.beforeLoad || route.lazyFn || routeNeedsPreload(route) ? "pending" : "success";
2158
- match = {
2159
- id: matchId,
2160
- ssr: void 0,
2161
- index,
2162
- routeId: route.id,
2163
- params: previousMatch?.params ?? routeParams,
2164
- _strictParams: strictParams,
2165
- pathname: interpolatedPath,
2166
- updatedAt: Date.now(),
2167
- search: previousMatch ? nullReplaceEqualDeep(previousMatch.search, preMatchSearch) : preMatchSearch,
2168
- _strictSearch: strictMatchSearch,
2169
- searchError: void 0,
2170
- status,
2171
- isFetching: false,
2172
- error: void 0,
2173
- paramsError,
2174
- __routeContext: void 0,
2175
- _nonReactive: { loadPromise: createControlledPromise() },
2176
- __beforeLoadContext: void 0,
2177
- context: {},
2178
- abortController: new AbortController(),
2179
- fetchCount: 0,
2180
- cause,
2181
- loaderDeps: previousMatch ? replaceEqualDeep(previousMatch.loaderDeps, loaderDeps) : loaderDeps,
2182
- invalid: false,
2183
- preload: false,
2184
- links: void 0,
2185
- scripts: void 0,
2186
- headScripts: void 0,
2187
- meta: void 0,
2188
- staticData: route.options.staticData || {},
2189
- fullPath: route.fullPath
2190
- };
2191
- }
2192
- if (!opts?.preload) match.globalNotFound = globalNotFoundRouteId === route.id;
2193
- match.searchError = searchError;
2194
- const parentContext = this.getParentContext(parentMatch);
2195
- match.context = {
2196
- ...parentContext,
2197
- ...match.__routeContext,
2198
- ...match.__beforeLoadContext
2199
- };
2200
- matches[index] = match;
2201
- }
2202
- for (let index = 0; index < matches.length; index++) {
2203
- const match = matches[index];
2204
- const route = this.looseRoutesById[match.routeId];
2205
- const existingMatch = this.getMatch(match.id);
2206
- const previousMatch = previousActiveMatchesByRouteId.get(match.routeId);
2207
- match.params = previousMatch ? nullReplaceEqualDeep(previousMatch.params, routeParams) : routeParams;
2208
- if (!existingMatch) {
2209
- const parentMatch = matches[index - 1];
2210
- const parentContext = this.getParentContext(parentMatch);
2211
- if (route.options.context) {
2212
- const contextFnContext = {
2213
- deps: match.loaderDeps,
2214
- params: match.params,
2215
- context: parentContext ?? {},
2216
- location: next,
2217
- navigate: (opts) => this.navigate({
2218
- ...opts,
2219
- _fromLocation: next
2220
- }),
2221
- buildLocation: this.buildLocation,
2222
- cause: match.cause,
2223
- abortController: match.abortController,
2224
- preload: !!match.preload,
2225
- matches,
2226
- routeId: route.id
2227
- };
2228
- match.__routeContext = route.options.context(contextFnContext) ?? void 0;
2229
- }
2230
- match.context = {
2231
- ...parentContext,
2232
- ...match.__routeContext,
2233
- ...match.__beforeLoadContext
2234
- };
2235
- }
2236
- }
2237
- return matches;
2238
- }
2239
- /**
2240
- * Lightweight route matching for buildLocation.
2241
- * Only computes fullPath, accumulated search, and params - skipping expensive
2242
- * operations like AbortController, ControlledPromise, loaderDeps, and full match objects.
2243
- */
2244
- matchRoutesLightweight(location) {
2245
- const { matchedRoutes, routeParams, parsedParams } = this.getMatchedRoutes(location.pathname);
2246
- const lastRoute = last(matchedRoutes);
2247
- const accumulatedSearch = { ...location.search };
2248
- for (const route of matchedRoutes) try {
2249
- Object.assign(accumulatedSearch, validateSearch(route.options.validateSearch, accumulatedSearch));
2250
- } catch {}
2251
- const lastStateMatchId = last(this.stores.matchesId.state);
2252
- const lastStateMatch = lastStateMatchId && this.stores.activeMatchStoresById.get(lastStateMatchId)?.state;
2253
- const canReuseParams = lastStateMatch && lastStateMatch.routeId === lastRoute.id && lastStateMatch.pathname === location.pathname;
2254
- let params;
2255
- if (canReuseParams) params = lastStateMatch.params;
2256
- else {
2257
- const strictParams = Object.assign(Object.create(null), routeParams);
2258
- for (const route of matchedRoutes) try {
2259
- extractStrictParams(route, routeParams, parsedParams ?? {}, strictParams);
2260
- } catch {}
2261
- params = strictParams;
2262
- }
2263
- return {
2264
- matchedRoutes,
2265
- fullPath: lastRoute.fullPath,
2266
- search: accumulatedSearch,
2267
- params
2268
- };
2269
- }
2270
- };
2271
- /** Error thrown when search parameter validation fails. */
2272
- var SearchParamError = class extends Error {};
2273
- /** Error thrown when path parameter parsing/validation fails. */
2274
- var PathParamError = class extends Error {};
2275
- /** Create an initial RouterState from a parsed location. */
2276
- function getInitialRouterState(location) {
2277
- return {
2278
- loadedAt: 0,
2279
- isLoading: false,
2280
- isTransitioning: false,
2281
- status: "idle",
2282
- resolvedLocation: void 0,
2283
- location,
2284
- matches: [],
2285
- statusCode: 200
2286
- };
2287
- }
2288
- function validateSearch(validateSearch, input) {
2289
- if (validateSearch == null) return {};
2290
- if ("~standard" in validateSearch) {
2291
- const result = validateSearch["~standard"].validate(input);
2292
- if (result instanceof Promise) throw new SearchParamError("Async validation not supported");
2293
- if (result.issues) throw new SearchParamError(JSON.stringify(result.issues, void 0, 2), { cause: result });
2294
- return result.value;
2295
- }
2296
- if ("parse" in validateSearch) return validateSearch.parse(input);
2297
- if (typeof validateSearch === "function") return validateSearch(input);
2298
- return {};
2299
- }
2300
- /**
2301
- * Build the matched route chain and extract params for a pathname.
2302
- * Falls back to the root route if no specific route is found.
2303
- */
2304
- function getMatchedRoutes({ pathname, routesById, processedTree }) {
2305
- const routeParams = Object.create(null);
2306
- const trimmedPath = trimPathRight(pathname);
2307
- let foundRoute = void 0;
2308
- let parsedParams = void 0;
2309
- const match = findRouteMatch(trimmedPath, processedTree, true);
2310
- if (match) {
2311
- foundRoute = match.route;
2312
- Object.assign(routeParams, match.rawParams);
2313
- parsedParams = Object.assign(Object.create(null), match.parsedParams);
2314
- }
2315
- return {
2316
- matchedRoutes: match?.branch || [routesById["__root__"]],
2317
- routeParams,
2318
- foundRoute,
2319
- parsedParams
2320
- };
2321
- }
2322
- /**
2323
- * TODO: once caches are persisted across requests on the server,
2324
- * we can cache the built middleware chain using `last(destRoutes)` as the key
2325
- */
2326
- function applySearchMiddleware({ search, dest, destRoutes, _includeValidateSearch }) {
2327
- return buildMiddlewareChain(destRoutes)(search, dest, _includeValidateSearch ?? false);
2328
- }
2329
- function buildMiddlewareChain(destRoutes) {
2330
- const context = {
2331
- dest: null,
2332
- _includeValidateSearch: false,
2333
- middlewares: []
2334
- };
2335
- for (const route of destRoutes) {
2336
- if ("search" in route.options) {
2337
- if (route.options.search?.middlewares) context.middlewares.push(...route.options.search.middlewares);
2338
- } else if (route.options.preSearchFilters || route.options.postSearchFilters) {
2339
- const legacyMiddleware = ({ search, next }) => {
2340
- let nextSearch = search;
2341
- if ("preSearchFilters" in route.options && route.options.preSearchFilters) nextSearch = route.options.preSearchFilters.reduce((prev, next) => next(prev), search);
2342
- const result = next(nextSearch);
2343
- if ("postSearchFilters" in route.options && route.options.postSearchFilters) return route.options.postSearchFilters.reduce((prev, next) => next(prev), result);
2344
- return result;
2345
- };
2346
- context.middlewares.push(legacyMiddleware);
2347
- }
2348
- if (route.options.validateSearch) {
2349
- const validate = ({ search, next }) => {
2350
- const result = next(search);
2351
- if (!context._includeValidateSearch) return result;
2352
- try {
2353
- return {
2354
- ...result,
2355
- ...validateSearch(route.options.validateSearch, result) ?? void 0
2356
- };
2357
- } catch {
2358
- return result;
2359
- }
2360
- };
2361
- context.middlewares.push(validate);
2362
- }
2363
- }
2364
- const final = ({ search }) => {
2365
- const dest = context.dest;
2366
- if (!dest.search) return {};
2367
- if (dest.search === true) return search;
2368
- return functionalUpdate(dest.search, search);
2369
- };
2370
- context.middlewares.push(final);
2371
- const applyNext = (index, currentSearch, middlewares) => {
2372
- if (index >= middlewares.length) return currentSearch;
2373
- const middleware = middlewares[index];
2374
- const next = (newSearch) => {
2375
- return applyNext(index + 1, newSearch, middlewares);
2376
- };
2377
- return middleware({
2378
- search: currentSearch,
2379
- next
2380
- });
2381
- };
2382
- return function middleware(search, dest, _includeValidateSearch) {
2383
- context.dest = dest;
2384
- context._includeValidateSearch = _includeValidateSearch;
2385
- return applyNext(0, search, context.middlewares);
2386
- };
2387
- }
2388
- function findGlobalNotFoundRouteId(notFoundMode, routes) {
2389
- if (notFoundMode !== "root") for (let i = routes.length - 1; i >= 0; i--) {
2390
- const route = routes[i];
2391
- if (route.children) return route.id;
2392
- }
2393
- return rootRouteId;
2394
- }
2395
- function extractStrictParams(route, referenceParams, parsedParams, accumulatedParams) {
2396
- const parseParams = route.options.params?.parse ?? route.options.parseParams;
2397
- if (parseParams) if (route.options.skipRouteOnParseError) {
2398
- for (const key in referenceParams) if (key in parsedParams) accumulatedParams[key] = parsedParams[key];
2399
- } else {
2400
- const result = parseParams(accumulatedParams);
2401
- Object.assign(accumulatedParams, result);
2402
- }
2403
- }
2404
- //#endregion
2405
- //#region ../../node_modules/.bun/@tanstack+router-core@1.168.3/node_modules/@tanstack/router-core/dist/esm/manifest.js
2406
- function getAssetCrossOrigin(assetCrossOrigin, kind) {
2407
- if (!assetCrossOrigin) return;
2408
- if (typeof assetCrossOrigin === "string") return assetCrossOrigin;
2409
- return assetCrossOrigin[kind];
2410
- }
2411
- function resolveManifestAssetLink(link) {
2412
- if (typeof link === "string") return {
2413
- href: link,
2414
- crossOrigin: void 0
2415
- };
2416
- return link;
2417
- }
2418
- //#endregion
2419
10
  //#region ../../node_modules/.bun/@tanstack+router-core@1.168.3/node_modules/@tanstack/router-core/dist/esm/ssr/constants.js
2420
11
  var GLOBAL_TSR = "$_TSR";
2421
12
  var TSR_SCRIPT_BARRIER_ID = "$tsr-stream-barrier";
@@ -5179,925 +2770,80 @@ ni({
5179
2770
  async async(e, r) {
5180
2771
  return {
5181
2772
  body: await r.parse(e.body && !e.bodyUsed ? await e.clone().arrayBuffer() : null),
5182
- options: await r.parse(h(e))
5183
- };
5184
- },
5185
- stream(e, r) {
5186
- return {
5187
- body: r.parse(e.body && !e.bodyUsed ? e.clone().body : null),
5188
- options: r.parse(h(e))
5189
- };
5190
- }
5191
- },
5192
- serialize(e, r) {
5193
- return "new Response(" + r.serialize(e.body) + "," + r.serialize(e.options) + ")";
5194
- },
5195
- deserialize(e, r) {
5196
- return new Response(r.deserialize(e.body), r.deserialize(e.options));
5197
- }
5198
- });
5199
- ni({
5200
- tag: "seroval-plugins/web/URL",
5201
- test(e) {
5202
- return typeof URL == "undefined" ? !1 : e instanceof URL;
5203
- },
5204
- parse: {
5205
- sync(e, r) {
5206
- return { value: r.parse(e.href) };
5207
- },
5208
- async async(e, r) {
5209
- return { value: await r.parse(e.href) };
5210
- },
5211
- stream(e, r) {
5212
- return { value: r.parse(e.href) };
5213
- }
5214
- },
5215
- serialize(e, r) {
5216
- return "new URL(" + r.serialize(e.value) + ")";
5217
- },
5218
- deserialize(e, r) {
5219
- return new URL(r.deserialize(e.value));
5220
- }
5221
- });
5222
- ni({
5223
- tag: "seroval-plugins/web/URLSearchParams",
5224
- test(e) {
5225
- return typeof URLSearchParams == "undefined" ? !1 : e instanceof URLSearchParams;
5226
- },
5227
- parse: {
5228
- sync(e, r) {
5229
- return { value: r.parse(e.toString()) };
5230
- },
5231
- async async(e, r) {
5232
- return { value: await r.parse(e.toString()) };
5233
- },
5234
- stream(e, r) {
5235
- return { value: r.parse(e.toString()) };
5236
- }
5237
- },
5238
- serialize(e, r) {
5239
- return "new URLSearchParams(" + r.serialize(e.value) + ")";
5240
- },
5241
- deserialize(e, r) {
5242
- return new URLSearchParams(r.deserialize(e.value));
5243
- }
5244
- });
5245
- //#endregion
5246
- //#region ../../node_modules/.bun/@tanstack+router-core@1.168.3/node_modules/@tanstack/router-core/dist/esm/ssr/serializer/seroval-plugins.js
5247
- var defaultSerovalPlugins = [
5248
- ShallowErrorPlugin,
5249
- RawStreamSSRPlugin,
5250
- p
5251
- ];
5252
- //#endregion
5253
- //#region ../../node_modules/.bun/@tanstack+react-router@1.168.3+bf16f8eded5e12ee/node_modules/@tanstack/react-router/dist/esm/CatchBoundary.js
5254
- var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
5255
- var import_jsx_runtime = require_jsx_runtime();
5256
- function CatchBoundary(props) {
5257
- const errorComponent = props.errorComponent ?? ErrorComponent;
5258
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CatchBoundaryImpl, {
5259
- getResetKey: props.getResetKey,
5260
- onCatch: props.onCatch,
5261
- children: ({ error, reset }) => {
5262
- if (error) return import_react.createElement(errorComponent, {
5263
- error,
5264
- reset
5265
- });
5266
- return props.children;
5267
- }
5268
- });
5269
- }
5270
- var CatchBoundaryImpl = class extends import_react.Component {
5271
- constructor(..._args) {
5272
- super(..._args);
5273
- this.state = { error: null };
5274
- }
5275
- static getDerivedStateFromProps(props) {
5276
- return { resetKey: props.getResetKey() };
5277
- }
5278
- static getDerivedStateFromError(error) {
5279
- return { error };
5280
- }
5281
- reset() {
5282
- this.setState({ error: null });
5283
- }
5284
- componentDidUpdate(prevProps, prevState) {
5285
- if (prevState.error && prevState.resetKey !== this.state.resetKey) this.reset();
5286
- }
5287
- componentDidCatch(error, errorInfo) {
5288
- if (this.props.onCatch) this.props.onCatch(error, errorInfo);
5289
- }
5290
- render() {
5291
- return this.props.children({
5292
- error: this.state.resetKey !== this.props.getResetKey() ? null : this.state.error,
5293
- reset: () => {
5294
- this.reset();
5295
- }
5296
- });
5297
- }
5298
- };
5299
- function ErrorComponent({ error }) {
5300
- const [show, setShow] = import_react.useState(false);
5301
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
5302
- style: {
5303
- padding: ".5rem",
5304
- maxWidth: "100%"
5305
- },
5306
- children: [
5307
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
5308
- style: {
5309
- display: "flex",
5310
- alignItems: "center",
5311
- gap: ".5rem"
5312
- },
5313
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", {
5314
- style: { fontSize: "1rem" },
5315
- children: "Something went wrong!"
5316
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
5317
- style: {
5318
- appearance: "none",
5319
- fontSize: ".6em",
5320
- border: "1px solid currentColor",
5321
- padding: ".1rem .2rem",
5322
- fontWeight: "bold",
5323
- borderRadius: ".25rem"
5324
- },
5325
- onClick: () => setShow((d) => !d),
5326
- children: show ? "Hide Error" : "Show Error"
5327
- })]
5328
- }),
5329
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { height: ".25rem" } }),
5330
- show ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
5331
- style: {
5332
- fontSize: ".7em",
5333
- border: "1px solid red",
5334
- borderRadius: ".25rem",
5335
- padding: ".3rem",
5336
- color: "red",
5337
- overflow: "auto"
5338
- },
5339
- children: error.message ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: error.message }) : null
5340
- }) }) : null
5341
- ]
5342
- });
5343
- }
5344
- //#endregion
5345
- //#region ../../node_modules/.bun/@tanstack+store@0.9.2/node_modules/@tanstack/store/dist/esm/alien.js
5346
- var ReactiveFlags = /* @__PURE__ */ ((ReactiveFlags2) => {
5347
- ReactiveFlags2[ReactiveFlags2["None"] = 0] = "None";
5348
- ReactiveFlags2[ReactiveFlags2["Mutable"] = 1] = "Mutable";
5349
- ReactiveFlags2[ReactiveFlags2["Watching"] = 2] = "Watching";
5350
- ReactiveFlags2[ReactiveFlags2["RecursedCheck"] = 4] = "RecursedCheck";
5351
- ReactiveFlags2[ReactiveFlags2["Recursed"] = 8] = "Recursed";
5352
- ReactiveFlags2[ReactiveFlags2["Dirty"] = 16] = "Dirty";
5353
- ReactiveFlags2[ReactiveFlags2["Pending"] = 32] = "Pending";
5354
- return ReactiveFlags2;
5355
- })(ReactiveFlags || {});
5356
- function createReactiveSystem({ update, notify, unwatched }) {
5357
- return {
5358
- link: link2,
5359
- unlink: unlink2,
5360
- propagate: propagate2,
5361
- checkDirty: checkDirty2,
5362
- shallowPropagate: shallowPropagate2
5363
- };
5364
- function link2(dep, sub, version) {
5365
- const prevDep = sub.depsTail;
5366
- if (prevDep !== void 0 && prevDep.dep === dep) return;
5367
- const nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
5368
- if (nextDep !== void 0 && nextDep.dep === dep) {
5369
- nextDep.version = version;
5370
- sub.depsTail = nextDep;
5371
- return;
5372
- }
5373
- const prevSub = dep.subsTail;
5374
- if (prevSub !== void 0 && prevSub.version === version && prevSub.sub === sub) return;
5375
- const newLink = sub.depsTail = dep.subsTail = {
5376
- version,
5377
- dep,
5378
- sub,
5379
- prevDep,
5380
- nextDep,
5381
- prevSub,
5382
- nextSub: void 0
5383
- };
5384
- if (nextDep !== void 0) nextDep.prevDep = newLink;
5385
- if (prevDep !== void 0) prevDep.nextDep = newLink;
5386
- else sub.deps = newLink;
5387
- if (prevSub !== void 0) prevSub.nextSub = newLink;
5388
- else dep.subs = newLink;
5389
- }
5390
- function unlink2(link3, sub = link3.sub) {
5391
- const dep = link3.dep;
5392
- const prevDep = link3.prevDep;
5393
- const nextDep = link3.nextDep;
5394
- const nextSub = link3.nextSub;
5395
- const prevSub = link3.prevSub;
5396
- if (nextDep !== void 0) nextDep.prevDep = prevDep;
5397
- else sub.depsTail = prevDep;
5398
- if (prevDep !== void 0) prevDep.nextDep = nextDep;
5399
- else sub.deps = nextDep;
5400
- if (nextSub !== void 0) nextSub.prevSub = prevSub;
5401
- else dep.subsTail = prevSub;
5402
- if (prevSub !== void 0) prevSub.nextSub = nextSub;
5403
- else if ((dep.subs = nextSub) === void 0) unwatched(dep);
5404
- return nextDep;
5405
- }
5406
- function propagate2(link3) {
5407
- let next = link3.nextSub;
5408
- let stack;
5409
- top: do {
5410
- const sub = link3.sub;
5411
- let flags = sub.flags;
5412
- if (!(flags & 60)) sub.flags = flags | 32;
5413
- else if (!(flags & 12)) flags = 0;
5414
- else if (!(flags & 4)) sub.flags = flags & -9 | 32;
5415
- else if (!(flags & 48) && isValidLink(link3, sub)) {
5416
- sub.flags = flags | 40;
5417
- flags &= 1;
5418
- } else flags = 0;
5419
- if (flags & 2) notify(sub);
5420
- if (flags & 1) {
5421
- const subSubs = sub.subs;
5422
- if (subSubs !== void 0) {
5423
- const nextSub = (link3 = subSubs).nextSub;
5424
- if (nextSub !== void 0) {
5425
- stack = {
5426
- value: next,
5427
- prev: stack
5428
- };
5429
- next = nextSub;
5430
- }
5431
- continue;
5432
- }
5433
- }
5434
- if ((link3 = next) !== void 0) {
5435
- next = link3.nextSub;
5436
- continue;
5437
- }
5438
- while (stack !== void 0) {
5439
- link3 = stack.value;
5440
- stack = stack.prev;
5441
- if (link3 !== void 0) {
5442
- next = link3.nextSub;
5443
- continue top;
5444
- }
5445
- }
5446
- break;
5447
- } while (true);
5448
- }
5449
- function checkDirty2(link3, sub) {
5450
- let stack;
5451
- let checkDepth = 0;
5452
- let dirty = false;
5453
- top: do {
5454
- const dep = link3.dep;
5455
- const flags = dep.flags;
5456
- if (sub.flags & 16) dirty = true;
5457
- else if ((flags & 17) === 17) {
5458
- if (update(dep)) {
5459
- const subs = dep.subs;
5460
- if (subs.nextSub !== void 0) shallowPropagate2(subs);
5461
- dirty = true;
5462
- }
5463
- } else if ((flags & 33) === 33) {
5464
- if (link3.nextSub !== void 0 || link3.prevSub !== void 0) stack = {
5465
- value: link3,
5466
- prev: stack
5467
- };
5468
- link3 = dep.deps;
5469
- sub = dep;
5470
- ++checkDepth;
5471
- continue;
5472
- }
5473
- if (!dirty) {
5474
- const nextDep = link3.nextDep;
5475
- if (nextDep !== void 0) {
5476
- link3 = nextDep;
5477
- continue;
5478
- }
5479
- }
5480
- while (checkDepth--) {
5481
- const firstSub = sub.subs;
5482
- const hasMultipleSubs = firstSub.nextSub !== void 0;
5483
- if (hasMultipleSubs) {
5484
- link3 = stack.value;
5485
- stack = stack.prev;
5486
- } else link3 = firstSub;
5487
- if (dirty) {
5488
- if (update(sub)) {
5489
- if (hasMultipleSubs) shallowPropagate2(firstSub);
5490
- sub = link3.sub;
5491
- continue;
5492
- }
5493
- dirty = false;
5494
- } else sub.flags &= -33;
5495
- sub = link3.sub;
5496
- const nextDep = link3.nextDep;
5497
- if (nextDep !== void 0) {
5498
- link3 = nextDep;
5499
- continue top;
5500
- }
5501
- }
5502
- return dirty;
5503
- } while (true);
5504
- }
5505
- function shallowPropagate2(link3) {
5506
- do {
5507
- const sub = link3.sub;
5508
- const flags = sub.flags;
5509
- if ((flags & 48) === 32) {
5510
- sub.flags = flags | 16;
5511
- if ((flags & 6) === 2) notify(sub);
5512
- }
5513
- } while ((link3 = link3.nextSub) !== void 0);
5514
- }
5515
- function isValidLink(checkLink, sub) {
5516
- let link3 = sub.depsTail;
5517
- while (link3 !== void 0) {
5518
- if (link3 === checkLink) return true;
5519
- link3 = link3.prevDep;
5520
- }
5521
- return false;
5522
- }
5523
- }
5524
- var batchDepth = 0;
5525
- var notifyIndex$1 = 0;
5526
- var queuedLength = 0;
5527
- var queued = [];
5528
- var { link: link$1, unlink: unlink$1, propagate: propagate$1, checkDirty: checkDirty$1, shallowPropagate: shallowPropagate$1 } = createReactiveSystem({
5529
- update(node) {
5530
- if (node.depsTail !== void 0) return updateComputed(node);
5531
- else return updateSignal(node);
5532
- },
5533
- notify(effect2) {
5534
- let insertIndex = queuedLength;
5535
- let firstInsertedIndex = insertIndex;
5536
- do {
5537
- queued[insertIndex++] = effect2;
5538
- effect2.flags &= -3;
5539
- effect2 = effect2.subs?.sub;
5540
- if (effect2 === void 0 || !(effect2.flags & 2)) break;
5541
- } while (true);
5542
- queuedLength = insertIndex;
5543
- while (firstInsertedIndex < --insertIndex) {
5544
- const left = queued[firstInsertedIndex];
5545
- queued[firstInsertedIndex++] = queued[insertIndex];
5546
- queued[insertIndex] = left;
5547
- }
5548
- },
5549
- unwatched(node) {
5550
- if (!(node.flags & 1)) effectScopeOper.call(node);
5551
- else if (node.depsTail !== void 0) {
5552
- node.depsTail = void 0;
5553
- node.flags = 17;
5554
- purgeDeps$1(node);
5555
- }
5556
- }
5557
- });
5558
- function getBatchDepth() {
5559
- return batchDepth;
5560
- }
5561
- function startBatch() {
5562
- ++batchDepth;
5563
- }
5564
- function endBatch() {
5565
- if (!--batchDepth) flush$1();
5566
- }
5567
- function updateComputed(c) {
5568
- c.depsTail = void 0;
5569
- c.flags = 5;
5570
- try {
5571
- const oldValue = c.value;
5572
- return oldValue !== (c.value = c.getter(oldValue));
5573
- } finally {
5574
- c.flags &= -5;
5575
- purgeDeps$1(c);
5576
- }
5577
- }
5578
- function updateSignal(s) {
5579
- s.flags = 1;
5580
- return s.currentValue !== (s.currentValue = s.pendingValue);
5581
- }
5582
- function run(e) {
5583
- const flags = e.flags;
5584
- if (flags & 16 || flags & 32 && checkDirty$1(e.deps, e)) {
5585
- e.depsTail = void 0;
5586
- e.flags = 6;
5587
- try {
5588
- e.fn();
5589
- } finally {
5590
- e.flags &= -5;
5591
- purgeDeps$1(e);
5592
- }
5593
- } else e.flags = 2;
5594
- }
5595
- function flush$1() {
5596
- try {
5597
- while (notifyIndex$1 < queuedLength) {
5598
- const effect2 = queued[notifyIndex$1];
5599
- queued[notifyIndex$1++] = void 0;
5600
- run(effect2);
5601
- }
5602
- } finally {
5603
- while (notifyIndex$1 < queuedLength) {
5604
- const effect2 = queued[notifyIndex$1];
5605
- queued[notifyIndex$1++] = void 0;
5606
- effect2.flags |= 10;
5607
- }
5608
- notifyIndex$1 = 0;
5609
- queuedLength = 0;
5610
- }
5611
- }
5612
- function effectScopeOper() {
5613
- this.depsTail = void 0;
5614
- this.flags = 0;
5615
- purgeDeps$1(this);
5616
- const sub = this.subs;
5617
- if (sub !== void 0) unlink$1(sub);
5618
- }
5619
- function purgeDeps$1(sub) {
5620
- const depsTail = sub.depsTail;
5621
- let dep = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
5622
- while (dep !== void 0) dep = unlink$1(dep, sub);
5623
- }
5624
- //#endregion
5625
- //#region ../../node_modules/.bun/@tanstack+store@0.9.2/node_modules/@tanstack/store/dist/esm/atom.js
5626
- function toObserver(nextHandler, errorHandler, completionHandler) {
5627
- const isObserver = typeof nextHandler === "object";
5628
- const self = isObserver ? nextHandler : void 0;
5629
- return {
5630
- next: (isObserver ? nextHandler.next : nextHandler)?.bind(self),
5631
- error: (isObserver ? nextHandler.error : errorHandler)?.bind(self),
5632
- complete: (isObserver ? nextHandler.complete : completionHandler)?.bind(self)
5633
- };
5634
- }
5635
- var queuedEffects = [];
5636
- var cycle = 0;
5637
- var { link, unlink, propagate, checkDirty, shallowPropagate } = createReactiveSystem({
5638
- update(atom) {
5639
- return atom._update();
5640
- },
5641
- notify(effect2) {
5642
- queuedEffects[queuedEffectsLength++] = effect2;
5643
- effect2.flags &= ~ReactiveFlags.Watching;
5644
- },
5645
- unwatched(atom) {
5646
- if (atom.depsTail !== void 0) {
5647
- atom.depsTail = void 0;
5648
- atom.flags = ReactiveFlags.Mutable | ReactiveFlags.Dirty;
5649
- purgeDeps(atom);
5650
- }
5651
- }
5652
- });
5653
- var notifyIndex = 0;
5654
- var queuedEffectsLength = 0;
5655
- var activeSub;
5656
- function purgeDeps(sub) {
5657
- const depsTail = sub.depsTail;
5658
- let dep = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
5659
- while (dep !== void 0) dep = unlink(dep, sub);
5660
- }
5661
- function flush() {
5662
- if (getBatchDepth() > 0) return;
5663
- while (notifyIndex < queuedEffectsLength) {
5664
- const effect2 = queuedEffects[notifyIndex];
5665
- queuedEffects[notifyIndex++] = void 0;
5666
- effect2.notify();
5667
- }
5668
- notifyIndex = 0;
5669
- queuedEffectsLength = 0;
5670
- }
5671
- function createAtom(valueOrFn, options) {
5672
- const isComputed = typeof valueOrFn === "function";
5673
- const getter = valueOrFn;
5674
- const atom = {
5675
- _snapshot: isComputed ? void 0 : valueOrFn,
5676
- subs: void 0,
5677
- subsTail: void 0,
5678
- deps: void 0,
5679
- depsTail: void 0,
5680
- flags: isComputed ? ReactiveFlags.None : ReactiveFlags.Mutable,
5681
- get() {
5682
- if (activeSub !== void 0) link(atom, activeSub, cycle);
5683
- return atom._snapshot;
5684
- },
5685
- subscribe(observerOrFn) {
5686
- const obs = toObserver(observerOrFn);
5687
- const observed = { current: false };
5688
- const e = effect(() => {
5689
- atom.get();
5690
- if (!observed.current) observed.current = true;
5691
- else obs.next?.(atom._snapshot);
5692
- });
5693
- return { unsubscribe: () => {
5694
- e.stop();
5695
- } };
5696
- },
5697
- _update(getValue) {
5698
- const prevSub = activeSub;
5699
- const compare = options?.compare ?? Object.is;
5700
- if (isComputed) {
5701
- activeSub = atom;
5702
- ++cycle;
5703
- atom.depsTail = void 0;
5704
- } else if (getValue === void 0) return false;
5705
- if (isComputed) atom.flags = ReactiveFlags.Mutable | ReactiveFlags.RecursedCheck;
5706
- try {
5707
- const oldValue = atom._snapshot;
5708
- const newValue = typeof getValue === "function" ? getValue(oldValue) : getValue === void 0 && isComputed ? getter(oldValue) : getValue;
5709
- if (oldValue === void 0 || !compare(oldValue, newValue)) {
5710
- atom._snapshot = newValue;
5711
- return true;
5712
- }
5713
- return false;
5714
- } finally {
5715
- activeSub = prevSub;
5716
- if (isComputed) atom.flags &= ~ReactiveFlags.RecursedCheck;
5717
- purgeDeps(atom);
5718
- }
5719
- }
5720
- };
5721
- if (isComputed) {
5722
- atom.flags = ReactiveFlags.Mutable | ReactiveFlags.Dirty;
5723
- atom.get = function() {
5724
- const flags = atom.flags;
5725
- if (flags & ReactiveFlags.Dirty || flags & ReactiveFlags.Pending && checkDirty(atom.deps, atom)) {
5726
- if (atom._update()) {
5727
- const subs = atom.subs;
5728
- if (subs !== void 0) shallowPropagate(subs);
5729
- }
5730
- } else if (flags & ReactiveFlags.Pending) atom.flags = flags & ~ReactiveFlags.Pending;
5731
- if (activeSub !== void 0) link(atom, activeSub, cycle);
5732
- return atom._snapshot;
5733
- };
5734
- } else atom.set = function(valueOrFn2) {
5735
- if (atom._update(valueOrFn2)) {
5736
- const subs = atom.subs;
5737
- if (subs !== void 0) {
5738
- propagate(subs);
5739
- shallowPropagate(subs);
5740
- flush();
5741
- }
5742
- }
5743
- };
5744
- return atom;
5745
- }
5746
- function effect(fn) {
5747
- const run = () => {
5748
- const prevSub = activeSub;
5749
- activeSub = effectObj;
5750
- ++cycle;
5751
- effectObj.depsTail = void 0;
5752
- effectObj.flags = ReactiveFlags.Watching | ReactiveFlags.RecursedCheck;
5753
- try {
5754
- return fn();
5755
- } finally {
5756
- activeSub = prevSub;
5757
- effectObj.flags &= ~ReactiveFlags.RecursedCheck;
5758
- purgeDeps(effectObj);
5759
- }
5760
- };
5761
- const effectObj = {
5762
- deps: void 0,
5763
- depsTail: void 0,
5764
- subs: void 0,
5765
- subsTail: void 0,
5766
- flags: ReactiveFlags.Watching | ReactiveFlags.RecursedCheck,
5767
- notify() {
5768
- const flags = this.flags;
5769
- if (flags & ReactiveFlags.Dirty || flags & ReactiveFlags.Pending && checkDirty(this.deps, this)) run();
5770
- else this.flags = ReactiveFlags.Watching;
5771
- },
5772
- stop() {
5773
- this.flags = ReactiveFlags.None;
5774
- this.depsTail = void 0;
5775
- purgeDeps(this);
5776
- }
5777
- };
5778
- run();
5779
- return effectObj;
5780
- }
5781
- //#endregion
5782
- //#region ../../node_modules/.bun/@tanstack+store@0.9.2/node_modules/@tanstack/store/dist/esm/batch.js
5783
- function batch(fn) {
5784
- try {
5785
- startBatch();
5786
- fn();
5787
- } finally {
5788
- endBatch();
5789
- flush();
5790
- }
5791
- }
5792
- //#endregion
5793
- //#region ../../node_modules/.bun/@tanstack+react-router@1.168.3+bf16f8eded5e12ee/node_modules/@tanstack/react-router/dist/esm/not-found.js
5794
- function CatchNotFound(props) {
5795
- const router = useRouter();
5796
- {
5797
- const resetKey = `not-found-${router.stores.location.state.pathname}-${router.stores.status.state}`;
5798
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CatchBoundary, {
5799
- getResetKey: () => resetKey,
5800
- onCatch: (error, errorInfo) => {
5801
- if (isNotFound(error)) props.onCatch?.(error, errorInfo);
5802
- else throw error;
5803
- },
5804
- errorComponent: ({ error }) => {
5805
- if (isNotFound(error)) return props.fallback?.(error);
5806
- else throw error;
5807
- },
5808
- children: props.children
5809
- });
5810
- }
5811
- const resetKey = `not-found-${useStore(router.stores.location, (location) => location.pathname)}-${useStore(router.stores.status, (status) => status)}`;
5812
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CatchBoundary, {
5813
- getResetKey: () => resetKey,
5814
- onCatch: (error, errorInfo) => {
5815
- if (isNotFound(error)) props.onCatch?.(error, errorInfo);
5816
- else throw error;
5817
- },
5818
- errorComponent: ({ error }) => {
5819
- if (isNotFound(error)) return props.fallback?.(error);
5820
- else throw error;
5821
- },
5822
- children: props.children
5823
- });
5824
- }
5825
- function DefaultGlobalNotFound() {
5826
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Not Found" });
5827
- }
5828
- //#endregion
5829
- //#region ../../node_modules/.bun/@tanstack+react-router@1.168.3+bf16f8eded5e12ee/node_modules/@tanstack/react-router/dist/esm/ScriptOnce.js
5830
- /**
5831
- * Server-only helper to emit a script tag exactly once during SSR.
5832
- */
5833
- function ScriptOnce({ children }) {
5834
- const router = useRouter();
5835
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("script", {
5836
- nonce: router.options.ssr?.nonce,
5837
- dangerouslySetInnerHTML: { __html: children + ";document.currentScript.remove()" }
5838
- });
5839
- }
5840
- //#endregion
5841
- //#region ../../node_modules/.bun/@tanstack+react-router@1.168.3+bf16f8eded5e12ee/node_modules/@tanstack/react-router/dist/esm/SafeFragment.js
5842
- function SafeFragment(props) {
5843
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: props.children });
5844
- }
5845
- //#endregion
5846
- //#region ../../node_modules/.bun/@tanstack+react-router@1.168.3+bf16f8eded5e12ee/node_modules/@tanstack/react-router/dist/esm/renderRouteNotFound.js
5847
- /**
5848
- * Renders a not found component for a route when no matching route is found.
5849
- *
5850
- * @param router - The router instance containing the route configuration
5851
- * @param route - The route that triggered the not found state
5852
- * @param data - Additional data to pass to the not found component
5853
- * @returns The rendered not found component or a default fallback component
5854
- */
5855
- function renderRouteNotFound(router, route, data) {
5856
- if (!route.options.notFoundComponent) {
5857
- if (router.options.defaultNotFoundComponent) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(router.options.defaultNotFoundComponent, { ...data });
5858
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultGlobalNotFound, {});
5859
- }
5860
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(route.options.notFoundComponent, { ...data });
5861
- }
5862
- //#endregion
5863
- //#region ../../node_modules/.bun/@tanstack+react-router@1.168.3+bf16f8eded5e12ee/node_modules/@tanstack/react-router/dist/esm/scroll-restoration.js
5864
- function ScrollRestoration() {
5865
- const router = useRouter();
5866
- if (!router.isScrollRestoring || false) return null;
5867
- if (typeof router.options.scrollRestoration === "function") {
5868
- if (!router.options.scrollRestoration({ location: router.latestLocation })) return null;
5869
- }
5870
- const userKey = (router.options.getScrollRestorationKey || defaultGetScrollRestorationKey)(router.latestLocation);
5871
- const resolvedKey = userKey !== defaultGetScrollRestorationKey(router.latestLocation) ? userKey : void 0;
5872
- const restoreScrollOptions = {
5873
- storageKey,
5874
- shouldScrollRestoration: true
5875
- };
5876
- if (resolvedKey) restoreScrollOptions.key = resolvedKey;
5877
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScriptOnce, { children: `(${restoreScroll.toString()})(${escapeHtml(JSON.stringify(restoreScrollOptions))})` });
5878
- }
5879
- //#endregion
5880
- //#region ../../node_modules/.bun/@tanstack+react-router@1.168.3+bf16f8eded5e12ee/node_modules/@tanstack/react-router/dist/esm/Match.js
5881
- var Match = import_react.memo(function MatchImpl({ matchId }) {
5882
- const router = useRouter();
5883
- {
5884
- const match = router.stores.activeMatchStoresById.get(matchId)?.state;
5885
- if (!match) invariant();
5886
- const routeId = match.routeId;
5887
- const parentRouteId = router.routesById[routeId].parentRoute?.id;
5888
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MatchView, {
5889
- router,
5890
- matchId,
5891
- resetKey: router.stores.loadedAt.state,
5892
- matchState: {
5893
- routeId,
5894
- ssr: match.ssr,
5895
- _displayPending: match._displayPending,
5896
- parentRouteId
5897
- }
5898
- });
5899
- }
5900
- const matchStore = router.stores.activeMatchStoresById.get(matchId);
5901
- if (!matchStore) invariant();
5902
- const resetKey = useStore(router.stores.loadedAt, (loadedAt) => loadedAt);
5903
- const match = useStore(matchStore, (value) => value);
5904
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MatchView, {
5905
- router,
5906
- matchId,
5907
- resetKey,
5908
- matchState: import_react.useMemo(() => {
5909
- const routeId = match.routeId;
5910
- const parentRouteId = router.routesById[routeId].parentRoute?.id;
2773
+ options: await r.parse(h(e))
2774
+ };
2775
+ },
2776
+ stream(e, r) {
5911
2777
  return {
5912
- routeId,
5913
- ssr: match.ssr,
5914
- _displayPending: match._displayPending,
5915
- parentRouteId
2778
+ body: r.parse(e.body && !e.bodyUsed ? e.clone().body : null),
2779
+ options: r.parse(h(e))
5916
2780
  };
5917
- }, [
5918
- match._displayPending,
5919
- match.routeId,
5920
- match.ssr,
5921
- router.routesById
5922
- ])
5923
- });
5924
- });
5925
- function MatchView({ router, matchId, resetKey, matchState }) {
5926
- const route = router.routesById[matchState.routeId];
5927
- const PendingComponent = route.options.pendingComponent ?? router.options.defaultPendingComponent;
5928
- const pendingElement = PendingComponent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PendingComponent, {}) : null;
5929
- const routeErrorComponent = route.options.errorComponent ?? router.options.defaultErrorComponent;
5930
- const routeOnCatch = route.options.onCatch ?? router.options.defaultOnCatch;
5931
- const routeNotFoundComponent = route.isRoot ? route.options.notFoundComponent ?? router.options.notFoundRoute?.options.component : route.options.notFoundComponent;
5932
- const resolvedNoSsr = matchState.ssr === false || matchState.ssr === "data-only";
5933
- const ResolvedSuspenseBoundary = (!route.isRoot || route.options.wrapInSuspense || resolvedNoSsr) && (route.options.wrapInSuspense ?? PendingComponent ?? (route.options.errorComponent?.preload || resolvedNoSsr)) ? import_react.Suspense : SafeFragment;
5934
- const ResolvedCatchBoundary = routeErrorComponent ? CatchBoundary : SafeFragment;
5935
- const ResolvedNotFoundBoundary = routeNotFoundComponent ? CatchNotFound : SafeFragment;
5936
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(route.isRoot ? route.options.shellComponent ?? SafeFragment : SafeFragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(matchContext.Provider, {
5937
- value: matchId,
5938
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ResolvedSuspenseBoundary, {
5939
- fallback: pendingElement,
5940
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ResolvedCatchBoundary, {
5941
- getResetKey: () => resetKey,
5942
- errorComponent: routeErrorComponent || ErrorComponent,
5943
- onCatch: (error, errorInfo) => {
5944
- if (isNotFound(error)) throw error;
5945
- routeOnCatch?.(error, errorInfo);
5946
- },
5947
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ResolvedNotFoundBoundary, {
5948
- fallback: (error) => {
5949
- if (!routeNotFoundComponent || error.routeId && error.routeId !== matchState.routeId || !error.routeId && !route.isRoot) throw error;
5950
- return import_react.createElement(routeNotFoundComponent, error);
5951
- },
5952
- children: resolvedNoSsr || matchState._displayPending ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClientOnly, {
5953
- fallback: pendingElement,
5954
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MatchInner, { matchId })
5955
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MatchInner, { matchId })
5956
- })
5957
- })
5958
- })
5959
- }), 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] });
5960
- }
5961
- function OnRendered() {
5962
- const router = useRouter();
5963
- const prevLocationRef = import_react.useRef(void 0);
5964
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("script", {
5965
- suppressHydrationWarning: true,
5966
- ref: (el) => {
5967
- if (el && (prevLocationRef.current === void 0 || prevLocationRef.current.href !== router.latestLocation.href)) {
5968
- router.emit({
5969
- type: "onRendered",
5970
- ...getLocationChangeInfo(router.stores.location.state, router.stores.resolvedLocation.state)
5971
- });
5972
- prevLocationRef.current = router.latestLocation;
5973
- }
5974
- }
5975
- }, router.latestLocation.state.__TSR_key);
5976
- }
5977
- var MatchInner = import_react.memo(function MatchInnerImpl({ matchId }) {
5978
- const router = useRouter();
5979
- {
5980
- const match = router.stores.activeMatchStoresById.get(matchId)?.state;
5981
- if (!match) invariant();
5982
- const routeId = match.routeId;
5983
- const route = router.routesById[routeId];
5984
- const remountDeps = (router.routesById[routeId].options.remountDeps ?? router.options.defaultRemountDeps)?.({
5985
- routeId,
5986
- loaderDeps: match.loaderDeps,
5987
- params: match._strictParams,
5988
- search: match._strictSearch
5989
- });
5990
- const key = remountDeps ? JSON.stringify(remountDeps) : void 0;
5991
- const Comp = route.options.component ?? router.options.defaultComponent;
5992
- const out = Comp ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Comp, {}, key) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Outlet, {});
5993
- if (match._displayPending) throw router.getMatch(match.id)?._nonReactive.displayPendingPromise;
5994
- if (match._forcePending) throw router.getMatch(match.id)?._nonReactive.minPendingPromise;
5995
- if (match.status === "pending") throw router.getMatch(match.id)?._nonReactive.loadPromise;
5996
- if (match.status === "notFound") {
5997
- if (!isNotFound(match.error)) invariant();
5998
- return renderRouteNotFound(router, route, match.error);
5999
- }
6000
- if (match.status === "redirected") {
6001
- if (!isRedirect(match.error)) invariant();
6002
- throw router.getMatch(match.id)?._nonReactive.loadPromise;
6003
- }
6004
- if (match.status === "error") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)((route.options.errorComponent ?? router.options.defaultErrorComponent) || ErrorComponent, {
6005
- error: match.error,
6006
- reset: void 0,
6007
- info: { componentStack: "" }
6008
- });
6009
- return out;
6010
- }
6011
- const matchStore = router.stores.activeMatchStoresById.get(matchId);
6012
- if (!matchStore) invariant();
6013
- const match = useStore(matchStore, (value) => value);
6014
- const routeId = match.routeId;
6015
- const route = router.routesById[routeId];
6016
- const key = import_react.useMemo(() => {
6017
- const remountDeps = (router.routesById[routeId].options.remountDeps ?? router.options.defaultRemountDeps)?.({
6018
- routeId,
6019
- loaderDeps: match.loaderDeps,
6020
- params: match._strictParams,
6021
- search: match._strictSearch
6022
- });
6023
- return remountDeps ? JSON.stringify(remountDeps) : void 0;
6024
- }, [
6025
- routeId,
6026
- match.loaderDeps,
6027
- match._strictParams,
6028
- match._strictSearch,
6029
- router.options.defaultRemountDeps,
6030
- router.routesById
6031
- ]);
6032
- const out = import_react.useMemo(() => {
6033
- const Comp = route.options.component ?? router.options.defaultComponent;
6034
- if (Comp) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Comp, {}, key);
6035
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Outlet, {});
6036
- }, [
6037
- key,
6038
- route.options.component,
6039
- router.options.defaultComponent
6040
- ]);
6041
- if (match._displayPending) throw router.getMatch(match.id)?._nonReactive.displayPendingPromise;
6042
- if (match._forcePending) throw router.getMatch(match.id)?._nonReactive.minPendingPromise;
6043
- if (match.status === "pending") {
6044
- if (route.options.pendingMinMs ?? router.options.defaultPendingMinMs) {
6045
- const routerMatch = router.getMatch(match.id);
6046
- if (routerMatch && !routerMatch._nonReactive.minPendingPromise) {}
6047
2781
  }
6048
- throw router.getMatch(match.id)?._nonReactive.loadPromise;
6049
- }
6050
- if (match.status === "notFound") {
6051
- if (!isNotFound(match.error)) invariant();
6052
- return renderRouteNotFound(router, route, match.error);
2782
+ },
2783
+ serialize(e, r) {
2784
+ return "new Response(" + r.serialize(e.body) + "," + r.serialize(e.options) + ")";
2785
+ },
2786
+ deserialize(e, r) {
2787
+ return new Response(r.deserialize(e.body), r.deserialize(e.options));
6053
2788
  }
6054
- if (match.status === "redirected") {
6055
- if (!isRedirect(match.error)) invariant();
6056
- throw router.getMatch(match.id)?._nonReactive.loadPromise;
2789
+ });
2790
+ ni({
2791
+ tag: "seroval-plugins/web/URL",
2792
+ test(e) {
2793
+ return typeof URL == "undefined" ? !1 : e instanceof URL;
2794
+ },
2795
+ parse: {
2796
+ sync(e, r) {
2797
+ return { value: r.parse(e.href) };
2798
+ },
2799
+ async async(e, r) {
2800
+ return { value: await r.parse(e.href) };
2801
+ },
2802
+ stream(e, r) {
2803
+ return { value: r.parse(e.href) };
2804
+ }
2805
+ },
2806
+ serialize(e, r) {
2807
+ return "new URL(" + r.serialize(e.value) + ")";
2808
+ },
2809
+ deserialize(e, r) {
2810
+ return new URL(r.deserialize(e.value));
6057
2811
  }
6058
- if (match.status === "error") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)((route.options.errorComponent ?? router.options.defaultErrorComponent) || ErrorComponent, {
6059
- error: match.error,
6060
- reset: void 0,
6061
- info: { componentStack: "" }
6062
- });
6063
- return out;
6064
2812
  });
6065
- /**
6066
- * Render the next child match in the route tree. Typically used inside
6067
- * a route component to render nested routes.
6068
- *
6069
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/outletComponent
6070
- */
6071
- var Outlet = import_react.memo(function OutletImpl() {
6072
- const router = useRouter();
6073
- const matchId = import_react.useContext(matchContext);
6074
- let routeId;
6075
- let parentGlobalNotFound = false;
6076
- let childMatchId;
6077
- {
6078
- const matches = router.stores.activeMatchesSnapshot.state;
6079
- const parentIndex = matchId ? matches.findIndex((match) => match.id === matchId) : -1;
6080
- const parentMatch = parentIndex >= 0 ? matches[parentIndex] : void 0;
6081
- routeId = parentMatch?.routeId;
6082
- parentGlobalNotFound = parentMatch?.globalNotFound ?? false;
6083
- childMatchId = parentIndex >= 0 ? matches[parentIndex + 1]?.id : void 0;
6084
- }
6085
- const route = routeId ? router.routesById[routeId] : void 0;
6086
- const pendingElement = router.options.defaultPendingComponent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(router.options.defaultPendingComponent, {}) : null;
6087
- if (parentGlobalNotFound) {
6088
- if (!route) invariant();
6089
- return renderRouteNotFound(router, route, void 0);
6090
- }
6091
- if (!childMatchId) return null;
6092
- const nextMatch = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Match, { matchId: childMatchId });
6093
- if (routeId === "__root__") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, {
6094
- fallback: pendingElement,
6095
- children: nextMatch
6096
- });
6097
- return nextMatch;
2813
+ ni({
2814
+ tag: "seroval-plugins/web/URLSearchParams",
2815
+ test(e) {
2816
+ return typeof URLSearchParams == "undefined" ? !1 : e instanceof URLSearchParams;
2817
+ },
2818
+ parse: {
2819
+ sync(e, r) {
2820
+ return { value: r.parse(e.toString()) };
2821
+ },
2822
+ async async(e, r) {
2823
+ return { value: await r.parse(e.toString()) };
2824
+ },
2825
+ stream(e, r) {
2826
+ return { value: r.parse(e.toString()) };
2827
+ }
2828
+ },
2829
+ serialize(e, r) {
2830
+ return "new URLSearchParams(" + r.serialize(e.value) + ")";
2831
+ },
2832
+ deserialize(e, r) {
2833
+ return new URLSearchParams(r.deserialize(e.value));
2834
+ }
6098
2835
  });
6099
2836
  //#endregion
2837
+ //#region ../../node_modules/.bun/@tanstack+router-core@1.168.3/node_modules/@tanstack/router-core/dist/esm/ssr/serializer/seroval-plugins.js
2838
+ var defaultSerovalPlugins = [
2839
+ ShallowErrorPlugin,
2840
+ RawStreamSSRPlugin,
2841
+ p
2842
+ ];
2843
+ require_react();
2844
+ //#endregion
6100
2845
  //#region ../../node_modules/.bun/@tanstack+react-router@1.168.3+bf16f8eded5e12ee/node_modules/@tanstack/react-router/dist/esm/Matches.js
2846
+ var import_jsx_runtime = require_jsx_runtime();
6101
2847
  /**
6102
2848
  * Internal component that renders the router's active match tree with
6103
2849
  * suspense, error, and not-found boundaries. Rendered by `RouterProvider`.
@@ -10016,7 +6762,7 @@ var require_react_dom_server_legacy_node_production = /* @__PURE__ */ __commonJS
10016
6762
  * LICENSE file in the root directory of this source tree.
10017
6763
  */
10018
6764
  var require_react_dom_server_node_production = /* @__PURE__ */ __commonJSMin(((exports) => {
10019
- var util = __require("util"), crypto$1 = __require("crypto"), async_hooks = __require("async_hooks"), React = require_react(), ReactDOM = require_react_dom(), stream = __require("stream"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_SCOPE_TYPE = Symbol.for("react.scope"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_LEGACY_HIDDEN_TYPE = Symbol.for("react.legacy_hidden"), REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"), REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
6765
+ var util = __require("util"), crypto = __require("crypto"), async_hooks = __require("async_hooks"), React = require_react(), ReactDOM = require_react_dom(), stream = __require("stream"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_SCOPE_TYPE = Symbol.for("react.scope"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_LEGACY_HIDDEN_TYPE = Symbol.for("react.legacy_hidden"), REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"), REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
10020
6766
  function getIteratorFn(maybeIterable) {
10021
6767
  if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
10022
6768
  maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
@@ -12040,7 +8786,7 @@ var require_react_dom_server_node_production = /* @__PURE__ */ __commonJSMin(((e
12040
8786
  null,
12041
8787
  hookIndex
12042
8788
  ]);
12043
- componentKeyPath = crypto$1.createHash("md5");
8789
+ componentKeyPath = crypto.createHash("md5");
12044
8790
  componentKeyPath.update(permalink);
12045
8791
  return "k" + componentKeyPath.digest("hex");
12046
8792
  }
@@ -14541,66 +11287,6 @@ function getNormalizedURL(url, base) {
14541
11287
  };
14542
11288
  }
14543
11289
  //#endregion
14544
- //#region ../../node_modules/.bun/cookie-es@2.0.0/node_modules/cookie-es/dist/index.mjs
14545
- function splitSetCookieString(cookiesString) {
14546
- if (Array.isArray(cookiesString)) return cookiesString.flatMap((c) => splitSetCookieString(c));
14547
- if (typeof cookiesString !== "string") return [];
14548
- const cookiesStrings = [];
14549
- let pos = 0;
14550
- let start;
14551
- let ch;
14552
- let lastComma;
14553
- let nextStart;
14554
- let cookiesSeparatorFound;
14555
- const skipWhitespace = () => {
14556
- while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) pos += 1;
14557
- return pos < cookiesString.length;
14558
- };
14559
- const notSpecialChar = () => {
14560
- ch = cookiesString.charAt(pos);
14561
- return ch !== "=" && ch !== ";" && ch !== ",";
14562
- };
14563
- while (pos < cookiesString.length) {
14564
- start = pos;
14565
- cookiesSeparatorFound = false;
14566
- while (skipWhitespace()) {
14567
- ch = cookiesString.charAt(pos);
14568
- if (ch === ",") {
14569
- lastComma = pos;
14570
- pos += 1;
14571
- skipWhitespace();
14572
- nextStart = pos;
14573
- while (pos < cookiesString.length && notSpecialChar()) pos += 1;
14574
- if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
14575
- cookiesSeparatorFound = true;
14576
- pos = nextStart;
14577
- cookiesStrings.push(cookiesString.slice(start, lastComma));
14578
- start = pos;
14579
- } else pos = lastComma + 1;
14580
- } else pos += 1;
14581
- }
14582
- if (!cookiesSeparatorFound || pos >= cookiesString.length) cookiesStrings.push(cookiesString.slice(start));
14583
- }
14584
- return cookiesStrings;
14585
- }
14586
- //#endregion
14587
- //#region ../../node_modules/.bun/@tanstack+router-core@1.168.3/node_modules/@tanstack/router-core/dist/esm/ssr/headers.js
14588
- function toHeadersInstance(init) {
14589
- if (init instanceof Headers) return init;
14590
- else if (Array.isArray(init)) return new Headers(init);
14591
- else if (typeof init === "object") return new Headers(init);
14592
- else return null;
14593
- }
14594
- function mergeHeaders(...headers) {
14595
- return headers.reduce((acc, header) => {
14596
- const headersInstance = toHeadersInstance(header);
14597
- if (!headersInstance) return acc;
14598
- for (const [key, value] of headersInstance.entries()) if (key === "set-cookie") splitSetCookieString(value).forEach((cookie) => acc.append("set-cookie", cookie));
14599
- else acc.set(key, value);
14600
- return acc;
14601
- }, new Headers());
14602
- }
14603
- //#endregion
14604
11290
  //#region ../../node_modules/.bun/@tanstack+router-core@1.168.3/node_modules/@tanstack/router-core/dist/esm/ssr/handlerCallback.js
14605
11291
  function defineHandlerCallback(handler) {
14606
11292
  return handler;
@@ -14995,592 +11681,6 @@ var defaultStreamHandler = defineHandlerCallback(({ request, router, responseHea
14995
11681
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StartServer, { router })
14996
11682
  }));
14997
11683
  //#endregion
14998
- //#region ../../node_modules/.bun/rou3@0.8.1/node_modules/rou3/dist/index.mjs
14999
- var NullProtoObj = /* @__PURE__ */ (() => {
15000
- const e = function() {};
15001
- return e.prototype = Object.create(null), Object.freeze(e.prototype), e;
15002
- })();
15003
- //#endregion
15004
- //#region ../../node_modules/.bun/srvx@0.11.13/node_modules/srvx/dist/_chunks/_url.mjs
15005
- function lazyInherit(target, source, sourceKey) {
15006
- for (const key of [...Object.getOwnPropertyNames(source), ...Object.getOwnPropertySymbols(source)]) {
15007
- if (key === "constructor") continue;
15008
- const targetDesc = Object.getOwnPropertyDescriptor(target, key);
15009
- const desc = Object.getOwnPropertyDescriptor(source, key);
15010
- let modified = false;
15011
- if (desc.get) {
15012
- modified = true;
15013
- desc.get = targetDesc?.get || function() {
15014
- return this[sourceKey][key];
15015
- };
15016
- }
15017
- if (desc.set) {
15018
- modified = true;
15019
- desc.set = targetDesc?.set || function(value) {
15020
- this[sourceKey][key] = value;
15021
- };
15022
- }
15023
- if (!targetDesc?.value && typeof desc.value === "function") {
15024
- modified = true;
15025
- desc.value = function(...args) {
15026
- return this[sourceKey][key](...args);
15027
- };
15028
- }
15029
- if (modified) Object.defineProperty(target, key, desc);
15030
- }
15031
- }
15032
- var _needsNormRE = /(?:(?:^|\/)(?:\.|\.\.|%2e|%2e\.|\.%2e|%2e%2e)(?:\/|$))|[\\^\x80-\uffff]/i;
15033
- /**
15034
- * URL wrapper with fast paths to access to the following props:
15035
- *
15036
- * - `url.pathname`
15037
- * - `url.search`
15038
- * - `url.searchParams`
15039
- * - `url.protocol`
15040
- *
15041
- * **NOTES:**
15042
- *
15043
- * - It is assumed that the input URL is **already encoded** and formatted from an HTTP request and contains no hash.
15044
- * - Triggering the setters or getters on other props will deoptimize to full URL parsing.
15045
- * - Changes to `searchParams` will be discarded as we don't track them.
15046
- */
15047
- var FastURL = /* @__PURE__ */ (() => {
15048
- const NativeURL = globalThis.URL;
15049
- const FastURL = class URL {
15050
- #url;
15051
- #href;
15052
- #protocol;
15053
- #host;
15054
- #pathname;
15055
- #search;
15056
- #searchParams;
15057
- #pos;
15058
- constructor(url) {
15059
- if (typeof url === "string") if (url[0] === "/") this.#href = url;
15060
- else this.#url = new NativeURL(url);
15061
- else if (_needsNormRE.test(url.pathname)) this.#url = new NativeURL(`${url.protocol || "http:"}//${url.host || "localhost"}${url.pathname}${url.search || ""}`);
15062
- else {
15063
- this.#protocol = url.protocol;
15064
- this.#host = url.host;
15065
- this.#pathname = url.pathname;
15066
- this.#search = url.search;
15067
- }
15068
- }
15069
- static [Symbol.hasInstance](val) {
15070
- return val instanceof NativeURL;
15071
- }
15072
- get _url() {
15073
- if (this.#url) return this.#url;
15074
- this.#url = new NativeURL(this.href);
15075
- this.#href = void 0;
15076
- this.#protocol = void 0;
15077
- this.#host = void 0;
15078
- this.#pathname = void 0;
15079
- this.#search = void 0;
15080
- this.#searchParams = void 0;
15081
- this.#pos = void 0;
15082
- return this.#url;
15083
- }
15084
- get href() {
15085
- if (this.#url) return this.#url.href;
15086
- if (!this.#href) this.#href = `${this.#protocol || "http:"}//${this.#host || "localhost"}${this.#pathname || "/"}${this.#search || ""}`;
15087
- return this.#href;
15088
- }
15089
- #getPos() {
15090
- if (!this.#pos) {
15091
- const url = this.href;
15092
- const protoIndex = url.indexOf("://");
15093
- const pathnameIndex = protoIndex === -1 ? -1 : url.indexOf("/", protoIndex + 4);
15094
- this.#pos = [
15095
- protoIndex,
15096
- pathnameIndex,
15097
- pathnameIndex === -1 ? -1 : url.indexOf("?", pathnameIndex)
15098
- ];
15099
- }
15100
- return this.#pos;
15101
- }
15102
- get pathname() {
15103
- if (this.#url) return this.#url.pathname;
15104
- if (this.#pathname === void 0) {
15105
- const [, pathnameIndex, queryIndex] = this.#getPos();
15106
- if (pathnameIndex === -1) return this._url.pathname;
15107
- this.#pathname = this.href.slice(pathnameIndex, queryIndex === -1 ? void 0 : queryIndex);
15108
- }
15109
- return this.#pathname;
15110
- }
15111
- get search() {
15112
- if (this.#url) return this.#url.search;
15113
- if (this.#search === void 0) {
15114
- const [, pathnameIndex, queryIndex] = this.#getPos();
15115
- if (pathnameIndex === -1) return this._url.search;
15116
- const url = this.href;
15117
- this.#search = queryIndex === -1 || queryIndex === url.length - 1 ? "" : url.slice(queryIndex);
15118
- }
15119
- return this.#search;
15120
- }
15121
- get searchParams() {
15122
- if (this.#url) return this.#url.searchParams;
15123
- if (!this.#searchParams) this.#searchParams = new URLSearchParams(this.search);
15124
- return this.#searchParams;
15125
- }
15126
- get protocol() {
15127
- if (this.#url) return this.#url.protocol;
15128
- if (this.#protocol === void 0) {
15129
- const [protocolIndex] = this.#getPos();
15130
- if (protocolIndex === -1) return this._url.protocol;
15131
- this.#protocol = this.href.slice(0, protocolIndex + 1);
15132
- }
15133
- return this.#protocol;
15134
- }
15135
- toString() {
15136
- return this.href;
15137
- }
15138
- toJSON() {
15139
- return this.href;
15140
- }
15141
- };
15142
- lazyInherit(FastURL.prototype, NativeURL.prototype, "_url");
15143
- Object.setPrototypeOf(FastURL.prototype, NativeURL.prototype);
15144
- Object.setPrototypeOf(FastURL, NativeURL);
15145
- return FastURL;
15146
- })();
15147
- //#endregion
15148
- //#region ../../node_modules/.bun/srvx@0.11.13/node_modules/srvx/dist/adapters/node.mjs
15149
- /**
15150
- * Fast Response for Node.js runtime
15151
- *
15152
- * It is faster because in most cases it doesn't create a full Response instance.
15153
- */
15154
- var NodeResponse = /* @__PURE__ */ (() => {
15155
- const NativeResponse = globalThis.Response;
15156
- const STATUS_CODES = globalThis.process?.getBuiltinModule?.("node:http")?.STATUS_CODES || {};
15157
- class NodeResponse {
15158
- #body;
15159
- #init;
15160
- #headers;
15161
- #response;
15162
- constructor(body, init) {
15163
- this.#body = body;
15164
- this.#init = init;
15165
- }
15166
- static [Symbol.hasInstance](val) {
15167
- return val instanceof NativeResponse;
15168
- }
15169
- get status() {
15170
- return this.#response?.status || this.#init?.status || 200;
15171
- }
15172
- get statusText() {
15173
- return this.#response?.statusText || this.#init?.statusText || STATUS_CODES[this.status] || "";
15174
- }
15175
- get headers() {
15176
- if (this.#response) return this.#response.headers;
15177
- if (this.#headers) return this.#headers;
15178
- const initHeaders = this.#init?.headers;
15179
- return this.#headers = initHeaders instanceof Headers ? initHeaders : new Headers(initHeaders);
15180
- }
15181
- get ok() {
15182
- if (this.#response) return this.#response.ok;
15183
- const status = this.status;
15184
- return status >= 200 && status < 300;
15185
- }
15186
- get _response() {
15187
- if (this.#response) return this.#response;
15188
- let body = this.#body;
15189
- if (body && typeof body.pipe === "function" && !(body instanceof Readable)) {
15190
- const stream = new PassThrough();
15191
- body.pipe(stream);
15192
- const abort = body.abort;
15193
- if (abort) stream.once("close", () => abort());
15194
- body = stream;
15195
- }
15196
- this.#response = new NativeResponse(body, this.#headers ? {
15197
- ...this.#init,
15198
- headers: this.#headers
15199
- } : this.#init);
15200
- this.#init = void 0;
15201
- this.#headers = void 0;
15202
- this.#body = void 0;
15203
- return this.#response;
15204
- }
15205
- _toNodeResponse() {
15206
- const status = this.status;
15207
- const statusText = this.statusText;
15208
- let body;
15209
- let contentType;
15210
- let contentLength;
15211
- if (this.#response) body = this.#response.body;
15212
- else if (this.#body) if (this.#body instanceof ReadableStream) body = this.#body;
15213
- else if (typeof this.#body === "string") {
15214
- body = this.#body;
15215
- contentType = "text/plain; charset=UTF-8";
15216
- contentLength = Buffer.byteLength(this.#body);
15217
- } else if (this.#body instanceof ArrayBuffer) {
15218
- body = Buffer.from(this.#body);
15219
- contentLength = this.#body.byteLength;
15220
- } else if (this.#body instanceof Uint8Array) {
15221
- body = this.#body;
15222
- contentLength = this.#body.byteLength;
15223
- } else if (this.#body instanceof DataView) {
15224
- body = Buffer.from(this.#body.buffer);
15225
- contentLength = this.#body.byteLength;
15226
- } else if (this.#body instanceof Blob) {
15227
- body = this.#body.stream();
15228
- contentType = this.#body.type;
15229
- contentLength = this.#body.size;
15230
- } else if (typeof this.#body.pipe === "function") body = this.#body;
15231
- else body = this._response.body;
15232
- const headers = [];
15233
- const initHeaders = this.#init?.headers;
15234
- const headerEntries = this.#response?.headers || this.#headers || (initHeaders ? Array.isArray(initHeaders) ? initHeaders : initHeaders?.entries ? initHeaders.entries() : Object.entries(initHeaders).map(([k, v]) => [k.toLowerCase(), v]) : void 0);
15235
- let hasContentTypeHeader;
15236
- let hasContentLength;
15237
- if (headerEntries) for (const [key, value] of headerEntries) {
15238
- if (Array.isArray(value)) for (const v of value) headers.push([key, v]);
15239
- else headers.push([key, value]);
15240
- if (key === "content-type") hasContentTypeHeader = true;
15241
- else if (key === "content-length") hasContentLength = true;
15242
- }
15243
- if (contentType && !hasContentTypeHeader) headers.push(["content-type", contentType]);
15244
- if (contentLength && !hasContentLength) headers.push(["content-length", String(contentLength)]);
15245
- this.#init = void 0;
15246
- this.#headers = void 0;
15247
- this.#response = void 0;
15248
- this.#body = void 0;
15249
- return {
15250
- status,
15251
- statusText,
15252
- headers,
15253
- body
15254
- };
15255
- }
15256
- }
15257
- lazyInherit(NodeResponse.prototype, NativeResponse.prototype, "_response");
15258
- Object.setPrototypeOf(NodeResponse, NativeResponse);
15259
- Object.setPrototypeOf(NodeResponse.prototype, NativeResponse.prototype);
15260
- return NodeResponse;
15261
- })();
15262
- //#endregion
15263
- //#region ../../node_modules/.bun/h3@2.0.1-rc.16/node_modules/h3/dist/h3-ByfIX5Jk.mjs
15264
- var kEventNS = "h3.internal.event.";
15265
- var kEventRes = /* @__PURE__ */ Symbol.for(`${kEventNS}res`);
15266
- var kEventResHeaders = /* @__PURE__ */ Symbol.for(`${kEventNS}res.headers`);
15267
- var H3Event = class {
15268
- app;
15269
- req;
15270
- url;
15271
- context;
15272
- static __is_event__ = true;
15273
- constructor(req, context, app) {
15274
- this.context = context || req.context || new NullProtoObj();
15275
- this.req = req;
15276
- this.app = app;
15277
- const _url = req._url;
15278
- this.url = _url && _url instanceof URL ? _url : new FastURL(req.url);
15279
- }
15280
- get res() {
15281
- return this[kEventRes] ||= new H3EventResponse();
15282
- }
15283
- get runtime() {
15284
- return this.req.runtime;
15285
- }
15286
- waitUntil(promise) {
15287
- this.req.waitUntil?.(promise);
15288
- }
15289
- toString() {
15290
- return `[${this.req.method}] ${this.req.url}`;
15291
- }
15292
- toJSON() {
15293
- return this.toString();
15294
- }
15295
- get node() {
15296
- return this.req.runtime?.node;
15297
- }
15298
- get headers() {
15299
- return this.req.headers;
15300
- }
15301
- get path() {
15302
- return this.url.pathname + this.url.search;
15303
- }
15304
- get method() {
15305
- return this.req.method;
15306
- }
15307
- };
15308
- var H3EventResponse = class {
15309
- status;
15310
- statusText;
15311
- get headers() {
15312
- return this[kEventResHeaders] ||= new Headers();
15313
- }
15314
- };
15315
- var DISALLOWED_STATUS_CHARS = /[^\u0009\u0020-\u007E]/g;
15316
- function sanitizeStatusMessage(statusMessage = "") {
15317
- return statusMessage.replace(DISALLOWED_STATUS_CHARS, "");
15318
- }
15319
- function sanitizeStatusCode(statusCode, defaultStatusCode = 200) {
15320
- if (!statusCode) return defaultStatusCode;
15321
- if (typeof statusCode === "string") statusCode = +statusCode;
15322
- if (statusCode < 100 || statusCode > 599) return defaultStatusCode;
15323
- return statusCode;
15324
- }
15325
- var HTTPError = class HTTPError extends Error {
15326
- get name() {
15327
- return "HTTPError";
15328
- }
15329
- status;
15330
- statusText;
15331
- headers;
15332
- cause;
15333
- data;
15334
- body;
15335
- unhandled;
15336
- static isError(input) {
15337
- return input instanceof Error && input?.name === "HTTPError";
15338
- }
15339
- static status(status, statusText, details) {
15340
- return new HTTPError({
15341
- ...details,
15342
- statusText,
15343
- status
15344
- });
15345
- }
15346
- constructor(arg1, arg2) {
15347
- let messageInput;
15348
- let details;
15349
- if (typeof arg1 === "string") {
15350
- messageInput = arg1;
15351
- details = arg2;
15352
- } else details = arg1;
15353
- const status = sanitizeStatusCode(details?.status || (details?.cause)?.status || details?.status || details?.statusCode, 500);
15354
- const statusText = sanitizeStatusMessage(details?.statusText || (details?.cause)?.statusText || details?.statusText || details?.statusMessage);
15355
- const message = messageInput || details?.message || (details?.cause)?.message || details?.statusText || details?.statusMessage || [
15356
- "HTTPError",
15357
- status,
15358
- statusText
15359
- ].filter(Boolean).join(" ");
15360
- super(message, { cause: details });
15361
- this.cause = details;
15362
- this.status = status;
15363
- this.statusText = statusText || void 0;
15364
- const rawHeaders = details?.headers || (details?.cause)?.headers;
15365
- this.headers = rawHeaders ? new Headers(rawHeaders) : void 0;
15366
- this.unhandled = details?.unhandled ?? (details?.cause)?.unhandled ?? void 0;
15367
- this.data = details?.data;
15368
- this.body = details?.body;
15369
- }
15370
- get statusCode() {
15371
- return this.status;
15372
- }
15373
- get statusMessage() {
15374
- return this.statusText;
15375
- }
15376
- toJSON() {
15377
- const unhandled = this.unhandled;
15378
- return {
15379
- status: this.status,
15380
- statusText: this.statusText,
15381
- unhandled,
15382
- message: unhandled ? "HTTPError" : this.message,
15383
- data: unhandled ? void 0 : this.data,
15384
- ...unhandled ? void 0 : this.body
15385
- };
15386
- }
15387
- };
15388
- function isJSONSerializable(value, _type) {
15389
- if (value === null || value === void 0) return true;
15390
- if (_type !== "object") return _type === "boolean" || _type === "number" || _type === "string";
15391
- if (typeof value.toJSON === "function") return true;
15392
- if (Array.isArray(value)) return true;
15393
- if (typeof value.pipe === "function" || typeof value.pipeTo === "function") return false;
15394
- if (value instanceof NullProtoObj) return true;
15395
- const proto = Object.getPrototypeOf(value);
15396
- return proto === Object.prototype || proto === null;
15397
- }
15398
- var kNotFound = /* @__PURE__ */ Symbol.for("h3.notFound");
15399
- var kHandled = /* @__PURE__ */ Symbol.for("h3.handled");
15400
- function toResponse(val, event, config = {}) {
15401
- if (typeof val?.then === "function") return (val.catch?.((error) => error) || Promise.resolve(val)).then((resolvedVal) => toResponse(resolvedVal, event, config));
15402
- const response = prepareResponse(val, event, config);
15403
- if (typeof response?.then === "function") return toResponse(response, event, config);
15404
- const { onResponse } = config;
15405
- return onResponse ? Promise.resolve(onResponse(response, event)).then(() => response) : response;
15406
- }
15407
- var HTTPResponse = class {
15408
- #headers;
15409
- #init;
15410
- body;
15411
- constructor(body, init) {
15412
- this.body = body;
15413
- this.#init = init;
15414
- }
15415
- get status() {
15416
- return this.#init?.status || 200;
15417
- }
15418
- get statusText() {
15419
- return this.#init?.statusText || "OK";
15420
- }
15421
- get headers() {
15422
- return this.#headers ||= new Headers(this.#init?.headers);
15423
- }
15424
- };
15425
- function prepareResponse(val, event, config, nested) {
15426
- if (val === kHandled) return new NodeResponse(null);
15427
- if (val === kNotFound) val = new HTTPError({
15428
- status: 404,
15429
- message: `Cannot find any route matching [${event.req.method}] ${event.url}`
15430
- });
15431
- if (val && val instanceof Error) {
15432
- const isHTTPError = HTTPError.isError(val);
15433
- const error = isHTTPError ? val : new HTTPError(val);
15434
- if (!isHTTPError) {
15435
- error.unhandled = true;
15436
- if (val?.stack) error.stack = val.stack;
15437
- }
15438
- if (error.unhandled && !config.silent) console.error(error);
15439
- const { onError } = config;
15440
- return onError && !nested ? Promise.resolve(onError(error, event)).catch((error) => error).then((newVal) => prepareResponse(newVal ?? val, event, config, true)) : errorResponse(error, config.debug);
15441
- }
15442
- const preparedRes = event[kEventRes];
15443
- const preparedHeaders = preparedRes?.[kEventResHeaders];
15444
- event[kEventRes] = void 0;
15445
- if (!(val instanceof Response)) {
15446
- const res = prepareResponseBody(val, event, config);
15447
- const status = res.status || preparedRes?.status;
15448
- return new NodeResponse(nullBody(event.req.method, status) ? null : res.body, {
15449
- status,
15450
- statusText: res.statusText || preparedRes?.statusText,
15451
- headers: res.headers && preparedHeaders ? mergeHeaders$1(res.headers, preparedHeaders) : res.headers || preparedHeaders
15452
- });
15453
- }
15454
- if (!preparedHeaders || nested || !val.ok) return val;
15455
- try {
15456
- mergeHeaders$1(val.headers, preparedHeaders, val.headers);
15457
- return val;
15458
- } catch {
15459
- return new NodeResponse(nullBody(event.req.method, val.status) ? null : val.body, {
15460
- status: val.status,
15461
- statusText: val.statusText,
15462
- headers: mergeHeaders$1(val.headers, preparedHeaders)
15463
- });
15464
- }
15465
- }
15466
- function mergeHeaders$1(base, overrides, target = new Headers(base)) {
15467
- for (const [name, value] of overrides) if (name === "set-cookie") target.append(name, value);
15468
- else target.set(name, value);
15469
- return target;
15470
- }
15471
- var frozen = (name) => (...args) => {
15472
- throw new Error(`Headers are frozen (${name} ${args.join(", ")})`);
15473
- };
15474
- var FrozenHeaders = class extends Headers {
15475
- set = frozen("set");
15476
- append = frozen("append");
15477
- delete = frozen("delete");
15478
- };
15479
- var emptyHeaders = /* @__PURE__ */ new FrozenHeaders({ "content-length": "0" });
15480
- var jsonHeaders = /* @__PURE__ */ new FrozenHeaders({ "content-type": "application/json;charset=UTF-8" });
15481
- function prepareResponseBody(val, event, config) {
15482
- if (val === null || val === void 0) return {
15483
- body: "",
15484
- headers: emptyHeaders
15485
- };
15486
- const valType = typeof val;
15487
- if (valType === "string") return { body: val };
15488
- if (val instanceof Uint8Array) {
15489
- event.res.headers.set("content-length", val.byteLength.toString());
15490
- return { body: val };
15491
- }
15492
- if (val instanceof HTTPResponse || val?.constructor?.name === "HTTPResponse") return val;
15493
- if (isJSONSerializable(val, valType)) return {
15494
- body: JSON.stringify(val, void 0, config.debug ? 2 : void 0),
15495
- headers: jsonHeaders
15496
- };
15497
- if (valType === "bigint") return {
15498
- body: val.toString(),
15499
- headers: jsonHeaders
15500
- };
15501
- if (val instanceof Blob) {
15502
- const headers = new Headers({
15503
- "content-type": val.type,
15504
- "content-length": val.size.toString()
15505
- });
15506
- let filename = val.name;
15507
- if (filename) {
15508
- filename = encodeURIComponent(filename);
15509
- headers.set("content-disposition", `filename="${filename}"; filename*=UTF-8''${filename}`);
15510
- }
15511
- return {
15512
- body: val.stream(),
15513
- headers
15514
- };
15515
- }
15516
- if (valType === "symbol") return { body: val.toString() };
15517
- if (valType === "function") return { body: `${val.name}()` };
15518
- return { body: val };
15519
- }
15520
- function nullBody(method, status) {
15521
- return method === "HEAD" || status === 100 || status === 101 || status === 102 || status === 204 || status === 205 || status === 304;
15522
- }
15523
- function errorResponse(error, debug) {
15524
- return new NodeResponse(JSON.stringify({
15525
- ...error.toJSON(),
15526
- stack: debug && error.stack ? error.stack.split("\n").map((l) => l.trim()) : void 0
15527
- }, void 0, debug ? 2 : void 0), {
15528
- status: error.status,
15529
- statusText: error.statusText,
15530
- headers: error.headers ? mergeHeaders$1(jsonHeaders, error.headers) : new Headers(jsonHeaders)
15531
- });
15532
- }
15533
- new TextEncoder();
15534
- //#endregion
15535
- //#region ../../node_modules/.bun/@tanstack+start-server-core@1.167.3/node_modules/@tanstack/start-server-core/dist/esm/request-response.js
15536
- var GLOBAL_EVENT_STORAGE_KEY = Symbol.for("tanstack-start:event-storage");
15537
- var globalObj$1 = globalThis;
15538
- if (!globalObj$1[GLOBAL_EVENT_STORAGE_KEY]) globalObj$1[GLOBAL_EVENT_STORAGE_KEY] = new AsyncLocalStorage();
15539
- var eventStorage = globalObj$1[GLOBAL_EVENT_STORAGE_KEY];
15540
- function isPromiseLike(value) {
15541
- return typeof value.then === "function";
15542
- }
15543
- function getSetCookieValues(headers) {
15544
- const headersWithSetCookie = headers;
15545
- if (typeof headersWithSetCookie.getSetCookie === "function") return headersWithSetCookie.getSetCookie();
15546
- const value = headers.get("set-cookie");
15547
- return value ? [value] : [];
15548
- }
15549
- function mergeEventResponseHeaders(response, event) {
15550
- if (response.ok) return;
15551
- const eventSetCookies = getSetCookieValues(event.res.headers);
15552
- if (eventSetCookies.length === 0) return;
15553
- const responseSetCookies = getSetCookieValues(response.headers);
15554
- response.headers.delete("set-cookie");
15555
- for (const cookie of responseSetCookies) response.headers.append("set-cookie", cookie);
15556
- for (const cookie of eventSetCookies) response.headers.append("set-cookie", cookie);
15557
- }
15558
- function attachResponseHeaders(value, event) {
15559
- if (isPromiseLike(value)) return value.then((resolved) => {
15560
- if (resolved instanceof Response) mergeEventResponseHeaders(resolved, event);
15561
- return resolved;
15562
- });
15563
- if (value instanceof Response) mergeEventResponseHeaders(value, event);
15564
- return value;
15565
- }
15566
- function requestHandler(handler) {
15567
- return (request, requestOpts) => {
15568
- const h3Event = new H3Event(request);
15569
- return toResponse(attachResponseHeaders(eventStorage.run({ h3Event }, () => handler(request, requestOpts)), h3Event), h3Event);
15570
- };
15571
- }
15572
- function getH3Event() {
15573
- const event = eventStorage.getStore();
15574
- if (!event) throw new Error(`No StartEvent found in AsyncLocalStorage. Make sure you are using the function within the server runtime.`);
15575
- return event.h3Event;
15576
- }
15577
- function getRequest() {
15578
- return getH3Event().req;
15579
- }
15580
- function getResponse() {
15581
- return getH3Event().res;
15582
- }
15583
- //#endregion
15584
11684
  //#region ../../node_modules/.bun/@tanstack+start-server-core@1.167.3/node_modules/@tanstack/start-server-core/dist/esm/constants.js
15585
11685
  var HEADERS = { TSS_SHELL: "X-TSS_SHELL" };
15586
11686
  //#endregion
@@ -15598,7 +11698,7 @@ var HEADERS = { TSS_SHELL: "X-TSS_SHELL" };
15598
11698
  * the dev styles URL for route-scoped CSS collection.
15599
11699
  */
15600
11700
  async function getStartManifest(matchedRoutes) {
15601
- const { tsrStartManifest } = await import("./assets/_tanstack-start-manifest_v-BgMVPPt2.js");
11701
+ const { tsrStartManifest } = await import("./assets/_tanstack-start-manifest_v-CZNmyv5h.js");
15602
11702
  const startManifest = tsrStartManifest();
15603
11703
  const rootRoute = startManifest.routes[rootRouteId] = startManifest.routes["__root__"] || {};
15604
11704
  rootRoute.assets = rootRoute.assets || [];
@@ -15623,264 +11723,6 @@ async function getStartManifest(matchedRoutes) {
15623
11723
  };
15624
11724
  }
15625
11725
  //#endregion
15626
- //#region ../../node_modules/.bun/@tanstack+start-client-core@1.167.3/node_modules/@tanstack/start-client-core/dist/esm/constants.js
15627
- var TSS_FORMDATA_CONTEXT = "__TSS_CONTEXT";
15628
- var TSS_SERVER_FUNCTION = Symbol.for("TSS_SERVER_FUNCTION");
15629
- var TSS_SERVER_FUNCTION_FACTORY = Symbol.for("TSS_SERVER_FUNCTION_FACTORY");
15630
- var X_TSS_SERIALIZED = "x-tss-serialized";
15631
- var X_TSS_RAW_RESPONSE = "x-tss-raw";
15632
- /** Content-Type for multiplexed framed responses (RawStream support) */
15633
- var TSS_CONTENT_TYPE_FRAMED = "application/x-tss-framed";
15634
- /**
15635
- * Frame types for binary multiplexing protocol.
15636
- */
15637
- var FrameType = {
15638
- JSON: 0,
15639
- CHUNK: 1,
15640
- END: 2,
15641
- ERROR: 3
15642
- };
15643
- /** Full Content-Type header value with version parameter */
15644
- var TSS_CONTENT_TYPE_FRAMED_VERSIONED = `${TSS_CONTENT_TYPE_FRAMED}; v=1`;
15645
- //#endregion
15646
- //#region ../../node_modules/.bun/@tanstack+start-client-core@1.167.3/node_modules/@tanstack/start-client-core/dist/esm/safeObjectMerge.js
15647
- function isSafeKey(key) {
15648
- return key !== "__proto__" && key !== "constructor" && key !== "prototype";
15649
- }
15650
- /**
15651
- * Merge target and source into a new null-proto object, filtering dangerous keys.
15652
- */
15653
- function safeObjectMerge(target, source) {
15654
- const result = Object.create(null);
15655
- if (target) {
15656
- for (const key of Object.keys(target)) if (isSafeKey(key)) result[key] = target[key];
15657
- }
15658
- if (source && typeof source === "object") {
15659
- for (const key of Object.keys(source)) if (isSafeKey(key)) result[key] = source[key];
15660
- }
15661
- return result;
15662
- }
15663
- /**
15664
- * Create a null-prototype object, optionally copying from source.
15665
- */
15666
- function createNullProtoObject(source) {
15667
- if (!source) return Object.create(null);
15668
- const obj = Object.create(null);
15669
- for (const key of Object.keys(source)) if (isSafeKey(key)) obj[key] = source[key];
15670
- return obj;
15671
- }
15672
- //#endregion
15673
- //#region ../../node_modules/.bun/@tanstack+start-storage-context@1.166.17/node_modules/@tanstack/start-storage-context/dist/esm/async-local-storage.js
15674
- var GLOBAL_STORAGE_KEY = Symbol.for("tanstack-start:start-storage-context");
15675
- var globalObj = globalThis;
15676
- if (!globalObj[GLOBAL_STORAGE_KEY]) globalObj[GLOBAL_STORAGE_KEY] = new AsyncLocalStorage();
15677
- var startStorage = globalObj[GLOBAL_STORAGE_KEY];
15678
- async function runWithStartContext(context, fn) {
15679
- return startStorage.run(context, fn);
15680
- }
15681
- function getStartContext(opts) {
15682
- const context = startStorage.getStore();
15683
- if (!context && opts?.throwIfNotFound !== false) throw new Error(`No Start context found in AsyncLocalStorage. Make sure you are using the function within the server runtime.`);
15684
- return context;
15685
- }
15686
- //#endregion
15687
- //#region ../../node_modules/.bun/@tanstack+start-client-core@1.167.3/node_modules/@tanstack/start-client-core/dist/esm/getStartOptions.js
15688
- var getStartOptions = () => getStartContext().startOptions;
15689
- //#endregion
15690
- //#region ../../node_modules/.bun/@tanstack+start-client-core@1.167.3/node_modules/@tanstack/start-client-core/dist/esm/getStartContextServerOnly.js
15691
- var getStartContextServerOnly = getStartContext;
15692
- //#endregion
15693
- //#region ../../node_modules/.bun/@tanstack+start-client-core@1.167.3/node_modules/@tanstack/start-client-core/dist/esm/createServerFn.js
15694
- var createServerFn = (options, __opts) => {
15695
- const resolvedOptions = __opts || options || {};
15696
- if (typeof resolvedOptions.method === "undefined") resolvedOptions.method = "GET";
15697
- const res = {
15698
- options: resolvedOptions,
15699
- middleware: (middleware) => {
15700
- const newMiddleware = [...resolvedOptions.middleware || []];
15701
- middleware.map((m) => {
15702
- if (TSS_SERVER_FUNCTION_FACTORY in m) {
15703
- if (m.options.middleware) newMiddleware.push(...m.options.middleware);
15704
- } else newMiddleware.push(m);
15705
- });
15706
- const res = createServerFn(void 0, {
15707
- ...resolvedOptions,
15708
- middleware: newMiddleware
15709
- });
15710
- res[TSS_SERVER_FUNCTION_FACTORY] = true;
15711
- return res;
15712
- },
15713
- inputValidator: (inputValidator) => {
15714
- return createServerFn(void 0, {
15715
- ...resolvedOptions,
15716
- inputValidator
15717
- });
15718
- },
15719
- handler: (...args) => {
15720
- const [extractedFn, serverFn] = args;
15721
- const newOptions = {
15722
- ...resolvedOptions,
15723
- extractedFn,
15724
- serverFn
15725
- };
15726
- const resolvedMiddleware = [...newOptions.middleware || [], serverFnBaseToMiddleware(newOptions)];
15727
- extractedFn.method = resolvedOptions.method;
15728
- return Object.assign(async (opts) => {
15729
- const result = await executeMiddleware$1(resolvedMiddleware, "client", {
15730
- ...extractedFn,
15731
- ...newOptions,
15732
- data: opts?.data,
15733
- headers: opts?.headers,
15734
- signal: opts?.signal,
15735
- fetch: opts?.fetch,
15736
- context: createNullProtoObject()
15737
- });
15738
- const redirect = parseRedirect(result.error);
15739
- if (redirect) throw redirect;
15740
- if (result.error) throw result.error;
15741
- return result.result;
15742
- }, {
15743
- ...extractedFn,
15744
- method: resolvedOptions.method,
15745
- __executeServer: async (opts) => {
15746
- const startContext = getStartContextServerOnly();
15747
- const serverContextAfterGlobalMiddlewares = startContext.contextAfterGlobalMiddlewares;
15748
- return await executeMiddleware$1(resolvedMiddleware, "server", {
15749
- ...extractedFn,
15750
- ...opts,
15751
- serverFnMeta: extractedFn.serverFnMeta,
15752
- context: safeObjectMerge(serverContextAfterGlobalMiddlewares, opts.context),
15753
- request: startContext.request
15754
- }).then((d) => ({
15755
- result: d.result,
15756
- error: d.error,
15757
- context: d.sendContext
15758
- }));
15759
- }
15760
- });
15761
- }
15762
- };
15763
- const fun = (options) => {
15764
- return createServerFn(void 0, {
15765
- ...resolvedOptions,
15766
- ...options
15767
- });
15768
- };
15769
- return Object.assign(fun, res);
15770
- };
15771
- async function executeMiddleware$1(middlewares, env, opts) {
15772
- let flattenedMiddlewares = flattenMiddlewares([...getStartOptions()?.functionMiddleware || [], ...middlewares]);
15773
- if (env === "server") {
15774
- const startContext = getStartContextServerOnly({ throwIfNotFound: false });
15775
- if (startContext?.executedRequestMiddlewares) flattenedMiddlewares = flattenedMiddlewares.filter((m) => !startContext.executedRequestMiddlewares.has(m));
15776
- }
15777
- const callNextMiddleware = async (ctx) => {
15778
- const nextMiddleware = flattenedMiddlewares.shift();
15779
- if (!nextMiddleware) return ctx;
15780
- try {
15781
- if ("inputValidator" in nextMiddleware.options && nextMiddleware.options.inputValidator && env === "server") ctx.data = await execValidator(nextMiddleware.options.inputValidator, ctx.data);
15782
- let middlewareFn = void 0;
15783
- if (env === "client") {
15784
- if ("client" in nextMiddleware.options) middlewareFn = nextMiddleware.options.client;
15785
- } else if ("server" in nextMiddleware.options) middlewareFn = nextMiddleware.options.server;
15786
- if (middlewareFn) {
15787
- const userNext = async (userCtx = {}) => {
15788
- const result = await callNextMiddleware({
15789
- ...ctx,
15790
- ...userCtx,
15791
- context: safeObjectMerge(ctx.context, userCtx.context),
15792
- sendContext: safeObjectMerge(ctx.sendContext, userCtx.sendContext),
15793
- headers: mergeHeaders(ctx.headers, userCtx.headers),
15794
- _callSiteFetch: ctx._callSiteFetch,
15795
- fetch: ctx._callSiteFetch ?? userCtx.fetch ?? ctx.fetch,
15796
- result: userCtx.result !== void 0 ? userCtx.result : userCtx instanceof Response ? userCtx : ctx.result,
15797
- error: userCtx.error ?? ctx.error
15798
- });
15799
- if (result.error) throw result.error;
15800
- return result;
15801
- };
15802
- const result = await middlewareFn({
15803
- ...ctx,
15804
- next: userNext
15805
- });
15806
- if (isRedirect(result)) return {
15807
- ...ctx,
15808
- error: result
15809
- };
15810
- if (result instanceof Response) return {
15811
- ...ctx,
15812
- result
15813
- };
15814
- if (!result) throw new Error("User middleware returned undefined. You must call next() or return a result in your middlewares.");
15815
- return result;
15816
- }
15817
- return callNextMiddleware(ctx);
15818
- } catch (error) {
15819
- return {
15820
- ...ctx,
15821
- error
15822
- };
15823
- }
15824
- };
15825
- return callNextMiddleware({
15826
- ...opts,
15827
- headers: opts.headers || {},
15828
- sendContext: opts.sendContext || {},
15829
- context: opts.context || createNullProtoObject(),
15830
- _callSiteFetch: opts.fetch
15831
- });
15832
- }
15833
- function flattenMiddlewares(middlewares, maxDepth = 100) {
15834
- const seen = /* @__PURE__ */ new Set();
15835
- const flattened = [];
15836
- const recurse = (middleware, depth) => {
15837
- if (depth > maxDepth) throw new Error(`Middleware nesting depth exceeded maximum of ${maxDepth}. Check for circular references.`);
15838
- middleware.forEach((m) => {
15839
- if (m.options.middleware) recurse(m.options.middleware, depth + 1);
15840
- if (!seen.has(m)) {
15841
- seen.add(m);
15842
- flattened.push(m);
15843
- }
15844
- });
15845
- };
15846
- recurse(middlewares, 0);
15847
- return flattened;
15848
- }
15849
- async function execValidator(validator, input) {
15850
- if (validator == null) return {};
15851
- if ("~standard" in validator) {
15852
- const result = await validator["~standard"].validate(input);
15853
- if (result.issues) throw new Error(JSON.stringify(result.issues, void 0, 2));
15854
- return result.value;
15855
- }
15856
- if ("parse" in validator) return validator.parse(input);
15857
- if (typeof validator === "function") return validator(input);
15858
- throw new Error("Invalid validator type!");
15859
- }
15860
- function serverFnBaseToMiddleware(options) {
15861
- return {
15862
- "~types": void 0,
15863
- options: {
15864
- inputValidator: options.inputValidator,
15865
- client: async ({ next, sendContext, fetch, ...ctx }) => {
15866
- const payload = {
15867
- ...ctx,
15868
- context: sendContext,
15869
- fetch
15870
- };
15871
- return next(await options.extractedFn?.(payload));
15872
- },
15873
- server: async ({ next, ...ctx }) => {
15874
- const result = await options.serverFn?.(ctx);
15875
- return next({
15876
- ...ctx,
15877
- result
15878
- });
15879
- }
15880
- }
15881
- };
15882
- }
15883
- //#endregion
15884
11726
  //#region ../../node_modules/.bun/@tanstack+start-client-core@1.167.3/node_modules/@tanstack/start-client-core/dist/esm/getDefaultSerovalPlugins.js
15885
11727
  function getDefaultSerovalPlugins() {
15886
11728
  return [...(getStartOptions()?.serializationAdapters)?.map(makeSerovalPlugin) ?? [], ...defaultSerovalPlugins];
@@ -16404,9 +12246,9 @@ var baseManifestPromise;
16404
12246
  */
16405
12247
  var cachedFinalManifestPromise;
16406
12248
  async function loadEntries() {
16407
- const routerEntry = await import("./assets/router-noqexgr0.js");
12249
+ const routerEntry = await import("./assets/router-B4k1eDGl.js");
16408
12250
  return {
16409
- startEntry: await import("./assets/start-BiybVoR2.js"),
12251
+ startEntry: await import("./assets/start-BYRsG6Vf.js"),
16410
12252
  routerEntry
16411
12253
  };
16412
12254
  }
@@ -16762,10 +12604,11 @@ async function handleServerRoutes({ getRouter, request, url, executeRouter, cont
16762
12604
  * Custom server entry that wraps TanStack Start's default handler
16763
12605
  * to add better-auth API route handling at /api/auth/*.
16764
12606
  */
12607
+ await ensureMigrations();
16765
12608
  var startHandler = createStartHandler(defaultStreamHandler);
16766
12609
  var server_default = { async fetch(request) {
16767
12610
  if (new URL(request.url).pathname.startsWith("/api/auth")) return getAuth().handler(request);
16768
12611
  return startHandler(request);
16769
12612
  } };
16770
12613
  //#endregion
16771
- export { batch as a, getAssetCrossOrigin as c, createNonReactiveMutableStore as d, server_default as default, createNonReactiveReadonlyStore as f, Outlet as i, resolveManifestAssetLink as l, TSS_SERVER_FUNCTION as n, createAtom as o, redirect as p, getRequest as r, toObserver as s, createServerFn as t, RouterCore as u };
12614
+ export { server_default as default };