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

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