reifyui 0.6.2 → 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 ",
@@ -2824,29 +2845,22 @@ function SheetGrid({
2824
2845
  )
2825
2846
  ] }),
2826
2847
  peer && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "shg-peer-flag", style: { background: peer.color }, children: peer.name }),
2827
- isEditing ? renderEditor(col) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2828
- "div",
2829
- {
2830
- className: "shg-val",
2831
- style: { maxWidth: colWidth(col) ? colWidth(col) - 20 : 400 },
2832
- children: custom !== void 0 ? custom : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
2833
- computed && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(StatusDot, { status: c.status }),
2834
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CellValue, { cell: c, col, fetchBlobUrl, onOpenResource }),
2835
- computed && !readOnly && onRunCell && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2836
- "button",
2837
- {
2838
- className: "shg-runcell",
2839
- title: "Run this cell",
2840
- onClick: (e) => {
2841
- e.stopPropagation();
2842
- onRunCell(row.id, col.id);
2843
- },
2844
- children: "\u25B6"
2845
- }
2846
- )
2847
- ] })
2848
- }
2849
- )
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
+ ] }) })
2850
2864
  ]
2851
2865
  },
2852
2866
  col.id
@@ -3091,15 +3105,419 @@ function sheetToAoA(sheet, { cellText = defaultCellValue } = {}) {
3091
3105
  ];
3092
3106
  }
3093
3107
 
3094
- // src/components/Carousel.jsx
3095
- var import_react16 = __toESM(require("react"), 1);
3108
+ // src/components/FileTypeIcon.jsx
3109
+ var import_react16 = require("react");
3096
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");
3097
3515
  var EDGE = 2;
3098
3516
  function Carousel(props) {
3099
3517
  const { label, step, children, classNames = {} } = props;
3100
- const ref = (0, import_react16.useRef)(null);
3101
- const [edges, setEdges] = (0, import_react16.useState)({ start: true, end: true, overflow: false });
3102
- 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)(() => {
3103
3521
  const el = ref.current;
3104
3522
  if (!el) return;
3105
3523
  const overflow = el.scrollWidth - el.clientWidth > EDGE;
@@ -3109,7 +3527,7 @@ function Carousel(props) {
3109
3527
  end: el.scrollLeft >= el.scrollWidth - el.clientWidth - EDGE
3110
3528
  });
3111
3529
  }, []);
3112
- (0, import_react16.useEffect)(() => {
3530
+ (0, import_react20.useEffect)(() => {
3113
3531
  const el = ref.current;
3114
3532
  if (!el) return void 0;
3115
3533
  measure();
@@ -3123,8 +3541,8 @@ function Carousel(props) {
3123
3541
  if (!el) return;
3124
3542
  el.scrollBy({ left: dir * (step || Math.round(el.clientWidth * 0.9)), behavior: "smooth" });
3125
3543
  };
3126
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: ["uic-carousel-wrap", classNames.root || ""].filter(Boolean).join(" "), children: [
3127
- 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)(
3128
3546
  "button",
3129
3547
  {
3130
3548
  type: "button",
@@ -3132,10 +3550,10 @@ function Carousel(props) {
3132
3550
  onClick: () => scroll(-1),
3133
3551
  disabled: edges.start,
3134
3552
  "aria-label": `Scroll ${label} left`,
3135
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Chevron, { dir: "left" })
3553
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Chevron, { dir: "left" })
3136
3554
  }
3137
3555
  ) : null,
3138
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3556
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3139
3557
  "div",
3140
3558
  {
3141
3559
  className: ["uic-carousel", classNames.viewport || ""].filter(Boolean).join(" "),
@@ -3146,7 +3564,7 @@ function Carousel(props) {
3146
3564
  children
3147
3565
  }
3148
3566
  ),
3149
- edges.overflow ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3567
+ edges.overflow ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3150
3568
  "button",
3151
3569
  {
3152
3570
  type: "button",
@@ -3154,42 +3572,42 @@ function Carousel(props) {
3154
3572
  onClick: () => scroll(1),
3155
3573
  disabled: edges.end,
3156
3574
  "aria-label": `Scroll ${label} right`,
3157
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Chevron, { dir: "right" })
3575
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Chevron, { dir: "right" })
3158
3576
  }
3159
3577
  ) : null
3160
3578
  ] });
3161
3579
  }
3162
3580
 
3163
3581
  // src/components/Card.jsx
3164
- var import_react17 = __toESM(require("react"), 1);
3165
- 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");
3166
3584
  function Card(props) {
3167
- const { art, title, subtitle, onClick, selected = false, overlay, actions, classNames = {} } = props;
3168
- const foot = /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "uic-card-foot", children: [
3169
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "uic-card-name", children: title }),
3170
- 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
3171
3589
  ] });
3172
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: ["uic-card", selected ? "is-selected" : "", classNames.root || ""].filter(Boolean).join(" "), children: [
3173
- onClick ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("button", { type: "button", className: "uic-card-main", onClick, "aria-pressed": selected || void 0, children: [
3174
- /* @__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 }),
3175
3593
  foot
3176
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "uic-card-main", children: [
3177
- /* @__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 }),
3178
3596
  foot
3179
3597
  ] }),
3180
- overlay ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "uic-card-overlay", children: overlay }) : null,
3181
- 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
3182
3600
  ] });
3183
3601
  }
3184
3602
 
3185
3603
  // src/components/SearchField.jsx
3186
- var import_react18 = __toESM(require("react"), 1);
3187
- 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");
3188
3606
  function SearchField(props) {
3189
3607
  const { value, onChange, placeholder, clearLabel = "Clear search", className } = props;
3190
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: ["uic-search", className || ""].filter(Boolean).join(" "), children: [
3191
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "uic-search-ic", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(IcSearch, {}) }),
3192
- /* @__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)(
3193
3611
  "input",
3194
3612
  {
3195
3613
  type: "search",
@@ -3199,14 +3617,14 @@ function SearchField(props) {
3199
3617
  onChange: (e) => onChange(e.target.value)
3200
3618
  }
3201
3619
  ),
3202
- 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
3203
3621
  ] });
3204
3622
  }
3205
3623
 
3206
3624
  // src/components/Popover.jsx
3207
- var import_react19 = __toESM(require("react"), 1);
3625
+ var import_react23 = __toESM(require("react"), 1);
3208
3626
  var import_react_dom3 = require("react-dom");
3209
- var import_jsx_runtime17 = require("react/jsx-runtime");
3627
+ var import_jsx_runtime21 = require("react/jsx-runtime");
3210
3628
  var GAP = 6;
3211
3629
  var MARGIN = 8;
3212
3630
  function Popover(props) {
@@ -3221,9 +3639,9 @@ function Popover(props) {
3221
3639
  className,
3222
3640
  label
3223
3641
  } = props;
3224
- const popRef = (0, import_react19.useRef)(null);
3225
- const [pos, setPos] = (0, import_react19.useState)(null);
3226
- (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)(() => {
3227
3645
  if (!open) {
3228
3646
  setPos(null);
3229
3647
  return void 0;
@@ -3250,7 +3668,7 @@ function Popover(props) {
3250
3668
  window.removeEventListener("scroll", place, true);
3251
3669
  };
3252
3670
  }, [open, anchorRef, width, minHeight, placement]);
3253
- (0, import_react19.useEffect)(() => {
3671
+ (0, import_react23.useEffect)(() => {
3254
3672
  if (!open) return void 0;
3255
3673
  const onDown = (e) => {
3256
3674
  if (popRef.current?.contains(e.target)) return;
@@ -3260,11 +3678,11 @@ function Popover(props) {
3260
3678
  document.addEventListener("pointerdown", onDown);
3261
3679
  return () => document.removeEventListener("pointerdown", onDown);
3262
3680
  }, [open, anchorRef, onClose]);
3263
- const escape = (0, import_react19.useCallback)(() => onClose?.(), [onClose]);
3681
+ const escape = (0, import_react23.useCallback)(() => onClose?.(), [onClose]);
3264
3682
  useOverlayEscape(open, escape);
3265
3683
  if (!open || !pos || typeof document === "undefined") return null;
3266
3684
  return (0, import_react_dom3.createPortal)(
3267
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3685
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3268
3686
  "div",
3269
3687
  {
3270
3688
  ref: popRef,
@@ -3280,9 +3698,9 @@ function Popover(props) {
3280
3698
  }
3281
3699
 
3282
3700
  // src/components/Modal.jsx
3283
- var import_react20 = __toESM(require("react"), 1);
3701
+ var import_react24 = __toESM(require("react"), 1);
3284
3702
  var import_react_dom4 = require("react-dom");
3285
- var import_jsx_runtime18 = require("react/jsx-runtime");
3703
+ var import_jsx_runtime22 = require("react/jsx-runtime");
3286
3704
  function Modal(props) {
3287
3705
  const {
3288
3706
  open,
@@ -3296,10 +3714,10 @@ function Modal(props) {
3296
3714
  children,
3297
3715
  classNames = {}
3298
3716
  } = props;
3299
- const titleId = (0, import_react20.useId)();
3300
- const escape = (0, import_react20.useCallback)(() => onClose?.(), [onClose]);
3717
+ const titleId = (0, import_react24.useId)();
3718
+ const escape = (0, import_react24.useCallback)(() => onClose?.(), [onClose]);
3301
3719
  useOverlayEscape(open, escape);
3302
- (0, import_react20.useEffect)(() => {
3720
+ (0, import_react24.useEffect)(() => {
3303
3721
  if (!open || typeof document === "undefined") return void 0;
3304
3722
  const prev = document.body.style.overflow;
3305
3723
  document.body.style.overflow = "hidden";
@@ -3312,12 +3730,12 @@ function Modal(props) {
3312
3730
  if (e.target === e.currentTarget) onClose?.();
3313
3731
  };
3314
3732
  return (0, import_react_dom4.createPortal)(
3315
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3733
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3316
3734
  "div",
3317
3735
  {
3318
3736
  className: ["uic-modal-backdrop", classNames.backdrop || ""].filter(Boolean).join(" "),
3319
3737
  onMouseDown: onBackdrop,
3320
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3738
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
3321
3739
  "div",
3322
3740
  {
3323
3741
  className: ["uic-modal", `is-${size}`, classNames.root || ""].filter(Boolean).join(" "),
@@ -3326,15 +3744,15 @@ function Modal(props) {
3326
3744
  "aria-modal": "true",
3327
3745
  "aria-labelledby": labelledBy || (title ? titleId : void 0),
3328
3746
  children: [
3329
- title || actions ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "uic-modal-h", children: [
3330
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "uic-modal-title", children: [
3331
- title ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h3", { id: titleId, children: title }) : null,
3332
- 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
3333
3751
  ] }),
3334
3752
  actions,
3335
- /* @__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 }) })
3336
3754
  ] }) : null,
3337
- /* @__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 })
3338
3756
  ]
3339
3757
  }
3340
3758
  )
@@ -3345,15 +3763,15 @@ function Modal(props) {
3345
3763
  }
3346
3764
 
3347
3765
  // src/hooks/useTypewriter.js
3348
- var import_react21 = require("react");
3766
+ var import_react25 = require("react");
3349
3767
  var CHAR_MS = 26;
3350
3768
  var HOLD_MS = 2600;
3351
3769
  function useTypewriter(phrases, { active = true } = {}) {
3352
3770
  const list = phrases && phrases.length ? phrases : [""];
3353
- const [text, setText] = (0, import_react21.useState)(list[0]);
3354
- 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);
3355
3773
  listRef.current = list;
3356
- (0, import_react21.useEffect)(() => {
3774
+ (0, import_react25.useEffect)(() => {
3357
3775
  if (!active) return void 0;
3358
3776
  if (typeof window === "undefined") return void 0;
3359
3777
  if (window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches) {