@openpalm/ui 0.11.0-rc.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (339) hide show
  1. package/README.md +160 -0
  2. package/build/.openpalm-ui-version +1 -0
  3. package/build/client/_app/immutable/assets/0.p3iHeEvq.css +1 -0
  4. package/build/client/_app/immutable/assets/0.p3iHeEvq.css.br +0 -0
  5. package/build/client/_app/immutable/assets/0.p3iHeEvq.css.gz +0 -0
  6. package/build/client/_app/immutable/assets/4.BakrtzGF.css +1 -0
  7. package/build/client/_app/immutable/assets/4.BakrtzGF.css.br +0 -0
  8. package/build/client/_app/immutable/assets/4.BakrtzGF.css.gz +0 -0
  9. package/build/client/_app/immutable/assets/5.Cj0Mk9Gn.css +1 -0
  10. package/build/client/_app/immutable/assets/5.Cj0Mk9Gn.css.br +0 -0
  11. package/build/client/_app/immutable/assets/5.Cj0Mk9Gn.css.gz +0 -0
  12. package/build/client/_app/immutable/assets/6.B0Z8tVIH.css +1 -0
  13. package/build/client/_app/immutable/assets/6.B0Z8tVIH.css.br +1 -0
  14. package/build/client/_app/immutable/assets/6.B0Z8tVIH.css.gz +0 -0
  15. package/build/client/_app/immutable/assets/7.Cucah5cY.css +1 -0
  16. package/build/client/_app/immutable/assets/7.Cucah5cY.css.br +0 -0
  17. package/build/client/_app/immutable/assets/7.Cucah5cY.css.gz +0 -0
  18. package/build/client/_app/immutable/assets/8.DjrHy5wu.css +1 -0
  19. package/build/client/_app/immutable/assets/8.DjrHy5wu.css.br +0 -0
  20. package/build/client/_app/immutable/assets/8.DjrHy5wu.css.gz +0 -0
  21. package/build/client/_app/immutable/assets/AuthGate.B8fOC_pJ.css +1 -0
  22. package/build/client/_app/immutable/assets/AuthGate.B8fOC_pJ.css.br +0 -0
  23. package/build/client/_app/immutable/assets/AuthGate.B8fOC_pJ.css.gz +0 -0
  24. package/build/client/_app/immutable/assets/ModeSwitch.RmRIDur-.css +1 -0
  25. package/build/client/_app/immutable/assets/ModeSwitch.RmRIDur-.css.br +0 -0
  26. package/build/client/_app/immutable/assets/ModeSwitch.RmRIDur-.css.gz +0 -0
  27. package/build/client/_app/immutable/assets/VoiceProfileSelector.CM_o2XIa.css +1 -0
  28. package/build/client/_app/immutable/assets/VoiceProfileSelector.CM_o2XIa.css.br +0 -0
  29. package/build/client/_app/immutable/assets/VoiceProfileSelector.CM_o2XIa.css.gz +0 -0
  30. package/build/client/_app/immutable/chunks/BDFsK-cU.js +5 -0
  31. package/build/client/_app/immutable/chunks/BDFsK-cU.js.br +0 -0
  32. package/build/client/_app/immutable/chunks/BDFsK-cU.js.gz +0 -0
  33. package/build/client/_app/immutable/chunks/BOq4Y36A.js +1 -0
  34. package/build/client/_app/immutable/chunks/BOq4Y36A.js.br +0 -0
  35. package/build/client/_app/immutable/chunks/BOq4Y36A.js.gz +0 -0
  36. package/build/client/_app/immutable/chunks/Bdvti_5C.js +1 -0
  37. package/build/client/_app/immutable/chunks/Bdvti_5C.js.br +0 -0
  38. package/build/client/_app/immutable/chunks/Bdvti_5C.js.gz +0 -0
  39. package/build/client/_app/immutable/chunks/BuFlayix.js +1 -0
  40. package/build/client/_app/immutable/chunks/BuFlayix.js.br +0 -0
  41. package/build/client/_app/immutable/chunks/BuFlayix.js.gz +0 -0
  42. package/build/client/_app/immutable/chunks/BwTF6U35.js +3 -0
  43. package/build/client/_app/immutable/chunks/BwTF6U35.js.br +0 -0
  44. package/build/client/_app/immutable/chunks/BwTF6U35.js.gz +0 -0
  45. package/build/client/_app/immutable/chunks/CJkMgfFh.js +1 -0
  46. package/build/client/_app/immutable/chunks/CJkMgfFh.js.br +0 -0
  47. package/build/client/_app/immutable/chunks/CJkMgfFh.js.gz +0 -0
  48. package/build/client/_app/immutable/chunks/DQCVeARi.js +1 -0
  49. package/build/client/_app/immutable/chunks/DQCVeARi.js.br +0 -0
  50. package/build/client/_app/immutable/chunks/DQCVeARi.js.gz +0 -0
  51. package/build/client/_app/immutable/chunks/DpdFx-ph.js +1 -0
  52. package/build/client/_app/immutable/chunks/DpdFx-ph.js.br +0 -0
  53. package/build/client/_app/immutable/chunks/DpdFx-ph.js.gz +0 -0
  54. package/build/client/_app/immutable/chunks/kNaey6uv.js +1 -0
  55. package/build/client/_app/immutable/chunks/kNaey6uv.js.br +0 -0
  56. package/build/client/_app/immutable/chunks/kNaey6uv.js.gz +0 -0
  57. package/build/client/_app/immutable/chunks/os2NZ37U.js +1 -0
  58. package/build/client/_app/immutable/chunks/os2NZ37U.js.br +1 -0
  59. package/build/client/_app/immutable/chunks/os2NZ37U.js.gz +0 -0
  60. package/build/client/_app/immutable/chunks/xihTtKlq.js +1 -0
  61. package/build/client/_app/immutable/chunks/xihTtKlq.js.br +1 -0
  62. package/build/client/_app/immutable/chunks/xihTtKlq.js.gz +0 -0
  63. package/build/client/_app/immutable/entry/app.Coaz9qVz.js +2 -0
  64. package/build/client/_app/immutable/entry/app.Coaz9qVz.js.br +0 -0
  65. package/build/client/_app/immutable/entry/app.Coaz9qVz.js.gz +0 -0
  66. package/build/client/_app/immutable/entry/start.CaHQB6hU.js +1 -0
  67. package/build/client/_app/immutable/entry/start.CaHQB6hU.js.br +1 -0
  68. package/build/client/_app/immutable/entry/start.CaHQB6hU.js.gz +0 -0
  69. package/build/client/_app/immutable/nodes/0.BUaVTC13.js +1 -0
  70. package/build/client/_app/immutable/nodes/0.BUaVTC13.js.br +0 -0
  71. package/build/client/_app/immutable/nodes/0.BUaVTC13.js.gz +0 -0
  72. package/build/client/_app/immutable/nodes/1.DpM9NN8J.js +1 -0
  73. package/build/client/_app/immutable/nodes/1.DpM9NN8J.js.br +0 -0
  74. package/build/client/_app/immutable/nodes/1.DpM9NN8J.js.gz +0 -0
  75. package/build/client/_app/immutable/nodes/2.ojh8oE7F.js +1 -0
  76. package/build/client/_app/immutable/nodes/2.ojh8oE7F.js.br +0 -0
  77. package/build/client/_app/immutable/nodes/2.ojh8oE7F.js.gz +0 -0
  78. package/build/client/_app/immutable/nodes/3.DeAC3yVJ.js +1 -0
  79. package/build/client/_app/immutable/nodes/3.DeAC3yVJ.js.br +0 -0
  80. package/build/client/_app/immutable/nodes/3.DeAC3yVJ.js.gz +0 -0
  81. package/build/client/_app/immutable/nodes/4.8L-_wsn9.js +18 -0
  82. package/build/client/_app/immutable/nodes/4.8L-_wsn9.js.br +0 -0
  83. package/build/client/_app/immutable/nodes/4.8L-_wsn9.js.gz +0 -0
  84. package/build/client/_app/immutable/nodes/5.kb9iVd3S.js +4 -0
  85. package/build/client/_app/immutable/nodes/5.kb9iVd3S.js.br +0 -0
  86. package/build/client/_app/immutable/nodes/5.kb9iVd3S.js.gz +0 -0
  87. package/build/client/_app/immutable/nodes/6.DtmDzmki.js +1 -0
  88. package/build/client/_app/immutable/nodes/6.DtmDzmki.js.br +0 -0
  89. package/build/client/_app/immutable/nodes/6.DtmDzmki.js.gz +0 -0
  90. package/build/client/_app/immutable/nodes/7.-Pv5Qce0.js +15 -0
  91. package/build/client/_app/immutable/nodes/7.-Pv5Qce0.js.br +0 -0
  92. package/build/client/_app/immutable/nodes/7.-Pv5Qce0.js.gz +0 -0
  93. package/build/client/_app/immutable/nodes/8.Rc3xcFgu.js +2 -0
  94. package/build/client/_app/immutable/nodes/8.Rc3xcFgu.js.br +0 -0
  95. package/build/client/_app/immutable/nodes/8.Rc3xcFgu.js.gz +0 -0
  96. package/build/client/_app/version.json +1 -0
  97. package/build/client/_app/version.json.br +1 -0
  98. package/build/client/_app/version.json.gz +0 -0
  99. package/build/client/banner.png +0 -0
  100. package/build/client/fu-128.png +0 -0
  101. package/build/client/fu.png +0 -0
  102. package/build/client/logo-128.png +0 -0
  103. package/build/client/logo.png +0 -0
  104. package/build/client/setup/wizard.css +1639 -0
  105. package/build/client/setup/wizard.css.br +0 -0
  106. package/build/client/setup/wizard.css.gz +0 -0
  107. package/build/client/wizard-128.png +0 -0
  108. package/build/client/wizard.png +0 -0
  109. package/build/env.js +94 -0
  110. package/build/handler.js +1494 -0
  111. package/build/index.js +345 -0
  112. package/build/server/chunks/0-TTdZdv8o.js +9 -0
  113. package/build/server/chunks/0-TTdZdv8o.js.map +1 -0
  114. package/build/server/chunks/1-XPMbcj69.js +9 -0
  115. package/build/server/chunks/1-XPMbcj69.js.map +1 -0
  116. package/build/server/chunks/2-C2y4ydWU.js +9 -0
  117. package/build/server/chunks/2-C2y4ydWU.js.map +1 -0
  118. package/build/server/chunks/3-BgeGdVvT.js +23 -0
  119. package/build/server/chunks/3-BgeGdVvT.js.map +1 -0
  120. package/build/server/chunks/4-v8u4eatk.js +9 -0
  121. package/build/server/chunks/4-v8u4eatk.js.map +1 -0
  122. package/build/server/chunks/5-BkUoZ2K4.js +9 -0
  123. package/build/server/chunks/5-BkUoZ2K4.js.map +1 -0
  124. package/build/server/chunks/6-Cep4AGS2.js +9 -0
  125. package/build/server/chunks/6-Cep4AGS2.js.map +1 -0
  126. package/build/server/chunks/7-DOEFGynd.js +9 -0
  127. package/build/server/chunks/7-DOEFGynd.js.map +1 -0
  128. package/build/server/chunks/8-EJHw3wqt.js +9 -0
  129. package/build/server/chunks/8-EJHw3wqt.js.map +1 -0
  130. package/build/server/chunks/AuthGate-UhfWI3rb.js +741 -0
  131. package/build/server/chunks/AuthGate-UhfWI3rb.js.map +1 -0
  132. package/build/server/chunks/ModeSwitch-S3I-WINb.js +15 -0
  133. package/build/server/chunks/ModeSwitch-S3I-WINb.js.map +1 -0
  134. package/build/server/chunks/_helpers-B_lb4-jB.js +74 -0
  135. package/build/server/chunks/_helpers-B_lb4-jB.js.map +1 -0
  136. package/build/server/chunks/_layout.svelte-B93aaRP_.js +11 -0
  137. package/build/server/chunks/_layout.svelte-B93aaRP_.js.map +1 -0
  138. package/build/server/chunks/_layout.svelte-CcloHuB_.js +60 -0
  139. package/build/server/chunks/_layout.svelte-CcloHuB_.js.map +1 -0
  140. package/build/server/chunks/_page.svelte-9RQ3rYiU.js +69 -0
  141. package/build/server/chunks/_page.svelte-9RQ3rYiU.js.map +1 -0
  142. package/build/server/chunks/_page.svelte-BP2EdQl3.js +5 -0
  143. package/build/server/chunks/_page.svelte-BP2EdQl3.js.map +1 -0
  144. package/build/server/chunks/_page.svelte-CKARhLvT.js +408 -0
  145. package/build/server/chunks/_page.svelte-CKARhLvT.js.map +1 -0
  146. package/build/server/chunks/_page.svelte-CnZsPxgJ.js +5540 -0
  147. package/build/server/chunks/_page.svelte-CnZsPxgJ.js.map +1 -0
  148. package/build/server/chunks/_page.svelte-D0gMlmzQ.js +104 -0
  149. package/build/server/chunks/_page.svelte-D0gMlmzQ.js.map +1 -0
  150. package/build/server/chunks/_page.svelte-pxsCzB7-.js +106 -0
  151. package/build/server/chunks/_page.svelte-pxsCzB7-.js.map +1 -0
  152. package/build/server/chunks/_server.ts-33LuQvHu.js +19 -0
  153. package/build/server/chunks/_server.ts-33LuQvHu.js.map +1 -0
  154. package/build/server/chunks/_server.ts-5CjguYY3.js +514 -0
  155. package/build/server/chunks/_server.ts-5CjguYY3.js.map +1 -0
  156. package/build/server/chunks/_server.ts-B3tjtq2m.js +64 -0
  157. package/build/server/chunks/_server.ts-B3tjtq2m.js.map +1 -0
  158. package/build/server/chunks/_server.ts-B4N5gO26.js +70 -0
  159. package/build/server/chunks/_server.ts-B4N5gO26.js.map +1 -0
  160. package/build/server/chunks/_server.ts-B6FENZO7.js +82 -0
  161. package/build/server/chunks/_server.ts-B6FENZO7.js.map +1 -0
  162. package/build/server/chunks/_server.ts-B8JtVHLy.js +41 -0
  163. package/build/server/chunks/_server.ts-B8JtVHLy.js.map +1 -0
  164. package/build/server/chunks/_server.ts-BR9OrjcE.js +68 -0
  165. package/build/server/chunks/_server.ts-BR9OrjcE.js.map +1 -0
  166. package/build/server/chunks/_server.ts-BYVcXj0z.js +107 -0
  167. package/build/server/chunks/_server.ts-BYVcXj0z.js.map +1 -0
  168. package/build/server/chunks/_server.ts-BYdXdnje.js +97 -0
  169. package/build/server/chunks/_server.ts-BYdXdnje.js.map +1 -0
  170. package/build/server/chunks/_server.ts-BaxRyhZ8.js +44 -0
  171. package/build/server/chunks/_server.ts-BaxRyhZ8.js.map +1 -0
  172. package/build/server/chunks/_server.ts-BclZ3UFT.js +41 -0
  173. package/build/server/chunks/_server.ts-BclZ3UFT.js.map +1 -0
  174. package/build/server/chunks/_server.ts-Bd_I8GjG.js +60 -0
  175. package/build/server/chunks/_server.ts-Bd_I8GjG.js.map +1 -0
  176. package/build/server/chunks/_server.ts-Bdry_CdG.js +33 -0
  177. package/build/server/chunks/_server.ts-Bdry_CdG.js.map +1 -0
  178. package/build/server/chunks/_server.ts-Bg8OpPuA.js +65 -0
  179. package/build/server/chunks/_server.ts-Bg8OpPuA.js.map +1 -0
  180. package/build/server/chunks/_server.ts-BjrO7pvn.js +73 -0
  181. package/build/server/chunks/_server.ts-BjrO7pvn.js.map +1 -0
  182. package/build/server/chunks/_server.ts-BkoJOqrr.js +70 -0
  183. package/build/server/chunks/_server.ts-BkoJOqrr.js.map +1 -0
  184. package/build/server/chunks/_server.ts-Bl0YOh50.js +40 -0
  185. package/build/server/chunks/_server.ts-Bl0YOh50.js.map +1 -0
  186. package/build/server/chunks/_server.ts-BmZlEy27.js +55 -0
  187. package/build/server/chunks/_server.ts-BmZlEy27.js.map +1 -0
  188. package/build/server/chunks/_server.ts-Bq2S1OMq.js +163 -0
  189. package/build/server/chunks/_server.ts-Bq2S1OMq.js.map +1 -0
  190. package/build/server/chunks/_server.ts-BwHojI4i.js +59 -0
  191. package/build/server/chunks/_server.ts-BwHojI4i.js.map +1 -0
  192. package/build/server/chunks/_server.ts-C-lN2ZUO.js +33 -0
  193. package/build/server/chunks/_server.ts-C-lN2ZUO.js.map +1 -0
  194. package/build/server/chunks/_server.ts-C1DcK_rP.js +200 -0
  195. package/build/server/chunks/_server.ts-C1DcK_rP.js.map +1 -0
  196. package/build/server/chunks/_server.ts-C1y3X6iK.js +52 -0
  197. package/build/server/chunks/_server.ts-C1y3X6iK.js.map +1 -0
  198. package/build/server/chunks/_server.ts-C5s-OXCm.js +79 -0
  199. package/build/server/chunks/_server.ts-C5s-OXCm.js.map +1 -0
  200. package/build/server/chunks/_server.ts-CAKTZL2t.js +63 -0
  201. package/build/server/chunks/_server.ts-CAKTZL2t.js.map +1 -0
  202. package/build/server/chunks/_server.ts-CDtOOD3Q.js +83 -0
  203. package/build/server/chunks/_server.ts-CDtOOD3Q.js.map +1 -0
  204. package/build/server/chunks/_server.ts-CG409cWi.js +46 -0
  205. package/build/server/chunks/_server.ts-CG409cWi.js.map +1 -0
  206. package/build/server/chunks/_server.ts-CJL8da0o.js +56 -0
  207. package/build/server/chunks/_server.ts-CJL8da0o.js.map +1 -0
  208. package/build/server/chunks/_server.ts-CLBKpKeH.js +204 -0
  209. package/build/server/chunks/_server.ts-CLBKpKeH.js.map +1 -0
  210. package/build/server/chunks/_server.ts-CLiYOnOv.js +50 -0
  211. package/build/server/chunks/_server.ts-CLiYOnOv.js.map +1 -0
  212. package/build/server/chunks/_server.ts-CMvY0ZDz.js +101 -0
  213. package/build/server/chunks/_server.ts-CMvY0ZDz.js.map +1 -0
  214. package/build/server/chunks/_server.ts-CQqURrHY.js +41 -0
  215. package/build/server/chunks/_server.ts-CQqURrHY.js.map +1 -0
  216. package/build/server/chunks/_server.ts-CSgPjCYv.js +79 -0
  217. package/build/server/chunks/_server.ts-CSgPjCYv.js.map +1 -0
  218. package/build/server/chunks/_server.ts-C_fNO73y.js +44 -0
  219. package/build/server/chunks/_server.ts-C_fNO73y.js.map +1 -0
  220. package/build/server/chunks/_server.ts-CcTt5aAs.js +41 -0
  221. package/build/server/chunks/_server.ts-CcTt5aAs.js.map +1 -0
  222. package/build/server/chunks/_server.ts-CfLbEufw.js +53 -0
  223. package/build/server/chunks/_server.ts-CfLbEufw.js.map +1 -0
  224. package/build/server/chunks/_server.ts-CqHMhINi.js +53 -0
  225. package/build/server/chunks/_server.ts-CqHMhINi.js.map +1 -0
  226. package/build/server/chunks/_server.ts-CrU9r7-F.js +88 -0
  227. package/build/server/chunks/_server.ts-CrU9r7-F.js.map +1 -0
  228. package/build/server/chunks/_server.ts-CtZuKotA.js +70 -0
  229. package/build/server/chunks/_server.ts-CtZuKotA.js.map +1 -0
  230. package/build/server/chunks/_server.ts-D-sjM5kn.js +103 -0
  231. package/build/server/chunks/_server.ts-D-sjM5kn.js.map +1 -0
  232. package/build/server/chunks/_server.ts-D2wlMMJl.js +41 -0
  233. package/build/server/chunks/_server.ts-D2wlMMJl.js.map +1 -0
  234. package/build/server/chunks/_server.ts-D7L27_xI.js +65 -0
  235. package/build/server/chunks/_server.ts-D7L27_xI.js.map +1 -0
  236. package/build/server/chunks/_server.ts-DMKIHwKi.js +90 -0
  237. package/build/server/chunks/_server.ts-DMKIHwKi.js.map +1 -0
  238. package/build/server/chunks/_server.ts-DTyZan5L.js +33 -0
  239. package/build/server/chunks/_server.ts-DTyZan5L.js.map +1 -0
  240. package/build/server/chunks/_server.ts-DVekHgMN.js +96 -0
  241. package/build/server/chunks/_server.ts-DVekHgMN.js.map +1 -0
  242. package/build/server/chunks/_server.ts-DWLkr6Qg.js +54 -0
  243. package/build/server/chunks/_server.ts-DWLkr6Qg.js.map +1 -0
  244. package/build/server/chunks/_server.ts-DWN6TJv0.js +149 -0
  245. package/build/server/chunks/_server.ts-DWN6TJv0.js.map +1 -0
  246. package/build/server/chunks/_server.ts-D_dO8hvJ.js +56 -0
  247. package/build/server/chunks/_server.ts-D_dO8hvJ.js.map +1 -0
  248. package/build/server/chunks/_server.ts-Da9y6lio.js +82 -0
  249. package/build/server/chunks/_server.ts-Da9y6lio.js.map +1 -0
  250. package/build/server/chunks/_server.ts-DbO3cg55.js +54 -0
  251. package/build/server/chunks/_server.ts-DbO3cg55.js.map +1 -0
  252. package/build/server/chunks/_server.ts-DclRsTpW.js +44 -0
  253. package/build/server/chunks/_server.ts-DclRsTpW.js.map +1 -0
  254. package/build/server/chunks/_server.ts-DdlF1vjy.js +159 -0
  255. package/build/server/chunks/_server.ts-DdlF1vjy.js.map +1 -0
  256. package/build/server/chunks/_server.ts-De7IOs2z.js +759 -0
  257. package/build/server/chunks/_server.ts-De7IOs2z.js.map +1 -0
  258. package/build/server/chunks/_server.ts-DmyOp1yq.js +40 -0
  259. package/build/server/chunks/_server.ts-DmyOp1yq.js.map +1 -0
  260. package/build/server/chunks/_server.ts-DnKTcT9x.js +46 -0
  261. package/build/server/chunks/_server.ts-DnKTcT9x.js.map +1 -0
  262. package/build/server/chunks/_server.ts-Dq82kHyx.js +72 -0
  263. package/build/server/chunks/_server.ts-Dq82kHyx.js.map +1 -0
  264. package/build/server/chunks/_server.ts-DqVJ1NqI.js +55 -0
  265. package/build/server/chunks/_server.ts-DqVJ1NqI.js.map +1 -0
  266. package/build/server/chunks/_server.ts-DzWtvjem.js +46 -0
  267. package/build/server/chunks/_server.ts-DzWtvjem.js.map +1 -0
  268. package/build/server/chunks/_server.ts-EZS5Qan4.js +62 -0
  269. package/build/server/chunks/_server.ts-EZS5Qan4.js.map +1 -0
  270. package/build/server/chunks/_server.ts-I0iKpsyr.js +77 -0
  271. package/build/server/chunks/_server.ts-I0iKpsyr.js.map +1 -0
  272. package/build/server/chunks/_server.ts-P4pmd9NX.js +55 -0
  273. package/build/server/chunks/_server.ts-P4pmd9NX.js.map +1 -0
  274. package/build/server/chunks/_server.ts-UF_kxNaU.js +79 -0
  275. package/build/server/chunks/_server.ts-UF_kxNaU.js.map +1 -0
  276. package/build/server/chunks/_server.ts-b3mVtmkb.js +121 -0
  277. package/build/server/chunks/_server.ts-b3mVtmkb.js.map +1 -0
  278. package/build/server/chunks/_server.ts-dhkEt2p6.js +63 -0
  279. package/build/server/chunks/_server.ts-dhkEt2p6.js.map +1 -0
  280. package/build/server/chunks/_server.ts-eK_9jY-9.js +67 -0
  281. package/build/server/chunks/_server.ts-eK_9jY-9.js.map +1 -0
  282. package/build/server/chunks/_server.ts-fsEmx9mw.js +42 -0
  283. package/build/server/chunks/_server.ts-fsEmx9mw.js.map +1 -0
  284. package/build/server/chunks/_server.ts-l4CK3c4j.js +109 -0
  285. package/build/server/chunks/_server.ts-l4CK3c4j.js.map +1 -0
  286. package/build/server/chunks/_server.ts-otJRaSSq.js +139 -0
  287. package/build/server/chunks/_server.ts-otJRaSSq.js.map +1 -0
  288. package/build/server/chunks/_server.ts-rXhjnBtw.js +49 -0
  289. package/build/server/chunks/_server.ts-rXhjnBtw.js.map +1 -0
  290. package/build/server/chunks/_server.ts-wZ88P3nX.js +157 -0
  291. package/build/server/chunks/_server.ts-wZ88P3nX.js.map +1 -0
  292. package/build/server/chunks/_server.ts-xO4nhxDx.js +60 -0
  293. package/build/server/chunks/_server.ts-xO4nhxDx.js.map +1 -0
  294. package/build/server/chunks/_server.ts-yimewsjO.js +57 -0
  295. package/build/server/chunks/_server.ts-yimewsjO.js.map +1 -0
  296. package/build/server/chunks/addon-helpers-BpnH-GEc.js +49 -0
  297. package/build/server/chunks/addon-helpers-BpnH-GEc.js.map +1 -0
  298. package/build/server/chunks/chunk-CLZ62Ad-.js +18 -0
  299. package/build/server/chunks/chunk-CLZ62Ad-.js.map +1 -0
  300. package/build/server/chunks/coercion-TNFJisCC.js +34 -0
  301. package/build/server/chunks/coercion-TNFJisCC.js.map +1 -0
  302. package/build/server/chunks/config-0LFudKuE.js +121 -0
  303. package/build/server/chunks/config-0LFudKuE.js.map +1 -0
  304. package/build/server/chunks/dev-DjANv7AF.js +4389 -0
  305. package/build/server/chunks/dev-DjANv7AF.js.map +1 -0
  306. package/build/server/chunks/docker-B23w4kr6.js +20 -0
  307. package/build/server/chunks/docker-B23w4kr6.js.map +1 -0
  308. package/build/server/chunks/endpoints-Drq_J-2Z.js +340 -0
  309. package/build/server/chunks/endpoints-Drq_J-2Z.js.map +1 -0
  310. package/build/server/chunks/error.svelte-ByNznOuj.js +16 -0
  311. package/build/server/chunks/error.svelte-ByNznOuj.js.map +1 -0
  312. package/build/server/chunks/exports-D1quPX8S.js +124 -0
  313. package/build/server/chunks/exports-D1quPX8S.js.map +1 -0
  314. package/build/server/chunks/helpers-CX6xRBmt.js +226 -0
  315. package/build/server/chunks/helpers-CX6xRBmt.js.map +1 -0
  316. package/build/server/chunks/hooks.server-BEVMYNQ4.js +86 -0
  317. package/build/server/chunks/hooks.server-BEVMYNQ4.js.map +1 -0
  318. package/build/server/chunks/http-VqOG8hyj.js +31 -0
  319. package/build/server/chunks/http-VqOG8hyj.js.map +1 -0
  320. package/build/server/chunks/internal-CeK24Lte.js +1544 -0
  321. package/build/server/chunks/internal-CeK24Lte.js.map +1 -0
  322. package/build/server/chunks/serial-queue-D9FEpYVv.js +22 -0
  323. package/build/server/chunks/serial-queue-D9FEpYVv.js.map +1 -0
  324. package/build/server/chunks/setup-deploy-B4oSSFYi.js +529 -0
  325. package/build/server/chunks/setup-deploy-B4oSSFYi.js.map +1 -0
  326. package/build/server/chunks/src-BkvQ5Uuf.js +14082 -0
  327. package/build/server/chunks/src-BkvQ5Uuf.js.map +1 -0
  328. package/build/server/chunks/state-D7JS-l_D.js +203 -0
  329. package/build/server/chunks/state-D7JS-l_D.js.map +1 -0
  330. package/build/server/chunks/theme-state.svelte-PtPMmKGN.js +520 -0
  331. package/build/server/chunks/theme-state.svelte-PtPMmKGN.js.map +1 -0
  332. package/build/server/chunks/utils-BSRjJDrZ.js +150 -0
  333. package/build/server/chunks/utils-BSRjJDrZ.js.map +1 -0
  334. package/build/server/index.js +4389 -0
  335. package/build/server/index.js.map +1 -0
  336. package/build/server/manifest.js +584 -0
  337. package/build/server/manifest.js.map +1 -0
  338. package/build/shims.js +32 -0
  339. package/package.json +68 -0
@@ -0,0 +1,4389 @@
1
+ import { _ as __commonJSMin } from './chunks/chunk-CLZ62Ad-.js';
2
+ import { c as coalesce_to_error, j as get_status, i as get_message, F as with_request_store, t as parse, s as options, a as IN_WEBCONTAINER, h as get_hooks, n as noop, T as TRAILING_SLASH_PARAM, I as INVALIDATED_PARAM, e as decode_pathname, g as find_route, q as normalize_path, f as disable_search, C as validate_layout_server_exports, B as validate_layout_exports, E as validate_page_server_exports, D as validate_page_exports, o as noop_span, w as resolve, v as read_implementation, l as merge_tracing, x as set_read_implementation, d as create_remote_key, k as hash, b as compact, r as once, p as normalize_error, m as make_trackable, u as parse_remote_arg, z as stringify, A as stringify$1, y as split_remote_key, N as NULL_BODY_STATUS } from './chunks/internal-CeK24Lte.js';
3
+ import { H as HttpError, S as SvelteKitError, e as has_resolution_suffix, h as has_data_suffix, f as strip_resolution_suffix, s as strip_data_suffix, a as add_data_suffix, b as add_resolution_suffix, R as Redirect, g as get_relative_path, t as text_encoder, A as ActionFailure, d as base64_encode } from './chunks/utils-BSRjJDrZ.js';
4
+ import { j as json, t as text, i as isRedirect, e as error } from './chunks/exports-D1quPX8S.js';
5
+ import { a9 as uneval, ab as writable, X as readable } from './chunks/dev-DjANv7AF.js';
6
+ import 'node:module';
7
+
8
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/runtime/app/paths/internal/server.js
9
+ var base = "";
10
+ var assets = base;
11
+ var app_dir = "_app";
12
+ var initial = {
13
+ base,
14
+ assets
15
+ };
16
+ /**
17
+ * @param {{ base: string, assets: string }} paths
18
+ */
19
+ function override(paths) {
20
+ base = paths.base;
21
+ assets = paths.assets;
22
+ }
23
+ function reset() {
24
+ base = initial.base;
25
+ assets = initial.assets;
26
+ }
27
+ /**
28
+ * `$env/dynamic/public`
29
+ * @type {Record<string, string>}
30
+ */
31
+ var public_env = {};
32
+ /** @type {(environment: Record<string, string>) => void} */
33
+ function set_private_env(environment) {}
34
+ /** @type {(environment: Record<string, string>) => void} */
35
+ function set_public_env(environment) {
36
+ public_env = environment;
37
+ }
38
+
39
+ var ENDPOINT_METHODS = [
40
+ "GET",
41
+ "POST",
42
+ "PUT",
43
+ "PATCH",
44
+ "DELETE",
45
+ "OPTIONS",
46
+ "HEAD"
47
+ ];
48
+ var PAGE_METHODS = [
49
+ "GET",
50
+ "POST",
51
+ "HEAD"
52
+ ];
53
+ //#endregion
54
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/runtime/form-utils.js
55
+ /** @import { RemoteForm } from '@sveltejs/kit' */
56
+ /** @import { BinaryFormMeta, InternalRemoteFormIssue } from 'types' */
57
+ /** @import { StandardSchemaV1 } from '@standard-schema/spec' */
58
+ var decoder = new TextDecoder();
59
+ /**
60
+ * Sets a value in a nested object using a path string, mutating the original object
61
+ * @param {Record<string, any>} object
62
+ * @param {string} path_string
63
+ * @param {any} value
64
+ */
65
+ function set_nested_value(object, path_string, value) {
66
+ if (path_string.startsWith("n:")) {
67
+ path_string = path_string.slice(2);
68
+ value = value === "" ? void 0 : parseFloat(value);
69
+ } else if (path_string.startsWith("b:")) {
70
+ path_string = path_string.slice(2);
71
+ value = value === "on";
72
+ }
73
+ deep_set(object, split_path(path_string), value);
74
+ }
75
+ /**
76
+ * Convert `FormData` into a POJO
77
+ * @param {FormData} data
78
+ */
79
+ function convert_formdata(data) {
80
+ /** @type {Record<string, any>} */
81
+ const result = {};
82
+ for (let key of data.keys()) {
83
+ const is_array = key.endsWith("[]");
84
+ /** @type {any[]} */
85
+ let values = data.getAll(key);
86
+ if (is_array) key = key.slice(0, -2);
87
+ if (values.length > 1 && !is_array) throw new Error(`Form cannot contain duplicated keys — "${key}" has ${values.length} values`);
88
+ values = values.filter((entry) => typeof entry === "string" || entry.name !== "" || entry.size > 0);
89
+ if (key.startsWith("n:")) {
90
+ key = key.slice(2);
91
+ values = values.map((v) => v === "" ? void 0 : parseFloat(v));
92
+ } else if (key.startsWith("b:")) {
93
+ key = key.slice(2);
94
+ values = values.map((v) => v === "on");
95
+ }
96
+ set_nested_value(result, key, is_array ? values : values[0]);
97
+ }
98
+ return result;
99
+ }
100
+ var BINARY_FORM_CONTENT_TYPE = "application/x-sveltekit-formdata";
101
+ var BINARY_FORM_VERSION = 0;
102
+ var HEADER_BYTES = 7;
103
+ /**
104
+ * @param {Request} request
105
+ * @returns {Promise<{ data: Record<string, any>; meta: BinaryFormMeta; form_data: FormData | null }>}
106
+ */
107
+ async function deserialize_binary_form(request) {
108
+ if (request.headers.get("content-type") !== "application/x-sveltekit-formdata") {
109
+ const form_data = await request.formData();
110
+ return {
111
+ data: convert_formdata(form_data),
112
+ meta: {},
113
+ form_data
114
+ };
115
+ }
116
+ if (!request.body) throw deserialize_error("no body");
117
+ const reader = request.body.getReader();
118
+ /** @type {Array<Promise<Uint8Array<ArrayBuffer> | undefined>>} */
119
+ const chunks = [];
120
+ /**
121
+ * @param {number} index
122
+ * @returns {Promise<Uint8Array<ArrayBuffer> | undefined>}
123
+ */
124
+ function get_chunk(index) {
125
+ if (index in chunks) return chunks[index];
126
+ let i = chunks.length;
127
+ while (i <= index) {
128
+ chunks[i] = reader.read().then((chunk) => chunk.value);
129
+ i++;
130
+ }
131
+ return chunks[index];
132
+ }
133
+ /**
134
+ * @param {number} offset
135
+ * @param {number} length
136
+ * @returns {Promise<Uint8Array | null>}
137
+ */
138
+ async function get_buffer(offset, length) {
139
+ /** @type {Uint8Array} */
140
+ let start_chunk;
141
+ let chunk_start = 0;
142
+ /** @type {number} */
143
+ let chunk_index;
144
+ for (chunk_index = 0;; chunk_index++) {
145
+ const chunk = await get_chunk(chunk_index);
146
+ if (!chunk) return null;
147
+ const chunk_end = chunk_start + chunk.byteLength;
148
+ if (offset >= chunk_start && offset < chunk_end) {
149
+ start_chunk = chunk;
150
+ break;
151
+ }
152
+ chunk_start = chunk_end;
153
+ }
154
+ if (offset + length <= chunk_start + start_chunk.byteLength) return start_chunk.subarray(offset - chunk_start, offset + length - chunk_start);
155
+ const chunks = [start_chunk.subarray(offset - chunk_start)];
156
+ let cursor = start_chunk.byteLength - offset + chunk_start;
157
+ while (cursor < length) {
158
+ chunk_index++;
159
+ let chunk = await get_chunk(chunk_index);
160
+ if (!chunk) return null;
161
+ if (chunk.byteLength > length - cursor) chunk = chunk.subarray(0, length - cursor);
162
+ chunks.push(chunk);
163
+ cursor += chunk.byteLength;
164
+ }
165
+ const buffer = new Uint8Array(length);
166
+ cursor = 0;
167
+ for (const chunk of chunks) {
168
+ buffer.set(chunk, cursor);
169
+ cursor += chunk.byteLength;
170
+ }
171
+ return buffer;
172
+ }
173
+ const header = await get_buffer(0, HEADER_BYTES);
174
+ if (!header) throw deserialize_error("too short");
175
+ if (header[0] !== BINARY_FORM_VERSION) throw deserialize_error(`got version ${header[0]}, expected version ${BINARY_FORM_VERSION}`);
176
+ const header_view = new DataView(header.buffer, header.byteOffset, header.byteLength);
177
+ const data_length = header_view.getUint32(1, true);
178
+ const file_offsets_length = header_view.getUint16(5, true);
179
+ const data_buffer = await get_buffer(HEADER_BYTES, data_length);
180
+ if (!data_buffer) throw deserialize_error("data too short");
181
+ /** @type {Array<number | undefined>} */
182
+ let file_offsets;
183
+ /** @type {number} */
184
+ let files_start_offset;
185
+ if (file_offsets_length > 0) {
186
+ const file_offsets_buffer = await get_buffer(HEADER_BYTES + data_length, file_offsets_length);
187
+ if (!file_offsets_buffer) throw deserialize_error("file offset table too short");
188
+ const parsed_offsets = JSON.parse(decoder.decode(file_offsets_buffer));
189
+ if (!Array.isArray(parsed_offsets) || parsed_offsets.some((n) => typeof n !== "number" || !Number.isInteger(n) || n < 0)) throw deserialize_error("invalid file offset table");
190
+ file_offsets = parsed_offsets;
191
+ files_start_offset = HEADER_BYTES + data_length + file_offsets_length;
192
+ }
193
+ /** @type {Array<{ offset: number, size: number }>} */
194
+ const file_spans = [];
195
+ const [data, meta] = parse(decoder.decode(data_buffer), { File: ([name, type, size, last_modified, index]) => {
196
+ if (typeof name !== "string" || typeof type !== "string" || typeof size !== "number" || typeof last_modified !== "number" || typeof index !== "number") throw deserialize_error("invalid file metadata");
197
+ let offset = file_offsets[index];
198
+ if (offset === void 0) throw deserialize_error("duplicate file offset table index");
199
+ file_offsets[index] = void 0;
200
+ offset += files_start_offset;
201
+ file_spans.push({
202
+ offset,
203
+ size
204
+ });
205
+ return new Proxy(new LazyFile(name, type, size, last_modified, get_chunk, offset), { getPrototypeOf() {
206
+ return File.prototype;
207
+ } });
208
+ } });
209
+ file_spans.sort((a, b) => a.offset - b.offset || a.size - b.size);
210
+ for (let i = 1; i < file_spans.length; i++) {
211
+ const previous = file_spans[i - 1];
212
+ const current = file_spans[i];
213
+ const previous_end = previous.offset + previous.size;
214
+ if (previous_end < current.offset) throw deserialize_error("gaps in file data");
215
+ if (previous_end > current.offset) throw deserialize_error("overlapping file data");
216
+ }
217
+ (async () => {
218
+ let has_more = true;
219
+ while (has_more) has_more = !!await get_chunk(chunks.length);
220
+ })();
221
+ return {
222
+ data,
223
+ meta,
224
+ form_data: null
225
+ };
226
+ }
227
+ /**
228
+ * @param {string} message
229
+ */
230
+ function deserialize_error(message) {
231
+ return new SvelteKitError(400, "Bad Request", `Could not deserialize binary form: ${message}`);
232
+ }
233
+ /** @implements {File} */
234
+ var LazyFile = class LazyFile {
235
+ /** @type {(index: number) => Promise<Uint8Array<ArrayBuffer> | undefined>} */
236
+ #get_chunk;
237
+ /** @type {number} */
238
+ #offset;
239
+ /**
240
+ * @param {string} name
241
+ * @param {string} type
242
+ * @param {number} size
243
+ * @param {number} last_modified
244
+ * @param {(index: number) => Promise<Uint8Array<ArrayBuffer> | undefined>} get_chunk
245
+ * @param {number} offset
246
+ */
247
+ constructor(name, type, size, last_modified, get_chunk, offset) {
248
+ this.name = name;
249
+ this.type = type;
250
+ this.size = size;
251
+ this.lastModified = last_modified;
252
+ this.webkitRelativePath = "";
253
+ this.#get_chunk = get_chunk;
254
+ this.#offset = offset;
255
+ this.arrayBuffer = this.arrayBuffer.bind(this);
256
+ this.bytes = this.bytes.bind(this);
257
+ this.slice = this.slice.bind(this);
258
+ this.stream = this.stream.bind(this);
259
+ this.text = this.text.bind(this);
260
+ }
261
+ /** @type {ArrayBuffer | undefined} */
262
+ #buffer;
263
+ async arrayBuffer() {
264
+ this.#buffer ??= await new Response(this.stream()).arrayBuffer();
265
+ return this.#buffer;
266
+ }
267
+ async bytes() {
268
+ return new Uint8Array(await this.arrayBuffer());
269
+ }
270
+ /**
271
+ * @param {number=} start
272
+ * @param {number=} end
273
+ * @param {string=} contentType
274
+ */
275
+ slice(start = 0, end = this.size, contentType = this.type) {
276
+ if (start < 0) start = Math.max(this.size + start, 0);
277
+ else start = Math.min(start, this.size);
278
+ if (end < 0) end = Math.max(this.size + end, 0);
279
+ else end = Math.min(end, this.size);
280
+ const size = Math.max(end - start, 0);
281
+ return new LazyFile(this.name, contentType, size, this.lastModified, this.#get_chunk, this.#offset + start);
282
+ }
283
+ stream() {
284
+ let cursor = 0;
285
+ let chunk_index = 0;
286
+ return new ReadableStream({
287
+ start: async (controller) => {
288
+ let chunk_start = 0;
289
+ /** @type {Uint8Array} */
290
+ let start_chunk;
291
+ for (chunk_index = 0;; chunk_index++) {
292
+ const chunk = await this.#get_chunk(chunk_index);
293
+ if (!chunk) return null;
294
+ const chunk_end = chunk_start + chunk.byteLength;
295
+ if (this.#offset >= chunk_start && this.#offset < chunk_end) {
296
+ start_chunk = chunk;
297
+ break;
298
+ }
299
+ chunk_start = chunk_end;
300
+ }
301
+ if (this.#offset + this.size <= chunk_start + start_chunk.byteLength) {
302
+ controller.enqueue(start_chunk.subarray(this.#offset - chunk_start, this.#offset + this.size - chunk_start));
303
+ controller.close();
304
+ } else {
305
+ controller.enqueue(start_chunk.subarray(this.#offset - chunk_start));
306
+ cursor = start_chunk.byteLength - this.#offset + chunk_start;
307
+ }
308
+ },
309
+ pull: async (controller) => {
310
+ chunk_index++;
311
+ let chunk = await this.#get_chunk(chunk_index);
312
+ if (!chunk) {
313
+ controller.error("incomplete file data");
314
+ controller.close();
315
+ return;
316
+ }
317
+ if (chunk.byteLength > this.size - cursor) chunk = chunk.subarray(0, this.size - cursor);
318
+ controller.enqueue(chunk);
319
+ cursor += chunk.byteLength;
320
+ if (cursor >= this.size) controller.close();
321
+ }
322
+ });
323
+ }
324
+ async text() {
325
+ return decoder.decode(await this.arrayBuffer());
326
+ }
327
+ };
328
+ var path_regex = /^[a-zA-Z_$]\w*(\.[a-zA-Z_$]\w*|\[\d+\])*$/;
329
+ /**
330
+ * @param {string} path
331
+ */
332
+ function split_path(path) {
333
+ if (!path_regex.test(path)) throw new Error(`Invalid path ${path}`);
334
+ return path.split(/\.|\[|\]/).filter(Boolean);
335
+ }
336
+ /**
337
+ * Check if a property key is dangerous and could lead to prototype pollution
338
+ * @param {string} key
339
+ */
340
+ function check_prototype_pollution(key) {
341
+ if (key === "__proto__" || key === "constructor" || key === "prototype") throw new Error(`Invalid key "${key}"`);
342
+ }
343
+ /**
344
+ * Sets a value in a nested object using an array of keys, mutating the original object.
345
+ * @param {Record<string, any>} object
346
+ * @param {string[]} keys
347
+ * @param {any} value
348
+ */
349
+ function deep_set(object, keys, value) {
350
+ let current = object;
351
+ for (let i = 0; i < keys.length - 1; i += 1) {
352
+ const key = keys[i];
353
+ check_prototype_pollution(key);
354
+ const is_array = /^\d+$/.test(keys[i + 1]);
355
+ const inner = Object.hasOwn(current, key) ? current[key] : void 0;
356
+ const exists = inner != null;
357
+ if (exists && is_array !== Array.isArray(inner)) throw new Error(`Invalid array key ${keys[i + 1]}`);
358
+ if (!exists) current[key] = is_array ? [] : {};
359
+ current = current[key];
360
+ }
361
+ const final_key = keys[keys.length - 1];
362
+ check_prototype_pollution(final_key);
363
+ current[final_key] = value;
364
+ }
365
+ //#endregion
366
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/utils/http.js
367
+ /**
368
+ * Given an Accept header and a list of possible content types, pick
369
+ * the most suitable one to respond with
370
+ * @param {string} accept
371
+ * @param {string[]} types
372
+ */
373
+ function negotiate(accept, types) {
374
+ /** @type {Array<{ type: string, subtype: string, q: number, i: number }>} */
375
+ const parts = [];
376
+ accept.split(",").forEach((str, i) => {
377
+ const match = /([^/ \t]+)\/([^; \t]+)[ \t]*(?:;[ \t]*q=([0-9.]+))?/.exec(str);
378
+ if (match) {
379
+ const [, type, subtype, q = "1"] = match;
380
+ parts.push({
381
+ type,
382
+ subtype,
383
+ q: +q,
384
+ i
385
+ });
386
+ }
387
+ });
388
+ parts.sort((a, b) => {
389
+ if (a.q !== b.q) return b.q - a.q;
390
+ if (a.subtype === "*" !== (b.subtype === "*")) return a.subtype === "*" ? 1 : -1;
391
+ if (a.type === "*" !== (b.type === "*")) return a.type === "*" ? 1 : -1;
392
+ return a.i - b.i;
393
+ });
394
+ let accepted;
395
+ let min_priority = Infinity;
396
+ for (const mimetype of types) {
397
+ const [type, subtype] = mimetype.split("/");
398
+ const priority = parts.findIndex((part) => (part.type === type || part.type === "*") && (part.subtype === subtype || part.subtype === "*"));
399
+ if (priority !== -1 && priority < min_priority) {
400
+ accepted = mimetype;
401
+ min_priority = priority;
402
+ }
403
+ }
404
+ return accepted;
405
+ }
406
+ /**
407
+ * Returns `true` if the request contains a `content-type` header with the given type
408
+ * @param {Request} request
409
+ * @param {...string} types
410
+ */
411
+ function is_content_type(request, ...types) {
412
+ const type = request.headers.get("content-type")?.split(";", 1)[0].trim() ?? "";
413
+ return types.includes(type.toLowerCase());
414
+ }
415
+ /**
416
+ * @param {Request} request
417
+ */
418
+ function is_form_content_type(request) {
419
+ return is_content_type(request, "application/x-www-form-urlencoded", "multipart/form-data", "text/plain", BINARY_FORM_CONTENT_TYPE);
420
+ }
421
+ //#endregion
422
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/utils/misc.js
423
+ var s = JSON.stringify;
424
+ //#endregion
425
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/utils/escape.js
426
+ /**
427
+ * When inside a double-quoted attribute value, only `&` and `"` hold special meaning.
428
+ * @see https://html.spec.whatwg.org/multipage/parsing.html#attribute-value-(double-quoted)-state
429
+ * @type {Record<string, string>}
430
+ */
431
+ var escape_html_attr_dict = {
432
+ "&": "&amp;",
433
+ "\"": "&quot;"
434
+ };
435
+ /**
436
+ * @type {Record<string, string>}
437
+ */
438
+ var escape_html_dict = {
439
+ "&": "&amp;",
440
+ "<": "&lt;"
441
+ };
442
+ var escape_html_attr_regex = new RegExp(`[${Object.keys(escape_html_attr_dict).join("")}]|[\\ud800-\\udbff](?![\\udc00-\\udfff])|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\udc00-\\udfff]`, "g");
443
+ var escape_html_regex = new RegExp(`[${Object.keys(escape_html_dict).join("")}]|[\\ud800-\\udbff](?![\\udc00-\\udfff])|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\udc00-\\udfff]`, "g");
444
+ /**
445
+ * Escapes unpaired surrogates (which are allowed in js strings but invalid in HTML) and
446
+ * escapes characters that are special.
447
+ *
448
+ * @param {string} str
449
+ * @param {boolean} [is_attr]
450
+ * @returns {string} escaped string
451
+ * @example const html = `<tag data-value="${escape_html('value', true)}">...</tag>`;
452
+ */
453
+ function escape_html(str, is_attr) {
454
+ const dict = is_attr ? escape_html_attr_dict : escape_html_dict;
455
+ return str.replace(is_attr ? escape_html_attr_regex : escape_html_regex, (match) => {
456
+ if (match.length === 2) return match;
457
+ return dict[match] ?? `&#${match.charCodeAt(0)};`;
458
+ });
459
+ }
460
+ //#endregion
461
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/runtime/server/utils.js
462
+ /** @import { ServerHooks } from 'types' */
463
+ /**
464
+ * @param {Partial<Record<import('types').HttpMethod, any>>} mod
465
+ * @param {import('types').HttpMethod} method
466
+ */
467
+ function method_not_allowed(mod, method) {
468
+ return text(`${method} method not allowed`, {
469
+ status: 405,
470
+ headers: { allow: allowed_methods(mod).join(", ") }
471
+ });
472
+ }
473
+ /** @param {Partial<Record<import('types').HttpMethod, any>>} mod */
474
+ function allowed_methods(mod) {
475
+ const allowed = ENDPOINT_METHODS.filter((method) => method in mod);
476
+ if ("GET" in mod && !("HEAD" in mod)) allowed.push("HEAD");
477
+ return allowed;
478
+ }
479
+ /**
480
+ * @param {import('types').SSROptions} options
481
+ */
482
+ function get_global_name(options) {
483
+ return `__sveltekit_${options.version_hash}`;
484
+ }
485
+ /**
486
+ * Return as a response that renders the error.html
487
+ *
488
+ * @param {import('types').SSROptions} options
489
+ * @param {number} status
490
+ * @param {string} message
491
+ */
492
+ function static_error_page(options, status, message) {
493
+ return text(options.templates.error({
494
+ status,
495
+ message: escape_html(message)
496
+ }), {
497
+ headers: { "content-type": "text/html; charset=utf-8" },
498
+ status
499
+ });
500
+ }
501
+ /**
502
+ * @param {import('@sveltejs/kit').RequestEvent} event
503
+ * @param {import('types').RequestState} state
504
+ * @param {import('types').SSROptions} options
505
+ * @param {unknown} error
506
+ */
507
+ async function handle_fatal_error(event, state, options, error) {
508
+ error = error instanceof HttpError ? error : coalesce_to_error(error);
509
+ const status = get_status(error);
510
+ const body = await handle_error_and_jsonify(event, state, options, error);
511
+ const type = negotiate(event.request.headers.get("accept") || "text/html", ["application/json", "text/html"]);
512
+ if (event.isDataRequest || type === "application/json") return json(body, { status });
513
+ return static_error_page(options, status, body.message);
514
+ }
515
+ /**
516
+ * @param {import('@sveltejs/kit').RequestEvent} event
517
+ * @param {import('types').RequestState} state
518
+ * @param {import('types').SSROptions} options
519
+ * @param {any} error
520
+ * @returns {Promise<App.Error>}
521
+ */
522
+ async function handle_error_and_jsonify(event, state, options, error) {
523
+ if (error instanceof HttpError) return {
524
+ message: "Unknown Error",
525
+ ...error.body
526
+ };
527
+ const status = get_status(error);
528
+ const message = get_message(error);
529
+ return await with_request_store({
530
+ event,
531
+ state
532
+ }, () => options.hooks.handleError({
533
+ error,
534
+ event,
535
+ status,
536
+ message
537
+ })) ?? { message };
538
+ }
539
+ /**
540
+ * @param {number} status
541
+ * @param {string} location
542
+ */
543
+ function redirect_response(status, location) {
544
+ return new Response(void 0, {
545
+ status,
546
+ headers: { location }
547
+ });
548
+ }
549
+ /**
550
+ * @param {import('@sveltejs/kit').RequestEvent} event
551
+ * @param {Error & { path: string }} error
552
+ */
553
+ function clarify_devalue_error(event, error) {
554
+ if (error.path) return `Data returned from \`load\` while rendering ${event.route.id} is not serializable: ${error.message} (${error.path}). If you need to serialize/deserialize custom types, use transport hooks: https://svelte.dev/docs/kit/hooks#Universal-hooks-transport.`;
555
+ if (error.path === "") return `Data returned from \`load\` while rendering ${event.route.id} is not a plain object`;
556
+ return error.message;
557
+ }
558
+ /**
559
+ * @param {import('types').ServerDataNode} node
560
+ */
561
+ function serialize_uses(node) {
562
+ const uses = {};
563
+ if (node.uses && node.uses.dependencies.size > 0) uses.dependencies = Array.from(node.uses.dependencies);
564
+ if (node.uses && node.uses.search_params.size > 0) uses.search_params = Array.from(node.uses.search_params);
565
+ if (node.uses && node.uses.params.size > 0) uses.params = Array.from(node.uses.params);
566
+ if (node.uses?.parent) uses.parent = 1;
567
+ if (node.uses?.route) uses.route = 1;
568
+ if (node.uses?.url) uses.url = 1;
569
+ return uses;
570
+ }
571
+ /**
572
+ * Returns `true` if the given path was prerendered
573
+ * @param {import('@sveltejs/kit').SSRManifest} manifest
574
+ * @param {string} pathname Should include the base and be decoded
575
+ */
576
+ function has_prerendered_path(manifest, pathname) {
577
+ return manifest._.prerendered_routes.has(pathname) || pathname.at(-1) === "/" && manifest._.prerendered_routes.has(pathname.slice(0, -1));
578
+ }
579
+ /**
580
+ * Formats the error into a nice message with sanitized stack trace
581
+ * @param {number} status
582
+ * @param {Error} error
583
+ * @param {import('@sveltejs/kit').RequestEvent} event
584
+ */
585
+ function format_server_error(status, error, event) {
586
+ const formatted_text = `\n\x1b[1;31m[${status}] ${event.request.method} ${event.url.pathname}\x1b[0m`;
587
+ if (status === 404) return formatted_text;
588
+ return `${formatted_text}\n${error.stack}`;
589
+ }
590
+ /**
591
+ * Returns the filename without the extension. e.g., `+page.server`, `+page`, etc.
592
+ * @param {string | undefined} node_id
593
+ * @returns {string}
594
+ */
595
+ function get_node_type(node_id) {
596
+ const filename = (node_id?.split("/"))?.at(-1);
597
+ if (!filename) return "unknown";
598
+ return filename.split(".").slice(0, -1).join(".");
599
+ }
600
+ /**
601
+ * Creates a serialiser for non-arbitrary POJOs using the app's transport hook
602
+ * @param {ServerHooks['transport']} transport
603
+ * @returns {(thing: unknown) => string | undefined}
604
+ */
605
+ function create_replacer(transport) {
606
+ /** @param {unknown} thing */
607
+ const replacer = (thing) => {
608
+ for (const key in transport) {
609
+ const encoded = transport[key].encode(thing);
610
+ if (encoded) return `app.decode('${key}', ${uneval(encoded, replacer)})`;
611
+ }
612
+ };
613
+ return replacer;
614
+ }
615
+
616
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/utils/promise.js
617
+ /** @see https://github.com/microsoft/TypeScript/blob/904e7dd97dc8da1352c8e05d70829dff17c73214/src/lib/es2024.promise.d.ts */
618
+ /**
619
+ * @template T
620
+ * @typedef {{
621
+ * promise: Promise<T>;
622
+ * resolve: (value: T | PromiseLike<T>) => void;
623
+ * reject: (reason?: any) => void;
624
+ * }} PromiseWithResolvers<T>
625
+ */
626
+ /**
627
+ * TODO: Whenever Node >21 is minimum supported version, we can use `Promise.withResolvers` to avoid this ceremony
628
+ *
629
+ * @template T
630
+ * @returns {PromiseWithResolvers<T>}
631
+ */
632
+ function with_resolvers() {
633
+ let resolve;
634
+ let reject;
635
+ return {
636
+ promise: new Promise((res, rej) => {
637
+ resolve = res;
638
+ reject = rej;
639
+ }),
640
+ resolve,
641
+ reject
642
+ };
643
+ }
644
+ //#endregion
645
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/runtime/server/endpoint.js
646
+ /**
647
+ * @param {import('@sveltejs/kit').RequestEvent} event
648
+ * @param {import('types').RequestState} event_state
649
+ * @param {import('types').SSREndpoint} mod
650
+ * @param {import('types').SSRState} state
651
+ * @returns {Promise<Response>}
652
+ */
653
+ async function render_endpoint(event, event_state, mod, state) {
654
+ const method = event.request.method;
655
+ let handler = mod[method] || mod.fallback;
656
+ if (method === "HEAD" && !mod.HEAD && mod.GET) handler = mod.GET;
657
+ if (!handler) return method_not_allowed(mod, method);
658
+ const prerender = mod.prerender ?? state.prerender_default;
659
+ if (prerender && (mod.POST || mod.PATCH || mod.PUT || mod.DELETE)) throw new Error("Cannot prerender endpoints that have mutative methods");
660
+ if (state.prerendering && !state.prerendering.inside_reroute && !prerender) if (state.depth > 0) throw new Error(`${event.route.id} is not prerenderable`);
661
+ else return new Response(void 0, { status: 204 });
662
+ try {
663
+ const response = await with_request_store({
664
+ event,
665
+ state: event_state
666
+ }, () => handler(event));
667
+ if (!(response instanceof Response)) throw new Error(`Invalid response from route ${event.url.pathname}: handler should return a Response object`);
668
+ if (state.prerendering && (!state.prerendering.inside_reroute || prerender)) {
669
+ const cloned = new Response(response.clone().body, {
670
+ status: response.status,
671
+ statusText: response.statusText,
672
+ headers: new Headers(response.headers)
673
+ });
674
+ cloned.headers.set("x-sveltekit-prerender", String(prerender));
675
+ if (state.prerendering.inside_reroute && prerender) {
676
+ cloned.headers.set("x-sveltekit-routeid", encodeURI(event.route.id));
677
+ state.prerendering.dependencies.set(event.url.pathname, {
678
+ response: cloned,
679
+ body: null
680
+ });
681
+ } else return cloned;
682
+ }
683
+ return response;
684
+ } catch (e) {
685
+ if (e instanceof Redirect) return new Response(void 0, {
686
+ status: e.status,
687
+ headers: { location: e.location }
688
+ });
689
+ throw e;
690
+ }
691
+ }
692
+ /**
693
+ * @param {import('@sveltejs/kit').RequestEvent} event
694
+ */
695
+ function is_endpoint_request(event) {
696
+ const { method, headers } = event.request;
697
+ if (ENDPOINT_METHODS.includes(method) && !PAGE_METHODS.includes(method)) return true;
698
+ if (method === "POST" && headers.get("x-sveltekit-action") === "true") return false;
699
+ return negotiate(event.request.headers.get("accept") ?? "*/*", ["*", "text/html"]) !== "text/html";
700
+ }
701
+ //#endregion
702
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/runtime/telemetry/record_span.js
703
+ /** @import { RecordSpan } from 'types' */
704
+ /** @type {RecordSpan} */
705
+ async function record_span({ name, attributes, fn }) {
706
+ return fn(noop_span);
707
+ }
708
+ //#endregion
709
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/runtime/server/page/actions.js
710
+ /** @import { RequestEvent, ActionResult, Actions } from '@sveltejs/kit' */
711
+ /** @import { SSROptions, SSRNode, ServerNode, ServerHooks } from 'types' */
712
+ /** @param {RequestEvent} event */
713
+ function is_action_json_request(event) {
714
+ return negotiate(event.request.headers.get("accept") ?? "*/*", ["application/json", "text/html"]) === "application/json" && event.request.method === "POST";
715
+ }
716
+ /**
717
+ * @param {RequestEvent} event
718
+ * @param {import('types').RequestState} event_state
719
+ * @param {SSROptions} options
720
+ * @param {SSRNode['server'] | undefined} server
721
+ */
722
+ async function handle_action_json_request(event, event_state, options, server) {
723
+ const actions = server?.actions;
724
+ if (!actions) {
725
+ const no_actions_error = new SvelteKitError(405, "Method Not Allowed", `POST method not allowed. No form actions exist for this page`);
726
+ return action_json({
727
+ type: "error",
728
+ error: await handle_error_and_jsonify(event, event_state, options, no_actions_error)
729
+ }, {
730
+ status: no_actions_error.status,
731
+ headers: { allow: "GET" }
732
+ });
733
+ }
734
+ check_named_default_separate(actions);
735
+ try {
736
+ const data = await call_action(event, event_state, actions);
737
+ if (data instanceof ActionFailure) return action_json({
738
+ type: "failure",
739
+ status: data.status,
740
+ data: stringify_action_response(data.data, event.route.id, options.hooks.transport)
741
+ });
742
+ else return action_json({
743
+ type: "success",
744
+ status: data ? 200 : 204,
745
+ data: stringify_action_response(data, event.route.id, options.hooks.transport)
746
+ });
747
+ } catch (e) {
748
+ const err = normalize_error(e);
749
+ if (err instanceof Redirect) return action_json_redirect(err);
750
+ return action_json({
751
+ type: "error",
752
+ error: await handle_error_and_jsonify(event, event_state, options, check_incorrect_fail_use(err))
753
+ }, { status: get_status(err) });
754
+ }
755
+ }
756
+ /**
757
+ * @param {HttpError | Error} error
758
+ */
759
+ function check_incorrect_fail_use(error) {
760
+ return error instanceof ActionFailure ? /* @__PURE__ */ new Error("Cannot \"throw fail()\". Use \"return fail()\"") : error;
761
+ }
762
+ /**
763
+ * @param {Redirect} redirect
764
+ */
765
+ function action_json_redirect(redirect) {
766
+ return action_json({
767
+ type: "redirect",
768
+ status: redirect.status,
769
+ location: redirect.location
770
+ });
771
+ }
772
+ /**
773
+ * @param {ActionResult} data
774
+ * @param {ResponseInit} [init]
775
+ */
776
+ function action_json(data, init) {
777
+ return json(data, init);
778
+ }
779
+ /**
780
+ * @param {RequestEvent} event
781
+ */
782
+ function is_action_request(event) {
783
+ return event.request.method === "POST";
784
+ }
785
+ /**
786
+ * @param {RequestEvent} event
787
+ * @param {import('types').RequestState} event_state
788
+ * @param {SSRNode['server'] | undefined} server
789
+ * @returns {Promise<ActionResult>}
790
+ */
791
+ async function handle_action_request(event, event_state, server) {
792
+ const actions = server?.actions;
793
+ if (!actions) {
794
+ event.setHeaders({ allow: "GET" });
795
+ return {
796
+ type: "error",
797
+ error: new SvelteKitError(405, "Method Not Allowed", `POST method not allowed. No form actions exist for this page`)
798
+ };
799
+ }
800
+ check_named_default_separate(actions);
801
+ try {
802
+ const data = await call_action(event, event_state, actions);
803
+ if (data instanceof ActionFailure) return {
804
+ type: "failure",
805
+ status: data.status,
806
+ data: data.data
807
+ };
808
+ else return {
809
+ type: "success",
810
+ status: 200,
811
+ data
812
+ };
813
+ } catch (e) {
814
+ const err = normalize_error(e);
815
+ if (err instanceof Redirect) return {
816
+ type: "redirect",
817
+ status: err.status,
818
+ location: err.location
819
+ };
820
+ return {
821
+ type: "error",
822
+ error: check_incorrect_fail_use(err)
823
+ };
824
+ }
825
+ }
826
+ /**
827
+ * @param {Actions} actions
828
+ */
829
+ function check_named_default_separate(actions) {
830
+ if (actions.default && Object.keys(actions).length > 1) throw new Error("When using named actions, the default action cannot be used. See the docs for more info: https://svelte.dev/docs/kit/form-actions#named-actions");
831
+ }
832
+ /**
833
+ * @param {RequestEvent} event
834
+ * @param {import('types').RequestState} event_state
835
+ * @param {NonNullable<ServerNode['actions']>} actions
836
+ * @throws {Redirect | HttpError | SvelteKitError | Error}
837
+ */
838
+ async function call_action(event, event_state, actions) {
839
+ const url = new URL(event.request.url);
840
+ let name = "default";
841
+ for (const param of url.searchParams) if (param[0].startsWith("/")) {
842
+ name = param[0].slice(1);
843
+ if (name === "default") throw new Error("Cannot use reserved action name \"default\"");
844
+ break;
845
+ }
846
+ const action = actions[name];
847
+ if (!action) throw new SvelteKitError(404, "Not Found", `No action with name '${name}' found`);
848
+ if (!is_form_content_type(event.request)) throw new SvelteKitError(415, "Unsupported Media Type", `Form actions expect form-encoded data — received ${event.request.headers.get("content-type")}`);
849
+ return record_span({
850
+ name: "sveltekit.form_action",
851
+ attributes: {
852
+ "http.route": event.route.id || "unknown"
853
+ },
854
+ fn: async (current) => {
855
+ const traced_event = merge_tracing(event, current);
856
+ const result = await with_request_store({
857
+ event: traced_event,
858
+ state: event_state
859
+ }, () => action(traced_event));
860
+ if (result instanceof ActionFailure) current.setAttributes({
861
+ "sveltekit.form_action.result.type": "failure",
862
+ "sveltekit.form_action.result.status": result.status
863
+ });
864
+ return result;
865
+ }
866
+ });
867
+ }
868
+ /**
869
+ * Try to `devalue.uneval` the data object, and if it fails, return a proper Error with context
870
+ * @param {any} data
871
+ * @param {string} route_id
872
+ * @param {ServerHooks['transport']} transport
873
+ */
874
+ function uneval_action_response(data, route_id, transport) {
875
+ const replacer = create_replacer(transport);
876
+ return try_serialize(data, (value) => uneval(value, replacer), route_id);
877
+ }
878
+ /**
879
+ * Try to `devalue.stringify` the data object, and if it fails, return a proper Error with context
880
+ * @param {any} data
881
+ * @param {string} route_id
882
+ * @param {ServerHooks['transport']} transport
883
+ */
884
+ function stringify_action_response(data, route_id, transport) {
885
+ const encoders = Object.fromEntries(Object.entries(transport).map(([key, value]) => [key, value.encode]));
886
+ return try_serialize(data, (value) => stringify$1(value, encoders), route_id);
887
+ }
888
+ /**
889
+ * @param {any} data
890
+ * @param {(data: any) => string} fn
891
+ * @param {string} route_id
892
+ */
893
+ function try_serialize(data, fn, route_id) {
894
+ try {
895
+ return fn(data);
896
+ } catch (e) {
897
+ const error = e;
898
+ if (data instanceof Response) throw new Error(`Data returned from action inside ${route_id} is not serializable. Form actions need to return plain objects or fail(). E.g. return { success: true } or return fail(400, { message: "invalid" });`, { cause: e });
899
+ if ("path" in error) {
900
+ let message = `Data returned from action inside ${route_id} is not serializable: ${error.message}`;
901
+ if (error.path !== "") message += ` (data.${error.path})`;
902
+ throw new Error(message, { cause: e });
903
+ }
904
+ throw error;
905
+ }
906
+ }
907
+ //#endregion
908
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/utils/streaming.js
909
+ /**
910
+ * Create an async iterator and a function to push values into it
911
+ * @template T
912
+ * @returns {{
913
+ * iterate: (transform?: (input: T) => T) => AsyncIterable<T>;
914
+ * add: (promise: Promise<T>) => void;
915
+ * }}
916
+ */
917
+ function create_async_iterator() {
918
+ let resolved = -1;
919
+ let returned = -1;
920
+ /** @type {import('./promise.js').PromiseWithResolvers<T>[]} */
921
+ const deferred = [];
922
+ return {
923
+ iterate: (transform = (x) => x) => {
924
+ return { [Symbol.asyncIterator]() {
925
+ return { next: async () => {
926
+ const next = deferred[++returned];
927
+ if (!next) return {
928
+ value: null,
929
+ done: true
930
+ };
931
+ return {
932
+ value: transform(await next.promise),
933
+ done: false
934
+ };
935
+ } };
936
+ } };
937
+ },
938
+ add: (promise) => {
939
+ deferred.push(with_resolvers());
940
+ promise.then((value) => {
941
+ deferred[++resolved].resolve(value);
942
+ });
943
+ }
944
+ };
945
+ }
946
+ //#endregion
947
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/runtime/server/page/data_serializer.js
948
+ /**
949
+ * If the serialized data contains promises, `chunks` will be an
950
+ * async iterable containing their resolutions
951
+ * @param {import('@sveltejs/kit').RequestEvent} event
952
+ * @param {import('types').RequestState} event_state
953
+ * @param {import('types').SSROptions} options
954
+ * @returns {import('./types.js').ServerDataSerializer}
955
+ */
956
+ function server_data_serializer(event, event_state, options) {
957
+ let promise_id = 1;
958
+ let max_nodes = -1;
959
+ const iterator = create_async_iterator();
960
+ const global = get_global_name(options);
961
+ /** @param {number} index */
962
+ function get_replacer(index) {
963
+ /** @param {any} thing */
964
+ return function replacer(thing) {
965
+ if (typeof thing?.then === "function") {
966
+ const id = promise_id++;
967
+ const promise = thing.then(
968
+ /** @param {any} data */
969
+ (data) => ({ data })
970
+ ).catch(
971
+ /** @param {any} error */
972
+ async (error) => ({ error: await handle_error_and_jsonify(event, event_state, options, error) })
973
+ ).then(
974
+ /**
975
+ * @param {{data: any; error: any}} result
976
+ */
977
+ async ({ data, error }) => {
978
+ let str;
979
+ try {
980
+ str = uneval(error ? [, error] : [data], replacer);
981
+ } catch {
982
+ error = await handle_error_and_jsonify(event, event_state, options, /* @__PURE__ */ new Error(`Failed to serialize promise while rendering ${event.route.id}`));
983
+ str = uneval([, error], replacer);
984
+ }
985
+ return {
986
+ index,
987
+ str: `${global}.resolve(${id}, ${str.includes("app.decode") ? `(app) => ${str}` : `() => ${str}`})`
988
+ };
989
+ }
990
+ );
991
+ iterator.add(promise);
992
+ return `${global}.defer(${id})`;
993
+ } else for (const key in options.hooks.transport) {
994
+ const encoded = options.hooks.transport[key].encode(thing);
995
+ if (encoded) return `app.decode('${key}', ${uneval(encoded, replacer)})`;
996
+ }
997
+ };
998
+ }
999
+ const strings = [];
1000
+ return {
1001
+ set_max_nodes(i) {
1002
+ max_nodes = i;
1003
+ },
1004
+ add_node(i, node) {
1005
+ try {
1006
+ if (!node) {
1007
+ strings[i] = "null";
1008
+ return;
1009
+ }
1010
+ /** @type {any} */
1011
+ const payload = {
1012
+ type: "data",
1013
+ data: node.data,
1014
+ uses: serialize_uses(node)
1015
+ };
1016
+ if (node.slash) payload.slash = node.slash;
1017
+ strings[i] = uneval(payload, get_replacer(i));
1018
+ } catch (e) {
1019
+ e.path = e.path.slice(1);
1020
+ throw new Error(clarify_devalue_error(event, e), { cause: e });
1021
+ }
1022
+ },
1023
+ get_data(csp) {
1024
+ const open = `<script${csp.script_needs_nonce ? ` nonce="${csp.nonce}"` : ""}>`;
1025
+ const close = `<\/script>\n`;
1026
+ return {
1027
+ data: `[${compact(max_nodes > -1 ? strings.slice(0, max_nodes) : strings).join(",")}]`,
1028
+ chunks: promise_id > 1 ? iterator.iterate(({ index, str }) => {
1029
+ if (max_nodes > -1 && index >= max_nodes) return "";
1030
+ return open + str + close;
1031
+ }) : null
1032
+ };
1033
+ }
1034
+ };
1035
+ }
1036
+ /**
1037
+ * If the serialized data contains promises, `chunks` will be an
1038
+ * async iterable containing their resolutions
1039
+ * @param {import('@sveltejs/kit').RequestEvent} event
1040
+ * @param {import('types').RequestState} event_state
1041
+ * @param {import('types').SSROptions} options
1042
+ * @returns {import('./types.js').ServerDataSerializerJson}
1043
+ */
1044
+ function server_data_serializer_json(event, event_state, options) {
1045
+ let promise_id = 1;
1046
+ const iterator = create_async_iterator();
1047
+ const reducers = {
1048
+ ...Object.fromEntries(Object.entries(options.hooks.transport).map(([key, value]) => [key, value.encode])),
1049
+ /** @param {any} thing */
1050
+ Promise: (thing) => {
1051
+ if (typeof thing?.then !== "function") return;
1052
+ const id = promise_id++;
1053
+ /** @type {'data' | 'error'} */
1054
+ let key = "data";
1055
+ const promise = thing.catch(
1056
+ /** @param {any} e */
1057
+ async (e) => {
1058
+ key = "error";
1059
+ return handle_error_and_jsonify(event, event_state, options, e);
1060
+ }
1061
+ ).then(
1062
+ /** @param {any} value */
1063
+ async (value) => {
1064
+ let str;
1065
+ try {
1066
+ str = stringify$1(value, reducers);
1067
+ } catch {
1068
+ const error = await handle_error_and_jsonify(event, event_state, options, /* @__PURE__ */ new Error(`Failed to serialize promise while rendering ${event.route.id}`));
1069
+ key = "error";
1070
+ str = stringify$1(error, reducers);
1071
+ }
1072
+ return `{"type":"chunk","id":${id},"${key}":${str}}\n`;
1073
+ }
1074
+ );
1075
+ iterator.add(promise);
1076
+ return id;
1077
+ }
1078
+ };
1079
+ const strings = [];
1080
+ return {
1081
+ add_node(i, node) {
1082
+ try {
1083
+ if (!node) {
1084
+ strings[i] = "null";
1085
+ return;
1086
+ }
1087
+ if (node.type === "error" || node.type === "skip") {
1088
+ strings[i] = JSON.stringify(node);
1089
+ return;
1090
+ }
1091
+ strings[i] = `{"type":"data","data":${stringify$1(node.data, reducers)},"uses":${JSON.stringify(serialize_uses(node))}${node.slash ? `,"slash":${JSON.stringify(node.slash)}` : ""}}`;
1092
+ } catch (e) {
1093
+ e.path = "data" + e.path;
1094
+ throw new Error(clarify_devalue_error(event, e), { cause: e });
1095
+ }
1096
+ },
1097
+ get_data() {
1098
+ return {
1099
+ data: `{"type":"data","nodes":[${strings.join(",")}]}\n`,
1100
+ chunks: promise_id > 1 ? iterator.iterate() : null
1101
+ };
1102
+ }
1103
+ };
1104
+ }
1105
+ //#endregion
1106
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/runtime/server/page/load_data.js
1107
+ /**
1108
+ * Calls the user's server `load` function.
1109
+ * @param {{
1110
+ * event: import('@sveltejs/kit').RequestEvent;
1111
+ * event_state: import('types').RequestState;
1112
+ * state: import('types').SSRState;
1113
+ * node: import('types').SSRNode | undefined;
1114
+ * parent: () => Promise<Record<string, any>>;
1115
+ * }} opts
1116
+ * @returns {Promise<import('types').ServerDataNode | null>}
1117
+ */
1118
+ async function load_server_data({ event, event_state, state, node, parent }) {
1119
+ if (!node?.server) return null;
1120
+ let is_tracking = true;
1121
+ const uses = {
1122
+ dependencies: /* @__PURE__ */ new Set(),
1123
+ params: /* @__PURE__ */ new Set(),
1124
+ parent: false,
1125
+ route: false,
1126
+ url: false,
1127
+ search_params: /* @__PURE__ */ new Set()
1128
+ };
1129
+ const load = node.server.load;
1130
+ const slash = node.server.trailingSlash;
1131
+ if (!load) return {
1132
+ type: "data",
1133
+ data: null,
1134
+ uses,
1135
+ slash
1136
+ };
1137
+ const url = make_trackable(event.url, () => {
1138
+ if (is_tracking) uses.url = true;
1139
+ }, (param) => {
1140
+ if (is_tracking) uses.search_params.add(param);
1141
+ });
1142
+ if (state.prerendering) disable_search(url);
1143
+ return {
1144
+ type: "data",
1145
+ data: await record_span({
1146
+ name: "sveltekit.load",
1147
+ attributes: {
1148
+ "sveltekit.load.node_id": node.server_id || "unknown",
1149
+ "sveltekit.load.node_type": get_node_type(node.server_id),
1150
+ "http.route": event.route.id || "unknown"
1151
+ },
1152
+ fn: async (current) => {
1153
+ const traced_event = merge_tracing(event, current);
1154
+ return await with_request_store({
1155
+ event: traced_event,
1156
+ state: event_state
1157
+ }, () => load.call(null, {
1158
+ ...traced_event,
1159
+ fetch: (info, init) => {
1160
+ new URL(info instanceof Request ? info.url : info, event.url);
1161
+ return event.fetch(info, init);
1162
+ },
1163
+ /** @param {string[]} deps */
1164
+ depends: (...deps) => {
1165
+ for (const dep of deps) {
1166
+ const { href } = new URL(dep, event.url);
1167
+ uses.dependencies.add(href);
1168
+ }
1169
+ },
1170
+ params: new Proxy(event.params, { get: (target, key) => {
1171
+ if (is_tracking) uses.params.add(key);
1172
+ return target[key];
1173
+ } }),
1174
+ parent: async () => {
1175
+ if (is_tracking) uses.parent = true;
1176
+ return parent();
1177
+ },
1178
+ route: new Proxy(event.route, { get: (target, key) => {
1179
+ if (is_tracking) uses.route = true;
1180
+ return target[key];
1181
+ } }),
1182
+ url,
1183
+ untrack(fn) {
1184
+ is_tracking = false;
1185
+ try {
1186
+ return fn();
1187
+ } finally {
1188
+ is_tracking = true;
1189
+ }
1190
+ }
1191
+ }));
1192
+ }
1193
+ }) ?? null,
1194
+ uses,
1195
+ slash
1196
+ };
1197
+ }
1198
+ /**
1199
+ * Calls the user's `load` function.
1200
+ * @param {{
1201
+ * event: import('@sveltejs/kit').RequestEvent;
1202
+ * event_state: import('types').RequestState;
1203
+ * fetched: import('./types.js').Fetched[];
1204
+ * node: import('types').SSRNode | undefined;
1205
+ * parent: () => Promise<Record<string, any>>;
1206
+ * resolve_opts: import('types').RequiredResolveOptions;
1207
+ * server_data_promise: Promise<import('types').ServerDataNode | null>;
1208
+ * state: import('types').SSRState;
1209
+ * csr: boolean;
1210
+ * }} opts
1211
+ * @returns {Promise<Record<string, any | Promise<any>> | null>}
1212
+ */
1213
+ async function load_data({ event, event_state, fetched, node, parent, server_data_promise, state, resolve_opts, csr }) {
1214
+ const server_data_node = await server_data_promise;
1215
+ const load = node?.universal?.load;
1216
+ if (!load) return server_data_node?.data ?? null;
1217
+ return await record_span({
1218
+ name: "sveltekit.load",
1219
+ attributes: {
1220
+ "sveltekit.load.node_id": node.universal_id || "unknown",
1221
+ "sveltekit.load.node_type": get_node_type(node.universal_id),
1222
+ "http.route": event.route.id || "unknown"
1223
+ },
1224
+ fn: async (current) => {
1225
+ const traced_event = merge_tracing(event, current);
1226
+ return await with_request_store({
1227
+ event: traced_event,
1228
+ state: {
1229
+ ...event_state,
1230
+ is_in_universal_load: true
1231
+ }
1232
+ }, () => load.call(null, {
1233
+ url: event.url,
1234
+ params: event.params,
1235
+ data: server_data_node?.data ?? null,
1236
+ route: event.route,
1237
+ fetch: create_universal_fetch(event, state, fetched, csr, resolve_opts),
1238
+ setHeaders: event.setHeaders,
1239
+ depends: noop,
1240
+ parent,
1241
+ untrack: (fn) => fn(),
1242
+ tracing: traced_event.tracing
1243
+ }));
1244
+ }
1245
+ }) ?? null;
1246
+ }
1247
+ /**
1248
+ * @param {Pick<import('@sveltejs/kit').RequestEvent, 'fetch' | 'url' | 'request' | 'route'>} event
1249
+ * @param {import('types').SSRState} state
1250
+ * @param {import('./types.js').Fetched[]} fetched
1251
+ * @param {boolean} csr
1252
+ * @param {Pick<Required<import('@sveltejs/kit').ResolveOptions>, 'filterSerializedResponseHeaders'>} resolve_opts
1253
+ * @returns {typeof fetch}
1254
+ */
1255
+ function create_universal_fetch(event, state, fetched, csr, resolve_opts) {
1256
+ /**
1257
+ * @param {URL | RequestInfo} input
1258
+ * @param {RequestInit} [init]
1259
+ */
1260
+ const universal_fetch = async (input, init) => {
1261
+ const cloned_body = input instanceof Request && input.body ? input.clone().body : null;
1262
+ const cloned_headers = input instanceof Request && [...input.headers].length ? new Headers(input.headers) : init?.headers;
1263
+ let response = await event.fetch(input, init);
1264
+ const url = new URL(input instanceof Request ? input.url : input, event.url);
1265
+ const same_origin = url.origin === event.url.origin;
1266
+ /** @type {import('types').PrerenderDependency} */
1267
+ let dependency;
1268
+ if (same_origin) {
1269
+ if (state.prerendering) {
1270
+ dependency = {
1271
+ response,
1272
+ body: null
1273
+ };
1274
+ state.prerendering.dependencies.set(url.pathname, dependency);
1275
+ }
1276
+ } else if (url.protocol === "https:" || url.protocol === "http:") if ((input instanceof Request ? input.mode : init?.mode ?? "cors") === "no-cors") response = new Response("", {
1277
+ status: response.status,
1278
+ statusText: response.statusText,
1279
+ headers: response.headers
1280
+ });
1281
+ else {
1282
+ const acao = response.headers.get("access-control-allow-origin");
1283
+ if (!acao || acao !== event.url.origin && acao !== "*") throw new Error(`CORS error: ${acao ? "Incorrect" : "No"} 'Access-Control-Allow-Origin' header is present on the requested resource`);
1284
+ }
1285
+ /** @type {ReadableStream<Uint8Array>} */
1286
+ let teed_body;
1287
+ const proxy = new Proxy(response, { get(response, key, receiver) {
1288
+ /**
1289
+ * @param {string | undefined} body
1290
+ * @param {boolean} is_b64
1291
+ */
1292
+ async function push_fetched(body, is_b64) {
1293
+ const status_number = Number(response.status);
1294
+ if (isNaN(status_number)) throw new Error(`response.status is not a number. value: "${response.status}" type: ${typeof response.status}`);
1295
+ fetched.push({
1296
+ url: same_origin ? url.href.slice(event.url.origin.length) : url.href,
1297
+ method: event.request.method,
1298
+ request_body: input instanceof Request && cloned_body ? await stream_to_string(cloned_body) : init?.body,
1299
+ request_headers: cloned_headers,
1300
+ response_body: body,
1301
+ response,
1302
+ is_b64
1303
+ });
1304
+ }
1305
+ if (key === "body") {
1306
+ if (response.body === null) return null;
1307
+ if (teed_body) return teed_body;
1308
+ const [a, b] = response.body.tee();
1309
+ (async () => {
1310
+ let result = new Uint8Array();
1311
+ for await (const chunk of a) {
1312
+ const combined = new Uint8Array(result.length + chunk.length);
1313
+ combined.set(result, 0);
1314
+ combined.set(chunk, result.length);
1315
+ result = combined;
1316
+ }
1317
+ if (dependency) dependency.body = new Uint8Array(result);
1318
+ push_fetched(base64_encode(result), true);
1319
+ })();
1320
+ return teed_body = b;
1321
+ }
1322
+ if (key === "arrayBuffer") return async () => {
1323
+ const buffer = await response.arrayBuffer();
1324
+ const bytes = new Uint8Array(buffer);
1325
+ if (dependency) dependency.body = bytes;
1326
+ if (buffer instanceof ArrayBuffer) await push_fetched(base64_encode(bytes), true);
1327
+ return buffer;
1328
+ };
1329
+ async function text() {
1330
+ const body = await response.text();
1331
+ if (body === "" && NULL_BODY_STATUS.includes(response.status)) {
1332
+ await push_fetched(void 0, false);
1333
+ return;
1334
+ }
1335
+ if (!body || typeof body === "string") await push_fetched(body, false);
1336
+ if (dependency) dependency.body = body;
1337
+ return body;
1338
+ }
1339
+ if (key === "text") return text;
1340
+ if (key === "json") return async () => {
1341
+ const body = await text();
1342
+ return body ? JSON.parse(body) : void 0;
1343
+ };
1344
+ const value = Reflect.get(response, key, response);
1345
+ if (value instanceof Function) return Object.defineProperties(
1346
+ /**
1347
+ * @this {any}
1348
+ */
1349
+ function() {
1350
+ return Reflect.apply(value, this === receiver ? response : this, arguments);
1351
+ },
1352
+ {
1353
+ name: { value: value.name },
1354
+ length: { value: value.length }
1355
+ }
1356
+ );
1357
+ return value;
1358
+ } });
1359
+ if (csr) {
1360
+ const get = response.headers.get;
1361
+ response.headers.get = (key) => {
1362
+ const lower = key.toLowerCase();
1363
+ const value = get.call(response.headers, lower);
1364
+ if (value && !lower.startsWith("x-sveltekit-")) {
1365
+ if (!resolve_opts.filterSerializedResponseHeaders(lower, value)) throw new Error(`Failed to get response header "${lower}" — it must be included by the \`filterSerializedResponseHeaders\` option: https://svelte.dev/docs/kit/hooks#Server-hooks-handle (at ${event.route.id})`);
1366
+ }
1367
+ return value;
1368
+ };
1369
+ }
1370
+ return proxy;
1371
+ };
1372
+ return (input, init) => {
1373
+ const response = universal_fetch(input, init);
1374
+ response.catch(noop);
1375
+ return response;
1376
+ };
1377
+ }
1378
+ /**
1379
+ * @param {ReadableStream<Uint8Array>} stream
1380
+ */
1381
+ async function stream_to_string(stream) {
1382
+ let result = "";
1383
+ const reader = stream.getReader();
1384
+ const decoder = new TextDecoder();
1385
+ while (true) {
1386
+ const { done, value } = await reader.read();
1387
+ if (done) {
1388
+ result += decoder.decode();
1389
+ break;
1390
+ }
1391
+ result += decoder.decode(value, { stream: true });
1392
+ }
1393
+ return result;
1394
+ }
1395
+ //#endregion
1396
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/runtime/server/page/serialize_data.js
1397
+ /**
1398
+ * Inside a script element, only `<\/script` and `<!--` hold special meaning to the HTML parser.
1399
+ *
1400
+ * The first closes the script element, so everything after is treated as raw HTML.
1401
+ * The second disables further parsing until `-->`, so the script element might be unexpectedly
1402
+ * kept open up until an unrelated HTML comment in the page.
1403
+ *
1404
+ * U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR are escaped for the sake of pre-2018
1405
+ * browsers.
1406
+ *
1407
+ * @see tests for unsafe parsing examples.
1408
+ * @see https://html.spec.whatwg.org/multipage/scripting.html#restrictions-for-contents-of-script-elements
1409
+ * @see https://html.spec.whatwg.org/multipage/syntax.html#cdata-rcdata-restrictions
1410
+ * @see https://html.spec.whatwg.org/multipage/parsing.html#script-data-state
1411
+ * @see https://html.spec.whatwg.org/multipage/parsing.html#script-data-double-escaped-state
1412
+ * @see https://github.com/tc39/proposal-json-superset
1413
+ * @type {Record<string, string>}
1414
+ */
1415
+ var replacements = {
1416
+ "<": "\\u003C",
1417
+ "\u2028": "\\u2028",
1418
+ "\u2029": "\\u2029"
1419
+ };
1420
+ var pattern = new RegExp(`[${Object.keys(replacements).join("")}]`, "g");
1421
+ /**
1422
+ * Generates a raw HTML string containing a safe script element carrying data and associated attributes.
1423
+ *
1424
+ * It escapes all the special characters needed to guarantee the element is unbroken, but care must
1425
+ * be taken to ensure it is inserted in the document at an acceptable position for a script element,
1426
+ * and that the resulting string isn't further modified.
1427
+ *
1428
+ * @param {import('./types.js').Fetched} fetched
1429
+ * @param {(name: string, value: string) => boolean} filter
1430
+ * @param {boolean} [prerendering]
1431
+ * @returns {string} The raw HTML of a script element carrying the JSON payload.
1432
+ * @example const html = serialize_data('/data.json', null, { foo: 'bar' });
1433
+ */
1434
+ function serialize_data(fetched, filter, prerendering = false) {
1435
+ /** @type {Record<string, string>} */
1436
+ const headers = {};
1437
+ let cache_control = null;
1438
+ let age = null;
1439
+ let varyAny = false;
1440
+ for (const [key, value] of fetched.response.headers) {
1441
+ if (filter(key, value)) headers[key] = value;
1442
+ if (key === "cache-control") cache_control = value;
1443
+ else if (key === "age") age = value;
1444
+ else if (key === "vary" && value.trim() === "*") varyAny = true;
1445
+ }
1446
+ const payload = {
1447
+ status: fetched.response.status,
1448
+ statusText: fetched.response.statusText,
1449
+ headers,
1450
+ body: fetched.response_body
1451
+ };
1452
+ const safe_payload = JSON.stringify(payload).replace(pattern, (match) => replacements[match]);
1453
+ const attrs = [
1454
+ "type=\"application/json\"",
1455
+ "data-sveltekit-fetched",
1456
+ `data-url="${escape_html(fetched.url, true)}"`
1457
+ ];
1458
+ if (fetched.is_b64) attrs.push("data-b64");
1459
+ if (fetched.request_headers || fetched.request_body) {
1460
+ /** @type {import('types').StrictBody[]} */
1461
+ const values = [];
1462
+ if (fetched.request_headers) values.push([...new Headers(fetched.request_headers)].join(","));
1463
+ if (fetched.request_body) values.push(fetched.request_body);
1464
+ attrs.push(`data-hash="${hash(...values)}"`);
1465
+ }
1466
+ if (!prerendering && fetched.method === "GET" && cache_control && !varyAny) {
1467
+ const match = /s-maxage=(\d+)/g.exec(cache_control) ?? /max-age=(\d+)/g.exec(cache_control);
1468
+ if (match) {
1469
+ const ttl = +match[1] - +(age ?? "0");
1470
+ attrs.push(`data-ttl="${ttl}"`);
1471
+ }
1472
+ }
1473
+ return `<script ${attrs.join(" ")}>${safe_payload}<\/script>`;
1474
+ }
1475
+ //#endregion
1476
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/runtime/server/page/crypto.js
1477
+ /**
1478
+ * SHA-256 hashing function adapted from https://bitwiseshiftleft.github.io/sjcl
1479
+ * modified and redistributed under BSD license
1480
+ * @param {string} data
1481
+ */
1482
+ function sha256(data) {
1483
+ if (!key[0]) precompute();
1484
+ const out = init.slice(0);
1485
+ const array = encode(data);
1486
+ for (let i = 0; i < array.length; i += 16) {
1487
+ const w = array.subarray(i, i + 16);
1488
+ let tmp;
1489
+ let a;
1490
+ let b;
1491
+ let out0 = out[0];
1492
+ let out1 = out[1];
1493
+ let out2 = out[2];
1494
+ let out3 = out[3];
1495
+ let out4 = out[4];
1496
+ let out5 = out[5];
1497
+ let out6 = out[6];
1498
+ let out7 = out[7];
1499
+ for (let i = 0; i < 64; i++) {
1500
+ if (i < 16) tmp = w[i];
1501
+ else {
1502
+ a = w[i + 1 & 15];
1503
+ b = w[i + 14 & 15];
1504
+ tmp = w[i & 15] = (a >>> 7 ^ a >>> 18 ^ a >>> 3 ^ a << 25 ^ a << 14) + (b >>> 17 ^ b >>> 19 ^ b >>> 10 ^ b << 15 ^ b << 13) + w[i & 15] + w[i + 9 & 15] | 0;
1505
+ }
1506
+ tmp = tmp + out7 + (out4 >>> 6 ^ out4 >>> 11 ^ out4 >>> 25 ^ out4 << 26 ^ out4 << 21 ^ out4 << 7) + (out6 ^ out4 & (out5 ^ out6)) + key[i];
1507
+ out7 = out6;
1508
+ out6 = out5;
1509
+ out5 = out4;
1510
+ out4 = out3 + tmp | 0;
1511
+ out3 = out2;
1512
+ out2 = out1;
1513
+ out1 = out0;
1514
+ out0 = tmp + (out1 & out2 ^ out3 & (out1 ^ out2)) + (out1 >>> 2 ^ out1 >>> 13 ^ out1 >>> 22 ^ out1 << 30 ^ out1 << 19 ^ out1 << 10) | 0;
1515
+ }
1516
+ out[0] = out[0] + out0 | 0;
1517
+ out[1] = out[1] + out1 | 0;
1518
+ out[2] = out[2] + out2 | 0;
1519
+ out[3] = out[3] + out3 | 0;
1520
+ out[4] = out[4] + out4 | 0;
1521
+ out[5] = out[5] + out5 | 0;
1522
+ out[6] = out[6] + out6 | 0;
1523
+ out[7] = out[7] + out7 | 0;
1524
+ }
1525
+ const bytes = new Uint8Array(out.buffer);
1526
+ reverse_endianness(bytes);
1527
+ return btoa(String.fromCharCode(...bytes));
1528
+ }
1529
+ /** The SHA-256 initialization vector */
1530
+ var init = new Uint32Array(8);
1531
+ /** The SHA-256 hash key */
1532
+ var key = new Uint32Array(64);
1533
+ /** Function to precompute init and key. */
1534
+ function precompute() {
1535
+ /** @param {number} x */
1536
+ function frac(x) {
1537
+ return (x - Math.floor(x)) * 4294967296;
1538
+ }
1539
+ let prime = 2;
1540
+ for (let i = 0; i < 64; prime++) {
1541
+ let is_prime = true;
1542
+ for (let factor = 2; factor * factor <= prime; factor++) if (prime % factor === 0) {
1543
+ is_prime = false;
1544
+ break;
1545
+ }
1546
+ if (is_prime) {
1547
+ if (i < 8) init[i] = frac(prime ** (1 / 2));
1548
+ key[i] = frac(prime ** (1 / 3));
1549
+ i++;
1550
+ }
1551
+ }
1552
+ }
1553
+ /** @param {Uint8Array} bytes */
1554
+ function reverse_endianness(bytes) {
1555
+ for (let i = 0; i < bytes.length; i += 4) {
1556
+ const a = bytes[i + 0];
1557
+ const b = bytes[i + 1];
1558
+ const c = bytes[i + 2];
1559
+ const d = bytes[i + 3];
1560
+ bytes[i + 0] = d;
1561
+ bytes[i + 1] = c;
1562
+ bytes[i + 2] = b;
1563
+ bytes[i + 3] = a;
1564
+ }
1565
+ }
1566
+ /** @param {string} str */
1567
+ function encode(str) {
1568
+ const encoded = text_encoder.encode(str);
1569
+ const length = encoded.length * 8;
1570
+ const size = 512 * Math.ceil((length + 65) / 512);
1571
+ const bytes = new Uint8Array(size / 8);
1572
+ bytes.set(encoded);
1573
+ bytes[encoded.length] = 128;
1574
+ reverse_endianness(bytes);
1575
+ const words = new Uint32Array(bytes.buffer);
1576
+ words[words.length - 2] = Math.floor(length / 4294967296);
1577
+ words[words.length - 1] = length;
1578
+ return words;
1579
+ }
1580
+ //#endregion
1581
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/runtime/server/page/csp.js
1582
+ var array = new Uint8Array(16);
1583
+ function generate_nonce() {
1584
+ crypto.getRandomValues(array);
1585
+ return btoa(String.fromCharCode(...array));
1586
+ }
1587
+ var quoted = new Set([
1588
+ "self",
1589
+ "unsafe-eval",
1590
+ "unsafe-hashes",
1591
+ "unsafe-inline",
1592
+ "none",
1593
+ "strict-dynamic",
1594
+ "report-sample",
1595
+ "wasm-unsafe-eval",
1596
+ "script"
1597
+ ]);
1598
+ var crypto_pattern = /^(nonce|sha\d\d\d)-/;
1599
+ var BaseProvider = class {
1600
+ /** @type {boolean} */
1601
+ #use_hashes;
1602
+ /** @type {boolean} */
1603
+ #script_needs_csp;
1604
+ /** @type {boolean} */
1605
+ #script_src_needs_csp;
1606
+ /** @type {boolean} */
1607
+ #script_src_elem_needs_csp;
1608
+ /** @type {boolean} */
1609
+ #style_needs_csp;
1610
+ /** @type {boolean} */
1611
+ #style_src_needs_csp;
1612
+ /** @type {boolean} */
1613
+ #style_src_attr_needs_csp;
1614
+ /** @type {boolean} */
1615
+ #style_src_elem_needs_csp;
1616
+ /** @type {import('types').CspDirectives} */
1617
+ #directives;
1618
+ /** @type {Set<import('types').Csp.Source>} */
1619
+ #script_src;
1620
+ /** @type {Set<import('types').Csp.Source>} */
1621
+ #script_src_elem;
1622
+ /** @type {Set<import('types').Csp.Source>} */
1623
+ #style_src;
1624
+ /** @type {Set<import('types').Csp.Source>} */
1625
+ #style_src_attr;
1626
+ /** @type {Set<import('types').Csp.Source>} */
1627
+ #style_src_elem;
1628
+ /** @type {boolean} */
1629
+ script_needs_nonce;
1630
+ /** @type {boolean} */
1631
+ style_needs_nonce;
1632
+ /** @type {boolean} */
1633
+ script_needs_hash;
1634
+ /** @type {string} */
1635
+ #nonce;
1636
+ /**
1637
+ * @param {boolean} use_hashes
1638
+ * @param {import('types').CspDirectives} directives
1639
+ * @param {string} nonce
1640
+ */
1641
+ constructor(use_hashes, directives, nonce) {
1642
+ this.#use_hashes = use_hashes;
1643
+ this.#directives = directives;
1644
+ const d = this.#directives;
1645
+ this.#script_src = /* @__PURE__ */ new Set();
1646
+ this.#script_src_elem = /* @__PURE__ */ new Set();
1647
+ this.#style_src = /* @__PURE__ */ new Set();
1648
+ this.#style_src_attr = /* @__PURE__ */ new Set();
1649
+ this.#style_src_elem = /* @__PURE__ */ new Set();
1650
+ const effective_script_src = d["script-src"] || d["default-src"];
1651
+ const script_src_elem = d["script-src-elem"];
1652
+ const effective_style_src = d["style-src"] || d["default-src"];
1653
+ const style_src_attr = d["style-src-attr"];
1654
+ const style_src_elem = d["style-src-elem"];
1655
+ /** @param {(import('types').Csp.Source | import('types').Csp.ActionSource)[] | undefined} directive */
1656
+ const style_needs_csp = (directive) => !!directive && !directive.some((value) => value === "unsafe-inline");
1657
+ /** @param {(import('types').Csp.Source | import('types').Csp.ActionSource)[] | undefined} directive */
1658
+ const script_needs_csp = (directive) => !!directive && (!directive.some((value) => value === "unsafe-inline") || directive.some((value) => value === "strict-dynamic"));
1659
+ this.#script_src_needs_csp = script_needs_csp(effective_script_src);
1660
+ this.#script_src_elem_needs_csp = script_needs_csp(script_src_elem);
1661
+ this.#style_src_needs_csp = style_needs_csp(effective_style_src);
1662
+ this.#style_src_attr_needs_csp = style_needs_csp(style_src_attr);
1663
+ this.#style_src_elem_needs_csp = style_needs_csp(style_src_elem);
1664
+ this.#script_needs_csp = this.#script_src_needs_csp || this.#script_src_elem_needs_csp;
1665
+ this.#style_needs_csp = this.#style_src_needs_csp || this.#style_src_attr_needs_csp || this.#style_src_elem_needs_csp;
1666
+ this.script_needs_nonce = this.#script_needs_csp && !this.#use_hashes;
1667
+ this.style_needs_nonce = this.#style_needs_csp && !this.#use_hashes;
1668
+ this.script_needs_hash = this.#script_needs_csp && this.#use_hashes;
1669
+ this.#nonce = nonce;
1670
+ }
1671
+ /** @param {string} content */
1672
+ add_script(content) {
1673
+ if (!this.#script_needs_csp) return;
1674
+ /** @type {`nonce-${string}` | `sha256-${string}`} */
1675
+ const source = this.#use_hashes ? `sha256-${sha256(content)}` : `nonce-${this.#nonce}`;
1676
+ if (this.#script_src_needs_csp) this.#script_src.add(source);
1677
+ if (this.#script_src_elem_needs_csp) this.#script_src_elem.add(source);
1678
+ }
1679
+ /** @param {`sha256-${string}`[]} hashes */
1680
+ add_script_hashes(hashes) {
1681
+ for (const hash of hashes) {
1682
+ if (this.#script_src_needs_csp) this.#script_src.add(hash);
1683
+ if (this.#script_src_elem_needs_csp) this.#script_src_elem.add(hash);
1684
+ }
1685
+ }
1686
+ /** @param {string} content */
1687
+ add_style(content) {
1688
+ if (!this.#style_needs_csp) return;
1689
+ /** @type {`nonce-${string}` | `sha256-${string}`} */
1690
+ const source = this.#use_hashes ? `sha256-${sha256(content)}` : `nonce-${this.#nonce}`;
1691
+ if (this.#style_src_needs_csp) this.#style_src.add(source);
1692
+ if (this.#style_src_attr_needs_csp) this.#style_src_attr.add(source);
1693
+ if (this.#style_src_elem_needs_csp) {
1694
+ const sha256_empty_comment_hash = "sha256-9OlNO0DNEeaVzHL4RZwCLsBHA8WBQ8toBp/4F5XV2nc=";
1695
+ const d = this.#directives;
1696
+ if (d["style-src-elem"] && !d["style-src-elem"].includes(sha256_empty_comment_hash) && !this.#style_src_elem.has(sha256_empty_comment_hash)) this.#style_src_elem.add(sha256_empty_comment_hash);
1697
+ if (source !== sha256_empty_comment_hash) this.#style_src_elem.add(source);
1698
+ }
1699
+ }
1700
+ /**
1701
+ * @param {boolean} [is_meta]
1702
+ */
1703
+ get_header(is_meta = false) {
1704
+ const header = [];
1705
+ const directives = { ...this.#directives };
1706
+ if (this.#style_src.size > 0) directives["style-src"] = [...directives["style-src"] || directives["default-src"] || [], ...this.#style_src];
1707
+ if (this.#style_src_attr.size > 0) directives["style-src-attr"] = [...directives["style-src-attr"] || [], ...this.#style_src_attr];
1708
+ if (this.#style_src_elem.size > 0) directives["style-src-elem"] = [...directives["style-src-elem"] || [], ...this.#style_src_elem];
1709
+ if (this.#script_src.size > 0) directives["script-src"] = [...directives["script-src"] || directives["default-src"] || [], ...this.#script_src];
1710
+ if (this.#script_src_elem.size > 0) directives["script-src-elem"] = [...directives["script-src-elem"] || [], ...this.#script_src_elem];
1711
+ for (const key in directives) {
1712
+ if (is_meta && (key === "frame-ancestors" || key === "report-uri" || key === "sandbox")) continue;
1713
+ const value = directives[key];
1714
+ if (!value) continue;
1715
+ const directive = [key];
1716
+ if (Array.isArray(value)) value.forEach((value) => {
1717
+ if (quoted.has(value) || crypto_pattern.test(value)) directive.push(`'${value}'`);
1718
+ else directive.push(value);
1719
+ });
1720
+ header.push(directive.join(" "));
1721
+ }
1722
+ return header.join("; ");
1723
+ }
1724
+ };
1725
+ var CspProvider = class extends BaseProvider {
1726
+ get_meta() {
1727
+ const content = this.get_header(true);
1728
+ if (!content) return;
1729
+ return `<meta http-equiv="content-security-policy" content="${escape_html(content, true)}">`;
1730
+ }
1731
+ };
1732
+ var CspReportOnlyProvider = class extends BaseProvider {
1733
+ /**
1734
+ * @param {boolean} use_hashes
1735
+ * @param {import('types').CspDirectives} directives
1736
+ * @param {string} nonce
1737
+ */
1738
+ constructor(use_hashes, directives, nonce) {
1739
+ super(use_hashes, directives, nonce);
1740
+ if (Object.values(directives).filter((v) => !!v).length > 0) {
1741
+ const has_report_to = directives["report-to"]?.length ?? false;
1742
+ const has_report_uri = directives["report-uri"]?.length ?? false;
1743
+ if (!has_report_to && !has_report_uri) throw Error("`content-security-policy-report-only` must be specified with either the `report-to` or `report-uri` directives, or both");
1744
+ }
1745
+ }
1746
+ };
1747
+ var Csp = class {
1748
+ /** @readonly */
1749
+ nonce = generate_nonce();
1750
+ /** @type {CspProvider} */
1751
+ csp_provider;
1752
+ /** @type {CspReportOnlyProvider} */
1753
+ report_only_provider;
1754
+ /**
1755
+ * @param {import('./types.js').CspConfig} config
1756
+ * @param {import('./types.js').CspOpts} opts
1757
+ */
1758
+ constructor({ mode, directives, reportOnly }, { prerender }) {
1759
+ const use_hashes = mode === "hash" || mode === "auto" && prerender;
1760
+ this.csp_provider = new CspProvider(use_hashes, directives, this.nonce);
1761
+ this.report_only_provider = new CspReportOnlyProvider(use_hashes, reportOnly, this.nonce);
1762
+ }
1763
+ get script_needs_hash() {
1764
+ return this.csp_provider.script_needs_hash || this.report_only_provider.script_needs_hash;
1765
+ }
1766
+ get script_needs_nonce() {
1767
+ return this.csp_provider.script_needs_nonce || this.report_only_provider.script_needs_nonce;
1768
+ }
1769
+ get style_needs_nonce() {
1770
+ return this.csp_provider.style_needs_nonce || this.report_only_provider.style_needs_nonce;
1771
+ }
1772
+ /** @param {string} content */
1773
+ add_script(content) {
1774
+ this.csp_provider.add_script(content);
1775
+ this.report_only_provider.add_script(content);
1776
+ }
1777
+ /** @param {`sha256-${string}`[]} hashes */
1778
+ add_script_hashes(hashes) {
1779
+ this.csp_provider.add_script_hashes(hashes);
1780
+ this.report_only_provider.add_script_hashes(hashes);
1781
+ }
1782
+ /** @param {string} content */
1783
+ add_style(content) {
1784
+ this.csp_provider.add_style(content);
1785
+ this.report_only_provider.add_style(content);
1786
+ }
1787
+ };
1788
+ //#endregion
1789
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/runtime/server/page/server_routing.js
1790
+ /**
1791
+ * @param {import('types').SSRClientRoute} route
1792
+ * @param {URL} url
1793
+ * @param {import('@sveltejs/kit').SSRManifest} manifest
1794
+ * @returns {string}
1795
+ */
1796
+ function generate_route_object(route, url, manifest) {
1797
+ const { errors, layouts, leaf } = route;
1798
+ const nodes = [
1799
+ ...errors,
1800
+ ...layouts.map((l) => l?.[1]),
1801
+ leaf[1]
1802
+ ].filter((n) => typeof n === "number").map((n) => `'${n}': () => ${create_client_import(manifest._.client.nodes?.[n], url)}`).join(",\n ");
1803
+ /** @type {import('types').CSRRouteServer} */
1804
+ return [
1805
+ `{\n\tid: ${s(route.id)}`,
1806
+ `errors: ${s(route.errors)}`,
1807
+ `layouts: ${s(route.layouts)}`,
1808
+ `leaf: ${s(route.leaf)}`,
1809
+ `nodes: {\n\t\t${nodes}\n\t}\n}`
1810
+ ].join(",\n ");
1811
+ }
1812
+ /**
1813
+ * @param {string | undefined} import_path
1814
+ * @param {URL} url
1815
+ */
1816
+ function create_client_import(import_path, url) {
1817
+ if (!import_path) return "Promise.resolve({})";
1818
+ if (import_path[0] === "/") return `import('${import_path}')`;
1819
+ if (assets !== "") return `import('${assets}/${import_path}')`;
1820
+ let path = get_relative_path(url.pathname, `${base}/${import_path}`);
1821
+ if (path[0] !== ".") path = `./${path}`;
1822
+ return `import('${path}')`;
1823
+ }
1824
+ /**
1825
+ * @param {string} resolved_path
1826
+ * @param {URL} url
1827
+ * @param {import('@sveltejs/kit').SSRManifest} manifest
1828
+ * @returns {Promise<Response>}
1829
+ */
1830
+ async function resolve_route(resolved_path, url, manifest) {
1831
+ if (!manifest._.client.routes) return text("Server-side route resolution disabled", { status: 400 });
1832
+ const matchers = await manifest._.matchers();
1833
+ const result = find_route(resolved_path, manifest._.client.routes, matchers);
1834
+ return create_server_routing_response(result?.route ?? null, result?.params ?? {}, url, manifest).response;
1835
+ }
1836
+ /**
1837
+ * @param {import('types').SSRClientRoute | null} route
1838
+ * @param {Partial<Record<string, string>>} params
1839
+ * @param {URL} url
1840
+ * @param {import('@sveltejs/kit').SSRManifest} manifest
1841
+ * @returns {{response: Response, body: string}}
1842
+ */
1843
+ function create_server_routing_response(route, params, url, manifest) {
1844
+ const headers = new Headers({ "content-type": "application/javascript; charset=utf-8" });
1845
+ if (route) {
1846
+ const csr_route = generate_route_object(route, url, manifest);
1847
+ const body = `${create_css_import(route, url, manifest)}\nexport const route = ${csr_route}; export const params = ${JSON.stringify(params)};`;
1848
+ return {
1849
+ response: text(body, { headers }),
1850
+ body
1851
+ };
1852
+ } else return {
1853
+ response: text("", { headers }),
1854
+ body: ""
1855
+ };
1856
+ }
1857
+ /**
1858
+ * This function generates the client-side import for the CSS files that are
1859
+ * associated with the current route. Vite takes care of that when using
1860
+ * client-side route resolution, but for server-side resolution it does
1861
+ * not know about the CSS files automatically.
1862
+ *
1863
+ * @param {import('types').SSRClientRoute} route
1864
+ * @param {URL} url
1865
+ * @param {import('@sveltejs/kit').SSRManifest} manifest
1866
+ * @returns {string}
1867
+ */
1868
+ function create_css_import(route, url, manifest) {
1869
+ const { errors, layouts, leaf } = route;
1870
+ let css = "";
1871
+ for (const node of [
1872
+ ...errors,
1873
+ ...layouts.map((l) => l?.[1]),
1874
+ leaf[1]
1875
+ ]) {
1876
+ if (typeof node !== "number") continue;
1877
+ const node_css = manifest._.client.css?.[node];
1878
+ for (const css_path of node_css ?? []) css += `'${assets || base}/${css_path}',`;
1879
+ }
1880
+ if (!css) return "";
1881
+ return `${create_client_import(manifest._.client.start, url)}.then(x => x.load_css([${css}]));`;
1882
+ }
1883
+ //#endregion
1884
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/runtime/server/page/render.js
1885
+ var updated = {
1886
+ ...readable(false),
1887
+ check: () => false
1888
+ };
1889
+ /**
1890
+ * Creates the HTML response.
1891
+ * @param {{
1892
+ * branch: Array<import('./types.js').Loaded>;
1893
+ * fetched: Array<import('./types.js').Fetched>;
1894
+ * options: import('types').SSROptions;
1895
+ * manifest: import('@sveltejs/kit').SSRManifest;
1896
+ * state: import('types').SSRState;
1897
+ * page_config: { ssr: boolean; csr: boolean };
1898
+ * status: number;
1899
+ * error: App.Error | null;
1900
+ * event: import('@sveltejs/kit').RequestEvent;
1901
+ * event_state: import('types').RequestState;
1902
+ * resolve_opts: import('types').RequiredResolveOptions;
1903
+ * action_result?: import('@sveltejs/kit').ActionResult;
1904
+ * data_serializer: import('./types.js').ServerDataSerializer;
1905
+ * error_components?: Array<import('types').SSRComponent | undefined>
1906
+ * }} opts
1907
+ */
1908
+ async function render_response({ branch, fetched, options, manifest, state, page_config, status, error = null, event, event_state, resolve_opts, action_result, data_serializer, error_components }) {
1909
+ if (state.prerendering) {
1910
+ if (options.csp.mode === "nonce") throw new Error("Cannot use prerendering if config.kit.csp.mode === \"nonce\"");
1911
+ if (options.app_template_contains_nonce) throw new Error("Cannot use prerendering if page template contains %sveltekit.nonce%");
1912
+ }
1913
+ const { client } = manifest._;
1914
+ const modulepreloads = new Set(client.imports);
1915
+ const stylesheets = new Set(client.stylesheets);
1916
+ const fonts = new Set(client.fonts);
1917
+ /**
1918
+ * The value of the Link header that is added to the response when not prerendering
1919
+ * @type {Set<string>}
1920
+ */
1921
+ const link_headers = /* @__PURE__ */ new Set();
1922
+ /** @type {Map<string, string>} */
1923
+ const inline_styles = /* @__PURE__ */ new Map();
1924
+ /** @type {ReturnType<typeof options.root.render>} */
1925
+ let rendered;
1926
+ const form_value = action_result?.type === "success" || action_result?.type === "failure" ? action_result.data ?? null : null;
1927
+ /** @type {string} */
1928
+ let base$1 = base;
1929
+ /** @type {string} */
1930
+ let assets$1 = assets;
1931
+ /**
1932
+ * An expression that will evaluate in the client to determine the resolved base path.
1933
+ * We use a relative path when possible to support IPFS, the internet archive, etc.
1934
+ */
1935
+ let base_expression = s(base);
1936
+ const csp = new Csp(options.csp, { prerender: !!state.prerendering });
1937
+ if (!state.prerendering?.fallback) {
1938
+ base$1 = event.url.pathname.slice(base.length).split("/").slice(2).map(() => "..").join("/") || ".";
1939
+ base_expression = `new URL(${s(base$1)}, location).pathname.slice(0, -1)`;
1940
+ if (!assets || assets[0] === "/" && assets !== "/_svelte_kit_assets") assets$1 = base$1;
1941
+ } else if (options.hash_routing) base_expression = "new URL('.', location).pathname.slice(0, -1)";
1942
+ if (page_config.ssr) {
1943
+ /** @type {Record<string, any>} */
1944
+ const props = {
1945
+ stores: {
1946
+ page: writable(null),
1947
+ navigating: writable(null),
1948
+ updated
1949
+ },
1950
+ constructors: await Promise.all(branch.map(({ node }) => {
1951
+ if (!node.component) throw new Error(`Missing +page.svelte component for route ${event.route.id}`);
1952
+ return node.component();
1953
+ })),
1954
+ form: form_value
1955
+ };
1956
+ if (error_components) {
1957
+ if (error) props.error = error;
1958
+ props.errors = error_components;
1959
+ }
1960
+ let data = {};
1961
+ for (let i = 0; i < branch.length; i += 1) {
1962
+ data = {
1963
+ ...data,
1964
+ ...branch[i].data
1965
+ };
1966
+ props[`data_${i}`] = data;
1967
+ }
1968
+ props.page = {
1969
+ error,
1970
+ params: event.params,
1971
+ route: event.route,
1972
+ status,
1973
+ url: event.url,
1974
+ data,
1975
+ form: form_value,
1976
+ state: {}
1977
+ };
1978
+ const render_opts = {
1979
+ context: new Map([["__request__", { page: props.page }]]),
1980
+ csp: csp.script_needs_nonce ? { nonce: csp.nonce } : { hash: csp.script_needs_hash },
1981
+ transformError: error_components ? async (e) => {
1982
+ if (isRedirect(e)) throw e;
1983
+ const transformed = await handle_error_and_jsonify(event, event_state, options, e);
1984
+ props.page.error = props.error = error = transformed;
1985
+ props.page.status = status = get_status(e);
1986
+ return transformed;
1987
+ } : void 0
1988
+ };
1989
+ try {
1990
+ rendered = await with_request_store({
1991
+ event,
1992
+ state: {
1993
+ ...event_state,
1994
+ is_in_render: true
1995
+ }
1996
+ }, async () => {
1997
+ override({
1998
+ base: base$1,
1999
+ assets: assets$1
2000
+ });
2001
+ const maybe_promise = options.root.render(props, render_opts);
2002
+ const rendered = options.async && "then" in maybe_promise ? maybe_promise.then((r) => r) : maybe_promise;
2003
+ if (options.async) reset();
2004
+ const { head, html, css, hashes } = options.async ? await rendered : rendered;
2005
+ if (hashes) csp.add_script_hashes(hashes.script);
2006
+ return {
2007
+ head,
2008
+ html,
2009
+ css,
2010
+ hashes
2011
+ };
2012
+ });
2013
+ } finally {
2014
+ reset();
2015
+ }
2016
+ } else rendered = {
2017
+ head: "",
2018
+ html: "",
2019
+ css: {
2020
+ code: "",
2021
+ map: null
2022
+ },
2023
+ hashes: { script: [] }
2024
+ };
2025
+ for (const { node } of branch) {
2026
+ for (const url of node.imports) modulepreloads.add(url);
2027
+ for (const url of node.stylesheets) stylesheets.add(url);
2028
+ for (const url of node.fonts) fonts.add(url);
2029
+ if (node.inline_styles && !client.inline) Object.entries(await node.inline_styles()).forEach(([filename, css]) => {
2030
+ if (typeof css === "string") {
2031
+ inline_styles.set(filename, css);
2032
+ return;
2033
+ }
2034
+ inline_styles.set(filename, css(`${assets$1}/${app_dir}/immutable/assets`, assets$1));
2035
+ });
2036
+ }
2037
+ const head = new Head(rendered.head, !!state.prerendering);
2038
+ let body = rendered.html;
2039
+ /** @param {string} path */
2040
+ const prefixed = (path) => {
2041
+ if (path.startsWith("/")) return base + path;
2042
+ return `${assets$1}/${path}`;
2043
+ };
2044
+ const style = client.inline ? client.inline?.style : Array.from(inline_styles.values()).join("\n");
2045
+ if (style) {
2046
+ const attributes = [];
2047
+ if (csp.style_needs_nonce) attributes.push(`nonce="${csp.nonce}"`);
2048
+ csp.add_style(style);
2049
+ head.add_style(style, attributes);
2050
+ }
2051
+ for (const dep of stylesheets) {
2052
+ const path = prefixed(dep);
2053
+ const attributes = ["rel=\"stylesheet\""];
2054
+ if (inline_styles.has(dep)) attributes.push("disabled", "media=\"(max-width: 0)\"");
2055
+ else if (resolve_opts.preload({
2056
+ type: "css",
2057
+ path
2058
+ })) link_headers.add(`<${encodeURI(path)}>; rel="preload"; as="style"; nopush`);
2059
+ head.add_stylesheet(path, attributes);
2060
+ }
2061
+ for (const dep of fonts) {
2062
+ const path = prefixed(dep);
2063
+ if (resolve_opts.preload({
2064
+ type: "font",
2065
+ path
2066
+ })) {
2067
+ const ext = dep.slice(dep.lastIndexOf(".") + 1);
2068
+ head.add_link_tag(path, [
2069
+ "rel=\"preload\"",
2070
+ "as=\"font\"",
2071
+ `type="font/${ext}"`,
2072
+ "crossorigin"
2073
+ ]);
2074
+ link_headers.add(`<${encodeURI(path)}>; rel="preload"; as="font"; type="font/${ext}"; crossorigin; nopush`);
2075
+ }
2076
+ }
2077
+ const global = get_global_name(options);
2078
+ const { data, chunks } = data_serializer.get_data(csp);
2079
+ if (page_config.ssr && page_config.csr) body += `\n\t\t\t${fetched.map((item) => serialize_data(item, resolve_opts.filterSerializedResponseHeaders, !!state.prerendering)).join("\n ")}`;
2080
+ if (page_config.csr) {
2081
+ const route = manifest._.client.routes?.find((r) => r.id === event.route.id) ?? null;
2082
+ if (client.uses_env_dynamic_public && state.prerendering) modulepreloads.add(`${app_dir}/env.js`);
2083
+ if (!client.inline) {
2084
+ const included_modulepreloads = Array.from(modulepreloads, (dep) => prefixed(dep)).filter((path) => resolve_opts.preload({
2085
+ type: "js",
2086
+ path
2087
+ }));
2088
+ for (const path of included_modulepreloads) {
2089
+ link_headers.add(`<${encodeURI(path)}>; rel="modulepreload"; nopush`);
2090
+ if (options.preload_strategy !== "modulepreload") head.add_script_preload(path);
2091
+ else head.add_link_tag(path, ["rel=\"modulepreload\""]);
2092
+ }
2093
+ }
2094
+ if (manifest._.client.routes && state.prerendering && !state.prerendering.fallback) {
2095
+ const pathname = add_resolution_suffix(event.url.pathname);
2096
+ state.prerendering.dependencies.set(pathname, create_server_routing_response(route, event.params, new URL(pathname, event.url), manifest));
2097
+ }
2098
+ const blocks = [];
2099
+ const load_env_eagerly = client.uses_env_dynamic_public && state.prerendering;
2100
+ const properties = [`base: ${base_expression}`];
2101
+ if (assets) properties.push(`assets: ${s(assets)}`);
2102
+ if (client.uses_env_dynamic_public) properties.push(`env: ${load_env_eagerly ? "null" : s(public_env)}`);
2103
+ if (chunks) {
2104
+ blocks.push("const deferred = new Map();");
2105
+ properties.push(`defer: (id) => new Promise((fulfil, reject) => {
2106
+ deferred.set(id, { fulfil, reject });
2107
+ })`);
2108
+ let app_declaration = "";
2109
+ if (Object.keys(options.hooks.transport).length > 0) if (client.inline) app_declaration = `const app = __sveltekit_${options.version_hash}.app.app;`;
2110
+ else if (client.app) app_declaration = `const app = await import(${s(prefixed(client.app))});`;
2111
+ else app_declaration = `const { app } = await import(${s(prefixed(client.start))});`;
2112
+ const prelude = app_declaration ? `${app_declaration}
2113
+ const [data, error] = fn(app);` : `const [data, error] = fn();`;
2114
+ properties.push(`resolve: async (id, fn) => {
2115
+ ${prelude}
2116
+
2117
+ const try_to_resolve = () => {
2118
+ if (!deferred.has(id)) {
2119
+ setTimeout(try_to_resolve, 0);
2120
+ return;
2121
+ }
2122
+ const { fulfil, reject } = deferred.get(id);
2123
+ deferred.delete(id);
2124
+ if (error) reject(error);
2125
+ else fulfil(data);
2126
+ }
2127
+ try_to_resolve();
2128
+ }`);
2129
+ }
2130
+ blocks.push(`${global} = {
2131
+ ${properties.join(",\n ")}
2132
+ };`);
2133
+ const args = ["element"];
2134
+ blocks.push("const element = document.currentScript.parentElement;");
2135
+ if (page_config.ssr) {
2136
+ const serialized = {
2137
+ form: "null",
2138
+ error: "null"
2139
+ };
2140
+ if (form_value) serialized.form = uneval_action_response(form_value, event.route.id, options.hooks.transport);
2141
+ if (error) serialized.error = uneval(error);
2142
+ const hydrate = [
2143
+ `node_ids: [${branch.map(({ node }) => node.index).join(", ")}]`,
2144
+ `data: ${data}`,
2145
+ `form: ${serialized.form}`,
2146
+ `error: ${serialized.error}`
2147
+ ];
2148
+ if (status !== 200) hydrate.push(`status: ${status}`);
2149
+ if (manifest._.client.routes) {
2150
+ if (route) {
2151
+ const stringified = generate_route_object(route, event.url, manifest).replaceAll("\n", "\n ");
2152
+ hydrate.push(`params: ${uneval(event.params)}`, `server_route: ${stringified}`);
2153
+ }
2154
+ } else if (options.embedded) hydrate.push(`params: ${uneval(event.params)}`, `route: ${s(event.route)}`);
2155
+ const indent = " ".repeat(load_env_eagerly ? 7 : 6);
2156
+ args.push(`{\n${indent}\t${hydrate.join(`,\n${indent}\t`)}\n${indent}}`);
2157
+ }
2158
+ const { remote } = event_state;
2159
+ let serialized_query_data = "";
2160
+ let serialized_prerender_data = "";
2161
+ if (remote.data) {
2162
+ /** @type {Record<string, any>} */
2163
+ const query = {};
2164
+ /** @type {Record<string, any>} */
2165
+ const prerender = {};
2166
+ for (const [internals, cache] of remote.data) {
2167
+ if (!internals.id) continue;
2168
+ for (const key in cache) {
2169
+ const entry = cache[key];
2170
+ if (!entry.serialize) continue;
2171
+ const remote_key = create_remote_key(internals.id, key);
2172
+ const store = internals.type === "prerender" ? prerender : query;
2173
+ if (event_state.remote.refreshes?.has(remote_key) || event_state.remote.reconnects?.has(remote_key)) store[remote_key] = await entry.data;
2174
+ else {
2175
+ const result = await Promise.race([Promise.resolve(entry.data).then((v) => ({
2176
+ settled: true,
2177
+ value: v
2178
+ }), (e) => ({
2179
+ settled: true,
2180
+ error: e
2181
+ })), new Promise((resolve) => {
2182
+ queueMicrotask(() => resolve({ settled: false }));
2183
+ })]);
2184
+ if (result.settled) {
2185
+ if ("error" in result) throw result.error;
2186
+ store[remote_key] = result.value;
2187
+ }
2188
+ }
2189
+ }
2190
+ }
2191
+ const replacer = create_replacer(options.hooks.transport);
2192
+ if (Object.keys(query).length > 0) serialized_query_data = `${global}.query = ${uneval(query, replacer)};\n\n\t\t\t\t\t\t`;
2193
+ if (Object.keys(prerender).length > 0) serialized_prerender_data = `${global}.prerender = ${uneval(prerender, replacer)};\n\n\t\t\t\t\t\t`;
2194
+ }
2195
+ const serialized_remote_data = `${serialized_query_data}${serialized_prerender_data}`;
2196
+ const boot = client.inline ? `${client.inline.script}
2197
+
2198
+ ${serialized_remote_data}${global}.app.start(${args.join(", ")});` : client.app ? `Promise.all([
2199
+ import(${s(prefixed(client.start))}),
2200
+ import(${s(prefixed(client.app))})
2201
+ ]).then(([kit, app]) => {
2202
+ ${serialized_remote_data}kit.start(app, ${args.join(", ")});
2203
+ });` : `import(${s(prefixed(client.start))}).then((app) => {
2204
+ ${serialized_remote_data}app.start(${args.join(", ")})
2205
+ });`;
2206
+ if (load_env_eagerly) blocks.push(`import(${s(`${base$1}/${app_dir}/env.js`)}).then(({ env }) => {
2207
+ ${global}.env = env;
2208
+
2209
+ ${boot.replace(/\n/g, "\n ")}
2210
+ });`);
2211
+ else blocks.push(boot);
2212
+ if (options.service_worker) {
2213
+ let opts = "";
2214
+ if (options.service_worker_options != null) opts = `, ${s({ ...options.service_worker_options })}`;
2215
+ blocks.push(`if ('serviceWorker' in navigator) {
2216
+ const script_url = '${prefixed("service-worker.js")}';
2217
+ const policy = globalThis?.window?.trustedTypes?.createPolicy(
2218
+ 'sveltekit-trusted-url',
2219
+ { createScriptURL(url) { return url; } }
2220
+ );
2221
+ const sanitised = policy?.createScriptURL(script_url) ?? script_url;
2222
+ addEventListener('load', function () {
2223
+ navigator.serviceWorker.register(sanitised${opts});
2224
+ });
2225
+ }`);
2226
+ }
2227
+ const init_app = `
2228
+ {
2229
+ ${blocks.join("\n\n ")}
2230
+ }
2231
+ `;
2232
+ csp.add_script(init_app);
2233
+ body += `\n\t\t\t<script${csp.script_needs_nonce ? ` nonce="${csp.nonce}"` : ""}>${init_app}<\/script>\n\t\t`;
2234
+ }
2235
+ const headers = new Headers({
2236
+ "x-sveltekit-page": "true",
2237
+ "content-type": "text/html"
2238
+ });
2239
+ if (state.prerendering) {
2240
+ const csp_headers = csp.csp_provider.get_meta();
2241
+ if (csp_headers) head.add_http_equiv(csp_headers);
2242
+ if (state.prerendering.cache) head.add_http_equiv(`<meta http-equiv="cache-control" content="${state.prerendering.cache}">`);
2243
+ } else {
2244
+ const csp_header = csp.csp_provider.get_header();
2245
+ if (csp_header) headers.set("content-security-policy", csp_header);
2246
+ const report_only_header = csp.report_only_provider.get_header();
2247
+ if (report_only_header) headers.set("content-security-policy-report-only", report_only_header);
2248
+ if (link_headers.size) headers.set("link", Array.from(link_headers).join(", "));
2249
+ }
2250
+ const html = options.templates.app({
2251
+ head: head.build(),
2252
+ body,
2253
+ assets: assets$1,
2254
+ nonce: csp.nonce,
2255
+ env: public_env
2256
+ });
2257
+ const transformed = await resolve_opts.transformPageChunk({
2258
+ html,
2259
+ done: true
2260
+ }) || "";
2261
+ if (!chunks) headers.set("etag", `"${hash(transformed)}"`);
2262
+ return !chunks ? text(transformed, {
2263
+ status,
2264
+ headers
2265
+ }) : new Response(new ReadableStream({
2266
+ async start(controller) {
2267
+ controller.enqueue(text_encoder.encode(transformed + "\n"));
2268
+ for await (const chunk of chunks) if (chunk.length) controller.enqueue(text_encoder.encode(chunk));
2269
+ controller.close();
2270
+ },
2271
+ type: "bytes"
2272
+ }), { headers });
2273
+ }
2274
+ var Head = class {
2275
+ #rendered;
2276
+ #prerendering;
2277
+ /** @type {string[]} */
2278
+ #http_equiv = [];
2279
+ /** @type {string[]} */
2280
+ #link_tags = [];
2281
+ /** @type {string[]} */
2282
+ #script_preloads = [];
2283
+ /** @type {string[]} */
2284
+ #style_tags = [];
2285
+ /** @type {string[]} */
2286
+ #stylesheet_links = [];
2287
+ /**
2288
+ * @param {string} rendered
2289
+ * @param {boolean} prerendering
2290
+ */
2291
+ constructor(rendered, prerendering) {
2292
+ this.#rendered = rendered;
2293
+ this.#prerendering = prerendering;
2294
+ }
2295
+ build() {
2296
+ return [
2297
+ ...this.#http_equiv,
2298
+ ...this.#link_tags,
2299
+ ...this.#script_preloads,
2300
+ this.#rendered,
2301
+ ...this.#style_tags,
2302
+ ...this.#stylesheet_links
2303
+ ].join("\n ");
2304
+ }
2305
+ /**
2306
+ * @param {string} style
2307
+ * @param {string[]} attributes
2308
+ */
2309
+ add_style(style, attributes) {
2310
+ this.#style_tags.push(`<style${attributes.length ? " " + attributes.join(" ") : ""}>${style}</style>`);
2311
+ }
2312
+ /**
2313
+ * @param {string} href
2314
+ * @param {string[]} attributes
2315
+ */
2316
+ add_stylesheet(href, attributes) {
2317
+ this.#stylesheet_links.push(`<link href="${href}" ${attributes.join(" ")}>`);
2318
+ }
2319
+ /** @param {string} href */
2320
+ add_script_preload(href) {
2321
+ this.#script_preloads.push(`<link rel="preload" as="script" crossorigin="anonymous" href="${href}">`);
2322
+ }
2323
+ /**
2324
+ * @param {string} href
2325
+ * @param {string[]} attributes
2326
+ */
2327
+ add_link_tag(href, attributes) {
2328
+ if (!this.#prerendering) return;
2329
+ this.#link_tags.push(`<link href="${href}" ${attributes.join(" ")}>`);
2330
+ }
2331
+ /** @param {string} tag */
2332
+ add_http_equiv(tag) {
2333
+ if (!this.#prerendering) return;
2334
+ this.#http_equiv.push(tag);
2335
+ }
2336
+ };
2337
+ //#endregion
2338
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/utils/page_nodes.js
2339
+ var PageNodes = class {
2340
+ /** All layout nodes and the page node, if any */
2341
+ data;
2342
+ /**
2343
+ * @param {Array<import('types').SSRNode | undefined>} nodes
2344
+ */
2345
+ constructor(nodes) {
2346
+ this.data = nodes;
2347
+ }
2348
+ layouts() {
2349
+ return this.data.slice(0, -1);
2350
+ }
2351
+ page() {
2352
+ return this.data.at(-1);
2353
+ }
2354
+ validate() {
2355
+ for (const layout of this.layouts()) if (layout) {
2356
+ validate_layout_server_exports(layout.server, layout.server_id);
2357
+ validate_layout_exports(layout.universal, layout.universal_id);
2358
+ }
2359
+ const page = this.page();
2360
+ if (page) {
2361
+ validate_page_server_exports(page.server, page.server_id);
2362
+ validate_page_exports(page.universal, page.universal_id);
2363
+ }
2364
+ }
2365
+ /**
2366
+ * @template {'prerender' | 'ssr' | 'csr' | 'trailingSlash'} Option
2367
+ * @param {Option} option
2368
+ * @returns {Value | undefined}
2369
+ */
2370
+ #get_option(option) {
2371
+ /** @typedef {(import('types').UniversalNode | import('types').ServerNode)[Option]} Value */
2372
+ return this.data.reduce((value, node) => {
2373
+ return node?.universal?.[option] ?? node?.server?.[option] ?? value;
2374
+ }, void 0);
2375
+ }
2376
+ csr() {
2377
+ return this.#get_option("csr") ?? true;
2378
+ }
2379
+ ssr() {
2380
+ return this.#get_option("ssr") ?? true;
2381
+ }
2382
+ prerender() {
2383
+ return this.#get_option("prerender") ?? false;
2384
+ }
2385
+ trailing_slash() {
2386
+ return this.#get_option("trailingSlash") ?? "never";
2387
+ }
2388
+ get_config() {
2389
+ /** @type {any} */
2390
+ let current = {};
2391
+ for (const node of this.data) {
2392
+ if (!node?.universal?.config && !node?.server?.config) continue;
2393
+ current = {
2394
+ ...current,
2395
+ ...node?.universal?.config,
2396
+ ...node?.server?.config
2397
+ };
2398
+ }
2399
+ return Object.keys(current).length ? current : void 0;
2400
+ }
2401
+ should_prerender_data() {
2402
+ return this.data.some((node) => node?.server?.load || node?.server?.trailingSlash !== void 0);
2403
+ }
2404
+ };
2405
+ //#endregion
2406
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/runtime/server/page/respond_with_error.js
2407
+ /**
2408
+ * @typedef {import('./types.js').Loaded} Loaded
2409
+ */
2410
+ /**
2411
+ * @param {{
2412
+ * event: import('@sveltejs/kit').RequestEvent;
2413
+ * event_state: import('types').RequestState;
2414
+ * options: import('types').SSROptions;
2415
+ * manifest: import('@sveltejs/kit').SSRManifest;
2416
+ * state: import('types').SSRState;
2417
+ * status: number;
2418
+ * error: unknown;
2419
+ * resolve_opts: import('types').RequiredResolveOptions;
2420
+ * }} opts
2421
+ */
2422
+ async function respond_with_error({ event, event_state, options, manifest, state, status, error, resolve_opts }) {
2423
+ if (event.request.headers.get("x-sveltekit-error")) return static_error_page(
2424
+ options,
2425
+ status,
2426
+ /** @type {Error} */
2427
+ error.message
2428
+ );
2429
+ /** @type {import('./types.js').Fetched[]} */
2430
+ const fetched = [];
2431
+ try {
2432
+ const branch = [];
2433
+ const default_layout = await manifest._.nodes[0]();
2434
+ const nodes = new PageNodes([default_layout]);
2435
+ const ssr = nodes.ssr();
2436
+ const csr = nodes.csr();
2437
+ const data_serializer = server_data_serializer(event, event_state, options);
2438
+ if (ssr) {
2439
+ state.error = true;
2440
+ const server_data_promise = load_server_data({
2441
+ event,
2442
+ event_state,
2443
+ state,
2444
+ node: default_layout,
2445
+ parent: async () => ({})
2446
+ });
2447
+ const server_data = await server_data_promise;
2448
+ data_serializer.add_node(0, server_data);
2449
+ const data = await load_data({
2450
+ event,
2451
+ event_state,
2452
+ fetched,
2453
+ node: default_layout,
2454
+ parent: async () => ({}),
2455
+ resolve_opts,
2456
+ server_data_promise,
2457
+ state,
2458
+ csr
2459
+ });
2460
+ branch.push({
2461
+ node: default_layout,
2462
+ server_data,
2463
+ data
2464
+ }, {
2465
+ node: await manifest._.nodes[1](),
2466
+ data: null,
2467
+ server_data: null
2468
+ });
2469
+ }
2470
+ return await render_response({
2471
+ options,
2472
+ manifest,
2473
+ state,
2474
+ page_config: {
2475
+ ssr,
2476
+ csr
2477
+ },
2478
+ status,
2479
+ error: await handle_error_and_jsonify(event, event_state, options, error),
2480
+ branch,
2481
+ error_components: [],
2482
+ fetched,
2483
+ event,
2484
+ event_state,
2485
+ resolve_opts,
2486
+ data_serializer
2487
+ });
2488
+ } catch (e) {
2489
+ if (e instanceof Redirect) return redirect_response(e.status, e.location);
2490
+ return static_error_page(options, get_status(e), (await handle_error_and_jsonify(event, event_state, options, e)).message);
2491
+ }
2492
+ }
2493
+ //#endregion
2494
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/runtime/server/remote.js
2495
+ /** @import { ActionResult, RemoteForm, RequestEvent, SSRManifest } from '@sveltejs/kit' */
2496
+ /** @import { RemoteFormInternals, RemoteFunctionResponse, RemoteInternals, RequestState, SSROptions } from 'types' */
2497
+ /** @type {typeof handle_remote_call_internal} */
2498
+ async function handle_remote_call(event, state, options, manifest, id) {
2499
+ return record_span({
2500
+ name: "sveltekit.remote.call",
2501
+ attributes: { },
2502
+ fn: (current) => {
2503
+ const traced_event = merge_tracing(event, current);
2504
+ return with_request_store({
2505
+ event: traced_event,
2506
+ state
2507
+ }, () => handle_remote_call_internal(traced_event, state, options, manifest, id));
2508
+ }
2509
+ });
2510
+ }
2511
+ /**
2512
+ * @param {RequestEvent} event
2513
+ * @param {RequestState} state
2514
+ * @param {SSROptions} options
2515
+ * @param {SSRManifest} manifest
2516
+ * @param {string} id
2517
+ */
2518
+ async function handle_remote_call_internal(event, state, options, manifest, id) {
2519
+ const [hash, name, additional_args] = id.split("/");
2520
+ const remotes = manifest._.remotes;
2521
+ if (!remotes[hash]) error(404);
2522
+ const fn = (await remotes[hash]()).default[name];
2523
+ if (!fn) error(404);
2524
+ /** @type {RemoteInternals} */
2525
+ const internals = fn.__;
2526
+ const transport = options.hooks.transport;
2527
+ event.tracing.current.setAttributes({
2528
+ "sveltekit.remote.call.type": internals.type,
2529
+ "sveltekit.remote.call.name": internals.name
2530
+ });
2531
+ try {
2532
+ if (internals.type === "query_batch") {
2533
+ if (event.request.method !== "POST") throw new SvelteKitError(405, "Method Not Allowed", `\`query.batch\` functions must be invoked via POST request, not ${event.request.method}`);
2534
+ /** @type {{ payloads: string[] }} */
2535
+ const { payloads } = await event.request.json();
2536
+ const args = await Promise.all(payloads.map((payload) => parse_remote_arg(payload, transport)));
2537
+ return json({
2538
+ type: "result",
2539
+ result: stringify(await with_request_store({
2540
+ event,
2541
+ state
2542
+ }, () => internals.run(args, options)), transport)
2543
+ });
2544
+ }
2545
+ if (internals.type === "form") {
2546
+ if (event.request.method !== "POST") throw new SvelteKitError(405, "Method Not Allowed", `\`form\` functions must be invoked via POST request, not ${event.request.method}`);
2547
+ if (!is_form_content_type(event.request)) throw new SvelteKitError(415, "Unsupported Media Type", `\`form\` functions expect form-encoded data — received ${event.request.headers.get("content-type")}`);
2548
+ const { data, meta, form_data } = await deserialize_binary_form(event.request);
2549
+ state.remote.requested = create_requested_map(meta.remote_refreshes);
2550
+ if (additional_args && !("id" in data)) data.id = JSON.parse(decodeURIComponent(additional_args));
2551
+ const fn = internals.fn;
2552
+ const result = await with_request_store({
2553
+ event,
2554
+ state
2555
+ }, () => fn(data, meta, form_data));
2556
+ return json({
2557
+ type: "result",
2558
+ result: stringify(result, transport),
2559
+ refreshes: result.issues ? void 0 : await serialize_singleflight(state.remote.refreshes),
2560
+ reconnects: result.issues ? void 0 : await serialize_singleflight(state.remote.reconnects)
2561
+ });
2562
+ }
2563
+ if (internals.type === "command") {
2564
+ /** @type {{ payload: string, refreshes?: string[] }} */
2565
+ const { payload, refreshes } = await event.request.json();
2566
+ state.remote.requested = create_requested_map(refreshes);
2567
+ const arg = parse_remote_arg(payload, transport);
2568
+ return json({
2569
+ type: "result",
2570
+ result: stringify(await with_request_store({
2571
+ event,
2572
+ state
2573
+ }, () => fn(arg)), transport),
2574
+ refreshes: await serialize_singleflight(state.remote.refreshes),
2575
+ reconnects: await serialize_singleflight(state.remote.reconnects)
2576
+ });
2577
+ }
2578
+ if (internals.type === "query_live") {
2579
+ if (event.request.method !== "GET") throw new SvelteKitError(405, "Method Not Allowed", `\`query.live\` functions must be invoked via GET request, not ${event.request.method}`);
2580
+ const payload = new URL(event.request.url).searchParams.get("payload");
2581
+ const generator = internals.run(event, state, parse_remote_arg(payload, transport));
2582
+ const encoder = new TextEncoder();
2583
+ /**
2584
+ * @param {ReadableStreamDefaultController} controller
2585
+ * @param {any} payload
2586
+ */
2587
+ function send(controller, payload) {
2588
+ controller.enqueue(encoder.encode(JSON.stringify(payload) + "\n"));
2589
+ }
2590
+ let closed = false;
2591
+ /** @type {string | undefined} */
2592
+ let result = void 0;
2593
+ async function cancel() {
2594
+ if (closed) return;
2595
+ closed = true;
2596
+ await generator.return(void 0);
2597
+ }
2598
+ event.request.signal.addEventListener("abort", cancel, { once: true });
2599
+ return new Response(new ReadableStream({
2600
+ async pull(controller) {
2601
+ if (event.request.signal.aborted) {
2602
+ await cancel();
2603
+ controller.close();
2604
+ return;
2605
+ }
2606
+ try {
2607
+ while (true) {
2608
+ const { value, done } = await generator.next();
2609
+ if (done) {
2610
+ await cancel();
2611
+ controller.close();
2612
+ return;
2613
+ }
2614
+ if (result !== (result = stringify(value, transport))) {
2615
+ send(controller, {
2616
+ type: "result",
2617
+ result
2618
+ });
2619
+ return;
2620
+ }
2621
+ }
2622
+ } catch (error) {
2623
+ if (!event.request.signal.aborted) if (error instanceof Redirect) send(controller, {
2624
+ type: "redirect",
2625
+ location: error.location
2626
+ });
2627
+ else {
2628
+ const status = error instanceof HttpError || error instanceof SvelteKitError ? error.status : 500;
2629
+ send(controller, {
2630
+ type: "error",
2631
+ error: await handle_error_and_jsonify(event, state, options, error),
2632
+ status
2633
+ });
2634
+ }
2635
+ await cancel();
2636
+ controller.close();
2637
+ }
2638
+ },
2639
+ cancel
2640
+ }), { headers: {
2641
+ "cache-control": "private, no-store",
2642
+ "content-type": "application/x-ndjson"
2643
+ } });
2644
+ }
2645
+ const payload = internals.type === "prerender" ? additional_args : new URL(event.request.url).searchParams.get("payload");
2646
+ return json({
2647
+ type: "result",
2648
+ result: stringify(await with_request_store({
2649
+ event,
2650
+ state
2651
+ }, () => fn(parse_remote_arg(payload, transport))), transport)
2652
+ });
2653
+ } catch (error) {
2654
+ if (error instanceof Redirect) return json({
2655
+ type: "redirect",
2656
+ location: error.location,
2657
+ refreshes: await serialize_singleflight(state.remote.refreshes),
2658
+ reconnects: await serialize_singleflight(state.remote.reconnects)
2659
+ });
2660
+ const status = error instanceof HttpError || error instanceof SvelteKitError ? error.status : 500;
2661
+ return json({
2662
+ type: "error",
2663
+ error: await handle_error_and_jsonify(event, state, options, error),
2664
+ status
2665
+ }, {
2666
+ status: state.prerendering ? status : void 0,
2667
+ headers: { "cache-control": "private, no-store" }
2668
+ });
2669
+ }
2670
+ /** @param {Map<string, Promise<any>> | null} map */
2671
+ async function serialize_singleflight(map) {
2672
+ if (!map || map.size === 0) return;
2673
+ const results = await Promise.all(Array.from(map, async ([key, promise]) => {
2674
+ try {
2675
+ return [key, {
2676
+ type: "result",
2677
+ data: await promise
2678
+ }];
2679
+ } catch (error) {
2680
+ return [key, {
2681
+ type: "error",
2682
+ status: error instanceof HttpError || error instanceof SvelteKitError ? error.status : 500,
2683
+ error: await handle_error_and_jsonify(event, state, options, error)
2684
+ }];
2685
+ }
2686
+ }));
2687
+ return stringify(Object.fromEntries(results), transport);
2688
+ }
2689
+ }
2690
+ /**
2691
+ * @param {string[] | undefined} refreshes
2692
+ */
2693
+ function create_requested_map(refreshes) {
2694
+ /** @type {Map<string, string[]>} */
2695
+ const requested = /* @__PURE__ */ new Map();
2696
+ for (const key of refreshes ?? []) {
2697
+ const parts = split_remote_key(key);
2698
+ const existing = requested.get(parts.id);
2699
+ if (existing) existing.push(parts.payload);
2700
+ else requested.set(parts.id, [parts.payload]);
2701
+ }
2702
+ return requested;
2703
+ }
2704
+ /** @type {typeof handle_remote_form_post_internal} */
2705
+ async function handle_remote_form_post(event, state, manifest, id) {
2706
+ return record_span({
2707
+ name: "sveltekit.remote.form.post",
2708
+ attributes: { },
2709
+ fn: (current) => {
2710
+ const traced_event = merge_tracing(event, current);
2711
+ return with_request_store({
2712
+ event: traced_event,
2713
+ state
2714
+ }, () => handle_remote_form_post_internal(traced_event, state, manifest, id));
2715
+ }
2716
+ });
2717
+ }
2718
+ /**
2719
+ * @param {RequestEvent} event
2720
+ * @param {RequestState} state
2721
+ * @param {SSRManifest} manifest
2722
+ * @param {string} id
2723
+ * @returns {Promise<ActionResult>}
2724
+ */
2725
+ async function handle_remote_form_post_internal(event, state, manifest, id) {
2726
+ const [hash, name, action_id] = id.split("/");
2727
+ let form = (await manifest._.remotes[hash]?.())?.default[name];
2728
+ if (!form) {
2729
+ event.setHeaders({ allow: "GET" });
2730
+ return {
2731
+ type: "error",
2732
+ error: new SvelteKitError(405, "Method Not Allowed", `POST method not allowed. No form actions exist for this page`)
2733
+ };
2734
+ }
2735
+ if (action_id) form = with_request_store({
2736
+ event,
2737
+ state
2738
+ }, () => form.for(JSON.parse(action_id)));
2739
+ try {
2740
+ const fn = form.__.fn;
2741
+ const { data, meta, form_data } = await deserialize_binary_form(event.request);
2742
+ if (action_id && !("id" in data)) data.id = JSON.parse(decodeURIComponent(action_id));
2743
+ await with_request_store({
2744
+ event,
2745
+ state
2746
+ }, () => fn(data, meta, form_data));
2747
+ return {
2748
+ type: "success",
2749
+ status: 200
2750
+ };
2751
+ } catch (e) {
2752
+ const err = normalize_error(e);
2753
+ if (err instanceof Redirect) return {
2754
+ type: "redirect",
2755
+ status: err.status,
2756
+ location: err.location
2757
+ };
2758
+ return {
2759
+ type: "error",
2760
+ error: check_incorrect_fail_use(err)
2761
+ };
2762
+ }
2763
+ }
2764
+ /**
2765
+ * @param {URL} url
2766
+ */
2767
+ function get_remote_id(url) {
2768
+ return url.pathname.startsWith(`${base}/_app/remote/`) && url.pathname.replace(`${base}/_app/remote/`, "");
2769
+ }
2770
+ /**
2771
+ * @param {URL} url
2772
+ */
2773
+ function get_remote_action(url) {
2774
+ return url.searchParams.get("/remote");
2775
+ }
2776
+ //#endregion
2777
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/runtime/server/page/index.js
2778
+ /** @import { ActionResult, RequestEvent, SSRManifest } from '@sveltejs/kit' */
2779
+ /** @import { PageNodeIndexes, RequestState, RequiredResolveOptions, ServerDataNode, SSRComponent, SSRNode, SSROptions, SSRState } from 'types' */
2780
+ /**
2781
+ * The maximum request depth permitted before assuming we're stuck in an infinite loop
2782
+ */
2783
+ var MAX_DEPTH = 10;
2784
+ /**
2785
+ * @param {RequestEvent} event
2786
+ * @param {RequestState} event_state
2787
+ * @param {PageNodeIndexes} page
2788
+ * @param {SSROptions} options
2789
+ * @param {SSRManifest} manifest
2790
+ * @param {SSRState} state
2791
+ * @param {import('../../../utils/page_nodes.js').PageNodes} nodes
2792
+ * @param {RequiredResolveOptions} resolve_opts
2793
+ * @returns {Promise<Response>}
2794
+ */
2795
+ async function render_page(event, event_state, page, options, manifest, state, nodes, resolve_opts) {
2796
+ if (state.depth > MAX_DEPTH) return text(`Not found: ${event.url.pathname}`, { status: 404 });
2797
+ if (is_action_json_request(event)) return handle_action_json_request(event, event_state, options, (await manifest._.nodes[page.leaf]())?.server);
2798
+ try {
2799
+ const leaf_node = nodes.page();
2800
+ let status = 200;
2801
+ /** @type {ActionResult | undefined} */
2802
+ let action_result = void 0;
2803
+ if (is_action_request(event)) {
2804
+ const remote_id = get_remote_action(event.url);
2805
+ if (remote_id) action_result = await handle_remote_form_post(event, event_state, manifest, remote_id);
2806
+ else action_result = await handle_action_request(event, event_state, leaf_node.server);
2807
+ if (action_result?.type === "redirect") return redirect_response(action_result.status, action_result.location);
2808
+ if (action_result?.type === "error") status = get_status(action_result.error);
2809
+ if (action_result?.type === "failure") status = action_result.status;
2810
+ }
2811
+ const should_prerender = nodes.prerender();
2812
+ if (should_prerender) {
2813
+ if (leaf_node.server?.actions) throw new Error("Cannot prerender pages with actions");
2814
+ } else if (state.prerendering) return new Response(void 0, { status: 204 });
2815
+ state.prerender_default = should_prerender;
2816
+ const should_prerender_data = nodes.should_prerender_data();
2817
+ const data_pathname = add_data_suffix(event.url.pathname);
2818
+ /** @type {import('./types.js').Fetched[]} */
2819
+ const fetched = [];
2820
+ const ssr = nodes.ssr();
2821
+ const csr = nodes.csr();
2822
+ if (ssr === false && !(state.prerendering && should_prerender_data)) return await render_response({
2823
+ branch: compact(nodes.data).map((node) => {
2824
+ return {
2825
+ node,
2826
+ data: null,
2827
+ server_data: null
2828
+ };
2829
+ }),
2830
+ fetched,
2831
+ page_config: {
2832
+ ssr: false,
2833
+ csr
2834
+ },
2835
+ status,
2836
+ error: null,
2837
+ event,
2838
+ event_state,
2839
+ options,
2840
+ manifest,
2841
+ state,
2842
+ resolve_opts,
2843
+ data_serializer: server_data_serializer(event, event_state, options)
2844
+ });
2845
+ /** @type {Array<import('./types.js').Loaded | null>} */
2846
+ const branch = [];
2847
+ /** @type {Error | null} */
2848
+ let load_error = null;
2849
+ const data_serializer = server_data_serializer(event, event_state, options);
2850
+ const data_serializer_json = state.prerendering && should_prerender_data ? server_data_serializer_json(event, event_state, options) : null;
2851
+ /** @type {Array<Promise<ServerDataNode | null>>} */
2852
+ const server_promises = nodes.data.map((node, i) => {
2853
+ if (load_error) throw load_error;
2854
+ return Promise.resolve().then(async () => {
2855
+ try {
2856
+ if (node === leaf_node && action_result?.type === "error") throw action_result.error;
2857
+ const server_data = await load_server_data({
2858
+ event,
2859
+ event_state,
2860
+ state,
2861
+ node,
2862
+ parent: async () => {
2863
+ /** @type {Record<string, any>} */
2864
+ const data = {};
2865
+ for (let j = 0; j < i; j += 1) {
2866
+ const parent = await server_promises[j];
2867
+ if (parent) Object.assign(data, parent.data);
2868
+ }
2869
+ return data;
2870
+ }
2871
+ });
2872
+ if (node) data_serializer.add_node(i, server_data);
2873
+ data_serializer_json?.add_node(i, server_data);
2874
+ return server_data;
2875
+ } catch (e) {
2876
+ load_error = e;
2877
+ throw load_error;
2878
+ }
2879
+ });
2880
+ });
2881
+ /** @type {Array<Promise<Record<string, any> | null>>} */
2882
+ const load_promises = nodes.data.map((node, i) => {
2883
+ if (load_error) throw load_error;
2884
+ return Promise.resolve().then(async () => {
2885
+ try {
2886
+ return await load_data({
2887
+ event,
2888
+ event_state,
2889
+ fetched,
2890
+ node,
2891
+ parent: async () => {
2892
+ const data = {};
2893
+ for (let j = 0; j < i; j += 1) Object.assign(data, await load_promises[j]);
2894
+ return data;
2895
+ },
2896
+ resolve_opts,
2897
+ server_data_promise: server_promises[i],
2898
+ state,
2899
+ csr
2900
+ });
2901
+ } catch (e) {
2902
+ load_error = e;
2903
+ throw load_error;
2904
+ }
2905
+ });
2906
+ });
2907
+ for (const p of server_promises) p.catch(noop);
2908
+ for (const p of load_promises) p.catch(noop);
2909
+ for (let i = 0; i < nodes.data.length; i += 1) {
2910
+ const node = nodes.data[i];
2911
+ if (node) try {
2912
+ const server_data = await server_promises[i];
2913
+ const data = await load_promises[i];
2914
+ branch.push({
2915
+ node,
2916
+ server_data,
2917
+ data
2918
+ });
2919
+ } catch (e) {
2920
+ const err = normalize_error(e);
2921
+ if (err instanceof Redirect) {
2922
+ if (state.prerendering && should_prerender_data) {
2923
+ const body = JSON.stringify({
2924
+ type: "redirect",
2925
+ location: err.location
2926
+ });
2927
+ state.prerendering.dependencies.set(data_pathname, {
2928
+ response: text(body),
2929
+ body
2930
+ });
2931
+ }
2932
+ return redirect_response(err.status, err.location);
2933
+ }
2934
+ const status = get_status(err);
2935
+ const error = await handle_error_and_jsonify(event, event_state, options, err);
2936
+ while (i--) if (page.errors[i]) {
2937
+ const index = page.errors[i];
2938
+ const node = await manifest._.nodes[index]();
2939
+ let j = i;
2940
+ while (!branch[j]) j -= 1;
2941
+ data_serializer.set_max_nodes(j + 1);
2942
+ const layouts = compact(branch.slice(0, j + 1));
2943
+ const nodes = new PageNodes(layouts.map((layout) => layout.node));
2944
+ const error_branch = layouts.concat({
2945
+ node,
2946
+ data: null,
2947
+ server_data: null
2948
+ });
2949
+ return await render_response({
2950
+ event,
2951
+ event_state,
2952
+ options,
2953
+ manifest,
2954
+ state,
2955
+ resolve_opts,
2956
+ page_config: {
2957
+ ssr: nodes.ssr(),
2958
+ csr: nodes.csr()
2959
+ },
2960
+ status,
2961
+ error,
2962
+ error_components: await load_error_components(options, ssr, error_branch, page, manifest),
2963
+ branch: error_branch,
2964
+ fetched,
2965
+ data_serializer
2966
+ });
2967
+ }
2968
+ return static_error_page(options, status, error.message);
2969
+ }
2970
+ else branch.push(null);
2971
+ }
2972
+ if (state.prerendering && data_serializer_json) {
2973
+ let { data, chunks } = data_serializer_json.get_data();
2974
+ if (chunks) for await (const chunk of chunks) data += chunk;
2975
+ state.prerendering.dependencies.set(data_pathname, {
2976
+ response: text(data),
2977
+ body: data
2978
+ });
2979
+ }
2980
+ return await render_response({
2981
+ event,
2982
+ event_state,
2983
+ options,
2984
+ manifest,
2985
+ state,
2986
+ resolve_opts,
2987
+ page_config: {
2988
+ csr,
2989
+ ssr
2990
+ },
2991
+ status,
2992
+ error: null,
2993
+ branch: compact(branch),
2994
+ action_result,
2995
+ fetched,
2996
+ data_serializer: !ssr ? server_data_serializer(event, event_state, options) : data_serializer,
2997
+ error_components: await load_error_components(options, ssr, branch, page, manifest)
2998
+ });
2999
+ } catch (e) {
3000
+ if (e instanceof Redirect) return redirect_response(e.status, e.location);
3001
+ return await respond_with_error({
3002
+ event,
3003
+ event_state,
3004
+ options,
3005
+ manifest,
3006
+ state,
3007
+ status: e instanceof HttpError ? e.status : 500,
3008
+ error: e,
3009
+ resolve_opts
3010
+ });
3011
+ }
3012
+ }
3013
+ /**
3014
+ *
3015
+ * @param {SSROptions} options
3016
+ * @param {boolean} ssr
3017
+ * @param {Array<import('./types.js').Loaded | null>} branch
3018
+ * @param {PageNodeIndexes} page
3019
+ * @param {SSRManifest} manifest
3020
+ */
3021
+ async function load_error_components(options, ssr, branch, page, manifest) {
3022
+ /** @type {Array<SSRComponent | undefined> | undefined} */
3023
+ let error_components;
3024
+ if (options.server_error_boundaries && ssr) {
3025
+ let last_idx = -1;
3026
+ error_components = await Promise.all(branch.map((b, i) => {
3027
+ if (i === 0) return void 0;
3028
+ if (!b) return null;
3029
+ i--;
3030
+ while (i > last_idx + 1 && page.errors[i] === void 0) i -= 1;
3031
+ last_idx = i;
3032
+ const idx = page.errors[i];
3033
+ if (idx == null) return void 0;
3034
+ return manifest._.nodes[idx]?.().then((e) => e.component?.()).catch(() => void 0);
3035
+ }).filter((e) => e !== null));
3036
+ }
3037
+ return error_components;
3038
+ }
3039
+ //#endregion
3040
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/runtime/server/data/index.js
3041
+ /**
3042
+ * @param {import('@sveltejs/kit').RequestEvent} event
3043
+ * @param {import('types').RequestState} event_state
3044
+ * @param {import('types').SSRRoute} route
3045
+ * @param {import('types').SSROptions} options
3046
+ * @param {import('@sveltejs/kit').SSRManifest} manifest
3047
+ * @param {import('types').SSRState} state
3048
+ * @param {boolean[] | undefined} invalidated_data_nodes
3049
+ * @param {import('types').TrailingSlash} trailing_slash
3050
+ * @returns {Promise<Response>}
3051
+ */
3052
+ async function render_data(event, event_state, route, options, manifest, state, invalidated_data_nodes, trailing_slash) {
3053
+ if (!route.page) return new Response(void 0, { status: 404 });
3054
+ try {
3055
+ const node_ids = [...route.page.layouts, route.page.leaf];
3056
+ const invalidated = invalidated_data_nodes ?? node_ids.map(() => true);
3057
+ let aborted = false;
3058
+ const url = new URL(event.url);
3059
+ url.pathname = normalize_path(url.pathname, trailing_slash);
3060
+ const new_event = {
3061
+ ...event,
3062
+ url
3063
+ };
3064
+ const functions = node_ids.map((n, i) => {
3065
+ return once(async () => {
3066
+ try {
3067
+ if (aborted) return { type: "skip" };
3068
+ return load_server_data({
3069
+ event: new_event,
3070
+ event_state,
3071
+ state,
3072
+ node: n == void 0 ? n : await manifest._.nodes[n](),
3073
+ parent: async () => {
3074
+ /** @type {Record<string, any>} */
3075
+ const data = {};
3076
+ for (let j = 0; j < i; j += 1) {
3077
+ const parent = await functions[j]();
3078
+ if (parent) Object.assign(data, parent.data);
3079
+ }
3080
+ return data;
3081
+ }
3082
+ });
3083
+ } catch (e) {
3084
+ aborted = true;
3085
+ throw e;
3086
+ }
3087
+ });
3088
+ });
3089
+ const promises = functions.map(async (fn, i) => {
3090
+ if (!invalidated[i]) return { type: "skip" };
3091
+ return fn();
3092
+ });
3093
+ let length = promises.length;
3094
+ const nodes = await Promise.all(promises.map((p, i) => p.catch(async (error) => {
3095
+ if (error instanceof Redirect) throw error;
3096
+ length = Math.min(length, i + 1);
3097
+ return {
3098
+ type: "error",
3099
+ error: await handle_error_and_jsonify(event, event_state, options, error),
3100
+ status: error instanceof HttpError || error instanceof SvelteKitError ? error.status : void 0
3101
+ };
3102
+ })));
3103
+ const data_serializer = server_data_serializer_json(event, event_state, options);
3104
+ for (let i = 0; i < nodes.length; i++) data_serializer.add_node(i, nodes[i]);
3105
+ const { data, chunks } = data_serializer.get_data();
3106
+ if (!chunks) return json_response(data);
3107
+ return new Response(new ReadableStream({
3108
+ async start(controller) {
3109
+ controller.enqueue(text_encoder.encode(data));
3110
+ for await (const chunk of chunks) controller.enqueue(text_encoder.encode(chunk));
3111
+ controller.close();
3112
+ },
3113
+ type: "bytes"
3114
+ }), { headers: {
3115
+ "content-type": "text/sveltekit-data",
3116
+ "cache-control": "private, no-store"
3117
+ } });
3118
+ } catch (e) {
3119
+ const error = normalize_error(e);
3120
+ if (error instanceof Redirect) return redirect_json_response(error);
3121
+ else return json_response(await handle_error_and_jsonify(event, event_state, options, error), 500);
3122
+ }
3123
+ }
3124
+ /**
3125
+ * @param {Record<string, any> | string} json
3126
+ * @param {number} [status]
3127
+ */
3128
+ function json_response(json, status = 200) {
3129
+ return text(typeof json === "string" ? json : JSON.stringify(json), {
3130
+ status,
3131
+ headers: {
3132
+ "content-type": "application/json",
3133
+ "cache-control": "private, no-store"
3134
+ }
3135
+ });
3136
+ }
3137
+ /**
3138
+ * @param {Redirect} redirect
3139
+ */
3140
+ function redirect_json_response(redirect) {
3141
+ return json_response({
3142
+ type: "redirect",
3143
+ location: redirect.location
3144
+ });
3145
+ }
3146
+ /*!
3147
+ * cookie
3148
+ * Copyright(c) 2012-2014 Roman Shtylman
3149
+ * Copyright(c) 2015 Douglas Christopher Wilson
3150
+ * MIT Licensed
3151
+ */
3152
+ //#endregion
3153
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/runtime/server/cookie.js
3154
+ var import_cookie = (/* @__PURE__ */ __commonJSMin(((exports) => {
3155
+ /**
3156
+ * Module exports.
3157
+ * @public
3158
+ */
3159
+ exports.parse = parse;
3160
+ exports.serialize = serialize;
3161
+ /**
3162
+ * Module variables.
3163
+ * @private
3164
+ */
3165
+ var __toString = Object.prototype.toString;
3166
+ /**
3167
+ * RegExp to match field-content in RFC 7230 sec 3.2
3168
+ *
3169
+ * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
3170
+ * field-vchar = VCHAR / obs-text
3171
+ * obs-text = %x80-FF
3172
+ */
3173
+ var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
3174
+ /**
3175
+ * Parse a cookie header.
3176
+ *
3177
+ * Parse the given cookie header string into an object
3178
+ * The object has the various cookies as keys(names) => values
3179
+ *
3180
+ * @param {string} str
3181
+ * @param {object} [options]
3182
+ * @return {object}
3183
+ * @public
3184
+ */
3185
+ function parse(str, options) {
3186
+ if (typeof str !== "string") throw new TypeError("argument str must be a string");
3187
+ var obj = {};
3188
+ var dec = (options || {}).decode || decode;
3189
+ var index = 0;
3190
+ while (index < str.length) {
3191
+ var eqIdx = str.indexOf("=", index);
3192
+ if (eqIdx === -1) break;
3193
+ var endIdx = str.indexOf(";", index);
3194
+ if (endIdx === -1) endIdx = str.length;
3195
+ else if (endIdx < eqIdx) {
3196
+ index = str.lastIndexOf(";", eqIdx - 1) + 1;
3197
+ continue;
3198
+ }
3199
+ var key = str.slice(index, eqIdx).trim();
3200
+ if (void 0 === obj[key]) {
3201
+ var val = str.slice(eqIdx + 1, endIdx).trim();
3202
+ if (val.charCodeAt(0) === 34) val = val.slice(1, -1);
3203
+ obj[key] = tryDecode(val, dec);
3204
+ }
3205
+ index = endIdx + 1;
3206
+ }
3207
+ return obj;
3208
+ }
3209
+ /**
3210
+ * Serialize data into a cookie header.
3211
+ *
3212
+ * Serialize the a name value pair into a cookie string suitable for
3213
+ * http headers. An optional options object specified cookie parameters.
3214
+ *
3215
+ * serialize('foo', 'bar', { httpOnly: true })
3216
+ * => "foo=bar; httpOnly"
3217
+ *
3218
+ * @param {string} name
3219
+ * @param {string} val
3220
+ * @param {object} [options]
3221
+ * @return {string}
3222
+ * @public
3223
+ */
3224
+ function serialize(name, val, options) {
3225
+ var opt = options || {};
3226
+ var enc = opt.encode || encode;
3227
+ if (typeof enc !== "function") throw new TypeError("option encode is invalid");
3228
+ if (!fieldContentRegExp.test(name)) throw new TypeError("argument name is invalid");
3229
+ var value = enc(val);
3230
+ if (value && !fieldContentRegExp.test(value)) throw new TypeError("argument val is invalid");
3231
+ var str = name + "=" + value;
3232
+ if (null != opt.maxAge) {
3233
+ var maxAge = opt.maxAge - 0;
3234
+ if (isNaN(maxAge) || !isFinite(maxAge)) throw new TypeError("option maxAge is invalid");
3235
+ str += "; Max-Age=" + Math.floor(maxAge);
3236
+ }
3237
+ if (opt.domain) {
3238
+ if (!fieldContentRegExp.test(opt.domain)) throw new TypeError("option domain is invalid");
3239
+ str += "; Domain=" + opt.domain;
3240
+ }
3241
+ if (opt.path) {
3242
+ if (!fieldContentRegExp.test(opt.path)) throw new TypeError("option path is invalid");
3243
+ str += "; Path=" + opt.path;
3244
+ }
3245
+ if (opt.expires) {
3246
+ var expires = opt.expires;
3247
+ if (!isDate(expires) || isNaN(expires.valueOf())) throw new TypeError("option expires is invalid");
3248
+ str += "; Expires=" + expires.toUTCString();
3249
+ }
3250
+ if (opt.httpOnly) str += "; HttpOnly";
3251
+ if (opt.secure) str += "; Secure";
3252
+ if (opt.partitioned) str += "; Partitioned";
3253
+ if (opt.priority) switch (typeof opt.priority === "string" ? opt.priority.toLowerCase() : opt.priority) {
3254
+ case "low":
3255
+ str += "; Priority=Low";
3256
+ break;
3257
+ case "medium":
3258
+ str += "; Priority=Medium";
3259
+ break;
3260
+ case "high":
3261
+ str += "; Priority=High";
3262
+ break;
3263
+ default: throw new TypeError("option priority is invalid");
3264
+ }
3265
+ if (opt.sameSite) switch (typeof opt.sameSite === "string" ? opt.sameSite.toLowerCase() : opt.sameSite) {
3266
+ case true:
3267
+ str += "; SameSite=Strict";
3268
+ break;
3269
+ case "lax":
3270
+ str += "; SameSite=Lax";
3271
+ break;
3272
+ case "strict":
3273
+ str += "; SameSite=Strict";
3274
+ break;
3275
+ case "none":
3276
+ str += "; SameSite=None";
3277
+ break;
3278
+ default: throw new TypeError("option sameSite is invalid");
3279
+ }
3280
+ return str;
3281
+ }
3282
+ /**
3283
+ * URL-decode string value. Optimized to skip native call when no %.
3284
+ *
3285
+ * @param {string} str
3286
+ * @returns {string}
3287
+ */
3288
+ function decode(str) {
3289
+ return str.indexOf("%") !== -1 ? decodeURIComponent(str) : str;
3290
+ }
3291
+ /**
3292
+ * URL-encode value.
3293
+ *
3294
+ * @param {string} val
3295
+ * @returns {string}
3296
+ */
3297
+ function encode(val) {
3298
+ return encodeURIComponent(val);
3299
+ }
3300
+ /**
3301
+ * Determine if value is a Date.
3302
+ *
3303
+ * @param {*} val
3304
+ * @private
3305
+ */
3306
+ function isDate(val) {
3307
+ return __toString.call(val) === "[object Date]" || val instanceof Date;
3308
+ }
3309
+ /**
3310
+ * Try decoding a string using a decoding function.
3311
+ *
3312
+ * @param {string} str
3313
+ * @param {function} decode
3314
+ * @private
3315
+ */
3316
+ function tryDecode(str, decode) {
3317
+ try {
3318
+ return decode(str);
3319
+ } catch (e) {
3320
+ return str;
3321
+ }
3322
+ }
3323
+ })))();
3324
+ var INVALID_COOKIE_CHARACTER_REGEX = /[\x00-\x1F\x7F()<>@,;:"/[\]?={} \t]/;
3325
+ /** @param {import('./page/types.js').Cookie['options']} options */
3326
+ function validate_options(options) {
3327
+ if (options?.path === void 0) throw new Error("You must specify a `path` when setting, deleting or serializing cookies");
3328
+ }
3329
+ /**
3330
+ * Generates a unique key for a cookie based on its domain, path, and name in
3331
+ * the format: `<domain>/<path>?<name>`.
3332
+ * If domain is undefined, it will be omitted.
3333
+ * For example: `/?name`, `example.com/foo?name`.
3334
+ *
3335
+ * @param {string | undefined} domain
3336
+ * @param {string} path
3337
+ * @param {string} name
3338
+ * @returns {string}
3339
+ */
3340
+ function generate_cookie_key(domain, path, name) {
3341
+ return `${domain || ""}${path}?${encodeURIComponent(name)}`;
3342
+ }
3343
+ /**
3344
+ * @param {Request} request
3345
+ * @param {URL} url
3346
+ */
3347
+ function get_cookies(request, url) {
3348
+ const header = request.headers.get("cookie") ?? "";
3349
+ const initial_cookies = (0, import_cookie.parse)(header, { decode: (value) => value });
3350
+ /** @type {string | undefined} */
3351
+ let normalized_url;
3352
+ /** @type {Map<string, import('./page/types.js').Cookie>} */
3353
+ const new_cookies = /* @__PURE__ */ new Map();
3354
+ /** @type {import('cookie').CookieSerializeOptions} */
3355
+ const defaults = {
3356
+ httpOnly: true,
3357
+ sameSite: "lax",
3358
+ secure: url.hostname === "localhost" && url.protocol === "http:" ? false : true
3359
+ };
3360
+ /** @type {import('@sveltejs/kit').Cookies} */
3361
+ const cookies = {
3362
+ /**
3363
+ * @param {string} name
3364
+ * @param {import('cookie').CookieParseOptions} [opts]
3365
+ */
3366
+ get(name, opts) {
3367
+ const best_match = Array.from(new_cookies.values()).filter((c) => {
3368
+ return c.name === name && domain_matches(url.hostname, c.options.domain) && path_matches(url.pathname, c.options.path);
3369
+ }).sort((a, b) => b.options.path.length - a.options.path.length)[0];
3370
+ if (best_match) return best_match.options.maxAge === 0 ? void 0 : best_match.value;
3371
+ return (0, import_cookie.parse)(header, { decode: opts?.decode })[name];
3372
+ },
3373
+ /**
3374
+ * @param {import('cookie').CookieParseOptions} [opts]
3375
+ */
3376
+ getAll(opts) {
3377
+ const cookies = (0, import_cookie.parse)(header, { decode: opts?.decode });
3378
+ const lookup = /* @__PURE__ */ new Map();
3379
+ for (const c of new_cookies.values()) if (domain_matches(url.hostname, c.options.domain) && path_matches(url.pathname, c.options.path)) {
3380
+ const existing = lookup.get(c.name);
3381
+ if (!existing || c.options.path.length > existing.options.path.length) lookup.set(c.name, c);
3382
+ }
3383
+ for (const c of lookup.values()) cookies[c.name] = c.value;
3384
+ return Object.entries(cookies).map(([name, value]) => ({
3385
+ name,
3386
+ value
3387
+ }));
3388
+ },
3389
+ /**
3390
+ * @param {string} name
3391
+ * @param {string} value
3392
+ * @param {import('./page/types.js').Cookie['options']} options
3393
+ */
3394
+ set(name, value, options) {
3395
+ const illegal_characters = name.match(INVALID_COOKIE_CHARACTER_REGEX);
3396
+ if (illegal_characters) console.warn(`The cookie name "${name}" will be invalid in SvelteKit 3.0 as it contains ${illegal_characters.join(" and ")}. See RFC 2616 for more details https://datatracker.ietf.org/doc/html/rfc2616#section-2.2`);
3397
+ validate_options(options);
3398
+ set_internal(name, value, {
3399
+ ...defaults,
3400
+ ...options
3401
+ });
3402
+ },
3403
+ /**
3404
+ * @param {string} name
3405
+ * @param {import('./page/types.js').Cookie['options']} options
3406
+ */
3407
+ delete(name, options) {
3408
+ validate_options(options);
3409
+ cookies.set(name, "", {
3410
+ ...options,
3411
+ maxAge: 0
3412
+ });
3413
+ },
3414
+ /**
3415
+ * @param {string} name
3416
+ * @param {string} value
3417
+ * @param {import('./page/types.js').Cookie['options']} options
3418
+ */
3419
+ serialize(name, value, options) {
3420
+ validate_options(options);
3421
+ let path = options.path;
3422
+ if (!options.domain || options.domain === url.hostname) {
3423
+ if (!normalized_url) throw new Error("Cannot serialize cookies until after the route is determined");
3424
+ path = resolve(normalized_url, path);
3425
+ }
3426
+ return (0, import_cookie.serialize)(name, value, {
3427
+ ...defaults,
3428
+ ...options,
3429
+ path
3430
+ });
3431
+ }
3432
+ };
3433
+ /**
3434
+ * @param {URL} destination
3435
+ * @param {string | null} header
3436
+ */
3437
+ function get_cookie_header(destination, header) {
3438
+ /** @type {Record<string, string>} */
3439
+ const combined_cookies = { ...initial_cookies };
3440
+ for (const cookie of new_cookies.values()) {
3441
+ if (!domain_matches(destination.hostname, cookie.options.domain)) continue;
3442
+ if (!path_matches(destination.pathname, cookie.options.path)) continue;
3443
+ const encoder = cookie.options.encode || encodeURIComponent;
3444
+ combined_cookies[cookie.name] = encoder(cookie.value);
3445
+ }
3446
+ if (header) {
3447
+ const parsed = (0, import_cookie.parse)(header, { decode: (value) => value });
3448
+ for (const name in parsed) combined_cookies[name] = parsed[name];
3449
+ }
3450
+ return Object.entries(combined_cookies).map(([name, value]) => `${name}=${value}`).join("; ");
3451
+ }
3452
+ /** @type {Array<() => void>} */
3453
+ const internal_queue = [];
3454
+ /**
3455
+ * @param {string} name
3456
+ * @param {string} value
3457
+ * @param {import('./page/types.js').Cookie['options']} options
3458
+ */
3459
+ function set_internal(name, value, options) {
3460
+ if (!normalized_url) {
3461
+ internal_queue.push(() => set_internal(name, value, options));
3462
+ return;
3463
+ }
3464
+ let path = options.path;
3465
+ if (!options.domain || options.domain === url.hostname) path = resolve(normalized_url, path);
3466
+ const cookie_key = generate_cookie_key(options.domain, path, name);
3467
+ const cookie = {
3468
+ name,
3469
+ value,
3470
+ options: {
3471
+ ...options,
3472
+ path
3473
+ }
3474
+ };
3475
+ new_cookies.set(cookie_key, cookie);
3476
+ }
3477
+ /**
3478
+ * @param {import('types').TrailingSlash} trailing_slash
3479
+ */
3480
+ function set_trailing_slash(trailing_slash) {
3481
+ normalized_url = normalize_path(url.pathname, trailing_slash);
3482
+ internal_queue.forEach((fn) => fn());
3483
+ }
3484
+ return {
3485
+ cookies,
3486
+ new_cookies,
3487
+ get_cookie_header,
3488
+ set_internal,
3489
+ set_trailing_slash
3490
+ };
3491
+ }
3492
+ /**
3493
+ * @param {string} hostname
3494
+ * @param {string} [constraint]
3495
+ */
3496
+ function domain_matches(hostname, constraint) {
3497
+ if (!constraint) return true;
3498
+ const normalized = constraint[0] === "." ? constraint.slice(1) : constraint;
3499
+ if (hostname === normalized) return true;
3500
+ return hostname.endsWith("." + normalized);
3501
+ }
3502
+ /**
3503
+ * @param {string} path
3504
+ * @param {string} [constraint]
3505
+ */
3506
+ function path_matches(path, constraint) {
3507
+ if (!constraint) return true;
3508
+ const normalized = constraint.endsWith("/") ? constraint.slice(0, -1) : constraint;
3509
+ if (path === normalized) return true;
3510
+ return path.startsWith(normalized + "/");
3511
+ }
3512
+ /**
3513
+ * @param {Headers} headers
3514
+ * @param {MapIterator<import('./page/types.js').Cookie>} cookies
3515
+ */
3516
+ function add_cookies_to_headers(headers, cookies) {
3517
+ for (const new_cookie of cookies) {
3518
+ const { name, value, options } = new_cookie;
3519
+ headers.append("set-cookie", (0, import_cookie.serialize)(name, value, options));
3520
+ if (options.path.endsWith(".html")) {
3521
+ const path = add_data_suffix(options.path);
3522
+ headers.append("set-cookie", (0, import_cookie.serialize)(name, value, {
3523
+ ...options,
3524
+ path
3525
+ }));
3526
+ }
3527
+ }
3528
+ }
3529
+ //#endregion
3530
+ //#region ../../node_modules/.bun/set-cookie-parser@3.1.0/node_modules/set-cookie-parser/lib/set-cookie.js
3531
+ var defaultParseOptions = {
3532
+ decodeValues: true,
3533
+ map: false,
3534
+ silent: false,
3535
+ split: "auto"
3536
+ };
3537
+ function isForbiddenKey(key) {
3538
+ return typeof key !== "string" || key in {};
3539
+ }
3540
+ function createNullObj() {
3541
+ return Object.create(null);
3542
+ }
3543
+ function isNonEmptyString(str) {
3544
+ return typeof str === "string" && !!str.trim();
3545
+ }
3546
+ function parseString(setCookieValue, options) {
3547
+ var parts = setCookieValue.split(";").filter(isNonEmptyString);
3548
+ var parsed = parseNameValuePair(parts.shift());
3549
+ var name = parsed.name;
3550
+ var value = parsed.value;
3551
+ options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
3552
+ if (isForbiddenKey(name)) return null;
3553
+ try {
3554
+ value = options.decodeValues ? decodeURIComponent(value) : value;
3555
+ } catch (e) {
3556
+ console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.", e);
3557
+ }
3558
+ var cookie = createNullObj();
3559
+ cookie.name = name;
3560
+ cookie.value = value;
3561
+ parts.forEach(function(part) {
3562
+ var sides = part.split("=");
3563
+ var key = sides.shift().trimLeft().toLowerCase();
3564
+ if (isForbiddenKey(key)) return;
3565
+ var value = sides.join("=");
3566
+ if (key === "expires") cookie.expires = new Date(value);
3567
+ else if (key === "max-age") {
3568
+ var n = parseInt(value, 10);
3569
+ if (!Number.isNaN(n)) cookie.maxAge = n;
3570
+ } else if (key === "secure") cookie.secure = true;
3571
+ else if (key === "httponly") cookie.httpOnly = true;
3572
+ else if (key === "samesite") cookie.sameSite = value;
3573
+ else if (key === "partitioned") cookie.partitioned = true;
3574
+ else if (key) cookie[key] = value;
3575
+ });
3576
+ return cookie;
3577
+ }
3578
+ function parseNameValuePair(nameValuePairStr) {
3579
+ var name = "";
3580
+ var value = "";
3581
+ var nameValueArr = nameValuePairStr.split("=");
3582
+ if (nameValueArr.length > 1) {
3583
+ name = nameValueArr.shift();
3584
+ value = nameValueArr.join("=");
3585
+ } else value = nameValuePairStr;
3586
+ return {
3587
+ name,
3588
+ value
3589
+ };
3590
+ }
3591
+ function parseSetCookie(input, options) {
3592
+ options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
3593
+ if (!input) if (!options.map) return [];
3594
+ else return createNullObj();
3595
+ if (input.headers) if (typeof input.headers.getSetCookie === "function") input = input.headers.getSetCookie();
3596
+ else if (input.headers["set-cookie"]) input = input.headers["set-cookie"];
3597
+ else {
3598
+ var sch = input.headers[Object.keys(input.headers).find(function(key) {
3599
+ return key.toLowerCase() === "set-cookie";
3600
+ })];
3601
+ if (!sch && input.headers.cookie && !options.silent) console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning.");
3602
+ input = sch;
3603
+ }
3604
+ var split = options.split;
3605
+ var isArray = Array.isArray(input);
3606
+ if (split === "auto") split = !isArray;
3607
+ if (!isArray) input = [input];
3608
+ input = input.filter(isNonEmptyString);
3609
+ if (split) input = input.map(splitCookiesString).flat();
3610
+ if (!options.map) return input.map(function(str) {
3611
+ return parseString(str, options);
3612
+ }).filter(Boolean);
3613
+ else {
3614
+ var cookies = createNullObj();
3615
+ return input.reduce(function(cookies, str) {
3616
+ var cookie = parseString(str, options);
3617
+ if (cookie && !isForbiddenKey(cookie.name)) cookies[cookie.name] = cookie;
3618
+ return cookies;
3619
+ }, cookies);
3620
+ }
3621
+ }
3622
+ function splitCookiesString(cookiesString) {
3623
+ if (Array.isArray(cookiesString)) return cookiesString;
3624
+ if (typeof cookiesString !== "string") return [];
3625
+ var cookiesStrings = [];
3626
+ var pos = 0;
3627
+ var start;
3628
+ var ch;
3629
+ var lastComma;
3630
+ var nextStart;
3631
+ var cookiesSeparatorFound;
3632
+ function skipWhitespace() {
3633
+ while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) pos += 1;
3634
+ return pos < cookiesString.length;
3635
+ }
3636
+ function notSpecialChar() {
3637
+ ch = cookiesString.charAt(pos);
3638
+ return ch !== "=" && ch !== ";" && ch !== ",";
3639
+ }
3640
+ while (pos < cookiesString.length) {
3641
+ start = pos;
3642
+ cookiesSeparatorFound = false;
3643
+ while (skipWhitespace()) {
3644
+ ch = cookiesString.charAt(pos);
3645
+ if (ch === ",") {
3646
+ lastComma = pos;
3647
+ pos += 1;
3648
+ skipWhitespace();
3649
+ nextStart = pos;
3650
+ while (pos < cookiesString.length && notSpecialChar()) pos += 1;
3651
+ if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
3652
+ cookiesSeparatorFound = true;
3653
+ pos = nextStart;
3654
+ cookiesStrings.push(cookiesString.substring(start, lastComma));
3655
+ start = pos;
3656
+ } else pos = lastComma + 1;
3657
+ } else pos += 1;
3658
+ }
3659
+ if (!cookiesSeparatorFound || pos >= cookiesString.length) cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
3660
+ }
3661
+ return cookiesStrings;
3662
+ }
3663
+ parseSetCookie.parseSetCookie = parseSetCookie;
3664
+ parseSetCookie.parse = parseSetCookie;
3665
+ parseSetCookie.parseString = parseString;
3666
+ parseSetCookie.splitCookiesString = splitCookiesString;
3667
+ //#endregion
3668
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/runtime/server/fetch.js
3669
+ /**
3670
+ * @param {{
3671
+ * event: import('@sveltejs/kit').RequestEvent;
3672
+ * options: import('types').SSROptions;
3673
+ * manifest: import('@sveltejs/kit').SSRManifest;
3674
+ * state: import('types').SSRState;
3675
+ * get_cookie_header: (url: URL, header: string | null) => string;
3676
+ * set_internal: (name: string, value: string, opts: import('./page/types.js').Cookie['options']) => void;
3677
+ * }} opts
3678
+ * @returns {typeof fetch}
3679
+ */
3680
+ function create_fetch({ event, options, manifest, state, get_cookie_header, set_internal }) {
3681
+ /**
3682
+ * @type {typeof fetch}
3683
+ */
3684
+ const server_fetch = async (info, init) => {
3685
+ const original_request = normalize_fetch_input(info, init, event.url);
3686
+ let mode = (info instanceof Request ? info.mode : init?.mode) ?? "cors";
3687
+ let credentials = (info instanceof Request ? info.credentials : init?.credentials) ?? "same-origin";
3688
+ return options.hooks.handleFetch({
3689
+ event,
3690
+ request: original_request,
3691
+ fetch: async (info, init) => {
3692
+ const request = normalize_fetch_input(info, init, event.url);
3693
+ const url = new URL(request.url);
3694
+ if (!request.headers.has("origin")) request.headers.set("origin", event.url.origin);
3695
+ if (info !== original_request) {
3696
+ mode = (info instanceof Request ? info.mode : init?.mode) ?? "cors";
3697
+ credentials = (info instanceof Request ? info.credentials : init?.credentials) ?? "same-origin";
3698
+ }
3699
+ if ((request.method === "GET" || request.method === "HEAD") && (mode === "no-cors" && url.origin !== event.url.origin || url.origin === event.url.origin)) request.headers.delete("origin");
3700
+ const decoded = decodeURIComponent(url.pathname);
3701
+ if (url.origin !== event.url.origin || base && decoded !== base && !decoded.startsWith(`${base}/`)) {
3702
+ if (`.${url.hostname}`.endsWith(`.${event.url.hostname}`) && credentials !== "omit") {
3703
+ const cookie = get_cookie_header(url, request.headers.get("cookie"));
3704
+ if (cookie) request.headers.set("cookie", cookie);
3705
+ }
3706
+ return fetch(request);
3707
+ }
3708
+ const prefix = assets || base;
3709
+ const filename = (decoded.startsWith(prefix) ? decoded.slice(prefix.length) : decoded).slice(1);
3710
+ const filename_html = `${filename}/index.html`;
3711
+ const is_asset = manifest.assets.has(filename) || filename in manifest._.server_assets;
3712
+ const is_asset_html = manifest.assets.has(filename_html) || filename_html in manifest._.server_assets;
3713
+ if (is_asset || is_asset_html) {
3714
+ const file = is_asset ? filename : filename_html;
3715
+ if (state.read) {
3716
+ const type = is_asset ? manifest.mimeTypes[filename.slice(filename.lastIndexOf("."))] : "text/html";
3717
+ return new Response(state.read(file), { headers: type ? { "content-type": type } : {} });
3718
+ } else if (read_implementation && file in manifest._.server_assets) {
3719
+ const length = manifest._.server_assets[file];
3720
+ const type = manifest.mimeTypes[file.slice(file.lastIndexOf("."))];
3721
+ return new Response(read_implementation(file), { headers: {
3722
+ "Content-Length": "" + length,
3723
+ "Content-Type": type
3724
+ } });
3725
+ }
3726
+ return await fetch(request);
3727
+ }
3728
+ if (has_prerendered_path(manifest, base + decoded)) return await fetch(request);
3729
+ if (credentials !== "omit") {
3730
+ const cookie = get_cookie_header(url, request.headers.get("cookie"));
3731
+ if (cookie) request.headers.set("cookie", cookie);
3732
+ const authorization = event.request.headers.get("authorization");
3733
+ if (authorization && !request.headers.has("authorization")) request.headers.set("authorization", authorization);
3734
+ }
3735
+ if (!request.headers.has("accept")) request.headers.set("accept", "*/*");
3736
+ if (!request.headers.has("accept-language")) request.headers.set("accept-language", event.request.headers.get("accept-language"));
3737
+ const response = await internal_fetch(request, options, manifest, state);
3738
+ const set_cookie = response.headers.get("set-cookie");
3739
+ if (set_cookie) for (const str of splitCookiesString(set_cookie)) {
3740
+ const { name, value, ...options } = parseString(str, { decodeValues: false });
3741
+ set_internal(name, value, {
3742
+ path: options.path ?? (url.pathname.split("/").slice(0, -1).join("/") || "/"),
3743
+ encode: (value) => value,
3744
+ ...options
3745
+ });
3746
+ }
3747
+ return response;
3748
+ }
3749
+ });
3750
+ };
3751
+ return (input, init) => {
3752
+ const response = server_fetch(input, init);
3753
+ response.catch(noop);
3754
+ return response;
3755
+ };
3756
+ }
3757
+ /**
3758
+ * @param {RequestInfo | URL} info
3759
+ * @param {RequestInit | undefined} init
3760
+ * @param {URL} url
3761
+ */
3762
+ function normalize_fetch_input(info, init, url) {
3763
+ if (info instanceof Request) return info;
3764
+ return new Request(typeof info === "string" ? new URL(info, url) : info, init);
3765
+ }
3766
+ /**
3767
+ * @param {Request} request
3768
+ * @param {import('types').SSROptions} options
3769
+ * @param {import('@sveltejs/kit').SSRManifest} manifest
3770
+ * @param {import('types').SSRState} state
3771
+ * @returns {Promise<Response>}
3772
+ */
3773
+ async function internal_fetch(request, options, manifest, state) {
3774
+ if (request.signal) {
3775
+ if (request.signal.aborted) throw new DOMException("The operation was aborted.", "AbortError");
3776
+ let remove_abort_listener = noop;
3777
+ /** @type {Promise<never>} */
3778
+ const abort_promise = new Promise((_, reject) => {
3779
+ const on_abort = () => {
3780
+ reject(new DOMException("The operation was aborted.", "AbortError"));
3781
+ };
3782
+ request.signal.addEventListener("abort", on_abort, { once: true });
3783
+ remove_abort_listener = () => request.signal.removeEventListener("abort", on_abort);
3784
+ });
3785
+ const result = await Promise.race([respond(request, options, manifest, {
3786
+ ...state,
3787
+ depth: state.depth + 1
3788
+ }), abort_promise]);
3789
+ remove_abort_listener();
3790
+ return result;
3791
+ } else return await respond(request, options, manifest, {
3792
+ ...state,
3793
+ depth: state.depth + 1
3794
+ });
3795
+ }
3796
+ //#endregion
3797
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/runtime/server/env_module.js
3798
+ /** @type {string} */
3799
+ var body;
3800
+ /** @type {string} */
3801
+ var etag;
3802
+ /** @type {Headers} */
3803
+ var headers;
3804
+ /**
3805
+ * @param {Request} request
3806
+ * @returns {Response}
3807
+ */
3808
+ function get_public_env(request) {
3809
+ body ??= `export const env=${JSON.stringify(public_env)}`;
3810
+ etag ??= `W/${Date.now()}`;
3811
+ headers ??= new Headers({
3812
+ "content-type": "application/javascript; charset=utf-8",
3813
+ etag
3814
+ });
3815
+ if (request.headers.get("if-none-match") === etag) return new Response(void 0, {
3816
+ status: 304,
3817
+ headers
3818
+ });
3819
+ return new Response(body, { headers });
3820
+ }
3821
+ //#endregion
3822
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/runtime/server/respond.js
3823
+ /** @import { RequestState, SSRNode } from 'types' */
3824
+ /** @type {import('types').RequiredResolveOptions['transformPageChunk']} */
3825
+ var default_transform = ({ html }) => html;
3826
+ /** @type {import('types').RequiredResolveOptions['filterSerializedResponseHeaders']} */
3827
+ var default_filter = () => false;
3828
+ /** @type {import('types').RequiredResolveOptions['preload']} */
3829
+ var default_preload = ({ type }) => type === "js" || type === "css";
3830
+ var page_methods = new Set([
3831
+ "GET",
3832
+ "HEAD",
3833
+ "POST"
3834
+ ]);
3835
+ var allowed_page_methods = new Set([
3836
+ "GET",
3837
+ "HEAD",
3838
+ "OPTIONS"
3839
+ ]);
3840
+ var respond = propagate_context(internal_respond);
3841
+ /**
3842
+ * @param {Request} request
3843
+ * @param {import('types').SSROptions} options
3844
+ * @param {import('@sveltejs/kit').SSRManifest} manifest
3845
+ * @param {import('types').SSRState} state
3846
+ * @returns {Promise<Response>}
3847
+ */
3848
+ async function internal_respond(request, options, manifest, state) {
3849
+ /** URL but stripped from the potential `/__data.json` suffix and its search param */
3850
+ const url = new URL(request.url);
3851
+ const is_route_resolution_request = has_resolution_suffix(url.pathname);
3852
+ const is_data_request = has_data_suffix(url.pathname);
3853
+ const remote_id = get_remote_id(url);
3854
+ {
3855
+ const request_origin = request.headers.get("origin");
3856
+ if (remote_id) {
3857
+ if (request.method !== "GET" && request_origin !== url.origin) return json({ message: "Cross-site remote requests are forbidden" }, { status: 403 });
3858
+ } else if (options.csrf_check_origin) {
3859
+ if (is_form_content_type(request) && (request.method === "POST" || request.method === "PUT" || request.method === "PATCH" || request.method === "DELETE") && request_origin !== url.origin && (!request_origin || !options.csrf_trusted_origins.includes(request_origin))) {
3860
+ const message = `Cross-site ${request.method} form submissions are forbidden`;
3861
+ const opts = { status: 403 };
3862
+ if (request.headers.get("accept") === "application/json") return json({ message }, opts);
3863
+ return text(message, opts);
3864
+ }
3865
+ }
3866
+ }
3867
+ if (options.hash_routing && url.pathname !== base + "/" && url.pathname !== "/[fallback]") return text("Not found", { status: 404 });
3868
+ /** @type {boolean[] | undefined} */
3869
+ let invalidated_data_nodes;
3870
+ if (is_route_resolution_request)
3871
+ /**
3872
+ * If the request is for a route resolution, first modify the URL, then continue as normal
3873
+ * for path resolution, then return the route object as a JS file.
3874
+ */
3875
+ url.pathname = strip_resolution_suffix(url.pathname);
3876
+ else if (is_data_request) {
3877
+ url.pathname = strip_data_suffix(url.pathname) + (url.searchParams.get("x-sveltekit-trailing-slash") === "1" ? "/" : "") || "/";
3878
+ url.searchParams.delete(TRAILING_SLASH_PARAM);
3879
+ invalidated_data_nodes = url.searchParams.get(INVALIDATED_PARAM)?.split("").map((node) => node === "1");
3880
+ url.searchParams.delete(INVALIDATED_PARAM);
3881
+ } else if (remote_id) {
3882
+ url.pathname = request.headers.get("x-sveltekit-pathname") ?? base;
3883
+ url.search = request.headers.get("x-sveltekit-search") ?? "";
3884
+ }
3885
+ /** @type {Record<string, string>} */
3886
+ const headers = {};
3887
+ const { cookies, new_cookies, get_cookie_header, set_internal, set_trailing_slash } = get_cookies(request, url);
3888
+ /** @type {RequestState} */
3889
+ const event_state = {
3890
+ prerendering: state.prerendering,
3891
+ transport: options.hooks.transport,
3892
+ handleValidationError: options.hooks.handleValidationError,
3893
+ tracing: { record_span },
3894
+ remote: {
3895
+ data: null,
3896
+ forms: null,
3897
+ refreshes: null,
3898
+ requested: null,
3899
+ reconnects: null,
3900
+ batches: null,
3901
+ live_iterators: null
3902
+ },
3903
+ is_in_remote_function: false,
3904
+ is_in_render: false,
3905
+ is_in_universal_load: false
3906
+ };
3907
+ /** @type {import('@sveltejs/kit').RequestEvent} */
3908
+ const event = {
3909
+ cookies,
3910
+ fetch: null,
3911
+ getClientAddress: state.getClientAddress || (() => {
3912
+ throw new Error(`@sveltejs/adapter-node does not specify getClientAddress. Please raise an issue`);
3913
+ }),
3914
+ locals: {},
3915
+ params: {},
3916
+ platform: state.platform,
3917
+ request,
3918
+ route: { id: null },
3919
+ setHeaders: (new_headers) => {
3920
+ for (const key in new_headers) {
3921
+ const lower = key.toLowerCase();
3922
+ const value = new_headers[key];
3923
+ if (lower === "set-cookie") throw new Error("Use `event.cookies.set(name, value, options)` instead of `event.setHeaders` to set cookies");
3924
+ else if (lower in headers) if (lower === "server-timing") headers[lower] += ", " + value;
3925
+ else throw new Error(`"${key}" header is already set`);
3926
+ else {
3927
+ headers[lower] = value;
3928
+ if (state.prerendering && lower === "cache-control") state.prerendering.cache = value;
3929
+ }
3930
+ }
3931
+ },
3932
+ url,
3933
+ isDataRequest: is_data_request,
3934
+ isSubRequest: state.depth > 0,
3935
+ isRemoteRequest: !!remote_id
3936
+ };
3937
+ event.fetch = create_fetch({
3938
+ event,
3939
+ options,
3940
+ manifest,
3941
+ state,
3942
+ get_cookie_header,
3943
+ set_internal
3944
+ });
3945
+ if (state.emulator?.platform) event.platform = await state.emulator.platform({
3946
+ config: {},
3947
+ prerender: !!state.prerendering?.fallback
3948
+ });
3949
+ /** @type {string | null} */
3950
+ let resolved_path = url.pathname;
3951
+ if (!remote_id) {
3952
+ const prerendering_reroute_state = state.prerendering?.inside_reroute;
3953
+ try {
3954
+ if (state.prerendering) state.prerendering.inside_reroute = true;
3955
+ resolved_path = await options.hooks.reroute({
3956
+ url: new URL(url),
3957
+ fetch: event.fetch
3958
+ }) ?? url.pathname;
3959
+ } catch {
3960
+ return text("Internal Server Error", { status: 500 });
3961
+ } finally {
3962
+ if (state.prerendering) state.prerendering.inside_reroute = prerendering_reroute_state;
3963
+ }
3964
+ }
3965
+ /** @type {import('types').RequiredResolveOptions} */
3966
+ let resolve_opts = {
3967
+ transformPageChunk: default_transform,
3968
+ filterSerializedResponseHeaders: default_filter,
3969
+ preload: default_preload
3970
+ };
3971
+ /** @type {import('types').TrailingSlash} */
3972
+ let trailing_slash = "never";
3973
+ /** @type {PageNodes | undefined} */
3974
+ let page_nodes;
3975
+ try {
3976
+ resolved_path = decode_pathname(resolved_path);
3977
+ } catch {
3978
+ resolved_path = null;
3979
+ return await handle();
3980
+ }
3981
+ if (resolved_path !== decode_pathname(url.pathname) && !state.prerendering?.fallback && has_prerendered_path(manifest, resolved_path)) {
3982
+ const url = new URL(request.url);
3983
+ url.pathname = is_data_request ? add_data_suffix(resolved_path) : is_route_resolution_request ? add_resolution_suffix(resolved_path) : resolved_path;
3984
+ try {
3985
+ const response = await fetch(url, request);
3986
+ const headers = new Headers(response.headers);
3987
+ if (headers.has("content-encoding")) {
3988
+ headers.delete("content-encoding");
3989
+ headers.delete("content-length");
3990
+ }
3991
+ return new Response(response.body, {
3992
+ headers,
3993
+ status: response.status,
3994
+ statusText: response.statusText
3995
+ });
3996
+ } catch (error) {
3997
+ return await handle_fatal_error(event, event_state, options, error);
3998
+ }
3999
+ }
4000
+ /** @type {import('types').SSRRoute | null} */
4001
+ let route = null;
4002
+ if (base && !state.prerendering?.fallback) {
4003
+ if (!resolved_path.startsWith(base)) return text("Not found", { status: 404 });
4004
+ resolved_path = resolved_path.slice(base.length) || "/";
4005
+ }
4006
+ if (is_route_resolution_request) return resolve_route(resolved_path, new URL(request.url), manifest);
4007
+ if (resolved_path === `/_app/env.js`) return get_public_env(request);
4008
+ if (!remote_id && resolved_path.startsWith(`/_app`)) {
4009
+ const headers = new Headers();
4010
+ headers.set("cache-control", "public, max-age=0, must-revalidate");
4011
+ return text("Not found", {
4012
+ status: 404,
4013
+ headers
4014
+ });
4015
+ }
4016
+ if (!state.prerendering?.fallback) {
4017
+ const matchers = await manifest._.matchers();
4018
+ const result = find_route(resolved_path, manifest._.routes, matchers);
4019
+ if (result) {
4020
+ route = result.route;
4021
+ event.route = { id: route.id };
4022
+ event.params = result.params;
4023
+ }
4024
+ }
4025
+ try {
4026
+ page_nodes = route?.page ? new PageNodes(await load_page_nodes(route.page, manifest)) : void 0;
4027
+ if (route && !remote_id) {
4028
+ if (url.pathname === base || url.pathname === base + "/") trailing_slash = "always";
4029
+ else if (page_nodes) trailing_slash = page_nodes.trailing_slash();
4030
+ else if (route.endpoint) trailing_slash = (await route.endpoint()).trailingSlash ?? "never";
4031
+ if (!is_data_request) {
4032
+ const normalized = normalize_path(url.pathname, trailing_slash);
4033
+ if (normalized !== url.pathname && !state.prerendering?.fallback) return new Response(void 0, {
4034
+ status: 308,
4035
+ headers: {
4036
+ "x-sveltekit-normalize": "1",
4037
+ location: (normalized.startsWith("//") ? url.origin + normalized : normalized) + (url.search === "?" ? "" : url.search)
4038
+ }
4039
+ });
4040
+ }
4041
+ if (state.before_handle || state.emulator?.platform) {
4042
+ let config = {};
4043
+ /** @type {import('types').PrerenderOption} */
4044
+ let prerender = false;
4045
+ if (route.endpoint) {
4046
+ const node = await route.endpoint();
4047
+ config = node.config ?? config;
4048
+ prerender = node.prerender ?? prerender;
4049
+ } else if (page_nodes) {
4050
+ config = page_nodes.get_config() ?? config;
4051
+ prerender = page_nodes.prerender();
4052
+ }
4053
+ if (state.emulator?.platform) event.platform = await state.emulator.platform({
4054
+ config,
4055
+ prerender
4056
+ });
4057
+ if (state.before_handle) return await state.before_handle(event, config, prerender, handle);
4058
+ }
4059
+ }
4060
+ return await handle();
4061
+ } catch (e) {
4062
+ if (e instanceof Redirect) try {
4063
+ const response = is_data_request || remote_id ? redirect_json_response(e) : route?.page && is_action_json_request(event) ? action_json_redirect(e) : redirect_response(e.status, e.location);
4064
+ add_cookies_to_headers(response.headers, new_cookies.values());
4065
+ return response;
4066
+ } catch (err) {
4067
+ return await handle_fatal_error(event, event_state, options, err);
4068
+ }
4069
+ return await handle_fatal_error(event, event_state, options, e);
4070
+ }
4071
+ async function handle() {
4072
+ set_trailing_slash(trailing_slash);
4073
+ if (state.prerendering && !state.prerendering.fallback && !state.prerendering.inside_reroute) disable_search(url);
4074
+ const response = await record_span({
4075
+ name: "sveltekit.handle.root",
4076
+ attributes: {
4077
+ "http.route": event.route.id || "unknown",
4078
+ "http.method": event.request.method,
4079
+ "http.url": event.url.href,
4080
+ "sveltekit.is_sub_request": event.isSubRequest
4081
+ },
4082
+ fn: async (root_span) => {
4083
+ const traced_event = {
4084
+ ...event,
4085
+ tracing: {
4086
+ enabled: false,
4087
+ root: root_span,
4088
+ current: root_span
4089
+ }
4090
+ };
4091
+ return await with_request_store({
4092
+ event: traced_event,
4093
+ state: event_state
4094
+ }, () => options.hooks.handle({
4095
+ event: traced_event,
4096
+ resolve: (event, opts) => {
4097
+ return record_span({
4098
+ name: "sveltekit.resolve",
4099
+ attributes: { "http.route": event.route.id || "unknown" },
4100
+ fn: (resolve_span) => {
4101
+ return with_request_store(null, () => resolve(merge_tracing(event, resolve_span), page_nodes, opts).then((response) => {
4102
+ for (const key in headers) {
4103
+ const value = headers[key];
4104
+ response.headers.set(key, value);
4105
+ }
4106
+ add_cookies_to_headers(response.headers, new_cookies.values());
4107
+ if (state.prerendering && event.route.id !== null) response.headers.set("x-sveltekit-routeid", encodeURI(event.route.id));
4108
+ resolve_span.setAttributes({
4109
+ "http.response.status_code": response.status,
4110
+ "http.response.body.size": response.headers.get("content-length") || "unknown"
4111
+ });
4112
+ return response;
4113
+ }));
4114
+ }
4115
+ });
4116
+ }
4117
+ }));
4118
+ }
4119
+ });
4120
+ if (response.status === 200 && response.headers.has("etag")) {
4121
+ let if_none_match_value = request.headers.get("if-none-match");
4122
+ if (if_none_match_value?.startsWith("W/\"")) if_none_match_value = if_none_match_value.substring(2);
4123
+ const etag = response.headers.get("etag");
4124
+ if (if_none_match_value === etag) {
4125
+ const headers = new Headers({ etag });
4126
+ for (const key of [
4127
+ "cache-control",
4128
+ "content-location",
4129
+ "date",
4130
+ "expires",
4131
+ "vary",
4132
+ "set-cookie"
4133
+ ]) {
4134
+ const value = response.headers.get(key);
4135
+ if (value) headers.set(key, value);
4136
+ }
4137
+ return new Response(void 0, {
4138
+ status: 304,
4139
+ headers
4140
+ });
4141
+ }
4142
+ }
4143
+ if (is_data_request && response.status >= 300 && response.status <= 308) {
4144
+ const location = response.headers.get("location");
4145
+ if (location) return redirect_json_response(new Redirect(response.status, location));
4146
+ }
4147
+ return response;
4148
+ }
4149
+ /**
4150
+ * @param {import('@sveltejs/kit').RequestEvent} event
4151
+ * @param {PageNodes | undefined} page_nodes
4152
+ * @param {import('@sveltejs/kit').ResolveOptions} [opts]
4153
+ */
4154
+ async function resolve(event, page_nodes, opts) {
4155
+ try {
4156
+ if (opts) resolve_opts = {
4157
+ transformPageChunk: opts.transformPageChunk || default_transform,
4158
+ filterSerializedResponseHeaders: opts.filterSerializedResponseHeaders || default_filter,
4159
+ preload: opts.preload || default_preload
4160
+ };
4161
+ if (resolved_path === null) return await respond_with_error({
4162
+ event,
4163
+ event_state,
4164
+ options,
4165
+ manifest,
4166
+ state,
4167
+ status: 400,
4168
+ error: new SvelteKitError(400, "Malformed URI", `Failed to decode URI: ${event.url.pathname}`),
4169
+ resolve_opts
4170
+ });
4171
+ if (options.hash_routing || state.prerendering?.fallback) return await render_response({
4172
+ event,
4173
+ event_state,
4174
+ options,
4175
+ manifest,
4176
+ state,
4177
+ page_config: {
4178
+ ssr: false,
4179
+ csr: true
4180
+ },
4181
+ status: 200,
4182
+ error: null,
4183
+ branch: [{
4184
+ node: await manifest._.nodes[0](),
4185
+ data: null,
4186
+ server_data: null
4187
+ }],
4188
+ fetched: [],
4189
+ resolve_opts,
4190
+ data_serializer: server_data_serializer(event, event_state, options)
4191
+ });
4192
+ if (remote_id) return await handle_remote_call(event, event_state, options, manifest, remote_id);
4193
+ if (route) {
4194
+ const method = event.request.method;
4195
+ /** @type {Response} */
4196
+ let response;
4197
+ if (is_data_request) response = await render_data(event, event_state, route, options, manifest, state, invalidated_data_nodes, trailing_slash);
4198
+ else if (route.endpoint && (!route.page || is_endpoint_request(event))) response = await render_endpoint(event, event_state, await route.endpoint(), state);
4199
+ else if (route.page) if (!page_nodes) throw new Error("page_nodes not found. This should never happen");
4200
+ else if (page_methods.has(method)) response = await render_page(event, event_state, route.page, options, manifest, state, page_nodes, resolve_opts);
4201
+ else {
4202
+ const allowed_methods = new Set(allowed_page_methods);
4203
+ if ((await manifest._.nodes[route.page.leaf]())?.server?.actions) allowed_methods.add("POST");
4204
+ if (method === "OPTIONS") response = new Response(null, {
4205
+ status: 204,
4206
+ headers: { allow: Array.from(allowed_methods.values()).join(", ") }
4207
+ });
4208
+ else response = method_not_allowed([...allowed_methods].reduce((acc, curr) => {
4209
+ acc[curr] = true;
4210
+ return acc;
4211
+ }, {}), method);
4212
+ }
4213
+ else throw new Error("Route is neither page nor endpoint. This should never happen");
4214
+ if (request.method === "GET" && route.page && route.endpoint) {
4215
+ const vary = response.headers.get("vary")?.split(",")?.map((v) => v.trim().toLowerCase());
4216
+ if (!(vary?.includes("accept") || vary?.includes("*"))) {
4217
+ response = new Response(response.body, {
4218
+ status: response.status,
4219
+ statusText: response.statusText,
4220
+ headers: new Headers(response.headers)
4221
+ });
4222
+ response.headers.append("Vary", "Accept");
4223
+ }
4224
+ }
4225
+ return response;
4226
+ }
4227
+ if (state.error && event.isSubRequest) {
4228
+ const headers = new Headers(request.headers);
4229
+ headers.set("x-sveltekit-error", "true");
4230
+ return await fetch(request, { headers });
4231
+ }
4232
+ if (state.error) return text("Internal Server Error", { status: 500 });
4233
+ if (state.depth === 0) return await respond_with_error({
4234
+ event,
4235
+ event_state,
4236
+ options,
4237
+ manifest,
4238
+ state,
4239
+ status: 404,
4240
+ error: new SvelteKitError(404, "Not Found", `Not found: ${event.url.pathname}`),
4241
+ resolve_opts
4242
+ });
4243
+ if (state.prerendering) return text("not found", { status: 404 });
4244
+ const response = await fetch(request);
4245
+ return new Response(response.body, response);
4246
+ } catch (e) {
4247
+ return await handle_fatal_error(event, event_state, options, e);
4248
+ } finally {
4249
+ event.cookies.set = () => {
4250
+ throw new Error("Cannot use `cookies.set(...)` after the response has been generated");
4251
+ };
4252
+ event.setHeaders = () => {
4253
+ throw new Error("Cannot use `setHeaders(...)` after the response has been generated");
4254
+ };
4255
+ }
4256
+ }
4257
+ }
4258
+ /**
4259
+ * @param {import('types').PageNodeIndexes} page
4260
+ * @param {import('@sveltejs/kit').SSRManifest} manifest
4261
+ */
4262
+ function load_page_nodes(page, manifest) {
4263
+ return Promise.all([...page.layouts.map((n) => n == void 0 ? n : manifest._.nodes[n]()), manifest._.nodes[page.leaf]()]);
4264
+ }
4265
+ /**
4266
+ * It's likely that, in a distributed system, there are spans starting outside the SvelteKit server -- eg.
4267
+ * started on the frontend client, or in a service that calls the SvelteKit server. There are standardized
4268
+ * ways to represent this context in HTTP headers, so we can extract that context and run our tracing inside of it
4269
+ * so that when our traces are exported, they are associated with the correct parent context.
4270
+ * @param {typeof internal_respond} fn
4271
+ * @returns {typeof internal_respond}
4272
+ */
4273
+ function propagate_context(fn) {
4274
+ return async (req, ...rest) => {
4275
+ return fn(req, ...rest);
4276
+ };
4277
+ }
4278
+ //#endregion
4279
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/utils/env.js
4280
+ /**
4281
+ * @param {Record<string, string>} env
4282
+ * @param {string} allowed
4283
+ * @param {string} disallowed
4284
+ * @returns {Record<string, string>}
4285
+ */
4286
+ function filter_env(env, allowed, disallowed) {
4287
+ return Object.fromEntries(Object.entries(env).filter(([k]) => k.startsWith(allowed) && (disallowed === "" || !k.startsWith(disallowed))));
4288
+ }
4289
+ //#endregion
4290
+ //#region ../../node_modules/.bun/@sveltejs+kit@2.61.0+aeb06e9cf8e23ab6/node_modules/@sveltejs/kit/src/runtime/server/index.js
4291
+ /** @import { PromiseWithResolvers } from '../../utils/promise.js' */
4292
+ /** @type {Promise<any>} */
4293
+ var init_promise;
4294
+ /** @type {Promise<void> | null} */
4295
+ var current = null;
4296
+ var Server = class {
4297
+ /** @type {import('types').SSROptions} */
4298
+ #options;
4299
+ /** @type {import('@sveltejs/kit').SSRManifest} */
4300
+ #manifest;
4301
+ /** @param {import('@sveltejs/kit').SSRManifest} manifest */
4302
+ constructor(manifest) {
4303
+ /** @type {import('types').SSROptions} */
4304
+ this.#options = options;
4305
+ this.#manifest = manifest;
4306
+ if (IN_WEBCONTAINER) {
4307
+ const respond = this.respond.bind(this);
4308
+ /** @type {typeof respond} */
4309
+ this.respond = async (...args) => {
4310
+ const { promise, resolve } = with_resolvers();
4311
+ const previous = current;
4312
+ current = promise;
4313
+ await previous;
4314
+ return respond(...args).finally(resolve);
4315
+ };
4316
+ }
4317
+ }
4318
+ /**
4319
+ * @param {import('@sveltejs/kit').ServerInitOptions} opts
4320
+ */
4321
+ async init({ env, read }) {
4322
+ const { env_public_prefix, env_private_prefix } = this.#options;
4323
+ set_private_env(filter_env(env, env_private_prefix, env_public_prefix));
4324
+ set_public_env(filter_env(env, env_public_prefix, env_private_prefix));
4325
+ if (read) {
4326
+ /** @param {string} file */
4327
+ const wrapped_read = (file) => {
4328
+ const result = read(file);
4329
+ if (result instanceof ReadableStream) return result;
4330
+ else return new ReadableStream({ async start(controller) {
4331
+ try {
4332
+ const stream = await Promise.resolve(result);
4333
+ if (!stream) {
4334
+ controller.close();
4335
+ return;
4336
+ }
4337
+ const reader = stream.getReader();
4338
+ while (true) {
4339
+ const { done, value } = await reader.read();
4340
+ if (done) break;
4341
+ controller.enqueue(value);
4342
+ }
4343
+ controller.close();
4344
+ } catch (error) {
4345
+ controller.error(error);
4346
+ }
4347
+ } });
4348
+ };
4349
+ set_read_implementation(wrapped_read);
4350
+ }
4351
+ await (init_promise ??= (async () => {
4352
+ try {
4353
+ const module = await get_hooks();
4354
+ this.#options.hooks = {
4355
+ handle: module.handle || (({ event, resolve }) => resolve(event)),
4356
+ handleError: module.handleError || (({ status, error, event }) => {
4357
+ const error_message = format_server_error(status, error, event);
4358
+ console.error(error_message);
4359
+ }),
4360
+ handleFetch: module.handleFetch || (({ request, fetch }) => fetch(request)),
4361
+ handleValidationError: module.handleValidationError || (({ issues }) => {
4362
+ console.error("Remote function schema validation failed:", issues);
4363
+ return { message: "Bad Request" };
4364
+ }),
4365
+ reroute: module.reroute || noop,
4366
+ transport: module.transport || {}
4367
+ };
4368
+ module.transport && Object.fromEntries(Object.entries(module.transport).map(([k, v]) => [k, v.decode]));
4369
+ if (module.init) await module.init();
4370
+ } catch (e) {
4371
+ throw e;
4372
+ }
4373
+ })());
4374
+ }
4375
+ /**
4376
+ * @param {Request} request
4377
+ * @param {import('types').RequestOptions} options
4378
+ */
4379
+ async respond(request, options) {
4380
+ return respond(request, this.#options, this.#manifest, {
4381
+ ...options,
4382
+ error: false,
4383
+ depth: 0
4384
+ });
4385
+ }
4386
+ };
4387
+
4388
+ export { Server };
4389
+ //# sourceMappingURL=index.js.map