reifyui 0.6.1 → 0.7.0

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.cjs CHANGED
@@ -16,21 +16,22 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
20
20
  // If the importer is in node compatibility mode or this is not an ESM
21
21
  // file that has been converted to a CommonJS file using a Babel-
22
22
  // compatible transform (i.e. "__esModule" has not been set), then set
23
23
  // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
24
+ isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target,
25
+ mod2
26
26
  ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
28
28
 
29
29
  // src/index.js
30
30
  var src_exports = {};
31
31
  __export(src_exports, {
32
32
  AssistantTurn: () => AssistantTurn,
33
33
  AuthForm: () => AuthForm,
34
+ Button: () => Button,
34
35
  Card: () => Card,
35
36
  Carousel: () => Carousel,
36
37
  ChatMessages: () => ChatMessages,
@@ -42,10 +43,17 @@ __export(src_exports, {
42
43
  Composer: () => Composer,
43
44
  DEFAULT_STATUS_LABELS: () => DEFAULT_STATUS_LABELS,
44
45
  DialogHost: () => DialogHost,
46
+ Field: () => Field,
47
+ FileCard: () => FileCard,
48
+ FilePreview: () => FilePreview,
49
+ FileTypeIcon: () => FileTypeIcon,
50
+ FormActions: () => FormActions,
45
51
  GOOGLE_ENABLED: () => GOOGLE_ENABLED,
46
52
  GoogleButton: () => GoogleButton,
47
53
  IcCheck: () => IcCheck,
48
54
  IcDoc: () => IcDoc,
55
+ IcDownload: () => IcDownload,
56
+ IcEye: () => IcEye,
49
57
  IcGlobe: () => IcGlobe,
50
58
  IcList: () => IcList,
51
59
  IcMic: () => IcMic,
@@ -61,14 +69,17 @@ __export(src_exports, {
61
69
  IcThink: () => IcThink,
62
70
  IcTool: () => IcTool,
63
71
  IcX: () => IcX,
72
+ Input: () => Input,
64
73
  Modal: () => Modal,
65
74
  PaneResizer: () => PaneResizer,
66
75
  Popover: () => Popover,
67
76
  SESSION_EVENT: () => SESSION_EVENT,
68
77
  SearchField: () => SearchField,
78
+ Select: () => Select,
69
79
  SheetGrid: () => SheetGrid,
70
80
  Svg: () => Svg,
71
81
  TaskList: () => TaskList,
82
+ Textarea: () => Textarea,
72
83
  ToolGroup: () => ToolGroup,
73
84
  ToolRow: () => ToolRow,
74
85
  UserTurn: () => UserTurn,
@@ -82,6 +93,7 @@ __export(src_exports, {
82
93
  createConversationStore: () => createConversationStore,
83
94
  createDictation: () => createDictation,
84
95
  createResponsesDispatcher: () => createResponsesDispatcher,
96
+ extOf: () => extOf,
85
97
  fetchBalance: () => fetchBalance,
86
98
  getSession: () => getSession,
87
99
  getToken: () => getToken,
@@ -406,6 +418,15 @@ var IcPanelRight = ({ size = 17 }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx
406
418
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "3", y: "4", width: "18", height: "16", rx: "2" }),
407
419
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M15 4v16" })
408
420
  ] });
421
+ var IcDownload = ({ size = 16 }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Svg, { s: size, children: [
422
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
423
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M7 10l5 5 5-5" }),
424
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 15V3" })
425
+ ] });
426
+ var IcEye = ({ size = 15 }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Svg, { s: size, children: [
427
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7-10-7-10-7z" }),
428
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "12", r: "3" })
429
+ ] });
409
430
 
410
431
  // src/components/toolMeta.js
411
432
  function humanize(s) {
@@ -1342,8 +1363,8 @@ function canonicalLang(tag) {
1342
1363
  var _ready = /* @__PURE__ */ new Map();
1343
1364
  function ensureLanguage(name) {
1344
1365
  if (!_ready.has(name)) {
1345
- const p = Promise.all([loadHljs(), GRAMMARS[name]()]).then(([hljs, mod]) => {
1346
- if (!hljs.getLanguage(name)) hljs.registerLanguage(name, mod.default || mod);
1366
+ const p = Promise.all([loadHljs(), GRAMMARS[name]()]).then(([hljs, mod2]) => {
1367
+ if (!hljs.getLanguage(name)) hljs.registerLanguage(name, mod2.default || mod2);
1347
1368
  return hljs;
1348
1369
  }).catch(() => null);
1349
1370
  _ready.set(name, p);
@@ -1788,7 +1809,7 @@ function PromptBody({ spec, onClose, t, titleId }) {
1788
1809
  const [value, setValue] = (0, import_react12.useState)(spec.defaultValue ?? "");
1789
1810
  const [err, setErr] = (0, import_react12.useState)(null);
1790
1811
  const inputId = (0, import_react12.useId)();
1791
- const Field = spec.multiline ? "textarea" : "input";
1812
+ const Field2 = spec.multiline ? "textarea" : "input";
1792
1813
  const submit = () => {
1793
1814
  const invalid = spec.validate?.(value);
1794
1815
  if (invalid) {
@@ -1807,7 +1828,7 @@ function PromptBody({ spec, onClose, t, titleId }) {
1807
1828
  spec.message ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "rui-dlg-msg", children: spec.message }) : null,
1808
1829
  spec.label ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "rui-dlg-label", htmlFor: inputId, children: spec.label }) : null,
1809
1830
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1810
- Field,
1831
+ Field2,
1811
1832
  {
1812
1833
  id: inputId,
1813
1834
  className: `rui-dlg-input${err ? " is-err" : ""}`,
@@ -2119,7 +2140,7 @@ var GOOGLE_ENABLED = !!CLIENT_ID;
2119
2140
 
2120
2141
  // src/auth/AuthForm.jsx
2121
2142
  var import_jsx_runtime12 = require("react/jsx-runtime");
2122
- function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
2143
+ function AuthForm({ onDone, subtitle: subtitle2, brand = null, productName = "" }) {
2123
2144
  const [mode, setMode] = (0, import_react14.useState)("signin");
2124
2145
  const [email, setEmail] = (0, import_react14.useState)("");
2125
2146
  const [password, setPassword] = (0, import_react14.useState)("");
@@ -2195,7 +2216,7 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
2195
2216
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("form", { onSubmit: submit, children: [
2196
2217
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "logo", children: brand }),
2197
2218
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h1", { children: mode === "register" ? "Create your account" : mode === "forgot" ? "Reset password" : "Sign in" }),
2198
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "sub", children: mode === "register" ? "Get started in seconds." : mode === "forgot" ? "We will email you a reset link." : subtitle || "Welcome back." }),
2219
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "sub", children: mode === "register" ? "Get started in seconds." : mode === "forgot" ? "We will email you a reset link." : subtitle2 || "Welcome back." }),
2199
2220
  mode === "forgot" ? resetSent ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
2200
2221
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "auth-note", children: [
2201
2222
  "If an account exists for ",
@@ -2795,30 +2816,51 @@ function SheetGrid({
2795
2816
  },
2796
2817
  title: c.error || "",
2797
2818
  children: [
2798
- peer && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "shg-peer-flag", style: { background: peer.color }, children: peer.name }),
2799
- isEditing ? renderEditor(col) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2800
- "div",
2801
- {
2802
- className: "shg-val",
2803
- style: { maxWidth: colWidth(col) ? colWidth(col) - 20 : 400 },
2804
- children: custom !== void 0 ? custom : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
2805
- computed && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(StatusDot, { status: c.status }),
2806
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CellValue, { cell: c, col, fetchBlobUrl, onOpenResource }),
2807
- computed && !readOnly && onRunCell && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2808
- "button",
2809
- {
2810
- className: "shg-runcell",
2811
- title: "Run this cell",
2812
- onClick: (e) => {
2813
- e.stopPropagation();
2814
- onRunCell(row.id, col.id);
2815
- },
2816
- children: "\u25B6"
2817
- }
2819
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
2820
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2821
+ "span",
2822
+ {
2823
+ className: "shg-resize-col shg-resize-in-cell",
2824
+ onClick: (e) => e.stopPropagation(),
2825
+ onMouseDown: (e) => startResize(
2826
+ e,
2827
+ "col",
2828
+ col.id,
2829
+ colWidth(col) || e.currentTarget.closest("td").offsetWidth
2818
2830
  )
2819
- ] })
2820
- }
2821
- )
2831
+ }
2832
+ ),
2833
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2834
+ "span",
2835
+ {
2836
+ className: "shg-resize-row shg-resize-in-cell",
2837
+ onClick: (e) => e.stopPropagation(),
2838
+ onMouseDown: (e) => startResize(
2839
+ e,
2840
+ "row",
2841
+ row.id,
2842
+ rowHeight(row) || e.currentTarget.closest("tr").offsetHeight
2843
+ )
2844
+ }
2845
+ )
2846
+ ] }),
2847
+ peer && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "shg-peer-flag", style: { background: peer.color }, children: peer.name }),
2848
+ isEditing ? renderEditor(col) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "shg-val", children: custom !== void 0 ? custom : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
2849
+ computed && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(StatusDot, { status: c.status }),
2850
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CellValue, { cell: c, col, fetchBlobUrl, onOpenResource }),
2851
+ computed && !readOnly && onRunCell && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2852
+ "button",
2853
+ {
2854
+ className: "shg-runcell",
2855
+ title: "Run this cell",
2856
+ onClick: (e) => {
2857
+ e.stopPropagation();
2858
+ onRunCell(row.id, col.id);
2859
+ },
2860
+ children: "\u25B6"
2861
+ }
2862
+ )
2863
+ ] }) })
2822
2864
  ]
2823
2865
  },
2824
2866
  col.id
@@ -3063,15 +3105,419 @@ function sheetToAoA(sheet, { cellText = defaultCellValue } = {}) {
3063
3105
  ];
3064
3106
  }
3065
3107
 
3066
- // src/components/Carousel.jsx
3067
- var import_react16 = __toESM(require("react"), 1);
3108
+ // src/components/FileTypeIcon.jsx
3109
+ var import_react16 = require("react");
3068
3110
  var import_jsx_runtime14 = require("react/jsx-runtime");
3111
+ function extOf(name) {
3112
+ const m = String(name || "").toLowerCase().match(/\.([a-z0-9]+)$/);
3113
+ return m ? m[1] : "";
3114
+ }
3115
+ var mod = null;
3116
+ var tried = false;
3117
+ function FileTypeIcon({ name, size = 36 }) {
3118
+ const [, force] = (0, import_react16.useState)(0);
3119
+ const ext = extOf(name);
3120
+ (0, import_react16.useEffect)(() => {
3121
+ if (tried || mod) return;
3122
+ tried = true;
3123
+ import("react-file-icon").then((m) => {
3124
+ mod = m;
3125
+ force((n) => n + 1);
3126
+ }).catch(() => {
3127
+ });
3128
+ }, []);
3129
+ const box = { width: size, height: Math.round(size * 1.16), display: "inline-block", flex: "0 0 auto" };
3130
+ if (!mod) {
3131
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "uic-fileglyph", style: box, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "uic-fileglyph-ext", children: (ext || "file").slice(0, 4) }) });
3132
+ }
3133
+ const { FileIcon, defaultStyles } = mod;
3134
+ const style = defaultStyles?.[ext] || {};
3135
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: box, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FileIcon, { extension: ext || void 0, ...style }) });
3136
+ }
3137
+
3138
+ // src/components/FileCard.jsx
3139
+ var import_react17 = require("react");
3140
+ var import_jsx_runtime15 = require("react/jsx-runtime");
3141
+ function subtitle(name, origin, bytes) {
3142
+ const parts = [(extOf(name) || "file").toUpperCase()];
3143
+ if (origin) parts.push(origin);
3144
+ if (bytes != null) parts.push(bytesLabel2(bytes));
3145
+ return parts.join(" \xB7 ");
3146
+ }
3147
+ function bytesLabel2(n) {
3148
+ if (n == null) return "";
3149
+ if (n < 1024) return `${n} B`;
3150
+ if (n < 1048576) return `${Math.round(n / 1024)} KB`;
3151
+ return `${(n / 1048576).toFixed(1)} MB`;
3152
+ }
3153
+ function FileCard({
3154
+ name,
3155
+ origin,
3156
+ bytes,
3157
+ onPreview,
3158
+ onDownload,
3159
+ compact = false,
3160
+ className = ""
3161
+ }) {
3162
+ const open = onPreview ? (e) => {
3163
+ e.stopPropagation();
3164
+ onPreview();
3165
+ } : void 0;
3166
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
3167
+ "div",
3168
+ {
3169
+ className: "uic-filecard" + (compact ? " is-compact" : "") + (open ? " is-clickable" : "") + (className ? " " + className : ""),
3170
+ onClick: open,
3171
+ role: open ? "button" : void 0,
3172
+ tabIndex: open ? 0 : void 0,
3173
+ onKeyDown: open ? (e) => {
3174
+ if (e.key === "Enter" || e.key === " ") {
3175
+ e.preventDefault();
3176
+ open(e);
3177
+ }
3178
+ } : void 0,
3179
+ title: name,
3180
+ children: [
3181
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "uic-filecard-ic", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FileTypeIcon, { name, size: compact ? 20 : 30 }) }),
3182
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "uic-filecard-meta", children: [
3183
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "uic-filecard-name", children: name }),
3184
+ !compact && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "uic-filecard-sub", children: subtitle(name, origin, bytes) })
3185
+ ] }),
3186
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react17.Fragment, { children: [
3187
+ onDownload && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3188
+ "button",
3189
+ {
3190
+ type: "button",
3191
+ className: "uic-filecard-btn",
3192
+ "aria-label": `Download ${name}`,
3193
+ title: "Download",
3194
+ onClick: (e) => {
3195
+ e.stopPropagation();
3196
+ onDownload();
3197
+ },
3198
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(IcDownload, {})
3199
+ }
3200
+ ),
3201
+ onPreview && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3202
+ "button",
3203
+ {
3204
+ type: "button",
3205
+ className: "uic-filecard-btn",
3206
+ "aria-label": `Preview ${name}`,
3207
+ title: "Preview",
3208
+ onClick: open,
3209
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(IcEye, {})
3210
+ }
3211
+ )
3212
+ ] })
3213
+ ]
3214
+ }
3215
+ );
3216
+ }
3217
+
3218
+ // src/components/FilePreview.jsx
3219
+ var import_react18 = require("react");
3220
+ var import_jsx_runtime16 = require("react/jsx-runtime");
3221
+ var LANG = {
3222
+ js: "javascript",
3223
+ mjs: "javascript",
3224
+ cjs: "javascript",
3225
+ jsx: "javascript",
3226
+ ts: "typescript",
3227
+ tsx: "typescript",
3228
+ py: "python",
3229
+ rb: "ruby",
3230
+ go: "go",
3231
+ rs: "rust",
3232
+ java: "java",
3233
+ c: "c",
3234
+ h: "c",
3235
+ cpp: "cpp",
3236
+ hpp: "cpp",
3237
+ cs: "csharp",
3238
+ php: "php",
3239
+ swift: "swift",
3240
+ kt: "kotlin",
3241
+ scala: "scala",
3242
+ sh: "bash",
3243
+ bash: "bash",
3244
+ zsh: "bash",
3245
+ sql: "sql",
3246
+ css: "css",
3247
+ scss: "scss",
3248
+ less: "less",
3249
+ html: "xml",
3250
+ htm: "xml",
3251
+ xml: "xml",
3252
+ svg: "xml",
3253
+ json: "json",
3254
+ yaml: "yaml",
3255
+ yml: "yaml",
3256
+ toml: "ini",
3257
+ ini: "ini",
3258
+ r: "r",
3259
+ lua: "lua",
3260
+ pl: "perl",
3261
+ dockerfile: "dockerfile",
3262
+ diff: "diff"
3263
+ };
3264
+ var OFFICE = /* @__PURE__ */ new Set(["pptx", "ppt", "pptm", "odp", "doc", "docx", "odt", "rtf"]);
3265
+ var SHEET = /* @__PURE__ */ new Set(["xls", "xlsx", "xlsm", "xlsb", "ods"]);
3266
+ function kindOf(name, mime = "") {
3267
+ const e = extOf(name);
3268
+ if (mime.startsWith("image/") || /^(png|jpe?g|gif|webp|svg|bmp|ico|avif)$/.test(e)) return "image";
3269
+ if (mime === "application/pdf" || e === "pdf") return "pdf";
3270
+ if (mime.startsWith("video/") || ["mp4", "webm", "mov", "m4v"].includes(e)) return "video";
3271
+ if (mime.startsWith("audio/") || ["mp3", "wav", "ogg", "m4a", "flac"].includes(e)) return "audio";
3272
+ if (e === "csv" || e === "tsv") return "csv";
3273
+ if (e === "md" || e === "markdown") return "markdown";
3274
+ if (SHEET.has(e)) return "sheet";
3275
+ if (OFFICE.has(e)) return "office";
3276
+ if (mime.startsWith("text/") || LANG[e] || /^(txt|log|env|conf|cfg|gitignore)$/.test(e)) return "code";
3277
+ return "binary";
3278
+ }
3279
+ function delimitedToRows(text, sep) {
3280
+ return text.split(/\r?\n/).filter((l) => l.length).slice(0, 1e3).map((line) => {
3281
+ const out = [];
3282
+ let cur = "";
3283
+ let q = false;
3284
+ for (const ch of line) {
3285
+ if (ch === '"') q = !q;
3286
+ else if (ch === sep && !q) {
3287
+ out.push(cur);
3288
+ cur = "";
3289
+ } else cur += ch;
3290
+ }
3291
+ out.push(cur);
3292
+ return out.map((c) => c.replace(/^"|"$/g, ""));
3293
+ });
3294
+ }
3295
+ function Grid({ rows }) {
3296
+ if (!rows?.length) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "uic-fp-empty", children: "This file is empty." });
3297
+ const [head, ...body] = rows;
3298
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "uic-fp-sheet", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("table", { children: [
3299
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tr", { children: head.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("th", { children: c }, i)) }) }),
3300
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tbody", { children: body.map((r, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tr", { children: r.map((c, j) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("td", { children: c }, j)) }, i)) })
3301
+ ] }) });
3302
+ }
3303
+ var defaultDownload = (url, name) => {
3304
+ const a = document.createElement("a");
3305
+ a.href = url;
3306
+ a.download = name;
3307
+ a.rel = "noreferrer";
3308
+ document.body.appendChild(a);
3309
+ a.click();
3310
+ a.remove();
3311
+ };
3312
+ function FilePreview({
3313
+ file,
3314
+ onClose,
3315
+ fetchFile,
3316
+ officePdfUrl,
3317
+ renderMarkdown,
3318
+ onDownload,
3319
+ title
3320
+ }) {
3321
+ const { url, name } = file || {};
3322
+ const [st, setSt] = (0, import_react18.useState)({ kind: "loading" });
3323
+ const [tab, setTab] = (0, import_react18.useState)(0);
3324
+ (0, import_react18.useEffect)(() => {
3325
+ if (!url) return void 0;
3326
+ let alive = true;
3327
+ let obj;
3328
+ setSt({ kind: "loading" });
3329
+ setTab(0);
3330
+ const get = fetchFile || ((u) => fetch(u, { cache: "no-store" }));
3331
+ (async () => {
3332
+ const res = await get(url);
3333
+ if (!res.ok) throw new Error(`${res.status}`);
3334
+ const mime = (res.headers.get("content-type") || "").toLowerCase();
3335
+ const kind = kindOf(name, mime);
3336
+ if (kind === "office") {
3337
+ if (!officePdfUrl) {
3338
+ setSt({ kind: "binary", error: "This format has no inline preview here \u2014 download it to open it." });
3339
+ return;
3340
+ }
3341
+ const r = await get(officePdfUrl(url));
3342
+ if (!r.ok) throw new Error(`${r.status}`);
3343
+ obj = URL.createObjectURL(await r.blob());
3344
+ if (alive) setSt({ kind: "pdf", objUrl: obj });
3345
+ return;
3346
+ }
3347
+ if (kind === "sheet") {
3348
+ try {
3349
+ const buf = await res.arrayBuffer();
3350
+ const XLSX = await import("xlsx");
3351
+ const wb = XLSX.read(buf, { type: "array" });
3352
+ const sheets = wb.SheetNames.map((n) => {
3353
+ const ws = wb.Sheets[n] || {};
3354
+ const filled = Boolean(ws["!ref"]);
3355
+ return { name: n, filled, rows: filled ? XLSX.utils.sheet_to_json(ws, { header: 1, raw: false }) : [] };
3356
+ });
3357
+ const first = sheets.findIndex((s) => s.filled);
3358
+ if (alive) {
3359
+ setTab(first < 0 ? 0 : first);
3360
+ setSt({ kind: "sheet", sheets });
3361
+ }
3362
+ } catch (e) {
3363
+ if (alive) setSt({ kind: "binary", error: `This spreadsheet couldn\u2019t be read (${String(e?.message || "parse failed").slice(0, 80)}).` });
3364
+ }
3365
+ return;
3366
+ }
3367
+ if (kind === "csv" || kind === "markdown" || kind === "code") {
3368
+ const text = await res.text();
3369
+ if (!alive) return;
3370
+ if (kind === "csv") setSt({ kind: "csv", rows: delimitedToRows(text, extOf(name) === "tsv" ? " " : ",") });
3371
+ else setSt({ kind, text: text.slice(0, 4e5) });
3372
+ return;
3373
+ }
3374
+ if (kind === "binary") {
3375
+ if (alive) setSt({ kind: "binary" });
3376
+ return;
3377
+ }
3378
+ obj = URL.createObjectURL(await res.blob());
3379
+ if (alive) setSt({ kind, objUrl: obj });
3380
+ })().catch(() => {
3381
+ if (alive) setSt({ kind: "binary", error: "Could not load this file." });
3382
+ });
3383
+ return () => {
3384
+ alive = false;
3385
+ if (obj) URL.revokeObjectURL(obj);
3386
+ };
3387
+ }, [url, name, fetchFile, officePdfUrl]);
3388
+ const download = () => onDownload ? onDownload(url, name) : defaultDownload(url, name);
3389
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("aside", { className: "uic-fp", "aria-label": title || `Preview of ${name}`, children: [
3390
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("header", { className: "uic-fp-head", children: [
3391
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "uic-fp-ic", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(FileTypeIcon, { name, size: 20 }) }),
3392
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "uic-fp-name", title: name, children: name }),
3393
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3394
+ "button",
3395
+ {
3396
+ type: "button",
3397
+ className: "uic-fp-btn",
3398
+ "aria-label": `Download ${name}`,
3399
+ title: "Download",
3400
+ onClick: download,
3401
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(IcDownload, {})
3402
+ }
3403
+ ),
3404
+ onClose && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3405
+ "button",
3406
+ {
3407
+ type: "button",
3408
+ className: "uic-fp-btn",
3409
+ "aria-label": "Close preview",
3410
+ title: "Close",
3411
+ onClick: onClose,
3412
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(IcX, { size: 18 })
3413
+ }
3414
+ )
3415
+ ] }),
3416
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "uic-fp-body", children: [
3417
+ st.kind === "loading" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "uic-fp-pad", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "uic-skel uic-fp-skel" }) }),
3418
+ st.kind === "image" && st.objUrl && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "uic-fp-center", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("img", { className: "uic-fp-img", src: st.objUrl, alt: name }) }),
3419
+ st.kind === "pdf" && st.objUrl && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("iframe", { className: "uic-fp-frame", src: st.objUrl, title: name }),
3420
+ st.kind === "video" && st.objUrl && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "uic-fp-center", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("video", { className: "uic-fp-media", src: st.objUrl, controls: true }) }),
3421
+ st.kind === "audio" && st.objUrl && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "uic-fp-center", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("audio", { src: st.objUrl, controls: true }) }),
3422
+ st.kind === "markdown" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "uic-fp-doc", children: renderMarkdown ? renderMarkdown(st.text || "") : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("pre", { className: "uic-fp-pre", children: st.text }) }),
3423
+ st.kind === "code" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CodeBlock, { code: st.text || "", lang: LANG[extOf(name)] || "plaintext" }),
3424
+ st.kind === "csv" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Grid, { rows: st.rows }),
3425
+ st.kind === "sheet" && st.sheets && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "uic-fp-xlsx", children: [
3426
+ st.sheets[tab]?.filled ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Grid, { rows: st.sheets[tab].rows }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "uic-fp-empty", children: "This sheet is empty." }),
3427
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "uic-fp-tabs", children: st.sheets.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3428
+ "button",
3429
+ {
3430
+ type: "button",
3431
+ className: "uic-fp-tab" + (i === tab ? " is-on" : "") + (s.filled ? "" : " is-empty"),
3432
+ onClick: () => setTab(i),
3433
+ title: s.filled ? s.name : `${s.name} (empty)`,
3434
+ children: s.name
3435
+ },
3436
+ s.name + i
3437
+ )) })
3438
+ ] }),
3439
+ st.kind === "binary" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "uic-fp-center", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "uic-fp-fallback", children: [
3440
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(FileTypeIcon, { name, size: 56 }),
3441
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { children: st.error || "No inline preview for this file type." }),
3442
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: "uic-fp-dl", onClick: download, children: "Download" })
3443
+ ] }) })
3444
+ ] })
3445
+ ] });
3446
+ }
3447
+
3448
+ // src/components/form.jsx
3449
+ var import_react19 = require("react");
3450
+ var import_jsx_runtime17 = require("react/jsx-runtime");
3451
+ function Field({ label, hint, error, htmlFor, required, children, className = "" }) {
3452
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "uic-field" + (error ? " is-error" : "") + (className ? " " + className : ""), children: [
3453
+ label && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "uic-field-label", htmlFor, children: [
3454
+ label,
3455
+ required && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "uic-field-req", "aria-hidden": "true", children: "*" })
3456
+ ] }),
3457
+ children,
3458
+ error ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "uic-field-err", children: error }) : hint ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "uic-field-hint", children: hint }) : null
3459
+ ] });
3460
+ }
3461
+ function withField(Control) {
3462
+ return function Fielded({ label, hint, error, required, id, className, ...rest }) {
3463
+ const auto = (0, import_react19.useId)();
3464
+ const inputId = id || auto;
3465
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Field, { label, hint, error, required, htmlFor: inputId, className, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Control, { id: inputId, invalid: !!error, required, ...rest }) });
3466
+ };
3467
+ }
3468
+ function BareInput({ invalid, ...rest }) {
3469
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { className: "uic-input" + (invalid ? " is-error" : ""), "aria-invalid": invalid || void 0, ...rest });
3470
+ }
3471
+ function BareTextarea({ invalid, rows = 4, ...rest }) {
3472
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3473
+ "textarea",
3474
+ {
3475
+ className: "uic-input uic-textarea" + (invalid ? " is-error" : ""),
3476
+ rows,
3477
+ "aria-invalid": invalid || void 0,
3478
+ ...rest
3479
+ }
3480
+ );
3481
+ }
3482
+ function BareSelect({ invalid, options = [], placeholder, ...rest }) {
3483
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "uic-select-wrap", children: [
3484
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3485
+ "select",
3486
+ {
3487
+ className: "uic-input uic-select" + (invalid ? " is-error" : ""),
3488
+ "aria-invalid": invalid || void 0,
3489
+ ...rest,
3490
+ children: [
3491
+ placeholder && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: placeholder }),
3492
+ options.map((o) => {
3493
+ const opt = typeof o === "string" ? { value: o, label: o } : o;
3494
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: opt.value, disabled: opt.disabled, children: opt.label }, opt.value);
3495
+ })
3496
+ ]
3497
+ }
3498
+ ),
3499
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "uic-select-chev", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Chevron, { dir: "down", size: 14 }) })
3500
+ ] });
3501
+ }
3502
+ var Input = withField(BareInput);
3503
+ var Textarea = withField(BareTextarea);
3504
+ var Select = withField(BareSelect);
3505
+ function FormActions({ children, align = "end", className = "" }) {
3506
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: `uic-form-actions is-${align}${className ? " " + className : ""}`, children });
3507
+ }
3508
+ function Button({ variant = "default", size = "md", type = "button", className = "", ...rest }) {
3509
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type, className: `uic-btn is-${variant} is-${size}${className ? " " + className : ""}`, ...rest });
3510
+ }
3511
+
3512
+ // src/components/Carousel.jsx
3513
+ var import_react20 = __toESM(require("react"), 1);
3514
+ var import_jsx_runtime18 = require("react/jsx-runtime");
3069
3515
  var EDGE = 2;
3070
3516
  function Carousel(props) {
3071
3517
  const { label, step, children, classNames = {} } = props;
3072
- const ref = (0, import_react16.useRef)(null);
3073
- const [edges, setEdges] = (0, import_react16.useState)({ start: true, end: true, overflow: false });
3074
- const measure = (0, import_react16.useCallback)(() => {
3518
+ const ref = (0, import_react20.useRef)(null);
3519
+ const [edges, setEdges] = (0, import_react20.useState)({ start: true, end: true, overflow: false });
3520
+ const measure = (0, import_react20.useCallback)(() => {
3075
3521
  const el = ref.current;
3076
3522
  if (!el) return;
3077
3523
  const overflow = el.scrollWidth - el.clientWidth > EDGE;
@@ -3081,7 +3527,7 @@ function Carousel(props) {
3081
3527
  end: el.scrollLeft >= el.scrollWidth - el.clientWidth - EDGE
3082
3528
  });
3083
3529
  }, []);
3084
- (0, import_react16.useEffect)(() => {
3530
+ (0, import_react20.useEffect)(() => {
3085
3531
  const el = ref.current;
3086
3532
  if (!el) return void 0;
3087
3533
  measure();
@@ -3095,8 +3541,8 @@ function Carousel(props) {
3095
3541
  if (!el) return;
3096
3542
  el.scrollBy({ left: dir * (step || Math.round(el.clientWidth * 0.9)), behavior: "smooth" });
3097
3543
  };
3098
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: ["uic-carousel-wrap", classNames.root || ""].filter(Boolean).join(" "), children: [
3099
- edges.overflow ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3544
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: ["uic-carousel-wrap", classNames.root || ""].filter(Boolean).join(" "), children: [
3545
+ edges.overflow ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3100
3546
  "button",
3101
3547
  {
3102
3548
  type: "button",
@@ -3104,10 +3550,10 @@ function Carousel(props) {
3104
3550
  onClick: () => scroll(-1),
3105
3551
  disabled: edges.start,
3106
3552
  "aria-label": `Scroll ${label} left`,
3107
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Chevron, { dir: "left" })
3553
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Chevron, { dir: "left" })
3108
3554
  }
3109
3555
  ) : null,
3110
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3556
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3111
3557
  "div",
3112
3558
  {
3113
3559
  className: ["uic-carousel", classNames.viewport || ""].filter(Boolean).join(" "),
@@ -3118,7 +3564,7 @@ function Carousel(props) {
3118
3564
  children
3119
3565
  }
3120
3566
  ),
3121
- edges.overflow ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3567
+ edges.overflow ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3122
3568
  "button",
3123
3569
  {
3124
3570
  type: "button",
@@ -3126,42 +3572,42 @@ function Carousel(props) {
3126
3572
  onClick: () => scroll(1),
3127
3573
  disabled: edges.end,
3128
3574
  "aria-label": `Scroll ${label} right`,
3129
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Chevron, { dir: "right" })
3575
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Chevron, { dir: "right" })
3130
3576
  }
3131
3577
  ) : null
3132
3578
  ] });
3133
3579
  }
3134
3580
 
3135
3581
  // src/components/Card.jsx
3136
- var import_react17 = __toESM(require("react"), 1);
3137
- var import_jsx_runtime15 = require("react/jsx-runtime");
3582
+ var import_react21 = __toESM(require("react"), 1);
3583
+ var import_jsx_runtime19 = require("react/jsx-runtime");
3138
3584
  function Card(props) {
3139
- const { art, title, subtitle, onClick, selected = false, overlay, actions, classNames = {} } = props;
3140
- const foot = /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "uic-card-foot", children: [
3141
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "uic-card-name", children: title }),
3142
- subtitle ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "uic-card-sub", children: subtitle }) : null
3585
+ const { art, title, subtitle: subtitle2, onClick, selected = false, overlay, actions, classNames = {} } = props;
3586
+ const foot = /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "uic-card-foot", children: [
3587
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "uic-card-name", children: title }),
3588
+ subtitle2 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "uic-card-sub", children: subtitle2 }) : null
3143
3589
  ] });
3144
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: ["uic-card", selected ? "is-selected" : "", classNames.root || ""].filter(Boolean).join(" "), children: [
3145
- onClick ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("button", { type: "button", className: "uic-card-main", onClick, "aria-pressed": selected || void 0, children: [
3146
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "uic-card-art", children: art }),
3590
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: ["uic-card", selected ? "is-selected" : "", classNames.root || ""].filter(Boolean).join(" "), children: [
3591
+ onClick ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("button", { type: "button", className: "uic-card-main", onClick, "aria-pressed": selected || void 0, children: [
3592
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "uic-card-art", children: art }),
3147
3593
  foot
3148
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "uic-card-main", children: [
3149
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "uic-card-art", children: art }),
3594
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "uic-card-main", children: [
3595
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "uic-card-art", children: art }),
3150
3596
  foot
3151
3597
  ] }),
3152
- overlay ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "uic-card-overlay", children: overlay }) : null,
3153
- actions ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "uic-card-actions", children: actions }) : null
3598
+ overlay ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "uic-card-overlay", children: overlay }) : null,
3599
+ actions ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "uic-card-actions", children: actions }) : null
3154
3600
  ] });
3155
3601
  }
3156
3602
 
3157
3603
  // src/components/SearchField.jsx
3158
- var import_react18 = __toESM(require("react"), 1);
3159
- var import_jsx_runtime16 = require("react/jsx-runtime");
3604
+ var import_react22 = __toESM(require("react"), 1);
3605
+ var import_jsx_runtime20 = require("react/jsx-runtime");
3160
3606
  function SearchField(props) {
3161
3607
  const { value, onChange, placeholder, clearLabel = "Clear search", className } = props;
3162
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: ["uic-search", className || ""].filter(Boolean).join(" "), children: [
3163
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "uic-search-ic", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(IcSearch, {}) }),
3164
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3608
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: ["uic-search", className || ""].filter(Boolean).join(" "), children: [
3609
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "uic-search-ic", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(IcSearch, {}) }),
3610
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3165
3611
  "input",
3166
3612
  {
3167
3613
  type: "search",
@@ -3171,14 +3617,14 @@ function SearchField(props) {
3171
3617
  onChange: (e) => onChange(e.target.value)
3172
3618
  }
3173
3619
  ),
3174
- value ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: "uic-search-x", "aria-label": clearLabel, onClick: () => onChange(""), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(IcX, { size: 12 }) }) : null
3620
+ value ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: "uic-search-x", "aria-label": clearLabel, onClick: () => onChange(""), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(IcX, { size: 12 }) }) : null
3175
3621
  ] });
3176
3622
  }
3177
3623
 
3178
3624
  // src/components/Popover.jsx
3179
- var import_react19 = __toESM(require("react"), 1);
3625
+ var import_react23 = __toESM(require("react"), 1);
3180
3626
  var import_react_dom3 = require("react-dom");
3181
- var import_jsx_runtime17 = require("react/jsx-runtime");
3627
+ var import_jsx_runtime21 = require("react/jsx-runtime");
3182
3628
  var GAP = 6;
3183
3629
  var MARGIN = 8;
3184
3630
  function Popover(props) {
@@ -3193,9 +3639,9 @@ function Popover(props) {
3193
3639
  className,
3194
3640
  label
3195
3641
  } = props;
3196
- const popRef = (0, import_react19.useRef)(null);
3197
- const [pos, setPos] = (0, import_react19.useState)(null);
3198
- (0, import_react19.useEffect)(() => {
3642
+ const popRef = (0, import_react23.useRef)(null);
3643
+ const [pos, setPos] = (0, import_react23.useState)(null);
3644
+ (0, import_react23.useEffect)(() => {
3199
3645
  if (!open) {
3200
3646
  setPos(null);
3201
3647
  return void 0;
@@ -3222,7 +3668,7 @@ function Popover(props) {
3222
3668
  window.removeEventListener("scroll", place, true);
3223
3669
  };
3224
3670
  }, [open, anchorRef, width, minHeight, placement]);
3225
- (0, import_react19.useEffect)(() => {
3671
+ (0, import_react23.useEffect)(() => {
3226
3672
  if (!open) return void 0;
3227
3673
  const onDown = (e) => {
3228
3674
  if (popRef.current?.contains(e.target)) return;
@@ -3232,11 +3678,11 @@ function Popover(props) {
3232
3678
  document.addEventListener("pointerdown", onDown);
3233
3679
  return () => document.removeEventListener("pointerdown", onDown);
3234
3680
  }, [open, anchorRef, onClose]);
3235
- const escape = (0, import_react19.useCallback)(() => onClose?.(), [onClose]);
3681
+ const escape = (0, import_react23.useCallback)(() => onClose?.(), [onClose]);
3236
3682
  useOverlayEscape(open, escape);
3237
3683
  if (!open || !pos || typeof document === "undefined") return null;
3238
3684
  return (0, import_react_dom3.createPortal)(
3239
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3685
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3240
3686
  "div",
3241
3687
  {
3242
3688
  ref: popRef,
@@ -3252,9 +3698,9 @@ function Popover(props) {
3252
3698
  }
3253
3699
 
3254
3700
  // src/components/Modal.jsx
3255
- var import_react20 = __toESM(require("react"), 1);
3701
+ var import_react24 = __toESM(require("react"), 1);
3256
3702
  var import_react_dom4 = require("react-dom");
3257
- var import_jsx_runtime18 = require("react/jsx-runtime");
3703
+ var import_jsx_runtime22 = require("react/jsx-runtime");
3258
3704
  function Modal(props) {
3259
3705
  const {
3260
3706
  open,
@@ -3268,10 +3714,10 @@ function Modal(props) {
3268
3714
  children,
3269
3715
  classNames = {}
3270
3716
  } = props;
3271
- const titleId = (0, import_react20.useId)();
3272
- const escape = (0, import_react20.useCallback)(() => onClose?.(), [onClose]);
3717
+ const titleId = (0, import_react24.useId)();
3718
+ const escape = (0, import_react24.useCallback)(() => onClose?.(), [onClose]);
3273
3719
  useOverlayEscape(open, escape);
3274
- (0, import_react20.useEffect)(() => {
3720
+ (0, import_react24.useEffect)(() => {
3275
3721
  if (!open || typeof document === "undefined") return void 0;
3276
3722
  const prev = document.body.style.overflow;
3277
3723
  document.body.style.overflow = "hidden";
@@ -3284,12 +3730,12 @@ function Modal(props) {
3284
3730
  if (e.target === e.currentTarget) onClose?.();
3285
3731
  };
3286
3732
  return (0, import_react_dom4.createPortal)(
3287
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3733
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3288
3734
  "div",
3289
3735
  {
3290
3736
  className: ["uic-modal-backdrop", classNames.backdrop || ""].filter(Boolean).join(" "),
3291
3737
  onMouseDown: onBackdrop,
3292
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3738
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
3293
3739
  "div",
3294
3740
  {
3295
3741
  className: ["uic-modal", `is-${size}`, classNames.root || ""].filter(Boolean).join(" "),
@@ -3298,15 +3744,15 @@ function Modal(props) {
3298
3744
  "aria-modal": "true",
3299
3745
  "aria-labelledby": labelledBy || (title ? titleId : void 0),
3300
3746
  children: [
3301
- title || actions ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "uic-modal-h", children: [
3302
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "uic-modal-title", children: [
3303
- title ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h3", { id: titleId, children: title }) : null,
3304
- description ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { children: description }) : null
3747
+ title || actions ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "uic-modal-h", children: [
3748
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "uic-modal-title", children: [
3749
+ title ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h3", { id: titleId, children: title }) : null,
3750
+ description ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { children: description }) : null
3305
3751
  ] }),
3306
3752
  actions,
3307
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: "uic-modal-x", "aria-label": "Close", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(IcX, { size: 18 }) })
3753
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: "uic-modal-x", "aria-label": "Close", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(IcX, { size: 18 }) })
3308
3754
  ] }) : null,
3309
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: ["uic-modal-b", classNames.body || ""].filter(Boolean).join(" "), children })
3755
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: ["uic-modal-b", classNames.body || ""].filter(Boolean).join(" "), children })
3310
3756
  ]
3311
3757
  }
3312
3758
  )
@@ -3317,15 +3763,15 @@ function Modal(props) {
3317
3763
  }
3318
3764
 
3319
3765
  // src/hooks/useTypewriter.js
3320
- var import_react21 = require("react");
3766
+ var import_react25 = require("react");
3321
3767
  var CHAR_MS = 26;
3322
3768
  var HOLD_MS = 2600;
3323
3769
  function useTypewriter(phrases, { active = true } = {}) {
3324
3770
  const list = phrases && phrases.length ? phrases : [""];
3325
- const [text, setText] = (0, import_react21.useState)(list[0]);
3326
- const listRef = (0, import_react21.useRef)(list);
3771
+ const [text, setText] = (0, import_react25.useState)(list[0]);
3772
+ const listRef = (0, import_react25.useRef)(list);
3327
3773
  listRef.current = list;
3328
- (0, import_react21.useEffect)(() => {
3774
+ (0, import_react25.useEffect)(() => {
3329
3775
  if (!active) return void 0;
3330
3776
  if (typeof window === "undefined") return void 0;
3331
3777
  if (window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches) {