screenreader-speech-capture 0.2.0 → 0.3.0
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/dist/cli.mjs +15 -5
- package/dist/ui/adapter-node.js +4 -4
- package/dist/ui/client/ui/_app/immutable/assets/0.CeDGT9MW.css +1 -0
- package/dist/ui/client/ui/_app/immutable/assets/0.CeDGT9MW.css.br +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/0.CeDGT9MW.css.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/2.DJfIfRJB.css +1 -0
- package/dist/ui/client/ui/_app/immutable/assets/2.DJfIfRJB.css.br +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/2.DJfIfRJB.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/BaD2EyfF.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BaD2EyfF.js.br +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BaD2EyfF.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CcBdu3S8.js +3 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CcBdu3S8.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CcBdu3S8.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DSHrAZZ8.js +37 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DSHrAZZ8.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DSHrAZZ8.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DbiAGPgw.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DbiAGPgw.js.br +2 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DbiAGPgw.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Dg9MaatX.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Dg9MaatX.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Dg9MaatX.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DvmLiMpQ.js +3 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DvmLiMpQ.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DvmLiMpQ.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/app.2mjWY9ga.js +2 -0
- package/dist/ui/client/ui/_app/immutable/entry/app.2mjWY9ga.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/app.2mjWY9ga.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/start.BHpKgjPx.js +2 -0
- package/dist/ui/client/ui/_app/immutable/entry/start.BHpKgjPx.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/start.BHpKgjPx.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/0.CQ_XophD.js +1 -0
- package/dist/ui/client/ui/_app/immutable/nodes/0.CQ_XophD.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/0.CQ_XophD.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/1.Bd-KoKuj.js +1 -0
- package/dist/ui/client/ui/_app/immutable/nodes/1.Bd-KoKuj.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/1.Bd-KoKuj.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/2.BTJ1n3E7.js +224 -0
- package/dist/ui/client/ui/_app/immutable/nodes/2.BTJ1n3E7.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/2.BTJ1n3E7.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/3.CsdEJLWJ.js +1 -0
- package/dist/ui/client/ui/_app/immutable/nodes/3.CsdEJLWJ.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/3.CsdEJLWJ.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/4.CXVi2Rvi.js +1 -0
- package/dist/ui/client/ui/_app/immutable/nodes/4.CXVi2Rvi.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/4.CXVi2Rvi.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/server/.vite/manifest.json +269 -4
- package/dist/ui/server/_app/immutable/assets/_layout.CeDGT9MW.css +1 -0
- package/dist/ui/server/_app/immutable/assets/_page.DJfIfRJB.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/chunks/bridge-api.js +61 -0
- package/dist/ui/server/chunks/bridge-api.js.map +1 -0
- package/dist/ui/server/chunks/composition.js +232 -0
- package/dist/ui/server/chunks/composition.js.map +1 -0
- package/dist/ui/server/chunks/exports.js +69 -1
- package/dist/ui/server/chunks/exports.js.map +1 -1
- package/dist/ui/server/chunks/instance.js +20 -26
- package/dist/ui/server/chunks/instance.js.map +1 -1
- package/dist/ui/server/chunks/internal.js +102 -7
- package/dist/ui/server/chunks/internal.js.map +1 -1
- package/dist/ui/server/chunks/navigation.js +15 -0
- package/dist/ui/server/chunks/navigation.js.map +1 -0
- package/dist/ui/server/chunks/server2.js +30 -1
- package/dist/ui/server/chunks/server2.js.map +1 -1
- package/dist/ui/server/chunks/src.js +968 -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/entries/endpoints/api/sessions/_server.ts.js +18 -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 +10 -0
- package/dist/ui/server/entries/endpoints/api/sessions/end/_server.ts.js.map +1 -0
- package/dist/ui/server/entries/endpoints/api/status/_server.ts.js +10 -0
- package/dist/ui/server/entries/endpoints/api/status/_server.ts.js.map +1 -0
- package/dist/ui/server/entries/fallbacks/error.svelte.js +2 -35
- package/dist/ui/server/entries/fallbacks/error.svelte.js.map +1 -1
- package/dist/ui/server/entries/pages/_layout.server.ts.js +5 -980
- package/dist/ui/server/entries/pages/_layout.server.ts.js.map +1 -1
- package/dist/ui/server/entries/pages/_layout.svelte.js +194 -7
- package/dist/ui/server/entries/pages/_layout.svelte.js.map +1 -1
- 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 +213 -2
- package/dist/ui/server/entries/pages/_page.svelte.js.map +1 -1
- package/dist/ui/server/entries/pages/settings/_page.svelte.js +8 -0
- package/dist/ui/server/entries/pages/settings/_page.svelte.js.map +1 -0
- package/dist/ui/server/entries/pages/setup/_page.svelte.js +8 -0
- package/dist/ui/server/entries/pages/setup/_page.svelte.js.map +1 -0
- package/dist/ui/server/index.js +2 -2
- package/dist/ui/server/manifest-full.js +40 -3
- package/dist/ui/server/manifest.js +40 -3
- package/dist/ui/server/nodes/0.js +3 -3
- package/dist/ui/server/nodes/1.js +1 -1
- package/dist/ui/server/nodes/2.js +5 -3
- package/dist/ui/server/nodes/3.js +8 -0
- package/dist/ui/server/nodes/4.js +8 -0
- package/dist/ui/server/remote-entry.js +3 -3
- package/dist/ui/server/remote-entry.js.map +1 -1
- package/dist/ui/server/server.js +40 -3
- package/package.json +1 -1
- package/dist/ui/client/_app/immutable/chunks/BMrJcSB7.js +0 -3
- package/dist/ui/client/_app/immutable/chunks/BMrJcSB7.js.br +0 -0
- package/dist/ui/client/_app/immutable/chunks/BMrJcSB7.js.gz +0 -0
- package/dist/ui/client/_app/immutable/chunks/BueZJg5y.js +0 -2
- package/dist/ui/client/_app/immutable/chunks/BueZJg5y.js.br +0 -0
- package/dist/ui/client/_app/immutable/chunks/BueZJg5y.js.gz +0 -0
- package/dist/ui/client/_app/immutable/chunks/ZzrMKdp0.js +0 -1
- package/dist/ui/client/_app/immutable/chunks/ZzrMKdp0.js.br +0 -0
- package/dist/ui/client/_app/immutable/chunks/ZzrMKdp0.js.gz +0 -0
- package/dist/ui/client/_app/immutable/entry/app.BGREpuCm.js +0 -2
- package/dist/ui/client/_app/immutable/entry/app.BGREpuCm.js.br +0 -0
- package/dist/ui/client/_app/immutable/entry/app.BGREpuCm.js.gz +0 -0
- package/dist/ui/client/_app/immutable/entry/start.Bj3y6VYi.js +0 -2
- package/dist/ui/client/_app/immutable/entry/start.Bj3y6VYi.js.br +0 -0
- package/dist/ui/client/_app/immutable/entry/start.Bj3y6VYi.js.gz +0 -0
- package/dist/ui/client/_app/immutable/nodes/0.BdmtdjrF.js +0 -1
- package/dist/ui/client/_app/immutable/nodes/0.BdmtdjrF.js.br +0 -0
- package/dist/ui/client/_app/immutable/nodes/0.BdmtdjrF.js.gz +0 -0
- package/dist/ui/client/_app/immutable/nodes/1.B76I_t5U.js +0 -1
- package/dist/ui/client/_app/immutable/nodes/1.B76I_t5U.js.br +0 -0
- package/dist/ui/client/_app/immutable/nodes/1.B76I_t5U.js.gz +0 -0
- package/dist/ui/client/_app/immutable/nodes/2.CpNTEXmI.js +0 -1
- package/dist/ui/client/_app/immutable/nodes/2.CpNTEXmI.js.br +0 -0
- package/dist/ui/client/_app/immutable/nodes/2.CpNTEXmI.js.gz +0 -0
- package/dist/ui/client/_app/version.json +0 -1
- package/dist/ui/client/_app/version.json.br +0 -0
- package/dist/ui/client/_app/version.json.gz +0 -0
- /package/dist/ui/client/{_app → ui/_app}/immutable/chunks/Bjy-W4x2.js +0 -0
- /package/dist/ui/client/{_app → ui/_app}/immutable/chunks/Bjy-W4x2.js.br +0 -0
- /package/dist/ui/client/{_app → ui/_app}/immutable/chunks/Bjy-W4x2.js.gz +0 -0
- /package/dist/ui/client/{_app → ui/_app}/immutable/chunks/DclECHGd.js +0 -0
- /package/dist/ui/client/{_app → ui/_app}/immutable/chunks/DclECHGd.js.br +0 -0
- /package/dist/ui/client/{_app → ui/_app}/immutable/chunks/DclECHGd.js.gz +0 -0
- /package/dist/ui/client/{_app → ui/_app}/immutable/entry/payload.DSmR2FwN.js +0 -0
- /package/dist/ui/client/{_app → ui/_app}/immutable/entry/payload.DSmR2FwN.js.br +0 -0
- /package/dist/ui/client/{_app → ui/_app}/immutable/entry/payload.DSmR2FwN.js.gz +0 -0
- /package/dist/ui/client/{robots.txt → ui/robots.txt} +0 -0
- /package/dist/ui/client/{robots.txt.br → ui/robots.txt.br} +0 -0
- /package/dist/ui/client/{robots.txt.gz → ui/robots.txt.gz} +0 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { mt as resolve } from "./internal.js";
|
|
2
|
+
import { a as SessionListSchema, n as checkDto, r as StatusSchema, s as StartSessionResponseSchema } from "./src.js";
|
|
3
|
+
import "./server2.js";
|
|
4
|
+
// src/lib/core/theme.ts
|
|
5
|
+
var DEFAULT_THEME = "light";
|
|
6
|
+
function parseTheme(raw) {
|
|
7
|
+
return raw === "light" || raw === "dark" ? raw : null;
|
|
8
|
+
}
|
|
9
|
+
function toggleTheme(theme) {
|
|
10
|
+
return theme === "light" ? "dark" : "light";
|
|
11
|
+
}
|
|
12
|
+
// src/lib/adapters/browser-theme-storage.ts
|
|
13
|
+
var THEME_STORAGE_KEY = "sr-theme";
|
|
14
|
+
/** Keeps the theme in `localStorage` and applies it as `data-theme` on `<html>`. */
|
|
15
|
+
var BrowserThemeStorage = class {
|
|
16
|
+
read() {
|
|
17
|
+
try {
|
|
18
|
+
return parseTheme(localStorage.getItem(THEME_STORAGE_KEY));
|
|
19
|
+
} catch {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
write(theme) {
|
|
24
|
+
document.documentElement.dataset.theme = theme;
|
|
25
|
+
try {
|
|
26
|
+
localStorage.setItem(THEME_STORAGE_KEY, theme);
|
|
27
|
+
} catch {}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
// src/lib/adapters/http-sessions-api.ts
|
|
31
|
+
/** Reads and changes sessions through the UI's own sessions routes (`url` includes the base path). */
|
|
32
|
+
var HttpSessionsApi = class {
|
|
33
|
+
url;
|
|
34
|
+
constructor(url) {
|
|
35
|
+
this.url = url;
|
|
36
|
+
}
|
|
37
|
+
list() {
|
|
38
|
+
return this.send("GET", this.url, void 0, SessionListSchema);
|
|
39
|
+
}
|
|
40
|
+
start(name, run) {
|
|
41
|
+
return this.send("POST", this.url, {
|
|
42
|
+
name,
|
|
43
|
+
run
|
|
44
|
+
}, StartSessionResponseSchema);
|
|
45
|
+
}
|
|
46
|
+
async end() {
|
|
47
|
+
await this.send("POST", `${this.url}/end`, void 0, void 0);
|
|
48
|
+
}
|
|
49
|
+
async send(method, url, body, schema) {
|
|
50
|
+
const response = await fetch(url, {
|
|
51
|
+
method,
|
|
52
|
+
headers: {
|
|
53
|
+
accept: "application/json",
|
|
54
|
+
...body === void 0 ? {} : { "content-type": "application/json" }
|
|
55
|
+
},
|
|
56
|
+
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
57
|
+
});
|
|
58
|
+
if (!response.ok) throw new Error(await errorMessage(response));
|
|
59
|
+
if (schema === void 0) return void 0;
|
|
60
|
+
const checked = checkDto(schema, await response.json());
|
|
61
|
+
if (!checked.ok) throw new Error(`Unexpected answer at ${checked.field}: ${checked.message}`);
|
|
62
|
+
return checked.value;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
/** SvelteKit's `error()` answers `{ message }`; fall back to the status. */
|
|
66
|
+
async function errorMessage(response) {
|
|
67
|
+
const body = await response.json().catch(() => void 0);
|
|
68
|
+
if (typeof body === "object" && body !== null && "message" in body) {
|
|
69
|
+
const { message } = body;
|
|
70
|
+
if (typeof message === "string") return message;
|
|
71
|
+
}
|
|
72
|
+
return `The request answered ${response.status}`;
|
|
73
|
+
}
|
|
74
|
+
// src/lib/adapters/http-status-api.ts
|
|
75
|
+
/** Reads the bridge status through the UI's own status route (`url` includes the base path). */
|
|
76
|
+
var HttpStatusApi = class {
|
|
77
|
+
url;
|
|
78
|
+
constructor(url) {
|
|
79
|
+
this.url = url;
|
|
80
|
+
}
|
|
81
|
+
async fetch() {
|
|
82
|
+
const response = await fetch(this.url, { headers: { accept: "application/json" } });
|
|
83
|
+
if (!response.ok) throw new Error(`The status request answered ${response.status}`);
|
|
84
|
+
const checked = checkDto(StatusSchema, await response.json());
|
|
85
|
+
if (!checked.ok) throw new Error(`Unexpected status at ${checked.field}: ${checked.message}`);
|
|
86
|
+
return checked.value;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
// src/lib/stores/sessions.svelte.ts
|
|
90
|
+
var REFRESH_MS = 3e3;
|
|
91
|
+
function createSessionsStore(api) {
|
|
92
|
+
let sessions = [];
|
|
93
|
+
let currentId = null;
|
|
94
|
+
let reachable = true;
|
|
95
|
+
let loaded = false;
|
|
96
|
+
let now = Date.now();
|
|
97
|
+
let inFlight = null;
|
|
98
|
+
function apply(list) {
|
|
99
|
+
sessions = list.sessions;
|
|
100
|
+
currentId = list.currentId;
|
|
101
|
+
now = Date.now();
|
|
102
|
+
loaded = true;
|
|
103
|
+
}
|
|
104
|
+
function read() {
|
|
105
|
+
if (inFlight) return inFlight;
|
|
106
|
+
inFlight = api.list().then((list) => {
|
|
107
|
+
apply(list);
|
|
108
|
+
reachable = true;
|
|
109
|
+
}).catch(() => {
|
|
110
|
+
reachable = false;
|
|
111
|
+
}).finally(() => {
|
|
112
|
+
inFlight = null;
|
|
113
|
+
});
|
|
114
|
+
return inFlight;
|
|
115
|
+
}
|
|
116
|
+
/** A read that started before the change would show the old list, so wait for it and read again. */
|
|
117
|
+
async function refreshAfterChange() {
|
|
118
|
+
await inFlight;
|
|
119
|
+
await read();
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
get sessions() {
|
|
123
|
+
return sessions;
|
|
124
|
+
},
|
|
125
|
+
get currentId() {
|
|
126
|
+
return currentId;
|
|
127
|
+
},
|
|
128
|
+
/** Whether a list has been applied yet; until then the page shows what the server rendered. */
|
|
129
|
+
get loaded() {
|
|
130
|
+
return loaded;
|
|
131
|
+
},
|
|
132
|
+
get reachable() {
|
|
133
|
+
return reachable;
|
|
134
|
+
},
|
|
135
|
+
/** Epoch ms, ticking once a second while a session is live (for its duration). */
|
|
136
|
+
get now() {
|
|
137
|
+
return now;
|
|
138
|
+
},
|
|
139
|
+
/**
|
|
140
|
+
* Reads the list and keeps it fresh; `seed` is the list the server rendered, so there is no
|
|
141
|
+
* flash. Returns the function that stops the timers (call it when the page goes away).
|
|
142
|
+
*/
|
|
143
|
+
init(seed) {
|
|
144
|
+
if (seed && sessions.length === 0) apply(seed);
|
|
145
|
+
read();
|
|
146
|
+
const tick = setInterval(() => {
|
|
147
|
+
if (currentId !== null) now = Date.now();
|
|
148
|
+
}, 1e3);
|
|
149
|
+
const refresh = setInterval(() => void read(), REFRESH_MS);
|
|
150
|
+
return () => {
|
|
151
|
+
clearInterval(tick);
|
|
152
|
+
clearInterval(refresh);
|
|
153
|
+
};
|
|
154
|
+
},
|
|
155
|
+
/** Starts a session, which ends the previous one. Rejects with the bridge's message. */
|
|
156
|
+
async start(name, run) {
|
|
157
|
+
const started = await api.start(name, run);
|
|
158
|
+
await refreshAfterChange();
|
|
159
|
+
return started;
|
|
160
|
+
},
|
|
161
|
+
async end() {
|
|
162
|
+
await api.end();
|
|
163
|
+
await refreshAfterChange();
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
// src/lib/stores/status.svelte.ts
|
|
168
|
+
function createStatusStore(api) {
|
|
169
|
+
let status = null;
|
|
170
|
+
let reachable = true;
|
|
171
|
+
let loading = false;
|
|
172
|
+
let inFlight = null;
|
|
173
|
+
function read() {
|
|
174
|
+
if (inFlight) return inFlight;
|
|
175
|
+
loading = true;
|
|
176
|
+
inFlight = api.fetch().then((next) => {
|
|
177
|
+
status = next;
|
|
178
|
+
reachable = true;
|
|
179
|
+
}).catch(() => {
|
|
180
|
+
reachable = false;
|
|
181
|
+
}).finally(() => {
|
|
182
|
+
loading = false;
|
|
183
|
+
inFlight = null;
|
|
184
|
+
});
|
|
185
|
+
return inFlight;
|
|
186
|
+
}
|
|
187
|
+
return {
|
|
188
|
+
get status() {
|
|
189
|
+
return status;
|
|
190
|
+
},
|
|
191
|
+
get reachable() {
|
|
192
|
+
return reachable;
|
|
193
|
+
},
|
|
194
|
+
get loading() {
|
|
195
|
+
return loading;
|
|
196
|
+
},
|
|
197
|
+
/** Reads the status once; `seed` is the status the server rendered, so there is no flash. */
|
|
198
|
+
init(seed) {
|
|
199
|
+
if (seed && status === null) status = seed;
|
|
200
|
+
read();
|
|
201
|
+
},
|
|
202
|
+
/** The refresh button. */
|
|
203
|
+
retry() {
|
|
204
|
+
return read();
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
// src/lib/stores/theme.svelte.ts
|
|
209
|
+
function createThemeStore(storage) {
|
|
210
|
+
let current = DEFAULT_THEME;
|
|
211
|
+
return {
|
|
212
|
+
get current() {
|
|
213
|
+
return current;
|
|
214
|
+
},
|
|
215
|
+
/** Pick up the saved choice. Call it in the browser only, after hydration. */
|
|
216
|
+
init() {
|
|
217
|
+
current = storage.read() ?? "light";
|
|
218
|
+
},
|
|
219
|
+
toggle() {
|
|
220
|
+
current = toggleTheme(current);
|
|
221
|
+
storage.write(current);
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
// src/lib/composition.ts
|
|
226
|
+
/** Wires the adapters into the stores; components get the stores, never the adapters. */
|
|
227
|
+
var themeStore = createThemeStore(new BrowserThemeStorage());
|
|
228
|
+
var statusStore = createStatusStore(new HttpStatusApi(resolve("/api/status")));
|
|
229
|
+
var sessionsStore = createSessionsStore(new HttpSessionsApi(resolve("/api/sessions")));
|
|
230
|
+
export { statusStore as n, themeStore as r, sessionsStore as t };
|
|
231
|
+
|
|
232
|
+
//# sourceMappingURL=composition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composition.js","names":[],"sources":["../../../src/lib/core/theme.ts","../../../src/lib/adapters/browser-theme-storage.ts","../../../src/lib/adapters/http-sessions-api.ts","../../../src/lib/adapters/http-status-api.ts","../../../src/lib/stores/sessions.svelte.ts","../../../src/lib/stores/status.svelte.ts","../../../src/lib/stores/theme.svelte.ts","../../../src/lib/composition.ts"],"sourcesContent":["export type Theme = 'light' | 'dark';\n\nexport const DEFAULT_THEME: Theme = 'light';\n\n/** Where the chosen theme is remembered and applied (the browser adapter implements it). */\nexport interface ThemeStorage {\n /** The saved choice, or `null` when there is none or it can't be read. */\n read(): Theme | null;\n /** Remember the choice and make it take effect. */\n write(theme: Theme): void;\n}\n\nexport function parseTheme(raw: unknown): Theme | null {\n return raw === 'light' || raw === 'dark' ? raw : null;\n}\n\nexport function toggleTheme(theme: Theme): Theme {\n return theme === 'light' ? 'dark' : 'light';\n}\n","import { parseTheme, type Theme, type ThemeStorage } from '#lib/core/theme.js';\n\nexport const THEME_STORAGE_KEY = 'sr-theme';\n\n/** Keeps the theme in `localStorage` and applies it as `data-theme` on `<html>`. */\nexport class BrowserThemeStorage implements ThemeStorage {\n read(): Theme | null {\n try {\n return parseTheme(localStorage.getItem(THEME_STORAGE_KEY));\n } catch {\n return null; // blocked storage, or running on the server\n }\n }\n\n write(theme: Theme): void {\n document.documentElement.dataset.theme = theme;\n try {\n localStorage.setItem(THEME_STORAGE_KEY, theme);\n } catch {\n // the theme still applies for this page view\n }\n }\n}\n","import {\n checkDto,\n SessionListSchema,\n StartSessionResponseSchema,\n type DtoOf,\n type DtoSchema,\n type SessionListDto,\n type StartSessionResponseDto,\n} from '@screenreader-speech-capture/shared';\nimport type { SessionsApi } from '#lib/core/sessions.js';\n\n/** Reads and changes sessions through the UI's own sessions routes (`url` includes the base path). */\nexport class HttpSessionsApi implements SessionsApi {\n constructor(private readonly url: string) {}\n\n list(): Promise<SessionListDto> {\n return this.send('GET', this.url, undefined, SessionListSchema);\n }\n\n start(name: string, run: string | null): Promise<StartSessionResponseDto> {\n return this.send('POST', this.url, { name, run }, StartSessionResponseSchema);\n }\n\n async end(): Promise<void> {\n await this.send('POST', `${this.url}/end`, undefined, undefined);\n }\n\n private async send<S extends DtoSchema>(\n method: 'GET' | 'POST',\n url: string,\n body: unknown,\n schema: S | undefined,\n ): Promise<DtoOf<S>> {\n const response = await fetch(url, {\n method,\n headers: {\n accept: 'application/json',\n ...(body === undefined ? {} : { 'content-type': 'application/json' }),\n },\n body: body === undefined ? undefined : JSON.stringify(body),\n });\n if (!response.ok) throw new Error(await errorMessage(response));\n if (schema === undefined) return undefined;\n const checked = checkDto(schema, await response.json());\n if (!checked.ok) throw new Error(`Unexpected answer at ${checked.field}: ${checked.message}`);\n return checked.value;\n }\n}\n\n/** SvelteKit's `error()` answers `{ message }`; fall back to the status. */\nasync function errorMessage(response: Response): Promise<string> {\n const body: unknown = await response.json().catch(() => undefined);\n if (typeof body === 'object' && body !== null && 'message' in body) {\n const { message } = body;\n if (typeof message === 'string') return message;\n }\n return `The request answered ${response.status}`;\n}\n","import { checkDto, StatusSchema, type StatusDto } from '@screenreader-speech-capture/shared';\nimport type { StatusApi } from '#lib/core/status.js';\n\n/** Reads the bridge status through the UI's own status route (`url` includes the base path). */\nexport class HttpStatusApi implements StatusApi {\n constructor(private readonly url: string) {}\n\n async fetch(): Promise<StatusDto> {\n const response = await fetch(this.url, { headers: { accept: 'application/json' } });\n if (!response.ok) throw new Error(`The status request answered ${response.status}`);\n const checked = checkDto(StatusSchema, await response.json());\n if (!checked.ok) throw new Error(`Unexpected status at ${checked.field}: ${checked.message}`);\n return checked.value;\n }\n}\n","import type { SessionsApi } from '#lib/core/sessions.js';\nimport type { SessionDto, SessionListDto } from '@screenreader-speech-capture/shared';\n\n/** How often the list is read again, so entry counts and sessions of other clients show up. */\nconst REFRESH_MS = 3000;\n\n/** The sessions: read on `init`, then every few seconds, and after every start or end. */\nexport function createSessionsStore(api: SessionsApi) {\n let sessions = $state<SessionDto[]>([]);\n let currentId = $state<number | null>(null);\n let reachable = $state(true);\n let loaded = $state(false);\n let now = $state(Date.now());\n let inFlight: Promise<void> | null = null;\n\n function apply(list: SessionListDto): void {\n sessions = list.sessions;\n currentId = list.currentId;\n now = Date.now();\n loaded = true;\n }\n\n function read(): Promise<void> {\n if (inFlight) return inFlight;\n inFlight = api\n .list()\n .then((list) => {\n apply(list);\n reachable = true;\n })\n .catch(() => {\n reachable = false; // the last known list stays\n })\n .finally(() => {\n inFlight = null;\n });\n return inFlight;\n }\n\n /** A read that started before the change would show the old list, so wait for it and read again. */\n async function refreshAfterChange(): Promise<void> {\n await inFlight;\n await read();\n }\n\n return {\n get sessions() {\n return sessions;\n },\n get currentId() {\n return currentId;\n },\n /** Whether a list has been applied yet; until then the page shows what the server rendered. */\n get loaded() {\n return loaded;\n },\n get reachable() {\n return reachable;\n },\n /** Epoch ms, ticking once a second while a session is live (for its duration). */\n get now() {\n return now;\n },\n /**\n * Reads the list and keeps it fresh; `seed` is the list the server rendered, so there is no\n * flash. Returns the function that stops the timers (call it when the page goes away).\n */\n init(seed: SessionListDto | null): () => void {\n if (seed && sessions.length === 0) apply(seed);\n void read();\n const tick = setInterval(() => {\n if (currentId !== null) now = Date.now();\n }, 1000);\n const refresh = setInterval(() => void read(), REFRESH_MS);\n return () => {\n clearInterval(tick);\n clearInterval(refresh);\n };\n },\n /** Starts a session, which ends the previous one. Rejects with the bridge's message. */\n async start(name: string, run: string | null): Promise<SessionDto> {\n const started = await api.start(name, run);\n await refreshAfterChange();\n return started;\n },\n async end(): Promise<void> {\n await api.end();\n await refreshAfterChange();\n },\n };\n}\n","import type { StatusApi } from '#lib/core/status.js';\nimport type { StatusDto } from '@screenreader-speech-capture/shared';\n\n/** The bridge status: read once on init and again on `retry()`. There is no polling. */\nexport function createStatusStore(api: StatusApi) {\n let status = $state<StatusDto | null>(null);\n let reachable = $state(true);\n let loading = $state(false);\n let inFlight: Promise<void> | null = null;\n\n function read(): Promise<void> {\n if (inFlight) return inFlight;\n loading = true;\n inFlight = api\n .fetch()\n .then((next) => {\n status = next;\n reachable = true;\n })\n .catch(() => {\n reachable = false; // the last known status stays, greyed out\n })\n .finally(() => {\n loading = false;\n inFlight = null;\n });\n return inFlight;\n }\n\n return {\n get status() {\n return status;\n },\n get reachable() {\n return reachable;\n },\n get loading() {\n return loading;\n },\n /** Reads the status once; `seed` is the status the server rendered, so there is no flash. */\n init(seed: StatusDto | null): void {\n if (seed && status === null) status = seed;\n void read();\n },\n /** The refresh button. */\n retry(): Promise<void> {\n return read();\n },\n };\n}\n","import { DEFAULT_THEME, toggleTheme, type Theme, type ThemeStorage } from '#lib/core/theme.js';\n\nexport function createThemeStore(storage: ThemeStorage) {\n let current = $state<Theme>(DEFAULT_THEME);\n return {\n get current() {\n return current;\n },\n /** Pick up the saved choice. Call it in the browser only, after hydration. */\n init() {\n current = storage.read() ?? DEFAULT_THEME;\n },\n toggle() {\n current = toggleTheme(current);\n storage.write(current);\n },\n };\n}\n","import { resolve } from '$app/paths';\nimport { BrowserThemeStorage } from '#lib/adapters/browser-theme-storage.js';\nimport { markIconFontReady } from '#lib/adapters/icon-font.js';\nimport { HttpSessionsApi } from '#lib/adapters/http-sessions-api.js';\nimport { HttpStatusApi } from '#lib/adapters/http-status-api.js';\nimport { createSessionsStore } from '#lib/stores/sessions.svelte.js';\nimport { createStatusStore } from '#lib/stores/status.svelte.js';\nimport { createThemeStore } from '#lib/stores/theme.svelte.js';\n\n/** Wires the adapters into the stores; components get the stores, never the adapters. */\nexport const themeStore = createThemeStore(new BrowserThemeStorage());\nexport const statusStore = createStatusStore(new HttpStatusApi(resolve('/api/status')));\nexport const sessionsStore = createSessionsStore(new HttpSessionsApi(resolve('/api/sessions')));\n\n/** Ends the icon placeholder shimmer once the icon font is loaded. */\nexport { markIconFontReady };\n"],"mappings":"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"}
|
|
@@ -234,6 +234,51 @@ function remote_argument_unsupported(_values) {
|
|
|
234
234
|
throw new Error("https://svelte.dev/e/kit/remote_argument_unsupported");
|
|
235
235
|
}
|
|
236
236
|
/**
|
|
237
|
+
* Missing params for dynamic route ID `%id%`
|
|
238
|
+
* @param {{ "id": string }} _values
|
|
239
|
+
* @returns {never}
|
|
240
|
+
*/
|
|
241
|
+
function resolve_params_missing(_values) {
|
|
242
|
+
if (verbose) throw_error("resolve_params_missing", `Missing params for dynamic route ID \`${_values.id}\``, resolve_params_missing);
|
|
243
|
+
throw new Error("https://svelte.dev/e/kit/resolve_params_missing");
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Cannot use `resolve(...)` with an absolute or protocol-relative URL (got "%id%")
|
|
247
|
+
* @param {{ "id": string }} _values
|
|
248
|
+
* @returns {never}
|
|
249
|
+
*/
|
|
250
|
+
function resolve_url_input(_values) {
|
|
251
|
+
if (verbose) throw_error("resolve_url_input", `Cannot use \`resolve(...)\` with an absolute or protocol-relative URL (got "${_values.id}")`, resolve_url_input);
|
|
252
|
+
throw new Error("https://svelte.dev/e/kit/resolve_url_input");
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Missing parameter `%name%` in route `%id%`
|
|
256
|
+
* @param {{ "name": string; "id": string }} _values
|
|
257
|
+
* @returns {never}
|
|
258
|
+
*/
|
|
259
|
+
function route_param_missing(_values) {
|
|
260
|
+
if (verbose) throw_error("route_param_missing", `Missing parameter \`${_values.name}\` in route \`${_values.id}\``, route_param_missing);
|
|
261
|
+
throw new Error("https://svelte.dev/e/kit/route_param_missing");
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Parameter `%name%` in route `%id%` cannot start or end with a slash — this would cause an invalid route like `foo/bar`
|
|
265
|
+
* @param {{ "name": string; "id": string }} _values
|
|
266
|
+
* @returns {never}
|
|
267
|
+
*/
|
|
268
|
+
function route_param_slash(_values) {
|
|
269
|
+
if (verbose) throw_error("route_param_slash", `Parameter \`${_values.name}\` in route \`${_values.id}\` cannot start or end with a slash — this would cause an invalid route like \`foo/bar\``, route_param_slash);
|
|
270
|
+
throw new Error("https://svelte.dev/e/kit/route_param_slash");
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Parameter `%name%` in route `%id%` must be a string, number, boolean, or bigint
|
|
274
|
+
* @param {{ "name": string; "id": string }} _values
|
|
275
|
+
* @returns {never}
|
|
276
|
+
*/
|
|
277
|
+
function route_param_value_invalid(_values) {
|
|
278
|
+
if (verbose) throw_error("route_param_value_invalid", `Parameter \`${_values.name}\` in route \`${_values.id}\` must be a string, number, boolean, or bigint`, route_param_value_invalid);
|
|
279
|
+
throw new Error("https://svelte.dev/e/kit/route_param_value_invalid");
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
237
282
|
* Cannot access `event.url.hash`. Consider using `page.url.hash` inside a component instead
|
|
238
283
|
* @param {void} _values
|
|
239
284
|
* @returns {never}
|
|
@@ -248,6 +293,13 @@ function url_hash_unavailable(_values) {
|
|
|
248
293
|
* @type {RegExp}
|
|
249
294
|
*/
|
|
250
295
|
var SCHEME = /^[a-z][a-z\d+\-.]*:/i;
|
|
296
|
+
/**
|
|
297
|
+
* Whether the string starts with a scheme (`https:`) or authority (`//example.com`)
|
|
298
|
+
* @param {string} str
|
|
299
|
+
*/
|
|
300
|
+
function has_scheme_or_authority(str) {
|
|
301
|
+
return SCHEME.test(str) || str.startsWith("//");
|
|
302
|
+
}
|
|
251
303
|
var internal = new URL("a://");
|
|
252
304
|
/**
|
|
253
305
|
* @param {string} base
|
|
@@ -459,6 +511,22 @@ function isRedirect(e) {
|
|
|
459
511
|
return e instanceof Redirect;
|
|
460
512
|
}
|
|
461
513
|
/**
|
|
514
|
+
* Create a JSON `Response` object from the supplied data.
|
|
515
|
+
* @param {any} data The value that will be serialized as JSON.
|
|
516
|
+
* @param {ResponseInit} [init] Options such as `status` and `headers` that will be added to the response. `Content-Type: application/json` and `Content-Length` headers will be added automatically.
|
|
517
|
+
* @deprecated use `Response.json`
|
|
518
|
+
*/
|
|
519
|
+
function json(data, init) {
|
|
520
|
+
const body = JSON.stringify(data);
|
|
521
|
+
const headers = new Headers(init?.headers);
|
|
522
|
+
if (!headers.has("content-length")) headers.set("content-length", text_encoder.encode(body).byteLength.toString());
|
|
523
|
+
if (!headers.has("content-type")) headers.set("content-type", "application/json");
|
|
524
|
+
return new Response(body, {
|
|
525
|
+
...init,
|
|
526
|
+
headers
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
462
530
|
* Create a `Response` object from the supplied body.
|
|
463
531
|
* @param {string} body The value that will be used as-is.
|
|
464
532
|
* @param {ResponseInit} [init] Options such as `status` and `headers` that will be added to the response. A `Content-Length` header will be added automatically.
|
|
@@ -479,6 +547,6 @@ function text(body, init) {
|
|
|
479
547
|
headers
|
|
480
548
|
});
|
|
481
549
|
}
|
|
482
|
-
export {
|
|
550
|
+
export { route_param_slash as A, PAGE_METHODS as B, load_invalid_response as C, resolve_params_missing as D, remote_argument_unsupported as E, with_request_store as F, normal as G, SVELTE_KIT_ASSETS as H, BODY_DEPENDENT_METHODS as I, ENDPOINT_METHODS as L, merge_tracing as M, get_request_store as N, resolve_url_input as O, try_get_request_store as P, IN_WEBCONTAINER as R, invalid_export_location as S, param_matcher_result_invalid as T, bold as U, REROUTED_URL_HEADER as V, enable_verbose_errors as W, form_field_forbidden_key as _, depends_special_scheme as a, form_input_missing_value as b, decode_pathname as c, make_trackable as d, normalize_path as f, form_field_duplicate as g, form_field_array_conflict as h, text as i, route_param_value_invalid as j, route_param_missing as k, disable_search as l, resolve as m, isRedirect as n, form_fields_enumerated as o, relative_pathname as p, json as r, SCHEME as s, error as t, has_scheme_or_authority as u, form_field_invalid_name as v, param_matcher_async as w, invalid_export as x, form_field_unbound as y, MUTATIVE_METHODS as z };
|
|
483
551
|
|
|
484
552
|
//# sourceMappingURL=exports.js.map
|