@farm.js/core 0.1.34 → 0.1.35

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 (261) hide show
  1. package/dist/agent-runtime.cjs +3 -3
  2. package/dist/agent-runtime.d.mts +4 -5
  3. package/dist/agent-runtime.d.ts +4 -5
  4. package/dist/agent-runtime.mjs +2 -2
  5. package/dist/api/route-manager.cjs +5 -5
  6. package/dist/api/route-manager.d.mts +6 -7
  7. package/dist/api/route-manager.d.ts +6 -7
  8. package/dist/api/route-manager.mjs +4 -4
  9. package/dist/api/runtime.cjs +6 -4
  10. package/dist/api/runtime.d.mts +4 -5
  11. package/dist/api/runtime.d.ts +4 -5
  12. package/dist/api/runtime.mjs +6 -4
  13. package/dist/api.cjs +6 -6
  14. package/dist/api.d.mts +7 -8
  15. package/dist/api.d.ts +7 -8
  16. package/dist/api.mjs +5 -5
  17. package/dist/{app-DgotYGbq.d.ts → app-BXB3JZYc.d.ts} +38 -12
  18. package/dist/{app-q4rmZlXK.d.mts → app-D_j9AAVL.d.mts} +38 -12
  19. package/dist/app-markdown.cjs +5 -5
  20. package/dist/app-markdown.d.mts +5 -6
  21. package/dist/app-markdown.d.ts +5 -6
  22. package/dist/app-markdown.mjs +4 -4
  23. package/dist/{chunk-LMJ7VRHZ.mjs → chunk-22LTEMGQ.mjs} +1 -1
  24. package/dist/{chunk-AQZFOP7S.mjs → chunk-2G2NNLE2.mjs} +1 -1
  25. package/dist/{chunk-QJ3J6MZT.cjs → chunk-3BHT4WMP.cjs} +2 -2
  26. package/dist/{chunk-X242HVD5.mjs → chunk-3PXS2MHU.mjs} +1 -1
  27. package/dist/{chunk-A5FGU2WU.cjs → chunk-3UH7MRCP.cjs} +19 -23
  28. package/dist/{chunk-AGC75XAE.mjs → chunk-4JHOT46A.mjs} +1 -1
  29. package/dist/{chunk-XV5DJTBX.mjs → chunk-4KU5Q7C2.mjs} +424 -230
  30. package/dist/{chunk-TA5G2HWD.cjs → chunk-4MMGO7YW.cjs} +21 -21
  31. package/dist/{chunk-7BT4H4P7.cjs → chunk-62XKI4Z3.cjs} +2 -2
  32. package/dist/{chunk-ZKP7C2B6.mjs → chunk-6DU6UFUE.mjs} +12 -11
  33. package/dist/{chunk-GOABMOX3.mjs → chunk-6ETPZTJI.mjs} +366 -4
  34. package/dist/{chunk-7Y6ZNFPX.mjs → chunk-6TJOML4E.mjs} +13 -3
  35. package/dist/{chunk-3ATMYLLJ.mjs → chunk-6WCPV6G2.mjs} +1 -1
  36. package/dist/{chunk-BTAG7LI7.cjs → chunk-73MC7ZL6.cjs} +2 -2
  37. package/dist/chunk-75RZHGLS.cjs +135 -0
  38. package/dist/{chunk-VKNHTSAP.cjs → chunk-7GLPRTTF.cjs} +2 -2
  39. package/dist/{chunk-7M52YUMY.cjs → chunk-7L5V3KQO.cjs} +2 -2
  40. package/dist/{chunk-LI2LMOLR.mjs → chunk-C35ZBVRD.mjs} +12 -3
  41. package/dist/{chunk-YQVSHTMR.mjs → chunk-CP6X4AEU.mjs} +1 -1
  42. package/dist/{chunk-QZCT2CQ4.mjs → chunk-CXEN47J3.mjs} +64 -2
  43. package/dist/{chunk-ATK2R4CH.cjs → chunk-D227TIEN.cjs} +14 -4
  44. package/dist/{chunk-ROUTX2E5.cjs → chunk-DBNKI4NF.cjs} +12 -3
  45. package/dist/{chunk-UX5S4JEO.cjs → chunk-EFCQPQMG.cjs} +3 -3
  46. package/dist/{chunk-K3F2E6GS.cjs → chunk-EJQT6KZN.cjs} +2 -2
  47. package/dist/{chunk-3LUF2PE2.cjs → chunk-EK4QAEFZ.cjs} +67 -5
  48. package/dist/{chunk-VVBO3QH7.mjs → chunk-ENLZ4R3Y.mjs} +10 -1
  49. package/dist/{chunk-XXJU7FCC.cjs → chunk-EUV4YR3V.cjs} +2 -2
  50. package/dist/{chunk-WNNYOOIB.mjs → chunk-F6Z3Y5KL.mjs} +1 -1
  51. package/dist/{chunk-PQDFUSXD.cjs → chunk-F7JZENPF.cjs} +33 -32
  52. package/dist/{chunk-TDFPACVX.cjs → chunk-FTFYRMQQ.cjs} +18 -18
  53. package/dist/{chunk-657WJNRY.mjs → chunk-G5RT7EXW.mjs} +1 -1
  54. package/dist/{chunk-MOKLYNHV.cjs → chunk-GFHLGIYC.cjs} +6 -6
  55. package/dist/{chunk-AWC4VUZL.cjs → chunk-GQ3Z3IZI.cjs} +14 -14
  56. package/dist/{chunk-75WGQVQA.cjs → chunk-HITLGIAO.cjs} +10 -1
  57. package/dist/{chunk-GNSDTTWZ.mjs → chunk-HMIJDL7S.mjs} +1 -1
  58. package/dist/{chunk-PXKIEXZD.mjs → chunk-HUMR6LSU.mjs} +1 -1
  59. package/dist/{chunk-SJVKK4JE.cjs → chunk-ICUQICNC.cjs} +912 -718
  60. package/dist/{chunk-P64MIF5B.cjs → chunk-IPXLADVO.cjs} +387 -25
  61. package/dist/{chunk-KROWKCUH.cjs → chunk-JGLC4TO3.cjs} +8 -1
  62. package/dist/{chunk-2NQQ5H5G.cjs → chunk-M7MKQXAF.cjs} +2 -1
  63. package/dist/chunk-NRDBW4MP.mjs +45 -0
  64. package/dist/chunk-OFZUJMCU.mjs +601 -0
  65. package/dist/{chunk-VCCUOMQN.mjs → chunk-OKZUAXHF.mjs} +1 -1
  66. package/dist/{chunk-EM6SBQKM.cjs → chunk-OMVAU7NT.cjs} +27 -2
  67. package/dist/{chunk-O27L4YAA.mjs → chunk-PDOCJ6RY.mjs} +2 -2
  68. package/dist/{chunk-36MK5YCW.cjs → chunk-PFQKNERH.cjs} +346 -206
  69. package/dist/{chunk-HR5KPHC2.mjs → chunk-Q3VLETLE.mjs} +1 -1
  70. package/dist/{chunk-LR5QSC2P.mjs → chunk-QAU5JD57.mjs} +211 -71
  71. package/dist/{chunk-LHODW25H.mjs → chunk-QORUJDIV.mjs} +2 -2
  72. package/dist/{chunk-UBO4SGH4.mjs → chunk-RHAZ22ZN.mjs} +2 -1
  73. package/dist/{chunk-ZHPHJPQP.cjs → chunk-RU3M2FIK.cjs} +18 -14
  74. package/dist/{chunk-JDPAKVS4.mjs → chunk-SAZVVAJH.mjs} +3 -3
  75. package/dist/{chunk-6VVL3MHY.mjs → chunk-SC2WYWPF.mjs} +1 -1
  76. package/dist/{chunk-QCFFHV5H.mjs → chunk-SMHH4VDG.mjs} +1 -1
  77. package/dist/{chunk-U4PTAHW3.mjs → chunk-SOMHP6GF.mjs} +7 -11
  78. package/dist/{chunk-VHANUNEG.mjs → chunk-UAORZ7QA.mjs} +2 -2
  79. package/dist/{chunk-NGVORZVZ.mjs → chunk-UJD4PHYB.mjs} +15 -11
  80. package/dist/{chunk-U74I55WB.cjs → chunk-ULAWS2PA.cjs} +13 -3
  81. package/dist/{chunk-MPEYMSCF.cjs → chunk-VFQT3LAO.cjs} +5 -5
  82. package/dist/{chunk-Z2YLTERK.cjs → chunk-VZJR7UTG.cjs} +6 -6
  83. package/dist/chunk-WWFTAUFG.cjs +45 -0
  84. package/dist/{chunk-ZUSJDQ2Q.mjs → chunk-WWIKMBRN.mjs} +1 -1
  85. package/dist/{chunk-QGYRXFU2.cjs → chunk-X6W5FFH6.cjs} +8 -8
  86. package/dist/{chunk-MIDIZJZC.cjs → chunk-XBML5KMG.cjs} +8 -8
  87. package/dist/{chunk-G26MUMKL.cjs → chunk-XCACDAZZ.cjs} +4 -4
  88. package/dist/{chunk-CLJYVZAD.mjs → chunk-XCMCS4DA.mjs} +11 -1
  89. package/dist/{chunk-XF7Q24PF.mjs → chunk-Y7RKTKYI.mjs} +25 -0
  90. package/dist/{chunk-ODBZYBAB.cjs → chunk-YC6V7PWE.cjs} +1 -1
  91. package/dist/{chunk-F6OHXPWR.mjs → chunk-YFILVET3.mjs} +8 -1
  92. package/dist/{chunk-DZ4DTRJ5.cjs → chunk-YKX5BK66.cjs} +7 -7
  93. package/dist/chunk-YSLWRWWP.cjs +601 -0
  94. package/dist/{chunk-3VSKDFAT.mjs → chunk-YULD7ICZ.mjs} +1 -1
  95. package/dist/chunk-ZLAT2CWY.mjs +135 -0
  96. package/dist/{chunk-T5CERMEH.cjs → chunk-ZXGAFZDO.cjs} +2 -2
  97. package/dist/{client-plugins-CLObcuCq.d.mts → client-plugins-CvIslxWi.d.mts} +207 -7
  98. package/dist/{client-plugins-DZjHC4Mi.d.ts → client-plugins-HIyulDym.d.ts} +207 -7
  99. package/dist/client-plugins.d.mts +4 -5
  100. package/dist/client-plugins.d.ts +4 -5
  101. package/dist/client.cjs +5 -5
  102. package/dist/client.d.mts +8 -9
  103. package/dist/client.d.ts +8 -9
  104. package/dist/client.mjs +4 -4
  105. package/dist/config.d.mts +4 -5
  106. package/dist/config.d.ts +4 -5
  107. package/dist/{devtools-HU6Y2MNV.cjs → devtools-EAUY43BS.cjs} +9 -9
  108. package/dist/{devtools-RNXCTS4R.mjs → devtools-EE5RIBTH.mjs} +8 -8
  109. package/dist/docs.cjs +12 -12
  110. package/dist/docs.d.mts +41 -4
  111. package/dist/docs.d.ts +41 -4
  112. package/dist/docs.mjs +11 -11
  113. package/dist/i18n/client.d.mts +2 -2
  114. package/dist/i18n/client.d.ts +2 -2
  115. package/dist/i18n/index.d.mts +3 -3
  116. package/dist/i18n/index.d.ts +3 -3
  117. package/dist/i18n/server.d.mts +5 -5
  118. package/dist/i18n/server.d.ts +5 -5
  119. package/dist/image/server.cjs +3 -3
  120. package/dist/image/server.mjs +2 -2
  121. package/dist/image/sharp.cjs +10 -10
  122. package/dist/image/sharp.mjs +2 -2
  123. package/dist/{index-a-8Z5kZU.d.mts → index-BJJfLxJo.d.mts} +2 -2
  124. package/dist/{index-BWVfxIsO.d.ts → index-CwoOP-MW.d.ts} +2 -2
  125. package/dist/index.cjs +38 -35
  126. package/dist/index.d.mts +19 -20
  127. package/dist/index.d.ts +19 -20
  128. package/dist/index.mjs +37 -34
  129. package/dist/integrations.cjs +3 -3
  130. package/dist/integrations.d.mts +4 -5
  131. package/dist/integrations.d.ts +4 -5
  132. package/dist/integrations.mjs +2 -2
  133. package/dist/internal/app-markdown-runtime.cjs +4 -4
  134. package/dist/internal/app-markdown-runtime.d.mts +5 -6
  135. package/dist/internal/app-markdown-runtime.d.ts +5 -6
  136. package/dist/internal/app-markdown-runtime.mjs +3 -3
  137. package/dist/internal/build-runtime.cjs +26 -26
  138. package/dist/internal/build-runtime.d.mts +6 -7
  139. package/dist/internal/build-runtime.d.ts +6 -7
  140. package/dist/internal/build-runtime.mjs +25 -25
  141. package/dist/internal/cli-runtime.cjs +13 -13
  142. package/dist/internal/cli-runtime.mjs +12 -12
  143. package/dist/internal/client-error-overlay.cjs +6 -6
  144. package/dist/internal/client-error-overlay.mjs +2 -2
  145. package/dist/internal/client-runtime.cjs +2 -2
  146. package/dist/internal/client-runtime.mjs +1 -1
  147. package/dist/internal/compression-runtime.d.mts +4 -5
  148. package/dist/internal/compression-runtime.d.ts +4 -5
  149. package/dist/internal/config-runtime.cjs +9 -9
  150. package/dist/internal/config-runtime.d.mts +5 -6
  151. package/dist/internal/config-runtime.d.ts +5 -6
  152. package/dist/internal/config-runtime.mjs +8 -8
  153. package/dist/internal/isolated-boundary.cjs +3 -2
  154. package/dist/internal/isolated-boundary.d.mts +1 -0
  155. package/dist/internal/isolated-boundary.d.ts +1 -0
  156. package/dist/internal/isolated-boundary.mjs +2 -1
  157. package/dist/internal/metadata-image-runtime.cjs +3 -3
  158. package/dist/internal/metadata-image-runtime.mjs +2 -2
  159. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  160. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  161. package/dist/internal/production-runtime.cjs +47 -23
  162. package/dist/internal/production-runtime.d.mts +58 -18
  163. package/dist/internal/production-runtime.d.ts +58 -18
  164. package/dist/internal/production-runtime.mjs +43 -19
  165. package/dist/internal/server-tree.cjs +12 -0
  166. package/dist/internal/server-tree.d.mts +27 -0
  167. package/dist/internal/server-tree.d.ts +27 -0
  168. package/dist/internal/server-tree.mjs +12 -0
  169. package/dist/markdown.cjs +3 -3
  170. package/dist/markdown.d.mts +4 -5
  171. package/dist/markdown.d.ts +4 -5
  172. package/dist/markdown.mjs +2 -2
  173. package/dist/{metadata-Cjs8JMRM.d.ts → metadata-BnLDsUOS.d.ts} +16 -2
  174. package/dist/{metadata-2HSU2i_w.d.mts → metadata-WGpBYcGn.d.mts} +16 -2
  175. package/dist/middleware.cjs +4 -4
  176. package/dist/middleware.d.mts +6 -7
  177. package/dist/middleware.d.ts +6 -7
  178. package/dist/middleware.mjs +3 -3
  179. package/dist/navigation.cjs +5 -5
  180. package/dist/navigation.d.mts +7 -8
  181. package/dist/navigation.d.ts +7 -8
  182. package/dist/navigation.mjs +4 -4
  183. package/dist/{nitro-4XGPNIK4.mjs → nitro-MXRDCXWZ.mjs} +2 -2
  184. package/dist/{nitro-HSAQFXSS.cjs → nitro-OVPLKPE2.cjs} +3 -3
  185. package/dist/{observability-BupkiN0m.d.mts → observability-CoXunYhS.d.mts} +4 -3
  186. package/dist/{observability-BupkiN0m.d.ts → observability-CoXunYhS.d.ts} +4 -3
  187. package/dist/observability.d.mts +1 -1
  188. package/dist/observability.d.ts +1 -1
  189. package/dist/plugin.cjs +22 -22
  190. package/dist/plugin.d.mts +4 -5
  191. package/dist/plugin.d.ts +4 -5
  192. package/dist/plugin.mjs +21 -21
  193. package/dist/{production-runtime-CysZl3EV.d.mts → production-runtime-0sRnuYc-.d.mts} +4 -4
  194. package/dist/{production-runtime-BU5ETAK9.d.ts → production-runtime-Crq6CJ-2.d.ts} +4 -4
  195. package/dist/query/client.cjs +6 -6
  196. package/dist/query/client.mjs +2 -2
  197. package/dist/{render-plan-D72O1qm4.d.ts → render-plan-8ozZh2Qv.d.ts} +1 -1
  198. package/dist/{render-plan-CKr4ltOd.d.mts → render-plan-gs9GGPzw.d.mts} +1 -1
  199. package/dist/renderer/react/server.cjs +10 -4
  200. package/dist/renderer/react/server.d.mts +2 -1
  201. package/dist/renderer/react/server.d.ts +2 -1
  202. package/dist/renderer/react/server.mjs +7 -1
  203. package/dist/renderer-client.cjs +5 -5
  204. package/dist/renderer-client.d.mts +6 -7
  205. package/dist/renderer-client.d.ts +6 -7
  206. package/dist/renderer-client.mjs +2 -2
  207. package/dist/renderer.d.mts +2 -0
  208. package/dist/renderer.d.ts +2 -0
  209. package/dist/{request-DbyOYI2j.d.ts → request-B5G8rLBH.d.ts} +1 -1
  210. package/dist/{request-Be83WafN.d.mts → request-fkhiynXe.d.mts} +1 -1
  211. package/dist/request.d.mts +5 -6
  212. package/dist/request.d.ts +5 -6
  213. package/dist/{resolver-PPEeiJ6M.d.ts → resolver-DadfRL6F.d.ts} +1 -1
  214. package/dist/{resolver-DhW0CqZN.d.mts → resolver-khasx3fU.d.mts} +1 -1
  215. package/dist/{route-rendering-BG56SzvJ.d.mts → route-rendering-CLnS7AZj.d.mts} +1 -1
  216. package/dist/{route-rendering-CtVMpV-k.d.ts → route-rendering-lS5nUMua.d.ts} +1 -1
  217. package/dist/{router-D94-SDlW.d.ts → router-4iuiYnOW.d.ts} +1 -1
  218. package/dist/{router-ALUvm8gC.d.mts → router-ifU8Dui1.d.mts} +1 -1
  219. package/dist/routes.d.mts +4 -5
  220. package/dist/routes.d.ts +4 -5
  221. package/dist/{runtime-BirxPwbZ.d.ts → runtime-BgDQzBiu.d.ts} +2 -2
  222. package/dist/{runtime-AOJge4vQ.d.mts → runtime-CV2UCV-5.d.mts} +2 -2
  223. package/dist/server-action-security.cjs +3 -3
  224. package/dist/server-action-security.mjs +2 -2
  225. package/dist/server-fn.cjs +4 -4
  226. package/dist/server-fn.mjs +3 -3
  227. package/dist/server-plugins.d.mts +5 -6
  228. package/dist/server-plugins.d.ts +5 -6
  229. package/dist/server-query.cjs +5 -5
  230. package/dist/server-query.mjs +4 -4
  231. package/dist/server.cjs +41 -41
  232. package/dist/server.d.mts +13 -14
  233. package/dist/server.d.ts +13 -14
  234. package/dist/server.mjs +24 -24
  235. package/dist/{spa-router-DbxNRKOB.d.mts → spa-router-Bq7VCOwx.d.mts} +3 -3
  236. package/dist/{spa-router-CxK3USIz.d.ts → spa-router-DaJk5Re4.d.ts} +3 -3
  237. package/dist/testing.cjs +7 -7
  238. package/dist/testing.d.mts +4 -5
  239. package/dist/testing.d.ts +4 -5
  240. package/dist/testing.mjs +5 -5
  241. package/dist/{types-Z0aotQ8w.d.mts → types-CnH8DOqo.d.mts} +1 -1
  242. package/dist/{types-Z0aotQ8w.d.ts → types-CnH8DOqo.d.ts} +1 -1
  243. package/dist/{utils-311Y8eoK.d.ts → utils-BXLmFsVR.d.ts} +1 -1
  244. package/dist/{utils-4wVRcpOw.d.mts → utils-XJn0c9bj.d.mts} +1 -1
  245. package/dist/version.cjs +2 -2
  246. package/dist/version.mjs +1 -1
  247. package/dist/vite.cjs +22 -22
  248. package/dist/vite.d.mts +4 -5
  249. package/dist/vite.d.ts +4 -5
  250. package/dist/vite.mjs +21 -21
  251. package/dist/{workflows-CR9ex-gz.d.ts → workflows-jZ4BcdoZ.d.mts} +1 -1
  252. package/dist/{workflows-CR9ex-gz.d.mts → workflows-jZ4BcdoZ.d.ts} +1 -1
  253. package/dist/workflows.cjs +3 -3
  254. package/dist/workflows.d.mts +1 -1
  255. package/dist/workflows.d.ts +1 -1
  256. package/dist/workflows.mjs +2 -2
  257. package/package.json +9 -1
  258. package/dist/chunk-M64YUMA4.cjs +0 -58
  259. package/dist/chunk-QLQ32WC4.mjs +0 -58
  260. package/dist/types-DFbjpjXX.d.mts +0 -105
  261. package/dist/types-DFbjpjXX.d.ts +0 -105
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkQJ3J6MZTcjs = require('./chunk-QJ3J6MZT.cjs');
7
+ var _chunk3BHT4WMPcjs = require('./chunk-3BHT4WMP.cjs');
8
8
 
9
9
 
10
10
 
@@ -28,16 +28,29 @@ var _chunkJSROZYYOcjs = require('./chunk-JSROZYYO.cjs');
28
28
 
29
29
 
30
30
 
31
- var _chunkP64MIF5Bcjs = require('./chunk-P64MIF5B.cjs');
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+ var _chunkIPXLADVOcjs = require('./chunk-IPXLADVO.cjs');
32
45
 
33
46
 
34
47
  var _chunkCXP5U3RWcjs = require('./chunk-CXP5U3RW.cjs');
35
48
 
36
49
 
37
- var _chunkK3F2E6GScjs = require('./chunk-K3F2E6GS.cjs');
50
+ var _chunkEJQT6KZNcjs = require('./chunk-EJQT6KZN.cjs');
38
51
 
39
52
 
40
- var _chunkVKNHTSAPcjs = require('./chunk-VKNHTSAP.cjs');
53
+ var _chunk7GLPRTTFcjs = require('./chunk-7GLPRTTF.cjs');
41
54
 
42
55
 
43
56
 
@@ -55,7 +68,8 @@ var _chunkKXWRO25Scjs = require('./chunk-KXWRO25S.cjs');
55
68
 
56
69
 
57
70
 
58
- var _chunk75WGQVQAcjs = require('./chunk-75WGQVQA.cjs');
71
+
72
+ var _chunkHITLGIAOcjs = require('./chunk-HITLGIAO.cjs');
59
73
 
60
74
 
61
75
 
@@ -109,7 +123,7 @@ var _chunkPSV6XKPOcjs = require('./chunk-PSV6XKPO.cjs');
109
123
 
110
124
 
111
125
 
112
- var _chunkZHPHJPQPcjs = require('./chunk-ZHPHJPQP.cjs');
126
+ var _chunkRU3M2FIKcjs = require('./chunk-RU3M2FIK.cjs');
113
127
 
114
128
 
115
129
 
@@ -119,7 +133,7 @@ var _chunkYFPGHF5Fcjs = require('./chunk-YFPGHF5F.cjs');
119
133
  var _chunk6EXBPJ24cjs = require('./chunk-6EXBPJ24.cjs');
120
134
 
121
135
 
122
- var _chunkT5CERMEHcjs = require('./chunk-T5CERMEH.cjs');
136
+ var _chunkZXGAFZDOcjs = require('./chunk-ZXGAFZDO.cjs');
123
137
 
124
138
 
125
139
 
@@ -127,12 +141,12 @@ var _chunkVEKFLAQMcjs = require('./chunk-VEKFLAQM.cjs');
127
141
 
128
142
 
129
143
 
130
- var _chunkBTAG7LI7cjs = require('./chunk-BTAG7LI7.cjs');
144
+ var _chunk73MC7ZL6cjs = require('./chunk-73MC7ZL6.cjs');
131
145
 
132
146
 
133
147
 
134
148
 
135
- var _chunkUX5S4JEOcjs = require('./chunk-UX5S4JEO.cjs');
149
+ var _chunkEFCQPQMGcjs = require('./chunk-EFCQPQMG.cjs');
136
150
 
137
151
 
138
152
 
@@ -146,10 +160,10 @@ var _chunkOHY2ZWUGcjs = require('./chunk-OHY2ZWUG.cjs');
146
160
 
147
161
 
148
162
 
149
- var _chunkXXJU7FCCcjs = require('./chunk-XXJU7FCC.cjs');
163
+ var _chunkEUV4YR3Vcjs = require('./chunk-EUV4YR3V.cjs');
150
164
 
151
165
 
152
- var _chunkMPEYMSCFcjs = require('./chunk-MPEYMSCF.cjs');
166
+ var _chunkVFQT3LAOcjs = require('./chunk-VFQT3LAO.cjs');
153
167
 
154
168
 
155
169
  var _chunk4ZFL5GFNcjs = require('./chunk-4ZFL5GFN.cjs');
@@ -169,14 +183,14 @@ var _chunk6QQDAAAZcjs = require('./chunk-6QQDAAAZ.cjs');
169
183
 
170
184
 
171
185
 
172
- var _chunkTDFPACVXcjs = require('./chunk-TDFPACVX.cjs');
186
+ var _chunkFTFYRMQQcjs = require('./chunk-FTFYRMQQ.cjs');
173
187
 
174
188
 
175
- var _chunkU74I55WBcjs = require('./chunk-U74I55WB.cjs');
189
+ var _chunkULAWS2PAcjs = require('./chunk-ULAWS2PA.cjs');
176
190
 
177
191
 
178
192
 
179
- var _chunk2NQQ5H5Gcjs = require('./chunk-2NQQ5H5G.cjs');
193
+ var _chunkM7MKQXAFcjs = require('./chunk-M7MKQXAF.cjs');
180
194
 
181
195
 
182
196
 
@@ -191,7 +205,7 @@ var _chunk4PPEPOZZcjs = require('./chunk-4PPEPOZZ.cjs');
191
205
  var _chunkMQ3H6LT5cjs = require('./chunk-MQ3H6LT5.cjs');
192
206
 
193
207
 
194
- var _chunkMIDIZJZCcjs = require('./chunk-MIDIZJZC.cjs');
208
+ var _chunkXBML5KMGcjs = require('./chunk-XBML5KMG.cjs');
195
209
 
196
210
 
197
211
 
@@ -210,7 +224,10 @@ var _chunkXJXBIP67cjs = require('./chunk-XJXBIP67.cjs');
210
224
  var _chunkLYLEZIG3cjs = require('./chunk-LYLEZIG3.cjs');
211
225
 
212
226
 
213
- var _chunkG26MUMKLcjs = require('./chunk-G26MUMKL.cjs');
227
+ var _chunkXCACDAZZcjs = require('./chunk-XCACDAZZ.cjs');
228
+
229
+
230
+ var _chunk75RZHGLScjs = require('./chunk-75RZHGLS.cjs');
214
231
 
215
232
 
216
233
 
@@ -244,7 +261,8 @@ var _chunkYWN746UScjs = require('./chunk-YWN746US.cjs');
244
261
 
245
262
 
246
263
 
247
- var _chunkEM6SBQKMcjs = require('./chunk-EM6SBQKM.cjs');
264
+
265
+ var _chunkOMVAU7NTcjs = require('./chunk-OMVAU7NT.cjs');
248
266
 
249
267
 
250
268
  var _chunkM2L4MYDQcjs = require('./chunk-M2L4MYDQ.cjs');
@@ -290,7 +308,7 @@ var _chunkE3UK5IIBcjs = require('./chunk-E3UK5IIB.cjs');
290
308
  var _chunkUQZ4AYTHcjs = require('./chunk-UQZ4AYTH.cjs');
291
309
 
292
310
 
293
- var _chunkODBZYBABcjs = require('./chunk-ODBZYBAB.cjs');
311
+ var _chunkYC6V7PWEcjs = require('./chunk-YC6V7PWE.cjs');
294
312
 
295
313
 
296
314
 
@@ -309,7 +327,9 @@ var _chunkQCVE2OCIcjs = require('./chunk-QCVE2OCI.cjs');
309
327
 
310
328
 
311
329
 
312
- var _chunk3LUF2PE2cjs = require('./chunk-3LUF2PE2.cjs');
330
+
331
+
332
+ var _chunkEK4QAEFZcjs = require('./chunk-EK4QAEFZ.cjs');
313
333
 
314
334
 
315
335
 
@@ -370,7 +390,7 @@ var _chunkNO3WWW3Ncjs = require('./chunk-NO3WWW3N.cjs');
370
390
  var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
371
391
 
372
392
  // src/routing/route-manager.ts
373
- var _path = require('path'); var path9 = _interopRequireWildcard(_path); var path4 = _interopRequireWildcard(_path); var path8 = _interopRequireWildcard(_path); var path16 = _interopRequireWildcard(_path); var path20 = _interopRequireWildcard(_path); var path17 = _interopRequireWildcard(_path);
393
+ var _path = require('path'); var path9 = _interopRequireWildcard(_path); var path4 = _interopRequireWildcard(_path); var path8 = _interopRequireWildcard(_path); var path16 = _interopRequireWildcard(_path); var path21 = _interopRequireWildcard(_path); var path17 = _interopRequireWildcard(_path);
374
394
 
375
395
  // src/utils/client-component.ts
376
396
  var _fs = require('fs'); var fs5 = _interopRequireWildcard(_fs); var fs2 = _interopRequireWildcard(_fs); var fs4 = _interopRequireWildcard(_fs); var fs11 = _interopRequireWildcard(_fs); var fs10 = _interopRequireWildcard(_fs);
@@ -753,6 +773,26 @@ function parseClientModuleMetadata(content, inspectIslandExport) {
753
773
  };
754
774
  }
755
775
  _chunkS3JO3N4Hcjs.__name.call(void 0, parseClientModuleMetadata, "parseClientModuleMetadata");
776
+ var DEFAULT_REEXPORT = /export\s*\{\s*default(?:\s+as\s+default)?\s*\}\s*from\s*(["'])([^"']+)\1/;
777
+ function resolveDefaultReexport(ownerPath, content, root) {
778
+ const match = content ? DEFAULT_REEXPORT.exec(content) : null;
779
+ if (!match) return null;
780
+ const imported = resolveImportedModule(ownerPath, match[2], root);
781
+ return imported.local ? imported.path : null;
782
+ }
783
+ _chunkS3JO3N4Hcjs.__name.call(void 0, resolveDefaultReexport, "resolveDefaultReexport");
784
+ function resolveOwnerSourcePath(resolvedPath, root) {
785
+ const seen = /* @__PURE__ */ new Set();
786
+ let current = resolvedPath;
787
+ while (current && !seen.has(current)) {
788
+ seen.add(current);
789
+ const target = resolveDefaultReexport(current, readIfExists(current), root);
790
+ if (!target) return current;
791
+ current = target;
792
+ }
793
+ return current;
794
+ }
795
+ _chunkS3JO3N4Hcjs.__name.call(void 0, resolveOwnerSourcePath, "resolveOwnerSourcePath");
756
796
  function getClientModuleMetadata(modulePath, root) {
757
797
  const resolvedPath = resolveModuleSourcePath(modulePath, root);
758
798
  return inspectClientModuleMetadata(resolvedPath, root, /* @__PURE__ */ new Set(), true);
@@ -774,7 +814,7 @@ function getClientModuleHydrationPlan(modulePath, root, mode = "off", options =
774
814
  }), "emptyPlan");
775
815
  const asyncOwner = metadata.suppressedAsyncHydration === true && options.asyncOwnerIslands === true;
776
816
  if (mode === "off" && !asyncOwner) return emptyPlan();
777
- const resolvedPath = resolveModuleSourcePath(modulePath, root);
817
+ const resolvedPath = resolveOwnerSourcePath(resolveModuleSourcePath(modulePath, root), root);
778
818
  const content = readIfExists(_nullishCoalesce(resolvedPath, () => ( "")));
779
819
  const parsed = parseClientModuleMetadata(content, true);
780
820
  if (!resolvedPath) return emptyPlan("the owner source could not be resolved");
@@ -828,6 +868,10 @@ function getClientModuleHydrationPlan(modulePath, root, mode = "off", options =
828
868
  return plan;
829
869
  }
830
870
  _chunkS3JO3N4Hcjs.__name.call(void 0, getClientModuleHydrationPlan, "getClientModuleHydrationPlan");
871
+ function usesFarmServerTree(plan) {
872
+ return _optionalChain([plan, 'optionalAccess', _32 => _32.asyncOwnerIslands]) === true && plan.isolatedBoundaries.length > 0 && plan.isolatedBoundaries.every((boundary) => boundary.islandStrategy === "load");
873
+ }
874
+ _chunkS3JO3N4Hcjs.__name.call(void 0, usesFarmServerTree, "usesFarmServerTree");
831
875
  function getMarkdownPageHydrationPlan(componentsModulePath, root, mode = "off", options = {}) {
832
876
  const plan = {
833
877
  isClientComponent: false,
@@ -948,7 +992,7 @@ function getStaticImportBindings(content) {
948
992
  if (!content) return bindings;
949
993
  const tokens = tokenizeModuleSource(content);
950
994
  for (let index = 0; index < tokens.length; index++) {
951
- if (tokens[index].value !== "import" || _optionalChain([tokens, 'access', _32 => _32[index - 1], 'optionalAccess', _33 => _33.value]) === ".") continue;
995
+ if (tokens[index].value !== "import" || _optionalChain([tokens, 'access', _33 => _33[index - 1], 'optionalAccess', _34 => _34.value]) === ".") continue;
952
996
  const first = tokens[index + 1];
953
997
  if (!first || first.value === "type" || first.value === "(" || first.kind === "string") {
954
998
  continue;
@@ -956,7 +1000,7 @@ function getStaticImportBindings(content) {
956
1000
  let fromIndex = -1;
957
1001
  for (let cursor = index + 1; cursor < tokens.length; cursor++) {
958
1002
  if (tokens[cursor].value === ";") break;
959
- if (tokens[cursor].value === "from" && _optionalChain([tokens, 'access', _34 => _34[cursor + 1], 'optionalAccess', _35 => _35.kind]) === "string") {
1003
+ if (tokens[cursor].value === "from" && _optionalChain([tokens, 'access', _35 => _35[cursor + 1], 'optionalAccess', _36 => _36.kind]) === "string") {
960
1004
  fromIndex = cursor;
961
1005
  break;
962
1006
  }
@@ -965,13 +1009,13 @@ function getStaticImportBindings(content) {
965
1009
  const specifier = tokens[fromIndex + 1].value;
966
1010
  const clause = tokens.slice(index + 1, fromIndex);
967
1011
  const localNames = [];
968
- if (_optionalChain([clause, 'access', _36 => _36[0], 'optionalAccess', _37 => _37.kind]) === "identifier" && clause[0].value !== "type") {
1012
+ if (_optionalChain([clause, 'access', _37 => _37[0], 'optionalAccess', _38 => _38.kind]) === "identifier" && clause[0].value !== "type") {
969
1013
  localNames.push(clause[0].value);
970
1014
  }
971
1015
  const namespaceAs = clause.findIndex(
972
- (token, clauseIndex) => token.value === "*" && _optionalChain([clause, 'access', _38 => _38[clauseIndex + 1], 'optionalAccess', _39 => _39.value]) === "as"
1016
+ (token, clauseIndex) => token.value === "*" && _optionalChain([clause, 'access', _39 => _39[clauseIndex + 1], 'optionalAccess', _40 => _40.value]) === "as"
973
1017
  );
974
- if (namespaceAs !== -1 && _optionalChain([clause, 'access', _40 => _40[namespaceAs + 2], 'optionalAccess', _41 => _41.kind]) === "identifier") {
1018
+ if (namespaceAs !== -1 && _optionalChain([clause, 'access', _41 => _41[namespaceAs + 2], 'optionalAccess', _42 => _42.kind]) === "identifier") {
975
1019
  localNames.push(clause[namespaceAs + 2].value);
976
1020
  }
977
1021
  const openingBrace = clause.findIndex((token) => token.value === "{");
@@ -981,11 +1025,11 @@ function getStaticImportBindings(content) {
981
1025
  if (openingBrace !== -1 && closingBrace !== -1) {
982
1026
  let entryStart = openingBrace + 1;
983
1027
  for (let cursor = entryStart; cursor <= closingBrace; cursor++) {
984
- if (cursor !== closingBrace && _optionalChain([clause, 'access', _42 => _42[cursor], 'optionalAccess', _43 => _43.value]) !== ",") continue;
1028
+ if (cursor !== closingBrace && _optionalChain([clause, 'access', _43 => _43[cursor], 'optionalAccess', _44 => _44.value]) !== ",") continue;
985
1029
  const entry = clause.slice(entryStart, cursor).filter((token) => token.value !== "type");
986
1030
  const asIndex = entry.findIndex((token) => token.value === "as");
987
1031
  const local = asIndex === -1 ? entry[0] : entry[asIndex + 1];
988
- if (_optionalChain([local, 'optionalAccess', _44 => _44.kind]) === "identifier") localNames.push(local.value);
1032
+ if (_optionalChain([local, 'optionalAccess', _45 => _45.kind]) === "identifier") localNames.push(local.value);
989
1033
  entryStart = cursor + 1;
990
1034
  }
991
1035
  }
@@ -1014,14 +1058,14 @@ function findParserSensitiveJsxContainer(content, localBindings) {
1014
1058
  const openDepth = /* @__PURE__ */ new Map();
1015
1059
  const isSelfClosing = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (openingIndex) => {
1016
1060
  for (let index = openingIndex; index < tokens.length; index++) {
1017
- if (tokens[index].value === ">") return _optionalChain([tokens, 'access', _45 => _45[index - 1], 'optionalAccess', _46 => _46.value]) === "/";
1061
+ if (tokens[index].value === ">") return _optionalChain([tokens, 'access', _46 => _46[index - 1], 'optionalAccess', _47 => _47.value]) === "/";
1018
1062
  }
1019
1063
  return false;
1020
1064
  }, "isSelfClosing");
1021
1065
  for (let index = 0; index < tokens.length - 1; index++) {
1022
1066
  if (tokens[index].value !== "<") continue;
1023
1067
  if (tokens[index + 1].value === "/") {
1024
- const closing = _optionalChain([tokens, 'access', _47 => _47[index + 2], 'optionalAccess', _48 => _48.value]);
1068
+ const closing = _optionalChain([tokens, 'access', _48 => _48[index + 2], 'optionalAccess', _49 => _49.value]);
1025
1069
  if (closing && openDepth.has(closing)) {
1026
1070
  openDepth.set(closing, Math.max(0, (_nullishCoalesce(openDepth.get(closing), () => ( 0))) - 1));
1027
1071
  }
@@ -1065,7 +1109,7 @@ function findMatchingToken(tokens, openingIndex, opening, closing) {
1065
1109
  _chunkS3JO3N4Hcjs.__name.call(void 0, findMatchingToken, "findMatchingToken");
1066
1110
  function containsClientJsx(tokens, start, end, clientBindings) {
1067
1111
  for (let index = start; index < end; index++) {
1068
- if (tokens[index].value === "<" && clientBindings.has(_optionalChain([tokens, 'access', _49 => _49[index + 1], 'optionalAccess', _50 => _50.value]))) return true;
1112
+ if (tokens[index].value === "<" && clientBindings.has(_optionalChain([tokens, 'access', _50 => _50[index + 1], 'optionalAccess', _51 => _51.value]))) return true;
1069
1113
  }
1070
1114
  return false;
1071
1115
  }
@@ -1105,7 +1149,7 @@ function getClientRenderingHelpers(tokens, clientBindings) {
1105
1149
  let helperName;
1106
1150
  let bodyStart = -1;
1107
1151
  let bodyEnd = -1;
1108
- if (tokens[index].value === "function" && _optionalChain([tokens, 'access', _51 => _51[index + 1], 'optionalAccess', _52 => _52.kind]) === "identifier") {
1152
+ if (tokens[index].value === "function" && _optionalChain([tokens, 'access', _52 => _52[index + 1], 'optionalAccess', _53 => _53.kind]) === "identifier") {
1109
1153
  helperName = tokens[index + 1].value;
1110
1154
  const parametersStart = tokens.findIndex(
1111
1155
  (token, tokenIndex) => tokenIndex > index + 1 && token.value === "("
@@ -1115,21 +1159,21 @@ function getClientRenderingHelpers(tokens, clientBindings) {
1115
1159
  (token, tokenIndex) => tokenIndex > parametersEnd && token.value === "{"
1116
1160
  );
1117
1161
  if (bodyStart !== -1) bodyEnd = findMatchingToken(tokens, bodyStart, "{", "}");
1118
- } else if ((tokens[index].value === "const" || tokens[index].value === "let" || tokens[index].value === "var") && _optionalChain([tokens, 'access', _53 => _53[index + 1], 'optionalAccess', _54 => _54.kind]) === "identifier") {
1162
+ } else if ((tokens[index].value === "const" || tokens[index].value === "let" || tokens[index].value === "var") && _optionalChain([tokens, 'access', _54 => _54[index + 1], 'optionalAccess', _55 => _55.kind]) === "identifier") {
1119
1163
  helperName = tokens[index + 1].value;
1120
1164
  let assignmentIndex = -1;
1121
1165
  let arrowIndex = -1;
1122
1166
  for (let cursor = index + 2; cursor < tokens.length; cursor++) {
1123
1167
  if (tokens[cursor].value === ";") break;
1124
1168
  if (assignmentIndex === -1 && tokens[cursor].value === "=") assignmentIndex = cursor;
1125
- if (tokens[cursor].value === "=" && _optionalChain([tokens, 'access', _55 => _55[cursor + 1], 'optionalAccess', _56 => _56.value]) === ">") {
1169
+ if (tokens[cursor].value === "=" && _optionalChain([tokens, 'access', _56 => _56[cursor + 1], 'optionalAccess', _57 => _57.value]) === ">") {
1126
1170
  arrowIndex = cursor;
1127
1171
  break;
1128
1172
  }
1129
1173
  }
1130
1174
  if (arrowIndex !== -1) {
1131
1175
  bodyStart = arrowIndex + 2;
1132
- bodyEnd = _optionalChain([tokens, 'access', _57 => _57[bodyStart], 'optionalAccess', _58 => _58.value]) === "{" ? findMatchingToken(tokens, bodyStart, "{", "}") : findStatementEnd(tokens, bodyStart);
1176
+ bodyEnd = _optionalChain([tokens, 'access', _58 => _58[bodyStart], 'optionalAccess', _59 => _59.value]) === "{" ? findMatchingToken(tokens, bodyStart, "{", "}") : findStatementEnd(tokens, bodyStart);
1133
1177
  } else if (assignmentIndex !== -1) {
1134
1178
  bodyStart = assignmentIndex + 1;
1135
1179
  bodyEnd = findStatementEnd(tokens, bodyStart);
@@ -1170,14 +1214,14 @@ function passesElementValuedProps(content, localBindings) {
1170
1214
  else if (value === "}") braceDepth--;
1171
1215
  else if (value === "<" && braceDepth > 0) return true;
1172
1216
  else if (value === ">" && braceDepth === 0) {
1173
- selfClosing = _optionalChain([tokens, 'access', _59 => _59[cursor - 1], 'optionalAccess', _60 => _60.value]) === "/";
1217
+ selfClosing = _optionalChain([tokens, 'access', _60 => _60[cursor - 1], 'optionalAccess', _61 => _61.value]) === "/";
1174
1218
  break;
1175
1219
  }
1176
1220
  }
1177
1221
  if (selfClosing || cursor >= tokens.length) continue;
1178
1222
  for (let child = cursor + 1; child < tokens.length; child++) {
1179
1223
  if (tokens[child].value !== "<") continue;
1180
- const closesBoundary = _optionalChain([tokens, 'access', _61 => _61[child + 1], 'optionalAccess', _62 => _62.value]) === "/" && _optionalChain([tokens, 'access', _63 => _63[child + 2], 'optionalAccess', _64 => _64.value]) === name;
1224
+ const closesBoundary = _optionalChain([tokens, 'access', _62 => _62[child + 1], 'optionalAccess', _63 => _63.value]) === "/" && _optionalChain([tokens, 'access', _64 => _64[child + 2], 'optionalAccess', _65 => _65.value]) === name;
1181
1225
  if (!closesBoundary) return true;
1182
1226
  break;
1183
1227
  }
@@ -1193,9 +1237,9 @@ function hasDynamicJsxCardinality(content, localBindings) {
1193
1237
  const containsDynamicRenderer = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (start, end) => containsClientJsx(tokens, start, end, clientBindings) || tokens.slice(start, end).some((token) => renderingHelpers.has(token.value)), "containsDynamicRenderer");
1194
1238
  for (let index = 0; index < tokens.length; index++) {
1195
1239
  let callStart = -1;
1196
- if (tokens[index].value === "." && (_optionalChain([tokens, 'access', _65 => _65[index + 1], 'optionalAccess', _66 => _66.value]) === "map" || _optionalChain([tokens, 'access', _67 => _67[index + 1], 'optionalAccess', _68 => _68.value]) === "flatMap") && _optionalChain([tokens, 'access', _69 => _69[index + 2], 'optionalAccess', _70 => _70.value]) === "(") {
1240
+ if (tokens[index].value === "." && (_optionalChain([tokens, 'access', _66 => _66[index + 1], 'optionalAccess', _67 => _67.value]) === "map" || _optionalChain([tokens, 'access', _68 => _68[index + 1], 'optionalAccess', _69 => _69.value]) === "flatMap") && _optionalChain([tokens, 'access', _70 => _70[index + 2], 'optionalAccess', _71 => _71.value]) === "(") {
1197
1241
  callStart = index + 2;
1198
- } else if (tokens[index].value === "Array" && _optionalChain([tokens, 'access', _71 => _71[index + 1], 'optionalAccess', _72 => _72.value]) === "." && _optionalChain([tokens, 'access', _73 => _73[index + 2], 'optionalAccess', _74 => _74.value]) === "from" && _optionalChain([tokens, 'access', _75 => _75[index + 3], 'optionalAccess', _76 => _76.value]) === "(") {
1242
+ } else if (tokens[index].value === "Array" && _optionalChain([tokens, 'access', _72 => _72[index + 1], 'optionalAccess', _73 => _73.value]) === "." && _optionalChain([tokens, 'access', _74 => _74[index + 2], 'optionalAccess', _75 => _75.value]) === "from" && _optionalChain([tokens, 'access', _76 => _76[index + 3], 'optionalAccess', _77 => _77.value]) === "(") {
1199
1243
  callStart = index + 3;
1200
1244
  }
1201
1245
  if (callStart !== -1) {
@@ -1204,10 +1248,10 @@ function hasDynamicJsxCardinality(content, localBindings) {
1204
1248
  index = callEnd;
1205
1249
  continue;
1206
1250
  }
1207
- if ((tokens[index].value === "for" || tokens[index].value === "while") && _optionalChain([tokens, 'access', _77 => _77[index + 1], 'optionalAccess', _78 => _78.value]) === "(") {
1251
+ if ((tokens[index].value === "for" || tokens[index].value === "while") && _optionalChain([tokens, 'access', _78 => _78[index + 1], 'optionalAccess', _79 => _79.value]) === "(") {
1208
1252
  const conditionEnd = findMatchingToken(tokens, index + 1, "(", ")");
1209
1253
  const bodyStart = conditionEnd + 1;
1210
- const bodyEnd = _optionalChain([tokens, 'access', _79 => _79[bodyStart], 'optionalAccess', _80 => _80.value]) === "{" ? findMatchingToken(tokens, bodyStart, "{", "}") : tokens.findIndex((token, tokenIndex) => tokenIndex > bodyStart && token.value === ";");
1254
+ const bodyEnd = _optionalChain([tokens, 'access', _80 => _80[bodyStart], 'optionalAccess', _81 => _81.value]) === "{" ? findMatchingToken(tokens, bodyStart, "{", "}") : tokens.findIndex((token, tokenIndex) => tokenIndex > bodyStart && token.value === ";");
1211
1255
  if (containsDynamicRenderer(bodyStart, bodyEnd === -1 ? tokens.length : bodyEnd)) return true;
1212
1256
  }
1213
1257
  }
@@ -1315,6 +1359,10 @@ function inspectClientModuleMetadata(resolvedPath, root, visited, inspectIslandE
1315
1359
  }
1316
1360
  visited.add(resolvedPath);
1317
1361
  const content = readIfExists(resolvedPath);
1362
+ if (inspectIslandExport) {
1363
+ const target = resolveDefaultReexport(resolvedPath, content, root);
1364
+ if (target) return inspectClientModuleMetadata(target, root, visited, true);
1365
+ }
1318
1366
  const parsed = parseClientModuleMetadata(content, inspectIslandExport);
1319
1367
  if (parsed.isClientComponent) {
1320
1368
  return {
@@ -1406,7 +1454,7 @@ function getImportSpecifiers(content) {
1406
1454
  continue;
1407
1455
  }
1408
1456
  const previous = tokens[index - 1];
1409
- if (_optionalChain([previous, 'optionalAccess', _81 => _81.value]) === ".") continue;
1457
+ if (_optionalChain([previous, 'optionalAccess', _82 => _82.value]) === ".") continue;
1410
1458
  const first = tokens[index + 1];
1411
1459
  if (!first || first.value === "type" || first.value === "(" || first.value === ".") {
1412
1460
  continue;
@@ -1422,7 +1470,7 @@ function getImportSpecifiers(content) {
1422
1470
  for (let cursor = index + 1; cursor < tokens.length; cursor++) {
1423
1471
  const token = tokens[cursor];
1424
1472
  if (token.value === ";") break;
1425
- if (token.value === "from" && _optionalChain([tokens, 'access', _82 => _82[cursor + 1], 'optionalAccess', _83 => _83.kind]) === "string") {
1473
+ if (token.value === "from" && _optionalChain([tokens, 'access', _83 => _83[cursor + 1], 'optionalAccess', _84 => _84.kind]) === "string") {
1426
1474
  fromIndex = cursor;
1427
1475
  break;
1428
1476
  }
@@ -1441,14 +1489,14 @@ function getImportSpecifiers(content) {
1441
1489
  }
1442
1490
  _chunkS3JO3N4Hcjs.__name.call(void 0, getImportSpecifiers, "getImportSpecifiers");
1443
1491
  function isTypeOnlyNamedClause(tokens, startIndex, endIndex) {
1444
- if (_optionalChain([tokens, 'access', _84 => _84[startIndex], 'optionalAccess', _85 => _85.value]) !== "{") return false;
1492
+ if (_optionalChain([tokens, 'access', _85 => _85[startIndex], 'optionalAccess', _86 => _86.value]) !== "{") return false;
1445
1493
  const closingBraceIndex = tokens.findIndex(
1446
1494
  (token, index) => index > startIndex && index < endIndex && token.value === "}"
1447
1495
  );
1448
1496
  if (closingBraceIndex === -1) return false;
1449
1497
  let entryStartsAt = startIndex + 1;
1450
1498
  for (let index = entryStartsAt; index <= closingBraceIndex; index++) {
1451
- if (index !== closingBraceIndex && _optionalChain([tokens, 'access', _86 => _86[index], 'optionalAccess', _87 => _87.value]) !== ",") continue;
1499
+ if (index !== closingBraceIndex && _optionalChain([tokens, 'access', _87 => _87[index], 'optionalAccess', _88 => _88.value]) !== ",") continue;
1452
1500
  const entry = tokens.slice(entryStartsAt, index);
1453
1501
  if (entry.length > 0 && entry[0].value !== "type") return false;
1454
1502
  entryStartsAt = index + 1;
@@ -1517,7 +1565,7 @@ function getProjectImportAliases(projectRoot) {
1517
1565
  const sourceDir = _chunk6MVFL3R5cjs.getFarmProjectSourceDir.call(void 0, projectRoot);
1518
1566
  const cacheStamp = `${stamp}:${sourceDir}`;
1519
1567
  const cached = projectImportAliasCache.get(projectRoot);
1520
- if (_optionalChain([cached, 'optionalAccess', _88 => _88.stamp]) === cacheStamp) return cached.aliases;
1568
+ if (_optionalChain([cached, 'optionalAccess', _89 => _89.stamp]) === cacheStamp) return cached.aliases;
1521
1569
  const aliases = [
1522
1570
  ...readTsconfigPathAliases(projectRoot),
1523
1571
  ...readPackageImportAliases(projectRoot)
@@ -1539,7 +1587,7 @@ function readTsconfigPathAliases(projectRoot) {
1539
1587
  const configPath = path9.default.join(projectRoot, name);
1540
1588
  if (!fs5.default.existsSync(configPath)) continue;
1541
1589
  const resolved = readTsconfigPaths(configPath, /* @__PURE__ */ new Set());
1542
- if (!_optionalChain([resolved, 'optionalAccess', _89 => _89.paths])) return [];
1590
+ if (!_optionalChain([resolved, 'optionalAccess', _90 => _90.paths])) return [];
1543
1591
  const base = _nullishCoalesce(resolved.baseUrl, () => ( resolved.pathsDirectory));
1544
1592
  return Object.entries(resolved.paths).flatMap(([pattern, targets]) => {
1545
1593
  if (!Array.isArray(targets)) return [];
@@ -1575,7 +1623,7 @@ function readTsconfigPaths(configPath, visited) {
1575
1623
  inherited = _nullishCoalesce(readTsconfigPaths(parentPath, visited), () => ( inherited));
1576
1624
  }
1577
1625
  const options = _nullishCoalesce(config.compilerOptions, () => ( {}));
1578
- const baseUrl = typeof options.baseUrl === "string" ? path9.default.resolve(directory, options.baseUrl) : _optionalChain([inherited, 'optionalAccess', _90 => _90.baseUrl]);
1626
+ const baseUrl = typeof options.baseUrl === "string" ? path9.default.resolve(directory, options.baseUrl) : _optionalChain([inherited, 'optionalAccess', _91 => _91.baseUrl]);
1579
1627
  if (options.paths && typeof options.paths === "object") {
1580
1628
  return { paths: options.paths, pathsDirectory: directory, baseUrl };
1581
1629
  }
@@ -1583,11 +1631,11 @@ function readTsconfigPaths(configPath, visited) {
1583
1631
  }
1584
1632
  _chunkS3JO3N4Hcjs.__name.call(void 0, readTsconfigPaths, "readTsconfigPaths");
1585
1633
  function readPackageImportAliases(projectRoot) {
1586
- const imports = _optionalChain([readPackageJson, 'call', _91 => _91(path9.default.join(projectRoot, "package.json")), 'optionalAccess', _92 => _92.imports]);
1634
+ const imports = _optionalChain([readPackageJson, 'call', _92 => _92(path9.default.join(projectRoot, "package.json")), 'optionalAccess', _93 => _93.imports]);
1587
1635
  if (!imports || typeof imports !== "object") return [];
1588
1636
  return Object.entries(imports).flatMap(([pattern, value]) => {
1589
1637
  const target = resolveConditionalExportTarget(value);
1590
- if (!pattern.startsWith("#") || !_optionalChain([target, 'optionalAccess', _93 => _93.startsWith, 'call', _94 => _94("./")])) return [];
1638
+ if (!pattern.startsWith("#") || !_optionalChain([target, 'optionalAccess', _94 => _94.startsWith, 'call', _95 => _95("./")])) return [];
1591
1639
  const wildcardIndex = pattern.indexOf("*");
1592
1640
  return [
1593
1641
  {
@@ -1656,15 +1704,15 @@ function resolvePackageModuleSourcePath(importerPath, specifier, root) {
1656
1704
  const packageJsonPath = path9.default.join(packageDirectory, "package.json");
1657
1705
  const packageJson = readPackageJson(packageJsonPath);
1658
1706
  const exportKey = packageSubpath ? `./${packageSubpath}` : ".";
1659
- const exportTarget = resolvePackageExport(_optionalChain([packageJson, 'optionalAccess', _95 => _95.exports]), exportKey);
1707
+ const exportTarget = resolvePackageExport(_optionalChain([packageJson, 'optionalAccess', _96 => _96.exports]), exportKey);
1660
1708
  const candidates = /* @__PURE__ */ new Set();
1661
- if (_optionalChain([exportTarget, 'optionalAccess', _96 => _96.startsWith, 'call', _97 => _97("./")])) {
1709
+ if (_optionalChain([exportTarget, 'optionalAccess', _97 => _97.startsWith, 'call', _98 => _98("./")])) {
1662
1710
  candidates.add(path9.default.resolve(packageDirectory, exportTarget));
1663
1711
  }
1664
1712
  if (packageSubpath) {
1665
1713
  candidates.add(path9.default.join(packageDirectory, packageSubpath));
1666
1714
  } else {
1667
- for (const entry of [_optionalChain([packageJson, 'optionalAccess', _98 => _98.browser]), _optionalChain([packageJson, 'optionalAccess', _99 => _99.module]), _optionalChain([packageJson, 'optionalAccess', _100 => _100.main])]) {
1715
+ for (const entry of [_optionalChain([packageJson, 'optionalAccess', _99 => _99.browser]), _optionalChain([packageJson, 'optionalAccess', _100 => _100.module]), _optionalChain([packageJson, 'optionalAccess', _101 => _101.main])]) {
1668
1716
  if (typeof entry === "string") candidates.add(path9.default.resolve(packageDirectory, entry));
1669
1717
  }
1670
1718
  candidates.add(path9.default.join(packageDirectory, "index"));
@@ -1732,7 +1780,7 @@ function resolvePackageExport(exportsField, exportKey) {
1732
1780
  if (!exportKey.startsWith(prefix) || !exportKey.endsWith(suffix)) continue;
1733
1781
  const wildcard = exportKey.slice(prefix.length, exportKey.length - suffix.length);
1734
1782
  const target = resolveConditionalExportTarget(value);
1735
- return _nullishCoalesce(_optionalChain([target, 'optionalAccess', _101 => _101.replace, 'call', _102 => _102("*", wildcard)]), () => ( null));
1783
+ return _nullishCoalesce(_optionalChain([target, 'optionalAccess', _102 => _102.replace, 'call', _103 => _103("*", wildcard)]), () => ( null));
1736
1784
  }
1737
1785
  return null;
1738
1786
  }
@@ -1781,7 +1829,7 @@ function createFarmRouteRenderPlan(input = {}) {
1781
1829
  const layoutShouldHydrate = input.layoutShouldHydrate === true;
1782
1830
  const hydration = pageShouldHydrate ? layoutShouldHydrate ? "route-and-layout-islands" : "route-island" : layoutShouldHydrate ? "layout-island" : "none";
1783
1831
  const rendering = input.rendering;
1784
- const cache2 = _optionalChain([rendering, 'optionalAccess', _103 => _103.ssg]) ? typeof rendering.revalidate === "number" && rendering.revalidate > 0 ? { mode: "revalidate", revalidate: rendering.revalidate } : { mode: "static" } : { mode: "dynamic" };
1832
+ const cache2 = _optionalChain([rendering, 'optionalAccess', _104 => _104.ssg]) ? typeof rendering.revalidate === "number" && rendering.revalidate > 0 ? { mode: "revalidate", revalidate: rendering.revalidate } : { mode: "static" } : { mode: "dynamic" };
1785
1833
  return {
1786
1834
  version: 1,
1787
1835
  output: "html",
@@ -1896,6 +1944,10 @@ async function readAltText(filePath) {
1896
1944
  _chunkS3JO3N4Hcjs.__name.call(void 0, readAltText, "readAltText");
1897
1945
 
1898
1946
  // src/routing/route-manager.ts
1947
+ function getRouteEntryDirectory(entry) {
1948
+ return _nullishCoalesce(entry.directory, () => ( entry.pattern));
1949
+ }
1950
+ _chunkS3JO3N4Hcjs.__name.call(void 0, getRouteEntryDirectory, "getRouteEntryDirectory");
1899
1951
  function shouldSuggestStaticRenderingForI18n(i18n) {
1900
1952
  return !i18n || i18n.routing === "prefix-always" || i18n.routing === "prefix-except-default" && i18n.detection.every((signal) => signal === "url");
1901
1953
  }
@@ -1973,8 +2025,8 @@ var _RouteManager = class _RouteManager {
1973
2025
  )
1974
2026
  );
1975
2027
  this.orderedLayouts = Array.from(this.layouts.values()).sort(
1976
- (left, right) => left.route.segments.length - right.route.segments.length
1977
- );
2028
+ (left, right) => _chunkIPXLADVOcjs.getRouteDirectoryDepth.call(void 0, left.pattern) - _chunkIPXLADVOcjs.getRouteDirectoryDepth.call(void 0, right.pattern)
2029
+ ).map((entry) => ({ entry, groupScope: _chunkIPXLADVOcjs.getRouteGroupScope.call(void 0, entry.pattern) }));
1978
2030
  for (const slot of this.routeSlots.values()) {
1979
2031
  if (!this.routeSlotOwnerSegments.has(slot.ownerPattern)) {
1980
2032
  this.routeSlotOwnerSegments.set(
@@ -2009,7 +2061,7 @@ var _RouteManager = class _RouteManager {
2009
2061
  break;
2010
2062
  }
2011
2063
  }
2012
- const layouts = this.findMatchingLayouts(normalizedPath, pathParts);
2064
+ const layouts = this.findMatchingLayouts(pathParts, matchedRoute);
2013
2065
  const slots = this.findMatchingRouteSlots(normalizedPath, pathParts, options.interceptFrom);
2014
2066
  return {
2015
2067
  route: matchedRoute,
@@ -2040,7 +2092,7 @@ var _RouteManager = class _RouteManager {
2040
2092
  throw new Error(`Cannot resolve runtime configuration for unknown route "${pattern}"`);
2041
2093
  }
2042
2094
  const inherited = _chunkSOR334EBcjs.resolveFarmRouteRuleRuntimeConfig.call(void 0, pattern, this.config.routeRules);
2043
- const layouts = this.findMatchingLayouts(pattern);
2095
+ const layouts = this.findMatchingLayouts(_chunk5QIKR7RRcjs.splitRoutePath.call(void 0, pattern), routeEntry);
2044
2096
  const layoutConfigs = [];
2045
2097
  for (const layout of layouts) {
2046
2098
  const layoutModule = await this.loadLayoutModule(layout.modulePath);
@@ -2085,7 +2137,7 @@ var _RouteManager = class _RouteManager {
2085
2137
  matchRedirect(pathname, search = "") {
2086
2138
  const i18n = this.getI18nConfig();
2087
2139
  const localeMatch = i18n ? _chunkBIDYX3SLcjs.resolveFarmLocalePath.call(void 0, pathname, i18n) : void 0;
2088
- const routePathname = _optionalChain([localeMatch, 'optionalAccess', _104 => _104.pathname]) || pathname;
2140
+ const routePathname = _optionalChain([localeMatch, 'optionalAccess', _105 => _105.pathname]) || pathname;
2089
2141
  const normalizedPath = routePathname === "/" ? "/" : routePathname.replace(/\/$/, "");
2090
2142
  for (const redirectEntry of this.redirects.values()) {
2091
2143
  const match = _chunk5QIKR7RRcjs.matchRoute.call(void 0, normalizedPath, redirectEntry.route.segments);
@@ -2096,7 +2148,7 @@ var _RouteManager = class _RouteManager {
2096
2148
  destination: _chunkYX3DBN4Mcjs.appendFarmRedirectQuery.call(void 0,
2097
2149
  this.localizeRedirectDestination(
2098
2150
  interpolateRedirectDestination(redirectEntry.definition.destination, match.params),
2099
- _optionalChain([localeMatch, 'optionalAccess', _105 => _105.locale])
2151
+ _optionalChain([localeMatch, 'optionalAccess', _106 => _106.locale])
2100
2152
  ),
2101
2153
  search
2102
2154
  ),
@@ -2107,16 +2159,19 @@ var _RouteManager = class _RouteManager {
2107
2159
  return null;
2108
2160
  }
2109
2161
  /**
2110
- * Return the nearest matching loading boundary for a pathname.
2162
+ * Return the nearest matching loading boundary for a pathname. Pass the page
2163
+ * `matchRoute` selected when it is known (`null` for none); otherwise the page is
2164
+ * matched only if a boundary inside a route group needs it.
2111
2165
  */
2112
- getMatchingLoading(pathname) {
2113
- return this.findNearestBoundary(this.toRoutePathname(pathname), this.loadings);
2166
+ getMatchingLoading(pathname, route) {
2167
+ return this.findNearestBoundary(this.toRoutePathname(pathname), this.loadings, route);
2114
2168
  }
2115
2169
  /**
2116
- * Return the nearest matching error boundary for a pathname.
2170
+ * Return the nearest matching error boundary for a pathname. `route` works as it
2171
+ * does for `getMatchingLoading`.
2117
2172
  */
2118
- getMatchingError(pathname) {
2119
- return this.findNearestBoundary(this.toRoutePathname(pathname), this.errors);
2173
+ getMatchingError(pathname, route) {
2174
+ return this.findNearestBoundary(this.toRoutePathname(pathname), this.errors, route);
2120
2175
  }
2121
2176
  matchMetadataImage(pathname) {
2122
2177
  const routePathname = this.toRoutePathname(pathname);
@@ -2201,7 +2256,7 @@ var _RouteManager = class _RouteManager {
2201
2256
  */
2202
2257
  generateClientManifest(projectRoot = this.config.root) {
2203
2258
  const normalizedProjectRoot = path9.default.resolve(projectRoot);
2204
- if (_optionalChain([this, 'access', _106 => _106.clientManifestCache, 'optionalAccess', _107 => _107.projectRoot]) === normalizedProjectRoot) {
2259
+ if (_optionalChain([this, 'access', _107 => _107.clientManifestCache, 'optionalAccess', _108 => _108.projectRoot]) === normalizedProjectRoot) {
2205
2260
  return this.clientManifestCache.manifest;
2206
2261
  }
2207
2262
  const toUrlPath = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (absolutePath) => {
@@ -2213,21 +2268,21 @@ var _RouteManager = class _RouteManager {
2213
2268
  }
2214
2269
  return absolutePath;
2215
2270
  }, "toUrlPath");
2216
- const integrationProviders = _chunkTDFPACVXcjs.getIntegrationProviders.call(void 0, this.config.integrations).filter(
2271
+ const integrationProviders = _chunkFTFYRMQQcjs.getIntegrationProviders.call(void 0, this.config.integrations).filter(
2217
2272
  (provider) => provider.component || provider.type === "clerk"
2218
2273
  );
2219
2274
  const unsupportedIntegrationProvider = integrationProviders.find(
2220
2275
  (provider) => provider.supportsIsolatedHydration !== true
2221
2276
  );
2222
- if (_optionalChain([this, 'access', _108 => _108.config, 'access', _109 => _109.experimental, 'optionalAccess', _110 => _110.isolatedClientHydration]) === "enabled" && _optionalChain([this, 'access', _111 => _111.config, 'access', _112 => _112.experimental, 'optionalAccess', _113 => _113.serverComponents]) !== true && unsupportedIntegrationProvider) {
2277
+ if (_optionalChain([this, 'access', _109 => _109.config, 'access', _110 => _110.experimental, 'optionalAccess', _111 => _111.isolatedClientHydration]) === "enabled" && _optionalChain([this, 'access', _112 => _112.config, 'access', _113 => _113.experimental, 'optionalAccess', _114 => _114.serverComponents]) !== true && unsupportedIntegrationProvider) {
2223
2278
  _chunk5QIKR7RRcjs.logger.warn(
2224
2279
  `[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
2225
2280
  );
2226
2281
  }
2227
2282
  const isolatedMode = resolveFarmIsolatedClientHydrationMode(
2228
- _optionalChain([this, 'access', _114 => _114.config, 'access', _115 => _115.experimental, 'optionalAccess', _116 => _116.isolatedClientHydration]),
2283
+ _optionalChain([this, 'access', _115 => _115.config, 'access', _116 => _116.experimental, 'optionalAccess', _117 => _117.isolatedClientHydration]),
2229
2284
  {
2230
- serverComponents: _optionalChain([this, 'access', _117 => _117.config, 'access', _118 => _118.experimental, 'optionalAccess', _119 => _119.serverComponents]) === true,
2285
+ serverComponents: _optionalChain([this, 'access', _118 => _118.config, 'access', _119 => _119.experimental, 'optionalAccess', _120 => _120.serverComponents]) === true,
2231
2286
  hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
2232
2287
  }
2233
2288
  );
@@ -2252,7 +2307,7 @@ var _RouteManager = class _RouteManager {
2252
2307
  );
2253
2308
  const routeEntries = Array.from(this.routes.values()).map((entry) => ({
2254
2309
  entry,
2255
- metadata: _chunkUX5S4JEOcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? markdownPagePlan() : getClientModuleHydrationPlan(
2310
+ metadata: _chunkEFCQPQMGcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? markdownPagePlan() : getClientModuleHydrationPlan(
2256
2311
  entry.modulePath,
2257
2312
  normalizedProjectRoot,
2258
2313
  isolatedMode,
@@ -2260,23 +2315,23 @@ var _RouteManager = class _RouteManager {
2260
2315
  )
2261
2316
  }));
2262
2317
  const markdownFallback = routeEntries.find(
2263
- ({ entry, metadata }) => _chunkUX5S4JEOcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) && metadata.fallbackReason
2318
+ ({ entry, metadata }) => _chunkEFCQPQMGcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) && metadata.fallbackReason
2264
2319
  );
2265
2320
  if (markdownFallback) {
2266
2321
  _chunk5QIKR7RRcjs.logger.warn(
2267
2322
  `[Farm.js] client components in Markdown pages stay static: ${markdownFallback.metadata.fallbackReason}.`
2268
2323
  );
2269
2324
  }
2270
- const markdownStaticPackages = _optionalChain([routeEntries, 'access', _120 => _120.find, 'call', _121 => _121(
2271
- ({ entry, metadata }) => _chunkUX5S4JEOcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) && metadata.staticPackageBoundaries
2272
- ), 'optionalAccess', _122 => _122.metadata, 'access', _123 => _123.staticPackageBoundaries]);
2325
+ const markdownStaticPackages = _optionalChain([routeEntries, 'access', _121 => _121.find, 'call', _122 => _122(
2326
+ ({ entry, metadata }) => _chunkEFCQPQMGcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) && metadata.staticPackageBoundaries
2327
+ ), 'optionalAccess', _123 => _123.metadata, 'access', _124 => _124.staticPackageBoundaries]);
2273
2328
  if (markdownStaticPackages) {
2274
2329
  _chunk5QIKR7RRcjs.logger.info(
2275
2330
  `[Farm.js] Markdown pages render client components from ${markdownStaticPackages.join(", ")} as static HTML: package client components cannot be isolated yet.`
2276
2331
  );
2277
2332
  }
2278
2333
  for (const { entry, metadata } of [...layoutEntries, ...routeEntries]) {
2279
- if (_chunkUX5S4JEOcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) || !metadata.staticPackageBoundaries) continue;
2334
+ if (_chunkEFCQPQMGcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) || !metadata.staticPackageBoundaries) continue;
2280
2335
  _chunk5QIKR7RRcjs.logger.info(
2281
2336
  `[Farm.js] ${entry.pattern} is async, so it renders client components from ${metadata.staticPackageBoundaries.join(", ")} as static HTML: package client components cannot be isolated yet.`
2282
2337
  );
@@ -2284,15 +2339,15 @@ var _RouteManager = class _RouteManager {
2284
2339
  enforceFarmIsolatedHydrationRouteBudget(
2285
2340
  layoutEntries.map(({ entry, metadata }) => ({
2286
2341
  pattern: entry.pattern,
2287
- depth: entry.route.segments.length,
2342
+ depth: _chunkIPXLADVOcjs.getRouteDirectoryDepth.call(void 0, entry.pattern),
2288
2343
  metadata
2289
2344
  })),
2290
2345
  routeEntries.map(({ entry, metadata }) => ({
2291
- pattern: entry.pattern,
2292
- depth: entry.route.segments.length,
2346
+ pattern: getRouteEntryDirectory(entry),
2347
+ depth: _chunkIPXLADVOcjs.getRouteDirectoryDepth.call(void 0, getRouteEntryDirectory(entry)),
2293
2348
  metadata
2294
2349
  })),
2295
- (layoutPattern, routePattern) => layoutPattern === "/" || routePattern === layoutPattern || routePattern.startsWith(`${layoutPattern.replace(/\/$/, "")}/`)
2350
+ _chunkIPXLADVOcjs.routeBoundaryCoversDirectory
2296
2351
  );
2297
2352
  for (const { entry, metadata } of [...layoutEntries, ...routeEntries]) {
2298
2353
  if (!metadata.costGuardExceeded) continue;
@@ -2311,10 +2366,11 @@ var _RouteManager = class _RouteManager {
2311
2366
  const routes = routeEntries.map(({ entry, metadata }) => {
2312
2367
  const programmaticPage = this.programmaticPages.get(entry.modulePath);
2313
2368
  const layoutShouldHydrate = layoutEntries.some(
2314
- ({ entry: layout, metadata: layoutMetadata }) => layoutMetadata.shouldHydrate && (layout.pattern === "/" || entry.pattern === layout.pattern || entry.pattern.startsWith(`${layout.pattern.replace(/\/$/, "")}/`))
2369
+ ({ entry: layout, metadata: layoutMetadata }) => layoutMetadata.shouldHydrate && _chunkIPXLADVOcjs.routeBoundaryCoversDirectory.call(void 0, layout.pattern, getRouteEntryDirectory(entry))
2315
2370
  );
2316
2371
  return {
2317
2372
  pattern: entry.pattern,
2373
+ ...entry.directory ? { directory: entry.directory } : {},
2318
2374
  modulePath: toUrlPath(entry.modulePath),
2319
2375
  shouldHydrate: metadata.shouldHydrate,
2320
2376
  isClientComponent: metadata.isClientComponent,
@@ -2326,6 +2382,7 @@ var _RouteManager = class _RouteManager {
2326
2382
  modulePath: toUrlPath(boundary.modulePath)
2327
2383
  }))
2328
2384
  } : {},
2385
+ ...usesFarmServerTree(metadata) ? { serverTree: true } : {},
2329
2386
  renderPlan: createFarmRouteRenderPlan({
2330
2387
  pageShouldHydrate: metadata.shouldHydrate,
2331
2388
  layoutShouldHydrate,
@@ -2333,7 +2390,7 @@ var _RouteManager = class _RouteManager {
2333
2390
  }),
2334
2391
  suppressedAsyncHydration: metadata.suppressedAsyncHydration,
2335
2392
  ...metadata.suppressedAsyncHydration && metadata.fallbackReason ? { suppressedAsyncHydrationReason: metadata.fallbackReason } : {},
2336
- search: _chunk6V4TDWECcjs.getProgrammaticRouteSearchClientOptions.call(void 0, _optionalChain([programmaticPage, 'optionalAccess', _124 => _124.search])),
2393
+ search: _chunk6V4TDWECcjs.getProgrammaticRouteSearchClientOptions.call(void 0, _optionalChain([programmaticPage, 'optionalAccess', _125 => _125.search])),
2337
2394
  segments: entry.route.segments.map((seg) => ({
2338
2395
  segment: seg.segment,
2339
2396
  isDynamic: seg.isDynamic,
@@ -2409,7 +2466,7 @@ var _RouteManager = class _RouteManager {
2409
2466
  getIsolatedClientBoundaryModules(projectRoot = this.config.root) {
2410
2467
  const normalizedProjectRoot = path9.default.resolve(projectRoot);
2411
2468
  this.generateClientManifest(normalizedProjectRoot);
2412
- return _nullishCoalesce(_optionalChain([this, 'access', _125 => _125.clientManifestCache, 'optionalAccess', _126 => _126.isolatedClientBoundaryModules]), () => ( /* @__PURE__ */ new Set()));
2469
+ return _nullishCoalesce(_optionalChain([this, 'access', _126 => _126.clientManifestCache, 'optionalAccess', _127 => _127.isolatedClientBoundaryModules]), () => ( /* @__PURE__ */ new Set()));
2413
2470
  }
2414
2471
  /**
2415
2472
  * Invalidate build-time route metadata after a page or layout changes in dev.
@@ -2428,13 +2485,13 @@ var _RouteManager = class _RouteManager {
2428
2485
  const { createRouteModuleFromProgrammaticPage } = await import("./routes.cjs");
2429
2486
  return createRouteModuleFromProgrammaticPage(programmaticPage, this.rendererRuntime);
2430
2487
  }
2431
- if (_chunkUX5S4JEOcjs.isFarmMarkdownPageFile.call(void 0, modulePath)) {
2488
+ if (_chunkEFCQPQMGcjs.isFarmMarkdownPageFile.call(void 0, modulePath)) {
2432
2489
  const mdxConfig = _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, this.config.mdx);
2433
- const components = await _chunkBTAG7LI7cjs.loadFarmMdxComponents.call(void 0, mdxConfig, {
2490
+ const components = await _chunk73MC7ZL6cjs.loadFarmMdxComponents.call(void 0, mdxConfig, {
2434
2491
  root: this.config.root,
2435
2492
  loadModule: this.viteServer ? (componentModulePath) => _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, this.viteServer, componentModulePath) : void 0
2436
2493
  });
2437
- return await _chunkBTAG7LI7cjs.createFarmMarkdownRouteModuleFromFile.call(void 0, modulePath, {
2494
+ return await _chunk73MC7ZL6cjs.createFarmMarkdownRouteModuleFromFile.call(void 0, modulePath, {
2438
2495
  components,
2439
2496
  config: mdxConfig
2440
2497
  });
@@ -2484,13 +2541,7 @@ var _RouteManager = class _RouteManager {
2484
2541
  */
2485
2542
  createRoutePattern(route) {
2486
2543
  if (route.segments.length === 0) return "/";
2487
- return "/" + route.segments.map((segment) => {
2488
- if (!segment.isDynamic) return segment.segment;
2489
- if (segment.isCatchAll) {
2490
- return segment.isOptional ? `[[...${segment.segment}]]` : `[...${segment.segment}]`;
2491
- }
2492
- return `[${segment.segment}]`;
2493
- }).join("/");
2544
+ return "/" + route.segments.map(_chunkIPXLADVOcjs.formatRouteSegment).join("/");
2494
2545
  }
2495
2546
  registerPageRoute(entry) {
2496
2547
  _chunkNO3WWW3Ncjs.assertUniqueRouteParameters.call(void 0, entry.pattern);
@@ -2527,7 +2578,7 @@ var _RouteManager = class _RouteManager {
2527
2578
  appDir
2528
2579
  );
2529
2580
  const canonicalPageGroups = /* @__PURE__ */ new Map();
2530
- for (const file of pageFiles.filter((candidate) => _chunk2NQQ5H5Gcjs.parseRouteSlotFile.call(void 0, candidate) === null)) {
2581
+ for (const file of pageFiles.filter((candidate) => _chunkM7MKQXAFcjs.parseRouteSlotFile.call(void 0, candidate) === null)) {
2531
2582
  const route = _chunk5QIKR7RRcjs.parseRoutePath.call(void 0, file);
2532
2583
  const pattern = this.createRoutePattern(route);
2533
2584
  const group = canonicalPageGroups.get(pattern);
@@ -2541,8 +2592,8 @@ var _RouteManager = class _RouteManager {
2541
2592
  }
2542
2593
  }
2543
2594
  for (const [pattern, group] of canonicalPageGroups) {
2544
- const componentFiles = group.files.filter((file) => !_chunkUX5S4JEOcjs.isFarmMarkdownPageFile.call(void 0, file));
2545
- const markdownFiles = group.files.filter(_chunkUX5S4JEOcjs.isFarmMarkdownPageFile);
2595
+ const componentFiles = group.files.filter((file) => !_chunkEFCQPQMGcjs.isFarmMarkdownPageFile.call(void 0, file));
2596
+ const markdownFiles = group.files.filter(_chunkEFCQPQMGcjs.isFarmMarkdownPageFile);
2546
2597
  if (componentFiles.length > 1) {
2547
2598
  throw new Error(
2548
2599
  `Duplicate page route "${pattern}". Found ${componentFiles.map((file) => path9.default.join(appDir, file)).join(" and ")}.`
@@ -2559,7 +2610,7 @@ var _RouteManager = class _RouteManager {
2559
2610
  if (!primaryFile) continue;
2560
2611
  const modulePath = path9.default.join(appDir, primaryFile);
2561
2612
  const existing = this.routes.get(pattern);
2562
- if (_optionalChain([existing, 'optionalAccess', _127 => _127.sourceRoot]) === source.root) {
2613
+ if (_optionalChain([existing, 'optionalAccess', _128 => _128.sourceRoot]) === source.root) {
2563
2614
  throw new Error(
2564
2615
  `Duplicate page route "${pattern}". Found both ${existing.modulePath} and ${modulePath}.`
2565
2616
  );
@@ -2571,6 +2622,7 @@ var _RouteManager = class _RouteManager {
2571
2622
  markdownSourcePath: path9.default.join(appDir, markdownFile)
2572
2623
  } : {},
2573
2624
  pattern,
2625
+ ...getPageDirectoryField(group.route, pattern),
2574
2626
  source: "file",
2575
2627
  sourceRoot: source.root
2576
2628
  });
@@ -2583,9 +2635,9 @@ var _RouteManager = class _RouteManager {
2583
2635
  for (const file of files) {
2584
2636
  const route = _chunk5QIKR7RRcjs.parseRoutePath.call(void 0, file);
2585
2637
  const modulePath = path9.default.join(appDir, file);
2586
- const pattern = this.createRoutePattern(route);
2638
+ const pattern = _chunkIPXLADVOcjs.createRouteDirectoryPattern.call(void 0, route);
2587
2639
  const existing = target.get(pattern);
2588
- if (_optionalChain([existing, 'optionalAccess', _128 => _128.sourceRoot]) === source.root) {
2640
+ if (_optionalChain([existing, 'optionalAccess', _129 => _129.sourceRoot]) === source.root) {
2589
2641
  throw new Error(
2590
2642
  `Duplicate ${kind} route "${pattern}". Found both ${existing.modulePath} and ${modulePath}.`
2591
2643
  );
@@ -2600,14 +2652,15 @@ var _RouteManager = class _RouteManager {
2600
2652
  }
2601
2653
  }
2602
2654
  for (const file of [...pageFiles, ...slotDefaultFiles]) {
2603
- const slot = _chunk2NQQ5H5Gcjs.parseRouteSlotFile.call(void 0, file);
2655
+ const slot = _chunkM7MKQXAFcjs.parseRouteSlotFile.call(void 0, file);
2604
2656
  if (!slot) continue;
2605
2657
  const modulePath = path9.default.join(appDir, file);
2606
2658
  const pattern = this.createRoutePattern(slot.route);
2607
2659
  const ownerPattern = this.createRoutePattern(slot.ownerRoute);
2660
+ const ownerDirectory = _chunkIPXLADVOcjs.createRouteDirectoryPattern.call(void 0, slot.ownerRoute);
2608
2661
  const key = `${ownerPattern}:${slot.name}:${slot.interception ? "intercept" : "slot"}:${slot.fallback ? "default" : pattern}`;
2609
2662
  const existing = this.routeSlots.get(key);
2610
- if (_optionalChain([existing, 'optionalAccess', _129 => _129.sourceRoot]) === source.root) {
2663
+ if (_optionalChain([existing, 'optionalAccess', _130 => _130.sourceRoot]) === source.root) {
2611
2664
  throw new Error(
2612
2665
  `Duplicate route slot "${slot.name}" for "${pattern}". Found both ${existing.modulePath} and ${modulePath}.`
2613
2666
  );
@@ -2620,9 +2673,10 @@ var _RouteManager = class _RouteManager {
2620
2673
  sourceRoot: source.root,
2621
2674
  name: slot.name,
2622
2675
  ownerPattern,
2676
+ ...ownerDirectory === ownerPattern ? {} : { ownerDirectory },
2623
2677
  interception: slot.interception,
2624
2678
  fallback: slot.fallback,
2625
- containerId: _chunk2NQQ5H5Gcjs.createRouteSlotContainerId.call(void 0, slot.name, ownerPattern)
2679
+ containerId: _chunkM7MKQXAFcjs.createRouteSlotContainerId.call(void 0, slot.name, ownerPattern)
2626
2680
  });
2627
2681
  }
2628
2682
  for (const file of metadataImageFiles) {
@@ -2635,7 +2689,7 @@ var _RouteManager = class _RouteManager {
2635
2689
  const key = `${kind}:${pattern}`;
2636
2690
  const existing = this.metadataImages.get(key);
2637
2691
  const sourceType = isStaticMetadataImageFile(file) ? "static" : "module";
2638
- if (_optionalChain([existing, 'optionalAccess', _130 => _130.sourceRoot]) === source.root) {
2692
+ if (_optionalChain([existing, 'optionalAccess', _131 => _131.sourceRoot]) === source.root) {
2639
2693
  throw new Error(
2640
2694
  `Duplicate ${fileName} route "${pattern}". Found both ${existing.modulePath} and ${modulePath}. Keep only one static image or module per route segment.`
2641
2695
  );
@@ -2663,7 +2717,7 @@ var _RouteManager = class _RouteManager {
2663
2717
  const pattern = this.createRoutePattern(route);
2664
2718
  const key = `${descriptor.kind}:${pattern}`;
2665
2719
  const existing = this.metadataRoutes.get(key);
2666
- if (_optionalChain([existing, 'optionalAccess', _131 => _131.sourceRoot]) === source.root) {
2720
+ if (_optionalChain([existing, 'optionalAccess', _132 => _132.sourceRoot]) === source.root) {
2667
2721
  throw new Error(
2668
2722
  `Duplicate ${descriptor.fileName} route "${pattern}". Found both ${existing.modulePath} and ${modulePath}. Keep only one .ts or .js metadata route per segment.`
2669
2723
  );
@@ -2690,7 +2744,7 @@ var _RouteManager = class _RouteManager {
2690
2744
  const route = _chunk6V4TDWECcjs.parseProgrammaticRoutePath.call(void 0, definition.path, "page");
2691
2745
  const pattern = this.createRoutePattern(route);
2692
2746
  const existing = this.routes.get(pattern);
2693
- if (_optionalChain([existing, 'optionalAccess', _132 => _132.sourceRoot]) === source.root) {
2747
+ if (_optionalChain([existing, 'optionalAccess', _133 => _133.sourceRoot]) === source.root) {
2694
2748
  throw new Error(
2695
2749
  `Duplicate page route "${pattern}". Found both ${existing.modulePath} and programmatic route in ${filePath}.`
2696
2750
  );
@@ -2701,15 +2755,16 @@ var _RouteManager = class _RouteManager {
2701
2755
  route,
2702
2756
  modulePath,
2703
2757
  pattern,
2758
+ ...getPageDirectoryField(route, pattern),
2704
2759
  source: "programmatic",
2705
2760
  sourceRoot: source.root
2706
2761
  });
2707
2762
  }
2708
2763
  if (definition.kind === "layout") {
2709
2764
  const route = _chunk6V4TDWECcjs.parseProgrammaticRoutePath.call(void 0, definition.path, "layout");
2710
- const pattern = this.createRoutePattern(route);
2765
+ const pattern = _chunkIPXLADVOcjs.createRouteDirectoryPattern.call(void 0, route);
2711
2766
  const existing = this.layouts.get(pattern);
2712
- if (_optionalChain([existing, 'optionalAccess', _133 => _133.sourceRoot]) === source.root) {
2767
+ if (_optionalChain([existing, 'optionalAccess', _134 => _134.sourceRoot]) === source.root) {
2713
2768
  throw new Error(
2714
2769
  `Duplicate layout route "${pattern}". Found both ${existing.modulePath} and programmatic route in ${filePath}.`
2715
2770
  );
@@ -2738,7 +2793,7 @@ var _RouteManager = class _RouteManager {
2738
2793
  }
2739
2794
  async loadProgrammaticRoutesModule(filePath) {
2740
2795
  if (this.viteServer) {
2741
- const viteRoot = _optionalChain([this, 'access', _134 => _134.viteServer, 'access', _135 => _135.config, 'optionalAccess', _136 => _136.root]) || this.config.root || process.cwd();
2796
+ const viteRoot = _optionalChain([this, 'access', _135 => _135.viteServer, 'access', _136 => _136.config, 'optionalAccess', _137 => _137.root]) || this.config.root || process.cwd();
2742
2797
  return await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, this.viteServer, _chunk5QIKR7RRcjs.toViteModuleId.call(void 0, filePath, viteRoot));
2743
2798
  }
2744
2799
  return await import(
@@ -2747,17 +2802,26 @@ var _RouteManager = class _RouteManager {
2747
2802
  );
2748
2803
  }
2749
2804
  /**
2750
- * Find all layouts that should wrap a given path
2805
+ * Find all layouts that should wrap a given path. A layout inside a route group
2806
+ * wraps only the pages in that group, so it needs the selected page.
2751
2807
  */
2752
- findMatchingLayouts(pathname, pathnameParts = _chunk5QIKR7RRcjs.splitRoutePath.call(void 0, pathname)) {
2808
+ findMatchingLayouts(pathnameParts, route) {
2753
2809
  const matchingLayouts = [];
2754
- for (const layoutEntry of this.orderedLayouts) {
2755
- if (_chunk5QIKR7RRcjs.matchRoutePrefixParts.call(void 0, pathnameParts, layoutEntry.route.segments)) {
2756
- matchingLayouts.push(layoutEntry);
2810
+ for (const { entry, groupScope } of this.orderedLayouts) {
2811
+ if (!_chunk5QIKR7RRcjs.matchRoutePrefixParts.call(void 0, pathnameParts, entry.route.segments)) continue;
2812
+ if (groupScope !== null && !_chunkIPXLADVOcjs.isInRouteGroupScope.call(void 0, route && getRouteEntryDirectory(route), groupScope)) {
2813
+ continue;
2757
2814
  }
2815
+ matchingLayouts.push(entry);
2758
2816
  }
2759
2817
  return matchingLayouts;
2760
2818
  }
2819
+ matchPageRoute(pathnameParts) {
2820
+ for (const routeEntry of this.routes.values()) {
2821
+ if (_chunk5QIKR7RRcjs.matchRouteParts.call(void 0, pathnameParts, routeEntry.route.segments).matches) return routeEntry;
2822
+ }
2823
+ return null;
2824
+ }
2761
2825
  findMatchingRouteSlots(pathname, pathnameParts, interceptFrom) {
2762
2826
  const groups = /* @__PURE__ */ new Map();
2763
2827
  for (const entry of this.routeSlots.values()) {
@@ -2787,6 +2851,7 @@ var _RouteManager = class _RouteManager {
2787
2851
  matches.push({
2788
2852
  name: selected.entry.name,
2789
2853
  ownerPattern: selected.entry.ownerPattern,
2854
+ ...selected.entry.ownerDirectory ? { ownerDirectory: selected.entry.ownerDirectory } : {},
2790
2855
  containerId: selected.entry.containerId,
2791
2856
  interception: selected.entry.interception,
2792
2857
  fallback: false,
@@ -2800,6 +2865,7 @@ var _RouteManager = class _RouteManager {
2800
2865
  matches.push({
2801
2866
  name: fallback.name,
2802
2867
  ownerPattern: fallback.ownerPattern,
2868
+ ...fallback.ownerDirectory ? { ownerDirectory: fallback.ownerDirectory } : {},
2803
2869
  containerId: fallback.containerId,
2804
2870
  interception: false,
2805
2871
  fallback: true,
@@ -2818,12 +2884,20 @@ var _RouteManager = class _RouteManager {
2818
2884
  const patternSegments = _nullishCoalesce(this.routeSlotOwnerSegments.get(pattern), () => ( _chunk5QIKR7RRcjs.parseRoutePath.call(void 0, `${pattern}/page.tsx`).segments));
2819
2885
  return _chunk5QIKR7RRcjs.matchRoutePrefixParts.call(void 0, pathnameParts, patternSegments);
2820
2886
  }
2821
- findNearestBoundary(pathname, boundaries) {
2887
+ findNearestBoundary(pathname, boundaries, route) {
2822
2888
  const normalizedPath = pathname === "/" ? "/" : pathname.replace(/\/$/, "");
2823
2889
  let bestMatch = null;
2890
+ let page = route;
2824
2891
  for (const boundaryEntry of boundaries.values()) {
2825
2892
  if (!_chunk5QIKR7RRcjs.matchRoutePrefix.call(void 0, normalizedPath, boundaryEntry.route.segments)) continue;
2826
- if (!bestMatch || boundaryEntry.route.segments.length > bestMatch.route.segments.length) {
2893
+ const groupScope = _chunkIPXLADVOcjs.getRouteGroupScope.call(void 0, boundaryEntry.pattern);
2894
+ if (groupScope !== null) {
2895
+ if (page === void 0) page = this.matchPageRoute(_chunk5QIKR7RRcjs.splitRoutePath.call(void 0, normalizedPath));
2896
+ if (!_chunkIPXLADVOcjs.isInRouteGroupScope.call(void 0, page && getRouteEntryDirectory(page), groupScope)) continue;
2897
+ }
2898
+ const depth = boundaryEntry.route.segments.length;
2899
+ const bestDepth = _nullishCoalesce(_optionalChain([bestMatch, 'optionalAccess', _138 => _138.route, 'access', _139 => _139.segments, 'access', _140 => _140.length]), () => ( -1));
2900
+ if (!bestMatch || depth > bestDepth || depth === bestDepth && _chunkIPXLADVOcjs.getRouteDirectoryDepth.call(void 0, boundaryEntry.pattern) > _chunkIPXLADVOcjs.getRouteDirectoryDepth.call(void 0, bestMatch.pattern)) {
2827
2901
  bestMatch = boundaryEntry;
2828
2902
  }
2829
2903
  }
@@ -2860,7 +2934,7 @@ var _RouteManager = class _RouteManager {
2860
2934
  pattern: entry.pattern
2861
2935
  }));
2862
2936
  const i18n = this.getI18nConfig();
2863
- const result = await _chunkQJ3J6MZTcjs.collectSSGPages.call(void 0, routes, (filePath) => this.loadRouteModule(filePath), {
2937
+ const result = await _chunk3BHT4WMPcjs.collectSSGPages.call(void 0, routes, (filePath) => this.loadRouteModule(filePath), {
2864
2938
  suggestStaticRendering: shouldSuggestStaticRenderingForI18n(i18n)
2865
2939
  });
2866
2940
  if (!i18n) {
@@ -2905,7 +2979,7 @@ var _RouteManager = class _RouteManager {
2905
2979
  async isRouteSSG(modulePath) {
2906
2980
  try {
2907
2981
  const mod = await this.loadRouteModule(modulePath);
2908
- const rendering = await _chunkQJ3J6MZTcjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
2982
+ const rendering = await _chunk3BHT4WMPcjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
2909
2983
  return rendering.ssg;
2910
2984
  } catch (e10) {
2911
2985
  return false;
@@ -2917,7 +2991,7 @@ var _RouteManager = class _RouteManager {
2917
2991
  async hasRouteISR(modulePath) {
2918
2992
  try {
2919
2993
  const mod = await this.loadRouteModule(modulePath);
2920
- const rendering = await _chunkQJ3J6MZTcjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
2994
+ const rendering = await _chunk3BHT4WMPcjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
2921
2995
  return rendering.ssg && typeof rendering.revalidate === "number" && rendering.revalidate > 0;
2922
2996
  } catch (e11) {
2923
2997
  return false;
@@ -2929,7 +3003,7 @@ var _RouteManager = class _RouteManager {
2929
3003
  async getRouteRevalidateInterval(modulePath) {
2930
3004
  try {
2931
3005
  const mod = await this.loadRouteModule(modulePath);
2932
- const rendering = await _chunkQJ3J6MZTcjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
3006
+ const rendering = await _chunk3BHT4WMPcjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
2933
3007
  return rendering.revalidate;
2934
3008
  } catch (e12) {
2935
3009
  return void 0;
@@ -2938,6 +3012,11 @@ var _RouteManager = class _RouteManager {
2938
3012
  };
2939
3013
  _chunkS3JO3N4Hcjs.__name.call(void 0, _RouteManager, "RouteManager");
2940
3014
  var RouteManager = _RouteManager;
3015
+ function getPageDirectoryField(route, pattern) {
3016
+ const directory = _chunkIPXLADVOcjs.createRouteDirectoryPattern.call(void 0, route);
3017
+ return directory === pattern ? {} : { directory };
3018
+ }
3019
+ _chunkS3JO3N4Hcjs.__name.call(void 0, getPageDirectoryField, "getPageDirectoryField");
2941
3020
  function interpolateRedirectDestination(destination, params) {
2942
3021
  let result = destination;
2943
3022
  for (const [key, value] of Object.entries(params)) {
@@ -3055,112 +3134,6 @@ function collectDevStylesheetUrls(modules, alreadyLinked = ALREADY_LINKED) {
3055
3134
  }
3056
3135
  _chunkS3JO3N4Hcjs.__name.call(void 0, collectDevStylesheetUrls, "collectDevStylesheetUrls");
3057
3136
 
3058
- // src/server/full-document.ts
3059
- var CONTENTS_WRAPPER = /^<div\b[^>]*style="display\s*:\s*contents"[^>]*>/i;
3060
- var HOISTED_HEAD_ELEMENT = /^(?:<(?:meta|link|base)\b[^>]*>|<title\b[^>]*>[\s\S]*?<\/title>|<script\b[^>]*\basync\b[^>]*><\/script>|<style\b[^>]*\bdata-precedence\b[^>]*>[\s\S]*?<\/style>)/i;
3061
- function peelDocumentPrefix(markup) {
3062
- let inner = markup.replace(/^\s+/, "");
3063
- let hoisted = "";
3064
- let match;
3065
- while (match = _nullishCoalesce(CONTENTS_WRAPPER.exec(inner), () => ( HOISTED_HEAD_ELEMENT.exec(inner)))) {
3066
- if (!/^<div/i.test(match[0])) hoisted += match[0];
3067
- inner = inner.slice(match[0].length).replace(/^\s+/, "");
3068
- }
3069
- return { inner, hoisted };
3070
- }
3071
- _chunkS3JO3N4Hcjs.__name.call(void 0, peelDocumentPrefix, "peelDocumentPrefix");
3072
- function restoreHoistedHead(document, hoisted) {
3073
- if (!hoisted) return document;
3074
- if (/<head[\s>]/i.test(document)) {
3075
- return document.replace(/<head\b[^>]*>/i, (open) => open + hoisted);
3076
- }
3077
- return document.replace(/<html\b[^>]*>/i, (open) => `${open}<head>${hoisted}</head>`);
3078
- }
3079
- _chunkS3JO3N4Hcjs.__name.call(void 0, restoreHoistedHead, "restoreHoistedHead");
3080
- function extractFarmFullDocument(markup) {
3081
- const { inner, hoisted } = peelDocumentPrefix(markup);
3082
- if (!/^<!doctype/i.test(inner) && !/^<html[\s>]/i.test(inner)) return null;
3083
- const start = markup.search(/<!doctype|<html[\s>]/i);
3084
- const lower = markup.toLowerCase();
3085
- let closeIndex = lower.lastIndexOf("</html>");
3086
- if (lower.length !== markup.length) {
3087
- closeIndex = -1;
3088
- const closing = /<\/html>/gi;
3089
- let match;
3090
- while (match = closing.exec(markup)) closeIndex = match.index;
3091
- }
3092
- if (start < 0 || closeIndex < 0) return null;
3093
- const closeEnd = closeIndex + "</html>".length;
3094
- let document = markup.slice(start, closeEnd);
3095
- const streamedTail = markup.slice(closeEnd).replace(/^(?:\s*<\/div>)+/i, "").trim();
3096
- if (streamedTail) {
3097
- document = document.replace(/<\/body>/i, () => `${streamedTail}</body>`);
3098
- }
3099
- return restoreHoistedHead(document, hoisted);
3100
- }
3101
- _chunkS3JO3N4Hcjs.__name.call(void 0, extractFarmFullDocument, "extractFarmFullDocument");
3102
- function classifyFarmDocumentPrefix(markup) {
3103
- const { inner } = peelDocumentPrefix(markup);
3104
- if (/^<!doctype/i.test(inner) || /^<html[\s>]/i.test(inner)) return "document";
3105
- return inner === "" ? "pending" : "fragment";
3106
- }
3107
- _chunkS3JO3N4Hcjs.__name.call(void 0, classifyFarmDocumentPrefix, "classifyFarmDocumentPrefix");
3108
- function ensureFarmDocumentHead(markup) {
3109
- if (/<head[\s>]/i.test(markup)) return markup;
3110
- return markup.replace(/<html([^>]*)>/i, (_match, attributes) => {
3111
- return `<html${attributes}><head></head>`;
3112
- });
3113
- }
3114
- _chunkS3JO3N4Hcjs.__name.call(void 0, ensureFarmDocumentHead, "ensureFarmDocumentHead");
3115
- function ensureFarmDocumentRoot(markup) {
3116
- if (/\sid=["']root["']/i.test(markup)) return markup;
3117
- return markup.replace(
3118
- /<body\b([^>]*)>/i,
3119
- (_match, attributes) => `<body${attributes}><div id="root">`
3120
- ).replace(/<\/body>/i, () => "</div></body>");
3121
- }
3122
- _chunkS3JO3N4Hcjs.__name.call(void 0, ensureFarmDocumentRoot, "ensureFarmDocumentRoot");
3123
- function hasFarmDocumentIcon(markup) {
3124
- return /<link\b[^>]*\brel=["']?(?:shortcut )?icon\b/i.test(markup);
3125
- }
3126
- _chunkS3JO3N4Hcjs.__name.call(void 0, hasFarmDocumentIcon, "hasFarmDocumentIcon");
3127
- function removeFarmDocumentTitles(markup) {
3128
- return markup.replace(/<title\b[^>]*>[\s\S]*?<\/title>\s*/gi, "");
3129
- }
3130
- _chunkS3JO3N4Hcjs.__name.call(void 0, removeFarmDocumentTitles, "removeFarmDocumentTitles");
3131
- function composeFarmFullDocument(documentHtml, assets) {
3132
- let html = ensureFarmDocumentHead(documentHtml);
3133
- if (assets.htmlAttributes) {
3134
- html = html.replace(/<html\b([^>]*)>/i, (_match, attrs) => {
3135
- let nextAttributes = attrs;
3136
- for (const name of _nullishCoalesce(assets.replaceHtmlAttributes, () => ( []))) {
3137
- const escapedName = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3138
- nextAttributes = nextAttributes.replace(
3139
- new RegExp("\\s+" + escapedName + `=(?:"[^"]*"|'[^']*'|[^\\s>]+)`, "gi"),
3140
- ""
3141
- );
3142
- }
3143
- return `<html${nextAttributes}${assets.htmlAttributes}>`;
3144
- });
3145
- }
3146
- html = ensureFarmDocumentRoot(html);
3147
- const headAssets = [
3148
- assets.fallbackIcon && !hasFarmDocumentIcon(html) ? '<link rel="icon" href="data:,">' : "",
3149
- assets.headAssets
3150
- ].filter(Boolean).join("\n ");
3151
- if (headAssets) {
3152
- html = html.replace(/<\/head>/i, () => ` ${headAssets}
3153
- </head>`);
3154
- }
3155
- if (assets.bodyFooter) {
3156
- html = html.replace(/<\/body>/i, () => ` ${assets.bodyFooter}
3157
- </body>`);
3158
- }
3159
- return /^\s*<!doctype/i.test(html) ? html : `<!DOCTYPE html>
3160
- ${html}`;
3161
- }
3162
- _chunkS3JO3N4Hcjs.__name.call(void 0, composeFarmFullDocument, "composeFarmFullDocument");
3163
-
3164
3137
  // src/server/renderer.ts
3165
3138
  var _stream = require('stream');
3166
3139
 
@@ -3169,7 +3142,7 @@ var _stream = require('stream');
3169
3142
 
3170
3143
  function resolveFarmNotFoundComponentPath(config, appDirs) {
3171
3144
  const extensions = _chunkPSV6XKPOcjs.getFarmRendererComponentExtensions.call(void 0, config.renderer);
3172
- const configuredPath = _optionalChain([config, 'access', _137 => _137.notFound, 'optionalAccess', _138 => _138.component, 'optionalAccess', _139 => _139.trim, 'call', _140 => _140()]);
3145
+ const configuredPath = _optionalChain([config, 'access', _141 => _141.notFound, 'optionalAccess', _142 => _142.component, 'optionalAccess', _143 => _143.trim, 'call', _144 => _144()]);
3173
3146
  if (configuredPath) {
3174
3147
  const componentPath = path9.default.isAbsolute(configuredPath) ? path9.default.normalize(configuredPath) : path9.default.resolve(config.root, configuredPath);
3175
3148
  if (!extensions.some((extension) => componentPath.endsWith(extension))) {
@@ -3256,7 +3229,7 @@ function farmFontImportsPlugin(options = {}) {
3256
3229
  return;
3257
3230
  }
3258
3231
  const resource = registry.getDevResource(pathname);
3259
- if (!_optionalChain([resource, 'optionalAccess', _141 => _141.bytes])) {
3232
+ if (!_optionalChain([resource, 'optionalAccess', _145 => _145.bytes])) {
3260
3233
  next();
3261
3234
  return;
3262
3235
  }
@@ -3784,7 +3757,7 @@ function readFontOptions(code, id, call) {
3784
3757
  const declaration = call.ancestors.at(-2);
3785
3758
  const statement = call.ancestors.at(-3);
3786
3759
  const statementParent = call.ancestors.at(-4);
3787
- const isModuleScope = _optionalChain([declaration, 'optionalAccess', _142 => _142.type]) === "VariableDeclaration" && (_optionalChain([statement, 'optionalAccess', _143 => _143.type]) === "Program" || _optionalChain([statement, 'optionalAccess', _144 => _144.type]) === "ExportNamedDeclaration" && _optionalChain([statementParent, 'optionalAccess', _145 => _145.type]) === "Program");
3760
+ const isModuleScope = _optionalChain([declaration, 'optionalAccess', _146 => _146.type]) === "VariableDeclaration" && (_optionalChain([statement, 'optionalAccess', _147 => _147.type]) === "Program" || _optionalChain([statement, 'optionalAccess', _148 => _148.type]) === "ExportNamedDeclaration" && _optionalChain([statementParent, 'optionalAccess', _149 => _149.type]) === "Program");
3788
3761
  if (!isModuleScope || call.ancestors.some((ancestor) => isFunctionNode(ancestor))) {
3789
3762
  throw fontError(id, `${call.kind}() must be declared directly at module scope`);
3790
3763
  }
@@ -4420,7 +4393,7 @@ function generateFarmIntegrationProviderClientCode(providers, root, rendererComp
4420
4393
  let hasClerkProvider = false;
4421
4394
  renderedProviders.forEach((provider, index) => {
4422
4395
  let componentExpression = "null";
4423
- if (_chunkTDFPACVXcjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) {
4396
+ if (_chunkFTFYRMQQcjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) {
4424
4397
  const namespace = `FarmIntegrationProviderModule${index}`;
4425
4398
  imports.push(
4426
4399
  `import * as ${namespace} from ${JSON.stringify(resolveProviderModule(provider.component.module, root))};`
@@ -4479,7 +4452,7 @@ function generateFarmIntegrationProviderServerModules(providers, root, rendererC
4479
4452
  const entries = [];
4480
4453
  let needsMarkHelper = false;
4481
4454
  providers.forEach((provider, index) => {
4482
- if (!_chunkTDFPACVXcjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) return;
4455
+ if (!_chunkFTFYRMQQcjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) return;
4483
4456
  const namespace = `FarmServerIntegrationProviderModule${index}`;
4484
4457
  imports.push(
4485
4458
  `import * as ${namespace} from ${JSON.stringify(resolveProviderModule(provider.component.module, root))};`
@@ -4701,7 +4674,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, appendResponseVary, "appendResponseVary");
4701
4674
  function renderI18nAlternateLinks(requestPath, snapshot, options) {
4702
4675
  if (snapshot.routing === "none") return "";
4703
4676
  const url = new URL(requestPath, "http://farm.local");
4704
- return _chunkP64MIF5Bcjs.renderFarmLocaleAlternateLinks.call(void 0, url.pathname, snapshot, options);
4677
+ return _chunkIPXLADVOcjs.renderFarmLocaleAlternateLinks.call(void 0, url.pathname, snapshot, options);
4705
4678
  }
4706
4679
  _chunkS3JO3N4Hcjs.__name.call(void 0, renderI18nAlternateLinks, "renderI18nAlternateLinks");
4707
4680
  var PPR_REFRESH_MAX_ATTEMPTS = 3;
@@ -4795,12 +4768,12 @@ async function parseRouteModuleProps(routeModule, input) {
4795
4768
  }
4796
4769
  const schemas = routeModule.__farmRouteSchemas;
4797
4770
  const params = parseRouteModuleSchema(
4798
- _optionalChain([schemas, 'optionalAccess', _146 => _146.params]),
4771
+ _optionalChain([schemas, 'optionalAccess', _150 => _150.params]),
4799
4772
  input.props.params,
4800
4773
  "params",
4801
4774
  input.routePath
4802
4775
  );
4803
- const search = parseRouteModuleSchema(_optionalChain([schemas, 'optionalAccess', _147 => _147.search]), input.search, "search", input.routePath);
4776
+ const search = parseRouteModuleSchema(_optionalChain([schemas, 'optionalAccess', _151 => _151.search]), input.search, "search", input.routePath);
4804
4777
  return {
4805
4778
  ...input.props,
4806
4779
  params,
@@ -4840,12 +4813,12 @@ var _ServerRenderer = class _ServerRenderer {
4840
4813
  this.routeManager = routeManager;
4841
4814
  this.i18nRuntime = i18nRuntime;
4842
4815
  this.viteServer = viteServer;
4843
- this.security = _chunkZHPHJPQPcjs.resolveFarmSecurityConfig.call(void 0, config.security);
4816
+ this.security = _chunkRU3M2FIKcjs.resolveFarmSecurityConfig.call(void 0, config.security);
4844
4817
  this.loadSSGManifest();
4845
4818
  }
4846
4819
  async initialize() {
4847
4820
  if (this.rendererRuntime) return;
4848
- if (_optionalChain([this, 'access', _148 => _148.config, 'access', _149 => _149.notFound, 'optionalAccess', _150 => _150.component, 'optionalAccess', _151 => _151.trim, 'call', _152 => _152()])) {
4821
+ if (_optionalChain([this, 'access', _152 => _152.config, 'access', _153 => _153.notFound, 'optionalAccess', _154 => _154.component, 'optionalAccess', _155 => _155.trim, 'call', _156 => _156()])) {
4849
4822
  resolveFarmNotFoundComponentPath(this.config, _chunkVPTDD5XFcjs.getFarmAppDirectories.call(void 0, this.config));
4850
4823
  }
4851
4824
  const loaded = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, this.config.renderer) ? await import("./renderer/react/server.cjs") : this.viteServer ? await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, this.viteServer, this.config.renderer.server) : await import(_url.pathToFileURL.call(void 0,
@@ -4870,7 +4843,7 @@ var _ServerRenderer = class _ServerRenderer {
4870
4843
  "node"
4871
4844
  );
4872
4845
  this.rendererRuntime = runtime;
4873
- _optionalChain([this, 'access', _153 => _153.routeManager, 'access', _154 => _154.setRendererRuntime, 'optionalCall', _155 => _155(this.rendererRuntime)]);
4846
+ _optionalChain([this, 'access', _157 => _157.routeManager, 'access', _158 => _158.setRendererRuntime, 'optionalCall', _159 => _159(this.rendererRuntime)]);
4874
4847
  await this.applyRendererAppSetup();
4875
4848
  }
4876
4849
  /**
@@ -4927,7 +4900,7 @@ var _ServerRenderer = class _ServerRenderer {
4927
4900
  /// Stylesheets the app imported through JS (fontsource packages, component
4928
4901
  /// CSS) that the document must link alongside globals.css — see #658.
4929
4902
  collectDevStyleHrefs() {
4930
- const graph = _optionalChain([this, 'access', _156 => _156.viteServer, 'optionalAccess', _157 => _157.moduleGraph]);
4903
+ const graph = _optionalChain([this, 'access', _160 => _160.viteServer, 'optionalAccess', _161 => _161.moduleGraph]);
4931
4904
  if (!graph) return [];
4932
4905
  return collectDevStylesheetUrls(
4933
4906
  graph.idToModuleMap.values(),
@@ -5029,7 +5002,7 @@ var _ServerRenderer = class _ServerRenderer {
5029
5002
  if (input.pageShouldHydrate && !input.layoutShouldHydrate) {
5030
5003
  element = this.wrapClientGraph(element);
5031
5004
  } else if (input.layoutShouldHydrate && !input.pageShouldHydrate && this.rendererRuntime.isolateServerPageGraph) {
5032
- element = this.rendererRuntime.isolateServerPageGraph(element);
5005
+ element = input.serverTree && this.rendererRuntime.renderServerTreePage ? await this.rendererRuntime.renderServerTreePage(element) : this.rendererRuntime.isolateServerPageGraph(element);
5033
5006
  }
5034
5007
  element = this.createPageBoundary(element, {
5035
5008
  pageShouldHydrate: input.pageShouldHydrate,
@@ -5046,7 +5019,9 @@ var _ServerRenderer = class _ServerRenderer {
5046
5019
  if (!LayoutComponent) continue;
5047
5020
  const slotProps = {};
5048
5021
  for (const slot of input.slots || []) {
5049
- if (slot.ownerPattern !== layout.pattern || !slot.module.default) continue;
5022
+ if ((_nullishCoalesce(slot.ownerDirectory, () => ( slot.ownerPattern))) !== layout.pattern || !slot.module.default) {
5023
+ continue;
5024
+ }
5050
5025
  let slotElement = this.rendererRuntime.createElement(slot.module.default, slot.props);
5051
5026
  slotElement = this.wrapClientGraph(slotElement);
5052
5027
  slotProps[slot.name] = this.rendererRuntime.createElement(
@@ -5074,7 +5049,7 @@ var _ServerRenderer = class _ServerRenderer {
5074
5049
  async runWithRequestContext(request2, fn) {
5075
5050
  return _chunkUXFQ3UDAcjs._runWithCurrentRequest.call(void 0,
5076
5051
  request2,
5077
- () => _optionalChain([this, 'access', _158 => _158.i18nRuntime, 'optionalAccess', _159 => _159.config, 'access', _160 => _160.enabled]) ? _chunkXJXBIP67cjs._runWithFarmI18nRequest.call(void 0, this.i18nRuntime, request2, fn, {
5052
+ () => _optionalChain([this, 'access', _162 => _162.i18nRuntime, 'optionalAccess', _163 => _163.config, 'access', _164 => _164.enabled]) ? _chunkXJXBIP67cjs._runWithFarmI18nRequest.call(void 0, this.i18nRuntime, request2, fn, {
5078
5053
  redirect: false
5079
5054
  }) : fn()
5080
5055
  );
@@ -5105,7 +5080,7 @@ var _ServerRenderer = class _ServerRenderer {
5105
5080
  * Check if a path should be served from SSG cache
5106
5081
  */
5107
5082
  async shouldServeSSG(pathname) {
5108
- const ssgPage = _chunkQJ3J6MZTcjs.matchSSGPage.call(void 0, pathname, this.ssgManifest);
5083
+ const ssgPage = _chunk3BHT4WMPcjs.matchSSGPage.call(void 0, pathname, this.ssgManifest);
5109
5084
  if (!ssgPage) return null;
5110
5085
  const cached = await this.getCachedSSGPage(pathname);
5111
5086
  if (cached && await this.dataCache.isStaleAsync(cached)) {
@@ -5222,7 +5197,7 @@ var _ServerRenderer = class _ServerRenderer {
5222
5197
  setImmediate(async () => {
5223
5198
  try {
5224
5199
  const mod = await this.routeManager.loadRouteModule(page.filePath);
5225
- if (!_optionalChain([mod, 'optionalAccess', _161 => _161.default])) return;
5200
+ if (!_optionalChain([mod, 'optionalAccess', _165 => _165.default])) return;
5226
5201
  const { route, layouts } = this.routeManager.matchRoute(page.urlPath);
5227
5202
  const layoutModules = await Promise.all(
5228
5203
  layouts.map((l) => this.routeManager.loadLayoutModule(l.modulePath))
@@ -5236,7 +5211,7 @@ var _ServerRenderer = class _ServerRenderer {
5236
5211
  };
5237
5212
  let pageElement = this.rendererRuntime.createElement(PageComponent, pageProps);
5238
5213
  const pageMetadata = _nullishCoalesce(routeManifest.routes.find(
5239
- (entry) => entry.pattern === _optionalChain([route, 'optionalAccess', _162 => _162.pattern])
5214
+ (entry) => entry.pattern === _optionalChain([route, 'optionalAccess', _166 => _166.pattern])
5240
5215
  ), () => ( {
5241
5216
  shouldHydrate: false,
5242
5217
  islandStrategy: null
@@ -5271,7 +5246,7 @@ var _ServerRenderer = class _ServerRenderer {
5271
5246
  pageProps,
5272
5247
  pathname: page.urlPath
5273
5248
  });
5274
- const { title, tags, hasFavicon } = _chunk3LUF2PE2cjs.renderMetadataHead.call(void 0, mergedMetadata);
5249
+ const { title, tags, hasFavicon } = _chunkEK4QAEFZcjs.renderMetadataHead.call(void 0, mergedMetadata);
5275
5250
  const metadataHead = `${hasFavicon ? "" : '<link rel="icon" href="data:,">\n '}<title>${title}</title>${tags}`;
5276
5251
  const fullDocument = this.createFullHTML(
5277
5252
  html,
@@ -5339,17 +5314,17 @@ var _ServerRenderer = class _ServerRenderer {
5339
5314
  if (this.viteServer) await this.applyRendererAppSetup();
5340
5315
  _chunkI57LW5VZcjs.setFarmBasePath.call(void 0, this.config.basePath);
5341
5316
  _chunkOYEUREB6cjs.setFarmTrailingSlashPreference.call(void 0, this.config.trailingSlash);
5342
- const cspNonce = _chunkZHPHJPQPcjs.createFarmCspNonce.call(void 0, this.security);
5317
+ const cspNonce = _chunkRU3M2FIKcjs.createFarmCspNonce.call(void 0, this.security);
5343
5318
  if (cspNonce) {
5344
5319
  req.__FARM_CSP_NONCE__ = cspNonce;
5345
- const header = _chunkZHPHJPQPcjs.getFarmSecurityHeader.call(void 0, this.security, cspNonce);
5320
+ const header = _chunkRU3M2FIKcjs.getFarmSecurityHeader.call(void 0, this.security, cspNonce);
5346
5321
  res.setHeader(header.key, header.value);
5347
5322
  }
5348
5323
  const request2 = _chunkUXFQ3UDAcjs.createWebRequestFromFarmRequest.call(void 0, req, {
5349
- trustProxy: _optionalChain([this, 'access', _163 => _163.config, 'access', _164 => _164.server, 'optionalAccess', _165 => _165.trustProxy])
5324
+ trustProxy: _optionalChain([this, 'access', _167 => _167.config, 'access', _168 => _168.server, 'optionalAccess', _169 => _169.trustProxy])
5350
5325
  });
5351
5326
  const runtime = this.i18nRuntime;
5352
- if (_optionalChain([runtime, 'optionalAccess', _166 => _166.config, 'access', _167 => _167.enabled])) {
5327
+ if (_optionalChain([runtime, 'optionalAccess', _170 => _170.config, 'access', _171 => _171.enabled])) {
5353
5328
  const resolution = runtime.resolveRequest(request2);
5354
5329
  const varyHeaders = _chunkQCVE2OCIcjs.getFarmLocaleVaryHeaders.call(void 0, runtime.config, resolution);
5355
5330
  for (const header of varyHeaders) appendResponseVary(res, header);
@@ -5392,7 +5367,7 @@ var _ServerRenderer = class _ServerRenderer {
5392
5367
  });
5393
5368
  }, "completeRender");
5394
5369
  try {
5395
- const url = _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _168 => _168.config, 'access', _169 => _169.server, 'optionalAccess', _170 => _170.trustProxy]) });
5370
+ const url = _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _172 => _172.config, 'access', _173 => _173.server, 'optionalAccess', _174 => _174.trustProxy]) });
5396
5371
  pathname = url.pathname;
5397
5372
  _chunkE3UK5IIBcjs.emitFarmEvent.call(void 0, { type: "render.start", route: pathname, pathname });
5398
5373
  searchParamsObject = _chunkQNPEUFHQcjs.searchParamsToObject.call(void 0, url.searchParams);
@@ -5461,15 +5436,15 @@ var _ServerRenderer = class _ServerRenderer {
5461
5436
  route: route.pattern,
5462
5437
  params
5463
5438
  });
5464
- const loadingBoundaryEntry = this.routeManager.getMatchingLoading(pathname);
5465
- errorBoundaryEntry = this.routeManager.getMatchingError(pathname);
5439
+ const loadingBoundaryEntry = this.routeManager.getMatchingLoading(pathname, route);
5440
+ errorBoundaryEntry = this.routeManager.getMatchingError(pathname, route);
5466
5441
  middlewareMap = toMiddlewareMap(req.__FARM_MIDDLEWARE_DATA__);
5467
5442
  middlewareContext = toMiddlewareMap(req.__FARM_MIDDLEWARE_CONTEXT__);
5468
- pluginExposedContext = _chunkEM6SBQKMcjs.getRequestContextSnapshot.call(void 0, req, {
5443
+ pluginExposedContext = _chunkOMVAU7NTcjs.getRequestContextSnapshot.call(void 0, req, {
5469
5444
  exposedOnly: true
5470
5445
  });
5471
5446
  const currentRequest = _chunkUXFQ3UDAcjs.createWebRequestFromFarmRequest.call(void 0, req, {
5472
- trustProxy: _optionalChain([this, 'access', _171 => _171.config, 'access', _172 => _172.server, 'optionalAccess', _173 => _173.trustProxy])
5447
+ trustProxy: _optionalChain([this, 'access', _175 => _175.config, 'access', _176 => _176.server, 'optionalAccess', _177 => _177.trustProxy])
5473
5448
  });
5474
5449
  const routeContext = await this.resolveRouteContext({
5475
5450
  request: currentRequest,
@@ -5511,11 +5486,11 @@ var _ServerRenderer = class _ServerRenderer {
5511
5486
  searchParams: Promise.resolve(searchParamsObject),
5512
5487
  error
5513
5488
  };
5514
- if (_chunkOX6O6WVAcjs.isFarmNotFoundError.call(void 0, error) && _optionalChain([programmaticRouteComponents, 'optionalAccess', _174 => _174.notFound])) {
5489
+ if (_chunkOX6O6WVAcjs.isFarmNotFoundError.call(void 0, error) && _optionalChain([programmaticRouteComponents, 'optionalAccess', _178 => _178.notFound])) {
5515
5490
  res.statusCode = 404;
5516
5491
  PageComponent = programmaticRouteComponents.notFound;
5517
5492
  pageProps = routeStateProps;
5518
- } else if (_optionalChain([programmaticRouteComponents, 'optionalAccess', _175 => _175.error])) {
5493
+ } else if (_optionalChain([programmaticRouteComponents, 'optionalAccess', _179 => _179.error])) {
5519
5494
  res.statusCode = 500;
5520
5495
  PageComponent = programmaticRouteComponents.error;
5521
5496
  pageProps = routeStateProps;
@@ -5523,10 +5498,10 @@ var _ServerRenderer = class _ServerRenderer {
5523
5498
  throw error;
5524
5499
  }
5525
5500
  }
5526
- const renderingConfig = await _chunkQJ3J6MZTcjs.resolveRouteRenderingConfigFromFile.call(void 0,
5501
+ const renderingConfig = await _chunk3BHT4WMPcjs.resolveRouteRenderingConfigFromFile.call(void 0,
5527
5502
  routeModule,
5528
5503
  route.modulePath,
5529
- { experimentalPPR: _optionalChain([this, 'access', _176 => _176.config, 'access', _177 => _177.experimental, 'optionalAccess', _178 => _178.ppr]) === true }
5504
+ { experimentalPPR: _optionalChain([this, 'access', _180 => _180.config, 'access', _181 => _181.experimental, 'optionalAccess', _182 => _182.ppr]) === true }
5530
5505
  );
5531
5506
  const pprBypassReason = renderingConfig.ppr ? this.getPPRShellBypassReason(req, middlewareMap, middlewareContext, pluginExposedContext) : void 0;
5532
5507
  const canCachePPRShell = renderingConfig.ppr && !pprBypassReason;
@@ -5534,7 +5509,7 @@ var _ServerRenderer = class _ServerRenderer {
5534
5509
  const pprShellOptions = canCachePPRShell ? {
5535
5510
  pathname,
5536
5511
  search: url.search,
5537
- locale: _nullishCoalesce(_optionalChain([pprI18nSnapshot, 'optionalAccess', _179 => _179.locale]), () => ( "")),
5512
+ locale: _nullishCoalesce(_optionalChain([pprI18nSnapshot, 'optionalAccess', _183 => _183.locale]), () => ( "")),
5538
5513
  origin: pprI18nSnapshot && pprI18nSnapshot.routing !== "none" ? url.origin : "",
5539
5514
  revalidate: renderingConfig.revalidate
5540
5515
  } : void 0;
@@ -5657,20 +5632,20 @@ var _ServerRenderer = class _ServerRenderer {
5657
5632
  if (moduleMetadata.suppressedAsyncHydration) {
5658
5633
  warnSuppressedAsyncHydrationOnce(
5659
5634
  route.modulePath,
5660
- _optionalChain([routeManifestEntry, 'optionalAccess', _180 => _180.suppressedAsyncHydrationReason])
5635
+ _optionalChain([routeManifestEntry, 'optionalAccess', _184 => _184.suppressedAsyncHydrationReason])
5661
5636
  );
5662
5637
  }
5663
5638
  const layoutHydrationMetadata = layouts.map((layout) => {
5664
5639
  const manifestEntry = routeManifest.layouts.find(
5665
5640
  (entry) => entry.pattern === layout.pattern
5666
5641
  );
5667
- if (_optionalChain([manifestEntry, 'optionalAccess', _181 => _181.suppressedAsyncHydration])) {
5642
+ if (_optionalChain([manifestEntry, 'optionalAccess', _185 => _185.suppressedAsyncHydration])) {
5668
5643
  warnSuppressedAsyncHydrationOnce(
5669
5644
  layout.modulePath,
5670
5645
  manifestEntry.suppressedAsyncHydrationReason
5671
5646
  );
5672
5647
  }
5673
- if (typeof _optionalChain([manifestEntry, 'optionalAccess', _182 => _182.shouldHydrate]) === "boolean") {
5648
+ if (typeof _optionalChain([manifestEntry, 'optionalAccess', _186 => _186.shouldHydrate]) === "boolean") {
5674
5649
  return {
5675
5650
  isClientComponent: manifestEntry.isClientComponent === true,
5676
5651
  shouldHydrate: manifestEntry.shouldHydrate,
@@ -5690,9 +5665,9 @@ var _ServerRenderer = class _ServerRenderer {
5690
5665
  const clientLayouts = layouts.map((layout, index) => ({
5691
5666
  pattern: layout.pattern,
5692
5667
  modulePath: _chunk5QIKR7RRcjs.toViteModuleId.call(void 0, layout.modulePath, this.config.root),
5693
- shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access', _183 => _183[index], 'optionalAccess', _184 => _184.shouldHydrate]) === true,
5694
- islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access', _185 => _185[index], 'optionalAccess', _186 => _186.islandStrategy]), () => ( null)),
5695
- ..._optionalChain([layoutHydrationMetadata, 'access', _187 => _187[index], 'optionalAccess', _188 => _188.hasIsolatedClientBoundaries]) === true ? { hasIsolatedClientBoundaries: true } : {}
5668
+ shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access', _187 => _187[index], 'optionalAccess', _188 => _188.shouldHydrate]) === true,
5669
+ islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access', _189 => _189[index], 'optionalAccess', _190 => _190.islandStrategy]), () => ( null)),
5670
+ ..._optionalChain([layoutHydrationMetadata, 'access', _191 => _191[index], 'optionalAccess', _192 => _192.hasIsolatedClientBoundaries]) === true ? { hasIsolatedClientBoundaries: true } : {}
5696
5671
  }));
5697
5672
  const hydrationStrategies = [
5698
5673
  ...shouldHydrate && moduleMetadata.islandStrategy ? [moduleMetadata.islandStrategy] : [],
@@ -5706,7 +5681,7 @@ var _ServerRenderer = class _ServerRenderer {
5706
5681
  const hasHydratableRouteSlots = renderedRouteSlots.some(
5707
5682
  (slot) => slot.isClientComponent || slot.shouldHydrate
5708
5683
  );
5709
- const hasIsolatedClientBoundaries = _optionalChain([routeManifestEntry, 'optionalAccess', _189 => _189.hasIsolatedClientBoundaries]) === true || layoutHydrationMetadata.some((metadata) => metadata.hasIsolatedClientBoundaries === true);
5684
+ const hasIsolatedClientBoundaries = _optionalChain([routeManifestEntry, 'optionalAccess', _193 => _193.hasIsolatedClientBoundaries]) === true || layoutHydrationMetadata.some((metadata) => metadata.hasIsolatedClientBoundaries === true);
5710
5685
  req.__FARM_PAGE_PATH__ = route.modulePath;
5711
5686
  req.__FARM_ROUTE__ = pathname;
5712
5687
  req.__FARM_IS_CLIENT_COMPONENT__ = isClientComponent;
@@ -5719,7 +5694,7 @@ var _ServerRenderer = class _ServerRenderer {
5719
5694
  req.__FARM_SHOULD_HYDRATE__ = shouldHydrate || shouldHydrateLayout || hasIsolatedClientBoundaries;
5720
5695
  req.__FARM_ISLAND_STRATEGY__ = hydrationIslandStrategy;
5721
5696
  req.__FARM_HAS_HYDRATABLE_ROUTE_SLOTS__ = hasHydratableRouteSlots;
5722
- req.__FARM_LOADING_MODULE_PATH__ = _optionalChain([loadingBoundaryEntry, 'optionalAccess', _190 => _190.modulePath]) ? _chunk5QIKR7RRcjs.toViteModuleId.call(void 0, loadingBoundaryEntry.modulePath, this.config.root) : null;
5697
+ req.__FARM_LOADING_MODULE_PATH__ = _optionalChain([loadingBoundaryEntry, 'optionalAccess', _194 => _194.modulePath]) ? _chunk5QIKR7RRcjs.toViteModuleId.call(void 0, loadingBoundaryEntry.modulePath, this.config.root) : null;
5723
5698
  req.__FARM_ROUTE_SLOTS__ = renderedRouteSlots.map((slot) => ({
5724
5699
  name: slot.name,
5725
5700
  ownerPattern: slot.ownerPattern,
@@ -5789,7 +5764,7 @@ var _ServerRenderer = class _ServerRenderer {
5789
5764
  if ((isClientComponent || shouldHydrate) && !shouldHydrateLayout) {
5790
5765
  pageElement = this.wrapClientGraph(pageElement);
5791
5766
  } else if (shouldHydrateLayout && !(isClientComponent || shouldHydrate) && this.rendererRuntime.isolateServerPageGraph) {
5792
- pageElement = this.rendererRuntime.isolateServerPageGraph(pageElement);
5767
+ pageElement = _optionalChain([routeManifestEntry, 'optionalAccess', _195 => _195.serverTree]) === true && this.rendererRuntime.renderServerTreePage ? await this.rendererRuntime.renderServerTreePage(pageElement) : this.rendererRuntime.isolateServerPageGraph(pageElement);
5793
5768
  }
5794
5769
  pageElement = this.createPageBoundary(pageElement, {
5795
5770
  pageShouldHydrate: isClientComponent || shouldHydrate,
@@ -5803,7 +5778,7 @@ var _ServerRenderer = class _ServerRenderer {
5803
5778
  const LayoutComponent = layoutModule.default;
5804
5779
  const slotProps = {};
5805
5780
  for (const slot of renderedRouteSlots) {
5806
- if (slot.ownerPattern !== layoutEntry.pattern) continue;
5781
+ if ((_nullishCoalesce(slot.ownerDirectory, () => ( slot.ownerPattern))) !== layoutEntry.pattern) continue;
5807
5782
  let slotElement = this.rendererRuntime.createElement(
5808
5783
  slot.module.default,
5809
5784
  slot.props
@@ -5946,7 +5921,7 @@ var _ServerRenderer = class _ServerRenderer {
5946
5921
  }
5947
5922
  }
5948
5923
  _chunkE3UK5IIBcjs.emitFarmEvent.call(void 0, { type: "render.error", route: pathname, error });
5949
- const errorStatus = _chunkP64MIF5Bcjs.resolveDefaultErrorStatus.call(void 0, error);
5924
+ const errorStatus = _chunkIPXLADVOcjs.resolveDefaultErrorStatus.call(void 0, error);
5950
5925
  if (pprRefreshRoute) {
5951
5926
  _chunkE3UK5IIBcjs.emitFarmEvent.call(void 0, {
5952
5927
  type: "ppr.refresh.error",
@@ -5982,7 +5957,7 @@ var _ServerRenderer = class _ServerRenderer {
5982
5957
  }
5983
5958
  }
5984
5959
  async wrapWithIntegrationProviders(element) {
5985
- const providers = _chunkTDFPACVXcjs.getIntegrationProviders.call(void 0, this.config.integrations);
5960
+ const providers = _chunkFTFYRMQQcjs.getIntegrationProviders.call(void 0, this.config.integrations);
5986
5961
  let wrapped = element;
5987
5962
  for (let i = providers.length - 1; i >= 0; i--) {
5988
5963
  const provider = providers[i];
@@ -5990,7 +5965,7 @@ var _ServerRenderer = class _ServerRenderer {
5990
5965
  const rendererCapabilities = _chunkPSV6XKPOcjs.getFarmRendererCapabilities.call(void 0, this.config.renderer);
5991
5966
  if (!rendererCapabilities.functionComponents) {
5992
5967
  throw new Error(
5993
- `Integration provider \`${provider.name}\` requires a renderer that can host function components; \`${_nullishCoalesce(_optionalChain([this, 'access', _191 => _191.config, 'access', _192 => _192.renderer, 'optionalAccess', _193 => _193.name]), () => ( "the configured renderer"))}\` cannot.`
5968
+ `Integration provider \`${provider.name}\` requires a renderer that can host function components; \`${_nullishCoalesce(_optionalChain([this, 'access', _196 => _196.config, 'access', _197 => _197.renderer, 'optionalAccess', _198 => _198.name]), () => ( "the configured renderer"))}\` cannot.`
5994
5969
  );
5995
5970
  }
5996
5971
  if (provider.type === "clerk" && !_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, this.config.renderer)) {
@@ -6000,7 +5975,7 @@ var _ServerRenderer = class _ServerRenderer {
6000
5975
  }
6001
5976
  let ProviderComponent;
6002
5977
  let providerSourceModule;
6003
- if (_chunkTDFPACVXcjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) {
5978
+ if (_chunkFTFYRMQQcjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) {
6004
5979
  providerSourceModule = provider.component.module;
6005
5980
  const providerModuleId = provider.component.module.startsWith(".") ? _chunk5QIKR7RRcjs.toViteModuleId.call(void 0,
6006
5981
  path9.resolve(this.config.root, provider.component.module),
@@ -6029,7 +6004,7 @@ var _ServerRenderer = class _ServerRenderer {
6029
6004
  }
6030
6005
  if (provider.type !== "clerk" && typeof this.rendererRuntime.markFunctionComponent === "function" && !isRendererCompiledComponent(
6031
6006
  _nullishCoalesce(providerSourceModule, () => ( "")),
6032
- _chunkPSV6XKPOcjs.resolveFarmComponentExtensions.call(void 0, _optionalChain([this, 'access', _194 => _194.config, 'access', _195 => _195.renderer, 'optionalAccess', _196 => _196.componentExtensions]))
6007
+ _chunkPSV6XKPOcjs.resolveFarmComponentExtensions.call(void 0, _optionalChain([this, 'access', _199 => _199.config, 'access', _200 => _200.renderer, 'optionalAccess', _201 => _201.componentExtensions]))
6033
6008
  )) {
6034
6009
  ProviderComponent = this.rendererRuntime.markFunctionComponent(ProviderComponent);
6035
6010
  }
@@ -6045,23 +6020,31 @@ var _ServerRenderer = class _ServerRenderer {
6045
6020
  async resolveRouteMetadata(options) {
6046
6021
  let metadata = {};
6047
6022
  for (const layoutModule of options.layoutModules) {
6048
- metadata = _chunk3LUF2PE2cjs.mergeMetadata.call(void 0, metadata, layoutModule.metadata);
6023
+ metadata = _chunkEK4QAEFZcjs.mergeMetadata.call(void 0, metadata, layoutModule.metadata);
6049
6024
  if (typeof layoutModule.generateMetadata === "function") {
6050
- metadata = _chunk3LUF2PE2cjs.mergeMetadata.call(void 0,
6025
+ metadata = _chunkEK4QAEFZcjs.mergeMetadata.call(void 0,
6051
6026
  metadata,
6052
6027
  await layoutModule.generateMetadata({
6053
6028
  params: options.pageProps.params
6054
6029
  })
6055
6030
  );
6056
6031
  }
6032
+ metadata = await _chunkEK4QAEFZcjs.mergeModuleViewport.call(void 0, metadata, layoutModule, {
6033
+ params: options.pageProps.params
6034
+ });
6057
6035
  }
6058
- metadata = _chunk3LUF2PE2cjs.mergeMetadata.call(void 0, metadata, options.routeModule.metadata);
6036
+ metadata = _chunkEK4QAEFZcjs.mergeMetadata.call(void 0, metadata, options.routeModule.metadata);
6059
6037
  if (!options.skipGeneratedRouteMetadata && typeof options.routeModule.generateMetadata === "function") {
6060
- metadata = _chunk3LUF2PE2cjs.mergeMetadata.call(void 0,
6038
+ metadata = _chunkEK4QAEFZcjs.mergeMetadata.call(void 0,
6061
6039
  metadata,
6062
6040
  await options.routeModule.generateMetadata(options.pageProps)
6063
6041
  );
6064
6042
  }
6043
+ metadata = await _chunkEK4QAEFZcjs.mergeModuleViewport.call(void 0,
6044
+ metadata,
6045
+ options.skipGeneratedRouteMetadata ? { viewport: options.routeModule.viewport } : options.routeModule,
6046
+ options.pageProps
6047
+ );
6065
6048
  if (!metadata.manifest) {
6066
6049
  const manifestMatch = this.routeManager.getMatchingMetadataRoute(
6067
6050
  options.pathname,
@@ -6080,7 +6063,7 @@ var _ServerRenderer = class _ServerRenderer {
6080
6063
  for (const kind of ["opengraph", "twitter"]) {
6081
6064
  const reference = await this.resolveMetadataImageReference(kind, options.pathname);
6082
6065
  if (reference) {
6083
- metadata = _chunk3LUF2PE2cjs.addMetadataImageReference.call(void 0, metadata, reference);
6066
+ metadata = _chunkEK4QAEFZcjs.addMetadataImageReference.call(void 0, metadata, reference);
6084
6067
  }
6085
6068
  }
6086
6069
  const snapshot = _chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0, );
@@ -6088,9 +6071,9 @@ var _ServerRenderer = class _ServerRenderer {
6088
6071
  snapshot ? _chunkBIDYX3SLcjs.localizeFarmHref.call(void 0, options.pathname, snapshot.locale, snapshot) : options.pathname,
6089
6072
  this.config.basePath
6090
6073
  );
6091
- metadata = _chunk3LUF2PE2cjs.addMetadataMarkdownAlternate.call(void 0,
6074
+ metadata = _chunkEK4QAEFZcjs.addMetadataMarkdownAlternate.call(void 0,
6092
6075
  metadata,
6093
- _chunkXXJU7FCCcjs.getFarmMarkdownAlternatePath.call(void 0, _chunkXXJU7FCCcjs.resolveMarkdownConfig.call(void 0, this.config.md), publicPathname)
6076
+ _chunkEUV4YR3Vcjs.getFarmMarkdownAlternatePath.call(void 0, _chunkEUV4YR3Vcjs.resolveMarkdownConfig.call(void 0, this.config.md), publicPathname)
6094
6077
  );
6095
6078
  return metadata;
6096
6079
  }
@@ -6148,7 +6131,7 @@ var _ServerRenderer = class _ServerRenderer {
6148
6131
  );
6149
6132
  }
6150
6133
  const request2 = _chunkUXFQ3UDAcjs.createWebRequestFromFarmRequest.call(void 0, req, {
6151
- trustProxy: _optionalChain([this, 'access', _197 => _197.config, 'access', _198 => _198.server, 'optionalAccess', _199 => _199.trustProxy])
6134
+ trustProxy: _optionalChain([this, 'access', _202 => _202.config, 'access', _203 => _203.server, 'optionalAccess', _204 => _204.trustProxy])
6152
6135
  });
6153
6136
  const url = new URL(request2.url);
6154
6137
  const llmsContext = match.metadata.kind === "llms" || match.metadata.kind === "llms-full" ? await this.createLlmsTxtContext(request2, {
@@ -6162,11 +6145,11 @@ var _ServerRenderer = class _ServerRenderer {
6162
6145
  path: match.routePath,
6163
6146
  ...llmsContext
6164
6147
  }) : routeModule.default;
6165
- const body = match.metadata.kind === "llms-full" && !(value instanceof Response) ? await _chunkZHPHJPQPcjs.renderFarmLlmsFullTxt.call(void 0, value, {
6148
+ const body = match.metadata.kind === "llms-full" && !(value instanceof Response) ? await _chunkRU3M2FIKcjs.renderFarmLlmsFullTxt.call(void 0, value, {
6166
6149
  origin: url.origin,
6167
6150
  readMarkdown: llmsContext.markdown
6168
6151
  }) : value;
6169
- const response = _chunkP64MIF5Bcjs.createFarmMetadataRouteResponse.call(void 0, match.metadata.kind, body, routeModule, {
6152
+ const response = _chunkIPXLADVOcjs.createFarmMetadataRouteResponse.call(void 0, match.metadata.kind, body, routeModule, {
6170
6153
  method,
6171
6154
  request: request2
6172
6155
  });
@@ -6184,7 +6167,7 @@ var _ServerRenderer = class _ServerRenderer {
6184
6167
  }
6185
6168
  /** `/llms.txt` and `/llms-full.txt` from `agent.llmsTxt` when no file route owns them. */
6186
6169
  getGeneratedLlmsKind(pathname) {
6187
- const config = _chunkZHPHJPQPcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _200 => _200.config, 'access', _201 => _201.agent, 'optionalAccess', _202 => _202.llmsTxt]));
6170
+ const config = _chunkRU3M2FIKcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _205 => _205.config, 'access', _206 => _206.agent, 'optionalAccess', _207 => _207.llmsTxt]));
6188
6171
  if (!config.enabled) return null;
6189
6172
  if (pathname === "/llms.txt") return "llms";
6190
6173
  return pathname === "/llms-full.txt" && config.full ? "llms-full" : null;
@@ -6192,17 +6175,17 @@ var _ServerRenderer = class _ServerRenderer {
6192
6175
  async renderGeneratedLlmsTxt(req, res, kind) {
6193
6176
  try {
6194
6177
  const request2 = _chunkUXFQ3UDAcjs.createWebRequestFromFarmRequest.call(void 0, req, {
6195
- trustProxy: _optionalChain([this, 'access', _203 => _203.config, 'access', _204 => _204.server, 'optionalAccess', _205 => _205.trustProxy])
6178
+ trustProxy: _optionalChain([this, 'access', _208 => _208.config, 'access', _209 => _209.server, 'optionalAccess', _210 => _210.trustProxy])
6196
6179
  });
6197
- const config = _chunkZHPHJPQPcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _206 => _206.config, 'access', _207 => _207.agent, 'optionalAccess', _208 => _208.llmsTxt]));
6180
+ const config = _chunkRU3M2FIKcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _211 => _211.config, 'access', _212 => _212.agent, 'optionalAccess', _213 => _213.llmsTxt]));
6198
6181
  const context = await this.createLlmsTxtContext(request2, { full: kind === "llms-full", req });
6199
- const body = kind === "llms-full" ? await _chunkZHPHJPQPcjs.renderFarmLlmsFullTxt.call(void 0, context.defaults, {
6182
+ const body = kind === "llms-full" ? await _chunkRU3M2FIKcjs.renderFarmLlmsFullTxt.call(void 0, context.defaults, {
6200
6183
  origin: new URL(request2.url).origin,
6201
6184
  readMarkdown: context.markdown
6202
6185
  }) : context.defaults;
6203
6186
  await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0,
6204
6187
  res,
6205
- _chunkP64MIF5Bcjs.createFarmMetadataRouteResponse.call(void 0,
6188
+ _chunkIPXLADVOcjs.createFarmMetadataRouteResponse.call(void 0,
6206
6189
  kind,
6207
6190
  body,
6208
6191
  { revalidate: config.revalidate },
@@ -6221,23 +6204,23 @@ var _ServerRenderer = class _ServerRenderer {
6221
6204
  }
6222
6205
  }
6223
6206
  getAgentCrawlers() {
6224
- return _chunkZHPHJPQPcjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([this, 'access', _209 => _209.config, 'access', _210 => _210.agent, 'optionalAccess', _211 => _211.crawlers]));
6207
+ return _chunkRU3M2FIKcjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([this, 'access', _214 => _214.config, 'access', _215 => _215.agent, 'optionalAccess', _216 => _216.crawlers]));
6225
6208
  }
6226
6209
  /** `/robots.txt` from `agent.crawlers` when no robots.ts owns it. */
6227
6210
  async renderGeneratedRobotsTxt(req, res) {
6228
6211
  try {
6229
- const sitemapPath = _optionalChain([this, 'access', _212 => _212.routeManager, 'access', _213 => _213.matchMetadataRoute, 'call', _214 => _214("/sitemap.xml"), 'optionalAccess', _215 => _215.metadata, 'access', _216 => _216.kind]) === "sitemap" ? "/sitemap.xml" : void 0;
6212
+ const sitemapPath = _optionalChain([this, 'access', _217 => _217.routeManager, 'access', _218 => _218.matchMetadataRoute, 'call', _219 => _219("/sitemap.xml"), 'optionalAccess', _220 => _220.metadata, 'access', _221 => _221.kind]) === "sitemap" ? "/sitemap.xml" : void 0;
6230
6213
  const rootLayout = this.routeManager.getLayouts().get("/");
6231
6214
  const rootMetadata = sitemapPath && rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
6232
- const robots = _chunkZHPHJPQPcjs.createFarmAgentRobots.call(void 0, {
6215
+ const robots = _chunkRU3M2FIKcjs.createFarmAgentRobots.call(void 0, {
6233
6216
  crawlers: this.getAgentCrawlers(),
6234
6217
  sitemapPath,
6235
- metadataBase: _optionalChain([rootMetadata, 'optionalAccess', _217 => _217.metadataBase]),
6218
+ metadataBase: _optionalChain([rootMetadata, 'optionalAccess', _222 => _222.metadataBase]),
6236
6219
  basePath: this.config.basePath
6237
6220
  });
6238
6221
  await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0,
6239
6222
  res,
6240
- _chunkP64MIF5Bcjs.createFarmMetadataRouteResponse.call(void 0, "robots", robots, {}, { method: req.method })
6223
+ _chunkIPXLADVOcjs.createFarmMetadataRouteResponse.call(void 0, "robots", robots, {}, { method: req.method })
6241
6224
  );
6242
6225
  } catch (error) {
6243
6226
  _chunk5QIKR7RRcjs.logger.error(`Generated robots.txt failed: ${error}`);
@@ -6252,7 +6235,7 @@ var _ServerRenderer = class _ServerRenderer {
6252
6235
  }
6253
6236
  /** Same inputs the production server gives llms.txt: static pages and root metadata. */
6254
6237
  async createLlmsTxtContext(request2, options = {}) {
6255
- const config = _chunkZHPHJPQPcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _218 => _218.config, 'access', _219 => _219.agent, 'optionalAccess', _220 => _220.llmsTxt]));
6238
+ const config = _chunkRU3M2FIKcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _223 => _223.config, 'access', _224 => _224.agent, 'optionalAccess', _225 => _225.llmsTxt]));
6256
6239
  const origin = new URL(request2.url).origin;
6257
6240
  const staticRoutes = [...this.routeManager.getRoutes()].filter(
6258
6241
  ([pattern]) => !pattern.includes("[")
@@ -6270,16 +6253,29 @@ var _ServerRenderer = class _ServerRenderer {
6270
6253
  );
6271
6254
  const rootLayout = this.routeManager.getLayouts().get("/");
6272
6255
  const rootMetadata = rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
6273
- const pages = _chunkZHPHJPQPcjs.collectFarmLlmsTxtPages.call(void 0, sources, {
6256
+ const pages = _chunkRU3M2FIKcjs.collectFarmLlmsTxtPages.call(void 0, sources, {
6274
6257
  origin,
6275
6258
  basePath: this.config.basePath,
6276
- markdown: _chunkXXJU7FCCcjs.resolveMarkdownConfig.call(void 0, this.config.md),
6259
+ markdown: _chunkEUV4YR3Vcjs.resolveMarkdownConfig.call(void 0, this.config.md),
6277
6260
  include: config.include,
6278
6261
  exclude: config.exclude
6279
6262
  });
6280
6263
  return {
6281
6264
  pages,
6282
- defaults: _chunkZHPHJPQPcjs.createFarmDefaultLlmsTxt.call(void 0, { origin, pages, config, rootMetadata }),
6265
+ defaults: _chunkRU3M2FIKcjs.createFarmDefaultLlmsTxt.call(void 0, {
6266
+ origin,
6267
+ pages,
6268
+ config,
6269
+ rootMetadata,
6270
+ mcp: _optionalChain([this, 'access', _226 => _226.config, 'access', _227 => _227.agent, 'optionalAccess', _228 => _228.aiCatalog]) === false ? [] : _chunkIPXLADVOcjs.listFarmMCPLlmsTxtLinks.call(void 0, origin, {
6271
+ basePath: this.config.basePath,
6272
+ apiServerBasePath: _chunkKNBBQHO2cjs.resolveFarmAPIServerBasePath.call(void 0,
6273
+ _chunkS3A45T7Fcjs.normalizeFarmAPIConfig.call(void 0,
6274
+ this.config.api
6275
+ )
6276
+ )
6277
+ })
6278
+ }),
6283
6279
  ...options.full ? { markdown: this.createDevMarkdownReader(options.req) } : {}
6284
6280
  };
6285
6281
  }
@@ -6293,17 +6289,17 @@ var _ServerRenderer = class _ServerRenderer {
6293
6289
  * body is discarded.
6294
6290
  */
6295
6291
  createDevMarkdownReader(req) {
6296
- const socket = _optionalChain([req, 'optionalAccess', _221 => _221.socket]);
6297
- if (_optionalChain([req, 'optionalAccess', _222 => _222.method, 'optionalAccess', _223 => _223.toUpperCase, 'call', _224 => _224()]) === "HEAD" || !_optionalChain([socket, 'optionalAccess', _225 => _225.localAddress]) || !socket.localPort) {
6292
+ const socket = _optionalChain([req, 'optionalAccess', _229 => _229.socket]);
6293
+ if (_optionalChain([req, 'optionalAccess', _230 => _230.method, 'optionalAccess', _231 => _231.toUpperCase, 'call', _232 => _232()]) === "HEAD" || !_optionalChain([socket, 'optionalAccess', _233 => _233.localAddress]) || !socket.localPort) {
6298
6294
  return async () => null;
6299
6295
  }
6300
6296
  if (socket.encrypted) {
6301
6297
  const address = { host: socket.localAddress, port: socket.localPort };
6302
- return _chunkZHPHJPQPcjs.createFarmLlmsMarkdownReader.call(void 0, (page) => requestOwnHttpsServer(page, address));
6298
+ return _chunkRU3M2FIKcjs.createFarmLlmsMarkdownReader.call(void 0, (page) => requestOwnHttpsServer(page, address));
6303
6299
  }
6304
6300
  const host = socket.localAddress.includes(":") ? `[${socket.localAddress}]` : socket.localAddress;
6305
6301
  const localOrigin = `http://${host}:${socket.localPort}`;
6306
- const read = _chunkZHPHJPQPcjs.createFarmLlmsMarkdownReader.call(void 0, (page) => fetch(page));
6302
+ const read = _chunkRU3M2FIKcjs.createFarmLlmsMarkdownReader.call(void 0, (page) => fetch(page));
6307
6303
  return (url) => {
6308
6304
  const target = new URL(url);
6309
6305
  return read(`${localOrigin}${target.pathname}${target.search}`);
@@ -6343,7 +6339,7 @@ var _ServerRenderer = class _ServerRenderer {
6343
6339
  }
6344
6340
  async writeMetadataImageResponse(req, res, value, imageModule) {
6345
6341
  const ifNoneMatch = req.headers["if-none-match"];
6346
- const response = await _chunkK3F2E6GScjs.createFarmMetadataImageResponse.call(void 0, value, imageModule, {
6342
+ const response = await _chunkEJQT6KZNcjs.createFarmMetadataImageResponse.call(void 0, value, imageModule, {
6347
6343
  method: req.method,
6348
6344
  ifNoneMatch: Array.isArray(ifNoneMatch) ? ifNoneMatch[0] : ifNoneMatch
6349
6345
  });
@@ -6359,7 +6355,7 @@ var _ServerRenderer = class _ServerRenderer {
6359
6355
  }
6360
6356
  const etag = `"${image.staticInfo.hash}"`;
6361
6357
  const requestUrl = _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, req, {
6362
- trustProxy: _optionalChain([this, 'access', _226 => _226.config, 'access', _227 => _227.server, 'optionalAccess', _228 => _228.trustProxy])
6358
+ trustProxy: _optionalChain([this, 'access', _234 => _234.config, 'access', _235 => _235.server, 'optionalAccess', _236 => _236.trustProxy])
6363
6359
  });
6364
6360
  const isVersioned = requestUrl.searchParams.get("v") === image.staticInfo.hash;
6365
6361
  res.setHeader("Content-Type", image.staticInfo.contentType);
@@ -6370,7 +6366,7 @@ var _ServerRenderer = class _ServerRenderer {
6370
6366
  "Cache-Control",
6371
6367
  isVersioned ? "public, max-age=31536000, immutable" : "public, max-age=0, must-revalidate"
6372
6368
  );
6373
- if (_chunkEM6SBQKMcjs.matchesFarmIfNoneMatch.call(void 0, req.headers["if-none-match"], etag)) {
6369
+ if (_chunkOMVAU7NTcjs.matchesFarmIfNoneMatch.call(void 0, req.headers["if-none-match"], etag)) {
6374
6370
  res.statusCode = 304;
6375
6371
  res.end();
6376
6372
  return;
@@ -6531,20 +6527,21 @@ window.__FARM_ISLAND_STRATEGY__ = ${JSON.stringify(req.__FARM_ISLAND_STRATEGY__
6531
6527
  window.__FARM_PAGE_MODULE__ = ${JSON.stringify(relativePath)};
6532
6528
  window.__FARM_LOADING_MODULE__ = ${JSON.stringify(req.__FARM_LOADING_MODULE_PATH__ || null)};
6533
6529
  window.__FARM_MANIFEST__ = ${JSON.stringify(clientManifest)};
6534
- window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkTDFPACVXcjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
6530
+ window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkFTFYRMQQcjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
6535
6531
  window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0, ) ? serializeInlineValue(_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0, )) : "null"};
6536
6532
  </script>`;
6537
6533
  const deferredScript = createDeferredHydrationScript(deferredProps.records);
6538
- const rendererHydrationScript = _optionalChain([this, 'access', _229 => _229.rendererRuntime, 'access', _230 => _230.generateHydrationScript, 'optionalCall', _231 => _231()]) || "";
6534
+ const rendererHydrationScript = _optionalChain([this, 'access', _237 => _237.rendererRuntime, 'access', _238 => _238.generateHydrationScript, 'optionalCall', _239 => _239()]) || "";
6539
6535
  const { html: content, head: rendererHead } = await this.renderElementToDocumentParts(element);
6540
6536
  const {
6541
6537
  title,
6542
6538
  tags: metaTags,
6543
6539
  hasFavicon,
6544
- hasExplicitTitle
6545
- } = _chunk3LUF2PE2cjs.renderMetadataHead.call(void 0, req.__FARM_METADATA__, {
6540
+ hasExplicitTitle,
6541
+ viewport: viewportTags
6542
+ } = _chunkEK4QAEFZcjs.renderMetadataHead.call(void 0, req.__FARM_METADATA__, {
6546
6543
  pathname: getFarmMetadataPathname(req),
6547
- jsonLd: _optionalChain([this, 'access', _232 => _232.config, 'access', _233 => _233.agent, 'optionalAccess', _234 => _234.jsonLd])
6544
+ jsonLd: _optionalChain([this, 'access', _240 => _240.config, 'access', _241 => _241.agent, 'optionalAccess', _242 => _242.jsonLd])
6548
6545
  });
6549
6546
  const documentTitleTag = !hasExplicitTitle && /<title[\s>]/i.test(rendererHead) ? "" : `<title>${title}</title>`;
6550
6547
  const rendererHasTitle = /<title[\s>]/i.test(rendererHead);
@@ -6554,19 +6551,20 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
6554
6551
  i18nSnapshot,
6555
6552
  this.getI18nAlternateOptions(req, req.__FARM_METADATA__)
6556
6553
  ) : "";
6557
- const themeDocument = _chunkP64MIF5Bcjs.createFarmThemeDocumentParts.call(void 0,
6554
+ const themeDocument = _chunkIPXLADVOcjs.createFarmThemeDocumentParts.call(void 0,
6558
6555
  this.config.theme,
6559
6556
  this.config.basePath,
6560
6557
  _chunkKXWRO25Scjs.getTheme.call(void 0, )
6561
6558
  );
6562
- const fullDocument = extractFarmFullDocument(content);
6559
+ const fullDocument = _chunkIPXLADVOcjs.extractFarmFullDocument.call(void 0, content);
6563
6560
  let html;
6564
6561
  if (fullDocument) {
6565
6562
  const shouldReplaceLayoutTitle = hasExplicitTitle || rendererHasTitle;
6566
- const documentHtml = shouldReplaceLayoutTitle ? removeFarmDocumentTitles(fullDocument) : fullDocument;
6567
- const effectiveRendererHead = hasExplicitTitle ? removeFarmDocumentTitles(rendererHead) : rendererHead;
6568
- html = composeFarmFullDocument(documentHtml, {
6563
+ const documentHtml = shouldReplaceLayoutTitle ? _chunkIPXLADVOcjs.removeFarmDocumentTitles.call(void 0, fullDocument) : fullDocument;
6564
+ const effectiveRendererHead = hasExplicitTitle ? _chunkIPXLADVOcjs.removeFarmDocumentTitles.call(void 0, rendererHead) : rendererHead;
6565
+ html = _chunkIPXLADVOcjs.composeFarmFullDocument.call(void 0, documentHtml, {
6569
6566
  fallbackIcon: !hasFavicon,
6567
+ viewport: viewportTags,
6570
6568
  htmlAttributes: `${i18nSnapshot ? ` lang="${escapeHtmlAttribute2(i18nSnapshot.locale)}" dir="${escapeHtmlAttribute2(i18nSnapshot.direction)}"` : ""}${themeDocument.attributes}`,
6571
6569
  replaceHtmlAttributes: [
6572
6570
  ...i18nSnapshot ? ["lang", "dir"] : [],
@@ -6590,11 +6588,11 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
6590
6588
  });
6591
6589
  } else {
6592
6590
  html = `<!DOCTYPE html>
6593
- <html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _235 => _235.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
6591
+ <html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _243 => _243.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
6594
6592
  <head>
6595
6593
  ${themeDocument.head}
6596
6594
  <meta charset="utf-8">
6597
- <meta name="viewport" content="width=device-width, initial-scale=1">
6595
+ ${viewportTags}
6598
6596
  <meta name="farm-deployment-id" content="${escapeHtmlAttribute2(deploymentId)}">
6599
6597
  ${hasFavicon ? "" : '<link rel="icon" href="data:,">'}
6600
6598
  ${documentTitleTag}${metaTags}${alternateTags}${rendererHead ? `
@@ -6621,7 +6619,7 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
6621
6619
  const securedHtml = this.secureDocumentHTML(req, html);
6622
6620
  if ((req.method || "GET").toUpperCase() !== "HEAD") res.write(securedHtml);
6623
6621
  res.end();
6624
- if (!options.captureStaticShell) await _optionalChain([options, 'access', _236 => _236.onComplete, 'optionalCall', _237 => _237(securedHtml)]);
6622
+ if (!options.captureStaticShell) await _optionalChain([options, 'access', _244 => _244.onComplete, 'optionalCall', _245 => _245(securedHtml)]);
6625
6623
  _chunkE3UK5IIBcjs.emitFarmEvent.call(void 0, {
6626
6624
  type: "render.stream.complete",
6627
6625
  route,
@@ -6631,7 +6629,7 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
6631
6629
  _chunkE3UK5IIBcjs.emitFarmEvent.call(void 0, { type: "render.error", route, error });
6632
6630
  throw error;
6633
6631
  } finally {
6634
- _optionalChain([clearMiddlewareData, 'optionalCall', _238 => _238()]);
6632
+ _optionalChain([clearMiddlewareData, 'optionalCall', _246 => _246()]);
6635
6633
  }
6636
6634
  }
6637
6635
  /**
@@ -6646,7 +6644,7 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
6646
6644
  if (!rootLayout) return false;
6647
6645
  try {
6648
6646
  const Layout = (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).default;
6649
- if (typeof Layout !== "function" || _optionalChain([Layout, 'access', _239 => _239.prototype, 'optionalAccess', _240 => _240.isReactComponent]) || _optionalChain([Layout, 'access', _241 => _241.constructor, 'optionalAccess', _242 => _242.name]) === "AsyncFunction") {
6647
+ if (typeof Layout !== "function" || _optionalChain([Layout, 'access', _247 => _247.prototype, 'optionalAccess', _248 => _248.isReactComponent]) || _optionalChain([Layout, 'access', _249 => _249.constructor, 'optionalAccess', _250 => _250.name]) === "AsyncFunction") {
6650
6648
  return false;
6651
6649
  }
6652
6650
  const cached = documentLayouts.get(Layout);
@@ -6772,17 +6770,18 @@ window.__FARM_LOADING_MODULE__ = ${JSON.stringify(
6772
6770
  req.__FARM_LOADING_MODULE_PATH__ || null
6773
6771
  )};
6774
6772
  window.__FARM_MANIFEST__ = ${JSON.stringify(clientManifest)};
6775
- window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkTDFPACVXcjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
6773
+ window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkFTFYRMQQcjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
6776
6774
  window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0, ) ? serializeInlineValue(_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0, )) : "null"};
6777
6775
  </script>`;
6778
6776
  const hydrationClickQueueScript = isClientComponent || req.__FARM_SHOULD_HYDRATE__ === true || req.__FARM_HAS_HYDRATABLE_ROUTE_SLOTS__ === true ? createPreHydrationClickQueueScript() : "";
6779
6777
  const {
6780
6778
  title,
6781
6779
  tags: metaTags,
6782
- hasFavicon
6783
- } = _chunk3LUF2PE2cjs.renderMetadataHead.call(void 0, req.__FARM_METADATA__, {
6780
+ hasFavicon,
6781
+ viewport: viewportTags
6782
+ } = _chunkEK4QAEFZcjs.renderMetadataHead.call(void 0, req.__FARM_METADATA__, {
6784
6783
  pathname: getFarmMetadataPathname(req),
6785
- jsonLd: _optionalChain([this, 'access', _243 => _243.config, 'access', _244 => _244.agent, 'optionalAccess', _245 => _245.jsonLd])
6784
+ jsonLd: _optionalChain([this, 'access', _251 => _251.config, 'access', _252 => _252.agent, 'optionalAccess', _253 => _253.jsonLd])
6786
6785
  });
6787
6786
  const i18nSnapshot = _chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0, );
6788
6787
  const i18nAlternateTags = i18nSnapshot ? renderI18nAlternateLinks(
@@ -6791,7 +6790,7 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
6791
6790
  this.getI18nAlternateOptions(req, req.__FARM_METADATA__)
6792
6791
  ) : "";
6793
6792
  const fontHead = renderFarmFontDevHead(this.config.root || process.cwd());
6794
- const themeDocument = _chunkP64MIF5Bcjs.createFarmThemeDocumentParts.call(void 0,
6793
+ const themeDocument = _chunkIPXLADVOcjs.createFarmThemeDocumentParts.call(void 0,
6795
6794
  this.config.theme,
6796
6795
  this.config.basePath,
6797
6796
  _chunkKXWRO25Scjs.getTheme.call(void 0, )
@@ -6800,13 +6799,13 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
6800
6799
  const devStyleLinks = this.collectDevStyleLinks();
6801
6800
  const globalStylesheetLink = this.devGlobalStylesheetLink(true);
6802
6801
  const cspNonce = this.getCspNonce(req);
6803
- const secureDocumentHTML = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (html) => cspNonce ? _chunkZHPHJPQPcjs.addFarmCspNonceToScriptTags.call(void 0, html, cspNonce) : html, "secureDocumentHTML");
6802
+ const secureDocumentHTML = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (html) => cspNonce ? _chunkRU3M2FIKcjs.addFarmCspNonceToScriptTags.call(void 0, html, cspNonce) : html, "secureDocumentHTML");
6804
6803
  const createLateNavigationRecovery = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (navigationError) => this.createLateNavigationRecoveryHTML(req, navigationError), "createLateNavigationRecovery");
6805
6804
  const { pipe, abort } = renderToPipeableStream(streamRoot, {
6806
6805
  nonce: cspNonce,
6807
6806
  onShellReady() {
6808
6807
  if (pendingNavigationError) {
6809
- _optionalChain([abort, 'optionalCall', _246 => _246(pendingNavigationError)]);
6808
+ _optionalChain([abort, 'optionalCall', _254 => _254(pendingNavigationError)]);
6810
6809
  if (clearMiddlewareData) {
6811
6810
  clearMiddlewareData();
6812
6811
  }
@@ -6824,11 +6823,11 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
6824
6823
  console.log(`[FARM STREAM] onShellReady at ${shellReadyMs}ms`);
6825
6824
  }
6826
6825
  const shell = `<!DOCTYPE html>
6827
- <html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _247 => _247.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
6826
+ <html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _255 => _255.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
6828
6827
  <head>
6829
6828
  ${themeDocument.head}
6830
6829
  <meta charset="utf-8">
6831
- <meta name="viewport" content="width=device-width, initial-scale=1">
6830
+ ${viewportTags}
6832
6831
  <meta name="farm-deployment-id" content="${escapeHtmlAttribute2(deploymentId)}">
6833
6832
  ${hasFavicon ? "" : '<link rel="icon" href="data:,">'}
6834
6833
  <title>${title}</title>${metaTags}${i18nAlternateTags}
@@ -6843,17 +6842,17 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
6843
6842
  <div id="root">`;
6844
6843
  const securedShell = secureDocumentHTML(shell);
6845
6844
  htmlParts.push(securedShell);
6846
- _optionalChain([staticShellParts, 'optionalAccess', _248 => _248.push, 'call', _249 => _249(securedShell)]);
6845
+ _optionalChain([staticShellParts, 'optionalAccess', _256 => _256.push, 'call', _257 => _257(securedShell)]);
6847
6846
  let firstChunk = true;
6848
6847
  let checkedFullDocument = false;
6849
6848
  let documentPrefix = "";
6850
- const cspNonceRewriter = cspNonce ? _chunkZHPHJPQPcjs.createFarmCspNonceRewriter.call(void 0, cspNonce) : void 0;
6849
+ const cspNonceRewriter = cspNonce ? _chunkRU3M2FIKcjs.createFarmCspNonceRewriter.call(void 0, cspNonce) : void 0;
6851
6850
  const cspStreamDecoder = cspNonceRewriter ? new TextDecoder() : void 0;
6852
6851
  const recordRenderedChunk = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (chunkText) => {
6853
6852
  if (!chunkText) return;
6854
6853
  if (!checkedFullDocument) {
6855
6854
  documentPrefix += chunkText;
6856
- const prefix = classifyFarmDocumentPrefix(documentPrefix);
6855
+ const prefix = _chunkIPXLADVOcjs.classifyFarmDocumentPrefix.call(void 0, documentPrefix);
6857
6856
  if (prefix !== "pending") {
6858
6857
  checkedFullDocument = true;
6859
6858
  documentPrefix = "";
@@ -6870,7 +6869,7 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
6870
6869
  staticShellClosed = true;
6871
6870
  if (!suspenseHoleEmitted) {
6872
6871
  suspenseHoleEmitted = true;
6873
- _optionalChain([options, 'access', _250 => _250.onSuspenseHoleDetected, 'optionalCall', _251 => _251()]);
6872
+ _optionalChain([options, 'access', _258 => _258.onSuspenseHoleDetected, 'optionalCall', _259 => _259()]);
6874
6873
  }
6875
6874
  } else {
6876
6875
  staticShellParts.push(chunkText);
@@ -7027,12 +7026,12 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
7027
7026
  return await this.routeManager.loadRouteModule(notFoundPath);
7028
7027
  }
7029
7028
  async loadNotFoundComponent() {
7030
- return await _asyncNullishCoalesce(await _asyncOptionalChain([(await this.loadNotFoundModule()), 'optionalAccess', async _252 => _252.default]), async () => ( null));
7029
+ return await _asyncNullishCoalesce(await _asyncOptionalChain([(await this.loadNotFoundModule()), 'optionalAccess', async _260 => _260.default]), async () => ( null));
7031
7030
  }
7032
7031
  /** The not-found document's head: layout and not-found metadata, as production renders it. */
7033
7032
  async notFoundMetadataHead(layoutModule, notFoundModule) {
7034
- const metadata = await _chunk3LUF2PE2cjs.resolveFarmNotFoundMetadata.call(void 0, [layoutModule], notFoundModule);
7035
- const { title, tags, hasFavicon } = _chunk3LUF2PE2cjs.renderMetadataHead.call(void 0, metadata);
7033
+ const metadata = await _chunkEK4QAEFZcjs.resolveFarmNotFoundMetadata.call(void 0, [layoutModule], notFoundModule);
7034
+ const { title, tags, hasFavicon } = _chunkEK4QAEFZcjs.renderMetadataHead.call(void 0, metadata);
7036
7035
  return {
7037
7036
  head: `${hasFavicon ? "" : '<link rel="icon" href="data:,">\n '}<title>${title}</title>${tags}`,
7038
7037
  metadata
@@ -7050,10 +7049,10 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
7050
7049
  */
7051
7050
  async createLateNavigationRecoveryHTML(req, error) {
7052
7051
  if (_chunkOX6O6WVAcjs.isFarmRedirectError.call(void 0, error)) {
7053
- return _chunkP64MIF5Bcjs.createLateRedirectRecovery.call(void 0, this.localizeRedirectUrl(_chunkOX6O6WVAcjs.getFarmRedirectError.call(void 0, error).url));
7052
+ return _chunkIPXLADVOcjs.createLateRedirectRecovery.call(void 0, this.localizeRedirectUrl(_chunkOX6O6WVAcjs.getFarmRedirectError.call(void 0, error).url));
7054
7053
  }
7055
7054
  const pathname = _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, req, {
7056
- trustProxy: _optionalChain([this, 'access', _253 => _253.config, 'access', _254 => _254.server, 'optionalAccess', _255 => _255.trustProxy])
7055
+ trustProxy: _optionalChain([this, 'access', _261 => _261.config, 'access', _262 => _262.server, 'optionalAccess', _263 => _263.trustProxy])
7057
7056
  }).pathname;
7058
7057
  let content = this.defaultNotFoundContent();
7059
7058
  const NotFoundComponent = await this.loadNotFoundComponent();
@@ -7068,20 +7067,20 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
7068
7067
  _chunk5QIKR7RRcjs.logger.warn(`not-found page could not render outside its layout, using Farm's: ${error2}`);
7069
7068
  }
7070
7069
  }
7071
- return _chunkP64MIF5Bcjs.createLateNotFoundRecovery.call(void 0, content);
7070
+ return _chunkIPXLADVOcjs.createLateNotFoundRecovery.call(void 0, content);
7072
7071
  }
7073
7072
  async render404(req, res) {
7074
7073
  res.statusCode = 404;
7075
7074
  const pathname = _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, req, {
7076
- trustProxy: _optionalChain([this, 'access', _256 => _256.config, 'access', _257 => _257.server, 'optionalAccess', _258 => _258.trustProxy])
7075
+ trustProxy: _optionalChain([this, 'access', _264 => _264.config, 'access', _265 => _265.server, 'optionalAccess', _266 => _266.trustProxy])
7077
7076
  }).pathname;
7078
7077
  const acceptHeader = req.headers.accept;
7079
7078
  const accept = Array.isArray(acceptHeader) ? acceptHeader.join(",") : acceptHeader;
7080
- if (_chunkXXJU7FCCcjs.farmRequestWantsMarkdown.call(void 0, pathname, accept)) {
7081
- res.setHeader("Content-Type", _chunkXXJU7FCCcjs.FARM_MARKDOWN_CONTENT_TYPE);
7079
+ if (_chunkEUV4YR3Vcjs.farmRequestWantsMarkdown.call(void 0, pathname, accept)) {
7080
+ res.setHeader("Content-Type", _chunkEUV4YR3Vcjs.FARM_MARKDOWN_CONTENT_TYPE);
7082
7081
  res.setHeader("X-Farm-Markdown-Error", "404");
7083
7082
  res.setHeader("Cache-Control", "no-store");
7084
- res.end(_chunkXXJU7FCCcjs.createFarmMarkdownErrorBody.call(void 0, 404, pathname, this.config.basePath || "/"));
7083
+ res.end(_chunkEUV4YR3Vcjs.createFarmMarkdownErrorBody.call(void 0, 404, pathname, this.config.basePath || "/"));
7085
7084
  return;
7086
7085
  }
7087
7086
  const appDir = path9.join(this.config.root, this.config.srcDir, "app");
@@ -7101,9 +7100,9 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
7101
7100
  );
7102
7101
  if (notFoundPath) {
7103
7102
  const notFoundModule = await this.loadNotFoundModule();
7104
- const NotFoundComponent = _nullishCoalesce(_optionalChain([notFoundModule, 'optionalAccess', _259 => _259.default]), () => ( null));
7103
+ const NotFoundComponent = _nullishCoalesce(_optionalChain([notFoundModule, 'optionalAccess', _267 => _267.default]), () => ( null));
7105
7104
  if (NotFoundComponent) {
7106
- const LayoutComponent = _nullishCoalesce(_optionalChain([layoutModule, 'optionalAccess', _260 => _260.default]), () => ( null));
7105
+ const LayoutComponent = _nullishCoalesce(_optionalChain([layoutModule, 'optionalAccess', _268 => _268.default]), () => ( null));
7107
7106
  let element = this.rendererRuntime.createElement(NotFoundComponent, { pathname });
7108
7107
  if (LayoutComponent) {
7109
7108
  element = this.rendererRuntime.createElement(LayoutComponent, {
@@ -7140,21 +7139,21 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
7140
7139
  res.statusCode = statusCode;
7141
7140
  const isDev = process.env.NODE_ENV === "development";
7142
7141
  const requestUrl = _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, req, {
7143
- trustProxy: _optionalChain([this, 'access', _261 => _261.config, 'access', _262 => _262.server, 'optionalAccess', _263 => _263.trustProxy])
7142
+ trustProxy: _optionalChain([this, 'access', _269 => _269.config, 'access', _270 => _270.server, 'optionalAccess', _271 => _271.trustProxy])
7144
7143
  });
7145
7144
  const diagnostics = isDev ? createDefaultErrorDiagnostics(error, this.config.root || process.cwd()) : void 0;
7146
- const statusText = _chunkP64MIF5Bcjs.getDefaultErrorStatusText.call(void 0, statusCode);
7147
- const content = _chunkP64MIF5Bcjs.createDefaultErrorMarkup.call(void 0, {
7145
+ const statusText = _chunkIPXLADVOcjs.getDefaultErrorStatusText.call(void 0, statusCode);
7146
+ const content = _chunkIPXLADVOcjs.createDefaultErrorMarkup.call(void 0, {
7148
7147
  statusCode,
7149
7148
  statusText,
7150
7149
  requestPath: requestUrl.pathname,
7151
7150
  method: req.method || "GET",
7152
- message: _optionalChain([diagnostics, 'optionalAccess', _264 => _264.message]),
7153
- errorName: _optionalChain([diagnostics, 'optionalAccess', _265 => _265.name]),
7154
- stack: _optionalChain([diagnostics, 'optionalAccess', _266 => _266.stack]),
7155
- sourceFrame: _optionalChain([diagnostics, 'optionalAccess', _267 => _267.sourceFrame]),
7151
+ message: _optionalChain([diagnostics, 'optionalAccess', _272 => _272.message]),
7152
+ errorName: _optionalChain([diagnostics, 'optionalAccess', _273 => _273.name]),
7153
+ stack: _optionalChain([diagnostics, 'optionalAccess', _274 => _274.stack]),
7154
+ sourceFrame: _optionalChain([diagnostics, 'optionalAccess', _275 => _275.sourceFrame]),
7156
7155
  development: isDev,
7157
- farmVersion: _chunkODBZYBABcjs.FARM_VERSION,
7156
+ farmVersion: _chunkYC6V7PWEcjs.FARM_VERSION,
7158
7157
  nodeVersion: process.version,
7159
7158
  mode: isDev ? "development" : "production"
7160
7159
  });
@@ -7179,8 +7178,8 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
7179
7178
  */
7180
7179
  getI18nAlternateOptions(req, metadata) {
7181
7180
  return {
7182
- metadataBase: _optionalChain([metadata, 'optionalAccess', _268 => _268.metadataBase]),
7183
- origin: req ? _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _269 => _269.config, 'access', _270 => _270.server, 'optionalAccess', _271 => _271.trustProxy]) }).origin : void 0
7181
+ metadataBase: _optionalChain([metadata, 'optionalAccess', _276 => _276.metadataBase]),
7182
+ origin: req ? _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _277 => _277.config, 'access', _278 => _278.server, 'optionalAccess', _279 => _279.trustProxy]) }).origin : void 0
7184
7183
  };
7185
7184
  }
7186
7185
  createFullHTML(content, isClientComponent = false, requestPath = "/", metadataHead, alternates = {}) {
@@ -7188,7 +7187,7 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
7188
7187
  const clientScript = isClientComponent ? ` <script type="module" src="/@farm/client.js"></script>` : "";
7189
7188
  const integrationManifestScript = `<script>
7190
7189
  window.__FARM_DEPLOYMENT_ID__ = ${serializeInlineValue(this.getDeploymentId())};
7191
- window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkTDFPACVXcjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
7190
+ window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkFTFYRMQQcjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
7192
7191
  ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};` : ""}
7193
7192
  </script>`;
7194
7193
  const alternateLinks = i18nSnapshot ? renderI18nAlternateLinks(
@@ -7197,18 +7196,20 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};`
7197
7196
  this.getI18nAlternateOptions(alternates.req, alternates.metadata)
7198
7197
  ) : "";
7199
7198
  const fontHead = renderFarmFontDevHead(this.config.root || process.cwd());
7200
- const themeDocument = _chunkP64MIF5Bcjs.createFarmThemeDocumentParts.call(void 0,
7199
+ const themeDocument = _chunkIPXLADVOcjs.createFarmThemeDocumentParts.call(void 0,
7201
7200
  this.config.theme,
7202
7201
  this.config.basePath,
7203
7202
  _chunkKXWRO25Scjs.getTheme.call(void 0, )
7204
7203
  );
7205
- const rendererHydrationScript = _optionalChain([this, 'access', _272 => _272.rendererRuntime, 'access', _273 => _273.generateHydrationScript, 'optionalCall', _274 => _274()]) || "";
7206
- const fullDocument = extractFarmFullDocument(content);
7204
+ const rendererHydrationScript = _optionalChain([this, 'access', _280 => _280.rendererRuntime, 'access', _281 => _281.generateHydrationScript, 'optionalCall', _282 => _282()]) || "";
7205
+ const viewportTags = _chunkEK4QAEFZcjs.renderViewportHead.call(void 0, _optionalChain([alternates, 'access', _283 => _283.metadata, 'optionalAccess', _284 => _284.viewport]));
7206
+ const fullDocument = _chunkIPXLADVOcjs.extractFarmFullDocument.call(void 0, content);
7207
7207
  if (fullDocument) {
7208
- return composeFarmFullDocument(
7209
- metadataHead ? removeFarmDocumentTitles(fullDocument) : fullDocument,
7208
+ return _chunkIPXLADVOcjs.composeFarmFullDocument.call(void 0,
7209
+ metadataHead ? _chunkIPXLADVOcjs.removeFarmDocumentTitles.call(void 0, fullDocument) : fullDocument,
7210
7210
  {
7211
7211
  fallbackIcon: !metadataHead,
7212
+ viewport: viewportTags,
7212
7213
  htmlAttributes: `${i18nSnapshot ? ` lang="${escapeHtmlAttribute2(i18nSnapshot.locale)}" dir="${escapeHtmlAttribute2(i18nSnapshot.direction)}"` : ""}${themeDocument.attributes}`,
7213
7214
  replaceHtmlAttributes: [
7214
7215
  ...i18nSnapshot ? ["lang", "dir"] : [],
@@ -7231,11 +7232,11 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};`
7231
7232
  );
7232
7233
  }
7233
7234
  return `<!DOCTYPE html>
7234
- <html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _275 => _275.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
7235
+ <html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _285 => _285.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
7235
7236
  <head>
7236
7237
  ${themeDocument.head}
7237
7238
  <meta charset="utf-8">
7238
- <meta name="viewport" content="width=device-width, initial-scale=1">
7239
+ ${viewportTags}
7239
7240
  <meta name="farm-deployment-id" content="${escapeHtmlAttribute2(this.getDeploymentId())}">
7240
7241
  ${_nullishCoalesce(metadataHead, () => ( '<link rel="icon" href="data:,">\n <title>Farm.js App</title>'))}${alternateLinks}
7241
7242
  ${fontHead}
@@ -7257,14 +7258,14 @@ ${clientScript}
7257
7258
  }
7258
7259
  secureDocumentHTML(req, html) {
7259
7260
  const nonce = this.getCspNonce(req);
7260
- return nonce ? _chunkZHPHJPQPcjs.addFarmCspNonceToScriptTags.call(void 0, html, nonce) : html;
7261
+ return nonce ? _chunkRU3M2FIKcjs.addFarmCspNonceToScriptTags.call(void 0, html, nonce) : html;
7261
7262
  }
7262
7263
  applyDeploymentHeaders(req, res) {
7263
7264
  const deploymentId = this.getDeploymentId();
7264
7265
  res.setHeader(_chunkC5GUTBZKcjs.FARM_DEPLOYMENT_ID_HEADER, deploymentId);
7265
7266
  if ((req.method || "GET").toUpperCase() !== "GET") return;
7266
7267
  const forwardedProto = req.headers["x-forwarded-proto"];
7267
- const isSecure = _optionalChain([(Array.isArray(forwardedProto) ? forwardedProto[0] : forwardedProto), 'optionalAccess', _276 => _276.split, 'call', _277 => _277(","), 'access', _278 => _278[0], 'optionalAccess', _279 => _279.trim, 'call', _280 => _280()]) === "https" || Boolean(_optionalChain([req, 'access', _281 => _281.socket, 'optionalAccess', _282 => _282.encrypted]));
7268
+ const isSecure = _optionalChain([(Array.isArray(forwardedProto) ? forwardedProto[0] : forwardedProto), 'optionalAccess', _286 => _286.split, 'call', _287 => _287(","), 'access', _288 => _288[0], 'optionalAccess', _289 => _289.trim, 'call', _290 => _290()]) === "https" || Boolean(_optionalChain([req, 'access', _291 => _291.socket, 'optionalAccess', _292 => _292.encrypted]));
7268
7269
  const cookie = _chunkC5GUTBZKcjs.createFarmDeploymentCookie.call(void 0, deploymentId, this.config.basePath || "/", isSecure);
7269
7270
  const existing = res.getHeader("Set-Cookie");
7270
7271
  if (Array.isArray(existing)) {
@@ -7358,16 +7359,16 @@ var _FarmApp = class _FarmApp {
7358
7359
  plugins: config.plugins || [],
7359
7360
  migrations: config.migrations || { commands: [] },
7360
7361
  cron: _chunk6EXBPJ24cjs.resolveCronConfig.call(void 0, config.cron),
7361
- workflows: _chunkMPEYMSCFcjs.resolveWorkflowsConfig.call(void 0, config.workflows),
7362
+ workflows: _chunkVFQT3LAOcjs.resolveWorkflowsConfig.call(void 0, config.workflows),
7362
7363
  api: normalizeFarmAppAPIConfig(config.api),
7363
7364
  middleware: config.middleware || {},
7364
7365
  routeRules: _chunkQ5B3KJBPcjs.normalizeRouteRules.call(void 0, config.routeRules),
7365
7366
  context: config.context || (() => void 0),
7366
- server: _chunkEM6SBQKMcjs.resolveFarmServerConfig.call(void 0, config.server),
7367
- serverActions: _chunkT5CERMEHcjs.resolveServerActionsConfig.call(void 0, config.serverActions),
7368
- security: _chunkZHPHJPQPcjs.resolveFarmSecurityConfig.call(void 0, config.security),
7367
+ server: _chunkOMVAU7NTcjs.resolveFarmServerConfig.call(void 0, config.server),
7368
+ serverActions: _chunkZXGAFZDOcjs.resolveServerActionsConfig.call(void 0, config.serverActions),
7369
+ security: _chunkRU3M2FIKcjs.resolveFarmSecurityConfig.call(void 0, config.security),
7369
7370
  images: _chunkYFPGHF5Fcjs.resolveFarmImageConfig.call(void 0, config.images),
7370
- performance: _chunkZHPHJPQPcjs.resolveFarmPerformanceConfig.call(void 0, config.performance),
7371
+ performance: _chunkRU3M2FIKcjs.resolveFarmPerformanceConfig.call(void 0, config.performance),
7371
7372
  theme: _chunkOI6CMLWXcjs.resolveFarmThemeConfig.call(void 0, config.theme, basePath),
7372
7373
  i18n: isResolvedI18nConfig(config.i18n) ? config.i18n : _chunkHLJ6MBUZcjs.resolveFarmI18nConfig.call(void 0, config.i18n, {
7373
7374
  root,
@@ -7379,7 +7380,7 @@ var _FarmApp = class _FarmApp {
7379
7380
  serverRuntimeConfig: config.serverRuntimeConfig || {},
7380
7381
  publicRuntimeConfig: config.publicRuntimeConfig || {},
7381
7382
  docs: isResolvedDocsConfig(config.docs) ? config.docs : defaultDocsConfig,
7382
- md: _chunkXXJU7FCCcjs.resolveMarkdownConfig.call(void 0, config.md),
7383
+ md: _chunkEUV4YR3Vcjs.resolveMarkdownConfig.call(void 0, config.md),
7383
7384
  mdx: _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, config.mdx),
7384
7385
  observability: _nullishCoalesce(config.observability, () => ( false)),
7385
7386
  telemetry: config.telemetry !== false,
@@ -7395,10 +7396,10 @@ var _FarmApp = class _FarmApp {
7395
7396
  env: config.env || { server: {}, public: {} },
7396
7397
  suppressLintOnLink: _nullishCoalesce(config.suppressLintOnLink, () => ( false)),
7397
7398
  experimental: {
7398
- serverComponents: _nullishCoalesce(_optionalChain([config, 'access', _283 => _283.experimental, 'optionalAccess', _284 => _284.serverComponents]), () => ( false)),
7399
- serverActions: _nullishCoalesce(_optionalChain([config, 'access', _285 => _285.experimental, 'optionalAccess', _286 => _286.serverActions]), () => ( false)),
7400
- isolatedClientHydration: _nullishCoalesce(_optionalChain([config, 'access', _287 => _287.experimental, 'optionalAccess', _288 => _288.isolatedClientHydration]), () => ( "off")),
7401
- ppr: _nullishCoalesce(_optionalChain([config, 'access', _289 => _289.experimental, 'optionalAccess', _290 => _290.ppr]), () => ( false)),
7399
+ serverComponents: _nullishCoalesce(_optionalChain([config, 'access', _293 => _293.experimental, 'optionalAccess', _294 => _294.serverComponents]), () => ( false)),
7400
+ serverActions: _nullishCoalesce(_optionalChain([config, 'access', _295 => _295.experimental, 'optionalAccess', _296 => _296.serverActions]), () => ( false)),
7401
+ isolatedClientHydration: _nullishCoalesce(_optionalChain([config, 'access', _297 => _297.experimental, 'optionalAccess', _298 => _298.isolatedClientHydration]), () => ( "off")),
7402
+ ppr: _nullishCoalesce(_optionalChain([config, 'access', _299 => _299.experimental, 'optionalAccess', _300 => _300.ppr]), () => ( false)),
7402
7403
  ...config.experimental
7403
7404
  },
7404
7405
  agent: _nullishCoalesce(config.agent, () => ( {})),
@@ -7449,7 +7450,7 @@ function isResolvedAuthConfig(value) {
7449
7450
  }
7450
7451
  _chunkS3JO3N4Hcjs.__name.call(void 0, isResolvedAuthConfig, "isResolvedAuthConfig");
7451
7452
  function normalizeFarmAppAPIConfig(config) {
7452
- if (typeof _optionalChain([config, 'optionalAccess', _291 => _291.baseURL]) === "function" || typeof _optionalChain([config, 'optionalAccess', _292 => _292.basePath]) === "function") {
7453
+ if (typeof _optionalChain([config, 'optionalAccess', _301 => _301.baseURL]) === "function" || typeof _optionalChain([config, 'optionalAccess', _302 => _302.basePath]) === "function") {
7453
7454
  throw new Error(
7454
7455
  "Farm API config resolver functions must be processed with resolveConfig() before creating a FarmApp."
7455
7456
  );
@@ -7475,7 +7476,7 @@ function adaptPluginOption(pluginOption) {
7475
7476
  if (Array.isArray(pluginOption)) return pluginOption.map(adaptPluginOption);
7476
7477
  if (!pluginOption || typeof pluginOption !== "object") return pluginOption;
7477
7478
  const plugin = pluginOption;
7478
- if (!_optionalChain([plugin, 'access', _293 => _293.name, 'optionalAccess', _294 => _294.startsWith, 'call', _295 => _295("@tailwindcss/vite:generate:")])) return pluginOption;
7479
+ if (!_optionalChain([plugin, 'access', _303 => _303.name, 'optionalAccess', _304 => _304.startsWith, 'call', _305 => _305("@tailwindcss/vite:generate:")])) return pluginOption;
7479
7480
  if (isVitePluginHook(plugin.transform)) {
7480
7481
  return {
7481
7482
  ...plugin,
@@ -7561,7 +7562,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, createMissingTailwindPlugin, "createMissin
7561
7562
  var SHARP_INSTALL_HINT = _chunkLYLEZIG3cjs.formatOptionalPeerInstallHint.call(void 0, "sharp", "optimize images");
7562
7563
  var CLOUDFLARE_IMAGE_PRESETS = /* @__PURE__ */ new Set(["cloudflare", "cloudflare-pages", "cloudflare-module"]);
7563
7564
  function resolveFarmImageProviderForRuntime(images, options) {
7564
- const provider = _nullishCoalesce(_optionalChain([images, 'optionalAccess', _296 => _296.provider]), () => ( "auto"));
7565
+ const provider = _nullishCoalesce(_optionalChain([images, 'optionalAccess', _306 => _306.provider]), () => ( "auto"));
7565
7566
  if (provider === "none") return images;
7566
7567
  const usesSharp = options.dev ? true : provider === "node" || provider === "auto" && !CLOUDFLARE_IMAGE_PRESETS.has(options.preset || "");
7567
7568
  if (!usesSharp || _chunkLYLEZIG3cjs.isOptionalPeerInstalled.call(void 0, options.root, "sharp")) return images;
@@ -7586,7 +7587,7 @@ function validateSchemaSteps(owner, schema, steps) {
7586
7587
  const models = _chunkJSROZYYOcjs.resolveSchemaModels.call(void 0, owner, schema);
7587
7588
  const ids = /* @__PURE__ */ new Set();
7588
7589
  for (const step of steps) {
7589
- const where = `${owner} migration "${_optionalChain([step, 'optionalAccess', _297 => _297.id])}"`;
7590
+ const where = `${owner} migration "${_optionalChain([step, 'optionalAccess', _307 => _307.id])}"`;
7590
7591
  if (!step || typeof step.id !== "string" || step.id.trim() === "") {
7591
7592
  throw new TypeError(`${owner}: every migration step needs a non-empty \`id\`.`);
7592
7593
  }
@@ -7663,8 +7664,8 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, validateSchemaSteps, "validateSchemaSteps"
7663
7664
  var _FarmPluginOptionsError = class _FarmPluginOptionsError extends TypeError {
7664
7665
  constructor(issues) {
7665
7666
  const lines = issues.map((issue) => {
7666
- const path21 = formatIssuePath(issue.path);
7667
- return ` - ${path21 ? `${path21}: ` : ""}${issue.message}`;
7667
+ const path22 = formatIssuePath(issue.path);
7668
+ return ` - ${path22 ? `${path22}: ` : ""}${issue.message}`;
7668
7669
  });
7669
7670
  super(`Invalid plugin options:
7670
7671
  ${lines.join("\n")}`);
@@ -7674,9 +7675,9 @@ ${lines.join("\n")}`);
7674
7675
  };
7675
7676
  _chunkS3JO3N4Hcjs.__name.call(void 0, _FarmPluginOptionsError, "FarmPluginOptionsError");
7676
7677
  var FarmPluginOptionsError = _FarmPluginOptionsError;
7677
- function formatIssuePath(path21) {
7678
- if (!_optionalChain([path21, 'optionalAccess', _298 => _298.length])) return "";
7679
- return path21.map((segment) => {
7678
+ function formatIssuePath(path22) {
7679
+ if (!_optionalChain([path22, 'optionalAccess', _308 => _308.length])) return "";
7680
+ return path22.map((segment) => {
7680
7681
  const key = typeof segment === "object" && segment !== null ? segment.key : segment;
7681
7682
  return typeof key === "symbol" ? key.toString() : String(key);
7682
7683
  }).join(".");
@@ -7689,11 +7690,11 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, isPromiseLike, "isPromiseLike");
7689
7690
  function isPluginOptionsSchema(value) {
7690
7691
  if (typeof value !== "object" && typeof value !== "function" || value === null) return false;
7691
7692
  const standard = value["~standard"];
7692
- return typeof _optionalChain([standard, 'optionalAccess', _299 => _299.validate]) === "function";
7693
+ return typeof _optionalChain([standard, 'optionalAccess', _309 => _309.validate]) === "function";
7693
7694
  }
7694
7695
  _chunkS3JO3N4Hcjs.__name.call(void 0, isPluginOptionsSchema, "isPluginOptionsSchema");
7695
7696
  function parsePluginOptions(schema, options) {
7696
- const standard = _optionalChain([schema, 'optionalAccess', _300 => _300["~standard"]]);
7697
+ const standard = _optionalChain([schema, 'optionalAccess', _310 => _310["~standard"]]);
7697
7698
  if (!standard || typeof standard.validate !== "function") {
7698
7699
  throw new TypeError(
7699
7700
  "A plugin's `options` needs a Standard Schema, such as a Zod, Valibot, or ArkType schema."
@@ -7753,9 +7754,9 @@ function normalizeRuntimeEndpointRequestPath(pathname) {
7753
7754
  _chunkS3JO3N4Hcjs.__name.call(void 0, normalizeRuntimeEndpointRequestPath, "normalizeRuntimeEndpointRequestPath");
7754
7755
  function farmPluginMayAffectRuntimePath(plugin, pathname) {
7755
7756
  const runtime = plugin.runtime;
7756
- const endpoints = _optionalChain([runtime, 'optionalAccess', _301 => _301.endpoints]);
7757
+ const endpoints = _optionalChain([runtime, 'optionalAccess', _311 => _311.endpoints]);
7757
7758
  const hasUnscopedRequestHooks = Boolean(
7758
- plugin.init || plugin.ready || plugin.shutdown || _optionalChain([runtime, 'optionalAccess', _302 => _302.context]) || _optionalChain([runtime, 'optionalAccess', _303 => _303.before]) || _optionalChain([runtime, 'optionalAccess', _304 => _304.after]) || _optionalChain([runtime, 'optionalAccess', _305 => _305.error]) || plugin.router || plugin.render || plugin.beforeRouteMatch || plugin.afterRouteMatch || plugin.beforeRender || plugin.afterRender || plugin.onError || plugin.transformHTML || plugin.beforeRequest || plugin.afterResponse
7759
+ plugin.init || plugin.ready || plugin.shutdown || _optionalChain([runtime, 'optionalAccess', _312 => _312.context]) || _optionalChain([runtime, 'optionalAccess', _313 => _313.before]) || _optionalChain([runtime, 'optionalAccess', _314 => _314.after]) || _optionalChain([runtime, 'optionalAccess', _315 => _315.error]) || plugin.router || plugin.render || plugin.beforeRouteMatch || plugin.afterRouteMatch || plugin.beforeRender || plugin.afterRender || plugin.onError || plugin.transformHTML || plugin.beforeRequest || plugin.afterResponse
7759
7760
  );
7760
7761
  if (hasUnscopedRequestHooks) return true;
7761
7762
  if (Array.isArray(endpoints) && endpoints.length > 0) {
@@ -7767,7 +7768,7 @@ function farmPluginMayAffectRuntimePath(plugin, pathname) {
7767
7768
  ) === normalizedPathname
7768
7769
  );
7769
7770
  }
7770
- return Boolean(plugin.setup || _optionalChain([runtime, 'optionalAccess', _306 => _306.start]) || _optionalChain([runtime, 'optionalAccess', _307 => _307.close]));
7771
+ return Boolean(plugin.setup || _optionalChain([runtime, 'optionalAccess', _316 => _316.start]) || _optionalChain([runtime, 'optionalAccess', _317 => _317.close]));
7771
7772
  }
7772
7773
  _chunkS3JO3N4Hcjs.__name.call(void 0, farmPluginMayAffectRuntimePath, "farmPluginMayAffectRuntimePath");
7773
7774
 
@@ -7826,28 +7827,28 @@ var _PluginManager = class _PluginManager {
7826
7827
  },
7827
7828
  requestContext: {
7828
7829
  set(target, key, value, options) {
7829
- _chunkEM6SBQKMcjs.setRequestContext.call(void 0, target, key, value, options);
7830
+ _chunkOMVAU7NTcjs.setRequestContext.call(void 0, target, key, value, options);
7830
7831
  },
7831
7832
  get(target, key) {
7832
- return _chunkEM6SBQKMcjs.getRequestContext.call(void 0, target, key);
7833
+ return _chunkOMVAU7NTcjs.getRequestContext.call(void 0, target, key);
7833
7834
  },
7834
7835
  has(target, key) {
7835
- return _chunkEM6SBQKMcjs.hasRequestContext.call(void 0, target, key);
7836
+ return _chunkOMVAU7NTcjs.hasRequestContext.call(void 0, target, key);
7836
7837
  },
7837
7838
  delete(target, key) {
7838
- return _chunkEM6SBQKMcjs.deleteRequestContext.call(void 0, target, key);
7839
+ return _chunkOMVAU7NTcjs.deleteRequestContext.call(void 0, target, key);
7839
7840
  },
7840
7841
  clear(target) {
7841
- _chunkEM6SBQKMcjs.clearRequestContext.call(void 0, target);
7842
+ _chunkOMVAU7NTcjs.clearRequestContext.call(void 0, target);
7842
7843
  },
7843
7844
  getAll(target, options) {
7844
- return _chunkEM6SBQKMcjs.getRequestContextSnapshot.call(void 0, target, options);
7845
+ return _chunkOMVAU7NTcjs.getRequestContextSnapshot.call(void 0, target, options);
7845
7846
  }
7846
7847
  }
7847
7848
  };
7848
7849
  }
7849
7850
  createPluginHookContext(plugin, context = this.context) {
7850
- const integration = _chunkTDFPACVXcjs.getFarmPluginIntegrationContext.call(void 0, plugin);
7851
+ const integration = _chunkFTFYRMQQcjs.getFarmPluginIntegrationContext.call(void 0, plugin);
7851
7852
  return integration ? { ...context, integration } : context;
7852
7853
  }
7853
7854
  createRequestHookContext(target, plugin) {
@@ -7877,7 +7878,7 @@ var _PluginManager = class _PluginManager {
7877
7878
  };
7878
7879
  }
7879
7880
  copyRequestStore(source, target) {
7880
- _chunkEM6SBQKMcjs.copyRequestContext.call(void 0, source, target);
7881
+ _chunkOMVAU7NTcjs.copyRequestContext.call(void 0, source, target);
7881
7882
  }
7882
7883
  copyRuntimeRequestContext(source, target) {
7883
7884
  const runtimeContext = this.runtimeRequestContexts.get(source);
@@ -7901,7 +7902,7 @@ var _PluginManager = class _PluginManager {
7901
7902
  const endpoints = [];
7902
7903
  const owners = /* @__PURE__ */ new Map();
7903
7904
  for (const plugin of this.getSortedPlugins()) {
7904
- const configured = _optionalChain([plugin, 'access', _308 => _308.runtime, 'optionalAccess', _309 => _309.endpoints]);
7905
+ const configured = _optionalChain([plugin, 'access', _318 => _318.runtime, 'optionalAccess', _319 => _319.endpoints]);
7905
7906
  if (configured === void 0) continue;
7906
7907
  if (!Array.isArray(configured)) {
7907
7908
  throw new TypeError(`Farm plugin "${plugin.name}" runtime.endpoints must be an array`);
@@ -7912,23 +7913,23 @@ var _PluginManager = class _PluginManager {
7912
7913
  `Farm plugin "${plugin.name}" runtime.endpoints must contain endpoint objects`
7913
7914
  );
7914
7915
  }
7915
- const path21 = normalizeFarmPluginRuntimeEndpointPath(
7916
+ const path22 = normalizeFarmPluginRuntimeEndpointPath(
7916
7917
  endpoint.path,
7917
7918
  `Farm plugin "${plugin.name}" runtime endpoint`
7918
7919
  );
7919
7920
  if (typeof endpoint.handler !== "function") {
7920
7921
  throw new TypeError(
7921
- `Farm plugin "${plugin.name}" runtime endpoint ${path21} requires a handler`
7922
+ `Farm plugin "${plugin.name}" runtime endpoint ${path22} requires a handler`
7922
7923
  );
7923
7924
  }
7924
- const owner = owners.get(path21);
7925
+ const owner = owners.get(path22);
7925
7926
  if (owner) {
7926
7927
  throw new Error(
7927
- `Farm plugin runtime endpoint ${path21} from "${plugin.name}" conflicts with "${owner}"`
7928
+ `Farm plugin runtime endpoint ${path22} from "${plugin.name}" conflicts with "${owner}"`
7928
7929
  );
7929
7930
  }
7930
- owners.set(path21, plugin.name);
7931
- endpoints.push({ plugin, endpoint, path: path21 });
7931
+ owners.set(path22, plugin.name);
7932
+ endpoints.push({ plugin, endpoint, path: path22 });
7932
7933
  }
7933
7934
  }
7934
7935
  this.runtimeEndpoints = endpoints;
@@ -7972,7 +7973,7 @@ var _PluginManager = class _PluginManager {
7972
7973
  const values = {};
7973
7974
  const owners = /* @__PURE__ */ new Map();
7974
7975
  for (const plugin of this.getSortedPlugins()) {
7975
- const createContext = _optionalChain([plugin, 'access', _310 => _310.runtime, 'optionalAccess', _311 => _311.context]);
7976
+ const createContext = _optionalChain([plugin, 'access', _320 => _320.runtime, 'optionalAccess', _321 => _321.context]);
7976
7977
  if (!createContext) continue;
7977
7978
  const result = await createContext(
7978
7979
  this.createRuntimeBaseEvent(plugin, request2, options, waitUntil)
@@ -7998,7 +7999,7 @@ var _PluginManager = class _PluginManager {
7998
7999
  }
7999
8000
  async runRuntimeErrorHooks(request2, error, ctx, durationMs, options, waitUntil) {
8000
8001
  for (const plugin of this.getSortedPlugins()) {
8001
- const onError = _optionalChain([plugin, 'access', _312 => _312.runtime, 'optionalAccess', _313 => _313.error]);
8002
+ const onError = _optionalChain([plugin, 'access', _322 => _322.runtime, 'optionalAccess', _323 => _323.error]);
8002
8003
  if (!onError) continue;
8003
8004
  try {
8004
8005
  await onError({
@@ -8042,19 +8043,19 @@ var _PluginManager = class _PluginManager {
8042
8043
  case "config":
8043
8044
  if (plugin.configure) {
8044
8045
  hooks.push(
8045
- (config, context) => _optionalChain([plugin, 'access', _314 => _314.configure, 'optionalCall', _315 => _315(config, context)])
8046
+ (config, context) => _optionalChain([plugin, 'access', _324 => _324.configure, 'optionalCall', _325 => _325(config, context)])
8046
8047
  );
8047
8048
  }
8048
8049
  break;
8049
8050
  case "ready":
8050
- if (_optionalChain([plugin, 'access', _316 => _316.runtime, 'optionalAccess', _317 => _317.start])) {
8051
- hooks.push((context) => _optionalChain([plugin, 'access', _318 => _318.runtime, 'optionalAccess', _319 => _319.start, 'optionalCall', _320 => _320(withState(context))]));
8051
+ if (_optionalChain([plugin, 'access', _326 => _326.runtime, 'optionalAccess', _327 => _327.start])) {
8052
+ hooks.push((context) => _optionalChain([plugin, 'access', _328 => _328.runtime, 'optionalAccess', _329 => _329.start, 'optionalCall', _330 => _330(withState(context))]));
8052
8053
  }
8053
8054
  break;
8054
8055
  case "shutdown":
8055
- if (_optionalChain([plugin, 'access', _321 => _321.runtime, 'optionalAccess', _322 => _322.close])) {
8056
+ if (_optionalChain([plugin, 'access', _331 => _331.runtime, 'optionalAccess', _332 => _332.close])) {
8056
8057
  hooks.push(
8057
- (payload, context) => _optionalChain([plugin, 'access', _323 => _323.runtime, 'optionalAccess', _324 => _324.close, 'optionalCall', _325 => _325({
8058
+ (payload, context) => _optionalChain([plugin, 'access', _333 => _333.runtime, 'optionalAccess', _334 => _334.close, 'optionalCall', _335 => _335({
8058
8059
  ...withState(context),
8059
8060
  reason: payload.reason
8060
8061
  })])
@@ -8062,93 +8063,93 @@ var _PluginManager = class _PluginManager {
8062
8063
  }
8063
8064
  break;
8064
8065
  case "routeDiscovered":
8065
- if (_optionalChain([plugin, 'access', _326 => _326.router, 'optionalAccess', _327 => _327.discovered])) {
8066
+ if (_optionalChain([plugin, 'access', _336 => _336.router, 'optionalAccess', _337 => _337.discovered])) {
8066
8067
  hooks.push(
8067
- (route, context) => _optionalChain([plugin, 'access', _328 => _328.router, 'optionalAccess', _329 => _329.discovered, 'optionalCall', _330 => _330(route, withState(context))])
8068
+ (route, context) => _optionalChain([plugin, 'access', _338 => _338.router, 'optionalAccess', _339 => _339.discovered, 'optionalCall', _340 => _340(route, withState(context))])
8068
8069
  );
8069
8070
  }
8070
8071
  break;
8071
8072
  case "middlewareDiscovered":
8072
- if (_optionalChain([plugin, 'access', _331 => _331.router, 'optionalAccess', _332 => _332.discovered])) {
8073
+ if (_optionalChain([plugin, 'access', _341 => _341.router, 'optionalAccess', _342 => _342.discovered])) {
8073
8074
  hooks.push(
8074
- (route, context) => _optionalChain([plugin, 'access', _333 => _333.router, 'optionalAccess', _334 => _334.discovered, 'optionalCall', _335 => _335({ kind: "middleware", ...route }, withState(context))])
8075
+ (route, context) => _optionalChain([plugin, 'access', _343 => _343.router, 'optionalAccess', _344 => _344.discovered, 'optionalCall', _345 => _345({ kind: "middleware", ...route }, withState(context))])
8075
8076
  );
8076
8077
  }
8077
8078
  break;
8078
8079
  case "apiRouteDiscovered":
8079
- if (_optionalChain([plugin, 'access', _336 => _336.router, 'optionalAccess', _337 => _337.discovered])) {
8080
+ if (_optionalChain([plugin, 'access', _346 => _346.router, 'optionalAccess', _347 => _347.discovered])) {
8080
8081
  hooks.push(
8081
- (route, context) => _optionalChain([plugin, 'access', _338 => _338.router, 'optionalAccess', _339 => _339.discovered, 'optionalCall', _340 => _340({ kind: "api", ...route }, withState(context))])
8082
+ (route, context) => _optionalChain([plugin, 'access', _348 => _348.router, 'optionalAccess', _349 => _349.discovered, 'optionalCall', _350 => _350({ kind: "api", ...route }, withState(context))])
8082
8083
  );
8083
8084
  }
8084
8085
  break;
8085
8086
  case "routesGenerated":
8086
- if (_optionalChain([plugin, 'access', _341 => _341.router, 'optionalAccess', _342 => _342.generated])) {
8087
+ if (_optionalChain([plugin, 'access', _351 => _351.router, 'optionalAccess', _352 => _352.generated])) {
8087
8088
  hooks.push(
8088
- (routes, context) => _optionalChain([plugin, 'access', _343 => _343.router, 'optionalAccess', _344 => _344.generated, 'optionalCall', _345 => _345(routes, withState(context))])
8089
+ (routes, context) => _optionalChain([plugin, 'access', _353 => _353.router, 'optionalAccess', _354 => _354.generated, 'optionalCall', _355 => _355(routes, withState(context))])
8089
8090
  );
8090
8091
  }
8091
8092
  break;
8092
8093
  case "beforeRouteMatch":
8093
- if (_optionalChain([plugin, 'access', _346 => _346.router, 'optionalAccess', _347 => _347.before])) {
8094
+ if (_optionalChain([plugin, 'access', _356 => _356.router, 'optionalAccess', _357 => _357.before])) {
8094
8095
  hooks.push(
8095
- (route, context) => _optionalChain([plugin, 'access', _348 => _348.router, 'optionalAccess', _349 => _349.before, 'optionalCall', _350 => _350(route, withState(context))])
8096
+ (route, context) => _optionalChain([plugin, 'access', _358 => _358.router, 'optionalAccess', _359 => _359.before, 'optionalCall', _360 => _360(route, withState(context))])
8096
8097
  );
8097
8098
  }
8098
8099
  break;
8099
8100
  case "afterRouteMatch":
8100
- if (_optionalChain([plugin, 'access', _351 => _351.router, 'optionalAccess', _352 => _352.after])) {
8101
+ if (_optionalChain([plugin, 'access', _361 => _361.router, 'optionalAccess', _362 => _362.after])) {
8101
8102
  hooks.push(
8102
- (result, context) => _optionalChain([plugin, 'access', _353 => _353.router, 'optionalAccess', _354 => _354.after, 'optionalCall', _355 => _355(result, withState(context))])
8103
+ (result, context) => _optionalChain([plugin, 'access', _363 => _363.router, 'optionalAccess', _364 => _364.after, 'optionalCall', _365 => _365(result, withState(context))])
8103
8104
  );
8104
8105
  }
8105
8106
  break;
8106
8107
  case "beforeRender":
8107
- if (_optionalChain([plugin, 'access', _356 => _356.render, 'optionalAccess', _357 => _357.before])) {
8108
+ if (_optionalChain([plugin, 'access', _366 => _366.render, 'optionalAccess', _367 => _367.before])) {
8108
8109
  hooks.push(
8109
- (render, context) => _optionalChain([plugin, 'access', _358 => _358.render, 'optionalAccess', _359 => _359.before, 'optionalCall', _360 => _360(render, withState(context))])
8110
+ (render, context) => _optionalChain([plugin, 'access', _368 => _368.render, 'optionalAccess', _369 => _369.before, 'optionalCall', _370 => _370(render, withState(context))])
8110
8111
  );
8111
8112
  }
8112
8113
  break;
8113
8114
  case "afterRender":
8114
- if (_optionalChain([plugin, 'access', _361 => _361.render, 'optionalAccess', _362 => _362.html])) {
8115
+ if (_optionalChain([plugin, 'access', _371 => _371.render, 'optionalAccess', _372 => _372.html])) {
8115
8116
  hooks.push(
8116
- (html, render, context) => _optionalChain([plugin, 'access', _363 => _363.render, 'optionalAccess', _364 => _364.html, 'optionalCall', _365 => _365(html, render, withState(context))])
8117
+ (html, render, context) => _optionalChain([plugin, 'access', _373 => _373.render, 'optionalAccess', _374 => _374.html, 'optionalCall', _375 => _375(html, render, withState(context))])
8117
8118
  );
8118
8119
  }
8119
8120
  break;
8120
8121
  case "beforeBundle":
8121
- if (_optionalChain([plugin, 'access', _366 => _366.build, 'optionalAccess', _367 => _367.before])) {
8122
+ if (_optionalChain([plugin, 'access', _376 => _376.build, 'optionalAccess', _377 => _377.before])) {
8122
8123
  hooks.push(
8123
- (bundle, context) => _optionalChain([plugin, 'access', _368 => _368.build, 'optionalAccess', _369 => _369.before, 'optionalCall', _370 => _370(bundle, withState(context))])
8124
+ (bundle, context) => _optionalChain([plugin, 'access', _378 => _378.build, 'optionalAccess', _379 => _379.before, 'optionalCall', _380 => _380(bundle, withState(context))])
8124
8125
  );
8125
8126
  }
8126
8127
  break;
8127
8128
  case "beforeNitroBuild":
8128
- if (_optionalChain([plugin, 'access', _371 => _371.build, 'optionalAccess', _372 => _372.configure])) {
8129
+ if (_optionalChain([plugin, 'access', _381 => _381.build, 'optionalAccess', _382 => _382.configure])) {
8129
8130
  hooks.push(
8130
- (buildConfig, context) => _optionalChain([plugin, 'access', _373 => _373.build, 'optionalAccess', _374 => _374.configure, 'optionalCall', _375 => _375(buildConfig, withState(context))])
8131
+ (buildConfig, context) => _optionalChain([plugin, 'access', _383 => _383.build, 'optionalAccess', _384 => _384.configure, 'optionalCall', _385 => _385(buildConfig, withState(context))])
8131
8132
  );
8132
8133
  }
8133
8134
  break;
8134
8135
  case "afterBundle":
8135
- if (_optionalChain([plugin, 'access', _376 => _376.build, 'optionalAccess', _377 => _377.after])) {
8136
+ if (_optionalChain([plugin, 'access', _386 => _386.build, 'optionalAccess', _387 => _387.after])) {
8136
8137
  hooks.push(
8137
- (result, context) => _optionalChain([plugin, 'access', _378 => _378.build, 'optionalAccess', _379 => _379.after, 'optionalCall', _380 => _380(result, withState(context))])
8138
+ (result, context) => _optionalChain([plugin, 'access', _388 => _388.build, 'optionalAccess', _389 => _389.after, 'optionalCall', _390 => _390(result, withState(context))])
8138
8139
  );
8139
8140
  }
8140
8141
  break;
8141
8142
  case "devServerCreated":
8142
- if (_optionalChain([plugin, 'access', _381 => _381.dev, 'optionalAccess', _382 => _382.server])) {
8143
+ if (_optionalChain([plugin, 'access', _391 => _391.dev, 'optionalAccess', _392 => _392.server])) {
8143
8144
  hooks.push(
8144
- (server, context) => _optionalChain([plugin, 'access', _383 => _383.dev, 'optionalAccess', _384 => _384.server, 'optionalCall', _385 => _385(server, withState(context))])
8145
+ (server, context) => _optionalChain([plugin, 'access', _393 => _393.dev, 'optionalAccess', _394 => _394.server, 'optionalCall', _395 => _395(server, withState(context))])
8145
8146
  );
8146
8147
  }
8147
8148
  break;
8148
8149
  case "hmrUpdate":
8149
- if (_optionalChain([plugin, 'access', _386 => _386.dev, 'optionalAccess', _387 => _387.update])) {
8150
+ if (_optionalChain([plugin, 'access', _396 => _396.dev, 'optionalAccess', _397 => _397.update])) {
8150
8151
  hooks.push(
8151
- (update, context) => _optionalChain([plugin, 'access', _388 => _388.dev, 'optionalAccess', _389 => _389.update, 'optionalCall', _390 => _390(update, withState(context))])
8152
+ (update, context) => _optionalChain([plugin, 'access', _398 => _398.dev, 'optionalAccess', _399 => _399.update, 'optionalCall', _400 => _400(update, withState(context))])
8152
8153
  );
8153
8154
  }
8154
8155
  break;
@@ -8194,7 +8195,7 @@ var _PluginManager = class _PluginManager {
8194
8195
  hasRuntimeHook(hookName) {
8195
8196
  const cached = this.runtimeHookPresence.get(hookName);
8196
8197
  if (cached !== void 0) return cached;
8197
- const present = this.plugins.some((plugin) => typeof _optionalChain([plugin, 'access', _391 => _391.runtime, 'optionalAccess', _392 => _392[hookName]]) === "function");
8198
+ const present = this.plugins.some((plugin) => typeof _optionalChain([plugin, 'access', _401 => _401.runtime, 'optionalAccess', _402 => _402[hookName]]) === "function");
8198
8199
  this.runtimeHookPresence.set(hookName, present);
8199
8200
  return present;
8200
8201
  }
@@ -8273,7 +8274,7 @@ var _PluginManager = class _PluginManager {
8273
8274
  async beginRuntimeRequest(request2, options = {}) {
8274
8275
  await this.startRuntime();
8275
8276
  const startedAt = Date.now();
8276
- const waitUntil = options.waitUntil ? (promise) => _optionalChain([options, 'access', _393 => _393.waitUntil, 'optionalCall', _394 => _394(Promise.resolve(promise))]) : (promise) => {
8277
+ const waitUntil = options.waitUntil ? (promise) => _optionalChain([options, 'access', _403 => _403.waitUntil, 'optionalCall', _404 => _404(Promise.resolve(promise))]) : (promise) => {
8277
8278
  void Promise.resolve(promise).catch(() => {
8278
8279
  });
8279
8280
  };
@@ -8306,7 +8307,7 @@ var _PluginManager = class _PluginManager {
8306
8307
  );
8307
8308
  let response;
8308
8309
  for (const plugin of this.getSortedPlugins()) {
8309
- const before = _optionalChain([plugin, 'access', _395 => _395.runtime, 'optionalAccess', _396 => _396.before]);
8310
+ const before = _optionalChain([plugin, 'access', _405 => _405.runtime, 'optionalAccess', _406 => _406.before]);
8310
8311
  if (!before) continue;
8311
8312
  const result = await before({
8312
8313
  ...this.createRuntimeBaseEvent(plugin, activeRequest, activeOptions, waitUntil),
@@ -8352,7 +8353,7 @@ var _PluginManager = class _PluginManager {
8352
8353
  let response = initialResponse;
8353
8354
  try {
8354
8355
  for (const plugin of this.getSortedPlugins()) {
8355
- const after = _optionalChain([plugin, 'access', _397 => _397.runtime, 'optionalAccess', _398 => _398.after]);
8356
+ const after = _optionalChain([plugin, 'access', _407 => _407.runtime, 'optionalAccess', _408 => _408.after]);
8356
8357
  if (!after) continue;
8357
8358
  const result = await after({
8358
8359
  ...this.createRuntimeBaseEvent(
@@ -8441,7 +8442,7 @@ var _PluginManager = class _PluginManager {
8441
8442
  /** @internal Runs hooks for only the plugins selected by the runtime adapter. */
8442
8443
  async runHookParallelFiltered(hookName, include, ...args) {
8443
8444
  if (hookName === "shutdown" && !this.runtimeShutdownHooksRunning) {
8444
- await this.closeRuntime(_optionalChain([args, 'access', _399 => _399[0], 'optionalAccess', _400 => _400.reason]));
8445
+ await this.closeRuntime(_optionalChain([args, 'access', _409 => _409[0], 'optionalAccess', _410 => _410.reason]));
8445
8446
  return false;
8446
8447
  }
8447
8448
  const plugins = this.getSortedPlugins().filter(include);
@@ -8554,7 +8555,7 @@ function createPluginFactory(definition) {
8554
8555
  configure: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (config, context) => configure(config, { ...context, options }), "configure")
8555
8556
  } : {},
8556
8557
  setup(context) {
8557
- const state = _optionalChain([setup, 'optionalCall', _401 => _401({ ...context, options })]);
8558
+ const state = _optionalChain([setup, 'optionalCall', _411 => _411({ ...context, options })]);
8558
8559
  return state instanceof Promise ? state.then(resolveState) : resolveState(state);
8559
8560
  }
8560
8561
  });
@@ -8595,10 +8596,10 @@ function declarePluginSchema(plugin) {
8595
8596
  models: Object.keys(models).filter((key) => !models[key].external),
8596
8597
  ...plugin.dependsOn ? { dependsOn: plugin.dependsOn.map(_chunk6MVFL3R5cjs.pluginShortName) } : {},
8597
8598
  ...plugin.version ? { version: plugin.version } : {},
8598
- ..._optionalChain([plugin, 'access', _402 => _402.migrations, 'optionalAccess', _403 => _403.length]) ? { migrations: plugin.migrations } : {},
8599
- dialect: _optionalChain([database, 'optionalAccess', _404 => _404.dialect]),
8599
+ ..._optionalChain([plugin, 'access', _412 => _412.migrations, 'optionalAccess', _413 => _413.length]) ? { migrations: plugin.migrations } : {},
8600
+ dialect: _optionalChain([database, 'optionalAccess', _414 => _414.dialect]),
8600
8601
  resolveClient: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (config) => {
8601
- if (_optionalChain([database, 'optionalAccess', _405 => _405.client]) !== void 0 && database.client !== null) {
8602
+ if (_optionalChain([database, 'optionalAccess', _415 => _415.client]) !== void 0 && database.client !== null) {
8602
8603
  const client2 = typeof database.client === "function" ? await database.client() : database.client;
8603
8604
  if (client2 === void 0 || client2 === null) {
8604
8605
  throw new Error(`The ${name} plugin's \`database.client\` returned no connection.`);
@@ -8652,7 +8653,7 @@ function resolveFarmAppClientEntry(root = process.cwd(), srcDir = "src") {
8652
8653
  }
8653
8654
  _chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmAppClientEntry, "resolveFarmAppClientEntry");
8654
8655
  function resolveFarmClientPlugins(plugins, _root) {
8655
- if (!_optionalChain([plugins, 'optionalAccess', _406 => _406.length])) return [];
8656
+ if (!_optionalChain([plugins, 'optionalAccess', _416 => _416.length])) return [];
8656
8657
  return plugins.flatMap((plugin) => {
8657
8658
  if (!plugin.client) return [];
8658
8659
  assertClientLifecycle(plugin.client, plugin.name);
@@ -8732,7 +8733,7 @@ function assertLifecycleObject(value, pluginName, location, allowedKeys) {
8732
8733
  throw new TypeError(`Client plugin "${pluginName}" has an unknown ${location}.${key} option`);
8733
8734
  }
8734
8735
  const descriptor = Object.getOwnPropertyDescriptor(value, key);
8735
- if (!_optionalChain([descriptor, 'optionalAccess', _407 => _407.enumerable])) {
8736
+ if (!_optionalChain([descriptor, 'optionalAccess', _417 => _417.enumerable])) {
8736
8737
  throw new TypeError(`Client plugin "${pluginName}" ${location}.${key} must be enumerable`);
8737
8738
  }
8738
8739
  if (!("value" in descriptor)) {
@@ -8856,7 +8857,7 @@ function assertPublicData(value, pluginName) {
8856
8857
  throwPublicDataError(pluginName, pathSegments, "cannot contain symbol keys");
8857
8858
  }
8858
8859
  const descriptor = Object.getOwnPropertyDescriptor(current, key);
8859
- if (!_optionalChain([descriptor, 'optionalAccess', _408 => _408.enumerable])) {
8860
+ if (!_optionalChain([descriptor, 'optionalAccess', _418 => _418.enumerable])) {
8860
8861
  throwPublicDataError(
8861
8862
  pluginName,
8862
8863
  [...pathSegments, key],
@@ -8902,8 +8903,8 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, isArrayIndex, "isArrayIndex");
8902
8903
 
8903
8904
  var ADAPTER_EXTENSIONS = ["ts", "tsx", "js", "jsx", "mts", "mjs"];
8904
8905
  function resolveFarmClientCacheAdapterEntry(root, cache2) {
8905
- const client = _optionalChain([cache2, 'optionalAccess', _409 => _409.client]);
8906
- const adapter = _optionalChain([client, 'optionalAccess', _410 => _410.adapter]);
8906
+ const client = _optionalChain([cache2, 'optionalAccess', _419 => _419.client]);
8907
+ const adapter = _optionalChain([client, 'optionalAccess', _420 => _420.adapter]);
8907
8908
  if (adapter === void 0) return void 0;
8908
8909
  if (typeof adapter !== "string" || adapter.trim().length === 0) {
8909
8910
  throw new Error(
@@ -8918,8 +8919,8 @@ function resolveFarmClientCacheAdapterEntry(root, cache2) {
8918
8919
  );
8919
8920
  }
8920
8921
  const options = {};
8921
- if (_optionalChain([client, 'optionalAccess', _411 => _411.version]) !== void 0) options.version = client.version;
8922
- if (_optionalChain([client, 'optionalAccess', _412 => _412.flushDelayMs]) !== void 0) options.flushDelayMs = client.flushDelayMs;
8922
+ if (_optionalChain([client, 'optionalAccess', _421 => _421.version]) !== void 0) options.version = client.version;
8923
+ if (_optionalChain([client, 'optionalAccess', _422 => _422.flushDelayMs]) !== void 0) options.flushDelayMs = client.flushDelayMs;
8923
8924
  return { importPath: found.replace(/\\/g, "/"), options };
8924
8925
  }
8925
8926
  _chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmClientCacheAdapterEntry, "resolveFarmClientCacheAdapterEntry");
@@ -9048,9 +9049,9 @@ function staticValue(node) {
9048
9049
  }
9049
9050
  _chunkS3JO3N4Hcjs.__name.call(void 0, staticValue, "staticValue");
9050
9051
  function property(object, name) {
9051
- return _optionalChain([object, 'access', _413 => _413.properties, 'access', _414 => _414.find, 'call', _415 => _415(
9052
+ return _optionalChain([object, 'access', _423 => _423.properties, 'access', _424 => _424.find, 'call', _425 => _425(
9052
9053
  (entry) => entry.type === "Property" && !entry.computed && (entry.key.name === name || entry.key.value === name)
9053
- ), 'optionalAccess', _416 => _416.value]);
9054
+ ), 'optionalAccess', _426 => _426.value]);
9054
9055
  }
9055
9056
  _chunkS3JO3N4Hcjs.__name.call(void 0, property, "property");
9056
9057
  function toolFromObject(object) {
@@ -9098,7 +9099,7 @@ function findFarmWebMCPTools(code, filename = "module.tsx") {
9098
9099
  if (statement.type !== "ImportDeclaration" || statement.source.value !== WEBMCP_CLIENT)
9099
9100
  continue;
9100
9101
  for (const specifier of statement.specifiers) {
9101
- const imported = _nullishCoalesce(_optionalChain([specifier, 'access', _417 => _417.imported, 'optionalAccess', _418 => _418.name]), () => ( _optionalChain([specifier, 'access', _419 => _419.imported, 'optionalAccess', _420 => _420.value])));
9102
+ const imported = _nullishCoalesce(_optionalChain([specifier, 'access', _427 => _427.imported, 'optionalAccess', _428 => _428.name]), () => ( _optionalChain([specifier, 'access', _429 => _429.imported, 'optionalAccess', _430 => _430.value])));
9102
9103
  if (specifier.type === "ImportSpecifier" && DEFINERS.has(imported))
9103
9104
  locals.set(specifier.local.name, imported);
9104
9105
  }
@@ -9114,7 +9115,7 @@ function findFarmWebMCPTools(code, filename = "module.tsx") {
9114
9115
  const [argument] = current.arguments;
9115
9116
  if (definer && argument) {
9116
9117
  const objects = definer === "registerWebMCPTools" ? argument.type === "ArrayExpression" ? argument.elements.filter(
9117
- (element) => _optionalChain([element, 'optionalAccess', _421 => _421.type]) === "ObjectExpression"
9118
+ (element) => _optionalChain([element, 'optionalAccess', _431 => _431.type]) === "ObjectExpression"
9118
9119
  ) : [] : argument.type === "ObjectExpression" ? [argument] : [];
9119
9120
  for (const object of objects) {
9120
9121
  const tool = toolFromObject(object);
@@ -9300,8 +9301,8 @@ async function isAllowedPreviewRequest(server, options, req) {
9300
9301
  if (method !== "GET" && method !== "HEAD") return true;
9301
9302
  const file = await resolveRequestedFile(server, pathname);
9302
9303
  if (!file) return true;
9303
- const client = _optionalChain([server, 'access', _422 => _422.environments, 'optionalAccess', _423 => _423.client]);
9304
- const inClientGraph = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => Boolean(await _optionalChain([client, 'optionalAccess', _424 => _424.moduleGraph, 'access', _425 => _425.getModuleByUrl, 'call', _426 => _426(url)])), "inClientGraph");
9304
+ const client = _optionalChain([server, 'access', _432 => _432.environments, 'optionalAccess', _433 => _433.client]);
9305
+ const inClientGraph = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => Boolean(await _optionalChain([client, 'optionalAccess', _434 => _434.moduleGraph, 'access', _435 => _435.getModuleByUrl, 'call', _436 => _436(url)])), "inClientGraph");
9305
9306
  if (SOURCE_QUERY_FLAGS.some((flag) => query.has(flag))) return inClientGraph();
9306
9307
  if (await inClientGraph()) return true;
9307
9308
  if (file.split(path16.sep).includes("node_modules")) return true;
@@ -9330,10 +9331,10 @@ async function resolveRequestedFile(server, pathname) {
9330
9331
  id = id.slice("/@id/".length).replace(/^__x00__/, "\0");
9331
9332
  if (id.startsWith("\0")) return void 0;
9332
9333
  }
9333
- const resolved = await _optionalChain([server, 'access', _427 => _427.environments, 'optionalAccess', _428 => _428.client, 'optionalAccess', _429 => _429.pluginContainer, 'access', _430 => _430.resolveId, 'call', _431 => _431(id, void 0)]);
9334
- const resolvedId = _optionalChain([resolved, 'optionalAccess', _432 => _432.id, 'access', _433 => _433.replace, 'call', _434 => _434(/[?#].*$/, "")]);
9334
+ const resolved = await _optionalChain([server, 'access', _437 => _437.environments, 'optionalAccess', _438 => _438.client, 'optionalAccess', _439 => _439.pluginContainer, 'access', _440 => _440.resolveId, 'call', _441 => _441(id, void 0)]);
9335
+ const resolvedId = _optionalChain([resolved, 'optionalAccess', _442 => _442.id, 'access', _443 => _443.replace, 'call', _444 => _444(/[?#].*$/, "")]);
9335
9336
  if (resolvedId && path16.isAbsolute(resolvedId)) candidate = resolvedId;
9336
- else if (_optionalChain([resolvedId, 'optionalAccess', _435 => _435.startsWith, 'call', _436 => _436("\0")])) return void 0;
9337
+ else if (_optionalChain([resolvedId, 'optionalAccess', _445 => _445.startsWith, 'call', _446 => _446("\0")])) return void 0;
9337
9338
  else if (id.startsWith("/")) candidate = path16.join(server.config.root, id);
9338
9339
  }
9339
9340
  if (!candidate) return void 0;
@@ -9370,7 +9371,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, isInside, "isInside");
9370
9371
  function shouldBypassFarmRouterForDottedPath(pathname, routeManager, baseDirs, generatedPaths = []) {
9371
9372
  if (!pathname.includes(".") || pathname.endsWith(".html")) return false;
9372
9373
  const matchesAppRoute = Boolean(
9373
- _optionalChain([routeManager, 'optionalAccess', _437 => _437.matchRoute, 'call', _438 => _438(pathname), 'optionalAccess', _439 => _439.route]) || _optionalChain([routeManager, 'optionalAccess', _440 => _440.matchMetadataRoute, 'call', _441 => _441(pathname)]) || _optionalChain([routeManager, 'optionalAccess', _442 => _442.matchMetadataImage, 'call', _443 => _443(pathname)]) || generatedPaths.includes(pathname)
9374
+ _optionalChain([routeManager, 'optionalAccess', _447 => _447.matchRoute, 'call', _448 => _448(pathname), 'optionalAccess', _449 => _449.route]) || _optionalChain([routeManager, 'optionalAccess', _450 => _450.matchMetadataRoute, 'call', _451 => _451(pathname)]) || _optionalChain([routeManager, 'optionalAccess', _452 => _452.matchMetadataImage, 'call', _453 => _453(pathname)]) || generatedPaths.includes(pathname)
9374
9375
  );
9375
9376
  return !matchesAppRoute || devServableFileExists(pathname, baseDirs);
9376
9377
  }
@@ -9399,7 +9400,7 @@ var DOCS_ENGINE_APP_OWNABLE_PATHS = /* @__PURE__ */ new Set([
9399
9400
  ]);
9400
9401
  function farmAppOwnsDocsEnginePath(pathname, options) {
9401
9402
  if (!DOCS_ENGINE_APP_OWNABLE_PATHS.has(pathname)) return false;
9402
- return options.generatedPaths.includes(pathname) || Boolean(_optionalChain([options, 'access', _444 => _444.routeManager, 'optionalAccess', _445 => _445.matchMetadataRoute, 'call', _446 => _446(pathname)])) || devServableFileExists(pathname, [options.publicDir]);
9403
+ return options.generatedPaths.includes(pathname) || Boolean(_optionalChain([options, 'access', _454 => _454.routeManager, 'optionalAccess', _455 => _455.matchMetadataRoute, 'call', _456 => _456(pathname)])) || devServableFileExists(pathname, [options.publicDir]);
9403
9404
  }
9404
9405
  _chunkS3JO3N4Hcjs.__name.call(void 0, farmAppOwnsDocsEnginePath, "farmAppOwnsDocsEnginePath");
9405
9406
  function devServableFileExists(pathname, baseDirs) {
@@ -9506,14 +9507,14 @@ function analyzeClientBoundary(program, publicKeys) {
9506
9507
  _chunkS3JO3N4Hcjs.__name.call(void 0, analyzeClientBoundary, "analyzeClientBoundary");
9507
9508
  function readNodeBuiltinSource(node) {
9508
9509
  if (node.type === "ImportDeclaration" || node.type === "ExportNamedDeclaration" || node.type === "ExportAllDeclaration" || node.type === "ImportExpression") {
9509
- const value = _optionalChain([node, 'access', _447 => _447.source, 'optionalAccess', _448 => _448.value]);
9510
+ const value = _optionalChain([node, 'access', _457 => _457.source, 'optionalAccess', _458 => _458.value]);
9510
9511
  return typeof value === "string" && value.startsWith("node:") ? value : void 0;
9511
9512
  }
9512
9513
  if (node.type === "CallExpression") {
9513
9514
  const callee = node.callee;
9514
- if (_optionalChain([callee, 'optionalAccess', _449 => _449.type]) === "Identifier" && callee.name === "require") {
9515
- const arg = _optionalChain([node, 'access', _450 => _450.arguments, 'optionalAccess', _451 => _451[0]]);
9516
- const value = _optionalChain([arg, 'optionalAccess', _452 => _452.type]) === "Literal" ? arg.value : void 0;
9515
+ if (_optionalChain([callee, 'optionalAccess', _459 => _459.type]) === "Identifier" && callee.name === "require") {
9516
+ const arg = _optionalChain([node, 'access', _460 => _460.arguments, 'optionalAccess', _461 => _461[0]]);
9517
+ const value = _optionalChain([arg, 'optionalAccess', _462 => _462.type]) === "Literal" ? arg.value : void 0;
9517
9518
  return typeof value === "string" && value.startsWith("node:") ? value : void 0;
9518
9519
  }
9519
9520
  }
@@ -9523,7 +9524,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, readNodeBuiltinSource, "readNodeBuiltinSou
9523
9524
  function readProcessEnvKey(node) {
9524
9525
  if (node.type !== "MemberExpression") return void 0;
9525
9526
  const object = node.object;
9526
- if (!object || object.type !== "MemberExpression" || _optionalChain([object, 'access', _453 => _453.object, 'optionalAccess', _454 => _454.type]) !== "Identifier" || object.object.name !== "process" || _optionalChain([object, 'access', _455 => _455.property, 'optionalAccess', _456 => _456.name]) !== "env") {
9527
+ if (!object || object.type !== "MemberExpression" || _optionalChain([object, 'access', _463 => _463.object, 'optionalAccess', _464 => _464.type]) !== "Identifier" || object.object.name !== "process" || _optionalChain([object, 'access', _465 => _465.property, 'optionalAccess', _466 => _466.name]) !== "env") {
9527
9528
  return void 0;
9528
9529
  }
9529
9530
  const property2 = node.property;
@@ -9588,7 +9589,7 @@ function farmImageImportsPlugin() {
9588
9589
  async transform(code, id) {
9589
9590
  const filePath = id.split("?", 1)[0];
9590
9591
  if (id.includes("?") || !STATIC_IMAGE_RE.test(filePath)) return null;
9591
- const defaultExport = _optionalChain([code, 'access', _457 => _457.match, 'call', _458 => _458(/^\s*export\s+default\s+(.+?);?\s*$/s), 'optionalAccess', _459 => _459[1]]);
9592
+ const defaultExport = _optionalChain([code, 'access', _467 => _467.match, 'call', _468 => _468(/^\s*export\s+default\s+(.+?);?\s*$/s), 'optionalAccess', _469 => _469[1]]);
9592
9593
  if (!defaultExport) return null;
9593
9594
  return createStaticImageModule(filePath, `const src = ${defaultExport};`);
9594
9595
  }
@@ -9649,7 +9650,7 @@ var FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE = [
9649
9650
  ];
9650
9651
  function getFarmClientOptimizeDepsInclude(renderer) {
9651
9652
  return Array.from(
9652
- /* @__PURE__ */ new Set([...FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE, ..._optionalChain([renderer, 'optionalAccess', _460 => _460.optimizeDeps]) || []])
9653
+ /* @__PURE__ */ new Set([...FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE, ..._optionalChain([renderer, 'optionalAccess', _470 => _470.optimizeDeps]) || []])
9653
9654
  );
9654
9655
  }
9655
9656
  _chunkS3JO3N4Hcjs.__name.call(void 0, getFarmClientOptimizeDepsInclude, "getFarmClientOptimizeDepsInclude");
@@ -9674,7 +9675,7 @@ function createFarmClientOptimizeDepsConfig(entries, renderer) {
9674
9675
  // Farm's HTML boots through a virtual module and imports route UI lazily.
9675
9676
  // Explicit entries let Vite finish that crawl before a navigation can
9676
9677
  // rotate the optimizer hash underneath a hydrated React runtime.
9677
- ..._optionalChain([entries, 'optionalAccess', _461 => _461.length]) ? { entries: [...entries] } : {}
9678
+ ..._optionalChain([entries, 'optionalAccess', _471 => _471.length]) ? { entries: [...entries] } : {}
9678
9679
  };
9679
9680
  }
9680
9681
  _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmClientOptimizeDepsConfig, "createFarmClientOptimizeDepsConfig");
@@ -9704,8 +9705,8 @@ function mergeAlias(farmValue, userValue) {
9704
9705
  }
9705
9706
  _chunkS3JO3N4Hcjs.__name.call(void 0, mergeAlias, "mergeAlias");
9706
9707
  function mergeFarmViteConfig(farmConfig, userConfig = {}) {
9707
- const noDiscovery = _nullishCoalesce(_optionalChain([userConfig, 'access', _462 => _462.optimizeDeps, 'optionalAccess', _463 => _463.noDiscovery]), () => ( _optionalChain([farmConfig, 'access', _464 => _464.optimizeDeps, 'optionalAccess', _465 => _465.noDiscovery])));
9708
- const holdUntilCrawlEnd = _nullishCoalesce(_optionalChain([userConfig, 'access', _466 => _466.optimizeDeps, 'optionalAccess', _467 => _467.holdUntilCrawlEnd]), () => ( (_optionalChain([userConfig, 'access', _468 => _468.optimizeDeps, 'optionalAccess', _469 => _469.noDiscovery]) === true ? false : _optionalChain([farmConfig, 'access', _470 => _470.optimizeDeps, 'optionalAccess', _471 => _471.holdUntilCrawlEnd]))));
9708
+ const noDiscovery = _nullishCoalesce(_optionalChain([userConfig, 'access', _472 => _472.optimizeDeps, 'optionalAccess', _473 => _473.noDiscovery]), () => ( _optionalChain([farmConfig, 'access', _474 => _474.optimizeDeps, 'optionalAccess', _475 => _475.noDiscovery])));
9709
+ const holdUntilCrawlEnd = _nullishCoalesce(_optionalChain([userConfig, 'access', _476 => _476.optimizeDeps, 'optionalAccess', _477 => _477.holdUntilCrawlEnd]), () => ( (_optionalChain([userConfig, 'access', _478 => _478.optimizeDeps, 'optionalAccess', _479 => _479.noDiscovery]) === true ? false : _optionalChain([farmConfig, 'access', _480 => _480.optimizeDeps, 'optionalAccess', _481 => _481.holdUntilCrawlEnd]))));
9709
9710
  return {
9710
9711
  ...farmConfig,
9711
9712
  ...userConfig,
@@ -9717,9 +9718,9 @@ function mergeFarmViteConfig(farmConfig, userConfig = {}) {
9717
9718
  resolve: {
9718
9719
  ...farmConfig.resolve,
9719
9720
  ...userConfig.resolve,
9720
- alias: mergeAlias(_optionalChain([farmConfig, 'access', _472 => _472.resolve, 'optionalAccess', _473 => _473.alias]), _optionalChain([userConfig, 'access', _474 => _474.resolve, 'optionalAccess', _475 => _475.alias])),
9721
+ alias: mergeAlias(_optionalChain([farmConfig, 'access', _482 => _482.resolve, 'optionalAccess', _483 => _483.alias]), _optionalChain([userConfig, 'access', _484 => _484.resolve, 'optionalAccess', _485 => _485.alias])),
9721
9722
  dedupe: Array.from(
9722
- /* @__PURE__ */ new Set([..._optionalChain([farmConfig, 'access', _476 => _476.resolve, 'optionalAccess', _477 => _477.dedupe]) || [], ..._optionalChain([userConfig, 'access', _478 => _478.resolve, 'optionalAccess', _479 => _479.dedupe]) || []])
9723
+ /* @__PURE__ */ new Set([..._optionalChain([farmConfig, 'access', _486 => _486.resolve, 'optionalAccess', _487 => _487.dedupe]) || [], ..._optionalChain([userConfig, 'access', _488 => _488.resolve, 'optionalAccess', _489 => _489.dedupe]) || []])
9723
9724
  )
9724
9725
  },
9725
9726
  optimizeDeps: {
@@ -9729,21 +9730,21 @@ function mergeFarmViteConfig(farmConfig, userConfig = {}) {
9729
9730
  holdUntilCrawlEnd,
9730
9731
  include: Array.from(
9731
9732
  /* @__PURE__ */ new Set([
9732
- ..._optionalChain([farmConfig, 'access', _480 => _480.optimizeDeps, 'optionalAccess', _481 => _481.include]) || [],
9733
- ..._optionalChain([userConfig, 'access', _482 => _482.optimizeDeps, 'optionalAccess', _483 => _483.include]) || []
9733
+ ..._optionalChain([farmConfig, 'access', _490 => _490.optimizeDeps, 'optionalAccess', _491 => _491.include]) || [],
9734
+ ..._optionalChain([userConfig, 'access', _492 => _492.optimizeDeps, 'optionalAccess', _493 => _493.include]) || []
9734
9735
  ])
9735
9736
  ),
9736
9737
  exclude: Array.from(
9737
9738
  /* @__PURE__ */ new Set([
9738
- ..._optionalChain([farmConfig, 'access', _484 => _484.optimizeDeps, 'optionalAccess', _485 => _485.exclude]) || [],
9739
- ..._optionalChain([userConfig, 'access', _486 => _486.optimizeDeps, 'optionalAccess', _487 => _487.exclude]) || []
9739
+ ..._optionalChain([farmConfig, 'access', _494 => _494.optimizeDeps, 'optionalAccess', _495 => _495.exclude]) || [],
9740
+ ..._optionalChain([userConfig, 'access', _496 => _496.optimizeDeps, 'optionalAccess', _497 => _497.exclude]) || []
9740
9741
  ])
9741
9742
  )
9742
9743
  },
9743
9744
  ssr: {
9744
9745
  ...farmConfig.ssr,
9745
9746
  ...userConfig.ssr,
9746
- noExternal: mergeNoExternal(_optionalChain([farmConfig, 'access', _488 => _488.ssr, 'optionalAccess', _489 => _489.noExternal]), _optionalChain([userConfig, 'access', _490 => _490.ssr, 'optionalAccess', _491 => _491.noExternal]))
9747
+ noExternal: mergeNoExternal(_optionalChain([farmConfig, 'access', _498 => _498.ssr, 'optionalAccess', _499 => _499.noExternal]), _optionalChain([userConfig, 'access', _500 => _500.ssr, 'optionalAccess', _501 => _501.noExternal]))
9747
9748
  }
9748
9749
  };
9749
9750
  }
@@ -9797,7 +9798,7 @@ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}) {
9797
9798
  ...farmConfig.build,
9798
9799
  rollupOptions: {
9799
9800
  ...userBundlerOptions,
9800
- ..._optionalChain([farmConfig, 'access', _492 => _492.build, 'optionalAccess', _493 => _493.rollupOptions])
9801
+ ..._optionalChain([farmConfig, 'access', _502 => _502.build, 'optionalAccess', _503 => _503.rollupOptions])
9801
9802
  }
9802
9803
  },
9803
9804
  css: farmConfig.css || userCss ? { ...farmConfig.css, ...userCss } : void 0,
@@ -9805,12 +9806,93 @@ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}) {
9805
9806
  esbuild: typeof userEsbuild === "object" && farmConfig.esbuild !== false ? { ...userEsbuild, ...farmConfig.esbuild } : _nullishCoalesce(farmConfig.esbuild, () => ( userEsbuild)),
9806
9807
  ssr: {
9807
9808
  ...merged.ssr,
9808
- external: mergeExternal(_optionalChain([farmConfig, 'access', _494 => _494.ssr, 'optionalAccess', _495 => _495.external]), _optionalChain([userConfig, 'access', _496 => _496.ssr, 'optionalAccess', _497 => _497.external]))
9809
+ external: mergeExternal(_optionalChain([farmConfig, 'access', _504 => _504.ssr, 'optionalAccess', _505 => _505.external]), _optionalChain([userConfig, 'access', _506 => _506.ssr, 'optionalAccess', _507 => _507.external]))
9809
9810
  }
9810
9811
  };
9811
9812
  }
9812
9813
  _chunkS3JO3N4Hcjs.__name.call(void 0, mergeFarmProductionViteConfig, "mergeFarmProductionViteConfig");
9813
9814
 
9815
+ // src/docs/client-config.ts
9816
+
9817
+
9818
+
9819
+ var parseAst2;
9820
+ function propertyKeyName(property2) {
9821
+ if (property2.computed) return void 0;
9822
+ const key = property2.key;
9823
+ if (key.type === "Identifier") return key.name;
9824
+ if (key.type === "Literal" && typeof key.value === "string") return key.value;
9825
+ return void 0;
9826
+ }
9827
+ _chunkS3JO3N4Hcjs.__name.call(void 0, propertyKeyName, "propertyKeyName");
9828
+ function redactFarmDocsClientConfig(code, filename) {
9829
+ _nullishCoalesce(parseAst2, () => ( (parseAst2 = _module.createRequire.call(void 0, typeof __filename === "string" ? __filename : _chunkS3JO3N4Hcjs.define_import_meta_default.url)(
9830
+ "rolldown/parseAst"
9831
+ ).parseAst)));
9832
+ const extension = path9.default.extname(filename);
9833
+ const program = parseAst2(code, {
9834
+ lang: extension === ".tsx" || extension === ".jsx" ? "tsx" : "ts"
9835
+ });
9836
+ const edits = [];
9837
+ const visit = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (node) => {
9838
+ if (Array.isArray(node)) {
9839
+ for (const child of node) visit(child);
9840
+ return;
9841
+ }
9842
+ if (!node || typeof node !== "object") return;
9843
+ const current = node;
9844
+ if (current.type === "Property") {
9845
+ const name = propertyKeyName(current);
9846
+ const valueType = _optionalChain([current, 'access', _508 => _508.value, 'optionalAccess', _509 => _509.type]);
9847
+ const credential = name !== void 0 && (name.toLowerCase() === "headers" || _chunkHITLGIAOcjs.isSecretDocsConfigKey.call(void 0, name) && valueType !== "ObjectExpression" && valueType !== "ArrayExpression");
9848
+ if (name && credential) {
9849
+ edits.push(
9850
+ current.shorthand || current.method || current.kind !== "init" ? { start: current.start, end: current.end, text: `${JSON.stringify(name)}: undefined` } : {
9851
+ start: current.value.start,
9852
+ end: current.value.end,
9853
+ text: "undefined"
9854
+ }
9855
+ );
9856
+ return;
9857
+ }
9858
+ }
9859
+ for (const [key, value] of Object.entries(current)) {
9860
+ if (key !== "start" && key !== "end" && value && typeof value === "object") visit(value);
9861
+ }
9862
+ }, "visit");
9863
+ visit(program);
9864
+ if (edits.length === 0) return null;
9865
+ let redacted = code;
9866
+ for (const edit of edits.sort((left, right) => right.start - left.start)) {
9867
+ redacted = redacted.slice(0, edit.start) + edit.text + redacted.slice(edit.end);
9868
+ }
9869
+ return redacted;
9870
+ }
9871
+ _chunkS3JO3N4Hcjs.__name.call(void 0, redactFarmDocsClientConfig, "redactFarmDocsClientConfig");
9872
+ function isFarmDocsClientConfigModule(id, configModule) {
9873
+ if (!configModule) return false;
9874
+ const file = id.split("?")[0].replace(/\\/g, "/");
9875
+ if (file === configModule) return true;
9876
+ try {
9877
+ return file === _fs.realpathSync.call(void 0, configModule).replace(/\\/g, "/");
9878
+ } catch (e33) {
9879
+ return false;
9880
+ }
9881
+ }
9882
+ _chunkS3JO3N4Hcjs.__name.call(void 0, isFarmDocsClientConfigModule, "isFarmDocsClientConfigModule");
9883
+ function farmDocsClientConfigPlugin(configModule) {
9884
+ return {
9885
+ name: "farm:docs-client-config",
9886
+ enforce: "pre",
9887
+ transform(code, id, options) {
9888
+ if (_optionalChain([options, 'optionalAccess', _510 => _510.ssr]) || !isFarmDocsClientConfigModule(id, configModule)) return null;
9889
+ const redacted = redactFarmDocsClientConfig(code, id.split("?")[0]);
9890
+ return redacted === null ? null : { code: redacted, map: null };
9891
+ }
9892
+ };
9893
+ }
9894
+ _chunkS3JO3N4Hcjs.__name.call(void 0, farmDocsClientConfigPlugin, "farmDocsClientConfigPlugin");
9895
+
9814
9896
  // src/theme/vite.ts
9815
9897
  var FARM_DARK_VARIANT = '@custom-variant dark (&:where([data-theme="dark"], [data-theme="dark"] *));';
9816
9898
  function createFarmThemeCssPlugin(input, basePath = "/") {
@@ -9878,13 +9960,13 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, reportOpenAPIDevGenerationResult, "reportO
9878
9960
  // src/vite.ts
9879
9961
  var SERVER_FN_TRANSFORM_PLUGIN = "@farm.js/plugin/rsc:server-fn-actions";
9880
9962
  function farmLlmsTxtGeneratedPaths(config) {
9881
- const llms = _chunkZHPHJPQPcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([config, 'access', _498 => _498.agent, 'optionalAccess', _499 => _499.llmsTxt]));
9963
+ const llms = _chunkRU3M2FIKcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([config, 'access', _511 => _511.agent, 'optionalAccess', _512 => _512.llmsTxt]));
9882
9964
  if (!llms.enabled) return [];
9883
9965
  return llms.full ? ["/llms.txt", "/llms-full.txt"] : ["/llms.txt"];
9884
9966
  }
9885
9967
  _chunkS3JO3N4Hcjs.__name.call(void 0, farmLlmsTxtGeneratedPaths, "farmLlmsTxtGeneratedPaths");
9886
9968
  function farmAgentGeneratedPaths(config) {
9887
- const crawlers = _chunkZHPHJPQPcjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([config, 'access', _500 => _500.agent, 'optionalAccess', _501 => _501.crawlers]));
9969
+ const crawlers = _chunkRU3M2FIKcjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([config, 'access', _513 => _513.agent, 'optionalAccess', _514 => _514.crawlers]));
9888
9970
  return [...farmLlmsTxtGeneratedPaths(config), ...crawlers.enabled ? ["/robots.txt"] : []];
9889
9971
  }
9890
9972
  _chunkS3JO3N4Hcjs.__name.call(void 0, farmAgentGeneratedPaths, "farmAgentGeneratedPaths");
@@ -9930,7 +10012,7 @@ function loadFarmWorkflowsDevRuntime() {
9930
10012
  }
9931
10013
  _chunkS3JO3N4Hcjs.__name.call(void 0, loadFarmWorkflowsDevRuntime, "loadFarmWorkflowsDevRuntime");
9932
10014
  function loadFarmDevtoolsSnapshotRuntime() {
9933
- return import("./devtools-HU6Y2MNV.cjs");
10015
+ return import("./devtools-EAUY43BS.cjs");
9934
10016
  }
9935
10017
  _chunkS3JO3N4Hcjs.__name.call(void 0, loadFarmDevtoolsSnapshotRuntime, "loadFarmDevtoolsSnapshotRuntime");
9936
10018
  function loadFarmDevtoolsUIRuntime() {
@@ -9946,7 +10028,7 @@ function farmI18nClientBridgePlugin() {
9946
10028
  name: "farm:i18n-client-bridge",
9947
10029
  enforce: "pre",
9948
10030
  resolveId(id, _importer, options) {
9949
- if (id === "@farm.js/core/i18n/server" && !_optionalChain([options, 'optionalAccess', _502 => _502.ssr])) {
10031
+ if (id === "@farm.js/core/i18n/server" && !_optionalChain([options, 'optionalAccess', _515 => _515.ssr])) {
9950
10032
  return FARM_I18N_CLIENT_BRIDGE_ID;
9951
10033
  }
9952
10034
  return null;
@@ -9971,7 +10053,7 @@ function farmServerOnlyEntriesPlugin() {
9971
10053
  resolveId(id, importer, options) {
9972
10054
  if (!FARM_SERVER_ONLY_ENTRIES.has(id)) return null;
9973
10055
  const importedBy = importer ? ` (imported by ${importer})` : "";
9974
- if (!_optionalChain([options, 'optionalAccess', _503 => _503.ssr])) {
10056
+ if (!_optionalChain([options, 'optionalAccess', _516 => _516.ssr])) {
9975
10057
  this.error(
9976
10058
  `${id} is server-only and cannot be imported into client code${importedBy}. Use it from an API route or another server module.`
9977
10059
  );
@@ -10017,11 +10099,11 @@ function renderFarmI18nStaticHead(requestPath, snapshot) {
10017
10099
  if (!snapshot) return "";
10018
10100
  const runtime = `<script>window.__FARM_I18N__ = ${serializeFarmInlineValue(snapshot)};</script>`;
10019
10101
  if (snapshot.routing === "none") return runtime;
10020
- return `${_chunkP64MIF5Bcjs.renderFarmLocaleAlternateLinks.call(void 0, requestPath, snapshot)}${runtime}`;
10102
+ return `${_chunkIPXLADVOcjs.renderFarmLocaleAlternateLinks.call(void 0, requestPath, snapshot)}${runtime}`;
10021
10103
  }
10022
10104
  _chunkS3JO3N4Hcjs.__name.call(void 0, renderFarmI18nStaticHead, "renderFarmI18nStaticHead");
10023
10105
  function getPublicEnvDefine(config) {
10024
- const publicEnv = _optionalChain([config, 'access', _504 => _504.env, 'optionalAccess', _505 => _505.public]);
10106
+ const publicEnv = _optionalChain([config, 'access', _517 => _517.env, 'optionalAccess', _518 => _518.public]);
10025
10107
  if (!isResolvedEnvScope(publicEnv)) {
10026
10108
  return {};
10027
10109
  }
@@ -10062,7 +10144,7 @@ function withFarmRequestTracing(handler, apiRuntime, resolveTraceUrl = (request2
10062
10144
  return;
10063
10145
  }
10064
10146
  if (res.headersSent) {
10065
- _optionalChain([res, 'access', _506 => _506.destroy, 'optionalCall', _507 => _507(error instanceof Error ? error : new Error(String(error)))]);
10147
+ _optionalChain([res, 'access', _519 => _519.destroy, 'optionalCall', _520 => _520(error instanceof Error ? error : new Error(String(error)))]);
10066
10148
  return;
10067
10149
  }
10068
10150
  res.statusCode = 500;
@@ -10161,7 +10243,7 @@ function interceptFarmDevPageResponse(options) {
10161
10243
  const originalWrite = res.write.bind(res);
10162
10244
  const originalEnd = res.end.bind(res);
10163
10245
  const originalWriteHead = res.writeHead.bind(res);
10164
- const originalFlushHeaders = _optionalChain([res, 'access', _508 => _508.flushHeaders, 'optionalAccess', _509 => _509.bind, 'call', _510 => _510(res)]);
10246
+ const originalFlushHeaders = _optionalChain([res, 'access', _521 => _521.flushHeaders, 'optionalAccess', _522 => _522.bind, 'call', _523 => _523(res)]);
10165
10247
  let afterResponseCalled = false;
10166
10248
  let interceptedEnd = false;
10167
10249
  const htmlChunks = [];
@@ -10201,7 +10283,7 @@ function interceptFarmDevPageResponse(options) {
10201
10283
  const shouldBufferResponse = isHtmlResponse ? bufferPluginResponse : Boolean(runtimeSession && hasRuntimeAfterHook);
10202
10284
  if (shouldBufferResponse) {
10203
10285
  const callback = args.find((arg) => typeof arg === "function");
10204
- _optionalChain([callback, 'optionalCall', _511 => _511()]);
10286
+ _optionalChain([callback, 'optionalCall', _524 => _524()]);
10205
10287
  return true;
10206
10288
  }
10207
10289
  const writeResult = originalWrite(chunk, ...args);
@@ -10316,14 +10398,14 @@ function getEnvDefines(config, configEnv) {
10316
10398
  _chunkYFPGHF5Fcjs.getPublicFarmImageConfig.call(void 0, _chunkYFPGHF5Fcjs.resolveFarmImageConfig.call(void 0, config.images))
10317
10399
  )
10318
10400
  };
10319
- if (_optionalChain([configEnv, 'optionalAccess', _512 => _512.isSsrBuild])) {
10401
+ if (_optionalChain([configEnv, 'optionalAccess', _525 => _525.isSsrBuild])) {
10320
10402
  defines.__FARM_ENV__ = JSON.stringify(_chunkVEKFLAQMcjs.createBundledEnv.call(void 0, getFullEnvDefine(config)));
10321
10403
  }
10322
10404
  return defines;
10323
10405
  }
10324
10406
  _chunkS3JO3N4Hcjs.__name.call(void 0, getEnvDefines, "getEnvDefines");
10325
10407
  function getFarmAPIBaseURLDefine(config) {
10326
- const baseURL = _optionalChain([config, 'access', _513 => _513.api, 'optionalAccess', _514 => _514.baseURL]);
10408
+ const baseURL = _optionalChain([config, 'access', _526 => _526.api, 'optionalAccess', _527 => _527.baseURL]);
10327
10409
  return typeof baseURL === "string" && baseURL ? baseURL : _chunkS3A45T7Fcjs.DEFAULT_FARM_API_BASE_PATH;
10328
10410
  }
10329
10411
  _chunkS3JO3N4Hcjs.__name.call(void 0, getFarmAPIBaseURLDefine, "getFarmAPIBaseURLDefine");
@@ -10346,21 +10428,21 @@ function fileContainsProgrammaticPageRoute(file) {
10346
10428
  }
10347
10429
  try {
10348
10430
  return _chunk6V4TDWECcjs.scanProgrammaticPagePaths.call(void 0, fs11.readFileSync(file, "utf8")).length > 0;
10349
- } catch (e33) {
10431
+ } catch (e34) {
10350
10432
  return false;
10351
10433
  }
10352
10434
  }
10353
10435
  _chunkS3JO3N4Hcjs.__name.call(void 0, fileContainsProgrammaticPageRoute, "fileContainsProgrammaticPageRoute");
10354
10436
  function rewriteEarlySsrRelativeImports(options) {
10355
10437
  const cleanId = options.id.split("?", 1)[0];
10356
- if (!path20.isAbsolute(cleanId) || cleanId.replace(/\\/g, "/").includes("/node_modules/")) {
10438
+ if (!path21.isAbsolute(cleanId) || cleanId.replace(/\\/g, "/").includes("/node_modules/")) {
10357
10439
  return null;
10358
10440
  }
10359
10441
  const replacements = [];
10360
10442
  let ast;
10361
10443
  try {
10362
10444
  ast = options.parse(options.code);
10363
- } catch (e34) {
10445
+ } catch (e35) {
10364
10446
  return null;
10365
10447
  }
10366
10448
  walkModuleAst(ast, (node) => {
@@ -10373,7 +10455,7 @@ function rewriteEarlySsrRelativeImports(options) {
10373
10455
  const suffixIndex = source.value.search(/[?#]/);
10374
10456
  const sourcePath = suffixIndex === -1 ? source.value : source.value.slice(0, suffixIndex);
10375
10457
  const suffix = suffixIndex === -1 ? "" : source.value.slice(suffixIndex);
10376
- const resolvedPath = path20.resolve(path20.dirname(cleanId), sourcePath);
10458
+ const resolvedPath = path21.resolve(path21.dirname(cleanId), sourcePath);
10377
10459
  replacements.push({
10378
10460
  start: source.start,
10379
10461
  end: source.end,
@@ -10392,7 +10474,7 @@ function transformIsolatedClientBoundaryModule(options) {
10392
10474
  let ast;
10393
10475
  try {
10394
10476
  ast = options.parse(options.code);
10395
- } catch (e35) {
10477
+ } catch (e36) {
10396
10478
  return null;
10397
10479
  }
10398
10480
  const body = Array.isArray(ast.body) ? ast.body : [];
@@ -10413,9 +10495,9 @@ function transformIsolatedClientBoundaryModule(options) {
10413
10495
  transformedExports++;
10414
10496
  }, "addWrapper");
10415
10497
  for (const node of body) {
10416
- if (_optionalChain([node, 'optionalAccess', _515 => _515.type]) === "ExportDefaultDeclaration" && node.declaration) {
10498
+ if (_optionalChain([node, 'optionalAccess', _528 => _528.type]) === "ExportDefaultDeclaration" && node.declaration) {
10417
10499
  const declaration2 = node.declaration;
10418
- if ((declaration2.type === "FunctionDeclaration" || declaration2.type === "ClassDeclaration") && _optionalChain([declaration2, 'access', _516 => _516.id, 'optionalAccess', _517 => _517.name])) {
10500
+ if ((declaration2.type === "FunctionDeclaration" || declaration2.type === "ClassDeclaration") && _optionalChain([declaration2, 'access', _529 => _529.id, 'optionalAccess', _530 => _530.name])) {
10419
10501
  replacements.push({
10420
10502
  start: node.start,
10421
10503
  end: node.end,
@@ -10433,14 +10515,14 @@ function transformIsolatedClientBoundaryModule(options) {
10433
10515
  }
10434
10516
  continue;
10435
10517
  }
10436
- if (_optionalChain([node, 'optionalAccess', _518 => _518.type]) !== "ExportNamedDeclaration" || !node.declaration) continue;
10518
+ if (_optionalChain([node, 'optionalAccess', _531 => _531.type]) !== "ExportNamedDeclaration" || !node.declaration) continue;
10437
10519
  const declaration = node.declaration;
10438
10520
  const declaredNames = [];
10439
- if ((declaration.type === "FunctionDeclaration" || declaration.type === "ClassDeclaration") && _optionalChain([declaration, 'access', _519 => _519.id, 'optionalAccess', _520 => _520.name])) {
10521
+ if ((declaration.type === "FunctionDeclaration" || declaration.type === "ClassDeclaration") && _optionalChain([declaration, 'access', _532 => _532.id, 'optionalAccess', _533 => _533.name])) {
10440
10522
  declaredNames.push(declaration.id.name);
10441
10523
  } else if (declaration.type === "VariableDeclaration") {
10442
10524
  for (const declarator of declaration.declarations || []) {
10443
- if (_optionalChain([declarator, 'access', _521 => _521.id, 'optionalAccess', _522 => _522.type]) === "Identifier") declaredNames.push(declarator.id.name);
10525
+ if (_optionalChain([declarator, 'access', _534 => _534.id, 'optionalAccess', _535 => _535.type]) === "Identifier") declaredNames.push(declarator.id.name);
10444
10526
  }
10445
10527
  }
10446
10528
  const componentNames = declaredNames.filter((name) => /^[A-Z]/.test(name));
@@ -10501,10 +10583,10 @@ function warnClientBoundaryOnce(context, id, code, config) {
10501
10583
  let program;
10502
10584
  try {
10503
10585
  program = context.parse(code);
10504
- } catch (e36) {
10586
+ } catch (e37) {
10505
10587
  return;
10506
10588
  }
10507
- const publicKeys = new Set(Object.keys(_nullishCoalesce(_optionalChain([config, 'access', _523 => _523.env, 'optionalAccess', _524 => _524.public]), () => ( {}))));
10589
+ const publicKeys = new Set(Object.keys(_nullishCoalesce(_optionalChain([config, 'access', _536 => _536.env, 'optionalAccess', _537 => _537.public]), () => ( {}))));
10508
10590
  const findings = analyzeClientBoundary(program, publicKeys);
10509
10591
  if (findings.envKeys.length === 0 && findings.publicEnvKeys.length === 0 && findings.builtinImports.length === 0) {
10510
10592
  return;
@@ -10541,6 +10623,11 @@ function farmPlugin(options = {}, initialPluginManager) {
10541
10623
  let refreshRouteDiscovery = null;
10542
10624
  let workflowHandler = null;
10543
10625
  let isBuild = false;
10626
+ const docsMCPServerDisposers = /* @__PURE__ */ new Set();
10627
+ const releaseDocsMCPServers = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => {
10628
+ for (const dispose of docsMCPServerDisposers) dispose();
10629
+ docsMCPServerDisposers.clear();
10630
+ }, "releaseDocsMCPServers");
10544
10631
  const logUpdate = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (tag, message) => {
10545
10632
  const pc = _chunkM2L4MYDQcjs.createCliColors.call(void 0, );
10546
10633
  const log = [
@@ -10556,7 +10643,7 @@ function farmPlugin(options = {}, initialPluginManager) {
10556
10643
  config(userConfig, configEnv) {
10557
10644
  isBuild = configEnv.command === "build";
10558
10645
  const layerAliases = _chunkVPTDD5XFcjs.getFarmLayerAliases.call(void 0, options.layers);
10559
- const sourceAlias = hasViteAlias(_optionalChain([userConfig, 'access', _525 => _525.resolve, 'optionalAccess', _526 => _526.alias]), "@") ? {} : createFarmSourceAlias(options.root || process.cwd(), options.srcDir);
10646
+ const sourceAlias = hasViteAlias(_optionalChain([userConfig, 'access', _538 => _538.resolve, 'optionalAccess', _539 => _539.alias]), "@") ? {} : createFarmSourceAlias(options.root || process.cwd(), options.srcDir);
10560
10647
  const layerRoots = (_nullishCoalesce(options.layers, () => ( []))).map((layer) => layer.root);
10561
10648
  return {
10562
10649
  // Honor Farm's publicDir so the dev server serves the same static
@@ -10571,8 +10658,8 @@ function farmPlugin(options = {}, initialPluginManager) {
10571
10658
  },
10572
10659
  server: {
10573
10660
  fs: {
10574
- ...layerRoots.length ? { allow: [path20.resolve(options.root || process.cwd()), ...layerRoots] } : {},
10575
- deny: getFarmDevFsDeny(_optionalChain([userConfig, 'access', _527 => _527.server, 'optionalAccess', _528 => _528.fs, 'optionalAccess', _529 => _529.deny]), options)
10661
+ ...layerRoots.length ? { allow: [path21.resolve(options.root || process.cwd()), ...layerRoots] } : {},
10662
+ deny: getFarmDevFsDeny(_optionalChain([userConfig, 'access', _540 => _540.server, 'optionalAccess', _541 => _541.fs, 'optionalAccess', _542 => _542.deny]), options)
10576
10663
  }
10577
10664
  }
10578
10665
  };
@@ -10584,7 +10671,7 @@ function farmPlugin(options = {}, initialPluginManager) {
10584
10671
  serverFnTransformActive = config.plugins.some(
10585
10672
  (plugin) => plugin.name === SERVER_FN_TRANSFORM_PLUGIN
10586
10673
  );
10587
- if (_optionalChain([options, 'access', _530 => _530.experimental, 'optionalAccess', _531 => _531.serverActions]) === true && !serverFnTransformActive) {
10674
+ if (_optionalChain([options, 'access', _543 => _543.experimental, 'optionalAccess', _544 => _544.serverActions]) === true && !serverFnTransformActive) {
10588
10675
  _chunk5QIKR7RRcjs.logger.warn(
10589
10676
  "experimental.serverActions has no effect without @farm.js/plugin/rsc in the Vite plugins. Server functions stay server-only, and importing one from client code is a build error."
10590
10677
  );
@@ -10593,7 +10680,7 @@ function farmPlugin(options = {}, initialPluginManager) {
10593
10680
  async configureServer(viteServer) {
10594
10681
  viteServer.middlewares.use(
10595
10682
  createFarmDevPreviewGuard(viteServer, {
10596
- getSourceRoots: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => _chunkVPTDD5XFcjs.getFarmSourceRoots.call(void 0, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _532 => _532.getConfig, 'call', _533 => _533()]), () => ( options))), "getSourceRoots")
10683
+ getSourceRoots: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => _chunkVPTDD5XFcjs.getFarmSourceRoots.call(void 0, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _545 => _545.getConfig, 'call', _546 => _546()]), () => ( options))), "getSourceRoots")
10597
10684
  })
10598
10685
  );
10599
10686
  if (typeof fontImports.configureServer === "function") {
@@ -10605,7 +10692,7 @@ function farmPlugin(options = {}, initialPluginManager) {
10605
10692
  if (!pm) return;
10606
10693
  try {
10607
10694
  await pm.runHookParallel("onError", { phase, error, meta });
10608
- } catch (e37) {
10695
+ } catch (e38) {
10609
10696
  }
10610
10697
  }, "emitPluginError");
10611
10698
  farmApp = new FarmApp(
@@ -10618,27 +10705,27 @@ function farmPlugin(options = {}, initialPluginManager) {
10618
10705
  await farmApp.initialize();
10619
10706
  const farmConfig = farmApp.getConfig();
10620
10707
  let farmAppPackages;
10621
- if (_optionalChain([farmConfig, 'access', _534 => _534.agent, 'optionalAccess', _535 => _535.noindexPreviews])) {
10708
+ if (_optionalChain([farmConfig, 'access', _547 => _547.agent, 'optionalAccess', _548 => _548.noindexPreviews])) {
10622
10709
  server.middlewares.use((_req, res, next) => {
10623
10710
  if (_chunkCXP5U3RWcjs.isFarmPreviewDeploymentEnvironment.call(void 0, process.env)) {
10624
- res.setHeader("X-Robots-Tag", _chunkZHPHJPQPcjs.FARM_PREVIEW_ROBOTS_TAG);
10711
+ res.setHeader("X-Robots-Tag", _chunkRU3M2FIKcjs.FARM_PREVIEW_ROBOTS_TAG);
10625
10712
  }
10626
10713
  next();
10627
10714
  });
10628
10715
  }
10629
10716
  const apiServerBasePath = _chunkKNBBQHO2cjs.resolveFarmAPIServerBasePath.call(void 0, farmConfig.api);
10630
- const serverConfig = _chunkEM6SBQKMcjs.resolveFarmServerConfig.call(void 0, farmConfig.server);
10717
+ const serverConfig = _chunkOMVAU7NTcjs.resolveFarmServerConfig.call(void 0, farmConfig.server);
10631
10718
  globalThis.__FARM_IMAGE_CONFIG__ = _chunkYFPGHF5Fcjs.getPublicFarmImageConfig.call(void 0, farmConfig.images);
10632
10719
  let imageHandler = null;
10633
10720
  if (farmConfig.images.provider !== "none") {
10634
10721
  const { createNodeImageFetcher, createNodeImageUrlValidator, createSharpImageTransformer } = await import("./image/sharp.cjs");
10635
- imageHandler = _chunkVKNHTSAPcjs.createFarmImageHandler.call(void 0, farmConfig.images, {
10722
+ imageHandler = _chunk7GLPRTTFcjs.createFarmImageHandler.call(void 0, farmConfig.images, {
10636
10723
  transform: createSharpImageTransformer(),
10637
10724
  fetchRemote: createNodeImageFetcher(farmConfig.images),
10638
10725
  validateRemoteUrl: createNodeImageUrlValidator(farmConfig.images),
10639
10726
  // Vite owns this address. Unlike request.url, it cannot be replaced by
10640
10727
  // a caller-controlled Host header.
10641
- trustedLocalOrigin: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => _optionalChain([server, 'access', _536 => _536.resolvedUrls, 'optionalAccess', _537 => _537.local, 'access', _538 => _538[0]]), "trustedLocalOrigin"),
10728
+ trustedLocalOrigin: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => _optionalChain([server, 'access', _549 => _549.resolvedUrls, 'optionalAccess', _550 => _550.local, 'access', _551 => _551[0]]), "trustedLocalOrigin"),
10642
10729
  onError(error) {
10643
10730
  _chunk5QIKR7RRcjs.logger.error(
10644
10731
  `Image optimization failed: ${error instanceof Error ? error.message : String(error)}`
@@ -10647,7 +10734,7 @@ function farmPlugin(options = {}, initialPluginManager) {
10647
10734
  });
10648
10735
  }
10649
10736
  const sourceRoots = _chunkVPTDD5XFcjs.getFarmSourceRoots.call(void 0, farmConfig);
10650
- server.watcher.add(sourceRoots.map((source) => path20.join(source.root, source.srcDir)));
10737
+ server.watcher.add(sourceRoots.map((source) => path21.join(source.root, source.srcDir)));
10651
10738
  if (farmConfig.i18n.enabled) {
10652
10739
  server.watcher.add(
10653
10740
  farmConfig.i18n.locales.map(
@@ -10658,15 +10745,15 @@ function farmPlugin(options = {}, initialPluginManager) {
10658
10745
  const workflowConfig = farmConfig.workflows;
10659
10746
  const farmDocsDevRuntime = farmConfig.docs.enabled ? await loadFarmDocsDevRuntime() : null;
10660
10747
  const getExtraRouteTypes = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => [
10661
- ..._optionalChain([options, 'access', _539 => _539.openapi, 'optionalAccess', _540 => _540.enabled]) && options.openapi.route ? [options.openapi.route] : [],
10662
- ..._nullishCoalesce(_optionalChain([farmDocsDevRuntime, 'optionalAccess', _541 => _541.getFarmDocsRouteTypeEntries, 'call', _542 => _542(farmConfig.docs)]), () => ( []))
10748
+ ..._optionalChain([options, 'access', _552 => _552.openapi, 'optionalAccess', _553 => _553.enabled]) && options.openapi.route ? [options.openapi.route] : [],
10749
+ ..._nullishCoalesce(_optionalChain([farmDocsDevRuntime, 'optionalAccess', _554 => _554.getFarmDocsRouteTypeEntries, 'call', _555 => _555(farmConfig.docs)]), () => ( []))
10663
10750
  ], "getExtraRouteTypes");
10664
10751
  const appDirSlugs = sourceRoots.map(
10665
- (source) => path20.join(source.root, source.srcDir, "app").replace(/\\/g, "/")
10752
+ (source) => path21.join(source.root, source.srcDir, "app").replace(/\\/g, "/")
10666
10753
  );
10667
10754
  const generateTypeArtifacts = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (reason, selection = ALL_TYPE_ARTIFACTS, log = false) => {
10668
10755
  try {
10669
- const result = await _chunkQJ3J6MZTcjs.generateFarmTypeArtifacts.call(void 0, {
10756
+ const result = await _chunk3BHT4WMPcjs.generateFarmTypeArtifacts.call(void 0, {
10670
10757
  root: farmConfig.root,
10671
10758
  srcDir: farmConfig.srcDir,
10672
10759
  layers: farmConfig.layers,
@@ -10703,10 +10790,10 @@ function farmPlugin(options = {}, initialPluginManager) {
10703
10790
  }, "generateTypeArtifacts");
10704
10791
  await generateTypeArtifacts("startup");
10705
10792
  const srcDirSlugs = sourceRoots.map(
10706
- (source) => path20.join(source.root, source.srcDir).replace(/\\/g, "/")
10793
+ (source) => path21.join(source.root, source.srcDir).replace(/\\/g, "/")
10707
10794
  );
10708
10795
  const layerConfigFiles = new Set(
10709
- farmConfig.layers.map((layer) => _optionalChain([layer, 'access', _543 => _543.configFile, 'optionalAccess', _544 => _544.replace, 'call', _545 => _545(/\\/g, "/")])).filter((file) => Boolean(file))
10796
+ farmConfig.layers.map((layer) => _optionalChain([layer, 'access', _556 => _556.configFile, 'optionalAccess', _557 => _557.replace, 'call', _558 => _558(/\\/g, "/")])).filter((file) => Boolean(file))
10710
10797
  );
10711
10798
  const routeModuleExtensions = /* @__PURE__ */ new Set([
10712
10799
  ..._chunkPSV6XKPOcjs.resolveFarmComponentExtensions.call(void 0, farmConfig.renderer.componentExtensions),
@@ -10785,7 +10872,7 @@ function farmPlugin(options = {}, initialPluginManager) {
10785
10872
  scheduleTypeArtifactGen(file, ev, typeArtifacts);
10786
10873
  }
10787
10874
  if (isI18nCatalogFile(file)) {
10788
- _optionalChain([farmApp, 'optionalAccess', _546 => _546.getI18nRuntime, 'call', _547 => _547(), 'access', _548 => _548.reload, 'call', _549 => _549(), 'access', _550 => _550.then, 'call', _551 => _551(() => server.ws.send({ type: "full-reload", path: "*" })), 'access', _552 => _552.catch, 'call', _553 => _553((error) => _chunk5QIKR7RRcjs.logger.warn(`i18n catalog reload failed: ${error.message}`))]);
10875
+ _optionalChain([farmApp, 'optionalAccess', _559 => _559.getI18nRuntime, 'call', _560 => _560(), 'access', _561 => _561.reload, 'call', _562 => _562(), 'access', _563 => _563.then, 'call', _564 => _564(() => server.ws.send({ type: "full-reload", path: "*" })), 'access', _565 => _565.catch, 'call', _566 => _566((error) => _chunk5QIKR7RRcjs.logger.warn(`i18n catalog reload failed: ${error.message}`))]);
10789
10876
  }
10790
10877
  const isRouteRefreshEvent = (ev !== "change" || isStaticMetadataImageFile2(file)) && (isAppRuntimeFile(file) || isProgrammaticRouteFile(file) || isProgrammaticRouteSourceFile(file) && (ev === "unlink" || fileContainsProgrammaticPageRoute(file)));
10791
10878
  if (isRouteRefreshEvent) {
@@ -10798,8 +10885,8 @@ function farmPlugin(options = {}, initialPluginManager) {
10798
10885
  const reloadsMiddleware = pendingRouteRefreshIncludesMiddleware;
10799
10886
  pendingRouteRefreshIncludesMiddleware = false;
10800
10887
  Promise.all([
10801
- _optionalChain([refreshRouteDiscovery, 'optionalCall', _554 => _554(`${ev} ${file}`)]),
10802
- reloadsMiddleware ? _optionalChain([middlewareManager, 'optionalAccess', _555 => _555.reload, 'call', _556 => _556()]) : void 0
10888
+ _optionalChain([refreshRouteDiscovery, 'optionalCall', _567 => _567(`${ev} ${file}`)]),
10889
+ reloadsMiddleware ? _optionalChain([middlewareManager, 'optionalAccess', _568 => _568.reload, 'call', _569 => _569()]) : void 0
10803
10890
  ]).then(() => server.ws.send({ type: "full-reload", path: "*" })).catch((error) => _chunk5QIKR7RRcjs.logger.warn(`Route refresh failed: ${error.message}`));
10804
10891
  }, 50);
10805
10892
  }
@@ -10833,7 +10920,7 @@ function farmPlugin(options = {}, initialPluginManager) {
10833
10920
  layoutCount: discoveredRoutes.filter((r) => r.kind === "layout").length
10834
10921
  });
10835
10922
  }
10836
- apiRouteManager = new (0, _chunkMIDIZJZCcjs.APIRouteManager)(appDirs, server, {
10923
+ apiRouteManager = new (0, _chunkXBML5KMGcjs.APIRouteManager)(appDirs, server, {
10837
10924
  plugins: farmConfig.plugins,
10838
10925
  i18n: farmApp.getI18nRuntime(),
10839
10926
  bodySizeLimit: serverConfig.bodySizeLimit,
@@ -10842,7 +10929,7 @@ function farmPlugin(options = {}, initialPluginManager) {
10842
10929
  await apiRouteManager.discoverRoutes();
10843
10930
  let discoveredWorkflows = [];
10844
10931
  const hasWorkflowDirectory = workflowConfig.enabled && workflowConfig.dirs.some(
10845
- (dir) => fs11.existsSync(path20.isAbsolute(dir) ? dir : path20.join(farmConfig.root, dir))
10932
+ (dir) => fs11.existsSync(path21.isAbsolute(dir) ? dir : path21.join(farmConfig.root, dir))
10846
10933
  );
10847
10934
  if (hasWorkflowDirectory) {
10848
10935
  const { createFarmWorkflowRequestHandler, discoverFarmWorkflows } = await loadFarmWorkflowsDevRuntime();
@@ -10871,7 +10958,7 @@ function farmPlugin(options = {}, initialPluginManager) {
10871
10958
  });
10872
10959
  }
10873
10960
  }
10874
- middlewareManager = new (0, _chunkU74I55WBcjs.MiddlewareManager)(
10961
+ middlewareManager = new (0, _chunkULAWS2PAcjs.MiddlewareManager)(
10875
10962
  appDirs,
10876
10963
  server,
10877
10964
  farmConfig.middleware,
@@ -10889,11 +10976,11 @@ function farmPlugin(options = {}, initialPluginManager) {
10889
10976
  });
10890
10977
  }
10891
10978
  }
10892
- if (_optionalChain([options, 'access', _557 => _557.openapi, 'optionalAccess', _558 => _558.enabled])) {
10979
+ if (_optionalChain([options, 'access', _570 => _570.openapi, 'optionalAccess', _571 => _571.enabled])) {
10893
10980
  const { OpenAPIManager } = await loadFarmOpenAPIDevRuntime();
10894
10981
  openAPIManager = new OpenAPIManager(appDirs, options.openapi, {
10895
10982
  mode: "development",
10896
- apiBaseURL: typeof _optionalChain([options, 'access', _559 => _559.api, 'optionalAccess', _560 => _560.baseURL]) === "string" ? options.api.baseURL : void 0
10983
+ apiBaseURL: typeof _optionalChain([options, 'access', _572 => _572.api, 'optionalAccess', _573 => _573.baseURL]) === "string" ? options.api.baseURL : void 0
10897
10984
  });
10898
10985
  const spec = await openAPIManager.generateSpec();
10899
10986
  reportOpenAPIDevGenerationResult(spec);
@@ -10920,6 +11007,7 @@ function farmPlugin(options = {}, initialPluginManager) {
10920
11007
  );
10921
11008
  return _chunkAMDMVWMIcjs.resolveFarmLayoutFonts.call(void 0, layoutModules);
10922
11009
  }, "resolveDocsLayoutFonts");
11010
+ releaseDocsMCPServers();
10923
11011
  const farmDocsHandler = farmDocsDevRuntime ? farmDocsDevRuntime.hasFarmDocsRuntimeAdapter(farmConfig.docs) ? await farmDocsDevRuntime.createFarmDocsAdapterHandler(farmConfig.docs, {
10924
11012
  root: farmConfig.root,
10925
11013
  srcDir: farmConfig.srcDir,
@@ -10932,14 +11020,22 @@ function farmPlugin(options = {}, initialPluginManager) {
10932
11020
  ),
10933
11021
  loadModule: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (specifier) => {
10934
11022
  const resolved = await server.environments.ssr.pluginContainer.resolveId(specifier);
10935
- if (specifier === _optionalChain([farmConfig, 'access', _561 => _561.docs, 'access', _562 => _562.adapter, 'optionalAccess', _563 => _563.server]) && _optionalChain([resolved, 'optionalAccess', _564 => _564.id])) {
11023
+ if (specifier === _optionalChain([farmConfig, 'access', _574 => _574.docs, 'access', _575 => _575.adapter, 'optionalAccess', _576 => _576.server]) && _optionalChain([resolved, 'optionalAccess', _577 => _577.id])) {
10936
11024
  return import(
10937
11025
  /* @vite-ignore */
10938
11026
  _url.pathToFileURL.call(void 0, resolved.id).href
10939
11027
  );
10940
11028
  }
10941
- return _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, server, _nullishCoalesce(_optionalChain([resolved, 'optionalAccess', _565 => _565.id]), () => ( specifier)));
10942
- }, "loadModule")
11029
+ return _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, server, _nullishCoalesce(_optionalChain([resolved, 'optionalAccess', _578 => _578.id]), () => ( specifier)));
11030
+ }, "loadModule"),
11031
+ registerMCPServer: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (mcpServer) => {
11032
+ const dispose = _chunk75RZHGLScjs.registerFarmMCPServer.call(void 0, mcpServer);
11033
+ docsMCPServerDisposers.add(dispose);
11034
+ return () => {
11035
+ docsMCPServerDisposers.delete(dispose);
11036
+ dispose();
11037
+ };
11038
+ }, "registerMCPServer")
10943
11039
  }) : farmDocsDevRuntime.createFarmDocsHandler(farmConfig.docs, {
10944
11040
  root: farmConfig.root,
10945
11041
  srcDir: farmConfig.srcDir,
@@ -10953,7 +11049,7 @@ function farmPlugin(options = {}, initialPluginManager) {
10953
11049
  )
10954
11050
  }) : null;
10955
11051
  const wrapFarmDocsResponseWithLayouts = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (request2, response) => {
10956
- if (request2.method === "HEAD" || response.headers.has("x-farm-docs-adapter") || !_optionalChain([response, 'access', _566 => _566.headers, 'access', _567 => _567.get, 'call', _568 => _568("content-type"), 'optionalAccess', _569 => _569.toLowerCase, 'call', _570 => _570(), 'access', _571 => _571.includes, 'call', _572 => _572("text/html")])) {
11052
+ if (request2.method === "HEAD" || response.headers.has("x-farm-docs-adapter") || !_optionalChain([response, 'access', _579 => _579.headers, 'access', _580 => _580.get, 'call', _581 => _581("content-type"), 'optionalAccess', _582 => _582.toLowerCase, 'call', _583 => _583(), 'access', _584 => _584.includes, 'call', _585 => _585("text/html")])) {
10957
11053
  return response;
10958
11054
  }
10959
11055
  const pathname = new URL(request2.url).pathname;
@@ -10974,7 +11070,7 @@ function farmPlugin(options = {}, initialPluginManager) {
10974
11070
  headers: response.headers
10975
11071
  });
10976
11072
  }
10977
- const docsRenderer = _chunkPSV6XKPOcjs.resolveFarmRenderer.call(void 0, (_nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _573 => _573.getConfig, 'call', _574 => _574()]), () => ( options))).renderer);
11073
+ const docsRenderer = _chunkPSV6XKPOcjs.resolveFarmRenderer.call(void 0, (_nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _586 => _586.getConfig, 'call', _587 => _587()]), () => ( options))).renderer);
10978
11074
  const [rendererRuntime, layoutModules] = await Promise.all([
10979
11075
  _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, docsRenderer) ? import("./renderer/react/server.cjs") : _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, server, docsRenderer.server),
10980
11076
  Promise.all(
@@ -11003,7 +11099,7 @@ function farmPlugin(options = {}, initialPluginManager) {
11003
11099
  ])
11004
11100
  );
11005
11101
  const inlineValue = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (value) => JSON.stringify(value).replace(/</g, "\\u003c").replace(/>/g, "\\u003e"), "inlineValue");
11006
- const pageModulePath = _optionalChain([matchedRoute, 'access', _575 => _575.route, 'optionalAccess', _576 => _576.modulePath]) ? toUrlPath(matchedRoute.route.modulePath) : "";
11102
+ const pageModulePath = _optionalChain([matchedRoute, 'access', _588 => _588.route, 'optionalAccess', _589 => _589.modulePath]) ? toUrlPath(matchedRoute.route.modulePath) : "";
11007
11103
  const bootstrapScript = `<script>
11008
11104
  window.__FARM_PROPS__ = ${inlineValue({ params })};
11009
11105
  window.__FARM_ROUTE_SLOTS__ = [];
@@ -11098,8 +11194,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11098
11194
  }, "dispatch")
11099
11195
  },
11100
11196
  (request2) => {
11101
- const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _577 => _577.getConfig, 'call', _578 => _578()]), () => ( options));
11102
- const currentServerConfig = _chunkEM6SBQKMcjs.resolveFarmServerConfig.call(void 0, currentConfig.server);
11197
+ const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _590 => _590.getConfig, 'call', _591 => _591()]), () => ( options));
11198
+ const currentServerConfig = _chunkOMVAU7NTcjs.resolveFarmServerConfig.call(void 0, currentConfig.server);
11103
11199
  return _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, request2, {
11104
11200
  trustProxy: currentServerConfig.trustProxy
11105
11201
  });
@@ -11109,8 +11205,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11109
11205
  withAPIRequestTracing(async (req, res, next) => {
11110
11206
  const requestUrl = req.url || "/";
11111
11207
  const requestMethod = req.method || "GET";
11112
- const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _579 => _579.getConfig, 'call', _580 => _580()]), () => ( options));
11113
- const currentServerConfig = _chunkEM6SBQKMcjs.resolveFarmServerConfig.call(void 0, currentConfig.server);
11208
+ const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _592 => _592.getConfig, 'call', _593 => _593()]), () => ( options));
11209
+ const currentServerConfig = _chunkOMVAU7NTcjs.resolveFarmServerConfig.call(void 0, currentConfig.server);
11114
11210
  const parsedRequestUrl = _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, req, {
11115
11211
  trustProxy: currentServerConfig.trustProxy
11116
11212
  });
@@ -11151,7 +11247,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11151
11247
  if (referrerUrl.origin === parsedRequestUrl.origin && !referrerUrl.pathname.startsWith(_chunkYJRZR7VUcjs.FARM_DEVTOOLS_PATH)) {
11152
11248
  launchUrl = referrerUrl;
11153
11249
  }
11154
- } catch (e38) {
11250
+ } catch (e39) {
11155
11251
  }
11156
11252
  }
11157
11253
  launchUrl.searchParams.set(_chunkYJRZR7VUcjs.FARM_DEVTOOLS_LAUNCH_PARAM, "1");
@@ -11177,7 +11273,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11177
11273
  openapi: options.openapi
11178
11274
  },
11179
11275
  workflows: discoveredWorkflows,
11180
- plugins: _optionalChain([pm, 'optionalAccess', _581 => _581.getSortedPlugins, 'call', _582 => _582()])
11276
+ plugins: _optionalChain([pm, 'optionalAccess', _594 => _594.getSortedPlugins, 'call', _595 => _595()])
11181
11277
  });
11182
11278
  res.statusCode = 200;
11183
11279
  res.setHeader(
@@ -11200,7 +11296,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11200
11296
  return;
11201
11297
  }
11202
11298
  const runAppMiddlewareForContentRoute = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => {
11203
- if (!_optionalChain([middlewareManager, 'optionalAccess', _583 => _583.hasMiddleware, 'call', _584 => _584()])) return false;
11299
+ if (!_optionalChain([middlewareManager, 'optionalAccess', _596 => _596.hasMiddleware, 'call', _597 => _597()])) return false;
11204
11300
  const middlewareRequest = createRequestFromNodeRequest(req, new URL(fullUrl));
11205
11301
  return runFarmMiddlewareWithNavigation(
11206
11302
  farmApp.getServerRenderer(),
@@ -11211,7 +11307,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11211
11307
  );
11212
11308
  }, "runAppMiddlewareForContentRoute");
11213
11309
  const openAPIRequestPathname = openAPIManager ? _chunkI57LW5VZcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath) : requestPathname;
11214
- if (openAPIManager && _optionalChain([options, 'access', _585 => _585.openapi, 'optionalAccess', _586 => _586.specRoute]) && openAPIRequestPathname === options.openapi.specRoute) {
11310
+ if (openAPIManager && _optionalChain([options, 'access', _598 => _598.openapi, 'optionalAccess', _599 => _599.specRoute]) && openAPIRequestPathname === options.openapi.specRoute) {
11215
11311
  if (await runAppMiddlewareForContentRoute()) return;
11216
11312
  if (requestMethod !== "GET" && requestMethod !== "HEAD") {
11217
11313
  res.statusCode = 405;
@@ -11228,20 +11324,20 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11228
11324
  res.end(requestMethod === "HEAD" ? void 0 : body);
11229
11325
  return;
11230
11326
  }
11231
- if (openAPIManager && openAPIRequestPathname === _optionalChain([options, 'access', _587 => _587.openapi, 'optionalAccess', _588 => _588.route])) {
11327
+ if (openAPIManager && openAPIRequestPathname === _optionalChain([options, 'access', _600 => _600.openapi, 'optionalAccess', _601 => _601.route])) {
11232
11328
  if (await runAppMiddlewareForContentRoute()) return;
11233
11329
  const docsHandler = openAPIManager.getDocsRouteHandler(parsedRequestUrl.origin);
11234
11330
  return docsHandler(req, res);
11235
11331
  }
11236
- if (_chunkI57LW5VZcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath) === _chunkP64MIF5Bcjs.FARM_APP_MANIFEST_PATH) {
11332
+ if (_chunkI57LW5VZcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath) === _chunkIPXLADVOcjs.FARM_APP_MANIFEST_PATH) {
11237
11333
  _nullishCoalesce(farmAppPackages, () => ( (farmAppPackages = resolveFarmAppPackages(_nullishCoalesce(farmConfig.root, () => ( process.cwd()))))));
11238
- const manifest = await _chunkP64MIF5Bcjs.createFarmAppManifestResponse.call(void 0,
11334
+ const manifest = await _chunkIPXLADVOcjs.createFarmAppManifestResponse.call(void 0,
11239
11335
  new Request(parsedRequestUrl, { method: requestMethod }),
11240
- _chunkP64MIF5Bcjs.resolveFarmAppManifestInput.call(void 0, farmConfig, {
11336
+ _chunkIPXLADVOcjs.resolveFarmAppManifestInput.call(void 0, farmConfig, {
11241
11337
  build: "development",
11242
11338
  packages: farmAppPackages,
11243
11339
  // Read again on each request; unchanged files come from a cache.
11244
- webmcpTools: _optionalChain([farmConfig, 'access', _589 => _589.plugins, 'optionalAccess', _590 => _590.some, 'call', _591 => _591(({ name }) => name === "farm:webmcp")]) ? collectFarmWebMCPTools(_nullishCoalesce(farmConfig.root, () => ( process.cwd())), farmConfig.srcDir) : []
11340
+ webmcpTools: _optionalChain([farmConfig, 'access', _602 => _602.plugins, 'optionalAccess', _603 => _603.some, 'call', _604 => _604(({ name }) => name === "farm:webmcp")]) ? collectFarmWebMCPTools(_nullishCoalesce(farmConfig.root, () => ( process.cwd())), farmConfig.srcDir) : []
11245
11341
  }),
11246
11342
  { development: true }
11247
11343
  );
@@ -11250,13 +11346,13 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11250
11346
  return;
11251
11347
  }
11252
11348
  }
11253
- if (_optionalChain([options, 'access', _592 => _592.agent, 'optionalAccess', _593 => _593.apiCatalog]) && _chunkI57LW5VZcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath) === _chunkP64MIF5Bcjs.FARM_API_CATALOG_PATH) {
11349
+ if (_optionalChain([options, 'access', _605 => _605.agent, 'optionalAccess', _606 => _606.apiCatalog]) && _chunkI57LW5VZcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath) === _chunkIPXLADVOcjs.FARM_API_CATALOG_PATH) {
11254
11350
  if (await runAppMiddlewareForContentRoute()) return;
11255
11351
  await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0,
11256
11352
  res,
11257
- _chunkP64MIF5Bcjs.createFarmApiCatalogResponse.call(void 0,
11353
+ _chunkIPXLADVOcjs.createFarmApiCatalogResponse.call(void 0,
11258
11354
  requestMethod,
11259
- _chunkP64MIF5Bcjs.resolveFarmApiCatalogInput.call(void 0, { ...options, api: farmConfig.api }),
11355
+ _chunkIPXLADVOcjs.resolveFarmApiCatalogInput.call(void 0, { ...options, api: farmConfig.api }),
11260
11356
  new Request(parsedRequestUrl, {
11261
11357
  headers: { "user-agent": String(_nullishCoalesce(req.headers["user-agent"], () => ( ""))) }
11262
11358
  })
@@ -11264,6 +11360,23 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11264
11360
  );
11265
11361
  return;
11266
11362
  }
11363
+ if (_optionalChain([options, 'access', _607 => _607.agent, 'optionalAccess', _608 => _608.aiCatalog]) !== false) {
11364
+ const aiCatalog = _chunkIPXLADVOcjs.createFarmAiCatalogResponse.call(void 0,
11365
+ new Request(parsedRequestUrl, {
11366
+ method: requestMethod,
11367
+ headers: {
11368
+ "user-agent": String(_nullishCoalesce(req.headers["user-agent"], () => ( ""))),
11369
+ "if-none-match": String(_nullishCoalesce(req.headers["if-none-match"], () => ( "")))
11370
+ }
11371
+ }),
11372
+ { basePath: farmConfig.basePath, apiServerBasePath }
11373
+ );
11374
+ if (aiCatalog) {
11375
+ if (await runAppMiddlewareForContentRoute()) return;
11376
+ await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0, res, aiCatalog);
11377
+ return;
11378
+ }
11379
+ }
11267
11380
  const docsHeaders = new Headers();
11268
11381
  for (const [key, value] of Object.entries(req.headers)) {
11269
11382
  if (value) {
@@ -11281,7 +11394,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11281
11394
  method: requestMethod,
11282
11395
  headers: docsHeaders
11283
11396
  });
11284
- const docsResponse = await farmDocsHandler(docsRequest.clone());
11397
+ const docsBodyInit = requestMethod === "GET" || requestMethod === "HEAD" ? {} : { body: _chunkOMVAU7NTcjs.createFarmNodeRequestBodyStream.call(void 0, req), duplex: "half" };
11398
+ const docsResponse = await farmDocsHandler(new Request(docsRequest, docsBodyInit));
11285
11399
  if (docsResponse) {
11286
11400
  if (await runAppMiddlewareForContentRoute()) return;
11287
11401
  await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0,
@@ -11291,7 +11405,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11291
11405
  return;
11292
11406
  }
11293
11407
  }
11294
- const markdownSourceResponse = viteModuleRequest ? null : await _chunkUX5S4JEOcjs.createFarmMarkdownSourceResponse.call(void 0, {
11408
+ const markdownSourceResponse = viteModuleRequest ? null : await _chunkEFCQPQMGcjs.createFarmMarkdownSourceResponse.call(void 0, {
11295
11409
  request: new Request(fullUrl, {
11296
11410
  method: requestMethod,
11297
11411
  headers: docsHeaders
@@ -11299,7 +11413,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11299
11413
  config: farmApp.getConfig().mdx,
11300
11414
  resolveSource: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (pathname2) => {
11301
11415
  const match = farmApp.getRouteManager().matchRoute(pathname2);
11302
- const sourcePath = _optionalChain([match, 'access', _594 => _594.route, 'optionalAccess', _595 => _595.markdownSourcePath]) || (match.route && _chunkUX5S4JEOcjs.isFarmMarkdownPageFile.call(void 0, match.route.modulePath) ? match.route.modulePath : null);
11416
+ const sourcePath = _optionalChain([match, 'access', _609 => _609.route, 'optionalAccess', _610 => _610.markdownSourcePath]) || (match.route && _chunkEFCQPQMGcjs.isFarmMarkdownPageFile.call(void 0, match.route.modulePath) ? match.route.modulePath : null);
11303
11417
  if (!sourcePath) {
11304
11418
  return null;
11305
11419
  }
@@ -11312,7 +11426,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11312
11426
  // middleware see the page's own path, as in production.
11313
11427
  renderPage: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (request2) => fetch(request2, {
11314
11428
  redirect: "manual",
11315
- signal: res.destroyed ? AbortSignal.abort() : _chunkEM6SBQKMcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
11429
+ signal: res.destroyed ? AbortSignal.abort() : _chunkOMVAU7NTcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
11316
11430
  }), "renderPage")
11317
11431
  });
11318
11432
  if (markdownSourceResponse) {
@@ -11320,7 +11434,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11320
11434
  await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0, res, markdownSourceResponse);
11321
11435
  return;
11322
11436
  }
11323
- const markdownResponse = viteModuleRequest ? null : await _chunkXXJU7FCCcjs.createMarkdownMirrorResponse.call(void 0, {
11437
+ const markdownResponse = viteModuleRequest ? null : await _chunkEUV4YR3Vcjs.createMarkdownMirrorResponse.call(void 0, {
11324
11438
  request: new Request(fullUrl, {
11325
11439
  method: requestMethod,
11326
11440
  headers: docsHeaders
@@ -11333,7 +11447,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11333
11447
  redirect: "manual",
11334
11448
  // Only accepted mirrors need disconnect listeners. An earlier
11335
11449
  // close (for example while the docs handler ran) must also abort.
11336
- signal: res.destroyed ? AbortSignal.abort() : _chunkEM6SBQKMcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
11450
+ signal: res.destroyed ? AbortSignal.abort() : _chunkOMVAU7NTcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
11337
11451
  }), "renderPage"),
11338
11452
  apiServerBasePath
11339
11453
  });
@@ -11342,21 +11456,21 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11342
11456
  await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0, res, markdownResponse);
11343
11457
  return;
11344
11458
  }
11345
- if (!viteModuleRequest && _chunkXXJU7FCCcjs.farmRequestWantsMarkdown.call(void 0, requestPathname, req.headers.accept)) {
11346
- const markdownRoute = farmApp.getRouteManager().matchRoute(_chunkUX5S4JEOcjs.normalizeFarmMarkdownRoutePath.call(void 0, requestPathname));
11459
+ if (!viteModuleRequest && _chunkEUV4YR3Vcjs.farmRequestWantsMarkdown.call(void 0, requestPathname, req.headers.accept)) {
11460
+ const markdownRoute = farmApp.getRouteManager().matchRoute(_chunkEFCQPQMGcjs.normalizeFarmMarkdownRoutePath.call(void 0, requestPathname));
11347
11461
  if (!markdownRoute.route) {
11348
11462
  if (await runAppMiddlewareForContentRoute()) return;
11349
11463
  res.statusCode = 404;
11350
- res.setHeader("Content-Type", _chunkXXJU7FCCcjs.FARM_MARKDOWN_CONTENT_TYPE);
11464
+ res.setHeader("Content-Type", _chunkEUV4YR3Vcjs.FARM_MARKDOWN_CONTENT_TYPE);
11351
11465
  res.setHeader("X-Farm-Markdown-Error", "404");
11352
11466
  res.setHeader("Cache-Control", "no-store");
11353
11467
  res.end(
11354
- _chunkXXJU7FCCcjs.createFarmMarkdownErrorBody.call(void 0, 404, requestPathname, farmConfig.basePath || "/")
11468
+ _chunkEUV4YR3Vcjs.createFarmMarkdownErrorBody.call(void 0, 404, requestPathname, farmConfig.basePath || "/")
11355
11469
  );
11356
11470
  return;
11357
11471
  }
11358
11472
  }
11359
- const markdownPageTarget = _chunkXXJU7FCCcjs.resolveMarkdownMirrorTarget.call(void 0,
11473
+ const markdownPageTarget = _chunkEUV4YR3Vcjs.resolveMarkdownMirrorTarget.call(void 0,
11360
11474
  farmApp.getConfig().md,
11361
11475
  requestPathname,
11362
11476
  {
@@ -11369,7 +11483,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11369
11483
  if (!varyValues.some((value) => value.toLowerCase() === "accept")) {
11370
11484
  res.setHeader("Vary", [...varyValues, "Accept"].join(", "));
11371
11485
  }
11372
- const alternatePath = _chunkXXJU7FCCcjs.getFarmMarkdownMirrorPath.call(void 0, markdownPageTarget.pathname);
11486
+ const alternatePath = _chunkEUV4YR3Vcjs.getFarmMarkdownMirrorPath.call(void 0, markdownPageTarget.pathname);
11373
11487
  const alternateLink = `<${alternatePath}>; rel="alternate"; type="text/markdown"`;
11374
11488
  const currentLink = res.getHeader("Link");
11375
11489
  res.setHeader(
@@ -11381,13 +11495,13 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11381
11495
  let workflowBody;
11382
11496
  try {
11383
11497
  if (requestMethod !== "GET" && requestMethod !== "HEAD") {
11384
- workflowBody = await _chunkEM6SBQKMcjs.readNodeRequestBody.call(void 0,
11498
+ workflowBody = await _chunkOMVAU7NTcjs.readNodeRequestBody.call(void 0,
11385
11499
  req,
11386
11500
  currentServerConfig.bodySizeLimit
11387
11501
  );
11388
11502
  }
11389
11503
  } catch (error) {
11390
- const response = _chunkEM6SBQKMcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
11504
+ const response = _chunkOMVAU7NTcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
11391
11505
  if (!response) throw error;
11392
11506
  await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0, res, response);
11393
11507
  return;
@@ -11397,7 +11511,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11397
11511
  method: requestMethod,
11398
11512
  headers: docsHeaders,
11399
11513
  body: toRequestBody(workflowBody),
11400
- signal: _chunkEM6SBQKMcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
11514
+ signal: _chunkOMVAU7NTcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
11401
11515
  })
11402
11516
  );
11403
11517
  if (workflowResponse) {
@@ -11407,7 +11521,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11407
11521
  }
11408
11522
  const configuredIntegrations = currentConfig.integrations;
11409
11523
  const tryConfiguredIntegrationRoute = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => {
11410
- const matchedRoute = _chunkTDFPACVXcjs.matchIntegrationRoute.call(void 0, configuredIntegrations, {
11524
+ const matchedRoute = _chunkFTFYRMQQcjs.matchIntegrationRoute.call(void 0, configuredIntegrations, {
11411
11525
  pathname: requestPathname,
11412
11526
  method: requestMethod
11413
11527
  });
@@ -11420,8 +11534,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11420
11534
  await pm.runHookParallelFiltered(
11421
11535
  "beforeRequest",
11422
11536
  (plugin) => {
11423
- const owner = _chunkTDFPACVXcjs.getFarmIntegrationPluginOwner.call(void 0, plugin);
11424
- return plugin.name !== _chunk27ZWSI3Wcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME && (_optionalChain([owner, 'optionalAccess', _596 => _596.source]) !== "lifecycle" || owner.key !== matchedRoute.key);
11537
+ const owner = _chunkFTFYRMQQcjs.getFarmIntegrationPluginOwner.call(void 0, plugin);
11538
+ return plugin.name !== _chunk27ZWSI3Wcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME && (_optionalChain([owner, 'optionalAccess', _611 => _611.source]) !== "lifecycle" || owner.key !== matchedRoute.key);
11425
11539
  },
11426
11540
  req,
11427
11541
  res
@@ -11440,16 +11554,16 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11440
11554
  }
11441
11555
  let body;
11442
11556
  if (req.method !== "GET" && req.method !== "HEAD") {
11443
- body = await _chunkEM6SBQKMcjs.readNodeRequestBody.call(void 0, req, currentServerConfig.bodySizeLimit);
11557
+ body = await _chunkOMVAU7NTcjs.readNodeRequestBody.call(void 0, req, currentServerConfig.bodySizeLimit);
11444
11558
  }
11445
11559
  const integrationRequest = new Request(fullUrl, {
11446
11560
  method: req.method,
11447
11561
  headers,
11448
11562
  body: toRequestBody(body),
11449
- signal: _chunkEM6SBQKMcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
11563
+ signal: _chunkOMVAU7NTcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
11450
11564
  });
11451
11565
  const dispatchIntegration = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (request2) => {
11452
- const result = await _chunkTDFPACVXcjs.dispatchIntegrationRequest.call(void 0,
11566
+ const result = await _chunkFTFYRMQQcjs.dispatchIntegrationRequest.call(void 0,
11453
11567
  {
11454
11568
  integration: matchedRoute.integration,
11455
11569
  config: currentConfig,
@@ -11478,7 +11592,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11478
11592
  await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0, res, response);
11479
11593
  return true;
11480
11594
  } catch (error) {
11481
- const bodyErrorResponse = _chunkEM6SBQKMcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
11595
+ const bodyErrorResponse = _chunkOMVAU7NTcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
11482
11596
  if (bodyErrorResponse) {
11483
11597
  await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
11484
11598
  return true;
@@ -11512,7 +11626,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11512
11626
  }
11513
11627
  const matchedApiRoute = apiRouteManager.matchRoute(requestPathname);
11514
11628
  const hasMatchedApiRoute = Boolean(matchedApiRoute);
11515
- if (hasMatchedApiRoute || _chunkG26MUMKLcjs.isFarmAPIPathname.call(void 0, requestPathname, apiServerBasePath)) {
11629
+ if (hasMatchedApiRoute || _chunkXCACDAZZcjs.isFarmAPIPathname.call(void 0, requestPathname, apiServerBasePath)) {
11516
11630
  const startTime2 = Date.now();
11517
11631
  const method2 = req.method || "GET";
11518
11632
  const urlPath2 = req.url || "/";
@@ -11551,7 +11665,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11551
11665
  const apiHandler = apiRouteManager.getHandler({ throwOnError: true });
11552
11666
  const hasExplicitAPIRoute = hasMatchedApiRoute || Boolean(apiRouteManager.matchRoute(pathname2));
11553
11667
  if (apiHandler && hasExplicitAPIRoute) {
11554
- const apiRoutePattern = _optionalChain([matchedApiRoute, 'optionalAccess', _597 => _597.route, 'access', _598 => _598.path]) || _optionalChain([apiRouteManager, 'access', _599 => _599.matchRoute, 'call', _600 => _600(pathname2), 'optionalAccess', _601 => _601.route, 'access', _602 => _602.path]) || urlPath2;
11668
+ const apiRoutePattern = _optionalChain([matchedApiRoute, 'optionalAccess', _612 => _612.route, 'access', _613 => _613.path]) || _optionalChain([apiRouteManager, 'access', _614 => _614.matchRoute, 'call', _615 => _615(pathname2), 'optionalAccess', _616 => _616.route, 'access', _617 => _617.path]) || urlPath2;
11555
11669
  _chunkE3UK5IIBcjs.emitFarmEvent.call(void 0, {
11556
11670
  type: "route.matched",
11557
11671
  pathname: pathname2,
@@ -11573,13 +11687,13 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11573
11687
  }
11574
11688
  let body;
11575
11689
  if (req.method !== "GET" && req.method !== "HEAD") {
11576
- body = await _chunkEM6SBQKMcjs.readNodeRequestBody.call(void 0, req, currentServerConfig.bodySizeLimit);
11690
+ body = await _chunkOMVAU7NTcjs.readNodeRequestBody.call(void 0, req, currentServerConfig.bodySizeLimit);
11577
11691
  }
11578
11692
  const request2 = new Request(url, {
11579
11693
  method: req.method,
11580
11694
  headers,
11581
11695
  body: toRequestBody(body),
11582
- signal: _chunkEM6SBQKMcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
11696
+ signal: _chunkOMVAU7NTcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
11583
11697
  });
11584
11698
  const apiLifecyclePayload = {
11585
11699
  pathname: new URL(url).pathname,
@@ -11624,7 +11738,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11624
11738
  durationMs: duration2,
11625
11739
  error
11626
11740
  });
11627
- const bodyErrorResponse = _chunkEM6SBQKMcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
11741
+ const bodyErrorResponse = _chunkOMVAU7NTcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
11628
11742
  if (bodyErrorResponse) {
11629
11743
  logResponse(method2, urlPath2, bodyErrorResponse.status, duration2, "API");
11630
11744
  await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
@@ -11641,7 +11755,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11641
11755
  return;
11642
11756
  }
11643
11757
  }
11644
- if (farmDocsAPIHandler && _optionalChain([farmDocsDevRuntime, 'optionalAccess', _603 => _603.isFarmDocsAPIRequest, 'call', _604 => _604(pathname2)])) {
11758
+ if (farmDocsAPIHandler && _optionalChain([farmDocsDevRuntime, 'optionalAccess', _618 => _618.isFarmDocsAPIRequest, 'call', _619 => _619(pathname2)])) {
11645
11759
  try {
11646
11760
  const url = `http://${req.headers.host || "localhost:3000"}${req.url}`;
11647
11761
  const headers = new Headers();
@@ -11652,13 +11766,13 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11652
11766
  }
11653
11767
  let body;
11654
11768
  if (req.method !== "GET" && req.method !== "HEAD") {
11655
- body = await _chunkEM6SBQKMcjs.readNodeRequestBody.call(void 0, req, currentServerConfig.bodySizeLimit);
11769
+ body = await _chunkOMVAU7NTcjs.readNodeRequestBody.call(void 0, req, currentServerConfig.bodySizeLimit);
11656
11770
  }
11657
11771
  const request2 = new Request(url, {
11658
11772
  method: req.method,
11659
11773
  headers,
11660
11774
  body: toRequestBody(body),
11661
- signal: _chunkEM6SBQKMcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
11775
+ signal: _chunkOMVAU7NTcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
11662
11776
  });
11663
11777
  const apiLifecyclePayload = {
11664
11778
  pathname: pathname2,
@@ -11691,7 +11805,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11691
11805
  return;
11692
11806
  }
11693
11807
  } catch (error) {
11694
- const bodyErrorResponse = _chunkEM6SBQKMcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
11808
+ const bodyErrorResponse = _chunkOMVAU7NTcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
11695
11809
  if (bodyErrorResponse) {
11696
11810
  await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
11697
11811
  return;
@@ -11714,25 +11828,25 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11714
11828
  res.end(JSON.stringify({ error: "API route not found", pathname: pathname2 }));
11715
11829
  return;
11716
11830
  }
11717
- if (_optionalChain([req, 'access', _605 => _605.url, 'optionalAccess', _606 => _606.startsWith, 'call', _607 => _607("/@")]) || _optionalChain([req, 'access', _608 => _608.url, 'optionalAccess', _609 => _609.startsWith, 'call', _610 => _610("/node_modules")])) {
11831
+ if (_optionalChain([req, 'access', _620 => _620.url, 'optionalAccess', _621 => _621.startsWith, 'call', _622 => _622("/@")]) || _optionalChain([req, 'access', _623 => _623.url, 'optionalAccess', _624 => _624.startsWith, 'call', _625 => _625("/node_modules")])) {
11718
11832
  return next();
11719
11833
  }
11720
11834
  if (shouldBypassFarmRouterForDottedPath(
11721
11835
  requestPathname,
11722
- _optionalChain([farmApp, 'optionalAccess', _611 => _611.getRouteManager, 'call', _612 => _612()]),
11836
+ _optionalChain([farmApp, 'optionalAccess', _626 => _626.getRouteManager, 'call', _627 => _627()]),
11723
11837
  [server.config.publicDir, server.config.root],
11724
11838
  farmAgentGeneratedPaths(farmConfig)
11725
11839
  )) {
11726
11840
  return next();
11727
11841
  }
11728
- if (_optionalChain([req, 'access', _613 => _613.url, 'optionalAccess', _614 => _614.startsWith, 'call', _615 => _615("/__farm/page-data")])) {
11842
+ if (_optionalChain([req, 'access', _628 => _628.url, 'optionalAccess', _629 => _629.startsWith, 'call', _630 => _630("/__farm/page-data")])) {
11729
11843
  const urlObj = parsedRequestUrl;
11730
11844
  const targetPath = urlObj.searchParams.get("path") || "/";
11731
11845
  try {
11732
11846
  const request2 = createRequestFromNodeRequest(
11733
11847
  req,
11734
11848
  urlObj,
11735
- _chunkEM6SBQKMcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
11849
+ _chunkOMVAU7NTcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
11736
11850
  );
11737
11851
  const deploymentMismatch = _chunkC5GUTBZKcjs.getFarmDeploymentMismatch.call(void 0,
11738
11852
  request2,
@@ -11753,7 +11867,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11753
11867
  });
11754
11868
  let middlewareMap = /* @__PURE__ */ new Map();
11755
11869
  let middlewareContext = /* @__PURE__ */ new Map();
11756
- if (_optionalChain([middlewareManager, 'optionalAccess', _616 => _616.hasMiddleware, 'call', _617 => _617()])) {
11870
+ if (_optionalChain([middlewareManager, 'optionalAccess', _631 => _631.hasMiddleware, 'call', _632 => _632()])) {
11757
11871
  const targetNodeRequest = createPageDataMiddlewareRequest(req, targetRequestUrl);
11758
11872
  const handled = await runFarmMiddlewareWithNavigation(
11759
11873
  farmApp.getServerRenderer(),
@@ -11781,10 +11895,10 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11781
11895
  if (pm) {
11782
11896
  await pm.runHookParallel("afterRouteMatch", {
11783
11897
  pathname: targetPath,
11784
- matched: !!_optionalChain([match, 'optionalAccess', _618 => _618.route]),
11785
- routePattern: _optionalChain([match, 'optionalAccess', _619 => _619.route, 'optionalAccess', _620 => _620.pattern]) || null,
11786
- params: _optionalChain([match, 'optionalAccess', _621 => _621.params]) || {},
11787
- layoutPatterns: (_optionalChain([match, 'optionalAccess', _622 => _622.layouts]) || []).map((l) => l.pattern)
11898
+ matched: !!_optionalChain([match, 'optionalAccess', _633 => _633.route]),
11899
+ routePattern: _optionalChain([match, 'optionalAccess', _634 => _634.route, 'optionalAccess', _635 => _635.pattern]) || null,
11900
+ params: _optionalChain([match, 'optionalAccess', _636 => _636.params]) || {},
11901
+ layoutPatterns: (_optionalChain([match, 'optionalAccess', _637 => _637.layouts]) || []).map((l) => l.pattern)
11788
11902
  });
11789
11903
  }
11790
11904
  if (!match) {
@@ -11801,7 +11915,10 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11801
11915
  return;
11802
11916
  }
11803
11917
  const routeModule = await routeManager3.loadRouteModule(route.modulePath);
11804
- const loadingBoundary = routeManager3.getMatchingLoading(targetRequestUrl.pathname);
11918
+ const loadingBoundary = routeManager3.getMatchingLoading(
11919
+ targetRequestUrl.pathname,
11920
+ route
11921
+ );
11805
11922
  const loadingModule = loadingBoundary ? await routeManager3.loadRouteModule(loadingBoundary.modulePath) : null;
11806
11923
  const navigationManifest = routeManager3.generateClientManifest(server.config.root);
11807
11924
  const moduleMetadata = _nullishCoalesce(navigationManifest.routes.find((entry) => entry.pattern === route.pattern), () => ( getClientModuleMetadata(route.modulePath, server.config.root)));
@@ -11848,24 +11965,28 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11848
11965
  routePath: route.pattern
11849
11966
  });
11850
11967
  for (const layoutModule of layoutModules) {
11851
- mergedMetadata = _chunk3LUF2PE2cjs.mergeMetadata.call(void 0, mergedMetadata, layoutModule.metadata);
11968
+ mergedMetadata = _chunkEK4QAEFZcjs.mergeMetadata.call(void 0, mergedMetadata, layoutModule.metadata);
11852
11969
  if (typeof layoutModule.generateMetadata === "function") {
11853
- mergedMetadata = _chunk3LUF2PE2cjs.mergeMetadata.call(void 0,
11970
+ mergedMetadata = _chunkEK4QAEFZcjs.mergeMetadata.call(void 0,
11854
11971
  mergedMetadata,
11855
11972
  await layoutModule.generateMetadata({ params: routeProps.params })
11856
11973
  );
11857
11974
  }
11975
+ mergedMetadata = await _chunkEK4QAEFZcjs.mergeModuleViewport.call(void 0, mergedMetadata, layoutModule, {
11976
+ params: routeProps.params
11977
+ });
11858
11978
  }
11859
- mergedMetadata = _chunk3LUF2PE2cjs.mergeMetadata.call(void 0, mergedMetadata, routeModule.metadata);
11979
+ mergedMetadata = _chunkEK4QAEFZcjs.mergeMetadata.call(void 0, mergedMetadata, routeModule.metadata);
11860
11980
  if (typeof routeModule.generateMetadata === "function") {
11861
- mergedMetadata = _chunk3LUF2PE2cjs.mergeMetadata.call(void 0,
11981
+ mergedMetadata = _chunkEK4QAEFZcjs.mergeMetadata.call(void 0,
11862
11982
  mergedMetadata,
11863
11983
  await routeModule.generateMetadata(routeProps)
11864
11984
  );
11865
11985
  }
11866
- mergedMetadata = _chunk3LUF2PE2cjs.addMetadataMarkdownAlternate.call(void 0,
11986
+ mergedMetadata = await _chunkEK4QAEFZcjs.mergeModuleViewport.call(void 0, mergedMetadata, routeModule, routeProps);
11987
+ mergedMetadata = _chunkEK4QAEFZcjs.addMetadataMarkdownAlternate.call(void 0,
11867
11988
  mergedMetadata,
11868
- _chunkXXJU7FCCcjs.getFarmMarkdownAlternatePath.call(void 0, farmApp.getConfig().md, targetRequestUrl.pathname)
11989
+ _chunkEUV4YR3Vcjs.getFarmMarkdownAlternatePath.call(void 0, farmApp.getConfig().md, targetRequestUrl.pathname)
11869
11990
  );
11870
11991
  const routeSlots = await Promise.all(
11871
11992
  slots.map(async (slot) => {
@@ -11894,6 +12015,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11894
12015
  return {
11895
12016
  name: slot.name,
11896
12017
  ownerPattern: slot.ownerPattern,
12018
+ ...slot.ownerDirectory ? { ownerDirectory: slot.ownerDirectory } : {},
11897
12019
  containerId: slot.containerId,
11898
12020
  interception: slot.interception,
11899
12021
  fallback: slot.fallback,
@@ -11921,7 +12043,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11921
12043
  pageShouldHydrate: shouldHydrate,
11922
12044
  layoutShouldHydrate: shouldHydrateLayout,
11923
12045
  islandStrategy: hydrationIslandStrategy,
11924
- rendering: _chunkQJ3J6MZTcjs.resolveRouteRenderingConfig.call(void 0, routeModule)
12046
+ rendering: _chunk3BHT4WMPcjs.resolveRouteRenderingConfig.call(void 0, routeModule)
11925
12047
  });
11926
12048
  const destinationLayoutPatterns = layouts.map((layout) => layout.pattern);
11927
12049
  const layoutStartIndex = getSharedLayoutPrefixLength(
@@ -11935,7 +12057,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11935
12057
  middlewareContext,
11936
12058
  () => renderer.renderNavigationFragment({
11937
12059
  PageComponent: routeModule.default,
11938
- LoadingComponent: _optionalChain([loadingModule, 'optionalAccess', _623 => _623.default]),
12060
+ LoadingComponent: _optionalChain([loadingModule, 'optionalAccess', _638 => _638.default]),
11939
12061
  pageProps: routeProps,
11940
12062
  params,
11941
12063
  layouts: layouts.map((layout, index) => ({
@@ -11946,13 +12068,15 @@ window.__FARM_MANIFEST__ = ${inlineValue({
11946
12068
  slots: routeSlots.map((slot) => ({
11947
12069
  name: slot.name,
11948
12070
  ownerPattern: slot.ownerPattern,
12071
+ ownerDirectory: slot.ownerDirectory,
11949
12072
  containerId: slot.containerId,
11950
12073
  module: slot.renderModule,
11951
12074
  props: slot.props
11952
12075
  })),
11953
12076
  pageShouldHydrate: shouldHydrate,
11954
12077
  layoutShouldHydrate: shouldHydrateLayout,
11955
- islandStrategy: hydrationIslandStrategy
12078
+ islandStrategy: hydrationIslandStrategy,
12079
+ serverTree: "serverTree" in moduleMetadata && moduleMetadata.serverTree === true
11956
12080
  })
11957
12081
  )
11958
12082
  );
@@ -12041,14 +12165,14 @@ window.__FARM_MANIFEST__ = ${inlineValue({
12041
12165
  trustProxy: currentServerConfig.trustProxy
12042
12166
  }).pathname;
12043
12167
  const routeManager2 = farmApp.getRouteManager();
12044
- const hasBeforeRouteMatchHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _624 => _624.hasHook, 'call', _625 => _625("beforeRouteMatch")]), () => ( false));
12045
- const hasAfterRouteMatchHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _626 => _626.hasHook, 'call', _627 => _627("afterRouteMatch")]), () => ( false));
12046
- const hasBeforeRequestHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _628 => _628.hasHook, 'call', _629 => _629("beforeRequest")]), () => ( false));
12047
- const hasBeforeRenderHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _630 => _630.hasHook, 'call', _631 => _631("beforeRender")]), () => ( false));
12048
- const hasAfterResponseHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _632 => _632.hasHook, 'call', _633 => _633("afterResponse")]), () => ( false));
12049
- const hasHTMLTransformHook = (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _634 => _634.hasHook, 'call', _635 => _635("transformHTML")]), () => ( false))) || (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _636 => _636.hasHook, 'call', _637 => _637("afterRender")]), () => ( false)));
12050
- const hasRuntimeRequestHooks = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _638 => _638.hasRuntimeRequestHooks, 'call', _639 => _639()]), () => ( false));
12051
- const hasRuntimeAfterHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _640 => _640.hasRuntimeHook, 'call', _641 => _641("after")]), () => ( false));
12168
+ const hasBeforeRouteMatchHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _639 => _639.hasHook, 'call', _640 => _640("beforeRouteMatch")]), () => ( false));
12169
+ const hasAfterRouteMatchHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _641 => _641.hasHook, 'call', _642 => _642("afterRouteMatch")]), () => ( false));
12170
+ const hasBeforeRequestHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _643 => _643.hasHook, 'call', _644 => _644("beforeRequest")]), () => ( false));
12171
+ const hasBeforeRenderHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _645 => _645.hasHook, 'call', _646 => _646("beforeRender")]), () => ( false));
12172
+ const hasAfterResponseHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _647 => _647.hasHook, 'call', _648 => _648("afterResponse")]), () => ( false));
12173
+ const hasHTMLTransformHook = (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _649 => _649.hasHook, 'call', _650 => _650("transformHTML")]), () => ( false))) || (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _651 => _651.hasHook, 'call', _652 => _652("afterRender")]), () => ( false)));
12174
+ const hasRuntimeRequestHooks = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _653 => _653.hasRuntimeRequestHooks, 'call', _654 => _654()]), () => ( false));
12175
+ const hasRuntimeAfterHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _655 => _655.hasRuntimeHook, 'call', _656 => _656("after")]), () => ( false));
12052
12176
  const requestedMatch = routeManager2.matchRoute(requestedPathname);
12053
12177
  let runtimeSession;
12054
12178
  if (pm && hasRuntimeRequestHooks) {
@@ -12059,8 +12183,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
12059
12183
  kind: "page",
12060
12184
  route: {
12061
12185
  pathname: requestedPathname,
12062
- pattern: _optionalChain([requestedMatch, 'optionalAccess', _642 => _642.route, 'optionalAccess', _643 => _643.pattern]) || null,
12063
- params: _optionalChain([requestedMatch, 'optionalAccess', _644 => _644.params]) || {}
12186
+ pattern: _optionalChain([requestedMatch, 'optionalAccess', _657 => _657.route, 'optionalAccess', _658 => _658.pattern]) || null,
12187
+ params: _optionalChain([requestedMatch, 'optionalAccess', _659 => _659.params]) || {}
12064
12188
  }
12065
12189
  }
12066
12190
  );
@@ -12093,17 +12217,17 @@ window.__FARM_MANIFEST__ = ${inlineValue({
12093
12217
  if (pm && hasAfterRouteMatchHook) {
12094
12218
  await pm.runHookParallel("afterRouteMatch", {
12095
12219
  pathname,
12096
- matched: !!_optionalChain([routeMatch, 'optionalAccess', _645 => _645.route]),
12097
- routePattern: _optionalChain([routeMatch, 'optionalAccess', _646 => _646.route, 'optionalAccess', _647 => _647.pattern]) || null,
12098
- params: _optionalChain([routeMatch, 'optionalAccess', _648 => _648.params]) || {},
12099
- layoutPatterns: (_optionalChain([routeMatch, 'optionalAccess', _649 => _649.layouts]) || []).map((l) => l.pattern)
12220
+ matched: !!_optionalChain([routeMatch, 'optionalAccess', _660 => _660.route]),
12221
+ routePattern: _optionalChain([routeMatch, 'optionalAccess', _661 => _661.route, 'optionalAccess', _662 => _662.pattern]) || null,
12222
+ params: _optionalChain([routeMatch, 'optionalAccess', _663 => _663.params]) || {},
12223
+ layoutPatterns: (_optionalChain([routeMatch, 'optionalAccess', _664 => _664.layouts]) || []).map((l) => l.pattern)
12100
12224
  });
12101
12225
  }
12102
12226
  const renderPayload = {
12103
12227
  pathname,
12104
12228
  method,
12105
- routePattern: _optionalChain([routeMatch, 'optionalAccess', _650 => _650.route, 'optionalAccess', _651 => _651.pattern]) || null,
12106
- params: _optionalChain([routeMatch, 'optionalAccess', _652 => _652.params]) || {}
12229
+ routePattern: _optionalChain([routeMatch, 'optionalAccess', _665 => _665.route, 'optionalAccess', _666 => _666.pattern]) || null,
12230
+ params: _optionalChain([routeMatch, 'optionalAccess', _667 => _667.params]) || {}
12107
12231
  };
12108
12232
  const shouldInterceptResponse = Boolean(
12109
12233
  pm && (hasAfterResponseHook || hasHTMLTransformHook || runtimeSession && hasRuntimeAfterHook)
@@ -12125,7 +12249,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
12125
12249
  emitError: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (error) => emitPluginError("response-end", error, { pathname }), "emitError")
12126
12250
  }) : void 0;
12127
12251
  try {
12128
- if (_optionalChain([middlewareManager, 'optionalAccess', _653 => _653.hasMiddleware, 'call', _654 => _654()])) {
12252
+ if (_optionalChain([middlewareManager, 'optionalAccess', _668 => _668.hasMiddleware, 'call', _669 => _669()])) {
12129
12253
  const middlewareRequest = createRequestFromNodeRequest(req, new URL(fullUrl));
12130
12254
  const handled = await runFarmMiddlewareWithNavigation(
12131
12255
  farmApp.getServerRenderer(),
@@ -12135,7 +12259,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
12135
12259
  () => middlewareManager.execute(req, res)
12136
12260
  );
12137
12261
  if (handled) {
12138
- if (!_optionalChain([responseInterceptor, 'optionalAccess', _655 => _655.isEnded, 'call', _656 => _656()])) {
12262
+ if (!_optionalChain([responseInterceptor, 'optionalAccess', _670 => _670.isEnded, 'call', _671 => _671()])) {
12139
12263
  const duration = Date.now() - startTime;
12140
12264
  logResponse(method, urlPath, res.statusCode || 200, duration, "PAGE");
12141
12265
  }
@@ -12147,7 +12271,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
12147
12271
  req.url || "/",
12148
12272
  `http://${req.headers.host || "localhost:3000"}`
12149
12273
  ).pathname;
12150
- const hasLocalPageRoute = Boolean(_optionalChain([routeManager2, 'access', _657 => _657.matchRoute, 'call', _658 => _658(currentPathname), 'optionalAccess', _659 => _659.route]));
12274
+ const hasLocalPageRoute = Boolean(_optionalChain([routeManager2, 'access', _672 => _672.matchRoute, 'call', _673 => _673(currentPathname), 'optionalAccess', _674 => _674.route]));
12151
12275
  await pm.runHookParallelFiltered(
12152
12276
  "beforeRequest",
12153
12277
  (plugin) => !hasLocalPageRoute || plugin.name !== _chunk27ZWSI3Wcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME,
@@ -12155,8 +12279,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
12155
12279
  res
12156
12280
  );
12157
12281
  }
12158
- if (res.writableEnded || _optionalChain([responseInterceptor, 'optionalAccess', _660 => _660.isEnded, 'call', _661 => _661()])) {
12159
- if (!_optionalChain([responseInterceptor, 'optionalAccess', _662 => _662.isEnded, 'call', _663 => _663()])) {
12282
+ if (res.writableEnded || _optionalChain([responseInterceptor, 'optionalAccess', _675 => _675.isEnded, 'call', _676 => _676()])) {
12283
+ if (!_optionalChain([responseInterceptor, 'optionalAccess', _677 => _677.isEnded, 'call', _678 => _678()])) {
12160
12284
  const duration = Date.now() - startTime;
12161
12285
  logResponse(method, urlPath, res.statusCode || 200, duration, "PAGE");
12162
12286
  }
@@ -12214,68 +12338,68 @@ window.__FARM_MANIFEST__ = ${inlineValue({
12214
12338
  if (imageModule) return imageModule;
12215
12339
  }
12216
12340
  if (_chunk6V4TDWECcjs.parseProgrammaticRouteModuleId.call(void 0, id)) {
12217
- const renderer = _optionalChain([farmApp, 'optionalAccess', _664 => _664.getConfig, 'call', _665 => _665(), 'access', _666 => _666.renderer]) || _chunkPSV6XKPOcjs.resolveFarmRenderer.call(void 0, options.renderer);
12218
- return generateProgrammaticRouteModule(id, _optionalChain([server, 'optionalAccess', _667 => _667.config, 'access', _668 => _668.root]) || options.root, renderer);
12341
+ const renderer = _optionalChain([farmApp, 'optionalAccess', _679 => _679.getConfig, 'call', _680 => _680(), 'access', _681 => _681.renderer]) || _chunkPSV6XKPOcjs.resolveFarmRenderer.call(void 0, options.renderer);
12342
+ return generateProgrammaticRouteModule(id, _optionalChain([server, 'optionalAccess', _682 => _682.config, 'access', _683 => _683.root]) || options.root, renderer);
12219
12343
  }
12220
12344
  if (isFarmClientVirtualId(id)) {
12221
- const resolvedConfig = _optionalChain([farmApp, 'optionalAccess', _669 => _669.getConfig, 'call', _670 => _670()]);
12222
- const renderer = _optionalChain([resolvedConfig, 'optionalAccess', _671 => _671.renderer]) || _chunkPSV6XKPOcjs.resolveFarmRenderer.call(void 0, options.renderer);
12223
- const integrations = _optionalChain([resolvedConfig, 'optionalAccess', _672 => _672.integrations]) || options.integrations;
12224
- const root = _optionalChain([resolvedConfig, 'optionalAccess', _673 => _673.root]) || _optionalChain([server, 'optionalAccess', _674 => _674.config, 'access', _675 => _675.root]) || process.cwd();
12225
- const docs = _optionalChain([resolvedConfig, 'optionalAccess', _676 => _676.docs]);
12345
+ const resolvedConfig = _optionalChain([farmApp, 'optionalAccess', _684 => _684.getConfig, 'call', _685 => _685()]);
12346
+ const renderer = _optionalChain([resolvedConfig, 'optionalAccess', _686 => _686.renderer]) || _chunkPSV6XKPOcjs.resolveFarmRenderer.call(void 0, options.renderer);
12347
+ const integrations = _optionalChain([resolvedConfig, 'optionalAccess', _687 => _687.integrations]) || options.integrations;
12348
+ const root = _optionalChain([resolvedConfig, 'optionalAccess', _688 => _688.root]) || _optionalChain([server, 'optionalAccess', _689 => _689.config, 'access', _690 => _690.root]) || process.cwd();
12349
+ const docs = _optionalChain([resolvedConfig, 'optionalAccess', _691 => _691.docs]);
12226
12350
  const adapterOwnsDocsRuntime = Boolean(
12227
- _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([docs, 'optionalAccess', _677 => _677.adapter, 'optionalAccess', _678 => _678.server]) && docs.adapter.react
12351
+ _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([docs, 'optionalAccess', _692 => _692.adapter, 'optionalAccess', _693 => _693.server]) && docs.adapter.react
12228
12352
  );
12229
- const devtools = _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _679 => _679.devtools]), () => ( _chunkYJRZR7VUcjs.resolveFarmDevtoolsConfig.call(void 0, false, "production")));
12353
+ const devtools = _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _694 => _694.devtools]), () => ( _chunkYJRZR7VUcjs.resolveFarmDevtoolsConfig.call(void 0, false, "production")));
12230
12354
  const [docsRuntime, docsSearchRuntime, devtoolsClientRuntime] = await Promise.all([
12231
- _optionalChain([docs, 'optionalAccess', _680 => _680.enabled]) ? loadFarmDocsDevRuntime() : null,
12232
- _optionalChain([docs, 'optionalAccess', _681 => _681.enabled]) && !adapterOwnsDocsRuntime ? loadFarmDocsSearchDevRuntime() : null,
12355
+ _optionalChain([docs, 'optionalAccess', _695 => _695.enabled]) ? loadFarmDocsDevRuntime() : null,
12356
+ _optionalChain([docs, 'optionalAccess', _696 => _696.enabled]) && !adapterOwnsDocsRuntime ? loadFarmDocsSearchDevRuntime() : null,
12233
12357
  devtools.enabled ? loadFarmDevtoolsClientRuntime() : null
12234
12358
  ]);
12235
- const docsSearchEnabled = _nullishCoalesce(_optionalChain([docsSearchRuntime, 'optionalAccess', _682 => _682.isFarmDocsSearchEnabled, 'call', _683 => _683(docs)]), () => ( false));
12359
+ const docsSearchEnabled = _nullishCoalesce(_optionalChain([docsSearchRuntime, 'optionalAccess', _697 => _697.isFarmDocsSearchEnabled, 'call', _698 => _698(docs)]), () => ( false));
12236
12360
  const generatedDocsSearchRuntime = docsSearchRuntime ? docsSearchRuntime.generateFarmDocsSearchClientRuntime(
12237
12361
  docsSearchEnabled,
12238
12362
  docsSearchEnabled ? docsSearchRuntime.resolveFarmDocsSearchClientModule(root) : void 0
12239
12363
  ) : EMPTY_FARM_DOCS_SEARCH_CLIENT_RUNTIME;
12240
12364
  const generatedDevtoolsClientRuntime = devtoolsClientRuntime ? devtoolsClientRuntime.generateFarmDevtoolsClientRuntime(devtools) : "";
12241
12365
  const generatedDevIndicatorsClientRuntime = farmApp ? _chunk6MVFL3R5cjs.generateFarmDevIndicatorsClientRuntime.call(void 0, farmApp.getConfig().devIndicators) : "";
12242
- const integrationProviders = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) ? _chunkTDFPACVXcjs.getIntegrationProviders.call(void 0, integrations) : [];
12366
+ const integrationProviders = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) ? _chunkFTFYRMQQcjs.getIntegrationProviders.call(void 0, integrations) : [];
12243
12367
  const isolatedHydrationMode = resolveFarmIsolatedClientHydrationMode(
12244
- _optionalChain([resolvedConfig, 'optionalAccess', _684 => _684.experimental, 'optionalAccess', _685 => _685.isolatedClientHydration]),
12368
+ _optionalChain([resolvedConfig, 'optionalAccess', _699 => _699.experimental, 'optionalAccess', _700 => _700.isolatedClientHydration]),
12245
12369
  {
12246
- serverComponents: _optionalChain([resolvedConfig, 'optionalAccess', _686 => _686.experimental, 'optionalAccess', _687 => _687.serverComponents]) === true,
12370
+ serverComponents: _optionalChain([resolvedConfig, 'optionalAccess', _701 => _701.experimental, 'optionalAccess', _702 => _702.serverComponents]) === true,
12247
12371
  hasUnsupportedIntegrationProvider: integrationProviders.filter((provider) => provider.component || provider.type === "clerk").some((provider) => provider.supportsIsolatedHydration !== true)
12248
12372
  }
12249
12373
  );
12250
12374
  return generateClientCode(
12251
12375
  integrationProviders,
12252
12376
  [
12253
- ..._chunkTDFPACVXcjs.getIntegrationDocumentNavigationMatchers.call(void 0, integrations),
12254
- ..._nullishCoalesce(_optionalChain([docsRuntime, 'optionalAccess', _688 => _688.getFarmDocsDocumentNavigationMatchers, 'call', _689 => _689(docs)]), () => ( []))
12377
+ ..._chunkFTFYRMQQcjs.getIntegrationDocumentNavigationMatchers.call(void 0, integrations),
12378
+ ..._nullishCoalesce(_optionalChain([docsRuntime, 'optionalAccess', _703 => _703.getFarmDocsDocumentNavigationMatchers, 'call', _704 => _704(docs)]), () => ( []))
12255
12379
  ],
12256
12380
  generatedDocsSearchRuntime,
12257
12381
  `${generatedDevtoolsClientRuntime}
12258
12382
  ${generatedDevIndicatorsClientRuntime}`,
12259
- _optionalChain([resolvedConfig, 'optionalAccess', _690 => _690.plugins]) || [],
12383
+ _optionalChain([resolvedConfig, 'optionalAccess', _705 => _705.plugins]) || [],
12260
12384
  root,
12261
- _optionalChain([resolvedConfig, 'optionalAccess', _691 => _691.srcDir]) || options.srcDir || "src",
12262
- _optionalChain([resolvedConfig, 'optionalAccess', _692 => _692.publicRuntimeConfig]) || options.publicRuntimeConfig,
12263
- _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) ? _optionalChain([docs, 'optionalAccess', _693 => _693.adapter, 'optionalAccess', _694 => _694.react]) : void 0,
12385
+ _optionalChain([resolvedConfig, 'optionalAccess', _706 => _706.srcDir]) || options.srcDir || "src",
12386
+ _optionalChain([resolvedConfig, 'optionalAccess', _707 => _707.publicRuntimeConfig]) || options.publicRuntimeConfig,
12387
+ _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) ? _optionalChain([docs, 'optionalAccess', _708 => _708.adapter, 'optionalAccess', _709 => _709.react]) : void 0,
12264
12388
  renderer,
12265
- isolatedHydrationMode === "enabled" || _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([(_nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _695 => _695.getRouteManager, 'call', _696 => _696(), 'access', _697 => _697.getIsolatedClientBoundaryModules, 'call', _698 => _698(root)])))), 'optionalAccess', _699 => _699.size]) > 0,
12266
- _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _700 => _700.trailingSlash]), () => ( false)),
12267
- _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _701 => _701.basePath]), () => ( "/")),
12389
+ isolatedHydrationMode === "enabled" || _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([(_nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _710 => _710.getRouteManager, 'call', _711 => _711(), 'access', _712 => _712.getIsolatedClientBoundaryModules, 'call', _713 => _713(root)])))), 'optionalAccess', _714 => _714.size]) > 0,
12390
+ _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _715 => _715.trailingSlash]), () => ( false)),
12391
+ _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _716 => _716.basePath]), () => ( "/")),
12268
12392
  generateClientCachePersistenceCode(
12269
- resolveFarmClientCacheAdapterEntry(root, _optionalChain([resolvedConfig, 'optionalAccess', _702 => _702.cache]))
12393
+ resolveFarmClientCacheAdapterEntry(root, _optionalChain([resolvedConfig, 'optionalAccess', _717 => _717.cache]))
12270
12394
  ),
12271
- _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) ? _chunk75WGQVQAcjs.getFarmDocsAdapterConfigModule.call(void 0, docs) : void 0
12395
+ _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) ? _chunkHITLGIAOcjs.getFarmDocsAdapterConfigModule.call(void 0, docs) : void 0
12272
12396
  );
12273
12397
  }
12274
12398
  if (id === "/@farm/server") {
12275
12399
  return generateServerCode();
12276
12400
  }
12277
12401
  if (id === "/@farm/manifest") {
12278
- const routeManager = _optionalChain([farmApp, 'optionalAccess', _703 => _703.getRouteManager, 'call', _704 => _704()]);
12402
+ const routeManager = _optionalChain([farmApp, 'optionalAccess', _718 => _718.getRouteManager, 'call', _719 => _719()]);
12279
12403
  if (!routeManager) {
12280
12404
  return `
12281
12405
  export const getManifest = () => ({
@@ -12290,7 +12414,7 @@ export const getManifest = () => ({
12290
12414
  const manifest = routeManager.generateClientManifest(server.config.root);
12291
12415
  const globalStylesheetHref = resolveDevGlobalStylesheetHref(
12292
12416
  server.config.root,
12293
- _optionalChain([farmApp, 'optionalAccess', _705 => _705.getConfig, 'call', _706 => _706(), 'access', _707 => _707.srcDir])
12417
+ _optionalChain([farmApp, 'optionalAccess', _720 => _720.getConfig, 'call', _721 => _721(), 'access', _722 => _722.srcDir])
12294
12418
  );
12295
12419
  const fullManifest = {
12296
12420
  clientEntry: "/@farm/client.js",
@@ -12303,6 +12427,7 @@ export const getManifest = () => ({
12303
12427
  fullManifest.routes[route.pattern] = {
12304
12428
  modulePath: route.modulePath,
12305
12429
  pattern: route.pattern,
12430
+ ...route.directory ? { directory: route.directory } : {},
12306
12431
  segments: route.segments,
12307
12432
  search: route.search,
12308
12433
  isClientComponent: route.isClientComponent,
@@ -12315,9 +12440,11 @@ export const getManifest = () => ({
12315
12440
  };
12316
12441
  }
12317
12442
  for (const layout of manifest.layouts) {
12443
+ const groupScope = _chunkIPXLADVOcjs.getRouteGroupScope.call(void 0, layout.pattern);
12318
12444
  fullManifest.layouts[layout.pattern] = {
12319
12445
  modulePath: layout.modulePath,
12320
12446
  pattern: layout.pattern,
12447
+ ...groupScope ? { urlPattern: _chunkIPXLADVOcjs.stripRouteGroups.call(void 0, layout.pattern), groupScope } : {},
12321
12448
  shouldHydrate: layout.shouldHydrate,
12322
12449
  islandStrategy: layout.islandStrategy,
12323
12450
  preloads: [layout.modulePath],
@@ -12341,17 +12468,24 @@ export const manifest = getManifest();
12341
12468
  }
12342
12469
  },
12343
12470
  async transform(code, id, transformOptions) {
12344
- if (!_optionalChain([transformOptions, 'optionalAccess', _708 => _708.ssr])) {
12345
- const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _709 => _709.getConfig, 'call', _710 => _710()]), () => ( options));
12346
- if (_optionalChain([currentConfig, 'access', _711 => _711.experimental, 'optionalAccess', _712 => _712.serverActions]) !== true || !serverFnTransformActive) {
12471
+ if (!_optionalChain([transformOptions, 'optionalAccess', _723 => _723.ssr])) {
12472
+ const docsConfigModule = _chunkHITLGIAOcjs.getFarmDocsAdapterConfigModule.call(void 0, _optionalChain([farmApp, 'optionalAccess', _724 => _724.getConfig, 'call', _725 => _725(), 'optionalAccess', _726 => _726.docs]));
12473
+ if (isFarmDocsClientConfigModule(id, docsConfigModule)) {
12474
+ const redacted = redactFarmDocsClientConfig(code, id.split("?")[0]);
12475
+ if (redacted !== null) return { code: redacted, map: null };
12476
+ }
12477
+ }
12478
+ if (!_optionalChain([transformOptions, 'optionalAccess', _727 => _727.ssr])) {
12479
+ const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _728 => _728.getConfig, 'call', _729 => _729()]), () => ( options));
12480
+ if (_optionalChain([currentConfig, 'access', _730 => _730.experimental, 'optionalAccess', _731 => _731.serverActions]) !== true || !serverFnTransformActive) {
12347
12481
  const violation = findClientServerFnViolation(code, id);
12348
12482
  if (violation) {
12349
12483
  this.error(formatServerFnBoundaryError(violation, id));
12350
12484
  }
12351
12485
  }
12352
12486
  }
12353
- if (!_optionalChain([transformOptions, 'optionalAccess', _713 => _713.ssr]) && shouldInspectClientBoundary(id, code)) {
12354
- warnClientBoundaryOnce(this, id, code, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _714 => _714.getConfig, 'call', _715 => _715()]), () => ( options)));
12487
+ if (!_optionalChain([transformOptions, 'optionalAccess', _732 => _732.ssr]) && shouldInspectClientBoundary(id, code)) {
12488
+ warnClientBoundaryOnce(this, id, code, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _733 => _733.getConfig, 'call', _734 => _734()]), () => ( options)));
12355
12489
  }
12356
12490
  if (typeof imageImports.transform === "function") {
12357
12491
  const imageModule = await imageImports.transform.call(this, code, id, transformOptions);
@@ -12366,13 +12500,13 @@ export const manifest = getManifest();
12366
12500
  id,
12367
12501
  transformOptions
12368
12502
  );
12369
- const fontCode = typeof fontResult === "string" ? fontResult : _optionalChain([fontResult, 'optionalAccess', _716 => _716.code, 'optionalAccess', _717 => _717.toString, 'call', _718 => _718()]);
12503
+ const fontCode = typeof fontResult === "string" ? fontResult : _optionalChain([fontResult, 'optionalAccess', _735 => _735.code, 'optionalAccess', _736 => _736.toString, 'call', _737 => _737()]);
12370
12504
  if (fontCode) {
12371
12505
  transformedCode = fontCode;
12372
12506
  transformed = true;
12373
12507
  }
12374
12508
  }
12375
- if (_optionalChain([transformOptions, 'optionalAccess', _719 => _719.ssr]) && server) {
12509
+ if (_optionalChain([transformOptions, 'optionalAccess', _738 => _738.ssr]) && server) {
12376
12510
  const rewrittenImports = rewriteEarlySsrRelativeImports({
12377
12511
  code: transformedCode,
12378
12512
  id,
@@ -12392,12 +12526,12 @@ export const manifest = getManifest();
12392
12526
  }
12393
12527
  transformedCode = stripUseClientDirective(transformedCode);
12394
12528
  transformed = true;
12395
- const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _720 => _720.getConfig, 'call', _721 => _721()]), () => ( options));
12529
+ const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _739 => _739.getConfig, 'call', _740 => _740()]), () => ( options));
12396
12530
  let isolatedModuleReference = null;
12397
- const root = currentConfig.root || _optionalChain([server, 'optionalAccess', _722 => _722.config, 'access', _723 => _723.root]) || process.cwd();
12531
+ const root = currentConfig.root || _optionalChain([server, 'optionalAccess', _741 => _741.config, 'access', _742 => _742.root]) || process.cwd();
12398
12532
  const cleanId = id.split("?", 1)[0];
12399
- const selectedIsolatedModules = _nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _724 => _724.getRouteManager, 'call', _725 => _725(), 'access', _726 => _726.getIsolatedClientBoundaryModules, 'call', _727 => _727(root)])));
12400
- const selectedForIsolatedHydration = _optionalChain([selectedIsolatedModules, 'optionalAccess', _728 => _728.has, 'call', _729 => _729(path20.resolve(cleanId))]) === true;
12533
+ const selectedIsolatedModules = _nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _743 => _743.getRouteManager, 'call', _744 => _744(), 'access', _745 => _745.getIsolatedClientBoundaryModules, 'call', _746 => _746(root)])));
12534
+ const selectedForIsolatedHydration = _optionalChain([selectedIsolatedModules, 'optionalAccess', _747 => _747.has, 'call', _748 => _748(path21.resolve(cleanId))]) === true;
12401
12535
  if (_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, _chunkPSV6XKPOcjs.resolveFarmRenderer.call(void 0, currentConfig.renderer)) && selectedForIsolatedHydration && isIsolatableClientBoundarySource(clientBoundarySource)) {
12402
12536
  isolatedModuleReference = _chunk5QIKR7RRcjs.toViteModuleId.call(void 0, cleanId, root);
12403
12537
  const transformedBoundary = transformIsolatedClientBoundaryModule({
@@ -12434,7 +12568,7 @@ export const manifest = getManifest();
12434
12568
  );
12435
12569
  return;
12436
12570
  }` : "";
12437
- const hmrCode = _optionalChain([transformOptions, 'optionalAccess', _730 => _730.ssr]) || !shouldEmitFarmClientRootHmr(currentConfig.renderer) ? "" : `
12571
+ const hmrCode = _optionalChain([transformOptions, 'optionalAccess', _749 => _749.ssr]) || !shouldEmitFarmClientRootHmr(currentConfig.renderer) ? "" : `
12438
12572
  if (import.meta.hot) {
12439
12573
  import.meta.hot.accept((newModule) => {
12440
12574
  ${isolatedHmrUpdate}
@@ -12477,6 +12611,7 @@ if (import.meta.hot) {
12477
12611
  });
12478
12612
  },
12479
12613
  async closeBundle() {
12614
+ if (!isBuild) releaseDocsMCPServers();
12480
12615
  if (!farmApp || !isBuild) return;
12481
12616
  try {
12482
12617
  const routeManager = farmApp.getRouteManager();
@@ -12488,14 +12623,14 @@ if (import.meta.hot) {
12488
12623
  }
12489
12624
  _chunk5QIKR7RRcjs.logger.info(`Found ${ssgPages.length} SSG pages, ${ssrRoutes.length} SSR routes`);
12490
12625
  _chunk5QIKR7RRcjs.logger.info("Pre-rendering SSG pages...");
12491
- const outDir = path20.join(_optionalChain([server, 'optionalAccess', _731 => _731.config, 'access', _732 => _732.root]) || process.cwd(), options.outDir || "dist");
12492
- const clientDir = path20.join(outDir, "client");
12626
+ const outDir = path21.join(_optionalChain([server, 'optionalAccess', _750 => _750.config, 'access', _751 => _751.root]) || process.cwd(), options.outDir || "dist");
12627
+ const clientDir = path21.join(outDir, "client");
12493
12628
  for (const page of ssgPages) {
12494
12629
  try {
12495
12630
  const staticRequest = new Request(new URL(page.urlPath, "http://farm.static"));
12496
12631
  await farmApp.getServerRenderer().runWithRequestContext(staticRequest, async () => {
12497
12632
  const mod = await routeManager.loadRouteModule(page.filePath);
12498
- if (!_optionalChain([mod, 'optionalAccess', _733 => _733.default])) return;
12633
+ if (!_optionalChain([mod, 'optionalAccess', _752 => _752.default])) return;
12499
12634
  const { layouts } = routeManager.matchRoute(page.urlPath);
12500
12635
  const layoutModules = await Promise.all(
12501
12636
  layouts.map((l) => routeManager.loadLayoutModule(l.modulePath))
@@ -12527,7 +12662,7 @@ if (import.meta.hot) {
12527
12662
  const i18nSnapshot = _chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0, );
12528
12663
  const i18nHead = renderFarmI18nStaticHead(page.urlPath, i18nSnapshot);
12529
12664
  const fullHtml = `<!DOCTYPE html>
12530
- <html lang="${escapeFarmHtmlAttribute(_optionalChain([i18nSnapshot, 'optionalAccess', _734 => _734.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}>
12665
+ <html lang="${escapeFarmHtmlAttribute(_optionalChain([i18nSnapshot, 'optionalAccess', _753 => _753.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}>
12531
12666
  <head>
12532
12667
  <meta charset="utf-8">
12533
12668
  <meta name="viewport" content="width=device-width, initial-scale=1">
@@ -12541,8 +12676,8 @@ if (import.meta.hot) {
12541
12676
  <script type="module" src="/assets/client.js"></script>
12542
12677
  </body>
12543
12678
  </html>`;
12544
- const outputPath = page.urlPath === "/" ? path20.join(clientDir, "index.html") : path20.join(clientDir, page.urlPath + ".html");
12545
- fs11.mkdirSync(path20.dirname(outputPath), { recursive: true });
12679
+ const outputPath = page.urlPath === "/" ? path21.join(clientDir, "index.html") : path21.join(clientDir, page.urlPath + ".html");
12680
+ fs11.mkdirSync(path21.dirname(outputPath), { recursive: true });
12546
12681
  fs11.writeFileSync(outputPath, fullHtml);
12547
12682
  const revalidateInfo = page.revalidate ? ` (revalidate: ${page.revalidate}s)` : "";
12548
12683
  _chunk5QIKR7RRcjs.logger.success(` \u2713 ${page.urlPath}${revalidateInfo}`);
@@ -12551,7 +12686,7 @@ if (import.meta.hot) {
12551
12686
  _chunk5QIKR7RRcjs.logger.error(` \u2717 ${page.urlPath}: ${error}`);
12552
12687
  }
12553
12688
  }
12554
- const manifestPath = path20.join(outDir, "__ssg_manifest.json");
12689
+ const manifestPath = path21.join(outDir, "__ssg_manifest.json");
12555
12690
  fs11.writeFileSync(
12556
12691
  manifestPath,
12557
12692
  JSON.stringify(
@@ -12585,23 +12720,23 @@ if (import.meta.hot) {
12585
12720
  });
12586
12721
  }
12587
12722
  }
12588
- const currentFarmConfig = _optionalChain([farmApp, 'optionalAccess', _735 => _735.getConfig, 'call', _736 => _736()]);
12723
+ const currentFarmConfig = _optionalChain([farmApp, 'optionalAccess', _754 => _754.getConfig, 'call', _755 => _755()]);
12589
12724
  const normalizedFile = file.replace(/\\/g, "/");
12590
12725
  if (currentFarmConfig && /\/route\.(?:ts|tsx|js|jsx)$/.test(normalizedFile) && _chunkVPTDD5XFcjs.getFarmAppDirectories.call(void 0, currentFarmConfig).some(
12591
12726
  (appDir) => normalizedFile.startsWith(`${_chunk5QIKR7RRcjs.toPosixPath.call(void 0, appDir)}/api/`)
12592
12727
  )) {
12593
12728
  for (const mod of modules) server2.moduleGraph.invalidateModule(mod);
12594
- await _optionalChain([refreshRouteDiscovery, 'optionalCall', _737 => _737(`updated ${file}`)]);
12729
+ await _optionalChain([refreshRouteDiscovery, 'optionalCall', _756 => _756(`updated ${file}`)]);
12595
12730
  server2.ws.send({ type: "full-reload", path: "*" });
12596
12731
  return [];
12597
12732
  }
12598
- const currentSrcRoot = currentFarmConfig ? _chunkVPTDD5XFcjs.getFarmSourceRoots.call(void 0, currentFarmConfig).map((source) => path20.join(source.root, source.srcDir).replace(/\\/g, "/")).find((sourceRoot) => normalizedFile.startsWith(`${sourceRoot}/`)) || null : null;
12733
+ const currentSrcRoot = currentFarmConfig ? _chunkVPTDD5XFcjs.getFarmSourceRoots.call(void 0, currentFarmConfig).map((source) => path21.join(source.root, source.srcDir).replace(/\\/g, "/")).find((sourceRoot) => normalizedFile.startsWith(`${sourceRoot}/`)) || null : null;
12599
12734
  if (currentSrcRoot && normalizedFile.startsWith(`${currentSrcRoot}/`) && _chunk6V4TDWECcjs.isProgrammaticRoutesFileName.call(void 0, normalizedFile)) {
12600
- logUpdate("PAGE", `updated ${path20.basename(file)}`);
12735
+ logUpdate("PAGE", `updated ${path21.basename(file)}`);
12601
12736
  for (const mod of modules) {
12602
12737
  server2.moduleGraph.invalidateModule(mod);
12603
12738
  }
12604
- await _optionalChain([refreshRouteDiscovery, 'optionalCall', _738 => _738(`updated ${file}`)]);
12739
+ await _optionalChain([refreshRouteDiscovery, 'optionalCall', _757 => _757(`updated ${file}`)]);
12605
12740
  server2.ws.send({
12606
12741
  type: "full-reload",
12607
12742
  path: "*"
@@ -12614,17 +12749,17 @@ if (import.meta.hot) {
12614
12749
  for (const mod of modules) {
12615
12750
  server2.moduleGraph.invalidateModule(mod);
12616
12751
  }
12617
- await _optionalChain([refreshRouteDiscovery, 'optionalCall', _739 => _739(`updated ${file}`)]);
12752
+ await _optionalChain([refreshRouteDiscovery, 'optionalCall', _758 => _758(`updated ${file}`)]);
12618
12753
  server2.ws.send({
12619
12754
  type: "full-reload",
12620
12755
  path: "*"
12621
12756
  });
12622
12757
  return [];
12623
12758
  }
12624
- const isolatedHydrationMode = _optionalChain([currentFarmConfig, 'optionalAccess', _740 => _740.experimental, 'optionalAccess', _741 => _741.isolatedClientHydration]);
12625
- const planRouteManager = _optionalChain([farmApp, 'optionalAccess', _742 => _742.getRouteManager, 'call', _743 => _743()]);
12759
+ const isolatedHydrationMode = _optionalChain([currentFarmConfig, 'optionalAccess', _759 => _759.experimental, 'optionalAccess', _760 => _760.isolatedClientHydration]);
12760
+ const planRouteManager = _optionalChain([farmApp, 'optionalAccess', _761 => _761.getRouteManager, 'call', _762 => _762()]);
12626
12761
  const isHydrationPlanSource = currentSrcRoot !== null && normalizedFile.startsWith(`${currentSrcRoot}/`) && /\.[cm]?[jt]sx?$/.test(normalizedFile);
12627
- const tracksAsyncOwnerIslands = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, _optionalChain([currentFarmConfig, 'optionalAccess', _744 => _744.renderer])) && planRouteManager !== void 0;
12762
+ const tracksAsyncOwnerIslands = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, _optionalChain([currentFarmConfig, 'optionalAccess', _763 => _763.renderer])) && planRouteManager !== void 0;
12628
12763
  if (isHydrationPlanSource && (isolatedHydrationMode === "enabled" || isolatedHydrationMode === "analyze" || tracksAsyncOwnerIslands)) {
12629
12764
  const routeManager = planRouteManager;
12630
12765
  if (routeManager) {
@@ -12684,7 +12819,7 @@ if (import.meta.hot) {
12684
12819
  }
12685
12820
  return [];
12686
12821
  }
12687
- _optionalChain([farmApp, 'optionalAccess', _745 => _745.getRouteManager, 'call', _746 => _746(), 'access', _747 => _747.invalidateClientManifest, 'call', _748 => _748()]);
12822
+ _optionalChain([farmApp, 'optionalAccess', _764 => _764.getRouteManager, 'call', _765 => _765(), 'access', _766 => _766.invalidateClientManifest, 'call', _767 => _767()]);
12688
12823
  const manifestModule = server2.moduleGraph.getModuleById("/@farm/manifest");
12689
12824
  if (manifestModule) {
12690
12825
  server2.moduleGraph.invalidateModule(manifestModule);
@@ -12728,12 +12863,12 @@ function createPageDataMiddlewareRequest(req, target) {
12728
12863
  _chunkS3JO3N4Hcjs.__name.call(void 0, createPageDataMiddlewareRequest, "createPageDataMiddlewareRequest");
12729
12864
  function resolveDevelopmentRoot(farmRoot, viteRoot) {
12730
12865
  if (!farmRoot) return viteRoot;
12731
- if (path20.resolve(farmRoot) === path20.resolve(viteRoot)) return farmRoot;
12866
+ if (path21.resolve(farmRoot) === path21.resolve(viteRoot)) return farmRoot;
12732
12867
  try {
12733
12868
  if (fs11.realpathSync(farmRoot) === fs11.realpathSync(viteRoot)) {
12734
- return path20.resolve(viteRoot);
12869
+ return path21.resolve(viteRoot);
12735
12870
  }
12736
- } catch (e39) {
12871
+ } catch (e40) {
12737
12872
  }
12738
12873
  return farmRoot;
12739
12874
  }
@@ -13053,12 +13188,12 @@ async function parseRouteModuleProps2(routeModule, input) {
13053
13188
  }
13054
13189
  const schemas = routeModule.__farmRouteSchemas;
13055
13190
  const params = parseRouteModuleSchema2(
13056
- _optionalChain([schemas, 'optionalAccess', _749 => _749.params]),
13191
+ _optionalChain([schemas, 'optionalAccess', _768 => _768.params]),
13057
13192
  input.props.params,
13058
13193
  "params",
13059
13194
  input.routePath
13060
13195
  );
13061
- const search = parseRouteModuleSchema2(_optionalChain([schemas, 'optionalAccess', _750 => _750.search]), input.search, "search", input.routePath);
13196
+ const search = parseRouteModuleSchema2(_optionalChain([schemas, 'optionalAccess', _769 => _769.search]), input.search, "search", input.routePath);
13062
13197
  return {
13063
13198
  ...input.props,
13064
13199
  params,
@@ -13096,8 +13231,9 @@ function generateClientCode(integrationProviders = [], documentNavigationMatcher
13096
13231
  import { hydrateRoot, createRoot } from 'react-dom/client'` : appSetupPath ? `import React, { hydrateRoot, createRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)}
13097
13232
  import __farmAppSetup from ${JSON.stringify(_chunk5QIKR7RRcjs.toViteModuleId.call(void 0, appSetupPath, root))}
13098
13233
  __farmConfigureApp(__farmAppSetup)` : `import React, { hydrateRoot, createRoot } from ${JSON.stringify(renderer.client)}`;
13099
- const isolatedHydrationImport = isolatedHydrationEnabled ? `import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph } from '@farm.js/core/internal/isolated-boundary'` : "";
13100
- const docsAdapterImportBlock = _chunk75WGQVQAcjs.generateFarmDocsAdapterClientRuntime.call(void 0,
13234
+ const isolatedHydrationImport = isolatedHydrationEnabled ? `import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph } from '@farm.js/core/internal/isolated-boundary'
13235
+ import { createFarmServerTreeElement } from '@farm.js/core/internal/server-tree'` : "";
13236
+ const docsAdapterImportBlock = _chunkHITLGIAOcjs.generateFarmDocsAdapterClientRuntime.call(void 0,
13101
13237
  docsAdapterReact,
13102
13238
  docsConfigModule
13103
13239
  );
@@ -13118,7 +13254,21 @@ function disposeFarmIsolatedClientBoundaries(scope) {
13118
13254
 
13119
13255
  async function hydrateFarmIsolatedClientBoundaries(scope = document, signal) {
13120
13256
  await farmIsolatedHydrationRuntime.hydrate(scope, signal);
13121
- }` : "";
13257
+ }
13258
+
13259
+ // A server-tree page (an async page below a hydrating layout) rebuilds in the layout's root.
13260
+ async function createFarmServerTreePageElement(source, pathname) {
13261
+ try {
13262
+ return await createFarmServerTreeElement(React, source, {
13263
+ load: (reference) => import(/* @vite-ignore */ reference),
13264
+ ServerHtml: FarmServerPage,
13265
+ key: pathname,
13266
+ });
13267
+ } catch (error) {
13268
+ console.warn('[Farm.js] Could not rebuild the server tree of ' + pathname + '; its server HTML was kept.', error);
13269
+ return null;
13270
+ }
13271
+ }` : `async function createFarmServerTreePageElement() { return null; }`;
13122
13272
  return `
13123
13273
  ${rendererClientImports}
13124
13274
  ${isolatedHydrationImport}
@@ -13259,14 +13409,29 @@ function findLayouts(pathname) {
13259
13409
  const manifest = getManifest();
13260
13410
  const layouts = Object.values(manifest.layouts);
13261
13411
  const matchingLayouts = [];
13412
+ let directory;
13262
13413
 
13263
13414
  for (const layout of layouts) {
13264
- if (layout.pattern === '/' || isFarmRouteActive(layout.pattern, pathname, { exact: false })) {
13265
- matchingLayouts.push(layout);
13415
+ // Route groups add no URL segment: match the layout's URL, then keep a
13416
+ // grouped layout to the pages inside its group directory.
13417
+ const urlPattern = layout.urlPattern || layout.pattern;
13418
+ if (urlPattern !== '/' && !isFarmRouteActive(urlPattern, pathname, { exact: false })) continue;
13419
+ if (layout.groupScope) {
13420
+ if (directory === undefined) {
13421
+ const route = findRoute(pathname)?.route;
13422
+ directory = route ? route.directory || route.pattern : null;
13423
+ }
13424
+ if (
13425
+ typeof directory !== 'string' ||
13426
+ (directory !== layout.groupScope && !directory.startsWith(layout.groupScope + '/'))
13427
+ ) continue;
13266
13428
  }
13429
+ matchingLayouts.push(layout);
13267
13430
  }
13268
13431
 
13269
- return matchingLayouts.sort((a, b) => a.pattern.length - b.pattern.length);
13432
+ return matchingLayouts.sort(
13433
+ (a, b) => a.pattern.split('/').filter(Boolean).length - b.pattern.split('/').filter(Boolean).length,
13434
+ );
13270
13435
  }
13271
13436
 
13272
13437
  // ====== SPA ROUTER ======
@@ -14048,14 +14213,23 @@ async function tryHydrateImportedPage(
14048
14213
  } else if (layoutShouldHydrate) {
14049
14214
  currentPageProps = existingProps || { params };
14050
14215
  const serverPage = document.getElementById('__farm_page__');
14051
- pageElement = createLayoutPageBoundary(
14052
- false,
14053
- islandStrategy,
14054
- null,
14055
- typeof hydrationOptions.serverHtml === 'string'
14056
- ? hydrationOptions.serverHtml
14057
- : serverPage ? serverPage.innerHTML : '',
14058
- );
14216
+ const pageSource = typeof hydrationOptions.serverHtml === 'string'
14217
+ ? hydrationOptions.serverHtml
14218
+ : serverPage;
14219
+ const serverTree = pageSource
14220
+ ? await createFarmServerTreePageElement(pageSource, window.location.pathname)
14221
+ : null;
14222
+ if (signal?.aborted || !container?.isConnected) return false;
14223
+ pageElement = serverTree
14224
+ ? createLayoutPageBoundary(false, islandStrategy, serverTree)
14225
+ : createLayoutPageBoundary(
14226
+ false,
14227
+ islandStrategy,
14228
+ null,
14229
+ typeof hydrationOptions.serverHtml === 'string'
14230
+ ? hydrationOptions.serverHtml
14231
+ : serverPage ? serverPage.innerHTML : '',
14232
+ );
14059
14233
  }
14060
14234
  if (signal?.aborted || !container?.isConnected || !pageElement) return false;
14061
14235
 
@@ -14241,6 +14415,8 @@ async function renderPage(pageData) {
14241
14415
  loadingModulePath: pageData.loadingModulePath,
14242
14416
  };
14243
14417
  const params = pageData.props?.params || {};
14418
+ // Page data carries middleware data as JSON, the way a full load embeds it.
14419
+ const pageProps = pageData.props ? normalizeServerProps(pageData.props) : pageData.props;
14244
14420
  const nextLayoutPatterns = Array.isArray(pageData.fragment?.layoutPatterns)
14245
14421
  ? pageData.fragment.layoutPatterns
14246
14422
  : [];
@@ -14257,6 +14433,20 @@ async function renderPage(pageData) {
14257
14433
  let fragmentHtml = pageData.fragment?.html;
14258
14434
  let layoutPatterns = nextLayoutPatterns;
14259
14435
 
14436
+ // The fragment leaves out the layouts both routes share. When React owns the
14437
+ // current layouts and will not keep rendering them, the swap below replaces the
14438
+ // whole container, so a fragment without its outer layouts would drop them.
14439
+ // Load the complete route for that swap instead.
14440
+ if (
14441
+ typeof fragmentHtml === 'string' &&
14442
+ activeLayoutShouldHydrate &&
14443
+ !(route.layoutShouldHydrate && (appRoot || reactRoot)) &&
14444
+ nextLayoutPatterns.length > 0 &&
14445
+ !findLayoutBoundary(parseNavigationFragment(fragmentHtml), nextLayoutPatterns[0])
14446
+ ) {
14447
+ fragmentHtml = undefined;
14448
+ }
14449
+
14260
14450
  if (typeof fragmentHtml !== 'string') {
14261
14451
  const deploymentId = window.__FARM_DEPLOYMENT_ID__;
14262
14452
  const response = await fetch(path, {
@@ -14297,7 +14487,7 @@ async function renderPage(pageData) {
14297
14487
  params,
14298
14488
  layouts,
14299
14489
  false,
14300
- pageData.props,
14490
+ pageProps,
14301
14491
  null,
14302
14492
  {
14303
14493
  pageShouldHydrate,
@@ -14343,7 +14533,7 @@ async function renderPage(pageData) {
14343
14533
  params,
14344
14534
  layouts,
14345
14535
  true,
14346
- pageData.props,
14536
+ pageProps,
14347
14537
  hydrationController.signal,
14348
14538
  {
14349
14539
  pageShouldHydrate,
@@ -14457,17 +14647,20 @@ async function hydrate() {
14457
14647
  return
14458
14648
  }
14459
14649
 
14460
- // Get props - either from server-injected props or by matching the current URL
14461
- if (!pageProps || !pageProps.params || Object.keys(pageProps.params).length === 0) {
14462
- // Extract params from URL using manifest route matching (fallback)
14650
+ // Use the server-injected props. A document that carries no params (a route
14651
+ // without any, or generated HTML) takes them from the current URL, keeping
14652
+ // what the server rendered with, such as middleware data.
14653
+ if (!pageProps.params || Object.keys(pageProps.params).length === 0) {
14463
14654
  const pathname = window.location.pathname;
14464
14655
  const foundRoute = findRoute(pathname);
14465
- pageProps = normalizeServerProps({
14466
- params: foundRoute?.params || {},
14467
- search: getCurrentSearchParams(),
14468
- searchParams: getCurrentSearchParams(),
14656
+ const search = getCurrentSearchParams();
14657
+ pageProps = {
14658
+ search,
14659
+ searchParams: search,
14469
14660
  path: pathname,
14470
- });
14661
+ ...pageProps,
14662
+ params: foundRoute?.params || {},
14663
+ };
14471
14664
  }
14472
14665
  currentPageProps = pageProps;
14473
14666
 
@@ -14660,8 +14853,8 @@ function generateClientManifest(bundle) {
14660
14853
  _chunkS3JO3N4Hcjs.__name.call(void 0, generateClientManifest, "generateClientManifest");
14661
14854
  async function defineConfig(config = {}) {
14662
14855
  const tailwindVitePlugin = await loadTailwindVitePlugin();
14663
- const appRoot = path20.resolve(config.root || process.cwd());
14664
- if (_optionalChain([config, 'access', _751 => _751.extends, 'optionalAccess', _752 => _752.length])) {
14856
+ const appRoot = path21.resolve(config.root || process.cwd());
14857
+ if (_optionalChain([config, 'access', _770 => _770.extends, 'optionalAccess', _771 => _771.length])) {
14665
14858
  const { config: layeredConfig } = await import("./layers-4PNE2HOY.cjs").then(
14666
14859
  ({ resolveFarmLayers }) => resolveFarmLayers(config, {
14667
14860
  root: appRoot,
@@ -14762,13 +14955,13 @@ async function defineConfig(config = {}) {
14762
14955
  if (!serverStarted) {
14763
14956
  serverStarted = true;
14764
14957
  const elapsed = Date.now() - startTime;
14765
- const address = _optionalChain([server, 'access', _753 => _753.httpServer, 'optionalAccess', _754 => _754.address, 'call', _755 => _755()]);
14958
+ const address = _optionalChain([server, 'access', _772 => _772.httpServer, 'optionalAccess', _773 => _773.address, 'call', _774 => _774()]);
14766
14959
  const resolvedPort = typeof address === "object" && address ? address.port : server.config.server.port || port || 3e3;
14767
14960
  const hostConfig = server.config.server.host;
14768
14961
  const isExposed = hostConfig === true || hostConfig === "0.0.0.0";
14769
14962
  console.log("");
14770
14963
  console.log(
14771
- ` ${pc.bold(pc.green("Farm.js"))} ${pc.dim(`v${_chunkODBZYBABcjs.FARM_VERSION}`)} ${pc.dim(`ready in ${elapsed}ms`)}`
14964
+ ` ${pc.bold(pc.green("Farm.js"))} ${pc.dim(`v${_chunkYC6V7PWEcjs.FARM_VERSION}`)} ${pc.dim(`ready in ${elapsed}ms`)}`
14772
14965
  );
14773
14966
  console.log("");
14774
14967
  console.log(
@@ -14925,4 +15118,5 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, defineConfig, "defineConfig");
14925
15118
 
14926
15119
 
14927
15120
 
14928
- exports.getFarmClientHydrationPlanOptions = getFarmClientHydrationPlanOptions; exports.describeSuppressedAsyncHydration = describeSuppressedAsyncHydration; exports.resolveFarmIsolatedClientHydrationMode = resolveFarmIsolatedClientHydrationMode; exports.getClientModuleMetadata = getClientModuleMetadata; exports.getClientModuleHydrationPlan = getClientModuleHydrationPlan; exports.createMarkdownPageHydrationPlanner = createMarkdownPageHydrationPlanner; exports.enforceFarmIsolatedHydrationRouteBudget = enforceFarmIsolatedHydrationRouteBudget; exports.RouteManager = RouteManager; exports.HOISTED_HEAD_ELEMENT = HOISTED_HEAD_ELEMENT; exports.resolveFarmNotFoundComponentPath = resolveFarmNotFoundComponentPath; exports.farmFontImportsPlugin = farmFontImportsPlugin; exports.mergeFarmFontCss = mergeFarmFontCss; exports.DEFAULT_NOT_FOUND_STYLES = DEFAULT_NOT_FOUND_STYLES; exports.generateFarmIntegrationProviderClientCode = generateFarmIntegrationProviderClientCode; exports.generateFarmIntegrationProviderServerModules = generateFarmIntegrationProviderServerModules; exports.ServerRenderer = ServerRenderer; exports.FarmApp = FarmApp; exports.createFarmApp = createFarmApp; exports.FarmPluginOptionsError = FarmPluginOptionsError; exports.farmPluginMayAffectRuntimePath = farmPluginMayAffectRuntimePath; exports.loadTailwindVitePlugin = loadTailwindVitePlugin; exports.SHARP_INSTALL_HINT = SHARP_INSTALL_HINT; exports.resolveFarmImageProviderForRuntime = resolveFarmImageProviderForRuntime; exports.generateFarmClientPluginEntryCode = generateFarmClientPluginEntryCode; exports.resolveFarmClientCacheAdapterEntry = resolveFarmClientCacheAdapterEntry; exports.generateClientCachePersistenceCode = generateClientCachePersistenceCode; exports.resolveFarmAppPackages = resolveFarmAppPackages; exports.collectFarmWebMCPTools = collectFarmWebMCPTools; exports.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE = FARM_LAYOUT_ELEMENT_CLIENT_SOURCE; exports.createFarmClientOptimizeDepsEntries = createFarmClientOptimizeDepsEntries; exports.createFarmClientOptimizeDepsConfig = createFarmClientOptimizeDepsConfig; exports.createFarmSourceAlias = createFarmSourceAlias; exports.mergeFarmViteConfig = mergeFarmViteConfig; exports.mergeFarmProductionViteConfig = mergeFarmProductionViteConfig; exports.createFarmThemeCssPlugin = createFarmThemeCssPlugin; exports.farmI18nClientBridgePlugin = farmI18nClientBridgePlugin; exports.farmServerOnlyEntriesPlugin = farmServerOnlyEntriesPlugin; exports.withFarmRequestTracing = withFarmRequestTracing; exports.rewriteEarlySsrRelativeImports = rewriteEarlySsrRelativeImports; exports.transformIsolatedClientBoundaryModule = transformIsolatedClientBoundaryModule; exports.shouldEmitFarmClientRootHmr = shouldEmitFarmClientRootHmr; exports.farmPlugin = farmPlugin; exports.defineConfig = defineConfig; exports.FARM_NODE_RESPONSE_END_PENDING = FARM_NODE_RESPONSE_END_PENDING; exports.FarmRuntimeShutdownError = FarmRuntimeShutdownError; exports.PluginManager = PluginManager; exports.definePlugin = definePlugin;
15121
+
15122
+ exports.getFarmClientHydrationPlanOptions = getFarmClientHydrationPlanOptions; exports.describeSuppressedAsyncHydration = describeSuppressedAsyncHydration; exports.resolveFarmIsolatedClientHydrationMode = resolveFarmIsolatedClientHydrationMode; exports.getClientModuleMetadata = getClientModuleMetadata; exports.getClientModuleHydrationPlan = getClientModuleHydrationPlan; exports.usesFarmServerTree = usesFarmServerTree; exports.createMarkdownPageHydrationPlanner = createMarkdownPageHydrationPlanner; exports.enforceFarmIsolatedHydrationRouteBudget = enforceFarmIsolatedHydrationRouteBudget; exports.RouteManager = RouteManager; exports.resolveFarmNotFoundComponentPath = resolveFarmNotFoundComponentPath; exports.farmFontImportsPlugin = farmFontImportsPlugin; exports.mergeFarmFontCss = mergeFarmFontCss; exports.DEFAULT_NOT_FOUND_STYLES = DEFAULT_NOT_FOUND_STYLES; exports.generateFarmIntegrationProviderClientCode = generateFarmIntegrationProviderClientCode; exports.generateFarmIntegrationProviderServerModules = generateFarmIntegrationProviderServerModules; exports.ServerRenderer = ServerRenderer; exports.FarmApp = FarmApp; exports.createFarmApp = createFarmApp; exports.FarmPluginOptionsError = FarmPluginOptionsError; exports.farmPluginMayAffectRuntimePath = farmPluginMayAffectRuntimePath; exports.loadTailwindVitePlugin = loadTailwindVitePlugin; exports.SHARP_INSTALL_HINT = SHARP_INSTALL_HINT; exports.resolveFarmImageProviderForRuntime = resolveFarmImageProviderForRuntime; exports.generateFarmClientPluginEntryCode = generateFarmClientPluginEntryCode; exports.resolveFarmClientCacheAdapterEntry = resolveFarmClientCacheAdapterEntry; exports.generateClientCachePersistenceCode = generateClientCachePersistenceCode; exports.resolveFarmAppPackages = resolveFarmAppPackages; exports.collectFarmWebMCPTools = collectFarmWebMCPTools; exports.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE = FARM_LAYOUT_ELEMENT_CLIENT_SOURCE; exports.createFarmClientOptimizeDepsEntries = createFarmClientOptimizeDepsEntries; exports.createFarmClientOptimizeDepsConfig = createFarmClientOptimizeDepsConfig; exports.createFarmSourceAlias = createFarmSourceAlias; exports.mergeFarmViteConfig = mergeFarmViteConfig; exports.mergeFarmProductionViteConfig = mergeFarmProductionViteConfig; exports.farmDocsClientConfigPlugin = farmDocsClientConfigPlugin; exports.createFarmThemeCssPlugin = createFarmThemeCssPlugin; exports.farmI18nClientBridgePlugin = farmI18nClientBridgePlugin; exports.farmServerOnlyEntriesPlugin = farmServerOnlyEntriesPlugin; exports.withFarmRequestTracing = withFarmRequestTracing; exports.rewriteEarlySsrRelativeImports = rewriteEarlySsrRelativeImports; exports.transformIsolatedClientBoundaryModule = transformIsolatedClientBoundaryModule; exports.shouldEmitFarmClientRootHmr = shouldEmitFarmClientRootHmr; exports.farmPlugin = farmPlugin; exports.defineConfig = defineConfig; exports.FARM_NODE_RESPONSE_END_PENDING = FARM_NODE_RESPONSE_END_PENDING; exports.FarmRuntimeShutdownError = FarmRuntimeShutdownError; exports.PluginManager = PluginManager; exports.definePlugin = definePlugin;