@cghbcf/xp-ui 1.0.0 → 1.0.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,1342 @@
1
+ import { ref as _, openBlock as r, createBlock as z, Transition as N, withCtx as S, createElementBlock as i, normalizeClass as $, createElementVNode as c, toDisplayString as k, renderSlot as b, createTextVNode as X, createCommentVNode as g, computed as w, normalizeStyle as C, Teleport as L, createVNode as B, withModifiers as K, onMounted as Q, onBeforeUnmount as J, Fragment as W, renderList as q, nextTick as Z, inject as oe, provide as se } from "vue";
2
+ const v = (e, t) => {
3
+ const a = e.__vccOpts || e;
4
+ for (const [l, n] of t)
5
+ a[l] = n;
6
+ return a;
7
+ }, re = { class: "xp-alert__icon" }, ie = { class: "xp-alert__content" }, de = { class: "xp-alert__title" }, ce = {
8
+ key: 0,
9
+ class: "xp-alert__description"
10
+ }, ue = {
11
+ __name: "Alert",
12
+ props: {
13
+ title: {
14
+ type: String,
15
+ default: ""
16
+ },
17
+ type: {
18
+ type: String,
19
+ default: "info",
20
+ validator: (e) => ["success", "warning", "danger", "info"].includes(e)
21
+ },
22
+ effect: {
23
+ type: String,
24
+ default: "light",
25
+ validator: (e) => ["light", "dark", "plain"].includes(e)
26
+ },
27
+ closable: {
28
+ type: Boolean,
29
+ default: !0
30
+ },
31
+ showIcon: {
32
+ type: Boolean,
33
+ default: !0
34
+ }
35
+ },
36
+ emits: ["close"],
37
+ setup(e, { emit: t }) {
38
+ const a = t, l = _(!0), n = {
39
+ success: "✓",
40
+ warning: "!",
41
+ danger: "×",
42
+ info: "i"
43
+ }, s = () => {
44
+ l.value = !1, a("close");
45
+ };
46
+ return (o, u) => (r(), z(N, { name: "xp-alert-fade" }, {
47
+ default: S(() => [
48
+ l.value ? (r(), i("div", {
49
+ key: 0,
50
+ class: $(["xp-alert", [
51
+ `xp-alert--${e.type}`,
52
+ `xp-alert--${e.effect}`,
53
+ { "xp-alert--plain": e.effect === "plain" }
54
+ ]]),
55
+ role: "alert"
56
+ }, [
57
+ c("span", re, k(n[e.type]), 1),
58
+ c("div", ie, [
59
+ c("span", de, [
60
+ b(o.$slots, "default", {}, () => [
61
+ X(k(e.title), 1)
62
+ ], !0)
63
+ ]),
64
+ o.$slots.default ? (r(), i("p", ce, [
65
+ b(o.$slots, "default", {}, void 0, !0)
66
+ ])) : g("", !0)
67
+ ]),
68
+ e.closable ? (r(), i("i", {
69
+ key: 0,
70
+ class: "xp-alert__close-btn",
71
+ onClick: s
72
+ }, "×")) : g("", !0)
73
+ ], 2)) : g("", !0)
74
+ ]),
75
+ _: 3
76
+ }));
77
+ }
78
+ }, pe = /* @__PURE__ */ v(ue, [["__scopeId", "data-v-91d792bd"]]), fe = ["src", "alt"], he = {
79
+ key: 1,
80
+ class: "xp-avatar__slot"
81
+ }, me = {
82
+ key: 2,
83
+ class: "xp-avatar__text"
84
+ }, ge = {
85
+ __name: "Avatar",
86
+ props: {
87
+ src: {
88
+ type: String,
89
+ default: ""
90
+ },
91
+ alt: {
92
+ type: String,
93
+ default: ""
94
+ },
95
+ shape: {
96
+ type: String,
97
+ default: "circle",
98
+ validator: (e) => ["circle", "square"].includes(e)
99
+ },
100
+ size: {
101
+ type: String,
102
+ default: "medium",
103
+ validator: (e) => ["small", "medium", "large"].includes(e)
104
+ },
105
+ icon: {
106
+ type: String,
107
+ default: ""
108
+ }
109
+ },
110
+ emits: ["error"],
111
+ setup(e, { emit: t }) {
112
+ const a = e, l = t, n = _(!1), s = w(() => ({
113
+ backgroundColor: a.src ? "transparent" : "var(--xp-color-primary-bg)",
114
+ color: a.src ? void 0 : "var(--xp-color-primary)"
115
+ })), o = () => {
116
+ n.value = !0, l("error");
117
+ };
118
+ return (u, f) => (r(), i("span", {
119
+ class: $(["xp-avatar", [
120
+ `xp-avatar--${e.shape}`,
121
+ `xp-avatar--${e.size}`,
122
+ { "xp-avatar--fit": e.src }
123
+ ]]),
124
+ style: C(s.value)
125
+ }, [
126
+ e.src && !n.value ? (r(), i("img", {
127
+ key: 0,
128
+ src: e.src,
129
+ alt: e.alt,
130
+ onError: o
131
+ }, null, 40, fe)) : u.$slots.default ? (r(), i("span", he, [
132
+ b(u.$slots, "default", {}, void 0, !0)
133
+ ])) : (r(), i("span", me, k(e.alt || "A"), 1))
134
+ ], 6));
135
+ }
136
+ }, be = /* @__PURE__ */ v(ge, [["__scopeId", "data-v-a9a54bc5"]]), xe = { key: 0 }, ve = {
137
+ __name: "Badge",
138
+ props: {
139
+ value: {
140
+ type: [String, Number],
141
+ default: 0
142
+ },
143
+ max: {
144
+ type: Number,
145
+ default: 99
146
+ },
147
+ type: {
148
+ type: String,
149
+ default: "danger",
150
+ validator: (e) => ["primary", "success", "warning", "danger", "info"].includes(e)
151
+ },
152
+ isDot: {
153
+ type: Boolean,
154
+ default: !1
155
+ },
156
+ hidden: {
157
+ type: Boolean,
158
+ default: !1
159
+ }
160
+ },
161
+ setup(e) {
162
+ const t = e, a = w(() => typeof t.value == "number" && t.value > t.max ? `${t.max}+` : t.value), l = w(() => t.value !== 0 && t.value !== "" && t.value !== null && t.value !== void 0);
163
+ return (n, s) => (r(), i("div", {
164
+ class: $(["xp-badge", { "xp-badge--dot": e.isDot, "xp-badge--hidden": e.hidden }])
165
+ }, [
166
+ b(n.$slots, "default", {}, void 0, !0),
167
+ !e.hidden && (e.isDot || l.value) ? (r(), i("sup", {
168
+ key: 0,
169
+ class: $(["xp-badge__content", [
170
+ `xp-badge__content--${e.type}`,
171
+ { "xp-badge__content--dot": e.isDot }
172
+ ]])
173
+ }, [
174
+ e.isDot ? g("", !0) : (r(), i("span", xe, k(a.value), 1))
175
+ ], 2)) : g("", !0)
176
+ ], 2));
177
+ }
178
+ }, ye = /* @__PURE__ */ v(ve, [["__scopeId", "data-v-207db6dd"]]), _e = ["disabled"], $e = {
179
+ key: 0,
180
+ class: "xp-button__loading"
181
+ }, ke = { class: "xp-button__text" }, we = {
182
+ __name: "Button",
183
+ props: {
184
+ type: {
185
+ type: String,
186
+ default: "default",
187
+ validator: (e) => ["primary", "default", "success", "warning", "danger", "info"].includes(e)
188
+ },
189
+ size: {
190
+ type: String,
191
+ default: "medium",
192
+ validator: (e) => ["small", "medium", "large"].includes(e)
193
+ },
194
+ disabled: {
195
+ type: Boolean,
196
+ default: !1
197
+ },
198
+ loading: {
199
+ type: Boolean,
200
+ default: !1
201
+ },
202
+ plain: {
203
+ type: Boolean,
204
+ default: !1
205
+ },
206
+ text: {
207
+ type: Boolean,
208
+ default: !1
209
+ }
210
+ },
211
+ emits: ["click"],
212
+ setup(e, { emit: t }) {
213
+ const a = e, l = t, n = (s) => {
214
+ !a.disabled && !a.loading && l("click", s);
215
+ };
216
+ return (s, o) => (r(), i("button", {
217
+ class: $(["xp-button", [
218
+ `xp-button--${e.type}`,
219
+ `xp-button--${e.size}`,
220
+ {
221
+ "xp-button--disabled": e.disabled,
222
+ "xp-button--loading": e.loading,
223
+ "xp-button--plain": e.plain,
224
+ "xp-button--text": e.text
225
+ }
226
+ ]]),
227
+ disabled: e.disabled || e.loading,
228
+ onClick: n
229
+ }, [
230
+ e.loading ? (r(), i("span", $e)) : g("", !0),
231
+ c("span", ke, [
232
+ b(s.$slots, "default", {}, void 0, !0)
233
+ ])
234
+ ], 10, _e));
235
+ }
236
+ }, F = /* @__PURE__ */ v(we, [["__scopeId", "data-v-a768661d"]]), Ce = {
237
+ key: 0,
238
+ class: "xp-card__header"
239
+ }, Se = { class: "xp-card__title" }, Be = {
240
+ key: 0,
241
+ class: "xp-card__extra"
242
+ }, Ve = { class: "xp-card__body" }, Te = {
243
+ key: 1,
244
+ class: "xp-card__footer"
245
+ }, Ie = {
246
+ __name: "Card",
247
+ props: {
248
+ title: {
249
+ type: String,
250
+ default: ""
251
+ },
252
+ shadow: {
253
+ type: String,
254
+ default: "always",
255
+ validator: (e) => ["always", "hover", "never"].includes(e)
256
+ },
257
+ bordered: {
258
+ type: Boolean,
259
+ default: !0
260
+ },
261
+ hover: {
262
+ type: Boolean,
263
+ default: !1
264
+ }
265
+ },
266
+ setup(e) {
267
+ return (t, a) => (r(), i("div", {
268
+ class: $(["xp-card", [
269
+ `xp-card--${e.shadow}`,
270
+ {
271
+ "xp-card--bordered": e.bordered,
272
+ "xp-card--hover": e.hover
273
+ }
274
+ ]])
275
+ }, [
276
+ e.title || t.$slots.header ? (r(), i("div", Ce, [
277
+ b(t.$slots, "header", {}, () => [
278
+ c("h3", Se, k(e.title), 1)
279
+ ], !0),
280
+ t.$slots.extra ? (r(), i("div", Be, [
281
+ b(t.$slots, "extra", {}, void 0, !0)
282
+ ])) : g("", !0)
283
+ ])) : g("", !0),
284
+ c("div", Ve, [
285
+ b(t.$slots, "default", {}, void 0, !0)
286
+ ]),
287
+ t.$slots.footer ? (r(), i("div", Te, [
288
+ b(t.$slots, "footer", {}, void 0, !0)
289
+ ])) : g("", !0)
290
+ ], 2));
291
+ }
292
+ }, Re = /* @__PURE__ */ v(Ie, [["__scopeId", "data-v-e65cbe05"]]), Me = { class: "xp-checkbox__input" }, Ne = ["checked", "disabled", ".indeterminate"], Xe = { class: "xp-checkbox__label" }, Ae = {
293
+ __name: "Checkbox",
294
+ props: {
295
+ modelValue: {
296
+ type: Boolean,
297
+ default: !1
298
+ },
299
+ disabled: {
300
+ type: Boolean,
301
+ default: !1
302
+ },
303
+ indeterminate: {
304
+ type: Boolean,
305
+ default: !1
306
+ }
307
+ },
308
+ emits: ["update:modelValue", "change"],
309
+ setup(e, { emit: t }) {
310
+ const a = e, l = t, n = (s) => {
311
+ if (a.disabled) return;
312
+ const o = s.target.checked;
313
+ l("update:modelValue", o), l("change", o);
314
+ };
315
+ return (s, o) => (r(), i("label", {
316
+ class: $(["xp-checkbox", [
317
+ {
318
+ "xp-checkbox--checked": e.modelValue,
319
+ "xp-checkbox--disabled": e.disabled,
320
+ "xp-checkbox--indeterminate": e.indeterminate
321
+ }
322
+ ]])
323
+ }, [
324
+ c("span", Me, [
325
+ o[0] || (o[0] = c("span", { class: "xp-checkbox__inner" }, null, -1)),
326
+ c("input", {
327
+ type: "checkbox",
328
+ class: "xp-checkbox__original",
329
+ checked: e.modelValue,
330
+ disabled: e.disabled,
331
+ onChange: n,
332
+ ".indeterminate": e.indeterminate
333
+ }, null, 40, Ne)
334
+ ]),
335
+ c("span", Xe, [
336
+ b(s.$slots, "default", {}, void 0, !0)
337
+ ])
338
+ ], 2));
339
+ }
340
+ }, Oe = /* @__PURE__ */ v(Ae, [["__scopeId", "data-v-7c078f46"]]), je = { class: "xp-dialog__header" }, De = { class: "xp-dialog__title" }, Ee = { class: "xp-dialog__body" }, ze = {
341
+ key: 0,
342
+ class: "xp-dialog__footer"
343
+ }, Fe = {
344
+ __name: "Dialog",
345
+ props: {
346
+ visible: {
347
+ type: Boolean,
348
+ default: !1
349
+ },
350
+ title: {
351
+ type: String,
352
+ default: ""
353
+ },
354
+ width: {
355
+ type: String,
356
+ default: "500px"
357
+ },
358
+ confirmButtonText: {
359
+ type: String,
360
+ default: "确定"
361
+ },
362
+ cancelButtonText: {
363
+ type: String,
364
+ default: "取消"
365
+ },
366
+ closeOnClickModal: {
367
+ type: Boolean,
368
+ default: !0
369
+ },
370
+ showDefaultFooter: {
371
+ type: Boolean,
372
+ default: !0
373
+ }
374
+ },
375
+ emits: ["confirm", "cancel", "update:visible", "close"],
376
+ setup(e, { emit: t }) {
377
+ const a = e, l = t, n = () => {
378
+ l("update:visible", !1), l("close");
379
+ }, s = () => {
380
+ a.closeOnClickModal && n();
381
+ }, o = () => {
382
+ l("confirm"), n();
383
+ }, u = () => {
384
+ l("cancel"), n();
385
+ };
386
+ return (f, p) => (r(), z(L, { to: "body" }, [
387
+ B(N, { name: "xp-dialog-fade" }, {
388
+ default: S(() => [
389
+ e.visible ? (r(), i("div", {
390
+ key: 0,
391
+ class: "xp-dialog__wrapper",
392
+ onClick: K(s, ["self"])
393
+ }, [
394
+ p[0] || (p[0] = c("div", { class: "xp-dialog__mask" }, null, -1)),
395
+ B(N, {
396
+ name: "xp-dialog-slide",
397
+ appear: ""
398
+ }, {
399
+ default: S(() => [
400
+ e.visible ? (r(), i("div", {
401
+ key: 0,
402
+ class: "xp-dialog",
403
+ style: C({ width: e.width })
404
+ }, [
405
+ c("div", je, [
406
+ c("h3", De, k(e.title), 1),
407
+ c("button", {
408
+ class: "xp-dialog__close",
409
+ onClick: n
410
+ }, "×")
411
+ ]),
412
+ c("div", Ee, [
413
+ b(f.$slots, "default", {}, void 0, !0)
414
+ ]),
415
+ f.$slots.footer || e.showDefaultFooter ? (r(), i("div", ze, [
416
+ b(f.$slots, "footer", {}, () => [
417
+ B(F, { onClick: u }, {
418
+ default: S(() => [
419
+ X(k(e.cancelButtonText), 1)
420
+ ]),
421
+ _: 1
422
+ }),
423
+ B(F, {
424
+ type: "primary",
425
+ onClick: o
426
+ }, {
427
+ default: S(() => [
428
+ X(k(e.confirmButtonText), 1)
429
+ ]),
430
+ _: 1
431
+ })
432
+ ], !0)
433
+ ])) : g("", !0)
434
+ ], 4)) : g("", !0)
435
+ ]),
436
+ _: 3
437
+ })
438
+ ])) : g("", !0)
439
+ ]),
440
+ _: 3
441
+ })
442
+ ]));
443
+ }
444
+ }, Pe = /* @__PURE__ */ v(Fe, [["__scopeId", "data-v-ef43d114"]]), Le = ["onClick"], Je = { key: 0 }, We = {
445
+ key: 1,
446
+ class: "xp-dropdown__divider"
447
+ }, qe = {
448
+ __name: "Dropdown",
449
+ props: {
450
+ items: {
451
+ type: Array,
452
+ default: () => []
453
+ },
454
+ disabled: {
455
+ type: Boolean,
456
+ default: !1
457
+ }
458
+ },
459
+ emits: ["select", "command", "open", "close"],
460
+ setup(e, { emit: t }) {
461
+ const a = e, l = t, n = _(!1), s = _({}), o = _(null), u = _(null), f = () => {
462
+ Z(() => {
463
+ if (!o.value || !u.value) return;
464
+ const d = o.value.getBoundingClientRect(), y = u.value.getBoundingClientRect();
465
+ let x = d.bottom + 6, I = d.left;
466
+ I + y.width > window.innerWidth - 10 && (I = window.innerWidth - y.width - 10), x + y.height > window.innerHeight - 10 && (x = d.top - y.height - 6), s.value = {
467
+ top: `${x + window.scrollY}px`,
468
+ left: `${I + window.scrollX}px`
469
+ };
470
+ });
471
+ }, p = () => {
472
+ a.disabled || (n.value = !n.value, n.value ? (f(), l("open")) : l("close"));
473
+ }, m = (d) => {
474
+ d.disabled || d.divider || (l("select", d), d.command !== void 0 && l("command", d.command, d), n.value = !1, l("close"));
475
+ }, h = (d) => {
476
+ var y;
477
+ n.value && o.value && !o.value.contains(d.target) && !((y = u.value) != null && y.contains(d.target)) && (n.value = !1, l("close"));
478
+ };
479
+ return Q(() => {
480
+ document.addEventListener("click", h);
481
+ }), J(() => {
482
+ document.removeEventListener("click", h);
483
+ }), (d, y) => (r(), i("div", {
484
+ class: "xp-dropdown",
485
+ ref_key: "dropdownRef",
486
+ ref: o
487
+ }, [
488
+ c("div", {
489
+ class: "xp-dropdown__trigger",
490
+ onClick: p
491
+ }, [
492
+ b(d.$slots, "default", {}, void 0, !0)
493
+ ]),
494
+ (r(), z(L, { to: "body" }, [
495
+ B(N, { name: "xp-dropdown-fade" }, {
496
+ default: S(() => [
497
+ n.value ? (r(), i("div", {
498
+ key: 0,
499
+ class: "xp-dropdown__menu",
500
+ style: C(s.value),
501
+ ref_key: "menuRef",
502
+ ref: u
503
+ }, [
504
+ (r(!0), i(W, null, q(e.items, (x, I) => (r(), i("div", {
505
+ key: I,
506
+ class: $(["xp-dropdown__item", { "xp-dropdown__item--disabled": x.disabled, "xp-dropdown__item--divider": x.divider }]),
507
+ onClick: (Lt) => m(x)
508
+ }, [
509
+ x.divider ? g("", !0) : (r(), i("span", Je, k(x.label), 1)),
510
+ x.divider ? (r(), i("span", We)) : g("", !0)
511
+ ], 10, Le))), 128))
512
+ ], 4)) : g("", !0)
513
+ ]),
514
+ _: 1
515
+ })
516
+ ]))
517
+ ], 512));
518
+ }
519
+ }, He = /* @__PURE__ */ v(qe, [["__scopeId", "data-v-ad741cd8"]]), Ue = {
520
+ key: 0,
521
+ class: "xp-input__prefix"
522
+ }, Ye = ["type", "value", "placeholder", "disabled", "maxlength"], Ge = {
523
+ key: 2,
524
+ class: "xp-input__suffix"
525
+ }, Ke = {
526
+ __name: "Input",
527
+ props: {
528
+ modelValue: {
529
+ type: [String, Number],
530
+ default: ""
531
+ },
532
+ type: {
533
+ type: String,
534
+ default: "text",
535
+ validator: (e) => ["text", "password", "number", "email", "tel", "url"].includes(e)
536
+ },
537
+ placeholder: {
538
+ type: String,
539
+ default: ""
540
+ },
541
+ disabled: {
542
+ type: Boolean,
543
+ default: !1
544
+ },
545
+ size: {
546
+ type: String,
547
+ default: "medium",
548
+ validator: (e) => ["small", "medium", "large"].includes(e)
549
+ },
550
+ maxlength: {
551
+ type: [String, Number],
552
+ default: null
553
+ },
554
+ showClear: {
555
+ type: Boolean,
556
+ default: !1
557
+ }
558
+ },
559
+ emits: ["update:modelValue", "focus", "blur", "clear"],
560
+ setup(e, { emit: t }) {
561
+ const a = t, l = _(null), n = _(!1), s = (p) => {
562
+ a("update:modelValue", p.target.value);
563
+ }, o = (p) => {
564
+ n.value = !0, a("focus", p);
565
+ }, u = (p) => {
566
+ n.value = !1, a("blur", p);
567
+ }, f = () => {
568
+ a("update:modelValue", ""), a("clear"), l.value && l.value.focus();
569
+ };
570
+ return (p, m) => (r(), i("div", {
571
+ class: $(["xp-input", [
572
+ `xp-input--${e.size}`,
573
+ {
574
+ "xp-input--disabled": e.disabled,
575
+ "xp-input--prefix": p.$slots.prefix,
576
+ "xp-input--suffix": p.$slots.suffix || e.showClear,
577
+ "xp-input--focus": n.value
578
+ }
579
+ ]])
580
+ }, [
581
+ p.$slots.prefix ? (r(), i("span", Ue, [
582
+ b(p.$slots, "prefix", {}, void 0, !0)
583
+ ])) : g("", !0),
584
+ c("input", {
585
+ ref_key: "inputRef",
586
+ ref: l,
587
+ class: "xp-input__inner",
588
+ type: e.type,
589
+ value: e.modelValue,
590
+ placeholder: e.placeholder,
591
+ disabled: e.disabled,
592
+ maxlength: e.maxlength,
593
+ onInput: s,
594
+ onFocus: o,
595
+ onBlur: u
596
+ }, null, 40, Ye),
597
+ e.showClear && e.modelValue && !e.disabled ? (r(), i("span", {
598
+ key: 1,
599
+ class: "xp-input__clear",
600
+ onClick: f
601
+ }, "×")) : g("", !0),
602
+ p.$slots.suffix && !e.showClear ? (r(), i("span", Ge, [
603
+ b(p.$slots, "suffix", {}, void 0, !0)
604
+ ])) : g("", !0)
605
+ ], 2));
606
+ }
607
+ }, Qe = /* @__PURE__ */ v(Ke, [["__scopeId", "data-v-f671ef9a"]]), Ze = { class: "xp-progress__bar" }, et = {
608
+ key: 0,
609
+ class: "xp-progress__text"
610
+ }, tt = {
611
+ __name: "Progress",
612
+ props: {
613
+ percentage: {
614
+ type: Number,
615
+ default: 0,
616
+ validator: (e) => e >= 0 && e <= 100
617
+ },
618
+ color: {
619
+ type: String,
620
+ default: ""
621
+ },
622
+ showText: {
623
+ type: Boolean,
624
+ default: !0
625
+ },
626
+ type: {
627
+ type: String,
628
+ default: "line",
629
+ validator: (e) => ["line", "circle"].includes(e)
630
+ },
631
+ status: {
632
+ type: String,
633
+ default: "",
634
+ validator: (e) => ["", "success", "warning", "exception"].includes(e)
635
+ }
636
+ },
637
+ setup(e) {
638
+ const t = e, a = w(() => t.color ? t.color : t.status === "success" ? "var(--xp-color-success)" : t.status === "warning" ? "var(--xp-color-warning)" : t.status === "exception" ? "var(--xp-color-danger)" : "var(--xp-color-primary)");
639
+ return (l, n) => (r(), i("div", {
640
+ class: $(["xp-progress", [`xp-progress--${e.type}`]])
641
+ }, [
642
+ c("div", Ze, [
643
+ c("div", {
644
+ class: "xp-progress__inner",
645
+ style: C({ width: `${e.percentage}%`, backgroundColor: a.value })
646
+ }, null, 4)
647
+ ]),
648
+ e.showText ? (r(), i("span", et, [
649
+ b(l.$slots, "default", {}, () => [
650
+ X(k(e.percentage) + "%", 1)
651
+ ], !0)
652
+ ])) : g("", !0)
653
+ ], 2));
654
+ }
655
+ }, at = /* @__PURE__ */ v(tt, [["__scopeId", "data-v-a95933c8"]]), lt = { class: "xp-radio__input" }, nt = ["checked", "disabled"], ot = { class: "xp-radio__label" }, st = {
656
+ __name: "Radio",
657
+ props: {
658
+ modelValue: {
659
+ type: [String, Number, Boolean],
660
+ default: ""
661
+ },
662
+ value: {
663
+ type: [String, Number, Boolean],
664
+ default: ""
665
+ },
666
+ disabled: {
667
+ type: Boolean,
668
+ default: !1
669
+ }
670
+ },
671
+ emits: ["update:modelValue", "change"],
672
+ setup(e, { emit: t }) {
673
+ const a = e, l = t, n = () => {
674
+ a.disabled || (l("update:modelValue", a.value), l("change", a.value));
675
+ };
676
+ return (s, o) => (r(), i("label", {
677
+ class: $(["xp-radio", [
678
+ {
679
+ "xp-radio--checked": e.modelValue === e.value,
680
+ "xp-radio--disabled": e.disabled
681
+ }
682
+ ]])
683
+ }, [
684
+ c("span", lt, [
685
+ o[0] || (o[0] = c("span", { class: "xp-radio__inner" }, null, -1)),
686
+ c("input", {
687
+ type: "radio",
688
+ class: "xp-radio__original",
689
+ checked: e.modelValue === e.value,
690
+ disabled: e.disabled,
691
+ onChange: n
692
+ }, null, 40, nt)
693
+ ]),
694
+ c("span", ot, [
695
+ b(s.$slots, "default", {}, void 0, !0)
696
+ ])
697
+ ], 2));
698
+ }
699
+ }, rt = /* @__PURE__ */ v(st, [["__scopeId", "data-v-02a0d80d"]]), it = { class: "xp-rate" }, dt = ["onClick", "onMouseenter"], ct = { class: "xp-rate__star" }, ut = {
700
+ key: 0,
701
+ class: "xp-rate__text"
702
+ }, pt = {
703
+ __name: "Rate",
704
+ props: {
705
+ modelValue: {
706
+ type: Number,
707
+ default: 0
708
+ },
709
+ max: {
710
+ type: Number,
711
+ default: 5
712
+ },
713
+ color: {
714
+ type: String,
715
+ default: "#f7ba2a"
716
+ },
717
+ disabled: {
718
+ type: Boolean,
719
+ default: !1
720
+ },
721
+ showText: {
722
+ type: Boolean,
723
+ default: !1
724
+ }
725
+ },
726
+ emits: ["update:modelValue", "change"],
727
+ setup(e, { emit: t }) {
728
+ const a = e, l = t, n = _(0), s = w(() => n.value || a.modelValue), o = (f) => {
729
+ const p = s.value - f + 1;
730
+ return p >= 1 ? 100 : p > 0 ? p * 100 : 0;
731
+ }, u = (f) => {
732
+ a.disabled || (l("update:modelValue", f), l("change", f));
733
+ };
734
+ return (f, p) => (r(), i("div", it, [
735
+ (r(!0), i(W, null, q(e.max, (m) => (r(), i("span", {
736
+ key: m,
737
+ class: $(["xp-rate__item", {
738
+ "xp-rate__item--disabled": e.disabled
739
+ }]),
740
+ style: C({ cursor: e.disabled ? "default" : "pointer" }),
741
+ onClick: (h) => u(m),
742
+ onMouseenter: (h) => n.value = m,
743
+ onMouseleave: p[0] || (p[0] = (h) => n.value = 0)
744
+ }, [
745
+ c("span", ct, [
746
+ c("span", {
747
+ class: "xp-rate__star-inner",
748
+ style: C({ width: o(m) + "%", color: e.color })
749
+ }, " ★ ", 4),
750
+ p[1] || (p[1] = c("span", { class: "xp-rate__star-outer" }, "★", -1))
751
+ ])
752
+ ], 46, dt))), 128)),
753
+ e.showText && !e.disabled ? (r(), i("span", ut, k(e.modelValue) + " / " + k(e.max), 1)) : g("", !0)
754
+ ]));
755
+ }
756
+ }, ft = /* @__PURE__ */ v(pt, [["__scopeId", "data-v-17bb0933"]]), ht = ["aria-checked"], mt = {
757
+ key: 0,
758
+ class: "xp-switch__label"
759
+ }, gt = {
760
+ __name: "Switch",
761
+ props: {
762
+ modelValue: {
763
+ type: Boolean,
764
+ default: !1
765
+ },
766
+ size: {
767
+ type: String,
768
+ default: "medium",
769
+ validator: (e) => ["small", "medium", "large"].includes(e)
770
+ },
771
+ disabled: {
772
+ type: Boolean,
773
+ default: !1
774
+ }
775
+ },
776
+ emits: ["update:modelValue", "change"],
777
+ setup(e, { emit: t }) {
778
+ const a = e, l = t, n = () => {
779
+ if (a.disabled) return;
780
+ const s = !a.modelValue;
781
+ l("update:modelValue", s), l("change", s);
782
+ };
783
+ return (s, o) => (r(), i("div", {
784
+ class: $(["xp-switch", [
785
+ `xp-switch--${e.size}`,
786
+ {
787
+ "xp-switch--checked": e.modelValue,
788
+ "xp-switch--disabled": e.disabled
789
+ }
790
+ ]]),
791
+ role: "switch",
792
+ "aria-checked": e.modelValue,
793
+ onClick: n
794
+ }, [
795
+ o[0] || (o[0] = c("span", { class: "xp-switch__core" }, [
796
+ c("span", { class: "xp-switch__action" })
797
+ ], -1)),
798
+ s.$slots.default ? (r(), i("span", mt, [
799
+ b(s.$slots, "default", {}, void 0, !0)
800
+ ])) : g("", !0)
801
+ ], 10, ht));
802
+ }
803
+ }, bt = /* @__PURE__ */ v(gt, [["__scopeId", "data-v-5a5e33c5"]]), xt = {
804
+ key: 0,
805
+ class: "xp-tab-pane"
806
+ }, vt = {
807
+ __name: "TabPane",
808
+ props: {
809
+ name: {
810
+ type: [String, Number],
811
+ required: !0
812
+ },
813
+ title: {
814
+ type: String,
815
+ default: ""
816
+ },
817
+ disabled: {
818
+ type: Boolean,
819
+ default: !1
820
+ }
821
+ },
822
+ setup(e) {
823
+ const t = e, a = oe("xpTabs", null), l = w(() => a ? a.currentValue.value === t.name : !0);
824
+ return Q(() => {
825
+ a && a.addTab && a.addTab({ name: t.name, title: t.title, disabled: t.disabled });
826
+ }), J(() => {
827
+ a && a.removeTab && a.removeTab(t.name);
828
+ }), (n, s) => l.value ? (r(), i("div", xt, [
829
+ b(n.$slots, "default", {}, void 0, !0)
830
+ ])) : g("", !0);
831
+ }
832
+ }, yt = /* @__PURE__ */ v(vt, [["__scopeId", "data-v-6fe7943a"]]), _t = { class: "xp-tabs" }, $t = {
833
+ class: "xp-tabs__nav",
834
+ role: "tablist"
835
+ }, kt = ["onClick"], wt = { class: "xp-tabs__content" }, Ct = {
836
+ __name: "Tabs",
837
+ props: {
838
+ modelValue: {
839
+ type: [String, Number],
840
+ default: null
841
+ }
842
+ },
843
+ emits: ["update:modelValue", "change"],
844
+ setup(e, { emit: t }) {
845
+ const a = e, l = t, n = _([]), s = w(() => {
846
+ var m;
847
+ return a.modelValue !== null && a.modelValue !== void 0 && a.modelValue !== "" ? a.modelValue : ((m = n.value[0]) == null ? void 0 : m.name) ?? null;
848
+ }), o = w(() => {
849
+ const m = n.value.findIndex((d) => d.name === s.value);
850
+ return {
851
+ transform: `translateX(${(m >= 0 ? m : 0) * 100}%)`,
852
+ width: `${n.value.length ? 100 / n.value.length : 0}%`
853
+ };
854
+ }), u = (m) => {
855
+ m.disabled || (l("update:modelValue", m.name), l("change", m.name));
856
+ };
857
+ return se("xpTabs", { addTab: (m) => {
858
+ n.value.find((h) => h.name === m.name) || n.value.push(m);
859
+ }, removeTab: (m) => {
860
+ const h = n.value.findIndex((d) => d.name === m);
861
+ h >= 0 && n.value.splice(h, 1);
862
+ }, currentValue: s }), (m, h) => (r(), i("div", _t, [
863
+ c("div", $t, [
864
+ (r(!0), i(W, null, q(n.value, (d, y) => (r(), i("div", {
865
+ key: d.name || y,
866
+ class: $(["xp-tabs__item", [
867
+ {
868
+ "xp-tabs__item--active": s.value === d.name,
869
+ "xp-tabs__item--disabled": d.disabled
870
+ }
871
+ ]]),
872
+ role: "tab",
873
+ onClick: (x) => u(d)
874
+ }, k(d.title), 11, kt))), 128)),
875
+ c("div", {
876
+ class: "xp-tabs__active-bar",
877
+ style: C(o.value)
878
+ }, null, 4)
879
+ ]),
880
+ c("div", wt, [
881
+ b(m.$slots, "default", {}, void 0, !0)
882
+ ])
883
+ ]));
884
+ }
885
+ }, St = /* @__PURE__ */ v(Ct, [["__scopeId", "data-v-3e658dba"]]), Bt = {
886
+ __name: "Tag",
887
+ props: {
888
+ type: {
889
+ type: String,
890
+ default: "default",
891
+ validator: (e) => ["primary", "default", "success", "warning", "danger", "info"].includes(e)
892
+ },
893
+ size: {
894
+ type: String,
895
+ default: "medium",
896
+ validator: (e) => ["small", "medium", "large"].includes(e)
897
+ },
898
+ color: {
899
+ type: String,
900
+ default: ""
901
+ },
902
+ plain: {
903
+ type: Boolean,
904
+ default: !1
905
+ },
906
+ round: {
907
+ type: Boolean,
908
+ default: !1
909
+ },
910
+ closable: {
911
+ type: Boolean,
912
+ default: !1
913
+ }
914
+ },
915
+ emits: ["click", "close"],
916
+ setup(e, { emit: t }) {
917
+ const a = e, l = t, n = w(() => a.color ? a.color.startsWith("#") || a.color.startsWith("rgb") ? {
918
+ backgroundColor: a.color,
919
+ borderColor: a.color,
920
+ color: "#fff"
921
+ } : {} : {}), s = (u) => {
922
+ l("click", u);
923
+ }, o = (u) => {
924
+ l("close", u);
925
+ };
926
+ return (u, f) => (r(), i("span", {
927
+ class: $(["xp-tag", [
928
+ `xp-tag--${e.type}`,
929
+ `xp-tag--${e.size}`,
930
+ {
931
+ "xp-tag--plain": e.plain,
932
+ "xp-tag--round": e.round,
933
+ "xp-tag--closable": e.closable
934
+ }
935
+ ]]),
936
+ style: C(n.value),
937
+ onClick: s
938
+ }, [
939
+ b(u.$slots, "default", {}, void 0, !0),
940
+ e.closable ? (r(), i("span", {
941
+ key: 0,
942
+ class: "xp-tag__close",
943
+ onClick: K(o, ["stop"])
944
+ }, "×")) : g("", !0)
945
+ ], 6));
946
+ }
947
+ }, Vt = /* @__PURE__ */ v(Bt, [["__scopeId", "data-v-903813de"]]), Tt = { class: "xp-tooltip__content" }, It = {
948
+ __name: "Tooltip",
949
+ props: {
950
+ content: {
951
+ type: String,
952
+ default: ""
953
+ },
954
+ placement: {
955
+ type: String,
956
+ default: "top",
957
+ validator: (e) => ["top", "bottom", "left", "right"].includes(e)
958
+ },
959
+ trigger: {
960
+ type: String,
961
+ default: "hover",
962
+ validator: (e) => ["hover", "click", "manual"].includes(e)
963
+ },
964
+ disabled: {
965
+ type: Boolean,
966
+ default: !1
967
+ }
968
+ },
969
+ setup(e) {
970
+ const t = e, a = _(!1), l = _({}), n = _(null), s = _(null);
971
+ let o = null;
972
+ const u = () => {
973
+ Z(() => {
974
+ if (!n.value || !s.value) return;
975
+ const h = n.value.getBoundingClientRect(), d = s.value.getBoundingClientRect();
976
+ let y = 0, x = 0;
977
+ switch (t.placement) {
978
+ case "top":
979
+ y = h.top - d.height - 8, x = h.left + h.width / 2 - d.width / 2;
980
+ break;
981
+ case "bottom":
982
+ y = h.bottom + 8, x = h.left + h.width / 2 - d.width / 2;
983
+ break;
984
+ case "left":
985
+ y = h.top + h.height / 2 - d.height / 2, x = h.left - d.width - 8;
986
+ break;
987
+ case "right":
988
+ y = h.top + h.height / 2 - d.height / 2, x = h.right + 8;
989
+ break;
990
+ }
991
+ l.value = {
992
+ top: `${y + window.scrollY}px`,
993
+ left: `${x + window.scrollX}px`
994
+ };
995
+ });
996
+ }, f = () => {
997
+ t.disabled || (clearTimeout(o), o = setTimeout(() => {
998
+ a.value = !0, u();
999
+ }, 100));
1000
+ }, p = () => {
1001
+ clearTimeout(o), o = setTimeout(() => {
1002
+ a.value = !1;
1003
+ }, 150);
1004
+ }, m = () => {
1005
+ t.trigger !== "click" || t.disabled || (a.value = !a.value, a.value && u());
1006
+ };
1007
+ return J(() => {
1008
+ clearTimeout(o);
1009
+ }), (h, d) => (r(), i("div", {
1010
+ class: "xp-tooltip",
1011
+ ref_key: "tooltipRef",
1012
+ ref: n
1013
+ }, [
1014
+ c("div", {
1015
+ class: "xp-tooltip__trigger",
1016
+ onMouseenter: f,
1017
+ onMouseleave: p,
1018
+ onClick: m
1019
+ }, [
1020
+ b(h.$slots, "default", {}, void 0, !0)
1021
+ ], 32),
1022
+ (r(), z(L, { to: "body" }, [
1023
+ B(N, { name: "xp-tooltip-fade" }, {
1024
+ default: S(() => [
1025
+ a.value ? (r(), i("div", {
1026
+ key: 0,
1027
+ class: $(["xp-tooltip__popper", [`xp-tooltip__popper--${e.placement}`]]),
1028
+ style: C(l.value),
1029
+ ref_key: "popperRef",
1030
+ ref: s
1031
+ }, [
1032
+ c("div", Tt, [
1033
+ b(h.$slots, "content", {}, () => [
1034
+ X(k(e.content), 1)
1035
+ ], !0)
1036
+ ]),
1037
+ d[0] || (d[0] = c("div", { class: "xp-tooltip__arrow" }, null, -1))
1038
+ ], 6)) : g("", !0)
1039
+ ]),
1040
+ _: 3
1041
+ })
1042
+ ]))
1043
+ ], 512));
1044
+ }
1045
+ }, Rt = /* @__PURE__ */ v(It, [["__scopeId", "data-v-6d9af40b"]]), Mt = /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/, Nt = /^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*([\d.]+))?\s*\)$/;
1046
+ function E(e) {
1047
+ if (typeof e != "string") return null;
1048
+ const t = e.trim(), a = t.match(Mt);
1049
+ if (a) {
1050
+ let n = a[1];
1051
+ n.length === 3 && (n = n.split("").map((f) => f + f).join(""));
1052
+ const s = parseInt(n.slice(0, 2), 16), o = parseInt(n.slice(2, 4), 16), u = parseInt(n.slice(4, 6), 16);
1053
+ return { r: s, g: o, b: u, a: 1 };
1054
+ }
1055
+ const l = t.match(Nt);
1056
+ return l ? {
1057
+ r: parseInt(l[1], 10),
1058
+ g: parseInt(l[2], 10),
1059
+ b: parseInt(l[3], 10),
1060
+ a: l[4] ? parseFloat(l[4]) : 1
1061
+ } : null;
1062
+ }
1063
+ function Xt(e) {
1064
+ return Math.max(0, Math.min(255, Math.round(e)));
1065
+ }
1066
+ function At(e, t, a) {
1067
+ const l = (n) => Xt(n).toString(16).padStart(2, "0");
1068
+ return "#" + l(e) + l(t) + l(a);
1069
+ }
1070
+ function ee(e, t, a = 0.5) {
1071
+ const l = E(e), n = E(t);
1072
+ if (!l || !n) return "#000000";
1073
+ const s = Math.max(0, Math.min(1, a)), o = l.r * (1 - s) + n.r * s, u = l.g * (1 - s) + n.g * s, f = l.b * (1 - s) + n.b * s;
1074
+ return At(o, u, f);
1075
+ }
1076
+ function j(e, t) {
1077
+ return ee(e, "#ffffff", t);
1078
+ }
1079
+ function D(e, t) {
1080
+ return ee(e, "#000000", t);
1081
+ }
1082
+ function Wt(e) {
1083
+ return j(e, 0.3);
1084
+ }
1085
+ function qt(e) {
1086
+ return D(e, 0.2);
1087
+ }
1088
+ function Ht(e, t) {
1089
+ const a = E(e);
1090
+ if (!a) return e;
1091
+ const l = Math.max(0, Math.min(1, t));
1092
+ return `rgba(${a.r}, ${a.g}, ${a.b}, ${l})`;
1093
+ }
1094
+ function Ut(e) {
1095
+ const t = E(e);
1096
+ return t ? (t.r * 299 + t.g * 587 + t.b * 114) / 1e3 < 128 : !1;
1097
+ }
1098
+ function te(e, t) {
1099
+ const a = j(e, 0.3), l = D(e, 0.2), n = t === "dark" ? D(e, 0.85) : j(e, 0.9), s = t === "dark" ? D(e, 0.7) : j(e, 0.7);
1100
+ return { base: e, light: a, dark: l, bg: n, border: s };
1101
+ }
1102
+ const V = {
1103
+ primary: "#409eff",
1104
+ success: "#67c23a",
1105
+ warning: "#e6a23c",
1106
+ danger: "#f56c6c",
1107
+ info: "#909399"
1108
+ }, A = {
1109
+ light: {
1110
+ text: { primary: "#303133", regular: "#606266", secondary: "#909399", placeholder: "#c0c4cc" },
1111
+ border: { base: "#dcdfe6", light: "#ebeef5", lighter: "#f2f6fc" },
1112
+ bg: { base: "#ffffff", page: "#f2f3f5", soft: "#f5f7fa", overlay: "rgba(0, 0, 0, 0.5)" },
1113
+ fill: { base: "#f0f2f5", light: "#f5f7fa", lighter: "#fafafa" },
1114
+ shadow: {
1115
+ sm: "0 1px 2px 0 rgba(0, 0, 0, 0.05)",
1116
+ md: "0 2px 12px 0 rgba(0, 0, 0, 0.1)",
1117
+ lg: "0 4px 20px 0 rgba(0, 0, 0, 0.15)",
1118
+ overlay: "0 8px 24px 0 rgba(0, 0, 0, 0.2)"
1119
+ }
1120
+ },
1121
+ dark: {
1122
+ text: { primary: "#e5eaf3", regular: "#cfd3dc", secondary: "#a3a6ad", placeholder: "#8d9095" },
1123
+ border: { base: "#4c4d4f", light: "#414243", lighter: "#363637" },
1124
+ bg: { base: "#1d1e1f", page: "#141414", soft: "#2a2b2c", overlay: "rgba(0, 0, 0, 0.7)" },
1125
+ fill: { base: "#303030", light: "#262727", lighter: "#1d1d1d" },
1126
+ shadow: {
1127
+ sm: "0 1px 2px 0 rgba(0, 0, 0, 0.4)",
1128
+ md: "0 2px 12px 0 rgba(0, 0, 0, 0.45)",
1129
+ lg: "0 4px 20px 0 rgba(0, 0, 0, 0.5)",
1130
+ overlay: "0 8px 24px 0 rgba(0, 0, 0, 0.6)"
1131
+ }
1132
+ }
1133
+ };
1134
+ function T() {
1135
+ return {
1136
+ primary: { ...V },
1137
+ light: U(A.light),
1138
+ dark: U(A.dark)
1139
+ };
1140
+ }
1141
+ function U(e) {
1142
+ return JSON.parse(JSON.stringify(e));
1143
+ }
1144
+ function Y(e, t) {
1145
+ const a = ["primary", "success", "warning", "danger", "info"], l = [];
1146
+ for (const n of a) {
1147
+ const s = e[n] || V[n], o = te(s, t);
1148
+ l.push(` --xp-color-${n}: ${s};`), l.push(` --xp-color-${n}-light: ${o.light};`), l.push(` --xp-color-${n}-dark: ${o.dark};`), l.push(` --xp-color-${n}-bg: ${o.bg};`), l.push(` --xp-color-${n}-border: ${o.border};`);
1149
+ }
1150
+ return l.join(`
1151
+ `);
1152
+ }
1153
+ function G(e) {
1154
+ const t = [];
1155
+ for (const a of Object.keys(e.text)) t.push(` --xp-text-color-${a}: ${e.text[a]};`);
1156
+ t.push(` --xp-border-color: ${e.border.base};`), t.push(` --xp-border-color-light: ${e.border.light};`), t.push(` --xp-border-color-lighter: ${e.border.lighter};`);
1157
+ for (const a of Object.keys(e.bg)) {
1158
+ const l = a === "base" ? "" : `-${a}`;
1159
+ t.push(` --xp-bg-color${l}: ${e.bg[a]};`);
1160
+ }
1161
+ for (const a of Object.keys(e.fill)) {
1162
+ const l = a === "base" ? "" : `-${a}`;
1163
+ t.push(` --xp-fill-color${l}: ${e.fill[a]};`);
1164
+ }
1165
+ for (const a of Object.keys(e.shadow)) t.push(` --xp-shadow-${a}: ${e.shadow[a]};`);
1166
+ return t.join(`
1167
+ `);
1168
+ }
1169
+ function Ot(e, t) {
1170
+ const a = {}, l = e.primary || V, n = ["primary", "success", "warning", "danger", "info"];
1171
+ for (const o of n) {
1172
+ const u = l[o] || V[o], f = te(u, t);
1173
+ a[`--xp-color-${o}`] = u, a[`--xp-color-${o}-light`] = f.light, a[`--xp-color-${o}-dark`] = f.dark, a[`--xp-color-${o}-bg`] = f.bg, a[`--xp-color-${o}-border`] = f.border;
1174
+ }
1175
+ const s = e[t] || A[t];
1176
+ for (const o of Object.keys(s.text)) a[`--xp-text-color-${o}`] = s.text[o];
1177
+ a["--xp-border-color"] = s.border.base, a["--xp-border-color-light"] = s.border.light, a["--xp-border-color-lighter"] = s.border.lighter;
1178
+ for (const o of Object.keys(s.bg)) a[`--xp-bg-color${o === "base" ? "" : "-" + o}`] = s.bg[o];
1179
+ for (const o of Object.keys(s.fill)) a[`--xp-fill-color${o === "base" ? "" : "-" + o}`] = s.fill[o];
1180
+ for (const o of Object.keys(s.shadow)) a[`--xp-shadow-${o}`] = s.shadow[o];
1181
+ return a;
1182
+ }
1183
+ function ae(e) {
1184
+ return [
1185
+ ':root, [data-theme="light"] {',
1186
+ Y(e.primary || V, "light"),
1187
+ G(e.light || A.light),
1188
+ "}",
1189
+ "",
1190
+ '[data-theme="dark"] {',
1191
+ Y(e.primary || V, "dark"),
1192
+ G(e.dark || A.dark),
1193
+ "}"
1194
+ ].join(`
1195
+ `);
1196
+ }
1197
+ let O = null;
1198
+ function jt() {
1199
+ if (typeof document > "u") return null;
1200
+ if (O && document.contains(O)) return O;
1201
+ let e = document.querySelector("style[data-xp-ui-theme]");
1202
+ return e || (e = document.createElement("style"), e.setAttribute("data-xp-ui-theme", "true"), document.head.appendChild(e)), O = e, e;
1203
+ }
1204
+ function Dt(e) {
1205
+ const t = jt();
1206
+ t && (t.textContent = ae(e));
1207
+ }
1208
+ const H = _("light"), le = _(T());
1209
+ function R(e) {
1210
+ if (["light", "dark"].includes(e) && (H.value = e, typeof document < "u")) {
1211
+ document.documentElement.setAttribute("data-theme", e);
1212
+ try {
1213
+ localStorage.setItem("xp-ui-theme", e);
1214
+ } catch {
1215
+ }
1216
+ }
1217
+ }
1218
+ function Et() {
1219
+ R(H.value === "light" ? "dark" : "light");
1220
+ }
1221
+ function M(e) {
1222
+ if (!e) return;
1223
+ const t = T();
1224
+ e.primary && (t.primary = { ...t.primary, ...e.primary }), e.light && (t.light = P(t.light, e.light)), e.dark && (t.dark = P(t.dark, e.dark)), le.value = t, Dt(t);
1225
+ try {
1226
+ localStorage.setItem("xp-ui-theme-config", JSON.stringify(t));
1227
+ } catch {
1228
+ }
1229
+ }
1230
+ function zt() {
1231
+ M(T());
1232
+ }
1233
+ function Ft() {
1234
+ if (typeof document > "u") return;
1235
+ let e = null;
1236
+ try {
1237
+ e = localStorage.getItem("xp-ui-theme");
1238
+ } catch {
1239
+ }
1240
+ e === "light" || e === "dark" ? R(e) : typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? R("dark") : R("light");
1241
+ let t = null;
1242
+ try {
1243
+ t = localStorage.getItem("xp-ui-theme-config");
1244
+ } catch {
1245
+ }
1246
+ if (t)
1247
+ try {
1248
+ M(JSON.parse(t));
1249
+ } catch {
1250
+ M(T());
1251
+ }
1252
+ else
1253
+ M(T());
1254
+ }
1255
+ function P(e, t) {
1256
+ if (!t || typeof t != "object") return e;
1257
+ const a = Array.isArray(e) ? [...e] : { ...e };
1258
+ for (const l of Object.keys(t))
1259
+ t[l] && typeof t[l] == "object" && !Array.isArray(t[l]) ? a[l] = P(e[l] || {}, t[l]) : a[l] = t[l];
1260
+ return a;
1261
+ }
1262
+ function Yt() {
1263
+ return {
1264
+ theme: H,
1265
+ themeConfig: le,
1266
+ setTheme: R,
1267
+ toggleTheme: Et,
1268
+ initTheme: Ft,
1269
+ applyThemeConfig: M,
1270
+ resetThemeConfig: zt,
1271
+ getDefaultThemeConfig: T,
1272
+ buildCssString: ae,
1273
+ buildCssVars: Ot
1274
+ };
1275
+ }
1276
+ const ne = {
1277
+ XpAlert: pe,
1278
+ XpAvatar: be,
1279
+ XpBadge: ye,
1280
+ XpButton: F,
1281
+ XpCard: Re,
1282
+ XpCheckbox: Oe,
1283
+ XpDialog: Pe,
1284
+ XpDropdown: He,
1285
+ XpInput: Qe,
1286
+ XpProgress: at,
1287
+ XpRadio: rt,
1288
+ XpRate: ft,
1289
+ XpSwitch: bt,
1290
+ XpTabPane: yt,
1291
+ XpTabs: St,
1292
+ XpTag: Vt,
1293
+ XpTooltip: Rt
1294
+ }, Pt = (e) => {
1295
+ Object.entries(ne).forEach(([t, a]) => {
1296
+ e.component(t, a);
1297
+ });
1298
+ }, Gt = {
1299
+ install: Pt,
1300
+ ...ne
1301
+ };
1302
+ export {
1303
+ V as DEFAULT_PRIMARY,
1304
+ A as DEFAULT_TOKENS,
1305
+ pe as XpAlert,
1306
+ be as XpAvatar,
1307
+ ye as XpBadge,
1308
+ F as XpButton,
1309
+ Re as XpCard,
1310
+ Oe as XpCheckbox,
1311
+ Pe as XpDialog,
1312
+ He as XpDropdown,
1313
+ Qe as XpInput,
1314
+ at as XpProgress,
1315
+ rt as XpRadio,
1316
+ ft as XpRate,
1317
+ bt as XpSwitch,
1318
+ yt as XpTabPane,
1319
+ St as XpTabs,
1320
+ Vt as XpTag,
1321
+ Rt as XpTooltip,
1322
+ M as applyThemeConfig,
1323
+ ae as buildCssString,
1324
+ Ot as buildCssVars,
1325
+ D as darken,
1326
+ Gt as default,
1327
+ qt as deriveDark,
1328
+ Wt as deriveLight,
1329
+ T as getDefaultThemeConfig,
1330
+ Ft as initTheme,
1331
+ Pt as install,
1332
+ Ut as isDark,
1333
+ j as lighten,
1334
+ ee as mix,
1335
+ E as parseColor,
1336
+ zt as resetThemeConfig,
1337
+ R as setTheme,
1338
+ At as toHex,
1339
+ Et as toggleTheme,
1340
+ Yt as useTheme,
1341
+ Ht as withAlpha
1342
+ };