@coolms/ui-react 0.1.0-alpha.3 → 0.1.0-alpha.31

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