@aeria-ui/ui 0.0.41 → 0.0.43

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.
@@ -0,0 +1,3279 @@
1
+ import { defineComponent as q, ref as X, resolveDirective as ne, openBlock as n, createElementBlock as s, normalizeClass as Q, Fragment as J, renderList as U, withDirectives as Z, toDisplayString as k, createCommentVNode as y, createTextVNode as D, unref as e, renderSlot as A, inject as ve, computed as H, createElementVNode as V, mergeProps as E, createBlock as $, resolveDynamicComponent as he, withCtx as v, useCssVars as kt, Teleport as Ge, watch as re, createVNode as z, vModelDynamic as Vt, onBeforeMount as mt, normalizeStyle as $e, withModifiers as ze, pushScopeId as Fe, popScopeId as qe, provide as ye, onMounted as Ct, normalizeProps as ce, guardReactiveProps as Ve, isRef as ft, createSlots as de, vModelCheckbox as It, onUnmounted as At, resolveComponent as Ot, Suspense as wt, useSlots as Bt, h as St } from "vue";
2
+ import { t as F, useI18n as jt } from "@aeria-ui/i18n";
3
+ import { useScrollObserver as We, useBreakpoints as je, useClipboard as Tt, useMask as Lt, PAGINATION_PER_PAGE_DEFAULTS as Rt, API_URL as vt, request as zt, useDebounce as yt, isDocumentComplete as Mt, convertToSearchQuery as Ft, useAction as qt, convertFromSearchQuery as Ut, usePasswordPolicy as Et } from "@aeria-ui/core";
4
+ import { useStore as ue, getStoreId as Te, useParentStore as ge, STORE_ID as Ue, getGlobalStateManager as ht } from "@aeria-ui/state-management";
5
+ import { useRouter as Le } from "vue-router";
6
+ import { isLeft as $t, getReferenceProperty as pe, convertConditionToQuery as Ht, deepClone as Se, freshItem as Dt, isRequired as Qt, evaluateCondition as Qe } from "@aeriajs/common";
7
+ const Gt = ["onClick"], Wt = { key: 0 }, Xt = {
8
+ key: 0,
9
+ class: "accordion__content"
10
+ }, Yt = /* @__PURE__ */ q({
11
+ __name: "aeria-accordion",
12
+ props: {
13
+ enumerate: { type: Boolean },
14
+ noPadding: { type: Boolean },
15
+ headers: {}
16
+ },
17
+ setup(c) {
18
+ const r = X(null), t = (o) => typeof o == "string" ? o : o.title;
19
+ return (o, l) => {
20
+ const i = ne("clickable");
21
+ return n(), s("div", {
22
+ class: Q({
23
+ accordion: !0,
24
+ "accordion--padded": !o.noPadding
25
+ })
26
+ }, [
27
+ (n(!0), s(J, null, U(Object.keys(o.$slots).filter((u) => u !== "default"), (u, _) => (n(), s("div", {
28
+ key: u,
29
+ class: "accordion__slot"
30
+ }, [
31
+ Z((n(), s("div", {
32
+ class: "accordion__header",
33
+ onClick: (m) => r.value === u ? r.value = null : r.value = u
34
+ }, [
35
+ o.enumerate ? (n(), s("span", Wt, k(_ + 1) + ". ", 1)) : y("", !0),
36
+ D(" " + k(o.headers[u] ? t(o.headers[u]) : e(F)(u)), 1)
37
+ ], 8, Gt)), [
38
+ [i]
39
+ ]),
40
+ r.value === u ? (n(), s("div", Xt, [
41
+ A(o.$slots, u, {}, void 0, !0)
42
+ ])) : y("", !0)
43
+ ]))), 128))
44
+ ], 2);
45
+ };
46
+ }
47
+ });
48
+ const G = (c, r) => {
49
+ const t = c.__vccOpts || c;
50
+ for (const [o, l] of r)
51
+ t[o] = l;
52
+ return t;
53
+ }, Tl = /* @__PURE__ */ G(Yt, [["__scopeId", "data-v-3ea933d4"]]), Jt = /* @__PURE__ */ q({
54
+ __name: "aeria-badge",
55
+ props: {
56
+ large: { type: Boolean },
57
+ alt: { type: Boolean }
58
+ },
59
+ setup(c) {
60
+ return (r, t) => (n(), s("div", {
61
+ class: Q(`
62
+ badge
63
+ ${r.large && "badge--large"}
64
+ ${r.alt && "badge--alt"}
65
+ `)
66
+ }, [
67
+ A(r.$slots, "default", {}, void 0, !0)
68
+ ], 2));
69
+ }
70
+ });
71
+ const be = /* @__PURE__ */ G(Jt, [["__scopeId", "data-v-47f92648"]]), Kt = /* @__PURE__ */ q({
72
+ __name: "aeria-bare-button",
73
+ props: {
74
+ disabled: { type: Boolean }
75
+ },
76
+ emits: ["click"],
77
+ setup(c, { emit: r }) {
78
+ const t = c, o = r, l = (i) => {
79
+ t.disabled || o("click", i);
80
+ };
81
+ return (i, u) => (n(), s("button", {
82
+ class: Q(`
83
+ barebutton
84
+ barebutton--${i.disabled ? "disabled" : "enabled"}
85
+ `),
86
+ onClick: l
87
+ }, [
88
+ A(i.$slots, "default", {}, void 0, !0)
89
+ ], 2));
90
+ }
91
+ });
92
+ const fe = /* @__PURE__ */ G(Kt, [["__scopeId", "data-v-35bc81ae"]]), Zt = ["href"], Pt = {
93
+ key: 0,
94
+ "data-component": "icon-label"
95
+ }, Nt = /* @__PURE__ */ q({
96
+ __name: "aeria-icon",
97
+ props: {
98
+ icon: {},
99
+ size: {},
100
+ medium: { type: Boolean },
101
+ reactive: { type: [Boolean, null] },
102
+ iconRight: { type: Boolean },
103
+ fill: {}
104
+ },
105
+ setup(c) {
106
+ const r = c, t = typeof r.reactive == "boolean" ? r.reactive : ve("iconReactive", !1), o = H(() => {
107
+ var l;
108
+ return (l = r.icon) != null && l.includes(":") ? r.icon : `regular:${r.icon}`;
109
+ });
110
+ return (l, i) => (n(), s("a", {
111
+ class: Q(`
112
+ icon
113
+ ${e(t) && "icon--reactive"}
114
+ ${l.$slots.default ? "icon--centered" : "icon--standalone"}
115
+ `)
116
+ }, [
117
+ V("div", {
118
+ class: Q(`
119
+ icon__icon
120
+ ${l.size && `icon__icon--${l.size}`}
121
+ ${l.iconRight && "icon__icon--right"}
122
+ `)
123
+ }, [
124
+ (n(), s("svg", E({
125
+ width: "24",
126
+ height: "24",
127
+ viewBox: "0 0 256 256",
128
+ "data-component": "icon"
129
+ }, {
130
+ ...l.fill ? { fill: l.fill } : {}
131
+ }), [
132
+ V("use", {
133
+ href: `/assets/icons.svg#${o.value}`
134
+ }, null, 8, Zt)
135
+ ], 16))
136
+ ], 2),
137
+ l.$slots.default ? (n(), s("div", Pt, [
138
+ A(l.$slots, "default", {}, void 0, !0)
139
+ ])) : y("", !0)
140
+ ], 2));
141
+ }
142
+ });
143
+ const K = /* @__PURE__ */ G(Nt, [["__scopeId", "data-v-4b763bd3"]]), xt = { class: "panel__header-left" }, en = { key: 1 }, tn = {
144
+ key: 2,
145
+ style: { "margin-left": "auto" }
146
+ }, nn = /* @__PURE__ */ q({
147
+ __name: "aeria-panel",
148
+ props: {
149
+ closeHint: { type: Boolean, default: !1 },
150
+ modelValue: { default: !0 },
151
+ title: {},
152
+ float: { type: Boolean },
153
+ fixedRight: { type: Boolean },
154
+ floating: { type: Boolean },
155
+ loading: { type: Boolean },
156
+ bordered: { type: Boolean },
157
+ overlay: { type: Boolean },
158
+ invisibleOverlay: { type: Boolean },
159
+ collapsed: { type: Boolean },
160
+ collapsible: { type: Boolean, default: !1 },
161
+ fill: { type: Boolean },
162
+ fillFooter: { type: Boolean },
163
+ transparent: { type: Boolean },
164
+ transparentMobile: { type: Boolean },
165
+ outerHeader: { type: Boolean },
166
+ overlayLayer: {}
167
+ },
168
+ emits: ["update:modelValue", "update:collapsed", "update:closeHint", "overlayClick", "close"],
169
+ setup(c, { emit: r }) {
170
+ const t = c, o = r, l = H(() => t.floating || t.float), i = X(t.collapsed), u = X(null), { reachedEnd: _ } = We(u), m = () => {
171
+ o("update:modelValue", !1), o("close");
172
+ }, h = () => {
173
+ o("overlayClick");
174
+ }, d = (a) => {
175
+ o("update:collapsed", a), i.value = a;
176
+ };
177
+ return (a, p) => {
178
+ const b = ne("clickable"), S = ne("loading"), R = ne("overlay");
179
+ return a.modelValue ? Z((n(), s("div", {
180
+ key: 0,
181
+ class: Q(`
182
+ panel
183
+ ${a.fixedRight && "panel--fixed"}
184
+ `)
185
+ }, [
186
+ (n(), $(he(
187
+ l.value ? "dialog" : "div"
188
+ ), {
189
+ "data-component": "panel",
190
+ class: Q(`
191
+ aeria-surface
192
+ panel__content
193
+ ${!(l.value || a.fixedRight) && "panel__content--rounded"}
194
+ ${l.value && "panel__content--floating"}
195
+ ${a.bordered && "panel__content--bordered-body"}
196
+ ${a.fixedRight && "panel__content--fixed-right"}
197
+ ${a.transparent && "panel__content--transparent"}
198
+ ${a.transparentMobile && "panel__content--transparent-mobile"}
199
+ ${a.outerHeader && "panel__content--outer-header"}
200
+ `),
201
+ onClick: p[1] || (p[1] = (Y) => Y.stopPropagation())
202
+ }, {
203
+ default: v(() => [
204
+ a.$slots.header || a.title ? (n(), s("div", {
205
+ key: 0,
206
+ class: Q(`
207
+ panel__header
208
+ ${i.value && "panel__header--collapsed"}
209
+ ${a.outerHeader && "panel__header--outer"}
210
+ `)
211
+ }, [
212
+ V("div", xt, [
213
+ a.$slots.header ? A(a.$slots, "header", { key: 0 }, void 0, !0) : a.title ? (n(), s("div", en, k(a.title), 1)) : y("", !0),
214
+ a.$slots.extra ? (n(), s("div", tn, [
215
+ A(a.$slots, "extra", {}, void 0, !0)
216
+ ])) : y("", !0)
217
+ ]),
218
+ a.collapsible ? Z((n(), $(K, {
219
+ key: 0,
220
+ reactive: "",
221
+ icon: i.value ? "plus" : "minus",
222
+ onClick: p[0] || (p[0] = (Y) => d(!i.value))
223
+ }, null, 8, ["icon"])), [
224
+ [b]
225
+ ]) : a.closeHint ? Z((n(), $(K, {
226
+ key: 1,
227
+ reactive: "",
228
+ icon: "x",
229
+ onClick: m
230
+ }, null, 512)), [
231
+ [b]
232
+ ]) : y("", !0)
233
+ ], 2)) : y("", !0),
234
+ i.value ? y("", !0) : Z((n(), s("div", {
235
+ key: 1,
236
+ ref_key: "body",
237
+ ref: u,
238
+ class: Q(`
239
+ panel__body
240
+ ${a.fill || "panel__body--padded"}
241
+ `)
242
+ }, [
243
+ A(a.$slots, "default", {}, void 0, !0)
244
+ ], 2)), [
245
+ [S, a.loading]
246
+ ]),
247
+ a.$slots.footer ? (n(), s("div", {
248
+ key: 2,
249
+ class: Q(`
250
+ panel__footer
251
+ ${a.fillFooter || "panel__footer--padded"}
252
+ ${e(_) || "panel__footer--shadowed"}
253
+ `)
254
+ }, [
255
+ A(a.$slots, "footer", {}, void 0, !0)
256
+ ], 2)) : y("", !0)
257
+ ]),
258
+ _: 3
259
+ }, 8, ["class"]))
260
+ ], 2)), [
261
+ [R, {
262
+ condition: a.overlay || a.fixedRight || l.value,
263
+ invisible: a.invisibleOverlay,
264
+ click: h,
265
+ layer: a.overlayLayer || (l.value ? 60 : a.fixedRight ? 50 : 0)
266
+ }]
267
+ ]) : y("", !0);
268
+ };
269
+ }
270
+ });
271
+ const Ae = /* @__PURE__ */ G(nn, [["__scopeId", "data-v-6fdc75a0"]]), on = { class: "button__content" }, an = {
272
+ key: 1,
273
+ class: "button__content"
274
+ }, ln = /* @__PURE__ */ q({
275
+ __name: "aeria-button",
276
+ props: {
277
+ size: {},
278
+ variant: {},
279
+ small: { type: Boolean },
280
+ large: { type: Boolean },
281
+ icon: {},
282
+ disabled: { type: Boolean },
283
+ loading: { type: Boolean }
284
+ },
285
+ setup(c) {
286
+ const r = c, t = ve("buttonVariant", r.variant) || "primary", o = (() => {
287
+ switch (!0) {
288
+ case r.small:
289
+ return "small";
290
+ case r.large:
291
+ return "large";
292
+ }
293
+ return ve("buttonSize", r.size) || "medium";
294
+ })();
295
+ return (l, i) => (n(), $(fe, {
296
+ class: Q(`
297
+ button
298
+ button--${e(t)}
299
+ button--${e(o)}
300
+ ${l.loading && "button--loading"}
301
+ `),
302
+ disabled: l.disabled
303
+ }, {
304
+ default: v(() => [
305
+ l.icon ? (n(), $(K, {
306
+ key: 0,
307
+ icon: l.icon
308
+ }, {
309
+ default: v(() => [
310
+ V("div", on, [
311
+ A(l.$slots, "default", {}, void 0, !0)
312
+ ])
313
+ ]),
314
+ _: 3
315
+ }, 8, ["icon"])) : (n(), s("div", an, [
316
+ A(l.$slots, "default", {}, void 0, !0)
317
+ ]))
318
+ ]),
319
+ _: 3
320
+ }, 8, ["class", "disabled"]));
321
+ }
322
+ });
323
+ const ie = /* @__PURE__ */ G(ln, [["__scopeId", "data-v-c328251b"]]), sn = { class: "card__picture" }, rn = { class: "card__footer" }, un = { class: "card__footer-upper" }, cn = { class: "card__badge" }, dn = /* @__PURE__ */ q({
324
+ __name: "aeria-card",
325
+ props: {
326
+ inactive: { type: Boolean },
327
+ horizontal: { type: Boolean }
328
+ },
329
+ setup(c) {
330
+ return (r, t) => (n(), s("div", {
331
+ class: Q(`
332
+ card
333
+ ${r.inactive && "card--inactive"}
334
+ ${r.horizontal && "card--horizontal"}
335
+ `)
336
+ }, [
337
+ V("div", sn, [
338
+ A(r.$slots, "default", {}, void 0, !0)
339
+ ]),
340
+ V("div", rn, [
341
+ V("div", un, [
342
+ V("div", null, [
343
+ A(r.$slots, "footer", {}, void 0, !0)
344
+ ]),
345
+ r.$slots.actions ? A(r.$slots, "actions", { key: 0 }, void 0, !0) : y("", !0)
346
+ ]),
347
+ V("div", cn, [
348
+ A(r.$slots, "badge", {}, void 0, !0)
349
+ ])
350
+ ])
351
+ ], 2));
352
+ }
353
+ });
354
+ const pn = /* @__PURE__ */ G(dn, [["__scopeId", "data-v-c1a322df"]]), _n = { class: "content__body" }, mn = {
355
+ key: 0,
356
+ class: "content__section"
357
+ }, fn = { class: "content__item" }, vn = /* @__PURE__ */ q({
358
+ __name: "aeria-context-menu",
359
+ props: {
360
+ actions: {},
361
+ subject: {},
362
+ overlayLayer: {}
363
+ },
364
+ emits: ["actionClick"],
365
+ setup(c, { emit: r }) {
366
+ kt((h) => ({
367
+ "42bf4bfe": m.value.x,
368
+ "42bf4bfc": m.value.y
369
+ }));
370
+ const t = r, o = ue("user"), l = X(null), i = X(!1), u = (h) => h == null ? void 0 : h.filter((d) => d.roles ? d.roles.include(o.currentUser.role) : !!d.click), _ = (h, d) => {
371
+ h.click(d), t("actionClick", {
372
+ action: h,
373
+ subject: d
374
+ }), i.value = !1;
375
+ }, m = H(() => {
376
+ if (!l.value)
377
+ return {
378
+ x: 0,
379
+ y: 0
380
+ };
381
+ const h = l.value.getBoundingClientRect().top, d = l.value.getBoundingClientRect().left, a = l.value.offsetHeight;
382
+ return {
383
+ _: i.value,
384
+ x: Math.floor(d) + "px",
385
+ y: Math.floor(h + a) + "px"
386
+ };
387
+ });
388
+ return (h, d) => {
389
+ const a = ne("overlay");
390
+ return n(), s(J, null, [
391
+ Object.keys(h.$slots).some((p) => p !== "default") || h.actions !== void 0 && h.actions.length > 0 ? (n(), s("div", {
392
+ key: 0,
393
+ ref_key: "contextmenu",
394
+ ref: l,
395
+ class: "contextmenu"
396
+ }, [
397
+ V("a", {
398
+ class: "contextmenu__trigger",
399
+ onClick: d[0] || (d[0] = (p) => i.value = !0)
400
+ }, [
401
+ A(h.$slots, "default", {}, void 0, !0)
402
+ ])
403
+ ], 512)) : y("", !0),
404
+ i.value ? (n(), $(Ge, {
405
+ key: 1,
406
+ to: "main"
407
+ }, [
408
+ Z((n(), $(Ae, {
409
+ modelValue: i.value,
410
+ "onUpdate:modelValue": d[4] || (d[4] = (p) => i.value = p),
411
+ fill: "",
412
+ class: "content"
413
+ }, {
414
+ default: v(() => [
415
+ V("div", _n, [
416
+ h.$slots.header ? (n(), s("div", mn, [
417
+ A(h.$slots, "header", {}, void 0, !0)
418
+ ])) : y("", !0),
419
+ Object.keys(h.$slots).filter((p) => !["default", "extra", "header"].includes(p)).length > 0 ? (n(), s("div", {
420
+ key: 1,
421
+ class: "content__section",
422
+ onClick: d[1] || (d[1] = (p) => i.value = !1)
423
+ }, [
424
+ (n(!0), s(J, null, U(Object.keys(h.$slots).filter((p) => !["default", "extra", "header"].includes(p)), (p, b) => (n(), $(fe, {
425
+ key: `slot-${b}`,
426
+ class: "content__item content__item--reactive"
427
+ }, {
428
+ default: v(() => [
429
+ A(h.$slots, p, {}, void 0, !0)
430
+ ]),
431
+ _: 2
432
+ }, 1024))), 128))
433
+ ])) : y("", !0),
434
+ h.actions !== void 0 && h.actions.length > 0 ? (n(), s("div", {
435
+ key: 2,
436
+ class: "content__section",
437
+ onClick: d[2] || (d[2] = (p) => i.value = !1)
438
+ }, [
439
+ (n(!0), s(J, null, U(u(h.actions), (p, b) => (n(), $(fe, {
440
+ key: `action-${b}`,
441
+ class: "content__item content__item--reactive",
442
+ onClick: (S) => _(p, h.subject)
443
+ }, {
444
+ default: v(() => [
445
+ p.icon ? (n(), $(K, {
446
+ key: 0,
447
+ icon: p.icon
448
+ }, {
449
+ default: v(() => [
450
+ D(k(p.translate ? e(F)(p.label, { capitalize: !0 }) : p.label), 1)
451
+ ]),
452
+ _: 2
453
+ }, 1032, ["icon"])) : y("", !0)
454
+ ]),
455
+ _: 2
456
+ }, 1032, ["onClick"]))), 128))
457
+ ])) : y("", !0),
458
+ h.$slots.extra ? (n(), s("div", {
459
+ key: 3,
460
+ class: "content__section",
461
+ onClick: d[3] || (d[3] = (p) => i.value = !1)
462
+ }, [
463
+ V("div", fn, [
464
+ h.$slots.extra ? A(h.$slots, "extra", { key: 0 }, void 0, !0) : y("", !0)
465
+ ])
466
+ ])) : y("", !0)
467
+ ])
468
+ ]),
469
+ _: 3
470
+ }, 8, ["modelValue"])), [
471
+ [
472
+ a,
473
+ {
474
+ layer: h.overlayLayer,
475
+ click: () => {
476
+ i.value = !1;
477
+ }
478
+ },
479
+ void 0,
480
+ { invisibleOnLarge: !0 }
481
+ ]
482
+ ])
483
+ ])) : y("", !0)
484
+ ], 64);
485
+ };
486
+ }
487
+ });
488
+ const Ce = /* @__PURE__ */ G(vn, [["__scopeId", "data-v-0b83b591"]]), yn = { class: "info__content" }, hn = /* @__PURE__ */ q({
489
+ __name: "aeria-info",
490
+ props: {
491
+ where: {}
492
+ },
493
+ setup(c) {
494
+ const r = c, t = je(), o = X(!1), l = r.where || "top";
495
+ return (i, u) => e(t).md ? (n(), s("div", {
496
+ key: 0,
497
+ class: "info",
498
+ onMouseleave: u[1] || (u[1] = (_) => o.value = !1)
499
+ }, [
500
+ o.value ? (n(), s("div", {
501
+ key: 0,
502
+ class: Q(`
503
+ info__bubble
504
+ info__bubble--${e(l)}
505
+ `)
506
+ }, [
507
+ V("div", yn, [
508
+ A(i.$slots, "text", {}, void 0, !0)
509
+ ])
510
+ ], 2)) : y("", !0),
511
+ V("div", {
512
+ onMouseover: u[0] || (u[0] = (_) => o.value = !0)
513
+ }, [
514
+ A(i.$slots, "default", {}, void 0, !0)
515
+ ], 32)
516
+ ], 32)) : A(i.$slots, "default", { key: 1 }, void 0, !0);
517
+ }
518
+ });
519
+ const $n = /* @__PURE__ */ G(hn, [["__scopeId", "data-v-76defa0b"]]), bn = { class: "input" }, gn = {
520
+ key: 0,
521
+ class: "input__label"
522
+ }, kn = {
523
+ key: 1,
524
+ class: "input__hint"
525
+ }, Vn = ["placeholder", "readonly", "value"], Cn = ["value"], In = {
526
+ key: 1,
527
+ class: "input__clipboard"
528
+ }, An = /* @__PURE__ */ q({
529
+ __name: "aeria-input",
530
+ props: {
531
+ modelValue: {},
532
+ property: {},
533
+ propertyName: {},
534
+ parentPropertyName: {},
535
+ parentCollection: {},
536
+ variant: {}
537
+ },
538
+ emits: ["update:modelValue", "input", "change"],
539
+ setup(c, { emit: r }) {
540
+ var O;
541
+ const t = c, o = t.property || {}, l = "icon" in o || "inputType" in o && o.inputType === "search", i = ve("searchOnly", !1), u = ve("innerInputLabel", !1), _ = !i && o.readOnly, m = Tt(), h = r, d = ve("inputVariant", t.variant) || "normal", a = {
542
+ name: t.propertyName,
543
+ readonly: _,
544
+ type: (() => {
545
+ if ("type" in o)
546
+ switch (o.type) {
547
+ case "number":
548
+ case "integer":
549
+ return "number";
550
+ }
551
+ if (o.inputType)
552
+ return o.inputType;
553
+ switch (typeof t.modelValue) {
554
+ case "string":
555
+ return "text";
556
+ case "number":
557
+ return "number";
558
+ default:
559
+ return "text";
560
+ }
561
+ })(),
562
+ placeholder: u ? o.description || t.propertyName : o.placeholder
563
+ };
564
+ "type" in o && ((o.type === "number" || o.type === "integer") && (o.minimum && (a.min = o.minimum), o.exclusiveMinimum && (a.min = o.exclusiveMinimum + 1), o.maximum && (a.max = o.maximum), o.exclusiveMaximum && (a.max = o.exclusiveMaximum - 1)), o.type === "string" && ((o.format === "date" || o.format === "date-time") && (a.type = !i && o.format === "date-time" ? "datetime-local" : "date"), a.minlength = o.minLength, a.maxlength = o.maxLength)), a.type === "text" && i && (a.type = "search");
565
+ const p = () => {
566
+ try {
567
+ return t.modelValue ? new Date(t.modelValue).toISOString().split("T").shift() : "";
568
+ } catch {
569
+ return "";
570
+ }
571
+ }, b = X([
572
+ "date",
573
+ "date-time"
574
+ ].includes(a.type) ? p() : t.modelValue === null || t.modelValue === void 0 ? "" : t.modelValue), S = ((O = t.property) == null ? void 0 : O.type) === "string" && t.property.mask ? Lt(t.property.mask) : null, R = (M) => {
575
+ var W;
576
+ return typeof b.value == "string" && ((W = t.property) == null ? void 0 : W.type) === "string" && S !== null ? (b.value = S.enmask(S.unmask(b.value)), t.property.maskedValue === !0 ? b.value : S.unmask(b.value)) : M;
577
+ }, Y = (M) => {
578
+ const W = (() => {
579
+ if (!M || typeof M != "string")
580
+ return M;
581
+ if (a.type === "number" || a.type === "integer")
582
+ return Number(M);
583
+ if (!("type" in o && o.type === "string"))
584
+ return R(M);
585
+ switch (o.format) {
586
+ case "date":
587
+ case "date-time":
588
+ return new Date(M);
589
+ default:
590
+ return R(M);
591
+ }
592
+ })();
593
+ h("input", W), h("update:modelValue", W);
594
+ }, P = (M) => {
595
+ const W = M.target.value;
596
+ b.value = W, Y(W);
597
+ };
598
+ return re(() => t.modelValue, (M, W) => {
599
+ M instanceof Date || (W && !M ? b.value = void 0 : b.value = String(M));
600
+ }), (M, W) => {
601
+ const w = ne("focus"), ee = ne("clickable");
602
+ return n(), s("label", bn, [
603
+ e(u) ? y("", !0) : (n(), s("div", gn, [
604
+ M.$slots.default ? A(M.$slots, "default", { key: 0 }, void 0, !0) : A(M.$slots, "description", { key: 1 }, void 0, !0)
605
+ ])),
606
+ M.$slots.hint ? (n(), s("div", kn, [
607
+ A(M.$slots, "hint", {}, void 0, !0)
608
+ ])) : y("", !0),
609
+ "element" in e(o) && e(o).element === "textarea" ? (n(), s("div", {
610
+ key: 2,
611
+ class: Q(`
612
+ input__container
613
+ input__container--${e(d)}
614
+ `)
615
+ }, [
616
+ Z(V("textarea", {
617
+ placeholder: a.placeholder,
618
+ readonly: a.readonly,
619
+ value: M.modelValue,
620
+ class: Q(`
621
+ input__textarea
622
+ input__input--${e(d)}
623
+ `),
624
+ onInput: P
625
+ }, null, 42, Vn), [
626
+ [w, e(o).focus]
627
+ ])
628
+ ], 2)) : (n(), s("div", {
629
+ key: 3,
630
+ class: Q(`
631
+ input__container
632
+ input__container--${e(d)}
633
+ `)
634
+ }, [
635
+ Z(V("input", E(a, {
636
+ value: b.value,
637
+ "data-component": "input",
638
+ class: `
639
+ input__input
640
+ input__input--${e(d)}
641
+ ${e(l) && "input__input--icon"}
642
+ ${e(_) && "input__input--readOnly"}
643
+ `,
644
+ onInput: P,
645
+ onChange: W[0] || (W[0] = (C) => h("change", C))
646
+ }), null, 16, Cn), [
647
+ [w, e(o).focus]
648
+ ]),
649
+ e(l) ? (n(), $(K, {
650
+ key: 0,
651
+ icon: e(o).icon || "magnifying-glass",
652
+ class: Q(`
653
+ input__icon
654
+ input__icon--${e(d)}
655
+ `)
656
+ }, null, 8, ["icon", "class"])) : y("", !0),
657
+ e(_) ? (n(), s("div", In, [
658
+ z($n, null, {
659
+ text: v(() => [
660
+ D("Copiar")
661
+ ]),
662
+ default: v(() => [
663
+ Z(z(K, {
664
+ icon: "clipboard",
665
+ onClick: W[1] || (W[1] = (C) => e(m)(String(M.modelValue || "")))
666
+ }, null, 512), [
667
+ [ee]
668
+ ])
669
+ ]),
670
+ _: 1
671
+ })
672
+ ])) : y("", !0)
673
+ ], 2))
674
+ ]);
675
+ };
676
+ }
677
+ });
678
+ const Ie = /* @__PURE__ */ G(An, [["__scopeId", "data-v-470ff8e4"]]), On = ["value"], wn = {
679
+ key: 1,
680
+ value: ""
681
+ }, Bn = ["value", "data-selected"], Sn = /* @__PURE__ */ q({
682
+ __name: "aeria-select",
683
+ props: {
684
+ modelValue: {},
685
+ property: {},
686
+ propertyName: {},
687
+ parentPropertyName: {},
688
+ parentCollection: {},
689
+ booleanRef: { type: Boolean },
690
+ multiple: { type: [Boolean, Number] },
691
+ noOutline: { type: Boolean }
692
+ },
693
+ emits: ["update:modelValue", "change"],
694
+ setup(c, { emit: r }) {
695
+ const t = c, o = r, l = X(null), i = t.property || {}, u = (d) => {
696
+ t.booleanRef && (_.value = d), o("update:modelValue", (d == null ? void 0 : d._id) || d), o("change", (d == null ? void 0 : d._id) || d);
697
+ }, _ = t.booleanRef ? (() => {
698
+ const d = X(t.modelValue);
699
+ return H({
700
+ get: () => d.value === "true" ? !0 : d.value === "false" ? !1 : null,
701
+ set: (p) => {
702
+ d.value = p;
703
+ }
704
+ });
705
+ })() : H({
706
+ get: () => t.modelValue,
707
+ set: u
708
+ }), m = (d) => Array.isArray(t.modelValue) ? t.modelValue.includes(d) : t.modelValue === d, h = H(() => t.multiple ? typeof t.multiple == "number" ? t.multiple : 5 : 1);
709
+ return t.multiple && re(() => t.modelValue, (d) => {
710
+ var p;
711
+ if (!l.value)
712
+ return;
713
+ const a = l.value.querySelector('option[data-selected="true"]');
714
+ a && a.removeAttribute("data-selected"), (p = l.value.querySelector(`option[value="${d}"]`)) == null || p.setAttribute("data-selected", "true");
715
+ }), (d, a) => (n(), s("div", {
716
+ class: Q({
717
+ select: !0,
718
+ "select--outline": !d.noOutline
719
+ })
720
+ }, [
721
+ V("select", E({
722
+ ref_key: "select",
723
+ ref: l,
724
+ value: e(_)
725
+ }, {
726
+ size: h.value
727
+ }, {
728
+ class: {
729
+ select__select: !0,
730
+ "select__select--multiple": !!t.multiple
731
+ },
732
+ onChange: a[0] || (a[0] = (p) => u(p.target.value))
733
+ }), [
734
+ e(i).icon ? (n(), $(K, {
735
+ key: 0,
736
+ icon: e(i).icon
737
+ }, null, 8, ["icon"])) : y("", !0),
738
+ t.multiple ? y("", !0) : (n(), s("option", wn, k(e(F)("none")), 1)),
739
+ (n(!0), s(J, null, U("enum" in e(i) ? e(i).enum : [], (p) => (n(), s("option", {
740
+ key: p,
741
+ value: p,
742
+ "data-selected": m(p)
743
+ }, k(e(i).translate ? e(F)(p) : p), 9, Bn))), 128)),
744
+ A(d.$slots, "default", {}, void 0, !0)
745
+ ], 16, On)
746
+ ], 2));
747
+ }
748
+ });
749
+ const Ee = /* @__PURE__ */ G(Sn, [["__scopeId", "data-v-7a33443b"]]), jn = { class: "pagination" }, Tn = ["value"], Ln = { class: "pagination__control" }, Rn = { class: "pagination__page-input" }, zn = /* @__PURE__ */ q({
750
+ __name: "aeria-pagination",
751
+ props: {
752
+ pagination: {}
753
+ },
754
+ emits: ["paginate"],
755
+ setup(c, { emit: r }) {
756
+ const t = c, o = r, l = H({
757
+ get: () => Math.floor(t.pagination.offset / t.pagination.limit),
758
+ set: (h) => {
759
+ t.pagination.offset = h * t.pagination.limit;
760
+ }
761
+ }), i = H({
762
+ get: () => t.pagination.limit,
763
+ set: (h) => {
764
+ t.pagination.limit = Number(h);
765
+ }
766
+ }), u = X(l.value ? l.value + 1 : 1), _ = H(() => Math.ceil(t.pagination.recordsTotal / t.pagination.limit)), m = (h) => {
767
+ l.value = h === "previous" ? l.value - 1 : l.value + 1;
768
+ };
769
+ return re([
770
+ l,
771
+ i
772
+ ], ([h]) => {
773
+ u.value = h + 1, o("paginate", {
774
+ offset: l.value * i.value,
775
+ limit: i.value
776
+ });
777
+ }), (h, d) => (n(), s("div", jn, [
778
+ z(Ee, {
779
+ modelValue: i.value,
780
+ "onUpdate:modelValue": d[0] || (d[0] = (a) => i.value = a),
781
+ property: {
782
+ enum: [],
783
+ icon: "list"
784
+ },
785
+ class: "pagination__control"
786
+ }, {
787
+ default: v(() => [
788
+ (n(!0), s(J, null, U(e(Rt), (a) => (n(), s("option", {
789
+ key: `limit-${a}`,
790
+ value: a
791
+ }, k(a), 9, Tn))), 128))
792
+ ]),
793
+ _: 1
794
+ }, 8, ["modelValue"]),
795
+ V("div", Ln, [
796
+ z(fe, {
797
+ onClick: d[1] || (d[1] = (a) => l.value = 0)
798
+ }, {
799
+ default: v(() => [
800
+ z(K, {
801
+ reactive: "",
802
+ icon: "caret-double-left"
803
+ })
804
+ ]),
805
+ _: 1
806
+ }),
807
+ z(fe, {
808
+ disabled: l.value === 0,
809
+ onClick: d[2] || (d[2] = (a) => m("previous"))
810
+ }, {
811
+ default: v(() => [
812
+ z(K, {
813
+ reactive: "",
814
+ icon: "caret-left"
815
+ })
816
+ ]),
817
+ _: 1
818
+ }, 8, ["disabled"]),
819
+ V("div", Rn, [
820
+ (n(), $(Ie, {
821
+ key: l.value,
822
+ modelValue: u.value,
823
+ "onUpdate:modelValue": d[3] || (d[3] = (a) => u.value = a),
824
+ property: {
825
+ type: "number",
826
+ minimum: 1
827
+ },
828
+ onChange: d[4] || (d[4] = (a) => {
829
+ l.value = u.value === 0 ? 0 : u.value - 1;
830
+ })
831
+ }, null, 8, ["modelValue"])),
832
+ V("span", null, k(e(F)("of")) + " " + k(_.value), 1)
833
+ ]),
834
+ z(fe, {
835
+ disabled: l.value === _.value - 1,
836
+ onClick: d[5] || (d[5] = (a) => m("next"))
837
+ }, {
838
+ default: v(() => [
839
+ z(K, {
840
+ reactive: "",
841
+ icon: "caret-right"
842
+ })
843
+ ]),
844
+ _: 1
845
+ }, 8, ["disabled"]),
846
+ z(fe, {
847
+ onClick: d[6] || (d[6] = (a) => l.value = _.value - 1)
848
+ }, {
849
+ default: v(() => [
850
+ z(K, {
851
+ reactive: "",
852
+ icon: "caret-double-right"
853
+ })
854
+ ]),
855
+ _: 1
856
+ })
857
+ ])
858
+ ]));
859
+ }
860
+ });
861
+ const Mn = /* @__PURE__ */ G(zn, [["__scopeId", "data-v-41aa1ffc"]]), Fn = { class: "checkbox__text" }, qn = ["innerHTML"], Un = { class: "checkbox__hint" }, En = ["innerHTML"], Hn = {
862
+ inheritAttrs: !1
863
+ }, Dn = /* @__PURE__ */ q({
864
+ ...Hn,
865
+ __name: "aeria-checkbox",
866
+ props: {
867
+ modelValue: {},
868
+ property: {},
869
+ propertyName: {},
870
+ parentPropertyName: {},
871
+ parentCollection: {},
872
+ value: {},
873
+ variant: {}
874
+ },
875
+ emits: ["update:modelValue", "change"],
876
+ setup(c, { emit: r }) {
877
+ const t = c, o = t.property || {}, l = !("enum" in o) && [
878
+ "array",
879
+ "boolean"
880
+ ].includes(o.type) ? "checkbox" : "radio", i = r, u = t.value || !1, _ = H({
881
+ get: () => {
882
+ var m;
883
+ return "type" in o && o.type === "boolean" ? !!t.value : "items" in o ? (m = t.modelValue) == null ? void 0 : m.includes(t.value) : t.modelValue === t.value;
884
+ },
885
+ set: () => {
886
+ var m;
887
+ if (!o.readOnly) {
888
+ if ("type" in o && o.type === "boolean") {
889
+ i("update:modelValue", !t.modelValue);
890
+ return;
891
+ }
892
+ if ("items" in o) {
893
+ i("update:modelValue", (m = t.modelValue) != null && m.includes(u) ? t.modelValue.filter((h) => h !== u) : [
894
+ ...t.modelValue || [],
895
+ u
896
+ ]);
897
+ return;
898
+ }
899
+ i("update:modelValue", t.value);
900
+ }
901
+ }
902
+ });
903
+ return (m, h) => {
904
+ const d = ne("clickable");
905
+ return Z((n(), s("label", {
906
+ class: Q(`
907
+ checkbox
908
+ ${e(o).readOnly && "checkbox--readOnly"}
909
+ `)
910
+ }, [
911
+ Z(V("input", E({
912
+ "onUpdate:modelValue": h[0] || (h[0] = (a) => _.value = a)
913
+ }, {
914
+ type: e(l),
915
+ readOnly: e(o).readOnly,
916
+ checked: _.value
917
+ }, { class: "checkbox__input" }), null, 16), [
918
+ [Vt, _.value]
919
+ ]),
920
+ V("div", Fn, [
921
+ V("div", null, [
922
+ m.$slots.description ? A(m.$slots, "description", { key: 0 }, void 0, !0) : e(u) ? (n(), s("div", {
923
+ key: 1,
924
+ innerHTML: e(o).translate ? e(F)(e(u)) : e(u)
925
+ }, null, 8, qn)) : A(m.$slots, "default", { key: 2 }, void 0, !0)
926
+ ]),
927
+ V("div", Un, [
928
+ m.$slots.hint ? A(m.$slots, "hint", { key: 0 }, void 0, !0) : e(o).hint ? (n(), s("div", {
929
+ key: 1,
930
+ innerHTML: e(o).hint
931
+ }, null, 8, En)) : y("", !0)
932
+ ])
933
+ ])
934
+ ], 2)), [
935
+ [d]
936
+ ]);
937
+ };
938
+ }
939
+ });
940
+ const Qn = /* @__PURE__ */ G(Dn, [["__scopeId", "data-v-256eb557"]]), Gn = {
941
+ inheritAttrs: !1
942
+ }, Wn = /* @__PURE__ */ q({
943
+ ...Gn,
944
+ __name: "aeria-options",
945
+ props: {
946
+ modelValue: {},
947
+ propertyName: {},
948
+ parentPropertyName: {},
949
+ parentCollection: {},
950
+ property: {},
951
+ columns: { default: 1 }
952
+ },
953
+ emits: ["update:modelValue"],
954
+ setup(c, { emit: r }) {
955
+ const t = c, o = r, l = "items" in t.property ? t.property.items.enum : t.property.enum, i = (u) => {
956
+ o("update:modelValue", u);
957
+ };
958
+ return mt(() => {
959
+ t.modelValue || o(
960
+ "update:modelValue",
961
+ "items" in t.property ? [] : ""
962
+ );
963
+ }), (u, _) => (n(), s("div", {
964
+ class: "options",
965
+ style: $e(`
966
+ --columns: ${u.columns};
967
+ grid-template-columns: repeat(var(--columns), 1fr);
968
+ `)
969
+ }, [
970
+ (n(!0), s(J, null, U(e(l), (m) => (n(), s("div", {
971
+ key: `option-${m}`,
972
+ class: "options__checkbox"
973
+ }, [
974
+ z(Qn, E({ ref_for: !0 }, {
975
+ value: m,
976
+ property: u.property
977
+ }, {
978
+ "model-value": u.modelValue,
979
+ "onUpdate:modelValue": i
980
+ }), null, 16, ["model-value"])
981
+ ]))), 128))
982
+ ], 4));
983
+ }
984
+ });
985
+ const Xn = /* @__PURE__ */ G(Wn, [["__scopeId", "data-v-43cda372"]]), Yn = (c) => (Fe("data-v-30f5a5ca"), c = c(), qe(), c), Jn = { class: "switch-wrapper" }, Kn = /* @__PURE__ */ Yn(() => /* @__PURE__ */ V("div", { class: "switch__slider" }, null, -1)), Zn = { key: 1 }, Pn = {
986
+ inheritAttrs: !1
987
+ }, Nn = /* @__PURE__ */ q({
988
+ ...Pn,
989
+ __name: "aeria-switch",
990
+ props: {
991
+ modelValue: {},
992
+ property: {},
993
+ propertyName: {},
994
+ parentPropertyName: {},
995
+ parentCollection: {}
996
+ },
997
+ emits: ["update:modelValue", "change"],
998
+ setup(c, { emit: r }) {
999
+ const t = c, o = r, l = t.property || {}, i = () => {
1000
+ l.readOnly || (o("change", !t.modelValue), o("update:modelValue", !t.modelValue));
1001
+ };
1002
+ return (u, _) => {
1003
+ const m = ne("clickable");
1004
+ return n(), s("div", Jn, [
1005
+ Z((n(), s("a", {
1006
+ class: Q(`
1007
+ switch
1008
+ ${u.modelValue && "switch--active"}
1009
+ ${e(l).readOnly && "switch--readOnly"}
1010
+ `),
1011
+ onClick: ze(i, ["stop"])
1012
+ }, [
1013
+ Kn,
1014
+ V("div", {
1015
+ class: Q(`
1016
+ switch__dummy
1017
+ ${!u.modelValue && "switch__dummy--flex"}
1018
+ `)
1019
+ }, null, 2)
1020
+ ], 2)), [
1021
+ [m, {
1022
+ blocked: e(l).readOnly
1023
+ }]
1024
+ ]),
1025
+ u.$slots.default ? A(u.$slots, "default", { key: 0 }, void 0, !0) : (n(), s("div", Zn, k(e(l).description || u.propertyName), 1))
1026
+ ]);
1027
+ };
1028
+ }
1029
+ });
1030
+ const xn = /* @__PURE__ */ G(Nn, [["__scopeId", "data-v-30f5a5ca"]]), bt = (c) => (Fe("data-v-153a2e0f"), c = c(), qe(), c), eo = { class: "picture" }, to = {
1031
+ key: 0,
1032
+ style: { position: "fixed", top: "50%", left: "50%", transform: "translate(-50%, -50%)" }
1033
+ }, no = ["src", "alt"], oo = {
1034
+ key: 0,
1035
+ class: "picture__meta"
1036
+ }, ao = ["src"], lo = /* @__PURE__ */ bt(() => /* @__PURE__ */ V("line", {
1037
+ x1: "0",
1038
+ y1: "0",
1039
+ x2: "200",
1040
+ y2: "200",
1041
+ stroke: "#000",
1042
+ "vector-effect": "non-scaling-stroke"
1043
+ }, null, -1)), so = /* @__PURE__ */ bt(() => /* @__PURE__ */ V("line", {
1044
+ x1: "200",
1045
+ y1: "0",
1046
+ x2: "0",
1047
+ y2: "200",
1048
+ stroke: "#000",
1049
+ "vector-effect": "non-scaling-stroke"
1050
+ }, null, -1)), io = [
1051
+ lo,
1052
+ so
1053
+ ], ro = { key: 5 }, uo = /* @__PURE__ */ q({
1054
+ __name: "aeria-picture",
1055
+ props: {
1056
+ url: {},
1057
+ alt: {},
1058
+ fileId: {},
1059
+ modelValue: {},
1060
+ objectFit: {},
1061
+ bordered: { type: Boolean },
1062
+ width: {},
1063
+ height: {},
1064
+ expandable: { type: Boolean },
1065
+ meta: {}
1066
+ },
1067
+ setup(c) {
1068
+ const r = c, t = H(() => r.fileId ? `${vt}/file/${r.fileId}/picture` : r.url || r.modelValue), o = X(!1);
1069
+ return (l, i) => {
1070
+ var _;
1071
+ const u = ne("overlay");
1072
+ return n(), s("figure", eo, [
1073
+ t.value ? (n(), $(Ge, {
1074
+ key: 0,
1075
+ to: "main"
1076
+ }, [
1077
+ o.value ? Z((n(), s("div", to, [
1078
+ V("img", {
1079
+ src: t.value,
1080
+ alt: l.alt,
1081
+ style: `
1082
+ max-height: 60vh;
1083
+ object-fit: contain;
1084
+ `,
1085
+ onClick: i[0] || (i[0] = (m) => o.value = !0)
1086
+ }, null, 8, no),
1087
+ (_ = l.meta) != null && _.owner ? (n(), s("div", oo, " Criado por " + k(l.meta.owner.name) + " em " + k(l.formatDateTime(l.meta.created_at, { hours: !0 })), 1)) : y("", !0)
1088
+ ])), [
1089
+ [u, {
1090
+ click: () => {
1091
+ o.value = !1;
1092
+ }
1093
+ }]
1094
+ ]) : y("", !0)
1095
+ ])) : y("", !0),
1096
+ t.value ? (n(), s("img", {
1097
+ key: 1,
1098
+ src: t.value,
1099
+ class: Q(`
1100
+ picture__image
1101
+ ${l.bordered && "picture__image--bordered"}
1102
+ ${l.expandable && "picture__image--expandable"}
1103
+ `),
1104
+ style: $e(`
1105
+ object-fit: ${l.objectFit || "cover"};
1106
+ width: ${l.width || "100%"};
1107
+ height: ${l.height || "100%"};
1108
+ `),
1109
+ onClick: i[1] || (i[1] = () => {
1110
+ l.expandable && (o.value = !0);
1111
+ })
1112
+ }, null, 14, ao)) : l.$slots.fallback ? A(l.$slots, "fallback", { key: 2 }, void 0, !0) : l.$slots.default ? A(l.$slots, "default", { key: 3 }, void 0, !0) : (n(), s("svg", {
1113
+ key: 4,
1114
+ class: Q(["picture__background", `
1115
+ ${l.bordered && "picture__image--bordered"}
1116
+ `]),
1117
+ xmlns: "http://www.w3.org/2000/svg",
1118
+ viewBox: "0 0 200 200",
1119
+ preserveAspectRatio: "none",
1120
+ style: $e(`
1121
+ object-fit: ${l.objectFit || "cover"};
1122
+ width: ${l.width || "100%"};
1123
+ height: ${l.height || "100%"};
1124
+ `)
1125
+ }, io, 6)),
1126
+ l.$slots.caption ? (n(), s("figcaption", ro, [
1127
+ A(l.$slots, "caption", {}, void 0, !0)
1128
+ ])) : y("", !0)
1129
+ ]);
1130
+ };
1131
+ }
1132
+ });
1133
+ const Me = /* @__PURE__ */ G(uo, [["__scopeId", "data-v-153a2e0f"]]), co = { class: "file" }, po = { key: 0 }, _o = ["href"], mo = { class: "file__actions" }, fo = ["accept"], vo = {
1134
+ key: 0,
1135
+ class: "file__buttons"
1136
+ }, yo = {
1137
+ key: 1,
1138
+ class: "file__buttons"
1139
+ }, ho = /* @__PURE__ */ q({
1140
+ __name: "aeria-file",
1141
+ props: {
1142
+ modelValue: {},
1143
+ property: {},
1144
+ propertyName: {},
1145
+ parentPropertyName: {},
1146
+ parentCollection: {},
1147
+ meta: {},
1148
+ content: {}
1149
+ },
1150
+ emits: ["update:content", "change", "update:modelValue"],
1151
+ setup(c, { emit: r }) {
1152
+ const t = c, o = r, i = Te() ? ge() : null, u = X(null), _ = H(() => {
1153
+ var b;
1154
+ return u.value ? URL.createObjectURL(u.value) : (b = t.modelValue) == null ? void 0 : b.link;
1155
+ }), m = H(() => {
1156
+ var b, S, R;
1157
+ return /^image\//.test((b = t.modelValue) == null ? void 0 : b.type) && !((S = u.value) != null && S.type) || /^image\//.test((R = u.value) == null ? void 0 : R.type);
1158
+ }), h = (b) => new Promise((S) => {
1159
+ const R = new FileReader();
1160
+ R.onload = () => S(R.result), R.readAsArrayBuffer(b);
1161
+ }), d = () => {
1162
+ u.value = null;
1163
+ }, a = async (b) => {
1164
+ u.value = b.target.files[0];
1165
+ const S = u.value, R = await h(S);
1166
+ if (i) {
1167
+ const { data: Y } = await zt(`${vt}/${i.$id}/upload?name=${S.name}`, R, {
1168
+ params: {
1169
+ method: "POST",
1170
+ headers: {
1171
+ "content-type": S.type || "application/octet-stream",
1172
+ "x-stream-request": "1"
1173
+ }
1174
+ }
1175
+ });
1176
+ if ($t(Y))
1177
+ return;
1178
+ o("update:modelValue", Y);
1179
+ } else
1180
+ o("update:modelValue", S);
1181
+ o("update:content", R), o("change", R);
1182
+ }, p = async () => {
1183
+ o("update:modelValue", null);
1184
+ };
1185
+ return (b, S) => {
1186
+ var R, Y, P, O, M, W;
1187
+ return n(), s("div", co, [
1188
+ u.value || (R = b.modelValue) != null && R._id ? (n(), s("div", po, [
1189
+ m.value ? (n(), $(Me, {
1190
+ key: 0,
1191
+ modelValue: _.value,
1192
+ "onUpdate:modelValue": S[0] || (S[0] = (w) => _.value = w),
1193
+ alt: "Image preview",
1194
+ class: Q(`
1195
+ file__image
1196
+ ${!e(i) || ((Y = b.modelValue) == null ? void 0 : Y._id) || "file__image--unsent"}
1197
+ `)
1198
+ }, null, 8, ["modelValue", "class"])) : y("", !0),
1199
+ (P = b.modelValue) != null && P._id ? (n(), s("a", {
1200
+ key: 1,
1201
+ href: b.modelValue.download_link
1202
+ }, k(b.modelValue.filename), 9, _o)) : y("", !0)
1203
+ ])) : y("", !0),
1204
+ V("div", mo, [
1205
+ V("input", {
1206
+ ref: "file",
1207
+ type: "file",
1208
+ accept: (M = (O = b.property) == null ? void 0 : O.accept) == null ? void 0 : M.join(","),
1209
+ onChange: a
1210
+ }, null, 40, fo),
1211
+ u.value ? (n(), s("div", vo, [
1212
+ z(ie, {
1213
+ small: "",
1214
+ onClick: ze(d, ["prevent"])
1215
+ }, {
1216
+ default: v(() => [
1217
+ D(k(e(F)("action.clear", { capitalize: !0 })), 1)
1218
+ ]),
1219
+ _: 1
1220
+ })
1221
+ ])) : (W = b.modelValue) != null && W._id ? (n(), s("div", yo, [
1222
+ z(ie, {
1223
+ small: "",
1224
+ onClick: ze(p, ["prevent"])
1225
+ }, {
1226
+ default: v(() => [
1227
+ D(k(e(F)("action.remove", { capitalize: !0 })), 1)
1228
+ ]),
1229
+ _: 1
1230
+ })
1231
+ ])) : y("", !0)
1232
+ ])
1233
+ ]);
1234
+ };
1235
+ }
1236
+ });
1237
+ const $o = /* @__PURE__ */ G(ho, [["__scopeId", "data-v-5fa55625"]]), bo = { class: "container" }, go = {
1238
+ key: 1,
1239
+ class: "container__footer"
1240
+ }, ko = /* @__PURE__ */ q({
1241
+ __name: "aeria-search-container",
1242
+ props: {
1243
+ observeScroll: { type: Boolean }
1244
+ },
1245
+ emits: ["endReached"],
1246
+ setup(c, { emit: r }) {
1247
+ const t = c, o = r, l = X(null), i = t.observeScroll ? We(l, {
1248
+ antecipate: 100
1249
+ }).reachedEnd : null;
1250
+ return i !== null && re(i, (u) => {
1251
+ u && o("endReached", u);
1252
+ }), (u, _) => (n(), s("div", bo, [
1253
+ u.$slots.default ? (n(), s("div", {
1254
+ key: 0,
1255
+ ref_key: "containerEl",
1256
+ ref: l,
1257
+ class: "container__content"
1258
+ }, [
1259
+ A(u.$slots, "default", {}, void 0, !0)
1260
+ ], 512)) : y("", !0),
1261
+ u.$slots.footer ? (n(), s("div", go, [
1262
+ A(u.$slots, "footer", {}, void 0, !0)
1263
+ ])) : y("", !0)
1264
+ ]));
1265
+ }
1266
+ });
1267
+ const it = /* @__PURE__ */ G(ko, [["__scopeId", "data-v-c86e2d2a"]]), Vo = { class: "item__values" }, Co = /* @__PURE__ */ q({
1268
+ __name: "aeria-search-item",
1269
+ props: {
1270
+ item: {},
1271
+ indexes: {},
1272
+ modelValue: {},
1273
+ property: {}
1274
+ },
1275
+ emits: ["update:modelValue", "change"],
1276
+ setup(c, { emit: r }) {
1277
+ const t = c, o = r, l = t.property, i = pe(l), u = ge(), _ = H(() => Array.isArray(t.modelValue) ? Array.isArray(t.modelValue) && Object.values(t.modelValue).some(({ _id: d }) => t.item._id === d) : t.modelValue && t.modelValue._id === t.item._id), m = () => {
1278
+ if (_.value)
1279
+ return;
1280
+ const d = (p) => p.filter((b) => !!(b != null && b._id)), a = "items" in l ? d(Array.isArray(t.modelValue) ? t.modelValue : [t.modelValue]) : t.modelValue;
1281
+ o("update:modelValue", Array.isArray(a) ? [
1282
+ ...a,
1283
+ t.item
1284
+ ] : t.item), o("change", t.item);
1285
+ }, h = async (d) => {
1286
+ if (i.purge && (d != null && d.purge)) {
1287
+ const { _id: p } = t.item;
1288
+ await u.$actions.remove({
1289
+ filters: {
1290
+ _id: p
1291
+ }
1292
+ });
1293
+ }
1294
+ const a = () => {
1295
+ const p = [...t.modelValue], b = p.findIndex((S) => S._id === t.item._id);
1296
+ return p.splice(b, 1), p;
1297
+ };
1298
+ o("update:modelValue", "items" in l ? a() : null);
1299
+ };
1300
+ return (d, a) => {
1301
+ const p = ne("clickable");
1302
+ return Z((n(), s("div", {
1303
+ class: Q({
1304
+ item: !0,
1305
+ "item--selected": _.value
1306
+ }),
1307
+ onClick: a[0] || (a[0] = (b) => _.value ? h() : m())
1308
+ }, [
1309
+ A(d.$slots, "default", {}, void 0, !0),
1310
+ V("div", Vo, [
1311
+ (n(!0), s(J, null, U(d.indexes, (b, S) => (n(), s("div", {
1312
+ key: `index-${d.item._id}-${S}`,
1313
+ class: "item__value"
1314
+ }, k(d.item[b]), 1))), 128))
1315
+ ])
1316
+ ], 2)), [
1317
+ [p]
1318
+ ]);
1319
+ };
1320
+ }
1321
+ });
1322
+ const De = /* @__PURE__ */ G(Co, [["__scopeId", "data-v-fa7fea9f"]]), Io = { class: "search__panel" }, Ao = { class: "search__input" }, Oo = ["value"], wo = { style: { flex: "1" } }, Bo = { key: 1 }, So = { key: 0 }, jo = { key: 1 }, To = { class: "search__summary" }, Lo = {
1323
+ key: 1,
1324
+ class: "search"
1325
+ }, Ro = { key: 0 }, Re = 10, zo = /* @__PURE__ */ q({
1326
+ __name: "aeria-search",
1327
+ props: {
1328
+ modelValue: {},
1329
+ parentPropertyName: {},
1330
+ parentCollection: {},
1331
+ property: {},
1332
+ propertyName: {},
1333
+ selectOnly: { type: Boolean },
1334
+ panel: { default: void 0 }
1335
+ },
1336
+ emits: ["update:modelValue", "change", "update:panel"],
1337
+ setup(c, { emit: r }) {
1338
+ const t = c, o = pe(t.property), l = t.panel !== void 0 ? H(() => t.panel) : X(!1), i = r, u = ue(pe(t.property).$ref), _ = Te(), m = _ ? ge() : null, h = o.indexes;
1339
+ ye(Ue, pe(t.property).$ref), ye("innerInputLabel", !0), ye("omitInputLabels", !0);
1340
+ const d = X(t.modelValue), a = X({
1341
+ data: [],
1342
+ pagination: {}
1343
+ }), p = H(() => a.value.data), b = H(() => a.value.pagination), S = X(0), R = X(h[0]), Y = X(!1), P = X({}), O = () => {
1344
+ const g = {};
1345
+ if (_) {
1346
+ const j = e(_);
1347
+ g[j] = m;
1348
+ }
1349
+ return o.constraints ? Ht(o.constraints, g) : {};
1350
+ }, M = () => {
1351
+ p.value.length < b.value.recordsTotal && (S.value += 1, w());
1352
+ }, W = async () => Object.values(P.value).every((g) => !(String(g).length > 0)) ? u.$actions.custom("getAll", {
1353
+ limit: Re,
1354
+ offset: S.value * Re,
1355
+ filters: O()
1356
+ }) : u.$actions.custom("getAll", {
1357
+ limit: Re,
1358
+ offset: S.value * Re,
1359
+ filters: {
1360
+ ...O(),
1361
+ $or: h.filter((g) => {
1362
+ var j;
1363
+ return ((j = P.value[g]) == null ? void 0 : j.length) > 0;
1364
+ }).map((g) => ({
1365
+ [g]: {
1366
+ $regex: P.value[g].trim().replace("(", "\\(").replace(")", "\\)"),
1367
+ $options: "i"
1368
+ }
1369
+ }))
1370
+ }
1371
+ }), w = async () => {
1372
+ if (u.loading.getAll)
1373
+ return;
1374
+ const g = await W();
1375
+ a.value.pagination = g.pagination, S.value === 0 && a.value.data.splice(0), a.value.data.push(...g.data);
1376
+ }, [ee] = yt({
1377
+ delay: 800
1378
+ })(() => {
1379
+ S.value = 0, w(), Y.value = !1;
1380
+ }), C = () => {
1381
+ Y.value = !0, ee();
1382
+ }, L = () => {
1383
+ "effect" in l ? i("update:panel", !0) : l.value = !0, w();
1384
+ }, te = () => {
1385
+ S.value = 0, a.value.data.splice(0), "effect" in l ? i("update:panel", !1) : l.value = !1;
1386
+ }, oe = H(() => !Object.values(P.value).some((g) => !!g));
1387
+ re(oe, (g, j) => {
1388
+ g && !j && w();
1389
+ }), Ct(() => {
1390
+ t.selectOnly && w();
1391
+ });
1392
+ const le = (g) => {
1393
+ d.value = g, t.selectOnly || i("update:modelValue", g);
1394
+ }, f = () => {
1395
+ te(), i("update:modelValue", d.value);
1396
+ };
1397
+ return (g, j) => {
1398
+ const N = ne("clickable");
1399
+ return n(), s("div", null, [
1400
+ e(l) ? (n(), $(Ge, {
1401
+ key: 0,
1402
+ to: "main"
1403
+ }, [
1404
+ z(Ae, {
1405
+ float: "",
1406
+ "close-hint": "",
1407
+ title: `${e(F)("action.select", { capitalize: !0 })} ${e(F)(g.propertyName)}`,
1408
+ "overlay-layer": 65,
1409
+ "model-value": e(l),
1410
+ style: { "--panel-max-width": "36rem" },
1411
+ onClose: te,
1412
+ onOverlayClick: te
1413
+ }, {
1414
+ footer: v(() => [
1415
+ z(ie, {
1416
+ large: "",
1417
+ onClick: f
1418
+ }, {
1419
+ default: v(() => [
1420
+ D(k(e(F)("action.save", { capitalize: !0 })), 1)
1421
+ ]),
1422
+ _: 1
1423
+ })
1424
+ ]),
1425
+ default: v(() => {
1426
+ var I, T;
1427
+ return [
1428
+ V("div", Io, [
1429
+ V("div", Ao, [
1430
+ e(h).length > 1 ? (n(), $(Ee, {
1431
+ key: 0,
1432
+ modelValue: R.value,
1433
+ "onUpdate:modelValue": j[0] || (j[0] = (B) => R.value = B),
1434
+ onChange: j[1] || (j[1] = (B) => P.value = {})
1435
+ }, {
1436
+ default: v(() => [
1437
+ (n(!0), s(J, null, U(e(h), (B) => (n(), s("option", {
1438
+ key: `searchfield-${B}`,
1439
+ value: B
1440
+ }, k(e(F)(B)), 9, Oo))), 128))
1441
+ ]),
1442
+ _: 1
1443
+ }, 8, ["modelValue"])) : y("", !0),
1444
+ V("div", wo, [
1445
+ (n(), $(Ie, {
1446
+ key: `field-${R.value}`,
1447
+ modelValue: P.value[R.value],
1448
+ "onUpdate:modelValue": j[2] || (j[2] = (B) => P.value[R.value] = B),
1449
+ property: {
1450
+ ...e(u).properties[R.value],
1451
+ inputType: "search"
1452
+ },
1453
+ onInput: C
1454
+ }, null, 8, ["modelValue", "property"]))
1455
+ ])
1456
+ ]),
1457
+ p.value.length ? (n(), $(it, {
1458
+ key: 0,
1459
+ "observe-scroll": "",
1460
+ onEndReached: M
1461
+ }, {
1462
+ default: v(() => [
1463
+ (n(!0), s(J, null, U(p.value, (B) => (n(), $(De, E({ ref_for: !0 }, {
1464
+ item: B,
1465
+ indexes: e(h),
1466
+ property: g.property
1467
+ }, {
1468
+ key: `matching-${B._id}`,
1469
+ modelValue: d.value,
1470
+ "onUpdate:modelValue": j[3] || (j[3] = (ae) => d.value = ae)
1471
+ }), null, 16, ["modelValue"]))), 128))
1472
+ ]),
1473
+ _: 1
1474
+ })) : (n(), s("div", Bo, [
1475
+ Y.value ? (n(), s("div", So, k(e(F)("searching", { capitalize: !0 })) + "... ", 1)) : !e(u).loading.getAll && Object.values(P.value).filter((B) => !!B).length > 0 && !("items" in g.property && ((I = g.modelValue) != null && I.length) || !Array.isArray(g.modelValue) && ((T = g.modelValue) != null && T._id)) ? (n(), s("div", jo, k(e(F)("no_results", { capitalize: !0 })), 1)) : y("", !0)
1476
+ ]))
1477
+ ]),
1478
+ V("div", To, k(e(F)("showing", { capitalize: !0 })) + " " + k(p.value.length) + " " + k(e(F)("of")) + " " + k(b.value.recordsTotal), 1)
1479
+ ];
1480
+ }),
1481
+ _: 1
1482
+ }, 8, ["title", "model-value"])
1483
+ ])) : y("", !0),
1484
+ g.selectOnly ? y("", !0) : (n(), s("div", Lo, [
1485
+ z(it, null, {
1486
+ footer: v(() => [
1487
+ Z((n(), $(K, {
1488
+ icon: "plus",
1489
+ onClick: L
1490
+ }, {
1491
+ default: v(() => [
1492
+ D(k(e(F)("action.select", { capitalize: !0 })), 1)
1493
+ ]),
1494
+ _: 1
1495
+ })), [
1496
+ [N]
1497
+ ])
1498
+ ]),
1499
+ default: v(() => {
1500
+ var I;
1501
+ return [
1502
+ "items" in g.property ? (n(), s("div", Ro, [
1503
+ (n(!0), s(J, null, U(g.modelValue, (T) => (n(), $(De, E({ ref_for: !0 }, {
1504
+ item: T,
1505
+ indexes: e(h),
1506
+ property: g.property,
1507
+ modelValue: g.modelValue
1508
+ }, {
1509
+ key: `selected-${T._id}`,
1510
+ "onUpdate:modelValue": le
1511
+ }), null, 16))), 128))
1512
+ ])) : (I = g.modelValue) != null && I._id ? (n(), $(De, E({ key: 1 }, {
1513
+ item: g.modelValue,
1514
+ indexes: e(h),
1515
+ property: e(o),
1516
+ modelValue: g.modelValue
1517
+ }, { "onUpdate:modelValue": le }), null, 16)) : y("", !0)
1518
+ ];
1519
+ }),
1520
+ _: 1
1521
+ })
1522
+ ]))
1523
+ ]);
1524
+ };
1525
+ }
1526
+ });
1527
+ const Mo = /* @__PURE__ */ G(zo, [["__scopeId", "data-v-d9d768a1"]]), rt = (c, r) => {
1528
+ const t = "items" in c ? c.items : c, o = {
1529
+ options: Xn,
1530
+ select: Ee,
1531
+ switch: xn,
1532
+ file: $o,
1533
+ search: Mo,
1534
+ input: Ie,
1535
+ form: He
1536
+ }, l = (() => {
1537
+ if ("type" in t) {
1538
+ if (t.type === "object")
1539
+ return "form";
1540
+ if (t.type === "boolean")
1541
+ return "switch";
1542
+ }
1543
+ if ("element" in c) {
1544
+ if (c.element === "checkbox" || c.element === "radio")
1545
+ return "options";
1546
+ if (c.element === "select")
1547
+ return "select";
1548
+ }
1549
+ const i = pe(c);
1550
+ return i ? i.inline ? "form" : i.$ref === "file" ? "file" : "search" : "items" in c && c.uniqueItems ? "options" : "enum" in t ? "select" : "input";
1551
+ })();
1552
+ return r[l] ? r[l] : o[l];
1553
+ }, Fo = (c, r, t) => {
1554
+ c ?? (c = []);
1555
+ const o = "items" in r ? r.items : r;
1556
+ if ("$ref" in o) {
1557
+ const l = ue(o.$ref, t), i = Se(l.$freshItem);
1558
+ return c.unshift(i);
1559
+ }
1560
+ return "properties" in o ? c.unshift(Dt(o)) : "type" in o && o.type === "boolean" ? c.unshift({}) : c.unshift(null);
1561
+ }, qo = (c, r) => {
1562
+ c.splice(r, 1);
1563
+ }, Uo = {
1564
+ key: 0,
1565
+ class: "form__header"
1566
+ }, Eo = {
1567
+ key: 1,
1568
+ class: "form__fieldset"
1569
+ }, Ho = { key: 0 }, Do = ["innerHTML"], Qo = ["onInput"], Go = { key: 4 }, Wo = { value: "true" }, Xo = { value: "false" }, Yo = {
1570
+ key: 5,
1571
+ style: { display: "grid", "row-gap": ".4rem" }
1572
+ }, Jo = { style: { "flex-grow": "1" } }, Ko = {
1573
+ key: 7,
1574
+ class: "form__validation-error"
1575
+ }, Zo = { key: 0 }, Po = { key: 1 }, No = {
1576
+ key: 3,
1577
+ class: "form__footer"
1578
+ }, xo = /* @__PURE__ */ q({
1579
+ __name: "aeria-form",
1580
+ props: {
1581
+ modelValue: {},
1582
+ property: {},
1583
+ propertyName: {},
1584
+ parentPropertyName: {},
1585
+ parentCollection: {},
1586
+ form: {},
1587
+ collection: {},
1588
+ isReadOnly: { type: Boolean, default: !1 },
1589
+ searchOnly: { type: Boolean },
1590
+ layout: {},
1591
+ required: {},
1592
+ formComponents: {},
1593
+ propertyComponents: {},
1594
+ omitFormHeader: { type: Boolean },
1595
+ omitInputLabels: { type: Boolean },
1596
+ innerInputLabel: { type: Boolean },
1597
+ validationErrors: { default: null },
1598
+ highlightRequired: { type: Boolean, default: !0 },
1599
+ focus: { type: Boolean }
1600
+ },
1601
+ emits: ["update:modelValue", "input", "change"],
1602
+ setup(c, { emit: r }) {
1603
+ const t = ht(), o = c, l = r;
1604
+ mt(() => {
1605
+ o.modelValue || l("update:modelValue", o.property && "items" in o.property ? [] : {});
1606
+ });
1607
+ const i = o.property && pe(o.property), u = i ? i.$ref : o.collection || Te(), _ = u ? ue(e(u)) : null;
1608
+ !u && process.env.NODE_ENV !== "production" && console.warn(`aeria-form was used without providing storeId or specifying
1609
+ collection prop, some features may not work as intended`);
1610
+ const m = X(!1), h = H(() => !o.form && o.property ? "properties" in o.property ? o.property.properties : _ == null ? void 0 : _.properties : o.form), d = H(() => o.layout || (_ == null ? void 0 : _.description.formLayout)), a = (f) => {
1611
+ const g = ve(f, o[f]);
1612
+ return o[f] && ye(f, o[f]), g;
1613
+ }, p = H(() => o.validationErrors !== null ? o.validationErrors : _ == null ? void 0 : _.validationErrors), b = a("formComponents") || {}, S = a("propertyComponents") || {}, R = a("omitFormHeader"), Y = a("omitInputLabels"), P = a("innerInputLabel");
1614
+ u && ye(Ue, u), ye("searchOnly", o.searchOnly);
1615
+ const O = (f) => h.value ? Object.entries(h.value).filter(([g, j]) => !j.noForm && f([
1616
+ g,
1617
+ j
1618
+ ])) : null, M = (f) => {
1619
+ var j;
1620
+ if (o.searchOnly || !u)
1621
+ return !0;
1622
+ const g = o.property && "properties" in o.property ? o.property.form : (j = _ == null ? void 0 : _.description) == null ? void 0 : j.form;
1623
+ return !g || g.includes(f);
1624
+ }, W = O(([f]) => M(f)), w = je(), ee = {}, C = (f, g) => {
1625
+ var T, B, ae, _e;
1626
+ const j = [], N = ((B = (T = d.value) == null ? void 0 : T.fields) == null ? void 0 : B[f]) || ((_e = (ae = d.value) == null ? void 0 : ae.fields) == null ? void 0 : _e.$default);
1627
+ if (!g)
1628
+ return;
1629
+ if (N != null && N.if && !o.searchOnly) {
1630
+ const me = Qe(
1631
+ o.modelValue,
1632
+ N.if
1633
+ );
1634
+ me.satisfied || (ee[f] && (_ ? o.modelValue[f] = typeof _.$freshItem[f] == "object" ? Se(_.$freshItem[f]) : _.$freshItem[f] : o.modelValue[f] = [
1635
+ void 0,
1636
+ null
1637
+ ].includes(o.modelValue[f]) ? null : o.modelValue[f].constructor()), j.push("display: none;")), ee[f] = me.satisfied;
1638
+ }
1639
+ const I = w.value.md && (N == null ? void 0 : N.span) || 6;
1640
+ return j.push(`
1641
+ --field-span: ${I};
1642
+ grid-column: span var(--field-span) / span var(--field-span);
1643
+ `), N && (N.verticalSpacing && j.push(`
1644
+ --vertical-spacing: ${N.verticalSpacing};
1645
+ padding: var(--vertical-spacing) 0;
1646
+ `), N.separator && j.push(`
1647
+ border-top: 1px solid var(--theme-border-color);
1648
+ border-width: 1px 0 1px 0;
1649
+ padding: 1rem 0;
1650
+ margin: 1rem 0;
1651
+ `)), j.join("");
1652
+ }, L = (f) => f === null || f instanceof Object && !Object.keys(f).length, te = H(() => o.required ? o.required : o.property && "required" in o.property ? o.property.required : _ == null ? void 0 : _.description.required), oe = H(() => o.form ? Mt(
1653
+ o.modelValue,
1654
+ o.form,
1655
+ te.value,
1656
+ _ == null ? void 0 : _.description
1657
+ ) : !0), le = (f, g) => {
1658
+ var j;
1659
+ return (j = p.value) != null && j[f] && (typeof p.value[f].index != "number" || p.value[f].index === g) ? p.value[f].errors : null;
1660
+ };
1661
+ return (f, g) => {
1662
+ const j = ne("clickable"), N = ne("focus");
1663
+ return n(), s("form", {
1664
+ class: "form",
1665
+ style: $e(`row-gap: ${e(R) ? ".8rem" : "var(--form-internal-gap, 1.6rem);"};`)
1666
+ }, [
1667
+ f.$slots.header && !e(R) ? (n(), s("header", Uo, [
1668
+ A(f.$slots, "header", {}, void 0, !0)
1669
+ ])) : y("", !0),
1670
+ A(f.$slots, "default", {}, void 0, !0),
1671
+ f.isReadOnly ? y("", !0) : (n(), s("fieldset", Eo, [
1672
+ (n(!0), s(J, null, U(e(W), ([I, T]) => {
1673
+ var B, ae, _e, me, Xe, Ye, Je, Ke, Ze, Pe, Ne, xe, et;
1674
+ return n(), s("div", {
1675
+ key: `field-${I}`,
1676
+ style: $e(C(I, T)),
1677
+ class: "form__field"
1678
+ }, [
1679
+ (!("type" in T) || T.type !== "boolean" || f.searchOnly) && !T.noLabel && !e(Y) && !e(P) ? (n(), s("label", Ho, [
1680
+ V("div", {
1681
+ class: Q({
1682
+ "form__field-label": !0,
1683
+ "form__field-label--section": "items" in T ? "properties" in T.items : "properties" in T,
1684
+ "form__field-required-hint": f.highlightRequired && !f.searchOnly && (!te.value || e(Qt)(I, te.value, f.modelValue))
1685
+ })
1686
+ }, k(T.description || e(F)(I)), 3),
1687
+ T.hint ? (n(), s("div", {
1688
+ key: 0,
1689
+ innerHTML: T.hint
1690
+ }, null, 8, Do)) : y("", !0)
1691
+ ])) : y("", !0),
1692
+ f.$slots[`field-${I}`] ? A(f.$slots, `field-${I}`, E({
1693
+ key: 1,
1694
+ ref_for: !0
1695
+ }, {
1696
+ propery: T,
1697
+ properyName: I,
1698
+ modelValue: f.modelValue
1699
+ }), void 0, !0) : (_e = (ae = (B = f.layout) == null ? void 0 : B.fields) == null ? void 0 : ae[I]) != null && _e.component && e(S)[f.layout.fields[I].component.name] ? (n(), $(he(e(S)[f.layout.fields[I].component.name]), E({
1700
+ key: 2,
1701
+ modelValue: f.modelValue[I],
1702
+ "onUpdate:modelValue": (x) => f.modelValue[I] = x,
1703
+ ref_for: !0
1704
+ }, {
1705
+ property: T,
1706
+ propertyName: I,
1707
+ ...f.layout.fields[I].component.props || {}
1708
+ }, {
1709
+ onInput: (x) => l("input", I),
1710
+ onChange: g[0] || (g[0] = (x) => l("change", x))
1711
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "onInput"])) : "format" in T && ["date", "date-time"].includes(T.format) && f.searchOnly ? (n(), s("div", {
1712
+ key: 3,
1713
+ style: { display: "grid", "grid-template-columns": "repeat(2, 1fr)", "column-gap": "1rem" },
1714
+ onInput: (x) => l("input", I),
1715
+ onChange: g[1] || (g[1] = (x) => l("change", x))
1716
+ }, [
1717
+ z(Ie, E({
1718
+ modelValue: f.modelValue[I].$gte,
1719
+ "onUpdate:modelValue": (x) => f.modelValue[I].$gte = x,
1720
+ ref_for: !0
1721
+ }, {
1722
+ property: T,
1723
+ propertyName: I
1724
+ }), null, 16, ["modelValue", "onUpdate:modelValue"]),
1725
+ z(Ie, E({
1726
+ modelValue: f.modelValue[I].$lte,
1727
+ "onUpdate:modelValue": (x) => f.modelValue[I].$lte = x,
1728
+ ref_for: !0
1729
+ }, {
1730
+ property: T,
1731
+ propertyName: I
1732
+ }), null, 16, ["modelValue", "onUpdate:modelValue"])
1733
+ ], 40, Qo)) : "type" in T && T.type === "boolean" && f.searchOnly ? (n(), s("div", Go, [
1734
+ z(Ee, E({ ref_for: !0 }, {
1735
+ property: T,
1736
+ propertyName: I
1737
+ }, {
1738
+ "boolean-ref": "",
1739
+ "model-value": f.modelValue[I],
1740
+ onChange: g[2] || (g[2] = (x) => l("change", x)),
1741
+ "onUpdate:modelValue": (x) => {
1742
+ f.modelValue[I] = x == "true" ? !0 : x == "false" ? !1 : null;
1743
+ }
1744
+ }), {
1745
+ default: v(() => [
1746
+ V("option", Wo, k(e(F)("yes")), 1),
1747
+ V("option", Xo, k(e(F)("no")), 1)
1748
+ ]),
1749
+ _: 2
1750
+ }, 1040, ["model-value", "onUpdate:modelValue"])
1751
+ ])) : f.modelValue && "items" in T && !T.uniqueItems && (!("$ref" in T.items) || T.items.inline || T.items.$ref === "file") ? (n(), s("div", Yo, [
1752
+ V("div", null, [
1753
+ z(ie, {
1754
+ small: "",
1755
+ variant: "alt",
1756
+ icon: "plus",
1757
+ disabled: !("inline" in T.items && T.items.inline) && (((me = f.modelValue[I]) == null ? void 0 : me.length) >= T.maxItems || L((Ye = f.modelValue[I]) == null ? void 0 : Ye[((Xe = f.modelValue[I]) == null ? void 0 : Xe.length) - 1])),
1758
+ onClick: ze((x) => {
1759
+ f.modelValue[I] || (f.modelValue[I] = []), e(Fo)(f.modelValue[I], T, e(t));
1760
+ }, ["prevent"])
1761
+ }, {
1762
+ default: v(() => [
1763
+ D(k(e(F)("action.add", { capitalize: !0 })), 1)
1764
+ ]),
1765
+ _: 2
1766
+ }, 1032, ["disabled", "onClick"])
1767
+ ]),
1768
+ (n(!0), s(J, null, U(f.modelValue[I], (x, Oe) => {
1769
+ var tt, nt, ot, at, lt, st;
1770
+ return n(), s("div", {
1771
+ key: `rep-${I}-${Oe}`,
1772
+ style: { display: "flex", "column-gap": ".6rem", "align-items": "center" }
1773
+ }, [
1774
+ V("div", Jo, [
1775
+ (n(), $(he(e(rt)(T, e(b))), E({
1776
+ modelValue: f.modelValue[I][Oe],
1777
+ "onUpdate:modelValue": (we) => f.modelValue[I][Oe] = we,
1778
+ ref_for: !0
1779
+ }, {
1780
+ property: T.items,
1781
+ propertyName: I,
1782
+ parentCollection: e(u),
1783
+ parentPropertyName: f.parentPropertyName,
1784
+ columns: ((ot = (nt = (tt = f.layout) == null ? void 0 : tt.fields) == null ? void 0 : nt[I]) == null ? void 0 : ot.optionsColumns) || ((st = (lt = (at = f.layout) == null ? void 0 : at.fields) == null ? void 0 : lt.$default) == null ? void 0 : st.optionsColumns),
1785
+ validationErrors: le(I, Oe),
1786
+ ...T.componentProps || {}
1787
+ }, {
1788
+ onInput: (we) => l("input", I),
1789
+ onChange: g[3] || (g[3] = (we) => l("change", we))
1790
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "onInput"]))
1791
+ ]),
1792
+ Z(z(K, {
1793
+ reactive: "",
1794
+ icon: "trash",
1795
+ onClick: (we) => e(qo)(f.modelValue[I], Oe)
1796
+ }, null, 8, ["onClick"]), [
1797
+ [j]
1798
+ ])
1799
+ ]);
1800
+ }), 128))
1801
+ ])) : f.modelValue ? Z((n(), $(he(e(rt)(T, e(b))), E({
1802
+ key: 6,
1803
+ modelValue: f.modelValue[I],
1804
+ "onUpdate:modelValue": (x) => f.modelValue[I] = x,
1805
+ ref_for: !0
1806
+ }, {
1807
+ property: T,
1808
+ propertyName: I,
1809
+ parentPropertyName: f.parentPropertyName,
1810
+ parentCollection: e(u),
1811
+ columns: ((Ze = (Ke = (Je = f.layout) == null ? void 0 : Je.fields) == null ? void 0 : Ke[I]) == null ? void 0 : Ze.optionsColumns) || ((xe = (Ne = (Pe = f.layout) == null ? void 0 : Pe.fields) == null ? void 0 : Ne.$default) == null ? void 0 : xe.optionsColumns),
1812
+ ...T.componentProps || {},
1813
+ validationErrors: le(I)
1814
+ }, {
1815
+ onInput: (x) => l("input", I),
1816
+ onChange: g[4] || (g[4] = (x) => l("change", x))
1817
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "onInput"])), [
1818
+ [N, !m.value && (m.value = !!f.focus)]
1819
+ ]) : y("", !0),
1820
+ (et = p.value) != null && et[I] ? (n(), s("div", Ko, [
1821
+ p.value[I].type ? (n(), s("span", Zo, k(e(F)(`validation_error.${p.value[I].type}`)), 1)) : y("", !0),
1822
+ p.value[I].detail ? (n(), s("span", Po, k(e(F)(p.value[I].detail)), 1)) : y("", !0)
1823
+ ])) : y("", !0)
1824
+ ], 4);
1825
+ }), 128))
1826
+ ])),
1827
+ f.$slots.after ? A(f.$slots, "after", { key: 2 }, void 0, !0) : y("", !0),
1828
+ f.$slots.footer ? (n(), s("div", No, [
1829
+ A(f.$slots, "footer", ce(Ve({
1830
+ isInsertReady: oe.value
1831
+ })), void 0, !0)
1832
+ ])) : y("", !0)
1833
+ ], 4);
1834
+ };
1835
+ }
1836
+ });
1837
+ const He = /* @__PURE__ */ G(xo, [["__scopeId", "data-v-4fa79d79"]]), ea = /* @__PURE__ */ q({
1838
+ __name: "aeria-filter-panel",
1839
+ emits: ["update:modelValue"],
1840
+ setup(c, { emit: r }) {
1841
+ const t = r, o = ge(), l = Le(), i = () => {
1842
+ o.pagination.offset = 0, o.$actions.filter(), t("update:modelValue", !1), l.push({
1843
+ query: Ft(o)
1844
+ });
1845
+ };
1846
+ return (u, _) => (n(), $(Ae, {
1847
+ "close-hint": "",
1848
+ "fixed-right": "",
1849
+ title: u.t("filter_by", { capitalize: !0 }),
1850
+ onClose: _[2] || (_[2] = (m) => t("update:modelValue", !1)),
1851
+ onOverlayClick: _[3] || (_[3] = (m) => t("update:modelValue", !1))
1852
+ }, {
1853
+ footer: v(() => [
1854
+ e(o).filtersCount > 0 ? (n(), $(ie, {
1855
+ key: 0,
1856
+ variant: "transparent",
1857
+ onClick: _[1] || (_[1] = (m) => {
1858
+ e(o).$actions.clearFilters(), i(), t("update:modelValue", !1);
1859
+ })
1860
+ }, {
1861
+ default: v(() => [
1862
+ D(k(u.t("action.clear", { capitalize: !0 })) + " ", 1),
1863
+ z(be, null, {
1864
+ default: v(() => [
1865
+ D(k(e(o).filtersCount), 1)
1866
+ ]),
1867
+ _: 1
1868
+ })
1869
+ ]),
1870
+ _: 1
1871
+ })) : y("", !0),
1872
+ z(ie, {
1873
+ large: "",
1874
+ icon: "funnel",
1875
+ disabled: !e(o).hasActiveFilters,
1876
+ onClick: i
1877
+ }, {
1878
+ default: v(() => [
1879
+ D(k(u.t("action.filter", { capitalize: !0 })), 1)
1880
+ ]),
1881
+ _: 1
1882
+ }, 8, ["disabled"])
1883
+ ]),
1884
+ default: v(() => [
1885
+ z(He, E({
1886
+ modelValue: e(o).filters,
1887
+ "onUpdate:modelValue": _[0] || (_[0] = (m) => e(o).filters = m)
1888
+ }, {
1889
+ searchOnly: !0,
1890
+ form: e(o).availableFilters,
1891
+ layout: e(o).description.formLayout || {}
1892
+ }, { focus: "" }), null, 16, ["modelValue"])
1893
+ ]),
1894
+ _: 1
1895
+ }, 8, ["title"]));
1896
+ }
1897
+ }), se = X(!1), ut = X(!1), ke = X(!1), Be = X((...c) => null), ct = X(), dt = !1, ta = /* @__PURE__ */ q({
1898
+ __name: "aeria-insert-panel",
1899
+ setup(c) {
1900
+ const r = ue("meta"), t = ue(r.view.collection), o = ve("individualActions", []), l = async () => {
1901
+ const _ = await t.$actions.deepInsert();
1902
+ $t(_) || (se.value = !1);
1903
+ }, { t: i } = jt(), u = () => {
1904
+ r.$actions.ask({
1905
+ action: () => {
1906
+ t.$actions.clearItem(), t.validationErrors = {}, se.value = !1;
1907
+ },
1908
+ body: i("prompt.close_panel")
1909
+ });
1910
+ };
1911
+ return re(() => t.item._id, (_) => {
1912
+ _ === null && (se.value = !1);
1913
+ }), (_, m) => {
1914
+ const h = ne("clickable");
1915
+ return n(), $(Ae, {
1916
+ modelValue: e(se),
1917
+ "onUpdate:modelValue": m[3] || (m[3] = (d) => ft(se) ? se.value = d : null),
1918
+ "fixed-right": "",
1919
+ loading: e(t).loading.get,
1920
+ onOverlayClick: u
1921
+ }, {
1922
+ header: v(() => [
1923
+ V("span", null, k((() => {
1924
+ switch (e(se)) {
1925
+ case "add":
1926
+ return e(i)("action.add", { capitalize: !0 });
1927
+ case "duplicate":
1928
+ return e(i)("action.duplicate", { capitalize: !0 });
1929
+ case "edit":
1930
+ default:
1931
+ return e(i)("action.edit", { capitalize: !0 });
1932
+ }
1933
+ })()), 1),
1934
+ V("span", null, " " + k(e(i)(e(r).view.collection)), 1)
1935
+ ]),
1936
+ extra: v(() => [
1937
+ z(Ce, E({
1938
+ subject: e(t).item,
1939
+ actions: e(o).filter(({ action: d }) => d !== "ui/spawnEdit")
1940
+ }, {
1941
+ onActionClick: m[2] || (m[2] = (d) => se.value = !1)
1942
+ }), {
1943
+ default: v(() => [
1944
+ e(t).item._id ? Z((n(), $(K, {
1945
+ key: 0,
1946
+ reactive: "",
1947
+ icon: "dots-three"
1948
+ }, null, 512)), [
1949
+ [h]
1950
+ ]) : y("", !0)
1951
+ ]),
1952
+ _: 1
1953
+ }, 16)
1954
+ ]),
1955
+ footer: v(() => [
1956
+ z(ie, {
1957
+ variant: "transparent",
1958
+ onClick: u
1959
+ }, {
1960
+ default: v(() => [
1961
+ D(k(e(i)("action.cancel", { capitalize: !0 })), 1)
1962
+ ]),
1963
+ _: 1
1964
+ }),
1965
+ z(ie, {
1966
+ large: "",
1967
+ disabled: !e(t).isInsertReady || dt || e(t).loading.get,
1968
+ loading: e(t).loading.insert,
1969
+ onClick: l
1970
+ }, {
1971
+ default: v(() => [
1972
+ D(k(e(i)("action.insert", { capitalize: !0 })), 1)
1973
+ ]),
1974
+ _: 1
1975
+ }, 8, ["disabled", "loading"])
1976
+ ]),
1977
+ default: v(() => [
1978
+ z(He, E({
1979
+ modelValue: e(t).item,
1980
+ "onUpdate:modelValue": m[0] || (m[0] = (d) => e(t).item = d)
1981
+ }, {
1982
+ collection: e(r).view.collection,
1983
+ form: e(t).properties,
1984
+ isReadOnly: dt,
1985
+ layout: e(t).description.formLayout || {}
1986
+ }, {
1987
+ focus: "",
1988
+ onAdd: m[1] || (m[1] = (d) => d.preventDefault())
1989
+ }), de({ _: 2 }, [
1990
+ U(Object.keys(_.$slots).filter((d) => d.startsWith("field-")), (d) => ({
1991
+ name: d,
1992
+ fn: v((a) => [
1993
+ A(_.$slots, d, ce(Ve(a)))
1994
+ ])
1995
+ }))
1996
+ ]), 1040, ["modelValue"])
1997
+ ]),
1998
+ _: 3
1999
+ }, 8, ["modelValue", "loading"]);
2000
+ };
2001
+ }
2002
+ }), gt = (c, r) => {
2003
+ if (r) {
2004
+ if (!c) {
2005
+ r.filtersPreset = {}, r.preferredTableProperties = [], r.pagination.offset = 0;
2006
+ return;
2007
+ }
2008
+ r.filtersPreset = c.filters || {}, r.preferredTableProperties = c.table ? Array.from(c.table) : [], r.pagination.offset = 0;
2009
+ }
2010
+ }, na = (c, r = {
2011
+ persistInQuery: !0
2012
+ }) => {
2013
+ const o = Le().currentRoute;
2014
+ return re(() => o.value.query.section, (l) => {
2015
+ if (c) {
2016
+ if (c.description.filtersPresets) {
2017
+ const i = l || Object.keys(c.description.filtersPresets)[0];
2018
+ gt(c.description.filtersPresets[i], c);
2019
+ }
2020
+ if (r.persistInQuery) {
2021
+ const i = o.value.query;
2022
+ i.offset && (c.pagination.offset = +i.offset), i.limit && (c.pagination.limit = +i.limit), i.search && (c.textQuery = i.search, c.filters.$text = {
2023
+ $search: `"${i.search}"`,
2024
+ $caseSensitive: !1
2025
+ });
2026
+ }
2027
+ }
2028
+ }, {
2029
+ immediate: !0
2030
+ });
2031
+ }, oa = (c) => (Fe("data-v-434830ec"), c = c(), qe(), c), aa = {
2032
+ key: 0,
2033
+ class: "table aeria-surface"
2034
+ }, la = { key: 0 }, sa = { key: 1 }, ia = { key: 0 }, ra = ["checked"], ua = {
2035
+ key: 1,
2036
+ style: { "text-align": "right" }
2037
+ }, ca = { key: 2 }, da = { key: 3 }, pa = ["onClick"], _a = { key: 0 }, ma = ["value"], fa = { class: "table__cell-mobile-label" }, va = {
2038
+ key: 0,
2039
+ class: "table__cell-container"
2040
+ }, ya = {
2041
+ key: 1,
2042
+ class: "table__cell-container"
2043
+ }, ha = { class: "table__cell-grid" }, $a = { key: 0 }, ba = { key: 1 }, ga = ["href"], ka = { key: 3 }, Va = { key: 2 }, Ca = { key: 0 }, Ia = { key: 1 }, Aa = { key: 2 }, Oa = {
2044
+ key: 1,
2045
+ class: "no-print"
2046
+ }, wa = { class: "table__cell-actions" }, Ba = {
2047
+ key: 2,
2048
+ class: "no-print table__mobile-actions"
2049
+ }, Sa = ["id"], ja = { key: 1 }, Ta = /* @__PURE__ */ oa(() => /* @__PURE__ */ V("td", { colspan: 10 }, [
2050
+ /* @__PURE__ */ V("div", { class: "table__empty" }, " Não foram encontrados resultados. ")
2051
+ ], -1)), La = [
2052
+ Ta
2053
+ ], Ra = /* @__PURE__ */ q({
2054
+ __name: "aeria-table",
2055
+ props: {
2056
+ columns: {},
2057
+ rows: {},
2058
+ collection: {},
2059
+ checkbox: { type: Boolean },
2060
+ actions: {},
2061
+ layout: {}
2062
+ },
2063
+ emits: ["itemClick"],
2064
+ setup(c, { emit: r }) {
2065
+ const t = c, o = r, l = je(), i = t.collection || Te(), u = i ? ue(typeof i == "string" ? i : i.value) : null, _ = H({
2066
+ get: () => u == null ? void 0 : u.selected,
2067
+ set: (p) => u == null ? void 0 : u.$actions.selectManyItems(p, !0)
2068
+ }), m = (p, b) => p != null && p.button ? typeof p.button == "object" ? Qe(b, p.button).satisfied : p.button : !1, h = (p) => {
2069
+ var b;
2070
+ return !l.value.xl || !((b = t.layout) != null && b.actions) || !t.actions ? [] : t.actions.filter((S) => {
2071
+ const R = t.layout.actions[S.action];
2072
+ return m(R, p);
2073
+ });
2074
+ }, d = (p) => {
2075
+ var b;
2076
+ return t.actions ? !l.value.xl || !((b = t.layout) != null && b.actions) ? t.actions : t.actions.filter((S) => {
2077
+ const R = t.layout.actions[S.action];
2078
+ return !m(R, p);
2079
+ }) : [];
2080
+ }, a = (p, b) => {
2081
+ var Y, P;
2082
+ const S = [], R = (P = (Y = t.layout) == null ? void 0 : Y.actions) == null ? void 0 : P[b.action];
2083
+ return R != null && R.if && (Qe(
2084
+ p,
2085
+ R.if
2086
+ ).satisfied || S.push("display: none;")), S.join("");
2087
+ };
2088
+ return (p, b) => {
2089
+ var R, Y, P;
2090
+ const S = ne("clickable");
2091
+ return p.columns && Object.keys(p.columns).length > 0 || p.$slots.thead ? (n(), s("table", aa, [
2092
+ p.$slots.thead ? (n(), s("thead", la, [
2093
+ A(p.$slots, "thead", {}, void 0, !0)
2094
+ ])) : (n(), s("thead", sa, [
2095
+ V("tr", null, [
2096
+ p.checkbox && e(u) && e(l).md ? (n(), s("th", ia, [
2097
+ V("input", {
2098
+ type: "checkbox",
2099
+ checked: e(u).selected.length > 0 && e(u).selected.length === e(u).itemsCount,
2100
+ onChange: b[0] || (b[0] = (O) => e(u).$actions.selectAllItems(O.target.checked))
2101
+ }, null, 40, ra)
2102
+ ])) : y("", !0),
2103
+ (n(!0), s(J, null, U(Object.entries(p.columns), ([O, M], W) => (n(), s("th", {
2104
+ key: `header-${W}`,
2105
+ class: "table__header"
2106
+ }, k(M.description || e(F)(O)), 1))), 128)),
2107
+ (R = p.actions) != null && R.length ? (n(), s("th", ua)) : y("", !0)
2108
+ ])
2109
+ ])),
2110
+ p.$slots.tbody ? (n(), s("tbody", ca, [
2111
+ A(p.$slots, "tbody", {}, void 0, !0)
2112
+ ])) : (n(), s("tbody", da, [
2113
+ (n(!0), s(J, null, U(p.rows, (O) => {
2114
+ var M, W;
2115
+ return n(), s("tr", {
2116
+ key: O._id,
2117
+ onClick: (w) => o("itemClick", O)
2118
+ }, [
2119
+ e(u) && p.checkbox && e(l).md ? (n(), s("td", _a, [
2120
+ Z(V("input", {
2121
+ "onUpdate:modelValue": b[1] || (b[1] = (w) => _.value = w),
2122
+ type: "checkbox",
2123
+ value: O._id
2124
+ }, null, 8, ma), [
2125
+ [It, _.value]
2126
+ ])
2127
+ ])) : y("", !0),
2128
+ (n(!0), s(J, null, U(Object.entries(p.columns), ([w, ee], C) => {
2129
+ var L, te, oe, le, f, g;
2130
+ return n(), s("td", {
2131
+ key: `column-${O._id}-${C}`
2132
+ }, [
2133
+ V("div", fa, k(ee.description || e(F)(w)), 1),
2134
+ `row-${w}` in p.$slots ? (n(), s("div", va, [
2135
+ A(p.$slots, `row-${w}`, E({ ref_for: !0 }, {
2136
+ store: e(u),
2137
+ column: w,
2138
+ property: ee,
2139
+ row: O
2140
+ }), void 0, !0)
2141
+ ])) : (n(), s("div", ya, [
2142
+ V("div", ha, [
2143
+ "type" in ee && ee.type === "boolean" ? (n(), s("div", $a, [
2144
+ O[w] ? (n(), $(K, {
2145
+ key: 0,
2146
+ icon: "check",
2147
+ "icon-classes": "aeria-blueish"
2148
+ }, {
2149
+ default: v(() => [
2150
+ D(k(e(F)("yes")), 1)
2151
+ ]),
2152
+ _: 1
2153
+ })) : (n(), $(K, {
2154
+ key: 1,
2155
+ icon: "x",
2156
+ "icon-classes": "aeria-redish"
2157
+ }, {
2158
+ default: v(() => [
2159
+ D(k(e(F)("no")), 1)
2160
+ ]),
2161
+ _: 1
2162
+ }))
2163
+ ])) : ((L = e(pe)(ee)) == null ? void 0 : L.$ref) === "file" ? (n(), s("div", ba, [
2164
+ /^image/.test((te = O[w][0]) == null ? void 0 : te.type) && "items" in ee ? (n(), $(Me, {
2165
+ key: 0,
2166
+ modelValue: O[w][0].link,
2167
+ "onUpdate:modelValue": (j) => O[w][0].link = j,
2168
+ expandable: "",
2169
+ meta: O[w][0],
2170
+ alt: "Row image",
2171
+ class: "table__picture"
2172
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "meta"])) : /^image/.test((oe = O[w]) == null ? void 0 : oe.type) ? (n(), $(Me, {
2173
+ key: 1,
2174
+ modelValue: O[w].link,
2175
+ "onUpdate:modelValue": (j) => O[w].link = j,
2176
+ expandable: "",
2177
+ meta: O[w],
2178
+ alt: "Row image",
2179
+ class: "table__picture"
2180
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "meta"])) : (le = O[w]) != null && le.link ? (n(), s("a", {
2181
+ key: 2,
2182
+ href: O[w].link,
2183
+ style: { "font-size": "10pt" }
2184
+ }, k(O[w].filename), 9, ga)) : (n(), s("div", ka, " - "))
2185
+ ])) : (n(), s("div", Va, [
2186
+ e(u) ? (n(), s("span", Ca, k(e(u).$actions.formatValue({
2187
+ value: O[w],
2188
+ key: w,
2189
+ property: ee
2190
+ })), 1)) : (n(), s("span", Ia, k(Array.isArray(O[w]) ? O[w].filter((j) => !!j).join(", ") : [void 0, null].includes(O[w]) ? "-" : O[w]), 1)),
2191
+ ((g = (f = e(pe)(ee)) == null ? void 0 : f.indexes) == null ? void 0 : g.length) > 1 ? (n(), s("div", Aa, [
2192
+ (n(!0), s(J, null, U(e(pe)(ee).indexes.slice(1, 2), (j, N) => (n(), s("div", {
2193
+ key: `subvalue-${N}`,
2194
+ class: "table__cell-subvalue"
2195
+ }, k(e(u).$actions.formatValue({
2196
+ value: O[w],
2197
+ key: w,
2198
+ property: ee,
2199
+ index: j
2200
+ })), 1))), 128))
2201
+ ])) : y("", !0)
2202
+ ]))
2203
+ ])
2204
+ ]))
2205
+ ]);
2206
+ }), 128)),
2207
+ (M = p.actions) != null && M.length && e(l).md ? (n(), s("td", Oa, [
2208
+ V("div", wa, [
2209
+ (n(!0), s(J, null, U(h(O), (w) => (n(), $(ie, {
2210
+ key: `action-${w.action}`,
2211
+ small: "",
2212
+ variant: "transparent",
2213
+ icon: w.icon,
2214
+ style: $e(a(O, w)),
2215
+ onClick: (ee) => w.click(O)
2216
+ }, {
2217
+ default: v(() => [
2218
+ D(k(e(F)(w.label)), 1)
2219
+ ]),
2220
+ _: 2
2221
+ }, 1032, ["icon", "style", "onClick"]))), 128)),
2222
+ d(O).length > 0 ? (n(), $(Ce, E({
2223
+ key: 0,
2224
+ ref_for: !0
2225
+ }, {
2226
+ subject: O,
2227
+ actions: d(O)
2228
+ }), {
2229
+ default: v(() => [
2230
+ Z(z(K, {
2231
+ reactive: "",
2232
+ icon: "dots-three"
2233
+ }, null, 512), [
2234
+ [S]
2235
+ ])
2236
+ ]),
2237
+ _: 2
2238
+ }, 1040)) : y("", !0)
2239
+ ])
2240
+ ])) : (W = p.actions) != null && W.length ? (n(), s("td", Ba, [
2241
+ V("div", {
2242
+ class: "table__mobile-actions-grid",
2243
+ style: $e(`grid-template-columns: repeat(${h(O).length + (d(O).length ? 1 : 0)}, 1fr);`)
2244
+ }, [
2245
+ (n(!0), s(J, null, U(h(O), (w) => (n(), $(fe, {
2246
+ key: `action-${w.action}`,
2247
+ class: "table__mobile-actions-button",
2248
+ onClick: (ee) => w.click(O)
2249
+ }, {
2250
+ default: v(() => [
2251
+ z(K, {
2252
+ icon: w.icon || "gear"
2253
+ }, {
2254
+ default: v(() => [
2255
+ D(k(e(F)(w.label)), 1)
2256
+ ]),
2257
+ _: 2
2258
+ }, 1032, ["icon"])
2259
+ ]),
2260
+ _: 2
2261
+ }, 1032, ["onClick"]))), 128)),
2262
+ d(O).length > 0 ? (n(), $(Ce, E({
2263
+ key: 0,
2264
+ ref_for: !0
2265
+ }, {
2266
+ subject: O,
2267
+ actions: d(O)
2268
+ }), {
2269
+ default: v(() => [
2270
+ z(K, {
2271
+ icon: "dots-three",
2272
+ class: "table__mobile-actions-button"
2273
+ })
2274
+ ]),
2275
+ _: 2
2276
+ }, 1040)) : y("", !0)
2277
+ ], 4)
2278
+ ])) : y("", !0),
2279
+ V("div", {
2280
+ id: `dropdown-${O._id}`
2281
+ }, null, 8, Sa)
2282
+ ], 8, pa);
2283
+ }), 128))
2284
+ ])),
2285
+ V("tfoot", null, [
2286
+ p.$slots.tfoot ? A(p.$slots, "tfoot", { key: 0 }, void 0, !0) : p.columns && !((Y = p.rows) != null && Y.length) && !((P = e(u)) != null && P.loading.getAll) ? (n(), s("tr", ja, La)) : y("", !0)
2287
+ ])
2288
+ ])) : y("", !0);
2289
+ };
2290
+ }
2291
+ });
2292
+ const za = /* @__PURE__ */ G(Ra, [["__scopeId", "data-v-434830ec"]]), Ma = /* @__PURE__ */ q({
2293
+ __name: "aeria-tabular",
2294
+ props: {
2295
+ individualActions: {},
2296
+ layoutOptions: {},
2297
+ componentProps: {}
2298
+ },
2299
+ setup(c) {
2300
+ const r = c, t = ge(), o = Te(), l = H(() => {
2301
+ const i = {
2302
+ collection: o,
2303
+ checkbox: t.hasSelectionActions,
2304
+ columns: t.tableProperties,
2305
+ rows: t.items,
2306
+ actions: r.individualActions,
2307
+ layout: t.tableLayout
2308
+ };
2309
+ return Object.assign(i, r.componentProps);
2310
+ });
2311
+ return (i, u) => (n(), s("div", null, [
2312
+ i.$slots.inner ? A(i.$slots, "inner", { key: 0 }) : y("", !0),
2313
+ e(t).properties ? (n(), $(za, E({ key: 1 }, l.value, {
2314
+ key: e(t).$id
2315
+ }), de({ _: 2 }, [
2316
+ U(Object.keys(i.$slots).filter((_) => !["inner"].includes(_)), (_) => ({
2317
+ name: _,
2318
+ fn: v((m) => [
2319
+ A(i.$slots, _, ce(Ve(m)))
2320
+ ])
2321
+ }))
2322
+ ]), 1040)) : y("", !0)
2323
+ ]));
2324
+ }
2325
+ }), Fa = /* @__PURE__ */ q({
2326
+ __name: "aeria-grid",
2327
+ props: {
2328
+ list: { type: Boolean }
2329
+ },
2330
+ setup(c) {
2331
+ return (r, t) => (n(), s("div", {
2332
+ class: Q(`
2333
+ grid
2334
+ ${r.list && "grid--list"}
2335
+ `)
2336
+ }, [
2337
+ A(r.$slots, "default", {}, void 0, !0)
2338
+ ], 2));
2339
+ }
2340
+ });
2341
+ const qa = /* @__PURE__ */ G(Fa, [["__scopeId", "data-v-438c4aed"]]), Ua = { key: 0 }, Ea = {
2342
+ key: 1,
2343
+ class: "card__information"
2344
+ }, Ha = /* @__PURE__ */ q({
2345
+ __name: "aeria-grid",
2346
+ props: {
2347
+ individualActions: {},
2348
+ hasSelectionActions: { type: Boolean },
2349
+ layoutOptions: {},
2350
+ componentName: {}
2351
+ },
2352
+ setup(c) {
2353
+ const t = c.layoutOptions, o = ge(), l = (i) => Array.isArray(i) ? i[0] : i;
2354
+ return (i, u) => {
2355
+ const _ = ne("clickable");
2356
+ return n(), $(qa, {
2357
+ list: i.componentName === "list"
2358
+ }, {
2359
+ default: v(() => [
2360
+ (n(!0), s(J, null, U(e(o).items, (m) => (n(), $(pn, {
2361
+ key: m,
2362
+ inactive: !!(e(t).active && !m[e(t).active]),
2363
+ horizontal: i.componentName === "list"
2364
+ }, de({
2365
+ footer: v(() => [
2366
+ e(t).title ? (n(), s("div", Ua, k(m[e(t).title]), 1)) : y("", !0),
2367
+ e(t).information ? (n(), s("div", Ea, k(m[e(t).information]), 1)) : y("", !0)
2368
+ ]),
2369
+ actions: v(() => [
2370
+ i.individualActions.length > 0 ? (n(), $(Ce, E({
2371
+ key: 0,
2372
+ ref_for: !0
2373
+ }, {
2374
+ subject: m,
2375
+ actions: i.individualActions
2376
+ }), {
2377
+ default: v(() => [
2378
+ Z(z(K, {
2379
+ reactive: "",
2380
+ icon: "dots-three-vertical"
2381
+ }, null, 512), [
2382
+ [_]
2383
+ ])
2384
+ ]),
2385
+ _: 2
2386
+ }, 1040)) : y("", !0)
2387
+ ]),
2388
+ default: v(() => {
2389
+ var h;
2390
+ return [
2391
+ z(Me, {
2392
+ alt: "Item picture",
2393
+ expandable: "",
2394
+ url: (h = l(m[e(t).picture])) == null ? void 0 : h.link,
2395
+ meta: l(m[e(t).picture])
2396
+ }, null, 8, ["url", "meta"])
2397
+ ];
2398
+ }),
2399
+ _: 2
2400
+ }, [
2401
+ e(t).badge && Array.isArray(m[e(t).badge]) ? {
2402
+ name: "badge",
2403
+ fn: v(() => [
2404
+ (n(!0), s(J, null, U(m[e(t).badge], (h) => (n(), $(be, {
2405
+ key: `${m._id}-${h}`,
2406
+ large: ""
2407
+ }, {
2408
+ default: v(() => [
2409
+ D(k(e(t).translateBadge ? e(F)(h) : h), 1)
2410
+ ]),
2411
+ _: 2
2412
+ }, 1024))), 128))
2413
+ ]),
2414
+ key: "0"
2415
+ } : e(t).badge ? {
2416
+ name: "badge",
2417
+ fn: v(() => [
2418
+ z(be, null, {
2419
+ default: v(() => [
2420
+ D(k(e(t).translateBadge ? e(F)(m[e(t).badge]) : m[e(t)[i.badge]]), 1)
2421
+ ]),
2422
+ _: 2
2423
+ }, 1024)
2424
+ ]),
2425
+ key: "1"
2426
+ } : void 0
2427
+ ]), 1032, ["inactive", "horizontal"]))), 128))
2428
+ ]),
2429
+ _: 1
2430
+ }, 8, ["list"]);
2431
+ };
2432
+ }
2433
+ });
2434
+ const pt = /* @__PURE__ */ G(Ha, [["__scopeId", "data-v-71a3bd40"]]), Da = (c) => ({
2435
+ tabular: Ma,
2436
+ grid: pt,
2437
+ list: pt
2438
+ })[c], Qa = (c) => (Fe("data-v-2cbb3e9f"), c = c(), qe(), c), Ga = {
2439
+ key: 2,
2440
+ class: "crud__controls"
2441
+ }, Wa = {
2442
+ key: 0,
2443
+ class: "crud__search"
2444
+ }, Xa = { class: "crud__actions" }, Ya = { class: "crud__context-badge" }, Ja = /* @__PURE__ */ Qa(() => /* @__PURE__ */ V("div", null, "Filtros", -1)), Ka = { key: 0 }, Za = {
2445
+ key: 3,
2446
+ class: "crud__pagination"
2447
+ }, _t = 30, Pa = /* @__PURE__ */ q({
2448
+ __name: "aeria-crud",
2449
+ props: {
2450
+ collection: {},
2451
+ noControls: { type: Boolean },
2452
+ noActions: { type: Boolean },
2453
+ noFetch: { type: Boolean },
2454
+ noLayoutToggle: { type: Boolean },
2455
+ layout: {},
2456
+ action: {},
2457
+ componentProps: {},
2458
+ scrollPagination: { type: Boolean },
2459
+ noQueryPersistence: { type: Boolean }
2460
+ },
2461
+ emits: ["uiEvent"],
2462
+ setup(c, { emit: r }) {
2463
+ const t = c, o = r, l = Le(), i = yt({
2464
+ delay: 600
2465
+ }), u = ue("meta"), _ = je(), { reachedEnd: m, detach: h } = We(null, {
2466
+ antecipate: 600
2467
+ }), d = !_.value.md || t.scrollPagination;
2468
+ d && re(m, (C) => {
2469
+ C && a.pagination.recordsTotal > a.items.length && S.value < _t && (S.value += 1, Y());
2470
+ });
2471
+ const a = ue(t.collection);
2472
+ na(a, {
2473
+ persistInQuery: !t.noQueryPersistence
2474
+ });
2475
+ const p = ht(), b = t.action ? e(t.action) : qt(a, l, p);
2476
+ Be.value = b[0], ct.value = b[1];
2477
+ const S = X(0), R = X(!1), Y = async (C) => {
2478
+ a.activeFilters = Object.assign({}, (C == null ? void 0 : C.filters) || a.$filters), Object.assign(a.activeFilters, a.filtersPreset);
2479
+ const L = {
2480
+ filters: a.activeFilters,
2481
+ limit: a.pagination.limit,
2482
+ offset: a.pagination.offset,
2483
+ project: a.preferredTableProperties.length > 0 ? a.preferredTableProperties : a.description.table || Object.keys(a.properties)
2484
+ };
2485
+ S.value > 0 && (L.limit = 15, L.offset = S.value * L.limit), a.description.tableMeta && (L.project = L.project.concat(a.description.tableMeta)), C && Object.assign(L, C), a.loading.getAll = !0;
2486
+ const { data: te, pagination: oe } = await a.$actions.retrieveItems(L);
2487
+ a.pagination.recordsCount = oe.recordsCount, a.pagination.recordsTotal = oe.recordsTotal, S.value === 0 && a.items.splice(0), a.items.push(...te), a.loading.getAll = !1, R.value = !0;
2488
+ }, P = async (C) => {
2489
+ l.push({
2490
+ query: {
2491
+ ...l.currentRoute.value.query,
2492
+ offset: C.offset,
2493
+ limit: C.limit
2494
+ }
2495
+ }), a.pagination.offset = C.offset, a.pagination.limit = C.limit, Y();
2496
+ }, O = ve("noResultsComponent", null);
2497
+ re(() => [
2498
+ l.currentRoute.value.path,
2499
+ l.currentRoute.value.query.section
2500
+ ], async (C, L) => {
2501
+ if (L && L[0] === C[0] && L[1] === C[1])
2502
+ return;
2503
+ const te = l.currentRoute.value;
2504
+ if (u.view.title = t.collection, u.view.collection = t.collection, ut.value = !1, !t.noFetch && !te.query._popstate) {
2505
+ const oe = Ut(a, te);
2506
+ Object.keys(oe).length > 0 && Object.assign(a.filters, oe), await Y();
2507
+ }
2508
+ }, {
2509
+ immediate: !0,
2510
+ flush: "post"
2511
+ });
2512
+ const [M] = i((C) => (l.push({
2513
+ query: {
2514
+ search: C || void 0
2515
+ }
2516
+ }), C ? (a.filters = Object.assign(Se(a.freshFilters), {
2517
+ $text: {
2518
+ $search: `"${C}"`,
2519
+ $caseSensitive: !1
2520
+ }
2521
+ }), Y({
2522
+ offset: 0
2523
+ })) : (a.filters = Se(a.freshFilters), S.value = 0, Y())));
2524
+ re(() => a.textQuery, (C) => {
2525
+ M(C);
2526
+ });
2527
+ const W = (C) => {
2528
+ C.currentLayout = C.currentLayout === "tabular" ? C.description.layout.name : "tabular";
2529
+ };
2530
+ At(() => {
2531
+ a.$actions.clearFilters(), a.textQuery = "", h();
2532
+ }), re(() => ct.value, async (C) => {
2533
+ var oe;
2534
+ const L = Se(C);
2535
+ let te;
2536
+ if (L)
2537
+ if ([
2538
+ "spawnEdit",
2539
+ "spawnView",
2540
+ "duplicate"
2541
+ ].includes(L.name) && (te = a.$actions.get({
2542
+ filters: {
2543
+ _id: L.params._id
2544
+ }
2545
+ })), L.name === "spawnAdd")
2546
+ a.$actions.clearItem(), (oe = L.params) != null && oe.item && (a.$actions.setItem(L.params.item), Object.keys(L.params.item).forEach((le) => {
2547
+ delete a.referenceItem[le];
2548
+ })), se.value = "add";
2549
+ else if (L.name === "spawnEdit")
2550
+ a.$actions.setItem(L.params), se.value = "edit";
2551
+ else if (L.name === "spawnView")
2552
+ ut.value = !0, se.value = "view";
2553
+ else if (L.name === "duplicate") {
2554
+ await te;
2555
+ const le = Object.entries(a.item).reduce((f, [g, j]) => {
2556
+ if (!(g in a.properties))
2557
+ return {
2558
+ ...f,
2559
+ [g]: j
2560
+ };
2561
+ const N = a.properties[g];
2562
+ if (N.readOnly)
2563
+ return f;
2564
+ const I = (T) => {
2565
+ const B = pe(N);
2566
+ if (!B)
2567
+ return T;
2568
+ if (B.$ref === "file")
2569
+ return {};
2570
+ if (B.inline && T) {
2571
+ const { _id: ae, ..._e } = T;
2572
+ return _e;
2573
+ }
2574
+ return T;
2575
+ };
2576
+ return j = Array.isArray(j) ? j.map(I) : I(j), {
2577
+ ...f,
2578
+ [g]: j
2579
+ };
2580
+ }, {});
2581
+ a.$actions.setItem(le), delete a.item._id, a.referenceItem = {}, se.value = "duplicate";
2582
+ } else
2583
+ o("uiEvent", L);
2584
+ }, {
2585
+ deep: !0
2586
+ }), re(() => se, (C) => {
2587
+ C.value === !1 && (u.view.collection = t.collection, a.$actions.clearItem());
2588
+ });
2589
+ const w = H(() => a.individualActions.map((C) => ({
2590
+ click: Be.value(C),
2591
+ ...C
2592
+ }))), ee = H(() => a.actions.filter((C) => !C.button));
2593
+ return ye(Ue, H(() => t.collection)), ye("individualActions", w), (C, L) => {
2594
+ var le, f, g, j, N, I, T;
2595
+ const te = ne("clickable"), oe = ne("loading");
2596
+ return n(), s(J, null, [
2597
+ e(ke) ? (n(), $(ea, {
2598
+ key: e(a).$id,
2599
+ modelValue: e(ke),
2600
+ "onUpdate:modelValue": L[0] || (L[0] = (B) => ft(ke) ? ke.value = B : null)
2601
+ }, null, 8, ["modelValue"])) : y("", !0),
2602
+ e(se) ? (n(), $(ta, { key: 1 }, de({ _: 2 }, [
2603
+ U(Object.keys(C.$slots).filter((B) => B.startsWith("field-")), (B) => ({
2604
+ name: B,
2605
+ fn: v((ae) => [
2606
+ A(C.$slots, B, ce(Ve(ae)), void 0, !0)
2607
+ ])
2608
+ }))
2609
+ ]), 1024)) : y("", !0),
2610
+ !C.noActions && (e(a).description.search || Object.keys(e(a).availableFilters).length > 0 || ((le = e(a)) == null ? void 0 : le.actions.length) > 0 || C.$slots.actions || !C.noLayoutToggle && e(a).description.layout && ((f = e(a).description.layout) == null ? void 0 : f.name) !== "tabular") ? (n(), s("div", Ga, [
2611
+ e(a).description.search ? (n(), s("div", Wa, [
2612
+ z(Ie, E({
2613
+ modelValue: e(a).textQuery,
2614
+ "onUpdate:modelValue": L[1] || (L[1] = (B) => e(a).textQuery = B)
2615
+ }, {
2616
+ property: {
2617
+ type: "string",
2618
+ placeholder: e(a).description.search.placeholder || "Pesquise aqui",
2619
+ inputType: "search"
2620
+ }
2621
+ }), null, 16, ["modelValue"])
2622
+ ])) : y("", !0),
2623
+ V("div", Xa, [
2624
+ ee.value.length > 0 || !C.noLayoutToggle && e(a).description.layout && ((g = e(a).description.layout) == null ? void 0 : g.name) !== "tabular" ? (n(), $(Ce, { key: 0 }, de({
2625
+ default: v(() => [
2626
+ z(ie, {
2627
+ variant: "alt",
2628
+ icon: "sliders"
2629
+ }, {
2630
+ default: v(() => [
2631
+ e(a).filtersCount ? (n(), $(be, { key: 0 }, {
2632
+ default: v(() => [
2633
+ D(k(e(a).filtersCount), 1)
2634
+ ]),
2635
+ _: 1
2636
+ })) : y("", !0)
2637
+ ]),
2638
+ _: 1
2639
+ })
2640
+ ]),
2641
+ _: 2
2642
+ }, [
2643
+ Object.keys(e(a).availableFilters).length > 0 ? {
2644
+ name: "filter",
2645
+ fn: v(() => [
2646
+ Z((n(), $(K, {
2647
+ icon: "funnel",
2648
+ onClick: L[2] || (L[2] = (B) => ke.value = !0)
2649
+ }, {
2650
+ default: v(() => [
2651
+ D(k(e(F)("filters", { capitalize: !0 })), 1)
2652
+ ]),
2653
+ _: 1
2654
+ })), [
2655
+ [te]
2656
+ ]),
2657
+ V("div", Ya, [
2658
+ e(a).filtersCount ? (n(), $(be, { key: 0 }, {
2659
+ default: v(() => [
2660
+ D(k(e(a).filtersCount), 1)
2661
+ ]),
2662
+ _: 1
2663
+ })) : y("", !0)
2664
+ ])
2665
+ ]),
2666
+ key: "0"
2667
+ } : void 0,
2668
+ !C.noLayoutToggle && e(a).description.layout && ((j = e(a).description.layout) == null ? void 0 : j.name) !== "tabular" ? {
2669
+ name: "layout-toggle",
2670
+ fn: v(() => [
2671
+ Z((n(), $(K, {
2672
+ icon: "table",
2673
+ onClick: L[3] || (L[3] = (B) => W(e(a)))
2674
+ }, {
2675
+ default: v(() => [
2676
+ D(k(e(F)("change_layout", { capitalize: !0 })), 1)
2677
+ ]),
2678
+ _: 1
2679
+ })), [
2680
+ [te]
2681
+ ])
2682
+ ]),
2683
+ key: "1"
2684
+ } : void 0,
2685
+ U(ee.value, (B, ae) => ({
2686
+ name: `action-${ae}`,
2687
+ fn: v(() => [
2688
+ B ? (n(), $(K, {
2689
+ key: 0,
2690
+ icon: B.icon || "gear",
2691
+ disabled: e(a).selected.length === 0 && B.selection,
2692
+ onClick: (_e) => e(Be)(B)({ _id: e(a).selected.map((me) => me._id) })
2693
+ }, {
2694
+ default: v(() => [
2695
+ D(k(e(F)(B.label, { capitalize: !0 })), 1)
2696
+ ]),
2697
+ _: 2
2698
+ }, 1032, ["icon", "disabled", "onClick"])) : y("", !0)
2699
+ ])
2700
+ }))
2701
+ ]), 1024)) : Object.keys(e(a).availableFilters).length > 0 ? (n(), $(ie, {
2702
+ key: 1,
2703
+ variant: "alt",
2704
+ icon: "funnel",
2705
+ onClick: L[4] || (L[4] = (B) => ke.value = !0)
2706
+ }, {
2707
+ default: v(() => [
2708
+ Ja,
2709
+ e(a).filtersCount ? (n(), $(be, { key: 0 }, {
2710
+ default: v(() => [
2711
+ D(k(e(a).filtersCount), 1)
2712
+ ]),
2713
+ _: 1
2714
+ })) : y("", !0)
2715
+ ]),
2716
+ _: 1
2717
+ })) : y("", !0),
2718
+ (n(!0), s(J, null, U(e(a).actions.filter((B) => B.button), (B, ae) => (n(), $(ie, {
2719
+ key: `action-${ae}`,
2720
+ icon: B.icon,
2721
+ disabled: e(a).selected.length === 0 && B.selection,
2722
+ onClick: (_e) => e(Be)(B)({ _id: e(a).selected.map((me) => me._id) })
2723
+ }, {
2724
+ default: v(() => [
2725
+ D(k(e(F)(B.label, { capitalize: !0 })), 1)
2726
+ ]),
2727
+ _: 2
2728
+ }, 1032, ["icon", "disabled", "onClick"]))), 128)),
2729
+ C.$slots.actions ? A(C.$slots, "actions", { key: 2 }, void 0, !0) : y("", !0)
2730
+ ])
2731
+ ])) : y("", !0),
2732
+ Z((n(), s("div", null, [
2733
+ e(a).itemsCount === 0 && !e(a).loading.getAll && R.value && (e(O) || C.$slots.empty) ? (n(), s("div", Ka, [
2734
+ e(O) ? (n(), $(he(e(O)), ce(E({ key: 0 }, {
2735
+ collection: e(a).$id
2736
+ })), {
2737
+ default: v(() => [
2738
+ e(a).filtersCount === 0 && e(a).description.actions && "ui:spawnAdd" in e(a).description.actions ? (n(), $(ie, {
2739
+ key: 0,
2740
+ icon: "plus",
2741
+ onClick: L[5] || (L[5] = (B) => e(Be)({
2742
+ action: "ui:spawnAdd"
2743
+ })())
2744
+ }, {
2745
+ default: v(() => [
2746
+ D(k(e(F)("add_first_item", { capitalize: !0 })), 1)
2747
+ ]),
2748
+ _: 1
2749
+ })) : y("", !0)
2750
+ ]),
2751
+ _: 1
2752
+ }, 16)) : A(C.$slots, "empty", ce(E({ key: 1 }, {
2753
+ collection: e(a).$id
2754
+ })), void 0, !0)
2755
+ ])) : C.$slots.component ? A(C.$slots, "component", ce(E({ key: 1 }, {
2756
+ store: e(a)
2757
+ })), void 0, !0) : (n(), $(he(e(Da)(((N = C.layout) == null ? void 0 : N.name) || e(a).$currentLayout)), E({ key: 2 }, {
2758
+ individualActions: w.value,
2759
+ layoutOptions: ((I = C.layout) == null ? void 0 : I.options) || e(a).layout.options,
2760
+ componentProps: C.componentProps
2761
+ }, {
2762
+ "component-name": ((T = C.layout) == null ? void 0 : T.name) || e(a).$currentLayout
2763
+ }), de({ _: 2 }, [
2764
+ U(Object.keys(C.$slots).filter((B) => B.startsWith("row-")), (B) => ({
2765
+ name: B,
2766
+ fn: v((ae) => [
2767
+ A(C.$slots, B, ce(Ve(ae)), void 0, !0)
2768
+ ])
2769
+ })),
2770
+ C.$slots.tfoot ? {
2771
+ name: "tfoot",
2772
+ fn: v(() => [
2773
+ A(C.$slots, "tfoot", {}, void 0, !0)
2774
+ ]),
2775
+ key: "0"
2776
+ } : void 0
2777
+ ]), 1040, ["component-name"]))
2778
+ ])), [
2779
+ [oe, (!e(d) || S.value === _t) && e(a).loading.getAll]
2780
+ ]),
2781
+ !e(a).loading.getAll && e(a).itemsCount > 0 ? (n(), s("div", Za, [
2782
+ z(Mn, {
2783
+ pagination: e(a).pagination,
2784
+ onPaginate: P
2785
+ }, null, 8, ["pagination"])
2786
+ ])) : y("", !0)
2787
+ ], 64);
2788
+ };
2789
+ }
2790
+ });
2791
+ const Ll = /* @__PURE__ */ G(Pa, [["__scopeId", "data-v-2cbb3e9f"]]), Na = { class: "prompt" }, xa = /* @__PURE__ */ q({
2792
+ __name: "aeria-prompt",
2793
+ props: {
2794
+ title: {},
2795
+ actions: {}
2796
+ },
2797
+ setup(c) {
2798
+ const r = ue("meta"), t = (o) => {
2799
+ r.$actions.fulfillPrompt(o);
2800
+ };
2801
+ return (o, l) => (n(), $(Ae, {
2802
+ float: "",
2803
+ "fill-footer": "",
2804
+ "close-hint": !1,
2805
+ style: { "--panel-min-width": "32rem" }
2806
+ }, de({
2807
+ footer: v(() => [
2808
+ V("div", {
2809
+ class: "prompt__actions",
2810
+ style: $e(`grid-template-columns: repeat(${o.actions.length}, 1fr)`)
2811
+ }, [
2812
+ (n(!0), s(J, null, U(o.actions, (i, u) => (n(), $(fe, {
2813
+ key: `action-${u}`,
2814
+ class: Q(`
2815
+ prompt__action
2816
+ prompt__action--${i.variant || "primary"}
2817
+ `),
2818
+ onClick: (_) => i.click ? i.click(i) : t(i)
2819
+ }, {
2820
+ default: v(() => [
2821
+ D(k(i.title || i.name), 1)
2822
+ ]),
2823
+ _: 2
2824
+ }, 1032, ["class", "onClick"]))), 128))
2825
+ ], 4)
2826
+ ]),
2827
+ default: v(() => [
2828
+ V("div", Na, [
2829
+ A(o.$slots, "default", {}, void 0, !0)
2830
+ ])
2831
+ ]),
2832
+ _: 2
2833
+ }, [
2834
+ o.title ? {
2835
+ name: "title",
2836
+ fn: v(() => [
2837
+ D(k(o.title), 1)
2838
+ ]),
2839
+ key: "0"
2840
+ } : void 0
2841
+ ]), 1024));
2842
+ }
2843
+ });
2844
+ const el = /* @__PURE__ */ G(xa, [["__scopeId", "data-v-5443f297"]]), tl = { class: "toast__content" }, nl = { class: "toast__time" }, ol = /* @__PURE__ */ q({
2845
+ __name: "aeria-toast",
2846
+ props: {
2847
+ idx: {},
2848
+ itr: {},
2849
+ date: {},
2850
+ icon: {}
2851
+ },
2852
+ setup(c) {
2853
+ const r = ue("meta");
2854
+ return (t, o) => {
2855
+ const l = ne("clickable");
2856
+ return Z((n(), s("div", {
2857
+ class: Q({
2858
+ toast: !0,
2859
+ "toast--animate": e(r).toasts[0].itr === t.itr
2860
+ }),
2861
+ onAnimationend: o[0] || (o[0] = (i) => e(r).$actions.popToast()),
2862
+ onClick: o[1] || (o[1] = (i) => e(r).$actions.popToast(t.itr))
2863
+ }, [
2864
+ z(K, E(
2865
+ t.icon ? { icon: t.icon } : { icon: "warning-circle" },
2866
+ { style: { "--icon-size": "4rem", "--icon-color": "var(--theme-brand-color-shade-3)" } }
2867
+ ), null, 16),
2868
+ V("div", tl, [
2869
+ A(t.$slots, "default", {}, void 0, !0),
2870
+ V("div", nl, k(t.formatDateTime(t.date, { hoursOnly: !0 })), 1)
2871
+ ])
2872
+ ], 34)), [
2873
+ [l]
2874
+ ]);
2875
+ };
2876
+ }
2877
+ });
2878
+ const al = /* @__PURE__ */ G(ol, [["__scopeId", "data-v-54736bc3"]]), ll = ["innerHTML"], sl = { class: "main__toasts" }, il = ["innerHTML"], rl = /* @__PURE__ */ q({
2879
+ __name: "aeria-main",
2880
+ setup(c) {
2881
+ const r = ue("meta"), t = H(() => r.themeOverride || r.theme);
2882
+ return (o, l) => {
2883
+ const i = Ot("router-view");
2884
+ return n(), s("main", {
2885
+ id: "main",
2886
+ class: Q(`
2887
+ main
2888
+ main--${t.value}
2889
+ ${t.value === "dark" && "tw-dark"}
2890
+ `)
2891
+ }, [
2892
+ (n(), $(wt, null, {
2893
+ default: v(() => [
2894
+ z(i, null, {
2895
+ default: v(({ Component: u }) => [
2896
+ (n(), $(he(u), null, de({ _: 2 }, [
2897
+ U(Object.keys(o.$slots), (_) => ({
2898
+ name: _,
2899
+ fn: v(() => [
2900
+ A(o.$slots, _, {}, void 0, !0)
2901
+ ])
2902
+ }))
2903
+ ]), 1024))
2904
+ ]),
2905
+ _: 3
2906
+ })
2907
+ ]),
2908
+ _: 3
2909
+ })),
2910
+ A(o.$slots, "default", {}, void 0, !0),
2911
+ z(Ae, E({
2912
+ modelValue: e(r).modal.visible,
2913
+ "onUpdate:modelValue": l[0] || (l[0] = (u) => e(r).modal.visible = u),
2914
+ float: "",
2915
+ "close-hint": ""
2916
+ }, e(r).modal, {
2917
+ "overlay-layer": 70,
2918
+ onOverlayClick: l[1] || (l[1] = (u) => e(r).modal.visible = !1)
2919
+ }), {
2920
+ default: v(() => [
2921
+ e(r).modal.body ? (n(), s("div", {
2922
+ key: 0,
2923
+ style: { "white-space": "pre-wrap" },
2924
+ innerHTML: e(r).modal.body
2925
+ }, null, 8, ll)) : y("", !0),
2926
+ e(r).modal.component ? (n(), $(he(e(r).modal.component), { key: 1 })) : y("", !0)
2927
+ ]),
2928
+ _: 1
2929
+ }, 16, ["modelValue"]),
2930
+ e(r).prompt.visible ? (n(), $(el, ce(E({ key: 0 }, e(r).prompt)), {
2931
+ default: v(() => [
2932
+ D(k(e(r).prompt.body), 1)
2933
+ ]),
2934
+ _: 1
2935
+ }, 16)) : y("", !0),
2936
+ V("div", sl, [
2937
+ (n(!0), s(J, null, U(e(r).toasts, (u) => (n(), $(al, E({ ref_for: !0 }, u, {
2938
+ key: `toast-${u.itr}`
2939
+ }), {
2940
+ default: v(() => [
2941
+ V("div", {
2942
+ innerHTML: e(F)(u.text)
2943
+ }, null, 8, il)
2944
+ ]),
2945
+ _: 2
2946
+ }, 1040))), 128))
2947
+ ])
2948
+ ], 2);
2949
+ };
2950
+ }
2951
+ });
2952
+ const Rl = /* @__PURE__ */ G(rl, [["__scopeId", "data-v-1166be3d"]]);
2953
+ const ul = {}, cl = { class: "menu" };
2954
+ function dl(c, r) {
2955
+ return n(), s("menu", cl, [
2956
+ (n(!0), s(J, null, U(Object.keys(c.$slots), (t) => (n(), s("div", {
2957
+ key: t,
2958
+ class: "menu__entry"
2959
+ }, [
2960
+ A(c.$slots, t, {}, void 0, !0)
2961
+ ]))), 128))
2962
+ ]);
2963
+ }
2964
+ const zl = /* @__PURE__ */ G(ul, [["render", dl], ["__scopeId", "data-v-3cfef7fb"]]), pl = { class: "tabs" }, _l = {
2965
+ key: 0,
2966
+ class: "tabs__horizontal"
2967
+ }, ml = {
2968
+ key: 0,
2969
+ class: "tabs__tab tabs__tab--info"
2970
+ }, fl = ["onClick"], vl = {
2971
+ key: 1,
2972
+ class: "tabs__context-menu"
2973
+ }, yl = ["onClick"], hl = /* @__PURE__ */ q({
2974
+ __name: "aeria-tabs",
2975
+ props: {
2976
+ query: {},
2977
+ param: {},
2978
+ dropdown: { type: Boolean }
2979
+ },
2980
+ setup(c) {
2981
+ const r = c, t = Bt(), o = Le(), l = je(), i = "query" in r && r.query ? "query" : "params", u = H(() => {
2982
+ const m = o.currentRoute.value[i][r.query || r.param];
2983
+ return m || Object.keys(t)[0];
2984
+ }), _ = (m) => {
2985
+ if (i === "query") {
2986
+ o.push({
2987
+ query: {
2988
+ ...o.currentRoute.value.query,
2989
+ [r.query]: m
2990
+ }
2991
+ });
2992
+ return;
2993
+ }
2994
+ o.push({
2995
+ params: {
2996
+ [r.param]: m
2997
+ }
2998
+ });
2999
+ };
3000
+ return (m, h) => {
3001
+ const d = ne("clickable");
3002
+ return n(), s("div", pl, [
3003
+ e(l).md && !m.dropdown ? (n(), s("div", _l, [
3004
+ m.$slots.default ? (n(), s("div", ml, [
3005
+ A(m.$slots, "default", {}, void 0, !0)
3006
+ ])) : y("", !0),
3007
+ (n(!0), s(J, null, U(Object.keys(m.$slots).filter((a) => a !== "default"), (a, p) => (n(), s("div", {
3008
+ key: a,
3009
+ class: Q({
3010
+ tabs__tab: !0,
3011
+ "tabs__tab--current": a === u.value || !u.value && p === 0
3012
+ }),
3013
+ onClick: (b) => _(a)
3014
+ }, [
3015
+ A(m.$slots, a, {}, void 0, !0)
3016
+ ], 10, fl))), 128))
3017
+ ])) : (n(), s("div", vl, [
3018
+ z(Ce, null, de({
3019
+ default: v(() => [
3020
+ Z((n(), $(K, {
3021
+ "icon-right": "",
3022
+ icon: "caret-down",
3023
+ style: { "--icon-color": "var(--theme-brand-color-shade-1)" },
3024
+ class: "tabs__context-menu-icon"
3025
+ }, {
3026
+ default: v(() => [
3027
+ A(m.$slots, u.value, {}, void 0, !0)
3028
+ ]),
3029
+ _: 3
3030
+ })), [
3031
+ [d]
3032
+ ])
3033
+ ]),
3034
+ _: 2
3035
+ }, [
3036
+ U(Object.keys(m.$slots).filter((a) => a !== "default"), (a) => ({
3037
+ name: a,
3038
+ fn: v(() => [
3039
+ V("div", {
3040
+ onClick: (p) => _(a)
3041
+ }, [
3042
+ A(m.$slots, a, {}, void 0, !0)
3043
+ ], 8, yl)
3044
+ ])
3045
+ }))
3046
+ ]), 1024)
3047
+ ]))
3048
+ ]);
3049
+ };
3050
+ }
3051
+ });
3052
+ const $l = /* @__PURE__ */ G(hl, [["__scopeId", "data-v-4dd516ec"]]), bl = q({
3053
+ props: {
3054
+ initialValue: String,
3055
+ promise: Promise
3056
+ },
3057
+ setup(c) {
3058
+ const r = X(c.initialValue);
3059
+ return c.promise instanceof Promise && c.promise.then((t) => {
3060
+ r.value = t;
3061
+ }), () => St("div", r.value);
3062
+ }
3063
+ }), gl = ["onClick"], kl = { key: 1 }, Vl = /* @__PURE__ */ q({
3064
+ __name: "aeria-crud-topbar",
3065
+ props: {
3066
+ collection: {}
3067
+ },
3068
+ setup(c) {
3069
+ const r = c, o = Le().currentRoute, l = H(() => {
3070
+ try {
3071
+ const i = r.collection ? r.collection : o.value.meta.collection || o.value.params.collection;
3072
+ return ge(i);
3073
+ } catch {
3074
+ return null;
3075
+ }
3076
+ });
3077
+ return (i, u) => l.value && l.value.description.filtersPresets ? (n(), $($l, {
3078
+ key: 0,
3079
+ dropdown: "",
3080
+ query: "section"
3081
+ }, de({ _: 2 }, [
3082
+ U(Object.entries(l.value.description.filtersPresets), ([_, m]) => ({
3083
+ name: _,
3084
+ fn: v(() => [
3085
+ V("div", {
3086
+ class: "topbar__preset",
3087
+ onClick: (h) => e(gt)(m, l.value)
3088
+ }, [
3089
+ m.icon ? (n(), $(K, {
3090
+ key: 0,
3091
+ icon: m.icon
3092
+ }, {
3093
+ default: v(() => [
3094
+ D(k(m.name || e(F)(_, { plural: !0 })), 1)
3095
+ ]),
3096
+ _: 2
3097
+ }, 1032, ["icon"])) : (n(), s("div", kl, k(m.name || e(F)(_, { plural: !0 })), 1)),
3098
+ m.badgeFunction ? (n(), $(be, { key: 2 }, {
3099
+ default: v(() => [
3100
+ z(e(bl), {
3101
+ "initial-value": "0",
3102
+ promise: l.value.$functions[m.badgeFunction]({ filters: m.filters })
3103
+ }, null, 8, ["promise"])
3104
+ ]),
3105
+ _: 2
3106
+ }, 1024)) : y("", !0)
3107
+ ], 8, gl)
3108
+ ])
3109
+ }))
3110
+ ]), 1024)) : y("", !0);
3111
+ }
3112
+ });
3113
+ const Cl = /* @__PURE__ */ G(Vl, [["__scopeId", "data-v-57d3d562"]]), Il = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3114
+ __proto__: null,
3115
+ default: Cl
3116
+ }, Symbol.toStringTag, { value: "Module" })), Ml = /* @__PURE__ */ q({
3117
+ __name: "aeria-password-form",
3118
+ props: {
3119
+ modelValue: {}
3120
+ },
3121
+ emits: ["update:modelValue"],
3122
+ setup(c) {
3123
+ const r = c;
3124
+ ye(Ue, null);
3125
+ const t = Et(), o = H(() => t(
3126
+ r.modelValue.password,
3127
+ r.modelValue.confirmation
3128
+ ));
3129
+ return (l, i) => (n(), $(He, {
3130
+ form: {
3131
+ password: {
3132
+ type: "string",
3133
+ icon: "key",
3134
+ inputType: "password"
3135
+ },
3136
+ confirmation: {
3137
+ type: "string",
3138
+ icon: "key",
3139
+ inputType: "password"
3140
+ }
3141
+ },
3142
+ "model-value": l.modelValue,
3143
+ "onUpdate:modelValue": i[0] || (i[0] = (u) => l.$emit("update:modelValue", u))
3144
+ }, {
3145
+ after: v(() => [
3146
+ V("div", null, k(o.value || "Senhas conferem"), 1),
3147
+ A(l.$slots, "default", ce(Ve({ passwordError: o.value })))
3148
+ ]),
3149
+ _: 3
3150
+ }, 8, ["model-value"]));
3151
+ }
3152
+ }), Fl = (c, r = []) => ({
3153
+ path: "/user",
3154
+ name: "/builtin:user",
3155
+ component: c,
3156
+ children: r.concat([
3157
+ {
3158
+ path: "invite/:id",
3159
+ name: "/user/invite/:id",
3160
+ redirect: (t) => ({
3161
+ path: "/user/signup",
3162
+ params: {
3163
+ inviteId: t.params.id
3164
+ }
3165
+ })
3166
+ },
3167
+ {
3168
+ path: "signin",
3169
+ name: "/user/signin",
3170
+ component: () => import("./signin-12da0ca0.js"),
3171
+ meta: {
3172
+ title: "Autenticação"
3173
+ }
3174
+ },
3175
+ {
3176
+ path: "signup",
3177
+ name: "/user/signup",
3178
+ component: () => import("./signup-db7595de.js"),
3179
+ meta: {
3180
+ title: "Registro"
3181
+ }
3182
+ },
3183
+ {
3184
+ path: "activation",
3185
+ name: "/user/activation",
3186
+ component: () => import("./activation-309d46c7.js"),
3187
+ meta: {
3188
+ title: "Ativação"
3189
+ }
3190
+ }
3191
+ ])
3192
+ }), ql = (c, r = []) => ({
3193
+ path: "/dashboard",
3194
+ name: "/builtin:dashboard",
3195
+ component: c,
3196
+ redirect: {
3197
+ name: "/dashboard/"
3198
+ },
3199
+ meta: {
3200
+ title: "Dashboard"
3201
+ },
3202
+ children: r.concat([
3203
+ {
3204
+ path: "c/:collection?",
3205
+ name: "/dashboard/crud",
3206
+ props: !0,
3207
+ components: {
3208
+ default: () => import("./crud-view-86988807.js"),
3209
+ topbar: () => Promise.resolve().then(() => Il)
3210
+ },
3211
+ meta: {
3212
+ title: "%viewTitle%"
3213
+ }
3214
+ },
3215
+ {
3216
+ path: "user",
3217
+ name: "/dashboard/user",
3218
+ meta: {
3219
+ title: "user",
3220
+ icon: "users"
3221
+ },
3222
+ redirect: "/dashboard/c/user",
3223
+ children: [
3224
+ {
3225
+ path: "profile",
3226
+ component: () => import("./profile-28afeeaa.js"),
3227
+ meta: {
3228
+ title: "Meu perfil",
3229
+ icon: "user-square"
3230
+ }
3231
+ },
3232
+ {
3233
+ path: "changepass",
3234
+ name: "/dashboard/user/changepass",
3235
+ component: () => import("./password-change-09610509.js"),
3236
+ meta: {
3237
+ title: "Mudar senha",
3238
+ icon: "lock"
3239
+ }
3240
+ }
3241
+ ]
3242
+ }
3243
+ ])
3244
+ });
3245
+ export {
3246
+ He as A,
3247
+ el as B,
3248
+ al as C,
3249
+ Cl as D,
3250
+ Fl as E,
3251
+ ql as F,
3252
+ Ml as _,
3253
+ ie as a,
3254
+ K as b,
3255
+ Qn as c,
3256
+ Ll as d,
3257
+ Me as e,
3258
+ zl as f,
3259
+ Ae as g,
3260
+ G as h,
3261
+ Tl as i,
3262
+ be as j,
3263
+ fe as k,
3264
+ pn as l,
3265
+ Ce as m,
3266
+ qa as n,
3267
+ $n as o,
3268
+ Rl as p,
3269
+ Mn as q,
3270
+ za as r,
3271
+ $l as s,
3272
+ $o as t,
3273
+ Ie as u,
3274
+ Xn as v,
3275
+ Mo as w,
3276
+ Ee as x,
3277
+ xn as y,
3278
+ bl as z
3279
+ };