@aerogel/core 0.0.0-next.f9394854509d71d644498ac087706a2f8f8eea1c → 0.0.0-next.fb0f08b1df2e4aff5b34e23b9927b06b58484c98

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