@coolms/ui-react 0.1.0-alpha.7 → 0.1.0-alpha.9

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 c of Object.keys(n ?? {})) {
7
+ const t = n == null ? void 0 : n[c];
8
+ t !== void 0 && (a[c] = 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: c = !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: i,
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", c && "is-locked", r),
55
+ disabled: m,
56
56
  "aria-busy": n || void 0,
57
- title: t ? s ?? o : o,
57
+ title: c ? t ?? i : i,
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" }) : c ? /* @__PURE__ */ e($, { name: "lock" }) : h,
60
+ /* @__PURE__ */ e("span", { className: "cms-button__label", children: n && a !== void 0 ? a : u }),
61
+ c && 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: c, pinned: t, children: h }) {
70
+ return /* @__PURE__ */ s("div", { className: k("cms-field", c != 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
+ c != null ? /* @__PURE__ */ e("p", { className: "cms-field__error", id: `${l}-error`, role: "alert", children: c }) : 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: c, readOnly: t, pinned: h, value: d, onChange: r, placeholder: u, type: o = "text", name: i }) {
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: i,
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: c,
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: c, readOnly: t, value: h, options: d, onChange: r, emptyText: u = "Nothing to choose from yet.", name: o }) {
106
+ const i = V(), p = d.length === 0;
107
+ return /* @__PURE__ */ e(ue, { id: i, label: l, help: p ? u : n, error: a, children: /* @__PURE__ */ e(
108
108
  "select",
109
109
  {
110
- id: o,
111
- name: r,
110
+ id: i,
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: c || 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(i, { 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: c, 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: c,
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: c = !1, onDirtyClose: t, children: h, footer: d, closeLabel: r = "Close", initialFocus: u, className: o }) {
151
+ const [i, p] = D(l), [m, N] = D(!1), v = 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), N(!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 (!i) return;
158
+ N(!0);
159
+ const y = window.setTimeout(() => {
160
+ var C, x;
161
+ p(!1), N(!1), (x = (C = g.current) == null ? void 0 : C.focus) == null || x.call(C);
162
+ }, ye);
163
+ return () => window.clearTimeout(y);
164
+ }, [l, i]), z(() => {
165
+ var y, C;
166
+ if (l && i) {
167
+ const x = 'input, select, textarea, button, [href], [tabindex]:not([tabindex="-1"])';
168
+ (C = (u == null ? void 0 : u.current) ?? ((y = v.current) == null ? void 0 : y.querySelector(`.cms-modal__body :is(${x}), .cms-modal__foot :is(${x})`)) ?? v.current) == null || C.focus();
169
169
  }
170
- }, [l, d]), !d) return null;
171
- const y = () => {
172
- t ? s == null || s() : a();
170
+ }, [l, i, u]), !i) return null;
171
+ const H = () => {
172
+ c ? 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: v,
181
+ className: k("cms-modal", o, m && "is-closing", c && "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 = v.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: c = "default", confirmLabel: t, cancelLabel: h, closeLabel: d, onConfirm: r, onCancel: u }) {
211
+ const o = c === "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: c === "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: c !== "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: c, 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
+ c ? /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": t, onClick: c, 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: c, 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
+ c !== void 0 && l !== "denied" ? /* @__PURE__ */ e(Z, { className: "cms-state__action", onClick: c.onAction, children: c.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,7 +391,7 @@ 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" })
@@ -400,7 +400,7 @@ const X = {
400
400
  more: /* @__PURE__ */ e("path", { d: "M5 12h.5M12 12h.5M19 12h.5" }),
401
401
  important: /* @__PURE__ */ e("path", { d: "M4 6h11l5 6-5 6H4l4-6-4-6Z" })
402
402
  };
403
- function x({ name: l, size: n = 20, label: a }) {
403
+ function L({ name: l, size: n = 20, label: a }) {
404
404
  return /* @__PURE__ */ e(
405
405
  "svg",
406
406
  {
@@ -415,140 +415,298 @@ function x({ name: l, size: n = 20, label: a }) {
415
415
  strokeLinejoin: "round",
416
416
  focusable: !1,
417
417
  ...a ? { role: "img", "aria-label": a } : { "aria-hidden": !0 },
418
- children: X[l]
418
+ children: pe[l]
419
419
  }
420
420
  );
421
421
  }
422
- const $e = Object.keys(X), re = 'input, select, textarea, button:not([disabled]), iframe, [href], [tabindex]:not([tabindex="-1"])', ie = 60;
423
- 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) {
424
424
  return l instanceof Element && l.closest('input, select, textarea, [contenteditable="true"], [data-viewer-keys]') !== null;
425
425
  }
426
- function de(l) {
426
+ function Se(l) {
427
427
  return l instanceof Element && l.closest("[data-viewer-gestures]") !== null;
428
428
  }
429
- function me(l) {
429
+ function Le(l) {
430
430
  return l.getClientRects().length > 0;
431
431
  }
432
- function Te(l) {
433
- 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);
434
- K(() => {
435
- var L;
436
- const _ = document.activeElement, k = document.body.style.overflow;
437
- return document.body.style.overflow = "hidden", (L = b.current) == null || L.focus(), () => {
438
- var S;
439
- document.body.style.overflow = k, (S = _ == null ? void 0 : _.focus) == null || S.call(_);
432
+ function ll(l) {
433
+ const { name: n, badge: a, closeLabel: c, onClose: t, actions: h = [], moreLabel: d = "More", edit: r, editing: u, siblings: o, bar: i, thumbnails: p, strip: m, onZoom: N, children: v } = l, g = T(null), A = T(null), H = V(), [y, C] = D(!1), x = T(null);
434
+ z(() => {
435
+ var P;
436
+ const b = 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 = b == null ? void 0 : b.focus) == null || B.call(b);
440
440
  };
441
441
  }, []);
442
- const Y = () => {
443
- d != null && d.dirty ? d.onDirtyClose() : s();
444
- }, G = (_) => {
445
- const k = _.touches.length === 1 ? _.touches[0] : void 0;
446
- B.current = k === void 0 || d !== void 0 || de(_.target) ? null : { x: k.clientX, y: k.clientY };
447
- }, O = (_) => {
448
- var $, P;
449
- const k = B.current, L = _.changedTouches[0];
450
- if (B.current = null, k === null || L === void 0) return;
451
- const S = L.clientX - k.x;
452
- 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 = (b) => {
445
+ const S = b.touches.length === 1 ? b.touches[0] : void 0;
446
+ x.current = S === void 0 || u !== void 0 || Se(b.target) ? null : { x: S.clientX, y: S.clientY };
447
+ }, q = (b) => {
448
+ var E, W;
449
+ const S = x.current, P = b.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));
453
453
  };
454
- return R(
455
- /* @__PURE__ */ c(
454
+ return le(
455
+ /* @__PURE__ */ s(
456
456
  "div",
457
457
  {
458
- ref: y,
459
- className: g("cms-viewer", d !== void 0 && "is-editing"),
458
+ ref: g,
459
+ className: k("cms-viewer", u !== void 0 && "is-editing"),
460
460
  role: "dialog",
461
461
  "aria-modal": "true",
462
- "aria-labelledby": C,
462
+ "aria-labelledby": H,
463
463
  tabIndex: -1,
464
- onKeyDown: (_) => {
465
- var k, L, S;
466
- if (_.key === "Escape") {
467
- if (d !== void 0) return;
468
- _.stopPropagation(), w ? D(!1) : s();
469
- } else if (_.key === "Tab") {
470
- const $ = Array.from(((k = y.current) == null ? void 0 : k.querySelectorAll(re)) ?? []).filter(me);
471
- if ($.length === 0) return;
472
- const P = $[0], U = $[$.length - 1];
473
- _.shiftKey && document.activeElement === P ? (_.preventDefault(), U.focus()) : !_.shiftKey && document.activeElement === U && (_.preventDefault(), P.focus());
474
- } 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: (b) => {
465
+ var S, P, B;
466
+ if (b.key === "Escape") {
467
+ if (u !== void 0) return;
468
+ b.stopPropagation(), y ? C(!1) : t();
469
+ } else if (b.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
+ b.shiftKey && document.activeElement === W ? (b.preventDefault(), F.focus()) : !b.shiftKey && document.activeElement === F && (b.preventDefault(), W.focus());
474
+ } else u === void 0 && !De(b.target) && !b.ctrlKey && !b.metaKey && !b.altKey && (b.key === "ArrowLeft" ? (P = o == null ? void 0 : o.onPrevious) == null || P.call(o) : b.key === "ArrowRight" ? (B = o == null ? void 0 : o.onNext) == null || B.call(o) : b.key === "+" || b.key === "=" ? N == null || N("in") : b.key === "-" ? N == null || N("out") : b.key === "0" && (N == null || N("reset")));
475
475
  },
476
476
  children: [
477
- r !== void 0 ? /* @__PURE__ */ e("span", { className: "cms-visually-hidden", role: "status", children: `${n}, ${r.position}` }) : null,
478
- /* @__PURE__ */ c("header", { className: "cms-viewer__top", children: [
479
- /* @__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": c, onClick: K, children: /* @__PURE__ */ e($, { name: "close" }) }),
480
480
  /* @__PURE__ */ e("span", { className: "cms-viewer__badge", children: a }),
481
- /* @__PURE__ */ e("h2", { className: "cms-viewer__name", id: C, title: n, children: n }),
482
- 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,
483
483
  /* @__PURE__ */ e("span", { className: "cms-viewer__space" }),
484
- d !== void 0 ? /* @__PURE__ */ c(v, { children: [
485
- /* @__PURE__ */ e("span", { className: "cms-viewer__status", role: "status", children: d.status }),
486
- /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__button cms-viewer__button--edit", onClick: d.onDone, children: d.doneLabel })
487
- ] }) : /* @__PURE__ */ c(v, { children: [
488
- /* @__PURE__ */ e("span", { className: "cms-viewer__actions", children: h.map((_) => /* @__PURE__ */ c("button", { type: "button", className: "cms-viewer__button", onClick: _.onSelect, children: [
489
- _.icon,
490
- _.label
491
- ] }, _.label)) }),
492
- m !== void 0 ? /* @__PURE__ */ c("button", { type: "button", className: "cms-viewer__button cms-viewer__button--edit", "aria-label": m.label, onClick: m.onEdit, children: [
493
- m.icon,
494
- /* @__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((b) => /* @__PURE__ */ s("button", { type: "button", className: "cms-viewer__button", onClick: b.onSelect, children: [
489
+ b.icon,
490
+ b.label
491
+ ] }, b.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 })
495
495
  ] }) : null,
496
- h.length > 0 ? /* @__PURE__ */ c("span", { className: "cms-viewer__more", children: [
497
- /* @__PURE__ */ e("button", { type: "button", className: "cms-viewer__icon", "aria-label": i, "aria-expanded": w, onClick: () => D((_) => !_), children: /* @__PURE__ */ e(x, { name: "more" }) }),
498
- 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((b) => !b), children: /* @__PURE__ */ e(L, { name: "more" }) }),
498
+ y ? /* @__PURE__ */ e("span", { className: "cms-viewer__menu", children: h.map((b) => /* @__PURE__ */ s(
499
499
  "button",
500
500
  {
501
501
  type: "button",
502
502
  className: "cms-viewer__button",
503
503
  onClick: () => {
504
- D(!1), _.onSelect();
504
+ C(!1), b.onSelect();
505
505
  },
506
506
  children: [
507
- _.icon,
508
- _.label
507
+ b.icon,
508
+ b.label
509
509
  ]
510
510
  },
511
- _.label
511
+ b.label
512
512
  )) }) : null
513
513
  ] }) : null
514
514
  ] })
515
515
  ] }),
516
- /* @__PURE__ */ c("div", { className: "cms-viewer__body", children: [
517
- f != null && d === void 0 ? /* @__PURE__ */ e("nav", { className: "cms-viewer__thumbnails", children: f }) : null,
518
- /* @__PURE__ */ c("div", { className: "cms-viewer__content", onTouchStart: G, onTouchEnd: O, children: [
519
- N,
520
- 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,
521
- 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,
522
- 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
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: [
519
+ v,
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) }, (b, S) => /* @__PURE__ */ e("i", { className: S === Math.min(o.index, 6) ? "is-current" : void 0 }, S)) }) : null
523
523
  ] })
524
524
  ] }),
525
- d === void 0 && u != null ? /* @__PURE__ */ e("div", { className: "cms-viewer__strip", children: u }) : null,
526
- 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
+ i != null ? /* @__PURE__ */ e("footer", { className: "cms-viewer__bar", children: i }) : null
527
527
  ]
528
528
  }
529
529
  ),
530
530
  document.body
531
531
  );
532
532
  }
533
- function Ie({ title: l, scope: n, actions: a, backLink: t }) {
534
- return /* @__PURE__ */ c("header", { className: "cms-page-header", children: [
535
- 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: c, disabledReason: t, budget: h, formatSize: d, labels: r, onConfirm: u, onCancel: o } = l, [i, p] = D(((oe = a[0]) == null ? void 0 : oe.id) ?? ""), [m, N] = D(""), [v, g] = D({ status: "loading" }), [A, H] = D(0), [y, C] = D(/* @__PURE__ */ new Map()), [x, K] = D(0), [R, q] = D(!1), b = T(null), S = V();
543
+ z(() => {
544
+ var f;
545
+ n && (p(((f = a[0]) == null ? void 0 : f.id) ?? ""), N(""), C(/* @__PURE__ */ new Map()), q(!1));
546
+ }, [n]), z(() => {
547
+ if (!n || i === "") return;
548
+ let f = !0;
549
+ return g({ status: "loading" }), K(0), c(i, m).then(
550
+ (_) => f && g({ status: "ready", entries: _.entries, next: _.next ?? null, paging: !1 }),
551
+ (_) => f && g({ status: _ instanceof $e ? "denied" : "error" })
552
+ ), () => {
553
+ f = !1;
554
+ };
555
+ }, [n, i, m, c, A]);
556
+ const P = J(() => {
557
+ if (v.status !== "ready" || v.next === null || v.paging) return;
558
+ const f = v.next, _ = v.entries;
559
+ g({ ...v, paging: !0 }), c(i, m, f).then(
560
+ (M) => g({ status: "ready", entries: [..._, ...M.entries], next: M.next ?? null, paging: !1 }),
561
+ () => g({ status: "ready", entries: _, next: f, paging: !1 })
562
+ );
563
+ }, [v, c, i, m]), B = J((f) => {
564
+ var _;
565
+ return ((_ = h == null ? void 0 : h.cost) == null ? void 0 : _.call(h, f)) ?? f.size ?? 0;
566
+ }, [h]), E = Ne(() => [...y.values()], [y]), W = E.reduce((f, _) => f + (_.size ?? 0), 0), F = h === void 0 ? null : h.limitBytes - h.usedBytes - E.reduce((f, _) => f + B(_), 0), O = F !== null && F < 0, ae = (f) => {
567
+ if (f.kind !== "file") return null;
568
+ const _ = t == null ? void 0 : t(f);
569
+ return _ || (F !== null && !y.has(Q(i, f.id)) && B(f) > F ? r.overBudget : null);
570
+ }, se = (f) => {
571
+ const _ = Q(i, f.id);
572
+ !y.has(_) && ae(f) !== null || C((M) => {
573
+ const I = new Map(M);
574
+ return I.has(_) ? I.delete(_) : I.set(_, { ...f, space: i, path: m }), I;
575
+ });
576
+ }, te = (f) => N(Te(m, f.name)), ce = () => N(m.includes("/") ? m.slice(0, m.lastIndexOf("/")) : ""), _e = (f) => C((_) => {
577
+ const M = new Map(_);
578
+ return M.delete(f), M;
579
+ }), j = v.status === "ready" ? v.entries : [], be = (f) => {
580
+ const _ = 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" && (_ == null ? void 0 : _.kind) === "folder" ? (f.preventDefault(), te(_)) : f.key === " " && (_ == null ? void 0 : _.kind) === "file" ? (f.preventDefault(), se(_)) : f.key === "Backspace" && m !== "" && (f.preventDefault(), ce());
586
+ }, ie = m === "" ? [] : m.split("/"), ve = ((de = a.find((f) => f.id === i)) == 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: b,
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: i, onChange: (f) => {
611
+ p(f.target.value), N("");
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: () => N(""), children: ve }) }),
618
+ ie.map((f, _) => {
619
+ const M = ie.slice(0, _ + 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: () => N(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, _]) => /* @__PURE__ */ s("li", { children: [
628
+ /* @__PURE__ */ e("span", { className: "cms-file-picker__name", children: _.name }),
629
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-icon-button", "aria-label": r.remove(_.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 _ = f.currentTarget;
637
+ _.scrollTop + _.clientHeight >= _.scrollHeight - Pe && P();
638
+ }, children: [
639
+ v.status === "loading" ? /* @__PURE__ */ e(X, { kind: "loading", title: r.loading, placement: "block" }) : null,
640
+ v.status === "error" ? /* @__PURE__ */ e(X, { kind: "error", title: r.error, placement: "block", action: { label: r.retry, onAction: () => H((f) => f + 1) } }) : null,
641
+ v.status === "denied" ? /* @__PURE__ */ e(X, { kind: "denied", title: r.denied, placement: "block" }) : null,
642
+ v.status === "ready" && j.length === 0 ? /* @__PURE__ */ e(X, { kind: "empty", title: r.empty, placement: "block" }) : null,
643
+ /* @__PURE__ */ s(
644
+ "div",
645
+ {
646
+ ref: b,
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: v.status !== "ready" || j.length === 0,
654
+ onKeyDown: be,
655
+ children: [
656
+ j.map((f, _) => {
657
+ const M = f.kind === "file" && y.has(Q(i, f.id)), I = ae(f);
658
+ return /* @__PURE__ */ s(
659
+ "div",
660
+ {
661
+ id: re(_),
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", _ === x && "is-active", M && "is-ticked", I !== null && "is-disabled"),
666
+ onClick: () => {
667
+ K(_), 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
+ v.status === "ready" && v.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: c }) {
692
+ return /* @__PURE__ */ s("header", { className: "cms-page-header", children: [
693
+ c ? /* @__PURE__ */ s(
536
694
  "a",
537
695
  {
538
696
  className: "cms-page-header__back",
539
- href: t.href ?? "#",
540
- onClick: (s) => {
541
- t.onBack && (s.preventDefault(), t.onBack());
697
+ href: c.href ?? "#",
698
+ onClick: (t) => {
699
+ c.onBack && (t.preventDefault(), c.onBack());
542
700
  },
543
701
  children: [
544
- /* @__PURE__ */ e(M, { name: "back" }),
702
+ /* @__PURE__ */ e($, { name: "back" }),
545
703
  " ",
546
- t.label
704
+ c.label
547
705
  ]
548
706
  }
549
707
  ) : null,
550
- /* @__PURE__ */ c("div", { className: "cms-page-header__row", children: [
551
- /* @__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: [
552
710
  /* @__PURE__ */ e("h1", { className: "cms-page-header__title", children: l }),
553
711
  n != null ? /* @__PURE__ */ e("p", { className: "cms-page-header__scope", children: n }) : null
554
712
  ] }),
@@ -556,118 +714,118 @@ function Ie({ title: l, scope: n, actions: a, backLink: t }) {
556
714
  ] })
557
715
  ] });
558
716
  }
559
- function Be({ tabs: l, active: n, onSelect: a, label: t }) {
560
- const s = A([]), h = (i, m) => {
561
- var f;
562
- 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;
563
- if (r === null) return;
564
- i.preventDefault();
565
- const o = l[r];
566
- o && (a(o.id), (f = s.current[r]) == null || f.focus());
717
+ function sl({ tabs: l, active: n, onSelect: a, label: c }) {
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 i = l[o];
724
+ i && (a(i.id), (p = t.current[o]) == null || p.focus());
567
725
  };
568
- return /* @__PURE__ */ e("div", { className: "cms-tabs", role: "tablist", "aria-label": t, children: l.map((i, m) => {
569
- const d = i.id === n;
570
- return /* @__PURE__ */ c(
726
+ return /* @__PURE__ */ e("div", { className: "cms-tabs", role: "tablist", "aria-label": c, children: l.map((d, r) => {
727
+ const u = d.id === n;
728
+ return /* @__PURE__ */ s(
571
729
  "button",
572
730
  {
573
- ref: (r) => {
574
- s.current[m] = r;
731
+ ref: (o) => {
732
+ t.current[r] = o;
575
733
  },
576
734
  type: "button",
577
735
  role: "tab",
578
- className: g("cms-tab", d && "is-active"),
579
- "aria-selected": d,
580
- tabIndex: d ? 0 : -1,
581
- onClick: () => a(i.id),
582
- 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),
583
741
  children: [
584
- i.label,
585
- 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
586
744
  ]
587
745
  },
588
- i.id
746
+ d.id
589
747
  );
590
748
  }) });
591
749
  }
592
- function ue(l) {
593
- var t;
750
+ function Be(l) {
751
+ var c;
594
752
  const n = l.trim().split(/\s+/).filter(Boolean);
595
- 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]] : [(c = n[0]) == null ? void 0 : c[0]]).filter(Boolean).join("").toUpperCase();
596
754
  }
597
- function he(l) {
755
+ function Ie(l) {
598
756
  let n = 0;
599
757
  for (const a of l.trim().toLowerCase())
600
758
  n = n * 31 + (a.codePointAt(0) ?? 0) >>> 0;
601
759
  return n % 6 + 1;
602
760
  }
603
- function H({ name: l, pictureUrl: n, presence: a, size: t = 32 }) {
604
- return /* @__PURE__ */ c(
761
+ function G({ name: l, pictureUrl: n, presence: a, size: c = 32 }) {
762
+ return /* @__PURE__ */ s(
605
763
  "span",
606
764
  {
607
- className: `cms-avatar cms-avatar--tint-${he(l)}`,
608
- style: { width: t, height: t, fontSize: Math.round(t * 0.4) },
765
+ className: `cms-avatar cms-avatar--tint-${Ie(l)}`,
766
+ style: { width: c, height: c, fontSize: Math.round(c * 0.4) },
609
767
  role: "img",
610
768
  "aria-label": a ? `${l}, ${a}` : l,
611
769
  children: [
612
- n ? /* @__PURE__ */ e("img", { src: n, alt: "", className: "cms-avatar__picture" }) : /* @__PURE__ */ e("span", { "aria-hidden": "true", children: ue(l) }),
613
- 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
614
772
  ]
615
773
  }
616
774
  );
617
775
  }
618
- function fe({ count: l, label: n, max: a = 99 }) {
619
- 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: [
620
778
  /* @__PURE__ */ e("span", { "aria-hidden": "true", children: l > a ? `${a}+` : l }),
621
779
  /* @__PURE__ */ e("span", { className: "cms-visually-hidden", children: n })
622
780
  ] });
623
781
  }
624
- function Ke({ product: l, mark: n, rail: a, active: t, onNavigate: s, server: h, search: i, account: m, children: d, railLabel: r = "Sections" }) {
625
- return /* @__PURE__ */ c("div", { className: "cms-shell", children: [
626
- /* @__PURE__ */ c("nav", { className: "cms-shell__rail", "aria-label": r, children: [
782
+ function tl({ product: l, mark: n, rail: a, active: c, 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: [
627
785
  /* @__PURE__ */ e("span", { className: "cms-shell__mark", "aria-hidden": "true", children: n }),
628
- /* @__PURE__ */ e("ul", { className: "cms-shell__items", children: a.map((o) => {
629
- const f = o.id === t;
630
- return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ c(
786
+ /* @__PURE__ */ e("ul", { className: "cms-shell__items", children: a.map((i) => {
787
+ const p = i.id === c;
788
+ return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ s(
631
789
  "a",
632
790
  {
633
- href: o.href,
634
- className: g("cms-shell__item", f && "is-active"),
635
- "aria-current": f ? "page" : void 0,
636
- title: o.label,
637
- onClick: (u) => {
638
- s && (u.preventDefault(), s(o.id));
791
+ href: i.href,
792
+ className: k("cms-shell__item", p && "is-active"),
793
+ "aria-current": p ? "page" : void 0,
794
+ title: i.label,
795
+ onClick: (m) => {
796
+ t && (m.preventDefault(), t(i.id));
639
797
  },
640
798
  children: [
641
- /* @__PURE__ */ c("span", { className: "cms-shell__icon", children: [
642
- /* @__PURE__ */ e(x, { name: o.icon, size: 22 }),
643
- 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: i.icon, size: 22 }),
801
+ i.badge ? /* @__PURE__ */ e(Ke, { count: i.badge.count, label: i.badge.label }) : null
644
802
  ] }),
645
- /* @__PURE__ */ e("span", { className: "cms-shell__label", children: o.label })
803
+ /* @__PURE__ */ e("span", { className: "cms-shell__label", children: i.label })
646
804
  ]
647
805
  }
648
- ) }, o.id);
806
+ ) }, i.id);
649
807
  }) })
650
808
  ] }),
651
- /* @__PURE__ */ c("header", { className: "cms-shell__top", children: [
809
+ /* @__PURE__ */ s("header", { className: "cms-shell__top", children: [
652
810
  /* @__PURE__ */ e("span", { className: "cms-shell__product", children: l }),
653
811
  h != null ? /* @__PURE__ */ e("div", { className: "cms-shell__server", children: h }) : null,
654
- i != null ? /* @__PURE__ */ e("div", { className: "cms-shell__search", children: i }) : null,
655
- 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
656
814
  ] }),
657
- /* @__PURE__ */ e("main", { className: "cms-shell__main", children: d })
815
+ /* @__PURE__ */ e("main", { className: "cms-shell__main", children: u })
658
816
  ] });
659
817
  }
660
- function Pe({ label: l, placeholder: n, value: a, onChange: t, onSearch: s }) {
661
- return /* @__PURE__ */ c(
818
+ function cl({ label: l, placeholder: n, value: a, onChange: c, onSearch: t }) {
819
+ return /* @__PURE__ */ s(
662
820
  "form",
663
821
  {
664
822
  role: "search",
665
823
  className: "cms-search",
666
824
  onSubmit: (h) => {
667
- h.preventDefault(), s == null || s(a);
825
+ h.preventDefault(), t == null || t(a);
668
826
  },
669
827
  children: [
670
- /* @__PURE__ */ e(x, { name: "search", size: 18 }),
828
+ /* @__PURE__ */ e(L, { name: "search", size: 18 }),
671
829
  /* @__PURE__ */ e(
672
830
  "input",
673
831
  {
@@ -676,77 +834,77 @@ function Pe({ label: l, placeholder: n, value: a, onChange: t, onSearch: s }) {
676
834
  "aria-label": l,
677
835
  placeholder: n,
678
836
  value: a,
679
- onChange: (h) => t(h.target.value)
837
+ onChange: (h) => c(h.target.value)
680
838
  }
681
839
  )
682
840
  ]
683
841
  }
684
842
  );
685
843
  }
686
- function Fe({ options: l, value: n, onChange: a, label: t }) {
687
- const s = A([]), h = (i, m) => {
688
- var f;
689
- 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;
690
- if (r === null) return;
691
- i.preventDefault();
692
- const o = l[r];
693
- o && (a(o.id), (f = s.current[r]) == null || f.focus());
844
+ function il({ options: l, value: n, onChange: a, label: c }) {
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 i = l[o];
851
+ i && (a(i.id), (p = t.current[o]) == null || p.focus());
694
852
  };
695
- return /* @__PURE__ */ e("div", { className: "cms-chips", role: "radiogroup", "aria-label": t, children: l.map((i, m) => {
696
- const d = i.id === n;
697
- return /* @__PURE__ */ c(
853
+ return /* @__PURE__ */ e("div", { className: "cms-chips", role: "radiogroup", "aria-label": c, children: l.map((d, r) => {
854
+ const u = d.id === n;
855
+ return /* @__PURE__ */ s(
698
856
  "button",
699
857
  {
700
- ref: (r) => {
701
- s.current[m] = r;
858
+ ref: (o) => {
859
+ t.current[r] = o;
702
860
  },
703
861
  type: "button",
704
862
  role: "radio",
705
- "aria-checked": d,
706
- tabIndex: d ? 0 : -1,
707
- className: g("cms-chip", d && "is-on"),
708
- onClick: () => a(i.id),
709
- 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),
710
868
  children: [
711
- d ? /* @__PURE__ */ e(x, { name: "check", size: 16 }) : null,
712
- i.label
869
+ u ? /* @__PURE__ */ e(L, { name: "check", size: 16 }) : null,
870
+ d.label
713
871
  ]
714
872
  },
715
- i.id
873
+ d.id
716
874
  );
717
875
  }) });
718
876
  }
719
- function Ze({ panes: l, active: n, back: a }) {
720
- const t = Math.min(Math.max(n ?? l.length - 1, 0), l.length - 1);
721
- 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: [
722
- h === t && a ? /* @__PURE__ */ c("a", { className: "cms-panes__back", href: a.href, children: [
723
- /* @__PURE__ */ e(x, { name: "chevron-left", size: 18 }),
877
+ function rl({ panes: l, active: n, back: a }) {
878
+ const c = 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": c, children: l.map((t, h) => /* @__PURE__ */ s("section", { className: "cms-panes__pane", "aria-label": t.label, "data-offset": c - h, children: [
880
+ h === c && a ? /* @__PURE__ */ s("a", { className: "cms-panes__back", href: a.href, children: [
881
+ /* @__PURE__ */ e(L, { name: "chevron-left", size: 18 }),
724
882
  a.label
725
883
  ] }) : null,
726
- s.content
727
- ] }, s.label)) });
884
+ t.content
885
+ ] }, t.label)) });
728
886
  }
729
- const pe = { attachment: "Has an attachment", unread: "Unread" };
730
- function He({ from: l, subject: n, preview: a, time: t, unread: s, hasAttachment: h, selected: i, onOpen: m, labels: d }) {
731
- const r = Z(pe, d);
732
- return /* @__PURE__ */ c(
887
+ const Fe = { attachment: "Has an attachment", unread: "Unread" };
888
+ function ol({ from: l, subject: n, preview: a, time: c, unread: t, hasAttachment: h, selected: d, onOpen: r, labels: u }) {
889
+ const o = Y(Fe, u);
890
+ return /* @__PURE__ */ s(
733
891
  "button",
734
892
  {
735
893
  type: "button",
736
- className: g("cms-mail-row", s && "is-unread", i && "is-selected"),
737
- "aria-current": i ? "true" : void 0,
738
- onClick: m,
894
+ className: k("cms-mail-row", t && "is-unread", d && "is-selected"),
895
+ "aria-current": d ? "true" : void 0,
896
+ onClick: r,
739
897
  children: [
740
- /* @__PURE__ */ e(H, { name: l, size: 40 }),
741
- /* @__PURE__ */ c("span", { className: "cms-mail-row__body", children: [
742
- /* @__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: [
743
901
  /* @__PURE__ */ e("span", { className: "cms-mail-row__from", children: l }),
744
- h ? /* @__PURE__ */ e(x, { name: "paperclip", size: 16, label: r.attachment }) : null,
745
- /* @__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: c })
746
904
  ] }),
747
- /* @__PURE__ */ c("span", { className: "cms-mail-row__line", children: [
905
+ /* @__PURE__ */ s("span", { className: "cms-mail-row__line", children: [
748
906
  /* @__PURE__ */ e("span", { className: "cms-mail-row__subject", children: n }),
749
- 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
750
908
  ] }),
751
909
  /* @__PURE__ */ e("span", { className: "cms-mail-row__preview", children: a })
752
910
  ] })
@@ -754,48 +912,49 @@ function He({ from: l, subject: n, preview: a, time: t, unread: s, hasAttachment
754
912
  }
755
913
  );
756
914
  }
757
- function Ve({ direction: l, children: n, time: a, read: t, readLabel: s = "Read" }) {
758
- return /* @__PURE__ */ c("div", { className: g("cms-bubble", `cms-bubble--${l}`), children: [
915
+ function dl({ direction: l, children: n, time: a, read: c, readLabel: t = "Read" }) {
916
+ return /* @__PURE__ */ s("div", { className: k("cms-bubble", `cms-bubble--${l}`), children: [
759
917
  /* @__PURE__ */ e("div", { className: "cms-bubble__text", children: n }),
760
- /* @__PURE__ */ c("div", { className: "cms-bubble__meta", children: [
918
+ /* @__PURE__ */ s("div", { className: "cms-bubble__meta", children: [
761
919
  a,
762
- l === "out" && t ? /* @__PURE__ */ c(v, { children: [
920
+ l === "out" && c ? /* @__PURE__ */ s(w, { children: [
763
921
  " · ",
764
- s
922
+ t
765
923
  ] }) : null
766
924
  ] })
767
925
  ] });
768
926
  }
769
- 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" }) {
770
- const r = I(), o = n.trim() === "", f = (p) => {
771
- p.preventDefault(), o || t();
772
- }, 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;
773
- return /* @__PURE__ */ c("form", { className: g("cms-composer", `cms-composer--${i}`), onSubmit: f, children: [
774
- /* @__PURE__ */ e("label", { htmlFor: r, className: i === "reply" ? "cms-composer__title" : "cms-visually-hidden", children: l }),
775
- i === "chat" ? u : null,
927
+ function ml({ label: l, value: n, onChange: a, onSend: c, onAttach: t, placeholder: h, variant: d = "chat", sendLabel: r = "Send", attachLabel: u = "Attach a file", leading: o, canSend: i }) {
928
+ const p = V(), m = i ?? n.trim() !== "", N = (g) => {
929
+ g.preventDefault(), m && c();
930
+ }, v = 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: N, children: [
932
+ /* @__PURE__ */ e("label", { htmlFor: p, className: d === "reply" ? "cms-composer__title" : "cms-visually-hidden", children: l }),
933
+ d === "chat" ? v : null,
776
934
  /* @__PURE__ */ e(
777
935
  "textarea",
778
936
  {
779
- id: r,
937
+ id: p,
780
938
  className: "cms-composer__input",
781
- rows: i === "reply" ? 3 : 1,
939
+ rows: d === "reply" ? 3 : 1,
782
940
  placeholder: h,
783
941
  value: n,
784
- onChange: (p) => a(p.target.value),
785
- onKeyDown: (p) => {
786
- p.nativeEvent.isComposing || p.keyCode === 229 || i === "chat" && p.key === "Enter" && !p.shiftKey && (p.preventDefault(), o || t());
942
+ onChange: (g) => a(g.target.value),
943
+ onKeyDown: (g) => {
944
+ g.nativeEvent.isComposing || g.keyCode === 229 || d === "chat" && g.key === "Enter" && !g.shiftKey && (g.preventDefault(), m && c());
787
945
  }
788
946
  }
789
947
  ),
790
- i === "reply" ? u : null,
791
- 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: [
792
- m,
948
+ d === "reply" && o !== void 0 ? /* @__PURE__ */ e("div", { className: "cms-composer__leading", children: o }) : null,
949
+ d === "reply" ? v : null,
950
+ d === "chat" ? /* @__PURE__ */ e("button", { type: "submit", className: "cms-composer__send-round", "aria-label": r, disabled: !m, children: /* @__PURE__ */ e(L, { name: "send" }) }) : /* @__PURE__ */ s("button", { type: "submit", className: "cms-button cms-button--chrome cms-composer__send", disabled: !m, children: [
951
+ r,
793
952
  " ",
794
- /* @__PURE__ */ e(x, { name: "send", size: 18 })
953
+ /* @__PURE__ */ e(L, { name: "send", size: 18 })
795
954
  ] })
796
955
  ] });
797
956
  }
798
- const W = {
957
+ const ne = {
799
958
  incomingAudio: "Incoming audio call",
800
959
  incomingVideo: "Incoming video call",
801
960
  incomingFrom: (l, n) => `${l} from ${n}`,
@@ -816,91 +975,91 @@ const W = {
816
975
  onCallWith: (l) => `On a call with ${l}`,
817
976
  returnToCall: "Return to call"
818
977
  };
819
- function We({ name: l, media: n, onAccept: a, onDecline: t, labels: s }) {
820
- const h = Z(W, s), i = n === "video" ? h.incomingVideo : h.incomingAudio;
821
- return /* @__PURE__ */ c("div", { className: "cms-call-incoming", role: "alertdialog", "aria-label": h.incomingFrom(i, l), children: [
822
- /* @__PURE__ */ e("span", { className: "cms-call-incoming__ring", "aria-hidden": "true", children: /* @__PURE__ */ e(H, { name: l, size: 112 }) }),
978
+ function ul({ name: l, media: n, onAccept: a, onDecline: c, labels: t }) {
979
+ const h = Y(ne, t), d = n === "video" ? h.incomingVideo : h.incomingAudio;
980
+ return /* @__PURE__ */ s("div", { className: "cms-call-incoming", role: "alertdialog", "aria-label": h.incomingFrom(d, l), children: [
981
+ /* @__PURE__ */ e("span", { className: "cms-call-incoming__ring", "aria-hidden": "true", children: /* @__PURE__ */ e(G, { name: l, size: 112 }) }),
823
982
  /* @__PURE__ */ e("p", { className: "cms-call-incoming__name", children: l }),
824
- /* @__PURE__ */ e("p", { className: "cms-call-incoming__what", children: i }),
825
- /* @__PURE__ */ c("div", { className: "cms-call-incoming__actions", children: [
826
- /* @__PURE__ */ e(T, { icon: "phone-off", label: h.decline, tone: "hang-up", onClick: t }),
827
- /* @__PURE__ */ e(T, { icon: "phone", label: h.accept, tone: "accept", onClick: a })
983
+ /* @__PURE__ */ e("p", { className: "cms-call-incoming__what", children: d }),
984
+ /* @__PURE__ */ s("div", { className: "cms-call-incoming__actions", children: [
985
+ /* @__PURE__ */ e(U, { icon: "phone-off", label: h.decline, tone: "hang-up", onClick: c }),
986
+ /* @__PURE__ */ e(U, { icon: "phone", label: h.accept, tone: "accept", onClick: a })
828
987
  ] })
829
988
  ] });
830
989
  }
831
- function T({ icon: l, label: n, onClick: a, tone: t = "plain", pressed: s }) {
832
- return /* @__PURE__ */ c(
990
+ function U({ icon: l, label: n, onClick: a, tone: c = "plain", pressed: t }) {
991
+ return /* @__PURE__ */ s(
833
992
  "button",
834
993
  {
835
994
  type: "button",
836
- className: g("cms-call-button", `cms-call-button--${t}`, s && "is-pressed"),
837
- "aria-pressed": s,
995
+ className: k("cms-call-button", `cms-call-button--${c}`, t && "is-pressed"),
996
+ "aria-pressed": t,
838
997
  onClick: a,
839
998
  children: [
840
- /* @__PURE__ */ e("span", { className: "cms-call-button__disc", children: /* @__PURE__ */ e(x, { name: l, size: 24 }) }),
999
+ /* @__PURE__ */ e("span", { className: "cms-call-button__disc", children: /* @__PURE__ */ e(L, { name: l, size: 24 }) }),
841
1000
  /* @__PURE__ */ e("span", { className: "cms-call-button__label", children: n })
842
1001
  ]
843
1002
  }
844
1003
  );
845
1004
  }
846
- 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 }) {
847
- const u = Z(W, f);
848
- return /* @__PURE__ */ c("section", { className: "cms-call-panel", "aria-label": u.callWith(l), children: [
849
- /* @__PURE__ */ c("div", { className: "cms-call-panel__head", children: [
850
- /* @__PURE__ */ e(H, { name: l, size: 64 }),
851
- /* @__PURE__ */ c("div", { className: "cms-call-panel__who", children: [
1005
+ function hl({ name: l, duration: n, connection: a, you: c, muted: t, speaker: h, onToggleMute: d, onToggleSpeaker: r, onAddPerson: u, onChat: o, onHangUp: i, labels: p }) {
1006
+ const m = Y(ne, p);
1007
+ return /* @__PURE__ */ s("section", { className: "cms-call-panel", "aria-label": m.callWith(l), children: [
1008
+ /* @__PURE__ */ s("div", { className: "cms-call-panel__head", children: [
1009
+ /* @__PURE__ */ e(G, { name: l, size: 64 }),
1010
+ /* @__PURE__ */ s("div", { className: "cms-call-panel__who", children: [
852
1011
  /* @__PURE__ */ e("p", { className: "cms-call-panel__name", children: l }),
853
- /* @__PURE__ */ e("p", { className: "cms-call-panel__time", "aria-label": u.callTime(n), children: n })
1012
+ /* @__PURE__ */ e("p", { className: "cms-call-panel__time", "aria-label": m.callTime(n), children: n })
854
1013
  ] }),
855
- /* @__PURE__ */ e("span", { className: g("cms-pill", a === "good" ? "cms-pill--success" : "cms-pill--warning"), children: a === "good" ? u.goodConnection : u.poorConnection })
1014
+ /* @__PURE__ */ e("span", { className: k("cms-pill", a === "good" ? "cms-pill--success" : "cms-pill--warning"), children: a === "good" ? m.goodConnection : m.poorConnection })
856
1015
  ] }),
857
- /* @__PURE__ */ c("div", { className: "cms-call-panel__you", children: [
858
- /* @__PURE__ */ e(H, { name: t.name, size: 36 }),
859
- /* @__PURE__ */ e("span", { children: u.you }),
860
- t.speaking ? /* @__PURE__ */ e("span", { className: "cms-call-panel__level", role: "img", "aria-label": u.speaking }) : null
1016
+ /* @__PURE__ */ s("div", { className: "cms-call-panel__you", children: [
1017
+ /* @__PURE__ */ e(G, { name: c.name, size: 36 }),
1018
+ /* @__PURE__ */ e("span", { children: m.you }),
1019
+ c.speaking ? /* @__PURE__ */ e("span", { className: "cms-call-panel__level", role: "img", "aria-label": m.speaking }) : null
861
1020
  ] }),
862
- /* @__PURE__ */ c("div", { className: "cms-call-panel__controls", children: [
863
- /* @__PURE__ */ e(T, { icon: "mic", label: s ? u.unmute : u.mute, pressed: s, onClick: i }),
864
- /* @__PURE__ */ e(T, { icon: "speaker", label: u.speaker, pressed: h, onClick: m }),
865
- d ? /* @__PURE__ */ e(T, { icon: "user-plus", label: u.addPerson, onClick: d }) : null,
866
- r ? /* @__PURE__ */ e(T, { icon: "chat", label: u.chat, onClick: r }) : null,
867
- /* @__PURE__ */ e(T, { icon: "phone-off", label: u.hangUp, tone: "hang-up", onClick: o })
1021
+ /* @__PURE__ */ s("div", { className: "cms-call-panel__controls", children: [
1022
+ /* @__PURE__ */ e(U, { icon: "mic", label: t ? m.unmute : m.mute, pressed: t, onClick: d }),
1023
+ /* @__PURE__ */ e(U, { icon: "speaker", label: m.speaker, pressed: h, onClick: r }),
1024
+ u ? /* @__PURE__ */ e(U, { icon: "user-plus", label: m.addPerson, onClick: u }) : null,
1025
+ o ? /* @__PURE__ */ e(U, { icon: "chat", label: m.chat, onClick: o }) : null,
1026
+ /* @__PURE__ */ e(U, { icon: "phone-off", label: m.hangUp, tone: "hang-up", onClick: i })
868
1027
  ] })
869
1028
  ] });
870
1029
  }
871
- function je({ name: l, duration: n, muted: a, onToggleMute: t, onReturn: s, onHangUp: h, labels: i }) {
872
- const m = Z(W, i);
873
- return /* @__PURE__ */ c("section", { className: "cms-call-bar", "aria-label": m.callWith(l), children: [
1030
+ function fl({ name: l, duration: n, muted: a, onToggleMute: c, onReturn: t, onHangUp: h, labels: d }) {
1031
+ const r = Y(ne, d);
1032
+ return /* @__PURE__ */ s("section", { className: "cms-call-bar", "aria-label": r.callWith(l), children: [
874
1033
  /* @__PURE__ */ e("span", { className: "cms-call-bar__live", "aria-hidden": "true" }),
875
- /* @__PURE__ */ e("span", { className: "cms-call-bar__name", children: m.onCallWith(l) }),
1034
+ /* @__PURE__ */ e("span", { className: "cms-call-bar__name", children: r.onCallWith(l) }),
876
1035
  /* @__PURE__ */ e("span", { className: "cms-call-bar__time", children: n }),
877
- /* @__PURE__ */ c("span", { className: "cms-call-bar__actions", children: [
878
- /* @__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" }) }),
879
- /* @__PURE__ */ e("button", { type: "button", className: "cms-button cms-button--primary", onClick: s, children: m.returnToCall }),
880
- /* @__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" }) })
1036
+ /* @__PURE__ */ s("span", { className: "cms-call-bar__actions", children: [
1037
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-call-bar__icon", "aria-label": a ? r.unmute : r.mute, "aria-pressed": a, onClick: c, children: /* @__PURE__ */ e(L, { name: "mic" }) }),
1038
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-button cms-button--primary", onClick: t, children: r.returnToCall }),
1039
+ /* @__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" }) })
881
1040
  ] })
882
1041
  ] });
883
1042
  }
884
- function qe({ mark: l, product: n, headline: a, lead: t, features: s = [], children: h }) {
885
- return /* @__PURE__ */ c("div", { className: "cms-signin", children: [
886
- /* @__PURE__ */ c("aside", { className: "cms-signin__brand", children: [
887
- /* @__PURE__ */ c("p", { className: "cms-signin__logo", children: [
1043
+ function pl({ mark: l, product: n, headline: a, lead: c, features: t = [], children: h }) {
1044
+ return /* @__PURE__ */ s("div", { className: "cms-signin", children: [
1045
+ /* @__PURE__ */ s("aside", { className: "cms-signin__brand", children: [
1046
+ /* @__PURE__ */ s("p", { className: "cms-signin__logo", children: [
888
1047
  /* @__PURE__ */ e("span", { className: "cms-signin__mark", "aria-hidden": "true", children: l }),
889
1048
  n
890
1049
  ] }),
891
- /* @__PURE__ */ c("div", { className: "cms-signin__pitch", children: [
1050
+ /* @__PURE__ */ s("div", { className: "cms-signin__pitch", children: [
892
1051
  /* @__PURE__ */ e("p", { className: "cms-signin__headline", children: a }),
893
- /* @__PURE__ */ e("p", { className: "cms-signin__lead", children: t }),
894
- s.length ? /* @__PURE__ */ e("ul", { className: "cms-signin__features", children: s.map((i) => /* @__PURE__ */ c("li", { children: [
895
- /* @__PURE__ */ e(x, { name: i.icon, size: 18 }),
896
- i.label
897
- ] }, i.label)) }) : null
1052
+ /* @__PURE__ */ e("p", { className: "cms-signin__lead", children: c }),
1053
+ t.length ? /* @__PURE__ */ e("ul", { className: "cms-signin__features", children: t.map((d) => /* @__PURE__ */ s("li", { children: [
1054
+ /* @__PURE__ */ e(L, { name: d.icon, size: 18 }),
1055
+ d.label
1056
+ ] }, d.label)) }) : null
898
1057
  ] })
899
1058
  ] }),
900
1059
  /* @__PURE__ */ e("main", { className: "cms-signin__form", children: h })
901
1060
  ] });
902
1061
  }
903
- const _e = {
1062
+ const He = {
904
1063
  title: "Sign in",
905
1064
  identifier: "Email or username",
906
1065
  identifierPlaceholder: "name@example.com",
@@ -912,166 +1071,166 @@ const _e = {
912
1071
  newHere: "New here?",
913
1072
  create: "Create an account"
914
1073
  };
915
- function ze({ server: l, onSubmit: n, forgotHref: a, createHref: t, error: s, busy: h, labels: i }) {
916
- const m = Z(_e, i), d = I(), [r, o] = E(""), [f, u] = E(""), [p, N] = E(!1);
917
- return /* @__PURE__ */ c("form", { className: "cms-signin-form", onSubmit: (b) => {
918
- b.preventDefault(), n(r, f);
919
- }, "aria-describedby": s ? `${d}-error` : void 0, children: [
920
- /* @__PURE__ */ e("h1", { className: "cms-signin-form__title", children: m.title }),
921
- /* @__PURE__ */ c("p", { className: "cms-signin-form__server", children: [
922
- /* @__PURE__ */ e(x, { name: "server", size: 18 }),
1074
+ function _l({ server: l, onSubmit: n, forgotHref: a, createHref: c, error: t, busy: h, labels: d }) {
1075
+ const r = Y(He, d), u = V(), [o, i] = D(""), [p, m] = D(""), [N, v] = D(!1);
1076
+ return /* @__PURE__ */ s("form", { className: "cms-signin-form", onSubmit: (A) => {
1077
+ A.preventDefault(), n(o, p);
1078
+ }, "aria-describedby": t ? `${u}-error` : void 0, children: [
1079
+ /* @__PURE__ */ e("h1", { className: "cms-signin-form__title", children: r.title }),
1080
+ /* @__PURE__ */ s("p", { className: "cms-signin-form__server", children: [
1081
+ /* @__PURE__ */ e(L, { name: "server", size: 18 }),
923
1082
  l
924
1083
  ] }),
925
- /* @__PURE__ */ e("label", { className: "cms-signin-form__label", htmlFor: `${d}-identifier`, children: m.identifier }),
1084
+ /* @__PURE__ */ e("label", { className: "cms-signin-form__label", htmlFor: `${u}-identifier`, children: r.identifier }),
926
1085
  /* @__PURE__ */ e(
927
1086
  "input",
928
1087
  {
929
- id: `${d}-identifier`,
1088
+ id: `${u}-identifier`,
930
1089
  className: "cms-signin-form__input",
931
1090
  type: "text",
932
1091
  autoComplete: "username",
933
- placeholder: m.identifierPlaceholder,
934
- value: r,
935
- onChange: (b) => o(b.target.value),
1092
+ placeholder: r.identifierPlaceholder,
1093
+ value: o,
1094
+ onChange: (A) => i(A.target.value),
936
1095
  required: !0
937
1096
  }
938
1097
  ),
939
- /* @__PURE__ */ e("label", { className: "cms-signin-form__label", htmlFor: `${d}-password`, children: m.password }),
940
- /* @__PURE__ */ c("span", { className: "cms-signin-form__password", children: [
1098
+ /* @__PURE__ */ e("label", { className: "cms-signin-form__label", htmlFor: `${u}-password`, children: r.password }),
1099
+ /* @__PURE__ */ s("span", { className: "cms-signin-form__password", children: [
941
1100
  /* @__PURE__ */ e(
942
1101
  "input",
943
1102
  {
944
- id: `${d}-password`,
1103
+ id: `${u}-password`,
945
1104
  className: "cms-signin-form__input",
946
- type: p ? "text" : "password",
1105
+ type: N ? "text" : "password",
947
1106
  autoComplete: "current-password",
948
- value: f,
949
- onChange: (b) => u(b.target.value),
1107
+ value: p,
1108
+ onChange: (A) => m(A.target.value),
950
1109
  required: !0
951
1110
  }
952
1111
  ),
953
- /* @__PURE__ */ e("button", { type: "button", className: "cms-signin-form__show", "aria-pressed": p, onClick: () => N((b) => !b), children: p ? m.hide : m.show })
1112
+ /* @__PURE__ */ e("button", { type: "button", className: "cms-signin-form__show", "aria-pressed": N, onClick: () => v((A) => !A), children: N ? r.hide : r.show })
954
1113
  ] }),
955
- a ? /* @__PURE__ */ e("a", { className: "cms-signin-form__forgot", href: a, children: m.forgot }) : null,
956
- s ? /* @__PURE__ */ e("p", { id: `${d}-error`, className: "cms-signin-form__error", role: "alert", children: s }) : null,
957
- /* @__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 }),
958
- t ? /* @__PURE__ */ c(v, { children: [
959
- /* @__PURE__ */ e("p", { className: "cms-signin-form__or", children: /* @__PURE__ */ e("span", { children: m.newHere }) }),
960
- /* @__PURE__ */ e("a", { className: "cms-button cms-signin-form__create", href: t, children: m.create })
1114
+ a ? /* @__PURE__ */ e("a", { className: "cms-signin-form__forgot", href: a, children: r.forgot }) : null,
1115
+ t ? /* @__PURE__ */ e("p", { id: `${u}-error`, className: "cms-signin-form__error", role: "alert", children: t }) : null,
1116
+ /* @__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 }),
1117
+ c ? /* @__PURE__ */ s(w, { children: [
1118
+ /* @__PURE__ */ e("p", { className: "cms-signin-form__or", children: /* @__PURE__ */ e("span", { children: r.newHere }) }),
1119
+ /* @__PURE__ */ e("a", { className: "cms-button cms-signin-form__create", href: c, children: r.create })
961
1120
  ] }) : null
962
1121
  ] });
963
1122
  }
964
- 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 }) {
965
- const o = A([]);
966
- if (a != null) return /* @__PURE__ */ e(se, { message: a, onRetry: t });
967
- if (n === null) return /* @__PURE__ */ e(ne, { what: s, layout: "block" });
968
- if (n.length === 0) return /* @__PURE__ */ e(ae, { title: h, hint: i });
969
- const f = (u, p, N) => {
970
- var y;
971
- if (u.key === "ArrowDown" || u.key === "ArrowUp")
972
- u.preventDefault(), (y = o.current[Math.min(n.length - 1, Math.max(0, p + (u.key === "ArrowDown" ? 1 : -1)))]) == null || y.focus();
973
- else if (u.key === "Enter")
974
- d == null || d(N);
975
- else if ((u.key === "ContextMenu" || u.shiftKey && u.key === "F10") && r) {
976
- u.preventDefault();
977
- const b = u.currentTarget.getBoundingClientRect();
978
- r(N, { x: b.left + 16, y: b.bottom });
1123
+ function bl({ label: l, rows: n, error: a, onRetry: c, loadingText: t = "Loading", emptyTitle: h = "Nothing here yet", emptyHint: d, selected: r, onOpen: u, onRowMenu: o }) {
1124
+ const i = T([]);
1125
+ if (a != null) return /* @__PURE__ */ e(xe, { message: a, onRetry: c });
1126
+ if (n === null) return /* @__PURE__ */ e(we, { what: t, layout: "block" });
1127
+ if (n.length === 0) return /* @__PURE__ */ e(ke, { title: h, hint: d });
1128
+ const p = (m, N, v) => {
1129
+ var g;
1130
+ if (m.key === "ArrowDown" || m.key === "ArrowUp")
1131
+ m.preventDefault(), (g = i.current[Math.min(n.length - 1, Math.max(0, N + (m.key === "ArrowDown" ? 1 : -1)))]) == null || g.focus();
1132
+ else if (m.key === "Enter")
1133
+ u == null || u(v);
1134
+ else if ((m.key === "ContextMenu" || m.shiftKey && m.key === "F10") && o) {
1135
+ m.preventDefault();
1136
+ const A = m.currentTarget.getBoundingClientRect();
1137
+ o(v, { x: A.left + 16, y: A.bottom });
979
1138
  }
980
1139
  };
981
- return /* @__PURE__ */ e("ul", { className: "cms-list", role: "listbox", "aria-label": l, children: n.map((u, p) => {
982
- const N = u.id === m;
983
- return /* @__PURE__ */ c(
1140
+ return /* @__PURE__ */ e("ul", { className: "cms-list", role: "listbox", "aria-label": l, children: n.map((m, N) => {
1141
+ const v = m.id === r;
1142
+ return /* @__PURE__ */ s(
984
1143
  "li",
985
1144
  {
986
- ref: (y) => {
987
- o.current[p] = y;
1145
+ ref: (g) => {
1146
+ i.current[N] = g;
988
1147
  },
989
1148
  role: "option",
990
- "aria-selected": N,
991
- tabIndex: N || m == null && p === 0 ? 0 : -1,
992
- className: g("cms-list__row", N && "is-selected"),
993
- onClick: () => d == null ? void 0 : d(u.id),
994
- onKeyDown: (y) => f(y, p, u.id),
995
- onContextMenu: r ? (y) => {
996
- y.preventDefault(), r(u.id, { x: y.clientX, y: y.clientY });
1149
+ "aria-selected": v,
1150
+ tabIndex: v || r == null && N === 0 ? 0 : -1,
1151
+ className: k("cms-list__row", v && "is-selected"),
1152
+ onClick: () => u == null ? void 0 : u(m.id),
1153
+ onKeyDown: (g) => p(g, N, m.id),
1154
+ onContextMenu: o ? (g) => {
1155
+ g.preventDefault(), o(m.id, { x: g.clientX, y: g.clientY });
997
1156
  } : void 0,
998
1157
  children: [
999
- u.lead != null ? /* @__PURE__ */ e("span", { className: "cms-list__lead", children: u.lead }) : null,
1000
- /* @__PURE__ */ c("span", { className: "cms-list__text", children: [
1001
- /* @__PURE__ */ e("span", { className: "cms-list__primary", children: u.primary }),
1002
- u.secondary != null ? /* @__PURE__ */ e("span", { className: "cms-list__secondary", children: u.secondary }) : null
1158
+ m.lead != null ? /* @__PURE__ */ e("span", { className: "cms-list__lead", children: m.lead }) : null,
1159
+ /* @__PURE__ */ s("span", { className: "cms-list__text", children: [
1160
+ /* @__PURE__ */ e("span", { className: "cms-list__primary", children: m.primary }),
1161
+ m.secondary != null ? /* @__PURE__ */ e("span", { className: "cms-list__secondary", children: m.secondary }) : null
1003
1162
  ] }),
1004
- u.meta != null ? /* @__PURE__ */ e("span", { className: "cms-list__meta", children: u.meta }) : null
1163
+ m.meta != null ? /* @__PURE__ */ e("span", { className: "cms-list__meta", children: m.meta }) : null
1005
1164
  ]
1006
1165
  },
1007
- u.id
1166
+ m.id
1008
1167
  );
1009
1168
  }) });
1010
1169
  }
1011
- function Ye({ at: l, items: n, onClose: a, label: t = "Actions" }) {
1012
- const s = A(null), h = A(null), [i, m] = E(l), d = n.filter((o) => o.offer.offered);
1013
- if (Q(() => {
1170
+ function vl({ at: l, items: n, onClose: a, label: c = "Actions" }) {
1171
+ const t = T(null), h = T(null), [d, r] = D(l), u = n.filter((i) => i.offer.offered);
1172
+ if (ge(() => {
1014
1173
  if (!l) return;
1015
- const o = s.current, f = (o == null ? void 0 : o.offsetWidth) ?? 0, u = (o == null ? void 0 : o.offsetHeight) ?? 0;
1016
- m({ x: Math.max(0, Math.min(l.x, window.innerWidth - f)), y: Math.max(0, Math.min(l.y, window.innerHeight - u)) });
1017
- }, [l]), K(() => {
1018
- var f, u;
1174
+ const i = t.current, p = (i == null ? void 0 : i.offsetWidth) ?? 0, m = (i == null ? void 0 : i.offsetHeight) ?? 0;
1175
+ r({ x: Math.max(0, Math.min(l.x, window.innerWidth - p)), y: Math.max(0, Math.min(l.y, window.innerHeight - m)) });
1176
+ }, [l]), z(() => {
1177
+ var p, m;
1019
1178
  if (!l) return;
1020
- h.current = document.activeElement, (u = (f = s.current) == null ? void 0 : f.querySelector('[role="menuitem"]:not([aria-disabled="true"])')) == null || u.focus();
1021
- const o = (p) => {
1022
- var N;
1023
- (N = s.current) != null && N.contains(p.target) || a();
1179
+ h.current = document.activeElement, (m = (p = t.current) == null ? void 0 : p.querySelector('[role="menuitem"]:not([aria-disabled="true"])')) == null || m.focus();
1180
+ const i = (N) => {
1181
+ var v;
1182
+ (v = t.current) != null && v.contains(N.target) || a();
1024
1183
  };
1025
- return document.addEventListener("mousedown", o), () => {
1026
- var p, N;
1027
- document.removeEventListener("mousedown", o), (N = (p = h.current) == null ? void 0 : p.focus) == null || N.call(p);
1184
+ return document.addEventListener("mousedown", i), () => {
1185
+ var N, v;
1186
+ document.removeEventListener("mousedown", i), (v = (N = h.current) == null ? void 0 : N.focus) == null || v.call(N);
1028
1187
  };
1029
- }, [l, a]), !l || d.length === 0) return null;
1030
- const r = (o) => {
1031
- var p, N;
1032
- const f = Array.from(((p = s.current) == null ? void 0 : p.querySelectorAll('[role="menuitem"]')) ?? []), u = f.indexOf(document.activeElement);
1033
- if (o.key === "Escape" || o.key === "Tab")
1034
- o.preventDefault(), a();
1035
- else if (o.key === "ArrowDown" || o.key === "ArrowUp") {
1036
- o.preventDefault();
1037
- const y = o.key === "ArrowDown" ? 1 : -1;
1038
- (N = f[(u + y + f.length) % f.length]) == null || N.focus();
1188
+ }, [l, a]), !l || u.length === 0) return null;
1189
+ const o = (i) => {
1190
+ var N, v;
1191
+ const p = Array.from(((N = t.current) == null ? void 0 : N.querySelectorAll('[role="menuitem"]')) ?? []), m = p.indexOf(document.activeElement);
1192
+ if (i.key === "Escape" || i.key === "Tab")
1193
+ i.preventDefault(), a();
1194
+ else if (i.key === "ArrowDown" || i.key === "ArrowUp") {
1195
+ i.preventDefault();
1196
+ const g = i.key === "ArrowDown" ? 1 : -1;
1197
+ (v = p[(m + g + p.length) % p.length]) == null || v.focus();
1039
1198
  }
1040
1199
  };
1041
- return R(
1200
+ return le(
1042
1201
  /* @__PURE__ */ e(
1043
1202
  "div",
1044
1203
  {
1045
- ref: s,
1204
+ ref: t,
1046
1205
  className: "cms-menu",
1047
1206
  role: "menu",
1048
- "aria-label": t,
1049
- style: { left: (i ?? l).x, top: (i ?? l).y },
1050
- onKeyDown: r,
1051
- onContextMenu: (o) => o.preventDefault(),
1052
- children: d.map((o) => {
1053
- const f = o.offer.refusal !== void 0;
1054
- return /* @__PURE__ */ c(
1207
+ "aria-label": c,
1208
+ style: { left: (d ?? l).x, top: (d ?? l).y },
1209
+ onKeyDown: o,
1210
+ onContextMenu: (i) => i.preventDefault(),
1211
+ children: u.map((i) => {
1212
+ const p = i.offer.refusal !== void 0;
1213
+ return /* @__PURE__ */ s(
1055
1214
  "div",
1056
1215
  {
1057
1216
  role: "menuitem",
1058
1217
  tabIndex: -1,
1059
- "aria-disabled": f || void 0,
1060
- title: f ? o.offer.refusal : void 0,
1061
- className: g("cms-menu__item", o.danger && "is-danger", o.offer.locked && "is-locked", f && "is-refused"),
1218
+ "aria-disabled": p || void 0,
1219
+ title: p ? i.offer.refusal : void 0,
1220
+ className: k("cms-menu__item", i.danger && "is-danger", i.offer.locked && "is-locked", p && "is-refused"),
1062
1221
  onClick: () => {
1063
- f || (a(), o.onSelect());
1222
+ p || (a(), i.onSelect());
1064
1223
  },
1065
- onKeyDown: (u) => {
1066
- (u.key === "Enter" || u.key === " ") && !f && (u.preventDefault(), a(), o.onSelect());
1224
+ onKeyDown: (m) => {
1225
+ (m.key === "Enter" || m.key === " ") && !p && (m.preventDefault(), a(), i.onSelect());
1067
1226
  },
1068
1227
  children: [
1069
- o.offer.locked ? /* @__PURE__ */ e(M, { name: "lock" }) : null,
1070
- /* @__PURE__ */ e("span", { className: "cms-menu__label", children: o.label }),
1071
- f ? /* @__PURE__ */ e("span", { className: "cms-menu__refusal", children: o.offer.refusal }) : null
1228
+ i.offer.locked ? /* @__PURE__ */ e($, { name: "lock" }) : null,
1229
+ /* @__PURE__ */ e("span", { className: "cms-menu__label", children: i.label }),
1230
+ p ? /* @__PURE__ */ e("span", { className: "cms-menu__refusal", children: i.offer.refusal }) : null
1072
1231
  ]
1073
1232
  },
1074
- o.id
1233
+ i.id
1075
1234
  );
1076
1235
  })
1077
1236
  }
@@ -1079,11 +1238,11 @@ function Ye({ at: l, items: n, onClose: a, label: t = "Actions" }) {
1079
1238
  document.body
1080
1239
  );
1081
1240
  }
1082
- function be(l) {
1241
+ function Ze(l) {
1083
1242
  return l === "allowed" || l === "elevate" || l === "denied";
1084
1243
  }
1085
- function Ge(l, n) {
1086
- if (!be(l))
1244
+ function Nl(l, n) {
1245
+ if (!Ze(l))
1087
1246
  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 };
1088
1247
  switch (l) {
1089
1248
  case "allowed":
@@ -1094,114 +1253,116 @@ function Ge(l, n) {
1094
1253
  return n.showRefused ? { offered: !0, locked: !1, refusal: n.refusal ?? "not allowed" } : { offered: !1, locked: !1 };
1095
1254
  }
1096
1255
  }
1097
- function ve(l, n) {
1256
+ function ze(l, n) {
1098
1257
  if (!l) return;
1099
1258
  if (typeof l.get == "function") return l.get(n) ?? void 0;
1100
- const a = l, t = Object.keys(a).find((s) => s.toLowerCase() === n.toLowerCase());
1101
- return t === void 0 ? void 0 : a[t];
1259
+ const a = l, c = Object.keys(a).find((t) => t.toLowerCase() === n.toLowerCase());
1260
+ return c === void 0 ? void 0 : a[c];
1102
1261
  }
1103
- function Ne(l) {
1262
+ function Ve(l) {
1104
1263
  if (l && typeof l == "object") {
1105
1264
  const n = l;
1106
1265
  if (typeof n.detail == "string" && n.detail !== "") return n.detail;
1107
1266
  if (typeof n.title == "string" && n.title !== "") return n.title;
1108
1267
  }
1109
1268
  }
1110
- function Oe(l, n, a, t) {
1269
+ function gl(l, n, a, c) {
1111
1270
  if (l !== 403) return { kind: "none" };
1112
- const s = Ne(a);
1113
- 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." };
1271
+ const t = Ve(a);
1272
+ return ze(n, "X-Elevation-Required") !== void 0 ? c.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." };
1114
1273
  }
1115
- const V = "coolms-kit:reread";
1116
- function Qe() {
1117
- window.dispatchEvent(new Event(V));
1274
+ const ee = "coolms-kit:reread";
1275
+ function yl() {
1276
+ window.dispatchEvent(new Event(ee));
1118
1277
  }
1119
- function Je(l) {
1120
- const [n, a] = E(void 0), [t, s] = E(void 0), [h, i] = E(!0), m = A(l);
1121
- m.current = l;
1122
- const d = A(0), r = J(() => {
1123
- const o = ++d.current;
1124
- i(!0), m.current().then(
1125
- (f) => {
1126
- o === d.current && (a(f), s(void 0), i(!1));
1278
+ function wl(l) {
1279
+ const [n, a] = D(void 0), [c, t] = D(void 0), [h, d] = D(!0), r = T(l);
1280
+ r.current = l;
1281
+ const u = T(0), o = J(() => {
1282
+ const i = ++u.current;
1283
+ d(!0), r.current().then(
1284
+ (p) => {
1285
+ i === u.current && (a(p), t(void 0), d(!1));
1127
1286
  },
1128
- (f) => {
1129
- o === d.current && (s(f), i(!1));
1287
+ (p) => {
1288
+ i === u.current && (t(p), d(!1));
1130
1289
  }
1131
1290
  );
1132
1291
  }, []);
1133
- return K(() => {
1134
- r();
1135
- const o = () => r();
1136
- return window.addEventListener("focus", o), window.addEventListener(V, o), () => {
1137
- window.removeEventListener("focus", o), window.removeEventListener(V, o);
1292
+ return z(() => {
1293
+ o();
1294
+ const i = () => o();
1295
+ return window.addEventListener("focus", i), window.addEventListener(ee, i), () => {
1296
+ window.removeEventListener("focus", i), window.removeEventListener(ee, i);
1138
1297
  };
1139
- }, [r]), { value: n, error: t, loading: h, reread: r };
1298
+ }, [o]), { value: n, error: c, loading: h, reread: o };
1140
1299
  }
1141
- function el(l) {
1300
+ function kl(l) {
1142
1301
  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 };
1143
1302
  }
1144
- const ge = "/errors/client-update-required";
1145
- function ye(l, n) {
1146
- const a = l.split(".").map((s) => Number.parseInt(s, 10) || 0), t = n.split(".").map((s) => Number.parseInt(s, 10) || 0);
1147
- for (let s = 0; s < Math.max(a.length, t.length); s++) {
1148
- const h = a[s] ?? 0, i = t[s] ?? 0;
1149
- if (h !== i) return h < i;
1303
+ const Re = "/errors/client-update-required";
1304
+ function We(l, n) {
1305
+ const a = l.split(".").map((t) => Number.parseInt(t, 10) || 0), c = n.split(".").map((t) => Number.parseInt(t, 10) || 0);
1306
+ for (let t = 0; t < Math.max(a.length, c.length); t++) {
1307
+ const h = a[t] ?? 0, d = c[t] ?? 0;
1308
+ if (h !== d) return h < d;
1150
1309
  }
1151
1310
  return !1;
1152
1311
  }
1153
- function ll(l) {
1154
- return l.problemType !== void 0 && l.problemType.endsWith(ge) ? !0 : l.minimumVersion !== void 0 && ye(l.version, l.minimumVersion);
1312
+ function xl(l) {
1313
+ return l.problemType !== void 0 && l.problemType.endsWith(Re) ? !0 : l.minimumVersion !== void 0 && We(l.version, l.minimumVersion);
1155
1314
  }
1156
1315
  export {
1157
- Ke as AppShell,
1158
- H as Avatar,
1159
- fe as Badge,
1160
- F as Button,
1161
- W as CALL_LABELS,
1162
- ge as CLIENT_UPDATE_REQUIRED,
1163
- je as CallBar,
1164
- Ue as CallPanel,
1165
- Ve as ChatBubble,
1166
- Re as Composer,
1167
- Ee as ConfirmDialog,
1168
- Ye as ContextMenu,
1169
- ae as EmptyState,
1170
- se as ErrorBanner,
1171
- Te as FileViewer,
1172
- Fe as FilterChips,
1173
- $e as ICON_NAMES,
1174
- x as Icon,
1175
- We as IncomingCall,
1176
- Xe as List,
1177
- ne as Loading,
1178
- pe as MAIL_ROW_LABELS,
1179
- ee as MODAL_CLOSE_MS,
1180
- He as MailRow,
1181
- le as Modal,
1182
- Ie as PageHeader,
1183
- _e as SIGN_IN_LABELS,
1184
- j as STATE_DELAY_MS,
1185
- Pe as SearchField,
1186
- Ce as Select,
1187
- ze as SignInForm,
1188
- qe as SignInLayout,
1189
- Ze as SplitPanes,
1190
- De as State,
1191
- Be as TabStrip,
1192
- xe as TextField,
1193
- Le as Toast,
1194
- Se as ToastRegion,
1195
- Ae as Toggle,
1196
- ue as initialsOf,
1197
- be as isCapability,
1198
- ll as needsClientUpdate,
1199
- Ge as offerFor,
1200
- el as readConflict,
1201
- Oe as readRefusal,
1202
- Ne as refusalText,
1203
- Qe as rereadAll,
1204
- he as tintOf,
1205
- Je as useReread,
1206
- ye as versionBelow
1316
+ tl as AppShell,
1317
+ G as Avatar,
1318
+ Ke as Badge,
1319
+ Z as Button,
1320
+ ne as CALL_LABELS,
1321
+ Re as CLIENT_UPDATE_REQUIRED,
1322
+ fl as CallBar,
1323
+ hl as CallPanel,
1324
+ dl as ChatBubble,
1325
+ ml as Composer,
1326
+ Oe as ConfirmDialog,
1327
+ vl as ContextMenu,
1328
+ ke as EmptyState,
1329
+ xe as ErrorBanner,
1330
+ nl as FilePicker,
1331
+ $e as FilePickerDenied,
1332
+ ll as FileViewer,
1333
+ il as FilterChips,
1334
+ el as ICON_NAMES,
1335
+ L as Icon,
1336
+ ul as IncomingCall,
1337
+ bl as List,
1338
+ we as Loading,
1339
+ Fe as MAIL_ROW_LABELS,
1340
+ ye as MODAL_CLOSE_MS,
1341
+ ol as MailRow,
1342
+ fe as Modal,
1343
+ al as PageHeader,
1344
+ He as SIGN_IN_LABELS,
1345
+ me as STATE_DELAY_MS,
1346
+ cl as SearchField,
1347
+ Ye as Select,
1348
+ _l as SignInForm,
1349
+ pl as SignInLayout,
1350
+ rl as SplitPanes,
1351
+ X as State,
1352
+ sl as TabStrip,
1353
+ Xe as TextField,
1354
+ Qe as Toast,
1355
+ Je as ToastRegion,
1356
+ Ge as Toggle,
1357
+ Be as initialsOf,
1358
+ Ze as isCapability,
1359
+ xl as needsClientUpdate,
1360
+ Nl as offerFor,
1361
+ kl as readConflict,
1362
+ gl as readRefusal,
1363
+ Ve as refusalText,
1364
+ yl as rereadAll,
1365
+ Ie as tintOf,
1366
+ wl as useReread,
1367
+ We as versionBelow
1207
1368
  };