@aerogel/core 0.0.0-next.f86b4b09f066c4aef21796a37dbc8417b7dce3cd → 0.0.0-next.f8c757d83e1e0d001a2836fa45aba318ec17b9b9

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