@coolms/ui-react 0.1.0-alpha.4 → 0.1.0-alpha.40

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.
package/dist/index.js CHANGED
@@ -1,64 +1,64 @@
1
- import { jsx as e, jsxs as i, Fragment as g } from "react/jsx-runtime";
2
- import { useId as E, useState as C, useRef as x, useEffect as D, useLayoutEffect as R, useCallback as V } from "react";
3
- import { createPortal as F } from "react-dom";
4
- function L(l, n) {
5
- const a = { ...l };
6
- for (const c of Object.keys(n ?? {})) {
7
- const s = n == null ? void 0 : n[c];
8
- s !== void 0 && (a[c] = s);
1
+ import { jsx as e, jsxs as c, Fragment as $ } from "react/jsx-runtime";
2
+ import { useId as fe, useState as D, useRef as P, useEffect as ee, useCallback as Ie, useMemo as Ln, useContext as Dn, createContext as In, useLayoutEffect as $e, Fragment as $n } from "react";
3
+ import { createPortal as ln } from "react-dom";
4
+ function qe(n, t) {
5
+ const l = { ...n };
6
+ for (const r of Object.keys(t ?? {})) {
7
+ const s = t == null ? void 0 : t[r];
8
+ s !== void 0 && (l[r] = s);
9
9
  }
10
- return a;
10
+ return l;
11
11
  }
12
- function v(...l) {
13
- return l.filter(Boolean).join(" ");
12
+ function H(...n) {
13
+ return n.filter(Boolean).join(" ");
14
14
  }
15
- function k({ name: l }) {
16
- const n = { width: 16, height: 16, viewBox: "0 0 16 16", "aria-hidden": !0, focusable: !1 };
17
- switch (l) {
15
+ function re({ name: n }) {
16
+ const t = { width: 16, height: 16, viewBox: "0 0 16 16", "aria-hidden": !0, focusable: !1 };
17
+ switch (n) {
18
18
  case "lock":
19
- return /* @__PURE__ */ e("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ e("path", { fill: "currentColor", d: "M5 7V5a3 3 0 1 1 6 0v2h.5A1.5 1.5 0 0 1 13 8.5v5A1.5 1.5 0 0 1 11.5 15h-7A1.5 1.5 0 0 1 3 13.5v-5A1.5 1.5 0 0 1 4.5 7H5Zm1.5 0h3V5a1.5 1.5 0 0 0-3 0v2Z" }) });
19
+ return /* @__PURE__ */ e("svg", { ...t, className: "cms-glyph", children: /* @__PURE__ */ e("path", { fill: "currentColor", d: "M5 7V5a3 3 0 1 1 6 0v2h.5A1.5 1.5 0 0 1 13 8.5v5A1.5 1.5 0 0 1 11.5 15h-7A1.5 1.5 0 0 1 3 13.5v-5A1.5 1.5 0 0 1 4.5 7H5Zm1.5 0h3V5a1.5 1.5 0 0 0-3 0v2Z" }) });
20
20
  case "spinner":
21
- return /* @__PURE__ */ e("svg", { ...n, className: "cms-glyph cms-spinner", children: /* @__PURE__ */ e("circle", { cx: "8", cy: "8", r: "6", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeDasharray: "28", strokeDashoffset: "10" }) });
21
+ return /* @__PURE__ */ e("svg", { ...t, className: "cms-glyph cms-spinner", children: /* @__PURE__ */ e("circle", { cx: "8", cy: "8", r: "6", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeDasharray: "28", strokeDashoffset: "10" }) });
22
22
  case "back":
23
- return /* @__PURE__ */ e("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ e("path", { fill: "currentColor", d: "M10.7 2.3a1 1 0 0 1 0 1.4L6.4 8l4.3 4.3a1 1 0 0 1-1.4 1.4l-5-5a1 1 0 0 1 0-1.4l5-5a1 1 0 0 1 1.4 0Z" }) });
23
+ return /* @__PURE__ */ e("svg", { ...t, className: "cms-glyph", children: /* @__PURE__ */ e("path", { fill: "currentColor", d: "M10.7 2.3a1 1 0 0 1 0 1.4L6.4 8l4.3 4.3a1 1 0 0 1-1.4 1.4l-5-5a1 1 0 0 1 0-1.4l5-5a1 1 0 0 1 1.4 0Z" }) });
24
24
  case "close":
25
- return /* @__PURE__ */ e("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ e("path", { fill: "currentColor", d: "M3.3 3.3a1 1 0 0 1 1.4 0L8 6.6l3.3-3.3a1 1 0 1 1 1.4 1.4L9.4 8l3.3 3.3a1 1 0 0 1-1.4 1.4L8 9.4l-3.3 3.3a1 1 0 0 1-1.4-1.4L6.6 8 3.3 4.7a1 1 0 0 1 0-1.4Z" }) });
25
+ return /* @__PURE__ */ e("svg", { ...t, className: "cms-glyph", children: /* @__PURE__ */ e("path", { fill: "currentColor", d: "M3.3 3.3a1 1 0 0 1 1.4 0L8 6.6l3.3-3.3a1 1 0 1 1 1.4 1.4L9.4 8l3.3 3.3a1 1 0 0 1-1.4 1.4L8 9.4l-3.3 3.3a1 1 0 0 1-1.4-1.4L6.6 8 3.3 4.7a1 1 0 0 1 0-1.4Z" }) });
26
26
  case "warning":
27
- return /* @__PURE__ */ e("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ e("path", { fill: "currentColor", d: "M8.9 1.5a1 1 0 0 0-1.8 0l-6 11A1 1 0 0 0 2 14h12a1 1 0 0 0 .9-1.5l-6-11ZM8 5a1 1 0 0 1 1 1v3a1 1 0 0 1-2 0V6a1 1 0 0 1 1-1Zm0 7.5A1 1 0 1 1 8 10.5a1 1 0 0 1 0 2Z" }) });
27
+ return /* @__PURE__ */ e("svg", { ...t, className: "cms-glyph", children: /* @__PURE__ */ e("path", { fill: "currentColor", d: "M8.9 1.5a1 1 0 0 0-1.8 0l-6 11A1 1 0 0 0 2 14h12a1 1 0 0 0 .9-1.5l-6-11ZM8 5a1 1 0 0 1 1 1v3a1 1 0 0 1-2 0V6a1 1 0 0 1 1-1Zm0 7.5A1 1 0 1 1 8 10.5a1 1 0 0 1 0 2Z" }) });
28
28
  case "check":
29
- return /* @__PURE__ */ e("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ e("path", { fill: "currentColor", d: "M13.7 4.3a1 1 0 0 1 0 1.4l-6 6a1 1 0 0 1-1.4 0l-3-3a1 1 0 1 1 1.4-1.4L7 9.6l5.3-5.3a1 1 0 0 1 1.4 0Z" }) });
29
+ return /* @__PURE__ */ e("svg", { ...t, className: "cms-glyph", children: /* @__PURE__ */ e("path", { fill: "currentColor", d: "M13.7 4.3a1 1 0 0 1 0 1.4l-6 6a1 1 0 0 1-1.4 0l-3-3a1 1 0 1 1 1.4-1.4L7 9.6l5.3-5.3a1 1 0 0 1 1.4 0Z" }) });
30
30
  case "info":
31
- return /* @__PURE__ */ e("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ e("path", { fill: "currentColor", d: "M8 1a7 7 0 1 1 0 14A7 7 0 0 1 8 1Zm0 5.5a1 1 0 0 0-1 1V11a1 1 0 1 0 2 0V7.5a1 1 0 0 0-1-1ZM8 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z" }) });
31
+ return /* @__PURE__ */ e("svg", { ...t, className: "cms-glyph", children: /* @__PURE__ */ e("path", { fill: "currentColor", d: "M8 1a7 7 0 1 1 0 14A7 7 0 0 1 8 1Zm0 5.5a1 1 0 0 0-1 1V11a1 1 0 1 0 2 0V7.5a1 1 0 0 0-1-1ZM8 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z" }) });
32
32
  }
33
33
  }
34
- function $({
35
- variant: l = "secondary",
36
- busy: n = !1,
37
- busyLabel: a,
38
- locked: c = !1,
34
+ function De({
35
+ variant: n = "secondary",
36
+ busy: t = !1,
37
+ busyLabel: l,
38
+ locked: r = !1,
39
39
  lockedReason: s,
40
- icon: m,
41
- disabled: r,
40
+ icon: a,
41
+ disabled: h,
42
42
  className: d,
43
- children: u,
44
- type: h = "button",
45
- title: t,
46
- ...f
43
+ children: m,
44
+ type: b = "button",
45
+ title: i,
46
+ ...g
47
47
  }) {
48
- const o = !!r || n;
49
- return /* @__PURE__ */ i(
48
+ const f = !!h || t;
49
+ return /* @__PURE__ */ c(
50
50
  "button",
51
51
  {
52
- ...f,
53
- type: h,
54
- className: v("cms-button", `cms-button--${l}`, n && "is-busy", c && "is-locked", d),
55
- disabled: o,
56
- "aria-busy": n || void 0,
57
- title: c ? s ?? t : t,
52
+ ...g,
53
+ type: b,
54
+ className: H("cms-button", `cms-button--${n}`, t && "is-busy", r && "is-locked", d),
55
+ disabled: f,
56
+ "aria-busy": t || void 0,
57
+ title: r ? s ?? i : i,
58
58
  children: [
59
- n ? /* @__PURE__ */ e(k, { name: "spinner" }) : c ? /* @__PURE__ */ e(k, { name: "lock" }) : m,
60
- /* @__PURE__ */ e("span", { className: "cms-button__label", children: n && a !== void 0 ? a : u }),
61
- c && s ? /* @__PURE__ */ i("span", { className: "cms-visually-hidden", children: [
59
+ t ? /* @__PURE__ */ e(re, { name: "spinner" }) : r ? /* @__PURE__ */ e(re, { name: "lock" }) : a,
60
+ /* @__PURE__ */ e("span", { className: "cms-button__label", children: t && l !== void 0 ? l : m }),
61
+ r && s ? /* @__PURE__ */ c("span", { className: "cms-visually-hidden", children: [
62
62
  ", ",
63
63
  s
64
64
  ] }) : null
@@ -66,576 +66,1830 @@ function $({
66
66
  }
67
67
  );
68
68
  }
69
- function K({ id: l, label: n, help: a, error: c, pinned: s, children: m }) {
70
- return /* @__PURE__ */ i("div", { className: v("cms-field", c != null && "is-invalid"), children: [
71
- /* @__PURE__ */ e("label", { className: "cms-field__label", htmlFor: l, children: n }),
72
- m,
73
- s != null ? /* @__PURE__ */ i("p", { className: "cms-field__pinned", id: `${l}-pinned`, children: [
74
- /* @__PURE__ */ e(k, { name: "lock" }),
69
+ const kn = {
70
+ mail: /* @__PURE__ */ c($, { children: [
71
+ /* @__PURE__ */ e("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
72
+ /* @__PURE__ */ e("path", { d: "m3 7 9 6 9-6" })
73
+ ] }),
74
+ // A gear: a ring with eight short teeth, the hole in its middle.
75
+ settings: /* @__PURE__ */ c($, { children: [
76
+ /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "3" }),
77
+ /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "7" }),
78
+ /* @__PURE__ */ e("path", { d: "M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9 7 7M17 17l2.1 2.1M4.9 19.1 7 17M17 7l2.1-2.1" })
79
+ ] }),
80
+ // The envelope with its flap open above it: a message read, or the message itself again.
81
+ "mail-open": /* @__PURE__ */ c($, { children: [
82
+ /* @__PURE__ */ e("path", { d: "M3 10v9a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9" }),
83
+ /* @__PURE__ */ e("path", { d: "m3 10 9-6 9 6" }),
84
+ /* @__PURE__ */ e("path", { d: "m3 10 9 6 9-6" })
85
+ ] }),
86
+ // A clipboard: copy what is shown.
87
+ copy: /* @__PURE__ */ c($, { children: [
88
+ /* @__PURE__ */ e("rect", { x: "6", y: "4", width: "12", height: "17", rx: "2" }),
89
+ /* @__PURE__ */ e("path", { d: "M9 4V3h6v1" }),
90
+ /* @__PURE__ */ e("path", { d: "M9 10h6M9 14h6M9 18h3" })
91
+ ] }),
92
+ chat: /* @__PURE__ */ e("path", { d: "M4 12a8 8 0 1 1 4 6.9L4 20l1.1-4A8 8 0 0 1 4 12Z" }),
93
+ phone: /* @__PURE__ */ e("path", { d: "M5 3h3l2 5-2.5 1.5a11 11 0 0 0 7 7L16 14l5 2v3a2 2 0 0 1-2 2A16 16 0 0 1 3 5a2 2 0 0 1 2-2Z" }),
94
+ calendar: /* @__PURE__ */ c($, { children: [
95
+ /* @__PURE__ */ e("rect", { x: "3", y: "5", width: "18", height: "16", rx: "2" }),
96
+ /* @__PURE__ */ e("path", { d: "M3 10h18M8 3v4M16 3v4" })
97
+ ] }),
98
+ file: /* @__PURE__ */ c($, { children: [
99
+ /* @__PURE__ */ e("path", { d: "M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9Z" }),
100
+ /* @__PURE__ */ e("path", { d: "M14 3v6h6M8 13h8M8 17h6" })
101
+ ] }),
102
+ // The file, with code's angle brackets in place of its lines: a message's source.
103
+ "file-code": /* @__PURE__ */ c($, { children: [
104
+ /* @__PURE__ */ e("path", { d: "M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9Z" }),
105
+ /* @__PURE__ */ e("path", { d: "M14 3v6h6" }),
106
+ /* @__PURE__ */ e("path", { d: "m10 12-2 2.5 2 2.5M14 12l2 2.5-2 2.5" })
107
+ ] }),
108
+ image: /* @__PURE__ */ c($, { children: [
109
+ /* @__PURE__ */ e("rect", { x: "3", y: "4", width: "18", height: "16", rx: "2" }),
110
+ /* @__PURE__ */ e("circle", { cx: "9", cy: "10", r: "2" }),
111
+ /* @__PURE__ */ e("path", { d: "m21 17-5-5-9 8" })
112
+ ] }),
113
+ search: /* @__PURE__ */ c($, { children: [
114
+ /* @__PURE__ */ e("circle", { cx: "11", cy: "11", r: "7" }),
115
+ /* @__PURE__ */ e("path", { d: "m20 20-4-4" })
116
+ ] }),
117
+ bell: /* @__PURE__ */ c($, { children: [
118
+ /* @__PURE__ */ e("path", { d: "M6 9a6 6 0 1 1 12 0c0 6 2 8 2 8H4s2-2 2-8Z" }),
119
+ /* @__PURE__ */ e("path", { d: "M10 20a2 2 0 0 0 4 0" })
120
+ ] }),
121
+ pencil: /* @__PURE__ */ c($, { children: [
122
+ /* @__PURE__ */ e("path", { d: "M4 20h4L19 9l-4-4L4 16Z" }),
123
+ /* @__PURE__ */ e("path", { d: "m13 7 4 4" })
124
+ ] }),
125
+ download: /* @__PURE__ */ c($, { children: [
126
+ /* @__PURE__ */ e("path", { d: "M12 4v11" }),
127
+ /* @__PURE__ */ e("path", { d: "m7 11 5 5 5-5" }),
128
+ /* @__PURE__ */ e("path", { d: "M4 20h16" })
129
+ ] }),
130
+ // Download's arrow turned up, from the line: a file sent up.
131
+ upload: /* @__PURE__ */ c($, { children: [
132
+ /* @__PURE__ */ e("path", { d: "M12 20V9" }),
133
+ /* @__PURE__ */ e("path", { d: "m7 13 5-5 5 5" }),
134
+ /* @__PURE__ */ e("path", { d: "M4 4h16" })
135
+ ] }),
136
+ print: /* @__PURE__ */ c($, { children: [
137
+ /* @__PURE__ */ e("path", { d: "M7 8V4h10v4" }),
138
+ /* @__PURE__ */ e("rect", { x: "3", y: "8", width: "18", height: "8", rx: "2" }),
139
+ /* @__PURE__ */ e("path", { d: "M7 14h10v6H7Z" })
140
+ ] }),
141
+ "open-separately": /* @__PURE__ */ c($, { children: [
142
+ /* @__PURE__ */ e("path", { d: "M14 4h6v6" }),
143
+ /* @__PURE__ */ e("path", { d: "m20 4-9 9" }),
144
+ /* @__PURE__ */ e("path", { d: "M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5" })
145
+ ] }),
146
+ star: /* @__PURE__ */ e("path", { d: "m12 3 2.8 5.8 6.2.9-4.5 4.4 1 6.2L12 17.4l-5.5 2.9 1-6.2L3 9.7l6.2-.9Z" }),
147
+ send: /* @__PURE__ */ c($, { children: [
148
+ /* @__PURE__ */ e("path", { d: "M21 3 10 14" }),
149
+ /* @__PURE__ */ e("path", { d: "M21 3 14 21l-4-7-7-4Z" })
150
+ ] }),
151
+ inbox: /* @__PURE__ */ c($, { children: [
152
+ /* @__PURE__ */ e("path", { d: "M3 13h5l1 3h6l1-3h5" }),
153
+ /* @__PURE__ */ e("path", { d: "M5 5h14l2 8v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-6Z" })
154
+ ] }),
155
+ archive: /* @__PURE__ */ c($, { children: [
156
+ /* @__PURE__ */ e("rect", { x: "3", y: "4", width: "18", height: "5", rx: "1" }),
157
+ /* @__PURE__ */ e("path", { d: "M5 9v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V9M10 13h4" })
158
+ ] }),
159
+ trash: /* @__PURE__ */ c($, { children: [
160
+ /* @__PURE__ */ e("path", { d: "M4 7h16M10 11v6M14 11v6" }),
161
+ /* @__PURE__ */ e("path", { d: "M6 7l1 13a2 2 0 0 0 2 1h6a2 2 0 0 0 2-1l1-13M9 7V4h6v3" })
162
+ ] }),
163
+ paperclip: /* @__PURE__ */ e("path", { d: "m20 11-8.5 8.5a5 5 0 0 1-7-7L13 4a3.5 3.5 0 0 1 5 5l-8.5 8.5a2 2 0 0 1-3-3L14 7" }),
164
+ mic: /* @__PURE__ */ c($, { children: [
165
+ /* @__PURE__ */ e("rect", { x: "9", y: "3", width: "6", height: "11", rx: "3" }),
166
+ /* @__PURE__ */ e("path", { d: "M5 11a7 7 0 0 0 14 0M12 18v3" })
167
+ ] }),
168
+ speaker: /* @__PURE__ */ c($, { children: [
169
+ /* @__PURE__ */ e("path", { d: "M4 9h4l5-4v14l-5-4H4Z" }),
170
+ /* @__PURE__ */ e("path", { d: "M16 9a4 4 0 0 1 0 6M19 6a8 8 0 0 1 0 12" })
171
+ ] }),
172
+ "user-plus": /* @__PURE__ */ c($, { children: [
173
+ /* @__PURE__ */ e("circle", { cx: "10", cy: "8", r: "4" }),
174
+ /* @__PURE__ */ e("path", { d: "M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6" })
175
+ ] }),
176
+ // A person, nothing more: one whose account is gone.
177
+ user: /* @__PURE__ */ c($, { children: [
178
+ /* @__PURE__ */ e("circle", { cx: "12", cy: "8", r: "4" }),
179
+ /* @__PURE__ */ e("path", { d: "M4 21a8 8 0 0 1 16 0" })
180
+ ] }),
181
+ // A person with a tick: someone allowed.
182
+ "user-check": /* @__PURE__ */ c($, { children: [
183
+ /* @__PURE__ */ e("circle", { cx: "10", cy: "8", r: "4" }),
184
+ /* @__PURE__ */ e("path", { d: "M3 21a7 7 0 0 1 14 0M16 11l2 2 4-4" })
185
+ ] }),
186
+ // A person with a cross: someone no longer allowed.
187
+ "user-x": /* @__PURE__ */ c($, { children: [
188
+ /* @__PURE__ */ e("circle", { cx: "10", cy: "8", r: "4" }),
189
+ /* @__PURE__ */ e("path", { d: "M3 21a7 7 0 0 1 14 0M17 8l4 4M21 8l-4 4" })
190
+ ] }),
191
+ // Two people: the members of a group.
192
+ users: /* @__PURE__ */ c($, { children: [
193
+ /* @__PURE__ */ e("circle", { cx: "9", cy: "8", r: "3.5" }),
194
+ /* @__PURE__ */ e("path", { d: "M2.5 20a6.5 6.5 0 0 1 13 0M16 4.6a3.5 3.5 0 0 1 0 6.8M18 14a6.5 6.5 0 0 1 3.5 6" })
195
+ ] }),
196
+ "phone-off": /* @__PURE__ */ e("path", { d: "M3 14c5-5 13-5 18 0l-2 3-4-1v-3a10 10 0 0 0-6 0v3l-4 1Z" }),
197
+ video: /* @__PURE__ */ c($, { children: [
198
+ /* @__PURE__ */ e("rect", { x: "3", y: "6", width: "13", height: "12", rx: "2" }),
199
+ /* @__PURE__ */ e("path", { d: "m16 10 5-3v10l-5-3" })
200
+ ] }),
201
+ info: /* @__PURE__ */ c($, { children: [
202
+ /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "9" }),
203
+ /* @__PURE__ */ e("path", { d: "M12 11v6M12 7.5v.5" })
204
+ ] }),
205
+ "chevron-down": /* @__PURE__ */ e("path", { d: "m6 9 6 6 6-6" }),
206
+ "chevron-left": /* @__PURE__ */ e("path", { d: "m15 18-6-6 6-6" }),
207
+ plus: /* @__PURE__ */ e("path", { d: "M12 5v14M5 12h14" }),
208
+ folder: /* @__PURE__ */ e("path", { d: "M3 6a2 2 0 0 1 2-2h4l2 3h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z" }),
209
+ // The folder with a plus inside: a new folder.
210
+ "folder-plus": /* @__PURE__ */ c($, { children: [
211
+ /* @__PURE__ */ e("path", { d: "M3 6a2 2 0 0 1 2-2h4l2 3h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z" }),
212
+ /* @__PURE__ */ e("path", { d: "M12 10.5v6M9 13.5h6" })
213
+ ] }),
214
+ // The folder with a cross inside: a folder removed.
215
+ "folder-x": /* @__PURE__ */ c($, { children: [
216
+ /* @__PURE__ */ e("path", { d: "M3 6a2 2 0 0 1 2-2h4l2 3h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z" }),
217
+ /* @__PURE__ */ e("path", { d: "m9.5 11 5 5M14.5 11l-5 5" })
218
+ ] }),
219
+ check: /* @__PURE__ */ e("path", { d: "m5 12 5 5 9-10" }),
220
+ server: /* @__PURE__ */ c($, { children: [
221
+ /* @__PURE__ */ e("rect", { x: "3", y: "4", width: "18", height: "7", rx: "2" }),
222
+ /* @__PURE__ */ e("rect", { x: "3", y: "13", width: "18", height: "7", rx: "2" }),
223
+ /* @__PURE__ */ e("path", { d: "M7 7.5h.5M7 16.5h.5" })
224
+ ] }),
225
+ reply: /* @__PURE__ */ e("path", { d: "M10 8 4 13l6 5M4 13h11a5 5 0 0 1 5 5" }),
226
+ // Reply's mirror: the arrow leaves to the right.
227
+ forward: /* @__PURE__ */ e("path", { d: "m14 8 6 5-6 5M20 13H9a5 5 0 0 0-5 5" }),
228
+ refresh: /* @__PURE__ */ e("path", { d: "M20 11a8 8 0 1 0-2.3 5.7M20 5v6h-6" }),
229
+ more: /* @__PURE__ */ e("path", { d: "M5 12h.5M12 12h.5M19 12h.5" }),
230
+ // A number sign: a channel, by its name.
231
+ hash: /* @__PURE__ */ e("path", { d: "M10 4 8 20M16 4l-2 16M5 9h15M4 15h15" }),
232
+ // A funnel: a list's filter.
233
+ funnel: /* @__PURE__ */ e("path", { d: "M4 5h16l-6 8v6l-4-2v-4Z" }),
234
+ // An eye: what is hidden is shown. Struck through: it is hidden again.
235
+ eye: /* @__PURE__ */ c($, { children: [
236
+ /* @__PURE__ */ e("path", { d: "M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z" }),
237
+ /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "3" })
238
+ ] }),
239
+ "eye-off": /* @__PURE__ */ c($, { children: [
240
+ /* @__PURE__ */ e("path", { d: "M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z" }),
241
+ /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "3" }),
242
+ /* @__PURE__ */ e("path", { d: "m4 4 16 16" })
243
+ ] }),
244
+ important: /* @__PURE__ */ e("path", { d: "M4 6h11l5 6-5 6H4l4-6-4-6Z" })
245
+ };
246
+ function B({ name: n, size: t = 20, label: l }) {
247
+ return /* @__PURE__ */ e(
248
+ "svg",
249
+ {
250
+ className: "cms-icon",
251
+ width: t,
252
+ height: t,
253
+ viewBox: "0 0 24 24",
254
+ fill: "none",
255
+ stroke: "currentColor",
256
+ strokeWidth: n === "more" ? 3 : 1.75,
257
+ strokeLinecap: "round",
258
+ strokeLinejoin: "round",
259
+ focusable: !1,
260
+ ...l ? { role: "img", "aria-label": l } : { "aria-hidden": !0 },
261
+ children: kn[n]
262
+ }
263
+ );
264
+ }
265
+ const zt = Object.keys(kn), pn = {
266
+ reply: "reply",
267
+ "reply-all": "reply",
268
+ forward: "forward",
269
+ envelope: "mail",
270
+ "envelope-open": "mail-open",
271
+ star: "star",
272
+ "star-fill": "star",
273
+ "folder-symlink": "folder",
274
+ folder: "folder",
275
+ trash: "trash",
276
+ archive: "archive",
277
+ "arrow-clockwise": "refresh",
278
+ download: "download",
279
+ printer: "print",
280
+ "file-earmark-code": "file-code",
281
+ clipboard: "copy",
282
+ "three-dots": "more",
283
+ pencil: "pencil",
284
+ trash3: "trash",
285
+ "folder-plus": "folder-plus",
286
+ "folder-x": "folder-x",
287
+ image: "image",
288
+ "person-check": "user-check",
289
+ "person-x": "user-x",
290
+ "arrow-left": "chevron-left",
291
+ "pencil-square": "pencil",
292
+ "plus-lg": "plus",
293
+ gear: "settings",
294
+ upload: "upload",
295
+ "cloud-upload": "upload",
296
+ people: "users",
297
+ "file-earmark-word": "file",
298
+ "file-earmark-spreadsheet": "file",
299
+ "file-earmark-text": "file",
300
+ folder2: "folder",
301
+ "folder2-open": "folder",
302
+ "chat-dots": "chat",
303
+ images: "image",
304
+ paperclip: "paperclip",
305
+ hash: "hash",
306
+ funnel: "funnel",
307
+ eye: "eye",
308
+ "eye-slash": "eye-off"
309
+ };
310
+ function Ue(n) {
311
+ return Object.prototype.hasOwnProperty.call(pn, n) ? pn[n] : null;
312
+ }
313
+ function Bn() {
314
+ try {
315
+ return process.env.NODE_ENV !== "production";
316
+ } catch {
317
+ return !1;
318
+ }
319
+ }
320
+ const bn = /* @__PURE__ */ new Set();
321
+ function Fn({ name: n, size: t = 18 }) {
322
+ if (n === "") return null;
323
+ const l = Ue(n);
324
+ return l !== null ? /* @__PURE__ */ e(B, { name: l, size: t }) : (!bn.has(n) && Bn() && (bn.add(n), console.warn(`@coolms/ui-react: no icon for the server's icon name "${n}"; its space is kept empty`)), /* @__PURE__ */ e("span", { className: "cms-icon cms-icon--blank", style: { width: t, height: t }, "aria-hidden": "true", "data-icon-name": n }));
325
+ }
326
+ function sn({ id: n, label: t, help: l, error: r, pinned: s, children: a }) {
327
+ return /* @__PURE__ */ c("div", { className: H("cms-field", r != null && "is-invalid"), children: [
328
+ /* @__PURE__ */ e("label", { className: "cms-field__label", htmlFor: n, children: t }),
329
+ a,
330
+ s != null ? /* @__PURE__ */ c("p", { className: "cms-field__pinned", id: `${n}-pinned`, children: [
331
+ /* @__PURE__ */ e(re, { name: "lock" }),
75
332
  " ",
76
333
  s
77
334
  ] }) : null,
78
- c != null ? /* @__PURE__ */ e("p", { className: "cms-field__error", id: `${l}-error`, role: "alert", children: c }) : null,
79
- a != null ? /* @__PURE__ */ e("p", { className: "cms-field__help", id: `${l}-help`, children: a }) : null
335
+ r != null ? /* @__PURE__ */ e("p", { className: "cms-field__error", id: `${n}-error`, role: "alert", children: r }) : null,
336
+ l != null ? /* @__PURE__ */ e("p", { className: "cms-field__help", id: `${n}-help`, children: l }) : null
80
337
  ] });
81
338
  }
82
- function P(l, n) {
83
- const a = [n.error != null && `${l}-error`, n.pinned != null && `${l}-pinned`, n.help != null && `${l}-help`].filter(Boolean).join(" ");
84
- return a === "" ? void 0 : a;
339
+ function rn(n, t) {
340
+ const l = [t.error != null && `${n}-error`, t.pinned != null && `${n}-pinned`, t.help != null && `${n}-help`].filter(Boolean).join(" ");
341
+ return l === "" ? void 0 : l;
85
342
  }
86
- function re({ label: l, help: n, error: a, disabled: c, readOnly: s, pinned: m, value: r, onChange: d, placeholder: u, type: h = "text", name: t }) {
87
- const f = E();
88
- return /* @__PURE__ */ e(K, { id: f, label: l, help: n, error: a, pinned: m, children: /* @__PURE__ */ e(
343
+ const Hn = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2}))?)?$/, Rn = /^(\d{2}):(\d{2})(?::(\d{2}))?$/;
344
+ function On(n, t, l) {
345
+ const r = (a, h, d, m = 0, b = 0, i = 0) => {
346
+ const g = new Date(Date.UTC(a, h - 1, d, m, b, i));
347
+ return g.setUTCFullYear(a), g.getUTCFullYear() === a && g.getUTCMonth() === h - 1 && g.getUTCDate() === d && g.getUTCHours() === m && g.getUTCMinutes() === b && g.getUTCSeconds() === i ? g : null;
348
+ }, s = (a) => ({ hour: Number(a[1]), minute: Number(a[2]), second: Number(a[3] ?? 0) });
349
+ try {
350
+ if (n === "time") {
351
+ const h = t.match(Rn);
352
+ if (h === null) return t;
353
+ const d = s(h), m = r(2e3, 1, 1, d.hour, d.minute, d.second);
354
+ return m === null ? t : new Intl.DateTimeFormat(l, { timeStyle: h[3] === void 0 ? "short" : "medium", timeZone: "UTC" }).format(m);
355
+ }
356
+ const a = t.match(Hn);
357
+ if (a === null) return t;
358
+ if (n === "date" && a[4] === void 0) {
359
+ const h = r(Number(a[1]), Number(a[2]), Number(a[3]));
360
+ return h === null ? t : new Intl.DateTimeFormat(l, { dateStyle: "medium", timeZone: "UTC" }).format(h);
361
+ }
362
+ if (n === "datetime-local" && a[4] !== void 0) {
363
+ const h = r(Number(a[1]), Number(a[2]), Number(a[3]), Number(a[4]), Number(a[5]), Number(a[6] ?? 0));
364
+ return h === null ? t : new Intl.DateTimeFormat(l, { dateStyle: "medium", timeStyle: a[6] === void 0 ? "short" : "medium", timeZone: "UTC" }).format(h);
365
+ }
366
+ } catch {
367
+ return t;
368
+ }
369
+ return t;
370
+ }
371
+ const Pn = /* @__PURE__ */ new Set(["date", "time", "datetime-local"]);
372
+ function Ut({ label: n, help: t, error: l, disabled: r, readOnly: s, pinned: a, value: h, onChange: d, placeholder: m, type: b = "text", name: i, locale: g, min: f, max: v, step: u, minLength: y, maxLength: S, required: T, autoComplete: M, reveal: E }) {
373
+ const _ = fe(), [N, I] = D(!1), K = s === !0 || a != null, z = K && Pn.has(b), k = b === "number" && (u === "any" || typeof u == "number" && !Number.isInteger(u)), F = b === "password" && E !== void 0 && !K, U = /* @__PURE__ */ e(
89
374
  "input",
90
375
  {
91
- id: f,
92
- name: t,
93
- type: h,
376
+ id: _,
377
+ name: i,
378
+ type: z || F && N ? "text" : b,
379
+ autoComplete: M,
94
380
  className: "cms-input",
95
- value: r,
96
- placeholder: u,
97
- disabled: c,
98
- readOnly: s || m != null,
99
- "aria-invalid": a != null || void 0,
100
- "aria-describedby": P(f, { help: n, error: a, pinned: m }),
101
- onChange: (o) => d == null ? void 0 : d(o.target.value)
381
+ value: z ? On(b, h, g) : h,
382
+ ...z ? { "data-value": h } : {},
383
+ lang: g,
384
+ placeholder: m,
385
+ disabled: r,
386
+ readOnly: K,
387
+ required: T,
388
+ "aria-required": T || void 0,
389
+ min: z ? void 0 : f,
390
+ max: z ? void 0 : v,
391
+ step: z ? void 0 : u,
392
+ minLength: y,
393
+ maxLength: S,
394
+ inputMode: b === "number" ? k ? "decimal" : "numeric" : void 0,
395
+ "aria-invalid": l != null || void 0,
396
+ "aria-describedby": rn(_, { help: t, error: l, pinned: a }),
397
+ onChange: (Y) => d == null ? void 0 : d(Y.target.value)
398
+ }
399
+ );
400
+ return /* @__PURE__ */ e(sn, { id: _, label: n, help: t, error: l, pinned: a, children: F ? /* @__PURE__ */ c("span", { className: "cms-input-reveal", children: [
401
+ U,
402
+ /* @__PURE__ */ e(
403
+ "button",
404
+ {
405
+ type: "button",
406
+ className: "cms-input-reveal__button",
407
+ "aria-controls": _,
408
+ "aria-label": N ? E.hide : E.show,
409
+ title: N ? E.hide : E.show,
410
+ disabled: r,
411
+ onClick: () => I((Y) => !Y),
412
+ children: /* @__PURE__ */ e(B, { name: N ? "eye-off" : "eye", size: 18 })
413
+ }
414
+ )
415
+ ] }) : U });
416
+ }
417
+ function Kt({ label: n, help: t, error: l, disabled: r, readOnly: s, pinned: a, value: h, onChange: d, placeholder: m, rows: b = 4, name: i, locale: g, minLength: f, maxLength: v, required: u }) {
418
+ const y = fe();
419
+ return /* @__PURE__ */ e(sn, { id: y, label: n, help: t, error: l, pinned: a, children: /* @__PURE__ */ e(
420
+ "textarea",
421
+ {
422
+ id: y,
423
+ name: i,
424
+ className: "cms-input cms-textarea",
425
+ rows: b,
426
+ value: h,
427
+ lang: g,
428
+ placeholder: m,
429
+ disabled: r,
430
+ readOnly: s === !0 || a != null,
431
+ required: u,
432
+ "aria-required": u || void 0,
433
+ minLength: f,
434
+ maxLength: v,
435
+ "aria-invalid": l != null || void 0,
436
+ "aria-describedby": rn(y, { help: t, error: l, pinned: a }),
437
+ onChange: (S) => d == null ? void 0 : d(S.target.value)
102
438
  }
103
439
  ) });
104
440
  }
105
- function ie({ label: l, help: n, error: a, disabled: c, readOnly: s, value: m, options: r, onChange: d, emptyText: u = "Nothing to choose from yet.", name: h }) {
106
- const t = E(), f = r.length === 0;
107
- return /* @__PURE__ */ e(K, { id: t, label: l, help: f ? u : n, error: a, children: /* @__PURE__ */ e(
441
+ function Wt({ label: n, help: t, error: l, disabled: r, readOnly: s, value: a, options: h, onChange: d, emptyText: m = "Nothing to choose from yet.", name: b }) {
442
+ const i = fe(), g = h.length === 0;
443
+ return /* @__PURE__ */ e(sn, { id: i, label: n, help: g ? m : t, error: l, children: /* @__PURE__ */ e(
108
444
  "select",
109
445
  {
110
- id: t,
111
- name: h,
446
+ id: i,
447
+ name: b,
112
448
  className: "cms-input cms-select",
113
- value: m,
114
- disabled: c || f,
449
+ value: a,
450
+ disabled: r || g,
115
451
  "aria-readonly": s || void 0,
116
- "aria-invalid": a != null || void 0,
117
- "aria-describedby": P(t, { help: f ? u : n, error: a }),
118
- onChange: (o) => {
119
- s || d == null || d(o.target.value);
452
+ "aria-invalid": l != null || void 0,
453
+ "aria-describedby": rn(i, { help: g ? m : t, error: l }),
454
+ onChange: (f) => {
455
+ s || d == null || d(f.target.value);
120
456
  },
121
- children: r.map((o) => /* @__PURE__ */ e("option", { value: o.value, disabled: s && o.value !== m, children: o.label }, o.value))
457
+ children: h.map((f) => /* @__PURE__ */ e("option", { value: f.value, disabled: s && f.value !== a, children: f.label }, f.value))
122
458
  }
123
459
  ) });
124
460
  }
125
- function oe({ label: l, checked: n, onChange: a, disabled: c, readOnly: s, help: m }) {
126
- const r = E();
127
- return /* @__PURE__ */ i("div", { className: "cms-toggle-row", children: [
461
+ function Zt({ label: n, checked: t, onChange: l, disabled: r, readOnly: s, help: a }) {
462
+ const h = fe();
463
+ return /* @__PURE__ */ c("div", { className: "cms-toggle-row", children: [
128
464
  /* @__PURE__ */ e(
129
465
  "button",
130
466
  {
131
- id: r,
467
+ id: h,
132
468
  type: "button",
133
469
  role: "switch",
134
- className: v("cms-toggle", n && "is-on"),
135
- "aria-checked": n,
470
+ className: H("cms-toggle", t && "is-on"),
471
+ "aria-checked": t,
136
472
  "aria-readonly": s || void 0,
137
- "aria-describedby": m != null ? `${r}-help` : void 0,
138
- disabled: c,
473
+ "aria-describedby": a != null ? `${h}-help` : void 0,
474
+ disabled: r,
139
475
  onClick: () => {
140
- s || a == null || a(!n);
476
+ s || l == null || l(!t);
141
477
  },
142
478
  children: /* @__PURE__ */ e("span", { className: "cms-toggle__thumb" })
143
479
  }
144
480
  ),
145
- /* @__PURE__ */ e("label", { className: "cms-toggle__label", htmlFor: r, children: l }),
146
- m != null ? /* @__PURE__ */ e("p", { className: "cms-field__help", id: `${r}-help`, children: m }) : null
481
+ /* @__PURE__ */ e("label", { className: "cms-toggle__label", htmlFor: h, children: n }),
482
+ a != null ? /* @__PURE__ */ e("p", { className: "cms-field__help", id: `${h}-help`, children: a }) : null
147
483
  ] });
148
484
  }
149
- const j = 150;
150
- function z({ open: l, title: n, onClose: a, dirty: c = !1, onDirtyClose: s, children: m, footer: r, closeLabel: d = "Close" }) {
151
- const [u, h] = C(l), [t, f] = C(!1), o = x(null), p = x(null), b = E();
152
- if (D(() => {
153
- if (l) {
154
- p.current = document.activeElement, h(!0), f(!1);
485
+ const zn = 150;
486
+ function xn({ open: n, title: t, onClose: l, dirty: r = !1, onDirtyClose: s, children: a, footer: h, closeLabel: d = "Close", initialFocus: m, className: b }) {
487
+ const [i, g] = D(n), [f, v] = D(!1), u = P(null), y = P(null), S = fe();
488
+ if (ee(() => {
489
+ if (n) {
490
+ y.current = document.activeElement, g(!0), v(!1);
155
491
  return;
156
492
  }
157
- if (!u) return;
158
- f(!0);
159
- const _ = window.setTimeout(() => {
160
- var M, w;
161
- h(!1), f(!1), (w = (M = p.current) == null ? void 0 : M.focus) == null || w.call(M);
162
- }, j);
163
- return () => window.clearTimeout(_);
164
- }, [l, u]), D(() => {
165
- var _, M;
166
- if (l && u) {
167
- const w = 'input, select, textarea, button, [href], [tabindex]:not([tabindex="-1"])';
168
- (M = ((_ = o.current) == null ? void 0 : _.querySelector(`.cms-modal__body :is(${w}), .cms-modal__foot :is(${w})`)) ?? o.current) == null || M.focus();
493
+ if (!i) return;
494
+ v(!0);
495
+ const M = window.setTimeout(() => {
496
+ var E, _;
497
+ g(!1), v(!1), (_ = (E = y.current) == null ? void 0 : E.focus) == null || _.call(E);
498
+ }, zn);
499
+ return () => window.clearTimeout(M);
500
+ }, [n, i]), ee(() => {
501
+ var M, E;
502
+ if (n && i) {
503
+ const _ = 'input, select, textarea, button, [href], [tabindex]:not([tabindex="-1"])';
504
+ (E = (m == null ? void 0 : m.current) ?? ((M = u.current) == null ? void 0 : M.querySelector(`.cms-modal__body :is(${_}), .cms-modal__foot :is(${_})`)) ?? u.current) == null || E.focus();
169
505
  }
170
- }, [l, u]), !u) return null;
171
- const N = () => {
172
- c ? s == null || s() : a();
506
+ }, [n, i, m]), !i) return null;
507
+ const T = () => {
508
+ r ? s == null || s() : l();
173
509
  };
174
- return F(
175
- /* @__PURE__ */ e("div", { className: v("cms-modal-scrim", t && "is-closing"), onMouseDown: (_) => {
176
- _.target === _.currentTarget && N();
177
- }, children: /* @__PURE__ */ i(
510
+ return ln(
511
+ /* @__PURE__ */ e("div", { className: H("cms-modal-scrim", f && "is-closing"), onMouseDown: (M) => {
512
+ M.target === M.currentTarget && T();
513
+ }, children: /* @__PURE__ */ c(
178
514
  "div",
179
515
  {
180
- ref: o,
181
- className: v("cms-modal", t && "is-closing", c && "is-dirty"),
516
+ ref: u,
517
+ className: H("cms-modal", b, f && "is-closing", r && "is-dirty"),
182
518
  role: "dialog",
183
519
  "aria-modal": "true",
184
- "aria-labelledby": b,
520
+ "aria-labelledby": S,
185
521
  tabIndex: -1,
186
- onKeyDown: (_) => {
187
- var M;
188
- if (_.key === "Escape")
189
- _.stopPropagation(), N();
190
- else if (_.key === "Tab") {
191
- const w = (M = o.current) == null ? void 0 : M.querySelectorAll('input, select, textarea, button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])');
192
- if (!w || w.length === 0) return;
193
- const T = w[0], B = w[w.length - 1];
194
- _.shiftKey && document.activeElement === T ? (_.preventDefault(), B.focus()) : !_.shiftKey && document.activeElement === B && (_.preventDefault(), T.focus());
522
+ onKeyDown: (M) => {
523
+ var E;
524
+ if (M.key === "Escape")
525
+ M.stopPropagation(), T();
526
+ else if (M.key === "Tab") {
527
+ const _ = (E = u.current) == null ? void 0 : E.querySelectorAll('input, select, textarea, button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])');
528
+ if (!_ || _.length === 0) return;
529
+ const N = _[0], I = _[_.length - 1];
530
+ M.shiftKey && document.activeElement === N ? (M.preventDefault(), I.focus()) : !M.shiftKey && document.activeElement === I && (M.preventDefault(), N.focus());
195
531
  }
196
532
  },
197
533
  children: [
198
- /* @__PURE__ */ i("header", { className: "cms-modal__head", children: [
199
- /* @__PURE__ */ e("h2", { className: "cms-modal__title", id: b, children: n }),
200
- /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": d, onClick: N, children: /* @__PURE__ */ e(k, { name: "close" }) })
534
+ /* @__PURE__ */ c("header", { className: "cms-modal__head", children: [
535
+ /* @__PURE__ */ e("h2", { className: "cms-modal__title", id: S, children: t }),
536
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": d, onClick: T, children: /* @__PURE__ */ e(re, { name: "close" }) })
201
537
  ] }),
202
- /* @__PURE__ */ e("div", { className: "cms-modal__body", children: m }),
203
- r != null ? /* @__PURE__ */ e("footer", { className: "cms-modal__foot", children: r }) : null
538
+ /* @__PURE__ */ e("div", { className: "cms-modal__body", children: a }),
539
+ h != null ? /* @__PURE__ */ e("footer", { className: "cms-modal__foot", children: h }) : null
204
540
  ]
205
541
  }
206
542
  ) }),
207
543
  document.body
208
544
  );
209
545
  }
210
- function de({ open: l, title: n, message: a, kind: c = "default", confirmLabel: s, cancelLabel: m, closeLabel: r, onConfirm: d, onCancel: u }) {
211
- const h = c === "discard-changes";
546
+ function Vt({ open: n, title: t, message: l, kind: r = "default", confirmLabel: s, cancelLabel: a, closeLabel: h, onConfirm: d, onCancel: m }) {
547
+ const b = r === "discard-changes";
212
548
  return /* @__PURE__ */ e(
213
- z,
549
+ xn,
214
550
  {
215
- open: l,
216
- title: n,
217
- onClose: u,
218
- ...r === void 0 ? {} : { closeLabel: r },
219
- footer: /* @__PURE__ */ i(g, { children: [
220
- /* @__PURE__ */ e($, { onClick: u, children: m ?? (h ? "Keep editing" : "Cancel") }),
221
- /* @__PURE__ */ e($, { variant: c === "default" ? "primary" : "danger", onClick: d, children: s ?? (h ? "Discard changes" : "Confirm") })
551
+ open: n,
552
+ title: t,
553
+ onClose: m,
554
+ ...h === void 0 ? {} : { closeLabel: h },
555
+ footer: /* @__PURE__ */ c($, { children: [
556
+ /* @__PURE__ */ e(De, { onClick: m, children: a ?? (b ? "Keep editing" : "Cancel") }),
557
+ /* @__PURE__ */ e(De, { variant: r === "default" ? "primary" : "danger", onClick: d, children: s ?? (b ? "Discard changes" : "Confirm") })
222
558
  ] }),
223
- children: c !== "default" ? /* @__PURE__ */ i("p", { className: "cms-confirm__warning", children: [
224
- /* @__PURE__ */ e(k, { name: "warning" }),
559
+ children: r !== "default" ? /* @__PURE__ */ c("p", { className: "cms-confirm__warning", children: [
560
+ /* @__PURE__ */ e(re, { name: "warning" }),
225
561
  " ",
226
- a
227
- ] }) : /* @__PURE__ */ e("p", { children: a })
562
+ l
563
+ ] }) : /* @__PURE__ */ e("p", { children: l })
228
564
  }
229
565
  );
230
566
  }
231
- function me({ kind: l, message: n, action: a, onDismiss: c, dismissLabel: s = "Dismiss" }) {
232
- return /* @__PURE__ */ i("div", { className: v("cms-toast", `cms-toast--${l}`), role: l === "error" ? "alert" : "status", children: [
233
- /* @__PURE__ */ e(k, { name: l === "success" ? "check" : l === "error" ? "warning" : "info" }),
234
- /* @__PURE__ */ e("span", { className: "cms-toast__message", children: n }),
235
- a ? /* @__PURE__ */ e($, { className: "cms-toast__action", onClick: a.onAction, children: a.label }) : null,
236
- c ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": s, onClick: c, children: /* @__PURE__ */ e(k, { name: "close" }) }) : null
567
+ function qt({ kind: n, message: t, action: l, onDismiss: r, dismissLabel: s = "Dismiss" }) {
568
+ return /* @__PURE__ */ c("div", { className: H("cms-toast", `cms-toast--${n}`), role: n === "error" ? "alert" : "status", children: [
569
+ /* @__PURE__ */ e(re, { name: n === "success" ? "check" : n === "error" ? "warning" : "info" }),
570
+ /* @__PURE__ */ e("span", { className: "cms-toast__message", children: t }),
571
+ l ? /* @__PURE__ */ e(De, { className: "cms-toast__action", onClick: l.onAction, children: l.label }) : null,
572
+ r ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": s, onClick: r, children: /* @__PURE__ */ e(re, { name: "close" }) }) : null
237
573
  ] });
238
574
  }
239
- function ue({ children: l }) {
240
- return /* @__PURE__ */ e("div", { className: "cms-toast-region", children: l });
575
+ function Gt({ children: n }) {
576
+ return /* @__PURE__ */ e("div", { className: "cms-toast-region", children: n });
241
577
  }
242
- function U({ what: l, layout: n = "inline" }) {
243
- return /* @__PURE__ */ i("div", { className: v("cms-loading", `cms-loading--${n}`), role: "status", "aria-live": "polite", children: [
244
- /* @__PURE__ */ e(k, { name: "spinner" }),
245
- /* @__PURE__ */ e("span", { children: l })
578
+ function Un({ what: n, layout: t = "inline" }) {
579
+ return /* @__PURE__ */ c("div", { className: H("cms-loading", `cms-loading--${t}`), role: "status", "aria-live": "polite", children: [
580
+ /* @__PURE__ */ e(re, { name: "spinner" }),
581
+ /* @__PURE__ */ e("span", { children: n })
246
582
  ] });
247
583
  }
248
- function W({ title: l, hint: n, action: a }) {
249
- return /* @__PURE__ */ i("div", { className: "cms-empty", children: [
250
- /* @__PURE__ */ e("p", { className: "cms-empty__title", children: l }),
251
- n != null ? /* @__PURE__ */ e("p", { className: "cms-empty__hint", children: n }) : null,
252
- a != null ? /* @__PURE__ */ e("div", { className: "cms-empty__action", children: a }) : null
584
+ function Kn({ title: n, hint: t, action: l }) {
585
+ return /* @__PURE__ */ c("div", { className: "cms-empty", children: [
586
+ /* @__PURE__ */ e("p", { className: "cms-empty__title", children: n }),
587
+ t != null ? /* @__PURE__ */ e("p", { className: "cms-empty__hint", children: t }) : null,
588
+ l != null ? /* @__PURE__ */ e("div", { className: "cms-empty__action", children: l }) : null
253
589
  ] });
254
590
  }
255
- function q({ message: l, onRetry: n, retryLabel: a = "Try again" }) {
256
- return /* @__PURE__ */ i("div", { className: "cms-error-banner", role: "alert", children: [
257
- /* @__PURE__ */ e(k, { name: "warning" }),
258
- /* @__PURE__ */ e("span", { className: "cms-error-banner__message", children: l }),
259
- n ? /* @__PURE__ */ e($, { onClick: n, children: a }) : null
591
+ function Wn({ message: n, onRetry: t, retryLabel: l = "Try again" }) {
592
+ return /* @__PURE__ */ c("div", { className: "cms-error-banner", role: "alert", children: [
593
+ /* @__PURE__ */ e(re, { name: "warning" }),
594
+ /* @__PURE__ */ e("span", { className: "cms-error-banner__message", children: n }),
595
+ t ? /* @__PURE__ */ e(De, { onClick: t, children: l }) : null
260
596
  ] });
261
597
  }
262
- function he({ title: l, scope: n, actions: a, backLink: c }) {
263
- return /* @__PURE__ */ i("header", { className: "cms-page-header", children: [
264
- c ? /* @__PURE__ */ i(
598
+ const Je = 300;
599
+ function Zn() {
600
+ if (typeof window > "u" || typeof getComputedStyle != "function") return Je;
601
+ const n = getComputedStyle(document.documentElement).getPropertyValue("--cms-state-delay").trim(), t = n.endsWith("ms") ? Number.parseFloat(n) : n.endsWith("s") ? Number.parseFloat(n) * 1e3 : Number.NaN;
602
+ return Number.isFinite(t) && t >= 0 ? t : Je;
603
+ }
604
+ function Vn() {
605
+ return /* @__PURE__ */ c("svg", { className: "cms-state__spinner", viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: [
606
+ /* @__PURE__ */ e("circle", { className: "cms-state__track", cx: "12", cy: "12", r: "10", fill: "none" }),
607
+ /* @__PURE__ */ e("circle", { className: "cms-state__arc", cx: "12", cy: "12", r: "10", fill: "none", pathLength: "100", strokeDasharray: "28 72" })
608
+ ] });
609
+ }
610
+ function Le({ kind: n, title: t, description: l, action: r, placement: s = "block", icon: a }) {
611
+ const [h, d] = D(n !== "loading");
612
+ return ee(() => {
613
+ if (n !== "loading") {
614
+ d(!0);
615
+ return;
616
+ }
617
+ d(!1);
618
+ const m = window.setTimeout(() => d(!0), Zn());
619
+ return () => window.clearTimeout(m);
620
+ }, [n]), /* @__PURE__ */ c(
621
+ "div",
622
+ {
623
+ className: H("cms-state", `cms-state--${n}`, `cms-state--${s}`, !h && "is-waiting"),
624
+ role: "status",
625
+ "aria-live": "polite",
626
+ "data-kind": n,
627
+ children: [
628
+ n === "loading" ? /* @__PURE__ */ e(Vn, {}) : null,
629
+ n === "error" || n === "denied" ? /* @__PURE__ */ e(re, { name: n === "error" ? "warning" : "lock" }) : null,
630
+ n === "empty" && a !== void 0 && Ue(a) !== null ? /* @__PURE__ */ e("span", { className: "cms-state__icon", "aria-hidden": "true", children: /* @__PURE__ */ e(Fn, { name: a, size: s === "page" ? 32 : 24 }) }) : null,
631
+ /* @__PURE__ */ c("span", { className: "cms-state__text", children: [
632
+ /* @__PURE__ */ e("span", { className: "cms-state__title", children: t }),
633
+ l !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-state__description", children: l }) : null
634
+ ] }),
635
+ r !== void 0 && n !== "denied" ? /* @__PURE__ */ e(De, { className: "cms-state__action", onClick: r.onAction, children: r.label }) : null
636
+ ]
637
+ }
638
+ );
639
+ }
640
+ const qn = 'input, select, textarea, button:not([disabled]), iframe, [href], [tabindex]:not([tabindex="-1"])', Gn = 60;
641
+ function jn(n) {
642
+ return n instanceof Element && n.closest('input, select, textarea, [contenteditable="true"], [data-viewer-keys]') !== null;
643
+ }
644
+ function Yn(n) {
645
+ return n instanceof Element && n.closest("[data-viewer-gestures]") !== null;
646
+ }
647
+ function Xn(n) {
648
+ return n.getClientRects().length > 0;
649
+ }
650
+ function jt(n) {
651
+ const { name: t, badge: l, closeLabel: r, onClose: s, actions: a = [], moreLabel: h = "More", edit: d, editing: m, state: b, siblings: i, bar: g, thumbnails: f, strip: v, onZoom: u, children: y } = n, S = P(null), T = P(null), M = fe(), [E, _] = D(!1), N = P(null);
652
+ ee(() => {
653
+ var U;
654
+ const k = document.activeElement, F = document.body.style.overflow;
655
+ return document.body.style.overflow = "hidden", (U = T.current) == null || U.focus(), () => {
656
+ var Y;
657
+ document.body.style.overflow = F, (Y = k == null ? void 0 : k.focus) == null || Y.call(k);
658
+ };
659
+ }, []);
660
+ const I = () => {
661
+ m != null && m.dirty ? m.onDirtyClose() : s();
662
+ }, K = (k) => {
663
+ const F = k.touches.length === 1 ? k.touches[0] : void 0;
664
+ N.current = F === void 0 || m !== void 0 || Yn(k.target) ? null : { x: F.clientX, y: F.clientY };
665
+ }, z = (k) => {
666
+ var W, j;
667
+ const F = N.current, U = k.changedTouches[0];
668
+ if (N.current = null, F === null || U === void 0) return;
669
+ const Y = U.clientX - F.x;
670
+ Math.abs(Y) < Gn || Math.abs(Y) < Math.abs(U.clientY - F.y) || (Y > 0 ? (W = i == null ? void 0 : i.onPrevious) == null || W.call(i) : (j = i == null ? void 0 : i.onNext) == null || j.call(i));
671
+ };
672
+ return ln(
673
+ /* @__PURE__ */ c(
674
+ "div",
675
+ {
676
+ ref: S,
677
+ className: H("cms-viewer", m !== void 0 && "is-editing"),
678
+ role: "dialog",
679
+ "aria-modal": "true",
680
+ "aria-labelledby": M,
681
+ tabIndex: -1,
682
+ onKeyDown: (k) => {
683
+ var F, U, Y;
684
+ if (k.key === "Escape") {
685
+ if (m !== void 0) return;
686
+ k.stopPropagation(), E ? _(!1) : s();
687
+ } else if (k.key === "Tab") {
688
+ const W = Array.from(((F = S.current) == null ? void 0 : F.querySelectorAll(qn)) ?? []).filter(Xn);
689
+ if (W.length === 0) return;
690
+ const j = W[0], X = W[W.length - 1];
691
+ k.shiftKey && document.activeElement === j ? (k.preventDefault(), X.focus()) : !k.shiftKey && document.activeElement === X && (k.preventDefault(), j.focus());
692
+ } else m === void 0 && !jn(k.target) && !k.ctrlKey && !k.metaKey && !k.altKey && (k.key === "ArrowLeft" ? (U = i == null ? void 0 : i.onPrevious) == null || U.call(i) : k.key === "ArrowRight" ? (Y = i == null ? void 0 : i.onNext) == null || Y.call(i) : k.key === "+" || k.key === "=" ? u == null || u("in") : k.key === "-" ? u == null || u("out") : k.key === "0" && (u == null || u("reset")));
693
+ },
694
+ children: [
695
+ i !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-visually-hidden", role: "status", children: `${t}, ${i.position}` }) : null,
696
+ /* @__PURE__ */ c("header", { className: "cms-viewer__top", children: [
697
+ /* @__PURE__ */ e("button", { ref: T, type: "button", className: "cms-viewer__icon", "aria-label": r, onClick: I, children: /* @__PURE__ */ e(re, { name: "close" }) }),
698
+ /* @__PURE__ */ e("span", { className: "cms-viewer__badge", children: l }),
699
+ /* @__PURE__ */ e("h2", { className: "cms-viewer__name", id: M, title: t, children: t }),
700
+ i !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-viewer__position", children: i.position }) : null,
701
+ /* @__PURE__ */ e("span", { className: "cms-viewer__space" }),
702
+ m !== void 0 ? /* @__PURE__ */ c($, { children: [
703
+ /* @__PURE__ */ e("span", { className: "cms-viewer__status", role: "status", children: m.status }),
704
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__button cms-viewer__button--edit", onClick: m.onDone, children: m.doneLabel })
705
+ ] }) : /* @__PURE__ */ c($, { children: [
706
+ /* @__PURE__ */ e("span", { className: "cms-viewer__actions", children: a.map((k) => /* @__PURE__ */ c("button", { type: "button", className: "cms-viewer__button", onClick: k.onSelect, children: [
707
+ k.icon,
708
+ k.label
709
+ ] }, k.label)) }),
710
+ d !== void 0 ? /* @__PURE__ */ c("button", { type: "button", className: "cms-viewer__button cms-viewer__button--edit", "aria-label": d.label, onClick: d.onEdit, children: [
711
+ d.icon,
712
+ /* @__PURE__ */ e("span", { className: "cms-viewer__wide", children: d.label })
713
+ ] }) : null,
714
+ a.length > 0 ? /* @__PURE__ */ c("span", { className: "cms-viewer__more", children: [
715
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__icon", "aria-label": h, "aria-expanded": E, onClick: () => _((k) => !k), children: /* @__PURE__ */ e(B, { name: "more" }) }),
716
+ E ? /* @__PURE__ */ e("span", { className: "cms-viewer__menu", children: a.map((k) => /* @__PURE__ */ c(
717
+ "button",
718
+ {
719
+ type: "button",
720
+ className: "cms-viewer__button",
721
+ onClick: () => {
722
+ _(!1), k.onSelect();
723
+ },
724
+ children: [
725
+ k.icon,
726
+ k.label
727
+ ]
728
+ },
729
+ k.label
730
+ )) }) : null
731
+ ] }) : null
732
+ ] })
733
+ ] }),
734
+ /* @__PURE__ */ c("div", { className: "cms-viewer__body", children: [
735
+ f != null && m === void 0 ? /* @__PURE__ */ e("nav", { className: "cms-viewer__thumbnails", children: f }) : null,
736
+ /* @__PURE__ */ c("div", { className: "cms-viewer__content", onTouchStart: K, onTouchEnd: z, children: [
737
+ (m == null ? void 0 : m.conflict) !== void 0 ? /* @__PURE__ */ c("div", { className: "cms-viewer__conflict", role: "alert", children: [
738
+ /* @__PURE__ */ e("p", { className: "cms-viewer__conflict-text", children: m.conflict.message }),
739
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__button", onClick: m.conflict.onOverwrite, children: m.conflict.overwriteLabel }),
740
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__button cms-viewer__button--edit", onClick: m.conflict.onKeepBoth, children: m.conflict.keepBothLabel })
741
+ ] }) : null,
742
+ b === void 0 ? y : /* @__PURE__ */ e(Jn, { state: b }),
743
+ m === void 0 && (i != null && i.onPrevious) ? /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__side cms-viewer__side--previous", "aria-label": i.previousLabel, title: i.previousLabel, onClick: i.onPrevious, children: /* @__PURE__ */ e(re, { name: "back" }) }) : null,
744
+ m === void 0 && (i != null && i.onNext) ? /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__side cms-viewer__side--next", "aria-label": i.nextLabel, title: i.nextLabel, onClick: i.onNext, children: /* @__PURE__ */ e(re, { name: "back" }) }) : null,
745
+ m === void 0 && i !== void 0 ? /* @__PURE__ */ e("div", { className: "cms-viewer__dots", "aria-hidden": "true", children: Array.from({ length: Math.min(i.total, 7) }, (k, F) => /* @__PURE__ */ e("i", { className: F === Math.min(i.index, 6) ? "is-current" : void 0 }, F)) }) : null
746
+ ] })
747
+ ] }),
748
+ m === void 0 && v != null ? /* @__PURE__ */ e("div", { className: "cms-viewer__strip", children: v }) : null,
749
+ g != null ? /* @__PURE__ */ e("footer", { className: "cms-viewer__bar", children: g }) : null
750
+ ]
751
+ }
752
+ ),
753
+ document.body
754
+ );
755
+ }
756
+ function Jn({ state: n }) {
757
+ switch (n.kind) {
758
+ case "loading":
759
+ return /* @__PURE__ */ e(Le, { kind: "loading", title: n.title, placement: "page" });
760
+ case "error":
761
+ return /* @__PURE__ */ e(
762
+ Le,
763
+ {
764
+ kind: "error",
765
+ title: n.title,
766
+ ...n.description === void 0 ? {} : { description: n.description },
767
+ ...n.retry === void 0 ? {} : { action: { label: n.retry.label, onAction: n.retry.onRetry } },
768
+ placement: "page"
769
+ }
770
+ );
771
+ case "no-preview":
772
+ return /* @__PURE__ */ e(
773
+ Le,
774
+ {
775
+ kind: "empty",
776
+ title: n.title,
777
+ ...n.description === void 0 ? {} : { description: n.description },
778
+ action: { label: n.download.label, onAction: n.download.onDownload },
779
+ placement: "page"
780
+ }
781
+ );
782
+ }
783
+ }
784
+ class Qn extends Error {
785
+ constructor(t = "denied") {
786
+ super(t), this.name = "FilePickerDenied";
787
+ }
788
+ }
789
+ class et extends Error {
790
+ constructor(t = "restart") {
791
+ super(t), this.name = "FilePickerRestart";
792
+ }
793
+ }
794
+ const Xe = (n, t) => `${n}
795
+ ${t}`, nt = (n, t) => n === "" ? t : `${n}/${t}`, tt = 48;
796
+ function Yt(n) {
797
+ var te, we;
798
+ const { open: t, spaces: l, list: r, disabledReason: s, budget: a, formatSize: h, labels: d, onConfirm: m, onCancel: b } = n, [i, g] = D(((te = l[0]) == null ? void 0 : te.id) ?? ""), [f, v] = D(""), [u, y] = D({ status: "loading" }), [S, T] = D(0), [M, E] = D(/* @__PURE__ */ new Map()), [_, N] = D(0), [I, K] = D(!1), z = P(null), k = P(!1);
799
+ ee(() => {
800
+ k.current = !1;
801
+ }, [t, i, f]);
802
+ const F = fe();
803
+ ee(() => {
804
+ var w;
805
+ t && (g(((w = l[0]) == null ? void 0 : w.id) ?? ""), v(""), E(/* @__PURE__ */ new Map()), K(!1));
806
+ }, [t]), ee(() => {
807
+ if (!t || i === "") return;
808
+ let w = !0;
809
+ return y({ status: "loading" }), N(0), r(i, f).then(
810
+ (C) => w && y({ status: "ready", entries: C.entries, next: C.next ?? null, paging: !1 }),
811
+ (C) => w && y({ status: C instanceof Qn ? "denied" : "error" })
812
+ ), () => {
813
+ w = !1;
814
+ };
815
+ }, [t, i, f, r, S]);
816
+ const U = Ie(() => {
817
+ if (u.status !== "ready" || u.next === null || u.paging) return;
818
+ const w = u.next, C = u.entries;
819
+ y({ ...u, paging: !0 }), r(i, f, w).then(
820
+ (Z) => {
821
+ k.current = !1, y({ status: "ready", entries: [...C, ...Z.entries], next: Z.next ?? null, paging: !1 });
822
+ },
823
+ (Z) => {
824
+ if (!(Z instanceof et)) {
825
+ y({ status: "ready", entries: C, next: w, paging: !1 });
826
+ return;
827
+ }
828
+ if (k.current) {
829
+ y({ status: "error" });
830
+ return;
831
+ }
832
+ k.current = !0, T((G) => G + 1);
833
+ }
834
+ );
835
+ }, [u, r, i, f]), Y = Ie((w) => {
836
+ var C;
837
+ return ((C = a == null ? void 0 : a.cost) == null ? void 0 : C.call(a, w)) ?? w.size ?? 0;
838
+ }, [a]), W = Ln(() => [...M.values()], [M]), j = W.reduce((w, C) => w + (C.size ?? 0), 0), X = a === void 0 ? null : a.limitBytes - a.usedBytes - W.reduce((w, C) => w + Y(C), 0), ne = X !== null && X < 0, ce = (w) => {
839
+ if (w.kind !== "file") return null;
840
+ const C = s == null ? void 0 : s(w);
841
+ return C || (X !== null && !M.has(Xe(i, w.id)) && Y(w) > X ? d.overBudget : null);
842
+ }, _e = (w) => {
843
+ const C = Xe(i, w.id);
844
+ !M.has(C) && ce(w) !== null || E((Z) => {
845
+ const G = new Map(Z);
846
+ return G.has(C) ? G.delete(C) : G.set(C, { ...w, space: i, path: f }), G;
847
+ });
848
+ }, oe = (w) => v(nt(f, w.name)), ue = () => v(f.includes("/") ? f.slice(0, f.lastIndexOf("/")) : ""), Ce = (w) => E((C) => {
849
+ const Z = new Map(C);
850
+ return Z.delete(w), Z;
851
+ }), pe = u.status === "ready" ? u.entries : [], le = (w) => {
852
+ const C = pe[_];
853
+ if (w.key === "ArrowDown" || w.key === "ArrowUp" || w.key === "Home" || w.key === "End") {
854
+ w.preventDefault();
855
+ const Z = pe.length - 1, G = w.key === "Home" ? 0 : w.key === "End" ? Z : Math.min(Z, Math.max(0, _ + (w.key === "ArrowDown" ? 1 : -1)));
856
+ N(G), G >= Z - 1 && U();
857
+ } else w.key === "Enter" && (C == null ? void 0 : C.kind) === "folder" ? (w.preventDefault(), oe(C)) : w.key === " " && (C == null ? void 0 : C.kind) === "file" ? (w.preventDefault(), _e(C)) : w.key === "Backspace" && f !== "" && (w.preventDefault(), ue());
858
+ }, be = f === "" ? [] : f.split("/"), ve = ((we = l.find((w) => w.id === i)) == null ? void 0 : we.name) ?? "", ye = (w) => `${F}-entry-${String(w)}`;
859
+ return /* @__PURE__ */ c(
860
+ xn,
861
+ {
862
+ open: t,
863
+ title: d.title,
864
+ onClose: b,
865
+ closeLabel: d.close,
866
+ initialFocus: z,
867
+ className: "cms-file-picker",
868
+ footer: /* @__PURE__ */ c("div", { className: "cms-file-picker__foot", children: [
869
+ /* @__PURE__ */ c("div", { className: "cms-file-picker__summary", "aria-live": "polite", children: [
870
+ W.length > 0 ? /* @__PURE__ */ e("span", { children: d.total(W.length, h(j)) }) : null,
871
+ a !== void 0 && X !== null ? /* @__PURE__ */ e("span", { className: H(ne && "is-over"), children: ne ? d.overBudget : d.left(h(Math.max(0, X)), h(a.limitBytes)) }) : null
872
+ ] }),
873
+ /* @__PURE__ */ c("div", { className: "cms-file-picker__actions", children: [
874
+ /* @__PURE__ */ e(De, { variant: "secondary", onClick: b, children: d.cancel }),
875
+ /* @__PURE__ */ e(De, { variant: "primary", disabled: W.length === 0 || ne, onClick: () => m(W), children: d.confirm(W.length) })
876
+ ] })
877
+ ] }),
878
+ children: [
879
+ /* @__PURE__ */ c("div", { className: "cms-file-picker__top", children: [
880
+ l.length > 1 ? /* @__PURE__ */ c("label", { className: "cms-file-picker__space", children: [
881
+ /* @__PURE__ */ e("span", { className: "cms-visually-hidden", children: d.space }),
882
+ /* @__PURE__ */ e("select", { className: "cms-input cms-select", value: i, onChange: (w) => {
883
+ g(w.target.value), v("");
884
+ }, children: l.map((w) => /* @__PURE__ */ e("option", { value: w.id, children: w.name }, w.id)) })
885
+ ] }) : null,
886
+ /* @__PURE__ */ c("nav", { className: "cms-file-picker__path", "aria-label": d.path, children: [
887
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": d.up, disabled: f === "", onClick: ue, children: /* @__PURE__ */ e(B, { name: "chevron-left" }) }),
888
+ /* @__PURE__ */ c("ol", { children: [
889
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e("button", { type: "button", className: "cms-file-picker__crumb", "aria-current": f === "" ? "location" : void 0, onClick: () => v(""), children: ve }) }),
890
+ be.map((w, C) => {
891
+ const Z = be.slice(0, C + 1).join("/");
892
+ return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e("button", { type: "button", className: "cms-file-picker__crumb", "aria-current": Z === f ? "location" : void 0, onClick: () => v(Z), children: w }) }, Z);
893
+ })
894
+ ] })
895
+ ] }),
896
+ W.length > 0 ? /* @__PURE__ */ e("button", { type: "button", className: "cms-file-picker__chip", "aria-expanded": I, onClick: () => K((w) => !w), children: d.selected(W.length) }) : null
897
+ ] }),
898
+ I && W.length > 0 ? /* @__PURE__ */ c("div", { className: "cms-file-picker__chosen", children: [
899
+ /* @__PURE__ */ e("ul", { children: [...M.entries()].map(([w, C]) => /* @__PURE__ */ c("li", { children: [
900
+ /* @__PURE__ */ e("span", { className: "cms-file-picker__name", children: C.name }),
901
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": d.remove(C.name), onClick: () => Ce(w), children: /* @__PURE__ */ e(re, { name: "close" }) })
902
+ ] }, w)) }),
903
+ /* @__PURE__ */ e(De, { variant: "secondary", onClick: () => {
904
+ E(/* @__PURE__ */ new Map()), K(!1);
905
+ }, children: d.clear })
906
+ ] }) : null,
907
+ /* @__PURE__ */ c("div", { className: "cms-file-picker__list", onScroll: (w) => {
908
+ const C = w.currentTarget;
909
+ C.scrollTop + C.clientHeight >= C.scrollHeight - tt && U();
910
+ }, children: [
911
+ u.status === "loading" ? /* @__PURE__ */ e(Le, { kind: "loading", title: d.loading, placement: "block" }) : null,
912
+ u.status === "error" ? /* @__PURE__ */ e(Le, { kind: "error", title: d.error, placement: "block", action: { label: d.retry, onAction: () => {
913
+ k.current = !1, T((w) => w + 1);
914
+ } } }) : null,
915
+ u.status === "denied" ? /* @__PURE__ */ e(Le, { kind: "denied", title: d.denied, placement: "block" }) : null,
916
+ u.status === "ready" && pe.length === 0 ? /* @__PURE__ */ e(Le, { kind: "empty", title: d.empty, placement: "block" }) : null,
917
+ /* @__PURE__ */ c(
918
+ "div",
919
+ {
920
+ ref: z,
921
+ role: "listbox",
922
+ "aria-multiselectable": "true",
923
+ "aria-label": d.files,
924
+ "aria-activedescendant": pe.length > 0 ? ye(_) : void 0,
925
+ tabIndex: 0,
926
+ className: "cms-file-picker__entries",
927
+ hidden: u.status !== "ready" || pe.length === 0,
928
+ onKeyDown: le,
929
+ children: [
930
+ pe.map((w, C) => {
931
+ const Z = w.kind === "file" && M.has(Xe(i, w.id)), G = ce(w);
932
+ return /* @__PURE__ */ c(
933
+ "div",
934
+ {
935
+ id: ye(C),
936
+ role: "option",
937
+ "aria-selected": w.kind === "file" ? Z : void 0,
938
+ "aria-disabled": G !== null || void 0,
939
+ className: H("cms-file-picker__entry", C === _ && "is-active", Z && "is-ticked", G !== null && "is-disabled"),
940
+ onClick: () => {
941
+ N(C), w.kind === "folder" ? oe(w) : _e(w);
942
+ },
943
+ children: [
944
+ /* @__PURE__ */ e("span", { className: "cms-file-picker__tick", "aria-hidden": "true", children: Z ? /* @__PURE__ */ e(B, { name: "check" }) : null }),
945
+ /* @__PURE__ */ e(B, { name: w.kind === "folder" ? "folder" : "file" }),
946
+ /* @__PURE__ */ c("span", { className: "cms-file-picker__text", children: [
947
+ /* @__PURE__ */ e("span", { className: "cms-file-picker__name", children: w.name }),
948
+ G !== null ? /* @__PURE__ */ e("span", { className: "cms-file-picker__reason", children: G }) : null
949
+ ] }),
950
+ w.kind === "file" && w.size != null ? /* @__PURE__ */ e("span", { className: "cms-file-picker__size", children: h(w.size) }) : null
951
+ ]
952
+ },
953
+ w.id
954
+ );
955
+ }),
956
+ u.status === "ready" && u.paging ? /* @__PURE__ */ e("div", { className: "cms-file-picker__paging", children: /* @__PURE__ */ e(Le, { kind: "loading", title: d.loading, placement: "inline" }) }) : null
957
+ ]
958
+ }
959
+ )
960
+ ] })
961
+ ]
962
+ }
963
+ );
964
+ }
965
+ const Qe = 64;
966
+ function lt(n, t) {
967
+ for (let l = n instanceof Element ? n : null; l !== null; l = l.parentElement) {
968
+ if (l instanceof HTMLElement && l.scrollTop > 0) return !1;
969
+ if (l === t) return !0;
970
+ }
971
+ return t.scrollTop <= 0;
972
+ }
973
+ function st(n, t) {
974
+ const [l, r] = D(0), s = P(t);
975
+ return s.current = t, ee(() => {
976
+ const a = n.current;
977
+ if (a === null) return;
978
+ let h = null, d = 0;
979
+ const m = (g) => {
980
+ h = lt(g.target, a) && g.touches.length === 1 ? g.touches[0].clientY : null, d = 0;
981
+ }, b = (g) => {
982
+ if (h === null || s.current === null) return;
983
+ const f = g.touches[0].clientY - h;
984
+ if (f <= 0) {
985
+ h = null, r(0);
986
+ return;
987
+ }
988
+ g.cancelable && g.preventDefault(), d = Math.min(f * 0.6, Qe * 1.5), r(d);
989
+ }, i = () => {
990
+ var g;
991
+ h !== null && d >= Qe && ((g = s.current) == null || g.call(s)), h = null, d = 0, r(0);
992
+ };
993
+ return a.addEventListener("touchstart", m, { passive: !0 }), a.addEventListener("touchmove", b, { passive: !1 }), a.addEventListener("touchend", i), a.addEventListener("touchcancel", i), () => {
994
+ a.removeEventListener("touchstart", m), a.removeEventListener("touchmove", b), a.removeEventListener("touchend", i), a.removeEventListener("touchcancel", i);
995
+ };
996
+ }, [n]), l;
997
+ }
998
+ const Mn = In(null);
999
+ function rt() {
1000
+ return Dn(Mn);
1001
+ }
1002
+ function Xt({ label: n, rows: t, error: l, onRetry: r, loadingText: s = "Loading", emptyTitle: a = "Nothing here yet", emptyHint: h, selected: d, onOpen: m, onRowMenu: b }) {
1003
+ const i = P([]), g = rt();
1004
+ if (l != null) return /* @__PURE__ */ e(Wn, { message: l, onRetry: r });
1005
+ if (t === null) return /* @__PURE__ */ e(Un, { what: s, layout: "block" });
1006
+ if (t.length === 0) return /* @__PURE__ */ e(Kn, { title: a, hint: h });
1007
+ const f = (v, u, y) => {
1008
+ var S;
1009
+ if (v.key === "ArrowDown" || v.key === "ArrowUp")
1010
+ v.preventDefault(), (S = i.current[Math.min(t.length - 1, Math.max(0, u + (v.key === "ArrowDown" ? 1 : -1)))]) == null || S.focus();
1011
+ else if (v.key === "Enter")
1012
+ m == null || m(y);
1013
+ else if ((v.key === "ContextMenu" || v.shiftKey && v.key === "F10") && b) {
1014
+ v.preventDefault();
1015
+ const T = v.currentTarget.getBoundingClientRect();
1016
+ b(y, { x: T.left + 16, y: T.bottom });
1017
+ }
1018
+ };
1019
+ return /* @__PURE__ */ c($, { children: [
1020
+ g !== null && (g.distance > 0 || g.refreshing) ? /* @__PURE__ */ c("div", { className: "cms-list__pull", role: "status", style: { height: g.refreshing ? void 0 : g.distance }, "data-ready": g.distance >= Qe ? "" : void 0, children: [
1021
+ g.refreshing ? /* @__PURE__ */ e(re, { name: "spinner" }) : null,
1022
+ g.text != null ? /* @__PURE__ */ e("span", { className: "cms-list__pull-text", children: g.text }) : null
1023
+ ] }) : null,
1024
+ /* @__PURE__ */ e("ul", { className: "cms-list", role: "listbox", "aria-label": n, children: t.map((v, u) => {
1025
+ const y = v.id === d;
1026
+ return /* @__PURE__ */ c(
1027
+ "li",
1028
+ {
1029
+ ref: (S) => {
1030
+ i.current[u] = S;
1031
+ },
1032
+ role: "option",
1033
+ "aria-selected": y,
1034
+ tabIndex: y || d == null && u === 0 ? 0 : -1,
1035
+ className: H("cms-list__row", y && "is-selected"),
1036
+ onClick: () => m == null ? void 0 : m(v.id),
1037
+ onKeyDown: (S) => f(S, u, v.id),
1038
+ onContextMenu: b ? (S) => {
1039
+ S.preventDefault(), b(v.id, { x: S.clientX, y: S.clientY });
1040
+ } : void 0,
1041
+ children: [
1042
+ v.lead != null ? /* @__PURE__ */ e("span", { className: "cms-list__lead", children: v.lead }) : null,
1043
+ /* @__PURE__ */ c("span", { className: "cms-list__text", children: [
1044
+ /* @__PURE__ */ e("span", { className: H("cms-list__primary", v.unread === !0 && "is-unread"), children: v.primary }),
1045
+ v.secondary != null ? /* @__PURE__ */ e("span", { className: "cms-list__secondary", children: v.secondary }) : null
1046
+ ] }),
1047
+ v.meta != null || v.count !== void 0 ? /* @__PURE__ */ c("span", { className: "cms-list__end", children: [
1048
+ v.meta != null ? /* @__PURE__ */ e("span", { className: "cms-list__meta", children: v.meta }) : null,
1049
+ v.count !== void 0 && v.count > 0 ? /* @__PURE__ */ e("span", { className: "cms-badge cms-list__count", children: v.count }) : null
1050
+ ] }) : null
1051
+ ]
1052
+ },
1053
+ v.id
1054
+ );
1055
+ }) })
1056
+ ] });
1057
+ }
1058
+ function Ke({ at: n, items: t, onClose: l, label: r = "Actions", focus: s = "current" }) {
1059
+ const a = P(null), h = P(null), d = fe(), [m, b] = D(n), i = t.filter((u) => u.offer.offered);
1060
+ if ($e(() => {
1061
+ if (!n) return;
1062
+ const u = a.current, y = (u == null ? void 0 : u.offsetWidth) ?? 0, S = (u == null ? void 0 : u.offsetHeight) ?? 0;
1063
+ b({ x: Math.max(0, Math.min(n.x, window.innerWidth - y)), y: Math.max(0, Math.min(n.y, window.innerHeight - S)) });
1064
+ }, [n]), ee(() => {
1065
+ var T, M;
1066
+ if (!n) return;
1067
+ h.current = document.activeElement;
1068
+ const u = Array.from(((T = a.current) == null ? void 0 : T.querySelectorAll('[role^="menuitem"]:not([aria-disabled="true"])')) ?? []), y = s === "current" ? u.find((E) => E.getAttribute("aria-checked") === "true") : void 0;
1069
+ (M = s === "last" ? u[u.length - 1] : y ?? u[0]) == null || M.focus();
1070
+ const S = (E) => {
1071
+ var _;
1072
+ (_ = a.current) != null && _.contains(E.target) || l();
1073
+ };
1074
+ return document.addEventListener("mousedown", S), () => {
1075
+ var E, _;
1076
+ document.removeEventListener("mousedown", S), (_ = (E = h.current) == null ? void 0 : E.focus) == null || _.call(E);
1077
+ };
1078
+ }, [n, l, s]), !n || i.length === 0) return null;
1079
+ const g = (u) => {
1080
+ var T, M;
1081
+ const y = Array.from(((T = a.current) == null ? void 0 : T.querySelectorAll('[role^="menuitem"]')) ?? []), S = y.indexOf(document.activeElement);
1082
+ if (u.key === "Escape" || u.key === "Tab")
1083
+ u.preventDefault(), l();
1084
+ else if (u.key === "ArrowDown" || u.key === "ArrowUp") {
1085
+ u.preventDefault();
1086
+ const E = u.key === "ArrowDown" ? 1 : -1;
1087
+ (M = y[(S + E + y.length) % y.length]) == null || M.focus();
1088
+ }
1089
+ }, f = (u) => {
1090
+ const y = u.offer.refusal !== void 0;
1091
+ return /* @__PURE__ */ c(
1092
+ "div",
1093
+ {
1094
+ role: u.checked === void 0 ? "menuitem" : "menuitemradio",
1095
+ "aria-checked": u.checked,
1096
+ tabIndex: -1,
1097
+ "aria-disabled": y || void 0,
1098
+ "aria-describedby": y ? `${d}-${u.id}` : void 0,
1099
+ title: y ? u.offer.refusal : void 0,
1100
+ className: H("cms-menu__item", u.danger && "is-danger", u.offer.locked && "is-locked", y && "is-refused"),
1101
+ onClick: () => {
1102
+ y || (l(), u.onSelect());
1103
+ },
1104
+ onKeyDown: (S) => {
1105
+ (S.key === "Enter" || S.key === " ") && !y && (S.preventDefault(), l(), u.onSelect());
1106
+ },
1107
+ children: [
1108
+ u.checked !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-menu__check", children: u.checked ? /* @__PURE__ */ e(re, { name: "check" }) : null }) : null,
1109
+ u.offer.locked ? /* @__PURE__ */ e(re, { name: "lock" }) : null,
1110
+ /* @__PURE__ */ e("span", { className: "cms-menu__label", children: u.label }),
1111
+ y ? /* @__PURE__ */ e("span", { id: `${d}-${u.id}`, className: "cms-menu__refusal", children: u.offer.refusal }) : null
1112
+ ]
1113
+ },
1114
+ u.id
1115
+ );
1116
+ }, v = [];
1117
+ for (const u of i) {
1118
+ const y = v[v.length - 1];
1119
+ y !== void 0 && y.group === u.group ? y.items.push(u) : v.push({ group: u.group, items: [u] });
1120
+ }
1121
+ return ln(
1122
+ /* @__PURE__ */ e(
1123
+ "div",
1124
+ {
1125
+ ref: a,
1126
+ className: "cms-menu",
1127
+ role: "menu",
1128
+ "aria-label": r,
1129
+ style: { left: (m ?? n).x, top: (m ?? n).y },
1130
+ onKeyDown: g,
1131
+ onContextMenu: (u) => u.preventDefault(),
1132
+ children: v.map((u, y) => /* @__PURE__ */ c($n, { children: [
1133
+ y > 0 ? /* @__PURE__ */ e("div", { className: "cms-menu__separator", role: "separator" }) : null,
1134
+ u.group === void 0 ? u.items.map(f) : /* @__PURE__ */ c("div", { role: "group", "aria-label": u.group, children: [
1135
+ /* @__PURE__ */ e("div", { className: "cms-menu__group", "aria-hidden": "true", children: u.group }),
1136
+ u.items.map(f)
1137
+ ] })
1138
+ ] }, y))
1139
+ }
1140
+ ),
1141
+ document.body
1142
+ );
1143
+ }
1144
+ function an() {
1145
+ const [n, t] = D(/* @__PURE__ */ new Set()), [l, r] = D(null), s = P(null), a = P(null), h = (m) => t((b) => b.has(m) ? b : /* @__PURE__ */ new Set([...b, m])), d = (m) => t((b) => {
1146
+ if (!b.has(m)) return b;
1147
+ const i = new Set(b);
1148
+ return i.delete(m), i;
1149
+ });
1150
+ return ee(() => {
1151
+ if (l === null) return;
1152
+ const m = (b) => {
1153
+ b.key === "Escape" && h(l);
1154
+ };
1155
+ return window.addEventListener("keydown", m), () => window.removeEventListener("keydown", m);
1156
+ }, [l]), {
1157
+ dismissed: (m) => n.has(m),
1158
+ dismiss: h,
1159
+ show: d,
1160
+ pointerIn: (m) => {
1161
+ a.current = m, r(m);
1162
+ },
1163
+ pointerOut: (m) => {
1164
+ a.current === m && (a.current = null), r((b) => b === m ? null : b), s.current !== m && d(m);
1165
+ },
1166
+ focusIn: (m) => {
1167
+ s.current = m;
1168
+ },
1169
+ focusOut: (m) => {
1170
+ s.current === m && (s.current = null), a.current !== m && d(m);
1171
+ }
1172
+ };
1173
+ }
1174
+ function at(n, t, l) {
1175
+ return Math.min(Math.max(n - l / 2, 0), Math.max(0, t - l));
1176
+ }
1177
+ const _n = /* @__PURE__ */ new Set(), vn = { descriptionHidden: !1, elsewhereHidden: !1, titleCut: !1, titleFloor: 0, bare: _n, primaryBare: !1, hidden: _n, primaryHidden: !1, chipsCut: !1 }, gn = (n, t) => n.size === t.size && [...n].every((l) => t.has(l)), it = (n, t) => n.descriptionHidden === t.descriptionHidden && n.elsewhereHidden === t.elsewhereHidden && n.titleCut === t.titleCut && n.titleFloor === t.titleFloor && gn(n.bare, t.bare) && n.primaryBare === t.primaryBare && gn(n.hidden, t.hidden) && n.primaryHidden === t.primaryHidden && n.chipsCut === t.chipsCut, ct = 64, Ae = "primary";
1178
+ function Jt({ title: n, icon: t, description: l, meta: r = [], primary: s, secondary: a, more: h = [], moreLabel: d, context: m, fullWidth: b = !1 }) {
1179
+ var J, Ne, de;
1180
+ const [i, g] = D(null), [f, v] = D(vn), [u, y] = D(null), [S, T] = D(null), M = an(), E = P(null), _ = P(null), N = P(null), I = fe(), K = fe(), z = [
1181
+ ...(a ?? []).map((o) => ({
1182
+ id: o.id,
1183
+ label: o.label,
1184
+ name: o.label,
1185
+ icon: o.icon === void 0 ? null : Ue(o.icon),
1186
+ overflow: o.overflow,
1187
+ danger: o.danger === !0,
1188
+ offer: o.offer ?? { offered: !0, locked: !1 },
1189
+ run: o.onPress
1190
+ })),
1191
+ ...h.map((o) => ({
1192
+ id: o.id,
1193
+ label: o.label,
1194
+ name: typeof o.label == "string" ? o.label : o.id,
1195
+ icon: null,
1196
+ overflow: void 0,
1197
+ danger: o.danger === !0,
1198
+ offer: o.offer,
1199
+ run: o.onSelect
1200
+ }))
1201
+ ].filter((o) => o.offer.offered), k = z.filter((o) => o.overflow === 0), F = z.filter((o) => o.overflow !== 0), U = k.length === 1 ? k[0] ?? null : null, Y = ot(F), W = F.filter((o) => o.overflow === void 0).map((o) => o.id).reverse(), j = [...Y, ...W.map((o) => [o])], X = [...U !== null ? [[U.id]] : [], ...j], ne = s !== void 0 && ((J = s.offer) == null ? void 0 : J.offered) !== !1, ce = (Ne = s == null ? void 0 : s.offer) == null ? void 0 : Ne.refusal, _e = s !== void 0 && (((de = s.offer) == null ? void 0 : de.offered) === !1 || ce !== void 0), oe = s !== void 0 && "menu" in s ? s.menu.filter((o) => o.offer.offered) : [], ue = s !== void 0 && "menu" in s && oe.length > 0 ? s : null, Ce = r.filter((o) => o.elsewhere === !0), pe = JSON.stringify([
1202
+ n,
1203
+ t ?? null,
1204
+ l ?? null,
1205
+ r.map((o) => [o.id, o.text, o.elsewhere === !0]),
1206
+ ne ? [s.label, s.icon, ue !== null] : null,
1207
+ z.map((o) => [o.id, o.name, o.icon, o.overflow ?? null])
1208
+ ]), le = Ie(() => {
1209
+ const o = E.current, A = _.current;
1210
+ if (o === null || A === null) return;
1211
+ const x = getComputedStyle(o), O = parseFloat(x.columnGap || "0") || 0, se = o.clientWidth - (parseFloat(x.paddingLeft) || 0) - (parseFloat(x.paddingRight) || 0), Q = (ie) => {
1212
+ var Me;
1213
+ return ((Me = A.querySelector(ie)) == null ? void 0 : Me.getBoundingClientRect().width) ?? 0;
1214
+ }, ke = Q('[data-measure="title"]'), Fe = Math.min(ke, ct), He = (ie) => {
1215
+ const Me = be(ie), xe = [];
1216
+ t !== void 0 && xe.push(Q('[data-measure="lead"]')), xe.push(ie.titleCut ? Fe : ke), l !== void 0 && !ie.descriptionHidden && xe.push(Q('[data-measure="description"]'));
1217
+ for (const ge of r) ge.elsewhere === !0 && ie.elsewhereHidden || xe.push(Q(`[data-measure="meta"][data-measure-id="${CSS.escape(ge.id)}"]`));
1218
+ for (const ge of z) {
1219
+ if (Me.has(ge.id)) continue;
1220
+ const Ze = ie.bare.has(ge.id) && ge.icon !== null;
1221
+ xe.push(Q(`[data-measure="${Ze ? "icon" : "full"}"][data-measure-id="${CSS.escape(ge.id)}"]`));
1222
+ }
1223
+ return ne && !ie.primaryHidden && xe.push(Q(`[data-measure="${ie.primaryBare ? "primary-icon" : "primary"}"]`)), Me.size > 0 && xe.push(Q('[data-measure="more"]')), xe.reduce((ge, Ze) => ge + Ze, 0) + O * Math.max(0, xe.length - 1);
1224
+ };
1225
+ let q = { ...vn, titleFloor: Fe };
1226
+ const Re = (ie) => (q = ie, He(ie) <= se), mn = (() => {
1227
+ if (Re(q) || l !== void 0 && Re({ ...q, descriptionHidden: !0 }) || (q = { ...q, descriptionHidden: !0 }, Ce.length > 0 && Re({ ...q, elsewhereHidden: !0 }))) return q;
1228
+ q = { ...q, elsewhereHidden: !0 };
1229
+ const ie = /* @__PURE__ */ new Set();
1230
+ for (const Ve of X) {
1231
+ for (const Ge of Ve) ie.add(Ge);
1232
+ if (Re({ ...q, bare: new Set(ie) })) return q;
1233
+ }
1234
+ if (ne && Re({ ...q, primaryBare: !0 })) return q;
1235
+ q = { ...q, primaryBare: ne };
1236
+ const Me = /* @__PURE__ */ new Set(), xe = [...j, ...ne ? [[Ae]] : []], ge = () => Me.size + k.length >= 2, Ze = (Ve) => ({ ...q, hidden: new Set([...Ve].filter((Ge) => Ge !== Ae)), primaryHidden: Ve.has(Ae) }), hn = q;
1237
+ for (const Ve of xe) {
1238
+ for (const Ge of Ve) Me.add(Ge);
1239
+ if (ge() && Re(Ze(Me))) return q;
1240
+ q = hn;
1241
+ }
1242
+ const fn = ge() ? Ze(Me) : hn;
1243
+ return Re({ ...fn, titleCut: !0 }) ? q : { ...fn, titleCut: !0, chipsCut: !0 };
1244
+ })();
1245
+ v((ie) => it(ie, mn) ? ie : mn);
1246
+ }, [pe]);
1247
+ $e(le, [le]), ee(() => {
1248
+ const o = E.current;
1249
+ if (o === null || typeof ResizeObserver > "u") return;
1250
+ const A = new ResizeObserver(() => le());
1251
+ return A.observe(o), () => A.disconnect();
1252
+ }, [le]), ee(() => {
1253
+ const o = typeof document > "u" ? void 0 : document.fonts;
1254
+ if (o === void 0) return;
1255
+ let A = !0;
1256
+ const x = () => {
1257
+ A && le();
1258
+ };
1259
+ return o.ready.then(x), o.addEventListener("loadingdone", x), () => {
1260
+ A = !1, o.removeEventListener("loadingdone", x);
1261
+ };
1262
+ }, [le]);
1263
+ function be(o) {
1264
+ const A = o.hidden.size + (o.primaryHidden ? 1 : 0);
1265
+ return /* @__PURE__ */ new Set([...k.filter((x) => x !== U || A > 0).map((x) => x.id), ...o.hidden, ...o.primaryHidden ? [Ae] : []]);
1266
+ }
1267
+ const ve = be(f), ye = z.filter((o) => !ve.has(o.id) && o !== U), te = U !== null && !ve.has(U.id) ? U : null, we = ne && !f.primaryHidden, w = (o) => z.find((A) => A.id === o), C = j.flat().filter((o) => f.hidden.has(o)).map(w).filter((o) => o !== void 0), Z = (o) => ({ id: o.id, label: o.label, offer: o.offer, ...o.danger ? { danger: !0 } : {}, onSelect: o.run }), G = [
1268
+ ...ne && f.primaryHidden ? [{ id: Ae, label: s.label, offer: s.offer ?? { offered: !0, locked: !1 }, onSelect: () => {
1269
+ _e || s.onPress();
1270
+ } }, ...oe] : [],
1271
+ ...C.map(Z),
1272
+ ...ve.size > 0 ? k.map(Z) : []
1273
+ ], p = G.length > 0, L = [
1274
+ ...ye.map((o) => o.id),
1275
+ ...te !== null ? [te.id] : [],
1276
+ ...we ? [Ae, ...ue !== null ? ["primary-menu"] : []] : [],
1277
+ ...p ? ["more"] : []
1278
+ ], V = u !== null && L.includes(u) ? u : L[0] ?? null;
1279
+ ee(() => {
1280
+ var o, A;
1281
+ u === null || L.includes(u) || !p || ((o = E.current) != null && o.contains(document.activeElement) || document.activeElement === document.body) && (y("more"), (A = N.current) == null || A.focus());
1282
+ }, [f]);
1283
+ const me = (o) => `${K}-${o}`, ae = (o) => {
1284
+ var se;
1285
+ const A = L.indexOf(V ?? "");
1286
+ let x = null;
1287
+ if (o.key === "ArrowRight" ? x = Math.min(L.length - 1, A + 1) : o.key === "ArrowLeft" ? x = Math.max(0, A - 1) : o.key === "Home" ? x = 0 : o.key === "End" && (x = L.length - 1), x === null) return;
1288
+ o.preventDefault();
1289
+ const O = L[x] ?? null;
1290
+ y(O), O !== null && ((se = document.getElementById(me(O))) == null || se.focus());
1291
+ }, he = (o, A) => {
1292
+ const x = A.getBoundingClientRect();
1293
+ g((i == null ? void 0 : i.which) === o ? null : { which: o, x: x.left, y: x.bottom + 4 });
1294
+ }, Se = (o) => ({ id: me(o), tabIndex: V === o ? 0 : -1, onFocus: () => y(o) }), We = (o, A, x) => A ? {
1295
+ ...S === o ? { "data-reason-shown": "" } : {},
1296
+ ...M.dismissed(o) ? { "data-tip-dismissed": "" } : {},
1297
+ onFocus: (O) => {
1298
+ y(o), M.focusIn(o), Te(O.currentTarget, x);
1299
+ },
1300
+ onBlur: () => {
1301
+ T((O) => O === o ? null : O), M.focusOut(o);
1302
+ },
1303
+ onMouseEnter: (O) => {
1304
+ M.pointerIn(o), Te(O.currentTarget, x);
1305
+ },
1306
+ onMouseLeave: () => M.pointerOut(o),
1307
+ onKeyDown: (O) => {
1308
+ O.key === "Escape" && (T((se) => se === o ? null : se), M.dismiss(o));
1309
+ }
1310
+ } : {}, Be = (o, A, x) => {
1311
+ T(o), M.show(o), Te(A, x);
1312
+ }, Te = (o, A) => {
1313
+ const x = document.getElementById(A), O = E.current;
1314
+ if (x === null || O === null) return;
1315
+ const se = x.style.display;
1316
+ x.style.display = "block";
1317
+ const Q = x.offsetWidth;
1318
+ x.style.display = se;
1319
+ const ke = O.getBoundingClientRect(), Fe = o.getBoundingClientRect();
1320
+ x.style.left = `${String(at(Fe.left + Fe.width / 2 - ke.left, ke.width, Q))}px`, x.style.right = "auto";
1321
+ }, Ee = (o, A, x) => /* @__PURE__ */ c("span", { id: o, className: "cms-section-header__tip", role: "tooltip", children: [
1322
+ x !== null ? /* @__PURE__ */ c("span", { "aria-hidden": "true", children: [
1323
+ x,
1324
+ ": "
1325
+ ] }) : null,
1326
+ A
1327
+ ] }), R = (o) => {
1328
+ const A = f.bare.has(o.id) && o.icon !== null, x = o.offer.refusal, O = `${K}-reason-${o.id}`;
1329
+ return /* @__PURE__ */ c(
1330
+ "button",
1331
+ {
1332
+ type: "button",
1333
+ className: H("cms-button", "cms-button--quiet", "cms-section-header__secondary", A && "cms-section-header__secondary--bare", o.danger && "is-danger"),
1334
+ "data-action": o.id,
1335
+ "aria-label": A || x !== void 0 ? o.name : void 0,
1336
+ "aria-disabled": x !== void 0 ? "true" : void 0,
1337
+ "aria-describedby": x !== void 0 ? O : void 0,
1338
+ title: x === void 0 && A ? o.name : void 0,
1339
+ ...Se(o.id),
1340
+ ...We(o.id, x !== void 0, O),
1341
+ onClick: (se) => {
1342
+ x === void 0 ? o.run() : Be(o.id, se.currentTarget, O);
1343
+ },
1344
+ children: [
1345
+ o.icon !== null ? /* @__PURE__ */ e(B, { name: o.icon, size: 18 }) : null,
1346
+ A ? null : /* @__PURE__ */ e("span", { className: "cms-section-header__label", children: o.label }),
1347
+ x !== void 0 ? Ee(O, x, A ? o.name : null) : null
1348
+ ]
1349
+ },
1350
+ o.id
1351
+ );
1352
+ };
1353
+ return /* @__PURE__ */ c("header", { className: H("cms-section-header", b && "cms-section-header--full"), children: [
1354
+ /* @__PURE__ */ c("div", { ref: E, className: H("cms-section-header__row", f.chipsCut && "cms-section-header__row--chips-cut"), "data-row": "1", children: [
1355
+ t !== void 0 ? /* @__PURE__ */ e(B, { name: t }) : null,
1356
+ /* @__PURE__ */ e(
1357
+ "h1",
1358
+ {
1359
+ className: "cms-section-header__title",
1360
+ title: n,
1361
+ style: { minWidth: f.titleCut ? `${f.titleFloor}px` : "max-content" },
1362
+ children: n
1363
+ }
1364
+ ),
1365
+ l !== void 0 ? /* @__PURE__ */ e("span", { className: H("cms-section-header__description", f.descriptionHidden && "cms-visually-hidden"), children: l }) : null,
1366
+ r.map((o, A) => /* @__PURE__ */ e(
1367
+ "span",
1368
+ {
1369
+ className: "cms-section-header__meta",
1370
+ "data-meta": o.id,
1371
+ hidden: o.elsewhere === !0 && f.elsewhereHidden,
1372
+ style: f.chipsCut && o.elsewhere !== !0 ? { flexShrink: A + 1 } : void 0,
1373
+ ...f.chipsCut && o.elsewhere !== !0 ? { title: o.text, "aria-label": o.text } : {},
1374
+ children: o.content
1375
+ },
1376
+ o.id
1377
+ )),
1378
+ /* @__PURE__ */ c("div", { className: "cms-section-header__actions", role: "toolbar", "aria-label": n, onKeyDown: ae, children: [
1379
+ ye.map(R),
1380
+ te !== null ? R(te) : null,
1381
+ we ? /* @__PURE__ */ c("span", { className: H("cms-section-header__primary", ue !== null && "cms-section-header__primary--split"), children: [
1382
+ /* @__PURE__ */ c(
1383
+ "button",
1384
+ {
1385
+ type: "button",
1386
+ className: H("cms-button", "cms-button--primary", f.primaryBare && "cms-section-header__primary--bare"),
1387
+ "data-action": "primary",
1388
+ "aria-label": f.primaryBare ? s.label : void 0,
1389
+ "aria-disabled": _e ? "true" : void 0,
1390
+ "aria-describedby": ce !== void 0 ? I : void 0,
1391
+ title: f.primaryBare && ce === void 0 ? s.label : void 0,
1392
+ ...Se(Ae),
1393
+ ...We(Ae, ce !== void 0, I),
1394
+ onClick: (o) => {
1395
+ _e ? ce !== void 0 && Be(Ae, o.currentTarget, I) : s.onPress();
1396
+ },
1397
+ children: [
1398
+ /* @__PURE__ */ e(B, { name: s.icon }),
1399
+ f.primaryBare ? null : /* @__PURE__ */ c($, { children: [
1400
+ " ",
1401
+ /* @__PURE__ */ e("span", { children: s.label })
1402
+ ] })
1403
+ ]
1404
+ }
1405
+ ),
1406
+ ue !== null ? /* @__PURE__ */ e(
1407
+ "button",
1408
+ {
1409
+ type: "button",
1410
+ className: "cms-button cms-button--primary cms-section-header__split",
1411
+ "data-action": "primary-menu",
1412
+ "aria-haspopup": "menu",
1413
+ "aria-expanded": (i == null ? void 0 : i.which) === "primary",
1414
+ "aria-label": ue.menuLabel,
1415
+ ...Se("primary-menu"),
1416
+ onClick: (o) => he("primary", o.currentTarget),
1417
+ children: /* @__PURE__ */ e(B, { name: "chevron-down" })
1418
+ }
1419
+ ) : null,
1420
+ ce !== void 0 ? Ee(I, ce, f.primaryBare ? s.label : null) : null
1421
+ ] }) : null,
1422
+ p ? /* @__PURE__ */ e(
1423
+ "button",
1424
+ {
1425
+ ref: N,
1426
+ type: "button",
1427
+ className: "cms-section-header__more",
1428
+ "data-action": "more",
1429
+ "aria-haspopup": "menu",
1430
+ "aria-expanded": (i == null ? void 0 : i.which) === "more",
1431
+ "aria-label": d,
1432
+ title: d,
1433
+ ...Se("more"),
1434
+ onClick: (o) => he("more", o.currentTarget),
1435
+ children: /* @__PURE__ */ e(B, { name: "more" })
1436
+ }
1437
+ ) : null
1438
+ ] }),
1439
+ /* @__PURE__ */ c("div", { ref: _, className: "cms-section-header__measure", "aria-hidden": "true", children: [
1440
+ t !== void 0 ? /* @__PURE__ */ e("span", { "data-measure": "lead", children: /* @__PURE__ */ e(B, { name: t }) }) : null,
1441
+ /* @__PURE__ */ e("span", { "data-measure": "title", className: "cms-section-header__title", children: n }),
1442
+ l !== void 0 ? /* @__PURE__ */ e("span", { "data-measure": "description", className: "cms-section-header__description", children: l }) : null,
1443
+ r.map((o) => /* @__PURE__ */ e("span", { "data-measure": "meta", "data-measure-id": o.id, className: "cms-section-header__meta", children: o.content }, o.id)),
1444
+ z.map((o) => /* @__PURE__ */ c("span", { children: [
1445
+ /* @__PURE__ */ c("span", { "data-measure": "full", "data-measure-id": o.id, className: "cms-button cms-button--quiet cms-section-header__secondary", children: [
1446
+ o.icon !== null ? /* @__PURE__ */ e(B, { name: o.icon, size: 18 }) : null,
1447
+ /* @__PURE__ */ e("span", { className: "cms-section-header__label", children: o.label })
1448
+ ] }),
1449
+ /* @__PURE__ */ e("span", { "data-measure": "icon", "data-measure-id": o.id, className: "cms-button cms-button--quiet cms-section-header__secondary cms-section-header__secondary--bare", children: o.icon !== null ? /* @__PURE__ */ e(B, { name: o.icon, size: 18 }) : null })
1450
+ ] }, o.id)),
1451
+ ne ? /* @__PURE__ */ c($, { children: [
1452
+ /* @__PURE__ */ c("span", { "data-measure": "primary", className: "cms-section-header__primary", children: [
1453
+ /* @__PURE__ */ c("span", { className: "cms-button cms-button--primary", children: [
1454
+ /* @__PURE__ */ e(B, { name: s.icon }),
1455
+ " ",
1456
+ /* @__PURE__ */ e("span", { children: s.label })
1457
+ ] }),
1458
+ ue !== null ? /* @__PURE__ */ e("span", { className: "cms-button cms-button--primary cms-section-header__split", children: /* @__PURE__ */ e(B, { name: "chevron-down" }) }) : null
1459
+ ] }),
1460
+ /* @__PURE__ */ c("span", { "data-measure": "primary-icon", className: "cms-section-header__primary", children: [
1461
+ /* @__PURE__ */ e("span", { className: "cms-button cms-button--primary cms-section-header__primary--bare", children: /* @__PURE__ */ e(B, { name: s.icon }) }),
1462
+ ue !== null ? /* @__PURE__ */ e("span", { className: "cms-button cms-button--primary cms-section-header__split", children: /* @__PURE__ */ e(B, { name: "chevron-down" }) }) : null
1463
+ ] })
1464
+ ] }) : null,
1465
+ /* @__PURE__ */ e("span", { "data-measure": "more", className: "cms-section-header__more", children: /* @__PURE__ */ e(B, { name: "more" }) })
1466
+ ] })
1467
+ ] }),
1468
+ m != null ? /* @__PURE__ */ e("div", { className: "cms-section-header__context", "data-row": "2", children: m }) : null,
1469
+ ue !== null ? /* @__PURE__ */ e(Ke, { at: (i == null ? void 0 : i.which) === "primary" ? i : null, items: oe, onClose: () => g(null), label: ue.menuLabel }) : null,
1470
+ /* @__PURE__ */ e(Ke, { at: (i == null ? void 0 : i.which) === "more" ? i : null, items: G, onClose: () => g(null), label: d })
1471
+ ] });
1472
+ }
1473
+ function ot(n) {
1474
+ const t = /* @__PURE__ */ new Map();
1475
+ for (const l of n) l.overflow !== void 0 && l.overflow !== 0 && t.set(l.overflow, [...t.get(l.overflow) ?? [], l.id]);
1476
+ return [...t.entries()].sort(([l], [r]) => l - r).map(([, l]) => l);
1477
+ }
1478
+ function Qt({ head: n, children: t, className: l, scrollRef: r, onScroll: s, bodyProps: a }) {
1479
+ return /* @__PURE__ */ c("div", { className: H("cms-column", l), children: [
1480
+ n == null ? null : /* @__PURE__ */ e("div", { className: "cms-column__head", children: n }),
1481
+ /* @__PURE__ */ e("div", { ...a, className: H("cms-column__body", a == null ? void 0 : a.className), ref: r, onScroll: s, children: t })
1482
+ ] });
1483
+ }
1484
+ function el({ title: n, scope: t, actions: l, backLink: r }) {
1485
+ return /* @__PURE__ */ c("header", { className: "cms-page-header", children: [
1486
+ r ? /* @__PURE__ */ c(
265
1487
  "a",
266
1488
  {
267
1489
  className: "cms-page-header__back",
268
- href: c.href ?? "#",
1490
+ href: r.href ?? "#",
269
1491
  onClick: (s) => {
270
- c.onBack && (s.preventDefault(), c.onBack());
1492
+ r.onBack && (s.preventDefault(), r.onBack());
271
1493
  },
272
1494
  children: [
273
- /* @__PURE__ */ e(k, { name: "back" }),
1495
+ /* @__PURE__ */ e(re, { name: "back" }),
274
1496
  " ",
275
- c.label
1497
+ r.label
276
1498
  ]
277
1499
  }
278
1500
  ) : null,
279
- /* @__PURE__ */ i("div", { className: "cms-page-header__row", children: [
280
- /* @__PURE__ */ i("div", { className: "cms-page-header__titles", children: [
281
- /* @__PURE__ */ e("h1", { className: "cms-page-header__title", children: l }),
282
- n != null ? /* @__PURE__ */ e("p", { className: "cms-page-header__scope", children: n }) : null
1501
+ /* @__PURE__ */ c("div", { className: "cms-page-header__row", children: [
1502
+ /* @__PURE__ */ c("div", { className: "cms-page-header__titles", children: [
1503
+ /* @__PURE__ */ e("h1", { className: "cms-page-header__title", children: n }),
1504
+ t != null ? /* @__PURE__ */ e("p", { className: "cms-page-header__scope", children: t }) : null
283
1505
  ] }),
284
- a != null ? /* @__PURE__ */ e("div", { className: "cms-page-header__actions", children: a }) : null
1506
+ l != null ? /* @__PURE__ */ e("div", { className: "cms-page-header__actions", children: l }) : null
285
1507
  ] })
286
1508
  ] });
287
1509
  }
288
- function fe({ tabs: l, active: n, onSelect: a, label: c }) {
289
- const s = x([]), m = (r, d) => {
290
- var f;
291
- const u = l.length - 1, h = r.key === "ArrowRight" ? d === u ? 0 : d + 1 : r.key === "ArrowLeft" ? d === 0 ? u : d - 1 : r.key === "Home" ? 0 : r.key === "End" ? u : null;
292
- if (h === null) return;
293
- r.preventDefault();
294
- const t = l[h];
295
- t && (a(t.id), (f = s.current[h]) == null || f.focus());
1510
+ function nl({ tabs: n, active: t, onSelect: l, label: r }) {
1511
+ const s = P([]), a = (h, d) => {
1512
+ var g;
1513
+ const m = n.length - 1, b = h.key === "ArrowRight" ? d === m ? 0 : d + 1 : h.key === "ArrowLeft" ? d === 0 ? m : d - 1 : h.key === "Home" ? 0 : h.key === "End" ? m : null;
1514
+ if (b === null) return;
1515
+ h.preventDefault();
1516
+ const i = n[b];
1517
+ i && (l(i.id), (g = s.current[b]) == null || g.focus());
296
1518
  };
297
- return /* @__PURE__ */ e("div", { className: "cms-tabs", role: "tablist", "aria-label": c, children: l.map((r, d) => {
298
- const u = r.id === n;
299
- return /* @__PURE__ */ i(
1519
+ return /* @__PURE__ */ e("div", { className: "cms-tabs", role: "tablist", "aria-label": r, children: n.map((h, d) => {
1520
+ const m = h.id === t;
1521
+ return /* @__PURE__ */ c(
300
1522
  "button",
301
1523
  {
302
- ref: (h) => {
303
- s.current[d] = h;
1524
+ ref: (b) => {
1525
+ s.current[d] = b;
304
1526
  },
305
1527
  type: "button",
306
1528
  role: "tab",
307
- className: v("cms-tab", u && "is-active"),
308
- "aria-selected": u,
309
- tabIndex: u ? 0 : -1,
310
- onClick: () => a(r.id),
311
- onKeyDown: (h) => m(h, d),
1529
+ className: H("cms-tab", m && "is-active"),
1530
+ "aria-selected": m,
1531
+ tabIndex: m ? 0 : -1,
1532
+ onClick: () => l(h.id),
1533
+ onKeyDown: (b) => a(b, d),
312
1534
  children: [
313
- r.label,
314
- r.count !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-tab__count", children: r.count }) : null
1535
+ h.label,
1536
+ h.count !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-tab__count", children: h.count }) : null
315
1537
  ]
316
1538
  },
317
- r.id
1539
+ h.id
318
1540
  );
319
1541
  }) });
320
1542
  }
321
- function G(l) {
322
- var c;
323
- const n = l.trim().split(/\s+/).filter(Boolean);
324
- return (n.length > 1 ? [n[0][0], n[n.length - 1][0]] : [(c = n[0]) == null ? void 0 : c[0]]).filter(Boolean).join("").toUpperCase();
1543
+ function dt(n) {
1544
+ const t = n.trim().replace(/\s+via\s+\S.*$/, "").split(/\s+/).filter(Boolean), l = (s) => {
1545
+ var a;
1546
+ return (a = s == null ? void 0 : s.match(/[\p{L}\p{N}]/u)) == null ? void 0 : a[0];
1547
+ };
1548
+ return (t.length > 1 ? [l(t[0]), l(t[t.length - 1])] : [l(t[0])]).filter(Boolean).join("").toUpperCase();
325
1549
  }
326
- function X(l) {
327
- let n = 0;
328
- for (const a of l.trim().toLowerCase())
329
- n = n * 31 + (a.codePointAt(0) ?? 0) >>> 0;
330
- return n % 6 + 1;
1550
+ function ut(n) {
1551
+ let t = 0;
1552
+ for (const l of n.trim().toLowerCase())
1553
+ t = t * 31 + (l.codePointAt(0) ?? 0) >>> 0;
1554
+ return t % 6 + 1;
331
1555
  }
332
- function S({ name: l, pictureUrl: n, presence: a, size: c = 32 }) {
333
- return /* @__PURE__ */ i(
1556
+ function Ye({ name: n, pictureUrl: t, presence: l, connection: r, deleted: s = !1, placeholder: a = !1, size: h = 32, tintSeed: d, unnamedLabel: m }) {
1557
+ const b = s || a, i = dt(n) || "?", g = n.trim() === "" ? (m == null ? void 0 : m.trim()) || "?" : n, f = r !== void 0 ? `is-${r.state === "offline" ? "disconnected" : r.state}` : l === void 0 ? null : `is-${l === "busy" ? "away" : l}`, v = r !== void 0 ? `${g}, ${r.label}` : l ? `${g}, ${l}` : g;
1558
+ return /* @__PURE__ */ c(
334
1559
  "span",
335
1560
  {
336
- className: `cms-avatar cms-avatar--tint-${X(l)}`,
337
- style: { width: c, height: c, fontSize: Math.round(c * 0.4) },
1561
+ className: H("cms-avatar", b ? "cms-avatar--deleted" : `cms-avatar--tint-${ut(d ?? n)}`),
1562
+ style: { width: h, height: h, fontSize: Math.round(h * 0.4) },
338
1563
  role: "img",
339
- "aria-label": a ? `${l}, ${a}` : l,
1564
+ "aria-label": v,
1565
+ ...r === void 0 ? {} : { title: r.label },
340
1566
  children: [
341
- n ? /* @__PURE__ */ e("img", { src: n, alt: "", className: "cms-avatar__picture" }) : /* @__PURE__ */ e("span", { "aria-hidden": "true", children: G(l) }),
342
- a ? /* @__PURE__ */ e("span", { className: v("cms-avatar__presence", `is-${a}`), "aria-hidden": "true" }) : null
1567
+ b ? /* @__PURE__ */ e(B, { name: "user", size: Math.round(h * 0.6) }) : t ? /* @__PURE__ */ e("img", { src: t, alt: "", className: "cms-avatar__picture" }) : /* @__PURE__ */ e("span", { "aria-hidden": "true", children: i }),
1568
+ f === null ? null : /* @__PURE__ */ e("span", { className: H("cms-avatar__presence", f), "aria-hidden": "true" })
343
1569
  ]
344
1570
  }
345
1571
  );
346
1572
  }
347
- const H = {
348
- mail: /* @__PURE__ */ i(g, { children: [
349
- /* @__PURE__ */ e("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
350
- /* @__PURE__ */ e("path", { d: "m3 7 9 6 9-6" })
351
- ] }),
352
- chat: /* @__PURE__ */ e("path", { d: "M4 12a8 8 0 1 1 4 6.9L4 20l1.1-4A8 8 0 0 1 4 12Z" }),
353
- phone: /* @__PURE__ */ e("path", { d: "M5 3h3l2 5-2.5 1.5a11 11 0 0 0 7 7L16 14l5 2v3a2 2 0 0 1-2 2A16 16 0 0 1 3 5a2 2 0 0 1 2-2Z" }),
354
- calendar: /* @__PURE__ */ i(g, { children: [
355
- /* @__PURE__ */ e("rect", { x: "3", y: "5", width: "18", height: "16", rx: "2" }),
356
- /* @__PURE__ */ e("path", { d: "M3 10h18M8 3v4M16 3v4" })
357
- ] }),
358
- file: /* @__PURE__ */ i(g, { children: [
359
- /* @__PURE__ */ e("path", { d: "M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9Z" }),
360
- /* @__PURE__ */ e("path", { d: "M14 3v6h6M8 13h8M8 17h6" })
361
- ] }),
362
- image: /* @__PURE__ */ i(g, { children: [
363
- /* @__PURE__ */ e("rect", { x: "3", y: "4", width: "18", height: "16", rx: "2" }),
364
- /* @__PURE__ */ e("circle", { cx: "9", cy: "10", r: "2" }),
365
- /* @__PURE__ */ e("path", { d: "m21 17-5-5-9 8" })
366
- ] }),
367
- search: /* @__PURE__ */ i(g, { children: [
368
- /* @__PURE__ */ e("circle", { cx: "11", cy: "11", r: "7" }),
369
- /* @__PURE__ */ e("path", { d: "m20 20-4-4" })
370
- ] }),
371
- bell: /* @__PURE__ */ i(g, { children: [
372
- /* @__PURE__ */ e("path", { d: "M6 9a6 6 0 1 1 12 0c0 6 2 8 2 8H4s2-2 2-8Z" }),
373
- /* @__PURE__ */ e("path", { d: "M10 20a2 2 0 0 0 4 0" })
374
- ] }),
375
- pencil: /* @__PURE__ */ i(g, { children: [
376
- /* @__PURE__ */ e("path", { d: "M4 20h4L19 9l-4-4L4 16Z" }),
377
- /* @__PURE__ */ e("path", { d: "m13 7 4 4" })
378
- ] }),
379
- star: /* @__PURE__ */ e("path", { d: "m12 3 2.8 5.8 6.2.9-4.5 4.4 1 6.2L12 17.4l-5.5 2.9 1-6.2L3 9.7l6.2-.9Z" }),
380
- send: /* @__PURE__ */ i(g, { children: [
381
- /* @__PURE__ */ e("path", { d: "M21 3 10 14" }),
382
- /* @__PURE__ */ e("path", { d: "M21 3 14 21l-4-7-7-4Z" })
383
- ] }),
384
- inbox: /* @__PURE__ */ i(g, { children: [
385
- /* @__PURE__ */ e("path", { d: "M3 13h5l1 3h6l1-3h5" }),
386
- /* @__PURE__ */ e("path", { d: "M5 5h14l2 8v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-6Z" })
387
- ] }),
388
- archive: /* @__PURE__ */ i(g, { children: [
389
- /* @__PURE__ */ e("rect", { x: "3", y: "4", width: "18", height: "5", rx: "1" }),
390
- /* @__PURE__ */ e("path", { d: "M5 9v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V9M10 13h4" })
391
- ] }),
392
- trash: /* @__PURE__ */ i(g, { children: [
393
- /* @__PURE__ */ e("path", { d: "M4 7h16M10 11v6M14 11v6" }),
394
- /* @__PURE__ */ e("path", { d: "M6 7l1 13a2 2 0 0 0 2 1h6a2 2 0 0 0 2-1l1-13M9 7V4h6v3" })
395
- ] }),
396
- paperclip: /* @__PURE__ */ e("path", { d: "m20 11-8.5 8.5a5 5 0 0 1-7-7L13 4a3.5 3.5 0 0 1 5 5l-8.5 8.5a2 2 0 0 1-3-3L14 7" }),
397
- mic: /* @__PURE__ */ i(g, { children: [
398
- /* @__PURE__ */ e("rect", { x: "9", y: "3", width: "6", height: "11", rx: "3" }),
399
- /* @__PURE__ */ e("path", { d: "M5 11a7 7 0 0 0 14 0M12 18v3" })
400
- ] }),
401
- speaker: /* @__PURE__ */ i(g, { children: [
402
- /* @__PURE__ */ e("path", { d: "M4 9h4l5-4v14l-5-4H4Z" }),
403
- /* @__PURE__ */ e("path", { d: "M16 9a4 4 0 0 1 0 6M19 6a8 8 0 0 1 0 12" })
404
- ] }),
405
- "user-plus": /* @__PURE__ */ i(g, { children: [
406
- /* @__PURE__ */ e("circle", { cx: "10", cy: "8", r: "4" }),
407
- /* @__PURE__ */ e("path", { d: "M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6" })
408
- ] }),
409
- "phone-off": /* @__PURE__ */ e("path", { d: "M3 14c5-5 13-5 18 0l-2 3-4-1v-3a10 10 0 0 0-6 0v3l-4 1Z" }),
410
- video: /* @__PURE__ */ i(g, { children: [
411
- /* @__PURE__ */ e("rect", { x: "3", y: "6", width: "13", height: "12", rx: "2" }),
412
- /* @__PURE__ */ e("path", { d: "m16 10 5-3v10l-5-3" })
413
- ] }),
414
- info: /* @__PURE__ */ i(g, { children: [
415
- /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "9" }),
416
- /* @__PURE__ */ e("path", { d: "M12 11v6M12 7.5v.5" })
417
- ] }),
418
- "chevron-down": /* @__PURE__ */ e("path", { d: "m6 9 6 6 6-6" }),
419
- "chevron-left": /* @__PURE__ */ e("path", { d: "m15 18-6-6 6-6" }),
420
- plus: /* @__PURE__ */ e("path", { d: "M12 5v14M5 12h14" }),
421
- folder: /* @__PURE__ */ e("path", { d: "M3 6a2 2 0 0 1 2-2h4l2 3h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z" }),
422
- check: /* @__PURE__ */ e("path", { d: "m5 12 5 5 9-10" }),
423
- server: /* @__PURE__ */ i(g, { children: [
424
- /* @__PURE__ */ e("rect", { x: "3", y: "4", width: "18", height: "7", rx: "2" }),
425
- /* @__PURE__ */ e("rect", { x: "3", y: "13", width: "18", height: "7", rx: "2" }),
426
- /* @__PURE__ */ e("path", { d: "M7 7.5h.5M7 16.5h.5" })
427
- ] }),
428
- reply: /* @__PURE__ */ e("path", { d: "M10 8 4 13l6 5M4 13h11a5 5 0 0 1 5 5" }),
429
- more: /* @__PURE__ */ e("path", { d: "M5 12h.5M12 12h.5M19 12h.5" })
430
- };
431
- function y({ name: l, size: n = 20, label: a }) {
1573
+ const mt = 64, cn = "cms-splitter:";
1574
+ function en(n) {
1575
+ try {
1576
+ const t = window.localStorage.getItem(cn + n);
1577
+ if (t === null) return null;
1578
+ const l = Number(t);
1579
+ return Number.isFinite(l) ? l : null;
1580
+ } catch {
1581
+ return null;
1582
+ }
1583
+ }
1584
+ function ht(n, t) {
1585
+ if (n !== void 0)
1586
+ try {
1587
+ window.localStorage.setItem(cn + n, String(t));
1588
+ } catch {
1589
+ }
1590
+ }
1591
+ function ft(n) {
1592
+ if (n !== void 0)
1593
+ try {
1594
+ window.localStorage.removeItem(cn + n);
1595
+ } catch {
1596
+ }
1597
+ }
1598
+ function pt({ storageKey: n, value: t, default: l, min: r, max: s, step: a = 16, label: h, onChange: d, className: m, style: b }) {
1599
+ const i = Math.max(r, s), g = (_) => Math.round(Math.min(Math.max(_, r), i)), [f, v] = D(() => {
1600
+ const _ = n === void 0 ? null : en(n);
1601
+ return g(_ ?? l);
1602
+ }), u = g(t ?? f), y = P(null), [S, T] = D(!1);
1603
+ $e(() => {
1604
+ if (n === void 0) return;
1605
+ const _ = en(n);
1606
+ if (_ === null) return;
1607
+ const N = g(_);
1608
+ (t === void 0 || N !== g(t)) && (v(N), d(N, !0));
1609
+ }, []), $e(() => {
1610
+ t !== void 0 && g(t) !== t && d(g(t), !0);
1611
+ }, [t, r, i]);
1612
+ const M = (_, N) => {
1613
+ const I = g(_);
1614
+ v(I), N && ht(n, I), d(I, N);
1615
+ }, E = () => {
1616
+ const _ = y.current;
1617
+ y.current = null, T(!1), _ !== null && _.last !== _.from && M(_.last, !0);
1618
+ };
432
1619
  return /* @__PURE__ */ e(
433
- "svg",
1620
+ "div",
434
1621
  {
435
- className: "cms-icon",
436
- width: n,
437
- height: n,
438
- viewBox: "0 0 24 24",
439
- fill: "none",
440
- stroke: "currentColor",
441
- strokeWidth: l === "more" ? 3 : 1.75,
442
- strokeLinecap: "round",
443
- strokeLinejoin: "round",
444
- focusable: !1,
445
- ...a ? { role: "img", "aria-label": a } : { "aria-hidden": !0 },
446
- children: H[l]
1622
+ role: "separator",
1623
+ tabIndex: 0,
1624
+ "aria-orientation": "vertical",
1625
+ "aria-label": h,
1626
+ "aria-valuenow": u,
1627
+ "aria-valuemin": r,
1628
+ "aria-valuemax": i,
1629
+ className: H("cms-splitter", S && "is-dragging", u <= r && "is-at-min", u >= i && "is-at-max", m),
1630
+ style: b,
1631
+ onPointerDown: (_) => {
1632
+ var I, K;
1633
+ if (_.button > 0) return;
1634
+ _.preventDefault(), (K = (I = _.currentTarget).setPointerCapture) == null || K.call(I, _.pointerId);
1635
+ const N = getComputedStyle(_.currentTarget).direction === "rtl" ? -1 : 1;
1636
+ y.current = { x: _.clientX, from: u, last: u, sign: N }, T(!0);
1637
+ },
1638
+ onPointerMove: (_) => {
1639
+ const N = y.current;
1640
+ N === null || !Number.isFinite(_.clientX) || (N.last = g(N.from + N.sign * (_.clientX - N.x)), M(N.last, !1));
1641
+ },
1642
+ onPointerUp: E,
1643
+ onPointerCancel: E,
1644
+ onDoubleClick: () => {
1645
+ ft(n);
1646
+ const _ = g(l);
1647
+ v(_), d(_, !0);
1648
+ },
1649
+ onKeyDown: (_) => {
1650
+ const N = _.shiftKey ? mt : a, I = getComputedStyle(_.currentTarget).direction === "rtl" ? -1 : 1, K = _.key === "ArrowLeft" ? u - I * N : _.key === "ArrowRight" ? u + I * N : _.key === "Home" ? r : _.key === "End" ? i : null;
1651
+ K !== null && (_.preventDefault(), M(K, !0));
1652
+ }
447
1653
  }
448
1654
  );
449
1655
  }
450
- const pe = Object.keys(H);
451
- function Y({ count: l, label: n, max: a = 99 }) {
452
- return l <= 0 ? null : /* @__PURE__ */ i("span", { className: "cms-badge", children: [
453
- /* @__PURE__ */ e("span", { "aria-hidden": "true", children: l > a ? `${a}+` : l }),
454
- /* @__PURE__ */ e("span", { className: "cms-visually-hidden", children: n })
1656
+ function bt({ count: n, label: t, max: l = 99 }) {
1657
+ return n <= 0 ? null : /* @__PURE__ */ c("span", { className: "cms-badge", children: [
1658
+ /* @__PURE__ */ e("span", { "aria-hidden": "true", children: n > l ? `${l}+` : n }),
1659
+ /* @__PURE__ */ e("span", { className: "cms-visually-hidden", children: t })
455
1660
  ] });
456
1661
  }
457
- function _e({ product: l, mark: n, rail: a, active: c, onNavigate: s, server: m, search: r, account: d, children: u, railLabel: h = "Sections" }) {
458
- return /* @__PURE__ */ i("div", { className: "cms-shell", children: [
459
- /* @__PURE__ */ i("nav", { className: "cms-shell__rail", "aria-label": h, children: [
460
- /* @__PURE__ */ e("span", { className: "cms-shell__mark", "aria-hidden": "true", children: n }),
461
- /* @__PURE__ */ e("ul", { className: "cms-shell__items", children: a.map((t) => {
462
- const f = t.id === c;
463
- return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
1662
+ function tl({ product: n, mark: t, rail: l, active: r, onNavigate: s, server: a, search: h, account: d, children: m, railLabel: b = "Sections" }) {
1663
+ return /* @__PURE__ */ c("div", { className: "cms-shell", children: [
1664
+ /* @__PURE__ */ c("nav", { className: "cms-shell__rail", "aria-label": b, children: [
1665
+ /* @__PURE__ */ e("span", { className: "cms-shell__mark", "aria-hidden": "true", children: t }),
1666
+ /* @__PURE__ */ e("ul", { className: "cms-shell__items", children: l.map((i) => {
1667
+ const g = i.id === r;
1668
+ return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ c(
464
1669
  "a",
465
1670
  {
466
- href: t.href,
467
- className: v("cms-shell__item", f && "is-active"),
468
- "aria-current": f ? "page" : void 0,
469
- title: t.label,
470
- onClick: (o) => {
471
- s && (o.preventDefault(), s(t.id));
1671
+ href: i.href,
1672
+ className: H("cms-shell__item", g && "is-active"),
1673
+ "aria-current": g ? "page" : void 0,
1674
+ title: i.label,
1675
+ onClick: (f) => {
1676
+ s && (f.preventDefault(), s(i.id));
472
1677
  },
473
1678
  children: [
474
- /* @__PURE__ */ i("span", { className: "cms-shell__icon", children: [
475
- /* @__PURE__ */ e(y, { name: t.icon, size: 22 }),
476
- t.badge ? /* @__PURE__ */ e(Y, { count: t.badge.count, label: t.badge.label }) : null
1679
+ /* @__PURE__ */ c("span", { className: "cms-shell__icon", children: [
1680
+ /* @__PURE__ */ e(B, { name: i.icon, size: 22 }),
1681
+ i.badge ? /* @__PURE__ */ e(bt, { count: i.badge.count, label: i.badge.label }) : null
477
1682
  ] }),
478
- /* @__PURE__ */ e("span", { className: "cms-shell__label", children: t.label })
1683
+ /* @__PURE__ */ e("span", { className: "cms-shell__label", children: i.label })
479
1684
  ]
480
1685
  }
481
- ) }, t.id);
1686
+ ) }, i.id);
482
1687
  }) })
483
1688
  ] }),
484
- /* @__PURE__ */ i("header", { className: "cms-shell__top", children: [
485
- /* @__PURE__ */ e("span", { className: "cms-shell__product", children: l }),
486
- m != null ? /* @__PURE__ */ e("div", { className: "cms-shell__server", children: m }) : null,
487
- r != null ? /* @__PURE__ */ e("div", { className: "cms-shell__search", children: r }) : null,
1689
+ /* @__PURE__ */ c("header", { className: "cms-shell__top", children: [
1690
+ /* @__PURE__ */ e("span", { className: "cms-shell__product", children: n }),
1691
+ a != null ? /* @__PURE__ */ e("div", { className: "cms-shell__server", children: a }) : null,
1692
+ h != null ? /* @__PURE__ */ e("div", { className: "cms-shell__search", children: h }) : null,
488
1693
  d != null ? /* @__PURE__ */ e("div", { className: "cms-shell__account", children: d }) : null
489
1694
  ] }),
490
- /* @__PURE__ */ e("main", { className: "cms-shell__main", children: u })
1695
+ /* @__PURE__ */ e("main", { className: "cms-shell__main", children: m })
491
1696
  ] });
492
1697
  }
493
- function be({ label: l, placeholder: n, value: a, onChange: c, onSearch: s }) {
494
- return /* @__PURE__ */ i(
1698
+ function ll({ label: n, placeholder: t, value: l, onChange: r, onSearch: s }) {
1699
+ return /* @__PURE__ */ c(
495
1700
  "form",
496
1701
  {
497
1702
  role: "search",
498
1703
  className: "cms-search",
499
- onSubmit: (m) => {
500
- m.preventDefault(), s == null || s(a);
1704
+ onSubmit: (a) => {
1705
+ a.preventDefault(), s == null || s(l);
501
1706
  },
502
1707
  children: [
503
- /* @__PURE__ */ e(y, { name: "search", size: 18 }),
1708
+ /* @__PURE__ */ e(B, { name: "search", size: 18 }),
504
1709
  /* @__PURE__ */ e(
505
1710
  "input",
506
1711
  {
507
1712
  className: "cms-search__input",
508
1713
  type: "search",
509
- "aria-label": l,
510
- placeholder: n,
511
- value: a,
512
- onChange: (m) => c(m.target.value)
1714
+ "aria-label": n,
1715
+ placeholder: t,
1716
+ value: l,
1717
+ onChange: (a) => r(a.target.value)
513
1718
  }
514
1719
  )
515
1720
  ]
516
1721
  }
517
1722
  );
518
1723
  }
519
- function ge({ options: l, value: n, onChange: a, label: c }) {
520
- const s = x([]), m = (r, d) => {
521
- var f;
522
- const u = l.length - 1, h = r.key === "ArrowRight" || r.key === "ArrowDown" ? d === u ? 0 : d + 1 : r.key === "ArrowLeft" || r.key === "ArrowUp" ? d === 0 ? u : d - 1 : null;
523
- if (h === null) return;
524
- r.preventDefault();
525
- const t = l[h];
526
- t && (a(t.id), (f = s.current[h]) == null || f.focus());
527
- };
528
- return /* @__PURE__ */ e("div", { className: "cms-chips", role: "radiogroup", "aria-label": c, children: l.map((r, d) => {
529
- const u = r.id === n;
530
- return /* @__PURE__ */ i(
531
- "button",
532
- {
533
- ref: (h) => {
534
- s.current[d] = h;
535
- },
536
- type: "button",
537
- role: "radio",
538
- "aria-checked": u,
539
- tabIndex: u ? 0 : -1,
540
- className: v("cms-chip", u && "is-on"),
541
- onClick: () => a(r.id),
542
- onKeyDown: (h) => m(h, d),
543
- children: [
544
- u ? /* @__PURE__ */ e(y, { name: "check", size: 16 }) : null,
545
- r.label
546
- ]
547
- },
548
- r.id
549
- );
550
- }) });
551
- }
552
- function ve({ panes: l, active: n, back: a }) {
553
- const c = Math.min(Math.max(n ?? l.length - 1, 0), l.length - 1);
554
- return /* @__PURE__ */ e("div", { className: v("cms-panes", l.length === 3 ? "cms-panes--three" : "cms-panes--two"), "data-active": c, children: l.map((s, m) => /* @__PURE__ */ i("section", { className: "cms-panes__pane", "aria-label": s.label, "data-offset": c - m, children: [
555
- m === c && a ? /* @__PURE__ */ i("a", { className: "cms-panes__back", href: a.href, children: [
556
- /* @__PURE__ */ e(y, { name: "chevron-left", size: 18 }),
557
- a.label
558
- ] }) : null,
559
- s.content
560
- ] }, s.label)) });
1724
+ function _t(n, t, l) {
1725
+ const r = n.map((a) => Math.min(Math.max(a.width, a.min), a.max));
1726
+ let s = r.reduce((a, h) => a + h, 0) + l - t;
1727
+ for (let a = r.length - 1; a >= 0 && s > 0; a -= 1) {
1728
+ const h = Math.min(s, r[a] - n[a].min);
1729
+ r[a] = r[a] - h, s -= h;
1730
+ }
1731
+ return r;
561
1732
  }
562
- const Q = { attachment: "Has an attachment", unread: "Unread" };
563
- function Ne({ from: l, subject: n, preview: a, time: c, unread: s, hasAttachment: m, selected: r, onOpen: d, labels: u }) {
564
- const h = L(Q, u);
565
- return /* @__PURE__ */ i(
566
- "button",
1733
+ function sl({ panes: n, active: t, back: l, sizes: r, lastMin: s = 360, onResize: a, storageKey: h }) {
1734
+ const d = Math.min(Math.max(t ?? n.length - 1, 0), n.length - 1), m = P(null), [b, i] = D(0), g = (r ?? []).slice(0, n.length - 1), [f, v] = D(() => h === void 0 ? [] : g.map((_, N) => en(`${h}:${String(N)}`) ?? void 0)), [u, y] = D(!1), S = g.map((_, N) => _ !== void 0 && f[N] !== void 0 ? { ..._, width: f[N] } : _), T = S.length === n.length - 1 && S.every((_) => _ !== void 0);
1735
+ $e(() => {
1736
+ const _ = m.current;
1737
+ if (_ === null || !T) return;
1738
+ const N = () => i(_.clientWidth);
1739
+ if (N(), typeof ResizeObserver > "u") return;
1740
+ const I = new ResizeObserver(N);
1741
+ return I.observe(_), () => I.disconnect();
1742
+ }, [T]);
1743
+ const M = T ? _t(S, b > 0 ? b : Number.POSITIVE_INFINITY, s) : [], E = T ? Object.fromEntries(M.flatMap((_, N) => [
1744
+ [`--split-pane-${String(N)}`, `${String(_)}px`],
1745
+ [`--split-pane-end-${String(N)}`, `${String(M.slice(0, N + 1).reduce((I, K) => I + K, 0))}px`]
1746
+ ])) : void 0;
1747
+ return /* @__PURE__ */ c(
1748
+ "div",
567
1749
  {
568
- type: "button",
569
- className: v("cms-mail-row", s && "is-unread", r && "is-selected"),
570
- "aria-current": r ? "true" : void 0,
571
- onClick: d,
1750
+ ref: m,
1751
+ className: H("cms-panes", n.length === 3 ? "cms-panes--three" : "cms-panes--two", T && "cms-panes--sized", u && "is-resizing"),
1752
+ "data-active": d,
1753
+ style: E,
572
1754
  children: [
573
- /* @__PURE__ */ e(S, { name: l, size: 40 }),
574
- /* @__PURE__ */ i("span", { className: "cms-mail-row__body", children: [
575
- /* @__PURE__ */ i("span", { className: "cms-mail-row__line", children: [
576
- /* @__PURE__ */ e("span", { className: "cms-mail-row__from", children: l }),
577
- m ? /* @__PURE__ */ e(y, { name: "paperclip", size: 16, label: h.attachment }) : null,
578
- /* @__PURE__ */ e("span", { className: "cms-mail-row__time", children: c })
579
- ] }),
580
- /* @__PURE__ */ i("span", { className: "cms-mail-row__line", children: [
581
- /* @__PURE__ */ e("span", { className: "cms-mail-row__subject", children: n }),
582
- s ? /* @__PURE__ */ e("span", { className: "cms-mail-row__dot", role: "img", "aria-label": h.unread }) : null
583
- ] }),
584
- /* @__PURE__ */ e("span", { className: "cms-mail-row__preview", children: a })
585
- ] })
1755
+ n.map((_, N) => /* @__PURE__ */ c("section", { className: "cms-panes__pane", "aria-label": _.label, "data-offset": d - N, children: [
1756
+ N === d && l ? /* @__PURE__ */ c("a", { className: "cms-panes__back", href: l.href, children: [
1757
+ /* @__PURE__ */ e(B, { name: "chevron-left", size: 18 }),
1758
+ l.label
1759
+ ] }) : null,
1760
+ _.content
1761
+ ] }, _.label)),
1762
+ T ? S.map((_, N) => {
1763
+ const I = M.reduce((z, k, F) => F === N ? z : z + k, 0), K = Math.max(_.min, Math.min(_.max, b > 0 ? b - I - s : _.max));
1764
+ return /* @__PURE__ */ e(
1765
+ pt,
1766
+ {
1767
+ ...h === void 0 ? {} : { storageKey: `${h}:${String(N)}` },
1768
+ value: M[N],
1769
+ default: _.reset,
1770
+ min: _.min,
1771
+ max: K,
1772
+ label: _.label,
1773
+ className: "cms-panes__splitter",
1774
+ style: { "--split-at": `var(--split-pane-end-${String(N)})` },
1775
+ onChange: (z, k) => {
1776
+ h !== void 0 && v((F) => {
1777
+ const U = [...F];
1778
+ return U[N] = z, U;
1779
+ }), y(!k), a == null || a(N, z, k);
1780
+ }
1781
+ },
1782
+ _.label
1783
+ );
1784
+ }) : null
586
1785
  ]
587
1786
  }
588
1787
  );
589
1788
  }
590
- function ye({ direction: l, children: n, time: a, read: c, readLabel: s = "Read" }) {
591
- return /* @__PURE__ */ i("div", { className: v("cms-bubble", `cms-bubble--${l}`), children: [
592
- /* @__PURE__ */ e("div", { className: "cms-bubble__text", children: n }),
593
- /* @__PURE__ */ i("div", { className: "cms-bubble__meta", children: [
594
- a,
595
- l === "out" && c ? /* @__PURE__ */ i(g, { children: [
1789
+ const vt = { attachment: "Has an attachment", unread: "Unread" };
1790
+ function rl({ from: n, fromPlaceholder: t = !1, subject: l, preview: r, time: s, unread: a, hasAttachment: h, selected: d, onOpen: m, check: b, selecting: i, labels: g }) {
1791
+ const f = qe(vt, g), v = /* @__PURE__ */ e(Ye, { name: n, size: 40, placeholder: t });
1792
+ return /* @__PURE__ */ c("div", { className: H("cms-mail-row", a && "is-unread", d && "is-selected", i && "is-selecting", (b == null ? void 0 : b.checked) && "is-checked"), children: [
1793
+ b !== void 0 ? /* @__PURE__ */ c("span", { className: "cms-mail-row__lead", children: [
1794
+ v,
1795
+ /* @__PURE__ */ e(
1796
+ "input",
1797
+ {
1798
+ type: "checkbox",
1799
+ className: "cms-mail-row__check",
1800
+ checked: b.checked,
1801
+ disabled: b.disabled,
1802
+ "aria-disabled": b.pending ? "true" : void 0,
1803
+ "aria-busy": b.pending ? "true" : void 0,
1804
+ "aria-label": b.label,
1805
+ onChange: () => {
1806
+ },
1807
+ onClick: (u) => {
1808
+ if (u.stopPropagation(), b.pending) {
1809
+ u.preventDefault();
1810
+ return;
1811
+ }
1812
+ b.onCheck({ shift: u.shiftKey, toggle: u.ctrlKey || u.metaKey });
1813
+ }
1814
+ }
1815
+ )
1816
+ ] }) : null,
1817
+ /* @__PURE__ */ c(
1818
+ "button",
1819
+ {
1820
+ type: "button",
1821
+ className: "cms-mail-row__open",
1822
+ "aria-current": d ? "true" : void 0,
1823
+ onClick: m,
1824
+ children: [
1825
+ b === void 0 ? v : null,
1826
+ /* @__PURE__ */ c("span", { className: "cms-mail-row__body", children: [
1827
+ /* @__PURE__ */ c("span", { className: "cms-mail-row__line", children: [
1828
+ /* @__PURE__ */ e("span", { className: "cms-mail-row__from", children: n }),
1829
+ h ? /* @__PURE__ */ e(B, { name: "paperclip", size: 16, label: f.attachment }) : null,
1830
+ /* @__PURE__ */ e("span", { className: "cms-mail-row__time", children: s })
1831
+ ] }),
1832
+ /* @__PURE__ */ c("span", { className: "cms-mail-row__line", children: [
1833
+ /* @__PURE__ */ e("span", { className: "cms-mail-row__subject", children: l }),
1834
+ a ? /* @__PURE__ */ e("span", { className: "cms-mail-row__dot", role: "img", "aria-label": f.unread }) : null
1835
+ ] }),
1836
+ /* @__PURE__ */ e("span", { className: "cms-mail-row__preview", children: r })
1837
+ ] })
1838
+ ]
1839
+ }
1840
+ )
1841
+ ] });
1842
+ }
1843
+ function al({ direction: n, children: t, time: l, read: r, readLabel: s = "Read" }) {
1844
+ return /* @__PURE__ */ c("div", { className: H("cms-bubble", `cms-bubble--${n}`), children: [
1845
+ /* @__PURE__ */ e("div", { className: "cms-bubble__text", children: t }),
1846
+ /* @__PURE__ */ c("div", { className: "cms-bubble__meta", children: [
1847
+ l,
1848
+ n === "out" && r ? /* @__PURE__ */ c($, { children: [
596
1849
  " · ",
597
1850
  s
598
1851
  ] }) : null
599
1852
  ] })
600
1853
  ] });
601
1854
  }
602
- function we({ label: l, value: n, onChange: a, onSend: c, onAttach: s, placeholder: m, variant: r = "chat", sendLabel: d = "Send", attachLabel: u = "Attach a file" }) {
603
- const h = E(), t = n.trim() === "", f = (p) => {
604
- p.preventDefault(), t || c();
605
- }, o = s ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button cms-composer__attach", "aria-label": u, onClick: s, children: /* @__PURE__ */ e(y, { name: "paperclip" }) }) : null;
606
- return /* @__PURE__ */ i("form", { className: v("cms-composer", `cms-composer--${r}`), onSubmit: f, children: [
607
- /* @__PURE__ */ e("label", { htmlFor: h, className: r === "reply" ? "cms-composer__title" : "cms-visually-hidden", children: l }),
608
- r === "chat" ? o : null,
1855
+ function il({ label: n, value: t, onChange: l, onSend: r, onAttach: s, placeholder: a, variant: h = "chat", sendLabel: d = "Send", attachLabel: m = "Attach a file", leading: b, canSend: i }) {
1856
+ const g = fe(), f = i ?? t.trim() !== "", v = (y) => {
1857
+ y.preventDefault(), f && r();
1858
+ }, u = s ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button cms-composer__attach", "aria-label": m, onClick: s, children: /* @__PURE__ */ e(B, { name: "paperclip" }) }) : null;
1859
+ return /* @__PURE__ */ c("form", { className: H("cms-composer", `cms-composer--${h}`), onSubmit: v, children: [
1860
+ /* @__PURE__ */ e("label", { htmlFor: g, className: h === "reply" ? "cms-composer__title" : "cms-visually-hidden", children: n }),
1861
+ h === "chat" ? u : null,
609
1862
  /* @__PURE__ */ e(
610
1863
  "textarea",
611
1864
  {
612
- id: h,
1865
+ id: g,
613
1866
  className: "cms-composer__input",
614
- rows: r === "reply" ? 3 : 1,
615
- placeholder: m,
616
- value: n,
617
- onChange: (p) => a(p.target.value),
618
- onKeyDown: (p) => {
619
- p.nativeEvent.isComposing || p.keyCode === 229 || r === "chat" && p.key === "Enter" && !p.shiftKey && (p.preventDefault(), t || c());
1867
+ rows: h === "reply" ? 3 : 1,
1868
+ placeholder: a,
1869
+ value: t,
1870
+ onChange: (y) => l(y.target.value),
1871
+ onKeyDown: (y) => {
1872
+ y.nativeEvent.isComposing || y.keyCode === 229 || h === "chat" && y.key === "Enter" && !y.shiftKey && (y.preventDefault(), f && r());
620
1873
  }
621
1874
  }
622
1875
  ),
623
- r === "reply" ? o : null,
624
- r === "chat" ? /* @__PURE__ */ e("button", { type: "submit", className: "cms-composer__send-round", "aria-label": d, disabled: t, children: /* @__PURE__ */ e(y, { name: "send" }) }) : /* @__PURE__ */ i("button", { type: "submit", className: "cms-button cms-button--chrome cms-composer__send", disabled: t, children: [
1876
+ h === "reply" && b !== void 0 ? /* @__PURE__ */ e("div", { className: "cms-composer__leading", children: b }) : null,
1877
+ h === "reply" ? u : null,
1878
+ h === "chat" ? /* @__PURE__ */ e("button", { type: "submit", className: "cms-composer__send-round", "aria-label": d, disabled: !f, children: /* @__PURE__ */ e(B, { name: "send" }) }) : /* @__PURE__ */ c("button", { type: "submit", className: "cms-button cms-button--chrome cms-composer__send", disabled: !f, children: [
625
1879
  d,
626
1880
  " ",
627
- /* @__PURE__ */ e(y, { name: "send", size: 18 })
1881
+ /* @__PURE__ */ e(B, { name: "send", size: 18 })
628
1882
  ] })
629
1883
  ] });
630
1884
  }
631
- const Z = {
1885
+ const on = {
632
1886
  incomingAudio: "Incoming audio call",
633
1887
  incomingVideo: "Incoming video call",
634
- incomingFrom: (l, n) => `${l} from ${n}`,
1888
+ incomingFrom: (n, t) => `${n} from ${t}`,
635
1889
  accept: "Accept",
636
1890
  decline: "Decline",
637
- callWith: (l) => `Call with ${l}`,
638
- callTime: (l) => `Call time ${l}`,
1891
+ callWith: (n) => `Call with ${n}`,
1892
+ callTime: (n) => `Call time ${n}`,
639
1893
  goodConnection: "Good connection",
640
1894
  poorConnection: "Poor connection",
641
1895
  you: "You",
@@ -646,94 +1900,94 @@ const Z = {
646
1900
  addPerson: "Add person",
647
1901
  chat: "Chat",
648
1902
  hangUp: "Hang up",
649
- onCallWith: (l) => `On a call with ${l}`,
1903
+ onCallWith: (n) => `On a call with ${n}`,
650
1904
  returnToCall: "Return to call"
651
1905
  };
652
- function ke({ name: l, media: n, onAccept: a, onDecline: c, labels: s }) {
653
- const m = L(Z, s), r = n === "video" ? m.incomingVideo : m.incomingAudio;
654
- return /* @__PURE__ */ i("div", { className: "cms-call-incoming", role: "alertdialog", "aria-label": m.incomingFrom(r, l), children: [
655
- /* @__PURE__ */ e("span", { className: "cms-call-incoming__ring", "aria-hidden": "true", children: /* @__PURE__ */ e(S, { name: l, size: 112 }) }),
656
- /* @__PURE__ */ e("p", { className: "cms-call-incoming__name", children: l }),
657
- /* @__PURE__ */ e("p", { className: "cms-call-incoming__what", children: r }),
658
- /* @__PURE__ */ i("div", { className: "cms-call-incoming__actions", children: [
659
- /* @__PURE__ */ e(A, { icon: "phone-off", label: m.decline, tone: "hang-up", onClick: c }),
660
- /* @__PURE__ */ e(A, { icon: "phone", label: m.accept, tone: "accept", onClick: a })
1906
+ function cl({ name: n, namePlaceholder: t = !1, media: l, onAccept: r, onDecline: s, labels: a }) {
1907
+ const h = qe(on, a), d = l === "video" ? h.incomingVideo : h.incomingAudio;
1908
+ return /* @__PURE__ */ c("div", { className: "cms-call-incoming", role: "alertdialog", "aria-label": h.incomingFrom(d, n), children: [
1909
+ /* @__PURE__ */ e("span", { className: "cms-call-incoming__ring", "aria-hidden": "true", children: /* @__PURE__ */ e(Ye, { name: n, size: 112, placeholder: t }) }),
1910
+ /* @__PURE__ */ e("p", { className: "cms-call-incoming__name", children: n }),
1911
+ /* @__PURE__ */ e("p", { className: "cms-call-incoming__what", children: d }),
1912
+ /* @__PURE__ */ c("div", { className: "cms-call-incoming__actions", children: [
1913
+ /* @__PURE__ */ e(ze, { icon: "phone-off", label: h.decline, tone: "hang-up", onClick: s }),
1914
+ /* @__PURE__ */ e(ze, { icon: "phone", label: h.accept, tone: "accept", onClick: r })
661
1915
  ] })
662
1916
  ] });
663
1917
  }
664
- function A({ icon: l, label: n, onClick: a, tone: c = "plain", pressed: s }) {
665
- return /* @__PURE__ */ i(
1918
+ function ze({ icon: n, label: t, onClick: l, tone: r = "plain", pressed: s }) {
1919
+ return /* @__PURE__ */ c(
666
1920
  "button",
667
1921
  {
668
1922
  type: "button",
669
- className: v("cms-call-button", `cms-call-button--${c}`, s && "is-pressed"),
1923
+ className: H("cms-call-button", `cms-call-button--${r}`, s && "is-pressed"),
670
1924
  "aria-pressed": s,
671
- onClick: a,
1925
+ onClick: l,
672
1926
  children: [
673
- /* @__PURE__ */ e("span", { className: "cms-call-button__disc", children: /* @__PURE__ */ e(y, { name: l, size: 24 }) }),
674
- /* @__PURE__ */ e("span", { className: "cms-call-button__label", children: n })
1927
+ /* @__PURE__ */ e("span", { className: "cms-call-button__disc", children: /* @__PURE__ */ e(B, { name: n, size: 24 }) }),
1928
+ /* @__PURE__ */ e("span", { className: "cms-call-button__label", children: t })
675
1929
  ]
676
1930
  }
677
1931
  );
678
1932
  }
679
- function Me({ name: l, duration: n, connection: a, you: c, muted: s, speaker: m, onToggleMute: r, onToggleSpeaker: d, onAddPerson: u, onChat: h, onHangUp: t, labels: f }) {
680
- const o = L(Z, f);
681
- return /* @__PURE__ */ i("section", { className: "cms-call-panel", "aria-label": o.callWith(l), children: [
682
- /* @__PURE__ */ i("div", { className: "cms-call-panel__head", children: [
683
- /* @__PURE__ */ e(S, { name: l, size: 64 }),
684
- /* @__PURE__ */ i("div", { className: "cms-call-panel__who", children: [
685
- /* @__PURE__ */ e("p", { className: "cms-call-panel__name", children: l }),
686
- /* @__PURE__ */ e("p", { className: "cms-call-panel__time", "aria-label": o.callTime(n), children: n })
1933
+ function ol({ name: n, duration: t, connection: l, you: r, muted: s, speaker: a, onToggleMute: h, onToggleSpeaker: d, onAddPerson: m, onChat: b, onHangUp: i, labels: g }) {
1934
+ const f = qe(on, g);
1935
+ return /* @__PURE__ */ c("section", { className: "cms-call-panel", "aria-label": f.callWith(n), children: [
1936
+ /* @__PURE__ */ c("div", { className: "cms-call-panel__head", children: [
1937
+ /* @__PURE__ */ e(Ye, { name: n, size: 64 }),
1938
+ /* @__PURE__ */ c("div", { className: "cms-call-panel__who", children: [
1939
+ /* @__PURE__ */ e("p", { className: "cms-call-panel__name", children: n }),
1940
+ /* @__PURE__ */ e("p", { className: "cms-call-panel__time", "aria-label": f.callTime(t), children: t })
687
1941
  ] }),
688
- /* @__PURE__ */ e("span", { className: v("cms-pill", a === "good" ? "cms-pill--success" : "cms-pill--warning"), children: a === "good" ? o.goodConnection : o.poorConnection })
1942
+ /* @__PURE__ */ e("span", { className: H("cms-pill", l === "good" ? "cms-pill--success" : "cms-pill--warning"), children: l === "good" ? f.goodConnection : f.poorConnection })
689
1943
  ] }),
690
- /* @__PURE__ */ i("div", { className: "cms-call-panel__you", children: [
691
- /* @__PURE__ */ e(S, { name: c.name, size: 36 }),
692
- /* @__PURE__ */ e("span", { children: o.you }),
693
- c.speaking ? /* @__PURE__ */ e("span", { className: "cms-call-panel__level", role: "img", "aria-label": o.speaking }) : null
1944
+ /* @__PURE__ */ c("div", { className: "cms-call-panel__you", children: [
1945
+ /* @__PURE__ */ e(Ye, { name: r.name, size: 36 }),
1946
+ /* @__PURE__ */ e("span", { children: f.you }),
1947
+ r.speaking ? /* @__PURE__ */ e("span", { className: "cms-call-panel__level", role: "img", "aria-label": f.speaking }) : null
694
1948
  ] }),
695
- /* @__PURE__ */ i("div", { className: "cms-call-panel__controls", children: [
696
- /* @__PURE__ */ e(A, { icon: "mic", label: s ? o.unmute : o.mute, pressed: s, onClick: r }),
697
- /* @__PURE__ */ e(A, { icon: "speaker", label: o.speaker, pressed: m, onClick: d }),
698
- u ? /* @__PURE__ */ e(A, { icon: "user-plus", label: o.addPerson, onClick: u }) : null,
699
- h ? /* @__PURE__ */ e(A, { icon: "chat", label: o.chat, onClick: h }) : null,
700
- /* @__PURE__ */ e(A, { icon: "phone-off", label: o.hangUp, tone: "hang-up", onClick: t })
1949
+ /* @__PURE__ */ c("div", { className: "cms-call-panel__controls", children: [
1950
+ /* @__PURE__ */ e(ze, { icon: "mic", label: s ? f.unmute : f.mute, pressed: s, onClick: h }),
1951
+ /* @__PURE__ */ e(ze, { icon: "speaker", label: f.speaker, pressed: a, onClick: d }),
1952
+ m ? /* @__PURE__ */ e(ze, { icon: "user-plus", label: f.addPerson, onClick: m }) : null,
1953
+ b ? /* @__PURE__ */ e(ze, { icon: "chat", label: f.chat, onClick: b }) : null,
1954
+ /* @__PURE__ */ e(ze, { icon: "phone-off", label: f.hangUp, tone: "hang-up", onClick: i })
701
1955
  ] })
702
1956
  ] });
703
1957
  }
704
- function Ce({ name: l, duration: n, muted: a, onToggleMute: c, onReturn: s, onHangUp: m, labels: r }) {
705
- const d = L(Z, r);
706
- return /* @__PURE__ */ i("section", { className: "cms-call-bar", "aria-label": d.callWith(l), children: [
1958
+ function dl({ name: n, duration: t, muted: l, onToggleMute: r, onReturn: s, onHangUp: a, labels: h }) {
1959
+ const d = qe(on, h);
1960
+ return /* @__PURE__ */ c("section", { className: "cms-call-bar", "aria-label": d.callWith(n), children: [
707
1961
  /* @__PURE__ */ e("span", { className: "cms-call-bar__live", "aria-hidden": "true" }),
708
- /* @__PURE__ */ e("span", { className: "cms-call-bar__name", children: d.onCallWith(l) }),
709
- /* @__PURE__ */ e("span", { className: "cms-call-bar__time", children: n }),
710
- /* @__PURE__ */ i("span", { className: "cms-call-bar__actions", children: [
711
- /* @__PURE__ */ e("button", { type: "button", className: "cms-call-bar__icon", "aria-label": a ? d.unmute : d.mute, "aria-pressed": a, onClick: c, children: /* @__PURE__ */ e(y, { name: "mic" }) }),
1962
+ /* @__PURE__ */ e("span", { className: "cms-call-bar__name", children: d.onCallWith(n) }),
1963
+ /* @__PURE__ */ e("span", { className: "cms-call-bar__time", children: t }),
1964
+ /* @__PURE__ */ c("span", { className: "cms-call-bar__actions", children: [
1965
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-call-bar__icon", "aria-label": l ? d.unmute : d.mute, "aria-pressed": l, onClick: r, children: /* @__PURE__ */ e(B, { name: "mic" }) }),
712
1966
  /* @__PURE__ */ e("button", { type: "button", className: "cms-button cms-button--primary", onClick: s, children: d.returnToCall }),
713
- /* @__PURE__ */ e("button", { type: "button", className: "cms-call-bar__icon cms-call-bar__icon--hang-up", "aria-label": d.hangUp, onClick: m, children: /* @__PURE__ */ e(y, { name: "phone-off" }) })
1967
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-call-bar__icon cms-call-bar__icon--hang-up", "aria-label": d.hangUp, onClick: a, children: /* @__PURE__ */ e(B, { name: "phone-off" }) })
714
1968
  ] })
715
1969
  ] });
716
1970
  }
717
- function xe({ mark: l, product: n, headline: a, lead: c, features: s = [], children: m }) {
718
- return /* @__PURE__ */ i("div", { className: "cms-signin", children: [
719
- /* @__PURE__ */ i("aside", { className: "cms-signin__brand", children: [
720
- /* @__PURE__ */ i("p", { className: "cms-signin__logo", children: [
721
- /* @__PURE__ */ e("span", { className: "cms-signin__mark", "aria-hidden": "true", children: l }),
722
- n
1971
+ function ul({ mark: n, product: t, headline: l, lead: r, features: s = [], children: a }) {
1972
+ return /* @__PURE__ */ c("div", { className: "cms-signin", children: [
1973
+ /* @__PURE__ */ c("aside", { className: "cms-signin__brand", children: [
1974
+ /* @__PURE__ */ c("p", { className: "cms-signin__logo", children: [
1975
+ /* @__PURE__ */ e("span", { className: "cms-signin__mark", "aria-hidden": "true", children: n }),
1976
+ t
723
1977
  ] }),
724
- /* @__PURE__ */ i("div", { className: "cms-signin__pitch", children: [
725
- /* @__PURE__ */ e("p", { className: "cms-signin__headline", children: a }),
726
- /* @__PURE__ */ e("p", { className: "cms-signin__lead", children: c }),
727
- s.length ? /* @__PURE__ */ e("ul", { className: "cms-signin__features", children: s.map((r) => /* @__PURE__ */ i("li", { children: [
728
- /* @__PURE__ */ e(y, { name: r.icon, size: 18 }),
729
- r.label
730
- ] }, r.label)) }) : null
1978
+ /* @__PURE__ */ c("div", { className: "cms-signin__pitch", children: [
1979
+ /* @__PURE__ */ e("p", { className: "cms-signin__headline", children: l }),
1980
+ /* @__PURE__ */ e("p", { className: "cms-signin__lead", children: r }),
1981
+ s.length ? /* @__PURE__ */ e("ul", { className: "cms-signin__features", children: s.map((h) => /* @__PURE__ */ c("li", { children: [
1982
+ /* @__PURE__ */ e(B, { name: h.icon, size: 18 }),
1983
+ h.label
1984
+ ] }, h.label)) }) : null
731
1985
  ] })
732
1986
  ] }),
733
- /* @__PURE__ */ e("main", { className: "cms-signin__form", children: m })
1987
+ /* @__PURE__ */ e("main", { className: "cms-signin__form", children: a })
734
1988
  ] });
735
1989
  }
736
- const J = {
1990
+ const gt = {
737
1991
  title: "Sign in",
738
1992
  identifier: "Email or username",
739
1993
  identifierPlaceholder: "name@example.com",
@@ -745,293 +1999,818 @@ const J = {
745
1999
  newHere: "New here?",
746
2000
  create: "Create an account"
747
2001
  };
748
- function Ae({ server: l, onSubmit: n, forgotHref: a, createHref: c, error: s, busy: m, labels: r }) {
749
- const d = L(J, r), u = E(), [h, t] = C(""), [f, o] = C(""), [p, b] = C(!1);
750
- return /* @__PURE__ */ i("form", { className: "cms-signin-form", onSubmit: (_) => {
751
- _.preventDefault(), n(h, f);
752
- }, "aria-describedby": s ? `${u}-error` : void 0, children: [
2002
+ function ml({ server: n, onSubmit: t, forgotHref: l, createHref: r, error: s, busy: a, labels: h }) {
2003
+ const d = qe(gt, h), m = fe(), [b, i] = D(""), [g, f] = D(""), [v, u] = D(!1);
2004
+ return /* @__PURE__ */ c("form", { className: "cms-signin-form", onSubmit: (S) => {
2005
+ S.preventDefault(), t(b, g);
2006
+ }, "aria-describedby": s ? `${m}-error` : void 0, children: [
753
2007
  /* @__PURE__ */ e("h1", { className: "cms-signin-form__title", children: d.title }),
754
- /* @__PURE__ */ i("p", { className: "cms-signin-form__server", children: [
755
- /* @__PURE__ */ e(y, { name: "server", size: 18 }),
756
- l
2008
+ /* @__PURE__ */ c("p", { className: "cms-signin-form__server", children: [
2009
+ /* @__PURE__ */ e(B, { name: "server", size: 18 }),
2010
+ n
757
2011
  ] }),
758
- /* @__PURE__ */ e("label", { className: "cms-signin-form__label", htmlFor: `${u}-identifier`, children: d.identifier }),
2012
+ /* @__PURE__ */ e("label", { className: "cms-signin-form__label", htmlFor: `${m}-identifier`, children: d.identifier }),
759
2013
  /* @__PURE__ */ e(
760
2014
  "input",
761
2015
  {
762
- id: `${u}-identifier`,
763
- className: "cms-field",
2016
+ id: `${m}-identifier`,
2017
+ className: "cms-signin-form__input",
764
2018
  type: "text",
765
2019
  autoComplete: "username",
766
2020
  placeholder: d.identifierPlaceholder,
767
- value: h,
768
- onChange: (_) => t(_.target.value),
2021
+ value: b,
2022
+ onChange: (S) => i(S.target.value),
769
2023
  required: !0
770
2024
  }
771
2025
  ),
772
- /* @__PURE__ */ e("label", { className: "cms-signin-form__label", htmlFor: `${u}-password`, children: d.password }),
773
- /* @__PURE__ */ i("span", { className: "cms-signin-form__password", children: [
2026
+ /* @__PURE__ */ e("label", { className: "cms-signin-form__label", htmlFor: `${m}-password`, children: d.password }),
2027
+ /* @__PURE__ */ c("span", { className: "cms-signin-form__password", children: [
774
2028
  /* @__PURE__ */ e(
775
2029
  "input",
776
2030
  {
777
- id: `${u}-password`,
778
- className: "cms-field",
779
- type: p ? "text" : "password",
2031
+ id: `${m}-password`,
2032
+ className: "cms-signin-form__input",
2033
+ type: v ? "text" : "password",
780
2034
  autoComplete: "current-password",
781
- value: f,
782
- onChange: (_) => o(_.target.value),
2035
+ value: g,
2036
+ onChange: (S) => f(S.target.value),
783
2037
  required: !0
784
2038
  }
785
2039
  ),
786
- /* @__PURE__ */ e("button", { type: "button", className: "cms-signin-form__show", "aria-pressed": p, onClick: () => b((_) => !_), children: p ? d.hide : d.show })
2040
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-signin-form__show", "aria-pressed": v, onClick: () => u((S) => !S), children: v ? d.hide : d.show })
787
2041
  ] }),
788
- a ? /* @__PURE__ */ e("a", { className: "cms-signin-form__forgot", href: a, children: d.forgot }) : null,
789
- s ? /* @__PURE__ */ e("p", { id: `${u}-error`, className: "cms-signin-form__error", role: "alert", children: s }) : null,
790
- /* @__PURE__ */ e("button", { type: "submit", className: "cms-button cms-button--chrome cms-signin-form__submit", disabled: m, "aria-busy": m || void 0, children: d.submit }),
791
- c ? /* @__PURE__ */ i(g, { children: [
2042
+ l ? /* @__PURE__ */ e("a", { className: "cms-signin-form__forgot", href: l, children: d.forgot }) : null,
2043
+ s ? /* @__PURE__ */ e("p", { id: `${m}-error`, className: "cms-signin-form__error", role: "alert", children: s }) : null,
2044
+ /* @__PURE__ */ e("button", { type: "submit", className: "cms-button cms-button--chrome cms-signin-form__submit", disabled: a, "aria-busy": a || void 0, children: d.submit }),
2045
+ r ? /* @__PURE__ */ c($, { children: [
792
2046
  /* @__PURE__ */ e("p", { className: "cms-signin-form__or", children: /* @__PURE__ */ e("span", { children: d.newHere }) }),
793
- /* @__PURE__ */ e("a", { className: "cms-button cms-signin-form__create", href: c, children: d.create })
2047
+ /* @__PURE__ */ e("a", { className: "cms-button cms-signin-form__create", href: r, children: d.create })
794
2048
  ] }) : null
795
2049
  ] });
796
2050
  }
797
- function Ee({ label: l, rows: n, error: a, onRetry: c, loadingText: s = "Loading", emptyTitle: m = "Nothing here yet", emptyHint: r, selected: d, onOpen: u, onRowMenu: h }) {
798
- const t = x([]);
799
- if (a != null) return /* @__PURE__ */ e(q, { message: a, onRetry: c });
800
- if (n === null) return /* @__PURE__ */ e(U, { what: s, layout: "block" });
801
- if (n.length === 0) return /* @__PURE__ */ e(W, { title: m, hint: r });
802
- const f = (o, p, b) => {
803
- var N;
804
- if (o.key === "ArrowDown" || o.key === "ArrowUp")
805
- o.preventDefault(), (N = t.current[Math.min(n.length - 1, Math.max(0, p + (o.key === "ArrowDown" ? 1 : -1)))]) == null || N.focus();
806
- else if (o.key === "Enter")
807
- u == null || u(b);
808
- else if ((o.key === "ContextMenu" || o.shiftKey && o.key === "F10") && h) {
809
- o.preventDefault();
810
- const _ = o.currentTarget.getBoundingClientRect();
811
- h(b, { x: _.left + 16, y: _.bottom });
2051
+ const yt = { name: (n, t) => `${n}: ${t}` };
2052
+ function Cn(n) {
2053
+ const t = dn(n);
2054
+ return t === un(n.options, n.defaultValue) ? null : t ?? null;
2055
+ }
2056
+ function dn({ options: n, value: t, defaultValue: l }) {
2057
+ return n.find((r) => r.id === t) ?? un(n, l);
2058
+ }
2059
+ function Sn(n) {
2060
+ var t;
2061
+ return qe(yt, n.labels).name(n.label, ((t = dn(n)) == null ? void 0 : t.label) ?? "");
2062
+ }
2063
+ function En(n, t) {
2064
+ const l = dn(n);
2065
+ return n.options.map((r) => ({
2066
+ id: r.id,
2067
+ label: r.label,
2068
+ offer: { offered: !0, locked: !1 },
2069
+ checked: r === l,
2070
+ ...t === void 0 ? {} : { group: t },
2071
+ onSelect: () => {
2072
+ r !== l && n.onChange(r.id);
812
2073
  }
2074
+ }));
2075
+ }
2076
+ function un(n, t) {
2077
+ return n.find((l) => l.id === t) ?? n[0];
2078
+ }
2079
+ function An(n) {
2080
+ var a;
2081
+ const t = P(null), l = (n == null ? void 0 : n.value) ?? null, s = n === void 0 || n.options.some((h) => h.id === n.value) ? null : ((a = un(n.options, n.defaultValue)) == null ? void 0 : a.id) ?? null;
2082
+ ee(() => {
2083
+ s === null ? t.current = null : t.current !== l && (t.current = l, n == null || n.onChange(s));
2084
+ }, [s, l]);
2085
+ }
2086
+ function Tn({ iconOnly: n = !1, onOpenChange: t, ...l }) {
2087
+ return l.options.length < 2 ? null : /* @__PURE__ */ e(wt, { ...l, iconOnly: n, onOpenChange: t });
2088
+ }
2089
+ function wt({ iconOnly: n, onOpenChange: t, ...l }) {
2090
+ const [r, s] = D(null), a = Ie(() => s(null), []), h = P(!1), d = r !== null;
2091
+ ee(() => (t == null || t(d), () => t == null ? void 0 : t(!1)), [d, t]);
2092
+ const m = Cn(l), b = m !== null && !n, i = Sn(l), g = (f, v) => {
2093
+ const u = f.getBoundingClientRect();
2094
+ s({ x: u.left, y: u.bottom + 4, focus: v });
813
2095
  };
814
- return /* @__PURE__ */ e("ul", { className: "cms-list", role: "listbox", "aria-label": l, children: n.map((o, p) => {
815
- const b = o.id === d;
816
- return /* @__PURE__ */ i(
817
- "li",
2096
+ return /* @__PURE__ */ c($, { children: [
2097
+ /* @__PURE__ */ e(
2098
+ "button",
818
2099
  {
819
- ref: (N) => {
820
- t.current[p] = N;
2100
+ type: "button",
2101
+ className: H("cms-filter-menu", m !== null && "cms-filter-menu--active", b && "cms-filter-menu--named"),
2102
+ "aria-haspopup": "menu",
2103
+ "aria-expanded": d,
2104
+ "aria-label": i,
2105
+ title: i,
2106
+ onMouseDown: () => {
2107
+ h.current = d;
821
2108
  },
822
- role: "option",
823
- "aria-selected": b,
824
- tabIndex: b || d == null && p === 0 ? 0 : -1,
825
- className: v("cms-list__row", b && "is-selected"),
826
- onClick: () => u == null ? void 0 : u(o.id),
827
- onKeyDown: (N) => f(N, p, o.id),
828
- onContextMenu: h ? (N) => {
829
- N.preventDefault(), h(o.id, { x: N.clientX, y: N.clientY });
830
- } : void 0,
831
- children: [
832
- o.lead != null ? /* @__PURE__ */ e("span", { className: "cms-list__lead", children: o.lead }) : null,
833
- /* @__PURE__ */ i("span", { className: "cms-list__text", children: [
834
- /* @__PURE__ */ e("span", { className: "cms-list__primary", children: o.primary }),
835
- o.secondary != null ? /* @__PURE__ */ e("span", { className: "cms-list__secondary", children: o.secondary }) : null
836
- ] }),
837
- o.meta != null ? /* @__PURE__ */ e("span", { className: "cms-list__meta", children: o.meta }) : null
838
- ]
839
- },
840
- o.id
841
- );
842
- }) });
2109
+ onClick: (f) => {
2110
+ d || h.current ? a() : g(f.currentTarget, "current"), h.current = !1;
2111
+ },
2112
+ onKeyDown: (f) => {
2113
+ h.current = !1, (f.key === "ArrowDown" || f.key === "ArrowUp") && (f.preventDefault(), g(f.currentTarget, f.key === "ArrowUp" ? "last" : "current"));
2114
+ },
2115
+ children: b ? /* @__PURE__ */ c($, { children: [
2116
+ /* @__PURE__ */ e("span", { className: "cms-filter-menu__choice", children: m.label }),
2117
+ /* @__PURE__ */ e(B, { name: "chevron-down", size: 16 })
2118
+ ] }) : /* @__PURE__ */ e(B, { name: "funnel" })
2119
+ }
2120
+ ),
2121
+ /* @__PURE__ */ e(
2122
+ Ke,
2123
+ {
2124
+ at: r,
2125
+ items: En(l),
2126
+ onClose: a,
2127
+ label: l.label,
2128
+ focus: r == null ? void 0 : r.focus
2129
+ }
2130
+ )
2131
+ ] });
2132
+ }
2133
+ function Nt(n) {
2134
+ return An(n), /* @__PURE__ */ e(Tn, { ...n });
2135
+ }
2136
+ function hl({ leading: n, name: t, filter: l }) {
2137
+ return /* @__PURE__ */ c("div", { className: "cms-list-head", children: [
2138
+ n != null ? /* @__PURE__ */ e("span", { className: "cms-list-head__leading", children: n }) : null,
2139
+ /* @__PURE__ */ e("h2", { className: "cms-list-head__name", title: t, children: t }),
2140
+ l !== void 0 ? /* @__PURE__ */ e(Nt, { ...l }) : null
2141
+ ] });
2142
+ }
2143
+ const yn = { bare: /* @__PURE__ */ new Set(), hidden: /* @__PURE__ */ new Set() }, wn = (n, t) => n.size === t.size && [...n].every((l) => t.has(l));
2144
+ function kt(n) {
2145
+ const t = /* @__PURE__ */ new Map();
2146
+ for (const l of n) t.set(l.group, [...t.get(l.group) ?? [], l]);
2147
+ return [...t.values()];
843
2148
  }
844
- function Le({ at: l, items: n, onClose: a, label: c = "Actions" }) {
845
- const s = x(null), m = x(null), [r, d] = C(l), u = n.filter((t) => t.offer.offered);
846
- if (R(() => {
847
- if (!l) return;
848
- const t = s.current, f = (t == null ? void 0 : t.offsetWidth) ?? 0, o = (t == null ? void 0 : t.offsetHeight) ?? 0;
849
- d({ x: Math.max(0, Math.min(l.x, window.innerWidth - f)), y: Math.max(0, Math.min(l.y, window.innerHeight - o)) });
850
- }, [l]), D(() => {
851
- var f, o;
852
- if (!l) return;
853
- m.current = document.activeElement, (o = (f = s.current) == null ? void 0 : f.querySelector('[role="menuitem"]:not([aria-disabled="true"])')) == null || o.focus();
854
- const t = (p) => {
855
- var b;
856
- (b = s.current) != null && b.contains(p.target) || a();
2149
+ function xt(n) {
2150
+ const t = /* @__PURE__ */ new Map();
2151
+ for (const l of n) l.overflow !== void 0 && l.overflow !== 0 && t.set(l.overflow, [...t.get(l.overflow) ?? [], l.id]);
2152
+ return [...t.entries()].sort(([l], [r]) => l - r).map(([, l]) => l);
2153
+ }
2154
+ function fl({ label: n, actions: t, onAction: l, status: r, moreLabel: s, leading: a }) {
2155
+ var G;
2156
+ const h = t.filter((p) => p.entries === void 0 || p.entries.length > 0), d = P(null), m = P(null), b = P(null), [i, g] = D(yn), [f, v] = D(null), [u, y] = D("first"), [S, T] = D(null), [M, E] = D(null), _ = kt(h), N = _.flat(), I = ((G = N.find((p) => p.primary === !0 && p.overflow !== 0)) == null ? void 0 : G.id) ?? null, K = xt(h.filter((p) => p.id !== I)), z = N.filter((p) => p.overflow === 0), k = N.filter((p) => p.overflow !== 0), F = z.length === 1 ? z[0] ?? null : null, U = JSON.stringify([h.map((p) => [p.id, p.label, p.icon, p.group, p.overflow ?? null, p.primary === !0, p.entries !== void 0]), r ?? "", a !== void 0]), Y = (p) => /* @__PURE__ */ new Set([...z.filter((L) => L !== F || p.size > 0).map((L) => L.id), ...p]), W = Ie(() => {
2157
+ const p = d.current, L = m.current;
2158
+ if (p === null || L === null) return;
2159
+ const V = getComputedStyle(p), me = parseFloat(V.columnGap || "0") || 0, ae = p.clientWidth - (parseFloat(V.paddingLeft) || 0) - (parseFloat(V.paddingRight) || 0), he = (A) => {
2160
+ var x;
2161
+ return ((x = L.querySelector(A)) == null ? void 0 : x.getBoundingClientRect().width) ?? 0;
2162
+ }, Se = he('[data-measure="leading"]'), We = he('[data-measure="separator"]'), Be = he('[data-measure="more"]'), Te = (A, x) => he(`[data-measure="${x ? "full" : "icon"}"][data-measure-action="${CSS.escape(A)}"]`), Ee = (A, x) => {
2163
+ const O = Y(x), se = F !== null && !O.has(F.id) ? F : null, Q = _.map((He) => He.filter((q) => !O.has(q.id) && q !== se)).filter((He) => He.length > 0), ke = [...Q.flat(), ...se !== null ? [se] : []], Fe = ke.length + (Q.length - 1) + (O.size > 0 ? 1 : 0) + (Se > 0 ? 1 : 0);
2164
+ return Se + ke.reduce((He, q) => He + Te(q.id, !A.has(q.id)), 0) + We * Math.max(0, Q.length - 1) + (O.size > 0 ? Be : 0) + me * Math.max(0, Fe - 1);
2165
+ }, R = k.filter((A) => A.id !== I && !K.some((x) => x.includes(A.id))).map((A) => A.id), J = [...K, ...[...R].reverse().map((A) => [A]), ...I !== null ? [[I]] : []], Ne = [...F !== null ? [[F.id]] : [], ...J];
2166
+ let de = null;
2167
+ if (Ee(/* @__PURE__ */ new Set(), /* @__PURE__ */ new Set()) <= ae) de = yn;
2168
+ else {
2169
+ const A = /* @__PURE__ */ new Set();
2170
+ for (const x of Ne) {
2171
+ for (const O of x) A.add(O);
2172
+ if (Ee(A, /* @__PURE__ */ new Set()) <= ae) {
2173
+ de = { bare: A, hidden: /* @__PURE__ */ new Set() };
2174
+ break;
2175
+ }
2176
+ }
2177
+ }
2178
+ if (de === null) {
2179
+ const A = new Set(Ne.flat()), x = /* @__PURE__ */ new Set(), O = () => x.size + z.length >= 2;
2180
+ for (const se of J) {
2181
+ for (const Q of se) x.add(Q);
2182
+ if (O() && Ee(A, x) <= ae) break;
2183
+ }
2184
+ O() || x.clear(), de = { bare: A, hidden: x };
2185
+ }
2186
+ const o = de;
2187
+ g((A) => wn(A.bare, o.bare) && wn(A.hidden, o.hidden) ? A : o);
2188
+ }, [U]);
2189
+ $e(W, [W]), ee(() => {
2190
+ const p = d.current;
2191
+ if (p === null || typeof ResizeObserver > "u") return;
2192
+ const L = new ResizeObserver(() => W());
2193
+ return L.observe(p), () => L.disconnect();
2194
+ }, [W]), ee(() => {
2195
+ const p = typeof document > "u" ? void 0 : document.fonts;
2196
+ if (p === void 0) return;
2197
+ let L = !0;
2198
+ const V = () => {
2199
+ L && W();
857
2200
  };
858
- return document.addEventListener("mousedown", t), () => {
859
- var p, b;
860
- document.removeEventListener("mousedown", t), (b = (p = m.current) == null ? void 0 : p.focus) == null || b.call(p);
2201
+ return p.ready.then(V), p.addEventListener("loadingdone", V), () => {
2202
+ L = !1, p.removeEventListener("loadingdone", V);
861
2203
  };
862
- }, [l, a]), !l || u.length === 0) return null;
863
- const h = (t) => {
864
- var p, b;
865
- const f = Array.from(((p = s.current) == null ? void 0 : p.querySelectorAll('[role="menuitem"]')) ?? []), o = f.indexOf(document.activeElement);
866
- if (t.key === "Escape" || t.key === "Tab")
867
- t.preventDefault(), a();
868
- else if (t.key === "ArrowDown" || t.key === "ArrowUp") {
869
- t.preventDefault();
870
- const N = t.key === "ArrowDown" ? 1 : -1;
871
- (b = f[(o + N + f.length) % f.length]) == null || b.focus();
2204
+ }, [W]);
2205
+ const j = Y(i.hidden), X = F !== null && !j.has(F.id) ? F : null, ne = (p) => j.has(p.id) || p === X, _e = [..._.map((p) => p.filter((L) => !ne(L))).filter((p) => p.length > 0).flat(), ...X !== null ? [X] : []], oe = (p) => N.find((L) => L.id === p), ue = [...K.flat(), ...k.filter((p) => p.id !== I && !K.some((L) => L.includes(p.id))).map((p) => p.id).reverse()], Ce = [
2206
+ ...I !== null && i.hidden.has(I) ? [oe(I)] : [],
2207
+ ...ue.filter((p) => i.hidden.has(p)).map(oe),
2208
+ ...j.size > 0 ? z : []
2209
+ ].filter((p) => p !== void 0 && j.has(p.id)), pe = new Set(k.filter((p) => !K.some((L) => L.includes(p.id))).map((p) => p.id)), le = [..._e.map((p) => p.id), ...Ce.length > 0 ? ["more"] : []], be = S !== null && le.includes(S) ? S : le[0] ?? null, ve = (p) => {
2210
+ var ae, he;
2211
+ const L = le.indexOf(be ?? "");
2212
+ let V = null;
2213
+ if (p.key === "ArrowRight" ? V = Math.min(le.length - 1, L + 1) : p.key === "ArrowLeft" ? V = Math.max(0, L - 1) : p.key === "Home" ? V = 0 : p.key === "End" ? V = le.length - 1 : p.key === "Escape" && E(be), V === null) return;
2214
+ p.preventDefault();
2215
+ const me = le[V] ?? null;
2216
+ T(me), (he = (ae = d.current) == null ? void 0 : ae.querySelector(`[data-stop="${CSS.escape(me ?? "")}"]`)) == null || he.focus();
2217
+ }, ye = Ce.map((p) => ({
2218
+ id: p.id,
2219
+ label: /* @__PURE__ */ c($, { children: [
2220
+ /* @__PURE__ */ e(je, { name: p.icon }),
2221
+ p.label
2222
+ ] }),
2223
+ offer: p.disabled ? { offered: !0, locked: !1, refusal: p.reason ?? "" } : { offered: !0, locked: !1 },
2224
+ ...p.danger ? { danger: !0 } : {},
2225
+ onSelect: () => {
2226
+ var V;
2227
+ if (p.disabled || p.busy) return;
2228
+ if (p.entries === void 0) {
2229
+ l(p.id);
2230
+ return;
2231
+ }
2232
+ const L = (V = b.current) == null ? void 0 : V.getBoundingClientRect();
2233
+ y("first"), v({ which: p.id, x: (L == null ? void 0 : L.left) ?? 0, y: (L == null ? void 0 : L.bottom) ?? 0 });
872
2234
  }
2235
+ })), te = f === null || f.which === "more" ? void 0 : N.find((p) => p.id === f.which), we = ((te == null ? void 0 : te.entries) ?? []).map((p) => ({
2236
+ id: p.id,
2237
+ label: /* @__PURE__ */ c($, { children: [
2238
+ p.icon !== void 0 ? /* @__PURE__ */ e(je, { name: p.icon }) : null,
2239
+ p.label
2240
+ ] }),
2241
+ offer: p.disabled ? { offered: !0, locked: !1, refusal: p.reason ?? "" } : { offered: !0, locked: !1 },
2242
+ ...p.danger ? { danger: !0 } : {},
2243
+ onSelect: () => {
2244
+ p.disabled || l(p.id);
2245
+ }
2246
+ })), w = (p, L, V) => {
2247
+ const me = L.getBoundingClientRect();
2248
+ y(V), v({ which: p, x: me.left, y: me.bottom });
2249
+ }, C = k.length + (F !== null ? 1 : 0), Z = (p) => /* @__PURE__ */ e(
2250
+ Mt,
2251
+ {
2252
+ action: p,
2253
+ labels: !i.bare.has(p.id),
2254
+ overflowed: j.has(p.id),
2255
+ pinned: pe.has(p.id),
2256
+ tabbable: be === p.id,
2257
+ tipOff: M === p.id,
2258
+ menuOpen: (f == null ? void 0 : f.which) === p.id,
2259
+ onChoose: (L, V) => {
2260
+ p.entries === void 0 ? l(p.id) : (f == null ? void 0 : f.which) === p.id && V === null ? v(null) : w(p.id, L, V ?? "first");
2261
+ },
2262
+ onFocus: () => {
2263
+ T(p.id), E(null);
2264
+ }
2265
+ },
2266
+ p.id
2267
+ );
2268
+ return /* @__PURE__ */ c(
2269
+ "div",
2270
+ {
2271
+ ref: d,
2272
+ role: "toolbar",
2273
+ "aria-label": n,
2274
+ className: H(
2275
+ "cms-pane-toolbar",
2276
+ C > 0 && i.bare.size >= C && "cms-pane-toolbar--labels-hidden",
2277
+ i.bare.size > 0 && i.bare.size < C && "cms-pane-toolbar--labels-partly-hidden"
2278
+ ),
2279
+ onKeyDown: ve,
2280
+ children: [
2281
+ a !== void 0 ? /* @__PURE__ */ e("div", { className: "cms-pane-toolbar__leading", children: a }) : null,
2282
+ _.map((p, L) => {
2283
+ const V = p.filter((ae) => !ne(ae)), me = _.slice(0, L).some((ae) => ae.some((he) => !ne(he)));
2284
+ return /* @__PURE__ */ c("div", { className: "cms-pane-toolbar__group-wrap", children: [
2285
+ V.length > 0 && me ? /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__separator", role: "separator", "aria-orientation": "vertical" }) : null,
2286
+ /* @__PURE__ */ e("div", { className: "cms-pane-toolbar__group", hidden: V.length === 0, children: p.filter((ae) => ae !== X).map((ae) => Z(ae)) })
2287
+ ] }, L);
2288
+ }),
2289
+ X !== null ? /* @__PURE__ */ e("div", { className: "cms-pane-toolbar__group cms-pane-toolbar__lone", children: Z(X) }) : null,
2290
+ Ce.length > 0 ? /* @__PURE__ */ e(
2291
+ "button",
2292
+ {
2293
+ ref: b,
2294
+ type: "button",
2295
+ className: "cms-icon-button cms-pane-toolbar__more",
2296
+ "data-stop": "more",
2297
+ "aria-label": s,
2298
+ title: s,
2299
+ "aria-haspopup": "menu",
2300
+ "aria-expanded": (f == null ? void 0 : f.which) === "more",
2301
+ tabIndex: be === "more" ? 0 : -1,
2302
+ onFocus: () => T("more"),
2303
+ onClick: (p) => {
2304
+ (f == null ? void 0 : f.which) === "more" ? v(null) : w("more", p.currentTarget, "first");
2305
+ },
2306
+ onKeyDown: (p) => {
2307
+ (p.key === "ArrowDown" || p.key === "ArrowUp") && (p.preventDefault(), p.stopPropagation(), w("more", p.currentTarget, p.key === "ArrowUp" ? "last" : "first"));
2308
+ },
2309
+ children: /* @__PURE__ */ e(B, { name: "more" })
2310
+ }
2311
+ ) : null,
2312
+ r !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__status", title: r, children: r }) : null,
2313
+ /* @__PURE__ */ e(Ke, { at: (f == null ? void 0 : f.which) === "more" ? f : null, items: ye, onClose: () => v(null), label: s, focus: u }),
2314
+ /* @__PURE__ */ e(Ke, { at: te !== void 0 ? f : null, items: we, onClose: () => v(null), label: (te == null ? void 0 : te.label) ?? "", focus: u }),
2315
+ /* @__PURE__ */ c("div", { ref: m, className: "cms-pane-toolbar__measure", "aria-hidden": "true", children: [
2316
+ a !== void 0 ? /* @__PURE__ */ e("div", { "data-measure": "leading", children: a }) : null,
2317
+ /* @__PURE__ */ e("span", { "data-measure": "separator", className: "cms-pane-toolbar__separator" }),
2318
+ /* @__PURE__ */ e("span", { "data-measure": "more", className: "cms-icon-button cms-pane-toolbar__more", children: /* @__PURE__ */ e(B, { name: "more" }) }),
2319
+ N.map((p) => /* @__PURE__ */ c("span", { children: [
2320
+ /* @__PURE__ */ c("span", { "data-measure": "full", "data-measure-action": p.id, className: H("cms-pane-toolbar__action", p.entries !== void 0 && "cms-pane-toolbar__action--menu"), children: [
2321
+ /* @__PURE__ */ e(je, { name: p.icon }),
2322
+ /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__label", children: p.label }),
2323
+ p.entries !== void 0 ? /* @__PURE__ */ e(nn, {}) : null
2324
+ ] }),
2325
+ /* @__PURE__ */ c("span", { "data-measure": "icon", "data-measure-action": p.id, className: H("cms-pane-toolbar__action", Ue(p.icon) !== null && "cms-pane-toolbar__action--bare", p.entries !== void 0 && "cms-pane-toolbar__action--menu"), children: [
2326
+ Ue(p.icon) !== null ? /* @__PURE__ */ e(je, { name: p.icon }) : /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__label", children: p.label }),
2327
+ p.entries !== void 0 ? /* @__PURE__ */ e(nn, {}) : null
2328
+ ] })
2329
+ ] }, p.id))
2330
+ ] })
2331
+ ]
2332
+ }
2333
+ );
2334
+ }
2335
+ const Oe = "tip";
2336
+ function Mt({ action: n, labels: t, overflowed: l, pinned: r, tabbable: s, tipOff: a, menuOpen: h, onChoose: d, onFocus: m }) {
2337
+ const [b, i] = D(!1);
2338
+ ee(() => {
2339
+ if (!n.busy) {
2340
+ i(!1);
2341
+ return;
2342
+ }
2343
+ const _ = setTimeout(() => i(!0), Je);
2344
+ return () => clearTimeout(_);
2345
+ }, [n.busy]);
2346
+ const g = Ue(n.icon) === null, f = t || g, v = n.disabled && n.reason ? n.reason : null, u = v ?? (f ? null : n.label), y = fe(), [S, T] = D(!1), M = an(), E = n.entries !== void 0;
2347
+ return /* @__PURE__ */ c(
2348
+ "button",
2349
+ {
2350
+ type: "button",
2351
+ className: H("cms-pane-toolbar__action", !f && "cms-pane-toolbar__action--bare", g && "cms-pane-toolbar__action--text", E && "cms-pane-toolbar__action--menu", n.danger && "is-danger"),
2352
+ "data-action": n.id,
2353
+ "data-stop": n.id,
2354
+ ...l ? { "data-overflowed": "" } : {},
2355
+ ...r ? { "data-pinned": "" } : {},
2356
+ hidden: l,
2357
+ "aria-label": n.label,
2358
+ "aria-disabled": n.disabled || void 0,
2359
+ "aria-busy": n.busy || void 0,
2360
+ ...E ? { "aria-haspopup": "menu", "aria-expanded": h } : {},
2361
+ ...v === null ? {} : { "aria-describedby": y },
2362
+ ...S && v !== null ? { "data-reason-shown": "" } : {},
2363
+ ...M.dismissed(Oe) ? { "data-tip-dismissed": "" } : {},
2364
+ tabIndex: s ? 0 : -1,
2365
+ onFocus: () => {
2366
+ m(), M.focusIn(Oe);
2367
+ },
2368
+ onBlur: () => {
2369
+ T(!1), M.focusOut(Oe);
2370
+ },
2371
+ onMouseEnter: () => M.pointerIn(Oe),
2372
+ onMouseLeave: () => M.pointerOut(Oe),
2373
+ onKeyDown: (_) => {
2374
+ _.key === "Escape" && (T(!1), M.dismiss(Oe)), E && (_.key === "ArrowDown" || _.key === "ArrowUp") && (_.preventDefault(), v !== null ? T(!0) : !n.disabled && !n.busy && d(_.currentTarget, _.key === "ArrowUp" ? "last" : "first"));
2375
+ },
2376
+ onClick: (_) => {
2377
+ v !== null ? (T(!0), M.show(Oe)) : !n.disabled && !n.busy && d(_.currentTarget, null);
2378
+ },
2379
+ children: [
2380
+ b ? /* @__PURE__ */ e(re, { name: "spinner" }) : /* @__PURE__ */ e(je, { name: n.icon }),
2381
+ f ? /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__label", "aria-hidden": "true", children: n.label }) : null,
2382
+ E ? /* @__PURE__ */ e(nn, {}) : null,
2383
+ v !== null || u !== null && !a ? /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__tip", role: "tooltip", id: y, children: u }) : null
2384
+ ]
2385
+ }
2386
+ );
2387
+ }
2388
+ function nn() {
2389
+ return /* @__PURE__ */ e("span", { className: "cms-pane-toolbar__chevron", "aria-hidden": "true", children: /* @__PURE__ */ e(B, { name: "chevron-down", size: 14 }) });
2390
+ }
2391
+ function je({ name: n }) {
2392
+ const t = Ue(n);
2393
+ return t === null ? null : /* @__PURE__ */ e(B, { name: t, size: 18 });
2394
+ }
2395
+ function pl({ title: n, body: t = null, time: l = null, unread: r, unreadLabel: s, expandLabel: a, collapseLabel: h, action: d = null, onRead: m, leading: b }) {
2396
+ const [i, g] = D(!1), f = fe(), v = () => {
2397
+ r && m();
2398
+ }, u = (d == null ? void 0 : d.presentation) === "row" && d.onAction !== void 0, y = (d == null ? void 0 : d.presentation) === "button" && d.onAction !== void 0 ? d : null, S = () => {
2399
+ var T;
2400
+ v(), u && ((T = d.onAction) == null || T.call(d));
873
2401
  };
874
- return F(
875
- /* @__PURE__ */ e(
2402
+ return /* @__PURE__ */ c("article", { className: H("cms-notification", r && "is-unread", i && "is-expanded", u && "is-row-action"), "data-state": r ? "unread" : "read", children: [
2403
+ /* @__PURE__ */ c(
876
2404
  "div",
877
2405
  {
878
- ref: s,
879
- className: "cms-menu",
880
- role: "menu",
881
- "aria-label": c,
882
- style: { left: (r ?? l).x, top: (r ?? l).y },
883
- onKeyDown: h,
884
- onContextMenu: (t) => t.preventDefault(),
885
- children: u.map((t) => {
886
- const f = t.offer.refusal !== void 0;
887
- return /* @__PURE__ */ i(
888
- "div",
889
- {
890
- role: "menuitem",
891
- tabIndex: -1,
892
- "aria-disabled": f || void 0,
893
- title: f ? t.offer.refusal : void 0,
894
- className: v("cms-menu__item", t.danger && "is-danger", t.offer.locked && "is-locked", f && "is-refused"),
895
- onClick: () => {
896
- f || (a(), t.onSelect());
897
- },
898
- onKeyDown: (o) => {
899
- (o.key === "Enter" || o.key === " ") && !f && (o.preventDefault(), a(), t.onSelect());
900
- },
901
- children: [
902
- t.offer.locked ? /* @__PURE__ */ e(k, { name: "lock" }) : null,
903
- /* @__PURE__ */ e("span", { className: "cms-menu__label", children: t.label }),
904
- f ? /* @__PURE__ */ e("span", { className: "cms-menu__refusal", children: t.offer.refusal }) : null
905
- ]
906
- },
907
- t.id
908
- );
909
- })
2406
+ className: "cms-notification__row",
2407
+ role: "button",
2408
+ tabIndex: 0,
2409
+ "aria-describedby": t === null ? void 0 : f,
2410
+ onClick: S,
2411
+ onKeyDown: (T) => {
2412
+ T.target !== T.currentTarget || T.key !== "Enter" && T.key !== " " || (T.preventDefault(), S());
2413
+ },
2414
+ children: [
2415
+ b != null ? /* @__PURE__ */ e("span", { className: "cms-notification__leading", children: b }) : null,
2416
+ /* @__PURE__ */ c("span", { className: "cms-notification__text", children: [
2417
+ /* @__PURE__ */ c("span", { className: "cms-notification__head", children: [
2418
+ /* @__PURE__ */ c("span", { className: "cms-notification__title", children: [
2419
+ r ? /* @__PURE__ */ c("span", { className: "cms-visually-hidden", children: [
2420
+ s,
2421
+ " "
2422
+ ] }) : null,
2423
+ n
2424
+ ] }),
2425
+ l !== null ? /* @__PURE__ */ e("span", { className: "cms-notification__time", children: l }) : null
2426
+ ] }),
2427
+ t !== null && t !== "" ? /* @__PURE__ */ e("span", { className: "cms-notification__body", id: f, children: t }) : null
2428
+ ] }),
2429
+ r ? /* @__PURE__ */ e("span", { className: "cms-notification__dot", "aria-hidden": "true" }) : null
2430
+ ]
910
2431
  }
911
2432
  ),
912
- document.body
913
- );
2433
+ t !== null && t !== "" ? /* @__PURE__ */ e(
2434
+ "button",
2435
+ {
2436
+ type: "button",
2437
+ className: "cms-notification__chevron",
2438
+ "aria-expanded": i,
2439
+ "aria-controls": f,
2440
+ "aria-label": i ? h : a,
2441
+ title: i ? h : a,
2442
+ onClick: () => {
2443
+ i || v(), g((T) => !T);
2444
+ },
2445
+ children: /* @__PURE__ */ e(B, { name: "chevron-down", size: 18 })
2446
+ }
2447
+ ) : null,
2448
+ y !== null ? /* @__PURE__ */ e(
2449
+ "button",
2450
+ {
2451
+ type: "button",
2452
+ className: "cms-button cms-notification__action",
2453
+ onClick: () => {
2454
+ var T;
2455
+ v(), (T = y.onAction) == null || T.call(y);
2456
+ },
2457
+ children: y.label
2458
+ }
2459
+ ) : null
2460
+ ] });
914
2461
  }
915
- function O(l) {
916
- return l === "allowed" || l === "elevate" || l === "denied";
2462
+ function Ct(n) {
2463
+ return n === "allowed" || n === "elevate" || n === "denied";
917
2464
  }
918
- function De(l, n) {
919
- if (!O(l))
920
- return n.showRefused ? { offered: !0, locked: !1, refusal: "not available: the server gave an answer this app does not know", unknown: !0 } : { offered: !1, locked: !1, unknown: !0 };
921
- switch (l) {
2465
+ function bl(n, t) {
2466
+ if (!Ct(n))
2467
+ return t.showRefused ? { offered: !0, locked: !1, refusal: "not available: the server gave an answer this app does not know", unknown: !0 } : { offered: !1, locked: !1, unknown: !0 };
2468
+ switch (n) {
922
2469
  case "allowed":
923
2470
  return { offered: !0, locked: !1 };
924
2471
  case "elevate":
925
- return n.elevates ? { offered: !0, locked: !0 } : { offered: !1, locked: !1 };
2472
+ return t.elevates ? { offered: !0, locked: !0 } : { offered: !1, locked: !1 };
926
2473
  case "denied":
927
- return n.showRefused ? { offered: !0, locked: !1, refusal: n.refusal ?? "not allowed" } : { offered: !1, locked: !1 };
2474
+ return t.showRefused ? { offered: !0, locked: !1, refusal: t.refusal ?? "not allowed" } : { offered: !1, locked: !1 };
928
2475
  }
929
2476
  }
930
- function ee(l, n) {
931
- if (!l) return;
932
- if (typeof l.get == "function") return l.get(n) ?? void 0;
933
- const a = l, c = Object.keys(a).find((s) => s.toLowerCase() === n.toLowerCase());
934
- return c === void 0 ? void 0 : a[c];
935
- }
936
- function le(l) {
937
- if (l && typeof l == "object") {
938
- const n = l;
939
- if (typeof n.detail == "string" && n.detail !== "") return n.detail;
940
- if (typeof n.title == "string" && n.title !== "") return n.title;
2477
+ function St(n, t) {
2478
+ if (!n) return;
2479
+ if (typeof n.get == "function") return n.get(t) ?? void 0;
2480
+ const l = n, r = Object.keys(l).find((s) => s.toLowerCase() === t.toLowerCase());
2481
+ return r === void 0 ? void 0 : l[r];
2482
+ }
2483
+ function Et(n) {
2484
+ if (n && typeof n == "object") {
2485
+ const t = n;
2486
+ if (typeof t.detail == "string" && t.detail !== "") return t.detail;
2487
+ if (typeof t.title == "string" && t.title !== "") return t.title;
941
2488
  }
942
2489
  }
943
- function $e(l, n, a, c) {
944
- if (l !== 403) return { kind: "none" };
945
- const s = le(a);
946
- return ee(n, "X-Elevation-Required") !== void 0 ? c.elevates ? { kind: "elevation-required", message: s ?? "This needs an elevated session." } : { kind: "refused", message: "This can only be done in the admin, in an elevated session." } : { kind: "refused", message: s ?? "The server refused this." };
947
- }
948
- const I = "coolms-kit:reread";
949
- function Se() {
950
- window.dispatchEvent(new Event(I));
951
- }
952
- function Te(l) {
953
- const [n, a] = C(void 0), [c, s] = C(void 0), [m, r] = C(!0), d = x(l);
954
- d.current = l;
955
- const u = x(0), h = V(() => {
956
- const t = ++u.current;
957
- r(!0), d.current().then(
958
- (f) => {
959
- t === u.current && (a(f), s(void 0), r(!1));
2490
+ function _l(n, t, l, r) {
2491
+ if (n !== 403) return { kind: "none" };
2492
+ const s = Et(l);
2493
+ return St(t, "X-Elevation-Required") !== void 0 ? r.elevates ? { kind: "elevation-required", message: s ?? "This needs an elevated session." } : { kind: "refused", message: "This can only be done in the admin, in an elevated session." } : { kind: "refused", message: s ?? "The server refused this." };
2494
+ }
2495
+ const tn = "coolms-kit:reread";
2496
+ function vl() {
2497
+ window.dispatchEvent(new Event(tn));
2498
+ }
2499
+ function gl(n) {
2500
+ const [t, l] = D(void 0), [r, s] = D(void 0), [a, h] = D(!0), d = P(n);
2501
+ d.current = n;
2502
+ const m = P(0), b = Ie(() => {
2503
+ const i = ++m.current;
2504
+ h(!0), d.current().then(
2505
+ (g) => {
2506
+ i === m.current && (l(g), s(void 0), h(!1));
960
2507
  },
961
- (f) => {
962
- t === u.current && (s(f), r(!1));
2508
+ (g) => {
2509
+ i === m.current && (s(g), h(!1));
963
2510
  }
964
2511
  );
965
2512
  }, []);
966
- return D(() => {
967
- h();
968
- const t = () => h();
969
- return window.addEventListener("focus", t), window.addEventListener(I, t), () => {
970
- window.removeEventListener("focus", t), window.removeEventListener(I, t);
2513
+ return ee(() => {
2514
+ b();
2515
+ const i = () => b();
2516
+ return window.addEventListener("focus", i), window.addEventListener(tn, i), () => {
2517
+ window.removeEventListener("focus", i), window.removeEventListener(tn, i);
971
2518
  };
972
- }, [h]), { value: n, error: c, loading: m, reread: h };
2519
+ }, [b]), { value: t, error: r, loading: a, reread: b };
973
2520
  }
974
- function Ie(l) {
975
- return l === 412 ? { conflict: !0, message: "Someone changed this since you opened it. Nothing was saved; read it again to see the change." } : { conflict: !1 };
2521
+ function yl(n) {
2522
+ return n === 412 ? { conflict: !0, message: "Someone changed this since you opened it. Nothing was saved; read it again to see the change." } : { conflict: !1 };
976
2523
  }
977
- const ne = "/errors/client-update-required";
978
- function ae(l, n) {
979
- const a = l.split(".").map((s) => Number.parseInt(s, 10) || 0), c = n.split(".").map((s) => Number.parseInt(s, 10) || 0);
980
- for (let s = 0; s < Math.max(a.length, c.length); s++) {
981
- const m = a[s] ?? 0, r = c[s] ?? 0;
982
- if (m !== r) return m < r;
2524
+ const At = "/errors/client-update-required";
2525
+ function Tt(n, t) {
2526
+ const l = n.split(".").map((s) => Number.parseInt(s, 10) || 0), r = t.split(".").map((s) => Number.parseInt(s, 10) || 0);
2527
+ for (let s = 0; s < Math.max(l.length, r.length); s++) {
2528
+ const a = l[s] ?? 0, h = r[s] ?? 0;
2529
+ if (a !== h) return a < h;
983
2530
  }
984
2531
  return !1;
985
2532
  }
986
- function Ze(l) {
987
- return l.problemType !== void 0 && l.problemType.endsWith(ne) ? !0 : l.minimumVersion !== void 0 && ae(l.version, l.minimumVersion);
2533
+ function wl(n) {
2534
+ return n.problemType !== void 0 && n.problemType.endsWith(At) ? !0 : n.minimumVersion !== void 0 && Tt(n.version, n.minimumVersion);
2535
+ }
2536
+ const Pe = "primary", Nn = 4, Lt = 48;
2537
+ function Dt(n, t, l) {
2538
+ const r = n.querySelector(":scope > .cms-screen__bar");
2539
+ return l <= t.scrollHeight - t.clientHeight - ((r == null ? void 0 : r.offsetHeight) ?? 0);
2540
+ }
2541
+ const It = 800, $t = /* @__PURE__ */ new Set(["ArrowDown", "ArrowUp", "PageDown", "PageUp", "Home", "End", " "]);
2542
+ function Bt(n, t) {
2543
+ const [l, r] = D(!1);
2544
+ return ee(() => {
2545
+ const s = n.current;
2546
+ if (s === null || !t) {
2547
+ r(!1);
2548
+ return;
2549
+ }
2550
+ const a = /* @__PURE__ */ new WeakMap();
2551
+ let h = Number.NEGATIVE_INFINITY, d = null;
2552
+ const m = (f) => {
2553
+ h = performance.now(), d = f.target;
2554
+ }, b = (f) => {
2555
+ const v = f.target;
2556
+ !(v instanceof HTMLElement && (v.isContentEditable || v.closest("input, textarea, select") !== null)) && $t.has(f.key) && m(f);
2557
+ }, i = (f) => {
2558
+ const v = f.target;
2559
+ if (!(v instanceof HTMLElement)) return;
2560
+ const u = v.scrollTop, y = a.get(v) ?? 0;
2561
+ if (a.set(v, u), u <= 0) {
2562
+ r(!1);
2563
+ return;
2564
+ }
2565
+ performance.now() - h > It || !(d === s || d === document.body || d instanceof Node && v.contains(d)) || (u < y - Nn ? r(!1) : u > y + Nn && u > Lt && Dt(s, v, u) && r(!0));
2566
+ }, g = [["wheel", m], ["touchmove", m], ["pointerdown", m], ["keydown", b]];
2567
+ for (const [f, v] of g) s.addEventListener(f, v, { capture: !0, passive: !0 });
2568
+ return s.addEventListener("scroll", i, { capture: !0, passive: !0 }), () => {
2569
+ for (const [f, v] of g) s.removeEventListener(f, v, { capture: !0 });
2570
+ s.removeEventListener("scroll", i, { capture: !0 });
2571
+ };
2572
+ }, [n, t]), [l, r];
2573
+ }
2574
+ const Ft = 64;
2575
+ function Ht({ bar: n, leading: t, gap: l, icon: r, iconGap: s, search: a, more: h, globals: d, name: m, choice: b }) {
2576
+ const i = [...a ? [r] : [], r, r, ...d], g = i.reduce((v, u) => v + u, 0) + s * (i.length - 1);
2577
+ return n - (t > 0 ? t + l : 0) - l - g + 0.01 < Math.min(Ft, m) + b;
2578
+ }
2579
+ function Nl({ title: n, back: t, navigation: l, search: r, searching: s, more: a = [], moreLabel: h = "More actions", globals: d, filter: m, primary: b, onRefresh: i, pullText: g, barHidden: f, children: v }) {
2580
+ var Te, Ee;
2581
+ const u = b === void 0 || ("menu" in b ? !b.menu.some((R) => R.offer.offered) : ((Te = b.offer) == null ? void 0 : Te.offered) === !1) ? void 0 : b, y = u !== void 0 && !("menu" in u) ? ((Ee = u.offer) == null ? void 0 : Ee.refusal) ?? null : null, S = fe(), [T, M] = D(!1), E = an(), _ = P(null), N = P(null), [I, K] = D(!1), [z, k] = D(null), [F, U] = D(null), Y = Ie(() => U(null), []), W = P(!1), j = P(null), X = P(null), ne = P(null), ce = a.some((R) => R.offer.offered), _e = F !== null && ce && s === void 0;
2582
+ An(m);
2583
+ const oe = m === void 0 ? null : Cn(m), [ue, Ce] = D(!1), pe = P(!1), le = P(!1), be = P(null), ve = m === void 0 ? void 0 : {
2584
+ ...m,
2585
+ onChange: (R) => {
2586
+ pe.current = !0, m.onChange(R);
2587
+ }
2588
+ }, ye = oe === null ? "" : ` · ${oe.label}`, te = m !== void 0 && m.options.length >= 2, [we, w] = D(!1), C = te && ce && we, Z = JSON.stringify([te, ce, C, r !== void 0, s !== void 0, t !== void 0, n, ye]), G = Ie(() => {
2589
+ const R = j.current, J = X.current, Ne = ne.current;
2590
+ if (R === null || J === null || Ne === null || !te) return null;
2591
+ const de = (Q) => parseFloat(Q) || 0, o = getComputedStyle(R), A = R.getBoundingClientRect().width;
2592
+ if (A === 0) return null;
2593
+ const x = (Q) => {
2594
+ var ke;
2595
+ return ((ke = R.querySelector(`.cms-screen__ruler > [data-ruler="${Q}"]`)) == null ? void 0 : ke.getBoundingClientRect().width) ?? 0;
2596
+ }, O = R.querySelector(".cms-screen__leading"), se = (r !== void 0 ? 1 : 0) + (C ? 0 : 1) + 1;
2597
+ return Ht({
2598
+ bar: A - de(o.paddingLeft) - de(o.paddingRight),
2599
+ leading: O === null || O.childNodes.length === 0 ? 0 : de(getComputedStyle(O).minWidth),
2600
+ gap: de(o.columnGap),
2601
+ icon: Ne.getBoundingClientRect().width,
2602
+ iconGap: de(getComputedStyle(J).columnGap),
2603
+ search: r !== void 0,
2604
+ more: !0,
2605
+ globals: Array.from(J.children).slice(se).map((Q) => Q.getBoundingClientRect().width),
2606
+ name: x("name"),
2607
+ choice: x("choice")
2608
+ });
2609
+ }, [Z]);
2610
+ $e(() => {
2611
+ const R = G() ?? we;
2612
+ R !== we && pe.current && (le.current = !0), pe.current = !1, w(R);
2613
+ }, [G]), ee(() => {
2614
+ if (j.current === null || typeof ResizeObserver > "u") return;
2615
+ const R = new ResizeObserver(() => {
2616
+ const J = G();
2617
+ J !== null && w(J);
2618
+ });
2619
+ for (const J of [j.current, X.current, ...j.current.querySelectorAll(".cms-screen__ruler > span")]) J !== null && R.observe(J);
2620
+ return () => R.disconnect();
2621
+ }, [G]);
2622
+ const p = P(C);
2623
+ $e(() => {
2624
+ var Ne, de, o;
2625
+ if (p.current === C) return;
2626
+ p.current = C, U(null);
2627
+ const R = document.activeElement;
2628
+ (R === document.body && be.current !== null && !be.current.isConnected || le.current && (R === document.body || ((Ne = j.current) == null ? void 0 : Ne.contains(R)) === !0)) && ((o = C ? ne.current : (de = X.current) == null ? void 0 : de.querySelector(".cms-filter-menu")) == null || o.focus()), le.current = !1;
2629
+ }, [C]);
2630
+ const L = C && oe !== null && m !== void 0 ? `${h}, ${Sn(m)}` : h, me = st(N, i === void 0 ? null : () => {
2631
+ I || (K(!0), i().finally(() => K(!1)));
2632
+ }), ae = i === void 0 ? null : { distance: me, refreshing: I, text: g ?? null }, he = s !== void 0 || me > 0 || I || _e || ue, [Se, We] = Bt(_, f === void 0 && !he), Be = !he && (f ?? Se);
2633
+ return /* @__PURE__ */ c(
2634
+ "div",
2635
+ {
2636
+ ref: _,
2637
+ className: H("cms-screen", u !== void 0 && "cms-screen--with-primary"),
2638
+ "data-bar-hidden": Be ? "" : void 0,
2639
+ onFocus: (R) => {
2640
+ be.current = R.target, Be && R.target instanceof Element && R.target.closest(".cms-screen__bar") !== null && We(!1);
2641
+ },
2642
+ children: [
2643
+ s !== void 0 ? /* @__PURE__ */ c("header", { className: "cms-screen__bar cms-screen__bar--searching", children: [
2644
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button cms-screen__icon", "aria-label": s.closeLabel, title: s.closeLabel, onClick: s.onClose, children: /* @__PURE__ */ e(B, { name: "chevron-left" }) }),
2645
+ /* @__PURE__ */ e("div", { className: "cms-screen__search", children: s.field })
2646
+ ] }) : /* @__PURE__ */ c("header", { ref: j, className: "cms-screen__bar", children: [
2647
+ /* @__PURE__ */ e("div", { className: "cms-screen__leading", children: t !== void 0 ? t.href !== void 0 ? /* @__PURE__ */ c("a", { className: "cms-screen__back", href: t.href, onClick: t.onBack, children: [
2648
+ /* @__PURE__ */ e(B, { name: "chevron-left" }),
2649
+ /* @__PURE__ */ e("span", { className: "cms-screen__back-name", children: t.label })
2650
+ ] }) : /* @__PURE__ */ c("button", { type: "button", className: "cms-screen__back", onClick: t.onBack, children: [
2651
+ /* @__PURE__ */ e(B, { name: "chevron-left" }),
2652
+ /* @__PURE__ */ e("span", { className: "cms-screen__back-name", children: t.label })
2653
+ ] }) : l }),
2654
+ oe === null ? /* @__PURE__ */ e("h1", { className: "cms-screen__title", title: n, children: n }) : /* @__PURE__ */ c("h1", { className: "cms-screen__title cms-screen__title--filtered", title: n + ye, children: [
2655
+ /* @__PURE__ */ c("span", { className: "cms-screen__title-place", children: [
2656
+ /* @__PURE__ */ e("span", { className: "cms-screen__title-name", children: n }),
2657
+ /* @__PURE__ */ e("span", { className: "cms-screen__title-dot", children: " · " })
2658
+ ] }),
2659
+ /* @__PURE__ */ e("span", { className: "cms-screen__title-choice", children: oe.label })
2660
+ ] }),
2661
+ te && ce ? /* @__PURE__ */ c("span", { className: "cms-screen__ruler", "aria-hidden": "true", children: [
2662
+ /* @__PURE__ */ e("span", { "data-ruler": "name", children: n }),
2663
+ oe !== null ? /* @__PURE__ */ e("span", { "data-ruler": "choice", children: ye }) : null
2664
+ ] }) : null,
2665
+ /* @__PURE__ */ c("div", { ref: X, className: "cms-screen__trailing", children: [
2666
+ r !== void 0 ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button cms-screen__icon", "aria-label": r.label, title: r.label, onClick: r.onOpen, children: /* @__PURE__ */ e(B, { name: "search" }) }) : null,
2667
+ ve !== void 0 && !C ? /* @__PURE__ */ e(Tn, { ...ve, iconOnly: !0, onOpenChange: Ce }) : null,
2668
+ ce ? /* @__PURE__ */ e(
2669
+ "button",
2670
+ {
2671
+ ref: ne,
2672
+ type: "button",
2673
+ className: H("cms-icon-button cms-screen__icon", C && oe !== null && "cms-screen__icon--active"),
2674
+ "data-action": "more",
2675
+ "aria-haspopup": "menu",
2676
+ "aria-expanded": _e,
2677
+ "aria-label": L,
2678
+ title: L,
2679
+ onMouseDown: () => {
2680
+ W.current = _e;
2681
+ },
2682
+ onClick: (R) => {
2683
+ const J = R.currentTarget.getBoundingClientRect();
2684
+ U(W.current ? null : { x: J.left, y: J.bottom + 4 }), W.current = !1;
2685
+ },
2686
+ children: /* @__PURE__ */ e(B, { name: "more" })
2687
+ }
2688
+ ) : null,
2689
+ d
2690
+ ] })
2691
+ ] }),
2692
+ /* @__PURE__ */ e("div", { ref: N, className: "cms-screen__content", "data-pulling": me > 0 ? "" : void 0, "data-refreshing": I ? "" : void 0, children: /* @__PURE__ */ e(Mn.Provider, { value: ae, children: v }) }),
2693
+ u !== void 0 ? /* @__PURE__ */ c(
2694
+ "button",
2695
+ {
2696
+ type: "button",
2697
+ className: "cms-button cms-button--primary cms-screen__primary",
2698
+ "aria-label": u.label,
2699
+ ...y === null ? { title: u.label } : {
2700
+ "aria-disabled": !0,
2701
+ "aria-describedby": S,
2702
+ ...T ? { "data-reason-shown": "" } : {},
2703
+ ...E.dismissed(Pe) ? { "data-tip-dismissed": "" } : {}
2704
+ },
2705
+ ..."menu" in u ? { "aria-haspopup": "menu", "aria-expanded": z !== null } : {},
2706
+ onFocus: () => E.focusIn(Pe),
2707
+ onBlur: () => {
2708
+ M(!1), E.focusOut(Pe);
2709
+ },
2710
+ onMouseEnter: () => E.pointerIn(Pe),
2711
+ onMouseLeave: () => E.pointerOut(Pe),
2712
+ onKeyDown: (R) => {
2713
+ R.key === "Escape" && y !== null && (M(!1), E.dismiss(Pe));
2714
+ },
2715
+ onClick: (R) => {
2716
+ if (y !== null)
2717
+ M(!0), E.show(Pe);
2718
+ else if ("menu" in u) {
2719
+ const J = R.currentTarget.getBoundingClientRect();
2720
+ k(z === null ? { x: J.left, y: J.top } : null);
2721
+ } else
2722
+ u.onPress();
2723
+ },
2724
+ children: [
2725
+ /* @__PURE__ */ e(B, { name: u.icon, size: 24 }),
2726
+ y !== null ? /* @__PURE__ */ e("span", { className: "cms-screen__tip", role: "tooltip", id: S, children: y }) : null
2727
+ ]
2728
+ }
2729
+ ) : null,
2730
+ /* @__PURE__ */ e(
2731
+ Ke,
2732
+ {
2733
+ at: _e ? F : null,
2734
+ items: C && ve !== void 0 ? [...a, ...En(ve, ve.label)] : a,
2735
+ onClose: Y,
2736
+ label: h,
2737
+ focus: "first"
2738
+ }
2739
+ ),
2740
+ u !== void 0 && "menu" in u ? /* @__PURE__ */ e(Ke, { at: z, items: u.menu, onClose: () => k(null), label: u.label }) : null
2741
+ ]
2742
+ }
2743
+ );
988
2744
  }
989
2745
  export {
990
- _e as AppShell,
991
- S as Avatar,
992
- Y as Badge,
993
- $ as Button,
994
- Z as CALL_LABELS,
995
- ne as CLIENT_UPDATE_REQUIRED,
996
- Ce as CallBar,
997
- Me as CallPanel,
998
- ye as ChatBubble,
999
- we as Composer,
1000
- de as ConfirmDialog,
1001
- Le as ContextMenu,
1002
- W as EmptyState,
1003
- q as ErrorBanner,
1004
- ge as FilterChips,
1005
- pe as ICON_NAMES,
1006
- y as Icon,
1007
- ke as IncomingCall,
1008
- Ee as List,
1009
- U as Loading,
1010
- Q as MAIL_ROW_LABELS,
1011
- j as MODAL_CLOSE_MS,
1012
- Ne as MailRow,
1013
- z as Modal,
1014
- he as PageHeader,
1015
- J as SIGN_IN_LABELS,
1016
- be as SearchField,
1017
- ie as Select,
1018
- Ae as SignInForm,
1019
- xe as SignInLayout,
1020
- ve as SplitPanes,
1021
- fe as TabStrip,
1022
- re as TextField,
1023
- me as Toast,
1024
- ue as ToastRegion,
1025
- oe as Toggle,
1026
- G as initialsOf,
1027
- O as isCapability,
1028
- Ze as needsClientUpdate,
1029
- De as offerFor,
1030
- Ie as readConflict,
1031
- $e as readRefusal,
1032
- le as refusalText,
1033
- Se as rereadAll,
1034
- X as tintOf,
1035
- Te as useReread,
1036
- ae as versionBelow
2746
+ tl as AppShell,
2747
+ Ye as Avatar,
2748
+ pn as BOOTSTRAP_ICONS,
2749
+ bt as Badge,
2750
+ De as Button,
2751
+ on as CALL_LABELS,
2752
+ At as CLIENT_UPDATE_REQUIRED,
2753
+ dl as CallBar,
2754
+ ol as CallPanel,
2755
+ al as ChatBubble,
2756
+ Qt as Column,
2757
+ il as Composer,
2758
+ Vt as ConfirmDialog,
2759
+ Ke as ContextMenu,
2760
+ Kn as EmptyState,
2761
+ Wn as ErrorBanner,
2762
+ yt as FILTER_MENU_LABELS,
2763
+ Yt as FilePicker,
2764
+ Qn as FilePickerDenied,
2765
+ et as FilePickerRestart,
2766
+ jt as FileViewer,
2767
+ Nt as FilterMenu,
2768
+ zt as ICON_NAMES,
2769
+ B as Icon,
2770
+ cl as IncomingCall,
2771
+ Xt as List,
2772
+ hl as ListHead,
2773
+ Un as Loading,
2774
+ vt as MAIL_ROW_LABELS,
2775
+ zn as MODAL_CLOSE_MS,
2776
+ rl as MailRow,
2777
+ xn as Modal,
2778
+ Fn as NamedIcon,
2779
+ pl as Notification,
2780
+ Qe as PULL_AT,
2781
+ el as PageHeader,
2782
+ fl as PaneToolbar,
2783
+ gt as SIGN_IN_LABELS,
2784
+ Je as STATE_DELAY_MS,
2785
+ Nl as ScreenShell,
2786
+ ll as SearchField,
2787
+ Jt as SectionHeader,
2788
+ Wt as Select,
2789
+ ml as SignInForm,
2790
+ ul as SignInLayout,
2791
+ sl as SplitPanes,
2792
+ pt as Splitter,
2793
+ Le as State,
2794
+ nl as TabStrip,
2795
+ Kt as TextArea,
2796
+ Ut as TextField,
2797
+ qt as Toast,
2798
+ Gt as ToastRegion,
2799
+ Zt as Toggle,
2800
+ _t as fitPanes,
2801
+ Ue as iconForName,
2802
+ dt as initialsOf,
2803
+ Ct as isCapability,
2804
+ wl as needsClientUpdate,
2805
+ bl as offerFor,
2806
+ yl as readConflict,
2807
+ _l as readRefusal,
2808
+ Et as refusalText,
2809
+ vl as rereadAll,
2810
+ ut as tintOf,
2811
+ st as usePull,
2812
+ rt as usePullState,
2813
+ gl as useReread,
2814
+ Tt as versionBelow,
2815
+ On as writtenOut
1037
2816
  };