@baseplate-dev/plugin-auth 4.0.0 → 4.0.2

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 (339) hide show
  1. package/CHANGELOG.md +621 -0
  2. package/dist/auth/core/common.d.ts +2 -5
  3. package/dist/auth/core/common.d.ts.map +1 -1
  4. package/dist/auth/core/common.js +14 -14
  5. package/dist/auth/core/common.js.map +1 -1
  6. package/dist/auth/core/node.d.ts +3 -3
  7. package/dist/auth/core/node.d.ts.map +1 -1
  8. package/dist/auth/core/node.js +5 -8
  9. package/dist/auth/core/node.js.map +1 -1
  10. package/dist/auth/core/web.d.ts +3 -3
  11. package/dist/auth/core/web.d.ts.map +1 -1
  12. package/dist/auth/core/web.js +4 -5
  13. package/dist/auth/core/web.js.map +1 -1
  14. package/dist/auth0/core/common.d.ts +3 -5
  15. package/dist/auth0/core/common.d.ts.map +1 -1
  16. package/dist/auth0/core/common.js +11 -14
  17. package/dist/auth0/core/common.js.map +1 -1
  18. package/dist/auth0/core/node.d.ts +3 -3
  19. package/dist/auth0/core/node.d.ts.map +1 -1
  20. package/dist/auth0/core/node.js +5 -8
  21. package/dist/auth0/core/node.js.map +1 -1
  22. package/dist/auth0/core/schema/plugin-definition.js +1 -1
  23. package/dist/auth0/core/schema/plugin-definition.js.map +1 -1
  24. package/dist/auth0/core/web.d.ts +3 -3
  25. package/dist/auth0/core/web.d.ts.map +1 -1
  26. package/dist/auth0/core/web.js +4 -5
  27. package/dist/auth0/core/web.js.map +1 -1
  28. package/dist/auth0/generators/fastify/auth0-module/templates/module/schema/user-session.queries.ts +1 -1
  29. package/dist/auth0/generators/react/auth0-hooks/auth0-hooks.generator.js +1 -1
  30. package/dist/auth0/generators/react/auth0-hooks/auth0-hooks.generator.js.map +1 -1
  31. package/dist/local-auth/admin/common.d.ts +3 -2
  32. package/dist/local-auth/admin/common.d.ts.map +1 -1
  33. package/dist/local-auth/admin/common.js +6 -7
  34. package/dist/local-auth/admin/common.js.map +1 -1
  35. package/dist/local-auth/admin/node.d.ts +3 -6
  36. package/dist/local-auth/admin/node.d.ts.map +1 -1
  37. package/dist/local-auth/admin/node.js +13 -12
  38. package/dist/local-auth/admin/node.js.map +1 -1
  39. package/dist/local-auth/admin/web.d.ts +3 -4
  40. package/dist/local-auth/admin/web.d.ts.map +1 -1
  41. package/dist/local-auth/admin/web.js +22 -21
  42. package/dist/local-auth/admin/web.js.map +1 -1
  43. package/dist/local-auth/constants/model-names.d.ts +4 -0
  44. package/dist/local-auth/constants/model-names.d.ts.map +1 -1
  45. package/dist/local-auth/constants/model-names.js +4 -0
  46. package/dist/local-auth/constants/model-names.js.map +1 -1
  47. package/dist/local-auth/core/common.d.ts +3 -5
  48. package/dist/local-auth/core/common.d.ts.map +1 -1
  49. package/dist/local-auth/core/common.js +10 -13
  50. package/dist/local-auth/core/common.js.map +1 -1
  51. package/dist/local-auth/core/generators/auth-email-password/auth-email-password.generator.d.ts +49 -0
  52. package/dist/local-auth/core/generators/auth-email-password/auth-email-password.generator.d.ts.map +1 -1
  53. package/dist/local-auth/core/generators/auth-email-password/auth-email-password.generator.js +17 -6
  54. package/dist/local-auth/core/generators/auth-email-password/auth-email-password.generator.js.map +1 -1
  55. package/dist/local-auth/core/generators/auth-email-password/generated/index.d.ts +209 -0
  56. package/dist/local-auth/core/generators/auth-email-password/generated/index.d.ts.map +1 -1
  57. package/dist/local-auth/core/generators/auth-email-password/generated/template-paths.d.ts +5 -0
  58. package/dist/local-auth/core/generators/auth-email-password/generated/template-paths.d.ts.map +1 -1
  59. package/dist/local-auth/core/generators/auth-email-password/generated/template-paths.js +5 -0
  60. package/dist/local-auth/core/generators/auth-email-password/generated/template-paths.js.map +1 -1
  61. package/dist/local-auth/core/generators/auth-email-password/generated/template-renderers.d.ts +47 -1
  62. package/dist/local-auth/core/generators/auth-email-password/generated/template-renderers.d.ts.map +1 -1
  63. package/dist/local-auth/core/generators/auth-email-password/generated/template-renderers.js +48 -2
  64. package/dist/local-auth/core/generators/auth-email-password/generated/template-renderers.js.map +1 -1
  65. package/dist/local-auth/core/generators/auth-email-password/generated/ts-import-providers.d.ts +18 -0
  66. package/dist/local-auth/core/generators/auth-email-password/generated/ts-import-providers.d.ts.map +1 -1
  67. package/dist/local-auth/core/generators/auth-email-password/generated/ts-import-providers.js +12 -0
  68. package/dist/local-auth/core/generators/auth-email-password/generated/ts-import-providers.js.map +1 -1
  69. package/dist/local-auth/core/generators/auth-email-password/generated/typed-templates.d.ts +253 -0
  70. package/dist/local-auth/core/generators/auth-email-password/generated/typed-templates.d.ts.map +1 -1
  71. package/dist/local-auth/core/generators/auth-email-password/generated/typed-templates.js +102 -4
  72. package/dist/local-auth/core/generators/auth-email-password/generated/typed-templates.js.map +1 -1
  73. package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/password.constants.d.ts +15 -0
  74. package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/password.constants.d.ts.map +1 -1
  75. package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/password.constants.js +15 -0
  76. package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/password.constants.js.map +1 -1
  77. package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/password.constants.ts +18 -0
  78. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/email-verification.mutations.d.ts +2 -0
  79. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/email-verification.mutations.d.ts.map +1 -0
  80. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/email-verification.mutations.js +24 -0
  81. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/email-verification.mutations.js.map +1 -0
  82. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/email-verification.mutations.ts +35 -0
  83. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/password-reset.mutations.d.ts +2 -0
  84. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/password-reset.mutations.d.ts.map +1 -0
  85. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/password-reset.mutations.js +38 -0
  86. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/password-reset.mutations.js.map +1 -0
  87. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/password-reset.mutations.ts +54 -0
  88. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/auth-verification.service.d.ts +40 -0
  89. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/auth-verification.service.d.ts.map +1 -0
  90. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/auth-verification.service.js +106 -0
  91. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/auth-verification.service.js.map +1 -0
  92. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/auth-verification.service.ts +146 -0
  93. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-verification.service.d.ts +24 -0
  94. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-verification.service.d.ts.map +1 -0
  95. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-verification.service.js +88 -0
  96. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-verification.service.js.map +1 -0
  97. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-verification.service.ts +141 -0
  98. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.d.ts +35 -0
  99. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.d.ts.map +1 -0
  100. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.js +157 -0
  101. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.js.map +1 -0
  102. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.ts +233 -0
  103. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/user-password.service.d.ts.map +1 -1
  104. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/user-password.service.js +48 -14
  105. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/user-password.service.js.map +1 -1
  106. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/user-password.service.ts +79 -15
  107. package/dist/local-auth/core/generators/auth-email-templates/auth-email-templates.generator.d.ts +43 -0
  108. package/dist/local-auth/core/generators/auth-email-templates/auth-email-templates.generator.d.ts.map +1 -0
  109. package/dist/local-auth/core/generators/auth-email-templates/auth-email-templates.generator.js +48 -0
  110. package/dist/local-auth/core/generators/auth-email-templates/auth-email-templates.generator.js.map +1 -0
  111. package/dist/local-auth/core/generators/auth-email-templates/generated/index.d.ts +96 -0
  112. package/dist/local-auth/core/generators/auth-email-templates/generated/index.d.ts.map +1 -0
  113. package/dist/local-auth/core/generators/auth-email-templates/generated/index.js +11 -0
  114. package/dist/local-auth/core/generators/auth-email-templates/generated/index.js.map +1 -0
  115. package/dist/local-auth/core/generators/auth-email-templates/generated/template-paths.d.ts +14 -0
  116. package/dist/local-auth/core/generators/auth-email-templates/generated/template-paths.d.ts.map +1 -0
  117. package/dist/local-auth/core/generators/auth-email-templates/generated/template-paths.js +26 -0
  118. package/dist/local-auth/core/generators/auth-email-templates/generated/template-paths.js.map +1 -0
  119. package/dist/local-auth/core/generators/auth-email-templates/generated/template-renderers.d.ts +41 -0
  120. package/dist/local-auth/core/generators/auth-email-templates/generated/template-renderers.d.ts.map +1 -0
  121. package/dist/local-auth/core/generators/auth-email-templates/generated/template-renderers.js +59 -0
  122. package/dist/local-auth/core/generators/auth-email-templates/generated/template-renderers.js.map +1 -0
  123. package/dist/local-auth/core/generators/auth-email-templates/generated/typed-templates.d.ts +60 -0
  124. package/dist/local-auth/core/generators/auth-email-templates/generated/typed-templates.d.ts.map +1 -0
  125. package/dist/local-auth/core/generators/auth-email-templates/generated/typed-templates.js +42 -0
  126. package/dist/local-auth/core/generators/auth-email-templates/generated/typed-templates.js.map +1 -0
  127. package/dist/local-auth/core/generators/auth-email-templates/index.d.ts +2 -0
  128. package/dist/local-auth/core/generators/auth-email-templates/index.d.ts.map +1 -0
  129. package/dist/local-auth/core/generators/auth-email-templates/index.js +2 -0
  130. package/dist/local-auth/core/generators/auth-email-templates/index.js.map +1 -0
  131. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/account-verification.email.d.ts +3 -0
  132. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/account-verification.email.d.ts.map +1 -0
  133. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/account-verification.email.js +14 -0
  134. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/account-verification.email.js.map +1 -0
  135. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/account-verification.email.tsx +55 -0
  136. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/password-changed.email.d.ts +3 -0
  137. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/password-changed.email.d.ts.map +1 -0
  138. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/password-changed.email.js +12 -0
  139. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/password-changed.email.js.map +1 -0
  140. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/password-changed.email.tsx +44 -0
  141. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/password-reset.email.d.ts +3 -0
  142. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/password-reset.email.d.ts.map +1 -0
  143. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/password-reset.email.js +14 -0
  144. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/password-reset.email.js.map +1 -0
  145. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/password-reset.email.tsx +55 -0
  146. package/dist/local-auth/core/generators/auth-module/auth-module.generator.d.ts +1 -0
  147. package/dist/local-auth/core/generators/auth-module/auth-module.generator.d.ts.map +1 -1
  148. package/dist/local-auth/core/generators/auth-module/auth-module.generator.js +1 -1
  149. package/dist/local-auth/core/generators/auth-module/auth-module.generator.js.map +1 -1
  150. package/dist/local-auth/core/generators/auth-module/generated/index.d.ts +2 -0
  151. package/dist/local-auth/core/generators/auth-module/generated/index.d.ts.map +1 -1
  152. package/dist/local-auth/core/generators/auth-module/generated/template-renderers.d.ts +1 -0
  153. package/dist/local-auth/core/generators/auth-module/generated/template-renderers.d.ts.map +1 -1
  154. package/dist/local-auth/core/generators/auth-module/generated/typed-templates.d.ts +1 -0
  155. package/dist/local-auth/core/generators/auth-module/generated/typed-templates.d.ts.map +1 -1
  156. package/dist/local-auth/core/generators/auth-module/templates/module/schema/user-session.mutations.js +1 -1
  157. package/dist/local-auth/core/generators/auth-module/templates/module/schema/user-session.mutations.js.map +1 -1
  158. package/dist/local-auth/core/generators/auth-module/templates/module/schema/user-session.mutations.ts +1 -1
  159. package/dist/local-auth/core/generators/auth-module/templates/module/schema/user-session.queries.js +2 -2
  160. package/dist/local-auth/core/generators/auth-module/templates/module/schema/user-session.queries.js.map +1 -1
  161. package/dist/local-auth/core/generators/auth-module/templates/module/schema/user-session.queries.ts +2 -2
  162. package/dist/local-auth/core/generators/auth-routes/auth-routes.generator.d.ts.map +1 -1
  163. package/dist/local-auth/core/generators/auth-routes/auth-routes.generator.js +1 -0
  164. package/dist/local-auth/core/generators/auth-routes/auth-routes.generator.js.map +1 -1
  165. package/dist/local-auth/core/generators/auth-routes/generated/index.d.ts +722 -4
  166. package/dist/local-auth/core/generators/auth-routes/generated/index.d.ts.map +1 -1
  167. package/dist/local-auth/core/generators/auth-routes/generated/index.js +2 -0
  168. package/dist/local-auth/core/generators/auth-routes/generated/index.js.map +1 -1
  169. package/dist/local-auth/core/generators/auth-routes/generated/template-paths.d.ts +4 -0
  170. package/dist/local-auth/core/generators/auth-routes/generated/template-paths.d.ts.map +1 -1
  171. package/dist/local-auth/core/generators/auth-routes/generated/template-paths.js +4 -0
  172. package/dist/local-auth/core/generators/auth-routes/generated/template-paths.js.map +1 -1
  173. package/dist/local-auth/core/generators/auth-routes/generated/template-renderers.d.ts +4 -1
  174. package/dist/local-auth/core/generators/auth-routes/generated/template-renderers.d.ts.map +1 -1
  175. package/dist/local-auth/core/generators/auth-routes/generated/template-renderers.js +14 -0
  176. package/dist/local-auth/core/generators/auth-routes/generated/template-renderers.js.map +1 -1
  177. package/dist/local-auth/core/generators/auth-routes/generated/ts-import-providers.d.ts +21 -0
  178. package/dist/local-auth/core/generators/auth-routes/generated/ts-import-providers.d.ts.map +1 -0
  179. package/dist/local-auth/core/generators/auth-routes/generated/ts-import-providers.js +30 -0
  180. package/dist/local-auth/core/generators/auth-routes/generated/ts-import-providers.js.map +1 -0
  181. package/dist/local-auth/core/generators/auth-routes/generated/typed-templates.d.ts +1216 -34
  182. package/dist/local-auth/core/generators/auth-routes/generated/typed-templates.d.ts.map +1 -1
  183. package/dist/local-auth/core/generators/auth-routes/generated/typed-templates.js +70 -2
  184. package/dist/local-auth/core/generators/auth-routes/generated/typed-templates.js.map +1 -1
  185. package/dist/local-auth/core/generators/auth-routes/index.d.ts +2 -0
  186. package/dist/local-auth/core/generators/auth-routes/index.d.ts.map +1 -1
  187. package/dist/local-auth/core/generators/auth-routes/index.js +1 -0
  188. package/dist/local-auth/core/generators/auth-routes/index.js.map +1 -1
  189. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/-constants.d.ts +10 -0
  190. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/-constants.d.ts.map +1 -0
  191. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/-constants.js +11 -0
  192. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/-constants.js.map +1 -0
  193. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/-constants.ts +12 -0
  194. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/forgot-password.d.ts +2 -0
  195. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/forgot-password.d.ts.map +1 -0
  196. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/forgot-password.js +60 -0
  197. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/forgot-password.js.map +1 -0
  198. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/forgot-password.tsx +127 -0
  199. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login.d.ts +1 -1
  200. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login.d.ts.map +1 -1
  201. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login.js +6 -11
  202. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login.js.map +1 -1
  203. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login.tsx +20 -19
  204. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/register.d.ts +1 -1
  205. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/register.d.ts.map +1 -1
  206. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/register.js +2 -2
  207. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/register.js.map +1 -1
  208. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/register.tsx +2 -3
  209. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/reset-password.d.ts +7 -0
  210. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/reset-password.d.ts.map +1 -0
  211. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/reset-password.js +131 -0
  212. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/reset-password.js.map +1 -0
  213. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/reset-password.tsx +240 -0
  214. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/verify-email.d.ts +7 -0
  215. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/verify-email.d.ts.map +1 -0
  216. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/verify-email.js +106 -0
  217. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/verify-email.js.map +1 -0
  218. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/verify-email.tsx +206 -0
  219. package/dist/local-auth/core/generators/index.d.ts +1 -0
  220. package/dist/local-auth/core/generators/index.d.ts.map +1 -1
  221. package/dist/local-auth/core/generators/index.js +1 -0
  222. package/dist/local-auth/core/generators/index.js.map +1 -1
  223. package/dist/local-auth/core/generators/seed-initial-user/generated/index.d.ts +12 -0
  224. package/dist/local-auth/core/generators/seed-initial-user/generated/index.d.ts.map +1 -1
  225. package/dist/local-auth/core/generators/seed-initial-user/generated/template-renderers.d.ts +6 -0
  226. package/dist/local-auth/core/generators/seed-initial-user/generated/template-renderers.d.ts.map +1 -1
  227. package/dist/local-auth/core/generators/seed-initial-user/generated/typed-templates.d.ts +6 -0
  228. package/dist/local-auth/core/generators/seed-initial-user/generated/typed-templates.d.ts.map +1 -1
  229. package/dist/local-auth/core/generators/seed-initial-user/seed-initial-user.generator.d.ts +6 -0
  230. package/dist/local-auth/core/generators/seed-initial-user/seed-initial-user.generator.d.ts.map +1 -1
  231. package/dist/local-auth/core/generators/seed-initial-user/seed-initial-user.generator.js +1 -1
  232. package/dist/local-auth/core/generators/seed-initial-user/seed-initial-user.generator.js.map +1 -1
  233. package/dist/local-auth/core/node.d.ts +3 -3
  234. package/dist/local-auth/core/node.d.ts.map +1 -1
  235. package/dist/local-auth/core/node.js +16 -9
  236. package/dist/local-auth/core/node.js.map +1 -1
  237. package/dist/local-auth/core/schema/models.d.ts.map +1 -1
  238. package/dist/local-auth/core/schema/models.js +60 -0
  239. package/dist/local-auth/core/schema/models.js.map +1 -1
  240. package/dist/local-auth/core/web.d.ts +3 -3
  241. package/dist/local-auth/core/web.d.ts.map +1 -1
  242. package/dist/local-auth/core/web.js +4 -5
  243. package/dist/local-auth/core/web.js.map +1 -1
  244. package/dist/placeholder-auth/core/common.d.ts +2 -5
  245. package/dist/placeholder-auth/core/common.d.ts.map +1 -1
  246. package/dist/placeholder-auth/core/common.js +10 -13
  247. package/dist/placeholder-auth/core/common.js.map +1 -1
  248. package/dist/placeholder-auth/core/node.d.ts +3 -3
  249. package/dist/placeholder-auth/core/node.d.ts.map +1 -1
  250. package/dist/placeholder-auth/core/node.js +5 -8
  251. package/dist/placeholder-auth/core/node.js.map +1 -1
  252. package/dist/placeholder-auth/core/schema/plugin-definition.js +1 -1
  253. package/dist/placeholder-auth/core/schema/plugin-definition.js.map +1 -1
  254. package/dist/placeholder-auth/core/web.d.ts +3 -3
  255. package/dist/placeholder-auth/core/web.d.ts.map +1 -1
  256. package/dist/placeholder-auth/core/web.js +4 -5
  257. package/dist/placeholder-auth/core/web.js.map +1 -1
  258. package/dist/web/assets/__federation_expose_auth0CoreCommon-DKJVe6Rd.js +40 -0
  259. package/dist/web/assets/__federation_expose_auth0CoreCommon-DKJVe6Rd.js.map +1 -0
  260. package/dist/web/assets/{__federation_expose_auth0CoreWeb-CZueDXPK.js → __federation_expose_auth0CoreWeb-CfhSWZsK.js} +9 -10
  261. package/dist/web/assets/{__federation_expose_auth0CoreWeb-CZueDXPK.js.map → __federation_expose_auth0CoreWeb-CfhSWZsK.js.map} +1 -1
  262. package/dist/web/assets/__federation_expose_authCoreCommon-D3-Gk9mI.js +29 -0
  263. package/dist/web/assets/__federation_expose_authCoreCommon-D3-Gk9mI.js.map +1 -0
  264. package/dist/web/assets/{__federation_expose_authCoreWeb-C8rgnA2v.js → __federation_expose_authCoreWeb-DZoAij9e.js} +10 -11
  265. package/dist/web/assets/{__federation_expose_authCoreWeb-C8rgnA2v.js.map → __federation_expose_authCoreWeb-DZoAij9e.js.map} +1 -1
  266. package/dist/web/assets/{__federation_expose_local-authAdminCommon-C75-DAzO.js → __federation_expose_local-authAdminCommon-BRHnF0Hn.js} +8 -9
  267. package/dist/web/assets/__federation_expose_local-authAdminCommon-BRHnF0Hn.js.map +1 -0
  268. package/dist/web/assets/__federation_expose_local-authAdminWeb-dYAIxuqC.js +41 -0
  269. package/dist/web/assets/__federation_expose_local-authAdminWeb-dYAIxuqC.js.map +1 -0
  270. package/dist/web/assets/__federation_expose_local-authCoreCommon-CIwvOx0d.js +21 -0
  271. package/dist/web/assets/__federation_expose_local-authCoreCommon-CIwvOx0d.js.map +1 -0
  272. package/dist/web/assets/{__federation_expose_local-authCoreWeb-ChyvdsRq.js → __federation_expose_local-authCoreWeb-Bwooi2qZ.js} +70 -11
  273. package/dist/web/assets/__federation_expose_local-authCoreWeb-Bwooi2qZ.js.map +1 -0
  274. package/dist/web/assets/__federation_expose_placeholder-authCoreCommon-gFDSzGjB.js +23 -0
  275. package/dist/web/assets/__federation_expose_placeholder-authCoreCommon-gFDSzGjB.js.map +1 -0
  276. package/dist/web/assets/{__federation_expose_placeholder-authCoreWeb-CT8JKYLB.js → __federation_expose_placeholder-authCoreWeb-BZLwIkLk.js} +9 -13
  277. package/dist/web/assets/{__federation_expose_placeholder-authCoreWeb-CT8JKYLB.js.map → __federation_expose_placeholder-authCoreWeb-BZLwIkLk.js.map} +1 -1
  278. package/dist/web/assets/{__federation_fn_import-C_QCk5FX.js → __federation_fn_import-pxYUpmb_.js} +2 -2
  279. package/dist/web/assets/{__federation_fn_import-C_QCk5FX.js.map → __federation_fn_import-pxYUpmb_.js.map} +1 -1
  280. package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib/{web-DtztAtUw.js → web-BXi2UCP-.js} +39 -120
  281. package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib/web-BXi2UCP-.js.map +1 -0
  282. package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib-O0clDXMb.js +17445 -0
  283. package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib-O0clDXMb.js.map +1 -0
  284. package/dist/web/assets/__federation_shared_@baseplate-dev/ui-components-BpuFQk6s.js +52536 -0
  285. package/dist/web/assets/__federation_shared_@baseplate-dev/ui-components-BpuFQk6s.js.map +1 -0
  286. package/dist/web/assets/__federation_shared_@baseplate-dev/{utils-Bxy-1ETU.js → utils-UiZ-8JBg.js} +30 -10
  287. package/dist/web/assets/__federation_shared_@baseplate-dev/utils-UiZ-8JBg.js.map +1 -0
  288. package/dist/web/assets/__federation_shared_@tanstack/{react-router-DooFj-IS.js → react-router-BPEAtEJI.js} +1069 -746
  289. package/dist/web/assets/__federation_shared_@tanstack/react-router-BPEAtEJI.js.map +1 -0
  290. package/dist/web/assets/{get-auth-plugin-definition-D2XMaoy7.js → get-auth-plugin-definition-DPsrvQbo.js} +2 -2
  291. package/dist/web/assets/{get-auth-plugin-definition-D2XMaoy7.js.map → get-auth-plugin-definition-DPsrvQbo.js.map} +1 -1
  292. package/dist/web/assets/{index-DwJT6_Wn.js → index-CSfs0UAV.js} +2 -2
  293. package/dist/web/assets/{index-DwJT6_Wn.js.map → index-CSfs0UAV.js.map} +1 -1
  294. package/dist/web/assets/{index.esm-ChwWPPiL.js → index.esm-BoRQu8mM.js} +2 -2
  295. package/dist/web/assets/{index.esm-ChwWPPiL.js.map → index.esm-BoRQu8mM.js.map} +1 -1
  296. package/dist/web/assets/{isEqual-DAXqKRba.js → isEqual-BQtm2LNT.js} +5 -5
  297. package/dist/web/assets/{isEqual-DAXqKRba.js.map → isEqual-BQtm2LNT.js.map} +1 -1
  298. package/dist/web/assets/{model-merger-gGkFnyaY.js → model-merger-CdjliK9v.js} +266 -101
  299. package/dist/web/assets/model-merger-CdjliK9v.js.map +1 -0
  300. package/dist/web/assets/{model-names-CEoSIalq.js → model-names-DrcaRxt1.js} +6 -2
  301. package/dist/web/assets/{model-names-CEoSIalq.js.map → model-names-DrcaRxt1.js.map} +1 -1
  302. package/dist/web/assets/{plugin-definition-rpMj4pr8.js → plugin-definition-BG6tu7Hh.js} +3 -3
  303. package/dist/web/assets/plugin-definition-BG6tu7Hh.js.map +1 -0
  304. package/dist/web/assets/{plugin-definition-QRBMcFiG.js → plugin-definition-BMYDEj3f.js} +3 -3
  305. package/dist/web/assets/plugin-definition-BMYDEj3f.js.map +1 -0
  306. package/dist/web/assets/{plugin-definition-hAzbWO7b.js → plugin-definition-DRhTuQas.js} +2 -2
  307. package/dist/web/assets/{plugin-definition-hAzbWO7b.js.map → plugin-definition-DRhTuQas.js.map} +1 -1
  308. package/dist/web/assets/{plugin-definition-_slrOM0G.js → plugin-definition-j1nJ0FFI.js} +2 -2
  309. package/dist/web/assets/{plugin-definition-_slrOM0G.js.map → plugin-definition-j1nJ0FFI.js.map} +1 -1
  310. package/dist/web/assets/{react-DbX1FP85.js → react-CBhSWxr_.js} +2 -2
  311. package/dist/web/assets/{react-DbX1FP85.js.map → react-CBhSWxr_.js.map} +1 -1
  312. package/dist/web/assets/remoteEntry.js +20 -20
  313. package/dist/web/assets/{style-DZ-aOCkd.css → style-DiK_rD1L.css} +1 -1
  314. package/dist/web/assets/{styles-DqLt1Blm.js → styles-BbHyE-2h.js} +3 -3
  315. package/dist/web/assets/{styles-DqLt1Blm.js.map → styles-BbHyE-2h.js.map} +1 -1
  316. package/dist/web/index.html +1 -1
  317. package/package.json +23 -20
  318. package/dist/web/assets/__federation_expose_auth0CoreCommon-Ga9LD3d6.js +0 -43
  319. package/dist/web/assets/__federation_expose_auth0CoreCommon-Ga9LD3d6.js.map +0 -1
  320. package/dist/web/assets/__federation_expose_authCoreCommon-BrTLsuJC.js +0 -29
  321. package/dist/web/assets/__federation_expose_authCoreCommon-BrTLsuJC.js.map +0 -1
  322. package/dist/web/assets/__federation_expose_local-authAdminCommon-C75-DAzO.js.map +0 -1
  323. package/dist/web/assets/__federation_expose_local-authAdminWeb-D2xGvwyL.js +0 -40
  324. package/dist/web/assets/__federation_expose_local-authAdminWeb-D2xGvwyL.js.map +0 -1
  325. package/dist/web/assets/__federation_expose_local-authCoreCommon-BFUbyPYg.js +0 -27
  326. package/dist/web/assets/__federation_expose_local-authCoreCommon-BFUbyPYg.js.map +0 -1
  327. package/dist/web/assets/__federation_expose_local-authCoreWeb-ChyvdsRq.js.map +0 -1
  328. package/dist/web/assets/__federation_expose_placeholder-authCoreCommon-DrFV9FSW.js +0 -26
  329. package/dist/web/assets/__federation_expose_placeholder-authCoreCommon-DrFV9FSW.js.map +0 -1
  330. package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib/web-DtztAtUw.js.map +0 -1
  331. package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib-CcNtL_U6.js +0 -10507
  332. package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib-CcNtL_U6.js.map +0 -1
  333. package/dist/web/assets/__federation_shared_@baseplate-dev/ui-components-DA_4I2Vy.js +0 -24082
  334. package/dist/web/assets/__federation_shared_@baseplate-dev/ui-components-DA_4I2Vy.js.map +0 -1
  335. package/dist/web/assets/__federation_shared_@baseplate-dev/utils-Bxy-1ETU.js.map +0 -1
  336. package/dist/web/assets/__federation_shared_@tanstack/react-router-DooFj-IS.js.map +0 -1
  337. package/dist/web/assets/model-merger-gGkFnyaY.js.map +0 -1
  338. package/dist/web/assets/plugin-definition-QRBMcFiG.js.map +0 -1
  339. package/dist/web/assets/plugin-definition-rpMj4pr8.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { importShared } from '../__federation_fn_import-C_QCk5FX.js';
1
+ import { importShared } from '../__federation_fn_import-pxYUpmb_.js';
2
2
  import { j as jsxRuntimeExports } from '../jsx-runtime-XI9uIe3W.js';
3
3
  import { r as requireReact } from '../index-DUwCgkeV.js';
4
4
 
@@ -171,7 +171,7 @@ function __flush(store) {
171
171
  __initialBatchValues.clear();
172
172
  }
173
173
  }
174
- function batch(fn) {
174
+ function batch$1(fn) {
175
175
  __batchDepth++;
176
176
  try {
177
177
  fn();
@@ -578,6 +578,9 @@ function createMemoryHistory(opts = {
578
578
  (_entry, index2) => assignKeyAndIndex(index2, void 0)
579
579
  );
580
580
  const getLocation = () => parseHref(entries[index], states[index]);
581
+ let blockers = [];
582
+ const _getBlockers = () => blockers;
583
+ const _setBlockers = (newBlockers) => blockers = newBlockers;
581
584
  return createHistory({
582
585
  getLocation,
583
586
  getLength: () => entries.length,
@@ -603,21 +606,34 @@ function createMemoryHistory(opts = {
603
606
  go: (n) => {
604
607
  index = Math.min(Math.max(index + n, 0), entries.length - 1);
605
608
  },
606
- createHref: (path) => path
609
+ createHref: (path) => path,
610
+ getBlockers: _getBlockers,
611
+ setBlockers: _setBlockers
607
612
  });
608
613
  }
614
+ function sanitizePath(path) {
615
+ let sanitized = path.replace(/[\x00-\x1f\x7f]/g, "");
616
+ if (sanitized.startsWith("//")) {
617
+ sanitized = "/" + sanitized.replace(/^\/+/, "");
618
+ }
619
+ return sanitized;
620
+ }
609
621
  function parseHref(href, state) {
610
- const hashIndex = href.indexOf("#");
611
- const searchIndex = href.indexOf("?");
622
+ const sanitizedHref = sanitizePath(href);
623
+ const hashIndex = sanitizedHref.indexOf("#");
624
+ const searchIndex = sanitizedHref.indexOf("?");
612
625
  const addedKey = createRandomKey();
613
626
  return {
614
- href,
615
- pathname: href.substring(
627
+ href: sanitizedHref,
628
+ pathname: sanitizedHref.substring(
616
629
  0,
617
- hashIndex > 0 ? searchIndex > 0 ? Math.min(hashIndex, searchIndex) : hashIndex : searchIndex > 0 ? searchIndex : href.length
630
+ hashIndex > 0 ? searchIndex > 0 ? Math.min(hashIndex, searchIndex) : hashIndex : searchIndex > 0 ? searchIndex : sanitizedHref.length
618
631
  ),
619
- hash: hashIndex > -1 ? href.substring(hashIndex) : "",
620
- search: searchIndex > -1 ? href.slice(searchIndex, hashIndex === -1 ? void 0 : hashIndex) : "",
632
+ hash: hashIndex > -1 ? sanitizedHref.substring(hashIndex) : "",
633
+ search: searchIndex > -1 ? sanitizedHref.slice(
634
+ searchIndex,
635
+ hashIndex === -1 ? void 0 : hashIndex
636
+ ) : "",
621
637
  state: state || { [stateIndexKey]: 0, key: addedKey, __TSR_key: addedKey }
622
638
  };
623
639
  }
@@ -625,6 +641,16 @@ function createRandomKey() {
625
641
  return (Math.random() + 1).toString(36).substring(7);
626
642
  }
627
643
 
644
+ const isServer = false;
645
+
646
+ function batch(fn) {
647
+ let result;
648
+ batch$1(() => {
649
+ result = fn();
650
+ });
651
+ return result;
652
+ }
653
+
628
654
  function last(arr) {
629
655
  return arr[arr.length - 1];
630
656
  }
@@ -638,10 +664,12 @@ function functionalUpdate(updater, previous) {
638
664
  return updater;
639
665
  }
640
666
  const hasOwn = Object.prototype.hasOwnProperty;
641
- function replaceEqualDeep(prev, _next) {
667
+ const isEnumerable = Object.prototype.propertyIsEnumerable;
668
+ function replaceEqualDeep(prev, _next, _depth = 0) {
642
669
  if (prev === _next) {
643
670
  return prev;
644
671
  }
672
+ if (_depth > 500) return _next;
645
673
  const next = _next;
646
674
  const array = isPlainArray(prev) && isPlainArray(next);
647
675
  if (!array && !(isPlainObject(prev) && isPlainObject(next))) return next;
@@ -666,22 +694,22 @@ function replaceEqualDeep(prev, _next) {
666
694
  copy[key] = n;
667
695
  continue;
668
696
  }
669
- const v = replaceEqualDeep(p, n);
697
+ const v = replaceEqualDeep(p, n, _depth + 1);
670
698
  copy[key] = v;
671
699
  if (v === p) equalItems++;
672
700
  }
673
701
  return prevSize === nextSize && equalItems === prevSize ? prev : copy;
674
702
  }
675
703
  function getEnumerableOwnKeys(o) {
676
- const keys = [];
677
704
  const names = Object.getOwnPropertyNames(o);
678
705
  for (const name of names) {
679
- if (!Object.prototype.propertyIsEnumerable.call(o, name)) return false;
680
- keys.push(name);
706
+ if (!isEnumerable.call(o, name)) return false;
681
707
  }
682
708
  const symbols = Object.getOwnPropertySymbols(o);
709
+ if (symbols.length === 0) return names;
710
+ const keys = names;
683
711
  for (const symbol of symbols) {
684
- if (!Object.prototype.propertyIsEnumerable.call(o, symbol)) return false;
712
+ if (!isEnumerable.call(o, symbol)) return false;
685
713
  keys.push(symbol);
686
714
  }
687
715
  return keys;
@@ -781,11 +809,15 @@ function isPromise(value) {
781
809
  value && typeof value === "object" && typeof value.then === "function"
782
810
  );
783
811
  }
812
+ function sanitizePathSegment(segment) {
813
+ return segment.replace(/[\x00-\x1f\x7f]/g, "");
814
+ }
784
815
  function decodeSegment(segment) {
816
+ let decoded;
785
817
  try {
786
- return decodeURI(segment);
818
+ decoded = decodeURI(segment);
787
819
  } catch {
788
- return segment.replaceAll(/%[0-9A-F]{2}/gi, (match) => {
820
+ decoded = segment.replaceAll(/%[0-9A-F]{2}/gi, (match) => {
789
821
  try {
790
822
  return decodeURI(match);
791
823
  } catch {
@@ -793,9 +825,34 @@ function decodeSegment(segment) {
793
825
  }
794
826
  });
795
827
  }
828
+ return sanitizePathSegment(decoded);
829
+ }
830
+ const SAFE_URL_PROTOCOLS = ["http:", "https:", "mailto:", "tel:"];
831
+ function isDangerousProtocol(url) {
832
+ if (!url) return false;
833
+ try {
834
+ const parsed = new URL(url);
835
+ return !SAFE_URL_PROTOCOLS.includes(parsed.protocol);
836
+ } catch {
837
+ return false;
838
+ }
839
+ }
840
+ const HTML_ESCAPE_LOOKUP = {
841
+ "&": "\\u0026",
842
+ ">": "\\u003e",
843
+ "<": "\\u003c",
844
+ "\u2028": "\\u2028",
845
+ "\u2029": "\\u2029"
846
+ };
847
+ const HTML_ESCAPE_REGEX = /[&><\u2028\u2029]/g;
848
+ function escapeHtml(str) {
849
+ return str.replace(HTML_ESCAPE_REGEX, (match) => HTML_ESCAPE_LOOKUP[match]);
796
850
  }
797
- function decodePath(path, decodeIgnore) {
798
- if (!path) return path;
851
+ function decodePath(path) {
852
+ if (!path) return { path, handledProtocolRelativeURL: false };
853
+ if (!/[%\\\x00-\x1f\x7f]/.test(path) && !path.startsWith("//")) {
854
+ return { path, handledProtocolRelativeURL: false };
855
+ }
799
856
  const re = /%25|%5C/gi;
800
857
  let cursor = 0;
801
858
  let result = "";
@@ -804,7 +861,17 @@ function decodePath(path, decodeIgnore) {
804
861
  result += decodeSegment(path.slice(cursor, match.index)) + match[0];
805
862
  cursor = re.lastIndex;
806
863
  }
807
- return result + decodeSegment(cursor ? path.slice(cursor) : path);
864
+ result = result + decodeSegment(cursor ? path.slice(cursor) : path);
865
+ let handledProtocolRelativeURL = false;
866
+ if (result.startsWith("//")) {
867
+ handledProtocolRelativeURL = true;
868
+ result = "/" + result.replace(/^\/+/, "");
869
+ }
870
+ return { path: result, handledProtocolRelativeURL };
871
+ }
872
+ function encodePathLikeUrl(path) {
873
+ if (!/\s|[^\u0000-\u007F]/.test(path)) return path;
874
+ return path.replace(/\s|[^\u0000-\u007F]/gu, encodeURIComponent);
808
875
  }
809
876
 
810
877
  var prefix = "Invariant failed";
@@ -885,9 +952,17 @@ const SEGMENT_TYPE_PATHNAME = 0;
885
952
  const SEGMENT_TYPE_PARAM = 1;
886
953
  const SEGMENT_TYPE_WILDCARD = 2;
887
954
  const SEGMENT_TYPE_OPTIONAL_PARAM = 3;
888
- const PARAM_W_CURLY_BRACES_RE = /^([^{]*)\{\$([a-zA-Z_$][a-zA-Z0-9_$]*)\}([^}]*)$/;
889
- const OPTIONAL_PARAM_W_CURLY_BRACES_RE = /^([^{]*)\{-\$([a-zA-Z_$][a-zA-Z0-9_$]*)\}([^}]*)$/;
890
- const WILDCARD_W_CURLY_BRACES_RE = /^([^{]*)\{\$\}([^}]*)$/;
955
+ const SEGMENT_TYPE_INDEX = 4;
956
+ const SEGMENT_TYPE_PATHLESS = 5;
957
+ function getOpenAndCloseBraces(part) {
958
+ const openBrace = part.indexOf("{");
959
+ if (openBrace === -1) return null;
960
+ const closeBrace = part.indexOf("}", openBrace);
961
+ if (closeBrace === -1) return null;
962
+ const afterOpen = openBrace + 1;
963
+ if (afterOpen >= part.length) return null;
964
+ return [openBrace, closeBrace];
965
+ }
891
966
  function parseSegment(path, start, output = new Uint16Array(6)) {
892
967
  const next = path.indexOf("/", start);
893
968
  const end = next === -1 ? path.length : next;
@@ -920,45 +995,44 @@ function parseSegment(path, start, output = new Uint16Array(6)) {
920
995
  output[5] = end;
921
996
  return output;
922
997
  }
923
- const wildcardBracesMatch = part.match(WILDCARD_W_CURLY_BRACES_RE);
924
- if (wildcardBracesMatch) {
925
- const prefix = wildcardBracesMatch[1];
926
- const pLength = prefix.length;
927
- output[0] = SEGMENT_TYPE_WILDCARD;
928
- output[1] = start + pLength;
929
- output[2] = start + pLength + 1;
930
- output[3] = start + pLength + 2;
931
- output[4] = start + pLength + 3;
932
- output[5] = path.length;
933
- return output;
934
- }
935
- const optionalParamBracesMatch = part.match(OPTIONAL_PARAM_W_CURLY_BRACES_RE);
936
- if (optionalParamBracesMatch) {
937
- const prefix = optionalParamBracesMatch[1];
938
- const paramName = optionalParamBracesMatch[2];
939
- const suffix = optionalParamBracesMatch[3];
940
- const pLength = prefix.length;
941
- output[0] = SEGMENT_TYPE_OPTIONAL_PARAM;
942
- output[1] = start + pLength;
943
- output[2] = start + pLength + 3;
944
- output[3] = start + pLength + 3 + paramName.length;
945
- output[4] = end - suffix.length;
946
- output[5] = end;
947
- return output;
948
- }
949
- const paramBracesMatch = part.match(PARAM_W_CURLY_BRACES_RE);
950
- if (paramBracesMatch) {
951
- const prefix = paramBracesMatch[1];
952
- const paramName = paramBracesMatch[2];
953
- const suffix = paramBracesMatch[3];
954
- const pLength = prefix.length;
955
- output[0] = SEGMENT_TYPE_PARAM;
956
- output[1] = start + pLength;
957
- output[2] = start + pLength + 2;
958
- output[3] = start + pLength + 2 + paramName.length;
959
- output[4] = end - suffix.length;
960
- output[5] = end;
961
- return output;
998
+ const braces = getOpenAndCloseBraces(part);
999
+ if (braces) {
1000
+ const [openBrace, closeBrace] = braces;
1001
+ const firstChar = part.charCodeAt(openBrace + 1);
1002
+ if (firstChar === 45) {
1003
+ if (openBrace + 2 < part.length && part.charCodeAt(openBrace + 2) === 36) {
1004
+ const paramStart = openBrace + 3;
1005
+ const paramEnd = closeBrace;
1006
+ if (paramStart < paramEnd) {
1007
+ output[0] = SEGMENT_TYPE_OPTIONAL_PARAM;
1008
+ output[1] = start + openBrace;
1009
+ output[2] = start + paramStart;
1010
+ output[3] = start + paramEnd;
1011
+ output[4] = start + closeBrace + 1;
1012
+ output[5] = end;
1013
+ return output;
1014
+ }
1015
+ }
1016
+ } else if (firstChar === 36) {
1017
+ const dollarPos = openBrace + 1;
1018
+ const afterDollar = openBrace + 2;
1019
+ if (afterDollar === closeBrace) {
1020
+ output[0] = SEGMENT_TYPE_WILDCARD;
1021
+ output[1] = start + openBrace;
1022
+ output[2] = start + dollarPos;
1023
+ output[3] = start + afterDollar;
1024
+ output[4] = start + closeBrace + 1;
1025
+ output[5] = path.length;
1026
+ return output;
1027
+ }
1028
+ output[0] = SEGMENT_TYPE_PARAM;
1029
+ output[1] = start + openBrace;
1030
+ output[2] = start + afterDollar;
1031
+ output[3] = start + closeBrace;
1032
+ output[4] = start + closeBrace + 1;
1033
+ output[5] = end;
1034
+ return output;
1035
+ }
962
1036
  }
963
1037
  output[0] = SEGMENT_TYPE_PATHNAME;
964
1038
  output[1] = start;
@@ -975,6 +1049,7 @@ function parseSegments(defaultCaseSensitive, data, route, start, node, depth, on
975
1049
  const path = route.fullPath ?? route.from;
976
1050
  const length = path.length;
977
1051
  const caseSensitive = route.options?.caseSensitive ?? defaultCaseSensitive;
1052
+ const skipOnParamError = !!(route.options?.params?.parse && route.options?.skipRouteOnParseError?.params);
978
1053
  while (cursor < length) {
979
1054
  const segment = parseSegment(path, cursor, data);
980
1055
  let nextNode;
@@ -1024,8 +1099,8 @@ function parseSegments(defaultCaseSensitive, data, route, start, node, depth, on
1024
1099
  const actuallyCaseSensitive = caseSensitive && !!(prefix_raw || suffix_raw);
1025
1100
  const prefix = !prefix_raw ? void 0 : actuallyCaseSensitive ? prefix_raw : prefix_raw.toLowerCase();
1026
1101
  const suffix = !suffix_raw ? void 0 : actuallyCaseSensitive ? suffix_raw : suffix_raw.toLowerCase();
1027
- const existingNode = node.dynamic?.find(
1028
- (s) => s.caseSensitive === actuallyCaseSensitive && s.prefix === prefix && s.suffix === suffix
1102
+ const existingNode = !skipOnParamError && node.dynamic?.find(
1103
+ (s) => !s.skipOnParamError && s.caseSensitive === actuallyCaseSensitive && s.prefix === prefix && s.suffix === suffix
1029
1104
  );
1030
1105
  if (existingNode) {
1031
1106
  nextNode = existingNode;
@@ -1051,8 +1126,8 @@ function parseSegments(defaultCaseSensitive, data, route, start, node, depth, on
1051
1126
  const actuallyCaseSensitive = caseSensitive && !!(prefix_raw || suffix_raw);
1052
1127
  const prefix = !prefix_raw ? void 0 : actuallyCaseSensitive ? prefix_raw : prefix_raw.toLowerCase();
1053
1128
  const suffix = !suffix_raw ? void 0 : actuallyCaseSensitive ? suffix_raw : suffix_raw.toLowerCase();
1054
- const existingNode = node.optional?.find(
1055
- (s) => s.caseSensitive === actuallyCaseSensitive && s.prefix === prefix && s.suffix === suffix
1129
+ const existingNode = !skipOnParamError && node.optional?.find(
1130
+ (s) => !s.skipOnParamError && s.caseSensitive === actuallyCaseSensitive && s.prefix === prefix && s.suffix === suffix
1056
1131
  );
1057
1132
  if (existingNode) {
1058
1133
  nextNode = existingNode;
@@ -1094,11 +1169,36 @@ function parseSegments(defaultCaseSensitive, data, route, start, node, depth, on
1094
1169
  }
1095
1170
  node = nextNode;
1096
1171
  }
1097
- if ((route.path || !route.children) && !route.isRoot) {
1098
- const isIndex = path.endsWith("/");
1099
- if (!isIndex) node.notFound = route;
1100
- if (!node.route || !node.isIndex && isIndex) node.route = route;
1101
- node.isIndex ||= isIndex;
1172
+ if (skipOnParamError && route.children && !route.isRoot && route.id && route.id.charCodeAt(route.id.lastIndexOf("/") + 1) === 95) {
1173
+ const pathlessNode = createStaticNode(
1174
+ route.fullPath ?? route.from
1175
+ );
1176
+ pathlessNode.kind = SEGMENT_TYPE_PATHLESS;
1177
+ pathlessNode.parent = node;
1178
+ depth++;
1179
+ pathlessNode.depth = depth;
1180
+ node.pathless ??= [];
1181
+ node.pathless.push(pathlessNode);
1182
+ node = pathlessNode;
1183
+ }
1184
+ const isLeaf = (route.path || !route.children) && !route.isRoot;
1185
+ if (isLeaf && path.endsWith("/")) {
1186
+ const indexNode = createStaticNode(
1187
+ route.fullPath ?? route.from
1188
+ );
1189
+ indexNode.kind = SEGMENT_TYPE_INDEX;
1190
+ indexNode.parent = node;
1191
+ depth++;
1192
+ indexNode.depth = depth;
1193
+ node.index = indexNode;
1194
+ node = indexNode;
1195
+ }
1196
+ node.parse = route.options?.params?.parse ?? null;
1197
+ node.skipOnParamError = skipOnParamError;
1198
+ node.parsingPriority = route.options?.skipRouteOnParseError?.priority ?? 0;
1199
+ if (isLeaf && !node.route) {
1200
+ node.route = route;
1201
+ node.fullPath = route.fullPath ?? route.from;
1102
1202
  }
1103
1203
  }
1104
1204
  if (route.children)
@@ -1115,6 +1215,10 @@ function parseSegments(defaultCaseSensitive, data, route, start, node, depth, on
1115
1215
  }
1116
1216
  }
1117
1217
  function sortDynamic(a, b) {
1218
+ if (a.skipOnParamError && !b.skipOnParamError) return -1;
1219
+ if (!a.skipOnParamError && b.skipOnParamError) return 1;
1220
+ if (a.skipOnParamError && b.skipOnParamError && (a.parsingPriority || b.parsingPriority))
1221
+ return b.parsingPriority - a.parsingPriority;
1118
1222
  if (a.prefix && b.prefix && a.prefix !== b.prefix) {
1119
1223
  if (a.prefix.startsWith(b.prefix)) return -1;
1120
1224
  if (b.prefix.startsWith(a.prefix)) return 1;
@@ -1132,6 +1236,11 @@ function sortDynamic(a, b) {
1132
1236
  return 0;
1133
1237
  }
1134
1238
  function sortTreeNodes(node) {
1239
+ if (node.pathless) {
1240
+ for (const child of node.pathless) {
1241
+ sortTreeNodes(child);
1242
+ }
1243
+ }
1135
1244
  if (node.static) {
1136
1245
  for (const child of node.static.values()) {
1137
1246
  sortTreeNodes(child);
@@ -1165,6 +1274,8 @@ function createStaticNode(fullPath) {
1165
1274
  return {
1166
1275
  kind: SEGMENT_TYPE_PATHNAME,
1167
1276
  depth: 0,
1277
+ pathless: null,
1278
+ index: null,
1168
1279
  static: null,
1169
1280
  staticInsensitive: null,
1170
1281
  dynamic: null,
@@ -1173,14 +1284,17 @@ function createStaticNode(fullPath) {
1173
1284
  route: null,
1174
1285
  fullPath,
1175
1286
  parent: null,
1176
- isIndex: false,
1177
- notFound: null
1287
+ parse: null,
1288
+ skipOnParamError: false,
1289
+ parsingPriority: 0
1178
1290
  };
1179
1291
  }
1180
1292
  function createDynamicNode(kind, fullPath, caseSensitive, prefix, suffix) {
1181
1293
  return {
1182
1294
  kind,
1183
1295
  depth: 0,
1296
+ pathless: null,
1297
+ index: null,
1184
1298
  static: null,
1185
1299
  staticInsensitive: null,
1186
1300
  dynamic: null,
@@ -1189,8 +1303,9 @@ function createDynamicNode(kind, fullPath, caseSensitive, prefix, suffix) {
1189
1303
  route: null,
1190
1304
  fullPath,
1191
1305
  parent: null,
1192
- isIndex: false,
1193
- notFound: null,
1306
+ parse: null,
1307
+ skipOnParamError: false,
1308
+ parsingPriority: 0,
1194
1309
  caseSensitive,
1195
1310
  prefix,
1196
1311
  suffix
@@ -1232,11 +1347,20 @@ function findRouteMatch(path, processedTree, fuzzy = false) {
1232
1347
  const cached = processedTree.matchCache.get(key);
1233
1348
  if (cached !== void 0) return cached;
1234
1349
  path ||= "/";
1235
- const result = findMatch(
1236
- path,
1237
- processedTree.segmentTree,
1238
- fuzzy
1239
- );
1350
+ let result;
1351
+ try {
1352
+ result = findMatch(
1353
+ path,
1354
+ processedTree.segmentTree,
1355
+ fuzzy
1356
+ );
1357
+ } catch (err) {
1358
+ if (err instanceof URIError) {
1359
+ result = null;
1360
+ } else {
1361
+ throw err;
1362
+ }
1363
+ }
1240
1364
  if (result) result.branch = buildRouteBranch(result.route);
1241
1365
  processedTree.matchCache.set(key, result);
1242
1366
  return result;
@@ -1283,27 +1407,36 @@ function findMatch(path, segmentTree, fuzzy = false) {
1283
1407
  const parts = path.split("/");
1284
1408
  const leaf = getNodeMatch(path, parts, segmentTree, fuzzy);
1285
1409
  if (!leaf) return null;
1286
- const params = extractParams(path, parts, leaf);
1287
- const isFuzzyMatch = "**" in leaf;
1288
- if (isFuzzyMatch) params["**"] = leaf["**"];
1289
- const route = isFuzzyMatch ? leaf.node.notFound ?? leaf.node.route : leaf.node.route;
1410
+ const [rawParams] = extractParams(path, parts, leaf);
1290
1411
  return {
1291
- route,
1292
- params
1412
+ route: leaf.node.route,
1413
+ rawParams,
1414
+ parsedParams: leaf.parsedParams
1293
1415
  };
1294
1416
  }
1295
1417
  function extractParams(path, parts, leaf) {
1296
1418
  const list = buildBranch(leaf.node);
1297
1419
  let nodeParts = null;
1298
- const params = {};
1299
- for (let partIndex = 0, nodeIndex = 0, pathIndex = 0; nodeIndex < list.length; partIndex++, nodeIndex++, pathIndex++) {
1420
+ const rawParams = {};
1421
+ let partIndex = leaf.extract?.part ?? 0;
1422
+ let nodeIndex = leaf.extract?.node ?? 0;
1423
+ let pathIndex = leaf.extract?.path ?? 0;
1424
+ let segmentCount = leaf.extract?.segment ?? 0;
1425
+ for (; nodeIndex < list.length; partIndex++, nodeIndex++, pathIndex++, segmentCount++) {
1300
1426
  const node = list[nodeIndex];
1427
+ if (node.kind === SEGMENT_TYPE_INDEX) break;
1428
+ if (node.kind === SEGMENT_TYPE_PATHLESS) {
1429
+ segmentCount--;
1430
+ partIndex--;
1431
+ pathIndex--;
1432
+ continue;
1433
+ }
1301
1434
  const part = parts[partIndex];
1302
1435
  const currentPathIndex = pathIndex;
1303
1436
  if (part) pathIndex += part.length;
1304
1437
  if (node.kind === SEGMENT_TYPE_PARAM) {
1305
1438
  nodeParts ??= leaf.node.fullPath.split("/");
1306
- const nodePart = nodeParts[nodeIndex];
1439
+ const nodePart = nodeParts[segmentCount];
1307
1440
  const preLength = node.prefix?.length ?? 0;
1308
1441
  const isCurlyBraced = nodePart.charCodeAt(preLength) === 123;
1309
1442
  if (isCurlyBraced) {
@@ -1313,18 +1446,19 @@ function extractParams(path, parts, leaf) {
1313
1446
  nodePart.length - sufLength - 1
1314
1447
  );
1315
1448
  const value = part.substring(preLength, part.length - sufLength);
1316
- params[name] = decodeURIComponent(value);
1449
+ rawParams[name] = decodeURIComponent(value);
1317
1450
  } else {
1318
1451
  const name = nodePart.substring(1);
1319
- params[name] = decodeURIComponent(part);
1452
+ rawParams[name] = decodeURIComponent(part);
1320
1453
  }
1321
1454
  } else if (node.kind === SEGMENT_TYPE_OPTIONAL_PARAM) {
1322
1455
  if (leaf.skipped & 1 << nodeIndex) {
1323
1456
  partIndex--;
1457
+ pathIndex = currentPathIndex - 1;
1324
1458
  continue;
1325
1459
  }
1326
1460
  nodeParts ??= leaf.node.fullPath.split("/");
1327
- const nodePart = nodeParts[nodeIndex];
1461
+ const nodePart = nodeParts[segmentCount];
1328
1462
  const preLength = node.prefix?.length ?? 0;
1329
1463
  const sufLength = node.suffix?.length ?? 0;
1330
1464
  const name = nodePart.substring(
@@ -1332,7 +1466,7 @@ function extractParams(path, parts, leaf) {
1332
1466
  nodePart.length - sufLength - 1
1333
1467
  );
1334
1468
  const value = node.suffix || node.prefix ? part.substring(preLength, part.length - sufLength) : part;
1335
- if (value) params[name] = decodeURIComponent(value);
1469
+ if (value) rawParams[name] = decodeURIComponent(value);
1336
1470
  } else if (node.kind === SEGMENT_TYPE_WILDCARD) {
1337
1471
  const n = node;
1338
1472
  const value = path.substring(
@@ -1340,12 +1474,21 @@ function extractParams(path, parts, leaf) {
1340
1474
  path.length - (n.suffix?.length ?? 0)
1341
1475
  );
1342
1476
  const splat = decodeURIComponent(value);
1343
- params["*"] = splat;
1344
- params._splat = splat;
1477
+ rawParams["*"] = splat;
1478
+ rawParams._splat = splat;
1345
1479
  break;
1346
1480
  }
1347
1481
  }
1348
- return params;
1482
+ if (leaf.rawParams) Object.assign(rawParams, leaf.rawParams);
1483
+ return [
1484
+ rawParams,
1485
+ {
1486
+ part: partIndex,
1487
+ node: nodeIndex,
1488
+ path: pathIndex,
1489
+ segment: segmentCount
1490
+ }
1491
+ ];
1349
1492
  }
1350
1493
  function buildRouteBranch(route) {
1351
1494
  const list = [route];
@@ -1365,6 +1508,8 @@ function buildBranch(node) {
1365
1508
  return list;
1366
1509
  }
1367
1510
  function getNodeMatch(path, parts, segmentTree, fuzzy) {
1511
+ if (path === "/" && segmentTree.index)
1512
+ return { node: segmentTree.index, skipped: 0 };
1368
1513
  const trailingSlash = !last(parts);
1369
1514
  const pathIsIndex = trailingSlash && path !== "/";
1370
1515
  const partsLength = parts.length - (trailingSlash ? 1 : 0);
@@ -1384,22 +1529,55 @@ function getNodeMatch(path, parts, segmentTree, fuzzy) {
1384
1529
  let bestMatch = null;
1385
1530
  while (stack.length) {
1386
1531
  const frame = stack.pop();
1387
- let { node, index, skipped, depth, statics, dynamics, optionals } = frame;
1388
- if (fuzzy && node.notFound && isFrameMoreSpecific(bestFuzzy, frame)) {
1532
+ const { node, index, skipped, depth, statics, dynamics, optionals } = frame;
1533
+ let { extract, rawParams, parsedParams } = frame;
1534
+ if (node.skipOnParamError) {
1535
+ const result = validateMatchParams(path, parts, frame);
1536
+ if (!result) continue;
1537
+ rawParams = frame.rawParams;
1538
+ extract = frame.extract;
1539
+ parsedParams = frame.parsedParams;
1540
+ }
1541
+ if (fuzzy && node.route && node.kind !== SEGMENT_TYPE_INDEX && isFrameMoreSpecific(bestFuzzy, frame)) {
1389
1542
  bestFuzzy = frame;
1390
1543
  }
1391
1544
  const isBeyondPath = index === partsLength;
1392
1545
  if (isBeyondPath) {
1393
- if (node.route && (!pathIsIndex || node.isIndex)) {
1394
- if (isFrameMoreSpecific(bestMatch, frame)) {
1395
- bestMatch = frame;
1396
- }
1397
- if (statics === partsLength && node.isIndex) return bestMatch;
1546
+ if (node.route && !pathIsIndex && isFrameMoreSpecific(bestMatch, frame)) {
1547
+ bestMatch = frame;
1398
1548
  }
1399
- if (!node.optional && !node.wildcard) continue;
1549
+ if (!node.optional && !node.wildcard && !node.index && !node.pathless)
1550
+ continue;
1400
1551
  }
1401
1552
  const part = isBeyondPath ? void 0 : parts[index];
1402
1553
  let lowerPart;
1554
+ if (isBeyondPath && node.index) {
1555
+ const indexFrame = {
1556
+ node: node.index,
1557
+ index,
1558
+ skipped,
1559
+ depth: depth + 1,
1560
+ statics,
1561
+ dynamics,
1562
+ optionals,
1563
+ extract,
1564
+ rawParams,
1565
+ parsedParams
1566
+ };
1567
+ let indexValid = true;
1568
+ if (node.index.skipOnParamError) {
1569
+ const result = validateMatchParams(path, parts, indexFrame);
1570
+ if (!result) indexValid = false;
1571
+ }
1572
+ if (indexValid) {
1573
+ if (statics === partsLength && !dynamics && !optionals && !skipped) {
1574
+ return indexFrame;
1575
+ }
1576
+ if (isFrameMoreSpecific(bestMatch, indexFrame)) {
1577
+ bestMatch = indexFrame;
1578
+ }
1579
+ }
1580
+ }
1403
1581
  if (node.wildcard && isFrameMoreSpecific(wildcardMatch, frame)) {
1404
1582
  for (const segment of node.wildcard) {
1405
1583
  const { prefix, suffix } = segment;
@@ -1414,15 +1592,23 @@ function getNodeMatch(path, parts, segmentTree, fuzzy) {
1414
1592
  const casePart = segment.caseSensitive ? end : end.toLowerCase();
1415
1593
  if (casePart !== suffix) continue;
1416
1594
  }
1417
- wildcardMatch = {
1595
+ const frame2 = {
1418
1596
  node: segment,
1419
- index,
1597
+ index: partsLength,
1420
1598
  skipped,
1421
1599
  depth,
1422
1600
  statics,
1423
1601
  dynamics,
1424
- optionals
1602
+ optionals,
1603
+ extract,
1604
+ rawParams,
1605
+ parsedParams
1425
1606
  };
1607
+ if (segment.skipOnParamError) {
1608
+ const result = validateMatchParams(path, parts, frame2);
1609
+ if (!result) continue;
1610
+ }
1611
+ wildcardMatch = frame2;
1426
1612
  break;
1427
1613
  }
1428
1614
  }
@@ -1438,7 +1624,10 @@ function getNodeMatch(path, parts, segmentTree, fuzzy) {
1438
1624
  depth: nextDepth,
1439
1625
  statics,
1440
1626
  dynamics,
1441
- optionals
1627
+ optionals,
1628
+ extract,
1629
+ rawParams,
1630
+ parsedParams
1442
1631
  });
1443
1632
  }
1444
1633
  if (!isBeyondPath) {
@@ -1457,7 +1646,10 @@ function getNodeMatch(path, parts, segmentTree, fuzzy) {
1457
1646
  depth: nextDepth,
1458
1647
  statics,
1459
1648
  dynamics,
1460
- optionals: optionals + 1
1649
+ optionals: optionals + 1,
1650
+ extract,
1651
+ rawParams,
1652
+ parsedParams
1461
1653
  });
1462
1654
  }
1463
1655
  }
@@ -1478,7 +1670,10 @@ function getNodeMatch(path, parts, segmentTree, fuzzy) {
1478
1670
  depth: depth + 1,
1479
1671
  statics,
1480
1672
  dynamics: dynamics + 1,
1481
- optionals
1673
+ optionals,
1674
+ extract,
1675
+ rawParams,
1676
+ parsedParams
1482
1677
  });
1483
1678
  }
1484
1679
  }
@@ -1494,7 +1689,10 @@ function getNodeMatch(path, parts, segmentTree, fuzzy) {
1494
1689
  depth: depth + 1,
1495
1690
  statics: statics + 1,
1496
1691
  dynamics,
1497
- optionals
1692
+ optionals,
1693
+ extract,
1694
+ rawParams,
1695
+ parsedParams
1498
1696
  });
1499
1697
  }
1500
1698
  }
@@ -1508,7 +1706,28 @@ function getNodeMatch(path, parts, segmentTree, fuzzy) {
1508
1706
  depth: depth + 1,
1509
1707
  statics: statics + 1,
1510
1708
  dynamics,
1511
- optionals
1709
+ optionals,
1710
+ extract,
1711
+ rawParams,
1712
+ parsedParams
1713
+ });
1714
+ }
1715
+ }
1716
+ if (node.pathless) {
1717
+ const nextDepth = depth + 1;
1718
+ for (let i = node.pathless.length - 1; i >= 0; i--) {
1719
+ const segment = node.pathless[i];
1720
+ stack.push({
1721
+ node: segment,
1722
+ index,
1723
+ skipped,
1724
+ depth: nextDepth,
1725
+ statics,
1726
+ dynamics,
1727
+ optionals,
1728
+ extract,
1729
+ rawParams,
1730
+ parsedParams
1512
1731
  });
1513
1732
  }
1514
1733
  }
@@ -1524,17 +1743,27 @@ function getNodeMatch(path, parts, segmentTree, fuzzy) {
1524
1743
  sliceIndex += parts[i].length;
1525
1744
  }
1526
1745
  const splat = sliceIndex === path.length ? "/" : path.slice(sliceIndex);
1527
- return {
1528
- node: bestFuzzy.node,
1529
- skipped: bestFuzzy.skipped,
1530
- "**": decodeURIComponent(splat)
1531
- };
1746
+ bestFuzzy.rawParams ??= {};
1747
+ bestFuzzy.rawParams["**"] = decodeURIComponent(splat);
1748
+ return bestFuzzy;
1532
1749
  }
1533
1750
  return null;
1534
1751
  }
1752
+ function validateMatchParams(path, parts, frame) {
1753
+ try {
1754
+ const [rawParams, state] = extractParams(path, parts, frame);
1755
+ frame.rawParams = rawParams;
1756
+ frame.extract = state;
1757
+ const parsed = frame.node.parse(rawParams);
1758
+ frame.parsedParams = Object.assign({}, frame.parsedParams, parsed);
1759
+ return true;
1760
+ } catch {
1761
+ return null;
1762
+ }
1763
+ }
1535
1764
  function isFrameMoreSpecific(prev, next) {
1536
1765
  if (!prev) return true;
1537
- return next.statics > prev.statics || next.statics === prev.statics && (next.dynamics > prev.dynamics || next.dynamics === prev.dynamics && (next.optionals > prev.optionals || next.optionals === prev.optionals && (next.node.isIndex > prev.node.isIndex || next.node.isIndex === prev.node.isIndex && next.depth > prev.depth)));
1766
+ return next.statics > prev.statics || next.statics === prev.statics && (next.dynamics > prev.dynamics || next.dynamics === prev.dynamics && (next.optionals > prev.optionals || next.optionals === prev.optionals && ((next.node.kind === SEGMENT_TYPE_INDEX) > (prev.node.kind === SEGMENT_TYPE_INDEX) || next.node.kind === SEGMENT_TYPE_INDEX === (prev.node.kind === SEGMENT_TYPE_INDEX) && next.depth > prev.depth)));
1538
1767
  }
1539
1768
 
1540
1769
  function joinPaths(paths) {
@@ -1645,19 +1874,32 @@ function resolvePath({
1645
1874
  if (key && cache) cache.set(key, result);
1646
1875
  return result;
1647
1876
  }
1648
- function encodeParam(key, params, decodeCharMap) {
1877
+ function compileDecodeCharMap(pathParamsAllowedCharacters) {
1878
+ const charMap = new Map(
1879
+ pathParamsAllowedCharacters.map((char) => [encodeURIComponent(char), char])
1880
+ );
1881
+ const pattern = Array.from(charMap.keys()).map((key) => key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
1882
+ const regex = new RegExp(pattern, "g");
1883
+ return (encoded) => encoded.replace(regex, (match) => charMap.get(match) ?? match);
1884
+ }
1885
+ function encodeParam(key, params, decoder) {
1649
1886
  const value = params[key];
1650
1887
  if (typeof value !== "string") return value;
1651
1888
  if (key === "_splat") {
1652
- return encodeURI(value);
1889
+ if (/^[a-zA-Z0-9\-._~!/]*$/.test(value)) return value;
1890
+ return value.split("/").map((segment) => encodePathParam(segment, decoder)).join("/");
1653
1891
  } else {
1654
- return encodePathParam(value, decodeCharMap);
1892
+ return encodePathParam(value, decoder);
1655
1893
  }
1656
1894
  }
1657
1895
  function interpolatePath({
1658
1896
  path,
1659
1897
  params,
1660
- decodeCharMap
1898
+ decoder,
1899
+ // `server` is marked @internal and stripped from .d.ts by `stripInternal`.
1900
+ // We avoid destructuring it in the function signature so the emitted
1901
+ // declaration doesn't reference a property that no longer exists.
1902
+ ...rest
1661
1903
  }) {
1662
1904
  let isMissingParams = false;
1663
1905
  const usedParams = {};
@@ -1693,7 +1935,7 @@ function interpolatePath({
1693
1935
  }
1694
1936
  continue;
1695
1937
  }
1696
- const value = encodeParam("_splat", params, decodeCharMap);
1938
+ const value = encodeParam("_splat", params, decoder);
1697
1939
  joined += "/" + prefix + value + suffix;
1698
1940
  continue;
1699
1941
  }
@@ -1705,7 +1947,7 @@ function interpolatePath({
1705
1947
  usedParams[key] = params[key];
1706
1948
  const prefix = path.substring(start, segment[1]);
1707
1949
  const suffix = path.substring(segment[4], end);
1708
- const value = encodeParam(key, params, decodeCharMap) ?? "undefined";
1950
+ const value = encodeParam(key, params, decoder) ?? "undefined";
1709
1951
  joined += "/" + prefix + value + suffix;
1710
1952
  continue;
1711
1953
  }
@@ -1716,7 +1958,7 @@ function interpolatePath({
1716
1958
  usedParams[key] = valueRaw;
1717
1959
  const prefix = path.substring(start, segment[1]);
1718
1960
  const suffix = path.substring(segment[4], end);
1719
- const value = encodeParam(key, params, decodeCharMap) ?? "";
1961
+ const value = encodeParam(key, params, decoder) ?? "";
1720
1962
  joined += "/" + prefix + value + suffix;
1721
1963
  continue;
1722
1964
  }
@@ -1725,14 +1967,9 @@ function interpolatePath({
1725
1967
  const interpolatedPath = joined || "/";
1726
1968
  return { usedParams, interpolatedPath, isMissingParams };
1727
1969
  }
1728
- function encodePathParam(value, decodeCharMap) {
1729
- let encoded = encodeURIComponent(value);
1730
- if (decodeCharMap) {
1731
- for (const [encodedChar, char] of decodeCharMap) {
1732
- encoded = encoded.replaceAll(encodedChar, char);
1733
- }
1734
- }
1735
- return encoded;
1970
+ function encodePathParam(value, decoder) {
1971
+ const encoded = encodeURIComponent(value);
1972
+ return decoder?.(encoded) ?? encoded;
1736
1973
  }
1737
1974
 
1738
1975
  function notFound(options = {}) {
@@ -1777,7 +2014,16 @@ function createScrollRestorationCache() {
1777
2014
  // This setter is simply to make sure that we set the sessionStorage right
1778
2015
  // after the state is updated. It doesn't necessarily need to be a functional
1779
2016
  // update.
1780
- set: (updater) => (state = functionalUpdate(updater, state) || state, safeSessionStorage.setItem(storageKey, JSON.stringify(state)))
2017
+ set: (updater) => {
2018
+ state = functionalUpdate(updater, state) || state;
2019
+ try {
2020
+ safeSessionStorage.setItem(storageKey, JSON.stringify(state));
2021
+ } catch {
2022
+ console.warn(
2023
+ "[ts-router] Could not persist scroll restoration state to sessionStorage."
2024
+ );
2025
+ }
2026
+ }
1781
2027
  };
1782
2028
  }
1783
2029
  const scrollRestorationCache = createScrollRestorationCache();
@@ -1858,14 +2104,14 @@ function restoreScroll({
1858
2104
  ignoreScroll = false;
1859
2105
  }
1860
2106
  function setupScrollRestoration(router, force) {
1861
- if (!scrollRestorationCache && !router.isServer) {
2107
+ if (!scrollRestorationCache && true) {
1862
2108
  return;
1863
2109
  }
1864
2110
  const shouldScrollRestoration = force ?? router.options.scrollRestoration ?? false;
1865
2111
  if (shouldScrollRestoration) {
1866
2112
  router.isScrollRestoring = true;
1867
2113
  }
1868
- if (router.isServer || router.isScrollRestorationSetup || !scrollRestorationCache) {
2114
+ if (router.isScrollRestorationSetup || !scrollRestorationCache) {
1869
2115
  return;
1870
2116
  }
1871
2117
  router.isScrollRestorationSetup = true;
@@ -2033,7 +2279,12 @@ const rootRouteId = "__root__";
2033
2279
 
2034
2280
  function redirect(opts) {
2035
2281
  opts.statusCode = opts.statusCode || opts.code || 307;
2036
- if (!opts.reloadDocument && typeof opts.href === "string") {
2282
+ if (!opts._builtLocation && typeof opts.href === "string" && isDangerousProtocol(opts.href)) {
2283
+ throw new Error(
2284
+ `Redirect blocked: unsafe protocol in href "${opts.href}". Only ${SAFE_URL_PROTOCOLS.join(", ")} protocols are allowed.`
2285
+ );
2286
+ }
2287
+ if (!opts._builtLocation && !opts.reloadDocument && typeof opts.href === "string") {
2037
2288
  try {
2038
2289
  new URL(opts.href);
2039
2290
  opts.reloadDocument = true;
@@ -2067,6 +2318,20 @@ const triggerOnReady = (inner) => {
2067
2318
  const resolvePreload = (inner, matchId) => {
2068
2319
  return !!(inner.preload && !inner.router.state.matches.some((d) => d.id === matchId));
2069
2320
  };
2321
+ const buildMatchContext = (inner, index, includeCurrentMatch = true) => {
2322
+ const context = {
2323
+ ...inner.router.options.context ?? {}
2324
+ };
2325
+ const end = includeCurrentMatch ? index : index - 1;
2326
+ for (let i = 0; i <= end; i++) {
2327
+ const innerMatch = inner.matches[i];
2328
+ if (!innerMatch) continue;
2329
+ const m = inner.router.getMatch(innerMatch.id);
2330
+ if (!m) continue;
2331
+ Object.assign(context, m.__routeContext, m.__beforeLoadContext);
2332
+ }
2333
+ return context;
2334
+ };
2070
2335
  const _handleNotFound = (inner, err) => {
2071
2336
  const routeCursor = inner.router.routesById[err.routeId ?? ""] ?? inner.router.routeTree;
2072
2337
  if (!routeCursor.options.notFoundComponent && inner.router.options?.defaultNotFoundComponent) {
@@ -2102,6 +2367,7 @@ const handleRedirectAndNotFound = (inner, match, err) => {
2102
2367
  inner.updateMatch(match.id, (prev) => ({
2103
2368
  ...prev,
2104
2369
  status,
2370
+ context: buildMatchContext(inner, match.index),
2105
2371
  isFetching: false,
2106
2372
  error: err
2107
2373
  }));
@@ -2123,10 +2389,7 @@ const handleRedirectAndNotFound = (inner, match, err) => {
2123
2389
  };
2124
2390
  const shouldSkipLoader = (inner, matchId) => {
2125
2391
  const match = inner.router.getMatch(matchId);
2126
- if (!inner.router.isServer && match._nonReactive.dehydrated) {
2127
- return true;
2128
- }
2129
- if (inner.router.isServer && match.ssr === false) {
2392
+ if (match._nonReactive.dehydrated) {
2130
2393
  return true;
2131
2394
  }
2132
2395
  return false;
@@ -2160,63 +2423,10 @@ const handleSerialError = (inner, index, err, routerCode) => {
2160
2423
  };
2161
2424
  });
2162
2425
  };
2163
- const isBeforeLoadSsr = (inner, matchId, index, route) => {
2164
- const existingMatch = inner.router.getMatch(matchId);
2165
- const parentMatchId = inner.matches[index - 1]?.id;
2166
- const parentMatch = parentMatchId ? inner.router.getMatch(parentMatchId) : void 0;
2167
- if (inner.router.isShell()) {
2168
- existingMatch.ssr = route.id === rootRouteId;
2169
- return;
2170
- }
2171
- if (parentMatch?.ssr === false) {
2172
- existingMatch.ssr = false;
2173
- return;
2174
- }
2175
- const parentOverride = (tempSsr2) => {
2176
- if (tempSsr2 === true && parentMatch?.ssr === "data-only") {
2177
- return "data-only";
2178
- }
2179
- return tempSsr2;
2180
- };
2181
- const defaultSsr = inner.router.options.defaultSsr ?? true;
2182
- if (route.options.ssr === void 0) {
2183
- existingMatch.ssr = parentOverride(defaultSsr);
2184
- return;
2185
- }
2186
- if (typeof route.options.ssr !== "function") {
2187
- existingMatch.ssr = parentOverride(route.options.ssr);
2188
- return;
2189
- }
2190
- const { search, params } = existingMatch;
2191
- const ssrFnContext = {
2192
- search: makeMaybe(search, existingMatch.searchError),
2193
- params: makeMaybe(params, existingMatch.paramsError),
2194
- location: inner.location,
2195
- matches: inner.matches.map((match) => ({
2196
- index: match.index,
2197
- pathname: match.pathname,
2198
- fullPath: match.fullPath,
2199
- staticData: match.staticData,
2200
- id: match.id,
2201
- routeId: match.routeId,
2202
- search: makeMaybe(match.search, match.searchError),
2203
- params: makeMaybe(match.params, match.paramsError),
2204
- ssr: match.ssr
2205
- }))
2206
- };
2207
- const tempSsr = route.options.ssr(ssrFnContext);
2208
- if (isPromise(tempSsr)) {
2209
- return tempSsr.then((ssr) => {
2210
- existingMatch.ssr = parentOverride(ssr ?? defaultSsr);
2211
- });
2212
- }
2213
- existingMatch.ssr = parentOverride(tempSsr ?? defaultSsr);
2214
- return;
2215
- };
2216
2426
  const setupPendingTimeout = (inner, matchId, route, match) => {
2217
2427
  if (match._nonReactive.pendingTimeout !== void 0) return;
2218
2428
  const pendingMs = route.options.pendingMs ?? inner.router.options.defaultPendingMs;
2219
- const shouldPending = !!(inner.onReady && !inner.router.isServer && !resolvePreload(inner, matchId) && (route.options.loader || route.options.beforeLoad || routeNeedsPreload(route)) && typeof pendingMs === "number" && pendingMs !== Infinity && (route.options.pendingComponent ?? inner.router.options?.defaultPendingComponent));
2429
+ const shouldPending = !!(inner.onReady && true && !resolvePreload(inner, matchId) && (route.options.loader || route.options.beforeLoad || routeNeedsPreload(route)) && typeof pendingMs === "number" && pendingMs !== Infinity && (route.options.pendingComponent ?? inner.router.options?.defaultPendingComponent));
2220
2430
  if (shouldPending) {
2221
2431
  const pendingTimeout = setTimeout(() => {
2222
2432
  triggerOnReady(inner);
@@ -2252,10 +2462,6 @@ const executeBeforeLoad = (inner, matchId, index, route) => {
2252
2462
  }
2253
2463
  setupPendingTimeout(inner, matchId, route, match);
2254
2464
  const abortController = new AbortController();
2255
- const parentMatchId = inner.matches[index - 1]?.id;
2256
- const parentMatch = parentMatchId ? inner.router.getMatch(parentMatchId) : void 0;
2257
- const parentMatchContext = parentMatch?.context ?? inner.router.options.context ?? void 0;
2258
- const context = { ...parentMatchContext, ...match.__routeContext };
2259
2465
  let isPending = false;
2260
2466
  const pending = () => {
2261
2467
  if (isPending) return;
@@ -2264,8 +2470,10 @@ const executeBeforeLoad = (inner, matchId, index, route) => {
2264
2470
  ...prev,
2265
2471
  isFetching: "beforeLoad",
2266
2472
  fetchCount: prev.fetchCount + 1,
2267
- abortController,
2268
- context
2473
+ abortController
2474
+ // Note: We intentionally don't update context here.
2475
+ // Context should only be updated after beforeLoad resolves to avoid
2476
+ // components seeing incomplete context during async beforeLoad execution.
2269
2477
  }));
2270
2478
  };
2271
2479
  const resolve = () => {
@@ -2284,6 +2492,10 @@ const executeBeforeLoad = (inner, matchId, index, route) => {
2284
2492
  return;
2285
2493
  }
2286
2494
  match._nonReactive.beforeLoadPromise = createControlledPromise();
2495
+ const context = {
2496
+ ...buildMatchContext(inner, index, false),
2497
+ ...match.__routeContext
2498
+ };
2287
2499
  const { search, params, cause } = match;
2288
2500
  const preload = resolvePreload(inner, matchId);
2289
2501
  const beforeLoadFnContext = {
@@ -2300,6 +2512,7 @@ const executeBeforeLoad = (inner, matchId, index, route) => {
2300
2512
  buildLocation: inner.router.buildLocation,
2301
2513
  cause: preload ? "preload" : cause,
2302
2514
  matches: inner.matches,
2515
+ routeId: route.id,
2303
2516
  ...inner.router.options.additionalContext
2304
2517
  };
2305
2518
  const updateContext = (beforeLoadContext2) => {
@@ -2318,11 +2531,7 @@ const executeBeforeLoad = (inner, matchId, index, route) => {
2318
2531
  pending();
2319
2532
  inner.updateMatch(matchId, (prev) => ({
2320
2533
  ...prev,
2321
- __beforeLoadContext: beforeLoadContext2,
2322
- context: {
2323
- ...prev.context,
2324
- ...beforeLoadContext2
2325
- }
2534
+ __beforeLoadContext: beforeLoadContext2
2326
2535
  }));
2327
2536
  resolve();
2328
2537
  });
@@ -2347,10 +2556,6 @@ const handleBeforeLoad = (inner, index) => {
2347
2556
  const { id: matchId, routeId } = inner.matches[index];
2348
2557
  const route = inner.router.looseRoutesById[routeId];
2349
2558
  const serverSsr = () => {
2350
- if (inner.router.isServer) {
2351
- const maybePromise = isBeforeLoadSsr(inner, matchId, index, route);
2352
- if (isPromise(maybePromise)) return maybePromise.then(queueExecution);
2353
- }
2354
2559
  return queueExecution();
2355
2560
  };
2356
2561
  const execute = () => executeBeforeLoad(inner, matchId, index, route);
@@ -2370,6 +2575,7 @@ const executeHead = (inner, matchId, route) => {
2370
2575
  return;
2371
2576
  }
2372
2577
  const assetContext = {
2578
+ ssr: inner.router.options.ssr,
2373
2579
  matches: inner.matches,
2374
2580
  match,
2375
2581
  params: match.params,
@@ -2397,18 +2603,7 @@ const executeHead = (inner, matchId, route) => {
2397
2603
  const getLoaderContext = (inner, matchId, index, route) => {
2398
2604
  const parentMatchPromise = inner.matchPromises[index - 1];
2399
2605
  const { params, loaderDeps, abortController, cause } = inner.router.getMatch(matchId);
2400
- let context = inner.router.options.context ?? {};
2401
- for (let i = 0; i <= index; i++) {
2402
- const innerMatch = inner.matches[i];
2403
- if (!innerMatch) continue;
2404
- const m = inner.router.getMatch(innerMatch.id);
2405
- if (!m) continue;
2406
- context = {
2407
- ...context,
2408
- ...m.__routeContext ?? {},
2409
- ...m.__beforeLoadContext ?? {}
2410
- };
2411
- }
2606
+ const context = buildMatchContext(inner, index);
2412
2607
  const preload = resolvePreload(inner, matchId);
2413
2608
  return {
2414
2609
  params,
@@ -2431,7 +2626,7 @@ const runLoader = async (inner, matchId, index, route) => {
2431
2626
  try {
2432
2627
  const match = inner.router.getMatch(matchId);
2433
2628
  try {
2434
- if (!inner.router.isServer || match.ssr === true) {
2629
+ if (!(isServer ?? inner.router.isServer) || match.ssr === true) {
2435
2630
  loadRouteChunk(route);
2436
2631
  }
2437
2632
  const loaderResult = route.options.loader?.(
@@ -2460,21 +2655,33 @@ const runLoader = async (inner, matchId, index, route) => {
2460
2655
  }
2461
2656
  }
2462
2657
  if (route._lazyPromise) await route._lazyPromise;
2463
- const headResult = executeHead(inner, matchId, route);
2464
- const head = headResult ? await headResult : void 0;
2465
2658
  const pendingPromise = match._nonReactive.minPendingPromise;
2466
2659
  if (pendingPromise) await pendingPromise;
2467
2660
  if (route._componentsPromise) await route._componentsPromise;
2468
2661
  inner.updateMatch(matchId, (prev) => ({
2469
2662
  ...prev,
2470
2663
  error: void 0,
2664
+ context: buildMatchContext(inner, index),
2471
2665
  status: "success",
2472
2666
  isFetching: false,
2473
- updatedAt: Date.now(),
2474
- ...head
2667
+ updatedAt: Date.now()
2475
2668
  }));
2476
2669
  } catch (e) {
2477
2670
  let error = e;
2671
+ if (error?.name === "AbortError") {
2672
+ if (match.abortController.signal.aborted) {
2673
+ match._nonReactive.loaderPromise?.resolve();
2674
+ match._nonReactive.loaderPromise = void 0;
2675
+ return;
2676
+ }
2677
+ inner.updateMatch(matchId, (prev) => ({
2678
+ ...prev,
2679
+ status: prev.status === "pending" ? "success" : prev.status,
2680
+ isFetching: false,
2681
+ context: buildMatchContext(inner, index)
2682
+ }));
2683
+ return;
2684
+ }
2478
2685
  const pendingPromise = match._nonReactive.minPendingPromise;
2479
2686
  if (pendingPromise) await pendingPromise;
2480
2687
  if (isNotFound(e)) {
@@ -2491,51 +2698,57 @@ const runLoader = async (inner, matchId, index, route) => {
2491
2698
  onErrorError
2492
2699
  );
2493
2700
  }
2494
- const headResult = executeHead(inner, matchId, route);
2495
- const head = headResult ? await headResult : void 0;
2496
2701
  inner.updateMatch(matchId, (prev) => ({
2497
2702
  ...prev,
2498
2703
  error,
2704
+ context: buildMatchContext(inner, index),
2499
2705
  status: "error",
2500
- isFetching: false,
2501
- ...head
2706
+ isFetching: false
2502
2707
  }));
2503
2708
  }
2504
2709
  } catch (err) {
2505
2710
  const match = inner.router.getMatch(matchId);
2506
2711
  if (match) {
2507
- const headResult = executeHead(inner, matchId, route);
2508
- if (headResult) {
2509
- const head = await headResult;
2510
- inner.updateMatch(matchId, (prev) => ({
2511
- ...prev,
2512
- ...head
2513
- }));
2514
- }
2515
2712
  match._nonReactive.loaderPromise = void 0;
2516
2713
  }
2517
2714
  handleRedirectAndNotFound(inner, match, err);
2518
2715
  }
2519
2716
  };
2520
2717
  const loadRouteMatch = async (inner, index) => {
2718
+ async function handleLoader(preload, prevMatch, match2, route2) {
2719
+ const age = Date.now() - prevMatch.updatedAt;
2720
+ const staleAge = preload ? route2.options.preloadStaleTime ?? inner.router.options.defaultPreloadStaleTime ?? 3e4 : route2.options.staleTime ?? inner.router.options.defaultStaleTime ?? 0;
2721
+ const shouldReloadOption = route2.options.shouldReload;
2722
+ const shouldReload = typeof shouldReloadOption === "function" ? shouldReloadOption(getLoaderContext(inner, matchId, index, route2)) : shouldReloadOption;
2723
+ const { status, invalid } = match2;
2724
+ loaderShouldRunAsync = status === "success" && (invalid || (shouldReload ?? age > staleAge));
2725
+ if (preload && route2.options.preload === false) ;
2726
+ else if (loaderShouldRunAsync && !inner.sync) {
2727
+ loaderIsRunningAsync = true;
2728
+ (async () => {
2729
+ try {
2730
+ await runLoader(inner, matchId, index, route2);
2731
+ const match3 = inner.router.getMatch(matchId);
2732
+ match3._nonReactive.loaderPromise?.resolve();
2733
+ match3._nonReactive.loadPromise?.resolve();
2734
+ match3._nonReactive.loaderPromise = void 0;
2735
+ } catch (err) {
2736
+ if (isRedirect(err)) {
2737
+ await inner.router.navigate(err.options);
2738
+ }
2739
+ }
2740
+ })();
2741
+ } else if (status !== "success" || loaderShouldRunAsync && inner.sync) {
2742
+ await runLoader(inner, matchId, index, route2);
2743
+ }
2744
+ }
2521
2745
  const { id: matchId, routeId } = inner.matches[index];
2522
2746
  let loaderShouldRunAsync = false;
2523
2747
  let loaderIsRunningAsync = false;
2524
2748
  const route = inner.router.looseRoutesById[routeId];
2525
- if (shouldSkipLoader(inner, matchId)) {
2526
- if (inner.router.isServer) {
2527
- const headResult = executeHead(inner, matchId, route);
2528
- if (headResult) {
2529
- const head = await headResult;
2530
- inner.updateMatch(matchId, (prev) => ({
2531
- ...prev,
2532
- ...head
2533
- }));
2534
- }
2535
- return inner.router.getMatch(matchId);
2536
- }
2537
- } else {
2749
+ if (shouldSkipLoader(inner, matchId)) ; else {
2538
2750
  const prevMatch = inner.router.getMatch(matchId);
2751
+ const preload = resolvePreload(inner, matchId);
2539
2752
  if (prevMatch._nonReactive.loaderPromise) {
2540
2753
  if (prevMatch.status === "success" && !inner.sync && !prevMatch.preload) {
2541
2754
  return prevMatch;
@@ -2546,13 +2759,11 @@ const loadRouteMatch = async (inner, index) => {
2546
2759
  if (error) {
2547
2760
  handleRedirectAndNotFound(inner, match2, error);
2548
2761
  }
2762
+ if (match2.status === "pending") {
2763
+ await handleLoader(preload, prevMatch, match2, route);
2764
+ }
2549
2765
  } else {
2550
- const age = Date.now() - prevMatch.updatedAt;
2551
- const preload = resolvePreload(inner, matchId);
2552
- const staleAge = preload ? route.options.preloadStaleTime ?? inner.router.options.defaultPreloadStaleTime ?? 3e4 : route.options.staleTime ?? inner.router.options.defaultStaleTime ?? 0;
2553
- const shouldReloadOption = route.options.shouldReload;
2554
- const shouldReload = typeof shouldReloadOption === "function" ? shouldReloadOption(getLoaderContext(inner, matchId, index, route)) : shouldReloadOption;
2555
- const nextPreload = !!preload && !inner.router.state.matches.some((d) => d.id === matchId);
2766
+ const nextPreload = preload && !inner.router.state.matches.some((d) => d.id === matchId);
2556
2767
  const match2 = inner.router.getMatch(matchId);
2557
2768
  match2._nonReactive.loaderPromise = createControlledPromise();
2558
2769
  if (nextPreload !== match2.preload) {
@@ -2561,36 +2772,7 @@ const loadRouteMatch = async (inner, index) => {
2561
2772
  preload: nextPreload
2562
2773
  }));
2563
2774
  }
2564
- const { status, invalid } = match2;
2565
- loaderShouldRunAsync = status === "success" && (invalid || (shouldReload ?? age > staleAge));
2566
- if (preload && route.options.preload === false) ;
2567
- else if (loaderShouldRunAsync && !inner.sync) {
2568
- loaderIsRunningAsync = true;
2569
- (async () => {
2570
- try {
2571
- await runLoader(inner, matchId, index, route);
2572
- const match3 = inner.router.getMatch(matchId);
2573
- match3._nonReactive.loaderPromise?.resolve();
2574
- match3._nonReactive.loadPromise?.resolve();
2575
- match3._nonReactive.loaderPromise = void 0;
2576
- } catch (err) {
2577
- if (isRedirect(err)) {
2578
- await inner.router.navigate(err.options);
2579
- }
2580
- }
2581
- })();
2582
- } else if (status !== "success" || loaderShouldRunAsync && inner.sync) {
2583
- await runLoader(inner, matchId, index, route);
2584
- } else {
2585
- const headResult = executeHead(inner, matchId, route);
2586
- if (headResult) {
2587
- const head = await headResult;
2588
- inner.updateMatch(matchId, (prev) => ({
2589
- ...prev,
2590
- ...head
2591
- }));
2592
- }
2593
- }
2775
+ await handleLoader(preload, prevMatch, match2, route);
2594
2776
  }
2595
2777
  }
2596
2778
  const match = inner.router.getMatch(matchId);
@@ -2618,7 +2800,7 @@ async function loadMatches(arg) {
2618
2800
  const inner = Object.assign(arg, {
2619
2801
  matchPromises: []
2620
2802
  });
2621
- if (!inner.router.isServer && inner.router.state.matches.some((d) => d._forcePending)) {
2803
+ if (inner.router.state.matches.some((d) => d._forcePending)) {
2622
2804
  triggerOnReady(inner);
2623
2805
  }
2624
2806
  try {
@@ -2630,7 +2812,38 @@ async function loadMatches(arg) {
2630
2812
  for (let i = 0; i < max; i++) {
2631
2813
  inner.matchPromises.push(loadRouteMatch(inner, i));
2632
2814
  }
2633
- await Promise.all(inner.matchPromises);
2815
+ const results = await Promise.allSettled(inner.matchPromises);
2816
+ const failures = results.filter(
2817
+ (result) => result.status === "rejected"
2818
+ ).map((result) => result.reason);
2819
+ let firstNotFound;
2820
+ for (const err of failures) {
2821
+ if (isRedirect(err)) {
2822
+ throw err;
2823
+ }
2824
+ if (!firstNotFound && isNotFound(err)) {
2825
+ firstNotFound = err;
2826
+ }
2827
+ }
2828
+ for (const match of inner.matches) {
2829
+ const { id: matchId, routeId } = match;
2830
+ const route = inner.router.looseRoutesById[routeId];
2831
+ try {
2832
+ const headResult = executeHead(inner, matchId, route);
2833
+ if (headResult) {
2834
+ const head = await headResult;
2835
+ inner.updateMatch(matchId, (prev) => ({
2836
+ ...prev,
2837
+ ...head
2838
+ }));
2839
+ }
2840
+ } catch (err) {
2841
+ console.error(`Error executing head for route ${routeId}:`, err);
2842
+ }
2843
+ }
2844
+ if (firstNotFound) {
2845
+ throw firstNotFound;
2846
+ }
2634
2847
  const readyPromise = triggerOnReady(inner);
2635
2848
  if (isPromise(readyPromise)) await readyPromise;
2636
2849
  } catch (err) {
@@ -2678,12 +2891,6 @@ async function loadRouteChunk(route) {
2678
2891
  }
2679
2892
  return route._componentsPromise;
2680
2893
  }
2681
- function makeMaybe(value, error) {
2682
- if (error) {
2683
- return { status: "error", error };
2684
- }
2685
- return { status: "success", value };
2686
- }
2687
2894
  function routeNeedsPreload(route) {
2688
2895
  for (const componentType of componentTypes) {
2689
2896
  if (route.options[componentType]?.preload) {
@@ -2810,15 +3017,13 @@ class RouterCore {
2810
3017
  ...newOptions
2811
3018
  };
2812
3019
  this.isServer = this.options.isServer ?? typeof document === "undefined";
2813
- this.pathParamsDecodeCharMap = this.options.pathParamsAllowedCharacters ? new Map(
2814
- this.options.pathParamsAllowedCharacters.map((char) => [
2815
- encodeURIComponent(char),
2816
- char
2817
- ])
2818
- ) : void 0;
3020
+ if (this.options.pathParamsAllowedCharacters)
3021
+ this.pathParamsDecoder = compileDecodeCharMap(
3022
+ this.options.pathParamsAllowedCharacters
3023
+ );
2819
3024
  if (!this.history || this.options.history && this.options.history !== this.history) {
2820
3025
  if (!this.options.history) {
2821
- if (!this.isServer) {
3026
+ {
2822
3027
  this.history = createBrowserHistory();
2823
3028
  }
2824
3029
  } else {
@@ -2827,7 +3032,7 @@ class RouterCore {
2827
3032
  }
2828
3033
  this.origin = this.options.origin;
2829
3034
  if (!this.origin) {
2830
- if (!this.isServer && window?.origin && window.origin !== "null") {
3035
+ if (window?.origin && window.origin !== "null") {
2831
3036
  this.origin = window.origin;
2832
3037
  } else {
2833
3038
  this.origin = "http://localhost";
@@ -2838,20 +3043,27 @@ class RouterCore {
2838
3043
  }
2839
3044
  if (this.options.routeTree !== this.routeTree) {
2840
3045
  this.routeTree = this.options.routeTree;
2841
- this.buildRouteTree();
3046
+ let processRouteTreeResult;
3047
+ {
3048
+ this.resolvePathCache = createLRUCache(1e3);
3049
+ processRouteTreeResult = this.buildRouteTree();
3050
+ }
3051
+ this.setRoutes(processRouteTreeResult);
2842
3052
  }
2843
3053
  if (!this.__store && this.latestLocation) {
2844
- this.__store = new Store(getInitialRouterState(this.latestLocation), {
2845
- onUpdate: () => {
2846
- this.__store.state = {
2847
- ...this.state,
2848
- cachedMatches: this.state.cachedMatches.filter(
2849
- (d) => !["redirected"].includes(d.status)
2850
- )
2851
- };
2852
- }
2853
- });
2854
- setupScrollRestoration(this);
3054
+ {
3055
+ this.__store = new Store(getInitialRouterState(this.latestLocation), {
3056
+ onUpdate: () => {
3057
+ this.__store.state = {
3058
+ ...this.state,
3059
+ cachedMatches: this.state.cachedMatches.filter(
3060
+ (d) => !["redirected"].includes(d.status)
3061
+ )
3062
+ };
3063
+ }
3064
+ });
3065
+ setupScrollRestoration(this);
3066
+ }
2855
3067
  }
2856
3068
  let needsLocationUpdate = false;
2857
3069
  const nextBasepath = this.options.basepath ?? "/";
@@ -2861,7 +3073,8 @@ class RouterCore {
2861
3073
  if (basepathChanged || rewriteChanged) {
2862
3074
  this.basepath = nextBasepath;
2863
3075
  const rewrites = [];
2864
- if (trimPath(nextBasepath) !== "") {
3076
+ const trimmed = trimPath(nextBasepath);
3077
+ if (trimmed && trimmed !== "/") {
2865
3078
  rewrites.push(
2866
3079
  rewriteBasepath({
2867
3080
  basepath: nextBasepath
@@ -2896,7 +3109,7 @@ class RouterCore {
2896
3109
  );
2897
3110
  };
2898
3111
  this.buildRouteTree = () => {
2899
- const { routesById, routesByPath, processedTree } = processRouteTree(
3112
+ const result = processRouteTree(
2900
3113
  this.routeTree,
2901
3114
  this.options.caseSensitive,
2902
3115
  (route, i) => {
@@ -2906,18 +3119,9 @@ class RouterCore {
2906
3119
  }
2907
3120
  );
2908
3121
  if (this.options.routeMasks) {
2909
- processRouteMasks(this.options.routeMasks, processedTree);
2910
- }
2911
- this.routesById = routesById;
2912
- this.routesByPath = routesByPath;
2913
- this.processedTree = processedTree;
2914
- const notFoundRoute = this.options.notFoundRoute;
2915
- if (notFoundRoute) {
2916
- notFoundRoute.init({
2917
- originalIndex: 99999999999
2918
- });
2919
- this.routesById[notFoundRoute.id] = notFoundRoute;
3122
+ processRouteMasks(this.options.routeMasks, result.processedTree);
2920
3123
  }
3124
+ return result;
2921
3125
  };
2922
3126
  this.subscribe = (eventType, fn) => {
2923
3127
  const listener = {
@@ -2938,24 +3142,43 @@ class RouterCore {
2938
3142
  };
2939
3143
  this.parseLocation = (locationToParse, previousLocation) => {
2940
3144
  const parse = ({
3145
+ pathname,
3146
+ search,
3147
+ hash,
2941
3148
  href,
2942
3149
  state
2943
3150
  }) => {
3151
+ if (!this.rewrite && !/[ \x00-\x1f\x7f\u0080-\uffff]/.test(pathname)) {
3152
+ const parsedSearch2 = this.options.parseSearch(search);
3153
+ const searchStr2 = this.options.stringifySearch(parsedSearch2);
3154
+ return {
3155
+ href: pathname + searchStr2 + hash,
3156
+ publicHref: href,
3157
+ pathname: decodePath(pathname).path,
3158
+ external: false,
3159
+ searchStr: searchStr2,
3160
+ search: replaceEqualDeep(
3161
+ previousLocation?.search,
3162
+ parsedSearch2
3163
+ ),
3164
+ hash: decodePath(hash.slice(1)).path,
3165
+ state: replaceEqualDeep(previousLocation?.state, state)
3166
+ };
3167
+ }
2944
3168
  const fullUrl = new URL(href, this.origin);
2945
3169
  const url = executeRewriteInput(this.rewrite, fullUrl);
2946
3170
  const parsedSearch = this.options.parseSearch(url.search);
2947
3171
  const searchStr = this.options.stringifySearch(parsedSearch);
2948
3172
  url.search = searchStr;
2949
3173
  const fullPath = url.href.replace(url.origin, "");
2950
- const { pathname, hash } = url;
2951
3174
  return {
2952
3175
  href: fullPath,
2953
3176
  publicHref: href,
2954
- url: url.href,
2955
- pathname: decodePath(pathname),
3177
+ pathname: decodePath(url.pathname).path,
3178
+ external: !!this.rewrite && url.origin !== this.origin,
2956
3179
  searchStr,
2957
3180
  search: replaceEqualDeep(previousLocation?.search, parsedSearch),
2958
- hash: hash.split("#").reverse()[0] ?? "",
3181
+ hash: decodePath(url.hash.slice(1)).path,
2959
3182
  state: replaceEqualDeep(previousLocation?.state, state)
2960
3183
  };
2961
3184
  };
@@ -2973,7 +3196,6 @@ class RouterCore {
2973
3196
  }
2974
3197
  return location;
2975
3198
  };
2976
- this.resolvePathCache = createLRUCache(1e3);
2977
3199
  this.resolvePathWithBase = (from, path) => {
2978
3200
  const resolvedPath = resolvePath({
2979
3201
  base: from,
@@ -3028,15 +3250,12 @@ class RouterCore {
3028
3250
  this.buildLocation = (opts) => {
3029
3251
  const build = (dest = {}) => {
3030
3252
  const currentLocation = dest._fromLocation || this.pendingBuiltLocation || this.latestLocation;
3031
- const allCurrentLocationMatches = this.matchRoutes(currentLocation, {
3032
- _buildLocation: true
3033
- });
3034
- const lastMatch = last(allCurrentLocationMatches);
3253
+ const lightweightResult = this.matchRoutesLightweight(currentLocation);
3035
3254
  if (dest.from && false) ;
3036
- const defaultedFromPath = dest.unsafeRelative === "path" ? currentLocation.pathname : dest.from ?? lastMatch.fullPath;
3255
+ const defaultedFromPath = dest.unsafeRelative === "path" ? currentLocation.pathname : dest.from ?? lightweightResult.fullPath;
3037
3256
  const fromPath = this.resolvePathWithBase(defaultedFromPath, ".");
3038
- const fromSearch = lastMatch.search;
3039
- const fromParams = { ...lastMatch.params };
3257
+ const fromSearch = lightweightResult.search;
3258
+ const fromParams = { ...lightweightResult.params };
3040
3259
  const nextTo = dest.to ? this.resolvePathWithBase(fromPath, `${dest.to}`) : this.resolvePathWithBase(fromPath, ".");
3041
3260
  const nextParams = dest.params === false || dest.params === null ? {} : (dest.params ?? true) === true ? fromParams : Object.assign(
3042
3261
  fromParams,
@@ -3044,15 +3263,22 @@ class RouterCore {
3044
3263
  );
3045
3264
  const interpolatedNextTo = interpolatePath({
3046
3265
  path: nextTo,
3047
- params: nextParams
3266
+ params: nextParams,
3267
+ decoder: this.pathParamsDecoder,
3268
+ server: this.isServer
3048
3269
  }).interpolatedPath;
3049
- const destRoutes = this.matchRoutes(interpolatedNextTo, void 0, {
3050
- _buildLocation: true
3051
- }).map((d) => this.looseRoutesById[d.routeId]);
3270
+ const destMatchResult = this.getMatchedRoutes(interpolatedNextTo);
3271
+ let destRoutes = destMatchResult.matchedRoutes;
3272
+ const isGlobalNotFound = destMatchResult.foundRoute ? destMatchResult.foundRoute.path !== "/" && destMatchResult.routeParams["**"] : trimPathRight(interpolatedNextTo);
3273
+ if (isGlobalNotFound && this.options.notFoundRoute) {
3274
+ destRoutes = [...destRoutes, this.options.notFoundRoute];
3275
+ }
3276
+ let changedParams = false;
3052
3277
  if (Object.keys(nextParams).length > 0) {
3053
3278
  for (const route of destRoutes) {
3054
3279
  const fn = route.options.params?.stringify ?? route.options.stringifyParams;
3055
3280
  if (fn) {
3281
+ changedParams = true;
3056
3282
  Object.assign(nextParams, fn(nextParams));
3057
3283
  }
3058
3284
  }
@@ -3062,12 +3288,13 @@ class RouterCore {
3062
3288
  // This preserves the original parameter syntax including optional parameters
3063
3289
  nextTo
3064
3290
  ) : decodePath(
3065
- interpolatePath({
3291
+ !changedParams ? interpolatedNextTo : interpolatePath({
3066
3292
  path: nextTo,
3067
3293
  params: nextParams,
3068
- decodeCharMap: this.pathParamsDecodeCharMap
3294
+ decoder: this.pathParamsDecoder,
3295
+ server: this.isServer
3069
3296
  }).interpolatedPath
3070
- );
3297
+ ).path;
3071
3298
  let nextSearch = fromSearch;
3072
3299
  if (opts._includeValidateSearch && this.options.search?.strict) {
3073
3300
  const validatedSearch = {};
@@ -3100,17 +3327,32 @@ class RouterCore {
3100
3327
  let nextState = dest.state === true ? currentLocation.state : dest.state ? functionalUpdate(dest.state, currentLocation.state) : {};
3101
3328
  nextState = replaceEqualDeep(currentLocation.state, nextState);
3102
3329
  const fullPath = `${nextPathname}${searchStr}${hashStr}`;
3103
- const url = new URL(fullPath, this.origin);
3104
- const rewrittenUrl = executeRewriteOutput(this.rewrite, url);
3330
+ let href;
3331
+ let publicHref;
3332
+ let external = false;
3333
+ if (this.rewrite) {
3334
+ const url = new URL(fullPath, this.origin);
3335
+ const rewrittenUrl = executeRewriteOutput(this.rewrite, url);
3336
+ href = url.href.replace(url.origin, "");
3337
+ if (rewrittenUrl.origin !== this.origin) {
3338
+ publicHref = rewrittenUrl.href;
3339
+ external = true;
3340
+ } else {
3341
+ publicHref = rewrittenUrl.pathname + rewrittenUrl.search + rewrittenUrl.hash;
3342
+ }
3343
+ } else {
3344
+ href = encodePathLikeUrl(fullPath);
3345
+ publicHref = href;
3346
+ }
3105
3347
  return {
3106
- publicHref: rewrittenUrl.pathname + rewrittenUrl.search + rewrittenUrl.hash,
3107
- href: fullPath,
3108
- url: rewrittenUrl.href,
3348
+ publicHref,
3349
+ href,
3109
3350
  pathname: nextPathname,
3110
3351
  search: nextSearch,
3111
3352
  searchStr,
3112
3353
  state: nextState,
3113
3354
  hash: hash ?? "",
3355
+ external,
3114
3356
  unmaskOnReload: dest.unmaskOnReload
3115
3357
  };
3116
3358
  };
@@ -3125,12 +3367,17 @@ class RouterCore {
3125
3367
  this.processedTree
3126
3368
  );
3127
3369
  if (match) {
3128
- Object.assign(params, match.params);
3129
- const { from: _from, ...maskProps } = match.route;
3370
+ Object.assign(params, match.rawParams);
3371
+ const {
3372
+ from: _from,
3373
+ params: maskParams,
3374
+ ...maskProps
3375
+ } = match.route;
3376
+ const nextParams = maskParams === false || maskParams === null ? {} : (maskParams ?? true) === true ? params : Object.assign(params, functionalUpdate(maskParams, params));
3130
3377
  maskedDest = {
3131
3378
  from: opts.from,
3132
3379
  ...maskProps,
3133
- params
3380
+ params: nextParams
3134
3381
  };
3135
3382
  maskedNext = build(maskedDest);
3136
3383
  }
@@ -3149,7 +3396,7 @@ class RouterCore {
3149
3396
  }
3150
3397
  return buildWithMatches(opts);
3151
3398
  };
3152
- this.commitLocation = ({
3399
+ this.commitLocation = async ({
3153
3400
  viewTransition,
3154
3401
  ignoreBlocker,
3155
3402
  ...next
@@ -3179,7 +3426,13 @@ class RouterCore {
3179
3426
  if (isSameUrl && isSameState()) {
3180
3427
  this.load();
3181
3428
  } else {
3182
- let { maskedLocation, hashScrollIntoView, ...nextHistory } = next;
3429
+ let {
3430
+ // eslint-disable-next-line prefer-const
3431
+ maskedLocation,
3432
+ // eslint-disable-next-line prefer-const
3433
+ hashScrollIntoView,
3434
+ ...nextHistory
3435
+ } = next;
3183
3436
  if (maskedLocation) {
3184
3437
  nextHistory = {
3185
3438
  ...maskedLocation,
@@ -3232,7 +3485,9 @@ class RouterCore {
3232
3485
  const parsed = parseHref(href, {
3233
3486
  __TSR_index: replace ? currentIndex : currentIndex + 1
3234
3487
  });
3235
- rest.to = parsed.pathname;
3488
+ const hrefUrl = new URL(parsed.pathname, this.origin);
3489
+ const rewrittenUrl = executeRewriteInput(this.rewrite, hrefUrl);
3490
+ rest.to = rewrittenUrl.pathname;
3236
3491
  rest.search = this.options.parseSearch(parsed.search);
3237
3492
  rest.hash = parsed.hash.slice(1);
3238
3493
  }
@@ -3256,18 +3511,33 @@ class RouterCore {
3256
3511
  });
3257
3512
  return commitPromise;
3258
3513
  };
3259
- this.navigate = async ({ to, reloadDocument, href, ...rest }) => {
3260
- if (!reloadDocument && href) {
3514
+ this.navigate = async ({
3515
+ to,
3516
+ reloadDocument,
3517
+ href,
3518
+ publicHref,
3519
+ ...rest
3520
+ }) => {
3521
+ let hrefIsUrl = false;
3522
+ if (href) {
3261
3523
  try {
3262
3524
  new URL(`${href}`);
3263
- reloadDocument = true;
3525
+ hrefIsUrl = true;
3264
3526
  } catch {
3265
3527
  }
3266
3528
  }
3529
+ if (hrefIsUrl && !reloadDocument) {
3530
+ reloadDocument = true;
3531
+ }
3267
3532
  if (reloadDocument) {
3268
- if (!href) {
3533
+ if (to !== void 0 || !href) {
3269
3534
  const location = this.buildLocation({ to, ...rest });
3270
- href = location.url;
3535
+ href = href ?? location.publicHref;
3536
+ publicHref = publicHref ?? location.publicHref;
3537
+ }
3538
+ const reloadHref = !hrefIsUrl && publicHref ? publicHref : href;
3539
+ if (isDangerousProtocol(reloadHref)) {
3540
+ return Promise.resolve();
3271
3541
  }
3272
3542
  if (!rest.ignoreBlocker) {
3273
3543
  const historyWithBlockers = this.history;
@@ -3287,9 +3557,9 @@ class RouterCore {
3287
3557
  }
3288
3558
  }
3289
3559
  if (rest.replace) {
3290
- window.location.replace(href);
3560
+ window.location.replace(reloadHref);
3291
3561
  } else {
3292
- window.location.href = href;
3562
+ window.location.href = reloadHref;
3293
3563
  }
3294
3564
  return Promise.resolve();
3295
3565
  }
@@ -3303,30 +3573,6 @@ class RouterCore {
3303
3573
  this.beforeLoad = () => {
3304
3574
  this.cancelMatches();
3305
3575
  this.updateLatestLocation();
3306
- if (this.isServer) {
3307
- const nextLocation = this.buildLocation({
3308
- to: this.latestLocation.pathname,
3309
- search: true,
3310
- params: true,
3311
- hash: true,
3312
- state: true,
3313
- _includeValidateSearch: true
3314
- });
3315
- const normalizeUrl = (url) => {
3316
- try {
3317
- return encodeURI(decodeURI(url));
3318
- } catch {
3319
- return url;
3320
- }
3321
- };
3322
- if (trimPath(normalizeUrl(this.latestLocation.href)) !== trimPath(normalizeUrl(nextLocation.href))) {
3323
- let href = nextLocation.url;
3324
- if (this.origin && href.startsWith(this.origin)) {
3325
- href = href.replace(this.origin, "") || "/";
3326
- }
3327
- throw redirect({ href });
3328
- }
3329
- }
3330
3576
  const pendingMatches = this.matchRoutes(this.latestLocation);
3331
3577
  this.__store.setState((s) => ({
3332
3578
  ...s,
@@ -3433,7 +3679,7 @@ class RouterCore {
3433
3679
  } catch (err) {
3434
3680
  if (isRedirect(err)) {
3435
3681
  redirect2 = err;
3436
- if (!this.isServer) {
3682
+ {
3437
3683
  this.navigate({
3438
3684
  ...redirect2.options,
3439
3685
  replace: true,
@@ -3477,7 +3723,7 @@ class RouterCore {
3477
3723
  };
3478
3724
  this.startViewTransition = (fn) => {
3479
3725
  const shouldViewTransition = this.shouldViewTransition ?? this.options.defaultViewTransition;
3480
- delete this.shouldViewTransition;
3726
+ this.shouldViewTransition = void 0;
3481
3727
  if (shouldViewTransition && typeof document !== "undefined" && "startViewTransition" in document && typeof document.startViewTransition === "function") {
3482
3728
  let startViewTransitionParams;
3483
3729
  if (typeof shouldViewTransition === "object" && this.isViewTransitionTypesSupported) {
@@ -3542,15 +3788,26 @@ class RouterCore {
3542
3788
  this.shouldViewTransition = false;
3543
3789
  return this.load({ sync: opts?.sync });
3544
3790
  };
3791
+ this.getParsedLocationHref = (location) => {
3792
+ return location.publicHref || "/";
3793
+ };
3545
3794
  this.resolveRedirect = (redirect2) => {
3546
- if (!redirect2.options.href) {
3547
- const location = this.buildLocation(redirect2.options);
3548
- let href = location.url;
3549
- if (this.origin && href.startsWith(this.origin)) {
3550
- href = href.replace(this.origin, "") || "/";
3551
- }
3552
- redirect2.options.href = location.href;
3795
+ const locationHeader = redirect2.headers.get("Location");
3796
+ if (!redirect2.options.href || redirect2.options._builtLocation) {
3797
+ const location = redirect2.options._builtLocation ?? this.buildLocation(redirect2.options);
3798
+ const href = this.getParsedLocationHref(location);
3799
+ redirect2.options.href = href;
3553
3800
  redirect2.headers.set("Location", href);
3801
+ } else if (locationHeader) {
3802
+ try {
3803
+ const url = new URL(locationHeader);
3804
+ if (this.origin && url.origin === this.origin) {
3805
+ const href = url.pathname + url.search + url.hash;
3806
+ redirect2.options.href = href;
3807
+ redirect2.headers.set("Location", href);
3808
+ }
3809
+ } catch {
3810
+ }
3554
3811
  }
3555
3812
  if (!redirect2.headers.get("Location")) {
3556
3813
  redirect2.headers.set("Location", redirect2.options.href);
@@ -3676,14 +3933,14 @@ class RouterCore {
3676
3933
  return false;
3677
3934
  }
3678
3935
  if (location.params) {
3679
- if (!deepEqual(match.params, location.params, { partial: true })) {
3936
+ if (!deepEqual(match.rawParams, location.params, { partial: true })) {
3680
3937
  return false;
3681
3938
  }
3682
3939
  }
3683
3940
  if (opts?.includeSearch ?? true) {
3684
- return deepEqual(baseLocation.search, next.search, { partial: true }) ? match.params : false;
3941
+ return deepEqual(baseLocation.search, next.search, { partial: true }) ? match.rawParams : false;
3685
3942
  }
3686
- return match.params;
3943
+ return match.rawParams;
3687
3944
  };
3688
3945
  this.hasNotFoundMatch = () => {
3689
3946
  return this.__store.state.matches.some(
@@ -3714,12 +3971,33 @@ class RouterCore {
3714
3971
  get state() {
3715
3972
  return this.__store.state;
3716
3973
  }
3974
+ setRoutes({
3975
+ routesById,
3976
+ routesByPath,
3977
+ processedTree
3978
+ }) {
3979
+ this.routesById = routesById;
3980
+ this.routesByPath = routesByPath;
3981
+ this.processedTree = processedTree;
3982
+ const notFoundRoute = this.options.notFoundRoute;
3983
+ if (notFoundRoute) {
3984
+ notFoundRoute.init({
3985
+ originalIndex: 99999999999
3986
+ });
3987
+ this.routesById[notFoundRoute.id] = notFoundRoute;
3988
+ }
3989
+ }
3717
3990
  get looseRoutesById() {
3718
3991
  return this.routesById;
3719
3992
  }
3993
+ getParentContext(parentMatch) {
3994
+ const parentMatchId = parentMatch?.id;
3995
+ const parentContext = !parentMatchId ? this.options.context ?? void 0 : parentMatch.context ?? this.options.context ?? void 0;
3996
+ return parentContext;
3997
+ }
3720
3998
  matchRoutesInternal(next, opts) {
3721
3999
  const matchedRoutesResult = this.getMatchedRoutes(next.pathname);
3722
- const { foundRoute, routeParams } = matchedRoutesResult;
4000
+ const { foundRoute, routeParams, parsedParams } = matchedRoutesResult;
3723
4001
  let { matchedRoutes } = matchedRoutesResult;
3724
4002
  let isGlobalNotFound = false;
3725
4003
  if (
@@ -3735,41 +4013,28 @@ class RouterCore {
3735
4013
  isGlobalNotFound = true;
3736
4014
  }
3737
4015
  }
3738
- const globalNotFoundRouteId = (() => {
3739
- if (!isGlobalNotFound) {
3740
- return void 0;
3741
- }
3742
- if (this.options.notFoundMode !== "root") {
3743
- for (let i = matchedRoutes.length - 1; i >= 0; i--) {
3744
- const route = matchedRoutes[i];
3745
- if (route.children) {
3746
- return route.id;
3747
- }
3748
- }
3749
- }
3750
- return rootRouteId;
3751
- })();
3752
- const matches = [];
3753
- const getParentContext = (parentMatch) => {
3754
- const parentMatchId = parentMatch?.id;
3755
- const parentContext = !parentMatchId ? this.options.context ?? void 0 : parentMatch.context ?? this.options.context ?? void 0;
3756
- return parentContext;
3757
- };
3758
- matchedRoutes.forEach((route, index) => {
4016
+ const globalNotFoundRouteId = isGlobalNotFound ? findGlobalNotFoundRouteId(this.options.notFoundMode, matchedRoutes) : void 0;
4017
+ const matches = new Array(matchedRoutes.length);
4018
+ const previousMatchesByRouteId = new Map(
4019
+ this.state.matches.map((match) => [match.routeId, match])
4020
+ );
4021
+ for (let index = 0; index < matchedRoutes.length; index++) {
4022
+ const route = matchedRoutes[index];
3759
4023
  const parentMatch = matches[index - 1];
3760
- const [preMatchSearch, strictMatchSearch, searchError] = (() => {
4024
+ let preMatchSearch;
4025
+ let strictMatchSearch;
4026
+ let searchError;
4027
+ {
3761
4028
  const parentSearch = parentMatch?.search ?? next.search;
3762
4029
  const parentStrictSearch = parentMatch?._strictSearch ?? void 0;
3763
4030
  try {
3764
4031
  const strictSearch = validateSearch(route.options.validateSearch, { ...parentSearch }) ?? void 0;
3765
- return [
3766
- {
3767
- ...parentSearch,
3768
- ...strictSearch
3769
- },
3770
- { ...parentStrictSearch, ...strictSearch },
3771
- void 0
3772
- ];
4032
+ preMatchSearch = {
4033
+ ...parentSearch,
4034
+ ...strictSearch
4035
+ };
4036
+ strictMatchSearch = { ...parentStrictSearch, ...strictSearch };
4037
+ searchError = void 0;
3773
4038
  } catch (err) {
3774
4039
  let searchParamError = err;
3775
4040
  if (!(err instanceof SearchParamError)) {
@@ -3780,9 +4045,11 @@ class RouterCore {
3780
4045
  if (opts?.throwOnError) {
3781
4046
  throw searchParamError;
3782
4047
  }
3783
- return [parentSearch, {}, searchParamError];
4048
+ preMatchSearch = parentSearch;
4049
+ strictMatchSearch = {};
4050
+ searchError = searchParamError;
3784
4051
  }
3785
- })();
4052
+ }
3786
4053
  const loaderDeps = route.options.loaderDeps?.({
3787
4054
  search: preMatchSearch
3788
4055
  }) ?? "";
@@ -3790,7 +4057,8 @@ class RouterCore {
3790
4057
  const { interpolatedPath, usedParams } = interpolatePath({
3791
4058
  path: route.fullPath,
3792
4059
  params: routeParams,
3793
- decodeCharMap: this.pathParamsDecodeCharMap
4060
+ decoder: this.pathParamsDecoder,
4061
+ server: this.isServer
3794
4062
  });
3795
4063
  const matchId = (
3796
4064
  // route.id for disambiguation
@@ -3799,30 +4067,22 @@ class RouterCore {
3799
4067
  loaderDepsHash
3800
4068
  );
3801
4069
  const existingMatch = this.getMatch(matchId);
3802
- const previousMatch = this.state.matches.find(
3803
- (d) => d.routeId === route.id
3804
- );
4070
+ const previousMatch = previousMatchesByRouteId.get(route.id);
3805
4071
  const strictParams = existingMatch?._strictParams ?? usedParams;
3806
4072
  let paramsError = void 0;
3807
4073
  if (!existingMatch) {
3808
- const strictParseParams = route.options.params?.parse ?? route.options.parseParams;
3809
- if (strictParseParams) {
3810
- try {
3811
- Object.assign(
3812
- strictParams,
3813
- strictParseParams(strictParams)
3814
- );
3815
- } catch (err) {
3816
- if (isNotFound(err) || isRedirect(err)) {
3817
- paramsError = err;
3818
- } else {
3819
- paramsError = new PathParamError(err.message, {
3820
- cause: err
3821
- });
3822
- }
3823
- if (opts?.throwOnError) {
3824
- throw paramsError;
3825
- }
4074
+ try {
4075
+ extractStrictParams(route, usedParams, parsedParams, strictParams);
4076
+ } catch (err) {
4077
+ if (isNotFound(err) || isRedirect(err)) {
4078
+ paramsError = err;
4079
+ } else {
4080
+ paramsError = new PathParamError(err.message, {
4081
+ cause: err
4082
+ });
4083
+ }
4084
+ if (opts?.throwOnError) {
4085
+ throw paramsError;
3826
4086
  }
3827
4087
  }
3828
4088
  }
@@ -3833,7 +4093,7 @@ class RouterCore {
3833
4093
  match = {
3834
4094
  ...existingMatch,
3835
4095
  cause,
3836
- params: previousMatch ? replaceEqualDeep(previousMatch.params, routeParams) : routeParams,
4096
+ params: previousMatch?.params ?? routeParams,
3837
4097
  _strictParams: strictParams,
3838
4098
  search: previousMatch ? replaceEqualDeep(previousMatch.search, preMatchSearch) : replaceEqualDeep(existingMatch.search, preMatchSearch),
3839
4099
  _strictSearch: strictMatchSearch
@@ -3842,10 +4102,10 @@ class RouterCore {
3842
4102
  const status = route.options.loader || route.options.beforeLoad || route.lazyFn || routeNeedsPreload(route) ? "pending" : "success";
3843
4103
  match = {
3844
4104
  id: matchId,
3845
- ssr: this.isServer ? void 0 : route.options.ssr,
4105
+ ssr: route.options.ssr,
3846
4106
  index,
3847
4107
  routeId: route.id,
3848
- params: previousMatch ? replaceEqualDeep(previousMatch.params, routeParams) : routeParams,
4108
+ params: previousMatch?.params ?? routeParams,
3849
4109
  _strictParams: strictParams,
3850
4110
  pathname: interpolatedPath,
3851
4111
  updatedAt: Date.now(),
@@ -3880,20 +4140,23 @@ class RouterCore {
3880
4140
  match.globalNotFound = globalNotFoundRouteId === route.id;
3881
4141
  }
3882
4142
  match.searchError = searchError;
3883
- const parentContext = getParentContext(parentMatch);
4143
+ const parentContext = this.getParentContext(parentMatch);
3884
4144
  match.context = {
3885
4145
  ...parentContext,
3886
4146
  ...match.__routeContext,
3887
4147
  ...match.__beforeLoadContext
3888
4148
  };
3889
- matches.push(match);
3890
- });
3891
- matches.forEach((match, index) => {
4149
+ matches[index] = match;
4150
+ }
4151
+ for (let index = 0; index < matches.length; index++) {
4152
+ const match = matches[index];
3892
4153
  const route = this.looseRoutesById[match.routeId];
3893
4154
  const existingMatch = this.getMatch(match.id);
3894
- if (!existingMatch && opts?._buildLocation !== true) {
4155
+ const previousMatch = previousMatchesByRouteId.get(match.routeId);
4156
+ match.params = previousMatch ? replaceEqualDeep(previousMatch.params, routeParams) : routeParams;
4157
+ if (!existingMatch) {
3895
4158
  const parentMatch = matches[index - 1];
3896
- const parentContext = getParentContext(parentMatch);
4159
+ const parentContext = this.getParentContext(parentMatch);
3897
4160
  if (route.options.context) {
3898
4161
  const contextFnContext = {
3899
4162
  deps: match.loaderDeps,
@@ -3905,7 +4168,8 @@ class RouterCore {
3905
4168
  cause: match.cause,
3906
4169
  abortController: match.abortController,
3907
4170
  preload: !!match.preload,
3908
- matches
4171
+ matches,
4172
+ routeId: route.id
3909
4173
  };
3910
4174
  match.__routeContext = route.options.context(contextFnContext) ?? void 0;
3911
4175
  }
@@ -3915,9 +4179,56 @@ class RouterCore {
3915
4179
  ...match.__beforeLoadContext
3916
4180
  };
3917
4181
  }
3918
- });
4182
+ }
3919
4183
  return matches;
3920
4184
  }
4185
+ /**
4186
+ * Lightweight route matching for buildLocation.
4187
+ * Only computes fullPath, accumulated search, and params - skipping expensive
4188
+ * operations like AbortController, ControlledPromise, loaderDeps, and full match objects.
4189
+ */
4190
+ matchRoutesLightweight(location) {
4191
+ const { matchedRoutes, routeParams, parsedParams } = this.getMatchedRoutes(
4192
+ location.pathname
4193
+ );
4194
+ const lastRoute = last(matchedRoutes);
4195
+ const accumulatedSearch = { ...location.search };
4196
+ for (const route of matchedRoutes) {
4197
+ try {
4198
+ Object.assign(
4199
+ accumulatedSearch,
4200
+ validateSearch(route.options.validateSearch, accumulatedSearch)
4201
+ );
4202
+ } catch {
4203
+ }
4204
+ }
4205
+ const lastStateMatch = last(this.state.matches);
4206
+ const canReuseParams = lastStateMatch && lastStateMatch.routeId === lastRoute.id && location.pathname === this.state.location.pathname;
4207
+ let params;
4208
+ if (canReuseParams) {
4209
+ params = lastStateMatch.params;
4210
+ } else {
4211
+ const strictParams = { ...routeParams };
4212
+ for (const route of matchedRoutes) {
4213
+ try {
4214
+ extractStrictParams(
4215
+ route,
4216
+ routeParams,
4217
+ parsedParams ?? {},
4218
+ strictParams
4219
+ );
4220
+ } catch {
4221
+ }
4222
+ }
4223
+ params = strictParams;
4224
+ }
4225
+ return {
4226
+ matchedRoutes,
4227
+ fullPath: lastRoute.fullPath,
4228
+ search: accumulatedSearch,
4229
+ params
4230
+ };
4231
+ }
3921
4232
  }
3922
4233
  class SearchParamError extends Error {
3923
4234
  }
@@ -3971,13 +4282,15 @@ function getMatchedRoutes({
3971
4282
  const routeParams = {};
3972
4283
  const trimmedPath = trimPathRight(pathname);
3973
4284
  let foundRoute = void 0;
4285
+ let parsedParams = void 0;
3974
4286
  const match = findRouteMatch(trimmedPath, processedTree, true);
3975
4287
  if (match) {
3976
4288
  foundRoute = match.route;
3977
- Object.assign(routeParams, match.params);
4289
+ Object.assign(routeParams, match.rawParams);
4290
+ parsedParams = Object.assign({}, match.parsedParams);
3978
4291
  }
3979
4292
  const matchedRoutes = match?.branch || [routesById[rootRouteId]];
3980
- return { matchedRoutes, routeParams, foundRoute };
4293
+ return { matchedRoutes, routeParams, foundRoute, parsedParams };
3981
4294
  }
3982
4295
  function applySearchMiddleware({
3983
4296
  search,
@@ -3985,79 +4298,112 @@ function applySearchMiddleware({
3985
4298
  destRoutes,
3986
4299
  _includeValidateSearch
3987
4300
  }) {
3988
- const allMiddlewares = destRoutes.reduce(
3989
- (acc, route) => {
3990
- const middlewares = [];
3991
- if ("search" in route.options) {
3992
- if (route.options.search?.middlewares) {
3993
- middlewares.push(...route.options.search.middlewares);
4301
+ const middleware = buildMiddlewareChain(destRoutes);
4302
+ return middleware(search, dest, _includeValidateSearch ?? false);
4303
+ }
4304
+ function buildMiddlewareChain(destRoutes) {
4305
+ const context = {
4306
+ dest: null,
4307
+ _includeValidateSearch: false,
4308
+ middlewares: []
4309
+ };
4310
+ for (const route of destRoutes) {
4311
+ if ("search" in route.options) {
4312
+ if (route.options.search?.middlewares) {
4313
+ context.middlewares.push(...route.options.search.middlewares);
4314
+ }
4315
+ } else if (route.options.preSearchFilters || route.options.postSearchFilters) {
4316
+ const legacyMiddleware = ({ search, next }) => {
4317
+ let nextSearch = search;
4318
+ if ("preSearchFilters" in route.options && route.options.preSearchFilters) {
4319
+ nextSearch = route.options.preSearchFilters.reduce(
4320
+ (prev, next2) => next2(prev),
4321
+ search
4322
+ );
3994
4323
  }
3995
- } else if (route.options.preSearchFilters || route.options.postSearchFilters) {
3996
- const legacyMiddleware = ({
3997
- search: search2,
3998
- next
3999
- }) => {
4000
- let nextSearch = search2;
4001
- if ("preSearchFilters" in route.options && route.options.preSearchFilters) {
4002
- nextSearch = route.options.preSearchFilters.reduce(
4003
- (prev, next2) => next2(prev),
4004
- search2
4005
- );
4006
- }
4007
- const result = next(nextSearch);
4008
- if ("postSearchFilters" in route.options && route.options.postSearchFilters) {
4009
- return route.options.postSearchFilters.reduce(
4010
- (prev, next2) => next2(prev),
4011
- result
4012
- );
4013
- }
4324
+ const result = next(nextSearch);
4325
+ if ("postSearchFilters" in route.options && route.options.postSearchFilters) {
4326
+ return route.options.postSearchFilters.reduce(
4327
+ (prev, next2) => next2(prev),
4328
+ result
4329
+ );
4330
+ }
4331
+ return result;
4332
+ };
4333
+ context.middlewares.push(legacyMiddleware);
4334
+ }
4335
+ if (route.options.validateSearch) {
4336
+ const validate = ({ search, next }) => {
4337
+ const result = next(search);
4338
+ if (!context._includeValidateSearch) return result;
4339
+ try {
4340
+ const validatedSearch = {
4341
+ ...result,
4342
+ ...validateSearch(route.options.validateSearch, result) ?? void 0
4343
+ };
4344
+ return validatedSearch;
4345
+ } catch {
4014
4346
  return result;
4015
- };
4016
- middlewares.push(legacyMiddleware);
4017
- }
4018
- if (_includeValidateSearch && route.options.validateSearch) {
4019
- const validate = ({ search: search2, next }) => {
4020
- const result = next(search2);
4021
- try {
4022
- const validatedSearch = {
4023
- ...result,
4024
- ...validateSearch(route.options.validateSearch, result) ?? void 0
4025
- };
4026
- return validatedSearch;
4027
- } catch {
4028
- return result;
4029
- }
4030
- };
4031
- middlewares.push(validate);
4032
- }
4033
- return acc.concat(middlewares);
4034
- },
4035
- []
4036
- ) ?? [];
4037
- const final = ({ search: search2 }) => {
4347
+ }
4348
+ };
4349
+ context.middlewares.push(validate);
4350
+ }
4351
+ }
4352
+ const final = ({ search }) => {
4353
+ const dest = context.dest;
4038
4354
  if (!dest.search) {
4039
4355
  return {};
4040
4356
  }
4041
4357
  if (dest.search === true) {
4042
- return search2;
4358
+ return search;
4043
4359
  }
4044
- return functionalUpdate(dest.search, search2);
4360
+ return functionalUpdate(dest.search, search);
4045
4361
  };
4046
- allMiddlewares.push(final);
4047
- const applyNext = (index, currentSearch) => {
4048
- if (index >= allMiddlewares.length) {
4362
+ context.middlewares.push(final);
4363
+ const applyNext = (index, currentSearch, middlewares) => {
4364
+ if (index >= middlewares.length) {
4049
4365
  return currentSearch;
4050
4366
  }
4051
- const middleware = allMiddlewares[index];
4367
+ const middleware = middlewares[index];
4052
4368
  const next = (newSearch) => {
4053
- return applyNext(index + 1, newSearch);
4369
+ return applyNext(index + 1, newSearch, middlewares);
4054
4370
  };
4055
4371
  return middleware({ search: currentSearch, next });
4056
4372
  };
4057
- return applyNext(0, search);
4373
+ return function middleware(search, dest, _includeValidateSearch) {
4374
+ context.dest = dest;
4375
+ context._includeValidateSearch = _includeValidateSearch;
4376
+ return applyNext(0, search, context.middlewares);
4377
+ };
4378
+ }
4379
+ function findGlobalNotFoundRouteId(notFoundMode, routes) {
4380
+ if (notFoundMode !== "root") {
4381
+ for (let i = routes.length - 1; i >= 0; i--) {
4382
+ const route = routes[i];
4383
+ if (route.children) {
4384
+ return route.id;
4385
+ }
4386
+ }
4387
+ }
4388
+ return rootRouteId;
4389
+ }
4390
+ function extractStrictParams(route, referenceParams, parsedParams, accumulatedParams) {
4391
+ const parseParams = route.options.params?.parse ?? route.options.parseParams;
4392
+ if (parseParams) {
4393
+ if (route.options.skipRouteOnParseError) {
4394
+ for (const key in referenceParams) {
4395
+ if (key in parsedParams) {
4396
+ accumulatedParams[key] = parsedParams[key];
4397
+ }
4398
+ }
4399
+ } else {
4400
+ const result = parseParams(accumulatedParams);
4401
+ Object.assign(accumulatedParams, result);
4402
+ }
4403
+ }
4058
4404
  }
4059
4405
 
4060
- const TSR_DEFERRED_PROMISE = Symbol.for("TSR_DEFERRED_PROMISE");
4406
+ const TSR_DEFERRED_PROMISE = /* @__PURE__ */ Symbol.for("TSR_DEFERRED_PROMISE");
4061
4407
  function defer(_promise, options) {
4062
4408
  const promise = _promise;
4063
4409
  if (promise[TSR_DEFERRED_PROMISE]) {
@@ -4122,7 +4468,7 @@ class BaseRoute {
4122
4468
  this._path = path;
4123
4469
  this._id = id;
4124
4470
  this._fullPath = fullPath;
4125
- this._to = fullPath;
4471
+ this._to = trimPathRight(fullPath);
4126
4472
  };
4127
4473
  this.addChildren = (children) => {
4128
4474
  return this._addFileChildren(children);
@@ -4151,6 +4497,7 @@ class BaseRoute {
4151
4497
  this.lazyFn = lazyFn;
4152
4498
  return this;
4153
4499
  };
4500
+ this.redirect = (opts) => redirect({ from: this.fullPath, ...opts });
4154
4501
  this.options = options || {};
4155
4502
  this.isRoot = !options?.getParentRoute;
4156
4503
  if (options?.id && options?.path) {
@@ -4175,6 +4522,7 @@ class BaseRouteApi {
4175
4522
  this.notFound = (opts) => {
4176
4523
  return notFound({ routeId: this.id, ...opts });
4177
4524
  };
4525
+ this.redirect = (opts) => redirect({ from: this.id, ...opts });
4178
4526
  this.id = id;
4179
4527
  }
4180
4528
  }
@@ -4197,12 +4545,13 @@ function retainSearchParams(keys) {
4197
4545
  if (keys === true) {
4198
4546
  return { ...search, ...result };
4199
4547
  }
4548
+ const copy = { ...result };
4200
4549
  keys.forEach((key) => {
4201
- if (!(key in result)) {
4202
- result[key] = search[key];
4550
+ if (!(key in copy)) {
4551
+ copy[key] = search[key];
4203
4552
  }
4204
4553
  });
4205
- return result;
4554
+ return copy;
4206
4555
  };
4207
4556
  }
4208
4557
  function stripSearchParams(input) {
@@ -4210,7 +4559,7 @@ function stripSearchParams(input) {
4210
4559
  if (input === true) {
4211
4560
  return {};
4212
4561
  }
4213
- const result = next(search);
4562
+ const result = { ...next(search) };
4214
4563
  if (Array.isArray(input)) {
4215
4564
  input.forEach((key) => {
4216
4565
  delete result[key];
@@ -4228,16 +4577,63 @@ function stripSearchParams(input) {
4228
4577
  };
4229
4578
  }
4230
4579
 
4231
- var K=(s=>(s[s.AggregateError=1]="AggregateError",s[s.ArrowFunction=2]="ArrowFunction",s[s.ErrorPrototypeStack=4]="ErrorPrototypeStack",s[s.ObjectAssign=8]="ObjectAssign",s[s.BigIntTypedArray=16]="BigIntTypedArray",s))(K||{});var B="__SEROVAL_REFS__";var V=new Map;typeof globalThis!="undefined"?Object.defineProperty(globalThis,B,{value:V,configurable:true,writable:false,enumerable:false}):typeof window!="undefined"?Object.defineProperty(window,B,{value:V,configurable:true,writable:false,enumerable:false}):typeof self!="undefined"?Object.defineProperty(self,B,{value:V,configurable:true,writable:false,enumerable:false}):typeof global!="undefined"&&Object.defineProperty(global,B,{value:V,configurable:true,writable:false,enumerable:false});var X=()=>{let e={p:0,s:0,f:0};return e.p=new Promise((r,t)=>{e.s=r,e.f=t;}),e},un=(e,r)=>{e.s(r),e.p.s=1,e.p.v=r;},cn=(e,r)=>{e.f(r),e.p.s=2,e.p.v=r;};X.toString();un.toString();cn.toString();var Rr=(e,r)=>{let t=atob(r),n=new Uint8Array(e);for(let a=0;a<e;a++)n[a]=t.charCodeAt(a);return n.buffer};Rr.toString();var te=(t=>(t[t.Vanilla=1]="Vanilla",t[t.Cross=2]="Cross",t))(te||{});var no=()=>T;no.toString();
4580
+ var L=(i=>(i[i.AggregateError=1]="AggregateError",i[i.ArrowFunction=2]="ArrowFunction",i[i.ErrorPrototypeStack=4]="ErrorPrototypeStack",i[i.ObjectAssign=8]="ObjectAssign",i[i.BigIntTypedArray=16]="BigIntTypedArray",i[i.RegExp=32]="RegExp",i))(L||{});var U="__SEROVAL_REFS__";var j=new Map;typeof globalThis!="undefined"?Object.defineProperty(globalThis,U,{value:j,configurable:true,writable:false,enumerable:false}):typeof window!="undefined"?Object.defineProperty(window,U,{value:j,configurable:true,writable:false,enumerable:false}):typeof self!="undefined"?Object.defineProperty(self,U,{value:j,configurable:true,writable:false,enumerable:false}):typeof global!="undefined"&&Object.defineProperty(global,U,{value:j,configurable:true,writable:false,enumerable:false});var re=()=>{let e={p:0,s:0,f:0};return e.p=new Promise((r,t)=>{e.s=r,e.f=t;}),e},vn=(e,r)=>{e.s(r),e.p.s=1,e.p.v=r;},Cn=(e,r)=>{e.f(r),e.p.s=2,e.p.v=r;};re.toString();vn.toString();Cn.toString();var Or=e=>{let r=atob(e),t=r.length,n=new Uint8Array(t);for(let a=0;a<t;a++)n[a]=r.charCodeAt(a);return n.buffer};Or.toString();var ae=(t=>(t[t.Vanilla=1]="Vanilla",t[t.Cross=2]="Cross",t))(ae||{});var Eo=()=>T;Eo.toString();
4232
4581
 
4233
4582
  function createSerializationAdapter(opts) {
4234
4583
  return opts;
4235
4584
  }
4236
4585
 
4237
4586
  const React$f = await importShared('react');
4238
- function useAwaited({
4239
- promise: _promise
4240
- }) {
4587
+
4588
+ const REACT_USE = "use";
4589
+ const reactUse = React$f[REACT_USE];
4590
+ function useStableCallback(fn) {
4591
+ const fnRef = React$f.useRef(fn);
4592
+ fnRef.current = fn;
4593
+ const ref = React$f.useRef((...args) => fnRef.current(...args));
4594
+ return ref.current;
4595
+ }
4596
+ const useLayoutEffect = typeof window !== "undefined" ? React$f.useLayoutEffect : React$f.useEffect;
4597
+ function usePrevious(value) {
4598
+ const ref = React$f.useRef({
4599
+ value,
4600
+ prev: null
4601
+ });
4602
+ const current = ref.current.value;
4603
+ if (value !== current) {
4604
+ ref.current = {
4605
+ value,
4606
+ prev: current
4607
+ };
4608
+ }
4609
+ return ref.current.prev;
4610
+ }
4611
+ function useIntersectionObserver(ref, callback, intersectionObserverOptions = {}, options = {}) {
4612
+ React$f.useEffect(() => {
4613
+ if (!ref.current || options.disabled || typeof IntersectionObserver !== "function") {
4614
+ return;
4615
+ }
4616
+ const observer = new IntersectionObserver(([entry]) => {
4617
+ callback(entry);
4618
+ }, intersectionObserverOptions);
4619
+ observer.observe(ref.current);
4620
+ return () => {
4621
+ observer.disconnect();
4622
+ };
4623
+ }, [callback, intersectionObserverOptions, options.disabled, ref]);
4624
+ }
4625
+ function useForwardedRef(ref) {
4626
+ const innerRef = React$f.useRef(null);
4627
+ React$f.useImperativeHandle(ref, () => innerRef.current, []);
4628
+ return innerRef;
4629
+ }
4630
+
4631
+ const React$e = await importShared('react');
4632
+ function useAwaited({ promise: _promise }) {
4633
+ if (reactUse) {
4634
+ const data = reactUse(_promise);
4635
+ return data;
4636
+ }
4241
4637
  const promise = defer(_promise);
4242
4638
  if (promise[TSR_DEFERRED_PROMISE].status === "pending") {
4243
4639
  throw promise;
@@ -4245,21 +4641,21 @@ function useAwaited({
4245
4641
  if (promise[TSR_DEFERRED_PROMISE].status === "error") {
4246
4642
  throw promise[TSR_DEFERRED_PROMISE].error;
4247
4643
  }
4248
- return [promise[TSR_DEFERRED_PROMISE].data, promise];
4644
+ return promise[TSR_DEFERRED_PROMISE].data;
4249
4645
  }
4250
4646
  function Await(props) {
4251
4647
  const inner = /* @__PURE__ */ jsxRuntimeExports.jsx(AwaitInner, { ...props });
4252
4648
  if (props.fallback) {
4253
- return /* @__PURE__ */ jsxRuntimeExports.jsx(React$f.Suspense, { fallback: props.fallback, children: inner });
4649
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(React$e.Suspense, { fallback: props.fallback, children: inner });
4254
4650
  }
4255
4651
  return inner;
4256
4652
  }
4257
4653
  function AwaitInner(props) {
4258
- const [data] = useAwaited(props);
4654
+ const data = useAwaited(props);
4259
4655
  return props.children(data);
4260
4656
  }
4261
4657
 
4262
- const React$e = await importShared('react');
4658
+ const React$d = await importShared('react');
4263
4659
 
4264
4660
  function CatchBoundary(props) {
4265
4661
  const errorComponent = props.errorComponent ?? ErrorComponent;
@@ -4270,7 +4666,7 @@ function CatchBoundary(props) {
4270
4666
  onCatch: props.onCatch,
4271
4667
  children: ({ error, reset }) => {
4272
4668
  if (error) {
4273
- return React$e.createElement(errorComponent, {
4669
+ return React$d.createElement(errorComponent, {
4274
4670
  error,
4275
4671
  reset
4276
4672
  });
@@ -4280,7 +4676,7 @@ function CatchBoundary(props) {
4280
4676
  }
4281
4677
  );
4282
4678
  }
4283
- class CatchBoundaryImpl extends React$e.Component {
4679
+ class CatchBoundaryImpl extends React$d.Component {
4284
4680
  constructor() {
4285
4681
  super(...arguments);
4286
4682
  this.state = { error: null };
@@ -4314,7 +4710,7 @@ class CatchBoundaryImpl extends React$e.Component {
4314
4710
  }
4315
4711
  }
4316
4712
  function ErrorComponent({ error }) {
4317
- const [show, setShow] = React$e.useState(false);
4713
+ const [show, setShow] = React$d.useState(false);
4318
4714
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { padding: ".5rem", maxWidth: "100%" }, children: [
4319
4715
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { display: "flex", alignItems: "center", gap: ".5rem" }, children: [
4320
4716
  /* @__PURE__ */ jsxRuntimeExports.jsx("strong", { style: { fontSize: "1rem" }, children: "Something went wrong!" }),
@@ -4534,9 +4930,9 @@ function getOwnKeys(obj) {
4534
4930
  );
4535
4931
  }
4536
4932
 
4537
- const React$d = await importShared('react');
4933
+ const React$c = await importShared('react');
4538
4934
 
4539
- const routerContext = React$d.createContext(null);
4935
+ const routerContext = React$c.createContext(null);
4540
4936
  function getRouterContext() {
4541
4937
  if (typeof document === "undefined") {
4542
4938
  return routerContext;
@@ -4548,9 +4944,9 @@ function getRouterContext() {
4548
4944
  return routerContext;
4549
4945
  }
4550
4946
 
4551
- const React$c = await importShared('react');
4947
+ const React$b = await importShared('react');
4552
4948
  function useRouter(opts) {
4553
- const value = React$c.useContext(getRouterContext());
4949
+ const value = React$b.useContext(getRouterContext());
4554
4950
  warning(
4555
4951
  !((opts?.warn ?? true) && !value));
4556
4952
  return value;
@@ -4562,7 +4958,10 @@ function useRouterState(opts) {
4562
4958
  warn: opts?.router === void 0
4563
4959
  });
4564
4960
  const router = opts?.router || contextRouter;
4565
- const previousResult = useRef(void 0);
4961
+ const previousResult = (
4962
+ // eslint-disable-next-line react-hooks/rules-of-hooks
4963
+ useRef(void 0)
4964
+ );
4566
4965
  return useStore(router.__store, (state) => {
4567
4966
  if (opts?.select) {
4568
4967
  if (opts.structuralSharing ?? router.options.defaultStructuralSharing) {
@@ -4579,16 +4978,16 @@ function useRouterState(opts) {
4579
4978
  });
4580
4979
  }
4581
4980
 
4582
- const React$b = await importShared('react');
4981
+ const React$a = await importShared('react');
4583
4982
 
4584
- const matchContext = React$b.createContext(void 0);
4585
- const dummyMatchContext = React$b.createContext(
4983
+ const matchContext = React$a.createContext(void 0);
4984
+ const dummyMatchContext = React$a.createContext(
4586
4985
  void 0
4587
4986
  );
4588
4987
 
4589
- const React$a = await importShared('react');
4988
+ const React$9 = await importShared('react');
4590
4989
  function useMatch(opts) {
4591
- const nearestMatchId = React$a.useContext(
4990
+ const nearestMatchId = React$9.useContext(
4592
4991
  opts.from ? dummyMatchContext : matchContext
4593
4992
  );
4594
4993
  const matchSelection = useRouterState({
@@ -4656,49 +5055,6 @@ function useSearch(opts) {
4656
5055
  });
4657
5056
  }
4658
5057
 
4659
- const React$9 = await importShared('react');
4660
-
4661
- function useStableCallback(fn) {
4662
- const fnRef = React$9.useRef(fn);
4663
- fnRef.current = fn;
4664
- const ref = React$9.useRef((...args) => fnRef.current(...args));
4665
- return ref.current;
4666
- }
4667
- const useLayoutEffect = typeof window !== "undefined" ? React$9.useLayoutEffect : React$9.useEffect;
4668
- function usePrevious(value) {
4669
- const ref = React$9.useRef({
4670
- value,
4671
- prev: null
4672
- });
4673
- const current = ref.current.value;
4674
- if (value !== current) {
4675
- ref.current = {
4676
- value,
4677
- prev: current
4678
- };
4679
- }
4680
- return ref.current.prev;
4681
- }
4682
- function useIntersectionObserver(ref, callback, intersectionObserverOptions = {}, options = {}) {
4683
- React$9.useEffect(() => {
4684
- if (!ref.current || options.disabled || typeof IntersectionObserver !== "function") {
4685
- return;
4686
- }
4687
- const observer = new IntersectionObserver(([entry]) => {
4688
- callback(entry);
4689
- }, intersectionObserverOptions);
4690
- observer.observe(ref.current);
4691
- return () => {
4692
- observer.disconnect();
4693
- };
4694
- }, [callback, intersectionObserverOptions, options.disabled, ref]);
4695
- }
4696
- function useForwardedRef(ref) {
4697
- const innerRef = React$9.useRef(null);
4698
- React$9.useImperativeHandle(ref, () => innerRef.current, []);
4699
- return innerRef;
4700
- }
4701
-
4702
5058
  const React$8 = await importShared('react');
4703
5059
  function useNavigate(_defaultOpts) {
4704
5060
  const router = useRouter();
@@ -4730,8 +5086,6 @@ const React$7 = await importShared('react');
4730
5086
  const {flushSync} = await importShared('react-dom');
4731
5087
  function useLinkProps(options, forwardedRef) {
4732
5088
  const router = useRouter();
4733
- const [isTransitioning, setIsTransitioning] = React$7.useState(false);
4734
- const hasRenderFetched = React$7.useRef(false);
4735
5089
  const innerRef = useForwardedRef(forwardedRef);
4736
5090
  const {
4737
5091
  // custom props
@@ -4770,6 +5124,7 @@ function useLinkProps(options, forwardedRef) {
4770
5124
  _fromLocation,
4771
5125
  ...propsSafeToSpread
4772
5126
  } = options;
5127
+ const isHydrated = useHydrated();
4773
5128
  const currentSearch = useRouterState({
4774
5129
  select: (s) => s.location.search,
4775
5130
  structuralSharing: true
@@ -4798,34 +5153,38 @@ function useLinkProps(options, forwardedRef) {
4798
5153
  () => router.buildLocation({ ..._options }),
4799
5154
  [router, _options]
4800
5155
  );
4801
- const hrefOption = React$7.useMemo(() => {
4802
- if (disabled) {
4803
- return void 0;
4804
- }
4805
- let href = next.maskedLocation ? next.maskedLocation.url : next.url;
4806
- let external = false;
4807
- if (router.origin) {
4808
- if (href.startsWith(router.origin)) {
4809
- href = router.history.createHref(href.replace(router.origin, "")) || "/";
4810
- } else {
4811
- external = true;
4812
- }
4813
- }
4814
- return { href, external };
4815
- }, [disabled, next.maskedLocation, next.url, router.origin, router.history]);
5156
+ const hrefOptionPublicHref = next.maskedLocation ? next.maskedLocation.publicHref : next.publicHref;
5157
+ const hrefOptionExternal = next.maskedLocation ? next.maskedLocation.external : next.external;
5158
+ const hrefOption = React$7.useMemo(
5159
+ () => getHrefOption(
5160
+ hrefOptionPublicHref,
5161
+ hrefOptionExternal,
5162
+ router.history,
5163
+ disabled
5164
+ ),
5165
+ [disabled, hrefOptionExternal, hrefOptionPublicHref, router.history]
5166
+ );
4816
5167
  const externalLink = React$7.useMemo(() => {
4817
5168
  if (hrefOption?.external) {
5169
+ if (isDangerousProtocol(hrefOption.href)) {
5170
+ return void 0;
5171
+ }
4818
5172
  return hrefOption.href;
4819
5173
  }
5174
+ const safeInternal = isSafeInternal(to);
5175
+ if (safeInternal) return void 0;
5176
+ if (typeof to !== "string" || to.indexOf(":") === -1) return void 0;
4820
5177
  try {
4821
5178
  new URL(to);
5179
+ if (isDangerousProtocol(to)) {
5180
+ if (false) ;
5181
+ return void 0;
5182
+ }
4822
5183
  return to;
4823
5184
  } catch {
4824
5185
  }
4825
5186
  return void 0;
4826
5187
  }, [to, hrefOption]);
4827
- const preload = options.reloadDocument || externalLink ? false : userPreload ?? router.options.defaultPreload;
4828
- const preloadDelay = userPreloadDelay ?? router.options.defaultPreloadDelay ?? 0;
4829
5188
  const isActive = useRouterState({
4830
5189
  select: (s) => {
4831
5190
  if (externalLink) return false;
@@ -4862,11 +5221,27 @@ function useLinkProps(options, forwardedRef) {
4862
5221
  }
4863
5222
  }
4864
5223
  if (activeOptions?.includeHash) {
4865
- return s.location.hash === next.hash;
5224
+ return isHydrated && s.location.hash === next.hash;
4866
5225
  }
4867
5226
  return true;
4868
5227
  }
4869
5228
  });
5229
+ const resolvedActiveProps = isActive ? functionalUpdate(activeProps, {}) ?? STATIC_ACTIVE_OBJECT : STATIC_EMPTY_OBJECT;
5230
+ const resolvedInactiveProps = isActive ? STATIC_EMPTY_OBJECT : functionalUpdate(inactiveProps, {}) ?? STATIC_EMPTY_OBJECT;
5231
+ const resolvedClassName = [
5232
+ className,
5233
+ resolvedActiveProps.className,
5234
+ resolvedInactiveProps.className
5235
+ ].filter(Boolean).join(" ");
5236
+ const resolvedStyle = (style || resolvedActiveProps.style || resolvedInactiveProps.style) && {
5237
+ ...style,
5238
+ ...resolvedActiveProps.style,
5239
+ ...resolvedInactiveProps.style
5240
+ };
5241
+ const [isTransitioning, setIsTransitioning] = React$7.useState(false);
5242
+ const hasRenderFetched = React$7.useRef(false);
5243
+ const preload = options.reloadDocument || externalLink ? false : userPreload ?? router.options.defaultPreload;
5244
+ const preloadDelay = userPreloadDelay ?? router.options.defaultPreloadDelay ?? 0;
4870
5245
  const doPreload = React$7.useCallback(() => {
4871
5246
  router.preloadRoute({ ..._options }).catch((err) => {
4872
5247
  console.warn(err);
@@ -4968,18 +5343,6 @@ function useLinkProps(options, forwardedRef) {
4968
5343
  timeoutMap.delete(eventTarget);
4969
5344
  }
4970
5345
  };
4971
- const resolvedActiveProps = isActive ? functionalUpdate(activeProps, {}) ?? STATIC_ACTIVE_OBJECT : STATIC_EMPTY_OBJECT;
4972
- const resolvedInactiveProps = isActive ? STATIC_EMPTY_OBJECT : functionalUpdate(inactiveProps, {}) ?? STATIC_EMPTY_OBJECT;
4973
- const resolvedClassName = [
4974
- className,
4975
- resolvedActiveProps.className,
4976
- resolvedInactiveProps.className
4977
- ].filter(Boolean).join(" ");
4978
- const resolvedStyle = (style || resolvedActiveProps.style || resolvedInactiveProps.style) && {
4979
- ...style,
4980
- ...resolvedActiveProps.style,
4981
- ...resolvedInactiveProps.style
4982
- };
4983
5346
  return {
4984
5347
  ...propsSafeToSpread,
4985
5348
  ...resolvedActiveProps,
@@ -4997,7 +5360,7 @@ function useLinkProps(options, forwardedRef) {
4997
5360
  ...resolvedClassName && { className: resolvedClassName },
4998
5361
  ...disabled && STATIC_DISABLED_PROPS,
4999
5362
  ...isActive && STATIC_ACTIVE_PROPS,
5000
- ...isTransitioning && STATIC_TRANSITIONING_PROPS
5363
+ ...isHydrated && isTransitioning && STATIC_TRANSITIONING_PROPS
5001
5364
  };
5002
5365
  }
5003
5366
  const STATIC_EMPTY_OBJECT = {};
@@ -5016,6 +5379,22 @@ const composeHandlers = (handlers) => (e) => {
5016
5379
  handler(e);
5017
5380
  }
5018
5381
  };
5382
+ function getHrefOption(publicHref, external, history, disabled) {
5383
+ if (disabled) return void 0;
5384
+ if (external) {
5385
+ return { href: publicHref, external: true };
5386
+ }
5387
+ return {
5388
+ href: history.createHref(publicHref) || "/",
5389
+ external: false
5390
+ };
5391
+ }
5392
+ function isSafeInternal(to) {
5393
+ if (typeof to !== "string") return false;
5394
+ const zero = to.charCodeAt(0);
5395
+ if (zero === 47) return to.charCodeAt(1) !== 47;
5396
+ return zero === 46;
5397
+ }
5019
5398
  function createLink(Comp) {
5020
5399
  return React$7.forwardRef(function CreatedLink(props, ref) {
5021
5400
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { ...props, _asChild: Comp, ref });
@@ -5024,25 +5403,15 @@ function createLink(Comp) {
5024
5403
  const Link = React$7.forwardRef(
5025
5404
  (props, ref) => {
5026
5405
  const { _asChild, ...rest } = props;
5027
- const {
5028
- type: _type,
5029
- ref: innerRef,
5030
- ...linkProps
5031
- } = useLinkProps(rest, ref);
5406
+ const { type: _type, ...linkProps } = useLinkProps(rest, ref);
5032
5407
  const children = typeof rest.children === "function" ? rest.children({
5033
5408
  isActive: linkProps["data-status"] === "active"
5034
5409
  }) : rest.children;
5035
- if (_asChild === void 0) {
5036
- delete linkProps.disabled;
5410
+ if (!_asChild) {
5411
+ const { disabled: _, ...rest2 } = linkProps;
5412
+ return React$7.createElement("a", rest2, children);
5037
5413
  }
5038
- return React$7.createElement(
5039
- _asChild ? _asChild : "a",
5040
- {
5041
- ...linkProps,
5042
- ref: innerRef
5043
- },
5044
- children
5045
- );
5414
+ return React$7.createElement(_asChild, linkProps, children);
5046
5415
  }
5047
5416
  );
5048
5417
  function isCtrlEvent(e) {
@@ -5157,7 +5526,7 @@ class Route extends BaseRoute {
5157
5526
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { ref, from: this.fullPath, ...props });
5158
5527
  }
5159
5528
  );
5160
- this.$$typeof = Symbol.for("react.memo");
5529
+ this.$$typeof = /* @__PURE__ */ Symbol.for("react.memo");
5161
5530
  }
5162
5531
  }
5163
5532
  function createRoute(options) {
@@ -5220,7 +5589,7 @@ class RootRoute extends BaseRootRoute {
5220
5589
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { ref, from: this.fullPath, ...props });
5221
5590
  }
5222
5591
  );
5223
- this.$$typeof = Symbol.for("react.memo");
5592
+ this.$$typeof = /* @__PURE__ */ Symbol.for("react.memo");
5224
5593
  }
5225
5594
  }
5226
5595
  function createRootRoute(options) {
@@ -5304,7 +5673,7 @@ class LazyRoute {
5304
5673
  return useNavigate({ from: router.routesById[this.options.id].fullPath });
5305
5674
  };
5306
5675
  this.options = opts;
5307
- this.$$typeof = Symbol.for("react.memo");
5676
+ this.$$typeof = /* @__PURE__ */ Symbol.for("react.memo");
5308
5677
  }
5309
5678
  }
5310
5679
  function createLazyRoute(id) {
@@ -5358,7 +5727,11 @@ function lazyRouteComponent(importer, exportName) {
5358
5727
  throw error;
5359
5728
  }
5360
5729
  if (!comp) {
5361
- throw load();
5730
+ if (reactUse) {
5731
+ reactUse(load());
5732
+ } else {
5733
+ throw load();
5734
+ }
5362
5735
  }
5363
5736
  return React$6.createElement(comp, props);
5364
5737
  };
@@ -5400,7 +5773,7 @@ function Transitioner() {
5400
5773
  state: true,
5401
5774
  _includeValidateSearch: true
5402
5775
  });
5403
- if (trimPathRight(router.latestLocation.href) !== trimPathRight(nextLocation.href)) {
5776
+ if (trimPathRight(router.latestLocation.publicHref) !== trimPathRight(nextLocation.publicHref)) {
5404
5777
  router.commitLocation({ ...nextLocation, replace: true });
5405
5778
  }
5406
5779
  return () => {
@@ -5506,51 +5879,17 @@ function renderRouteNotFound(router, route, data) {
5506
5879
  }
5507
5880
 
5508
5881
  function ScriptOnce({ children }) {
5509
- const router = useRouter();
5510
- if (!router.isServer) {
5882
+ useRouter();
5883
+ {
5511
5884
  return null;
5512
5885
  }
5513
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
5514
- "script",
5515
- {
5516
- nonce: router.options.ssr?.nonce,
5517
- className: "$tsr",
5518
- dangerouslySetInnerHTML: {
5519
- __html: children + ';typeof $_TSR !== "undefined" && $_TSR.c()'
5520
- }
5521
- }
5522
- );
5523
5886
  }
5524
5887
 
5525
5888
  function ScrollRestoration$1() {
5526
5889
  const router = useRouter();
5527
- if (!router.isScrollRestoring || !router.isServer) {
5890
+ if (!router.isScrollRestoring || true) {
5528
5891
  return null;
5529
5892
  }
5530
- if (typeof router.options.scrollRestoration === "function") {
5531
- const shouldRestore = router.options.scrollRestoration({
5532
- location: router.latestLocation
5533
- });
5534
- if (!shouldRestore) {
5535
- return null;
5536
- }
5537
- }
5538
- const getKey = router.options.getScrollRestorationKey || defaultGetScrollRestorationKey;
5539
- const userKey = getKey(router.latestLocation);
5540
- const resolvedKey = userKey !== defaultGetScrollRestorationKey(router.latestLocation) ? userKey : void 0;
5541
- const restoreScrollOptions = {
5542
- storageKey,
5543
- shouldScrollRestoration: true
5544
- };
5545
- if (resolvedKey) {
5546
- restoreScrollOptions.key = resolvedKey;
5547
- }
5548
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
5549
- ScriptOnce,
5550
- {
5551
- children: `(${restoreScroll.toString()})(${JSON.stringify(restoreScrollOptions)})`
5552
- }
5553
- );
5554
5893
  }
5555
5894
 
5556
5895
  const React$4 = await importShared('react');
@@ -5560,13 +5899,16 @@ const Match = React$4.memo(function MatchImpl({
5560
5899
  const router = useRouter();
5561
5900
  const matchState = useRouterState({
5562
5901
  select: (s) => {
5563
- const match = s.matches.find((d) => d.id === matchId);
5902
+ const matchIndex = s.matches.findIndex((d) => d.id === matchId);
5903
+ const match = s.matches[matchIndex];
5564
5904
  invariant(
5565
5905
  match);
5566
5906
  return {
5567
5907
  routeId: match.routeId,
5568
5908
  ssr: match.ssr,
5569
- _displayPending: match._displayPending
5909
+ _displayPending: match._displayPending,
5910
+ resetKey: s.loadedAt,
5911
+ parentRouteId: s.matches[matchIndex - 1]?.routeId
5570
5912
  };
5571
5913
  },
5572
5914
  structuralSharing: true
@@ -5587,21 +5929,12 @@ const Match = React$4.memo(function MatchImpl({
5587
5929
  );
5588
5930
  const ResolvedCatchBoundary = routeErrorComponent ? CatchBoundary : SafeFragment;
5589
5931
  const ResolvedNotFoundBoundary = routeNotFoundComponent ? CatchNotFound : SafeFragment;
5590
- const resetKey = useRouterState({
5591
- select: (s) => s.loadedAt
5592
- });
5593
- const parentRouteId = useRouterState({
5594
- select: (s) => {
5595
- const index = s.matches.findIndex((d) => d.id === matchId);
5596
- return s.matches[index - 1]?.routeId;
5597
- }
5598
- });
5599
5932
  const ShellComponent = route.isRoot ? route.options.shellComponent ?? SafeFragment : SafeFragment;
5600
5933
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(ShellComponent, { children: [
5601
5934
  /* @__PURE__ */ jsxRuntimeExports.jsx(matchContext.Provider, { value: matchId, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ResolvedSuspenseBoundary, { fallback: pendingElement, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
5602
5935
  ResolvedCatchBoundary,
5603
5936
  {
5604
- getResetKey: () => resetKey,
5937
+ getResetKey: () => matchState.resetKey,
5605
5938
  errorComponent: routeErrorComponent || ErrorComponent,
5606
5939
  onCatch: (error, errorInfo) => {
5607
5940
  if (isNotFound(error)) throw error;
@@ -5620,7 +5953,7 @@ const Match = React$4.memo(function MatchImpl({
5620
5953
  )
5621
5954
  }
5622
5955
  ) }) }),
5623
- parentRouteId === rootRouteId && router.options.scrollRestoration ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
5956
+ matchState.parentRouteId === rootRouteId && router.options.scrollRestoration ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
5624
5957
  /* @__PURE__ */ jsxRuntimeExports.jsx(OnRendered, {}),
5625
5958
  /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollRestoration$1, {})
5626
5959
  ] }) : null
@@ -5671,6 +6004,7 @@ const MatchInner = React$4.memo(function MatchInnerImpl({
5671
6004
  id: match2.id,
5672
6005
  status: match2.status,
5673
6006
  error: match2.error,
6007
+ invalid: match2.invalid,
5674
6008
  _forcePending: match2._forcePending,
5675
6009
  _displayPending: match2._displayPending
5676
6010
  }
@@ -5697,7 +6031,7 @@ const MatchInner = React$4.memo(function MatchInnerImpl({
5697
6031
  if (pendingMinMs) {
5698
6032
  const routerMatch = router.getMatch(match.id);
5699
6033
  if (routerMatch && !routerMatch._nonReactive.minPendingPromise) {
5700
- if (!router.isServer) {
6034
+ {
5701
6035
  const minPendingPromise = createControlledPromise();
5702
6036
  routerMatch._nonReactive.minPendingPromise = minPendingPromise;
5703
6037
  setTimeout(() => {
@@ -5718,19 +6052,6 @@ const MatchInner = React$4.memo(function MatchInnerImpl({
5718
6052
  throw router.getMatch(match.id)?._nonReactive.loadPromise;
5719
6053
  }
5720
6054
  if (match.status === "error") {
5721
- if (router.isServer) {
5722
- const RouteErrorComponent = (route.options.errorComponent ?? router.options.defaultErrorComponent) || ErrorComponent;
5723
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
5724
- RouteErrorComponent,
5725
- {
5726
- error: match.error,
5727
- reset: void 0,
5728
- info: {
5729
- componentStack: ""
5730
- }
5731
- }
5732
- );
5733
- }
5734
6055
  throw match.error;
5735
6056
  }
5736
6057
  return out;
@@ -5778,9 +6099,9 @@ function Matches() {
5778
6099
  const rootRoute = router.routesById[rootRouteId];
5779
6100
  const PendingComponent = rootRoute.options.pendingComponent ?? router.options.defaultPendingComponent;
5780
6101
  const pendingElement = PendingComponent ? /* @__PURE__ */ jsxRuntimeExports.jsx(PendingComponent, {}) : null;
5781
- const ResolvedSuspense = router.isServer || typeof document !== "undefined" && router.ssr ? SafeFragment : React$3.Suspense;
6102
+ const ResolvedSuspense = typeof document !== "undefined" && router.ssr ? SafeFragment : React$3.Suspense;
5782
6103
  const inner = /* @__PURE__ */ jsxRuntimeExports.jsxs(ResolvedSuspense, { fallback: pendingElement, children: [
5783
- !router.isServer && /* @__PURE__ */ jsxRuntimeExports.jsx(Transitioner, {}),
6104
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Transitioner, {}),
5784
6105
  /* @__PURE__ */ jsxRuntimeExports.jsx(MatchesInner, {})
5785
6106
  ] });
5786
6107
  return router.options.InnerWrap ? /* @__PURE__ */ jsxRuntimeExports.jsx(router.options.InnerWrap, { children: inner }) : inner;
@@ -6138,7 +6459,7 @@ function Script({
6138
6459
  attrs,
6139
6460
  children
6140
6461
  }) {
6141
- const router = useRouter();
6462
+ useRouter();
6142
6463
  React$1.useEffect(() => {
6143
6464
  if (attrs?.src) {
6144
6465
  const normSrc = (() => {
@@ -6206,34 +6527,20 @@ function Script({
6206
6527
  }
6207
6528
  return void 0;
6208
6529
  }, [attrs, children]);
6209
- if (!router.isServer) {
6530
+ {
6531
+ const { src, ...rest } = attrs || {};
6210
6532
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
6211
6533
  "script",
6212
6534
  {
6213
6535
  suppressHydrationWarning: true,
6214
- dangerouslySetInnerHTML: { __html: "" }
6215
- }
6216
- );
6217
- }
6218
- if (attrs?.src && typeof attrs.src === "string") {
6219
- return /* @__PURE__ */ jsxRuntimeExports.jsx("script", { ...attrs, suppressHydrationWarning: true });
6220
- }
6221
- if (typeof children === "string") {
6222
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
6223
- "script",
6224
- {
6225
- ...attrs,
6226
- dangerouslySetInnerHTML: { __html: children },
6227
- suppressHydrationWarning: true
6536
+ dangerouslySetInnerHTML: { __html: "" },
6537
+ ...rest
6228
6538
  }
6229
6539
  );
6230
6540
  }
6231
- return null;
6232
6541
  }
6233
6542
 
6234
6543
  const React = await importShared('react');
6235
-
6236
- const {createElement: createElement$1} = await importShared('react');
6237
6544
  const useTags = () => {
6238
6545
  const router = useRouter();
6239
6546
  const nonce = router.options.ssr?.nonce;
@@ -6258,6 +6565,18 @@ const useTags = () => {
6258
6565
  children: m.title
6259
6566
  };
6260
6567
  }
6568
+ } else if ("script:ld+json" in m) {
6569
+ try {
6570
+ const json = JSON.stringify(m["script:ld+json"]);
6571
+ resultMeta.push({
6572
+ tag: "script",
6573
+ attrs: {
6574
+ type: "application/ld+json"
6575
+ },
6576
+ children: escapeHtml(json)
6577
+ });
6578
+ } catch {
6579
+ }
6261
6580
  } else {
6262
6581
  const attribute = m.name ?? m.property;
6263
6582
  if (attribute) {
@@ -6338,9 +6657,11 @@ const useTags = () => {
6338
6657
  const styles = useRouterState({
6339
6658
  select: (state) => state.matches.map((match) => match.styles).flat(1).filter(Boolean).map(({ children, ...attrs }) => ({
6340
6659
  tag: "style",
6341
- attrs,
6342
- children,
6343
- nonce
6660
+ attrs: {
6661
+ ...attrs,
6662
+ nonce
6663
+ },
6664
+ children
6344
6665
  })),
6345
6666
  structuralSharing: true
6346
6667
  });
@@ -6368,12 +6689,6 @@ const useTags = () => {
6368
6689
  }
6369
6690
  );
6370
6691
  };
6371
- function HeadContent() {
6372
- const tags = useTags();
6373
- const router = useRouter();
6374
- const nonce = router.options.ssr?.nonce;
6375
- return tags.map((tag) => /* @__PURE__ */ createElement$1(Asset, { ...tag, key: `tsr-meta-${JSON.stringify(tag)}`, nonce }));
6376
- }
6377
6692
  function uniqBy(arr, fn) {
6378
6693
  const seen = /* @__PURE__ */ new Set();
6379
6694
  return arr.filter((item) => {
@@ -6386,6 +6701,14 @@ function uniqBy(arr, fn) {
6386
6701
  });
6387
6702
  }
6388
6703
 
6704
+ const {createElement: createElement$1} = await importShared('react');
6705
+ function HeadContent() {
6706
+ const tags = useTags();
6707
+ const router = useRouter();
6708
+ const nonce = router.options.ssr?.nonce;
6709
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: tags.map((tag) => /* @__PURE__ */ createElement$1(Asset, { ...tag, key: `tsr-meta-${JSON.stringify(tag)}`, nonce })) });
6710
+ }
6711
+
6389
6712
  const {createElement} = await importShared('react');
6390
6713
  const Scripts = () => {
6391
6714
  const router = useRouter();
@@ -6435,5 +6758,5 @@ const Scripts = () => {
6435
6758
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: allScripts.map((asset, i) => /* @__PURE__ */ createElement(Asset, { ...asset, key: `tsr-scripts-${asset.tag}-${i}` })) });
6436
6759
  };
6437
6760
 
6438
- export { Asset, Await, Block, CatchBoundary, CatchNotFound, ClientOnly, DefaultGlobalNotFound, ErrorComponent, FileRoute, FileRouteLoader, HeadContent, LazyRoute, Link, Match, MatchRoute, Matches, Navigate, NotFoundRoute, Outlet, PathParamError, RootRoute, Route, RouteApi, Router, RouterContextProvider, RouterProvider, ScriptOnce, Scripts, ScrollRestoration, SearchParamError, TSR_DEFERRED_PROMISE, cleanPath, componentTypes, composeRewrites, createBrowserHistory, createControlledPromise, createFileRoute, createHashHistory, createHistory, createLazyFileRoute, createLazyRoute, createLink, createMemoryHistory, createRootRoute, createRootRouteWithContext, createRoute, createRouteMask, createRouter, createRouterConfig, createSerializationAdapter, deepEqual, defaultParseSearch, defaultSerializeError, defaultStringifySearch, defer, functionalUpdate, getInitialRouterState, getRouteApi, getRouterContext, interpolatePath, isMatch, isNotFound, isPlainArray, isPlainObject, isRedirect, joinPaths, lazyFn, lazyRouteComponent, linkOptions, matchContext, notFound, parseSearchWith, redirect, replaceEqualDeep, resolvePath, retainSearchParams, rootRouteId, rootRouteWithContext, stringifySearchWith, stripSearchParams, trimPath, trimPathLeft, trimPathRight, useAwaited, useBlocker, useCanGoBack, useChildMatches, useElementScrollRestoration, useHydrated, useLayoutEffect, useLinkProps, useLoaderData, useLoaderDeps, useLocation, useMatch, useMatchRoute, useMatches, useNavigate, useParams, useParentMatches, useRouteContext, useRouter, useRouterState, useSearch, useStableCallback };
6439
- //# sourceMappingURL=react-router-DooFj-IS.js.map
6761
+ export { Asset, Await, Block, CatchBoundary, CatchNotFound, ClientOnly, DefaultGlobalNotFound, ErrorComponent, FileRoute, FileRouteLoader, HeadContent, LazyRoute, Link, Match, MatchRoute, Matches, Navigate, NotFoundRoute, Outlet, PathParamError, RootRoute, Route, RouteApi, Router, RouterContextProvider, RouterProvider, ScriptOnce, Scripts, ScrollRestoration, SearchParamError, TSR_DEFERRED_PROMISE, cleanPath, componentTypes, composeRewrites, createBrowserHistory, createControlledPromise, createFileRoute, createHashHistory, createHistory, createLazyFileRoute, createLazyRoute, createLink, createMemoryHistory, createRootRoute, createRootRouteWithContext, createRoute, createRouteMask, createRouter, createRouterConfig, createSerializationAdapter, deepEqual, defaultParseSearch, defaultSerializeError, defaultStringifySearch, defer, functionalUpdate, getInitialRouterState, getRouteApi, getRouterContext, interpolatePath, isMatch, isNotFound, isPlainArray, isPlainObject, isRedirect, joinPaths, lazyFn, lazyRouteComponent, linkOptions, matchContext, notFound, parseSearchWith, redirect, replaceEqualDeep, resolvePath, retainSearchParams, rootRouteId, rootRouteWithContext, stringifySearchWith, stripSearchParams, trimPath, trimPathLeft, trimPathRight, useAwaited, useBlocker, useCanGoBack, useChildMatches, useElementScrollRestoration, useHydrated, useLayoutEffect, useLinkProps, useLoaderData, useLoaderDeps, useLocation, useMatch, useMatchRoute, useMatches, useNavigate, useParams, useParentMatches, useRouteContext, useRouter, useRouterState, useSearch, useStableCallback, useTags };
6762
+ //# sourceMappingURL=react-router-BPEAtEJI.js.map