@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.
- package/LICENSE +21 -0
- package/README.md +46 -2
- package/dist/cli.mjs +6291 -0
- package/dist/ui/adapter-node.js +11 -0
- package/dist/ui/client/ui/_app/immutable/assets/0.ONZWQgDA.css +1 -0
- package/dist/ui/client/ui/_app/immutable/assets/0.ONZWQgDA.css.br +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/0.ONZWQgDA.css.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/2.DSVNnDlO.css +1 -0
- package/dist/ui/client/ui/_app/immutable/assets/2.DSVNnDlO.css.br +3 -0
- package/dist/ui/client/ui/_app/immutable/assets/2.DSVNnDlO.css.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/3.WduKm4aT.css +1 -0
- package/dist/ui/client/ui/_app/immutable/assets/3.WduKm4aT.css.br +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/3.WduKm4aT.css.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/4.DyY1vjRV.css +1 -0
- package/dist/ui/client/ui/_app/immutable/assets/4.DyY1vjRV.css.br +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/4.DyY1vjRV.css.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/5.YyxFzHED.css +1 -0
- package/dist/ui/client/ui/_app/immutable/assets/5.YyxFzHED.css.br +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/5.YyxFzHED.css.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/6.C0Nhvs_m.css +1 -0
- package/dist/ui/client/ui/_app/immutable/assets/6.C0Nhvs_m.css.br +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/6.C0Nhvs_m.css.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/ExternalLink.CYXazpKA.css +1 -0
- package/dist/ui/client/ui/_app/immutable/assets/ExternalLink.CYXazpKA.css.br +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/ExternalLink.CYXazpKA.css.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/Pane.Dgdg5KMw.css +1 -0
- package/dist/ui/client/ui/_app/immutable/assets/Pane.Dgdg5KMw.css.br +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/Pane.Dgdg5KMw.css.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/material-symbols-outlined-latin-400-normal.BhEvR8fk.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-flex-cyrillic-ext-opsz-normal.nDQikIyu.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-flex-cyrillic-opsz-normal.SjuC5rw5.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-flex-greek-opsz-normal.C14fFRny.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-flex-latin-ext-opsz-normal.xNclTVCo.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-flex-latin-opsz-normal.hy8fyBBC.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-flex-vietnamese-opsz-normal.C-H_yGOU.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-cyrillic-400-normal.B3hIXASd.woff +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-cyrillic-400-normal.C-_K-ZCn.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-cyrillic-500-normal.DGZ7-lUP.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-cyrillic-500-normal.NpUJFYX7.woff +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-cyrillic-ext-400-normal.BHxv52bw.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-cyrillic-ext-400-normal.W26xs1TL.woff +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-cyrillic-ext-500-normal.6xdwlG7p.woff +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-cyrillic-ext-500-normal.DC57U9n8.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-greek-400-normal.CH_u3Aru.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-greek-400-normal.P8xe1gs1.woff +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-greek-500-normal.C2M8jX6G.woff +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-greek-500-normal.DpRFkptA.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-latin-400-normal.DBZPkcnn.woff +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-latin-400-normal.GekRknry.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-latin-500-normal.D6j6AMzd.woff +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-latin-500-normal.pxIOXZmA.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-latin-ext-400-normal.BwLXVYNz.woff +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-latin-ext-400-normal.DLAV9S_w.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-latin-ext-500-normal.B1IjfbhL.woff +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-latin-ext-500-normal.Db3ge6Oe.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-vietnamese-400-normal.CzWHQABp.woff +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-vietnamese-400-normal.yYTFiTTs.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-vietnamese-500-normal.Cq-quQMu.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-vietnamese-500-normal.IxzxMIj7.woff +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/0FroJ-XN.js +3 -0
- package/dist/ui/client/ui/_app/immutable/chunks/0FroJ-XN.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/0FroJ-XN.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/4wvZDMeR.js +33 -0
- package/dist/ui/client/ui/_app/immutable/chunks/4wvZDMeR.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/4wvZDMeR.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/B1Ryegye.js +3 -0
- package/dist/ui/client/ui/_app/immutable/chunks/B1Ryegye.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/B1Ryegye.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/B1vArRqi.js +3 -0
- package/dist/ui/client/ui/_app/immutable/chunks/B1vArRqi.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/B1vArRqi.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BS7n1gMj.js +40 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BS7n1gMj.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BS7n1gMj.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/B_ZElYu_.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/B_ZElYu_.js.br +2 -0
- package/dist/ui/client/ui/_app/immutable/chunks/B_ZElYu_.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Beqi9dRN.js +72 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Beqi9dRN.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Beqi9dRN.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BnU72Mow.js +2 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BnU72Mow.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BnU72Mow.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Bvlvl8SZ.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Bvlvl8SZ.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Bvlvl8SZ.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CK3uUd4t.js +48 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CK3uUd4t.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CK3uUd4t.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CMWEX9XL.js +138 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CMWEX9XL.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CMWEX9XL.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CVpgcnu3.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CVpgcnu3.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CVpgcnu3.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/D-2Nx62w.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/D-2Nx62w.js.br +4 -0
- package/dist/ui/client/ui/_app/immutable/chunks/D-2Nx62w.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/D0famktY.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/D0famktY.js.br +2 -0
- package/dist/ui/client/ui/_app/immutable/chunks/D0famktY.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DHsTyp2W.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DHsTyp2W.js.br +2 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DHsTyp2W.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DOY87jO2.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DOY87jO2.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DOY87jO2.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DUTjbZNf.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DUTjbZNf.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DUTjbZNf.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Dvxhfd7j.js +3 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Dvxhfd7j.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Dvxhfd7j.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DzInmTUe.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DzInmTUe.js.br +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DzInmTUe.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/tKonUL5Y.js +4 -0
- package/dist/ui/client/ui/_app/immutable/chunks/tKonUL5Y.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/tKonUL5Y.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/app.C8tsut3X.js +2 -0
- package/dist/ui/client/ui/_app/immutable/entry/app.C8tsut3X.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/app.C8tsut3X.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/payload.DSmR2FwN.js +1 -0
- package/dist/ui/client/ui/_app/immutable/entry/payload.DSmR2FwN.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/payload.DSmR2FwN.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/start.DqIv9xYX.js +2 -0
- package/dist/ui/client/ui/_app/immutable/entry/start.DqIv9xYX.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/start.DqIv9xYX.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/0.3bVKqGbx.js +1 -0
- package/dist/ui/client/ui/_app/immutable/nodes/0.3bVKqGbx.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/0.3bVKqGbx.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/1.C81neQJL.js +1 -0
- package/dist/ui/client/ui/_app/immutable/nodes/1.C81neQJL.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/1.C81neQJL.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/2.CmlyeAx_.js +1 -0
- package/dist/ui/client/ui/_app/immutable/nodes/2.CmlyeAx_.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/2.CmlyeAx_.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/3.WT26F_BF.js +5 -0
- package/dist/ui/client/ui/_app/immutable/nodes/3.WT26F_BF.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/3.WT26F_BF.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/4.tiDJxi6M.js +160 -0
- package/dist/ui/client/ui/_app/immutable/nodes/4.tiDJxi6M.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/4.tiDJxi6M.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/5.MzfJoePg.js +6 -0
- package/dist/ui/client/ui/_app/immutable/nodes/5.MzfJoePg.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/5.MzfJoePg.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/6.bNZhqiRK.js +6 -0
- package/dist/ui/client/ui/_app/immutable/nodes/6.bNZhqiRK.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/6.bNZhqiRK.js.gz +0 -0
- package/dist/ui/client/ui/_app/version.json +1 -0
- package/dist/ui/client/ui/_app/version.json.br +0 -0
- package/dist/ui/client/ui/_app/version.json.gz +0 -0
- package/dist/ui/client/ui/robots.txt +3 -0
- package/dist/ui/client/ui/robots.txt.br +0 -0
- package/dist/ui/client/ui/robots.txt.gz +0 -0
- package/dist/ui/handler.js +1 -0
- package/dist/ui/index.js +1 -0
- package/dist/ui/server/.vite/manifest.json +761 -0
- package/dist/ui/server/_app/immutable/assets/ExternalLink.CYXazpKA.css +1 -0
- package/dist/ui/server/_app/immutable/assets/Pane.Dgdg5KMw.css +1 -0
- package/dist/ui/server/_app/immutable/assets/_layout.DSVNnDlO.css +1 -0
- package/dist/ui/server/_app/immutable/assets/_layout.ONZWQgDA.css +1 -0
- package/dist/ui/server/_app/immutable/assets/_page.C0Nhvs_m.css +1 -0
- package/dist/ui/server/_app/immutable/assets/_page.DyY1vjRV.css +1 -0
- package/dist/ui/server/_app/immutable/assets/_page.WduKm4aT.css +1 -0
- package/dist/ui/server/_app/immutable/assets/_page.YyxFzHED.css +1 -0
- package/dist/ui/server/_app/immutable/assets/material-symbols-outlined-latin-400-normal.BhEvR8fk.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-flex-cyrillic-ext-opsz-normal.nDQikIyu.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-flex-cyrillic-opsz-normal.SjuC5rw5.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-flex-greek-opsz-normal.C14fFRny.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-flex-latin-ext-opsz-normal.xNclTVCo.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-flex-latin-opsz-normal.hy8fyBBC.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-flex-vietnamese-opsz-normal.C-H_yGOU.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-cyrillic-400-normal.B3hIXASd.woff +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-cyrillic-400-normal.C-_K-ZCn.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-cyrillic-500-normal.DGZ7-lUP.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-cyrillic-500-normal.NpUJFYX7.woff +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-cyrillic-ext-400-normal.BHxv52bw.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-cyrillic-ext-400-normal.W26xs1TL.woff +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-cyrillic-ext-500-normal.6xdwlG7p.woff +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-cyrillic-ext-500-normal.DC57U9n8.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-greek-400-normal.CH_u3Aru.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-greek-400-normal.P8xe1gs1.woff +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-greek-500-normal.C2M8jX6G.woff +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-greek-500-normal.DpRFkptA.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-latin-400-normal.DBZPkcnn.woff +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-latin-400-normal.GekRknry.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-latin-500-normal.D6j6AMzd.woff +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-latin-500-normal.pxIOXZmA.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-latin-ext-400-normal.BwLXVYNz.woff +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-latin-ext-400-normal.DLAV9S_w.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-latin-ext-500-normal.B1IjfbhL.woff +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-latin-ext-500-normal.Db3ge6Oe.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-vietnamese-400-normal.CzWHQABp.woff +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-vietnamese-400-normal.yYTFiTTs.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-vietnamese-500-normal.Cq-quQMu.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-vietnamese-500-normal.IxzxMIj7.woff +0 -0
- package/dist/ui/server/adapter-env.js +1 -0
- package/dist/ui/server/adapter-index.js +73 -0
- package/dist/ui/server/adapter-index.js.map +1 -0
- package/dist/ui/server/adapter-node-env.js +63 -0
- package/dist/ui/server/adapter-node-env.js.map +1 -0
- package/dist/ui/server/adapter-node-handler.js +638 -0
- package/dist/ui/server/adapter-node-handler.js.map +1 -0
- package/dist/ui/server/chunks/ExternalLink.js +12 -0
- package/dist/ui/server/chunks/ExternalLink.js.map +1 -0
- package/dist/ui/server/chunks/Pane.js +13 -0
- package/dist/ui/server/chunks/Pane.js.map +1 -0
- package/dist/ui/server/chunks/composition.js +3468 -0
- package/dist/ui/server/chunks/composition.js.map +1 -0
- package/dist/ui/server/chunks/config-state.js +21 -0
- package/dist/ui/server/chunks/config-state.js.map +1 -0
- package/dist/ui/server/chunks/config.js +145 -0
- package/dist/ui/server/chunks/config.js.map +1 -0
- package/dist/ui/server/chunks/dialog.js +592 -0
- package/dist/ui/server/chunks/dialog.js.map +1 -0
- package/dist/ui/server/chunks/exports.js +352 -0
- package/dist/ui/server/chunks/exports.js.map +1 -0
- package/dist/ui/server/chunks/filled-button.js +116 -0
- package/dist/ui/server/chunks/filled-button.js.map +1 -0
- package/dist/ui/server/chunks/functions.js +29 -0
- package/dist/ui/server/chunks/functions.js.map +1 -0
- package/dist/ui/server/chunks/icon-button.js +234 -0
- package/dist/ui/server/chunks/icon-button.js.map +1 -0
- package/dist/ui/server/chunks/icon.js +49 -0
- package/dist/ui/server/chunks/icon.js.map +1 -0
- package/dist/ui/server/chunks/index-server.js +6 -0
- package/dist/ui/server/chunks/index-server.js.map +1 -0
- package/dist/ui/server/chunks/instance.js +3577 -0
- package/dist/ui/server/chunks/instance.js.map +1 -0
- package/dist/ui/server/chunks/internal.js +3577 -0
- package/dist/ui/server/chunks/internal.js.map +1 -0
- package/dist/ui/server/chunks/navigation.js +11 -0
- package/dist/ui/server/chunks/navigation.js.map +1 -0
- package/dist/ui/server/chunks/navigation2.js +15 -0
- package/dist/ui/server/chunks/navigation2.js.map +1 -0
- package/dist/ui/server/chunks/outlined-text-field.js +1477 -0
- package/dist/ui/server/chunks/outlined-text-field.js.map +1 -0
- package/dist/ui/server/chunks/paths.js +2 -0
- package/dist/ui/server/chunks/redispatch-event.js +91 -0
- package/dist/ui/server/chunks/redispatch-event.js.map +1 -0
- package/dist/ui/server/chunks/remote-1j2tn2d.js +4 -0
- package/dist/ui/server/chunks/remote.js +1580 -0
- package/dist/ui/server/chunks/remote.js.map +1 -0
- package/dist/ui/server/chunks/scope.js +13 -0
- package/dist/ui/server/chunks/scope.js.map +1 -0
- package/dist/ui/server/chunks/server-errors.js +471 -0
- package/dist/ui/server/chunks/server-errors.js.map +1 -0
- package/dist/ui/server/chunks/server.js +8 -0
- package/dist/ui/server/chunks/server.js.map +1 -0
- package/dist/ui/server/chunks/server2.js +1960 -0
- package/dist/ui/server/chunks/server2.js.map +1 -0
- package/dist/ui/server/chunks/sessions.js +65 -0
- package/dist/ui/server/chunks/sessions.js.map +1 -0
- package/dist/ui/server/chunks/sessions.remote.js +56 -0
- package/dist/ui/server/chunks/sessions.remote.js.map +1 -0
- package/dist/ui/server/chunks/shared-errors.js +198 -0
- package/dist/ui/server/chunks/shared-errors.js.map +1 -0
- package/dist/ui/server/chunks/shared.js +85 -0
- package/dist/ui/server/chunks/shared.js.map +1 -0
- package/dist/ui/server/chunks/src.js +1217 -0
- package/dist/ui/server/chunks/src.js.map +1 -0
- package/dist/ui/server/chunks/state.js +38 -0
- package/dist/ui/server/chunks/state.js.map +1 -0
- package/dist/ui/server/chunks/static-html.js +38 -0
- package/dist/ui/server/chunks/static-html.js.map +1 -0
- package/dist/ui/server/chunks/text-button.js +307 -0
- package/dist/ui/server/chunks/text-button.js.map +1 -0
- package/dist/ui/server/entries/endpoints/api/config/_server.ts.js +19 -0
- package/dist/ui/server/entries/endpoints/api/config/_server.ts.js.map +1 -0
- package/dist/ui/server/entries/endpoints/api/input/keys/_server.ts.js +14 -0
- package/dist/ui/server/entries/endpoints/api/input/keys/_server.ts.js.map +1 -0
- package/dist/ui/server/entries/endpoints/api/markers/_server.ts.js +13 -0
- package/dist/ui/server/entries/endpoints/api/markers/_server.ts.js.map +1 -0
- package/dist/ui/server/entries/endpoints/api/sessions/_id_id_/_server.ts.js +12 -0
- package/dist/ui/server/entries/endpoints/api/sessions/_id_id_/_server.ts.js.map +1 -0
- package/dist/ui/server/entries/endpoints/api/sessions/_server.ts.js +13 -0
- package/dist/ui/server/entries/endpoints/api/sessions/_server.ts.js.map +1 -0
- package/dist/ui/server/entries/endpoints/api/sessions/end/_server.ts.js +9 -0
- package/dist/ui/server/entries/endpoints/api/sessions/end/_server.ts.js.map +1 -0
- package/dist/ui/server/entries/endpoints/api/speech/_server.ts.js +25 -0
- package/dist/ui/server/entries/endpoints/api/speech/_server.ts.js.map +1 -0
- package/dist/ui/server/entries/endpoints/api/speech/stream/_server.ts.js +19 -0
- package/dist/ui/server/entries/endpoints/api/speech/stream/_server.ts.js.map +1 -0
- package/dist/ui/server/entries/endpoints/api/status/_server.ts.js +9 -0
- package/dist/ui/server/entries/endpoints/api/status/_server.ts.js.map +1 -0
- package/dist/ui/server/entries/hooks.server.js +161 -0
- package/dist/ui/server/entries/hooks.server.js.map +1 -0
- package/dist/ui/server/entries/pages/_error.svelte.js +16 -0
- package/dist/ui/server/entries/pages/_error.svelte.js.map +1 -0
- package/dist/ui/server/entries/pages/_layout.server.ts.js +17 -0
- package/dist/ui/server/entries/pages/_layout.server.ts.js.map +1 -0
- package/dist/ui/server/entries/pages/_layout.svelte.js +175 -0
- package/dist/ui/server/entries/pages/_layout.svelte.js.map +1 -0
- package/dist/ui/server/entries/pages/_page.server.ts.js +18 -0
- package/dist/ui/server/entries/pages/_page.server.ts.js.map +1 -0
- package/dist/ui/server/entries/pages/_page.svelte.js +444 -0
- package/dist/ui/server/entries/pages/_page.svelte.js.map +1 -0
- package/dist/ui/server/entries/pages/settings/_page.server.ts.js +12 -0
- package/dist/ui/server/entries/pages/settings/_page.server.ts.js.map +1 -0
- package/dist/ui/server/entries/pages/settings/_page.svelte.js +3531 -0
- package/dist/ui/server/entries/pages/settings/_page.svelte.js.map +1 -0
- package/dist/ui/server/entries/pages/setup/_layout.svelte.js +51 -0
- package/dist/ui/server/entries/pages/setup/_layout.svelte.js.map +1 -0
- package/dist/ui/server/entries/pages/setup/_page.svelte.js +230 -0
- package/dist/ui/server/entries/pages/setup/_page.svelte.js.map +1 -0
- package/dist/ui/server/entries/pages/setup/instructions/_page.server.ts.js +12 -0
- package/dist/ui/server/entries/pages/setup/instructions/_page.server.ts.js.map +1 -0
- package/dist/ui/server/entries/pages/setup/instructions/_page.svelte.js +271 -0
- package/dist/ui/server/entries/pages/setup/instructions/_page.svelte.js.map +1 -0
- package/dist/ui/server/entries/params.js +60 -0
- package/dist/ui/server/entries/params.js.map +1 -0
- package/dist/ui/server/env.js +1 -0
- package/dist/ui/server/handler.js +1 -0
- package/dist/ui/server/index.js +67 -0
- package/dist/ui/server/index.js.map +1 -0
- package/dist/ui/server/manifest-full.js +126 -0
- package/dist/ui/server/manifest.js +126 -0
- package/dist/ui/server/nodes/0.js +10 -0
- package/dist/ui/server/nodes/1.js +8 -0
- package/dist/ui/server/nodes/2.js +8 -0
- package/dist/ui/server/nodes/3.js +10 -0
- package/dist/ui/server/nodes/4.js +10 -0
- package/dist/ui/server/nodes/5.js +8 -0
- package/dist/ui/server/nodes/6.js +10 -0
- package/dist/ui/server/remote-entry.js +1 -0
- package/dist/ui/server/server.js +128 -0
- package/package.json +39 -3
|
@@ -0,0 +1,3577 @@
|
|
|
1
|
+
import { _ as route_param_slash, a as form_field_too_many_gaps, d as param_matcher_async, f as param_matcher_result_invalid, g as route_param_missing, h as resolve_url_input, i as form_field_invalid_name, m as resolve_params_missing, n as form_field_duplicate, o as form_field_unbound, p as remote_argument_unsupported, r as form_field_forbidden_key, t as form_field_array_conflict, v as route_param_value_invalid } from "./shared-errors.js";
|
|
2
|
+
import { a as SvelteKitError, i as Redirect, n as HandledHttpError, o as ValidationError, r as HttpError, t as ActionFailure } from "./shared.js";
|
|
3
|
+
import { f as merge_tracing, g as with_request_store, h as try_get_request_store, i as text, s as has_scheme_or_authority, t as error, v as ENDPOINT_METHODS } from "./exports.js";
|
|
4
|
+
import { Y as capture_error, a as action_throw_fail, f as handle_error_hook_failed, g as load_not_serializable, h as load_not_plain_object, i as action_response_not_serializable, n as action_default_with_named, r as action_name_reserved, t as action_data_not_serializable } from "./server-errors.js";
|
|
5
|
+
import { n as noop } from "./functions.js";
|
|
6
|
+
var assets = "/ui";
|
|
7
|
+
var app_dir = "_app";
|
|
8
|
+
/** @param {string} path */
|
|
9
|
+
function set_assets(path) {
|
|
10
|
+
assets = path;
|
|
11
|
+
}
|
|
12
|
+
// ../../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/dev.js
|
|
13
|
+
var symbol = Symbol.for("sveltekit.global_state");
|
|
14
|
+
globalThis[symbol] ??= {};
|
|
15
|
+
// ../../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/utils.js
|
|
16
|
+
var text_encoder = new TextEncoder();
|
|
17
|
+
/**
|
|
18
|
+
* `ReadableStream.from`, for runtimes that don't support it (as of writing, every Bun release)
|
|
19
|
+
* @template T
|
|
20
|
+
* @param {AsyncIterable<T>} iterable
|
|
21
|
+
* @returns {ReadableStream<T>}
|
|
22
|
+
*/
|
|
23
|
+
function stream_from_iterable(iterable) {
|
|
24
|
+
if (ReadableStream.from) return ReadableStream.from(iterable);
|
|
25
|
+
const iterator = iterable[Symbol.asyncIterator]();
|
|
26
|
+
return new ReadableStream({
|
|
27
|
+
async pull(controller) {
|
|
28
|
+
const { value, done } = await iterator.next();
|
|
29
|
+
if (done) controller.close();
|
|
30
|
+
else controller.enqueue(value);
|
|
31
|
+
},
|
|
32
|
+
async cancel(reason) {
|
|
33
|
+
await iterator.return?.(reason);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @param {string} head
|
|
39
|
+
* @param {AsyncIterable<string>} chunks
|
|
40
|
+
* @returns {ReadableStream<Uint8Array>} `head` followed by each non-empty chunk, encoded
|
|
41
|
+
*/
|
|
42
|
+
function stream_text(head, chunks) {
|
|
43
|
+
return stream_from_iterable((async function* () {
|
|
44
|
+
yield text_encoder.encode(head);
|
|
45
|
+
for await (const chunk of chunks) if (chunk) yield text_encoder.encode(chunk);
|
|
46
|
+
})());
|
|
47
|
+
}
|
|
48
|
+
var text_decoder = new TextDecoder();
|
|
49
|
+
/**
|
|
50
|
+
* @param {Uint8Array} bytes
|
|
51
|
+
* @returns {string}
|
|
52
|
+
*/
|
|
53
|
+
function base64_encode(bytes) {
|
|
54
|
+
if (globalThis.Buffer) return globalThis.Buffer.from(bytes).toString("base64");
|
|
55
|
+
let binary = "";
|
|
56
|
+
for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);
|
|
57
|
+
return btoa(binary);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* @param {string} encoded
|
|
61
|
+
* @returns {Uint8Array}
|
|
62
|
+
*/
|
|
63
|
+
function base64_decode(encoded) {
|
|
64
|
+
if (globalThis.Buffer) {
|
|
65
|
+
const buffer = globalThis.Buffer.from(encoded, "base64");
|
|
66
|
+
return new Uint8Array(buffer);
|
|
67
|
+
}
|
|
68
|
+
const binary = atob(encoded);
|
|
69
|
+
const bytes = new Uint8Array(binary.length);
|
|
70
|
+
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
71
|
+
return bytes;
|
|
72
|
+
}
|
|
73
|
+
// ../../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/pathname.js
|
|
74
|
+
var DATA_SUFFIX = "/__data.json";
|
|
75
|
+
var HTML_DATA_SUFFIX = ".html__data.json";
|
|
76
|
+
/** @param {string} pathname */
|
|
77
|
+
function has_data_suffix(pathname) {
|
|
78
|
+
return pathname.endsWith(DATA_SUFFIX) || pathname.endsWith(HTML_DATA_SUFFIX);
|
|
79
|
+
}
|
|
80
|
+
/** @param {string} pathname */
|
|
81
|
+
function add_data_suffix(pathname) {
|
|
82
|
+
if (pathname.endsWith(".html")) return pathname.replace(/\.html$/, HTML_DATA_SUFFIX);
|
|
83
|
+
return pathname.replace(/\/$/, "") + DATA_SUFFIX;
|
|
84
|
+
}
|
|
85
|
+
/** @param {string} pathname */
|
|
86
|
+
function strip_data_suffix(pathname) {
|
|
87
|
+
if (pathname.endsWith(HTML_DATA_SUFFIX)) return pathname.slice(0, -16) + ".html";
|
|
88
|
+
return pathname.slice(0, -12);
|
|
89
|
+
}
|
|
90
|
+
var ROUTE_SUFFIX = "/__route.js";
|
|
91
|
+
var HTML_ROUTE_SUFFIX = ".html__route.js";
|
|
92
|
+
/**
|
|
93
|
+
* @param {string} pathname
|
|
94
|
+
* @returns {boolean}
|
|
95
|
+
*/
|
|
96
|
+
function has_resolution_suffix(pathname) {
|
|
97
|
+
return pathname.endsWith(ROUTE_SUFFIX) || pathname.endsWith(HTML_ROUTE_SUFFIX);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Convert a regular URL to a route to send to SvelteKit's server-side route resolution endpoint
|
|
101
|
+
* @param {string} pathname
|
|
102
|
+
* @returns {string}
|
|
103
|
+
*/
|
|
104
|
+
function add_resolution_suffix(pathname) {
|
|
105
|
+
if (pathname.endsWith(".html")) return pathname.replace(/\.html$/, HTML_ROUTE_SUFFIX);
|
|
106
|
+
return pathname.replace(/\/$/, "") + ROUTE_SUFFIX;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* @param {string} pathname
|
|
110
|
+
* @returns {string}
|
|
111
|
+
*/
|
|
112
|
+
function strip_resolution_suffix(pathname) {
|
|
113
|
+
if (pathname.endsWith(HTML_ROUTE_SUFFIX)) return pathname.slice(0, -15) + ".html";
|
|
114
|
+
return pathname.slice(0, -11);
|
|
115
|
+
}
|
|
116
|
+
// ../../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/telemetry.js
|
|
117
|
+
/** @import { Span, SpanContext } from '@opentelemetry/api' */
|
|
118
|
+
/**
|
|
119
|
+
* @type {Span}
|
|
120
|
+
*/
|
|
121
|
+
var noop_span = {
|
|
122
|
+
spanContext() {
|
|
123
|
+
return noop_span_context;
|
|
124
|
+
},
|
|
125
|
+
setAttribute() {
|
|
126
|
+
return this;
|
|
127
|
+
},
|
|
128
|
+
setAttributes() {
|
|
129
|
+
return this;
|
|
130
|
+
},
|
|
131
|
+
addEvent() {
|
|
132
|
+
return this;
|
|
133
|
+
},
|
|
134
|
+
setStatus() {
|
|
135
|
+
return this;
|
|
136
|
+
},
|
|
137
|
+
updateName() {
|
|
138
|
+
return this;
|
|
139
|
+
},
|
|
140
|
+
end() {
|
|
141
|
+
return this;
|
|
142
|
+
},
|
|
143
|
+
isRecording() {
|
|
144
|
+
return false;
|
|
145
|
+
},
|
|
146
|
+
recordException() {
|
|
147
|
+
return this;
|
|
148
|
+
},
|
|
149
|
+
addLink() {
|
|
150
|
+
return this;
|
|
151
|
+
},
|
|
152
|
+
addLinks() {
|
|
153
|
+
return this;
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* @type {SpanContext}
|
|
158
|
+
*/
|
|
159
|
+
var noop_span_context = {
|
|
160
|
+
traceId: "",
|
|
161
|
+
spanId: "",
|
|
162
|
+
traceFlags: 0
|
|
163
|
+
};
|
|
164
|
+
// ../../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/exports/internal/server/telemetry.js
|
|
165
|
+
/** @import { Tracer, SpanStatusCode, PropagationAPI, ContextAPI } from '@opentelemetry/api' */
|
|
166
|
+
/** @import { RecordSpan } from 'types' */
|
|
167
|
+
/** @type {Promise<{ tracer: Tracer, SpanStatusCode: typeof SpanStatusCode, propagation: PropagationAPI, context: ContextAPI }> | null} */
|
|
168
|
+
var otel = null;
|
|
169
|
+
/** @type {RecordSpan} */
|
|
170
|
+
async function record_span({ name, attributes, fn }) {
|
|
171
|
+
if (otel === null) return fn(noop_span);
|
|
172
|
+
const { SpanStatusCode, tracer } = await otel;
|
|
173
|
+
return tracer.startActiveSpan(name, { attributes }, async (span) => {
|
|
174
|
+
try {
|
|
175
|
+
return await fn(span);
|
|
176
|
+
} catch (error) {
|
|
177
|
+
if (error instanceof HttpError) {
|
|
178
|
+
span.setAttributes({
|
|
179
|
+
[`${name}.result.type`]: "known_error",
|
|
180
|
+
[`${name}.result.status`]: error.status,
|
|
181
|
+
[`${name}.result.message`]: error.body.message
|
|
182
|
+
});
|
|
183
|
+
if (error.status >= 500) {
|
|
184
|
+
span.recordException({
|
|
185
|
+
name: "HttpError",
|
|
186
|
+
message: error.body.message
|
|
187
|
+
});
|
|
188
|
+
span.setStatus({
|
|
189
|
+
code: SpanStatusCode.ERROR,
|
|
190
|
+
message: error.body.message
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
} else if (error instanceof Redirect) span.setAttributes({
|
|
194
|
+
[`${name}.result.type`]: "redirect",
|
|
195
|
+
[`${name}.result.status`]: error.status,
|
|
196
|
+
[`${name}.result.location`]: error.location
|
|
197
|
+
});
|
|
198
|
+
else if (error instanceof Error) {
|
|
199
|
+
span.setAttributes({ [`${name}.result.type`]: "unknown_error" });
|
|
200
|
+
span.recordException({
|
|
201
|
+
name: error.name,
|
|
202
|
+
message: error.message,
|
|
203
|
+
...error.stack !== void 0 && { stack: error.stack }
|
|
204
|
+
});
|
|
205
|
+
span.setStatus({
|
|
206
|
+
code: SpanStatusCode.ERROR,
|
|
207
|
+
message: error.message
|
|
208
|
+
});
|
|
209
|
+
} else {
|
|
210
|
+
span.setAttributes({ [`${name}.result.type`]: "unknown_error" });
|
|
211
|
+
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
212
|
+
}
|
|
213
|
+
throw error;
|
|
214
|
+
} finally {
|
|
215
|
+
span.end();
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
// ../../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/routing.js
|
|
220
|
+
/** @import { ParamMatcher, ParamValue } from '@sveltejs/kit/params' */
|
|
221
|
+
var escape_sequence_pattern = /\[([ux])\+([^\]]+)\]/;
|
|
222
|
+
/**
|
|
223
|
+
* Decodes the codepoints of an `[x+nn]` or `[u+nnnn]` escape sequence
|
|
224
|
+
* @param {string} code the sequence without its `[x+`/`[u+` prefix or `]` suffix
|
|
225
|
+
*/
|
|
226
|
+
function decode_escape_sequence(code) {
|
|
227
|
+
return String.fromCodePoint(...code.split("-").map((codepoint) => parseInt(codepoint, 16)));
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Encodes the characters that `decode_pathname` leaves untouched, so that a decoded
|
|
231
|
+
* escape sequence still matches the pattern `parse_route_id` builds for it
|
|
232
|
+
* @param {string} str
|
|
233
|
+
*/
|
|
234
|
+
function encode_pathname_chars(str) {
|
|
235
|
+
return str.replace(/[%/?#]/g, (char) => "%" + char.charCodeAt(0).toString(16).toUpperCase().padStart(2, "0"));
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Returns `false` for `(group)` segments
|
|
239
|
+
* @param {string} segment
|
|
240
|
+
*/
|
|
241
|
+
function affects_path(segment) {
|
|
242
|
+
return segment !== "" && !/^\([^)]+\)$/.test(segment);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Splits a route id into its segments, removing segments that
|
|
246
|
+
* don't affect the path (i.e. groups). The root route is represented by `/`
|
|
247
|
+
* and will be returned as `['']`.
|
|
248
|
+
* @param {string} route
|
|
249
|
+
* @returns string[]
|
|
250
|
+
*/
|
|
251
|
+
function get_route_segments(route) {
|
|
252
|
+
return route.slice(1).split("/").filter(affects_path);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* @param {ParamMatcher} matcher
|
|
256
|
+
* @param {string} value
|
|
257
|
+
* @returns {{ success: true, value: any } | { success: false }}
|
|
258
|
+
*/
|
|
259
|
+
function run_matcher(matcher, value) {
|
|
260
|
+
const result = matcher["~standard"].validate(value);
|
|
261
|
+
if (result instanceof Promise) param_matcher_async();
|
|
262
|
+
if (result.issues) return { success: false };
|
|
263
|
+
const parsed = result.value;
|
|
264
|
+
if (typeof parsed !== "string" && typeof parsed !== "number" && typeof parsed !== "boolean" && typeof parsed !== "bigint") param_matcher_result_invalid();
|
|
265
|
+
return {
|
|
266
|
+
success: true,
|
|
267
|
+
value: parsed
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* @param {RegExpMatchArray} match
|
|
272
|
+
* @param {import('types').RouteParam[]} params
|
|
273
|
+
* @param {Record<string, ParamMatcher>} matchers
|
|
274
|
+
*/
|
|
275
|
+
function exec(match, params, matchers) {
|
|
276
|
+
/** @type {Record<string, any>} */
|
|
277
|
+
const result = {};
|
|
278
|
+
const values = match.slice(1);
|
|
279
|
+
const values_needing_match = values.filter((value) => value !== void 0);
|
|
280
|
+
let buffered = 0;
|
|
281
|
+
for (let i = 0; i < params.length; i += 1) {
|
|
282
|
+
const param = params[i];
|
|
283
|
+
let value = values[i - buffered];
|
|
284
|
+
if (param.chained && param.rest && buffered) {
|
|
285
|
+
value = values.slice(i - buffered, i + 1).filter((s) => s).join("/");
|
|
286
|
+
buffered = 0;
|
|
287
|
+
}
|
|
288
|
+
if (value === void 0) {
|
|
289
|
+
if (param.rest) value = "";
|
|
290
|
+
else continue;
|
|
291
|
+
}
|
|
292
|
+
const decoded = decodeURIComponent(value);
|
|
293
|
+
if (param.matcher) {
|
|
294
|
+
const outcome = run_matcher(matchers[param.matcher], decoded);
|
|
295
|
+
if (!outcome.success) {
|
|
296
|
+
if (param.optional && param.chained) {
|
|
297
|
+
buffered++;
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
result[param.name] = outcome.value;
|
|
303
|
+
} else result[param.name] = decoded;
|
|
304
|
+
const next_param = params[i + 1];
|
|
305
|
+
const next_value = values[i + 1];
|
|
306
|
+
if (next_param && !next_param.rest && next_param.optional && next_value && param.chained) buffered = 0;
|
|
307
|
+
if (!next_param && !next_value && Object.keys(result).length === values_needing_match.length) buffered = 0;
|
|
308
|
+
}
|
|
309
|
+
if (buffered) return;
|
|
310
|
+
return result;
|
|
311
|
+
}
|
|
312
|
+
var segment_pattern = new RegExp(`${escape_sequence_pattern.source}|${/\[(\[)?(\.\.\.)?([\w-]+?)(?:=([\w-]+))?\]\]?/g.source}`, "g");
|
|
313
|
+
/**
|
|
314
|
+
* Populate a route ID with params to resolve a pathname.
|
|
315
|
+
* @example
|
|
316
|
+
* ```js
|
|
317
|
+
* resolveRoute(
|
|
318
|
+
* `/blog/[slug]/[...somethingElse]`,
|
|
319
|
+
* {
|
|
320
|
+
* slug: 'hello-world',
|
|
321
|
+
* somethingElse: 'something/else'
|
|
322
|
+
* }
|
|
323
|
+
* ); // `/blog/hello-world/something/else`
|
|
324
|
+
* ```
|
|
325
|
+
* @param {string} id
|
|
326
|
+
* @param {Record<string, ParamValue | undefined>} [params]
|
|
327
|
+
* @returns {string}
|
|
328
|
+
*/
|
|
329
|
+
function resolve_route(id, params) {
|
|
330
|
+
const [route, suffix = ""] = id.split(/([?#].*)/s);
|
|
331
|
+
const segments = get_route_segments(route);
|
|
332
|
+
const has_trailing_slash = route.endsWith("/");
|
|
333
|
+
const resolved = "/" + segments.map((segment) => segment.replace(segment_pattern, (_, escape_type, escape_code, optional, rest, name) => {
|
|
334
|
+
if (escape_type) return encode_pathname_chars(decode_escape_sequence(escape_code));
|
|
335
|
+
if (!params) resolve_params_missing({ id });
|
|
336
|
+
const value = params[name];
|
|
337
|
+
if (value === void 0 || value === "") {
|
|
338
|
+
if (optional) return "";
|
|
339
|
+
if (rest && value !== void 0) return "";
|
|
340
|
+
route_param_missing({
|
|
341
|
+
name,
|
|
342
|
+
id
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
if (typeof value === "string") {
|
|
346
|
+
if (value.startsWith("/") || value.endsWith("/")) route_param_slash({
|
|
347
|
+
name,
|
|
348
|
+
id
|
|
349
|
+
});
|
|
350
|
+
return value;
|
|
351
|
+
}
|
|
352
|
+
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return String(value);
|
|
353
|
+
route_param_value_invalid({
|
|
354
|
+
name,
|
|
355
|
+
id
|
|
356
|
+
});
|
|
357
|
+
})).filter(Boolean).join("/");
|
|
358
|
+
return resolved + (has_trailing_slash && resolved !== "/" ? "/" : "") + suffix;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Find the first route that matches the given path
|
|
362
|
+
* @template {{pattern: RegExp, params: import('types').RouteParam[]}} Route
|
|
363
|
+
* @param {string} path - The decoded pathname to match
|
|
364
|
+
* @param {Route[]} routes
|
|
365
|
+
* @param {Record<string, ParamMatcher>} matchers
|
|
366
|
+
* @returns {{ route: Route, params: Record<string, any> } | null}
|
|
367
|
+
*/
|
|
368
|
+
function find_route(path, routes, matchers) {
|
|
369
|
+
for (const route of routes) {
|
|
370
|
+
const match = route.pattern.exec(path);
|
|
371
|
+
if (!match) continue;
|
|
372
|
+
const matched = exec(match, route.params, matchers);
|
|
373
|
+
if (matched) return {
|
|
374
|
+
route,
|
|
375
|
+
params: matched
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
return null;
|
|
379
|
+
}
|
|
380
|
+
// .svelte-kit/generated/build/shared/error-template.js
|
|
381
|
+
var error_template_default = ({ status, message }) => "<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>" + message + "</title>\n\n <style>\n body {\n --bg: white;\n --fg: #222;\n --divider: #ccc;\n background: var(--bg);\n color: var(--fg);\n font-family:\n system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,\n Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100vh;\n margin: 0;\n }\n\n .error {\n display: flex;\n align-items: center;\n max-width: 32rem;\n margin: 0 1rem;\n }\n\n .status {\n font-weight: 200;\n font-size: 3rem;\n line-height: 1;\n position: relative;\n top: -0.05rem;\n }\n\n .message {\n border-left: 1px solid var(--divider);\n padding: 0 0 0 1rem;\n margin: 0 0 0 1rem;\n min-height: 2.5rem;\n display: flex;\n align-items: center;\n }\n\n .message h1 {\n font-weight: 400;\n font-size: 1em;\n margin: 0;\n }\n\n @media (prefers-color-scheme: dark) {\n body {\n --bg: #222;\n --fg: #ddd;\n --divider: #666;\n }\n }\n </style>\n </head>\n <body>\n <div class=\"error\">\n <span class=\"status\">" + status + "</span>\n <div class=\"message\">\n <h1>" + message + "</h1>\n </div>\n </div>\n </body>\n</html>\n";
|
|
382
|
+
// .svelte-kit/generated/build/server.js
|
|
383
|
+
var options = {
|
|
384
|
+
app_template_contains_nonce: true,
|
|
385
|
+
csp: {
|
|
386
|
+
"mode": "auto",
|
|
387
|
+
"directives": {
|
|
388
|
+
"default-src": ["self"],
|
|
389
|
+
"connect-src": ["self"],
|
|
390
|
+
"font-src": ["self"],
|
|
391
|
+
"img-src": ["self", "data:"],
|
|
392
|
+
"object-src": ["none"],
|
|
393
|
+
"script-src": ["self"],
|
|
394
|
+
"style-src": ["self", "unsafe-inline"],
|
|
395
|
+
"base-uri": ["self"],
|
|
396
|
+
"form-action": ["self"],
|
|
397
|
+
"frame-ancestors": ["none"],
|
|
398
|
+
"upgrade-insecure-requests": false,
|
|
399
|
+
"block-all-mixed-content": false
|
|
400
|
+
},
|
|
401
|
+
"reportOnly": {
|
|
402
|
+
"upgrade-insecure-requests": false,
|
|
403
|
+
"block-all-mixed-content": false
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
csrf_trusted_origins: [],
|
|
407
|
+
service_worker_options: void 0,
|
|
408
|
+
templates: {
|
|
409
|
+
app: ({ head, body, assets, nonce, env }) => "<!doctype html>\n<html lang=\"en\" translate=\"no\" data-theme=\"light\">\n <head>\n <meta charset=\"utf-8\" />\n <meta name=\"google\" content=\"notranslate\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <meta name=\"text-scale\" content=\"scale\" />\n <script nonce=\"" + nonce + "\">\n // Apply the saved theme before the first paint (no flash). Light is the default.\n try {\n var themes = ['light', 'dark', 'high-contrast', 'dark-high-contrast'];\n var saved = localStorage.getItem('sr-theme');\n document.documentElement.dataset.theme = themes.indexOf(saved) >= 0 ? saved : 'light';\n } catch {}\n <\/script>\n " + head + "\n </head>\n <body data-sveltekit-preload-data=\"hover\">\n <div style=\"display: contents\">" + body + "</div>\n </body>\n</html>\n",
|
|
410
|
+
error: error_template_default
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
async function get_hooks() {
|
|
414
|
+
let handle;
|
|
415
|
+
let handleFetch;
|
|
416
|
+
let handleError;
|
|
417
|
+
let init;
|
|
418
|
+
({handle, handleFetch, handleError, init} = await import("../entries/hooks.server.js"));
|
|
419
|
+
let reroute;
|
|
420
|
+
let transport;
|
|
421
|
+
return {
|
|
422
|
+
handle,
|
|
423
|
+
handleFetch,
|
|
424
|
+
handleError,
|
|
425
|
+
init,
|
|
426
|
+
reroute,
|
|
427
|
+
transport
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
// ../../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/app/paths/server.js
|
|
431
|
+
/** @type {typeof import('./client.js').resolve} */
|
|
432
|
+
function resolve(id, params) {
|
|
433
|
+
if (has_scheme_or_authority(id)) resolve_url_input({ id });
|
|
434
|
+
let resolved;
|
|
435
|
+
if (id[0] === "/") resolved = resolve_route(id, params);
|
|
436
|
+
else resolved = "/" + id;
|
|
437
|
+
return prefix_path(resolved);
|
|
438
|
+
}
|
|
439
|
+
/** @param {string} resolved */
|
|
440
|
+
function prefix_path(resolved) {
|
|
441
|
+
{
|
|
442
|
+
const store = try_get_request_store();
|
|
443
|
+
if (store && !store.state.prerendering?.fallback) return (store.event.url.pathname.slice(3).split("/").slice(2).map(() => "..").join("/") || ".") + resolved;
|
|
444
|
+
}
|
|
445
|
+
return "/ui" + resolved;
|
|
446
|
+
}
|
|
447
|
+
// ../../node_modules/.pnpm/devalue@5.9.4/node_modules/devalue/src/constants.js
|
|
448
|
+
var MAX_ARRAY_LEN = 2 ** 32 - 1;
|
|
449
|
+
var MAX_ARRAY_INDEX$1 = MAX_ARRAY_LEN - 1;
|
|
450
|
+
// ../../node_modules/.pnpm/devalue@5.9.4/node_modules/devalue/src/utils.js
|
|
451
|
+
/** @type {Record<string, string>} */
|
|
452
|
+
var escaped = {
|
|
453
|
+
"<": "\\u003C",
|
|
454
|
+
"\\": "\\\\",
|
|
455
|
+
"\b": "\\b",
|
|
456
|
+
"\f": "\\f",
|
|
457
|
+
"\n": "\\n",
|
|
458
|
+
"\r": "\\r",
|
|
459
|
+
" ": "\\t",
|
|
460
|
+
"\u2028": "\\u2028",
|
|
461
|
+
"\u2029": "\\u2029"
|
|
462
|
+
};
|
|
463
|
+
var DevalueError = class extends Error {
|
|
464
|
+
/**
|
|
465
|
+
* @param {string} message
|
|
466
|
+
* @param {string[]} keys
|
|
467
|
+
* @param {any} [value] - The value that failed to be serialized
|
|
468
|
+
* @param {any} [root] - The root value being serialized
|
|
469
|
+
*/
|
|
470
|
+
constructor(message, keys, value, root) {
|
|
471
|
+
super(message);
|
|
472
|
+
this.name = "DevalueError";
|
|
473
|
+
this.path = keys.join("");
|
|
474
|
+
this.value = value;
|
|
475
|
+
this.root = root;
|
|
476
|
+
}
|
|
477
|
+
};
|
|
478
|
+
/** @param {any} thing */
|
|
479
|
+
function is_primitive(thing) {
|
|
480
|
+
return thing === null || typeof thing !== "object" && typeof thing !== "function";
|
|
481
|
+
}
|
|
482
|
+
var object_proto_names$1 = /* @__PURE__ */ Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
|
|
483
|
+
/** @param {any} thing */
|
|
484
|
+
function is_plain_object$1(thing) {
|
|
485
|
+
const proto = Object.getPrototypeOf(thing);
|
|
486
|
+
return proto === Object.prototype || proto === null || Object.getPrototypeOf(proto) === null || Object.getOwnPropertyNames(proto).sort().join("\0") === object_proto_names$1;
|
|
487
|
+
}
|
|
488
|
+
/** @param {any} thing */
|
|
489
|
+
function get_type(thing) {
|
|
490
|
+
return Object.prototype.toString.call(thing).slice(8, -1);
|
|
491
|
+
}
|
|
492
|
+
/** @param {any} thing */
|
|
493
|
+
function is_buffer(thing) {
|
|
494
|
+
return typeof Buffer !== "undefined" && Buffer.isBuffer(thing);
|
|
495
|
+
}
|
|
496
|
+
/** @param {string} char */
|
|
497
|
+
function get_escaped_char(char) {
|
|
498
|
+
switch (char) {
|
|
499
|
+
case "\"": return "\\\"";
|
|
500
|
+
case "<": return "\\u003C";
|
|
501
|
+
case "\\": return "\\\\";
|
|
502
|
+
case "\n": return "\\n";
|
|
503
|
+
case "\r": return "\\r";
|
|
504
|
+
case " ": return "\\t";
|
|
505
|
+
case "\b": return "\\b";
|
|
506
|
+
case "\f": return "\\f";
|
|
507
|
+
case "\u2028": return "\\u2028";
|
|
508
|
+
case "\u2029": return "\\u2029";
|
|
509
|
+
default: return char < " " ? `\\u${char.charCodeAt(0).toString(16).padStart(4, "0")}` : "";
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
/** @param {string} str */
|
|
513
|
+
function stringify_string(str) {
|
|
514
|
+
let result = "";
|
|
515
|
+
let last_pos = 0;
|
|
516
|
+
const len = str.length;
|
|
517
|
+
for (let i = 0; i < len; i += 1) {
|
|
518
|
+
const replacement = get_escaped_char(str[i]);
|
|
519
|
+
if (replacement) {
|
|
520
|
+
result += str.slice(last_pos, i) + replacement;
|
|
521
|
+
last_pos = i + 1;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
return `"${last_pos === 0 ? str : result + str.slice(last_pos)}"`;
|
|
525
|
+
}
|
|
526
|
+
/** @param {Record<string | symbol, any>} object */
|
|
527
|
+
function enumerable_symbols(object) {
|
|
528
|
+
return Object.getOwnPropertySymbols(object).filter((symbol) => Object.getOwnPropertyDescriptor(object, symbol).enumerable);
|
|
529
|
+
}
|
|
530
|
+
var is_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
|
|
531
|
+
/** @param {string} key */
|
|
532
|
+
function stringify_key(key) {
|
|
533
|
+
return is_identifier.test(key) ? "." + key : "[" + JSON.stringify(key) + "]";
|
|
534
|
+
}
|
|
535
|
+
/** @param {number} n */
|
|
536
|
+
function is_valid_array_index(n) {
|
|
537
|
+
if (!Number.isInteger(n)) return false;
|
|
538
|
+
if (n < 0) return false;
|
|
539
|
+
if (n > MAX_ARRAY_INDEX$1) return false;
|
|
540
|
+
return true;
|
|
541
|
+
}
|
|
542
|
+
/** @param {number} n */
|
|
543
|
+
function is_valid_array_len(n) {
|
|
544
|
+
if (!Number.isInteger(n)) return false;
|
|
545
|
+
if (n < 0) return false;
|
|
546
|
+
if (n > MAX_ARRAY_LEN) return false;
|
|
547
|
+
return true;
|
|
548
|
+
}
|
|
549
|
+
/** @param {string} s */
|
|
550
|
+
function is_valid_array_index_string(s) {
|
|
551
|
+
if (s.length === 0) return false;
|
|
552
|
+
if (s.length > 1 && s.charCodeAt(0) === 48) return false;
|
|
553
|
+
for (let i = 0; i < s.length; i++) {
|
|
554
|
+
const c = s.charCodeAt(i);
|
|
555
|
+
if (c < 48 || c > 57) return false;
|
|
556
|
+
}
|
|
557
|
+
return is_valid_array_index(+s);
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* Returns the length of the leading run of valid array indices in `keys`.
|
|
561
|
+
* @param {readonly string[]} keys
|
|
562
|
+
*/
|
|
563
|
+
function array_index_cut(keys) {
|
|
564
|
+
for (var i = keys.length - 1; i >= 0; i--) if (is_valid_array_index_string(keys[i])) break;
|
|
565
|
+
return i + 1;
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Finds the populated indices of an array.
|
|
569
|
+
* @param {unknown[]} array
|
|
570
|
+
*/
|
|
571
|
+
function valid_array_indices(array) {
|
|
572
|
+
const keys = Object.keys(array);
|
|
573
|
+
keys.length = array_index_cut(keys);
|
|
574
|
+
return keys;
|
|
575
|
+
}
|
|
576
|
+
// ../../node_modules/.pnpm/devalue@5.9.4/node_modules/devalue/src/uneval.js
|
|
577
|
+
var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$";
|
|
578
|
+
var MIN_STRING_LENGTH = 128;
|
|
579
|
+
var unsafe_chars = /[<\b\f\n\r\t\0\u2028\u2029]/g;
|
|
580
|
+
var reserved = /^(?:do|if|in|for|int|let|new|try|var|byte|case|char|else|enum|goto|long|this|void|with|await|break|catch|class|const|final|float|short|super|throw|while|yield|delete|double|export|import|native|return|switch|throws|typeof|boolean|default|extends|finally|package|private|abstract|continue|debugger|function|volatile|interface|protected|transient|implements|instanceof|synchronized)$/;
|
|
581
|
+
/**
|
|
582
|
+
* Turn a value into the JavaScript that creates an equivalent value
|
|
583
|
+
* @param {any} value
|
|
584
|
+
* @param {(value: any, uneval: (value: any) => string) => string | void} [replacer]
|
|
585
|
+
*/
|
|
586
|
+
function uneval$1(value, replacer) {
|
|
587
|
+
const counts = /* @__PURE__ */ new Map();
|
|
588
|
+
/** @type {string[]} */
|
|
589
|
+
const keys = [];
|
|
590
|
+
const custom = /* @__PURE__ */ new Map();
|
|
591
|
+
/** @type {Map<string | bigint, string> | undefined} */
|
|
592
|
+
let primitives;
|
|
593
|
+
/** @param {any} thing */
|
|
594
|
+
function stringify_cached_primitive(thing) {
|
|
595
|
+
if (typeof thing === "string" && thing.length >= MIN_STRING_LENGTH || typeof thing === "bigint") {
|
|
596
|
+
primitives ??= /* @__PURE__ */ new Map();
|
|
597
|
+
let literal = primitives.get(thing);
|
|
598
|
+
if (literal === void 0) {
|
|
599
|
+
literal = stringify_primitive$1(thing);
|
|
600
|
+
primitives.set(thing, literal);
|
|
601
|
+
}
|
|
602
|
+
return literal;
|
|
603
|
+
}
|
|
604
|
+
return stringify_primitive$1(thing);
|
|
605
|
+
}
|
|
606
|
+
/** @param {any} thing */
|
|
607
|
+
function walk(thing) {
|
|
608
|
+
if (!is_primitive(thing)) {
|
|
609
|
+
if (counts.has(thing)) {
|
|
610
|
+
counts.set(thing, counts.get(thing) + 1);
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
counts.set(thing, 1);
|
|
614
|
+
if (replacer) {
|
|
615
|
+
const str = replacer(thing, (value) => uneval$1(value, replacer));
|
|
616
|
+
if (typeof str === "string") {
|
|
617
|
+
custom.set(thing, str);
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
if (typeof thing === "function") throw new DevalueError(`Cannot stringify a function`, keys, thing, value);
|
|
622
|
+
switch (get_type(thing)) {
|
|
623
|
+
case "BigInt":
|
|
624
|
+
case "String":
|
|
625
|
+
walk(thing.valueOf());
|
|
626
|
+
return;
|
|
627
|
+
case "Number":
|
|
628
|
+
case "Boolean":
|
|
629
|
+
case "Date":
|
|
630
|
+
case "RegExp":
|
|
631
|
+
case "URL":
|
|
632
|
+
case "URLSearchParams": return;
|
|
633
|
+
case "Array":
|
|
634
|
+
for (const i of valid_array_indices(thing)) {
|
|
635
|
+
keys.push(`[${i}]`);
|
|
636
|
+
walk(thing[i]);
|
|
637
|
+
keys.pop();
|
|
638
|
+
}
|
|
639
|
+
break;
|
|
640
|
+
case "Set":
|
|
641
|
+
Array.from(thing).forEach(walk);
|
|
642
|
+
break;
|
|
643
|
+
case "Map":
|
|
644
|
+
for (const [key, value] of thing) {
|
|
645
|
+
keys.push(`.get(${is_primitive(key) ? stringify_cached_primitive(key) : "..."})`);
|
|
646
|
+
walk(key);
|
|
647
|
+
walk(value);
|
|
648
|
+
keys.pop();
|
|
649
|
+
}
|
|
650
|
+
break;
|
|
651
|
+
case "Int8Array":
|
|
652
|
+
case "Uint8Array":
|
|
653
|
+
case "Uint8ClampedArray":
|
|
654
|
+
case "Int16Array":
|
|
655
|
+
case "Uint16Array":
|
|
656
|
+
case "Float16Array":
|
|
657
|
+
case "Int32Array":
|
|
658
|
+
case "Uint32Array":
|
|
659
|
+
case "Float32Array":
|
|
660
|
+
case "Float64Array":
|
|
661
|
+
case "BigInt64Array":
|
|
662
|
+
case "BigUint64Array":
|
|
663
|
+
case "DataView":
|
|
664
|
+
if (!is_buffer(thing)) walk(thing.buffer);
|
|
665
|
+
return;
|
|
666
|
+
case "ArrayBuffer": return;
|
|
667
|
+
case "Temporal.Duration":
|
|
668
|
+
case "Temporal.Instant":
|
|
669
|
+
case "Temporal.PlainDate":
|
|
670
|
+
case "Temporal.PlainTime":
|
|
671
|
+
case "Temporal.PlainDateTime":
|
|
672
|
+
case "Temporal.PlainMonthDay":
|
|
673
|
+
case "Temporal.PlainYearMonth":
|
|
674
|
+
case "Temporal.ZonedDateTime": return;
|
|
675
|
+
default:
|
|
676
|
+
if (!is_plain_object$1(thing)) throw new DevalueError(`Cannot stringify arbitrary non-POJOs`, keys, thing, value);
|
|
677
|
+
if (enumerable_symbols(thing).length > 0) throw new DevalueError(`Cannot stringify POJOs with symbolic keys`, keys, thing, value);
|
|
678
|
+
for (const key of Object.keys(thing)) {
|
|
679
|
+
if (key === "__proto__") throw new DevalueError(`Cannot stringify objects with __proto__ keys`, keys, thing, value);
|
|
680
|
+
keys.push(stringify_key(key));
|
|
681
|
+
walk(thing[key]);
|
|
682
|
+
keys.pop();
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
} else if (typeof thing === "symbol") throw new DevalueError(`Cannot stringify a Symbol primitive`, keys, thing, value);
|
|
686
|
+
else if (typeof thing === "string" && thing.length >= MIN_STRING_LENGTH || typeof thing === "bigint") counts.set(thing, (counts.get(thing) || 0) + 1);
|
|
687
|
+
}
|
|
688
|
+
walk(value);
|
|
689
|
+
const names = /* @__PURE__ */ new Map();
|
|
690
|
+
/** @type {Array<[any, number]>} */
|
|
691
|
+
const repeated = [];
|
|
692
|
+
counts.forEach((count, thing) => {
|
|
693
|
+
if (count > 1) repeated.push([thing, count]);
|
|
694
|
+
});
|
|
695
|
+
repeated.sort((a, b) => b[1] - a[1]).forEach(([thing, count]) => {
|
|
696
|
+
const name = get_name(names.size);
|
|
697
|
+
if (is_primitive(thing)) {
|
|
698
|
+
const length = stringify_cached_primitive(thing).length;
|
|
699
|
+
if (length * count <= length + (count + 1) * name.length + 25) return;
|
|
700
|
+
}
|
|
701
|
+
names.set(thing, name);
|
|
702
|
+
});
|
|
703
|
+
/**
|
|
704
|
+
* @param {any} thing
|
|
705
|
+
* @returns {string}
|
|
706
|
+
*/
|
|
707
|
+
function stringify(thing) {
|
|
708
|
+
if (names.has(thing)) return names.get(thing);
|
|
709
|
+
if (is_primitive(thing)) return stringify_primitive$1(thing);
|
|
710
|
+
if (custom.has(thing)) return custom.get(thing);
|
|
711
|
+
const type = get_type(thing);
|
|
712
|
+
switch (type) {
|
|
713
|
+
case "Number":
|
|
714
|
+
case "String":
|
|
715
|
+
case "Boolean":
|
|
716
|
+
case "BigInt": return `Object(${stringify(thing.valueOf())})`;
|
|
717
|
+
case "RegExp":
|
|
718
|
+
const { source, flags } = thing;
|
|
719
|
+
return flags ? `new RegExp(${stringify_string(source)},"${flags}")` : `new RegExp(${stringify_string(source)})`;
|
|
720
|
+
case "Date": return `new Date(${thing.getTime()})`;
|
|
721
|
+
case "URL": return `new URL(${stringify_string(thing.toString())})`;
|
|
722
|
+
case "URLSearchParams": return `new URLSearchParams(${stringify_string(thing.toString())})`;
|
|
723
|
+
case "Array": {
|
|
724
|
+
let has_holes = false;
|
|
725
|
+
let result = "[";
|
|
726
|
+
for (let i = 0; i < thing.length; i += 1) {
|
|
727
|
+
if (i > 0) result += ",";
|
|
728
|
+
if (Object.hasOwn(thing, i)) result += stringify(thing[i]);
|
|
729
|
+
else if (!has_holes) {
|
|
730
|
+
const populated_keys = valid_array_indices(thing);
|
|
731
|
+
const population = populated_keys.length;
|
|
732
|
+
const d = String(thing.length).length;
|
|
733
|
+
const array = stringify_sparse_array(thing.length);
|
|
734
|
+
if (thing.length + 2 > array.length + 18 + population * (d + 2)) return `Object.assign(${array},{${populated_keys.map((k) => `${k}:${stringify(thing[k])}`).join(",")}})`;
|
|
735
|
+
has_holes = true;
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
const tail = thing.length === 0 || Object.hasOwn(thing, thing.length - 1) ? "" : ",";
|
|
739
|
+
return result + tail + "]";
|
|
740
|
+
}
|
|
741
|
+
case "Set":
|
|
742
|
+
case "Map": return `new ${type}([${Array.from(thing).map(stringify).join(",")}])`;
|
|
743
|
+
case "Int8Array":
|
|
744
|
+
case "Uint8Array":
|
|
745
|
+
case "Uint8ClampedArray":
|
|
746
|
+
case "Int16Array":
|
|
747
|
+
case "Uint16Array":
|
|
748
|
+
case "Float16Array":
|
|
749
|
+
case "Int32Array":
|
|
750
|
+
case "Uint32Array":
|
|
751
|
+
case "Float32Array":
|
|
752
|
+
case "Float64Array":
|
|
753
|
+
case "BigInt64Array":
|
|
754
|
+
case "BigUint64Array": {
|
|
755
|
+
if (is_buffer(thing)) thing = new Uint8Array(thing);
|
|
756
|
+
let str = `new ${type}`;
|
|
757
|
+
if (!names.has(thing.buffer)) str += `([${stringify_typed_array_elements(type, thing.buffer)}])`;
|
|
758
|
+
else str += `(${stringify(thing.buffer)})`;
|
|
759
|
+
if (thing.byteLength !== thing.buffer.byteLength) {
|
|
760
|
+
const start = thing.byteOffset / thing.BYTES_PER_ELEMENT;
|
|
761
|
+
const end = start + thing.length;
|
|
762
|
+
str += `.subarray(${start},${end})`;
|
|
763
|
+
}
|
|
764
|
+
return str;
|
|
765
|
+
}
|
|
766
|
+
case "DataView": {
|
|
767
|
+
let str = `new DataView`;
|
|
768
|
+
if (!names.has(thing.buffer)) str += `(new Uint8Array([${new Uint8Array(thing.buffer)}]).buffer`;
|
|
769
|
+
else str += `(${stringify(thing.buffer)}`;
|
|
770
|
+
if (thing.byteLength !== thing.buffer.byteLength) str += `,${thing.byteOffset},${thing.byteLength}`;
|
|
771
|
+
return str + ")";
|
|
772
|
+
}
|
|
773
|
+
case "ArrayBuffer": return `new Uint8Array([${new Uint8Array(thing).toString()}]).buffer`;
|
|
774
|
+
case "Temporal.Duration":
|
|
775
|
+
case "Temporal.Instant":
|
|
776
|
+
case "Temporal.PlainDate":
|
|
777
|
+
case "Temporal.PlainTime":
|
|
778
|
+
case "Temporal.PlainDateTime":
|
|
779
|
+
case "Temporal.PlainMonthDay":
|
|
780
|
+
case "Temporal.PlainYearMonth":
|
|
781
|
+
case "Temporal.ZonedDateTime": return `${type}.from(${stringify_string(thing.toString())})`;
|
|
782
|
+
default:
|
|
783
|
+
const keys = Object.keys(thing);
|
|
784
|
+
const obj = keys.map((key) => `${safe_key(key)}:${stringify(thing[key])}`).join(",");
|
|
785
|
+
if (Object.getPrototypeOf(thing) === null) return keys.length > 0 ? `{${obj},__proto__:null}` : `{__proto__:null}`;
|
|
786
|
+
return `{${obj}}`;
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
const str = stringify(value);
|
|
790
|
+
if (names.size) {
|
|
791
|
+
/** @type {string[]} */
|
|
792
|
+
const params = [];
|
|
793
|
+
/** @type {string[]} */
|
|
794
|
+
const statements = [];
|
|
795
|
+
/** @type {string[]} */
|
|
796
|
+
const values = [];
|
|
797
|
+
/** @type {string[]} */
|
|
798
|
+
const reconstructions = [];
|
|
799
|
+
names.forEach((name, thing) => {
|
|
800
|
+
params.push(name);
|
|
801
|
+
if (custom.has(thing)) {
|
|
802
|
+
values.push(custom.get(thing));
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
if (is_primitive(thing)) {
|
|
806
|
+
values.push(stringify_cached_primitive(thing));
|
|
807
|
+
return;
|
|
808
|
+
}
|
|
809
|
+
const type = get_type(thing);
|
|
810
|
+
switch (type) {
|
|
811
|
+
case "Number":
|
|
812
|
+
case "String":
|
|
813
|
+
case "Boolean":
|
|
814
|
+
case "BigInt": {
|
|
815
|
+
const primitive = thing.valueOf();
|
|
816
|
+
if (names.has(primitive)) {
|
|
817
|
+
values.push("{}");
|
|
818
|
+
reconstructions.push(`${name}=Object(${stringify(primitive)})`);
|
|
819
|
+
} else values.push(`Object(${stringify(primitive)})`);
|
|
820
|
+
break;
|
|
821
|
+
}
|
|
822
|
+
case "RegExp":
|
|
823
|
+
const { source, flags } = thing;
|
|
824
|
+
const regexp = flags ? `new RegExp(${stringify_string(source)},"${flags}")` : `new RegExp(${stringify_string(source)})`;
|
|
825
|
+
values.push(regexp);
|
|
826
|
+
break;
|
|
827
|
+
case "Date":
|
|
828
|
+
values.push(`new Date(${thing.getTime()})`);
|
|
829
|
+
break;
|
|
830
|
+
case "URL":
|
|
831
|
+
values.push(`new URL(${stringify_string(thing.toString())})`);
|
|
832
|
+
break;
|
|
833
|
+
case "URLSearchParams":
|
|
834
|
+
values.push(`new URLSearchParams(${stringify_string(thing.toString())})`);
|
|
835
|
+
break;
|
|
836
|
+
case "Array": {
|
|
837
|
+
const populated_keys = valid_array_indices(thing);
|
|
838
|
+
values.push(thing.length > 32 + 2 * populated_keys.length ? stringify_sparse_array(thing.length) : `Array(${thing.length})`);
|
|
839
|
+
for (const i of populated_keys) statements.push(`${name}[${i}]=${stringify(thing[i])}`);
|
|
840
|
+
break;
|
|
841
|
+
}
|
|
842
|
+
case "Set": {
|
|
843
|
+
values.push(`new Set`);
|
|
844
|
+
const adds = Array.from(thing).map((v) => `.add(${stringify(v)})`);
|
|
845
|
+
if (adds.length > 0) statements.push(name + adds.join(""));
|
|
846
|
+
break;
|
|
847
|
+
}
|
|
848
|
+
case "Map": {
|
|
849
|
+
values.push(`new Map`);
|
|
850
|
+
const sets = Array.from(thing).map(([k, v]) => `.set(${stringify(k)}, ${stringify(v)})`);
|
|
851
|
+
if (sets.length > 0) statements.push(name + sets.join(""));
|
|
852
|
+
break;
|
|
853
|
+
}
|
|
854
|
+
case "Int8Array":
|
|
855
|
+
case "Uint8Array":
|
|
856
|
+
case "Uint8ClampedArray":
|
|
857
|
+
case "Int16Array":
|
|
858
|
+
case "Uint16Array":
|
|
859
|
+
case "Float16Array":
|
|
860
|
+
case "Int32Array":
|
|
861
|
+
case "Uint32Array":
|
|
862
|
+
case "Float32Array":
|
|
863
|
+
case "Float64Array":
|
|
864
|
+
case "BigInt64Array":
|
|
865
|
+
case "BigUint64Array": {
|
|
866
|
+
if (is_buffer(thing)) thing = new Uint8Array(thing);
|
|
867
|
+
let str = `new ${type}`;
|
|
868
|
+
if (!names.has(thing.buffer)) str += `([${stringify_typed_array_elements(type, thing.buffer)}])`;
|
|
869
|
+
else str += `(${stringify(thing.buffer)})`;
|
|
870
|
+
if (thing.byteLength !== thing.buffer.byteLength) {
|
|
871
|
+
const start = thing.byteOffset / thing.BYTES_PER_ELEMENT;
|
|
872
|
+
const end = start + thing.length;
|
|
873
|
+
str += `.subarray(${start},${end})`;
|
|
874
|
+
}
|
|
875
|
+
values.push(`{}`);
|
|
876
|
+
reconstructions.push(`${name}=${str}`);
|
|
877
|
+
break;
|
|
878
|
+
}
|
|
879
|
+
case "DataView": {
|
|
880
|
+
let str = `new DataView`;
|
|
881
|
+
if (!names.has(thing.buffer)) str += `(new Uint8Array([${new Uint8Array(thing.buffer)}]).buffer`;
|
|
882
|
+
else str += `(${stringify(thing.buffer)}`;
|
|
883
|
+
if (thing.byteLength !== thing.buffer.byteLength) str += `,${thing.byteOffset},${thing.byteLength}`;
|
|
884
|
+
str += ")";
|
|
885
|
+
values.push(`{}`);
|
|
886
|
+
reconstructions.push(`${name}=${str}`);
|
|
887
|
+
break;
|
|
888
|
+
}
|
|
889
|
+
case "ArrayBuffer":
|
|
890
|
+
values.push(`new Uint8Array([${new Uint8Array(thing)}]).buffer`);
|
|
891
|
+
break;
|
|
892
|
+
case "Temporal.Duration":
|
|
893
|
+
case "Temporal.Instant":
|
|
894
|
+
case "Temporal.PlainDate":
|
|
895
|
+
case "Temporal.PlainTime":
|
|
896
|
+
case "Temporal.PlainDateTime":
|
|
897
|
+
case "Temporal.PlainMonthDay":
|
|
898
|
+
case "Temporal.PlainYearMonth":
|
|
899
|
+
case "Temporal.ZonedDateTime":
|
|
900
|
+
values.push(`${type}.from(${stringify_string(thing.toString())})`);
|
|
901
|
+
break;
|
|
902
|
+
default:
|
|
903
|
+
values.push(Object.getPrototypeOf(thing) === null ? "Object.create(null)" : "{}");
|
|
904
|
+
Object.keys(thing).forEach((key) => {
|
|
905
|
+
statements.push(`${name}${safe_prop(key)}=${stringify(thing[key])}`);
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
});
|
|
909
|
+
statements.push(`return ${str}`);
|
|
910
|
+
const body = [...reconstructions, ...statements].join(";");
|
|
911
|
+
if (params.length > 65534) return `(function(){var[${params.join(",")}]=arguments[0];${body}}([${values.join(",")}]))`;
|
|
912
|
+
return `(function(${params.join(",")}){${body}}(${values.join(",")}))`;
|
|
913
|
+
} else return str;
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* Emit an array whose storage is not proportional to its declared length.
|
|
917
|
+
* As in the default parse operations, touching and deleting the largest valid
|
|
918
|
+
* index forces V8 into dictionary-elements mode before setting the length.
|
|
919
|
+
* Merely starting with [] and assigning .length still eagerly allocates.
|
|
920
|
+
* @param {number} length
|
|
921
|
+
*/
|
|
922
|
+
function stringify_sparse_array(length) {
|
|
923
|
+
return `(function(a){a[${MAX_ARRAY_INDEX$1}]=0;delete a[${MAX_ARRAY_INDEX$1}];a.length=${length};return a}([]))`;
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* Serialize the elements of `buffer`, read as `type`, as a comma-separated list.
|
|
927
|
+
* The view is created from `type` rather than from the serialized value's own
|
|
928
|
+
* constructor, which may be a subclass like Node's `Buffer` whose `toString`
|
|
929
|
+
* decodes the bytes instead of listing them.
|
|
930
|
+
* `BigInt64Array`/`BigUint64Array` elements are bigints and must be written
|
|
931
|
+
* with an `n` suffix, otherwise the emitted `new BigInt64Array([...])` throws.
|
|
932
|
+
* @param {string} type
|
|
933
|
+
* @param {ArrayBufferLike} buffer
|
|
934
|
+
*/
|
|
935
|
+
function stringify_typed_array_elements(type, buffer) {
|
|
936
|
+
const array = new globalThis[type](buffer);
|
|
937
|
+
if (type === "BigInt64Array" || type === "BigUint64Array") return Array.from(array, (element) => `${element}n`).join(",");
|
|
938
|
+
if (array instanceof Float32Array || array instanceof Float64Array || typeof Float16Array !== "undefined" && array instanceof Float16Array) return Array.from(array, (element) => Object.is(element, -0) ? "-0" : `${element}`).join(",");
|
|
939
|
+
return array.toString();
|
|
940
|
+
}
|
|
941
|
+
/** @param {number} num */
|
|
942
|
+
function get_name(num) {
|
|
943
|
+
let name = "";
|
|
944
|
+
do {
|
|
945
|
+
name = chars[num % 54] + name;
|
|
946
|
+
num = ~~(num / 54) - 1;
|
|
947
|
+
} while (num >= 0);
|
|
948
|
+
return reserved.test(name) ? `${name}0` : name;
|
|
949
|
+
}
|
|
950
|
+
/** @param {string} c */
|
|
951
|
+
function escape_unsafe_char(c) {
|
|
952
|
+
return escaped[c] || c;
|
|
953
|
+
}
|
|
954
|
+
/** @param {string} str */
|
|
955
|
+
function escape_unsafe_chars(str) {
|
|
956
|
+
return str.replace(unsafe_chars, escape_unsafe_char);
|
|
957
|
+
}
|
|
958
|
+
/** @param {string} key */
|
|
959
|
+
function safe_key(key) {
|
|
960
|
+
return /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key) ? key : escape_unsafe_chars(JSON.stringify(key));
|
|
961
|
+
}
|
|
962
|
+
/** @param {string} key */
|
|
963
|
+
function safe_prop(key) {
|
|
964
|
+
return /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key) ? `.${key}` : `[${escape_unsafe_chars(JSON.stringify(key))}]`;
|
|
965
|
+
}
|
|
966
|
+
/** @param {any} thing */
|
|
967
|
+
function stringify_primitive$1(thing) {
|
|
968
|
+
const type = typeof thing;
|
|
969
|
+
if (type === "string") return stringify_string(thing);
|
|
970
|
+
if (thing === void 0) return "void 0";
|
|
971
|
+
if (thing === 0 && 1 / thing < 0) return "-0";
|
|
972
|
+
const str = String(thing);
|
|
973
|
+
if (type === "number") return str.replace(/^(-)?0\./, "$1.");
|
|
974
|
+
if (type === "bigint") return thing + "n";
|
|
975
|
+
return str;
|
|
976
|
+
}
|
|
977
|
+
// ../../node_modules/.pnpm/devalue@5.9.4/node_modules/devalue/src/base64.js
|
|
978
|
+
/** @type {(array_buffer: ArrayBuffer) => string} */
|
|
979
|
+
function encode_native(array_buffer) {
|
|
980
|
+
return new Uint8Array(array_buffer).toBase64();
|
|
981
|
+
}
|
|
982
|
+
/** @type {(base64: string) => ArrayBuffer} */
|
|
983
|
+
function decode_native(base64) {
|
|
984
|
+
return Uint8Array.fromBase64(base64).buffer;
|
|
985
|
+
}
|
|
986
|
+
/** @type {(array_buffer: ArrayBuffer) => string} */
|
|
987
|
+
function encode_buffer(array_buffer) {
|
|
988
|
+
return Buffer.from(array_buffer).toString("base64");
|
|
989
|
+
}
|
|
990
|
+
/** @type {(base64: string) => ArrayBuffer} */
|
|
991
|
+
function decode_buffer(base64) {
|
|
992
|
+
return Uint8Array.from(Buffer.from(base64, "base64")).buffer;
|
|
993
|
+
}
|
|
994
|
+
/** @type {(array_buffer: ArrayBuffer) => string} */
|
|
995
|
+
function encode_legacy(array_buffer) {
|
|
996
|
+
const array = new Uint8Array(array_buffer);
|
|
997
|
+
let binary = "";
|
|
998
|
+
const chunk_size = 32768;
|
|
999
|
+
for (let i = 0; i < array.length; i += chunk_size) {
|
|
1000
|
+
const chunk = array.subarray(i, i + chunk_size);
|
|
1001
|
+
binary += String.fromCharCode.apply(null, chunk);
|
|
1002
|
+
}
|
|
1003
|
+
return btoa(binary);
|
|
1004
|
+
}
|
|
1005
|
+
/** @type {(base64: string) => ArrayBuffer} */
|
|
1006
|
+
function decode_legacy(base64) {
|
|
1007
|
+
const binary_string = atob(base64);
|
|
1008
|
+
const len = binary_string.length;
|
|
1009
|
+
const array = new Uint8Array(len);
|
|
1010
|
+
for (let i = 0; i < len; i++) array[i] = binary_string.charCodeAt(i);
|
|
1011
|
+
return array.buffer;
|
|
1012
|
+
}
|
|
1013
|
+
var native = typeof Uint8Array.fromBase64 === "function";
|
|
1014
|
+
var buffer = typeof process === "object" && process.versions?.node !== void 0;
|
|
1015
|
+
var encode64 = native ? encode_native : buffer ? encode_buffer : encode_legacy;
|
|
1016
|
+
var decode64 = native ? decode_native : buffer ? decode_buffer : decode_legacy;
|
|
1017
|
+
// ../../node_modules/.pnpm/devalue@5.9.4/node_modules/devalue/src/operations.js
|
|
1018
|
+
/**
|
|
1019
|
+
* Merges caller-provided operation overrides over the defaults. Iterating the
|
|
1020
|
+
* default keys (rather than the override's own keys) means nullish members
|
|
1021
|
+
* fall back to the default, and inherited members — e.g. from a class
|
|
1022
|
+
* instance — are picked up.
|
|
1023
|
+
*
|
|
1024
|
+
* @template {Record<string, any>} T
|
|
1025
|
+
* @param {T} defaults
|
|
1026
|
+
* @param {Partial<T> | undefined} overrides
|
|
1027
|
+
* @returns {T}
|
|
1028
|
+
*/
|
|
1029
|
+
function merge_operations(defaults, overrides) {
|
|
1030
|
+
if (!overrides) return defaults;
|
|
1031
|
+
const merged = {};
|
|
1032
|
+
for (const key of Object.keys(defaults)) merged[key] = overrides[key] ?? defaults[key];
|
|
1033
|
+
return merged;
|
|
1034
|
+
}
|
|
1035
|
+
/** @type {{ kind: 'not-plain' }} */
|
|
1036
|
+
var NOT_PLAIN = /* @__PURE__ */ Object.freeze({ kind: "not-plain" });
|
|
1037
|
+
/** @type {{ kind: 'symbol-keys' }} */
|
|
1038
|
+
var SYMBOL_KEYS = /* @__PURE__ */ Object.freeze({ kind: "symbol-keys" });
|
|
1039
|
+
var default_stringify_operations = /* @__PURE__ */ Object.freeze({
|
|
1040
|
+
identify: (value) => value,
|
|
1041
|
+
typeOf: (value) => value === null ? "null" : typeof value,
|
|
1042
|
+
toPrimitive: (value) => value,
|
|
1043
|
+
tagOf: (value) => get_type(value),
|
|
1044
|
+
isThenable: (value) => typeof value.then === "function",
|
|
1045
|
+
toPromise: (thenable) => Promise.resolve(thenable),
|
|
1046
|
+
unbox: (boxed) => boxed.valueOf(),
|
|
1047
|
+
toISOString: (date) => isNaN(date.getDate()) ? "" : date.toISOString(),
|
|
1048
|
+
toStringValue: (value) => value.toString(),
|
|
1049
|
+
regExpInfo: (regexp) => ({
|
|
1050
|
+
source: regexp.source,
|
|
1051
|
+
flags: regexp.flags
|
|
1052
|
+
}),
|
|
1053
|
+
valuesOf: (set) => set,
|
|
1054
|
+
entriesOf: (map) => map,
|
|
1055
|
+
viewInfo: (view) => {
|
|
1056
|
+
if (is_buffer(view)) view = new Uint8Array(view);
|
|
1057
|
+
return {
|
|
1058
|
+
buffer: view.buffer,
|
|
1059
|
+
byteOffset: view.byteOffset,
|
|
1060
|
+
byteLength: view.byteLength,
|
|
1061
|
+
length: view.length,
|
|
1062
|
+
bufferByteLength: view.buffer.byteLength
|
|
1063
|
+
};
|
|
1064
|
+
},
|
|
1065
|
+
toArrayBuffer: (buffer) => buffer,
|
|
1066
|
+
lengthOf: (array) => array.length,
|
|
1067
|
+
hasOwn: (value, key) => Object.hasOwn(value, key),
|
|
1068
|
+
indicesOf: (array) => valid_array_indices(array),
|
|
1069
|
+
shapeOf: (value) => {
|
|
1070
|
+
if (!is_plain_object$1(value)) return NOT_PLAIN;
|
|
1071
|
+
if (enumerable_symbols(value).length > 0) return SYMBOL_KEYS;
|
|
1072
|
+
return {
|
|
1073
|
+
kind: Object.getPrototypeOf(value) === null ? "null-proto" : "plain",
|
|
1074
|
+
keys: Object.keys(value)
|
|
1075
|
+
};
|
|
1076
|
+
},
|
|
1077
|
+
get: (value, key) => value[key]
|
|
1078
|
+
});
|
|
1079
|
+
var array_buffer_byte_length = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get;
|
|
1080
|
+
var shared_array_buffer_byte_length = typeof SharedArrayBuffer === "undefined" ? void 0 : Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype, "byteLength").get;
|
|
1081
|
+
var default_parse_operations = /* @__PURE__ */ Object.freeze({
|
|
1082
|
+
fromPrimitive: (primitive) => primitive,
|
|
1083
|
+
fromISOString: (iso) => new Date(iso),
|
|
1084
|
+
fromStringValue: (tag, text) => {
|
|
1085
|
+
if (tag === "URL") return new URL(text);
|
|
1086
|
+
if (tag === "URLSearchParams") return new URLSearchParams(text);
|
|
1087
|
+
return Temporal[tag.slice(9)].from(text);
|
|
1088
|
+
},
|
|
1089
|
+
fromArrayBuffer: (buffer) => buffer,
|
|
1090
|
+
fromRegExpInfo: (source, flags) => new RegExp(source, flags),
|
|
1091
|
+
fromViewInfo: (tag, buffer, byteOffset, length) => {
|
|
1092
|
+
try {
|
|
1093
|
+
array_buffer_byte_length.call(buffer);
|
|
1094
|
+
} catch (error) {
|
|
1095
|
+
if (!shared_array_buffer_byte_length) throw error;
|
|
1096
|
+
shared_array_buffer_byte_length.call(buffer);
|
|
1097
|
+
}
|
|
1098
|
+
const Constructor = globalThis[tag];
|
|
1099
|
+
return byteOffset !== void 0 ? new Constructor(buffer, byteOffset, length) : new Constructor(buffer);
|
|
1100
|
+
},
|
|
1101
|
+
box: (value) => Object(value),
|
|
1102
|
+
createArray: (length) => new Array(length),
|
|
1103
|
+
createSparseArray: (length) => {
|
|
1104
|
+
/** @type {any[]} */
|
|
1105
|
+
const array = [];
|
|
1106
|
+
array[MAX_ARRAY_INDEX$1] = void 0;
|
|
1107
|
+
delete array[MAX_ARRAY_INDEX$1];
|
|
1108
|
+
array.length = length;
|
|
1109
|
+
return array;
|
|
1110
|
+
},
|
|
1111
|
+
createObject: () => ({}),
|
|
1112
|
+
createNullPrototypeObject: () => Object.create(null),
|
|
1113
|
+
createSet: () => /* @__PURE__ */ new Set(),
|
|
1114
|
+
createMap: () => /* @__PURE__ */ new Map(),
|
|
1115
|
+
set: (target, key, value) => {
|
|
1116
|
+
target[key] = value;
|
|
1117
|
+
},
|
|
1118
|
+
addValue: (set, value) => {
|
|
1119
|
+
set.add(value);
|
|
1120
|
+
},
|
|
1121
|
+
addEntry: (map, key, value) => {
|
|
1122
|
+
map.set(key, value);
|
|
1123
|
+
}
|
|
1124
|
+
});
|
|
1125
|
+
// ../../node_modules/.pnpm/devalue@5.9.4/node_modules/devalue/src/parse.js
|
|
1126
|
+
/**
|
|
1127
|
+
* Revive a value serialized with `devalue.stringify`
|
|
1128
|
+
* @param {string} serialized
|
|
1129
|
+
* @param {Record<string, (value: any) => any>} [revivers]
|
|
1130
|
+
* @param {import('./types.js').ParseOptions} [options]
|
|
1131
|
+
*/
|
|
1132
|
+
function parse$1(serialized, revivers, options) {
|
|
1133
|
+
return unflatten(JSON.parse(serialized), revivers, options);
|
|
1134
|
+
}
|
|
1135
|
+
/**
|
|
1136
|
+
* Revive a value flattened with `devalue.stringify`
|
|
1137
|
+
* @param {number | any[]} parsed
|
|
1138
|
+
* @param {Record<string, (value: any) => any>} [revivers]
|
|
1139
|
+
* @param {import('./types.js').ParseOptions} [options]
|
|
1140
|
+
*/
|
|
1141
|
+
function unflatten(parsed, revivers, options) {
|
|
1142
|
+
/** @type {import('./types.js').ParseOperations} */
|
|
1143
|
+
const ops = merge_operations(default_parse_operations, options?.operations);
|
|
1144
|
+
if (typeof parsed === "number") return hydrate(parsed, true);
|
|
1145
|
+
if (!Array.isArray(parsed) || parsed.length === 0) throw new Error("Invalid input");
|
|
1146
|
+
const values = parsed;
|
|
1147
|
+
const hydrated = Array(values.length);
|
|
1148
|
+
/**
|
|
1149
|
+
* A set of values currently being hydrated with custom revivers,
|
|
1150
|
+
* used to detect invalid cyclical dependencies
|
|
1151
|
+
* @type {Set<number> | null}
|
|
1152
|
+
*/
|
|
1153
|
+
let hydrating = null;
|
|
1154
|
+
/**
|
|
1155
|
+
* @param {number} index
|
|
1156
|
+
* @returns {any}
|
|
1157
|
+
*/
|
|
1158
|
+
function hydrate(index, standalone = false) {
|
|
1159
|
+
if (index === -1) return ops.fromPrimitive(void 0);
|
|
1160
|
+
if (index === -3) return ops.fromPrimitive(NaN);
|
|
1161
|
+
if (index === -4) return ops.fromPrimitive(1e400);
|
|
1162
|
+
if (index === -5) return ops.fromPrimitive(-1e400);
|
|
1163
|
+
if (index === -6) return ops.fromPrimitive(-0);
|
|
1164
|
+
if (standalone || typeof index !== "number") throw new Error(`Invalid input`);
|
|
1165
|
+
if (index in hydrated) return hydrated[index];
|
|
1166
|
+
if (index >= values.length) throw new Error(`Invalid input`);
|
|
1167
|
+
const value = values[index];
|
|
1168
|
+
if (!value || typeof value !== "object") hydrated[index] = ops.fromPrimitive(value);
|
|
1169
|
+
else if (Array.isArray(value)) {
|
|
1170
|
+
if (typeof value[0] === "string") {
|
|
1171
|
+
const type = value[0];
|
|
1172
|
+
const reviver = revivers && Object.hasOwn(revivers, type) ? revivers[type] : void 0;
|
|
1173
|
+
if (reviver) {
|
|
1174
|
+
let i = value[1];
|
|
1175
|
+
if (typeof i !== "number") i = values.push(value[1]) - 1;
|
|
1176
|
+
if (Object.hasOwn(hydrated, i)) return hydrated[index] = reviver(hydrated[i]);
|
|
1177
|
+
hydrating ??= /* @__PURE__ */ new Set();
|
|
1178
|
+
if (hydrating.has(i)) throw new Error("Invalid circular reference");
|
|
1179
|
+
hydrating.add(i);
|
|
1180
|
+
hydrated[index] = reviver(hydrate(i));
|
|
1181
|
+
hydrating.delete(i);
|
|
1182
|
+
return hydrated[index];
|
|
1183
|
+
}
|
|
1184
|
+
switch (type) {
|
|
1185
|
+
case "Date":
|
|
1186
|
+
hydrated[index] = ops.fromISOString(value[1]);
|
|
1187
|
+
break;
|
|
1188
|
+
case "Set":
|
|
1189
|
+
const set = ops.createSet();
|
|
1190
|
+
hydrated[index] = set;
|
|
1191
|
+
for (let i = 1; i < value.length; i += 1) ops.addValue(set, hydrate(value[i]));
|
|
1192
|
+
break;
|
|
1193
|
+
case "Map":
|
|
1194
|
+
const map = ops.createMap();
|
|
1195
|
+
hydrated[index] = map;
|
|
1196
|
+
for (let i = 1; i < value.length; i += 2) ops.addEntry(map, hydrate(value[i]), hydrate(value[i + 1]));
|
|
1197
|
+
break;
|
|
1198
|
+
case "RegExp":
|
|
1199
|
+
hydrated[index] = ops.fromRegExpInfo(value[1], value[2]);
|
|
1200
|
+
break;
|
|
1201
|
+
case "Object": {
|
|
1202
|
+
const wrapped_index = value[1];
|
|
1203
|
+
if (typeof values[wrapped_index] === "object" && values[wrapped_index][0] !== "BigInt") throw new Error("Invalid input");
|
|
1204
|
+
hydrated[index] = ops.box(hydrate(wrapped_index));
|
|
1205
|
+
break;
|
|
1206
|
+
}
|
|
1207
|
+
case "BigInt":
|
|
1208
|
+
hydrated[index] = ops.fromPrimitive(BigInt(value[1]));
|
|
1209
|
+
break;
|
|
1210
|
+
case "null":
|
|
1211
|
+
const obj = ops.createNullPrototypeObject();
|
|
1212
|
+
hydrated[index] = obj;
|
|
1213
|
+
for (let i = 1; i < value.length; i += 2) {
|
|
1214
|
+
const key = value[i];
|
|
1215
|
+
if (typeof key !== "string") throw new Error("Cannot parse an object with a non-string key");
|
|
1216
|
+
if (key === "__proto__") throw new Error("Cannot parse an object with a `__proto__` property");
|
|
1217
|
+
ops.set(obj, key, hydrate(value[i + 1]));
|
|
1218
|
+
}
|
|
1219
|
+
break;
|
|
1220
|
+
case "Int8Array":
|
|
1221
|
+
case "Uint8Array":
|
|
1222
|
+
case "Uint8ClampedArray":
|
|
1223
|
+
case "Int16Array":
|
|
1224
|
+
case "Uint16Array":
|
|
1225
|
+
case "Float16Array":
|
|
1226
|
+
case "Int32Array":
|
|
1227
|
+
case "Uint32Array":
|
|
1228
|
+
case "Float32Array":
|
|
1229
|
+
case "Float64Array":
|
|
1230
|
+
case "BigInt64Array":
|
|
1231
|
+
case "BigUint64Array":
|
|
1232
|
+
case "DataView": {
|
|
1233
|
+
if (values[value[1]][0] !== "ArrayBuffer") throw new Error("Invalid data");
|
|
1234
|
+
const buffer = hydrate(value[1]);
|
|
1235
|
+
hydrated[index] = ops.fromViewInfo(type, buffer, value[2], value[3]);
|
|
1236
|
+
break;
|
|
1237
|
+
}
|
|
1238
|
+
case "ArrayBuffer": {
|
|
1239
|
+
const base64 = value[1];
|
|
1240
|
+
if (typeof base64 !== "string") throw new Error("Invalid ArrayBuffer encoding");
|
|
1241
|
+
hydrated[index] = ops.fromArrayBuffer(decode64(base64));
|
|
1242
|
+
break;
|
|
1243
|
+
}
|
|
1244
|
+
case "URL":
|
|
1245
|
+
case "URLSearchParams":
|
|
1246
|
+
case "Temporal.Duration":
|
|
1247
|
+
case "Temporal.Instant":
|
|
1248
|
+
case "Temporal.PlainDate":
|
|
1249
|
+
case "Temporal.PlainTime":
|
|
1250
|
+
case "Temporal.PlainDateTime":
|
|
1251
|
+
case "Temporal.PlainMonthDay":
|
|
1252
|
+
case "Temporal.PlainYearMonth":
|
|
1253
|
+
case "Temporal.ZonedDateTime":
|
|
1254
|
+
hydrated[index] = ops.fromStringValue(type, value[1]);
|
|
1255
|
+
break;
|
|
1256
|
+
default: throw new Error(`Unknown type ${type}`);
|
|
1257
|
+
}
|
|
1258
|
+
} else if (value[0] === -7) {
|
|
1259
|
+
const len = value[1];
|
|
1260
|
+
if (!is_valid_array_len(len)) throw new Error("Invalid input");
|
|
1261
|
+
const array = ops.createSparseArray(len);
|
|
1262
|
+
hydrated[index] = array;
|
|
1263
|
+
for (let i = 2; i < value.length; i += 2) {
|
|
1264
|
+
const idx = value[i];
|
|
1265
|
+
if (!is_valid_array_index(idx) || idx >= len) throw new Error("Invalid input");
|
|
1266
|
+
ops.set(array, idx, hydrate(value[i + 1]));
|
|
1267
|
+
}
|
|
1268
|
+
} else {
|
|
1269
|
+
const array = ops.createArray(value.length);
|
|
1270
|
+
hydrated[index] = array;
|
|
1271
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
1272
|
+
const n = value[i];
|
|
1273
|
+
if (n === -2) continue;
|
|
1274
|
+
ops.set(array, i, hydrate(n));
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
} else {
|
|
1278
|
+
const object = ops.createObject();
|
|
1279
|
+
hydrated[index] = object;
|
|
1280
|
+
for (const key of Object.keys(value)) {
|
|
1281
|
+
if (key === "__proto__") throw new Error("Cannot parse an object with a `__proto__` property");
|
|
1282
|
+
ops.set(object, key, hydrate(value[key]));
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
return hydrated[index];
|
|
1286
|
+
}
|
|
1287
|
+
return hydrate(0);
|
|
1288
|
+
}
|
|
1289
|
+
// ../../node_modules/.pnpm/devalue@5.9.4/node_modules/devalue/src/stringify.js
|
|
1290
|
+
/**
|
|
1291
|
+
* Turn a value into a JSON string that can be parsed with `devalue.parse`
|
|
1292
|
+
* @param {any} value
|
|
1293
|
+
* @param {Record<string, (value: any) => any>} [reducers]
|
|
1294
|
+
* @param {import('./types.js').StringifyOptions} [options]
|
|
1295
|
+
*/
|
|
1296
|
+
function stringify$1(value, reducers, options) {
|
|
1297
|
+
const stringified = run(false, value, reducers, options);
|
|
1298
|
+
return typeof stringified === "string" ? stringified : `[${stringified.join(",")}]`;
|
|
1299
|
+
}
|
|
1300
|
+
/**
|
|
1301
|
+
* @param {boolean} async
|
|
1302
|
+
* @param {any} value
|
|
1303
|
+
* @param {Record<string, (value: any) => any>} [reducers]
|
|
1304
|
+
* @param {import('./types.js').StringifyOptions} [options]
|
|
1305
|
+
*/
|
|
1306
|
+
function run(async, value, reducers, options) {
|
|
1307
|
+
const ops = merge_operations(default_stringify_operations, options?.operations);
|
|
1308
|
+
/** @type {any[]} */
|
|
1309
|
+
const stringified = [];
|
|
1310
|
+
/** @type {Map<any, number>} */
|
|
1311
|
+
const indexes = /* @__PURE__ */ new Map();
|
|
1312
|
+
/** @type {Array<{ key: string, fn: (value: any) => any }>} */
|
|
1313
|
+
const custom = [];
|
|
1314
|
+
if (reducers) for (const key of Object.getOwnPropertyNames(reducers)) custom.push({
|
|
1315
|
+
key,
|
|
1316
|
+
fn: reducers[key]
|
|
1317
|
+
});
|
|
1318
|
+
/** @type {string[]} */
|
|
1319
|
+
const keys = [];
|
|
1320
|
+
let p = 0;
|
|
1321
|
+
/**
|
|
1322
|
+
* @param {any} thing
|
|
1323
|
+
* @param {number} [index]
|
|
1324
|
+
*/
|
|
1325
|
+
function flatten(thing, index) {
|
|
1326
|
+
const type = ops.typeOf(thing);
|
|
1327
|
+
if (type === "undefined") return -1;
|
|
1328
|
+
/** @type {number | undefined} */
|
|
1329
|
+
let number;
|
|
1330
|
+
if (type === "number") {
|
|
1331
|
+
number = ops.toPrimitive(thing);
|
|
1332
|
+
if (Number.isNaN(number)) return -3;
|
|
1333
|
+
if (number === 1e400) return -4;
|
|
1334
|
+
if (number === -1e400) return -5;
|
|
1335
|
+
if (number === 0 && 1 / number < 0) return -6;
|
|
1336
|
+
}
|
|
1337
|
+
const id = ops.identify(thing);
|
|
1338
|
+
if (indexes.has(id)) return indexes.get(id);
|
|
1339
|
+
index ??= p++;
|
|
1340
|
+
indexes.set(id, index);
|
|
1341
|
+
for (const { key, fn } of custom) {
|
|
1342
|
+
const value = fn(thing);
|
|
1343
|
+
if (value) {
|
|
1344
|
+
stringified[index] = `["${key}",${flatten(value)}]`;
|
|
1345
|
+
return index;
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
if (type === "function") throw new DevalueError(`Cannot stringify a function`, keys, thing, value);
|
|
1349
|
+
else if (type === "symbol") throw new DevalueError(`Cannot stringify a Symbol primitive`, keys, thing, value);
|
|
1350
|
+
/** @type {string | Promise<any>} */
|
|
1351
|
+
let str = "";
|
|
1352
|
+
if (type !== "object") str = stringify_primitive(type === "number" ? number : ops.toPrimitive(thing));
|
|
1353
|
+
else if (ops.isThenable(thing)) {
|
|
1354
|
+
if (!async) throw new DevalueError(`Cannot stringify a Promise or thenable — use stringifyAsync instead`, keys, thing, value);
|
|
1355
|
+
str = ops.toPromise(thing).then((value) => {
|
|
1356
|
+
const i = flatten(value, index);
|
|
1357
|
+
if (i < 0) stringified[index] = i;
|
|
1358
|
+
});
|
|
1359
|
+
str.catch(() => {});
|
|
1360
|
+
} else {
|
|
1361
|
+
const tag = ops.tagOf(thing);
|
|
1362
|
+
switch (tag) {
|
|
1363
|
+
case "Number":
|
|
1364
|
+
case "String":
|
|
1365
|
+
case "Boolean":
|
|
1366
|
+
case "BigInt":
|
|
1367
|
+
str = `["Object",${flatten(ops.unbox(thing))}]`;
|
|
1368
|
+
break;
|
|
1369
|
+
case "Date":
|
|
1370
|
+
str = `["Date","${ops.toISOString(thing)}"]`;
|
|
1371
|
+
break;
|
|
1372
|
+
case "URL":
|
|
1373
|
+
str = `["URL",${stringify_string(ops.toStringValue(thing))}]`;
|
|
1374
|
+
break;
|
|
1375
|
+
case "URLSearchParams":
|
|
1376
|
+
str = `["URLSearchParams",${stringify_string(ops.toStringValue(thing))}]`;
|
|
1377
|
+
break;
|
|
1378
|
+
case "RegExp":
|
|
1379
|
+
const { source, flags } = ops.regExpInfo(thing);
|
|
1380
|
+
str = flags ? `["RegExp",${stringify_string(source)},"${flags}"]` : `["RegExp",${stringify_string(source)}]`;
|
|
1381
|
+
break;
|
|
1382
|
+
case "Array": {
|
|
1383
|
+
let mostly_dense = false;
|
|
1384
|
+
const length = ops.lengthOf(thing);
|
|
1385
|
+
str = "[";
|
|
1386
|
+
for (let i = 0; i < length; i += 1) {
|
|
1387
|
+
if (i > 0) str += ",";
|
|
1388
|
+
if (ops.hasOwn(thing, i)) {
|
|
1389
|
+
keys.push(`[${i}]`);
|
|
1390
|
+
str += flatten(ops.get(thing, i));
|
|
1391
|
+
keys.pop();
|
|
1392
|
+
} else if (mostly_dense) str += -2;
|
|
1393
|
+
else {
|
|
1394
|
+
const populated_keys = ops.indicesOf(thing);
|
|
1395
|
+
const population = populated_keys.length;
|
|
1396
|
+
const d = String(length).length;
|
|
1397
|
+
if ((length - population) * 3 > 4 + d + population * (d + 1)) {
|
|
1398
|
+
str = "[-7," + length;
|
|
1399
|
+
for (let j = 0; j < populated_keys.length; j++) {
|
|
1400
|
+
const key = populated_keys[j];
|
|
1401
|
+
keys.push(`[${key}]`);
|
|
1402
|
+
str += "," + key + "," + flatten(ops.get(thing, key));
|
|
1403
|
+
keys.pop();
|
|
1404
|
+
}
|
|
1405
|
+
break;
|
|
1406
|
+
} else {
|
|
1407
|
+
mostly_dense = true;
|
|
1408
|
+
str += -2;
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
str += "]";
|
|
1413
|
+
break;
|
|
1414
|
+
}
|
|
1415
|
+
case "Set":
|
|
1416
|
+
str = "[\"Set\"";
|
|
1417
|
+
for (const value of ops.valuesOf(thing)) str += `,${flatten(value)}`;
|
|
1418
|
+
str += "]";
|
|
1419
|
+
break;
|
|
1420
|
+
case "Map":
|
|
1421
|
+
str = "[\"Map\"";
|
|
1422
|
+
for (const [key, value] of ops.entriesOf(thing)) {
|
|
1423
|
+
const key_type = ops.typeOf(key);
|
|
1424
|
+
const key_is_primitive = key_type !== "object" && key_type !== "function" && key_type !== "symbol";
|
|
1425
|
+
keys.push(`.get(${key_is_primitive ? stringify_primitive(ops.toPrimitive(key)) : "..."})`);
|
|
1426
|
+
str += `,${flatten(key)},${flatten(value)}`;
|
|
1427
|
+
keys.pop();
|
|
1428
|
+
}
|
|
1429
|
+
str += "]";
|
|
1430
|
+
break;
|
|
1431
|
+
case "Int8Array":
|
|
1432
|
+
case "Uint8Array":
|
|
1433
|
+
case "Uint8ClampedArray":
|
|
1434
|
+
case "Int16Array":
|
|
1435
|
+
case "Uint16Array":
|
|
1436
|
+
case "Float16Array":
|
|
1437
|
+
case "Int32Array":
|
|
1438
|
+
case "Uint32Array":
|
|
1439
|
+
case "Float32Array":
|
|
1440
|
+
case "Float64Array":
|
|
1441
|
+
case "BigInt64Array":
|
|
1442
|
+
case "BigUint64Array": {
|
|
1443
|
+
const info = ops.viewInfo(thing);
|
|
1444
|
+
str = "[\"" + tag + "\"," + flatten(info.buffer);
|
|
1445
|
+
if (info.byteLength !== info.bufferByteLength) str += `,${info.byteOffset},${info.length}`;
|
|
1446
|
+
str += "]";
|
|
1447
|
+
break;
|
|
1448
|
+
}
|
|
1449
|
+
case "DataView": {
|
|
1450
|
+
const info = ops.viewInfo(thing);
|
|
1451
|
+
str = "[\"" + tag + "\"," + flatten(info.buffer);
|
|
1452
|
+
if (info.byteLength !== info.bufferByteLength) str += `,${info.byteOffset},${info.byteLength}`;
|
|
1453
|
+
str += "]";
|
|
1454
|
+
break;
|
|
1455
|
+
}
|
|
1456
|
+
case "ArrayBuffer":
|
|
1457
|
+
str = `["ArrayBuffer","${encode64(ops.toArrayBuffer(thing))}"]`;
|
|
1458
|
+
break;
|
|
1459
|
+
case "Temporal.Duration":
|
|
1460
|
+
case "Temporal.Instant":
|
|
1461
|
+
case "Temporal.PlainDate":
|
|
1462
|
+
case "Temporal.PlainTime":
|
|
1463
|
+
case "Temporal.PlainDateTime":
|
|
1464
|
+
case "Temporal.PlainMonthDay":
|
|
1465
|
+
case "Temporal.PlainYearMonth":
|
|
1466
|
+
case "Temporal.ZonedDateTime":
|
|
1467
|
+
str = `["${tag}",${stringify_string(ops.toStringValue(thing))}]`;
|
|
1468
|
+
break;
|
|
1469
|
+
default: {
|
|
1470
|
+
const shape = ops.shapeOf(thing);
|
|
1471
|
+
if (shape.kind === "not-plain") throw new DevalueError(`Cannot stringify arbitrary non-POJOs`, keys, thing, value);
|
|
1472
|
+
if (shape.kind === "symbol-keys") throw new DevalueError(`Cannot stringify POJOs with symbolic keys`, keys, thing, value);
|
|
1473
|
+
if (shape.kind === "null-proto") {
|
|
1474
|
+
str = "[\"null\"";
|
|
1475
|
+
for (const key of shape.keys) {
|
|
1476
|
+
if (key === "__proto__") throw new DevalueError(`Cannot stringify objects with __proto__ keys`, keys, thing, value);
|
|
1477
|
+
keys.push(stringify_key(key));
|
|
1478
|
+
str += `,${stringify_string(key)},${flatten(ops.get(thing, key))}`;
|
|
1479
|
+
keys.pop();
|
|
1480
|
+
}
|
|
1481
|
+
str += "]";
|
|
1482
|
+
} else {
|
|
1483
|
+
str = "{";
|
|
1484
|
+
let started = false;
|
|
1485
|
+
for (const key of shape.keys) {
|
|
1486
|
+
if (key === "__proto__") throw new DevalueError(`Cannot stringify objects with __proto__ keys`, keys, thing, value);
|
|
1487
|
+
if (started) str += ",";
|
|
1488
|
+
started = true;
|
|
1489
|
+
keys.push(stringify_key(key));
|
|
1490
|
+
str += `${stringify_string(key)}:${flatten(ops.get(thing, key))}`;
|
|
1491
|
+
keys.pop();
|
|
1492
|
+
}
|
|
1493
|
+
str += "}";
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
stringified[index] = str;
|
|
1499
|
+
return index;
|
|
1500
|
+
}
|
|
1501
|
+
const index = flatten(value);
|
|
1502
|
+
if (index < 0) return `${index}`;
|
|
1503
|
+
return stringified;
|
|
1504
|
+
}
|
|
1505
|
+
/**
|
|
1506
|
+
* @param {any} thing
|
|
1507
|
+
* @returns {string}
|
|
1508
|
+
*/
|
|
1509
|
+
function stringify_primitive(thing) {
|
|
1510
|
+
const type = typeof thing;
|
|
1511
|
+
if (type === "string") return stringify_string(thing);
|
|
1512
|
+
if (thing === void 0) return (-1).toString();
|
|
1513
|
+
if (thing === 0 && 1 / thing < 0) return (-6).toString();
|
|
1514
|
+
if (type === "bigint") return `["BigInt","${thing}"]`;
|
|
1515
|
+
return String(thing);
|
|
1516
|
+
}
|
|
1517
|
+
// ../../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/form-utils.js
|
|
1518
|
+
/** @import { BinaryFormMeta, InternalRemoteFormIssue } from 'types' */
|
|
1519
|
+
/** @import { StandardSchemaV1 } from '@standard-schema/spec' */
|
|
1520
|
+
/**
|
|
1521
|
+
* Sets a parsed form field value in a nested object, mutating the original object.
|
|
1522
|
+
* @param {Record<string, any>} object
|
|
1523
|
+
* @param {{ name: string; type: 'number' | 'boolean' | null }} field
|
|
1524
|
+
* @param {any} value
|
|
1525
|
+
*/
|
|
1526
|
+
function set_nested_value(object, field, value) {
|
|
1527
|
+
deep_set(object, split_path(field.name), value);
|
|
1528
|
+
}
|
|
1529
|
+
/**
|
|
1530
|
+
* Separates a form field's path from the metadata encoded in its name.
|
|
1531
|
+
* @param {string} form_id
|
|
1532
|
+
* @param {string} key
|
|
1533
|
+
* @returns {{ name: string; type: 'number' | 'boolean' | null; is_array: boolean }}
|
|
1534
|
+
*/
|
|
1535
|
+
function parse_form_key(form_id, key) {
|
|
1536
|
+
const suffix = "/" + form_id;
|
|
1537
|
+
let name = key;
|
|
1538
|
+
let image_coordinate = "";
|
|
1539
|
+
if (name.startsWith("i:") && (name.endsWith(suffix + ".x") || name.endsWith(suffix + ".y"))) {
|
|
1540
|
+
image_coordinate = name[name.length - 1];
|
|
1541
|
+
name = name.slice(0, -2);
|
|
1542
|
+
}
|
|
1543
|
+
if (!name.endsWith(suffix)) form_field_unbound({ name });
|
|
1544
|
+
name = name.slice(0, -suffix.length);
|
|
1545
|
+
/** @type {'number' | 'boolean' | null} */
|
|
1546
|
+
let type = null;
|
|
1547
|
+
if (name.startsWith("n:")) {
|
|
1548
|
+
name = name.slice(2);
|
|
1549
|
+
type = "number";
|
|
1550
|
+
} else if (name.startsWith("b:")) {
|
|
1551
|
+
name = name.slice(2);
|
|
1552
|
+
type = "boolean";
|
|
1553
|
+
} else if (name.startsWith("i:")) {
|
|
1554
|
+
name = name.slice(2);
|
|
1555
|
+
type = "number";
|
|
1556
|
+
}
|
|
1557
|
+
const is_array = name.endsWith("[]");
|
|
1558
|
+
if (is_array) name = name.slice(0, -2);
|
|
1559
|
+
if (image_coordinate) name += "." + image_coordinate;
|
|
1560
|
+
return {
|
|
1561
|
+
name,
|
|
1562
|
+
type,
|
|
1563
|
+
is_array
|
|
1564
|
+
};
|
|
1565
|
+
}
|
|
1566
|
+
/**
|
|
1567
|
+
* @param {'number' | 'boolean' | null} type
|
|
1568
|
+
* @param {any} value
|
|
1569
|
+
* @returns {any}
|
|
1570
|
+
*/
|
|
1571
|
+
function coerce_form_value(type, value) {
|
|
1572
|
+
if (Array.isArray(value)) return value.map((value) => coerce_form_value(type, value));
|
|
1573
|
+
if (type === "number") return value === "" ? void 0 : parseFloat(value);
|
|
1574
|
+
if (type === "boolean") return value === "on";
|
|
1575
|
+
return value;
|
|
1576
|
+
}
|
|
1577
|
+
/** Pass this to set_nested_value to delete the last part of the given path */
|
|
1578
|
+
var DELETE_KEY = {};
|
|
1579
|
+
/**
|
|
1580
|
+
* Groups `FormData` entries by name in a single pass. Calling `data.getAll(name)`
|
|
1581
|
+
* for each name is O(n²) in the number of entries, which is a DoS vector.
|
|
1582
|
+
* @param {FormData} data
|
|
1583
|
+
* @returns {Map<string, FormDataEntryValue[]>}
|
|
1584
|
+
*/
|
|
1585
|
+
function group_formdata(data) {
|
|
1586
|
+
/** @type {Map<string, FormDataEntryValue[]>} */
|
|
1587
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
1588
|
+
for (const [name, value] of data) {
|
|
1589
|
+
const values = grouped.get(name);
|
|
1590
|
+
if (values) values.push(value);
|
|
1591
|
+
else grouped.set(name, [value]);
|
|
1592
|
+
}
|
|
1593
|
+
return grouped;
|
|
1594
|
+
}
|
|
1595
|
+
/**
|
|
1596
|
+
* Convert `FormData` into a POJO
|
|
1597
|
+
* @param {string} form_id
|
|
1598
|
+
* @param {FormData} data
|
|
1599
|
+
*/
|
|
1600
|
+
function convert_formdata(form_id, data) {
|
|
1601
|
+
/** @type {Record<string, any>} */
|
|
1602
|
+
const result = {};
|
|
1603
|
+
for (const [field_name, values] of group_formdata(data)) {
|
|
1604
|
+
const field = parse_form_key(form_id, field_name);
|
|
1605
|
+
const entries = values.filter((entry) => typeof entry === "string" || entry.name !== "" || entry.size > 0);
|
|
1606
|
+
if (entries.length === 0 && !field.is_array) continue;
|
|
1607
|
+
if (entries.length > 1 && !field.is_array) form_field_duplicate({
|
|
1608
|
+
name: field.name,
|
|
1609
|
+
count: String(entries.length)
|
|
1610
|
+
});
|
|
1611
|
+
set_nested_value(result, field, coerce_form_value(field.type, field.is_array ? entries : entries[0]));
|
|
1612
|
+
}
|
|
1613
|
+
return result;
|
|
1614
|
+
}
|
|
1615
|
+
/**
|
|
1616
|
+
* Browsers don't submit unchecked checkboxes, unselected radio buttons or disabled controls, so
|
|
1617
|
+
* indexed fields like `items[3].done` can leave gaps in arrays. To prevent a small request from
|
|
1618
|
+
* creating huge arrays — whose cost is paid by anything that iterates over them, like a schema
|
|
1619
|
+
* validator — the total number of gaps across all arrays in a submission is limited
|
|
1620
|
+
*/
|
|
1621
|
+
var MAX_GAPS = 1e3;
|
|
1622
|
+
/**
|
|
1623
|
+
* Throws if arrays in form data converted from `FormData` have too many gaps
|
|
1624
|
+
* @param {Record<string, any>} data
|
|
1625
|
+
*/
|
|
1626
|
+
function check_gaps(data) {
|
|
1627
|
+
let gaps = 0;
|
|
1628
|
+
/** @type {Array<[value: unknown, name: string]>} */
|
|
1629
|
+
const stack = [[data, ""]];
|
|
1630
|
+
while (stack.length > 0) {
|
|
1631
|
+
const [value, name] = stack.pop();
|
|
1632
|
+
if (Array.isArray(value)) {
|
|
1633
|
+
const keys = Object.keys(value);
|
|
1634
|
+
gaps += value.length - keys.length;
|
|
1635
|
+
if (gaps > MAX_GAPS) form_field_too_many_gaps({ name });
|
|
1636
|
+
for (const key of keys) stack.push([value[key], `${name}[${key}]`]);
|
|
1637
|
+
} else if (value !== null && typeof value === "object") {
|
|
1638
|
+
if (Object.getPrototypeOf(value) !== Object.prototype) continue;
|
|
1639
|
+
for (const [key, entry] of Object.entries(value)) stack.push([entry, name === "" ? key : `${name}.${key}`]);
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
var BINARY_FORM_CONTENT_TYPE = "application/x-sveltekit-formdata";
|
|
1644
|
+
var BINARY_FORM_VERSION = 0;
|
|
1645
|
+
var HEADER_BYTES = 7;
|
|
1646
|
+
/** Smaller reads from the request body are combined until they reach this size */
|
|
1647
|
+
var MIN_CHUNK_SIZE = 16384;
|
|
1648
|
+
/**
|
|
1649
|
+
* @param {Request} request
|
|
1650
|
+
* @param {string} form_id
|
|
1651
|
+
* @returns {Promise<{ data: Record<string, any>; meta: BinaryFormMeta; form_data: FormData | null }>}
|
|
1652
|
+
*/
|
|
1653
|
+
async function deserialize_binary_form(request, form_id) {
|
|
1654
|
+
if (request.headers.get("content-type") !== "application/x-sveltekit-formdata") {
|
|
1655
|
+
const form_data = await request.formData();
|
|
1656
|
+
const data = convert_formdata(form_id, form_data);
|
|
1657
|
+
check_gaps(data);
|
|
1658
|
+
return {
|
|
1659
|
+
data,
|
|
1660
|
+
meta: {},
|
|
1661
|
+
form_data
|
|
1662
|
+
};
|
|
1663
|
+
}
|
|
1664
|
+
if (!request.body) throw deserialize_error("no body");
|
|
1665
|
+
const reader = request.body.getReader();
|
|
1666
|
+
/** @type {Array<Promise<Uint8Array<ArrayBuffer> | undefined>>} */
|
|
1667
|
+
const chunks = [];
|
|
1668
|
+
/**
|
|
1669
|
+
* Reads the next chunk, combining small reads so that the number of stored
|
|
1670
|
+
* chunks is bounded by the body size rather than by how the body was split up
|
|
1671
|
+
* @returns {Promise<Uint8Array<ArrayBuffer> | undefined>}
|
|
1672
|
+
*/
|
|
1673
|
+
async function read_chunk() {
|
|
1674
|
+
const first = await reader.read();
|
|
1675
|
+
if (first.done) return void 0;
|
|
1676
|
+
if (first.value.byteLength >= MIN_CHUNK_SIZE) return first.value;
|
|
1677
|
+
/** @type {Uint8Array<ArrayBuffer>[]} */
|
|
1678
|
+
const parts = [first.value];
|
|
1679
|
+
let size = first.value.byteLength;
|
|
1680
|
+
while (size < MIN_CHUNK_SIZE) {
|
|
1681
|
+
const { done, value } = await reader.read();
|
|
1682
|
+
if (done) break;
|
|
1683
|
+
parts.push(value);
|
|
1684
|
+
size += value.byteLength;
|
|
1685
|
+
}
|
|
1686
|
+
if (parts.length === 1) return parts[0];
|
|
1687
|
+
const chunk = new Uint8Array(size);
|
|
1688
|
+
let cursor = 0;
|
|
1689
|
+
for (const part of parts) {
|
|
1690
|
+
chunk.set(part, cursor);
|
|
1691
|
+
cursor += part.byteLength;
|
|
1692
|
+
}
|
|
1693
|
+
return chunk;
|
|
1694
|
+
}
|
|
1695
|
+
/**
|
|
1696
|
+
* @param {number} index
|
|
1697
|
+
* @returns {Promise<Uint8Array<ArrayBuffer> | undefined>}
|
|
1698
|
+
*/
|
|
1699
|
+
function get_chunk(index) {
|
|
1700
|
+
if (index in chunks) return chunks[index];
|
|
1701
|
+
let i = chunks.length;
|
|
1702
|
+
while (i <= index) {
|
|
1703
|
+
const previous = chunks[i - 1] ?? Promise.resolve(void 0);
|
|
1704
|
+
chunks[i] = previous.then(read_chunk);
|
|
1705
|
+
i++;
|
|
1706
|
+
}
|
|
1707
|
+
return chunks[index];
|
|
1708
|
+
}
|
|
1709
|
+
/**
|
|
1710
|
+
* @param {number} offset
|
|
1711
|
+
* @param {number} length
|
|
1712
|
+
* @returns {Promise<Uint8Array | null>}
|
|
1713
|
+
*/
|
|
1714
|
+
async function get_buffer(offset, length) {
|
|
1715
|
+
/** @type {Uint8Array<ArrayBuffer>[]} */
|
|
1716
|
+
const parts = [];
|
|
1717
|
+
let total = 0;
|
|
1718
|
+
for await (const part of read_range(get_chunk, offset, length)) {
|
|
1719
|
+
parts.push(part);
|
|
1720
|
+
total += part.byteLength;
|
|
1721
|
+
}
|
|
1722
|
+
if (total < length || parts.length === 0) return null;
|
|
1723
|
+
if (parts.length === 1) return parts[0];
|
|
1724
|
+
const buffer = new Uint8Array(length);
|
|
1725
|
+
let cursor = 0;
|
|
1726
|
+
for (const part of parts) {
|
|
1727
|
+
buffer.set(part, cursor);
|
|
1728
|
+
cursor += part.byteLength;
|
|
1729
|
+
}
|
|
1730
|
+
return buffer;
|
|
1731
|
+
}
|
|
1732
|
+
const header = await get_buffer(0, HEADER_BYTES);
|
|
1733
|
+
if (!header) throw deserialize_error("too short");
|
|
1734
|
+
if (header[0] !== BINARY_FORM_VERSION) throw deserialize_error(`got version ${header[0]}, expected version ${BINARY_FORM_VERSION}`);
|
|
1735
|
+
const header_view = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
1736
|
+
const data_length = header_view.getUint32(1, true);
|
|
1737
|
+
const file_offsets_length = header_view.getUint16(5, true);
|
|
1738
|
+
const data_buffer = await get_buffer(HEADER_BYTES, data_length);
|
|
1739
|
+
if (!data_buffer) throw deserialize_error("data too short");
|
|
1740
|
+
/** @type {Array<number | undefined>} */
|
|
1741
|
+
let file_offsets;
|
|
1742
|
+
/** @type {number} */
|
|
1743
|
+
let files_start_offset;
|
|
1744
|
+
if (file_offsets_length > 0) {
|
|
1745
|
+
const file_offsets_buffer = await get_buffer(HEADER_BYTES + data_length, file_offsets_length);
|
|
1746
|
+
if (!file_offsets_buffer) throw deserialize_error("file offset table too short");
|
|
1747
|
+
const parsed_offsets = JSON.parse(text_decoder.decode(file_offsets_buffer));
|
|
1748
|
+
if (!Array.isArray(parsed_offsets) || parsed_offsets.some((n) => typeof n !== "number" || !Number.isInteger(n) || n < 0)) throw deserialize_error("invalid file offset table");
|
|
1749
|
+
file_offsets = parsed_offsets;
|
|
1750
|
+
files_start_offset = HEADER_BYTES + data_length + file_offsets_length;
|
|
1751
|
+
}
|
|
1752
|
+
/** @type {Array<{ offset: number, size: number }>} */
|
|
1753
|
+
const file_spans = [];
|
|
1754
|
+
/** @type {unknown[][]} */
|
|
1755
|
+
const arrays = [];
|
|
1756
|
+
const [data, meta] = parse$1(text_decoder.decode(data_buffer), { File: ([name, type, size, last_modified, index]) => {
|
|
1757
|
+
if (typeof name !== "string" || typeof type !== "string" || !Number.isSafeInteger(size) || size < 0 || !Number.isSafeInteger(last_modified) || !Number.isSafeInteger(index) || index < 0 || file_offsets === void 0) throw deserialize_error("invalid file metadata");
|
|
1758
|
+
let offset = file_offsets[index];
|
|
1759
|
+
if (offset === void 0) throw deserialize_error("duplicate file offset table index");
|
|
1760
|
+
file_offsets[index] = void 0;
|
|
1761
|
+
offset += files_start_offset;
|
|
1762
|
+
file_spans.push({
|
|
1763
|
+
offset,
|
|
1764
|
+
size
|
|
1765
|
+
});
|
|
1766
|
+
return new Proxy(new LazyFile(name, type, size, last_modified, get_chunk, offset), { getPrototypeOf() {
|
|
1767
|
+
return File.prototype;
|
|
1768
|
+
} });
|
|
1769
|
+
} }, { operations: {
|
|
1770
|
+
createArray: (length) => {
|
|
1771
|
+
const array = default_parse_operations.createArray(length);
|
|
1772
|
+
arrays.push(array);
|
|
1773
|
+
return array;
|
|
1774
|
+
},
|
|
1775
|
+
createSparseArray: (length) => {
|
|
1776
|
+
const array = default_parse_operations.createSparseArray(length);
|
|
1777
|
+
arrays.push(array);
|
|
1778
|
+
return array;
|
|
1779
|
+
}
|
|
1780
|
+
} });
|
|
1781
|
+
let gaps = 0;
|
|
1782
|
+
for (const array of arrays) gaps += array.length - Object.keys(array).length;
|
|
1783
|
+
if (gaps > MAX_GAPS) throw deserialize_error("too many missing array indexes");
|
|
1784
|
+
file_spans.sort((a, b) => a.offset - b.offset || a.size - b.size);
|
|
1785
|
+
for (let i = 1; i < file_spans.length; i++) {
|
|
1786
|
+
const previous = file_spans[i - 1];
|
|
1787
|
+
const current = file_spans[i];
|
|
1788
|
+
const previous_end = previous.offset + previous.size;
|
|
1789
|
+
if (previous_end < current.offset) throw deserialize_error("gaps in file data");
|
|
1790
|
+
if (previous_end > current.offset) throw deserialize_error("overlapping file data");
|
|
1791
|
+
}
|
|
1792
|
+
(async () => {
|
|
1793
|
+
let has_more = true;
|
|
1794
|
+
while (has_more) has_more = !!await get_chunk(chunks.length);
|
|
1795
|
+
})().catch(noop);
|
|
1796
|
+
return {
|
|
1797
|
+
data,
|
|
1798
|
+
meta,
|
|
1799
|
+
form_data: null
|
|
1800
|
+
};
|
|
1801
|
+
}
|
|
1802
|
+
/**
|
|
1803
|
+
* @param {string} message
|
|
1804
|
+
*/
|
|
1805
|
+
function deserialize_error(message) {
|
|
1806
|
+
return new SvelteKitError(400, "Bad Request", `Could not deserialize binary form: ${message}`);
|
|
1807
|
+
}
|
|
1808
|
+
/**
|
|
1809
|
+
* Yields the chunks that make up the byte range `[offset, offset + length)`,
|
|
1810
|
+
* trimmed to its boundaries. Ends early if the underlying data runs out.
|
|
1811
|
+
* @param {(index: number) => Promise<Uint8Array<ArrayBuffer> | undefined>} get_chunk
|
|
1812
|
+
* @param {number} offset
|
|
1813
|
+
* @param {number} length
|
|
1814
|
+
* @returns {AsyncGenerator<Uint8Array<ArrayBuffer>, void, void>}
|
|
1815
|
+
*/
|
|
1816
|
+
async function* read_range(get_chunk, offset, length) {
|
|
1817
|
+
let chunk_start = 0;
|
|
1818
|
+
for (let index = 0;; index++) {
|
|
1819
|
+
const chunk = await get_chunk(index);
|
|
1820
|
+
if (!chunk) return;
|
|
1821
|
+
const chunk_end = chunk_start + chunk.byteLength;
|
|
1822
|
+
if (chunk_end > offset) {
|
|
1823
|
+
yield chunk.subarray(Math.max(0, offset - chunk_start), Math.min(chunk.byteLength, offset + length - chunk_start));
|
|
1824
|
+
if (offset + length <= chunk_end) return;
|
|
1825
|
+
}
|
|
1826
|
+
chunk_start = chunk_end;
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
/** @implements {File} */
|
|
1830
|
+
var LazyFile = class LazyFile {
|
|
1831
|
+
/** @type {(index: number) => Promise<Uint8Array<ArrayBuffer> | undefined>} */
|
|
1832
|
+
#get_chunk;
|
|
1833
|
+
/** @type {number} */
|
|
1834
|
+
#offset;
|
|
1835
|
+
/**
|
|
1836
|
+
* @param {string} name
|
|
1837
|
+
* @param {string} type
|
|
1838
|
+
* @param {number} size
|
|
1839
|
+
* @param {number} last_modified
|
|
1840
|
+
* @param {(index: number) => Promise<Uint8Array<ArrayBuffer> | undefined>} get_chunk
|
|
1841
|
+
* @param {number} offset
|
|
1842
|
+
*/
|
|
1843
|
+
constructor(name, type, size, last_modified, get_chunk, offset) {
|
|
1844
|
+
this.name = name;
|
|
1845
|
+
this.type = type;
|
|
1846
|
+
this.size = size;
|
|
1847
|
+
this.lastModified = last_modified;
|
|
1848
|
+
this.webkitRelativePath = "";
|
|
1849
|
+
this.#get_chunk = get_chunk;
|
|
1850
|
+
this.#offset = offset;
|
|
1851
|
+
this.arrayBuffer = this.arrayBuffer.bind(this);
|
|
1852
|
+
this.bytes = this.bytes.bind(this);
|
|
1853
|
+
this.slice = this.slice.bind(this);
|
|
1854
|
+
this.stream = this.stream.bind(this);
|
|
1855
|
+
this.text = this.text.bind(this);
|
|
1856
|
+
}
|
|
1857
|
+
/** @type {ArrayBuffer | undefined} */
|
|
1858
|
+
#buffer;
|
|
1859
|
+
async arrayBuffer() {
|
|
1860
|
+
this.#buffer ??= await new Response(this.stream()).arrayBuffer();
|
|
1861
|
+
return this.#buffer;
|
|
1862
|
+
}
|
|
1863
|
+
async bytes() {
|
|
1864
|
+
return new Uint8Array(await this.arrayBuffer());
|
|
1865
|
+
}
|
|
1866
|
+
/**
|
|
1867
|
+
* @param {number=} start
|
|
1868
|
+
* @param {number=} end
|
|
1869
|
+
* @param {string=} contentType
|
|
1870
|
+
*/
|
|
1871
|
+
slice(start = 0, end = this.size, contentType = this.type) {
|
|
1872
|
+
if (start < 0) start = Math.max(this.size + start, 0);
|
|
1873
|
+
else start = Math.min(start, this.size);
|
|
1874
|
+
if (end < 0) end = Math.max(this.size + end, 0);
|
|
1875
|
+
else end = Math.min(end, this.size);
|
|
1876
|
+
const size = Math.max(end - start, 0);
|
|
1877
|
+
return new LazyFile(this.name, contentType, size, this.lastModified, this.#get_chunk, this.#offset + start);
|
|
1878
|
+
}
|
|
1879
|
+
stream() {
|
|
1880
|
+
const range = read_range(this.#get_chunk, this.#offset, this.size);
|
|
1881
|
+
const size = this.size;
|
|
1882
|
+
return stream_from_iterable((async function* () {
|
|
1883
|
+
let cursor = 0;
|
|
1884
|
+
for await (const chunk of range) {
|
|
1885
|
+
cursor += chunk.byteLength;
|
|
1886
|
+
yield chunk;
|
|
1887
|
+
}
|
|
1888
|
+
if (cursor < size) throw new Error("incomplete file data");
|
|
1889
|
+
})());
|
|
1890
|
+
}
|
|
1891
|
+
async text() {
|
|
1892
|
+
return text_decoder.decode(await this.arrayBuffer());
|
|
1893
|
+
}
|
|
1894
|
+
};
|
|
1895
|
+
var path_regex = /^[a-zA-Z_$]\w*(\.[a-zA-Z_$]\w*|\[(?:0|[1-9]\d*)\])*$/;
|
|
1896
|
+
/** The largest valid array index */
|
|
1897
|
+
var MAX_ARRAY_INDEX = 2 ** 32 - 2;
|
|
1898
|
+
/**
|
|
1899
|
+
* @param {string} path
|
|
1900
|
+
*/
|
|
1901
|
+
function split_path(path) {
|
|
1902
|
+
if (!path_regex.test(path)) form_field_invalid_name({ name: path });
|
|
1903
|
+
const keys = path.split(/\.|\[|\]/).filter(Boolean);
|
|
1904
|
+
if (keys.some((key) => /^\d/.test(key) && Number(key) > MAX_ARRAY_INDEX)) form_field_invalid_name({ name: path });
|
|
1905
|
+
return keys;
|
|
1906
|
+
}
|
|
1907
|
+
/**
|
|
1908
|
+
* Check if a property key is dangerous and could lead to prototype pollution
|
|
1909
|
+
* @param {string} key
|
|
1910
|
+
*/
|
|
1911
|
+
function check_prototype_pollution(key) {
|
|
1912
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") form_field_forbidden_key({ key });
|
|
1913
|
+
}
|
|
1914
|
+
/**
|
|
1915
|
+
* Sets a value in a nested object using an array of keys, mutating the original object.
|
|
1916
|
+
* @param {Record<string, any>} object
|
|
1917
|
+
* @param {string[]} keys
|
|
1918
|
+
* @param {any} value
|
|
1919
|
+
*/
|
|
1920
|
+
function deep_set(object, keys, value) {
|
|
1921
|
+
let current = object;
|
|
1922
|
+
for (let i = 0; i < keys.length - 1; i += 1) {
|
|
1923
|
+
const key = keys[i];
|
|
1924
|
+
check_prototype_pollution(key);
|
|
1925
|
+
const is_array = /^\d+$/.test(keys[i + 1]);
|
|
1926
|
+
const inner = Object.hasOwn(current, key) ? current[key] : void 0;
|
|
1927
|
+
const exists = inner != null;
|
|
1928
|
+
if (exists && is_array !== Array.isArray(inner)) form_field_array_conflict({ key: keys[i + 1] });
|
|
1929
|
+
if (!exists) {
|
|
1930
|
+
if (value === DELETE_KEY) return;
|
|
1931
|
+
current[key] = is_array ? [] : {};
|
|
1932
|
+
}
|
|
1933
|
+
current = current[key];
|
|
1934
|
+
}
|
|
1935
|
+
const final_key = keys[keys.length - 1];
|
|
1936
|
+
check_prototype_pollution(final_key);
|
|
1937
|
+
if (value === DELETE_KEY) delete current[final_key];
|
|
1938
|
+
else current[final_key] = value;
|
|
1939
|
+
}
|
|
1940
|
+
/**
|
|
1941
|
+
* @param {StandardSchemaV1.Issue} issue
|
|
1942
|
+
* @param {boolean} server Whether this issue came from server validation
|
|
1943
|
+
*/
|
|
1944
|
+
function normalize_issue(issue, server = false) {
|
|
1945
|
+
/** @type {InternalRemoteFormIssue} */
|
|
1946
|
+
const normalized = {
|
|
1947
|
+
name: "",
|
|
1948
|
+
path: [],
|
|
1949
|
+
message: issue.message,
|
|
1950
|
+
server
|
|
1951
|
+
};
|
|
1952
|
+
if (issue.path !== void 0) {
|
|
1953
|
+
let name = "";
|
|
1954
|
+
for (const segment of issue.path) {
|
|
1955
|
+
const key = typeof segment === "object" ? segment.key : segment;
|
|
1956
|
+
normalized.path.push(key);
|
|
1957
|
+
if (typeof key === "number") name += `[${key}]`;
|
|
1958
|
+
else if (typeof key === "string") name += name === "" ? key : "." + key;
|
|
1959
|
+
}
|
|
1960
|
+
normalized.name = name;
|
|
1961
|
+
}
|
|
1962
|
+
return normalized;
|
|
1963
|
+
}
|
|
1964
|
+
/** @type {WeakMap<InternalRemoteFormIssue[], Record<string, InternalRemoteFormIssue[]>>} */
|
|
1965
|
+
var flattened_issues = /* @__PURE__ */ new WeakMap();
|
|
1966
|
+
/**
|
|
1967
|
+
* @param {InternalRemoteFormIssue[]} issues
|
|
1968
|
+
*/
|
|
1969
|
+
function flatten_issues(issues) {
|
|
1970
|
+
const cached = flattened_issues.get(issues);
|
|
1971
|
+
if (cached) return cached;
|
|
1972
|
+
/** @type {Record<string, InternalRemoteFormIssue[]>} */
|
|
1973
|
+
const result = Object.create(null);
|
|
1974
|
+
flattened_issues.set(issues, result);
|
|
1975
|
+
for (const issue of issues) {
|
|
1976
|
+
(result.$ ??= []).push(issue);
|
|
1977
|
+
let name = "";
|
|
1978
|
+
if (issue.path !== void 0) for (const key of issue.path) {
|
|
1979
|
+
if (typeof key === "number") name += `[${key}]`;
|
|
1980
|
+
else if (typeof key === "string") name += name === "" ? key : "." + key;
|
|
1981
|
+
(result[name] ??= []).push(issue);
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
return result;
|
|
1985
|
+
}
|
|
1986
|
+
/**
|
|
1987
|
+
* Gets a nested value from an object using a path array
|
|
1988
|
+
* @param {Record<string, any>} object
|
|
1989
|
+
* @param {(string | number)[]} path
|
|
1990
|
+
* @returns {any}
|
|
1991
|
+
*/
|
|
1992
|
+
function deep_get(object, path) {
|
|
1993
|
+
let current = object;
|
|
1994
|
+
for (const key of path) {
|
|
1995
|
+
if (current === null || typeof current !== "object" || !Object.hasOwn(current, key)) return;
|
|
1996
|
+
current = current[key];
|
|
1997
|
+
}
|
|
1998
|
+
return current;
|
|
1999
|
+
}
|
|
2000
|
+
/** name prefixes that tell the server which type to coerce a submitted string to */
|
|
2001
|
+
var type_prefixes = {
|
|
2002
|
+
number: "n:",
|
|
2003
|
+
boolean: "b:"
|
|
2004
|
+
};
|
|
2005
|
+
/**
|
|
2006
|
+
* adds props; a function becomes a getter that is computed each time it is read
|
|
2007
|
+
* @param {Record<string, any>} base_props
|
|
2008
|
+
* @param {Record<string, unknown>} props
|
|
2009
|
+
*/
|
|
2010
|
+
function add_props(base_props, props) {
|
|
2011
|
+
for (const prop in props) {
|
|
2012
|
+
const value = props[prop];
|
|
2013
|
+
if (typeof value === "function") Object.defineProperty(base_props, prop, {
|
|
2014
|
+
enumerable: true,
|
|
2015
|
+
get: value
|
|
2016
|
+
});
|
|
2017
|
+
else base_props[prop] = value;
|
|
2018
|
+
}
|
|
2019
|
+
return base_props;
|
|
2020
|
+
}
|
|
2021
|
+
/**
|
|
2022
|
+
* @param {string} type
|
|
2023
|
+
* @param {boolean} is_array
|
|
2024
|
+
* @param {unknown} input_value
|
|
2025
|
+
*/
|
|
2026
|
+
function get_type_prefix(type, is_array, input_value) {
|
|
2027
|
+
if (type === "number" || type === "range") return "n:";
|
|
2028
|
+
if (type === "image") return "i:";
|
|
2029
|
+
if (type === "checkbox" && !is_array) return "b:";
|
|
2030
|
+
if (type === "hidden" || type === "submit") return type_prefixes[typeof input_value] ?? "";
|
|
2031
|
+
return "";
|
|
2032
|
+
}
|
|
2033
|
+
/**
|
|
2034
|
+
* A deep-clone implementation specifically for form data, where
|
|
2035
|
+
* we don't need to worry about cycles and whatnot
|
|
2036
|
+
* @param {any} value
|
|
2037
|
+
* @returns {any}
|
|
2038
|
+
*/
|
|
2039
|
+
function deep_clone(value) {
|
|
2040
|
+
if (value !== null && typeof value === "object") {
|
|
2041
|
+
if (value instanceof Date) return new Date(value.getTime());
|
|
2042
|
+
if (value instanceof File) return value;
|
|
2043
|
+
if (Array.isArray(value)) return value.map(deep_clone);
|
|
2044
|
+
/** @type {Record<string, any>} */
|
|
2045
|
+
const clone = {};
|
|
2046
|
+
for (const key of Object.keys(value)) clone[key] = deep_clone(value[key]);
|
|
2047
|
+
return clone;
|
|
2048
|
+
}
|
|
2049
|
+
return value;
|
|
2050
|
+
}
|
|
2051
|
+
/** @type {ProxyHandler<object> | null} */
|
|
2052
|
+
var dev_traps = null;
|
|
2053
|
+
/** @param {InternalRemoteFormIssue} issue */
|
|
2054
|
+
var public_issue = (issue) => ({
|
|
2055
|
+
path: issue.path,
|
|
2056
|
+
message: issue.message
|
|
2057
|
+
});
|
|
2058
|
+
/** @typedef {{
|
|
2059
|
+
* form_id: string,
|
|
2060
|
+
* get: () => Record<string, any>,
|
|
2061
|
+
* set: (path: (string | number)[], value: any) => void,
|
|
2062
|
+
* get_issues: (path?: (string | number)[], all?: boolean) => Record<string, InternalRemoteFormIssue[]>,
|
|
2063
|
+
* get_touched: () => Record<string, boolean>,
|
|
2064
|
+
* get_dirty: () => Record<string, boolean>
|
|
2065
|
+
* }} FieldContext */
|
|
2066
|
+
/**
|
|
2067
|
+
* @param {FieldContext} context
|
|
2068
|
+
* @param {(string | number)[]} path
|
|
2069
|
+
* @param {string} prop
|
|
2070
|
+
* @returns {any} a method of the field at `path`, or undefined for a nested field
|
|
2071
|
+
*/
|
|
2072
|
+
function create_field_method(context, path, prop) {
|
|
2073
|
+
switch (prop) {
|
|
2074
|
+
case "set": return (value) => {
|
|
2075
|
+
context.set(path, value);
|
|
2076
|
+
return value;
|
|
2077
|
+
};
|
|
2078
|
+
case "value": return () => deep_clone(deep_get(context.get(), path));
|
|
2079
|
+
case "issues":
|
|
2080
|
+
case "allIssues": {
|
|
2081
|
+
const key = build_path_string(path);
|
|
2082
|
+
const all = prop === "allIssues";
|
|
2083
|
+
return () => {
|
|
2084
|
+
const issues = context.get_issues(path, all)[key === "" ? "$" : key];
|
|
2085
|
+
if (all) return issues?.map(public_issue);
|
|
2086
|
+
const own = issues?.filter((issue) => issue.name === key).map(public_issue);
|
|
2087
|
+
return own?.length ? own : void 0;
|
|
2088
|
+
};
|
|
2089
|
+
}
|
|
2090
|
+
case "touched":
|
|
2091
|
+
case "dirty": {
|
|
2092
|
+
const key = build_path_string(path);
|
|
2093
|
+
return () => {
|
|
2094
|
+
const object = prop === "dirty" ? context.get_dirty() : context.get_touched();
|
|
2095
|
+
if (Object.hasOwn(object, key)) return true;
|
|
2096
|
+
for (const candidate in object) {
|
|
2097
|
+
if (!Object.hasOwn(object, candidate)) continue;
|
|
2098
|
+
if (key === "") return true;
|
|
2099
|
+
if (!candidate.startsWith(key)) continue;
|
|
2100
|
+
const next = candidate[key.length];
|
|
2101
|
+
if (next === "." || next === "[") return true;
|
|
2102
|
+
}
|
|
2103
|
+
return false;
|
|
2104
|
+
};
|
|
2105
|
+
}
|
|
2106
|
+
case "as": {
|
|
2107
|
+
const key = build_path_string(path);
|
|
2108
|
+
/**
|
|
2109
|
+
* the field's value, or `fallback` until the field has been edited
|
|
2110
|
+
* (without a fallback there is nothing to suppress, so `dirty` is not read)
|
|
2111
|
+
* @param {unknown} [fallback]
|
|
2112
|
+
*/
|
|
2113
|
+
const read = (fallback) => deep_get(context.get(), path) ?? (fallback !== void 0 && Object.hasOwn(context.get_dirty(), key) ? void 0 : fallback);
|
|
2114
|
+
/**
|
|
2115
|
+
* @param {string} type
|
|
2116
|
+
* @param {unknown} [input_value]
|
|
2117
|
+
* @param {boolean} [checked]
|
|
2118
|
+
*/
|
|
2119
|
+
return (type, input_value, checked) => {
|
|
2120
|
+
const is_array = type === "file multiple" || type === "select multiple" || type === "checkbox" && typeof input_value === "string";
|
|
2121
|
+
/** @type {Record<string, any>} */
|
|
2122
|
+
const base_props = {
|
|
2123
|
+
name: get_type_prefix(type, is_array, input_value) + key + (is_array ? "[]" : "") + "/" + context.form_id,
|
|
2124
|
+
get "aria-invalid"() {
|
|
2125
|
+
const issues = context.get_issues();
|
|
2126
|
+
return key in issues ? "true" : void 0;
|
|
2127
|
+
}
|
|
2128
|
+
};
|
|
2129
|
+
if (type !== "text" && type !== "select" && type !== "select multiple") base_props.type = type === "file multiple" ? "file" : type;
|
|
2130
|
+
if (type === "submit" || type === "hidden") return add_props(base_props, { value: typeof input_value === "boolean" ? input_value ? "on" : "off" : input_value });
|
|
2131
|
+
if (type === "select" || type === "select multiple") return add_props(base_props, {
|
|
2132
|
+
multiple: is_array,
|
|
2133
|
+
value: () => {
|
|
2134
|
+
const value = read(input_value);
|
|
2135
|
+
return Array.isArray(value) ? [...value] : value;
|
|
2136
|
+
}
|
|
2137
|
+
});
|
|
2138
|
+
if (type === "checkbox" || type === "radio") {
|
|
2139
|
+
if (type === "radio" || is_array) base_props.value = input_value ?? "on";
|
|
2140
|
+
else checked = input_value;
|
|
2141
|
+
return add_props(base_props, {
|
|
2142
|
+
defaultChecked: checked,
|
|
2143
|
+
checked: () => {
|
|
2144
|
+
const value = read();
|
|
2145
|
+
if (value == null) return read(checked);
|
|
2146
|
+
if (type === "radio") return value === input_value;
|
|
2147
|
+
if (is_array) return value.includes(input_value);
|
|
2148
|
+
return value;
|
|
2149
|
+
}
|
|
2150
|
+
});
|
|
2151
|
+
}
|
|
2152
|
+
if (type === "file" || type === "file multiple") return add_props(base_props, {
|
|
2153
|
+
multiple: is_array,
|
|
2154
|
+
files: () => {
|
|
2155
|
+
const value = read();
|
|
2156
|
+
const files = value instanceof File ? [value] : value;
|
|
2157
|
+
if (!Array.isArray(files) || !files.every((f) => f instanceof File)) return null;
|
|
2158
|
+
if (typeof DataTransfer === "undefined") return Object.assign({ length: files.length }, files);
|
|
2159
|
+
const transfer = new DataTransfer();
|
|
2160
|
+
for (const file of files) transfer.items.add(file);
|
|
2161
|
+
return transfer.files;
|
|
2162
|
+
}
|
|
2163
|
+
});
|
|
2164
|
+
if (type === "image") return base_props;
|
|
2165
|
+
return add_props(base_props, {
|
|
2166
|
+
defaultValue: input_value,
|
|
2167
|
+
value: () => String(read(input_value) ?? "")
|
|
2168
|
+
});
|
|
2169
|
+
};
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
/**
|
|
2174
|
+
* Creates a proxy-based field accessor for form data
|
|
2175
|
+
* @param {FieldContext} context
|
|
2176
|
+
* @param {any} target - Function or empty POJO
|
|
2177
|
+
* @param {(string | number)[]} path - Current access path
|
|
2178
|
+
* @returns {any} Proxy object with name(), value(), and issues() methods
|
|
2179
|
+
*/
|
|
2180
|
+
function create_field_proxy(context, target = {}, path = []) {
|
|
2181
|
+
return new Proxy(target, {
|
|
2182
|
+
...dev_traps,
|
|
2183
|
+
get(target, prop) {
|
|
2184
|
+
if (typeof prop === "symbol") return target[prop];
|
|
2185
|
+
const next = [...path, /^\d+$/.test(prop) ? parseInt(prop, 10) : prop];
|
|
2186
|
+
return create_field_proxy(context, create_field_method(context, path, prop), next);
|
|
2187
|
+
}
|
|
2188
|
+
});
|
|
2189
|
+
}
|
|
2190
|
+
/**
|
|
2191
|
+
* Builds a path string from an array of path segments
|
|
2192
|
+
* @param {(string | number)[]} path
|
|
2193
|
+
* @returns {string}
|
|
2194
|
+
*/
|
|
2195
|
+
function build_path_string(path) {
|
|
2196
|
+
let result = "";
|
|
2197
|
+
for (const segment of path) if (typeof segment === "number") result += `[${segment}]`;
|
|
2198
|
+
else result += result === "" ? segment : "." + segment;
|
|
2199
|
+
return result;
|
|
2200
|
+
}
|
|
2201
|
+
// ../../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/http.js
|
|
2202
|
+
/**
|
|
2203
|
+
* Given an Accept header and a list of possible content types, pick
|
|
2204
|
+
* the most suitable one to respond with
|
|
2205
|
+
* @param {string} accept
|
|
2206
|
+
* @param {string[]} types
|
|
2207
|
+
*/
|
|
2208
|
+
function negotiate(accept, types) {
|
|
2209
|
+
/** @type {Array<{ type: string, subtype: string, q: number, i: number }>} */
|
|
2210
|
+
const parts = [];
|
|
2211
|
+
accept.split(",").forEach((str, i) => {
|
|
2212
|
+
const match = /^[ \t]*([^/ \t]+)\/([^; \t]+)[ \t]*(?:;[ \t]*q=([0-9.]+))?/.exec(str);
|
|
2213
|
+
if (match) {
|
|
2214
|
+
const [, type, subtype, q = "1"] = match;
|
|
2215
|
+
parts.push({
|
|
2216
|
+
type,
|
|
2217
|
+
subtype,
|
|
2218
|
+
q: +q,
|
|
2219
|
+
i
|
|
2220
|
+
});
|
|
2221
|
+
}
|
|
2222
|
+
});
|
|
2223
|
+
parts.sort((a, b) => {
|
|
2224
|
+
if (a.q !== b.q) return b.q - a.q;
|
|
2225
|
+
if (a.subtype === "*" !== (b.subtype === "*")) return a.subtype === "*" ? 1 : -1;
|
|
2226
|
+
if (a.type === "*" !== (b.type === "*")) return a.type === "*" ? 1 : -1;
|
|
2227
|
+
return a.i - b.i;
|
|
2228
|
+
});
|
|
2229
|
+
let accepted;
|
|
2230
|
+
let min_priority = 1e400;
|
|
2231
|
+
for (const mimetype of types) {
|
|
2232
|
+
const [type, subtype] = mimetype.split("/");
|
|
2233
|
+
const priority = parts.findIndex((part) => (part.type === type || part.type === "*") && (part.subtype === subtype || part.subtype === "*"));
|
|
2234
|
+
if (priority !== -1 && priority < min_priority) {
|
|
2235
|
+
accepted = mimetype;
|
|
2236
|
+
min_priority = priority;
|
|
2237
|
+
}
|
|
2238
|
+
}
|
|
2239
|
+
return accepted;
|
|
2240
|
+
}
|
|
2241
|
+
/**
|
|
2242
|
+
* Returns `true` if a `content-type` header value is one of the given types, ignoring
|
|
2243
|
+
* parameters such as `charset` and comparing case-insensitively
|
|
2244
|
+
* @param {string | null | undefined} header
|
|
2245
|
+
* @param {...string} types
|
|
2246
|
+
*/
|
|
2247
|
+
function matches_content_type(header, ...types) {
|
|
2248
|
+
const type = header?.split(";", 1)[0].trim() ?? "";
|
|
2249
|
+
return types.includes(type.toLowerCase());
|
|
2250
|
+
}
|
|
2251
|
+
/**
|
|
2252
|
+
* @param {Request} request
|
|
2253
|
+
*/
|
|
2254
|
+
function is_form_content_type(request) {
|
|
2255
|
+
return matches_content_type(request.headers.get("content-type"), "application/x-www-form-urlencoded", "multipart/form-data", "text/plain", BINARY_FORM_CONTENT_TYPE);
|
|
2256
|
+
}
|
|
2257
|
+
// ../../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/app/internal/transport.js
|
|
2258
|
+
/** @import { Transport } from '@sveltejs/kit/hooks' */
|
|
2259
|
+
/** @type {(thing: any) => string} */
|
|
2260
|
+
var uneval = () => {
|
|
2261
|
+
throw new Error("");
|
|
2262
|
+
};
|
|
2263
|
+
/** @type {(data: any) => string} */
|
|
2264
|
+
var stringify = () => {
|
|
2265
|
+
throw new Error("");
|
|
2266
|
+
};
|
|
2267
|
+
/** @type {(data: string) => any} */
|
|
2268
|
+
var parse = () => {
|
|
2269
|
+
throw new Error("");
|
|
2270
|
+
};
|
|
2271
|
+
/** @type {Record<string, (data: any) => any>} */
|
|
2272
|
+
var encoders = {};
|
|
2273
|
+
/** @type {Record<string, (data: any) => any>} */
|
|
2274
|
+
var decoders = {};
|
|
2275
|
+
var has_custom_transporters = false;
|
|
2276
|
+
/**
|
|
2277
|
+
*
|
|
2278
|
+
* @param {Transport} transport
|
|
2279
|
+
*/
|
|
2280
|
+
function init_transport(transport) {
|
|
2281
|
+
const transporters = Object.entries(transport);
|
|
2282
|
+
has_custom_transporters = transporters.length > 0;
|
|
2283
|
+
/** @param {unknown} thing */
|
|
2284
|
+
const replacer = (thing) => {
|
|
2285
|
+
for (const key of Object.keys(transport)) {
|
|
2286
|
+
const encoded = transport[key].encode(thing);
|
|
2287
|
+
if (encoded) return `app.decode('${key}', ${uneval$1(encoded, replacer)})`;
|
|
2288
|
+
}
|
|
2289
|
+
};
|
|
2290
|
+
encoders = Object.fromEntries(transporters.map(([k, v]) => [k, v.encode]));
|
|
2291
|
+
decoders = Object.fromEntries(transporters.map(([k, v]) => [k, v.decode]));
|
|
2292
|
+
uneval = (data) => uneval$1(data, replacer);
|
|
2293
|
+
stringify = (data) => stringify$1(data, encoders);
|
|
2294
|
+
parse = (data) => parse$1(data, decoders);
|
|
2295
|
+
}
|
|
2296
|
+
// ../../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/shared.js
|
|
2297
|
+
/**
|
|
2298
|
+
* Same-origin urls are keyed by path, so prerendered pages can be served from any origin
|
|
2299
|
+
* @param {URL} url
|
|
2300
|
+
* @param {{ origin: string }} page
|
|
2301
|
+
*/
|
|
2302
|
+
function fetch_cache_url(url, page) {
|
|
2303
|
+
return url.origin === page.origin ? url.href.slice(page.origin.length) : url.href;
|
|
2304
|
+
}
|
|
2305
|
+
var INVALIDATED_PARAM = "x-sveltekit-invalidated";
|
|
2306
|
+
var TRAILING_SLASH_PARAM = "x-sveltekit-trailing-slash";
|
|
2307
|
+
var object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
|
|
2308
|
+
/**
|
|
2309
|
+
* @param {unknown} thing
|
|
2310
|
+
* @returns {thing is Record<PropertyKey, unknown>}
|
|
2311
|
+
*/
|
|
2312
|
+
function is_plain_object(thing) {
|
|
2313
|
+
if (typeof thing !== "object" || thing === null) return false;
|
|
2314
|
+
const proto = Object.getPrototypeOf(thing);
|
|
2315
|
+
return proto === Object.prototype || proto === null || Object.getPrototypeOf(proto) === null || Object.getOwnPropertyNames(proto).sort().join("\0") === object_proto_names;
|
|
2316
|
+
}
|
|
2317
|
+
/**
|
|
2318
|
+
* @param {Record<string, any>} value
|
|
2319
|
+
* @param {Map<object, any>} clones
|
|
2320
|
+
*/
|
|
2321
|
+
function to_sorted(value, clones) {
|
|
2322
|
+
const clone = Object.getPrototypeOf(value) === null ? Object.create(null) : {};
|
|
2323
|
+
clones.set(value, clone);
|
|
2324
|
+
Object.defineProperty(clone, remote_arg_marker, { value: true });
|
|
2325
|
+
for (const key of Object.keys(value).sort()) {
|
|
2326
|
+
const property = value[key];
|
|
2327
|
+
Object.defineProperty(clone, key, {
|
|
2328
|
+
value: clones.get(property) ?? property,
|
|
2329
|
+
enumerable: true,
|
|
2330
|
+
configurable: true,
|
|
2331
|
+
writable: true
|
|
2332
|
+
});
|
|
2333
|
+
}
|
|
2334
|
+
return clone;
|
|
2335
|
+
}
|
|
2336
|
+
var remote_object = "__skrao";
|
|
2337
|
+
var remote_map = "__skram";
|
|
2338
|
+
var remote_set = "__skras";
|
|
2339
|
+
var remote_file = "__skraf";
|
|
2340
|
+
var remote_regex_guard = "__skrag";
|
|
2341
|
+
var remote_arg_marker = Symbol(remote_object);
|
|
2342
|
+
/**
|
|
2343
|
+
* @param {boolean} sort
|
|
2344
|
+
*/
|
|
2345
|
+
function create_remote_arg_reducers(sort) {
|
|
2346
|
+
/** @type {Record<string, (value: unknown) => unknown>} */
|
|
2347
|
+
const remote_fns_reducers = {
|
|
2348
|
+
/** @param {unknown} value */
|
|
2349
|
+
[remote_regex_guard]: (value) => {
|
|
2350
|
+
if (value instanceof RegExp) remote_argument_unsupported({ type: "Regular expressions" });
|
|
2351
|
+
} };
|
|
2352
|
+
if (sort) {
|
|
2353
|
+
const clones = /* @__PURE__ */ new Map();
|
|
2354
|
+
/** @type {(value: unknown) => Array<[unknown, unknown]> | undefined} */
|
|
2355
|
+
remote_fns_reducers[remote_map] = (value) => {
|
|
2356
|
+
if (!(value instanceof Map)) return;
|
|
2357
|
+
/** @type {Array<[string, string]>} */
|
|
2358
|
+
const entries = [];
|
|
2359
|
+
for (const [key, val] of value) entries.push([stringify(key), stringify(val)]);
|
|
2360
|
+
return entries.sort(([a1, a2], [b1, b2]) => {
|
|
2361
|
+
if (a1 < b1) return -1;
|
|
2362
|
+
if (a1 > b1) return 1;
|
|
2363
|
+
if (a2 < b2) return -1;
|
|
2364
|
+
if (a2 > b2) return 1;
|
|
2365
|
+
return 0;
|
|
2366
|
+
});
|
|
2367
|
+
};
|
|
2368
|
+
/** @type {(value: unknown) => unknown[] | undefined} */
|
|
2369
|
+
remote_fns_reducers[remote_set] = (value) => {
|
|
2370
|
+
if (!(value instanceof Set)) return;
|
|
2371
|
+
/** @type {string[]} */
|
|
2372
|
+
const items = [];
|
|
2373
|
+
for (const item of value) items.push(stringify(item));
|
|
2374
|
+
items.sort();
|
|
2375
|
+
return items;
|
|
2376
|
+
};
|
|
2377
|
+
/** @type {(value: unknown) => Record<PropertyKey, unknown> | undefined} */
|
|
2378
|
+
remote_fns_reducers[remote_object] = (value) => {
|
|
2379
|
+
if (!is_plain_object(value)) return;
|
|
2380
|
+
if (Object.hasOwn(value, remote_arg_marker)) return;
|
|
2381
|
+
if (clones.has(value)) return clones.get(value);
|
|
2382
|
+
return to_sorted(value, clones);
|
|
2383
|
+
};
|
|
2384
|
+
}
|
|
2385
|
+
const all_reducers = {
|
|
2386
|
+
...encoders,
|
|
2387
|
+
...remote_fns_reducers
|
|
2388
|
+
};
|
|
2389
|
+
/** @type {(value: unknown) => string} */
|
|
2390
|
+
const stringify = (value) => stringify$1(value, all_reducers);
|
|
2391
|
+
return all_reducers;
|
|
2392
|
+
}
|
|
2393
|
+
function create_remote_arg_revivers() {
|
|
2394
|
+
const remote_fns_revivers = {
|
|
2395
|
+
/** @type {(value: unknown) => unknown} */
|
|
2396
|
+
[remote_object]: (value) => value,
|
|
2397
|
+
/** @type {(value: unknown) => Map<unknown, unknown>} */
|
|
2398
|
+
[remote_map]: (value) => {
|
|
2399
|
+
if (!Array.isArray(value)) throw new Error("Invalid data for Map reviver");
|
|
2400
|
+
const map = /* @__PURE__ */ new Map();
|
|
2401
|
+
for (const item of value) {
|
|
2402
|
+
if (!Array.isArray(item) || item.length !== 2 || typeof item[0] !== "string" || typeof item[1] !== "string") throw new Error("Invalid data for Map reviver");
|
|
2403
|
+
const [key, val] = item;
|
|
2404
|
+
map.set(parse(key), parse(val));
|
|
2405
|
+
}
|
|
2406
|
+
return map;
|
|
2407
|
+
},
|
|
2408
|
+
/** @type {(value: unknown) => Set<unknown>} */
|
|
2409
|
+
[remote_set]: (value) => {
|
|
2410
|
+
if (!Array.isArray(value)) throw new Error("Invalid data for Set reviver");
|
|
2411
|
+
const set = /* @__PURE__ */ new Set();
|
|
2412
|
+
for (const item of value) {
|
|
2413
|
+
if (typeof item !== "string") throw new Error("Invalid data for Set reviver");
|
|
2414
|
+
set.add(parse(item));
|
|
2415
|
+
}
|
|
2416
|
+
return set;
|
|
2417
|
+
},
|
|
2418
|
+
/** @type {(value: any) => File} */
|
|
2419
|
+
[remote_file]: (value) => {
|
|
2420
|
+
if (!value || typeof value !== "object" || typeof value.name !== "string" || typeof value.type !== "string" || typeof value.size !== "number" || typeof value.lastModified !== "number" || !(value.data instanceof ArrayBuffer)) throw new Error("Invalid data for File reviver");
|
|
2421
|
+
const { data, name, ...meta } = value;
|
|
2422
|
+
return new File([data], name, meta);
|
|
2423
|
+
}
|
|
2424
|
+
};
|
|
2425
|
+
const all_revivers = {
|
|
2426
|
+
...decoders,
|
|
2427
|
+
...remote_fns_revivers
|
|
2428
|
+
};
|
|
2429
|
+
/** @type {(data: string) => unknown} */
|
|
2430
|
+
const parse = (data) => parse$1(data, all_revivers);
|
|
2431
|
+
return all_revivers;
|
|
2432
|
+
}
|
|
2433
|
+
/**
|
|
2434
|
+
* Stringifies the argument (if any) for a remote function in such a way that
|
|
2435
|
+
* it is both a valid URL and a valid file name (necessary for prerendering).
|
|
2436
|
+
* @param {any} value
|
|
2437
|
+
*/
|
|
2438
|
+
function stringify_remote_arg(value) {
|
|
2439
|
+
if (value === void 0) return "";
|
|
2440
|
+
return url_friendly_base64_encode(stringify$1(value, create_remote_arg_reducers(true)));
|
|
2441
|
+
}
|
|
2442
|
+
/**
|
|
2443
|
+
* Base64-encodes `string` in such a way that the result is safe to use
|
|
2444
|
+
* as both a URI component and a filename
|
|
2445
|
+
* @param {string} string
|
|
2446
|
+
*/
|
|
2447
|
+
function url_friendly_base64_encode(string) {
|
|
2448
|
+
return base64_encode(text_encoder.encode(string)).replaceAll("=", "").replaceAll("+", "-").replaceAll("/", "_");
|
|
2449
|
+
}
|
|
2450
|
+
/**
|
|
2451
|
+
* Parses the argument (if any) for a remote function
|
|
2452
|
+
* @param {string} string
|
|
2453
|
+
*/
|
|
2454
|
+
function parse_remote_arg(string) {
|
|
2455
|
+
if (!string) return void 0;
|
|
2456
|
+
return parse$1(text_decoder.decode(base64_decode(string.replaceAll("-", "+").replaceAll("_", "/"))), create_remote_arg_revivers());
|
|
2457
|
+
}
|
|
2458
|
+
/**
|
|
2459
|
+
* @param {string} id
|
|
2460
|
+
* @param {string} payload
|
|
2461
|
+
*/
|
|
2462
|
+
function create_remote_key(id, payload) {
|
|
2463
|
+
return id + "/" + payload;
|
|
2464
|
+
}
|
|
2465
|
+
/**
|
|
2466
|
+
* @param {string} key
|
|
2467
|
+
* @returns {{ id: string; payload: string }}
|
|
2468
|
+
*/
|
|
2469
|
+
function split_remote_key(key) {
|
|
2470
|
+
const i = key.lastIndexOf("/");
|
|
2471
|
+
if (i === -1) throw new Error(`Invalid remote key: ${key}`);
|
|
2472
|
+
return {
|
|
2473
|
+
id: key.slice(0, i),
|
|
2474
|
+
payload: key.slice(i + 1)
|
|
2475
|
+
};
|
|
2476
|
+
}
|
|
2477
|
+
// ../../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/error.js
|
|
2478
|
+
/**
|
|
2479
|
+
* @param {Error} error
|
|
2480
|
+
* @param {string} stack
|
|
2481
|
+
* @returns {string | undefined}
|
|
2482
|
+
*/
|
|
2483
|
+
function set_error_stack(error, stack) {
|
|
2484
|
+
try {
|
|
2485
|
+
Reflect.set(error, "stack", stack);
|
|
2486
|
+
} catch {}
|
|
2487
|
+
return error.stack;
|
|
2488
|
+
}
|
|
2489
|
+
/**
|
|
2490
|
+
* @param {unknown} err
|
|
2491
|
+
* @return {Error}
|
|
2492
|
+
*/
|
|
2493
|
+
function coalesce_to_error(err) {
|
|
2494
|
+
return err instanceof Error || err && err.name && err.message ? err : new Error(JSON.stringify(err));
|
|
2495
|
+
}
|
|
2496
|
+
/**
|
|
2497
|
+
* This is an identity function that exists to make TypeScript less
|
|
2498
|
+
* paranoid about people throwing things that aren't errors, which
|
|
2499
|
+
* frankly is not something we should care about
|
|
2500
|
+
* @param {unknown} error
|
|
2501
|
+
*/
|
|
2502
|
+
function normalize_error(error) {
|
|
2503
|
+
return error;
|
|
2504
|
+
}
|
|
2505
|
+
/**
|
|
2506
|
+
* @param {unknown} error
|
|
2507
|
+
*/
|
|
2508
|
+
function get_status(error) {
|
|
2509
|
+
return error instanceof HttpError || error instanceof SvelteKitError ? error.status : 500;
|
|
2510
|
+
}
|
|
2511
|
+
// ../../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/messages/server-warnings.js
|
|
2512
|
+
/**
|
|
2513
|
+
* To use an async `handleError` hook to handle errors that occur during rendering, you must enable `compilerOptions.experimental.async` in the SvelteKit plugin of your Vite config. The returned error has been replaced with a generic object
|
|
2514
|
+
* @param {void} _values
|
|
2515
|
+
*/
|
|
2516
|
+
function handle_error_async_without_async_svelte(_values) {
|
|
2517
|
+
console.warn("https://svelte.dev/e/kit/handle_error_async_without_async_svelte");
|
|
2518
|
+
}
|
|
2519
|
+
// ../../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/errors.js
|
|
2520
|
+
/**
|
|
2521
|
+
* @param {import('@sveltejs/kit').RequestEvent} event
|
|
2522
|
+
* @param {import('types').RequestState} state
|
|
2523
|
+
* @param {any} error
|
|
2524
|
+
* @returns {App.Error | Promise<App.Error>}
|
|
2525
|
+
*/
|
|
2526
|
+
function handle_error_and_jsonify(event, state, error) {
|
|
2527
|
+
if (error instanceof HandledHttpError) return error.body;
|
|
2528
|
+
/** @type {import('@sveltejs/kit/hooks').CaughtError} */
|
|
2529
|
+
let caught;
|
|
2530
|
+
if (error instanceof HttpError) caught = {
|
|
2531
|
+
kind: "app",
|
|
2532
|
+
error: error.body
|
|
2533
|
+
};
|
|
2534
|
+
else if (error instanceof SvelteKitError) caught = {
|
|
2535
|
+
kind: "framework",
|
|
2536
|
+
error: {
|
|
2537
|
+
status: error.status,
|
|
2538
|
+
message: error.text
|
|
2539
|
+
}
|
|
2540
|
+
};
|
|
2541
|
+
else if (error instanceof ValidationError) caught = {
|
|
2542
|
+
kind: "validation",
|
|
2543
|
+
error: {
|
|
2544
|
+
status: 400,
|
|
2545
|
+
message: "Bad Request"
|
|
2546
|
+
},
|
|
2547
|
+
issues: error.issues,
|
|
2548
|
+
remote: error.remote
|
|
2549
|
+
};
|
|
2550
|
+
else {
|
|
2551
|
+
caught = {
|
|
2552
|
+
kind: "unknown",
|
|
2553
|
+
error
|
|
2554
|
+
};
|
|
2555
|
+
let e = error;
|
|
2556
|
+
while (e instanceof Error) {
|
|
2557
|
+
fix_stack_trace(e);
|
|
2558
|
+
e = e.cause;
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
const fallback = caught.kind === "unknown" ? {
|
|
2562
|
+
status: 500,
|
|
2563
|
+
message: "Internal Error"
|
|
2564
|
+
} : caught.error;
|
|
2565
|
+
/**
|
|
2566
|
+
* The hook returns only the properties it wants to override; anything it omits
|
|
2567
|
+
* (including by returning nothing at all) is inherited from the caught error.
|
|
2568
|
+
* @param {Awaited<ReturnType<import('@sveltejs/kit/hooks').HandleServerError>>} body
|
|
2569
|
+
* @returns {App.Error}
|
|
2570
|
+
*/
|
|
2571
|
+
function merge(body) {
|
|
2572
|
+
return {
|
|
2573
|
+
...fallback,
|
|
2574
|
+
...body
|
|
2575
|
+
};
|
|
2576
|
+
}
|
|
2577
|
+
let result;
|
|
2578
|
+
try {
|
|
2579
|
+
const input = {
|
|
2580
|
+
...caught,
|
|
2581
|
+
event
|
|
2582
|
+
};
|
|
2583
|
+
result = with_request_store({
|
|
2584
|
+
event,
|
|
2585
|
+
state
|
|
2586
|
+
}, () => hooks.handleError(input));
|
|
2587
|
+
} catch (hook_error) {
|
|
2588
|
+
log_handle_error_hook_failure(error, hook_error);
|
|
2589
|
+
return {
|
|
2590
|
+
status: fallback.status,
|
|
2591
|
+
message: "Internal Error"
|
|
2592
|
+
};
|
|
2593
|
+
}
|
|
2594
|
+
if (result instanceof Promise) {
|
|
2595
|
+
if (state.is_in_render) {
|
|
2596
|
+
handle_error_async_without_async_svelte();
|
|
2597
|
+
result.catch((hook_error) => log_handle_error_hook_failure(error, hook_error));
|
|
2598
|
+
return {
|
|
2599
|
+
status: fallback.status,
|
|
2600
|
+
message: "Internal Error"
|
|
2601
|
+
};
|
|
2602
|
+
}
|
|
2603
|
+
return result.then(merge, (hook_error) => {
|
|
2604
|
+
log_handle_error_hook_failure(error, hook_error);
|
|
2605
|
+
return {
|
|
2606
|
+
status: fallback.status,
|
|
2607
|
+
message: "Internal Error"
|
|
2608
|
+
};
|
|
2609
|
+
});
|
|
2610
|
+
}
|
|
2611
|
+
return merge(result);
|
|
2612
|
+
}
|
|
2613
|
+
/**
|
|
2614
|
+
* @param {unknown} error
|
|
2615
|
+
* @param {unknown} hook_error
|
|
2616
|
+
*/
|
|
2617
|
+
function log_handle_error_hook_failure(error, hook_error) {
|
|
2618
|
+
const failure = capture_error(() => handle_error_hook_failed(void 0, { cause: coalesce_to_error(hook_error) }));
|
|
2619
|
+
failure.stack = `${failure.name}: ${failure.message}`;
|
|
2620
|
+
console.error(failure);
|
|
2621
|
+
if (error instanceof SvelteKitError) console.error(`Original error: ${error.status} ${error.text}: ${error.message}`);
|
|
2622
|
+
else console.error("Original error:", error);
|
|
2623
|
+
}
|
|
2624
|
+
/**
|
|
2625
|
+
* @param {import('@sveltejs/kit/hooks').CaughtError & { event: import('@sveltejs/kit').RequestEvent }} input
|
|
2626
|
+
*/
|
|
2627
|
+
function default_handle_error({ kind, error, issues, remote }) {
|
|
2628
|
+
if (kind === "validation") {
|
|
2629
|
+
let fn;
|
|
2630
|
+
if (remote?.name && remote.file) fn = `${remote.name} (${remote.file})`;
|
|
2631
|
+
else if (remote?.name) fn = remote.name;
|
|
2632
|
+
console.error(`Remote function ${fn ? fn + " " : ""}schema validation failed:`, issues);
|
|
2633
|
+
return;
|
|
2634
|
+
}
|
|
2635
|
+
if (kind !== "unknown") return;
|
|
2636
|
+
let e = error;
|
|
2637
|
+
while (e instanceof Error) {
|
|
2638
|
+
if (e.stack) console.error(e.stack);
|
|
2639
|
+
e = e.cause;
|
|
2640
|
+
}
|
|
2641
|
+
if (e) console.error(String(e));
|
|
2642
|
+
}
|
|
2643
|
+
// ../../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/utils.js
|
|
2644
|
+
/**
|
|
2645
|
+
* @param {Partial<Record<import('types').HttpMethod, any>>} mod
|
|
2646
|
+
* @param {import('types').HttpMethod} method
|
|
2647
|
+
*/
|
|
2648
|
+
function method_not_allowed(mod, method) {
|
|
2649
|
+
return text(`${method} method not allowed`, {
|
|
2650
|
+
status: 405,
|
|
2651
|
+
headers: { allow: allowed_methods(mod).join(", ") }
|
|
2652
|
+
});
|
|
2653
|
+
}
|
|
2654
|
+
/** @param {Partial<Record<import('types').HttpMethod, any>>} mod */
|
|
2655
|
+
function allowed_methods(mod) {
|
|
2656
|
+
const allowed = ENDPOINT_METHODS.filter((method) => method in mod);
|
|
2657
|
+
if ("GET" in mod && !("HEAD" in mod)) allowed.push("HEAD");
|
|
2658
|
+
return allowed;
|
|
2659
|
+
}
|
|
2660
|
+
/**
|
|
2661
|
+
* @param {number} status
|
|
2662
|
+
* @param {string} location
|
|
2663
|
+
*/
|
|
2664
|
+
function redirect_response(status, location) {
|
|
2665
|
+
return new Response(void 0, {
|
|
2666
|
+
status,
|
|
2667
|
+
headers: { location }
|
|
2668
|
+
});
|
|
2669
|
+
}
|
|
2670
|
+
/**
|
|
2671
|
+
* Whether the response is being prerendered, either because we're running the prerenderer
|
|
2672
|
+
* or because a `+server.js` endpoint inherits the prerender option of the page fetching it
|
|
2673
|
+
* @param {import('types').RequestState} state
|
|
2674
|
+
*/
|
|
2675
|
+
function is_prerendering(state) {
|
|
2676
|
+
return !!state.prerendering || state.prerender_default === true;
|
|
2677
|
+
}
|
|
2678
|
+
/**
|
|
2679
|
+
* @param {Response} response
|
|
2680
|
+
*/
|
|
2681
|
+
function with_version_header(response) {
|
|
2682
|
+
response.headers.set("x-sveltekit-version", "1795957316092");
|
|
2683
|
+
return response;
|
|
2684
|
+
}
|
|
2685
|
+
/**
|
|
2686
|
+
* Throws an error explaining why data returned from `load` couldn't be serialized by devalue,
|
|
2687
|
+
* whose error becomes the cause
|
|
2688
|
+
* @param {import('@sveltejs/kit').RequestEvent} event
|
|
2689
|
+
* @param {Error & { path: string }} error
|
|
2690
|
+
* @returns {never}
|
|
2691
|
+
*/
|
|
2692
|
+
function throw_devalue_error(event, error) {
|
|
2693
|
+
const id = event.route.id;
|
|
2694
|
+
if (error.path) load_not_serializable({
|
|
2695
|
+
id,
|
|
2696
|
+
message: error.message,
|
|
2697
|
+
path: error.path
|
|
2698
|
+
}, { cause: error });
|
|
2699
|
+
if (error.path === "") load_not_plain_object({ id }, { cause: error });
|
|
2700
|
+
throw new Error(error.message, { cause: error });
|
|
2701
|
+
}
|
|
2702
|
+
/**
|
|
2703
|
+
* @param {import('types').ServerDataNode} node
|
|
2704
|
+
*/
|
|
2705
|
+
function serialize_uses(node) {
|
|
2706
|
+
const uses = {};
|
|
2707
|
+
if (node.uses && node.uses.dependencies.size > 0) uses.dependencies = Array.from(node.uses.dependencies);
|
|
2708
|
+
if (node.uses && node.uses.search_params.size > 0) uses.search_params = Array.from(node.uses.search_params);
|
|
2709
|
+
if (node.uses && node.uses.params.size > 0) uses.params = Array.from(node.uses.params);
|
|
2710
|
+
if (node.uses?.parent) uses.parent = 1;
|
|
2711
|
+
if (node.uses?.route) uses.route = 1;
|
|
2712
|
+
if (node.uses?.url) uses.url = 1;
|
|
2713
|
+
return uses;
|
|
2714
|
+
}
|
|
2715
|
+
/**
|
|
2716
|
+
* Returns `true` if the given path was prerendered
|
|
2717
|
+
* @param {string} pathname Should include the base and be decoded
|
|
2718
|
+
*/
|
|
2719
|
+
function has_prerendered_path(pathname) {
|
|
2720
|
+
return manifest.prerendered_routes.has(pathname) || pathname.at(-1) === "/" && manifest.prerendered_routes.has(pathname.slice(0, -1));
|
|
2721
|
+
}
|
|
2722
|
+
/**
|
|
2723
|
+
* Returns the filename without the extension. e.g., `+page.server`, `+page`, etc.
|
|
2724
|
+
* @param {string | undefined} node_id
|
|
2725
|
+
* @returns {string}
|
|
2726
|
+
*/
|
|
2727
|
+
function get_node_type(node_id) {
|
|
2728
|
+
const filename = (node_id?.split("/"))?.at(-1);
|
|
2729
|
+
if (!filename) return "unknown";
|
|
2730
|
+
return filename.split(".").slice(0, -1).join(".");
|
|
2731
|
+
}
|
|
2732
|
+
// ../../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/actions.js
|
|
2733
|
+
/** @import { RequestEvent, Actions } from '@sveltejs/kit' */
|
|
2734
|
+
/** @import { ActionResult } from '$app/forms' */
|
|
2735
|
+
/** @import { SSRNode, ServerNode, ServerActionResult } from 'types' */
|
|
2736
|
+
/** @param {RequestEvent} event */
|
|
2737
|
+
function is_action_json_request(event) {
|
|
2738
|
+
return negotiate(event.request.headers.get("accept") ?? "*/*", ["application/json", "text/html"]) === "application/json" && event.request.method === "POST";
|
|
2739
|
+
}
|
|
2740
|
+
/**
|
|
2741
|
+
* @param {RequestEvent} event
|
|
2742
|
+
* @param {import('types').RequestState} state
|
|
2743
|
+
* @param {SSRNode['server'] | undefined} server
|
|
2744
|
+
*/
|
|
2745
|
+
async function handle_action_json_request(event, state, server) {
|
|
2746
|
+
return action_result_json(event, state, await handle_action_request(event, state, server));
|
|
2747
|
+
}
|
|
2748
|
+
/**
|
|
2749
|
+
* @param {RequestEvent} event
|
|
2750
|
+
* @param {import('types').RequestState} state
|
|
2751
|
+
* @param {ServerActionResult} result
|
|
2752
|
+
* @returns {Promise<Response>}
|
|
2753
|
+
*/
|
|
2754
|
+
async function action_result_json(event, state, result) {
|
|
2755
|
+
if (result.type === "redirect") return action_json(result);
|
|
2756
|
+
if (result.type === "error") {
|
|
2757
|
+
const error = await handle_error_and_jsonify(event, state, result.error);
|
|
2758
|
+
return action_json({
|
|
2759
|
+
...result,
|
|
2760
|
+
error
|
|
2761
|
+
}, { status: error.status });
|
|
2762
|
+
}
|
|
2763
|
+
if (result.type === "success" && !result.data) return action_json({
|
|
2764
|
+
...result,
|
|
2765
|
+
status: 204,
|
|
2766
|
+
data: void 0
|
|
2767
|
+
});
|
|
2768
|
+
try {
|
|
2769
|
+
return action_json({
|
|
2770
|
+
...result,
|
|
2771
|
+
data: try_serialize(result.data, stringify, event.route.id)
|
|
2772
|
+
}, { status: result.status });
|
|
2773
|
+
} catch (error) {
|
|
2774
|
+
return action_result_json(event, state, action_error_result(error, result.location));
|
|
2775
|
+
}
|
|
2776
|
+
}
|
|
2777
|
+
/**
|
|
2778
|
+
* @param {URL} url
|
|
2779
|
+
*/
|
|
2780
|
+
function get_action_location(url) {
|
|
2781
|
+
const location = new URL(url);
|
|
2782
|
+
for (const key of location.searchParams.keys()) if (key.startsWith("/")) {
|
|
2783
|
+
location.searchParams.delete(key);
|
|
2784
|
+
break;
|
|
2785
|
+
}
|
|
2786
|
+
return (location.pathname.startsWith("//") ? "/." + location.pathname : location.pathname) + location.search;
|
|
2787
|
+
}
|
|
2788
|
+
/**
|
|
2789
|
+
* @param {RequestEvent} event
|
|
2790
|
+
* @param {string} location
|
|
2791
|
+
* @returns {Extract<ServerActionResult, { type: 'error' }>}
|
|
2792
|
+
*/
|
|
2793
|
+
function method_not_allowed_result(event, location) {
|
|
2794
|
+
event.setHeaders({ allow: "GET" });
|
|
2795
|
+
return {
|
|
2796
|
+
type: "error",
|
|
2797
|
+
location,
|
|
2798
|
+
error: new SvelteKitError(405, "Method Not Allowed", `POST method not allowed. No form actions exist for this page`)
|
|
2799
|
+
};
|
|
2800
|
+
}
|
|
2801
|
+
/**
|
|
2802
|
+
* @param {unknown} error
|
|
2803
|
+
* @param {string} location
|
|
2804
|
+
* @returns {Extract<ServerActionResult, { type: 'redirect' | 'error' }>}
|
|
2805
|
+
*/
|
|
2806
|
+
function action_error_result(error, location) {
|
|
2807
|
+
const err = normalize_error(error);
|
|
2808
|
+
if (err instanceof Redirect) return {
|
|
2809
|
+
type: "redirect",
|
|
2810
|
+
status: err.status,
|
|
2811
|
+
location: err.location
|
|
2812
|
+
};
|
|
2813
|
+
return {
|
|
2814
|
+
type: "error",
|
|
2815
|
+
location,
|
|
2816
|
+
error: err
|
|
2817
|
+
};
|
|
2818
|
+
}
|
|
2819
|
+
/**
|
|
2820
|
+
* @param {Redirect} redirect
|
|
2821
|
+
*/
|
|
2822
|
+
function action_json_redirect(redirect) {
|
|
2823
|
+
return action_json({
|
|
2824
|
+
type: "redirect",
|
|
2825
|
+
status: redirect.status,
|
|
2826
|
+
location: redirect.location
|
|
2827
|
+
});
|
|
2828
|
+
}
|
|
2829
|
+
/**
|
|
2830
|
+
* @param {ActionResult} data
|
|
2831
|
+
* @param {ResponseInit} [init]
|
|
2832
|
+
*/
|
|
2833
|
+
function action_json(data, init) {
|
|
2834
|
+
return with_version_header(Response.json(data, init));
|
|
2835
|
+
}
|
|
2836
|
+
/**
|
|
2837
|
+
* @param {RequestEvent} event
|
|
2838
|
+
*/
|
|
2839
|
+
function is_action_request(event) {
|
|
2840
|
+
return event.request.method === "POST";
|
|
2841
|
+
}
|
|
2842
|
+
/**
|
|
2843
|
+
* @param {RequestEvent} event
|
|
2844
|
+
* @param {import('types').RequestState} state
|
|
2845
|
+
* @param {SSRNode['server'] | undefined} server
|
|
2846
|
+
* @returns {Promise<ServerActionResult>}
|
|
2847
|
+
*/
|
|
2848
|
+
async function handle_action_request(event, state, server) {
|
|
2849
|
+
const actions = server?.actions;
|
|
2850
|
+
const location = get_action_location(event.url);
|
|
2851
|
+
if (!actions) return method_not_allowed_result(event, location);
|
|
2852
|
+
check_named_default_separate(actions);
|
|
2853
|
+
try {
|
|
2854
|
+
const data = await call_action(event, state, actions);
|
|
2855
|
+
if (data instanceof ActionFailure) return {
|
|
2856
|
+
type: "failure",
|
|
2857
|
+
status: data.status,
|
|
2858
|
+
location,
|
|
2859
|
+
data: data.data
|
|
2860
|
+
};
|
|
2861
|
+
else return {
|
|
2862
|
+
type: "success",
|
|
2863
|
+
status: 200,
|
|
2864
|
+
location,
|
|
2865
|
+
data
|
|
2866
|
+
};
|
|
2867
|
+
} catch (error) {
|
|
2868
|
+
return action_error_result(error instanceof ActionFailure ? capture_error(() => action_throw_fail()) : error, location);
|
|
2869
|
+
}
|
|
2870
|
+
}
|
|
2871
|
+
/**
|
|
2872
|
+
* @param {Actions} actions
|
|
2873
|
+
*/
|
|
2874
|
+
function check_named_default_separate(actions) {
|
|
2875
|
+
if (actions.default && Object.keys(actions).length > 1) action_default_with_named();
|
|
2876
|
+
}
|
|
2877
|
+
/**
|
|
2878
|
+
* @param {RequestEvent} event
|
|
2879
|
+
* @param {import('types').RequestState} state
|
|
2880
|
+
* @param {NonNullable<ServerNode['actions']>} actions
|
|
2881
|
+
* @throws {Redirect | HttpError | SvelteKitError | Error}
|
|
2882
|
+
*/
|
|
2883
|
+
async function call_action(event, state, actions) {
|
|
2884
|
+
const url = new URL(event.request.url);
|
|
2885
|
+
let name = "default";
|
|
2886
|
+
for (const param of url.searchParams) if (param[0].startsWith("/")) {
|
|
2887
|
+
name = param[0].slice(1);
|
|
2888
|
+
if (name === "default") action_name_reserved();
|
|
2889
|
+
break;
|
|
2890
|
+
}
|
|
2891
|
+
if (!Object.hasOwn(actions, name)) throw new SvelteKitError(404, "Not Found", `No action with name '${name}' found`);
|
|
2892
|
+
const action = actions[name];
|
|
2893
|
+
if (!is_form_content_type(event.request)) throw new SvelteKitError(415, "Unsupported Media Type", `Form actions expect form-encoded data — received ${event.request.headers.get("content-type")}`);
|
|
2894
|
+
return record_span({
|
|
2895
|
+
name: "sveltekit.form_action",
|
|
2896
|
+
attributes: {
|
|
2897
|
+
"sveltekit.form_action.name": name,
|
|
2898
|
+
"http.route": event.route.id || "unknown"
|
|
2899
|
+
},
|
|
2900
|
+
fn: async (current) => {
|
|
2901
|
+
const traced_event = merge_tracing(event, current);
|
|
2902
|
+
const result = await with_request_store({
|
|
2903
|
+
event: traced_event,
|
|
2904
|
+
state
|
|
2905
|
+
}, () => action(traced_event));
|
|
2906
|
+
if (result instanceof ActionFailure) current.setAttributes({
|
|
2907
|
+
"sveltekit.form_action.result.type": "failure",
|
|
2908
|
+
"sveltekit.form_action.result.status": result.status
|
|
2909
|
+
});
|
|
2910
|
+
return result;
|
|
2911
|
+
}
|
|
2912
|
+
});
|
|
2913
|
+
}
|
|
2914
|
+
/**
|
|
2915
|
+
* Try to `devalue.uneval` the data object, and if it fails, return a proper Error with context
|
|
2916
|
+
* @param {any} data
|
|
2917
|
+
* @param {string} route_id
|
|
2918
|
+
*/
|
|
2919
|
+
function uneval_action_response(data, route_id) {
|
|
2920
|
+
return try_serialize(data, uneval, route_id);
|
|
2921
|
+
}
|
|
2922
|
+
/**
|
|
2923
|
+
* @param {any} data
|
|
2924
|
+
* @param {(data: any) => string} fn
|
|
2925
|
+
* @param {string} route_id
|
|
2926
|
+
*/
|
|
2927
|
+
function try_serialize(data, fn, route_id) {
|
|
2928
|
+
try {
|
|
2929
|
+
return fn(data);
|
|
2930
|
+
} catch (error) {
|
|
2931
|
+
if (data instanceof Response) action_response_not_serializable({ id: route_id }, { cause: error });
|
|
2932
|
+
if ("path" in error) {
|
|
2933
|
+
const values = {
|
|
2934
|
+
id: route_id,
|
|
2935
|
+
message: error.message
|
|
2936
|
+
};
|
|
2937
|
+
action_data_not_serializable(error.path === "" ? values : {
|
|
2938
|
+
...values,
|
|
2939
|
+
path: `data${error.path}`
|
|
2940
|
+
}, { cause: error });
|
|
2941
|
+
}
|
|
2942
|
+
throw error;
|
|
2943
|
+
}
|
|
2944
|
+
}
|
|
2945
|
+
// ../../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/remote-functions.js
|
|
2946
|
+
/** @import { RequestEvent } from '@sveltejs/kit' */
|
|
2947
|
+
/** @import { RemoteFormInternals, RemoteFunctionData, RemoteFunctionResponse, RemoteInternals, RequestState, ServerActionResult, SSRManifest } from 'types' */
|
|
2948
|
+
/**
|
|
2949
|
+
* How long (in milliseconds) to wait after the last message was sent before
|
|
2950
|
+
* sending a `: keep-alive` SSE comment, to prevent proxies/load balancers with
|
|
2951
|
+
* an idle timeout from closing an otherwise-quiet `query.live` connection.
|
|
2952
|
+
*/
|
|
2953
|
+
var KEEP_ALIVE_INTERVAL = 3e4;
|
|
2954
|
+
/**
|
|
2955
|
+
* @param {RequestEvent} event
|
|
2956
|
+
* @param {RequestState} state
|
|
2957
|
+
* @param {import('types').RemoteQueryLiveInternals} internals
|
|
2958
|
+
* @param {any} arg
|
|
2959
|
+
*/
|
|
2960
|
+
function create_live_query_response(event, state, internals, arg) {
|
|
2961
|
+
const cancellation = new AbortController();
|
|
2962
|
+
const live_event = {
|
|
2963
|
+
...event,
|
|
2964
|
+
request: new Request(event.request, { signal: AbortSignal.any([event.request.signal, cancellation.signal]) })
|
|
2965
|
+
};
|
|
2966
|
+
const generator = internals.run(live_event, state, arg);
|
|
2967
|
+
let open = true;
|
|
2968
|
+
let pulling = false;
|
|
2969
|
+
/** @type {ReadableStreamDefaultController<Uint8Array>} */
|
|
2970
|
+
let stream_controller;
|
|
2971
|
+
/** @type {ReturnType<typeof setTimeout> | undefined} */
|
|
2972
|
+
let keep_alive;
|
|
2973
|
+
/** @type {string | undefined} */
|
|
2974
|
+
let result;
|
|
2975
|
+
function schedule_keep_alive() {
|
|
2976
|
+
clearTimeout(keep_alive);
|
|
2977
|
+
keep_alive = setTimeout(() => {
|
|
2978
|
+
if (!open) return;
|
|
2979
|
+
if ((stream_controller.desiredSize ?? 0) > 0) stream_controller.enqueue(text_encoder.encode(": keep-alive\n\n"));
|
|
2980
|
+
schedule_keep_alive();
|
|
2981
|
+
}, KEEP_ALIVE_INTERVAL);
|
|
2982
|
+
}
|
|
2983
|
+
/** @param {any} data */
|
|
2984
|
+
function send(data) {
|
|
2985
|
+
if (!open) return;
|
|
2986
|
+
stream_controller.enqueue(text_encoder.encode("data: " + JSON.stringify(data) + "\n\n"));
|
|
2987
|
+
schedule_keep_alive();
|
|
2988
|
+
}
|
|
2989
|
+
/** @param {boolean} cancelled */
|
|
2990
|
+
function teardown(cancelled) {
|
|
2991
|
+
if (!open) return;
|
|
2992
|
+
open = false;
|
|
2993
|
+
clearTimeout(keep_alive);
|
|
2994
|
+
cancellation.abort();
|
|
2995
|
+
if (!cancelled) stream_controller.close();
|
|
2996
|
+
generator.return(void 0).catch(() => {});
|
|
2997
|
+
}
|
|
2998
|
+
event.request.signal.addEventListener("abort", () => teardown(true), { once: true });
|
|
2999
|
+
return new Response(new ReadableStream({
|
|
3000
|
+
start(controller) {
|
|
3001
|
+
stream_controller = controller;
|
|
3002
|
+
schedule_keep_alive();
|
|
3003
|
+
},
|
|
3004
|
+
async pull() {
|
|
3005
|
+
if (!open || pulling) return;
|
|
3006
|
+
pulling = true;
|
|
3007
|
+
try {
|
|
3008
|
+
while (open) {
|
|
3009
|
+
const { value, done } = await generator.next();
|
|
3010
|
+
if (!open) return;
|
|
3011
|
+
if (done) {
|
|
3012
|
+
teardown(false);
|
|
3013
|
+
return;
|
|
3014
|
+
}
|
|
3015
|
+
if (result !== (result = stringify(value))) {
|
|
3016
|
+
send({
|
|
3017
|
+
type: "result",
|
|
3018
|
+
result
|
|
3019
|
+
});
|
|
3020
|
+
return;
|
|
3021
|
+
}
|
|
3022
|
+
}
|
|
3023
|
+
} catch (error) {
|
|
3024
|
+
if (!open) return;
|
|
3025
|
+
if (error instanceof Redirect) send({
|
|
3026
|
+
type: "redirect",
|
|
3027
|
+
location: error.location
|
|
3028
|
+
});
|
|
3029
|
+
else send({
|
|
3030
|
+
type: "error",
|
|
3031
|
+
error: await handle_error_and_jsonify(event, state, error)
|
|
3032
|
+
});
|
|
3033
|
+
teardown(false);
|
|
3034
|
+
} finally {
|
|
3035
|
+
pulling = false;
|
|
3036
|
+
}
|
|
3037
|
+
},
|
|
3038
|
+
cancel() {
|
|
3039
|
+
teardown(true);
|
|
3040
|
+
}
|
|
3041
|
+
}), { headers: {
|
|
3042
|
+
"cache-control": "private, no-store",
|
|
3043
|
+
"content-type": "text/event-stream"
|
|
3044
|
+
} });
|
|
3045
|
+
}
|
|
3046
|
+
/** @type {typeof handle_remote_call_internal} */
|
|
3047
|
+
async function handle_remote_call(event, state, id) {
|
|
3048
|
+
return record_span({
|
|
3049
|
+
name: "sveltekit.remote.call",
|
|
3050
|
+
attributes: { "sveltekit.remote.call.id": id },
|
|
3051
|
+
fn: async (current) => {
|
|
3052
|
+
const traced_event = merge_tracing(event, current);
|
|
3053
|
+
return with_version_header(await with_request_store({
|
|
3054
|
+
event: traced_event,
|
|
3055
|
+
state
|
|
3056
|
+
}, () => handle_remote_call_internal(traced_event, state, id)));
|
|
3057
|
+
}
|
|
3058
|
+
});
|
|
3059
|
+
}
|
|
3060
|
+
/**
|
|
3061
|
+
*
|
|
3062
|
+
* @param {string} id
|
|
3063
|
+
* @param {SSRManifest} manifest
|
|
3064
|
+
* @returns {Promise<{ fn: ((...args: any[]) => any) & { __: RemoteInternals }, name: string, additional_args: string } | undefined>}
|
|
3065
|
+
*/
|
|
3066
|
+
async function get_remote_function(id, manifest) {
|
|
3067
|
+
const first_slash = id.indexOf("/");
|
|
3068
|
+
if (first_slash === -1) return;
|
|
3069
|
+
const second_slash = id.indexOf("/", first_slash + 1);
|
|
3070
|
+
const hash = id.substring(0, first_slash);
|
|
3071
|
+
/** @type {string} */
|
|
3072
|
+
let name;
|
|
3073
|
+
let additional_args = "";
|
|
3074
|
+
if (second_slash === -1) name = id.substring(first_slash + 1);
|
|
3075
|
+
else {
|
|
3076
|
+
name = id.substring(first_slash + 1, second_slash);
|
|
3077
|
+
additional_args = id.substring(second_slash + 1);
|
|
3078
|
+
}
|
|
3079
|
+
const remotes = manifest.remotes;
|
|
3080
|
+
if (!Object.hasOwn(remotes, hash)) return;
|
|
3081
|
+
const module = await with_request_store(null, () => remotes[hash]());
|
|
3082
|
+
if (!Object.hasOwn(module.default, name)) return;
|
|
3083
|
+
return {
|
|
3084
|
+
fn: module.default[name],
|
|
3085
|
+
name,
|
|
3086
|
+
additional_args
|
|
3087
|
+
};
|
|
3088
|
+
}
|
|
3089
|
+
/**
|
|
3090
|
+
* @param {RequestEvent} event
|
|
3091
|
+
* @param {string} type
|
|
3092
|
+
* @param {'GET' | 'POST'} method
|
|
3093
|
+
*/
|
|
3094
|
+
function check_method(event, type, method) {
|
|
3095
|
+
if (event.request.method !== method) throw new SvelteKitError(405, "Method Not Allowed", `\`${type}\` functions must be invoked via ${method} request, not ${event.request.method}`);
|
|
3096
|
+
}
|
|
3097
|
+
/**
|
|
3098
|
+
* @param {RequestEvent} event
|
|
3099
|
+
* @param {RequestState} state
|
|
3100
|
+
* @param {string} id
|
|
3101
|
+
*/
|
|
3102
|
+
async function handle_remote_call_internal(event, state, id) {
|
|
3103
|
+
const remote = await get_remote_function(id, manifest);
|
|
3104
|
+
if (!remote) error(404);
|
|
3105
|
+
const { fn, additional_args } = remote;
|
|
3106
|
+
/** @type {RemoteInternals} */
|
|
3107
|
+
const internals = fn.__;
|
|
3108
|
+
event.tracing.current.setAttributes({
|
|
3109
|
+
"sveltekit.remote.call.type": internals.type,
|
|
3110
|
+
"sveltekit.remote.call.name": internals.name,
|
|
3111
|
+
"sveltekit.remote.call.file": internals.file
|
|
3112
|
+
});
|
|
3113
|
+
/** @type {HeadersInit | undefined} */
|
|
3114
|
+
const headers = state.prerendering ? void 0 : { "cache-control": "private, no-store" };
|
|
3115
|
+
try {
|
|
3116
|
+
/** @type {RemoteFunctionData} */
|
|
3117
|
+
const data = {};
|
|
3118
|
+
switch (internals.type) {
|
|
3119
|
+
case "query_live":
|
|
3120
|
+
check_method(event, "query.live", "GET");
|
|
3121
|
+
return create_live_query_response(event, state, internals, parse_remote_arg(new URL(event.request.url).searchParams.get("payload")));
|
|
3122
|
+
case "query_batch": {
|
|
3123
|
+
check_method(event, "query.batch", "POST");
|
|
3124
|
+
/** @type {{ payloads: string[] }} */
|
|
3125
|
+
const { payloads } = await event.request.json();
|
|
3126
|
+
const args = await Promise.all(payloads.map((payload) => parse_remote_arg(payload)));
|
|
3127
|
+
data._ = await with_request_store({
|
|
3128
|
+
event,
|
|
3129
|
+
state
|
|
3130
|
+
}, () => internals.run(args));
|
|
3131
|
+
break;
|
|
3132
|
+
}
|
|
3133
|
+
case "form": {
|
|
3134
|
+
check_method(event, "form", "POST");
|
|
3135
|
+
if (!is_form_content_type(event.request)) throw new SvelteKitError(415, "Unsupported Media Type", `\`form\` functions expect form-encoded data — received ${event.request.headers.get("content-type")}`);
|
|
3136
|
+
const { data: input, meta, form_data } = await deserialize_binary_form(event.request, internals.id);
|
|
3137
|
+
state.remote.requested = create_requested_map(meta.remote_refreshes);
|
|
3138
|
+
if (additional_args && !("id" in input)) input.id = JSON.parse(decodeURIComponent(additional_args));
|
|
3139
|
+
const fn = internals.fn;
|
|
3140
|
+
data._ = await with_request_store({
|
|
3141
|
+
event,
|
|
3142
|
+
state: {
|
|
3143
|
+
...state,
|
|
3144
|
+
is_in_remote_form_or_command: true
|
|
3145
|
+
}
|
|
3146
|
+
}, () => fn(input, meta, form_data));
|
|
3147
|
+
if (data._.issues) return Response.json({
|
|
3148
|
+
type: "result",
|
|
3149
|
+
data: stringify(data)
|
|
3150
|
+
}, { headers });
|
|
3151
|
+
break;
|
|
3152
|
+
}
|
|
3153
|
+
case "command": {
|
|
3154
|
+
check_method(event, "command", "POST");
|
|
3155
|
+
/** @type {{ payload: string, refreshes?: string[] }} */
|
|
3156
|
+
const { payload, refreshes } = await event.request.json();
|
|
3157
|
+
state.remote.requested = create_requested_map(refreshes);
|
|
3158
|
+
const arg = parse_remote_arg(payload);
|
|
3159
|
+
data._ = await with_request_store({
|
|
3160
|
+
event,
|
|
3161
|
+
state: {
|
|
3162
|
+
...state,
|
|
3163
|
+
is_in_remote_form_or_command: true
|
|
3164
|
+
}
|
|
3165
|
+
}, () => fn(arg));
|
|
3166
|
+
break;
|
|
3167
|
+
}
|
|
3168
|
+
case "prerender":
|
|
3169
|
+
check_method(event, "prerender", "GET");
|
|
3170
|
+
data._ = await with_request_store({
|
|
3171
|
+
event,
|
|
3172
|
+
state
|
|
3173
|
+
}, () => fn(parse_remote_arg(additional_args)));
|
|
3174
|
+
break;
|
|
3175
|
+
case "query": {
|
|
3176
|
+
check_method(event, "query", "GET");
|
|
3177
|
+
const payload = new URL(event.request.url).searchParams.get("payload");
|
|
3178
|
+
data._ = await with_request_store({
|
|
3179
|
+
event,
|
|
3180
|
+
state
|
|
3181
|
+
}, () => fn(parse_remote_arg(payload)));
|
|
3182
|
+
break;
|
|
3183
|
+
}
|
|
3184
|
+
}
|
|
3185
|
+
await collect_remote_data(data, event, state);
|
|
3186
|
+
if (state.remote.ignored?.size) data.i = Array.from(state.remote.ignored);
|
|
3187
|
+
return Response.json({
|
|
3188
|
+
type: "result",
|
|
3189
|
+
data: stringify(data)
|
|
3190
|
+
}, { headers });
|
|
3191
|
+
} catch (error) {
|
|
3192
|
+
if (error instanceof Redirect) {
|
|
3193
|
+
const data = await collect_remote_data({ redirect: error.location }, event, state);
|
|
3194
|
+
return Response.json({
|
|
3195
|
+
type: "result",
|
|
3196
|
+
data: stringify(data)
|
|
3197
|
+
}, { headers });
|
|
3198
|
+
}
|
|
3199
|
+
const transformed = await handle_error_and_jsonify(event, state, error);
|
|
3200
|
+
return Response.json({
|
|
3201
|
+
type: "error",
|
|
3202
|
+
error: transformed
|
|
3203
|
+
}, {
|
|
3204
|
+
status: state.prerendering ? transformed.status : void 0,
|
|
3205
|
+
headers: { "cache-control": "private, no-store" }
|
|
3206
|
+
});
|
|
3207
|
+
}
|
|
3208
|
+
}
|
|
3209
|
+
/**
|
|
3210
|
+
* Collects all the query/prerender data that was retrieved
|
|
3211
|
+
* during the request and adds it to `data`
|
|
3212
|
+
* @param {RemoteFunctionData} data
|
|
3213
|
+
* @param {RequestEvent} event
|
|
3214
|
+
* @param {RequestState} state
|
|
3215
|
+
*/
|
|
3216
|
+
async function collect_remote_data(data, event, state) {
|
|
3217
|
+
/**
|
|
3218
|
+
*
|
|
3219
|
+
* @param {unknown} error
|
|
3220
|
+
* @returns {Promise<App.Error>}
|
|
3221
|
+
*/
|
|
3222
|
+
function convert_error(error) {
|
|
3223
|
+
return Promise.resolve(handle_error_and_jsonify(event, state, error));
|
|
3224
|
+
}
|
|
3225
|
+
/** @type {Promise<any>[]} */
|
|
3226
|
+
const promises = [];
|
|
3227
|
+
/** @type {Set<string>} */
|
|
3228
|
+
const processed = /* @__PURE__ */ new Set();
|
|
3229
|
+
if (state.remote.explicit) {
|
|
3230
|
+
const { explicit } = state.remote;
|
|
3231
|
+
/** @type {Promise<void>[]} */
|
|
3232
|
+
const inflight = [];
|
|
3233
|
+
const drain = () => {
|
|
3234
|
+
for (const [remote_key, { internals, fn }] of explicit) {
|
|
3235
|
+
explicit.delete(remote_key);
|
|
3236
|
+
if (processed.has(remote_key)) continue;
|
|
3237
|
+
processed.add(remote_key);
|
|
3238
|
+
data.r = true;
|
|
3239
|
+
const type = internals.type === "query_live" ? "l" : internals.type[0];
|
|
3240
|
+
inflight.push(fn().then((v) => {
|
|
3241
|
+
(data[type] ??= {})[remote_key] = { v };
|
|
3242
|
+
drain();
|
|
3243
|
+
}, async (e) => {
|
|
3244
|
+
if (!(e instanceof Redirect)) (data[type] ??= {})[remote_key] = { e: await convert_error(e) };
|
|
3245
|
+
drain();
|
|
3246
|
+
}));
|
|
3247
|
+
}
|
|
3248
|
+
};
|
|
3249
|
+
drain();
|
|
3250
|
+
for (const promise of inflight) await promise;
|
|
3251
|
+
}
|
|
3252
|
+
if (state.remote.implicit) for (const [internals, record] of state.remote.implicit) {
|
|
3253
|
+
if (!internals.id) continue;
|
|
3254
|
+
for (const key in record) {
|
|
3255
|
+
const remote_key = internals.type === "form" ? key : create_remote_key(internals.id, key);
|
|
3256
|
+
if (processed.has(remote_key)) continue;
|
|
3257
|
+
const type = internals.type === "query_live" ? "l" : internals.type[0];
|
|
3258
|
+
const promise = state.remote.data?.get(internals)?.[key] ?? record[key]();
|
|
3259
|
+
let resolved = true;
|
|
3260
|
+
await Promise.race([Promise.resolve(promise).then((v) => {
|
|
3261
|
+
if (resolved) ((data[type] ??= {})[remote_key] ??= {}).v = v;
|
|
3262
|
+
}, (e) => {
|
|
3263
|
+
if (e instanceof Redirect) return;
|
|
3264
|
+
if (resolved) promises.push(convert_error(e).then((e) => {
|
|
3265
|
+
((data[type] ??= {})[remote_key] ??= {}).e = e;
|
|
3266
|
+
}));
|
|
3267
|
+
}), Promise.resolve().then(() => resolved = false)]);
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3270
|
+
await Promise.all(promises);
|
|
3271
|
+
return data;
|
|
3272
|
+
}
|
|
3273
|
+
/**
|
|
3274
|
+
* @param {unknown} refreshes
|
|
3275
|
+
*/
|
|
3276
|
+
function create_requested_map(refreshes) {
|
|
3277
|
+
/** @type {Map<string, Set<string>>} */
|
|
3278
|
+
const requested = /* @__PURE__ */ new Map();
|
|
3279
|
+
if (refreshes === void 0) return requested;
|
|
3280
|
+
if (!Array.isArray(refreshes)) throw new SvelteKitError(400, "Bad Request", "Invalid refreshes");
|
|
3281
|
+
for (const key of refreshes) {
|
|
3282
|
+
if (typeof key !== "string" || !key.includes("/")) throw new SvelteKitError(400, "Bad Request", "Invalid refreshes");
|
|
3283
|
+
const parts = split_remote_key(key);
|
|
3284
|
+
const existing = requested.get(parts.id);
|
|
3285
|
+
if (existing) existing.add(parts.payload);
|
|
3286
|
+
else requested.set(parts.id, /* @__PURE__ */ new Set([parts.payload]));
|
|
3287
|
+
}
|
|
3288
|
+
return requested;
|
|
3289
|
+
}
|
|
3290
|
+
/** @type {typeof handle_remote_form_post_internal} */
|
|
3291
|
+
async function handle_remote_form_post(event, state, id) {
|
|
3292
|
+
return record_span({
|
|
3293
|
+
name: "sveltekit.remote.form.post",
|
|
3294
|
+
attributes: { "sveltekit.remote.form.post.id": id },
|
|
3295
|
+
fn: (current) => {
|
|
3296
|
+
const traced_event = merge_tracing(event, current);
|
|
3297
|
+
return with_request_store({
|
|
3298
|
+
event: traced_event,
|
|
3299
|
+
state
|
|
3300
|
+
}, () => handle_remote_form_post_internal(traced_event, state, id));
|
|
3301
|
+
}
|
|
3302
|
+
});
|
|
3303
|
+
}
|
|
3304
|
+
/**
|
|
3305
|
+
* @param {RequestEvent} event
|
|
3306
|
+
* @param {RequestState} state
|
|
3307
|
+
* @param {string} id
|
|
3308
|
+
* @returns {Promise<ServerActionResult>}
|
|
3309
|
+
*/
|
|
3310
|
+
async function handle_remote_form_post_internal(event, state, id) {
|
|
3311
|
+
const location = get_action_location(event.url);
|
|
3312
|
+
const remote = await get_remote_function(id, manifest);
|
|
3313
|
+
if (!remote) return method_not_allowed_result(event, location);
|
|
3314
|
+
let form = remote.fn;
|
|
3315
|
+
const action_id = remote.additional_args;
|
|
3316
|
+
if (action_id) form = with_request_store({
|
|
3317
|
+
event,
|
|
3318
|
+
state
|
|
3319
|
+
}, () => form.for(JSON.parse(action_id)));
|
|
3320
|
+
try {
|
|
3321
|
+
const __ = form.__;
|
|
3322
|
+
const { data, meta, form_data } = await deserialize_binary_form(event.request, __.id);
|
|
3323
|
+
if (action_id && !("id" in data)) data.id = JSON.parse(decodeURIComponent(action_id));
|
|
3324
|
+
await with_request_store({
|
|
3325
|
+
event,
|
|
3326
|
+
state: {
|
|
3327
|
+
...state,
|
|
3328
|
+
is_in_remote_form_or_command: true
|
|
3329
|
+
}
|
|
3330
|
+
}, () => __.fn(data, meta, form_data));
|
|
3331
|
+
return {
|
|
3332
|
+
type: "success",
|
|
3333
|
+
status: 200,
|
|
3334
|
+
location
|
|
3335
|
+
};
|
|
3336
|
+
} catch (e) {
|
|
3337
|
+
return action_error_result(e, location);
|
|
3338
|
+
}
|
|
3339
|
+
}
|
|
3340
|
+
/**
|
|
3341
|
+
* @param {URL} url
|
|
3342
|
+
*/
|
|
3343
|
+
function has_remote_prefix(url) {
|
|
3344
|
+
return url.pathname.startsWith(`/ui/${app_dir}/remote/`);
|
|
3345
|
+
}
|
|
3346
|
+
/**
|
|
3347
|
+
* @param {URL} url
|
|
3348
|
+
*/
|
|
3349
|
+
function strip_remote_prefix(url) {
|
|
3350
|
+
return url.pathname.replace(`/ui/${app_dir}/remote/`, "");
|
|
3351
|
+
}
|
|
3352
|
+
/**
|
|
3353
|
+
* @param {URL} url
|
|
3354
|
+
*/
|
|
3355
|
+
function get_remote_id(url) {
|
|
3356
|
+
return has_remote_prefix(url) && strip_remote_prefix(url);
|
|
3357
|
+
}
|
|
3358
|
+
/**
|
|
3359
|
+
* @param {URL} url
|
|
3360
|
+
*/
|
|
3361
|
+
function get_remote_action(url) {
|
|
3362
|
+
return url.searchParams.get("/remote");
|
|
3363
|
+
}
|
|
3364
|
+
// ../../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/sourcemaps.js
|
|
3365
|
+
var fs = globalThis.process?.getBuiltinModule?.("node:fs");
|
|
3366
|
+
var url = globalThis.process?.getBuiltinModule?.("node:url");
|
|
3367
|
+
var path = globalThis.process?.getBuiltinModule?.("node:path");
|
|
3368
|
+
var module = globalThis.process?.getBuiltinModule?.("node:module");
|
|
3369
|
+
var cwd = globalThis.process?.cwd?.();
|
|
3370
|
+
/** @type {(file: string) => string} */
|
|
3371
|
+
var relative = cwd ? (file) => path.relative(cwd, file) : (file) => file;
|
|
3372
|
+
/**
|
|
3373
|
+
* Applies sourcemaps, makes paths relative to the cwd, and truncates
|
|
3374
|
+
* non-user code from the bottom of the stack
|
|
3375
|
+
* @param {Error} error
|
|
3376
|
+
* @returns void
|
|
3377
|
+
*/
|
|
3378
|
+
var fix_stack_trace = (error) => {
|
|
3379
|
+
if (!error.stack || !fs) return;
|
|
3380
|
+
let header;
|
|
3381
|
+
try {
|
|
3382
|
+
header = Error.prototype.toString.call(error);
|
|
3383
|
+
} catch {
|
|
3384
|
+
return;
|
|
3385
|
+
}
|
|
3386
|
+
if (!error.stack.startsWith(header + "\n")) return;
|
|
3387
|
+
let end = 0;
|
|
3388
|
+
const frames = error.stack.slice(header.length + 1).split("\n").map((line, i) => {
|
|
3389
|
+
const match = line.match(/^ {4}at.+(file:\/\/\/.*):(\d+):(\d+)(\)?)$/);
|
|
3390
|
+
if (!match) {
|
|
3391
|
+
if (!line.includes("node:internal/")) end = i + 1;
|
|
3392
|
+
return line;
|
|
3393
|
+
}
|
|
3394
|
+
const file = url.fileURLToPath(match[1]);
|
|
3395
|
+
const traced = trace(file, Number(match[2]) - 1, Number(match[3]) - 1);
|
|
3396
|
+
if (!/[\\/]node_modules[\\/]/.test(traced?.file ?? file)) end = i + 1;
|
|
3397
|
+
if (traced?.line) {
|
|
3398
|
+
const location = `${match[1]}:${match[2]}:${match[3]}`;
|
|
3399
|
+
const original = `${relative(traced.file)}:${traced.line}:${traced.column}`;
|
|
3400
|
+
return line.replace(location, original);
|
|
3401
|
+
}
|
|
3402
|
+
if (traced) return `${line.replace(match[1], relative(file))} [${traced.file}]`;
|
|
3403
|
+
return line;
|
|
3404
|
+
}).slice(0, end);
|
|
3405
|
+
set_error_stack(error, [header, ...frames].join("\n"));
|
|
3406
|
+
};
|
|
3407
|
+
/**
|
|
3408
|
+
* Override the implementation of fix_stack_trace (for using during dev)
|
|
3409
|
+
* @param {(error: Error) => void} fn
|
|
3410
|
+
*/
|
|
3411
|
+
function set_fix_stack_trace(fn) {
|
|
3412
|
+
fix_stack_trace = fn;
|
|
3413
|
+
}
|
|
3414
|
+
/** @type {Map<string, { map: import('node:module').SourceMap; directory: string } | null>} */
|
|
3415
|
+
var source_maps = /* @__PURE__ */ new Map();
|
|
3416
|
+
/** @type {Map<string, Array<string | undefined>>} */
|
|
3417
|
+
var source_regions = /* @__PURE__ */ new Map();
|
|
3418
|
+
/** @param {string} file */
|
|
3419
|
+
function get_source_map(file) {
|
|
3420
|
+
if (source_maps.has(file)) return source_maps.get(file);
|
|
3421
|
+
try {
|
|
3422
|
+
let source;
|
|
3423
|
+
let directory = path.dirname(file);
|
|
3424
|
+
if (!is_file(file)) {
|
|
3425
|
+
source_maps.set(file, null);
|
|
3426
|
+
return null;
|
|
3427
|
+
}
|
|
3428
|
+
const code = fs.readFileSync(file, "utf8");
|
|
3429
|
+
const url = Array.from(code.matchAll(/\/\/[#@]\s*sourceMappingURL=(\S+)/g)).at(-1)?.[1];
|
|
3430
|
+
if (url?.startsWith("data:")) {
|
|
3431
|
+
const comma = url.indexOf(",");
|
|
3432
|
+
const metadata = url.slice(5, comma);
|
|
3433
|
+
const data = url.slice(comma + 1);
|
|
3434
|
+
source = metadata.endsWith(";base64") ? Buffer.from(data, "base64").toString() : decodeURIComponent(data);
|
|
3435
|
+
} else {
|
|
3436
|
+
const map_file = url ? path.resolve(path.dirname(file), decodeURIComponent(url)) : `${file}.map`;
|
|
3437
|
+
if (is_file(map_file)) {
|
|
3438
|
+
directory = path.dirname(map_file);
|
|
3439
|
+
source = fs.readFileSync(map_file, "utf8");
|
|
3440
|
+
}
|
|
3441
|
+
}
|
|
3442
|
+
if (source) {
|
|
3443
|
+
const source_map = {
|
|
3444
|
+
map: new module.SourceMap(JSON.parse(source)),
|
|
3445
|
+
directory
|
|
3446
|
+
};
|
|
3447
|
+
source_maps.set(file, source_map);
|
|
3448
|
+
return source_map;
|
|
3449
|
+
}
|
|
3450
|
+
} catch {}
|
|
3451
|
+
source_maps.set(file, null);
|
|
3452
|
+
return null;
|
|
3453
|
+
}
|
|
3454
|
+
/**
|
|
3455
|
+
* @param {string} file
|
|
3456
|
+
* @returns {boolean}
|
|
3457
|
+
*/
|
|
3458
|
+
function is_file(file) {
|
|
3459
|
+
return fs.statSync(file, { throwIfNoEntry: false })?.isFile() ?? false;
|
|
3460
|
+
}
|
|
3461
|
+
/**
|
|
3462
|
+
*
|
|
3463
|
+
* @param {string} file
|
|
3464
|
+
* @param {number} line
|
|
3465
|
+
* @param {number} column
|
|
3466
|
+
* @returns {null | { file: string, line?: number, column?: number }}
|
|
3467
|
+
*/
|
|
3468
|
+
function trace(file, line, column) {
|
|
3469
|
+
const source_map = get_source_map(file);
|
|
3470
|
+
if (!source_map) return null;
|
|
3471
|
+
const entry = source_map.map.findEntry(line, column);
|
|
3472
|
+
if (entry && "originalSource" in entry && entry.originalSource && typeof entry.originalLine === "number" && typeof entry.originalColumn === "number") {
|
|
3473
|
+
const traced = {
|
|
3474
|
+
file: entry.originalSource.startsWith("file:") ? url.fileURLToPath(entry.originalSource) : path.resolve(source_map.directory, entry.originalSource),
|
|
3475
|
+
line: entry.originalLine + 1,
|
|
3476
|
+
column: entry.originalColumn + 1
|
|
3477
|
+
};
|
|
3478
|
+
return trace(traced.file, traced.line - 1, traced.column - 1) ?? traced;
|
|
3479
|
+
}
|
|
3480
|
+
let regions = source_regions.get(file);
|
|
3481
|
+
if (!regions) {
|
|
3482
|
+
/** @type {string | undefined} */
|
|
3483
|
+
let source;
|
|
3484
|
+
regions = fs.readFileSync(file, "utf8").split("\n").map((line) => {
|
|
3485
|
+
const start = line.match(/^\/\/#region (.+)$/);
|
|
3486
|
+
if (start) source = start[1];
|
|
3487
|
+
if (line === "//#endregion") source = void 0;
|
|
3488
|
+
return source;
|
|
3489
|
+
});
|
|
3490
|
+
source_regions.set(file, regions);
|
|
3491
|
+
}
|
|
3492
|
+
const source = regions[line];
|
|
3493
|
+
if (source) return { file: source };
|
|
3494
|
+
return null;
|
|
3495
|
+
}
|
|
3496
|
+
// ../../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/internal.js
|
|
3497
|
+
var styleText = globalThis.process?.getBuiltinModule?.("node:util")?.styleText ?? ((_format, text) => text);
|
|
3498
|
+
var read_implementation = false;
|
|
3499
|
+
var manifest = false;
|
|
3500
|
+
var hooks = false;
|
|
3501
|
+
/**
|
|
3502
|
+
* The public `read` may return a promise, the runtime expects a stream
|
|
3503
|
+
* @param {NonNullable<import('@sveltejs/kit').ServerInitOptions['read']>} read
|
|
3504
|
+
*/
|
|
3505
|
+
function set_read_implementation(read) {
|
|
3506
|
+
read_implementation = (file) => {
|
|
3507
|
+
const result = read(file);
|
|
3508
|
+
if (result instanceof ReadableStream) return result;
|
|
3509
|
+
return stream_from_iterable((async function* () {
|
|
3510
|
+
const stream = await result;
|
|
3511
|
+
if (stream) yield* stream;
|
|
3512
|
+
})());
|
|
3513
|
+
};
|
|
3514
|
+
}
|
|
3515
|
+
/**
|
|
3516
|
+
*
|
|
3517
|
+
* @param {SSRManifest} value
|
|
3518
|
+
*/
|
|
3519
|
+
function set_manifest(value) {
|
|
3520
|
+
manifest = value;
|
|
3521
|
+
}
|
|
3522
|
+
/**
|
|
3523
|
+
* @param {ServerHooks} value
|
|
3524
|
+
*/
|
|
3525
|
+
function set_hooks(value) {
|
|
3526
|
+
hooks = value;
|
|
3527
|
+
}
|
|
3528
|
+
/**
|
|
3529
|
+
* @param {number} status
|
|
3530
|
+
* @param {Request} request
|
|
3531
|
+
* @param {SSRManifest} manifest
|
|
3532
|
+
* @returns {Promise<string>}
|
|
3533
|
+
*/
|
|
3534
|
+
async function format_response(status, request, manifest) {
|
|
3535
|
+
const url = new URL(request.url);
|
|
3536
|
+
const requested = url.href.replace(url.origin, "");
|
|
3537
|
+
let log = `${styleText(status < 400 ? ["cyan"] : ["bold", "red"], `${status}`)} `;
|
|
3538
|
+
if (has_data_suffix(url.pathname)) {
|
|
3539
|
+
log += `${request.method} `;
|
|
3540
|
+
const pathname = strip_data_suffix(url.pathname) || "/";
|
|
3541
|
+
log += pathname + styleText("dim", requested.slice(pathname.length));
|
|
3542
|
+
} else if (has_resolution_suffix(url.pathname)) {
|
|
3543
|
+
log += `${request.method} `;
|
|
3544
|
+
const pathname = strip_resolution_suffix(url.pathname) || "/";
|
|
3545
|
+
log += pathname + styleText("dim", requested.slice(pathname.length));
|
|
3546
|
+
} else if (has_remote_prefix(url)) {
|
|
3547
|
+
const id = strip_remote_prefix(url);
|
|
3548
|
+
/** @type {Awaited<ReturnType<typeof get_remote_function>>} */
|
|
3549
|
+
let remote;
|
|
3550
|
+
try {
|
|
3551
|
+
remote = await get_remote_function(id, manifest);
|
|
3552
|
+
} catch {}
|
|
3553
|
+
if (remote) {
|
|
3554
|
+
const internals = remote.fn.__;
|
|
3555
|
+
log += styleText(["bold", "magenta"], "ƒ ");
|
|
3556
|
+
log += styleText("magenta", `${internals.type.replace("_", ".")} `);
|
|
3557
|
+
if (internals.dev_loc) {
|
|
3558
|
+
let file_link = internals.dev_loc.file;
|
|
3559
|
+
if (internals.dev_loc.line != null) file_link += `#${internals.dev_loc.line}`;
|
|
3560
|
+
log += `\u001B]8;;${file_link}\u0007`;
|
|
3561
|
+
}
|
|
3562
|
+
log += styleText(["bold"], `${remote.name}()`);
|
|
3563
|
+
if (internals.dev_loc) log += "\x1B]8;;\x07";
|
|
3564
|
+
if (url.search) log += " " + styleText("dim", url.search);
|
|
3565
|
+
} else {
|
|
3566
|
+
log += `${request.method} `;
|
|
3567
|
+
const [file_hash, name, arg_hash] = id.split("/");
|
|
3568
|
+
log += styleText("dim", `${url.pathname.slice(0, -id.length)}${file_hash}/`) + name;
|
|
3569
|
+
if (arg_hash) log += styleText("dim", `/${arg_hash}`);
|
|
3570
|
+
if (url.search) log += styleText("dim", url.search);
|
|
3571
|
+
}
|
|
3572
|
+
} else log += `${request.method} ${requested}`;
|
|
3573
|
+
return log;
|
|
3574
|
+
}
|
|
3575
|
+
export { split_path as $, get_status as A, init_transport as B, method_not_allowed as C, with_version_header as D, throw_devalue_error as E, fetch_cache_url as F, matches_content_type as G, stringify as H, parse_remote_arg as I, deep_set as J, negotiate as K, stringify_remote_arg as L, INVALIDATED_PARAM as M, TRAILING_SLASH_PARAM as N, default_handle_error as O, create_remote_key as P, parse_form_key as Q, encoders as R, is_prerendering as S, serialize_uses as T, uneval as U, parse as V, is_form_content_type as W, group_formdata as X, flatten_issues as Y, normalize_issue as Z, is_action_json_request as _, app_dir as _t, set_hooks as a, find_route as at, get_node_type as b, set_fix_stack_trace as c, add_data_suffix as ct, get_remote_id as d, has_resolution_suffix as dt, stringify$1 as et, handle_remote_call as f, strip_data_suffix as ft, handle_action_request as g, text_encoder as gt, handle_action_json_request as h, stream_text as ht, read_implementation as i, options as it, normalize_error as j, handle_error_and_jsonify as k, collect_remote_data as l, add_resolution_suffix as lt, action_json_redirect as m, base64_encode as mt, hooks as n, resolve as nt, set_manifest as o, otel as ot, handle_remote_form_post as p, strip_resolution_suffix as pt, create_field_proxy as q, manifest as r, get_hooks as rt, set_read_implementation as s, record_span as st, format_response as t, uneval$1 as tt, get_remote_action as u, has_data_suffix as ut, is_action_request as v, assets as vt, redirect_response as w, has_prerendered_path as x, uneval_action_response as y, set_assets as yt, has_custom_transporters as z };
|
|
3576
|
+
|
|
3577
|
+
//# sourceMappingURL=internal.js.map
|