@coolms/ui-react 0.1.0-alpha.5 → 0.1.0-alpha.6

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,18 +1,18 @@
1
- import { jsx as e, jsxs as i, Fragment as g } from "react/jsx-runtime";
2
- import { useId as E, useState as C, useRef as x, useEffect as D, useLayoutEffect as R, useCallback as V } from "react";
3
- import { createPortal as F } from "react-dom";
4
- function L(l, n) {
1
+ import { jsx as e, jsxs as c, Fragment as v } from "react/jsx-runtime";
2
+ import { useId as I, useState as E, useRef as A, useEffect as K, useLayoutEffect as Q, useCallback as J } from "react";
3
+ import { createPortal as R } from "react-dom";
4
+ function Z(l, n) {
5
5
  const a = { ...l };
6
- for (const c of Object.keys(n ?? {})) {
7
- const s = n == null ? void 0 : n[c];
8
- s !== void 0 && (a[c] = s);
6
+ for (const t of Object.keys(n ?? {})) {
7
+ const s = n == null ? void 0 : n[t];
8
+ s !== void 0 && (a[t] = s);
9
9
  }
10
10
  return a;
11
11
  }
12
- function v(...l) {
12
+ function g(...l) {
13
13
  return l.filter(Boolean).join(" ");
14
14
  }
15
- function k({ name: l }) {
15
+ function M({ name: l }) {
16
16
  const n = { width: 16, height: 16, viewBox: "0 0 16 16", "aria-hidden": !0, focusable: !1 };
17
17
  switch (l) {
18
18
  case "lock":
@@ -31,34 +31,34 @@ function k({ name: l }) {
31
31
  return /* @__PURE__ */ e("svg", { ...n, className: "cms-glyph", children: /* @__PURE__ */ e("path", { fill: "currentColor", d: "M8 1a7 7 0 1 1 0 14A7 7 0 0 1 8 1Zm0 5.5a1 1 0 0 0-1 1V11a1 1 0 1 0 2 0V7.5a1 1 0 0 0-1-1ZM8 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z" }) });
32
32
  }
33
33
  }
34
- function $({
34
+ function F({
35
35
  variant: l = "secondary",
36
36
  busy: n = !1,
37
37
  busyLabel: a,
38
- locked: c = !1,
38
+ locked: t = !1,
39
39
  lockedReason: s,
40
- icon: m,
41
- disabled: r,
42
- className: d,
43
- children: u,
44
- type: h = "button",
45
- title: t,
40
+ icon: h,
41
+ disabled: i,
42
+ className: m,
43
+ children: d,
44
+ type: r = "button",
45
+ title: o,
46
46
  ...f
47
47
  }) {
48
- const o = !!r || n;
49
- return /* @__PURE__ */ i(
48
+ const u = !!i || n;
49
+ return /* @__PURE__ */ c(
50
50
  "button",
51
51
  {
52
52
  ...f,
53
- type: h,
54
- className: v("cms-button", `cms-button--${l}`, n && "is-busy", c && "is-locked", d),
55
- disabled: o,
53
+ type: r,
54
+ className: g("cms-button", `cms-button--${l}`, n && "is-busy", t && "is-locked", m),
55
+ disabled: u,
56
56
  "aria-busy": n || void 0,
57
- title: c ? s ?? t : t,
57
+ title: t ? s ?? o : o,
58
58
  children: [
59
- n ? /* @__PURE__ */ e(k, { name: "spinner" }) : c ? /* @__PURE__ */ e(k, { name: "lock" }) : m,
60
- /* @__PURE__ */ e("span", { className: "cms-button__label", children: n && a !== void 0 ? a : u }),
61
- c && s ? /* @__PURE__ */ i("span", { className: "cms-visually-hidden", children: [
59
+ n ? /* @__PURE__ */ e(M, { name: "spinner" }) : t ? /* @__PURE__ */ e(M, { name: "lock" }) : h,
60
+ /* @__PURE__ */ e("span", { className: "cms-button__label", children: n && a !== void 0 ? a : d }),
61
+ t && s ? /* @__PURE__ */ c("span", { className: "cms-visually-hidden", children: [
62
62
  ", ",
63
63
  s
64
64
  ] }) : null
@@ -66,352 +66,323 @@ function $({
66
66
  }
67
67
  );
68
68
  }
69
- function K({ id: l, label: n, help: a, error: c, pinned: s, children: m }) {
70
- return /* @__PURE__ */ i("div", { className: v("cms-field", c != null && "is-invalid"), children: [
69
+ function q({ id: l, label: n, help: a, error: t, pinned: s, children: h }) {
70
+ return /* @__PURE__ */ c("div", { className: g("cms-field", t != null && "is-invalid"), children: [
71
71
  /* @__PURE__ */ e("label", { className: "cms-field__label", htmlFor: l, children: n }),
72
- m,
73
- s != null ? /* @__PURE__ */ i("p", { className: "cms-field__pinned", id: `${l}-pinned`, children: [
74
- /* @__PURE__ */ e(k, { name: "lock" }),
72
+ h,
73
+ s != null ? /* @__PURE__ */ c("p", { className: "cms-field__pinned", id: `${l}-pinned`, children: [
74
+ /* @__PURE__ */ e(M, { name: "lock" }),
75
75
  " ",
76
76
  s
77
77
  ] }) : null,
78
- c != null ? /* @__PURE__ */ e("p", { className: "cms-field__error", id: `${l}-error`, role: "alert", children: c }) : null,
78
+ t != null ? /* @__PURE__ */ e("p", { className: "cms-field__error", id: `${l}-error`, role: "alert", children: t }) : null,
79
79
  a != null ? /* @__PURE__ */ e("p", { className: "cms-field__help", id: `${l}-help`, children: a }) : null
80
80
  ] });
81
81
  }
82
- function P(l, n) {
82
+ function z(l, n) {
83
83
  const a = [n.error != null && `${l}-error`, n.pinned != null && `${l}-pinned`, n.help != null && `${l}-help`].filter(Boolean).join(" ");
84
84
  return a === "" ? void 0 : a;
85
85
  }
86
- function re({ label: l, help: n, error: a, disabled: c, readOnly: s, pinned: m, value: r, onChange: d, placeholder: u, type: h = "text", name: t }) {
87
- const f = E();
88
- return /* @__PURE__ */ e(K, { id: f, label: l, help: n, error: a, pinned: m, children: /* @__PURE__ */ e(
86
+ function xe({ label: l, help: n, error: a, disabled: t, readOnly: s, pinned: h, value: i, onChange: m, placeholder: d, type: r = "text", name: o }) {
87
+ const f = I();
88
+ return /* @__PURE__ */ e(q, { id: f, label: l, help: n, error: a, pinned: h, children: /* @__PURE__ */ e(
89
89
  "input",
90
90
  {
91
91
  id: f,
92
- name: t,
93
- type: h,
92
+ name: o,
93
+ type: r,
94
94
  className: "cms-input",
95
- value: r,
96
- placeholder: u,
97
- disabled: c,
98
- readOnly: s || m != null,
95
+ value: i,
96
+ placeholder: d,
97
+ disabled: t,
98
+ readOnly: s || h != null,
99
99
  "aria-invalid": a != null || void 0,
100
- "aria-describedby": P(f, { help: n, error: a, pinned: m }),
101
- onChange: (o) => d == null ? void 0 : d(o.target.value)
100
+ "aria-describedby": z(f, { help: n, error: a, pinned: h }),
101
+ onChange: (u) => m == null ? void 0 : m(u.target.value)
102
102
  }
103
103
  ) });
104
104
  }
105
- function ie({ label: l, help: n, error: a, disabled: c, readOnly: s, value: m, options: r, onChange: d, emptyText: u = "Nothing to choose from yet.", name: h }) {
106
- const t = E(), f = r.length === 0;
107
- return /* @__PURE__ */ e(K, { id: t, label: l, help: f ? u : n, error: a, children: /* @__PURE__ */ e(
105
+ function Ce({ label: l, help: n, error: a, disabled: t, readOnly: s, value: h, options: i, onChange: m, emptyText: d = "Nothing to choose from yet.", name: r }) {
106
+ const o = I(), f = i.length === 0;
107
+ return /* @__PURE__ */ e(q, { id: o, label: l, help: f ? d : n, error: a, children: /* @__PURE__ */ e(
108
108
  "select",
109
109
  {
110
- id: t,
111
- name: h,
110
+ id: o,
111
+ name: r,
112
112
  className: "cms-input cms-select",
113
- value: m,
114
- disabled: c || f,
113
+ value: h,
114
+ disabled: t || f,
115
115
  "aria-readonly": s || void 0,
116
116
  "aria-invalid": a != null || void 0,
117
- "aria-describedby": P(t, { help: f ? u : n, error: a }),
118
- onChange: (o) => {
119
- s || d == null || d(o.target.value);
117
+ "aria-describedby": z(o, { help: f ? d : n, error: a }),
118
+ onChange: (u) => {
119
+ s || m == null || m(u.target.value);
120
120
  },
121
- children: r.map((o) => /* @__PURE__ */ e("option", { value: o.value, disabled: s && o.value !== m, children: o.label }, o.value))
121
+ children: i.map((u) => /* @__PURE__ */ e("option", { value: u.value, disabled: s && u.value !== h, children: u.label }, u.value))
122
122
  }
123
123
  ) });
124
124
  }
125
- function oe({ label: l, checked: n, onChange: a, disabled: c, readOnly: s, help: m }) {
126
- const r = E();
127
- return /* @__PURE__ */ i("div", { className: "cms-toggle-row", children: [
125
+ function Ae({ label: l, checked: n, onChange: a, disabled: t, readOnly: s, help: h }) {
126
+ const i = I();
127
+ return /* @__PURE__ */ c("div", { className: "cms-toggle-row", children: [
128
128
  /* @__PURE__ */ e(
129
129
  "button",
130
130
  {
131
- id: r,
131
+ id: i,
132
132
  type: "button",
133
133
  role: "switch",
134
- className: v("cms-toggle", n && "is-on"),
134
+ className: g("cms-toggle", n && "is-on"),
135
135
  "aria-checked": n,
136
136
  "aria-readonly": s || void 0,
137
- "aria-describedby": m != null ? `${r}-help` : void 0,
138
- disabled: c,
137
+ "aria-describedby": h != null ? `${i}-help` : void 0,
138
+ disabled: t,
139
139
  onClick: () => {
140
140
  s || a == null || a(!n);
141
141
  },
142
142
  children: /* @__PURE__ */ e("span", { className: "cms-toggle__thumb" })
143
143
  }
144
144
  ),
145
- /* @__PURE__ */ e("label", { className: "cms-toggle__label", htmlFor: r, children: l }),
146
- m != null ? /* @__PURE__ */ e("p", { className: "cms-field__help", id: `${r}-help`, children: m }) : null
145
+ /* @__PURE__ */ e("label", { className: "cms-toggle__label", htmlFor: i, children: l }),
146
+ h != null ? /* @__PURE__ */ e("p", { className: "cms-field__help", id: `${i}-help`, children: h }) : null
147
147
  ] });
148
148
  }
149
- const j = 150;
150
- function z({ open: l, title: n, onClose: a, dirty: c = !1, onDirtyClose: s, children: m, footer: r, closeLabel: d = "Close" }) {
151
- const [u, h] = C(l), [t, f] = C(!1), o = x(null), p = x(null), b = E();
152
- if (D(() => {
149
+ const ee = 150;
150
+ function le({ open: l, title: n, onClose: a, dirty: t = !1, onDirtyClose: s, children: h, footer: i, closeLabel: m = "Close" }) {
151
+ const [d, r] = E(l), [o, f] = E(!1), u = A(null), p = A(null), N = I();
152
+ if (K(() => {
153
153
  if (l) {
154
- p.current = document.activeElement, h(!0), f(!1);
154
+ p.current = document.activeElement, r(!0), f(!1);
155
155
  return;
156
156
  }
157
- if (!u) return;
157
+ if (!d) return;
158
158
  f(!0);
159
- const _ = window.setTimeout(() => {
160
- var M, w;
161
- h(!1), f(!1), (w = (M = p.current) == null ? void 0 : M.focus) == null || w.call(M);
162
- }, j);
163
- return () => window.clearTimeout(_);
164
- }, [l, u]), D(() => {
165
- var _, M;
166
- if (l && u) {
159
+ const b = window.setTimeout(() => {
160
+ var C, w;
161
+ r(!1), f(!1), (w = (C = p.current) == null ? void 0 : C.focus) == null || w.call(C);
162
+ }, ee);
163
+ return () => window.clearTimeout(b);
164
+ }, [l, d]), K(() => {
165
+ var b, C;
166
+ if (l && d) {
167
167
  const w = 'input, select, textarea, button, [href], [tabindex]:not([tabindex="-1"])';
168
- (M = ((_ = o.current) == null ? void 0 : _.querySelector(`.cms-modal__body :is(${w}), .cms-modal__foot :is(${w})`)) ?? o.current) == null || M.focus();
168
+ (C = ((b = u.current) == null ? void 0 : b.querySelector(`.cms-modal__body :is(${w}), .cms-modal__foot :is(${w})`)) ?? u.current) == null || C.focus();
169
169
  }
170
- }, [l, u]), !u) return null;
171
- const N = () => {
172
- c ? s == null || s() : a();
170
+ }, [l, d]), !d) return null;
171
+ const y = () => {
172
+ t ? s == null || s() : a();
173
173
  };
174
- return F(
175
- /* @__PURE__ */ e("div", { className: v("cms-modal-scrim", t && "is-closing"), onMouseDown: (_) => {
176
- _.target === _.currentTarget && N();
177
- }, children: /* @__PURE__ */ i(
174
+ return R(
175
+ /* @__PURE__ */ e("div", { className: g("cms-modal-scrim", o && "is-closing"), onMouseDown: (b) => {
176
+ b.target === b.currentTarget && y();
177
+ }, children: /* @__PURE__ */ c(
178
178
  "div",
179
179
  {
180
- ref: o,
181
- className: v("cms-modal", t && "is-closing", c && "is-dirty"),
180
+ ref: u,
181
+ className: g("cms-modal", o && "is-closing", t && "is-dirty"),
182
182
  role: "dialog",
183
183
  "aria-modal": "true",
184
- "aria-labelledby": b,
184
+ "aria-labelledby": N,
185
185
  tabIndex: -1,
186
- onKeyDown: (_) => {
187
- var M;
188
- if (_.key === "Escape")
189
- _.stopPropagation(), N();
190
- else if (_.key === "Tab") {
191
- const w = (M = o.current) == null ? void 0 : M.querySelectorAll('input, select, textarea, button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])');
186
+ onKeyDown: (b) => {
187
+ var C;
188
+ if (b.key === "Escape")
189
+ b.stopPropagation(), y();
190
+ else if (b.key === "Tab") {
191
+ const w = (C = u.current) == null ? void 0 : C.querySelectorAll('input, select, textarea, button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])');
192
192
  if (!w || w.length === 0) return;
193
- const T = w[0], B = w[w.length - 1];
194
- _.shiftKey && document.activeElement === T ? (_.preventDefault(), B.focus()) : !_.shiftKey && document.activeElement === B && (_.preventDefault(), T.focus());
193
+ const D = w[0], B = w[w.length - 1];
194
+ b.shiftKey && document.activeElement === D ? (b.preventDefault(), B.focus()) : !b.shiftKey && document.activeElement === B && (b.preventDefault(), D.focus());
195
195
  }
196
196
  },
197
197
  children: [
198
- /* @__PURE__ */ i("header", { className: "cms-modal__head", children: [
199
- /* @__PURE__ */ e("h2", { className: "cms-modal__title", id: b, children: n }),
200
- /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": d, onClick: N, children: /* @__PURE__ */ e(k, { name: "close" }) })
198
+ /* @__PURE__ */ c("header", { className: "cms-modal__head", children: [
199
+ /* @__PURE__ */ e("h2", { className: "cms-modal__title", id: N, children: n }),
200
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": m, onClick: y, children: /* @__PURE__ */ e(M, { name: "close" }) })
201
201
  ] }),
202
- /* @__PURE__ */ e("div", { className: "cms-modal__body", children: m }),
203
- r != null ? /* @__PURE__ */ e("footer", { className: "cms-modal__foot", children: r }) : null
202
+ /* @__PURE__ */ e("div", { className: "cms-modal__body", children: h }),
203
+ i != null ? /* @__PURE__ */ e("footer", { className: "cms-modal__foot", children: i }) : null
204
204
  ]
205
205
  }
206
206
  ) }),
207
207
  document.body
208
208
  );
209
209
  }
210
- function de({ open: l, title: n, message: a, kind: c = "default", confirmLabel: s, cancelLabel: m, closeLabel: r, onConfirm: d, onCancel: u }) {
211
- const h = c === "discard-changes";
210
+ function Ee({ open: l, title: n, message: a, kind: t = "default", confirmLabel: s, cancelLabel: h, closeLabel: i, onConfirm: m, onCancel: d }) {
211
+ const r = t === "discard-changes";
212
212
  return /* @__PURE__ */ e(
213
- z,
213
+ le,
214
214
  {
215
215
  open: l,
216
216
  title: n,
217
- onClose: u,
218
- ...r === void 0 ? {} : { closeLabel: r },
219
- footer: /* @__PURE__ */ i(g, { children: [
220
- /* @__PURE__ */ e($, { onClick: u, children: m ?? (h ? "Keep editing" : "Cancel") }),
221
- /* @__PURE__ */ e($, { variant: c === "default" ? "primary" : "danger", onClick: d, children: s ?? (h ? "Discard changes" : "Confirm") })
217
+ onClose: d,
218
+ ...i === void 0 ? {} : { closeLabel: i },
219
+ footer: /* @__PURE__ */ c(v, { children: [
220
+ /* @__PURE__ */ e(F, { onClick: d, children: h ?? (r ? "Keep editing" : "Cancel") }),
221
+ /* @__PURE__ */ e(F, { variant: t === "default" ? "primary" : "danger", onClick: m, children: s ?? (r ? "Discard changes" : "Confirm") })
222
222
  ] }),
223
- children: c !== "default" ? /* @__PURE__ */ i("p", { className: "cms-confirm__warning", children: [
224
- /* @__PURE__ */ e(k, { name: "warning" }),
223
+ children: t !== "default" ? /* @__PURE__ */ c("p", { className: "cms-confirm__warning", children: [
224
+ /* @__PURE__ */ e(M, { name: "warning" }),
225
225
  " ",
226
226
  a
227
227
  ] }) : /* @__PURE__ */ e("p", { children: a })
228
228
  }
229
229
  );
230
230
  }
231
- function me({ kind: l, message: n, action: a, onDismiss: c, dismissLabel: s = "Dismiss" }) {
232
- return /* @__PURE__ */ i("div", { className: v("cms-toast", `cms-toast--${l}`), role: l === "error" ? "alert" : "status", children: [
233
- /* @__PURE__ */ e(k, { name: l === "success" ? "check" : l === "error" ? "warning" : "info" }),
231
+ function Le({ kind: l, message: n, action: a, onDismiss: t, dismissLabel: s = "Dismiss" }) {
232
+ return /* @__PURE__ */ c("div", { className: g("cms-toast", `cms-toast--${l}`), role: l === "error" ? "alert" : "status", children: [
233
+ /* @__PURE__ */ e(M, { name: l === "success" ? "check" : l === "error" ? "warning" : "info" }),
234
234
  /* @__PURE__ */ e("span", { className: "cms-toast__message", children: n }),
235
- a ? /* @__PURE__ */ e($, { className: "cms-toast__action", onClick: a.onAction, children: a.label }) : null,
236
- c ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": s, onClick: c, children: /* @__PURE__ */ e(k, { name: "close" }) }) : null
235
+ a ? /* @__PURE__ */ e(F, { className: "cms-toast__action", onClick: a.onAction, children: a.label }) : null,
236
+ t ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": s, onClick: t, children: /* @__PURE__ */ e(M, { name: "close" }) }) : null
237
237
  ] });
238
238
  }
239
- function ue({ children: l }) {
239
+ function Se({ children: l }) {
240
240
  return /* @__PURE__ */ e("div", { className: "cms-toast-region", children: l });
241
241
  }
242
- function U({ what: l, layout: n = "inline" }) {
243
- return /* @__PURE__ */ i("div", { className: v("cms-loading", `cms-loading--${n}`), role: "status", "aria-live": "polite", children: [
244
- /* @__PURE__ */ e(k, { name: "spinner" }),
242
+ function ne({ what: l, layout: n = "inline" }) {
243
+ return /* @__PURE__ */ c("div", { className: g("cms-loading", `cms-loading--${n}`), role: "status", "aria-live": "polite", children: [
244
+ /* @__PURE__ */ e(M, { name: "spinner" }),
245
245
  /* @__PURE__ */ e("span", { children: l })
246
246
  ] });
247
247
  }
248
- function W({ title: l, hint: n, action: a }) {
249
- return /* @__PURE__ */ i("div", { className: "cms-empty", children: [
248
+ function ae({ title: l, hint: n, action: a }) {
249
+ return /* @__PURE__ */ c("div", { className: "cms-empty", children: [
250
250
  /* @__PURE__ */ e("p", { className: "cms-empty__title", children: l }),
251
251
  n != null ? /* @__PURE__ */ e("p", { className: "cms-empty__hint", children: n }) : null,
252
252
  a != null ? /* @__PURE__ */ e("div", { className: "cms-empty__action", children: a }) : null
253
253
  ] });
254
254
  }
255
- function q({ message: l, onRetry: n, retryLabel: a = "Try again" }) {
256
- return /* @__PURE__ */ i("div", { className: "cms-error-banner", role: "alert", children: [
257
- /* @__PURE__ */ e(k, { name: "warning" }),
255
+ function se({ message: l, onRetry: n, retryLabel: a = "Try again" }) {
256
+ return /* @__PURE__ */ c("div", { className: "cms-error-banner", role: "alert", children: [
257
+ /* @__PURE__ */ e(M, { name: "warning" }),
258
258
  /* @__PURE__ */ e("span", { className: "cms-error-banner__message", children: l }),
259
- n ? /* @__PURE__ */ e($, { onClick: n, children: a }) : null
260
- ] });
261
- }
262
- function he({ title: l, scope: n, actions: a, backLink: c }) {
263
- return /* @__PURE__ */ i("header", { className: "cms-page-header", children: [
264
- c ? /* @__PURE__ */ i(
265
- "a",
266
- {
267
- className: "cms-page-header__back",
268
- href: c.href ?? "#",
269
- onClick: (s) => {
270
- c.onBack && (s.preventDefault(), c.onBack());
271
- },
272
- children: [
273
- /* @__PURE__ */ e(k, { name: "back" }),
274
- " ",
275
- c.label
276
- ]
277
- }
278
- ) : null,
279
- /* @__PURE__ */ i("div", { className: "cms-page-header__row", children: [
280
- /* @__PURE__ */ i("div", { className: "cms-page-header__titles", children: [
281
- /* @__PURE__ */ e("h1", { className: "cms-page-header__title", children: l }),
282
- n != null ? /* @__PURE__ */ e("p", { className: "cms-page-header__scope", children: n }) : null
283
- ] }),
284
- a != null ? /* @__PURE__ */ e("div", { className: "cms-page-header__actions", children: a }) : null
285
- ] })
259
+ n ? /* @__PURE__ */ e(F, { onClick: n, children: a }) : null
286
260
  ] });
287
261
  }
288
- function fe({ tabs: l, active: n, onSelect: a, label: c }) {
289
- const s = x([]), m = (r, d) => {
290
- var f;
291
- const u = l.length - 1, h = r.key === "ArrowRight" ? d === u ? 0 : d + 1 : r.key === "ArrowLeft" ? d === 0 ? u : d - 1 : r.key === "Home" ? 0 : r.key === "End" ? u : null;
292
- if (h === null) return;
293
- r.preventDefault();
294
- const t = l[h];
295
- t && (a(t.id), (f = s.current[h]) == null || f.focus());
296
- };
297
- return /* @__PURE__ */ e("div", { className: "cms-tabs", role: "tablist", "aria-label": c, children: l.map((r, d) => {
298
- const u = r.id === n;
299
- return /* @__PURE__ */ i(
300
- "button",
301
- {
302
- ref: (h) => {
303
- s.current[d] = h;
304
- },
305
- type: "button",
306
- role: "tab",
307
- className: v("cms-tab", u && "is-active"),
308
- "aria-selected": u,
309
- tabIndex: u ? 0 : -1,
310
- onClick: () => a(r.id),
311
- onKeyDown: (h) => m(h, d),
312
- children: [
313
- r.label,
314
- r.count !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-tab__count", children: r.count }) : null
315
- ]
316
- },
317
- r.id
318
- );
319
- }) });
320
- }
321
- function G(l) {
322
- var c;
323
- const n = l.trim().split(/\s+/).filter(Boolean);
324
- return (n.length > 1 ? [n[0][0], n[n.length - 1][0]] : [(c = n[0]) == null ? void 0 : c[0]]).filter(Boolean).join("").toUpperCase();
262
+ const j = 300;
263
+ function te() {
264
+ if (typeof window > "u" || typeof getComputedStyle != "function") return j;
265
+ const l = getComputedStyle(document.documentElement).getPropertyValue("--cms-state-delay").trim(), n = l.endsWith("ms") ? Number.parseFloat(l) : l.endsWith("s") ? Number.parseFloat(l) * 1e3 : Number.NaN;
266
+ return Number.isFinite(n) && n >= 0 ? n : j;
325
267
  }
326
- function X(l) {
327
- let n = 0;
328
- for (const a of l.trim().toLowerCase())
329
- n = n * 31 + (a.codePointAt(0) ?? 0) >>> 0;
330
- return n % 6 + 1;
268
+ function ce() {
269
+ return /* @__PURE__ */ c("svg", { className: "cms-state__spinner", viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: [
270
+ /* @__PURE__ */ e("circle", { className: "cms-state__track", cx: "12", cy: "12", r: "10", fill: "none" }),
271
+ /* @__PURE__ */ e("circle", { className: "cms-state__arc", cx: "12", cy: "12", r: "10", fill: "none", pathLength: "100", strokeDasharray: "28 72" })
272
+ ] });
331
273
  }
332
- function S({ name: l, pictureUrl: n, presence: a, size: c = 32 }) {
333
- return /* @__PURE__ */ i(
334
- "span",
274
+ function De({ kind: l, title: n, description: a, action: t, placement: s = "block" }) {
275
+ const [h, i] = E(l !== "loading");
276
+ return K(() => {
277
+ if (l !== "loading") {
278
+ i(!0);
279
+ return;
280
+ }
281
+ i(!1);
282
+ const m = window.setTimeout(() => i(!0), te());
283
+ return () => window.clearTimeout(m);
284
+ }, [l]), /* @__PURE__ */ c(
285
+ "div",
335
286
  {
336
- className: `cms-avatar cms-avatar--tint-${X(l)}`,
337
- style: { width: c, height: c, fontSize: Math.round(c * 0.4) },
338
- role: "img",
339
- "aria-label": a ? `${l}, ${a}` : l,
287
+ className: g("cms-state", `cms-state--${l}`, `cms-state--${s}`, !h && "is-waiting"),
288
+ role: "status",
289
+ "aria-live": "polite",
290
+ "data-kind": l,
340
291
  children: [
341
- n ? /* @__PURE__ */ e("img", { src: n, alt: "", className: "cms-avatar__picture" }) : /* @__PURE__ */ e("span", { "aria-hidden": "true", children: G(l) }),
342
- a ? /* @__PURE__ */ e("span", { className: v("cms-avatar__presence", `is-${a}`), "aria-hidden": "true" }) : null
292
+ l === "loading" ? /* @__PURE__ */ e(ce, {}) : null,
293
+ l === "error" || l === "denied" ? /* @__PURE__ */ e(M, { name: l === "error" ? "warning" : "lock" }) : null,
294
+ /* @__PURE__ */ c("span", { className: "cms-state__text", children: [
295
+ /* @__PURE__ */ e("span", { className: "cms-state__title", children: n }),
296
+ a !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-state__description", children: a }) : null
297
+ ] }),
298
+ t !== void 0 && l !== "denied" ? /* @__PURE__ */ e(F, { className: "cms-state__action", onClick: t.onAction, children: t.label }) : null
343
299
  ]
344
300
  }
345
301
  );
346
302
  }
347
- const H = {
348
- mail: /* @__PURE__ */ i(g, { children: [
303
+ const X = {
304
+ mail: /* @__PURE__ */ c(v, { children: [
349
305
  /* @__PURE__ */ e("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
350
306
  /* @__PURE__ */ e("path", { d: "m3 7 9 6 9-6" })
351
307
  ] }),
352
308
  chat: /* @__PURE__ */ e("path", { d: "M4 12a8 8 0 1 1 4 6.9L4 20l1.1-4A8 8 0 0 1 4 12Z" }),
353
309
  phone: /* @__PURE__ */ e("path", { d: "M5 3h3l2 5-2.5 1.5a11 11 0 0 0 7 7L16 14l5 2v3a2 2 0 0 1-2 2A16 16 0 0 1 3 5a2 2 0 0 1 2-2Z" }),
354
- calendar: /* @__PURE__ */ i(g, { children: [
310
+ calendar: /* @__PURE__ */ c(v, { children: [
355
311
  /* @__PURE__ */ e("rect", { x: "3", y: "5", width: "18", height: "16", rx: "2" }),
356
312
  /* @__PURE__ */ e("path", { d: "M3 10h18M8 3v4M16 3v4" })
357
313
  ] }),
358
- file: /* @__PURE__ */ i(g, { children: [
314
+ file: /* @__PURE__ */ c(v, { children: [
359
315
  /* @__PURE__ */ e("path", { d: "M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9Z" }),
360
316
  /* @__PURE__ */ e("path", { d: "M14 3v6h6M8 13h8M8 17h6" })
361
317
  ] }),
362
- image: /* @__PURE__ */ i(g, { children: [
318
+ image: /* @__PURE__ */ c(v, { children: [
363
319
  /* @__PURE__ */ e("rect", { x: "3", y: "4", width: "18", height: "16", rx: "2" }),
364
320
  /* @__PURE__ */ e("circle", { cx: "9", cy: "10", r: "2" }),
365
321
  /* @__PURE__ */ e("path", { d: "m21 17-5-5-9 8" })
366
322
  ] }),
367
- search: /* @__PURE__ */ i(g, { children: [
323
+ search: /* @__PURE__ */ c(v, { children: [
368
324
  /* @__PURE__ */ e("circle", { cx: "11", cy: "11", r: "7" }),
369
325
  /* @__PURE__ */ e("path", { d: "m20 20-4-4" })
370
326
  ] }),
371
- bell: /* @__PURE__ */ i(g, { children: [
327
+ bell: /* @__PURE__ */ c(v, { children: [
372
328
  /* @__PURE__ */ e("path", { d: "M6 9a6 6 0 1 1 12 0c0 6 2 8 2 8H4s2-2 2-8Z" }),
373
329
  /* @__PURE__ */ e("path", { d: "M10 20a2 2 0 0 0 4 0" })
374
330
  ] }),
375
- pencil: /* @__PURE__ */ i(g, { children: [
331
+ pencil: /* @__PURE__ */ c(v, { children: [
376
332
  /* @__PURE__ */ e("path", { d: "M4 20h4L19 9l-4-4L4 16Z" }),
377
333
  /* @__PURE__ */ e("path", { d: "m13 7 4 4" })
378
334
  ] }),
335
+ download: /* @__PURE__ */ c(v, { children: [
336
+ /* @__PURE__ */ e("path", { d: "M12 4v11" }),
337
+ /* @__PURE__ */ e("path", { d: "m7 11 5 5 5-5" }),
338
+ /* @__PURE__ */ e("path", { d: "M4 20h16" })
339
+ ] }),
340
+ print: /* @__PURE__ */ c(v, { children: [
341
+ /* @__PURE__ */ e("path", { d: "M7 8V4h10v4" }),
342
+ /* @__PURE__ */ e("rect", { x: "3", y: "8", width: "18", height: "8", rx: "2" }),
343
+ /* @__PURE__ */ e("path", { d: "M7 14h10v6H7Z" })
344
+ ] }),
345
+ "open-separately": /* @__PURE__ */ c(v, { children: [
346
+ /* @__PURE__ */ e("path", { d: "M14 4h6v6" }),
347
+ /* @__PURE__ */ e("path", { d: "m20 4-9 9" }),
348
+ /* @__PURE__ */ e("path", { d: "M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5" })
349
+ ] }),
379
350
  star: /* @__PURE__ */ e("path", { d: "m12 3 2.8 5.8 6.2.9-4.5 4.4 1 6.2L12 17.4l-5.5 2.9 1-6.2L3 9.7l6.2-.9Z" }),
380
- send: /* @__PURE__ */ i(g, { children: [
351
+ send: /* @__PURE__ */ c(v, { children: [
381
352
  /* @__PURE__ */ e("path", { d: "M21 3 10 14" }),
382
353
  /* @__PURE__ */ e("path", { d: "M21 3 14 21l-4-7-7-4Z" })
383
354
  ] }),
384
- inbox: /* @__PURE__ */ i(g, { children: [
355
+ inbox: /* @__PURE__ */ c(v, { children: [
385
356
  /* @__PURE__ */ e("path", { d: "M3 13h5l1 3h6l1-3h5" }),
386
357
  /* @__PURE__ */ e("path", { d: "M5 5h14l2 8v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-6Z" })
387
358
  ] }),
388
- archive: /* @__PURE__ */ i(g, { children: [
359
+ archive: /* @__PURE__ */ c(v, { children: [
389
360
  /* @__PURE__ */ e("rect", { x: "3", y: "4", width: "18", height: "5", rx: "1" }),
390
361
  /* @__PURE__ */ e("path", { d: "M5 9v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V9M10 13h4" })
391
362
  ] }),
392
- trash: /* @__PURE__ */ i(g, { children: [
363
+ trash: /* @__PURE__ */ c(v, { children: [
393
364
  /* @__PURE__ */ e("path", { d: "M4 7h16M10 11v6M14 11v6" }),
394
365
  /* @__PURE__ */ e("path", { d: "M6 7l1 13a2 2 0 0 0 2 1h6a2 2 0 0 0 2-1l1-13M9 7V4h6v3" })
395
366
  ] }),
396
367
  paperclip: /* @__PURE__ */ e("path", { d: "m20 11-8.5 8.5a5 5 0 0 1-7-7L13 4a3.5 3.5 0 0 1 5 5l-8.5 8.5a2 2 0 0 1-3-3L14 7" }),
397
- mic: /* @__PURE__ */ i(g, { children: [
368
+ mic: /* @__PURE__ */ c(v, { children: [
398
369
  /* @__PURE__ */ e("rect", { x: "9", y: "3", width: "6", height: "11", rx: "3" }),
399
370
  /* @__PURE__ */ e("path", { d: "M5 11a7 7 0 0 0 14 0M12 18v3" })
400
371
  ] }),
401
- speaker: /* @__PURE__ */ i(g, { children: [
372
+ speaker: /* @__PURE__ */ c(v, { children: [
402
373
  /* @__PURE__ */ e("path", { d: "M4 9h4l5-4v14l-5-4H4Z" }),
403
374
  /* @__PURE__ */ e("path", { d: "M16 9a4 4 0 0 1 0 6M19 6a8 8 0 0 1 0 12" })
404
375
  ] }),
405
- "user-plus": /* @__PURE__ */ i(g, { children: [
376
+ "user-plus": /* @__PURE__ */ c(v, { children: [
406
377
  /* @__PURE__ */ e("circle", { cx: "10", cy: "8", r: "4" }),
407
378
  /* @__PURE__ */ e("path", { d: "M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6" })
408
379
  ] }),
409
380
  "phone-off": /* @__PURE__ */ e("path", { d: "M3 14c5-5 13-5 18 0l-2 3-4-1v-3a10 10 0 0 0-6 0v3l-4 1Z" }),
410
- video: /* @__PURE__ */ i(g, { children: [
381
+ video: /* @__PURE__ */ c(v, { children: [
411
382
  /* @__PURE__ */ e("rect", { x: "3", y: "6", width: "13", height: "12", rx: "2" }),
412
383
  /* @__PURE__ */ e("path", { d: "m16 10 5-3v10l-5-3" })
413
384
  ] }),
414
- info: /* @__PURE__ */ i(g, { children: [
385
+ info: /* @__PURE__ */ c(v, { children: [
415
386
  /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "9" }),
416
387
  /* @__PURE__ */ e("path", { d: "M12 11v6M12 7.5v.5" })
417
388
  ] }),
@@ -420,7 +391,7 @@ const H = {
420
391
  plus: /* @__PURE__ */ e("path", { d: "M12 5v14M5 12h14" }),
421
392
  folder: /* @__PURE__ */ e("path", { d: "M3 6a2 2 0 0 1 2-2h4l2 3h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z" }),
422
393
  check: /* @__PURE__ */ e("path", { d: "m5 12 5 5 9-10" }),
423
- server: /* @__PURE__ */ i(g, { children: [
394
+ server: /* @__PURE__ */ c(v, { children: [
424
395
  /* @__PURE__ */ e("rect", { x: "3", y: "4", width: "18", height: "7", rx: "2" }),
425
396
  /* @__PURE__ */ e("rect", { x: "3", y: "13", width: "18", height: "7", rx: "2" }),
426
397
  /* @__PURE__ */ e("path", { d: "M7 7.5h.5M7 16.5h.5" })
@@ -428,7 +399,7 @@ const H = {
428
399
  reply: /* @__PURE__ */ e("path", { d: "M10 8 4 13l6 5M4 13h11a5 5 0 0 1 5 5" }),
429
400
  more: /* @__PURE__ */ e("path", { d: "M5 12h.5M12 12h.5M19 12h.5" })
430
401
  };
431
- function y({ name: l, size: n = 20, label: a }) {
402
+ function x({ name: l, size: n = 20, label: a }) {
432
403
  return /* @__PURE__ */ e(
433
404
  "svg",
434
405
  {
@@ -443,64 +414,259 @@ function y({ name: l, size: n = 20, label: a }) {
443
414
  strokeLinejoin: "round",
444
415
  focusable: !1,
445
416
  ...a ? { role: "img", "aria-label": a } : { "aria-hidden": !0 },
446
- children: H[l]
417
+ children: X[l]
447
418
  }
448
419
  );
449
420
  }
450
- const pe = Object.keys(H);
451
- function Y({ count: l, label: n, max: a = 99 }) {
452
- return l <= 0 ? null : /* @__PURE__ */ i("span", { className: "cms-badge", children: [
421
+ const $e = Object.keys(X), re = 'input, select, textarea, button:not([disabled]), iframe, [href], [tabindex]:not([tabindex="-1"])', ie = 60;
422
+ function oe(l) {
423
+ return l instanceof Element && l.closest('input, select, textarea, [contenteditable="true"], [data-viewer-keys]') !== null;
424
+ }
425
+ function de(l) {
426
+ return l instanceof Element && l.closest("[data-viewer-gestures]") !== null;
427
+ }
428
+ function me(l) {
429
+ return l.getClientRects().length > 0;
430
+ }
431
+ function Te(l) {
432
+ const { name: n, badge: a, closeLabel: t, onClose: s, actions: h = [], moreLabel: i = "More", edit: m, editing: d, siblings: r, bar: o, thumbnails: f, strip: u, onZoom: p, children: N } = l, y = A(null), b = A(null), C = I(), [w, D] = E(!1), B = A(null);
433
+ K(() => {
434
+ var L;
435
+ const _ = document.activeElement, k = document.body.style.overflow;
436
+ return document.body.style.overflow = "hidden", (L = b.current) == null || L.focus(), () => {
437
+ var S;
438
+ document.body.style.overflow = k, (S = _ == null ? void 0 : _.focus) == null || S.call(_);
439
+ };
440
+ }, []);
441
+ const Y = () => {
442
+ d != null && d.dirty ? d.onDirtyClose() : s();
443
+ }, G = (_) => {
444
+ const k = _.touches.length === 1 ? _.touches[0] : void 0;
445
+ B.current = k === void 0 || d !== void 0 || de(_.target) ? null : { x: k.clientX, y: k.clientY };
446
+ }, O = (_) => {
447
+ var $, P;
448
+ const k = B.current, L = _.changedTouches[0];
449
+ if (B.current = null, k === null || L === void 0) return;
450
+ const S = L.clientX - k.x;
451
+ Math.abs(S) < ie || Math.abs(S) < Math.abs(L.clientY - k.y) || (S > 0 ? ($ = r == null ? void 0 : r.onPrevious) == null || $.call(r) : (P = r == null ? void 0 : r.onNext) == null || P.call(r));
452
+ };
453
+ return R(
454
+ /* @__PURE__ */ c(
455
+ "div",
456
+ {
457
+ ref: y,
458
+ className: g("cms-viewer", d !== void 0 && "is-editing"),
459
+ role: "dialog",
460
+ "aria-modal": "true",
461
+ "aria-labelledby": C,
462
+ tabIndex: -1,
463
+ onKeyDown: (_) => {
464
+ var k, L, S;
465
+ if (_.key === "Escape") {
466
+ if (d !== void 0) return;
467
+ _.stopPropagation(), w ? D(!1) : s();
468
+ } else if (_.key === "Tab") {
469
+ const $ = Array.from(((k = y.current) == null ? void 0 : k.querySelectorAll(re)) ?? []).filter(me);
470
+ if ($.length === 0) return;
471
+ const P = $[0], U = $[$.length - 1];
472
+ _.shiftKey && document.activeElement === P ? (_.preventDefault(), U.focus()) : !_.shiftKey && document.activeElement === U && (_.preventDefault(), P.focus());
473
+ } else d === void 0 && !oe(_.target) && !_.ctrlKey && !_.metaKey && !_.altKey && (_.key === "ArrowLeft" ? (L = r == null ? void 0 : r.onPrevious) == null || L.call(r) : _.key === "ArrowRight" ? (S = r == null ? void 0 : r.onNext) == null || S.call(r) : _.key === "+" || _.key === "=" ? p == null || p("in") : _.key === "-" ? p == null || p("out") : _.key === "0" && (p == null || p("reset")));
474
+ },
475
+ children: [
476
+ r !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-visually-hidden", role: "status", children: `${n}, ${r.position}` }) : null,
477
+ /* @__PURE__ */ c("header", { className: "cms-viewer__top", children: [
478
+ /* @__PURE__ */ e("button", { ref: b, type: "button", className: "cms-viewer__icon", "aria-label": t, onClick: Y, children: /* @__PURE__ */ e(M, { name: "close" }) }),
479
+ /* @__PURE__ */ e("span", { className: "cms-viewer__badge", children: a }),
480
+ /* @__PURE__ */ e("h2", { className: "cms-viewer__name", id: C, title: n, children: n }),
481
+ r !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-viewer__position", children: r.position }) : null,
482
+ /* @__PURE__ */ e("span", { className: "cms-viewer__space" }),
483
+ d !== void 0 ? /* @__PURE__ */ c(v, { children: [
484
+ /* @__PURE__ */ e("span", { className: "cms-viewer__status", role: "status", children: d.status }),
485
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__button cms-viewer__button--edit", onClick: d.onDone, children: d.doneLabel })
486
+ ] }) : /* @__PURE__ */ c(v, { children: [
487
+ /* @__PURE__ */ e("span", { className: "cms-viewer__actions", children: h.map((_) => /* @__PURE__ */ c("button", { type: "button", className: "cms-viewer__button", onClick: _.onSelect, children: [
488
+ _.icon,
489
+ _.label
490
+ ] }, _.label)) }),
491
+ m !== void 0 ? /* @__PURE__ */ c("button", { type: "button", className: "cms-viewer__button cms-viewer__button--edit", "aria-label": m.label, onClick: m.onEdit, children: [
492
+ m.icon,
493
+ /* @__PURE__ */ e("span", { className: "cms-viewer__wide", children: m.label })
494
+ ] }) : null,
495
+ h.length > 0 ? /* @__PURE__ */ c("span", { className: "cms-viewer__more", children: [
496
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__icon", "aria-label": i, "aria-expanded": w, onClick: () => D((_) => !_), children: /* @__PURE__ */ e(x, { name: "more" }) }),
497
+ w ? /* @__PURE__ */ e("span", { className: "cms-viewer__menu", children: h.map((_) => /* @__PURE__ */ c(
498
+ "button",
499
+ {
500
+ type: "button",
501
+ className: "cms-viewer__button",
502
+ onClick: () => {
503
+ D(!1), _.onSelect();
504
+ },
505
+ children: [
506
+ _.icon,
507
+ _.label
508
+ ]
509
+ },
510
+ _.label
511
+ )) }) : null
512
+ ] }) : null
513
+ ] })
514
+ ] }),
515
+ /* @__PURE__ */ c("div", { className: "cms-viewer__body", children: [
516
+ f != null && d === void 0 ? /* @__PURE__ */ e("nav", { className: "cms-viewer__thumbnails", children: f }) : null,
517
+ /* @__PURE__ */ c("div", { className: "cms-viewer__content", onTouchStart: G, onTouchEnd: O, children: [
518
+ N,
519
+ d === void 0 && (r != null && r.onPrevious) ? /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__side cms-viewer__side--previous", "aria-label": r.previousLabel, onClick: r.onPrevious, children: /* @__PURE__ */ e(M, { name: "back" }) }) : null,
520
+ d === void 0 && (r != null && r.onNext) ? /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__side cms-viewer__side--next", "aria-label": r.nextLabel, onClick: r.onNext, children: /* @__PURE__ */ e(M, { name: "back" }) }) : null,
521
+ d === void 0 && r !== void 0 ? /* @__PURE__ */ e("div", { className: "cms-viewer__dots", "aria-hidden": "true", children: Array.from({ length: Math.min(r.total, 7) }, (_, k) => /* @__PURE__ */ e("i", { className: k === Math.min(r.index, 6) ? "is-current" : void 0 }, k)) }) : null
522
+ ] })
523
+ ] }),
524
+ d === void 0 && u != null ? /* @__PURE__ */ e("div", { className: "cms-viewer__strip", children: u }) : null,
525
+ o != null ? /* @__PURE__ */ e("footer", { className: "cms-viewer__bar", children: o }) : null
526
+ ]
527
+ }
528
+ ),
529
+ document.body
530
+ );
531
+ }
532
+ function Ie({ title: l, scope: n, actions: a, backLink: t }) {
533
+ return /* @__PURE__ */ c("header", { className: "cms-page-header", children: [
534
+ t ? /* @__PURE__ */ c(
535
+ "a",
536
+ {
537
+ className: "cms-page-header__back",
538
+ href: t.href ?? "#",
539
+ onClick: (s) => {
540
+ t.onBack && (s.preventDefault(), t.onBack());
541
+ },
542
+ children: [
543
+ /* @__PURE__ */ e(M, { name: "back" }),
544
+ " ",
545
+ t.label
546
+ ]
547
+ }
548
+ ) : null,
549
+ /* @__PURE__ */ c("div", { className: "cms-page-header__row", children: [
550
+ /* @__PURE__ */ c("div", { className: "cms-page-header__titles", children: [
551
+ /* @__PURE__ */ e("h1", { className: "cms-page-header__title", children: l }),
552
+ n != null ? /* @__PURE__ */ e("p", { className: "cms-page-header__scope", children: n }) : null
553
+ ] }),
554
+ a != null ? /* @__PURE__ */ e("div", { className: "cms-page-header__actions", children: a }) : null
555
+ ] })
556
+ ] });
557
+ }
558
+ function Be({ tabs: l, active: n, onSelect: a, label: t }) {
559
+ const s = A([]), h = (i, m) => {
560
+ var f;
561
+ const d = l.length - 1, r = i.key === "ArrowRight" ? m === d ? 0 : m + 1 : i.key === "ArrowLeft" ? m === 0 ? d : m - 1 : i.key === "Home" ? 0 : i.key === "End" ? d : null;
562
+ if (r === null) return;
563
+ i.preventDefault();
564
+ const o = l[r];
565
+ o && (a(o.id), (f = s.current[r]) == null || f.focus());
566
+ };
567
+ return /* @__PURE__ */ e("div", { className: "cms-tabs", role: "tablist", "aria-label": t, children: l.map((i, m) => {
568
+ const d = i.id === n;
569
+ return /* @__PURE__ */ c(
570
+ "button",
571
+ {
572
+ ref: (r) => {
573
+ s.current[m] = r;
574
+ },
575
+ type: "button",
576
+ role: "tab",
577
+ className: g("cms-tab", d && "is-active"),
578
+ "aria-selected": d,
579
+ tabIndex: d ? 0 : -1,
580
+ onClick: () => a(i.id),
581
+ onKeyDown: (r) => h(r, m),
582
+ children: [
583
+ i.label,
584
+ i.count !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-tab__count", children: i.count }) : null
585
+ ]
586
+ },
587
+ i.id
588
+ );
589
+ }) });
590
+ }
591
+ function ue(l) {
592
+ var t;
593
+ const n = l.trim().split(/\s+/).filter(Boolean);
594
+ return (n.length > 1 ? [n[0][0], n[n.length - 1][0]] : [(t = n[0]) == null ? void 0 : t[0]]).filter(Boolean).join("").toUpperCase();
595
+ }
596
+ function he(l) {
597
+ let n = 0;
598
+ for (const a of l.trim().toLowerCase())
599
+ n = n * 31 + (a.codePointAt(0) ?? 0) >>> 0;
600
+ return n % 6 + 1;
601
+ }
602
+ function V({ name: l, pictureUrl: n, presence: a, size: t = 32 }) {
603
+ return /* @__PURE__ */ c(
604
+ "span",
605
+ {
606
+ className: `cms-avatar cms-avatar--tint-${he(l)}`,
607
+ style: { width: t, height: t, fontSize: Math.round(t * 0.4) },
608
+ role: "img",
609
+ "aria-label": a ? `${l}, ${a}` : l,
610
+ children: [
611
+ n ? /* @__PURE__ */ e("img", { src: n, alt: "", className: "cms-avatar__picture" }) : /* @__PURE__ */ e("span", { "aria-hidden": "true", children: ue(l) }),
612
+ a ? /* @__PURE__ */ e("span", { className: g("cms-avatar__presence", `is-${a}`), "aria-hidden": "true" }) : null
613
+ ]
614
+ }
615
+ );
616
+ }
617
+ function fe({ count: l, label: n, max: a = 99 }) {
618
+ return l <= 0 ? null : /* @__PURE__ */ c("span", { className: "cms-badge", children: [
453
619
  /* @__PURE__ */ e("span", { "aria-hidden": "true", children: l > a ? `${a}+` : l }),
454
620
  /* @__PURE__ */ e("span", { className: "cms-visually-hidden", children: n })
455
621
  ] });
456
622
  }
457
- function _e({ product: l, mark: n, rail: a, active: c, onNavigate: s, server: m, search: r, account: d, children: u, railLabel: h = "Sections" }) {
458
- return /* @__PURE__ */ i("div", { className: "cms-shell", children: [
459
- /* @__PURE__ */ i("nav", { className: "cms-shell__rail", "aria-label": h, children: [
623
+ function Ke({ product: l, mark: n, rail: a, active: t, onNavigate: s, server: h, search: i, account: m, children: d, railLabel: r = "Sections" }) {
624
+ return /* @__PURE__ */ c("div", { className: "cms-shell", children: [
625
+ /* @__PURE__ */ c("nav", { className: "cms-shell__rail", "aria-label": r, children: [
460
626
  /* @__PURE__ */ e("span", { className: "cms-shell__mark", "aria-hidden": "true", children: n }),
461
- /* @__PURE__ */ e("ul", { className: "cms-shell__items", children: a.map((t) => {
462
- const f = t.id === c;
463
- return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
627
+ /* @__PURE__ */ e("ul", { className: "cms-shell__items", children: a.map((o) => {
628
+ const f = o.id === t;
629
+ return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ c(
464
630
  "a",
465
631
  {
466
- href: t.href,
467
- className: v("cms-shell__item", f && "is-active"),
632
+ href: o.href,
633
+ className: g("cms-shell__item", f && "is-active"),
468
634
  "aria-current": f ? "page" : void 0,
469
- title: t.label,
470
- onClick: (o) => {
471
- s && (o.preventDefault(), s(t.id));
635
+ title: o.label,
636
+ onClick: (u) => {
637
+ s && (u.preventDefault(), s(o.id));
472
638
  },
473
639
  children: [
474
- /* @__PURE__ */ i("span", { className: "cms-shell__icon", children: [
475
- /* @__PURE__ */ e(y, { name: t.icon, size: 22 }),
476
- t.badge ? /* @__PURE__ */ e(Y, { count: t.badge.count, label: t.badge.label }) : null
640
+ /* @__PURE__ */ c("span", { className: "cms-shell__icon", children: [
641
+ /* @__PURE__ */ e(x, { name: o.icon, size: 22 }),
642
+ o.badge ? /* @__PURE__ */ e(fe, { count: o.badge.count, label: o.badge.label }) : null
477
643
  ] }),
478
- /* @__PURE__ */ e("span", { className: "cms-shell__label", children: t.label })
644
+ /* @__PURE__ */ e("span", { className: "cms-shell__label", children: o.label })
479
645
  ]
480
646
  }
481
- ) }, t.id);
647
+ ) }, o.id);
482
648
  }) })
483
649
  ] }),
484
- /* @__PURE__ */ i("header", { className: "cms-shell__top", children: [
650
+ /* @__PURE__ */ c("header", { className: "cms-shell__top", children: [
485
651
  /* @__PURE__ */ e("span", { className: "cms-shell__product", children: l }),
486
- m != null ? /* @__PURE__ */ e("div", { className: "cms-shell__server", children: m }) : null,
487
- r != null ? /* @__PURE__ */ e("div", { className: "cms-shell__search", children: r }) : null,
488
- d != null ? /* @__PURE__ */ e("div", { className: "cms-shell__account", children: d }) : null
652
+ h != null ? /* @__PURE__ */ e("div", { className: "cms-shell__server", children: h }) : null,
653
+ i != null ? /* @__PURE__ */ e("div", { className: "cms-shell__search", children: i }) : null,
654
+ m != null ? /* @__PURE__ */ e("div", { className: "cms-shell__account", children: m }) : null
489
655
  ] }),
490
- /* @__PURE__ */ e("main", { className: "cms-shell__main", children: u })
656
+ /* @__PURE__ */ e("main", { className: "cms-shell__main", children: d })
491
657
  ] });
492
658
  }
493
- function be({ label: l, placeholder: n, value: a, onChange: c, onSearch: s }) {
494
- return /* @__PURE__ */ i(
659
+ function Pe({ label: l, placeholder: n, value: a, onChange: t, onSearch: s }) {
660
+ return /* @__PURE__ */ c(
495
661
  "form",
496
662
  {
497
663
  role: "search",
498
664
  className: "cms-search",
499
- onSubmit: (m) => {
500
- m.preventDefault(), s == null || s(a);
665
+ onSubmit: (h) => {
666
+ h.preventDefault(), s == null || s(a);
501
667
  },
502
668
  children: [
503
- /* @__PURE__ */ e(y, { name: "search", size: 18 }),
669
+ /* @__PURE__ */ e(x, { name: "search", size: 18 }),
504
670
  /* @__PURE__ */ e(
505
671
  "input",
506
672
  {
@@ -509,77 +675,77 @@ function be({ label: l, placeholder: n, value: a, onChange: c, onSearch: s }) {
509
675
  "aria-label": l,
510
676
  placeholder: n,
511
677
  value: a,
512
- onChange: (m) => c(m.target.value)
678
+ onChange: (h) => t(h.target.value)
513
679
  }
514
680
  )
515
681
  ]
516
682
  }
517
683
  );
518
684
  }
519
- function ge({ options: l, value: n, onChange: a, label: c }) {
520
- const s = x([]), m = (r, d) => {
685
+ function Fe({ options: l, value: n, onChange: a, label: t }) {
686
+ const s = A([]), h = (i, m) => {
521
687
  var f;
522
- const u = l.length - 1, h = r.key === "ArrowRight" || r.key === "ArrowDown" ? d === u ? 0 : d + 1 : r.key === "ArrowLeft" || r.key === "ArrowUp" ? d === 0 ? u : d - 1 : null;
523
- if (h === null) return;
524
- r.preventDefault();
525
- const t = l[h];
526
- t && (a(t.id), (f = s.current[h]) == null || f.focus());
688
+ const d = l.length - 1, r = i.key === "ArrowRight" || i.key === "ArrowDown" ? m === d ? 0 : m + 1 : i.key === "ArrowLeft" || i.key === "ArrowUp" ? m === 0 ? d : m - 1 : null;
689
+ if (r === null) return;
690
+ i.preventDefault();
691
+ const o = l[r];
692
+ o && (a(o.id), (f = s.current[r]) == null || f.focus());
527
693
  };
528
- return /* @__PURE__ */ e("div", { className: "cms-chips", role: "radiogroup", "aria-label": c, children: l.map((r, d) => {
529
- const u = r.id === n;
530
- return /* @__PURE__ */ i(
694
+ return /* @__PURE__ */ e("div", { className: "cms-chips", role: "radiogroup", "aria-label": t, children: l.map((i, m) => {
695
+ const d = i.id === n;
696
+ return /* @__PURE__ */ c(
531
697
  "button",
532
698
  {
533
- ref: (h) => {
534
- s.current[d] = h;
699
+ ref: (r) => {
700
+ s.current[m] = r;
535
701
  },
536
702
  type: "button",
537
703
  role: "radio",
538
- "aria-checked": u,
539
- tabIndex: u ? 0 : -1,
540
- className: v("cms-chip", u && "is-on"),
541
- onClick: () => a(r.id),
542
- onKeyDown: (h) => m(h, d),
704
+ "aria-checked": d,
705
+ tabIndex: d ? 0 : -1,
706
+ className: g("cms-chip", d && "is-on"),
707
+ onClick: () => a(i.id),
708
+ onKeyDown: (r) => h(r, m),
543
709
  children: [
544
- u ? /* @__PURE__ */ e(y, { name: "check", size: 16 }) : null,
545
- r.label
710
+ d ? /* @__PURE__ */ e(x, { name: "check", size: 16 }) : null,
711
+ i.label
546
712
  ]
547
713
  },
548
- r.id
714
+ i.id
549
715
  );
550
716
  }) });
551
717
  }
552
- function ve({ panes: l, active: n, back: a }) {
553
- const c = Math.min(Math.max(n ?? l.length - 1, 0), l.length - 1);
554
- return /* @__PURE__ */ e("div", { className: v("cms-panes", l.length === 3 ? "cms-panes--three" : "cms-panes--two"), "data-active": c, children: l.map((s, m) => /* @__PURE__ */ i("section", { className: "cms-panes__pane", "aria-label": s.label, "data-offset": c - m, children: [
555
- m === c && a ? /* @__PURE__ */ i("a", { className: "cms-panes__back", href: a.href, children: [
556
- /* @__PURE__ */ e(y, { name: "chevron-left", size: 18 }),
718
+ function Ze({ panes: l, active: n, back: a }) {
719
+ const t = Math.min(Math.max(n ?? l.length - 1, 0), l.length - 1);
720
+ return /* @__PURE__ */ e("div", { className: g("cms-panes", l.length === 3 ? "cms-panes--three" : "cms-panes--two"), "data-active": t, children: l.map((s, h) => /* @__PURE__ */ c("section", { className: "cms-panes__pane", "aria-label": s.label, "data-offset": t - h, children: [
721
+ h === t && a ? /* @__PURE__ */ c("a", { className: "cms-panes__back", href: a.href, children: [
722
+ /* @__PURE__ */ e(x, { name: "chevron-left", size: 18 }),
557
723
  a.label
558
724
  ] }) : null,
559
725
  s.content
560
726
  ] }, s.label)) });
561
727
  }
562
- const Q = { attachment: "Has an attachment", unread: "Unread" };
563
- function Ne({ from: l, subject: n, preview: a, time: c, unread: s, hasAttachment: m, selected: r, onOpen: d, labels: u }) {
564
- const h = L(Q, u);
565
- return /* @__PURE__ */ i(
728
+ const pe = { attachment: "Has an attachment", unread: "Unread" };
729
+ function Ve({ from: l, subject: n, preview: a, time: t, unread: s, hasAttachment: h, selected: i, onOpen: m, labels: d }) {
730
+ const r = Z(pe, d);
731
+ return /* @__PURE__ */ c(
566
732
  "button",
567
733
  {
568
734
  type: "button",
569
- className: v("cms-mail-row", s && "is-unread", r && "is-selected"),
570
- "aria-current": r ? "true" : void 0,
571
- onClick: d,
735
+ className: g("cms-mail-row", s && "is-unread", i && "is-selected"),
736
+ "aria-current": i ? "true" : void 0,
737
+ onClick: m,
572
738
  children: [
573
- /* @__PURE__ */ e(S, { name: l, size: 40 }),
574
- /* @__PURE__ */ i("span", { className: "cms-mail-row__body", children: [
575
- /* @__PURE__ */ i("span", { className: "cms-mail-row__line", children: [
739
+ /* @__PURE__ */ e(V, { name: l, size: 40 }),
740
+ /* @__PURE__ */ c("span", { className: "cms-mail-row__body", children: [
741
+ /* @__PURE__ */ c("span", { className: "cms-mail-row__line", children: [
576
742
  /* @__PURE__ */ e("span", { className: "cms-mail-row__from", children: l }),
577
- m ? /* @__PURE__ */ e(y, { name: "paperclip", size: 16, label: h.attachment }) : null,
578
- /* @__PURE__ */ e("span", { className: "cms-mail-row__time", children: c })
743
+ h ? /* @__PURE__ */ e(x, { name: "paperclip", size: 16, label: r.attachment }) : null,
744
+ /* @__PURE__ */ e("span", { className: "cms-mail-row__time", children: t })
579
745
  ] }),
580
- /* @__PURE__ */ i("span", { className: "cms-mail-row__line", children: [
746
+ /* @__PURE__ */ c("span", { className: "cms-mail-row__line", children: [
581
747
  /* @__PURE__ */ e("span", { className: "cms-mail-row__subject", children: n }),
582
- s ? /* @__PURE__ */ e("span", { className: "cms-mail-row__dot", role: "img", "aria-label": h.unread }) : null
748
+ s ? /* @__PURE__ */ e("span", { className: "cms-mail-row__dot", role: "img", "aria-label": r.unread }) : null
583
749
  ] }),
584
750
  /* @__PURE__ */ e("span", { className: "cms-mail-row__preview", children: a })
585
751
  ] })
@@ -587,48 +753,48 @@ function Ne({ from: l, subject: n, preview: a, time: c, unread: s, hasAttachment
587
753
  }
588
754
  );
589
755
  }
590
- function ye({ direction: l, children: n, time: a, read: c, readLabel: s = "Read" }) {
591
- return /* @__PURE__ */ i("div", { className: v("cms-bubble", `cms-bubble--${l}`), children: [
756
+ function He({ direction: l, children: n, time: a, read: t, readLabel: s = "Read" }) {
757
+ return /* @__PURE__ */ c("div", { className: g("cms-bubble", `cms-bubble--${l}`), children: [
592
758
  /* @__PURE__ */ e("div", { className: "cms-bubble__text", children: n }),
593
- /* @__PURE__ */ i("div", { className: "cms-bubble__meta", children: [
759
+ /* @__PURE__ */ c("div", { className: "cms-bubble__meta", children: [
594
760
  a,
595
- l === "out" && c ? /* @__PURE__ */ i(g, { children: [
761
+ l === "out" && t ? /* @__PURE__ */ c(v, { children: [
596
762
  " · ",
597
763
  s
598
764
  ] }) : null
599
765
  ] })
600
766
  ] });
601
767
  }
602
- function we({ label: l, value: n, onChange: a, onSend: c, onAttach: s, placeholder: m, variant: r = "chat", sendLabel: d = "Send", attachLabel: u = "Attach a file" }) {
603
- const h = E(), t = n.trim() === "", f = (p) => {
604
- p.preventDefault(), t || c();
605
- }, o = s ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button cms-composer__attach", "aria-label": u, onClick: s, children: /* @__PURE__ */ e(y, { name: "paperclip" }) }) : null;
606
- return /* @__PURE__ */ i("form", { className: v("cms-composer", `cms-composer--${r}`), onSubmit: f, children: [
607
- /* @__PURE__ */ e("label", { htmlFor: h, className: r === "reply" ? "cms-composer__title" : "cms-visually-hidden", children: l }),
608
- r === "chat" ? o : null,
768
+ function Re({ label: l, value: n, onChange: a, onSend: t, onAttach: s, placeholder: h, variant: i = "chat", sendLabel: m = "Send", attachLabel: d = "Attach a file" }) {
769
+ const r = I(), o = n.trim() === "", f = (p) => {
770
+ p.preventDefault(), o || t();
771
+ }, u = s ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button cms-composer__attach", "aria-label": d, onClick: s, children: /* @__PURE__ */ e(x, { name: "paperclip" }) }) : null;
772
+ return /* @__PURE__ */ c("form", { className: g("cms-composer", `cms-composer--${i}`), onSubmit: f, children: [
773
+ /* @__PURE__ */ e("label", { htmlFor: r, className: i === "reply" ? "cms-composer__title" : "cms-visually-hidden", children: l }),
774
+ i === "chat" ? u : null,
609
775
  /* @__PURE__ */ e(
610
776
  "textarea",
611
777
  {
612
- id: h,
778
+ id: r,
613
779
  className: "cms-composer__input",
614
- rows: r === "reply" ? 3 : 1,
615
- placeholder: m,
780
+ rows: i === "reply" ? 3 : 1,
781
+ placeholder: h,
616
782
  value: n,
617
783
  onChange: (p) => a(p.target.value),
618
784
  onKeyDown: (p) => {
619
- p.nativeEvent.isComposing || p.keyCode === 229 || r === "chat" && p.key === "Enter" && !p.shiftKey && (p.preventDefault(), t || c());
785
+ p.nativeEvent.isComposing || p.keyCode === 229 || i === "chat" && p.key === "Enter" && !p.shiftKey && (p.preventDefault(), o || t());
620
786
  }
621
787
  }
622
788
  ),
623
- r === "reply" ? o : null,
624
- r === "chat" ? /* @__PURE__ */ e("button", { type: "submit", className: "cms-composer__send-round", "aria-label": d, disabled: t, children: /* @__PURE__ */ e(y, { name: "send" }) }) : /* @__PURE__ */ i("button", { type: "submit", className: "cms-button cms-button--chrome cms-composer__send", disabled: t, children: [
625
- d,
789
+ i === "reply" ? u : null,
790
+ i === "chat" ? /* @__PURE__ */ e("button", { type: "submit", className: "cms-composer__send-round", "aria-label": m, disabled: o, children: /* @__PURE__ */ e(x, { name: "send" }) }) : /* @__PURE__ */ c("button", { type: "submit", className: "cms-button cms-button--chrome cms-composer__send", disabled: o, children: [
791
+ m,
626
792
  " ",
627
- /* @__PURE__ */ e(y, { name: "send", size: 18 })
793
+ /* @__PURE__ */ e(x, { name: "send", size: 18 })
628
794
  ] })
629
795
  ] });
630
796
  }
631
- const Z = {
797
+ const W = {
632
798
  incomingAudio: "Incoming audio call",
633
799
  incomingVideo: "Incoming video call",
634
800
  incomingFrom: (l, n) => `${l} from ${n}`,
@@ -649,91 +815,91 @@ const Z = {
649
815
  onCallWith: (l) => `On a call with ${l}`,
650
816
  returnToCall: "Return to call"
651
817
  };
652
- function ke({ name: l, media: n, onAccept: a, onDecline: c, labels: s }) {
653
- const m = L(Z, s), r = n === "video" ? m.incomingVideo : m.incomingAudio;
654
- return /* @__PURE__ */ i("div", { className: "cms-call-incoming", role: "alertdialog", "aria-label": m.incomingFrom(r, l), children: [
655
- /* @__PURE__ */ e("span", { className: "cms-call-incoming__ring", "aria-hidden": "true", children: /* @__PURE__ */ e(S, { name: l, size: 112 }) }),
818
+ function We({ name: l, media: n, onAccept: a, onDecline: t, labels: s }) {
819
+ const h = Z(W, s), i = n === "video" ? h.incomingVideo : h.incomingAudio;
820
+ return /* @__PURE__ */ c("div", { className: "cms-call-incoming", role: "alertdialog", "aria-label": h.incomingFrom(i, l), children: [
821
+ /* @__PURE__ */ e("span", { className: "cms-call-incoming__ring", "aria-hidden": "true", children: /* @__PURE__ */ e(V, { name: l, size: 112 }) }),
656
822
  /* @__PURE__ */ e("p", { className: "cms-call-incoming__name", children: l }),
657
- /* @__PURE__ */ e("p", { className: "cms-call-incoming__what", children: r }),
658
- /* @__PURE__ */ i("div", { className: "cms-call-incoming__actions", children: [
659
- /* @__PURE__ */ e(A, { icon: "phone-off", label: m.decline, tone: "hang-up", onClick: c }),
660
- /* @__PURE__ */ e(A, { icon: "phone", label: m.accept, tone: "accept", onClick: a })
823
+ /* @__PURE__ */ e("p", { className: "cms-call-incoming__what", children: i }),
824
+ /* @__PURE__ */ c("div", { className: "cms-call-incoming__actions", children: [
825
+ /* @__PURE__ */ e(T, { icon: "phone-off", label: h.decline, tone: "hang-up", onClick: t }),
826
+ /* @__PURE__ */ e(T, { icon: "phone", label: h.accept, tone: "accept", onClick: a })
661
827
  ] })
662
828
  ] });
663
829
  }
664
- function A({ icon: l, label: n, onClick: a, tone: c = "plain", pressed: s }) {
665
- return /* @__PURE__ */ i(
830
+ function T({ icon: l, label: n, onClick: a, tone: t = "plain", pressed: s }) {
831
+ return /* @__PURE__ */ c(
666
832
  "button",
667
833
  {
668
834
  type: "button",
669
- className: v("cms-call-button", `cms-call-button--${c}`, s && "is-pressed"),
835
+ className: g("cms-call-button", `cms-call-button--${t}`, s && "is-pressed"),
670
836
  "aria-pressed": s,
671
837
  onClick: a,
672
838
  children: [
673
- /* @__PURE__ */ e("span", { className: "cms-call-button__disc", children: /* @__PURE__ */ e(y, { name: l, size: 24 }) }),
839
+ /* @__PURE__ */ e("span", { className: "cms-call-button__disc", children: /* @__PURE__ */ e(x, { name: l, size: 24 }) }),
674
840
  /* @__PURE__ */ e("span", { className: "cms-call-button__label", children: n })
675
841
  ]
676
842
  }
677
843
  );
678
844
  }
679
- function Me({ name: l, duration: n, connection: a, you: c, muted: s, speaker: m, onToggleMute: r, onToggleSpeaker: d, onAddPerson: u, onChat: h, onHangUp: t, labels: f }) {
680
- const o = L(Z, f);
681
- return /* @__PURE__ */ i("section", { className: "cms-call-panel", "aria-label": o.callWith(l), children: [
682
- /* @__PURE__ */ i("div", { className: "cms-call-panel__head", children: [
683
- /* @__PURE__ */ e(S, { name: l, size: 64 }),
684
- /* @__PURE__ */ i("div", { className: "cms-call-panel__who", children: [
845
+ function Ue({ name: l, duration: n, connection: a, you: t, muted: s, speaker: h, onToggleMute: i, onToggleSpeaker: m, onAddPerson: d, onChat: r, onHangUp: o, labels: f }) {
846
+ const u = Z(W, f);
847
+ return /* @__PURE__ */ c("section", { className: "cms-call-panel", "aria-label": u.callWith(l), children: [
848
+ /* @__PURE__ */ c("div", { className: "cms-call-panel__head", children: [
849
+ /* @__PURE__ */ e(V, { name: l, size: 64 }),
850
+ /* @__PURE__ */ c("div", { className: "cms-call-panel__who", children: [
685
851
  /* @__PURE__ */ e("p", { className: "cms-call-panel__name", children: l }),
686
- /* @__PURE__ */ e("p", { className: "cms-call-panel__time", "aria-label": o.callTime(n), children: n })
852
+ /* @__PURE__ */ e("p", { className: "cms-call-panel__time", "aria-label": u.callTime(n), children: n })
687
853
  ] }),
688
- /* @__PURE__ */ e("span", { className: v("cms-pill", a === "good" ? "cms-pill--success" : "cms-pill--warning"), children: a === "good" ? o.goodConnection : o.poorConnection })
854
+ /* @__PURE__ */ e("span", { className: g("cms-pill", a === "good" ? "cms-pill--success" : "cms-pill--warning"), children: a === "good" ? u.goodConnection : u.poorConnection })
689
855
  ] }),
690
- /* @__PURE__ */ i("div", { className: "cms-call-panel__you", children: [
691
- /* @__PURE__ */ e(S, { name: c.name, size: 36 }),
692
- /* @__PURE__ */ e("span", { children: o.you }),
693
- c.speaking ? /* @__PURE__ */ e("span", { className: "cms-call-panel__level", role: "img", "aria-label": o.speaking }) : null
856
+ /* @__PURE__ */ c("div", { className: "cms-call-panel__you", children: [
857
+ /* @__PURE__ */ e(V, { name: t.name, size: 36 }),
858
+ /* @__PURE__ */ e("span", { children: u.you }),
859
+ t.speaking ? /* @__PURE__ */ e("span", { className: "cms-call-panel__level", role: "img", "aria-label": u.speaking }) : null
694
860
  ] }),
695
- /* @__PURE__ */ i("div", { className: "cms-call-panel__controls", children: [
696
- /* @__PURE__ */ e(A, { icon: "mic", label: s ? o.unmute : o.mute, pressed: s, onClick: r }),
697
- /* @__PURE__ */ e(A, { icon: "speaker", label: o.speaker, pressed: m, onClick: d }),
698
- u ? /* @__PURE__ */ e(A, { icon: "user-plus", label: o.addPerson, onClick: u }) : null,
699
- h ? /* @__PURE__ */ e(A, { icon: "chat", label: o.chat, onClick: h }) : null,
700
- /* @__PURE__ */ e(A, { icon: "phone-off", label: o.hangUp, tone: "hang-up", onClick: t })
861
+ /* @__PURE__ */ c("div", { className: "cms-call-panel__controls", children: [
862
+ /* @__PURE__ */ e(T, { icon: "mic", label: s ? u.unmute : u.mute, pressed: s, onClick: i }),
863
+ /* @__PURE__ */ e(T, { icon: "speaker", label: u.speaker, pressed: h, onClick: m }),
864
+ d ? /* @__PURE__ */ e(T, { icon: "user-plus", label: u.addPerson, onClick: d }) : null,
865
+ r ? /* @__PURE__ */ e(T, { icon: "chat", label: u.chat, onClick: r }) : null,
866
+ /* @__PURE__ */ e(T, { icon: "phone-off", label: u.hangUp, tone: "hang-up", onClick: o })
701
867
  ] })
702
868
  ] });
703
869
  }
704
- function Ce({ name: l, duration: n, muted: a, onToggleMute: c, onReturn: s, onHangUp: m, labels: r }) {
705
- const d = L(Z, r);
706
- return /* @__PURE__ */ i("section", { className: "cms-call-bar", "aria-label": d.callWith(l), children: [
870
+ function je({ name: l, duration: n, muted: a, onToggleMute: t, onReturn: s, onHangUp: h, labels: i }) {
871
+ const m = Z(W, i);
872
+ return /* @__PURE__ */ c("section", { className: "cms-call-bar", "aria-label": m.callWith(l), children: [
707
873
  /* @__PURE__ */ e("span", { className: "cms-call-bar__live", "aria-hidden": "true" }),
708
- /* @__PURE__ */ e("span", { className: "cms-call-bar__name", children: d.onCallWith(l) }),
874
+ /* @__PURE__ */ e("span", { className: "cms-call-bar__name", children: m.onCallWith(l) }),
709
875
  /* @__PURE__ */ e("span", { className: "cms-call-bar__time", children: n }),
710
- /* @__PURE__ */ i("span", { className: "cms-call-bar__actions", children: [
711
- /* @__PURE__ */ e("button", { type: "button", className: "cms-call-bar__icon", "aria-label": a ? d.unmute : d.mute, "aria-pressed": a, onClick: c, children: /* @__PURE__ */ e(y, { name: "mic" }) }),
712
- /* @__PURE__ */ e("button", { type: "button", className: "cms-button cms-button--primary", onClick: s, children: d.returnToCall }),
713
- /* @__PURE__ */ e("button", { type: "button", className: "cms-call-bar__icon cms-call-bar__icon--hang-up", "aria-label": d.hangUp, onClick: m, children: /* @__PURE__ */ e(y, { name: "phone-off" }) })
876
+ /* @__PURE__ */ c("span", { className: "cms-call-bar__actions", children: [
877
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-call-bar__icon", "aria-label": a ? m.unmute : m.mute, "aria-pressed": a, onClick: t, children: /* @__PURE__ */ e(x, { name: "mic" }) }),
878
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-button cms-button--primary", onClick: s, children: m.returnToCall }),
879
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-call-bar__icon cms-call-bar__icon--hang-up", "aria-label": m.hangUp, onClick: h, children: /* @__PURE__ */ e(x, { name: "phone-off" }) })
714
880
  ] })
715
881
  ] });
716
882
  }
717
- function xe({ mark: l, product: n, headline: a, lead: c, features: s = [], children: m }) {
718
- return /* @__PURE__ */ i("div", { className: "cms-signin", children: [
719
- /* @__PURE__ */ i("aside", { className: "cms-signin__brand", children: [
720
- /* @__PURE__ */ i("p", { className: "cms-signin__logo", children: [
883
+ function qe({ mark: l, product: n, headline: a, lead: t, features: s = [], children: h }) {
884
+ return /* @__PURE__ */ c("div", { className: "cms-signin", children: [
885
+ /* @__PURE__ */ c("aside", { className: "cms-signin__brand", children: [
886
+ /* @__PURE__ */ c("p", { className: "cms-signin__logo", children: [
721
887
  /* @__PURE__ */ e("span", { className: "cms-signin__mark", "aria-hidden": "true", children: l }),
722
888
  n
723
889
  ] }),
724
- /* @__PURE__ */ i("div", { className: "cms-signin__pitch", children: [
890
+ /* @__PURE__ */ c("div", { className: "cms-signin__pitch", children: [
725
891
  /* @__PURE__ */ e("p", { className: "cms-signin__headline", children: a }),
726
- /* @__PURE__ */ e("p", { className: "cms-signin__lead", children: c }),
727
- s.length ? /* @__PURE__ */ e("ul", { className: "cms-signin__features", children: s.map((r) => /* @__PURE__ */ i("li", { children: [
728
- /* @__PURE__ */ e(y, { name: r.icon, size: 18 }),
729
- r.label
730
- ] }, r.label)) }) : null
892
+ /* @__PURE__ */ e("p", { className: "cms-signin__lead", children: t }),
893
+ s.length ? /* @__PURE__ */ e("ul", { className: "cms-signin__features", children: s.map((i) => /* @__PURE__ */ c("li", { children: [
894
+ /* @__PURE__ */ e(x, { name: i.icon, size: 18 }),
895
+ i.label
896
+ ] }, i.label)) }) : null
731
897
  ] })
732
898
  ] }),
733
- /* @__PURE__ */ e("main", { className: "cms-signin__form", children: m })
899
+ /* @__PURE__ */ e("main", { className: "cms-signin__form", children: h })
734
900
  ] });
735
901
  }
736
- const J = {
902
+ const _e = {
737
903
  title: "Sign in",
738
904
  identifier: "Email or username",
739
905
  identifierPlaceholder: "name@example.com",
@@ -745,166 +911,166 @@ const J = {
745
911
  newHere: "New here?",
746
912
  create: "Create an account"
747
913
  };
748
- function Ae({ server: l, onSubmit: n, forgotHref: a, createHref: c, error: s, busy: m, labels: r }) {
749
- const d = L(J, r), u = E(), [h, t] = C(""), [f, o] = C(""), [p, b] = C(!1);
750
- return /* @__PURE__ */ i("form", { className: "cms-signin-form", onSubmit: (_) => {
751
- _.preventDefault(), n(h, f);
752
- }, "aria-describedby": s ? `${u}-error` : void 0, children: [
753
- /* @__PURE__ */ e("h1", { className: "cms-signin-form__title", children: d.title }),
754
- /* @__PURE__ */ i("p", { className: "cms-signin-form__server", children: [
755
- /* @__PURE__ */ e(y, { name: "server", size: 18 }),
914
+ function ze({ server: l, onSubmit: n, forgotHref: a, createHref: t, error: s, busy: h, labels: i }) {
915
+ const m = Z(_e, i), d = I(), [r, o] = E(""), [f, u] = E(""), [p, N] = E(!1);
916
+ return /* @__PURE__ */ c("form", { className: "cms-signin-form", onSubmit: (b) => {
917
+ b.preventDefault(), n(r, f);
918
+ }, "aria-describedby": s ? `${d}-error` : void 0, children: [
919
+ /* @__PURE__ */ e("h1", { className: "cms-signin-form__title", children: m.title }),
920
+ /* @__PURE__ */ c("p", { className: "cms-signin-form__server", children: [
921
+ /* @__PURE__ */ e(x, { name: "server", size: 18 }),
756
922
  l
757
923
  ] }),
758
- /* @__PURE__ */ e("label", { className: "cms-signin-form__label", htmlFor: `${u}-identifier`, children: d.identifier }),
924
+ /* @__PURE__ */ e("label", { className: "cms-signin-form__label", htmlFor: `${d}-identifier`, children: m.identifier }),
759
925
  /* @__PURE__ */ e(
760
926
  "input",
761
927
  {
762
- id: `${u}-identifier`,
928
+ id: `${d}-identifier`,
763
929
  className: "cms-signin-form__input",
764
930
  type: "text",
765
931
  autoComplete: "username",
766
- placeholder: d.identifierPlaceholder,
767
- value: h,
768
- onChange: (_) => t(_.target.value),
932
+ placeholder: m.identifierPlaceholder,
933
+ value: r,
934
+ onChange: (b) => o(b.target.value),
769
935
  required: !0
770
936
  }
771
937
  ),
772
- /* @__PURE__ */ e("label", { className: "cms-signin-form__label", htmlFor: `${u}-password`, children: d.password }),
773
- /* @__PURE__ */ i("span", { className: "cms-signin-form__password", children: [
938
+ /* @__PURE__ */ e("label", { className: "cms-signin-form__label", htmlFor: `${d}-password`, children: m.password }),
939
+ /* @__PURE__ */ c("span", { className: "cms-signin-form__password", children: [
774
940
  /* @__PURE__ */ e(
775
941
  "input",
776
942
  {
777
- id: `${u}-password`,
943
+ id: `${d}-password`,
778
944
  className: "cms-signin-form__input",
779
945
  type: p ? "text" : "password",
780
946
  autoComplete: "current-password",
781
947
  value: f,
782
- onChange: (_) => o(_.target.value),
948
+ onChange: (b) => u(b.target.value),
783
949
  required: !0
784
950
  }
785
951
  ),
786
- /* @__PURE__ */ e("button", { type: "button", className: "cms-signin-form__show", "aria-pressed": p, onClick: () => b((_) => !_), children: p ? d.hide : d.show })
952
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-signin-form__show", "aria-pressed": p, onClick: () => N((b) => !b), children: p ? m.hide : m.show })
787
953
  ] }),
788
- a ? /* @__PURE__ */ e("a", { className: "cms-signin-form__forgot", href: a, children: d.forgot }) : null,
789
- s ? /* @__PURE__ */ e("p", { id: `${u}-error`, className: "cms-signin-form__error", role: "alert", children: s }) : null,
790
- /* @__PURE__ */ e("button", { type: "submit", className: "cms-button cms-button--chrome cms-signin-form__submit", disabled: m, "aria-busy": m || void 0, children: d.submit }),
791
- c ? /* @__PURE__ */ i(g, { children: [
792
- /* @__PURE__ */ e("p", { className: "cms-signin-form__or", children: /* @__PURE__ */ e("span", { children: d.newHere }) }),
793
- /* @__PURE__ */ e("a", { className: "cms-button cms-signin-form__create", href: c, children: d.create })
954
+ a ? /* @__PURE__ */ e("a", { className: "cms-signin-form__forgot", href: a, children: m.forgot }) : null,
955
+ s ? /* @__PURE__ */ e("p", { id: `${d}-error`, className: "cms-signin-form__error", role: "alert", children: s }) : null,
956
+ /* @__PURE__ */ e("button", { type: "submit", className: "cms-button cms-button--chrome cms-signin-form__submit", disabled: h, "aria-busy": h || void 0, children: m.submit }),
957
+ t ? /* @__PURE__ */ c(v, { children: [
958
+ /* @__PURE__ */ e("p", { className: "cms-signin-form__or", children: /* @__PURE__ */ e("span", { children: m.newHere }) }),
959
+ /* @__PURE__ */ e("a", { className: "cms-button cms-signin-form__create", href: t, children: m.create })
794
960
  ] }) : null
795
961
  ] });
796
962
  }
797
- function Ee({ label: l, rows: n, error: a, onRetry: c, loadingText: s = "Loading", emptyTitle: m = "Nothing here yet", emptyHint: r, selected: d, onOpen: u, onRowMenu: h }) {
798
- const t = x([]);
799
- if (a != null) return /* @__PURE__ */ e(q, { message: a, onRetry: c });
800
- if (n === null) return /* @__PURE__ */ e(U, { what: s, layout: "block" });
801
- if (n.length === 0) return /* @__PURE__ */ e(W, { title: m, hint: r });
802
- const f = (o, p, b) => {
803
- var N;
804
- if (o.key === "ArrowDown" || o.key === "ArrowUp")
805
- o.preventDefault(), (N = t.current[Math.min(n.length - 1, Math.max(0, p + (o.key === "ArrowDown" ? 1 : -1)))]) == null || N.focus();
806
- else if (o.key === "Enter")
807
- u == null || u(b);
808
- else if ((o.key === "ContextMenu" || o.shiftKey && o.key === "F10") && h) {
809
- o.preventDefault();
810
- const _ = o.currentTarget.getBoundingClientRect();
811
- h(b, { x: _.left + 16, y: _.bottom });
963
+ function Xe({ label: l, rows: n, error: a, onRetry: t, loadingText: s = "Loading", emptyTitle: h = "Nothing here yet", emptyHint: i, selected: m, onOpen: d, onRowMenu: r }) {
964
+ const o = A([]);
965
+ if (a != null) return /* @__PURE__ */ e(se, { message: a, onRetry: t });
966
+ if (n === null) return /* @__PURE__ */ e(ne, { what: s, layout: "block" });
967
+ if (n.length === 0) return /* @__PURE__ */ e(ae, { title: h, hint: i });
968
+ const f = (u, p, N) => {
969
+ var y;
970
+ if (u.key === "ArrowDown" || u.key === "ArrowUp")
971
+ u.preventDefault(), (y = o.current[Math.min(n.length - 1, Math.max(0, p + (u.key === "ArrowDown" ? 1 : -1)))]) == null || y.focus();
972
+ else if (u.key === "Enter")
973
+ d == null || d(N);
974
+ else if ((u.key === "ContextMenu" || u.shiftKey && u.key === "F10") && r) {
975
+ u.preventDefault();
976
+ const b = u.currentTarget.getBoundingClientRect();
977
+ r(N, { x: b.left + 16, y: b.bottom });
812
978
  }
813
979
  };
814
- return /* @__PURE__ */ e("ul", { className: "cms-list", role: "listbox", "aria-label": l, children: n.map((o, p) => {
815
- const b = o.id === d;
816
- return /* @__PURE__ */ i(
980
+ return /* @__PURE__ */ e("ul", { className: "cms-list", role: "listbox", "aria-label": l, children: n.map((u, p) => {
981
+ const N = u.id === m;
982
+ return /* @__PURE__ */ c(
817
983
  "li",
818
984
  {
819
- ref: (N) => {
820
- t.current[p] = N;
985
+ ref: (y) => {
986
+ o.current[p] = y;
821
987
  },
822
988
  role: "option",
823
- "aria-selected": b,
824
- tabIndex: b || d == null && p === 0 ? 0 : -1,
825
- className: v("cms-list__row", b && "is-selected"),
826
- onClick: () => u == null ? void 0 : u(o.id),
827
- onKeyDown: (N) => f(N, p, o.id),
828
- onContextMenu: h ? (N) => {
829
- N.preventDefault(), h(o.id, { x: N.clientX, y: N.clientY });
989
+ "aria-selected": N,
990
+ tabIndex: N || m == null && p === 0 ? 0 : -1,
991
+ className: g("cms-list__row", N && "is-selected"),
992
+ onClick: () => d == null ? void 0 : d(u.id),
993
+ onKeyDown: (y) => f(y, p, u.id),
994
+ onContextMenu: r ? (y) => {
995
+ y.preventDefault(), r(u.id, { x: y.clientX, y: y.clientY });
830
996
  } : void 0,
831
997
  children: [
832
- o.lead != null ? /* @__PURE__ */ e("span", { className: "cms-list__lead", children: o.lead }) : null,
833
- /* @__PURE__ */ i("span", { className: "cms-list__text", children: [
834
- /* @__PURE__ */ e("span", { className: "cms-list__primary", children: o.primary }),
835
- o.secondary != null ? /* @__PURE__ */ e("span", { className: "cms-list__secondary", children: o.secondary }) : null
998
+ u.lead != null ? /* @__PURE__ */ e("span", { className: "cms-list__lead", children: u.lead }) : null,
999
+ /* @__PURE__ */ c("span", { className: "cms-list__text", children: [
1000
+ /* @__PURE__ */ e("span", { className: "cms-list__primary", children: u.primary }),
1001
+ u.secondary != null ? /* @__PURE__ */ e("span", { className: "cms-list__secondary", children: u.secondary }) : null
836
1002
  ] }),
837
- o.meta != null ? /* @__PURE__ */ e("span", { className: "cms-list__meta", children: o.meta }) : null
1003
+ u.meta != null ? /* @__PURE__ */ e("span", { className: "cms-list__meta", children: u.meta }) : null
838
1004
  ]
839
1005
  },
840
- o.id
1006
+ u.id
841
1007
  );
842
1008
  }) });
843
1009
  }
844
- function Le({ at: l, items: n, onClose: a, label: c = "Actions" }) {
845
- const s = x(null), m = x(null), [r, d] = C(l), u = n.filter((t) => t.offer.offered);
846
- if (R(() => {
1010
+ function Ye({ at: l, items: n, onClose: a, label: t = "Actions" }) {
1011
+ const s = A(null), h = A(null), [i, m] = E(l), d = n.filter((o) => o.offer.offered);
1012
+ if (Q(() => {
847
1013
  if (!l) return;
848
- const t = s.current, f = (t == null ? void 0 : t.offsetWidth) ?? 0, o = (t == null ? void 0 : t.offsetHeight) ?? 0;
849
- d({ x: Math.max(0, Math.min(l.x, window.innerWidth - f)), y: Math.max(0, Math.min(l.y, window.innerHeight - o)) });
850
- }, [l]), D(() => {
851
- var f, o;
1014
+ const o = s.current, f = (o == null ? void 0 : o.offsetWidth) ?? 0, u = (o == null ? void 0 : o.offsetHeight) ?? 0;
1015
+ m({ x: Math.max(0, Math.min(l.x, window.innerWidth - f)), y: Math.max(0, Math.min(l.y, window.innerHeight - u)) });
1016
+ }, [l]), K(() => {
1017
+ var f, u;
852
1018
  if (!l) return;
853
- m.current = document.activeElement, (o = (f = s.current) == null ? void 0 : f.querySelector('[role="menuitem"]:not([aria-disabled="true"])')) == null || o.focus();
854
- const t = (p) => {
855
- var b;
856
- (b = s.current) != null && b.contains(p.target) || a();
1019
+ h.current = document.activeElement, (u = (f = s.current) == null ? void 0 : f.querySelector('[role="menuitem"]:not([aria-disabled="true"])')) == null || u.focus();
1020
+ const o = (p) => {
1021
+ var N;
1022
+ (N = s.current) != null && N.contains(p.target) || a();
857
1023
  };
858
- return document.addEventListener("mousedown", t), () => {
859
- var p, b;
860
- document.removeEventListener("mousedown", t), (b = (p = m.current) == null ? void 0 : p.focus) == null || b.call(p);
1024
+ return document.addEventListener("mousedown", o), () => {
1025
+ var p, N;
1026
+ document.removeEventListener("mousedown", o), (N = (p = h.current) == null ? void 0 : p.focus) == null || N.call(p);
861
1027
  };
862
- }, [l, a]), !l || u.length === 0) return null;
863
- const h = (t) => {
864
- var p, b;
865
- const f = Array.from(((p = s.current) == null ? void 0 : p.querySelectorAll('[role="menuitem"]')) ?? []), o = f.indexOf(document.activeElement);
866
- if (t.key === "Escape" || t.key === "Tab")
867
- t.preventDefault(), a();
868
- else if (t.key === "ArrowDown" || t.key === "ArrowUp") {
869
- t.preventDefault();
870
- const N = t.key === "ArrowDown" ? 1 : -1;
871
- (b = f[(o + N + f.length) % f.length]) == null || b.focus();
1028
+ }, [l, a]), !l || d.length === 0) return null;
1029
+ const r = (o) => {
1030
+ var p, N;
1031
+ const f = Array.from(((p = s.current) == null ? void 0 : p.querySelectorAll('[role="menuitem"]')) ?? []), u = f.indexOf(document.activeElement);
1032
+ if (o.key === "Escape" || o.key === "Tab")
1033
+ o.preventDefault(), a();
1034
+ else if (o.key === "ArrowDown" || o.key === "ArrowUp") {
1035
+ o.preventDefault();
1036
+ const y = o.key === "ArrowDown" ? 1 : -1;
1037
+ (N = f[(u + y + f.length) % f.length]) == null || N.focus();
872
1038
  }
873
1039
  };
874
- return F(
1040
+ return R(
875
1041
  /* @__PURE__ */ e(
876
1042
  "div",
877
1043
  {
878
1044
  ref: s,
879
1045
  className: "cms-menu",
880
1046
  role: "menu",
881
- "aria-label": c,
882
- style: { left: (r ?? l).x, top: (r ?? l).y },
883
- onKeyDown: h,
884
- onContextMenu: (t) => t.preventDefault(),
885
- children: u.map((t) => {
886
- const f = t.offer.refusal !== void 0;
887
- return /* @__PURE__ */ i(
1047
+ "aria-label": t,
1048
+ style: { left: (i ?? l).x, top: (i ?? l).y },
1049
+ onKeyDown: r,
1050
+ onContextMenu: (o) => o.preventDefault(),
1051
+ children: d.map((o) => {
1052
+ const f = o.offer.refusal !== void 0;
1053
+ return /* @__PURE__ */ c(
888
1054
  "div",
889
1055
  {
890
1056
  role: "menuitem",
891
1057
  tabIndex: -1,
892
1058
  "aria-disabled": f || void 0,
893
- title: f ? t.offer.refusal : void 0,
894
- className: v("cms-menu__item", t.danger && "is-danger", t.offer.locked && "is-locked", f && "is-refused"),
1059
+ title: f ? o.offer.refusal : void 0,
1060
+ className: g("cms-menu__item", o.danger && "is-danger", o.offer.locked && "is-locked", f && "is-refused"),
895
1061
  onClick: () => {
896
- f || (a(), t.onSelect());
1062
+ f || (a(), o.onSelect());
897
1063
  },
898
- onKeyDown: (o) => {
899
- (o.key === "Enter" || o.key === " ") && !f && (o.preventDefault(), a(), t.onSelect());
1064
+ onKeyDown: (u) => {
1065
+ (u.key === "Enter" || u.key === " ") && !f && (u.preventDefault(), a(), o.onSelect());
900
1066
  },
901
1067
  children: [
902
- t.offer.locked ? /* @__PURE__ */ e(k, { name: "lock" }) : null,
903
- /* @__PURE__ */ e("span", { className: "cms-menu__label", children: t.label }),
904
- f ? /* @__PURE__ */ e("span", { className: "cms-menu__refusal", children: t.offer.refusal }) : null
1068
+ o.offer.locked ? /* @__PURE__ */ e(M, { name: "lock" }) : null,
1069
+ /* @__PURE__ */ e("span", { className: "cms-menu__label", children: o.label }),
1070
+ f ? /* @__PURE__ */ e("span", { className: "cms-menu__refusal", children: o.offer.refusal }) : null
905
1071
  ]
906
1072
  },
907
- t.id
1073
+ o.id
908
1074
  );
909
1075
  })
910
1076
  }
@@ -912,11 +1078,11 @@ function Le({ at: l, items: n, onClose: a, label: c = "Actions" }) {
912
1078
  document.body
913
1079
  );
914
1080
  }
915
- function O(l) {
1081
+ function be(l) {
916
1082
  return l === "allowed" || l === "elevate" || l === "denied";
917
1083
  }
918
- function De(l, n) {
919
- if (!O(l))
1084
+ function Ge(l, n) {
1085
+ if (!be(l))
920
1086
  return n.showRefused ? { offered: !0, locked: !1, refusal: "not available: the server gave an answer this app does not know", unknown: !0 } : { offered: !1, locked: !1, unknown: !0 };
921
1087
  switch (l) {
922
1088
  case "allowed":
@@ -927,111 +1093,114 @@ function De(l, n) {
927
1093
  return n.showRefused ? { offered: !0, locked: !1, refusal: n.refusal ?? "not allowed" } : { offered: !1, locked: !1 };
928
1094
  }
929
1095
  }
930
- function ee(l, n) {
1096
+ function ve(l, n) {
931
1097
  if (!l) return;
932
1098
  if (typeof l.get == "function") return l.get(n) ?? void 0;
933
- const a = l, c = Object.keys(a).find((s) => s.toLowerCase() === n.toLowerCase());
934
- return c === void 0 ? void 0 : a[c];
1099
+ const a = l, t = Object.keys(a).find((s) => s.toLowerCase() === n.toLowerCase());
1100
+ return t === void 0 ? void 0 : a[t];
935
1101
  }
936
- function le(l) {
1102
+ function Ne(l) {
937
1103
  if (l && typeof l == "object") {
938
1104
  const n = l;
939
1105
  if (typeof n.detail == "string" && n.detail !== "") return n.detail;
940
1106
  if (typeof n.title == "string" && n.title !== "") return n.title;
941
1107
  }
942
1108
  }
943
- function $e(l, n, a, c) {
1109
+ function Oe(l, n, a, t) {
944
1110
  if (l !== 403) return { kind: "none" };
945
- const s = le(a);
946
- return ee(n, "X-Elevation-Required") !== void 0 ? c.elevates ? { kind: "elevation-required", message: s ?? "This needs an elevated session." } : { kind: "refused", message: "This can only be done in the admin, in an elevated session." } : { kind: "refused", message: s ?? "The server refused this." };
1111
+ const s = Ne(a);
1112
+ return ve(n, "X-Elevation-Required") !== void 0 ? t.elevates ? { kind: "elevation-required", message: s ?? "This needs an elevated session." } : { kind: "refused", message: "This can only be done in the admin, in an elevated session." } : { kind: "refused", message: s ?? "The server refused this." };
947
1113
  }
948
- const I = "coolms-kit:reread";
949
- function Se() {
950
- window.dispatchEvent(new Event(I));
1114
+ const H = "coolms-kit:reread";
1115
+ function Qe() {
1116
+ window.dispatchEvent(new Event(H));
951
1117
  }
952
- function Te(l) {
953
- const [n, a] = C(void 0), [c, s] = C(void 0), [m, r] = C(!0), d = x(l);
954
- d.current = l;
955
- const u = x(0), h = V(() => {
956
- const t = ++u.current;
957
- r(!0), d.current().then(
1118
+ function Je(l) {
1119
+ const [n, a] = E(void 0), [t, s] = E(void 0), [h, i] = E(!0), m = A(l);
1120
+ m.current = l;
1121
+ const d = A(0), r = J(() => {
1122
+ const o = ++d.current;
1123
+ i(!0), m.current().then(
958
1124
  (f) => {
959
- t === u.current && (a(f), s(void 0), r(!1));
1125
+ o === d.current && (a(f), s(void 0), i(!1));
960
1126
  },
961
1127
  (f) => {
962
- t === u.current && (s(f), r(!1));
1128
+ o === d.current && (s(f), i(!1));
963
1129
  }
964
1130
  );
965
1131
  }, []);
966
- return D(() => {
967
- h();
968
- const t = () => h();
969
- return window.addEventListener("focus", t), window.addEventListener(I, t), () => {
970
- window.removeEventListener("focus", t), window.removeEventListener(I, t);
1132
+ return K(() => {
1133
+ r();
1134
+ const o = () => r();
1135
+ return window.addEventListener("focus", o), window.addEventListener(H, o), () => {
1136
+ window.removeEventListener("focus", o), window.removeEventListener(H, o);
971
1137
  };
972
- }, [h]), { value: n, error: c, loading: m, reread: h };
1138
+ }, [r]), { value: n, error: t, loading: h, reread: r };
973
1139
  }
974
- function Ie(l) {
1140
+ function el(l) {
975
1141
  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 };
976
1142
  }
977
- const ne = "/errors/client-update-required";
978
- function ae(l, n) {
979
- const a = l.split(".").map((s) => Number.parseInt(s, 10) || 0), c = n.split(".").map((s) => Number.parseInt(s, 10) || 0);
980
- for (let s = 0; s < Math.max(a.length, c.length); s++) {
981
- const m = a[s] ?? 0, r = c[s] ?? 0;
982
- if (m !== r) return m < r;
1143
+ const ge = "/errors/client-update-required";
1144
+ function ye(l, n) {
1145
+ const a = l.split(".").map((s) => Number.parseInt(s, 10) || 0), t = n.split(".").map((s) => Number.parseInt(s, 10) || 0);
1146
+ for (let s = 0; s < Math.max(a.length, t.length); s++) {
1147
+ const h = a[s] ?? 0, i = t[s] ?? 0;
1148
+ if (h !== i) return h < i;
983
1149
  }
984
1150
  return !1;
985
1151
  }
986
- function Ze(l) {
987
- return l.problemType !== void 0 && l.problemType.endsWith(ne) ? !0 : l.minimumVersion !== void 0 && ae(l.version, l.minimumVersion);
1152
+ function ll(l) {
1153
+ return l.problemType !== void 0 && l.problemType.endsWith(ge) ? !0 : l.minimumVersion !== void 0 && ye(l.version, l.minimumVersion);
988
1154
  }
989
1155
  export {
990
- _e as AppShell,
991
- S as Avatar,
992
- Y as Badge,
993
- $ as Button,
994
- Z as CALL_LABELS,
995
- ne as CLIENT_UPDATE_REQUIRED,
996
- Ce as CallBar,
997
- Me as CallPanel,
998
- ye as ChatBubble,
999
- we as Composer,
1000
- de as ConfirmDialog,
1001
- Le as ContextMenu,
1002
- W as EmptyState,
1003
- q as ErrorBanner,
1004
- ge as FilterChips,
1005
- pe as ICON_NAMES,
1006
- y as Icon,
1007
- ke as IncomingCall,
1008
- Ee as List,
1009
- U as Loading,
1010
- Q as MAIL_ROW_LABELS,
1011
- j as MODAL_CLOSE_MS,
1012
- Ne as MailRow,
1013
- z as Modal,
1014
- he as PageHeader,
1015
- J as SIGN_IN_LABELS,
1016
- be as SearchField,
1017
- ie as Select,
1018
- Ae as SignInForm,
1019
- xe as SignInLayout,
1020
- ve as SplitPanes,
1021
- fe as TabStrip,
1022
- re as TextField,
1023
- me as Toast,
1024
- ue as ToastRegion,
1025
- oe as Toggle,
1026
- G as initialsOf,
1027
- O as isCapability,
1028
- Ze as needsClientUpdate,
1029
- De as offerFor,
1030
- Ie as readConflict,
1031
- $e as readRefusal,
1032
- le as refusalText,
1033
- Se as rereadAll,
1034
- X as tintOf,
1035
- Te as useReread,
1036
- ae as versionBelow
1156
+ Ke as AppShell,
1157
+ V as Avatar,
1158
+ fe as Badge,
1159
+ F as Button,
1160
+ W as CALL_LABELS,
1161
+ ge as CLIENT_UPDATE_REQUIRED,
1162
+ je as CallBar,
1163
+ Ue as CallPanel,
1164
+ He as ChatBubble,
1165
+ Re as Composer,
1166
+ Ee as ConfirmDialog,
1167
+ Ye as ContextMenu,
1168
+ ae as EmptyState,
1169
+ se as ErrorBanner,
1170
+ Te as FileViewer,
1171
+ Fe as FilterChips,
1172
+ $e as ICON_NAMES,
1173
+ x as Icon,
1174
+ We as IncomingCall,
1175
+ Xe as List,
1176
+ ne as Loading,
1177
+ pe as MAIL_ROW_LABELS,
1178
+ ee as MODAL_CLOSE_MS,
1179
+ Ve as MailRow,
1180
+ le as Modal,
1181
+ Ie as PageHeader,
1182
+ _e as SIGN_IN_LABELS,
1183
+ j as STATE_DELAY_MS,
1184
+ Pe as SearchField,
1185
+ Ce as Select,
1186
+ ze as SignInForm,
1187
+ qe as SignInLayout,
1188
+ Ze as SplitPanes,
1189
+ De as State,
1190
+ Be as TabStrip,
1191
+ xe as TextField,
1192
+ Le as Toast,
1193
+ Se as ToastRegion,
1194
+ Ae as Toggle,
1195
+ ue as initialsOf,
1196
+ be as isCapability,
1197
+ ll as needsClientUpdate,
1198
+ Ge as offerFor,
1199
+ el as readConflict,
1200
+ Oe as readRefusal,
1201
+ Ne as refusalText,
1202
+ Qe as rereadAll,
1203
+ he as tintOf,
1204
+ Je as useReread,
1205
+ ye as versionBelow
1037
1206
  };