@farm.js/core 0.1.0-beta.6 → 0.1.0-beta.8

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 (447) hide show
  1. package/dist/after.cjs +227 -0
  2. package/dist/after.cjs.map +1 -0
  3. package/dist/after.d.mts +25 -0
  4. package/dist/after.d.ts +25 -0
  5. package/dist/after.mjs +14 -0
  6. package/dist/after.mjs.map +1 -0
  7. package/dist/agent-runtime.cjs +2379 -0
  8. package/dist/agent-runtime.cjs.map +1 -0
  9. package/dist/agent-runtime.d.mts +94 -0
  10. package/dist/agent-runtime.d.ts +94 -0
  11. package/dist/agent-runtime.mjs +479 -0
  12. package/dist/agent-runtime.mjs.map +1 -0
  13. package/dist/api/route-manager.d.mts +66 -0
  14. package/dist/api/route-manager.d.ts +66 -0
  15. package/dist/api/runtime.d.mts +3 -0
  16. package/dist/api/runtime.d.ts +3 -0
  17. package/dist/api.cjs +4100 -0
  18. package/dist/api.cjs.map +1 -0
  19. package/dist/api.d.mts +48 -0
  20. package/dist/api.d.ts +48 -0
  21. package/dist/api.mjs +93 -0
  22. package/dist/api.mjs.map +1 -0
  23. package/dist/app-BWtqQu3R.d.mts +302 -0
  24. package/dist/app-markdown.cjs +244 -0
  25. package/dist/app-markdown.cjs.map +1 -0
  26. package/dist/app-markdown.d.mts +22 -0
  27. package/dist/app-markdown.d.ts +22 -0
  28. package/dist/app-markdown.mjs +27 -0
  29. package/dist/app-markdown.mjs.map +1 -0
  30. package/dist/app-xltejvLY.d.ts +302 -0
  31. package/dist/cache.cjs +945 -0
  32. package/dist/cache.cjs.map +1 -0
  33. package/dist/cache.d.mts +192 -0
  34. package/dist/cache.d.ts +192 -0
  35. package/dist/cache.mjs +46 -0
  36. package/dist/cache.mjs.map +1 -0
  37. package/dist/chunk-2ED5Q2GH.mjs +422 -0
  38. package/dist/chunk-2ED5Q2GH.mjs.map +1 -0
  39. package/dist/chunk-32W4QEJP.mjs +158 -0
  40. package/dist/chunk-32W4QEJP.mjs.map +1 -0
  41. package/dist/chunk-3XNTL3FQ.mjs +452 -0
  42. package/dist/chunk-3XNTL3FQ.mjs.map +1 -0
  43. package/dist/chunk-44ZCFSKE.mjs +84 -0
  44. package/dist/chunk-44ZCFSKE.mjs.map +1 -0
  45. package/dist/chunk-4MGVSBRP.mjs +7787 -0
  46. package/dist/chunk-4MGVSBRP.mjs.map +1 -0
  47. package/dist/chunk-4S3ORGFA.mjs +44 -0
  48. package/dist/chunk-4S3ORGFA.mjs.map +1 -0
  49. package/dist/chunk-5BY76U2M.mjs +1 -0
  50. package/dist/chunk-5BY76U2M.mjs.map +1 -0
  51. package/dist/chunk-5ZGPRGWV.mjs +136 -0
  52. package/dist/chunk-5ZGPRGWV.mjs.map +1 -0
  53. package/dist/chunk-65A7QIKI.mjs +142 -0
  54. package/dist/chunk-65A7QIKI.mjs.map +1 -0
  55. package/dist/chunk-74YTBPTY.mjs +450 -0
  56. package/dist/chunk-74YTBPTY.mjs.map +1 -0
  57. package/dist/chunk-7FBJLMQH.mjs +338 -0
  58. package/dist/chunk-7FBJLMQH.mjs.map +1 -0
  59. package/dist/chunk-7HO6AEOP.mjs +74 -0
  60. package/dist/chunk-7HO6AEOP.mjs.map +1 -0
  61. package/dist/chunk-7MABZJIM.mjs +29 -0
  62. package/dist/chunk-7MABZJIM.mjs.map +1 -0
  63. package/dist/chunk-7N62DNSO.mjs +41 -0
  64. package/dist/chunk-7N62DNSO.mjs.map +1 -0
  65. package/dist/chunk-7ZY5AIJO.mjs +161 -0
  66. package/dist/chunk-7ZY5AIJO.mjs.map +1 -0
  67. package/dist/chunk-ALCLXXTY.mjs +187 -0
  68. package/dist/chunk-ALCLXXTY.mjs.map +1 -0
  69. package/dist/chunk-AZ7YUVNR.mjs +65 -0
  70. package/dist/chunk-AZ7YUVNR.mjs.map +1 -0
  71. package/dist/chunk-B232I2GP.mjs +163 -0
  72. package/dist/chunk-B232I2GP.mjs.map +1 -0
  73. package/dist/chunk-B4W3BNTL.mjs +483 -0
  74. package/dist/chunk-B4W3BNTL.mjs.map +1 -0
  75. package/dist/chunk-C2ROET2V.mjs +718 -0
  76. package/dist/chunk-C2ROET2V.mjs.map +1 -0
  77. package/dist/chunk-CGILA3WO.mjs +14 -0
  78. package/dist/chunk-CGILA3WO.mjs.map +1 -0
  79. package/dist/chunk-CGIXMLSY.mjs +184 -0
  80. package/dist/chunk-CGIXMLSY.mjs.map +1 -0
  81. package/dist/chunk-DJSGLHCN.mjs +597 -0
  82. package/dist/chunk-DJSGLHCN.mjs.map +1 -0
  83. package/dist/chunk-E2MPIBRE.mjs +149 -0
  84. package/dist/chunk-E2MPIBRE.mjs.map +1 -0
  85. package/dist/chunk-E6EPN5BT.mjs +203 -0
  86. package/dist/chunk-E6EPN5BT.mjs.map +1 -0
  87. package/dist/chunk-EI43C4RA.mjs +6277 -0
  88. package/dist/chunk-EI43C4RA.mjs.map +1 -0
  89. package/dist/chunk-EJ7T4TPB.mjs +622 -0
  90. package/dist/chunk-EJ7T4TPB.mjs.map +1 -0
  91. package/dist/chunk-FQYDHKKU.mjs +128 -0
  92. package/dist/chunk-FQYDHKKU.mjs.map +1 -0
  93. package/dist/chunk-FRPWCMMG.mjs +299 -0
  94. package/dist/chunk-FRPWCMMG.mjs.map +1 -0
  95. package/dist/chunk-GN72QAIH.mjs +146 -0
  96. package/dist/chunk-GN72QAIH.mjs.map +1 -0
  97. package/dist/chunk-GQVGIUSN.mjs +149 -0
  98. package/dist/chunk-GQVGIUSN.mjs.map +1 -0
  99. package/dist/chunk-GS6K5OCM.mjs +407 -0
  100. package/dist/chunk-GS6K5OCM.mjs.map +1 -0
  101. package/dist/chunk-GXASWWJU.mjs +364 -0
  102. package/dist/chunk-GXASWWJU.mjs.map +1 -0
  103. package/dist/chunk-GY2STC2S.mjs +180 -0
  104. package/dist/chunk-GY2STC2S.mjs.map +1 -0
  105. package/dist/chunk-H2FA2SBS.mjs +51 -0
  106. package/dist/chunk-H2FA2SBS.mjs.map +1 -0
  107. package/dist/chunk-I4CUBGVF.mjs +93 -0
  108. package/dist/chunk-I4CUBGVF.mjs.map +1 -0
  109. package/dist/chunk-ITN462YM.mjs +98 -0
  110. package/dist/chunk-ITN462YM.mjs.map +1 -0
  111. package/dist/chunk-J23HNLFY.mjs +72 -0
  112. package/dist/chunk-J23HNLFY.mjs.map +1 -0
  113. package/dist/chunk-J4FNJ5IU.mjs +179 -0
  114. package/dist/chunk-J4FNJ5IU.mjs.map +1 -0
  115. package/dist/chunk-J5YWQVI5.mjs +211 -0
  116. package/dist/chunk-J5YWQVI5.mjs.map +1 -0
  117. package/dist/chunk-JDEOUK5V.mjs +427 -0
  118. package/dist/chunk-JDEOUK5V.mjs.map +1 -0
  119. package/dist/chunk-JK25YEN6.mjs +219 -0
  120. package/dist/chunk-JK25YEN6.mjs.map +1 -0
  121. package/dist/chunk-K4667E2Q.mjs +1916 -0
  122. package/dist/chunk-K4667E2Q.mjs.map +1 -0
  123. package/dist/chunk-LGHEOHBU.mjs +218 -0
  124. package/dist/chunk-LGHEOHBU.mjs.map +1 -0
  125. package/dist/chunk-LM2YNO4U.mjs +24 -0
  126. package/dist/chunk-LM2YNO4U.mjs.map +1 -0
  127. package/dist/chunk-ME4MO2RJ.mjs +3540 -0
  128. package/dist/chunk-ME4MO2RJ.mjs.map +1 -0
  129. package/dist/chunk-MIUW47JX.mjs +639 -0
  130. package/dist/chunk-MIUW47JX.mjs.map +1 -0
  131. package/dist/chunk-NNLCAVB6.mjs +391 -0
  132. package/dist/chunk-NNLCAVB6.mjs.map +1 -0
  133. package/dist/chunk-P7QDS5AT.mjs +191 -0
  134. package/dist/chunk-P7QDS5AT.mjs.map +1 -0
  135. package/dist/chunk-PFE6GMNE.mjs +603 -0
  136. package/dist/chunk-PFE6GMNE.mjs.map +1 -0
  137. package/dist/chunk-QGOHVJ6J.mjs +63 -0
  138. package/dist/chunk-QGOHVJ6J.mjs.map +1 -0
  139. package/dist/chunk-QKVUNGAH.mjs +39 -0
  140. package/dist/chunk-QKVUNGAH.mjs.map +1 -0
  141. package/dist/chunk-QM746KUO.mjs +56 -0
  142. package/dist/chunk-QM746KUO.mjs.map +1 -0
  143. package/dist/chunk-QTZZ2ISQ.mjs +753 -0
  144. package/dist/chunk-QTZZ2ISQ.mjs.map +1 -0
  145. package/dist/chunk-RBRLLZL5.mjs +81 -0
  146. package/dist/chunk-RBRLLZL5.mjs.map +1 -0
  147. package/dist/chunk-RHIFZZUI.mjs +69 -0
  148. package/dist/chunk-RHIFZZUI.mjs.map +1 -0
  149. package/dist/chunk-RQ633A5I.mjs +187 -0
  150. package/dist/chunk-RQ633A5I.mjs.map +1 -0
  151. package/dist/chunk-SCFX4UTD.mjs +28 -0
  152. package/dist/chunk-SCFX4UTD.mjs.map +1 -0
  153. package/dist/chunk-SL6HTIOK.mjs +66 -0
  154. package/dist/chunk-SL6HTIOK.mjs.map +1 -0
  155. package/dist/chunk-SPBBQLXI.mjs +207 -0
  156. package/dist/chunk-SPBBQLXI.mjs.map +1 -0
  157. package/dist/chunk-SSA7THPX.mjs +10 -0
  158. package/dist/chunk-SSA7THPX.mjs.map +1 -0
  159. package/dist/chunk-T4QJQK76.mjs +459 -0
  160. package/dist/chunk-T4QJQK76.mjs.map +1 -0
  161. package/dist/chunk-TQAEEJB4.mjs +157 -0
  162. package/dist/chunk-TQAEEJB4.mjs.map +1 -0
  163. package/dist/chunk-UB5UOSHB.mjs +458 -0
  164. package/dist/chunk-UB5UOSHB.mjs.map +1 -0
  165. package/dist/chunk-USWZZUEH.mjs +25 -0
  166. package/dist/chunk-USWZZUEH.mjs.map +1 -0
  167. package/dist/chunk-UVCIEUJC.mjs +16 -0
  168. package/dist/chunk-UVCIEUJC.mjs.map +1 -0
  169. package/dist/chunk-UXUAWNO5.mjs +396 -0
  170. package/dist/chunk-UXUAWNO5.mjs.map +1 -0
  171. package/dist/chunk-V3XURYJO.mjs +756 -0
  172. package/dist/chunk-V3XURYJO.mjs.map +1 -0
  173. package/dist/chunk-V6WE6JSZ.mjs +352 -0
  174. package/dist/chunk-V6WE6JSZ.mjs.map +1 -0
  175. package/dist/chunk-V7RBCSDJ.mjs +170 -0
  176. package/dist/chunk-V7RBCSDJ.mjs.map +1 -0
  177. package/dist/chunk-VCANOYFI.mjs +588 -0
  178. package/dist/chunk-VCANOYFI.mjs.map +1 -0
  179. package/dist/chunk-VY2UYN5R.mjs +224 -0
  180. package/dist/chunk-VY2UYN5R.mjs.map +1 -0
  181. package/dist/chunk-W2CRQFF6.mjs +1352 -0
  182. package/dist/chunk-W2CRQFF6.mjs.map +1 -0
  183. package/dist/chunk-WDU6QXNK.mjs +872 -0
  184. package/dist/chunk-WDU6QXNK.mjs.map +1 -0
  185. package/dist/chunk-WZ5QFROO.mjs +23 -0
  186. package/dist/chunk-WZ5QFROO.mjs.map +1 -0
  187. package/dist/chunk-XIVV5IWN.mjs +541 -0
  188. package/dist/chunk-XIVV5IWN.mjs.map +1 -0
  189. package/dist/chunk-YW7OBE6Q.mjs +119 -0
  190. package/dist/chunk-YW7OBE6Q.mjs.map +1 -0
  191. package/dist/chunk-Z5CQMP54.mjs +365 -0
  192. package/dist/chunk-Z5CQMP54.mjs.map +1 -0
  193. package/dist/chunk-ZBE6MLHL.mjs +230 -0
  194. package/dist/chunk-ZBE6MLHL.mjs.map +1 -0
  195. package/dist/chunk-ZVWA4ZQ3.mjs +189 -0
  196. package/dist/chunk-ZVWA4ZQ3.mjs.map +1 -0
  197. package/dist/chunk-ZZ57EH5Z.mjs +173 -0
  198. package/dist/chunk-ZZ57EH5Z.mjs.map +1 -0
  199. package/dist/client-BT1mFQas.d.mts +447 -0
  200. package/dist/client-Nn0q4eO4.d.ts +447 -0
  201. package/dist/client-cache-CIlyBlmx.d.ts +6 -0
  202. package/dist/client-cache-D-EZ7XVW.d.mts +6 -0
  203. package/dist/client-plugins-BI2R6Eae.d.mts +1926 -0
  204. package/dist/client-plugins-DU9oMspX.d.ts +1926 -0
  205. package/dist/client-plugins.cjs +415 -0
  206. package/dist/client-plugins.cjs.map +1 -0
  207. package/dist/client-plugins.d.mts +22 -0
  208. package/dist/client-plugins.d.ts +22 -0
  209. package/dist/client-plugins.mjs +10 -0
  210. package/dist/client-plugins.mjs.map +1 -0
  211. package/dist/client.cjs +5402 -0
  212. package/dist/client.cjs.map +1 -0
  213. package/dist/client.d.mts +447 -0
  214. package/dist/client.d.ts +447 -0
  215. package/dist/client.mjs +110 -0
  216. package/dist/client.mjs.map +1 -0
  217. package/dist/config.cjs +38 -0
  218. package/dist/config.cjs.map +1 -0
  219. package/dist/config.d.mts +29 -0
  220. package/dist/config.d.ts +29 -0
  221. package/dist/config.mjs +10 -0
  222. package/dist/config.mjs.map +1 -0
  223. package/dist/cron.cjs +406 -0
  224. package/dist/cron.cjs.map +1 -0
  225. package/dist/cron.d.mts +78 -0
  226. package/dist/cron.d.ts +78 -0
  227. package/dist/cron.mjs +30 -0
  228. package/dist/cron.mjs.map +1 -0
  229. package/dist/deferred.cjs +438 -0
  230. package/dist/deferred.cjs.map +1 -0
  231. package/dist/deferred.d.mts +42 -0
  232. package/dist/deferred.d.ts +42 -0
  233. package/dist/deferred.mjs +28 -0
  234. package/dist/deferred.mjs.map +1 -0
  235. package/dist/deployment.cjs +199 -0
  236. package/dist/deployment.cjs.map +1 -0
  237. package/dist/deployment.d.mts +34 -0
  238. package/dist/deployment.d.ts +34 -0
  239. package/dist/deployment.mjs +38 -0
  240. package/dist/deployment.mjs.map +1 -0
  241. package/dist/devtools-REQTS3I7.mjs +371 -0
  242. package/dist/devtools-REQTS3I7.mjs.map +1 -0
  243. package/dist/devtools-client-3XRTBND5.mjs +216 -0
  244. package/dist/devtools-client-3XRTBND5.mjs.map +1 -0
  245. package/dist/devtools-ui-NJKFORTG.mjs +1349 -0
  246. package/dist/devtools-ui-NJKFORTG.mjs.map +1 -0
  247. package/dist/docs.cjs +5548 -0
  248. package/dist/docs.cjs.map +1 -0
  249. package/dist/docs.d.mts +69 -0
  250. package/dist/docs.d.ts +69 -0
  251. package/dist/docs.mjs +47 -0
  252. package/dist/docs.mjs.map +1 -0
  253. package/dist/env-types.cjs +232 -0
  254. package/dist/env-types.cjs.map +1 -0
  255. package/dist/env-types.d.mts +12 -0
  256. package/dist/env-types.d.ts +12 -0
  257. package/dist/env-types.mjs +11 -0
  258. package/dist/env-types.mjs.map +1 -0
  259. package/dist/env.cjs +215 -0
  260. package/dist/env.cjs.map +1 -0
  261. package/dist/env.d.mts +45 -0
  262. package/dist/env.d.ts +45 -0
  263. package/dist/env.mjs +22 -0
  264. package/dist/env.mjs.map +1 -0
  265. package/dist/environment/vite.d.mts +22 -0
  266. package/dist/environment/vite.d.ts +22 -0
  267. package/dist/environment.cjs +96 -0
  268. package/dist/environment.cjs.map +1 -0
  269. package/dist/environment.d.mts +18 -0
  270. package/dist/environment.d.ts +18 -0
  271. package/dist/environment.mjs +14 -0
  272. package/dist/environment.mjs.map +1 -0
  273. package/dist/headers.cjs +126 -0
  274. package/dist/headers.cjs.map +1 -0
  275. package/dist/headers.d.mts +22 -0
  276. package/dist/headers.d.ts +22 -0
  277. package/dist/headers.mjs +12 -0
  278. package/dist/headers.mjs.map +1 -0
  279. package/dist/i18n/client.d.mts +32 -0
  280. package/dist/i18n/client.d.ts +32 -0
  281. package/dist/i18n/index.d.mts +20 -0
  282. package/dist/i18n/index.d.ts +20 -0
  283. package/dist/i18n/server.d.mts +30 -0
  284. package/dist/i18n/server.d.ts +30 -0
  285. package/dist/image/server.d.mts +37 -0
  286. package/dist/image/server.d.ts +37 -0
  287. package/dist/image/sharp.d.mts +7 -0
  288. package/dist/image/sharp.d.ts +7 -0
  289. package/dist/image-config-Duob7wER.d.mts +50 -0
  290. package/dist/image-config-Duob7wER.d.ts +50 -0
  291. package/dist/image.cjs +209 -0
  292. package/dist/image.cjs.map +1 -0
  293. package/dist/image.d.mts +39 -0
  294. package/dist/image.d.ts +39 -0
  295. package/dist/image.mjs +165 -0
  296. package/dist/image.mjs.map +1 -0
  297. package/dist/index.cjs +42186 -0
  298. package/dist/index.cjs.map +1 -0
  299. package/dist/index.d.mts +454 -0
  300. package/dist/index.d.ts +454 -0
  301. package/dist/index.mjs +980 -0
  302. package/dist/index.mjs.map +1 -0
  303. package/dist/integration-api-CHT2OKAf.d.mts +93 -0
  304. package/dist/integration-api-CHT2OKAf.d.ts +93 -0
  305. package/dist/integration-orm-GQLGU66X.mjs +13 -0
  306. package/dist/integration-orm-GQLGU66X.mjs.map +1 -0
  307. package/dist/integrations.cjs +2820 -0
  308. package/dist/integrations.cjs.map +1 -0
  309. package/dist/integrations.d.mts +22 -0
  310. package/dist/integrations.d.ts +22 -0
  311. package/dist/integrations.mjs +51 -0
  312. package/dist/integrations.mjs.map +1 -0
  313. package/dist/internal/build-runtime.cjs +643 -322
  314. package/dist/internal/build-runtime.cjs.map +1 -1
  315. package/dist/internal/build-runtime.d.mts +39 -0
  316. package/dist/internal/build-runtime.d.ts +39 -0
  317. package/dist/internal/build-runtime.mjs +11 -10
  318. package/dist/internal/client-runtime.d.mts +2 -0
  319. package/dist/internal/client-runtime.d.ts +2 -0
  320. package/dist/internal/config-runtime.cjs +135 -39
  321. package/dist/internal/config-runtime.cjs.map +1 -1
  322. package/dist/internal/config-runtime.d.mts +39 -0
  323. package/dist/internal/config-runtime.d.ts +39 -0
  324. package/dist/internal/config-runtime.mjs +5 -4
  325. package/dist/internal/production-node-env.d.mts +12 -0
  326. package/dist/internal/production-node-env.d.ts +12 -0
  327. package/dist/internal/production-runtime.d.mts +39 -0
  328. package/dist/internal/production-runtime.d.ts +39 -0
  329. package/dist/layers-VWVDTPUZ.mjs +16 -0
  330. package/dist/layers-VWVDTPUZ.mjs.map +1 -0
  331. package/dist/manager-THKFTOFE.mjs +10 -0
  332. package/dist/manager-THKFTOFE.mjs.map +1 -0
  333. package/dist/markdown.cjs +364 -0
  334. package/dist/markdown.cjs.map +1 -0
  335. package/dist/markdown.d.mts +60 -0
  336. package/dist/markdown.d.ts +60 -0
  337. package/dist/markdown.mjs +18 -0
  338. package/dist/markdown.mjs.map +1 -0
  339. package/dist/metadata-Cm9ujH4I.d.ts +22 -0
  340. package/dist/metadata-DacXbnLA.d.mts +22 -0
  341. package/dist/middleware.cjs +2148 -0
  342. package/dist/middleware.cjs.map +1 -0
  343. package/dist/middleware.d.mts +164 -0
  344. package/dist/middleware.d.ts +164 -0
  345. package/dist/middleware.mjs +49 -0
  346. package/dist/middleware.mjs.map +1 -0
  347. package/dist/navigation-errors-Dvwpzaer.d.mts +13 -0
  348. package/dist/navigation-errors-Dvwpzaer.d.ts +13 -0
  349. package/dist/navigation.cjs +1329 -0
  350. package/dist/navigation.cjs.map +1 -0
  351. package/dist/navigation.d.mts +14 -0
  352. package/dist/navigation.d.ts +14 -0
  353. package/dist/navigation.mjs +33 -0
  354. package/dist/navigation.mjs.map +1 -0
  355. package/dist/nitro-QO5LV6QK.mjs +689 -0
  356. package/dist/nitro-QO5LV6QK.mjs.map +1 -0
  357. package/dist/observability.cjs +186 -0
  358. package/dist/observability.cjs.map +1 -0
  359. package/dist/observability.d.mts +335 -0
  360. package/dist/observability.d.ts +335 -0
  361. package/dist/observability.mjs +16 -0
  362. package/dist/observability.mjs.map +1 -0
  363. package/dist/params-BALtrRim.d.ts +15 -0
  364. package/dist/params-ry-lxqmy.d.mts +15 -0
  365. package/dist/plugin-BJDf43dc.d.mts +165 -0
  366. package/dist/plugin-BJDf43dc.d.ts +165 -0
  367. package/dist/plugin.cjs +23470 -0
  368. package/dist/plugin.cjs.map +1 -1
  369. package/dist/plugin.d.mts +22 -0
  370. package/dist/plugin.d.ts +22 -0
  371. package/dist/plugin.mjs +8 -7
  372. package/dist/production-runtime-4KKq1AVC.d.mts +79 -0
  373. package/dist/production-runtime-C_B79w2P.d.mts +28 -0
  374. package/dist/production-runtime-DDEM1D2q.d.ts +28 -0
  375. package/dist/production-runtime-DRsWDN2x.d.ts +79 -0
  376. package/dist/query/client.d.mts +61 -0
  377. package/dist/query/client.d.ts +61 -0
  378. package/dist/query/index.d.mts +90 -0
  379. package/dist/query/index.d.ts +90 -0
  380. package/dist/query/parsers.d.mts +25 -0
  381. package/dist/query/parsers.d.ts +25 -0
  382. package/dist/query/server.d.mts +55 -0
  383. package/dist/query/server.d.ts +55 -0
  384. package/dist/request-Dsq4kGW0.d.mts +6 -0
  385. package/dist/request-udtobOLv.d.ts +6 -0
  386. package/dist/request.d.mts +2 -0
  387. package/dist/request.d.ts +2 -0
  388. package/dist/resolver-DJqjLMg_.d.mts +14 -0
  389. package/dist/resolver-IH4RmPEl.d.ts +14 -0
  390. package/dist/route-runtime-DoOHzCAD.d.mts +38 -0
  391. package/dist/route-runtime-DoOHzCAD.d.ts +38 -0
  392. package/dist/router.d.mts +36 -0
  393. package/dist/router.d.ts +36 -0
  394. package/dist/routes.d.mts +224 -0
  395. package/dist/routes.d.ts +224 -0
  396. package/dist/runtime-9nQjVM7X.d.mts +206 -0
  397. package/dist/runtime-Cxpq6xZN.d.mts +27 -0
  398. package/dist/runtime-DgeS2skB.d.ts +206 -0
  399. package/dist/runtime-bv63eUiO.d.ts +27 -0
  400. package/dist/server-action-security.d.mts +43 -0
  401. package/dist/server-action-security.d.ts +43 -0
  402. package/dist/server-fn-client.d.mts +32 -0
  403. package/dist/server-fn-client.d.ts +32 -0
  404. package/dist/server-fn.d.mts +93 -0
  405. package/dist/server-fn.d.ts +93 -0
  406. package/dist/server-plugins.d.mts +55 -0
  407. package/dist/server-plugins.d.ts +55 -0
  408. package/dist/server-query-client.d.mts +50 -0
  409. package/dist/server-query-client.d.ts +50 -0
  410. package/dist/server-query.d.mts +36 -0
  411. package/dist/server-query.d.ts +36 -0
  412. package/dist/server.cjs +731 -447
  413. package/dist/server.cjs.map +1 -1
  414. package/dist/server.d.mts +48 -0
  415. package/dist/server.d.ts +48 -0
  416. package/dist/server.mjs +9 -8
  417. package/dist/server.mjs.map +1 -1
  418. package/dist/storage.d.mts +52 -0
  419. package/dist/storage.d.ts +52 -0
  420. package/dist/testing.d.mts +101 -0
  421. package/dist/testing.d.ts +101 -0
  422. package/dist/transport-BmbGTXA5.d.mts +49 -0
  423. package/dist/transport-BmbGTXA5.d.ts +49 -0
  424. package/dist/types-BMxWr97v.d.mts +81 -0
  425. package/dist/types-BMxWr97v.d.ts +81 -0
  426. package/dist/types-C9N-nk5R.d.mts +53 -0
  427. package/dist/types-C9N-nk5R.d.ts +53 -0
  428. package/dist/types-D1A6-XvH.d.mts +73 -0
  429. package/dist/types-D1A6-XvH.d.ts +73 -0
  430. package/dist/utils-B-cUHwoK.d.ts +23 -0
  431. package/dist/utils-Cm41AefV.d.mts +23 -0
  432. package/dist/version.cjs +1 -1
  433. package/dist/version.cjs.map +1 -1
  434. package/dist/version.d.mts +3 -0
  435. package/dist/version.d.ts +3 -0
  436. package/dist/version.mjs +1 -1
  437. package/dist/vite.cjs +682 -437
  438. package/dist/vite.cjs.map +1 -1
  439. package/dist/vite.d.mts +22 -0
  440. package/dist/vite.d.ts +22 -0
  441. package/dist/vite.mjs +6 -5
  442. package/dist/workflows.d.mts +110 -0
  443. package/dist/workflows.d.ts +110 -0
  444. package/package.json +3 -2
  445. package/types/client.d.ts +1 -1
  446. package/types/image.d.ts +4 -0
  447. package/types/images.d.ts +59 -0
@@ -0,0 +1,872 @@
1
+ import {
2
+ getAPIRouteRefMetadata,
3
+ isAPIRouteRef
4
+ } from "./chunk-W2CRQFF6.mjs";
5
+ import {
6
+ isFarmLocaleChangeHref,
7
+ localizeActiveFarmHref
8
+ } from "./chunk-ITN462YM.mjs";
9
+ import {
10
+ buildFarmRoutePath
11
+ } from "./chunk-ZBE6MLHL.mjs";
12
+ import {
13
+ __name
14
+ } from "./chunk-CGILA3WO.mjs";
15
+
16
+ // src/mutation-client.ts
17
+ import { useCallback, useMemo, useRef, useState } from "react";
18
+ function useMutation(target, options = {}) {
19
+ const initialData = options.initialData ?? null;
20
+ const optionsRef = useRef(options);
21
+ const targetRef = useRef(target);
22
+ const requestIdRef = useRef(0);
23
+ const initialState = {
24
+ pendingCount: 0,
25
+ status: "idle",
26
+ data: initialData,
27
+ error: null,
28
+ variables: void 0
29
+ };
30
+ const stateRef = useRef(initialState);
31
+ const [state, setState] = useState(initialState);
32
+ optionsRef.current = options;
33
+ targetRef.current = target;
34
+ const setMutationState = useCallback(
35
+ (value) => {
36
+ setState((current) => {
37
+ const next = typeof value === "function" ? value(current) : value;
38
+ stateRef.current = next;
39
+ return next;
40
+ });
41
+ },
42
+ []
43
+ );
44
+ const mutateAsync = useCallback(
45
+ async (variables) => {
46
+ const requestId = ++requestIdRef.current;
47
+ const currentOptions = optionsRef.current;
48
+ const previousData = stateRef.current.data;
49
+ const optimisticData = currentOptions.optimistic?.({
50
+ variables,
51
+ current: previousData
52
+ });
53
+ const hasOptimisticData = optimisticData !== void 0;
54
+ setMutationState((current) => ({
55
+ pendingCount: current.pendingCount + 1,
56
+ status: "pending",
57
+ data: hasOptimisticData ? optimisticData : currentOptions.resetOnMutate === false ? current.data : null,
58
+ error: null,
59
+ variables
60
+ }));
61
+ try {
62
+ const mutationTarget = targetRef.current;
63
+ const rawResult = isAPIRouteRef(mutationTarget) ? await mutationTarget(variables, currentOptions.request) : await mutationTarget(variables);
64
+ const data = unwrapMutationResult(rawResult, isAPIRouteRef(mutationTarget));
65
+ const isLatestRequest = requestId === requestIdRef.current;
66
+ setMutationState((current) => {
67
+ const pendingCount = Math.max(0, current.pendingCount - 1);
68
+ if (!isLatestRequest) {
69
+ return {
70
+ ...current,
71
+ pendingCount,
72
+ status: pendingCount > 0 ? "pending" : current.status
73
+ };
74
+ }
75
+ return {
76
+ pendingCount,
77
+ status: "success",
78
+ data,
79
+ error: null,
80
+ variables
81
+ };
82
+ });
83
+ if (isLatestRequest) {
84
+ currentOptions.onSuccess?.(data, variables);
85
+ currentOptions.onSettled?.(data, null, variables);
86
+ }
87
+ return data;
88
+ } catch (cause) {
89
+ const error = normalizeMutationError(cause);
90
+ const isLatestRequest = requestId === requestIdRef.current;
91
+ setMutationState((current) => {
92
+ const pendingCount = Math.max(0, current.pendingCount - 1);
93
+ if (!isLatestRequest) {
94
+ return {
95
+ ...current,
96
+ pendingCount,
97
+ status: pendingCount > 0 ? "pending" : current.status
98
+ };
99
+ }
100
+ return {
101
+ pendingCount,
102
+ status: "error",
103
+ data: hasOptimisticData && currentOptions.rollbackOnError ? previousData : currentOptions.resetOnMutate === false ? current.data : null,
104
+ error,
105
+ variables
106
+ };
107
+ });
108
+ if (isLatestRequest) {
109
+ currentOptions.onError?.(error, variables);
110
+ currentOptions.onSettled?.(null, error, variables);
111
+ }
112
+ throw error;
113
+ }
114
+ },
115
+ [setMutationState]
116
+ );
117
+ const mutate = useCallback(
118
+ (variables) => {
119
+ void mutateAsync(variables).catch(() => {
120
+ });
121
+ },
122
+ [mutateAsync]
123
+ );
124
+ const reset = useCallback(() => {
125
+ requestIdRef.current += 1;
126
+ setMutationState({
127
+ pendingCount: 0,
128
+ status: "idle",
129
+ data: optionsRef.current.initialData ?? null,
130
+ error: null,
131
+ variables: void 0
132
+ });
133
+ }, [setMutationState]);
134
+ return useMemo(
135
+ () => ({
136
+ pending: state.pendingCount > 0,
137
+ status: state.status,
138
+ data: state.data,
139
+ error: state.error,
140
+ variables: state.variables,
141
+ mutate,
142
+ mutateAsync,
143
+ reset
144
+ }),
145
+ [
146
+ mutate,
147
+ mutateAsync,
148
+ reset,
149
+ state.data,
150
+ state.error,
151
+ state.pendingCount,
152
+ state.status,
153
+ state.variables
154
+ ]
155
+ );
156
+ }
157
+ __name(useMutation, "useMutation");
158
+ function unwrapMutationResult(result, apiRoute) {
159
+ if (!apiRoute) return result;
160
+ const apiResult = result;
161
+ if (apiResult.error) {
162
+ throw apiResult.error;
163
+ }
164
+ return apiResult.data;
165
+ }
166
+ __name(unwrapMutationResult, "unwrapMutationResult");
167
+ function normalizeMutationError(error) {
168
+ if (error instanceof Error) return error;
169
+ const normalized = new Error(typeof error === "string" ? error : "Mutation failed");
170
+ normalized.cause = error;
171
+ return normalized;
172
+ }
173
+ __name(normalizeMutationError, "normalizeMutationError");
174
+
175
+ // src/fetcher-client.tsx
176
+ import {
177
+ createElement,
178
+ useCallback as useCallback2,
179
+ useMemo as useMemo2,
180
+ useRef as useRef2,
181
+ useState as useState2
182
+ } from "react";
183
+ var formDataContexts = /* @__PURE__ */ new WeakMap();
184
+ function useFetcher(target, options = {}) {
185
+ const targetRef = useRef2(target);
186
+ const optionsRef = useRef2(options);
187
+ const submissionIdRef = useRef2(0);
188
+ const [formData, setFormData] = useState2(null);
189
+ const mutation = useMutation(target, options);
190
+ targetRef.current = target;
191
+ optionsRef.current = options;
192
+ const submitAsync = useCallback2(
193
+ async (input) => {
194
+ const submissionId = ++submissionIdRef.current;
195
+ const submittedFormData = isFormData(input) ? input : null;
196
+ setFormData(submittedFormData);
197
+ try {
198
+ const variables = submittedFormData ? mapFetcherFormData(targetRef.current, submittedFormData, optionsRef.current) : input;
199
+ return await mutation.mutateAsync(variables);
200
+ } finally {
201
+ if (submissionId === submissionIdRef.current) {
202
+ setFormData(null);
203
+ }
204
+ }
205
+ },
206
+ [mutation.mutateAsync]
207
+ );
208
+ const submit = useCallback2(
209
+ (input) => {
210
+ void submitAsync(input).catch(() => {
211
+ });
212
+ },
213
+ [submitAsync]
214
+ );
215
+ const Form = useMemo2(() => {
216
+ const FetcherForm = /* @__PURE__ */ __name(({ action, method, encType, onSubmit, ...props }) => {
217
+ const targetValue = targetRef.current;
218
+ const metadata = getAPIRouteRefMetadata(targetValue);
219
+ const nativeAction = action ?? resolveFetcherFormAction(targetValue, metadata);
220
+ const nativeMethod = method ?? (metadata && (metadata.method === "GET" || metadata.method === "POST") ? metadata.method.toLowerCase() : metadata ? "post" : void 0);
221
+ const functionAction = typeof nativeAction === "function";
222
+ const handleSubmit = /* @__PURE__ */ __name((event) => {
223
+ onSubmit?.(event);
224
+ if (event.defaultPrevented) return;
225
+ event.preventDefault();
226
+ const submitter = getSubmitter(event);
227
+ const nextFormData = createSubmitterFormData(event.currentTarget, submitter);
228
+ formDataContexts.set(nextFormData, {
229
+ form: event.currentTarget,
230
+ submitter
231
+ });
232
+ void submitAsync(nextFormData).catch(() => {
233
+ });
234
+ }, "handleSubmit");
235
+ return createElement("form", {
236
+ ...props,
237
+ action: nativeAction,
238
+ method: functionAction ? void 0 : nativeMethod,
239
+ encType: functionAction ? void 0 : encType,
240
+ onSubmit: handleSubmit
241
+ });
242
+ }, "FetcherForm");
243
+ FetcherForm.displayName = "FetcherForm";
244
+ return FetcherForm;
245
+ }, [submitAsync]);
246
+ const reset = useCallback2(() => {
247
+ submissionIdRef.current += 1;
248
+ setFormData(null);
249
+ mutation.reset();
250
+ }, [mutation.reset]);
251
+ return useMemo2(
252
+ () => ({
253
+ state: mutation.pending ? "submitting" : "idle",
254
+ status: mutation.status,
255
+ pending: mutation.pending,
256
+ data: mutation.data,
257
+ error: mutation.error,
258
+ variables: mutation.variables,
259
+ formData,
260
+ submit,
261
+ submitAsync,
262
+ Form,
263
+ reset
264
+ }),
265
+ [
266
+ Form,
267
+ formData,
268
+ mutation.data,
269
+ mutation.error,
270
+ mutation.pending,
271
+ mutation.status,
272
+ mutation.variables,
273
+ reset,
274
+ submit,
275
+ submitAsync
276
+ ]
277
+ );
278
+ }
279
+ __name(useFetcher, "useFetcher");
280
+ function mapFetcherFormData(target, formData, options) {
281
+ const context = formDataContexts.get(formData) ?? { form: null, submitter: null };
282
+ if (options.mapFormData) {
283
+ return options.mapFormData(formData, context);
284
+ }
285
+ if (!isAPIRouteRef(target)) {
286
+ return formData;
287
+ }
288
+ const values = formDataToObject(formData);
289
+ const method = getAPIRouteRefMetadata(target)?.method;
290
+ return method === "GET" || method === "HEAD" ? { query: values } : { body: values };
291
+ }
292
+ __name(mapFetcherFormData, "mapFetcherFormData");
293
+ function resolveFetcherFormAction(target, metadata) {
294
+ if (!metadata) return isProgressiveFormAction(target) ? target : void 0;
295
+ if (metadata.sameOrigin) return metadata.path;
296
+ return new URL(metadata.path, metadata.baseURL).href;
297
+ }
298
+ __name(resolveFetcherFormAction, "resolveFetcherFormAction");
299
+ function formDataToObject(formData) {
300
+ const output = /* @__PURE__ */ Object.create(null);
301
+ for (const [key, value] of formData.entries()) {
302
+ if (key === "__proto__" || key === "constructor" || key === "prototype") continue;
303
+ const current = output[key];
304
+ if (current === void 0) {
305
+ output[key] = value;
306
+ } else if (Array.isArray(current)) {
307
+ current.push(value);
308
+ } else {
309
+ output[key] = [current, value];
310
+ }
311
+ }
312
+ return output;
313
+ }
314
+ __name(formDataToObject, "formDataToObject");
315
+ function createSubmitterFormData(form, submitter) {
316
+ try {
317
+ return new FormData(form, submitter);
318
+ } catch {
319
+ const formData = new FormData(form);
320
+ const candidate = submitter;
321
+ if (candidate && !candidate.disabled && candidate.name) {
322
+ formData.append(candidate.name, candidate.value ?? "");
323
+ }
324
+ return formData;
325
+ }
326
+ }
327
+ __name(createSubmitterFormData, "createSubmitterFormData");
328
+ function getSubmitter(event) {
329
+ const nativeEvent = event.nativeEvent;
330
+ return nativeEvent.submitter instanceof HTMLElement ? nativeEvent.submitter : null;
331
+ }
332
+ __name(getSubmitter, "getSubmitter");
333
+ function isProgressiveFormAction(target) {
334
+ const candidate = target;
335
+ return candidate.__farmServerFn === true || typeof candidate.$$FORM_ACTION === "function" || candidate.$$typeof === /* @__PURE__ */ Symbol.for("react.server.reference");
336
+ }
337
+ __name(isProgressiveFormAction, "isProgressiveFormAction");
338
+ function isFormData(value) {
339
+ if (!value || typeof value !== "object") return false;
340
+ return typeof FormData !== "undefined" && value instanceof FormData || Object.prototype.toString.call(value) === "[object FormData]" && typeof value.entries === "function";
341
+ }
342
+ __name(isFormData, "isFormData");
343
+
344
+ // src/store.ts
345
+ import { useSyncExternalStore } from "react";
346
+ var RESERVED_STORE_KEYS = /* @__PURE__ */ new Set([
347
+ "use",
348
+ "get",
349
+ "set",
350
+ "replace",
351
+ "reset",
352
+ "subscribe"
353
+ ]);
354
+ function cloneState(state) {
355
+ return { ...state };
356
+ }
357
+ __name(cloneState, "cloneState");
358
+ function pickState(state, keys) {
359
+ const slice = {};
360
+ for (const key of keys) {
361
+ slice[key] = state[key];
362
+ }
363
+ return slice;
364
+ }
365
+ __name(pickState, "pickState");
366
+ function getChangedKeys(state, previousState) {
367
+ const keys = /* @__PURE__ */ new Set([
368
+ ...Object.keys(state),
369
+ ...Object.keys(previousState)
370
+ ]);
371
+ return [...keys].filter((key) => !Object.is(state[key], previousState[key]));
372
+ }
373
+ __name(getChangedKeys, "getChangedKeys");
374
+ function normalizeKeys(keys) {
375
+ return Array.from(new Set(keys));
376
+ }
377
+ __name(normalizeKeys, "normalizeKeys");
378
+ function resolveValue(value, previousValue) {
379
+ return typeof value === "function" ? value(previousValue) : value;
380
+ }
381
+ __name(resolveValue, "resolveValue");
382
+ function isStoreKey(value) {
383
+ return typeof value === "string" || typeof value === "number" || typeof value === "symbol";
384
+ }
385
+ __name(isStoreKey, "isStoreKey");
386
+ function createStore(initialState, extend) {
387
+ const initialSnapshot = cloneState(initialState);
388
+ let state = cloneState(initialState);
389
+ const subscriptions = /* @__PURE__ */ new Set();
390
+ const addSubscription = /* @__PURE__ */ __name((keys, notify) => {
391
+ const subscription = { keys, notify };
392
+ subscriptions.add(subscription);
393
+ return () => {
394
+ subscriptions.delete(subscription);
395
+ };
396
+ }, "addSubscription");
397
+ const emit = /* @__PURE__ */ __name((nextState, previousState) => {
398
+ const changedKeys = getChangedKeys(nextState, previousState);
399
+ if (changedKeys.length === 0) {
400
+ return;
401
+ }
402
+ const changedKeySet = new Set(changedKeys);
403
+ for (const subscription of subscriptions) {
404
+ if (subscription.keys === null || subscription.keys.some((key) => changedKeySet.has(key))) {
405
+ subscription.notify(nextState, previousState);
406
+ }
407
+ }
408
+ }, "emit");
409
+ const getState = /* @__PURE__ */ __name((key) => {
410
+ return key === void 0 ? state : state[key];
411
+ }, "getState");
412
+ const replaceState2 = /* @__PURE__ */ __name((nextState) => {
413
+ const previousState = state;
414
+ const resolvedState = typeof nextState === "function" ? nextState(previousState) : nextState;
415
+ state = resolvedState;
416
+ emit(state, previousState);
417
+ return state;
418
+ }, "replaceState");
419
+ const setState = /* @__PURE__ */ __name((keyOrPatch, value) => {
420
+ const previousState = state;
421
+ let nextState;
422
+ if (isStoreKey(keyOrPatch)) {
423
+ const key = keyOrPatch;
424
+ const nextValue = resolveValue(value, previousState[key]);
425
+ if (Object.is(previousState[key], nextValue)) {
426
+ return nextValue;
427
+ }
428
+ nextState = {
429
+ ...previousState,
430
+ [key]: nextValue
431
+ };
432
+ state = nextState;
433
+ emit(nextState, previousState);
434
+ return nextValue;
435
+ }
436
+ const patch = typeof keyOrPatch === "function" ? keyOrPatch(previousState) : keyOrPatch;
437
+ nextState = {
438
+ ...previousState,
439
+ ...patch
440
+ };
441
+ state = nextState;
442
+ emit(nextState, previousState);
443
+ return nextState;
444
+ }, "setState");
445
+ const subscribeState = /* @__PURE__ */ __name((keyOrListener, listener) => {
446
+ if (typeof keyOrListener === "function") {
447
+ return addSubscription(null, (nextState, previousState) => {
448
+ keyOrListener(nextState, previousState);
449
+ });
450
+ }
451
+ if (Array.isArray(keyOrListener)) {
452
+ const keys = normalizeKeys(keyOrListener);
453
+ return addSubscription(keys, (nextState, previousState) => {
454
+ listener(
455
+ pickState(nextState, keys),
456
+ pickState(previousState, keys)
457
+ );
458
+ });
459
+ }
460
+ const key = keyOrListener;
461
+ return addSubscription([key], (nextState, previousState) => {
462
+ listener(nextState[key], previousState[key]);
463
+ });
464
+ }, "subscribeState");
465
+ const useStateValue = /* @__PURE__ */ __name((keyOrKeys) => {
466
+ if (Array.isArray(keyOrKeys)) {
467
+ const keys = normalizeKeys(keyOrKeys);
468
+ let lastState = state;
469
+ let lastSlice = pickState(state, keys);
470
+ const getSnapshot = /* @__PURE__ */ __name(() => {
471
+ if (lastState !== state) {
472
+ lastState = state;
473
+ lastSlice = pickState(state, keys);
474
+ }
475
+ return lastSlice;
476
+ }, "getSnapshot");
477
+ return useSyncExternalStore(
478
+ (notify) => addSubscription(keys, () => notify()),
479
+ getSnapshot,
480
+ getSnapshot
481
+ );
482
+ }
483
+ if (typeof keyOrKeys === "string") {
484
+ return useSyncExternalStore(
485
+ (notify) => addSubscription([keyOrKeys], () => notify()),
486
+ () => state[keyOrKeys],
487
+ () => state[keyOrKeys]
488
+ );
489
+ }
490
+ return useSyncExternalStore(
491
+ (notify) => addSubscription(null, () => notify()),
492
+ () => state,
493
+ () => state
494
+ );
495
+ }, "useStateValue");
496
+ const store = {
497
+ use: useStateValue,
498
+ get: getState,
499
+ set: setState,
500
+ replace: replaceState2,
501
+ reset: /* @__PURE__ */ __name(() => replaceState2(cloneState(initialSnapshot)), "reset"),
502
+ subscribe: subscribeState
503
+ };
504
+ for (const key of Object.keys(initialSnapshot)) {
505
+ if (RESERVED_STORE_KEYS.has(key)) {
506
+ throw new Error(
507
+ `createStore does not allow the reserved key "${String(key)}" in the initial state.`
508
+ );
509
+ }
510
+ const field = /* @__PURE__ */ __name((() => useStateValue(key)), "field");
511
+ field.get = () => state[key];
512
+ field.set = (value) => setState(key, value);
513
+ field.subscribe = (listener) => subscribeState(key, listener);
514
+ Object.defineProperty(store, key, {
515
+ configurable: false,
516
+ enumerable: true,
517
+ value: field,
518
+ writable: false
519
+ });
520
+ }
521
+ if (extend) {
522
+ const methods = extend(store);
523
+ for (const [name, method] of Object.entries(methods)) {
524
+ if (name in store) {
525
+ throw new Error(
526
+ `createStore cannot attach the method "${name}" because it already exists.`
527
+ );
528
+ }
529
+ Object.defineProperty(store, name, {
530
+ configurable: false,
531
+ enumerable: true,
532
+ value: method,
533
+ writable: false
534
+ });
535
+ }
536
+ }
537
+ return store;
538
+ }
539
+ __name(createStore, "createStore");
540
+
541
+ // src/client/link.tsx
542
+ import { forwardRef, useEffect, useRef as useRef3, useCallback as useCallback3 } from "react";
543
+ import { jsx } from "react/jsx-runtime";
544
+ function isModifierEvent(e) {
545
+ return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
546
+ }
547
+ __name(isModifierEvent, "isModifierEvent");
548
+ function isExternalUrl(href) {
549
+ return href.startsWith("http://") || href.startsWith("https://") || href.startsWith("//");
550
+ }
551
+ __name(isExternalUrl, "isExternalUrl");
552
+ function getRouter() {
553
+ if (typeof window !== "undefined" && window.__FARM_SPA_ROUTER__) {
554
+ return window.__FARM_SPA_ROUTER__;
555
+ }
556
+ return null;
557
+ }
558
+ __name(getRouter, "getRouter");
559
+ function normalizePrefetch(prefetch2) {
560
+ if (prefetch2 === false || prefetch2 === "none") {
561
+ return { intent: false, viewport: false, render: false };
562
+ }
563
+ if (prefetch2 === true) {
564
+ return { intent: true, viewport: true, render: false };
565
+ }
566
+ if (prefetch2 === "hover") {
567
+ return { intent: true, viewport: false, render: false };
568
+ }
569
+ if (prefetch2 === "intent") {
570
+ return { intent: true, viewport: false, render: false };
571
+ }
572
+ if (prefetch2 === "viewport") {
573
+ return { intent: false, viewport: true, render: false };
574
+ }
575
+ if (prefetch2 === "render") {
576
+ return { intent: false, viewport: false, render: true };
577
+ }
578
+ return { intent: false, viewport: false, render: false };
579
+ }
580
+ __name(normalizePrefetch, "normalizePrefetch");
581
+ function LinkInner({
582
+ href,
583
+ params,
584
+ query,
585
+ hash,
586
+ trailingSlash,
587
+ prefetch: prefetch2 = true,
588
+ prefetchDelay = 50,
589
+ replace = false,
590
+ scroll = true,
591
+ viewTransition = false,
592
+ locale,
593
+ onClick,
594
+ target,
595
+ onMouseEnter,
596
+ onMouseLeave,
597
+ onFocus,
598
+ onBlur,
599
+ onTouchStart,
600
+ ...props
601
+ }, ref) {
602
+ const elementRef = useRef3(null);
603
+ const intentTimeoutRef = useRef3(null);
604
+ const hasPrefetched = useRef3(false);
605
+ const { intent, viewport, render } = normalizePrefetch(prefetch2);
606
+ const baseHref = resolveLinkHref(href, params, {
607
+ query,
608
+ hash,
609
+ trailingSlash
610
+ });
611
+ const resolvedHref = localizeActiveFarmHref(baseHref, locale);
612
+ const isExternal = isExternalUrl(resolvedHref);
613
+ const doPrefetch = useCallback3(() => {
614
+ if (isExternal || hasPrefetched.current) return;
615
+ const router = getRouter();
616
+ if (!router) return;
617
+ hasPrefetched.current = true;
618
+ router.prefetch(resolvedHref);
619
+ }, [resolvedHref, isExternal]);
620
+ useEffect(() => {
621
+ hasPrefetched.current = false;
622
+ }, [resolvedHref]);
623
+ useEffect(() => {
624
+ const element = elementRef.current;
625
+ if (!element || isExternal) return;
626
+ const router = getRouter();
627
+ if (!router) return;
628
+ if (viewport) {
629
+ router.observeForPrefetch(element);
630
+ return () => router.unobserveForPrefetch(element);
631
+ }
632
+ }, [resolvedHref, viewport, isExternal]);
633
+ useEffect(() => {
634
+ if (!render || isExternal) return;
635
+ let cancelled = false;
636
+ let timeoutId = null;
637
+ const tryRenderPrefetch = /* @__PURE__ */ __name(() => {
638
+ if (cancelled || hasPrefetched.current) return;
639
+ const router = getRouter();
640
+ if (!router) {
641
+ timeoutId = setTimeout(tryRenderPrefetch, 30);
642
+ return;
643
+ }
644
+ hasPrefetched.current = true;
645
+ router.prefetch(resolvedHref);
646
+ }, "tryRenderPrefetch");
647
+ tryRenderPrefetch();
648
+ return () => {
649
+ cancelled = true;
650
+ if (timeoutId) {
651
+ clearTimeout(timeoutId);
652
+ }
653
+ };
654
+ }, [render, isExternal, resolvedHref]);
655
+ useEffect(() => {
656
+ return () => {
657
+ if (intentTimeoutRef.current) {
658
+ clearTimeout(intentTimeoutRef.current);
659
+ intentTimeoutRef.current = null;
660
+ }
661
+ };
662
+ }, []);
663
+ const cancelIntent = useCallback3(() => {
664
+ if (intentTimeoutRef.current) {
665
+ clearTimeout(intentTimeoutRef.current);
666
+ intentTimeoutRef.current = null;
667
+ }
668
+ }, []);
669
+ const scheduleIntentPrefetch = useCallback3(() => {
670
+ if (isExternal || !intent || hasPrefetched.current) return;
671
+ cancelIntent();
672
+ intentTimeoutRef.current = setTimeout(() => {
673
+ intentTimeoutRef.current = null;
674
+ doPrefetch();
675
+ }, prefetchDelay);
676
+ }, [intent, isExternal, prefetchDelay, doPrefetch, cancelIntent]);
677
+ const handleMouseEnter = useCallback3(
678
+ (event) => {
679
+ onMouseEnter?.(event);
680
+ scheduleIntentPrefetch();
681
+ },
682
+ [onMouseEnter, scheduleIntentPrefetch]
683
+ );
684
+ const handleMouseLeave = useCallback3(
685
+ (event) => {
686
+ onMouseLeave?.(event);
687
+ cancelIntent();
688
+ },
689
+ [onMouseLeave, cancelIntent]
690
+ );
691
+ const handleTouchStart = useCallback3(
692
+ (event) => {
693
+ onTouchStart?.(event);
694
+ scheduleIntentPrefetch();
695
+ },
696
+ [onTouchStart, scheduleIntentPrefetch]
697
+ );
698
+ const handleFocus = useCallback3(
699
+ (event) => {
700
+ onFocus?.(event);
701
+ scheduleIntentPrefetch();
702
+ },
703
+ [onFocus, scheduleIntentPrefetch]
704
+ );
705
+ const handleBlur = useCallback3(
706
+ (event) => {
707
+ onBlur?.(event);
708
+ cancelIntent();
709
+ },
710
+ [onBlur, cancelIntent]
711
+ );
712
+ const handleClick = useCallback3(
713
+ (event) => {
714
+ onClick?.(event);
715
+ if (event.defaultPrevented) return;
716
+ if (isExternal) return;
717
+ if (target && target !== "_self") return;
718
+ if (isModifierEvent(event)) return;
719
+ if (event.button !== 0) return;
720
+ if (typeof window !== "undefined") {
721
+ event.preventDefault();
722
+ if (isFarmLocaleChangeHref(resolvedHref)) {
723
+ window.location.assign(resolvedHref);
724
+ return;
725
+ }
726
+ const router = getRouter();
727
+ if (router) {
728
+ router.navigate(resolvedHref, { replace, scroll, viewTransition });
729
+ } else {
730
+ if (replace) window.location.replace(resolvedHref);
731
+ else window.location.href = resolvedHref;
732
+ }
733
+ }
734
+ },
735
+ [resolvedHref, replace, scroll, viewTransition, target, isExternal, onClick]
736
+ );
737
+ const setRefs = useCallback3(
738
+ (node) => {
739
+ elementRef.current = node;
740
+ if (typeof ref === "function") ref(node);
741
+ else if (ref) ref.current = node;
742
+ },
743
+ [ref]
744
+ );
745
+ return /* @__PURE__ */ jsx(
746
+ "a",
747
+ {
748
+ ref: setRefs,
749
+ href: resolvedHref,
750
+ target,
751
+ onClick: handleClick,
752
+ onMouseEnter: handleMouseEnter,
753
+ onMouseLeave: handleMouseLeave,
754
+ onFocus: handleFocus,
755
+ onBlur: handleBlur,
756
+ onTouchStart: handleTouchStart,
757
+ ...props,
758
+ "data-farm-link": "",
759
+ "data-replace": replace ? "" : void 0,
760
+ "data-no-scroll": !scroll ? "" : void 0,
761
+ "data-view-transition": viewTransition === "auto" ? "auto" : viewTransition ? "true" : void 0
762
+ }
763
+ );
764
+ }
765
+ __name(LinkInner, "LinkInner");
766
+ var LinkWithRef = forwardRef(LinkInner);
767
+ LinkWithRef.displayName = "Link";
768
+ var Link = LinkWithRef;
769
+ function resolveLinkHref(href, params, options) {
770
+ if (isExternalUrl(href)) return href;
771
+ const { pathname, query, hash } = splitInternalHref(href);
772
+ const resolvedHref = buildFarmRoutePath(pathname, params, {
773
+ query: mergeQueryParams(query, options.query),
774
+ hash: options.hash ?? hash,
775
+ trailingSlash: options.trailingSlash
776
+ });
777
+ return applyPreservedSearchParams(resolvedHref);
778
+ }
779
+ __name(resolveLinkHref, "resolveLinkHref");
780
+ function splitInternalHref(href) {
781
+ try {
782
+ const url = new URL(href, "http://farm.local");
783
+ return {
784
+ pathname: url.pathname || "/",
785
+ query: url.searchParams,
786
+ hash: url.hash ? url.hash.slice(1) : void 0
787
+ };
788
+ } catch {
789
+ const [withoutHash, rawHash] = href.split("#", 2);
790
+ const [pathname, rawQuery] = withoutHash.split("?", 2);
791
+ return {
792
+ pathname: pathname || "/",
793
+ query: new URLSearchParams(rawQuery || ""),
794
+ hash: rawHash
795
+ };
796
+ }
797
+ }
798
+ __name(splitInternalHref, "splitInternalHref");
799
+ function mergeQueryParams(current, next) {
800
+ const merged = new URLSearchParams(current);
801
+ if (next instanceof URLSearchParams) {
802
+ for (const [key, value] of next.entries()) {
803
+ merged.append(key, value);
804
+ }
805
+ } else if (next) {
806
+ for (const [key, value] of Object.entries(next)) {
807
+ const values = Array.isArray(value) ? value : [value];
808
+ for (const item of values) {
809
+ if (item == null) continue;
810
+ merged.append(key, String(item));
811
+ }
812
+ }
813
+ }
814
+ return merged.toString() ? merged : void 0;
815
+ }
816
+ __name(mergeQueryParams, "mergeQueryParams");
817
+ function applyPreservedSearchParams(href) {
818
+ if (typeof window === "undefined") return href;
819
+ const manifest = window.__FARM_MANIFEST__;
820
+ const routes = manifest?.routes && typeof manifest.routes === "object" ? Object.values(manifest.routes) : [];
821
+ if (routes.length === 0) return href;
822
+ const url = new URL(href, window.location.origin);
823
+ const route = routes.find((candidate) => matchManifestRoute(url.pathname, candidate));
824
+ const preserve = Array.isArray(route?.search?.preserve) ? route.search.preserve : [];
825
+ if (preserve.length === 0) return href;
826
+ const current = new URLSearchParams(window.location.search);
827
+ let changed = false;
828
+ for (const key of preserve) {
829
+ if (url.searchParams.has(key) || !current.has(key)) continue;
830
+ for (const value of current.getAll(key)) {
831
+ url.searchParams.append(key, value);
832
+ changed = true;
833
+ }
834
+ }
835
+ if (!changed) return href;
836
+ return `${url.pathname}${url.search}${url.hash}`;
837
+ }
838
+ __name(applyPreservedSearchParams, "applyPreservedSearchParams");
839
+ function matchManifestRoute(pathname, route) {
840
+ if (!route || !Array.isArray(route.segments)) return false;
841
+ const routeSegments = route.segments;
842
+ const normalized = pathname === "/" ? "" : pathname.replace(/^\/+/, "").replace(/\/+$/, "");
843
+ const pathSegments = normalized ? normalized.split("/") : [];
844
+ const hasCatchAll = routeSegments.some((segment) => segment.isCatchAll);
845
+ if (!hasCatchAll && pathSegments.length !== routeSegments.length) {
846
+ return false;
847
+ }
848
+ for (let index = 0; index < routeSegments.length; index++) {
849
+ const routeSegment = routeSegments[index];
850
+ const pathSegment = pathSegments[index];
851
+ if (routeSegment.isCatchAll) {
852
+ return true;
853
+ }
854
+ if (pathSegment === void 0) {
855
+ if (routeSegment.isOptional) continue;
856
+ return false;
857
+ }
858
+ if (!routeSegment.isDynamic && routeSegment.segment !== pathSegment) {
859
+ return false;
860
+ }
861
+ }
862
+ return pathSegments.length === routeSegments.length || hasCatchAll;
863
+ }
864
+ __name(matchManifestRoute, "matchManifestRoute");
865
+
866
+ export {
867
+ useMutation,
868
+ useFetcher,
869
+ createStore,
870
+ Link
871
+ };
872
+ //# sourceMappingURL=chunk-WDU6QXNK.mjs.map