@w100n/documents 0.12.1 → 0.14.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.
Files changed (52) hide show
  1. package/dist/{SheetView-3XTEV2VT.css → SheetView-43MPR64N.css} +5 -4
  2. package/dist/{SheetView-3XTEV2VT.css.map → SheetView-43MPR64N.css.map} +1 -1
  3. package/dist/{SheetView-G3YWPH5V.js → SheetView-4TPL7DES.js} +51 -10
  4. package/dist/SheetView-4TPL7DES.js.map +1 -0
  5. package/dist/{TextEditor-SPEVB5HX.js → TextEditor-VBHWUOZR.js} +636 -225
  6. package/dist/TextEditor-VBHWUOZR.js.map +1 -0
  7. package/dist/{chunk-L765DZPO.js → chunk-2CA3HQTI.js} +3 -3
  8. package/dist/{chunk-L765DZPO.js.map → chunk-2CA3HQTI.js.map} +1 -1
  9. package/dist/{chunk-UWASFTDF.js → chunk-5MH4WDW4.js} +133 -20
  10. package/dist/chunk-5MH4WDW4.js.map +1 -0
  11. package/dist/{chunk-BKUFGMEA.js → chunk-DR3TTJWZ.js} +410 -29
  12. package/dist/chunk-DR3TTJWZ.js.map +1 -0
  13. package/dist/{chunk-5NT5ALOF.js → chunk-RCQODE2Z.js} +2 -2
  14. package/dist/collab.cjs +523 -46
  15. package/dist/collab.cjs.map +1 -1
  16. package/dist/collab.d.cts +2 -2
  17. package/dist/collab.d.ts +2 -2
  18. package/dist/collab.js +2 -2
  19. package/dist/{grid-EI5JNZAA.js → grid-Q4XBPQFY.js} +3 -3
  20. package/dist/grid-Q4XBPQFY.js.map +1 -0
  21. package/dist/index.cjs +2271 -882
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.css +1037 -189
  24. package/dist/index.css.map +1 -1
  25. package/dist/index.d.cts +9 -4
  26. package/dist/index.d.ts +9 -4
  27. package/dist/index.js +804 -336
  28. package/dist/index.js.map +1 -1
  29. package/dist/kinds.cjs +2 -2
  30. package/dist/kinds.cjs.map +1 -1
  31. package/dist/kinds.d.cts +2 -2
  32. package/dist/kinds.d.ts +2 -2
  33. package/dist/kinds.js +1 -1
  34. package/dist/memory.cjs +12 -1
  35. package/dist/memory.cjs.map +1 -1
  36. package/dist/memory.d.cts +1 -1
  37. package/dist/memory.d.ts +1 -1
  38. package/dist/memory.js +13 -2
  39. package/dist/memory.js.map +1 -1
  40. package/dist/{types-B5oF25dn.d.ts → types-BTsVooZw.d.cts} +8 -1
  41. package/dist/{types-B5oF25dn.d.cts → types-BTsVooZw.d.ts} +8 -1
  42. package/dist/write-BCI8yool.d.cts +16 -0
  43. package/dist/write-BCI8yool.d.ts +16 -0
  44. package/package.json +1 -1
  45. package/dist/SheetView-G3YWPH5V.js.map +0 -1
  46. package/dist/TextEditor-SPEVB5HX.js.map +0 -1
  47. package/dist/chunk-BKUFGMEA.js.map +0 -1
  48. package/dist/chunk-UWASFTDF.js.map +0 -1
  49. package/dist/grid-EI5JNZAA.js.map +0 -1
  50. package/dist/write-DaVtTJCS.d.cts +0 -6
  51. package/dist/write-DaVtTJCS.d.ts +0 -6
  52. /package/dist/{chunk-5NT5ALOF.js.map → chunk-RCQODE2Z.js.map} +0 -0
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  kinds,
5
5
  matches,
6
6
  readable
7
- } from "./chunk-L765DZPO.js";
7
+ } from "./chunk-2CA3HQTI.js";
8
8
  import {
9
9
  useLoad
10
10
  } from "./chunk-QDH7EZAF.js";
@@ -13,10 +13,11 @@ import {
13
13
  useRestore
14
14
  } from "./chunk-TDP6OJET.js";
15
15
  import {
16
+ escape,
16
17
  readDocx,
17
18
  texts,
18
19
  writeDocx
19
- } from "./chunk-BKUFGMEA.js";
20
+ } from "./chunk-DR3TTJWZ.js";
20
21
 
21
22
  // src/DocumentOverlay.tsx
22
23
  import { Download, ExternalLink, FileSpreadsheet, FileText, FileType, Files, Presentation, X as X4 } from "lucide-react";
@@ -345,10 +346,10 @@ var blocksOf = (el, html, notes) => {
345
346
  var notesOf = (el) => elements(el).find((e) => e.tag === "aside" && classes(e).includes("notes")) ?? null;
346
347
  var toText = (src) => decode(src.replace(/<!--[\s\S]*?-->/g, "").replace(/\s+/g, " ").replace(/<br\s*\/?>/gi, "\n").replace(/<\/(p|div|li|h[1-6]|blockquote|pre|tr)>/gi, "\n").replace(/<[^>]*>/g, "")).split("\n").map((line) => line.trim()).join("\n").replace(/\n{3,}/g, "\n\n").trim();
347
348
  var titled = (src) => toText(src).replace(/\s+/g, " ").slice(0, 80);
348
- var escape = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
349
- var quote = (s) => escape(s).replace(/"/g, "&quot;");
350
- var notesHtml = (text) => escape(text).split("\n").join("<br>\n");
351
- var sizeOf = (html, kind, scripts, styles, marks) => {
349
+ var escape2 = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
350
+ var quote = (s) => escape2(s).replace(/"/g, "&quot;");
351
+ var notesHtml = (text) => escape2(text).split("\n").join("<br>\n");
352
+ var sizeOf = (html, kind, scripts, styles2, marks) => {
352
353
  if (kind === "reveal") {
353
354
  const code = scripts.map((s) => html.slice(s.open, s.close)).join("\n");
354
355
  const at = code.search(/Reveal\.initialize\s*\(/);
@@ -362,7 +363,7 @@ var sizeOf = (html, kind, scripts, styles, marks) => {
362
363
  const height = Number(el.attrs.get("data-height")?.value);
363
364
  if (width > 0 && height > 0) return { width, height, center: false };
364
365
  }
365
- const css2 = styles.map((s) => html.slice(s.open, s.close)).join("\n").replace(/\/\*[\s\S]*?\*\//g, "");
366
+ const css2 = styles2.map((s) => html.slice(s.open, s.close)).join("\n").replace(/\/\*[\s\S]*?\*\//g, "");
366
367
  const target = kind === "marked" ? /(^|[\s>])\[data-slide[^\]]*\](\.[\w-]+)*$/ : /(^|[\s>])(section|\.slide)(\.[\w-]+)*$/;
367
368
  for (const rule of css2.matchAll(/([^{}]+)\{([^{}]*)\}/g)) {
368
369
  if (!rule[1].split(",").some((sel) => target.test(sel.trim()))) continue;
@@ -376,13 +377,13 @@ function shape(html) {
376
377
  const root = parse(html);
377
378
  const all = elements(root);
378
379
  const scripts = all.filter((el) => el.tag === "script");
379
- const styles = all.filter((el) => el.tag === "style");
380
+ const styles2 = all.filter((el) => el.tag === "style");
380
381
  const refresh = all.filter((el) => el.tag === "meta" && el.attrs.get("http-equiv")?.value.toLowerCase() === "refresh");
381
- const head = all.find((el) => el.tag === "head");
382
+ const head2 = all.find((el) => el.tag === "head");
382
383
  const outer = all.find((el) => el.tag === "html");
383
384
  const body = all.find((el) => el.tag === "body") ?? null;
384
385
  const doctype = /^\s*<!doctype[^>]*>/i.exec(html);
385
- const at = head ? head.open : outer ? outer.open : doctype ? doctype[0].length : 0;
386
+ const at = head2 ? head2.open : outer ? outer.open : doctype ? doctype[0].length : 0;
386
387
  const reveal = all.find((el) => classes(el).includes("reveal")) ?? null;
387
388
  const box = reveal && all.find((el) => classes(el).includes("slides") && under(el, (up) => up === reveal));
388
389
  const spots = [];
@@ -422,14 +423,14 @@ function shape(html) {
422
423
  }
423
424
  for (const unit of units) spot2(unit, null);
424
425
  }
425
- const size = sizeOf(html, kind, scripts, styles, [container, ...body ? [body] : [], ...outer ? [outer] : []]);
426
+ const size = sizeOf(html, kind, scripts, styles2, [container, ...body ? [body] : [], ...outer ? [outer] : []]);
426
427
  return { kind, ...size, root, box: container, units, stacks, spots, scripts, refresh, head: at, body };
427
428
  }
428
429
  var titleOf = (html, s) => {
429
430
  const heading = elements(s.el).find((el2) => /^h[1-6]$/.test(el2.tag) && !(s.notes && under(el2, (up) => up === s.notes)));
430
431
  const el = heading ?? s.blocks[0];
431
- const head = el ? s.blocks.indexOf(el) : -1;
432
- return { title: el ? titled(html.slice(el.open, el.close)) : "", head: head < 0 ? null : head };
432
+ const head2 = el ? s.blocks.indexOf(el) : -1;
433
+ return { title: el ? titled(html.slice(el.open, el.close)) : "", head: head2 < 0 ? null : head2 };
433
434
  };
434
435
  var notesText = (html, s) => s.notes ? toText(html.slice(s.notes.open, s.notes.close)) : s.attr ? s.attr.value.trim() : "";
435
436
  function readDeck(html, known) {
@@ -486,9 +487,9 @@ function apply(html, from, to, list) {
486
487
  }
487
488
  var blank = (s) => !/\S/.test(s);
488
489
  var join = (html, box, els, parts) => {
489
- const head = html.slice(box.open, els[0].start);
490
+ const head2 = html.slice(box.open, els[0].start);
490
491
  const pre = els.map((el, i) => i ? html.slice(els[i - 1].end, el.start) : "");
491
- const fill = pre.find((gap, i) => i && blank(gap)) ?? (/\s*$/.exec(head)[0] || "\n");
492
+ const fill = pre.find((gap, i) => i && blank(gap)) ?? (/\s*$/.exec(head2)[0] || "\n");
492
493
  const used = /* @__PURE__ */ new Set();
493
494
  const body = parts.map(([from, part], k) => {
494
495
  const first = !used.has(from);
@@ -497,7 +498,7 @@ var join = (html, box, els, parts) => {
497
498
  return (first && !blank(pre[from]) ? pre[from].trimStart() : "") + part;
498
499
  });
499
500
  const lost = pre.filter((gap, i) => !used.has(i) && !blank(gap)).map((gap) => gap.trimEnd());
500
- return head + body.join("") + lost.join("") + html.slice(els[els.length - 1].end, box.close);
501
+ return head2 + body.join("") + lost.join("") + html.slice(els[els.length - 1].end, box.close);
501
502
  };
502
503
  function writeDeck(original, deck, known) {
503
504
  const s = known ?? shape(original);
@@ -527,8 +528,8 @@ function moveSlide(deck, from, to) {
527
528
  const slide = deck.slides[from];
528
529
  const rest = deck.slides.filter((_, i) => i !== from);
529
530
  let at = Math.max(0, Math.min(rest.length, to));
530
- const run = rest.flatMap((other, i) => slide.stack !== null && other.stack === slide.stack ? [i] : []);
531
- if (run.length) at = Math.max(run[0], Math.min(run[run.length - 1] + 1, at));
531
+ const run2 = rest.flatMap((other, i) => slide.stack !== null && other.stack === slide.stack ? [i] : []);
532
+ if (run2.length) at = Math.max(run2[0], Math.min(run2[run2.length - 1] + 1, at));
532
533
  else if (at > 0 && at < rest.length && rest[at].stack !== null && rest[at - 1].stack === rest[at].stack) {
533
534
  let end = at;
534
535
  while (end < rest.length && rest[end].stack === rest[at].stack) end++;
@@ -1118,7 +1119,7 @@ function SlidesView({ html, name, rights, language = "en", theme = "light", base
1118
1119
  popup.close();
1119
1120
  };
1120
1121
  }, [popup]);
1121
- const tool = (Icon, text, run, disabled = false) => /* @__PURE__ */ jsx("button", { type: "button", "aria-label": text, title: text, disabled, onClick: run, children: /* @__PURE__ */ jsx(Icon, { "aria-hidden": true }) });
1122
+ const tool = (Icon, text, run2, disabled = false) => /* @__PURE__ */ jsx("button", { type: "button", "aria-label": text, title: text, disabled, onClick: run2, children: /* @__PURE__ */ jsx(Icon, { "aria-hidden": true }) });
1122
1123
  const thumb = 148;
1123
1124
  const seconds = Math.floor(Math.max(0, (timer.stop ?? now) - timer.from) / 1e3);
1124
1125
  const elapsed = `${seconds >= 3600 ? `${Math.floor(seconds / 3600)}:` : ""}${String(Math.floor(seconds / 60) % 60).padStart(2, "0")}:${String(seconds % 60).padStart(2, "0")}`;
@@ -2406,8 +2407,8 @@ function PdfView({ bytes, t, language, worker, rights, host, documentId, onSaved
2406
2407
 
2407
2408
  // src/DocumentOverlay.tsx
2408
2409
  import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
2409
- var TextEditor = lazy(() => import("./TextEditor-SPEVB5HX.js"));
2410
- var SheetView = lazy(() => import("./SheetView-G3YWPH5V.js"));
2410
+ var TextEditor = lazy(() => import("./TextEditor-VBHWUOZR.js"));
2411
+ var SheetView = lazy(() => import("./SheetView-4TPL7DES.js"));
2411
2412
  var icons = { docx: FileText, markdown: FileType, pdf: Files, sheet: FileSpreadsheet, slides: Presentation };
2412
2413
  var read = { view: true, comment: false, edit: false };
2413
2414
  var quiet = () => {
@@ -2435,16 +2436,16 @@ function DocumentOverlay({ source, name, mimeType, info, download, actions, onCl
2435
2436
  box.current.focus();
2436
2437
  }, []);
2437
2438
  useEffect4(() => {
2438
- const escape2 = (e) => {
2439
+ const escape3 = (e) => {
2439
2440
  if (e.key !== "Escape") return;
2440
2441
  e.stopPropagation();
2441
2442
  close();
2442
2443
  };
2443
2444
  const overflow = document.body.style.overflow;
2444
2445
  document.body.style.overflow = "hidden";
2445
- window.addEventListener("keydown", escape2, true);
2446
+ window.addEventListener("keydown", escape3, true);
2446
2447
  return () => {
2447
- window.removeEventListener("keydown", escape2, true);
2448
+ window.removeEventListener("keydown", escape3, true);
2448
2449
  document.body.style.overflow = overflow;
2449
2450
  };
2450
2451
  });
@@ -2456,7 +2457,7 @@ function DocumentOverlay({ source, name, mimeType, info, download, actions, onCl
2456
2457
  link.click();
2457
2458
  setTimeout(() => URL.revokeObjectURL(url), 1e3);
2458
2459
  };
2459
- const sheet = readable(name, mimeType) !== "sheet" ? null : /\.csv$/i.test(name) || mimeType === "text/csv" ? "csv" : "xlsx";
2460
+ const sheet2 = readable(name, mimeType) !== "sheet" ? null : /\.csv$/i.test(name) || mimeType === "text/csv" ? "csv" : "xlsx";
2460
2461
  const wait = /* @__PURE__ */ jsx5("div", { className: "w100n-docs-empty", children: t.loading });
2461
2462
  let stage = null;
2462
2463
  if (bytes && !doc.loading) {
@@ -2476,7 +2477,7 @@ function DocumentOverlay({ source, name, mimeType, info, download, actions, onCl
2476
2477
  );
2477
2478
  else if (kind === "docx" || kind === "markdown") stage = /* @__PURE__ */ jsx5(Suspense, { fallback: wait, children: /* @__PURE__ */ jsx5(TextEditor, { kind, bytes, t, language, rights: read, documentId: documentId ?? name, onOutline: quiet, slot: null }) });
2478
2479
  else if (kind === "slides") stage = /* @__PURE__ */ jsx5(SlidesView, { html: new TextDecoder().decode(bytes), name, rights: read, language, theme, onOutline: quiet });
2479
- else if (sheet) stage = /* @__PURE__ */ jsx5(Suspense, { fallback: wait, children: /* @__PURE__ */ jsx5(SheetView, { bytes, name, kind: sheet, rights: read, language, theme, documentId: documentId ?? name }) });
2480
+ else if (sheet2) stage = /* @__PURE__ */ jsx5(Suspense, { fallback: wait, children: /* @__PURE__ */ jsx5(SheetView, { bytes, name, kind: sheet2, rights: read, language, theme, documentId: documentId ?? name }) });
2480
2481
  else stage = /* @__PURE__ */ jsx5("div", { className: "w100n-docs-empty", children: t.unsupported });
2481
2482
  }
2482
2483
  return createPortal2(/* @__PURE__ */ jsxs5("div", { ref: box, className: "w100n-docs w100n-docs-overlay", "data-theme": theme, role: "dialog", "aria-modal": true, "aria-label": name, tabIndex: -1, children: [
@@ -2511,48 +2512,258 @@ function DocumentOverlay({ source, name, mimeType, info, download, actions, onCl
2511
2512
  }
2512
2513
 
2513
2514
  // src/DocumentsWorkspace.tsx
2514
- import { lazy as lazy2, Suspense as Suspense2, useEffect as useEffect6, useLayoutEffect as useLayoutEffect3, useRef as useRef6, useState as useState8 } from "react";
2515
+ import { lazy as lazy2, Suspense as Suspense2, useEffect as useEffect6, useLayoutEffect as useLayoutEffect3, useRef as useRef6, useState as useState9 } from "react";
2515
2516
  import { flushSync } from "react-dom";
2516
2517
  import {
2517
- Check,
2518
+ Bookmark,
2519
+ Check as Check2,
2518
2520
  ChevronDown as ChevronDown2,
2519
2521
  ChevronRight as ChevronRight2,
2520
2522
  FileDown,
2521
- FileSpreadsheet as FileSpreadsheet2,
2522
- FileText as FileText2,
2523
- FileType as FileType2,
2523
+ FilePlus,
2524
+ FileSpreadsheet as FileSpreadsheet3,
2525
+ FileText as FileText3,
2526
+ FileType as FileType3,
2524
2527
  Files as Files2,
2525
2528
  History,
2526
2529
  Info,
2527
2530
  LayoutGrid,
2531
+ ListFilter,
2528
2532
  ListTree,
2529
2533
  MessagesSquare,
2530
2534
  PanelLeftClose,
2531
2535
  PanelLeftOpen,
2532
2536
  PanelRightClose,
2533
2537
  PanelRightOpen,
2534
- Presentation as Presentation2,
2538
+ Plus as Plus4,
2539
+ Presentation as Presentation3,
2535
2540
  RotateCcw as RotateCcw2,
2536
2541
  Search as Search2,
2537
2542
  Share2,
2538
2543
  Signature,
2539
- X as X5
2544
+ Upload,
2545
+ X as X6
2540
2546
  } from "lucide-react";
2541
2547
 
2542
- // src/Sharing.tsx
2543
- import { useState as useState6 } from "react";
2544
- import { Ban, CalendarDays, Clock, Copy as Copy2, Download as Download2, Eye, Link, Lock, MessageSquarePlus, Plus as Plus2, Users } from "lucide-react";
2548
+ // src/NewDocument.tsx
2549
+ import { Check, FileSpreadsheet as FileSpreadsheet2, FileText as FileText2, FileType as FileType2, Plus as Plus2, Presentation as Presentation2, X as X5 } from "lucide-react";
2550
+ import { useId as useId3, useState as useState6 } from "react";
2551
+
2552
+ // src/blank.ts
2553
+ import { strToU8, zipSync } from "fflate";
2554
+ var W = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
2555
+ var REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
2556
+ var PKG = "http://schemas.openxmlformats.org/package/2006/relationships";
2557
+ var head = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n';
2558
+ var mimes = {
2559
+ docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
2560
+ markdown: "text/markdown",
2561
+ sheet: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
2562
+ slides: "text/html"
2563
+ };
2564
+ var extensions = { docx: "docx", markdown: "md", sheet: "xlsx", slides: "html" };
2565
+ var templates = {
2566
+ letter: (name) => [["Title", name], [null, "Web100Now"], [null, ""], [null, "Dear Name,"], [null, "Write the message here."], [null, ""], [null, "Kind regards,"], [null, "Your name"]],
2567
+ contract: (name) => [
2568
+ ["Title", name],
2569
+ [null, "Between Party A and Party B, date"],
2570
+ ["Heading1", "1. Scope of work"],
2571
+ [null, "What is delivered and when."],
2572
+ ["Heading1", "2. Fees and payment"],
2573
+ [null, "Amount, currency and when it is paid."],
2574
+ ["Heading1", "3. Term"],
2575
+ [null, "Start date, length and how either side ends it."],
2576
+ ["Heading1", "4. Signatures"],
2577
+ [["Party A", "Party B"], ["Name, date", "Name, date"]]
2578
+ ],
2579
+ notes: (name) => [
2580
+ ["Title", name],
2581
+ [null, "Date, people"],
2582
+ ["Heading1", "Agenda"],
2583
+ [null, "Topic one"],
2584
+ ["Heading1", "Decisions"],
2585
+ [null, "What was decided"],
2586
+ ["Heading1", "Next steps"],
2587
+ [["Who", "What", "By when"], ["", "", ""]]
2588
+ ],
2589
+ invoice: (name) => [
2590
+ ["Title", name],
2591
+ [null, "Number, date, due date"],
2592
+ [null, "Billed to: client name and address"],
2593
+ [["Item", "Quantity", "Price", "Total"], ["", "", "", ""], ["", "", "Total", ""]],
2594
+ [null, "Bank details and payment terms"]
2595
+ ],
2596
+ report: (name) => [
2597
+ ["Title", name],
2598
+ [null, "Period, author"],
2599
+ ["Heading1", "Summary"],
2600
+ [null, "The main points in a few lines."],
2601
+ ["Heading1", "Results"],
2602
+ [null, "What happened and the numbers behind it."],
2603
+ ["Heading1", "Next"],
2604
+ [null, "What comes next and who owns it."]
2605
+ ]
2606
+ };
2607
+ var run = (text) => text ? `<w:r><w:t xml:space="preserve">${escape(text)}</w:t></w:r>` : "";
2608
+ var para = ([style, text]) => `<w:p>${style ? `<w:pPr><w:pStyle w:val="${style}"/></w:pPr>` : ""}${run(text)}</w:p>`;
2609
+ var table = (rows) => {
2610
+ const width = Math.floor(9638 / rows[0].length);
2611
+ const border = (side) => `<w:${side} w:val="single" w:sz="4" w:space="0" w:color="94A3B8"/>`;
2612
+ return `<w:tbl><w:tblPr><w:tblW w:w="5000" w:type="pct"/><w:tblBorders>${["top", "left", "bottom", "right", "insideH", "insideV"].map(border).join("")}</w:tblBorders></w:tblPr><w:tblGrid>${rows[0].map(() => `<w:gridCol w:w="${width}"/>`).join("")}</w:tblGrid>` + rows.map((row, r) => `<w:tr>${row.map((cell) => `<w:tc><w:tcPr><w:tcW w:w="${width}" w:type="dxa"/></w:tcPr><w:p>${r === 0 ? `<w:r><w:rPr><w:b/></w:rPr><w:t xml:space="preserve">${escape(cell)}</w:t></w:r>` : run(cell)}</w:p></w:tc>`).join("")}</w:tr>`).join("") + "</w:tbl><w:p/>";
2613
+ };
2614
+ var styles = `${head}<w:styles xmlns:w="${W}"><w:docDefaults><w:rPrDefault><w:rPr><w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:eastAsia="Arial" w:cs="Arial"/><w:sz w:val="22"/><w:szCs w:val="22"/></w:rPr></w:rPrDefault><w:pPrDefault><w:pPr><w:spacing w:after="120" w:line="276" w:lineRule="auto"/></w:pPr></w:pPrDefault></w:docDefaults><w:style w:type="paragraph" w:default="1" w:styleId="Normal"><w:name w:val="Normal"/><w:qFormat/></w:style><w:style w:type="paragraph" w:styleId="Title"><w:name w:val="Title"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:qFormat/><w:pPr><w:spacing w:after="80"/></w:pPr><w:rPr><w:b/><w:sz w:val="48"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Heading1"><w:name w:val="heading 1"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:qFormat/><w:pPr><w:keepNext/><w:spacing w:before="360" w:after="120"/><w:outlineLvl w:val="0"/></w:pPr><w:rPr><w:b/><w:sz w:val="32"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Heading2"><w:name w:val="heading 2"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:qFormat/><w:pPr><w:keepNext/><w:spacing w:before="240" w:after="80"/><w:outlineLvl w:val="1"/></w:pPr><w:rPr><w:b/><w:sz w:val="26"/></w:rPr></w:style></w:styles>`;
2615
+ function docx(blocks) {
2616
+ const body = blocks.map((block) => typeof block[0] === "string" || block[0] === null ? para(block) : table(block)).join("") || "<w:p/>";
2617
+ return zipSync({
2618
+ "[Content_Types].xml": strToU8(`${head}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/><Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/></Types>`),
2619
+ "_rels/.rels": strToU8(`${head}<Relationships xmlns="${PKG}"><Relationship Id="rId1" Type="${REL}/officeDocument" Target="word/document.xml"/></Relationships>`),
2620
+ "word/_rels/document.xml.rels": strToU8(`${head}<Relationships xmlns="${PKG}"><Relationship Id="rId1" Type="${REL}/styles" Target="styles.xml"/></Relationships>`),
2621
+ "word/styles.xml": strToU8(styles),
2622
+ "word/document.xml": strToU8(`${head}<w:document xmlns:w="${W}" xmlns:r="${REL}"><w:body>${body}<w:sectPr><w:pgSz w:w="11906" w:h="16838"/><w:pgMar w:top="1417" w:right="1134" w:bottom="1417" w:left="1134" w:header="708" w:footer="708" w:gutter="0"/></w:sectPr></w:body></w:document>`)
2623
+ });
2624
+ }
2625
+ function markdown(blocks) {
2626
+ const line = (block) => {
2627
+ if (typeof block[0] === "string" || block[0] === null) {
2628
+ const [style, text] = block;
2629
+ return style === "Title" ? `# ${text}` : style === "Heading1" ? `## ${text.replace(/^\d+\.\s*/, "")}` : text;
2630
+ }
2631
+ const rows = block;
2632
+ return [rows[0], rows[0].map(() => "---"), ...rows.slice(1)].map((row) => `| ${row.join(" | ")} |`).join("\n");
2633
+ };
2634
+ return strToU8(blocks.map(line).join("\n\n").replace(/\n{3,}/g, "\n\n") + "\n");
2635
+ }
2636
+ var S = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
2637
+ function sheet() {
2638
+ return zipSync({
2639
+ "[Content_Types].xml": strToU8(`${head}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/></Types>`),
2640
+ "_rels/.rels": strToU8(`${head}<Relationships xmlns="${PKG}"><Relationship Id="rId1" Type="${REL}/officeDocument" Target="xl/workbook.xml"/></Relationships>`),
2641
+ "xl/workbook.xml": strToU8(`${head}<workbook xmlns="${S}" xmlns:r="${REL}"><sheets><sheet name="Sheet1" sheetId="1" r:id="rId1"/></sheets></workbook>`),
2642
+ "xl/_rels/workbook.xml.rels": strToU8(`${head}<Relationships xmlns="${PKG}"><Relationship Id="rId1" Type="${REL}/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId2" Type="${REL}/styles" Target="styles.xml"/></Relationships>`),
2643
+ "xl/worksheets/sheet1.xml": strToU8(`${head}<worksheet xmlns="${S}" xmlns:r="${REL}"><sheetData/></worksheet>`),
2644
+ "xl/styles.xml": strToU8(`${head}<styleSheet xmlns="${S}"><fonts count="1"><font><sz val="11"/><name val="Arial"/></font></fonts><fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills><borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/></cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles></styleSheet>`)
2645
+ });
2646
+ }
2647
+ var slides = (name) => strToU8(`<!DOCTYPE html>
2648
+ <html>
2649
+ <head>
2650
+ <meta charset="utf-8">
2651
+ <title>${escape(name)}</title>
2652
+ <style>
2653
+ body { margin: 0; font-family: Inter, Arial, sans-serif; background: #0f172a; }
2654
+ section { width: 1920px; height: 1080px; padding: 120px; box-sizing: border-box; background: #fff; color: #0f172a; }
2655
+ section h1 { font-size: 96px; margin: 0 0 24px; }
2656
+ section h2 { font-size: 72px; margin: 0 0 24px; }
2657
+ section p { font-size: 40px; color: #475569; }
2658
+ </style>
2659
+ </head>
2660
+ <body>
2661
+ <section><h1>${escape(name)}</h1><p>Subtitle</p></section>
2662
+ <section><h2>Title</h2><p>Text</p></section>
2663
+ </body>
2664
+ </html>
2665
+ `);
2666
+ function blank2(kind, name, template = "blank") {
2667
+ const blocks = template === "blank" ? [] : templates[template](name);
2668
+ const bytes = kind === "docx" ? docx(blocks) : kind === "markdown" ? markdown(blocks.length ? blocks : [["Title", name]]) : kind === "sheet" ? sheet() : slides(name);
2669
+ return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
2670
+ }
2671
+
2672
+ // src/NewDocument.tsx
2545
2673
  import { Fragment as Fragment5, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
2546
- var blank2 = { id: null, comment: false, download: false, askName: true, works: "30", day: "", password: false, secret: "", had: false };
2674
+ var icons2 = { docx: FileText2, markdown: FileType2, sheet: FileSpreadsheet2, slides: Presentation2 };
2675
+ var shaped = ["blank", "letter", "contract", "notes", "invoice", "report"];
2676
+ function NewDocument({ host, t, onClose, onMade }) {
2677
+ const id = useId3();
2678
+ const [kind, setKind] = useState6("docx");
2679
+ const [template, setTemplate] = useState6("blank");
2680
+ const [name, setName] = useState6("");
2681
+ const [state, setState] = useState6("idle");
2682
+ useRestore(true);
2683
+ const choices = kind === "docx" || kind === "markdown" ? shaped : ["blank"];
2684
+ const make2 = async () => {
2685
+ const title = name.trim() || (template === "blank" ? t.untitled : t.templates[template]);
2686
+ setState("busy");
2687
+ try {
2688
+ onMade(await host.create({ name: `${title.replace(/[\\/:*?"<>|\s]+/g, " ").trim()}.${extensions[kind]}`, bytes: blank2(kind, title, template), mimeType: mimes[kind] }));
2689
+ } catch {
2690
+ setState("failed");
2691
+ }
2692
+ };
2693
+ return /* @__PURE__ */ jsx6("div", { className: "w100n-pdf-back", onKeyDown: (e) => {
2694
+ if (e.key === "Escape") {
2695
+ e.stopPropagation();
2696
+ onClose();
2697
+ }
2698
+ }, children: /* @__PURE__ */ jsxs6("form", { className: "w100n-pdf-dialog w100n-new", role: "dialog", "aria-modal": true, "aria-labelledby": `${id}t`, onSubmit: (e) => {
2699
+ e.preventDefault();
2700
+ void make2();
2701
+ }, children: [
2702
+ /* @__PURE__ */ jsxs6("div", { className: "w100n-new-head", children: [
2703
+ /* @__PURE__ */ jsx6("span", { className: "w100n-new-tile", children: /* @__PURE__ */ jsx6(Plus2, { "aria-hidden": true }) }),
2704
+ /* @__PURE__ */ jsx6("b", { id: `${id}t`, className: "w100n-pdf-dialog-title", children: t.newTitle }),
2705
+ /* @__PURE__ */ jsx6("button", { type: "button", className: "w100n-docs-close", onClick: onClose, "aria-label": t.close, title: t.close, children: /* @__PURE__ */ jsx6(X5, { "aria-hidden": true }) })
2706
+ ] }),
2707
+ /* @__PURE__ */ jsx6("div", { role: "radiogroup", "aria-label": t.kind, className: "w100n-new-kinds", children: Object.keys(icons2).map((item) => {
2708
+ const Icon = icons2[item];
2709
+ return /* @__PURE__ */ jsxs6("button", { type: "button", role: "radio", "aria-checked": kind === item, "data-kind": item, onClick: () => {
2710
+ setKind(item);
2711
+ if (item === "sheet" || item === "slides") setTemplate("blank");
2712
+ }, children: [
2713
+ /* @__PURE__ */ jsx6("span", { className: "w100n-docs-tile", "data-kind": item, children: /* @__PURE__ */ jsx6(Icon, { "aria-hidden": true }) }),
2714
+ /* @__PURE__ */ jsxs6("span", { children: [
2715
+ /* @__PURE__ */ jsx6("b", { children: t.newKinds[item] }),
2716
+ /* @__PURE__ */ jsx6("small", { children: t.kindHints[item] })
2717
+ ] })
2718
+ ] }, item);
2719
+ }) }),
2720
+ /* @__PURE__ */ jsx6("p", { className: "w100n-docs-caption", children: t.startFrom }),
2721
+ /* @__PURE__ */ jsx6("div", { role: "radiogroup", "aria-label": t.startFrom, className: "w100n-new-templates", children: choices.map((item) => /* @__PURE__ */ jsxs6("button", { type: "button", role: "radio", "aria-checked": template === item, onClick: () => setTemplate(item), children: [
2722
+ /* @__PURE__ */ jsx6("span", { className: "w100n-new-sheet", "data-blank": item === "blank", children: item === "blank" ? /* @__PURE__ */ jsx6(Plus2, { "aria-hidden": true }) : /* @__PURE__ */ jsxs6(Fragment5, { children: [
2723
+ /* @__PURE__ */ jsx6("i", { "data-head": true }),
2724
+ /* @__PURE__ */ jsx6("i", {}),
2725
+ /* @__PURE__ */ jsx6("i", {}),
2726
+ /* @__PURE__ */ jsx6("i", { "data-accent": true }),
2727
+ /* @__PURE__ */ jsx6("i", {}),
2728
+ /* @__PURE__ */ jsx6("i", {})
2729
+ ] }) }),
2730
+ /* @__PURE__ */ jsx6("span", { children: t.templates[item] })
2731
+ ] }, item)) }),
2732
+ /* @__PURE__ */ jsxs6("div", { className: "w100n-new-fields", children: [
2733
+ /* @__PURE__ */ jsxs6("label", { children: [
2734
+ /* @__PURE__ */ jsx6("span", { className: "w100n-docs-caption", children: t.name }),
2735
+ /* @__PURE__ */ jsx6("input", { className: "w100n-docs-field", autoFocus: true, value: name, onChange: (e) => setName(e.target.value), placeholder: template === "blank" ? t.untitled : t.templates[template] })
2736
+ ] }),
2737
+ host.createIn && /* @__PURE__ */ jsxs6("div", { children: [
2738
+ /* @__PURE__ */ jsx6("span", { className: "w100n-docs-caption", children: t.savesTo }),
2739
+ /* @__PURE__ */ jsx6("span", { className: "w100n-docs-field w100n-new-place", children: host.createIn })
2740
+ ] })
2741
+ ] }),
2742
+ state === "failed" && /* @__PURE__ */ jsx6("p", { className: "w100n-docs-muted", role: "alert", children: t.makeFailed }),
2743
+ /* @__PURE__ */ jsxs6("div", { className: "w100n-pdf-dialog-end", children: [
2744
+ /* @__PURE__ */ jsx6("button", { type: "button", className: "w100n-pdf-link", onClick: onClose, children: t.cancel }),
2745
+ /* @__PURE__ */ jsxs6("button", { type: "submit", className: "w100n-docs-action", disabled: state === "busy", children: [
2746
+ /* @__PURE__ */ jsx6(Check, { "aria-hidden": true }),
2747
+ state === "busy" ? t.making : t.make
2748
+ ] })
2749
+ ] })
2750
+ ] }) });
2751
+ }
2752
+
2753
+ // src/Sharing.tsx
2754
+ import { useState as useState7 } from "react";
2755
+ import { Ban, CalendarDays, Clock, Copy as Copy2, Download as Download2, Eye, Link, Lock, MessageSquarePlus, Plus as Plus3, Users } from "lucide-react";
2756
+ import { Fragment as Fragment6, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
2757
+ var blank3 = { id: null, comment: false, download: false, askName: true, works: "30", day: "", password: false, secret: "", had: false };
2547
2758
  var local = (iso) => {
2548
2759
  const at = new Date(iso);
2549
2760
  return `${at.getFullYear()}-${String(at.getMonth() + 1).padStart(2, "0")}-${String(at.getDate()).padStart(2, "0")}`;
2550
2761
  };
2551
2762
  function Sharing({ host, doc, t, language, team }) {
2552
2763
  const links = useLoad((signal) => host.links(doc.id, { signal }), [host, doc.id]);
2553
- const [form, setForm] = useState6(null);
2554
- const [state, setState] = useState6("idle");
2555
- const [copied, setCopied] = useState6(null);
2764
+ const [form, setForm] = useState7(null);
2765
+ const [state, setState] = useState7("idle");
2766
+ const [copied, setCopied] = useState7(null);
2556
2767
  const text = doc.kind === "docx" || doc.kind === "markdown";
2557
2768
  const rules = new Intl.PluralRules(language);
2558
2769
  const count = (n, forms) => `${n} ${forms[rules.select(n)] ?? forms.other}`;
@@ -2614,31 +2825,31 @@ function Sharing({ host, doc, t, language, team }) {
2614
2825
  setCopied(null);
2615
2826
  }
2616
2827
  };
2617
- if (form) return /* @__PURE__ */ jsxs6("div", { className: "w100n-share", children: [
2618
- /* @__PURE__ */ jsxs6("p", { className: "w100n-docs-caption", children: [
2619
- /* @__PURE__ */ jsx6(Link, { "aria-hidden": true }),
2828
+ if (form) return /* @__PURE__ */ jsxs7("div", { className: "w100n-share", children: [
2829
+ /* @__PURE__ */ jsxs7("p", { className: "w100n-docs-caption", children: [
2830
+ /* @__PURE__ */ jsx7(Link, { "aria-hidden": true }),
2620
2831
  form.id ? t.changeLink : t.newLink
2621
2832
  ] }),
2622
- text && /* @__PURE__ */ jsxs6("div", { className: "w100n-share-field", children: [
2623
- /* @__PURE__ */ jsx6("span", { children: t.guestsCan }),
2624
- /* @__PURE__ */ jsxs6("div", { className: "w100n-docs-chips", children: [
2625
- /* @__PURE__ */ jsxs6("button", { type: "button", "aria-pressed": !form.comment, onClick: () => setForm({ ...form, comment: false }), children: [
2626
- /* @__PURE__ */ jsx6(Eye, { "aria-hidden": true }),
2833
+ text && /* @__PURE__ */ jsxs7("div", { className: "w100n-share-field", children: [
2834
+ /* @__PURE__ */ jsx7("span", { children: t.guestsCan }),
2835
+ /* @__PURE__ */ jsxs7("div", { className: "w100n-docs-chips", children: [
2836
+ /* @__PURE__ */ jsxs7("button", { type: "button", "aria-pressed": !form.comment, onClick: () => setForm({ ...form, comment: false }), children: [
2837
+ /* @__PURE__ */ jsx7(Eye, { "aria-hidden": true }),
2627
2838
  t.canRead
2628
2839
  ] }),
2629
- /* @__PURE__ */ jsxs6("button", { type: "button", "aria-pressed": form.comment, onClick: () => setForm({ ...form, comment: true }), children: [
2630
- /* @__PURE__ */ jsx6(MessageSquarePlus, { "aria-hidden": true }),
2840
+ /* @__PURE__ */ jsxs7("button", { type: "button", "aria-pressed": form.comment, onClick: () => setForm({ ...form, comment: true }), children: [
2841
+ /* @__PURE__ */ jsx7(MessageSquarePlus, { "aria-hidden": true }),
2631
2842
  t.canComment
2632
2843
  ] })
2633
2844
  ] })
2634
2845
  ] }),
2635
- /* @__PURE__ */ jsxs6("div", { className: "w100n-share-field", children: [
2636
- /* @__PURE__ */ jsx6("span", { children: t.linkWorks }),
2637
- /* @__PURE__ */ jsx6("div", { className: "w100n-docs-chips", children: [["7", t.days7], ["30", t.days30], ["off", t.untilTurnOff], ["day", t.pickDay]].map(([key, label]) => /* @__PURE__ */ jsxs6("button", { type: "button", "aria-pressed": form.works === key, onClick: () => setForm({ ...form, works: key }), children: [
2638
- key === "day" && /* @__PURE__ */ jsx6(CalendarDays, { "aria-hidden": true }),
2846
+ /* @__PURE__ */ jsxs7("div", { className: "w100n-share-field", children: [
2847
+ /* @__PURE__ */ jsx7("span", { children: t.linkWorks }),
2848
+ /* @__PURE__ */ jsx7("div", { className: "w100n-docs-chips", children: [["7", t.days7], ["30", t.days30], ["off", t.untilTurnOff], ["day", t.pickDay]].map(([key, label]) => /* @__PURE__ */ jsxs7("button", { type: "button", "aria-pressed": form.works === key, onClick: () => setForm({ ...form, works: key }), children: [
2849
+ key === "day" && /* @__PURE__ */ jsx7(CalendarDays, { "aria-hidden": true }),
2639
2850
  label
2640
2851
  ] }, key)) }),
2641
- form.works === "day" && /* @__PURE__ */ jsx6(
2852
+ form.works === "day" && /* @__PURE__ */ jsx7(
2642
2853
  "input",
2643
2854
  {
2644
2855
  type: "date",
@@ -2650,14 +2861,14 @@ function Sharing({ host, doc, t, language, team }) {
2650
2861
  }
2651
2862
  )
2652
2863
  ] }),
2653
- /* @__PURE__ */ jsxs6("label", { className: "w100n-share-toggle", children: [
2654
- /* @__PURE__ */ jsx6("input", { type: "checkbox", checked: form.password, onChange: (e) => setForm({ ...form, password: e.target.checked }) }),
2655
- /* @__PURE__ */ jsxs6("span", { children: [
2656
- /* @__PURE__ */ jsx6("b", { children: t.passwordOn }),
2657
- /* @__PURE__ */ jsx6("small", { children: t.passwordHint })
2864
+ /* @__PURE__ */ jsxs7("label", { className: "w100n-share-toggle", children: [
2865
+ /* @__PURE__ */ jsx7("input", { type: "checkbox", checked: form.password, onChange: (e) => setForm({ ...form, password: e.target.checked }) }),
2866
+ /* @__PURE__ */ jsxs7("span", { children: [
2867
+ /* @__PURE__ */ jsx7("b", { children: t.passwordOn }),
2868
+ /* @__PURE__ */ jsx7("small", { children: t.passwordHint })
2658
2869
  ] })
2659
2870
  ] }),
2660
- form.password && /* @__PURE__ */ jsx6(
2871
+ form.password && /* @__PURE__ */ jsx7(
2661
2872
  "input",
2662
2873
  {
2663
2874
  type: "password",
@@ -2669,120 +2880,120 @@ function Sharing({ host, doc, t, language, team }) {
2669
2880
  onChange: (e) => setForm({ ...form, secret: e.target.value })
2670
2881
  }
2671
2882
  ),
2672
- /* @__PURE__ */ jsxs6("label", { className: "w100n-share-toggle", children: [
2673
- /* @__PURE__ */ jsx6("input", { type: "checkbox", checked: form.download, onChange: (e) => setForm({ ...form, download: e.target.checked }) }),
2674
- /* @__PURE__ */ jsxs6("span", { children: [
2675
- /* @__PURE__ */ jsx6("b", { children: t.downloadFile }),
2676
- /* @__PURE__ */ jsx6("small", { children: t.downloadHint })
2883
+ /* @__PURE__ */ jsxs7("label", { className: "w100n-share-toggle", children: [
2884
+ /* @__PURE__ */ jsx7("input", { type: "checkbox", checked: form.download, onChange: (e) => setForm({ ...form, download: e.target.checked }) }),
2885
+ /* @__PURE__ */ jsxs7("span", { children: [
2886
+ /* @__PURE__ */ jsx7("b", { children: t.downloadFile }),
2887
+ /* @__PURE__ */ jsx7("small", { children: t.downloadHint })
2677
2888
  ] })
2678
2889
  ] }),
2679
- /* @__PURE__ */ jsxs6("label", { className: "w100n-share-toggle", children: [
2680
- /* @__PURE__ */ jsx6("input", { type: "checkbox", checked: form.askName, onChange: (e) => setForm({ ...form, askName: e.target.checked }) }),
2681
- /* @__PURE__ */ jsxs6("span", { children: [
2682
- /* @__PURE__ */ jsx6("b", { children: t.askName }),
2683
- /* @__PURE__ */ jsx6("small", { children: t.askNameHint })
2890
+ /* @__PURE__ */ jsxs7("label", { className: "w100n-share-toggle", children: [
2891
+ /* @__PURE__ */ jsx7("input", { type: "checkbox", checked: form.askName, onChange: (e) => setForm({ ...form, askName: e.target.checked }) }),
2892
+ /* @__PURE__ */ jsxs7("span", { children: [
2893
+ /* @__PURE__ */ jsx7("b", { children: t.askName }),
2894
+ /* @__PURE__ */ jsx7("small", { children: t.askNameHint })
2684
2895
  ] })
2685
2896
  ] }),
2686
- /* @__PURE__ */ jsx6("p", { className: "w100n-docs-muted", children: t.lastSaved }),
2687
- state === "failed" && /* @__PURE__ */ jsx6("p", { className: "w100n-docs-muted", role: "alert", children: t.shareFailed }),
2688
- /* @__PURE__ */ jsxs6("span", { className: "w100n-pdf-dialog-end", children: [
2689
- /* @__PURE__ */ jsx6("button", { type: "button", className: "w100n-pdf-link", onClick: () => {
2897
+ /* @__PURE__ */ jsx7("p", { className: "w100n-docs-muted", children: t.lastSaved }),
2898
+ state === "failed" && /* @__PURE__ */ jsx7("p", { className: "w100n-docs-muted", role: "alert", children: t.shareFailed }),
2899
+ /* @__PURE__ */ jsxs7("span", { className: "w100n-pdf-dialog-end", children: [
2900
+ /* @__PURE__ */ jsx7("button", { type: "button", className: "w100n-pdf-link", onClick: () => {
2690
2901
  setForm(null);
2691
2902
  setState("idle");
2692
2903
  }, children: t.cancel }),
2693
- /* @__PURE__ */ jsxs6("button", { type: "button", className: "w100n-docs-action", disabled: !ready || state === "busy", onClick: () => void submit(), children: [
2694
- /* @__PURE__ */ jsx6(Link, { "aria-hidden": true }),
2904
+ /* @__PURE__ */ jsxs7("button", { type: "button", className: "w100n-docs-action", disabled: !ready || state === "busy", onClick: () => void submit(), children: [
2905
+ /* @__PURE__ */ jsx7(Link, { "aria-hidden": true }),
2695
2906
  form.id ? t.saveLink : t.makeLink
2696
2907
  ] })
2697
2908
  ] })
2698
2909
  ] });
2699
2910
  const on = links.data ?? [];
2700
- return /* @__PURE__ */ jsxs6("div", { className: "w100n-share", children: [
2701
- /* @__PURE__ */ jsxs6("p", { className: "w100n-docs-caption", children: [
2702
- /* @__PURE__ */ jsx6(Link, { "aria-hidden": true }),
2911
+ return /* @__PURE__ */ jsxs7("div", { className: "w100n-share", children: [
2912
+ /* @__PURE__ */ jsxs7("p", { className: "w100n-docs-caption", children: [
2913
+ /* @__PURE__ */ jsx7(Link, { "aria-hidden": true }),
2703
2914
  t.guestLinks,
2704
- on.length > 0 && /* @__PURE__ */ jsx6("span", { children: on.filter((l) => !l.ended).length })
2915
+ on.length > 0 && /* @__PURE__ */ jsx7("span", { children: on.filter((l) => !l.ended).length })
2705
2916
  ] }),
2706
- links.error && /* @__PURE__ */ jsxs6("div", { className: "w100n-docs-note", children: [
2917
+ links.error && /* @__PURE__ */ jsxs7("div", { className: "w100n-docs-note", children: [
2707
2918
  t.failed,
2708
- /* @__PURE__ */ jsx6("button", { type: "button", onClick: links.retry, children: t.retry })
2919
+ /* @__PURE__ */ jsx7("button", { type: "button", onClick: links.retry, children: t.retry })
2709
2920
  ] }),
2710
- links.data && !on.length && /* @__PURE__ */ jsx6("p", { className: "w100n-docs-muted", children: t.noLinks }),
2711
- state === "failed" && /* @__PURE__ */ jsx6("p", { className: "w100n-docs-muted", role: "alert", children: t.shareFailed }),
2712
- on.map((l) => /* @__PURE__ */ jsxs6("article", { className: "w100n-share-link", "data-ended": l.ended, children: [
2713
- /* @__PURE__ */ jsxs6("header", { children: [
2714
- /* @__PURE__ */ jsx6("span", { className: "w100n-share-tile", "data-tone": l.comment ? "amber" : "blue", children: l.comment ? /* @__PURE__ */ jsx6(MessageSquarePlus, { "aria-hidden": true }) : /* @__PURE__ */ jsx6(Eye, { "aria-hidden": true }) }),
2715
- /* @__PURE__ */ jsxs6("span", { children: [
2716
- /* @__PURE__ */ jsx6("b", { children: l.comment ? t.commentLink : t.viewLink }),
2717
- /* @__PURE__ */ jsxs6("small", { children: [
2921
+ links.data && !on.length && /* @__PURE__ */ jsx7("p", { className: "w100n-docs-muted", children: t.noLinks }),
2922
+ state === "failed" && /* @__PURE__ */ jsx7("p", { className: "w100n-docs-muted", role: "alert", children: t.shareFailed }),
2923
+ on.map((l) => /* @__PURE__ */ jsxs7("article", { className: "w100n-share-link", "data-ended": l.ended, children: [
2924
+ /* @__PURE__ */ jsxs7("header", { children: [
2925
+ /* @__PURE__ */ jsx7("span", { className: "w100n-share-tile", "data-tone": l.comment ? "amber" : "blue", children: l.comment ? /* @__PURE__ */ jsx7(MessageSquarePlus, { "aria-hidden": true }) : /* @__PURE__ */ jsx7(Eye, { "aria-hidden": true }) }),
2926
+ /* @__PURE__ */ jsxs7("span", { children: [
2927
+ /* @__PURE__ */ jsx7("b", { children: l.comment ? t.commentLink : t.viewLink }),
2928
+ /* @__PURE__ */ jsxs7("small", { children: [
2718
2929
  t.madeBy.replace("{name}", l.createdBy.name),
2719
2930
  " \xB7 ",
2720
2931
  day(l.createdAt)
2721
2932
  ] })
2722
2933
  ] })
2723
2934
  ] }),
2724
- /* @__PURE__ */ jsxs6("div", { className: "w100n-share-chips", children: [
2725
- /* @__PURE__ */ jsxs6("span", { children: [
2726
- /* @__PURE__ */ jsx6(Clock, { "aria-hidden": true }),
2935
+ /* @__PURE__ */ jsxs7("div", { className: "w100n-share-chips", children: [
2936
+ /* @__PURE__ */ jsxs7("span", { children: [
2937
+ /* @__PURE__ */ jsx7(Clock, { "aria-hidden": true }),
2727
2938
  l.ended ? t.linkEnded : l.endsAt ? t.endsOn.replace("{date}", day(l.endsAt)) : t.untilOff
2728
2939
  ] }),
2729
- l.download && /* @__PURE__ */ jsxs6("span", { children: [
2730
- /* @__PURE__ */ jsx6(Download2, { "aria-hidden": true }),
2940
+ l.download && /* @__PURE__ */ jsxs7("span", { children: [
2941
+ /* @__PURE__ */ jsx7(Download2, { "aria-hidden": true }),
2731
2942
  t.downloadOn
2732
2943
  ] }),
2733
- l.password && /* @__PURE__ */ jsxs6("span", { children: [
2734
- /* @__PURE__ */ jsx6(Lock, { "aria-hidden": true }),
2944
+ l.password && /* @__PURE__ */ jsxs7("span", { children: [
2945
+ /* @__PURE__ */ jsx7(Lock, { "aria-hidden": true }),
2735
2946
  t.passwordOn
2736
2947
  ] }),
2737
- /* @__PURE__ */ jsxs6("span", { children: [
2738
- /* @__PURE__ */ jsx6(Eye, { "aria-hidden": true }),
2948
+ /* @__PURE__ */ jsxs7("span", { children: [
2949
+ /* @__PURE__ */ jsx7(Eye, { "aria-hidden": true }),
2739
2950
  count(l.guests.reduce((n, g) => n + g.opens, 0), t.openForms)
2740
2951
  ] })
2741
2952
  ] }),
2742
- /* @__PURE__ */ jsxs6("div", { className: "w100n-share-url", children: [
2743
- /* @__PURE__ */ jsx6("span", { children: l.url.replace(/^https?:\/\//, "") }),
2744
- /* @__PURE__ */ jsxs6("button", { type: "button", className: "w100n-docs-action", "data-tone": "blue", onClick: () => void copy(l), children: [
2745
- /* @__PURE__ */ jsx6(Copy2, { "aria-hidden": true }),
2953
+ /* @__PURE__ */ jsxs7("div", { className: "w100n-share-url", children: [
2954
+ /* @__PURE__ */ jsx7("span", { children: l.url.replace(/^https?:\/\//, "") }),
2955
+ /* @__PURE__ */ jsxs7("button", { type: "button", className: "w100n-docs-action", "data-tone": "blue", onClick: () => void copy(l), children: [
2956
+ /* @__PURE__ */ jsx7(Copy2, { "aria-hidden": true }),
2746
2957
  copied === l.id ? t.copied : t.copy
2747
2958
  ] })
2748
2959
  ] }),
2749
- l.guests.length > 0 && /* @__PURE__ */ jsx6("div", { className: "w100n-share-who", children: l.guests.map((g, i) => /* @__PURE__ */ jsxs6("div", { children: [
2750
- /* @__PURE__ */ jsx6("span", { className: "w100n-text-face", "aria-hidden": true, children: (g.name || "?").slice(0, 1).toUpperCase() }),
2751
- /* @__PURE__ */ jsx6("b", { children: g.name || t.unnamed }),
2752
- /* @__PURE__ */ jsxs6("small", { children: [
2960
+ l.guests.length > 0 && /* @__PURE__ */ jsx7("div", { className: "w100n-share-who", children: l.guests.map((g, i) => /* @__PURE__ */ jsxs7("div", { children: [
2961
+ /* @__PURE__ */ jsx7("span", { className: "w100n-text-face", "aria-hidden": true, children: (g.name || "?").slice(0, 1).toUpperCase() }),
2962
+ /* @__PURE__ */ jsx7("b", { children: g.name || t.unnamed }),
2963
+ /* @__PURE__ */ jsxs7("small", { children: [
2753
2964
  g.comments ? count(g.comments, t.commentForms) : count(g.opens, t.openForms),
2754
2965
  " \xB7 ",
2755
2966
  ago(g.lastAt)
2756
2967
  ] })
2757
2968
  ] }, i)) }),
2758
- /* @__PURE__ */ jsxs6("div", { className: "w100n-share-tools", children: [
2759
- /* @__PURE__ */ jsxs6("button", { type: "button", className: "w100n-docs-action", "data-tone": "slate", disabled: state === "busy", onClick: () => edit(l), children: [
2760
- /* @__PURE__ */ jsx6(Clock, { "aria-hidden": true }),
2969
+ /* @__PURE__ */ jsxs7("div", { className: "w100n-share-tools", children: [
2970
+ /* @__PURE__ */ jsxs7("button", { type: "button", className: "w100n-docs-action", "data-tone": "slate", disabled: state === "busy", onClick: () => edit(l), children: [
2971
+ /* @__PURE__ */ jsx7(Clock, { "aria-hidden": true }),
2761
2972
  t.changeLink
2762
2973
  ] }),
2763
- /* @__PURE__ */ jsxs6("button", { type: "button", className: "w100n-docs-action", "data-tone": "red", disabled: state === "busy", onClick: () => void off(l), children: [
2764
- /* @__PURE__ */ jsx6(Ban, { "aria-hidden": true }),
2974
+ /* @__PURE__ */ jsxs7("button", { type: "button", className: "w100n-docs-action", "data-tone": "red", disabled: state === "busy", onClick: () => void off(l), children: [
2975
+ /* @__PURE__ */ jsx7(Ban, { "aria-hidden": true }),
2765
2976
  t.turnOff
2766
2977
  ] })
2767
2978
  ] })
2768
2979
  ] }, l.id)),
2769
- /* @__PURE__ */ jsxs6("button", { type: "button", className: "w100n-docs-action w100n-share-new", onClick: () => {
2980
+ /* @__PURE__ */ jsxs7("button", { type: "button", className: "w100n-docs-action w100n-share-new", onClick: () => {
2770
2981
  setState("idle");
2771
- setForm(blank2);
2982
+ setForm(blank3);
2772
2983
  }, children: [
2773
- /* @__PURE__ */ jsx6(Plus2, { "aria-hidden": true }),
2984
+ /* @__PURE__ */ jsx7(Plus3, { "aria-hidden": true }),
2774
2985
  t.newLink
2775
2986
  ] }),
2776
- team && /* @__PURE__ */ jsxs6(Fragment5, { children: [
2777
- /* @__PURE__ */ jsxs6("p", { className: "w100n-docs-caption", children: [
2778
- /* @__PURE__ */ jsx6(Users, { "aria-hidden": true }),
2987
+ team && /* @__PURE__ */ jsxs7(Fragment6, { children: [
2988
+ /* @__PURE__ */ jsxs7("p", { className: "w100n-docs-caption", children: [
2989
+ /* @__PURE__ */ jsx7(Users, { "aria-hidden": true }),
2779
2990
  t.inTeam
2780
2991
  ] }),
2781
- /* @__PURE__ */ jsxs6("div", { className: "w100n-share-team", children: [
2782
- /* @__PURE__ */ jsx6("span", { className: "w100n-share-tile", children: /* @__PURE__ */ jsx6(Users, { "aria-hidden": true }) }),
2783
- /* @__PURE__ */ jsxs6("span", { children: [
2784
- /* @__PURE__ */ jsx6("b", { children: t.peopleOf.replace("{space}", team) }),
2785
- /* @__PURE__ */ jsx6("small", { children: t.teamHint })
2992
+ /* @__PURE__ */ jsxs7("div", { className: "w100n-share-team", children: [
2993
+ /* @__PURE__ */ jsx7("span", { className: "w100n-share-tile", children: /* @__PURE__ */ jsx7(Users, { "aria-hidden": true }) }),
2994
+ /* @__PURE__ */ jsxs7("span", { children: [
2995
+ /* @__PURE__ */ jsx7("b", { children: t.peopleOf.replace("{space}", team) }),
2996
+ /* @__PURE__ */ jsx7("small", { children: t.teamHint })
2786
2997
  ] })
2787
2998
  ] })
2788
2999
  ] })
@@ -2790,7 +3001,7 @@ function Sharing({ host, doc, t, language, team }) {
2790
3001
  }
2791
3002
 
2792
3003
  // src/Thumb.tsx
2793
- import { useEffect as useEffect5, useRef as useRef5, useState as useState7 } from "react";
3004
+ import { useEffect as useEffect5, useRef as useRef5, useState as useState8 } from "react";
2794
3005
 
2795
3006
  // src/preview.ts
2796
3007
  var cache = /* @__PURE__ */ new Map();
@@ -2843,11 +3054,11 @@ function preview(host, doc) {
2843
3054
  }
2844
3055
 
2845
3056
  // src/Thumb.tsx
2846
- import { Fragment as Fragment6, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
3057
+ import { Fragment as Fragment7, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
2847
3058
  function Thumb({ host, item, label }) {
2848
3059
  const box = useRef5(null);
2849
- const [seen, setSeen] = useState7(false);
2850
- const [shot, setShot] = useState7(null);
3060
+ const [seen, setSeen] = useState8(false);
3061
+ const [shot, setShot] = useState8(null);
2851
3062
  useEffect5(() => {
2852
3063
  if (item.thumbnailUrl || item.excerpt || typeof IntersectionObserver === "undefined") return;
2853
3064
  const watch = new IntersectionObserver((entries) => {
@@ -2869,39 +3080,44 @@ function Thumb({ host, item, label }) {
2869
3080
  const text = item.excerpt ?? shot?.text ?? "";
2870
3081
  const lines = text.split("\n").filter((line) => !line.trim().startsWith("```")).map((line) => line.replace(/^#+\s*/, "").replace(/[*_`>|]/g, "").trim()).filter(Boolean);
2871
3082
  const image = item.thumbnailUrl ?? shot?.image;
2872
- return /* @__PURE__ */ jsxs7("span", { ref: box, className: "w100n-docs-thumb", "data-kind": item.kind, children: [
2873
- image ? /* @__PURE__ */ jsx7("img", { src: image, alt: "" }) : /* @__PURE__ */ jsx7("span", { className: "w100n-docs-paper", "aria-hidden": true, children: lines.length ? /* @__PURE__ */ jsxs7(Fragment6, { children: [
2874
- /* @__PURE__ */ jsx7("b", { children: lines[0] }),
3083
+ return /* @__PURE__ */ jsxs8("span", { ref: box, className: "w100n-docs-thumb", "data-kind": item.kind, children: [
3084
+ image ? /* @__PURE__ */ jsx8("img", { src: image, alt: "" }) : /* @__PURE__ */ jsx8("span", { className: "w100n-docs-paper", "aria-hidden": true, children: lines.length ? /* @__PURE__ */ jsxs8(Fragment7, { children: [
3085
+ /* @__PURE__ */ jsx8("b", { children: lines[0] }),
2875
3086
  lines.slice(1, 14).join(" ")
2876
- ] }) : /* @__PURE__ */ jsxs7(Fragment6, { children: [
2877
- /* @__PURE__ */ jsx7("i", {}),
2878
- /* @__PURE__ */ jsx7("i", {}),
2879
- /* @__PURE__ */ jsx7("i", {}),
2880
- /* @__PURE__ */ jsx7("i", {}),
2881
- /* @__PURE__ */ jsx7("i", {})
3087
+ ] }) : /* @__PURE__ */ jsxs8(Fragment7, { children: [
3088
+ /* @__PURE__ */ jsx8("i", {}),
3089
+ /* @__PURE__ */ jsx8("i", {}),
3090
+ /* @__PURE__ */ jsx8("i", {}),
3091
+ /* @__PURE__ */ jsx8("i", {}),
3092
+ /* @__PURE__ */ jsx8("i", {})
2882
3093
  ] }) }),
2883
- /* @__PURE__ */ jsx7("span", { className: "w100n-docs-kind", "data-kind": item.kind, children: label })
3094
+ /* @__PURE__ */ jsx8("span", { className: "w100n-docs-kind", "data-kind": item.kind, children: label })
2884
3095
  ] });
2885
3096
  }
2886
3097
 
2887
3098
  // src/DocumentsWorkspace.tsx
2888
- import { Fragment as Fragment7, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
2889
- var TextEditor2 = lazy2(() => import("./TextEditor-SPEVB5HX.js"));
2890
- var SheetView2 = lazy2(() => import("./SheetView-G3YWPH5V.js"));
2891
- var icons2 = { docx: FileText2, markdown: FileType2, pdf: Files2, sheet: FileSpreadsheet2, slides: Presentation2 };
3099
+ import { Fragment as Fragment8, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
3100
+ var TextEditor2 = lazy2(() => import("./TextEditor-VBHWUOZR.js"));
3101
+ var SheetView2 = lazy2(() => import("./SheetView-4TPL7DES.js"));
3102
+ var icons3 = { docx: FileText3, markdown: FileType3, pdf: Files2, sheet: FileSpreadsheet3, slides: Presentation3 };
2892
3103
  function DocumentsWorkspace({ host, language = "en", theme = "light", place, onPlace, start, end, aside, actions }) {
2893
3104
  const t = texts[language];
2894
- const [own, setOwn] = useState8({ spaceId: null, documentId: null });
3105
+ const [own, setOwn] = useState9({ spaceId: null, documentId: null });
2895
3106
  const here = place ?? own;
2896
3107
  const go = (next) => {
2897
3108
  setOwn(next);
2898
3109
  onPlace?.(next);
2899
3110
  };
2900
- const [query, setQuery] = useState8("");
2901
- const [kind, setKind] = useState8("all");
2902
- const [listOpen, setListOpen] = useState8(true);
2903
- const [panelOpen, setPanelOpen] = useState8(true);
2904
- const [narrow, setNarrow] = useState8(false);
3111
+ const [query, setQuery] = useState9("");
3112
+ const [picked, setPicked] = useState9([]);
3113
+ const [typing, setTyping] = useState9(false);
3114
+ const [menusAt, setMenusAt] = useState9(null);
3115
+ const [renaming, setRenaming] = useState9(null);
3116
+ const [renamed, setRenamed] = useState9("idle");
3117
+ const [statusAt, setStatusAt] = useState9(null);
3118
+ const [listOpen, setListOpen] = useState9(true);
3119
+ const [panelOpen, setPanelOpen] = useState9(true);
3120
+ const [narrow, setNarrow] = useState9(false);
2905
3121
  const body = useRef6(null);
2906
3122
  const listButton = useRef6(null);
2907
3123
  const panelButton = useRef6(null);
@@ -2912,13 +3128,13 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
2912
3128
  const el = body.current;
2913
3129
  let was = false;
2914
3130
  const check = () => {
2915
- const now = getComputedStyle(el).getPropertyValue("--docs-narrow").trim() === "1";
2916
- if (now && !was) {
3131
+ const now2 = getComputedStyle(el).getPropertyValue("--docs-narrow").trim() === "1";
3132
+ if (now2 && !was) {
2917
3133
  setPanelOpen(false);
2918
3134
  if (here.documentId) setListOpen(false);
2919
3135
  }
2920
- was = now;
2921
- setNarrow(now);
3136
+ was = now2;
3137
+ setNarrow(now2);
2922
3138
  };
2923
3139
  check();
2924
3140
  if (typeof ResizeObserver === "undefined") return;
@@ -2926,7 +3142,24 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
2926
3142
  watch.observe(el);
2927
3143
  return () => watch.disconnect();
2928
3144
  }, [here.documentId]);
2929
- const [picking, setPicking] = useState8(false);
3145
+ const [picking, setPicking] = useState9(false);
3146
+ const [adding, setAdding] = useState9(false);
3147
+ useEffect6(() => {
3148
+ if (!adding) return;
3149
+ const close = (e) => {
3150
+ if (!e.target.closest(".w100n-docs-new")) setAdding(false);
3151
+ };
3152
+ document.addEventListener("pointerdown", close);
3153
+ return () => document.removeEventListener("pointerdown", close);
3154
+ }, [adding]);
3155
+ useEffect6(() => {
3156
+ if (!typing) return;
3157
+ const close = (e) => {
3158
+ if (!e.target.closest(".w100n-docs-types")) setTyping(false);
3159
+ };
3160
+ document.addEventListener("pointerdown", close);
3161
+ return () => document.removeEventListener("pointerdown", close);
3162
+ }, [typing]);
2930
3163
  useEffect6(() => {
2931
3164
  if (!picking) return;
2932
3165
  const close = (e) => {
@@ -2935,14 +3168,20 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
2935
3168
  document.addEventListener("pointerdown", close);
2936
3169
  return () => document.removeEventListener("pointerdown", close);
2937
3170
  }, [picking]);
2938
- const [tab, setTab] = useState8("outline");
2939
- const [outline, setOutline] = useState8([]);
2940
- const [version, setVersion] = useState8({ documentId: null, id: null });
3171
+ const [tab, setTab] = useState9("outline");
3172
+ const [outline, setOutline] = useState9([]);
3173
+ const [reading, setReading] = useState9(null);
3174
+ const [hunt, setHunt] = useState9("");
3175
+ const [fold, setFold] = useState9({});
3176
+ const [version, setVersion] = useState9({ documentId: null, id: null });
2941
3177
  const versionId = version.documentId === here.documentId ? version.id : null;
2942
- const [restoring, setRestoring] = useState8("idle");
2943
- const [exporting, setExporting] = useState8("idle");
2944
- const [copying, setCopying] = useState8("idle");
2945
- const [box, setBox] = useState8(null);
3178
+ const [restoring, setRestoring] = useState9("idle");
3179
+ const [exporting, setExporting] = useState9("idle");
3180
+ const [copying, setCopying] = useState9("idle");
3181
+ const [box, setBox] = useState9(null);
3182
+ const [making, setMaking] = useState9(false);
3183
+ const [sending, setSending] = useState9("idle");
3184
+ const upload = useRef6(null);
2946
3185
  const spaces = useLoad((signal) => host.spaces({ signal }), [host]);
2947
3186
  const single = spaces.data?.length === 1 ? spaces.data[0].id : null;
2948
3187
  const spaceId = here.spaceId ?? single;
@@ -2953,14 +3192,30 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
2953
3192
  const all2 = await host.spaces({ signal });
2954
3193
  return (await Promise.all(all2.map((item) => host.documents(item.id, { signal })))).flat();
2955
3194
  }, [host, spaceId]);
3195
+ useEffect6(() => {
3196
+ const sync = () => {
3197
+ if (document.visibilityState !== "visible") return;
3198
+ spaces.retry();
3199
+ list.retry();
3200
+ };
3201
+ const timer = window.setInterval(sync, 3e4);
3202
+ window.addEventListener("focus", sync);
3203
+ document.addEventListener("visibilitychange", sync);
3204
+ return () => {
3205
+ clearInterval(timer);
3206
+ window.removeEventListener("focus", sync);
3207
+ document.removeEventListener("visibilitychange", sync);
3208
+ };
3209
+ }, []);
2956
3210
  const doc = useLoad((signal) => here.documentId ? host.document(here.documentId, { signal }) : Promise.resolve(null), [host, here.documentId]);
2957
3211
  const versions = useLoad((signal) => here.documentId ? host.versions(here.documentId, { signal }) : Promise.resolve([]), [host, here.documentId]);
2958
3212
  const content = useLoad((signal) => here.documentId ? host.content(here.documentId, versionId, { signal }) : Promise.resolve(null), [host, here.documentId, versionId]);
2959
3213
  const pdf = doc.data?.kind === "pdf";
2960
3214
  const text = doc.data?.kind === "markdown" || doc.data?.kind === "docx";
3215
+ const docbar = text && !versionId && !narrow;
2961
3216
  const signatures = useLoad((signal) => here.documentId && pdf && host.signatures ? host.signatures(here.documentId, { signal }) : Promise.resolve([]), [host, here.documentId, pdf]);
2962
3217
  const all = list.data ?? [];
2963
- const shown = all.filter((item) => matches(item, query, kind));
3218
+ const shown = all.filter((item) => matches(item, query, picked));
2964
3219
  const present = kinds.filter((item) => all.some((doc2) => doc2.kind === item));
2965
3220
  const folders = spaceId ? [.../* @__PURE__ */ new Set(["", ...shown.map((item) => item.folder ?? "")])].filter((folder2) => shown.some((item) => (item.folder ?? "") === folder2)) : [""];
2966
3221
  const names2 = new Map((spaces.data ?? []).map((item) => [item.id, item.name]));
@@ -2977,9 +3232,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
2977
3232
  return new Intl.DateTimeFormat(language, { day: "numeric", month: "short", year: "numeric" }).format(new Date(iso));
2978
3233
  };
2979
3234
  const size = (bytes) => bytes < 1024 ? `${bytes} B` : bytes < 1048576 ? `${(bytes / 1024).toFixed(0)} KB` : `${(bytes / 1048576).toFixed(1)} MB`;
2980
- const failed = (retry) => /* @__PURE__ */ jsxs8("div", { className: "w100n-docs-note", children: [
3235
+ const failed = (retry) => /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-note", children: [
2981
3236
  t.failed,
2982
- /* @__PURE__ */ jsx8("button", { type: "button", onClick: retry, children: t.retry })
3237
+ /* @__PURE__ */ jsx9("button", { type: "button", onClick: retry, children: t.retry })
2983
3238
  ] });
2984
3239
  const { ask, dialog } = useUnsaved(guard, t);
2985
3240
  const side = (which, open2) => {
@@ -2998,6 +3253,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
2998
3253
  }
2999
3254
  ask(() => {
3000
3255
  setOutline([]);
3256
+ setHunt("");
3257
+ setFold({});
3001
3258
  setTab("outline");
3002
3259
  go({ spaceId: here.spaceId, documentId: item.id });
3003
3260
  if (narrow) setListOpen(false);
@@ -3006,7 +3263,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3006
3263
  const pick = (next) => {
3007
3264
  setPicking(false);
3008
3265
  ask(() => {
3009
- setKind("all");
3266
+ setPicked([]);
3010
3267
  go({ spaceId: next, documentId: null });
3011
3268
  });
3012
3269
  };
@@ -3057,8 +3314,46 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3057
3314
  setCopying("failed");
3058
3315
  }
3059
3316
  };
3060
- let stage = /* @__PURE__ */ jsxs8("div", { className: "w100n-docs-empty", children: [
3061
- /* @__PURE__ */ jsx8(FileText2, { "aria-hidden": true }),
3317
+ const copy = async (file) => {
3318
+ setCopying("busy");
3319
+ try {
3320
+ const made = await host.create({ name: `${t.copyOf} ${file.name}`, bytes: await host.content(file.id), mimeType: file.mimeType ?? "application/octet-stream" });
3321
+ setCopying("idle");
3322
+ opened(made);
3323
+ } catch {
3324
+ setCopying("failed");
3325
+ }
3326
+ };
3327
+ const rename = async (file, draft) => {
3328
+ setRenaming(null);
3329
+ const ext = /\.[^.]+$/.exec(file.name)?.[0] ?? "";
3330
+ const name = draft.trim() && (/\.[^.\s]+$/.test(draft.trim()) ? draft.trim() : draft.trim() + ext);
3331
+ if (!name || name === file.name) return;
3332
+ try {
3333
+ await host.rename(file.id, name);
3334
+ setRenamed("idle");
3335
+ doc.retry();
3336
+ list.retry();
3337
+ } catch {
3338
+ setRenamed("failed");
3339
+ }
3340
+ };
3341
+ const opened = (made) => {
3342
+ spaces.retry();
3343
+ list.retry();
3344
+ ask(() => go({ spaceId: here.spaceId && made.spaceId, documentId: made.id }));
3345
+ };
3346
+ const send = async (file) => {
3347
+ setSending("busy");
3348
+ try {
3349
+ opened(await host.create({ name: file.name, bytes: await file.arrayBuffer(), mimeType: file.type || "application/octet-stream" }));
3350
+ setSending("idle");
3351
+ } catch {
3352
+ setSending("failed");
3353
+ }
3354
+ };
3355
+ let stage = /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-empty", children: [
3356
+ /* @__PURE__ */ jsx9(FileText3, { "aria-hidden": true }),
3062
3357
  t.pick
3063
3358
  ] });
3064
3359
  if (here.documentId) {
@@ -3066,8 +3361,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3066
3361
  doc.retry();
3067
3362
  content.retry();
3068
3363
  });
3069
- else if (!doc.data || !content.data) stage = /* @__PURE__ */ jsx8("div", { className: "w100n-docs-empty", children: t.loading });
3070
- else if (doc.data.kind === "markdown" || doc.data.kind === "docx") stage = /* @__PURE__ */ jsx8(Suspense2, { fallback: /* @__PURE__ */ jsx8("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ jsx8(
3364
+ else if (!doc.data || !content.data) stage = /* @__PURE__ */ jsx9("div", { className: "w100n-docs-empty", children: t.loading });
3365
+ else if (doc.data.kind === "markdown" || doc.data.kind === "docx") stage = /* @__PURE__ */ jsx9(Suspense2, { fallback: /* @__PURE__ */ jsx9("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ jsx9(
3071
3366
  TextEditor2,
3072
3367
  {
3073
3368
  kind: doc.data.kind,
@@ -3079,13 +3374,21 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3079
3374
  together: doc.data.live,
3080
3375
  documentId: doc.data.id,
3081
3376
  onOutline: setOutline,
3377
+ onReading: setReading,
3082
3378
  onPanel: (next) => {
3083
3379
  setPanelOpen(true);
3084
3380
  setTab(next);
3085
3381
  if (narrow) setListOpen(false);
3086
3382
  },
3087
3383
  slot: tab === "comments" && panelOpen ? box : null,
3384
+ head: docbar ? { menus: menusAt, status: statusAt } : void 0,
3088
3385
  guard,
3386
+ file: versionId ? void 0 : {
3387
+ formats: host.exportAs ? doc.data.exports ?? [] : [],
3388
+ download: (f) => void exportAs(doc.data, f),
3389
+ copy: host.create ? () => void copy(doc.data) : void 0,
3390
+ rename: host.rename && doc.data.rights.edit ? () => setRenaming(doc.data.name.replace(/\.[^.]+$/, "")) : void 0
3391
+ },
3089
3392
  onSaved: () => {
3090
3393
  versions.retry();
3091
3394
  doc.retry();
@@ -3094,7 +3397,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3094
3397
  },
3095
3398
  doc.data.id
3096
3399
  ) });
3097
- else if (doc.data.kind === "pdf") stage = /* @__PURE__ */ jsx8(
3400
+ else if (doc.data.kind === "pdf") stage = /* @__PURE__ */ jsx9(
3098
3401
  PdfView,
3099
3402
  {
3100
3403
  bytes: content.data,
@@ -3116,7 +3419,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3116
3419
  },
3117
3420
  `${doc.data.id}:${versionId ?? ""}`
3118
3421
  );
3119
- else if (doc.data.kind === "slides") stage = /* @__PURE__ */ jsx8(
3422
+ else if (doc.data.kind === "slides") stage = /* @__PURE__ */ jsx9(
3120
3423
  SlidesView,
3121
3424
  {
3122
3425
  html: new TextDecoder().decode(content.data),
@@ -3135,7 +3438,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3135
3438
  },
3136
3439
  doc.data.id
3137
3440
  );
3138
- else if (doc.data.kind === "sheet") stage = /* @__PURE__ */ jsx8(Suspense2, { fallback: /* @__PURE__ */ jsx8("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ jsx8(
3441
+ else if (doc.data.kind === "sheet") stage = /* @__PURE__ */ jsx9(Suspense2, { fallback: /* @__PURE__ */ jsx9("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ jsx9(
3139
3442
  SheetView2,
3140
3443
  {
3141
3444
  bytes: content.data,
@@ -3162,16 +3465,27 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3162
3465
  },
3163
3466
  `${doc.data.id}:${versionId ?? ""}`
3164
3467
  ) });
3165
- else stage = /* @__PURE__ */ jsx8("div", { className: "w100n-docs-empty", children: t.unsupported });
3468
+ else stage = /* @__PURE__ */ jsx9("div", { className: "w100n-docs-empty", children: t.unsupported });
3166
3469
  }
3167
- const Kind = doc.data ? icons2[doc.data.kind] : FileText2;
3470
+ const Kind = doc.data ? icons3[doc.data.kind] : FileText3;
3471
+ const top = Math.min(...outline.map((h) => h.level));
3472
+ const chapters = outline.reduce((all2, h) => {
3473
+ if (h.level === top || !all2.length) all2.push({ head: h, subs: [] });
3474
+ else all2[all2.length - 1].subs.push(h);
3475
+ return all2;
3476
+ }, []);
3477
+ const now = reading?.documentId === here.documentId ? reading : null;
3478
+ const reached = now ? chapters.findIndex((c) => c.head.id === now.id || c.subs.some((s) => s.id === now.id)) : -1;
3479
+ const words = hunt.toLocaleLowerCase().split(/\s+/).filter(Boolean);
3480
+ const hit = (h) => words.every((w) => h.text.toLocaleLowerCase().includes(w));
3481
+ const reach = (h) => h.go ? h.go() : document.getElementById(h.id)?.scrollIntoView({ behavior: "smooth", block: "start" });
3168
3482
  const crumbs = doc.data ? [names2.get(doc.data.spaceId), doc.data.folder].filter(Boolean) : space ? [space.name] : [];
3169
3483
  const panelTabs = [["outline", ListTree, t.outline], ["versions", History, t.versions], ["details", Info, t.details]];
3170
3484
  if (pdf && host.signatures) panelTabs.push(["signatures", Signature, t.signatures]);
3171
3485
  if (text && host.comments && !versionId) panelTabs.push(["comments", MessagesSquare, t.comments]);
3172
3486
  const sharing = !!host.links && !!doc.data?.rights.edit && !versionId;
3173
3487
  if (sharing) panelTabs.push(["sharing", Share2, t.sharing]);
3174
- const listToggle = /* @__PURE__ */ jsx8(
3488
+ const listToggle = /* @__PURE__ */ jsx9(
3175
3489
  "button",
3176
3490
  {
3177
3491
  ref: listButton,
@@ -3181,10 +3495,10 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3181
3495
  onClick: () => side("list", !listOpen),
3182
3496
  "aria-label": listOpen ? t.closeList : t.openList,
3183
3497
  title: listOpen ? t.closeList : t.openList,
3184
- children: listOpen ? /* @__PURE__ */ jsx8(PanelLeftClose, { "aria-hidden": true }) : /* @__PURE__ */ jsx8(PanelLeftOpen, { "aria-hidden": true })
3498
+ children: listOpen ? /* @__PURE__ */ jsx9(PanelLeftClose, { "aria-hidden": true }) : /* @__PURE__ */ jsx9(PanelLeftOpen, { "aria-hidden": true })
3185
3499
  }
3186
3500
  );
3187
- const panelToggle = doc.data && /* @__PURE__ */ jsx8(
3501
+ const panelToggle = doc.data && /* @__PURE__ */ jsx9(
3188
3502
  "button",
3189
3503
  {
3190
3504
  ref: panelButton,
@@ -3194,163 +3508,313 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3194
3508
  onClick: () => side("panel", !panelOpen),
3195
3509
  "aria-label": panelOpen ? t.closePanel : t.openPanel,
3196
3510
  title: panelOpen ? t.closePanel : t.openPanel,
3197
- children: panelOpen ? /* @__PURE__ */ jsx8(PanelRightClose, { "aria-hidden": true }) : /* @__PURE__ */ jsx8(PanelRightOpen, { "aria-hidden": true })
3511
+ children: panelOpen ? /* @__PURE__ */ jsx9(PanelRightClose, { "aria-hidden": true }) : /* @__PURE__ */ jsx9(PanelRightOpen, { "aria-hidden": true })
3198
3512
  }
3199
3513
  );
3200
- return /* @__PURE__ */ jsxs8("div", { className: "w100n-docs", "data-theme": theme, children: [
3201
- /* @__PURE__ */ jsxs8("header", { className: "w100n-docs-bar", children: [
3202
- start && /* @__PURE__ */ jsx8("span", { className: "w100n-docs-start w100n-docs-slot", children: slot(start) }),
3514
+ return /* @__PURE__ */ jsxs9("div", { className: "w100n-docs", "data-theme": theme, children: [
3515
+ /* @__PURE__ */ jsxs9("header", { className: "w100n-docs-bar", children: [
3516
+ start && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-start w100n-docs-slot", children: slot(start) }),
3203
3517
  narrow && listToggle,
3204
- /* @__PURE__ */ jsx8("span", { className: "w100n-docs-tile", "data-kind": doc.data?.kind, children: /* @__PURE__ */ jsx8(Kind, { "aria-hidden": true }) }),
3205
- /* @__PURE__ */ jsxs8("div", { className: "w100n-docs-heading", children: [
3206
- /* @__PURE__ */ jsx8("strong", { className: "w100n-docs-title", children: doc.data?.name ?? t.documents }),
3207
- crumbs.length > 0 ? /* @__PURE__ */ jsx8("span", { className: "w100n-docs-crumbs", children: crumbs.map((item, i) => /* @__PURE__ */ jsxs8("span", { children: [
3208
- i > 0 && /* @__PURE__ */ jsx8(ChevronRight2, { "aria-hidden": true }),
3518
+ /* @__PURE__ */ jsx9("span", { className: "w100n-docs-tile", "data-kind": doc.data?.kind, children: /* @__PURE__ */ jsx9(Kind, { "aria-hidden": true }) }),
3519
+ /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-heading", children: [
3520
+ renaming !== null && doc.data ? /* @__PURE__ */ jsx9(
3521
+ "input",
3522
+ {
3523
+ className: "w100n-docs-title w100n-docs-rename",
3524
+ autoFocus: true,
3525
+ value: renaming,
3526
+ "aria-label": t.rename,
3527
+ onFocus: (e) => e.currentTarget.select(),
3528
+ onChange: (e) => setRenaming(e.target.value),
3529
+ onBlur: () => void rename(doc.data, renaming),
3530
+ onKeyDown: (e) => {
3531
+ if (e.key === "Enter") e.currentTarget.blur();
3532
+ if (e.key === "Escape") {
3533
+ e.stopPropagation();
3534
+ setRenaming(null);
3535
+ }
3536
+ }
3537
+ }
3538
+ ) : /* @__PURE__ */ jsx9(
3539
+ "strong",
3540
+ {
3541
+ className: "w100n-docs-title",
3542
+ title: docbar ? crumbs.join(" / ") : void 0,
3543
+ onDoubleClick: host.rename && doc.data?.rights.edit && !versionId ? () => setRenaming(doc.data.name.replace(/\.[^.]+$/, "")) : void 0,
3544
+ children: doc.data?.name ?? t.documents
3545
+ }
3546
+ ),
3547
+ docbar ? /* @__PURE__ */ jsx9("div", { ref: setMenusAt, className: "w100n-docs-menus" }) : crumbs.length > 0 ? /* @__PURE__ */ jsx9("span", { className: "w100n-docs-crumbs", children: crumbs.map((item, i) => /* @__PURE__ */ jsxs9("span", { children: [
3548
+ i > 0 && /* @__PURE__ */ jsx9(ChevronRight2, { "aria-hidden": true }),
3209
3549
  item
3210
- ] }, i)) }) : /* @__PURE__ */ jsx8("span", { className: "w100n-docs-hint", children: t.hint })
3550
+ ] }, i)) }) : /* @__PURE__ */ jsx9("span", { className: "w100n-docs-hint", children: t.hint })
3211
3551
  ] }),
3212
- doc.data && /* @__PURE__ */ jsx8("span", { className: "w100n-docs-badge", "data-kind": doc.data.kind, children: t.kinds[doc.data.kind] }),
3213
- versionId && /* @__PURE__ */ jsx8("span", { className: "w100n-docs-badge", children: versions.data?.find((v) => v.id === versionId) && date(versions.data.find((v) => v.id === versionId).createdAt) }),
3214
- versionId && here.documentId && host.restore && doc.data?.rights.edit && /* @__PURE__ */ jsxs8("button", { type: "button", className: "w100n-docs-action", disabled: restoring === "busy", onClick: () => void restore(here.documentId, versionId), children: [
3215
- /* @__PURE__ */ jsx8(RotateCcw2, { "aria-hidden": true }),
3552
+ versionId && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-badge", children: versions.data?.find((v) => v.id === versionId) && date(versions.data.find((v) => v.id === versionId).createdAt) }),
3553
+ versionId && here.documentId && host.restore && doc.data?.rights.edit && /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-action", disabled: restoring === "busy", onClick: () => void restore(here.documentId, versionId), children: [
3554
+ /* @__PURE__ */ jsx9(RotateCcw2, { "aria-hidden": true }),
3216
3555
  t.restore
3217
3556
  ] }),
3218
- restoring === "failed" && /* @__PURE__ */ jsx8("span", { className: "w100n-docs-muted", children: t.restoreFailed }),
3219
- doc.data?.convert && host.copyAs && !versionId && /* @__PURE__ */ jsxs8("button", { type: "button", className: "w100n-docs-action", "data-tone": "green", disabled: copying === "busy", onClick: () => void copyAs(doc.data), children: [
3220
- /* @__PURE__ */ jsx8(FileSpreadsheet2, { "aria-hidden": true }),
3557
+ restoring === "failed" && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-muted", children: t.restoreFailed }),
3558
+ doc.data?.convert && host.copyAs && !versionId && /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-action", "data-tone": "green", disabled: copying === "busy", onClick: () => void copyAs(doc.data), children: [
3559
+ /* @__PURE__ */ jsx9(FileSpreadsheet3, { "aria-hidden": true }),
3221
3560
  t.copyAs
3222
3561
  ] }),
3223
- copying === "failed" && /* @__PURE__ */ jsx8("span", { className: "w100n-docs-muted", children: t.copyFailed }),
3224
- sharing && /* @__PURE__ */ jsxs8("button", { type: "button", className: "w100n-docs-action", "aria-label": t.share, title: t.share, onClick: () => {
3562
+ copying === "failed" && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-muted", children: t.copyFailed }),
3563
+ renamed === "failed" && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-muted", children: t.renameFailed }),
3564
+ docbar && /* @__PURE__ */ jsx9("span", { ref: setStatusAt, className: "w100n-docs-status" }),
3565
+ sharing && /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-action", "aria-label": t.share, title: t.share, onClick: () => {
3225
3566
  setTab("sharing");
3226
3567
  side("panel", true);
3227
3568
  }, children: [
3228
- /* @__PURE__ */ jsx8(Share2, { "aria-hidden": true }),
3229
- /* @__PURE__ */ jsx8("span", { children: t.share })
3569
+ /* @__PURE__ */ jsx9(Share2, { "aria-hidden": true }),
3570
+ /* @__PURE__ */ jsx9("span", { children: t.share })
3230
3571
  ] }),
3231
3572
  doc.data && !versionId && actions?.(doc.data),
3232
3573
  narrow && panelToggle,
3233
- end && /* @__PURE__ */ jsx8("div", { className: "w100n-docs-end w100n-docs-slot", children: slot(end) })
3574
+ end && /* @__PURE__ */ jsx9("div", { className: "w100n-docs-end w100n-docs-slot", children: slot(end) })
3234
3575
  ] }),
3235
- /* @__PURE__ */ jsxs8("div", { ref: body, className: "w100n-docs-body", children: [
3236
- listOpen && /* @__PURE__ */ jsxs8("aside", { className: "w100n-docs-side w100n-docs-list", "aria-label": t.documents, children: [
3237
- /* @__PURE__ */ jsxs8("div", { className: "w100n-docs-head", children: [
3238
- /* @__PURE__ */ jsxs8("div", { className: "w100n-docs-row", children: [
3239
- /* @__PURE__ */ jsxs8("p", { className: "w100n-docs-caption", children: [
3240
- /* @__PURE__ */ jsx8(Files2, { "aria-hidden": true }),
3576
+ /* @__PURE__ */ jsxs9("div", { ref: body, className: "w100n-docs-body", children: [
3577
+ listOpen && /* @__PURE__ */ jsxs9("aside", { className: "w100n-docs-side w100n-docs-list", "aria-label": t.documents, children: [
3578
+ /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-head", children: [
3579
+ /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-row", children: [
3580
+ /* @__PURE__ */ jsxs9("p", { className: "w100n-docs-caption", children: [
3581
+ /* @__PURE__ */ jsx9(Files2, { "aria-hidden": true }),
3241
3582
  t.documents,
3242
- /* @__PURE__ */ jsx8("span", { children: all.length })
3583
+ /* @__PURE__ */ jsx9("span", { children: all.length })
3243
3584
  ] }),
3244
- /* @__PURE__ */ jsx8("button", { ref: listClose, type: "button", className: "w100n-docs-close", onClick: () => side("list", false), "aria-label": t.closeList, title: t.closeList, children: /* @__PURE__ */ jsx8(X5, { "aria-hidden": true }) })
3585
+ host.create && /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-new", onKeyDown: (e) => {
3586
+ if (e.key === "Escape" && adding) {
3587
+ e.stopPropagation();
3588
+ setAdding(false);
3589
+ }
3590
+ }, children: [
3591
+ /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-action", "aria-haspopup": "menu", "aria-expanded": adding, disabled: sending === "busy", onClick: () => setAdding(!adding), children: [
3592
+ /* @__PURE__ */ jsx9(Plus4, { "aria-hidden": true }),
3593
+ /* @__PURE__ */ jsx9("span", { children: sending === "busy" ? t.uploading : t.create }),
3594
+ /* @__PURE__ */ jsx9(ChevronDown2, { "aria-hidden": true })
3595
+ ] }),
3596
+ adding && /* @__PURE__ */ jsxs9("div", { role: "menu", className: "w100n-docs-menu", children: [
3597
+ /* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", onClick: () => {
3598
+ setAdding(false);
3599
+ setMaking(true);
3600
+ }, children: [
3601
+ /* @__PURE__ */ jsx9("span", { className: "w100n-docs-all", children: /* @__PURE__ */ jsx9(FilePlus, { "aria-hidden": true }) }),
3602
+ /* @__PURE__ */ jsx9("b", { children: t.newTitle })
3603
+ ] }),
3604
+ /* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", onClick: () => {
3605
+ setAdding(false);
3606
+ upload.current.click();
3607
+ }, children: [
3608
+ /* @__PURE__ */ jsx9("span", { className: "w100n-docs-all", children: /* @__PURE__ */ jsx9(Upload, { "aria-hidden": true }) }),
3609
+ /* @__PURE__ */ jsx9("b", { children: t.uploadFile })
3610
+ ] })
3611
+ ] }),
3612
+ /* @__PURE__ */ jsx9("input", { ref: upload, type: "file", hidden: true, "aria-label": t.uploadFile, accept: ".docx,.md,.markdown,.pdf,.xlsx,.csv,.html,.htm", onChange: (e) => {
3613
+ const file = e.target.files?.[0];
3614
+ e.target.value = "";
3615
+ if (file) void send(file);
3616
+ } })
3617
+ ] }),
3618
+ /* @__PURE__ */ jsx9("button", { ref: listClose, type: "button", className: "w100n-docs-close", onClick: () => side("list", false), "aria-label": t.closeList, title: t.closeList, children: /* @__PURE__ */ jsx9(X6, { "aria-hidden": true }) })
3245
3619
  ] }),
3246
- (spaces.data?.length ?? 0) > 1 && /* @__PURE__ */ jsxs8("div", { className: "w100n-docs-picker", onKeyDown: (e) => {
3620
+ (spaces.data?.length ?? 0) > 1 && /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-picker", onKeyDown: (e) => {
3247
3621
  if (e.key !== "Escape" || !picking) return;
3248
3622
  e.stopPropagation();
3249
3623
  setPicking(false);
3250
3624
  e.currentTarget.querySelector("button").focus();
3251
3625
  }, children: [
3252
- /* @__PURE__ */ jsxs8("button", { type: "button", className: "w100n-docs-field", "aria-haspopup": "listbox", "aria-expanded": picking, onClick: () => setPicking(!picking), children: [
3253
- space ? /* @__PURE__ */ jsx8("span", { className: "w100n-docs-dot", style: { background: space.color ?? void 0 } }) : /* @__PURE__ */ jsx8("span", { className: "w100n-docs-all", children: /* @__PURE__ */ jsx8(LayoutGrid, { "aria-hidden": true }) }),
3254
- /* @__PURE__ */ jsx8("b", { children: space?.name ?? t.allProjects }),
3255
- !space && /* @__PURE__ */ jsx8("span", { className: "w100n-docs-count", children: all.length }),
3256
- /* @__PURE__ */ jsx8(ChevronDown2, { "aria-hidden": true })
3626
+ /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-field", "aria-haspopup": "listbox", "aria-expanded": picking, onClick: () => setPicking(!picking), children: [
3627
+ space ? /* @__PURE__ */ jsx9("span", { className: "w100n-docs-dot", style: { background: space.color ?? void 0 } }) : /* @__PURE__ */ jsx9("span", { className: "w100n-docs-all", children: /* @__PURE__ */ jsx9(LayoutGrid, { "aria-hidden": true }) }),
3628
+ /* @__PURE__ */ jsx9("b", { children: space?.name ?? t.allProjects }),
3629
+ !space && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-count", children: all.length }),
3630
+ /* @__PURE__ */ jsx9(ChevronDown2, { "aria-hidden": true })
3257
3631
  ] }),
3258
- picking && /* @__PURE__ */ jsxs8("div", { role: "listbox", className: "w100n-docs-menu", children: [
3259
- /* @__PURE__ */ jsxs8("button", { type: "button", role: "option", "aria-selected": !spaceId, onClick: () => pick(null), children: [
3260
- /* @__PURE__ */ jsx8("span", { className: "w100n-docs-all", children: /* @__PURE__ */ jsx8(LayoutGrid, { "aria-hidden": true }) }),
3261
- /* @__PURE__ */ jsx8("b", { children: t.allProjects }),
3262
- !spaceId && /* @__PURE__ */ jsx8(Check, { "aria-hidden": true })
3632
+ picking && /* @__PURE__ */ jsxs9("div", { role: "listbox", className: "w100n-docs-menu", children: [
3633
+ /* @__PURE__ */ jsxs9("button", { type: "button", role: "option", "aria-selected": !spaceId, onClick: () => pick(null), children: [
3634
+ /* @__PURE__ */ jsx9("span", { className: "w100n-docs-all", children: /* @__PURE__ */ jsx9(LayoutGrid, { "aria-hidden": true }) }),
3635
+ /* @__PURE__ */ jsx9("b", { children: t.allProjects }),
3636
+ !spaceId && /* @__PURE__ */ jsx9(Check2, { "aria-hidden": true })
3263
3637
  ] }),
3264
- groups.map((group) => /* @__PURE__ */ jsxs8("div", { role: "group", "aria-label": group || void 0, children: [
3265
- group && /* @__PURE__ */ jsx8("p", { className: "w100n-docs-menu-caption", children: group }),
3266
- (spaces.data ?? []).filter((item) => (item.group ?? "") === group).map((item) => /* @__PURE__ */ jsxs8("button", { type: "button", role: "option", "aria-selected": item.id === spaceId, onClick: () => pick(item.id), children: [
3267
- /* @__PURE__ */ jsx8("span", { className: "w100n-docs-dot", style: { background: item.color ?? void 0 } }),
3268
- /* @__PURE__ */ jsx8("b", { children: item.name }),
3269
- !spaceId && counts.get(item.id) ? /* @__PURE__ */ jsx8("span", { className: "w100n-docs-count", children: counts.get(item.id) }) : null,
3270
- item.id === spaceId && /* @__PURE__ */ jsx8(Check, { "aria-hidden": true })
3638
+ groups.map((group) => /* @__PURE__ */ jsxs9("div", { role: "group", "aria-label": group || void 0, children: [
3639
+ group && /* @__PURE__ */ jsx9("p", { className: "w100n-docs-menu-caption", children: group }),
3640
+ (spaces.data ?? []).filter((item) => (item.group ?? "") === group).map((item) => /* @__PURE__ */ jsxs9("button", { type: "button", role: "option", "aria-selected": item.id === spaceId, onClick: () => pick(item.id), children: [
3641
+ /* @__PURE__ */ jsx9("span", { className: "w100n-docs-dot", style: { background: item.color ?? void 0 } }),
3642
+ /* @__PURE__ */ jsx9("b", { children: item.name }),
3643
+ !spaceId && counts.get(item.id) ? /* @__PURE__ */ jsx9("span", { className: "w100n-docs-count", children: counts.get(item.id) }) : null,
3644
+ item.id === spaceId && /* @__PURE__ */ jsx9(Check2, { "aria-hidden": true })
3271
3645
  ] }, item.id))
3272
3646
  ] }, group))
3273
3647
  ] })
3274
3648
  ] }),
3275
- /* @__PURE__ */ jsxs8("label", { className: "w100n-docs-field w100n-docs-search", children: [
3276
- /* @__PURE__ */ jsx8(Search2, { "aria-hidden": true }),
3277
- /* @__PURE__ */ jsx8("input", { value: query, onChange: (event) => setQuery(event.target.value), placeholder: t.search, "aria-label": t.search })
3649
+ /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-filters", children: [
3650
+ /* @__PURE__ */ jsxs9("label", { className: "w100n-docs-field w100n-docs-search", children: [
3651
+ /* @__PURE__ */ jsx9(Search2, { "aria-hidden": true }),
3652
+ /* @__PURE__ */ jsx9("input", { value: query, onChange: (event) => setQuery(event.target.value), placeholder: t.search, "aria-label": t.search })
3653
+ ] }),
3654
+ present.length > 1 && /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-types", onKeyDown: (e) => {
3655
+ if (e.key !== "Escape" || !typing) return;
3656
+ e.stopPropagation();
3657
+ setTyping(false);
3658
+ e.currentTarget.querySelector("button").focus();
3659
+ }, children: [
3660
+ /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-field", "aria-haspopup": "listbox", "aria-expanded": typing, "data-on": picked.length > 0, onClick: () => setTyping(!typing), children: [
3661
+ /* @__PURE__ */ jsx9(ListFilter, { "aria-hidden": true }),
3662
+ /* @__PURE__ */ jsx9("b", { children: t.typeFilter }),
3663
+ picked.length > 0 && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-badge", children: picked.length }),
3664
+ /* @__PURE__ */ jsx9(ChevronDown2, { "aria-hidden": true })
3665
+ ] }),
3666
+ typing && /* @__PURE__ */ jsxs9("div", { role: "listbox", "aria-multiselectable": true, "aria-label": t.kind, className: "w100n-docs-menu", children: [
3667
+ present.map((item) => {
3668
+ const Icon = icons3[item];
3669
+ const on = picked.includes(item);
3670
+ return /* @__PURE__ */ jsxs9("button", { type: "button", role: "option", "aria-selected": on, onClick: () => setPicked(on ? picked.filter((k) => k !== item) : [...picked, item]), children: [
3671
+ /* @__PURE__ */ jsx9("span", { className: "w100n-docs-box", children: on && /* @__PURE__ */ jsx9(Check2, { "aria-hidden": true }) }),
3672
+ /* @__PURE__ */ jsx9("span", { className: "w100n-docs-tile", "data-kind": item, children: /* @__PURE__ */ jsx9(Icon, { "aria-hidden": true }) }),
3673
+ /* @__PURE__ */ jsx9("b", { children: t.kinds[item] }),
3674
+ /* @__PURE__ */ jsx9("span", { className: "w100n-docs-count", children: all.filter((doc2) => doc2.kind === item).length })
3675
+ ] }, item);
3676
+ }),
3677
+ /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-menu-foot", children: [
3678
+ /* @__PURE__ */ jsx9("button", { type: "button", onClick: () => setPicked(present), children: t.selectAll }),
3679
+ /* @__PURE__ */ jsx9("button", { type: "button", onClick: () => setPicked([]), children: t.clearPick })
3680
+ ] })
3681
+ ] })
3682
+ ] })
3278
3683
  ] }),
3279
- present.length > 1 && /* @__PURE__ */ jsx8("div", { className: "w100n-docs-chips", role: "group", "aria-label": t.kind, children: ["all", ...present].map((item) => /* @__PURE__ */ jsxs8("button", { type: "button", "aria-pressed": kind === item, onClick: () => setKind(item), children: [
3280
- item === "all" ? t.all : t.kinds[item],
3281
- /* @__PURE__ */ jsx8("span", { "aria-hidden": true, children: item === "all" ? all.length : all.filter((doc2) => doc2.kind === item).length })
3684
+ picked.length > 0 && /* @__PURE__ */ jsx9("div", { className: "w100n-docs-chips", role: "group", "aria-label": t.kind, children: picked.map((item) => /* @__PURE__ */ jsxs9("button", { type: "button", "aria-pressed": true, "aria-label": `${t.clearPick}: ${t.kinds[item]}`, onClick: () => setPicked(picked.filter((k) => k !== item)), children: [
3685
+ t.kinds[item],
3686
+ /* @__PURE__ */ jsx9(X6, { "aria-hidden": true })
3282
3687
  ] }, item)) })
3283
3688
  ] }),
3284
- /* @__PURE__ */ jsxs8("div", { className: "w100n-docs-cards", children: [
3689
+ /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-cards", children: [
3690
+ sending === "failed" && /* @__PURE__ */ jsx9("p", { className: "w100n-docs-muted", role: "alert", children: t.uploadFailed }),
3285
3691
  list.error && failed(list.retry),
3286
- list.loading && !list.data && /* @__PURE__ */ jsx8("p", { className: "w100n-docs-muted", children: t.loading }),
3287
- list.data && !shown.length && /* @__PURE__ */ jsx8("p", { className: "w100n-docs-muted", children: all.length ? t.nothing : t.empty }),
3288
- folders.map((folder2) => /* @__PURE__ */ jsxs8("div", { className: "w100n-docs-folder", role: "group", "aria-label": folder2 || t.loose, children: [
3289
- folders.length > 1 && /* @__PURE__ */ jsx8("p", { className: "w100n-docs-group", children: folder2 || t.loose }),
3290
- /* @__PURE__ */ jsx8("div", { className: "w100n-docs-grid", children: shown.filter((item) => !spaceId || (item.folder ?? "") === folder2).map((item) => /* @__PURE__ */ jsxs8("button", { type: "button", className: "w100n-docs-card", "aria-current": item.id === here.documentId, onClick: () => open(item), title: item.name, children: [
3291
- /* @__PURE__ */ jsx8(Thumb, { host, item, label: t.kinds[item.kind] }),
3292
- /* @__PURE__ */ jsxs8("span", { className: "w100n-docs-card-text", children: [
3293
- /* @__PURE__ */ jsx8("b", { children: item.name }),
3294
- /* @__PURE__ */ jsx8("small", { children: [!spaceId && names2.get(item.spaceId), ago(item.updatedAt)].filter(Boolean).join(" \xB7 ") })
3692
+ list.loading && !list.data && /* @__PURE__ */ jsx9("p", { className: "w100n-docs-muted", children: t.loading }),
3693
+ list.data && !shown.length && /* @__PURE__ */ jsx9("p", { className: "w100n-docs-muted", children: all.length ? t.nothing : t.empty }),
3694
+ folders.map((folder2) => /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-folder", role: "group", "aria-label": folder2 || t.loose, children: [
3695
+ folders.length > 1 && /* @__PURE__ */ jsx9("p", { className: "w100n-docs-group", children: folder2 || t.loose }),
3696
+ /* @__PURE__ */ jsx9("div", { className: "w100n-docs-grid", children: shown.filter((item) => !spaceId || (item.folder ?? "") === folder2).map((item) => /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-card", "aria-current": item.id === here.documentId, onClick: () => open(item), title: item.name, children: [
3697
+ /* @__PURE__ */ jsx9(Thumb, { host, item, label: t.kinds[item.kind] }),
3698
+ /* @__PURE__ */ jsxs9("span", { className: "w100n-docs-card-text", children: [
3699
+ /* @__PURE__ */ jsx9("b", { children: item.name }),
3700
+ /* @__PURE__ */ jsx9("small", { children: [!spaceId && names2.get(item.spaceId), ago(item.updatedAt)].filter(Boolean).join(" \xB7 ") })
3295
3701
  ] })
3296
3702
  ] }, item.id)) })
3297
3703
  ] }, folder2))
3298
3704
  ] })
3299
3705
  ] }),
3300
3706
  !narrow && !listOpen && listToggle,
3301
- /* @__PURE__ */ jsxs8("main", { className: "w100n-docs-stage", children: [
3707
+ /* @__PURE__ */ jsxs9("main", { className: "w100n-docs-stage", children: [
3302
3708
  !narrow && !panelOpen && panelToggle,
3303
- /* @__PURE__ */ jsx8("div", { className: "w100n-docs-bare", children: stage })
3709
+ /* @__PURE__ */ jsx9("div", { className: "w100n-docs-bare", children: stage })
3304
3710
  ] }),
3305
- doc.data && panelOpen && /* @__PURE__ */ jsxs8("aside", { ref: panel, className: "w100n-docs-side w100n-docs-panel", "aria-label": t.details, children: [
3306
- /* @__PURE__ */ jsx8("div", { className: "w100n-docs-head", children: /* @__PURE__ */ jsxs8("div", { className: "w100n-docs-row", children: [
3307
- /* @__PURE__ */ jsx8("div", { className: "w100n-docs-tabs", role: "tablist", "aria-label": t.details, "data-compact": panelTabs.length > 3, onKeyDown: rove, children: panelTabs.map(([key, Icon, label]) => /* @__PURE__ */ jsxs8("button", { type: "button", role: "tab", "aria-selected": tab === key, tabIndex: tab === key ? 0 : -1, "aria-label": label, title: label, onClick: () => setTab(key), children: [
3308
- /* @__PURE__ */ jsx8(Icon, { "aria-hidden": true }),
3711
+ doc.data && panelOpen && /* @__PURE__ */ jsxs9("aside", { ref: panel, className: "w100n-docs-side w100n-docs-panel", "aria-label": t.details, children: [
3712
+ /* @__PURE__ */ jsx9("div", { className: "w100n-docs-head", children: /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-row", children: [
3713
+ /* @__PURE__ */ jsx9("div", { className: "w100n-docs-tabs", role: "tablist", "aria-label": t.details, "data-compact": panelTabs.length > 3, onKeyDown: rove, children: panelTabs.map(([key, Icon, label]) => /* @__PURE__ */ jsxs9("button", { type: "button", role: "tab", "aria-selected": tab === key, tabIndex: tab === key ? 0 : -1, "aria-label": label, title: label, onClick: () => setTab(key), children: [
3714
+ /* @__PURE__ */ jsx9(Icon, { "aria-hidden": true }),
3309
3715
  (panelTabs.length < 4 || tab === key) && label
3310
3716
  ] }, key)) }),
3311
- /* @__PURE__ */ jsx8("button", { type: "button", className: "w100n-docs-close", onClick: () => side("panel", false), "aria-label": t.closePanel, title: t.closePanel, children: /* @__PURE__ */ jsx8(X5, { "aria-hidden": true }) })
3717
+ /* @__PURE__ */ jsx9("button", { type: "button", className: "w100n-docs-close", onClick: () => side("panel", false), "aria-label": t.closePanel, title: t.closePanel, children: /* @__PURE__ */ jsx9(X6, { "aria-hidden": true }) })
3312
3718
  ] }) }),
3313
- /* @__PURE__ */ jsxs8("div", { className: "w100n-docs-panel-body", role: "tabpanel", "aria-label": panelTabs.find(([key]) => key === tab)?.[2], children: [
3314
- tab === "outline" && (outline.length ? /* @__PURE__ */ jsx8("nav", { className: "w100n-docs-outline", children: outline.map((item) => /* @__PURE__ */ jsx8("button", { type: "button", "data-level": item.level, onClick: () => item.go ? item.go() : document.getElementById(item.id)?.scrollIntoView({ behavior: "smooth", block: "start" }), children: item.text }, item.id)) }) : /* @__PURE__ */ jsx8("p", { className: "w100n-docs-muted", children: t.noOutline })),
3315
- tab === "versions" && /* @__PURE__ */ jsxs8("div", { className: "w100n-docs-versions", children: [
3719
+ /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-panel-body", role: "tabpanel", "aria-label": panelTabs.find(([key]) => key === tab)?.[2], children: [
3720
+ tab === "outline" && (outline.length ? /* @__PURE__ */ jsxs9("nav", { className: "w100n-docs-outline", "aria-label": t.outline, children: [
3721
+ now && /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-reading", children: [
3722
+ /* @__PURE__ */ jsx9("span", { children: /* @__PURE__ */ jsx9("i", { style: { width: `${Math.round(now.progress * 100)}%` } }) }),
3723
+ /* @__PURE__ */ jsxs9("small", { children: [
3724
+ Math.round(now.progress * 100),
3725
+ "% ",
3726
+ t.read
3727
+ ] })
3728
+ ] }),
3729
+ outline.length > 8 && /* @__PURE__ */ jsxs9("label", { className: "w100n-docs-field w100n-docs-search", children: [
3730
+ /* @__PURE__ */ jsx9(Search2, { "aria-hidden": true }),
3731
+ /* @__PURE__ */ jsx9("input", { value: hunt, onChange: (e) => setHunt(e.target.value), placeholder: t.findHeading, "aria-label": t.findHeading })
3732
+ ] }),
3733
+ chapters.map((c, i) => {
3734
+ const subs = words.length ? c.subs.filter(hit) : c.subs;
3735
+ if (words.length && !hit(c.head) && !subs.length) return null;
3736
+ const opened2 = words.length > 0 || (fold[c.head.id] ?? i === reached);
3737
+ const named = /^(\d+)[.)]?\s+(.+)$/.exec(c.head.text);
3738
+ const mark = c.subs.findIndex((s) => s.id === now?.id);
3739
+ return /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-chapter", "data-state": reached < 0 ? void 0 : i < reached ? "done" : i === reached ? "now" : void 0, children: [
3740
+ /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-chapter-row", children: [
3741
+ /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-chapter-go", "aria-label": c.head.text, "aria-current": now?.id === c.head.id ? "location" : void 0, onClick: () => reach(c.head), children: [
3742
+ /* @__PURE__ */ jsx9("span", { className: "w100n-docs-chapter-num", children: named ? named[1] : /* @__PURE__ */ jsx9(Bookmark, { "aria-hidden": true }) }),
3743
+ /* @__PURE__ */ jsx9("b", { children: named ? named[2] : c.head.text })
3744
+ ] }),
3745
+ c.subs.length > 0 && /* @__PURE__ */ jsxs9(
3746
+ "button",
3747
+ {
3748
+ type: "button",
3749
+ className: "w100n-docs-chapter-fold",
3750
+ "aria-expanded": opened2,
3751
+ "aria-label": opened2 ? t.hideSections : t.showSections,
3752
+ title: opened2 ? t.hideSections : t.showSections,
3753
+ onClick: () => setFold({ ...fold, [c.head.id]: !opened2 }),
3754
+ children: [
3755
+ /* @__PURE__ */ jsx9("small", { children: c.subs.length }),
3756
+ opened2 ? /* @__PURE__ */ jsx9(ChevronDown2, { "aria-hidden": true }) : /* @__PURE__ */ jsx9(ChevronRight2, { "aria-hidden": true })
3757
+ ]
3758
+ }
3759
+ )
3760
+ ] }),
3761
+ opened2 && subs.length > 0 && /* @__PURE__ */ jsx9("div", { className: "w100n-docs-sections", children: subs.map((s) => /* @__PURE__ */ jsxs9(
3762
+ "button",
3763
+ {
3764
+ type: "button",
3765
+ "data-level": s.level - top,
3766
+ onClick: () => reach(s),
3767
+ "data-state": i < reached || i === reached && c.subs.indexOf(s) < mark ? "done" : void 0,
3768
+ "aria-current": now?.id === s.id ? "location" : void 0,
3769
+ children: [
3770
+ /* @__PURE__ */ jsx9("i", { "aria-hidden": true }),
3771
+ s.text
3772
+ ]
3773
+ },
3774
+ s.id
3775
+ )) })
3776
+ ] }, c.head.id);
3777
+ })
3778
+ ] }) : /* @__PURE__ */ jsx9("p", { className: "w100n-docs-muted", children: t.noOutline })),
3779
+ tab === "versions" && /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-versions", children: [
3316
3780
  versions.error && failed(versions.retry),
3317
- (versions.data ?? []).map((item) => /* @__PURE__ */ jsxs8(
3781
+ (versions.data ?? []).map((item) => /* @__PURE__ */ jsxs9(
3318
3782
  "button",
3319
3783
  {
3320
3784
  type: "button",
3321
3785
  "aria-pressed": (versionId ?? "current") === item.id || !versionId && item.current,
3322
3786
  onClick: () => view(item.current ? null : item.id),
3323
3787
  children: [
3324
- /* @__PURE__ */ jsxs8("b", { children: [
3788
+ /* @__PURE__ */ jsxs9("b", { children: [
3325
3789
  date(item.createdAt),
3326
- item.current && /* @__PURE__ */ jsx8("span", { className: "w100n-docs-badge", children: t.current })
3790
+ item.current && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-badge", children: t.current })
3327
3791
  ] }),
3328
- /* @__PURE__ */ jsx8("small", { children: [item.author?.name, size(item.size), item.note].filter(Boolean).join(" \xB7 ") })
3792
+ /* @__PURE__ */ jsx9("small", { children: [item.author?.name, size(item.size), item.note].filter(Boolean).join(" \xB7 ") })
3329
3793
  ]
3330
3794
  },
3331
3795
  item.id
3332
3796
  ))
3333
3797
  ] }),
3334
- tab === "details" && /* @__PURE__ */ jsxs8("dl", { className: "w100n-docs-details", children: [
3335
- /* @__PURE__ */ jsx8("dt", { children: t.kind }),
3336
- /* @__PURE__ */ jsx8("dd", { children: t.kinds[doc.data.kind] }),
3337
- /* @__PURE__ */ jsx8("dt", { children: t.size }),
3338
- /* @__PURE__ */ jsx8("dd", { children: size(doc.data.size) }),
3339
- /* @__PURE__ */ jsx8("dt", { children: t.updated }),
3340
- /* @__PURE__ */ jsx8("dd", { children: date(doc.data.updatedAt) }),
3341
- doc.data.updatedBy && /* @__PURE__ */ jsxs8(Fragment7, { children: [
3342
- /* @__PURE__ */ jsx8("dt", { children: t.by }),
3343
- /* @__PURE__ */ jsx8("dd", { children: doc.data.updatedBy.name })
3798
+ tab === "details" && /* @__PURE__ */ jsxs9("dl", { className: "w100n-docs-details", children: [
3799
+ /* @__PURE__ */ jsx9("dt", { children: t.kind }),
3800
+ /* @__PURE__ */ jsx9("dd", { children: t.kinds[doc.data.kind] }),
3801
+ /* @__PURE__ */ jsx9("dt", { children: t.size }),
3802
+ /* @__PURE__ */ jsx9("dd", { children: size(doc.data.size) }),
3803
+ /* @__PURE__ */ jsx9("dt", { children: t.updated }),
3804
+ /* @__PURE__ */ jsx9("dd", { children: date(doc.data.updatedAt) }),
3805
+ doc.data.updatedBy && /* @__PURE__ */ jsxs9(Fragment8, { children: [
3806
+ /* @__PURE__ */ jsx9("dt", { children: t.by }),
3807
+ /* @__PURE__ */ jsx9("dd", { children: doc.data.updatedBy.name })
3344
3808
  ] }),
3345
- /* @__PURE__ */ jsx8("dt", { children: t.rights }),
3346
- /* @__PURE__ */ jsx8("dd", { children: [doc.data.rights.view && t.view, doc.data.rights.comment && t.comment, doc.data.rights.edit && t.edit].filter(Boolean).join(", ") })
3809
+ /* @__PURE__ */ jsx9("dt", { children: t.rights }),
3810
+ /* @__PURE__ */ jsx9("dd", { children: [doc.data.rights.view && t.view, doc.data.rights.comment && t.comment, doc.data.rights.edit && t.edit].filter(Boolean).join(", ") })
3347
3811
  ] }),
3348
- tab === "details" && host.exportAs && !!doc.data.exports?.length && /* @__PURE__ */ jsxs8("div", { className: "w100n-docs-about", children: [
3349
- /* @__PURE__ */ jsxs8("p", { className: "w100n-docs-caption", children: [
3350
- /* @__PURE__ */ jsx8(FileDown, { "aria-hidden": true }),
3812
+ tab === "details" && host.exportAs && !!doc.data.exports?.length && /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-about", children: [
3813
+ /* @__PURE__ */ jsxs9("p", { className: "w100n-docs-caption", children: [
3814
+ /* @__PURE__ */ jsx9(FileDown, { "aria-hidden": true }),
3351
3815
  t.exportAs
3352
3816
  ] }),
3353
- /* @__PURE__ */ jsx8("div", { className: "w100n-docs-chips", children: doc.data.exports.map((format) => /* @__PURE__ */ jsxs8(
3817
+ /* @__PURE__ */ jsx9("div", { className: "w100n-docs-chips", children: doc.data.exports.map((format) => /* @__PURE__ */ jsxs9(
3354
3818
  "button",
3355
3819
  {
3356
3820
  type: "button",
@@ -3358,22 +3822,22 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3358
3822
  disabled: exporting === "busy",
3359
3823
  onClick: () => void exportAs(doc.data, format),
3360
3824
  children: [
3361
- /* @__PURE__ */ jsx8(FileDown, { "aria-hidden": true }),
3825
+ /* @__PURE__ */ jsx9(FileDown, { "aria-hidden": true }),
3362
3826
  format.toUpperCase()
3363
3827
  ]
3364
3828
  },
3365
3829
  format
3366
3830
  )) }),
3367
- exporting === "failed" && /* @__PURE__ */ jsx8("p", { className: "w100n-docs-muted", children: t.exportFailed })
3831
+ exporting === "failed" && /* @__PURE__ */ jsx9("p", { className: "w100n-docs-muted", children: t.exportFailed })
3368
3832
  ] }),
3369
- tab === "comments" && /* @__PURE__ */ jsx8("div", { ref: setBox }),
3370
- tab === "sharing" && sharing && /* @__PURE__ */ jsx8(Sharing, { host, doc: doc.data, t, language, team: names2.get(doc.data.spaceId) }),
3371
- tab === "signatures" && /* @__PURE__ */ jsxs8("div", { className: "w100n-docs-versions", children: [
3833
+ tab === "comments" && /* @__PURE__ */ jsx9("div", { ref: setBox }),
3834
+ tab === "sharing" && sharing && /* @__PURE__ */ jsx9(Sharing, { host, doc: doc.data, t, language, team: names2.get(doc.data.spaceId) }),
3835
+ tab === "signatures" && /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-versions", children: [
3372
3836
  signatures.error && failed(signatures.retry),
3373
- signatures.data?.length === 0 && /* @__PURE__ */ jsx8("p", { className: "w100n-docs-muted", children: t.noSignatures }),
3837
+ signatures.data?.length === 0 && /* @__PURE__ */ jsx9("p", { className: "w100n-docs-muted", children: t.noSignatures }),
3374
3838
  (signatures.data ?? []).map((entry) => {
3375
3839
  const signed = versions.data?.find((v) => v.id === entry.versionId);
3376
- return /* @__PURE__ */ jsxs8(
3840
+ return /* @__PURE__ */ jsxs9(
3377
3841
  "button",
3378
3842
  {
3379
3843
  type: "button",
@@ -3381,15 +3845,15 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3381
3845
  "aria-pressed": !!signed && (versionId ?? versions.data?.find((v) => v.current)?.id) === signed.id,
3382
3846
  onClick: () => view(signed.current ? null : signed.id),
3383
3847
  children: [
3384
- /* @__PURE__ */ jsxs8("b", { children: [
3848
+ /* @__PURE__ */ jsxs9("b", { children: [
3385
3849
  entry.signer.name,
3386
- /* @__PURE__ */ jsxs8("span", { className: "w100n-docs-badge", children: [
3850
+ /* @__PURE__ */ jsxs9("span", { className: "w100n-docs-badge", children: [
3387
3851
  t.page,
3388
3852
  " ",
3389
3853
  entry.page
3390
3854
  ] })
3391
3855
  ] }),
3392
- /* @__PURE__ */ jsx8("small", { children: [date(entry.signedAt), t.methods[entry.method], signed && (signed.current ? t.current : `${t.version} ${date(signed.createdAt)}`)].filter(Boolean).join(" \xB7 ") })
3856
+ /* @__PURE__ */ jsx9("small", { children: [date(entry.signedAt), t.methods[entry.method], signed && (signed.current ? t.current : `${t.version} ${date(signed.createdAt)}`)].filter(Boolean).join(" \xB7 ") })
3393
3857
  ]
3394
3858
  },
3395
3859
  entry.id
@@ -3400,17 +3864,21 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3400
3864
  ] })
3401
3865
  ] })
3402
3866
  ] }),
3867
+ making && /* @__PURE__ */ jsx9(NewDocument, { host, t, onClose: () => setMaking(false), onMade: (made) => {
3868
+ setMaking(false);
3869
+ opened(made);
3870
+ } }),
3403
3871
  dialog
3404
3872
  ] });
3405
3873
  }
3406
3874
 
3407
3875
  // src/GuestDocument.tsx
3408
- import { lazy as lazy3, Suspense as Suspense3, useRef as useRef7, useState as useState9 } from "react";
3409
- import { Ban as Ban2, Download as Download3, Eye as Eye2, FileDown as FileDown2, FileSpreadsheet as FileSpreadsheet3, FileText as FileText3, FileType as FileType3, Files as Files3, Lock as Lock2, Presentation as Presentation3, UserRound } from "lucide-react";
3410
- import { Fragment as Fragment8, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
3411
- var TextEditor3 = lazy3(() => import("./TextEditor-SPEVB5HX.js"));
3412
- var SheetView3 = lazy3(() => import("./SheetView-G3YWPH5V.js"));
3413
- var icons3 = { docx: FileText3, markdown: FileType3, pdf: Files3, sheet: FileSpreadsheet3, slides: Presentation3 };
3876
+ import { lazy as lazy3, Suspense as Suspense3, useRef as useRef7, useState as useState10 } from "react";
3877
+ import { Ban as Ban2, Download as Download3, Eye as Eye2, FileDown as FileDown2, FileSpreadsheet as FileSpreadsheet4, FileText as FileText4, FileType as FileType4, Files as Files3, Lock as Lock2, Presentation as Presentation4, UserRound } from "lucide-react";
3878
+ import { Fragment as Fragment9, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
3879
+ var TextEditor3 = lazy3(() => import("./TextEditor-VBHWUOZR.js"));
3880
+ var SheetView3 = lazy3(() => import("./SheetView-4TPL7DES.js"));
3881
+ var icons4 = { docx: FileText4, markdown: FileType4, pdf: Files3, sheet: FileSpreadsheet4, slides: Presentation4 };
3414
3882
  var GuestRefused = class extends Error {
3415
3883
  constructor(reason, file = "", sharedBy = "") {
3416
3884
  super(reason);
@@ -3435,14 +3903,14 @@ var remember = (name) => {
3435
3903
  };
3436
3904
  function GuestDocument({ host, language = "en", theme = "light", brand }) {
3437
3905
  const t = texts[language];
3438
- const [ask, setAsk] = useState9(() => ({ name: remembered() || void 0 }));
3439
- const [typed, setTyped] = useState9("");
3440
- const [name, setName] = useState9(remembered);
3906
+ const [ask, setAsk] = useState10(() => ({ name: remembered() || void 0 }));
3907
+ const [typed, setTyped] = useState10("");
3908
+ const [name, setName] = useState10(remembered);
3441
3909
  const named = useRef7(name);
3442
- const [slot, setSlot] = useState9(null);
3443
- const [saving, setSaving] = useState9("idle");
3910
+ const [slot, setSlot] = useState10(null);
3911
+ const [saving, setSaving] = useState10("idle");
3444
3912
  const opened = useLoad((signal) => host.open(ask, { signal }), [host, ask]);
3445
- const [notes] = useState9(() => ({
3913
+ const [notes] = useState10(() => ({
3446
3914
  me: { id: "", name: "" },
3447
3915
  spaces: async () => [],
3448
3916
  documents: async () => [],
@@ -3468,18 +3936,18 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
3468
3936
  };
3469
3937
  const top = (file2, badge) => {
3470
3938
  const kind2 = file2 ? kindOf(file2.name, file2.mimeType) : null;
3471
- const Kind = kind2 ? icons3[kind2] : FileText3;
3472
- return /* @__PURE__ */ jsxs9("header", { className: "w100n-docs-bar w100n-guest-bar", children: [
3473
- brand && /* @__PURE__ */ jsx9("span", { className: "w100n-guest-brand", children: brand }),
3474
- file2 && /* @__PURE__ */ jsxs9(Fragment8, { children: [
3475
- /* @__PURE__ */ jsx9("span", { className: "w100n-docs-tile", "data-kind": kind2, children: /* @__PURE__ */ jsx9(Kind, { "aria-hidden": true }) }),
3476
- /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-heading", children: [
3477
- /* @__PURE__ */ jsx9("strong", { className: "w100n-docs-title", children: file2.name }),
3478
- file2.sharedBy && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-crumbs", children: t.sharedBy.replace("{name}", file2.sharedBy) })
3939
+ const Kind = kind2 ? icons4[kind2] : FileText4;
3940
+ return /* @__PURE__ */ jsxs10("header", { className: "w100n-docs-bar w100n-guest-bar", children: [
3941
+ brand && /* @__PURE__ */ jsx10("span", { className: "w100n-guest-brand", children: brand }),
3942
+ file2 && /* @__PURE__ */ jsxs10(Fragment9, { children: [
3943
+ /* @__PURE__ */ jsx10("span", { className: "w100n-docs-tile", "data-kind": kind2, children: /* @__PURE__ */ jsx10(Kind, { "aria-hidden": true }) }),
3944
+ /* @__PURE__ */ jsxs10("div", { className: "w100n-docs-heading", children: [
3945
+ /* @__PURE__ */ jsx10("strong", { className: "w100n-docs-title", children: file2.name }),
3946
+ file2.sharedBy && /* @__PURE__ */ jsx10("span", { className: "w100n-docs-crumbs", children: t.sharedBy.replace("{name}", file2.sharedBy) })
3479
3947
  ] }),
3480
- badge && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-badge", "data-kind": kind2, children: badge }),
3481
- file2.download && /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-end", children: [
3482
- (kind2 === "docx" || kind2 === "markdown" || kind2 === "sheet" || kind2 === "slides") && /* @__PURE__ */ jsxs9(
3948
+ badge && /* @__PURE__ */ jsx10("span", { className: "w100n-docs-badge", "data-kind": kind2, children: badge }),
3949
+ file2.download && /* @__PURE__ */ jsxs10("div", { className: "w100n-docs-end", children: [
3950
+ (kind2 === "docx" || kind2 === "markdown" || kind2 === "sheet" || kind2 === "slides") && /* @__PURE__ */ jsxs10(
3483
3951
  "button",
3484
3952
  {
3485
3953
  type: "button",
@@ -3490,25 +3958,25 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
3490
3958
  "aria-label": t.pdfCopy,
3491
3959
  title: t.pdfCopy,
3492
3960
  children: [
3493
- /* @__PURE__ */ jsx9(FileDown2, { "aria-hidden": true }),
3494
- /* @__PURE__ */ jsx9("span", { children: t.pdfCopy })
3961
+ /* @__PURE__ */ jsx10(FileDown2, { "aria-hidden": true }),
3962
+ /* @__PURE__ */ jsx10("span", { children: t.pdfCopy })
3495
3963
  ]
3496
3964
  }
3497
3965
  ),
3498
- /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-action", "data-tone": "blue", disabled: saving === "busy", onClick: () => void download("file"), "aria-label": t.download, title: t.download, children: [
3499
- /* @__PURE__ */ jsx9(Download3, { "aria-hidden": true }),
3500
- /* @__PURE__ */ jsx9("span", { children: t.download })
3966
+ /* @__PURE__ */ jsxs10("button", { type: "button", className: "w100n-docs-action", "data-tone": "blue", disabled: saving === "busy", onClick: () => void download("file"), "aria-label": t.download, title: t.download, children: [
3967
+ /* @__PURE__ */ jsx10(Download3, { "aria-hidden": true }),
3968
+ /* @__PURE__ */ jsx10("span", { children: t.download })
3501
3969
  ] })
3502
3970
  ] })
3503
3971
  ] })
3504
3972
  ] });
3505
3973
  };
3506
- const gate = (tone, Icon, title, body, form) => /* @__PURE__ */ jsxs9("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
3974
+ const gate = (tone, Icon, title, body, form) => /* @__PURE__ */ jsxs10("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
3507
3975
  top(null, null),
3508
- /* @__PURE__ */ jsx9("div", { className: "w100n-guest-gate", children: /* @__PURE__ */ jsxs9("div", { className: "w100n-guest-card", children: [
3509
- /* @__PURE__ */ jsx9("span", { className: "w100n-share-tile", "data-tone": tone, children: /* @__PURE__ */ jsx9(Icon, { "aria-hidden": true }) }),
3510
- /* @__PURE__ */ jsx9("h2", { children: title }),
3511
- /* @__PURE__ */ jsx9("p", { children: body }),
3976
+ /* @__PURE__ */ jsx10("div", { className: "w100n-guest-gate", children: /* @__PURE__ */ jsxs10("div", { className: "w100n-guest-card", children: [
3977
+ /* @__PURE__ */ jsx10("span", { className: "w100n-share-tile", "data-tone": tone, children: /* @__PURE__ */ jsx10(Icon, { "aria-hidden": true }) }),
3978
+ /* @__PURE__ */ jsx10("h2", { children: title }),
3979
+ /* @__PURE__ */ jsx10("p", { children: body }),
3512
3980
  form
3513
3981
  ] }) })
3514
3982
  ] });
@@ -3524,7 +3992,7 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
3524
3992
  password ? Lock2 : UserRound,
3525
3993
  refused.file || t.documents,
3526
3994
  shared + (password ? t.passwordAsk : t.nameAsk),
3527
- /* @__PURE__ */ jsxs9("form", { className: "w100n-guest-form", onSubmit: (e) => {
3995
+ /* @__PURE__ */ jsxs10("form", { className: "w100n-guest-form", onSubmit: (e) => {
3528
3996
  e.preventDefault();
3529
3997
  if (!typed.trim()) return;
3530
3998
  if (password) setAsk({ ...ask, password: typed });
@@ -3534,7 +4002,7 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
3534
4002
  }
3535
4003
  setTyped("");
3536
4004
  }, children: [
3537
- /* @__PURE__ */ jsx9(
4005
+ /* @__PURE__ */ jsx10(
3538
4006
  "input",
3539
4007
  {
3540
4008
  className: "w100n-share-input",
@@ -3547,21 +4015,21 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
3547
4015
  onChange: (e) => setTyped(e.target.value)
3548
4016
  }
3549
4017
  ),
3550
- refused.reason === "wrong" && /* @__PURE__ */ jsx9("p", { className: "w100n-docs-muted", role: "alert", children: t.wrongPassword }),
3551
- /* @__PURE__ */ jsxs9("button", { type: "submit", className: "w100n-docs-action", disabled: !typed.trim(), children: [
3552
- /* @__PURE__ */ jsx9(Eye2, { "aria-hidden": true }),
4018
+ refused.reason === "wrong" && /* @__PURE__ */ jsx10("p", { className: "w100n-docs-muted", role: "alert", children: t.wrongPassword }),
4019
+ /* @__PURE__ */ jsxs10("button", { type: "submit", className: "w100n-docs-action", disabled: !typed.trim(), children: [
4020
+ /* @__PURE__ */ jsx10(Eye2, { "aria-hidden": true }),
3553
4021
  t.openDoc
3554
4022
  ] })
3555
4023
  ] })
3556
4024
  );
3557
4025
  }
3558
4026
  if (refused?.reason === "busy") return gate("slate", Ban2, t.failed, t.tooMany);
3559
- return gate("slate", Ban2, t.failed, "", /* @__PURE__ */ jsx9("button", { type: "button", className: "w100n-docs-action", onClick: opened.retry, children: t.retry }));
4027
+ return gate("slate", Ban2, t.failed, "", /* @__PURE__ */ jsx10("button", { type: "button", className: "w100n-docs-action", onClick: opened.retry, children: t.retry }));
3560
4028
  }
3561
4029
  const file = opened.data;
3562
- if (!file) return /* @__PURE__ */ jsxs9("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
4030
+ if (!file) return /* @__PURE__ */ jsxs10("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
3563
4031
  top(null, null),
3564
- /* @__PURE__ */ jsx9("div", { className: "w100n-docs-empty", children: t.loading })
4032
+ /* @__PURE__ */ jsx10("div", { className: "w100n-docs-empty", children: t.loading })
3565
4033
  ] });
3566
4034
  const kind = kindOf(file.name, file.mimeType);
3567
4035
  const text = kind === "docx" || kind === "markdown";
@@ -3569,23 +4037,23 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
3569
4037
  const rights = { view: true, comment: talk, edit: false };
3570
4038
  const quiet2 = () => {
3571
4039
  };
3572
- let stage = /* @__PURE__ */ jsx9("div", { className: "w100n-docs-empty", children: t.unsupported });
3573
- if (text) stage = /* @__PURE__ */ jsx9(Suspense3, { fallback: /* @__PURE__ */ jsx9("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ jsx9(TextEditor3, { kind, bytes: file.bytes, t, language, rights, host: talk ? notes : void 0, documentId: file.id, onOutline: quiet2, slot: talk ? slot : null }) });
3574
- else if (kind === "pdf") stage = /* @__PURE__ */ jsx9(PdfView, { bytes: file.bytes, t, language, worker: host.pdfWorker, rights, documentId: file.id, onOutline: quiet2 });
3575
- else if (kind === "slides") stage = /* @__PURE__ */ jsx9(SlidesView, { html: new TextDecoder().decode(file.bytes), name: file.name, rights, language, theme, onOutline: quiet2 });
3576
- else if (kind === "sheet") stage = /* @__PURE__ */ jsx9(Suspense3, { fallback: /* @__PURE__ */ jsx9("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ jsx9(SheetView3, { bytes: file.bytes, name: file.name, kind: /\.csv$/i.test(file.name) || file.mimeType === "text/csv" ? "csv" : "xlsx", rights, language, theme, documentId: file.id }) });
3577
- return /* @__PURE__ */ jsxs9("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
4040
+ let stage = /* @__PURE__ */ jsx10("div", { className: "w100n-docs-empty", children: t.unsupported });
4041
+ if (text) stage = /* @__PURE__ */ jsx10(Suspense3, { fallback: /* @__PURE__ */ jsx10("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ jsx10(TextEditor3, { kind, bytes: file.bytes, t, language, rights, host: talk ? notes : void 0, documentId: file.id, onOutline: quiet2, slot: talk ? slot : null }) });
4042
+ else if (kind === "pdf") stage = /* @__PURE__ */ jsx10(PdfView, { bytes: file.bytes, t, language, worker: host.pdfWorker, rights, documentId: file.id, onOutline: quiet2 });
4043
+ else if (kind === "slides") stage = /* @__PURE__ */ jsx10(SlidesView, { html: new TextDecoder().decode(file.bytes), name: file.name, rights, language, theme, onOutline: quiet2 });
4044
+ else if (kind === "sheet") stage = /* @__PURE__ */ jsx10(Suspense3, { fallback: /* @__PURE__ */ jsx10("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ jsx10(SheetView3, { bytes: file.bytes, name: file.name, kind: /\.csv$/i.test(file.name) || file.mimeType === "text/csv" ? "csv" : "xlsx", rights, language, theme, documentId: file.id }) });
4045
+ return /* @__PURE__ */ jsxs10("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
3578
4046
  top(file, talk ? t.badgeComment : t.badgeRead),
3579
- saving === "failed" && /* @__PURE__ */ jsx9("p", { className: "w100n-docs-muted w100n-guest-note", role: "alert", children: t.exportFailed }),
3580
- /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-body w100n-guest-body", children: [
3581
- /* @__PURE__ */ jsx9("main", { className: "w100n-docs-stage", children: /* @__PURE__ */ jsx9("div", { className: "w100n-docs-bare", children: stage }) }),
3582
- talk && /* @__PURE__ */ jsx9("aside", { className: "w100n-docs-side w100n-docs-panel w100n-guest-panel", "aria-label": t.comments, children: /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-panel-body", children: [
3583
- /* @__PURE__ */ jsxs9("label", { className: "w100n-share-field", children: [
3584
- /* @__PURE__ */ jsx9("span", { children: t.yourName }),
3585
- /* @__PURE__ */ jsx9("input", { className: "w100n-share-input", value: name, autoComplete: "name", placeholder: t.yourName, onChange: (e) => typeName(e.target.value) })
4047
+ saving === "failed" && /* @__PURE__ */ jsx10("p", { className: "w100n-docs-muted w100n-guest-note", role: "alert", children: t.exportFailed }),
4048
+ /* @__PURE__ */ jsxs10("div", { className: "w100n-docs-body w100n-guest-body", children: [
4049
+ /* @__PURE__ */ jsx10("main", { className: "w100n-docs-stage", children: /* @__PURE__ */ jsx10("div", { className: "w100n-docs-bare", children: stage }) }),
4050
+ talk && /* @__PURE__ */ jsx10("aside", { className: "w100n-docs-side w100n-docs-panel w100n-guest-panel", "aria-label": t.comments, children: /* @__PURE__ */ jsxs10("div", { className: "w100n-docs-panel-body", children: [
4051
+ /* @__PURE__ */ jsxs10("label", { className: "w100n-share-field", children: [
4052
+ /* @__PURE__ */ jsx10("span", { children: t.yourName }),
4053
+ /* @__PURE__ */ jsx10("input", { className: "w100n-share-input", value: name, autoComplete: "name", placeholder: t.yourName, onChange: (e) => typeName(e.target.value) })
3586
4054
  ] }),
3587
- /* @__PURE__ */ jsx9("p", { className: "w100n-docs-muted", children: name.trim() ? t.nameHint : t.nameNeeded }),
3588
- /* @__PURE__ */ jsx9("div", { ref: setSlot })
4055
+ /* @__PURE__ */ jsx10("p", { className: "w100n-docs-muted", children: name.trim() ? t.nameHint : t.nameNeeded }),
4056
+ /* @__PURE__ */ jsx10("div", { ref: setSlot })
3589
4057
  ] }) })
3590
4058
  ] })
3591
4059
  ] });