@coolms/ui-react 0.1.0-alpha.2 → 0.1.0-alpha.20

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