@schwarzdavid/ui-kit 0.0.1-alpha.16 → 0.0.1-alpha.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -1,869 +1,1394 @@
1
- import { getCurrentInstance as ge, inject as ye, readonly as Z, markRaw as oe, defineComponent as k, createElementBlock as U, openBlock as m, Fragment as M, renderList as J, unref as l, createBlock as p, resolveDynamicComponent as F, mergeProps as $, ref as E, computed as y, onMounted as Ce, createSlots as Te, withCtx as d, toDisplayString as G, createVNode as s, TransitionGroup as we, normalizeClass as le, isRef as xe, createTextVNode as te, createElementVNode as N, createCommentVNode as S, normalizeProps as re, toValue as ne, useTemplateRef as De } from "vue";
2
- import { VAlert as Ve, VIcon as Ie, VOverlay as Ae, VProgressCircular as Re, VDialog as K, VCard as z, VCardTitle as ue, VBtn as A, VCardText as se, VCardActions as q, VToolbar as ce, VToolbarTitle as ie, VSpacer as B, VDivider as de, VDefaultsProvider as he } from "vuetify/components";
3
- import { useI18n as me } from "vue-i18n";
4
- import { useDisplay as fe } from "vuetify";
5
- import { merge as Q } from "lodash";
6
- import Ee from "@vuelidate/core";
7
- const g = [];
8
- for (let e = 0; e < 256; ++e)
9
- g.push((e + 256).toString(16).slice(1));
10
- function be(e, a = 0) {
11
- return (g[e[a + 0]] + g[e[a + 1]] + g[e[a + 2]] + g[e[a + 3]] + "-" + g[e[a + 4]] + g[e[a + 5]] + "-" + g[e[a + 6]] + g[e[a + 7]] + "-" + g[e[a + 8]] + g[e[a + 9]] + "-" + g[e[a + 10]] + g[e[a + 11]] + g[e[a + 12]] + g[e[a + 13]] + g[e[a + 14]] + g[e[a + 15]]).toLowerCase();
1
+ import { Fragment as e, Teleport as t, TransitionGroup as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createSlots as c, createVNode as l, defineComponent as u, hasInjectionContext as d, inject as f, isRef as p, markRaw as m, mergeProps as h, nextTick as g, normalizeClass as _, normalizeProps as v, normalizeStyle as y, onBeforeUnmount as b, onBeforeUpdate as x, onMounted as S, onScopeDispose as C, openBlock as w, provide as T, readonly as E, ref as D, renderList as O, renderSlot as k, resolveDynamicComponent as A, shallowReadonly as j, shallowRef as M, toDisplayString as N, toValue as ee, unref as P, useAttrs as te, useSlots as ne, useTemplateRef as F, vShow as re, watch as I, watchEffect as ie, withCtx as L, withDirectives as ae, withKeys as oe, withModifiers as se } from "vue";
2
+ import { useDisplay as ce } from "vuetify";
3
+ import { useI18n as le } from "vue-i18n";
4
+ import { VAlert as ue, VBottomSheet as de, VBtn as R, VCard as fe, VDialog as z, VIcon as pe, VOverlay as me, VProgressCircular as he } from "vuetify/components";
5
+ import { merge as B } from "lodash-es";
6
+ import ge from "@vuelidate/core";
7
+ //#region lib/internal/createId.ts
8
+ function _e(e) {
9
+ let t = Array.from(e, (e) => e.toString(16).padStart(2, "0")).join("");
10
+ return `${t.slice(0, 8)}-${t.slice(8, 12)}-${t.slice(12, 16)}-${t.slice(16, 20)}-${t.slice(20)}`;
12
11
  }
13
- let Y;
14
- const ke = new Uint8Array(16);
15
- function Oe() {
16
- if (!Y) {
17
- if (typeof crypto > "u" || !crypto.getRandomValues)
18
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
19
- Y = crypto.getRandomValues.bind(crypto);
20
- }
21
- return Y(ke);
12
+ function V() {
13
+ let e = globalThis.crypto;
14
+ if (e.randomUUID) return e.randomUUID();
15
+ let t = globalThis.crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16));
16
+ return t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128, _e(t);
22
17
  }
23
- const Ue = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ae = { randomUUID: Ue };
24
- function ve(e, a, t) {
25
- var o;
26
- if (ae.randomUUID && !e)
27
- return ae.randomUUID();
28
- e = e || {};
29
- const r = e.random ?? ((o = e.rng) == null ? void 0 : o.call(e)) ?? Oe();
30
- if (r.length < 16)
31
- throw new Error("Random bytes length must be >= 16");
32
- return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, be(r);
18
+ //#endregion
19
+ //#region lib/plugin/constants/errors.ts
20
+ var H = {
21
+ NOT_INSTALLED: "@schwarzdavid/ui-kit is not available in this context. Install it with app.use(createUIKit()) and call its composables inside setup() or app.runWithContext().",
22
+ DIALOG_ENTRY_CONTEXT_MISSING: "useDialogEntry() must be called inside a dialog preset rendered by UiKitOutlet.",
23
+ DIALOG_FORM_CONTEXT_MISSING: "useDialogForm() must be called inside a component rendered by the form dialog preset.",
24
+ TOAST_ENTRY_CONTEXT_MISSING: "useToastEntry() must be called inside a toast component rendered by UiKitOutlet."
25
+ }, U = Symbol("@schwarzdavid/ui-kit");
26
+ //#endregion
27
+ //#region lib/plugin/composables/usePluginContext.ts
28
+ function W() {
29
+ let e = d() ? f(U, null) : null;
30
+ if (!e) throw Error(H.NOT_INSTALLED);
31
+ return e;
33
32
  }
34
- var X = /* @__PURE__ */ ((e) => (e.NOT_INSTALLED = "Need to install with `app.use` function", e.UNEXPECTED_ERROR = "Unexpected error", e))(X || {});
35
- function j() {
36
- const e = ge();
37
- if (!(e != null && e.appContext.app.__SCHWARZDAVID_UIKIT_SYMBOL__))
38
- throw new Error(X.NOT_INSTALLED);
39
- const a = e.appContext.app.__SCHWARZDAVID_UIKIT_SYMBOL__, t = ye(a);
40
- if (!t)
41
- throw new Error(X.UNEXPECTED_ERROR);
42
- return t;
33
+ //#endregion
34
+ //#region lib/composables/dialog/internal/useDialogQueue.ts
35
+ function G() {
36
+ let { dialogQueue: e } = W();
37
+ function t(t) {
38
+ let r = V(), i = (e) => {
39
+ n(r), t.resolve(e);
40
+ }, a = (e) => {
41
+ n(r), t.reject(e);
42
+ }, o = m({
43
+ ...t,
44
+ id: r,
45
+ resolve: i,
46
+ reject: a
47
+ });
48
+ return e.value.push(o), o;
49
+ }
50
+ function n(t) {
51
+ let n = typeof t == "string" ? t : t.id, r = e.value.findIndex((e) => e.id === n);
52
+ r >= 0 && e.value.splice(r, 1);
53
+ }
54
+ return {
55
+ queue: j(e),
56
+ addToQueue: t,
57
+ removeFromQueue: n
58
+ };
43
59
  }
44
- function pe() {
45
- const { dialogQueue: e } = j();
46
- function a() {
47
- let o;
48
- for (; ; )
49
- if (o = ve(), !e.value.some((u) => u.id === o))
50
- return o;
51
- }
52
- function t(o) {
53
- const u = a(), i = oe({ ...o, id: u, resolve: (f) => {
54
- r(u), o.resolve(f);
55
- }, reject: (f) => {
56
- r(u), o.reject(f);
57
- } });
58
- return e.value.push(i), i;
59
- }
60
- function r(o) {
61
- const u = typeof o == "string" ? o : o.id, c = e.value.findIndex((n) => n.id === u);
62
- c >= 0 && e.value.splice(c, 1);
63
- }
64
- return {
65
- queue: Z(e),
66
- addToQueue: t,
67
- removeFromQueue: r
68
- };
60
+ //#endregion
61
+ //#region lib/composables/dialog/constants/injectionKeys.ts
62
+ var K = Symbol("@schwarzdavid/ui-kit:dialog-entry"), ve = Symbol("@schwarzdavid/ui-kit:dialog-form"), q = /* @__PURE__ */ u({
63
+ __name: "DialogEntryProvider",
64
+ props: { entry: {} },
65
+ setup(e) {
66
+ let t = e;
67
+ return T(K, {
68
+ id: t.entry.id,
69
+ data: t.entry.data,
70
+ resolve: t.entry.resolve,
71
+ reject: t.entry.reject
72
+ }), (t, n) => (w(), i(A(e.entry.component)));
73
+ }
74
+ }), ye = /* @__PURE__ */ u({
75
+ __name: "DialogOutlet",
76
+ setup(t) {
77
+ let { queue: n } = G();
78
+ return (t, r) => (w(!0), o(e, null, O(P(n), (e) => (w(), i(q, {
79
+ key: e.id,
80
+ entry: e
81
+ }, null, 8, ["entry"]))), 128));
82
+ }
83
+ });
84
+ //#endregion
85
+ //#region lib/composables/internal/useMaybeTranslation.ts
86
+ function J() {
87
+ let e = le({ useScope: "global" }), t = (t) => e.availableLocales.some((n) => e.te(t, n));
88
+ return (n, r = !0) => r && t(n) ? e.t(n) : n;
89
+ }
90
+ //#endregion
91
+ //#region lib/components/internal/MaybeTranslation.vue
92
+ var Y = /* @__PURE__ */ u({
93
+ __name: "MaybeTranslation",
94
+ props: {
95
+ content: {},
96
+ translate: {
97
+ type: Boolean,
98
+ default: !0
99
+ }
100
+ },
101
+ setup(e) {
102
+ let t = e, n = J(), i = r(() => n(t.content, t.translate));
103
+ return (e, t) => N(i.value);
104
+ }
105
+ });
106
+ //#endregion
107
+ //#region lib/composables/toast/internal/useToastQueue.ts
108
+ function X() {
109
+ let { toastQueue: e, toastTimers: t } = W();
110
+ function n(t) {
111
+ return e.value.find((e) => e.id === t);
112
+ }
113
+ function r(e, t) {
114
+ t.startedAt = Date.now(), t.handle = setTimeout(() => {
115
+ o(e);
116
+ }, t.remaining);
117
+ }
118
+ function i(e) {
119
+ let n = t.get(e);
120
+ n !== void 0 && (clearTimeout(n.handle), t.delete(e));
121
+ }
122
+ function a(t) {
123
+ let n = typeof t == "string" ? t : t.id;
124
+ i(n);
125
+ let r = e.value.findIndex((e) => e.id === n);
126
+ r >= 0 && e.value.splice(r, 1);
127
+ }
128
+ function o(e) {
129
+ let t = n(e);
130
+ t && (a(e), t.resolve(!1));
131
+ }
132
+ function s(e) {
133
+ let t = n(e);
134
+ t && (a(e), t.resolve(!0), t.action?.handler?.());
135
+ }
136
+ function c(e, n) {
137
+ let r = t.get(e);
138
+ r && (r.handle !== void 0 && (clearTimeout(r.handle), r.handle = void 0, r.remaining = Math.max(0, r.remaining - (Date.now() - r.startedAt))), r.holds.add(n));
139
+ }
140
+ function l(e, n) {
141
+ let i = t.get(e);
142
+ !i?.holds.delete(n) || i.holds.size > 0 || r(e, i);
143
+ }
144
+ function u(n) {
145
+ let i = V(), a = m({
146
+ ...n,
147
+ id: i
148
+ });
149
+ if (e.value.push(a), typeof n.timeout == "number" && n.timeout > 0) {
150
+ let e = {
151
+ remaining: n.timeout,
152
+ startedAt: 0,
153
+ handle: void 0,
154
+ holds: /* @__PURE__ */ new Set()
155
+ };
156
+ t.set(i, e), r(i, e);
157
+ }
158
+ return a;
159
+ }
160
+ return {
161
+ queue: j(e),
162
+ addToQueue: u,
163
+ removeFromQueue: a,
164
+ close: o,
165
+ trigger: s,
166
+ pause: c,
167
+ resume: l
168
+ };
169
+ }
170
+ //#endregion
171
+ //#region lib/composables/toast/constants/injectionKey.ts
172
+ var be = Symbol("@schwarzdavid/ui-kit:toast-entry"), xe = /* @__PURE__ */ u({
173
+ __name: "ToastEntryProvider",
174
+ props: { entry: {} },
175
+ setup(e) {
176
+ let t = e, { options: n } = W(), { close: a, trigger: o, pause: s, resume: c } = X(), l = r(() => n.components.toast);
177
+ function u(e) {
178
+ let n = e.currentTarget;
179
+ n instanceof Node && e.relatedTarget instanceof Node && n.contains(e.relatedTarget) || c(t.entry.id, "focus");
180
+ }
181
+ return T(be, {
182
+ entry: t.entry,
183
+ close: () => {
184
+ a(t.entry.id);
185
+ },
186
+ trigger: () => {
187
+ o(t.entry.id);
188
+ }
189
+ }), (t, n) => (w(), i(A(l.value), {
190
+ onMouseenter: n[0] ||= (t) => P(s)(e.entry.id, "hover"),
191
+ onMouseleave: n[1] ||= (t) => P(c)(e.entry.id, "hover"),
192
+ onFocusin: n[2] ||= (t) => P(s)(e.entry.id, "focus"),
193
+ onFocusout: u
194
+ }, null, 32));
195
+ }
196
+ }), Z = /* @__PURE__ */ function(e) {
197
+ return e.SUCCESS = "success", e.INFO = "info", e.WARNING = "warning", e.ERROR = "error", e;
198
+ }({}), Se = {
199
+ class: "ui-toast-outlet__announcer",
200
+ "aria-live": "polite",
201
+ "aria-atomic": "true"
202
+ }, Ce = /* @__PURE__ */ u({
203
+ __name: "ToastOutlet",
204
+ setup(t) {
205
+ let { queue: r, pause: c, resume: u } = X(), { xs: d } = ce(), f = M(null), p = /* @__PURE__ */ new WeakSet();
206
+ I(() => r.value.at(-1), (e) => {
207
+ e && e.type !== Z.ERROR && !p.has(e) && (p.add(e), f.value = null, g(() => {
208
+ f.value = e;
209
+ }));
210
+ });
211
+ let m = M(!1);
212
+ function h() {
213
+ m.value = document.visibilityState === "hidden";
214
+ }
215
+ S(() => {
216
+ h(), document.addEventListener("visibilitychange", h);
217
+ }), b(() => {
218
+ document.removeEventListener("visibilitychange", h);
219
+ }), ie(() => {
220
+ for (let e of r.value) m.value ? c(e.id, "hidden") : u(e.id, "hidden");
221
+ });
222
+ function v(e) {
223
+ if (e instanceof HTMLElement) {
224
+ let { width: t } = e.getBoundingClientRect();
225
+ e.style.width = `${t.toFixed()}px`;
226
+ }
227
+ }
228
+ return (t, c) => (w(), o(e, null, [s("div", Se, [f.value ? (w(), i(Y, {
229
+ key: 0,
230
+ content: f.value.message,
231
+ translate: f.value.translateMessage
232
+ }, null, 8, ["content", "translate"])) : a("", !0)]), l(n, {
233
+ name: "ui-toast",
234
+ tag: "div",
235
+ class: _(["ui-toast-outlet", { "ui-toast-outlet--mobile": P(d) }]),
236
+ onBeforeLeave: v
237
+ }, {
238
+ default: L(() => [(w(!0), o(e, null, O(P(r), (e) => (w(), i(xe, {
239
+ key: e.id,
240
+ entry: e
241
+ }, null, 8, ["entry"]))), 128))]),
242
+ _: 1
243
+ }, 8, ["class"])], 64));
244
+ }
245
+ });
246
+ //#endregion
247
+ //#region lib/composables/loading-overlay/useLoadingOverlay.ts
248
+ function we() {
249
+ return W().loadingOverlay;
69
250
  }
70
- const Le = /* @__PURE__ */ k({
71
- __name: "DialogOutlet",
72
- setup(e) {
73
- const { queue: a } = pe();
74
- return (t, r) => (m(!0), U(M, null, J(l(a), (o) => (m(), p(F(o.component), $({
75
- key: o.id,
76
- ref_for: !0
77
- }, o.props, {
78
- onResolve: o.resolve,
79
- onReject: o.reject
80
- }), null, 16, ["onResolve", "onReject"]))), 128));
81
- }
251
+ //#endregion
252
+ //#region lib/composables/loading-overlay/components/LoadingOverlay.vue
253
+ var Te = /* @__PURE__ */ u({
254
+ __name: "LoadingOverlay",
255
+ setup(e) {
256
+ let t = we();
257
+ return (e, n) => (w(), i(P(me), {
258
+ modelValue: P(t),
259
+ "onUpdate:modelValue": n[0] ||= (e) => p(t) ? t.value = e : null,
260
+ persistent: "",
261
+ class: "d-flex align-center justify-center"
262
+ }, {
263
+ default: L(() => [l(P(he), {
264
+ indeterminate: "",
265
+ color: "primary",
266
+ size: "100"
267
+ })]),
268
+ _: 1
269
+ }, 8, ["modelValue"]));
270
+ }
271
+ }), Ee = /* @__PURE__ */ u({
272
+ __name: "UiKitOutlet",
273
+ setup(t) {
274
+ return (t, n) => (w(), o(e, null, [
275
+ l(ye),
276
+ l(Ce),
277
+ l(Te)
278
+ ], 64));
279
+ }
82
280
  });
83
- function ee() {
84
- const { toastQueue: e } = j();
85
- function a() {
86
- let o;
87
- for (; ; )
88
- if (o = ve(), !e.value.some((u) => u.id === o))
89
- return o;
90
- }
91
- function t(o) {
92
- const u = a(), n = oe({ ...o, id: u, resolve: () => {
93
- r(u), o.resolve();
94
- } });
95
- return e.value.unshift(n), n;
96
- }
97
- function r(o) {
98
- const u = typeof o == "string" ? o : o.id, c = e.value.findIndex((n) => n.id === u);
99
- c >= 0 && e.value.splice(c, 1);
100
- }
101
- return {
102
- queue: Z(e),
103
- addToQueue: t,
104
- removeFromQueue: r
105
- };
281
+ //#endregion
282
+ //#region lib/components/sheet/internal/resolveSheetStages.ts
283
+ function De(e, t) {
284
+ return t ? [e ? "preview" : "content", "fullscreen"] : e ? ["preview", "content"] : ["content"];
106
285
  }
107
- var D = /* @__PURE__ */ ((e) => (e.SUCCESS = "success", e.INFO = "info", e.WARNING = "warning", e.ERROR = "error", e))(D || {});
108
- const Se = { key: 0 }, je = { key: 1 }, Me = /* @__PURE__ */ k({
109
- __name: "ToastEntry",
110
- props: {
111
- entry: {}
112
- },
113
- setup(e) {
114
- const a = {
115
- [D.ERROR]: "mdi-alert-circle-outline",
116
- [D.SUCCESS]: "mdi-check-circle-outline",
117
- [D.INFO]: "mdi-information-outline",
118
- [D.WARNING]: "mdi-alert-circle-outline"
119
- }, t = {
120
- [D.ERROR]: "error",
121
- [D.SUCCESS]: "success",
122
- [D.INFO]: "primary",
123
- [D.WARNING]: "warning"
124
- }, r = e, o = ee(), u = E(-1), c = y(() => a[r.entry.type]), n = y(() => t[r.entry.type]), { t: i } = me({ useScope: "global" });
125
- function f() {
126
- window.clearTimeout(u.value), o.removeFromQueue(r.entry.id);
127
- }
128
- return Ce(() => {
129
- u.value = window.setTimeout(() => {
130
- f();
131
- }, r.entry.timeout);
132
- }), (_, V) => (m(), p(l(Ve), {
133
- theme: "dark",
134
- class: "toast-entry",
135
- closable: "",
136
- "onClick:close": f,
137
- density: "compact"
138
- }, Te({
139
- default: d(() => [
140
- _.entry.translateMessage ? (m(), U("span", Se, G(l(i)(_.entry.message)), 1)) : (m(), U("span", je, G(_.entry.message), 1))
141
- ]),
142
- _: 2
143
- }, [
144
- c.value ? {
145
- name: "prepend",
146
- fn: d(() => [
147
- s(l(Ie), {
148
- icon: c.value,
149
- color: n.value
150
- }, null, 8, ["icon", "color"])
151
- ]),
152
- key: "0"
153
- } : void 0
154
- ]), 1024));
155
- }
156
- }), W = (e, a) => {
157
- const t = e.__vccOpts || e;
158
- for (const [r, o] of a)
159
- t[r] = o;
160
- return t;
161
- }, Pe = /* @__PURE__ */ W(Me, [["__scopeId", "data-v-7b5e0267"]]), Ne = /* @__PURE__ */ k({
162
- __name: "ToastOutlet",
163
- setup(e) {
164
- const { queue: a } = ee(), { mobile: t } = fe(), r = y(() => t.value ? "" : "toast-outlet--desktop");
165
- function o(u) {
166
- const { width: c } = u.getBoundingClientRect();
167
- u instanceof HTMLElement && (u.style.width = `${c.toFixed()}px`);
168
- }
169
- return (u, c) => (m(), p(we, {
170
- name: "fade",
171
- tag: "div",
172
- class: le(["toast-outlet", r.value]),
173
- onBeforeLeave: o
174
- }, {
175
- default: d(() => [
176
- (m(!0), U(M, null, J(l(a), (n) => (m(), p(Pe, {
177
- key: n.id,
178
- entry: n
179
- }, null, 8, ["entry"]))), 128))
180
- ]),
181
- _: 1
182
- }, 8, ["class"]));
183
- }
184
- }), Qe = /* @__PURE__ */ W(Ne, [["__scopeId", "data-v-ba5c8268"]]), Fe = E(!1);
185
- function _e() {
186
- return Fe;
286
+ //#endregion
287
+ //#region lib/components/sheet/internal/resolveSheetRelease.ts
288
+ var Oe = .5, ke = 1.5, Ae = .6;
289
+ function je(e) {
290
+ let { heights: t, current: n, delta: r, velocity: i, dismissible: a } = e, o = t.length - 1, s = t[n] - r;
291
+ if (a && (i > ke || s < t[0] * Ae)) return { type: "dismiss" };
292
+ if (i > Oe) return n === 0 ? a ? { type: "dismiss" } : {
293
+ type: "stage",
294
+ index: 0
295
+ } : {
296
+ type: "stage",
297
+ index: n - 1
298
+ };
299
+ if (i < -.5) return {
300
+ type: "stage",
301
+ index: Math.min(n + 1, o)
302
+ };
303
+ let c = 0;
304
+ for (let e = 1; e <= o; e++) Math.abs(t[e] - s) < Math.abs(t[c] - s) && (c = e);
305
+ return {
306
+ type: "stage",
307
+ index: c
308
+ };
187
309
  }
188
- const $e = /* @__PURE__ */ k({
189
- __name: "LoadingOverlay",
190
- setup(e) {
191
- const a = _e();
192
- return (t, r) => (m(), p(l(Ae), {
193
- modelValue: l(a),
194
- "onUpdate:modelValue": r[0] || (r[0] = (o) => xe(a) ? a.value = o : null),
195
- persistent: "",
196
- class: "d-flex align-center justify-center"
197
- }, {
198
- default: d(() => [
199
- s(l(Re), {
200
- indeterminate: "",
201
- color: "primary",
202
- size: "100"
203
- })
204
- ]),
205
- _: 1
206
- }, 8, ["modelValue"]));
207
- }
208
- }), dt = /* @__PURE__ */ k({
209
- __name: "UiKitOutlet",
210
- setup(e) {
211
- return (a, t) => (m(), U(M, null, [
212
- s(Le),
213
- s(Qe),
214
- s($e)
215
- ], 64));
216
- }
217
- }), C = /* @__PURE__ */ k({
218
- __name: "MaybeTranslation",
219
- props: {
220
- content: {},
221
- translate: { type: Boolean, default: !0 }
222
- },
223
- setup(e) {
224
- const { t: a } = me({ useScope: "global" });
225
- return (t, r) => t.translate ? (m(), U(M, { key: 0 }, [
226
- te(G(l(a)(t.content)), 1)
227
- ], 64)) : (m(), U(M, { key: 1 }, [
228
- te(G(t.content), 1)
229
- ], 64));
230
- }
231
- }), We = { class: "d-flex justify-space-between pr-2 py-2" }, Ge = 650, Be = /* @__PURE__ */ k({
232
- __name: "InfoDialog",
233
- props: {
234
- data: {}
235
- },
236
- emits: ["resolve", "reject"],
237
- setup(e, { emit: a }) {
238
- const t = e, r = a, { options: { i18n: { messages: { close: o } } } } = j(), u = {
239
- text: o,
240
- translateText: !0,
241
- value: null
242
- };
243
- let c = null;
244
- const n = E(!0), i = y(() => Object.hasOwn(t.data, "content") ? {
245
- content: t.data.content,
246
- translateContent: t.data.translateContent
247
- } : null), f = y(() => Object.hasOwn(t.data, "component") ? {
248
- component: t.data.component,
249
- props: t.data.props
250
- } : null), _ = y(() => t.data.defaultCta === !1 ? null : Q({}, u, t.data.defaultCta));
251
- function V(v) {
252
- R(v) ? v.action() : b(v.value);
253
- }
254
- function R(v) {
255
- return Object.hasOwn(v, "action");
256
- }
257
- function b(v = null) {
258
- c = v, n.value = !1;
259
- }
260
- function h() {
261
- r("resolve", c);
262
- }
263
- return (v, T) => (m(), p(l(K), {
264
- modelValue: n.value,
265
- "onUpdate:modelValue": T[1] || (T[1] = (w) => n.value = w),
266
- "max-width": v.data.width ?? Ge,
267
- onAfterLeave: h
268
- }, {
269
- default: d(() => [
270
- s(l(z), { class: "info-dialog-card" }, {
271
- default: d(() => [
272
- N("div", We, [
273
- s(l(ue), null, {
274
- default: d(() => [
275
- s(C, {
276
- translate: v.data.translateTitle,
277
- content: v.data.title
278
- }, null, 8, ["translate", "content"])
279
- ]),
280
- _: 1
281
- }),
282
- s(l(A), {
283
- icon: "$close",
284
- variant: "text",
285
- onClick: T[0] || (T[0] = (w) => b(null))
286
- })
287
- ]),
288
- i.value ? (m(), p(l(se), { key: 0 }, {
289
- default: d(() => [
290
- N("p", null, [
291
- s(C, {
292
- translate: i.value.translateContent,
293
- content: i.value.content
294
- }, null, 8, ["translate", "content"])
295
- ])
296
- ]),
297
- _: 1
298
- })) : S("", !0),
299
- f.value ? (m(), p(F(f.value.component), re($({ key: 1 }, f.value.props)), null, 16)) : S("", !0),
300
- s(l(q), { class: "justify-end" }, {
301
- default: d(() => [
302
- (m(!0), U(M, null, J(v.data.additionalCta ?? [], (w, I) => (m(), p(l(A), {
303
- key: I,
304
- color: "primary",
305
- variant: "text",
306
- onClick: () => V(w)
307
- }, {
308
- default: d(() => [
309
- s(C, {
310
- translate: w.translateText,
311
- content: w.text
312
- }, null, 8, ["translate", "content"])
313
- ]),
314
- _: 2
315
- }, 1032, ["onClick"]))), 128)),
316
- _.value ? (m(), p(l(A), {
317
- key: 0,
318
- color: "primary",
319
- variant: "elevated",
320
- onClick: b
321
- }, {
322
- default: d(() => [
323
- s(C, {
324
- translate: _.value.translateText,
325
- content: _.value.text
326
- }, null, 8, ["translate", "content"])
327
- ]),
328
- _: 1
329
- })) : S("", !0)
330
- ]),
331
- _: 1
332
- })
333
- ]),
334
- _: 1
335
- })
336
- ]),
337
- _: 1
338
- }, 8, ["modelValue", "max-width"]));
339
- }
340
- }), He = /* @__PURE__ */ W(Be, [["__scopeId", "data-v-0f8116ef"]]);
341
- var L = /* @__PURE__ */ ((e) => (e.SMALL = "sm", e.LARGE = "lg", e))(L || {});
342
- function H(e, a) {
343
- const r = {
344
- text: j().options.i18n.messages[a],
345
- translateText: !0
346
- };
347
- return Q(r, e);
310
+ //#endregion
311
+ //#region lib/components/sheet/internal/useSheetDrag.ts
312
+ var Me = 8, Ne = 100, Pe = "input, textarea, select, [contenteditable]";
313
+ function Fe(e) {
314
+ let t = D(!1), n = D(0), r = null, i = 0, a = 0, o = !1, s = [], c = null, l = !1;
315
+ function u(e) {
316
+ let t = performance.now();
317
+ s = s.filter((e) => t - e.time <= Ne), s.push({
318
+ y: e,
319
+ time: t
320
+ });
321
+ }
322
+ function d() {
323
+ let e = s[0], t = s[s.length - 1];
324
+ return e === t || t.time === e.time ? 0 : (t.y - e.y) / (t.time - e.time);
325
+ }
326
+ function f(e, t) {
327
+ return Math.abs(e) > Math.abs(t);
328
+ }
329
+ function p(e, t) {
330
+ return Math.max(Math.abs(e), Math.abs(t)) >= Me;
331
+ }
332
+ function m() {
333
+ window.removeEventListener("pointermove", v), window.removeEventListener("pointerup", y), window.removeEventListener("pointercancel", b);
334
+ }
335
+ function h() {
336
+ r !== null && m(), r = null, s = [], c = null, t.value = !1, n.value = 0;
337
+ }
338
+ function g(t) {
339
+ if (r !== null || t.button > 0) return;
340
+ l = !1;
341
+ let n = t.target;
342
+ n instanceof Element && n.closest(Pe) || (o = n instanceof Node && !!e.body.value?.contains(n), !(o && t.pointerType !== "touch" && t.pointerType !== "pen") && (r = t.pointerId, i = t.clientX, a = t.clientY, s = [], u(t.clientY), window.addEventListener("pointermove", v), window.addEventListener("pointerup", y), window.addEventListener("pointercancel", b)));
343
+ }
344
+ function _(t) {
345
+ return o ? t > 0 ? (e.body.value?.scrollTop ?? 0) === 0 : e.current.value < e.heights().length - 1 : !0;
346
+ }
347
+ function v(o) {
348
+ if (o.pointerId !== r) return;
349
+ let s = o.clientY - a;
350
+ if (!t.value) {
351
+ let n = o.clientX - i;
352
+ if (!p(n, s)) return;
353
+ if (f(n, s) || !_(s)) {
354
+ h();
355
+ return;
356
+ }
357
+ t.value = !0;
358
+ let r = e.surface.value;
359
+ r && typeof r.setPointerCapture == "function" && r.setPointerCapture(o.pointerId);
360
+ }
361
+ n.value = s, u(o.clientY);
362
+ }
363
+ function y(n) {
364
+ if (n.pointerId !== r) return;
365
+ if (!t.value) {
366
+ h();
367
+ return;
368
+ }
369
+ u(n.clientY);
370
+ let i = je({
371
+ heights: e.heights(),
372
+ current: e.current.value,
373
+ delta: n.clientY - a,
374
+ velocity: d(),
375
+ dismissible: e.dismissible.value
376
+ });
377
+ h(), l = !0, i.type === "dismiss" ? e.onDismiss() : e.current.value = i.index;
378
+ }
379
+ function b(e) {
380
+ e.pointerId === r && h();
381
+ }
382
+ function x(e) {
383
+ if (r !== null) {
384
+ if (!o) e.preventDefault();
385
+ else {
386
+ if (c === null) {
387
+ let t = e.touches[0], n = t.clientX - i, r = t.clientY - a;
388
+ if (!p(n, r)) return;
389
+ if (f(n, r)) {
390
+ h();
391
+ return;
392
+ }
393
+ c = _(r);
394
+ }
395
+ c && e.preventDefault();
396
+ }
397
+ }
398
+ }
399
+ function S() {
400
+ c = null;
401
+ }
402
+ function w(e) {
403
+ l && (l = !1, e.detail !== 0 && (e.preventDefault(), e.stopPropagation()));
404
+ }
405
+ return I(e.surface, (e, t, n) => {
406
+ e && (e.addEventListener("pointerdown", g), e.addEventListener("touchmove", x, { passive: !1 }), e.addEventListener("touchend", S), e.addEventListener("touchcancel", S), e.addEventListener("click", w, !0), n(() => {
407
+ e.removeEventListener("pointerdown", g), e.removeEventListener("touchmove", x), e.removeEventListener("touchend", S), e.removeEventListener("touchcancel", S), e.removeEventListener("click", w, !0), h();
408
+ }));
409
+ }, {
410
+ immediate: !0,
411
+ flush: "sync"
412
+ }), C(h), {
413
+ dragging: E(t),
414
+ offset: E(n)
415
+ };
348
416
  }
349
- const Ke = /* @__PURE__ */ k({
350
- __name: "PromptDialog",
351
- props: {
352
- data: {}
353
- },
354
- emits: ["resolve", "reject"],
355
- setup(e, { emit: a }) {
356
- const t = e, r = a, o = {
357
- [L.SMALL]: 650,
358
- [L.LARGE]: 1200
359
- }, u = H(t.data.saveCta, "save"), c = H(t.data.abortCta, "cancel"), n = E(!0), i = E(ne(t.data.initialValue) ?? null), f = E(null), { mobile: _ } = fe(), V = y(() => t.data.required && !i.value), R = y(() => o[t.data.size ?? L.SMALL]), b = y(() => t.data.size === L.LARGE ? _.value : !1), h = y(() => t.data.size === L.LARGE ? "secondary" : "primary");
360
- function v() {
361
- return t.data.props ?? {};
362
- }
363
- function T() {
364
- i.value = ne(t.data.initialValue) ?? null, n.value = !1;
365
- }
366
- function w() {
367
- n.value = !1;
368
- }
369
- function I() {
370
- if (t.data.required && !i.value) {
371
- r("reject");
372
- return;
373
- }
374
- r("resolve", i.value);
375
- }
376
- return (x, O) => (m(), p(l(K), {
377
- modelValue: n.value,
378
- "onUpdate:modelValue": O[1] || (O[1] = (P) => n.value = P),
379
- "max-width": R.value,
380
- fullscreen: b.value,
381
- scrollable: x.data.size === l(L).LARGE,
382
- onAfterLeave: I
383
- }, {
384
- default: d(() => [
385
- s(l(z), { class: "prompt-dialog-card" }, {
386
- default: d(() => [
387
- s(l(ce), { color: "primary" }, {
388
- default: d(() => [
389
- s(l(ie), null, {
390
- default: d(() => [
391
- s(C, {
392
- translate: x.data.translateTitle,
393
- content: x.data.title
394
- }, null, 8, ["translate", "content"])
395
- ]),
396
- _: 1
397
- }),
398
- s(l(B)),
399
- N("div", {
400
- ref_key: "toolbar",
401
- ref: f,
402
- class: "prompt-dialog-toolbar-slot"
403
- }, null, 512),
404
- s(l(A), {
405
- icon: "mdi-close",
406
- onClick: T
407
- })
408
- ]),
409
- _: 1
410
- }),
411
- f.value ? (m(), p(F(x.data.component), $({ key: 0 }, v(), {
412
- modelValue: i.value,
413
- "onUpdate:modelValue": O[0] || (O[0] = (P) => i.value = P),
414
- toolbar: f.value
415
- }), null, 16, ["modelValue", "toolbar"])) : S("", !0),
416
- s(l(de)),
417
- s(l(q), null, {
418
- default: d(() => [
419
- s(l(B)),
420
- s(l(A), {
421
- color: h.value,
422
- onClick: T
423
- }, {
424
- default: d(() => [
425
- s(C, {
426
- translate: l(c).translateText,
427
- content: l(c).text
428
- }, null, 8, ["translate", "content"])
429
- ]),
430
- _: 1
431
- }, 8, ["color"]),
432
- s(l(A), {
433
- variant: "elevated",
434
- color: h.value,
435
- disabled: V.value,
436
- onClick: w
437
- }, {
438
- default: d(() => [
439
- s(C, {
440
- translate: l(u).translateText,
441
- content: l(u).text
442
- }, null, 8, ["translate", "content"])
443
- ]),
444
- _: 1
445
- }, 8, ["color", "disabled"])
446
- ]),
447
- _: 1
448
- })
449
- ]),
450
- _: 1
451
- })
452
- ]),
453
- _: 1
454
- }, 8, ["modelValue", "max-width", "fullscreen", "scrollable"]));
455
- }
456
- }), ze = /* @__PURE__ */ W(Ke, [["__scopeId", "data-v-6cec23a5"]]), qe = { class: "d-flex justify-space-between pr-2 py-2" }, Ye = 550, Xe = /* @__PURE__ */ k({
457
- __name: "ConfirmDialog",
458
- props: {
459
- data: {}
460
- },
461
- emits: ["resolve", "reject"],
462
- setup(e, { emit: a }) {
463
- const t = e, r = a, { options: { i18n: { messages: { yes: o, no: u } } } } = j(), c = {
464
- text: o,
465
- translateText: !0
466
- }, n = {
467
- text: u,
468
- translateText: !0
469
- };
470
- let i = !1;
471
- const f = E(!0), _ = y(() => Object.hasOwn(t.data, "content") ? {
472
- content: t.data.content,
473
- translateContent: t.data.translateContent
474
- } : null), V = y(() => Object.hasOwn(t.data, "component") ? {
475
- component: t.data.component,
476
- props: t.data.props
477
- } : null), R = y(() => Q({}, c, t.data.confirmCta)), b = y(() => Q({}, n, t.data.rejectCta)), h = y(() => t.data.highlightCta ?? "confirm"), v = y(() => t.data.level ?? "primary");
478
- function T() {
479
- f.value = !1;
480
- }
481
- function w() {
482
- i = !0, f.value = !1;
483
- }
484
- function I() {
485
- if (t.data.throwOnReject && !i) {
486
- r("reject");
487
- return;
488
- }
489
- r("resolve", i);
490
- }
491
- return (x, O) => (m(), p(l(K), {
492
- modelValue: f.value,
493
- "onUpdate:modelValue": O[0] || (O[0] = (P) => f.value = P),
494
- persistent: !!x.data.permanent,
495
- "max-width": x.data.maxWidth ?? Ye,
496
- onAfterLeave: I
497
- }, {
498
- default: d(() => [
499
- s(l(z), { class: "confirm-dialog-card" }, {
500
- default: d(() => [
501
- N("div", qe, [
502
- s(l(ue), null, {
503
- default: d(() => [
504
- s(C, {
505
- translate: x.data.translateTitle,
506
- content: x.data.title
507
- }, null, 8, ["translate", "content"])
508
- ]),
509
- _: 1
510
- }),
511
- x.data.permanent ? S("", !0) : (m(), p(l(A), {
512
- key: 0,
513
- icon: "$close",
514
- variant: "text",
515
- onClick: T
516
- }))
517
- ]),
518
- _.value ? (m(), p(l(se), { key: 0 }, {
519
- default: d(() => [
520
- s(C, {
521
- translate: _.value.translateContent,
522
- content: _.value.content
523
- }, null, 8, ["translate", "content"])
524
- ]),
525
- _: 1
526
- })) : S("", !0),
527
- V.value ? (m(), p(F(V.value.component), re($({ key: 1 }, V.value.props)), null, 16)) : S("", !0),
528
- s(l(q), { class: "justify-end" }, {
529
- default: d(() => [
530
- N("div", {
531
- class: le(["d-flex align-center", h.value === "confirm" ? "" : "flex-row-reverse"])
532
- }, [
533
- s(l(A), {
534
- variant: h.value === "reject" ? "elevated" : "text",
535
- color: v.value,
536
- onClick: T
537
- }, {
538
- default: d(() => [
539
- s(C, {
540
- translate: b.value.translateText,
541
- content: b.value.text
542
- }, null, 8, ["translate", "content"])
543
- ]),
544
- _: 1
545
- }, 8, ["variant", "color"]),
546
- s(l(A), {
547
- variant: h.value === "confirm" ? "elevated" : "text",
548
- color: v.value,
549
- onClick: w
550
- }, {
551
- default: d(() => [
552
- s(C, {
553
- translate: R.value.translateText,
554
- content: R.value.text
555
- }, null, 8, ["translate", "content"])
556
- ]),
557
- _: 1
558
- }, 8, ["variant", "color"])
559
- ], 2)
560
- ]),
561
- _: 1
562
- })
563
- ]),
564
- _: 1
565
- })
566
- ]),
567
- _: 1
568
- }, 8, ["modelValue", "persistent", "max-width"]));
569
- }
570
- }), Ze = /* @__PURE__ */ W(Xe, [["__scopeId", "data-v-3e8b3358"]]);
571
- function Je(e) {
572
- return e ? new Promise((a) => {
573
- setTimeout(() => {
574
- a();
575
- }, e);
576
- }) : Promise.resolve();
417
+ //#endregion
418
+ //#region node_modules/@mdi/js/mdi.js
419
+ var Ie = "M11,15H13V17H11V15M11,7H13V13H11V7M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20Z", Le = "M12,2L1,21H23M12,6L19.53,19H4.47M11,10V14H13V10M11,16V18H13V16", Re = "M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M12 20C7.59 20 4 16.41 4 12S7.59 4 12 4 20 7.59 20 12 16.41 20 12 20M16.59 7.58L10 14.17L7.41 11.59L6 13L10 17L18 9L16.59 7.58Z", ze = "M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z", Be = "M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z";
420
+ //#endregion
421
+ //#region lib/internal/icons.ts
422
+ function Ve(e) {
423
+ return `svg:${e}`;
577
424
  }
578
- function et(e, a = {}) {
579
- const { options: { loading: { delay: t, overlay: r } } } = j(), o = E(!1), u = _e();
580
- async function c(...n) {
581
- o.value = !0, r && (u.value = !0);
582
- try {
583
- const [i] = await Promise.all([
584
- e(...n),
585
- Je(t)
586
- ]);
587
- return i;
588
- } catch (i) {
589
- throw i;
590
- } finally {
591
- o.value = !1, r && (u.value = !1);
592
- }
593
- }
594
- return { loading: Z(o), action: c };
425
+ var Q = {
426
+ close: Ve(ze),
427
+ success: Ve(Re),
428
+ error: Ve(Ie),
429
+ warning: Ve(Le),
430
+ info: Ve(Be)
431
+ }, He = ["aria-label"], Ue = {
432
+ key: 1,
433
+ class: "ui-sheet__handle",
434
+ "aria-hidden": "true"
435
+ }, We = { class: "ui-sheet__header" }, Ge = {
436
+ key: 0,
437
+ class: "ui-sheet__title"
438
+ }, Ke = {
439
+ key: 0,
440
+ ref: "preview",
441
+ class: "ui-sheet__preview"
442
+ }, qe = {
443
+ ref: "content",
444
+ class: "ui-sheet__content"
445
+ }, Je = {
446
+ key: 2,
447
+ class: "ui-sheet__footer"
448
+ }, Ye = .9, Xe = .2, Ze = /* @__PURE__ */ u({
449
+ __name: "UiBottomSheet",
450
+ props: {
451
+ modelValue: { type: Boolean },
452
+ stage: { default: void 0 },
453
+ title: { default: void 0 },
454
+ translateTitle: {
455
+ type: Boolean,
456
+ default: !0
457
+ },
458
+ expandable: {
459
+ type: Boolean,
460
+ default: !0
461
+ },
462
+ closable: {
463
+ type: Boolean,
464
+ default: !0
465
+ },
466
+ persistent: {
467
+ type: Boolean,
468
+ default: !1
469
+ },
470
+ form: {
471
+ type: Boolean,
472
+ default: !1
473
+ }
474
+ },
475
+ emits: [
476
+ "update:modelValue",
477
+ "update:stage",
478
+ "close",
479
+ "submit",
480
+ "opened",
481
+ "closed"
482
+ ],
483
+ setup(e, { emit: t }) {
484
+ let n = e, c = t, u = ne(), { options: d } = W(), f = J(), p = F("surface"), m = F("body"), g = F("preview"), v = F("content"), C = D(!!u.preview);
485
+ x(() => {
486
+ C.value = !!u.preview;
487
+ });
488
+ let T = r(() => De(C.value, n.expandable)), E = D(N()), O = r(() => T.value.includes(E.value) ? E.value : T.value[0]), j = r({
489
+ get: () => T.value.indexOf(O.value),
490
+ set: (e) => {
491
+ E.value = T.value[e];
492
+ }
493
+ }), M = r(() => j.value >= T.value.length - 1);
494
+ function N() {
495
+ return n.stage && T.value.includes(n.stage) ? n.stage : T.value[0];
496
+ }
497
+ let ee = r(() => d.i18n.messages), te = r(() => f(M.value ? ee.value.collapse : ee.value.expand)), ie = r(() => f(ee.value.close)), ce = D({
498
+ chrome: 0,
499
+ preview: 0,
500
+ content: 0
501
+ }), le = D(0);
502
+ function ue(e) {
503
+ let t = getComputedStyle(e);
504
+ return (parseFloat(t.paddingTop) || 0) + (parseFloat(t.paddingBottom) || 0);
505
+ }
506
+ function fe(e) {
507
+ if (!e) return 0;
508
+ if (e.style.display !== "none") return e.offsetHeight;
509
+ e.style.display = "";
510
+ let t = e.offsetHeight;
511
+ return e.style.display = "none", t;
512
+ }
513
+ function z() {
514
+ let e = p.value, t = m.value;
515
+ le.value = window.innerHeight, e && t && (ce.value = {
516
+ chrome: e.offsetHeight - t.offsetHeight + ue(t),
517
+ preview: fe(g.value),
518
+ content: fe(v.value)
519
+ });
520
+ }
521
+ function pe(e) {
522
+ let { chrome: t, preview: n, content: r } = ce.value;
523
+ return e === "fullscreen" ? le.value : e === "preview" ? t + n : Math.min(t + r, Ye * le.value);
524
+ }
525
+ function me() {
526
+ return z(), T.value.map(pe);
527
+ }
528
+ let he = null, B = D(null), ge = r(() => n.modelValue ? null : B.value);
529
+ function _e(e) {
530
+ B.value = e, c("update:modelValue", !1), c("close");
531
+ }
532
+ function V() {
533
+ _e(null);
534
+ }
535
+ function H() {
536
+ _e(he);
537
+ }
538
+ let { dragging: U, offset: G } = Fe({
539
+ surface: p,
540
+ body: m,
541
+ heights: me,
542
+ current: j,
543
+ dismissible: r(() => !n.persistent),
544
+ onDismiss: H
545
+ }), K = D([]);
546
+ I(U, (e) => {
547
+ K.value = e ? me() : [], e && (he = null, B.value = null);
548
+ }, { flush: "sync" }), I(G, (e) => {
549
+ U.value && K.value.length && (he = {
550
+ height: K.value[j.value],
551
+ offset: Math.max(e, 0)
552
+ });
553
+ }, { flush: "sync" });
554
+ let ve = r(() => {
555
+ if (ge.value) {
556
+ let { height: e, offset: t } = ge.value;
557
+ return {
558
+ height: `${String(e)}px`,
559
+ transform: `translateY(${String(t)}px)`
560
+ };
561
+ }
562
+ if (U.value && K.value.length) {
563
+ let e = K.value[j.value];
564
+ if (G.value >= 0) return {
565
+ height: `${String(e)}px`,
566
+ transform: `translateY(${String(G.value)}px)`
567
+ };
568
+ let t = K.value[K.value.length - 1], n = e - G.value, r = Math.min(n, t) + Math.max(n - t, 0) * Xe;
569
+ return { height: `${String(r)}px` };
570
+ }
571
+ let { chrome: e, preview: t, content: n } = ce.value;
572
+ return O.value === "preview" && e + t > 0 ? { height: `${String(e + t)}px` } : O.value === "content" && e + n > 0 ? { height: `min(${String(e + n)}px, 90dvh)` } : {};
573
+ }), q = null;
574
+ function ye() {
575
+ q?.disconnect(), q = null;
576
+ let e = [g.value, v.value].filter((e) => !!e);
577
+ e.length && typeof ResizeObserver < "u" && (q = new ResizeObserver(() => {
578
+ U.value || z();
579
+ }), e.forEach((e) => {
580
+ q?.observe(e);
581
+ }));
582
+ }
583
+ I([g, v], ye, { flush: "post" }), S(() => {
584
+ le.value = window.innerHeight, window.addEventListener("resize", z);
585
+ }), b(() => {
586
+ q?.disconnect(), window.removeEventListener("resize", z);
587
+ });
588
+ function X() {
589
+ O.value !== n.stage && c("update:stage", O.value);
590
+ }
591
+ I(() => n.stage, (e) => {
592
+ e && T.value.includes(e) ? E.value = e : X();
593
+ }), I(T, (e) => {
594
+ e.includes(E.value) || (E.value = e[0]);
595
+ }), I(() => n.modelValue, (e) => {
596
+ e && (B.value = null, E.value = N());
597
+ }), I(O, X, { immediate: !0 }), I(O, z, { flush: "post" });
598
+ function be() {
599
+ j.value = M.value ? 0 : T.value.length - 1;
600
+ }
601
+ function xe() {
602
+ B.value = null, c("closed");
603
+ }
604
+ function Z() {
605
+ n.persistent || V();
606
+ }
607
+ function Se() {
608
+ d.dialog.closeOnOverlayClick && !n.persistent && V();
609
+ }
610
+ function Ce() {
611
+ n.form && c("submit");
612
+ }
613
+ return (t, n) => (w(), i(P(de), {
614
+ "model-value": e.modelValue,
615
+ persistent: "",
616
+ "no-click-animation": "",
617
+ scrollable: !1,
618
+ "retain-focus": "",
619
+ "content-class": "ui-sheet-overlay",
620
+ "onClick:outside": Se,
621
+ onKeydown: oe(se(Z, ["stop", "prevent"]), ["esc"]),
622
+ onAfterEnter: n[0] ||= (e) => c("opened"),
623
+ onAfterLeave: xe
624
+ }, {
625
+ default: L(() => [s("div", {
626
+ ref_key: "surface",
627
+ ref: p,
628
+ class: _(["ui-sheet", [`ui-sheet--${O.value}`, {
629
+ "ui-sheet--dragging": P(U),
630
+ "ui-sheet--dismissing": !!ge.value
631
+ }]]),
632
+ style: y(ve.value)
633
+ }, [(w(), i(A(e.form ? "form" : "div"), h({ class: "ui-sheet__layout" }, e.form ? { novalidate: !0 } : {}, { onSubmit: se(Ce, ["prevent"]) }), {
634
+ default: L(() => [
635
+ T.value.length > 1 ? (w(), o("button", {
636
+ key: 0,
637
+ type: "button",
638
+ class: "ui-sheet__handle",
639
+ "aria-label": te.value,
640
+ onClick: be
641
+ }, [...n[1] ||= [s("span", { class: "ui-sheet__grip" }, null, -1)]], 8, He)) : (w(), o("div", Ue, [...n[2] ||= [s("span", { class: "ui-sheet__grip" }, null, -1)]])),
642
+ s("header", We, [
643
+ e.title ? (w(), o("h2", Ge, [l(Y, {
644
+ content: e.title,
645
+ translate: e.translateTitle
646
+ }, null, 8, ["content", "translate"])])) : a("", !0),
647
+ k(t.$slots, "header"),
648
+ e.closable && O.value === "fullscreen" ? (w(), i(P(R), {
649
+ key: 1,
650
+ variant: "text",
651
+ density: "comfortable",
652
+ icon: P(Q).close,
653
+ "aria-label": ie.value,
654
+ disabled: e.persistent,
655
+ class: "ui-sheet__close",
656
+ onClick: V
657
+ }, null, 8, [
658
+ "icon",
659
+ "aria-label",
660
+ "disabled"
661
+ ])) : a("", !0)
662
+ ]),
663
+ s("div", {
664
+ ref_key: "body",
665
+ ref: m,
666
+ class: "ui-sheet__body"
667
+ }, [C.value ? ae((w(), o("div", Ke, [k(t.$slots, "preview")], 512)), [[re, O.value === "preview"]]) : a("", !0), ae(s("div", qe, [k(t.$slots, "default")], 512), [[re, O.value !== "preview"]])], 512),
668
+ P(u).actions ? (w(), o("footer", Je, [k(t.$slots, "actions")])) : a("", !0)
669
+ ]),
670
+ _: 3
671
+ }, 16))], 6)]),
672
+ _: 3
673
+ }, 8, ["model-value", "onKeydown"]));
674
+ }
675
+ });
676
+ //#endregion
677
+ //#region lib/composables/dialog/internal/useDialogCta.ts
678
+ function $(e, t) {
679
+ let n = {
680
+ text: W().options.i18n.messages[t],
681
+ translateText: !0
682
+ };
683
+ return B(n, e);
684
+ }
685
+ //#endregion
686
+ //#region lib/composables/dialog/internal/dialogWidths.ts
687
+ var Qe = {
688
+ sm: 440,
689
+ md: 560,
690
+ lg: 720
691
+ };
692
+ function $e(e) {
693
+ return typeof e == "number" ? e : Qe[e];
595
694
  }
596
- const tt = /* @__PURE__ */ k({
597
- __name: "FormDialog",
598
- props: {
599
- data: {}
600
- },
601
- emits: ["resolve", "reject"],
602
- setup(e, { emit: a }) {
603
- const t = e, r = a, o = H(t.data.saveCta, "save"), u = H(t.data.abortCta, "cancel"), c = De("formComponent"), n = E(!0), i = Ee(), { loading: f, action: _ } = et(v), V = y(() => ({
604
- global: {
605
- disabled: f.value
606
- }
607
- }));
608
- let R = null;
609
- function b() {
610
- return t.data.props ?? {};
611
- }
612
- async function h() {
613
- await i.value.$validate() && await _();
614
- }
615
- async function v() {
616
- if (!c.value)
617
- throw new Error("Form component not mounted");
618
- const I = await c.value.finish();
619
- typeof t.data.action == "function" ? R = await t.data.action(I) : R = I, w();
620
- }
621
- function T() {
622
- n.value = !1;
623
- }
624
- function w() {
625
- if (t.data.rejectOnEmpty && R === null) {
626
- r("reject");
627
- return;
628
- }
629
- r("resolve", R);
630
- }
631
- return (I, x) => (m(), p(l(K), {
632
- modelValue: n.value,
633
- "onUpdate:modelValue": x[0] || (x[0] = (O) => n.value = O),
634
- onAfterLeave: w,
635
- "max-width": "1200",
636
- scrollable: ""
637
- }, {
638
- default: d(() => [
639
- s(l(z), null, {
640
- default: d(() => [
641
- s(l(ce), { color: "primary" }, {
642
- default: d(() => [
643
- s(l(ie), null, {
644
- default: d(() => [
645
- s(C, {
646
- content: I.data.title,
647
- translate: !!I.data.translateTitle
648
- }, null, 8, ["content", "translate"])
649
- ]),
650
- _: 1
651
- }),
652
- s(l(B)),
653
- s(l(A), {
654
- icon: "mdi-close",
655
- onClick: T
656
- })
657
- ]),
658
- _: 1
659
- }),
660
- s(l(he), { defaults: V.value }, {
661
- default: d(() => [
662
- (m(), p(F(I.data.component), $({
663
- ref_key: "formComponent",
664
- ref: c,
665
- onSave: h
666
- }, b()), null, 16))
667
- ]),
668
- _: 1
669
- }, 8, ["defaults"]),
670
- s(l(de)),
671
- s(l(q), null, {
672
- default: d(() => [
673
- s(l(B)),
674
- s(l(A), {
675
- onClick: T,
676
- color: "primary"
677
- }, {
678
- default: d(() => [
679
- s(C, {
680
- content: l(u).text,
681
- translate: l(u).translateText
682
- }, null, 8, ["content", "translate"])
683
- ]),
684
- _: 1
685
- }),
686
- s(l(A), {
687
- onClick: h,
688
- variant: "elevated",
689
- color: "primary"
690
- }, {
691
- default: d(() => [
692
- s(C, {
693
- translate: l(o).translateText,
694
- content: l(o).text
695
- }, null, 8, ["translate", "content"])
696
- ]),
697
- _: 1
698
- })
699
- ]),
700
- _: 1
701
- })
702
- ]),
703
- _: 1
704
- })
705
- ]),
706
- _: 1
707
- }, 8, ["modelValue"]));
708
- }
695
+ //#endregion
696
+ //#region lib/components/sheet/UiResponsiveDialog.vue?vue&type=script&setup=true&lang.ts
697
+ var et = { class: "ui-dialog__header" }, tt = { class: "ui-dialog__title" }, nt = { class: "ui-dialog__body" }, rt = {
698
+ key: 0,
699
+ class: "ui-dialog__footer"
700
+ }, it = /* @__PURE__ */ u({
701
+ inheritAttrs: !1,
702
+ __name: "UiResponsiveDialog",
703
+ props: {
704
+ modelValue: { type: Boolean },
705
+ title: {},
706
+ translateTitle: {
707
+ type: Boolean,
708
+ default: !0
709
+ },
710
+ width: { default: "md" },
711
+ closable: {
712
+ type: Boolean,
713
+ default: !0
714
+ },
715
+ persistent: {
716
+ type: Boolean,
717
+ default: !1
718
+ },
719
+ form: {
720
+ type: Boolean,
721
+ default: !1
722
+ },
723
+ expandable: {
724
+ type: Boolean,
725
+ default: !0
726
+ },
727
+ stage: { default: void 0 }
728
+ },
729
+ emits: [
730
+ "update:modelValue",
731
+ "close",
732
+ "submit",
733
+ "opened",
734
+ "closed",
735
+ "update:stage"
736
+ ],
737
+ setup(n, { emit: u }) {
738
+ let d = n, f = u, p = ne(), m = te(), { options: g } = W(), { mobile: _ } = ce(), v = J(), y = $(void 0, "close"), b = r(() => v(y.text, y.translateText)), x = r(() => $e(d.width)), S = M(null), C = !1;
739
+ function T(e) {
740
+ e instanceof HTMLElement && (S.value = e);
741
+ }
742
+ I(() => d.modelValue, (e, t) => {
743
+ C = !e && t;
744
+ }), I(_, () => {
745
+ C && !d.modelValue && E();
746
+ });
747
+ function E() {
748
+ C = !1, d.modelValue || (S.value = null), f("closed");
749
+ }
750
+ function D() {
751
+ f("update:modelValue", !1), f("close");
752
+ }
753
+ function O() {
754
+ d.persistent || D();
755
+ }
756
+ function j() {
757
+ g.dialog.closeOnOverlayClick && !d.persistent && D();
758
+ }
759
+ function N() {
760
+ d.form && f("submit");
761
+ }
762
+ return (r, u) => (w(), o(e, null, [P(_) ? (w(), i(Ze, h({ key: 0 }, P(m), {
763
+ "model-value": n.modelValue,
764
+ stage: n.stage,
765
+ title: n.title,
766
+ "translate-title": n.translateTitle,
767
+ expandable: n.expandable,
768
+ closable: n.closable,
769
+ persistent: n.persistent,
770
+ form: n.form,
771
+ "onUpdate:modelValue": u[0] ||= (e) => f("update:modelValue", e),
772
+ "onUpdate:stage": u[1] ||= (e) => f("update:stage", e),
773
+ onClose: u[2] ||= (e) => f("close"),
774
+ onSubmit: u[3] ||= (e) => f("submit"),
775
+ onOpened: u[4] ||= (e) => f("opened"),
776
+ onClosed: E
777
+ }), c({
778
+ default: L(() => [s("div", {
779
+ ref: T,
780
+ class: "ui-responsive-dialog__slot"
781
+ }, null, 512)]),
782
+ _: 2
783
+ }, [
784
+ P(p).preview ? {
785
+ name: "preview",
786
+ fn: L(() => [k(r.$slots, "preview")]),
787
+ key: "0"
788
+ } : void 0,
789
+ P(p).header ? {
790
+ name: "header",
791
+ fn: L(() => [k(r.$slots, "header")]),
792
+ key: "1"
793
+ } : void 0,
794
+ P(p).actions ? {
795
+ name: "actions",
796
+ fn: L(() => [k(r.$slots, "actions")]),
797
+ key: "2"
798
+ } : void 0
799
+ ]), 1040, [
800
+ "model-value",
801
+ "stage",
802
+ "title",
803
+ "translate-title",
804
+ "expandable",
805
+ "closable",
806
+ "persistent",
807
+ "form"
808
+ ])) : (w(), i(P(z), h({ key: 1 }, P(m), {
809
+ "model-value": n.modelValue,
810
+ "max-width": x.value,
811
+ persistent: "",
812
+ "no-click-animation": "",
813
+ scrollable: !1,
814
+ "retain-focus": "",
815
+ "onClick:outside": j,
816
+ onKeydown: oe(se(O, ["stop", "prevent"]), ["esc"]),
817
+ onAfterEnter: u[5] ||= (e) => f("opened"),
818
+ onAfterLeave: E
819
+ }), {
820
+ default: L(() => [l(P(fe), {
821
+ variant: "flat",
822
+ border: !1,
823
+ rounded: !1,
824
+ class: "ui-dialog"
825
+ }, {
826
+ default: L(() => [(w(), i(A(n.form ? "form" : "div"), h({ class: "ui-dialog__layout" }, n.form ? { novalidate: !0 } : {}, { onSubmit: se(N, ["prevent"]) }), {
827
+ default: L(() => [
828
+ s("header", et, [
829
+ s("h2", tt, [l(Y, {
830
+ content: n.title,
831
+ translate: n.translateTitle
832
+ }, null, 8, ["content", "translate"])]),
833
+ k(r.$slots, "header"),
834
+ n.closable ? (w(), i(P(R), {
835
+ key: 0,
836
+ variant: "text",
837
+ density: "comfortable",
838
+ icon: P(Q).close,
839
+ "aria-label": b.value,
840
+ disabled: n.persistent,
841
+ class: "ui-dialog__close",
842
+ onClick: D
843
+ }, null, 8, [
844
+ "icon",
845
+ "aria-label",
846
+ "disabled"
847
+ ])) : a("", !0)
848
+ ]),
849
+ s("div", nt, [s("div", {
850
+ ref: T,
851
+ class: "ui-responsive-dialog__slot"
852
+ }, null, 512)]),
853
+ P(p).actions ? (w(), o("footer", rt, [k(r.$slots, "actions")])) : a("", !0)
854
+ ]),
855
+ _: 3
856
+ }, 16))]),
857
+ _: 3
858
+ })]),
859
+ _: 3
860
+ }, 16, [
861
+ "model-value",
862
+ "max-width",
863
+ "onKeydown"
864
+ ])), S.value ? (w(), i(t, {
865
+ key: 2,
866
+ to: S.value
867
+ }, [k(r.$slots, "default")], 8, ["to"])) : a("", !0)], 64));
868
+ }
709
869
  });
710
- function mt() {
711
- const e = pe();
712
- function a(u, c) {
713
- let n;
714
- return typeof u == "string" ? n = {
715
- title: u,
716
- content: c ?? ""
717
- } : n = u, new Promise((i) => {
718
- const f = {
719
- component: He,
720
- props: { data: n },
721
- resolve: i,
722
- reject: () => {
723
- i(null);
724
- }
725
- };
726
- e.addToQueue(f);
727
- });
728
- }
729
- function t(u) {
730
- return new Promise((c, n) => {
731
- const i = {
732
- component: ze,
733
- props: { data: u },
734
- resolve: c,
735
- reject: n
736
- };
737
- e.addToQueue(i);
738
- });
739
- }
740
- function r(u, c, n) {
741
- let i = u;
742
- return typeof u == "string" && typeof c == "string" && (i = {
743
- title: u,
744
- content: c,
745
- level: n
746
- }), new Promise((f, _) => {
747
- const V = {
748
- component: Ze,
749
- props: { data: i },
750
- resolve: f,
751
- reject: _
752
- };
753
- e.addToQueue(V);
754
- });
755
- }
756
- function o(u) {
757
- return new Promise((c, n) => {
758
- const i = {
759
- component: tt,
760
- props: { data: u },
761
- resolve: c,
762
- reject: n
763
- };
764
- e.addToQueue(i);
765
- });
766
- }
767
- return {
768
- info: a,
769
- prompt: t,
770
- confirm: r,
771
- form: o
772
- };
870
+ //#endregion
871
+ //#region lib/composables/dialog/useDialog.ts
872
+ function at() {
873
+ let e = G(), { options: { components: { dialog: t } } } = W();
874
+ function n(n, r) {
875
+ let i = typeof n == "string" ? {
876
+ title: n,
877
+ content: r ?? ""
878
+ } : n;
879
+ return new Promise((n) => {
880
+ let r = {
881
+ component: t.info,
882
+ data: i,
883
+ resolve: n,
884
+ reject: () => {
885
+ n(null);
886
+ }
887
+ };
888
+ e.addToQueue(r);
889
+ });
890
+ }
891
+ function r(n, r, i) {
892
+ let a = typeof n == "string" ? {
893
+ title: n,
894
+ content: r ?? "",
895
+ level: i
896
+ } : n;
897
+ return new Promise((n, r) => {
898
+ let i = {
899
+ component: t.confirm,
900
+ data: a,
901
+ resolve: n,
902
+ reject: r
903
+ };
904
+ e.addToQueue(i);
905
+ });
906
+ }
907
+ function i(n) {
908
+ return new Promise((r, i) => {
909
+ let a = {
910
+ component: t.form,
911
+ data: n,
912
+ resolve: r,
913
+ reject: i
914
+ };
915
+ e.addToQueue(a);
916
+ });
917
+ }
918
+ return {
919
+ info: n,
920
+ confirm: r,
921
+ form: i
922
+ };
923
+ }
924
+ //#endregion
925
+ //#region lib/composables/dialog/useDialogEntry.ts
926
+ function ot() {
927
+ let e = d() ? f(K, null) : null;
928
+ if (!e) throw Error(H.DIALOG_ENTRY_CONTEXT_MISSING);
929
+ return e;
930
+ }
931
+ //#endregion
932
+ //#region lib/composables/dialog/useDialogForm.ts
933
+ function st(e) {
934
+ let t = d() ? f(ve, null) : null;
935
+ if (!t) throw Error(H.DIALOG_FORM_CONTEXT_MISSING);
936
+ return t.register(e), {
937
+ submit: t.submit,
938
+ loading: t.loading
939
+ };
773
940
  }
774
- var nt = /* @__PURE__ */ ((e) => (e.DEFAULT = "primary", e.WARNING = "warning", e.DANGER = "error", e))(nt || {});
775
- function ft() {
776
- const e = ee(), { options: { toast: { timeout: a } } } = j();
777
- function t(c, n) {
778
- return new Promise((i) => {
779
- e.addToQueue({
780
- message: c,
781
- resolve: i,
782
- timeout: (n == null ? void 0 : n.timeout) ?? a,
783
- translateMessage: (n == null ? void 0 : n.translateMessage) ?? !0,
784
- type: D.INFO
785
- });
786
- });
787
- }
788
- function r(c, n) {
789
- return new Promise((i) => {
790
- e.addToQueue({
791
- message: c,
792
- resolve: i,
793
- timeout: (n == null ? void 0 : n.timeout) ?? a,
794
- translateMessage: (n == null ? void 0 : n.translateMessage) ?? !0,
795
- type: D.WARNING
796
- });
797
- });
798
- }
799
- function o(c, n) {
800
- return new Promise((i) => {
801
- e.addToQueue({
802
- message: c,
803
- resolve: i,
804
- timeout: (n == null ? void 0 : n.timeout) ?? a,
805
- translateMessage: (n == null ? void 0 : n.translateMessage) ?? !0,
806
- type: D.ERROR
807
- });
808
- });
809
- }
810
- function u(c, n) {
811
- return new Promise((i) => {
812
- e.addToQueue({
813
- message: c,
814
- resolve: i,
815
- timeout: (n == null ? void 0 : n.timeout) ?? a,
816
- translateMessage: (n == null ? void 0 : n.translateMessage) ?? !0,
817
- type: D.SUCCESS
818
- });
819
- });
820
- }
821
- return {
822
- info: t,
823
- warn: r,
824
- error: o,
825
- success: u
826
- };
941
+ //#endregion
942
+ //#region lib/composables/dialog/presets/ConfirmDialogProps.ts
943
+ var ct = /* @__PURE__ */ function(e) {
944
+ return e.DEFAULT = "primary", e.WARNING = "warning", e.DANGER = "error", e;
945
+ }({});
946
+ //#endregion
947
+ //#region lib/composables/toast/useToast.ts
948
+ function lt() {
949
+ let e = X(), { options: { toast: t } } = W();
950
+ function n(e) {
951
+ return e === Z.ERROR ? t.errorTimeout : t.timeout;
952
+ }
953
+ function r(t) {
954
+ return (r, i) => new Promise((a) => {
955
+ e.addToQueue({
956
+ message: r,
957
+ resolve: a,
958
+ timeout: i?.timeout ?? n(t),
959
+ translateMessage: i?.translateMessage ?? !0,
960
+ action: i?.action,
961
+ type: t
962
+ });
963
+ });
964
+ }
965
+ return {
966
+ info: r(Z.INFO),
967
+ warn: r(Z.WARNING),
968
+ error: r(Z.ERROR),
969
+ success: r(Z.SUCCESS)
970
+ };
827
971
  }
828
- const at = () => ({
829
- loading: {
830
- delay: 2e3,
831
- overlay: !1
832
- },
833
- toast: {
834
- timeout: 4e3
835
- },
836
- i18n: {
837
- messages: {
838
- yes: "common.yes",
839
- no: "common.no",
840
- cancel: "action.cancel",
841
- close: "action.close",
842
- save: "action.save"
843
- }
844
- }
972
+ //#endregion
973
+ //#region lib/composables/toast/useToastEntry.ts
974
+ function ut() {
975
+ let e = d() ? f(be, null) : null;
976
+ if (!e) throw Error(H.TOAST_ENTRY_CONTEXT_MISSING);
977
+ return e;
978
+ }
979
+ //#endregion
980
+ //#region lib/composables/loading/useLoading.ts
981
+ function dt(e) {
982
+ return e ? new Promise((t) => {
983
+ setTimeout(t, e);
984
+ }) : Promise.resolve();
985
+ }
986
+ function ft(e, t = {}) {
987
+ let { options: { loading: n } } = W(), r = t.delay ?? n.delay, i = t.overlay ?? n.overlay, a = D(!1), o = we(), s = e;
988
+ async function c(...e) {
989
+ a.value = !0, i && (o.value = !0);
990
+ try {
991
+ let [t] = await Promise.all([s(...e), dt(r)]);
992
+ return t;
993
+ } finally {
994
+ a.value = !1, i && (o.value = !1);
995
+ }
996
+ }
997
+ return {
998
+ loading: E(a),
999
+ action: c
1000
+ };
1001
+ }
1002
+ //#endregion
1003
+ //#region lib/composables/dialog/components/dialog/presets/InfoDialog.vue?vue&type=script&setup=true&lang.ts
1004
+ var pt = {
1005
+ key: 0,
1006
+ class: "ui-dialog__text"
1007
+ }, mt = /* @__PURE__ */ u({
1008
+ __name: "InfoDialog",
1009
+ setup(t) {
1010
+ let { data: n, resolve: s } = ot(), u = n.defaultCta === !1 ? null : $(n.defaultCta, "close"), d = r(() => n.additionalCta ?? []), f = r(() => u !== null || d.value.length > 0), p = D(!0), m = r(() => "props" in n ? n.props : {}), g = null;
1011
+ function _(e) {
1012
+ "action" in e ? e.action() : y(e.value);
1013
+ }
1014
+ function y(e) {
1015
+ p.value &&= (g = e, !1);
1016
+ }
1017
+ function b() {
1018
+ y(null);
1019
+ }
1020
+ function x() {
1021
+ s(g);
1022
+ }
1023
+ return (t, r) => (w(), i(it, {
1024
+ "model-value": p.value,
1025
+ title: P(n).title,
1026
+ "translate-title": P(n).translateTitle,
1027
+ width: P(n).width ?? "sm",
1028
+ onClose: b,
1029
+ onClosed: x
1030
+ }, c({
1031
+ default: L(() => ["content" in P(n) ? (w(), o("p", pt, [l(Y, {
1032
+ content: P(n).content,
1033
+ translate: P(n).translateContent
1034
+ }, null, 8, ["content", "translate"])])) : (w(), i(A(P(n).component), v(h({ key: 1 }, m.value)), null, 16))]),
1035
+ _: 2
1036
+ }, [f.value ? {
1037
+ name: "actions",
1038
+ fn: L(() => [(w(!0), o(e, null, O(d.value, (e, t) => (w(), i(P(R), {
1039
+ key: t,
1040
+ variant: "text",
1041
+ onClick: () => _(e)
1042
+ }, {
1043
+ default: L(() => [l(Y, {
1044
+ content: e.text,
1045
+ translate: e.translateText
1046
+ }, null, 8, ["content", "translate"])]),
1047
+ _: 2
1048
+ }, 1032, ["onClick"]))), 128)), P(u) ? (w(), i(P(R), {
1049
+ key: 0,
1050
+ variant: "flat",
1051
+ color: "primary",
1052
+ onClick: b
1053
+ }, {
1054
+ default: L(() => [l(Y, {
1055
+ content: P(u).text,
1056
+ translate: P(u).translateText
1057
+ }, null, 8, ["content", "translate"])]),
1058
+ _: 1
1059
+ })) : a("", !0)]),
1060
+ key: "0"
1061
+ } : void 0]), 1032, [
1062
+ "model-value",
1063
+ "title",
1064
+ "translate-title",
1065
+ "width"
1066
+ ]));
1067
+ }
1068
+ }), ht = {
1069
+ key: 0,
1070
+ class: "ui-dialog__text"
1071
+ }, gt = /* @__PURE__ */ u({
1072
+ __name: "ConfirmDialog",
1073
+ setup(t) {
1074
+ let { data: n, resolve: a, reject: s } = ot(), c = $(n.confirmCta, "yes"), u = $(n.rejectCta, "no"), d = D(!0), f = {
1075
+ reject: null,
1076
+ confirm: null
1077
+ }, p = r(() => n.highlightCta ?? "confirm"), m = r(() => n.level ?? "primary"), g = r(() => "props" in n ? n.props : {}), _ = r(() => {
1078
+ let e = p.value, t = [{
1079
+ key: "reject",
1080
+ cta: u,
1081
+ variant: e === "reject" ? "flat" : "text",
1082
+ color: e === "reject" ? m.value : void 0,
1083
+ onClick: x
1084
+ }, {
1085
+ key: "confirm",
1086
+ cta: c,
1087
+ variant: e === "confirm" ? "flat" : "text",
1088
+ color: e === "confirm" ? m.value : void 0,
1089
+ onClick: S
1090
+ }];
1091
+ return e === "reject" ? t.reverse() : t;
1092
+ }), y = !1;
1093
+ function b(e, t) {
1094
+ t && "$el" in t ? f[e] = t.$el : f[e] = null;
1095
+ }
1096
+ function x() {
1097
+ d.value &&= (y = !1, !1);
1098
+ }
1099
+ function S() {
1100
+ d.value &&= (y = !0, !1);
1101
+ }
1102
+ function C() {
1103
+ f[n.level === ct.DANGER ? "reject" : "confirm"]?.focus();
1104
+ }
1105
+ function T() {
1106
+ !y && n.throwOnReject ? s() : a(y);
1107
+ }
1108
+ return (t, r) => (w(), i(it, {
1109
+ "model-value": d.value,
1110
+ title: P(n).title,
1111
+ "translate-title": P(n).translateTitle,
1112
+ width: P(n).width ?? "sm",
1113
+ closable: !1,
1114
+ persistent: !!P(n).permanent,
1115
+ onClose: x,
1116
+ onOpened: C,
1117
+ onClosed: T
1118
+ }, {
1119
+ actions: L(() => [(w(!0), o(e, null, O(_.value, (e) => (w(), i(P(R), {
1120
+ key: e.key,
1121
+ ref_for: !0,
1122
+ ref: (t) => b(e.key, t),
1123
+ variant: e.variant,
1124
+ color: e.color,
1125
+ onClick: e.onClick
1126
+ }, {
1127
+ default: L(() => [l(Y, {
1128
+ content: e.cta.text,
1129
+ translate: e.cta.translateText
1130
+ }, null, 8, ["content", "translate"])]),
1131
+ _: 2
1132
+ }, 1032, [
1133
+ "variant",
1134
+ "color",
1135
+ "onClick"
1136
+ ]))), 128))]),
1137
+ default: L(() => ["content" in P(n) ? (w(), o("p", ht, [l(Y, {
1138
+ content: P(n).content,
1139
+ translate: P(n).translateContent
1140
+ }, null, 8, ["content", "translate"])])) : (w(), i(A(P(n).component), v(h({ key: 1 }, g.value)), null, 16))]),
1141
+ _: 1
1142
+ }, 8, [
1143
+ "model-value",
1144
+ "title",
1145
+ "translate-title",
1146
+ "width",
1147
+ "persistent"
1148
+ ]));
1149
+ }
845
1150
  });
846
- function ot(e) {
847
- const a = E([]), t = E([]);
848
- return {
849
- dialogQueue: a,
850
- toastQueue: t,
851
- options: e
852
- };
1151
+ //#endregion
1152
+ //#region lib/composables/dialog/internal/declaresProp.ts
1153
+ function _t(e, t) {
1154
+ let n = e.props;
1155
+ return Array.isArray(n) ? n.includes(t) : typeof n == "object" && !!n && t in n;
853
1156
  }
1157
+ //#endregion
1158
+ //#region lib/composables/dialog/internal/isEmptyValue.ts
854
1159
  function vt(e) {
855
- return (a) => {
856
- const t = at(), r = Q(t, e), o = ot(r);
857
- a.__SCHWARZDAVID_UIKIT_SYMBOL__ = Symbol("@schwarzdavid/ui-kit"), a.provide(a.__SCHWARZDAVID_UIKIT_SYMBOL__, o);
858
- };
1160
+ let t = Object.getPrototypeOf(e);
1161
+ return t === Object.prototype || t === null;
859
1162
  }
860
- export {
861
- nt as ConfirmDialogLevel,
862
- L as PromptDialogSize,
863
- dt as UiKitOutlet,
864
- vt as createUIKit,
865
- mt as useDialog,
866
- et as useLoading,
867
- _e as useLoadingOverlay,
868
- ft as useToast
869
- };
1163
+ function yt(e) {
1164
+ return e == null || e === "" ? !0 : Array.isArray(e) ? e.length === 0 : e instanceof Date ? Number.isNaN(e.getTime()) : e instanceof Map || e instanceof Set ? e.size === 0 : typeof e == "object" && vt(e) && Object.keys(e).length === 0;
1165
+ }
1166
+ //#endregion
1167
+ //#region lib/internal/toErrorMessage.ts
1168
+ function bt(e, t) {
1169
+ return e instanceof Error ? e.message : typeof e == "string" ? e : typeof e == "object" && e && "message" in e && typeof e.message == "string" ? e.message : t;
1170
+ }
1171
+ //#endregion
1172
+ //#region lib/composables/dialog/components/dialog/presets/FormDialog.vue
1173
+ var xt = /* @__PURE__ */ u({
1174
+ __name: "FormDialog",
1175
+ setup(e) {
1176
+ let { data: t, resolve: n, reject: o } = ot(), { options: c } = W(), u = J(), d = $(t.saveCta, "save"), f = $(t.abortCta, "cancel"), p = r(() => u(c.i18n.messages.saveFailed, !0)), m = r(() => u(c.i18n.messages.unknownError, !0)), g = D(!0), _ = D(null), y = D(ee(t.initialValue) ?? null), b = M(null), x = M(null), S = F("content"), C = ge(), { loading: E, action: O } = ft(I), k = D(!1), j = r(() => !!t.required && b.value === null && yt(y.value)), N = r(() => {
1177
+ let e = { ...t.props };
1178
+ return _t(t.component, "modelValue") && (e.modelValue = y.value, e["onUpdate:modelValue"] = (e) => {
1179
+ y.value = e;
1180
+ }), _t(t.component, "toolbar") && (e.toolbar = x.value), e;
1181
+ }), te = null;
1182
+ function ne(e) {
1183
+ e instanceof HTMLDivElement && (x.value = e);
1184
+ }
1185
+ T(ve, {
1186
+ register(e) {
1187
+ b.value = e;
1188
+ },
1189
+ submit: re,
1190
+ loading: E
1191
+ });
1192
+ async function re() {
1193
+ if (!(E.value || k.value || j.value)) {
1194
+ k.value = !0;
1195
+ try {
1196
+ if (!await C.value.$validate() || !g.value) return;
1197
+ _.value = null, await O();
1198
+ } catch (e) {
1199
+ _.value = bt(e, m.value);
1200
+ } finally {
1201
+ k.value = !1;
1202
+ }
1203
+ }
1204
+ }
1205
+ async function I() {
1206
+ let e = b.value ? await b.value() : y.value;
1207
+ te = t.action ? await t.action(e) : e, g.value = !1;
1208
+ }
1209
+ function ie() {
1210
+ E.value || k.value || (g.value = !1);
1211
+ }
1212
+ function ae() {
1213
+ S.value?.querySelector("input:not([type=hidden]), textarea, select")?.focus();
1214
+ }
1215
+ function oe() {
1216
+ t.required && te === null ? o() : n(te);
1217
+ }
1218
+ return (e, n) => (w(), i(it, {
1219
+ "model-value": g.value,
1220
+ title: P(t).title,
1221
+ "translate-title": P(t).translateTitle,
1222
+ width: P(t).width ?? "md",
1223
+ persistent: P(E) || k.value,
1224
+ form: "",
1225
+ onClose: ie,
1226
+ onSubmit: re,
1227
+ onOpened: ae,
1228
+ onClosed: oe
1229
+ }, {
1230
+ header: L(() => [s("div", {
1231
+ ref: ne,
1232
+ class: "ui-dialog__toolbar"
1233
+ }, null, 512)]),
1234
+ actions: L(() => [l(P(R), {
1235
+ variant: "text",
1236
+ disabled: P(E),
1237
+ onClick: ie
1238
+ }, {
1239
+ default: L(() => [l(Y, {
1240
+ content: P(f).text,
1241
+ translate: P(f).translateText
1242
+ }, null, 8, ["content", "translate"])]),
1243
+ _: 1
1244
+ }, 8, ["disabled"]), l(P(R), {
1245
+ variant: "flat",
1246
+ color: "primary",
1247
+ type: "submit",
1248
+ disabled: j.value,
1249
+ loading: P(E)
1250
+ }, {
1251
+ default: L(() => [l(Y, {
1252
+ content: P(d).text,
1253
+ translate: P(d).translateText
1254
+ }, null, 8, ["content", "translate"])]),
1255
+ _: 1
1256
+ }, 8, ["disabled", "loading"])]),
1257
+ default: L(() => [_.value === null ? a("", !0) : (w(), i(P(ue), {
1258
+ key: 0,
1259
+ type: "error",
1260
+ variant: "tonal",
1261
+ density: "compact",
1262
+ icon: P(Q).error,
1263
+ title: p.value,
1264
+ text: _.value
1265
+ }, null, 8, [
1266
+ "icon",
1267
+ "title",
1268
+ "text"
1269
+ ])), s("div", {
1270
+ ref_key: "content",
1271
+ ref: S,
1272
+ class: "ui-dialog__content"
1273
+ }, [x.value ? (w(), i(A(P(t).component), v(h({ key: 0 }, N.value)), null, 16)) : a("", !0)], 512)]),
1274
+ _: 1
1275
+ }, 8, [
1276
+ "model-value",
1277
+ "title",
1278
+ "translate-title",
1279
+ "width",
1280
+ "persistent"
1281
+ ]));
1282
+ }
1283
+ }), St = ["role"], Ct = { class: "ui-toast__message" }, wt = /* @__PURE__ */ u({
1284
+ __name: "ToastEntry",
1285
+ setup(e) {
1286
+ let t = {
1287
+ [Z.ERROR]: Q.error,
1288
+ [Z.SUCCESS]: Q.success,
1289
+ [Z.INFO]: Q.info,
1290
+ [Z.WARNING]: Q.warning
1291
+ }, { entry: n, close: c, trigger: u } = ut(), { options: d } = W(), f = J(), p = r(() => f(d.i18n.messages.close, !0)), m = r(() => t[n.type]), h = r(() => n.type === Z.ERROR ? "alert" : void 0);
1292
+ return (e, t) => (w(), o("div", {
1293
+ class: "ui-toast",
1294
+ role: h.value
1295
+ }, [
1296
+ l(P(pe), {
1297
+ icon: m.value,
1298
+ size: "20",
1299
+ class: "ui-toast__icon"
1300
+ }, null, 8, ["icon"]),
1301
+ s("span", Ct, [l(Y, {
1302
+ content: P(n).message,
1303
+ translate: P(n).translateMessage
1304
+ }, null, 8, ["content", "translate"])]),
1305
+ P(n).action ? (w(), i(P(R), {
1306
+ key: 0,
1307
+ variant: "text",
1308
+ size: "small",
1309
+ class: "ui-toast__action",
1310
+ onClick: P(u)
1311
+ }, {
1312
+ default: L(() => [l(Y, {
1313
+ content: P(n).action.text,
1314
+ translate: P(n).action.translateText ?? !0
1315
+ }, null, 8, ["content", "translate"])]),
1316
+ _: 1
1317
+ }, 8, ["onClick"])) : a("", !0),
1318
+ l(P(R), {
1319
+ variant: "text",
1320
+ size: "small",
1321
+ icon: P(Q).close,
1322
+ "aria-label": p.value,
1323
+ class: "ui-toast__close",
1324
+ onClick: P(c)
1325
+ }, null, 8, [
1326
+ "icon",
1327
+ "aria-label",
1328
+ "onClick"
1329
+ ])
1330
+ ], 8, St));
1331
+ }
1332
+ }), Tt = () => ({
1333
+ loading: {
1334
+ delay: 2e3,
1335
+ overlay: !1
1336
+ },
1337
+ toast: {
1338
+ timeout: 4e3,
1339
+ errorTimeout: !1
1340
+ },
1341
+ dialog: { closeOnOverlayClick: !0 },
1342
+ i18n: { messages: {
1343
+ yes: "common.yes",
1344
+ no: "common.no",
1345
+ cancel: "action.cancel",
1346
+ close: "action.close",
1347
+ save: "action.save",
1348
+ saveFailed: "dialog.saveFailed",
1349
+ unknownError: "error.unknown",
1350
+ expand: "action.expand",
1351
+ collapse: "action.collapse"
1352
+ } },
1353
+ components: {
1354
+ dialog: {
1355
+ info: m(mt),
1356
+ confirm: m(gt),
1357
+ form: m(xt)
1358
+ },
1359
+ toast: m(wt)
1360
+ }
1361
+ });
1362
+ //#endregion
1363
+ //#region lib/plugin/helper/resolvePluginOptions.ts
1364
+ function Et(e = {}) {
1365
+ let { components: t, ...n } = e, r = Tt(), i = B(r, n);
1366
+ return i.components = {
1367
+ dialog: {
1368
+ info: m(t?.dialog?.info ?? r.components.dialog.info),
1369
+ confirm: m(t?.dialog?.confirm ?? r.components.dialog.confirm),
1370
+ form: m(t?.dialog?.form ?? r.components.dialog.form)
1371
+ },
1372
+ toast: m(t?.toast ?? r.components.toast)
1373
+ }, i;
1374
+ }
1375
+ //#endregion
1376
+ //#region lib/plugin/helper/createPluginContext.ts
1377
+ function Dt(e) {
1378
+ return {
1379
+ dialogQueue: D([]),
1380
+ toastQueue: D([]),
1381
+ toastTimers: /* @__PURE__ */ new Map(),
1382
+ loadingOverlay: D(!1),
1383
+ options: e
1384
+ };
1385
+ }
1386
+ //#endregion
1387
+ //#region lib/plugin/createUIKit.ts
1388
+ function Ot(e) {
1389
+ return (t) => {
1390
+ t.provide(U, Dt(Et(e)));
1391
+ };
1392
+ }
1393
+ //#endregion
1394
+ export { ct as ConfirmDialogLevel, Z as ToastType, Ze as UiBottomSheet, Ee as UiKitOutlet, it as UiResponsiveDialog, Ot as createUIKit, at as useDialog, ot as useDialogEntry, st as useDialogForm, ft as useLoading, we as useLoadingOverlay, lt as useToast, ut as useToastEntry };