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

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