@wssto2/vue-core 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/README.md +20 -9
  2. package/dist/{AdaptivePageShell.vue_vue_type_script_setup_true_lang-CKghARkW.js → AdaptivePageShell.vue_vue_type_script_setup_true_lang-CeKK8_g5.js} +2 -2
  3. package/dist/{AlertDialog.vue_vue_type_script_setup_true_lang-BZb4qKXo.js → AlertDialog.vue_vue_type_script_setup_true_lang-e4hzkzg3.js} +1 -1
  4. package/dist/{AsyncSection.vue_vue_type_script_setup_true_lang-B82bl36A.js → AsyncSection.vue_vue_type_script_setup_true_lang-CWLB3xsR.js} +1 -1
  5. package/dist/Badge.vue_vue_type_script_setup_true_lang-DJyZc0C7.js +51 -0
  6. package/dist/Button.vue_vue_type_script_setup_true_lang-B1eZgLae.js +182 -0
  7. package/dist/CountryFlag.vue_vue_type_script_setup_true_lang-Kry_vPPZ.js +299 -0
  8. package/dist/{DiscardChangesModal.vue_vue_type_script_setup_true_lang-Bx5O1RZJ.js → DiscardChangesModal.vue_vue_type_script_setup_true_lang-DyhYHRyz.js} +1 -1
  9. package/dist/{LeaveGuardRoot.vue_vue_type_script_setup_true_lang-DH6EB8br.js → LeaveGuardRoot.vue_vue_type_script_setup_true_lang-CvwoT1JF.js} +1 -1
  10. package/dist/{Menu.vue_vue_type_script_setup_true_lang-D44EHXQZ.js → Menu.vue_vue_type_script_setup_true_lang-CrMj6KPD.js} +1 -1
  11. package/dist/{Modal.vue_vue_type_script_setup_true_lang-DYQgaUtj.js → Modal.vue_vue_type_script_setup_true_lang-BQZM49gC.js} +138 -128
  12. package/dist/{PhotoViewer.vue_vue_type_script_setup_true_lang-DDVQXJRB.js → PhotoViewer.vue_vue_type_script_setup_true_lang-ElDizaW2.js} +1 -1
  13. package/dist/{SectionList.vue_vue_type_script_setup_true_lang-DGcKX_OJ.js → SectionList.vue_vue_type_script_setup_true_lang-L9ita_Kx.js} +2 -2
  14. package/dist/SelectField.vue_vue_type_script_setup_true_lang-DZTrU8NJ.js +661 -0
  15. package/dist/{Sheet.vue_vue_type_script_setup_true_lang-BLBD5ps8.js → Sheet.vue_vue_type_script_setup_true_lang-CtkJ-4e3.js} +1 -1
  16. package/dist/{Tooltip.vue_vue_type_script_setup_true_lang-BJWPVyfT.js → Tooltip.vue_vue_type_script_setup_true_lang-OOD_XNWx.js} +1 -1
  17. package/dist/app/application.d.ts +5 -0
  18. package/dist/app/environment.d.ts +2 -0
  19. package/dist/app/index.js +75 -72
  20. package/dist/button/index.d.ts +1 -1
  21. package/dist/button/index.js +5 -3
  22. package/dist/button/shortcut.d.ts +28 -2
  23. package/dist/collection/CollectionPage.vue.d.ts +1 -0
  24. package/dist/collection/CollectionRows.vue.d.ts +59 -0
  25. package/dist/collection/CollectionTable.vue.d.ts +1 -1
  26. package/dist/collection/DataTable.vue.d.ts +47 -0
  27. package/dist/collection/RowActions.vue.d.ts +19 -0
  28. package/dist/collection/columns.d.ts +2 -0
  29. package/dist/collection/index.d.ts +4 -2
  30. package/dist/collection/index.js +1752 -1610
  31. package/dist/collection/rowLayout.d.ts +10 -0
  32. package/dist/collection/slots.d.ts +6 -3
  33. package/dist/describeError-l5T9b8Uv.js +41 -0
  34. package/dist/dialogStack-DZZg55w0.js +31 -0
  35. package/dist/form/CommandDialog.vue.d.ts +12 -1
  36. package/dist/form/FormGroup.vue.d.ts +1 -1
  37. package/dist/form/MultiSelectField.vue.d.ts +4 -1
  38. package/dist/form/NumberField.vue.d.ts +6 -0
  39. package/dist/form/OptionList.vue.d.ts +6 -2
  40. package/dist/form/SelectField.vue.d.ts +4 -1
  41. package/dist/form/index.d.ts +2 -0
  42. package/dist/form/index.js +1940 -2008
  43. package/dist/form/suggestions.d.ts +11 -0
  44. package/dist/form/useOptions.d.ts +60 -0
  45. package/dist/i18n/describeError.d.ts +31 -0
  46. package/dist/i18n/index.d.ts +26 -0
  47. package/dist/i18n/index.js +22 -20
  48. package/dist/index.d.ts +1 -1
  49. package/dist/index.js +1 -1
  50. package/dist/internal/CountryFlag.vue.d.ts +10 -0
  51. package/dist/modal/Modal.vue.d.ts +4 -0
  52. package/dist/modal/ShortcutHelp.vue.d.ts +2 -0
  53. package/dist/modal/index.d.ts +2 -0
  54. package/dist/modal/index.js +64 -6
  55. package/dist/modal/placement.d.ts +22 -0
  56. package/dist/{options-CjSz2dQK.js → options-DAkBtYkI.js} +3 -3
  57. package/dist/overlay/Popover.vue.d.ts +3 -0
  58. package/dist/overlay/dialogStack.d.ts +9 -0
  59. package/dist/overlay/index.d.ts +1 -1
  60. package/dist/overlay/index.js +18 -17
  61. package/dist/page/index.js +4 -4
  62. package/dist/phone/index.js +247 -540
  63. package/dist/platform/AccessGate.vue.d.ts +50 -0
  64. package/dist/platform/index.d.ts +2 -0
  65. package/dist/platform/index.js +86 -66
  66. package/dist/resource/index.js +42 -42
  67. package/dist/shell/AccountMenuItem.vue.d.ts +3 -0
  68. package/dist/shell/NavigationList.vue.d.ts +1 -1
  69. package/dist/shell/index.js +406 -394
  70. package/dist/state/Badge.vue.d.ts +17 -10
  71. package/dist/state/hue.d.ts +8 -0
  72. package/dist/state/index.d.ts +2 -0
  73. package/dist/state/index.js +92 -56
  74. package/dist/state/useLoad.d.ts +41 -0
  75. package/dist/styles.css +1 -1
  76. package/dist/testing/app.d.ts +61 -0
  77. package/dist/testing/async.d.ts +12 -0
  78. package/dist/testing/collection.d.ts +18 -0
  79. package/dist/testing/format.d.ts +9 -0
  80. package/dist/testing/i18n.d.ts +16 -0
  81. package/dist/testing/index.d.ts +14 -0
  82. package/dist/testing/index.js +178 -0
  83. package/dist/testing/media.d.ts +23 -0
  84. package/dist/testing/platform.d.ts +40 -0
  85. package/dist/testing/transport.d.ts +40 -0
  86. package/dist/{toast-BTeX0r66.js → toast-DvrHQ6Ag.js} +45 -43
  87. package/dist/{useDialog-wmyNx2j_.js → useDialog-CXR3hN0G.js} +1 -1
  88. package/package.json +5 -1
  89. package/src/styles/theme.css +60 -0
  90. package/dist/Badge.vue_vue_type_script_setup_true_lang-DKc6ugmr.js +0 -31
  91. package/dist/Button.vue_vue_type_script_setup_true_lang-3f0emVNU.js +0 -141
  92. package/dist/SelectField.vue_vue_type_script_setup_true_lang-SyFWE33A.js +0 -422
  93. package/dist/dialogStack-DiTG1rZc.js +0 -26
  94. package/dist/phone/CountryFlag.vue.d.ts +0 -10
  95. /package/dist/{phone → internal}/flagLoaders.d.ts +0 -0
@@ -1,806 +1,682 @@
1
- import { hasInjectionContext as dt, inject as ft, watch as Ae, shallowRef as $e, computed as _, toValue as Ie, ref as ue, getCurrentScope as Ke, onScopeDispose as Xe, defineComponent as we, openBlock as i, createElementBlock as d, createBlock as W, unref as n, withCtx as B, Fragment as I, renderList as Z, normalizeClass as le, toDisplayString as y, createTextVNode as ne, createCommentVNode as L, renderSlot as pe, createVNode as O, createElementVNode as p, mergeProps as Se, useTemplateRef as _e, withModifiers as Re, withDirectives as Ge, vModelText as Je, nextTick as pt, onBeforeUnmount as Ct, onMounted as zt, useSlots as Ue, normalizeStyle as be, createSlots as vt, normalizeProps as Pt, guardReactiveProps as At } from "vue";
2
- import { routerKey as Et, useRoute as jt, RouterLink as mt, useRouter as Ot } from "vue-router";
3
- import { a as Me, i as Lt } from "../error-Bb_dr_Ay.js";
4
- import { f as Tt } from "../platform-jqlKVJ2e.js";
5
- import { a as Rt } from "../AdaptivePageShell.vue_vue_type_script_setup_true_lang-CKghARkW.js";
6
- import { useI18n as Ce } from "vue-i18n";
7
- import { _ as he, u as Qe } from "../Button.vue_vue_type_script_setup_true_lang-3f0emVNU.js";
8
- import { a as gt, _ as Mt } from "../SwipeActions.vue_vue_type_script_setup_true_lang-CGTuEnTv.js";
9
- import { u as Ve } from "../format-B8mJm946.js";
10
- import { _ as J } from "../Icon.vue_vue_type_script_lang-DtC4_mkz.js";
11
- import { a as bt } from "../mediaQuery-CygcXmFW.js";
12
- import { _ as We } from "../Menu.vue_vue_type_script_setup_true_lang-D44EHXQZ.js";
13
- import { _ as Vt } from "../Tooltip.vue_vue_type_script_setup_true_lang-BJWPVyfT.js";
14
- import { _ as Fe } from "../Banner.vue_vue_type_script_setup_true_lang-n_wGPIIu.js";
15
- import { _ as Ze } from "../EmptyState.vue_vue_type_script_setup_true_lang-BeGpHMUP.js";
16
- import { _ as Nt } from "../Badge.vue_vue_type_script_setup_true_lang-DKc6ugmr.js";
17
- import { _ as It } from "../Timestamp.vue_vue_type_script_setup_true_lang-CSY_mMm1.js";
18
- import { _ as ht, t as je } from "../toast-BTeX0r66.js";
19
- import { _ as Ft, a as qt } from "../SelectField.vue_vue_type_script_setup_true_lang-SyFWE33A.js";
20
- import { _ as Dt } from "../Sheet.vue_vue_type_script_setup_true_lang-BLBD5ps8.js";
21
- const Ut = [5, 8, 10, 15, 25, 50, 100], et = 25;
22
- function us(t) {
23
- const e = `defineCollection("${t.id}")`;
24
- if (typeof t.id != "string" || t.id.trim() === "") throw new Error("defineCollection: `id` must be a non-empty string.");
25
- if (!Number.isInteger(t.stateVersion) || t.stateVersion < 1) throw new Error(`${e}: \`stateVersion\` must be a positive integer.`);
26
- if (typeof t.load != "function") throw new Error(`${e}: \`load\` must be a function.`);
27
- if (typeof t.key != "function") throw new Error(`${e}: \`key\` must be a function.`);
28
- const l = {
29
- sorts: t.query?.sorts ? [...t.query.sorts] : null,
30
- filters: t.query?.filters ? [...t.query.filters] : null,
31
- views: t.query?.views ? [...t.query.views] : null,
32
- sensitive: [...t.query?.sensitive ?? []],
33
- pageSizes: [...t.query?.pageSizes ?? Ut]
1
+ import { hasInjectionContext as at, inject as rt, watch as Se, shallowRef as we, computed as h, toValue as Re, ref as ae, getCurrentScope as Ie, onScopeDispose as qe, defineComponent as ue, openBlock as c, createElementBlock as d, createVNode as P, unref as s, createElementVNode as v, toDisplayString as y, Fragment as V, renderList as X, createCommentVNode as j, createBlock as Y, mergeProps as _e, withCtx as q, createTextVNode as le, normalizeClass as W, renderSlot as oe, nextTick as it, useSlots as ke, useTemplateRef as ge, normalizeStyle as ve, withModifiers as Ee, createSlots as je, withDirectives as De, vModelText as Be, onBeforeUnmount as kt, onMounted as xt, normalizeProps as Ue, guardReactiveProps as He } from "vue";
2
+ import { routerKey as $t, useRoute as St, RouterLink as ct, useRouter as Ct } from "vue-router";
3
+ import { a as Oe, i as zt } from "../error-Bb_dr_Ay.js";
4
+ import { f as At } from "../platform-jqlKVJ2e.js";
5
+ import { a as Pt } from "../AdaptivePageShell.vue_vue_type_script_setup_true_lang-CeKK8_g5.js";
6
+ import { useI18n as he } from "vue-i18n";
7
+ import { _ as be, u as Xe } from "../Button.vue_vue_type_script_setup_true_lang-B1eZgLae.js";
8
+ import { _ as Et, a as ut } from "../SwipeActions.vue_vue_type_script_setup_true_lang-CGTuEnTv.js";
9
+ import { u as Le } from "../format-B8mJm946.js";
10
+ import { _ as H } from "../Icon.vue_vue_type_script_lang-DtC4_mkz.js";
11
+ import { _ as Ge } from "../Banner.vue_vue_type_script_setup_true_lang-n_wGPIIu.js";
12
+ import { _ as Fe } from "../EmptyState.vue_vue_type_script_setup_true_lang-BeGpHMUP.js";
13
+ import { _ as Ke } from "../Menu.vue_vue_type_script_setup_true_lang-CrMj6KPD.js";
14
+ import { _ as dt } from "../Tooltip.vue_vue_type_script_setup_true_lang-OOD_XNWx.js";
15
+ import { _ as Ot } from "../Badge.vue_vue_type_script_setup_true_lang-DJyZc0C7.js";
16
+ import { _ as jt } from "../Timestamp.vue_vue_type_script_setup_true_lang-CSY_mMm1.js";
17
+ import { _ as ft, t as Ce } from "../toast-DvrHQ6Ag.js";
18
+ import { _ as Lt, a as Rt } from "../SelectField.vue_vue_type_script_setup_true_lang-DZTrU8NJ.js";
19
+ import { a as pt } from "../mediaQuery-CygcXmFW.js";
20
+ import { _ as Tt } from "../Sheet.vue_vue_type_script_setup_true_lang-CtkJ-4e3.js";
21
+ const Vt = [5, 8, 10, 15, 25, 50, 100], Je = 25;
22
+ function as(l) {
23
+ const e = `defineCollection("${l.id}")`;
24
+ if (typeof l.id != "string" || l.id.trim() === "") throw new Error("defineCollection: `id` must be a non-empty string.");
25
+ if (!Number.isInteger(l.stateVersion) || l.stateVersion < 1) throw new Error(`${e}: \`stateVersion\` must be a positive integer.`);
26
+ if (typeof l.load != "function") throw new Error(`${e}: \`load\` must be a function.`);
27
+ if (typeof l.key != "function") throw new Error(`${e}: \`key\` must be a function.`);
28
+ const t = {
29
+ sorts: l.query?.sorts ? [...l.query.sorts] : null,
30
+ filters: l.query?.filters ? [...l.query.filters] : null,
31
+ views: l.query?.views ? [...l.query.views] : null,
32
+ sensitive: [...l.query?.sensitive ?? []],
33
+ pageSizes: [...l.query?.pageSizes ?? Vt]
34
34
  };
35
- if (l.pageSizes.length === 0 || l.pageSizes.some((x) => !Number.isInteger(x) || x < 1))
35
+ if (t.pageSizes.length === 0 || t.pageSizes.some(($) => !Number.isInteger($) || $ < 1))
36
36
  throw new Error(`${e}: \`query.pageSizes\` must list positive integers.`);
37
- for (const x of l.sensitive)
38
- if (l.filters && !l.filters.includes(x)) throw new Error(`${e}: sensitive filter "${x}" is not in \`query.filters\`.`);
39
- const s = t.defaults ?? {}, r = s.pageSize ?? (l.pageSizes.includes(et) ? et : l.pageSizes[0]);
40
- if (!l.pageSizes.includes(r)) throw new Error(`${e}: default page size ${r} is not one of ${l.pageSizes.join(", ")}.`);
41
- const a = s.sort ?? null;
42
- if (a !== null && l.sorts && !l.sorts.includes(a)) throw new Error(`${e}: default sort "${a}" is not in \`query.sorts\`.`);
43
- const c = s.view ?? null;
44
- if (c !== null && l.views && !l.views.includes(c)) throw new Error(`${e}: default view "${c}" is not in \`query.views\`.`);
45
- const f = Object.fromEntries(Object.entries(s.filters ?? {}).filter(([, x]) => x !== void 0 && x !== ""));
46
- for (const x of Object.keys(f))
47
- if (l.filters && !l.filters.includes(x)) throw new Error(`${e}: default filter "${x}" is not in \`query.filters\`.`);
48
- const b = s.page ?? 1;
49
- if (!Number.isInteger(b) || b < 1) throw new Error(`${e}: default page must be a positive integer.`);
50
- const v = s.direction ?? "asc";
51
- if (v !== "asc" && v !== "desc") throw new Error(`${e}: default direction must be "asc" or "desc".`);
37
+ for (const $ of t.sensitive)
38
+ if (t.filters && !t.filters.includes($)) throw new Error(`${e}: sensitive filter "${$}" is not in \`query.filters\`.`);
39
+ const i = l.defaults ?? {}, a = i.pageSize ?? (t.pageSizes.includes(Je) ? Je : t.pageSizes[0]);
40
+ if (!t.pageSizes.includes(a)) throw new Error(`${e}: default page size ${a} is not one of ${t.pageSizes.join(", ")}.`);
41
+ const n = i.sort ?? null;
42
+ if (n !== null && t.sorts && !t.sorts.includes(n)) throw new Error(`${e}: default sort "${n}" is not in \`query.sorts\`.`);
43
+ const u = i.view ?? null;
44
+ if (u !== null && t.views && !t.views.includes(u)) throw new Error(`${e}: default view "${u}" is not in \`query.views\`.`);
45
+ const p = Object.fromEntries(Object.entries(i.filters ?? {}).filter(([, $]) => $ !== void 0 && $ !== ""));
46
+ for (const $ of Object.keys(p))
47
+ if (t.filters && !t.filters.includes($)) throw new Error(`${e}: default filter "${$}" is not in \`query.filters\`.`);
48
+ const g = i.page ?? 1;
49
+ if (!Number.isInteger(g) || g < 1) throw new Error(`${e}: default page must be a positive integer.`);
50
+ const m = i.direction ?? "asc";
51
+ if (m !== "asc" && m !== "desc") throw new Error(`${e}: default direction must be "asc" or "desc".`);
52
52
  return Object.freeze({
53
- id: t.id,
54
- stateVersion: t.stateVersion,
55
- load: t.load,
56
- key: t.key,
53
+ id: l.id,
54
+ stateVersion: l.stateVersion,
55
+ load: l.load,
56
+ key: l.key,
57
57
  defaults: Object.freeze({
58
- page: b,
59
- pageSize: r,
60
- sort: a,
61
- direction: v,
62
- search: s.search ?? "",
63
- view: c,
64
- filters: Object.freeze(f)
58
+ page: g,
59
+ pageSize: a,
60
+ sort: n,
61
+ direction: m,
62
+ search: i.search ?? "",
63
+ view: u,
64
+ filters: Object.freeze(p)
65
65
  }),
66
- contract: Object.freeze(l),
67
- migrate: t.migrate
66
+ contract: Object.freeze(t),
67
+ migrate: l.migrate
68
68
  });
69
69
  }
70
- const ye = (t) => t == null || t === "";
71
- function yt(t) {
72
- if (!t) return [null, null];
73
- const [e = "", l = ""] = String(t).split(",");
74
- return [e.trim() || null, l.trim() || null];
70
+ const me = (l) => l == null || l === "";
71
+ function vt(l) {
72
+ if (!l) return [null, null];
73
+ const [e = "", t = ""] = String(l).split(",");
74
+ return [e.trim() || null, t.trim() || null];
75
75
  }
76
- function Bt(t, e) {
77
- const l = ye(t) ? "" : String(t), s = ye(e) ? "" : String(e);
78
- return l === "" && s === "" ? null : `${l},${s}`;
76
+ function Ft(l, e) {
77
+ const t = me(l) ? "" : String(l), i = me(e) ? "" : String(e);
78
+ return t === "" && i === "" ? null : `${t},${i}`;
79
79
  }
80
- function Ht(t, e) {
81
- const l = ye(e) ? null : new Set(String(e).split(",")), s = (t.options ?? []).filter(
82
- (a) => !t.dependsOn || !l || a.parentValue !== void 0 && l.has(String(a.parentValue))
83
- ), r = /* @__PURE__ */ new Map();
84
- for (const a of s) {
85
- const c = r.get(a.label) ?? [], f = String(a.value);
86
- c.includes(f) || c.push(f), r.set(a.label, c);
80
+ function Mt(l, e) {
81
+ const t = me(e) ? null : new Set(String(e).split(",")), i = (l.options ?? []).filter(
82
+ (n) => !l.dependsOn || !t || n.parentValue !== void 0 && t.has(String(n.parentValue))
83
+ ), a = /* @__PURE__ */ new Map();
84
+ for (const n of i) {
85
+ const u = a.get(n.label) ?? [], p = String(n.value);
86
+ u.includes(p) || u.push(p), a.set(n.label, u);
87
87
  }
88
- return [...r.entries()].map(([a, c]) => ({ label: a, value: c.join(",") }));
88
+ return [...a.entries()].map(([n, u]) => ({ label: n, value: u.join(",") }));
89
89
  }
90
- function Kt(t, e, l) {
91
- if (ye(e)) return null;
92
- if (t.type === "range") {
93
- const [r, a] = yt(String(e)), c = t.unit ? ` ${t.unit}` : "", f = (b) => `${t.unit ? l.formatNumber(Number(b)) : b}${c}`;
94
- return r !== null && a !== null ? `${f(r)} – ${f(a)}` : r !== null ? `${l.from.toLowerCase()} ${f(r)}` : a !== null ? `${l.until.toLowerCase()} ${f(a)}` : null;
90
+ function Nt(l, e, t) {
91
+ if (me(e)) return null;
92
+ if (l.type === "range") {
93
+ const [a, n] = vt(String(e)), u = l.unit ? ` ${l.unit}` : "", p = (g) => `${l.unit ? t.formatNumber(Number(g)) : g}${u}`;
94
+ return a !== null && n !== null ? `${p(a)} – ${p(n)}` : a !== null ? `${t.from.toLowerCase()} ${p(a)}` : n !== null ? `${t.until.toLowerCase()} ${p(n)}` : null;
95
95
  }
96
- const s = new Set(String(e).split(","));
97
- return (t.options ?? []).find((r) => s.has(String(r.value)))?.label ?? String(e);
96
+ const i = new Set(String(e).split(","));
97
+ return (l.options ?? []).find((a) => i.has(String(a.value)))?.label ?? String(e);
98
98
  }
99
- function _t(t, e, l) {
100
- const s = new Set(t.map((c) => c.key)), r = (c) => t.find((f) => f.dependsOn === c), a = [];
101
- for (const c of t.filter((f) => !f.dependsOn || !s.has(f.dependsOn))) {
102
- const f = [];
103
- for (let v = c; v && !f.includes(v); v = r(v.key)) f.push(v);
104
- const b = f.map((v) => ({ filter: v, value: Kt(v, e[v.key], l) })).filter((v) => v.value !== null);
105
- b.length !== 0 && a.push({
106
- key: c.key,
107
- label: b.length === 1 ? b[0].filter.label : null,
108
- values: b.map((v) => v.value),
109
- clears: f.map((v) => v.key)
99
+ function mt(l, e, t) {
100
+ const i = new Set(l.map((u) => u.key)), a = (u) => l.find((p) => p.dependsOn === u), n = [];
101
+ for (const u of l.filter((p) => !p.dependsOn || !i.has(p.dependsOn))) {
102
+ const p = [];
103
+ for (let m = u; m && !p.includes(m); m = a(m.key)) p.push(m);
104
+ const g = p.map((m) => ({ filter: m, value: Nt(m, e[m.key], t) })).filter((m) => m.value !== null);
105
+ g.length !== 0 && n.push({
106
+ key: u.key,
107
+ label: g.length === 1 ? g[0].filter.label : null,
108
+ values: g.map((m) => m.value),
109
+ clears: p.map((m) => m.key)
110
110
  });
111
111
  }
112
- return a;
112
+ return n;
113
113
  }
114
- function Xt(t, e) {
115
- return t.filter((l) => !ye(e[l.key])).length;
114
+ function It(l, e) {
115
+ return l.filter((t) => !me(e[t.key])).length;
116
116
  }
117
- const ze = "from";
118
- function Gt(t, e) {
119
- if (typeof t == "string") {
120
- const l = new URLSearchParams(e).toString(), s = t.indexOf("#"), r = s === -1 ? t : t.slice(0, s);
121
- return `${r}${r.includes("?") ? "&" : "?"}${l}${s === -1 ? "" : t.slice(s)}`;
117
+ const xe = "from";
118
+ function qt(l, e) {
119
+ if (typeof l == "string") {
120
+ const t = new URLSearchParams(e).toString(), i = l.indexOf("#"), a = i === -1 ? l : l.slice(0, i);
121
+ return `${a}${a.includes("?") ? "&" : "?"}${t}${i === -1 ? "" : l.slice(i)}`;
122
122
  }
123
- return { ...t, query: { ...t.query, ...e } };
123
+ return { ...l, query: { ...l.query, ...e } };
124
124
  }
125
- function wt(t) {
126
- if (!dt()) return;
127
- const e = ft(Tt, null);
128
- e && Ae(
125
+ function bt(l) {
126
+ if (!at()) return;
127
+ const e = rt(At, null);
128
+ e && Se(
129
129
  () => {
130
- const l = e.session.state.value;
131
- return l.status === "authenticated" ? l.user.id : null;
130
+ const t = e.session.state.value;
131
+ return t.status === "authenticated" ? t.user.id : null;
132
132
  },
133
- t,
133
+ l,
134
134
  { flush: "sync" }
135
135
  );
136
136
  }
137
- const Jt = 4096, Wt = 200, Yt = 32, Qt = 1e6, qe = /^[A-Za-z0-9_.-]{1,64}$/;
138
- function Zt(t) {
137
+ const Dt = 4096, Bt = 200, Ut = 32, Ht = 1e6, Te = /^[A-Za-z0-9_.-]{1,64}$/;
138
+ function Kt(l) {
139
139
  let e = "";
140
- for (const l of new TextEncoder().encode(t)) e += String.fromCharCode(l);
140
+ for (const t of new TextEncoder().encode(l)) e += String.fromCharCode(t);
141
141
  return btoa(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
142
142
  }
143
- function el(t) {
144
- const e = t.replace(/-/g, "+").replace(/_/g, "/"), l = atob(e.padEnd(Math.ceil(e.length / 4) * 4, "="));
145
- return new TextDecoder("utf-8", { fatal: !0 }).decode(Uint8Array.from(l, (s) => s.charCodeAt(0)));
143
+ function Xt(l) {
144
+ const e = l.replace(/-/g, "+").replace(/_/g, "/"), t = atob(e.padEnd(Math.ceil(e.length / 4) * 4, "="));
145
+ return new TextDecoder("utf-8", { fatal: !0 }).decode(Uint8Array.from(t, (i) => i.charCodeAt(0)));
146
146
  }
147
- const Be = (t) => typeof t == "object" && t !== null && !Array.isArray(t);
148
- function Oe(t, e = Wt) {
149
- return typeof t == "string" && t.length <= e ? t : null;
147
+ const Me = (l) => typeof l == "object" && l !== null && !Array.isArray(l);
148
+ function ze(l, e = Bt) {
149
+ return typeof l == "string" && l.length <= e ? l : null;
150
150
  }
151
- function tt(t, e) {
152
- const { defaults: l, contract: s } = t, r = typeof e.p == "number" && Number.isInteger(e.p) && e.p >= 1 && e.p <= Qt ? e.p : l.page, a = typeof e.l == "number" && s.pageSizes.includes(e.l) ? e.l : l.pageSize;
153
- let c = l.sort;
154
- const f = Oe(e.c, 64);
155
- f !== null && (s.sorts ? s.sorts.includes(f) : qe.test(f)) && (c = f);
156
- const b = e.d === "asc" || e.d === "desc" ? e.d : l.direction, v = Oe(e.s) ?? l.search;
157
- let x = l.view;
158
- const S = Oe(e.w, 64);
159
- S !== null && (s.views ? s.views.includes(S) : qe.test(S)) && (x = S);
160
- const D = Be(e.f) ? {} : { ...l.filters };
161
- if (Be(e.f)) {
162
- let P = 0;
163
- for (const [j, A] of Object.entries(e.f)) {
164
- if (++P > Yt) break;
165
- if (!(s.filters ? s.filters.includes(j) : qe.test(j)) || s.sensitive.includes(j)) continue;
166
- const k = typeof A == "number" || typeof A == "boolean" ? String(A) : Oe(A);
167
- k !== null && k !== "" && (D[j] = k);
151
+ function We(l, e) {
152
+ const { defaults: t, contract: i } = l, a = typeof e.p == "number" && Number.isInteger(e.p) && e.p >= 1 && e.p <= Ht ? e.p : t.page, n = typeof e.l == "number" && i.pageSizes.includes(e.l) ? e.l : t.pageSize;
153
+ let u = t.sort;
154
+ const p = ze(e.c, 64);
155
+ p !== null && (i.sorts ? i.sorts.includes(p) : Te.test(p)) && (u = p);
156
+ const g = e.d === "asc" || e.d === "desc" ? e.d : t.direction, m = ze(e.s) ?? t.search;
157
+ let $ = t.view;
158
+ const S = ze(e.w, 64);
159
+ S !== null && (i.views ? i.views.includes(S) : Te.test(S)) && ($ = S);
160
+ const N = Me(e.f) ? {} : { ...t.filters };
161
+ if (Me(e.f)) {
162
+ let k = 0;
163
+ for (const [L, z] of Object.entries(e.f)) {
164
+ if (++k > Ut) break;
165
+ if (!(i.filters ? i.filters.includes(L) : Te.test(L)) || i.sensitive.includes(L)) continue;
166
+ const x = typeof z == "number" || typeof z == "boolean" ? String(z) : ze(z);
167
+ x !== null && x !== "" && (N[L] = x);
168
168
  }
169
169
  }
170
- return { page: r, pageSize: a, sort: c, direction: b, search: v, view: x, filters: D };
170
+ return { page: a, pageSize: n, sort: u, direction: g, search: m, view: $, filters: N };
171
171
  }
172
- function Pe(t, e) {
173
- const l = { v: t.stateVersion, p: e.page, l: e.pageSize };
174
- e.sort && (l.c = e.sort), l.d = e.direction, e.search && (l.s = e.search), e.view && (l.w = e.view);
175
- const s = Object.fromEntries(
176
- Object.entries(e.filters).filter(([r, a]) => a !== void 0 && a !== "" && !t.contract.sensitive.includes(r))
172
+ function $e(l, e) {
173
+ const t = { v: l.stateVersion, p: e.page, l: e.pageSize };
174
+ e.sort && (t.c = e.sort), t.d = e.direction, e.search && (t.s = e.search), e.view && (t.w = e.view);
175
+ const i = Object.fromEntries(
176
+ Object.entries(e.filters).filter(([a, n]) => n !== void 0 && n !== "" && !l.contract.sensitive.includes(a))
177
177
  );
178
- return (Object.keys(s).length > 0 || Object.keys(t.defaults.filters).length > 0) && (l.f = s), Zt(JSON.stringify(l));
178
+ return (Object.keys(i).length > 0 || Object.keys(l.defaults.filters).length > 0) && (t.f = i), Kt(JSON.stringify(t));
179
179
  }
180
- function kt(t, e) {
181
- const l = e.v === void 0 ? t.stateVersion : e.v;
182
- if (typeof l != "number" || !Number.isInteger(l)) return null;
183
- if (l === t.stateVersion) return tt(t, e);
184
- const s = t.migrate?.(e, l);
185
- return s ? tt(t, s) : null;
180
+ function gt(l, e) {
181
+ const t = e.v === void 0 ? l.stateVersion : e.v;
182
+ if (typeof t != "number" || !Number.isInteger(t)) return null;
183
+ if (t === l.stateVersion) return We(l, e);
184
+ const i = l.migrate?.(e, t);
185
+ return i ? We(l, i) : null;
186
186
  }
187
- function He(t, e) {
188
- if (typeof e != "string" || e === "" || e.length > Jt) return null;
189
- let l;
187
+ function Ne(l, e) {
188
+ if (typeof e != "string" || e === "" || e.length > Dt) return null;
189
+ let t;
190
190
  try {
191
- l = JSON.parse(el(e));
191
+ t = JSON.parse(Xt(e));
192
192
  } catch {
193
193
  return null;
194
194
  }
195
- return Be(l) ? kt(t, l) : null;
195
+ return Me(t) ? gt(l, t) : null;
196
196
  }
197
- function tl(t) {
197
+ function Gt(l) {
198
198
  return JSON.stringify([
199
- t.page,
200
- t.pageSize,
201
- t.sort,
202
- t.direction,
203
- t.search,
204
- t.view,
205
- Object.entries(t.filters).sort(([e], [l]) => e.localeCompare(l))
199
+ l.page,
200
+ l.pageSize,
201
+ l.sort,
202
+ l.direction,
203
+ l.search,
204
+ l.view,
205
+ Object.entries(l.filters).sort(([e], [t]) => e.localeCompare(t))
206
206
  ]);
207
207
  }
208
- const lt = /* @__PURE__ */ new WeakMap();
209
- function ll(t, e, l, s) {
210
- let r = lt.get(t);
211
- r || lt.set(t, r = /* @__PURE__ */ new Map());
212
- const a = `${l}\0${s}`, c = r.get(a);
213
- if (c && c.id !== e)
208
+ const Ye = /* @__PURE__ */ new WeakMap();
209
+ function Jt(l, e, t, i) {
210
+ let a = Ye.get(l);
211
+ a || Ye.set(l, a = /* @__PURE__ */ new Map());
212
+ const n = `${t}\0${i}`, u = a.get(n);
213
+ if (u && u.id !== e)
214
214
  throw new Error(
215
- `useCollection("${e}"): the URL state key "${s}" is already used by the list "${c.id}" on this page. Two lists on one page each need their own \`state: { kind: "url", key }\`, or they overwrite each other's state.`
215
+ `useCollection("${e}"): the URL state key "${i}" is already used by the list "${u.id}" on this page. Two lists on one page each need their own \`state: { kind: "url", key }\`, or they overwrite each other's state.`
216
216
  );
217
- const f = c ?? { id: e, count: 0 };
218
- return f.count++, r.set(a, f), () => {
219
- --f.count <= 0 && r.delete(a);
217
+ const p = u ?? { id: e, count: 0 };
218
+ return p.count++, a.set(n, p), () => {
219
+ --p.count <= 0 && a.delete(n);
220
220
  };
221
221
  }
222
- const De = (t) => t.status === "loaded" || t.status === "refreshing" || t.status === "stale", ot = (t) => t instanceof Error && t.message !== "" ? t.message : String(t);
223
- function ds(t, e) {
224
- const l = `useCollection("${t.id}")`, s = e.state;
225
- let r = null, a = "", c = "", f = () => {
222
+ const Ve = (l) => l.status === "loaded" || l.status === "refreshing" || l.status === "stale", Qe = (l) => l instanceof Error && l.message !== "" ? l.message : String(l);
223
+ function rs(l, e) {
224
+ const t = `useCollection("${l.id}")`, i = e.state;
225
+ let a = null, n = "", u = "", p = () => {
226
226
  };
227
- if (s.kind === "url") {
228
- if (r = dt() ? ft(Et, null) : null, !r) throw new Error(`${l}: a URL state needs the application's router. Call it while a component is being set up, with the router installed, or use \`state: { kind: "memory" }\`.`);
229
- if (!s.key) throw new Error(`${l}: \`state.key\` must not be empty.`);
230
- c = s.key, a = r.currentRoute.value.path, f = ll(r, t.id, a, c);
227
+ if (i.kind === "url") {
228
+ if (a = at() ? rt($t, null) : null, !a) throw new Error(`${t}: a URL state needs the application's router. Call it while a component is being set up, with the router installed, or use \`state: { kind: "memory" }\`.`);
229
+ if (!i.key) throw new Error(`${t}: \`state.key\` must not be empty.`);
230
+ u = i.key, n = a.currentRoute.value.path, p = Jt(a, l.id, n, u);
231
231
  }
232
- const b = (() => {
233
- if (!r) return t.defaults;
234
- const o = r.currentRoute.value.query[c];
235
- return He(t, Array.isArray(o) ? o[0] : o) ?? t.defaults;
236
- })(), v = $e(b), x = $e({ status: "loading" }), S = $e(null), D = $e(null), P = _(() => De(x.value) ? x.value.value : D.value);
237
- let j = !1, A = null, U = 0, k = !1;
232
+ const g = (() => {
233
+ if (!a) return l.defaults;
234
+ const o = a.currentRoute.value.query[u];
235
+ return Ne(l, Array.isArray(o) ? o[0] : o) ?? l.defaults;
236
+ })(), m = we(g), $ = we({ status: "loading" }), S = we(null), N = we(null), k = h(() => Ve($.value) ? $.value.value : N.value);
237
+ let L = !1, z = null, D = 0, x = !1;
238
238
  const R = [];
239
- r && e.linked && H(r.currentRoute.value.query, e.linked);
240
- function H(o, u) {
241
- let V = v.value;
242
- const X = (ee) => {
243
- const G = o[ee], fe = Array.isArray(G) ? G[0] : G;
244
- return typeof fe == "string" && fe !== "" ? fe : null;
239
+ a && e.linked && B(a.currentRoute.value.query, e.linked);
240
+ function B(o, f) {
241
+ let F = m.value;
242
+ const G = (te) => {
243
+ const J = o[te], pe = Array.isArray(J) ? J[0] : J;
244
+ return typeof pe == "string" && pe !== "" ? pe : null;
245
245
  };
246
- if (u.view) {
247
- const ee = X(u.view), G = ee !== null && (t.contract.views ? t.contract.views.includes(ee) : !0);
248
- ee !== null && G && (V = { ...V, view: ee, page: 1 }, R.push(u.view));
246
+ if (f.view) {
247
+ const te = G(f.view), J = te !== null && (l.contract.views ? l.contract.views.includes(te) : !0);
248
+ te !== null && J && (F = { ...F, view: te, page: 1 }, R.push(f.view));
249
249
  }
250
- for (const [ee, G] of Object.entries(u.params ?? {})) {
251
- const fe = X(ee);
252
- if (fe === null) continue;
253
- const K = typeof G == "string" ? G : G.filter, Q = typeof G == "string" ? fe : G.value(fe), se = { ...V.filters };
254
- Q === null || Q === "any" || Q === "" ? delete se[K] : se[K] = String(Q), V = { ...V, filters: se, page: 1 }, R.push(ee);
250
+ for (const [te, J] of Object.entries(f.params ?? {})) {
251
+ const pe = G(te);
252
+ if (pe === null) continue;
253
+ const Q = typeof J == "string" ? J : J.filter, Z = typeof J == "string" ? pe : J.value(pe), se = { ...F.filters };
254
+ Z === null || Z === "any" || Z === "" ? delete se[Q] : se[Q] = String(Z), F = { ...F, filters: se, page: 1 }, R.push(te);
255
255
  }
256
256
  if (R.length > 0) {
257
- for (const ee of u.consume ?? []) ee in o && R.push(ee);
258
- v.value = V;
257
+ for (const te of f.consume ?? []) te in o && R.push(te);
258
+ m.value = F;
259
259
  }
260
260
  }
261
- async function Y(o) {
262
- if (j) return;
263
- A?.abort();
264
- const u = ++U, V = A = new AbortController(), X = x.value, ee = v.value;
265
- x.value = o && De(X) ? { status: "refreshing", value: X.value } : { status: "loading" };
261
+ async function K(o) {
262
+ if (L) return;
263
+ z?.abort();
264
+ const f = ++D, F = z = new AbortController(), G = $.value, te = m.value;
265
+ $.value = o && Ve(G) ? { status: "refreshing", value: G.value } : { status: "loading" };
266
266
  try {
267
- const G = await t.load(ee, { signal: V.signal });
268
- if (u !== U) return;
269
- if (G.lastPage >= 1 && ee.page > G.lastPage) {
270
- v.value = { ...ee, page: G.lastPage }, N(), Y(!1);
267
+ const J = await l.load(te, { signal: F.signal });
268
+ if (f !== D) return;
269
+ if (J.lastPage >= 1 && te.page > J.lastPage) {
270
+ m.value = { ...te, page: J.lastPage }, T(), K(!1);
271
271
  return;
272
272
  }
273
- S.value = null, D.value = G, x.value = { status: "loaded", value: G };
274
- } catch (G) {
275
- if (u !== U || V.signal.aborted || Me(G)) return;
276
- S.value = G, x.value = o && De(X) ? { status: "stale", value: X.value, error: ot(G) } : { status: "failed", error: ot(G) };
273
+ S.value = null, N.value = J, $.value = { status: "loaded", value: J };
274
+ } catch (J) {
275
+ if (f !== D || F.signal.aborted || Oe(J)) return;
276
+ S.value = J, $.value = o && Ve(G) ? { status: "stale", value: G.value, error: Qe(J) } : { status: "failed", error: Qe(J) };
277
277
  }
278
278
  }
279
- function F() {
280
- N(), !(k || j) && (k = !0, queueMicrotask(() => {
281
- k && (k = !1, Y(!1));
279
+ function M() {
280
+ T(), !(x || L) && (x = !0, queueMicrotask(() => {
281
+ x && (x = !1, K(!1));
282
282
  }));
283
283
  }
284
- function re() {
285
- return k = !1, Y(!0);
284
+ function ee() {
285
+ return x = !1, K(!0);
286
286
  }
287
- let te = !1, C = !1, T = !1;
288
- function N() {
289
- !r || te || j || (te = !0, queueMicrotask(() => {
290
- te = !1, E();
287
+ let O = !1, A = !1, I = !1;
288
+ function T() {
289
+ !a || O || L || (O = !0, queueMicrotask(() => {
290
+ O = !1, b();
291
291
  }));
292
292
  }
293
- async function E() {
294
- if (r) {
295
- if (C) {
296
- T = !0;
293
+ async function b() {
294
+ if (a) {
295
+ if (A) {
296
+ I = !0;
297
297
  return;
298
298
  }
299
- C = !0;
299
+ A = !0;
300
300
  try {
301
301
  do {
302
- T = !1;
303
- const o = r.currentRoute.value;
304
- if (j || o.path !== a) return;
305
- const u = Pe(t, v.value), V = { ...o.query };
306
- for (const X of R.splice(0)) delete V[X];
307
- o.query[c] === u && Object.keys(V).length === Object.keys(o.query).length || await r.replace({ query: { ...V, [c]: u }, hash: o.hash });
308
- } while (T);
302
+ I = !1;
303
+ const o = a.currentRoute.value;
304
+ if (L || o.path !== n) return;
305
+ const f = $e(l, m.value), F = { ...o.query };
306
+ for (const G of R.splice(0)) delete F[G];
307
+ o.query[u] === f && Object.keys(F).length === Object.keys(o.query).length || await a.replace({ query: { ...F, [u]: f }, hash: o.hash });
308
+ } while (I);
309
309
  } catch {
310
310
  } finally {
311
- C = !1;
311
+ A = !1;
312
312
  }
313
313
  }
314
314
  }
315
- const z = r ? Ae(
316
- () => r.currentRoute.value.query[c],
315
+ const C = a ? Se(
316
+ () => a.currentRoute.value.query[u],
317
317
  (o) => {
318
- const u = r.currentRoute.value;
319
- if (j || C || u.path !== a) return;
320
- const V = Array.isArray(o) ? o[0] : o, X = He(t, V) ?? t.defaults;
321
- JSON.stringify(X) !== JSON.stringify(v.value) ? (v.value = X, F()) : N();
318
+ const f = a.currentRoute.value;
319
+ if (L || A || f.path !== n) return;
320
+ const F = Array.isArray(o) ? o[0] : o, G = Ne(l, F) ?? l.defaults;
321
+ JSON.stringify(G) !== JSON.stringify(m.value) ? (m.value = G, M()) : T();
322
322
  }
323
323
  ) : () => {
324
- }, q = (o, u = !1) => {
325
- v.value = { ...v.value, ...o, ...u ? { page: 1 } : {} }, F();
326
- }, de = (o) => {
327
- const u = { ...v.value.filters };
328
- for (const [V, X] of Object.entries(o))
329
- X == null || ye(X) ? delete u[V] : u[V] = String(X);
330
- return u;
331
- }, me = _(() => v.value.search !== "" || Object.values(v.value.filters).some((o) => !ye(o))), ve = _(() => P.value?.rows ?? []), ae = _(() => {
332
- const o = x.value;
333
- return o.status === "loading" ? "loading" : o.status === "failed" ? "failed" : o.value.rows.length > 0 ? "rows" : me.value ? "no-matches" : "empty";
334
- }), ge = _(() => {
335
- const o = new Map((P.value?.views ?? []).map((u) => [u.key, u.count]));
336
- return (Ie(e.views) ?? []).map((u) => o.has(u.key) ? { ...u, count: o.get(u.key) } : u);
324
+ }, E = (o, f = !1) => {
325
+ m.value = { ...m.value, ...o, ...f ? { page: 1 } : {} }, M();
326
+ }, ie = (o) => {
327
+ const f = { ...m.value.filters };
328
+ for (const [F, G] of Object.entries(o))
329
+ G == null || me(G) ? delete f[F] : f[F] = String(G);
330
+ return f;
331
+ }, de = h(() => m.value.search !== "" || Object.values(m.value.filters).some((o) => !me(o))), ce = h(() => k.value?.rows ?? []), re = h(() => {
332
+ const o = $.value;
333
+ return o.status === "loading" ? "loading" : o.status === "failed" ? "failed" : o.value.rows.length > 0 ? "rows" : de.value ? "no-matches" : "empty";
334
+ }), fe = h(() => {
335
+ const o = new Map((k.value?.views ?? []).map((f) => [f.key, f.count]));
336
+ return (Re(e.views) ?? []).map((f) => o.has(f.key) ? { ...f, count: o.get(f.key) } : f);
337
337
  });
338
- let oe = () => {
338
+ let ne = () => {
339
339
  };
340
- const ie = e.savedViews ? h(e.savedViews) : null;
341
- function ce(o) {
342
- const u = { v: o.state.version, f: o.state.filters, s: o.state.search, w: o.state.view ?? void 0 };
343
- return kt(t, u);
340
+ const w = e.savedViews ? r(e.savedViews) : null;
341
+ function U(o) {
342
+ const f = { v: o.state.version, f: o.state.filters, s: o.state.search, w: o.state.view ?? void 0 };
343
+ return gt(l, f);
344
344
  }
345
- function h(o) {
346
- const u = ue([]), V = ue("idle");
347
- let X = null;
348
- const ee = (K, Q) => K.name.localeCompare(Q.name), G = _(() => u.value.filter((K) => ce(K) !== null));
349
- oe = () => {
350
- X?.abort(), u.value = [], V.value = "idle";
345
+ function r(o) {
346
+ const f = ae([]), F = ae("idle");
347
+ let G = null;
348
+ const te = (Q, Z) => Q.name.localeCompare(Z.name), J = h(() => f.value.filter((Q) => U(Q) !== null));
349
+ ne = () => {
350
+ G?.abort(), f.value = [], F.value = "idle";
351
351
  };
352
- const fe = () => ({
353
- version: t.stateVersion,
354
- filters: Object.fromEntries(Object.entries(v.value.filters).filter(([K, Q]) => Q !== void 0 && !t.contract.sensitive.includes(K))),
355
- search: v.value.search,
356
- view: v.value.view
352
+ const pe = () => ({
353
+ version: l.stateVersion,
354
+ filters: Object.fromEntries(Object.entries(m.value.filters).filter(([Q, Z]) => Z !== void 0 && !l.contract.sensitive.includes(Q))),
355
+ search: m.value.search,
356
+ view: m.value.view
357
357
  });
358
358
  return {
359
- items: G,
360
- status: V,
359
+ items: J,
360
+ status: F,
361
361
  async load() {
362
- X?.abort();
363
- const K = X = new AbortController();
364
- V.value = "loading";
362
+ G?.abort();
363
+ const Q = G = new AbortController();
364
+ F.value = "loading";
365
365
  try {
366
- const Q = await o.list(t.id, { signal: K.signal });
367
- if (K.signal.aborted) return;
368
- u.value = [...Q].sort(ee), V.value = "ready";
369
- } catch (Q) {
370
- if (K.signal.aborted || Me(Q)) return;
371
- V.value = "failed";
366
+ const Z = await o.list(l.id, { signal: Q.signal });
367
+ if (Q.signal.aborted) return;
368
+ f.value = [...Z].sort(te), F.value = "ready";
369
+ } catch (Z) {
370
+ if (Q.signal.aborted || Oe(Z)) return;
371
+ F.value = "failed";
372
372
  }
373
373
  },
374
- current: fe,
375
- async save(K, Q) {
376
- const se = await o.save(t.id, K, { ...fe(), ...Q });
377
- return u.value = [...u.value.filter((Ee) => Ee.id !== se.id), se].sort(ee), se;
374
+ current: pe,
375
+ async save(Q, Z) {
376
+ const se = await o.save(l.id, Q, { ...pe(), ...Z });
377
+ return f.value = [...f.value.filter((_t) => _t.id !== se.id), se].sort(te), se;
378
378
  },
379
- apply(K) {
380
- const Q = ce(K);
381
- Q && q({ filters: Q.filters, search: Q.search, view: K.state.view ? Q.view : v.value.view }, !0);
379
+ apply(Q) {
380
+ const Z = U(Q);
381
+ Z && E({ filters: Z.filters, search: Z.search, view: Q.state.view ? Z.view : m.value.view }, !0);
382
382
  },
383
- stageRemoval(K) {
384
- const Q = u.value.find((se) => se.id === K) ?? null;
385
- return u.value = u.value.filter((se) => se.id !== K), {
383
+ stageRemoval(Q) {
384
+ const Z = f.value.find((se) => se.id === Q) ?? null;
385
+ return f.value = f.value.filter((se) => se.id !== Q), {
386
386
  revert() {
387
- Q && !u.value.some((se) => se.id === K) && (u.value = [...u.value, Q].sort(ee));
387
+ Z && !f.value.some((se) => se.id === Q) && (f.value = [...f.value, Z].sort(te));
388
388
  },
389
389
  // Saved again under the same name while the toast was up: the server replaced that very row, it must not be deleted now.
390
390
  async commit() {
391
- u.value.some((se) => se.id === K) || await o.remove(t.id, K);
391
+ f.value.some((se) => se.id === Q) || await o.remove(l.id, Q);
392
392
  }
393
393
  };
394
394
  }
395
395
  };
396
396
  }
397
- function w() {
398
- j || (j = !0, A?.abort(), U++, z(), f());
397
+ function _() {
398
+ L || (L = !0, z?.abort(), D++, C(), p());
399
399
  }
400
- return Ke() && Xe(w), wt((o) => {
401
- A?.abort(), U++, x.value = { status: "loading" }, D.value = null, S.value = null, oe(), o !== null && F();
402
- }), F(), {
403
- id: t.id,
404
- pageSizes: t.contract.pageSizes,
405
- rowKey: (o) => t.key(o),
406
- state: x,
407
- query: v,
408
- page: P,
409
- rows: ve,
410
- total: _(() => P.value?.total ?? 0),
411
- display: ae,
412
- isFiltered: me,
400
+ return Ie() && qe(_), bt((o) => {
401
+ z?.abort(), D++, $.value = { status: "loading" }, N.value = null, S.value = null, ne(), o !== null && M();
402
+ }), M(), {
403
+ id: l.id,
404
+ pageSizes: l.contract.pageSizes,
405
+ rowKey: (o) => l.key(o),
406
+ state: $,
407
+ query: m,
408
+ page: k,
409
+ rows: ce,
410
+ total: h(() => k.value?.total ?? 0),
411
+ display: re,
412
+ isFiltered: de,
413
413
  error: S,
414
- columns: _(() => {
415
- const o = Ie(e.columns) ?? [], u = t.contract.sorts;
416
- if (u) {
417
- for (const V of o) if (V.sort !== void 0 && !u.includes(V.sort)) throw new Error(`${l}: column "${V.key}" sorts by "${V.sort}", which is not in the query contract's sorts (${u.join(", ")}).`);
414
+ columns: h(() => {
415
+ const o = Re(e.columns) ?? [], f = l.contract.sorts;
416
+ if (f) {
417
+ for (const F of o) if (F.sort !== void 0 && !f.includes(F.sort)) throw new Error(`${t}: column "${F.key}" sorts by "${F.sort}", which is not in the query contract's sorts (${f.join(", ")}).`);
418
418
  }
419
419
  return o;
420
420
  }),
421
- filters: _(() => Ie(e.filters) ?? []),
422
- views: ge,
423
- savedViews: ie,
424
- refresh: re,
421
+ filters: h(() => Re(e.filters) ?? []),
422
+ views: fe,
423
+ savedViews: w,
424
+ refresh: ee,
425
425
  goToPage: (o) => {
426
- Number.isInteger(o) && o >= 1 && o !== v.value.page && q({ page: o });
426
+ Number.isInteger(o) && o >= 1 && o !== m.value.page && E({ page: o });
427
427
  },
428
428
  nextPage: () => {
429
- const o = P.value?.lastPage ?? 0;
430
- v.value.page < o && q({ page: v.value.page + 1 });
429
+ const o = k.value?.lastPage ?? 0;
430
+ m.value.page < o && E({ page: m.value.page + 1 });
431
431
  },
432
432
  previousPage: () => {
433
- v.value.page > 1 && q({ page: v.value.page - 1 });
433
+ m.value.page > 1 && E({ page: m.value.page - 1 });
434
434
  },
435
435
  setPageSize: (o) => {
436
- t.contract.pageSizes.includes(o) && o !== v.value.pageSize && q({ pageSize: o }, !0);
436
+ l.contract.pageSizes.includes(o) && o !== m.value.pageSize && E({ pageSize: o }, !0);
437
437
  },
438
- sortBy: (o, u = "asc") => {
439
- if (t.contract.sorts && !t.contract.sorts.includes(o)) throw new Error(`${l}: "${o}" is not in the query contract's sorts.`);
440
- q({ sort: o, direction: u });
438
+ sortBy: (o, f = "asc") => {
439
+ if (l.contract.sorts && !l.contract.sorts.includes(o)) throw new Error(`${t}: "${o}" is not in the query contract's sorts.`);
440
+ E({ sort: o, direction: f });
441
441
  },
442
442
  toggleSort: (o) => {
443
- const u = v.value;
444
- q({ sort: o, direction: u.sort === o && u.direction === "asc" ? "desc" : "asc" });
443
+ const f = m.value;
444
+ E({ sort: o, direction: f.sort === o && f.direction === "asc" ? "desc" : "asc" });
445
445
  },
446
- search: (o) => q({ search: o }, !0),
447
- setFilter: (o, u) => q({ filters: de({ [o]: u }) }, !0),
448
- setFilters: (o) => q({ filters: de(o) }, !0),
449
- clearFilters: () => q({ filters: {}, search: "" }, !0),
450
- setView: (o) => q({ view: o }, !0),
446
+ search: (o) => E({ search: o }, !0),
447
+ setFilter: (o, f) => E({ filters: ie({ [o]: f }) }, !0),
448
+ setFilters: (o) => E({ filters: ie(o) }, !0),
449
+ clearFilters: () => E({ filters: {}, search: "" }, !0),
450
+ setView: (o) => E({ view: o }, !0),
451
451
  reset: () => {
452
- v.value = t.defaults, F();
452
+ m.value = l.defaults, M();
453
453
  },
454
454
  recordLocation: (o) => {
455
- const u = e.recordRoute?.(o);
456
- return u ? r ? Gt(u, { [ze]: Pe(t, v.value) }) : u : null;
455
+ const f = e.recordRoute?.(o);
456
+ return f ? a ? qt(f, { [xe]: $e(l, m.value) }) : f : null;
457
457
  },
458
- linkContext: () => r ? { [ze]: Pe(t, v.value) } : {}
458
+ linkContext: () => a ? { [xe]: $e(l, m.value) } : {}
459
459
  };
460
460
  }
461
- const Le = (t) => typeof t == "object" && t !== null && !Array.isArray(t), xe = (...t) => {
462
- for (const e of t) if (typeof e == "number" && Number.isFinite(e)) return e;
461
+ const Ae = (l) => typeof l == "object" && l !== null && !Array.isArray(l), ye = (...l) => {
462
+ for (const e of l) if (typeof e == "number" && Number.isFinite(e)) return e;
463
463
  return null;
464
464
  };
465
- function ol(t) {
465
+ function Wt(l) {
466
466
  return {
467
467
  // Filters first: the reserved names below always win, a filter called "page" cannot break paging.
468
- ...t.filters,
469
- page: t.page,
470
- per_page: t.pageSize,
471
- order_col: t.sort,
472
- order_dir: t.sort ? t.direction : null,
473
- search: t.search,
474
- view: t.view
468
+ ...l.filters,
469
+ page: l.page,
470
+ per_page: l.pageSize,
471
+ order_col: l.sort,
472
+ order_dir: l.sort ? l.direction : null,
473
+ search: l.search,
474
+ view: l.view
475
475
  };
476
476
  }
477
- function nl(t, e) {
478
- const l = t.data, s = Le(l) && Array.isArray(l.data), r = Array.isArray(l) ? l : s ? l.data : [], a = s ? l : {}, c = Le(t.meta) ? t.meta : Le(a.meta) ? a.meta : {}, f = xe(a.per_page, c.per_page) ?? e.pageSize, b = xe(a.total, c.total) ?? r.length, v = xe(a.current_page, c.page, c.current_page) ?? e.page, x = xe(a.last_page, c.last_page) ?? (b === 0 ? 0 : Math.ceil(b / Math.max(1, f))), S = xe(a.from, c.from) ?? (r.length === 0 ? 0 : (v - 1) * f + 1), D = xe(a.to, c.to) ?? (r.length === 0 ? 0 : S + r.length - 1), P = Array.isArray(c.views) ? c.views : Array.isArray(a.views) ? a.views : void 0;
477
+ function Yt(l, e) {
478
+ const t = l.data, i = Ae(t) && Array.isArray(t.data), a = Array.isArray(t) ? t : i ? t.data : [], n = i ? t : {}, u = Ae(l.meta) ? l.meta : Ae(n.meta) ? n.meta : {}, p = ye(n.per_page, u.per_page) ?? e.pageSize, g = ye(n.total, u.total) ?? a.length, m = ye(n.current_page, u.page, u.current_page) ?? e.page, $ = ye(n.last_page, u.last_page) ?? (g === 0 ? 0 : Math.ceil(g / Math.max(1, p))), S = ye(n.from, u.from) ?? (a.length === 0 ? 0 : (m - 1) * p + 1), N = ye(n.to, u.to) ?? (a.length === 0 ? 0 : S + a.length - 1), k = Array.isArray(u.views) ? u.views : Array.isArray(n.views) ? n.views : void 0;
479
479
  return {
480
- rows: r,
481
- total: b,
482
- page: v,
483
- pageSize: f,
484
- lastPage: x,
480
+ rows: a,
481
+ total: g,
482
+ page: m,
483
+ pageSize: p,
484
+ lastPage: $,
485
485
  from: S,
486
- to: D,
487
- views: P?.filter(Le).flatMap((j) => typeof j.key == "string" ? [{ key: j.key, count: xe(j.count) ?? void 0 }] : []),
488
- meta: c,
489
- requestId: t.requestId
486
+ to: N,
487
+ views: k?.filter(Ae).flatMap((L) => typeof L.key == "string" ? [{ key: L.key, count: ye(L.count) ?? void 0 }] : []),
488
+ meta: u,
489
+ requestId: l.requestId
490
490
  };
491
491
  }
492
- function fs(t, e, l = {}) {
493
- return async (s, { signal: r }) => {
494
- const a = await t.get(e, { query: l.params ? l.params(s) : ol(s), signal: r });
495
- return nl(a, s);
492
+ function is(l, e, t = {}) {
493
+ return async (i, { signal: a }) => {
494
+ const n = await l.get(e, { query: t.params ? t.params(i) : Wt(i), signal: a });
495
+ return Yt(n, i);
496
496
  };
497
497
  }
498
- const sl = 8;
499
- function ps(t, e) {
500
- const l = jt(), s = e.from ?? (() => typeof l.query[ze] == "string" ? l.query[ze] : null), r = e.stateKey ?? "query", a = ue(null), c = ue(0), f = $e(null), b = $e(null), v = ue(!1), x = $e(null), S = /* @__PURE__ */ new Map();
501
- let D = 0, P = new AbortController(), j = !1;
502
- function A(F, re, te) {
503
- const C = { ...F, page: re }, T = tl(C);
504
- let N = S.get(T);
505
- for (N ? S.delete(T) : (N = (async () => t.load(C, { signal: te }))(), N.catch(() => {
506
- S.get(T) === N && S.delete(T);
507
- })), S.set(T, N); S.size > sl; ) S.delete(S.keys().next().value);
508
- return N.catch((E) => {
509
- if (Me(E)) throw E;
498
+ const Qt = 8;
499
+ function cs(l, e) {
500
+ const t = St(), i = e.from ?? (() => typeof t.query[xe] == "string" ? t.query[xe] : null), a = e.stateKey ?? "query", n = ae(null), u = ae(0), p = we(null), g = we(null), m = ae(!1), $ = we(null), S = /* @__PURE__ */ new Map();
501
+ let N = 0, k = new AbortController(), L = !1;
502
+ function z(M, ee, O) {
503
+ const A = { ...M, page: ee }, I = Gt(A);
504
+ let T = S.get(I);
505
+ for (T ? S.delete(I) : (T = (async () => l.load(A, { signal: O }))(), T.catch(() => {
506
+ S.get(I) === T && S.delete(I);
507
+ })), S.set(I, T); S.size > Qt; ) S.delete(S.keys().next().value);
508
+ return T.catch((b) => {
509
+ if (Oe(b)) throw b;
510
510
  return null;
511
511
  });
512
512
  }
513
- function U() {
514
- a.value = null, f.value = null, b.value = null, c.value = 0, x.value = null;
513
+ function D() {
514
+ n.value = null, p.value = null, g.value = null, u.value = 0, $.value = null;
515
515
  }
516
- async function k() {
517
- const F = ++D, re = P.signal, te = He(t, s()), C = e.current();
518
- if (!te || C === null || C === void 0 || C === "") {
519
- U(), v.value = !1;
516
+ async function x() {
517
+ const M = ++N, ee = k.signal, O = Ne(l, i()), A = e.current();
518
+ if (!O || A === null || A === void 0 || A === "") {
519
+ D(), m.value = !1;
520
520
  return;
521
521
  }
522
- v.value = !0, f.value = null, b.value = null;
523
- const T = (E) => E ? E.rows.findIndex((z) => String(t.key(z)) === String(C)) : -1, N = (E, z) => {
524
- const q = Pe(t, { ...te, page: E });
525
- return { key: z, to: { name: l.name ?? void 0, params: { ...l.params, [e.param]: String(z) }, query: { ...l.query, [ze]: q }, hash: l.hash } };
522
+ m.value = !0, p.value = null, g.value = null;
523
+ const I = (b) => b ? b.rows.findIndex((C) => String(l.key(C)) === String(A)) : -1, T = (b, C) => {
524
+ const E = $e(l, { ...O, page: b });
525
+ return { key: C, to: { name: t.name ?? void 0, params: { ...t.params, [e.param]: String(C) }, query: { ...t.query, [xe]: E }, hash: t.hash } };
526
526
  };
527
527
  try {
528
- let E = te.page, z = await A(te, E, re), q = T(z);
529
- for (const oe of [E - 1, E + 1]) {
530
- if (q !== -1 || !z || oe < 1 || oe > z.lastPage) continue;
531
- const ie = await A(te, oe, re), ce = T(ie);
532
- ie && ce !== -1 && (E = oe, z = ie, q = ce);
528
+ let b = O.page, C = await z(O, b, ee), E = I(C);
529
+ for (const ne of [b - 1, b + 1]) {
530
+ if (E !== -1 || !C || ne < 1 || ne > C.lastPage) continue;
531
+ const w = await z(O, ne, ee), U = I(w);
532
+ w && U !== -1 && (b = ne, C = w, E = U);
533
533
  }
534
- if (F !== D) return;
535
- if (!z || q === -1) {
536
- U();
534
+ if (M !== N) return;
535
+ if (!C || E === -1) {
536
+ D();
537
537
  return;
538
538
  }
539
- const de = z.pageSize || te.pageSize, me = z.rows;
540
- let ve = null;
541
- if (q > 0) ve = N(E, t.key(me[q - 1]));
542
- else if (E > 1) {
543
- const oe = await A(te, E - 1, re), ie = oe?.rows[oe.rows.length - 1];
544
- ie !== void 0 && (ve = N(E - 1, t.key(ie)));
539
+ const ie = C.pageSize || O.pageSize, de = C.rows;
540
+ let ce = null;
541
+ if (E > 0) ce = T(b, l.key(de[E - 1]));
542
+ else if (b > 1) {
543
+ const ne = await z(O, b - 1, ee), w = ne?.rows[ne.rows.length - 1];
544
+ w !== void 0 && (ce = T(b - 1, l.key(w)));
545
545
  }
546
- let ae = null;
547
- if (q < me.length - 1) ae = N(E, t.key(me[q + 1]));
548
- else if (E < z.lastPage) {
549
- const ie = (await A(te, E + 1, re))?.rows[0];
550
- ie !== void 0 && (ae = N(E + 1, t.key(ie)));
546
+ let re = null;
547
+ if (E < de.length - 1) re = T(b, l.key(de[E + 1]));
548
+ else if (b < C.lastPage) {
549
+ const w = (await z(O, b + 1, ee))?.rows[0];
550
+ w !== void 0 && (re = T(b + 1, l.key(w)));
551
551
  }
552
- if (F !== D) return;
553
- c.value = z.total, a.value = (E - 1) * de + q + 1, f.value = ve, b.value = ae;
554
- const ge = e.list;
555
- x.value = typeof ge == "string" ? ge : { ...ge, query: { ...ge.query, [r]: Pe(t, { ...te, page: E }) } };
556
- } catch (E) {
557
- if (!Me(E)) throw E;
552
+ if (M !== N) return;
553
+ u.value = C.total, n.value = (b - 1) * ie + E + 1, p.value = ce, g.value = re;
554
+ const fe = e.list;
555
+ $.value = typeof fe == "string" ? fe : { ...fe, query: { ...fe.query, [a]: $e(l, { ...O, page: b }) } };
556
+ } catch (b) {
557
+ if (!Oe(b)) throw b;
558
558
  } finally {
559
- F === D && (v.value = !1);
559
+ M === N && (m.value = !1);
560
560
  }
561
561
  }
562
- const R = Ae([s, e.current], k, { immediate: !0 });
563
- function H() {
564
- j || (j = !0, D++, P.abort(), R(), S.clear());
562
+ const R = Se([i, e.current], x, { immediate: !0 });
563
+ function B() {
564
+ L || (L = !0, N++, k.abort(), R(), S.clear());
565
565
  }
566
- return Ke() && Xe(H), wt(() => {
567
- P.abort(), P = new AbortController(), S.clear(), k();
568
- }), { position: a, total: c, previous: f, next: b, loading: v, listRoute: x, context: {
566
+ return Ie() && qe(B), bt(() => {
567
+ k.abort(), k = new AbortController(), S.clear(), x();
568
+ }), { position: n, total: u, previous: p, next: g, loading: m, listRoute: $, context: {
569
569
  get back() {
570
- return { label: typeof e.backLabel == "function" ? e.backLabel() : e.backLabel, to: x.value ?? e.list };
570
+ return { label: typeof e.backLabel == "function" ? e.backLabel() : e.backLabel, to: $.value ?? e.list };
571
571
  },
572
572
  get neighbors() {
573
- return a.value === null ? null : { position: a.value, total: c.value, previous: f.value?.to ?? null, next: b.value?.to ?? null };
573
+ return n.value === null ? null : { position: n.value, total: u.value, previous: p.value?.to ?? null, next: g.value?.to ?? null };
574
574
  }
575
575
  } };
576
576
  }
577
- function vs(t = {}) {
578
- const e = new Map(Object.entries(t).map(([r, a]) => [r, [...a]]));
579
- let l = 1;
580
- const s = (r) => {
581
- let a = e.get(r);
582
- return a || e.set(r, a = []), a;
577
+ function us(l = {}) {
578
+ const e = new Map(Object.entries(l).map(([a, n]) => [a, [...n]]));
579
+ let t = 1;
580
+ const i = (a) => {
581
+ let n = e.get(a);
582
+ return n || e.set(a, n = []), n;
583
583
  };
584
584
  return {
585
- async list(r) {
586
- return [...s(r)];
585
+ async list(a) {
586
+ return [...i(a)];
587
587
  },
588
- async save(r, a, c) {
589
- const f = s(r), b = f.findIndex((x) => x.name === a), v = { id: b === -1 ? `view-${l++}` : f[b].id, name: a, state: c };
590
- return b === -1 ? f.push(v) : f[b] = v, v;
588
+ async save(a, n, u) {
589
+ const p = i(a), g = p.findIndex(($) => $.name === n), m = { id: g === -1 ? `view-${t++}` : p[g].id, name: n, state: u };
590
+ return g === -1 ? p.push(m) : p[g] = m, m;
591
591
  },
592
- async remove(r, a) {
593
- const c = s(r), f = c.findIndex((b) => b.id === a);
594
- f !== -1 && c.splice(f, 1);
592
+ async remove(a, n) {
593
+ const u = i(a), p = u.findIndex((g) => g.id === n);
594
+ p !== -1 && u.splice(p, 1);
595
595
  }
596
596
  };
597
597
  }
598
- function al(t, e) {
599
- const l = (e ?? "").split(/\s+/).filter((r) => r !== "");
600
- if (l.length === 0 || t === "") return [{ text: t, match: !1 }];
601
- const s = new RegExp(`(${l.sort((r, a) => a.length - r.length).map((r) => r.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})`, "giu");
602
- return t.split(s).flatMap((r, a) => r === "" ? [] : [{ text: r, match: a % 2 === 1 }]);
603
- }
604
- const rl = { class: "flex min-w-0 flex-col" }, il = {
605
- key: 1,
606
- class: "truncate text-row-title"
607
- }, cl = ["data-row-click-ignore"], nt = "rounded-sm bg-status-warning-surface text-status-warning-content", st = /* @__PURE__ */ we({
608
- __name: "RecordIdentity",
609
- props: {
610
- title: {},
611
- subtitle: { default: null },
612
- to: { default: null },
613
- subtitleSelectable: { type: Boolean, default: !1 },
614
- highlight: { default: null }
615
- },
616
- setup(t) {
617
- const e = t, l = _(() => al(e.title, e.highlight));
618
- return (s, r) => (i(), d("div", rl, [
619
- e.to ? (i(), W(n(mt), {
620
- key: 0,
621
- to: e.to,
622
- class: "block truncate rounded-sm text-row-title focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus"
623
- }, {
624
- default: B(() => [
625
- (i(!0), d(I, null, Z(l.value, (a, c) => (i(), d(I, { key: c }, [
626
- a.match ? (i(), d("mark", {
627
- key: 0,
628
- class: le(nt)
629
- }, y(a.text), 1)) : (i(), d(I, { key: 1 }, [
630
- ne(y(a.text), 1)
631
- ], 64))
632
- ], 64))), 128))
633
- ]),
634
- _: 1
635
- }, 8, ["to"])) : (i(), d("span", il, [
636
- (i(!0), d(I, null, Z(l.value, (a, c) => (i(), d(I, { key: c }, [
637
- a.match ? (i(), d("mark", {
638
- key: 0,
639
- class: le(nt)
640
- }, y(a.text), 1)) : (i(), d(I, { key: 1 }, [
641
- ne(y(a.text), 1)
642
- ], 64))
643
- ], 64))), 128))
644
- ])),
645
- e.subtitle ? (i(), d("span", {
646
- key: 2,
647
- "data-row-click-ignore": e.subtitleSelectable ? "" : void 0,
648
- class: le(["truncate text-row-subtitle", { "w-fit cursor-text select-text": e.subtitleSelectable }])
649
- }, y(e.subtitle), 11, cl)) : L("", !0)
650
- ]));
651
- }
652
- });
653
- function xt(t, e) {
654
- let l = t;
655
- for (const s of String(e).split(".")) {
656
- if (typeof l != "object" || l === null) return;
657
- l = l[s];
658
- }
659
- return l;
660
- }
661
- const ul = {
662
- key: 0,
663
- class: "flex items-center gap-3"
664
- }, dl = ["datetime"], fl = {
665
- key: 2,
666
- class: "tabular-nums"
667
- }, pl = {
668
- key: 3,
669
- class: "tabular-nums"
670
- }, Te = /* @__PURE__ */ we({
671
- __name: "CollectionCell",
672
- props: {
673
- column: {},
674
- item: {},
675
- compact: { type: Boolean },
676
- to: {},
677
- search: {}
678
- },
679
- setup(t) {
680
- const e = t, l = Ve(), s = _(() => xt(e.item, e.column.key)), r = _(() => s.value), a = _(() => s.value === null || s.value === void 0 ? "" : String(s.value)), c = _(() => typeof s.value == "number" ? s.value : typeof s.value == "string" && s.value.trim() !== "" ? Number(s.value) : null);
681
- return (f, b) => e.column.kind === "identity" ? (i(), d(I, { key: 0 }, [
682
- !e.compact && f.$slots.leading ? (i(), d("div", ul, [
683
- pe(f.$slots, "leading"),
684
- O(st, {
685
- to: e.to,
686
- title: e.column.title?.(e.item) ?? a.value,
687
- subtitle: e.column.subtitle?.(e.item),
688
- highlight: e.search,
689
- "subtitle-selectable": ""
690
- }, null, 8, ["to", "title", "subtitle", "highlight"])
691
- ])) : (i(), W(st, {
692
- key: 1,
693
- to: e.to,
694
- title: e.column.title?.(e.item) ?? a.value,
695
- subtitle: e.column.subtitle?.(e.item),
696
- highlight: e.search,
697
- "subtitle-selectable": ""
698
- }, null, 8, ["to", "title", "subtitle", "highlight"]))
699
- ], 64)) : e.column.kind === "timestamp" ? (i(), d(I, { key: 1 }, [
700
- e.compact && r.value ? (i(), d("time", {
701
- key: 0,
702
- class: "tabular-nums",
703
- datetime: String(s.value)
704
- }, y(e.column.precision === "date" ? n(l).date(r.value) : n(l).dateTime(r.value)), 9, dl)) : e.compact ? L("", !0) : (i(), W(n(It), {
705
- key: 1,
706
- value: r.value,
707
- precision: e.column.precision ?? "dateTime"
708
- }, null, 8, ["value", "precision"]))
709
- ], 64)) : e.column.kind === "number" ? (i(), d("span", fl, y(n(l).number(c.value, e.column.format)), 1)) : e.column.kind === "money" ? (i(), d("span", pl, y(n(l).money(c.value, typeof e.column.currency == "function" ? e.column.currency(e.item) : e.column.currency)), 1)) : e.column.kind === "badge" ? (i(), W(n(Nt), {
710
- key: 4,
711
- tone: e.column.tone(e.item),
712
- dot: ""
713
- }, {
714
- default: B(() => [
715
- ne(y(e.column.text?.(e.item) ?? a.value), 1)
716
- ]),
717
- _: 1
718
- }, 8, ["tone"])) : (i(), d(I, { key: 5 }, [
719
- ne(y(a.value), 1)
720
- ], 64));
721
- }
722
- }), vl = {
598
+ const Zt = {
723
599
  class: "mx-auto max-w-xl py-8 text-center",
724
600
  "data-test": "collection-empty-filtered"
725
- }, ml = { class: "mt-3 mb-1 text-headline font-semibold text-content-strong" }, gl = { class: "text-sm text-content-muted" }, bl = { class: "mt-4 flex flex-wrap justify-center gap-2" }, hl = {
601
+ }, eo = { class: "mt-3 mb-1 text-headline font-semibold text-content-strong" }, to = { class: "text-sm text-content-muted" }, oo = { class: "mt-4 flex flex-wrap justify-center gap-2" }, lo = {
726
602
  key: 0,
727
603
  class: "shrink-0 text-content-muted"
728
- }, yl = ["title"], _l = ["aria-label", "onClick"], wl = { class: "mt-5 flex flex-wrap justify-center gap-2" }, at = /* @__PURE__ */ we({
604
+ }, no = ["title"], so = ["aria-label", "onClick"], ao = { class: "mt-5 flex flex-wrap justify-center gap-2" }, ro = /* @__PURE__ */ ue({
729
605
  __name: "CollectionEmptyResult",
730
606
  props: {
731
607
  chips: {},
732
608
  lastChip: {}
733
609
  },
734
610
  emits: ["remove", "clearAll"],
735
- setup(t, { emit: e }) {
736
- const l = t, s = e, { t: r } = Ce();
737
- return (a, c) => (i(), d("div", vl, [
738
- O(n(J), {
611
+ setup(l, { emit: e }) {
612
+ const t = l, i = e, { t: a } = he();
613
+ return (n, u) => (c(), d("div", Zt, [
614
+ P(s(H), {
739
615
  name: "filter3",
740
616
  size: 32,
741
617
  class: "mx-auto text-content-disabled"
742
618
  }),
743
- p("h3", ml, y(n(r)("core.collection.empty.title")), 1),
744
- p("p", gl, y(n(r)("core.collection.empty.description")), 1),
745
- p("ul", bl, [
746
- (i(!0), d(I, null, Z(l.chips, (f) => (i(), d("li", {
747
- key: f.key,
619
+ v("h3", eo, y(s(a)("core.collection.empty.title")), 1),
620
+ v("p", to, y(s(a)("core.collection.empty.description")), 1),
621
+ v("ul", oo, [
622
+ (c(!0), d(V, null, X(t.chips, (p) => (c(), d("li", {
623
+ key: p.key,
748
624
  class: "inline-flex h-7 max-w-full min-w-0 items-center gap-1.5 rounded-control bg-surface-cell pr-0.5 pl-2.5 text-sm shadow-group ring-1 ring-inset ring-border-separator"
749
625
  }, [
750
- f.label ? (i(), d("span", hl, y(f.label), 1)) : L("", !0),
751
- p("span", {
626
+ p.label ? (c(), d("span", lo, y(p.label), 1)) : j("", !0),
627
+ v("span", {
752
628
  class: "min-w-0 truncate font-medium text-content-strong",
753
- title: f.values.join(" › ")
754
- }, y(f.values.join(" › ")), 9, yl),
755
- p("button", {
629
+ title: p.values.join(" › ")
630
+ }, y(p.values.join(" › ")), 9, no),
631
+ v("button", {
756
632
  type: "button",
757
633
  class: "shrink-0 cursor-pointer rounded p-1 text-content-disabled hover:bg-fill hover:text-content-strong",
758
- "aria-label": `${n(r)("core.collection.clear")}: ${f.label ?? f.values.join(" › ")}`,
759
- onClick: (b) => s("remove", f)
634
+ "aria-label": `${s(a)("core.collection.clear")}: ${p.label ?? p.values.join(" › ")}`,
635
+ onClick: (g) => i("remove", p)
760
636
  }, [
761
- O(n(J), {
637
+ P(s(H), {
762
638
  name: "close",
763
639
  size: 12
764
640
  })
765
- ], 8, _l)
641
+ ], 8, so)
766
642
  ]))), 128))
767
643
  ]),
768
- p("div", wl, [
769
- l.lastChip ? (i(), W(he, Se({ key: 0 }, { "data-test": "collection-empty-remove-last" }, {
644
+ v("div", ao, [
645
+ t.lastChip ? (c(), Y(be, _e({ key: 0 }, { "data-test": "collection-empty-remove-last" }, {
770
646
  prominence: "secondary",
771
647
  size: "sm",
772
- onClick: c[0] || (c[0] = (f) => s("remove", l.lastChip))
648
+ onClick: u[0] || (u[0] = (p) => i("remove", t.lastChip))
773
649
  }), {
774
- default: B(() => [
775
- ne(y(n(r)("core.collection.empty.remove_last", { filter: l.lastChip.values.join(" › ") })), 1)
650
+ default: q(() => [
651
+ le(y(s(a)("core.collection.empty.remove_last", { filter: t.lastChip.values.join(" › ") })), 1)
776
652
  ]),
777
653
  _: 1
778
- }, 16)) : L("", !0),
779
- O(he, Se({ "data-test": "collection-empty-clear-all" }, {
654
+ }, 16)) : j("", !0),
655
+ P(be, _e({ "data-test": "collection-empty-clear-all" }, {
780
656
  size: "sm",
781
- onClick: c[1] || (c[1] = (f) => s("clearAll"))
657
+ onClick: u[1] || (u[1] = (p) => i("clearAll"))
782
658
  }), {
783
- default: B(() => [
784
- ne(y(n(r)("core.collection.empty.clear_all")), 1)
659
+ default: q(() => [
660
+ le(y(s(a)("core.collection.empty.clear_all")), 1)
785
661
  ]),
786
662
  _: 1
787
663
  }, 16)
788
664
  ])
789
665
  ]));
790
666
  }
791
- }), kl = ["aria-label"], xl = ["disabled"], $l = { class: "sr-only" }, Sl = {
667
+ }), io = ["aria-label"], co = ["disabled"], uo = { class: "sr-only" }, fo = {
792
668
  class: "text-subheadline tabular-nums text-content-muted",
793
669
  "aria-live": "polite"
794
- }, Cl = ["disabled"], zl = { class: "sr-only" }, Pl = {
670
+ }, po = ["disabled"], vo = { class: "sr-only" }, mo = {
795
671
  key: 1,
796
672
  class: "flex select-none flex-col items-center justify-between gap-3 border-t border-border-separator px-4 py-2.5 md:flex-row"
797
- }, Al = { class: "flex flex-col items-center gap-x-4 text-footnote tabular-nums text-content-muted md:flex-row" }, El = {
673
+ }, bo = { class: "flex flex-col items-center gap-x-4 text-footnote tabular-nums text-content-muted md:flex-row" }, go = {
798
674
  key: 0,
799
675
  "aria-live": "polite"
800
- }, jl = { class: "flex items-center" }, Ol = { class: "mr-2" }, Ll = ["value"], Tl = ["value"], Rl = ["aria-label"], Ml = ["disabled"], Vl = { class: "sr-only" }, Nl = {
676
+ }, ho = { class: "flex items-center" }, yo = { class: "mr-2" }, wo = ["value"], _o = ["value"], ko = ["aria-label"], xo = ["disabled"], $o = { class: "sr-only" }, So = {
801
677
  key: 0,
802
678
  class: "px-1.5 text-content-disabled"
803
- }, Il = ["aria-current", "onClick"], Fl = ["disabled"], ql = { class: "sr-only" }, Dl = /* @__PURE__ */ we({
679
+ }, Co = ["aria-current", "onClick"], zo = ["disabled"], Ao = { class: "sr-only" }, Po = /* @__PURE__ */ ue({
804
680
  __name: "CollectionPager",
805
681
  props: {
806
682
  collection: {},
@@ -808,448 +684,1029 @@ const ul = {
808
684
  flat: { type: Boolean }
809
685
  },
810
686
  emits: ["turned"],
811
- setup(t, { emit: e }) {
812
- const l = t, s = e, { t: r } = Ce(), a = Ve(), c = _(() => l.collection.query.value.page), f = _(() => l.collection.page.value?.lastPage ?? 0), b = _(() => l.collection.page.value), v = _(() => {
813
- if (f.value <= 1) return f.value === 1 ? [1] : [];
814
- const P = [1], j = Math.max(2, c.value - 2), A = Math.min(f.value - 1, c.value + 2);
815
- j > 2 && P.push(null);
816
- for (let U = j; U <= A; U++) P.push(U);
817
- return A < f.value - 1 && P.push(null), P.push(f.value), P;
687
+ setup(l, { emit: e }) {
688
+ const t = l, i = e, { t: a } = he(), n = Le(), u = h(() => t.collection.query.value.page), p = h(() => t.collection.page.value?.lastPage ?? 0), g = h(() => t.collection.page.value), m = h(() => {
689
+ if (p.value <= 1) return p.value === 1 ? [1] : [];
690
+ const k = [1], L = Math.max(2, u.value - 2), z = Math.min(p.value - 1, u.value + 2);
691
+ L > 2 && k.push(null);
692
+ for (let D = L; D <= z; D++) k.push(D);
693
+ return z < p.value - 1 && k.push(null), k.push(p.value), k;
818
694
  });
819
- function x(P) {
820
- P === 1 ? l.collection.nextPage() : l.collection.previousPage(), s("turned");
695
+ function $(k) {
696
+ k === 1 ? t.collection.nextPage() : t.collection.previousPage(), i("turned");
821
697
  }
822
- const S = (P) => [
698
+ const S = (k) => [
823
699
  "hit-target inline-flex h-7 min-w-7 cursor-pointer items-center justify-center rounded-button px-2 transition-colors duration-motion-fast disabled:cursor-not-allowed disabled:opacity-40",
824
- P ? "bg-tint font-semibold text-content-on-tint" : "text-content-strong hover:bg-fill disabled:hover:bg-transparent"
700
+ k ? "bg-tint font-semibold text-content-on-tint" : "text-content-strong hover:bg-fill disabled:hover:bg-transparent"
825
701
  ].join(" ");
826
- function D(P) {
827
- l.collection.setPageSize(Number(P.target.value));
702
+ function N(k) {
703
+ t.collection.setPageSize(Number(k.target.value));
828
704
  }
829
- return (P, j) => l.compact && f.value > 1 ? (i(), d("nav", {
705
+ return (k, L) => t.compact && p.value > 1 ? (c(), d("nav", {
830
706
  key: 0,
831
- "aria-label": n(r)("core.collection.page.label"),
832
- class: le(["flex select-none items-center justify-between gap-3 px-1 py-2", l.flat ? "mt-1" : "border-t border-border-separator"]),
707
+ "aria-label": s(a)("core.collection.page.label"),
708
+ class: W(["flex select-none items-center justify-between gap-3 px-1 py-2", t.flat ? "mt-1" : "border-t border-border-separator"]),
833
709
  "data-test": "collection-pager-compact"
834
710
  }, [
835
- p("button", {
711
+ v("button", {
836
712
  type: "button",
837
713
  class: "inline-flex size-11 cursor-pointer items-center justify-center rounded-full text-content-link active:bg-fill disabled:cursor-not-allowed disabled:text-content-disabled",
838
- disabled: c.value <= 1,
839
- onClick: j[0] || (j[0] = (A) => x(-1))
714
+ disabled: u.value <= 1,
715
+ onClick: L[0] || (L[0] = (z) => $(-1))
840
716
  }, [
841
- O(n(J), {
717
+ P(s(H), {
842
718
  name: "arrowLeftSLine",
843
719
  size: 20
844
720
  }),
845
- p("span", $l, y(n(r)("core.collection.page.previous")), 1)
846
- ], 8, xl),
847
- p("span", Sl, y(n(r)("core.collection.page.page_of", { current: n(a).number(c.value), total: n(a).number(f.value) })), 1),
848
- p("button", {
721
+ v("span", uo, y(s(a)("core.collection.page.previous")), 1)
722
+ ], 8, co),
723
+ v("span", fo, y(s(a)("core.collection.page.page_of", { current: s(n).number(u.value), total: s(n).number(p.value) })), 1),
724
+ v("button", {
849
725
  type: "button",
850
726
  class: "inline-flex size-11 cursor-pointer items-center justify-center rounded-full text-content-link active:bg-fill disabled:cursor-not-allowed disabled:text-content-disabled",
851
- disabled: c.value >= f.value,
852
- onClick: j[1] || (j[1] = (A) => x(1))
727
+ disabled: u.value >= p.value,
728
+ onClick: L[1] || (L[1] = (z) => $(1))
853
729
  }, [
854
- O(n(J), {
730
+ P(s(H), {
855
731
  name: "arrowRightSLine",
856
732
  size: 20
857
733
  }),
858
- p("span", zl, y(n(r)("core.collection.page.next")), 1)
859
- ], 8, Cl)
860
- ], 10, kl)) : l.compact ? L("", !0) : (i(), d("div", Pl, [
861
- p("div", Al, [
862
- b.value ? (i(), d("span", El, y(n(r)("core.collection.page.total", { from: n(a).number(b.value.from), to: n(a).number(b.value.to), total: n(a).number(b.value.total) })), 1)) : L("", !0),
863
- p("label", jl, [
864
- p("span", Ol, y(n(r)("core.collection.page.per_page")) + ":", 1),
865
- p("select", {
866
- value: l.collection.query.value.pageSize,
734
+ v("span", vo, y(s(a)("core.collection.page.next")), 1)
735
+ ], 8, po)
736
+ ], 10, io)) : t.compact ? j("", !0) : (c(), d("div", mo, [
737
+ v("div", bo, [
738
+ g.value ? (c(), d("span", go, y(s(a)("core.collection.page.total", { from: s(n).number(g.value.from), to: s(n).number(g.value.to), total: s(n).number(g.value.total) })), 1)) : j("", !0),
739
+ v("label", ho, [
740
+ v("span", yo, y(s(a)("core.collection.page.per_page")) + ":", 1),
741
+ v("select", {
742
+ value: t.collection.query.value.pageSize,
867
743
  class: "cursor-pointer rounded-control bg-transparent py-0.5 pr-1 font-semibold text-content-strong hover:bg-fill",
868
- onChange: D
744
+ onChange: N
869
745
  }, [
870
- (i(!0), d(I, null, Z(l.collection.pageSizes, (A) => (i(), d("option", {
871
- key: A,
872
- value: A
873
- }, y(A), 9, Tl))), 128))
874
- ], 40, Ll)
746
+ (c(!0), d(V, null, X(t.collection.pageSizes, (z) => (c(), d("option", {
747
+ key: z,
748
+ value: z
749
+ }, y(z), 9, _o))), 128))
750
+ ], 40, wo)
875
751
  ])
876
752
  ]),
877
- p("nav", {
878
- "aria-label": n(r)("core.collection.page.label"),
753
+ v("nav", {
754
+ "aria-label": s(a)("core.collection.page.label"),
879
755
  class: "flex items-center gap-0.5 text-subheadline tabular-nums"
880
756
  }, [
881
- p("button", {
757
+ v("button", {
882
758
  type: "button",
883
- class: le(S(!1)),
884
- disabled: c.value <= 1,
885
- onClick: j[2] || (j[2] = (A) => x(-1))
759
+ class: W(S(!1)),
760
+ disabled: u.value <= 1,
761
+ onClick: L[2] || (L[2] = (z) => $(-1))
886
762
  }, [
887
- O(n(J), {
763
+ P(s(H), {
888
764
  name: "arrowLeftSLine",
889
765
  size: 16
890
766
  }),
891
- p("span", Vl, y(n(r)("core.collection.page.previous")), 1)
892
- ], 10, Ml),
893
- (i(!0), d(I, null, Z(v.value, (A, U) => (i(), d(I, { key: U }, [
894
- A === null ? (i(), d("span", Nl, "…")) : (i(), d("button", {
767
+ v("span", $o, y(s(a)("core.collection.page.previous")), 1)
768
+ ], 10, xo),
769
+ (c(!0), d(V, null, X(m.value, (z, D) => (c(), d(V, { key: D }, [
770
+ z === null ? (c(), d("span", So, "…")) : (c(), d("button", {
895
771
  key: 1,
896
772
  type: "button",
897
- class: le(S(A === c.value)),
898
- "aria-current": A === c.value ? "page" : void 0,
899
- onClick: (k) => l.collection.goToPage(A)
900
- }, y(n(a).number(A)), 11, Il))
773
+ class: W(S(z === u.value)),
774
+ "aria-current": z === u.value ? "page" : void 0,
775
+ onClick: (x) => t.collection.goToPage(z)
776
+ }, y(s(n).number(z)), 11, Co))
901
777
  ], 64))), 128)),
902
- p("button", {
778
+ v("button", {
903
779
  type: "button",
904
- class: le(S(!1)),
905
- disabled: c.value >= f.value,
906
- onClick: j[3] || (j[3] = (A) => x(1))
780
+ class: W(S(!1)),
781
+ disabled: u.value >= p.value,
782
+ onClick: L[3] || (L[3] = (z) => $(1))
907
783
  }, [
908
- O(n(J), {
784
+ P(s(H), {
909
785
  name: "arrowRightSLine",
910
786
  size: 16
911
787
  }),
912
- p("span", ql, y(n(r)("core.collection.page.next")), 1)
913
- ], 10, Fl)
914
- ], 8, Rl)
788
+ v("span", Ao, y(s(a)("core.collection.page.next")), 1)
789
+ ], 10, zo)
790
+ ], 8, ko)
791
+ ]));
792
+ }
793
+ });
794
+ function Eo(l, e) {
795
+ const t = (e ?? "").split(/\s+/).filter((a) => a !== "");
796
+ if (t.length === 0 || l === "") return [{ text: l, match: !1 }];
797
+ const i = new RegExp(`(${t.sort((a, n) => n.length - a.length).map((a) => a.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})`, "giu");
798
+ return l.split(i).flatMap((a, n) => a === "" ? [] : [{ text: a, match: n % 2 === 1 }]);
799
+ }
800
+ const Oo = { class: "flex min-w-0 flex-col" }, jo = {
801
+ key: 1,
802
+ class: "truncate text-row-title"
803
+ }, Lo = ["data-row-click-ignore"], Ze = "rounded-sm bg-status-warning-surface text-status-warning-content", et = /* @__PURE__ */ ue({
804
+ __name: "RecordIdentity",
805
+ props: {
806
+ title: {},
807
+ subtitle: { default: null },
808
+ to: { default: null },
809
+ subtitleSelectable: { type: Boolean, default: !1 },
810
+ highlight: { default: null }
811
+ },
812
+ setup(l) {
813
+ const e = l, t = h(() => Eo(e.title, e.highlight));
814
+ return (i, a) => (c(), d("div", Oo, [
815
+ e.to ? (c(), Y(s(ct), {
816
+ key: 0,
817
+ to: e.to,
818
+ class: "block truncate rounded-sm text-row-title focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus"
819
+ }, {
820
+ default: q(() => [
821
+ (c(!0), d(V, null, X(t.value, (n, u) => (c(), d(V, { key: u }, [
822
+ n.match ? (c(), d("mark", {
823
+ key: 0,
824
+ class: W(Ze)
825
+ }, y(n.text), 1)) : (c(), d(V, { key: 1 }, [
826
+ le(y(n.text), 1)
827
+ ], 64))
828
+ ], 64))), 128))
829
+ ]),
830
+ _: 1
831
+ }, 8, ["to"])) : (c(), d("span", jo, [
832
+ (c(!0), d(V, null, X(t.value, (n, u) => (c(), d(V, { key: u }, [
833
+ n.match ? (c(), d("mark", {
834
+ key: 0,
835
+ class: W(Ze)
836
+ }, y(n.text), 1)) : (c(), d(V, { key: 1 }, [
837
+ le(y(n.text), 1)
838
+ ], 64))
839
+ ], 64))), 128))
840
+ ])),
841
+ e.subtitle ? (c(), d("span", {
842
+ key: 2,
843
+ "data-row-click-ignore": e.subtitleSelectable ? "" : void 0,
844
+ class: W(["truncate text-row-subtitle", { "w-fit cursor-text select-text": e.subtitleSelectable }])
845
+ }, y(e.subtitle), 11, Lo)) : j("", !0)
915
846
  ]));
916
847
  }
917
- }), Ul = ["onClick"], Bl = { class: "max-w-56 truncate" }, Hl = { class: "flex flex-col gap-1.5 text-footnote font-medium text-content-muted" }, Kl = ["placeholder"], Xl = { class: "flex items-center justify-between gap-2" }, Gl = {
848
+ });
849
+ function ht(l, e) {
850
+ let t = l;
851
+ for (const i of String(e).split(".")) {
852
+ if (typeof t != "object" || t === null) return;
853
+ t = t[i];
854
+ }
855
+ return t;
856
+ }
857
+ const Ro = {
858
+ key: 0,
859
+ class: "flex items-center gap-3"
860
+ }, To = ["datetime"], Vo = {
861
+ key: 2,
862
+ class: "tabular-nums"
863
+ }, Fo = {
864
+ key: 3,
865
+ class: "tabular-nums"
866
+ }, Pe = /* @__PURE__ */ ue({
867
+ __name: "CollectionCell",
868
+ props: {
869
+ column: {},
870
+ item: {},
871
+ compact: { type: Boolean },
872
+ to: {},
873
+ search: {}
874
+ },
875
+ setup(l) {
876
+ const e = l, t = Le(), i = h(() => ht(e.item, e.column.key)), a = h(() => i.value), n = h(() => i.value === null || i.value === void 0 ? "" : String(i.value)), u = h(() => typeof i.value == "number" ? i.value : typeof i.value == "string" && i.value.trim() !== "" ? Number(i.value) : null);
877
+ return (p, g) => e.column.kind === "identity" ? (c(), d(V, { key: 0 }, [
878
+ !e.compact && p.$slots.leading ? (c(), d("div", Ro, [
879
+ oe(p.$slots, "leading"),
880
+ P(et, {
881
+ to: e.to,
882
+ title: e.column.title?.(e.item) ?? n.value,
883
+ subtitle: e.column.subtitle?.(e.item),
884
+ highlight: e.search,
885
+ "subtitle-selectable": ""
886
+ }, null, 8, ["to", "title", "subtitle", "highlight"])
887
+ ])) : (c(), Y(et, {
888
+ key: 1,
889
+ to: e.to,
890
+ title: e.column.title?.(e.item) ?? n.value,
891
+ subtitle: e.column.subtitle?.(e.item),
892
+ highlight: e.search,
893
+ "subtitle-selectable": ""
894
+ }, null, 8, ["to", "title", "subtitle", "highlight"]))
895
+ ], 64)) : e.column.kind === "timestamp" ? (c(), d(V, { key: 1 }, [
896
+ e.compact && a.value ? (c(), d("time", {
897
+ key: 0,
898
+ class: "tabular-nums",
899
+ datetime: String(i.value)
900
+ }, y(e.column.precision === "date" ? s(t).date(a.value) : s(t).dateTime(a.value)), 9, To)) : e.compact ? j("", !0) : (c(), Y(s(jt), {
901
+ key: 1,
902
+ value: a.value,
903
+ precision: e.column.precision ?? "dateTime"
904
+ }, null, 8, ["value", "precision"]))
905
+ ], 64)) : e.column.kind === "number" ? (c(), d("span", Vo, y(s(t).number(u.value, e.column.format)), 1)) : e.column.kind === "money" ? (c(), d("span", Fo, y(s(t).money(u.value, typeof e.column.currency == "function" ? e.column.currency(e.item) : e.column.currency)), 1)) : e.column.kind === "badge" ? (c(), Y(s(Ot), {
906
+ key: 4,
907
+ tone: e.column.tone(e.item),
908
+ dot: ""
909
+ }, {
910
+ default: q(() => [
911
+ le(y(e.column.text?.(e.item) ?? n.value), 1)
912
+ ]),
913
+ _: 1
914
+ }, 8, ["tone"])) : (c(), d(V, { key: 5 }, [
915
+ le(y(n.value), 1)
916
+ ], 64));
917
+ }
918
+ }), Mo = 'a, button, input, select, textarea, label, [role="button"], [data-row-click-ignore]', No = 500, Io = 8;
919
+ function qo(l) {
920
+ const e = Ct(), t = ae([]), i = ae("");
921
+ let a = !1, n = null, u = { x: 0, y: 0 };
922
+ const p = (x) => l.actions()?.(x) ?? [];
923
+ function g(x) {
924
+ return p(x).filter((R) => R.href).map((R) => ({ key: R.key, label: R.label, icon: R.icon, href: R.href, tone: R.tone ?? "neutral", external: R.external }));
925
+ }
926
+ function m(x, R, B) {
927
+ const K = p(x);
928
+ return K.length === 0 ? !1 : (i.value = l.label()?.(x) ?? l.moreLabel(), t.value = K.map((M) => ({
929
+ id: M.key,
930
+ label: M.label,
931
+ icon: M.icon,
932
+ section: M.section,
933
+ tone: M.tone === "critical" ? "critical" : void 0,
934
+ onSelect: () => {
935
+ M.onSelect ? M.onSelect() : M.href && (M.external ? window.open(M.href, "_blank", "noopener") : window.location.assign(M.href));
936
+ }
937
+ })), it(() => l.presentMenu(R, B)), !0);
938
+ }
939
+ function $(x, R) {
940
+ const B = x.currentTarget.getBoundingClientRect();
941
+ m(R, B.left, B.bottom);
942
+ }
943
+ function S(x, R) {
944
+ !l.actions() || x.target.closest("a") || m(R, x.clientX, x.clientY) && (x.preventDefault(), a = !0);
945
+ }
946
+ function N() {
947
+ n && clearTimeout(n), n = null;
948
+ }
949
+ function k(x, R) {
950
+ a = !1, !(x.pointerType !== "touch" || !l.actions()) && (u = { x: x.clientX, y: x.clientY }, N(), n = setTimeout(() => {
951
+ n = null, m(R, u.x, u.y) && (a = !0, navigator.vibrate?.(10));
952
+ }, No));
953
+ }
954
+ function L(x) {
955
+ n && Math.hypot(x.clientX - u.x, x.clientY - u.y) > Io && N();
956
+ }
957
+ function z(x) {
958
+ a && (a = !1, x.preventDefault(), x.stopPropagation());
959
+ }
960
+ function D(x, R) {
961
+ const B = l.target(R);
962
+ if (!(!B || x.target.closest(Mo)) && !window.getSelection()?.toString()) {
963
+ if (x.metaKey || x.ctrlKey) {
964
+ window.open(e.resolve(B).href, "_blank");
965
+ return;
966
+ }
967
+ e.push(B);
968
+ }
969
+ }
970
+ return Ie() && qe(N), { menuItems: t, menuLabel: i, swipeActions: g, openMenuFrom: $, onContextMenu: S, onPointerDown: k, onPointerMove: L, cancelPress: N, onClickCapture: z, onClick: D, actionsOf: p };
971
+ }
972
+ const Do = {
973
+ key: 0,
974
+ class: "overflow-hidden rounded-group bg-surface-cell shadow-group",
975
+ "data-test": "collection-mobile-rows"
976
+ }, Bo = { class: "flex flex-1 flex-col gap-2 pt-1" }, Uo = ["onClick", "onContextmenu", "onPointerdown"], Ho = { class: "flex items-start gap-3" }, Ko = {
977
+ key: 0,
978
+ class: "shrink-0 pt-0.5"
979
+ }, Xo = { class: "flex min-w-0 flex-1 flex-col gap-1" }, Go = { class: "flex min-w-0 items-start gap-3" }, Jo = { class: "min-w-0 flex-1" }, Wo = {
980
+ key: 1,
981
+ class: "block truncate text-row-title"
982
+ }, Yo = {
983
+ key: 0,
984
+ class: "flex shrink-0 items-center gap-2 pt-0.5"
985
+ }, Qo = ["aria-label", "onClick"], Zo = {
986
+ key: 0,
987
+ class: "flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-row-meta"
988
+ }, el = {
989
+ key: 1,
990
+ class: "truncate"
991
+ }, tl = {
992
+ key: 2,
993
+ class: "px-4 py-6",
994
+ "data-test": "collection-failed"
995
+ }, ol = {
996
+ key: 3,
997
+ class: "px-4 py-2 text-center",
998
+ "data-test": "collection-empty"
999
+ }, ll = {
1000
+ key: 1,
1001
+ class: "inline-block w-full align-middle"
1002
+ }, nl = { class: "border-b border-border-separator" }, sl = ["aria-sort"], al = ["onClick"], rl = { key: 1 }, il = {
1003
+ key: 0,
1004
+ class: "px-4 pt-2.5 pb-2",
1005
+ style: { width: "20px" }
1006
+ }, cl = { class: "sr-only" }, ul = {
1007
+ key: 0,
1008
+ class: "size-8 shrink-0 rounded-full bg-fill"
1009
+ }, dl = { class: "flex flex-1 flex-col gap-1.5" }, fl = { key: 0 }, pl = ["onClick", "onContextmenu", "onPointerdown"], vl = { key: 0 }, ml = { class: "flex items-center justify-center gap-1" }, bl = ["aria-label", "onClick"], gl = {
1010
+ key: 2,
1011
+ "data-test": "collection-failed"
1012
+ }, hl = ["colspan"], yl = {
1013
+ key: 3,
1014
+ "data-test": "collection-empty"
1015
+ }, wl = ["colspan"], _l = 37, yt = /* @__PURE__ */ ue({
1016
+ __name: "CollectionRows",
1017
+ props: {
1018
+ columns: {},
1019
+ rows: {},
1020
+ rowKey: {},
1021
+ display: {},
1022
+ phone: { type: Boolean },
1023
+ link: {},
1024
+ search: { default: void 0 },
1025
+ sorted: { default: null },
1026
+ rowActions: { type: Function, default: void 0 },
1027
+ rowLabel: { type: Function, default: void 0 },
1028
+ rowHeight: { default: void 0 },
1029
+ density: { default: "regular" },
1030
+ actionsVisible: { type: Boolean, default: !1 },
1031
+ skeletonRows: {},
1032
+ reserveRows: { default: void 0 },
1033
+ rowClass: { type: Function, default: void 0 }
1034
+ },
1035
+ emits: ["sort"],
1036
+ setup(l, { emit: e }) {
1037
+ const t = l, i = e, a = ke(), { t: n } = he(), u = ke(), p = (w) => t.columns.filter((U) => U.mobile === w), g = h(() => p("primary")), m = h(() => p("accessory")), $ = h(() => p("meta")), S = (w) => `cell-${String(w.key).replace(/\./g, "_")}`, N = (w) => !!u[S(w)], k = (w, U) => ht(w, U.key), L = (w) => w == null || w === "", z = { md: "hidden md:table-cell", xl: "hidden xl:table-cell", "2xl": "hidden 2xl:table-cell" }, D = (w) => w.hideBelow ? [z[w.hideBelow]] : [], x = (w) => ["text-nowrap px-4 pt-2.5 pb-2 text-footnote font-normal text-content-muted", ...D(w)], R = { start: "text-left", center: "text-center", end: "text-right" }, B = (w) => [...D(w), R[w.align ?? "start"]], K = { start: "justify-start", center: "justify-center", end: "justify-end" }, M = h(() => t.rows.length > 0 && t.link(t.rows[0]) !== null), ee = ge("rowMenu"), O = qo({
1038
+ actions: () => t.rowActions,
1039
+ label: () => t.rowLabel,
1040
+ target: (w) => t.link(w),
1041
+ presentMenu: (w, U) => ee.value?.presentAt(w, U),
1042
+ moreLabel: () => n("core.page.more_actions")
1043
+ }), A = h(() => !!t.rowActions && (t.actionsVisible || !a.actions && !M.value)), I = h(() => !!a.actions || M.value || A.value), T = (w) => t.rowLabel ? `${n("core.page.more_actions")}: ${t.rowLabel(w)}` : n("core.page.more_actions"), b = (w) => O.actionsOf(w).length > 0, C = h(() => t.columns.length + (I.value ? 1 : 0)), E = (w) => w.sort !== void 0 && t.sorted?.key === w.sort, ie = (w) => w.sort === void 0 ? void 0 : E(w) ? t.sorted?.direction === "asc" ? "ascending" : "descending" : "none", de = (w) => E(w) ? t.sorted?.direction === "asc" ? "arrowUpSLine" : "arrowDownSLine" : "expandUpDownLine", ce = (w) => ({ animationDelay: `${Math.min(w, 8) * 30}ms` }), re = h(() => t.display === "loading"), fe = h(() => re.value && t.reserveRows !== void 0 ? `${t.reserveRows * (t.rowHeight ?? 40) + _l}px` : void 0), ne = h(() => t.display === "empty" || t.display === "no-matches");
1044
+ return (w, U) => (c(), d(V, null, [
1045
+ t.phone ? (c(), d("ul", Do, [
1046
+ re.value ? (c(!0), d(V, { key: 0 }, X(t.skeletonRows, (r) => (c(), d("li", {
1047
+ key: `skeleton-${r}`,
1048
+ "aria-hidden": "true",
1049
+ class: "relative flex animate-pulse items-start gap-3 px-row-inset py-3 motion-reduce:animate-none not-first:before:absolute not-first:before:top-0 not-first:before:right-0 not-first:before:left-row-inset not-first:before:h-px not-first:before:bg-border-separator",
1050
+ style: ve({ animationDelay: `${r * 60}ms` })
1051
+ }, [
1052
+ U[5] || (U[5] = v("span", { class: "size-9 shrink-0 rounded-full bg-fill" }, null, -1)),
1053
+ v("span", Bo, [
1054
+ v("span", {
1055
+ class: "h-2.5 rounded-full bg-fill-strong",
1056
+ style: ve({ width: `${45 + r * 13 % 30}%` })
1057
+ }, null, 4),
1058
+ v("span", {
1059
+ class: "h-2 rounded-full bg-fill",
1060
+ style: ve({ width: `${60 + r * 7 % 25}%` })
1061
+ }, null, 4)
1062
+ ])
1063
+ ], 4))), 128)) : j("", !0),
1064
+ t.display === "rows" ? (c(!0), d(V, { key: 1 }, X(t.rows, (r, _) => (c(), d("li", {
1065
+ key: t.rowKey(r),
1066
+ style: ve(ce(_)),
1067
+ "data-test": "collection-row",
1068
+ class: W(["relative animate-row-in transition-colors duration-motion-fast active:bg-fill not-first:before:absolute not-first:before:top-0 not-first:before:right-0 not-first:before:left-row-inset not-first:before:z-10 not-first:before:h-px not-first:before:bg-border-separator", [t.link(r) ? "cursor-pointer" : void 0, t.rowClass?.(r)]]),
1069
+ onClickCapture: U[0] || (U[0] = //@ts-ignore
1070
+ (...o) => s(O).onClickCapture && s(O).onClickCapture(...o)),
1071
+ onClick: (o) => s(O).onClick(o, r),
1072
+ onContextmenu: (o) => s(O).onContextMenu(o, r),
1073
+ onPointerdown: (o) => s(O).onPointerDown(o, r),
1074
+ onPointermove: U[1] || (U[1] = //@ts-ignore
1075
+ (...o) => s(O).onPointerMove && s(O).onPointerMove(...o)),
1076
+ onPointerup: U[2] || (U[2] = //@ts-ignore
1077
+ (...o) => s(O).cancelPress && s(O).cancelPress(...o)),
1078
+ onPointercancel: U[3] || (U[3] = //@ts-ignore
1079
+ (...o) => s(O).cancelPress && s(O).cancelPress(...o))
1080
+ }, [
1081
+ P(s(Et), {
1082
+ actions: s(O).swipeActions(r),
1083
+ "content-class": "px-row-inset py-2.5"
1084
+ }, {
1085
+ default: q(() => [
1086
+ v("div", Ho, [
1087
+ a.leading ? (c(), d("div", Ko, [
1088
+ oe(w.$slots, "leading", {
1089
+ item: r,
1090
+ compact: !0
1091
+ })
1092
+ ])) : j("", !0),
1093
+ v("div", Xo, [
1094
+ v("div", Go, [
1095
+ v("div", Jo, [
1096
+ (c(!0), d(V, null, X(g.value, (o) => (c(), d(V, {
1097
+ key: String(o.key)
1098
+ }, [
1099
+ N(o) ? oe(w.$slots, S(o), {
1100
+ item: r,
1101
+ value: k(r, o),
1102
+ compact: !0,
1103
+ to: t.link(r),
1104
+ search: t.search
1105
+ }, void 0, void 0, 0) : (c(), d("span", Wo, [
1106
+ P(Pe, {
1107
+ column: o,
1108
+ item: r,
1109
+ compact: !0,
1110
+ to: t.link(r),
1111
+ search: t.search
1112
+ }, null, 8, ["column", "item", "to", "search"])
1113
+ ]))
1114
+ ], 64))), 128))
1115
+ ]),
1116
+ m.value.length || A.value && b(r) ? (c(), d("div", Yo, [
1117
+ (c(!0), d(V, null, X(m.value, (o) => (c(), d(V, {
1118
+ key: String(o.key)
1119
+ }, [
1120
+ N(o) ? oe(w.$slots, S(o), {
1121
+ item: r,
1122
+ value: k(r, o),
1123
+ compact: !0,
1124
+ to: t.link(r),
1125
+ search: t.search
1126
+ }, void 0, void 0, 0) : (c(), Y(Pe, {
1127
+ key: 1,
1128
+ column: o,
1129
+ item: r,
1130
+ compact: !0,
1131
+ to: t.link(r),
1132
+ search: t.search
1133
+ }, null, 8, ["column", "item", "to", "search"]))
1134
+ ], 64))), 128)),
1135
+ A.value && b(r) ? (c(), d("button", {
1136
+ key: 0,
1137
+ type: "button",
1138
+ "data-test": "collection-row-more",
1139
+ "aria-label": T(r),
1140
+ class: "hit-target -my-1 -mr-1 flex size-8 cursor-pointer items-center justify-center rounded-full text-content-muted active:bg-fill",
1141
+ onClick: Ee((o) => s(O).openMenuFrom(o, r), ["stop"])
1142
+ }, [
1143
+ P(s(H), {
1144
+ name: "moreLine",
1145
+ size: 20
1146
+ })
1147
+ ], 8, Qo)) : j("", !0)
1148
+ ])) : j("", !0)
1149
+ ]),
1150
+ $.value.length ? (c(), d("div", Zo, [
1151
+ (c(!0), d(V, null, X($.value, (o) => (c(), d(V, {
1152
+ key: String(o.key)
1153
+ }, [
1154
+ N(o) ? oe(w.$slots, S(o), {
1155
+ item: r,
1156
+ value: k(r, o),
1157
+ compact: !0,
1158
+ to: t.link(r),
1159
+ search: t.search
1160
+ }, void 0, void 0, 0) : L(k(r, o)) ? j("", !0) : (c(), d("span", el, [
1161
+ P(Pe, {
1162
+ column: o,
1163
+ item: r,
1164
+ compact: !0,
1165
+ to: t.link(r),
1166
+ search: t.search
1167
+ }, null, 8, ["column", "item", "to", "search"])
1168
+ ]))
1169
+ ], 64))), 128))
1170
+ ])) : j("", !0)
1171
+ ])
1172
+ ])
1173
+ ]),
1174
+ _: 2
1175
+ }, 1032, ["actions"])
1176
+ ], 46, Uo))), 128)) : j("", !0),
1177
+ t.display === "failed" ? (c(), d("li", tl, [
1178
+ oe(w.$slots, "failed")
1179
+ ])) : j("", !0),
1180
+ ne.value ? (c(), d("li", ol, [
1181
+ oe(w.$slots, "empty", {}, () => [
1182
+ P(s(Fe), {
1183
+ title: s(n)("core.collection.no_data")
1184
+ }, null, 8, ["title"])
1185
+ ])
1186
+ ])) : j("", !0)
1187
+ ])) : (c(), d("div", ll, [
1188
+ v("div", {
1189
+ class: "overflow-x-auto",
1190
+ style: ve({ minHeight: fe.value })
1191
+ }, [
1192
+ v("table", {
1193
+ class: W(["collection-grid w-full", { condensed: t.density === "condensed" }])
1194
+ }, [
1195
+ v("thead", nl, [
1196
+ v("tr", null, [
1197
+ (c(!0), d(V, null, X(t.columns, (r) => (c(), d("th", {
1198
+ key: String(r.key),
1199
+ scope: "col",
1200
+ class: W(x(r)),
1201
+ style: ve({ width: r.width ? `${r.width}px` : void 0, textAlign: r.align ?? "start" }),
1202
+ "aria-sort": ie(r)
1203
+ }, [
1204
+ v("div", {
1205
+ class: W(["flex", K[r.align ?? "start"]])
1206
+ }, [
1207
+ r.sort !== void 0 ? (c(), d("button", {
1208
+ key: 0,
1209
+ type: "button",
1210
+ class: W(["group inline-flex cursor-pointer items-center gap-1 rounded-sm transition-colors hover:text-content-strong focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus", [E(r) ? "font-semibold text-content-strong" : "", r.align === "end" ? "flex-row-reverse" : ""]]),
1211
+ onClick: (_) => i("sort", r.sort)
1212
+ }, [
1213
+ v("span", null, y(r.label), 1),
1214
+ P(s(H), {
1215
+ name: de(r),
1216
+ size: 14,
1217
+ class: W(E(r) ? "text-content-muted" : "text-content-disabled opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100")
1218
+ }, null, 8, ["name", "class"])
1219
+ ], 10, al)) : (c(), d("span", rl, y(r.label), 1))
1220
+ ], 2)
1221
+ ], 14, sl))), 128)),
1222
+ I.value ? (c(), d("th", il, [
1223
+ v("span", cl, y(s(n)("core.actions.more")), 1)
1224
+ ])) : j("", !0)
1225
+ ])
1226
+ ]),
1227
+ v("tbody", null, [
1228
+ re.value ? (c(!0), d(V, { key: 0 }, X(t.skeletonRows, (r) => (c(), d("tr", {
1229
+ key: `skeleton-${r}`,
1230
+ "aria-hidden": "true",
1231
+ style: ve(t.rowHeight ? { height: `${t.rowHeight}px` } : void 0)
1232
+ }, [
1233
+ (c(!0), d(V, null, X(t.columns, (_, o) => (c(), d("td", {
1234
+ key: String(_.key),
1235
+ class: W(D(_))
1236
+ }, [
1237
+ v("div", {
1238
+ class: "flex animate-pulse items-center gap-3 motion-reduce:animate-none",
1239
+ style: ve({ animationDelay: `${r * 60}ms` })
1240
+ }, [
1241
+ o === 0 ? (c(), d("span", ul)) : j("", !0),
1242
+ v("span", dl, [
1243
+ v("span", {
1244
+ class: "h-2.5 rounded-full bg-fill-strong",
1245
+ style: ve({ width: `${55 + (r * 7 + o * 13) % 35}%` })
1246
+ }, null, 4),
1247
+ v("span", {
1248
+ class: "h-2 rounded-full bg-fill",
1249
+ style: ve({ width: `${30 + (r * 11 + o * 5) % 30}%` })
1250
+ }, null, 4)
1251
+ ])
1252
+ ], 4)
1253
+ ], 2))), 128)),
1254
+ I.value ? (c(), d("td", fl, [...U[6] || (U[6] = [
1255
+ v("div", { class: "mx-auto h-6 w-6 animate-pulse rounded-full bg-fill motion-reduce:animate-none" }, null, -1)
1256
+ ])])) : j("", !0)
1257
+ ], 4))), 128)) : j("", !0),
1258
+ t.display === "rows" ? (c(!0), d(V, { key: 1 }, X(t.rows, (r, _) => (c(), d("tr", {
1259
+ key: t.rowKey(r),
1260
+ class: W(["animate-row-in", [t.link(r) ? "cursor-pointer" : void 0, t.rowClass?.(r)]]),
1261
+ "data-test": "collection-row",
1262
+ style: ve([t.rowHeight ? { height: `${t.rowHeight}px` } : {}, ce(_)]),
1263
+ onClickCapture: U[4] || (U[4] = //@ts-ignore
1264
+ (...o) => s(O).onClickCapture && s(O).onClickCapture(...o)),
1265
+ onClick: (o) => s(O).onClick(o, r),
1266
+ onContextmenu: (o) => s(O).onContextMenu(o, r),
1267
+ onPointerdown: (o) => s(O).onPointerDown(o, r)
1268
+ }, [
1269
+ (c(!0), d(V, null, X(t.columns, (o, f) => (c(), d("td", {
1270
+ key: String(o.key),
1271
+ class: W(B(o))
1272
+ }, [
1273
+ oe(w.$slots, S(o), {
1274
+ item: r,
1275
+ value: k(r, o),
1276
+ compact: !1,
1277
+ to: t.link(r)
1278
+ }, () => [
1279
+ P(Pe, {
1280
+ column: o,
1281
+ item: r,
1282
+ compact: !1,
1283
+ to: t.link(r),
1284
+ search: t.search
1285
+ }, je({ _: 2 }, [
1286
+ a.leading && f === 0 ? {
1287
+ name: "leading",
1288
+ fn: q(() => [
1289
+ oe(w.$slots, "leading", {
1290
+ item: r,
1291
+ compact: !1
1292
+ })
1293
+ ]),
1294
+ key: "0"
1295
+ } : void 0
1296
+ ]), 1032, ["column", "item", "to", "search"])
1297
+ ])
1298
+ ], 2))), 128)),
1299
+ I.value ? (c(), d("td", vl, [
1300
+ oe(w.$slots, "actions", { item: r }, () => [
1301
+ v("div", ml, [
1302
+ t.link(r) ? (c(), Y(s(dt), {
1303
+ key: 0,
1304
+ text: s(n)("core.collection.open_record"),
1305
+ side: "left"
1306
+ }, {
1307
+ default: q(() => [
1308
+ P(s(ct), {
1309
+ to: t.link(r),
1310
+ "aria-label": `${s(n)("core.collection.open_record")}${t.rowLabel ? `: ${t.rowLabel(r)}` : ""}`,
1311
+ class: "inline-flex rounded-md p-1.5 text-content-link transition-colors hover:bg-tint-soft focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus"
1312
+ }, {
1313
+ default: q(() => [
1314
+ P(s(H), {
1315
+ name: "eye",
1316
+ size: 18
1317
+ })
1318
+ ]),
1319
+ _: 1
1320
+ }, 8, ["to", "aria-label"])
1321
+ ]),
1322
+ _: 2
1323
+ }, 1032, ["text"])) : j("", !0),
1324
+ A.value && b(r) ? (c(), d("button", {
1325
+ key: 1,
1326
+ type: "button",
1327
+ "data-test": "collection-row-more",
1328
+ "aria-label": T(r),
1329
+ class: "hit-target flex size-8 cursor-pointer items-center justify-center rounded-full bg-fill text-content-strong transition-colors duration-motion-fast hover:bg-fill-strong focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
1330
+ onClick: Ee((o) => s(O).openMenuFrom(o, r), ["stop"])
1331
+ }, [
1332
+ P(s(H), {
1333
+ name: "moreLine",
1334
+ size: 18
1335
+ })
1336
+ ], 8, bl)) : j("", !0)
1337
+ ])
1338
+ ])
1339
+ ])) : j("", !0)
1340
+ ], 46, pl))), 128)) : j("", !0),
1341
+ t.display === "failed" ? (c(), d("tr", gl, [
1342
+ v("td", {
1343
+ colspan: C.value,
1344
+ class: "!whitespace-normal py-6"
1345
+ }, [
1346
+ oe(w.$slots, "failed")
1347
+ ], 8, hl)
1348
+ ])) : j("", !0),
1349
+ ne.value ? (c(), d("tr", yl, [
1350
+ v("td", {
1351
+ colspan: C.value,
1352
+ class: "!whitespace-normal py-6 text-center"
1353
+ }, [
1354
+ oe(w.$slots, "empty", {}, () => [
1355
+ P(s(Fe), {
1356
+ title: s(n)("core.collection.no_data")
1357
+ }, null, 8, ["title"])
1358
+ ])
1359
+ ], 8, wl)
1360
+ ])) : j("", !0)
1361
+ ])
1362
+ ], 2)
1363
+ ], 4)
1364
+ ])),
1365
+ t.rowActions ? (c(), Y(s(Ke), {
1366
+ key: 2,
1367
+ ref_key: "rowMenu",
1368
+ ref: ee,
1369
+ items: s(O).menuItems.value,
1370
+ label: s(O).menuLabel.value
1371
+ }, null, 8, ["items", "label"])) : j("", !0)
1372
+ ], 64));
1373
+ }
1374
+ }), kl = ["onClick"], xl = { class: "max-w-56 truncate" }, $l = { class: "flex flex-col gap-1.5 text-footnote font-medium text-content-muted" }, Sl = ["placeholder"], Cl = { class: "flex items-center justify-between gap-2" }, zl = {
918
1375
  type: "submit",
919
1376
  class: "cursor-pointer rounded-control bg-tint px-3 py-1.5 text-footnote font-semibold text-content-on-tint"
920
- }, Jl = ["onClick"], Wl = { class: "max-w-56 truncate" }, rt = "inline-flex shrink-0 cursor-pointer items-center gap-x-2 rounded-button px-3 py-1.5 text-subheadline transition-colors duration-motion-fast focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus", Yl = /* @__PURE__ */ we({
1377
+ }, Al = ["onClick"], Pl = { class: "max-w-56 truncate" }, tt = "inline-flex shrink-0 cursor-pointer items-center gap-x-2 rounded-button px-3 py-1.5 text-subheadline transition-colors duration-motion-fast focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus", El = /* @__PURE__ */ ue({
921
1378
  __name: "CollectionFilterMenu",
922
1379
  props: {
923
1380
  filter: {},
924
1381
  value: {}
925
1382
  },
926
1383
  emits: ["update"],
927
- setup(t, { emit: e }) {
928
- const l = t, s = e, { t: r } = Ce(), a = _(() => ye(l.value) ? null : String(l.value)), c = _(() => l.filter.options?.find((k) => String(k.value) === a.value) ?? null), f = _(() => [
929
- ...l.filter.withoutDefaultOption ? [] : [{ id: "__all", label: l.filter.defaultOptionTitle ?? r("core.collection.filters.show_all"), checked: a.value === null, onSelect: () => s("update", null) }],
930
- ...(l.filter.options ?? []).map((R) => ({
1384
+ setup(l, { emit: e }) {
1385
+ const t = l, i = e, { t: a } = he(), n = h(() => me(t.value) ? null : String(t.value)), u = h(() => t.filter.options?.find((x) => String(x.value) === n.value) ?? null), p = h(() => [
1386
+ ...t.filter.withoutDefaultOption ? [] : [{ id: "__all", label: t.filter.defaultOptionTitle ?? a("core.collection.filters.show_all"), checked: n.value === null, onSelect: () => i("update", null) }],
1387
+ ...(t.filter.options ?? []).map((R) => ({
931
1388
  id: `option-${String(R.value)}`,
932
1389
  label: R.label,
933
1390
  icon: R.icon,
934
- checked: a.value === String(R.value),
935
- onSelect: () => s("update", String(R.value))
1391
+ checked: n.value === String(R.value),
1392
+ onSelect: () => i("update", String(R.value))
936
1393
  }))
937
- ]), b = _(() => l.filter.type === "text" && a.value ? `${l.filter.label}: ${a.value}` : c.value?.label ?? l.filter.label), v = _(() => a.value !== null), x = _(
938
- () => v.value ? "bg-tint-soft font-semibold text-content-link" : "bg-surface-cell font-medium text-content-strong ring-1 ring-inset ring-border-separator hover:bg-fill"
939
- ), S = ue(""), D = _e("popover");
940
- Ae(a, (k) => S.value = k ?? "", { immediate: !0 });
941
- function P() {
942
- const k = S.value.trim();
943
- s("update", k === "" ? null : k), D.value?.dismiss();
1394
+ ]), g = h(() => t.filter.type === "text" && n.value ? `${t.filter.label}: ${n.value}` : u.value?.label ?? t.filter.label), m = h(() => n.value !== null), $ = h(
1395
+ () => m.value ? "bg-tint-soft font-semibold text-content-link" : "bg-surface-cell font-medium text-content-strong ring-1 ring-inset ring-border-separator hover:bg-fill"
1396
+ ), S = ae(""), N = ge("popover");
1397
+ Se(n, (x) => S.value = x ?? "", { immediate: !0 });
1398
+ function k() {
1399
+ const x = S.value.trim();
1400
+ i("update", x === "" ? null : x), N.value?.dismiss();
944
1401
  }
945
- function j() {
946
- S.value = "", s("update", null), D.value?.dismiss();
1402
+ function L() {
1403
+ S.value = "", i("update", null), N.value?.dismiss();
947
1404
  }
948
- const A = _e("field");
949
- async function U() {
950
- await pt(), A.value?.focus();
1405
+ const z = ge("field");
1406
+ async function D() {
1407
+ await it(), z.value?.focus();
951
1408
  }
952
- return (k, R) => l.filter.type === "text" ? (i(), W(n(ht), {
1409
+ return (x, R) => t.filter.type === "text" ? (c(), Y(s(ft), {
953
1410
  key: 0,
954
1411
  ref_key: "popover",
955
- ref: D,
956
- label: l.filter.label,
1412
+ ref: N,
1413
+ label: t.filter.label,
957
1414
  width: "md",
958
1415
  placement: "bottom-start",
959
- onPresented: U
1416
+ onPresented: D
960
1417
  }, {
961
- trigger: B(({ toggle: H, attrs: Y }) => [
962
- p("button", Se(Y, {
1418
+ trigger: q(({ toggle: B, attrs: K }) => [
1419
+ v("button", _e(K, {
963
1420
  type: "button",
964
- class: [rt, x.value],
965
- onClick: H
1421
+ class: [tt, $.value],
1422
+ onClick: B
966
1423
  }), [
967
- l.filter.icon ? (i(), W(n(J), {
1424
+ t.filter.icon ? (c(), Y(s(H), {
968
1425
  key: 0,
969
- name: l.filter.icon,
1426
+ name: t.filter.icon,
970
1427
  size: 16
971
- }, null, 8, ["name"])) : L("", !0),
972
- p("span", Bl, y(b.value), 1),
973
- O(n(J), {
1428
+ }, null, 8, ["name"])) : j("", !0),
1429
+ v("span", xl, y(g.value), 1),
1430
+ P(s(H), {
974
1431
  name: "arrowDownSLine",
975
1432
  size: 16,
976
1433
  class: "text-content-muted"
977
1434
  })
978
- ], 16, Ul)
1435
+ ], 16, kl)
979
1436
  ]),
980
- default: B(() => [
981
- p("form", {
1437
+ default: q(() => [
1438
+ v("form", {
982
1439
  class: "flex flex-col gap-3",
983
- onSubmit: Re(P, ["prevent"])
1440
+ onSubmit: Ee(k, ["prevent"])
984
1441
  }, [
985
- p("label", Hl, [
986
- ne(y(l.filter.label) + " ", 1),
987
- Ge(p("input", {
1442
+ v("label", $l, [
1443
+ le(y(t.filter.label) + " ", 1),
1444
+ De(v("input", {
988
1445
  ref_key: "field",
989
- ref: A,
990
- "onUpdate:modelValue": R[0] || (R[0] = (H) => S.value = H),
1446
+ ref: z,
1447
+ "onUpdate:modelValue": R[0] || (R[0] = (B) => S.value = B),
991
1448
  type: "text",
992
1449
  autocomplete: "off",
993
- placeholder: n(r)("core.collection.filters.type_to_filter"),
1450
+ placeholder: s(a)("core.collection.filters.type_to_filter"),
994
1451
  class: "rounded-control bg-fill px-2.5 py-1.5 text-body text-content-strong outline-none placeholder:text-content-disabled focus:bg-surface-cell focus:ring-[1.5px] focus:ring-inset focus:ring-border-focus"
995
- }, null, 8, Kl), [
996
- [Je, S.value]
1452
+ }, null, 8, Sl), [
1453
+ [Be, S.value]
997
1454
  ])
998
1455
  ]),
999
- p("div", Xl, [
1000
- p("button", {
1456
+ v("div", Cl, [
1457
+ v("button", {
1001
1458
  type: "button",
1002
1459
  class: "cursor-pointer rounded-control px-2 py-1 text-footnote text-content-muted hover:text-content-strong",
1003
- onClick: j
1004
- }, y(n(r)("core.collection.filters.clear")), 1),
1005
- p("button", Gl, y(n(r)("core.collection.filters.apply")), 1)
1460
+ onClick: L
1461
+ }, y(s(a)("core.collection.filters.clear")), 1),
1462
+ v("button", zl, y(s(a)("core.collection.filters.apply")), 1)
1006
1463
  ])
1007
1464
  ], 32)
1008
1465
  ]),
1009
1466
  _: 1
1010
- }, 8, ["label"])) : (i(), W(n(We), {
1467
+ }, 8, ["label"])) : (c(), Y(s(Ke), {
1011
1468
  key: 1,
1012
- items: f.value,
1013
- label: l.filter.label,
1469
+ items: p.value,
1470
+ label: t.filter.label,
1014
1471
  placement: "bottom-start"
1015
1472
  }, {
1016
- trigger: B(({ toggle: H, attrs: Y }) => [
1017
- p("button", Se(Y, {
1473
+ trigger: q(({ toggle: B, attrs: K }) => [
1474
+ v("button", _e(K, {
1018
1475
  type: "button",
1019
- class: [rt, x.value],
1020
- onClick: H
1476
+ class: [tt, $.value],
1477
+ onClick: B
1021
1478
  }), [
1022
- l.filter.icon ? (i(), W(n(J), {
1479
+ t.filter.icon ? (c(), Y(s(H), {
1023
1480
  key: 0,
1024
- name: l.filter.icon,
1481
+ name: t.filter.icon,
1025
1482
  size: 16
1026
- }, null, 8, ["name"])) : L("", !0),
1027
- p("span", Wl, y(b.value), 1),
1028
- O(n(J), {
1483
+ }, null, 8, ["name"])) : j("", !0),
1484
+ v("span", Pl, y(g.value), 1),
1485
+ P(s(H), {
1029
1486
  name: "arrowDownSLine",
1030
1487
  size: 16,
1031
1488
  class: "text-content-muted"
1032
1489
  })
1033
- ], 16, Jl)
1490
+ ], 16, Al)
1034
1491
  ]),
1035
1492
  _: 1
1036
1493
  }, 8, ["items", "label"]));
1037
1494
  }
1038
- }), Ql = {
1495
+ }), Ol = {
1039
1496
  key: 0,
1040
1497
  "data-test": "filter-drilldown"
1041
- }, Zl = { class: "mb-3 text-headline font-semibold" }, eo = ["aria-label"], to = ["aria-selected", "onClick"], lo = { class: "min-w-0 truncate" }, oo = {
1498
+ }, jl = { class: "mb-3 text-headline font-semibold" }, Ll = ["aria-label"], Rl = ["aria-selected", "onClick"], Tl = { class: "min-w-0 truncate" }, Vl = {
1042
1499
  key: 0,
1043
1500
  class: "mb-5 border-b border-border-separator pb-5",
1044
1501
  "data-test": "saved-filters"
1045
- }, no = { class: "mb-2 text-footnote font-medium text-content-muted" }, so = { class: "flex flex-wrap gap-2" }, ao = ["onClick"], ro = ["aria-label", "title", "onClick"], io = { class: "space-y-5" }, co = { key: 0 }, uo = { class: "mb-1.5 text-footnote font-medium text-content-muted" }, fo = ["aria-label"], po = { class: "mb-1.5 text-footnote font-medium text-content-muted" }, vo = {
1502
+ }, Fl = { class: "mb-2 text-footnote font-medium text-content-muted" }, Ml = { class: "flex flex-wrap gap-2" }, Nl = ["onClick"], Il = ["aria-label", "title", "onClick"], ql = { class: "space-y-5" }, Dl = { key: 0 }, Bl = { class: "mb-1.5 text-footnote font-medium text-content-muted" }, Ul = ["aria-label"], Hl = { class: "mb-1.5 text-footnote font-medium text-content-muted" }, Kl = {
1046
1503
  key: 0,
1047
1504
  class: "grid grid-cols-2 gap-3"
1048
- }, mo = ["aria-label"], go = { class: "mb-2 text-footnote font-medium text-content-muted" }, bo = { class: "flex flex-wrap gap-2" }, ho = ["aria-pressed", "onClick"], yo = ["disabled", "onClick"], _o = { class: "shrink-0 text-subheadline font-medium" }, wo = { class: "flex items-center justify-between gap-2" }, ko = { class: "flex items-center gap-2" }, xo = ["title"], $o = { class: "sm:hidden" }, So = { class: "hidden sm:inline" }, Co = { class: "flex flex-col gap-1.5 text-footnote font-medium text-content-muted" }, zo = ["placeholder"], Po = {
1505
+ }, Xl = ["aria-label"], Gl = { class: "mb-2 text-footnote font-medium text-content-muted" }, Jl = { class: "flex flex-wrap gap-2" }, Wl = ["aria-pressed", "onClick"], Yl = ["disabled", "onClick"], Ql = { class: "shrink-0 text-subheadline font-medium" }, Zl = { class: "flex items-center justify-between gap-2" }, en = { class: "flex items-center gap-2" }, tn = ["title"], on = { class: "sm:hidden" }, ln = { class: "hidden sm:inline" }, nn = { class: "flex flex-col gap-1.5 text-footnote font-medium text-content-muted" }, sn = ["placeholder"], an = {
1049
1506
  key: 0,
1050
1507
  class: "text-footnote text-status-warning-content",
1051
1508
  "data-test": "saved-filter-replace-hint"
1052
- }, Ao = { class: "flex justify-end gap-2" }, Eo = 8, jo = 18, it = 6e3, Oo = /* @__PURE__ */ we({
1509
+ }, rn = { class: "flex justify-end gap-2" }, cn = 8, un = 18, ot = 6e3, dn = /* @__PURE__ */ ue({
1053
1510
  __name: "CollectionFilterPanel",
1054
1511
  props: {
1055
1512
  collection: {},
1056
1513
  filters: {}
1057
1514
  },
1058
1515
  emits: ["touched"],
1059
- setup(t, { expose: e, emit: l }) {
1060
- const s = t, r = l, { t: a } = Ce(), c = _e("sheet"), f = bt("(max-width: 1023px), (pointer: coarse)"), b = ue({}), v = ue({}), x = ue(null), S = _(() => s.filters.find((h) => h.key === x.value) ?? null);
1061
- function D() {
1062
- const h = {}, w = {};
1063
- for (const o of s.filters) {
1064
- const u = s.collection.query.value.filters[o.key];
1065
- if (h[o.key] = ye(u) ? null : String(u), o.type === "range") {
1066
- const [V, X] = yt(h[o.key]);
1067
- w[o.key] = { min: V ?? "", max: X ?? "" };
1516
+ setup(l, { expose: e, emit: t }) {
1517
+ const i = l, a = t, { t: n } = he(), u = ge("sheet"), p = pt("(max-width: 1023px), (pointer: coarse)"), g = ae({}), m = ae({}), $ = ae(null), S = h(() => i.filters.find((r) => r.key === $.value) ?? null);
1518
+ function N() {
1519
+ const r = {}, _ = {};
1520
+ for (const o of i.filters) {
1521
+ const f = i.collection.query.value.filters[o.key];
1522
+ if (r[o.key] = me(f) ? null : String(f), o.type === "range") {
1523
+ const [F, G] = vt(r[o.key]);
1524
+ _[o.key] = { min: F ?? "", max: G ?? "" };
1068
1525
  }
1069
1526
  }
1070
- b.value = h, v.value = w, x.value = null, c.value?.present();
1527
+ g.value = r, m.value = _, $.value = null, u.value?.present();
1071
1528
  }
1072
- function P(h, w) {
1073
- const o = ye(w) ? null : String(w);
1074
- if (b.value[h] !== o) {
1075
- b.value = { ...b.value, [h]: o };
1076
- for (const u of s.filters.filter((V) => V.dependsOn === h)) P(u.key, null);
1529
+ function k(r, _) {
1530
+ const o = me(_) ? null : String(_);
1531
+ if (g.value[r] !== o) {
1532
+ g.value = { ...g.value, [r]: o };
1533
+ for (const f of i.filters.filter((F) => F.dependsOn === r)) k(f.key, null);
1077
1534
  }
1078
1535
  }
1079
- function j() {
1080
- for (const h of s.filters)
1081
- b.value[h.key] = null, h.type === "range" && (v.value[h.key] = { min: "", max: "" });
1536
+ function L() {
1537
+ for (const r of i.filters)
1538
+ g.value[r.key] = null, r.type === "range" && (m.value[r.key] = { min: "", max: "" });
1082
1539
  }
1083
- const A = (h) => h.replace(/[^\d.,-]/g, "").replace(",", "."), U = (h, w) => {
1084
- const o = v.value[h]?.[w] ?? "", u = o === "" ? Number.NaN : Number(A(o));
1085
- return Number.isNaN(u) ? null : u;
1540
+ const z = (r) => r.replace(/[^\d.,-]/g, "").replace(",", "."), D = (r, _) => {
1541
+ const o = m.value[r]?.[_] ?? "", f = o === "" ? Number.NaN : Number(z(o));
1542
+ return Number.isNaN(f) ? null : f;
1086
1543
  };
1087
- function k(h, w, o) {
1088
- const u = v.value[h];
1089
- u && (u[w] = o === null ? "" : String(o));
1544
+ function x(r, _, o) {
1545
+ const f = m.value[r];
1546
+ f && (f[_] = o === null ? "" : String(o));
1090
1547
  }
1091
1548
  function R() {
1092
- const h = {};
1093
- for (const w of s.filters) {
1094
- const o = v.value[w.key];
1095
- h[w.key] = w.type === "range" ? Bt(o ? A(o.min) : null, o ? A(o.max) : null) : b.value[w.key] ?? null;
1549
+ const r = {};
1550
+ for (const _ of i.filters) {
1551
+ const o = m.value[_.key];
1552
+ r[_.key] = _.type === "range" ? Ft(o ? z(o.min) : null, o ? z(o.max) : null) : g.value[_.key] ?? null;
1096
1553
  }
1097
- return h;
1554
+ return r;
1098
1555
  }
1099
- function H() {
1100
- const h = R(), w = Object.keys(h).filter((o) => (s.collection.query.value.filters[o] ?? null) !== h[o]);
1101
- r("touched", w), s.collection.setFilters(h), c.value?.dismiss();
1556
+ function B() {
1557
+ const r = R(), _ = Object.keys(r).filter((o) => (i.collection.query.value.filters[o] ?? null) !== r[o]);
1558
+ a("touched", _), i.collection.setFilters(r), u.value?.dismiss();
1102
1559
  }
1103
- const Y = (h) => Ht(h, h.dependsOn ? b.value[h.dependsOn] : null), F = (h) => h.defaultOptionTitle ?? a("core.collection.filters.show_all");
1104
- function re(h) {
1105
- const w = b.value[h.key];
1106
- return w == null ? F(h) : Y(h).find((o) => o.value === w)?.label ?? w;
1560
+ const K = (r) => Mt(r, r.dependsOn ? g.value[r.dependsOn] : null), M = (r) => r.defaultOptionTitle ?? n("core.collection.filters.show_all");
1561
+ function ee(r) {
1562
+ const _ = g.value[r.key];
1563
+ return _ == null ? M(r) : K(r).find((o) => o.value === _)?.label ?? _;
1107
1564
  }
1108
- const te = (h) => [
1109
- { value: "", label: F(h) },
1110
- ...Y(h).map((w) => ({ value: String(w.value), label: w.label }))
1111
- ], C = (h) => [
1112
- { value: "", label: F(h) },
1113
- ...(h.options ?? []).map((w) => ({ value: String(w.value), label: w.label }))
1565
+ const O = (r) => [
1566
+ { value: "", label: M(r) },
1567
+ ...K(r).map((_) => ({ value: String(_.value), label: _.label }))
1568
+ ], A = (r) => [
1569
+ { value: "", label: M(r) },
1570
+ ...(r.options ?? []).map((_) => ({ value: String(_.value), label: _.label }))
1114
1571
  ];
1115
- function T(h) {
1116
- const w = Y(h);
1117
- return !h.dependsOn && w.length > 0 && w.length <= Eo && w.every((o) => o.label.length <= jo);
1572
+ function I(r) {
1573
+ const _ = K(r);
1574
+ return !r.dependsOn && _.length > 0 && _.length <= cn && _.every((o) => o.label.length <= un);
1118
1575
  }
1119
- const N = _(() => f.value && S.value !== null), E = _(() => s.collection.savedViews), z = ue(""), q = ue(!1), de = _e("savePopover");
1120
- function me() {
1121
- const h = new Set(s.filters.map((o) => o.key)), w = {};
1122
- for (const [o, u] of Object.entries(s.collection.query.value.filters))
1123
- !h.has(o) && u !== void 0 && u !== "" && (w[o] = String(u));
1124
- for (const [o, u] of Object.entries(R())) u !== null && (w[o] = u);
1125
- return { filters: w, search: s.collection.query.value.search };
1576
+ const T = h(() => p.value && S.value !== null), b = h(() => i.collection.savedViews), C = ae(""), E = ae(!1), ie = ge("savePopover");
1577
+ function de() {
1578
+ const r = new Set(i.filters.map((o) => o.key)), _ = {};
1579
+ for (const [o, f] of Object.entries(i.collection.query.value.filters))
1580
+ !r.has(o) && f !== void 0 && f !== "" && (_[o] = String(f));
1581
+ for (const [o, f] of Object.entries(R())) f !== null && (_[o] = f);
1582
+ return { filters: _, search: i.collection.query.value.search };
1126
1583
  }
1127
- const ve = _(() => {
1128
- const h = me();
1129
- return Object.keys(h.filters).length > 0 || h.search.trim() !== "";
1130
- }), ae = _(() => {
1131
- const h = z.value.trim();
1132
- return h ? E.value?.items.value.find((w) => w.name === h) ?? null : null;
1133
- }), ge = (h, w) => Lt(h) && h.message ? h.message : w;
1134
- async function oe() {
1135
- const h = z.value.trim(), w = E.value;
1136
- if (!(!w || !h || q.value || !ve.value)) {
1137
- q.value = !0;
1584
+ const ce = h(() => {
1585
+ const r = de();
1586
+ return Object.keys(r.filters).length > 0 || r.search.trim() !== "";
1587
+ }), re = h(() => {
1588
+ const r = C.value.trim();
1589
+ return r ? b.value?.items.value.find((_) => _.name === r) ?? null : null;
1590
+ }), fe = (r, _) => zt(r) && r.message ? r.message : _;
1591
+ async function ne() {
1592
+ const r = C.value.trim(), _ = b.value;
1593
+ if (!(!_ || !r || E.value || !ce.value)) {
1594
+ E.value = !0;
1138
1595
  try {
1139
- const o = await w.save(h, me());
1140
- z.value = "", de.value?.dismiss(), je.success(a("core.collection.saved.saved_toast", { name: o.name })), w.apply(o), r("touched", []), c.value?.dismiss();
1596
+ const o = await _.save(r, de());
1597
+ C.value = "", ie.value?.dismiss(), Ce.success(n("core.collection.saved.saved_toast", { name: o.name })), _.apply(o), a("touched", []), u.value?.dismiss();
1141
1598
  } catch (o) {
1142
- je.error(ge(o, a("core.collection.saved.save_failed")));
1599
+ Ce.error(fe(o, n("core.collection.saved.save_failed")));
1143
1600
  } finally {
1144
- q.value = !1;
1601
+ E.value = !1;
1145
1602
  }
1146
1603
  }
1147
1604
  }
1148
- function ie(h) {
1149
- E.value?.apply(h), r("touched", []), c.value?.dismiss();
1605
+ function w(r) {
1606
+ b.value?.apply(r), a("touched", []), u.value?.dismiss();
1150
1607
  }
1151
- function ce(h) {
1152
- const w = E.value;
1153
- if (!w) return;
1154
- const { revert: o, commit: u } = w.stageRemoval(h.id), V = setTimeout(() => {
1155
- u().catch((X) => {
1156
- o(), je.error(ge(X, a("core.collection.saved.delete_failed")));
1608
+ function U(r) {
1609
+ const _ = b.value;
1610
+ if (!_) return;
1611
+ const { revert: o, commit: f } = _.stageRemoval(r.id), F = setTimeout(() => {
1612
+ f().catch((G) => {
1613
+ o(), Ce.error(fe(G, n("core.collection.saved.delete_failed")));
1157
1614
  });
1158
- }, it);
1159
- je.success(a("core.collection.saved.deleted_toast", { name: h.name }), {
1160
- duration: it,
1615
+ }, ot);
1616
+ Ce.success(n("core.collection.saved.deleted_toast", { name: r.name }), {
1617
+ duration: ot,
1161
1618
  action: {
1162
- label: a("core.collection.saved.undo"),
1619
+ label: n("core.collection.saved.undo"),
1163
1620
  onClick: () => {
1164
- clearTimeout(V), o();
1621
+ clearTimeout(F), o();
1165
1622
  }
1166
1623
  }
1167
1624
  });
1168
1625
  }
1169
- return e({ present: D }), (h, w) => (i(), W(n(Dt), {
1626
+ return e({ present: N }), (r, _) => (c(), Y(s(Tt), {
1170
1627
  ref_key: "sheet",
1171
- ref: c,
1172
- title: n(a)("core.collection.filters.panel_title"),
1173
- grouped: N.value
1628
+ ref: u,
1629
+ title: s(n)("core.collection.filters.panel_title"),
1630
+ grouped: T.value
1174
1631
  }, {
1175
- footer: B(() => [
1176
- p("div", wo, [
1177
- O(he, {
1632
+ footer: q(() => [
1633
+ v("div", Zl, [
1634
+ P(be, {
1178
1635
  prominence: "standard",
1179
1636
  class: "whitespace-nowrap",
1180
- onClick: j
1637
+ onClick: L
1181
1638
  }, {
1182
- default: B(() => [
1183
- ne(y(n(a)("core.collection.filters.reset_all")), 1)
1639
+ default: q(() => [
1640
+ le(y(s(n)("core.collection.filters.reset_all")), 1)
1184
1641
  ]),
1185
1642
  _: 1
1186
1643
  }),
1187
- p("div", ko, [
1188
- E.value ? (i(), W(n(ht), {
1644
+ v("div", en, [
1645
+ b.value ? (c(), Y(s(ft), {
1189
1646
  key: 0,
1190
1647
  ref_key: "savePopover",
1191
- ref: de,
1648
+ ref: ie,
1192
1649
  placement: "top-end",
1193
- label: n(a)("core.collection.saved.save_button")
1650
+ label: s(n)("core.collection.saved.save_button")
1194
1651
  }, {
1195
- trigger: B(({ toggle: o, attrs: u }) => [
1196
- p("span", {
1197
- title: ve.value ? void 0 : n(a)("core.collection.saved.nothing_to_save")
1652
+ trigger: q(({ toggle: o, attrs: f }) => [
1653
+ v("span", {
1654
+ title: ce.value ? void 0 : s(n)("core.collection.saved.nothing_to_save")
1198
1655
  }, [
1199
- O(he, Se({ ...u, "data-test": "saved-filter-open" }, {
1656
+ P(be, _e({ ...f, "data-test": "saved-filter-open" }, {
1200
1657
  prominence: "standard",
1201
1658
  icon: "save",
1202
1659
  class: "whitespace-nowrap",
1203
- disabled: !ve.value,
1660
+ disabled: !ce.value,
1204
1661
  onClick: o
1205
1662
  }), {
1206
- default: B(() => [
1207
- p("span", $o, y(n(a)("core.collection.saved.save")), 1),
1208
- p("span", So, y(n(a)("core.collection.saved.save_button")), 1)
1663
+ default: q(() => [
1664
+ v("span", on, y(s(n)("core.collection.saved.save")), 1),
1665
+ v("span", ln, y(s(n)("core.collection.saved.save_button")), 1)
1209
1666
  ]),
1210
1667
  _: 1
1211
1668
  }, 16, ["disabled", "onClick"])
1212
- ], 8, xo)
1669
+ ], 8, tn)
1213
1670
  ]),
1214
- default: B(() => [
1215
- p("form", {
1671
+ default: q(() => [
1672
+ v("form", {
1216
1673
  class: "flex flex-col gap-3",
1217
1674
  "data-test": "saved-filter-form",
1218
- onSubmit: Re(oe, ["prevent"])
1675
+ onSubmit: Ee(ne, ["prevent"])
1219
1676
  }, [
1220
- p("label", Co, [
1221
- ne(y(n(a)("core.collection.saved.name_label")) + " ", 1),
1222
- Ge(p("input", {
1223
- "onUpdate:modelValue": w[1] || (w[1] = (o) => z.value = o),
1677
+ v("label", nn, [
1678
+ le(y(s(n)("core.collection.saved.name_label")) + " ", 1),
1679
+ De(v("input", {
1680
+ "onUpdate:modelValue": _[1] || (_[1] = (o) => C.value = o),
1224
1681
  type: "text",
1225
1682
  maxlength: "60",
1226
1683
  autocomplete: "off",
1227
- placeholder: n(a)("core.collection.saved.name_placeholder"),
1684
+ placeholder: s(n)("core.collection.saved.name_placeholder"),
1228
1685
  class: "rounded-control bg-fill px-2.5 py-1.5 text-body text-content-strong outline-none placeholder:text-content-disabled focus:bg-surface-cell focus:ring-[1.5px] focus:ring-inset focus:ring-border-focus"
1229
- }, null, 8, zo), [
1230
- [Je, z.value]
1686
+ }, null, 8, sn), [
1687
+ [Be, C.value]
1231
1688
  ])
1232
1689
  ]),
1233
- ae.value ? (i(), d("p", Po, y(n(a)("core.collection.saved.replace_hint", { name: ae.value.name })), 1)) : L("", !0),
1234
- p("div", Ao, [
1235
- O(he, {
1690
+ re.value ? (c(), d("p", an, y(s(n)("core.collection.saved.replace_hint", { name: re.value.name })), 1)) : j("", !0),
1691
+ v("div", rn, [
1692
+ P(be, {
1236
1693
  size: "sm",
1237
- onClick: w[2] || (w[2] = (o) => de.value?.dismiss())
1694
+ onClick: _[2] || (_[2] = (o) => ie.value?.dismiss())
1238
1695
  }, {
1239
- default: B(() => [
1240
- ne(y(n(a)("core.actions.cancel")), 1)
1696
+ default: q(() => [
1697
+ le(y(s(n)("core.actions.cancel")), 1)
1241
1698
  ]),
1242
1699
  _: 1
1243
1700
  }),
1244
- O(he, Se({ "data-test": "saved-filter-save" }, {
1701
+ P(be, _e({ "data-test": "saved-filter-save" }, {
1245
1702
  type: "submit",
1246
1703
  prominence: "primary",
1247
1704
  size: "sm",
1248
- processing: q.value,
1249
- disabled: !z.value.trim()
1705
+ processing: E.value,
1706
+ disabled: !C.value.trim()
1250
1707
  }), {
1251
- default: B(() => [
1252
- ne(y(ae.value ? n(a)("core.collection.saved.replace") : n(a)("core.collection.saved.save")), 1)
1708
+ default: q(() => [
1709
+ le(y(re.value ? s(n)("core.collection.saved.replace") : s(n)("core.collection.saved.save")), 1)
1253
1710
  ]),
1254
1711
  _: 1
1255
1712
  }, 16, ["processing", "disabled"])
@@ -1257,172 +1714,172 @@ const ul = {
1257
1714
  ], 32)
1258
1715
  ]),
1259
1716
  _: 1
1260
- }, 8, ["label"])) : L("", !0),
1261
- O(he, {
1717
+ }, 8, ["label"])) : j("", !0),
1718
+ P(be, {
1262
1719
  prominence: "primary",
1263
1720
  icon: "filter3",
1264
1721
  class: "whitespace-nowrap",
1265
- onClick: H
1722
+ onClick: B
1266
1723
  }, {
1267
- default: B(() => [
1268
- ne(y(n(a)("core.collection.filters.apply")), 1)
1724
+ default: q(() => [
1725
+ le(y(s(n)("core.collection.filters.apply")), 1)
1269
1726
  ]),
1270
1727
  _: 1
1271
1728
  })
1272
1729
  ])
1273
1730
  ])
1274
1731
  ]),
1275
- default: B(() => [
1276
- n(f) && S.value ? (i(), d("div", Ql, [
1277
- p("button", {
1732
+ default: q(() => [
1733
+ s(p) && S.value ? (c(), d("div", Ol, [
1734
+ v("button", {
1278
1735
  type: "button",
1279
1736
  "data-test": "filter-drilldown-back",
1280
1737
  class: "-mx-2 -mt-2 mb-1 inline-flex h-10 cursor-pointer items-center gap-0.5 rounded-control px-2 text-body font-medium text-content-link active:bg-tint-soft",
1281
- onClick: w[0] || (w[0] = (o) => x.value = null)
1738
+ onClick: _[0] || (_[0] = (o) => $.value = null)
1282
1739
  }, [
1283
- O(n(J), {
1740
+ P(s(H), {
1284
1741
  name: "arrowLeftSLine",
1285
1742
  size: 20
1286
1743
  }),
1287
- ne(" " + y(n(a)("core.collection.filters.panel_title")), 1)
1744
+ le(" " + y(s(n)("core.collection.filters.panel_title")), 1)
1288
1745
  ]),
1289
- p("p", Zl, y(S.value.label), 1),
1290
- p("ul", {
1746
+ v("p", jl, y(S.value.label), 1),
1747
+ v("ul", {
1291
1748
  class: "overflow-hidden rounded-group bg-surface-cell shadow-group",
1292
1749
  role: "listbox",
1293
1750
  "aria-label": S.value.label
1294
1751
  }, [
1295
- (i(!0), d(I, null, Z([{ value: null, label: F(S.value) }, ...Y(S.value)], (o) => (i(), d("li", {
1752
+ (c(!0), d(V, null, X([{ value: null, label: M(S.value) }, ...K(S.value)], (o) => (c(), d("li", {
1296
1753
  key: String(o.value),
1297
1754
  role: "presentation"
1298
1755
  }, [
1299
- p("button", {
1756
+ v("button", {
1300
1757
  type: "button",
1301
1758
  role: "option",
1302
- "aria-selected": (b.value[S.value.key] ?? null) === o.value,
1759
+ "aria-selected": (g.value[S.value.key] ?? null) === o.value,
1303
1760
  class: "flex min-h-11 w-full cursor-pointer items-center justify-between gap-3 px-row-inset text-left text-body active:bg-fill",
1304
- onClick: (u) => {
1305
- P(S.value.key, o.value), x.value = null;
1761
+ onClick: (f) => {
1762
+ k(S.value.key, o.value), $.value = null;
1306
1763
  }
1307
1764
  }, [
1308
- p("span", lo, y(o.label), 1),
1309
- (b.value[S.value.key] ?? null) === o.value ? (i(), W(n(J), {
1765
+ v("span", Tl, y(o.label), 1),
1766
+ (g.value[S.value.key] ?? null) === o.value ? (c(), Y(s(H), {
1310
1767
  key: 0,
1311
1768
  name: "checkboxCircleFill",
1312
1769
  size: 18,
1313
1770
  class: "shrink-0 text-content-link"
1314
- })) : L("", !0)
1315
- ], 8, to)
1771
+ })) : j("", !0)
1772
+ ], 8, Rl)
1316
1773
  ]))), 128))
1317
- ], 8, eo)
1318
- ])) : (i(), d(I, { key: 1 }, [
1319
- E.value && E.value.items.value.length > 0 ? (i(), d("section", oo, [
1320
- p("p", no, y(n(a)("core.collection.saved.title")), 1),
1321
- p("div", so, [
1322
- (i(!0), d(I, null, Z(E.value.items.value, (o) => (i(), d("span", {
1774
+ ], 8, Ll)
1775
+ ])) : (c(), d(V, { key: 1 }, [
1776
+ b.value && b.value.items.value.length > 0 ? (c(), d("section", Vl, [
1777
+ v("p", Fl, y(s(n)("core.collection.saved.title")), 1),
1778
+ v("div", Ml, [
1779
+ (c(!0), d(V, null, X(b.value.items.value, (o) => (c(), d("span", {
1323
1780
  key: o.id,
1324
1781
  class: "inline-flex h-8 items-center rounded-control bg-surface-cell text-subheadline shadow-group ring-1 ring-inset ring-border-separator"
1325
1782
  }, [
1326
- p("button", {
1783
+ v("button", {
1327
1784
  type: "button",
1328
1785
  "data-test": "saved-filter-apply",
1329
1786
  class: "inline-flex h-full cursor-pointer items-center gap-1.5 rounded-l-control pr-1.5 pl-2.5 font-medium text-content-strong hover:bg-fill",
1330
- onClick: (u) => ie(o)
1787
+ onClick: (f) => w(o)
1331
1788
  }, [
1332
- O(n(J), {
1789
+ P(s(H), {
1333
1790
  name: "starFill",
1334
1791
  size: 12,
1335
1792
  class: "text-status-warning-content"
1336
1793
  }),
1337
- ne(" " + y(o.name), 1)
1338
- ], 8, ao),
1339
- p("button", {
1794
+ le(" " + y(o.name), 1)
1795
+ ], 8, Nl),
1796
+ v("button", {
1340
1797
  type: "button",
1341
1798
  "data-test": "saved-filter-delete",
1342
- "aria-label": n(a)("core.collection.saved.delete", { name: o.name }),
1343
- title: n(a)("core.collection.saved.delete", { name: o.name }),
1799
+ "aria-label": s(n)("core.collection.saved.delete", { name: o.name }),
1800
+ title: s(n)("core.collection.saved.delete", { name: o.name }),
1344
1801
  class: "h-full cursor-pointer rounded-r-control px-1.5 text-content-muted hover:bg-fill hover:text-content-destructive",
1345
- onClick: (u) => ce(o)
1802
+ onClick: (f) => U(o)
1346
1803
  }, [
1347
- O(n(J), {
1804
+ P(s(H), {
1348
1805
  name: "close",
1349
1806
  size: 12
1350
1807
  })
1351
- ], 8, ro)
1808
+ ], 8, Il)
1352
1809
  ]))), 128))
1353
1810
  ])
1354
- ])) : L("", !0),
1355
- p("div", io, [
1356
- (i(!0), d(I, null, Z(s.filters, (o) => (i(), d(I, {
1811
+ ])) : j("", !0),
1812
+ v("div", ql, [
1813
+ (c(!0), d(V, null, X(i.filters, (o) => (c(), d(V, {
1357
1814
  key: o.key
1358
1815
  }, [
1359
- o.type === "segmented" ? (i(), d("div", co, [
1360
- p("p", uo, y(o.label), 1),
1361
- O(n(gt), {
1362
- "model-value": b.value[o.key] ?? "",
1363
- tabs: C(o),
1816
+ o.type === "segmented" ? (c(), d("div", Dl, [
1817
+ v("p", Bl, y(o.label), 1),
1818
+ P(s(ut), {
1819
+ "model-value": g.value[o.key] ?? "",
1820
+ tabs: A(o),
1364
1821
  label: o.label,
1365
1822
  stretch: "",
1366
- "onUpdate:modelValue": (u) => P(o.key, u === null ? null : String(u))
1823
+ "onUpdate:modelValue": (f) => k(o.key, f === null ? null : String(f))
1367
1824
  }, null, 8, ["model-value", "tabs", "label", "onUpdate:modelValue"])
1368
- ])) : o.type === "range" ? (i(), d("div", {
1825
+ ])) : o.type === "range" ? (c(), d("div", {
1369
1826
  key: 1,
1370
1827
  role: "group",
1371
1828
  "aria-label": o.label
1372
1829
  }, [
1373
- p("p", po, y(o.label), 1),
1374
- v.value[o.key] ? (i(), d("div", vo, [
1375
- (i(), d(I, null, Z(["min", "max"], (u) => O(Ft, {
1376
- key: u,
1377
- "model-value": U(o.key, u),
1378
- name: `${o.key}_${u}`,
1830
+ v("p", Hl, y(o.label), 1),
1831
+ m.value[o.key] ? (c(), d("div", Kl, [
1832
+ (c(), d(V, null, X(["min", "max"], (f) => P(Lt, {
1833
+ key: f,
1834
+ "model-value": D(o.key, f),
1835
+ name: `${o.key}_${f}`,
1379
1836
  width: "full",
1380
1837
  decimals: o.decimals ?? 0,
1381
1838
  suffix: o.unit,
1382
- label: n(a)(u === "min" ? "core.collection.filters.range_from" : "core.collection.filters.range_until"),
1383
- "onUpdate:modelValue": (V) => k(o.key, u, V)
1839
+ label: s(n)(f === "min" ? "core.collection.filters.range_from" : "core.collection.filters.range_until"),
1840
+ "onUpdate:modelValue": (F) => x(o.key, f, F)
1384
1841
  }, null, 8, ["model-value", "name", "decimals", "suffix", "label", "onUpdate:modelValue"])), 64))
1385
- ])) : L("", !0)
1386
- ], 8, fo)) : n(f) && T(o) ? (i(), d("div", {
1842
+ ])) : j("", !0)
1843
+ ], 8, Ul)) : s(p) && I(o) ? (c(), d("div", {
1387
1844
  key: 2,
1388
1845
  role: "group",
1389
1846
  "aria-label": o.label,
1390
1847
  "data-test": "filter-chips"
1391
1848
  }, [
1392
- p("p", go, y(o.label), 1),
1393
- p("div", bo, [
1394
- (i(!0), d(I, null, Z([{ value: null, label: F(o) }, ...Y(o)], (u) => (i(), d("button", {
1395
- key: String(u.value),
1849
+ v("p", Gl, y(o.label), 1),
1850
+ v("div", Jl, [
1851
+ (c(!0), d(V, null, X([{ value: null, label: M(o) }, ...K(o)], (f) => (c(), d("button", {
1852
+ key: String(f.value),
1396
1853
  type: "button",
1397
- "aria-pressed": (b.value[o.key] ?? null) === u.value,
1398
- class: le(["min-h-9 cursor-pointer rounded-full px-3.5 text-subheadline ring-1 ring-inset transition-colors", (b.value[o.key] ?? null) === u.value ? "bg-tint-soft font-semibold text-content-link ring-border-selected" : "bg-surface-cell text-content ring-border-separator active:bg-fill"]),
1399
- onClick: (V) => P(o.key, u.value)
1400
- }, y(u.label), 11, ho))), 128))
1854
+ "aria-pressed": (g.value[o.key] ?? null) === f.value,
1855
+ class: W(["min-h-9 cursor-pointer rounded-full px-3.5 text-subheadline ring-1 ring-inset transition-colors", (g.value[o.key] ?? null) === f.value ? "bg-tint-soft font-semibold text-content-link ring-border-selected" : "bg-surface-cell text-content ring-border-separator active:bg-fill"]),
1856
+ onClick: (F) => k(o.key, f.value)
1857
+ }, y(f.label), 11, Wl))), 128))
1401
1858
  ])
1402
- ], 8, mo)) : n(f) ? (i(), d("button", {
1859
+ ], 8, Xl)) : s(p) ? (c(), d("button", {
1403
1860
  key: 3,
1404
1861
  type: "button",
1405
1862
  "data-test": "filter-row",
1406
- disabled: !!o.dependsOn && Y(o).length === 0,
1863
+ disabled: !!o.dependsOn && K(o).length === 0,
1407
1864
  class: "flex min-h-12 w-full cursor-pointer items-center gap-3 rounded-group bg-surface-cell px-3 text-left ring-1 ring-inset ring-border-separator active:bg-fill disabled:cursor-not-allowed disabled:opacity-50",
1408
- onClick: (u) => x.value = o.key
1865
+ onClick: (f) => $.value = o.key
1409
1866
  }, [
1410
- p("span", _o, y(o.label), 1),
1411
- p("span", {
1412
- class: le(["min-w-0 flex-1 truncate text-right text-subheadline", b.value[o.key] == null ? "text-content-disabled" : "font-medium text-content-link"])
1413
- }, y(re(o)), 3),
1414
- O(n(J), {
1867
+ v("span", Ql, y(o.label), 1),
1868
+ v("span", {
1869
+ class: W(["min-w-0 flex-1 truncate text-right text-subheadline", g.value[o.key] == null ? "text-content-disabled" : "font-medium text-content-link"])
1870
+ }, y(ee(o)), 3),
1871
+ P(s(H), {
1415
1872
  name: "arrowRightSLine",
1416
1873
  size: 18,
1417
1874
  class: "shrink-0 text-content-muted"
1418
1875
  })
1419
- ], 8, yo)) : (i(), W(qt, {
1876
+ ], 8, Yl)) : (c(), Y(Rt, {
1420
1877
  key: 4,
1421
- "model-value": b.value[o.key] ?? "",
1878
+ "model-value": g.value[o.key] ?? "",
1422
1879
  label: o.label,
1423
- options: te(o),
1424
- disabled: !!o.dependsOn && Y(o).length === 0,
1425
- "onUpdate:modelValue": (u) => P(o.key, u === "" ? null : u)
1880
+ options: O(o),
1881
+ disabled: !!o.dependsOn && K(o).length === 0,
1882
+ "onUpdate:modelValue": (f) => k(o.key, f === "" ? null : f)
1426
1883
  }, null, 8, ["model-value", "label", "options", "disabled", "onUpdate:modelValue"]))
1427
1884
  ], 64))), 128))
1428
1885
  ])
@@ -1431,17 +1888,17 @@ const ul = {
1431
1888
  _: 1
1432
1889
  }, 8, ["title", "grouped"]));
1433
1890
  }
1434
- }), Lo = { class: "flex flex-col items-start gap-2 lg:flex-row" }, To = { class: "flex h-9 w-full items-center rounded-control bg-fill px-2.5 text-content-muted transition-colors duration-motion-fast focus-within:outline-2 focus-within:outline-offset-1 focus-within:outline-border-focus lg:w-72 compact:h-10" }, Ro = ["placeholder", "aria-label"], Mo = ["aria-label"], Vo = ["title"], No = {
1891
+ }), fn = { class: "flex flex-col items-start gap-2 lg:flex-row" }, pn = { class: "flex h-9 w-full items-center rounded-control bg-fill px-2.5 text-content-muted transition-colors duration-motion-fast focus-within:outline-2 focus-within:outline-offset-1 focus-within:outline-border-focus lg:w-72 compact:h-10" }, vn = ["placeholder", "aria-label"], mn = ["aria-label"], bn = ["title"], gn = {
1435
1892
  key: 0,
1436
1893
  class: "min-w-4.5 rounded-full bg-tint px-1 text-center text-caption font-semibold leading-4.5 text-content-on-tint"
1437
- }, Io = ["onClick"], Fo = {
1894
+ }, hn = ["onClick"], yn = {
1438
1895
  key: 0,
1439
1896
  class: "mt-2.5 flex flex-wrap items-center gap-2",
1440
1897
  "data-test": "collection-filter-chips"
1441
- }, qo = {
1898
+ }, wn = {
1442
1899
  key: 0,
1443
1900
  class: "shrink-0 opacity-80"
1444
- }, Do = { class: "flex min-w-0 flex-wrap items-center gap-1 font-semibold" }, Uo = { class: "break-words" }, Bo = ["aria-label", "onClick"], ct = "__search", Ho = 3, Ko = 300, Xo = /* @__PURE__ */ we({
1901
+ }, _n = { class: "flex min-w-0 flex-wrap items-center gap-1 font-semibold" }, kn = { class: "break-words" }, xn = ["aria-label", "onClick"], lt = "__search", $n = 3, Sn = 300, Cn = /* @__PURE__ */ ue({
1445
1902
  __name: "CollectionToolbar",
1446
1903
  props: {
1447
1904
  collection: {},
@@ -1449,305 +1906,213 @@ const ul = {
1449
1906
  flat: { type: Boolean }
1450
1907
  },
1451
1908
  emits: ["touched"],
1452
- setup(t, { emit: e }) {
1453
- const l = t, s = e, { t: r } = Ce(), a = Ve(), c = ue(l.collection.query.value.search), f = _e("field");
1454
- let b = null;
1455
- Ae(() => l.collection.query.value.search, (C) => {
1456
- C !== c.value.trim() && (c.value = C);
1909
+ setup(l, { emit: e }) {
1910
+ const t = l, i = e, { t: a } = he(), n = Le(), u = ae(t.collection.query.value.search), p = ge("field");
1911
+ let g = null;
1912
+ Se(() => t.collection.query.value.search, (A) => {
1913
+ A !== u.value.trim() && (u.value = A);
1457
1914
  });
1458
- function v() {
1459
- b && clearTimeout(b);
1460
- const C = c.value;
1461
- C.length > 0 && C.length < Ho || (b = setTimeout(() => {
1462
- b = null, C !== l.collection.query.value.search && (s("touched", [ct]), l.collection.search(C));
1463
- }, Ko));
1915
+ function m() {
1916
+ g && clearTimeout(g);
1917
+ const A = u.value;
1918
+ A.length > 0 && A.length < $n || (g = setTimeout(() => {
1919
+ g = null, A !== t.collection.query.value.search && (i("touched", [lt]), t.collection.search(A));
1920
+ }, Sn));
1464
1921
  }
1465
- function x() {
1466
- b && clearTimeout(b), c.value = "", s("touched", [ct]), l.collection.search(""), f.value?.focus();
1922
+ function $() {
1923
+ g && clearTimeout(g), u.value = "", i("touched", [lt]), t.collection.search(""), p.value?.focus();
1467
1924
  }
1468
- Ct(() => b && clearTimeout(b));
1469
- const S = (C) => C.placement === "panel" || l.narrow && C.type !== "text", D = _(() => l.collection.filters.value.filter((C) => !S(C))), P = _(() => l.collection.filters.value.filter(S)), j = _(() => l.collection.query.value.filters), A = _(
1470
- () => _t(P.value, j.value, {
1471
- formatNumber: (C) => a.number(C),
1472
- from: r("core.collection.filters.range_from"),
1473
- until: r("core.collection.filters.range_until")
1925
+ kt(() => g && clearTimeout(g));
1926
+ const S = (A) => A.placement === "panel" || t.narrow && A.type !== "text", N = h(() => t.collection.filters.value.filter((A) => !S(A))), k = h(() => t.collection.filters.value.filter(S)), L = h(() => t.collection.query.value.filters), z = h(
1927
+ () => mt(k.value, L.value, {
1928
+ formatNumber: (A) => n.number(A),
1929
+ from: a("core.collection.filters.range_from"),
1930
+ until: a("core.collection.filters.range_until")
1474
1931
  })
1475
- ), U = _(() => Xt(P.value, j.value));
1476
- function k(C, T) {
1477
- s("touched", [C]), l.collection.setFilter(C, T);
1932
+ ), D = h(() => It(k.value, L.value));
1933
+ function x(A, I) {
1934
+ i("touched", [A]), t.collection.setFilter(A, I);
1478
1935
  }
1479
- function R(C) {
1480
- l.collection.setFilters(Object.fromEntries(C.map((T) => [T, null])));
1936
+ function R(A) {
1937
+ t.collection.setFilters(Object.fromEntries(A.map((I) => [I, null])));
1481
1938
  }
1482
- const H = _e("panel"), Y = _e("panelButton"), F = (C) => !!C && (typeof C.checkVisibility != "function" || C.checkVisibility());
1483
- Qe({ key: "/" }, () => {
1484
- if (!F(f.value)) return !1;
1485
- f.value?.focus(), f.value?.select();
1486
- }), Qe({ key: "f" }, () => {
1487
- if (P.value.length === 0 || !F(Y.value)) return !1;
1488
- H.value?.present();
1939
+ const B = ge("panel"), K = ge("panelButton"), M = (A) => !!A && (typeof A.checkVisibility != "function" || A.checkVisibility());
1940
+ Xe({ key: "/", group: "list", label: () => a("core.shortcuts.focus_search") }, () => {
1941
+ if (!M(p.value)) return !1;
1942
+ p.value?.focus(), p.value?.select();
1943
+ }), Xe({ key: "f", group: "list", label: () => k.value.length > 0 ? a("core.shortcuts.open_filters") : "" }, () => {
1944
+ if (k.value.length === 0 || !M(K.value)) return !1;
1945
+ B.value?.present();
1489
1946
  });
1490
- const re = _(() => l.collection.savedViews);
1491
- zt(() => void re.value?.load());
1492
- const te = _(
1493
- () => (re.value?.items.value ?? []).map((C) => ({
1494
- id: `saved-${C.id}`,
1495
- label: C.name,
1947
+ const ee = h(() => t.collection.savedViews);
1948
+ xt(() => void ee.value?.load());
1949
+ const O = h(
1950
+ () => (ee.value?.items.value ?? []).map((A) => ({
1951
+ id: `saved-${A.id}`,
1952
+ label: A.name,
1496
1953
  icon: "starFill",
1497
1954
  onSelect: () => {
1498
- s("touched", []), re.value?.apply(C);
1955
+ i("touched", []), ee.value?.apply(A);
1499
1956
  }
1500
1957
  }))
1501
1958
  );
1502
- return (C, T) => (i(), d("div", {
1503
- class: le([l.flat ? "pb-3" : "border-b border-border-separator px-3 py-2.5", "select-none"]),
1959
+ return (A, I) => (c(), d("div", {
1960
+ class: W([t.flat ? "pb-3" : "border-b border-border-separator px-3 py-2.5", "select-none"]),
1504
1961
  "data-test": "collection-toolbar"
1505
1962
  }, [
1506
- p("div", Lo, [
1507
- p("div", To, [
1508
- O(n(J), {
1963
+ v("div", fn, [
1964
+ v("div", pn, [
1965
+ P(s(H), {
1509
1966
  name: "search",
1510
1967
  size: 16
1511
1968
  }),
1512
- Ge(p("input", {
1969
+ De(v("input", {
1513
1970
  ref_key: "field",
1514
- ref: f,
1515
- "onUpdate:modelValue": T[0] || (T[0] = (N) => c.value = N),
1971
+ ref: p,
1972
+ "onUpdate:modelValue": I[0] || (I[0] = (T) => u.value = T),
1516
1973
  type: "text",
1517
1974
  name: "collection-search",
1518
1975
  autocomplete: "off",
1519
- placeholder: n(r)("core.collection.search.placeholder"),
1520
- "aria-label": n(r)("core.collection.search.label"),
1976
+ placeholder: s(a)("core.collection.search.placeholder"),
1977
+ "aria-label": s(a)("core.collection.search.label"),
1521
1978
  class: "peer block min-w-0 flex-1 bg-transparent px-2 py-1.5 text-body text-content-strong outline-0 placeholder:text-content-disabled",
1522
- onInput: v
1523
- }, null, 40, Ro), [
1524
- [Je, c.value]
1979
+ onInput: m
1980
+ }, null, 40, vn), [
1981
+ [Be, u.value]
1525
1982
  ]),
1526
- T[4] || (T[4] = p("kbd", {
1983
+ I[4] || (I[4] = v("kbd", {
1527
1984
  "aria-hidden": "true",
1528
1985
  class: "rounded border border-border-separator px-1.5 font-mono text-2xs leading-5 text-content-disabled peer-focus:hidden peer-[:not(:placeholder-shown)]:hidden [@media(pointer:coarse)]:hidden"
1529
1986
  }, "/", -1)),
1530
- c.value !== "" ? (i(), d("button", {
1987
+ u.value !== "" ? (c(), d("button", {
1531
1988
  key: 0,
1532
1989
  type: "button",
1533
- "aria-label": n(r)("core.collection.clear"),
1990
+ "aria-label": s(a)("core.collection.clear"),
1534
1991
  class: "cursor-pointer rounded-full text-content-disabled hover:text-content-muted",
1535
- onClick: x
1992
+ onClick: $
1536
1993
  }, [
1537
- O(n(J), {
1994
+ P(s(H), {
1538
1995
  name: "close",
1539
1996
  size: 16
1540
1997
  })
1541
- ], 8, Mo)) : L("", !0)
1998
+ ], 8, mn)) : j("", !0)
1542
1999
  ]),
1543
- p("div", {
1544
- class: le(["flex min-w-0 flex-1 items-center gap-2", l.narrow ? "w-full flex-nowrap overflow-x-auto [scrollbar-width:none]" : "flex-wrap"])
2000
+ v("div", {
2001
+ class: W(["flex min-w-0 flex-1 items-center gap-2", t.narrow ? "w-full flex-nowrap overflow-x-auto [scrollbar-width:none]" : "flex-wrap"])
1545
2002
  }, [
1546
- P.value.length > 0 ? (i(), d("button", {
2003
+ k.value.length > 0 ? (c(), d("button", {
1547
2004
  key: 0,
1548
2005
  ref_key: "panelButton",
1549
- ref: Y,
2006
+ ref: K,
1550
2007
  type: "button",
1551
2008
  "data-test": "collection-filter-panel-button",
1552
- title: `${n(r)("core.collection.filters.panel_button")} (F)`,
1553
- class: le(["hit-target inline-flex h-8 shrink-0 cursor-pointer items-center gap-x-1.5 rounded-button px-3 text-subheadline font-semibold transition-colors duration-motion-fast compact:h-9", U.value > 0 ? "bg-tint-soft text-content-link" : "bg-surface-cell text-content-strong shadow-group ring-1 ring-inset ring-border-separator hover:bg-fill"]),
1554
- onClick: T[1] || (T[1] = (N) => H.value?.present())
2009
+ title: `${s(a)("core.collection.filters.panel_button")} (F)`,
2010
+ class: W(["hit-target inline-flex h-8 shrink-0 cursor-pointer items-center gap-x-1.5 rounded-button px-3 text-subheadline font-semibold transition-colors duration-motion-fast compact:h-9", D.value > 0 ? "bg-tint-soft text-content-link" : "bg-surface-cell text-content-strong shadow-group ring-1 ring-inset ring-border-separator hover:bg-fill"]),
2011
+ onClick: I[1] || (I[1] = (T) => B.value?.present())
1555
2012
  }, [
1556
- O(n(J), {
2013
+ P(s(H), {
1557
2014
  name: "filter3",
1558
2015
  size: 16
1559
2016
  }),
1560
- ne(" " + y(n(r)("core.collection.filters.panel_button")) + " ", 1),
1561
- U.value > 0 ? (i(), d("span", No, y(U.value), 1)) : L("", !0)
1562
- ], 10, Vo)) : L("", !0),
1563
- te.value.length > 0 ? (i(), W(n(We), {
2017
+ le(" " + y(s(a)("core.collection.filters.panel_button")) + " ", 1),
2018
+ D.value > 0 ? (c(), d("span", gn, y(D.value), 1)) : j("", !0)
2019
+ ], 10, bn)) : j("", !0),
2020
+ O.value.length > 0 ? (c(), Y(s(Ke), {
1564
2021
  key: 1,
1565
- items: te.value,
1566
- label: n(r)("core.collection.saved.menu"),
2022
+ items: O.value,
2023
+ label: s(a)("core.collection.saved.menu"),
1567
2024
  placement: "bottom-start"
1568
2025
  }, {
1569
- trigger: B(({ toggle: N, attrs: E }) => [
1570
- p("button", Se(E, {
2026
+ trigger: q(({ toggle: T, attrs: b }) => [
2027
+ v("button", _e(b, {
1571
2028
  type: "button",
1572
2029
  "data-test": "saved-filters-menu",
1573
2030
  class: "inline-flex shrink-0 cursor-pointer items-center gap-1.5 rounded-button bg-surface-cell px-3 py-1.5 text-subheadline font-semibold text-content-strong shadow-group ring-1 ring-inset ring-border-separator transition-colors hover:bg-fill",
1574
- onClick: N
2031
+ onClick: T
1575
2032
  }), [
1576
- O(n(J), {
2033
+ P(s(H), {
1577
2034
  name: "starFill",
1578
2035
  size: 14,
1579
2036
  class: "text-status-warning-content"
1580
2037
  }),
1581
- ne(" " + y(n(r)("core.collection.saved.menu")), 1)
1582
- ], 16, Io)
2038
+ le(" " + y(s(a)("core.collection.saved.menu")), 1)
2039
+ ], 16, hn)
1583
2040
  ]),
1584
2041
  _: 1
1585
- }, 8, ["items", "label"])) : L("", !0),
1586
- (i(!0), d(I, null, Z(D.value, (N) => (i(), W(Yl, {
1587
- key: N.key,
1588
- filter: N,
1589
- value: j.value[N.key],
1590
- onUpdate: (E) => k(N.key, E)
2042
+ }, 8, ["items", "label"])) : j("", !0),
2043
+ (c(!0), d(V, null, X(N.value, (T) => (c(), Y(El, {
2044
+ key: T.key,
2045
+ filter: T,
2046
+ value: L.value[T.key],
2047
+ onUpdate: (b) => x(T.key, b)
1591
2048
  }, null, 8, ["filter", "value", "onUpdate"]))), 128))
1592
2049
  ], 2),
1593
- pe(C.$slots, "default")
2050
+ oe(A.$slots, "default")
1594
2051
  ]),
1595
- A.value.length > 0 ? (i(), d("div", Fo, [
1596
- (i(!0), d(I, null, Z(A.value, (N) => (i(), d("span", {
1597
- key: N.key,
2052
+ z.value.length > 0 ? (c(), d("div", yn, [
2053
+ (c(!0), d(V, null, X(z.value, (T) => (c(), d("span", {
2054
+ key: T.key,
1598
2055
  class: "inline-flex min-h-7 max-w-full items-center gap-1.5 rounded-control bg-tint-soft py-0.5 pr-0.5 pl-2.5 text-subheadline text-content-link"
1599
2056
  }, [
1600
- N.label ? (i(), d("span", qo, y(N.label), 1)) : L("", !0),
1601
- p("span", Do, [
1602
- (i(!0), d(I, null, Z(N.values, (E, z) => (i(), d(I, { key: z }, [
1603
- z > 0 ? (i(), W(n(J), {
2057
+ T.label ? (c(), d("span", wn, y(T.label), 1)) : j("", !0),
2058
+ v("span", _n, [
2059
+ (c(!0), d(V, null, X(T.values, (b, C) => (c(), d(V, { key: C }, [
2060
+ C > 0 ? (c(), Y(s(H), {
1604
2061
  key: 0,
1605
2062
  name: "arrowRightSLine",
1606
2063
  size: 12,
1607
2064
  class: "opacity-60"
1608
- })) : L("", !0),
1609
- p("span", Uo, y(E), 1)
2065
+ })) : j("", !0),
2066
+ v("span", kn, y(b), 1)
1610
2067
  ], 64))), 128))
1611
2068
  ]),
1612
- p("button", {
2069
+ v("button", {
1613
2070
  type: "button",
1614
2071
  class: "hit-target flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-full hover:bg-tint/15",
1615
- "aria-label": n(r)("core.collection.clear"),
1616
- onClick: (E) => R(N.clears)
2072
+ "aria-label": s(a)("core.collection.clear"),
2073
+ onClick: (b) => R(T.clears)
1617
2074
  }, [
1618
- O(n(J), {
2075
+ P(s(H), {
1619
2076
  name: "close",
1620
2077
  size: 12
1621
2078
  })
1622
- ], 8, Bo)
2079
+ ], 8, xn)
1623
2080
  ]))), 128)),
1624
- A.value.length > 1 ? (i(), d("button", {
2081
+ z.value.length > 1 ? (c(), d("button", {
1625
2082
  key: 0,
1626
2083
  type: "button",
1627
2084
  class: "cursor-pointer px-2 text-subheadline text-content-muted hover:text-content-strong hover:underline",
1628
- onClick: T[2] || (T[2] = (N) => R(P.value.map((E) => E.key)))
1629
- }, y(n(r)("core.collection.filters.reset_all")), 1)) : L("", !0)
1630
- ])) : L("", !0),
1631
- P.value.length > 0 ? (i(), W(Oo, {
2085
+ onClick: I[2] || (I[2] = (T) => R(k.value.map((b) => b.key)))
2086
+ }, y(s(a)("core.collection.filters.reset_all")), 1)) : j("", !0)
2087
+ ])) : j("", !0),
2088
+ k.value.length > 0 ? (c(), Y(dn, {
1632
2089
  key: 1,
1633
2090
  ref_key: "panel",
1634
- ref: H,
1635
- collection: l.collection,
1636
- filters: P.value,
1637
- onTouched: T[3] || (T[3] = (N) => s("touched", N))
1638
- }, null, 8, ["collection", "filters"])) : L("", !0)
2091
+ ref: B,
2092
+ collection: t.collection,
2093
+ filters: k.value,
2094
+ onTouched: I[3] || (I[3] = (T) => i("touched", T))
2095
+ }, null, 8, ["collection", "filters"])) : j("", !0)
1639
2096
  ], 2));
1640
2097
  }
1641
- }), Go = 'a, button, input, select, textarea, label, [role="button"], [data-row-click-ignore]', Jo = 500, Wo = 8;
1642
- function Yo(t) {
1643
- const e = Ot(), l = ue([]), s = ue("");
1644
- let r = !1, a = null, c = { x: 0, y: 0 };
1645
- const f = (k) => t.actions()?.(k) ?? [];
1646
- function b(k) {
1647
- return f(k).filter((R) => R.href).map((R) => ({ key: R.key, label: R.label, icon: R.icon, href: R.href, tone: R.tone ?? "neutral", external: R.external }));
1648
- }
1649
- function v(k, R, H) {
1650
- const Y = f(k);
1651
- return Y.length === 0 ? !1 : (s.value = t.label()?.(k) ?? t.moreLabel(), l.value = Y.map((F) => ({
1652
- id: F.key,
1653
- label: F.label,
1654
- icon: F.icon,
1655
- section: F.section,
1656
- tone: F.tone === "critical" ? "critical" : void 0,
1657
- onSelect: () => {
1658
- F.onSelect ? F.onSelect() : F.href && (F.external ? window.open(F.href, "_blank", "noopener") : window.location.assign(F.href));
1659
- }
1660
- })), pt(() => t.presentMenu(R, H)), !0);
1661
- }
1662
- function x(k, R) {
1663
- const H = k.currentTarget.getBoundingClientRect();
1664
- v(R, H.left, H.bottom);
1665
- }
1666
- function S(k, R) {
1667
- !t.actions() || k.target.closest("a") || v(R, k.clientX, k.clientY) && (k.preventDefault(), r = !0);
1668
- }
1669
- function D() {
1670
- a && clearTimeout(a), a = null;
1671
- }
1672
- function P(k, R) {
1673
- r = !1, !(k.pointerType !== "touch" || !t.actions()) && (c = { x: k.clientX, y: k.clientY }, D(), a = setTimeout(() => {
1674
- a = null, v(R, c.x, c.y) && (r = !0, navigator.vibrate?.(10));
1675
- }, Jo));
1676
- }
1677
- function j(k) {
1678
- a && Math.hypot(k.clientX - c.x, k.clientY - c.y) > Wo && D();
1679
- }
1680
- function A(k) {
1681
- r && (r = !1, k.preventDefault(), k.stopPropagation());
1682
- }
1683
- function U(k, R) {
1684
- const H = t.target(R);
1685
- if (!(!H || k.target.closest(Go)) && !window.getSelection()?.toString()) {
1686
- if (k.metaKey || k.ctrlKey) {
1687
- window.open(e.resolve(H).href, "_blank");
1688
- return;
1689
- }
1690
- e.push(H);
1691
- }
1692
- }
1693
- return Ke() && Xe(D), { menuItems: l, menuLabel: s, swipeActions: b, openMenuFrom: x, onContextMenu: S, onPointerDown: P, onPointerMove: j, cancelPress: D, onClickCapture: A, onClick: U, actionsOf: f };
2098
+ });
2099
+ function wt(l) {
2100
+ const e = pt("(max-width: 1023px)"), t = h(() => l().some((i) => i.mobile && i.mobile !== "hidden"));
2101
+ return { narrow: h(() => e.value), phone: h(() => e.value && t.value) };
1694
2102
  }
1695
- const Qo = ["aria-busy"], Zo = {
2103
+ const zn = ["aria-busy"], An = {
1696
2104
  key: 0,
1697
2105
  class: "mb-3 select-none"
1698
- }, en = {
2106
+ }, Pn = {
1699
2107
  key: 0,
1700
2108
  role: "status",
1701
2109
  "data-test": "collection-refreshing",
1702
2110
  class: "m-2 flex w-fit max-w-full items-center gap-2 rounded-group bg-fill py-1 pr-3 pl-3 text-footnote text-content-muted"
1703
- }, tn = {
2111
+ }, En = {
1704
2112
  key: 1,
1705
2113
  class: "m-2",
1706
2114
  "data-test": "collection-stale"
1707
- }, ln = { class: "flex flex-wrap items-center justify-between gap-3" }, on = {
1708
- key: 2,
1709
- class: "overflow-hidden rounded-group bg-surface-cell shadow-group",
1710
- "data-test": "collection-mobile-rows"
1711
- }, nn = { class: "flex flex-1 flex-col gap-2 pt-1" }, sn = ["onClick", "onContextmenu", "onPointerdown"], an = { class: "flex items-start gap-3" }, rn = {
1712
- key: 0,
1713
- class: "shrink-0 pt-0.5"
1714
- }, cn = { class: "flex min-w-0 flex-1 flex-col gap-1" }, un = { class: "flex min-w-0 items-start gap-3" }, dn = { class: "min-w-0 flex-1" }, fn = {
1715
- key: 1,
1716
- class: "block truncate text-row-title"
1717
- }, pn = {
1718
- key: 0,
1719
- class: "flex shrink-0 items-center gap-2 pt-0.5"
1720
- }, vn = ["aria-label", "onClick"], mn = {
1721
- key: 0,
1722
- class: "flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-row-meta"
1723
- }, gn = {
1724
- key: 1,
1725
- class: "truncate"
1726
- }, bn = {
1727
- key: 2,
1728
- class: "px-4 py-6",
1729
- "data-test": "collection-failed"
1730
- }, hn = { class: "flex flex-wrap items-center justify-between gap-3" }, yn = { class: "font-semibold" }, _n = {
1731
- key: 3,
1732
- class: "px-4 py-2 text-center",
1733
- "data-test": "collection-empty"
1734
- }, wn = {
1735
- key: 3,
1736
- class: "inline-block w-full align-middle"
1737
- }, kn = { class: "border-b border-border-separator" }, xn = ["aria-sort"], $n = ["onClick"], Sn = { key: 1 }, Cn = {
1738
- key: 0,
1739
- class: "px-4 pt-2.5 pb-2",
1740
- style: { width: "20px" }
1741
- }, zn = { class: "sr-only" }, Pn = {
1742
- key: 0,
1743
- class: "size-8 shrink-0 rounded-full bg-fill"
1744
- }, An = { class: "flex flex-1 flex-col gap-1.5" }, En = { key: 0 }, jn = ["onClick", "onContextmenu", "onPointerdown"], On = { key: 0 }, Ln = { class: "flex items-center justify-center gap-1" }, Tn = ["aria-label", "onClick"], Rn = {
1745
- key: 2,
1746
- "data-test": "collection-failed"
1747
- }, Mn = ["colspan"], Vn = { class: "flex flex-wrap items-center justify-between gap-3" }, Nn = { class: "font-semibold" }, In = {
1748
- key: 3,
1749
- "data-test": "collection-empty"
1750
- }, Fn = ["colspan"], ut = "__search", qn = 37, Dn = /* @__PURE__ */ we({
2115
+ }, On = { class: "flex flex-wrap items-center justify-between gap-3" }, jn = { class: "flex flex-wrap items-center justify-between gap-3" }, Ln = { class: "font-semibold" }, nt = "__search", Rn = /* @__PURE__ */ ue({
1751
2116
  __name: "CollectionTable",
1752
2117
  props: {
1753
2118
  collection: {},
@@ -1758,93 +2123,90 @@ const Qo = ["aria-busy"], Zo = {
1758
2123
  viewsPresentation: { default: "segmented" },
1759
2124
  actionsVisible: { type: Boolean, default: !1 }
1760
2125
  },
1761
- setup(t) {
1762
- const e = t, l = Ue(), { t: s } = Ce(), r = Ve(), a = Ue(), c = bt("(max-width: 1023px)"), f = _(() => e.collection.columns.value), b = _(() => f.value.some((g) => g.mobile && g.mobile !== "hidden")), v = _(() => c.value && b.value), x = (g) => f.value.filter((M) => M.mobile === g), S = _(() => x("primary")), D = _(() => x("accessory")), P = _(() => x("meta")), j = (g) => `cell-${String(g.key).replace(/\./g, "_")}`, A = (g) => !!a[j(g)], U = (g, M) => xt(g, M.key), k = (g) => g == null || g === "", R = { md: "hidden md:table-cell", xl: "hidden xl:table-cell", "2xl": "hidden 2xl:table-cell" }, H = (g) => g.hideBelow ? [R[g.hideBelow]] : [], Y = (g) => ["text-nowrap px-4 pt-2.5 pb-2 text-footnote font-normal text-content-muted", ...H(g)], F = { start: "text-left", center: "text-center", end: "text-right" }, re = (g) => [...H(g), F[g.align ?? "start"]], te = { start: "justify-start", center: "justify-center", end: "justify-end" }, C = _(() => e.collection.rows.value), T = (g) => e.collection.recordLocation(g), N = _(() => C.value.length > 0 && T(C.value[0]) !== null), E = _e("rowMenu"), z = Yo({
1763
- actions: () => e.rowActions,
1764
- label: () => e.rowLabel,
1765
- target: T,
1766
- presentMenu: (g, M) => E.value?.presentAt(g, M),
1767
- moreLabel: () => s("core.page.more_actions")
1768
- }), q = _(() => !!e.rowActions && (e.actionsVisible || !l.actions && !N.value)), de = _(() => !!l.actions || N.value || q.value), me = (g) => e.rowLabel ? `${s("core.page.more_actions")}: ${e.rowLabel(g)}` : s("core.page.more_actions"), ve = (g) => z.actionsOf(g).length > 0, ae = _(() => e.collection.query.value.search), ge = _(() => e.collection.views.value.map((g) => ({ value: g.key, label: g.label, icon: g.icon, badge: g.count }))), oe = ue([]), ie = (g) => oe.value = [...oe.value.filter((M) => !g.includes(M)), ...g], ce = _(() => {
1769
- const g = _t(e.collection.filters.value, e.collection.query.value.filters, {
1770
- formatNumber: (m) => r.number(m),
1771
- from: s("core.collection.filters.range_from"),
1772
- until: s("core.collection.filters.range_until")
1773
- }), M = e.collection.query.value.search;
1774
- return M && g.push({ key: ut, label: s("core.collection.empty.search"), values: [M], clears: [] }), g;
1775
- }), h = _(() => {
1776
- for (const g of [...oe.value].reverse()) {
1777
- const M = ce.value.find((m) => m.key === g || m.clears.includes(g));
1778
- if (M) return M;
2126
+ setup(l) {
2127
+ const e = l, t = ke(), { t: i } = he(), a = Le(), n = h(() => Object.keys(ke()).filter((b) => b !== "toolbar" && b !== "empty")), u = h(() => e.collection.columns.value), { narrow: p, phone: g } = wt(() => u.value), m = h(() => e.collection.rows.value), $ = (b) => e.collection.recordLocation(b), S = h(() => e.collection.query.value.search), N = h(() => e.collection.views.value.map((b) => ({ value: b.key, label: b.label, icon: b.icon, badge: b.count }))), k = ae([]), L = (b) => k.value = [...k.value.filter((C) => !b.includes(C)), ...b], z = h(() => {
2128
+ const b = mt(e.collection.filters.value, e.collection.query.value.filters, {
2129
+ formatNumber: (E) => a.number(E),
2130
+ from: i("core.collection.filters.range_from"),
2131
+ until: i("core.collection.filters.range_until")
2132
+ }), C = e.collection.query.value.search;
2133
+ return C && b.push({ key: nt, label: i("core.collection.empty.search"), values: [C], clears: [] }), b;
2134
+ }), D = h(() => {
2135
+ for (const b of [...k.value].reverse()) {
2136
+ const C = z.value.find((E) => E.key === b || E.clears.includes(b));
2137
+ if (C) return C;
1779
2138
  }
1780
- return ce.value[ce.value.length - 1] ?? null;
2139
+ return z.value[z.value.length - 1] ?? null;
1781
2140
  });
1782
- function w(g) {
1783
- oe.value = oe.value.filter((M) => M !== g.key && !g.clears.includes(M)), g.key === ut ? e.collection.search("") : e.collection.setFilters(Object.fromEntries(g.clears.map((M) => [M, null])));
2141
+ function x(b) {
2142
+ k.value = k.value.filter((C) => C !== b.key && !b.clears.includes(C)), b.key === nt ? e.collection.search("") : e.collection.setFilters(Object.fromEntries(b.clears.map((C) => [C, null])));
1784
2143
  }
1785
- function o() {
1786
- oe.value = [], e.collection.clearFilters();
2144
+ function R() {
2145
+ k.value = [], e.collection.clearFilters();
1787
2146
  }
1788
- const u = (g) => g.sort !== void 0 && e.collection.query.value.sort === g.sort, V = (g) => g.sort === void 0 ? void 0 : u(g) ? e.collection.query.value.direction === "asc" ? "ascending" : "descending" : "none", X = (g) => u(g) ? e.collection.query.value.direction === "asc" ? "arrowUpSLine" : "arrowDownSLine" : "expandUpDownLine", ee = _e("card"), G = () => ee.value?.scrollIntoView?.({ block: "start", behavior: "smooth" }), fe = (g) => ({ animationDelay: `${Math.min(g, 8) * 30}ms` }), K = _(() => e.collection.display.value === "loading"), Q = _(() => K.value ? `${e.collection.query.value.pageSize * (e.rowHeight ?? 40) + qn}px` : void 0), se = _(() => e.collection.query.value.pageSize), Ee = _(() => e.collection.state.value.status === "refreshing"), $t = _(() => e.collection.state.value.status === "stale"), Ye = _(() => e.collection.state.value.status === "failed"), Ne = _(() => {
1789
- const g = e.collection.state.value;
1790
- return g.status === "failed" || g.status === "stale" ? g.error ?? "" : "";
2147
+ const B = h(() => {
2148
+ const { sort: b, direction: C } = e.collection.query.value;
2149
+ return b === null ? null : { key: b, direction: C };
2150
+ }), K = ge("card"), M = () => K.value?.scrollIntoView?.({ block: "start", behavior: "smooth" }), ee = h(() => e.collection.display.value === "loading"), O = h(() => e.collection.query.value.pageSize), A = h(() => e.collection.state.value.status === "refreshing"), I = h(() => e.collection.state.value.status === "stale"), T = h(() => {
2151
+ const b = e.collection.state.value;
2152
+ return b.status === "failed" || b.status === "stale" ? b.error ?? "" : "";
1791
2153
  });
1792
- return (g, M) => (i(), d("div", {
2154
+ return (b, C) => (c(), d("div", {
1793
2155
  class: "collection",
1794
- "aria-busy": K.value || Ee.value || void 0,
2156
+ "aria-busy": ee.value || A.value || void 0,
1795
2157
  "data-test": "collection"
1796
2158
  }, [
1797
- ge.value.length > 0 ? (i(), d("div", Zo, [
1798
- O(n(gt), {
2159
+ N.value.length > 0 ? (c(), d("div", An, [
2160
+ P(s(ut), {
1799
2161
  "model-value": e.collection.query.value.view,
1800
- tabs: ge.value,
2162
+ tabs: N.value,
1801
2163
  presentation: e.viewsPresentation,
1802
- label: n(s)("core.collection.views_label"),
1803
- "onUpdate:modelValue": M[0] || (M[0] = (m) => e.collection.setView(m === null ? null : String(m)))
2164
+ label: s(i)("core.collection.views_label"),
2165
+ "onUpdate:modelValue": C[0] || (C[0] = (E) => e.collection.setView(E === null ? null : String(E)))
1804
2166
  }, null, 8, ["model-value", "tabs", "presentation", "label"])
1805
- ])) : L("", !0),
1806
- p("div", {
2167
+ ])) : j("", !0),
2168
+ v("div", {
1807
2169
  ref_key: "card",
1808
- ref: ee,
1809
- class: le(["scroll-mt-16", v.value ? "" : "rounded-group bg-surface-cell shadow-group"])
2170
+ ref: K,
2171
+ class: W(["scroll-mt-16", s(g) ? "" : "rounded-group bg-surface-cell shadow-group"])
1810
2172
  }, [
1811
- O(Xo, {
2173
+ P(Cn, {
1812
2174
  collection: e.collection,
1813
- narrow: n(c),
1814
- flat: v.value,
1815
- onTouched: ie
2175
+ narrow: s(p),
2176
+ flat: s(g),
2177
+ onTouched: L
1816
2178
  }, {
1817
- default: B(() => [
1818
- pe(g.$slots, "toolbar")
2179
+ default: q(() => [
2180
+ oe(b.$slots, "toolbar")
1819
2181
  ]),
1820
2182
  _: 3
1821
2183
  }, 8, ["collection", "narrow", "flat"]),
1822
- Ee.value ? (i(), d("div", en, [
1823
- O(n(J), {
2184
+ A.value ? (c(), d("div", Pn, [
2185
+ P(s(H), {
1824
2186
  name: "loader4Line",
1825
2187
  size: 14,
1826
2188
  class: "animate-spin motion-reduce:animate-none"
1827
2189
  }),
1828
- ne(" " + y(n(s)("core.state.refreshing")), 1)
1829
- ])) : L("", !0),
1830
- $t.value ? (i(), d("div", tn, [
1831
- O(n(Fe), {
2190
+ le(" " + y(s(i)("core.state.refreshing")), 1)
2191
+ ])) : j("", !0),
2192
+ I.value ? (c(), d("div", En, [
2193
+ P(s(Ge), {
1832
2194
  tone: "warning",
1833
2195
  role: "alert"
1834
2196
  }, {
1835
- default: B(() => [
1836
- p("div", ln, [
1837
- p("div", null, [
1838
- p("p", null, y(Ne.value), 1),
1839
- p("p", null, y(n(s)("core.state.stale")), 1)
2197
+ default: q(() => [
2198
+ v("div", On, [
2199
+ v("div", null, [
2200
+ v("p", null, y(T.value), 1),
2201
+ v("p", null, y(s(i)("core.state.stale")), 1)
1840
2202
  ]),
1841
- O(he, {
2203
+ P(be, {
1842
2204
  prominence: "secondary",
1843
2205
  size: "sm",
1844
- onClick: M[1] || (M[1] = (m) => e.collection.refresh())
2206
+ onClick: C[1] || (C[1] = (E) => e.collection.refresh())
1845
2207
  }, {
1846
- default: B(() => [
1847
- ne(y(n(s)("core.actions.retry")), 1)
2208
+ default: q(() => [
2209
+ le(y(s(i)("core.actions.retry")), 1)
1848
2210
  ]),
1849
2211
  _: 1
1850
2212
  })
@@ -1852,157 +2214,43 @@ const Qo = ["aria-busy"], Zo = {
1852
2214
  ]),
1853
2215
  _: 1
1854
2216
  })
1855
- ])) : L("", !0),
1856
- v.value ? (i(), d("ul", on, [
1857
- K.value ? (i(!0), d(I, { key: 0 }, Z(se.value, (m) => (i(), d("li", {
1858
- key: `skeleton-${m}`,
1859
- "aria-hidden": "true",
1860
- class: "relative flex animate-pulse items-start gap-3 px-row-inset py-3 motion-reduce:animate-none not-first:before:absolute not-first:before:top-0 not-first:before:right-0 not-first:before:left-row-inset not-first:before:h-px not-first:before:bg-border-separator",
1861
- style: be({ animationDelay: `${m * 60}ms` })
1862
- }, [
1863
- M[9] || (M[9] = p("span", { class: "size-9 shrink-0 rounded-full bg-fill" }, null, -1)),
1864
- p("span", nn, [
1865
- p("span", {
1866
- class: "h-2.5 rounded-full bg-fill-strong",
1867
- style: be({ width: `${45 + m * 13 % 30}%` })
1868
- }, null, 4),
1869
- p("span", {
1870
- class: "h-2 rounded-full bg-fill",
1871
- style: be({ width: `${60 + m * 7 % 25}%` })
1872
- }, null, 4)
1873
- ])
1874
- ], 4))), 128)) : L("", !0),
1875
- e.collection.display.value === "rows" ? (i(!0), d(I, { key: 1 }, Z(C.value, (m, ke) => (i(), d("li", {
1876
- key: e.collection.rowKey(m),
1877
- style: be(fe(ke)),
1878
- "data-test": "collection-row",
1879
- class: le(["relative animate-row-in transition-colors duration-motion-fast active:bg-fill not-first:before:absolute not-first:before:top-0 not-first:before:right-0 not-first:before:left-row-inset not-first:before:z-10 not-first:before:h-px not-first:before:bg-border-separator", T(m) ? "cursor-pointer" : void 0]),
1880
- onClickCapture: M[2] || (M[2] = //@ts-ignore
1881
- (...$) => n(z).onClickCapture && n(z).onClickCapture(...$)),
1882
- onClick: ($) => n(z).onClick($, m),
1883
- onContextmenu: ($) => n(z).onContextMenu($, m),
1884
- onPointerdown: ($) => n(z).onPointerDown($, m),
1885
- onPointermove: M[3] || (M[3] = //@ts-ignore
1886
- (...$) => n(z).onPointerMove && n(z).onPointerMove(...$)),
1887
- onPointerup: M[4] || (M[4] = //@ts-ignore
1888
- (...$) => n(z).cancelPress && n(z).cancelPress(...$)),
1889
- onPointercancel: M[5] || (M[5] = //@ts-ignore
1890
- (...$) => n(z).cancelPress && n(z).cancelPress(...$))
1891
- }, [
1892
- O(n(Mt), {
1893
- actions: n(z).swipeActions(m),
1894
- "content-class": "px-row-inset py-2.5"
1895
- }, {
1896
- default: B(() => [
1897
- p("div", an, [
1898
- l.leading ? (i(), d("div", rn, [
1899
- pe(g.$slots, "leading", {
1900
- item: m,
1901
- compact: !0
1902
- })
1903
- ])) : L("", !0),
1904
- p("div", cn, [
1905
- p("div", un, [
1906
- p("div", dn, [
1907
- (i(!0), d(I, null, Z(S.value, ($) => (i(), d(I, {
1908
- key: String($.key)
1909
- }, [
1910
- A($) ? pe(g.$slots, j($), {
1911
- item: m,
1912
- value: U(m, $),
1913
- compact: !0,
1914
- to: T(m),
1915
- search: ae.value
1916
- }, void 0, void 0, 0) : (i(), d("span", fn, [
1917
- O(Te, {
1918
- column: $,
1919
- item: m,
1920
- compact: !0,
1921
- to: T(m),
1922
- search: ae.value
1923
- }, null, 8, ["column", "item", "to", "search"])
1924
- ]))
1925
- ], 64))), 128))
1926
- ]),
1927
- D.value.length || q.value && ve(m) ? (i(), d("div", pn, [
1928
- (i(!0), d(I, null, Z(D.value, ($) => (i(), d(I, {
1929
- key: String($.key)
1930
- }, [
1931
- A($) ? pe(g.$slots, j($), {
1932
- item: m,
1933
- value: U(m, $),
1934
- compact: !0,
1935
- to: T(m),
1936
- search: ae.value
1937
- }, void 0, void 0, 0) : (i(), W(Te, {
1938
- key: 1,
1939
- column: $,
1940
- item: m,
1941
- compact: !0,
1942
- to: T(m),
1943
- search: ae.value
1944
- }, null, 8, ["column", "item", "to", "search"]))
1945
- ], 64))), 128)),
1946
- q.value && ve(m) ? (i(), d("button", {
1947
- key: 0,
1948
- type: "button",
1949
- "data-test": "collection-row-more",
1950
- "aria-label": me(m),
1951
- class: "hit-target -my-1 -mr-1 flex size-8 cursor-pointer items-center justify-center rounded-full text-content-muted active:bg-fill",
1952
- onClick: Re(($) => n(z).openMenuFrom($, m), ["stop"])
1953
- }, [
1954
- O(n(J), {
1955
- name: "moreLine",
1956
- size: 20
1957
- })
1958
- ], 8, vn)) : L("", !0)
1959
- ])) : L("", !0)
1960
- ]),
1961
- P.value.length ? (i(), d("div", mn, [
1962
- (i(!0), d(I, null, Z(P.value, ($) => (i(), d(I, {
1963
- key: String($.key)
1964
- }, [
1965
- A($) ? pe(g.$slots, j($), {
1966
- item: m,
1967
- value: U(m, $),
1968
- compact: !0,
1969
- to: T(m),
1970
- search: ae.value
1971
- }, void 0, void 0, 0) : k(U(m, $)) ? L("", !0) : (i(), d("span", gn, [
1972
- O(Te, {
1973
- column: $,
1974
- item: m,
1975
- compact: !0,
1976
- to: T(m),
1977
- search: ae.value
1978
- }, null, 8, ["column", "item", "to", "search"])
1979
- ]))
1980
- ], 64))), 128))
1981
- ])) : L("", !0)
1982
- ])
1983
- ])
1984
- ]),
1985
- _: 2
1986
- }, 1032, ["actions"])
1987
- ], 46, sn))), 128)) : L("", !0),
1988
- Ye.value ? (i(), d("li", bn, [
1989
- O(n(Fe), {
2217
+ ])) : j("", !0),
2218
+ P(yt, {
2219
+ columns: u.value,
2220
+ rows: m.value,
2221
+ "row-key": e.collection.rowKey,
2222
+ display: e.collection.display.value,
2223
+ phone: s(g),
2224
+ link: $,
2225
+ search: S.value,
2226
+ sorted: B.value,
2227
+ "row-actions": e.rowActions,
2228
+ "row-label": e.rowLabel,
2229
+ "row-height": e.rowHeight,
2230
+ density: e.density,
2231
+ "actions-visible": e.actionsVisible,
2232
+ "skeleton-rows": O.value,
2233
+ "reserve-rows": ee.value ? O.value : void 0,
2234
+ onSort: C[3] || (C[3] = (E) => e.collection.toggleSort(E))
2235
+ }, je({
2236
+ failed: q(() => [
2237
+ P(s(Ge), {
1990
2238
  tone: "warning",
1991
2239
  role: "alert"
1992
2240
  }, {
1993
- default: B(() => [
1994
- p("div", hn, [
1995
- p("div", null, [
1996
- p("p", yn, y(n(s)("core.collection.failed.title")), 1),
1997
- p("p", null, y(Ne.value), 1)
2241
+ default: q(() => [
2242
+ v("div", jn, [
2243
+ v("div", null, [
2244
+ v("p", Ln, y(s(i)("core.collection.failed.title")), 1),
2245
+ v("p", null, y(T.value), 1)
1998
2246
  ]),
1999
- O(he, {
2247
+ P(be, {
2000
2248
  prominence: "secondary",
2001
2249
  size: "sm",
2002
- onClick: M[6] || (M[6] = (m) => e.collection.refresh())
2250
+ onClick: C[2] || (C[2] = (E) => e.collection.refresh())
2003
2251
  }, {
2004
- default: B(() => [
2005
- ne(y(n(s)("core.actions.retry")), 1)
2252
+ default: q(() => [
2253
+ le(y(s(i)("core.actions.retry")), 1)
2006
2254
  ]),
2007
2255
  _: 1
2008
2256
  })
@@ -2010,244 +2258,39 @@ const Qo = ["aria-busy"], Zo = {
2010
2258
  ]),
2011
2259
  _: 1
2012
2260
  })
2013
- ])) : L("", !0),
2014
- e.collection.display.value === "empty" || e.collection.display.value === "no-matches" ? (i(), d("li", _n, [
2015
- e.collection.display.value === "empty" && l.empty ? pe(g.$slots, "empty", {}, void 0, void 0, 0) : ce.value.length > 0 ? (i(), W(at, {
2261
+ ]),
2262
+ empty: q(() => [
2263
+ e.collection.display.value === "empty" && t.empty ? oe(b.$slots, "empty", {}, void 0, void 0, 0) : z.value.length > 0 ? (c(), Y(ro, {
2016
2264
  key: 1,
2017
- chips: ce.value,
2018
- "last-chip": h.value,
2019
- onRemove: w,
2020
- onClearAll: o
2021
- }, null, 8, ["chips", "last-chip"])) : (i(), W(n(Ze), {
2265
+ chips: z.value,
2266
+ "last-chip": D.value,
2267
+ onRemove: x,
2268
+ onClearAll: R
2269
+ }, null, 8, ["chips", "last-chip"])) : (c(), Y(s(Fe), {
2022
2270
  key: 2,
2023
- title: n(s)("core.collection.no_data"),
2024
- description: n(s)("core.collection.no_results")
2271
+ title: s(i)("core.collection.no_data"),
2272
+ description: s(i)("core.collection.no_results")
2025
2273
  }, null, 8, ["title", "description"]))
2026
- ])) : L("", !0)
2027
- ])) : (i(), d("div", wn, [
2028
- p("div", {
2029
- class: "overflow-x-auto",
2030
- style: be({ minHeight: Q.value })
2031
- }, [
2032
- p("table", {
2033
- class: le(["collection-grid w-full", { condensed: e.density === "condensed" }])
2034
- }, [
2035
- p("thead", kn, [
2036
- p("tr", null, [
2037
- (i(!0), d(I, null, Z(f.value, (m) => (i(), d("th", {
2038
- key: String(m.key),
2039
- scope: "col",
2040
- class: le(Y(m)),
2041
- style: be({ width: m.width ? `${m.width}px` : void 0, textAlign: m.align ?? "start" }),
2042
- "aria-sort": V(m)
2043
- }, [
2044
- p("div", {
2045
- class: le(["flex", te[m.align ?? "start"]])
2046
- }, [
2047
- m.sort !== void 0 ? (i(), d("button", {
2048
- key: 0,
2049
- type: "button",
2050
- class: le(["group inline-flex cursor-pointer items-center gap-1 rounded-sm transition-colors hover:text-content-strong focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus", [u(m) ? "font-semibold text-content-strong" : "", m.align === "end" ? "flex-row-reverse" : ""]]),
2051
- onClick: (ke) => e.collection.toggleSort(m.sort)
2052
- }, [
2053
- p("span", null, y(m.label), 1),
2054
- O(n(J), {
2055
- name: X(m),
2056
- size: 14,
2057
- class: le(u(m) ? "text-content-muted" : "text-content-disabled opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100")
2058
- }, null, 8, ["name", "class"])
2059
- ], 10, $n)) : (i(), d("span", Sn, y(m.label), 1))
2060
- ], 2)
2061
- ], 14, xn))), 128)),
2062
- de.value ? (i(), d("th", Cn, [
2063
- p("span", zn, y(n(s)("core.actions.more")), 1)
2064
- ])) : L("", !0)
2065
- ])
2066
- ]),
2067
- p("tbody", null, [
2068
- K.value ? (i(!0), d(I, { key: 0 }, Z(se.value, (m) => (i(), d("tr", {
2069
- key: `skeleton-${m}`,
2070
- "aria-hidden": "true",
2071
- style: be(e.rowHeight ? { height: `${e.rowHeight}px` } : void 0)
2072
- }, [
2073
- (i(!0), d(I, null, Z(f.value, (ke, $) => (i(), d("td", {
2074
- key: String(ke.key),
2075
- class: le(H(ke))
2076
- }, [
2077
- p("div", {
2078
- class: "flex animate-pulse items-center gap-3 motion-reduce:animate-none",
2079
- style: be({ animationDelay: `${m * 60}ms` })
2080
- }, [
2081
- $ === 0 ? (i(), d("span", Pn)) : L("", !0),
2082
- p("span", An, [
2083
- p("span", {
2084
- class: "h-2.5 rounded-full bg-fill-strong",
2085
- style: be({ width: `${55 + (m * 7 + $ * 13) % 35}%` })
2086
- }, null, 4),
2087
- p("span", {
2088
- class: "h-2 rounded-full bg-fill",
2089
- style: be({ width: `${30 + (m * 11 + $ * 5) % 30}%` })
2090
- }, null, 4)
2091
- ])
2092
- ], 4)
2093
- ], 2))), 128)),
2094
- de.value ? (i(), d("td", En, [...M[10] || (M[10] = [
2095
- p("div", { class: "mx-auto h-6 w-6 animate-pulse rounded-full bg-fill motion-reduce:animate-none" }, null, -1)
2096
- ])])) : L("", !0)
2097
- ], 4))), 128)) : L("", !0),
2098
- e.collection.display.value === "rows" ? (i(!0), d(I, { key: 1 }, Z(C.value, (m, ke) => (i(), d("tr", {
2099
- key: e.collection.rowKey(m),
2100
- class: le(["animate-row-in", T(m) ? "cursor-pointer" : void 0]),
2101
- "data-test": "collection-row",
2102
- style: be([e.rowHeight ? { height: `${e.rowHeight}px` } : {}, fe(ke)]),
2103
- onClickCapture: M[7] || (M[7] = //@ts-ignore
2104
- (...$) => n(z).onClickCapture && n(z).onClickCapture(...$)),
2105
- onClick: ($) => n(z).onClick($, m),
2106
- onContextmenu: ($) => n(z).onContextMenu($, m),
2107
- onPointerdown: ($) => n(z).onPointerDown($, m)
2108
- }, [
2109
- (i(!0), d(I, null, Z(f.value, ($, St) => (i(), d("td", {
2110
- key: String($.key),
2111
- class: le(re($))
2112
- }, [
2113
- pe(g.$slots, j($), {
2114
- item: m,
2115
- value: U(m, $),
2116
- compact: !1,
2117
- to: T(m)
2118
- }, () => [
2119
- O(Te, {
2120
- column: $,
2121
- item: m,
2122
- compact: !1,
2123
- to: T(m),
2124
- search: ae.value
2125
- }, vt({ _: 2 }, [
2126
- l.leading && St === 0 ? {
2127
- name: "leading",
2128
- fn: B(() => [
2129
- pe(g.$slots, "leading", {
2130
- item: m,
2131
- compact: !1
2132
- })
2133
- ]),
2134
- key: "0"
2135
- } : void 0
2136
- ]), 1032, ["column", "item", "to", "search"])
2137
- ])
2138
- ], 2))), 128)),
2139
- de.value ? (i(), d("td", On, [
2140
- pe(g.$slots, "actions", { item: m }, () => [
2141
- p("div", Ln, [
2142
- T(m) ? (i(), W(n(Vt), {
2143
- key: 0,
2144
- text: n(s)("core.collection.open_record"),
2145
- side: "left"
2146
- }, {
2147
- default: B(() => [
2148
- O(n(mt), {
2149
- to: T(m),
2150
- "aria-label": `${n(s)("core.collection.open_record")}${e.rowLabel ? `: ${e.rowLabel(m)}` : ""}`,
2151
- class: "inline-flex rounded-md p-1.5 text-content-link transition-colors hover:bg-tint-soft focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus"
2152
- }, {
2153
- default: B(() => [
2154
- O(n(J), {
2155
- name: "eye",
2156
- size: 18
2157
- })
2158
- ]),
2159
- _: 1
2160
- }, 8, ["to", "aria-label"])
2161
- ]),
2162
- _: 2
2163
- }, 1032, ["text"])) : L("", !0),
2164
- q.value && ve(m) ? (i(), d("button", {
2165
- key: 1,
2166
- type: "button",
2167
- "data-test": "collection-row-more",
2168
- "aria-label": me(m),
2169
- class: "hit-target flex size-8 cursor-pointer items-center justify-center rounded-full bg-fill text-content-strong transition-colors duration-motion-fast hover:bg-fill-strong focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
2170
- onClick: Re(($) => n(z).openMenuFrom($, m), ["stop"])
2171
- }, [
2172
- O(n(J), {
2173
- name: "moreLine",
2174
- size: 18
2175
- })
2176
- ], 8, Tn)) : L("", !0)
2177
- ])
2178
- ])
2179
- ])) : L("", !0)
2180
- ], 46, jn))), 128)) : L("", !0),
2181
- Ye.value ? (i(), d("tr", Rn, [
2182
- p("td", {
2183
- colspan: f.value.length + (de.value ? 1 : 0),
2184
- class: "!whitespace-normal py-6"
2185
- }, [
2186
- O(n(Fe), {
2187
- tone: "warning",
2188
- role: "alert"
2189
- }, {
2190
- default: B(() => [
2191
- p("div", Vn, [
2192
- p("div", null, [
2193
- p("p", Nn, y(n(s)("core.collection.failed.title")), 1),
2194
- p("p", null, y(Ne.value), 1)
2195
- ]),
2196
- O(he, {
2197
- prominence: "secondary",
2198
- size: "sm",
2199
- onClick: M[8] || (M[8] = (m) => e.collection.refresh())
2200
- }, {
2201
- default: B(() => [
2202
- ne(y(n(s)("core.actions.retry")), 1)
2203
- ]),
2204
- _: 1
2205
- })
2206
- ])
2207
- ]),
2208
- _: 1
2209
- })
2210
- ], 8, Mn)
2211
- ])) : L("", !0),
2212
- e.collection.display.value === "empty" || e.collection.display.value === "no-matches" ? (i(), d("tr", In, [
2213
- p("td", {
2214
- colspan: f.value.length + (de.value ? 1 : 0),
2215
- class: "!whitespace-normal py-6 text-center"
2216
- }, [
2217
- e.collection.display.value === "empty" && l.empty ? pe(g.$slots, "empty", {}, void 0, void 0, 0) : ce.value.length > 0 ? (i(), W(at, {
2218
- key: 1,
2219
- chips: ce.value,
2220
- "last-chip": h.value,
2221
- onRemove: w,
2222
- onClearAll: o
2223
- }, null, 8, ["chips", "last-chip"])) : (i(), W(n(Ze), {
2224
- key: 2,
2225
- title: n(s)("core.collection.no_data"),
2226
- description: n(s)("core.collection.no_results")
2227
- }, null, 8, ["title", "description"]))
2228
- ], 8, Fn)
2229
- ])) : L("", !0)
2230
- ])
2231
- ], 2)
2232
- ], 4)
2233
- ])),
2234
- O(Dl, {
2274
+ ]),
2275
+ _: 2
2276
+ }, [
2277
+ X(n.value, (E) => ({
2278
+ name: E,
2279
+ fn: q((ie) => [
2280
+ oe(b.$slots, E, Ue(He(ie ?? {})))
2281
+ ])
2282
+ }))
2283
+ ]), 1032, ["columns", "rows", "row-key", "display", "phone", "search", "sorted", "row-actions", "row-label", "row-height", "density", "actions-visible", "skeleton-rows", "reserve-rows"]),
2284
+ P(Po, {
2235
2285
  collection: e.collection,
2236
- compact: n(c),
2237
- flat: v.value,
2238
- onTurned: G
2286
+ compact: s(p),
2287
+ flat: s(g),
2288
+ onTurned: M
2239
2289
  }, null, 8, ["collection", "compact", "flat"])
2240
- ], 2),
2241
- e.rowActions ? (i(), W(n(We), {
2242
- key: 1,
2243
- ref_key: "rowMenu",
2244
- ref: E,
2245
- items: n(z).menuItems.value,
2246
- label: n(z).menuLabel.value
2247
- }, null, 8, ["items", "label"])) : L("", !0)
2248
- ], 8, Qo));
2290
+ ], 2)
2291
+ ], 8, zn));
2249
2292
  }
2250
- }), ms = /* @__PURE__ */ we({
2293
+ }), ds = /* @__PURE__ */ ue({
2251
2294
  __name: "CollectionPage",
2252
2295
  props: {
2253
2296
  collection: {},
@@ -2262,17 +2305,17 @@ const Qo = ["aria-busy"], Zo = {
2262
2305
  viewsPresentation: { default: "segmented" },
2263
2306
  actionsVisible: { type: Boolean, default: !1 }
2264
2307
  },
2265
- setup(t) {
2266
- const e = t, l = _(() => Object.keys(Ue()).filter((r) => r !== "default")), s = _(() => e.collection.total.value || null);
2267
- return (r, a) => (i(), W(n(Rt), {
2308
+ setup(l) {
2309
+ const e = l, t = h(() => Object.keys(ke()).filter((a) => a !== "default")), i = h(() => e.collection.total.value || null);
2310
+ return (a, n) => (c(), Y(s(Pt), {
2268
2311
  title: e.title,
2269
2312
  description: e.description,
2270
2313
  icon: e.icon,
2271
- count: s.value,
2314
+ count: i.value,
2272
2315
  actions: e.actions
2273
2316
  }, {
2274
- default: B(() => [
2275
- O(Dn, {
2317
+ default: q(() => [
2318
+ P(Rn, {
2276
2319
  collection: e.collection,
2277
2320
  "row-actions": e.rowActions,
2278
2321
  "row-label": e.rowLabel,
@@ -2280,44 +2323,143 @@ const Qo = ["aria-busy"], Zo = {
2280
2323
  density: e.density,
2281
2324
  "views-presentation": e.viewsPresentation,
2282
2325
  "actions-visible": e.actionsVisible
2283
- }, vt({ _: 2 }, [
2284
- Z(l.value, (c) => ({
2285
- name: c,
2286
- fn: B((f) => [
2287
- pe(r.$slots, c, Pt(At(f ?? {})))
2326
+ }, je({ _: 2 }, [
2327
+ X(t.value, (u) => ({
2328
+ name: u,
2329
+ fn: q((p) => [
2330
+ oe(a.$slots, u, Ue(He(p ?? {})))
2288
2331
  ])
2289
2332
  }))
2290
2333
  ]), 1032, ["collection", "row-actions", "row-label", "row-height", "density", "views-presentation", "actions-visible"]),
2291
- pe(r.$slots, "default")
2334
+ oe(a.$slots, "default")
2292
2335
  ]),
2293
2336
  _: 3
2294
2337
  }, 8, ["title", "description", "icon", "count", "actions"]));
2295
2338
  }
2296
- }), Un = ["today", "yesterday", "this_week", "last_week", "this_month", "last_month", "this_year", "last_year"];
2297
- function gs(t, e) {
2298
- const { t: l } = Ce();
2339
+ }), Tn = ["aria-busy"], fs = /* @__PURE__ */ ue({
2340
+ __name: "DataTable",
2341
+ props: {
2342
+ rows: {},
2343
+ columns: {},
2344
+ rowKey: {},
2345
+ loading: { type: Boolean, default: !1 },
2346
+ skeletonRows: { default: 3 },
2347
+ recordRoute: { type: Function, default: void 0 },
2348
+ rowActions: { type: Function, default: void 0 },
2349
+ rowLabel: { type: Function, default: void 0 },
2350
+ rowHeight: { default: void 0 },
2351
+ density: { default: "regular" },
2352
+ actionsVisible: { type: Boolean, default: !1 },
2353
+ rowClass: { type: Function, default: void 0 }
2354
+ },
2355
+ setup(l) {
2356
+ const e = l, { phone: t } = wt(() => e.columns), i = h(() => e.loading ? "loading" : e.rows.length === 0 ? "empty" : "rows"), a = (u) => e.recordRoute ? e.recordRoute(u) : null, n = h(() => Object.keys(ke()));
2357
+ return (u, p) => (c(), d("div", {
2358
+ "aria-busy": e.loading || void 0,
2359
+ "data-test": "data-table"
2360
+ }, [
2361
+ P(yt, {
2362
+ columns: e.columns,
2363
+ rows: e.rows,
2364
+ "row-key": e.rowKey,
2365
+ display: i.value,
2366
+ phone: s(t),
2367
+ link: a,
2368
+ "row-actions": e.rowActions,
2369
+ "row-label": e.rowLabel,
2370
+ "row-height": e.rowHeight,
2371
+ density: e.density,
2372
+ "actions-visible": e.actionsVisible,
2373
+ "skeleton-rows": e.skeletonRows,
2374
+ "row-class": e.rowClass
2375
+ }, je({ _: 2 }, [
2376
+ X(n.value, (g) => ({
2377
+ name: g,
2378
+ fn: q((m) => [
2379
+ oe(u.$slots, g, Ue(He(m ?? {})))
2380
+ ])
2381
+ }))
2382
+ ]), 1032, ["columns", "rows", "row-key", "display", "phone", "row-actions", "row-label", "row-height", "density", "actions-visible", "skeleton-rows", "row-class"])
2383
+ ], 8, Tn));
2384
+ }
2385
+ }), Vn = {
2386
+ key: 0,
2387
+ class: "flex items-center justify-center gap-1",
2388
+ "data-test": "row-actions"
2389
+ }, Fn = ["href", "target", "rel", "aria-label", "data-action"], Mn = ["aria-label", "data-action", "disabled", "onClick"], st = "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus", ps = /* @__PURE__ */ ue({
2390
+ __name: "RowActions",
2391
+ props: {
2392
+ actions: {},
2393
+ disabled: { type: Boolean, default: !1 }
2394
+ },
2395
+ setup(l) {
2396
+ const e = l, t = (i) => i.tone === "critical" ? "text-status-danger-content hover:bg-status-danger-surface" : "text-content-link hover:bg-tint-soft";
2397
+ return (i, a) => e.actions.length > 0 ? (c(), d("div", Vn, [
2398
+ (c(!0), d(V, null, X(e.actions, (n) => (c(), Y(s(dt), {
2399
+ key: n.key,
2400
+ text: n.label,
2401
+ side: "left"
2402
+ }, {
2403
+ default: q(() => [
2404
+ n.href && !e.disabled ? (c(), d("a", {
2405
+ key: 0,
2406
+ href: n.href,
2407
+ target: n.external ? "_blank" : void 0,
2408
+ rel: n.external ? "noopener" : void 0,
2409
+ "aria-label": n.label,
2410
+ "data-action": n.key,
2411
+ class: W(["inline-flex rounded-md p-1.5 transition-colors", [t(n), st]])
2412
+ }, [
2413
+ P(s(H), {
2414
+ name: n.icon,
2415
+ size: 18
2416
+ }, null, 8, ["name"])
2417
+ ], 10, Fn)) : (c(), d("button", {
2418
+ key: 1,
2419
+ type: "button",
2420
+ "aria-label": n.label,
2421
+ "data-action": n.key,
2422
+ disabled: e.disabled,
2423
+ class: W(["inline-flex cursor-pointer rounded-md p-1.5 transition-colors disabled:pointer-events-none disabled:opacity-40", [t(n), st]]),
2424
+ onClick: (u) => n.onSelect?.()
2425
+ }, [
2426
+ P(s(H), {
2427
+ name: n.icon,
2428
+ size: 18
2429
+ }, null, 8, ["name"])
2430
+ ], 10, Mn))
2431
+ ]),
2432
+ _: 2
2433
+ }, 1032, ["text"]))), 128))
2434
+ ])) : j("", !0);
2435
+ }
2436
+ }), Nn = ["today", "yesterday", "this_week", "last_week", "this_month", "last_month", "this_year", "last_year"];
2437
+ function vs(l, e) {
2438
+ const { t } = he();
2299
2439
  return {
2300
- key: t,
2440
+ key: l,
2301
2441
  icon: "calendarEventFill",
2302
- label: e ?? l("core.collection.date_presets.label"),
2442
+ label: e ?? t("core.collection.date_presets.label"),
2303
2443
  type: "select",
2304
- options: Un.map((s) => ({ value: s, label: l(`core.collection.date_presets.options.${s}`) }))
2444
+ options: Nn.map((i) => ({ value: i, label: t(`core.collection.date_presets.options.${i}`) }))
2305
2445
  };
2306
2446
  }
2307
2447
  export {
2308
- Te as CollectionCell,
2309
- ms as CollectionPage,
2310
- Dn as CollectionTable,
2311
- Un as DATE_PRESETS,
2312
- Ut as DEFAULT_PAGE_SIZES,
2313
- ze as LIST_CONTEXT_PARAM,
2314
- st as RecordIdentity,
2315
- vs as createMemorySavedViews,
2316
- us as defineCollection,
2317
- fs as httpList,
2318
- ol as listParams,
2319
- nl as readListPage,
2320
- ds as useCollection,
2321
- ps as useCollectionNeighbors,
2322
- gs as useDatePresetFilter
2448
+ Pe as CollectionCell,
2449
+ ds as CollectionPage,
2450
+ Rn as CollectionTable,
2451
+ Nn as DATE_PRESETS,
2452
+ Vt as DEFAULT_PAGE_SIZES,
2453
+ fs as DataTable,
2454
+ xe as LIST_CONTEXT_PARAM,
2455
+ et as RecordIdentity,
2456
+ ps as RowActions,
2457
+ us as createMemorySavedViews,
2458
+ as as defineCollection,
2459
+ is as httpList,
2460
+ Wt as listParams,
2461
+ Yt as readListPage,
2462
+ rs as useCollection,
2463
+ cs as useCollectionNeighbors,
2464
+ vs as useDatePresetFilter
2323
2465
  };