@serfab/cadre-host 0.7.1
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/README.md +101 -0
- package/dist/auth/duration.d.ts +1 -0
- package/dist/auth/duration.js +32 -0
- package/dist/auth/duration.js.map +1 -0
- package/dist/auth/index.d.ts +9 -0
- package/dist/auth/index.js +8 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/trust-circle-store.d.ts +26 -0
- package/dist/auth/trust-circle-store.js +129 -0
- package/dist/auth/trust-circle-store.js.map +1 -0
- package/dist/auth/trust-circle.d.ts +91 -0
- package/dist/auth/trust-circle.js +230 -0
- package/dist/auth/trust-circle.js.map +1 -0
- package/dist/auth/types.d.ts +81 -0
- package/dist/auth/types.js +24 -0
- package/dist/auth/types.js.map +1 -0
- package/dist/bin/host.d.ts +13 -0
- package/dist/bin/host.js +826 -0
- package/dist/bin/host.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/installer/browser.d.ts +14 -0
- package/dist/installer/browser.js +35 -0
- package/dist/installer/browser.js.map +1 -0
- package/dist/installer/config.d.ts +43 -0
- package/dist/installer/config.js +113 -0
- package/dist/installer/config.js.map +1 -0
- package/dist/installer/identity.d.ts +23 -0
- package/dist/installer/identity.js +36 -0
- package/dist/installer/identity.js.map +1 -0
- package/dist/installer/index.d.ts +83 -0
- package/dist/installer/index.js +204 -0
- package/dist/installer/index.js.map +1 -0
- package/dist/installer/paths.d.ts +33 -0
- package/dist/installer/paths.js +84 -0
- package/dist/installer/paths.js.map +1 -0
- package/dist/installer/platform.d.ts +9 -0
- package/dist/installer/platform.js +21 -0
- package/dist/installer/platform.js.map +1 -0
- package/dist/installer/service-host/index.d.ts +11 -0
- package/dist/installer/service-host/index.js +16 -0
- package/dist/installer/service-host/index.js.map +1 -0
- package/dist/installer/service-host/launchd.d.ts +16 -0
- package/dist/installer/service-host/launchd.js +79 -0
- package/dist/installer/service-host/launchd.js.map +1 -0
- package/dist/installer/service-host/nssm.d.ts +20 -0
- package/dist/installer/service-host/nssm.js +88 -0
- package/dist/installer/service-host/nssm.js.map +1 -0
- package/dist/installer/service-host/systemd.d.ts +16 -0
- package/dist/installer/service-host/systemd.js +78 -0
- package/dist/installer/service-host/systemd.js.map +1 -0
- package/dist/installer/service-host/template.d.ts +6 -0
- package/dist/installer/service-host/template.js +20 -0
- package/dist/installer/service-host/template.js.map +1 -0
- package/dist/installer/service-host/types.d.ts +40 -0
- package/dist/installer/service-host/types.js +6 -0
- package/dist/installer/service-host/types.js.map +1 -0
- package/dist/installer/wizard.d.ts +31 -0
- package/dist/installer/wizard.js +67 -0
- package/dist/installer/wizard.js.map +1 -0
- package/dist/nat/address-resolver.d.ts +22 -0
- package/dist/nat/address-resolver.js +31 -0
- package/dist/nat/address-resolver.js.map +1 -0
- package/dist/nat/ddns/duckdns.d.ts +12 -0
- package/dist/nat/ddns/duckdns.js +57 -0
- package/dist/nat/ddns/duckdns.js.map +1 -0
- package/dist/nat/ddns/index.d.ts +30 -0
- package/dist/nat/ddns/index.js +21 -0
- package/dist/nat/ddns/index.js.map +1 -0
- package/dist/nat/ddns/updater.d.ts +68 -0
- package/dist/nat/ddns/updater.js +194 -0
- package/dist/nat/ddns/updater.js.map +1 -0
- package/dist/nat/external-ip.d.ts +62 -0
- package/dist/nat/external-ip.js +114 -0
- package/dist/nat/external-ip.js.map +1 -0
- package/dist/nat/index.d.ts +22 -0
- package/dist/nat/index.js +16 -0
- package/dist/nat/index.js.map +1 -0
- package/dist/nat/nat-service.d.ts +101 -0
- package/dist/nat/nat-service.js +284 -0
- package/dist/nat/nat-service.js.map +1 -0
- package/dist/nat/nat-store.d.ts +19 -0
- package/dist/nat/nat-store.js +136 -0
- package/dist/nat/nat-store.js.map +1 -0
- package/dist/nat/port-mapper.d.ts +98 -0
- package/dist/nat/port-mapper.js +226 -0
- package/dist/nat/port-mapper.js.map +1 -0
- package/dist/nat/reachability.d.ts +19 -0
- package/dist/nat/reachability.js +29 -0
- package/dist/nat/reachability.js.map +1 -0
- package/dist/nat/secrets/file-store.d.ts +23 -0
- package/dist/nat/secrets/file-store.js +102 -0
- package/dist/nat/secrets/file-store.js.map +1 -0
- package/dist/nat/secrets/index.d.ts +36 -0
- package/dist/nat/secrets/index.js +56 -0
- package/dist/nat/secrets/index.js.map +1 -0
- package/dist/nat/secrets/keytar-store.d.ts +18 -0
- package/dist/nat/secrets/keytar-store.js +52 -0
- package/dist/nat/secrets/keytar-store.js.map +1 -0
- package/dist/nat/types.d.ts +120 -0
- package/dist/nat/types.js +24 -0
- package/dist/nat/types.js.map +1 -0
- package/dist/orchestrator/host-process-orchestrator.d.ts +87 -0
- package/dist/orchestrator/host-process-orchestrator.js +557 -0
- package/dist/orchestrator/host-process-orchestrator.js.map +1 -0
- package/dist/orchestrator/index.d.ts +3 -0
- package/dist/orchestrator/index.js +2 -0
- package/dist/orchestrator/index.js.map +1 -0
- package/dist/orchestrator/log-rotator.d.ts +25 -0
- package/dist/orchestrator/log-rotator.js +56 -0
- package/dist/orchestrator/log-rotator.js.map +1 -0
- package/dist/orchestrator/pid-liveness.d.ts +11 -0
- package/dist/orchestrator/pid-liveness.js +26 -0
- package/dist/orchestrator/pid-liveness.js.map +1 -0
- package/dist/orchestrator/port-allocator.d.ts +16 -0
- package/dist/orchestrator/port-allocator.js +38 -0
- package/dist/orchestrator/port-allocator.js.map +1 -0
- package/dist/orchestrator/state-store.d.ts +32 -0
- package/dist/orchestrator/state-store.js +44 -0
- package/dist/orchestrator/state-store.js.map +1 -0
- package/dist/orchestrator/types.d.ts +85 -0
- package/dist/orchestrator/types.js +31 -0
- package/dist/orchestrator/types.js.map +1 -0
- package/dist/server/error-handler.d.ts +26 -0
- package/dist/server/error-handler.js +95 -0
- package/dist/server/error-handler.js.map +1 -0
- package/dist/server/events/bus.d.ts +17 -0
- package/dist/server/events/bus.js +36 -0
- package/dist/server/events/bus.js.map +1 -0
- package/dist/server/events/sse-route.d.ts +22 -0
- package/dist/server/events/sse-route.js +65 -0
- package/dist/server/events/sse-route.js.map +1 -0
- package/dist/server/events/types.d.ts +25 -0
- package/dist/server/events/types.js +8 -0
- package/dist/server/events/types.js.map +1 -0
- package/dist/server/index.d.ts +67 -0
- package/dist/server/index.js +149 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/origin-guard.d.ts +24 -0
- package/dist/server/origin-guard.js +72 -0
- package/dist/server/origin-guard.js.map +1 -0
- package/dist/server/routes/nat.d.ts +16 -0
- package/dist/server/routes/nat.js +42 -0
- package/dist/server/routes/nat.js.map +1 -0
- package/dist/server/routes/nodes.d.ts +23 -0
- package/dist/server/routes/nodes.js +128 -0
- package/dist/server/routes/nodes.js.map +1 -0
- package/dist/server/routes/settings.d.ts +26 -0
- package/dist/server/routes/settings.js +97 -0
- package/dist/server/routes/settings.js.map +1 -0
- package/dist/server/routes/status.d.ts +42 -0
- package/dist/server/routes/status.js +76 -0
- package/dist/server/routes/status.js.map +1 -0
- package/dist/server/routes/trust-circle.d.ts +17 -0
- package/dist/server/routes/trust-circle.js +35 -0
- package/dist/server/routes/trust-circle.js.map +1 -0
- package/dist/server/routes/update.d.ts +16 -0
- package/dist/server/routes/update.js +29 -0
- package/dist/server/routes/update.js.map +1 -0
- package/dist/server/server.d.ts +40 -0
- package/dist/server/server.js +90 -0
- package/dist/server/server.js.map +1 -0
- package/dist/server/settings-store.d.ts +24 -0
- package/dist/server/settings-store.js +27 -0
- package/dist/server/settings-store.js.map +1 -0
- package/dist/server/static.d.ts +25 -0
- package/dist/server/static.js +177 -0
- package/dist/server/static.js.map +1 -0
- package/dist/ui/assets/index-BwU5mJGF.css +1 -0
- package/dist/ui/assets/index-C9uChk2P.js +14 -0
- package/dist/ui/assets/index-C9uChk2P.js.map +1 -0
- package/dist/ui/index.html +14 -0
- package/dist/update/apply.d.ts +37 -0
- package/dist/update/apply.js +102 -0
- package/dist/update/apply.js.map +1 -0
- package/dist/update/index.d.ts +101 -0
- package/dist/update/index.js +228 -0
- package/dist/update/index.js.map +1 -0
- package/dist/update/manifest.d.ts +48 -0
- package/dist/update/manifest.js +152 -0
- package/dist/update/manifest.js.map +1 -0
- package/dist/update/release-key.d.ts +24 -0
- package/dist/update/release-key.js +52 -0
- package/dist/update/release-key.js.map +1 -0
- package/dist/update/store.d.ts +22 -0
- package/dist/update/store.js +81 -0
- package/dist/update/store.js.map +1 -0
- package/dist/update/types.d.ts +90 -0
- package/dist/update/types.js +22 -0
- package/dist/update/types.js.map +1 -0
- package/dist/update/version.d.ts +18 -0
- package/dist/update/version.js +76 -0
- package/dist/update/version.js.map +1 -0
- package/package.json +80 -0
- package/service/README.md +86 -0
- package/service/cadre-host.service.tmpl +16 -0
- package/service/com.serfab.cadre-host.plist.tmpl +35 -0
- package/service/install-service.ps1 +98 -0
- package/service/uninstall-service.ps1 +19 -0
- package/src/__tests__/cli-invite.smoke.test.ts +187 -0
- package/src/__tests__/cli-nat.smoke.test.ts +207 -0
- package/src/__tests__/cli.smoke.test.ts +41 -0
- package/src/__tests__/orchestrator.test.ts +570 -0
- package/src/auth/__tests__/duration.test.ts +28 -0
- package/src/auth/__tests__/trust-circle-integration.test.ts +128 -0
- package/src/auth/__tests__/trust-circle-store.test.ts +115 -0
- package/src/auth/__tests__/trust-circle.test.ts +334 -0
- package/src/auth/duration.ts +33 -0
- package/src/auth/index.ts +19 -0
- package/src/auth/trust-circle-store.ts +155 -0
- package/src/auth/trust-circle.ts +304 -0
- package/src/auth/types.ts +96 -0
- package/src/bin/host.ts +905 -0
- package/src/index.ts +167 -0
- package/src/installer/__tests__/config.test.ts +86 -0
- package/src/installer/__tests__/identity.test.ts +34 -0
- package/src/installer/__tests__/installer.smoke.test.ts +124 -0
- package/src/installer/__tests__/paths.test.ts +47 -0
- package/src/installer/__tests__/service-host.test.ts +62 -0
- package/src/installer/__tests__/wizard.test.ts +60 -0
- package/src/installer/browser.ts +42 -0
- package/src/installer/config.ts +153 -0
- package/src/installer/identity.ts +49 -0
- package/src/installer/index.ts +303 -0
- package/src/installer/paths.ts +109 -0
- package/src/installer/platform.ts +27 -0
- package/src/installer/service-host/index.ts +21 -0
- package/src/installer/service-host/launchd.ts +90 -0
- package/src/installer/service-host/nssm.ts +100 -0
- package/src/installer/service-host/systemd.ts +88 -0
- package/src/installer/service-host/template.ts +21 -0
- package/src/installer/service-host/types.ts +48 -0
- package/src/installer/wizard.ts +92 -0
- package/src/nat/__tests__/address-resolver.test.ts +82 -0
- package/src/nat/__tests__/ddns-duckdns.test.ts +83 -0
- package/src/nat/__tests__/ddns-updater.test.ts +253 -0
- package/src/nat/__tests__/external-ip.test.ts +124 -0
- package/src/nat/__tests__/nat-service.test.ts +305 -0
- package/src/nat/__tests__/nat-store.test.ts +93 -0
- package/src/nat/__tests__/port-mapper.test.ts +191 -0
- package/src/nat/__tests__/reachability.test.ts +24 -0
- package/src/nat/__tests__/secrets.test.ts +156 -0
- package/src/nat/address-resolver.ts +51 -0
- package/src/nat/ddns/duckdns.ts +76 -0
- package/src/nat/ddns/index.ts +55 -0
- package/src/nat/ddns/updater.ts +243 -0
- package/src/nat/external-ip.ts +154 -0
- package/src/nat/index.ts +71 -0
- package/src/nat/nat-service.ts +375 -0
- package/src/nat/nat-store.ts +154 -0
- package/src/nat/port-mapper.ts +329 -0
- package/src/nat/reachability.ts +34 -0
- package/src/nat/secrets/file-store.ts +130 -0
- package/src/nat/secrets/index.ts +82 -0
- package/src/nat/secrets/keytar-store.ts +67 -0
- package/src/nat/types.ts +157 -0
- package/src/orchestrator/host-process-orchestrator.ts +626 -0
- package/src/orchestrator/index.ts +3 -0
- package/src/orchestrator/log-rotator.ts +53 -0
- package/src/orchestrator/pid-liveness.ts +24 -0
- package/src/orchestrator/port-allocator.ts +43 -0
- package/src/orchestrator/state-store.ts +72 -0
- package/src/orchestrator/types.ts +95 -0
- package/src/server/__tests__/bus.test.ts +38 -0
- package/src/server/__tests__/error-handler.test.ts +96 -0
- package/src/server/__tests__/nodes-route.test.ts +179 -0
- package/src/server/__tests__/origin-guard.test.ts +72 -0
- package/src/server/__tests__/publishers.test.ts +216 -0
- package/src/server/__tests__/server.smoke.test.ts +178 -0
- package/src/server/__tests__/settings-route.test.ts +177 -0
- package/src/server/__tests__/sse-route.test.ts +119 -0
- package/src/server/__tests__/status-route.test.ts +113 -0
- package/src/server/error-handler.ts +108 -0
- package/src/server/events/bus.ts +42 -0
- package/src/server/events/sse-route.ts +81 -0
- package/src/server/events/types.ts +22 -0
- package/src/server/index.ts +209 -0
- package/src/server/origin-guard.ts +84 -0
- package/src/server/routes/nat.ts +63 -0
- package/src/server/routes/nodes.ts +147 -0
- package/src/server/routes/settings.ts +115 -0
- package/src/server/routes/status.ts +108 -0
- package/src/server/routes/trust-circle.ts +49 -0
- package/src/server/routes/update.ts +43 -0
- package/src/server/server.ts +122 -0
- package/src/server/settings-store.ts +37 -0
- package/src/server/static.ts +191 -0
- package/src/update/__tests__/apply.test.ts +101 -0
- package/src/update/__tests__/manifest.test.ts +93 -0
- package/src/update/__tests__/store.test.ts +81 -0
- package/src/update/__tests__/update-service.integration.test.ts +221 -0
- package/src/update/__tests__/version.test.ts +31 -0
- package/src/update/apply.ts +148 -0
- package/src/update/index.ts +303 -0
- package/src/update/manifest.ts +172 -0
- package/src/update/release-key.ts +55 -0
- package/src/update/store.ts +101 -0
- package/src/update/types.ts +109 -0
- package/src/update/version.ts +80 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static-asset mount for the SPA bundle.
|
|
3
|
+
*
|
|
4
|
+
* The SPA bundle is produced by `6.5.2-cadre-host-local-ui-spa` into
|
|
5
|
+
* `<package>/dist/ui/`. When that directory exists we serve files from it
|
|
6
|
+
* with an `index.html` SPA fallback. When it's missing (running from source
|
|
7
|
+
* before the SPA ticket lands) we serve a placeholder page that explains
|
|
8
|
+
* how to install/build the SPA.
|
|
9
|
+
*
|
|
10
|
+
* Hand-rolled rather than pulling in `@fastify/static` — the surface area we
|
|
11
|
+
* need is tiny and the dep would only matter under tests that don't exercise
|
|
12
|
+
* static serving anyway.
|
|
13
|
+
*/
|
|
14
|
+
import { readFileSync, statSync, existsSync } from 'node:fs';
|
|
15
|
+
import { dirname, extname, join, normalize, resolve } from 'node:path';
|
|
16
|
+
import { fileURLToPath } from 'node:url';
|
|
17
|
+
import debug from 'debug';
|
|
18
|
+
const log = debug('cadre:host:static');
|
|
19
|
+
const MIME_TYPES = {
|
|
20
|
+
'.html': 'text/html; charset=utf-8',
|
|
21
|
+
'.js': 'application/javascript; charset=utf-8',
|
|
22
|
+
'.mjs': 'application/javascript; charset=utf-8',
|
|
23
|
+
'.css': 'text/css; charset=utf-8',
|
|
24
|
+
'.json': 'application/json; charset=utf-8',
|
|
25
|
+
'.svg': 'image/svg+xml',
|
|
26
|
+
'.png': 'image/png',
|
|
27
|
+
'.jpg': 'image/jpeg',
|
|
28
|
+
'.jpeg': 'image/jpeg',
|
|
29
|
+
'.gif': 'image/gif',
|
|
30
|
+
'.ico': 'image/x-icon',
|
|
31
|
+
'.woff': 'font/woff',
|
|
32
|
+
'.woff2': 'font/woff2',
|
|
33
|
+
'.txt': 'text/plain; charset=utf-8',
|
|
34
|
+
'.map': 'application/json; charset=utf-8',
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Default location of the SPA bundle when `cadre-host` runs from its
|
|
38
|
+
* installed package.
|
|
39
|
+
* - dist/server/static.js → ../ui → packages/cadre-host/dist/ui
|
|
40
|
+
*/
|
|
41
|
+
export function defaultStaticRoot() {
|
|
42
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
43
|
+
return resolve(here, '..', 'ui');
|
|
44
|
+
}
|
|
45
|
+
export function registerStaticMount(app, opts = {}) {
|
|
46
|
+
const rootDir = opts.rootDir ?? defaultStaticRoot();
|
|
47
|
+
// Register *after* all routes so API paths win.
|
|
48
|
+
app.setNotFoundHandler((request, reply) => {
|
|
49
|
+
if (request.method !== 'GET' && request.method !== 'HEAD') {
|
|
50
|
+
return reply.code(404).send({
|
|
51
|
+
ok: false,
|
|
52
|
+
error: { code: 'not_found', message: `No route for ${request.method} ${request.url}` },
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
// Don't try to serve API paths as static.
|
|
56
|
+
if (request.url.startsWith('/api') ||
|
|
57
|
+
request.url.startsWith('/auth') ||
|
|
58
|
+
request.url.startsWith('/nat') ||
|
|
59
|
+
request.url.startsWith('/update')) {
|
|
60
|
+
return reply.code(404).send({
|
|
61
|
+
ok: false,
|
|
62
|
+
error: { code: 'not_found', message: `No route for ${request.method} ${request.url}` },
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return serveStatic(rootDir, request, reply);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function serveStatic(rootDir, request, reply) {
|
|
69
|
+
if (!existsSync(rootDir)) {
|
|
70
|
+
if (request.url === '/' || request.url === '/index.html') {
|
|
71
|
+
return reply.code(200).type('text/html; charset=utf-8').send(placeholderHtml());
|
|
72
|
+
}
|
|
73
|
+
return reply.code(404).send({
|
|
74
|
+
ok: false,
|
|
75
|
+
error: { code: 'not_found', message: 'SPA bundle not installed' },
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
const requested = stripQuery(request.url);
|
|
79
|
+
const target = resolveSafe(rootDir, requested);
|
|
80
|
+
if (!target) {
|
|
81
|
+
return reply.code(404).send({
|
|
82
|
+
ok: false,
|
|
83
|
+
error: { code: 'not_found', message: `No static asset for ${request.url}` },
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
const stat = statSync(target);
|
|
88
|
+
if (stat.isFile())
|
|
89
|
+
return sendFile(reply, target);
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
// fall through to SPA index
|
|
93
|
+
}
|
|
94
|
+
// SPA fallback: serve index.html for any GET that accepts HTML.
|
|
95
|
+
const accept = (request.headers.accept ?? '').toLowerCase();
|
|
96
|
+
if (accept.includes('text/html') || accept === '' || accept === '*/*') {
|
|
97
|
+
const index = join(rootDir, 'index.html');
|
|
98
|
+
if (existsSync(index))
|
|
99
|
+
return sendFile(reply, index);
|
|
100
|
+
}
|
|
101
|
+
return reply.code(404).send({
|
|
102
|
+
ok: false,
|
|
103
|
+
error: { code: 'not_found', message: `No static asset for ${request.url}` },
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function resolveSafe(rootDir, urlPath) {
|
|
107
|
+
const cleaned = decodeSafe(urlPath);
|
|
108
|
+
if (cleaned === null)
|
|
109
|
+
return null;
|
|
110
|
+
const target = normalize(join(rootDir, cleaned === '/' ? '' : cleaned));
|
|
111
|
+
// Disallow path traversal above rootDir.
|
|
112
|
+
if (!target.startsWith(normalize(rootDir)))
|
|
113
|
+
return null;
|
|
114
|
+
return target;
|
|
115
|
+
}
|
|
116
|
+
function decodeSafe(urlPath) {
|
|
117
|
+
try {
|
|
118
|
+
const decoded = decodeURIComponent(urlPath);
|
|
119
|
+
if (decoded.includes('\0'))
|
|
120
|
+
return null;
|
|
121
|
+
return decoded;
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function stripQuery(url) {
|
|
128
|
+
const q = url.indexOf('?');
|
|
129
|
+
return q === -1 ? url : url.slice(0, q);
|
|
130
|
+
}
|
|
131
|
+
function sendFile(reply, path) {
|
|
132
|
+
const buf = readFileSync(path);
|
|
133
|
+
const mime = MIME_TYPES[extname(path).toLowerCase()] ?? 'application/octet-stream';
|
|
134
|
+
return reply.code(200).type(mime).send(buf);
|
|
135
|
+
}
|
|
136
|
+
function placeholderHtml() {
|
|
137
|
+
return `<!doctype html>
|
|
138
|
+
<html lang="en">
|
|
139
|
+
<head>
|
|
140
|
+
<meta charset="utf-8" />
|
|
141
|
+
<title>cadre-host — UI bundle missing</title>
|
|
142
|
+
<style>
|
|
143
|
+
body { font-family: system-ui, -apple-system, sans-serif; max-width: 40rem; margin: 4rem auto; padding: 0 1rem; color: #1a1a1a; }
|
|
144
|
+
h1 { font-weight: 600; }
|
|
145
|
+
code { background: #f4f4f4; padding: 0.125rem 0.375rem; border-radius: 0.25rem; }
|
|
146
|
+
pre { background: #f4f4f4; padding: 0.75rem 1rem; border-radius: 0.5rem; overflow: auto; }
|
|
147
|
+
.endpoint { font-family: ui-monospace, monospace; }
|
|
148
|
+
</style>
|
|
149
|
+
</head>
|
|
150
|
+
<body>
|
|
151
|
+
<h1>cadre-host is running — UI bundle is missing</h1>
|
|
152
|
+
<p>
|
|
153
|
+
The HTTP management API is fully available (see endpoints below), but the
|
|
154
|
+
Svelte SPA that normally renders at this URL hasn't been built into this
|
|
155
|
+
install. This page is most likely shown because the package was started
|
|
156
|
+
from a source checkout without running the UI build step.
|
|
157
|
+
</p>
|
|
158
|
+
<p>To build it:</p>
|
|
159
|
+
<pre>yarn workspace @serfab/cadre-host build</pre>
|
|
160
|
+
<p>or just the UI:</p>
|
|
161
|
+
<pre>yarn workspace @serfab/cadre-host build:ui</pre>
|
|
162
|
+
<p>Then refresh this page.</p>
|
|
163
|
+
|
|
164
|
+
<h2 style="font-size:1.1rem;margin-top:2rem;">Available API endpoints</h2>
|
|
165
|
+
<ul>
|
|
166
|
+
<li><span class="endpoint">GET /api/status</span></li>
|
|
167
|
+
<li><span class="endpoint">GET /api/nodes</span></li>
|
|
168
|
+
<li><span class="endpoint">GET /api/settings</span></li>
|
|
169
|
+
<li><span class="endpoint">GET /api/events</span> (Server-Sent Events)</li>
|
|
170
|
+
<li><span class="endpoint">/auth/*</span>, <span class="endpoint">/nat/*</span>, <span class="endpoint">/update/*</span></li>
|
|
171
|
+
</ul>
|
|
172
|
+
<p>See <a href="https://github.com/gotchoices/sereus/blob/master/docs/cadre-host.md">docs/cadre-host.md</a>.</p>
|
|
173
|
+
</body>
|
|
174
|
+
</html>
|
|
175
|
+
`;
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=static.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static.js","sourceRoot":"","sources":["../../src/server/static.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,GAAG,GAAG,KAAK,CAAC,mBAAmB,CAAC,CAAC;AAEvC,MAAM,UAAU,GAA2B;IACzC,OAAO,EAAE,0BAA0B;IACnC,KAAK,EAAE,uCAAuC;IAC9C,MAAM,EAAE,uCAAuC;IAC/C,MAAM,EAAE,yBAAyB;IACjC,OAAO,EAAE,iCAAiC;IAC1C,MAAM,EAAE,eAAe;IACvB,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,cAAc;IACtB,OAAO,EAAE,WAAW;IACpB,QAAQ,EAAE,YAAY;IACtB,MAAM,EAAE,2BAA2B;IACnC,MAAM,EAAE,iCAAiC;CAC1C,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACrD,OAAO,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACnC,CAAC;AAOD,MAAM,UAAU,mBAAmB,CAAC,GAAoB,EAAE,OAA2B,EAAE;IACrF,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,iBAAiB,EAAE,CAAC;IAEpD,gDAAgD;IAChD,GAAG,CAAC,kBAAkB,CAAC,CAAC,OAAuB,EAAE,KAAmB,EAAE,EAAE;QACtE,IAAI,OAAO,CAAC,MAAM,KAAK,KAAK,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;YAC1D,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBAC1B,EAAE,EAAE,KAAK;gBACT,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,EAAE,EAAE;aACvF,CAAC,CAAC;QACL,CAAC;QACD,0CAA0C;QAC1C,IACE,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC;YAC9B,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC;YAC/B,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC;YAC9B,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,EACjC,CAAC;YACD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBAC1B,EAAE,EAAE,KAAK;gBACT,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,EAAE,EAAE;aACvF,CAAC,CAAC;QACL,CAAC;QACD,OAAO,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,WAAW,CAAC,OAAe,EAAE,OAAuB,EAAE,KAAmB;IAChF,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACzB,IAAI,OAAO,CAAC,GAAG,KAAK,GAAG,IAAI,OAAO,CAAC,GAAG,KAAK,aAAa,EAAE,CAAC;YACzD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;QAClF,CAAC;QACD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YAC1B,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,0BAA0B,EAAE;SAClE,CAAC,CAAC;IACL,CAAC;IAED,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC/C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YAC1B,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,uBAAuB,OAAO,CAAC,GAAG,EAAE,EAAE;SAC5E,CAAC,CAAC;IACL,CAAC;IACD,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC9B,IAAI,IAAI,CAAC,MAAM,EAAE;YAAE,OAAO,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACpD,CAAC;IAAC,MAAM,CAAC;QACP,4BAA4B;IAC9B,CAAC;IACD,gEAAgE;IAChE,MAAM,MAAM,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5D,IAAI,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,MAAM,KAAK,EAAE,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACtE,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QAC1C,IAAI,UAAU,CAAC,KAAK,CAAC;YAAE,OAAO,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;QAC1B,EAAE,EAAE,KAAK;QACT,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,uBAAuB,OAAO,CAAC,GAAG,EAAE,EAAE;KAC5E,CAAC,CAAC;AACL,CAAC;AAED,SAAS,WAAW,CAAC,OAAe,EAAE,OAAe;IACnD,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAClC,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACxE,yCAAyC;IACzC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACxD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,UAAU,CAAC,OAAe;IACjC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAC5C,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QACxC,OAAO,OAAO,CAAC;IACjB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,GAAW;IAC7B,MAAM,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3B,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,QAAQ,CAAC,KAAmB,EAAE,IAAY;IACjD,MAAM,GAAG,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,IAAI,0BAA0B,CAAC;IACnF,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,eAAe;IACtB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCR,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.dot.svelte-1qa2kn2{display:inline-flex;align-items:center;gap:.5rem;font-weight:500}.bulb.svelte-1qa2kn2{display:inline-block;border-radius:999px;flex:0 0 auto;background:var(--color-text-soft);box-shadow:0 0 0 3px #0000000f}.dot-ok.svelte-1qa2kn2 .bulb:where(.svelte-1qa2kn2){background:var(--color-success);box-shadow:0 0 0 3px var(--color-success-bg)}.dot-warn.svelte-1qa2kn2 .bulb:where(.svelte-1qa2kn2){background:var(--color-warn);box-shadow:0 0 0 3px var(--color-warn-bg)}.dot-err.svelte-1qa2kn2 .bulb:where(.svelte-1qa2kn2){background:var(--color-danger);box-shadow:0 0 0 3px var(--color-danger-bg)}.dot-muted.svelte-1qa2kn2 .bulb:where(.svelte-1qa2kn2){background:var(--color-text-soft)}.dot-ok.svelte-1qa2kn2{color:var(--color-success)}.dot-warn.svelte-1qa2kn2{color:var(--color-warn)}.dot-err.svelte-1qa2kn2{color:var(--color-danger)}.row.svelte-lwwmgz{display:inline-flex;gap:.4rem;flex-wrap:wrap}.banner.svelte-15mtls8{display:flex;align-items:center;justify-content:space-between;gap:var(--space-3);padding:var(--space-3) var(--space-4);border-radius:var(--radius);background:var(--color-info-bg);color:var(--color-info);border:1px solid var(--color-info)}.summary.svelte-15mtls8{grid-template-columns:repeat(auto-fit,minmax(15rem,1fr))}.kv.svelte-15mtls8{margin:var(--space-3) 0 0 0;display:grid;grid-template-columns:max-content 1fr;gap:var(--space-1) var(--space-3);font-size:.9rem}.kv.svelte-15mtls8>div:where(.svelte-15mtls8){display:contents}.kv.svelte-15mtls8 dt:where(.svelte-15mtls8){color:var(--color-text-muted)}.kv.svelte-15mtls8 dd:where(.svelte-15mtls8){margin:0}.big.svelte-15mtls8{font-size:1.75rem;font-weight:600;margin:var(--space-2) 0}.big.svelte-15mtls8 .muted:where(.svelte-15mtls8){font-size:.95rem;font-weight:400}.link.svelte-15mtls8{display:inline-block;margin-top:var(--space-2);font-weight:500}.backdrop.svelte-80vbit{position:fixed;inset:0;background:#0f111673;z-index:1000}.dialog.svelte-80vbit{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);background:var(--color-surface);border:1px solid var(--color-border);border-radius:var(--radius-lg);box-shadow:var(--shadow-lg);padding:var(--space-5);min-width:min(24rem,calc(100vw - 2rem));z-index:1010}.actions.svelte-80vbit{display:flex;justify-content:flex-end;gap:.5rem;margin-top:var(--space-4)}.qr.svelte-1uqetyj{background:#fff;border-radius:var(--radius);padding:.5rem;display:inline-block;line-height:0}.qr.svelte-1uqetyj svg{width:100%;height:100%;display:block}.placeholder.svelte-1uqetyj{background:var(--color-surface-alt)}.backdrop.svelte-1d46kin{position:fixed;inset:0;background:#0f111673;z-index:1000}.dialog.svelte-1d46kin{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);background:var(--color-surface);border:1px solid var(--color-border);border-radius:var(--radius-lg);box-shadow:var(--shadow-lg);padding:var(--space-5);width:min(28rem,calc(100vw - 2rem));max-height:calc(100vh - 2rem);overflow:auto;z-index:1010}.actions.svelte-1d46kin{display:flex;justify-content:flex-end;gap:.5rem;margin-top:var(--space-4)}.qr-wrap.svelte-1d46kin{display:flex;justify-content:center;margin:var(--space-3) 0}.token.svelte-1d46kin{display:flex;flex-direction:column;gap:.5rem}.token.svelte-1d46kin textarea:where(.svelte-1d46kin){font-family:var(--font-mono);font-size:.78rem;word-break:break-all;resize:vertical}.token.svelte-1d46kin button:where(.svelte-1d46kin){align-self:flex-end;display:inline-flex;align-items:center;gap:.375rem}.small.svelte-1d46kin{font-size:.85rem}.page-header.svelte-3alf51{display:flex;align-items:flex-end;justify-content:space-between;flex-wrap:wrap;gap:var(--space-3)}.list.svelte-3alf51{list-style:none;padding:0;margin:var(--space-3) 0 0 0;display:flex;flex-direction:column;gap:.5rem}.list.svelte-3alf51 li:where(.svelte-3alf51){display:flex;align-items:center;justify-content:space-between;gap:var(--space-3);padding:var(--space-3);border:1px solid var(--color-border);border-radius:var(--radius);background:var(--color-surface-alt)}.member-main.svelte-3alf51{display:flex;flex-direction:column;gap:.125rem;min-width:0}.member-label.svelte-3alf51{font-weight:500}.small.svelte-3alf51{font-size:.85rem}.grid.two.svelte-hh3bto{grid-template-columns:repeat(auto-fit,minmax(20rem,1fr))}.kv.svelte-hh3bto{margin:var(--space-3) 0;display:grid;grid-template-columns:max-content 1fr;gap:var(--space-1) var(--space-3);font-size:.9rem}.kv.svelte-hh3bto>div:where(.svelte-hh3bto){display:contents}.kv.svelte-hh3bto dt:where(.svelte-hh3bto){color:var(--color-text-muted)}.kv.svelte-hh3bto dd:where(.svelte-hh3bto){margin:0}.row.inline.svelte-hh3bto{gap:.5rem}.row.inline.svelte-hh3bto input[type=checkbox]:where(.svelte-hh3bto){width:auto}.warning.svelte-hh3bto{background:var(--color-warn-bg);border-color:var(--color-warn)}.warning.svelte-hh3bto ul:where(.svelte-hh3bto){margin:0;padding-left:1.25rem}.actions.svelte-hh3bto{display:flex;justify-content:flex-end;gap:.5rem}.small.svelte-hh3bto{font-size:.85rem}table.svelte-7tcksg{width:100%;border-collapse:collapse;font-size:.92rem}th.svelte-7tcksg,td.svelte-7tcksg{padding:.5rem .75rem;text-align:left;border-bottom:1px solid var(--color-border)}th.svelte-7tcksg{font-weight:600;font-size:.78rem;text-transform:uppercase;letter-spacing:.05em;color:var(--color-text-muted);border-bottom-color:var(--color-border-strong)}tr.svelte-7tcksg:last-child td:where(.svelte-7tcksg){border-bottom:none}.log-card.svelte-15ufwrh{display:flex;flex-direction:column;gap:var(--space-3)}.header.svelte-15ufwrh{display:flex;align-items:center;justify-content:space-between;gap:var(--space-3)}.logs.svelte-15ufwrh{max-height:24rem;font-size:.78rem;line-height:1.45;white-space:pre}.small.svelte-15ufwrh{font-size:.85rem}button.svelte-15ufwrh{display:inline-flex;align-items:center;gap:.375rem}.back.svelte-1eq4g96{font-size:.92rem}.page-header.svelte-1eq4g96{display:flex;align-items:flex-start;justify-content:space-between;flex-wrap:wrap;gap:var(--space-3)}.kv.svelte-1eq4g96{margin:var(--space-3) 0;display:grid;grid-template-columns:max-content 1fr;gap:var(--space-1) var(--space-3);font-size:.92rem}.kv.svelte-1eq4g96>div:where(.svelte-1eq4g96){display:contents}.kv.svelte-1eq4g96 dt:where(.svelte-1eq4g96){color:var(--color-text-muted)}.kv.svelte-1eq4g96 dd:where(.svelte-1eq4g96){margin:0}.actions.svelte-1eq4g96{display:flex;gap:.5rem;flex-wrap:wrap}.row.inline.svelte-1cl3wo6{gap:.5rem}.row.inline.svelte-1cl3wo6 input[type=checkbox]:where(.svelte-1cl3wo6){width:auto}.banner.svelte-1cl3wo6{display:flex;align-items:center;justify-content:space-between;gap:var(--space-3);padding:var(--space-3);border-radius:var(--radius);background:var(--color-info-bg);color:var(--color-info);border:1px solid var(--color-info);flex-wrap:wrap}.kv.svelte-1cl3wo6{margin:var(--space-3) 0;display:grid;grid-template-columns:max-content 1fr;gap:var(--space-1) var(--space-3);font-size:.92rem}.kv.svelte-1cl3wo6>div:where(.svelte-1cl3wo6){display:contents}.kv.svelte-1cl3wo6 dt:where(.svelte-1cl3wo6){color:var(--color-text-muted)}.kv.svelte-1cl3wo6 dd:where(.svelte-1cl3wo6){margin:0}.copy-row.svelte-1cl3wo6{display:flex;align-items:center;gap:.375rem}.actions.svelte-1cl3wo6{display:flex;justify-content:flex-end}.small.svelte-1cl3wo6{font-size:.85rem}.error.svelte-1cl3wo6{color:var(--color-danger)}.toast-stack.svelte-g7yjw8{position:fixed;right:1rem;bottom:1rem;display:flex;flex-direction:column;gap:.5rem;max-width:min(30rem,calc(100vw - 2rem));z-index:1100}.toast.svelte-g7yjw8{background:var(--color-surface);color:var(--color-text);border:1px solid var(--color-border-strong);border-radius:var(--radius);padding:.625rem .75rem;display:flex;align-items:center;gap:.5rem;box-shadow:var(--shadow);font-size:.92rem}.toast-error.svelte-g7yjw8{border-color:var(--color-danger);background:var(--color-danger-bg);color:var(--color-danger)}.toast-success.svelte-g7yjw8{border-color:var(--color-success);background:var(--color-success-bg);color:var(--color-success)}.text.svelte-g7yjw8{flex:1 1 auto}button.svelte-g7yjw8{font-size:1.1rem;line-height:1;padding:.125rem .5rem;color:currentColor}.topbar.svelte-1r8vfx3{position:sticky;top:0;z-index:10;display:flex;align-items:center;justify-content:space-between;gap:var(--space-4);padding:var(--space-3) var(--space-5);background:var(--color-surface);border-bottom:1px solid var(--color-border);backdrop-filter:saturate(180%) blur(8px)}.brand.svelte-1r8vfx3{display:flex;align-items:center;gap:.6rem;font-weight:600}.logo.svelte-1r8vfx3{color:var(--color-accent);font-size:1.1rem}nav.svelte-1r8vfx3{display:flex;gap:.125rem}nav.svelte-1r8vfx3 a:where(.svelte-1r8vfx3){font-size:.92rem;color:var(--color-text-muted);padding:.375rem .75rem;border-radius:var(--radius);text-decoration:none}nav.svelte-1r8vfx3 a:where(.svelte-1r8vfx3):hover{background:var(--color-surface-alt);color:var(--color-text)}nav.svelte-1r8vfx3 a.active:where(.svelte-1r8vfx3){color:var(--color-accent-on);background:var(--color-accent)}main.svelte-1r8vfx3{flex:1 1 auto;width:min(64rem,100%);margin:0 auto;padding:var(--space-5)}@media(max-width:640px){.topbar.svelte-1r8vfx3{flex-direction:column;align-items:flex-start;gap:var(--space-2);padding:var(--space-2) var(--space-3)}nav.svelte-1r8vfx3{width:100%;overflow-x:auto}main.svelte-1r8vfx3{padding:var(--space-3)}}:root{color-scheme:light dark;--font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;--font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Menlo, monospace;--radius-sm: .25rem;--radius: .5rem;--radius-lg: .75rem;--space-1: .25rem;--space-2: .5rem;--space-3: .75rem;--space-4: 1rem;--space-5: 1.5rem;--space-6: 2rem;--space-7: 3rem;--color-bg: #f7f8fa;--color-surface: #ffffff;--color-surface-alt: #f0f2f6;--color-border: #d9dde3;--color-border-strong: #b8bec7;--color-text: #1d1f24;--color-text-muted: #5b626d;--color-text-soft: #8a8f99;--color-accent: #1d4ed8;--color-accent-strong: #1e3a8a;--color-accent-on: #ffffff;--color-accent-soft: #e0e7ff;--color-success: #15803d;--color-success-bg: #dcfce7;--color-warn: #b45309;--color-warn-bg: #fef3c7;--color-danger: #b91c1c;--color-danger-bg: #fee2e2;--color-info: #1d4ed8;--color-info-bg: #dbeafe;--shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);--shadow: 0 4px 12px rgba(15, 23, 42, .08);--shadow-lg: 0 12px 32px rgba(15, 23, 42, .16)}@media(prefers-color-scheme:dark){:root{--color-bg: #0f1116;--color-surface: #181b22;--color-surface-alt: #20242d;--color-border: #2c313c;--color-border-strong: #3b424f;--color-text: #e8eaf0;--color-text-muted: #a4abb8;--color-text-soft: #777e8b;--color-accent: #93c5fd;--color-accent-strong: #bfdbfe;--color-accent-on: #0f1116;--color-accent-soft: #1e293b;--color-success: #4ade80;--color-success-bg: #14532d;--color-warn: #fbbf24;--color-warn-bg: #78350f;--color-danger: #f87171;--color-danger-bg: #7f1d1d;--color-info: #93c5fd;--color-info-bg: #1e3a8a;--shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);--shadow: 0 4px 12px rgba(0, 0, 0, .45);--shadow-lg: 0 12px 32px rgba(0, 0, 0, .6)}}*,*:before,*:after{box-sizing:border-box}html,body{margin:0;padding:0;background:var(--color-bg);color:var(--color-text);font-family:var(--font-sans);font-size:15px;line-height:1.5;-webkit-font-smoothing:antialiased;min-height:100vh}#app{min-height:100vh;display:flex;flex-direction:column}h1,h2,h3,h4,h5,h6{margin:0 0 var(--space-2) 0;font-weight:600;line-height:1.25;letter-spacing:-.01em}h1{font-size:1.5rem}h2{font-size:1.25rem}h3{font-size:1.05rem}p{margin:0 0 var(--space-3) 0}a{color:var(--color-accent);text-decoration:none}a:hover{text-decoration:underline}button{font:inherit;cursor:pointer;border:1px solid var(--color-border-strong);background:var(--color-surface);color:var(--color-text);padding:var(--space-2) var(--space-3);border-radius:var(--radius);transition:background-color .12s ease,border-color .12s ease}button:hover:not(:disabled){background:var(--color-surface-alt);border-color:var(--color-text-muted)}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:2px solid var(--color-accent);outline-offset:2px}button:disabled{opacity:.55;cursor:not-allowed}button.primary{background:var(--color-accent);border-color:var(--color-accent);color:var(--color-accent-on)}button.primary:hover:not(:disabled){background:var(--color-accent-strong);border-color:var(--color-accent-strong)}button.danger{background:var(--color-danger);border-color:var(--color-danger);color:#fff}button.ghost{background:transparent;border-color:transparent;color:var(--color-text-muted);padding:var(--space-1) var(--space-2)}button.ghost:hover:not(:disabled){color:var(--color-text);background:var(--color-surface-alt)}input[type=text],input[type=url],input[type=number],input[type=password],select,textarea{font:inherit;color:var(--color-text);background:var(--color-surface);border:1px solid var(--color-border-strong);border-radius:var(--radius);padding:var(--space-2) var(--space-3);width:100%}label{display:block;font-size:.85rem;color:var(--color-text-muted);font-weight:500;margin-bottom:var(--space-1)}code,pre{font-family:var(--font-mono);font-size:.85rem}pre{background:var(--color-surface-alt);padding:var(--space-3);border-radius:var(--radius);overflow:auto;margin:0}hr{border:none;border-top:1px solid var(--color-border);margin:var(--space-5) 0}.card{background:var(--color-surface);border:1px solid var(--color-border);border-radius:var(--radius-lg);padding:var(--space-5);box-shadow:var(--shadow-sm)}.muted{color:var(--color-text-muted)}.row{display:flex;gap:var(--space-3);align-items:center;flex-wrap:wrap}.stack{display:flex;flex-direction:column;gap:var(--space-3)}.grid{display:grid;gap:var(--space-4)}.badge{display:inline-flex;align-items:center;gap:var(--space-1);font-size:.78rem;font-weight:600;letter-spacing:.02em;text-transform:uppercase;padding:.125rem .5rem;border-radius:999px;background:var(--color-surface-alt);color:var(--color-text-muted)}.badge.ok{background:var(--color-success-bg);color:var(--color-success)}.badge.warn{background:var(--color-warn-bg);color:var(--color-warn)}.badge.err{background:var(--color-danger-bg);color:var(--color-danger)}.badge.info{background:var(--color-info-bg);color:var(--color-info)}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();const Xs=!1;var Tn=Array.isArray,Zs=Array.prototype.indexOf,zt=Array.prototype.includes,Ar=Array.from,ea=Object.defineProperty,nr=Object.getOwnPropertyDescriptor,Li=Object.getOwnPropertyDescriptors,ta=Object.prototype,ra=Array.prototype,An=Object.getPrototypeOf,Vn=Object.isExtensible;const na=()=>{};function ia(e){return e()}function on(e){for(var t=0;t<e.length;t++)e[t]()}function Di(){var e,t,r=new Promise((n,i)=>{e=n,t=i});return{promise:r,resolve:e,reject:t}}const Ee=2,jt=4,ur=8,Ui=1<<24,Ge=16,Ve=32,vt=64,ln=128,Be=512,ge=1024,ye=2048,Qe=4096,Ce=8192,Le=16384,xt=32768,Hn=1<<25,Vt=65536,un=1<<17,sa=1<<18,Gt=1<<19,qi=1<<20,Ke=1<<25,Rt=65536,yr=1<<21,or=1<<22,ct=1<<23,St=Symbol("$state"),aa=Symbol(""),it=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},oa=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml");function Fi(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function la(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function ua(e,t,r){throw new Error("https://svelte.dev/e/each_key_duplicate")}function ca(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function fa(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function da(e){throw new Error("https://svelte.dev/e/effect_orphan")}function va(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function ha(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function pa(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function ga(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function _a(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const ma=1,ya=2,Oi=4,ba=8,wa=16,Ea=1,Ca=2,me=Symbol(),$i="http://www.w3.org/1999/xhtml",ka="http://www.w3.org/2000/svg",Sa="http://www.w3.org/1998/Math/MathML";function Ta(){console.warn("https://svelte.dev/e/derived_inert")}function Aa(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function Ia(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function zi(e){return e===this.v}function Ra(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function ji(e){return!Ra(e,this.v)}let cr=!1,Ma=!1;function Na(){cr=!0}let ue=null;function Ht(e){ue=e}function Ie(e,t=!1,r){ue={p:ue,i:!1,c:null,e:null,s:e,x:null,r:V,l:cr&&!t?{s:null,u:null,$:[]}:null}}function Re(e){var t=ue,r=t.e;if(r!==null){t.e=null;for(var n of r)ls(n)}return t.i=!0,ue=t.p,{}}function fr(){return!cr||ue!==null&&ue.l===null}let Et=[];function Vi(){var e=Et;Et=[],on(e)}function ft(e){if(Et.length===0&&!ir){var t=Et;queueMicrotask(()=>{t===Et&&Vi()})}Et.push(e)}function Pa(){for(;Et.length>0;)Vi()}function Hi(e){var t=V;if(t===null)return H.f|=ct,e;if((t.f&xt)===0&&(t.f&jt)===0)throw e;ut(e,t)}function ut(e,t){for(;t!==null;){if((t.f&ln)!==0){if((t.f&xt)===0)throw e;try{t.b.error(e);return}catch(r){e=r}}t=t.parent}throw e}const xa=-7169;function de(e,t){e.f=e.f&xa|t}function In(e){(e.f&Be)!==0||e.deps===null?de(e,ge):de(e,Qe)}function Ki(e){if(e!==null)for(const t of e)(t.f&Ee)===0||(t.f&Rt)===0||(t.f^=Rt,Ki(t.deps))}function Yi(e,t,r){(e.f&ye)!==0?t.add(e):(e.f&Qe)!==0&&r.add(e),Ki(e.deps),de(e,ge)}const wt=new Set;let O=null,$e=null,cn=null,ir=!1,xr=!1,Ft=null,_r=null;var Kn=0;let Ba=1;class ht{id=Ba++;current=new Map;previous=new Map;#r=new Set;#l=new Set;#e=new Set;#i=new Map;#n=new Map;#s=null;#t=[];#a=[];#u=new Set;#c=new Set;#o=new Map;#d=new Set;is_fork=!1;#h=!1;#v=new Set;#f(){return this.is_fork||this.#n.size>0}#_(){for(const n of this.#v)for(const i of n.#n.keys()){for(var t=!1,r=i;r.parent!==null;){if(this.#o.has(r)){t=!0;break}r=r.parent}if(!t)return!0}return!1}skip_effect(t){this.#o.has(t)||this.#o.set(t,{d:[],m:[]}),this.#d.delete(t)}unskip_effect(t,r=n=>this.schedule(n)){var n=this.#o.get(t);if(n){this.#o.delete(t);for(var i of n.d)de(i,ye),r(i);for(i of n.m)de(i,Qe),r(i)}this.#d.add(t)}#p(){if(Kn++>1e3&&(wt.delete(this),Da()),!this.#f()){for(const l of this.#u)this.#c.delete(l),de(l,ye),this.schedule(l);for(const l of this.#c)de(l,Qe),this.schedule(l)}const t=this.#t;this.#t=[],this.apply();var r=Ft=[],n=[],i=_r=[];for(const l of t)try{this.#m(l,r,n)}catch(o){throw Qi(l),o}if(O=null,i.length>0){var s=ht.ensure();for(const l of i)s.schedule(l)}if(Ft=null,_r=null,this.#f()||this.#_()){this.#g(n),this.#g(r);for(const[l,o]of this.#o)Gi(l,o)}else{this.#i.size===0&&wt.delete(this),this.#u.clear(),this.#c.clear();for(const l of this.#r)l(this);this.#r.clear(),Yn(n),Yn(r),this.#s?.resolve()}var a=O;if(this.#t.length>0){const l=a??=this;l.#t.push(...this.#t.filter(o=>!l.#t.includes(o)))}a!==null&&(wt.add(a),a.#p())}#m(t,r,n){t.f^=ge;for(var i=t.first;i!==null;){var s=i.f,a=(s&(Ve|vt))!==0,l=a&&(s&ge)!==0,o=l||(s&Ce)!==0||this.#o.has(i);if(!o&&i.fn!==null){a?i.f^=ge:(s&jt)!==0?r.push(i):vr(i)&&((s&Ge)!==0&&this.#c.add(i),Yt(i));var u=i.first;if(u!==null){i=u;continue}}for(;i!==null;){var c=i.next;if(c!==null){i=c;break}i=i.parent}}}#g(t){for(var r=0;r<t.length;r+=1)Yi(t[r],this.#u,this.#c)}capture(t,r,n=!1){t.v!==me&&!this.previous.has(t)&&this.previous.set(t,t.v),(t.f&ct)===0&&(this.current.set(t,[r,n]),$e?.set(t,r)),this.is_fork||(t.v=r)}activate(){O=this}deactivate(){O=null,$e=null}flush(){try{xr=!0,O=this,this.#p()}finally{Kn=0,cn=null,Ft=null,_r=null,xr=!1,O=null,$e=null,Tt.clear()}}discard(){for(const t of this.#l)t(this);this.#l.clear(),this.#e.clear(),wt.delete(this)}register_created_effect(t){this.#a.push(t)}#y(){for(const c of wt){var t=c.id<this.id,r=[];for(const[v,[d,_]]of this.current){if(c.current.has(v)){var n=c.current.get(v)[0];if(t&&d!==n)c.current.set(v,[d,_]);else continue}r.push(v)}var i=[...c.current.keys()].filter(v=>!this.current.has(v));if(i.length===0)t&&c.discard();else if(r.length>0){if(t)for(const v of this.#d)c.unskip_effect(v,d=>{(d.f&(Ge|or))!==0?c.schedule(d):c.#g([d])});c.activate();var s=new Set,a=new Map;for(var l of r)Ji(l,i,s,a);a=new Map;var o=[...c.current.keys()].filter(v=>this.current.has(v)?this.current.get(v)[0]!==v:!0);for(const v of this.#a)(v.f&(Le|Ce|un))===0&&Rn(v,o,a)&&((v.f&(or|Ge))!==0?(de(v,ye),c.schedule(v)):c.#u.add(v));if(c.#t.length>0){c.apply();for(var u of c.#t)c.#m(u,[],[]);c.#t=[]}c.deactivate()}}for(const c of wt)c.#v.has(this)&&(c.#v.delete(this),c.#v.size===0&&!c.#f()&&(c.activate(),c.#p()))}increment(t,r){let n=this.#i.get(r)??0;if(this.#i.set(r,n+1),t){let i=this.#n.get(r)??0;this.#n.set(r,i+1)}}decrement(t,r,n){let i=this.#i.get(r)??0;if(i===1?this.#i.delete(r):this.#i.set(r,i-1),t){let s=this.#n.get(r)??0;s===1?this.#n.delete(r):this.#n.set(r,s-1)}this.#h||n||(this.#h=!0,ft(()=>{this.#h=!1,this.flush()}))}transfer_effects(t,r){for(const n of t)this.#u.add(n);for(const n of r)this.#c.add(n);t.clear(),r.clear()}oncommit(t){this.#r.add(t)}ondiscard(t){this.#l.add(t)}on_fork_commit(t){this.#e.add(t)}run_fork_commit_callbacks(){for(const t of this.#e)t(this);this.#e.clear()}settled(){return(this.#s??=Di()).promise}static ensure(){if(O===null){const t=O=new ht;xr||(wt.add(O),ir||ft(()=>{O===t&&t.flush()}))}return O}apply(){{$e=null;return}}schedule(t){if(cn=t,t.b?.is_pending&&(t.f&(jt|ur|Ui))!==0&&(t.f&xt)===0){t.b.defer_effect(t);return}for(var r=t;r.parent!==null;){r=r.parent;var n=r.f;if(Ft!==null&&r===V&&(H===null||(H.f&Ee)===0))return;if((n&(vt|Ve))!==0){if((n&ge)===0)return;r.f^=ge}}this.#t.push(r)}}function La(e){var t=ir;ir=!0;try{for(var r;;){if(Pa(),O===null)return r;O.flush()}}finally{ir=t}}function Da(){try{va()}catch(e){ut(e,cn)}}let nt=null;function Yn(e){var t=e.length;if(t!==0){for(var r=0;r<t;){var n=e[r++];if((n.f&(Le|Ce))===0&&vr(n)&&(nt=new Set,Yt(n),n.deps===null&&n.first===null&&n.nodes===null&&n.teardown===null&&n.ac===null&&fs(n),nt?.size>0)){Tt.clear();for(const i of nt){if((i.f&(Le|Ce))!==0)continue;const s=[i];let a=i.parent;for(;a!==null;)nt.has(a)&&(nt.delete(a),s.push(a)),a=a.parent;for(let l=s.length-1;l>=0;l--){const o=s[l];(o.f&(Le|Ce))===0&&Yt(o)}}nt.clear()}}nt=null}}function Ji(e,t,r,n){if(!r.has(e)&&(r.add(e),e.reactions!==null))for(const i of e.reactions){const s=i.f;(s&Ee)!==0?Ji(i,t,r,n):(s&(or|Ge))!==0&&(s&ye)===0&&Rn(i,t,n)&&(de(i,ye),Mn(i))}}function Rn(e,t,r){const n=r.get(e);if(n!==void 0)return n;if(e.deps!==null)for(const i of e.deps){if(zt.call(t,i))return!0;if((i.f&Ee)!==0&&Rn(i,t,r))return r.set(i,!0),!0}return r.set(e,!1),!1}function Mn(e){O.schedule(e)}function Gi(e,t){if(!((e.f&Ve)!==0&&(e.f&ge)!==0)){(e.f&ye)!==0?t.d.push(e):(e.f&Qe)!==0&&t.m.push(e),de(e,ge);for(var r=e.first;r!==null;)Gi(r,t),r=r.next}}function Qi(e){de(e,ge);for(var t=e.first;t!==null;)Qi(t),t=t.next}function Ua(e){let t=0,r=Mt(0),n;return()=>{xn()&&(h(r),Ln(()=>(t===0&&(n=Qt(()=>e(()=>sr(r)))),t+=1,()=>{ft(()=>{t-=1,t===0&&(n?.(),n=void 0,sr(r))})})))}}var qa=Vt|Gt;function Fa(e,t,r,n){new Oa(e,t,r,n)}class Oa{parent;is_pending=!1;transform_error;#r;#l=null;#e;#i;#n;#s=null;#t=null;#a=null;#u=null;#c=0;#o=0;#d=!1;#h=new Set;#v=new Set;#f=null;#_=Ua(()=>(this.#f=Mt(this.#c),()=>{this.#f=null}));constructor(t,r,n,i){this.#r=t,this.#e=r,this.#i=s=>{var a=V;a.b=this,a.f|=ln,n(s)},this.parent=V.b,this.transform_error=i??this.parent?.transform_error??(s=>s),this.#n=Dn(()=>{this.#y()},qa)}#p(){try{this.#s=Pe(()=>this.#i(this.#r))}catch(t){this.error(t)}}#m(t){const r=this.#e.failed;r&&(this.#a=Pe(()=>{r(this.#r,()=>t,()=>()=>{})}))}#g(){const t=this.#e.pending;t&&(this.is_pending=!0,this.#t=Pe(()=>t(this.#r)),ft(()=>{var r=this.#u=document.createDocumentFragment(),n=st();r.append(n),this.#s=this.#w(()=>Pe(()=>this.#i(n))),this.#o===0&&(this.#r.before(r),this.#u=null,At(this.#t,()=>{this.#t=null}),this.#b(O))}))}#y(){try{if(this.is_pending=this.has_pending_snippet(),this.#o=0,this.#c=0,this.#s=Pe(()=>{this.#i(this.#r)}),this.#o>0){var t=this.#u=document.createDocumentFragment();Fn(this.#s,t);const r=this.#e.pending;this.#t=Pe(()=>r(this.#r))}else this.#b(O)}catch(r){this.error(r)}}#b(t){this.is_pending=!1,t.transfer_effects(this.#h,this.#v)}defer_effect(t){Yi(t,this.#h,this.#v)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#e.pending}#w(t){var r=V,n=H,i=ue;We(this.#n),Ue(this.#n),Ht(this.#n.ctx);try{return ht.ensure(),t()}catch(s){return Hi(s),null}finally{We(r),Ue(n),Ht(i)}}#E(t,r){if(!this.has_pending_snippet()){this.parent&&this.parent.#E(t,r);return}this.#o+=t,this.#o===0&&(this.#b(r),this.#t&&At(this.#t,()=>{this.#t=null}),this.#u&&(this.#r.before(this.#u),this.#u=null))}update_pending_count(t,r){this.#E(t,r),this.#c+=t,!(!this.#f||this.#d)&&(this.#d=!0,ft(()=>{this.#d=!1,this.#f&&Kt(this.#f,this.#c)}))}get_effect_pending(){return this.#_(),h(this.#f)}error(t){if(!this.#e.onerror&&!this.#e.failed)throw t;O?.is_fork?(this.#s&&O.skip_effect(this.#s),this.#t&&O.skip_effect(this.#t),this.#a&&O.skip_effect(this.#a),O.on_fork_commit(()=>{this.#C(t)})):this.#C(t)}#C(t){this.#s&&(Te(this.#s),this.#s=null),this.#t&&(Te(this.#t),this.#t=null),this.#a&&(Te(this.#a),this.#a=null);var r=this.#e.onerror;let n=this.#e.failed;var i=!1,s=!1;const a=()=>{if(i){Ia();return}i=!0,s&&_a(),this.#a!==null&&At(this.#a,()=>{this.#a=null}),this.#w(()=>{this.#y()})},l=o=>{try{s=!0,r?.(o,a),s=!1}catch(u){ut(u,this.#n&&this.#n.parent)}n&&(this.#a=this.#w(()=>{try{return Pe(()=>{var u=V;u.b=this,u.f|=ln,n(this.#r,()=>o,()=>a)})}catch(u){return ut(u,this.#n.parent),null}}))};ft(()=>{var o;try{o=this.transform_error(t)}catch(u){ut(u,this.#n&&this.#n.parent);return}o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(l,u=>ut(u,this.#n&&this.#n.parent)):l(o)})}}function $a(e,t,r,n){const i=fr()?Ir:wr;var s=e.filter(d=>!d.settled);if(r.length===0&&s.length===0){n(t.map(i));return}var a=V,l=za(),o=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(d=>d.promise)):null;function u(d){l();try{n(d)}catch(_){(a.f&Le)===0&&ut(_,a)}br()}if(r.length===0){o.then(()=>u(t.map(i)));return}var c=Wi();function v(){Promise.all(r.map(d=>ja(d))).then(d=>u([...t.map(i),...d])).catch(d=>ut(d,a)).finally(()=>c())}o?o.then(()=>{l(),v(),br()}):v()}function za(){var e=V,t=H,r=ue,n=O;return function(s=!0){We(e),Ue(t),Ht(r),s&&(e.f&Le)===0&&(n?.activate(),n?.apply())}}function br(e=!0){We(null),Ue(null),Ht(null),e&&O?.deactivate()}function Wi(){var e=V,t=e.b,r=O,n=t.is_rendered();return t.update_pending_count(1,r),r.increment(n,e),(i=!1)=>{t.update_pending_count(-1,r),r.decrement(n,e,i)}}function Ir(e){var t=Ee|ye;return V!==null&&(V.f|=Gt),{ctx:ue,deps:null,effects:null,equals:zi,f:t,fn:e,reactions:null,rv:0,v:me,wv:0,parent:V,ac:null}}function ja(e,t,r){let n=V;n===null&&la();var i=void 0,s=Mt(me),a=!H,l=new Map;return ro(()=>{var o=V,u=Di();i=u.promise;try{Promise.resolve(e()).then(u.resolve,u.reject).finally(br)}catch(_){u.reject(_),br()}var c=O;if(a){if((o.f&xt)!==0)var v=Wi();if(n.b.is_rendered())l.get(c)?.reject(it),l.delete(c);else{for(const _ of l.values())_.reject(it);l.clear()}l.set(c,u)}const d=(_,y=void 0)=>{if(v){var E=y===it;v(E)}if(!(y===it||(o.f&Le)!==0)){if(c.activate(),y)s.f|=ct,Kt(s,y);else{(s.f&ct)!==0&&(s.f^=ct),Kt(s,_);for(const[b,g]of l){if(l.delete(b),b===c)break;g.reject(it)}}c.deactivate()}};u.promise.then(d,_=>d(null,_||"unknown"))}),Bn(()=>{for(const o of l.values())o.reject(it)}),new Promise(o=>{function u(c){function v(){c===i?o(s):u(i)}c.then(v,v)}u(i)})}function _e(e){const t=Ir(e);return hs(t),t}function wr(e){const t=Ir(e);return t.equals=ji,t}function Va(e){var t=e.effects;if(t!==null){e.effects=null;for(var r=0;r<t.length;r+=1)Te(t[r])}}function Nn(e){var t,r=V,n=e.parent;if(!pt&&n!==null&&(n.f&(Le|Ce))!==0)return Ta(),e.v;We(n);try{e.f&=~Rt,Va(e),t=ms(e)}finally{We(r)}return t}function Xi(e){var t=Nn(e);if(!e.equals(t)&&(e.wv=gs(),(!O?.is_fork||e.deps===null)&&(O!==null?O.capture(e,t,!0):e.v=t,e.deps===null))){de(e,ge);return}pt||($e!==null?(xn()||O?.is_fork)&&$e.set(e,t):In(e))}function Ha(e){if(e.effects!==null)for(const t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac?.abort(it),t.teardown=na,t.ac=null,lr(t,0),Un(t))}function Zi(e){if(e.effects!==null)for(const t of e.effects)t.teardown&&Yt(t)}let fn=new Set;const Tt=new Map;let es=!1;function Mt(e,t){var r={f:0,v:e,reactions:null,equals:zi,rv:0,wv:0};return r}function z(e,t){const r=Mt(e);return hs(r),r}function Ka(e,t=!1,r=!0){const n=Mt(e);return t||(n.equals=ji),cr&&r&&ue!==null&&ue.l!==null&&(ue.l.s??=[]).push(n),n}function L(e,t,r=!1){H!==null&&(!ze||(H.f&un)!==0)&&fr()&&(H.f&(Ee|Ge|or|un))!==0&&(De===null||!zt.call(De,e))&&ga();let n=r?Ye(t):t;return Kt(e,n,_r)}function Kt(e,t,r=null){if(!e.equals(t)){Tt.set(e,pt?t:e.v);var n=ht.ensure();if(n.capture(e,t),(e.f&Ee)!==0){const i=e;(e.f&ye)!==0&&Nn(i),$e===null&&In(i)}e.wv=gs(),ts(e,ye,r),fr()&&V!==null&&(V.f&ge)!==0&&(V.f&(Ve|vt))===0&&(Ne===null?io([e]):Ne.push(e)),!n.is_fork&&fn.size>0&&!es&&Ya()}return t}function Ya(){es=!1;for(const e of fn)(e.f&ge)!==0&&de(e,Qe),vr(e)&&Yt(e);fn.clear()}function sr(e){L(e,e.v+1)}function ts(e,t,r){var n=e.reactions;if(n!==null)for(var i=fr(),s=n.length,a=0;a<s;a++){var l=n[a],o=l.f;if(!(!i&&l===V)){var u=(o&ye)===0;if(u&&de(l,t),(o&Ee)!==0){var c=l;$e?.delete(c),(o&Rt)===0&&(o&Be&&(V===null||(V.f&yr)===0)&&(l.f|=Rt),ts(c,Qe,r))}else if(u){var v=l;(o&Ge)!==0&&nt!==null&&nt.add(v),r!==null?r.push(v):Mn(v)}}}}function Ye(e){if(typeof e!="object"||e===null||St in e)return e;const t=An(e);if(t!==ta&&t!==ra)return e;var r=new Map,n=Tn(e),i=z(0),s=It,a=l=>{if(It===s)return l();var o=H,u=It;Ue(null),Xn(s);var c=l();return Ue(o),Xn(u),c};return n&&r.set("length",z(e.length)),new Proxy(e,{defineProperty(l,o,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&ha();var c=r.get(o);return c===void 0?a(()=>{var v=z(u.value);return r.set(o,v),v}):L(c,u.value,!0),!0},deleteProperty(l,o){var u=r.get(o);if(u===void 0){if(o in l){const c=a(()=>z(me));r.set(o,c),sr(i)}}else L(u,me),sr(i);return!0},get(l,o,u){if(o===St)return e;var c=r.get(o),v=o in l;if(c===void 0&&(!v||nr(l,o)?.writable)&&(c=a(()=>{var _=Ye(v?l[o]:me),y=z(_);return y}),r.set(o,c)),c!==void 0){var d=h(c);return d===me?void 0:d}return Reflect.get(l,o,u)},getOwnPropertyDescriptor(l,o){var u=Reflect.getOwnPropertyDescriptor(l,o);if(u&&"value"in u){var c=r.get(o);c&&(u.value=h(c))}else if(u===void 0){var v=r.get(o),d=v?.v;if(v!==void 0&&d!==me)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return u},has(l,o){if(o===St)return!0;var u=r.get(o),c=u!==void 0&&u.v!==me||Reflect.has(l,o);if(u!==void 0||V!==null&&(!c||nr(l,o)?.writable)){u===void 0&&(u=a(()=>{var d=c?Ye(l[o]):me,_=z(d);return _}),r.set(o,u));var v=h(u);if(v===me)return!1}return c},set(l,o,u,c){var v=r.get(o),d=o in l;if(n&&o==="length")for(var _=u;_<v.v;_+=1){var y=r.get(_+"");y!==void 0?L(y,me):_ in l&&(y=a(()=>z(me)),r.set(_+"",y))}if(v===void 0)(!d||nr(l,o)?.writable)&&(v=a(()=>z(void 0)),L(v,Ye(u)),r.set(o,v));else{d=v.v!==me;var E=a(()=>Ye(u));L(v,E)}var b=Reflect.getOwnPropertyDescriptor(l,o);if(b?.set&&b.set.call(c,u),!d){if(n&&typeof o=="string"){var g=r.get("length"),T=Number(o);Number.isInteger(T)&&T>=g.v&&L(g,T+1)}sr(i)}return!0},ownKeys(l){h(i);var o=Reflect.ownKeys(l).filter(v=>{var d=r.get(v);return d===void 0||d.v!==me});for(var[u,c]of r)c.v!==me&&!(u in l)&&o.push(u);return o},setPrototypeOf(){pa()}})}function Jn(e){try{if(e!==null&&typeof e=="object"&&St in e)return e[St]}catch{}return e}function Ja(e,t){return Object.is(Jn(e),Jn(t))}var Gn,rs,ns,is;function Ga(){if(Gn===void 0){Gn=window,rs=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,r=Text.prototype;ns=nr(t,"firstChild").get,is=nr(t,"nextSibling").get,Vn(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Vn(r)&&(r.__t=void 0)}}function st(e=""){return document.createTextNode(e)}function Je(e){return ns.call(e)}function dr(e){return is.call(e)}function f(e,t){return Je(e)}function we(e,t=!1){{var r=Je(e);return r instanceof Comment&&r.data===""?dr(r):r}}function p(e,t=1,r=!1){let n=e;for(;t--;)n=dr(n);return n}function Qa(e){e.textContent=""}function ss(){return!1}function as(e,t,r){return document.createElementNS(t??$i,e,void 0)}let Qn=!1;function Wa(){Qn||(Qn=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(const t of e.target.elements)t.__on_r?.()})},{capture:!0}))}function Rr(e){var t=H,r=V;Ue(null),We(null);try{return e()}finally{Ue(t),We(r)}}function Pn(e,t,r,n=r){e.addEventListener(t,()=>Rr(r));const i=e.__on_r;i?e.__on_r=()=>{i(),n(!0)}:e.__on_r=()=>n(!0),Wa()}function os(e){V===null&&(H===null&&da(),fa()),pt&&ca()}function Xa(e,t){var r=t.last;r===null?t.last=t.first=e:(r.next=e,e.prev=r,t.last=e)}function Xe(e,t){var r=V;r!==null&&(r.f&Ce)!==0&&(e|=Ce);var n={ctx:ue,deps:null,nodes:null,f:e|ye|Be,first:null,fn:t,last:null,next:null,parent:r,b:r&&r.b,prev:null,teardown:null,wv:0,ac:null};O?.register_created_effect(n);var i=n;if((e&jt)!==0)Ft!==null?Ft.push(n):ht.ensure().schedule(n);else if(t!==null){try{Yt(n)}catch(a){throw Te(n),a}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&(i.f&Gt)===0&&(i=i.first,(e&Ge)!==0&&(e&Vt)!==0&&i!==null&&(i.f|=Vt))}if(i!==null&&(i.parent=r,r!==null&&Xa(i,r),H!==null&&(H.f&Ee)!==0&&(e&vt)===0)){var s=H;(s.effects??=[]).push(i)}return n}function xn(){return H!==null&&!ze}function Bn(e){const t=Xe(ur,null);return de(t,ge),t.teardown=e,t}function Nt(e){os();var t=V.f,r=!H&&(t&Ve)!==0&&(t&xt)===0;if(r){var n=ue;(n.e??=[]).push(e)}else return ls(e)}function ls(e){return Xe(jt|qi,e)}function Za(e){return os(),Xe(ur|qi,e)}function eo(e){ht.ensure();const t=Xe(vt|Gt,e);return(r={})=>new Promise(n=>{r.outro?At(t,()=>{Te(t),n(void 0)}):(Te(t),n(void 0))})}function to(e){return Xe(jt,e)}function ro(e){return Xe(or|Gt,e)}function Ln(e,t=0){return Xe(ur|t,e)}function F(e,t=[],r=[],n=[]){$a(n,t,r,i=>{Xe(ur,()=>e(...i.map(h)))})}function Dn(e,t=0){var r=Xe(Ge|t,e);return r}function Pe(e){return Xe(Ve|Gt,e)}function us(e){var t=e.teardown;if(t!==null){const r=pt,n=H;Wn(!0),Ue(null);try{t.call(null)}finally{Wn(r),Ue(n)}}}function Un(e,t=!1){var r=e.first;for(e.first=e.last=null;r!==null;){const i=r.ac;i!==null&&Rr(()=>{i.abort(it)});var n=r.next;(r.f&vt)!==0?r.parent=null:Te(r,t),r=n}}function no(e){for(var t=e.first;t!==null;){var r=t.next;(t.f&Ve)===0&&Te(t),t=r}}function Te(e,t=!0){var r=!1;(t||(e.f&sa)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(cs(e.nodes.start,e.nodes.end),r=!0),de(e,Hn),Un(e,t&&!r),lr(e,0);var n=e.nodes&&e.nodes.t;if(n!==null)for(const s of n)s.stop();us(e),e.f^=Hn,e.f|=Le;var i=e.parent;i!==null&&i.first!==null&&fs(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function cs(e,t){for(;e!==null;){var r=e===t?null:dr(e);e.remove(),e=r}}function fs(e){var t=e.parent,r=e.prev,n=e.next;r!==null&&(r.next=n),n!==null&&(n.prev=r),t!==null&&(t.first===e&&(t.first=n),t.last===e&&(t.last=r))}function At(e,t,r=!0){var n=[];ds(e,n,!0);var i=()=>{r&&Te(e),t&&t()},s=n.length;if(s>0){var a=()=>--s||i();for(var l of n)l.out(a)}else i()}function ds(e,t,r){if((e.f&Ce)===0){e.f^=Ce;var n=e.nodes&&e.nodes.t;if(n!==null)for(const l of n)(l.is_global||r)&&t.push(l);for(var i=e.first;i!==null;){var s=i.next;if((i.f&vt)===0){var a=(i.f&Vt)!==0||(i.f&Ve)!==0&&(e.f&Ge)!==0;ds(i,t,a?r:!1)}i=s}}}function qn(e){vs(e,!0)}function vs(e,t){if((e.f&Ce)!==0){e.f^=Ce,(e.f&ge)===0&&(de(e,ye),ht.ensure().schedule(e));for(var r=e.first;r!==null;){var n=r.next,i=(r.f&Vt)!==0||(r.f&Ve)!==0;vs(r,i?t:!1),r=n}var s=e.nodes&&e.nodes.t;if(s!==null)for(const a of s)(a.is_global||t)&&a.in()}}function Fn(e,t){if(e.nodes)for(var r=e.nodes.start,n=e.nodes.end;r!==null;){var i=r===n?null:dr(r);t.append(r),r=i}}let mr=!1,pt=!1;function Wn(e){pt=e}let H=null,ze=!1;function Ue(e){H=e}let V=null;function We(e){V=e}let De=null;function hs(e){H!==null&&(De===null?De=[e]:De.push(e))}let Se=null,Ae=0,Ne=null;function io(e){Ne=e}let ps=1,Ct=0,It=Ct;function Xn(e){It=e}function gs(){return++ps}function vr(e){var t=e.f;if((t&ye)!==0)return!0;if(t&Ee&&(e.f&=~Rt),(t&Qe)!==0){for(var r=e.deps,n=r.length,i=0;i<n;i++){var s=r[i];if(vr(s)&&Xi(s),s.wv>e.wv)return!0}(t&Be)!==0&&$e===null&&de(e,ge)}return!1}function _s(e,t,r=!0){var n=e.reactions;if(n!==null&&!(De!==null&&zt.call(De,e)))for(var i=0;i<n.length;i++){var s=n[i];(s.f&Ee)!==0?_s(s,t,!1):t===s&&(r?de(s,ye):(s.f&ge)!==0&&de(s,Qe),Mn(s))}}function ms(e){var t=Se,r=Ae,n=Ne,i=H,s=De,a=ue,l=ze,o=It,u=e.f;Se=null,Ae=0,Ne=null,H=(u&(Ve|vt))===0?e:null,De=null,Ht(e.ctx),ze=!1,It=++Ct,e.ac!==null&&(Rr(()=>{e.ac.abort(it)}),e.ac=null);try{e.f|=yr;var c=e.fn,v=c();e.f|=xt;var d=e.deps,_=O?.is_fork;if(Se!==null){var y;if(_||lr(e,Ae),d!==null&&Ae>0)for(d.length=Ae+Se.length,y=0;y<Se.length;y++)d[Ae+y]=Se[y];else e.deps=d=Se;if(xn()&&(e.f&Be)!==0)for(y=Ae;y<d.length;y++)(d[y].reactions??=[]).push(e)}else!_&&d!==null&&Ae<d.length&&(lr(e,Ae),d.length=Ae);if(fr()&&Ne!==null&&!ze&&d!==null&&(e.f&(Ee|Qe|ye))===0)for(y=0;y<Ne.length;y++)_s(Ne[y],e);if(i!==null&&i!==e){if(Ct++,i.deps!==null)for(let E=0;E<r;E+=1)i.deps[E].rv=Ct;if(t!==null)for(const E of t)E.rv=Ct;Ne!==null&&(n===null?n=Ne:n.push(...Ne))}return(e.f&ct)!==0&&(e.f^=ct),v}catch(E){return Hi(E)}finally{e.f^=yr,Se=t,Ae=r,Ne=n,H=i,De=s,Ht(a),ze=l,It=o}}function so(e,t){let r=t.reactions;if(r!==null){var n=Zs.call(r,e);if(n!==-1){var i=r.length-1;i===0?r=t.reactions=null:(r[n]=r[i],r.pop())}}if(r===null&&(t.f&Ee)!==0&&(Se===null||!zt.call(Se,t))){var s=t;(s.f&Be)!==0&&(s.f^=Be,s.f&=~Rt),s.v!==me&&In(s),Ha(s),lr(s,0)}}function lr(e,t){var r=e.deps;if(r!==null)for(var n=t;n<r.length;n++)so(e,r[n])}function Yt(e){var t=e.f;if((t&Le)===0){de(e,ge);var r=V,n=mr;V=e,mr=!0;try{(t&(Ge|Ui))!==0?no(e):Un(e),us(e);var i=ms(e);e.teardown=typeof i=="function"?i:null,e.wv=ps;var s;Xs&&Ma&&(e.f&ye)!==0&&e.deps}finally{mr=n,V=r}}}async function ao(){await Promise.resolve(),La()}function h(e){var t=e.f,r=(t&Ee)!==0;if(H!==null&&!ze){var n=V!==null&&(V.f&Le)!==0;if(!n&&(De===null||!zt.call(De,e))){var i=H.deps;if((H.f&yr)!==0)e.rv<Ct&&(e.rv=Ct,Se===null&&i!==null&&i[Ae]===e?Ae++:Se===null?Se=[e]:Se.push(e));else{(H.deps??=[]).push(e);var s=e.reactions;s===null?e.reactions=[H]:zt.call(s,H)||s.push(H)}}}if(pt&&Tt.has(e))return Tt.get(e);if(r){var a=e;if(pt){var l=a.v;return((a.f&ge)===0&&a.reactions!==null||bs(a))&&(l=Nn(a)),Tt.set(a,l),l}var o=(a.f&Be)===0&&!ze&&H!==null&&(mr||(H.f&Be)!==0),u=(a.f&xt)===0;vr(a)&&(o&&(a.f|=Be),Xi(a)),o&&!u&&(Zi(a),ys(a))}if($e?.has(e))return $e.get(e);if((e.f&ct)!==0)throw e.v;return e.v}function ys(e){if(e.f|=Be,e.deps!==null)for(const t of e.deps)(t.reactions??=[]).push(e),(t.f&Ee)!==0&&(t.f&Be)===0&&(Zi(t),ys(t))}function bs(e){if(e.v===me)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(Tt.has(t)||(t.f&Ee)!==0&&bs(t))return!0;return!1}function Qt(e){var t=ze;try{return ze=!0,e()}finally{ze=t}}function oo(e){if(!(typeof e!="object"||!e||e instanceof EventTarget)){if(St in e)dn(e);else if(!Array.isArray(e))for(let t in e){const r=e[t];typeof r=="object"&&r&&St in r&&dn(r)}}}function dn(e,t=new Set){if(typeof e=="object"&&e!==null&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let n in e)try{dn(e[n],t)}catch{}const r=An(e);if(r!==Object.prototype&&r!==Array.prototype&&r!==Map.prototype&&r!==Set.prototype&&r!==Date.prototype){const n=Li(r);for(let i in n){const s=n[i].get;if(s)try{s.call(e)}catch{}}}}}const lo=["touchstart","touchmove"];function uo(e){return lo.includes(e)}const tr=Symbol("events"),ws=new Set,vn=new Set;function co(e,t,r,n={}){function i(s){if(n.capture||hn.call(t,s),!s.cancelBubble)return Rr(()=>r?.call(this,s))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?ft(()=>{t.addEventListener(e,i,n)}):t.addEventListener(e,i,n),i}function Er(e,t,r,n,i){var s={capture:n,passive:i},a=co(e,t,r,s);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Bn(()=>{t.removeEventListener(e,a,s)})}function le(e,t,r){(t[tr]??={})[e]=r}function _t(e){for(var t=0;t<e.length;t++)ws.add(e[t]);for(var r of vn)r(e)}let Zn=null;function hn(e){var t=this,r=t.ownerDocument,n=e.type,i=e.composedPath?.()||[],s=i[0]||e.target;Zn=e;var a=0,l=Zn===e&&e[tr];if(l){var o=i.indexOf(l);if(o!==-1&&(t===document||t===window)){e[tr]=t;return}var u=i.indexOf(t);if(u===-1)return;o<=u&&(a=o)}if(s=i[a]||e.target,s!==t){ea(e,"currentTarget",{configurable:!0,get(){return s||r}});var c=H,v=V;Ue(null),We(null);try{for(var d,_=[];s!==null;){var y=s.assignedSlot||s.parentNode||s.host||null;try{var E=s[tr]?.[n];E!=null&&(!s.disabled||e.target===s)&&E.call(s,e)}catch(b){d?_.push(b):d=b}if(e.cancelBubble||y===t||y===null)break;s=y}if(d){for(let b of _)queueMicrotask(()=>{throw b});throw d}}finally{e[tr]=t,delete e.currentTarget,Ue(c),We(v)}}}const fo=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function vo(e){return fo?.createHTML(e)??e}function Es(e){var t=as("template");return t.innerHTML=vo(e.replaceAll("<!>","<!---->")),t.content}function Pt(e,t){var r=V;r.nodes===null&&(r.nodes={start:e,end:t,a:null,t:null})}function q(e,t){var r=(t&Ea)!==0,n=(t&Ca)!==0,i,s=!e.startsWith("<!>");return()=>{i===void 0&&(i=Es(s?e:"<!>"+e),r||(i=Je(i)));var a=n||rs?document.importNode(i,!0):i.cloneNode(!0);if(r){var l=Je(a),o=a.lastChild;Pt(l,o)}else Pt(a,a);return a}}function ho(e,t,r="svg"){var n=!e.startsWith("<!>"),i=`<${r}>${n?e:"<!>"+e}</${r}>`,s;return()=>{if(!s){var a=Es(i),l=Je(a);s=Je(l)}var o=s.cloneNode(!0);return Pt(o,o),o}}function Cs(e,t){return ho(e,t,"svg")}function po(e=""){{var t=st(e+"");return Pt(t,t),t}}function hr(){var e=document.createDocumentFragment(),t=document.createComment(""),r=st();return e.append(t,r),Pt(t,r),e}function D(e,t){e!==null&&e.before(t)}function B(e,t){var r=t==null?"":typeof t=="object"?`${t}`:t;r!==(e.__t??=e.nodeValue)&&(e.__t=r,e.nodeValue=`${r}`)}function go(e,t){return _o(e,t)}const pr=new Map;function _o(e,{target:t,anchor:r,props:n={},events:i,context:s,intro:a=!0,transformError:l}){Ga();var o=void 0,u=eo(()=>{var c=r??t.appendChild(st());Fa(c,{pending:()=>{}},_=>{Ie({});var y=ue;s&&(y.c=s),i&&(n.$$events=i),o=e(_,n)||{},Re()},l);var v=new Set,d=_=>{for(var y=0;y<_.length;y++){var E=_[y];if(!v.has(E)){v.add(E);var b=uo(E);for(const C of[t,document]){var g=pr.get(C);g===void 0&&(g=new Map,pr.set(C,g));var T=g.get(E);T===void 0?(C.addEventListener(E,hn,{passive:b}),g.set(E,1)):g.set(E,T+1)}}}};return d(Ar(ws)),vn.add(d),()=>{for(var _ of v)for(const b of[t,document]){var y=pr.get(b),E=y.get(_);--E==0?(b.removeEventListener(_,hn),y.delete(_),y.size===0&&pr.delete(b)):y.set(_,E)}vn.delete(d),c!==r&&c.parentNode?.removeChild(c)}});return mo.set(o,u),o}let mo=new WeakMap;class yo{anchor;#r=new Map;#l=new Map;#e=new Map;#i=new Set;#n=!0;constructor(t,r=!0){this.anchor=t,this.#n=r}#s=t=>{if(this.#r.has(t)){var r=this.#r.get(t),n=this.#l.get(r);if(n)qn(n),this.#i.delete(r);else{var i=this.#e.get(r);i&&(this.#l.set(r,i.effect),this.#e.delete(r),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),n=i.effect)}for(const[s,a]of this.#r){if(this.#r.delete(s),s===t)break;const l=this.#e.get(a);l&&(Te(l.effect),this.#e.delete(a))}for(const[s,a]of this.#l){if(s===r||this.#i.has(s))continue;const l=()=>{if(Array.from(this.#r.values()).includes(s)){var u=document.createDocumentFragment();Fn(a,u),u.append(st()),this.#e.set(s,{effect:a,fragment:u})}else Te(a);this.#i.delete(s),this.#l.delete(s)};this.#n||!n?(this.#i.add(s),At(a,l,!1)):l()}}};#t=t=>{this.#r.delete(t);const r=Array.from(this.#r.values());for(const[n,i]of this.#e)r.includes(n)||(Te(i.effect),this.#e.delete(n))};ensure(t,r){var n=O,i=ss();if(r&&!this.#l.has(t)&&!this.#e.has(t))if(i){var s=document.createDocumentFragment(),a=st();s.append(a),this.#e.set(t,{effect:Pe(()=>r(a)),fragment:s})}else this.#l.set(t,Pe(()=>r(this.anchor)));if(this.#r.set(n,t),i){for(const[l,o]of this.#l)l===t?n.unskip_effect(o):n.skip_effect(o);for(const[l,o]of this.#e)l===t?n.unskip_effect(o.effect):n.skip_effect(o.effect);n.oncommit(this.#s),n.ondiscard(this.#t)}else this.#s(n)}}function G(e,t,r=!1){var n=new yo(e),i=r?Vt:0;function s(a,l){n.ensure(a,l)}Dn(()=>{var a=!1;t((l,o=0)=>{a=!0,s(o,l)}),a||s(-1,null)},i)}function bo(e,t,r){for(var n=[],i=t.length,s,a=t.length,l=0;l<i;l++){let v=t[l];At(v,()=>{if(s){if(s.pending.delete(v),s.done.add(v),s.pending.size===0){var d=e.outrogroups;pn(e,Ar(s.done)),d.delete(s),d.size===0&&(e.outrogroups=null)}}else a-=1},!1)}if(a===0){var o=n.length===0&&r!==null;if(o){var u=r,c=u.parentNode;Qa(c),c.append(u),e.items.clear()}pn(e,t,!o)}else s={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(s)}function pn(e,t,r=!0){var n;if(e.pending.size>0){n=new Set;for(const a of e.pending.values())for(const l of a)n.add(e.items.get(l).e)}for(var i=0;i<t.length;i++){var s=t[i];if(n?.has(s)){s.f|=Ke;const a=document.createDocumentFragment();Fn(s,a)}else Te(t[i],r)}}var ei;function gt(e,t,r,n,i,s=null){var a=e,l=new Map,o=(t&Oi)!==0;if(o){var u=e;a=u.appendChild(st())}var c=null,v=wr(()=>{var C=r();return Tn(C)?C:C==null?[]:Ar(C)}),d,_=new Map,y=!0;function E(C){(T.effect.f&Le)===0&&(T.pending.delete(C),T.fallback=c,wo(T,d,a,t,n),c!==null&&(d.length===0?(c.f&Ke)===0?qn(c):(c.f^=Ke,rr(c,null,a)):At(c,()=>{c=null})))}function b(C){T.pending.delete(C)}var g=Dn(()=>{d=h(v);for(var C=d.length,I=new Set,x=O,k=ss(),A=0;A<C;A+=1){var M=d[A],N=n(M,A),P=y?null:l.get(N);P?(P.v&&Kt(P.v,M),P.i&&Kt(P.i,A),k&&x.unskip_effect(P.e)):(P=Eo(l,y?a:ei??=st(),M,N,A,i,t,r),y||(P.e.f|=Ke),l.set(N,P)),I.add(N)}if(C===0&&s&&!c&&(y?c=Pe(()=>s(a)):(c=Pe(()=>s(ei??=st())),c.f|=Ke)),C>I.size&&ua(),!y)if(_.set(x,I),k){for(const[S,m]of l)I.has(S)||x.skip_effect(m.e);x.oncommit(E),x.ondiscard(b)}else E(x);h(v)}),T={effect:g,items:l,pending:_,outrogroups:null,fallback:c};y=!1}function Zt(e){for(;e!==null&&(e.f&Ve)===0;)e=e.next;return e}function wo(e,t,r,n,i){var s=(n&ba)!==0,a=t.length,l=e.items,o=Zt(e.effect.first),u,c=null,v,d=[],_=[],y,E,b,g;if(s)for(g=0;g<a;g+=1)y=t[g],E=i(y,g),b=l.get(E).e,(b.f&Ke)===0&&(b.nodes?.a?.measure(),(v??=new Set).add(b));for(g=0;g<a;g+=1){if(y=t[g],E=i(y,g),b=l.get(E).e,e.outrogroups!==null)for(const P of e.outrogroups)P.pending.delete(b),P.done.delete(b);if((b.f&Ce)!==0&&(qn(b),s&&(b.nodes?.a?.unfix(),(v??=new Set).delete(b))),(b.f&Ke)!==0)if(b.f^=Ke,b===o)rr(b,null,r);else{var T=c?c.next:o;b===e.effect.last&&(e.effect.last=b.prev),b.prev&&(b.prev.next=b.next),b.next&&(b.next.prev=b.prev),ot(e,c,b),ot(e,b,T),rr(b,T,r),c=b,d=[],_=[],o=Zt(c.next);continue}if(b!==o){if(u!==void 0&&u.has(b)){if(d.length<_.length){var C=_[0],I;c=C.prev;var x=d[0],k=d[d.length-1];for(I=0;I<d.length;I+=1)rr(d[I],C,r);for(I=0;I<_.length;I+=1)u.delete(_[I]);ot(e,x.prev,k.next),ot(e,c,x),ot(e,k,C),o=C,c=k,g-=1,d=[],_=[]}else u.delete(b),rr(b,o,r),ot(e,b.prev,b.next),ot(e,b,c===null?e.effect.first:c.next),ot(e,c,b),c=b;continue}for(d=[],_=[];o!==null&&o!==b;)(u??=new Set).add(o),_.push(o),o=Zt(o.next);if(o===null)continue}(b.f&Ke)===0&&d.push(b),c=b,o=Zt(b.next)}if(e.outrogroups!==null){for(const P of e.outrogroups)P.pending.size===0&&(pn(e,Ar(P.done)),e.outrogroups?.delete(P));e.outrogroups.size===0&&(e.outrogroups=null)}if(o!==null||u!==void 0){var A=[];if(u!==void 0)for(b of u)(b.f&Ce)===0&&A.push(b);for(;o!==null;)(o.f&Ce)===0&&o!==e.fallback&&A.push(o),o=Zt(o.next);var M=A.length;if(M>0){var N=(n&Oi)!==0&&a===0?r:null;if(s){for(g=0;g<M;g+=1)A[g].nodes?.a?.measure();for(g=0;g<M;g+=1)A[g].nodes?.a?.fix()}bo(e,A,N)}}s&&ft(()=>{if(v!==void 0)for(b of v)b.nodes?.a?.apply()})}function Eo(e,t,r,n,i,s,a,l){var o=(a&ma)!==0?(a&wa)===0?Ka(r,!1,!1):Mt(r):null,u=(a&ya)!==0?Mt(i):null;return{v:o,i:u,e:Pe(()=>(s(t,o??r,u??i,l),()=>{e.delete(n)}))}}function rr(e,t,r){if(e.nodes)for(var n=e.nodes.start,i=e.nodes.end,s=t&&(t.f&Ke)===0?t.nodes.start:r;n!==null;){var a=dr(n);if(s.before(n),n===i)return;n=a}}function ot(e,t,r){t===null?e.effect.first=r:t.next=r,r===null?e.effect.last=t:r.prev=t}function Co(e,t,r=!1,n=!1,i=!1,s=!1){var a=e,l="";if(r)var o=e;F(()=>{var u=V;if(l!==(l=t()??"")){if(r){u.nodes=null,o.innerHTML=l,l!==""&&Pt(Je(o),o.lastChild);return}if(u.nodes!==null&&(cs(u.nodes.start,u.nodes.end),u.nodes=null),l!==""){var c=n?ka:i?Sa:void 0,v=as(n?"svg":i?"math":"template",c);v.innerHTML=l;var d=n||i?v:v.content;if(Pt(Je(d),d.lastChild),n||i)for(;Je(d);)a.before(Je(d));else a.before(d)}}})}function ks(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=ks(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function ko(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=ks(e))&&(n&&(n+=" "),n+=t);return n}function So(e){return typeof e=="object"?ko(e):e??""}const ti=[...`
|
|
2
|
+
\r\f \v\uFEFF`];function To(e,t,r){var n=e==null?"":""+e;if(t&&(n=n?n+" "+t:t),r){for(var i of Object.keys(r))if(r[i])n=n?n+" "+i:i;else if(n.length)for(var s=i.length,a=0;(a=n.indexOf(i,a))>=0;){var l=a+s;(a===0||ti.includes(n[a-1]))&&(l===n.length||ti.includes(n[l]))?n=(a===0?"":n.substring(0,a))+n.substring(l+1):a=l}}return n===""?null:n}function Ao(e,t){return e==null?null:String(e)}function Bt(e,t,r,n,i,s){var a=e.__className;if(a!==r||a===void 0){var l=To(r,n,s);l==null?e.removeAttribute("class"):e.className=l,e.__className=r}else if(s&&i!==s)for(var o in s){var u=!!s[o];(i==null||u!==!!i[o])&&e.classList.toggle(o,u)}return s}function gn(e,t,r,n){var i=e.__style;if(i!==t){var s=Ao(t);s==null?e.removeAttribute("style"):e.style.cssText=s,e.__style=t}return n}function Ss(e,t,r=!1){if(e.multiple){if(t==null)return;if(!Tn(t))return Aa();for(var n of e.options)n.selected=t.includes(ar(n));return}for(n of e.options){var i=ar(n);if(Ja(i,t)){n.selected=!0;return}}(!r||t!==void 0)&&(e.selectedIndex=-1)}function Io(e){var t=new MutationObserver(()=>{Ss(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Bn(()=>{t.disconnect()})}function Ts(e,t,r=t){var n=new WeakSet,i=!0;Pn(e,"change",s=>{var a=s?"[selected]":":checked",l;if(e.multiple)l=[].map.call(e.querySelectorAll(a),ar);else{var o=e.querySelector(a)??e.querySelector("option:not([disabled])");l=o&&ar(o)}r(l),e.__value=l,O!==null&&n.add(O)}),to(()=>{var s=t();if(e===document.activeElement){var a=O;if(n.has(a))return}if(Ss(e,s,i),i&&s===void 0){var l=e.querySelector(":checked");l!==null&&(s=ar(l),r(s))}e.__value=s,i=!1}),Io(e)}function ar(e){return"__value"in e?e.__value:e.value}const Ro=Symbol("is custom element"),Mo=Symbol("is html"),No=oa?"progress":"PROGRESS";function As(e,t){var r=Is(e);r.value===(r.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!==No)||(e.value=t??"")}function he(e,t,r,n){var i=Is(e);i[t]!==(i[t]=r)&&(t==="loading"&&(e[aa]=r),r==null?e.removeAttribute(t):typeof r!="string"&&Po(e).includes(t)?e[t]=r:e.setAttribute(t,r))}function Is(e){return e.__attributes??={[Ro]:e.nodeName.includes("-"),[Mo]:e.namespaceURI===$i}}var ri=new Map;function Po(e){var t=e.getAttribute("is")||e.nodeName,r=ri.get(t);if(r)return r;ri.set(t,r=[]);for(var n,i=e,s=Element.prototype;s!==i;){n=Li(i);for(var a in n)n[a].set&&r.push(a);i=An(i)}return r}function Cr(e,t,r=t){var n=new WeakSet;Pn(e,"input",async i=>{var s=i?e.defaultValue:e.value;if(s=Br(e)?Lr(s):s,r(s),O!==null&&n.add(O),await ao(),s!==(s=t())){var a=e.selectionStart,l=e.selectionEnd,o=e.value.length;if(e.value=s??"",l!==null){var u=e.value.length;a===l&&l===o&&u>o?(e.selectionStart=u,e.selectionEnd=u):(e.selectionStart=a,e.selectionEnd=Math.min(l,u))}}}),Qt(t)==null&&e.value&&(r(Br(e)?Lr(e.value):e.value),O!==null&&n.add(O)),Ln(()=>{var i=t();if(e===document.activeElement){var s=O;if(n.has(s))return}Br(e)&&i===Lr(e.value)||e.type==="date"&&!i&&!e.value||i!==e.value&&(e.value=i??"")})}function _n(e,t,r=t){Pn(e,"change",n=>{var i=n?e.defaultChecked:e.checked;r(i)}),Qt(t)==null&&r(e.checked),Ln(()=>{var n=t();e.checked=!!n})}function Br(e){var t=e.type;return t==="number"||t==="range"}function Lr(e){return e===""?null:+e}function On(e=!1){const t=ue,r=t.l.u;if(!r)return;let n=()=>oo(t.s);if(e){let i=0,s={};const a=Ir(()=>{let l=!1;const o=t.s;for(const u in o)o[u]!==s[u]&&(s[u]=o[u],l=!0);return l&&i++,i});n=()=>h(a)}r.b.length&&Za(()=>{ni(t,n),on(r.b)}),Nt(()=>{const i=Qt(()=>r.m.map(ia));return()=>{for(const s of i)typeof s=="function"&&s()}}),r.a.length&&Nt(()=>{ni(t,n),on(r.a)})}function ni(e,t){if(e.l.s)for(const r of e.l.s)h(r);t()}function dt(e,t,r,n){var i=n,s=!0,a=()=>(s&&(s=!1,i=n),i),l;l=e[t],l===void 0&&n!==void 0&&(l=a());var o;return o=()=>{var u=e[t];return u===void 0?a():(s=!0,u)},o}function mt(e){ue===null&&Fi(),cr&&ue.l!==null?Bo(ue).m.push(e):Nt(()=>{const t=Qt(e);if(typeof t=="function")return t})}function xo(e){ue===null&&Fi(),mt(()=>()=>Qt(e))}function Bo(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}const Lo="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(Lo);Na();class xe extends Error{code;status;constructor(t,r,n=0){super(r),this.name="ApiError",this.code=t,this.status=n}}async function qe(e,t={}){let r;try{r=await fetch(e,{...t,headers:{accept:"application/json",...t.body!==void 0&&t.body!==null?{"content-type":"application/json"}:{},...t.headers??{}}})}catch(a){throw new xe("network",a.message||"Network request failed",0)}const s=(r.headers.get("content-type")??"").includes("application/json")?await r.json().catch(()=>null):null;if(!r.ok){const a=s;throw a&&a.ok===!1&&a.error?new xe(a.error.code,a.error.message,r.status):new xe(`http_${r.status}`,r.statusText||"Request failed",r.status)}if(s&&typeof s=="object"){const a=s;if(a.ok===!1&&a.error)throw new xe(a.error.code,a.error.message,r.status);if(a.ok===!0&&"data"in a)return a.data}return s}function Mr(e,t){const r=t===void 0?{method:"POST"}:{method:"POST",body:JSON.stringify(t)};return qe(e,r)}function mn(e,t){const r=t===void 0?{method:"PUT"}:{method:"PUT",body:JSON.stringify(t)};return qe(e,r)}function ii(e){return qe(e,{method:"DELETE"})}const W=Ye({status:"loading",service:null,nodes:[],nodeStats:{},trustCircle:{members:[],pending:[]},connectivity:null,update:null,settings:null,toasts:[]});function yt(){return W}const si=6e3;let Do=0;function X(e,t){const r=`t${++Do}`,n={id:r,kind:e,text:t,expiresAt:Date.now()+si};W.toasts.push(n),setTimeout(()=>Rs(r),si)}function Rs(e){W.toasts=W.toasts.filter(t=>t.id!==e)}function Wt(e,t){const r=t instanceof xe?t.code:"error",n=t instanceof Error?t.message:String(t);console.error(`[cadre-host-ui] ${e}:`,t),X("error",`${e}: ${n} (${r})`)}function Uo(e,t,r){if(!e)return"loading";const n=e.directReachability,i=t.some(s=>s.status!=="running");return n==="unreachable"||n==="cgnat"||i||r?.lastError?"warn":"ok"}function Jt(){W.status=Uo(W.connectivity,W.nodes,W.update)}async function Ms(){try{const e=await qe("/api/status");W.service=e.service,W.connectivity=e.connectivity,W.nodes.length===0&&(W.nodes=e.nodes.map(t=>({id:t.id,dockerId:"",partyId:t.partyId,profile:t.profile,status:t.status,spawnedAt:"",workdir:"",ports:{health:0,metrics:0,p2p:0}}))),Jt()}catch(e){Wt("status",e),W.status="error"}}async function Ns(){try{const e=await qe("/api/nodes");W.nodes=e.nodes,Jt()}catch(e){Wt("nodes",e)}}async function Dr(e){try{const t=await qe(`/api/nodes/${encodeURIComponent(e)}`);return W.nodes=W.nodes.map(r=>r.id===e?t.node:r),W.nodeStats={...W.nodeStats,[e]:t.stats},t}catch(t){return Wt(`node ${e}`,t),null}}async function $t(){try{const e=await qe("/auth/trust-circle");W.trustCircle=e}catch(e){Wt("trust-circle",e)}}async function Ot(){try{const e=await qe("/nat/status");W.connectivity=e,Jt()}catch(e){Wt("connectivity",e)}}async function kr(){try{const e=await qe("/update");W.update=e,Jt()}catch{W.update=null}}async function yn(){try{const e=await qe("/api/settings");W.settings=e}catch(e){Wt("settings",e)}}function qo(e){let t={};try{t=JSON.parse(e.data)}catch{return}switch(e.type){case"node-state-changed":{const r=t.nodeId,n=t.status;r&&n&&(W.nodes=W.nodes.map(i=>i.id===r?{...i,status:n}:i),Jt());break}case"trust-circle-changed":$t();break;case"connectivity-changed":Ot();break;case"update-available":{const r=t.version,n=t.releaseNotesUrl;r&&(W.update={...W.update??{version:1},available:{version:r,publishedAt:W.update?.available?.publishedAt??new Date().toISOString(),...n?{releaseNotesUrl:n}:{}}},Jt());break}}}const bn={name:"home",params:{}};function Ps(e){const t=e.startsWith("#")?e.slice(1):e,r=t.startsWith("/")?t.slice(1):t;if(!r)return bn;const n=r.split("/").filter(Boolean);switch(n[0]){case"trust-circle":return{name:"trust-circle",params:{}};case"connectivity":return{name:"connectivity",params:{}};case"nodes":return n.length>=2&&n[1]?{name:"node-detail",params:{id:decodeURIComponent(n[1])}}:{name:"nodes",params:{}};case"settings":return{name:"settings",params:{}};default:return bn}}function kt(e,t={}){switch(e){case"home":return"#/";case"trust-circle":return"#/trust-circle";case"connectivity":return"#/connectivity";case"nodes":return"#/nodes";case"node-detail":return`#/nodes/${encodeURIComponent(t.id??"")}`;case"settings":return"#/settings"}}const xs=Ye({route:typeof window>"u"?bn:Ps(window.location.hash)});let Sr=!1;function wn(){xs.route=Ps(window.location.hash)}function Fo(){return xs}function Oo(){Sr||typeof window>"u"||(Sr=!0,window.addEventListener("hashchange",wn),wn())}function $o(){!Sr||typeof window>"u"||(Sr=!1,window.removeEventListener("hashchange",wn))}const zo=["node-state-changed","trust-circle-changed","connectivity-changed","update-available"],jo=[2e3,4e3,8e3,16e3,3e4];function Vo(e,t={}){const r=t.url??"/api/events",n=t.eventSourceCtor??(typeof EventSource<"u"?EventSource:void 0);if(!n)return{close(){}};const i=t.backoffSchedule??jo;let s=!1,a=0,l,o;function u(v){const d=Math.min(v,i.length-1);return i[d]??i[i.length-1]}function c(){if(s)return;o=new n(r);const v=o;v.onopen=()=>{s||(a=0,t.onOpen?.())};for(const d of zo)v.addEventListener(d,_=>{e({type:d,data:_.data??""})});v.onerror=()=>{if(s)return;try{v.close()}catch{}const d=u(a);t.onError?.(a,d),a+=1,l=setTimeout(c,d)}}return c(),{close(){if(s=!0,l&&clearTimeout(l),o)try{o.close()}catch{}}}}const Bs=1e3,En=60*Bs,Cn=60*En,ai=24*Cn;function je(e,t=Date.now()){if(!e)return"—";const r=Date.parse(e);if(!Number.isFinite(r))return"—";const n=t-r;return n<0?"just now":n<En?`${Math.floor(n/Bs)}s ago`:n<Cn?`${Math.floor(n/En)}m ago`:n<ai?`${Math.floor(n/Cn)}h ago`:`${Math.floor(n/ai)}d ago`}function Ho(e){if(e==null||!Number.isFinite(e))return"—";if(e<1024)return`${e} B`;const t=["KB","MB","GB","TB"];let r=e/1024,n=0;for(;r>=1024&&n<t.length-1;)r/=1024,n+=1;return`${r.toFixed(r<10?2:1)} ${t[n]}`}function Ko(e){if(e==null||!Number.isFinite(e)||e<0)return"—";const t=Math.floor(e/86400),r=Math.floor(e%86400/3600),n=Math.floor(e%3600/60);return t>0?`${t}d ${r}h`:r>0?`${r}h ${n}m`:`${n}m`}function Tr(e){return e?e.length<=12?e:`${e.slice(0,6)}…${e.slice(-4)}`:"—"}var Yo=q('<span role="status"><span class="bulb svelte-1qa2kn2" aria-hidden="true"></span> <span> </span></span>');function Ls(e,t){let r=dt(t,"size",3,14);const n=_e(()=>{switch(t.status){case"ok":return"ok";case"warn":return"warn";case"error":return"err";default:return"muted"}}),i=_e(()=>t.label??s(t.status));function s(c){switch(c){case"ok":return"Healthy";case"warn":return"Attention needed";case"error":return"Error";default:return"Loading…"}}var a=Yo(),l=f(a),o=p(l,2),u=f(o);F(()=>{Bt(a,1,`dot dot-${h(n)??""}`,"svelte-1qa2kn2"),gn(l,`width: ${r()??""}px; height: ${r()??""}px;`),B(u,h(i))}),D(e,a)}var Jo=q('<span class="row svelte-lwwmgz"><span> </span> <span class="badge"> </span></span>');function Ds(e,t){const r=_e(()=>{switch(t.reachability){case"reachable":return"Reachable";case"unreachable":return"Unreachable";case"cgnat":return"Behind CGNAT";default:return"Unknown"}}),n=_e(()=>{switch(t.reachability){case"reachable":return"ok";case"unreachable":return"err";case"cgnat":return"warn";default:return"info"}}),i=_e(()=>{switch(t.portMode){case"auto-upnp":return"UPnP";case"auto-natpmp":return"NAT-PMP";case"manual":return"Manual";case"failed":return"Failed";case"disabled":return"Disabled";default:return t.portMode}});var s=Jo(),a=f(s),l=f(a),o=p(a,2),u=f(o);F(()=>{Bt(a,1,`badge ${h(n)??""}`,"svelte-lwwmgz"),B(l,h(r)),B(u,h(i))}),D(e,s)}var Go=q('<div class="banner info svelte-15mtls8"><div><strong>Update available</strong> <span class="muted"> </span></div> <a class="link svelte-15mtls8">View update</a></div>'),Qo=q('<a class="link svelte-15mtls8">Resolve →</a>'),Wo=q('<!> <dl class="kv svelte-15mtls8"><div class="svelte-15mtls8"><dt class="svelte-15mtls8">External IP</dt><dd class="svelte-15mtls8"> </dd></div> <div class="svelte-15mtls8"><dt class="svelte-15mtls8">External port</dt><dd class="svelte-15mtls8"> </dd></div> <div class="svelte-15mtls8"><dt class="svelte-15mtls8">Last tested</dt><dd class="svelte-15mtls8"> </dd></div></dl> <!>',1),Xo=q('<p class="muted">Loading connectivity…</p>'),Zo=q('<p class="muted"> </p>'),el=q('<section class="stack"><!> <div class="grid summary svelte-15mtls8"><div class="card"><h3>Overall</h3> <!> <dl class="kv svelte-15mtls8"><div class="svelte-15mtls8"><dt class="svelte-15mtls8">Service</dt><dd class="svelte-15mtls8"> </dd></div> <div class="svelte-15mtls8"><dt class="svelte-15mtls8">Version</dt><dd class="svelte-15mtls8"> </dd></div> <div class="svelte-15mtls8"><dt class="svelte-15mtls8">Uptime</dt><dd class="svelte-15mtls8"> </dd></div></dl></div> <div class="card"><h3>Connectivity</h3> <!></div> <div class="card"><h3>Trust circle</h3> <p class="big svelte-15mtls8"> <span class="muted svelte-15mtls8">members</span></p> <!> <a class="link svelte-15mtls8">Manage →</a></div> <div class="card"><h3>Nodes</h3> <p class="big svelte-15mtls8"> <span class="muted svelte-15mtls8"> </span></p> <a class="link svelte-15mtls8">Details →</a></div></div></section>');function tl(e,t){Ie(t,!0);const r=yt();mt(()=>{Ms(),kr()});const n=_e(()=>r.update?.available?.version??null),i=_e(()=>r.trustCircle.members.length),s=_e(()=>r.trustCircle.pending.length),a=_e(()=>r.nodes.filter($=>$.status==="running").length);var l=el(),o=f(l);{var u=$=>{var oe=Go(),Q=f(oe),pe=p(f(Q),2),re=f(pe),Y=p(Q,2);F(ne=>{B(re,`— version ${h(n)??""}`),he(Y,"href",ne)},[()=>kt("settings")]),D($,oe)};G(o,$=>{h(n)&&$(u)})}var c=p(o,2),v=f(c),d=p(f(v),2);Ls(d,{get status(){return r.status}});var _=p(d,2),y=f(_),E=p(f(y)),b=f(E),g=p(y,2),T=p(f(g)),C=f(T),I=p(g,2),x=p(f(I)),k=f(x),A=p(v,2),M=p(f(A),2);{var N=$=>{var oe=Wo(),Q=we(oe);Ds(Q,{get reachability(){return r.connectivity.directReachability},get portMode(){return r.connectivity.portMode}});var pe=p(Q,2),re=f(pe),Y=p(f(re)),ne=f(Y),Me=p(re,2),Ze=p(f(Me)),at=f(Ze),Fe=p(Me,2),bt=p(f(Fe)),Oe=f(bt),U=p(pe,2);{var J=ie=>{var ve=Qo();F(fe=>he(ve,"href",fe),[()=>kt("connectivity")]),D(ie,ve)};G(U,ie=>{r.connectivity.directReachability!=="reachable"&&ie(J)})}F(ie=>{B(ne,r.connectivity.externalIp??"—"),B(at,r.connectivity.externalPort),B(Oe,ie)},[()=>je(r.connectivity.lastTestedAt)]),D($,oe)},P=$=>{var oe=Xo();D($,oe)};G(M,$=>{r.connectivity?$(N):$(P,-1)})}var S=p(A,2),m=p(f(S),2),w=f(m),R=p(m,2);{var j=$=>{var oe=Zo(),Q=f(oe);F(()=>B(Q,`${h(s)??""} pending invite${h(s)===1?"":"s"}`)),D($,oe)};G(R,$=>{h(s)>0&&$(j)})}var K=p(R,2),se=p(S,2),Z=p(f(se),2),ee=f(Z),te=p(ee),ae=f(te),ce=p(Z,2);F(($,oe,Q)=>{B(b,r.service?.name??"cadre-host"),B(C,r.service?.version??"—"),B(k,$),B(w,h(i)),he(K,"href",oe),B(ee,h(a)),B(ae,`/ ${r.nodes.length??""} running`),he(ce,"href",Q)},[()=>Ko(r.service?.uptimeSeconds),()=>kt("trust-circle"),()=>kt("nodes")]),D(e,l),Re()}var rl=q('<div class="backdrop svelte-80vbit" role="presentation"></div> <div class="dialog svelte-80vbit" role="dialog" aria-modal="true" aria-labelledby="confirm-title" tabindex="-1"><h3 id="confirm-title"> </h3> <p class="muted"> </p> <div class="actions svelte-80vbit"><button> </button> <button> </button></div></div>',1);function kn(e,t){Ie(t,!0);let r=dt(t,"confirmLabel",3,"Confirm"),n=dt(t,"cancelLabel",3,"Cancel"),i=dt(t,"danger",3,!1),s=z(!1);async function a(){L(s,!0);try{await t.onConfirm()}finally{L(s,!1)}}function l(v){v.key==="Escape"&&t.onCancel()}var o=hr(),u=we(o);{var c=v=>{var d=rl(),_=we(d),y=p(_,2),E=f(y),b=f(E),g=p(E,2),T=f(g),C=p(g,2),I=f(C),x=f(I),k=p(I,2),A=f(k);F(()=>{B(b,t.title),B(T,t.message),I.disabled=h(s),B(x,n()),Bt(k,1,So(i()?"danger":"primary")),k.disabled=h(s),B(A,h(s)?"Working…":r())}),le("click",_,function(...M){t.onCancel?.apply(this,M)}),le("keydown",y,l),le("click",I,function(...M){t.onCancel?.apply(this,M)}),le("click",k,a),D(v,d)};G(u,v=>{t.open&&v(c)})}D(e,o),Re()}_t(["click","keydown"]);function nl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var qt={},Ur,oi;function il(){return oi||(oi=1,Ur=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Ur}var qr={},lt={},li;function Lt(){if(li)return lt;li=1;let e;const t=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return lt.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return n*4+17},lt.getSymbolTotalCodewords=function(n){return t[n]},lt.getBCHDigit=function(r){let n=0;for(;r!==0;)n++,r>>>=1;return n},lt.setToSJISFunction=function(n){if(typeof n!="function")throw new Error('"toSJISFunc" is not a valid function.');e=n},lt.isKanjiModeEnabled=function(){return typeof e<"u"},lt.toSJIS=function(n){return e(n)},lt}var Fr={},ui;function $n(){return ui||(ui=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+r)}}e.isValid=function(n){return n&&typeof n.bit<"u"&&n.bit>=0&&n.bit<4},e.from=function(n,i){if(e.isValid(n))return n;try{return t(n)}catch{return i}}})(Fr)),Fr}var Or,ci;function sl(){if(ci)return Or;ci=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const r=Math.floor(t/8);return(this.buffer[r]>>>7-t%8&1)===1},put:function(t,r){for(let n=0;n<r;n++)this.putBit((t>>>r-n-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const r=Math.floor(this.length/8);this.buffer.length<=r&&this.buffer.push(0),t&&(this.buffer[r]|=128>>>this.length%8),this.length++}},Or=e,Or}var $r,fi;function al(){if(fi)return $r;fi=1;function e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return e.prototype.set=function(t,r,n,i){const s=t*this.size+r;this.data[s]=n,i&&(this.reservedBit[s]=!0)},e.prototype.get=function(t,r){return this.data[t*this.size+r]},e.prototype.xor=function(t,r,n){this.data[t*this.size+r]^=n},e.prototype.isReserved=function(t,r){return this.reservedBit[t*this.size+r]},$r=e,$r}var zr={},di;function ol(){return di||(di=1,(function(e){const t=Lt().getSymbolSize;e.getRowColCoords=function(n){if(n===1)return[];const i=Math.floor(n/7)+2,s=t(n),a=s===145?26:Math.ceil((s-13)/(2*i-2))*2,l=[s-7];for(let o=1;o<i-1;o++)l[o]=l[o-1]-a;return l.push(6),l.reverse()},e.getPositions=function(n){const i=[],s=e.getRowColCoords(n),a=s.length;for(let l=0;l<a;l++)for(let o=0;o<a;o++)l===0&&o===0||l===0&&o===a-1||l===a-1&&o===0||i.push([s[l],s[o]]);return i}})(zr)),zr}var jr={},vi;function ll(){if(vi)return jr;vi=1;const e=Lt().getSymbolSize,t=7;return jr.getPositions=function(n){const i=e(n);return[[0,0],[i-t,0],[0,i-t]]},jr}var Vr={},hi;function ul(){return hi||(hi=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(i){return i!=null&&i!==""&&!isNaN(i)&&i>=0&&i<=7},e.from=function(i){return e.isValid(i)?parseInt(i,10):void 0},e.getPenaltyN1=function(i){const s=i.size;let a=0,l=0,o=0,u=null,c=null;for(let v=0;v<s;v++){l=o=0,u=c=null;for(let d=0;d<s;d++){let _=i.get(v,d);_===u?l++:(l>=5&&(a+=t.N1+(l-5)),u=_,l=1),_=i.get(d,v),_===c?o++:(o>=5&&(a+=t.N1+(o-5)),c=_,o=1)}l>=5&&(a+=t.N1+(l-5)),o>=5&&(a+=t.N1+(o-5))}return a},e.getPenaltyN2=function(i){const s=i.size;let a=0;for(let l=0;l<s-1;l++)for(let o=0;o<s-1;o++){const u=i.get(l,o)+i.get(l,o+1)+i.get(l+1,o)+i.get(l+1,o+1);(u===4||u===0)&&a++}return a*t.N2},e.getPenaltyN3=function(i){const s=i.size;let a=0,l=0,o=0;for(let u=0;u<s;u++){l=o=0;for(let c=0;c<s;c++)l=l<<1&2047|i.get(u,c),c>=10&&(l===1488||l===93)&&a++,o=o<<1&2047|i.get(c,u),c>=10&&(o===1488||o===93)&&a++}return a*t.N3},e.getPenaltyN4=function(i){let s=0;const a=i.data.length;for(let o=0;o<a;o++)s+=i.data[o];return Math.abs(Math.ceil(s*100/a/5)-10)*t.N4};function r(n,i,s){switch(n){case e.Patterns.PATTERN000:return(i+s)%2===0;case e.Patterns.PATTERN001:return i%2===0;case e.Patterns.PATTERN010:return s%3===0;case e.Patterns.PATTERN011:return(i+s)%3===0;case e.Patterns.PATTERN100:return(Math.floor(i/2)+Math.floor(s/3))%2===0;case e.Patterns.PATTERN101:return i*s%2+i*s%3===0;case e.Patterns.PATTERN110:return(i*s%2+i*s%3)%2===0;case e.Patterns.PATTERN111:return(i*s%3+(i+s)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}e.applyMask=function(i,s){const a=s.size;for(let l=0;l<a;l++)for(let o=0;o<a;o++)s.isReserved(o,l)||s.xor(o,l,r(i,o,l))},e.getBestMask=function(i,s){const a=Object.keys(e.Patterns).length;let l=0,o=1/0;for(let u=0;u<a;u++){s(u),e.applyMask(u,i);const c=e.getPenaltyN1(i)+e.getPenaltyN2(i)+e.getPenaltyN3(i)+e.getPenaltyN4(i);e.applyMask(u,i),c<o&&(o=c,l=u)}return l}})(Vr)),Vr}var gr={},pi;function Us(){if(pi)return gr;pi=1;const e=$n(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return gr.getBlocksCount=function(i,s){switch(s){case e.L:return t[(i-1)*4+0];case e.M:return t[(i-1)*4+1];case e.Q:return t[(i-1)*4+2];case e.H:return t[(i-1)*4+3];default:return}},gr.getTotalCodewordsCount=function(i,s){switch(s){case e.L:return r[(i-1)*4+0];case e.M:return r[(i-1)*4+1];case e.Q:return r[(i-1)*4+2];case e.H:return r[(i-1)*4+3];default:return}},gr}var Hr={},er={},gi;function cl(){if(gi)return er;gi=1;const e=new Uint8Array(512),t=new Uint8Array(256);return(function(){let n=1;for(let i=0;i<255;i++)e[i]=n,t[n]=i,n<<=1,n&256&&(n^=285);for(let i=255;i<512;i++)e[i]=e[i-255]})(),er.log=function(n){if(n<1)throw new Error("log("+n+")");return t[n]},er.exp=function(n){return e[n]},er.mul=function(n,i){return n===0||i===0?0:e[t[n]+t[i]]},er}var _i;function fl(){return _i||(_i=1,(function(e){const t=cl();e.mul=function(n,i){const s=new Uint8Array(n.length+i.length-1);for(let a=0;a<n.length;a++)for(let l=0;l<i.length;l++)s[a+l]^=t.mul(n[a],i[l]);return s},e.mod=function(n,i){let s=new Uint8Array(n);for(;s.length-i.length>=0;){const a=s[0];for(let o=0;o<i.length;o++)s[o]^=t.mul(i[o],a);let l=0;for(;l<s.length&&s[l]===0;)l++;s=s.slice(l)}return s},e.generateECPolynomial=function(n){let i=new Uint8Array([1]);for(let s=0;s<n;s++)i=e.mul(i,new Uint8Array([1,t.exp(s)]));return i}})(Hr)),Hr}var Kr,mi;function dl(){if(mi)return Kr;mi=1;const e=fl();function t(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(n){this.degree=n,this.genPoly=e.generateECPolynomial(this.degree)},t.prototype.encode=function(n){if(!this.genPoly)throw new Error("Encoder not initialized");const i=new Uint8Array(n.length+this.degree);i.set(n);const s=e.mod(i,this.genPoly),a=this.degree-s.length;if(a>0){const l=new Uint8Array(this.degree);return l.set(s,a),l}return s},Kr=t,Kr}var Yr={},Jr={},Gr={},yi;function qs(){return yi||(yi=1,Gr.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),Gr}var He={},bi;function Fs(){if(bi)return He;bi=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let r="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";r=r.replace(/u/g,"\\u");const n="(?:(?![A-Z0-9 $%*+\\-./:]|"+r+`)(?:.|[\r
|
|
3
|
+
]))+`;He.KANJI=new RegExp(r,"g"),He.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),He.BYTE=new RegExp(n,"g"),He.NUMERIC=new RegExp(e,"g"),He.ALPHANUMERIC=new RegExp(t,"g");const i=new RegExp("^"+r+"$"),s=new RegExp("^"+e+"$"),a=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return He.testKanji=function(o){return i.test(o)},He.testNumeric=function(o){return s.test(o)},He.testAlphanumeric=function(o){return a.test(o)},He}var wi;function Dt(){return wi||(wi=1,(function(e){const t=qs(),r=Fs();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(s,a){if(!s.ccBits)throw new Error("Invalid mode: "+s);if(!t.isValid(a))throw new Error("Invalid version: "+a);return a>=1&&a<10?s.ccBits[0]:a<27?s.ccBits[1]:s.ccBits[2]},e.getBestModeForData=function(s){return r.testNumeric(s)?e.NUMERIC:r.testAlphanumeric(s)?e.ALPHANUMERIC:r.testKanji(s)?e.KANJI:e.BYTE},e.toString=function(s){if(s&&s.id)return s.id;throw new Error("Invalid mode")},e.isValid=function(s){return s&&s.bit&&s.ccBits};function n(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+i)}}e.from=function(s,a){if(e.isValid(s))return s;try{return n(s)}catch{return a}}})(Jr)),Jr}var Ei;function vl(){return Ei||(Ei=1,(function(e){const t=Lt(),r=Us(),n=$n(),i=Dt(),s=qs(),a=7973,l=t.getBCHDigit(a);function o(d,_,y){for(let E=1;E<=40;E++)if(_<=e.getCapacity(E,y,d))return E}function u(d,_){return i.getCharCountIndicator(d,_)+4}function c(d,_){let y=0;return d.forEach(function(E){const b=u(E.mode,_);y+=b+E.getBitsLength()}),y}function v(d,_){for(let y=1;y<=40;y++)if(c(d,y)<=e.getCapacity(y,_,i.MIXED))return y}e.from=function(_,y){return s.isValid(_)?parseInt(_,10):y},e.getCapacity=function(_,y,E){if(!s.isValid(_))throw new Error("Invalid QR Code version");typeof E>"u"&&(E=i.BYTE);const b=t.getSymbolTotalCodewords(_),g=r.getTotalCodewordsCount(_,y),T=(b-g)*8;if(E===i.MIXED)return T;const C=T-u(E,_);switch(E){case i.NUMERIC:return Math.floor(C/10*3);case i.ALPHANUMERIC:return Math.floor(C/11*2);case i.KANJI:return Math.floor(C/13);case i.BYTE:default:return Math.floor(C/8)}},e.getBestVersionForData=function(_,y){let E;const b=n.from(y,n.M);if(Array.isArray(_)){if(_.length>1)return v(_,b);if(_.length===0)return 1;E=_[0]}else E=_;return o(E.mode,E.getLength(),b)},e.getEncodedBits=function(_){if(!s.isValid(_)||_<7)throw new Error("Invalid QR Code version");let y=_<<12;for(;t.getBCHDigit(y)-l>=0;)y^=a<<t.getBCHDigit(y)-l;return _<<12|y}})(Yr)),Yr}var Qr={},Ci;function hl(){if(Ci)return Qr;Ci=1;const e=Lt(),t=1335,r=21522,n=e.getBCHDigit(t);return Qr.getEncodedBits=function(s,a){const l=s.bit<<3|a;let o=l<<10;for(;e.getBCHDigit(o)-n>=0;)o^=t<<e.getBCHDigit(o)-n;return(l<<10|o)^r},Qr}var Wr={},Xr,ki;function pl(){if(ki)return Xr;ki=1;const e=Dt();function t(r){this.mode=e.NUMERIC,this.data=r.toString()}return t.getBitsLength=function(n){return 10*Math.floor(n/3)+(n%3?n%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(n){let i,s,a;for(i=0;i+3<=this.data.length;i+=3)s=this.data.substr(i,3),a=parseInt(s,10),n.put(a,10);const l=this.data.length-i;l>0&&(s=this.data.substr(i),a=parseInt(s,10),n.put(a,l*3+1))},Xr=t,Xr}var Zr,Si;function gl(){if(Si)return Zr;Si=1;const e=Dt(),t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function r(n){this.mode=e.ALPHANUMERIC,this.data=n}return r.getBitsLength=function(i){return 11*Math.floor(i/2)+6*(i%2)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(i){let s;for(s=0;s+2<=this.data.length;s+=2){let a=t.indexOf(this.data[s])*45;a+=t.indexOf(this.data[s+1]),i.put(a,11)}this.data.length%2&&i.put(t.indexOf(this.data[s]),6)},Zr=r,Zr}var en,Ti;function _l(){if(Ti)return en;Ti=1;const e=Dt();function t(r){this.mode=e.BYTE,typeof r=="string"?this.data=new TextEncoder().encode(r):this.data=new Uint8Array(r)}return t.getBitsLength=function(n){return n*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(r){for(let n=0,i=this.data.length;n<i;n++)r.put(this.data[n],8)},en=t,en}var tn,Ai;function ml(){if(Ai)return tn;Ai=1;const e=Dt(),t=Lt();function r(n){this.mode=e.KANJI,this.data=n}return r.getBitsLength=function(i){return i*13},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(n){let i;for(i=0;i<this.data.length;i++){let s=t.toSJIS(this.data[i]);if(s>=33088&&s<=40956)s-=33088;else if(s>=57408&&s<=60351)s-=49472;else throw new Error("Invalid SJIS character: "+this.data[i]+`
|
|
4
|
+
Make sure your charset is UTF-8`);s=(s>>>8&255)*192+(s&255),n.put(s,13)}},tn=r,tn}var rn={exports:{}},Ii;function yl(){return Ii||(Ii=1,(function(e){var t={single_source_shortest_paths:function(r,n,i){var s={},a={};a[n]=0;var l=t.PriorityQueue.make();l.push(n,0);for(var o,u,c,v,d,_,y,E,b;!l.empty();){o=l.pop(),u=o.value,v=o.cost,d=r[u]||{};for(c in d)d.hasOwnProperty(c)&&(_=d[c],y=v+_,E=a[c],b=typeof a[c]>"u",(b||E>y)&&(a[c]=y,l.push(c,y),s[c]=u))}if(typeof i<"u"&&typeof a[i]>"u"){var g=["Could not find a path from ",n," to ",i,"."].join("");throw new Error(g)}return s},extract_shortest_path_from_predecessor_list:function(r,n){for(var i=[],s=n;s;)i.push(s),r[s],s=r[s];return i.reverse(),i},find_path:function(r,n,i){var s=t.single_source_shortest_paths(r,n,i);return t.extract_shortest_path_from_predecessor_list(s,i)},PriorityQueue:{make:function(r){var n=t.PriorityQueue,i={},s;r=r||{};for(s in n)n.hasOwnProperty(s)&&(i[s]=n[s]);return i.queue=[],i.sorter=r.sorter||n.default_sorter,i},default_sorter:function(r,n){return r.cost-n.cost},push:function(r,n){var i={value:r,cost:n};this.queue.push(i),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(rn)),rn.exports}var Ri;function bl(){return Ri||(Ri=1,(function(e){const t=Dt(),r=pl(),n=gl(),i=_l(),s=ml(),a=Fs(),l=Lt(),o=yl();function u(g){return unescape(encodeURIComponent(g)).length}function c(g,T,C){const I=[];let x;for(;(x=g.exec(C))!==null;)I.push({data:x[0],index:x.index,mode:T,length:x[0].length});return I}function v(g){const T=c(a.NUMERIC,t.NUMERIC,g),C=c(a.ALPHANUMERIC,t.ALPHANUMERIC,g);let I,x;return l.isKanjiModeEnabled()?(I=c(a.BYTE,t.BYTE,g),x=c(a.KANJI,t.KANJI,g)):(I=c(a.BYTE_KANJI,t.BYTE,g),x=[]),T.concat(C,I,x).sort(function(A,M){return A.index-M.index}).map(function(A){return{data:A.data,mode:A.mode,length:A.length}})}function d(g,T){switch(T){case t.NUMERIC:return r.getBitsLength(g);case t.ALPHANUMERIC:return n.getBitsLength(g);case t.KANJI:return s.getBitsLength(g);case t.BYTE:return i.getBitsLength(g)}}function _(g){return g.reduce(function(T,C){const I=T.length-1>=0?T[T.length-1]:null;return I&&I.mode===C.mode?(T[T.length-1].data+=C.data,T):(T.push(C),T)},[])}function y(g){const T=[];for(let C=0;C<g.length;C++){const I=g[C];switch(I.mode){case t.NUMERIC:T.push([I,{data:I.data,mode:t.ALPHANUMERIC,length:I.length},{data:I.data,mode:t.BYTE,length:I.length}]);break;case t.ALPHANUMERIC:T.push([I,{data:I.data,mode:t.BYTE,length:I.length}]);break;case t.KANJI:T.push([I,{data:I.data,mode:t.BYTE,length:u(I.data)}]);break;case t.BYTE:T.push([{data:I.data,mode:t.BYTE,length:u(I.data)}])}}return T}function E(g,T){const C={},I={start:{}};let x=["start"];for(let k=0;k<g.length;k++){const A=g[k],M=[];for(let N=0;N<A.length;N++){const P=A[N],S=""+k+N;M.push(S),C[S]={node:P,lastCount:0},I[S]={};for(let m=0;m<x.length;m++){const w=x[m];C[w]&&C[w].node.mode===P.mode?(I[w][S]=d(C[w].lastCount+P.length,P.mode)-d(C[w].lastCount,P.mode),C[w].lastCount+=P.length):(C[w]&&(C[w].lastCount=P.length),I[w][S]=d(P.length,P.mode)+4+t.getCharCountIndicator(P.mode,T))}}x=M}for(let k=0;k<x.length;k++)I[x[k]].end=0;return{map:I,table:C}}function b(g,T){let C;const I=t.getBestModeForData(g);if(C=t.from(T,I),C!==t.BYTE&&C.bit<I.bit)throw new Error('"'+g+'" cannot be encoded with mode '+t.toString(C)+`.
|
|
5
|
+
Suggested mode is: `+t.toString(I));switch(C===t.KANJI&&!l.isKanjiModeEnabled()&&(C=t.BYTE),C){case t.NUMERIC:return new r(g);case t.ALPHANUMERIC:return new n(g);case t.KANJI:return new s(g);case t.BYTE:return new i(g)}}e.fromArray=function(T){return T.reduce(function(C,I){return typeof I=="string"?C.push(b(I,null)):I.data&&C.push(b(I.data,I.mode)),C},[])},e.fromString=function(T,C){const I=v(T,l.isKanjiModeEnabled()),x=y(I),k=E(x,C),A=o.find_path(k.map,"start","end"),M=[];for(let N=1;N<A.length-1;N++)M.push(k.table[A[N]].node);return e.fromArray(_(M))},e.rawSplit=function(T){return e.fromArray(v(T,l.isKanjiModeEnabled()))}})(Wr)),Wr}var Mi;function wl(){if(Mi)return qr;Mi=1;const e=Lt(),t=$n(),r=sl(),n=al(),i=ol(),s=ll(),a=ul(),l=Us(),o=dl(),u=vl(),c=hl(),v=Dt(),d=bl();function _(k,A){const M=k.size,N=s.getPositions(A);for(let P=0;P<N.length;P++){const S=N[P][0],m=N[P][1];for(let w=-1;w<=7;w++)if(!(S+w<=-1||M<=S+w))for(let R=-1;R<=7;R++)m+R<=-1||M<=m+R||(w>=0&&w<=6&&(R===0||R===6)||R>=0&&R<=6&&(w===0||w===6)||w>=2&&w<=4&&R>=2&&R<=4?k.set(S+w,m+R,!0,!0):k.set(S+w,m+R,!1,!0))}}function y(k){const A=k.size;for(let M=8;M<A-8;M++){const N=M%2===0;k.set(M,6,N,!0),k.set(6,M,N,!0)}}function E(k,A){const M=i.getPositions(A);for(let N=0;N<M.length;N++){const P=M[N][0],S=M[N][1];for(let m=-2;m<=2;m++)for(let w=-2;w<=2;w++)m===-2||m===2||w===-2||w===2||m===0&&w===0?k.set(P+m,S+w,!0,!0):k.set(P+m,S+w,!1,!0)}}function b(k,A){const M=k.size,N=u.getEncodedBits(A);let P,S,m;for(let w=0;w<18;w++)P=Math.floor(w/3),S=w%3+M-8-3,m=(N>>w&1)===1,k.set(P,S,m,!0),k.set(S,P,m,!0)}function g(k,A,M){const N=k.size,P=c.getEncodedBits(A,M);let S,m;for(S=0;S<15;S++)m=(P>>S&1)===1,S<6?k.set(S,8,m,!0):S<8?k.set(S+1,8,m,!0):k.set(N-15+S,8,m,!0),S<8?k.set(8,N-S-1,m,!0):S<9?k.set(8,15-S-1+1,m,!0):k.set(8,15-S-1,m,!0);k.set(N-8,8,1,!0)}function T(k,A){const M=k.size;let N=-1,P=M-1,S=7,m=0;for(let w=M-1;w>0;w-=2)for(w===6&&w--;;){for(let R=0;R<2;R++)if(!k.isReserved(P,w-R)){let j=!1;m<A.length&&(j=(A[m]>>>S&1)===1),k.set(P,w-R,j),S--,S===-1&&(m++,S=7)}if(P+=N,P<0||M<=P){P-=N,N=-N;break}}}function C(k,A,M){const N=new r;M.forEach(function(R){N.put(R.mode.bit,4),N.put(R.getLength(),v.getCharCountIndicator(R.mode,k)),R.write(N)});const P=e.getSymbolTotalCodewords(k),S=l.getTotalCodewordsCount(k,A),m=(P-S)*8;for(N.getLengthInBits()+4<=m&&N.put(0,4);N.getLengthInBits()%8!==0;)N.putBit(0);const w=(m-N.getLengthInBits())/8;for(let R=0;R<w;R++)N.put(R%2?17:236,8);return I(N,k,A)}function I(k,A,M){const N=e.getSymbolTotalCodewords(A),P=l.getTotalCodewordsCount(A,M),S=N-P,m=l.getBlocksCount(A,M),w=N%m,R=m-w,j=Math.floor(N/m),K=Math.floor(S/m),se=K+1,Z=j-K,ee=new o(Z);let te=0;const ae=new Array(m),ce=new Array(m);let $=0;const oe=new Uint8Array(k.buffer);for(let ne=0;ne<m;ne++){const Me=ne<R?K:se;ae[ne]=oe.slice(te,te+Me),ce[ne]=ee.encode(ae[ne]),te+=Me,$=Math.max($,Me)}const Q=new Uint8Array(N);let pe=0,re,Y;for(re=0;re<$;re++)for(Y=0;Y<m;Y++)re<ae[Y].length&&(Q[pe++]=ae[Y][re]);for(re=0;re<Z;re++)for(Y=0;Y<m;Y++)Q[pe++]=ce[Y][re];return Q}function x(k,A,M,N){let P;if(Array.isArray(k))P=d.fromArray(k);else if(typeof k=="string"){let j=A;if(!j){const K=d.rawSplit(k);j=u.getBestVersionForData(K,M)}P=d.fromString(k,j||40)}else throw new Error("Invalid data");const S=u.getBestVersionForData(P,M);if(!S)throw new Error("The amount of data is too big to be stored in a QR Code");if(!A)A=S;else if(A<S)throw new Error(`
|
|
6
|
+
The chosen QR Code version cannot contain this amount of data.
|
|
7
|
+
Minimum version required to store current data is: `+S+`.
|
|
8
|
+
`);const m=C(A,M,P),w=e.getSymbolSize(A),R=new n(w);return _(R,A),y(R),E(R,A),g(R,M,0),A>=7&&b(R,A),T(R,m),isNaN(N)&&(N=a.getBestMask(R,g.bind(null,R,M))),a.applyMask(N,R),g(R,M,N),{modules:R,version:A,errorCorrectionLevel:M,maskPattern:N,segments:P}}return qr.create=function(A,M){if(typeof A>"u"||A==="")throw new Error("No input text");let N=t.M,P,S;return typeof M<"u"&&(N=t.from(M.errorCorrectionLevel,t.M),P=u.from(M.version),S=a.from(M.maskPattern),M.toSJISFunc&&e.setToSJISFunction(M.toSJISFunc)),x(A,P,N,S)},qr}var nn={},sn={},Ni;function Os(){return Ni||(Ni=1,(function(e){function t(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let n=r.slice().replace("#","").split("");if(n.length<3||n.length===5||n.length>8)throw new Error("Invalid hex color: "+r);(n.length===3||n.length===4)&&(n=Array.prototype.concat.apply([],n.map(function(s){return[s,s]}))),n.length===6&&n.push("F","F");const i=parseInt(n.join(""),16);return{r:i>>24&255,g:i>>16&255,b:i>>8&255,a:i&255,hex:"#"+n.slice(0,6).join("")}}e.getOptions=function(n){n||(n={}),n.color||(n.color={});const i=typeof n.margin>"u"||n.margin===null||n.margin<0?4:n.margin,s=n.width&&n.width>=21?n.width:void 0,a=n.scale||4;return{width:s,scale:s?4:a,margin:i,color:{dark:t(n.color.dark||"#000000ff"),light:t(n.color.light||"#ffffffff")},type:n.type,rendererOpts:n.rendererOpts||{}}},e.getScale=function(n,i){return i.width&&i.width>=n+i.margin*2?i.width/(n+i.margin*2):i.scale},e.getImageWidth=function(n,i){const s=e.getScale(n,i);return Math.floor((n+i.margin*2)*s)},e.qrToImageData=function(n,i,s){const a=i.modules.size,l=i.modules.data,o=e.getScale(a,s),u=Math.floor((a+s.margin*2)*o),c=s.margin*o,v=[s.color.light,s.color.dark];for(let d=0;d<u;d++)for(let _=0;_<u;_++){let y=(d*u+_)*4,E=s.color.light;if(d>=c&&_>=c&&d<u-c&&_<u-c){const b=Math.floor((d-c)/o),g=Math.floor((_-c)/o);E=v[l[b*a+g]?1:0]}n[y++]=E.r,n[y++]=E.g,n[y++]=E.b,n[y]=E.a}}})(sn)),sn}var Pi;function El(){return Pi||(Pi=1,(function(e){const t=Os();function r(i,s,a){i.clearRect(0,0,s.width,s.height),s.style||(s.style={}),s.height=a,s.width=a,s.style.height=a+"px",s.style.width=a+"px"}function n(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(s,a,l){let o=l,u=a;typeof o>"u"&&(!a||!a.getContext)&&(o=a,a=void 0),a||(u=n()),o=t.getOptions(o);const c=t.getImageWidth(s.modules.size,o),v=u.getContext("2d"),d=v.createImageData(c,c);return t.qrToImageData(d.data,s,o),r(v,u,c),v.putImageData(d,0,0),u},e.renderToDataURL=function(s,a,l){let o=l;typeof o>"u"&&(!a||!a.getContext)&&(o=a,a=void 0),o||(o={});const u=e.render(s,a,o),c=o.type||"image/png",v=o.rendererOpts||{};return u.toDataURL(c,v.quality)}})(nn)),nn}var an={},xi;function Cl(){if(xi)return an;xi=1;const e=Os();function t(i,s){const a=i.a/255,l=s+'="'+i.hex+'"';return a<1?l+" "+s+'-opacity="'+a.toFixed(2).slice(1)+'"':l}function r(i,s,a){let l=i+s;return typeof a<"u"&&(l+=" "+a),l}function n(i,s,a){let l="",o=0,u=!1,c=0;for(let v=0;v<i.length;v++){const d=Math.floor(v%s),_=Math.floor(v/s);!d&&!u&&(u=!0),i[v]?(c++,v>0&&d>0&&i[v-1]||(l+=u?r("M",d+a,.5+_+a):r("m",o,0),o=0,u=!1),d+1<s&&i[v+1]||(l+=r("h",c),c=0)):o++}return l}return an.render=function(s,a,l){const o=e.getOptions(a),u=s.modules.size,c=s.modules.data,v=u+o.margin*2,d=o.color.light.a?"<path "+t(o.color.light,"fill")+' d="M0 0h'+v+"v"+v+'H0z"/>':"",_="<path "+t(o.color.dark,"stroke")+' d="'+n(c,u,o.margin)+'"/>',y='viewBox="0 0 '+v+" "+v+'"',b='<svg xmlns="http://www.w3.org/2000/svg" '+(o.width?'width="'+o.width+'" height="'+o.width+'" ':"")+y+' shape-rendering="crispEdges">'+d+_+`</svg>
|
|
9
|
+
`;return typeof l=="function"&&l(null,b),b},an}var Bi;function kl(){if(Bi)return qt;Bi=1;const e=il(),t=wl(),r=El(),n=Cl();function i(s,a,l,o,u){const c=[].slice.call(arguments,1),v=c.length,d=typeof c[v-1]=="function";if(!d&&!e())throw new Error("Callback required as last argument");if(d){if(v<2)throw new Error("Too few arguments provided");v===2?(u=l,l=a,a=o=void 0):v===3&&(a.getContext&&typeof u>"u"?(u=o,o=void 0):(u=o,o=l,l=a,a=void 0))}else{if(v<1)throw new Error("Too few arguments provided");return v===1?(l=a,a=o=void 0):v===2&&!a.getContext&&(o=l,l=a,a=void 0),new Promise(function(_,y){try{const E=t.create(l,o);_(s(E,a,o))}catch(E){y(E)}})}try{const _=t.create(l,o);u(null,s(_,a,o))}catch(_){u(_)}}return qt.create=t.create,qt.toCanvas=i.bind(null,r.render),qt.toDataURL=i.bind(null,r.renderToDataURL),qt.toString=i.bind(null,function(s,a,l){return n.render(s,l)}),qt}var Sl=kl();const Tl=nl(Sl);var Al=q('<p class="muted"> </p>'),Il=q('<div class="qr svelte-1uqetyj"></div>'),Rl=q('<div class="qr placeholder svelte-1uqetyj"></div>');function Ml(e,t){Ie(t,!0);let r=dt(t,"size",3,192),n=z(""),i=z(null);Nt(()=>{const c=t.value;if(!c){L(n,""),L(i,null);return}Tl.toString(c,{type:"svg",errorCorrectionLevel:"M",margin:1,width:r(),color:{dark:"#1d1f24",light:"#ffffff"}}).then(v=>{L(n,v,!0),L(i,null)}).catch(v=>{console.error("QR generation failed",v),L(i,v.message,!0)})});var s=hr(),a=we(s);{var l=c=>{var v=Al(),d=f(v);F(()=>B(d,`QR unavailable: ${h(i)??""}`)),D(c,v)},o=c=>{var v=Il();Co(v,()=>h(n),!0),F(()=>gn(v,`width: ${r()??""}px; height: ${r()??""}px;`)),D(c,v)},u=c=>{var v=Rl();F(()=>gn(v,`width: ${r()??""}px; height: ${r()??""}px;`)),D(c,v)};G(a,c=>{h(i)?c(l):h(n)?c(o,1):c(u,-1)})}D(e,s),Re()}var Nl=Cs('<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5" y="5" width="9" height="9" rx="1.5"></rect><path d="M11 3.5V3a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v7a1 1 0 0 0 1 1h.5"></path></svg>');function Sn(e,t){let r=dt(t,"size",3,16);var n=Nl();F(()=>{he(n,"width",r()),he(n,"height",r())}),D(e,n)}var Pl=q("<option> </option>"),xl=q(`<form class="stack"><div><label for="invite-label">Label</label> <input id="invite-label" type="text" placeholder="e.g. Mom's phone" required="" autocomplete="off"/></div> <div><label for="invite-ttl">Expires after</label> <select id="invite-ttl"></select></div> <div class="actions svelte-1d46kin"><button type="button">Cancel</button> <button type="submit" class="primary"> </button></div></form>`),Bl=q('<p class="muted small svelte-1d46kin"> </p>'),Ll=q('<p class="muted">Share this invite with the new device. It can be scanned as a QR or pasted as text.</p> <div class="qr-wrap svelte-1d46kin"><!></div> <div class="token svelte-1d46kin"><textarea readonly="" rows="3" class="svelte-1d46kin"></textarea> <button class="ghost svelte-1d46kin" type="button" aria-label="Copy invite"><!> Copy</button></div> <!> <div class="actions svelte-1d46kin"><button type="button">Create another</button> <button type="button" class="primary">Done</button></div>',1),Dl=q('<div class="backdrop svelte-1d46kin" role="presentation"></div> <div class="dialog svelte-1d46kin" role="dialog" aria-modal="true" aria-labelledby="invite-title" tabindex="-1"><h3 id="invite-title">Invite a friend</h3> <!></div>',1);function Ul(e,t){Ie(t,!0);const r=[{label:"15 minutes",value:900*1e3},{label:"1 hour",value:3600*1e3},{label:"24 hours",value:1440*60*1e3},{label:"7 days",value:10080*60*1e3},{label:"No expiry",value:0}];let n=z(""),i=z(1440*60*1e3),s=z(!1),a=z(null);function l(){L(n,""),L(i,1440*60*1e3),L(s,!1),L(a,null)}function o(){l(),t.onClose()}async function u(E){E.preventDefault();const b=h(n).trim();if(!b){X("error","Label is required");return}L(s,!0);try{const g={label:b};h(i)>0&&(g.ttlMs=h(i));const T=await Mr("/auth/invites",g);L(a,T,!0),X("success","Invite created"),$t()}catch(g){const T=g instanceof xe?g.code:"error",C=g instanceof Error?g.message:String(g);X("error",`Invite failed: ${C} (${T})`)}finally{L(s,!1)}}async function c(E){try{await navigator.clipboard.writeText(E),X("success","Copied to clipboard")}catch(b){X("error",`Copy failed: ${b.message}`)}}function v(E){E.key==="Escape"&&o()}var d=hr(),_=we(d);{var y=E=>{var b=Dl(),g=we(b),T=p(g,2),C=p(f(T),2);{var I=k=>{var A=xl(),M=f(A),N=p(f(M),2),P=p(M,2),S=p(f(P),2);gt(S,21,()=>r,K=>K.value,(K,se)=>{var Z=Pl(),ee=f(Z),te={};F(()=>{B(ee,h(se).label),te!==(te=h(se).value)&&(Z.value=(Z.__value=h(se).value)??"")}),D(K,Z)});var m=p(P,2),w=f(m),R=p(w,2),j=f(R);F(()=>{w.disabled=h(s),R.disabled=h(s),B(j,h(s)?"Creating…":"Create invite")}),Er("submit",A,u),Cr(N,()=>h(n),K=>L(n,K)),Ts(S,()=>h(i),K=>L(i,K)),le("click",w,o),D(k,A)},x=k=>{var A=Ll(),M=p(we(A),2),N=f(M);Ml(N,{get value(){return h(a).encodedInvite},size:224});var P=p(M,2),S=f(P),m=p(S,2),w=f(m);Sn(w,{});var R=p(P,2);{var j=ee=>{var te=Bl(),ae=f(te);F(ce=>B(ae,`Expires ${ce??""}`),[()=>new Date(h(a).expiresAt).toLocaleString()]),D(ee,te)};G(R,ee=>{h(a).expiresAt&&ee(j)})}var K=p(R,2),se=f(K),Z=p(se,2);F(()=>As(S,h(a).encodedInvite)),le("click",m,()=>c(h(a).encodedInvite)),le("click",se,()=>L(a,null)),le("click",Z,o),D(k,A)};G(C,k=>{h(a)?k(x,-1):k(I)})}le("click",g,o),le("keydown",T,v),D(E,b)};G(_,E=>{t.open&&E(y)})}D(e,d),Re()}_t(["click","keydown"]);var ql=q('<p class="muted">No members yet. Use “Invite a friend” to add one.</p>'),Fl=q('<span class="badge info">This device</span>'),Ol=q('<button class="danger">Remove</button>'),$l=q('<li class="svelte-3alf51"><div class="member-main svelte-3alf51"><div><span class="member-label svelte-3alf51"> </span> <!></div> <div class="muted small svelte-3alf51"><code> </code> </div></div> <!></li>'),zl=q('<ul class="list svelte-3alf51"></ul>'),jl=q('<p class="muted">No outstanding invites.</p>'),Vl=q('<li class="svelte-3alf51"><div class="member-main svelte-3alf51"><div><span class="member-label svelte-3alf51"> </span></div> <div class="muted small svelte-3alf51"> <!></div></div> <button>Revoke</button></li>'),Hl=q('<ul class="list svelte-3alf51"></ul>'),Kl=q('<section class="stack"><header class="page-header svelte-3alf51"><div><h2>Trust Circle</h2> <p class="muted">Devices authorised to participate in your cadre.</p></div> <button class="primary">Invite a friend</button></header> <div class="card"><h3> </h3> <!></div> <div class="card"><h3> </h3> <!></div></section> <!> <!> <!>',1);function Yl(e,t){Ie(t,!0);const r=yt();let n=z(!1),i=z(null),s=z(null);mt(()=>{$t()});async function a(){const S=h(i);if(S)try{await ii(`/auth/members/${encodeURIComponent(S.peerId)}`),X("success",`Removed ${S.label||Tr(S.peerId)}`),await $t()}catch(m){const w=m instanceof xe?m.code:"error",R=m instanceof Error?m.message:String(m);X("error",`Remove failed: ${R} (${w})`)}finally{L(i,null)}}async function l(){const S=h(s);if(S)try{await ii(`/auth/invites/${encodeURIComponent(S.token)}`),X("success",`Revoked invite for ${S.label}`),await $t()}catch(m){const w=m instanceof xe?m.code:"error",R=m instanceof Error?m.message:String(m);X("error",`Revoke failed: ${R} (${w})`)}finally{L(s,null)}}var o=Kl(),u=we(o),c=f(u),v=p(f(c),2),d=p(c,2),_=f(d),y=f(_),E=p(_,2);{var b=S=>{var m=ql();D(S,m)},g=S=>{var m=zl();gt(m,21,()=>r.trustCircle.members,w=>w.peerId,(w,R)=>{var j=$l(),K=f(j),se=f(K),Z=f(se),ee=f(Z),te=p(Z,2);{var ae=Y=>{var ne=Fl();D(Y,ne)};G(te,Y=>{h(R).self&&Y(ae)})}var ce=p(se,2),$=f(ce),oe=f($),Q=p($),pe=p(K,2);{var re=Y=>{var ne=Ol();F(()=>he(ne,"aria-label",`Remove ${h(R).label||h(R).peerId}`)),le("click",ne,()=>L(i,h(R),!0)),D(Y,ne)};G(pe,Y=>{h(R).self||Y(re)})}F((Y,ne)=>{B(ee,h(R).label||"Unnamed"),he($,"title",h(R).peerId),B(oe,Y),B(Q,` · added ${ne??""}`)},[()=>Tr(h(R).peerId),()=>je(h(R).addedAt)]),D(w,j)}),D(S,m)};G(E,S=>{r.trustCircle.members.length===0?S(b):S(g,-1)})}var T=p(d,2),C=f(T),I=f(C),x=p(C,2);{var k=S=>{var m=jl();D(S,m)},A=S=>{var m=Hl();gt(m,21,()=>r.trustCircle.pending,w=>w.token,(w,R)=>{var j=Vl(),K=f(j),se=f(K),Z=f(se),ee=f(Z),te=p(se,2),ae=f(te),ce=p(ae);{var $=Q=>{var pe=po();F(re=>B(pe,`· expires ${re??""}`),[()=>je(h(R).expiresAt)]),D(Q,pe)};G(ce,Q=>{h(R).expiresAt&&Q($)})}var oe=p(K,2);F(Q=>{B(ee,h(R).label),B(ae,`issued ${Q??""} `)},[()=>je(h(R).createdAt)]),le("click",oe,()=>L(s,h(R),!0)),D(w,j)}),D(S,m)};G(x,S=>{r.trustCircle.pending.length===0?S(k):S(A,-1)})}var M=p(u,2);Ul(M,{get open(){return h(n)},onClose:()=>L(n,!1)});var N=p(M,2);{let S=_e(()=>h(i)!==null),m=_e(()=>`Remove ${h(i)?.label||"this device"} from your trust circle? This cannot be undone — they will lose access to your cadre.`);kn(N,{get open(){return h(S)},title:"Remove member",get message(){return h(m)},confirmLabel:"Remove",danger:!0,onConfirm:a,onCancel:()=>L(i,null)})}var P=p(N,2);{let S=_e(()=>h(s)!==null),m=_e(()=>`Revoke the invite for ${h(s)?.label??"this invite"}? It will no longer be redeemable.`);kn(P,{get open(){return h(S)},title:"Revoke invite",get message(){return h(m)},confirmLabel:"Revoke",danger:!0,onConfirm:l,onCancel:()=>L(s,null)})}F(()=>{B(y,`Members (${r.trustCircle.members.length??""})`),B(I,`Pending invites (${r.trustCircle.pending.length??""})`)}),le("click",v,()=>L(n,!0)),D(e,o),Re()}_t(["click"]);var Jl=q('<!> <dl class="kv svelte-hh3bto"><div class="svelte-hh3bto"><dt class="svelte-hh3bto">External IP</dt><dd class="svelte-hh3bto"> </dd></div> <div class="svelte-hh3bto"><dt class="svelte-hh3bto">Router IP</dt><dd class="svelte-hh3bto"> </dd></div> <div class="svelte-hh3bto"><dt class="svelte-hh3bto">External port</dt><dd class="svelte-hh3bto"> </dd></div> <div class="svelte-hh3bto"><dt class="svelte-hh3bto">Internal port</dt><dd class="svelte-hh3bto"> </dd></div> <div class="svelte-hh3bto"><dt class="svelte-hh3bto">Last tested</dt><dd class="svelte-hh3bto"> </dd></div> <div class="svelte-hh3bto"><dt class="svelte-hh3bto">External IP detected</dt><dd class="svelte-hh3bto"> </dd></div></dl> <button> </button>',1),Gl=q('<p class="muted">Loading…</p>'),Ql=q(`<p>Your ISP is using Carrier-Grade NAT (CGNAT). You'll need to either:</p> <ul class="svelte-hh3bto"><li>Ask your ISP for a public IP.</li> <li>Use a relay / tunnel (e.g. Cloudflare Tunnel, Tailscale Funnel).</li></ul>`,1),Wl=q(`<p>Your cadre isn't reachable from the open internet. The most likely causes:</p> <ul class="svelte-hh3bto"><li> </li> <li> </li></ul>`,1),Xl=q('<div class="card warning svelte-hh3bto"><h3>Manual fix</h3> <!> <p class="muted small svelte-hh3bto">See <a href="https://github.com/gotchoices/sereus/blob/master/docs/cadre-host.md" target="_blank" rel="noreferrer">docs/cadre-host.md</a> for vendor-specific router instructions.</p></div>'),Zl=q("<option> </option>"),eu=q('<span class="muted small svelte-hh3bto">(stored in OS keychain)</span>'),tu=q('<div><label> <!></label> <input autocomplete="off"/></div>'),ru=q('<p class="muted small svelte-hh3bto"> </p>'),nu=q(`<section class="stack"><header><h2>Connectivity</h2> <p class="muted">How the outside world reaches your cadre.</p></header> <div class="grid two svelte-hh3bto"><div class="card status-card"><h3>Current status</h3> <!></div> <!></div> <form class="card stack"><h3>Port forwarding</h3> <label class="row inline svelte-hh3bto"><input type="checkbox" class="svelte-hh3bto"/> <span>Attempt UPnP / NAT-PMP automatically</span></label> <div><label for="external-port">External port</label> <input id="external-port" type="number" min="1" max="65535"/></div> <div class="actions svelte-hh3bto"><button type="submit" class="primary"> </button></div></form> <form class="card stack"><h3>Dynamic DNS</h3> <p class="muted">Publish a stable hostname so your friends don't need to track your IP.</p> <div><label for="ddns-provider">Provider</label> <select id="ddns-provider"><option>— none —</option><!></select></div> <div><label for="ddns-hostname">Hostname</label> <input id="ddns-hostname" type="text" placeholder="e.g. yourname.duckdns.org" autocomplete="off"/></div> <!> <label class="row inline svelte-hh3bto"><input type="checkbox" class="svelte-hh3bto"/> <span>I manage this DDNS record outside cadre-host (don't auto-update)</span></label> <div class="actions svelte-hh3bto"><button type="submit" class="primary"> </button></div> <!></form></section>`);function iu(e,t){Ie(t,!0);const r=yt();let n=z(Ye([])),i=z(""),s=z(""),a=z(!1),l=z(Ye({})),o=z(!0),u=z(4001),c=z(!1),v=z(!1),d=z(!1);const _=_e(()=>h(n).find(U=>U.id===h(i))??null),y=_e(()=>!!r.connectivity&&(r.connectivity.directReachability==="unreachable"||r.connectivity.portMode==="failed")),E=_e(()=>r.connectivity?.cgnatDetected===!0);mt(()=>{Ot(),b()}),Nt(()=>{const U=r.connectivity;U&&(h(i)===""&&U.ddns.providerId&&L(i,U.ddns.providerId,!0),h(s)===""&&U.ddns.hostname&&L(s,U.ddns.hostname,!0),L(a,U.ddns.externallyManaged,!0),L(u,U.externalPort,!0))});async function b(){try{const U=await qe("/nat/providers");L(n,U,!0)}catch(U){X("error",`Could not load DDNS providers: ${U.message}`)}}async function g(){L(c,!0);try{await Mr("/nat/test"),X("success","Reachability test complete"),await Ot()}catch(U){X("error",`Test failed: ${U.message}`)}finally{L(c,!1)}}async function T(U){U.preventDefault(),L(v,!0);try{await mn("/nat/ddns",{providerId:h(i),hostname:h(s),config:{...h(l)},externallyManaged:h(a)}),X("success","DDNS settings saved"),L(l,{},!0),await Ot()}catch(J){const ie=J instanceof xe?J.code:"error";X("error",`Save failed: ${J.message} (${ie})`)}finally{L(v,!1)}}async function C(U){U.preventDefault(),L(d,!0);try{await mn("/nat/settings",{upnpEnabled:h(o),externalPort:h(u)}),X("success","Port settings saved"),await Ot()}catch(J){X("error",`Save failed: ${J.message}`)}finally{L(d,!1)}}var I=nu(),x=p(f(I),2),k=f(x),A=p(f(k),2);{var M=U=>{var J=Jl(),ie=we(J);Ds(ie,{get reachability(){return r.connectivity.directReachability},get portMode(){return r.connectivity.portMode}});var ve=p(ie,2),fe=f(ve),be=p(f(fe)),ke=f(be),et=p(fe,2),Ut=p(f(et)),Xt=f(Ut),tt=p(et,2),rt=p(f(tt)),Nr=f(rt),zn=p(tt,2),zs=p(f(zn)),js=f(zs),jn=p(zn,2),Vs=p(f(jn)),Hs=f(Vs),Ks=p(jn,2),Ys=p(f(Ks)),Js=f(Ys),Pr=p(ve,2),Gs=f(Pr);F((Qs,Ws)=>{B(ke,r.connectivity.externalIp??"—"),B(Xt,r.connectivity.routerExternalIp??"—"),B(Nr,r.connectivity.externalPort),B(js,r.connectivity.internalPort),B(Hs,Qs),B(Js,Ws),Pr.disabled=h(c),B(Gs,h(c)?"Testing…":"Test reachability")},[()=>je(r.connectivity.lastTestedAt),()=>je(r.connectivity.externalIpDetectedAt)]),le("click",Pr,g),D(U,J)},N=U=>{var J=Gl();D(U,J)};G(A,U=>{r.connectivity?U(M):U(N,-1)})}var P=p(k,2);{var S=U=>{var J=Xl(),ie=p(f(J),2);{var ve=be=>{var ke=Ql();D(be,ke)},fe=be=>{var ke=Wl(),et=p(we(ke),2),Ut=f(et),Xt=f(Ut),tt=p(Ut,2),rt=f(tt);F(()=>{B(Xt,`Your router doesn't allow UPnP / NAT-PMP — open it and enable the feature, or set up a manual port-forward for port ${r.connectivity?.externalPort??""}.`),B(rt,`A firewall on this machine is blocking inbound TCP on port ${r.connectivity?.internalPort??""}.`)}),D(be,ke)};G(ie,be=>{h(E)?be(ve):be(fe,-1)})}D(U,J)};G(P,U=>{(h(y)||h(E))&&U(S)})}var m=p(x,2),w=p(f(m),2),R=f(w),j=p(w,2),K=p(f(j),2),se=p(j,2),Z=f(se),ee=f(Z),te=p(m,2),ae=p(f(te),4),ce=p(f(ae),2),$=f(ce);$.value=$.__value="";var oe=p($);gt(oe,17,()=>h(n),U=>U.id,(U,J)=>{var ie=Zl(),ve=f(ie),fe={};F(()=>{B(ve,h(J).displayName),fe!==(fe=h(J).id)&&(ie.value=(ie.__value=h(J).id)??"")}),D(U,ie)});var Q=p(ae,2),pe=p(f(Q),2),re=p(Q,2);{var Y=U=>{var J=hr(),ie=we(J);gt(ie,17,()=>h(_).configFields,ve=>ve.key,(ve,fe)=>{var be=tu(),ke=f(be),et=f(ke),Ut=p(et);{var Xt=rt=>{var Nr=eu();D(rt,Nr)};G(Ut,rt=>{h(fe).secret&&rt(Xt)})}var tt=p(ke,2);F(()=>{he(ke,"for",`ddns-${h(fe).key}`),B(et,`${h(fe).label??""} `),he(tt,"id",`ddns-${h(fe).key}`),he(tt,"type",h(fe).secret?"password":"text"),As(tt,h(l)[h(fe).key]??"")}),le("input",tt,rt=>L(l,{...h(l),[h(fe).key]:rt.currentTarget.value},!0)),D(ve,be)}),D(U,J)};G(re,U=>{h(_)&&U(Y)})}var ne=p(re,2),Me=f(ne),Ze=p(ne,2),at=f(Ze),Fe=f(at),bt=p(Ze,2);{var Oe=U=>{var J=ru(),ie=f(J);F(ve=>B(ie,`Last DDNS update ${ve??""}
|
|
10
|
+
${r.connectivity.ddns.lastUpdateOk===!0?"· ok":r.connectivity.ddns.lastUpdateOk===!1?`· failed: ${r.connectivity.ddns.lastError??"error"}`:""}`),[()=>je(r.connectivity.ddns.lastUpdateAt)]),D(U,J)};G(bt,U=>{r.connectivity?.ddns.lastUpdateAt&&U(Oe)})}F(()=>{Z.disabled=h(d),B(ee,h(d)?"Saving…":"Save port settings"),at.disabled=h(v)||h(i)==="",B(Fe,h(v)?"Saving…":"Save DDNS settings")}),Er("submit",m,C),_n(R,()=>h(o),U=>L(o,U)),Cr(K,()=>h(u),U=>L(u,U)),Er("submit",te,T),Ts(ce,()=>h(i),U=>L(i,U)),Cr(pe,()=>h(s),U=>L(s,U)),_n(Me,()=>h(a),U=>L(a,U)),D(e,I),Re()}_t(["click","input"]);var su=q(`<p class="muted">No managed nodes yet. cadre-host v1 doesn't auto-spawn nodes — they
|
|
11
|
+
come up once you complete an invite redemption.</p>`),au=q('<tr class="svelte-7tcksg"><td class="svelte-7tcksg"><code> </code></td><td class="svelte-7tcksg"> </td><td class="svelte-7tcksg"><span> </span></td><td class="svelte-7tcksg"><code> </code></td><td class="muted svelte-7tcksg"> </td><td class="svelte-7tcksg"><a>Details →</a></td></tr>'),ou=q('<table class="svelte-7tcksg"><thead><tr><th scope="col" class="svelte-7tcksg">ID</th><th scope="col" class="svelte-7tcksg">Profile</th><th scope="col" class="svelte-7tcksg">Status</th><th scope="col" class="svelte-7tcksg">Party</th><th scope="col" class="svelte-7tcksg">Spawned</th><th scope="col" class="svelte-7tcksg"></th></tr></thead><tbody></tbody></table>'),lu=q('<section class="stack"><header><h2>Nodes</h2> <p class="muted">Cadre nodes managed by this host.</p></header> <div class="card"><!></div></section>');function uu(e,t){Ie(t,!1);const r=yt();mt(()=>{Ns()}),On();var n=lu(),i=p(f(n),2),s=f(i);{var a=o=>{var u=su();D(o,u)},l=o=>{var u=ou(),c=p(f(u));gt(c,5,()=>r.nodes,v=>v.id,(v,d)=>{var _=au(),y=f(_),E=f(y),b=f(E),g=p(y),T=f(g),C=p(g),I=f(C),x=f(I),k=p(C),A=f(k),M=f(A),N=p(k),P=f(N),S=p(N),m=f(S);F((w,R,j)=>{B(b,h(d).id),B(T,h(d).profile),Bt(I,1,`badge ${h(d).status==="running"?"ok":"err"}`),B(x,h(d).status),he(A,"title",h(d).partyId),B(M,w),B(P,R),he(m,"href",j)},[()=>Tr(h(d).partyId),()=>je(h(d).spawnedAt),()=>kt("node-detail",{id:h(d).id})]),D(v,_)}),D(o,u)};G(s,o=>{r.nodes.length===0?o(a):o(l,-1)})}D(e,n),Re()}var cu=Cs('<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M13.5 8a5.5 5.5 0 1 1-1.6-3.9"></path><path d="M14 2v3h-3"></path></svg>');function fu(e,t){let r=dt(t,"size",3,16);var n=cu();F(()=>{he(n,"width",r()),he(n,"height",r())}),D(e,n)}var du=q('<span class="muted small svelte-15ufwrh"> </span>'),vu=q('<p class="muted"> </p>'),hu=q('<pre class="logs svelte-15ufwrh"> </pre>'),pu=q('<div class="card log-card svelte-15ufwrh"><div class="header svelte-15ufwrh"><h3>Recent logs</h3> <div class="row"><!> <button class="ghost svelte-15ufwrh" aria-label="Refresh logs"><!> Refresh</button></div></div> <!></div>');function gu(e,t){Ie(t,!0);let r=dt(t,"lines",3,200),n=z(Ye([])),i=z(!1),s=z(null);async function a(){if(t.nodeId){L(i,!0);try{const g=await qe(`/api/nodes/${encodeURIComponent(t.nodeId)}/logs?lines=${r()}`);L(n,g.lines,!0),L(s,new Date,!0)}catch(g){X("error",`Logs unavailable: ${g.message}`)}finally{L(i,!1)}}}Nt(()=>{a()});var l=pu(),o=f(l),u=p(f(o),2),c=f(u);{var v=g=>{var T=du(),C=f(T);F(I=>B(C,`as of ${I??""}`),[()=>h(s).toLocaleTimeString()]),D(g,T)};G(c,g=>{h(s)&&g(v)})}var d=p(c,2),_=f(d);fu(_,{});var y=p(o,2);{var E=g=>{var T=vu(),C=f(T);F(()=>B(C,h(i)?"Loading…":"No log lines yet.")),D(g,T)},b=g=>{var T=hu(),C=f(T);F(I=>B(C,I),[()=>h(n).join(`
|
|
12
|
+
`)]),D(g,T)};G(y,g=>{h(n).length===0?g(E):g(b,-1)})}F(()=>d.disabled=h(i)),le("click",d,a),D(e,l),Re()}_t(["click"]);var _u=q('<div class="card"><p class="muted"> </p></div>'),mu=q('<div class="card"><div class="page-header svelte-1eq4g96"><div><h2><code> </code></h2> <p class="muted"> <code> </code></p></div> <span> </span></div> <dl class="kv svelte-1eq4g96"><div class="svelte-1eq4g96"><dt class="svelte-1eq4g96">Workdir</dt><dd class="svelte-1eq4g96"><code> </code></dd></div> <div class="svelte-1eq4g96"><dt class="svelte-1eq4g96">Spawned</dt><dd class="svelte-1eq4g96"> </dd></div> <div class="svelte-1eq4g96"><dt class="svelte-1eq4g96">Ports</dt><dd class="svelte-1eq4g96"> </dd></div> <div class="svelte-1eq4g96"><dt class="svelte-1eq4g96">CPU</dt><dd class="svelte-1eq4g96"> </dd></div> <div class="svelte-1eq4g96"><dt class="svelte-1eq4g96">Memory (RSS)</dt><dd class="svelte-1eq4g96"> </dd></div></dl> <div class="actions svelte-1eq4g96"><button> </button> <button> </button> <button class="danger">Stop</button></div></div> <!>',1),yu=q('<section class="stack"><header class="row"><a class="back svelte-1eq4g96">← Back to nodes</a></header> <!></section> <!>',1);function bu(e,t){Ie(t,!0);const r=yt();let n=z(!1),i=z(null),s;const a=_e(()=>r.nodes.find(g=>g.id===t.id)??null),l=_e(()=>r.nodeStats[t.id]??null);mt(()=>{Dr(t.id),s=setInterval(()=>void Dr(t.id),5e3)}),xo(()=>{s&&clearInterval(s)});async function o(g){L(i,g,!0);try{await Mr(`/api/nodes/${encodeURIComponent(t.id)}/${g}`),X("success",`${g} requested`),await Dr(t.id)}catch(T){const C=T instanceof xe?T.code:"error",I=T instanceof Error?T.message:String(T);X("error",`${g} failed: ${I} (${C})`)}finally{L(i,null)}}var u=yu(),c=we(u),v=f(c),d=f(v),_=p(v,2);{var y=g=>{var T=_u(),C=f(T),I=f(C);F(()=>B(I,`Loading node ${t.id??""}…`)),D(g,T)},E=g=>{var T=mu(),C=we(T),I=f(C),x=f(I),k=f(x),A=f(k),M=f(A),N=p(k,2),P=f(N),S=p(P),m=f(S),w=p(x,2),R=f(w),j=p(I,2),K=f(j),se=p(f(K)),Z=f(se),ee=f(Z),te=p(K,2),ae=p(f(te)),ce=f(ae),$=p(te,2),oe=p(f($)),Q=f(oe),pe=p($,2),re=p(f(pe)),Y=f(re),ne=p(pe,2),Me=p(f(ne)),Ze=f(Me),at=p(j,2),Fe=f(at),bt=f(Fe),Oe=p(Fe,2),U=f(Oe),J=p(Oe,2),ie=p(C,2);gu(ie,{get nodeId(){return h(a).id}}),F((ve,fe,be,ke)=>{B(M,h(a).id),B(P,`${h(a).profile??""} · party `),he(S,"title",h(a).partyId),B(m,ve),Bt(w,1,`badge ${h(a).status==="running"?"ok":"err"}`,"svelte-1eq4g96"),B(R,h(a).status),B(ee,h(a).workdir||"—"),B(ce,fe),B(Q,`health ${h(a).ports.health??""} · metrics ${h(a).ports.metrics??""} · p2p ${h(a).ports.p2p??""}`),B(Y,be),B(Ze,ke),Fe.disabled=h(i)!==null||h(a).status==="running",B(bt,h(i)==="start"?"Starting…":"Start"),Oe.disabled=h(i)!==null||h(a).status==="running",B(U,h(i)==="restart"?"Restarting…":"Restart"),J.disabled=h(i)!==null||h(a).status!=="running"},[()=>Tr(h(a).partyId),()=>je(h(a).spawnedAt),()=>h(l)?h(l).cpu.toFixed(1)+"%":"—",()=>Ho(h(l)?.rssBytes)]),le("click",Fe,()=>o("start")),le("click",Oe,()=>o("restart")),le("click",J,()=>L(n,!0)),D(g,T)};G(_,g=>{h(a)?g(E,-1):g(y)})}var b=p(c,2);{let g=_e(()=>`Stop node ${t.id}? In-flight requests will be terminated.`);kn(b,{get open(){return h(n)},title:"Stop node",get message(){return h(g)},confirmLabel:"Stop",danger:!0,onConfirm:async()=>{L(n,!1),await o("stop")},onCancel:()=>L(n,!1)})}F(g=>he(d,"href",g),[()=>kt("nodes")]),D(e,u),Re()}_t(["click"]);var wu=q('<a target="_blank" rel="noreferrer">Release notes</a>'),Eu=q('<div class="banner info svelte-1cl3wo6"><div><strong>Update available</strong> <span class="muted"> </span> <!></div> <button type="button" class="primary"> </button></div>'),Cu=q('<p class="muted small svelte-1cl3wo6"> </p>'),ku=q('<p class="error small svelte-1cl3wo6"> </p>'),Su=q('<dl class="kv svelte-1cl3wo6"><div class="svelte-1cl3wo6"><dt class="svelte-1cl3wo6">Install ID</dt><dd class="svelte-1cl3wo6"><code> </code></dd></div> <div class="svelte-1cl3wo6"><dt class="svelte-1cl3wo6">Installed at</dt><dd class="svelte-1cl3wo6"> </dd></div> <div class="svelte-1cl3wo6"><dt class="svelte-1cl3wo6">Installer version</dt><dd class="svelte-1cl3wo6"> </dd></div> <div class="svelte-1cl3wo6"><dt class="svelte-1cl3wo6">UI port</dt><dd class="svelte-1cl3wo6"> </dd></div> <div class="svelte-1cl3wo6"><dt class="svelte-1cl3wo6">libp2p port</dt><dd class="svelte-1cl3wo6"> </dd></div> <div class="svelte-1cl3wo6"><dt class="svelte-1cl3wo6">Data dir</dt> <dd class="copy-row svelte-1cl3wo6"><code> </code> <button type="button" class="ghost" aria-label="Copy data dir"><!></button></dd></div> <div class="svelte-1cl3wo6"><dt class="svelte-1cl3wo6">Identity</dt> <dd class="copy-row svelte-1cl3wo6"><code> </code> <button type="button" class="ghost" aria-label="Copy identity path"><!></button></dd></div></dl> <p class="muted small svelte-1cl3wo6">UI port, libp2p port, and data dir are set at install time and can only be changed by editing <code>host.config.json</code> and restarting the service.</p>',1),Tu=q('<p class="muted">Loading…</p>'),Au=q(`<section class="stack"><header><h2>Settings</h2> <p class="muted">Update preferences and install metadata.</p></header> <form class="card stack"><h3>Updates</h3> <label class="row inline svelte-1cl3wo6"><input type="checkbox" class="svelte-1cl3wo6"/> <span>Apply updates automatically when available</span></label> <div><label for="manifest-url">Manifest URL (optional override)</label> <input id="manifest-url" type="url" placeholder="https://example.org/latest.json" autocomplete="off"/></div> <!> <!> <div class="actions svelte-1cl3wo6"><button type="submit" class="primary"> </button></div></form> <div class="card"><h3>Install</h3> <!></div> <div class="card"><h3>Uninstall</h3> <p class="muted">Stop the cadre-host service, then remove the data directory above and the
|
|
13
|
+
installed package:</p> <pre>npm uninstall -g @serfab/cadre-host</pre> <p class="muted small svelte-1cl3wo6">See the README under <a href="https://github.com/gotchoices/sereus/blob/master/packages/cadre-host/README.md" target="_blank" rel="noreferrer">Uninstall</a> for OS-specific service teardown.</p></div></section>`);function Iu(e,t){Ie(t,!0);const r=yt();let n=z(!1),i=z(""),s=z(!1),a=z(!1);mt(()=>{yn(),kr()}),Nt(()=>{const m=r.settings;m&&(L(n,m.updates.autoApply,!0),L(i,m.updates.manifestUrl??"",!0))});async function l(m){m.preventDefault(),L(s,!0);try{const w={updates:{autoApply:h(n)}};h(i).trim()&&(w.updates.manifestUrl=h(i).trim()),await mn("/api/settings",w),X("success","Update preferences saved"),await yn()}catch(w){const R=w instanceof xe?w.code:"error";X("error",`Save failed: ${w.message} (${R})`)}finally{L(s,!1)}}async function o(){L(a,!0);try{const m=await Mr("/update/apply");X("success",`Applied ${m.fromVersion} → ${m.toVersion}`+(m.restarted?" (service restarting)":"")),await kr()}catch(m){const w=m instanceof xe?m.code:"error";X("error",`Apply failed: ${m.message} (${w})`)}finally{L(a,!1)}}async function u(m){try{await navigator.clipboard.writeText(m),X("success","Copied")}catch(w){X("error",`Copy failed: ${w.message}`)}}var c=Au(),v=p(f(c),2),d=p(f(v),2),_=f(d),y=p(d,2),E=p(f(y),2),b=p(y,2);{var g=m=>{var w=Eu(),R=f(w),j=p(f(R),2),K=f(j),se=p(j,2);{var Z=ae=>{var ce=wu();F(()=>he(ce,"href",r.update.available.releaseNotesUrl)),D(ae,ce)};G(se,ae=>{r.update.available.releaseNotesUrl&&ae(Z)})}var ee=p(R,2),te=f(ee);F(()=>{B(K,`→ version ${r.update.available.version??""}`),ee.disabled=h(a),B(te,h(a)?"Applying…":"Apply now")}),le("click",ee,o),D(m,w)},T=m=>{var w=Cu(),R=f(w);F(j=>B(R,`No update available. Last checked ${j??""}.`),[()=>je(r.update.lastChecked)]),D(m,w)};G(b,m=>{r.update?.available?.version?m(g):r.update?.lastChecked&&m(T,1)})}var C=p(b,2);{var I=m=>{var w=ku(),R=f(w);F(()=>B(R,`Last error: ${r.update.lastError.message??""} (${r.update.lastError.code??""})`)),D(m,w)};G(C,m=>{r.update?.lastError&&m(I)})}var x=p(C,2),k=f(x),A=f(k),M=p(v,2),N=p(f(M),2);{var P=m=>{var w=Su(),R=we(w),j=f(R),K=p(f(j)),se=f(K),Z=f(se),ee=p(j,2),te=p(f(ee)),ae=f(te),ce=p(ee,2),$=p(f(ce)),oe=f($),Q=p(ce,2),pe=p(f(Q)),re=f(pe),Y=p(Q,2),ne=p(f(Y)),Me=f(ne),Ze=p(Y,2),at=p(f(Ze),2),Fe=f(at),bt=f(Fe),Oe=p(Fe,2),U=f(Oe);Sn(U,{});var J=p(Ze,2),ie=p(f(J),2),ve=f(ie),fe=f(ve),be=p(ve,2),ke=f(be);Sn(ke,{}),F(et=>{B(Z,r.settings.installId),B(ae,et),B(oe,r.settings.installerVersion??"—"),B(re,r.settings.uiPort),B(Me,r.settings.libp2pPort),B(bt,r.settings.dataDir),B(fe,r.settings.identityPath)},[()=>je(r.settings.installedAt)]),le("click",Oe,()=>u(r.settings.dataDir)),le("click",be,()=>u(r.settings.identityPath)),D(m,w)},S=m=>{var w=Tu();D(m,w)};G(N,m=>{r.settings?m(P):m(S,-1)})}F(()=>{k.disabled=h(s),B(A,h(s)?"Saving…":"Save update preferences")}),Er("submit",v,l),_n(_,()=>h(n),m=>L(n,m)),Cr(E,()=>h(i),m=>L(i,m)),D(e,c),Re()}_t(["click"]);var Ru=q('<div role="status"><span class="text svelte-g7yjw8"> </span> <button class="ghost svelte-g7yjw8" aria-label="Dismiss">×</button></div>'),Mu=q('<div class="toast-stack svelte-g7yjw8" aria-live="polite" aria-relevant="additions"></div>');function Nu(e,t){Ie(t,!1);const r=yt();On();var n=hr(),i=we(n);{var s=a=>{var l=Mu();gt(l,5,()=>r.toasts,o=>o.id,(o,u)=>{var c=Ru(),v=f(c),d=f(v),_=p(v,2);F(()=>{Bt(c,1,`toast toast-${h(u).kind??""}`,"svelte-g7yjw8"),B(d,h(u).text)}),le("click",_,()=>Rs(h(u).id)),D(o,c)}),D(a,l)};G(i,a=>{r.toasts.length>0&&a(s)})}D(e,n),Re()}_t(["click"]);var Pu=q("<a> </a>"),xu=q('<a class="visually-hidden" href="#main">Skip to content</a> <header class="topbar svelte-1r8vfx3"><div class="brand svelte-1r8vfx3"><span class="logo svelte-1r8vfx3" aria-hidden="true">●</span> <span>cadre-host</span> <!></div> <nav aria-label="Primary" class="svelte-1r8vfx3"></nav></header> <main id="main" class="svelte-1r8vfx3"><!></main> <!>',1);function Bu(e,t){Ie(t,!1);const r=Fo(),n=yt();function i(x){switch(x){case"ok":return"OK";case"warn":return"Attention";case"error":return"Error";default:return"…"}}const s=[{name:"home",label:"Home"},{name:"trust-circle",label:"Trust Circle"},{name:"connectivity",label:"Connectivity"},{name:"nodes",label:"Nodes"},{name:"settings",label:"Settings"}];function a(x){return x==="nodes"?r.route.name==="nodes"||r.route.name==="node-detail":r.route.name===x}mt(()=>{Oo(),Ms(),Ns(),$t(),Ot(),kr(),yn();let x=!0;const k=Vo(A=>qo(A),{onError(A,M){x&&(x=!1,X("error",`Lost realtime updates; retrying in ${Math.round(M/1e3)}s`))},onOpen(){x=!0}});return()=>{k.close(),$o()}}),On();var l=xu(),o=p(we(l),2),u=f(o),c=p(f(u),4);{let x=wr(()=>i(n.status));Ls(c,{get status(){return n.status},get label(){return h(x)},size:10})}var v=p(u,2);gt(v,5,()=>s,x=>x.name,(x,k)=>{var A=Pu();let M;var N=f(A);F((P,S,m)=>{he(A,"href",P),he(A,"aria-current",S),M=Bt(A,1,"svelte-1r8vfx3",null,M,m),B(N,h(k).label)},[()=>kt(h(k).name),()=>a(h(k).name)?"page":void 0,()=>({active:a(h(k).name)})]),D(x,A)});var d=p(o,2),_=f(d);{var y=x=>{Yl(x,{})},E=x=>{iu(x,{})},b=x=>{uu(x,{})},g=x=>{{let k=wr(()=>r.route.params.id??"");bu(x,{get id(){return h(k)}})}},T=x=>{Iu(x,{})},C=x=>{tl(x,{})};G(_,x=>{r.route.name==="trust-circle"?x(y):r.route.name==="connectivity"?x(E,1):r.route.name==="nodes"?x(b,2):r.route.name==="node-detail"?x(g,3):r.route.name==="settings"?x(T,4):x(C,-1)})}var I=p(d,2);Nu(I,{}),D(e,l),Re()}const $s=document.getElementById("app");if(!$s)throw new Error("Missing #app mount target");go(Bu,{target:$s});
|
|
14
|
+
//# sourceMappingURL=index-C9uChk2P.js.map
|