mistwatch 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +119 -2
- package/dist/cli.js +192 -0
- package/dist/web/apple-touch-icon.png +0 -0
- package/dist/web/favicon.ico +0 -0
- package/dist/web/favicon.svg +1 -0
- package/dist/web/icon-192.png +0 -0
- package/dist/web/icon-512.png +0 -0
- package/dist/web/index.html +1460 -0
- package/dist/web/logo-dark.svg +1 -0
- package/dist/web/logo.svg +1 -0
- package/dist/web/mark.svg +1 -0
- package/dist/web/site.webmanifest +1 -0
- package/package.json +66 -4
|
@@ -0,0 +1,1460 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>Mistwatch</title>
|
|
6
|
+
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
|
|
7
|
+
<meta name="color-scheme" content="dark">
|
|
8
|
+
<meta name="description" content="Local budget watcher and pacing proxy for Mistral accounts">
|
|
9
|
+
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
|
|
10
|
+
<link rel="icon" href="/favicon.ico" sizes="48x48">
|
|
11
|
+
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
|
|
12
|
+
<link rel="manifest" href="/site.webmanifest">
|
|
13
|
+
<meta name="theme-color" content="#1d1108">
|
|
14
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
15
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
16
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap">
|
|
17
|
+
<style>/* ==========================================================================
|
|
18
|
+
Mistwatch UI — "the quiet instrument"
|
|
19
|
+
Small type, generous space, one accent. Colour is reserved for data and status.
|
|
20
|
+
Dark only. The palette is generated from one seed colour (Material You / M3 tonal palettes) by brand/palette.mjs.
|
|
21
|
+
========================================================================== */
|
|
22
|
+
:root {
|
|
23
|
+
color-scheme: dark;
|
|
24
|
+
/* TOKENS:BEGIN (generated by brand/palette.mjs) */
|
|
25
|
+
--bg: #1d1108;
|
|
26
|
+
--surface: #2a1d14;
|
|
27
|
+
--fill: #35271d;
|
|
28
|
+
--fill-2: #413228;
|
|
29
|
+
--line: #574336;
|
|
30
|
+
--line-strong: #a58c7c;
|
|
31
|
+
--text-3: #dec1b0;
|
|
32
|
+
--text-2: #f7decf;
|
|
33
|
+
--text: #f7decf;
|
|
34
|
+
--accent: #ffb786;
|
|
35
|
+
--accent-ink: #502400;
|
|
36
|
+
--accent-container: #723600;
|
|
37
|
+
--ok: #8cd893;
|
|
38
|
+
--warn: #e3c600;
|
|
39
|
+
--bad: #ffb4ab;
|
|
40
|
+
--ok-container: #00531f;
|
|
41
|
+
--warn-container: #524700;
|
|
42
|
+
--bad-container: #93000a;
|
|
43
|
+
--s1: #ff9647;
|
|
44
|
+
--s2: #3ac2c7;
|
|
45
|
+
--s3: #95c4ff;
|
|
46
|
+
--s4: #89bf73;
|
|
47
|
+
--s5: #ff9dcf;
|
|
48
|
+
--s6: #d7c93c;
|
|
49
|
+
--s-other: #7d6658;
|
|
50
|
+
--accent-soft: var(--accent-container);
|
|
51
|
+
--ok-soft: var(--ok-container);
|
|
52
|
+
--warn-soft: var(--warn-container);
|
|
53
|
+
--bad-soft: var(--bad-container);
|
|
54
|
+
/* TOKENS:END */
|
|
55
|
+
/* type: system stacks, 6 steps */
|
|
56
|
+
--sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
57
|
+
--mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, Consolas, monospace;
|
|
58
|
+
--t-xs: 0.75rem;
|
|
59
|
+
--t-sm: 0.8125rem;
|
|
60
|
+
--t-md: 0.9375rem;
|
|
61
|
+
--t-lg: 1.125rem;
|
|
62
|
+
--t-xl: clamp(1.25rem, 0.9rem + 1vw, 1.625rem);
|
|
63
|
+
--t-2xl: clamp(1.5rem, 1rem + 1.6vw, 2.125rem);
|
|
64
|
+
/* 4px grid (rem so it follows text scaling), one radius scale, one shadow */
|
|
65
|
+
--sp-1: 0.25rem;
|
|
66
|
+
--sp-2: 0.5rem;
|
|
67
|
+
--sp-3: 0.75rem;
|
|
68
|
+
--sp-4: 1rem;
|
|
69
|
+
--sp-5: 1.25rem;
|
|
70
|
+
--sp-6: 1.5rem;
|
|
71
|
+
--sp-8: 2rem;
|
|
72
|
+
--sp-10: 2.5rem;
|
|
73
|
+
--r-1: 0.25rem;
|
|
74
|
+
--r-2: 0.5rem;
|
|
75
|
+
--r-3: 0.875rem;
|
|
76
|
+
--shadow: none;
|
|
77
|
+
/* clean pass: quiet hairlines; outlines only where a control needs one */
|
|
78
|
+
--hair: var(--line);
|
|
79
|
+
--outline: var(--line-strong);
|
|
80
|
+
--ctl: 2.25rem;
|
|
81
|
+
--side: 14rem;
|
|
82
|
+
--tabbar: 3.5rem;
|
|
83
|
+
--ease: 160ms cubic-bezier(0.2, 0.6, 0.2, 1);
|
|
84
|
+
}
|
|
85
|
+
@media (pointer: coarse), (max-width: 56rem) {
|
|
86
|
+
:root {
|
|
87
|
+
--ctl: 2.75rem;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
*,
|
|
92
|
+
*::before,
|
|
93
|
+
*::after {
|
|
94
|
+
box-sizing: border-box;
|
|
95
|
+
}
|
|
96
|
+
html {
|
|
97
|
+
-webkit-text-size-adjust: 100%;
|
|
98
|
+
text-size-adjust: 100%;
|
|
99
|
+
}
|
|
100
|
+
html {
|
|
101
|
+
font-feature-settings: "cv11", "ss03", "calt";
|
|
102
|
+
}
|
|
103
|
+
body {
|
|
104
|
+
margin: 0;
|
|
105
|
+
background: var(--bg);
|
|
106
|
+
color: var(--text);
|
|
107
|
+
font: 400 var(--t-md) / 1.5 var(--sans);
|
|
108
|
+
-webkit-font-smoothing: antialiased;
|
|
109
|
+
min-height: 100dvh;
|
|
110
|
+
overflow-wrap: anywhere;
|
|
111
|
+
}
|
|
112
|
+
h1,
|
|
113
|
+
h2,
|
|
114
|
+
h3,
|
|
115
|
+
p {
|
|
116
|
+
margin: 0;
|
|
117
|
+
}
|
|
118
|
+
a {
|
|
119
|
+
color: var(--accent);
|
|
120
|
+
}
|
|
121
|
+
:focus-visible {
|
|
122
|
+
outline: 2px solid var(--accent);
|
|
123
|
+
outline-offset: 2px;
|
|
124
|
+
border-radius: var(--r-1);
|
|
125
|
+
}
|
|
126
|
+
[hidden] {
|
|
127
|
+
display: none !important;
|
|
128
|
+
}
|
|
129
|
+
.sr {
|
|
130
|
+
position: absolute;
|
|
131
|
+
width: 1px;
|
|
132
|
+
height: 1px;
|
|
133
|
+
overflow: hidden;
|
|
134
|
+
clip: rect(0 0 0 0);
|
|
135
|
+
white-space: nowrap;
|
|
136
|
+
}
|
|
137
|
+
.mut {
|
|
138
|
+
color: var(--text-3);
|
|
139
|
+
}
|
|
140
|
+
.sm {
|
|
141
|
+
font-size: var(--t-sm);
|
|
142
|
+
}
|
|
143
|
+
.xs {
|
|
144
|
+
font-size: var(--t-xs);
|
|
145
|
+
}
|
|
146
|
+
.mono {
|
|
147
|
+
font-family: var(--mono);
|
|
148
|
+
font-size: 0.92em;
|
|
149
|
+
}
|
|
150
|
+
.num {
|
|
151
|
+
font-variant-numeric: tabular-nums;
|
|
152
|
+
white-space: nowrap;
|
|
153
|
+
}
|
|
154
|
+
.tnum {
|
|
155
|
+
font-variant-numeric: tabular-nums;
|
|
156
|
+
}
|
|
157
|
+
.trunc {
|
|
158
|
+
min-width: 0;
|
|
159
|
+
overflow: hidden;
|
|
160
|
+
text-overflow: ellipsis;
|
|
161
|
+
white-space: nowrap;
|
|
162
|
+
}
|
|
163
|
+
.row {
|
|
164
|
+
display: flex;
|
|
165
|
+
align-items: center;
|
|
166
|
+
gap: var(--sp-3);
|
|
167
|
+
flex-wrap: wrap;
|
|
168
|
+
}
|
|
169
|
+
.row.nw {
|
|
170
|
+
flex-wrap: nowrap;
|
|
171
|
+
}
|
|
172
|
+
.grow {
|
|
173
|
+
flex: 1 1 auto;
|
|
174
|
+
min-width: 0;
|
|
175
|
+
}
|
|
176
|
+
.stack {
|
|
177
|
+
display: grid;
|
|
178
|
+
gap: var(--sp-4);
|
|
179
|
+
}
|
|
180
|
+
.stack > *,
|
|
181
|
+
.cols > * {
|
|
182
|
+
min-width: 0;
|
|
183
|
+
}
|
|
184
|
+
.ic {
|
|
185
|
+
width: 1rem;
|
|
186
|
+
height: 1rem;
|
|
187
|
+
flex: none;
|
|
188
|
+
stroke: currentColor;
|
|
189
|
+
fill: none;
|
|
190
|
+
stroke-width: 1.75;
|
|
191
|
+
stroke-linecap: round;
|
|
192
|
+
stroke-linejoin: round;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* ---------- shell: sidebar on wide screens, top bar + bottom tab bar on narrow ---------- */
|
|
196
|
+
.shell {
|
|
197
|
+
display: grid;
|
|
198
|
+
grid-template-columns: var(--side) minmax(0, 1fr);
|
|
199
|
+
min-height: 100dvh;
|
|
200
|
+
}
|
|
201
|
+
.side {
|
|
202
|
+
position: sticky;
|
|
203
|
+
top: 0;
|
|
204
|
+
height: 100dvh;
|
|
205
|
+
display: flex;
|
|
206
|
+
flex-direction: column;
|
|
207
|
+
gap: var(--sp-5);
|
|
208
|
+
padding: var(--sp-5) var(--sp-3);
|
|
209
|
+
background: var(--surface);
|
|
210
|
+
overflow-y: auto;
|
|
211
|
+
}
|
|
212
|
+
.brand {
|
|
213
|
+
display: flex;
|
|
214
|
+
align-items: center;
|
|
215
|
+
gap: var(--sp-2);
|
|
216
|
+
font-weight: 600;
|
|
217
|
+
letter-spacing: -0.015em;
|
|
218
|
+
font-size: var(--t-md);
|
|
219
|
+
padding-inline: var(--sp-2);
|
|
220
|
+
color: var(--text);
|
|
221
|
+
text-decoration: none;
|
|
222
|
+
}
|
|
223
|
+
.brand img {
|
|
224
|
+
width: 1.5rem;
|
|
225
|
+
height: 1.5rem;
|
|
226
|
+
display: block;
|
|
227
|
+
image-rendering: pixelated;
|
|
228
|
+
}
|
|
229
|
+
.nav {
|
|
230
|
+
display: grid;
|
|
231
|
+
gap: 2px;
|
|
232
|
+
}
|
|
233
|
+
.nav a {
|
|
234
|
+
display: flex;
|
|
235
|
+
align-items: center;
|
|
236
|
+
gap: var(--sp-3);
|
|
237
|
+
min-height: var(--ctl);
|
|
238
|
+
padding: 0 var(--sp-3);
|
|
239
|
+
border-radius: var(--r-2);
|
|
240
|
+
color: var(--text-2);
|
|
241
|
+
text-decoration: none;
|
|
242
|
+
font-size: var(--t-sm);
|
|
243
|
+
font-weight: 500;
|
|
244
|
+
transition:
|
|
245
|
+
background var(--ease),
|
|
246
|
+
color var(--ease);
|
|
247
|
+
}
|
|
248
|
+
.nav a:hover {
|
|
249
|
+
background: var(--fill);
|
|
250
|
+
}
|
|
251
|
+
.nav a[aria-current="page"] {
|
|
252
|
+
background: var(--accent-soft);
|
|
253
|
+
color: var(--accent);
|
|
254
|
+
font-weight: 600;
|
|
255
|
+
}
|
|
256
|
+
.side-sum {
|
|
257
|
+
margin-top: auto;
|
|
258
|
+
padding: var(--sp-3);
|
|
259
|
+
background: var(--fill);
|
|
260
|
+
border-radius: var(--r-3);
|
|
261
|
+
display: grid;
|
|
262
|
+
gap: var(--sp-2);
|
|
263
|
+
text-decoration: none;
|
|
264
|
+
color: var(--text);
|
|
265
|
+
}
|
|
266
|
+
.side-sum:hover {
|
|
267
|
+
background: var(--fill-2);
|
|
268
|
+
}
|
|
269
|
+
.side-foot {
|
|
270
|
+
display: flex;
|
|
271
|
+
align-items: center;
|
|
272
|
+
gap: var(--sp-1);
|
|
273
|
+
padding-inline: var(--sp-1);
|
|
274
|
+
}
|
|
275
|
+
.side-foot .who {
|
|
276
|
+
flex: 1;
|
|
277
|
+
min-width: 0;
|
|
278
|
+
font-size: var(--t-sm);
|
|
279
|
+
color: var(--text-3);
|
|
280
|
+
}
|
|
281
|
+
.main {
|
|
282
|
+
min-width: 0;
|
|
283
|
+
}
|
|
284
|
+
.page {
|
|
285
|
+
width: 100%;
|
|
286
|
+
max-width: 76rem;
|
|
287
|
+
margin-inline: auto;
|
|
288
|
+
padding: clamp(1rem, 2.4vw, 2rem) clamp(1rem, 3vw, 2.25rem) var(--sp-10);
|
|
289
|
+
}
|
|
290
|
+
.top {
|
|
291
|
+
display: none;
|
|
292
|
+
}
|
|
293
|
+
.tabbar {
|
|
294
|
+
display: none;
|
|
295
|
+
}
|
|
296
|
+
@media (max-width: 56rem) {
|
|
297
|
+
.shell {
|
|
298
|
+
grid-template-columns: minmax(0, 1fr);
|
|
299
|
+
}
|
|
300
|
+
.side {
|
|
301
|
+
display: none;
|
|
302
|
+
}
|
|
303
|
+
.top {
|
|
304
|
+
display: flex;
|
|
305
|
+
align-items: center;
|
|
306
|
+
gap: var(--sp-3);
|
|
307
|
+
position: sticky;
|
|
308
|
+
top: 0;
|
|
309
|
+
z-index: 5;
|
|
310
|
+
padding: var(--sp-2) max(var(--sp-4), env(safe-area-inset-right)) var(--sp-2)
|
|
311
|
+
max(var(--sp-4), env(safe-area-inset-left));
|
|
312
|
+
padding-top: max(var(--sp-2), env(safe-area-inset-top));
|
|
313
|
+
background: var(--surface);
|
|
314
|
+
border-bottom: 1px solid var(--hair);
|
|
315
|
+
}
|
|
316
|
+
.top .brand {
|
|
317
|
+
padding: 0;
|
|
318
|
+
}
|
|
319
|
+
.top .sumv {
|
|
320
|
+
margin-left: auto;
|
|
321
|
+
display: flex;
|
|
322
|
+
align-items: center;
|
|
323
|
+
gap: var(--sp-2);
|
|
324
|
+
min-width: 0;
|
|
325
|
+
text-decoration: none;
|
|
326
|
+
color: var(--text);
|
|
327
|
+
font-size: var(--t-sm);
|
|
328
|
+
}
|
|
329
|
+
.tabbar {
|
|
330
|
+
display: grid;
|
|
331
|
+
grid-template-columns: repeat(4, 1fr);
|
|
332
|
+
position: fixed;
|
|
333
|
+
inset: auto 0 0 0;
|
|
334
|
+
z-index: 5;
|
|
335
|
+
background: var(--surface);
|
|
336
|
+
border-top: 1px solid var(--hair);
|
|
337
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
338
|
+
padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
|
|
339
|
+
}
|
|
340
|
+
.tabbar a {
|
|
341
|
+
display: flex;
|
|
342
|
+
flex-direction: column;
|
|
343
|
+
align-items: center;
|
|
344
|
+
justify-content: center;
|
|
345
|
+
gap: 2px;
|
|
346
|
+
min-height: var(--tabbar);
|
|
347
|
+
padding: var(--sp-1);
|
|
348
|
+
color: var(--text-3);
|
|
349
|
+
text-decoration: none;
|
|
350
|
+
font-size: var(--t-xs);
|
|
351
|
+
font-weight: 500;
|
|
352
|
+
}
|
|
353
|
+
.tabbar a[aria-current="page"] {
|
|
354
|
+
color: var(--accent);
|
|
355
|
+
}
|
|
356
|
+
.page {
|
|
357
|
+
padding-bottom: var(--sp-6);
|
|
358
|
+
}
|
|
359
|
+
.legal {
|
|
360
|
+
padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + var(--sp-8)) !important;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.legal {
|
|
365
|
+
width: 100%;
|
|
366
|
+
max-width: 76rem;
|
|
367
|
+
margin-inline: auto;
|
|
368
|
+
padding: 0 clamp(1rem, 3vw, 2.25rem) var(--sp-8);
|
|
369
|
+
font-size: var(--t-xs);
|
|
370
|
+
color: var(--text-3);
|
|
371
|
+
line-height: 1.6;
|
|
372
|
+
}
|
|
373
|
+
.legal p {
|
|
374
|
+
max-width: 70ch;
|
|
375
|
+
border-top: 1px solid var(--hair);
|
|
376
|
+
padding-top: var(--sp-4);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/* ---------- surfaces ---------- */
|
|
380
|
+
.card {
|
|
381
|
+
background: var(--surface);
|
|
382
|
+
border-radius: var(--r-3);
|
|
383
|
+
padding: var(--sp-6);
|
|
384
|
+
}
|
|
385
|
+
.card-h {
|
|
386
|
+
display: flex;
|
|
387
|
+
align-items: center;
|
|
388
|
+
gap: var(--sp-3);
|
|
389
|
+
flex-wrap: wrap;
|
|
390
|
+
margin-bottom: var(--sp-4);
|
|
391
|
+
}
|
|
392
|
+
.card-h h2 {
|
|
393
|
+
font-size: var(--t-md);
|
|
394
|
+
font-weight: 600;
|
|
395
|
+
letter-spacing: -0.01em;
|
|
396
|
+
}
|
|
397
|
+
.page-h {
|
|
398
|
+
display: flex;
|
|
399
|
+
align-items: flex-end;
|
|
400
|
+
gap: var(--sp-3) var(--sp-4);
|
|
401
|
+
flex-wrap: wrap;
|
|
402
|
+
margin-bottom: var(--sp-8);
|
|
403
|
+
}
|
|
404
|
+
.page-h h1 {
|
|
405
|
+
font-size: var(--t-2xl);
|
|
406
|
+
font-weight: 600;
|
|
407
|
+
letter-spacing: -0.03em;
|
|
408
|
+
line-height: 1.15;
|
|
409
|
+
}
|
|
410
|
+
.page-h p {
|
|
411
|
+
color: var(--text-3);
|
|
412
|
+
font-size: var(--t-sm);
|
|
413
|
+
max-width: 60ch;
|
|
414
|
+
}
|
|
415
|
+
.page-h .act {
|
|
416
|
+
margin-left: auto;
|
|
417
|
+
}
|
|
418
|
+
.lead {
|
|
419
|
+
color: var(--text-3);
|
|
420
|
+
font-size: var(--t-sm);
|
|
421
|
+
max-width: 64ch;
|
|
422
|
+
margin: calc(var(--sp-3) * -1) 0 var(--sp-5);
|
|
423
|
+
}
|
|
424
|
+
.dash-split {
|
|
425
|
+
display: grid;
|
|
426
|
+
gap: var(--sp-5);
|
|
427
|
+
align-items: start;
|
|
428
|
+
}
|
|
429
|
+
@media (min-width: 64rem) {
|
|
430
|
+
.dash-split {
|
|
431
|
+
grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
|
|
432
|
+
}
|
|
433
|
+
.dash-split > .rec {
|
|
434
|
+
grid-column: 1;
|
|
435
|
+
grid-row: 1;
|
|
436
|
+
}
|
|
437
|
+
.dash-split > .aside {
|
|
438
|
+
grid-column: 2;
|
|
439
|
+
grid-row: 1;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
.cols {
|
|
443
|
+
display: grid;
|
|
444
|
+
grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
|
|
445
|
+
gap: var(--sp-5);
|
|
446
|
+
align-items: start;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/* ---------- buttons ---------- */
|
|
450
|
+
.btn {
|
|
451
|
+
appearance: none;
|
|
452
|
+
display: inline-flex;
|
|
453
|
+
align-items: center;
|
|
454
|
+
justify-content: center;
|
|
455
|
+
gap: var(--sp-2);
|
|
456
|
+
min-height: var(--ctl);
|
|
457
|
+
padding: 0 var(--sp-4);
|
|
458
|
+
border: 1px solid transparent;
|
|
459
|
+
border-radius: var(--r-2);
|
|
460
|
+
background: var(--fill);
|
|
461
|
+
color: var(--text);
|
|
462
|
+
font: 500 var(--t-sm) / 1 var(--sans);
|
|
463
|
+
text-decoration: none;
|
|
464
|
+
cursor: pointer;
|
|
465
|
+
white-space: nowrap;
|
|
466
|
+
transition:
|
|
467
|
+
background var(--ease),
|
|
468
|
+
border-color var(--ease),
|
|
469
|
+
color var(--ease),
|
|
470
|
+
transform var(--ease);
|
|
471
|
+
touch-action: manipulation;
|
|
472
|
+
-webkit-tap-highlight-color: transparent;
|
|
473
|
+
}
|
|
474
|
+
.btn:hover {
|
|
475
|
+
background: var(--fill-2);
|
|
476
|
+
}
|
|
477
|
+
.btn:active {
|
|
478
|
+
background: var(--fill-2);
|
|
479
|
+
transform: translateY(1px);
|
|
480
|
+
}
|
|
481
|
+
.btn.pri {
|
|
482
|
+
background: var(--accent);
|
|
483
|
+
border-color: var(--accent);
|
|
484
|
+
color: var(--accent-ink);
|
|
485
|
+
}
|
|
486
|
+
.btn.pri:hover {
|
|
487
|
+
background: color-mix(in srgb, var(--accent) 88%, var(--text));
|
|
488
|
+
}
|
|
489
|
+
.btn.pri:active {
|
|
490
|
+
background: color-mix(in srgb, var(--accent) 78%, var(--text));
|
|
491
|
+
}
|
|
492
|
+
.btn.ghost {
|
|
493
|
+
border-color: transparent;
|
|
494
|
+
background: transparent;
|
|
495
|
+
color: var(--text-2);
|
|
496
|
+
}
|
|
497
|
+
.btn.ghost:hover {
|
|
498
|
+
background: var(--fill);
|
|
499
|
+
}
|
|
500
|
+
.btn.out {
|
|
501
|
+
background: transparent;
|
|
502
|
+
border-color: var(--outline);
|
|
503
|
+
}
|
|
504
|
+
.btn.out:hover {
|
|
505
|
+
background: var(--fill);
|
|
506
|
+
}
|
|
507
|
+
.btn.danger {
|
|
508
|
+
color: var(--bad);
|
|
509
|
+
border-color: color-mix(in srgb, var(--bad) 45%, transparent);
|
|
510
|
+
background: transparent;
|
|
511
|
+
}
|
|
512
|
+
.btn.danger:hover {
|
|
513
|
+
background: var(--bad-soft);
|
|
514
|
+
}
|
|
515
|
+
.btn.danger.solid {
|
|
516
|
+
background: var(--bad);
|
|
517
|
+
color: var(--surface);
|
|
518
|
+
border-color: var(--bad);
|
|
519
|
+
}
|
|
520
|
+
.btn.icon {
|
|
521
|
+
padding: 0;
|
|
522
|
+
width: var(--ctl);
|
|
523
|
+
}
|
|
524
|
+
.btn.sm {
|
|
525
|
+
min-height: calc(var(--ctl) - 0.375rem);
|
|
526
|
+
padding: 0 var(--sp-3);
|
|
527
|
+
}
|
|
528
|
+
.btn:disabled,
|
|
529
|
+
.btn[aria-disabled="true"] {
|
|
530
|
+
opacity: 0.5;
|
|
531
|
+
cursor: not-allowed;
|
|
532
|
+
pointer-events: none;
|
|
533
|
+
}
|
|
534
|
+
.btn.wide {
|
|
535
|
+
width: 100%;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/* ---------- inputs ---------- */
|
|
539
|
+
label.f {
|
|
540
|
+
display: grid;
|
|
541
|
+
gap: var(--sp-1);
|
|
542
|
+
font-size: var(--t-sm);
|
|
543
|
+
font-weight: 500;
|
|
544
|
+
color: var(--text-2);
|
|
545
|
+
}
|
|
546
|
+
.input,
|
|
547
|
+
select.input {
|
|
548
|
+
appearance: none;
|
|
549
|
+
width: 100%;
|
|
550
|
+
min-width: 0;
|
|
551
|
+
min-height: var(--ctl);
|
|
552
|
+
padding: 0 var(--sp-3);
|
|
553
|
+
border: 1px solid var(--outline);
|
|
554
|
+
border-radius: var(--r-2);
|
|
555
|
+
background: transparent;
|
|
556
|
+
color: var(--text);
|
|
557
|
+
font: 400 var(--t-sm) / 1.2 var(--sans);
|
|
558
|
+
transition:
|
|
559
|
+
border-color var(--ease),
|
|
560
|
+
box-shadow var(--ease);
|
|
561
|
+
}
|
|
562
|
+
select.input {
|
|
563
|
+
padding-right: var(--sp-8);
|
|
564
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ddc1af' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
|
|
565
|
+
background-repeat: no-repeat;
|
|
566
|
+
background-position: right 0.5rem center;
|
|
567
|
+
background-size: 1rem;
|
|
568
|
+
}
|
|
569
|
+
select.input option {
|
|
570
|
+
background: var(--fill);
|
|
571
|
+
color: var(--text);
|
|
572
|
+
}
|
|
573
|
+
.input:hover {
|
|
574
|
+
border-color: var(--line-strong);
|
|
575
|
+
}
|
|
576
|
+
.input:focus-visible {
|
|
577
|
+
outline: none;
|
|
578
|
+
border-color: var(--accent);
|
|
579
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
|
|
580
|
+
}
|
|
581
|
+
.input::placeholder {
|
|
582
|
+
color: var(--text-3);
|
|
583
|
+
}
|
|
584
|
+
.input:disabled {
|
|
585
|
+
opacity: 0.55;
|
|
586
|
+
}
|
|
587
|
+
@media (pointer: coarse), (max-width: 56rem) {
|
|
588
|
+
.input,
|
|
589
|
+
select.input {
|
|
590
|
+
font-size: 1rem;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
.input.short {
|
|
594
|
+
width: 5rem;
|
|
595
|
+
}
|
|
596
|
+
.field-row {
|
|
597
|
+
display: flex;
|
|
598
|
+
gap: var(--sp-3);
|
|
599
|
+
flex-wrap: wrap;
|
|
600
|
+
align-items: end;
|
|
601
|
+
}
|
|
602
|
+
.field-row > label {
|
|
603
|
+
flex: 1 1 14rem;
|
|
604
|
+
max-width: 24rem;
|
|
605
|
+
}
|
|
606
|
+
.switch {
|
|
607
|
+
position: relative;
|
|
608
|
+
appearance: none;
|
|
609
|
+
flex: none;
|
|
610
|
+
width: 2.25rem;
|
|
611
|
+
height: 1.375rem;
|
|
612
|
+
padding: 0;
|
|
613
|
+
border: 1px solid var(--outline);
|
|
614
|
+
border-radius: 999px;
|
|
615
|
+
background: var(--fill-2);
|
|
616
|
+
cursor: pointer;
|
|
617
|
+
transition:
|
|
618
|
+
background var(--ease),
|
|
619
|
+
border-color var(--ease);
|
|
620
|
+
}
|
|
621
|
+
.switch::before {
|
|
622
|
+
content: "";
|
|
623
|
+
position: absolute;
|
|
624
|
+
inset: -0.7rem -0.3rem;
|
|
625
|
+
}
|
|
626
|
+
.switch::after {
|
|
627
|
+
content: "";
|
|
628
|
+
position: absolute;
|
|
629
|
+
top: 2px;
|
|
630
|
+
left: 2px;
|
|
631
|
+
width: 1rem;
|
|
632
|
+
height: 1rem;
|
|
633
|
+
border-radius: 50%;
|
|
634
|
+
background: var(--text-2);
|
|
635
|
+
transition:
|
|
636
|
+
transform var(--ease),
|
|
637
|
+
background var(--ease);
|
|
638
|
+
}
|
|
639
|
+
.switch[aria-checked="true"] {
|
|
640
|
+
background: var(--accent);
|
|
641
|
+
border-color: var(--accent);
|
|
642
|
+
}
|
|
643
|
+
.switch[aria-checked="true"]::after {
|
|
644
|
+
transform: translateX(0.875rem);
|
|
645
|
+
background: var(--accent-ink);
|
|
646
|
+
}
|
|
647
|
+
.check {
|
|
648
|
+
display: inline-flex;
|
|
649
|
+
align-items: center;
|
|
650
|
+
gap: var(--sp-2);
|
|
651
|
+
font-size: var(--t-sm);
|
|
652
|
+
min-height: var(--ctl);
|
|
653
|
+
cursor: pointer;
|
|
654
|
+
}
|
|
655
|
+
.check input {
|
|
656
|
+
width: 1.125rem;
|
|
657
|
+
height: 1.125rem;
|
|
658
|
+
accent-color: var(--accent);
|
|
659
|
+
margin: 0;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
/* ---------- badges ---------- */
|
|
663
|
+
.badge {
|
|
664
|
+
display: inline-flex;
|
|
665
|
+
align-items: center;
|
|
666
|
+
gap: 0.3rem;
|
|
667
|
+
height: 1.375rem;
|
|
668
|
+
padding: 0 0.5rem;
|
|
669
|
+
border-radius: var(--r-1);
|
|
670
|
+
font-size: var(--t-xs);
|
|
671
|
+
font-weight: 500;
|
|
672
|
+
background: var(--fill);
|
|
673
|
+
color: var(--text-2);
|
|
674
|
+
white-space: nowrap;
|
|
675
|
+
}
|
|
676
|
+
.badge .ic {
|
|
677
|
+
width: 0.8125rem;
|
|
678
|
+
height: 0.8125rem;
|
|
679
|
+
stroke-width: 2.2;
|
|
680
|
+
}
|
|
681
|
+
.badge.ok {
|
|
682
|
+
background: var(--ok-soft);
|
|
683
|
+
color: var(--ok);
|
|
684
|
+
}
|
|
685
|
+
.badge.warn {
|
|
686
|
+
background: var(--warn-soft);
|
|
687
|
+
color: var(--warn);
|
|
688
|
+
}
|
|
689
|
+
.badge.bad {
|
|
690
|
+
background: var(--bad-soft);
|
|
691
|
+
color: var(--bad);
|
|
692
|
+
}
|
|
693
|
+
.badge.info {
|
|
694
|
+
background: var(--accent-soft);
|
|
695
|
+
color: var(--accent);
|
|
696
|
+
}
|
|
697
|
+
.tx-ok {
|
|
698
|
+
color: var(--ok);
|
|
699
|
+
}
|
|
700
|
+
.tx-warn {
|
|
701
|
+
color: var(--warn);
|
|
702
|
+
}
|
|
703
|
+
.tx-bad {
|
|
704
|
+
color: var(--bad);
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
/* ---------- tabs (segmented) ---------- */
|
|
708
|
+
.tabs {
|
|
709
|
+
display: inline-flex;
|
|
710
|
+
padding: 2px;
|
|
711
|
+
gap: 2px;
|
|
712
|
+
border-radius: var(--r-2);
|
|
713
|
+
background: var(--fill);
|
|
714
|
+
}
|
|
715
|
+
.tab {
|
|
716
|
+
appearance: none;
|
|
717
|
+
border: 0;
|
|
718
|
+
background: transparent;
|
|
719
|
+
color: var(--text-3);
|
|
720
|
+
font: 500 var(--t-sm) / 1 var(--sans);
|
|
721
|
+
min-height: calc(var(--ctl) - 0.5rem);
|
|
722
|
+
padding: 0 var(--sp-3);
|
|
723
|
+
border-radius: calc(var(--r-2) - 2px);
|
|
724
|
+
cursor: pointer;
|
|
725
|
+
transition:
|
|
726
|
+
background var(--ease),
|
|
727
|
+
color var(--ease);
|
|
728
|
+
touch-action: manipulation;
|
|
729
|
+
}
|
|
730
|
+
.tab:hover {
|
|
731
|
+
color: var(--text);
|
|
732
|
+
}
|
|
733
|
+
.tab[aria-selected="true"] {
|
|
734
|
+
background: var(--surface);
|
|
735
|
+
color: var(--text);
|
|
736
|
+
box-shadow: var(--shadow);
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
/* ---------- summary strip ---------- */
|
|
740
|
+
.strip {
|
|
741
|
+
display: grid;
|
|
742
|
+
grid-template-columns: repeat(auto-fit, minmax(min(100%, 12.5rem), 1fr));
|
|
743
|
+
gap: var(--sp-3);
|
|
744
|
+
margin-bottom: var(--sp-5);
|
|
745
|
+
}
|
|
746
|
+
.cell {
|
|
747
|
+
background: var(--surface);
|
|
748
|
+
border-radius: var(--r-3);
|
|
749
|
+
padding: var(--sp-5);
|
|
750
|
+
display: grid;
|
|
751
|
+
gap: var(--sp-1);
|
|
752
|
+
align-content: start;
|
|
753
|
+
min-width: 0;
|
|
754
|
+
}
|
|
755
|
+
.cell .k {
|
|
756
|
+
font-size: var(--t-sm);
|
|
757
|
+
font-weight: 500;
|
|
758
|
+
color: var(--text-3);
|
|
759
|
+
}
|
|
760
|
+
.cell .v {
|
|
761
|
+
font-size: var(--t-xl);
|
|
762
|
+
font-weight: 600;
|
|
763
|
+
letter-spacing: -0.03em;
|
|
764
|
+
line-height: 1.2;
|
|
765
|
+
font-variant-numeric: tabular-nums;
|
|
766
|
+
}
|
|
767
|
+
.cell .s {
|
|
768
|
+
font-size: var(--t-sm);
|
|
769
|
+
color: var(--text-3);
|
|
770
|
+
min-height: 1.25rem;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
/* ---------- bars ---------- */
|
|
774
|
+
.mini {
|
|
775
|
+
height: 0.25rem;
|
|
776
|
+
border-radius: 2px;
|
|
777
|
+
background: var(--fill-2);
|
|
778
|
+
overflow: hidden;
|
|
779
|
+
margin-top: var(--sp-1);
|
|
780
|
+
}
|
|
781
|
+
.mini i {
|
|
782
|
+
display: block;
|
|
783
|
+
height: 100%;
|
|
784
|
+
background: var(--accent);
|
|
785
|
+
border-radius: 2px;
|
|
786
|
+
}
|
|
787
|
+
.mini i.warn {
|
|
788
|
+
background: var(--warn);
|
|
789
|
+
}
|
|
790
|
+
.mini i.bad {
|
|
791
|
+
background: var(--bad);
|
|
792
|
+
}
|
|
793
|
+
.pbar {
|
|
794
|
+
position: relative;
|
|
795
|
+
height: 0.625rem;
|
|
796
|
+
border-radius: 3px;
|
|
797
|
+
background: var(--fill-2);
|
|
798
|
+
margin: var(--sp-3) 0 var(--sp-2);
|
|
799
|
+
}
|
|
800
|
+
.pbar .fill {
|
|
801
|
+
position: absolute;
|
|
802
|
+
left: 0;
|
|
803
|
+
top: 0;
|
|
804
|
+
bottom: 0;
|
|
805
|
+
border-radius: 3px 0 0 3px;
|
|
806
|
+
background: var(--accent);
|
|
807
|
+
transition: width 400ms ease;
|
|
808
|
+
}
|
|
809
|
+
.pbar .fill.warn {
|
|
810
|
+
background: var(--warn);
|
|
811
|
+
}
|
|
812
|
+
.pbar .fill.bad {
|
|
813
|
+
background: var(--bad);
|
|
814
|
+
}
|
|
815
|
+
.pbar .res {
|
|
816
|
+
position: absolute;
|
|
817
|
+
top: 0;
|
|
818
|
+
bottom: 0;
|
|
819
|
+
right: 0;
|
|
820
|
+
border-radius: 0 3px 3px 0;
|
|
821
|
+
background: repeating-linear-gradient(135deg, var(--line-strong) 0 1px, transparent 1px 4px);
|
|
822
|
+
opacity: 0.6;
|
|
823
|
+
}
|
|
824
|
+
.pbar .mark {
|
|
825
|
+
position: absolute;
|
|
826
|
+
top: -0.25rem;
|
|
827
|
+
bottom: -0.25rem;
|
|
828
|
+
width: 2px;
|
|
829
|
+
margin-left: -1px;
|
|
830
|
+
background: var(--text);
|
|
831
|
+
border-radius: 1px;
|
|
832
|
+
}
|
|
833
|
+
.keyline {
|
|
834
|
+
display: flex;
|
|
835
|
+
flex-wrap: wrap;
|
|
836
|
+
gap: var(--sp-1) var(--sp-4);
|
|
837
|
+
font-size: var(--t-xs);
|
|
838
|
+
color: var(--text-3);
|
|
839
|
+
margin-top: var(--sp-4);
|
|
840
|
+
padding-top: var(--sp-3);
|
|
841
|
+
border-top: 1px solid var(--hair);
|
|
842
|
+
}
|
|
843
|
+
.keyline span {
|
|
844
|
+
display: inline-flex;
|
|
845
|
+
align-items: center;
|
|
846
|
+
gap: var(--sp-2);
|
|
847
|
+
}
|
|
848
|
+
.sw {
|
|
849
|
+
display: inline-block;
|
|
850
|
+
width: 0.625rem;
|
|
851
|
+
height: 0.625rem;
|
|
852
|
+
border-radius: 2px;
|
|
853
|
+
background: var(--accent);
|
|
854
|
+
}
|
|
855
|
+
.sw.mark {
|
|
856
|
+
width: 2px;
|
|
857
|
+
height: 0.75rem;
|
|
858
|
+
background: var(--text);
|
|
859
|
+
}
|
|
860
|
+
.sw.res {
|
|
861
|
+
background: repeating-linear-gradient(135deg, var(--line-strong) 0 1px, transparent 1px 3px);
|
|
862
|
+
outline: 1px solid var(--line);
|
|
863
|
+
}
|
|
864
|
+
.prow {
|
|
865
|
+
padding: var(--sp-4) 0;
|
|
866
|
+
border-top: 1px solid var(--hair);
|
|
867
|
+
}
|
|
868
|
+
.prow:first-of-type {
|
|
869
|
+
border-top: 0;
|
|
870
|
+
padding-top: 0;
|
|
871
|
+
}
|
|
872
|
+
.wrow {
|
|
873
|
+
display: grid;
|
|
874
|
+
grid-template-columns: 4.5rem minmax(0, 1fr) auto;
|
|
875
|
+
gap: var(--sp-3);
|
|
876
|
+
align-items: center;
|
|
877
|
+
padding: var(--sp-3) 0;
|
|
878
|
+
border-top: 1px solid var(--hair);
|
|
879
|
+
}
|
|
880
|
+
.wrow:first-of-type {
|
|
881
|
+
border-top: 0;
|
|
882
|
+
padding-top: 0;
|
|
883
|
+
}
|
|
884
|
+
.min0 {
|
|
885
|
+
min-width: 0;
|
|
886
|
+
}
|
|
887
|
+
.wrow .mini {
|
|
888
|
+
margin: var(--sp-1) 0 0;
|
|
889
|
+
height: 0.375rem;
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
/* ---------- chart ---------- */
|
|
893
|
+
.chart {
|
|
894
|
+
position: relative;
|
|
895
|
+
min-height: 11rem;
|
|
896
|
+
}
|
|
897
|
+
.chart svg {
|
|
898
|
+
display: block;
|
|
899
|
+
width: 100%;
|
|
900
|
+
height: auto;
|
|
901
|
+
overflow: visible;
|
|
902
|
+
}
|
|
903
|
+
.chart .g {
|
|
904
|
+
stroke: var(--hair);
|
|
905
|
+
stroke-width: 1;
|
|
906
|
+
}
|
|
907
|
+
.chart .ax {
|
|
908
|
+
fill: var(--text-3);
|
|
909
|
+
font: 400 11px var(--sans);
|
|
910
|
+
font-variant-numeric: tabular-nums;
|
|
911
|
+
}
|
|
912
|
+
.chart .pace {
|
|
913
|
+
stroke: var(--text-2);
|
|
914
|
+
stroke-width: 1;
|
|
915
|
+
stroke-dasharray: 3 4;
|
|
916
|
+
}
|
|
917
|
+
.chart .hit {
|
|
918
|
+
fill: transparent;
|
|
919
|
+
touch-action: pan-y;
|
|
920
|
+
}
|
|
921
|
+
.chart .hit:hover,
|
|
922
|
+
.chart .hit.on {
|
|
923
|
+
fill: color-mix(in srgb, var(--text) 6%, transparent);
|
|
924
|
+
}
|
|
925
|
+
.tip {
|
|
926
|
+
position: absolute;
|
|
927
|
+
z-index: 3;
|
|
928
|
+
pointer-events: none;
|
|
929
|
+
background: var(--text);
|
|
930
|
+
color: var(--bg);
|
|
931
|
+
padding: var(--sp-2) var(--sp-3);
|
|
932
|
+
border-radius: var(--r-2);
|
|
933
|
+
font-size: var(--t-xs);
|
|
934
|
+
line-height: 1.5;
|
|
935
|
+
white-space: nowrap;
|
|
936
|
+
box-shadow: 0 4px 16px rgb(0 0 0 / 0.25);
|
|
937
|
+
}
|
|
938
|
+
.tip i {
|
|
939
|
+
display: inline-block;
|
|
940
|
+
width: 0.5rem;
|
|
941
|
+
height: 0.5rem;
|
|
942
|
+
border-radius: 2px;
|
|
943
|
+
margin-right: 0.4rem;
|
|
944
|
+
}
|
|
945
|
+
.tip .t {
|
|
946
|
+
border-top: 1px solid color-mix(in srgb, var(--bg) 35%, transparent);
|
|
947
|
+
margin-top: var(--sp-1);
|
|
948
|
+
padding-top: var(--sp-1);
|
|
949
|
+
font-weight: 600;
|
|
950
|
+
}
|
|
951
|
+
.empty-chart {
|
|
952
|
+
position: absolute;
|
|
953
|
+
inset: 0;
|
|
954
|
+
display: grid;
|
|
955
|
+
place-items: center;
|
|
956
|
+
color: var(--text-3);
|
|
957
|
+
font-size: var(--t-sm);
|
|
958
|
+
pointer-events: none;
|
|
959
|
+
}
|
|
960
|
+
.legend {
|
|
961
|
+
display: flex;
|
|
962
|
+
flex-wrap: wrap;
|
|
963
|
+
gap: var(--sp-1) var(--sp-4);
|
|
964
|
+
margin-top: var(--sp-3);
|
|
965
|
+
font-size: var(--t-xs);
|
|
966
|
+
}
|
|
967
|
+
.legend span {
|
|
968
|
+
display: inline-flex;
|
|
969
|
+
align-items: center;
|
|
970
|
+
gap: 0.4rem;
|
|
971
|
+
min-width: 0;
|
|
972
|
+
max-width: 100%;
|
|
973
|
+
}
|
|
974
|
+
.legend i {
|
|
975
|
+
width: 0.625rem;
|
|
976
|
+
height: 0.625rem;
|
|
977
|
+
border-radius: 2px;
|
|
978
|
+
flex: none;
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
/* ---------- tables ---------- */
|
|
982
|
+
.tw {
|
|
983
|
+
position: relative;
|
|
984
|
+
overflow-x: auto;
|
|
985
|
+
container-type: inline-size;
|
|
986
|
+
margin-inline: calc(var(--sp-5) * -1);
|
|
987
|
+
padding-inline: var(--sp-5);
|
|
988
|
+
}
|
|
989
|
+
.tbl {
|
|
990
|
+
width: 100%;
|
|
991
|
+
border-collapse: collapse;
|
|
992
|
+
font-size: var(--t-sm);
|
|
993
|
+
}
|
|
994
|
+
.tbl th {
|
|
995
|
+
font-size: var(--t-xs);
|
|
996
|
+
font-weight: 500;
|
|
997
|
+
color: var(--text-3);
|
|
998
|
+
text-align: left;
|
|
999
|
+
padding: var(--sp-2) var(--sp-3);
|
|
1000
|
+
border-bottom: 1px solid var(--hair);
|
|
1001
|
+
white-space: nowrap;
|
|
1002
|
+
}
|
|
1003
|
+
.tbl td {
|
|
1004
|
+
padding: var(--sp-2) var(--sp-3);
|
|
1005
|
+
border-bottom: 1px solid var(--hair);
|
|
1006
|
+
vertical-align: middle;
|
|
1007
|
+
}
|
|
1008
|
+
.tbl tr:last-child td {
|
|
1009
|
+
border-bottom: 0;
|
|
1010
|
+
}
|
|
1011
|
+
.tbl .n {
|
|
1012
|
+
text-align: right;
|
|
1013
|
+
font-family: var(--mono);
|
|
1014
|
+
font-size: 0.92em;
|
|
1015
|
+
font-variant-numeric: tabular-nums;
|
|
1016
|
+
white-space: nowrap;
|
|
1017
|
+
}
|
|
1018
|
+
.tbl th.n {
|
|
1019
|
+
font-family: var(--sans);
|
|
1020
|
+
font-size: var(--t-xs);
|
|
1021
|
+
}
|
|
1022
|
+
.tbl th:first-child,
|
|
1023
|
+
.tbl td:first-child {
|
|
1024
|
+
padding-left: 0;
|
|
1025
|
+
}
|
|
1026
|
+
.tbl th:last-child,
|
|
1027
|
+
.tbl td:last-child {
|
|
1028
|
+
padding-right: 0;
|
|
1029
|
+
}
|
|
1030
|
+
.tbl .max {
|
|
1031
|
+
max-width: 14rem;
|
|
1032
|
+
}
|
|
1033
|
+
.tbl.wide {
|
|
1034
|
+
min-width: 36rem;
|
|
1035
|
+
}
|
|
1036
|
+
.tbl.stack {
|
|
1037
|
+
display: table;
|
|
1038
|
+
gap: 0;
|
|
1039
|
+
}
|
|
1040
|
+
@container (max-width: 34rem) {
|
|
1041
|
+
.tbl.stack thead {
|
|
1042
|
+
display: none;
|
|
1043
|
+
}
|
|
1044
|
+
.tbl.stack,
|
|
1045
|
+
.tbl.stack tbody,
|
|
1046
|
+
.tbl.stack tr,
|
|
1047
|
+
.tbl.stack td {
|
|
1048
|
+
display: block;
|
|
1049
|
+
width: 100%;
|
|
1050
|
+
}
|
|
1051
|
+
.tbl.stack tr {
|
|
1052
|
+
padding: var(--sp-3) 0;
|
|
1053
|
+
border-bottom: 1px solid var(--hair);
|
|
1054
|
+
}
|
|
1055
|
+
.tbl.stack tr:last-child {
|
|
1056
|
+
border-bottom: 0;
|
|
1057
|
+
}
|
|
1058
|
+
.tbl.stack td {
|
|
1059
|
+
display: flex;
|
|
1060
|
+
justify-content: space-between;
|
|
1061
|
+
align-items: center;
|
|
1062
|
+
gap: var(--sp-4);
|
|
1063
|
+
padding: var(--sp-1) 0;
|
|
1064
|
+
border: 0;
|
|
1065
|
+
text-align: right;
|
|
1066
|
+
}
|
|
1067
|
+
.tbl.stack td::before {
|
|
1068
|
+
content: attr(data-l);
|
|
1069
|
+
color: var(--text-3);
|
|
1070
|
+
font-size: var(--t-xs);
|
|
1071
|
+
text-align: left;
|
|
1072
|
+
flex: none;
|
|
1073
|
+
}
|
|
1074
|
+
.tbl.stack td.max {
|
|
1075
|
+
max-width: none;
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
/* ---------- details / empty / skeleton / code ---------- */
|
|
1080
|
+
details.fold {
|
|
1081
|
+
border-radius: var(--r-3);
|
|
1082
|
+
background: var(--surface);
|
|
1083
|
+
}
|
|
1084
|
+
details.fold + details.fold,
|
|
1085
|
+
.card + details.fold,
|
|
1086
|
+
details.fold + .card {
|
|
1087
|
+
margin-top: var(--sp-3);
|
|
1088
|
+
}
|
|
1089
|
+
details.fold > summary {
|
|
1090
|
+
display: flex;
|
|
1091
|
+
align-items: center;
|
|
1092
|
+
gap: var(--sp-3);
|
|
1093
|
+
min-height: var(--ctl);
|
|
1094
|
+
padding: var(--sp-2) var(--sp-5);
|
|
1095
|
+
cursor: pointer;
|
|
1096
|
+
list-style: none;
|
|
1097
|
+
font-weight: 600;
|
|
1098
|
+
font-size: var(--t-md);
|
|
1099
|
+
border-radius: var(--r-3);
|
|
1100
|
+
}
|
|
1101
|
+
details.fold > summary::-webkit-details-marker {
|
|
1102
|
+
display: none;
|
|
1103
|
+
}
|
|
1104
|
+
details.fold > summary .ic {
|
|
1105
|
+
transition: transform var(--ease);
|
|
1106
|
+
color: var(--text-3);
|
|
1107
|
+
}
|
|
1108
|
+
details.fold[open] > summary .ic {
|
|
1109
|
+
transform: rotate(90deg);
|
|
1110
|
+
}
|
|
1111
|
+
details.fold > .fb {
|
|
1112
|
+
padding: 0 var(--sp-5) var(--sp-5);
|
|
1113
|
+
}
|
|
1114
|
+
.empty {
|
|
1115
|
+
display: grid;
|
|
1116
|
+
justify-items: start;
|
|
1117
|
+
gap: var(--sp-3);
|
|
1118
|
+
padding: var(--sp-2) 0;
|
|
1119
|
+
}
|
|
1120
|
+
.empty .ei {
|
|
1121
|
+
width: 2.25rem;
|
|
1122
|
+
height: 2.25rem;
|
|
1123
|
+
border-radius: var(--r-2);
|
|
1124
|
+
background: var(--fill);
|
|
1125
|
+
color: var(--text-3);
|
|
1126
|
+
display: grid;
|
|
1127
|
+
place-items: center;
|
|
1128
|
+
}
|
|
1129
|
+
.empty .ei .ic {
|
|
1130
|
+
width: 1.125rem;
|
|
1131
|
+
height: 1.125rem;
|
|
1132
|
+
}
|
|
1133
|
+
.empty h2 {
|
|
1134
|
+
font-size: var(--t-md);
|
|
1135
|
+
font-weight: 600;
|
|
1136
|
+
}
|
|
1137
|
+
.empty p {
|
|
1138
|
+
color: var(--text-3);
|
|
1139
|
+
font-size: var(--t-sm);
|
|
1140
|
+
max-width: 56ch;
|
|
1141
|
+
}
|
|
1142
|
+
.sk {
|
|
1143
|
+
background: var(--fill);
|
|
1144
|
+
border-radius: var(--r-2);
|
|
1145
|
+
animation: pulse 1.4s ease-in-out infinite;
|
|
1146
|
+
}
|
|
1147
|
+
@keyframes pulse {
|
|
1148
|
+
50% {
|
|
1149
|
+
opacity: 0.45;
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
.code {
|
|
1153
|
+
position: relative;
|
|
1154
|
+
background: var(--fill);
|
|
1155
|
+
border-radius: var(--r-2);
|
|
1156
|
+
padding: var(--sp-3) 3rem var(--sp-3) var(--sp-3);
|
|
1157
|
+
}
|
|
1158
|
+
.code pre {
|
|
1159
|
+
margin: 0;
|
|
1160
|
+
font: 400 var(--t-xs) / 1.6 var(--mono);
|
|
1161
|
+
white-space: pre-wrap;
|
|
1162
|
+
word-break: break-all;
|
|
1163
|
+
}
|
|
1164
|
+
.code .btn {
|
|
1165
|
+
position: absolute;
|
|
1166
|
+
top: var(--sp-1);
|
|
1167
|
+
right: var(--sp-1);
|
|
1168
|
+
}
|
|
1169
|
+
code {
|
|
1170
|
+
font-family: var(--mono);
|
|
1171
|
+
font-size: 0.9em;
|
|
1172
|
+
background: var(--fill);
|
|
1173
|
+
padding: 0.1rem 0.35rem;
|
|
1174
|
+
border-radius: var(--r-1);
|
|
1175
|
+
}
|
|
1176
|
+
.keybox {
|
|
1177
|
+
display: flex;
|
|
1178
|
+
align-items: center;
|
|
1179
|
+
gap: var(--sp-2);
|
|
1180
|
+
background: var(--accent-soft);
|
|
1181
|
+
border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line));
|
|
1182
|
+
border-radius: var(--r-2);
|
|
1183
|
+
padding: var(--sp-3);
|
|
1184
|
+
}
|
|
1185
|
+
.keybox code {
|
|
1186
|
+
background: transparent;
|
|
1187
|
+
padding: 0;
|
|
1188
|
+
font-size: var(--t-sm);
|
|
1189
|
+
word-break: break-all;
|
|
1190
|
+
flex: 1;
|
|
1191
|
+
min-width: 0;
|
|
1192
|
+
}
|
|
1193
|
+
.notice {
|
|
1194
|
+
display: flex;
|
|
1195
|
+
gap: var(--sp-3);
|
|
1196
|
+
align-items: flex-start;
|
|
1197
|
+
padding: var(--sp-3) var(--sp-4);
|
|
1198
|
+
border-radius: var(--r-2);
|
|
1199
|
+
background: var(--bad-soft);
|
|
1200
|
+
color: var(--text);
|
|
1201
|
+
font-size: var(--t-sm);
|
|
1202
|
+
}
|
|
1203
|
+
.notice .ic {
|
|
1204
|
+
color: var(--bad);
|
|
1205
|
+
margin-top: 0.15rem;
|
|
1206
|
+
}
|
|
1207
|
+
.notice.warn {
|
|
1208
|
+
background: var(--warn-soft);
|
|
1209
|
+
}
|
|
1210
|
+
.notice.warn .ic {
|
|
1211
|
+
color: var(--warn);
|
|
1212
|
+
}
|
|
1213
|
+
.err {
|
|
1214
|
+
color: var(--bad);
|
|
1215
|
+
font-size: var(--t-sm);
|
|
1216
|
+
min-height: 1.25rem;
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
/* ---------- accounts ---------- */
|
|
1220
|
+
.acct {
|
|
1221
|
+
container-type: inline-size;
|
|
1222
|
+
}
|
|
1223
|
+
.keyrow {
|
|
1224
|
+
display: grid;
|
|
1225
|
+
grid-template-columns: 9rem minmax(0, 1fr) auto;
|
|
1226
|
+
gap: var(--sp-3) var(--sp-4);
|
|
1227
|
+
align-items: center;
|
|
1228
|
+
padding: var(--sp-3) 0;
|
|
1229
|
+
border-top: 1px solid var(--hair);
|
|
1230
|
+
}
|
|
1231
|
+
.keyrow .kl {
|
|
1232
|
+
display: grid;
|
|
1233
|
+
gap: var(--sp-1);
|
|
1234
|
+
justify-items: start;
|
|
1235
|
+
}
|
|
1236
|
+
.keyrow .ki {
|
|
1237
|
+
min-width: 0;
|
|
1238
|
+
display: flex;
|
|
1239
|
+
align-items: center;
|
|
1240
|
+
gap: var(--sp-2);
|
|
1241
|
+
flex-wrap: wrap;
|
|
1242
|
+
font-size: var(--t-sm);
|
|
1243
|
+
color: var(--text-3);
|
|
1244
|
+
}
|
|
1245
|
+
.keyrow .ki code {
|
|
1246
|
+
max-width: 100%;
|
|
1247
|
+
overflow: hidden;
|
|
1248
|
+
text-overflow: ellipsis;
|
|
1249
|
+
white-space: nowrap;
|
|
1250
|
+
}
|
|
1251
|
+
.keyrow .ka {
|
|
1252
|
+
display: flex;
|
|
1253
|
+
gap: var(--sp-2);
|
|
1254
|
+
flex-wrap: wrap;
|
|
1255
|
+
}
|
|
1256
|
+
@container (max-width: 44rem) {
|
|
1257
|
+
.keyrow {
|
|
1258
|
+
grid-template-columns: minmax(0, 1fr);
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
.acct-h {
|
|
1262
|
+
display: flex;
|
|
1263
|
+
align-items: center;
|
|
1264
|
+
gap: var(--sp-3);
|
|
1265
|
+
flex-wrap: wrap;
|
|
1266
|
+
margin-bottom: var(--sp-3);
|
|
1267
|
+
}
|
|
1268
|
+
.acct-h h2 {
|
|
1269
|
+
font-size: var(--t-lg);
|
|
1270
|
+
font-weight: 600;
|
|
1271
|
+
letter-spacing: -0.01em;
|
|
1272
|
+
min-width: 0;
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
/* ---------- toasts ---------- */
|
|
1276
|
+
.toasts {
|
|
1277
|
+
position: fixed;
|
|
1278
|
+
z-index: 30;
|
|
1279
|
+
left: 50%;
|
|
1280
|
+
transform: translateX(-50%);
|
|
1281
|
+
bottom: max(var(--sp-4), env(safe-area-inset-bottom));
|
|
1282
|
+
display: grid;
|
|
1283
|
+
gap: var(--sp-2);
|
|
1284
|
+
width: min(26rem, calc(100% - 2rem));
|
|
1285
|
+
pointer-events: none;
|
|
1286
|
+
}
|
|
1287
|
+
@media (max-width: 56rem) {
|
|
1288
|
+
.toasts {
|
|
1289
|
+
bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + var(--sp-3));
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
.toast {
|
|
1293
|
+
pointer-events: auto;
|
|
1294
|
+
display: flex;
|
|
1295
|
+
align-items: flex-start;
|
|
1296
|
+
gap: var(--sp-3);
|
|
1297
|
+
padding: var(--sp-3) var(--sp-4);
|
|
1298
|
+
border-radius: var(--r-3);
|
|
1299
|
+
background: var(--text);
|
|
1300
|
+
color: var(--bg);
|
|
1301
|
+
font-size: var(--t-sm);
|
|
1302
|
+
box-shadow: 0 8px 28px rgb(0 0 0 / 0.28);
|
|
1303
|
+
animation: rise var(--ease);
|
|
1304
|
+
}
|
|
1305
|
+
.toast.bad {
|
|
1306
|
+
background: var(--bad);
|
|
1307
|
+
color: var(--surface);
|
|
1308
|
+
}
|
|
1309
|
+
@keyframes rise {
|
|
1310
|
+
from {
|
|
1311
|
+
opacity: 0;
|
|
1312
|
+
transform: translateY(0.5rem);
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
/* ---------- dialog (full-screen sheet on phones) ---------- */
|
|
1317
|
+
dialog.dlg {
|
|
1318
|
+
padding: 0;
|
|
1319
|
+
border: 0;
|
|
1320
|
+
border-radius: 1.125rem;
|
|
1321
|
+
background: var(--surface);
|
|
1322
|
+
color: var(--text);
|
|
1323
|
+
width: min(30rem, calc(100% - 2rem));
|
|
1324
|
+
max-height: calc(100dvh - 2rem);
|
|
1325
|
+
box-shadow: 0 16px 48px rgb(0 0 0 / 0.3);
|
|
1326
|
+
overflow: auto;
|
|
1327
|
+
}
|
|
1328
|
+
dialog.dlg::backdrop {
|
|
1329
|
+
background: rgb(8 12 16 / 0.5);
|
|
1330
|
+
}
|
|
1331
|
+
.dlg form,
|
|
1332
|
+
.dlg > div {
|
|
1333
|
+
display: grid;
|
|
1334
|
+
gap: var(--sp-4);
|
|
1335
|
+
padding: var(--sp-6);
|
|
1336
|
+
}
|
|
1337
|
+
.dlg h2 {
|
|
1338
|
+
font-size: var(--t-lg);
|
|
1339
|
+
font-weight: 600;
|
|
1340
|
+
letter-spacing: -0.01em;
|
|
1341
|
+
}
|
|
1342
|
+
.dlg .acts {
|
|
1343
|
+
display: flex;
|
|
1344
|
+
gap: var(--sp-2);
|
|
1345
|
+
justify-content: flex-end;
|
|
1346
|
+
flex-wrap: wrap;
|
|
1347
|
+
}
|
|
1348
|
+
@media (max-width: 40rem) {
|
|
1349
|
+
dialog.dlg {
|
|
1350
|
+
width: 100%;
|
|
1351
|
+
max-width: none;
|
|
1352
|
+
height: 100dvh;
|
|
1353
|
+
max-height: none;
|
|
1354
|
+
margin: 0;
|
|
1355
|
+
border: 0;
|
|
1356
|
+
border-radius: 0;
|
|
1357
|
+
}
|
|
1358
|
+
.dlg > div {
|
|
1359
|
+
min-height: 100dvh;
|
|
1360
|
+
align-content: start;
|
|
1361
|
+
padding: max(var(--sp-5), env(safe-area-inset-top)) max(var(--sp-5), env(safe-area-inset-right))
|
|
1362
|
+
max(var(--sp-5), env(safe-area-inset-bottom)) max(var(--sp-5), env(safe-area-inset-left));
|
|
1363
|
+
}
|
|
1364
|
+
.dlg .acts {
|
|
1365
|
+
position: sticky;
|
|
1366
|
+
bottom: 0;
|
|
1367
|
+
background: var(--surface);
|
|
1368
|
+
padding-top: var(--sp-3);
|
|
1369
|
+
}
|
|
1370
|
+
.dlg .acts .btn {
|
|
1371
|
+
flex: 1;
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
/* ---------- sign in ---------- */
|
|
1376
|
+
.auth {
|
|
1377
|
+
min-height: 100dvh;
|
|
1378
|
+
display: grid;
|
|
1379
|
+
place-items: center;
|
|
1380
|
+
padding: var(--sp-5) max(var(--sp-4), env(safe-area-inset-right)) var(--sp-5)
|
|
1381
|
+
max(var(--sp-4), env(safe-area-inset-left));
|
|
1382
|
+
}
|
|
1383
|
+
.auth .box {
|
|
1384
|
+
width: min(23.5rem, 100%);
|
|
1385
|
+
display: grid;
|
|
1386
|
+
gap: var(--sp-5);
|
|
1387
|
+
}
|
|
1388
|
+
.auth .brand {
|
|
1389
|
+
padding: 0;
|
|
1390
|
+
font-size: var(--t-lg);
|
|
1391
|
+
justify-content: center;
|
|
1392
|
+
}
|
|
1393
|
+
.auth .brand img {
|
|
1394
|
+
width: 2.25rem;
|
|
1395
|
+
height: 2.25rem;
|
|
1396
|
+
}
|
|
1397
|
+
.auth .card {
|
|
1398
|
+
display: grid;
|
|
1399
|
+
gap: var(--sp-4);
|
|
1400
|
+
padding: var(--sp-6);
|
|
1401
|
+
}
|
|
1402
|
+
.auth h1 {
|
|
1403
|
+
font-size: var(--t-xl);
|
|
1404
|
+
font-weight: 600;
|
|
1405
|
+
letter-spacing: -0.02em;
|
|
1406
|
+
}
|
|
1407
|
+
.auth p.lead {
|
|
1408
|
+
margin: calc(var(--sp-2) * -1) 0 0;
|
|
1409
|
+
}
|
|
1410
|
+
.auth .foot {
|
|
1411
|
+
text-align: center;
|
|
1412
|
+
font-size: var(--t-xs);
|
|
1413
|
+
color: var(--text-3);
|
|
1414
|
+
line-height: 1.6;
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
@media (pointer: coarse), (max-width: 56rem) {
|
|
1418
|
+
.tab {
|
|
1419
|
+
min-height: var(--ctl);
|
|
1420
|
+
min-width: var(--ctl);
|
|
1421
|
+
padding: 0 var(--sp-4);
|
|
1422
|
+
}
|
|
1423
|
+
.btn.sm {
|
|
1424
|
+
min-height: var(--ctl);
|
|
1425
|
+
}
|
|
1426
|
+
.top .brand,
|
|
1427
|
+
.top .sumv,
|
|
1428
|
+
.side-sum {
|
|
1429
|
+
min-height: var(--ctl);
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1433
|
+
*,
|
|
1434
|
+
*::before,
|
|
1435
|
+
*::after {
|
|
1436
|
+
animation-duration: 0.001ms !important;
|
|
1437
|
+
animation-iteration-count: 1 !important;
|
|
1438
|
+
transition-duration: 0.001ms !important;
|
|
1439
|
+
}
|
|
1440
|
+
.sk {
|
|
1441
|
+
animation: none;
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
</style>
|
|
1445
|
+
</head>
|
|
1446
|
+
<body>
|
|
1447
|
+
<noscript><p style="padding:1rem">Mistwatch needs JavaScript.</p></noscript>
|
|
1448
|
+
<div id="app"></div>
|
|
1449
|
+
<div class="toasts" id="toasts" role="status" aria-live="polite"></div>
|
|
1450
|
+
<div class="toasts" id="alerts" role="alert" style="bottom:calc(max(1rem,env(safe-area-inset-bottom)) + 0px)"></div>
|
|
1451
|
+
<script type="module">
|
|
1452
|
+
"use strict";
|
|
1453
|
+
var D=encodeURIComponent,He=(t,s)=>`${t} ${s}${t===1?"":"s"}`,h=t=>`\u20AC${(t??0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`,ae=t=>t<.01?`\u20AC${t.toFixed(5)}`:h(t),G=t=>t?new Date(t*1e3).toLocaleString("en-GB",{day:"numeric",month:"numeric",hour:"2-digit",minute:"2-digit"}):"\u2014",ye=t=>{if(!t)return"never";let s=Date.now()/1e3-t;return s<90?"just now":s<5400?`${Math.round(s/60)} min ago`:s<129600?`${Math.round(s/3600)} h ago`:`${Math.round(s/86400)} d ago`},oe=t=>Math.max(0,Math.min(100,t)),fe=t=>t>=100?`\u20AC${Math.round(t)}`:t>=10?`\u20AC${t.toFixed(0)}`:t>=1?`\u20AC${t.toFixed(1).replace(/\.0$/,"")}`:`\u20AC${t.toFixed(2)}`,Ke=t=>{if(t<=0)return 1;let s=10**Math.floor(Math.log10(t));for(let n of[1,1.5,2,3,5,7.5,10])if(t<=n*s)return n*s;return 10*s},$=t=>t instanceof Error?t.message:String(t);var R={me:null,sumTimer:0},re=()=>{},E={boot:async()=>null,pause:re,resume:re,dispose:re},Se=()=>{E.dispose(),E.pause=re,E.resume=re,E.dispose=re},ie={get:(t,s)=>{try{return localStorage.getItem(`mw.${t}`)||s}catch{return s}},set:(t,s)=>{try{localStorage.setItem(`mw.${t}`,s)}catch{}}};var le=class extends Error{status;constructor(s,n){super(s),this.name="ApiError",this.status=n}},De=(t,s)=>{let n=t[s];return typeof n=="string"?n:void 0},g=async(t,s,n)=>{let a=await fetch(`/api${s}`,{method:t,credentials:"same-origin",headers:{"content-type":"application/json","x-mw":"1"},body:n===void 0?null:JSON.stringify(n)}),r=null;try{r=await a.json()}catch{}if(a.status===401&&s!=="/login")throw R.me=null,E.boot(),new le("Your session has expired.",401);if(!a.ok){let o=typeof r=="object"&&r!==null?De(r,"detail")??De(r,"message"):void 0;throw new le(o??`Error ${a.status}`,a.status)}return r},p={session:()=>g("GET","/session"),setup:t=>g("POST","/setup",t),login:t=>g("POST","/login",t),logout:()=>g("POST","/logout"),password:t=>g("POST","/password",t),users:()=>g("GET","/users"),addUser:t=>g("POST","/users",t),delUser:t=>g("DELETE",`/users/${t}`),status:()=>g("GET","/status"),summary:()=>g("GET","/summary"),usage:(t,s)=>g("GET",`/usage?range=${t}&by=${s}`),ledger:t=>g("GET",`/ledger?limit=${t}`),models:t=>g("GET",`/models${t?"?all=true":""}`),renameModel:(t,s)=>g("PUT",`/models/${D(t)}`,s),resetModel:t=>g("DELETE",`/models/${D(t)}`),refreshModels:()=>g("POST","/models-refresh"),sync:()=>g("POST","/sync"),accounts:()=>g("GET","/accounts"),addAccount:t=>g("POST","/accounts",{name:t}),patchAccount:(t,s)=>g("PATCH",`/accounts/${D(t)}`,s),delAccount:t=>g("DELETE",`/accounts/${D(t)}`),putKey:(t,s,n)=>g("PUT",`/accounts/${D(t)}/keys/${s}`,n),delKey:(t,s)=>g("DELETE",`/accounts/${D(t)}/keys/${s}`),startSignin:t=>g("POST",`/accounts/${D(t)}/signin`),signinStatus:t=>g("GET",`/signin/${D(t)}`),signinCancel:t=>g("DELETE",`/signin/${D(t)}`),agentConfig:()=>g("GET","/agent-config"),apikeys:()=>g("GET","/apikeys"),newApikey:t=>g("POST","/apikeys",{name:t}),delApikey:t=>g("DELETE",`/apikeys/${t}`)},be=async()=>{await p.logout(),R.me=null,E.boot()};var Ne=(t,s)=>s==null||typeof s=="function"?null:typeof s=="boolean"?t.startsWith("aria-")?String(s):s?"":null:String(s);var e=(t,s,...n)=>{let a=document.createElement(t);for(let[o,i]of Object.entries(s??{})){let l=Ne(o,i);if(o.startsWith("on")&&typeof i=="function")a.addEventListener(o.slice(2),i);else{if(l===null)continue;o==="class"?a.className=l:o==="value"?a.value=i:o==="checked"||o==="disabled"||o==="selected"||o==="hidden"?Reflect.set(a,o,!0):a.setAttribute(o,l)}}let r=o=>{if(!(o==null||o===!1)){if(Array.isArray(o)){for(let i of o)r(i);return}a.append(o instanceof Node?o:String(o))}};for(let o of n)r(o);return a},H=(t,s,...n)=>{let a=document.createElementNS("http://www.w3.org/2000/svg",t);for(let[r,o]of Object.entries(s??{}))a.setAttribute(r,String(o));for(let r of n)r!=null&&a.append(r instanceof Node?r:String(r));return a},rt={overview:'<rect x="3" y="3" width="7" height="9" rx="1.5"/><rect x="14" y="3" width="7" height="5" rx="1.5"/><rect x="14" y="12" width="7" height="9" rx="1.5"/><rect x="3" y="16" width="7" height="5" rx="1.5"/>',accounts:'<circle cx="9" cy="8" r="3.5"/><path d="M2.5 20c.6-3.6 3.2-5.5 6.5-5.5s5.9 1.9 6.5 5.5M16 4.6a3.5 3.5 0 0 1 0 6.8M18.5 14.8c1.7.7 2.8 2.4 3 5.2"/>',key:'<circle cx="8" cy="15" r="4"/><path d="m11 12 9-9m-3 3 3 3"/>',settings:'<path d="M4 6h8M18 6h2M4 12h2M12 12h8M4 18h10M20 18h0"/><circle cx="15" cy="6" r="2"/><circle cx="9" cy="12" r="2"/><circle cx="17" cy="18" r="2"/>',check:'<path d="m5 12.5 4.5 4.5L19 7.5"/>',alert:'<path d="M12 4 2.8 19.5h18.4z"/><path d="M12 10v4.5M12 17.4v.1"/>',x:'<path d="m6 6 12 12M18 6 6 18"/>',info:'<circle cx="12" cy="12" r="9"/><path d="M12 11v5M12 8v.1"/>',copy:'<rect x="9" y="9" width="11" height="11" rx="2"/><path d="M5 15V6a2 2 0 0 1 2-2h8"/>',download:'<path d="M12 4v11m0 0-4-4m4 4 4-4M5 19h14"/>',refresh:'<path d="M20 11a8 8 0 0 0-14.5-4M4 4v4h4M4 13a8 8 0 0 0 14.5 4M20 20v-4h-4"/>',plus:'<path d="M12 5v14M5 12h14"/>',trash:'<path d="M4 7h16M10 11v6M14 11v6M6 7l1 13h10l1-13M9 7V4h6v3"/>',logout:'<path d="M9 4H5v16h4M16 8l4 4-4 4M20 12H9"/>',chevron:'<path d="m9 6 6 6-6 6"/>',clock:'<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/>'},y=t=>{let s=H("svg",{class:"ic",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false"});return s.innerHTML=rt[t],s},pe=()=>e("img",{src:"/favicon.svg",alt:"",width:24,height:24,"aria-hidden":"true"}),L=(t,s=document)=>s.querySelector(t),Ue=t=>Object.keys(t),V=t=>Object.entries(t);var W={vibe:"Vibe Code",api:"Studio (API)"},it={"5h":"5 hours",day:"Day",week:"Week"},ve={"24h":"24 hours","7d":"7 days","30d":"30 days"},qe={model:"Model",client:"API key",account:"Account",pool:"Budget"},Ge={"24h":1,"7d":7,"30d":30},Ve={"vibe-cli":"Vibe CLI sign-in (updates automatically)",keyring:"saved on this computer",env:"environment setting",inline:"app data"},We={custom:["custom","info"],"built-in":["built-in",""],mistral:["from Mistral",""],auto:["auto",""]},Be=["var(--s1)","var(--s2)","var(--s3)","var(--s4)","var(--s5)","var(--s6)"],Fe=30.44,z=t=>t==="vibe"||t==="api"?W[t]:t,je=t=>t==="5h"||t==="day"||t==="week"?it[t]:t,we=(t,s)=>t==="other"?"var(--s-other)":Be[s%Be.length]??"var(--s-other)",$e=t=>t==="24h"||t==="30d"?t:"7d",Ee=t=>t==="client"||t==="account"||t==="pool"?t:"model",Re="Mistwatch is an independent, unofficial tool. It is not affiliated with, endorsed by or sponsored by Mistral AI. \u201CMistral\u201D is a trademark of Mistral AI.",Ye=()=>e("footer",{class:"legal"},e("p",{},Re));var lt=0,ce=t=>{let s=e("dialog",{class:"dlg"},e("div",{},t)),n=s.querySelector("h2");return n&&(n.id=`dlg-title-${++lt}`,s.setAttribute("aria-labelledby",n.id)),s.addEventListener("close",()=>s.remove()),s.addEventListener("click",a=>{a.target===s&&s.close()}),document.body.append(s),s.showModal(),s.remove=()=>{s.open?s.close():HTMLElement.prototype.remove.call(s)},s},J=t=>{let{title:s,body:n,ok:a="Confirm",danger:r=!1}=t;return new Promise(o=>{let i=!1,l=c=>{i||(i=!0,o(c)),d.remove()},d=ce([e("h2",{},s),e("p",{class:"mut sm"},n),e("div",{class:"acts"},e("button",{class:"btn",onclick:()=>l(!1)},"Cancel"),e("button",{class:`btn ${r?"danger solid":"pri"}`,onclick:()=>l(!0)},a))]);d.addEventListener("close",()=>l(!1))})};var k=(t,s)=>{let n=document.querySelector(s?"#alerts":"#toasts");if(!n)return;let a=e("div",{class:`toast${s?" bad":""}`},y(s?"alert":"check"),e("span",{},t));n.replaceChildren(a),setTimeout(()=>a.remove(),s?7e3:3200)};var ct={ok:"check",warn:"alert",bad:"x",info:"info"},M=(t,s,n=null)=>{let a=ct[t];return e("span",{class:`badge ${t||""}`,title:n},a?y(a):null,s)},v=t=>async(...s)=>{try{await t(...s)}catch(n){k($(n),!0)}},dt=t=>{let s=t.closest("dialog");if(!s){k("Copy failed",!0);return}let n=L(".copy-err",s)??s.firstElementChild?.appendChild(e("p",{class:"err sm copy-err",role:"alert"}));n&&(n.textContent="Copy failed. Select the text and copy it by hand.")},Q=t=>{let s=document.activeElement;return s instanceof HTMLElement&&t.contains(s)?s.dataset.fk??"":null},X=(t,s)=>{if(s===null||document.activeElement&&document.activeElement!==document.body)return;let n=[...t.querySelectorAll("[data-fk]")].find(a=>a.dataset.fk===s)??L("#main h1");n&&(n.matches("a,button,input,select,textarea,[tabindex]")||(n.tabIndex=-1),n.focus())},ze=(t,s="Copy")=>{let n=e("button",{class:"btn ghost icon",type:"button","aria-label":s,title:s});return n.append(y("copy")),n.addEventListener("click",async()=>{try{await navigator.clipboard.writeText(t)}catch{dt(n);return}L(".copy-err",n.closest("dialog")??n)?.remove(),n.replaceChildren(y("check")),n.setAttribute("aria-label","Copied"),k("Copied to clipboard"),setTimeout(()=>{n.replaceChildren(y("copy")),n.setAttribute("aria-label",s)},1600)}),n},Te=t=>e("div",{class:"code"},e("pre",{},t),ze(t)),F=(t,s,...n)=>e("div",{class:"page-h"},e("div",{class:"grow"},e("h1",{},t),s?e("p",{},s):null),n.length?e("div",{class:"act row"},n):null),U=(t,s,n,...a)=>e("div",{class:"empty"},e("div",{class:"ei"},y(t)),e("h2",{},s),e("p",{},n),a.length?e("div",{class:"row"},a):null),w=(t,s="1rem")=>e("div",{class:"sk",style:`width:${t};height:${s}`}),j=(t,s)=>e("div",{class:"card"},U("alert","Could not load this page",t,e("button",{class:"btn",onclick:s},y("refresh"),"Try again"))),Le=(t,s,...n)=>e("details",{class:"fold"},e("summary",{},y("chevron"),e("span",{},t),s?e("span",{class:"mut sm"},s):null),e("div",{class:"fb"},n)),b=(t,s,...n)=>e("td",{"data-l":t,class:s||""},n),ke=(t,s,n)=>{let a=ce([e("h2",{},n?"Account created. Your first API key":`Key "${t}"`),e("div",{class:"keybox"},e("code",{},s),ze(s,"Copy key")),e("p",{class:"sm mut"},"Copy it now. You will not be able to see it again."),e("div",{class:"acts"},e("button",{class:"btn pri",onclick:()=>a.remove()},"Done"))])};var Je=async t=>{let s=e("div",{class:"stack"},e("div",{class:"card"},w("30%","1.25rem"),e("div",{style:"height:1rem"}),w("100%","4rem")));t.append(F("Accounts","Vibe Code uses the key from the Vibe CLI sign-in and the subscription budget. Studio (API) uses a key from console.mistral.ai and a separate API budget."),s);let n=async()=>{let a=Q(s),r;try{r=await p.accounts()}catch(d){s.replaceChildren(j($(d),n));return}let o=e("input",{class:"input",id:"an","data-fk":"add-name",placeholder:"name or e-mail",autocomplete:"off",spellcheck:"false","aria-label":"Account name"}),i=v(async()=>{await p.addAccount(o.value),k("Account added"),n()});o.addEventListener("keydown",d=>{d.key==="Enter"&&i()});let l=e("div",{class:"card"},e("div",{class:"card-h"},e("h2",{},"Add an account")),e("div",{class:"field-row"},e("label",{class:"f",for:"an"},"Name",o),e("button",{class:"btn pri","data-fk":"add",onclick:i},y("plus"),"Add account")),e("p",{class:"xs mut",style:"margin-top:var(--sp-2)"},"1\u201380 characters: letters, digits and . _ + @ -"));s.replaceChildren(...r.accounts.length?r.accounts.map(d=>ut(d,r.vibe_cli_available,n)):[],l),r.accounts.length||s.prepend(e("div",{class:"card"},U("accounts","No accounts yet","An account is one Mistral login. Add one below, then connect its Vibe Code and Studio keys."))),X(s,a)};n()},ut=(t,s,n)=>{let a=d=>`${t.name}:${d}`,r=e("input",{class:"input short",type:"number",inputmode:"numeric",value:t.priority,id:`pr-${t.name}`,"data-fk":a("priority"),title:"Lower number is used first"}),o=String(t.priority);r.addEventListener("change",v(async()=>{let d=r.value.trim();try{if(!/^-?\d+$/.test(d))throw new Error("Priority must be a whole number.");await p.patchAccount(t.name,{priority:Number(d)})}catch(c){throw r.value=o,c}o=d,k("Priority saved")}));let i=e("button",{class:"switch",role:"switch",type:"button","aria-checked":String(!!t.enabled),"aria-label":"Enabled","data-fk":a("enabled"),onclick:v(async()=>{await p.patchAccount(t.name,{enabled:!t.enabled}),n()})}),l=d=>{let c=t.keys[d],u=e("div",{class:"kl"},e("b",{class:"sm"},W[d]),c?c.ok?M("ok","Connected"):M("bad","Can't read key"):M("","Missing")),m=e("div",{class:"ki"},c?[e("code",{title:c.hint??""},c.hint||"\u2014"),e("span",{},`\xB7 ${Ve[c.source]??c.source}`),c.error?e("span",{class:"tx-bad"},`\xB7 ${c.error}`):null]:"No key"),f=[];return d==="vibe"&&f.push(e("button",{class:"btn","data-fk":a(`${d}-signin`),onclick:()=>mt(t.name,n)},c?"Sign in again":"Sign in with Mistral")),d==="vibe"&&s&&!(c&&c.source==="vibe-cli")&&f.push(e("button",{class:"btn","data-fk":a("vibe-cli"),onclick:v(async()=>{let P=await p.putKey(t.name,"vibe",{source:"vibe-cli"});k(`Connected to Vibe CLI${Ce(P)}`),n()})},"Use Vibe CLI")),f.push(e("button",{class:"btn","data-fk":a(`${d}-paste`),onclick:()=>pt(t.name,d,n)},c?"Change key":"Paste key")),c&&f.push(e("button",{class:"btn ghost danger","data-fk":a(`${d}-remove`),"aria-label":`Remove ${W[d]} key`,onclick:v(async()=>{await J({title:"Remove this key?",body:`The ${W[d]} key of ${t.name} will be forgotten. Budget tracking for it stops until you add a key again.`,ok:"Remove key",danger:!0})&&(await p.delKey(t.name,d),n())})},"Remove")),e("div",{class:"keyrow"},u,m,e("div",{class:"ka"},f))};return e("section",{class:"card acct","aria-label":`Account ${t.name}`},e("div",{class:"acct-h"},e("h2",{class:"trunc",title:t.name},t.name),t.enabled?null:M("warn","Disabled"),t.shared_with.length?e("span",{class:"badge info",title:"Same Mistral account, counted as one budget"},`shares budget with ${t.shared_with.join(", ")}`):null,e("span",{class:"grow"}),e("label",{class:"row nw sm mut",style:"gap:var(--sp-2)"},"Priority",r),e("label",{class:"row nw sm mut",style:"gap:var(--sp-2)"},"Enabled",i),e("button",{class:"btn ghost danger icon","data-fk":a("delete"),"aria-label":`Delete account ${t.name}`,title:"Delete account",onclick:v(async()=>{await J({title:`Delete ${t.name}?`,body:"The account and its keys are removed. Usage history is kept.",ok:"Delete account",danger:!0})&&(await p.delAccount(t.name),n())})},y("trash"))),l("vibe"),l("api"))},Ce=t=>{let s=V(t.synced??{}).map(([n,a])=>`${z(n)}: ${h(a.used)} / ${h(a.initial)}`);return s.length?` \xB7 ${s.join(", ")}`:""},mt=async(t,s)=>{let n=window.open("","_blank"),a;try{a=await p.startSignin(t)}catch(d){n?.close(),k($(d),!0);return}n&&(n.opener=null,n.location.href=a.sign_in_url);let r=e("p",{class:"mut sm",role:"status"},"Waiting for sign-in in the browser\u2026"),o=!1,i=!1,l=ce([e("h2",{},"Sign in with Mistral"),e("p",{class:"mut sm"},"In the new tab, sign in to Mistral and choose a workspace. This page finishes automatically."),e("a",{href:a.sign_in_url,target:"_blank",rel:"noopener",class:"sm"},"Open the sign-in page again"),r,e("div",{class:"acts"},e("button",{class:"btn",onclick:()=>l.remove()},"Cancel"))]);for(l.addEventListener("close",()=>{o=!0,i||p.signinCancel(a.id).catch(()=>null)});!o&&document.body.contains(l);){if(await new Promise(c=>setTimeout(c,2e3)),o)return;let d;try{d=await p.signinStatus(a.id)}catch(c){r.textContent=$(c),r.className="err";return}if(d.status==="done"){o=!0,i=!0,l.remove(),k(`Signed in${Ce(d)}`),s();return}if(!["pending","exchanging"].includes(d.status)){o=!0,r.textContent=d.message||"Sign-in failed.",r.className="err";return}d.status==="exchanging"&&(r.textContent="Finishing\u2026")}},pt=(t,s,n)=>{let a=e("input",{class:"input",id:"pk",type:"password",placeholder:s==="vibe"?"Vibe CLI key":"API key from console.mistral.ai",autocomplete:"off",spellcheck:"false"}),r=e("div",{class:"err",role:"alert"}),o=e("button",{class:"btn pri",onclick:async()=>{o.disabled=!0,r.textContent="";try{let l=await p.putKey(t,s,{key:a.value});i.remove(),k(`Key saved${Ce(l)}`),n()}catch(l){r.textContent=$(l),o.disabled=!1}}},"Verify and save"),i=ce([e("h2",{},`${W[s]} key`),e("p",{class:"mut sm"},`For account ${t}. Mistwatch checks the key with Mistral, then stores it securely on this computer. It is never shown in full.`),e("label",{class:"f",for:"pk"},"Key",a),r,e("div",{class:"acts"},e("button",{class:"btn",onclick:()=>i.remove()},"Cancel"),o)]);a.addEventListener("keydown",l=>{l.key==="Enter"&&o.click()}),a.focus()};var Ae=t=>{let s=t==="setup",n=e("input",{class:"input",id:"u",autocomplete:"username",autocapitalize:"none",spellcheck:"false",required:!0}),a=e("input",{class:"input",id:"p",type:"password",autocomplete:s?"new-password":"current-password",required:!0}),r=s?e("input",{class:"input",id:"p2",type:"password",autocomplete:"new-password",required:!0}):null,o=e("div",{class:"err",role:"alert"}),i=e("button",{class:"btn pri wide",type:"submit"},s?"Create account":"Sign in"),l,d=u=>{clearInterval(l);let m=u;i.disabled=!0;let f=()=>{if(!i.isConnected){clearInterval(l);return}if(m<=0){clearInterval(l),i.disabled=!1,o.replaceChildren();return}o.replaceChildren(e("div",{class:"notice warn"},y("clock"),e("span",{},`Too many attempts. Try again in ${m} s.`))),m--};f(),l=setInterval(f,1e3)},c=async u=>{if(u.preventDefault(),o.replaceChildren(),s&&r&&a.value!==r.value){o.textContent="Passwords do not match.";return}i.disabled=!0;try{let m=s?await p.setup({username:n.value,password:a.value}):await p.login({username:n.value,password:a.value}),f=await E.boot();"api_key"in m&&m.api_key&&ke(m.api_key.name,m.api_key.secret,!0),f!==null&&i.isConnected&&(o.textContent=f,i.disabled=!1)}catch(m){let P=(m instanceof le&&m.status===429?/(\d+)\s*s/.exec(m.message):null)?.[1];P?d(Number(P)):(o.textContent=$(m),i.disabled=!1)}};L("#app")?.replaceChildren(e("div",{class:"auth"},e("div",{class:"box"},e("div",{class:"brand"},pe(),"Mistwatch"),e("form",{class:"card",onsubmit:c,novalidate:!0},e("h1",{},s?"Create your account":"Sign in"),s?e("p",{class:"lead"},"Create the first account. It manages keys and limits."):null,e("label",{class:"f",for:"u"},"Username",n),e("label",{class:"f",for:"p"},"Password",a),s?e("label",{class:"f",for:"p2"},"Password again",r):null,s?e("p",{class:"xs mut"},"At least 10 characters."):null,o,i),e("p",{class:"foot"},Re)))),n.focus()};var Qe=()=>{let t=0;return{next:()=>++t,isCurrent:s=>s===t}},Xe=(t,s,n)=>t<=0?null:n==="ArrowRight"?(s+1)%t:n==="ArrowLeft"?(s+t-1)%t:null;var Ze=t=>t.querySelector("summary span")?.textContent??"",Pe=(t,s)=>{if(t.contains(document.activeElement))return;let n=new Set([...t.querySelectorAll("details[open]")].map(Ze));t.replaceChildren(...s);for(let a of t.querySelectorAll("details"))a.open=n.has(Ze(a))},ht=(t,s)=>{let n=Ue(ve);s.id="chart-panel",s.setAttribute("role","tabpanel");let a=n.map(l=>e("button",{class:"tab",role:"tab",id:`range-${l}`,"aria-controls":s.id,onclick:()=>t("range",l)},l)),r=e("div",{class:"tabs",role:"tablist","aria-label":"Time range"},a);r.addEventListener("keydown",l=>{let d=a.findIndex(m=>m===document.activeElement),c=Xe(a.length,d,l.key),u=c===null?void 0:n[c];u!==void 0&&(l.preventDefault(),a[c??0]?.focus(),t("range",u))});let o=e("select",{class:"input",style:"width:auto","aria-label":"Split spending by",onchange:()=>t("by",o.value)},V(qe).map(([l,d])=>e("option",{value:l},`by ${d.toLowerCase()}`))),i=(l,d)=>{a.forEach((c,u)=>{let m=n[u]===l;c.setAttribute("aria-selected",String(m)),c.tabIndex=m?0:-1}),s.setAttribute("aria-labelledby",`range-${l}`),o.value!==d&&(o.value=d)};return{head:e("div",{class:"card-h"},e("h2",{},"Spending"),e("span",{class:"grow"}),r,o),sync:i}},et=async t=>{let s=$e(ie.get("range","7d")),n=Ee(ie.get("by","model")),a={range:s,by:n},r=!0,o=0,i=Qe(),l=e("p",{},"Loading\u2026"),d=e("div",{class:"stack"},gt()),c=()=>e("div",{style:"display:contents"}),u=c(),m=c(),f=c(),_=ht((I,T)=>{I==="range"?s=$e(T):n=Ee(T),ie.set(I,T),_.sync(s,n),N(B=>{({range:s,by:n}=a),ie.set("range",s),ie.set("by",n),_.sync(s,n),k($(B),!0)})},m),C=e("section",{class:"card","aria-label":"Spending over time"},_.head,m);_.sync(s,n);let N=async I=>{let T=i.next(),[B,q]=[s,n],ee,O,ue;try{[ee,O,ue]=await Promise.all([p.status(),p.usage(B,q),p.ledger(18)])}catch(S){if(!r||!i.isCurrent(T)||!d.isConnected)return;d.dataset.ok?I?.(S):d.replaceChildren(j($(S),()=>{N()}));return}if(!r||!i.isCurrent(T)||!d.isConnected)return;d.dataset.ok||d.replaceChildren(u,C,f),d.dataset.ok="1",a={range:B,by:q},l.textContent=`Last sync with Mistral: ${ee.last_sync?ye(ee.last_sync):"not yet"}`;let te=ft(ee,O,ue,B,q);C.hidden=!te.chart,Pe(u,te.top),Pe(m,te.chart??[]),Pe(f,te.rest)},de=e("button",{class:"btn",onclick:v(async()=>{k("Syncing with Mistral\u2026"),await p.sync(),N()})},y("refresh"),"Sync now"),Z=()=>{clearInterval(o),o=0},A=()=>{Z(),r&&!document.hidden&&(o=setInterval(()=>{N()},1e4))};E.pause=Z,E.resume=()=>{r&&(A(),N())},E.dispose=()=>{r=!1,Z()},t.append(F("Overview",l,de),d),await N(),A()},gt=()=>e("div",{class:"stack","aria-busy":"true","aria-label":"Loading"},e("div",{class:"strip"},[0,1,2,3].map(()=>e("div",{class:"cell"},w("40%",".75rem"),w("65%","1.75rem"),w("80%",".75rem")))),e("div",{class:"card"},w("30%","1rem"),e("div",{style:"height:1rem"}),w("100%","10rem")),e("div",{class:"cols"},e("div",{class:"card"},w("50%"),e("div",{style:"height:.75rem"}),w("100%","5rem")),e("div",{class:"card"},w("50%"),e("div",{style:"height:.75rem"}),w("100%","5rem")))),yt=t=>e("div",{class:"tw"},e("table",{class:"tbl stack"},e("thead",{},e("tr",{},e("th",{},"Period"),e("th",{class:"n"},"Spent"),e("th",{class:"n"},"Limit"),e("th",{class:"n"},"Left"),e("th",{},e("span",{class:"sr"},"Details")))),e("tbody",{},t.map(([s,n])=>e("tr",{},b("Period","",s),b("Spent","n",h(n.spent)),b("Limit","n",h(n.cap)),b("Left",`n ${n.room>0?"tx-ok":"tx-bad"}`,h(n.room)),b("","mut xs","retry_at"in n&&n.retry_at?`free from ${G(n.retry_at)}`:"")))))),ft=(t,s,n,a,r)=>{let o=t.summary,i=o.all;if(!i){let u=t.pools.length>0;return{chart:null,rest:[],top:[e("div",{class:"card"},u?U("alert","All accounts are disabled","Turn on at least one account to see its budget here.",e("a",{class:"btn pri",href:"#/accounts"},"Open accounts")):U("key","Nothing to watch yet","Add a Mistral account and key. Mistwatch will track your budget and help you spread it out.",e("a",{class:"btn pri",href:"#/accounts"},y("plus"),"Add an account")))]}}let l=t.pools.filter(u=>u.account===u.group),d=e("div",{class:"dash-split"},e("div",{class:"stack aside"},xt(o,l),kt(i)),n.length?e("div",{class:"card rec"},e("div",{class:"card-h"},e("h2",{},"Recent requests"),e("span",{class:"mut sm"},`latest ${n.length}`)),e("div",{class:"tw"},e("table",{class:"tbl stack"},e("thead",{},e("tr",{},e("th",{},"When"),e("th",{},"Key"),e("th",{},"Model"),e("th",{class:"n"},"Tokens in / out"),e("th",{class:"n"},"Cost"))),e("tbody",{},n.map(u=>e("tr",{},b("When","",G(u.ts)),b("Key","max trunc",u.client||"\u2014"),e("td",{"data-l":"Model",class:"max trunc",title:u.model??""},u.model_name??u.endpoint??"\u2014"),b("Tokens in / out","n",u.prompt_tokens!==null?`${u.prompt_tokens} / ${u.completion_tokens??0}`:"\u2014"),b("Cost","n",ae(u.cost_eur)))))))):e("div",{class:"card rec"},e("div",{class:"card-h"},e("h2",{},"Recent requests")),U("clock","No requests yet","Requests sent through Mistwatch show up here.",e("a",{class:"btn",href:"#/keys"},"Create an API key")))),c=e("div",{},Le("Limits per budget","spent and what is left",...l.map(u=>e("div",{style:"margin-bottom:var(--sp-4)"},e("div",{class:"sm mut",style:"margin:var(--sp-2) 0"},`${u.account} \xB7 ${z(u.pool)}`),yt([["Month",u.month],...V(u.windows).map(([m,f])=>[je(m),f])])))),t.by_client_7d.length?Le("Spend by key","last 7 days",e("div",{class:"tw"},e("table",{class:"tbl stack"},e("thead",{},e("tr",{},e("th",{},"Key"),e("th",{},"Account / budget"),e("th",{class:"n"},"Requests"),e("th",{class:"n"},"Cost"))),e("tbody",{},t.by_client_7d.map(u=>e("tr",{},b("Key","max trunc",u.client),b("Account / budget","max trunc",`${u.account} / ${z(u.pool)}`),b("Requests","n",u.n),b("Cost","n",h(u.cost_eur)))))))):null);return{top:[bt(i)],chart:vt(s,i,a,r),rest:[d,c]}},bt=t=>{let s=t.initial_eur?oe(t.used_eur/t.initial_eur*100):0,a=[["5 hours",t.windows["5h"]],["Day",t.windows.day],["Week",t.windows.week],["Month",t.month]].filter(([,d])=>d.cap>0).sort((d,c)=>d[1].room/d[1].cap-c[1].room/c[1].cap)[0],r=a?oe(a[1].spent/a[1].cap*100):0,o=t.reset_at,i=o?(o-Date.now()/1e3)/86400:null,l=(d,c,u,m,f)=>e("div",{class:"cell"},e("div",{class:"k"},d),e("div",{class:`v ${f||""}`},c),e("div",{class:"s"},u),m);return e("section",{class:"strip","aria-label":"Summary"},l("Spent this period",h(t.used_eur),`of ${h(t.initial_eur)} \xB7 ${s.toFixed(0)}% used`,e("div",{class:"mini"},e("i",{class:s>=90?"bad":s>=75?"warn":"",style:`width:${s}%`}))),l("Available now",h(t.room_eur),t.blocked?M("bad",`Blocked${t.retry_at?` until ${G(t.retry_at)}`:""}`):M("ok","Ready","Within every limit")),a?l("Closest limit",h(Math.max(a[1].room,0)),`${a[0]} \xB7 ${h(a[1].spent)} of ${h(a[1].cap)}`,e("div",{class:"mini"},e("i",{class:r>=95?"bad":r>=80?"warn":"",style:`width:${r}%`}))):null,i!==null&&o?l("Resets",i<1?"< 1 day":`in ${Math.round(i)} d`,new Date(o*1e3).toLocaleDateString("en-GB",{weekday:"short",day:"numeric",month:"short"})):null)},vt=(t,s,n,a)=>{let r=m=>a==="pool"?z(m):m,o=t.total/Ge[n],i=t.prev_total>0?(t.total-t.prev_total)/t.prev_total*100:null,l=s.fair_daily_eur>0&&o>s.fair_daily_eur,d=e("div",{class:"legend"},t.series.map((m,f)=>e("span",{},e("i",{style:`background:${we(m.name,f)}`}),e("span",{class:"trunc"},r(m.name)),e("span",{class:"mut num"},ae(m.total))))),c=e("div",{class:"chart"}),u=()=>wt(c,t,s,r);if(requestAnimationFrame(u),window.ResizeObserver){let m=new ResizeObserver(()=>{c.isConnected?u():m.disconnect()});m.observe(c)}return[e("div",{class:"row sm",style:"margin:calc(var(--sp-2)*-1) 0 var(--sp-3);gap:var(--sp-1) var(--sp-4)"},e("span",{},e("b",{class:"num"},h(t.total)),e("span",{class:"mut"},` in ${ve[n]} \xB7 ${He(t.requests,"request")}`)),i===null?null:e("span",{class:"mut"},`${i>=0?"up":"down"} ${Math.abs(i).toFixed(0)}% vs. previous`),s.fair_daily_eur>0?[e("span",{class:"mut num"},`avg ${h(o)}/day \xB7 target ${h(s.fair_daily_eur)}/day`),l?M("warn","Spending fast"):M("ok","On track")]:null),c,t.series.length?d:null].flatMap(m=>m?[m]:[])},wt=(t,s,n,a)=>{let r=Math.max(t.clientWidth||640,200),o=r<460,i=Math.round(Math.min(Math.max(r*.38,170),280)),l=o?36:44,d=4,c=10,u=24,m=s.buckets.length,f=r-l-d,P=i-c-u,_=s.buckets.map((S,x)=>s.series.reduce((se,me)=>se+(me.values[x]??0),0)),C=s.unit==="day"?n.fair_daily_eur:0,N=Math.max(..._,1e-4),de=C>0&&C<=N*2.5,Z=Ke(Math.max(N,de?C*1.05:0)),A=S=>c+P-S/Z*P,I=f/m,T=H("svg",{viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",role:"img","aria-label":`Spending over ${ve[s.range]}: total ${h(s.total)}`}),B=o?2:4;for(let S=0;S<=B;S++){let x=Z*S/B;T.append(H("line",{x1:l,x2:r-d,y1:A(x),y2:A(x),class:"g"}),H("text",{x:l-6,y:A(x)+4,class:"ax","text-anchor":"end"},fe(x)))}let q=S=>{let x=new Date(S*1e3);return s.unit==="hour"?x.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"}):x.toLocaleDateString("en-GB",s.range==="7d"&&!o?{weekday:"short",day:"numeric"}:{day:"numeric",month:o?"numeric":"short"})},ee=s.unit==="hour"?o?6:4:m<=7?o?2:1:o?7:5,O=e("div",{class:"tip",hidden:!0}),ue=null;s.buckets.forEach((S,x)=>{let se=l+x*I;(m-1-x)%ee===0&&T.append(H("text",{x:se+I/2,y:i-6,class:"ax","text-anchor":"middle"},q(S)));let me=0;s.series.forEach((ne,ge)=>{let K=ne.values[x]??0;if(K<=0)return;let ot=A(me),Oe=A(me+K);me+=K,T.append(H("rect",{x:se+I*.16,y:Oe,width:I*.68,height:Math.max(ot-Oe,1),rx:1.5,style:`fill:${we(ne.name,ge)}`}))});let Y=H("rect",{x:se,y:c,width:I,height:P,class:"hit"}),Ie=()=>{ue?.classList.remove("on"),Y.classList.add("on"),ue=Y;let ne=s.unit==="hour"?`${q(S)} \u2013 ${q(S+3600)}`:new Date(S*1e3).toLocaleDateString("en-GB",{weekday:"short",day:"numeric",month:"short"});O.replaceChildren(e("b",{},ne),...s.series.filter(K=>(K.values[x]??0)>0).map(K=>e("div",{},e("i",{style:`background:${we(K.name,s.series.indexOf(K))}`}),`${a(K.name)} ${ae(K.values[x]??0)}`)),e("div",{class:"t"},`Total ${ae(_[x]??0)}`)),O.hidden=!1;let ge=O.offsetWidth;O.style.left=`${Math.min(Math.max(se+I/2-ge/2,0),Math.max(r-ge,0))}px`,O.style.top=`${Math.max(A(_[x]??0)-O.offsetHeight-8,0)}px`},at=()=>{O.hidden=!0,Y.classList.remove("on")};Y.addEventListener("pointerenter",Ie),Y.addEventListener("pointerdown",Ie),Y.addEventListener("pointerleave",ne=>{ne.pointerType==="mouse"&&at()}),T.append(Y)}),C>0&&!de&&T.append(H("text",{x:r-d,y:c-1,class:"ax","text-anchor":"end"},`pace ${fe(C)}/day, above this chart`)),de&&T.append(H("line",{x1:l,x2:r-d,y1:A(C),y2:A(C),class:"pace"}),H("text",{x:r-d,y:A(C)-4,class:"ax","text-anchor":"end"},`pace ${fe(C)}`));let te=e("table",{class:"sr"},e("caption",{},`Spending per ${s.unit}`),e("tbody",{},s.buckets.map((S,x)=>e("tr",{},e("th",{scope:"row"},q(S)),e("td",{},ae(_[x]??0))))));t.replaceChildren(T,O,te),s.total||t.append(e("div",{class:"empty-chart"},"No spending in this period."))},kt=t=>{let s=[["5 hours",t.windows["5h"]],["Day",t.windows.day],["Week",t.windows.week],["Month",t.month]];return e("section",{class:"card","aria-label":"Limits right now"},e("div",{class:"card-h"},e("h2",{},"Limits right now")),e("p",{class:"mut sm",style:"margin:calc(var(--sp-2)*-1) 0 var(--sp-4)"},"How much you can spend in each time period. Unused budget raises the limits."),s.map(([n,a])=>{let r=a.cap>0?oe(a.spent/a.cap*100):100,o=r>=95?"bad":r>=80?"warn":"";return e("div",{class:"wrow"},e("div",{class:"sm"},n),e("div",{class:"min0"},e("div",{class:"mini"},e("i",{class:o,style:`width:${r}%`})),e("div",{class:"mut xs num",style:"margin-top:.25rem"},`${h(a.spent)} of ${h(a.cap)}`)),e("div",{class:`num sm ${a.room>0?"":"tx-bad"}`},a.room>0?`${h(a.room)} left`:M("bad","none left")))}))},xt=(t,s)=>{let n=s.map(r=>{let o=r.initial_eur||0,i=o?Math.min(1,r.used_eur/o):0,l=o?Math.max(0,(o-r.reserve_eur)/o):1,d=Math.min(1,Math.max(0,1-r.days_left/Fe)),c=(o-r.reserve_eur)*d,u=r.remaining_eur<=r.reserve_eur+.005||i>=l,m=!u&&r.used_eur>c*1.1+.5,f=u?"bad":m?"warn":"",P=r.enabled?r.blocked_by?M("bad",`Blocked: ${r.blocked_by}`):r.blocked_temporarily?M("warn","Paused"):u?M("bad","Used up"):m?M("warn","Spending fast"):M("ok","On track"):M("","Off"),_=e("div",{class:"pbar",role:"img","aria-label":`${h(r.used_eur)} of ${h(o)} used. Planned spending so far ${h(Math.max(c,0))}. Kept in reserve ${h(r.reserve_eur)}.`},e("i",{class:`fill ${f}`,style:`width:${i*100}%`}),e("i",{class:"res",style:`left:${l*100}%`}),e("i",{class:"mark",style:`left:${d*100}%`}));return e("div",{class:"prow"},e("div",{class:"row nw"},e("b",{class:"trunc",title:r.account},r.account),e("span",{class:"mut sm"},z(r.pool)),e("span",{class:"grow"}),e("b",{class:"num"},h(r.remaining_eur)),e("span",{class:"mut sm"},"left")),_,e("div",{class:"row",style:"gap:var(--sp-1) var(--sp-3)"},P,r.members.length>1?e("span",{class:"badge info",title:r.members.join(", ")},`${r.members.length} keys, one budget`):null,e("span",{class:"mut xs tnum"},`${h(r.used_eur)} of ${h(o)} \xB7 resets in ${Math.max(r.days_left,0).toFixed(0)} days \xB7 ${h(Math.max(r.room_eur,0))} available now`)))}),a=t.shared.map(r=>e("p",{class:"mut xs",style:"margin-top:var(--sp-3)"},`Counted as one budget: ${r.members.join(", ")}${r.confidence==="sure"?" (same usage)":" (probably the same account, nothing spent yet)"}`));return e("section",{class:"card","aria-label":"Budgets"},e("div",{class:"card-h"},e("h2",{},"Budgets")),n,a,e("div",{class:"keyline","aria-hidden":"true"},e("span",{},e("i",{class:"sw"}),"used"),e("span",{},e("i",{class:"sw mark"}),"planned spending so far"),e("span",{},e("i",{class:"sw res"}),"kept in reserve")))};var tt=async t=>{let s=e("div",{class:"stack"},e("div",{class:"card"},w("30%","1.25rem"),e("div",{style:"height:1rem"}),w("100%","4rem")));t.append(F("API keys","Keys that let your tools (Vibe CLI, Pi, OpenCode, scripts) use Mistwatch. The full key is shown only once, when you create it."),s);let n=async()=>{let a=Q(s),r,o=[];try{r=await p.apikeys()}catch(c){s.replaceChildren(j($(c),n));return}try{o=await p.agentConfig()}catch{o=[]}let i=e("input",{class:"input",id:"kn","data-fk":"new-name",placeholder:"e.g. vibe-cli",autocomplete:"off",spellcheck:"false"}),l=v(async()=>{let c=await p.newApikey(i.value);ke(c.key.name,c.secret),n()});i.addEventListener("keydown",c=>{c.key==="Enter"&&l()});let d=e("div",{class:"field-row"},e("label",{class:"f",for:"kn"},"New key name",i),e("button",{class:"btn pri","data-fk":"create",onclick:l},y("plus"),"Create key"));s.replaceChildren(e("section",{class:"card","aria-label":"API keys"},r.keys.length?e("div",{class:"tw"},e("table",{class:"tbl stack"},e("thead",{},e("tr",{},e("th",{},"Name"),e("th",{},"Key"),e("th",{class:"n"},"Created"),e("th",{class:"n"},"Last used"),e("th",{},e("span",{class:"sr"},"Actions")))),e("tbody",{},r.keys.map(c=>e("tr",{},b("Name","max trunc",e("b",{},c.name)),b("Key","",e("code",{},`${c.prefix}\u2026`)),b("Created","n",G(c.created)),b("Last used","n",ye(c.last_used)),b("","",e("button",{class:"btn ghost danger sm","data-fk":`revoke-${c.id}`,"aria-label":`Revoke key ${c.name}`,onclick:v(async()=>{await J({title:`Revoke "${c.name}"?`,body:"Tools using this key stop working immediately.",ok:"Revoke key",danger:!0})&&(await p.delApikey(c.id),n())})},"Revoke"))))))):e("div",{style:"margin-bottom:var(--sp-4)"},U("key","No keys yet","Without a key, any app on this computer can use Mistwatch. Create one key for each tool.")),r.keys.length?e("div",{style:"height:var(--sp-4)"}):null,d),Mt(o,r.base_url)),X(s,a)};n()},Mt=(t,s)=>{let n=0,a=e("div",{class:"stack",role:"tabpanel",id:"tool-panel",style:"gap:var(--sp-3)"}),r=e("div",{class:"tabs",role:"tablist","aria-label":"Tool"}),o=i=>{n=i;let l=t[i];if(!l)return;r.querySelectorAll(".tab").forEach((c,u)=>{c.setAttribute("aria-selected",String(u===i)),c.tabIndex=u===i?0:-1}),a.setAttribute("aria-labelledby",`tool-tab-${i}`);let d=()=>{let c=e("a",{href:URL.createObjectURL(new Blob([l.content],{type:"text/plain"})),download:l.filename});document.body.append(c),c.click(),c.remove(),setTimeout(()=>URL.revokeObjectURL(c.href),1e3)};a.replaceChildren(e("div",{class:"sm mut"},l.tool==="env"?"Set these variables":["Goes in ",e("code",{},l.path)]),Te(l.content),e("p",{class:"sm mut"},l.note),...l.tool==="env"?[e("div",{class:"sm mut"},"Quick test"),Te(`curl ${s}/chat/completions \\
|
|
1454
|
+
-H "Authorization: Bearer mw-\u2026" -H "Content-Type: application/json" \\
|
|
1455
|
+
-d '{"model":"auto","messages":[{"role":"user","content":"Hello"}]}'`)]:[],e("div",{class:"row"},l.tool==="env"?null:e("button",{class:"btn",onclick:d},y("download"),`Download ${l.filename}`)))};return t.forEach((i,l)=>{r.append(e("button",{class:"tab",role:"tab",id:`tool-tab-${l}`,"aria-controls":"tool-panel",onclick:()=>o(l)},i.label))}),r.addEventListener("keydown",i=>{i.key!=="ArrowRight"&&i.key!=="ArrowLeft"||(o((n+(i.key==="ArrowRight"?1:t.length-1))%t.length),r.querySelectorAll(".tab")[n]?.focus())}),t.length?o(0):a.append(e("p",{class:"sm mut"},"Base URL: ",e("code",{},s))),e("section",{class:"card","aria-label":"Connect your tools"},e("div",{class:"card-h"},e("h2",{},"Connect your tools"),e("span",{class:"grow"}),t.length?r:null),a,e("p",{class:"sm mut",style:"margin-top:var(--sp-4)"},"Model ",e("code",{},"auto")," picks a model for each request based on how hard it is. ",e("code",{},"auto-fast")," prefers cheaper models, ",e("code",{},"auto-max")," aims for quality. Claude Code and recent Codex need a translating proxy; see ",e("a",{href:"/llms.txt",target:"_blank",rel:"noopener"},"llms.txt"),"."))};var st=async t=>{let s=R.me;if(!s)return;let n=e("input",{class:"input",id:"pw0",type:"password",autocomplete:"current-password"}),a=e("input",{class:"input",id:"pw1",type:"password",autocomplete:"new-password"}),r=v(async()=>{await p.password({old:n.value,new:a.value}),n.value=a.value="",k("Password changed. Other sessions were signed out.")});t.append(F("Settings","Sign-in and how models are named."),e("div",{class:"stack"},e("div",{class:"cols"},e("section",{class:"card"},e("div",{class:"card-h"},e("h2",{},"Account")),e("div",{class:"stack"},e("label",{class:"f",for:"pw0"},"Current password",n),e("label",{class:"f",for:"pw1"},"New password (10+ characters)",a),e("div",{class:"row"},e("button",{class:"btn pri",onclick:r},"Change password"),e("span",{class:"grow"}),e("span",{class:"sm mut"},"Signed in as ",e("b",{},s.username)),e("button",{class:"btn",onclick:v(be)},y("logout"),"Sign out")))),e("section",{class:"card",id:"ulist"},w("30%","1.25rem"),e("div",{style:"height:1rem"}),w("100%","3rem"))),e("section",{class:"card",id:"mlist"},w("30%","1.25rem"),e("div",{style:"height:1rem"}),w("100%","6rem")))),he();let o=v(async()=>{let i=L("#ulist"),l=i?Q(i):null,d=await p.users(),c=e("input",{class:"input",id:"un","data-fk":"new-user",autocomplete:"off",spellcheck:"false"}),u=e("input",{class:"input",id:"up",type:"password",autocomplete:"new-password"});i?.replaceChildren(e("div",{class:"card-h"},e("h2",{},"Users")),e("div",{class:"tw"},e("table",{class:"tbl stack"},e("thead",{},e("tr",{},e("th",{},"User"),e("th",{class:"n"},"Since"),e("th",{},e("span",{class:"sr"},"Actions")))),e("tbody",{},d.map(m=>e("tr",{},b("User","",m.username,m.username===s.username?e("span",{class:"badge",style:"margin-left:.5rem"},"you"):null),b("Since","n",G(m.created)),b("","",m.username===s.username?"":e("button",{class:"btn ghost danger sm","data-fk":`del-${m.id}`,"aria-label":`Delete user ${m.username}`,onclick:v(async()=>{await J({title:`Delete user ${m.username}?`,body:"They will no longer be able to sign in.",ok:"Delete user",danger:!0})&&(await p.delUser(m.id),o())})},"Delete"))))))),e("div",{class:"field-row",style:"margin-top:var(--sp-4)"},e("label",{class:"f",for:"un"},"New user",c),e("label",{class:"f",for:"up"},"Password",u),e("button",{class:"btn","data-fk":"add-user",onclick:v(async()=>{await p.addUser({username:c.value,password:u.value}),k("User added"),o()})},y("plus"),"Add user"))),X(i??document,l)});o()},he=async(t=!1)=>{let s=L("#mlist");if(!s)return;let n=Q(s),a;try{a=await p.models(t)}catch(o){k($(o),!0);return}let r=e("input",{type:"checkbox",checked:t,"data-fk":"all",onchange:()=>he(r.checked)});s.replaceChildren(e("div",{class:"card-h"},e("h2",{},"Model names"),e("span",{class:"grow"}),e("label",{class:"check"},r,"All Mistral models"),e("button",{class:"btn","data-fk":"refresh",onclick:v(async()=>{let o=await p.refreshModels();k(`Loaded ${o.models} models from Mistral`),he(t)})},y("refresh"),"Refresh")),e("p",{class:"mut sm",style:"margin:calc(var(--sp-2)*-1) 0 var(--sp-4)"},"Choose how models are named in charts and tables. Different IDs of the same model are combined. Edit a name and press Enter."),e("div",{class:"tw"},e("table",{class:"tbl wide"},e("thead",{},e("tr",{},e("th",{},"Model ID"),e("th",{},"Shown as"),e("th",{},"Source"),e("th",{},e("span",{class:"sr"},"Actions")))),e("tbody",{},a.map(o=>{let i=e("input",{class:"input",value:o.display,"data-fk":`name-${o.key}`,"aria-label":`Display name for ${o.ids[0]??""}`}),l=v(async()=>{i.value.trim()&&i.value.trim()!==o.display&&(await p.renameModel(o.key,{display:i.value}),k("Saved"),he(t))});i.addEventListener("keydown",u=>{u.key==="Enter"&&l()}),i.addEventListener("blur",l);let[d,c]=We[o.source]??[o.source,""];return e("tr",{},e("td",{title:o.description??""},e("code",{},o.ids[0]??""),o.ids.length>1?e("span",{class:"mut xs"},` +${o.ids.length-1} aliases`):null),e("td",{},i),e("td",{},e("span",{class:`badge ${c}`},d)),e("td",{},o.source==="custom"?e("button",{class:"btn ghost sm","data-fk":`reset-${o.key}`,onclick:v(async()=>{await p.resetModel(o.key),he(t)})},"Reset"):""))}))))),X(s,n)};var xe={"":["Overview","overview",et],"#/accounts":["Accounts","accounts",Je],"#/keys":["API keys","key",tt],"#/settings":["Settings","settings",st]},St=t=>Object.hasOwn(xe,t),Me=async()=>{let t=document.querySelectorAll(".sumv");if(!t.length)return;let s;try{s=await p.summary()}catch{return}let n=s.all;t.forEach(a=>{if(a.replaceChildren(),!n){a.append(e("span",{class:"mut sm"},"No active budget"));return}let r=n.initial_eur?oe(n.used_eur/n.initial_eur*100):0;a.title=`${V(s.pools).map(([o,i])=>`${W[o]}: ${h(i.remaining_eur)} left of ${h(i.initial_eur)}`).join(`
|
|
1456
|
+
`)}
|
|
1457
|
+
Can spend now: ${h(n.room_eur)}`,a.dataset.full&&a.append(e("span",{class:"xs mut"},"Left in total")),a.append(e("span",{class:"row nw",style:"gap:.5rem"},e("b",{class:"num"},h(n.remaining_eur)),a.dataset.full?null:e("span",{class:"mut"},"left"),n.blocked?M("bad","exhausted"):null)),a.dataset.full&&a.append(e("span",{class:"mini"},e("i",{class:n.blocked?"bad":"",style:`width:${r}%`})),e("span",{class:"xs mut"},n.blocked?"All budgets used up":`Can spend now ${h(n.room_eur)}`))})},nt=()=>{Se(),clearInterval(R.sumTimer);let t=R.me,s=L("#app");if(!t||!s)return;let n=St(location.hash)?location.hash:"",a=o=>V(xe).map(([i,[l,d]])=>e("a",{href:i||"#/","aria-current":i===n?"page":null},y(d),o?e("span",{},l):l));document.title=`${xe[n][0]} \xB7 Mistwatch`;let r=e("main",{class:"page",id:"main",tabindex:"-1"});s.replaceChildren(e("div",{class:"shell"},e("aside",{class:"side"},e("a",{class:"brand",href:"#/"},pe(),"Mistwatch"),e("nav",{class:"nav","aria-label":"Main"},a(!1)),e("a",{class:"side-sum sumv","data-full":"1",href:"#/",title:"Total across all accounts and keys"}),e("div",{class:"side-foot"},e("span",{class:"who trunc",title:t.username},t.username),e("button",{class:"btn ghost icon","aria-label":"Sign out",title:"Sign out",onclick:v(be)},y("logout")))),e("div",{class:"main"},e("header",{class:"top"},e("a",{class:"brand",href:"#/"},pe(),"Mistwatch"),e("a",{class:"sumv",href:"#/"})),r,Ye())),e("nav",{class:"tabbar","aria-label":"Main"},a(!0))),xe[n][2](r),Me(),document.hidden||(R.sumTimer=setInterval(Me,15e3))},_e=async()=>{Se(),clearInterval(R.sumTimer);let t;try{t=await p.session()}catch(s){let n=$(s);return L(".auth form")||(document.title="Mistwatch",L("#app")?.replaceChildren(e("div",{class:"auth"},e("div",{class:"box"},j(n,()=>{_e()}))))),n}return R.me=t.user,t.setup_needed?Ae("setup"):R.me?nt():Ae("login"),null};E.boot=_e;window.addEventListener("hashchange",()=>{R.me&&(nt(),scrollTo(0,0),L("#main")?.focus({preventScroll:!0}))});document.addEventListener("visibilitychange",()=>{if(document.hidden){E.pause(),clearInterval(R.sumTimer);return}R.me&&(Me(),R.sumTimer=setInterval(Me,15e3),E.resume())});_e();
|
|
1458
|
+
</script>
|
|
1459
|
+
</body>
|
|
1460
|
+
</html>
|