@screenreader-speech-capture/bridge 0.0.0-stage → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (328) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +46 -2
  3. package/dist/cli.mjs +6291 -0
  4. package/dist/ui/adapter-node.js +11 -0
  5. package/dist/ui/client/ui/_app/immutable/assets/0.ONZWQgDA.css +1 -0
  6. package/dist/ui/client/ui/_app/immutable/assets/0.ONZWQgDA.css.br +0 -0
  7. package/dist/ui/client/ui/_app/immutable/assets/0.ONZWQgDA.css.gz +0 -0
  8. package/dist/ui/client/ui/_app/immutable/assets/2.DSVNnDlO.css +1 -0
  9. package/dist/ui/client/ui/_app/immutable/assets/2.DSVNnDlO.css.br +3 -0
  10. package/dist/ui/client/ui/_app/immutable/assets/2.DSVNnDlO.css.gz +0 -0
  11. package/dist/ui/client/ui/_app/immutable/assets/3.WduKm4aT.css +1 -0
  12. package/dist/ui/client/ui/_app/immutable/assets/3.WduKm4aT.css.br +0 -0
  13. package/dist/ui/client/ui/_app/immutable/assets/3.WduKm4aT.css.gz +0 -0
  14. package/dist/ui/client/ui/_app/immutable/assets/4.DyY1vjRV.css +1 -0
  15. package/dist/ui/client/ui/_app/immutable/assets/4.DyY1vjRV.css.br +0 -0
  16. package/dist/ui/client/ui/_app/immutable/assets/4.DyY1vjRV.css.gz +0 -0
  17. package/dist/ui/client/ui/_app/immutable/assets/5.YyxFzHED.css +1 -0
  18. package/dist/ui/client/ui/_app/immutable/assets/5.YyxFzHED.css.br +0 -0
  19. package/dist/ui/client/ui/_app/immutable/assets/5.YyxFzHED.css.gz +0 -0
  20. package/dist/ui/client/ui/_app/immutable/assets/6.C0Nhvs_m.css +1 -0
  21. package/dist/ui/client/ui/_app/immutable/assets/6.C0Nhvs_m.css.br +0 -0
  22. package/dist/ui/client/ui/_app/immutable/assets/6.C0Nhvs_m.css.gz +0 -0
  23. package/dist/ui/client/ui/_app/immutable/assets/ExternalLink.CYXazpKA.css +1 -0
  24. package/dist/ui/client/ui/_app/immutable/assets/ExternalLink.CYXazpKA.css.br +0 -0
  25. package/dist/ui/client/ui/_app/immutable/assets/ExternalLink.CYXazpKA.css.gz +0 -0
  26. package/dist/ui/client/ui/_app/immutable/assets/Pane.Dgdg5KMw.css +1 -0
  27. package/dist/ui/client/ui/_app/immutable/assets/Pane.Dgdg5KMw.css.br +0 -0
  28. package/dist/ui/client/ui/_app/immutable/assets/Pane.Dgdg5KMw.css.gz +0 -0
  29. package/dist/ui/client/ui/_app/immutable/assets/material-symbols-outlined-latin-400-normal.BhEvR8fk.woff2 +0 -0
  30. package/dist/ui/client/ui/_app/immutable/assets/roboto-flex-cyrillic-ext-opsz-normal.nDQikIyu.woff2 +0 -0
  31. package/dist/ui/client/ui/_app/immutable/assets/roboto-flex-cyrillic-opsz-normal.SjuC5rw5.woff2 +0 -0
  32. package/dist/ui/client/ui/_app/immutable/assets/roboto-flex-greek-opsz-normal.C14fFRny.woff2 +0 -0
  33. package/dist/ui/client/ui/_app/immutable/assets/roboto-flex-latin-ext-opsz-normal.xNclTVCo.woff2 +0 -0
  34. package/dist/ui/client/ui/_app/immutable/assets/roboto-flex-latin-opsz-normal.hy8fyBBC.woff2 +0 -0
  35. package/dist/ui/client/ui/_app/immutable/assets/roboto-flex-vietnamese-opsz-normal.C-H_yGOU.woff2 +0 -0
  36. package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-cyrillic-400-normal.B3hIXASd.woff +0 -0
  37. package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-cyrillic-400-normal.C-_K-ZCn.woff2 +0 -0
  38. package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-cyrillic-500-normal.DGZ7-lUP.woff2 +0 -0
  39. package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-cyrillic-500-normal.NpUJFYX7.woff +0 -0
  40. package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-cyrillic-ext-400-normal.BHxv52bw.woff2 +0 -0
  41. package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-cyrillic-ext-400-normal.W26xs1TL.woff +0 -0
  42. package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-cyrillic-ext-500-normal.6xdwlG7p.woff +0 -0
  43. package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-cyrillic-ext-500-normal.DC57U9n8.woff2 +0 -0
  44. package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-greek-400-normal.CH_u3Aru.woff2 +0 -0
  45. package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-greek-400-normal.P8xe1gs1.woff +0 -0
  46. package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-greek-500-normal.C2M8jX6G.woff +0 -0
  47. package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-greek-500-normal.DpRFkptA.woff2 +0 -0
  48. package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-latin-400-normal.DBZPkcnn.woff +0 -0
  49. package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-latin-400-normal.GekRknry.woff2 +0 -0
  50. package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-latin-500-normal.D6j6AMzd.woff +0 -0
  51. package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-latin-500-normal.pxIOXZmA.woff2 +0 -0
  52. package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-latin-ext-400-normal.BwLXVYNz.woff +0 -0
  53. package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-latin-ext-400-normal.DLAV9S_w.woff2 +0 -0
  54. package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-latin-ext-500-normal.B1IjfbhL.woff +0 -0
  55. package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-latin-ext-500-normal.Db3ge6Oe.woff2 +0 -0
  56. package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-vietnamese-400-normal.CzWHQABp.woff +0 -0
  57. package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-vietnamese-400-normal.yYTFiTTs.woff2 +0 -0
  58. package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-vietnamese-500-normal.Cq-quQMu.woff2 +0 -0
  59. package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-vietnamese-500-normal.IxzxMIj7.woff +0 -0
  60. package/dist/ui/client/ui/_app/immutable/chunks/0FroJ-XN.js +3 -0
  61. package/dist/ui/client/ui/_app/immutable/chunks/0FroJ-XN.js.br +0 -0
  62. package/dist/ui/client/ui/_app/immutable/chunks/0FroJ-XN.js.gz +0 -0
  63. package/dist/ui/client/ui/_app/immutable/chunks/4wvZDMeR.js +33 -0
  64. package/dist/ui/client/ui/_app/immutable/chunks/4wvZDMeR.js.br +0 -0
  65. package/dist/ui/client/ui/_app/immutable/chunks/4wvZDMeR.js.gz +0 -0
  66. package/dist/ui/client/ui/_app/immutable/chunks/B1Ryegye.js +3 -0
  67. package/dist/ui/client/ui/_app/immutable/chunks/B1Ryegye.js.br +0 -0
  68. package/dist/ui/client/ui/_app/immutable/chunks/B1Ryegye.js.gz +0 -0
  69. package/dist/ui/client/ui/_app/immutable/chunks/B1vArRqi.js +3 -0
  70. package/dist/ui/client/ui/_app/immutable/chunks/B1vArRqi.js.br +0 -0
  71. package/dist/ui/client/ui/_app/immutable/chunks/B1vArRqi.js.gz +0 -0
  72. package/dist/ui/client/ui/_app/immutable/chunks/BS7n1gMj.js +40 -0
  73. package/dist/ui/client/ui/_app/immutable/chunks/BS7n1gMj.js.br +0 -0
  74. package/dist/ui/client/ui/_app/immutable/chunks/BS7n1gMj.js.gz +0 -0
  75. package/dist/ui/client/ui/_app/immutable/chunks/B_ZElYu_.js +1 -0
  76. package/dist/ui/client/ui/_app/immutable/chunks/B_ZElYu_.js.br +2 -0
  77. package/dist/ui/client/ui/_app/immutable/chunks/B_ZElYu_.js.gz +0 -0
  78. package/dist/ui/client/ui/_app/immutable/chunks/Beqi9dRN.js +72 -0
  79. package/dist/ui/client/ui/_app/immutable/chunks/Beqi9dRN.js.br +0 -0
  80. package/dist/ui/client/ui/_app/immutable/chunks/Beqi9dRN.js.gz +0 -0
  81. package/dist/ui/client/ui/_app/immutable/chunks/BnU72Mow.js +2 -0
  82. package/dist/ui/client/ui/_app/immutable/chunks/BnU72Mow.js.br +0 -0
  83. package/dist/ui/client/ui/_app/immutable/chunks/BnU72Mow.js.gz +0 -0
  84. package/dist/ui/client/ui/_app/immutable/chunks/Bvlvl8SZ.js +1 -0
  85. package/dist/ui/client/ui/_app/immutable/chunks/Bvlvl8SZ.js.br +0 -0
  86. package/dist/ui/client/ui/_app/immutable/chunks/Bvlvl8SZ.js.gz +0 -0
  87. package/dist/ui/client/ui/_app/immutable/chunks/CK3uUd4t.js +48 -0
  88. package/dist/ui/client/ui/_app/immutable/chunks/CK3uUd4t.js.br +0 -0
  89. package/dist/ui/client/ui/_app/immutable/chunks/CK3uUd4t.js.gz +0 -0
  90. package/dist/ui/client/ui/_app/immutable/chunks/CMWEX9XL.js +138 -0
  91. package/dist/ui/client/ui/_app/immutable/chunks/CMWEX9XL.js.br +0 -0
  92. package/dist/ui/client/ui/_app/immutable/chunks/CMWEX9XL.js.gz +0 -0
  93. package/dist/ui/client/ui/_app/immutable/chunks/CVpgcnu3.js +1 -0
  94. package/dist/ui/client/ui/_app/immutable/chunks/CVpgcnu3.js.br +0 -0
  95. package/dist/ui/client/ui/_app/immutable/chunks/CVpgcnu3.js.gz +0 -0
  96. package/dist/ui/client/ui/_app/immutable/chunks/D-2Nx62w.js +1 -0
  97. package/dist/ui/client/ui/_app/immutable/chunks/D-2Nx62w.js.br +4 -0
  98. package/dist/ui/client/ui/_app/immutable/chunks/D-2Nx62w.js.gz +0 -0
  99. package/dist/ui/client/ui/_app/immutable/chunks/D0famktY.js +1 -0
  100. package/dist/ui/client/ui/_app/immutable/chunks/D0famktY.js.br +2 -0
  101. package/dist/ui/client/ui/_app/immutable/chunks/D0famktY.js.gz +0 -0
  102. package/dist/ui/client/ui/_app/immutable/chunks/DHsTyp2W.js +1 -0
  103. package/dist/ui/client/ui/_app/immutable/chunks/DHsTyp2W.js.br +2 -0
  104. package/dist/ui/client/ui/_app/immutable/chunks/DHsTyp2W.js.gz +0 -0
  105. package/dist/ui/client/ui/_app/immutable/chunks/DOY87jO2.js +1 -0
  106. package/dist/ui/client/ui/_app/immutable/chunks/DOY87jO2.js.br +0 -0
  107. package/dist/ui/client/ui/_app/immutable/chunks/DOY87jO2.js.gz +0 -0
  108. package/dist/ui/client/ui/_app/immutable/chunks/DUTjbZNf.js +1 -0
  109. package/dist/ui/client/ui/_app/immutable/chunks/DUTjbZNf.js.br +0 -0
  110. package/dist/ui/client/ui/_app/immutable/chunks/DUTjbZNf.js.gz +0 -0
  111. package/dist/ui/client/ui/_app/immutable/chunks/Dvxhfd7j.js +3 -0
  112. package/dist/ui/client/ui/_app/immutable/chunks/Dvxhfd7j.js.br +0 -0
  113. package/dist/ui/client/ui/_app/immutable/chunks/Dvxhfd7j.js.gz +0 -0
  114. package/dist/ui/client/ui/_app/immutable/chunks/DzInmTUe.js +1 -0
  115. package/dist/ui/client/ui/_app/immutable/chunks/DzInmTUe.js.br +1 -0
  116. package/dist/ui/client/ui/_app/immutable/chunks/DzInmTUe.js.gz +0 -0
  117. package/dist/ui/client/ui/_app/immutable/chunks/tKonUL5Y.js +4 -0
  118. package/dist/ui/client/ui/_app/immutable/chunks/tKonUL5Y.js.br +0 -0
  119. package/dist/ui/client/ui/_app/immutable/chunks/tKonUL5Y.js.gz +0 -0
  120. package/dist/ui/client/ui/_app/immutable/entry/app.C8tsut3X.js +2 -0
  121. package/dist/ui/client/ui/_app/immutable/entry/app.C8tsut3X.js.br +0 -0
  122. package/dist/ui/client/ui/_app/immutable/entry/app.C8tsut3X.js.gz +0 -0
  123. package/dist/ui/client/ui/_app/immutable/entry/payload.DSmR2FwN.js +1 -0
  124. package/dist/ui/client/ui/_app/immutable/entry/payload.DSmR2FwN.js.br +0 -0
  125. package/dist/ui/client/ui/_app/immutable/entry/payload.DSmR2FwN.js.gz +0 -0
  126. package/dist/ui/client/ui/_app/immutable/entry/start.DqIv9xYX.js +2 -0
  127. package/dist/ui/client/ui/_app/immutable/entry/start.DqIv9xYX.js.br +0 -0
  128. package/dist/ui/client/ui/_app/immutable/entry/start.DqIv9xYX.js.gz +0 -0
  129. package/dist/ui/client/ui/_app/immutable/nodes/0.3bVKqGbx.js +1 -0
  130. package/dist/ui/client/ui/_app/immutable/nodes/0.3bVKqGbx.js.br +0 -0
  131. package/dist/ui/client/ui/_app/immutable/nodes/0.3bVKqGbx.js.gz +0 -0
  132. package/dist/ui/client/ui/_app/immutable/nodes/1.C81neQJL.js +1 -0
  133. package/dist/ui/client/ui/_app/immutable/nodes/1.C81neQJL.js.br +0 -0
  134. package/dist/ui/client/ui/_app/immutable/nodes/1.C81neQJL.js.gz +0 -0
  135. package/dist/ui/client/ui/_app/immutable/nodes/2.CmlyeAx_.js +1 -0
  136. package/dist/ui/client/ui/_app/immutable/nodes/2.CmlyeAx_.js.br +0 -0
  137. package/dist/ui/client/ui/_app/immutable/nodes/2.CmlyeAx_.js.gz +0 -0
  138. package/dist/ui/client/ui/_app/immutable/nodes/3.WT26F_BF.js +5 -0
  139. package/dist/ui/client/ui/_app/immutable/nodes/3.WT26F_BF.js.br +0 -0
  140. package/dist/ui/client/ui/_app/immutable/nodes/3.WT26F_BF.js.gz +0 -0
  141. package/dist/ui/client/ui/_app/immutable/nodes/4.tiDJxi6M.js +160 -0
  142. package/dist/ui/client/ui/_app/immutable/nodes/4.tiDJxi6M.js.br +0 -0
  143. package/dist/ui/client/ui/_app/immutable/nodes/4.tiDJxi6M.js.gz +0 -0
  144. package/dist/ui/client/ui/_app/immutable/nodes/5.MzfJoePg.js +6 -0
  145. package/dist/ui/client/ui/_app/immutable/nodes/5.MzfJoePg.js.br +0 -0
  146. package/dist/ui/client/ui/_app/immutable/nodes/5.MzfJoePg.js.gz +0 -0
  147. package/dist/ui/client/ui/_app/immutable/nodes/6.bNZhqiRK.js +6 -0
  148. package/dist/ui/client/ui/_app/immutable/nodes/6.bNZhqiRK.js.br +0 -0
  149. package/dist/ui/client/ui/_app/immutable/nodes/6.bNZhqiRK.js.gz +0 -0
  150. package/dist/ui/client/ui/_app/version.json +1 -0
  151. package/dist/ui/client/ui/_app/version.json.br +0 -0
  152. package/dist/ui/client/ui/_app/version.json.gz +0 -0
  153. package/dist/ui/client/ui/robots.txt +3 -0
  154. package/dist/ui/client/ui/robots.txt.br +0 -0
  155. package/dist/ui/client/ui/robots.txt.gz +0 -0
  156. package/dist/ui/handler.js +1 -0
  157. package/dist/ui/index.js +1 -0
  158. package/dist/ui/server/.vite/manifest.json +761 -0
  159. package/dist/ui/server/_app/immutable/assets/ExternalLink.CYXazpKA.css +1 -0
  160. package/dist/ui/server/_app/immutable/assets/Pane.Dgdg5KMw.css +1 -0
  161. package/dist/ui/server/_app/immutable/assets/_layout.DSVNnDlO.css +1 -0
  162. package/dist/ui/server/_app/immutable/assets/_layout.ONZWQgDA.css +1 -0
  163. package/dist/ui/server/_app/immutable/assets/_page.C0Nhvs_m.css +1 -0
  164. package/dist/ui/server/_app/immutable/assets/_page.DyY1vjRV.css +1 -0
  165. package/dist/ui/server/_app/immutable/assets/_page.WduKm4aT.css +1 -0
  166. package/dist/ui/server/_app/immutable/assets/_page.YyxFzHED.css +1 -0
  167. package/dist/ui/server/_app/immutable/assets/material-symbols-outlined-latin-400-normal.BhEvR8fk.woff2 +0 -0
  168. package/dist/ui/server/_app/immutable/assets/roboto-flex-cyrillic-ext-opsz-normal.nDQikIyu.woff2 +0 -0
  169. package/dist/ui/server/_app/immutable/assets/roboto-flex-cyrillic-opsz-normal.SjuC5rw5.woff2 +0 -0
  170. package/dist/ui/server/_app/immutable/assets/roboto-flex-greek-opsz-normal.C14fFRny.woff2 +0 -0
  171. package/dist/ui/server/_app/immutable/assets/roboto-flex-latin-ext-opsz-normal.xNclTVCo.woff2 +0 -0
  172. package/dist/ui/server/_app/immutable/assets/roboto-flex-latin-opsz-normal.hy8fyBBC.woff2 +0 -0
  173. package/dist/ui/server/_app/immutable/assets/roboto-flex-vietnamese-opsz-normal.C-H_yGOU.woff2 +0 -0
  174. package/dist/ui/server/_app/immutable/assets/roboto-mono-cyrillic-400-normal.B3hIXASd.woff +0 -0
  175. package/dist/ui/server/_app/immutable/assets/roboto-mono-cyrillic-400-normal.C-_K-ZCn.woff2 +0 -0
  176. package/dist/ui/server/_app/immutable/assets/roboto-mono-cyrillic-500-normal.DGZ7-lUP.woff2 +0 -0
  177. package/dist/ui/server/_app/immutable/assets/roboto-mono-cyrillic-500-normal.NpUJFYX7.woff +0 -0
  178. package/dist/ui/server/_app/immutable/assets/roboto-mono-cyrillic-ext-400-normal.BHxv52bw.woff2 +0 -0
  179. package/dist/ui/server/_app/immutable/assets/roboto-mono-cyrillic-ext-400-normal.W26xs1TL.woff +0 -0
  180. package/dist/ui/server/_app/immutable/assets/roboto-mono-cyrillic-ext-500-normal.6xdwlG7p.woff +0 -0
  181. package/dist/ui/server/_app/immutable/assets/roboto-mono-cyrillic-ext-500-normal.DC57U9n8.woff2 +0 -0
  182. package/dist/ui/server/_app/immutable/assets/roboto-mono-greek-400-normal.CH_u3Aru.woff2 +0 -0
  183. package/dist/ui/server/_app/immutable/assets/roboto-mono-greek-400-normal.P8xe1gs1.woff +0 -0
  184. package/dist/ui/server/_app/immutable/assets/roboto-mono-greek-500-normal.C2M8jX6G.woff +0 -0
  185. package/dist/ui/server/_app/immutable/assets/roboto-mono-greek-500-normal.DpRFkptA.woff2 +0 -0
  186. package/dist/ui/server/_app/immutable/assets/roboto-mono-latin-400-normal.DBZPkcnn.woff +0 -0
  187. package/dist/ui/server/_app/immutable/assets/roboto-mono-latin-400-normal.GekRknry.woff2 +0 -0
  188. package/dist/ui/server/_app/immutable/assets/roboto-mono-latin-500-normal.D6j6AMzd.woff +0 -0
  189. package/dist/ui/server/_app/immutable/assets/roboto-mono-latin-500-normal.pxIOXZmA.woff2 +0 -0
  190. package/dist/ui/server/_app/immutable/assets/roboto-mono-latin-ext-400-normal.BwLXVYNz.woff +0 -0
  191. package/dist/ui/server/_app/immutable/assets/roboto-mono-latin-ext-400-normal.DLAV9S_w.woff2 +0 -0
  192. package/dist/ui/server/_app/immutable/assets/roboto-mono-latin-ext-500-normal.B1IjfbhL.woff +0 -0
  193. package/dist/ui/server/_app/immutable/assets/roboto-mono-latin-ext-500-normal.Db3ge6Oe.woff2 +0 -0
  194. package/dist/ui/server/_app/immutable/assets/roboto-mono-vietnamese-400-normal.CzWHQABp.woff +0 -0
  195. package/dist/ui/server/_app/immutable/assets/roboto-mono-vietnamese-400-normal.yYTFiTTs.woff2 +0 -0
  196. package/dist/ui/server/_app/immutable/assets/roboto-mono-vietnamese-500-normal.Cq-quQMu.woff2 +0 -0
  197. package/dist/ui/server/_app/immutable/assets/roboto-mono-vietnamese-500-normal.IxzxMIj7.woff +0 -0
  198. package/dist/ui/server/adapter-env.js +1 -0
  199. package/dist/ui/server/adapter-index.js +73 -0
  200. package/dist/ui/server/adapter-index.js.map +1 -0
  201. package/dist/ui/server/adapter-node-env.js +63 -0
  202. package/dist/ui/server/adapter-node-env.js.map +1 -0
  203. package/dist/ui/server/adapter-node-handler.js +638 -0
  204. package/dist/ui/server/adapter-node-handler.js.map +1 -0
  205. package/dist/ui/server/chunks/ExternalLink.js +12 -0
  206. package/dist/ui/server/chunks/ExternalLink.js.map +1 -0
  207. package/dist/ui/server/chunks/Pane.js +13 -0
  208. package/dist/ui/server/chunks/Pane.js.map +1 -0
  209. package/dist/ui/server/chunks/composition.js +3468 -0
  210. package/dist/ui/server/chunks/composition.js.map +1 -0
  211. package/dist/ui/server/chunks/config-state.js +21 -0
  212. package/dist/ui/server/chunks/config-state.js.map +1 -0
  213. package/dist/ui/server/chunks/config.js +145 -0
  214. package/dist/ui/server/chunks/config.js.map +1 -0
  215. package/dist/ui/server/chunks/dialog.js +592 -0
  216. package/dist/ui/server/chunks/dialog.js.map +1 -0
  217. package/dist/ui/server/chunks/exports.js +352 -0
  218. package/dist/ui/server/chunks/exports.js.map +1 -0
  219. package/dist/ui/server/chunks/filled-button.js +116 -0
  220. package/dist/ui/server/chunks/filled-button.js.map +1 -0
  221. package/dist/ui/server/chunks/functions.js +29 -0
  222. package/dist/ui/server/chunks/functions.js.map +1 -0
  223. package/dist/ui/server/chunks/icon-button.js +234 -0
  224. package/dist/ui/server/chunks/icon-button.js.map +1 -0
  225. package/dist/ui/server/chunks/icon.js +49 -0
  226. package/dist/ui/server/chunks/icon.js.map +1 -0
  227. package/dist/ui/server/chunks/index-server.js +6 -0
  228. package/dist/ui/server/chunks/index-server.js.map +1 -0
  229. package/dist/ui/server/chunks/instance.js +3577 -0
  230. package/dist/ui/server/chunks/instance.js.map +1 -0
  231. package/dist/ui/server/chunks/internal.js +3577 -0
  232. package/dist/ui/server/chunks/internal.js.map +1 -0
  233. package/dist/ui/server/chunks/navigation.js +11 -0
  234. package/dist/ui/server/chunks/navigation.js.map +1 -0
  235. package/dist/ui/server/chunks/navigation2.js +15 -0
  236. package/dist/ui/server/chunks/navigation2.js.map +1 -0
  237. package/dist/ui/server/chunks/outlined-text-field.js +1477 -0
  238. package/dist/ui/server/chunks/outlined-text-field.js.map +1 -0
  239. package/dist/ui/server/chunks/paths.js +2 -0
  240. package/dist/ui/server/chunks/redispatch-event.js +91 -0
  241. package/dist/ui/server/chunks/redispatch-event.js.map +1 -0
  242. package/dist/ui/server/chunks/remote-1j2tn2d.js +4 -0
  243. package/dist/ui/server/chunks/remote.js +1580 -0
  244. package/dist/ui/server/chunks/remote.js.map +1 -0
  245. package/dist/ui/server/chunks/scope.js +13 -0
  246. package/dist/ui/server/chunks/scope.js.map +1 -0
  247. package/dist/ui/server/chunks/server-errors.js +471 -0
  248. package/dist/ui/server/chunks/server-errors.js.map +1 -0
  249. package/dist/ui/server/chunks/server.js +8 -0
  250. package/dist/ui/server/chunks/server.js.map +1 -0
  251. package/dist/ui/server/chunks/server2.js +1960 -0
  252. package/dist/ui/server/chunks/server2.js.map +1 -0
  253. package/dist/ui/server/chunks/sessions.js +65 -0
  254. package/dist/ui/server/chunks/sessions.js.map +1 -0
  255. package/dist/ui/server/chunks/sessions.remote.js +56 -0
  256. package/dist/ui/server/chunks/sessions.remote.js.map +1 -0
  257. package/dist/ui/server/chunks/shared-errors.js +198 -0
  258. package/dist/ui/server/chunks/shared-errors.js.map +1 -0
  259. package/dist/ui/server/chunks/shared.js +85 -0
  260. package/dist/ui/server/chunks/shared.js.map +1 -0
  261. package/dist/ui/server/chunks/src.js +1217 -0
  262. package/dist/ui/server/chunks/src.js.map +1 -0
  263. package/dist/ui/server/chunks/state.js +38 -0
  264. package/dist/ui/server/chunks/state.js.map +1 -0
  265. package/dist/ui/server/chunks/static-html.js +38 -0
  266. package/dist/ui/server/chunks/static-html.js.map +1 -0
  267. package/dist/ui/server/chunks/text-button.js +307 -0
  268. package/dist/ui/server/chunks/text-button.js.map +1 -0
  269. package/dist/ui/server/entries/endpoints/api/config/_server.ts.js +19 -0
  270. package/dist/ui/server/entries/endpoints/api/config/_server.ts.js.map +1 -0
  271. package/dist/ui/server/entries/endpoints/api/input/keys/_server.ts.js +14 -0
  272. package/dist/ui/server/entries/endpoints/api/input/keys/_server.ts.js.map +1 -0
  273. package/dist/ui/server/entries/endpoints/api/markers/_server.ts.js +13 -0
  274. package/dist/ui/server/entries/endpoints/api/markers/_server.ts.js.map +1 -0
  275. package/dist/ui/server/entries/endpoints/api/sessions/_id_id_/_server.ts.js +12 -0
  276. package/dist/ui/server/entries/endpoints/api/sessions/_id_id_/_server.ts.js.map +1 -0
  277. package/dist/ui/server/entries/endpoints/api/sessions/_server.ts.js +13 -0
  278. package/dist/ui/server/entries/endpoints/api/sessions/_server.ts.js.map +1 -0
  279. package/dist/ui/server/entries/endpoints/api/sessions/end/_server.ts.js +9 -0
  280. package/dist/ui/server/entries/endpoints/api/sessions/end/_server.ts.js.map +1 -0
  281. package/dist/ui/server/entries/endpoints/api/speech/_server.ts.js +25 -0
  282. package/dist/ui/server/entries/endpoints/api/speech/_server.ts.js.map +1 -0
  283. package/dist/ui/server/entries/endpoints/api/speech/stream/_server.ts.js +19 -0
  284. package/dist/ui/server/entries/endpoints/api/speech/stream/_server.ts.js.map +1 -0
  285. package/dist/ui/server/entries/endpoints/api/status/_server.ts.js +9 -0
  286. package/dist/ui/server/entries/endpoints/api/status/_server.ts.js.map +1 -0
  287. package/dist/ui/server/entries/hooks.server.js +161 -0
  288. package/dist/ui/server/entries/hooks.server.js.map +1 -0
  289. package/dist/ui/server/entries/pages/_error.svelte.js +16 -0
  290. package/dist/ui/server/entries/pages/_error.svelte.js.map +1 -0
  291. package/dist/ui/server/entries/pages/_layout.server.ts.js +17 -0
  292. package/dist/ui/server/entries/pages/_layout.server.ts.js.map +1 -0
  293. package/dist/ui/server/entries/pages/_layout.svelte.js +175 -0
  294. package/dist/ui/server/entries/pages/_layout.svelte.js.map +1 -0
  295. package/dist/ui/server/entries/pages/_page.server.ts.js +18 -0
  296. package/dist/ui/server/entries/pages/_page.server.ts.js.map +1 -0
  297. package/dist/ui/server/entries/pages/_page.svelte.js +444 -0
  298. package/dist/ui/server/entries/pages/_page.svelte.js.map +1 -0
  299. package/dist/ui/server/entries/pages/settings/_page.server.ts.js +12 -0
  300. package/dist/ui/server/entries/pages/settings/_page.server.ts.js.map +1 -0
  301. package/dist/ui/server/entries/pages/settings/_page.svelte.js +3531 -0
  302. package/dist/ui/server/entries/pages/settings/_page.svelte.js.map +1 -0
  303. package/dist/ui/server/entries/pages/setup/_layout.svelte.js +51 -0
  304. package/dist/ui/server/entries/pages/setup/_layout.svelte.js.map +1 -0
  305. package/dist/ui/server/entries/pages/setup/_page.svelte.js +230 -0
  306. package/dist/ui/server/entries/pages/setup/_page.svelte.js.map +1 -0
  307. package/dist/ui/server/entries/pages/setup/instructions/_page.server.ts.js +12 -0
  308. package/dist/ui/server/entries/pages/setup/instructions/_page.server.ts.js.map +1 -0
  309. package/dist/ui/server/entries/pages/setup/instructions/_page.svelte.js +271 -0
  310. package/dist/ui/server/entries/pages/setup/instructions/_page.svelte.js.map +1 -0
  311. package/dist/ui/server/entries/params.js +60 -0
  312. package/dist/ui/server/entries/params.js.map +1 -0
  313. package/dist/ui/server/env.js +1 -0
  314. package/dist/ui/server/handler.js +1 -0
  315. package/dist/ui/server/index.js +67 -0
  316. package/dist/ui/server/index.js.map +1 -0
  317. package/dist/ui/server/manifest-full.js +126 -0
  318. package/dist/ui/server/manifest.js +126 -0
  319. package/dist/ui/server/nodes/0.js +10 -0
  320. package/dist/ui/server/nodes/1.js +8 -0
  321. package/dist/ui/server/nodes/2.js +8 -0
  322. package/dist/ui/server/nodes/3.js +10 -0
  323. package/dist/ui/server/nodes/4.js +10 -0
  324. package/dist/ui/server/nodes/5.js +8 -0
  325. package/dist/ui/server/nodes/6.js +10 -0
  326. package/dist/ui/server/remote-entry.js +1 -0
  327. package/dist/ui/server/server.js +128 -0
  328. package/package.json +39 -3
@@ -0,0 +1,3577 @@
1
+ import { n as noop, r as once } from "./functions.js";
2
+ import { S as REROUTED_URL_HEADER, _ as BODY_DEPENDENT_METHODS, a as decode_pathname, c as make_trackable, d as resolve, f as merge_tracing, g as with_request_store, i as text, l as normalize_path, n as isRedirect, o as disable_search, u as relative_pathname, v as ENDPOINT_METHODS, x as PAGE_METHODS, y as IN_WEBCONTAINER } from "./exports.js";
3
+ import { a as SvelteKitError, i as Redirect } from "./shared.js";
4
+ import { A as get_status, B as init_transport, C as method_not_allowed, D as with_version_header, E as throw_devalue_error, F as fetch_cache_url, G as matches_content_type, K as negotiate, M as INVALIDATED_PARAM, N as TRAILING_SLASH_PARAM, O as default_handle_error, R as encoders, S as is_prerendering, T as serialize_uses, U as uneval$1, W as is_form_content_type, _ as is_action_json_request, _t as app_dir, a as set_hooks, at as find_route, b as get_node_type, ct as add_data_suffix, d as get_remote_id, dt as has_resolution_suffix, et as stringify, f as handle_remote_call, ft as strip_data_suffix, g as handle_action_request, gt as text_encoder, h as handle_action_json_request, ht as stream_text, i as read_implementation, it as options, j as normalize_error, k as handle_error_and_jsonify, l as collect_remote_data, lt as add_resolution_suffix, m as action_json_redirect, mt as base64_encode, n as hooks, ot as otel, p as handle_remote_form_post, pt as strip_resolution_suffix, r as manifest, rt as get_hooks, st as record_span, tt as uneval, u as get_remote_action, ut as has_data_suffix, v as is_action_request, vt as assets, w as redirect_response, x as has_prerendered_path, y as uneval_action_response, z as has_custom_transporters } from "./internal.js";
5
+ import { C as prerender_template_nonce, K as set_headers_after_response, S as prerender_nonce, Y as capture_error, _ as load_promise_not_serializable, b as prerender_endpoint_methods, c as cookies_set_after_response, l as csp_report_only_missing_report, m as load_fetch_cors, o as client_address_unsupported, p as header_already_set, q as set_headers_cookie, s as cookies_serialize_before_route, u as endpoint_invalid_response, v as load_response_header_not_serialized, x as prerender_endpoint_not_prerenderable, y as prerender_actions } from "./server-errors.js";
6
+ import { a as join_or, i as set_env, n as explicit_public_env, r as rendered_env } from "./config.js";
7
+ import { h as escape_html$1, r as derived, s as render } from "./server2.js";
8
+ import { t as afterNavigate } from "./navigation2.js";
9
+ import { c as invalid_export, l as invalid_export_location } from "./shared-errors.js";
10
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/runtime/server/endpoint.js
11
+ /**
12
+ * @param {import('@sveltejs/kit').RequestEvent} event
13
+ * @param {import('types').RequestState} state
14
+ * @param {import('types').SSREndpoint} mod
15
+ * @returns {Promise<Response>}
16
+ */
17
+ async function render_endpoint(event, state, mod) {
18
+ const method = event.request.method;
19
+ let handler = mod[method] || mod.fallback;
20
+ if (method === "HEAD" && !mod.HEAD && mod.GET) handler = mod.GET;
21
+ if (!handler) return method_not_allowed(mod, method);
22
+ const prerender = mod.prerender ?? state.prerender_default;
23
+ if (prerender && (mod.fallback || BODY_DEPENDENT_METHODS.some((method) => mod[method]))) prerender_endpoint_methods({
24
+ methods: BODY_DEPENDENT_METHODS.join(", "),
25
+ id: event.route.id
26
+ });
27
+ if (state.prerendering && !state.prerendering.inside_reroute && !prerender) {
28
+ if (state.depth > 0) prerender_endpoint_not_prerenderable({ id: event.route.id });
29
+ else return new Response(void 0, { status: 204 });
30
+ }
31
+ try {
32
+ const response = await record_span({
33
+ name: "sveltekit.endpoint",
34
+ attributes: {
35
+ "http.route": event.route.id || "unknown",
36
+ "http.method": method
37
+ },
38
+ fn: async (current) => {
39
+ const traced_event = merge_tracing(event, current);
40
+ return with_request_store({
41
+ event: traced_event,
42
+ state
43
+ }, () => handler(traced_event));
44
+ }
45
+ });
46
+ if (!(response instanceof Response)) endpoint_invalid_response({ path: event.url.pathname });
47
+ if (state.prerendering && (!state.prerendering.inside_reroute || prerender)) {
48
+ const cloned = new Response(response.clone().body, {
49
+ status: response.status,
50
+ statusText: response.statusText,
51
+ headers: new Headers(response.headers)
52
+ });
53
+ cloned.headers.set("x-sveltekit-prerender", String(prerender));
54
+ if (state.prerendering.inside_reroute && prerender) {
55
+ cloned.headers.set("x-sveltekit-routeid", encodeURI(event.route.id));
56
+ state.prerendering.dependencies.set(event.url.pathname, {
57
+ response: cloned,
58
+ body: null
59
+ });
60
+ } else return cloned;
61
+ }
62
+ return response;
63
+ } catch (e) {
64
+ if (e instanceof Redirect) return new Response(void 0, {
65
+ status: e.status,
66
+ headers: { location: e.location }
67
+ });
68
+ throw e;
69
+ }
70
+ }
71
+ /**
72
+ * @param {import('@sveltejs/kit').RequestEvent} event
73
+ */
74
+ function is_endpoint_request(event) {
75
+ const { method, headers } = event.request;
76
+ if (ENDPOINT_METHODS.includes(method) && !PAGE_METHODS.includes(method)) return true;
77
+ if (method === "POST" && headers.get("x-sveltekit-action") === "true") return false;
78
+ const accept = event.request.headers.get("accept") ?? "*/*";
79
+ return negotiate(accept, ["*", "text/html"]) !== "text/html";
80
+ }
81
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/utils/array.js
82
+ /**
83
+ * Removes nullish values from an array.
84
+ *
85
+ * @template T
86
+ * @param {Array<T>} arr
87
+ */
88
+ function compact(arr) {
89
+ return arr.filter(
90
+ /** @returns {val is NonNullable<T>} */
91
+ (val) => val != null
92
+ );
93
+ }
94
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/runtime/pathname.js
95
+ var ROUTES_PREFIX = "/routes";
96
+ /**
97
+ * The pathname of the route-ID-keyed resolution module for a given route ID,
98
+ * e.g. `/_app/routes/blog/[slug]/__route.js` (before prefixing with `base`).
99
+ * @param {string} route_id
100
+ * @returns {string}
101
+ */
102
+ function route_id_resolution_pathname(route_id) {
103
+ return add_resolution_suffix(`/${app_dir}${ROUTES_PREFIX}${route_id === "/" ? "" : route_id}`);
104
+ }
105
+ /**
106
+ * Whether a pathname (with the `/__route.js` suffix already stripped, and `base` NOT yet stripped)
107
+ * is a route-ID resolution request rather than a pathname resolution request.
108
+ * @param {string} pathname
109
+ * @returns {boolean}
110
+ */
111
+ function is_route_id_resolution_path(pathname) {
112
+ const prefix = `/ui/${app_dir}${ROUTES_PREFIX}`;
113
+ return pathname === prefix || pathname.startsWith(prefix + "/");
114
+ }
115
+ /**
116
+ * Extract the route ID from a decoded, base-stripped, suffix-stripped pathname,
117
+ * e.g. `/_app/routes/blog/[slug]` -> `/blog/[slug]`, `/_app/routes` -> `/`.
118
+ * @param {string} pathname
119
+ * @returns {string}
120
+ */
121
+ function extract_route_id(pathname) {
122
+ return pathname.slice(`/_app${ROUTES_PREFIX}`.length) || "/";
123
+ }
124
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/runtime/error-chain.js
125
+ /** @import { Component } from 'svelte'; */
126
+ /**
127
+ * Resolves the `+error.svelte` component that guards each node of `branch`, aligned to the
128
+ * branch with its empty slots removed. A node is guarded by the closest error page declared
129
+ * at or above it, except the root layout, which wraps the root error component rather than
130
+ * being wrapped by it.
131
+ * @template T
132
+ * @param {Array<unknown>} branch
133
+ * @param {Array<T | undefined | null>} errors the error page declared at each depth, if any
134
+ * @param {(error: T) => Promise<Component | undefined> | undefined} load
135
+ * @returns {Promise<Array<Component | undefined>>}
136
+ */
137
+ function build_error_chain(branch, errors, load) {
138
+ /** @type {Array<Promise<Component | undefined> | undefined>} */
139
+ const chain = [void 0];
140
+ let last_idx = -1;
141
+ for (let i = 1; i < branch.length; i += 1) {
142
+ if (!branch[i]) continue;
143
+ let j = i - 1;
144
+ while (j > last_idx + 1 && errors[j] == null) j -= 1;
145
+ last_idx = j;
146
+ const error = errors[j];
147
+ chain.push(error == null ? void 0 : load(error)?.catch(() => void 0));
148
+ }
149
+ return Promise.all(chain);
150
+ }
151
+ /**
152
+ * Walks up from the node at index `i` through the `+error.svelte` pages declared strictly
153
+ * above it, nearest first. Yields each candidate with the branch depth it attaches at,
154
+ * rewound past empty branch slots, so callers can skip candidates that fail to load.
155
+ * @template T
156
+ * @param {number} i
157
+ * @param {Array<unknown>} branch
158
+ * @param {Array<T | undefined | null>} errors the error page declared at each depth, if any
159
+ * @returns {Generator<{ error: T; idx: number }>}
160
+ */
161
+ function* nearest_error_pages(i, branch, errors) {
162
+ while (i--) {
163
+ const error = errors[i];
164
+ if (error != null) {
165
+ let j = i;
166
+ while (!branch[j]) j -= 1;
167
+ yield {
168
+ error,
169
+ idx: j + 1
170
+ };
171
+ }
172
+ }
173
+ }
174
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/utils/streaming.js
175
+ /**
176
+ * Create an async iterator and a function to push values into it
177
+ * @template T
178
+ * @returns {{
179
+ * iterate: (transform?: (input: T) => T) => AsyncIterable<T>;
180
+ * add: (promise: Promise<T>) => void;
181
+ * }}
182
+ */
183
+ function create_async_iterator() {
184
+ let resolved = -1;
185
+ /** @type {PromiseWithResolvers<T>[]} */
186
+ const deferred = [];
187
+ return {
188
+ async *iterate(transform = (x) => x) {
189
+ for (let i = 0; i < deferred.length; i += 1) yield transform(await deferred[i].promise);
190
+ },
191
+ add: (promise) => {
192
+ const next = Promise.withResolvers();
193
+ next.promise.catch(noop);
194
+ deferred.push(next);
195
+ promise.then((value) => {
196
+ deferred[++resolved].resolve(value);
197
+ }, (error) => {
198
+ deferred[++resolved].reject(error);
199
+ });
200
+ }
201
+ };
202
+ }
203
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/runtime/server/page/data_serializer.js
204
+ /**
205
+ * If the serialized data contains promises, `chunks` will be an
206
+ * async iterable containing their resolutions
207
+ * @param {import('@sveltejs/kit').RequestEvent} event
208
+ * @param {import('types').RequestState} state
209
+ * @returns {import('./types.js').ServerDataSerializer}
210
+ */
211
+ function server_data_serializer(event, state) {
212
+ let promise_id = 1;
213
+ let max_nodes = -1;
214
+ const iterator = create_async_iterator();
215
+ const global = "__sveltekit_7iohn";
216
+ /** @param {number} index */
217
+ function get_replacer(index) {
218
+ /** @param {any} thing */
219
+ return function replacer(thing) {
220
+ if (typeof thing?.then === "function") {
221
+ const id = promise_id++;
222
+ const promise = thing.then(
223
+ /** @param {any} data */
224
+ (data) => ({ data })
225
+ ).catch(
226
+ /** @param {any} error */
227
+ async (error) => ({ error: await handle_error_and_jsonify(event, state, error) })
228
+ ).then(
229
+ /**
230
+ * @param {{data: any; error: any}} result
231
+ */
232
+ async ({ data, error }) => {
233
+ let str;
234
+ try {
235
+ str = uneval(error ? [, error] : [data], replacer);
236
+ } catch (serialization_error) {
237
+ error = await handle_error_and_jsonify(event, state, capture_error(() => load_promise_not_serializable({ id: event.route.id }, { cause: serialization_error })));
238
+ str = uneval([, error], replacer);
239
+ }
240
+ return {
241
+ index,
242
+ str: `${global}.resolve(${id}, ${str.includes("app.decode") ? `(app) => ${str}` : `() => ${str}`})`
243
+ };
244
+ }
245
+ );
246
+ iterator.add(promise);
247
+ return `${global}.defer(${id})`;
248
+ } else for (const key in encoders) {
249
+ const encoded = encoders[key](thing);
250
+ if (encoded) return `app.decode('${key}', ${uneval(encoded, replacer)})`;
251
+ }
252
+ };
253
+ }
254
+ const strings = [];
255
+ return {
256
+ set_max_nodes(i) {
257
+ max_nodes = i;
258
+ },
259
+ add_node(i, node) {
260
+ try {
261
+ if (!node) {
262
+ strings[i] = "null";
263
+ return;
264
+ }
265
+ /** @type {any} */
266
+ const payload = {
267
+ type: "data",
268
+ data: node.data,
269
+ uses: serialize_uses(node)
270
+ };
271
+ if (node.slash) payload.slash = node.slash;
272
+ strings[i] = uneval(payload, get_replacer(i));
273
+ } catch (error) {
274
+ error.path = error.path.slice(1);
275
+ throw_devalue_error(event, error);
276
+ }
277
+ },
278
+ get_data(csp) {
279
+ const open = `<script${csp.script_needs_nonce ? ` nonce="${csp.nonce}"` : ""}>`;
280
+ const close = `<\/script>\n`;
281
+ return {
282
+ data: `[${compact(max_nodes > -1 ? strings.slice(0, max_nodes) : strings).join(",")}]`,
283
+ chunks: promise_id > 1 ? iterator.iterate(({ index, str }) => {
284
+ if (max_nodes > -1 && index >= max_nodes) return "";
285
+ return open + str + close;
286
+ }) : null
287
+ };
288
+ }
289
+ };
290
+ }
291
+ /**
292
+ * If the serialized data contains promises, `chunks` will be an
293
+ * async iterable containing their resolutions
294
+ * @param {import('@sveltejs/kit').RequestEvent} event
295
+ * @param {import('types').RequestState} state
296
+ * @returns {import('./types.js').ServerDataSerializerJson}
297
+ */
298
+ function server_data_serializer_json(event, state) {
299
+ let promise_id = 1;
300
+ const iterator = create_async_iterator();
301
+ const reducers = {
302
+ ...encoders,
303
+ /** @param {any} thing */
304
+ Promise: (thing) => {
305
+ if (typeof thing?.then !== "function") return;
306
+ const id = promise_id++;
307
+ /** @type {'data' | 'error'} */
308
+ let key = "data";
309
+ const promise = thing.catch(
310
+ /** @param {any} error */
311
+ async (error) => {
312
+ key = "error";
313
+ return handle_error_and_jsonify(event, state, error);
314
+ }
315
+ ).then(
316
+ /** @param {any} value */
317
+ async (value) => {
318
+ let str;
319
+ try {
320
+ str = stringify(value, reducers);
321
+ } catch (serialization_error) {
322
+ const error = await handle_error_and_jsonify(event, state, capture_error(() => load_promise_not_serializable({ id: event.route.id }, { cause: serialization_error })));
323
+ key = "error";
324
+ str = stringify(error, reducers);
325
+ }
326
+ return `{"type":"chunk","id":${id},"${key}":${str}}\n`;
327
+ }
328
+ );
329
+ iterator.add(promise);
330
+ return id;
331
+ }
332
+ };
333
+ const strings = [];
334
+ return {
335
+ add_node(i, node) {
336
+ try {
337
+ if (!node) {
338
+ strings[i] = "null";
339
+ return;
340
+ }
341
+ if (node.type === "error" || node.type === "skip") {
342
+ strings[i] = JSON.stringify(node);
343
+ return;
344
+ }
345
+ strings[i] = `{"type":"data","data":${stringify(node.data, reducers)},"uses":${JSON.stringify(serialize_uses(node))}${node.slash ? `,"slash":${JSON.stringify(node.slash)}` : ""}}`;
346
+ } catch (error) {
347
+ error.path = "data" + error.path;
348
+ throw_devalue_error(event, error);
349
+ }
350
+ },
351
+ get_data() {
352
+ return {
353
+ data: `{"type":"data","nodes":[${strings.join(",")}]}\n`,
354
+ chunks: promise_id > 1 ? iterator.iterate() : null
355
+ };
356
+ }
357
+ };
358
+ }
359
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/runtime/server/constants.js
360
+ var NULL_BODY_STATUS = [
361
+ 101,
362
+ 103,
363
+ 204,
364
+ 205,
365
+ 304
366
+ ];
367
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/runtime/server/page/load_data.js
368
+ /**
369
+ * Calls the user's server `load` function.
370
+ * @param {{
371
+ * event: import('@sveltejs/kit').RequestEvent;
372
+ * state: import('types').RequestState;
373
+ * node: import('types').SSRNode | undefined;
374
+ * parent: () => Promise<Record<string, any>>;
375
+ * }} opts
376
+ * @returns {Promise<import('types').ServerDataNode | null>}
377
+ */
378
+ async function load_server_data({ event, state, node, parent }) {
379
+ if (!node?.server) return null;
380
+ let is_tracking = true;
381
+ const uses = {
382
+ dependencies: /* @__PURE__ */ new Set(),
383
+ params: /* @__PURE__ */ new Set(),
384
+ parent: false,
385
+ route: false,
386
+ url: false,
387
+ search_params: /* @__PURE__ */ new Set()
388
+ };
389
+ const load = node.server.load;
390
+ const slash = node.server.trailingSlash;
391
+ if (!load) return {
392
+ type: "data",
393
+ data: null,
394
+ uses,
395
+ slash
396
+ };
397
+ const url = make_trackable(event.url, () => {
398
+ if (is_tracking) uses.url = true;
399
+ }, (param) => {
400
+ if (is_tracking) uses.search_params.add(param);
401
+ });
402
+ if (is_prerendering(state)) disable_search(url);
403
+ const load_state = {
404
+ ...state,
405
+ is_in_server_load: true
406
+ };
407
+ return {
408
+ type: "data",
409
+ data: await record_span({
410
+ name: "sveltekit.load",
411
+ attributes: {
412
+ "sveltekit.load.node_id": node.server_id || "unknown",
413
+ "sveltekit.load.node_type": get_node_type(node.server_id),
414
+ "sveltekit.load.environment": "server",
415
+ "http.route": event.route.id || "unknown"
416
+ },
417
+ fn: async (current) => {
418
+ const traced_event = merge_tracing(event, current);
419
+ return await with_request_store({
420
+ event: traced_event,
421
+ state: load_state
422
+ }, () => load.call(null, {
423
+ ...traced_event,
424
+ fetch: (info, init) => {
425
+ new URL(info instanceof Request ? info.url : info, event.url);
426
+ return event.fetch(info, init);
427
+ },
428
+ /** @param {string[]} deps */
429
+ depends: (...deps) => {
430
+ for (const dep of deps) {
431
+ const { href } = new URL(dep, event.url);
432
+ uses.dependencies.add(href);
433
+ }
434
+ },
435
+ params: new Proxy(event.params, { get: (target, key) => {
436
+ if (is_tracking) uses.params.add(key);
437
+ return target[key];
438
+ } }),
439
+ parent: async () => {
440
+ if (is_tracking) uses.parent = true;
441
+ return parent();
442
+ },
443
+ route: new Proxy(event.route, { get: (target, key) => {
444
+ if (is_tracking) uses.route = true;
445
+ return target[key];
446
+ } }),
447
+ url,
448
+ untrack(fn) {
449
+ is_tracking = false;
450
+ try {
451
+ return fn();
452
+ } finally {
453
+ is_tracking = true;
454
+ }
455
+ }
456
+ }));
457
+ }
458
+ }) ?? null,
459
+ uses,
460
+ slash
461
+ };
462
+ }
463
+ /**
464
+ * Calls the user's `load` function.
465
+ * @param {{
466
+ * event: import('@sveltejs/kit').RequestEvent;
467
+ * state: import('types').RequestState;
468
+ * fetched: import('./types.js').Fetched[];
469
+ * node: import('types').SSRNode | undefined;
470
+ * parent: () => Promise<Record<string, any>>;
471
+ * resolve_opts: import('types').RequiredResolveOptions;
472
+ * server_data_promise: Promise<import('types').ServerDataNode | null>;
473
+ * csr: boolean;
474
+ * }} opts
475
+ * @returns {Promise<Record<string, any | Promise<any>> | null>}
476
+ */
477
+ async function load_data({ event, state, fetched, node, parent, server_data_promise, resolve_opts, csr }) {
478
+ const server_data_node = await server_data_promise;
479
+ const load = node?.universal?.load;
480
+ if (!load) return server_data_node?.data ?? null;
481
+ return await record_span({
482
+ name: "sveltekit.load",
483
+ attributes: {
484
+ "sveltekit.load.node_id": node.universal_id || "unknown",
485
+ "sveltekit.load.node_type": get_node_type(node.universal_id),
486
+ "sveltekit.load.environment": "server",
487
+ "http.route": event.route.id || "unknown"
488
+ },
489
+ fn: async (current) => {
490
+ const traced_event = merge_tracing(event, current);
491
+ return await with_request_store({
492
+ event: traced_event,
493
+ state
494
+ }, () => load.call(null, {
495
+ url: event.url,
496
+ params: event.params,
497
+ data: server_data_node?.data ?? null,
498
+ route: event.route,
499
+ fetch: create_universal_fetch(event, state.prerendering, fetched, csr, resolve_opts),
500
+ setHeaders: event.setHeaders,
501
+ depends: noop,
502
+ parent,
503
+ untrack: (fn) => fn(),
504
+ tracing: traced_event.tracing
505
+ }));
506
+ }
507
+ }) ?? null;
508
+ }
509
+ /**
510
+ * @param {Pick<import('@sveltejs/kit').RequestEvent, 'fetch' | 'url' | 'request' | 'route'>} event
511
+ * @param {import('types').PrerenderOptions | undefined} prerendering
512
+ * @param {import('./types.js').Fetched[]} fetched
513
+ * @param {boolean} csr
514
+ * @param {Pick<Required<import('@sveltejs/kit/hooks').ResolveOptions>, 'filterSerializedResponseHeaders'>} resolve_opts
515
+ * @returns {typeof fetch}
516
+ */
517
+ function create_universal_fetch(event, prerendering, fetched, csr, resolve_opts) {
518
+ /**
519
+ * @param {URL | RequestInfo} input
520
+ * @param {RequestInit} [init]
521
+ */
522
+ const universal_fetch = async (input, init) => {
523
+ const cloned_body = input instanceof Request && input.body ? input.clone().body : null;
524
+ const cloned_headers = input instanceof Request && [...input.headers].length ? new Headers(input.headers) : init?.headers;
525
+ let response = await event.fetch(input, init);
526
+ const url = new URL(input instanceof Request ? input.url : input, event.url);
527
+ const same_origin = url.origin === event.url.origin;
528
+ /** @type {import('types').PrerenderDependency} */
529
+ let dependency;
530
+ if (same_origin) {
531
+ if (prerendering) {
532
+ dependency = {
533
+ response,
534
+ body: null
535
+ };
536
+ prerendering.dependencies.set(url.pathname, dependency);
537
+ }
538
+ } else if (url.protocol === "https:" || url.protocol === "http:") {
539
+ if ((input instanceof Request ? input.mode : init?.mode ?? "cors") === "no-cors") response = new Response("", {
540
+ status: response.status,
541
+ statusText: response.statusText,
542
+ headers: response.headers
543
+ });
544
+ else {
545
+ const acao = response.headers.get("access-control-allow-origin");
546
+ if (!acao || acao !== event.url.origin && acao !== "*") load_fetch_cors({ reason: acao ? "Incorrect" : "No" });
547
+ }
548
+ }
549
+ /** @type {ReadableStream<Uint8Array>} */
550
+ let teed_body;
551
+ const proxy = new Proxy(response, { get(response, key, receiver) {
552
+ /**
553
+ * @param {string | undefined} body
554
+ * @param {boolean} is_b64
555
+ */
556
+ async function push_fetched(body, is_b64) {
557
+ const status_number = Number(response.status);
558
+ if (isNaN(status_number)) throw new Error(`response.status is not a number. value: "${response.status}" type: ${typeof response.status}`);
559
+ const request_body = input instanceof Request && cloned_body ? await new Response(cloned_body).text() : init?.body;
560
+ if (request_body && typeof request_body !== "string" && !ArrayBuffer.isView(request_body)) return;
561
+ fetched.push({
562
+ url: fetch_cache_url(url, event.url),
563
+ method: event.request.method,
564
+ request_body,
565
+ request_headers: cloned_headers,
566
+ response_body: body,
567
+ response,
568
+ is_b64
569
+ });
570
+ }
571
+ if (key === "body") {
572
+ if (response.body === null) return null;
573
+ if (teed_body) return teed_body;
574
+ const [a, b] = response.body.tee();
575
+ (async () => {
576
+ const result = new Uint8Array(await new Response(a).arrayBuffer());
577
+ if (dependency) dependency.body = new Uint8Array(result);
578
+ push_fetched(base64_encode(result), true);
579
+ })().catch(noop);
580
+ return teed_body = b;
581
+ }
582
+ if (key === "arrayBuffer") return async () => {
583
+ const buffer = await response.arrayBuffer();
584
+ const bytes = new Uint8Array(buffer);
585
+ if (dependency) dependency.body = bytes;
586
+ if (buffer instanceof ArrayBuffer) await push_fetched(base64_encode(bytes), true);
587
+ return buffer;
588
+ };
589
+ async function text() {
590
+ const body = await response.text();
591
+ if (body === "" && NULL_BODY_STATUS.includes(response.status)) {
592
+ await push_fetched(void 0, false);
593
+ return;
594
+ }
595
+ if (!body || typeof body === "string") await push_fetched(body, false);
596
+ if (dependency) dependency.body = body;
597
+ return body;
598
+ }
599
+ if (key === "text") return text;
600
+ if (key === "json") return async () => {
601
+ const body = await text();
602
+ return body ? JSON.parse(body) : void 0;
603
+ };
604
+ const value = Reflect.get(response, key, response);
605
+ if (value instanceof Function) return Object.defineProperties(
606
+ /**
607
+ * @this {any}
608
+ */
609
+ function() {
610
+ return Reflect.apply(value, this === receiver ? response : this, arguments);
611
+ },
612
+ {
613
+ name: { value: value.name },
614
+ length: { value: value.length }
615
+ }
616
+ );
617
+ return value;
618
+ } });
619
+ if (csr) {
620
+ const get = response.headers.get;
621
+ response.headers.get = (key) => {
622
+ const lower = key.toLowerCase();
623
+ const value = get.call(response.headers, lower);
624
+ if (value && !lower.startsWith("x-sveltekit-")) {
625
+ if (!resolve_opts.filterSerializedResponseHeaders(lower, value)) load_response_header_not_serialized({
626
+ name: lower,
627
+ id: event.route.id
628
+ });
629
+ }
630
+ return value;
631
+ };
632
+ const get_set_cookie = response.headers.getSetCookie;
633
+ response.headers.getSetCookie = () => {
634
+ const values = get_set_cookie.call(response.headers);
635
+ for (const value of values) if (!resolve_opts.filterSerializedResponseHeaders("set-cookie", value)) load_response_header_not_serialized({
636
+ name: "set-cookie",
637
+ id: event.route.id
638
+ });
639
+ return values;
640
+ };
641
+ }
642
+ return proxy;
643
+ };
644
+ return (input, init) => {
645
+ const response = universal_fetch(input, init);
646
+ response.catch(noop);
647
+ return response;
648
+ };
649
+ }
650
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/utils/misc.js
651
+ var s = JSON.stringify;
652
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/utils/escape.js
653
+ /**
654
+ * When inside a double-quoted attribute value, only `&` and `"` hold special meaning.
655
+ * @see https://html.spec.whatwg.org/multipage/parsing.html#attribute-value-(double-quoted)-state
656
+ * @type {Record<string, string>}
657
+ */
658
+ var escape_html_attr_dict = {
659
+ "&": "&amp;",
660
+ "\"": "&quot;"
661
+ };
662
+ /**
663
+ * @type {Record<string, string>}
664
+ */
665
+ var escape_html_dict = {
666
+ "&": "&amp;",
667
+ "<": "&lt;"
668
+ };
669
+ /** @param {Record<string, string>} dict */
670
+ var escape_regex = (dict) => new RegExp(`[${Object.keys(dict).join("")}]|\\p{Surrogate}`, "gu");
671
+ var escape_html_attr_regex = escape_regex(escape_html_attr_dict);
672
+ var escape_html_regex = escape_regex(escape_html_dict);
673
+ /**
674
+ * Escapes unpaired surrogates (which are allowed in js strings but invalid in HTML) and
675
+ * escapes characters that are special.
676
+ *
677
+ * @param {string} str
678
+ * @param {boolean} [is_attr]
679
+ * @returns {string} escaped string
680
+ * @example const html = `<tag data-value="${escape_html('value', true)}">...</tag>`;
681
+ */
682
+ function escape_html(str, is_attr) {
683
+ const dict = is_attr ? escape_html_attr_dict : escape_html_dict;
684
+ return str.replace(is_attr ? escape_html_attr_regex : escape_html_regex, (match) => dict[match] ?? `&#${match.charCodeAt(0)};`);
685
+ }
686
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/utils/hash.js
687
+ /**
688
+ * Hash using djb2
689
+ * @param {import('types').StrictBody[]} values
690
+ */
691
+ function hash(...values) {
692
+ let hash = 5381;
693
+ for (const value of values) if (typeof value === "string") {
694
+ let i = value.length;
695
+ while (i) hash = hash * 33 ^ value.charCodeAt(--i);
696
+ } else if (ArrayBuffer.isView(value)) {
697
+ const buffer = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
698
+ let i = buffer.length;
699
+ while (i) hash = hash * 33 ^ buffer[--i];
700
+ } else throw new TypeError("value must be a string or TypedArray");
701
+ return (hash >>> 0).toString(36);
702
+ }
703
+ /**
704
+ * Hash of the headers and body a `fetch` was called with. The server-side serializer and the
705
+ * client-side cache lookup must produce identical values for cached responses to be found.
706
+ * @param {HeadersInit | undefined} headers
707
+ * @param {import('types').StrictBody | null | undefined} body
708
+ */
709
+ function hash_request(headers, body) {
710
+ /** @type {import('types').StrictBody[]} */
711
+ const values = [];
712
+ if (headers) values.push([...new Headers(headers)].join(","));
713
+ if (body) values.push(body);
714
+ return hash(...values);
715
+ }
716
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/runtime/server/page/serialize_data.js
717
+ /**
718
+ * Inside a script element, only `<\/script` and `<!--` hold special meaning to the HTML parser.
719
+ *
720
+ * The first closes the script element, so everything after is treated as raw HTML.
721
+ * The second disables further parsing until `-->`, so the script element might be unexpectedly
722
+ * kept open up until an unrelated HTML comment in the page.
723
+ *
724
+ * U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR are escaped for the sake of pre-2018
725
+ * browsers.
726
+ *
727
+ * @see tests for unsafe parsing examples.
728
+ * @see https://html.spec.whatwg.org/multipage/scripting.html#restrictions-for-contents-of-script-elements
729
+ * @see https://html.spec.whatwg.org/multipage/syntax.html#cdata-rcdata-restrictions
730
+ * @see https://html.spec.whatwg.org/multipage/parsing.html#script-data-state
731
+ * @see https://html.spec.whatwg.org/multipage/parsing.html#script-data-double-escaped-state
732
+ * @see https://github.com/tc39/proposal-json-superset
733
+ * @type {Record<string, string>}
734
+ */
735
+ var replacements = {
736
+ "<": "\\u003C",
737
+ "\u2028": "\\u2028",
738
+ "\u2029": "\\u2029"
739
+ };
740
+ var pattern = new RegExp(`[${Object.keys(replacements).join("")}]`, "g");
741
+ /**
742
+ * Generates a raw HTML string containing a safe script element carrying data and associated attributes.
743
+ *
744
+ * It escapes all the special characters needed to guarantee the element is unbroken, but care must
745
+ * be taken to ensure it is inserted in the document at an acceptable position for a script element,
746
+ * and that the resulting string isn't further modified.
747
+ *
748
+ * @param {import('./types.js').Fetched} fetched
749
+ * @param {(name: string, value: string) => boolean} filter
750
+ * @param {boolean} [prerendering]
751
+ * @returns {string} The raw HTML of a script element carrying the JSON payload.
752
+ * @example const html = serialize_data('/data.json', null, { foo: 'bar' });
753
+ */
754
+ function serialize_data(fetched, filter, prerendering = false) {
755
+ /** @type {Record<string, string>} */
756
+ const headers = {};
757
+ let cache_control = null;
758
+ let age = null;
759
+ let varyAny = false;
760
+ for (const [key, value] of fetched.response.headers) {
761
+ if (filter(key, value)) headers[key] = value;
762
+ if (key === "cache-control") cache_control = value;
763
+ else if (key === "age") age = value;
764
+ else if (key === "vary" && value.trim() === "*") varyAny = true;
765
+ }
766
+ const payload = {
767
+ status: fetched.response.status,
768
+ statusText: fetched.response.statusText,
769
+ headers,
770
+ body: fetched.response_body
771
+ };
772
+ const safe_payload = JSON.stringify(payload).replace(pattern, (match) => replacements[match]);
773
+ const attrs = [
774
+ "type=\"application/json\"",
775
+ "data-sveltekit-fetched",
776
+ `data-url="${escape_html(fetched.url, true)}"`
777
+ ];
778
+ if (fetched.is_b64) attrs.push("data-b64");
779
+ if (fetched.request_headers || fetched.request_body) attrs.push(`data-hash="${hash_request(fetched.request_headers, fetched.request_body)}"`);
780
+ if (!prerendering && fetched.method === "GET" && cache_control && !varyAny) {
781
+ const match = /s-maxage=(\d+)/g.exec(cache_control) ?? /max-age=(\d+)/g.exec(cache_control);
782
+ if (match) {
783
+ const ttl = +match[1] - +(age ?? "0");
784
+ attrs.push(`data-ttl="${ttl}"`);
785
+ }
786
+ }
787
+ return `<script ${attrs.join(" ")}>${safe_payload}<\/script>`;
788
+ }
789
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/runtime/server/page/csp.js
790
+ var array = /* @__PURE__ */ new Uint8Array(16);
791
+ function generate_nonce() {
792
+ crypto.getRandomValues(array);
793
+ return base64_encode(array);
794
+ }
795
+ /** @param {string} content */
796
+ async function sha256(content) {
797
+ const digest = await crypto.subtle.digest("SHA-256", text_encoder.encode(content));
798
+ return base64_encode(new Uint8Array(digest));
799
+ }
800
+ /** @typedef {`nonce-${string}` | `sha256-${string}`} CspSource */
801
+ var quoted = /* @__PURE__ */ new Set([
802
+ "self",
803
+ "unsafe-eval",
804
+ "unsafe-hashes",
805
+ "unsafe-inline",
806
+ "none",
807
+ "strict-dynamic",
808
+ "report-sample",
809
+ "report-sha256",
810
+ "report-sha384",
811
+ "report-sha512",
812
+ "wasm-unsafe-eval",
813
+ "script"
814
+ ]);
815
+ var crypto_pattern = /^(nonce|sha\d\d\d)-/;
816
+ var BaseProvider = class {
817
+ /** @type {boolean} */
818
+ #use_hashes;
819
+ /** @type {boolean} */
820
+ script_needs_csp;
821
+ /** @type {boolean} */
822
+ #script_src_needs_csp;
823
+ /** @type {boolean} */
824
+ #script_src_elem_needs_csp;
825
+ /** @type {boolean} */
826
+ style_needs_csp;
827
+ /** @type {boolean} */
828
+ #style_src_needs_csp;
829
+ /** @type {boolean} */
830
+ #style_src_attr_needs_csp;
831
+ /** @type {boolean} */
832
+ #style_src_elem_needs_csp;
833
+ /** @type {import('types').CspDirectives} */
834
+ #directives;
835
+ /** @type {Set<import('types').Csp.Source>} */
836
+ #script_src = /* @__PURE__ */ new Set();
837
+ /** @type {Set<import('types').Csp.Source>} */
838
+ #script_src_elem = /* @__PURE__ */ new Set();
839
+ /** @type {Set<import('types').Csp.Source>} */
840
+ #style_src = /* @__PURE__ */ new Set();
841
+ /** @type {Set<import('types').Csp.Source>} */
842
+ #style_src_attr = /* @__PURE__ */ new Set();
843
+ /** @type {Set<import('types').Csp.Source>} */
844
+ #style_src_elem = /* @__PURE__ */ new Set();
845
+ /** @type {boolean} */
846
+ script_needs_nonce;
847
+ /** @type {boolean} */
848
+ style_needs_nonce;
849
+ /** @type {boolean} */
850
+ script_needs_hash;
851
+ /**
852
+ * @param {boolean} use_hashes
853
+ * @param {import('types').CspDirectives} directives
854
+ */
855
+ constructor(use_hashes, directives) {
856
+ this.#use_hashes = use_hashes;
857
+ this.#directives = directives;
858
+ const d = this.#directives;
859
+ const effective_script_src = d["script-src"] || d["default-src"];
860
+ const script_src_elem = d["script-src-elem"];
861
+ const effective_style_src = d["style-src"] || d["default-src"];
862
+ const style_src_attr = d["style-src-attr"];
863
+ const style_src_elem = d["style-src-elem"];
864
+ /** @param {(import('types').Csp.Source | import('types').Csp.ActionSource)[] | undefined} directive */
865
+ const style_needs_csp = (directive) => !!directive && !directive.some((value) => value === "unsafe-inline");
866
+ /** @param {(import('types').Csp.Source | import('types').Csp.ActionSource)[] | undefined} directive */
867
+ const script_needs_csp = (directive) => !!directive && (!directive.some((value) => value === "unsafe-inline") || directive.some((value) => value === "strict-dynamic"));
868
+ this.#script_src_needs_csp = script_needs_csp(effective_script_src);
869
+ this.#script_src_elem_needs_csp = script_needs_csp(script_src_elem);
870
+ this.#style_src_needs_csp = style_needs_csp(effective_style_src);
871
+ this.#style_src_attr_needs_csp = style_needs_csp(style_src_attr);
872
+ this.#style_src_elem_needs_csp = style_needs_csp(style_src_elem);
873
+ this.script_needs_csp = this.#script_src_needs_csp || this.#script_src_elem_needs_csp;
874
+ this.style_needs_csp = this.#style_src_needs_csp || this.#style_src_attr_needs_csp || this.#style_src_elem_needs_csp;
875
+ this.script_needs_nonce = this.script_needs_csp && !this.#use_hashes;
876
+ this.style_needs_nonce = this.style_needs_csp && !this.#use_hashes;
877
+ this.script_needs_hash = this.script_needs_csp && this.#use_hashes;
878
+ }
879
+ /** @param {CspSource} source */
880
+ add_script(source) {
881
+ if (this.#script_src_needs_csp) this.#script_src.add(source);
882
+ if (this.#script_src_elem_needs_csp) this.#script_src_elem.add(source);
883
+ }
884
+ /** @param {CspSource} source */
885
+ add_style(source) {
886
+ if (!this.style_needs_csp) return;
887
+ if (this.#style_src_needs_csp) this.#style_src.add(source);
888
+ if (this.#style_src_attr_needs_csp) this.#style_src_attr.add(source);
889
+ if (this.#style_src_elem_needs_csp) {
890
+ const sha256_empty_comment_hash = "sha256-9OlNO0DNEeaVzHL4RZwCLsBHA8WBQ8toBp/4F5XV2nc=";
891
+ const d = this.#directives;
892
+ 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);
893
+ if (source !== sha256_empty_comment_hash) this.#style_src_elem.add(source);
894
+ }
895
+ }
896
+ /**
897
+ * @param {boolean} [is_meta]
898
+ */
899
+ get_header(is_meta = false) {
900
+ const header = [];
901
+ const directives = { ...this.#directives };
902
+ /**
903
+ * @template {'style-src' | 'style-src-attr' | 'style-src-elem' | 'script-src' | 'script-src-elem'} K
904
+ * @param {K} key
905
+ * @param {Set<import('types').Csp.Source>} sources
906
+ * @param {import('types').CspDirectives[K]} [base]
907
+ */
908
+ const merge_sources = (key, sources, base) => {
909
+ if (sources.size > 0) directives[key] = [...base || [], ...sources];
910
+ };
911
+ merge_sources("style-src", this.#style_src, directives["style-src"] || directives["default-src"]);
912
+ merge_sources("style-src-attr", this.#style_src_attr, directives["style-src-attr"]);
913
+ merge_sources("style-src-elem", this.#style_src_elem, directives["style-src-elem"]);
914
+ merge_sources("script-src", this.#script_src, directives["script-src"] || directives["default-src"]);
915
+ merge_sources("script-src-elem", this.#script_src_elem, directives["script-src-elem"]);
916
+ for (const key in directives) {
917
+ if (is_meta && (key === "frame-ancestors" || key === "report-uri" || key === "sandbox")) continue;
918
+ const value = directives[key];
919
+ if (!value) continue;
920
+ const directive = [key];
921
+ if (Array.isArray(value)) for (const source of value) directive.push(quoted.has(source) || crypto_pattern.test(source) ? `'${source}'` : source);
922
+ header.push(directive.join(" "));
923
+ }
924
+ return header.join("; ");
925
+ }
926
+ };
927
+ var CspProvider = class extends BaseProvider {
928
+ get_meta() {
929
+ const content = this.get_header(true);
930
+ if (!content) return;
931
+ return `<meta http-equiv="content-security-policy" content="${escape_html(content, true)}">`;
932
+ }
933
+ };
934
+ var CspReportOnlyProvider = class extends BaseProvider {
935
+ /**
936
+ * @param {boolean} use_hashes
937
+ * @param {import('types').CspDirectives} directives
938
+ */
939
+ constructor(use_hashes, directives) {
940
+ super(use_hashes, directives);
941
+ if (Object.values(directives).some((v) => !!v) && !directives["report-to"]?.length && !directives["report-uri"]?.length) csp_report_only_missing_report();
942
+ }
943
+ };
944
+ var Csp = class {
945
+ /** @readonly */
946
+ nonce = generate_nonce();
947
+ /** @type {CspProvider} */
948
+ csp_provider;
949
+ /** @type {CspReportOnlyProvider} */
950
+ report_only_provider;
951
+ /** @type {boolean} */
952
+ #use_hashes;
953
+ /**
954
+ * @param {import('./types.js').CspConfig} config
955
+ * @param {import('./types.js').CspOpts} opts
956
+ */
957
+ constructor({ mode, directives, reportOnly }, { prerender }) {
958
+ this.#use_hashes = mode === "hash" || mode === "auto" && prerender;
959
+ this.csp_provider = new CspProvider(this.#use_hashes, directives);
960
+ this.report_only_provider = new CspReportOnlyProvider(this.#use_hashes, reportOnly);
961
+ }
962
+ /**
963
+ * @param {string} content
964
+ * @returns {Promise<CspSource>}
965
+ */
966
+ async #get_source(content) {
967
+ return this.#use_hashes ? `sha256-${await sha256(content)}` : `nonce-${this.nonce}`;
968
+ }
969
+ get script_needs_hash() {
970
+ return this.csp_provider.script_needs_hash || this.report_only_provider.script_needs_hash;
971
+ }
972
+ get script_needs_nonce() {
973
+ return this.csp_provider.script_needs_nonce || this.report_only_provider.script_needs_nonce;
974
+ }
975
+ get style_needs_nonce() {
976
+ return this.csp_provider.style_needs_nonce || this.report_only_provider.style_needs_nonce;
977
+ }
978
+ /** @param {string} content */
979
+ async add_script(content) {
980
+ if (!this.csp_provider.script_needs_csp && !this.report_only_provider.script_needs_csp) return;
981
+ const source = await this.#get_source(content);
982
+ if (this.csp_provider.script_needs_csp) this.csp_provider.add_script(source);
983
+ if (this.report_only_provider.script_needs_csp) this.report_only_provider.add_script(source);
984
+ }
985
+ /** @param {`sha256-${string}`[]} hashes */
986
+ add_script_hashes(hashes) {
987
+ for (const hash of hashes) {
988
+ this.csp_provider.add_script(hash);
989
+ this.report_only_provider.add_script(hash);
990
+ }
991
+ }
992
+ /** @param {string} content */
993
+ async add_style(content) {
994
+ if (!this.csp_provider.style_needs_csp && !this.report_only_provider.style_needs_csp) return;
995
+ const source = await this.#get_source(content);
996
+ this.csp_provider.add_style(source);
997
+ this.report_only_provider.add_style(source);
998
+ }
999
+ };
1000
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/runtime/server/page/server_routing.js
1001
+ /** @import { ParamValue } from '@sveltejs/kit/params' */
1002
+ /** @import { SSRManifest } from 'types' */
1003
+ /**
1004
+ * @param {import('types').SSRClientRoute} route
1005
+ * @param {URL} url
1006
+ * @param {NonNullable<SSRManifest['client']>} client
1007
+ * @returns {string}
1008
+ */
1009
+ function generate_route_object(route, url, client) {
1010
+ const { errors, layouts, leaf } = route;
1011
+ const paths = resolve_paths(url.pathname);
1012
+ const nodes = [
1013
+ ...errors,
1014
+ ...layouts.map((l) => l?.[1]),
1015
+ leaf[1]
1016
+ ].filter((n) => typeof n === "number").map((n) => `'${n}': () => ${create_client_import(client.nodes?.[n], paths)}`).join(",\n ");
1017
+ return [
1018
+ `{\n\tid: ${s(route.id)}`,
1019
+ `errors: ${s(route.errors)}`,
1020
+ `layouts: ${s(route.layouts)}`,
1021
+ `leaf: ${s(route.leaf)}`,
1022
+ `nodes: {\n\t\t${nodes}\n\t}\n}`
1023
+ ].join(",\n ");
1024
+ }
1025
+ /**
1026
+ * The `base` and `assets` prefixes for client paths in a document at `pathname`. With
1027
+ * `paths.relative`, they're relative to that document so the app also works when served
1028
+ * from IPFS, the internet archive, or behind a proxy.
1029
+ * @param {string} pathname
1030
+ */
1031
+ function resolve_paths(pathname) {
1032
+ const relative_base = pathname.slice(3).split("/").slice(2).map(() => "..").join("/") || ".";
1033
+ return {
1034
+ base: relative_base,
1035
+ assets: !assets || assets[0] === "/" && assets !== "/_svelte_kit_assets" ? relative_base : assets
1036
+ };
1037
+ }
1038
+ /**
1039
+ * @param {string} path a root-absolute dev path (e.g. `/@fs/...`) or a prod path relative to `assets`
1040
+ * @param {ReturnType<typeof resolve_paths>} paths
1041
+ */
1042
+ function client_path(path, { base, assets }) {
1043
+ return path[0] === "/" ? base + path : `${assets}/${path}`;
1044
+ }
1045
+ /**
1046
+ * @param {string | undefined} import_path
1047
+ * @param {ReturnType<typeof resolve_paths>} paths
1048
+ */
1049
+ function create_client_import(import_path, paths) {
1050
+ return import_path ? `import('${client_path(import_path, paths)}')` : "Promise.resolve({})";
1051
+ }
1052
+ /**
1053
+ * @param {string} resolved_path
1054
+ * @param {URL} url
1055
+ * @returns {Promise<Response>}
1056
+ */
1057
+ async function resolve_route(resolved_path, url) {
1058
+ if (!manifest.client?.routes) return text("Server-side route resolution disabled", { status: 400 });
1059
+ try {
1060
+ const matchers = await manifest.matchers();
1061
+ const result = find_route(resolved_path, manifest.client.routes, matchers);
1062
+ return create_server_routing_response(result?.route ?? null, result?.params ?? {}, url, manifest.client).response;
1063
+ } catch {
1064
+ return text("Error resolving route", { status: 500 });
1065
+ }
1066
+ }
1067
+ /**
1068
+ * Resolve a route-ID resolution request (`/_app/routes/<id>/__route.js`) to a
1069
+ * JS module containing the route's node loaders. Params are always `{}` since
1070
+ * this endpoint exists to support `preloadCode(routeId)`, which doesn't need them.
1071
+ *
1072
+ * The module has one of three shapes, which the client uses to tell three cases apart:
1073
+ *
1074
+ * - `export const route = {...}` — a page route, with loaders to import
1075
+ * - `export const endpoint_only = true` — a real route with no `+page`, so there is
1076
+ * nothing to preload, but the client can cache that fact and stop asking
1077
+ * - an empty module — no such route
1078
+ *
1079
+ * @param {string} route_id
1080
+ * @param {URL} url
1081
+ * @returns {Response}
1082
+ */
1083
+ function resolve_route_by_id(route_id, url) {
1084
+ if (!manifest.client?.routes) return text("Server-side route resolution disabled", { status: 400 });
1085
+ try {
1086
+ const route = manifest.client.routes.find((r) => r.id === route_id);
1087
+ if (route) return create_server_routing_response(route, null, url, manifest.client).response;
1088
+ if (manifest.routes.some((r) => r.id === route_id && !r.page)) return text("export const endpoint_only = true;", { headers: js_headers() });
1089
+ return create_server_routing_response(null, null, url, manifest.client).response;
1090
+ } catch {
1091
+ return text("Error resolving route", { status: 500 });
1092
+ }
1093
+ }
1094
+ function js_headers() {
1095
+ return new Headers({ "content-type": "application/javascript; charset=utf-8" });
1096
+ }
1097
+ /**
1098
+ * @param {import('types').SSRClientRoute | null} route
1099
+ * @param {Partial<Record<string, ParamValue>> | null} params
1100
+ * @param {URL} url
1101
+ * @param {NonNullable<SSRManifest['client']>} client
1102
+ * @returns {{response: Response, body: string}}
1103
+ */
1104
+ function create_server_routing_response(route, params, url, client) {
1105
+ const headers = js_headers();
1106
+ let body = "";
1107
+ if (route) {
1108
+ const csr_route = generate_route_object(route, url, client);
1109
+ body = `${create_css_import(route, url, client)}export const route = ${csr_route};`;
1110
+ if (params !== null) body += `\nexport const params = ${uneval(params)}`;
1111
+ }
1112
+ return {
1113
+ response: text(body, { headers }),
1114
+ body
1115
+ };
1116
+ }
1117
+ /**
1118
+ * This function generates the client-side import for the CSS files that are
1119
+ * associated with the current route. Vite takes care of that when using
1120
+ * client-side route resolution, but for server-side resolution it does
1121
+ * not know about the CSS files automatically.
1122
+ *
1123
+ * @param {import('types').SSRClientRoute} route
1124
+ * @param {URL} url
1125
+ * @param {NonNullable<SSRManifest['client']>} client
1126
+ * @returns {string}
1127
+ */
1128
+ function create_css_import(route, url, client) {
1129
+ const { errors, layouts, leaf } = route;
1130
+ const paths = resolve_paths(url.pathname);
1131
+ let css = "";
1132
+ for (const node of [
1133
+ ...errors,
1134
+ ...layouts.map((l) => l?.[1]),
1135
+ leaf[1]
1136
+ ]) {
1137
+ if (typeof node !== "number") continue;
1138
+ const node_css = client.css?.[node];
1139
+ for (const css_path of node_css ?? []) css += `'${client_path(css_path, paths)}',`;
1140
+ }
1141
+ if (!css) return "";
1142
+ return `${create_client_import(client.start, paths)}.then(x => x.load_css([${css}]));\n`;
1143
+ }
1144
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/runtime/server/page/hash_bytes.js
1145
+ /**
1146
+ * MurmurHash3 (x86, 32-bit, seed 0) over the bytes, read as little-endian 32-bit words so every
1147
+ * platform computes the same value
1148
+ * @param {Uint8Array} bytes
1149
+ */
1150
+ function hash_bytes(bytes) {
1151
+ let hash = 0;
1152
+ const length = bytes.byteLength;
1153
+ const words = length >> 2;
1154
+ const view = new DataView(bytes.buffer, bytes.byteOffset, length);
1155
+ for (let i = 0; i < words; i += 1) hash = mix(hash, view.getInt32(i * 4, true));
1156
+ const rest = words * 4;
1157
+ let k = 0;
1158
+ switch (length & 3) {
1159
+ case 3: k ^= bytes[rest + 2] << 16;
1160
+ case 2: k ^= bytes[rest + 1] << 8;
1161
+ case 1:
1162
+ k ^= bytes[rest];
1163
+ k = Math.imul(k, 0xcc9e2d51);
1164
+ k = k << 15 | k >>> 17;
1165
+ hash ^= Math.imul(k, 461845907);
1166
+ }
1167
+ hash ^= length;
1168
+ hash = Math.imul(hash ^ hash >>> 16, 0x85ebca6b);
1169
+ hash = Math.imul(hash ^ hash >>> 13, 0xc2b2ae35);
1170
+ hash ^= hash >>> 16;
1171
+ return (hash >>> 0).toString(36);
1172
+ }
1173
+ /**
1174
+ * @param {number} hash
1175
+ * @param {number} word
1176
+ */
1177
+ function mix(hash, word) {
1178
+ word = Math.imul(word, 0xcc9e2d51);
1179
+ word = word << 15 | word >>> 17;
1180
+ hash ^= Math.imul(word, 461845907);
1181
+ hash = hash << 13 | hash >>> 19;
1182
+ return Math.imul(hash, 5) + 0xe6546b64 | 0;
1183
+ }
1184
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/runtime/components/root.svelte
1185
+ function Root($$renderer, $$props) {
1186
+ $$renderer.component(($$renderer) => {
1187
+ const { page, components, onerror, tree, form, error } = $$props;
1188
+ let mounted = false;
1189
+ let navigated = false;
1190
+ let title = "";
1191
+ afterNavigate(() => {
1192
+ if (mounted) {
1193
+ navigated = true;
1194
+ title = document.title || "untitled page";
1195
+ } else mounted = true;
1196
+ });
1197
+ function node($$renderer, n, depth) {
1198
+ const Component = derived(() => n.component);
1199
+ const Error = derived(() => n.error);
1200
+ const data = derived(() => n.data);
1201
+ function failed($$renderer, error) {
1202
+ if (Error()) {
1203
+ $$renderer.push("<!--[-->");
1204
+ Error()($$renderer, { error });
1205
+ $$renderer.push("<!--]-->");
1206
+ } else {
1207
+ $$renderer.push("<!--[!-->");
1208
+ $$renderer.push("<!--]-->");
1209
+ }
1210
+ }
1211
+ $$renderer.boundary({ failed: Error() ? failed : void 0 }, ($$renderer) => {
1212
+ $$renderer.push(`<!--[-->`);
1213
+ if (n.child) {
1214
+ $$renderer.push("<!--[0-->");
1215
+ if (Component()) {
1216
+ $$renderer.push("<!--[-->");
1217
+ Component()($$renderer, {
1218
+ data: data(),
1219
+ form,
1220
+ params: page.params,
1221
+ children: ($$renderer) => {
1222
+ node($$renderer, n.child, depth + 1);
1223
+ },
1224
+ $$slots: { default: true }
1225
+ });
1226
+ $$renderer.push("<!--]-->");
1227
+ } else {
1228
+ $$renderer.push("<!--[!-->");
1229
+ $$renderer.push("<!--]-->");
1230
+ }
1231
+ } else {
1232
+ $$renderer.push("<!--[-1-->");
1233
+ if (Component()) {
1234
+ $$renderer.push("<!--[-->");
1235
+ Component()($$renderer, {
1236
+ data: data(),
1237
+ form,
1238
+ params: page.params,
1239
+ error
1240
+ });
1241
+ $$renderer.push("<!--]-->");
1242
+ } else {
1243
+ $$renderer.push("<!--[!-->");
1244
+ $$renderer.push("<!--]-->");
1245
+ }
1246
+ }
1247
+ $$renderer.push(`<!--]-->`);
1248
+ $$renderer.push(`<!--]-->`);
1249
+ });
1250
+ }
1251
+ node($$renderer, tree, 0);
1252
+ $$renderer.push(`<!----> `);
1253
+ if (mounted) {
1254
+ $$renderer.push(`<!--[0--><div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px">`);
1255
+ if (navigated) $$renderer.push(`<!--[0-->${escape_html$1(title)}`);
1256
+ else $$renderer.push("<!--[-1-->");
1257
+ $$renderer.push(`<!--]--></div>`);
1258
+ } else $$renderer.push("<!--[-1-->");
1259
+ $$renderer.push(`<!--]-->`);
1260
+ });
1261
+ }
1262
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/runtime/props.svelte.js
1263
+ var Props = class {
1264
+ /** @type {Page} */
1265
+ page;
1266
+ /**
1267
+ * An array of the `+layout.svelte` and `+page.svelte` component instances
1268
+ * that currently live on the page — used for capturing and restoring snapshots.
1269
+ * It's updated/manipulated through `bind:this` in `Root.svelte`.
1270
+ * @type {Array<Record<string, any>>}
1271
+ * @deprecated only used for `export const snapshot` — TODO 4.0 get rid
1272
+ */
1273
+ components = [];
1274
+ /** @type {any} */
1275
+ form;
1276
+ /** @type {App.Error | undefined} */
1277
+ error;
1278
+ /** @type {RenderNode} */
1279
+ tree;
1280
+ /** @type {(error: unknown, reset: () => void) => void} */
1281
+ onerror;
1282
+ /**
1283
+ * @param {{
1284
+ * page: Page;
1285
+ * tree: RenderNode;
1286
+ * form: any;
1287
+ * error: App.Error | undefined;
1288
+ * onerror?: (error: unknown, reset: () => void) => void;
1289
+ * }} props
1290
+ */
1291
+ constructor({ page, tree, form, error, onerror = noop }) {
1292
+ this.page = page;
1293
+ this.tree = tree;
1294
+ this.onerror = onerror;
1295
+ this.form = form;
1296
+ this.error = error;
1297
+ }
1298
+ };
1299
+ var RenderNode = class {
1300
+ /** @type {Component} */
1301
+ component;
1302
+ /** @type {Component | undefined} */
1303
+ error;
1304
+ /** @type {Record<string, any>} */
1305
+ data = {};
1306
+ /** @type {RenderNode | undefined} */
1307
+ child;
1308
+ /**
1309
+ *
1310
+ * @param {Component} component
1311
+ * @param {Component | undefined} error
1312
+ */
1313
+ constructor(component, error) {
1314
+ this.component = component;
1315
+ this.error = error;
1316
+ }
1317
+ };
1318
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/runtime/server/page/render.js
1319
+ /** @import { Component } from 'svelte'; */
1320
+ /** @import { SyncRenderOutput } from 'svelte/server' */
1321
+ /**
1322
+ * Creates the HTML response.
1323
+ * @param {{
1324
+ * branch: Array<import('./types.js').Loaded>;
1325
+ * fetched: Array<import('./types.js').Fetched>;
1326
+ * page_config: { ssr: boolean; csr: boolean };
1327
+ * status: number;
1328
+ * error: App.Error | null;
1329
+ * event: import('@sveltejs/kit').RequestEvent;
1330
+ * state: import('types').RequestState;
1331
+ * resolve_opts: import('types').RequiredResolveOptions;
1332
+ * action_result?: import('types').ServerActionResult;
1333
+ * data_serializer: import('./types.js').ServerDataSerializer;
1334
+ * error_components?: Array<import('svelte').Component | undefined>
1335
+ * }} opts
1336
+ */
1337
+ async function render_response({ branch, fetched, page_config, status, error = null, event, state, resolve_opts, action_result, data_serializer, error_components }) {
1338
+ if (is_prerendering(state)) {
1339
+ if (options.csp.mode === "nonce") prerender_nonce();
1340
+ if (options.app_template_contains_nonce) prerender_template_nonce({ tag: "%sveltekit.nonce%" });
1341
+ }
1342
+ const client = manifest.client;
1343
+ const modulepreloads = new Set(client?.imports);
1344
+ const stylesheets = new Set(client?.stylesheets);
1345
+ /** @type {Map<string, import('types').FontDependency>} */
1346
+ const fonts = new Map(client?.fonts.map((font) => [font.file, font]));
1347
+ /** @type {Map<string, string>} */
1348
+ const inline_styles = /* @__PURE__ */ new Map();
1349
+ /** @type {Omit<SyncRenderOutput, 'html'>} */
1350
+ let rendered;
1351
+ const form_value = action_result?.type === "success" || action_result?.type === "failure" ? action_result.data ?? null : null;
1352
+ /** @type {string} */
1353
+ let base = "/ui";
1354
+ /** @type {string} */
1355
+ let assets$1 = assets;
1356
+ /**
1357
+ * An expression that will evaluate in the client to determine the resolved base path.
1358
+ * We use a relative path when possible to support IPFS, the internet archive, etc.
1359
+ */
1360
+ let base_expression = s("/ui");
1361
+ const csp = new Csp(options.csp, { prerender: is_prerendering(state) });
1362
+ if (!state.prerendering?.fallback) {
1363
+ ({base, assets: assets$1} = resolve_paths(event.url.pathname));
1364
+ base_expression = `new URL(${s(base)}, location).pathname.slice(0, -1)`;
1365
+ }
1366
+ if (page_config.ssr) {
1367
+ const props = new Props({
1368
+ page: {
1369
+ error,
1370
+ params: event.params,
1371
+ route: event.route,
1372
+ status,
1373
+ url: event.url,
1374
+ data: {},
1375
+ form: form_value,
1376
+ shallow: null,
1377
+ state: {}
1378
+ },
1379
+ tree: new RenderNode(await branch[0].node.component?.(), void 0),
1380
+ form: form_value,
1381
+ error: error ?? void 0
1382
+ });
1383
+ let current_node = props.tree;
1384
+ let data = props.page.data;
1385
+ for (let i = 0; i < branch.length; i += 1) {
1386
+ const node = branch[i];
1387
+ data = {
1388
+ ...data,
1389
+ ...node.data
1390
+ };
1391
+ current_node.data = data;
1392
+ if (i < branch.length - 1) current_node = current_node.child = new RenderNode(await branch[i + 1].node.component?.(), error_components?.[i + 1]);
1393
+ }
1394
+ props.page.data = data;
1395
+ const render_state = {
1396
+ ...state,
1397
+ is_in_render: true
1398
+ };
1399
+ const render_opts = {
1400
+ context: /* @__PURE__ */ new Map([["__request__", { page: props.page }]]),
1401
+ csp: csp.script_needs_nonce ? { nonce: csp.nonce } : { hash: csp.script_needs_hash },
1402
+ transformError: error_components ? (e) => {
1403
+ if (isRedirect(e)) throw e;
1404
+ const handled = handle_error_and_jsonify(event, render_state, e);
1405
+ if (handled instanceof Promise) return handled.then((e) => {
1406
+ error = e;
1407
+ props.page.error = error;
1408
+ props.page.status = status = error.status;
1409
+ return error;
1410
+ });
1411
+ error = handled;
1412
+ props.page.error = error;
1413
+ props.page.status = status = error.status;
1414
+ return error;
1415
+ } : void 0
1416
+ };
1417
+ globalThis.fetch;
1418
+ try {
1419
+ rendered = await with_request_store({
1420
+ event,
1421
+ state: render_state
1422
+ }, async () => {
1423
+ return render(Root, {
1424
+ ...render_opts,
1425
+ props
1426
+ });
1427
+ });
1428
+ if (rendered.hashes) csp.add_script_hashes(rendered.hashes.script);
1429
+ } finally {}
1430
+ } else rendered = {
1431
+ head: "",
1432
+ body: "",
1433
+ hashes: { script: [] }
1434
+ };
1435
+ for (const { node } of branch) {
1436
+ for (const url of node.imports) modulepreloads.add(url);
1437
+ for (const url of node.stylesheets) stylesheets.add(url);
1438
+ for (const font of node.fonts) fonts.set(font.file, font);
1439
+ if (node.inline_styles && !client?.inline) Object.entries(await node.inline_styles()).forEach(([filename, css]) => {
1440
+ if (typeof css === "string") {
1441
+ inline_styles.set(filename, css);
1442
+ return;
1443
+ }
1444
+ inline_styles.set(filename, css(`${assets$1}/${app_dir}/immutable/assets`, assets$1));
1445
+ });
1446
+ }
1447
+ const head = new Head(rendered.head);
1448
+ let body = rendered.body;
1449
+ /** @param {string} path */
1450
+ const prefixed = (path) => client_path(path, {
1451
+ base,
1452
+ assets: assets$1
1453
+ });
1454
+ const style = client?.inline ? client.inline?.style : Array.from(inline_styles.values()).join("\n");
1455
+ if (style) {
1456
+ const attributes = [];
1457
+ if (csp.style_needs_nonce) attributes.push(`nonce="${csp.nonce}"`);
1458
+ await csp.add_style(style);
1459
+ head.add_style(style, attributes);
1460
+ }
1461
+ /**
1462
+ * see the `output.linkHeaderPreload` option for details on why we have multiple options here
1463
+ * @param {string} path
1464
+ * @param {string[]} attributes
1465
+ */
1466
+ const add_preload = (path, attributes) => {
1467
+ head.add_link_tag(path, attributes);
1468
+ };
1469
+ for (const dep of stylesheets) {
1470
+ const path = prefixed(dep);
1471
+ const attributes = ["rel=\"stylesheet\""];
1472
+ if (inline_styles.has(dep)) attributes.push("disabled", "media=\"(max-width: 0)\"");
1473
+ head.add_stylesheet(path, attributes);
1474
+ }
1475
+ for (const { file, filename } of fonts.values()) {
1476
+ const path = prefixed(file);
1477
+ if (resolve_opts.preload({
1478
+ type: "font",
1479
+ path,
1480
+ filename
1481
+ })) add_preload(path, [
1482
+ "rel=\"preload\"",
1483
+ "as=\"font\"",
1484
+ `type="font/${file.slice(file.lastIndexOf(".") + 1)}"`,
1485
+ "crossorigin"
1486
+ ]);
1487
+ }
1488
+ const global = "__sveltekit_7iohn";
1489
+ const { data, chunks } = data_serializer.get_data(csp);
1490
+ if (page_config.ssr && page_config.csr) body += `\n\t\t\t${fetched.map((item) => serialize_data(item, resolve_opts.filterSerializedResponseHeaders, is_prerendering(state))).join("\n ")}`;
1491
+ if (page_config.csr && client) {
1492
+ const route = client.routes?.find((r) => r.id === event.route.id) ?? null;
1493
+ const load_env_eagerly = client.uses_env_dynamic_public && is_prerendering(state);
1494
+ if (load_env_eagerly) modulepreloads.add(`${app_dir}/env.js`);
1495
+ if (!client.inline) for (const dep of modulepreloads) {
1496
+ const path = prefixed(dep);
1497
+ if (resolve_opts.preload({
1498
+ type: "js",
1499
+ path
1500
+ })) add_preload(path, ["rel=\"modulepreload\""]);
1501
+ }
1502
+ if (client.routes && state.prerendering && !state.prerendering.fallback) {
1503
+ const pathname = add_resolution_suffix(event.url.pathname);
1504
+ state.prerendering.dependencies.set(pathname, create_server_routing_response(route, event.params, new URL(pathname, event.url), client));
1505
+ if (route && !state.prerendering.resolved_route_ids.has(route.id)) {
1506
+ state.prerendering.resolved_route_ids.add(route.id);
1507
+ const id_pathname = "/ui" + route_id_resolution_pathname(route.id);
1508
+ state.prerendering.dependencies.set(id_pathname, create_server_routing_response(route, null, new URL(id_pathname, event.url), client));
1509
+ }
1510
+ }
1511
+ const blocks = [];
1512
+ const properties = [`base: ${base_expression}`, `version: ${s("1795957316092")}`];
1513
+ if (assets) properties.push(`assets: ${s(assets)}`);
1514
+ if (client.uses_env_dynamic_public) properties.push(`env: ${load_env_eagerly ? "null" : uneval(rendered_env)}`);
1515
+ if (chunks) {
1516
+ blocks.push("const deferred = new Map();");
1517
+ properties.push(`defer: (id) => new Promise((fulfil, reject) => {
1518
+ deferred.set(id, { fulfil, reject });
1519
+ })`);
1520
+ let app_declaration = "";
1521
+ if (has_custom_transporters) {
1522
+ if (client.inline) app_declaration = `const app = ${global}.app.app;`;
1523
+ else if (client.app) app_declaration = `const kit = await import(${s(prefixed(client.start))});
1524
+ kit.init(${global});
1525
+ const app = await import(${s(prefixed(client.app))});`;
1526
+ else app_declaration = `const { app } = await import(${s(prefixed(client.start))});`;
1527
+ }
1528
+ const prelude = app_declaration ? `${app_declaration}
1529
+ const [data, error] = fn(app);` : `const [data, error] = fn();`;
1530
+ properties.push(`resolve: async (id, fn) => {
1531
+ ${prelude}
1532
+
1533
+ const try_to_resolve = () => {
1534
+ if (!deferred.has(id)) {
1535
+ setTimeout(try_to_resolve, 0);
1536
+ return;
1537
+ }
1538
+ const { fulfil, reject } = deferred.get(id);
1539
+ deferred.delete(id);
1540
+ if (error) reject(error);
1541
+ else fulfil(data);
1542
+ }
1543
+ try_to_resolve();
1544
+ }`);
1545
+ }
1546
+ blocks.push(`${global} = {
1547
+ ${properties.join(",\n ")}
1548
+ };`);
1549
+ const args = ["element"];
1550
+ blocks.push("const element = document.currentScript.parentElement;");
1551
+ if (page_config.ssr) {
1552
+ const serialized = {
1553
+ form: "null",
1554
+ error: "null"
1555
+ };
1556
+ if (form_value) serialized.form = uneval_action_response(form_value, event.route.id);
1557
+ if (error) serialized.error = uneval(error);
1558
+ const hydrate = [
1559
+ `node_ids: [${branch.map(({ node }) => node.index).join(", ")}]`,
1560
+ `data: ${data}`,
1561
+ `form: ${serialized.form}`,
1562
+ `error: ${serialized.error}`
1563
+ ];
1564
+ if (status !== 200 && !error) hydrate.push(`status: ${status}`);
1565
+ if (client.routes) {
1566
+ if (route) {
1567
+ const stringified = generate_route_object(route, event.url, client).replaceAll("\n", "\n ");
1568
+ hydrate.push(`params: ${uneval(event.params)}`, `server_route: ${stringified}`);
1569
+ }
1570
+ }
1571
+ const indent = " ".repeat(load_env_eagerly ? 7 : 6);
1572
+ args.push(`{\n${indent}\t${hydrate.join(`,\n${indent}\t`)}\n${indent}}`);
1573
+ }
1574
+ const remote_data = await collect_remote_data({}, event, state);
1575
+ const serialized_data = Object.keys(remote_data).length > 0 ? `${global}.data = ${uneval$1(remote_data)};\n\n\t\t\t\t\t\t` : "";
1576
+ const boot = client.inline ? `${client.inline.script}
1577
+
1578
+ ${serialized_data}${global}.app.start(${args.join(", ")});` : client.app ? `import(${s(prefixed(client.start))}).then(async (kit) => {
1579
+ kit.init(${global});
1580
+ const app = await import(${s(prefixed(client.app))});
1581
+ ${serialized_data}kit.start(app, ${args.join(", ")});
1582
+ });` : `import(${s(prefixed(client.start))}).then((app) => {
1583
+ ${serialized_data}app.start(${args.join(", ")})
1584
+ });`;
1585
+ if (load_env_eagerly) blocks.push(`import(${s(`${base}/${app_dir}/env.js`)}).then(({ env }) => {
1586
+ ${global}.env = env;
1587
+
1588
+ ${boot.replace(/\n/g, "\n ")}
1589
+ });`);
1590
+ else blocks.push(boot);
1591
+ const init_app = `
1592
+ {
1593
+ ${blocks.join("\n\n ")}
1594
+ }
1595
+ `;
1596
+ await csp.add_script(init_app);
1597
+ body += `\n\t\t\t<script${csp.script_needs_nonce ? ` nonce="${csp.nonce}"` : ""}>${init_app}<\/script>\n\t\t`;
1598
+ }
1599
+ const headers = new Headers({
1600
+ "x-sveltekit-page": "true",
1601
+ "content-type": "text/html"
1602
+ });
1603
+ if (is_prerendering(state)) {
1604
+ const csp_headers = csp.csp_provider.get_meta();
1605
+ if (csp_headers) head.add_http_equiv(csp_headers);
1606
+ if (state.prerendering?.cache) head.add_http_equiv(`<meta http-equiv="cache-control" content="${escape_html(state.prerendering.cache, true)}">`);
1607
+ } else {
1608
+ const csp_header = csp.csp_provider.get_header();
1609
+ if (csp_header) headers.set("content-security-policy", csp_header);
1610
+ const report_only_header = csp.report_only_provider.get_header();
1611
+ if (report_only_header) headers.set("content-security-policy-report-only", report_only_header);
1612
+ }
1613
+ const html = options.templates.app({
1614
+ head: head.build(),
1615
+ body,
1616
+ assets: assets$1,
1617
+ nonce: csp.nonce,
1618
+ env: explicit_public_env
1619
+ });
1620
+ const transformed = await resolve_opts.transformPageChunk({
1621
+ html,
1622
+ done: true
1623
+ }) || "";
1624
+ const encoded = chunks ? null : text_encoder.encode(transformed);
1625
+ const needs_nonce = csp.script_needs_nonce || csp.style_needs_nonce || options.app_template_contains_nonce;
1626
+ if (encoded && !("etag" in state.headers) && !/\bno-store\b/i.test(state.headers["cache-control"] ?? "") && !(needs_nonce && transformed.includes(csp.nonce))) headers.set("etag", `"${hash_bytes(encoded)}"`);
1627
+ if (chunks) return new Response(stream_text(transformed + "\n", chunks), {
1628
+ status,
1629
+ headers
1630
+ });
1631
+ const bytes = encoded;
1632
+ headers.set("content-length", bytes.byteLength.toString());
1633
+ return new Response(bytes, {
1634
+ status,
1635
+ headers
1636
+ });
1637
+ }
1638
+ var Head = class {
1639
+ #rendered;
1640
+ /** @type {string[]} */
1641
+ #http_equiv = [];
1642
+ /** @type {string[]} */
1643
+ #link_tags = [];
1644
+ /** @type {string[]} */
1645
+ #style_tags = [];
1646
+ /** @type {string[]} */
1647
+ #stylesheet_links = [];
1648
+ /**
1649
+ * @param {string} rendered
1650
+ */
1651
+ constructor(rendered) {
1652
+ this.#rendered = rendered;
1653
+ }
1654
+ build() {
1655
+ return [
1656
+ ...this.#http_equiv,
1657
+ ...this.#link_tags,
1658
+ this.#rendered,
1659
+ ...this.#style_tags,
1660
+ ...this.#stylesheet_links
1661
+ ].join("\n ");
1662
+ }
1663
+ /**
1664
+ * @param {string} style
1665
+ * @param {string[]} attributes
1666
+ */
1667
+ add_style(style, attributes) {
1668
+ this.#style_tags.push(`<style${attributes.length ? " " + attributes.join(" ") : ""}>${style}</style>`);
1669
+ }
1670
+ /**
1671
+ * @param {string} href
1672
+ * @param {string[]} attributes
1673
+ */
1674
+ add_stylesheet(href, attributes) {
1675
+ this.#stylesheet_links.push(`<link href="${href}" ${attributes.join(" ")}>`);
1676
+ }
1677
+ /**
1678
+ * @param {string} href
1679
+ * @param {string[]} attributes
1680
+ */
1681
+ add_link_tag(href, attributes) {
1682
+ this.#link_tags.push(`<link href="${href}" ${attributes.join(" ")}>`);
1683
+ }
1684
+ /** @param {string} tag */
1685
+ add_http_equiv(tag) {
1686
+ this.#http_equiv.push(tag);
1687
+ }
1688
+ };
1689
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/utils/exports.js
1690
+ /**
1691
+ * @param {Set<string>} expected
1692
+ */
1693
+ function validator(expected) {
1694
+ /**
1695
+ * @param {any} module
1696
+ * @param {string} [file]
1697
+ */
1698
+ function validate(module, file) {
1699
+ if (!module) return;
1700
+ for (const key in module) {
1701
+ if (key[0] === "_" || expected.has(key)) continue;
1702
+ const locations = valid_locations(key, file?.slice(file.lastIndexOf(".")));
1703
+ if (locations.length > 0) invalid_export_location({
1704
+ key,
1705
+ locations: join_or(locations),
1706
+ file: file || void 0
1707
+ });
1708
+ invalid_export({
1709
+ key,
1710
+ exports: [...expected.values()].join(", "),
1711
+ file: file || void 0
1712
+ });
1713
+ }
1714
+ }
1715
+ return validate;
1716
+ }
1717
+ /**
1718
+ * Returns the route files in which `key` is a valid export
1719
+ * @param {string} key
1720
+ * @param {string} ext
1721
+ * @returns {string[]}
1722
+ */
1723
+ function valid_locations(key, ext = ".js") {
1724
+ const locations = [];
1725
+ if (valid_layout_exports.has(key)) locations.push(`+layout${ext}`);
1726
+ if (valid_page_exports.has(key)) locations.push(`+page${ext}`);
1727
+ if (valid_layout_server_exports.has(key)) locations.push(`+layout.server${ext}`);
1728
+ if (valid_page_server_exports.has(key)) locations.push(`+page.server${ext}`);
1729
+ if (valid_server_exports.has(key)) locations.push(`+server${ext}`);
1730
+ return locations;
1731
+ }
1732
+ var valid_layout_exports = /* @__PURE__ */ new Set([
1733
+ "load",
1734
+ "prerender",
1735
+ "csr",
1736
+ "ssr",
1737
+ "trailingSlash",
1738
+ "config"
1739
+ ]);
1740
+ var valid_page_exports = /* @__PURE__ */ new Set([...valid_layout_exports, "entries"]);
1741
+ var valid_layout_server_exports = /* @__PURE__ */ new Set([...valid_layout_exports]);
1742
+ var valid_page_server_exports = /* @__PURE__ */ new Set([
1743
+ ...valid_layout_server_exports,
1744
+ "actions",
1745
+ "entries"
1746
+ ]);
1747
+ var valid_server_exports = /* @__PURE__ */ new Set([
1748
+ "GET",
1749
+ "POST",
1750
+ "PATCH",
1751
+ "PUT",
1752
+ "DELETE",
1753
+ "OPTIONS",
1754
+ "HEAD",
1755
+ "QUERY",
1756
+ "fallback",
1757
+ "prerender",
1758
+ "trailingSlash",
1759
+ "config",
1760
+ "entries"
1761
+ ]);
1762
+ var validate_layout_exports = validator(valid_layout_exports);
1763
+ var validate_page_exports = validator(valid_page_exports);
1764
+ var validate_layout_server_exports = validator(valid_layout_server_exports);
1765
+ var validate_page_server_exports = validator(valid_page_server_exports);
1766
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/utils/page_nodes.js
1767
+ /** @import { UniversalNode, ServerNode } from 'types' */
1768
+ var PageNodes = class {
1769
+ /** All layout nodes and the page node, if any */
1770
+ data;
1771
+ /**
1772
+ * @param {Array<import('types').SSRNode | undefined>} nodes
1773
+ */
1774
+ constructor(nodes) {
1775
+ this.data = nodes;
1776
+ }
1777
+ layouts() {
1778
+ return this.data.slice(0, -1);
1779
+ }
1780
+ page() {
1781
+ return this.data.at(-1);
1782
+ }
1783
+ validate() {
1784
+ for (const layout of this.layouts()) if (layout) {
1785
+ validate_layout_server_exports(layout.server, layout.server_id);
1786
+ validate_layout_exports(layout.universal, layout.universal_id);
1787
+ }
1788
+ const page = this.page();
1789
+ if (page) {
1790
+ validate_page_server_exports(page.server, page.server_id);
1791
+ validate_page_exports(page.universal, page.universal_id);
1792
+ }
1793
+ }
1794
+ /**
1795
+ * @template {'prerender' | 'ssr' | 'csr' | 'trailingSlash'} Option
1796
+ * @param {Option} option
1797
+ * @returns {(UniversalNode | ServerNode)[Option] | undefined}
1798
+ */
1799
+ #get_option(option) {
1800
+ /** @typedef {(UniversalNode | ServerNode)[Option]} Value */
1801
+ return this.data.reduce((value, node) => {
1802
+ return node?.universal?.[option] ?? node?.server?.[option] ?? value;
1803
+ }, void 0);
1804
+ }
1805
+ csr() {
1806
+ return this.#get_option("csr") ?? true;
1807
+ }
1808
+ ssr() {
1809
+ return this.#get_option("ssr") ?? true;
1810
+ }
1811
+ prerender() {
1812
+ return this.#get_option("prerender") ?? false;
1813
+ }
1814
+ trailing_slash() {
1815
+ return this.#get_option("trailingSlash") ?? "never";
1816
+ }
1817
+ get_config() {
1818
+ /** @type {Record<string, any>} */
1819
+ let current = {};
1820
+ for (const node of this.data) {
1821
+ if (!node?.universal?.config && !node?.server?.config) continue;
1822
+ current = {
1823
+ ...current,
1824
+ ...node?.server?.config,
1825
+ ...node?.universal?.config
1826
+ };
1827
+ }
1828
+ return Object.keys(current).length ? current : void 0;
1829
+ }
1830
+ should_prerender_data() {
1831
+ return this.data.some((node) => node?.server?.load || node?.server?.trailingSlash !== void 0);
1832
+ }
1833
+ };
1834
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/runtime/server/page/respond_with_error.js
1835
+ /**
1836
+ * @typedef {import('./types.js').Loaded} Loaded
1837
+ */
1838
+ /**
1839
+ * @param {{
1840
+ * event: import('@sveltejs/kit').RequestEvent;
1841
+ * state: import('types').RequestState;
1842
+ * error: unknown;
1843
+ * resolve_opts: import('types').RequiredResolveOptions;
1844
+ * }} opts
1845
+ */
1846
+ async function respond_with_error({ event, state, error, resolve_opts }) {
1847
+ if (event.isDataRequest) return handle_fatal_error(event, state, error);
1848
+ if (event.request.headers.get("x-sveltekit-error")) {
1849
+ const transformed = await handle_error_and_jsonify(event, state, error);
1850
+ return static_error_page(transformed.status, transformed.message);
1851
+ }
1852
+ /** @type {import('./types.js').Fetched[]} */
1853
+ const fetched = [];
1854
+ try {
1855
+ const branch = [];
1856
+ const default_layout = await manifest.nodes[0]();
1857
+ const nodes = new PageNodes([default_layout]);
1858
+ const ssr = nodes.ssr();
1859
+ const csr = nodes.csr();
1860
+ const data_serializer = server_data_serializer(event, state);
1861
+ const transformed = await handle_error_and_jsonify(event, state, error);
1862
+ if (ssr) {
1863
+ state.error = true;
1864
+ const server_data_promise = load_server_data({
1865
+ event,
1866
+ state,
1867
+ node: default_layout,
1868
+ parent: async () => ({})
1869
+ });
1870
+ const server_data = await server_data_promise;
1871
+ data_serializer.add_node(0, server_data);
1872
+ const data = await load_data({
1873
+ event,
1874
+ state,
1875
+ fetched,
1876
+ node: default_layout,
1877
+ parent: async () => ({}),
1878
+ resolve_opts,
1879
+ server_data_promise,
1880
+ csr
1881
+ });
1882
+ branch.push({
1883
+ node: default_layout,
1884
+ server_data,
1885
+ data
1886
+ }, {
1887
+ node: await manifest.nodes[1](),
1888
+ data: null,
1889
+ server_data: null
1890
+ });
1891
+ }
1892
+ return await render_response({
1893
+ page_config: {
1894
+ ssr,
1895
+ csr
1896
+ },
1897
+ status: transformed.status,
1898
+ error: transformed,
1899
+ branch,
1900
+ error_components: [],
1901
+ fetched,
1902
+ event,
1903
+ state,
1904
+ resolve_opts,
1905
+ data_serializer
1906
+ });
1907
+ } catch (e) {
1908
+ if (e instanceof Redirect) return redirect_response(e.status, e.location);
1909
+ const transformed = await handle_error_and_jsonify(event, state, e);
1910
+ return static_error_page(transformed.status, transformed.message);
1911
+ }
1912
+ }
1913
+ /**
1914
+ * Return as a response that renders the error.html
1915
+ *
1916
+ * @param {number} status
1917
+ * @param {string} message
1918
+ */
1919
+ function static_error_page(status, message) {
1920
+ let page = options.templates.error({
1921
+ status,
1922
+ message: escape_html(message)
1923
+ });
1924
+ return text(page, {
1925
+ headers: { "content-type": "text/html; charset=utf-8" },
1926
+ status
1927
+ });
1928
+ }
1929
+ /**
1930
+ * @param {import('@sveltejs/kit').RequestEvent} event
1931
+ * @param {import('types').RequestState} state
1932
+ * @param {unknown} error
1933
+ */
1934
+ async function handle_fatal_error(event, state, error) {
1935
+ const body = await handle_error_and_jsonify(event, state, error);
1936
+ const status = body.status;
1937
+ const type = negotiate(event.request.headers.get("accept") || "text/html", ["application/json", "text/html"]);
1938
+ if (event.isDataRequest || type === "application/json") return Response.json(body, { status });
1939
+ return static_error_page(status, body.message);
1940
+ }
1941
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/runtime/server/page/index.js
1942
+ /** @import { RequestEvent } from '@sveltejs/kit' */
1943
+ /** @import { PageNodeIndexes, RequestState, RequiredResolveOptions, ServerDataNode, SSRNode } from 'types' */
1944
+ /**
1945
+ * The maximum request depth permitted before assuming we're stuck in an infinite loop
1946
+ */
1947
+ var MAX_DEPTH = 10;
1948
+ /**
1949
+ * @param {RequestEvent} event
1950
+ * @param {RequestState} state
1951
+ * @param {PageNodeIndexes} page
1952
+ * @param {import('../../../utils/page_nodes.js').PageNodes} nodes
1953
+ * @param {RequiredResolveOptions} resolve_opts
1954
+ * @returns {Promise<Response>}
1955
+ */
1956
+ async function render_page(event, state, page, nodes, resolve_opts) {
1957
+ if (state.depth > MAX_DEPTH) return text(`Not found: ${event.url.pathname}`, { status: 404 });
1958
+ if (is_action_json_request(event)) {
1959
+ const node = await manifest.nodes[page.leaf]();
1960
+ return handle_action_json_request(event, state, node?.server);
1961
+ }
1962
+ try {
1963
+ const leaf_node = nodes.page();
1964
+ let status = 200;
1965
+ /** @type {import('types').ServerActionResult | undefined} */
1966
+ let action_result = void 0;
1967
+ if (is_action_request(event)) {
1968
+ const remote_id = get_remote_action(event.url);
1969
+ if (remote_id) action_result = await handle_remote_form_post(event, state, remote_id);
1970
+ else action_result = await handle_action_request(event, state, leaf_node.server);
1971
+ if (action_result?.type === "redirect") return redirect_response(action_result.status, action_result.location);
1972
+ if (action_result?.type === "error") status = get_status(action_result.error);
1973
+ if (action_result?.type === "failure") status = action_result.status;
1974
+ }
1975
+ const should_prerender = nodes.prerender();
1976
+ if (should_prerender) {
1977
+ if (leaf_node.server?.actions) prerender_actions();
1978
+ } else if (state.prerendering) return new Response(void 0, { status: 204 });
1979
+ state.prerender_default = should_prerender;
1980
+ const should_prerender_data = nodes.should_prerender_data();
1981
+ const data_pathname = add_data_suffix(event.url.pathname);
1982
+ /** @type {import('./types.js').Fetched[]} */
1983
+ const fetched = [];
1984
+ const ssr = nodes.ssr();
1985
+ const csr = nodes.csr();
1986
+ if (ssr === false && !(is_prerendering(state) && should_prerender_data)) return await render_response({
1987
+ branch: compact(nodes.data).map((node) => {
1988
+ return {
1989
+ node,
1990
+ data: null,
1991
+ server_data: null
1992
+ };
1993
+ }),
1994
+ fetched,
1995
+ page_config: {
1996
+ ssr: false,
1997
+ csr
1998
+ },
1999
+ status,
2000
+ error: null,
2001
+ event,
2002
+ state,
2003
+ resolve_opts,
2004
+ data_serializer: server_data_serializer(event, state)
2005
+ });
2006
+ /** @type {Array<import('./types.js').Loaded | null>} */
2007
+ const branch = [];
2008
+ /** @type {Error | null} */
2009
+ let load_error = null;
2010
+ const data_serializer = server_data_serializer(event, state);
2011
+ const data_serializer_json = is_prerendering(state) && should_prerender_data ? server_data_serializer_json(event, state) : null;
2012
+ /** @type {Array<Promise<ServerDataNode | null>>} */
2013
+ const server_promises = nodes.data.map((node, i) => {
2014
+ if (load_error) throw load_error;
2015
+ return Promise.resolve().then(async () => {
2016
+ try {
2017
+ if (node === leaf_node && action_result?.type === "error") throw action_result.error;
2018
+ const server_data = await load_server_data({
2019
+ event,
2020
+ state,
2021
+ node,
2022
+ parent: async () => {
2023
+ /** @type {Record<string, any>} */
2024
+ const data = {};
2025
+ for (let j = 0; j < i; j += 1) {
2026
+ const parent = await server_promises[j];
2027
+ if (parent) Object.assign(data, parent.data);
2028
+ }
2029
+ return data;
2030
+ }
2031
+ });
2032
+ if (node) data_serializer.add_node(i, server_data);
2033
+ data_serializer_json?.add_node(i, server_data);
2034
+ return server_data;
2035
+ } catch (e) {
2036
+ load_error = e;
2037
+ throw load_error;
2038
+ }
2039
+ });
2040
+ });
2041
+ /** @type {Array<Promise<Record<string, any> | null>>} */
2042
+ const load_promises = nodes.data.map((node, i) => {
2043
+ if (load_error) throw load_error;
2044
+ return Promise.resolve().then(async () => {
2045
+ try {
2046
+ return await load_data({
2047
+ event,
2048
+ state,
2049
+ fetched,
2050
+ node,
2051
+ parent: async () => {
2052
+ const data = {};
2053
+ for (let j = 0; j < i; j += 1) Object.assign(data, await load_promises[j]);
2054
+ return data;
2055
+ },
2056
+ resolve_opts,
2057
+ server_data_promise: server_promises[i],
2058
+ csr
2059
+ });
2060
+ } catch (e) {
2061
+ load_error = e;
2062
+ throw load_error;
2063
+ }
2064
+ });
2065
+ });
2066
+ for (const p of server_promises) p.catch(noop);
2067
+ for (const p of load_promises) p.catch(noop);
2068
+ for (let i = 0; i < nodes.data.length; i += 1) {
2069
+ const node = nodes.data[i];
2070
+ if (node) try {
2071
+ const server_data = await server_promises[i];
2072
+ const data = await load_promises[i];
2073
+ branch.push({
2074
+ node,
2075
+ server_data,
2076
+ data
2077
+ });
2078
+ } catch (e) {
2079
+ const err = normalize_error(e);
2080
+ if (err instanceof Redirect) {
2081
+ if (state.prerendering && should_prerender_data) {
2082
+ const body = JSON.stringify({
2083
+ type: "redirect",
2084
+ status: err.status,
2085
+ location: err.location
2086
+ });
2087
+ state.prerendering.dependencies.set(data_pathname, {
2088
+ response: text(body),
2089
+ body
2090
+ });
2091
+ }
2092
+ return redirect_response(err.status, err.location);
2093
+ }
2094
+ const error = await handle_error_and_jsonify(event, state, err);
2095
+ const status = error.status;
2096
+ for (const { error: index, idx } of nearest_error_pages(i, branch, page.errors)) {
2097
+ const node = await manifest.nodes[index]();
2098
+ data_serializer.set_max_nodes(idx);
2099
+ const layouts = compact(branch.slice(0, idx));
2100
+ const nodes = new PageNodes(layouts.map((layout) => layout.node));
2101
+ const error_branch = layouts.concat({
2102
+ node,
2103
+ data: null,
2104
+ server_data: null
2105
+ });
2106
+ return await render_response({
2107
+ event,
2108
+ state,
2109
+ resolve_opts,
2110
+ page_config: {
2111
+ ssr: nodes.ssr(),
2112
+ csr: nodes.csr()
2113
+ },
2114
+ status,
2115
+ error,
2116
+ error_components: await load_error_components(ssr, error_branch, page),
2117
+ branch: error_branch,
2118
+ fetched,
2119
+ data_serializer
2120
+ });
2121
+ }
2122
+ return static_error_page(status, error.message);
2123
+ }
2124
+ else branch.push(null);
2125
+ }
2126
+ if (state.prerendering && data_serializer_json) {
2127
+ let { data, chunks } = data_serializer_json.get_data();
2128
+ if (chunks) for await (const chunk of chunks) data += chunk;
2129
+ state.prerendering.dependencies.set(data_pathname, {
2130
+ response: text(data),
2131
+ body: data
2132
+ });
2133
+ }
2134
+ return await render_response({
2135
+ event,
2136
+ state,
2137
+ resolve_opts,
2138
+ page_config: {
2139
+ csr,
2140
+ ssr
2141
+ },
2142
+ status,
2143
+ error: null,
2144
+ branch: compact(branch),
2145
+ action_result,
2146
+ fetched,
2147
+ data_serializer: !ssr ? server_data_serializer(event, state) : data_serializer,
2148
+ error_components: await load_error_components(ssr, branch, page)
2149
+ });
2150
+ } catch (e) {
2151
+ if (e instanceof Redirect) return redirect_response(e.status, e.location);
2152
+ return await respond_with_error({
2153
+ event,
2154
+ state,
2155
+ error: e,
2156
+ resolve_opts
2157
+ });
2158
+ }
2159
+ }
2160
+ /**
2161
+ * @param {boolean} ssr
2162
+ * @param {Array<import('./types.js').Loaded | null>} branch
2163
+ * @param {PageNodeIndexes} page
2164
+ */
2165
+ function load_error_components(ssr, branch, page) {
2166
+ if (!ssr) return void 0;
2167
+ return build_error_chain(branch, page.errors, (idx) => manifest.nodes[idx]?.().then((e) => e.component?.()));
2168
+ }
2169
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/runtime/server/csrf.js
2170
+ var mutating_form_methods = /* @__PURE__ */ new Set([
2171
+ "POST",
2172
+ "PUT",
2173
+ "PATCH",
2174
+ "DELETE"
2175
+ ]);
2176
+ /**
2177
+ * Returns `true` if a browser could send a cross-site request with this content type
2178
+ * without a CORS preflight, meaning its origin must be checked
2179
+ * @param {Request} request
2180
+ */
2181
+ function can_skip_preflight(request) {
2182
+ const content_type = request.headers.get("content-type");
2183
+ return !content_type || is_form_content_type(request) || matches_content_type(content_type, "text/ping");
2184
+ }
2185
+ /**
2186
+ * The origin SvelteKit treats as "self" when validating the `Origin` header on
2187
+ * cross-site requests.
2188
+ *
2189
+ * By default (`paths.origin` is `undefined`), SvelteKit derives the origin
2190
+ * from `request.url` (which is set by the adapter, and ultimately by the
2191
+ * platform). When `paths.origin` is configured — for example so that a preview
2192
+ * deployment whose URL isn't known at build time, or an app behind a reverse
2193
+ * proxy, can declare a canonical origin — that value takes precedence.
2194
+ *
2195
+ * @param {string | undefined} paths_origin the configured `kit.paths.origin`
2196
+ * @param {string} url_origin the origin derived from `request.url`
2197
+ * @returns {string}
2198
+ */
2199
+ function get_self_origin(paths_origin, url_origin) {
2200
+ return paths_origin || url_origin;
2201
+ }
2202
+ /**
2203
+ * Determines whether a non-remote request should be rejected as a cross-site
2204
+ * request forgery (CSRF). Used by `respond.js` to gate form `POST`/`PUT`/
2205
+ * `PATCH`/`DELETE` requests whose `Origin` header doesn't match the app's
2206
+ * self-origin (and isn't in `trusted_origins`).
2207
+ *
2208
+ * @param {{
2209
+ * request: Request;
2210
+ * request_origin: string | null;
2211
+ * self_origin: string;
2212
+ * trusted_origins: string[];
2213
+ * }} input
2214
+ * @returns {boolean}
2215
+ */
2216
+ function is_csrf_forbidden({ request, request_origin, self_origin, trusted_origins }) {
2217
+ return can_skip_preflight(request) && mutating_form_methods.has(request.method) && request_origin !== self_origin && (!request_origin || !trusted_origins.includes(request_origin));
2218
+ }
2219
+ /**
2220
+ * Determines whether a remote-function request should be rejected as cross-site.
2221
+ *
2222
+ * Unlike form submissions, remote functions accept any content type (e.g.
2223
+ * `application/json`), so the check is solely on the request method and origin:
2224
+ * a non-`GET` request is forbidden when its `Origin` header doesn't match the
2225
+ * app's self-origin. Unlike `is_csrf_forbidden`, entries in `trusted_origins`
2226
+ * are *not* honoured — remote function endpoints are an implementation detail,
2227
+ * not a public API, so cross-origin calls are forbidden regardless.
2228
+ *
2229
+ * @param {{
2230
+ * request: Request;
2231
+ * request_origin: string | null;
2232
+ * self_origin: string;
2233
+ * }} input
2234
+ * @returns {boolean}
2235
+ */
2236
+ function is_remote_forbidden({ request, request_origin, self_origin }) {
2237
+ return request.method !== "GET" && request_origin !== self_origin;
2238
+ }
2239
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/runtime/server/data/index.js
2240
+ /**
2241
+ * @param {import('@sveltejs/kit').RequestEvent} event
2242
+ * @param {import('types').RequestState} state
2243
+ * @param {{ page: Pick<import('types').PageNodeIndexes, 'layouts' | 'leaf'> | null }} route
2244
+ * @param {boolean[] | undefined} invalidated_data_nodes
2245
+ * @param {import('types').TrailingSlash} trailing_slash
2246
+ * @returns {Promise<Response>}
2247
+ */
2248
+ async function render_data(event, state, route, invalidated_data_nodes, trailing_slash) {
2249
+ if (!route.page) return with_version_header(new Response(void 0, { status: 404 }));
2250
+ try {
2251
+ const node_ids = [...route.page.layouts, route.page.leaf];
2252
+ const invalidated = invalidated_data_nodes ?? node_ids.map(() => true);
2253
+ let aborted = false;
2254
+ const url = new URL(event.url);
2255
+ url.pathname = normalize_path(url.pathname, trailing_slash);
2256
+ const new_event = {
2257
+ ...event,
2258
+ url
2259
+ };
2260
+ const functions = node_ids.map((n, i) => {
2261
+ return once(async () => {
2262
+ try {
2263
+ if (aborted) return { type: "skip" };
2264
+ const node = n == void 0 ? n : await manifest.nodes[n]();
2265
+ return load_server_data({
2266
+ event: new_event,
2267
+ state,
2268
+ node,
2269
+ parent: async () => {
2270
+ /** @type {Record<string, any>} */
2271
+ const data = {};
2272
+ for (let j = 0; j < i; j += 1) {
2273
+ const parent = await functions[j]();
2274
+ if (parent) Object.assign(data, parent.data);
2275
+ }
2276
+ return data;
2277
+ }
2278
+ });
2279
+ } catch (e) {
2280
+ aborted = true;
2281
+ throw e;
2282
+ }
2283
+ });
2284
+ });
2285
+ const promises = functions.map(async (fn, i) => {
2286
+ if (!invalidated[i]) return { type: "skip" };
2287
+ return fn();
2288
+ });
2289
+ const data_serializer = server_data_serializer_json(event, state);
2290
+ await Promise.all(promises.map(async (p, i) => {
2291
+ const node = await p.catch(async (error) => {
2292
+ if (error instanceof Redirect) throw error;
2293
+ return {
2294
+ type: "error",
2295
+ error: await handle_error_and_jsonify(event, state, error)
2296
+ };
2297
+ });
2298
+ data_serializer.add_node(i, node);
2299
+ }));
2300
+ const { data, chunks } = data_serializer.get_data();
2301
+ if (!chunks) return json_response(data);
2302
+ return with_version_header(new Response(stream_text(data, chunks), { headers: {
2303
+ "content-type": "text/sveltekit-data",
2304
+ "cache-control": "private, no-store"
2305
+ } }));
2306
+ } catch (e) {
2307
+ const error = normalize_error(e);
2308
+ if (error instanceof Redirect) return redirect_json_response(error);
2309
+ else {
2310
+ const transformed = await handle_error_and_jsonify(event, state, error);
2311
+ return json_response(transformed, transformed.status);
2312
+ }
2313
+ }
2314
+ }
2315
+ /**
2316
+ * @param {Record<string, any> | string} json
2317
+ * @param {number} [status]
2318
+ */
2319
+ function json_response(json, status = 200) {
2320
+ return with_version_header(text(typeof json === "string" ? json : JSON.stringify(json), {
2321
+ status,
2322
+ headers: {
2323
+ "content-type": "application/json",
2324
+ "cache-control": "private, no-store"
2325
+ }
2326
+ }));
2327
+ }
2328
+ /**
2329
+ * @param {Redirect} redirect
2330
+ */
2331
+ function redirect_json_response(redirect) {
2332
+ return json_response({
2333
+ type: "redirect",
2334
+ status: redirect.status,
2335
+ location: redirect.location
2336
+ });
2337
+ }
2338
+ // ../../node_modules/.pnpm/cookie@2.0.2/node_modules/cookie/dist/index.js
2339
+ /**
2340
+ * RegExp to match cookie-name in RFC 6265 sec 4.1.1
2341
+ * This refers out to the obsoleted definition of token in RFC 2616 sec 2.2
2342
+ * which has been replaced by the token definition in RFC 7230 appendix B.
2343
+ *
2344
+ * cookie-name = token
2345
+ * token = 1*tchar
2346
+ * tchar = "!" / "#" / "$" / "%" / "&" / "'" /
2347
+ * "*" / "+" / "-" / "." / "^" / "_" /
2348
+ * "`" / "|" / "~" / DIGIT / ALPHA
2349
+ *
2350
+ * Note: Allowing more characters - https://github.com/jshttp/cookie/issues/191
2351
+ * Allow same range as cookie value, except `=`, which delimits end of name.
2352
+ */
2353
+ var cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
2354
+ /**
2355
+ * RegExp to match cookie-value in RFC 6265 sec 4.1.1
2356
+ *
2357
+ * cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
2358
+ * cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
2359
+ * ; US-ASCII characters excluding CTLs,
2360
+ * ; whitespace DQUOTE, comma, semicolon,
2361
+ * ; and backslash
2362
+ *
2363
+ * Allowing more characters: https://github.com/jshttp/cookie/issues/191
2364
+ * Comma, backslash, and DQUOTE are not part of the parsing algorithm.
2365
+ */
2366
+ var cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
2367
+ /**
2368
+ * RegExp to match invalid cookie values to be encoded, including `%` for roundtrip safety.
2369
+ */
2370
+ var cookieOctetInvalidRegExp = /[\u0000-\u0020\u007F-\uFFFF",;\\%]/;
2371
+ /**
2372
+ * RegExp to match domain-value in RFC 6265 sec 4.1.1
2373
+ *
2374
+ * domain-value = <subdomain>
2375
+ * ; defined in [RFC1034], Section 3.5, as
2376
+ * ; enhanced by [RFC1123], Section 2.1
2377
+ * <subdomain> = <label> | <subdomain> "." <label>
2378
+ * <label> = <let-dig> [ [ <ldh-str> ] <let-dig> ]
2379
+ * Labels must be 63 characters or less.
2380
+ * 'let-dig' not 'letter' in the first char, per RFC1123
2381
+ * <ldh-str> = <let-dig-hyp> | <let-dig-hyp> <ldh-str>
2382
+ * <let-dig-hyp> = <let-dig> | "-"
2383
+ * <let-dig> = <letter> | <digit>
2384
+ * <letter> = any one of the 52 alphabetic characters A through Z in
2385
+ * upper case and a through z in lower case
2386
+ * <digit> = any one of the ten digits 0 through 9
2387
+ *
2388
+ * Keep support for leading dot: https://github.com/jshttp/cookie/issues/173
2389
+ *
2390
+ * > (Note that a leading %x2E ("."), if present, is ignored even though that
2391
+ * character is not permitted, but a trailing %x2E ("."), if present, will
2392
+ * cause the user agent to ignore the attribute.)
2393
+ */
2394
+ var domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
2395
+ /**
2396
+ * RegExp to match path-value in RFC 6265 sec 4.1.1
2397
+ *
2398
+ * path-value = <any CHAR except CTLs or ";">
2399
+ * CHAR = %x01-7F
2400
+ * ; defined in RFC 5234 appendix B.1
2401
+ */
2402
+ var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
2403
+ /**
2404
+ * RegExp to match max-age-value in RFC 6265 sec 5.6.2
2405
+ */
2406
+ var maxAgeRegExp = /^-?\d+$/;
2407
+ var NullObject = /* @__PURE__ */ (() => {
2408
+ const C = function() {};
2409
+ C.prototype = Object.create(null);
2410
+ return C;
2411
+ })();
2412
+ /**
2413
+ * Parse a `Cookie` header.
2414
+ *
2415
+ * Parse the given cookie header string into an object
2416
+ * The object has the various cookies as keys(names) => values
2417
+ */
2418
+ function parseCookie(str, options) {
2419
+ const obj = new NullObject();
2420
+ const len = str.length;
2421
+ if (len < 2) return obj;
2422
+ const dec = options?.decode ?? defaultDecode;
2423
+ let index = 0;
2424
+ do {
2425
+ const eqIdx = eqIndex(str, index, len);
2426
+ if (eqIdx === len) break;
2427
+ const endIdx = endIndex(str, index, len);
2428
+ if (eqIdx > endIdx) {
2429
+ index = str.lastIndexOf(";", eqIdx - 1) + 1;
2430
+ continue;
2431
+ }
2432
+ const key = valueSlice(str, index, eqIdx);
2433
+ if (obj[key] === void 0) obj[key] = dec(valueSlice(str, eqIdx + 1, endIdx));
2434
+ index = endIdx + 1;
2435
+ } while (index < len);
2436
+ return obj;
2437
+ }
2438
+ /**
2439
+ * Serialize data into a cookie header.
2440
+ *
2441
+ * Serialize a name value pair into a cookie string suitable for
2442
+ * http headers. An optional options object specifies cookie parameters.
2443
+ *
2444
+ * stringifySetCookie({ name: 'foo', value: 'bar', httpOnly: true })
2445
+ * => "foo=bar; HttpOnly"
2446
+ */
2447
+ function stringifySetCookie(cookie, options) {
2448
+ const enc = options?.encode ?? defaultEncode;
2449
+ if (!cookieNameRegExp.test(cookie.name)) throw new TypeError(`cookie name is invalid: ${cookie.name}`);
2450
+ const value = cookie.value == null ? "" : enc(cookie.value);
2451
+ if (enc !== defaultEncode && !cookieValueRegExp.test(value)) throw new TypeError(`cookie value is invalid: ${cookie.value}`);
2452
+ let str = cookie.name + "=" + value;
2453
+ if (cookie.maxAge !== void 0) {
2454
+ if (!Number.isSafeInteger(cookie.maxAge)) throw new TypeError(`cookie maxAge is invalid: ${cookie.maxAge}`);
2455
+ str += "; Max-Age=" + cookie.maxAge;
2456
+ }
2457
+ if (cookie.domain) {
2458
+ if (!domainValueRegExp.test(cookie.domain)) throw new TypeError(`cookie domain is invalid: ${cookie.domain}`);
2459
+ str += "; Domain=" + cookie.domain;
2460
+ }
2461
+ if (cookie.path) {
2462
+ if (!pathValueRegExp.test(cookie.path)) throw new TypeError(`cookie path is invalid: ${cookie.path}`);
2463
+ str += "; Path=" + cookie.path;
2464
+ }
2465
+ if (cookie.expires) {
2466
+ const year = cookie.expires.getUTCFullYear();
2467
+ if (!(year >= 1601 && year <= 9999)) throw new TypeError(`cookie expires is invalid: ${cookie.expires}`);
2468
+ str += "; Expires=" + cookie.expires.toUTCString();
2469
+ }
2470
+ if (cookie.httpOnly) str += "; HttpOnly";
2471
+ if (cookie.secure) str += "; Secure";
2472
+ if (cookie.partitioned) str += "; Partitioned";
2473
+ if (cookie.priority) switch (typeof cookie.priority === "string" ? cookie.priority.toLowerCase() : void 0) {
2474
+ case "low":
2475
+ str += "; Priority=Low";
2476
+ break;
2477
+ case "medium":
2478
+ str += "; Priority=Medium";
2479
+ break;
2480
+ case "high":
2481
+ str += "; Priority=High";
2482
+ break;
2483
+ default: throw new TypeError(`cookie priority is invalid: ${cookie.priority}`);
2484
+ }
2485
+ if (cookie.sameSite) switch (typeof cookie.sameSite === "string" ? cookie.sameSite.toLowerCase() : cookie.sameSite) {
2486
+ case true:
2487
+ case "strict":
2488
+ str += "; SameSite=Strict";
2489
+ break;
2490
+ case "lax":
2491
+ str += "; SameSite=Lax";
2492
+ break;
2493
+ case "none":
2494
+ str += "; SameSite=None";
2495
+ break;
2496
+ default: throw new TypeError(`cookie sameSite is invalid: ${cookie.sameSite}`);
2497
+ }
2498
+ return str;
2499
+ }
2500
+ /**
2501
+ * Deserialize a `Set-Cookie` header into an object.
2502
+ *
2503
+ * parseSetCookie('foo=bar; HttpOnly')
2504
+ * => { name: 'foo', value: 'bar', httpOnly: true }
2505
+ */
2506
+ function parseSetCookie(str, options) {
2507
+ const dec = options?.decode ?? defaultDecode;
2508
+ const len = str.length;
2509
+ const endIdx = endIndex(str, 0, len);
2510
+ let eqIdx = eqIndex(str, 0, len);
2511
+ const setCookie = eqIdx < endIdx ? {
2512
+ name: valueSlice(str, 0, eqIdx),
2513
+ value: dec(valueSlice(str, eqIdx + 1, endIdx))
2514
+ } : {
2515
+ name: "",
2516
+ value: dec(valueSlice(str, 0, endIdx))
2517
+ };
2518
+ let index = endIdx + 1;
2519
+ while (index < len) {
2520
+ const endIdx = endIndex(str, index, len);
2521
+ if (eqIdx < index) eqIdx = eqIndex(str, index, len);
2522
+ const attr = eqIdx < endIdx ? valueSlice(str, index, eqIdx) : valueSlice(str, index, endIdx);
2523
+ const val = eqIdx < endIdx ? valueSlice(str, eqIdx + 1, endIdx) : void 0;
2524
+ switch (attr.toLowerCase()) {
2525
+ case "httponly":
2526
+ setCookie.httpOnly = true;
2527
+ break;
2528
+ case "secure":
2529
+ setCookie.secure = true;
2530
+ break;
2531
+ case "partitioned":
2532
+ setCookie.partitioned = true;
2533
+ break;
2534
+ case "domain":
2535
+ setCookie.domain = val;
2536
+ break;
2537
+ case "path":
2538
+ setCookie.path = val;
2539
+ break;
2540
+ case "max-age":
2541
+ if (val && maxAgeRegExp.test(val)) setCookie.maxAge = Number(val);
2542
+ break;
2543
+ case "expires":
2544
+ if (!val) break;
2545
+ const date = new Date(val);
2546
+ if (Number.isFinite(date.valueOf())) setCookie.expires = date;
2547
+ break;
2548
+ case "priority":
2549
+ if (!val) break;
2550
+ const priority = val.toLowerCase();
2551
+ if (priority === "low" || priority === "medium" || priority === "high") setCookie.priority = priority;
2552
+ break;
2553
+ case "samesite":
2554
+ if (!val) break;
2555
+ const sameSite = val.toLowerCase();
2556
+ if (sameSite === "lax" || sameSite === "strict" || sameSite === "none") setCookie.sameSite = sameSite;
2557
+ }
2558
+ index = endIdx + 1;
2559
+ }
2560
+ return setCookie;
2561
+ }
2562
+ /**
2563
+ * Find the next `;` character, or return `len`.
2564
+ */
2565
+ function endIndex(str, min, len) {
2566
+ const index = str.indexOf(";", min);
2567
+ return index === -1 ? len : index;
2568
+ }
2569
+ /**
2570
+ * Find the next `=` character, or return `len`.
2571
+ */
2572
+ function eqIndex(str, min, len) {
2573
+ const index = str.indexOf("=", min);
2574
+ return index === -1 ? len : index;
2575
+ }
2576
+ /**
2577
+ * Slice out a value between startPod to max.
2578
+ */
2579
+ function valueSlice(str, min, max) {
2580
+ if (min === max) return "";
2581
+ let start = min;
2582
+ let end = max;
2583
+ do {
2584
+ const code = str.charCodeAt(start);
2585
+ if (code !== 32 && code !== 9) break;
2586
+ } while (++start < end);
2587
+ while (end > start) {
2588
+ const code = str.charCodeAt(end - 1);
2589
+ if (code !== 32 && code !== 9) break;
2590
+ end--;
2591
+ }
2592
+ return str.slice(start, end);
2593
+ }
2594
+ /**
2595
+ * URL-decode string value. Optimized to skip native call when no %.
2596
+ */
2597
+ function defaultDecode(str) {
2598
+ if (str.indexOf("%") === -1) return str;
2599
+ try {
2600
+ return decodeURIComponent(str);
2601
+ } catch (e) {
2602
+ return str;
2603
+ }
2604
+ }
2605
+ /**
2606
+ * URL-encode string value. Optimized to skip native call for roundtrip-safe cookie-octet values.
2607
+ */
2608
+ function defaultEncode(str) {
2609
+ return cookieOctetInvalidRegExp.test(str) ? encodeURIComponent(str) : str;
2610
+ }
2611
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/runtime/server/cookie.js
2612
+ /**
2613
+ * Generates a unique key for a cookie based on its domain, path, and name in
2614
+ * the format: `<domain>/<path>?<name>`.
2615
+ * If domain is undefined, it will be omitted.
2616
+ * For example: `/?name`, `example.com/foo?name`.
2617
+ *
2618
+ * @param {string | undefined} domain
2619
+ * @param {string} path
2620
+ * @param {string} name
2621
+ * @returns {string}
2622
+ */
2623
+ function generate_cookie_key(domain, path, name) {
2624
+ return `${domain || ""}${path}?${encodeURIComponent(name)}`;
2625
+ }
2626
+ /**
2627
+ * @param {Request} request
2628
+ * @param {URL} url
2629
+ */
2630
+ function get_cookies(request, url) {
2631
+ const header = request.headers.get("cookie") ?? "";
2632
+ const initial_cookies = parseCookie(header, { decode: (value) => value });
2633
+ /** @type {ReturnType<typeof parseCookie> | undefined} */
2634
+ let default_cookies;
2635
+ /**
2636
+ * The header never changes during the request, so the default-decode parse is cached
2637
+ * @param {import('cookie').ParseOptions} [opts]
2638
+ */
2639
+ function parse_header(opts) {
2640
+ return opts?.decode ? parseCookie(header, opts) : default_cookies ??= parseCookie(header);
2641
+ }
2642
+ /** @param {import('./page/types.js').Cookie} cookie */
2643
+ function matches_url(cookie) {
2644
+ return domain_matches(url.hostname, cookie.options.domain) && path_matches(url.pathname, cookie.options.path);
2645
+ }
2646
+ /** @type {string | undefined} */
2647
+ let normalized_url;
2648
+ /** @type {Map<string, import('./page/types.js').Cookie>} */
2649
+ const new_cookies = /* @__PURE__ */ new Map();
2650
+ /** @type {Omit<import('cookie').SetCookie, 'name' | 'value'>} */
2651
+ const defaults = {
2652
+ httpOnly: true,
2653
+ path: "/",
2654
+ sameSite: "lax",
2655
+ secure: !(url.hostname === "localhost" && url.protocol === "http:")
2656
+ };
2657
+ /** @type {import('@sveltejs/kit').Cookies} */
2658
+ const cookies = {
2659
+ get(name, opts) {
2660
+ /** @type {import('./page/types.js').Cookie | undefined} */
2661
+ let best_match;
2662
+ for (const c of new_cookies.values()) if (c.name === name && matches_url(c) && (!best_match || c.options.path.length > best_match.options.path.length)) best_match = c;
2663
+ if (best_match) return best_match.options.maxAge === 0 ? void 0 : best_match.value;
2664
+ return parse_header(opts)[name];
2665
+ },
2666
+ getAll(opts) {
2667
+ const cookies = { ...parse_header(opts) };
2668
+ const lookup = /* @__PURE__ */ new Map();
2669
+ for (const c of new_cookies.values()) if (matches_url(c)) {
2670
+ const existing = lookup.get(c.name);
2671
+ if (!existing || c.options.path.length > existing.options.path.length) lookup.set(c.name, c);
2672
+ }
2673
+ for (const c of lookup.values()) if (c.options.maxAge === 0) delete cookies[c.name];
2674
+ else cookies[c.name] = c.value;
2675
+ return Object.entries(cookies).filter(([, value]) => value != null).map(([name, value]) => ({
2676
+ name,
2677
+ value
2678
+ }));
2679
+ },
2680
+ set(name, value, options) {
2681
+ set_internal(name, value, {
2682
+ ...defaults,
2683
+ ...options
2684
+ });
2685
+ },
2686
+ delete(name, options) {
2687
+ cookies.set(name, "", {
2688
+ ...options,
2689
+ maxAge: 0
2690
+ });
2691
+ },
2692
+ parse: parseSetCookie,
2693
+ serialize(name, value, { encode, ...options } = {}) {
2694
+ let path = options.path ?? "/";
2695
+ if (!options.domain || options.domain === url.hostname) {
2696
+ if (!normalized_url) cookies_serialize_before_route();
2697
+ path = resolve(normalized_url, path);
2698
+ }
2699
+ return stringifySetCookie({
2700
+ name,
2701
+ value,
2702
+ ...defaults,
2703
+ ...options,
2704
+ path
2705
+ }, { encode });
2706
+ }
2707
+ };
2708
+ /**
2709
+ * @param {URL} destination
2710
+ * @param {string | null} header
2711
+ */
2712
+ function get_cookie_header(destination, header) {
2713
+ /** @type {Record<string, string>} */
2714
+ const combined_cookies = { ...initial_cookies };
2715
+ for (const cookie of new_cookies.values()) {
2716
+ if (!domain_matches(destination.hostname, cookie.options.domain)) continue;
2717
+ if (!path_matches(destination.pathname, cookie.options.path)) continue;
2718
+ const encoder = cookie.options.encode || encodeURIComponent;
2719
+ combined_cookies[cookie.name] = encoder(cookie.value);
2720
+ }
2721
+ if (header) {
2722
+ const parsed = parseCookie(header, { decode: (value) => value });
2723
+ for (const name in parsed) combined_cookies[name] = parsed[name];
2724
+ }
2725
+ return Object.entries(combined_cookies).map(([name, value]) => `${name}=${value}`).join("; ");
2726
+ }
2727
+ /** @type {Array<() => void>} */
2728
+ const internal_queue = [];
2729
+ /**
2730
+ * @param {string} name
2731
+ * @param {string} value
2732
+ * @param {import('cookie').SerializeOptions} options
2733
+ */
2734
+ function set_internal(name, value, options) {
2735
+ if (!normalized_url) {
2736
+ internal_queue.push(() => set_internal(name, value, options));
2737
+ return;
2738
+ }
2739
+ let path = options.path ?? "/";
2740
+ if (!options.domain || options.domain === url.hostname) path = resolve(normalized_url, path);
2741
+ const cookie_key = generate_cookie_key(options.domain, path, name);
2742
+ const cookie = {
2743
+ name,
2744
+ value,
2745
+ options: {
2746
+ ...options,
2747
+ path
2748
+ }
2749
+ };
2750
+ new_cookies.set(cookie_key, cookie);
2751
+ }
2752
+ /**
2753
+ * @param {import('types').TrailingSlash} trailing_slash
2754
+ */
2755
+ function set_trailing_slash(trailing_slash) {
2756
+ normalized_url = normalize_path(url.pathname, trailing_slash);
2757
+ internal_queue.forEach((fn) => fn());
2758
+ }
2759
+ return {
2760
+ cookies,
2761
+ new_cookies,
2762
+ get_cookie_header,
2763
+ set_internal,
2764
+ set_trailing_slash
2765
+ };
2766
+ }
2767
+ /**
2768
+ * @param {string} hostname
2769
+ * @param {string} [constraint]
2770
+ */
2771
+ function domain_matches(hostname, constraint) {
2772
+ if (!constraint) return true;
2773
+ const normalized = constraint[0] === "." ? constraint.slice(1) : constraint;
2774
+ if (hostname === normalized) return true;
2775
+ return hostname.endsWith("." + normalized);
2776
+ }
2777
+ /**
2778
+ * @param {string} path
2779
+ * @param {string} [constraint]
2780
+ */
2781
+ function path_matches(path, constraint) {
2782
+ if (!constraint) return true;
2783
+ const normalized = constraint.endsWith("/") ? constraint.slice(0, -1) : constraint;
2784
+ if (path === normalized) return true;
2785
+ return path.startsWith(normalized + "/");
2786
+ }
2787
+ /**
2788
+ * @param {Headers} headers
2789
+ * @param {MapIterator<import('./page/types.js').Cookie>} cookies
2790
+ */
2791
+ function add_cookies_to_headers(headers, cookies) {
2792
+ for (const new_cookie of cookies) {
2793
+ const { name, value, options: { encode, ...options } } = new_cookie;
2794
+ headers.append("set-cookie", stringifySetCookie({
2795
+ name,
2796
+ value,
2797
+ ...options
2798
+ }, { encode }));
2799
+ if (options.path.endsWith(".html")) {
2800
+ const path = add_data_suffix(options.path);
2801
+ headers.append("set-cookie", stringifySetCookie({
2802
+ name,
2803
+ value,
2804
+ ...options,
2805
+ path
2806
+ }, { encode }));
2807
+ }
2808
+ }
2809
+ }
2810
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/runtime/server/state.js
2811
+ /** @import { InternalRequestOptions, RequestState } from 'types' */
2812
+ /** Per-request caches and context flags — never carried into a fork. */
2813
+ function transient_fields() {
2814
+ return {
2815
+ headers: {},
2816
+ remote: {
2817
+ data: null,
2818
+ explicit: null,
2819
+ implicit: null,
2820
+ forms: null,
2821
+ requested: null,
2822
+ ignored: null,
2823
+ batches: null,
2824
+ live_iterators: null
2825
+ },
2826
+ is_in_remote_function: false,
2827
+ is_in_remote_form_or_command: false,
2828
+ is_in_remote_query: false,
2829
+ is_in_remote_prerender: false,
2830
+ is_in_render: false,
2831
+ is_in_server_load: false
2832
+ };
2833
+ }
2834
+ /**
2835
+ * @param {InternalRequestOptions} options
2836
+ * @returns {RequestState}
2837
+ */
2838
+ function create_request_state(options) {
2839
+ return {
2840
+ getClientAddress: options.getClientAddress,
2841
+ platform: options.platform,
2842
+ read: options.read,
2843
+ before_handle: options.before_handle,
2844
+ emulator: options.emulator,
2845
+ prerendering: options.prerendering,
2846
+ prerender_default: void 0,
2847
+ error: false,
2848
+ depth: 0,
2849
+ rerouted_url: null,
2850
+ ...transient_fields()
2851
+ };
2852
+ }
2853
+ /**
2854
+ * @param {RequestState} state
2855
+ * @returns {RequestState}
2856
+ */
2857
+ function fork_state_for_subrequest(state) {
2858
+ return {
2859
+ ...state,
2860
+ ...transient_fields(),
2861
+ depth: state.depth + 1
2862
+ };
2863
+ }
2864
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/runtime/server/fetch.js
2865
+ /**
2866
+ * @param {{
2867
+ * event: import('@sveltejs/kit').RequestEvent;
2868
+ * state: import('types').RequestState;
2869
+ * get_cookie_header: (url: URL, header: string | null) => string;
2870
+ * set_internal: (name: string, value: string, opts: import('./page/types.js').Cookie['options']) => void;
2871
+ * }} opts
2872
+ * @returns {typeof fetch}
2873
+ */
2874
+ function create_fetch({ event, state, get_cookie_header, set_internal }) {
2875
+ /**
2876
+ * @type {typeof fetch}
2877
+ */
2878
+ const server_fetch = async (info, init) => {
2879
+ const original_request = normalize_fetch_input(info, init, event.url);
2880
+ let mode = (info instanceof Request ? info.mode : init?.mode) ?? "cors";
2881
+ let credentials = (info instanceof Request ? info.credentials : init?.credentials) ?? "same-origin";
2882
+ return hooks.handleFetch({
2883
+ event,
2884
+ request: original_request,
2885
+ fetch: async (info, init) => {
2886
+ const request = normalize_fetch_input(info, init, event.url);
2887
+ const url = new URL(request.url);
2888
+ if (!request.headers.has("origin")) request.headers.set("origin", event.url.origin);
2889
+ if (info !== original_request) {
2890
+ mode = (info instanceof Request ? info.mode : init?.mode) ?? "cors";
2891
+ credentials = (info instanceof Request ? info.credentials : init?.credentials) ?? "same-origin";
2892
+ }
2893
+ if ((request.method === "GET" || request.method === "HEAD") && (mode === "no-cors" && url.origin !== event.url.origin || url.origin === event.url.origin)) request.headers.delete("origin");
2894
+ const decoded = decodeURIComponent(url.pathname);
2895
+ if (url.origin !== event.url.origin || decoded !== "/ui" && !decoded.startsWith(`/ui/`)) {
2896
+ if (`.${url.hostname}`.endsWith(`.${event.url.hostname}`) && credentials !== "omit") {
2897
+ const cookie = get_cookie_header(url, request.headers.get("cookie"));
2898
+ if (cookie) request.headers.set("cookie", cookie);
2899
+ }
2900
+ return fetch(request);
2901
+ }
2902
+ const filename = (decoded.startsWith(assets) ? decoded.slice(assets.length) : decoded).slice(1);
2903
+ const filename_html = `${filename}/index.html`;
2904
+ const is_asset = manifest.assets.has(filename) || filename in manifest.server_assets;
2905
+ const is_asset_html = manifest.assets.has(filename_html) || filename_html in manifest.server_assets;
2906
+ if (is_asset || is_asset_html) {
2907
+ const file = is_asset ? filename : filename_html;
2908
+ if (state.read) {
2909
+ const type = is_asset ? manifest.mime_types[filename.slice(filename.lastIndexOf("."))] : "text/html";
2910
+ return new Response(state.read(file), { headers: type ? { "content-type": type } : {} });
2911
+ } else if (read_implementation && file in manifest.server_assets) {
2912
+ const length = manifest.server_assets[file];
2913
+ const type = manifest.mime_types[file.slice(file.lastIndexOf("."))];
2914
+ return new Response(read_implementation(file), { headers: {
2915
+ "Content-Length": "" + length,
2916
+ "Content-Type": type
2917
+ } });
2918
+ }
2919
+ return await fetch(request, { redirect: "manual" });
2920
+ }
2921
+ if (has_prerendered_path(decoded)) return await fetch(request, { redirect: "manual" });
2922
+ if (credentials !== "omit") {
2923
+ const cookie = get_cookie_header(url, request.headers.get("cookie"));
2924
+ if (cookie) request.headers.set("cookie", cookie);
2925
+ const authorization = event.request.headers.get("authorization");
2926
+ if (authorization && !request.headers.has("authorization")) request.headers.set("authorization", authorization);
2927
+ }
2928
+ if (!request.headers.has("accept")) request.headers.set("accept", "*/*");
2929
+ const accept_language = event.request.headers.get("accept-language");
2930
+ if (accept_language && !request.headers.has("accept-language")) request.headers.set("accept-language", accept_language);
2931
+ const response = await internal_fetch(request, state);
2932
+ for (const str of response.headers.getSetCookie()) {
2933
+ const { name, value, ...cookie_options } = parseSetCookie(str, { decode: (v) => v });
2934
+ set_internal(name, value, {
2935
+ path: cookie_options.path ?? (url.pathname.split("/").slice(0, -1).join("/") || "/"),
2936
+ encode: (value) => value,
2937
+ ...cookie_options
2938
+ });
2939
+ }
2940
+ return response;
2941
+ }
2942
+ });
2943
+ };
2944
+ return (input, init) => {
2945
+ const response = server_fetch(input, init);
2946
+ response.catch(noop);
2947
+ return response;
2948
+ };
2949
+ }
2950
+ /**
2951
+ * @param {RequestInfo | URL} info
2952
+ * @param {RequestInit | undefined} init
2953
+ * @param {URL} url
2954
+ */
2955
+ function normalize_fetch_input(info, init, url) {
2956
+ if (info instanceof Request) return info;
2957
+ return new Request(typeof info === "string" ? new URL(info, url) : info, init);
2958
+ }
2959
+ /**
2960
+ * @param {Request} request
2961
+ * @param {import('types').RequestState} state
2962
+ * @returns {Promise<Response>}
2963
+ */
2964
+ async function internal_fetch(request, state) {
2965
+ if (request.signal?.aborted) throw new DOMException("The operation was aborted.", "AbortError");
2966
+ const subrequest_state = fork_state_for_subrequest(state);
2967
+ if (!request.signal) return await respond$1(request, subrequest_state);
2968
+ let remove_abort_listener = noop;
2969
+ /** @type {Promise<never>} */
2970
+ const abort_promise = new Promise((_, reject) => {
2971
+ const on_abort = () => {
2972
+ reject(new DOMException("The operation was aborted.", "AbortError"));
2973
+ };
2974
+ request.signal.addEventListener("abort", on_abort, { once: true });
2975
+ remove_abort_listener = () => request.signal.removeEventListener("abort", on_abort);
2976
+ });
2977
+ return Promise.race([respond$1(request, subrequest_state), abort_promise]).finally(remove_abort_listener);
2978
+ }
2979
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/runtime/server/env_module.js
2980
+ /** @type {string} */
2981
+ var payload;
2982
+ /** @type {string} */
2983
+ var etag;
2984
+ /** @type {Headers} */
2985
+ var headers;
2986
+ /**
2987
+ * @param {Request} request
2988
+ * @returns {Response}
2989
+ */
2990
+ function get_public_env(request) {
2991
+ payload ??= uneval(rendered_env);
2992
+ etag ??= `W/${Date.now()}`;
2993
+ headers ??= new Headers({
2994
+ "content-type": "application/javascript; charset=utf-8",
2995
+ etag
2996
+ });
2997
+ if (request.headers.get("if-none-match") === etag) return new Response(void 0, {
2998
+ status: 304,
2999
+ headers
3000
+ });
3001
+ return new Response(`export const env=${payload}`, { headers });
3002
+ }
3003
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/runtime/server/respond.js
3004
+ /** @import { SSRNode } from 'types' */
3005
+ /** @type {import('types').RequiredResolveOptions['transformPageChunk']} */
3006
+ var default_transform = ({ html }) => html;
3007
+ /** @type {import('types').RequiredResolveOptions['filterSerializedResponseHeaders']} */
3008
+ var default_filter = () => false;
3009
+ /** @type {import('types').RequiredResolveOptions['preload']} */
3010
+ var default_preload = ({ type }) => type === "js" || type === "css";
3011
+ var non_html_fetch_destinations = /* @__PURE__ */ new Set([
3012
+ "audio",
3013
+ "audioworklet",
3014
+ "font",
3015
+ "image",
3016
+ "json",
3017
+ "manifest",
3018
+ "paintworklet",
3019
+ "report",
3020
+ "script",
3021
+ "serviceworker",
3022
+ "sharedworker",
3023
+ "style",
3024
+ "track",
3025
+ "video",
3026
+ "webidentity",
3027
+ "worker",
3028
+ "xslt"
3029
+ ]);
3030
+ var page_methods = /* @__PURE__ */ new Set([
3031
+ "GET",
3032
+ "HEAD",
3033
+ "POST"
3034
+ ]);
3035
+ var allowed_page_methods = /* @__PURE__ */ new Set([
3036
+ "GET",
3037
+ "HEAD",
3038
+ "OPTIONS"
3039
+ ]);
3040
+ var respond$1 = propagate_context(internal_respond);
3041
+ /**
3042
+ * @param {Request} request
3043
+ * @param {import('types').RequestState} state
3044
+ * @returns {Promise<Response>}
3045
+ */
3046
+ async function internal_respond(request, state) {
3047
+ /** URL but stripped from the potential `/__data.json` suffix and its search param */
3048
+ const url = new URL(request.url);
3049
+ const is_route_resolution_request = has_resolution_suffix(url.pathname);
3050
+ const is_data_request = has_data_suffix(url.pathname);
3051
+ const remote_id = get_remote_id(url);
3052
+ {
3053
+ const request_origin = request.headers.get("origin");
3054
+ const self_origin = get_self_origin(void 0, url.origin);
3055
+ if (remote_id) {
3056
+ if (is_remote_forbidden({
3057
+ request,
3058
+ request_origin,
3059
+ self_origin
3060
+ })) return Response.json({ message: "Cross-site remote requests are forbidden" }, { status: 403 });
3061
+ } else if (is_csrf_forbidden({
3062
+ request,
3063
+ request_origin,
3064
+ self_origin,
3065
+ trusted_origins: options.csrf_trusted_origins
3066
+ })) {
3067
+ const message = `Cross-site ${request.method} form submissions are forbidden`;
3068
+ const opts = { status: 403 };
3069
+ if (request.headers.get("accept") === "application/json") return Response.json({ message }, opts);
3070
+ return text(message, opts);
3071
+ }
3072
+ }
3073
+ /** @type {boolean[] | undefined} */
3074
+ let invalidated_data_nodes;
3075
+ let skip_route_resolution = false;
3076
+ /** Whether this is a `/${app_dir}/routes/<route_id>/__route.js` request, used by `preloadCode` */
3077
+ let is_route_id_resolution_request = false;
3078
+ if (is_route_resolution_request) {
3079
+ /**
3080
+ * If the request is for a route resolution, first modify the URL, then continue as normal
3081
+ * for path resolution, then return the route object as a JS file.
3082
+ */
3083
+ url.pathname = strip_resolution_suffix(url.pathname);
3084
+ is_route_id_resolution_request = is_route_id_resolution_path(url.pathname);
3085
+ } else if (is_data_request) {
3086
+ url.pathname = strip_data_suffix(url.pathname) + (url.searchParams.get("x-sveltekit-trailing-slash") === "1" ? "/" : "") || "/";
3087
+ url.searchParams.delete(TRAILING_SLASH_PARAM);
3088
+ invalidated_data_nodes = url.searchParams.get(INVALIDATED_PARAM)?.split("").map((node) => node === "1");
3089
+ url.searchParams.delete(INVALIDATED_PARAM);
3090
+ } else if (remote_id) {
3091
+ const pathname = request.headers.get("x-sveltekit-pathname");
3092
+ if (pathname === null) skip_route_resolution = true;
3093
+ else {
3094
+ url.pathname = pathname;
3095
+ url.search = request.headers.get("x-sveltekit-search") ?? "";
3096
+ }
3097
+ }
3098
+ for (const key of url.searchParams.keys()) if (key.startsWith("x-sveltekit-")) return text(`Cannot use reserved query parameter "${key}"`, { status: 400 });
3099
+ const headers = state.headers;
3100
+ const { cookies, new_cookies, get_cookie_header, set_internal, set_trailing_slash } = get_cookies(request, url);
3101
+ /** @type {import('@sveltejs/kit').RequestEvent} */
3102
+ const event = {
3103
+ cookies,
3104
+ fetch: null,
3105
+ getClientAddress: state.getClientAddress || (() => {
3106
+ client_address_unsupported({ adapter: "@sveltejs/adapter-node" });
3107
+ }),
3108
+ locals: {},
3109
+ params: {},
3110
+ platform: state.emulator?.platform ? await state.emulator.platform({
3111
+ config: {},
3112
+ prerender: !!state.prerendering?.fallback
3113
+ }) : state.platform,
3114
+ request,
3115
+ route: { id: null },
3116
+ setHeaders: (new_headers) => {
3117
+ for (const key in new_headers) {
3118
+ const lower = key.toLowerCase();
3119
+ const value = new_headers[key];
3120
+ if (lower === "set-cookie") set_headers_cookie();
3121
+ else if (lower in headers) {
3122
+ if (lower === "server-timing") headers[lower] += ", " + value;
3123
+ else header_already_set({ name: key });
3124
+ } else {
3125
+ headers[lower] = value;
3126
+ if (state.prerendering && lower === "cache-control") state.prerendering.cache = value;
3127
+ }
3128
+ }
3129
+ },
3130
+ url,
3131
+ isDataRequest: is_data_request,
3132
+ isSubRequest: state.depth > 0,
3133
+ isRemoteRequest: !!remote_id
3134
+ };
3135
+ event.fetch = create_fetch({
3136
+ event,
3137
+ state,
3138
+ get_cookie_header,
3139
+ set_internal
3140
+ });
3141
+ /** @type {string | null} */
3142
+ let resolved_path = url.pathname;
3143
+ if (!remote_id && !is_route_id_resolution_request) {
3144
+ const prerendering_reroute_state = state.prerendering?.inside_reroute;
3145
+ try {
3146
+ if (state.prerendering) state.prerendering.inside_reroute = true;
3147
+ resolved_path = await hooks.reroute({
3148
+ url: new URL(url),
3149
+ fetch: event.fetch
3150
+ }) ?? url.pathname;
3151
+ if (!manifest.routes.length && resolved_path !== url.pathname) state.rerouted_url = denormalise_url({
3152
+ request_url: request.url,
3153
+ resolved_path,
3154
+ is_data_request,
3155
+ is_route_resolution_request
3156
+ }).toString();
3157
+ } catch {
3158
+ return text("Internal Server Error", { status: 500 });
3159
+ } finally {
3160
+ if (state.prerendering) state.prerendering.inside_reroute = prerendering_reroute_state;
3161
+ }
3162
+ }
3163
+ /** @type {import('types').RequiredResolveOptions} */
3164
+ let resolve_opts = {
3165
+ transformPageChunk: default_transform,
3166
+ filterSerializedResponseHeaders: default_filter,
3167
+ preload: default_preload
3168
+ };
3169
+ /** @type {import('types').TrailingSlash} */
3170
+ let trailing_slash = "never";
3171
+ /** @type {PageNodes | undefined} */
3172
+ let page_nodes;
3173
+ /** @type {import('types').SSRRoute | null} */
3174
+ let route = null;
3175
+ /** @type {string} */
3176
+ let decoded_pathname;
3177
+ try {
3178
+ resolved_path = decode_pathname(resolved_path);
3179
+ decoded_pathname = decode_pathname(url.pathname);
3180
+ } catch {
3181
+ resolved_path = null;
3182
+ return await handle();
3183
+ }
3184
+ if (resolved_path !== decoded_pathname && !state.prerendering?.fallback && has_prerendered_path(resolved_path)) {
3185
+ const url = denormalise_url({
3186
+ request_url: request.url,
3187
+ resolved_path,
3188
+ is_data_request,
3189
+ is_route_resolution_request
3190
+ });
3191
+ try {
3192
+ const response = await fetch(new Request(url, request), { redirect: "manual" });
3193
+ const headers = new Headers(response.headers);
3194
+ if (headers.has("content-encoding")) {
3195
+ headers.delete("content-encoding");
3196
+ headers.delete("content-length");
3197
+ }
3198
+ return new Response(response.body, {
3199
+ headers,
3200
+ status: response.status,
3201
+ statusText: response.statusText
3202
+ });
3203
+ } catch (error) {
3204
+ return await handle_fatal_error(event, state, error);
3205
+ }
3206
+ }
3207
+ if (!state.prerendering?.fallback) {
3208
+ if (!resolved_path.startsWith("/ui")) return text("Not found", { status: 404 });
3209
+ resolved_path = resolved_path.slice(3) || "/";
3210
+ }
3211
+ if (is_route_resolution_request) {
3212
+ if (is_route_id_resolution_request) return resolve_route_by_id(extract_route_id(resolved_path), new URL(request.url));
3213
+ return resolve_route(resolved_path, new URL(request.url));
3214
+ }
3215
+ if (resolved_path === `/_app/env.js`) return get_public_env(request);
3216
+ if (!remote_id && resolved_path.startsWith(`/_app`)) {
3217
+ const headers = new Headers();
3218
+ headers.set("cache-control", "public, max-age=0, must-revalidate");
3219
+ return text("Not found", {
3220
+ status: 404,
3221
+ headers
3222
+ });
3223
+ }
3224
+ if (!state.prerendering?.fallback && !skip_route_resolution) try {
3225
+ const matchers = await manifest.matchers();
3226
+ const result = find_route(resolved_path, manifest.routes, matchers);
3227
+ if (result) {
3228
+ route = result.route;
3229
+ event.route = { id: route.id };
3230
+ event.params = result.params;
3231
+ }
3232
+ } catch (e) {
3233
+ return await handle_fatal_error(event, state, e);
3234
+ }
3235
+ try {
3236
+ page_nodes = route?.page ? new PageNodes(await load_page_nodes(route.page)) : void 0;
3237
+ if (route && !remote_id) {
3238
+ if (url.pathname === "/ui" || url.pathname === "/ui/") trailing_slash = "always";
3239
+ else if (page_nodes) trailing_slash = page_nodes.trailing_slash();
3240
+ else if (route.endpoint) trailing_slash = (await route.endpoint()).trailingSlash ?? "never";
3241
+ if (!is_data_request) {
3242
+ const normalized = normalize_path(url.pathname, trailing_slash);
3243
+ if (normalized !== url.pathname && !state.prerendering?.fallback) return new Response(void 0, {
3244
+ status: 308,
3245
+ headers: {
3246
+ "x-sveltekit-normalize": "1",
3247
+ location: relative_pathname(url.pathname, normalized) + (url.search === "?" ? "" : url.search)
3248
+ }
3249
+ });
3250
+ }
3251
+ if (state.before_handle || state.emulator?.platform) {
3252
+ let config = {};
3253
+ /** @type {import('types').PrerenderOption} */
3254
+ let prerender = false;
3255
+ if (route.endpoint) {
3256
+ const node = await route.endpoint();
3257
+ config = node.config ?? config;
3258
+ prerender = node.prerender ?? prerender;
3259
+ } else if (page_nodes) {
3260
+ config = page_nodes.get_config() ?? config;
3261
+ prerender = state.prerender_default = page_nodes.prerender();
3262
+ }
3263
+ if (state.emulator?.platform) event.platform = await state.emulator.platform({
3264
+ config,
3265
+ prerender
3266
+ });
3267
+ if (state.before_handle) return await state.before_handle(event, config, prerender, handle);
3268
+ }
3269
+ }
3270
+ return await handle();
3271
+ } catch (e) {
3272
+ if (e instanceof Redirect) try {
3273
+ 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);
3274
+ add_cookies_to_headers(response.headers, new_cookies.values());
3275
+ return response;
3276
+ } catch (err) {
3277
+ return await handle_fatal_error(event, state, err);
3278
+ }
3279
+ return await handle_fatal_error(event, state, e);
3280
+ }
3281
+ async function handle() {
3282
+ set_trailing_slash(trailing_slash);
3283
+ if (state.prerendering && !state.prerendering.fallback && !state.prerendering.inside_reroute) disable_search(url);
3284
+ const response = await record_span({
3285
+ name: "sveltekit.handle.root",
3286
+ attributes: {
3287
+ "http.route": event.route.id || "unknown",
3288
+ "http.method": event.request.method,
3289
+ "http.url": event.url.href,
3290
+ "sveltekit.is_data_request": is_data_request,
3291
+ "sveltekit.is_sub_request": event.isSubRequest
3292
+ },
3293
+ fn: async (root_span) => {
3294
+ const traced_event = {
3295
+ ...event,
3296
+ tracing: {
3297
+ enabled: false,
3298
+ root: root_span,
3299
+ current: root_span
3300
+ }
3301
+ };
3302
+ return await with_request_store({
3303
+ event: traced_event,
3304
+ state
3305
+ }, () => hooks.handle({
3306
+ event: traced_event,
3307
+ resolve: (event, opts) => {
3308
+ return record_span({
3309
+ name: "sveltekit.resolve",
3310
+ attributes: { "http.route": event.route.id || "unknown" },
3311
+ fn: (resolve_span) => {
3312
+ return with_request_store(null, () => resolve(merge_tracing(event, resolve_span), page_nodes, opts).then((response) => {
3313
+ const negotiated = (request.method === "GET" || request.method === "HEAD") && !remote_id && !!route?.page && !!route.endpoint;
3314
+ if (negotiated) response = new Response(response.body, {
3315
+ status: response.status,
3316
+ statusText: response.statusText,
3317
+ headers: new Headers(response.headers)
3318
+ });
3319
+ for (const key in headers) {
3320
+ const value = headers[key];
3321
+ response.headers.set(key, value);
3322
+ }
3323
+ if (negotiated) {
3324
+ const vary = response.headers.get("vary")?.split(",").map((v) => v.trim().toLowerCase());
3325
+ if (!(vary?.includes("accept") || vary?.includes("*"))) response.headers.append("Vary", "Accept");
3326
+ }
3327
+ add_cookies_to_headers(response.headers, new_cookies.values());
3328
+ if (state.prerendering && event.route.id !== null) response.headers.set("x-sveltekit-routeid", encodeURI(event.route.id));
3329
+ resolve_span.setAttributes({
3330
+ "http.response.status_code": response.status,
3331
+ "http.response.body.size": response.headers.get("content-length") || "unknown"
3332
+ });
3333
+ return response;
3334
+ }));
3335
+ }
3336
+ });
3337
+ }
3338
+ }));
3339
+ }
3340
+ });
3341
+ if (response.status === 200 && response.headers.has("etag")) {
3342
+ let if_none_match_value = request.headers.get("if-none-match");
3343
+ if (if_none_match_value?.startsWith("W/\"")) if_none_match_value = if_none_match_value.substring(2);
3344
+ const etag = response.headers.get("etag");
3345
+ if (if_none_match_value === etag) {
3346
+ const headers = new Headers({ etag });
3347
+ for (const key of [
3348
+ "cache-control",
3349
+ "content-location",
3350
+ "date",
3351
+ "expires",
3352
+ "vary"
3353
+ ]) {
3354
+ const value = response.headers.get(key);
3355
+ if (value) headers.set(key, value);
3356
+ }
3357
+ for (const cookie of response.headers.getSetCookie()) headers.append("set-cookie", cookie);
3358
+ return new Response(void 0, {
3359
+ status: 304,
3360
+ headers
3361
+ });
3362
+ }
3363
+ }
3364
+ if (is_data_request && response.status >= 300 && response.status <= 308) {
3365
+ const location = response.headers.get("location");
3366
+ if (location) return redirect_json_response(new Redirect(response.status, location));
3367
+ }
3368
+ return response;
3369
+ }
3370
+ /**
3371
+ * @param {import('@sveltejs/kit').RequestEvent} event
3372
+ * @param {PageNodes | undefined} page_nodes
3373
+ * @param {import('@sveltejs/kit/hooks').ResolveOptions} [opts]
3374
+ */
3375
+ async function resolve(event, page_nodes, opts) {
3376
+ try {
3377
+ if (opts) resolve_opts = {
3378
+ transformPageChunk: opts.transformPageChunk || default_transform,
3379
+ filterSerializedResponseHeaders: opts.filterSerializedResponseHeaders || default_filter,
3380
+ preload: opts.preload || default_preload
3381
+ };
3382
+ if (resolved_path === null) return await respond_with_error({
3383
+ event,
3384
+ state,
3385
+ error: new SvelteKitError(400, "Malformed URI", `Failed to decode URI: ${event.url.pathname}`),
3386
+ resolve_opts
3387
+ });
3388
+ if (state.prerendering?.fallback) return await render_response({
3389
+ event,
3390
+ state,
3391
+ page_config: {
3392
+ ssr: false,
3393
+ csr: true
3394
+ },
3395
+ status: 200,
3396
+ error: null,
3397
+ branch: [{
3398
+ node: await manifest.nodes[0](),
3399
+ data: null,
3400
+ server_data: null
3401
+ }],
3402
+ fetched: [],
3403
+ resolve_opts,
3404
+ data_serializer: server_data_serializer(event, state)
3405
+ });
3406
+ if (remote_id) return await handle_remote_call(event, state, remote_id);
3407
+ if (route) {
3408
+ const method = event.request.method;
3409
+ /** @type {Response} */
3410
+ let response;
3411
+ if (is_data_request) response = await render_data(event, state, route, invalidated_data_nodes, trailing_slash);
3412
+ else {
3413
+ let endpoint;
3414
+ if (route.endpoint && (!route.page || !state.prerendering && is_endpoint_request(event))) {
3415
+ endpoint = await route.endpoint();
3416
+ if (route.page && (method === "GET" || method === "HEAD" || method === "POST")) {
3417
+ if (!(method === "POST" ? !!(endpoint.POST || endpoint.fallback) : !!(endpoint.GET || endpoint.fallback || method === "HEAD" && endpoint.HEAD))) endpoint = void 0;
3418
+ }
3419
+ }
3420
+ if (endpoint) response = await render_endpoint(event, state, endpoint);
3421
+ else if (route.page) {
3422
+ if (!page_nodes) throw new Error("page_nodes not found. This should never happen");
3423
+ else if (page_methods.has(method)) response = await render_page(event, state, route.page, page_nodes, resolve_opts);
3424
+ else {
3425
+ const allowed_methods = new Set(allowed_page_methods);
3426
+ if ((await manifest.nodes[route.page.leaf]())?.server?.actions) allowed_methods.add("POST");
3427
+ if (method === "OPTIONS") response = new Response(null, {
3428
+ status: 204,
3429
+ headers: { allow: [...allowed_methods].join(", ") }
3430
+ });
3431
+ else {
3432
+ const mod = Object.fromEntries([...allowed_methods].map((m) => [m, true]));
3433
+ response = method_not_allowed(mod, method);
3434
+ }
3435
+ }
3436
+ } else throw new Error("Route is neither page nor endpoint. This should never happen");
3437
+ }
3438
+ return response;
3439
+ }
3440
+ if (state.error && event.isSubRequest) {
3441
+ const headers = new Headers(request.headers);
3442
+ headers.set("x-sveltekit-error", "true");
3443
+ return await fetch(request, {
3444
+ headers,
3445
+ redirect: "manual"
3446
+ });
3447
+ }
3448
+ if (state.error) return text("Internal Server Error", { status: 500 });
3449
+ if (state.depth === 0) {
3450
+ if (!state.prerendering && is_data_request && invalidated_data_nodes?.length === 1 && invalidated_data_nodes[0]) return await render_data(event, state, { page: {
3451
+ layouts: [],
3452
+ leaf: 0
3453
+ } }, invalidated_data_nodes, "ignore");
3454
+ if (non_html_fetch_destinations.has(event.request.headers.get("sec-fetch-dest") ?? "")) return text("Not Found", {
3455
+ status: 404,
3456
+ headers: { vary: "Sec-Fetch-Dest" }
3457
+ });
3458
+ return await respond_with_error({
3459
+ event,
3460
+ state,
3461
+ error: new SvelteKitError(404, "Not Found", `Not found: ${event.url.pathname}`),
3462
+ resolve_opts
3463
+ });
3464
+ }
3465
+ if (state.prerendering) return text("not found", { status: 404 });
3466
+ const response = await fetch(request, { redirect: "manual" });
3467
+ return new Response(response.body, response);
3468
+ } catch (e) {
3469
+ return await handle_fatal_error(event, state, e);
3470
+ } finally {
3471
+ event.cookies.set = () => {
3472
+ cookies_set_after_response();
3473
+ };
3474
+ event.setHeaders = () => {
3475
+ set_headers_after_response();
3476
+ };
3477
+ }
3478
+ }
3479
+ }
3480
+ /**
3481
+ * @param {import('types').PageNodeIndexes} page
3482
+ */
3483
+ function load_page_nodes(page) {
3484
+ return Promise.all([...page.layouts.map((n) => n == void 0 ? n : manifest.nodes[n]()), manifest.nodes[page.leaf]()]);
3485
+ }
3486
+ /**
3487
+ * It's likely that, in a distributed system, there are spans starting outside the SvelteKit server -- eg.
3488
+ * started on the frontend client, or in a service that calls the SvelteKit server. There are standardized
3489
+ * ways to represent this context in HTTP headers, so we can extract that context and run our tracing inside of it
3490
+ * so that when our traces are exported, they are associated with the correct parent context.
3491
+ * @param {typeof internal_respond} fn
3492
+ * @returns {typeof internal_respond}
3493
+ */
3494
+ function propagate_context(fn) {
3495
+ return async (req, ...rest) => {
3496
+ if (otel === null) return fn(req, ...rest);
3497
+ const { propagation, context } = await otel;
3498
+ const c = propagation.extract(context.active(), Object.fromEntries(req.headers));
3499
+ return context.with(c, async () => {
3500
+ return await fn(req, ...rest);
3501
+ });
3502
+ };
3503
+ }
3504
+ /**
3505
+ * @param {object} opts
3506
+ * @param {string} opts.request_url - The original request URL
3507
+ * @param {string} opts.resolved_path - The resolved pathname
3508
+ * @param {boolean} opts.is_data_request - Whether the request is a data request
3509
+ * @param {boolean} opts.is_route_resolution_request -
3510
+ * @returns {URL}
3511
+ */
3512
+ function denormalise_url({ request_url, resolved_path, is_data_request, is_route_resolution_request }) {
3513
+ const url = new URL(request_url);
3514
+ url.pathname = is_data_request ? add_data_suffix(resolved_path) : is_route_resolution_request ? add_resolution_suffix(resolved_path) : resolved_path;
3515
+ return url;
3516
+ }
3517
+ // ../../node_modules/.pnpm/@sveltejs+kit@3.4.1_@sveltejs+vite-plugin-svelte@7.3.2_svelte@5.59.2_@typescript-eslint_728102f730ebab1d17bec5b56ce561d1/node_modules/@sveltejs/kit/src/runtime/server/instance.js
3518
+ /** @type {Promise<any>} */
3519
+ var init_promise;
3520
+ /**
3521
+ * Loads the user's hooks, once, however many times an adapter calls it
3522
+ */
3523
+ async function init() {
3524
+ await (init_promise ??= (async () => {
3525
+ try {
3526
+ const module = await get_hooks();
3527
+ set_hooks({
3528
+ handle: module.handle || (({ event, resolve }) => resolve(event)),
3529
+ handleError: module.handleError || default_handle_error,
3530
+ handleFetch: module.handleFetch || (({ request, fetch }) => fetch(request)),
3531
+ reroute: module.reroute || noop
3532
+ });
3533
+ init_transport(module.transport ?? {});
3534
+ if (module.init) await module.init();
3535
+ } catch (e) {
3536
+ throw e;
3537
+ }
3538
+ })());
3539
+ }
3540
+ /**
3541
+ * @param {Request} request
3542
+ * @param {import('types').InternalRequestOptions} options
3543
+ */
3544
+ async function respond_to(request, options) {
3545
+ const request_state = create_request_state(options);
3546
+ let response = await respond$1(request, request_state);
3547
+ if (request_state.rerouted_url) {
3548
+ response = new Response(response.body, response);
3549
+ response.headers.set(REROUTED_URL_HEADER, request_state.rerouted_url);
3550
+ }
3551
+ if (request.method === "HEAD" && response.body !== null) {
3552
+ response.body.cancel().catch(noop);
3553
+ return new Response(null, response);
3554
+ }
3555
+ return response;
3556
+ }
3557
+ /**
3558
+ * AsyncLocalStorage does not work in webcontainers, so there `sync_store` is never reset
3559
+ * (see `src/exports/internal/server/event.js`) and requests are handled one at a time
3560
+ * @param {typeof respond_to} fn
3561
+ */
3562
+ function serialise(fn) {
3563
+ /** @type {Promise<void> | null} */
3564
+ let current = null;
3565
+ /** @type {typeof respond_to} */
3566
+ return async (...args) => {
3567
+ const { promise, resolve } = Promise.withResolvers();
3568
+ const previous = current;
3569
+ current = promise;
3570
+ await previous;
3571
+ return fn(...args).finally(resolve);
3572
+ };
3573
+ }
3574
+ var respond = IN_WEBCONTAINER ? serialise(respond_to) : respond_to;
3575
+ export { init, respond, set_env };
3576
+
3577
+ //# sourceMappingURL=instance.js.map