@coolms/ui-react 0.1.0-alpha.18 → 0.1.0-alpha.19

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