@aerogel/core 0.0.0-next.a56c0f4966eb71571173f8502f3f36d357ceebc7 → 0.0.0-next.aa6e27a9c197d1ee10c9fe018ee8c0fc6ff77767

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 (190) hide show
  1. package/dist/aerogel-core.d.ts +2004 -1034
  2. package/dist/aerogel-core.js +3223 -0
  3. package/dist/aerogel-core.js.map +1 -0
  4. package/package.json +27 -37
  5. package/src/bootstrap/bootstrap.test.ts +7 -11
  6. package/src/bootstrap/index.ts +36 -16
  7. package/src/bootstrap/options.ts +4 -1
  8. package/src/components/AppLayout.vue +16 -0
  9. package/src/components/{AGAppModals.vue → AppModals.vue} +3 -4
  10. package/src/components/{AGAppOverlays.vue → AppOverlays.vue} +5 -6
  11. package/src/components/AppToasts.vue +16 -0
  12. package/src/components/composition.ts +23 -0
  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 +36 -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/HeadlessInputDescription.vue +27 -0
  29. package/src/components/headless/{forms/AGHeadlessInputError.vue → HeadlessInputError.vue} +4 -8
  30. package/src/components/headless/HeadlessInputInput.vue +75 -0
  31. package/src/components/headless/HeadlessInputLabel.vue +18 -0
  32. package/src/components/headless/HeadlessInputTextArea.vue +40 -0
  33. package/src/components/headless/{modals/AGHeadlessModal.vue → HeadlessModal.vue} +17 -19
  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 +105 -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 +5 -9
  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} +38 -29
  58. package/src/components/ui/ErrorReportModalTitle.vue +24 -0
  59. package/src/components/ui/Form.vue +24 -0
  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/ui/ModalContext.vue +30 -0
  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 +21 -0
  69. package/src/components/ui/SelectLabel.vue +10 -0
  70. package/src/components/ui/SelectOptions.vue +31 -0
  71. package/src/components/ui/SelectTrigger.vue +29 -0
  72. package/src/components/ui/SettingsModal.vue +51 -0
  73. package/src/components/{lib/AGStartupCrash.vue → ui/StartupCrash.vue} +8 -8
  74. package/src/components/ui/Toast.vue +42 -0
  75. package/src/components/ui/index.ts +27 -0
  76. package/src/components/utils.ts +107 -0
  77. package/src/directives/index.ts +13 -5
  78. package/src/directives/measure.ts +40 -0
  79. package/src/errors/Errors.state.ts +1 -1
  80. package/src/errors/Errors.ts +35 -34
  81. package/src/errors/JobCancelledError.ts +3 -0
  82. package/src/errors/index.ts +11 -17
  83. package/src/errors/utils.ts +35 -0
  84. package/src/forms/{Form.test.ts → FormController.test.ts} +33 -4
  85. package/src/forms/{Form.ts → FormController.ts} +86 -25
  86. package/src/forms/composition.ts +4 -4
  87. package/src/forms/index.ts +3 -1
  88. package/src/forms/utils.ts +36 -5
  89. package/src/forms/validation.ts +19 -0
  90. package/src/index.css +41 -0
  91. package/src/{main.ts → index.ts} +3 -0
  92. package/src/jobs/Job.ts +147 -0
  93. package/src/jobs/index.ts +10 -0
  94. package/src/jobs/listeners.ts +3 -0
  95. package/src/jobs/status.ts +4 -0
  96. package/src/lang/DefaultLangProvider.ts +46 -0
  97. package/src/lang/Lang.state.ts +11 -0
  98. package/src/lang/Lang.ts +44 -29
  99. package/src/lang/index.ts +8 -6
  100. package/src/plugins/Plugin.ts +1 -1
  101. package/src/plugins/index.ts +10 -7
  102. package/src/services/App.state.ts +27 -5
  103. package/src/services/App.ts +32 -6
  104. package/src/services/Cache.ts +43 -0
  105. package/src/services/Events.test.ts +39 -0
  106. package/src/services/Events.ts +112 -32
  107. package/src/services/Service.ts +154 -49
  108. package/src/services/Storage.ts +20 -0
  109. package/src/services/index.ts +15 -6
  110. package/src/services/store.ts +8 -5
  111. package/src/services/utils.ts +18 -0
  112. package/src/testing/index.ts +26 -0
  113. package/src/testing/setup.ts +11 -0
  114. package/src/ui/UI.state.ts +19 -7
  115. package/src/ui/UI.ts +252 -63
  116. package/src/ui/index.ts +23 -17
  117. package/src/ui/utils.ts +16 -0
  118. package/src/utils/composition/events.ts +3 -2
  119. package/src/utils/composition/forms.ts +4 -3
  120. package/src/utils/composition/persistent.test.ts +33 -0
  121. package/src/utils/composition/persistent.ts +11 -0
  122. package/src/utils/composition/state.test.ts +47 -0
  123. package/src/utils/composition/state.ts +24 -0
  124. package/src/utils/index.ts +3 -0
  125. package/src/utils/markdown.test.ts +50 -0
  126. package/src/utils/markdown.ts +19 -6
  127. package/src/utils/tailwindcss.test.ts +26 -0
  128. package/src/utils/tailwindcss.ts +7 -0
  129. package/src/utils/vdom.ts +31 -0
  130. package/src/utils/vue.ts +31 -19
  131. package/dist/aerogel-core.cjs.js +0 -2
  132. package/dist/aerogel-core.cjs.js.map +0 -1
  133. package/dist/aerogel-core.esm.js +0 -2
  134. package/dist/aerogel-core.esm.js.map +0 -1
  135. package/histoire.config.ts +0 -7
  136. package/noeldemartin.config.js +0 -5
  137. package/postcss.config.js +0 -6
  138. package/src/assets/histoire.css +0 -3
  139. package/src/components/AGAppLayout.vue +0 -15
  140. package/src/components/AGAppSnackbars.vue +0 -13
  141. package/src/components/constants.ts +0 -8
  142. package/src/components/forms/AGButton.vue +0 -44
  143. package/src/components/forms/AGCheckbox.vue +0 -35
  144. package/src/components/forms/AGForm.vue +0 -26
  145. package/src/components/forms/AGInput.vue +0 -36
  146. package/src/components/forms/AGSelect.story.vue +0 -28
  147. package/src/components/forms/AGSelect.vue +0 -53
  148. package/src/components/forms/index.ts +0 -5
  149. package/src/components/headless/forms/AGHeadlessButton.vue +0 -51
  150. package/src/components/headless/forms/AGHeadlessInput.ts +0 -8
  151. package/src/components/headless/forms/AGHeadlessInput.vue +0 -54
  152. package/src/components/headless/forms/AGHeadlessInputInput.vue +0 -45
  153. package/src/components/headless/forms/AGHeadlessInputLabel.vue +0 -16
  154. package/src/components/headless/forms/AGHeadlessSelect.ts +0 -43
  155. package/src/components/headless/forms/AGHeadlessSelect.vue +0 -77
  156. package/src/components/headless/forms/AGHeadlessSelectButton.vue +0 -24
  157. package/src/components/headless/forms/AGHeadlessSelectLabel.vue +0 -21
  158. package/src/components/headless/forms/AGHeadlessSelectOption.ts +0 -4
  159. package/src/components/headless/forms/AGHeadlessSelectOption.vue +0 -39
  160. package/src/components/headless/forms/AGHeadlessSelectOptions.ts +0 -3
  161. package/src/components/headless/forms/index.ts +0 -14
  162. package/src/components/headless/modals/AGHeadlessModal.ts +0 -7
  163. package/src/components/headless/modals/AGHeadlessModalPanel.vue +0 -28
  164. package/src/components/headless/modals/AGHeadlessModalTitle.vue +0 -13
  165. package/src/components/headless/modals/index.ts +0 -6
  166. package/src/components/headless/snackbars/AGHeadlessSnackbar.vue +0 -10
  167. package/src/components/headless/snackbars/index.ts +0 -25
  168. package/src/components/lib/AGErrorMessage.vue +0 -16
  169. package/src/components/lib/AGLink.vue +0 -9
  170. package/src/components/lib/AGMarkdown.vue +0 -36
  171. package/src/components/lib/index.ts +0 -4
  172. package/src/components/modals/AGAlertModal.vue +0 -25
  173. package/src/components/modals/AGConfirmModal.vue +0 -30
  174. package/src/components/modals/AGErrorReportModal.ts +0 -20
  175. package/src/components/modals/AGErrorReportModal.vue +0 -62
  176. package/src/components/modals/AGErrorReportModalTitle.vue +0 -25
  177. package/src/components/modals/AGLoadingModal.vue +0 -19
  178. package/src/components/modals/AGModal.ts +0 -10
  179. package/src/components/modals/AGModal.vue +0 -37
  180. package/src/components/modals/AGModalContext.ts +0 -8
  181. package/src/components/modals/AGModalContext.vue +0 -22
  182. package/src/components/modals/AGModalTitle.vue +0 -9
  183. package/src/components/modals/index.ts +0 -23
  184. package/src/components/snackbars/AGSnackbar.vue +0 -42
  185. package/src/components/snackbars/index.ts +0 -3
  186. package/src/directives/initial-focus.ts +0 -11
  187. package/src/main.histoire.ts +0 -1
  188. package/tailwind.config.js +0 -4
  189. package/tsconfig.json +0 -11
  190. package/vite.config.ts +0 -14
@@ -0,0 +1,3223 @@
1
+ var vt = Object.defineProperty;
2
+ var bt = (t, s, e) => s in t ? vt(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
3
+ var _ = (t, s, e) => bt(t, typeof s != "symbol" ? s + "" : s, e);
4
+ import { ref as L, computed as p, watch as Ce, inject as ne, reactive as ie, markRaw as Ie, nextTick as Be, createElementBlock as b, openBlock as i, createElementVNode as y, Comment as yt, Text as _t, Static as wt, defineComponent as g, useAttrs as qe, useSlots as Se, createBlock as h, h as $t, unref as l, mergeProps as T, withCtx as f, renderSlot as w, onUnmounted as de, createPropsRestProxy as Y, createVNode as m, provide as pe, toRef as Te, resolveDynamicComponent as Q, normalizeProps as ae, guardReactiveProps as oe, createCommentVNode as M, useTemplateRef as ke, normalizeClass as P, toDisplayString as $, watchEffect as Me, withModifiers as De, readonly as Ee, Fragment as q, renderList as N, withDirectives as Fe, vModelCheckbox as xt, createTextVNode as j, normalizeStyle as Ct, createApp as St, customRef as kt, onMounted as Mt, toRaw as Et, vModelText as Pt } from "vue";
5
+ import { JSError as me, tap as G, MagicObject as Ue, PromisedValue as W, Storage as D, objectOnly as te, arrayFrom as Ne, isEmpty as ve, objectDeepClone as Lt, fail as K, facade as Z, arrayRemove as _e, getEnv as Ht, updateLocationQueryParameters as It, forever as Tt, toString as z, isDevelopment as X, isTesting as Pe, after as Ve, uuid as re, required as Vt, isObject as ue, objectWithoutEmpty as Oe, stringMatchAll as At, isInstanceOf as jt, stringExcerpt as Rt, objectWithout as zt, noop as Bt, value as qt, ListenersManager as Dt, toError as Ft, round as Ut } from "@noeldemartin/utils";
6
+ import F from "virtual:aerogel";
7
+ import { createPinia as Nt, setActivePinia as Ot, defineStore as Wt } from "pinia";
8
+ import Kt from "dompurify";
9
+ import { marked as Jt, Renderer as Ae } from "marked";
10
+ import { Primitive as Qt, DialogRoot as Gt, DialogPortal as Zt, DialogContent as Xt, DialogOverlay as Yt, DialogTitle as es, ToastClose as ts, ToastRoot as ss, ToastProvider as rs, ToastViewport as ns, SelectValue as as, SelectTrigger as os, SelectIcon as ls, SelectItem as is, SelectItemText as us, SelectPortal as cs, SelectContent as ds, SelectViewport as ps, SelectRoot as ms, Label as fs, DropdownMenuRoot as hs, DropdownMenuTrigger as gs, DropdownMenuPortal as vs, DropdownMenuContent as bs, DropdownMenuItem as ys } from "reka-ui";
11
+ import _s from "clsx";
12
+ import { cva as ws } from "class-variance-authority";
13
+ import { twMerge as $s } from "tailwind-merge";
14
+ class we extends me {
15
+ constructor(s, e) {
16
+ super(`Service '${s}' failed booting`, { cause: e });
17
+ }
18
+ }
19
+ let Le = null;
20
+ function We() {
21
+ return Le ?? xs();
22
+ }
23
+ function xs() {
24
+ return G(Nt(), (t) => {
25
+ Le = t, Ot(t);
26
+ });
27
+ }
28
+ function Cs() {
29
+ return Le ?? We();
30
+ }
31
+ function Ss(t, s) {
32
+ return We(), Wt(t, s)();
33
+ }
34
+ function fe(t) {
35
+ var s;
36
+ return s = class extends he {
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, [r, n]) => {
45
+ try {
46
+ n = structuredClone(n);
47
+ } catch {
48
+ console.warn(
49
+ `Could not clone '${r}' 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[r] = n, e;
54
+ }, {});
55
+ }
56
+ getComputedStateDefinition() {
57
+ return t.computed ?? {};
58
+ }
59
+ getStateWatchers() {
60
+ return t.watch ?? {};
61
+ }
62
+ serializePersistedState(e) {
63
+ var r;
64
+ return ((r = t.serialize) == null ? void 0 : r.call(t, e)) ?? e;
65
+ }
66
+ deserializePersistedState(e) {
67
+ var r;
68
+ return ((r = t.restore) == null ? void 0 : r.call(t, e)) ?? e;
69
+ }
70
+ }, _(s, "persist", t.persist ?? []), s;
71
+ }
72
+ var ye;
73
+ let he = (ye = class extends Ue {
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 W(), this._computedStateKeys = new Set(Object.keys(e)), this._watchers = this.getStateWatchers(), this._store = this.usesStore() && Ss(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 = (r) => this._booted.reject(new we(this._name, r));
96
+ try {
97
+ this.frameworkBoot().then(() => this.boot()).then(() => this._booted.resolve()).catch(e);
98
+ } catch (r) {
99
+ e(r);
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 r = this._store;
111
+ return e ? r ? r[e] : void 0 : r || {};
112
+ }
113
+ setState(e, r) {
114
+ if (!this._store)
115
+ return;
116
+ const n = typeof e == "string" ? { [e]: r } : e, a = te(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 r = Ne(e), n = te(this._store.$state, r);
123
+ ve(n) || this.onPersistentStateUpdated(n);
124
+ }
125
+ __get(e) {
126
+ return this.hasState(e) ? this.getState(e) : super.__get(e);
127
+ }
128
+ __set(e, r) {
129
+ this.setState({ [e]: r });
130
+ }
131
+ onStateUpdated(e, r) {
132
+ const n = te(e, this.static("persist"));
133
+ ve(n) || this.onPersistentStateUpdated(n);
134
+ for (const a in e) {
135
+ const o = this._watchers[a];
136
+ !o || e[a] === r[a] || o.call(this, e[a], r[a]);
137
+ }
138
+ }
139
+ onPersistentStateUpdated(e) {
140
+ const r = D.get(this._name);
141
+ r && D.set(this._name, {
142
+ ...r,
143
+ ...this.serializePersistedState(Lt(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() || ve(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, te(this.getState(), this.static("persist")));
180
+ }
181
+ }
182
+ requireStore() {
183
+ return this._store ? this._store : K(`Failed getting '${this._name}' store`);
184
+ }
185
+ }, _(ye, "persist", []), ye);
186
+ const da = {
187
+ Low: -256,
188
+ Default: 0,
189
+ High: 256
190
+ };
191
+ class ks extends he {
192
+ constructor() {
193
+ super(...arguments);
194
+ _(this, "listeners", {});
195
+ }
196
+ async boot() {
197
+ Object.entries(globalThis.__aerogelEvents__ ?? {}).forEach(([e, r]) => this.on(e, r));
198
+ }
199
+ async emit(e, r) {
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(r))) ?? []);
204
+ }
205
+ // prettier-ignore
206
+ /* eslint-enable max-len */
207
+ on(e, r, n) {
208
+ const a = typeof r == "function" ? {} : typeof r == "number" ? { priority: r } : r, o = typeof r == "function" ? r : n;
209
+ return this.registerListener(e, a, o), () => this.off(e, o);
210
+ }
211
+ // prettier-ignore
212
+ /* eslint-enable max-len */
213
+ once(e, r, n) {
214
+ let a = null;
215
+ const o = typeof r == "function" ? {} : r, u = typeof r == "function" ? r : n;
216
+ return G(
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, r) {
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
+ _e(n.handlers[u] ?? [], r), ((o = n.handlers[u]) == null ? void 0 : o.length) === 0 && (delete n.handlers[u], _e(n.priorities, u));
231
+ n.priorities.length === 0 && delete this.listeners[e];
232
+ }
233
+ registerListener(e, r, n) {
234
+ var c, d, v;
235
+ const a = r.priority ?? 0;
236
+ e in this.listeners || (this.listeners[e] = { priorities: [], handlers: {} });
237
+ const o = ((c = this.listeners[e]) == null ? void 0 : c.priorities) ?? K(`priorities missing for event '${e}'`), u = ((d = this.listeners[e]) == null ? void 0 : d.handlers) ?? K(`handlers missing for event '${e}'`);
238
+ o.includes(a) || (o.push(a), o.sort((x, S) => S - x), u[a] = []), (v = u[a]) == null || v.push(n);
239
+ }
240
+ }
241
+ const k = Z(ks), Ms = fe({
242
+ name: "app",
243
+ initialState: {
244
+ plugins: {},
245
+ instance: null,
246
+ environment: Ht() ?? "development",
247
+ version: F.version,
248
+ sourceUrl: F.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." + F.sourceHash.toString().substring(0, 7) : this.staging ? "staging." + F.sourceHash.toString().substring(0, 7) : `v${t.version}`;
256
+ },
257
+ versionUrl(t) {
258
+ return t.sourceUrl + (this.development || this.staging ? `/tree/${F.sourceHash}` : `/releases/tag/${this.versionName}`);
259
+ }
260
+ }
261
+ });
262
+ class Es extends Ms {
263
+ constructor() {
264
+ super(...arguments);
265
+ _(this, "name", F.name);
266
+ _(this, "ready", new W());
267
+ _(this, "mounted", new W());
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 && It(e), location.reload(), await Tt();
280
+ }
281
+ plugin(e) {
282
+ return this.plugins[e] ?? null;
283
+ }
284
+ service(e) {
285
+ var r;
286
+ return ((r = this.instance) == null ? void 0 : r.config.globalProperties[e]) ?? null;
287
+ }
288
+ async boot() {
289
+ k.once("application-ready", () => this.ready.resolve()), k.once("application-mounted", () => this.mounted.resolve());
290
+ }
291
+ }
292
+ const U = Z(Es);
293
+ function pa(t) {
294
+ return t;
295
+ }
296
+ async function Ps(t, ...s) {
297
+ U.setState(
298
+ "plugins",
299
+ t.reduce(
300
+ (e, r) => (r.name && (e[r.name] = r), e),
301
+ {}
302
+ )
303
+ ), await Promise.all(t.map((e) => e.install(...s)) ?? []);
304
+ }
305
+ function ma(t) {
306
+ return {
307
+ type: Array,
308
+ default: t ?? (() => [])
309
+ };
310
+ }
311
+ function fa(t = !1) {
312
+ return {
313
+ type: Boolean,
314
+ default: t
315
+ };
316
+ }
317
+ function ha(t) {
318
+ const s = L(), e = p(t);
319
+ return Ce(e, async () => s.value = await e.value, { immediate: !0 }), s;
320
+ }
321
+ function ga(t) {
322
+ return t;
323
+ }
324
+ function va(t, s) {
325
+ const e = Object.values(t);
326
+ return {
327
+ type: String,
328
+ default: s ?? e[0] ?? null,
329
+ validator: (r) => e.includes(r)
330
+ };
331
+ }
332
+ function Ls(t) {
333
+ const s = ne(t);
334
+ return s ? ie(s) : void 0;
335
+ }
336
+ function H(t, s) {
337
+ return Ls(t) ?? K(s ?? `Could not resolve '${z(t)}' injection key`);
338
+ }
339
+ function ba(t, s) {
340
+ return ne(t) ?? K(s ?? `Could not resolve '${z(t)}' injection key`);
341
+ }
342
+ function ya() {
343
+ return {
344
+ type: Function,
345
+ default: null
346
+ };
347
+ }
348
+ function _a(t, s) {
349
+ return {
350
+ type: t,
351
+ default: s ?? null
352
+ };
353
+ }
354
+ function wa(t = null) {
355
+ return {
356
+ type: Number,
357
+ default: t
358
+ };
359
+ }
360
+ function $a(t = null) {
361
+ return {
362
+ type: Object,
363
+ default: t
364
+ };
365
+ }
366
+ function xa() {
367
+ return {
368
+ type: Array,
369
+ required: !0
370
+ };
371
+ }
372
+ function Ca(t) {
373
+ const s = Object.values(t);
374
+ return {
375
+ type: String,
376
+ required: !0,
377
+ validator: (e) => s.includes(e)
378
+ };
379
+ }
380
+ function Sa(t) {
381
+ return {
382
+ type: t,
383
+ required: !0
384
+ };
385
+ }
386
+ function ka() {
387
+ return {
388
+ type: Number,
389
+ required: !0
390
+ };
391
+ }
392
+ function Ma() {
393
+ return {
394
+ type: Object,
395
+ required: !0
396
+ };
397
+ }
398
+ function Ea() {
399
+ return {
400
+ type: String,
401
+ required: !0
402
+ };
403
+ }
404
+ function Pa(t = null) {
405
+ return {
406
+ type: String,
407
+ default: t
408
+ };
409
+ }
410
+ const be = /* @__PURE__ */ new WeakMap(), Hs = {
411
+ mounted(t, { value: s }) {
412
+ const e = typeof s == "function" ? s : null, r = () => {
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
+ be.set(t, G(new ResizeObserver(r)).observe(t)), r();
417
+ },
418
+ unmounted(t) {
419
+ var s;
420
+ (s = be.get(t)) == null || s.unobserve(t), be.delete(t);
421
+ }
422
+ }, Is = {
423
+ measure: Hs
424
+ }, Ts = {
425
+ install(t, s) {
426
+ const e = {
427
+ ...Is,
428
+ ...s.directives
429
+ };
430
+ for (const [r, n] of Object.entries(e))
431
+ t.directive(r, n);
432
+ }
433
+ };
434
+ class Vs extends he {
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, r) {
443
+ await (await this.open()).put(e, r);
444
+ }
445
+ async replace(e, r) {
446
+ const n = await this.open();
447
+ (await n.keys(e)).length !== 0 && await n.put(e, r);
448
+ }
449
+ async open() {
450
+ return this.cache = this.cache ?? G(new W(), (e) => {
451
+ caches.open("app").then((r) => e.resolve(r));
452
+ });
453
+ }
454
+ }
455
+ const La = Z(Vs);
456
+ class As extends he {
457
+ async purge() {
458
+ await k.emit("purge-storage");
459
+ }
460
+ }
461
+ const js = Z(As);
462
+ function Ha(t, s) {
463
+ return {
464
+ ...t,
465
+ ...te(s, Object.keys(t))
466
+ };
467
+ }
468
+ const Rs = {
469
+ $app: U,
470
+ $events: k,
471
+ $storage: js
472
+ };
473
+ async function ge(t, s) {
474
+ await Promise.all(
475
+ Object.entries(s).map(async ([e, r]) => {
476
+ await r.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, s), (X() || Pe()) && Object.assign(globalThis, s);
482
+ }
483
+ const zs = {
484
+ async install(t, s) {
485
+ const e = {
486
+ ...Rs,
487
+ ...s.services
488
+ };
489
+ t.use(Cs()), await ge(t, e);
490
+ }
491
+ }, Ke = 768, ce = {
492
+ Mobile: "mobile",
493
+ Desktop: "desktop"
494
+ };
495
+ function Je() {
496
+ return globalThis.innerWidth > Ke ? ce.Desktop : ce.Mobile;
497
+ }
498
+ const Bs = fe({
499
+ name: "ui",
500
+ initialState: {
501
+ modals: [],
502
+ toasts: [],
503
+ layout: Je()
504
+ },
505
+ computed: {
506
+ mobile: ({ layout: t }) => t === ce.Mobile,
507
+ desktop: ({ layout: t }) => t === ce.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 qs extends Bs {
519
+ constructor() {
520
+ super(...arguments);
521
+ _(this, "modalCallbacks", {});
522
+ _(this, "components", {});
523
+ }
524
+ requireComponent(e) {
525
+ return this.components[e] ?? K(`UI Component '${e}' is not defined!`);
526
+ }
527
+ alert(e, r) {
528
+ const n = () => typeof r != "string" ? { message: e } : {
529
+ title: e,
530
+ message: r
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, r, n) {
540
+ const o = typeof r != "string" ? {
541
+ ...r ?? {},
542
+ message: e,
543
+ required: !!(r != null && r.required)
544
+ } : {
545
+ ...n ?? {},
546
+ title: e,
547
+ message: r,
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, v = typeof c == "object" ? c[1] : Object.entries(o.checkboxes ?? {}).reduce(
553
+ (x, [S, { default: O }]) => ({
554
+ [S]: O ?? !1,
555
+ ...x
556
+ }),
557
+ {}
558
+ );
559
+ for (const [x, S] of Object.entries(o.checkboxes ?? {}))
560
+ if (!(!S.required || v[x]))
561
+ return d && X() && console.warn(`Confirmed confirm modal was suppressed because required '${x}' checkbox was missing`), [!1, v];
562
+ return "checkboxes" in o ? [d, v] : d;
563
+ }
564
+ async prompt(e, r, n) {
565
+ const a = (n == null ? void 0 : n.trim) ?? !0, o = () => typeof r != "string" ? {
566
+ message: e,
567
+ ...r ?? {}
568
+ } : {
569
+ title: e,
570
+ message: r,
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, r) {
579
+ const n = (d) => typeof d == "function" ? Promise.resolve(d()) : d, a = () => typeof e == "string" ? {
580
+ props: { message: e },
581
+ operationPromise: n(r)
582
+ } : typeof e == "function" || e instanceof Promise ? { operationPromise: n(e) } : {
583
+ props: e,
584
+ operationPromise: n(r)
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, r = {}) {
594
+ const { component: n, ...a } = r, o = {
595
+ id: re(),
596
+ properties: { message: e, ...a },
597
+ component: Ie(n ?? this.requireComponent(E.Toast))
598
+ };
599
+ this.setState("toasts", this.toasts.concat(o));
600
+ }
601
+ registerComponent(e, r) {
602
+ this.components[e] = r;
603
+ }
604
+ async openModal(e, r) {
605
+ const n = re(), a = {}, o = {
606
+ id: n,
607
+ properties: r ?? {},
608
+ component: Ie(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 Be(), await (u && k.emit("hide-modal", { id: u.id })), await Promise.all([
613
+ u || k.emit("show-overlays-backdrop"),
614
+ k.emit("show-modal", { id: o.id })
615
+ ]), o;
616
+ }
617
+ async closeModal(e, r) {
618
+ if (!U.isMounted()) {
619
+ await this.removeModal(e, r);
620
+ return;
621
+ }
622
+ await k.emit("close-modal", { id: e, result: r });
623
+ }
624
+ async closeAllModals() {
625
+ for (; this.modals.length > 0; )
626
+ await this.closeModal(Vt(this.modals[this.modals.length - 1]).id);
627
+ }
628
+ async boot() {
629
+ this.watchModalEvents(), this.watchMountedEvent(), this.watchViewportBreakpoints();
630
+ }
631
+ async removeModal(e, r) {
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, r), delete this.modalCallbacks[e];
637
+ const n = this.modals.at(-1);
638
+ await (n && k.emit("show-modal", { id: n.id }));
639
+ }
640
+ watchModalEvents() {
641
+ k.on("modal-will-close", ({ modal: e, result: r }) => {
642
+ var n, a;
643
+ (a = (n = this.modalCallbacks[e.id]) == null ? void 0 : n.willClose) == null || a.call(n, r), this.modals.length === 1 && k.emit("hide-overlays-backdrop");
644
+ }), k.on("modal-closed", async ({ modal: { id: e }, result: r }) => {
645
+ await this.removeModal(e, r);
646
+ });
647
+ }
648
+ watchMountedEvent() {
649
+ k.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: ${Ke}px)`).addEventListener("change", () => this.setState({ layout: Je() }));
660
+ }
661
+ }
662
+ const A = Z(qs);
663
+ class Ds {
664
+ constructor(s, e) {
665
+ this.locale = s, this.fallbackLocale = e;
666
+ }
667
+ getLocale() {
668
+ return this.locale;
669
+ }
670
+ async setLocale(s) {
671
+ this.locale = s;
672
+ }
673
+ getFallbackLocale() {
674
+ return this.fallbackLocale;
675
+ }
676
+ async setFallbackLocale(s) {
677
+ this.fallbackLocale = s;
678
+ }
679
+ getLocales() {
680
+ return ["en"];
681
+ }
682
+ translate(s) {
683
+ return X() && console.warn("Lang provider is missing"), s;
684
+ }
685
+ translateWithDefault(s, e) {
686
+ return X() && console.warn("Lang provider is missing"), e;
687
+ }
688
+ }
689
+ const Fs = fe({
690
+ name: "lang",
691
+ persist: ["locale", "fallbackLocale"],
692
+ initialState: {
693
+ locale: null,
694
+ locales: ["en"],
695
+ fallbackLocale: "en"
696
+ }
697
+ });
698
+ class Us extends Fs {
699
+ constructor() {
700
+ super();
701
+ _(this, "provider");
702
+ this.provider = new Ds(
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, r) {
711
+ return this.provider.translate(e, r) ?? e;
712
+ }
713
+ translateWithDefault(e, r, n = {}) {
714
+ return this.provider.translateWithDefault(e, r, n);
715
+ }
716
+ getBrowserLocale() {
717
+ const e = this.getState("locales");
718
+ return navigator.languages.find((r) => e.includes(r)) ?? "en";
719
+ }
720
+ async boot() {
721
+ globalThis.document && this.requireStore().$subscribe(
722
+ async () => {
723
+ var e, r;
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) : (r = document.querySelector("html")) == null || r.removeAttribute("lang");
725
+ },
726
+ { immediate: !0 }
727
+ );
728
+ }
729
+ }
730
+ const J = Z(Us), Qe = J.translate.bind(J), C = J.translateWithDefault.bind(J), Ns = fe({
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((s) => !s.seen),
739
+ hasStartupErrors: ({ startupErrors: t }) => t.length > 0
740
+ }
741
+ });
742
+ class Os extends Ns {
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 r = Array.isArray(e) ? e : [await this.createErrorReport(e)];
756
+ if (r.length === 0) {
757
+ A.alert(C("errors.inspectEmpty", "Nothing to inspect!"));
758
+ return;
759
+ }
760
+ A.openModal(A.requireComponent(E.ErrorReportModal), {
761
+ reports: r
762
+ });
763
+ }
764
+ async report(e, r) {
765
+ if (await k.emit("error", { error: e, message: r }), Pe("unit") || (X() && this.logError(e), !this.enabled))
766
+ throw e;
767
+ if (!U.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
+ A.toast(
778
+ r ?? 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: () => A.openModal(
786
+ A.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((r) => r.report !== e ? r : {
797
+ ...r,
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), ue(e) && e.cause && this.logError(e.cause);
812
+ }
813
+ async createErrorReport(e) {
814
+ return typeof e == "string" ? { title: e } : e instanceof Error || e instanceof me ? this.createErrorReportFromError(e) : ue(e) ? Oe({
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 we ? e.cause instanceof we ? null : this.createErrorReport(e.cause) : this.createErrorReport(e);
829
+ }
830
+ createErrorReportFromError(e, r = {}) {
831
+ return {
832
+ title: e.name,
833
+ description: e.message,
834
+ details: e.stack,
835
+ error: e,
836
+ ...r
837
+ };
838
+ }
839
+ }
840
+ const Ge = Z(Os), Ze = [];
841
+ function Ia(t) {
842
+ Ze.push(t);
843
+ }
844
+ function Ws(t) {
845
+ for (const s of Ze) {
846
+ const e = s(t);
847
+ if (e)
848
+ return e;
849
+ }
850
+ return typeof t == "string" ? t : t instanceof Error || t instanceof me ? t.message : ue(t) ? z(t.message ?? t.description ?? "Unknown error object") : C("errors.unknown", "Unknown Error");
851
+ }
852
+ class je extends me {
853
+ }
854
+ const Ks = { $errors: Ge }, Js = (t) => (Ge.report(t), !0);
855
+ function Qs(t, s = () => !1) {
856
+ const e = (r) => s(r) || Js(r);
857
+ t.config.errorHandler = e, globalThis.onerror = (r, n, a, o, u) => e(u ?? r), globalThis.onunhandledrejection = (r) => e(r.reason);
858
+ }
859
+ const Gs = {
860
+ async install(t, s) {
861
+ Qs(t, s.handleError), await ge(t, Ks);
862
+ }
863
+ }, Zs = { $lang: J }, Xs = {
864
+ async install(t) {
865
+ var s;
866
+ (s = t.config.globalProperties).$t ?? (s.$t = Qe), t.config.globalProperties.$td = C, await ge(t, Zs);
867
+ }
868
+ }, Ys = {
869
+ async install() {
870
+ Pe() && (globalThis.testingRuntime = {
871
+ on: (...t) => k.on(...t)
872
+ });
873
+ }
874
+ }, er = {
875
+ viewBox: "0 0 20 20",
876
+ width: "1.2em",
877
+ height: "1.2em"
878
+ };
879
+ function tr(t, s) {
880
+ return i(), b("svg", er, s[0] || (s[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 sr = { name: "zondicons-close", render: tr };
888
+ function rr() {
889
+ return G(new Ae(), (t) => {
890
+ t.link = function(s) {
891
+ return Ae.prototype.link.apply(this, [s]).replace("<a", '<a target="_blank"');
892
+ };
893
+ });
894
+ }
895
+ function nr(t) {
896
+ const s = At(t, /<a[^>]*href="#action:([^"]+)"[^>]*>([^<]+)<\/a>/g);
897
+ for (const [e, r, n] of s)
898
+ t = t.replace(e, `<button type="button" data-markdown-action="${r}">${n}</button>`);
899
+ return t;
900
+ }
901
+ function ar(t) {
902
+ let s = Jt(t, { renderer: rr(), async: !1 });
903
+ return s = or(s), s = nr(s), s;
904
+ }
905
+ function or(t) {
906
+ return Kt.sanitize(t, { ADD_ATTR: ["target"] });
907
+ }
908
+ function lr(t) {
909
+ return Object.entries(t.props ?? {}).reduce((s, [e, r]) => s + `${e}="${z(r)}"`, "");
910
+ }
911
+ function Xe(t) {
912
+ return typeof t == "string" ? t : t.type === yt ? "" : t.type === _t || t.type === wt ? t.children : t.type === "br" ? `
913
+
914
+ ` : `<${t.type} ${lr(t)}>${Array.from(t.children).map(Xe).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 s = qe(), e = Se(), r = p(() => e.default ? e.default().map(Xe).join("") : t.text ?? (t.langKey && (t.langDefault ? C(t.langKey, t.langDefault, t.langParams ?? {}) : Qe(t.langKey, t.langParams ?? {})))), n = p(() => {
929
+ if (!r.value)
930
+ return null;
931
+ let u = ar(r.value);
932
+ return t.inline && (u = u.replace("<p>", "<span>").replace("</p>", "</span>")), u;
933
+ }), a = () => $t(t.as ?? (t.inline ? "span" : "div"), {
934
+ innerHTML: n.value,
935
+ onClick: o,
936
+ ...s,
937
+ class: `${s.class ?? ""} ${t.inline ? "" : "prose"}`
938
+ });
939
+ async function o(u) {
940
+ var d, v;
941
+ const { target: c } = u;
942
+ if (jt(c, HTMLElement) && c.dataset.markdownAction) {
943
+ (v = (d = t.actions) == null ? void 0 : d[c.dataset.markdownAction]) == null || v.call(d);
944
+ return;
945
+ }
946
+ }
947
+ return (u, c) => (i(), h(a));
948
+ }
949
+ }), ir = /* @__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 s = p(() => t.as ? { as: t.as } : t.route ? {
966
+ as: "router-link",
967
+ to: Oe({
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, r) => (i(), h(l(Qt), T({
981
+ class: t.class,
982
+ "as-child": e.asChild,
983
+ disabled: e.disabled
984
+ }, s.value), {
985
+ default: f(() => [
986
+ w(e.$slots, "default")
987
+ ]),
988
+ _: 3
989
+ }, 16, ["class", "as-child", "disabled"]));
990
+ }
991
+ });
992
+ function Ye(t, s) {
993
+ return p(() => {
994
+ const { baseClasses: e, ...r } = t, { baseClasses: n, ...a } = s, o = ws(n, a), u = Object.entries(r).reduce((c, [d, v]) => (c[d] = l(v), c), {});
995
+ return I(o(u), l(e));
996
+ });
997
+ }
998
+ function I(...t) {
999
+ return $s(_s(t));
1000
+ }
1001
+ function ur(t) {
1002
+ if (t instanceof HTMLElement)
1003
+ return t;
1004
+ if (cr(t))
1005
+ return t.$el;
1006
+ }
1007
+ function cr(t) {
1008
+ return ue(t) && "$el" in t;
1009
+ }
1010
+ function et(t, s) {
1011
+ const e = ne("form", null), r = e == null ? void 0 : e.on("focus", (n) => t.name === n && s());
1012
+ de(() => r == null ? void 0 : r());
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 s = Y(t, ["class", "size", "variant", "disabled"]), e = Ye(
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 (r, n) => (i(), h(ir, T({
1111
+ class: l(e),
1112
+ disabled: r.disabled
1113
+ }, s), {
1114
+ default: f(() => [
1115
+ w(r.$slots, "default")
1116
+ ]),
1117
+ _: 3
1118
+ }, 16, ["class", "disabled"]));
1119
+ }
1120
+ });
1121
+ function se(t, s) {
1122
+ const e = k.on(t, s);
1123
+ de(() => e());
1124
+ }
1125
+ const dr = /* @__PURE__ */ g({
1126
+ __name: "HeadlessModal",
1127
+ props: {
1128
+ persistent: { type: Boolean },
1129
+ title: {},
1130
+ description: {}
1131
+ },
1132
+ setup(t, { expose: s }) {
1133
+ const e = L(null), r = L(!0), n = L(!1), { modal: a } = H(
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 && (r.value = !0);
1140
+ }
1141
+ async function u() {
1142
+ var d;
1143
+ (d = e.value) != null && d.$el && (r.value = !1);
1144
+ }
1145
+ async function c(d) {
1146
+ n.value || (k.emit("modal-will-close", { modal: a, result: d }), await o(), n.value = !0, k.emit("modal-closed", { modal: a, result: d }));
1147
+ }
1148
+ return se("close-modal", async ({ id: d, result: v }) => {
1149
+ d === a.id && await c(v);
1150
+ }), se("hide-modal", async ({ id: d }) => {
1151
+ d === a.id && await o();
1152
+ }), se("show-modal", async ({ id: d }) => {
1153
+ d === a.id && await u();
1154
+ }), s({ close: c }), (d, v) => (i(), h(l(Gt), {
1155
+ ref_key: "$root",
1156
+ ref: e,
1157
+ open: "",
1158
+ "onUpdate:open": v[0] || (v[0] = (x) => d.persistent || c())
1159
+ }, {
1160
+ default: f(() => [
1161
+ m(l(Zt), null, {
1162
+ default: f(() => [
1163
+ w(d.$slots, "default", { close: c })
1164
+ ]),
1165
+ _: 3
1166
+ })
1167
+ ]),
1168
+ _: 3
1169
+ }, 512));
1170
+ }
1171
+ }), tt = /* @__PURE__ */ g({
1172
+ __name: "ModalContext",
1173
+ props: {
1174
+ modal: {},
1175
+ childIndex: {}
1176
+ },
1177
+ setup(t) {
1178
+ const s = t, e = p(() => {
1179
+ const r = {};
1180
+ for (const n in s.modal.properties)
1181
+ r[n] = l(s.modal.properties[n]);
1182
+ return r;
1183
+ });
1184
+ return pe("modal", {
1185
+ modal: Te(s, "modal"),
1186
+ childIndex: Te(s, "childIndex")
1187
+ }), (r, n) => (i(), h(Q(r.modal.component), ae(oe(e.value)), null, 16));
1188
+ }
1189
+ }), pr = /* @__PURE__ */ g({
1190
+ __name: "HeadlessModalContent",
1191
+ setup(t) {
1192
+ const { childIndex: s = 0 } = H(
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(() => A.modals[s] ?? null);
1196
+ return (r, n) => (i(), h(l(Xt), null, {
1197
+ default: f(() => [
1198
+ w(r.$slots, "default"),
1199
+ e.value ? (i(), h(tt, {
1200
+ key: 0,
1201
+ "child-index": l(s) + 1,
1202
+ modal: e.value
1203
+ }, null, 8, ["child-index", "modal"])) : M("", !0)
1204
+ ]),
1205
+ _: 3
1206
+ }));
1207
+ }
1208
+ }), mr = /* @__PURE__ */ g({
1209
+ __name: "HeadlessModalOverlay",
1210
+ props: {
1211
+ forceMount: { type: Boolean },
1212
+ asChild: { type: Boolean },
1213
+ as: {}
1214
+ },
1215
+ setup(t) {
1216
+ return (s, e) => (i(), h(l(Yt), ae(oe(s.$props)), {
1217
+ default: f(() => [
1218
+ w(s.$slots, "default")
1219
+ ]),
1220
+ _: 3
1221
+ }, 16));
1222
+ }
1223
+ }), fr = /* @__PURE__ */ g({
1224
+ __name: "HeadlessModalTitle",
1225
+ props: {
1226
+ asChild: { type: Boolean },
1227
+ as: {}
1228
+ },
1229
+ setup(t) {
1230
+ return (s, e) => (i(), h(l(es), ae(oe(s.$props)), {
1231
+ default: f(() => [
1232
+ w(s.$slots, "default")
1233
+ ]),
1234
+ _: 3
1235
+ }, 16));
1236
+ }
1237
+ }), hr = {
1238
+ key: 0,
1239
+ class: "absolute top-0 right-0 hidden pt-1.5 pr-1.5 sm:block"
1240
+ }, gr = { class: "sr-only" }, ee = /* @__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: s }) {
1251
+ const e = Y(t, ["class", "dismissable", "wrapperClass", "title", "persistent"]), r = ke("$modal"), n = p(() => I({ "mt-2": t.title }, t.class)), a = p(() => I(
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 s({ close: async () => {
1257
+ var o;
1258
+ return (o = r.value) == null ? void 0 : o.close();
1259
+ } }), (o, u) => (i(), h(dr, T(e, {
1260
+ ref_key: "$modal",
1261
+ ref: r,
1262
+ persistent: o.persistent
1263
+ }), {
1264
+ default: f(({ close: c }) => [
1265
+ m(mr, { class: "fixed inset-0 bg-gray-500/75" }),
1266
+ m(pr, {
1267
+ class: P(a.value)
1268
+ }, {
1269
+ default: f(() => [
1270
+ !o.persistent && o.dismissable ? (i(), b("div", hr, [
1271
+ m(V, {
1272
+ variant: "ghost",
1273
+ size: "icon",
1274
+ onClick: (d) => c()
1275
+ }, {
1276
+ default: f(() => [
1277
+ y("span", gr, $(o.$td("ui.close", "Close")), 1),
1278
+ m(l(sr), { class: "size-3 text-gray-400" })
1279
+ ]),
1280
+ _: 2
1281
+ }, 1032, ["onClick"])
1282
+ ])) : M("", !0),
1283
+ o.title ? (i(), h(fr, {
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
+ }), vr = /* @__PURE__ */ g({
1308
+ __name: "AlertModal",
1309
+ props: {
1310
+ title: {},
1311
+ message: {}
1312
+ },
1313
+ setup(t) {
1314
+ return (s, e) => (i(), h(ee, { title: s.title }, {
1315
+ default: f(() => [
1316
+ m(R, { text: s.message }, null, 8, ["text"])
1317
+ ]),
1318
+ _: 1
1319
+ }, 8, ["title"]));
1320
+ }
1321
+ }), st = /* @__PURE__ */ g({
1322
+ __name: "Form",
1323
+ props: {
1324
+ form: {}
1325
+ },
1326
+ emits: ["submit"],
1327
+ setup(t, { emit: s }) {
1328
+ let e;
1329
+ const r = s;
1330
+ return Me((n) => {
1331
+ var a;
1332
+ e == null || e(), e = (a = t.form) == null ? void 0 : a.on("submit", () => r("submit")), n(() => e == null ? void 0 : e());
1333
+ }), pe("form", t.form), (n, a) => (i(), b("form", {
1334
+ onSubmit: a[0] || (a[0] = De((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
+ }), br = {
1343
+ required: (t) => t ? void 0 : "required"
1344
+ }, le = { ...br };
1345
+ function Ta(t, s) {
1346
+ le[t] = s;
1347
+ }
1348
+ function yr(t, s) {
1349
+ var r;
1350
+ const e = (r = le[s]) == null ? void 0 : r.call(le, t);
1351
+ return e ? Ne(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 _r extends Ue {
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 = L(!1), this._data = this.getInitialData(e), this._errors = this.getInitialErrors(e), Re.set(
1370
+ this,
1371
+ p(() => !Object.values(this._errors).some((r) => r !== 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, r) {
1382
+ const n = this._fields[e] ?? K(`Trying to set undefined '${z(e)}' field`);
1383
+ this._data[e] = n.type === B.String && (n.trim ?? !0) ? z(r).trim() : r, this._submitted.value && this.validate();
1384
+ }
1385
+ getFieldValue(e) {
1386
+ return this._data[e];
1387
+ }
1388
+ getFieldRules(e) {
1389
+ var r, n;
1390
+ return ((n = (r = this._fields[e]) == null ? void 0 : r.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
+ (r, [n, a]) => (r[n] = this.getFieldErrors(n, a), r),
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 r;
1407
+ this._submitted.value = !0;
1408
+ const e = this.validate();
1409
+ return e && ((r = this._listeners.submit) == null || r.forEach((n) => n())), e;
1410
+ }
1411
+ on(e, r) {
1412
+ var n, a;
1413
+ return (n = this._listeners)[e] ?? (n[e] = []), (a = this._listeners[e]) == null || a.push(r), () => this.off(e, r);
1414
+ }
1415
+ off(e, r) {
1416
+ _e(this._listeners[e] ?? [], r);
1417
+ }
1418
+ async focus(e) {
1419
+ var r;
1420
+ await Be(), (r = this._listeners.focus) == null || r.forEach((n) => n(e));
1421
+ }
1422
+ __get(e) {
1423
+ return e in this._fields ? this.getFieldValue(e) : super.__get(e);
1424
+ }
1425
+ __set(e, r) {
1426
+ if (!(e in this._fields)) {
1427
+ super.__set(e, r);
1428
+ return;
1429
+ }
1430
+ this.setFieldValue(e, r);
1431
+ }
1432
+ getFieldErrors(e, r) {
1433
+ var u;
1434
+ const n = [], a = this._data[e], o = ((u = r.rules) == null ? void 0 : u.split("|")) ?? [];
1435
+ for (const c of o)
1436
+ c !== "required" && a == null || n.push(...yr(a, c));
1437
+ return n.length > 0 ? n : null;
1438
+ }
1439
+ getInitialData(e) {
1440
+ if (this.static().isConjuring())
1441
+ return {};
1442
+ const r = Object.entries(e).reduce((n, [a, o]) => (n[a] = o.default ?? null, n), {});
1443
+ return ie(r);
1444
+ }
1445
+ getInitialErrors(e) {
1446
+ if (this.static().isConjuring())
1447
+ return {};
1448
+ const r = Object.keys(e).reduce((n, a) => (n[a] = null, n), {});
1449
+ return ie(r);
1450
+ }
1451
+ resetData() {
1452
+ for (const [e, r] of Object.entries(this._fields))
1453
+ this._data[e] = r.default ?? null;
1454
+ }
1455
+ resetErrors(e) {
1456
+ Object.keys(this._errors).forEach((r) => delete this._errors[r]), e && Object.assign(this._errors, e);
1457
+ }
1458
+ }
1459
+ function rt(t) {
1460
+ return new _r(t);
1461
+ }
1462
+ function Va(t, s = {}) {
1463
+ return {
1464
+ default: t,
1465
+ type: B.Boolean,
1466
+ rules: s.rules
1467
+ };
1468
+ }
1469
+ function Aa(t, s = {}) {
1470
+ return {
1471
+ default: t,
1472
+ type: B.Date,
1473
+ rules: s.rules
1474
+ };
1475
+ }
1476
+ function ja(t) {
1477
+ return {
1478
+ default: t,
1479
+ type: B.Boolean,
1480
+ rules: "required"
1481
+ };
1482
+ }
1483
+ function Ra(t) {
1484
+ return {
1485
+ default: t,
1486
+ type: B.Date,
1487
+ rules: "required"
1488
+ };
1489
+ }
1490
+ function za(t) {
1491
+ return {
1492
+ default: t,
1493
+ type: B.Number,
1494
+ rules: "required"
1495
+ };
1496
+ }
1497
+ function wr(t) {
1498
+ return {
1499
+ default: t,
1500
+ type: B.String,
1501
+ rules: "required"
1502
+ };
1503
+ }
1504
+ function Ba(t, s = {}) {
1505
+ return {
1506
+ default: t,
1507
+ type: B.Number,
1508
+ rules: s.rules
1509
+ };
1510
+ }
1511
+ function qa(t, s = {}) {
1512
+ return {
1513
+ default: t,
1514
+ type: B.String,
1515
+ rules: s.rules
1516
+ };
1517
+ }
1518
+ function $r(t) {
1519
+ const s = 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")), r = p(() => t.cancelText ?? C("ui.cancel", "Cancel"));
1532
+ return { form: s, renderedAcceptText: e, renderedCancelText: r };
1533
+ }
1534
+ const xr = {
1535
+ key: 0,
1536
+ class: "mt-4 flex flex-col text-sm text-gray-600"
1537
+ }, Cr = { class: "flex items-center" }, Sr = ["onUpdate:modelValue", "required"], kr = { class: "ml-1.5" }, Mr = { class: "mt-4 flex flex-row-reverse gap-2" }, Er = /* @__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 s = Y(t, ["cancelVariant"]), { form: e, renderedAcceptText: r, renderedCancelText: n } = $r(s);
1552
+ return (a, o) => (i(), h(ee, {
1553
+ title: a.title,
1554
+ persistent: ""
1555
+ }, {
1556
+ default: f(({ close: u }) => [
1557
+ m(st, {
1558
+ form: l(e),
1559
+ onSubmit: (c) => u([!0, l(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 ? (i(), b("ul", xr, [
1567
+ (i(!0), b(q, null, N(a.checkboxes, (c, d) => (i(), b("li", { key: d }, [
1568
+ y("label", Cr, [
1569
+ Fe(y("input", {
1570
+ "onUpdate:modelValue": (v) => l(e)[d] = v,
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, Sr), [
1575
+ [xt, l(e)[d]]
1576
+ ]),
1577
+ y("span", kr, $(c.label), 1)
1578
+ ])
1579
+ ]))), 128))
1580
+ ])) : M("", !0),
1581
+ y("div", Mr, [
1582
+ m(V, {
1583
+ variant: a.acceptVariant,
1584
+ submit: ""
1585
+ }, {
1586
+ default: f(() => [
1587
+ j($(l(r)), 1)
1588
+ ]),
1589
+ _: 1
1590
+ }, 8, ["variant"]),
1591
+ a.required ? M("", !0) : (i(), h(V, {
1592
+ key: 0,
1593
+ variant: a.cancelVariant,
1594
+ onClick: (c) => u(!1)
1595
+ }, {
1596
+ default: f(() => [
1597
+ j($(l(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
+ }), Pr = {
1610
+ viewBox: "0 0 20 20",
1611
+ width: "1.2em",
1612
+ height: "1.2em"
1613
+ };
1614
+ function Lr(t, s) {
1615
+ return i(), b("svg", Pr, s[0] || (s[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 Hr = { name: "zondicons-cheveron-left", render: Lr }, Ir = {
1623
+ viewBox: "0 0 20 20",
1624
+ width: "1.2em",
1625
+ height: "1.2em"
1626
+ };
1627
+ function Tr(t, s) {
1628
+ return i(), b("svg", Ir, s[0] || (s[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 nt = { name: "zondicons-cheveron-right", render: Tr }, Vr = {
1636
+ viewBox: "0 0 20 20",
1637
+ width: "1.2em",
1638
+ height: "1.2em"
1639
+ };
1640
+ function Ar(t, s) {
1641
+ return i(), b("svg", Vr, s[0] || (s[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 at = { name: "zondicons-exclamation-solid", render: Ar }, jr = {
1649
+ viewBox: "0 0 24 24",
1650
+ width: "1.2em",
1651
+ height: "1.2em"
1652
+ };
1653
+ function Rr(t, s) {
1654
+ return i(), b("svg", jr, s[0] || (s[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 zr = { name: "mdi-console", render: Rr }, Br = {
1662
+ viewBox: "0 0 20 20",
1663
+ width: "1.2em",
1664
+ height: "1.2em"
1665
+ };
1666
+ function qr(t, s) {
1667
+ return i(), b("svg", Br, s[0] || (s[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 Dr = { name: "zondicons-copy", render: qr }, Fr = {
1675
+ viewBox: "0 0 24 24",
1676
+ width: "1.2em",
1677
+ height: "1.2em"
1678
+ };
1679
+ function Ur(t, s) {
1680
+ return i(), b("svg", Fr, s[0] || (s[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 Nr = { name: "mdi-github", render: Ur }, Or = { class: "flex" }, Wr = { class: "sr-only" }, Kr = /* @__PURE__ */ g({
1688
+ __name: "ErrorReportModalButtons",
1689
+ props: {
1690
+ report: {}
1691
+ },
1692
+ setup(t) {
1693
+ const s = t, e = p(() => s.report.description ? `${s.report.title}: ${s.report.description}` : s.report.title), r = p(() => {
1694
+ if (!U.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
+ Rt(
1703
+ s.report.details ?? "Details missing from report",
1704
+ 1800 - a.length - U.sourceUrl.length
1705
+ ).trim(),
1706
+ "```"
1707
+ ].join(`
1708
+ `)
1709
+ );
1710
+ return `${U.sourceUrl}/issues/new?title=${a}&body=${o}`;
1711
+ }), n = p(() => G(
1712
+ [
1713
+ {
1714
+ id: "clipboard",
1715
+ description: "Copy to clipboard",
1716
+ iconComponent: Dr,
1717
+ async click() {
1718
+ await navigator.clipboard.writeText(`${e.value}
1719
+
1720
+ ${s.report.details}`), A.toast(C("errors.copiedToClipboard", "Debug information copied to clipboard"));
1721
+ }
1722
+ },
1723
+ {
1724
+ id: "console",
1725
+ description: "Log to console",
1726
+ iconComponent: zr,
1727
+ click() {
1728
+ const a = s.report.error ?? s.report;
1729
+ window.error = a, console.error(a), A.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
+ r.value && a.push({
1740
+ id: "github",
1741
+ description: "Report in GitHub",
1742
+ iconComponent: Nr,
1743
+ url: r.value
1744
+ });
1745
+ }
1746
+ ));
1747
+ return (a, o) => (i(), b("div", Or, [
1748
+ (i(!0), b(q, null, N(n.value, (u) => w(a.$slots, "default", T({ 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", Wr, $(a.$td(`errors.report_${u.id}`, u.description)), 1),
1759
+ (i(), h(Q(u.iconComponent), {
1760
+ class: "size-4",
1761
+ "aria-hidden": "true"
1762
+ }))
1763
+ ]),
1764
+ _: 2
1765
+ }, 1032, ["href", "title", "onClick"])
1766
+ ])), 256))
1767
+ ]));
1768
+ }
1769
+ }), Jr = /* @__PURE__ */ g({
1770
+ __name: "ErrorReportModalTitle",
1771
+ props: {
1772
+ report: {},
1773
+ currentReport: {},
1774
+ totalReports: {}
1775
+ },
1776
+ setup(t) {
1777
+ const s = p(() => !t.totalReports || t.totalReports <= 1 ? t.report.title : `${t.report.title} (${t.currentReport}/${t.totalReports})`);
1778
+ return (e, r) => (i(), h(R, {
1779
+ text: s.value,
1780
+ inline: ""
1781
+ }, null, 8, ["text"]));
1782
+ }
1783
+ });
1784
+ function Qr(t) {
1785
+ const s = L(0), e = p(() => t.reports[s.value]), r = 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: s,
1793
+ details: r,
1794
+ nextReportText: a,
1795
+ previousReportText: n,
1796
+ report: e
1797
+ };
1798
+ }
1799
+ const Gr = { class: "px-4 pt-5 pb-4" }, Zr = { class: "flex justify-between gap-4" }, Xr = { class: "flex items-center gap-2" }, Yr = {
1800
+ key: 0,
1801
+ class: "flex gap-0.5"
1802
+ }, en = { class: "-mt-2 max-h-[80vh] overflow-auto bg-red-800/10" }, tn = ["textContent"], sn = /* @__PURE__ */ g({
1803
+ __name: "ErrorReportModal",
1804
+ props: {
1805
+ reports: {}
1806
+ },
1807
+ setup(t) {
1808
+ const s = t, { activeReportIndex: e, details: r, nextReportText: n, previousReportText: a, report: o } = Qr(s);
1809
+ return (u, c) => (i(), h(ee, { "wrapper-class": "p-0 sm:w-auto sm:min-w-lg sm:max-w-[80vw]" }, {
1810
+ default: f(() => [
1811
+ y("div", Gr, [
1812
+ y("h2", Zr, [
1813
+ y("div", Xr, [
1814
+ m(l(at), { class: "size-5 text-red-600" }),
1815
+ m(Jr, {
1816
+ class: "text-lg leading-6 font-semibold text-gray-900",
1817
+ report: l(o),
1818
+ "current-report": l(e) + 1,
1819
+ "total-reports": u.reports.length
1820
+ }, null, 8, ["report", "current-report", "total-reports"]),
1821
+ u.reports.length > 1 ? (i(), b("span", Yr, [
1822
+ m(V, {
1823
+ size: "icon",
1824
+ variant: "ghost",
1825
+ disabled: l(e) === 0,
1826
+ "aria-label": l(a),
1827
+ title: l(a),
1828
+ onClick: c[0] || (c[0] = (d) => e.value--)
1829
+ }, {
1830
+ default: f(() => [
1831
+ m(l(Hr), { class: "size-4" })
1832
+ ]),
1833
+ _: 1
1834
+ }, 8, ["disabled", "aria-label", "title"]),
1835
+ m(V, {
1836
+ size: "icon",
1837
+ variant: "ghost",
1838
+ disabled: l(e) === u.reports.length - 1,
1839
+ "aria-label": l(n),
1840
+ title: l(n),
1841
+ onClick: c[1] || (c[1] = (d) => e.value++)
1842
+ }, {
1843
+ default: f(() => [
1844
+ m(l(nt), { class: "size-4" })
1845
+ ]),
1846
+ _: 1
1847
+ }, 8, ["disabled", "aria-label", "title"])
1848
+ ])) : M("", !0)
1849
+ ]),
1850
+ m(Kr, {
1851
+ report: l(o),
1852
+ class: "gap-0.5"
1853
+ }, null, 8, ["report"])
1854
+ ]),
1855
+ l(o).description ? (i(), h(R, {
1856
+ key: 0,
1857
+ text: l(o).description,
1858
+ class: "text-gray-600"
1859
+ }, null, 8, ["text"])) : M("", !0)
1860
+ ]),
1861
+ y("div", en, [
1862
+ y("pre", {
1863
+ class: "p-4 text-xs text-red-800",
1864
+ textContent: $(l(r))
1865
+ }, null, 8, tn)
1866
+ ])
1867
+ ]),
1868
+ _: 1
1869
+ }));
1870
+ }
1871
+ }), rn = {
1872
+ viewBox: "0 0 24 24",
1873
+ width: "1.2em",
1874
+ height: "1.2em"
1875
+ };
1876
+ function nn(t, s) {
1877
+ return i(), b("svg", rn, s[0] || (s[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 an = { name: "svg-spinners-90-ring-with-bg", render: nn }, on = { class: "mt-1 h-2 w-full overflow-hidden rounded-full bg-gray-200" }, ln = { class: "sr-only" }, un = /* @__PURE__ */ g({
1898
+ __name: "ProgressBar",
1899
+ props: {
1900
+ filledClass: {},
1901
+ progress: {},
1902
+ job: {}
1903
+ },
1904
+ setup(t) {
1905
+ let s;
1906
+ const e = L(0), r = p(() => I("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 Ce(
1908
+ () => t.job,
1909
+ () => {
1910
+ var a, o;
1911
+ s == null || s(), e.value = ((a = t.job) == null ? void 0 : a.progress) ?? 0, s = (o = t.job) == null ? void 0 : o.listeners.add({ onUpdated: (u) => e.value = u });
1912
+ },
1913
+ { immediate: !0 }
1914
+ ), de(() => s == null ? void 0 : s()), (a, o) => (i(), b("div", on, [
1915
+ y("div", {
1916
+ class: P(r.value),
1917
+ style: Ct(`transform:translateX(-${(1 - n.value) * 100}%)`)
1918
+ }, null, 6),
1919
+ y("span", ln, $(a.$td("ui.progress", "{progress}% complete", {
1920
+ progress: n.value * 100
1921
+ })), 1)
1922
+ ]));
1923
+ }
1924
+ });
1925
+ function cn(t) {
1926
+ const s = p(() => t.message ?? C("ui.loading", "Loading...")), e = p(() => typeof t.progress == "number" || !!t.job);
1927
+ return { renderedMessage: s, showProgress: e };
1928
+ }
1929
+ const dn = /* @__PURE__ */ g({
1930
+ __name: "LoadingModal",
1931
+ props: {
1932
+ title: {},
1933
+ message: {},
1934
+ progress: {},
1935
+ job: {}
1936
+ },
1937
+ setup(t) {
1938
+ const s = t, { renderedMessage: e, showProgress: r } = cn(s);
1939
+ return (n, a) => (i(), h(ee, {
1940
+ persistent: "",
1941
+ class: P(["flex", { "flex-col-reverse": l(r), "items-center justify-center gap-2": !l(r) }]),
1942
+ "wrapper-class": "w-auto",
1943
+ title: n.title
1944
+ }, {
1945
+ default: f(() => [
1946
+ l(r) ? (i(), h(un, {
1947
+ key: 0,
1948
+ progress: n.progress,
1949
+ job: n.job,
1950
+ class: "min-w-[min(400px,80vw)]"
1951
+ }, null, 8, ["progress", "job"])) : (i(), h(l(an), {
1952
+ key: 1,
1953
+ class: "text-primary mr-1 size-6"
1954
+ })),
1955
+ m(R, { text: l(e) }, null, 8, ["text"])
1956
+ ]),
1957
+ _: 1
1958
+ }, 8, ["title", "class"]));
1959
+ }
1960
+ }), ot = /* @__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: s, emit: e }) {
1971
+ const r = e, n = ne("form", null), a = p(() => !n || !t.name ? null : n.errors[t.name] ?? null), o = {
1972
+ id: `input-${re()}`,
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
+ r("update:modelValue", u);
1988
+ }
1989
+ };
1990
+ return pe("input", o), s(o), (u, c) => (i(), h(Q(u.as), null, {
1991
+ default: f(() => [
1992
+ w(u.$slots, "default")
1993
+ ]),
1994
+ _: 3
1995
+ }));
1996
+ }
1997
+ }), pn = ["for"], $e = /* @__PURE__ */ g({
1998
+ __name: "HeadlessInputLabel",
1999
+ setup(t) {
2000
+ const s = H("input", "<HeadlessInputLabel> must be a child of a <HeadlessInput>"), e = Se(), r = p(() => !!(s.label || e.default));
2001
+ return (n, a) => r.value ? (i(), b("label", {
2002
+ key: 0,
2003
+ for: l(s).id
2004
+ }, [
2005
+ w(n.$slots, "default", {}, () => [
2006
+ j($(l(s).label), 1)
2007
+ ])
2008
+ ], 8, pn)) : M("", !0);
2009
+ }
2010
+ }), mn = ["id", "name", "type", "checked", "required", "aria-invalid", "aria-describedby"], lt = /* @__PURE__ */ g({
2011
+ __name: "HeadlessInputInput",
2012
+ props: {
2013
+ type: { default: "text" }
2014
+ },
2015
+ setup(t) {
2016
+ const s = L(), e = H("input", "<HeadlessInputInput> must be a child of a <HeadlessInput>"), r = 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
+ s.value && e.update(u());
2022
+ }
2023
+ function u() {
2024
+ if (!s.value)
2025
+ return null;
2026
+ switch (t.type) {
2027
+ case "checkbox":
2028
+ return s.value.checked;
2029
+ case "date":
2030
+ return s.value.valueAsDate;
2031
+ default:
2032
+ return s.value.value;
2033
+ }
2034
+ }
2035
+ return et(e, () => {
2036
+ var c;
2037
+ return (c = s.value) == null ? void 0 : c.focus();
2038
+ }), Me(() => {
2039
+ if (s.value) {
2040
+ if (t.type === "date") {
2041
+ s.value.valueAsDate = n.value;
2042
+ return;
2043
+ }
2044
+ s.value.value = n.value ?? null;
2045
+ }
2046
+ }), (c, d) => (i(), b("input", {
2047
+ id: l(e).id,
2048
+ ref_key: "$input",
2049
+ ref: s,
2050
+ name: r.value,
2051
+ type: c.type,
2052
+ checked: a.value,
2053
+ required: l(e).required ?? void 0,
2054
+ "aria-invalid": l(e).errors ? "true" : "false",
2055
+ "aria-describedby": l(e).errors ? `${l(e).id}-error` : l(e).description ? `${l(e).id}-description` : void 0,
2056
+ onInput: o
2057
+ }, null, 40, mn));
2058
+ }
2059
+ }), fn = /* @__PURE__ */ g({
2060
+ inheritAttrs: !1,
2061
+ __name: "HeadlessInputDescription",
2062
+ setup(t) {
2063
+ const s = H(
2064
+ "input",
2065
+ "<HeadlessInputDescription> must be a child of a <HeadlessInput>"
2066
+ ), e = p(() => typeof s.description == "string" ? s.description : ""), r = p(() => !!s.description);
2067
+ return (n, a) => w(n.$slots, "default", {
2068
+ id: `${l(s).id}-description`
2069
+ }, () => [
2070
+ r.value ? (i(), h(R, T({ key: 0 }, n.$attrs, {
2071
+ id: `${l(s).id}-description`,
2072
+ text: e.value
2073
+ }), null, 16, ["id", "text"])) : M("", !0)
2074
+ ]);
2075
+ }
2076
+ }), hn = ["id"], xe = /* @__PURE__ */ g({
2077
+ __name: "HeadlessInputError",
2078
+ setup(t) {
2079
+ const s = H("input", "<HeadlessInputError> must be a child of a <HeadlessInput>"), e = p(() => s.errors ? C(`errors.${s.errors[0]}`, `Error: ${s.errors[0]}`) : null);
2080
+ return (r, n) => e.value ? (i(), b("p", {
2081
+ key: 0,
2082
+ id: `${l(s).id}-error`
2083
+ }, $(e.value), 9, hn)) : M("", !0);
2084
+ }
2085
+ });
2086
+ function it() {
2087
+ const t = qe(), s = p(() => t.class);
2088
+ return [p(() => zt(t, "class")), s];
2089
+ }
2090
+ const gn = {
2091
+ key: 0,
2092
+ class: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3"
2093
+ }, vn = /* @__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 s = Y(t, ["label", "inputClass", "wrapperClass"]), e = ke("$input"), [r, n] = it(), a = p(() => I("relative rounded-md shadow-2xs", { "mt-1": t.label }, t.wrapperClass)), o = p(() => {
2107
+ var u, c, d;
2108
+ return I(
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) => (i(), h(ot, T({
2120
+ ref_key: "$input",
2121
+ ref: e,
2122
+ label: u.label,
2123
+ class: l(n)
2124
+ }, s, {
2125
+ "onUpdate:modelValue": c[0] || (c[0] = (d) => u.$emit("update:modelValue", d))
2126
+ }), {
2127
+ default: f(() => {
2128
+ var d;
2129
+ return [
2130
+ m($e, { class: "block text-sm leading-6 font-medium text-gray-900" }),
2131
+ y("div", {
2132
+ class: P(a.value)
2133
+ }, [
2134
+ m(lt, T(l(r), { class: o.value }), null, 16, ["class"]),
2135
+ (d = l(e)) != null && d.errors ? (i(), b("div", gn, [
2136
+ m(l(at), { class: "size-5 text-red-500" })
2137
+ ])) : M("", !0)
2138
+ ], 2),
2139
+ m(fn, { class: "mt-2 text-sm text-gray-600" }),
2140
+ m(xe, { class: "mt-2 text-sm text-red-600" })
2141
+ ];
2142
+ }),
2143
+ _: 1
2144
+ }, 16, ["label", "class"]));
2145
+ }
2146
+ });
2147
+ function bn(t) {
2148
+ const s = rt({
2149
+ draft: wr(t.defaultValue ?? "")
2150
+ }), e = p(() => t.acceptText ?? C("ui.accept", "Ok")), r = p(() => t.cancelText ?? C("ui.cancel", "Cancel"));
2151
+ return { form: s, renderedAcceptText: e, renderedCancelText: r };
2152
+ }
2153
+ const yn = { class: "mt-4 flex flex-row-reverse gap-2" }, _n = /* @__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 s = Y(t, ["cancelVariant"]), { form: e, renderedAcceptText: r, renderedCancelText: n } = bn(s);
2168
+ return (a, o) => (i(), h(ee, {
2169
+ title: a.title,
2170
+ persistent: ""
2171
+ }, {
2172
+ default: f(({ close: u }) => [
2173
+ m(st, {
2174
+ form: l(e),
2175
+ onSubmit: (c) => u(l(e).draft)
2176
+ }, {
2177
+ default: f(() => [
2178
+ m(R, { text: a.message }, null, 8, ["text"]),
2179
+ m(vn, {
2180
+ name: "draft",
2181
+ class: "mt-2",
2182
+ placeholder: a.placeholder,
2183
+ label: a.label
2184
+ }, null, 8, ["placeholder", "label"]),
2185
+ y("div", yn, [
2186
+ m(V, {
2187
+ variant: a.acceptVariant,
2188
+ submit: ""
2189
+ }, {
2190
+ default: f(() => [
2191
+ j($(l(r)), 1)
2192
+ ]),
2193
+ _: 1
2194
+ }, 8, ["variant"]),
2195
+ m(V, {
2196
+ variant: a.cancelVariant,
2197
+ onClick: (c) => u(!1)
2198
+ }, {
2199
+ default: f(() => [
2200
+ j($(l(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
+ }), wn = { class: "grid grow place-items-center" }, $n = { class: "flex flex-col items-center space-y-6 p-8" }, xn = { class: "mt-2 text-center text-4xl font-medium text-red-600" }, Cn = { class: "mt-4 flex flex-col space-y-4" }, Sn = /* @__PURE__ */ g({
2213
+ __name: "StartupCrash",
2214
+ setup(t) {
2215
+ return (s, e) => (i(), b("div", wn, [
2216
+ y("div", $n, [
2217
+ y("h1", xn, $(s.$td("startupCrash.title", "Something went wrong!")), 1),
2218
+ m(R, {
2219
+ text: s.$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", Cn, [
2228
+ m(V, {
2229
+ variant: "danger",
2230
+ onClick: e[0] || (e[0] = (r) => s.$app.reload())
2231
+ }, {
2232
+ default: f(() => [
2233
+ j($(s.$td("startupCrash.reload", "Try again")), 1)
2234
+ ]),
2235
+ _: 1
2236
+ }),
2237
+ m(V, {
2238
+ variant: "danger",
2239
+ onClick: e[1] || (e[1] = (r) => s.$errors.inspect(s.$errors.startupErrors))
2240
+ }, {
2241
+ default: f(() => [
2242
+ j($(s.$td("startupCrash.inspect", "View error details")), 1)
2243
+ ]),
2244
+ _: 1
2245
+ })
2246
+ ])
2247
+ ])
2248
+ ]));
2249
+ }
2250
+ }), ut = /* @__PURE__ */ g({
2251
+ __name: "HeadlessToastAction",
2252
+ props: {
2253
+ action: {}
2254
+ },
2255
+ setup(t) {
2256
+ return (s, e) => (i(), h(Q(s.action.dismiss ? l(ts) : "button"), {
2257
+ type: "button",
2258
+ onClick: s.action.click
2259
+ }, {
2260
+ default: f(() => [
2261
+ j($(s.action.label), 1)
2262
+ ]),
2263
+ _: 1
2264
+ }, 8, ["onClick"]));
2265
+ }
2266
+ }), kn = { key: 0 }, Mn = /* @__PURE__ */ g({
2267
+ __name: "HeadlessToast",
2268
+ props: {
2269
+ message: {},
2270
+ actions: {},
2271
+ variant: {}
2272
+ },
2273
+ setup(t) {
2274
+ return (s, e) => (i(), h(l(ss), null, {
2275
+ default: f(() => [
2276
+ w(s.$slots, "default", {}, () => [
2277
+ s.message ? (i(), b("span", kn, $(s.message), 1)) : M("", !0),
2278
+ (i(!0), b(q, null, N(s.actions, (r, n) => (i(), h(ut, {
2279
+ key: n,
2280
+ action: r
2281
+ }, null, 8, ["action"]))), 128))
2282
+ ])
2283
+ ]),
2284
+ _: 3
2285
+ }));
2286
+ }
2287
+ }), En = /* @__PURE__ */ g({
2288
+ __name: "Toast",
2289
+ props: {
2290
+ message: {},
2291
+ actions: {},
2292
+ variant: { default: "secondary" },
2293
+ class: {}
2294
+ },
2295
+ setup(t) {
2296
+ const s = Ye(
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, r) => (i(), h(Mn, {
2312
+ class: P(l(s))
2313
+ }, {
2314
+ default: f(() => [
2315
+ e.message ? (i(), h(R, {
2316
+ key: 0,
2317
+ text: e.message,
2318
+ inline: ""
2319
+ }, null, 8, ["text"])) : M("", !0),
2320
+ (i(!0), b(q, null, N(e.actions, (n, a) => (i(), h(V, {
2321
+ key: a,
2322
+ action: n,
2323
+ variant: e.variant,
2324
+ as: ut
2325
+ }, null, 8, ["action", "variant"]))), 128))
2326
+ ]),
2327
+ _: 1
2328
+ }, 8, ["class"]));
2329
+ }
2330
+ }), Pn = { $ui: A }, Ln = {
2331
+ async install(t, s) {
2332
+ const e = {
2333
+ [E.AlertModal]: vr,
2334
+ [E.ConfirmModal]: Er,
2335
+ [E.ErrorReportModal]: sn,
2336
+ [E.LoadingModal]: dn,
2337
+ [E.PromptModal]: _n,
2338
+ [E.Toast]: En,
2339
+ [E.StartupCrash]: Sn
2340
+ };
2341
+ Object.entries({
2342
+ ...e,
2343
+ ...s.components
2344
+ }).forEach(([r, n]) => A.registerComponent(r, n)), await ge(t, Pn);
2345
+ }
2346
+ };
2347
+ async function Hn(t, s = {}) {
2348
+ var r;
2349
+ const e = [Ys, Ts, Gs, Xs, zs, Ln, ...s.plugins ?? []];
2350
+ U.instance = t, await Ps(e, t, s), await ((r = s.install) == null ? void 0 : r.call(s, t)), await k.emit("application-ready");
2351
+ }
2352
+ async function Da(t, s = {}) {
2353
+ var r;
2354
+ const e = St(t);
2355
+ X() && (window.$aerogel = e), await Hn(e, s), e.mount("#app"), (r = e._container) == null || r.classList.remove("loading"), await k.emit("application-mounted");
2356
+ }
2357
+ const In = { key: 0 }, Tn = /* @__PURE__ */ g({
2358
+ __name: "AppModals",
2359
+ setup(t) {
2360
+ const s = p(() => A.modals[0] ?? null);
2361
+ return (e, r) => s.value ? (i(), b("aside", In, [
2362
+ m(tt, {
2363
+ "child-index": 1,
2364
+ modal: s.value
2365
+ }, null, 8, ["modal"])
2366
+ ])) : M("", !0);
2367
+ }
2368
+ }), Vn = /* @__PURE__ */ g({
2369
+ __name: "AppToasts",
2370
+ setup(t) {
2371
+ return (s, e) => (i(), h(l(rs), null, {
2372
+ default: f(() => [
2373
+ (i(!0), b(q, null, N(s.$ui.toasts, (r) => (i(), h(Q(r.component), T({
2374
+ id: r.id,
2375
+ key: r.id,
2376
+ ref_for: !0
2377
+ }, r.properties), null, 16, ["id"]))), 128)),
2378
+ m(l(ns), { 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
+ }), An = /* @__PURE__ */ g({
2384
+ __name: "AppOverlays",
2385
+ setup(t) {
2386
+ const s = L(null), e = L(!0);
2387
+ return se("show-overlays-backdrop", async () => {
2388
+ !s.value || !e.value || (e.value = !1, s.value.classList.remove("opacity-0"));
2389
+ }), se("hide-overlays-backdrop", async () => {
2390
+ !s.value || e.value || (e.value = !0, s.value.classList.add("opacity-0"));
2391
+ }), (r, n) => (i(), b(q, null, [
2392
+ m(Tn),
2393
+ m(Vn)
2394
+ ], 64));
2395
+ }
2396
+ }), jn = { class: "flex min-h-full flex-col text-base leading-tight font-normal text-gray-900 antialiased" }, Fa = /* @__PURE__ */ g({
2397
+ __name: "AppLayout",
2398
+ setup(t) {
2399
+ return (s, e) => (i(), b("div", jn, [
2400
+ s.$errors.hasStartupErrors ? w(s.$slots, "startup-crash", { key: 0 }, () => [
2401
+ (i(), h(Q(s.$ui.requireComponent(l(E).StartupCrash))))
2402
+ ]) : w(s.$slots, "default", { key: 1 }),
2403
+ m(An)
2404
+ ]));
2405
+ }
2406
+ });
2407
+ function Ua() {
2408
+ return kt((t, s) => {
2409
+ let e;
2410
+ return {
2411
+ get() {
2412
+ return t(), e;
2413
+ },
2414
+ set(r) {
2415
+ e = ur(r), s();
2416
+ }
2417
+ };
2418
+ });
2419
+ }
2420
+ function Rn(t) {
2421
+ return typeof t == "object" && t !== null && "label" in t;
2422
+ }
2423
+ const zn = ["id", "name", "value", "required", "aria-invalid", "aria-describedby"], Na = /* @__PURE__ */ g({
2424
+ __name: "HeadlessInputTextArea",
2425
+ setup(t) {
2426
+ const s = L(), e = H(
2427
+ "input",
2428
+ "<HeadlessInputTextArea> must be a child of a <HeadlessInput>"
2429
+ ), r = p(() => e.name ?? void 0), n = p(() => e.value);
2430
+ function a() {
2431
+ s.value && e.update(s.value.value);
2432
+ }
2433
+ return et(e, () => {
2434
+ var o;
2435
+ return (o = s.value) == null ? void 0 : o.focus();
2436
+ }), (o, u) => (i(), b("textarea", {
2437
+ id: l(e).id,
2438
+ ref_key: "$textArea",
2439
+ ref: s,
2440
+ name: r.value,
2441
+ value: n.value,
2442
+ required: l(e).required ?? void 0,
2443
+ "aria-invalid": l(e).errors ? "true" : "false",
2444
+ "aria-describedby": l(e).errors ? `${l(e).id}-error` : l(e).description ? `${l(e).id}-description` : void 0,
2445
+ onInput: a
2446
+ }, null, 40, zn));
2447
+ }
2448
+ });
2449
+ function Oa(t) {
2450
+ let s = Bt;
2451
+ Mt(() => s = t()), de(() => s());
2452
+ }
2453
+ function Wa(t, s) {
2454
+ const e = ie(D.get(t) ?? s);
2455
+ return Ce(e, () => D.set(t, Et(e))), e;
2456
+ }
2457
+ function Ka(t) {
2458
+ return t.split(/\s+/).filter((s) => !/^(hover|focus|focus-visible):/.test(s)).join(" ").trim();
2459
+ }
2460
+ const ct = /* @__PURE__ */ g({
2461
+ __name: "HeadlessSelectValue",
2462
+ setup(t) {
2463
+ const s = H(
2464
+ "select",
2465
+ "<HeadlessSelectValue> must be a child of a <HeadlessSelect>"
2466
+ );
2467
+ return (e, r) => (i(), h(l(as), {
2468
+ placeholder: l(s).placeholder
2469
+ }, null, 8, ["placeholder"]));
2470
+ }
2471
+ }), dt = /* @__PURE__ */ g({
2472
+ __name: "HeadlessSelectTrigger",
2473
+ setup(t) {
2474
+ const s = H(
2475
+ "select",
2476
+ "<HeadlessSelectTrigger> must be a child of a <HeadlessSelect>"
2477
+ );
2478
+ return (e, r) => (i(), h(l(os), {
2479
+ id: l(s).id
2480
+ }, {
2481
+ default: f(() => [
2482
+ w(e.$slots, "default", {}, () => [
2483
+ m(ct, {
2484
+ placeholder: l(s).placeholder
2485
+ }, null, 8, ["placeholder"]),
2486
+ m(l(ls))
2487
+ ])
2488
+ ]),
2489
+ _: 3
2490
+ }, 8, ["id"]));
2491
+ }
2492
+ }), pt = /* @__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 s = H(
2503
+ "select",
2504
+ "<HeadlessSelectOption> must be a child of a <HeadlessSelect>"
2505
+ ), e = p(() => {
2506
+ var n;
2507
+ const r = (n = s.options) == null ? void 0 : n.find((a) => a.value === t.value);
2508
+ return r ? r.label : z(t.value);
2509
+ });
2510
+ return (r, n) => (i(), h(l(is), ae(oe(r.$props)), {
2511
+ default: f(() => [
2512
+ m(l(us), { class: "the-text" }, {
2513
+ default: f(() => [
2514
+ w(r.$slots, "default", {}, () => [
2515
+ j($(e.value), 1)
2516
+ ])
2517
+ ]),
2518
+ _: 3
2519
+ })
2520
+ ]),
2521
+ _: 3
2522
+ }, 16));
2523
+ }
2524
+ }), mt = /* @__PURE__ */ g({
2525
+ __name: "HeadlessSelectOptions",
2526
+ props: {
2527
+ class: {}
2528
+ },
2529
+ setup(t) {
2530
+ const s = H(
2531
+ "select",
2532
+ "<HeadlessSelectOptions> must be a child of a <HeadlessSelect>"
2533
+ );
2534
+ return (e, r) => (i(), h(l(cs), null, {
2535
+ default: f(() => [
2536
+ m(l(ds), {
2537
+ class: P(t.class)
2538
+ }, {
2539
+ default: f(() => [
2540
+ m(l(ps), null, {
2541
+ default: f(() => [
2542
+ w(e.$slots, "default", {}, () => [
2543
+ (i(!0), b(q, null, N(l(s).options ?? [], (n) => (i(), h(pt, {
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
+ }), Bn = /* @__PURE__ */ g({
2559
+ inheritAttrs: !1,
2560
+ __name: "HeadlessSelect",
2561
+ props: {
2562
+ as: { default: "template" },
2563
+ options: {},
2564
+ placeholder: {},
2565
+ renderOption: { type: Function },
2566
+ name: {},
2567
+ label: {},
2568
+ description: {},
2569
+ modelValue: {}
2570
+ },
2571
+ emits: ["update:modelValue"],
2572
+ setup(t, { expose: s, emit: e }) {
2573
+ const r = e, n = ne("form", null), a = p(() => t.modelValue), o = p(() => !n || !t.name ? null : n.errors[t.name] ?? null), u = p(() => t.options ? t.options.map((v) => ({
2574
+ key: re(),
2575
+ label: t.renderOption ? t.renderOption(v) : Rn(v) ? qt(v.label) : z(v),
2576
+ value: v
2577
+ })) : null), c = {
2578
+ id: `select-${re()}`,
2579
+ name: p(() => t.name),
2580
+ label: p(() => t.label),
2581
+ description: p(() => t.description),
2582
+ placeholder: p(() => t.placeholder ?? C("ui.select", "Select an option")),
2583
+ options: u,
2584
+ selectedOption: p(() => {
2585
+ var v;
2586
+ return (v = u.value) == null ? void 0 : v.find((x) => x.value === t.modelValue);
2587
+ }),
2588
+ value: p(() => n && t.name ? n.getFieldValue(t.name) : t.modelValue),
2589
+ errors: Ee(o),
2590
+ required: p(() => {
2591
+ if (!(!t.name || !n))
2592
+ return n.getFieldRules(t.name).includes("required");
2593
+ }),
2594
+ update(v) {
2595
+ if (n && t.name) {
2596
+ n.setFieldValue(t.name, v);
2597
+ return;
2598
+ }
2599
+ r("update:modelValue", v);
2600
+ }
2601
+ };
2602
+ function d(v) {
2603
+ c.update(v);
2604
+ }
2605
+ return pe("select", c), s(c), (v, x) => (i(), h(l(ms), {
2606
+ "model-value": a.value,
2607
+ "onUpdate:modelValue": x[0] || (x[0] = (S) => d(S))
2608
+ }, {
2609
+ default: f(({ open: S }) => [
2610
+ (i(), h(Q(v.as), ae(oe(v.$attrs)), {
2611
+ default: f(() => [
2612
+ w(v.$slots, "default", {
2613
+ modelValue: v.modelValue,
2614
+ open: S
2615
+ }, () => [
2616
+ m(dt),
2617
+ m(mt)
2618
+ ])
2619
+ ]),
2620
+ _: 2
2621
+ }, 1040))
2622
+ ]),
2623
+ _: 3
2624
+ }, 8, ["model-value"]));
2625
+ }
2626
+ }), ze = /* @__PURE__ */ g({
2627
+ __name: "HeadlessSelectLabel",
2628
+ props: {
2629
+ asChild: { type: Boolean },
2630
+ as: {}
2631
+ },
2632
+ setup(t) {
2633
+ const s = H(
2634
+ "select",
2635
+ "<HeadlessSelectLabel> must be a child of a <HeadlessSelect>"
2636
+ ), e = Se(), r = p(() => !!(s.label || e.default));
2637
+ return (n, a) => r.value ? (i(), h(l(fs), T({
2638
+ key: 0,
2639
+ for: l(s).id
2640
+ }, n.$props), {
2641
+ default: f(() => [
2642
+ w(n.$slots, "default", {}, () => [
2643
+ j($(l(s).label), 1)
2644
+ ])
2645
+ ]),
2646
+ _: 3
2647
+ }, 16, ["for"])) : M("", !0);
2648
+ }
2649
+ }), qn = { class: "group" }, Dn = { 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" }, Fn = { class: "pt-2 pl-4" }, Ja = /* @__PURE__ */ g({
2650
+ __name: "AdvancedOptions",
2651
+ setup(t) {
2652
+ return (s, e) => (i(), b("details", qn, [
2653
+ y("summary", Dn, [
2654
+ m(l(nt), { class: "size-6 transition-transform group-open:rotate-90" }),
2655
+ y("span", null, $(s.$td("ui.advancedOptions", "Advanced options")), 1)
2656
+ ]),
2657
+ y("div", Fn, [
2658
+ w(s.$slots, "default")
2659
+ ])
2660
+ ]));
2661
+ }
2662
+ }), Un = { class: "flex h-6 items-center" }, Qa = /* @__PURE__ */ g({
2663
+ inheritAttrs: !1,
2664
+ __name: "Checkbox",
2665
+ props: {
2666
+ name: {},
2667
+ label: {},
2668
+ description: {},
2669
+ modelValue: {},
2670
+ inputClass: {},
2671
+ labelClass: {}
2672
+ },
2673
+ emits: ["update:modelValue"],
2674
+ setup(t) {
2675
+ const s = Y(t, ["inputClass", "labelClass"]), e = ke("$input"), [r, n] = it(), a = p(() => I("relative flex items-start", n.value)), o = p(() => {
2676
+ var c, d;
2677
+ return I(
2678
+ "size-4 rounded text-primary hover:bg-gray-200 checked:hover:bg-primary/80 checked:border-0",
2679
+ {
2680
+ "border-gray-300 focus:ring-primary": !((c = e.value) != null && c.errors),
2681
+ "border-red-400 border-2 focus:ring-red-600": (d = e.value) == null ? void 0 : d.errors
2682
+ },
2683
+ t.inputClass
2684
+ );
2685
+ }), u = p(() => I("ml-2 text-sm leading-6", t.labelClass));
2686
+ return (c, d) => (i(), h(ot, T({
2687
+ ref_key: "$input",
2688
+ ref: e,
2689
+ class: a.value
2690
+ }, s, {
2691
+ "onUpdate:modelValue": d[0] || (d[0] = (v) => c.$emit("update:modelValue", v))
2692
+ }), {
2693
+ default: f(() => [
2694
+ y("div", Un, [
2695
+ m(lt, T(l(r), {
2696
+ type: "checkbox",
2697
+ class: o.value
2698
+ }), null, 16, ["class"])
2699
+ ]),
2700
+ c.$slots.default ? (i(), b("div", {
2701
+ key: 0,
2702
+ class: P(u.value)
2703
+ }, [
2704
+ m($e, { class: "text-gray-900" }, {
2705
+ default: f(() => [
2706
+ w(c.$slots, "default")
2707
+ ]),
2708
+ _: 3
2709
+ }),
2710
+ m(xe, { class: "text-red-600" })
2711
+ ], 2)) : c.label ? (i(), b("div", {
2712
+ key: 1,
2713
+ class: P(u.value)
2714
+ }, [
2715
+ m($e, { class: "text-gray-900" }),
2716
+ m(xe, { class: "text-red-600" })
2717
+ ], 2)) : M("", !0)
2718
+ ]),
2719
+ _: 3
2720
+ }, 16, ["class"]));
2721
+ }
2722
+ }), Ga = /* @__PURE__ */ g({
2723
+ __name: "DropdownMenu",
2724
+ props: {
2725
+ align: {},
2726
+ options: {}
2727
+ },
2728
+ setup(t) {
2729
+ return (s, e) => (i(), h(l(hs), null, {
2730
+ default: f(() => [
2731
+ m(l(gs), null, {
2732
+ default: f(() => [
2733
+ w(s.$slots, "default")
2734
+ ]),
2735
+ _: 3
2736
+ }),
2737
+ m(l(vs), null, {
2738
+ default: f(() => [
2739
+ m(l(bs), {
2740
+ class: "gap-y-0.5 rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-black/5",
2741
+ align: s.align
2742
+ }, {
2743
+ default: f(() => [
2744
+ (i(!0), b(q, null, N(s.options, (r, n) => (i(), h(l(ys), {
2745
+ key: n,
2746
+ class: "flex w-full items-center rounded-lg px-2 py-2 text-sm text-gray-900 data-[highlighted]:bg-gray-100",
2747
+ onSelect: r.click
2748
+ }, {
2749
+ default: f(() => [
2750
+ j($(r.label), 1)
2751
+ ]),
2752
+ _: 2
2753
+ }, 1032, ["onSelect"]))), 128))
2754
+ ]),
2755
+ _: 1
2756
+ }, 8, ["align"])
2757
+ ]),
2758
+ _: 1
2759
+ })
2760
+ ]),
2761
+ _: 3
2762
+ }));
2763
+ }
2764
+ }), Nn = ["aria-hidden"], On = ["tabindex", "aria-label", "type"], Za = /* @__PURE__ */ g({
2765
+ __name: "EditableContent",
2766
+ props: {
2767
+ type: { default: "text" },
2768
+ contentClass: {},
2769
+ ariaLabel: {},
2770
+ formAriaHidden: { type: Boolean },
2771
+ tabindex: {},
2772
+ text: {},
2773
+ disabled: { type: Boolean }
2774
+ },
2775
+ emits: ["update", "save"],
2776
+ setup(t, { emit: s }) {
2777
+ const e = s, r = L(), n = L(null), a = L(t.text), o = p(() => I("inline whitespace-pre", t.contentClass)), u = p(() => I("invisible whitespace-pre", t.contentClass)), c = p(() => I("absolute inset-0 h-full w-full resize-none border-0 bg-transparent p-0 focus:ring-0", t.contentClass));
2778
+ function d() {
2779
+ n.value = t.text;
2780
+ }
2781
+ function v() {
2782
+ n.value && (t.type !== "number" && a.value.trim().length === 0 && (a.value = n.value, e("update", a.value)), n.value = null, e("save"));
2783
+ }
2784
+ return Me(() => a.value = t.text), (x, S) => (i(), b("div", {
2785
+ class: P(["relative", { "pointer-events-none!": x.disabled && !n.value }])
2786
+ }, [
2787
+ n.value ? (i(), b("span", {
2788
+ key: 1,
2789
+ class: P(u.value)
2790
+ }, $(a.value), 3)) : (i(), b("div", {
2791
+ key: 0,
2792
+ class: P(o.value)
2793
+ }, [
2794
+ w(x.$slots, "default")
2795
+ ], 2)),
2796
+ x.type === "number" ? (i(), b("span", {
2797
+ key: 2,
2798
+ class: P(["inline-block transition-[width]", n.value ? "w-5" : "w-0"])
2799
+ }, null, 2)) : M("", !0),
2800
+ y("form", {
2801
+ class: "w-full",
2802
+ "aria-hidden": x.formAriaHidden,
2803
+ onSubmit: S[4] || (S[4] = De((O) => {
2804
+ var He;
2805
+ return (He = r.value) == null ? void 0 : He.blur();
2806
+ }, ["prevent"]))
2807
+ }, [
2808
+ Fe(y("input", {
2809
+ ref_key: "$input",
2810
+ ref: r,
2811
+ "onUpdate:modelValue": S[0] || (S[0] = (O) => a.value = O),
2812
+ tabindex: x.tabindex ?? void 0,
2813
+ "aria-label": x.ariaLabel ?? void 0,
2814
+ type: x.type,
2815
+ class: P([
2816
+ c.value,
2817
+ { "opacity-0": !n.value, "appearance-textfield": !n.value && x.type === "number" }
2818
+ ]),
2819
+ onKeyup: S[1] || (S[1] = (O) => x.$emit("update", a.value)),
2820
+ onFocus: S[2] || (S[2] = (O) => d()),
2821
+ onBlur: S[3] || (S[3] = (O) => v())
2822
+ }, null, 42, On), [
2823
+ [Pt, a.value]
2824
+ ])
2825
+ ], 40, Nn)
2826
+ ], 2));
2827
+ }
2828
+ }), Xa = /* @__PURE__ */ g({
2829
+ __name: "ErrorMessage",
2830
+ props: {
2831
+ error: {}
2832
+ },
2833
+ setup(t) {
2834
+ const s = p(() => Ws(t.error));
2835
+ return (e, r) => (i(), h(R, {
2836
+ text: s.value,
2837
+ inline: ""
2838
+ }, null, 8, ["text"]));
2839
+ }
2840
+ }), Ya = /* @__PURE__ */ g({
2841
+ __name: "Link",
2842
+ props: {
2843
+ class: {},
2844
+ disabled: { type: Boolean },
2845
+ href: {},
2846
+ route: {},
2847
+ routeParams: {},
2848
+ routeQuery: {},
2849
+ size: {},
2850
+ submit: { type: Boolean },
2851
+ asChild: { type: Boolean },
2852
+ as: {}
2853
+ },
2854
+ setup(t) {
2855
+ return (s, e) => (i(), h(V, T({ variant: "link" }, s.$props), {
2856
+ default: f(() => [
2857
+ w(s.$slots, "default")
2858
+ ]),
2859
+ _: 3
2860
+ }, 16));
2861
+ }
2862
+ }), ft = /* @__PURE__ */ g({
2863
+ __name: "SelectLabel",
2864
+ setup(t) {
2865
+ return (s, e) => s.$slots.default ? (i(), h(ze, {
2866
+ key: 0,
2867
+ class: "block text-sm leading-6 font-medium text-gray-900"
2868
+ }, {
2869
+ default: f(() => [
2870
+ w(s.$slots, "default")
2871
+ ]),
2872
+ _: 3
2873
+ })) : (i(), h(ze, {
2874
+ key: 1,
2875
+ class: "block text-sm leading-6 font-medium text-gray-900"
2876
+ }));
2877
+ }
2878
+ }), 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" }, ht = /* @__PURE__ */ g({
2879
+ __name: "SelectOptions",
2880
+ setup(t) {
2881
+ const s = H("select", "<SelectOptions> must be a child of a <Select>");
2882
+ return (e, r) => (i(), h(mt, { class: "z-50 overflow-auto rounded-lg bg-white text-base shadow-lg ring-1 ring-black/5 focus:outline-hidden" }, {
2883
+ default: f(() => [
2884
+ w(e.$slots, "default", {}, () => {
2885
+ var n;
2886
+ return [
2887
+ (i(!0), b(q, null, N(((n = l(s)) == null ? void 0 : n.options) ?? [], (a) => (i(), h(pt, {
2888
+ key: a.key,
2889
+ value: a.value,
2890
+ class: "group p-1 outline-none"
2891
+ }, {
2892
+ default: f(() => [
2893
+ y("div", Wn, [
2894
+ y("span", Kn, $(a.label), 1)
2895
+ ])
2896
+ ]),
2897
+ _: 2
2898
+ }, 1032, ["value"]))), 128))
2899
+ ];
2900
+ })
2901
+ ]),
2902
+ _: 3
2903
+ }));
2904
+ }
2905
+ }), Jn = {
2906
+ viewBox: "0 0 20 20",
2907
+ width: "1.2em",
2908
+ height: "1.2em"
2909
+ };
2910
+ function Qn(t, s) {
2911
+ return i(), b("svg", Jn, s[0] || (s[0] = [
2912
+ y("path", {
2913
+ fill: "currentColor",
2914
+ d: "m9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828L5.757 6.586L4.343 8z"
2915
+ }, null, -1)
2916
+ ]));
2917
+ }
2918
+ const Gn = { name: "zondicons-cheveron-down", render: Qn }, gt = /* @__PURE__ */ g({
2919
+ __name: "SelectTrigger",
2920
+ props: {
2921
+ class: {}
2922
+ },
2923
+ setup(t) {
2924
+ const s = H("select", "<SelectTrigger> must be a child of a <Select>"), e = p(() => I(
2925
+ // eslint-disable-next-line vue/max-len
2926
+ "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",
2927
+ { "mt-1": s.label },
2928
+ t.class
2929
+ ));
2930
+ return (r, n) => (i(), h(dt, {
2931
+ class: P(e.value)
2932
+ }, {
2933
+ default: f(() => [
2934
+ m(ct, { class: "col-start-1 row-start-1 truncate pr-2" }),
2935
+ m(l(Gn), { class: "col-start-1 row-start-1 size-5 self-center justify-self-end text-gray-500 sm:size-4" })
2936
+ ]),
2937
+ _: 1
2938
+ }, 8, ["class"]));
2939
+ }
2940
+ }), Zn = /* @__PURE__ */ g({
2941
+ __name: "Select",
2942
+ props: {
2943
+ as: {},
2944
+ options: {},
2945
+ placeholder: {},
2946
+ renderOption: { type: Function },
2947
+ name: {},
2948
+ label: {},
2949
+ description: {},
2950
+ modelValue: {}
2951
+ },
2952
+ emits: ["update:modelValue"],
2953
+ setup(t) {
2954
+ return (s, e) => (i(), h(Bn, T(s.$props, {
2955
+ "onUpdate:modelValue": e[0] || (e[0] = (r) => s.$emit("update:modelValue", r))
2956
+ }), {
2957
+ default: f(() => [
2958
+ m(ft),
2959
+ w(s.$slots, "default", {}, () => [
2960
+ m(gt),
2961
+ m(ht)
2962
+ ])
2963
+ ]),
2964
+ _: 3
2965
+ }, 16));
2966
+ }
2967
+ }), Xn = { class: "grow" }, eo = /* @__PURE__ */ g({
2968
+ __name: "SettingsModal",
2969
+ setup(t) {
2970
+ const s = J.getBrowserLocale(), e = p(() => [null, ...J.locales]);
2971
+ function r(n) {
2972
+ return (n && F.locales[n]) ?? C("settings.localeDefault", "{locale} (default)", {
2973
+ locale: F.locales[s] ?? s
2974
+ });
2975
+ }
2976
+ return (n, a) => (i(), h(ee, {
2977
+ title: n.$td("settings.title", "Settings")
2978
+ }, {
2979
+ default: f(() => [
2980
+ m(Zn, {
2981
+ modelValue: n.$lang.locale,
2982
+ "onUpdate:modelValue": a[0] || (a[0] = (o) => n.$lang.locale = o),
2983
+ class: "flex flex-col items-start md:flex-row",
2984
+ as: "div",
2985
+ options: e.value,
2986
+ "render-option": r
2987
+ }, {
2988
+ default: f(() => [
2989
+ y("div", Xn, [
2990
+ m(ft, null, {
2991
+ default: f(() => [
2992
+ j($(n.$td("settings.locale", "Language")), 1)
2993
+ ]),
2994
+ _: 1
2995
+ }),
2996
+ m(R, {
2997
+ "lang-key": "settings.localeDescription",
2998
+ "lang-default": "Choose the application's language.",
2999
+ class: "mt-1 text-sm text-gray-500"
3000
+ })
3001
+ ]),
3002
+ m(V, {
3003
+ variant: "ghost",
3004
+ as: gt,
3005
+ class: "w-auto outline-none"
3006
+ }),
3007
+ m(ht)
3008
+ ]),
3009
+ _: 1
3010
+ }, 8, ["modelValue", "options"])
3011
+ ]),
3012
+ _: 1
3013
+ }, 8, ["title"]));
3014
+ }
3015
+ });
3016
+ class to {
3017
+ constructor() {
3018
+ _(this, "status");
3019
+ _(this, "_listeners");
3020
+ _(this, "_progress");
3021
+ _(this, "_cancelled");
3022
+ _(this, "_started");
3023
+ _(this, "_completed");
3024
+ this.status = this.getInitialStatus(), this._listeners = new Dt(), this._started = new W(), this._completed = new W();
3025
+ }
3026
+ async start() {
3027
+ this.beforeStart(), this._started.resolve();
3028
+ try {
3029
+ await this.updateProgress(), await this.run(), await this.updateProgress(), this._completed.resolve();
3030
+ } catch (s) {
3031
+ if (s instanceof je)
3032
+ return;
3033
+ throw G(Ft(s), (e) => {
3034
+ this._completed.reject(e);
3035
+ });
3036
+ }
3037
+ }
3038
+ async cancel() {
3039
+ this._cancelled = new W(), await this._cancelled;
3040
+ }
3041
+ serialize() {
3042
+ return this.serializeStatus(this.status);
3043
+ }
3044
+ get listeners() {
3045
+ return this._listeners;
3046
+ }
3047
+ get progress() {
3048
+ return this._progress ?? 0;
3049
+ }
3050
+ get cancelled() {
3051
+ var s;
3052
+ return !!((s = this._cancelled) != null && s.isResolved());
3053
+ }
3054
+ get started() {
3055
+ return this._started;
3056
+ }
3057
+ get completed() {
3058
+ return this._completed;
3059
+ }
3060
+ getInitialStatus() {
3061
+ return { completed: !1 };
3062
+ }
3063
+ beforeStart() {
3064
+ if (this._started.isResolved()) {
3065
+ if (this._cancelled) {
3066
+ delete this._progress, delete this._cancelled;
3067
+ return;
3068
+ }
3069
+ throw new Error("Job already started!");
3070
+ }
3071
+ }
3072
+ assertNotCancelled() {
3073
+ if (this._cancelled)
3074
+ throw this._cancelled.resolve(), new je();
3075
+ }
3076
+ calculateCurrentProgress(s) {
3077
+ return s ?? (s = this.status), s.completed ? 1 : s.children ? Ut(
3078
+ s.children.reduce((e, r) => e + this.calculateCurrentProgress(r), 0) / s.children.length,
3079
+ 2
3080
+ ) : 0;
3081
+ }
3082
+ async updateProgress(s) {
3083
+ await (s == null ? void 0 : s(this.status));
3084
+ const e = this.calculateCurrentProgress();
3085
+ e !== this._progress && (this._progress = e, await this._listeners.emit("onUpdated", e));
3086
+ }
3087
+ serializeStatus(s) {
3088
+ return { ...s };
3089
+ }
3090
+ }
3091
+ async function so(t) {
3092
+ await t.start();
3093
+ }
3094
+ export {
3095
+ Ja as AdvancedOptions,
3096
+ vr as AlertModal,
3097
+ U as App,
3098
+ Fa as AppLayout,
3099
+ An as AppOverlays,
3100
+ Es as AppService,
3101
+ V as Button,
3102
+ La as Cache,
3103
+ Vs as CacheService,
3104
+ Qa as Checkbox,
3105
+ Er as ConfirmModal,
3106
+ Ga as DropdownMenu,
3107
+ Za as EditableContent,
3108
+ Xa as ErrorMessage,
3109
+ sn as ErrorReportModal,
3110
+ Kr as ErrorReportModalButtons,
3111
+ Jr as ErrorReportModalTitle,
3112
+ Ge as Errors,
3113
+ da as EventListenerPriorities,
3114
+ k as Events,
3115
+ ks as EventsService,
3116
+ st as Form,
3117
+ _r as FormController,
3118
+ B as FormFieldTypes,
3119
+ ir as HeadlessButton,
3120
+ ot as HeadlessInput,
3121
+ fn as HeadlessInputDescription,
3122
+ xe as HeadlessInputError,
3123
+ lt as HeadlessInputInput,
3124
+ $e as HeadlessInputLabel,
3125
+ Na as HeadlessInputTextArea,
3126
+ dr as HeadlessModal,
3127
+ pr as HeadlessModalContent,
3128
+ mr as HeadlessModalOverlay,
3129
+ fr as HeadlessModalTitle,
3130
+ Bn as HeadlessSelect,
3131
+ ze as HeadlessSelectLabel,
3132
+ pt as HeadlessSelectOption,
3133
+ mt as HeadlessSelectOptions,
3134
+ dt as HeadlessSelectTrigger,
3135
+ ct as HeadlessSelectValue,
3136
+ Mn as HeadlessToast,
3137
+ vn as Input,
3138
+ to as Job,
3139
+ je as JobCancelledError,
3140
+ J as Lang,
3141
+ ce as Layouts,
3142
+ Ya as Link,
3143
+ dn as LoadingModal,
3144
+ Ke as MOBILE_BREAKPOINT,
3145
+ R as Markdown,
3146
+ ee as Modal,
3147
+ tt as ModalContext,
3148
+ un as ProgressBar,
3149
+ _n as PromptModal,
3150
+ Zn as Select,
3151
+ ft as SelectLabel,
3152
+ ht as SelectOptions,
3153
+ gt as SelectTrigger,
3154
+ he as Service,
3155
+ we as ServiceBootError,
3156
+ eo as SettingsModal,
3157
+ Sn as StartupCrash,
3158
+ js as Storage,
3159
+ En as Toast,
3160
+ A as UI,
3161
+ E as UIComponents,
3162
+ qs as UIService,
3163
+ ma as arrayProp,
3164
+ Va as booleanInput,
3165
+ fa as booleanProp,
3166
+ ge as bootServices,
3167
+ Da as bootstrap,
3168
+ Hn as bootstrapApplication,
3169
+ ha as computedAsync,
3170
+ Aa as dateInput,
3171
+ ga as defineDirective,
3172
+ Ta as defineFormValidationRule,
3173
+ pa as definePlugin,
3174
+ fe as defineServiceState,
3175
+ Ss as defineServiceStore,
3176
+ so as dispatch,
3177
+ Ua as elementRef,
3178
+ va as enumProp,
3179
+ Je as getCurrentLayout,
3180
+ Ws as getErrorMessage,
3181
+ Cs as getPiniaStore,
3182
+ Rn as hasSelectOptionLabel,
3183
+ ba as injectOrFail,
3184
+ Ls as injectReactive,
3185
+ H as injectReactiveOrFail,
3186
+ Ps as installPlugins,
3187
+ ya as listenerProp,
3188
+ _a as mixedProp,
3189
+ Ba as numberInput,
3190
+ wa as numberProp,
3191
+ $a as objectProp,
3192
+ Oa as onCleanMounted,
3193
+ Wa as persistent,
3194
+ Ia as registerErrorHandler,
3195
+ Ka as removeInteractiveClasses,
3196
+ ar as renderMarkdown,
3197
+ Ha as replaceExisting,
3198
+ xa as requiredArrayProp,
3199
+ ja as requiredBooleanInput,
3200
+ Ra as requiredDateInput,
3201
+ Ca as requiredEnumProp,
3202
+ Sa as requiredMixedProp,
3203
+ za as requiredNumberInput,
3204
+ ka as requiredNumberProp,
3205
+ Ma as requiredObjectProp,
3206
+ wr as requiredStringInput,
3207
+ Ea as requiredStringProp,
3208
+ xs as resetPiniaStore,
3209
+ or as safeHtml,
3210
+ qa as stringInput,
3211
+ Pa as stringProp,
3212
+ Qe as translate,
3213
+ C as translateWithDefault,
3214
+ $r as useConfirmModal,
3215
+ se as useEvent,
3216
+ rt as useForm,
3217
+ it as useInputAttrs,
3218
+ cn as useLoadingModal,
3219
+ bn as usePromptModal,
3220
+ yr as validate,
3221
+ le as validators
3222
+ };
3223
+ //# sourceMappingURL=aerogel-core.js.map