@aerogel/core 0.0.0-next.c29ffcd25bffdbed37ecce3aac1ba14cde3e9d39 → 0.0.0-next.c33ad773d3eb977461630ff22012d99eeedf46cb

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.
Files changed (175) hide show
  1. package/dist/aerogel-core.d.ts +1840 -1813
  2. package/dist/aerogel-core.js +3129 -0
  3. package/dist/aerogel-core.js.map +1 -0
  4. package/package.json +27 -37
  5. package/src/bootstrap/bootstrap.test.ts +4 -7
  6. package/src/bootstrap/index.ts +14 -15
  7. package/src/bootstrap/options.ts +1 -1
  8. package/src/components/{AGAppLayout.vue → AppLayout.vue} +4 -4
  9. package/src/components/{AGAppModals.vue → AppModals.vue} +3 -4
  10. package/src/components/{AGAppOverlays.vue → AppOverlays.vue} +5 -10
  11. package/src/components/AppToasts.vue +16 -0
  12. package/src/components/composition.ts +1 -1
  13. package/src/components/contracts/AlertModal.ts +4 -0
  14. package/src/components/contracts/Button.ts +16 -0
  15. package/src/components/contracts/ConfirmModal.ts +41 -0
  16. package/src/components/contracts/DropdownMenu.ts +11 -0
  17. package/src/components/contracts/ErrorReportModal.ts +29 -0
  18. package/src/components/contracts/Input.ts +26 -0
  19. package/src/components/contracts/LoadingModal.ts +18 -0
  20. package/src/components/contracts/Modal.ts +13 -0
  21. package/src/components/contracts/PromptModal.ts +28 -0
  22. package/src/components/contracts/Select.ts +33 -0
  23. package/src/components/contracts/Toast.ts +13 -0
  24. package/src/components/contracts/index.ts +9 -0
  25. package/src/components/contracts/shared.ts +9 -0
  26. package/src/components/headless/HeadlessButton.vue +50 -0
  27. package/src/components/headless/HeadlessInput.vue +59 -0
  28. package/src/components/headless/{forms/AGHeadlessInputDescription.vue → HeadlessInputDescription.vue} +7 -8
  29. package/src/components/headless/{forms/AGHeadlessInputError.vue → HeadlessInputError.vue} +4 -8
  30. package/src/components/headless/{forms/AGHeadlessInputInput.vue → HeadlessInputInput.vue} +13 -22
  31. package/src/components/headless/{forms/AGHeadlessInputLabel.vue → HeadlessInputLabel.vue} +3 -7
  32. package/src/components/headless/{forms/AGHeadlessInputTextArea.vue → HeadlessInputTextArea.vue} +8 -11
  33. package/src/components/headless/{modals/AGHeadlessModal.vue → HeadlessModal.vue} +17 -23
  34. package/src/components/headless/HeadlessModalContent.vue +24 -0
  35. package/src/components/headless/HeadlessModalOverlay.vue +12 -0
  36. package/src/components/headless/HeadlessModalTitle.vue +12 -0
  37. package/src/components/headless/HeadlessSelect.vue +92 -0
  38. package/src/components/headless/{forms/AGHeadlessSelectError.vue → HeadlessSelectError.vue} +5 -6
  39. package/src/components/headless/HeadlessSelectLabel.vue +25 -0
  40. package/src/components/headless/HeadlessSelectOption.vue +34 -0
  41. package/src/components/headless/HeadlessSelectOptions.vue +30 -0
  42. package/src/components/headless/HeadlessSelectTrigger.vue +22 -0
  43. package/src/components/headless/HeadlessSelectValue.vue +15 -0
  44. package/src/components/headless/HeadlessToast.vue +18 -0
  45. package/src/components/headless/HeadlessToastAction.vue +13 -0
  46. package/src/components/headless/index.ts +18 -3
  47. package/src/components/index.ts +4 -10
  48. package/src/components/ui/AdvancedOptions.vue +18 -0
  49. package/src/components/ui/AlertModal.vue +13 -0
  50. package/src/components/ui/Button.vue +98 -0
  51. package/src/components/ui/Checkbox.vue +56 -0
  52. package/src/components/ui/ConfirmModal.vue +42 -0
  53. package/src/components/ui/DropdownMenu.vue +33 -0
  54. package/src/components/ui/EditableContent.vue +82 -0
  55. package/src/components/ui/ErrorMessage.vue +15 -0
  56. package/src/components/ui/ErrorReportModal.vue +62 -0
  57. package/src/components/{modals/AGErrorReportModalButtons.vue → ui/ErrorReportModalButtons.vue} +34 -27
  58. package/src/components/ui/ErrorReportModalTitle.vue +24 -0
  59. package/src/components/{forms/AGForm.vue → ui/Form.vue} +4 -5
  60. package/src/components/ui/Input.vue +56 -0
  61. package/src/components/ui/Link.vue +12 -0
  62. package/src/components/ui/LoadingModal.vue +32 -0
  63. package/src/components/ui/Markdown.vue +69 -0
  64. package/src/components/ui/Modal.vue +70 -0
  65. package/src/components/{modals/AGModalContext.vue → ui/ModalContext.vue} +7 -9
  66. package/src/components/ui/ProgressBar.vue +50 -0
  67. package/src/components/ui/PromptModal.vue +35 -0
  68. package/src/components/ui/Select.vue +53 -0
  69. package/src/components/{lib/AGStartupCrash.vue → ui/StartupCrash.vue} +8 -8
  70. package/src/components/ui/Toast.vue +42 -0
  71. package/src/components/ui/index.ts +23 -0
  72. package/src/components/utils.ts +106 -9
  73. package/src/directives/index.ts +9 -5
  74. package/src/directives/measure.ts +1 -1
  75. package/src/errors/Errors.state.ts +1 -1
  76. package/src/errors/Errors.ts +17 -18
  77. package/src/errors/index.ts +9 -6
  78. package/src/errors/utils.ts +1 -1
  79. package/src/forms/{Form.test.ts → FormController.test.ts} +5 -4
  80. package/src/forms/{Form.ts → FormController.ts} +22 -19
  81. package/src/forms/composition.ts +4 -4
  82. package/src/forms/index.ts +2 -2
  83. package/src/forms/utils.ts +2 -2
  84. package/src/index.css +41 -0
  85. package/src/jobs/Job.ts +2 -2
  86. package/src/lang/DefaultLangProvider.ts +7 -4
  87. package/src/lang/Lang.state.ts +1 -1
  88. package/src/lang/Lang.ts +1 -1
  89. package/src/lang/index.ts +8 -6
  90. package/src/plugins/Plugin.ts +1 -1
  91. package/src/plugins/index.ts +10 -7
  92. package/src/services/App.state.ts +4 -3
  93. package/src/services/App.ts +4 -4
  94. package/src/services/Cache.ts +1 -1
  95. package/src/services/Events.ts +2 -2
  96. package/src/services/Service.ts +21 -21
  97. package/src/services/Storage.ts +3 -3
  98. package/src/services/index.ts +5 -4
  99. package/src/services/utils.ts +2 -2
  100. package/src/testing/index.ts +4 -3
  101. package/src/testing/setup.ts +3 -19
  102. package/src/ui/UI.state.ts +12 -7
  103. package/src/ui/UI.ts +63 -58
  104. package/src/ui/index.ts +18 -18
  105. package/src/utils/composition/events.ts +2 -2
  106. package/src/utils/composition/forms.ts +4 -3
  107. package/src/utils/markdown.ts +3 -5
  108. package/src/utils/vdom.ts +31 -0
  109. package/src/utils/vue.ts +7 -16
  110. package/dist/aerogel-core.cjs.js +0 -2
  111. package/dist/aerogel-core.cjs.js.map +0 -1
  112. package/dist/aerogel-core.esm.js +0 -2
  113. package/dist/aerogel-core.esm.js.map +0 -1
  114. package/histoire.config.ts +0 -7
  115. package/noeldemartin.config.js +0 -5
  116. package/postcss.config.js +0 -6
  117. package/src/assets/histoire.css +0 -3
  118. package/src/components/AGAppSnackbars.vue +0 -13
  119. package/src/components/constants.ts +0 -8
  120. package/src/components/forms/AGButton.vue +0 -44
  121. package/src/components/forms/AGCheckbox.vue +0 -41
  122. package/src/components/forms/AGInput.vue +0 -40
  123. package/src/components/forms/AGSelect.story.vue +0 -46
  124. package/src/components/forms/AGSelect.vue +0 -60
  125. package/src/components/forms/index.ts +0 -5
  126. package/src/components/headless/forms/AGHeadlessButton.ts +0 -3
  127. package/src/components/headless/forms/AGHeadlessButton.vue +0 -62
  128. package/src/components/headless/forms/AGHeadlessInput.ts +0 -34
  129. package/src/components/headless/forms/AGHeadlessInput.vue +0 -70
  130. package/src/components/headless/forms/AGHeadlessSelect.ts +0 -42
  131. package/src/components/headless/forms/AGHeadlessSelect.vue +0 -77
  132. package/src/components/headless/forms/AGHeadlessSelectButton.vue +0 -24
  133. package/src/components/headless/forms/AGHeadlessSelectLabel.vue +0 -24
  134. package/src/components/headless/forms/AGHeadlessSelectOption.ts +0 -4
  135. package/src/components/headless/forms/AGHeadlessSelectOption.vue +0 -39
  136. package/src/components/headless/forms/AGHeadlessSelectOptions.ts +0 -3
  137. package/src/components/headless/forms/composition.ts +0 -10
  138. package/src/components/headless/forms/index.ts +0 -18
  139. package/src/components/headless/modals/AGHeadlessModal.ts +0 -36
  140. package/src/components/headless/modals/AGHeadlessModalPanel.vue +0 -32
  141. package/src/components/headless/modals/AGHeadlessModalTitle.vue +0 -23
  142. package/src/components/headless/modals/index.ts +0 -4
  143. package/src/components/headless/snackbars/AGHeadlessSnackbar.vue +0 -10
  144. package/src/components/headless/snackbars/index.ts +0 -40
  145. package/src/components/interfaces.ts +0 -24
  146. package/src/components/lib/AGErrorMessage.vue +0 -16
  147. package/src/components/lib/AGLink.vue +0 -9
  148. package/src/components/lib/AGMarkdown.vue +0 -54
  149. package/src/components/lib/AGMeasured.vue +0 -16
  150. package/src/components/lib/AGProgressBar.vue +0 -45
  151. package/src/components/lib/index.ts +0 -6
  152. package/src/components/modals/AGAlertModal.ts +0 -18
  153. package/src/components/modals/AGAlertModal.vue +0 -14
  154. package/src/components/modals/AGConfirmModal.ts +0 -42
  155. package/src/components/modals/AGConfirmModal.vue +0 -26
  156. package/src/components/modals/AGErrorReportModal.ts +0 -49
  157. package/src/components/modals/AGErrorReportModal.vue +0 -54
  158. package/src/components/modals/AGErrorReportModalTitle.vue +0 -25
  159. package/src/components/modals/AGLoadingModal.ts +0 -29
  160. package/src/components/modals/AGLoadingModal.vue +0 -15
  161. package/src/components/modals/AGModal.ts +0 -11
  162. package/src/components/modals/AGModal.vue +0 -39
  163. package/src/components/modals/AGModalContext.ts +0 -8
  164. package/src/components/modals/AGModalTitle.vue +0 -9
  165. package/src/components/modals/AGPromptModal.ts +0 -41
  166. package/src/components/modals/AGPromptModal.vue +0 -34
  167. package/src/components/modals/index.ts +0 -17
  168. package/src/components/snackbars/AGSnackbar.vue +0 -36
  169. package/src/components/snackbars/index.ts +0 -3
  170. package/src/directives/initial-focus.ts +0 -11
  171. package/src/main.histoire.ts +0 -1
  172. package/tailwind.config.js +0 -4
  173. package/tsconfig.json +0 -11
  174. package/vite.config.ts +0 -17
  175. /package/src/{main.ts → index.ts} +0 -0
@@ -0,0 +1,3129 @@
1
+ var mt = Object.defineProperty;
2
+ var ft = (t, r, e) => r in t ? mt(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
3
+ var _ = (t, r, e) => ft(t, typeof r != "symbol" ? r + "" : r, e);
4
+ import { ref as H, computed as p, watch as ke, inject as se, reactive as oe, markRaw as Le, nextTick as ze, createElementBlock as v, openBlock as l, createElementVNode as y, Comment as ht, Text as gt, Static as vt, defineComponent as g, useAttrs as Be, useSlots as Se, createBlock as h, h as bt, unref as i, mergeProps as I, withCtx as f, renderSlot as w, onUnmounted as ue, createPropsRestProxy as Z, createVNode as m, provide as ce, toRef as Te, resolveDynamicComponent as X, normalizeProps as de, guardReactiveProps as pe, createCommentVNode as M, useTemplateRef as me, normalizeClass as P, toDisplayString as x, watchEffect as Me, withModifiers as qe, readonly as Ee, Fragment as q, renderList as U, withDirectives as De, vModelCheckbox as yt, createTextVNode as A, normalizeStyle as _t, createApp as wt, customRef as $t, onMounted as xt, toRaw as Ct, vModelText as kt } from "vue";
5
+ import { JSError as fe, tap as K, MagicObject as Fe, PromisedValue as O, Storage as D, objectOnly as Y, arrayFrom as Ue, isEmpty as be, objectDeepClone as St, fail as W, facade as J, arrayRemove as we, getEnv as Mt, updateLocationQueryParameters as Et, forever as Pt, toString as z, isDevelopment as G, isTesting as Pe, after as Ve, uuid as te, required as Ht, isObject as ie, objectWithoutEmpty as Ne, stringMatchAll as It, isInstanceOf as Lt, stringExcerpt as Tt, objectWithout as Vt, noop as jt, value as At, ListenersManager as Rt, toError as zt, round as Bt } from "@noeldemartin/utils";
6
+ import Q from "virtual:aerogel";
7
+ import { createPinia as qt, setActivePinia as Dt, defineStore as Ft } from "pinia";
8
+ import Ut from "dompurify";
9
+ import { marked as Nt, Renderer as je } from "marked";
10
+ import { Primitive as Ot, DialogRoot as Wt, DialogPortal as Kt, DialogContent as Jt, DialogOverlay as Qt, DialogTitle as Gt, ToastClose as Zt, ToastRoot as Xt, ToastProvider as Yt, ToastViewport as er, SelectValue as tr, SelectTrigger as rr, SelectIcon as sr, SelectItem as nr, SelectItemText as ar, SelectPortal as or, SelectContent as ir, SelectViewport as lr, SelectRoot as ur, Label as cr, DropdownMenuRoot as dr, DropdownMenuTrigger as pr, DropdownMenuPortal as mr, DropdownMenuContent as fr, DropdownMenuItem as hr } from "reka-ui";
11
+ import gr from "clsx";
12
+ import { cva as vr } from "class-variance-authority";
13
+ import { twMerge as br } from "tailwind-merge";
14
+ class $e extends fe {
15
+ constructor(r, e) {
16
+ super(`Service '${r}' failed booting`, { cause: e });
17
+ }
18
+ }
19
+ let He = null;
20
+ function Oe() {
21
+ return He ?? yr();
22
+ }
23
+ function yr() {
24
+ return K(qt(), (t) => {
25
+ He = t, Dt(t);
26
+ });
27
+ }
28
+ function _r() {
29
+ return He ?? Oe();
30
+ }
31
+ function wr(t, r) {
32
+ return Oe(), Ft(t, r)();
33
+ }
34
+ function he(t) {
35
+ var r;
36
+ return r = class extends ge {
37
+ usesStore() {
38
+ return !0;
39
+ }
40
+ getName() {
41
+ return t.name ?? null;
42
+ }
43
+ getInitialState() {
44
+ return typeof t.initialState == "function" ? t.initialState() : Object.entries(t.initialState).reduce((e, [s, n]) => {
45
+ try {
46
+ n = structuredClone(n);
47
+ } catch {
48
+ console.warn(
49
+ `Could not clone '${s}' state from ${this.getName()} service, this may cause problems if you're using multiple instances of the service (for example, in unit tests).
50
+ To fix this problem, declare your initialState as a function instead.`
51
+ );
52
+ }
53
+ return e[s] = n, e;
54
+ }, {});
55
+ }
56
+ getComputedStateDefinition() {
57
+ return t.computed ?? {};
58
+ }
59
+ getStateWatchers() {
60
+ return t.watch ?? {};
61
+ }
62
+ serializePersistedState(e) {
63
+ var s;
64
+ return ((s = t.serialize) == null ? void 0 : s.call(t, e)) ?? e;
65
+ }
66
+ deserializePersistedState(e) {
67
+ var s;
68
+ return ((s = t.restore) == null ? void 0 : s.call(t, e)) ?? e;
69
+ }
70
+ }, _(r, "persist", t.persist ?? []), r;
71
+ }
72
+ var _e;
73
+ let ge = (_e = class extends Fe {
74
+ constructor() {
75
+ super();
76
+ _(this, "_name");
77
+ _(this, "_booted");
78
+ _(this, "_computedStateKeys");
79
+ _(this, "_watchers");
80
+ _(this, "_store");
81
+ const e = this.getComputedStateDefinition();
82
+ this._name = this.getName() ?? new.target.name, this._booted = new O(), this._computedStateKeys = new Set(Object.keys(e)), this._watchers = this.getStateWatchers(), this._store = this.usesStore() && wr(this._name, {
83
+ state: () => this.getInitialState(),
84
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
85
+ getters: e
86
+ });
87
+ }
88
+ get booted() {
89
+ return this._booted;
90
+ }
91
+ static(e) {
92
+ return super.static(e);
93
+ }
94
+ launch() {
95
+ const e = (s) => this._booted.reject(new $e(this._name, s));
96
+ try {
97
+ this.frameworkBoot().then(() => this.boot()).then(() => this._booted.resolve()).catch(e);
98
+ } catch (s) {
99
+ e(s);
100
+ }
101
+ return this._booted;
102
+ }
103
+ hasPersistedState() {
104
+ return D.has(this._name);
105
+ }
106
+ hasState(e) {
107
+ return this._store ? e in this._store.$state || this._computedStateKeys.has(e) : !1;
108
+ }
109
+ getState(e) {
110
+ const s = this._store;
111
+ return e ? s ? s[e] : void 0 : s || {};
112
+ }
113
+ setState(e, s) {
114
+ if (!this._store)
115
+ return;
116
+ const n = typeof e == "string" ? { [e]: s } : e, a = Y(this._store.$state, Object.keys(n));
117
+ Object.assign(this._store.$state, n), this.onStateUpdated(n, a);
118
+ }
119
+ updatePersistedState(e) {
120
+ if (!this._store)
121
+ return;
122
+ const s = Ue(e), n = Y(this._store.$state, s);
123
+ be(n) || this.onPersistentStateUpdated(n);
124
+ }
125
+ __get(e) {
126
+ return this.hasState(e) ? this.getState(e) : super.__get(e);
127
+ }
128
+ __set(e, s) {
129
+ this.setState({ [e]: s });
130
+ }
131
+ onStateUpdated(e, s) {
132
+ const n = Y(e, this.static("persist"));
133
+ be(n) || this.onPersistentStateUpdated(n);
134
+ for (const a in e) {
135
+ const o = this._watchers[a];
136
+ !o || e[a] === s[a] || o.call(this, e[a], s[a]);
137
+ }
138
+ }
139
+ onPersistentStateUpdated(e) {
140
+ const s = D.get(this._name);
141
+ s && D.set(this._name, {
142
+ ...s,
143
+ ...this.serializePersistedState(St(e))
144
+ });
145
+ }
146
+ usesStore() {
147
+ return !1;
148
+ }
149
+ getName() {
150
+ return null;
151
+ }
152
+ getInitialState() {
153
+ return {};
154
+ }
155
+ getComputedStateDefinition() {
156
+ return {};
157
+ }
158
+ getStateWatchers() {
159
+ return {};
160
+ }
161
+ serializePersistedState(e) {
162
+ return e;
163
+ }
164
+ deserializePersistedState(e) {
165
+ return e;
166
+ }
167
+ async frameworkBoot() {
168
+ this.restorePersistedState();
169
+ }
170
+ async boot() {
171
+ }
172
+ restorePersistedState() {
173
+ if (!(!this.usesStore() || be(this.static("persist")))) {
174
+ if (D.has(this._name)) {
175
+ const e = D.require(this._name);
176
+ this.setState(this.deserializePersistedState(e));
177
+ return;
178
+ }
179
+ D.set(this._name, Y(this.getState(), this.static("persist")));
180
+ }
181
+ }
182
+ requireStore() {
183
+ return this._store ? this._store : W(`Failed getting '${this._name}' store`);
184
+ }
185
+ }, _(_e, "persist", []), _e);
186
+ const oa = {
187
+ Low: -256,
188
+ Default: 0,
189
+ High: 256
190
+ };
191
+ class $r extends ge {
192
+ constructor() {
193
+ super(...arguments);
194
+ _(this, "listeners", {});
195
+ }
196
+ async boot() {
197
+ Object.entries(globalThis.__aerogelEvents__ ?? {}).forEach(([e, s]) => this.on(e, s));
198
+ }
199
+ async emit(e, s) {
200
+ var a;
201
+ const n = this.listeners[e] ?? { priorities: [], handlers: {} };
202
+ for (const o of n.priorities)
203
+ await Promise.all(((a = n.handlers[o]) == null ? void 0 : a.map((u) => u(s))) ?? []);
204
+ }
205
+ // prettier-ignore
206
+ /* eslint-enable max-len */
207
+ on(e, s, n) {
208
+ const a = typeof s == "function" ? {} : typeof s == "number" ? { priority: s } : s, o = typeof s == "function" ? s : n;
209
+ return this.registerListener(e, a, o), () => this.off(e, o);
210
+ }
211
+ // prettier-ignore
212
+ /* eslint-enable max-len */
213
+ once(e, s, n) {
214
+ let a = null;
215
+ const o = typeof s == "function" ? {} : s, u = typeof s == "function" ? s : n;
216
+ return K(
217
+ () => a && this.off(e, a),
218
+ (c) => {
219
+ a = (...d) => (c(), u(...d)), this.registerListener(e, o, u);
220
+ }
221
+ );
222
+ }
223
+ off(e, s) {
224
+ var o;
225
+ const n = this.listeners[e];
226
+ if (!n)
227
+ return;
228
+ const a = [...n.priorities];
229
+ for (const u of a)
230
+ we(n.handlers[u] ?? [], s), ((o = n.handlers[u]) == null ? void 0 : o.length) === 0 && (delete n.handlers[u], we(n.priorities, u));
231
+ n.priorities.length === 0 && delete this.listeners[e];
232
+ }
233
+ registerListener(e, s, n) {
234
+ var c, d, b;
235
+ const a = s.priority ?? 0;
236
+ e in this.listeners || (this.listeners[e] = { priorities: [], handlers: {} });
237
+ const o = ((c = this.listeners[e]) == null ? void 0 : c.priorities) ?? W(`priorities missing for event '${e}'`), u = ((d = this.listeners[e]) == null ? void 0 : d.handlers) ?? W(`handlers missing for event '${e}'`);
238
+ o.includes(a) || (o.push(a), o.sort(($, k) => k - $), u[a] = []), (b = u[a]) == null || b.push(n);
239
+ }
240
+ }
241
+ const S = J($r), xr = he({
242
+ name: "app",
243
+ initialState: {
244
+ plugins: {},
245
+ instance: null,
246
+ environment: Mt() ?? "development",
247
+ version: Q.version,
248
+ sourceUrl: Q.sourceUrl
249
+ },
250
+ computed: {
251
+ development: (t) => t.environment === "development",
252
+ staging: (t) => t.environment === "staging",
253
+ testing: (t) => t.environment === "test" || t.environment === "testing",
254
+ versionName(t) {
255
+ return this.development ? "dev." + Q.sourceHash.toString().substring(0, 7) : this.staging ? "staging." + Q.sourceHash.toString().substring(0, 7) : `v${t.version}`;
256
+ },
257
+ versionUrl(t) {
258
+ return t.sourceUrl + (this.development || this.staging ? `/tree/${Q.sourceHash}` : `/releases/tag/${this.versionName}`);
259
+ }
260
+ }
261
+ });
262
+ class Cr extends xr {
263
+ constructor() {
264
+ super(...arguments);
265
+ _(this, "name", Q.name);
266
+ _(this, "ready", new O());
267
+ _(this, "mounted", new O());
268
+ }
269
+ isReady() {
270
+ return this.ready.isResolved();
271
+ }
272
+ isMounted() {
273
+ return this.mounted.isResolved();
274
+ }
275
+ async whenReady(e) {
276
+ return await this.ready.then(e);
277
+ }
278
+ async reload(e) {
279
+ e && Et(e), location.reload(), await Pt();
280
+ }
281
+ plugin(e) {
282
+ return this.plugins[e] ?? null;
283
+ }
284
+ service(e) {
285
+ var s;
286
+ return ((s = this.instance) == null ? void 0 : s.config.globalProperties[e]) ?? null;
287
+ }
288
+ async boot() {
289
+ S.once("application-ready", () => this.ready.resolve()), S.once("application-mounted", () => this.mounted.resolve());
290
+ }
291
+ }
292
+ const F = J(Cr);
293
+ function ia(t) {
294
+ return t;
295
+ }
296
+ async function kr(t, ...r) {
297
+ F.setState(
298
+ "plugins",
299
+ t.reduce(
300
+ (e, s) => (s.name && (e[s.name] = s), e),
301
+ {}
302
+ )
303
+ ), await Promise.all(t.map((e) => e.install(...r)) ?? []);
304
+ }
305
+ function la(t) {
306
+ return {
307
+ type: Array,
308
+ default: t ?? (() => [])
309
+ };
310
+ }
311
+ function ua(t = !1) {
312
+ return {
313
+ type: Boolean,
314
+ default: t
315
+ };
316
+ }
317
+ function ca(t) {
318
+ const r = H(), e = p(t);
319
+ return ke(e, async () => r.value = await e.value, { immediate: !0 }), r;
320
+ }
321
+ function da(t) {
322
+ return t;
323
+ }
324
+ function pa(t, r) {
325
+ const e = Object.values(t);
326
+ return {
327
+ type: String,
328
+ default: r ?? e[0] ?? null,
329
+ validator: (s) => e.includes(s)
330
+ };
331
+ }
332
+ function Sr(t) {
333
+ const r = se(t);
334
+ return r ? oe(r) : void 0;
335
+ }
336
+ function j(t, r) {
337
+ return Sr(t) ?? W(r ?? `Could not resolve '${z(t)}' injection key`);
338
+ }
339
+ function ma(t, r) {
340
+ return se(t) ?? W(r ?? `Could not resolve '${z(t)}' injection key`);
341
+ }
342
+ function fa() {
343
+ return {
344
+ type: Function,
345
+ default: null
346
+ };
347
+ }
348
+ function ha(t, r) {
349
+ return {
350
+ type: t,
351
+ default: r ?? null
352
+ };
353
+ }
354
+ function ga(t = null) {
355
+ return {
356
+ type: Number,
357
+ default: t
358
+ };
359
+ }
360
+ function va(t = null) {
361
+ return {
362
+ type: Object,
363
+ default: t
364
+ };
365
+ }
366
+ function ba() {
367
+ return {
368
+ type: Array,
369
+ required: !0
370
+ };
371
+ }
372
+ function ya(t) {
373
+ const r = Object.values(t);
374
+ return {
375
+ type: String,
376
+ required: !0,
377
+ validator: (e) => r.includes(e)
378
+ };
379
+ }
380
+ function _a(t) {
381
+ return {
382
+ type: t,
383
+ required: !0
384
+ };
385
+ }
386
+ function wa() {
387
+ return {
388
+ type: Number,
389
+ required: !0
390
+ };
391
+ }
392
+ function $a() {
393
+ return {
394
+ type: Object,
395
+ required: !0
396
+ };
397
+ }
398
+ function xa() {
399
+ return {
400
+ type: String,
401
+ required: !0
402
+ };
403
+ }
404
+ function Ca(t = null) {
405
+ return {
406
+ type: String,
407
+ default: t
408
+ };
409
+ }
410
+ const ye = /* @__PURE__ */ new WeakMap(), Mr = {
411
+ mounted(t, { value: r }) {
412
+ const e = typeof r == "function" ? r : null, s = () => {
413
+ const n = t.getBoundingClientRect();
414
+ t.style.setProperty("--width", `${n.width}px`), t.style.setProperty("--height", `${n.height}px`), e == null || e({ width: n.width, height: n.height });
415
+ };
416
+ ye.set(t, K(new ResizeObserver(s)).observe(t)), s();
417
+ },
418
+ unmounted(t) {
419
+ var r;
420
+ (r = ye.get(t)) == null || r.unobserve(t), ye.delete(t);
421
+ }
422
+ }, Er = {
423
+ measure: Mr
424
+ }, Pr = {
425
+ install(t, r) {
426
+ const e = {
427
+ ...Er,
428
+ ...r.directives
429
+ };
430
+ for (const [s, n] of Object.entries(e))
431
+ t.directive(s, n);
432
+ }
433
+ };
434
+ class Hr extends ge {
435
+ constructor() {
436
+ super(...arguments);
437
+ _(this, "cache");
438
+ }
439
+ async get(e) {
440
+ return await (await this.open()).match(e) ?? null;
441
+ }
442
+ async store(e, s) {
443
+ await (await this.open()).put(e, s);
444
+ }
445
+ async replace(e, s) {
446
+ const n = await this.open();
447
+ (await n.keys(e)).length !== 0 && await n.put(e, s);
448
+ }
449
+ async open() {
450
+ return this.cache = this.cache ?? K(new O(), (e) => {
451
+ caches.open("app").then((s) => e.resolve(s));
452
+ });
453
+ }
454
+ }
455
+ const ka = J(Hr);
456
+ class Ir extends ge {
457
+ async purge() {
458
+ await S.emit("purge-storage");
459
+ }
460
+ }
461
+ const Lr = J(Ir);
462
+ function Sa(t, r) {
463
+ return {
464
+ ...t,
465
+ ...Y(r, Object.keys(t))
466
+ };
467
+ }
468
+ const Tr = {
469
+ $app: F,
470
+ $events: S,
471
+ $storage: Lr
472
+ };
473
+ async function ve(t, r) {
474
+ await Promise.all(
475
+ Object.entries(r).map(async ([e, s]) => {
476
+ await s.launch().catch((n) => {
477
+ var a, o;
478
+ return (o = (a = t.config).errorHandler) == null ? void 0 : o.call(a, n, null, `Failed launching ${e}.`);
479
+ });
480
+ })
481
+ ), Object.assign(t.config.globalProperties, r), (G() || Pe()) && Object.assign(globalThis, r);
482
+ }
483
+ const Vr = {
484
+ async install(t, r) {
485
+ const e = {
486
+ ...Tr,
487
+ ...r.services
488
+ };
489
+ t.use(_r()), await ve(t, e);
490
+ }
491
+ }, We = 768, le = {
492
+ Mobile: "mobile",
493
+ Desktop: "desktop"
494
+ };
495
+ function Ke() {
496
+ return globalThis.innerWidth > We ? le.Desktop : le.Mobile;
497
+ }
498
+ const jr = he({
499
+ name: "ui",
500
+ initialState: {
501
+ modals: [],
502
+ toasts: [],
503
+ layout: Ke()
504
+ },
505
+ computed: {
506
+ mobile: ({ layout: t }) => t === le.Mobile,
507
+ desktop: ({ layout: t }) => t === le.Desktop
508
+ }
509
+ }), E = {
510
+ AlertModal: "alert-modal",
511
+ ConfirmModal: "confirm-modal",
512
+ ErrorReportModal: "error-report-modal",
513
+ LoadingModal: "loading-modal",
514
+ PromptModal: "prompt-modal",
515
+ Toast: "toast",
516
+ StartupCrash: "startup-crash"
517
+ };
518
+ class Ar extends jr {
519
+ constructor() {
520
+ super(...arguments);
521
+ _(this, "modalCallbacks", {});
522
+ _(this, "components", {});
523
+ }
524
+ requireComponent(e) {
525
+ return this.components[e] ?? W(`UI Component '${e}' is not defined!`);
526
+ }
527
+ alert(e, s) {
528
+ const n = () => typeof s != "string" ? { message: e } : {
529
+ title: e,
530
+ message: s
531
+ };
532
+ this.openModal(
533
+ this.requireComponent(E.AlertModal),
534
+ n()
535
+ );
536
+ }
537
+ // prettier-ignore
538
+ /* eslint-enable max-len */
539
+ async confirm(e, s, n) {
540
+ const o = typeof s != "string" ? {
541
+ ...s ?? {},
542
+ message: e,
543
+ required: !!(s != null && s.required)
544
+ } : {
545
+ ...n ?? {},
546
+ title: e,
547
+ message: s,
548
+ required: !!(n != null && n.required)
549
+ }, c = await (await this.openModal(
550
+ this.requireComponent(E.ConfirmModal),
551
+ o
552
+ )).beforeClose, d = typeof c == "object" ? c[0] : c ?? !1, b = typeof c == "object" ? c[1] : Object.entries(o.checkboxes ?? {}).reduce(
553
+ ($, [k, { default: N }]) => ({
554
+ [k]: N ?? !1,
555
+ ...$
556
+ }),
557
+ {}
558
+ );
559
+ for (const [$, k] of Object.entries(o.checkboxes ?? {}))
560
+ if (!(!k.required || b[$]))
561
+ return d && G() && console.warn(`Confirmed confirm modal was suppressed because required '${$}' checkbox was missing`), [!1, b];
562
+ return "checkboxes" in o ? [d, b] : d;
563
+ }
564
+ async prompt(e, s, n) {
565
+ const a = (n == null ? void 0 : n.trim) ?? !0, o = () => typeof s != "string" ? {
566
+ message: e,
567
+ ...s ?? {}
568
+ } : {
569
+ title: e,
570
+ message: s,
571
+ ...n ?? {}
572
+ }, c = await (await this.openModal(
573
+ this.requireComponent(E.PromptModal),
574
+ o()
575
+ )).beforeClose;
576
+ return (a && typeof c == "string" ? c == null ? void 0 : c.trim() : c) ?? null;
577
+ }
578
+ async loading(e, s) {
579
+ const n = (d) => typeof d == "function" ? Promise.resolve(d()) : d, a = () => typeof e == "string" ? {
580
+ props: { message: e },
581
+ operationPromise: n(s)
582
+ } : typeof e == "function" || e instanceof Promise ? { operationPromise: n(e) } : {
583
+ props: e,
584
+ operationPromise: n(s)
585
+ }, { operationPromise: o, props: u } = a(), c = await this.openModal(this.requireComponent(E.LoadingModal), u);
586
+ try {
587
+ const d = await o;
588
+ return await Ve({ ms: 500 }), d;
589
+ } finally {
590
+ await this.closeModal(c.id);
591
+ }
592
+ }
593
+ toast(e, s = {}) {
594
+ const { component: n, ...a } = s, o = {
595
+ id: te(),
596
+ properties: { message: e, ...a },
597
+ component: Le(n ?? this.requireComponent(E.Toast))
598
+ };
599
+ this.setState("toasts", this.toasts.concat(o));
600
+ }
601
+ registerComponent(e, s) {
602
+ this.components[e] = s;
603
+ }
604
+ async openModal(e, s) {
605
+ const n = te(), a = {}, o = {
606
+ id: n,
607
+ properties: s ?? {},
608
+ component: Le(e),
609
+ beforeClose: new Promise((d) => a.willClose = d),
610
+ afterClose: new Promise((d) => a.closed = d)
611
+ }, u = this.modals.at(-1), c = this.modals.concat(o);
612
+ return this.modalCallbacks[o.id] = a, this.setState({ modals: c }), await ze(), await (u && S.emit("hide-modal", { id: u.id })), await Promise.all([
613
+ u || S.emit("show-overlays-backdrop"),
614
+ S.emit("show-modal", { id: o.id })
615
+ ]), o;
616
+ }
617
+ async closeModal(e, s) {
618
+ if (!F.isMounted()) {
619
+ await this.removeModal(e, s);
620
+ return;
621
+ }
622
+ await S.emit("close-modal", { id: e, result: s });
623
+ }
624
+ async closeAllModals() {
625
+ for (; this.modals.length > 0; )
626
+ await this.closeModal(Ht(this.modals[this.modals.length - 1]).id);
627
+ }
628
+ async boot() {
629
+ this.watchModalEvents(), this.watchMountedEvent(), this.watchViewportBreakpoints();
630
+ }
631
+ async removeModal(e, s) {
632
+ var a, o;
633
+ this.setState(
634
+ "modals",
635
+ this.modals.filter((u) => u.id !== e)
636
+ ), (o = (a = this.modalCallbacks[e]) == null ? void 0 : a.closed) == null || o.call(a, s), delete this.modalCallbacks[e];
637
+ const n = this.modals.at(-1);
638
+ await (n && S.emit("show-modal", { id: n.id }));
639
+ }
640
+ watchModalEvents() {
641
+ S.on("modal-will-close", ({ modal: e, result: s }) => {
642
+ var n, a;
643
+ (a = (n = this.modalCallbacks[e.id]) == null ? void 0 : n.willClose) == null || a.call(n, s), this.modals.length === 1 && S.emit("hide-overlays-backdrop");
644
+ }), S.on("modal-closed", async ({ modal: { id: e }, result: s }) => {
645
+ await this.removeModal(e, s);
646
+ });
647
+ }
648
+ watchMountedEvent() {
649
+ S.once("application-mounted", async () => {
650
+ if (!globalThis.document || !globalThis.getComputedStyle)
651
+ return;
652
+ const e = globalThis.document.getElementById("splash");
653
+ e && (globalThis.getComputedStyle(e).opacity !== "0" && (e.style.opacity = "0", await Ve({ ms: 600 })), e.remove());
654
+ });
655
+ }
656
+ watchViewportBreakpoints() {
657
+ if (!globalThis.matchMedia)
658
+ return;
659
+ globalThis.matchMedia(`(min-width: ${We}px)`).addEventListener("change", () => this.setState({ layout: Ke() }));
660
+ }
661
+ }
662
+ const L = J(Ar);
663
+ class Rr {
664
+ constructor(r, e) {
665
+ this.locale = r, this.fallbackLocale = e;
666
+ }
667
+ getLocale() {
668
+ return this.locale;
669
+ }
670
+ async setLocale(r) {
671
+ this.locale = r;
672
+ }
673
+ getFallbackLocale() {
674
+ return this.fallbackLocale;
675
+ }
676
+ async setFallbackLocale(r) {
677
+ this.fallbackLocale = r;
678
+ }
679
+ getLocales() {
680
+ return ["en"];
681
+ }
682
+ translate(r) {
683
+ return G() && console.warn("Lang provider is missing"), r;
684
+ }
685
+ translateWithDefault(r, e) {
686
+ return G() && console.warn("Lang provider is missing"), e;
687
+ }
688
+ }
689
+ const zr = he({
690
+ name: "lang",
691
+ persist: ["locale", "fallbackLocale"],
692
+ initialState: {
693
+ locale: null,
694
+ locales: ["en"],
695
+ fallbackLocale: "en"
696
+ }
697
+ });
698
+ class Br extends zr {
699
+ constructor() {
700
+ super();
701
+ _(this, "provider");
702
+ this.provider = new Rr(
703
+ this.getState("locale") ?? this.getBrowserLocale(),
704
+ this.getState("fallbackLocale")
705
+ );
706
+ }
707
+ async setProvider(e) {
708
+ this.provider = e, this.locales = e.getLocales(), await e.setLocale(this.locale ?? this.getBrowserLocale()), await e.setFallbackLocale(this.fallbackLocale);
709
+ }
710
+ translate(e, s) {
711
+ return this.provider.translate(e, s) ?? e;
712
+ }
713
+ translateWithDefault(e, s, n = {}) {
714
+ return this.provider.translateWithDefault(e, s, n);
715
+ }
716
+ getBrowserLocale() {
717
+ const e = this.getState("locales");
718
+ return navigator.languages.find((s) => e.includes(s)) ?? "en";
719
+ }
720
+ async boot() {
721
+ globalThis.document && this.requireStore().$subscribe(
722
+ async () => {
723
+ var e, s;
724
+ await this.provider.setLocale(this.locale ?? this.getBrowserLocale()), await this.provider.setFallbackLocale(this.fallbackLocale), this.locale ? (e = document.querySelector("html")) == null || e.setAttribute("lang", this.locale) : (s = document.querySelector("html")) == null || s.removeAttribute("lang");
725
+ },
726
+ { immediate: !0 }
727
+ );
728
+ }
729
+ }
730
+ const re = J(Br), Je = re.translate.bind(re), C = re.translateWithDefault.bind(re), qr = he({
731
+ name: "errors",
732
+ initialState: {
733
+ logs: [],
734
+ startupErrors: []
735
+ },
736
+ computed: {
737
+ hasErrors: ({ logs: t }) => t.length > 0,
738
+ hasNewErrors: ({ logs: t }) => t.some((r) => !r.seen),
739
+ hasStartupErrors: ({ startupErrors: t }) => t.length > 0
740
+ }
741
+ });
742
+ class Dr extends qr {
743
+ constructor() {
744
+ super(...arguments);
745
+ _(this, "forceReporting", !1);
746
+ _(this, "enabled", !0);
747
+ }
748
+ enable() {
749
+ this.enabled = !0;
750
+ }
751
+ disable() {
752
+ this.enabled = !1;
753
+ }
754
+ async inspect(e) {
755
+ const s = Array.isArray(e) ? e : [await this.createErrorReport(e)];
756
+ if (s.length === 0) {
757
+ L.alert(C("errors.inspectEmpty", "Nothing to inspect!"));
758
+ return;
759
+ }
760
+ L.openModal(L.requireComponent(E.ErrorReportModal), {
761
+ reports: s
762
+ });
763
+ }
764
+ async report(e, s) {
765
+ if (await S.emit("error", { error: e, message: s }), Pe("unit") || (G() && this.logError(e), !this.enabled))
766
+ throw e;
767
+ if (!F.isMounted()) {
768
+ const o = await this.createStartupErrorReport(e);
769
+ o && this.setState({ startupErrors: this.startupErrors.concat(o) });
770
+ return;
771
+ }
772
+ const n = await this.createErrorReport(e), a = {
773
+ report: n,
774
+ seen: !1,
775
+ date: /* @__PURE__ */ new Date()
776
+ };
777
+ L.toast(
778
+ s ?? C("errors.notice", "Something went wrong, but it's not your fault. Try again!"),
779
+ {
780
+ variant: "danger",
781
+ actions: [
782
+ {
783
+ label: C("errors.viewDetails", "View details"),
784
+ dismiss: !0,
785
+ click: () => L.openModal(
786
+ L.requireComponent(E.ErrorReportModal),
787
+ { reports: [n] }
788
+ )
789
+ }
790
+ ]
791
+ }
792
+ ), this.setState({ logs: [a].concat(this.logs) });
793
+ }
794
+ see(e) {
795
+ this.setState({
796
+ logs: this.logs.map((s) => s.report !== e ? s : {
797
+ ...s,
798
+ seen: !0
799
+ })
800
+ });
801
+ }
802
+ seeAll() {
803
+ this.setState({
804
+ logs: this.logs.map((e) => ({
805
+ ...e,
806
+ seen: !0
807
+ }))
808
+ });
809
+ }
810
+ logError(e) {
811
+ console.error(e), ie(e) && e.cause && this.logError(e.cause);
812
+ }
813
+ async createErrorReport(e) {
814
+ return typeof e == "string" ? { title: e } : e instanceof Error || e instanceof fe ? this.createErrorReportFromError(e) : ie(e) ? Ne({
815
+ title: z(
816
+ e.name ?? e.title ?? C("errors.unknown", "Unknown Error")
817
+ ),
818
+ description: z(
819
+ e.message ?? e.description ?? C("errors.unknownDescription", "Unknown error object")
820
+ ),
821
+ error: e
822
+ }) : {
823
+ title: C("errors.unknown", "Unknown Error"),
824
+ error: e
825
+ };
826
+ }
827
+ async createStartupErrorReport(e) {
828
+ return e instanceof $e ? e.cause instanceof $e ? null : this.createErrorReport(e.cause) : this.createErrorReport(e);
829
+ }
830
+ createErrorReportFromError(e, s = {}) {
831
+ return {
832
+ title: e.name,
833
+ description: e.message,
834
+ details: e.stack,
835
+ error: e,
836
+ ...s
837
+ };
838
+ }
839
+ }
840
+ const Qe = J(Dr), Ge = [];
841
+ function Ma(t) {
842
+ Ge.push(t);
843
+ }
844
+ function Fr(t) {
845
+ for (const r of Ge) {
846
+ const e = r(t);
847
+ if (e)
848
+ return e;
849
+ }
850
+ return typeof t == "string" ? t : t instanceof Error || t instanceof fe ? t.message : ie(t) ? z(t.message ?? t.description ?? "Unknown error object") : C("errors.unknown", "Unknown Error");
851
+ }
852
+ class Ae extends fe {
853
+ }
854
+ const Ur = { $errors: Qe }, Nr = (t) => (Qe.report(t), !0);
855
+ function Or(t, r = () => !1) {
856
+ const e = (s) => r(s) || Nr(s);
857
+ t.config.errorHandler = e, globalThis.onerror = (s, n, a, o, u) => e(u ?? s), globalThis.onunhandledrejection = (s) => e(s.reason);
858
+ }
859
+ const Wr = {
860
+ async install(t, r) {
861
+ Or(t, r.handleError), await ve(t, Ur);
862
+ }
863
+ }, Kr = { $lang: re }, Jr = {
864
+ async install(t) {
865
+ var r;
866
+ (r = t.config.globalProperties).$t ?? (r.$t = Je), t.config.globalProperties.$td = C, await ve(t, Kr);
867
+ }
868
+ }, Qr = {
869
+ async install() {
870
+ Pe() && (globalThis.testingRuntime = {
871
+ on: (...t) => S.on(...t)
872
+ });
873
+ }
874
+ }, Gr = {
875
+ viewBox: "0 0 20 20",
876
+ width: "1.2em",
877
+ height: "1.2em"
878
+ };
879
+ function Zr(t, r) {
880
+ return l(), v("svg", Gr, r[0] || (r[0] = [
881
+ y("path", {
882
+ fill: "currentColor",
883
+ d: "M10 8.586L2.929 1.515L1.515 2.929L8.586 10l-7.071 7.071l1.414 1.414L10 11.414l7.071 7.071l1.414-1.414L11.414 10l7.071-7.071l-1.414-1.414z"
884
+ }, null, -1)
885
+ ]));
886
+ }
887
+ const Xr = { name: "zondicons-close", render: Zr };
888
+ function Yr() {
889
+ return K(new je(), (t) => {
890
+ t.link = function(r) {
891
+ return je.prototype.link.apply(this, [r]).replace("<a", '<a target="_blank"');
892
+ };
893
+ });
894
+ }
895
+ function es(t) {
896
+ const r = It(t, /<a[^>]*href="#action:([^"]+)"[^>]*>([^<]+)<\/a>/g);
897
+ for (const [e, s, n] of r)
898
+ t = t.replace(e, `<button type="button" data-markdown-action="${s}">${n}</button>`);
899
+ return t;
900
+ }
901
+ function ts(t) {
902
+ let r = Nt(t, { renderer: Yr(), async: !1 });
903
+ return r = rs(r), r = es(r), r;
904
+ }
905
+ function rs(t) {
906
+ return Ut.sanitize(t, { ADD_ATTR: ["target"] });
907
+ }
908
+ function ss(t) {
909
+ return Object.entries(t.props ?? {}).reduce((r, [e, s]) => r + `${e}="${z(s)}"`, "");
910
+ }
911
+ function Ze(t) {
912
+ return typeof t == "string" ? t : t.type === ht ? "" : t.type === gt || t.type === vt ? t.children : t.type === "br" ? `
913
+
914
+ ` : `<${t.type} ${ss(t)}>${Array.from(t.children).map(Ze).join("")}</${t.type}>`;
915
+ }
916
+ const R = /* @__PURE__ */ g({
917
+ __name: "Markdown",
918
+ props: {
919
+ as: {},
920
+ inline: { type: Boolean },
921
+ langKey: {},
922
+ langParams: {},
923
+ langDefault: {},
924
+ text: {},
925
+ actions: {}
926
+ },
927
+ setup(t) {
928
+ const r = Be(), e = Se(), s = p(() => e.default ? e.default().map(Ze).join("") : t.text ?? (t.langKey && (t.langDefault ? C(t.langKey, t.langDefault, t.langParams ?? {}) : Je(t.langKey, t.langParams ?? {})))), n = p(() => {
929
+ if (!s.value)
930
+ return null;
931
+ let u = ts(s.value);
932
+ return t.inline && (u = u.replace("<p>", "<span>").replace("</p>", "</span>")), u;
933
+ }), a = () => bt(t.as ?? (t.inline ? "span" : "div"), {
934
+ innerHTML: n.value,
935
+ onClick: o,
936
+ ...r,
937
+ class: `${r.class ?? ""} ${t.inline ? "" : "prose"}`
938
+ });
939
+ async function o(u) {
940
+ var d, b;
941
+ const { target: c } = u;
942
+ if (Lt(c, HTMLElement) && c.dataset.markdownAction) {
943
+ (b = (d = t.actions) == null ? void 0 : d[c.dataset.markdownAction]) == null || b.call(d);
944
+ return;
945
+ }
946
+ }
947
+ return (u, c) => (l(), h(a));
948
+ }
949
+ }), ns = /* @__PURE__ */ g({
950
+ __name: "HeadlessButton",
951
+ props: {
952
+ class: {},
953
+ disabled: { type: Boolean },
954
+ href: {},
955
+ route: {},
956
+ routeParams: {},
957
+ routeQuery: {},
958
+ size: {},
959
+ submit: { type: Boolean },
960
+ variant: {},
961
+ asChild: { type: Boolean },
962
+ as: {}
963
+ },
964
+ setup(t) {
965
+ const r = p(() => t.as ? { as: t.as } : t.route ? {
966
+ as: "router-link",
967
+ to: Ne({
968
+ name: t.route,
969
+ params: t.routeParams,
970
+ query: t.routeQuery
971
+ })
972
+ } : t.href ? {
973
+ as: "a",
974
+ target: "_blank",
975
+ href: t.href
976
+ } : {
977
+ as: "button",
978
+ type: t.submit ? "submit" : "button"
979
+ });
980
+ return (e, s) => (l(), h(i(Ot), I({
981
+ class: t.class,
982
+ "as-child": e.asChild,
983
+ disabled: e.disabled
984
+ }, r.value), {
985
+ default: f(() => [
986
+ w(e.$slots, "default")
987
+ ]),
988
+ _: 3
989
+ }, 16, ["class", "as-child", "disabled"]));
990
+ }
991
+ });
992
+ function Xe(t, r) {
993
+ return p(() => {
994
+ const { baseClasses: e, ...s } = t, { baseClasses: n, ...a } = r, o = vr(n, a), u = Object.entries(s).reduce((c, [d, b]) => (c[d] = i(b), c), {});
995
+ return T(o(u), i(e));
996
+ });
997
+ }
998
+ function T(...t) {
999
+ return br(gr(t));
1000
+ }
1001
+ function as(t) {
1002
+ if (t instanceof HTMLElement)
1003
+ return t;
1004
+ if (os(t))
1005
+ return t.$el;
1006
+ }
1007
+ function os(t) {
1008
+ return ie(t) && "$el" in t;
1009
+ }
1010
+ function Ye(t, r) {
1011
+ const e = se("form", null), s = e == null ? void 0 : e.on("focus", (n) => t.name === n && r());
1012
+ ue(() => s == null ? void 0 : s());
1013
+ }
1014
+ const V = /* @__PURE__ */ g({
1015
+ __name: "Button",
1016
+ props: {
1017
+ class: {},
1018
+ disabled: { type: Boolean },
1019
+ href: {},
1020
+ route: {},
1021
+ routeParams: {},
1022
+ routeQuery: {},
1023
+ size: {},
1024
+ submit: { type: Boolean },
1025
+ variant: {},
1026
+ asChild: { type: Boolean },
1027
+ as: {}
1028
+ },
1029
+ setup(t) {
1030
+ const r = Z(t, ["class", "size", "variant", "disabled"]), e = Xe(
1031
+ { baseClasses: t.class, variant: t.variant, size: t.size, disabled: t.disabled },
1032
+ {
1033
+ baseClasses: "flex items-center justify-center gap-1 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2",
1034
+ variants: {
1035
+ variant: {
1036
+ default: "bg-primary text-white focus-visible:outline-primary",
1037
+ secondary: "bg-background text-gray-900 ring-gray-300",
1038
+ danger: "bg-danger text-white focus-visible:outline-danger",
1039
+ ghost: "bg-transparent",
1040
+ outline: "bg-transparent text-primary ring-primary",
1041
+ link: "text-primary"
1042
+ },
1043
+ size: {
1044
+ small: "text-xs",
1045
+ default: "text-sm",
1046
+ large: "text-base",
1047
+ icon: "rounded-full p-2.5"
1048
+ },
1049
+ disabled: {
1050
+ false: null,
1051
+ true: "opacity-50 cursor-not-allowed"
1052
+ }
1053
+ },
1054
+ compoundVariants: [
1055
+ {
1056
+ variant: ["default", "secondary", "danger", "ghost", "outline"],
1057
+ class: "font-medium"
1058
+ },
1059
+ {
1060
+ variant: ["default", "danger"],
1061
+ class: "shadow-sm"
1062
+ },
1063
+ {
1064
+ variant: ["secondary", "outline"],
1065
+ class: "ring-1 ring-inset"
1066
+ },
1067
+ {
1068
+ variant: ["default", "secondary", "danger", "ghost", "outline"],
1069
+ size: "small",
1070
+ class: "rounded px-2 py-1"
1071
+ },
1072
+ {
1073
+ variant: ["default", "secondary", "danger", "ghost", "outline"],
1074
+ size: "default",
1075
+ class: "rounded-md px-2.5 py-1.5"
1076
+ },
1077
+ {
1078
+ variant: ["default", "secondary", "danger", "ghost", "outline"],
1079
+ size: "large",
1080
+ class: "rounded-md px-3 py-2"
1081
+ },
1082
+ {
1083
+ variant: "default",
1084
+ disabled: !1,
1085
+ class: "hover:bg-primary/90"
1086
+ },
1087
+ {
1088
+ variant: ["secondary", "ghost", "outline"],
1089
+ disabled: !1,
1090
+ class: "hover:bg-accent"
1091
+ },
1092
+ {
1093
+ variant: "danger",
1094
+ disabled: !1,
1095
+ class: "hover:bg-danger/80"
1096
+ },
1097
+ {
1098
+ variant: "link",
1099
+ disabled: !1,
1100
+ class: "hover:underline"
1101
+ }
1102
+ ],
1103
+ defaultVariants: {
1104
+ variant: "default",
1105
+ size: "default",
1106
+ disabled: !1
1107
+ }
1108
+ }
1109
+ );
1110
+ return (s, n) => (l(), h(ns, I({
1111
+ class: i(e),
1112
+ disabled: s.disabled
1113
+ }, r), {
1114
+ default: f(() => [
1115
+ w(s.$slots, "default")
1116
+ ]),
1117
+ _: 3
1118
+ }, 16, ["class", "disabled"]));
1119
+ }
1120
+ });
1121
+ function ee(t, r) {
1122
+ const e = S.on(t, r);
1123
+ ue(() => e());
1124
+ }
1125
+ const is = /* @__PURE__ */ g({
1126
+ __name: "HeadlessModal",
1127
+ props: {
1128
+ persistent: { type: Boolean },
1129
+ title: {},
1130
+ description: {}
1131
+ },
1132
+ setup(t, { expose: r }) {
1133
+ const e = H(null), s = H(!0), n = H(!1), { modal: a } = j(
1134
+ "modal",
1135
+ "could not obtain modal reference from <HeadlessModal>, did you render this component manually? Show it using $ui.openModal() instead"
1136
+ );
1137
+ async function o() {
1138
+ var d;
1139
+ (d = e.value) != null && d.$el && (s.value = !0);
1140
+ }
1141
+ async function u() {
1142
+ var d;
1143
+ (d = e.value) != null && d.$el && (s.value = !1);
1144
+ }
1145
+ async function c(d) {
1146
+ n.value || (S.emit("modal-will-close", { modal: a, result: d }), await o(), n.value = !0, S.emit("modal-closed", { modal: a, result: d }));
1147
+ }
1148
+ return ee("close-modal", async ({ id: d, result: b }) => {
1149
+ d === a.id && await c(b);
1150
+ }), ee("hide-modal", async ({ id: d }) => {
1151
+ d === a.id && await o();
1152
+ }), ee("show-modal", async ({ id: d }) => {
1153
+ d === a.id && await u();
1154
+ }), r({ close: c }), (d, b) => (l(), h(i(Wt), {
1155
+ ref_key: "$root",
1156
+ ref: e,
1157
+ open: "",
1158
+ "onUpdate:open": b[0] || (b[0] = ($) => d.persistent || c())
1159
+ }, {
1160
+ default: f(() => [
1161
+ m(i(Kt), null, {
1162
+ default: f(() => [
1163
+ w(d.$slots, "default", { close: c })
1164
+ ]),
1165
+ _: 3
1166
+ })
1167
+ ]),
1168
+ _: 3
1169
+ }, 512));
1170
+ }
1171
+ }), et = /* @__PURE__ */ g({
1172
+ __name: "ModalContext",
1173
+ props: {
1174
+ modal: {},
1175
+ childIndex: {}
1176
+ },
1177
+ setup(t) {
1178
+ const r = t, e = p(() => {
1179
+ const s = {};
1180
+ for (const n in r.modal.properties)
1181
+ s[n] = i(r.modal.properties[n]);
1182
+ return s;
1183
+ });
1184
+ return ce("modal", {
1185
+ modal: Te(r, "modal"),
1186
+ childIndex: Te(r, "childIndex")
1187
+ }), (s, n) => (l(), h(X(s.modal.component), de(pe(e.value)), null, 16));
1188
+ }
1189
+ }), ls = /* @__PURE__ */ g({
1190
+ __name: "HeadlessModalContent",
1191
+ setup(t) {
1192
+ const { childIndex: r = 0 } = j(
1193
+ "modal",
1194
+ "could not obtain modal reference from <HeadlessModalContent>, did you render this component manually? Show it using $ui.openModal() instead"
1195
+ ), e = p(() => L.modals[r] ?? null);
1196
+ return (s, n) => (l(), h(i(Jt), null, {
1197
+ default: f(() => [
1198
+ w(s.$slots, "default"),
1199
+ e.value ? (l(), h(et, {
1200
+ key: 0,
1201
+ "child-index": i(r) + 1,
1202
+ modal: e.value
1203
+ }, null, 8, ["child-index", "modal"])) : M("", !0)
1204
+ ]),
1205
+ _: 3
1206
+ }));
1207
+ }
1208
+ }), us = /* @__PURE__ */ g({
1209
+ __name: "HeadlessModalOverlay",
1210
+ props: {
1211
+ forceMount: { type: Boolean },
1212
+ asChild: { type: Boolean },
1213
+ as: {}
1214
+ },
1215
+ setup(t) {
1216
+ return (r, e) => (l(), h(i(Qt), de(pe(r.$props)), {
1217
+ default: f(() => [
1218
+ w(r.$slots, "default")
1219
+ ]),
1220
+ _: 3
1221
+ }, 16));
1222
+ }
1223
+ }), cs = /* @__PURE__ */ g({
1224
+ __name: "HeadlessModalTitle",
1225
+ props: {
1226
+ asChild: { type: Boolean },
1227
+ as: {}
1228
+ },
1229
+ setup(t) {
1230
+ return (r, e) => (l(), h(i(Gt), de(pe(r.$props)), {
1231
+ default: f(() => [
1232
+ w(r.$slots, "default")
1233
+ ]),
1234
+ _: 3
1235
+ }, 16));
1236
+ }
1237
+ }), ds = {
1238
+ key: 0,
1239
+ class: "absolute top-0 right-0 hidden pt-1.5 pr-1.5 sm:block"
1240
+ }, ps = { class: "sr-only" }, ne = /* @__PURE__ */ g({
1241
+ __name: "Modal",
1242
+ props: {
1243
+ persistent: { type: Boolean },
1244
+ title: {},
1245
+ description: {},
1246
+ dismissable: { type: Boolean, default: !0 },
1247
+ wrapperClass: { default: "" },
1248
+ class: { default: "" }
1249
+ },
1250
+ setup(t, { expose: r }) {
1251
+ const e = Z(t, ["class", "dismissable", "wrapperClass", "title", "persistent"]), s = me("$modal"), n = p(() => T({ "mt-2": t.title }, t.class)), a = p(() => T(
1252
+ // eslint-disable-next-line vue/max-len
1253
+ "fixed top-1/2 left-1/2 z-50 w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-lg bg-white px-4 pt-5 pb-4 text-left shadow-xl sm:max-w-lg",
1254
+ t.wrapperClass
1255
+ ));
1256
+ return r({ close: async () => {
1257
+ var o;
1258
+ return (o = s.value) == null ? void 0 : o.close();
1259
+ } }), (o, u) => (l(), h(is, I(e, {
1260
+ ref_key: "$modal",
1261
+ ref: s,
1262
+ persistent: o.persistent
1263
+ }), {
1264
+ default: f(({ close: c }) => [
1265
+ m(us, { class: "fixed inset-0 bg-gray-500/75" }),
1266
+ m(ls, {
1267
+ class: P(a.value)
1268
+ }, {
1269
+ default: f(() => [
1270
+ !o.persistent && o.dismissable ? (l(), v("div", ds, [
1271
+ m(V, {
1272
+ variant: "ghost",
1273
+ size: "icon",
1274
+ onClick: (d) => c()
1275
+ }, {
1276
+ default: f(() => [
1277
+ y("span", ps, x(o.$td("ui.close", "Close")), 1),
1278
+ m(i(Xr), { class: "size-3 text-gray-400" })
1279
+ ]),
1280
+ _: 2
1281
+ }, 1032, ["onClick"])
1282
+ ])) : M("", !0),
1283
+ o.title ? (l(), h(cs, {
1284
+ key: 1,
1285
+ class: "text-base font-semibold text-gray-900"
1286
+ }, {
1287
+ default: f(() => [
1288
+ m(R, {
1289
+ text: o.title,
1290
+ inline: ""
1291
+ }, null, 8, ["text"])
1292
+ ]),
1293
+ _: 1
1294
+ })) : M("", !0),
1295
+ y("div", {
1296
+ class: P(n.value)
1297
+ }, [
1298
+ w(o.$slots, "default", { close: c })
1299
+ ], 2)
1300
+ ]),
1301
+ _: 2
1302
+ }, 1032, ["class"])
1303
+ ]),
1304
+ _: 3
1305
+ }, 16, ["persistent"]));
1306
+ }
1307
+ }), ms = /* @__PURE__ */ g({
1308
+ __name: "AlertModal",
1309
+ props: {
1310
+ title: {},
1311
+ message: {}
1312
+ },
1313
+ setup(t) {
1314
+ return (r, e) => (l(), h(ne, { title: r.title }, {
1315
+ default: f(() => [
1316
+ m(R, { text: r.message }, null, 8, ["text"])
1317
+ ]),
1318
+ _: 1
1319
+ }, 8, ["title"]));
1320
+ }
1321
+ }), tt = /* @__PURE__ */ g({
1322
+ __name: "Form",
1323
+ props: {
1324
+ form: {}
1325
+ },
1326
+ emits: ["submit"],
1327
+ setup(t, { emit: r }) {
1328
+ let e;
1329
+ const s = r;
1330
+ return Me((n) => {
1331
+ var a;
1332
+ e == null || e(), e = (a = t.form) == null ? void 0 : a.on("submit", () => s("submit")), n(() => e == null ? void 0 : e());
1333
+ }), ce("form", t.form), (n, a) => (l(), v("form", {
1334
+ onSubmit: a[0] || (a[0] = qe((o) => {
1335
+ var u;
1336
+ return (u = n.form) == null ? void 0 : u.submit();
1337
+ }, ["prevent"]))
1338
+ }, [
1339
+ w(n.$slots, "default")
1340
+ ], 32));
1341
+ }
1342
+ }), fs = {
1343
+ required: (t) => t ? void 0 : "required"
1344
+ }, ae = { ...fs };
1345
+ function Ea(t, r) {
1346
+ ae[t] = r;
1347
+ }
1348
+ function hs(t, r) {
1349
+ var s;
1350
+ const e = (s = ae[r]) == null ? void 0 : s.call(ae, t);
1351
+ return e ? Ue(e) : [];
1352
+ }
1353
+ const B = {
1354
+ String: "string",
1355
+ Number: "number",
1356
+ Boolean: "boolean",
1357
+ Object: "object",
1358
+ Date: "date"
1359
+ }, Re = /* @__PURE__ */ new WeakMap();
1360
+ class gs extends Fe {
1361
+ constructor(e) {
1362
+ super();
1363
+ _(this, "errors");
1364
+ _(this, "_fields");
1365
+ _(this, "_data");
1366
+ _(this, "_submitted");
1367
+ _(this, "_errors");
1368
+ _(this, "_listeners", {});
1369
+ this._fields = e, this._submitted = H(!1), this._data = this.getInitialData(e), this._errors = this.getInitialErrors(e), Re.set(
1370
+ this,
1371
+ p(() => !Object.values(this._errors).some((s) => s !== null))
1372
+ ), this.errors = Ee(this._errors);
1373
+ }
1374
+ get valid() {
1375
+ var e;
1376
+ return !!((e = Re.get(this)) != null && e.value);
1377
+ }
1378
+ get submitted() {
1379
+ return this._submitted.value;
1380
+ }
1381
+ setFieldValue(e, s) {
1382
+ const n = this._fields[e] ?? W(`Trying to set undefined '${z(e)}' field`);
1383
+ this._data[e] = n.type === B.String && (n.trim ?? !0) ? z(s).trim() : s, this._submitted.value && this.validate();
1384
+ }
1385
+ getFieldValue(e) {
1386
+ return this._data[e];
1387
+ }
1388
+ getFieldRules(e) {
1389
+ var s, n;
1390
+ return ((n = (s = this._fields[e]) == null ? void 0 : s.rules) == null ? void 0 : n.split("|")) ?? [];
1391
+ }
1392
+ data() {
1393
+ return { ...this._data };
1394
+ }
1395
+ validate() {
1396
+ const e = Object.entries(this._fields).reduce(
1397
+ (s, [n, a]) => (s[n] = this.getFieldErrors(n, a), s),
1398
+ {}
1399
+ );
1400
+ return this.resetErrors(e), this.valid;
1401
+ }
1402
+ reset(e = {}) {
1403
+ this._submitted.value = !1, e.keepData || this.resetData(), e.keepErrors || this.resetErrors();
1404
+ }
1405
+ submit() {
1406
+ var s;
1407
+ this._submitted.value = !0;
1408
+ const e = this.validate();
1409
+ return e && ((s = this._listeners.submit) == null || s.forEach((n) => n())), e;
1410
+ }
1411
+ on(e, s) {
1412
+ var n, a;
1413
+ return (n = this._listeners)[e] ?? (n[e] = []), (a = this._listeners[e]) == null || a.push(s), () => this.off(e, s);
1414
+ }
1415
+ off(e, s) {
1416
+ we(this._listeners[e] ?? [], s);
1417
+ }
1418
+ async focus(e) {
1419
+ var s;
1420
+ await ze(), (s = this._listeners.focus) == null || s.forEach((n) => n(e));
1421
+ }
1422
+ __get(e) {
1423
+ return e in this._fields ? this.getFieldValue(e) : super.__get(e);
1424
+ }
1425
+ __set(e, s) {
1426
+ if (!(e in this._fields)) {
1427
+ super.__set(e, s);
1428
+ return;
1429
+ }
1430
+ this.setFieldValue(e, s);
1431
+ }
1432
+ getFieldErrors(e, s) {
1433
+ var u;
1434
+ const n = [], a = this._data[e], o = ((u = s.rules) == null ? void 0 : u.split("|")) ?? [];
1435
+ for (const c of o)
1436
+ c !== "required" && a == null || n.push(...hs(a, c));
1437
+ return n.length > 0 ? n : null;
1438
+ }
1439
+ getInitialData(e) {
1440
+ if (this.static().isConjuring())
1441
+ return {};
1442
+ const s = Object.entries(e).reduce((n, [a, o]) => (n[a] = o.default ?? null, n), {});
1443
+ return oe(s);
1444
+ }
1445
+ getInitialErrors(e) {
1446
+ if (this.static().isConjuring())
1447
+ return {};
1448
+ const s = Object.keys(e).reduce((n, a) => (n[a] = null, n), {});
1449
+ return oe(s);
1450
+ }
1451
+ resetData() {
1452
+ for (const [e, s] of Object.entries(this._fields))
1453
+ this._data[e] = s.default ?? null;
1454
+ }
1455
+ resetErrors(e) {
1456
+ Object.keys(this._errors).forEach((s) => delete this._errors[s]), e && Object.assign(this._errors, e);
1457
+ }
1458
+ }
1459
+ function rt(t) {
1460
+ return new gs(t);
1461
+ }
1462
+ function Pa(t, r = {}) {
1463
+ return {
1464
+ default: t,
1465
+ type: B.Boolean,
1466
+ rules: r.rules
1467
+ };
1468
+ }
1469
+ function Ha(t, r = {}) {
1470
+ return {
1471
+ default: t,
1472
+ type: B.Date,
1473
+ rules: r.rules
1474
+ };
1475
+ }
1476
+ function Ia(t) {
1477
+ return {
1478
+ default: t,
1479
+ type: B.Boolean,
1480
+ rules: "required"
1481
+ };
1482
+ }
1483
+ function La(t) {
1484
+ return {
1485
+ default: t,
1486
+ type: B.Date,
1487
+ rules: "required"
1488
+ };
1489
+ }
1490
+ function Ta(t) {
1491
+ return {
1492
+ default: t,
1493
+ type: B.Number,
1494
+ rules: "required"
1495
+ };
1496
+ }
1497
+ function vs(t) {
1498
+ return {
1499
+ default: t,
1500
+ type: B.String,
1501
+ rules: "required"
1502
+ };
1503
+ }
1504
+ function Va(t, r = {}) {
1505
+ return {
1506
+ default: t,
1507
+ type: B.Number,
1508
+ rules: r.rules
1509
+ };
1510
+ }
1511
+ function ja(t, r = {}) {
1512
+ return {
1513
+ default: t,
1514
+ type: B.String,
1515
+ rules: r.rules
1516
+ };
1517
+ }
1518
+ function bs(t) {
1519
+ const r = rt(
1520
+ Object.entries(t.checkboxes ?? {}).reduce(
1521
+ (n, [a, o]) => ({
1522
+ [a]: {
1523
+ type: B.Boolean,
1524
+ default: o.default,
1525
+ required: o.required ? "required" : void 0
1526
+ },
1527
+ ...n
1528
+ }),
1529
+ {}
1530
+ )
1531
+ ), e = p(() => t.acceptText ?? C("ui.accept", "Ok")), s = p(() => t.cancelText ?? C("ui.cancel", "Cancel"));
1532
+ return { form: r, renderedAcceptText: e, renderedCancelText: s };
1533
+ }
1534
+ const ys = {
1535
+ key: 0,
1536
+ class: "mt-4 flex flex-col text-sm text-gray-600"
1537
+ }, _s = { class: "flex items-center" }, ws = ["onUpdate:modelValue", "required"], $s = { class: "ml-1.5" }, xs = { class: "mt-4 flex flex-row-reverse gap-2" }, Cs = /* @__PURE__ */ g({
1538
+ __name: "ConfirmModal",
1539
+ props: {
1540
+ title: {},
1541
+ message: {},
1542
+ acceptText: {},
1543
+ acceptVariant: {},
1544
+ cancelText: {},
1545
+ cancelVariant: { default: "secondary" },
1546
+ checkboxes: {},
1547
+ actions: {},
1548
+ required: { type: Boolean }
1549
+ },
1550
+ setup(t) {
1551
+ const r = Z(t, ["cancelVariant"]), { form: e, renderedAcceptText: s, renderedCancelText: n } = bs(r);
1552
+ return (a, o) => (l(), h(ne, {
1553
+ title: a.title,
1554
+ persistent: ""
1555
+ }, {
1556
+ default: f(({ close: u }) => [
1557
+ m(tt, {
1558
+ form: i(e),
1559
+ onSubmit: (c) => u([!0, i(e).data()])
1560
+ }, {
1561
+ default: f(() => [
1562
+ m(R, {
1563
+ text: a.message,
1564
+ actions: a.actions
1565
+ }, null, 8, ["text", "actions"]),
1566
+ a.checkboxes ? (l(), v("ul", ys, [
1567
+ (l(!0), v(q, null, U(a.checkboxes, (c, d) => (l(), v("li", { key: d }, [
1568
+ y("label", _s, [
1569
+ De(y("input", {
1570
+ "onUpdate:modelValue": (b) => i(e)[d] = b,
1571
+ type: "checkbox",
1572
+ required: c.required,
1573
+ class: "border-primary text-primary hover:bg-primary/10 hover:checked:bg-primary/80 focus:ring-primary focus-visible:ring-primary rounded border-2"
1574
+ }, null, 8, ws), [
1575
+ [yt, i(e)[d]]
1576
+ ]),
1577
+ y("span", $s, x(c.label), 1)
1578
+ ])
1579
+ ]))), 128))
1580
+ ])) : M("", !0),
1581
+ y("div", xs, [
1582
+ m(V, {
1583
+ variant: a.acceptVariant,
1584
+ submit: ""
1585
+ }, {
1586
+ default: f(() => [
1587
+ A(x(i(s)), 1)
1588
+ ]),
1589
+ _: 1
1590
+ }, 8, ["variant"]),
1591
+ a.required ? M("", !0) : (l(), h(V, {
1592
+ key: 0,
1593
+ variant: a.cancelVariant,
1594
+ onClick: (c) => u(!1)
1595
+ }, {
1596
+ default: f(() => [
1597
+ A(x(i(n)), 1)
1598
+ ]),
1599
+ _: 2
1600
+ }, 1032, ["variant", "onClick"]))
1601
+ ])
1602
+ ]),
1603
+ _: 2
1604
+ }, 1032, ["form", "onSubmit"])
1605
+ ]),
1606
+ _: 1
1607
+ }, 8, ["title"]));
1608
+ }
1609
+ }), ks = {
1610
+ viewBox: "0 0 20 20",
1611
+ width: "1.2em",
1612
+ height: "1.2em"
1613
+ };
1614
+ function Ss(t, r) {
1615
+ return l(), v("svg", ks, r[0] || (r[0] = [
1616
+ y("path", {
1617
+ fill: "currentColor",
1618
+ d: "M7.05 9.293L6.343 10L12 15.657l1.414-1.414L9.172 10l4.242-4.243L12 4.343z"
1619
+ }, null, -1)
1620
+ ]));
1621
+ }
1622
+ const Ms = { name: "zondicons-cheveron-left", render: Ss }, Es = {
1623
+ viewBox: "0 0 20 20",
1624
+ width: "1.2em",
1625
+ height: "1.2em"
1626
+ };
1627
+ function Ps(t, r) {
1628
+ return l(), v("svg", Es, r[0] || (r[0] = [
1629
+ y("path", {
1630
+ fill: "currentColor",
1631
+ d: "m12.95 10.707l.707-.707L8 4.343L6.586 5.757L10.828 10l-4.242 4.243L8 15.657z"
1632
+ }, null, -1)
1633
+ ]));
1634
+ }
1635
+ const st = { name: "zondicons-cheveron-right", render: Ps }, Hs = {
1636
+ viewBox: "0 0 20 20",
1637
+ width: "1.2em",
1638
+ height: "1.2em"
1639
+ };
1640
+ function Is(t, r) {
1641
+ return l(), v("svg", Hs, r[0] || (r[0] = [
1642
+ y("path", {
1643
+ fill: "currentColor",
1644
+ d: "M2.93 17.07A10 10 0 1 1 17.07 2.93A10 10 0 0 1 2.93 17.07M9 5v6h2V5zm0 8v2h2v-2z"
1645
+ }, null, -1)
1646
+ ]));
1647
+ }
1648
+ const nt = { name: "zondicons-exclamation-solid", render: Is }, Ls = {
1649
+ viewBox: "0 0 24 24",
1650
+ width: "1.2em",
1651
+ height: "1.2em"
1652
+ };
1653
+ function Ts(t, r) {
1654
+ return l(), v("svg", Ls, r[0] || (r[0] = [
1655
+ y("path", {
1656
+ fill: "currentColor",
1657
+ d: "M20 19V7H4v12zm0-16a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm-7 14v-2h5v2zm-3.42-4L5.57 9H8.4l3.3 3.3c.39.39.39 1.03 0 1.42L8.42 17H5.59z"
1658
+ }, null, -1)
1659
+ ]));
1660
+ }
1661
+ const Vs = { name: "mdi-console", render: Ts }, js = {
1662
+ viewBox: "0 0 20 20",
1663
+ width: "1.2em",
1664
+ height: "1.2em"
1665
+ };
1666
+ function As(t, r) {
1667
+ return l(), v("svg", js, r[0] || (r[0] = [
1668
+ y("path", {
1669
+ fill: "currentColor",
1670
+ d: "M6 6V2c0-1.1.9-2 2-2h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-4v4a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8c0-1.1.9-2 2-2zm2 0h4a2 2 0 0 1 2 2v4h4V2H8zM2 8v10h10V8z"
1671
+ }, null, -1)
1672
+ ]));
1673
+ }
1674
+ const Rs = { name: "zondicons-copy", render: As }, zs = {
1675
+ viewBox: "0 0 24 24",
1676
+ width: "1.2em",
1677
+ height: "1.2em"
1678
+ };
1679
+ function Bs(t, r) {
1680
+ return l(), v("svg", zs, r[0] || (r[0] = [
1681
+ y("path", {
1682
+ fill: "currentColor",
1683
+ d: "M12 2A10 10 0 0 0 2 12c0 4.42 2.87 8.17 6.84 9.5c.5.08.66-.23.66-.5v-1.69c-2.77.6-3.36-1.34-3.36-1.34c-.46-1.16-1.11-1.47-1.11-1.47c-.91-.62.07-.6.07-.6c1 .07 1.53 1.03 1.53 1.03c.87 1.52 2.34 1.07 2.91.83c.09-.65.35-1.09.63-1.34c-2.22-.25-4.55-1.11-4.55-4.92c0-1.11.38-2 1.03-2.71c-.1-.25-.45-1.29.1-2.64c0 0 .84-.27 2.75 1.02c.79-.22 1.65-.33 2.5-.33s1.71.11 2.5.33c1.91-1.29 2.75-1.02 2.75-1.02c.55 1.35.2 2.39.1 2.64c.65.71 1.03 1.6 1.03 2.71c0 3.82-2.34 4.66-4.57 4.91c.36.31.69.92.69 1.85V21c0 .27.16.59.67.5C19.14 20.16 22 16.42 22 12A10 10 0 0 0 12 2"
1684
+ }, null, -1)
1685
+ ]));
1686
+ }
1687
+ const qs = { name: "mdi-github", render: Bs }, Ds = { class: "flex" }, Fs = { class: "sr-only" }, Us = /* @__PURE__ */ g({
1688
+ __name: "ErrorReportModalButtons",
1689
+ props: {
1690
+ report: {}
1691
+ },
1692
+ setup(t) {
1693
+ const r = t, e = p(() => r.report.description ? `${r.report.title}: ${r.report.description}` : r.report.title), s = p(() => {
1694
+ if (!F.sourceUrl)
1695
+ return !1;
1696
+ const a = encodeURIComponent(e.value), o = encodeURIComponent(
1697
+ [
1698
+ "[Please, explain here what you were trying to do when this error appeared]",
1699
+ "",
1700
+ "Error details:",
1701
+ "```",
1702
+ Tt(
1703
+ r.report.details ?? "Details missing from report",
1704
+ 1800 - a.length - F.sourceUrl.length
1705
+ ).trim(),
1706
+ "```"
1707
+ ].join(`
1708
+ `)
1709
+ );
1710
+ return `${F.sourceUrl}/issues/new?title=${a}&body=${o}`;
1711
+ }), n = p(() => K(
1712
+ [
1713
+ {
1714
+ id: "clipboard",
1715
+ description: "Copy to clipboard",
1716
+ iconComponent: Rs,
1717
+ async click() {
1718
+ await navigator.clipboard.writeText(`${e.value}
1719
+
1720
+ ${r.report.details}`), L.toast(C("errors.copiedToClipboard", "Debug information copied to clipboard"));
1721
+ }
1722
+ },
1723
+ {
1724
+ id: "console",
1725
+ description: "Log to console",
1726
+ iconComponent: Vs,
1727
+ click() {
1728
+ const a = r.report.error ?? r.report;
1729
+ window.error = a, console.error(a), L.toast(
1730
+ C(
1731
+ "errors.addedToConsole",
1732
+ "You can now use the **error** variable in the console"
1733
+ )
1734
+ );
1735
+ }
1736
+ }
1737
+ ],
1738
+ (a) => {
1739
+ s.value && a.push({
1740
+ id: "github",
1741
+ description: "Report in GitHub",
1742
+ iconComponent: qs,
1743
+ url: s.value
1744
+ });
1745
+ }
1746
+ ));
1747
+ return (a, o) => (l(), v("div", Ds, [
1748
+ (l(!0), v(q, null, U(n.value, (u) => w(a.$slots, "default", I({ ref_for: !0 }, u), () => [
1749
+ m(V, {
1750
+ size: "icon",
1751
+ variant: "ghost",
1752
+ class: "group whitespace-nowrap",
1753
+ href: u.url,
1754
+ title: a.$td(`errors.report_${u.id}`, u.description),
1755
+ onClick: u.click
1756
+ }, {
1757
+ default: f(() => [
1758
+ y("span", Fs, x(a.$td(`errors.report_${u.id}`, u.description)), 1),
1759
+ (l(), h(X(u.iconComponent), {
1760
+ class: "size-4",
1761
+ "aria-hidden": "true"
1762
+ }))
1763
+ ]),
1764
+ _: 2
1765
+ }, 1032, ["href", "title", "onClick"])
1766
+ ])), 256))
1767
+ ]));
1768
+ }
1769
+ }), Ns = /* @__PURE__ */ g({
1770
+ __name: "ErrorReportModalTitle",
1771
+ props: {
1772
+ report: {},
1773
+ currentReport: {},
1774
+ totalReports: {}
1775
+ },
1776
+ setup(t) {
1777
+ const r = p(() => !t.totalReports || t.totalReports <= 1 ? t.report.title : `${t.report.title} (${t.currentReport}/${t.totalReports})`);
1778
+ return (e, s) => (l(), h(R, {
1779
+ text: r.value,
1780
+ inline: ""
1781
+ }, null, 8, ["text"]));
1782
+ }
1783
+ });
1784
+ function Os(t) {
1785
+ const r = H(0), e = p(() => t.reports[r.value]), s = p(
1786
+ () => {
1787
+ var o;
1788
+ return ((o = e.value.details) == null ? void 0 : o.trim()) || C("errors.detailsEmpty", "This error is missing a stacktrace.");
1789
+ }
1790
+ ), n = C("errors.previousReport", "Show previous report"), a = C("errors.nextReport", "Show next report");
1791
+ return {
1792
+ activeReportIndex: r,
1793
+ details: s,
1794
+ nextReportText: a,
1795
+ previousReportText: n,
1796
+ report: e
1797
+ };
1798
+ }
1799
+ const Ws = { class: "px-4 pt-5 pb-4" }, Ks = { class: "flex justify-between gap-4" }, Js = { class: "flex items-center gap-2" }, Qs = {
1800
+ key: 0,
1801
+ class: "flex gap-0.5"
1802
+ }, Gs = { class: "-mt-2 max-h-[80vh] overflow-auto bg-red-800/10" }, Zs = ["textContent"], Xs = /* @__PURE__ */ g({
1803
+ __name: "ErrorReportModal",
1804
+ props: {
1805
+ reports: {}
1806
+ },
1807
+ setup(t) {
1808
+ const r = t, { activeReportIndex: e, details: s, nextReportText: n, previousReportText: a, report: o } = Os(r);
1809
+ return (u, c) => (l(), h(ne, { "wrapper-class": "p-0 sm:w-auto sm:min-w-lg sm:max-w-[80vw]" }, {
1810
+ default: f(() => [
1811
+ y("div", Ws, [
1812
+ y("h2", Ks, [
1813
+ y("div", Js, [
1814
+ m(i(nt), { class: "size-5 text-red-600" }),
1815
+ m(Ns, {
1816
+ class: "text-lg leading-6 font-semibold text-gray-900",
1817
+ report: i(o),
1818
+ "current-report": i(e) + 1,
1819
+ "total-reports": u.reports.length
1820
+ }, null, 8, ["report", "current-report", "total-reports"]),
1821
+ u.reports.length > 1 ? (l(), v("span", Qs, [
1822
+ m(V, {
1823
+ size: "icon",
1824
+ variant: "ghost",
1825
+ disabled: i(e) === 0,
1826
+ "aria-label": i(a),
1827
+ title: i(a),
1828
+ onClick: c[0] || (c[0] = (d) => e.value--)
1829
+ }, {
1830
+ default: f(() => [
1831
+ m(i(Ms), { class: "size-4" })
1832
+ ]),
1833
+ _: 1
1834
+ }, 8, ["disabled", "aria-label", "title"]),
1835
+ m(V, {
1836
+ size: "icon",
1837
+ variant: "ghost",
1838
+ disabled: i(e) === u.reports.length - 1,
1839
+ "aria-label": i(n),
1840
+ title: i(n),
1841
+ onClick: c[1] || (c[1] = (d) => e.value++)
1842
+ }, {
1843
+ default: f(() => [
1844
+ m(i(st), { class: "size-4" })
1845
+ ]),
1846
+ _: 1
1847
+ }, 8, ["disabled", "aria-label", "title"])
1848
+ ])) : M("", !0)
1849
+ ]),
1850
+ m(Us, {
1851
+ report: i(o),
1852
+ class: "gap-0.5"
1853
+ }, null, 8, ["report"])
1854
+ ]),
1855
+ i(o).description ? (l(), h(R, {
1856
+ key: 0,
1857
+ text: i(o).description,
1858
+ class: "text-gray-600"
1859
+ }, null, 8, ["text"])) : M("", !0)
1860
+ ]),
1861
+ y("div", Gs, [
1862
+ y("pre", {
1863
+ class: "p-4 text-xs text-red-800",
1864
+ textContent: x(i(s))
1865
+ }, null, 8, Zs)
1866
+ ])
1867
+ ]),
1868
+ _: 1
1869
+ }));
1870
+ }
1871
+ }), Ys = {
1872
+ viewBox: "0 0 24 24",
1873
+ width: "1.2em",
1874
+ height: "1.2em"
1875
+ };
1876
+ function en(t, r) {
1877
+ return l(), v("svg", Ys, r[0] || (r[0] = [
1878
+ y("path", {
1879
+ fill: "currentColor",
1880
+ d: "M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z",
1881
+ opacity: ".25"
1882
+ }, null, -1),
1883
+ y("path", {
1884
+ fill: "currentColor",
1885
+ d: "M10.14,1.16a11,11,0,0,0-9,8.92A1.59,1.59,0,0,0,2.46,12,1.52,1.52,0,0,0,4.11,10.7a8,8,0,0,1,6.66-6.61A1.42,1.42,0,0,0,12,2.69h0A1.57,1.57,0,0,0,10.14,1.16Z"
1886
+ }, [
1887
+ y("animateTransform", {
1888
+ attributeName: "transform",
1889
+ dur: "0.75s",
1890
+ repeatCount: "indefinite",
1891
+ type: "rotate",
1892
+ values: "0 12 12;360 12 12"
1893
+ })
1894
+ ], -1)
1895
+ ]));
1896
+ }
1897
+ const tn = { name: "svg-spinners-90-ring-with-bg", render: en }, rn = { class: "mt-1 h-2 w-full overflow-hidden rounded-full bg-gray-200" }, sn = { class: "sr-only" }, nn = /* @__PURE__ */ g({
1898
+ __name: "ProgressBar",
1899
+ props: {
1900
+ filledClass: {},
1901
+ progress: {},
1902
+ job: {}
1903
+ },
1904
+ setup(t) {
1905
+ let r;
1906
+ const e = H(0), s = p(() => T("size-full transition-transform duration-500 rounded-r-full ease-linear bg-primary", t.filledClass)), n = p(() => typeof t.progress == "number" ? t.progress : e.value);
1907
+ return ke(
1908
+ () => t.job,
1909
+ () => {
1910
+ var a, o;
1911
+ r == null || r(), e.value = ((a = t.job) == null ? void 0 : a.progress) ?? 0, r = (o = t.job) == null ? void 0 : o.listeners.add({ onUpdated: (u) => e.value = u });
1912
+ },
1913
+ { immediate: !0 }
1914
+ ), ue(() => r == null ? void 0 : r()), (a, o) => (l(), v("div", rn, [
1915
+ y("div", {
1916
+ class: P(s.value),
1917
+ style: _t(`transform:translateX(-${(1 - n.value) * 100}%)`)
1918
+ }, null, 6),
1919
+ y("span", sn, x(a.$td("ui.progress", "{progress}% complete", {
1920
+ progress: n.value * 100
1921
+ })), 1)
1922
+ ]));
1923
+ }
1924
+ });
1925
+ function an(t) {
1926
+ const r = p(() => t.message ?? C("ui.loading", "Loading...")), e = p(() => typeof t.progress == "number" || !!t.job);
1927
+ return { renderedMessage: r, showProgress: e };
1928
+ }
1929
+ const on = /* @__PURE__ */ g({
1930
+ __name: "LoadingModal",
1931
+ props: {
1932
+ title: {},
1933
+ message: {},
1934
+ progress: {},
1935
+ job: {}
1936
+ },
1937
+ setup(t) {
1938
+ const r = t, { renderedMessage: e, showProgress: s } = an(r);
1939
+ return (n, a) => (l(), h(ne, {
1940
+ persistent: "",
1941
+ class: P(["flex", { "flex-col-reverse": i(s), "items-center justify-center gap-2": !i(s) }]),
1942
+ "wrapper-class": "w-auto",
1943
+ title: n.title
1944
+ }, {
1945
+ default: f(() => [
1946
+ i(s) ? (l(), h(nn, {
1947
+ key: 0,
1948
+ progress: n.progress,
1949
+ job: n.job,
1950
+ class: "min-w-[min(400px,80vw)]"
1951
+ }, null, 8, ["progress", "job"])) : (l(), h(i(tn), {
1952
+ key: 1,
1953
+ class: "text-primary mr-1 size-6"
1954
+ })),
1955
+ m(R, { text: i(e) }, null, 8, ["text"])
1956
+ ]),
1957
+ _: 1
1958
+ }, 8, ["title", "class"]));
1959
+ }
1960
+ }), at = /* @__PURE__ */ g({
1961
+ __name: "HeadlessInput",
1962
+ props: {
1963
+ name: {},
1964
+ label: {},
1965
+ description: {},
1966
+ modelValue: {},
1967
+ as: { default: "div" }
1968
+ },
1969
+ emits: ["update:modelValue"],
1970
+ setup(t, { expose: r, emit: e }) {
1971
+ const s = e, n = se("form", null), a = p(() => !n || !t.name ? null : n.errors[t.name] ?? null), o = {
1972
+ id: `input-${te()}`,
1973
+ name: p(() => t.name),
1974
+ label: p(() => t.label),
1975
+ description: p(() => t.description),
1976
+ value: p(() => n && t.name ? n.getFieldValue(t.name) : t.modelValue),
1977
+ errors: Ee(a),
1978
+ required: p(() => {
1979
+ if (!(!t.name || !n))
1980
+ return n.getFieldRules(t.name).includes("required");
1981
+ }),
1982
+ update(u) {
1983
+ if (n && t.name) {
1984
+ n.setFieldValue(t.name, u);
1985
+ return;
1986
+ }
1987
+ s("update:modelValue", u);
1988
+ }
1989
+ };
1990
+ return ce("input", o), r(o), (u, c) => (l(), h(X(u.as), null, {
1991
+ default: f(() => [
1992
+ w(u.$slots, "default")
1993
+ ]),
1994
+ _: 3
1995
+ }));
1996
+ }
1997
+ }), ln = ["for"], xe = /* @__PURE__ */ g({
1998
+ __name: "HeadlessInputLabel",
1999
+ setup(t) {
2000
+ const r = j("input", "<HeadlessInputLabel> must be a child of a <HeadlessInput>"), e = Se(), s = p(() => !!(r.label || e.default));
2001
+ return (n, a) => s.value ? (l(), v("label", {
2002
+ key: 0,
2003
+ for: i(r).id
2004
+ }, [
2005
+ w(n.$slots, "default", {}, () => [
2006
+ A(x(i(r).label), 1)
2007
+ ])
2008
+ ], 8, ln)) : M("", !0);
2009
+ }
2010
+ }), un = ["id", "name", "type", "checked", "required", "aria-invalid", "aria-describedby"], ot = /* @__PURE__ */ g({
2011
+ __name: "HeadlessInputInput",
2012
+ props: {
2013
+ type: { default: "text" }
2014
+ },
2015
+ setup(t) {
2016
+ const r = H(), e = j("input", "<HeadlessInputInput> must be a child of a <HeadlessInput>"), s = p(() => e.name ?? void 0), n = p(() => e.value), a = p(() => {
2017
+ if (t.type === "checkbox")
2018
+ return !!n.value;
2019
+ });
2020
+ function o() {
2021
+ r.value && e.update(u());
2022
+ }
2023
+ function u() {
2024
+ if (!r.value)
2025
+ return null;
2026
+ switch (t.type) {
2027
+ case "checkbox":
2028
+ return r.value.checked;
2029
+ case "date":
2030
+ return r.value.valueAsDate;
2031
+ default:
2032
+ return r.value.value;
2033
+ }
2034
+ }
2035
+ return Ye(e, () => {
2036
+ var c;
2037
+ return (c = r.value) == null ? void 0 : c.focus();
2038
+ }), Me(() => {
2039
+ if (r.value) {
2040
+ if (t.type === "date") {
2041
+ r.value.valueAsDate = n.value;
2042
+ return;
2043
+ }
2044
+ r.value.value = n.value ?? null;
2045
+ }
2046
+ }), (c, d) => (l(), v("input", {
2047
+ id: i(e).id,
2048
+ ref_key: "$input",
2049
+ ref: r,
2050
+ name: s.value,
2051
+ type: c.type,
2052
+ checked: a.value,
2053
+ required: i(e).required ?? void 0,
2054
+ "aria-invalid": i(e).errors ? "true" : "false",
2055
+ "aria-describedby": i(e).errors ? `${i(e).id}-error` : i(e).description ? `${i(e).id}-description` : void 0,
2056
+ onInput: o
2057
+ }, null, 40, un));
2058
+ }
2059
+ }), cn = /* @__PURE__ */ g({
2060
+ inheritAttrs: !1,
2061
+ __name: "HeadlessInputDescription",
2062
+ setup(t) {
2063
+ const r = j(
2064
+ "input",
2065
+ "<HeadlessInputDescription> must be a child of a <HeadlessInput>"
2066
+ ), e = p(() => typeof r.description == "string" ? r.description : ""), s = p(() => !!r.description);
2067
+ return (n, a) => w(n.$slots, "default", {
2068
+ id: `${i(r).id}-description`
2069
+ }, () => [
2070
+ s.value ? (l(), h(R, I({ key: 0 }, n.$attrs, {
2071
+ id: `${i(r).id}-description`,
2072
+ text: e.value
2073
+ }), null, 16, ["id", "text"])) : M("", !0)
2074
+ ]);
2075
+ }
2076
+ }), dn = ["id"], Ce = /* @__PURE__ */ g({
2077
+ __name: "HeadlessInputError",
2078
+ setup(t) {
2079
+ const r = j("input", "<HeadlessInputError> must be a child of a <HeadlessInput>"), e = p(() => r.errors ? C(`errors.${r.errors[0]}`, `Error: ${r.errors[0]}`) : null);
2080
+ return (s, n) => e.value ? (l(), v("p", {
2081
+ key: 0,
2082
+ id: `${i(r).id}-error`
2083
+ }, x(e.value), 9, dn)) : M("", !0);
2084
+ }
2085
+ });
2086
+ function it() {
2087
+ const t = Be(), r = p(() => t.class);
2088
+ return [p(() => Vt(t, "class")), r];
2089
+ }
2090
+ const pn = {
2091
+ key: 0,
2092
+ class: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3"
2093
+ }, mn = /* @__PURE__ */ g({
2094
+ inheritAttrs: !1,
2095
+ __name: "Input",
2096
+ props: {
2097
+ name: {},
2098
+ label: {},
2099
+ description: {},
2100
+ modelValue: {},
2101
+ inputClass: {},
2102
+ wrapperClass: {}
2103
+ },
2104
+ emits: ["update:modelValue"],
2105
+ setup(t) {
2106
+ const r = Z(t, ["label", "inputClass", "wrapperClass"]), e = me("$input"), [s, n] = it(), a = p(() => T("relative rounded-md shadow-2xs", { "mt-1": t.label }, t.wrapperClass)), o = p(() => {
2107
+ var u, c, d;
2108
+ return T(
2109
+ // eslint-disable-next-line vue/max-len
2110
+ "block w-full rounded-md border-0 py-1.5 ring-1 ring-inset focus:ring-2 focus:ring-inset sm:text-sm sm:leading-6",
2111
+ {
2112
+ "text-gray-900 shadow-2xs ring-gray-300 placeholder:text-gray-400": !((u = e.value) != null && u.errors),
2113
+ "hover:ring-1 hover:ring-primary/80 hover:ring-inset focus:ring-primary": !((c = e.value) != null && c.errors),
2114
+ "pr-10 text-red-900 ring-red-300 placeholder:text-red-300 focus:ring-red-500": (d = e.value) == null ? void 0 : d.errors
2115
+ },
2116
+ t.inputClass
2117
+ );
2118
+ });
2119
+ return (u, c) => (l(), h(at, I({
2120
+ ref_key: "$input",
2121
+ ref: e,
2122
+ label: u.label,
2123
+ class: i(n)
2124
+ }, r, {
2125
+ "onUpdate:modelValue": c[0] || (c[0] = (d) => u.$emit("update:modelValue", d))
2126
+ }), {
2127
+ default: f(() => {
2128
+ var d;
2129
+ return [
2130
+ m(xe, { class: "block text-sm leading-6 font-medium text-gray-900" }),
2131
+ y("div", {
2132
+ class: P(a.value)
2133
+ }, [
2134
+ m(ot, I(i(s), { class: o.value }), null, 16, ["class"]),
2135
+ (d = i(e)) != null && d.errors ? (l(), v("div", pn, [
2136
+ m(i(nt), { class: "size-5 text-red-500" })
2137
+ ])) : M("", !0)
2138
+ ], 2),
2139
+ m(cn, { class: "mt-2 text-sm text-gray-600" }),
2140
+ m(Ce, { class: "mt-2 text-sm text-red-600" })
2141
+ ];
2142
+ }),
2143
+ _: 1
2144
+ }, 16, ["label", "class"]));
2145
+ }
2146
+ });
2147
+ function fn(t) {
2148
+ const r = rt({
2149
+ draft: vs(t.defaultValue ?? "")
2150
+ }), e = p(() => t.acceptText ?? C("ui.accept", "Ok")), s = p(() => t.cancelText ?? C("ui.cancel", "Cancel"));
2151
+ return { form: r, renderedAcceptText: e, renderedCancelText: s };
2152
+ }
2153
+ const hn = { class: "mt-4 flex flex-row-reverse gap-2" }, gn = /* @__PURE__ */ g({
2154
+ __name: "PromptModal",
2155
+ props: {
2156
+ title: {},
2157
+ message: {},
2158
+ label: {},
2159
+ defaultValue: {},
2160
+ placeholder: {},
2161
+ acceptText: {},
2162
+ acceptVariant: {},
2163
+ cancelText: {},
2164
+ cancelVariant: { default: "secondary" }
2165
+ },
2166
+ setup(t) {
2167
+ const r = Z(t, ["cancelVariant"]), { form: e, renderedAcceptText: s, renderedCancelText: n } = fn(r);
2168
+ return (a, o) => (l(), h(ne, {
2169
+ title: a.title,
2170
+ persistent: ""
2171
+ }, {
2172
+ default: f(({ close: u }) => [
2173
+ m(tt, {
2174
+ form: i(e),
2175
+ onSubmit: (c) => u(i(e).draft)
2176
+ }, {
2177
+ default: f(() => [
2178
+ m(R, { text: a.message }, null, 8, ["text"]),
2179
+ m(mn, {
2180
+ name: "draft",
2181
+ class: "mt-2",
2182
+ placeholder: a.placeholder,
2183
+ label: a.label
2184
+ }, null, 8, ["placeholder", "label"]),
2185
+ y("div", hn, [
2186
+ m(V, {
2187
+ variant: a.acceptVariant,
2188
+ submit: ""
2189
+ }, {
2190
+ default: f(() => [
2191
+ A(x(i(s)), 1)
2192
+ ]),
2193
+ _: 1
2194
+ }, 8, ["variant"]),
2195
+ m(V, {
2196
+ variant: a.cancelVariant,
2197
+ onClick: (c) => u(!1)
2198
+ }, {
2199
+ default: f(() => [
2200
+ A(x(i(n)), 1)
2201
+ ]),
2202
+ _: 2
2203
+ }, 1032, ["variant", "onClick"])
2204
+ ])
2205
+ ]),
2206
+ _: 2
2207
+ }, 1032, ["form", "onSubmit"])
2208
+ ]),
2209
+ _: 1
2210
+ }, 8, ["title"]));
2211
+ }
2212
+ }), vn = { class: "grid grow place-items-center" }, bn = { class: "flex flex-col items-center space-y-6 p-8" }, yn = { class: "mt-2 text-center text-4xl font-medium text-red-600" }, _n = { class: "mt-4 flex flex-col space-y-4" }, wn = /* @__PURE__ */ g({
2213
+ __name: "StartupCrash",
2214
+ setup(t) {
2215
+ return (r, e) => (l(), v("div", vn, [
2216
+ y("div", bn, [
2217
+ y("h1", yn, x(r.$td("startupCrash.title", "Something went wrong!")), 1),
2218
+ m(R, {
2219
+ text: r.$td(
2220
+ "startupCrash.message",
2221
+ `Something failed trying to start the application.
2222
+
2223
+ Here's some things you can do:`
2224
+ ),
2225
+ class: "mt-4 text-center"
2226
+ }, null, 8, ["text"]),
2227
+ y("div", _n, [
2228
+ m(V, {
2229
+ variant: "danger",
2230
+ onClick: e[0] || (e[0] = (s) => r.$app.reload())
2231
+ }, {
2232
+ default: f(() => [
2233
+ A(x(r.$td("startupCrash.reload", "Try again")), 1)
2234
+ ]),
2235
+ _: 1
2236
+ }),
2237
+ m(V, {
2238
+ variant: "danger",
2239
+ onClick: e[1] || (e[1] = (s) => r.$errors.inspect(r.$errors.startupErrors))
2240
+ }, {
2241
+ default: f(() => [
2242
+ A(x(r.$td("startupCrash.inspect", "View error details")), 1)
2243
+ ]),
2244
+ _: 1
2245
+ })
2246
+ ])
2247
+ ])
2248
+ ]));
2249
+ }
2250
+ }), lt = /* @__PURE__ */ g({
2251
+ __name: "HeadlessToastAction",
2252
+ props: {
2253
+ action: {}
2254
+ },
2255
+ setup(t) {
2256
+ return (r, e) => (l(), h(X(r.action.dismiss ? i(Zt) : "button"), {
2257
+ type: "button",
2258
+ onClick: r.action.click
2259
+ }, {
2260
+ default: f(() => [
2261
+ A(x(r.action.label), 1)
2262
+ ]),
2263
+ _: 1
2264
+ }, 8, ["onClick"]));
2265
+ }
2266
+ }), $n = { key: 0 }, xn = /* @__PURE__ */ g({
2267
+ __name: "HeadlessToast",
2268
+ props: {
2269
+ message: {},
2270
+ actions: {},
2271
+ variant: {}
2272
+ },
2273
+ setup(t) {
2274
+ return (r, e) => (l(), h(i(Xt), null, {
2275
+ default: f(() => [
2276
+ w(r.$slots, "default", {}, () => [
2277
+ r.message ? (l(), v("span", $n, x(r.message), 1)) : M("", !0),
2278
+ (l(!0), v(q, null, U(r.actions, (s, n) => (l(), h(lt, {
2279
+ key: n,
2280
+ action: s
2281
+ }, null, 8, ["action"]))), 128))
2282
+ ])
2283
+ ]),
2284
+ _: 3
2285
+ }));
2286
+ }
2287
+ }), Cn = /* @__PURE__ */ g({
2288
+ __name: "Toast",
2289
+ props: {
2290
+ message: {},
2291
+ actions: {},
2292
+ variant: { default: "secondary" },
2293
+ class: {}
2294
+ },
2295
+ setup(t) {
2296
+ const r = Xe(
2297
+ { baseClasses: t.class, variant: t.variant },
2298
+ {
2299
+ baseClasses: "flex items-center gap-2 rounded-md p-2 ring-1 shadow-lg border-gray-200",
2300
+ variants: {
2301
+ variant: {
2302
+ secondary: "bg-gray-900 text-white ring-black",
2303
+ danger: "bg-red-50 text-red-900 ring-red-100"
2304
+ }
2305
+ },
2306
+ defaultVariants: {
2307
+ variant: "secondary"
2308
+ }
2309
+ }
2310
+ );
2311
+ return (e, s) => (l(), h(xn, {
2312
+ class: P(i(r))
2313
+ }, {
2314
+ default: f(() => [
2315
+ e.message ? (l(), h(R, {
2316
+ key: 0,
2317
+ text: e.message,
2318
+ inline: ""
2319
+ }, null, 8, ["text"])) : M("", !0),
2320
+ (l(!0), v(q, null, U(e.actions, (n, a) => (l(), h(V, {
2321
+ key: a,
2322
+ action: n,
2323
+ variant: e.variant,
2324
+ as: lt
2325
+ }, null, 8, ["action", "variant"]))), 128))
2326
+ ]),
2327
+ _: 1
2328
+ }, 8, ["class"]));
2329
+ }
2330
+ }), kn = { $ui: L }, Sn = {
2331
+ async install(t, r) {
2332
+ const e = {
2333
+ [E.AlertModal]: ms,
2334
+ [E.ConfirmModal]: Cs,
2335
+ [E.ErrorReportModal]: Xs,
2336
+ [E.LoadingModal]: on,
2337
+ [E.PromptModal]: gn,
2338
+ [E.Toast]: Cn,
2339
+ [E.StartupCrash]: wn
2340
+ };
2341
+ Object.entries({
2342
+ ...e,
2343
+ ...r.components
2344
+ }).forEach(([s, n]) => L.registerComponent(s, n)), await ve(t, kn);
2345
+ }
2346
+ };
2347
+ async function Mn(t, r = {}) {
2348
+ var s;
2349
+ const e = [Qr, Pr, Wr, Jr, Vr, Sn, ...r.plugins ?? []];
2350
+ F.instance = t, await kr(e, t, r), await ((s = r.install) == null ? void 0 : s.call(r, t)), await S.emit("application-ready");
2351
+ }
2352
+ async function Aa(t, r = {}) {
2353
+ var s;
2354
+ const e = wt(t);
2355
+ G() && (window.$aerogel = e), await Mn(e, r), e.mount("#app"), (s = e._container) == null || s.classList.remove("loading"), await S.emit("application-mounted");
2356
+ }
2357
+ const En = { key: 0 }, Pn = /* @__PURE__ */ g({
2358
+ __name: "AppModals",
2359
+ setup(t) {
2360
+ const r = p(() => L.modals[0] ?? null);
2361
+ return (e, s) => r.value ? (l(), v("aside", En, [
2362
+ m(et, {
2363
+ "child-index": 1,
2364
+ modal: r.value
2365
+ }, null, 8, ["modal"])
2366
+ ])) : M("", !0);
2367
+ }
2368
+ }), Hn = /* @__PURE__ */ g({
2369
+ __name: "AppToasts",
2370
+ setup(t) {
2371
+ return (r, e) => (l(), h(i(Yt), null, {
2372
+ default: f(() => [
2373
+ (l(!0), v(q, null, U(r.$ui.toasts, (s) => (l(), h(X(s.component), I({
2374
+ id: s.id,
2375
+ key: s.id,
2376
+ ref_for: !0
2377
+ }, s.properties), null, 16, ["id"]))), 128)),
2378
+ m(i(er), { class: "fixed right-0 bottom-0 z-50 flex flex-col items-end space-y-4 px-4 py-6 sm:p-6" })
2379
+ ]),
2380
+ _: 1
2381
+ }));
2382
+ }
2383
+ }), In = /* @__PURE__ */ g({
2384
+ __name: "AppOverlays",
2385
+ setup(t) {
2386
+ const r = H(null), e = H(!0);
2387
+ return ee("show-overlays-backdrop", async () => {
2388
+ !r.value || !e.value || (e.value = !1, r.value.classList.remove("opacity-0"));
2389
+ }), ee("hide-overlays-backdrop", async () => {
2390
+ !r.value || e.value || (e.value = !0, r.value.classList.add("opacity-0"));
2391
+ }), (s, n) => (l(), v(q, null, [
2392
+ m(Pn),
2393
+ m(Hn)
2394
+ ], 64));
2395
+ }
2396
+ }), Ln = { class: "flex min-h-full flex-col text-base leading-tight font-normal text-gray-900 antialiased" }, Ra = /* @__PURE__ */ g({
2397
+ __name: "AppLayout",
2398
+ setup(t) {
2399
+ return (r, e) => (l(), v("div", Ln, [
2400
+ r.$errors.hasStartupErrors ? w(r.$slots, "startup-crash", { key: 0 }, () => [
2401
+ (l(), h(X(r.$ui.requireComponent(i(E).StartupCrash))))
2402
+ ]) : w(r.$slots, "default", { key: 1 }),
2403
+ m(In)
2404
+ ]));
2405
+ }
2406
+ });
2407
+ function za() {
2408
+ return $t((t, r) => {
2409
+ let e;
2410
+ return {
2411
+ get() {
2412
+ return t(), e;
2413
+ },
2414
+ set(s) {
2415
+ e = as(s), r();
2416
+ }
2417
+ };
2418
+ });
2419
+ }
2420
+ function Tn(t) {
2421
+ return typeof t == "object" && t !== null && "label" in t;
2422
+ }
2423
+ const Vn = ["id", "name", "value", "required", "aria-invalid", "aria-describedby"], Ba = /* @__PURE__ */ g({
2424
+ __name: "HeadlessInputTextArea",
2425
+ setup(t) {
2426
+ const r = H(), e = j(
2427
+ "input",
2428
+ "<HeadlessInputTextArea> must be a child of a <HeadlessInput>"
2429
+ ), s = p(() => e.name ?? void 0), n = p(() => e.value);
2430
+ function a() {
2431
+ r.value && e.update(r.value.value);
2432
+ }
2433
+ return Ye(e, () => {
2434
+ var o;
2435
+ return (o = r.value) == null ? void 0 : o.focus();
2436
+ }), (o, u) => (l(), v("textarea", {
2437
+ id: i(e).id,
2438
+ ref_key: "$textArea",
2439
+ ref: r,
2440
+ name: s.value,
2441
+ value: n.value,
2442
+ required: i(e).required ?? void 0,
2443
+ "aria-invalid": i(e).errors ? "true" : "false",
2444
+ "aria-describedby": i(e).errors ? `${i(e).id}-error` : i(e).description ? `${i(e).id}-description` : void 0,
2445
+ onInput: a
2446
+ }, null, 40, Vn));
2447
+ }
2448
+ });
2449
+ function qa(t) {
2450
+ let r = jt;
2451
+ xt(() => r = t()), ue(() => r());
2452
+ }
2453
+ function Da(t, r) {
2454
+ const e = oe(D.get(t) ?? r);
2455
+ return ke(e, () => D.set(t, Ct(e))), e;
2456
+ }
2457
+ function Fa(t) {
2458
+ return t.split(/\s+/).filter((r) => !/^(hover|focus|focus-visible):/.test(r)).join(" ").trim();
2459
+ }
2460
+ const ut = /* @__PURE__ */ g({
2461
+ __name: "HeadlessSelectValue",
2462
+ setup(t) {
2463
+ const r = j(
2464
+ "select",
2465
+ "<HeadlessSelectValue> must be a child of a <HeadlessSelect>"
2466
+ );
2467
+ return (e, s) => (l(), h(i(tr), {
2468
+ placeholder: i(r).placeholder
2469
+ }, null, 8, ["placeholder"]));
2470
+ }
2471
+ }), ct = /* @__PURE__ */ g({
2472
+ __name: "HeadlessSelectTrigger",
2473
+ setup(t) {
2474
+ const r = j(
2475
+ "select",
2476
+ "<HeadlessSelectTrigger> must be a child of a <HeadlessSelect>"
2477
+ );
2478
+ return (e, s) => (l(), h(i(rr), {
2479
+ id: i(r).id
2480
+ }, {
2481
+ default: f(() => [
2482
+ w(e.$slots, "default", {}, () => [
2483
+ m(ut, {
2484
+ placeholder: i(r).placeholder
2485
+ }, null, 8, ["placeholder"]),
2486
+ m(i(sr))
2487
+ ])
2488
+ ]),
2489
+ _: 3
2490
+ }, 8, ["id"]));
2491
+ }
2492
+ }), dt = /* @__PURE__ */ g({
2493
+ __name: "HeadlessSelectOption",
2494
+ props: {
2495
+ value: {},
2496
+ disabled: { type: Boolean },
2497
+ textValue: {},
2498
+ asChild: { type: Boolean },
2499
+ as: {}
2500
+ },
2501
+ setup(t) {
2502
+ const r = j(
2503
+ "select",
2504
+ "<HeadlessSelectOption> must be a child of a <HeadlessSelect>"
2505
+ ), e = p(() => {
2506
+ var n;
2507
+ const s = (n = r.options) == null ? void 0 : n.find((a) => a.value === t.value);
2508
+ return s ? s.label : z(t.value);
2509
+ });
2510
+ return (s, n) => (l(), h(i(nr), de(pe(s.$props)), {
2511
+ default: f(() => [
2512
+ m(i(ar), { class: "the-text" }, {
2513
+ default: f(() => [
2514
+ w(s.$slots, "default", {}, () => [
2515
+ A(x(e.value), 1)
2516
+ ])
2517
+ ]),
2518
+ _: 3
2519
+ })
2520
+ ]),
2521
+ _: 3
2522
+ }, 16));
2523
+ }
2524
+ }), pt = /* @__PURE__ */ g({
2525
+ __name: "HeadlessSelectOptions",
2526
+ props: {
2527
+ class: {}
2528
+ },
2529
+ setup(t) {
2530
+ const r = j(
2531
+ "select",
2532
+ "<HeadlessSelectOptions> must be a child of a <HeadlessSelect>"
2533
+ );
2534
+ return (e, s) => (l(), h(i(or), null, {
2535
+ default: f(() => [
2536
+ m(i(ir), {
2537
+ class: P(t.class)
2538
+ }, {
2539
+ default: f(() => [
2540
+ m(i(lr), null, {
2541
+ default: f(() => [
2542
+ w(e.$slots, "default", {}, () => [
2543
+ (l(!0), v(q, null, U(i(r).options ?? [], (n) => (l(), h(dt, {
2544
+ key: n.key,
2545
+ value: n.value
2546
+ }, null, 8, ["value"]))), 128))
2547
+ ])
2548
+ ]),
2549
+ _: 3
2550
+ })
2551
+ ]),
2552
+ _: 3
2553
+ }, 8, ["class"])
2554
+ ]),
2555
+ _: 3
2556
+ }));
2557
+ }
2558
+ }), jn = /* @__PURE__ */ g({
2559
+ __name: "HeadlessSelect",
2560
+ props: {
2561
+ options: {},
2562
+ placeholder: {},
2563
+ renderOption: { type: Function },
2564
+ name: {},
2565
+ label: {},
2566
+ description: {},
2567
+ modelValue: {}
2568
+ },
2569
+ emits: ["update:modelValue"],
2570
+ setup(t, { expose: r, emit: e }) {
2571
+ const s = e, n = se("form", null), a = p(() => t.modelValue), o = p(() => !n || !t.name ? null : n.errors[t.name] ?? null), u = p(() => t.options ? t.options.map((b) => ({
2572
+ key: te(),
2573
+ label: t.renderOption ? t.renderOption(b) : Tn(b) ? At(b.label) : z(b),
2574
+ value: b
2575
+ })) : null), c = {
2576
+ id: `select-${te()}`,
2577
+ name: p(() => t.name),
2578
+ label: p(() => t.label),
2579
+ description: p(() => t.description),
2580
+ placeholder: p(() => t.placeholder ?? C("ui.select", "Select an option")),
2581
+ options: u,
2582
+ selectedOption: p(() => {
2583
+ var b;
2584
+ return (b = u.value) == null ? void 0 : b.find(($) => $.value === t.modelValue);
2585
+ }),
2586
+ value: p(() => n && t.name ? n.getFieldValue(t.name) : t.modelValue),
2587
+ errors: Ee(o),
2588
+ required: p(() => {
2589
+ if (!(!t.name || !n))
2590
+ return n.getFieldRules(t.name).includes("required");
2591
+ }),
2592
+ update(b) {
2593
+ if (n && t.name) {
2594
+ n.setFieldValue(t.name, b);
2595
+ return;
2596
+ }
2597
+ s("update:modelValue", b);
2598
+ }
2599
+ };
2600
+ function d(b) {
2601
+ c.update(b);
2602
+ }
2603
+ return ce("select", c), r(c), (b, $) => (l(), h(i(ur), {
2604
+ "model-value": a.value,
2605
+ "onUpdate:modelValue": $[0] || ($[0] = (k) => d(k))
2606
+ }, {
2607
+ default: f(({ open: k }) => [
2608
+ w(b.$slots, "default", {
2609
+ modelValue: b.modelValue,
2610
+ open: k
2611
+ }, () => [
2612
+ m(ct),
2613
+ m(pt)
2614
+ ])
2615
+ ]),
2616
+ _: 3
2617
+ }, 8, ["model-value"]));
2618
+ }
2619
+ }), An = /* @__PURE__ */ g({
2620
+ __name: "HeadlessSelectLabel",
2621
+ props: {
2622
+ asChild: { type: Boolean },
2623
+ as: {}
2624
+ },
2625
+ setup(t) {
2626
+ const r = j(
2627
+ "select",
2628
+ "<HeadlessSelectLabel> must be a child of a <HeadlessSelect>"
2629
+ ), e = Se(), s = p(() => !!(r.label || e.default));
2630
+ return (n, a) => s.value ? (l(), h(i(cr), I({
2631
+ key: 0,
2632
+ for: i(r).id
2633
+ }, n.$props), {
2634
+ default: f(() => [
2635
+ w(n.$slots, "default", {}, () => [
2636
+ A(x(i(r).label), 1)
2637
+ ])
2638
+ ]),
2639
+ _: 3
2640
+ }, 16, ["for"])) : M("", !0);
2641
+ }
2642
+ }), Rn = { class: "group" }, zn = { class: "-ml-2 flex w-[max-content] cursor-pointer items-center rounded-lg py-2 pr-3 pl-1 hover:bg-gray-100 focus-visible:outline focus-visible:outline-gray-700" }, Bn = { class: "pt-2 pl-4" }, Ua = /* @__PURE__ */ g({
2643
+ __name: "AdvancedOptions",
2644
+ setup(t) {
2645
+ return (r, e) => (l(), v("details", Rn, [
2646
+ y("summary", zn, [
2647
+ m(i(st), { class: "size-6 transition-transform group-open:rotate-90" }),
2648
+ y("span", null, x(r.$td("ui.advancedOptions", "Advanced options")), 1)
2649
+ ]),
2650
+ y("div", Bn, [
2651
+ w(r.$slots, "default")
2652
+ ])
2653
+ ]));
2654
+ }
2655
+ }), qn = { class: "flex h-6 items-center" }, Na = /* @__PURE__ */ g({
2656
+ inheritAttrs: !1,
2657
+ __name: "Checkbox",
2658
+ props: {
2659
+ name: {},
2660
+ label: {},
2661
+ description: {},
2662
+ modelValue: {},
2663
+ inputClass: {},
2664
+ labelClass: {}
2665
+ },
2666
+ emits: ["update:modelValue"],
2667
+ setup(t) {
2668
+ const r = Z(t, ["inputClass", "labelClass"]), e = me("$input"), [s, n] = it(), a = p(() => T("relative flex items-start", n.value)), o = p(() => {
2669
+ var c, d;
2670
+ return T(
2671
+ "size-4 rounded text-primary hover:bg-gray-200 checked:hover:bg-primary/80 checked:border-0",
2672
+ {
2673
+ "border-gray-300 focus:ring-primary": !((c = e.value) != null && c.errors),
2674
+ "border-red-400 border-2 focus:ring-red-600": (d = e.value) == null ? void 0 : d.errors
2675
+ },
2676
+ t.inputClass
2677
+ );
2678
+ }), u = p(() => T("ml-2 text-sm leading-6", t.labelClass));
2679
+ return (c, d) => (l(), h(at, I({
2680
+ ref_key: "$input",
2681
+ ref: e,
2682
+ class: a.value
2683
+ }, r, {
2684
+ "onUpdate:modelValue": d[0] || (d[0] = (b) => c.$emit("update:modelValue", b))
2685
+ }), {
2686
+ default: f(() => [
2687
+ y("div", qn, [
2688
+ m(ot, I(i(s), {
2689
+ type: "checkbox",
2690
+ class: o.value
2691
+ }), null, 16, ["class"])
2692
+ ]),
2693
+ c.$slots.default ? (l(), v("div", {
2694
+ key: 0,
2695
+ class: P(u.value)
2696
+ }, [
2697
+ m(xe, { class: "text-gray-900" }, {
2698
+ default: f(() => [
2699
+ w(c.$slots, "default")
2700
+ ]),
2701
+ _: 3
2702
+ }),
2703
+ m(Ce, { class: "text-red-600" })
2704
+ ], 2)) : c.label ? (l(), v("div", {
2705
+ key: 1,
2706
+ class: P(u.value)
2707
+ }, [
2708
+ m(xe, { class: "text-gray-900" }),
2709
+ m(Ce, { class: "text-red-600" })
2710
+ ], 2)) : M("", !0)
2711
+ ]),
2712
+ _: 3
2713
+ }, 16, ["class"]));
2714
+ }
2715
+ }), Oa = /* @__PURE__ */ g({
2716
+ __name: "DropdownMenu",
2717
+ props: {
2718
+ align: {},
2719
+ options: {}
2720
+ },
2721
+ setup(t) {
2722
+ return (r, e) => (l(), h(i(dr), null, {
2723
+ default: f(() => [
2724
+ m(i(pr), null, {
2725
+ default: f(() => [
2726
+ w(r.$slots, "default")
2727
+ ]),
2728
+ _: 3
2729
+ }),
2730
+ m(i(mr), null, {
2731
+ default: f(() => [
2732
+ m(i(fr), {
2733
+ class: "gap-y-0.5 rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-black/5",
2734
+ align: r.align
2735
+ }, {
2736
+ default: f(() => [
2737
+ (l(!0), v(q, null, U(r.options, (s, n) => (l(), h(i(hr), {
2738
+ key: n,
2739
+ class: "flex w-full items-center rounded-lg px-2 py-2 text-sm text-gray-900 data-[highlighted]:bg-gray-100",
2740
+ onSelect: s.click
2741
+ }, {
2742
+ default: f(() => [
2743
+ A(x(s.label), 1)
2744
+ ]),
2745
+ _: 2
2746
+ }, 1032, ["onSelect"]))), 128))
2747
+ ]),
2748
+ _: 1
2749
+ }, 8, ["align"])
2750
+ ]),
2751
+ _: 1
2752
+ })
2753
+ ]),
2754
+ _: 3
2755
+ }));
2756
+ }
2757
+ }), Dn = ["aria-hidden"], Fn = ["tabindex", "aria-label", "type"], Wa = /* @__PURE__ */ g({
2758
+ __name: "EditableContent",
2759
+ props: {
2760
+ type: { default: "text" },
2761
+ contentClass: {},
2762
+ ariaLabel: {},
2763
+ formAriaHidden: { type: Boolean },
2764
+ tabindex: {},
2765
+ text: {},
2766
+ disabled: { type: Boolean }
2767
+ },
2768
+ emits: ["update", "save"],
2769
+ setup(t, { emit: r }) {
2770
+ const e = r, s = H(), n = H(null), a = H(t.text), o = p(() => T("inline whitespace-pre", t.contentClass)), u = p(() => T("invisible whitespace-pre", t.contentClass)), c = p(() => T("absolute inset-0 h-full w-full resize-none border-0 bg-transparent p-0 focus:ring-0", t.contentClass));
2771
+ function d() {
2772
+ n.value = t.text;
2773
+ }
2774
+ function b() {
2775
+ n.value && (t.type !== "number" && a.value.trim().length === 0 && (a.value = n.value, e("update", a.value)), n.value = null, e("save"));
2776
+ }
2777
+ return Me(() => a.value = t.text), ($, k) => (l(), v("div", {
2778
+ class: P(["relative", { "pointer-events-none!": $.disabled && !n.value }])
2779
+ }, [
2780
+ n.value ? (l(), v("span", {
2781
+ key: 1,
2782
+ class: P(u.value)
2783
+ }, x(a.value), 3)) : (l(), v("div", {
2784
+ key: 0,
2785
+ class: P(o.value)
2786
+ }, [
2787
+ w($.$slots, "default")
2788
+ ], 2)),
2789
+ $.type === "number" ? (l(), v("span", {
2790
+ key: 2,
2791
+ class: P(["inline-block transition-[width]", n.value ? "w-5" : "w-0"])
2792
+ }, null, 2)) : M("", !0),
2793
+ y("form", {
2794
+ class: "w-full",
2795
+ "aria-hidden": $.formAriaHidden,
2796
+ onSubmit: k[4] || (k[4] = qe((N) => {
2797
+ var Ie;
2798
+ return (Ie = s.value) == null ? void 0 : Ie.blur();
2799
+ }, ["prevent"]))
2800
+ }, [
2801
+ De(y("input", {
2802
+ ref_key: "$input",
2803
+ ref: s,
2804
+ "onUpdate:modelValue": k[0] || (k[0] = (N) => a.value = N),
2805
+ tabindex: $.tabindex ?? void 0,
2806
+ "aria-label": $.ariaLabel ?? void 0,
2807
+ type: $.type,
2808
+ class: P([
2809
+ c.value,
2810
+ { "opacity-0": !n.value, "appearance-textfield": !n.value && $.type === "number" }
2811
+ ]),
2812
+ onKeyup: k[1] || (k[1] = (N) => $.$emit("update", a.value)),
2813
+ onFocus: k[2] || (k[2] = (N) => d()),
2814
+ onBlur: k[3] || (k[3] = (N) => b())
2815
+ }, null, 42, Fn), [
2816
+ [kt, a.value]
2817
+ ])
2818
+ ], 40, Dn)
2819
+ ], 2));
2820
+ }
2821
+ }), Ka = /* @__PURE__ */ g({
2822
+ __name: "ErrorMessage",
2823
+ props: {
2824
+ error: {}
2825
+ },
2826
+ setup(t) {
2827
+ const r = p(() => Fr(t.error));
2828
+ return (e, s) => (l(), h(R, {
2829
+ text: r.value,
2830
+ inline: ""
2831
+ }, null, 8, ["text"]));
2832
+ }
2833
+ }), Ja = /* @__PURE__ */ g({
2834
+ __name: "Link",
2835
+ props: {
2836
+ class: {},
2837
+ disabled: { type: Boolean },
2838
+ href: {},
2839
+ route: {},
2840
+ routeParams: {},
2841
+ routeQuery: {},
2842
+ size: {},
2843
+ submit: { type: Boolean },
2844
+ asChild: { type: Boolean },
2845
+ as: {}
2846
+ },
2847
+ setup(t) {
2848
+ return (r, e) => (l(), h(V, I({ variant: "link" }, r.$props), {
2849
+ default: f(() => [
2850
+ w(r.$slots, "default")
2851
+ ]),
2852
+ _: 3
2853
+ }, 16));
2854
+ }
2855
+ }), Un = {
2856
+ viewBox: "0 0 20 20",
2857
+ width: "1.2em",
2858
+ height: "1.2em"
2859
+ };
2860
+ function Nn(t, r) {
2861
+ return l(), v("svg", Un, r[0] || (r[0] = [
2862
+ y("path", {
2863
+ fill: "currentColor",
2864
+ d: "m9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828L5.757 6.586L4.343 8z"
2865
+ }, null, -1)
2866
+ ]));
2867
+ }
2868
+ const On = { name: "zondicons-cheveron-down", render: Nn }, Wn = { class: "relative flex max-w-[calc(100vw-2rem)] cursor-pointer items-center truncate rounded-md px-2 py-1 select-none *:truncate group-data-[highlighted]:bg-gray-100 group-data-[state=checked]:font-semibold group-data-[state=unchecked]:opacity-50" }, Kn = { class: "text-sm" }, Qa = /* @__PURE__ */ g({
2869
+ __name: "Select",
2870
+ props: {
2871
+ options: {},
2872
+ placeholder: {},
2873
+ renderOption: { type: Function },
2874
+ name: {},
2875
+ label: {},
2876
+ description: {},
2877
+ modelValue: {}
2878
+ },
2879
+ emits: ["update:modelValue"],
2880
+ setup(t) {
2881
+ const r = me("$select");
2882
+ return (e, s) => (l(), h(jn, I({
2883
+ ref_key: "$select",
2884
+ ref: r
2885
+ }, e.$props, {
2886
+ "onUpdate:modelValue": s[0] || (s[0] = (n) => e.$emit("update:modelValue", n))
2887
+ }), {
2888
+ default: f(() => [
2889
+ m(An, { class: "block text-sm leading-6 font-medium text-gray-900" }),
2890
+ w(e.$slots, "default", {}, () => [
2891
+ m(ct, {
2892
+ class: P(["focus:outline-primary grid w-full cursor-default grid-cols-1 rounded-md bg-white py-1.5 pr-2 pl-3 text-left text-gray-900 outline outline-1 -outline-offset-1 outline-gray-300 focus:outline focus:outline-2 focus:-outline-offset-2 sm:text-sm/6", { "mt-1": e.label }])
2893
+ }, {
2894
+ default: f(() => [
2895
+ m(ut, { class: "col-start-1 row-start-1 truncate pr-6" }),
2896
+ m(i(On), { class: "col-start-1 row-start-1 size-5 self-center justify-self-end text-gray-500 sm:size-4" })
2897
+ ]),
2898
+ _: 1
2899
+ }, 8, ["class"]),
2900
+ m(pt, { class: "z-50 overflow-auto rounded-lg bg-white text-base shadow-lg ring-1 ring-black/5 focus:outline-hidden" }, {
2901
+ default: f(() => {
2902
+ var n;
2903
+ return [
2904
+ (l(!0), v(q, null, U(((n = i(r)) == null ? void 0 : n.options) ?? [], (a) => (l(), h(dt, {
2905
+ key: a.key,
2906
+ value: a.value,
2907
+ class: "group p-1 outline-none"
2908
+ }, {
2909
+ default: f(() => [
2910
+ y("div", Wn, [
2911
+ y("span", Kn, x(a.label), 1)
2912
+ ])
2913
+ ]),
2914
+ _: 2
2915
+ }, 1032, ["value"]))), 128))
2916
+ ];
2917
+ }),
2918
+ _: 1
2919
+ })
2920
+ ])
2921
+ ]),
2922
+ _: 3
2923
+ }, 16));
2924
+ }
2925
+ });
2926
+ class Ga {
2927
+ constructor() {
2928
+ _(this, "status");
2929
+ _(this, "_listeners");
2930
+ _(this, "_progress");
2931
+ _(this, "_cancelled");
2932
+ _(this, "_started");
2933
+ _(this, "_completed");
2934
+ this.status = this.getInitialStatus(), this._listeners = new Rt(), this._started = new O(), this._completed = new O();
2935
+ }
2936
+ async start() {
2937
+ this.beforeStart(), this._started.resolve();
2938
+ try {
2939
+ await this.updateProgress(), await this.run(), await this.updateProgress(), this._completed.resolve();
2940
+ } catch (r) {
2941
+ if (r instanceof Ae)
2942
+ return;
2943
+ throw K(zt(r), (e) => {
2944
+ this._completed.reject(e);
2945
+ });
2946
+ }
2947
+ }
2948
+ async cancel() {
2949
+ this._cancelled = new O(), await this._cancelled;
2950
+ }
2951
+ serialize() {
2952
+ return this.serializeStatus(this.status);
2953
+ }
2954
+ get listeners() {
2955
+ return this._listeners;
2956
+ }
2957
+ get progress() {
2958
+ return this._progress ?? 0;
2959
+ }
2960
+ get cancelled() {
2961
+ var r;
2962
+ return !!((r = this._cancelled) != null && r.isResolved());
2963
+ }
2964
+ get started() {
2965
+ return this._started;
2966
+ }
2967
+ get completed() {
2968
+ return this._completed;
2969
+ }
2970
+ getInitialStatus() {
2971
+ return { completed: !1 };
2972
+ }
2973
+ beforeStart() {
2974
+ if (this._started.isResolved()) {
2975
+ if (this._cancelled) {
2976
+ delete this._progress, delete this._cancelled;
2977
+ return;
2978
+ }
2979
+ throw new Error("Job already started!");
2980
+ }
2981
+ }
2982
+ assertNotCancelled() {
2983
+ if (this._cancelled)
2984
+ throw this._cancelled.resolve(), new Ae();
2985
+ }
2986
+ calculateCurrentProgress(r) {
2987
+ return r ?? (r = this.status), r.completed ? 1 : r.children ? Bt(
2988
+ r.children.reduce((e, s) => e + this.calculateCurrentProgress(s), 0) / r.children.length,
2989
+ 2
2990
+ ) : 0;
2991
+ }
2992
+ async updateProgress(r) {
2993
+ await (r == null ? void 0 : r(this.status));
2994
+ const e = this.calculateCurrentProgress();
2995
+ e !== this._progress && (this._progress = e, await this._listeners.emit("onUpdated", e));
2996
+ }
2997
+ serializeStatus(r) {
2998
+ return { ...r };
2999
+ }
3000
+ }
3001
+ async function Za(t) {
3002
+ await t.start();
3003
+ }
3004
+ export {
3005
+ Ua as AdvancedOptions,
3006
+ ms as AlertModal,
3007
+ F as App,
3008
+ Ra as AppLayout,
3009
+ In as AppOverlays,
3010
+ Cr as AppService,
3011
+ V as Button,
3012
+ ka as Cache,
3013
+ Hr as CacheService,
3014
+ Na as Checkbox,
3015
+ Cs as ConfirmModal,
3016
+ Oa as DropdownMenu,
3017
+ Wa as EditableContent,
3018
+ Ka as ErrorMessage,
3019
+ Xs as ErrorReportModal,
3020
+ Us as ErrorReportModalButtons,
3021
+ Ns as ErrorReportModalTitle,
3022
+ Qe as Errors,
3023
+ oa as EventListenerPriorities,
3024
+ S as Events,
3025
+ $r as EventsService,
3026
+ tt as Form,
3027
+ gs as FormController,
3028
+ B as FormFieldTypes,
3029
+ ns as HeadlessButton,
3030
+ at as HeadlessInput,
3031
+ cn as HeadlessInputDescription,
3032
+ Ce as HeadlessInputError,
3033
+ ot as HeadlessInputInput,
3034
+ xe as HeadlessInputLabel,
3035
+ Ba as HeadlessInputTextArea,
3036
+ is as HeadlessModal,
3037
+ ls as HeadlessModalContent,
3038
+ us as HeadlessModalOverlay,
3039
+ cs as HeadlessModalTitle,
3040
+ jn as HeadlessSelect,
3041
+ An as HeadlessSelectLabel,
3042
+ dt as HeadlessSelectOption,
3043
+ pt as HeadlessSelectOptions,
3044
+ ct as HeadlessSelectTrigger,
3045
+ ut as HeadlessSelectValue,
3046
+ xn as HeadlessToast,
3047
+ mn as Input,
3048
+ Ga as Job,
3049
+ Ae as JobCancelledError,
3050
+ re as Lang,
3051
+ le as Layouts,
3052
+ Ja as Link,
3053
+ on as LoadingModal,
3054
+ We as MOBILE_BREAKPOINT,
3055
+ R as Markdown,
3056
+ ne as Modal,
3057
+ et as ModalContext,
3058
+ nn as ProgressBar,
3059
+ gn as PromptModal,
3060
+ Qa as Select,
3061
+ ge as Service,
3062
+ $e as ServiceBootError,
3063
+ wn as StartupCrash,
3064
+ Lr as Storage,
3065
+ Cn as Toast,
3066
+ L as UI,
3067
+ E as UIComponents,
3068
+ Ar as UIService,
3069
+ la as arrayProp,
3070
+ Pa as booleanInput,
3071
+ ua as booleanProp,
3072
+ ve as bootServices,
3073
+ Aa as bootstrap,
3074
+ Mn as bootstrapApplication,
3075
+ ca as computedAsync,
3076
+ Ha as dateInput,
3077
+ da as defineDirective,
3078
+ Ea as defineFormValidationRule,
3079
+ ia as definePlugin,
3080
+ he as defineServiceState,
3081
+ wr as defineServiceStore,
3082
+ Za as dispatch,
3083
+ za as elementRef,
3084
+ pa as enumProp,
3085
+ Ke as getCurrentLayout,
3086
+ Fr as getErrorMessage,
3087
+ _r as getPiniaStore,
3088
+ Tn as hasSelectOptionLabel,
3089
+ ma as injectOrFail,
3090
+ Sr as injectReactive,
3091
+ j as injectReactiveOrFail,
3092
+ kr as installPlugins,
3093
+ fa as listenerProp,
3094
+ ha as mixedProp,
3095
+ Va as numberInput,
3096
+ ga as numberProp,
3097
+ va as objectProp,
3098
+ qa as onCleanMounted,
3099
+ Da as persistent,
3100
+ Ma as registerErrorHandler,
3101
+ Fa as removeInteractiveClasses,
3102
+ ts as renderMarkdown,
3103
+ Sa as replaceExisting,
3104
+ ba as requiredArrayProp,
3105
+ Ia as requiredBooleanInput,
3106
+ La as requiredDateInput,
3107
+ ya as requiredEnumProp,
3108
+ _a as requiredMixedProp,
3109
+ Ta as requiredNumberInput,
3110
+ wa as requiredNumberProp,
3111
+ $a as requiredObjectProp,
3112
+ vs as requiredStringInput,
3113
+ xa as requiredStringProp,
3114
+ yr as resetPiniaStore,
3115
+ rs as safeHtml,
3116
+ ja as stringInput,
3117
+ Ca as stringProp,
3118
+ Je as translate,
3119
+ C as translateWithDefault,
3120
+ bs as useConfirmModal,
3121
+ ee as useEvent,
3122
+ rt as useForm,
3123
+ it as useInputAttrs,
3124
+ an as useLoadingModal,
3125
+ fn as usePromptModal,
3126
+ hs as validate,
3127
+ ae as validators
3128
+ };
3129
+ //# sourceMappingURL=aerogel-core.js.map