zero-ai-ui-lib 0.0.0-stage → 0.1.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.
@@ -0,0 +1,3590 @@
1
+ import { openBlock as d, createElementBlock as h, normalizeClass as U, createElementVNode as t, toDisplayString as B, withDirectives as je, renderSlot as ie, vShow as Ye, Fragment as ae, createCommentVNode as X, computed as O, createTextVNode as ze, normalizeStyle as ne, renderList as oe, ref as C, watch as be, onBeforeUnmount as ge, createBlock as xe, Teleport as Pe, nextTick as ve, withModifiers as $e, onMounted as Me, onDeactivated as Te, unref as Y, shallowRef as Ke, createVNode as Xe, TransitionGroup as Ge, withCtx as Fe, createStaticVNode as Ze, onActivated as Qe, resolveDynamicComponent as Ue, normalizeProps as Je, guardReactiveProps as et } from "vue";
2
+ import { useRoute as tt, useRouter as nt } from "vue-router";
3
+ const at = ["aria-expanded"], lt = { class: "ui-accordion__body" }, wl = {
4
+ __name: "UiAccordion",
5
+ props: {
6
+ modelValue: { type: Boolean, default: !1 },
7
+ title: { type: String, default: "" }
8
+ },
9
+ emits: ["update:modelValue"],
10
+ setup(e, { emit: u }) {
11
+ const n = u;
12
+ return (g, a) => (d(), h("div", {
13
+ class: U(["ui-accordion", { "is-open": e.modelValue }])
14
+ }, [
15
+ t("button", {
16
+ type: "button",
17
+ class: "ui-accordion__head",
18
+ "aria-expanded": e.modelValue,
19
+ onClick: a[0] || (a[0] = (p) => n("update:modelValue", !e.modelValue))
20
+ }, [
21
+ t("span", null, B(e.title), 1),
22
+ a[1] || (a[1] = t("svg", {
23
+ class: "ui-accordion__chevron",
24
+ viewBox: "0 0 24 24",
25
+ fill: "none",
26
+ stroke: "currentColor",
27
+ "stroke-width": "2",
28
+ "stroke-linecap": "round",
29
+ "stroke-linejoin": "round",
30
+ "aria-hidden": "true"
31
+ }, [
32
+ t("path", { d: "M6 9l6 6 6-6" })
33
+ ], -1))
34
+ ], 8, at),
35
+ je(t("div", lt, [
36
+ ie(g.$slots, "default")
37
+ ], 512), [
38
+ [Ye, e.modelValue]
39
+ ])
40
+ ], 2));
41
+ }
42
+ }, it = {
43
+ class: "ui-alert__icon",
44
+ viewBox: "0 0 24 24",
45
+ fill: "none",
46
+ stroke: "currentColor",
47
+ "stroke-width": "2",
48
+ "stroke-linecap": "round",
49
+ "stroke-linejoin": "round",
50
+ "aria-hidden": "true"
51
+ }, rt = { class: "ui-alert__body" }, ot = {
52
+ key: 0,
53
+ class: "ui-alert__title"
54
+ }, st = { class: "ui-alert__desc" }, xl = {
55
+ __name: "UiAlert",
56
+ props: {
57
+ tone: { type: String, default: "info" },
58
+ title: { type: String, default: "" },
59
+ closable: { type: Boolean, default: !1 }
60
+ },
61
+ emits: ["close"],
62
+ setup(e, { emit: u }) {
63
+ const n = u;
64
+ return (g, a) => (d(), h("div", {
65
+ class: U(["ui-alert", `ui-alert--${e.tone}`]),
66
+ role: "alert"
67
+ }, [
68
+ (d(), h("svg", it, [
69
+ e.tone === "success" ? (d(), h(ae, { key: 0 }, [
70
+ a[1] || (a[1] = t("circle", {
71
+ cx: "12",
72
+ cy: "12",
73
+ r: "9"
74
+ }, null, -1)),
75
+ a[2] || (a[2] = t("path", { d: "M8.5 12.5l2.5 2.5 4.5-5" }, null, -1))
76
+ ], 64)) : e.tone === "warning" || e.tone === "danger" ? (d(), h(ae, { key: 1 }, [
77
+ a[3] || (a[3] = t("path", { d: "M12 3.5L21 20H3L12 3.5z" }, null, -1)),
78
+ a[4] || (a[4] = t("path", { d: "M12 9.5v4.5" }, null, -1)),
79
+ a[5] || (a[5] = t("path", { d: "M12 17.2v.1" }, null, -1))
80
+ ], 64)) : (d(), h(ae, { key: 2 }, [
81
+ a[6] || (a[6] = t("circle", {
82
+ cx: "12",
83
+ cy: "12",
84
+ r: "9"
85
+ }, null, -1)),
86
+ a[7] || (a[7] = t("path", { d: "M12 11v5" }, null, -1)),
87
+ a[8] || (a[8] = t("path", { d: "M12 7.7v.1" }, null, -1))
88
+ ], 64))
89
+ ])),
90
+ t("div", rt, [
91
+ e.title ? (d(), h("div", ot, B(e.title), 1)) : X("", !0),
92
+ t("div", st, [
93
+ ie(g.$slots, "default")
94
+ ])
95
+ ]),
96
+ e.closable ? (d(), h("button", {
97
+ key: 0,
98
+ type: "button",
99
+ class: "ui-alert__close",
100
+ "aria-label": "关闭提示",
101
+ onClick: a[0] || (a[0] = (p) => n("close"))
102
+ }, [...a[9] || (a[9] = [
103
+ t("svg", {
104
+ viewBox: "0 0 24 24",
105
+ fill: "none",
106
+ stroke: "currentColor",
107
+ "stroke-width": "2.4",
108
+ "stroke-linecap": "round",
109
+ "aria-hidden": "true"
110
+ }, [
111
+ t("path", { d: "M6 6l12 12M18 6L6 18" })
112
+ ], -1)
113
+ ])])) : X("", !0)
114
+ ], 2));
115
+ }
116
+ }, ut = ["src", "alt"], dt = {
117
+ key: 2,
118
+ class: "ui-avatar__status",
119
+ "aria-label": "在线"
120
+ }, _l = {
121
+ __name: "UiAvatar",
122
+ props: {
123
+ name: { type: String, default: "" },
124
+ src: { type: String, default: "" },
125
+ size: { type: String, default: "md" },
126
+ status: { type: Boolean, default: !1 }
127
+ },
128
+ setup(e) {
129
+ const u = e, n = O(() => {
130
+ const g = u.name.trim();
131
+ if (!g) return "?";
132
+ const a = g.split(/\s+/);
133
+ return a.length === 1 ? g.slice(0, 2).toUpperCase() : (a[0][0] + a[a.length - 1][0]).toUpperCase();
134
+ });
135
+ return (g, a) => (d(), h("span", {
136
+ class: U(["ui-avatar", e.size !== "md" ? `ui-avatar--${e.size}` : ""])
137
+ }, [
138
+ e.src ? (d(), h("img", {
139
+ key: 0,
140
+ src: e.src,
141
+ alt: e.name
142
+ }, null, 8, ut)) : (d(), h(ae, { key: 1 }, [
143
+ ze(B(n.value), 1)
144
+ ], 64)),
145
+ e.status ? (d(), h("span", dt)) : X("", !0)
146
+ ], 2));
147
+ }
148
+ }, ct = {
149
+ key: 0,
150
+ class: "ui-badge__dot",
151
+ "aria-hidden": "true"
152
+ }, kl = {
153
+ __name: "UiBadge",
154
+ props: {
155
+ tone: { type: String, default: "neutral" },
156
+ dot: { type: Boolean, default: !1 }
157
+ },
158
+ setup(e) {
159
+ return (u, n) => (d(), h("span", {
160
+ class: U(["ui-badge", `ui-badge--${e.tone}`])
161
+ }, [
162
+ e.dot ? (d(), h("span", ct)) : X("", !0),
163
+ ie(u.$slots, "default")
164
+ ], 2));
165
+ }
166
+ }, ue = (e, u) => {
167
+ const n = e.__vccOpts || e;
168
+ for (const [g, a] of u)
169
+ n[g] = a;
170
+ return n;
171
+ }, ft = ["id", "aria-label"], pt = ["data-tip"], vt = {
172
+ __name: "UiBarChart",
173
+ props: {
174
+ id: { type: String, default: "" },
175
+ data: { type: Array, default: () => [42, 68, 55, 80, 63, 92, 74] },
176
+ labels: { type: Array, default: () => ["一", "二", "三", "四", "五", "六", "日"] },
177
+ height: { type: [String, Number], default: null },
178
+ unit: { type: String, default: "" },
179
+ decimals: { type: Number, default: 1 },
180
+ highlight: { type: Number, default: null },
181
+ ariaLabel: { type: String, default: "柱状图" }
182
+ },
183
+ setup(e) {
184
+ const u = e, n = O(() => u.data.length ? u.data : [0]), g = O(() => Math.max.apply(null, n.value) || 1), a = O(() => u.height ? { height: typeof u.height == "number" ? `${u.height}px` : u.height } : {});
185
+ function p(i) {
186
+ return `${(i / g.value * 100).toFixed(1)}%`;
187
+ }
188
+ function v(i) {
189
+ return u.highlight !== null && i >= u.highlight;
190
+ }
191
+ function r(i, f) {
192
+ const _ = u.labels[f] || "", b = u.unit ? ` ${u.unit}` : "";
193
+ return `${_} · ${Number(i).toFixed(u.decimals)}${b}`.trim();
194
+ }
195
+ return (i, f) => (d(), h("div", {
196
+ class: "bars",
197
+ id: e.id,
198
+ style: ne(a.value),
199
+ role: "img",
200
+ "aria-label": e.ariaLabel
201
+ }, [
202
+ (d(!0), h(ae, null, oe(n.value, (_, b) => (d(), h("div", {
203
+ key: b,
204
+ class: "bar-col"
205
+ }, [
206
+ t("div", {
207
+ class: U(["bar", { hi: v(_) }]),
208
+ style: ne({ height: p(_), animationDelay: `${b * 55}ms` }),
209
+ "data-tip": r(_, b)
210
+ }, null, 14, pt),
211
+ t("span", null, B(e.labels[b] || ""), 1)
212
+ ]))), 128))
213
+ ], 12, ft));
214
+ }
215
+ }, $l = /* @__PURE__ */ ue(vt, [["__scopeId", "data-v-40849deb"]]), mt = {
216
+ key: 0,
217
+ class: "ui-sheet-root"
218
+ }, ht = ["aria-label"], gt = { class: "ui-sheet-head" }, yt = { class: "ui-sheet-body" }, bt = {
219
+ key: 0,
220
+ class: "ui-sheet-footer"
221
+ }, wt = 80, xt = 420, _t = {
222
+ __name: "UiBottomSheet",
223
+ props: {
224
+ modelValue: { type: Boolean, default: !1 },
225
+ title: { type: String, default: "面板" },
226
+ maxHeight: { type: String, default: "90dvh" },
227
+ closeOnBackdrop: { type: Boolean, default: !0 }
228
+ },
229
+ emits: ["update:modelValue"],
230
+ setup(e, { emit: u }) {
231
+ const n = e, g = u, a = C(null), p = C(!1), v = C(!1), r = C(!1);
232
+ let i = null, f = "", _ = null, b = 0, y = 0, k = !1;
233
+ function P(N, M) {
234
+ const j = getComputedStyle(document.documentElement).getPropertyValue(N).trim();
235
+ if (!j) return M;
236
+ const te = parseFloat(j);
237
+ return Number.isFinite(te) ? j.endsWith("ms") ? te : te * 1e3 : M;
238
+ }
239
+ function F() {
240
+ return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
241
+ }
242
+ function D() {
243
+ b && cancelAnimationFrame(b), y && cancelAnimationFrame(y), b = 0, y = 0;
244
+ }
245
+ function H() {
246
+ !n.modelValue || r.value || g("update:modelValue", !1);
247
+ }
248
+ function z() {
249
+ i || (i = document.getElementById("scrollArea"), i && (f = i.style.overflow, i.style.overflow = "hidden"));
250
+ }
251
+ function K() {
252
+ i && (i.style.overflow = f, i = null);
253
+ }
254
+ function I(N) {
255
+ N.key === "Escape" && n.modelValue && (N.preventDefault(), H());
256
+ }
257
+ function J() {
258
+ if (clearTimeout(_), _ = null, D(), p.value && k && !v.value) {
259
+ r.value = !1, v.value = !0, z();
260
+ return;
261
+ }
262
+ p.value = !0, r.value = !1, v.value = !1, z(), ve(() => {
263
+ const N = a.value;
264
+ !n.modelValue || !N || (N.focus({ preventScroll: !0 }), N.offsetHeight, b = requestAnimationFrame(() => {
265
+ b = 0, y = requestAnimationFrame(() => {
266
+ y = 0, n.modelValue && (v.value = !0, k = !0);
267
+ });
268
+ }));
269
+ });
270
+ }
271
+ function q() {
272
+ p.value = !1, v.value = !1, r.value = !1, k = !1, K();
273
+ }
274
+ function Q() {
275
+ if (D(), clearTimeout(_), _ = null, !k) {
276
+ q();
277
+ return;
278
+ }
279
+ r.value = !0, v.value = !1;
280
+ const N = F() ? 0 : P("--spring-exit-dur", 650), M = F() ? 0 : xt, j = F() ? 0 : Math.max(N, M) + wt;
281
+ _ = setTimeout(() => {
282
+ _ = null, q();
283
+ }, j);
284
+ }
285
+ return be(() => n.modelValue, (N) => {
286
+ N ? J() : (p.value || k) && Q();
287
+ }, { immediate: !0 }), document.addEventListener("keydown", I), ge(() => {
288
+ clearTimeout(_), _ = null, D(), K(), document.removeEventListener("keydown", I);
289
+ }), (N, M) => (d(), xe(Pe, { to: "body" }, [
290
+ p.value ? (d(), h("div", mt, [
291
+ t("div", {
292
+ class: U(["ui-scrim ui-sheet-scrim", { "is-open": v.value, "is-static": !e.closeOnBackdrop }]),
293
+ "aria-hidden": "true",
294
+ onClick: M[0] || (M[0] = (j) => e.closeOnBackdrop && H())
295
+ }, null, 2),
296
+ t("section", {
297
+ ref_key: "panel",
298
+ ref: a,
299
+ class: U(["ui-sheet-panel", { "is-open": v.value, "is-closing": r.value }]),
300
+ style: ne({ maxHeight: e.maxHeight }),
301
+ role: "dialog",
302
+ "aria-modal": "true",
303
+ "aria-label": e.title,
304
+ tabindex: "-1"
305
+ }, [
306
+ M[2] || (M[2] = t("div", {
307
+ class: "ui-sheet-handle",
308
+ "aria-hidden": "true"
309
+ }, null, -1)),
310
+ t("header", gt, [
311
+ t("h2", null, B(e.title), 1),
312
+ t("button", {
313
+ type: "button",
314
+ class: "ui-sheet-close",
315
+ "aria-label": "关闭面板",
316
+ onClick: H
317
+ }, [...M[1] || (M[1] = [
318
+ t("svg", {
319
+ viewBox: "0 0 24 24",
320
+ fill: "none",
321
+ stroke: "currentColor",
322
+ "stroke-width": "2.4",
323
+ "stroke-linecap": "round",
324
+ "aria-hidden": "true"
325
+ }, [
326
+ t("path", { d: "M6 6l12 12M18 6L6 18" })
327
+ ], -1)
328
+ ])])
329
+ ]),
330
+ t("div", yt, [
331
+ ie(N.$slots, "default", {}, void 0, !0)
332
+ ]),
333
+ N.$slots.footer ? (d(), h("footer", bt, [
334
+ ie(N.$slots, "footer", {}, void 0, !0)
335
+ ])) : X("", !0)
336
+ ], 14, ht)
337
+ ])) : X("", !0)
338
+ ]));
339
+ }
340
+ }, Ml = /* @__PURE__ */ ue(_t, [["__scopeId", "data-v-4386a2b1"]]), kt = ["type", "disabled"], $t = {
341
+ key: 0,
342
+ class: "ui-btn__spinner",
343
+ "aria-hidden": "true"
344
+ }, Sl = {
345
+ __name: "UiButton",
346
+ props: {
347
+ variant: { type: String, default: "primary" },
348
+ size: { type: String, default: "md" },
349
+ type: { type: String, default: "button" },
350
+ block: { type: Boolean, default: !1 },
351
+ disabled: { type: Boolean, default: !1 },
352
+ loading: { type: Boolean, default: !1 }
353
+ },
354
+ setup(e) {
355
+ return (u, n) => (d(), h("button", {
356
+ type: e.type,
357
+ class: U(["ui-btn", [`ui-btn--${e.variant}`, e.size !== "md" ? `ui-btn--${e.size}` : "", { "ui-btn--block": e.block }]]),
358
+ disabled: e.disabled || e.loading
359
+ }, [
360
+ e.loading ? (d(), h("span", $t)) : X("", !0),
361
+ ie(u.$slots, "default")
362
+ ], 10, kt));
363
+ }
364
+ }, Mt = { class: "ui-check" }, St = ["checked"], Ct = { class: "ui-check__text" }, Et = {
365
+ key: 0,
366
+ class: "ui-check__desc"
367
+ }, Cl = {
368
+ __name: "UiCheckbox",
369
+ props: {
370
+ modelValue: { type: Boolean, default: !1 },
371
+ label: { type: String, default: "" },
372
+ description: { type: String, default: "" }
373
+ },
374
+ emits: ["update:modelValue"],
375
+ setup(e, { emit: u }) {
376
+ const n = u;
377
+ return (g, a) => (d(), h("label", Mt, [
378
+ t("input", {
379
+ type: "checkbox",
380
+ checked: e.modelValue,
381
+ onChange: a[0] || (a[0] = (p) => n("update:modelValue", p.target.checked))
382
+ }, null, 40, St),
383
+ a[1] || (a[1] = t("span", {
384
+ class: "ui-check__box",
385
+ "aria-hidden": "true"
386
+ }, [
387
+ t("svg", {
388
+ viewBox: "0 0 24 24",
389
+ fill: "none",
390
+ stroke: "currentColor",
391
+ "stroke-width": "3",
392
+ "stroke-linecap": "round",
393
+ "stroke-linejoin": "round"
394
+ }, [
395
+ t("path", { d: "M5 12.5l4.5 4.5L19 7" })
396
+ ])
397
+ ], -1)),
398
+ t("span", Ct, [
399
+ t("span", null, B(e.label), 1),
400
+ e.description ? (d(), h("span", Et, B(e.description), 1)) : X("", !0)
401
+ ])
402
+ ]));
403
+ }
404
+ }, At = {
405
+ key: 0,
406
+ class: "ui-chip__dot",
407
+ "aria-hidden": "true"
408
+ }, El = {
409
+ __name: "UiChip",
410
+ props: {
411
+ variant: { type: String, default: "filled" },
412
+ selected: { type: Boolean, default: !1 },
413
+ removable: { type: Boolean, default: !1 },
414
+ dot: { type: Boolean, default: !1 }
415
+ },
416
+ emits: ["select", "remove"],
417
+ setup(e, { emit: u }) {
418
+ const n = u;
419
+ return (g, a) => (d(), h("button", {
420
+ type: "button",
421
+ class: U(["ui-chip", [`ui-chip--${e.variant}`, { "is-selected": e.selected }]]),
422
+ onClick: a[1] || (a[1] = (p) => n("select"))
423
+ }, [
424
+ e.dot ? (d(), h("span", At)) : X("", !0),
425
+ ie(g.$slots, "default"),
426
+ e.removable ? (d(), h("span", {
427
+ key: 1,
428
+ class: "ui-chip__close",
429
+ role: "button",
430
+ "aria-label": "移除",
431
+ onClick: a[0] || (a[0] = $e((p) => n("remove"), ["stop"]))
432
+ }, [...a[2] || (a[2] = [
433
+ t("svg", {
434
+ viewBox: "0 0 24 24",
435
+ fill: "none",
436
+ stroke: "currentColor",
437
+ "stroke-width": "2.6",
438
+ "stroke-linecap": "round",
439
+ "aria-hidden": "true"
440
+ }, [
441
+ t("path", { d: "M6 6l12 12M18 6L6 18" })
442
+ ], -1)
443
+ ])])) : X("", !0)
444
+ ], 2));
445
+ }
446
+ }, _e = 16;
447
+ function We() {
448
+ return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
449
+ }
450
+ function Vt(e, u) {
451
+ const n = getComputedStyle(document.documentElement).getPropertyValue(e).trim();
452
+ if (!n) return u;
453
+ const g = parseFloat(n);
454
+ return Number.isFinite(g) ? n.endsWith("ms") ? g : g * 1e3 : u;
455
+ }
456
+ function qe(e) {
457
+ const u = C(!1), n = C(!1), g = C(!1), a = C(!1), p = C({}), v = C({});
458
+ let r = null, i = null, f = null, _ = null, b = null, y = 0, k = 0;
459
+ function P($) {
460
+ const E = $.getBoundingClientRect();
461
+ let c = 1, x = 1;
462
+ const l = getComputedStyle($).transform;
463
+ if (l && l !== "none" && typeof DOMMatrixReadOnly == "function") {
464
+ const S = new DOMMatrixReadOnly(l);
465
+ c = S.a || 1, x = S.d || 1;
466
+ }
467
+ const m = Math.max(1, E.width / c), A = Math.max(1, E.height / x);
468
+ return {
469
+ left: E.left + (E.width - m) / 2,
470
+ top: E.top + (E.height - A) / 2,
471
+ width: m,
472
+ height: A
473
+ };
474
+ }
475
+ function F() {
476
+ var $;
477
+ return (($ = e.surface) == null ? void 0 : $.call(e)) ?? null;
478
+ }
479
+ function D($) {
480
+ var m, A;
481
+ const E = (m = e.panel) == null ? void 0 : m.call(e), c = (A = e.content) == null ? void 0 : A.call(e);
482
+ if (!E || !c) return 0;
483
+ const x = E.style.width;
484
+ E.style.width = $ + "px";
485
+ const l = c.offsetHeight;
486
+ return E.style.width = x, Math.ceil(l);
487
+ }
488
+ function H($) {
489
+ const E = F();
490
+ r || !(E != null && E.parentNode) || (r = document.createElement("div"), r.setAttribute("aria-hidden", "true"), r.style.cssText = "display:block;visibility:hidden;pointer-events:none;flex-shrink:0;", r.style.width = Math.round($.width) + "px", r.style.height = Math.round($.height) + "px", E.parentNode.insertBefore(r, E));
491
+ }
492
+ function z() {
493
+ r && (r.remove(), r = null);
494
+ }
495
+ function K() {
496
+ if (r != null && r.isConnected) {
497
+ const $ = r.getBoundingClientRect();
498
+ if ($.width > 0) return $;
499
+ }
500
+ return _;
501
+ }
502
+ function I() {
503
+ i && clearTimeout(i), f && clearTimeout(f), i = null, f = null;
504
+ }
505
+ function J() {
506
+ var $;
507
+ if (I(), q(), !g.value || !b) {
508
+ n.value = !1, u.value = !1, N();
509
+ return;
510
+ }
511
+ n.value = !1, a.value = !1, g.value = !0, p.value = { ...b }, u.value = !0, ($ = e.onOpened) == null || $.call(e);
512
+ }
513
+ function q() {
514
+ a.value = !1;
515
+ }
516
+ function Q($ = !0) {
517
+ var c;
518
+ I();
519
+ const E = g.value || u.value;
520
+ n.value = !1, u.value = !1, g.value = !1, a.value = !1, p.value = {}, v.value = {}, _ = null, b = null, z(), $ && E && ((c = e.onClosed) == null || c.call(e));
521
+ }
522
+ async function N() {
523
+ if (u.value) return;
524
+ n.value = !1;
525
+ const $ = F();
526
+ if (!$) return;
527
+ const E = $.closest(".view");
528
+ if (E && typeof E.getAnimations == "function")
529
+ try {
530
+ E.getAnimations().forEach((w) => w.finish());
531
+ } catch {
532
+ }
533
+ const c = P($);
534
+ if (!c.width || !c.height) return;
535
+ const x = getComputedStyle($);
536
+ y = parseFloat(x.borderLeftWidth) || 0, k = parseFloat(x.borderTopWidth) || 0;
537
+ const l = Math.max(180, Math.round(Math.min(e.width(), window.innerWidth - _e * 2))), m = Math.max(1, Math.round(l - y * 2)), A = Math.max(
538
+ Math.round(c.height),
539
+ Math.round(Math.min(D(m) + k * 2, window.innerHeight - _e * 2))
540
+ );
541
+ let S = Math.round(c.left);
542
+ S = Math.max(_e, Math.min(S, window.innerWidth - _e - l));
543
+ let T = Math.round(c.top);
544
+ T = Math.max(_e, Math.min(T, window.innerHeight - _e - A)), _ = { left: c.left, top: c.top, width: c.width, height: c.height };
545
+ const s = Math.max(1, c.width - y * 2), o = Math.max(1, c.height - k * 2);
546
+ H(c), p.value = {
547
+ left: c.left + "px",
548
+ top: c.top + "px",
549
+ width: c.width + "px",
550
+ height: c.height + "px"
551
+ }, v.value = {
552
+ width: s + "px",
553
+ height: o + "px"
554
+ }, g.value = !0, await ve();
555
+ const R = F();
556
+ R && R.offsetWidth, a.value = !0, i = setTimeout(() => {
557
+ var w;
558
+ i = null, g.value && (a.value = !1, b = { left: S + "px", top: T + "px", width: l + "px", height: A + "px" }, p.value = { ...b }, u.value = !0, (w = e.onOpened) == null || w.call(e));
559
+ }, We() ? 0 : 110);
560
+ }
561
+ async function M() {
562
+ if (n.value) return;
563
+ if (!g.value || !u.value && !a.value) {
564
+ Q();
565
+ return;
566
+ }
567
+ I();
568
+ const $ = K();
569
+ n.value = !0, u.value = !1, a.value = !1, await ve();
570
+ const E = F();
571
+ E && E.offsetWidth, $ && (p.value = {
572
+ left: $.left + "px",
573
+ top: $.top + "px",
574
+ width: $.width + "px",
575
+ height: $.height + "px"
576
+ });
577
+ const c = We() ? 0 : Vt("--spring-exit-dur", 650);
578
+ f = setTimeout(() => {
579
+ f = null, Q();
580
+ }, c + 80);
581
+ }
582
+ function j() {
583
+ if (u.value) {
584
+ M();
585
+ return;
586
+ }
587
+ if (n.value || a.value) {
588
+ J();
589
+ return;
590
+ }
591
+ N();
592
+ }
593
+ function te() {
594
+ Q(!1);
595
+ }
596
+ function G($) {
597
+ var E;
598
+ if (g.value && !((E = F()) != null && E.contains($.target))) {
599
+ if (n.value || !u.value) {
600
+ Q();
601
+ return;
602
+ }
603
+ M();
604
+ }
605
+ }
606
+ function Z($) {
607
+ var E;
608
+ !g.value || n.value || (E = F()) != null && E.contains($.target) || M();
609
+ }
610
+ function ee($) {
611
+ $.key !== "Escape" || !g.value && !n.value || ($.stopPropagation(), M());
612
+ }
613
+ function W() {
614
+ (g.value || n.value) && M();
615
+ }
616
+ return Me(() => {
617
+ document.addEventListener("pointerdown", Z), document.addEventListener("keydown", ee), window.addEventListener("scroll", G, !0), window.addEventListener("resize", W);
618
+ }), ge(() => {
619
+ Q(!1), document.removeEventListener("pointerdown", Z), document.removeEventListener("keydown", ee), window.removeEventListener("scroll", G, !0), window.removeEventListener("resize", W);
620
+ }), Te(() => {
621
+ Q(!1);
622
+ }), {
623
+ open: u,
624
+ closing: n,
625
+ floating: g,
626
+ compressed: a,
627
+ style: p,
628
+ viewStyle: v,
629
+ openWindow: N,
630
+ closeWindow: M,
631
+ toggleWindow: j,
632
+ interruptOpen: J,
633
+ resetWindow: te
634
+ };
635
+ }
636
+ const Pt = { class: "ui-date" }, Tt = { class: "ui-date__label" }, Bt = ["aria-expanded"], Ft = { class: "ui-date__value" }, Lt = ["aria-hidden", "inert"], Nt = { class: "ui-date__head" }, Rt = {
637
+ class: "ui-date__weekdays",
638
+ "aria-hidden": "true"
639
+ }, Dt = { class: "ui-date__grid" }, Ut = ["tabindex", "onClick"], Wt = {
640
+ __name: "UiDatePicker",
641
+ props: {
642
+ modelValue: { type: String, default: "" },
643
+ label: { type: String, default: "日期" }
644
+ },
645
+ emits: ["update:modelValue"],
646
+ setup(e, { emit: u }) {
647
+ const n = e, g = u, a = C(null), p = C(null), v = C(null), r = C(null), i = C(n.modelValue || G(M())), f = C(j(M())), { open: _, closing: b, floating: y, compressed: k, style: P, viewStyle: F, openWindow: D, closeWindow: H, toggleWindow: z } = qe({
648
+ surface: () => a.value,
649
+ panel: () => v.value,
650
+ content: () => r.value,
651
+ width: () => Math.min(300, window.innerWidth - 32),
652
+ onOpened: () => {
653
+ requestAnimationFrame(() => {
654
+ var l, m;
655
+ (m = (l = a.value) == null ? void 0 : l.querySelector(".is-selected")) == null || m.focus({ preventScroll: !0 });
656
+ });
657
+ },
658
+ onClosed: () => {
659
+ var l;
660
+ (l = p.value) == null || l.focus({ preventScroll: !0 });
661
+ }
662
+ }), K = ["一", "二", "三", "四", "五", "六", "日"], I = O(() => te(i.value) || M()), J = O(() => ee(I.value)), q = O(() => `${f.value.getFullYear()}年${f.value.getMonth() + 1}月`), Q = O(() => {
663
+ const l = f.value.getFullYear(), m = f.value.getMonth(), S = (new Date(l, m, 1).getDay() + 6) % 7, T = new Date(l, m + 1, 0).getDate();
664
+ return [
665
+ ...Array.from({ length: S }, () => null),
666
+ ...Array.from({ length: T }, (s, o) => o + 1)
667
+ ];
668
+ });
669
+ function N(l) {
670
+ return String(l).padStart(2, "0");
671
+ }
672
+ function M() {
673
+ const l = /* @__PURE__ */ new Date();
674
+ return new Date(l.getFullYear(), l.getMonth(), l.getDate());
675
+ }
676
+ function j(l) {
677
+ return new Date(l.getFullYear(), l.getMonth(), 1);
678
+ }
679
+ function te(l) {
680
+ if (typeof l != "string") return null;
681
+ const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(l);
682
+ if (!m) return null;
683
+ const A = new Date(Number(m[1]), Number(m[2]) - 1, Number(m[3]));
684
+ return Number.isNaN(A.getTime()) ? null : A;
685
+ }
686
+ function G(l) {
687
+ return `${l.getFullYear()}-${N(l.getMonth() + 1)}-${N(l.getDate())}`;
688
+ }
689
+ function Z(l, m) {
690
+ return l.getFullYear() === m.getFullYear() && l.getMonth() === m.getMonth() && l.getDate() === m.getDate();
691
+ }
692
+ function ee(l) {
693
+ return Z(l, M()) ? `今天 · ${l.getMonth() + 1}月${l.getDate()}日` : `${l.getFullYear()}年${l.getMonth() + 1}月${l.getDate()}日`;
694
+ }
695
+ function W() {
696
+ f.value = j(I.value), D();
697
+ }
698
+ function $() {
699
+ if (_.value) {
700
+ H();
701
+ return;
702
+ }
703
+ if (b.value || k.value) {
704
+ f.value = j(I.value), z();
705
+ return;
706
+ }
707
+ W();
708
+ }
709
+ function E(l) {
710
+ f.value = new Date(f.value.getFullYear(), f.value.getMonth() + l, 1);
711
+ }
712
+ function c(l) {
713
+ const m = new Date(f.value.getFullYear(), f.value.getMonth(), l);
714
+ i.value = G(m), g("update:modelValue", i.value), H();
715
+ }
716
+ function x() {
717
+ const l = M();
718
+ f.value = j(l), i.value = G(l), g("update:modelValue", i.value), H();
719
+ }
720
+ return be(() => n.modelValue, (l) => {
721
+ i.value = l || G(M()), y.value || (f.value = j(I.value));
722
+ }), (l, m) => (d(), h("div", Pt, [
723
+ t("span", Tt, B(e.label), 1),
724
+ t("div", {
725
+ ref_key: "surfaceEl",
726
+ ref: a,
727
+ class: U(["ui-date__surface ui-morph", {
728
+ "is-open": Y(_),
729
+ "is-closing": Y(b),
730
+ "is-floating": Y(y),
731
+ "is-compressed": Y(k)
732
+ }]),
733
+ style: ne(Y(P))
734
+ }, [
735
+ t("div", {
736
+ class: "ui-date__view ui-morph__view",
737
+ style: ne(Y(F))
738
+ }, [
739
+ t("button", {
740
+ ref_key: "fieldEl",
741
+ ref: p,
742
+ type: "button",
743
+ class: "ui-date__field",
744
+ "aria-expanded": Y(y),
745
+ "aria-haspopup": "dialog",
746
+ onClick: $
747
+ }, [
748
+ m[4] || (m[4] = t("span", {
749
+ class: "ui-date__icon",
750
+ "aria-hidden": "true"
751
+ }, [
752
+ t("svg", {
753
+ viewBox: "0 0 24 24",
754
+ fill: "none",
755
+ stroke: "currentColor",
756
+ "stroke-width": "2",
757
+ "stroke-linecap": "round",
758
+ "stroke-linejoin": "round"
759
+ }, [
760
+ t("rect", {
761
+ x: "3",
762
+ y: "5",
763
+ width: "18",
764
+ height: "16",
765
+ rx: "3"
766
+ }),
767
+ t("path", { d: "M8 3v4M16 3v4M3 10h18" })
768
+ ])
769
+ ], -1)),
770
+ t("span", Ft, B(J.value), 1),
771
+ t("span", {
772
+ class: U(["ui-date__chevron", { "is-open": Y(_) }]),
773
+ "aria-hidden": "true"
774
+ }, [...m[3] || (m[3] = [
775
+ t("svg", {
776
+ viewBox: "0 0 24 24",
777
+ fill: "none",
778
+ stroke: "currentColor",
779
+ "stroke-width": "2.2",
780
+ "stroke-linecap": "round",
781
+ "stroke-linejoin": "round"
782
+ }, [
783
+ t("path", { d: "M6 9l6 6 6-6" })
784
+ ], -1)
785
+ ])], 2)
786
+ ], 8, Bt)
787
+ ], 4),
788
+ t("div", {
789
+ ref_key: "panelEl",
790
+ ref: v,
791
+ class: "ui-date__pop ui-morph__panel",
792
+ role: "dialog",
793
+ "aria-label": "选择日期",
794
+ "aria-hidden": Y(_) ? "false" : "true",
795
+ inert: Y(_) ? null : "",
796
+ tabindex: "-1",
797
+ onPointerdown: m[2] || (m[2] = $e(() => {
798
+ }, ["stop"]))
799
+ }, [
800
+ t("div", {
801
+ ref_key: "panelContentEl",
802
+ ref: r,
803
+ class: "ui-date__pop-inner"
804
+ }, [
805
+ t("div", Nt, [
806
+ t("button", {
807
+ type: "button",
808
+ class: "ui-date__nav",
809
+ "aria-label": "上个月",
810
+ onClick: m[0] || (m[0] = (A) => E(-1))
811
+ }, [...m[5] || (m[5] = [
812
+ t("svg", {
813
+ viewBox: "0 0 24 24",
814
+ fill: "none",
815
+ stroke: "currentColor",
816
+ "stroke-width": "2.2",
817
+ "stroke-linecap": "round",
818
+ "stroke-linejoin": "round",
819
+ "aria-hidden": "true"
820
+ }, [
821
+ t("path", { d: "M15 6l-6 6 6 6" })
822
+ ], -1)
823
+ ])]),
824
+ t("strong", null, B(q.value), 1),
825
+ t("button", {
826
+ type: "button",
827
+ class: "ui-date__nav",
828
+ "aria-label": "下个月",
829
+ onClick: m[1] || (m[1] = (A) => E(1))
830
+ }, [...m[6] || (m[6] = [
831
+ t("svg", {
832
+ viewBox: "0 0 24 24",
833
+ fill: "none",
834
+ stroke: "currentColor",
835
+ "stroke-width": "2.2",
836
+ "stroke-linecap": "round",
837
+ "stroke-linejoin": "round",
838
+ "aria-hidden": "true"
839
+ }, [
840
+ t("path", { d: "M9 6l6 6-6 6" })
841
+ ], -1)
842
+ ])])
843
+ ]),
844
+ t("div", Rt, [
845
+ (d(), h(ae, null, oe(K, (A) => t("span", { key: A }, B(A), 1)), 64))
846
+ ]),
847
+ t("div", Dt, [
848
+ (d(!0), h(ae, null, oe(Q.value, (A, S) => (d(), h("span", {
849
+ key: `${q.value}-${S}`,
850
+ class: "ui-date__cell"
851
+ }, [
852
+ A ? (d(), h("button", {
853
+ key: 0,
854
+ type: "button",
855
+ tabindex: Y(_) ? 0 : -1,
856
+ class: U({
857
+ "is-selected": Z(new Date(f.value.getFullYear(), f.value.getMonth(), A), I.value),
858
+ "is-today": Z(new Date(f.value.getFullYear(), f.value.getMonth(), A), M())
859
+ }),
860
+ onClick: (T) => c(A)
861
+ }, B(A), 11, Ut)) : X("", !0)
862
+ ]))), 128))
863
+ ]),
864
+ t("div", { class: "ui-date__footer" }, [
865
+ m[7] || (m[7] = t("span", null, "选择后会立即生效", -1)),
866
+ t("button", {
867
+ type: "button",
868
+ onClick: x
869
+ }, "今天")
870
+ ])
871
+ ], 512)
872
+ ], 40, Lt)
873
+ ], 6)
874
+ ]));
875
+ }
876
+ }, Al = /* @__PURE__ */ ue(Wt, [["__scopeId", "data-v-8ad07d43"]]), Ot = { class: "ui-empty" }, Ht = { class: "ui-empty__icon" }, It = { class: "ui-empty__title" }, zt = {
877
+ key: 0,
878
+ class: "ui-empty__desc"
879
+ }, qt = {
880
+ key: 1,
881
+ class: "ui-empty__action"
882
+ }, Vl = {
883
+ __name: "UiEmptyState",
884
+ props: {
885
+ title: { type: String, default: "暂无内容" },
886
+ description: { type: String, default: "" }
887
+ },
888
+ setup(e) {
889
+ return (u, n) => (d(), h("div", Ot, [
890
+ t("div", Ht, [
891
+ ie(u.$slots, "icon", {}, () => [
892
+ n[0] || (n[0] = t("svg", {
893
+ viewBox: "0 0 24 24",
894
+ fill: "none",
895
+ stroke: "currentColor",
896
+ "stroke-width": "1.8",
897
+ "stroke-linecap": "round",
898
+ "stroke-linejoin": "round",
899
+ "aria-hidden": "true"
900
+ }, [
901
+ t("path", { d: "M4 7.5h16v11a1.5 1.5 0 01-1.5 1.5h-13A1.5 1.5 0 014 18.5v-11z" }),
902
+ t("path", { d: "M4 9l8 5 8-5" }),
903
+ t("path", { d: "M9 4h6" })
904
+ ], -1))
905
+ ])
906
+ ]),
907
+ t("div", It, B(e.title), 1),
908
+ e.description ? (d(), h("div", zt, B(e.description), 1)) : X("", !0),
909
+ u.$slots.action ? (d(), h("div", qt, [
910
+ ie(u.$slots, "action")
911
+ ])) : X("", !0)
912
+ ]));
913
+ }
914
+ }, jt = 12;
915
+ function Le(e) {
916
+ let u = "idle", n = 0, g = 0, a = null, p = null;
917
+ function v() {
918
+ a && (a.removeEventListener("pointermove", f), a.removeEventListener("pointerup", _), a.removeEventListener("pointercancel", b), a = null, p = null);
919
+ }
920
+ function r() {
921
+ var y;
922
+ u === "pressing" && (u = "idle", v(), (y = e.onPressEnd) == null || y.call(e));
923
+ }
924
+ function i(y) {
925
+ var k;
926
+ if (u === "idle" && y.isPrimary !== !1 && !(typeof y.button == "number" && y.button !== 0) && !(e.canPress && !e.canPress())) {
927
+ n = y.clientX, g = y.clientY, u = "pressing", a = y.currentTarget, p = y.pointerId, a.addEventListener("pointermove", f), a.addEventListener("pointerup", _), a.addEventListener("pointercancel", b);
928
+ try {
929
+ a.setPointerCapture(y.pointerId);
930
+ } catch {
931
+ }
932
+ (k = e.onPressStart) == null || k.call(e);
933
+ }
934
+ }
935
+ function f(y) {
936
+ u === "pressing" && Math.hypot(y.clientX - n, y.clientY - g) > jt && r();
937
+ }
938
+ function _() {
939
+ var P, F;
940
+ if (u !== "pressing") return;
941
+ const y = a, k = p;
942
+ if (u = "idle", v(), y && k !== null)
943
+ try {
944
+ y.releasePointerCapture(k);
945
+ } catch {
946
+ }
947
+ (P = e.onPressEnd) == null || P.call(e), (F = e.onRelease) == null || F.call(e);
948
+ }
949
+ function b() {
950
+ r();
951
+ }
952
+ return ge(() => {
953
+ r(), v();
954
+ }), { onPointerDown: i, cancelPress: r };
955
+ }
956
+ const Yt = ["aria-expanded"], Kt = ["aria-label", "aria-hidden", "inert"], Xt = {
957
+ class: "ui-floating-menu__head",
958
+ role: "presentation"
959
+ }, Gt = ["aria-checked", "tabindex", "onClick"], Zt = { class: "ui-floating-menu__copy" }, Qt = { class: "ui-floating-menu__label" }, Jt = {
960
+ key: 0,
961
+ class: "ui-floating-menu__desc"
962
+ }, en = {
963
+ key: 0,
964
+ class: "ui-floating-menu__check",
965
+ viewBox: "0 0 24 24",
966
+ fill: "none",
967
+ stroke: "currentColor",
968
+ "stroke-width": "2.4",
969
+ "stroke-linecap": "round",
970
+ "stroke-linejoin": "round",
971
+ "aria-hidden": "true"
972
+ }, tn = {
973
+ key: 1,
974
+ class: "ui-floating-menu__dot",
975
+ "aria-hidden": "true"
976
+ }, ke = 12, nn = {
977
+ __name: "UiFloatingMenu",
978
+ props: {
979
+ modelValue: { type: String, default: "" },
980
+ label: { type: String, default: "排序" },
981
+ title: { type: String, default: "排序方式" },
982
+ size: { type: String, default: "md" },
983
+ items: {
984
+ type: Array,
985
+ default: () => [
986
+ { value: "recent", label: "最近优先", description: "按时间从新到旧" },
987
+ { value: "calories", label: "消耗最高", description: "优先显示高消耗记录" },
988
+ { value: "duration", label: "时长最长", description: "优先显示长时间训练" }
989
+ ]
990
+ }
991
+ },
992
+ emits: ["update:modelValue", "select"],
993
+ setup(e, { emit: u }) {
994
+ const n = u, g = C(null), a = C(null), p = C(null), v = C(!1), r = C(!1), i = C(!1), f = C(!1), _ = C({}), b = C({});
995
+ let y = null, k = null, P = null, F = null, D = !1, H = 0, z = 0;
996
+ function K(S) {
997
+ const T = S.getBoundingClientRect();
998
+ let s = 1, o = 1;
999
+ const R = getComputedStyle(S).transform;
1000
+ if (R && R !== "none" && typeof DOMMatrixReadOnly == "function") {
1001
+ const L = new DOMMatrixReadOnly(R);
1002
+ s = L.a || 1, o = L.d || 1;
1003
+ }
1004
+ const w = Math.max(1, T.width / s), V = Math.max(1, T.height / o);
1005
+ return {
1006
+ left: T.left + (T.width - w) / 2,
1007
+ top: T.top + (T.height - V) / 2,
1008
+ width: w,
1009
+ height: V
1010
+ };
1011
+ }
1012
+ function I() {
1013
+ return Math.max(1, Math.min(286, window.innerWidth - ke * 2));
1014
+ }
1015
+ function J() {
1016
+ return window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
1017
+ }
1018
+ function q(S, T) {
1019
+ const s = getComputedStyle(document.documentElement).getPropertyValue(S).trim();
1020
+ if (!s) return T;
1021
+ const o = parseFloat(s);
1022
+ return Number.isFinite(o) ? s.endsWith("ms") ? o : o * 1e3 : T;
1023
+ }
1024
+ function Q(S) {
1025
+ const T = a.value, s = p.value;
1026
+ if (!T || !s) return 0;
1027
+ const o = T.style.width;
1028
+ T.style.width = S + "px";
1029
+ const R = s.offsetHeight;
1030
+ return T.style.width = o, Math.ceil(R);
1031
+ }
1032
+ function N() {
1033
+ var S;
1034
+ y || !((S = g.value) != null && S.parentNode) || (y = document.createElement("div"), y.setAttribute("aria-hidden", "true"), y.style.cssText = "display:inline-flex;flex-shrink:0;visibility:hidden;pointer-events:none;", g.value.parentNode.insertBefore(y, g.value));
1035
+ }
1036
+ function M(S) {
1037
+ y && (y.style.width = S.width + "px", y.style.height = S.height + "px");
1038
+ }
1039
+ function j() {
1040
+ y && (y.remove(), y = null);
1041
+ }
1042
+ function te() {
1043
+ if (y && y.isConnected) {
1044
+ const S = y.getBoundingClientRect();
1045
+ if (S.width > 0) return S;
1046
+ }
1047
+ return P;
1048
+ }
1049
+ const G = Le({
1050
+ // 收起途中也允许按下,才有机会打断收起、重新展开。
1051
+ canPress: () => !v.value,
1052
+ onPressStart: () => {
1053
+ i.value = !0;
1054
+ },
1055
+ onPressEnd: () => {
1056
+ i.value = !1;
1057
+ }
1058
+ });
1059
+ async function Z() {
1060
+ if (v.value) return;
1061
+ r.value = !1;
1062
+ const S = g.value;
1063
+ if (!S) return;
1064
+ const T = S.closest(".view");
1065
+ if (T && typeof T.getAnimations == "function")
1066
+ try {
1067
+ T.getAnimations().forEach((de) => de.finish());
1068
+ } catch {
1069
+ }
1070
+ const s = K(S), o = s.width, R = s.height, w = s.left, V = s.top, L = getComputedStyle(S);
1071
+ H = parseFloat(L.borderLeftWidth) || 0, z = parseFloat(L.borderTopWidth) || 0;
1072
+ const re = Math.max(1, o - H * 2), ce = Math.max(1, R - z * 2), fe = Math.max(I(), o), me = Math.max(1, Math.round(fe - H * 2)), we = Math.max(R, window.innerHeight - ke * 2), pe = Math.max(R, Math.min(Q(me) + z * 2, we));
1073
+ let le = w + o - fe;
1074
+ le = Math.max(ke, Math.min(le, window.innerWidth - ke - fe));
1075
+ let he = V;
1076
+ he = Math.max(ke, Math.min(he, window.innerHeight - ke - pe)), P = { left: w, top: V, width: o, height: R }, D = !0, N(), M(P), _.value = {
1077
+ left: w + "px",
1078
+ top: V + "px",
1079
+ width: o + "px",
1080
+ height: R + "px"
1081
+ }, b.value = {
1082
+ position: "fixed",
1083
+ left: w + H + "px",
1084
+ top: V + z + "px",
1085
+ width: re + "px",
1086
+ height: ce + "px"
1087
+ }, f.value = !0, i.value = !1, await ve(), S.offsetWidth, F = {
1088
+ left: Math.round(le) + "px",
1089
+ top: Math.round(he) + "px",
1090
+ width: fe + "px",
1091
+ height: pe + "px"
1092
+ }, requestAnimationFrame(() => {
1093
+ var de;
1094
+ f.value && (_.value = { ...F }, v.value = !0, (de = a.value) == null || de.focus({ preventScroll: !0 }));
1095
+ });
1096
+ }
1097
+ function ee() {
1098
+ var S;
1099
+ if (clearTimeout(k), k = null, r.value = !1, i.value = !1, !f.value || !F) {
1100
+ v.value = !1, Z();
1101
+ return;
1102
+ }
1103
+ v.value = !0, D = !0, _.value = { ...F }, b.value = {
1104
+ position: "fixed",
1105
+ left: parseFloat(F.left) + H + "px",
1106
+ top: parseFloat(F.top) + z + "px",
1107
+ width: Math.max(1, Math.round(parseFloat(F.width) - H * 2)) + "px",
1108
+ height: Math.max(1, Math.round(parseFloat(F.height) - z * 2)) + "px"
1109
+ }, (S = a.value) == null || S.focus({ preventScroll: !0 });
1110
+ }
1111
+ function W() {
1112
+ clearTimeout(k), k = null, r.value = !1, v.value = !1, f.value = !1, i.value = !1, _.value = {}, b.value = {}, P = null, F = null, j();
1113
+ }
1114
+ async function $() {
1115
+ var s;
1116
+ if (r.value || !v.value) return;
1117
+ clearTimeout(k);
1118
+ const S = te();
1119
+ r.value = !0, v.value = !1, await ve(), (s = g.value) == null || s.offsetWidth, S && (_.value = {
1120
+ left: S.left + "px",
1121
+ top: S.top + "px",
1122
+ width: S.width + "px",
1123
+ height: S.height + "px"
1124
+ }, b.value = {
1125
+ position: "fixed",
1126
+ left: S.left + H + "px",
1127
+ top: S.top + z + "px",
1128
+ width: Math.max(1, S.width - H * 2) + "px",
1129
+ height: Math.max(1, S.height - z * 2) + "px"
1130
+ });
1131
+ const T = J() ? 0 : q("--spring-exit-dur", 400);
1132
+ k = setTimeout(() => {
1133
+ var R, w;
1134
+ k = null;
1135
+ const o = D;
1136
+ D = !1, W(), o && ((w = (R = g.value) == null ? void 0 : R.querySelector("button")) == null || w.focus({ preventScroll: !0 }));
1137
+ }, T + 80);
1138
+ }
1139
+ function E() {
1140
+ if (v.value) {
1141
+ $();
1142
+ return;
1143
+ }
1144
+ if (r.value) {
1145
+ ee();
1146
+ return;
1147
+ }
1148
+ Z();
1149
+ }
1150
+ function c(S) {
1151
+ n("update:modelValue", S.value), n("select", S), $();
1152
+ }
1153
+ function x(S) {
1154
+ var T;
1155
+ r.value || !v.value || (T = g.value) != null && T.contains(S.target) || $();
1156
+ }
1157
+ function l(S) {
1158
+ S.key === "Escape" && (v.value || r.value) && (S.stopPropagation(), G.cancelPress(), $());
1159
+ }
1160
+ function m(S) {
1161
+ var T;
1162
+ if (!((T = g.value) != null && T.contains(S.target))) {
1163
+ if (r.value || f.value && !v.value) {
1164
+ W();
1165
+ return;
1166
+ }
1167
+ v.value && $();
1168
+ }
1169
+ }
1170
+ function A() {
1171
+ (v.value || r.value) && $();
1172
+ }
1173
+ return Me(() => {
1174
+ document.addEventListener("pointerdown", x), document.addEventListener("keydown", l), window.addEventListener("resize", A), window.addEventListener("scroll", m, !0);
1175
+ }), Te(() => {
1176
+ G.cancelPress(), D = !1, W();
1177
+ }), ge(() => {
1178
+ clearTimeout(k), G.cancelPress(), document.removeEventListener("pointerdown", x), document.removeEventListener("keydown", l), window.removeEventListener("resize", A), window.removeEventListener("scroll", m, !0), j();
1179
+ }), (S, T) => (d(), h("div", {
1180
+ ref_key: "root",
1181
+ ref: g,
1182
+ class: U(["ui-floating-menu ui-morph", [e.size !== "md" ? `is-${e.size}` : "", {
1183
+ "is-open": v.value,
1184
+ "is-closing": r.value,
1185
+ "is-floating": f.value,
1186
+ "is-pressed": i.value
1187
+ }]]),
1188
+ style: ne(_.value)
1189
+ }, [
1190
+ t("div", {
1191
+ class: "ui-floating-menu__view ui-morph__view",
1192
+ style: ne(b.value)
1193
+ }, [
1194
+ t("button", {
1195
+ type: "button",
1196
+ class: "ui-floating-menu__trigger",
1197
+ "aria-haspopup": "menu",
1198
+ "aria-expanded": v.value,
1199
+ onPointerdown: T[0] || (T[0] = (...s) => Y(G).onPointerDown && Y(G).onPointerDown(...s)),
1200
+ onClick: E,
1201
+ onContextmenu: T[1] || (T[1] = $e(() => {
1202
+ }, ["prevent"]))
1203
+ }, [
1204
+ T[2] || (T[2] = t("svg", {
1205
+ viewBox: "0 0 24 24",
1206
+ fill: "none",
1207
+ stroke: "currentColor",
1208
+ "stroke-width": "2",
1209
+ "stroke-linecap": "round",
1210
+ "stroke-linejoin": "round",
1211
+ "aria-hidden": "true"
1212
+ }, [
1213
+ t("path", { d: "M4 7h13M4 12h9M4 17h5" }),
1214
+ t("path", {
1215
+ d: "M18 15l3 3 3-3",
1216
+ transform: "translate(-2 -2)"
1217
+ })
1218
+ ], -1)),
1219
+ t("span", null, B(e.label), 1),
1220
+ T[3] || (T[3] = t("span", {
1221
+ class: "ui-floating-menu__chevron",
1222
+ "aria-hidden": "true"
1223
+ }, [
1224
+ t("svg", {
1225
+ viewBox: "0 0 24 24",
1226
+ fill: "none",
1227
+ stroke: "currentColor",
1228
+ "stroke-width": "2.4",
1229
+ "stroke-linecap": "round",
1230
+ "stroke-linejoin": "round"
1231
+ }, [
1232
+ t("path", { d: "M6 9l6 6 6-6" })
1233
+ ])
1234
+ ], -1))
1235
+ ], 40, Yt)
1236
+ ], 4),
1237
+ t("section", {
1238
+ ref_key: "panel",
1239
+ ref: a,
1240
+ class: "ui-floating-menu__panel ui-morph__panel",
1241
+ role: "menu",
1242
+ "aria-label": e.title,
1243
+ "aria-hidden": v.value ? "false" : "true",
1244
+ inert: v.value ? null : "",
1245
+ tabindex: "-1"
1246
+ }, [
1247
+ t("div", {
1248
+ ref_key: "panelContent",
1249
+ ref: p,
1250
+ class: "ui-floating-menu__panel-inner"
1251
+ }, [
1252
+ t("div", Xt, B(e.title), 1),
1253
+ (d(!0), h(ae, null, oe(e.items, (s) => (d(), h("button", {
1254
+ key: s.value ?? s.label,
1255
+ type: "button",
1256
+ role: "menuitemradio",
1257
+ "aria-checked": e.modelValue === s.value,
1258
+ tabindex: v.value ? 0 : -1,
1259
+ class: U(["ui-floating-menu__item", { "is-active": e.modelValue === s.value, "is-danger": s.tone === "danger" }]),
1260
+ onClick: (o) => c(s)
1261
+ }, [
1262
+ t("span", Zt, [
1263
+ t("span", Qt, B(s.label), 1),
1264
+ s.description ? (d(), h("span", Jt, B(s.description), 1)) : X("", !0)
1265
+ ]),
1266
+ e.modelValue === s.value ? (d(), h("svg", en, [...T[4] || (T[4] = [
1267
+ t("path", { d: "M5 12.5l4.2 4.2L19 7" }, null, -1)
1268
+ ])])) : (d(), h("span", tn))
1269
+ ], 10, Gt))), 128))
1270
+ ], 512)
1271
+ ], 8, Kt)
1272
+ ], 6));
1273
+ }
1274
+ }, Pl = /* @__PURE__ */ ue(nn, [["__scopeId", "data-v-4afed32a"]]), an = ["aria-label"], ln = { class: "ui-gauge__dial" }, rn = {
1275
+ viewBox: "0 0 200 140",
1276
+ "aria-hidden": "true"
1277
+ }, on = { class: "ui-gauge__center" }, sn = { class: "ui-gauge__caption" }, Oe = "M 26.7 126.68 A 78 78 0 1 1 173.3 126.68", un = {
1278
+ __name: "UiGauge",
1279
+ props: {
1280
+ value: { type: Number, default: 72 },
1281
+ label: { type: String, default: "今日达成" }
1282
+ },
1283
+ setup(e) {
1284
+ const u = e, n = O(() => {
1285
+ const a = Number(u.value);
1286
+ return Number.isFinite(a) ? Math.min(100, Math.max(0, a)) : 0;
1287
+ }), g = O(() => 100 - n.value);
1288
+ return (a, p) => (d(), h("div", {
1289
+ class: "ui-gauge",
1290
+ role: "img",
1291
+ "aria-label": `${e.label} ${n.value}%`
1292
+ }, [
1293
+ t("div", ln, [
1294
+ (d(), h("svg", rn, [
1295
+ t("path", {
1296
+ class: "ui-gauge__track",
1297
+ d: Oe,
1298
+ pathLength: "100",
1299
+ fill: "none"
1300
+ }),
1301
+ t("path", {
1302
+ class: "ui-gauge__progress",
1303
+ d: Oe,
1304
+ pathLength: "100",
1305
+ fill: "none",
1306
+ style: ne({ strokeDashoffset: g.value })
1307
+ }, null, 4)
1308
+ ])),
1309
+ t("div", on, [
1310
+ t("strong", null, [
1311
+ ze(B(n.value), 1),
1312
+ p[0] || (p[0] = t("small", null, "%", -1))
1313
+ ]),
1314
+ t("span", sn, B(e.label), 1)
1315
+ ])
1316
+ ]),
1317
+ p[1] || (p[1] = t("div", {
1318
+ class: "ui-gauge__scale",
1319
+ "aria-hidden": "true"
1320
+ }, [
1321
+ t("span", null, "0"),
1322
+ t("span", null, "100")
1323
+ ], -1))
1324
+ ], 8, an));
1325
+ }
1326
+ }, Tl = /* @__PURE__ */ ue(un, [["__scopeId", "data-v-02718fb3"]]), dn = { class: "ui-heatmap" }, cn = { class: "ui-heatmap__head" }, fn = { class: "ui-heatmap__body" }, pn = ["aria-label"], vn = ["data-level", "title"], mn = {
1327
+ class: "ui-heatmap__legend",
1328
+ "aria-hidden": "true"
1329
+ }, hn = ["data-level"], gn = {
1330
+ __name: "UiHeatmap",
1331
+ props: {
1332
+ values: {
1333
+ type: Array,
1334
+ default: () => Array.from({ length: 84 }, (e, u) => {
1335
+ const n = Math.sin(u * 0.62) * 1.8 + Math.cos(u * 0.19) * 1.1 + 2;
1336
+ return Math.max(0, Math.min(4, Math.round(n)));
1337
+ })
1338
+ },
1339
+ weeks: { type: Number, default: 12 },
1340
+ label: { type: String, default: "活动热力图" }
1341
+ },
1342
+ setup(e) {
1343
+ const u = e, n = O(() => {
1344
+ const g = Math.max(1, u.weeks) * 7, a = u.values.slice(0, g).map((p) => {
1345
+ const v = Number(p);
1346
+ return Number.isFinite(v) ? Math.min(4, Math.max(0, Math.round(v))) : 0;
1347
+ });
1348
+ for (; a.length < g; ) a.push(0);
1349
+ return a.map((p, v) => ({
1350
+ level: p,
1351
+ title: `第 ${Math.floor(v / 7) + 1} 周 · 第 ${v % 7 + 1} 天 · 等级 ${p}`
1352
+ }));
1353
+ });
1354
+ return (g, a) => (d(), h("div", dn, [
1355
+ t("div", cn, [
1356
+ t("span", null, B(e.label), 1),
1357
+ t("span", null, "近 " + B(e.weeks) + " 周", 1)
1358
+ ]),
1359
+ t("div", fn, [
1360
+ t("div", {
1361
+ class: "ui-heatmap__grid",
1362
+ role: "img",
1363
+ "aria-label": e.label
1364
+ }, [
1365
+ (d(!0), h(ae, null, oe(n.value, (p, v) => (d(), h("span", {
1366
+ key: v,
1367
+ class: "ui-heatmap__cell",
1368
+ "data-level": p.level,
1369
+ title: p.title
1370
+ }, null, 8, vn))), 128))
1371
+ ], 8, pn)
1372
+ ]),
1373
+ t("div", mn, [
1374
+ a[0] || (a[0] = t("span", null, "少", -1)),
1375
+ (d(), h(ae, null, oe(5, (p) => t("i", {
1376
+ key: p,
1377
+ "data-level": p - 1
1378
+ }, null, 8, hn)), 64)),
1379
+ a[1] || (a[1] = t("span", null, "多", -1))
1380
+ ])
1381
+ ]));
1382
+ }
1383
+ }, Bl = /* @__PURE__ */ ue(gn, [["__scopeId", "data-v-aba10172"]]), yn = { class: "ui-field" }, bn = {
1384
+ key: 0,
1385
+ class: "ui-field__label"
1386
+ }, wn = {
1387
+ key: 0,
1388
+ class: "ui-field__icon"
1389
+ }, xn = ["type", "value", "placeholder", "disabled", "autocomplete", "min", "max", "step", "inputmode", "aria-invalid"], _n = {
1390
+ key: 1,
1391
+ class: "ui-field__icon"
1392
+ }, kn = {
1393
+ key: 1,
1394
+ class: "ui-field__error"
1395
+ }, $n = {
1396
+ key: 2,
1397
+ class: "ui-field__hint"
1398
+ }, Fl = {
1399
+ __name: "UiInput",
1400
+ props: {
1401
+ modelValue: { type: [String, Number], default: "" },
1402
+ label: { type: String, default: "" },
1403
+ type: { type: String, default: "text" },
1404
+ placeholder: { type: String, default: "" },
1405
+ hint: { type: String, default: "" },
1406
+ error: { type: String, default: "" },
1407
+ disabled: { type: Boolean, default: !1 },
1408
+ autocomplete: { type: String, default: "off" },
1409
+ min: { type: [String, Number], default: void 0 },
1410
+ max: { type: [String, Number], default: void 0 },
1411
+ step: { type: [String, Number], default: void 0 },
1412
+ inputmode: { type: String, default: void 0 }
1413
+ },
1414
+ emits: ["update:modelValue"],
1415
+ setup(e, { emit: u }) {
1416
+ const n = u;
1417
+ function g(a) {
1418
+ n("update:modelValue", a.target.value);
1419
+ }
1420
+ return (a, p) => (d(), h("label", yn, [
1421
+ e.label ? (d(), h("span", bn, B(e.label), 1)) : X("", !0),
1422
+ t("span", {
1423
+ class: U(["ui-field__control", { "is-error": !!e.error }])
1424
+ }, [
1425
+ a.$slots.prefix ? (d(), h("span", wn, [
1426
+ ie(a.$slots, "prefix")
1427
+ ])) : X("", !0),
1428
+ t("input", {
1429
+ type: e.type,
1430
+ value: e.modelValue,
1431
+ placeholder: e.placeholder,
1432
+ disabled: e.disabled,
1433
+ autocomplete: e.autocomplete,
1434
+ min: e.min,
1435
+ max: e.max,
1436
+ step: e.step,
1437
+ inputmode: e.inputmode,
1438
+ "aria-invalid": !!e.error,
1439
+ onInput: g
1440
+ }, null, 40, xn),
1441
+ a.$slots.suffix ? (d(), h("span", _n, [
1442
+ ie(a.$slots, "suffix")
1443
+ ])) : X("", !0)
1444
+ ], 2),
1445
+ e.error ? (d(), h("span", kn, B(e.error), 1)) : e.hint ? (d(), h("span", $n, B(e.hint), 1)) : X("", !0)
1446
+ ]));
1447
+ }
1448
+ }, Mn = { class: "chart-wrap" }, Sn = ["id", "viewBox", "aria-label"], Cn = ["y1", "y2"], En = ["d"], An = ["d"], Vn = ["cx", "cy"], Ee = 300, ye = 8, Ae = 92, Pn = {
1449
+ __name: "UiLineChart",
1450
+ props: {
1451
+ id: { type: String, default: "" },
1452
+ data: {
1453
+ type: Array,
1454
+ default: () => [58, 62, 60, 66, 72, 68, 74, 70, 64, 61, 63, 59]
1455
+ },
1456
+ labels: {
1457
+ type: Array,
1458
+ default: () => ["06:00", "07:00", "08:00", "09:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00"]
1459
+ },
1460
+ viewBoxHeight: { type: Number, default: 92 },
1461
+ gridY: { type: Array, default: () => [23, 46, 69] },
1462
+ ariaLabel: { type: String, default: "趋势曲线" }
1463
+ },
1464
+ setup(e) {
1465
+ const u = e, n = C(null), g = C(!1), a = C(0), p = C(0), v = C("0%"), r = C(""), i = O(() => {
1466
+ const b = u.data, y = Math.min.apply(null, b), P = Math.max.apply(null, b) - y || 1, F = (Ee - ye * 2) / (b.length - 1), D = b.map((K, I) => {
1467
+ const J = ye + I * F, q = Ae - ye - (K - y) / P * (Ae - ye * 2);
1468
+ return [J, q];
1469
+ }), H = D.map(([K, I], J) => `${J === 0 ? "M" : "L"}${K.toFixed(1)},${I.toFixed(1)}`).join(" "), z = `${H} L${(Ee - ye).toFixed(1)},${(Ae - ye).toFixed(1)} L${ye},${(Ae - ye).toFixed(1)} Z`;
1470
+ return { points: D, line: H, area: z, stepX: F };
1471
+ });
1472
+ function f(b) {
1473
+ const y = n.value;
1474
+ if (!y) return;
1475
+ const k = y.getBoundingClientRect(), F = Math.max(0, Math.min(1, (b - k.left) / k.width)) * Ee;
1476
+ let D = Math.round((F - ye) / i.value.stepX);
1477
+ D = Math.max(0, Math.min(u.data.length - 1, D));
1478
+ const H = i.value.points[D];
1479
+ a.value = H[0], p.value = H[1], g.value = !0, v.value = `${H[0] / Ee * 100}%`, r.value = `${u.labels[D] || ""} · ${u.data[D]}`;
1480
+ }
1481
+ function _() {
1482
+ g.value = !1;
1483
+ }
1484
+ return (b, y) => (d(), h("div", Mn, [
1485
+ (d(), h("svg", {
1486
+ ref_key: "svgEl",
1487
+ ref: n,
1488
+ class: "chart",
1489
+ id: e.id,
1490
+ viewBox: `0 0 300 ${e.viewBoxHeight}`,
1491
+ preserveAspectRatio: "none",
1492
+ role: "img",
1493
+ "aria-label": e.ariaLabel,
1494
+ onPointermove: y[0] || (y[0] = (k) => f(k.clientX)),
1495
+ onPointerdown: y[1] || (y[1] = (k) => f(k.clientX)),
1496
+ onPointerleave: _
1497
+ }, [
1498
+ (d(!0), h(ae, null, oe(e.gridY, (k) => (d(), h("line", {
1499
+ key: k,
1500
+ class: "grid-line",
1501
+ x1: "6",
1502
+ y1: k,
1503
+ x2: "294",
1504
+ y2: k
1505
+ }, null, 8, Cn))), 128)),
1506
+ t("path", {
1507
+ class: "area",
1508
+ fill: "url(#heartGrad)",
1509
+ d: i.value.area
1510
+ }, null, 8, En),
1511
+ t("path", {
1512
+ class: "line",
1513
+ fill: "none",
1514
+ stroke: "var(--primary)",
1515
+ "stroke-width": "2.5",
1516
+ "stroke-linecap": "round",
1517
+ "stroke-linejoin": "round",
1518
+ d: i.value.line
1519
+ }, null, 8, An),
1520
+ t("circle", {
1521
+ class: U(["chart-dot", { show: g.value }]),
1522
+ cx: a.value,
1523
+ cy: p.value,
1524
+ r: "4"
1525
+ }, null, 10, Vn)
1526
+ ], 40, Sn)),
1527
+ t("div", {
1528
+ class: U(["chart-tip", { show: g.value }]),
1529
+ style: ne({ left: v.value })
1530
+ }, B(r.value), 7)
1531
+ ]));
1532
+ }
1533
+ }, Ll = /* @__PURE__ */ ue(Pn, [["__scopeId", "data-v-55557827"]]), Tn = ["aria-label"], Bn = { class: "ui-modal__head" }, Fn = { class: "ui-modal__title" }, Ln = { class: "ui-modal__body" }, Nn = {
1534
+ key: 0,
1535
+ class: "ui-modal__footer"
1536
+ }, Rn = 80, Nl = {
1537
+ __name: "UiModal",
1538
+ props: {
1539
+ modelValue: { type: Boolean, default: !1 },
1540
+ title: { type: String, default: "" },
1541
+ maxWidth: { type: String, default: "420px" }
1542
+ },
1543
+ emits: ["update:modelValue", "close"],
1544
+ setup(e, { expose: u, emit: n }) {
1545
+ const g = e, a = n, p = C(null), v = C(!1), r = C(!1), i = C(!1);
1546
+ let f = null, _ = "", b = null, y = 0, k = 0, P = !1;
1547
+ function F(M, j) {
1548
+ const te = getComputedStyle(document.documentElement).getPropertyValue(M).trim();
1549
+ if (!te) return j;
1550
+ const G = parseFloat(te);
1551
+ return Number.isFinite(G) ? te.endsWith("ms") ? G : G * 1e3 : j;
1552
+ }
1553
+ function D() {
1554
+ return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
1555
+ }
1556
+ function H() {
1557
+ y && cancelAnimationFrame(y), k && cancelAnimationFrame(k), y = 0, k = 0;
1558
+ }
1559
+ function z() {
1560
+ g.modelValue && (a("update:modelValue", !1), a("close"));
1561
+ }
1562
+ function K(M) {
1563
+ M.key === "Escape" && g.modelValue && (M.stopPropagation(), z());
1564
+ }
1565
+ function I() {
1566
+ f || (f = document.getElementById("scrollArea"), f && (_ = f.style.overflow, f.style.overflow = "hidden"));
1567
+ }
1568
+ function J() {
1569
+ f && (f.style.overflow = _, f = null);
1570
+ }
1571
+ function q() {
1572
+ if (clearTimeout(b), b = null, H(), v.value && P && !r.value) {
1573
+ i.value = !1, r.value = !0, I();
1574
+ return;
1575
+ }
1576
+ v.value = !0, i.value = !1, r.value = !1, I(), ve(() => {
1577
+ const M = p.value;
1578
+ !g.modelValue || !M || (M.focus({ preventScroll: !0 }), M.offsetHeight, y = requestAnimationFrame(() => {
1579
+ y = 0, k = requestAnimationFrame(() => {
1580
+ k = 0, g.modelValue && (r.value = !0, P = !0);
1581
+ });
1582
+ }));
1583
+ });
1584
+ }
1585
+ function Q() {
1586
+ v.value = !1, r.value = !1, i.value = !1, P = !1, J();
1587
+ }
1588
+ function N() {
1589
+ if (H(), clearTimeout(b), b = null, !P) {
1590
+ Q();
1591
+ return;
1592
+ }
1593
+ i.value = !0, r.value = !1;
1594
+ const M = D() ? 0 : F("--spring-exit-dur", 650);
1595
+ b = setTimeout(() => {
1596
+ b = null, Q();
1597
+ }, M + Rn);
1598
+ }
1599
+ return be(() => g.modelValue, (M) => {
1600
+ M ? q() : (v.value || P) && N();
1601
+ }, { immediate: !0 }), document.addEventListener("keydown", K), ge(() => {
1602
+ clearTimeout(b), b = null, H(), J(), document.removeEventListener("keydown", K);
1603
+ }), u({ close: z }), (M, j) => (d(), xe(Pe, { to: "body" }, [
1604
+ v.value ? (d(), h("div", {
1605
+ key: 0,
1606
+ class: U(["ui-modal", { "is-open": r.value, "is-closing": i.value }])
1607
+ }, [
1608
+ t("div", {
1609
+ class: U(["ui-scrim", { "is-open": r.value }]),
1610
+ "aria-hidden": "true",
1611
+ onClick: z
1612
+ }, null, 2),
1613
+ t("div", {
1614
+ ref_key: "panel",
1615
+ ref: p,
1616
+ class: "ui-modal__panel",
1617
+ style: ne({ maxWidth: e.maxWidth }),
1618
+ role: "dialog",
1619
+ "aria-modal": "true",
1620
+ "aria-label": e.title || "对话框",
1621
+ tabindex: "-1"
1622
+ }, [
1623
+ ie(M.$slots, "header", { close: z }, () => [
1624
+ t("div", Bn, [
1625
+ ie(M.$slots, "title", {}, () => [
1626
+ t("div", Fn, B(e.title), 1)
1627
+ ]),
1628
+ t("button", {
1629
+ type: "button",
1630
+ class: "ui-modal__close",
1631
+ "aria-label": "关闭对话框",
1632
+ onClick: z
1633
+ }, [...j[0] || (j[0] = [
1634
+ t("svg", {
1635
+ viewBox: "0 0 24 24",
1636
+ fill: "none",
1637
+ stroke: "currentColor",
1638
+ "stroke-width": "2.4",
1639
+ "stroke-linecap": "round",
1640
+ "aria-hidden": "true"
1641
+ }, [
1642
+ t("path", { d: "M6 6l12 12M18 6L6 18" })
1643
+ ], -1)
1644
+ ])])
1645
+ ])
1646
+ ]),
1647
+ t("div", Ln, [
1648
+ ie(M.$slots, "default", { close: z })
1649
+ ]),
1650
+ M.$slots.footer ? (d(), h("div", Nn, [
1651
+ ie(M.$slots, "footer", { close: z })
1652
+ ])) : X("", !0)
1653
+ ], 12, Tn)
1654
+ ], 2)) : X("", !0)
1655
+ ]));
1656
+ }
1657
+ }, Dn = { class: "ui-progress" }, Un = {
1658
+ key: 0,
1659
+ class: "ui-progress__head"
1660
+ }, Wn = { key: 0 }, On = ["aria-valuenow", "aria-valuemax"], Rl = {
1661
+ __name: "UiProgress",
1662
+ props: {
1663
+ value: { type: Number, default: 0 },
1664
+ max: { type: Number, default: 100 },
1665
+ label: { type: String, default: "" },
1666
+ tone: { type: String, default: "primary" },
1667
+ showValue: { type: Boolean, default: !0 }
1668
+ },
1669
+ setup(e) {
1670
+ const u = e, n = O(() => Math.max(0, Math.min(100, u.value / u.max * 100)));
1671
+ return (g, a) => (d(), h("div", Dn, [
1672
+ e.label || e.showValue ? (d(), h("div", Un, [
1673
+ t("span", null, B(e.label), 1),
1674
+ e.showValue ? (d(), h("span", Wn, B(Math.round(n.value)) + "%", 1)) : X("", !0)
1675
+ ])) : X("", !0),
1676
+ t("div", {
1677
+ class: "ui-progress__track",
1678
+ role: "progressbar",
1679
+ "aria-valuenow": e.value,
1680
+ "aria-valuemin": 0,
1681
+ "aria-valuemax": e.max
1682
+ }, [
1683
+ t("div", {
1684
+ class: U(["ui-progress__bar", e.tone !== "primary" ? `ui-progress__bar--${e.tone}` : ""]),
1685
+ style: ne({ width: n.value + "%" })
1686
+ }, null, 6)
1687
+ ], 8, On)
1688
+ ]));
1689
+ }
1690
+ }, Hn = {
1691
+ class: "ui-radio-group",
1692
+ role: "radiogroup"
1693
+ }, In = ["name", "value", "checked", "onChange"], Dl = {
1694
+ __name: "UiRadioGroup",
1695
+ props: {
1696
+ modelValue: { type: [String, Number], default: "" },
1697
+ options: { type: Array, default: () => [] },
1698
+ name: { type: String, default: "ui-radio" }
1699
+ },
1700
+ emits: ["update:modelValue"],
1701
+ setup(e, { emit: u }) {
1702
+ const n = u;
1703
+ return (g, a) => (d(), h("div", Hn, [
1704
+ (d(!0), h(ae, null, oe(e.options, (p) => (d(), h("label", {
1705
+ key: p.value,
1706
+ class: "ui-radio"
1707
+ }, [
1708
+ t("input", {
1709
+ type: "radio",
1710
+ name: e.name,
1711
+ value: p.value,
1712
+ checked: e.modelValue === p.value,
1713
+ onChange: (v) => n("update:modelValue", p.value)
1714
+ }, null, 40, In),
1715
+ a[0] || (a[0] = t("span", {
1716
+ class: "ui-radio__dot",
1717
+ "aria-hidden": "true"
1718
+ }, null, -1)),
1719
+ t("span", null, B(p.label), 1)
1720
+ ]))), 128))
1721
+ ]));
1722
+ }
1723
+ }, zn = { class: "ui-rating" }, qn = { class: "ui-rating__head" }, jn = { class: "ui-rating__label" }, Yn = { class: "ui-rating__value" }, Kn = ["aria-label"], Xn = ["aria-checked", "aria-label", "onMouseenter", "onFocus", "onClick"], Gn = {
1724
+ __name: "UiRating",
1725
+ props: {
1726
+ modelValue: { type: Number, default: 4 },
1727
+ max: { type: Number, default: 5 },
1728
+ label: { type: String, default: "评分" }
1729
+ },
1730
+ emits: ["update:modelValue"],
1731
+ setup(e, { emit: u }) {
1732
+ const n = e, g = u, a = C(0), p = C(Number(n.modelValue));
1733
+ be(() => n.modelValue, (f) => {
1734
+ p.value = Number(f);
1735
+ });
1736
+ const v = O(() => Array.from({ length: n.max }, (f, _) => _ + 1)), r = O(() => a.value || p.value);
1737
+ function i(f) {
1738
+ p.value = f, g("update:modelValue", f);
1739
+ }
1740
+ return (f, _) => (d(), h("div", zn, [
1741
+ t("div", qn, [
1742
+ t("span", jn, B(e.label), 1),
1743
+ t("span", Yn, B(p.value) + " / " + B(e.max), 1)
1744
+ ]),
1745
+ t("div", {
1746
+ class: "ui-rating__stars",
1747
+ role: "radiogroup",
1748
+ "aria-label": e.label,
1749
+ onMouseleave: _[1] || (_[1] = (b) => a.value = 0)
1750
+ }, [
1751
+ (d(!0), h(ae, null, oe(v.value, (b) => (d(), h("button", {
1752
+ key: b,
1753
+ type: "button",
1754
+ role: "radio",
1755
+ "aria-checked": e.modelValue === b,
1756
+ "aria-label": `${b} 星`,
1757
+ class: U({ "is-filled": b <= r.value }),
1758
+ onMouseenter: (y) => a.value = b,
1759
+ onFocus: (y) => a.value = b,
1760
+ onBlur: _[0] || (_[0] = (y) => a.value = 0),
1761
+ onClick: (y) => i(b)
1762
+ }, [..._[2] || (_[2] = [
1763
+ t("svg", {
1764
+ viewBox: "0 0 24 24",
1765
+ fill: "none",
1766
+ stroke: "currentColor",
1767
+ "stroke-width": "1.8",
1768
+ "stroke-linecap": "round",
1769
+ "stroke-linejoin": "round",
1770
+ "aria-hidden": "true"
1771
+ }, [
1772
+ t("path", { d: "M12 3.6l2.6 5.3 5.8.8-4.2 4.1 1 5.8-5.2-2.7-5.2 2.7 1-5.8L3.6 9.7l5.8-.8L12 3.6z" })
1773
+ ], -1)
1774
+ ])], 42, Xn))), 128))
1775
+ ], 40, Kn)
1776
+ ]));
1777
+ }
1778
+ }, Ul = /* @__PURE__ */ ue(Gn, [["__scopeId", "data-v-713a0ba8"]]), Zn = ["aria-label"], Qn = ["viewBox"], Jn = ["cx", "cy", "r", "stroke-width"], ea = ["cx", "cy", "r", "stroke-width", "stroke-dasharray", "stroke-dashoffset", "transform"], ta = { class: "ui-ring__center" }, na = {
1779
+ __name: "UiRingProgress",
1780
+ props: {
1781
+ value: { type: Number, default: 78 },
1782
+ size: { type: Number, default: 116 },
1783
+ stroke: { type: Number, default: 10 },
1784
+ label: { type: String, default: "今日目标" }
1785
+ },
1786
+ setup(e) {
1787
+ const u = e, n = O(() => {
1788
+ const i = Number(u.value);
1789
+ return Number.isFinite(i) ? Math.min(100, Math.max(0, i)) : 0;
1790
+ }), g = O(() => u.size / 2 - u.stroke / 2 - 1), a = O(() => u.size / 2), p = O(() => 2 * Math.PI * g.value), v = C(0), r = O(() => p.value * (1 - v.value / 100));
1791
+ return be(n, (i) => {
1792
+ v.value = i;
1793
+ }), Me(() => {
1794
+ var f;
1795
+ if ((f = window.matchMedia) == null ? void 0 : f.call(window, "(prefers-reduced-motion: reduce)").matches) {
1796
+ v.value = n.value;
1797
+ return;
1798
+ }
1799
+ requestAnimationFrame(() => {
1800
+ v.value = n.value;
1801
+ });
1802
+ }), (i, f) => (d(), h("div", {
1803
+ class: "ui-ring",
1804
+ style: ne({ width: `${e.size}px`, height: `${e.size}px` }),
1805
+ role: "img",
1806
+ "aria-label": `${e.label} ${n.value}%`
1807
+ }, [
1808
+ (d(), h("svg", {
1809
+ viewBox: `0 0 ${e.size} ${e.size}`,
1810
+ "aria-hidden": "true"
1811
+ }, [
1812
+ t("circle", {
1813
+ class: "ui-ring__track",
1814
+ cx: a.value,
1815
+ cy: a.value,
1816
+ r: g.value,
1817
+ fill: "none",
1818
+ "stroke-width": e.stroke
1819
+ }, null, 8, Jn),
1820
+ t("circle", {
1821
+ class: "ui-ring__progress",
1822
+ cx: a.value,
1823
+ cy: a.value,
1824
+ r: g.value,
1825
+ fill: "none",
1826
+ "stroke-width": e.stroke,
1827
+ "stroke-dasharray": p.value,
1828
+ "stroke-dashoffset": r.value,
1829
+ transform: `rotate(-90 ${a.value} ${a.value})`
1830
+ }, null, 8, ea)
1831
+ ], 8, Qn)),
1832
+ t("div", ta, [
1833
+ t("strong", null, B(n.value) + "%", 1),
1834
+ t("span", null, B(e.label), 1)
1835
+ ])
1836
+ ], 12, Zn));
1837
+ }
1838
+ }, Wl = /* @__PURE__ */ ue(na, [["__scopeId", "data-v-7c0d1432"]]), aa = {
1839
+ key: 0,
1840
+ class: "ui-segmented-field__label"
1841
+ }, la = {
1842
+ class: "ui-segmented",
1843
+ role: "group"
1844
+ }, ia = ["aria-pressed", "onClick"], Ol = {
1845
+ __name: "UiSegmented",
1846
+ props: {
1847
+ modelValue: { type: [String, Number], default: "" },
1848
+ options: { type: Array, default: () => [] },
1849
+ /* 左上角标签 */
1850
+ label: { type: String, default: "" },
1851
+ /* one-line:标签与分段控件同一行;默认上下堆叠 */
1852
+ layout: { type: String, default: "stack" }
1853
+ },
1854
+ emits: ["update:modelValue"],
1855
+ setup(e, { emit: u }) {
1856
+ const n = e, g = u, a = O(() => n.options.findIndex((v) => v.value === n.modelValue)), p = O(() => {
1857
+ const v = n.options.length;
1858
+ return !v || a.value < 0 ? null : {
1859
+ width: `calc((100% - 6px - ${(v - 1) * 3}px) / ${v})`,
1860
+ transform: `translateX(calc(${a.value * 100}% + ${a.value * 3}px))`
1861
+ };
1862
+ });
1863
+ return (v, r) => (d(), h("div", {
1864
+ class: U(["ui-segmented-field", `ui-segmented-field--${e.layout}`])
1865
+ }, [
1866
+ e.label ? (d(), h("span", aa, B(e.label), 1)) : X("", !0),
1867
+ t("div", la, [
1868
+ p.value ? (d(), h("span", {
1869
+ key: 0,
1870
+ class: "ui-segmented__indicator",
1871
+ style: ne(p.value),
1872
+ "aria-hidden": "true"
1873
+ }, null, 4)) : X("", !0),
1874
+ (d(!0), h(ae, null, oe(e.options, (i) => (d(), h("button", {
1875
+ key: i.value,
1876
+ type: "button",
1877
+ class: U({ "is-active": e.modelValue === i.value }),
1878
+ "aria-pressed": e.modelValue === i.value,
1879
+ onClick: (f) => g("update:modelValue", i.value)
1880
+ }, B(i.label), 11, ia))), 128))
1881
+ ])
1882
+ ], 2));
1883
+ }
1884
+ }, ra = {
1885
+ key: 0,
1886
+ class: "ui-field__label"
1887
+ }, oa = { class: "ui-select__view" }, sa = ["aria-expanded"], ua = ["aria-label", "aria-hidden", "inert"], da = ["aria-selected", "tabindex", "onClick"], ca = { class: "ui-select__option-label" }, fa = {
1888
+ key: 0,
1889
+ class: "ui-select__check",
1890
+ viewBox: "0 0 24 24",
1891
+ fill: "none",
1892
+ stroke: "currentColor",
1893
+ "stroke-width": "2.4",
1894
+ "stroke-linecap": "round",
1895
+ "stroke-linejoin": "round",
1896
+ "aria-hidden": "true"
1897
+ }, pa = {
1898
+ key: 1,
1899
+ class: "ui-field__hint"
1900
+ }, Ce = 12, va = {
1901
+ __name: "UiSelect",
1902
+ props: {
1903
+ modelValue: { type: [String, Number], default: "" },
1904
+ label: { type: String, default: "" },
1905
+ options: { type: Array, default: () => [] },
1906
+ hint: { type: String, default: "" },
1907
+ placeholder: { type: String, default: "请选择" }
1908
+ },
1909
+ emits: ["update:modelValue"],
1910
+ setup(e, { emit: u }) {
1911
+ const n = e, g = u, a = C(null), p = C(null), v = C(null), r = C(!1), i = C(!1), f = C(!1), _ = C(!1), b = C({});
1912
+ let y = null, k = null, P = null, F = null, D = 0, H = 0;
1913
+ const z = O(() => {
1914
+ const l = n.options.find((m) => m.value === n.modelValue);
1915
+ return l ? l.label : n.modelValue === "" || n.modelValue === null || n.modelValue === void 0 ? n.placeholder : String(n.modelValue);
1916
+ });
1917
+ function K(l) {
1918
+ const m = l.getBoundingClientRect();
1919
+ let A = 1, S = 1;
1920
+ const T = getComputedStyle(l).transform;
1921
+ if (T && T !== "none" && typeof DOMMatrixReadOnly == "function") {
1922
+ const R = new DOMMatrixReadOnly(T);
1923
+ A = R.a || 1, S = R.d || 1;
1924
+ }
1925
+ const s = Math.max(1, m.width / A), o = Math.max(1, m.height / S);
1926
+ return {
1927
+ left: m.left + (m.width - s) / 2,
1928
+ top: m.top + (m.height - o) / 2,
1929
+ width: s,
1930
+ height: o
1931
+ };
1932
+ }
1933
+ function I() {
1934
+ return window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
1935
+ }
1936
+ function J(l, m) {
1937
+ const A = getComputedStyle(document.documentElement).getPropertyValue(l).trim();
1938
+ if (!A) return m;
1939
+ const S = parseFloat(A);
1940
+ return Number.isFinite(S) ? A.endsWith("ms") ? S : S * 1e3 : m;
1941
+ }
1942
+ function q(l) {
1943
+ var m;
1944
+ y || !((m = a.value) != null && m.parentNode) || (y = document.createElement("div"), y.setAttribute("aria-hidden", "true"), y.style.cssText = "display:block;visibility:hidden;pointer-events:none;flex-shrink:0;", y.style.height = Math.round(l.height) + "px", a.value.parentNode.insertBefore(y, a.value));
1945
+ }
1946
+ function Q() {
1947
+ y && (y.remove(), y = null);
1948
+ }
1949
+ function N(l, m) {
1950
+ const A = p.value, S = v.value;
1951
+ if (!A || !S) return { height: 0, shiftY: 0 };
1952
+ const T = A.style.width;
1953
+ A.style.width = l + "px";
1954
+ const s = S.offsetHeight, o = S.querySelector(".is-selected"), R = o ? Math.round(o.offsetTop + o.offsetHeight / 2 - m / 2) : 0;
1955
+ return A.style.width = T, { height: Math.ceil(s), shiftY: R };
1956
+ }
1957
+ const M = Le({
1958
+ // 收起途中也允许按下,才有机会打断收起、重新展开。
1959
+ canPress: () => !r.value,
1960
+ onPressStart: () => {
1961
+ f.value = !0;
1962
+ },
1963
+ onPressEnd: () => {
1964
+ f.value = !1;
1965
+ }
1966
+ });
1967
+ async function j(l = !1) {
1968
+ if (r.value) return;
1969
+ i.value = !1;
1970
+ const m = a.value;
1971
+ if (!m) return;
1972
+ const A = m.closest(".view");
1973
+ if (A && typeof A.getAnimations == "function")
1974
+ try {
1975
+ A.getAnimations().forEach((pe) => pe.finish());
1976
+ } catch {
1977
+ }
1978
+ const S = K(m), T = S.width, s = S.height, o = S.left, R = S.top, w = getComputedStyle(m);
1979
+ D = parseFloat(w.borderLeftWidth) || 0, H = parseFloat(w.borderTopWidth) || 0, P = { left: o, top: R, width: T, height: s }, F = null, q(P), b.value = {
1980
+ left: o + "px",
1981
+ top: R + "px",
1982
+ width: T + "px",
1983
+ height: s + "px",
1984
+ "--select-shift": "0px"
1985
+ }, _.value = !0, f.value = !1, await ve();
1986
+ const V = Math.max(1, T - D * 2), { height: L, shiftY: re } = N(V, s), ce = L + H * 2, fe = Math.max(s, Math.min(ce, window.innerHeight - Ce * 2));
1987
+ let me = o;
1988
+ me = Math.max(Ce, Math.min(me, window.innerWidth - Ce - T));
1989
+ let we = R;
1990
+ we = Math.max(Ce, Math.min(we, window.innerHeight - Ce - fe)), m.offsetWidth, requestAnimationFrame(() => {
1991
+ var pe;
1992
+ _.value && (F = {
1993
+ left: Math.round(me) + "px",
1994
+ top: Math.round(we) + "px",
1995
+ width: T + "px",
1996
+ height: fe + "px",
1997
+ "--select-shift": re + "px"
1998
+ }, b.value = { ...F }, r.value = !0, l && ((pe = p.value) == null || pe.focus({ preventScroll: !0 })));
1999
+ });
2000
+ }
2001
+ function te() {
2002
+ if (clearTimeout(k), k = null, f.value = !1, !_.value || !F) {
2003
+ i.value = !1, r.value = !1, j();
2004
+ return;
2005
+ }
2006
+ if (i.value = !1, r.value = !0, P) {
2007
+ const l = Math.max(1, P.width - D * 2), { shiftY: m } = N(l, P.height);
2008
+ F = { ...F, "--select-shift": m + "px" };
2009
+ }
2010
+ b.value = { ...F };
2011
+ }
2012
+ function G() {
2013
+ clearTimeout(k), k = null, i.value = !1, r.value = !1, _.value = !1, f.value = !1, b.value = {}, P = null, F = null, Q();
2014
+ }
2015
+ async function Z() {
2016
+ if (i.value || !r.value) return;
2017
+ clearTimeout(k), i.value = !0, r.value = !1, await ve();
2018
+ const l = a.value;
2019
+ l && l.offsetWidth, P && (b.value = {
2020
+ left: P.left + "px",
2021
+ top: P.top + "px",
2022
+ width: P.width + "px",
2023
+ height: P.height + "px",
2024
+ "--select-shift": "0px"
2025
+ });
2026
+ const m = I() ? 0 : J("--spring-exit-dur", 400);
2027
+ k = setTimeout(G, m + 80);
2028
+ }
2029
+ function ee(l) {
2030
+ if (r.value) {
2031
+ Z();
2032
+ return;
2033
+ }
2034
+ if (i.value) {
2035
+ te();
2036
+ return;
2037
+ }
2038
+ j(l.detail === 0);
2039
+ }
2040
+ function W(l) {
2041
+ if (l.value === n.modelValue) {
2042
+ Z();
2043
+ return;
2044
+ }
2045
+ g("update:modelValue", l.value), Z();
2046
+ }
2047
+ function $(l) {
2048
+ var m;
2049
+ i.value || !r.value || (m = a.value) != null && m.contains(l.target) || Z();
2050
+ }
2051
+ function E(l) {
2052
+ l.key === "Escape" && (r.value || i.value) && (l.stopPropagation(), M.cancelPress(), Z());
2053
+ }
2054
+ function c(l) {
2055
+ var m;
2056
+ if (!((m = a.value) != null && m.contains(l.target))) {
2057
+ if (i.value || _.value && !r.value) {
2058
+ G();
2059
+ return;
2060
+ }
2061
+ r.value && Z();
2062
+ }
2063
+ }
2064
+ function x() {
2065
+ (r.value || i.value) && Z();
2066
+ }
2067
+ return Me(() => {
2068
+ document.addEventListener("pointerdown", $), document.addEventListener("keydown", E), window.addEventListener("scroll", c, !0), window.addEventListener("resize", x);
2069
+ }), Te(() => {
2070
+ M.cancelPress(), G();
2071
+ }), ge(() => {
2072
+ clearTimeout(k), M.cancelPress(), document.removeEventListener("pointerdown", $), document.removeEventListener("keydown", E), window.removeEventListener("scroll", c, !0), window.removeEventListener("resize", x), Q();
2073
+ }), (l, m) => (d(), h("div", {
2074
+ class: U(["ui-field ui-select", { "is-open": r.value, "is-closing": i.value }])
2075
+ }, [
2076
+ e.label ? (d(), h("span", ra, B(e.label), 1)) : X("", !0),
2077
+ t("div", {
2078
+ ref_key: "surfaceEl",
2079
+ ref: a,
2080
+ class: U(["ui-select__surface", {
2081
+ "is-open": r.value,
2082
+ "is-closing": i.value,
2083
+ "is-floating": _.value,
2084
+ "is-pressed": f.value
2085
+ }]),
2086
+ style: ne(b.value)
2087
+ }, [
2088
+ t("div", oa, [
2089
+ t("button", {
2090
+ type: "button",
2091
+ class: "ui-select__field",
2092
+ "aria-haspopup": "listbox",
2093
+ "aria-expanded": r.value,
2094
+ onPointerdown: m[0] || (m[0] = (...A) => Y(M).onPointerDown && Y(M).onPointerDown(...A)),
2095
+ onClick: ee,
2096
+ onContextmenu: m[1] || (m[1] = $e(() => {
2097
+ }, ["prevent"]))
2098
+ }, [
2099
+ t("span", {
2100
+ class: U(["ui-select__value", { "is-placeholder": z.value === Y(y) }])
2101
+ }, B(z.value), 3),
2102
+ m[2] || (m[2] = t("span", {
2103
+ class: "ui-select__chevron",
2104
+ "aria-hidden": "true"
2105
+ }, [
2106
+ t("svg", {
2107
+ viewBox: "0 0 24 24",
2108
+ fill: "none",
2109
+ stroke: "currentColor",
2110
+ "stroke-width": "2",
2111
+ "stroke-linecap": "round",
2112
+ "stroke-linejoin": "round"
2113
+ }, [
2114
+ t("path", { d: "M6 9l6 6 6-6" })
2115
+ ])
2116
+ ], -1))
2117
+ ], 40, sa)
2118
+ ]),
2119
+ t("div", {
2120
+ ref_key: "panelEl",
2121
+ ref: p,
2122
+ class: "ui-select__panel",
2123
+ role: "listbox",
2124
+ "aria-label": e.label || "选项",
2125
+ "aria-hidden": r.value ? "false" : "true",
2126
+ inert: r.value ? null : "",
2127
+ tabindex: "-1"
2128
+ }, [
2129
+ t("div", {
2130
+ ref_key: "panelContentEl",
2131
+ ref: v,
2132
+ class: "ui-select__panel-inner"
2133
+ }, [
2134
+ (d(!0), h(ae, null, oe(e.options, (A) => (d(), h("button", {
2135
+ key: A.value,
2136
+ type: "button",
2137
+ role: "option",
2138
+ "aria-selected": A.value === e.modelValue,
2139
+ tabindex: r.value ? 0 : -1,
2140
+ class: U(["ui-select__option", { "is-selected": A.value === e.modelValue }]),
2141
+ onClick: (S) => W(A)
2142
+ }, [
2143
+ t("span", ca, B(A.label), 1),
2144
+ A.value === e.modelValue ? (d(), h("svg", fa, [...m[3] || (m[3] = [
2145
+ t("path", { d: "M5 12.5l4.2 4.2L19 7" }, null, -1)
2146
+ ])])) : X("", !0)
2147
+ ], 10, da))), 128))
2148
+ ], 512)
2149
+ ], 8, ua)
2150
+ ], 6),
2151
+ e.hint ? (d(), h("span", pa, B(e.hint), 1)) : X("", !0)
2152
+ ], 2));
2153
+ }
2154
+ }, Hl = /* @__PURE__ */ ue(va, [["__scopeId", "data-v-922f19c9"]]), Il = {
2155
+ __name: "UiSkeleton",
2156
+ props: {
2157
+ width: { type: String, default: "100%" },
2158
+ height: { type: String, default: "14px" },
2159
+ radius: { type: String, default: "10px" }
2160
+ },
2161
+ setup(e) {
2162
+ return (u, n) => (d(), h("span", {
2163
+ class: "ui-skeleton",
2164
+ style: ne({ width: e.width, height: e.height, borderRadius: e.radius }),
2165
+ "aria-hidden": "true"
2166
+ }, null, 4));
2167
+ }
2168
+ }, ma = { class: "ui-slider__head" }, ha = {
2169
+ key: 0,
2170
+ class: "ui-slider__label"
2171
+ }, ga = {
2172
+ key: 1,
2173
+ class: "ui-slider__value"
2174
+ }, ya = ["aria-label", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext"], ba = {
2175
+ __name: "UiSlider",
2176
+ props: {
2177
+ modelValue: { type: Number, default: 50 },
2178
+ min: { type: Number, default: 0 },
2179
+ max: { type: Number, default: 100 },
2180
+ step: { type: Number, default: 1 },
2181
+ label: { type: String, default: "" },
2182
+ unit: { type: String, default: "" },
2183
+ showValue: { type: Boolean, default: !0 },
2184
+ /* 吸附点:自定义数组,例如 [0, 25, 50, 75, 100] */
2185
+ stops: { type: Array, default: null },
2186
+ /* 或者等分:snapCount=4 -> min + i*(max-min)/4 */
2187
+ snapCount: { type: Number, default: 0 },
2188
+ /* 临界阻尼弹簧:stiffness 越大越快,ratio=1 临界阻尼不回弹 */
2189
+ stiffness: { type: Number, default: 520 },
2190
+ dampingRatio: { type: Number, default: 1 },
2191
+ /* 松手后的速度投射时长(秒):目标 = 预测位置附近最近的吸附点 */
2192
+ flingTime: { type: Number, default: 0.11 },
2193
+ /* 越界橡皮筋:0 完全锁死,1 完全跟手 */
2194
+ rubber: { type: Number, default: 0.32 },
2195
+ maxOverscroll: { type: Number, default: 0.06 }
2196
+ },
2197
+ emits: ["update:modelValue", "snap", "drag-start", "drag-end"],
2198
+ setup(e, { emit: u }) {
2199
+ const n = e, g = u, a = C(null), p = C(!1), v = C(k(n.modelValue));
2200
+ let r = v.value, i = 0, f = 0;
2201
+ const _ = O(() => {
2202
+ if (Array.isArray(n.stops) && n.stops.length)
2203
+ return [...n.stops].filter((c) => Number.isFinite(c)).sort((c, x) => c - x);
2204
+ if (n.snapCount > 1) {
2205
+ const c = [];
2206
+ for (let x = 0; x < n.snapCount; x += 1)
2207
+ c.push(n.min + y.value * x / (n.snapCount - 1));
2208
+ return c;
2209
+ }
2210
+ return null;
2211
+ }), b = O(() => Array.isArray(_.value) && _.value.length > 0), y = O(() => n.max - n.min || 1);
2212
+ function k(c) {
2213
+ return Number.isFinite(c) ? Math.min(n.max, Math.max(n.min, c)) : n.min;
2214
+ }
2215
+ function P(c) {
2216
+ if (n.step > 0) {
2217
+ const x = Math.round((c - n.min) / n.step) * n.step + n.min;
2218
+ return Math.min(n.max, Math.max(n.min, x));
2219
+ }
2220
+ return Math.min(n.max, Math.max(n.min, c));
2221
+ }
2222
+ const F = O(() => (v.value - n.min) / y.value * 100), D = O(() => P(v.value));
2223
+ be(() => n.modelValue, (c) => {
2224
+ p.value || Z(k(c));
2225
+ });
2226
+ function H(c) {
2227
+ var m;
2228
+ const x = (m = a.value) == null ? void 0 : m.getBoundingClientRect();
2229
+ if (!x || !x.width) return v.value;
2230
+ const l = (c - x.left) / x.width;
2231
+ return n.min + l * y.value;
2232
+ }
2233
+ function z(c) {
2234
+ const x = c > n.max ? c - n.max : c < n.min ? c - n.min : 0;
2235
+ if (!x) return c;
2236
+ const l = y.value * n.maxOverscroll, m = Math.sign(x) * Math.min(Math.abs(x) * n.rubber, l);
2237
+ return (x > 0 ? n.max : n.min) + m;
2238
+ }
2239
+ let K = [];
2240
+ function I(c) {
2241
+ const x = performance.now();
2242
+ for (K.push({ t: x, v: c }); K.length > 2 && x - K[0].t > 90; ) K.shift();
2243
+ }
2244
+ function J() {
2245
+ if (K.length < 2) return 0;
2246
+ const c = K[0], x = K[K.length - 1], l = (x.t - c.t) / 1e3;
2247
+ return l <= 0 ? 0 : (x.v - c.v) / l;
2248
+ }
2249
+ let q = null;
2250
+ function Q(c) {
2251
+ if (c.button !== void 0 && c.button !== 0 && c.pointerType === "mouse") return;
2252
+ const x = a.value;
2253
+ if (!x) return;
2254
+ $(), p.value = !0, q = c.pointerId;
2255
+ try {
2256
+ x.setPointerCapture(c.pointerId);
2257
+ } catch {
2258
+ }
2259
+ K = [];
2260
+ const l = H(c.clientX);
2261
+ v.value = l, I(l), r = l, g("update:modelValue", P(l)), g("drag-start"), c.preventDefault();
2262
+ }
2263
+ function N(c) {
2264
+ if (!p.value || c.pointerId !== q) return;
2265
+ const x = z(H(c.clientX));
2266
+ v.value = x, r = x, I(x), g("update:modelValue", P(x)), c.preventDefault();
2267
+ }
2268
+ function M(c) {
2269
+ var m;
2270
+ if (!p.value || c.pointerId !== q) return;
2271
+ p.value = !1, q = null;
2272
+ try {
2273
+ (m = a.value) == null || m.releasePointerCapture(c.pointerId);
2274
+ } catch {
2275
+ }
2276
+ i = J();
2277
+ const x = v.value + i * n.flingTime;
2278
+ let l;
2279
+ b.value ? l = j(x) : l = k(x), g("update:modelValue", P(l)), g("drag-end"), Z(l);
2280
+ }
2281
+ function j(c) {
2282
+ const x = _.value;
2283
+ let l = 0, m = Math.abs(c - x[0]);
2284
+ for (let A = 1; A < x.length; A += 1) {
2285
+ const S = Math.abs(c - x[A]);
2286
+ S < m && (m = S, l = A);
2287
+ }
2288
+ return x[l];
2289
+ }
2290
+ function te(c) {
2291
+ return b.value ? _.value.findIndex((x) => Math.abs(x - c) < 1e-6) : -1;
2292
+ }
2293
+ function G(c) {
2294
+ const x = te(c);
2295
+ x >= 0 ? g("snap", { index: x, value: c }) : b.value || g("snap", { index: -1, value: P(c) });
2296
+ }
2297
+ function Z(c) {
2298
+ if (r = c, Math.abs(r - v.value) < 1e-4) {
2299
+ v.value = r, G(r);
2300
+ return;
2301
+ }
2302
+ f || (f = requestAnimationFrame(W));
2303
+ }
2304
+ let ee = 0;
2305
+ function W(c) {
2306
+ f = 0, ee || (ee = c);
2307
+ let x = (c - ee) / 1e3;
2308
+ ee = c, x = Math.min(x, 1 / 30);
2309
+ const l = Math.sqrt(Math.max(1, n.stiffness)), m = 2 * n.dampingRatio * l, A = v.value - r, S = -l * l * A - m * i;
2310
+ if (i += S * x, v.value += i * x, Math.abs(A) < 0.3 && Math.abs(i) < 2) {
2311
+ v.value = r, i = 0, ee = 0, G(r);
2312
+ return;
2313
+ }
2314
+ f = requestAnimationFrame(W);
2315
+ }
2316
+ function $() {
2317
+ f && cancelAnimationFrame(f), f = 0, ee = 0, i = 0;
2318
+ }
2319
+ function E(c) {
2320
+ const x = Math.max(n.step, y.value * 0.1);
2321
+ let l = null;
2322
+ switch (c.key) {
2323
+ case "ArrowRight":
2324
+ case "ArrowUp":
2325
+ l = v.value + n.step;
2326
+ break;
2327
+ case "ArrowLeft":
2328
+ case "ArrowDown":
2329
+ l = v.value - n.step;
2330
+ break;
2331
+ case "PageUp":
2332
+ l = v.value + x;
2333
+ break;
2334
+ case "PageDown":
2335
+ l = v.value - x;
2336
+ break;
2337
+ case "Home":
2338
+ l = n.min;
2339
+ break;
2340
+ case "End":
2341
+ l = n.max;
2342
+ break;
2343
+ default:
2344
+ return;
2345
+ }
2346
+ c.preventDefault(), $();
2347
+ const m = b.value ? [j(l)] : [k(l)];
2348
+ v.value = k(l), g("update:modelValue", P(m[0])), Z(m[0]);
2349
+ }
2350
+ return ge(() => {
2351
+ $();
2352
+ }), (c, x) => (d(), h("div", {
2353
+ class: U(["ui-slider", { "is-dragging": p.value, "is-stepped": b.value }])
2354
+ }, [
2355
+ t("div", ma, [
2356
+ e.label ? (d(), h("span", ha, B(e.label), 1)) : X("", !0),
2357
+ e.showValue ? (d(), h("span", ga, B(D.value) + B(e.unit), 1)) : X("", !0)
2358
+ ]),
2359
+ t("div", {
2360
+ ref_key: "trackEl",
2361
+ ref: a,
2362
+ class: "ui-slider__track",
2363
+ style: ne({ "--pct": `${F.value}%` }),
2364
+ onPointerdown: Q,
2365
+ onPointermove: N,
2366
+ onPointerup: M,
2367
+ onPointercancel: M
2368
+ }, [
2369
+ x[1] || (x[1] = t("span", {
2370
+ class: "ui-slider__fill",
2371
+ "aria-hidden": "true"
2372
+ }, null, -1)),
2373
+ t("button", {
2374
+ type: "button",
2375
+ class: "ui-slider__thumb",
2376
+ role: "slider",
2377
+ "aria-label": e.label || "滑块",
2378
+ "aria-valuemin": e.min,
2379
+ "aria-valuemax": e.max,
2380
+ "aria-valuenow": D.value,
2381
+ "aria-valuetext": `${D.value}${e.unit}`,
2382
+ onKeydown: E
2383
+ }, [...x[0] || (x[0] = [
2384
+ t("span", {
2385
+ class: "ui-slider__thumb-dot",
2386
+ "aria-hidden": "true"
2387
+ }, null, -1)
2388
+ ])], 40, ya)
2389
+ ], 36)
2390
+ ], 2));
2391
+ }
2392
+ }, zl = /* @__PURE__ */ ue(ba, [["__scopeId", "data-v-c952a627"]]), wa = ["aria-label"], xa = {
2393
+ viewBox: "0 0 300 84",
2394
+ preserveAspectRatio: "none",
2395
+ "aria-hidden": "true"
2396
+ }, _a = ["d", "fill"], ka = ["d"], $a = {
2397
+ __name: "UiSparkline",
2398
+ props: {
2399
+ values: {
2400
+ type: Array,
2401
+ default: () => [12, 17, 15, 23, 20, 28, 25, 33]
2402
+ },
2403
+ label: { type: String, default: "趋势迷你图" }
2404
+ },
2405
+ setup(e) {
2406
+ let u = 0;
2407
+ const n = e, g = `ui-spark-fill-${u++}`, a = O(() => {
2408
+ const i = n.values.map(Number).filter(Number.isFinite);
2409
+ return i.length ? i : [0];
2410
+ }), p = O(() => {
2411
+ const i = a.value, f = Math.max(...i), _ = Math.min(...i), b = f - _ || 1, y = i.length > 1 ? 300 / (i.length - 1) : 300;
2412
+ return i.map((k, P) => ({
2413
+ x: P * y,
2414
+ y: 78 - (k - _) / b * 62
2415
+ }));
2416
+ }), v = O(() => p.value.map((i, f) => `${f === 0 ? "M" : "L"}${i.x.toFixed(1)},${i.y.toFixed(1)}`).join(" ")), r = O(() => `${v.value} L300,84 L0,84 Z`);
2417
+ return (i, f) => (d(), h("div", {
2418
+ class: "ui-sparkline",
2419
+ role: "img",
2420
+ "aria-label": e.label
2421
+ }, [
2422
+ (d(), h("svg", xa, [
2423
+ t("defs", null, [
2424
+ t("linearGradient", {
2425
+ id: g,
2426
+ x1: "0",
2427
+ y1: "0",
2428
+ x2: "0",
2429
+ y2: "1"
2430
+ }, [...f[0] || (f[0] = [
2431
+ t("stop", {
2432
+ offset: "0%",
2433
+ class: "ui-sparkline__stop-start"
2434
+ }, null, -1),
2435
+ t("stop", {
2436
+ offset: "100%",
2437
+ class: "ui-sparkline__stop-end"
2438
+ }, null, -1)
2439
+ ])])
2440
+ ]),
2441
+ t("path", {
2442
+ class: "ui-sparkline__area",
2443
+ d: r.value,
2444
+ fill: `url(#${g})`
2445
+ }, null, 8, _a),
2446
+ t("path", {
2447
+ class: "ui-sparkline__line",
2448
+ d: v.value,
2449
+ fill: "none",
2450
+ "vector-effect": "non-scaling-stroke"
2451
+ }, null, 8, ka)
2452
+ ]))
2453
+ ], 8, wa));
2454
+ }
2455
+ }, ql = /* @__PURE__ */ ue($a, [["__scopeId", "data-v-edae2913"]]), Ma = ["aria-label"], jl = {
2456
+ __name: "UiSpinner",
2457
+ props: {
2458
+ size: { type: String, default: "md" },
2459
+ label: { type: String, default: "加载中" }
2460
+ },
2461
+ setup(e) {
2462
+ return (u, n) => (d(), h("span", {
2463
+ class: U(["ui-spinner", e.size !== "md" ? `ui-spinner--${e.size}` : ""]),
2464
+ role: "status",
2465
+ "aria-label": e.label
2466
+ }, null, 10, Ma));
2467
+ }
2468
+ }, Sa = {
2469
+ key: 0,
2470
+ class: "ui-stepper__field-label"
2471
+ }, Ca = {
2472
+ key: 1,
2473
+ class: "ui-stepper__label"
2474
+ }, Ea = ["aria-label"], Aa = ["aria-disabled"], Va = { class: "ui-stepper__flow" }, Pa = { class: "ui-stepper__box" }, Ta = { class: "ui-stepper__unit" }, Ba = ["aria-disabled"], Fa = {
2475
+ __name: "UiStepper",
2476
+ props: {
2477
+ modelValue: { type: Number, default: 1 },
2478
+ label: { type: String, default: "数量" },
2479
+ min: { type: Number, default: 0 },
2480
+ max: { type: Number, default: 99 },
2481
+ step: { type: Number, default: 1 },
2482
+ unit: { type: String, default: "" },
2483
+ /* sm / md / lg / xl */
2484
+ size: { type: String, default: "md" },
2485
+ /* sides 两侧 / bottom 底部横排 */
2486
+ controls: { type: String, default: "sides" },
2487
+ /* standard 默认(新值变大 -> 旧值向上)/ reverse 反向 */
2488
+ roll: { type: String, default: "standard" },
2489
+ /* 左上角标签:传了就显示在整块控件的左上方 */
2490
+ fieldLabel: { type: String, default: "" }
2491
+ },
2492
+ emits: ["update:modelValue"],
2493
+ setup(e, { emit: u }) {
2494
+ const n = e, g = u, a = C(Number(n.modelValue)), p = C(Number(n.modelValue)), v = C(!1), r = C(0), i = Ke(null), f = C("");
2495
+ let _ = null, b = null, y = 0;
2496
+ be(() => n.modelValue, (N) => {
2497
+ const M = Number(N);
2498
+ Number.isFinite(M) && (a.value = M);
2499
+ });
2500
+ const k = O(() => {
2501
+ const N = Number(a.value);
2502
+ return Number.isFinite(N) ? Math.min(n.max, Math.max(n.min, N)) : n.min;
2503
+ }), P = O(() => k.value > n.min), F = O(() => k.value < n.max), D = O(() => {
2504
+ const N = Math.abs(k.value - p.value), M = n.step > 0 ? N / n.step : 1;
2505
+ return Math.max(0.3, Math.min(2.2, 0.35 + M * 0.2)) + "em";
2506
+ }), H = O(() => {
2507
+ const M = k.value >= p.value ? "up" : "down";
2508
+ return n.roll !== "reverse" ? M : M === "up" ? "down" : "up";
2509
+ });
2510
+ function z() {
2511
+ return window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
2512
+ }
2513
+ function K(N) {
2514
+ i.value = N, p.value = N, v.value = !1, cancelAnimationFrame(y), clearTimeout(_), ve(() => {
2515
+ y = requestAnimationFrame(() => {
2516
+ y = 0, v.value = !0, r.value += 1, _ = setTimeout(() => {
2517
+ _ = null, v.value = !1, i.value = null;
2518
+ }, z() ? 0 : 430);
2519
+ });
2520
+ });
2521
+ }
2522
+ function I(N) {
2523
+ if (!Number.isFinite(N)) return;
2524
+ const M = Math.min(n.max, Math.max(n.min, N));
2525
+ if (M === k.value) return;
2526
+ const j = k.value;
2527
+ a.value = M, g("update:modelValue", M), K(j);
2528
+ }
2529
+ function J(N) {
2530
+ z() || (f.value = "", clearTimeout(b), requestAnimationFrame(() => {
2531
+ f.value = N, b = setTimeout(() => {
2532
+ f.value = "";
2533
+ }, 420);
2534
+ }));
2535
+ }
2536
+ function q() {
2537
+ if (!P.value) {
2538
+ J("minus");
2539
+ return;
2540
+ }
2541
+ I(k.value - n.step);
2542
+ }
2543
+ function Q() {
2544
+ if (!F.value) {
2545
+ J("plus");
2546
+ return;
2547
+ }
2548
+ I(k.value + n.step);
2549
+ }
2550
+ return ge(() => {
2551
+ cancelAnimationFrame(y), clearTimeout(_), clearTimeout(b);
2552
+ }), (N, M) => (d(), h("div", {
2553
+ class: U(["ui-stepper", [
2554
+ `ui-stepper--${e.size}`,
2555
+ `ui-stepper--ctrl-${e.controls}`,
2556
+ `ui-stepper--dir-${H.value}`,
2557
+ f.value ? `is-bumping-${f.value}` : ""
2558
+ ]])
2559
+ }, [
2560
+ e.fieldLabel ? (d(), h("span", Sa, B(e.fieldLabel), 1)) : X("", !0),
2561
+ e.label ? (d(), h("span", Ca, B(e.label), 1)) : X("", !0),
2562
+ t("div", {
2563
+ class: "ui-stepper__control",
2564
+ role: "group",
2565
+ "aria-label": e.label || e.fieldLabel
2566
+ }, [
2567
+ t("button", {
2568
+ type: "button",
2569
+ class: U(["ui-stepper__btn ui-stepper__btn--minus", { "is-disabled": !P.value }]),
2570
+ "aria-disabled": !P.value,
2571
+ "aria-label": "减少",
2572
+ onClick: q
2573
+ }, [...M[0] || (M[0] = [
2574
+ t("svg", {
2575
+ viewBox: "0 0 24 24",
2576
+ fill: "none",
2577
+ stroke: "currentColor",
2578
+ "stroke-width": "2.4",
2579
+ "stroke-linecap": "round",
2580
+ "aria-hidden": "true"
2581
+ }, [
2582
+ t("path", { d: "M5 12h14" })
2583
+ ], -1)
2584
+ ])], 10, Aa),
2585
+ t("div", {
2586
+ class: "ui-stepper__stage",
2587
+ style: ne({ "--roll-distance": D.value })
2588
+ }, [
2589
+ t("span", Va, [
2590
+ t("span", Pa, [
2591
+ t("span", {
2592
+ class: U(["ui-stepper__value ui-stepper__value--leave", { "is-rolling": v.value }]),
2593
+ "aria-hidden": "true"
2594
+ }, B(i.value), 3),
2595
+ (d(), h("span", {
2596
+ key: r.value,
2597
+ class: U(["ui-stepper__value ui-stepper__value--enter", { "is-rolling": v.value }]),
2598
+ "aria-live": "polite"
2599
+ }, B(k.value), 3))
2600
+ ]),
2601
+ t("span", Ta, B(e.unit), 1)
2602
+ ])
2603
+ ], 4),
2604
+ t("button", {
2605
+ type: "button",
2606
+ class: U(["ui-stepper__btn ui-stepper__btn--plus", { "is-disabled": !F.value }]),
2607
+ "aria-disabled": !F.value,
2608
+ "aria-label": "增加",
2609
+ onClick: Q
2610
+ }, [...M[1] || (M[1] = [
2611
+ t("svg", {
2612
+ viewBox: "0 0 24 24",
2613
+ fill: "none",
2614
+ stroke: "currentColor",
2615
+ "stroke-width": "2.4",
2616
+ "stroke-linecap": "round",
2617
+ "aria-hidden": "true"
2618
+ }, [
2619
+ t("path", { d: "M12 5v14M5 12h14" })
2620
+ ], -1)
2621
+ ])], 10, Ba)
2622
+ ], 8, Ea)
2623
+ ], 2));
2624
+ }
2625
+ }, Yl = /* @__PURE__ */ ue(Fa, [["__scopeId", "data-v-04de9fcf"]]), La = ["aria-checked", "aria-label"], Kl = {
2626
+ __name: "UiSwitch",
2627
+ props: {
2628
+ modelValue: { type: Boolean, default: !1 },
2629
+ label: { type: String, default: "" }
2630
+ },
2631
+ emits: ["update:modelValue"],
2632
+ setup(e, { emit: u }) {
2633
+ const n = u;
2634
+ return (g, a) => (d(), h("button", {
2635
+ type: "button",
2636
+ class: U(["ui-switch", { "is-on": e.modelValue }]),
2637
+ role: "switch",
2638
+ "aria-checked": e.modelValue,
2639
+ "aria-label": e.label || "开关",
2640
+ onClick: a[0] || (a[0] = (p) => n("update:modelValue", !e.modelValue))
2641
+ }, [...a[1] || (a[1] = [
2642
+ t("span", { class: "ui-switch__thumb" }, null, -1)
2643
+ ])], 10, La));
2644
+ }
2645
+ }, Na = { class: "ui-field" }, Ra = {
2646
+ key: 0,
2647
+ class: "ui-field__label"
2648
+ }, Da = ["value", "placeholder", "rows", "aria-invalid"], Ua = {
2649
+ key: 1,
2650
+ class: "ui-field__error"
2651
+ }, Wa = {
2652
+ key: 2,
2653
+ class: "ui-field__hint"
2654
+ }, Xl = {
2655
+ __name: "UiTextarea",
2656
+ props: {
2657
+ modelValue: { type: String, default: "" },
2658
+ label: { type: String, default: "" },
2659
+ placeholder: { type: String, default: "" },
2660
+ hint: { type: String, default: "" },
2661
+ error: { type: String, default: "" },
2662
+ rows: { type: Number, default: 3 }
2663
+ },
2664
+ emits: ["update:modelValue"],
2665
+ setup(e, { emit: u }) {
2666
+ const n = u;
2667
+ return (g, a) => (d(), h("label", Na, [
2668
+ e.label ? (d(), h("span", Ra, B(e.label), 1)) : X("", !0),
2669
+ t("span", {
2670
+ class: U(["ui-field__control ui-field__control--area", { "is-error": !!e.error }])
2671
+ }, [
2672
+ t("textarea", {
2673
+ value: e.modelValue,
2674
+ placeholder: e.placeholder,
2675
+ rows: e.rows,
2676
+ "aria-invalid": !!e.error,
2677
+ onInput: a[0] || (a[0] = (p) => n("update:modelValue", p.target.value))
2678
+ }, null, 40, Da)
2679
+ ], 2),
2680
+ e.error ? (d(), h("span", Ua, B(e.error), 1)) : e.hint ? (d(), h("span", Wa, B(e.hint), 1)) : X("", !0)
2681
+ ]));
2682
+ }
2683
+ }, Oa = { class: "ui-time" }, Ha = { class: "ui-time__label" }, Ia = ["aria-expanded"], za = { class: "ui-time__value" }, qa = ["aria-hidden", "inert"], ja = { class: "ui-time__head" }, Ya = { class: "ui-time__body" }, Ka = ["data-value", "tabindex", "onClick"], Xa = ["data-value", "tabindex", "onClick"], Ga = ["tabindex", "onClick"], Za = { class: "ui-time__actions" }, Qa = {
2684
+ __name: "UiTimePicker",
2685
+ props: {
2686
+ modelValue: { type: String, default: "09:00" },
2687
+ label: { type: String, default: "时间" },
2688
+ presets: {
2689
+ type: Array,
2690
+ default: () => [
2691
+ { label: "早上", value: "08:00" },
2692
+ { label: "中午", value: "12:00" },
2693
+ { label: "傍晚", value: "18:30" },
2694
+ { label: "晚上", value: "21:00" }
2695
+ ]
2696
+ }
2697
+ },
2698
+ emits: ["update:modelValue"],
2699
+ setup(e, { emit: u }) {
2700
+ const n = e, g = u, a = C(null), p = C(null), v = C(null), r = C(null), i = C(null), f = C(null), _ = C(Z(n.modelValue)), b = C("09"), y = C("00"), { open: k, closing: P, floating: F, compressed: D, style: H, viewStyle: z, openWindow: K, closeWindow: I, toggleWindow: J } = qe({
2701
+ surface: () => a.value,
2702
+ panel: () => v.value,
2703
+ content: () => r.value,
2704
+ width: () => Math.min(300, window.innerWidth - 32),
2705
+ onOpened: () => {
2706
+ requestAnimationFrame(() => $("auto"));
2707
+ },
2708
+ onClosed: () => {
2709
+ var w;
2710
+ (w = p.value) == null || w.focus({ preventScroll: !0 });
2711
+ }
2712
+ }), q = Array.from({ length: 24 }, (w, V) => String(V).padStart(2, "0")), Q = Array.from({ length: 60 }, (w, V) => String(V).padStart(2, "0")), N = O(() => _.value), M = O(() => `${b.value}:${y.value}`), j = O(() => (Array.isArray(n.presets) ? n.presets : []).map((w) => {
2713
+ if (typeof w == "string")
2714
+ return { label: w, value: Z(w) };
2715
+ if (!w || typeof w != "object") return null;
2716
+ const V = w.value ?? (w.hour !== void 0 ? `${G(w.hour)}:${G(w.minute ?? 0)}` : ""), L = Z(V);
2717
+ return { label: w.label || L, value: L };
2718
+ }).filter(Boolean)), te = O(() => Math.min(Math.max(j.value.length, 1), 4));
2719
+ function G(w) {
2720
+ return String(w).padStart(2, "0");
2721
+ }
2722
+ function Z(w) {
2723
+ if (typeof w != "string" || !/^\d{1,2}:\d{2}$/.test(w)) return "09:00";
2724
+ const [V, L] = w.split(":").map(Number);
2725
+ return V > 23 || L > 59 ? "09:00" : `${G(V)}:${G(L)}`;
2726
+ }
2727
+ function ee() {
2728
+ const [w, V] = _.value.split(":");
2729
+ b.value = w, y.value = V;
2730
+ }
2731
+ function W(w, V, L = "smooth") {
2732
+ if (!w) return;
2733
+ const re = w.querySelector(`[data-value="${V}"]`);
2734
+ if (!re) return;
2735
+ const ce = re.offsetTop - (w.clientHeight - re.offsetHeight) / 2;
2736
+ w.scrollTo({
2737
+ top: Math.max(0, ce),
2738
+ behavior: L
2739
+ });
2740
+ }
2741
+ function $(w = "smooth") {
2742
+ W(i.value, b.value, w), W(f.value, y.value, w);
2743
+ }
2744
+ function E(w) {
2745
+ if (!w) return "";
2746
+ const V = w.scrollTop + w.clientHeight / 2;
2747
+ let L = "", re = 1 / 0;
2748
+ return w.querySelectorAll("button[data-value]").forEach((ce) => {
2749
+ const fe = ce.offsetTop + ce.offsetHeight / 2, me = Math.abs(fe - V);
2750
+ me < re && (re = me, L = ce.dataset.value);
2751
+ }), L;
2752
+ }
2753
+ function c(w, V) {
2754
+ if (!w) return;
2755
+ const L = E(w);
2756
+ L && (V(L), W(w, L));
2757
+ }
2758
+ function x(w, V) {
2759
+ let L = 0;
2760
+ return {
2761
+ onScroll() {
2762
+ clearTimeout(L), L = setTimeout(() => {
2763
+ L = 0, c(w.value, V);
2764
+ }, 140);
2765
+ }
2766
+ };
2767
+ }
2768
+ const l = x(i, (w) => {
2769
+ b.value = w;
2770
+ }), m = x(f, (w) => {
2771
+ y.value = w;
2772
+ });
2773
+ function A() {
2774
+ ee(), K();
2775
+ }
2776
+ function S() {
2777
+ if (k.value) {
2778
+ I();
2779
+ return;
2780
+ }
2781
+ if (P.value || D.value) {
2782
+ ee(), J();
2783
+ return;
2784
+ }
2785
+ A();
2786
+ }
2787
+ function T(w) {
2788
+ b.value = w, W(i.value, w);
2789
+ }
2790
+ function s(w) {
2791
+ y.value = w, W(f.value, w);
2792
+ }
2793
+ function o(w) {
2794
+ const [V, L] = Z(w).split(":");
2795
+ b.value = V, y.value = L, requestAnimationFrame(() => $());
2796
+ }
2797
+ function R() {
2798
+ _.value = M.value, g("update:modelValue", M.value), I();
2799
+ }
2800
+ return be(() => n.modelValue, (w) => {
2801
+ _.value = Z(w), F.value || ee();
2802
+ }), (w, V) => (d(), h("div", Oa, [
2803
+ t("span", Ha, B(e.label), 1),
2804
+ t("div", {
2805
+ ref_key: "surfaceEl",
2806
+ ref: a,
2807
+ class: U(["ui-time__surface ui-morph", {
2808
+ "is-open": Y(k),
2809
+ "is-closing": Y(P),
2810
+ "is-floating": Y(F),
2811
+ "is-compressed": Y(D)
2812
+ }]),
2813
+ style: ne(Y(H))
2814
+ }, [
2815
+ t("div", {
2816
+ class: "ui-time__view ui-morph__view",
2817
+ style: ne(Y(z))
2818
+ }, [
2819
+ t("button", {
2820
+ ref_key: "fieldEl",
2821
+ ref: p,
2822
+ type: "button",
2823
+ class: "ui-time__field",
2824
+ "aria-expanded": Y(F),
2825
+ "aria-haspopup": "dialog",
2826
+ onClick: S
2827
+ }, [
2828
+ V[5] || (V[5] = t("span", {
2829
+ class: "ui-time__icon",
2830
+ "aria-hidden": "true"
2831
+ }, [
2832
+ t("svg", {
2833
+ viewBox: "0 0 24 24",
2834
+ fill: "none",
2835
+ stroke: "currentColor",
2836
+ "stroke-width": "2",
2837
+ "stroke-linecap": "round",
2838
+ "stroke-linejoin": "round"
2839
+ }, [
2840
+ t("circle", {
2841
+ cx: "12",
2842
+ cy: "12",
2843
+ r: "9"
2844
+ }),
2845
+ t("path", { d: "M12 7v5l3.2 1.9" })
2846
+ ])
2847
+ ], -1)),
2848
+ t("span", za, B(N.value), 1),
2849
+ t("span", {
2850
+ class: U(["ui-time__chevron", { "is-open": Y(k) }]),
2851
+ "aria-hidden": "true"
2852
+ }, [...V[4] || (V[4] = [
2853
+ t("svg", {
2854
+ viewBox: "0 0 24 24",
2855
+ fill: "none",
2856
+ stroke: "currentColor",
2857
+ "stroke-width": "2.2",
2858
+ "stroke-linecap": "round",
2859
+ "stroke-linejoin": "round"
2860
+ }, [
2861
+ t("path", { d: "M6 9l6 6 6-6" })
2862
+ ], -1)
2863
+ ])], 2)
2864
+ ], 8, Ia)
2865
+ ], 4),
2866
+ t("div", {
2867
+ ref_key: "panelEl",
2868
+ ref: v,
2869
+ class: "ui-time__pop ui-morph__panel",
2870
+ role: "dialog",
2871
+ "aria-label": "选择时间",
2872
+ "aria-hidden": Y(k) ? "false" : "true",
2873
+ inert: Y(k) ? null : "",
2874
+ tabindex: "-1",
2875
+ onPointerdown: V[3] || (V[3] = $e(() => {
2876
+ }, ["stop"]))
2877
+ }, [
2878
+ t("div", {
2879
+ ref_key: "panelContentEl",
2880
+ ref: r,
2881
+ class: "ui-time__pop-inner"
2882
+ }, [
2883
+ t("div", ja, [
2884
+ V[6] || (V[6] = t("span", null, "选择时间", -1)),
2885
+ t("strong", null, B(M.value), 1)
2886
+ ]),
2887
+ t("div", Ya, [
2888
+ V[7] || (V[7] = t("span", {
2889
+ class: "ui-time__highlight",
2890
+ "aria-hidden": "true"
2891
+ }, null, -1)),
2892
+ t("div", {
2893
+ ref_key: "hourColumn",
2894
+ ref: i,
2895
+ class: "ui-time__column",
2896
+ "aria-label": "小时",
2897
+ onScrollPassive: V[0] || (V[0] = (...L) => Y(l).onScroll && Y(l).onScroll(...L))
2898
+ }, [
2899
+ (d(!0), h(ae, null, oe(Y(q), (L) => (d(), h("button", {
2900
+ key: L,
2901
+ type: "button",
2902
+ "data-value": L,
2903
+ tabindex: Y(k) ? 0 : -1,
2904
+ class: U({ "is-selected": b.value === L }),
2905
+ onClick: (re) => T(L)
2906
+ }, B(L), 11, Ka))), 128))
2907
+ ], 544),
2908
+ V[8] || (V[8] = t("span", {
2909
+ class: "ui-time__colon",
2910
+ "aria-hidden": "true"
2911
+ }, ":", -1)),
2912
+ t("div", {
2913
+ ref_key: "minuteColumn",
2914
+ ref: f,
2915
+ class: "ui-time__column",
2916
+ "aria-label": "分钟",
2917
+ onScrollPassive: V[1] || (V[1] = (...L) => Y(m).onScroll && Y(m).onScroll(...L))
2918
+ }, [
2919
+ (d(!0), h(ae, null, oe(Y(Q), (L) => (d(), h("button", {
2920
+ key: L,
2921
+ type: "button",
2922
+ "data-value": L,
2923
+ tabindex: Y(k) ? 0 : -1,
2924
+ class: U({ "is-selected": y.value === L }),
2925
+ onClick: (re) => s(L)
2926
+ }, B(L), 11, Xa))), 128))
2927
+ ], 544)
2928
+ ]),
2929
+ j.value.length ? (d(), h("div", {
2930
+ key: 0,
2931
+ class: "ui-time__presets",
2932
+ style: ne({ "--preset-cols": te.value })
2933
+ }, [
2934
+ (d(!0), h(ae, null, oe(j.value, (L) => (d(), h("button", {
2935
+ key: `${L.value}-${L.label}`,
2936
+ type: "button",
2937
+ tabindex: Y(k) ? 0 : -1,
2938
+ onClick: (re) => o(L.value)
2939
+ }, B(L.label), 9, Ga))), 128))
2940
+ ], 4)) : X("", !0),
2941
+ t("div", Za, [
2942
+ t("button", {
2943
+ type: "button",
2944
+ class: "ui-time__cancel",
2945
+ onClick: V[2] || (V[2] = (...L) => Y(I) && Y(I)(...L))
2946
+ }, "取消"),
2947
+ t("button", {
2948
+ type: "button",
2949
+ class: "ui-time__confirm",
2950
+ onClick: R
2951
+ }, "完成")
2952
+ ])
2953
+ ], 512)
2954
+ ], 40, qa)
2955
+ ], 6)
2956
+ ]));
2957
+ }
2958
+ }, Gl = /* @__PURE__ */ ue(Qa, [["__scopeId", "data-v-74660981"]]), Ja = ["onClick"], Zl = {
2959
+ __name: "UiToastHost",
2960
+ setup(e, { expose: u }) {
2961
+ const n = C([]), g = /* @__PURE__ */ new Map();
2962
+ let a = 1;
2963
+ function p(r) {
2964
+ const i = g.get(r);
2965
+ i && (clearTimeout(i), g.delete(r)), n.value = n.value.filter((f) => f.id !== r);
2966
+ }
2967
+ function v(r, i = "info", f = 2600) {
2968
+ const _ = a++;
2969
+ n.value.push({ id: _, message: r, tone: i });
2970
+ const b = setTimeout(() => p(_), f);
2971
+ return g.set(_, b), _;
2972
+ }
2973
+ return ge(() => {
2974
+ g.forEach((r) => clearTimeout(r)), g.clear();
2975
+ }), u({ show: v, dismiss: p }), (r, i) => (d(), xe(Pe, { to: "body" }, [
2976
+ Xe(Ge, {
2977
+ name: "ui-toast",
2978
+ tag: "div",
2979
+ class: "ui-toast-host",
2980
+ "aria-live": "polite"
2981
+ }, {
2982
+ default: Fe(() => [
2983
+ (d(!0), h(ae, null, oe(n.value, (f) => (d(), h("div", {
2984
+ key: f.id,
2985
+ class: U(["ui-toast", `ui-toast--${f.tone}`])
2986
+ }, [
2987
+ i[1] || (i[1] = t("span", {
2988
+ class: "ui-toast__dot",
2989
+ "aria-hidden": "true"
2990
+ }, null, -1)),
2991
+ t("span", null, B(f.message), 1),
2992
+ t("button", {
2993
+ type: "button",
2994
+ class: "ui-toast__close",
2995
+ "aria-label": "关闭提示",
2996
+ onClick: (_) => p(f.id)
2997
+ }, [...i[0] || (i[0] = [
2998
+ t("svg", {
2999
+ viewBox: "0 0 24 24",
3000
+ fill: "none",
3001
+ stroke: "currentColor",
3002
+ "stroke-width": "2.6",
3003
+ "stroke-linecap": "round",
3004
+ "aria-hidden": "true"
3005
+ }, [
3006
+ t("path", { d: "M6 6l12 12M18 6L6 18" })
3007
+ ], -1)
3008
+ ])], 8, Ja)
3009
+ ], 2))), 128))
3010
+ ]),
3011
+ _: 1
3012
+ })
3013
+ ]));
3014
+ }
3015
+ }, el = ["aria-expanded"], tl = { class: "ui-tool-menu__label" }, nl = ["aria-hidden", "inert"], al = ["tabindex", "onClick"], ll = { class: "ui-tool-menu__item-copy" }, il = { class: "ui-tool-menu__item-label" }, rl = {
3016
+ key: 0,
3017
+ class: "ui-tool-menu__item-desc"
3018
+ }, ol = 248, sl = 184, ul = 12, dl = {
3019
+ __name: "UiToolMenu",
3020
+ props: {
3021
+ label: { type: String, default: "工具" },
3022
+ size: { type: String, default: "md" },
3023
+ items: {
3024
+ type: Array,
3025
+ default: () => [
3026
+ { value: "pin", label: "置顶记录", description: "固定在列表顶部" },
3027
+ { value: "duplicate", label: "复制为草稿", description: "保留本次运动数据" },
3028
+ { value: "archive", label: "归档记录", description: "从本周视图中隐藏" }
3029
+ ]
3030
+ }
3031
+ },
3032
+ emits: ["select"],
3033
+ setup(e, { expose: u, emit: n }) {
3034
+ const g = n, a = C(null), p = C(null), v = C(null), r = C(!1), i = C(!1), f = C(!1), _ = C({}), b = C({});
3035
+ let y = null, k = null, P = null, F = null, D = !1;
3036
+ function H(W) {
3037
+ const $ = W.getBoundingClientRect();
3038
+ let E = 1, c = 1;
3039
+ const x = getComputedStyle(W).transform;
3040
+ if (x && x !== "none" && typeof DOMMatrixReadOnly == "function") {
3041
+ const A = new DOMMatrixReadOnly(x);
3042
+ E = A.a || 1, c = A.d || 1;
3043
+ }
3044
+ const l = Math.max(1, $.width / E), m = Math.max(1, $.height / c);
3045
+ return {
3046
+ left: $.left + ($.width - l) / 2,
3047
+ top: $.top + ($.height - m) / 2,
3048
+ width: l,
3049
+ height: m
3050
+ };
3051
+ }
3052
+ function z() {
3053
+ return Math.min(ol, Math.max(sl, window.innerWidth - 36));
3054
+ }
3055
+ function K() {
3056
+ return window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
3057
+ }
3058
+ function I(W, $) {
3059
+ const E = getComputedStyle(document.documentElement).getPropertyValue(W).trim();
3060
+ if (!E) return $;
3061
+ const c = parseFloat(E);
3062
+ return Number.isFinite(c) ? E.endsWith("ms") ? c : c * 1e3 : $;
3063
+ }
3064
+ function J(W) {
3065
+ const $ = p.value, E = v.value;
3066
+ if (!$ || !E) return 0;
3067
+ const c = $.style.width;
3068
+ $.style.width = W + "px";
3069
+ const x = E.offsetHeight;
3070
+ return $.style.width = c, Math.ceil(x);
3071
+ }
3072
+ const q = Le({
3073
+ // 收起途中也允许按下,才有机会打断收起、重新展开。
3074
+ canPress: () => !r.value,
3075
+ onPressStart: () => {
3076
+ f.value = !0;
3077
+ },
3078
+ onPressEnd: () => {
3079
+ f.value = !1;
3080
+ }
3081
+ });
3082
+ async function Q(W = !1) {
3083
+ if (r.value) return;
3084
+ i.value = !1;
3085
+ const $ = a.value;
3086
+ if (!$) return;
3087
+ const E = H($), c = E.width, x = E.height, l = getComputedStyle($), m = parseFloat(l.borderLeftWidth) || 0, A = parseFloat(l.borderTopWidth) || 0, S = Math.max(z(), c), T = Math.max(1, Math.round(S - m * 2)), s = Math.max(x, window.innerHeight - ul * 2), o = Math.max(x, Math.min(J(T) + A * 2, s)), R = Math.max(1, c - m * 2), w = Math.max(1, x - A * 2);
3088
+ D = W, k = { width: c + "px", height: x + "px" }, P = { width: S + "px", height: o + "px" }, F = { width: R + "px", height: w + "px" }, b.value = { width: R + "px", height: w + "px" }, _.value = { width: c + "px", height: x + "px" }, f.value = !1, await ve();
3089
+ const V = a.value;
3090
+ V && V.offsetWidth, requestAnimationFrame(() => {
3091
+ var L;
3092
+ i.value || (_.value = { ...P }, r.value = !0, D && ((L = p.value) == null || L.focus({ preventScroll: !0 })), D = !1);
3093
+ });
3094
+ }
3095
+ function N() {
3096
+ var W;
3097
+ if (clearTimeout(y), y = null, f.value = !1, !P) {
3098
+ i.value = !1, r.value = !1, Q();
3099
+ return;
3100
+ }
3101
+ i.value = !1, r.value = !0, b.value = { ...F }, _.value = { ...P }, (W = p.value) == null || W.focus({ preventScroll: !0 });
3102
+ }
3103
+ async function M() {
3104
+ if (i.value || !r.value) return;
3105
+ clearTimeout(y);
3106
+ const W = (k == null ? void 0 : k.width) || "0px", $ = (k == null ? void 0 : k.height) || "0px";
3107
+ i.value = !0, r.value = !1, await ve();
3108
+ const E = a.value;
3109
+ E && E.offsetWidth, _.value = { width: W, height: $ };
3110
+ const c = K() ? 0 : I("--spring-exit-dur", 400);
3111
+ y = setTimeout(() => {
3112
+ i.value = !1, _.value = {}, b.value = {}, k = null, P = null, F = null, y = null;
3113
+ }, c + 80);
3114
+ }
3115
+ function j() {
3116
+ if (r.value) {
3117
+ M();
3118
+ return;
3119
+ }
3120
+ if (i.value) {
3121
+ N();
3122
+ return;
3123
+ }
3124
+ Q(!0);
3125
+ }
3126
+ function te(W) {
3127
+ g("select", W), M();
3128
+ }
3129
+ function G(W) {
3130
+ W.key === "Escape" && (r.value || i.value) && (W.stopPropagation(), q.cancelPress(), M());
3131
+ }
3132
+ function Z(W) {
3133
+ var $;
3134
+ r.value && (($ = a.value) != null && $.contains(W.target) || M());
3135
+ }
3136
+ function ee() {
3137
+ (r.value || i.value) && M();
3138
+ }
3139
+ return Me(() => {
3140
+ window.addEventListener("pointerdown", Z), window.addEventListener("resize", ee), document.addEventListener("keydown", G);
3141
+ }), Te(() => {
3142
+ clearTimeout(y), y = null, q.cancelPress(), r.value = !1, i.value = !1, f.value = !1, _.value = {}, b.value = {}, k = null, P = null, F = null;
3143
+ }), ge(() => {
3144
+ clearTimeout(y), window.removeEventListener("pointerdown", Z), window.removeEventListener("resize", ee), document.removeEventListener("keydown", G);
3145
+ }), u({ close: M }), (W, $) => (d(), h("div", {
3146
+ ref_key: "root",
3147
+ ref: a,
3148
+ class: U(["ui-tool-menu ui-morph", [e.size !== "md" ? `is-${e.size}` : "", {
3149
+ "is-open": r.value,
3150
+ "is-closing": i.value,
3151
+ "is-pressed": f.value
3152
+ }]]),
3153
+ style: ne(_.value)
3154
+ }, [
3155
+ t("div", {
3156
+ class: "ui-tool-menu__view ui-morph__view",
3157
+ style: ne(b.value)
3158
+ }, [
3159
+ t("button", {
3160
+ type: "button",
3161
+ class: "ui-tool-menu__trigger",
3162
+ "aria-haspopup": "menu",
3163
+ "aria-expanded": r.value,
3164
+ onPointerdown: $[0] || ($[0] = (...E) => Y(q).onPointerDown && Y(q).onPointerDown(...E)),
3165
+ onClick: j,
3166
+ onContextmenu: $[1] || ($[1] = $e(() => {
3167
+ }, ["prevent"]))
3168
+ }, [
3169
+ $[2] || ($[2] = Ze('<span class="ui-tool-menu__icon" aria-hidden="true" data-v-06458478><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" data-v-06458478><path d="M4 7h10M18 7h2M4 17h2M10 17h10" data-v-06458478></path><circle cx="16" cy="7" r="2" data-v-06458478></circle><circle cx="8" cy="17" r="2" data-v-06458478></circle></svg></span>', 1)),
3170
+ t("span", tl, B(e.label), 1),
3171
+ $[3] || ($[3] = t("span", {
3172
+ class: "ui-tool-menu__chevron",
3173
+ "aria-hidden": "true"
3174
+ }, [
3175
+ t("svg", {
3176
+ viewBox: "0 0 24 24",
3177
+ fill: "none",
3178
+ stroke: "currentColor",
3179
+ "stroke-width": "2.4",
3180
+ "stroke-linecap": "round",
3181
+ "stroke-linejoin": "round"
3182
+ }, [
3183
+ t("path", { d: "M6 9l6 6 6-6" })
3184
+ ])
3185
+ ], -1))
3186
+ ], 40, el)
3187
+ ], 4),
3188
+ t("div", {
3189
+ ref_key: "panel",
3190
+ ref: p,
3191
+ class: "ui-tool-menu__panel ui-morph__panel",
3192
+ role: "menu",
3193
+ tabindex: "-1",
3194
+ "aria-hidden": r.value ? "false" : "true",
3195
+ inert: r.value ? null : ""
3196
+ }, [
3197
+ t("div", {
3198
+ ref_key: "panelContent",
3199
+ ref: v,
3200
+ class: "ui-tool-menu__inner"
3201
+ }, [
3202
+ (d(!0), h(ae, null, oe(e.items, (E) => (d(), h("button", {
3203
+ key: E.value ?? E.label,
3204
+ type: "button",
3205
+ role: "menuitem",
3206
+ tabindex: r.value ? 0 : -1,
3207
+ class: U(["ui-tool-menu__item", { "is-danger": E.tone === "danger" }]),
3208
+ onClick: (c) => te(E)
3209
+ }, [
3210
+ $[4] || ($[4] = t("span", {
3211
+ class: "ui-tool-menu__item-dot",
3212
+ "aria-hidden": "true"
3213
+ }, null, -1)),
3214
+ t("span", ll, [
3215
+ t("span", il, B(E.label), 1),
3216
+ E.description ? (d(), h("span", rl, B(E.description), 1)) : X("", !0)
3217
+ ])
3218
+ ], 10, al))), 128))
3219
+ ], 512)
3220
+ ], 8, nl)
3221
+ ], 6));
3222
+ }
3223
+ }, Ql = /* @__PURE__ */ ue(dl, [["__scopeId", "data-v-06458478"]]), cl = {
3224
+ class: "ui-tooltip__bubble",
3225
+ role: "tooltip"
3226
+ }, Jl = {
3227
+ __name: "UiTooltip",
3228
+ props: {
3229
+ text: { type: String, default: "提示" },
3230
+ placement: { type: String, default: "top" }
3231
+ },
3232
+ setup(e) {
3233
+ return (u, n) => (d(), h("span", {
3234
+ class: U(["ui-tooltip", `ui-tooltip--${e.placement}`]),
3235
+ tabindex: "0"
3236
+ }, [
3237
+ ie(u.$slots, "default"),
3238
+ t("span", cl, B(e.text), 1)
3239
+ ], 2));
3240
+ }
3241
+ };
3242
+ let Ve = null;
3243
+ function se() {
3244
+ return Ve;
3245
+ }
3246
+ function fl(e) {
3247
+ Ve = e;
3248
+ }
3249
+ function He(e) {
3250
+ (!e || Ve === e) && (Ve = null);
3251
+ }
3252
+ const pl = {
3253
+ key: 0,
3254
+ class: "expand-content"
3255
+ }, vl = 80, ml = 180, Ie = ".chart, .bar, .bar-col, button, a, input, select, textarea, [data-no-expand]", hl = "(min-width: 900px)", gl = {
3256
+ __name: "ExpandableCard",
3257
+ props: {
3258
+ tag: { type: String, default: "section" },
3259
+ expandKey: { type: String, required: !0 },
3260
+ routeName: { type: String, required: !0 },
3261
+ parentRouteName: { type: String, required: !0 },
3262
+ routeParams: { type: Object, default: () => ({}) },
3263
+ variant: { type: String, default: "card" },
3264
+ feature: { type: Boolean, default: !1 },
3265
+ content: { type: [Object, Function], required: !0 },
3266
+ contentProps: { type: Object, default: () => ({}) }
3267
+ },
3268
+ setup(e, { expose: u }) {
3269
+ const n = e, g = tt(), a = nt(), p = O(() => g.name !== n.routeName ? !1 : Object.entries(n.routeParams).every(
3270
+ ([s, o]) => String(g.params[s] ?? "") === String(o)
3271
+ ));
3272
+ function v() {
3273
+ return window.matchMedia && window.matchMedia(hl).matches;
3274
+ }
3275
+ function r() {
3276
+ if (!v())
3277
+ return {
3278
+ top: "0px",
3279
+ left: "0px",
3280
+ width: "100vw",
3281
+ height: "100dvh",
3282
+ radius: "0px",
3283
+ background: "var(--background)",
3284
+ border: "transparent",
3285
+ shadow: "none"
3286
+ };
3287
+ const s = Math.round(Math.min(680, Math.max(360, window.innerWidth - 140))), o = Math.round(Math.min(760, Math.max(320, window.innerHeight - 140)));
3288
+ return {
3289
+ top: Math.round((window.innerHeight - o) / 2) + "px",
3290
+ left: Math.round((window.innerWidth - s) / 2) + "px",
3291
+ width: s + "px",
3292
+ height: o + "px",
3293
+ radius: "calc(var(--r-card) * var(--radius-scale))",
3294
+ background: "var(--surface)",
3295
+ border: "var(--outline-variant)",
3296
+ shadow: "none"
3297
+ };
3298
+ }
3299
+ let i = null, f = null, _ = !1, b = null, y = "", k = null, P = "pointer", F = !1;
3300
+ const D = C(null), H = C(null), z = C(null), K = C(!1), I = C(!1), J = C(!1), q = C(!1), Q = C(!1), N = C(!1), M = O(() => [
3301
+ n.variant === "card" ? "card" : n.variant,
3302
+ n.feature ? "card--feature" : "",
3303
+ {
3304
+ "is-expanded": K.value,
3305
+ "is-closing": q.value,
3306
+ "is-settling": Q.value
3307
+ }
3308
+ ]), j = () => window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
3309
+ function te(s, o) {
3310
+ const R = getComputedStyle(document.documentElement).getPropertyValue(s).trim();
3311
+ if (!R) return o;
3312
+ const w = parseFloat(R);
3313
+ return Number.isFinite(w) ? R.endsWith("ms") ? w : w * 1e3 : o;
3314
+ }
3315
+ function G() {
3316
+ b = document.getElementById("scrollArea"), b && (y = b.style.overflow, b.style.overflow = "hidden");
3317
+ }
3318
+ function Z() {
3319
+ b && (b.style.overflow = y, b = null);
3320
+ }
3321
+ function ee() {
3322
+ v() && (I.value = !0, requestAnimationFrame(() => {
3323
+ I.value && (J.value = !0);
3324
+ }));
3325
+ }
3326
+ function W(s, o) {
3327
+ return Array.from(s.children).find((R) => R.classList.contains(o)) || null;
3328
+ }
3329
+ function $(s, o, R) {
3330
+ s.style.position = "fixed", s.style.zIndex = "300", s.style.margin = "0", s.style.maxWidth = "none", s.style.top = o.top + "px", s.style.left = o.left + "px", s.style.width = o.width + "px", s.style.height = o.height + "px", s.style.overflow = "hidden", s.style.cursor = "default", s.style.borderRadius = R.borderRadius, s.style.backgroundColor = R.backgroundColor, s.style.borderColor = R.borderColor, s.style.boxShadow = R.boxShadow, s.style.transform = "none", s.style.willChange = "top, left, width, height, border-radius, background-color, border-color, box-shadow", s.style.transition = [
3331
+ "top var(--spring-expand-dur) var(--spring-expand)",
3332
+ "left var(--spring-expand-dur) var(--spring-expand)",
3333
+ "width var(--spring-expand-dur) var(--spring-expand)",
3334
+ "height var(--spring-expand-dur) var(--spring-expand)",
3335
+ "border-radius var(--spring-expand-dur) var(--spring-expand)",
3336
+ "background-color var(--spring-fade-dur) var(--spring-fade)",
3337
+ "border-color var(--spring-fade-dur) var(--spring-fade)",
3338
+ "box-shadow var(--spring-fade-dur) var(--spring-fade)",
3339
+ "transform var(--t-feedback)"
3340
+ ].join(", ");
3341
+ }
3342
+ function E(s, o) {
3343
+ o.originalRole === null ? s.removeAttribute("role") : s.setAttribute("role", o.originalRole), o.originalAriaLabel === null ? s.removeAttribute("aria-label") : s.setAttribute("aria-label", o.originalAriaLabel), o.originalAriaExpanded === null ? s.removeAttribute("aria-expanded") : s.setAttribute("aria-expanded", o.originalAriaExpanded), o.originalAriaModal === null ? s.removeAttribute("aria-modal") : s.setAttribute("aria-modal", o.originalAriaModal);
3344
+ }
3345
+ async function c() {
3346
+ p.value ? await a.push({ name: n.parentRouteName }) && p.value && l() : l();
3347
+ }
3348
+ async function x(s = "pointer") {
3349
+ if (se()) return;
3350
+ const o = D.value;
3351
+ if (!o) return;
3352
+ clearTimeout(f), Q.value = !1, o.classList.remove("is-pressing");
3353
+ const R = o.closest(".view");
3354
+ if (R && typeof R.getAnimations == "function")
3355
+ try {
3356
+ R.getAnimations().forEach((Se) => Se.finish());
3357
+ } catch {
3358
+ }
3359
+ const w = o.getBoundingClientRect(), V = getComputedStyle(o), L = V.borderRadius, re = o.parentNode, ce = o.style.cssText, fe = o.getAttribute("role"), me = o.getAttribute("aria-label"), we = o.getAttribute("aria-expanded"), pe = o.getAttribute("aria-modal"), le = document.createElement("div");
3360
+ le.className = "expand-placeholder", le.style.height = w.height + "px", le.style.gridColumn = V.gridColumn, le.style.gridRow = V.gridRow, le.style.flex = V.flex, le.style.alignSelf = V.alignSelf, le.style.order = V.order, le.style.margin = V.margin, le.style.minWidth = V.minWidth, le.setAttribute("aria-hidden", "true"), re.insertBefore(le, o);
3361
+ const he = W(o, "card-inner");
3362
+ he && (he.setAttribute("aria-hidden", "true"), he.inert = !0), N.value || (N.value = !0), $(o, w, V), o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.setAttribute("aria-expanded", "true"), document.body.classList.add("locked"), G();
3363
+ const de = r();
3364
+ ee(), s === "pointer" && document.activeElement === o && o.blur();
3365
+ const Ne = (Se) => {
3366
+ Se.key === "Escape" && (Se.preventDefault(), c());
3367
+ };
3368
+ document.addEventListener("keydown", Ne);
3369
+ const Be = {
3370
+ card: o,
3371
+ slot: le,
3372
+ rect: w,
3373
+ originRadius: L,
3374
+ method: s,
3375
+ originalStyle: ce,
3376
+ originalRole: fe,
3377
+ originalAriaLabel: me,
3378
+ originalAriaExpanded: we,
3379
+ originalAriaModal: pe,
3380
+ escHandler: Ne
3381
+ };
3382
+ if (fl(Be), await ve(), se() !== Be) return;
3383
+ const Re = z.value && z.value.firstElementChild, De = Re && Re.querySelector(".expand-title");
3384
+ De && o.setAttribute("aria-label", De.textContent), o.offsetWidth, requestAnimationFrame(() => {
3385
+ requestAnimationFrame(() => {
3386
+ se() !== Be || q.value || (K.value = !0, o.style.top = de.top, o.style.left = de.left, o.style.width = de.width, o.style.height = de.height, o.style.borderRadius = de.radius, o.style.backgroundColor = de.background, o.style.borderColor = de.border, o.style.boxShadow = de.shadow, s === "keyboard" && o.focus({ preventScroll: !0 }));
3387
+ });
3388
+ });
3389
+ }
3390
+ function l() {
3391
+ if (!se() || q.value) return;
3392
+ const s = se(), {
3393
+ card: o,
3394
+ slot: R,
3395
+ rect: w,
3396
+ originRadius: V,
3397
+ method: L,
3398
+ originalStyle: re,
3399
+ originalRole: ce,
3400
+ originalAriaLabel: fe,
3401
+ originalAriaExpanded: me,
3402
+ originalAriaModal: we,
3403
+ escHandler: pe
3404
+ } = s;
3405
+ document.removeEventListener("keydown", pe), K.value = !1, q.value = !0, J.value = !1, o.style.transition = [
3406
+ "top var(--spring-exit-dur) var(--spring-exit)",
3407
+ "left var(--spring-exit-dur) var(--spring-exit)",
3408
+ "width var(--spring-exit-dur) var(--spring-exit)",
3409
+ "height var(--spring-exit-dur) var(--spring-exit)",
3410
+ "border-radius var(--spring-exit-dur) var(--spring-exit)",
3411
+ "background-color var(--spring-fade-dur) var(--spring-fade)",
3412
+ "border-color var(--spring-fade-dur) var(--spring-fade)",
3413
+ "box-shadow var(--spring-fade-dur) var(--spring-fade)"
3414
+ ].join(", "), o.offsetWidth, o.style.top = w.top + "px", o.style.left = w.left + "px", o.style.width = w.width + "px", o.style.height = w.height + "px", o.style.borderRadius = V, o.style.backgroundColor = "var(--surface-container-low)", o.style.borderColor = "var(--outline-variant)", o.style.boxShadow = "var(--elev-card)";
3415
+ const le = j() ? 0 : te("--spring-exit-dur", 400);
3416
+ clearTimeout(i), i = setTimeout(() => {
3417
+ q.value = !1;
3418
+ const he = W(o, "card-inner");
3419
+ he && (he.removeAttribute("aria-hidden"), he.inert = !1), R.remove(), o.style.cssText = re, E(o, s), document.body.classList.remove("locked"), Z(), I.value = !1, L === "keyboard" ? o.focus({ preventScroll: !0 }) : document.activeElement === o && o.blur(), He(s), Q.value = !0, F && p.value && (F = !1, requestAnimationFrame(() => {
3420
+ p.value && !se() && x("pointer");
3421
+ })), clearTimeout(f), f = setTimeout(() => {
3422
+ Q.value = !1;
3423
+ }, j() ? 0 : ml);
3424
+ }, le + vl);
3425
+ }
3426
+ async function m(s) {
3427
+ if (q.value) return;
3428
+ if (K.value) {
3429
+ s.target.closest("[data-close]") && (s.stopPropagation(), c());
3430
+ return;
3431
+ }
3432
+ if (se() || s.target.closest(Ie)) return;
3433
+ const o = s.detail === 0 ? "keyboard" : "pointer";
3434
+ P = o, await a.push({ name: n.routeName, params: n.routeParams }) && p.value && !se() && !q.value && x(o);
3435
+ }
3436
+ async function A(s) {
3437
+ if (se() || s.key !== "Enter" && s.key !== " " || s.target.closest(Ie)) return;
3438
+ s.preventDefault(), P = "keyboard", await a.push({ name: n.routeName, params: n.routeParams }) && p.value && !se() && !q.value && x("keyboard");
3439
+ }
3440
+ function S() {
3441
+ const s = D.value, o = document.getElementById("scrollArea");
3442
+ if (!s || !o) return;
3443
+ const R = s.getBoundingClientRect(), w = o.getBoundingClientRect(), V = R.top - w.top, L = o.scrollTop + V - Math.max(0, (o.clientHeight - R.height) / 2);
3444
+ o.scrollTo({ top: Math.max(0, L), behavior: "instant" });
3445
+ }
3446
+ function T(s = "pointer", o = !1) {
3447
+ if (!p.value || se() || q.value) return;
3448
+ const R = D.value;
3449
+ !R || !R.isConnected || (o && S(), requestAnimationFrame(() => {
3450
+ p.value && !se() && !q.value && x(s);
3451
+ }));
3452
+ }
3453
+ return be(p, (s) => {
3454
+ if (_)
3455
+ if (s) {
3456
+ const o = se();
3457
+ if (o && o.card === D.value) {
3458
+ q.value && (F = !0);
3459
+ return;
3460
+ }
3461
+ o || T(P), P = "pointer";
3462
+ } else {
3463
+ F = !1;
3464
+ const o = se();
3465
+ o && o.card === D.value && l(), P = "pointer";
3466
+ }
3467
+ }, { flush: "post" }), Me(() => {
3468
+ _ = !0;
3469
+ const s = D.value;
3470
+ s && (s.hasAttribute("tabindex") || s.setAttribute("tabindex", "0"), s.hasAttribute("role") || s.setAttribute("role", "button"), s.hasAttribute("aria-haspopup") || s.setAttribute("aria-haspopup", "dialog"), s.setAttribute("aria-expanded", "false"), p.value && T("pointer", !0));
3471
+ }), Qe(() => {
3472
+ _ && p.value && T("pointer");
3473
+ }), ge(() => {
3474
+ clearTimeout(i), clearTimeout(f), clearTimeout(k), Z(), I.value = !1;
3475
+ const s = se();
3476
+ s && s.card === D.value && (document.removeEventListener("keydown", s.escHandler), document.body.classList.remove("locked"), He(s));
3477
+ }), u({ close: l, open: x }), (s, o) => (d(), xe(Ue(e.tag), {
3478
+ ref_key: "rootEl",
3479
+ ref: D,
3480
+ class: U(M.value),
3481
+ "data-expand": e.expandKey,
3482
+ onClick: m,
3483
+ onKeydown: A
3484
+ }, {
3485
+ default: Fe(() => [
3486
+ (d(), xe(Pe, { to: "body" }, [
3487
+ I.value ? (d(), h("div", {
3488
+ key: 0,
3489
+ class: U(["expand-backdrop", { "is-open": J.value }]),
3490
+ "aria-hidden": "true",
3491
+ onClick: c
3492
+ }, null, 2)) : X("", !0)
3493
+ ])),
3494
+ t("div", {
3495
+ class: "card-inner",
3496
+ ref_key: "innerEl",
3497
+ ref: H
3498
+ }, [
3499
+ ie(s.$slots, "default")
3500
+ ], 512),
3501
+ t("div", {
3502
+ class: "expand-scroller",
3503
+ ref_key: "scrollerEl",
3504
+ ref: z
3505
+ }, [
3506
+ N.value ? (d(), h("div", pl, [
3507
+ (d(), xe(Ue(e.content), Je(et(e.contentProps)), null, 16))
3508
+ ])) : X("", !0)
3509
+ ], 512)
3510
+ ]),
3511
+ _: 3
3512
+ }, 40, ["class", "data-expand"]));
3513
+ }
3514
+ }, ei = {
3515
+ __name: "RouteExpandCard",
3516
+ props: {
3517
+ section: { type: String, required: !0 },
3518
+ cardKey: { type: [String, Number], required: !0 },
3519
+ routeName: { type: String, default: "" },
3520
+ params: { type: Object, default: () => ({}) },
3521
+ tag: { type: String, default: "section" },
3522
+ variant: { type: String, default: "card" },
3523
+ feature: { type: Boolean, default: !1 },
3524
+ content: { type: [Object, Function], required: !0 },
3525
+ contentProps: { type: Object, default: () => ({}) }
3526
+ },
3527
+ setup(e) {
3528
+ const u = e, n = O(() => u.routeName || `${u.section}-${u.cardKey}`);
3529
+ return (g, a) => (d(), xe(gl, {
3530
+ tag: e.tag,
3531
+ "expand-key": String(e.cardKey),
3532
+ "route-name": n.value,
3533
+ "parent-route-name": e.section,
3534
+ "route-params": e.params,
3535
+ variant: e.variant,
3536
+ feature: e.feature,
3537
+ content: e.content,
3538
+ "content-props": e.contentProps
3539
+ }, {
3540
+ default: Fe(() => [
3541
+ ie(g.$slots, "default")
3542
+ ]),
3543
+ _: 3
3544
+ }, 8, ["tag", "expand-key", "route-name", "parent-route-name", "route-params", "variant", "feature", "content", "content-props"]));
3545
+ }
3546
+ }, ti = {
3547
+ name: "ExpandRoute",
3548
+ render: () => null
3549
+ };
3550
+ export {
3551
+ ti as EmptyRoute,
3552
+ gl as ExpandableCard,
3553
+ ei as RouteExpandCard,
3554
+ wl as UiAccordion,
3555
+ xl as UiAlert,
3556
+ _l as UiAvatar,
3557
+ kl as UiBadge,
3558
+ $l as UiBarChart,
3559
+ Ml as UiBottomSheet,
3560
+ Sl as UiButton,
3561
+ Cl as UiCheckbox,
3562
+ El as UiChip,
3563
+ Al as UiDatePicker,
3564
+ Vl as UiEmptyState,
3565
+ Pl as UiFloatingMenu,
3566
+ Tl as UiGauge,
3567
+ Bl as UiHeatmap,
3568
+ Fl as UiInput,
3569
+ Ll as UiLineChart,
3570
+ Nl as UiModal,
3571
+ Rl as UiProgress,
3572
+ Dl as UiRadioGroup,
3573
+ Ul as UiRating,
3574
+ Wl as UiRingProgress,
3575
+ Ol as UiSegmented,
3576
+ Hl as UiSelect,
3577
+ Il as UiSkeleton,
3578
+ zl as UiSlider,
3579
+ ql as UiSparkline,
3580
+ jl as UiSpinner,
3581
+ Yl as UiStepper,
3582
+ Kl as UiSwitch,
3583
+ Xl as UiTextarea,
3584
+ Gl as UiTimePicker,
3585
+ Zl as UiToastHost,
3586
+ Ql as UiToolMenu,
3587
+ Jl as UiTooltip,
3588
+ qe as useMorphWindow,
3589
+ Le as usePress
3590
+ };