@w100n/documents 0.12.1 → 0.13.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 (34) hide show
  1. package/dist/{SheetView-G3YWPH5V.js → SheetView-3UAFXGZS.js} +4 -4
  2. package/dist/{TextEditor-SPEVB5HX.js → TextEditor-OLBLWC6F.js} +4 -4
  3. package/dist/{chunk-UWASFTDF.js → chunk-MRP3EURG.js} +3 -3
  4. package/dist/{chunk-UWASFTDF.js.map → chunk-MRP3EURG.js.map} +1 -1
  5. package/dist/{chunk-5NT5ALOF.js → chunk-T7XCGDE5.js} +2 -2
  6. package/dist/{chunk-BKUFGMEA.js → chunk-WR3MT7KP.js} +40 -4
  7. package/dist/{chunk-BKUFGMEA.js.map → chunk-WR3MT7KP.js.map} +1 -1
  8. package/dist/collab.cjs +40 -4
  9. package/dist/collab.cjs.map +1 -1
  10. package/dist/collab.d.cts +1 -1
  11. package/dist/collab.d.ts +1 -1
  12. package/dist/collab.js +2 -2
  13. package/dist/index.cjs +857 -603
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.css +131 -0
  16. package/dist/index.css.map +1 -1
  17. package/dist/index.d.cts +2 -2
  18. package/dist/index.d.ts +2 -2
  19. package/dist/index.js +546 -328
  20. package/dist/index.js.map +1 -1
  21. package/dist/kinds.d.cts +1 -1
  22. package/dist/kinds.d.ts +1 -1
  23. package/dist/memory.cjs +9 -1
  24. package/dist/memory.cjs.map +1 -1
  25. package/dist/memory.d.cts +1 -1
  26. package/dist/memory.d.ts +1 -1
  27. package/dist/memory.js +9 -1
  28. package/dist/memory.js.map +1 -1
  29. package/dist/{types-B5oF25dn.d.cts → types-Er60M5kL.d.cts} +6 -0
  30. package/dist/{types-B5oF25dn.d.ts → types-Er60M5kL.d.ts} +6 -0
  31. package/package.json +1 -1
  32. /package/dist/{SheetView-G3YWPH5V.js.map → SheetView-3UAFXGZS.js.map} +0 -0
  33. /package/dist/{TextEditor-SPEVB5HX.js.map → TextEditor-OLBLWC6F.js.map} +0 -0
  34. /package/dist/{chunk-5NT5ALOF.js.map → chunk-T7XCGDE5.js.map} +0 -0
package/dist/index.cjs CHANGED
@@ -310,7 +310,19 @@ var init_text = __esm({
310
310
  openForms: { one: "open", other: "opens" },
311
311
  commentForms: { one: "comment", other: "comments" },
312
312
  methods: { typed: "Typed", drawn: "Drawn", image: "Image" },
313
- kinds: { docx: "DOCX", markdown: "Markdown", pdf: "PDF", sheet: "Sheets", slides: "Slides" }
313
+ kinds: { docx: "DOCX", markdown: "Markdown", pdf: "PDF", sheet: "Sheets", slides: "Slides" },
314
+ create: "New",
315
+ newTitle: "New document",
316
+ startFrom: "Start from",
317
+ name: "Name",
318
+ savesTo: "Saves to",
319
+ make: "Create",
320
+ making: "Creating",
321
+ makeFailed: "Could not create the document",
322
+ untitled: "Untitled",
323
+ kindHints: { docx: "Word, DOCX", markdown: "MD, same editor", sheet: "Excel, XLSX", slides: "HTML slides" },
324
+ newKinds: { docx: "Document", markdown: "Markdown", sheet: "Spreadsheet", slides: "Presentation" },
325
+ templates: { blank: "Blank", letter: "Letter", contract: "Contract", notes: "Meeting notes", invoice: "Invoice", report: "Report" }
314
326
  };
315
327
  pl2 = {
316
328
  documents: "Dokumenty",
@@ -556,7 +568,19 @@ var init_text = __esm({
556
568
  openForms: { one: "otwarcie", few: "otwarcia", many: "otwar\u0107", other: "otwarcia" },
557
569
  commentForms: { one: "komentarz", few: "komentarze", many: "komentarzy", other: "komentarza" },
558
570
  methods: { typed: "Wpisany", drawn: "Narysowany", image: "Obraz" },
559
- kinds: { docx: "DOCX", markdown: "Markdown", pdf: "PDF", sheet: "Arkusze", slides: "Slajdy" }
571
+ kinds: { docx: "DOCX", markdown: "Markdown", pdf: "PDF", sheet: "Arkusze", slides: "Slajdy" },
572
+ create: "Nowy",
573
+ newTitle: "Nowy dokument",
574
+ startFrom: "Zacznij od",
575
+ name: "Nazwa",
576
+ savesTo: "Zapisze si\u0119 w",
577
+ make: "Utw\xF3rz",
578
+ making: "Tworzenie",
579
+ makeFailed: "Nie uda\u0142o si\u0119 utworzy\u0107 dokumentu",
580
+ untitled: "Bez tytu\u0142u",
581
+ kindHints: { docx: "Word, DOCX", markdown: "MD, ten sam edytor", sheet: "Excel, XLSX", slides: "Slajdy HTML" },
582
+ newKinds: { docx: "Dokument", markdown: "Markdown", sheet: "Arkusz", slides: "Prezentacja" },
583
+ templates: { blank: "Pusty", letter: "List", contract: "Umowa", notes: "Notatki ze spotkania", invoice: "Faktura", report: "Raport" }
560
584
  };
561
585
  uk2 = {
562
586
  documents: "\u0414\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0438",
@@ -802,7 +826,19 @@ var init_text = __esm({
802
826
  openForms: { one: "\u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0442\u044F", few: "\u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0442\u044F", many: "\u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0442\u0456\u0432", other: "\u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0442\u044F" },
803
827
  commentForms: { one: "\u043A\u043E\u043C\u0435\u043D\u0442\u0430\u0440", few: "\u043A\u043E\u043C\u0435\u043D\u0442\u0430\u0440\u0456", many: "\u043A\u043E\u043C\u0435\u043D\u0442\u0430\u0440\u0456\u0432", other: "\u043A\u043E\u043C\u0435\u043D\u0442\u0430\u0440\u044F" },
804
828
  methods: { typed: "\u0412\u0432\u0435\u0434\u0435\u043D\u0438\u0439", drawn: "\u041D\u0430\u043C\u0430\u043B\u044C\u043E\u0432\u0430\u043D\u0438\u0439", image: "\u0417\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u043D\u044F" },
805
- kinds: { docx: "DOCX", markdown: "Markdown", pdf: "PDF", sheet: "\u0422\u0430\u0431\u043B\u0438\u0446\u0456", slides: "\u0421\u043B\u0430\u0439\u0434\u0438" }
829
+ kinds: { docx: "DOCX", markdown: "Markdown", pdf: "PDF", sheet: "\u0422\u0430\u0431\u043B\u0438\u0446\u0456", slides: "\u0421\u043B\u0430\u0439\u0434\u0438" },
830
+ create: "\u041D\u043E\u0432\u0438\u0439",
831
+ newTitle: "\u041D\u043E\u0432\u0438\u0439 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442",
832
+ startFrom: "\u041F\u043E\u0447\u0430\u0442\u0438 \u0437",
833
+ name: "\u041D\u0430\u0437\u0432\u0430",
834
+ savesTo: "\u0417\u0431\u0435\u0440\u0435\u0436\u0435\u0442\u044C\u0441\u044F \u0432",
835
+ make: "\u0421\u0442\u0432\u043E\u0440\u0438\u0442\u0438",
836
+ making: "\u0421\u0442\u0432\u043E\u0440\u0435\u043D\u043D\u044F",
837
+ makeFailed: "\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0441\u0442\u0432\u043E\u0440\u0438\u0442\u0438 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442",
838
+ untitled: "\u0411\u0435\u0437 \u043D\u0430\u0437\u0432\u0438",
839
+ kindHints: { docx: "Word, DOCX", markdown: "MD, \u0442\u043E\u0439 \u0441\u0430\u043C\u0438\u0439 \u0440\u0435\u0434\u0430\u043A\u0442\u043E\u0440", sheet: "Excel, XLSX", slides: "HTML-\u0441\u043B\u0430\u0439\u0434\u0438" },
840
+ newKinds: { docx: "\u0414\u043E\u043A\u0443\u043C\u0435\u043D\u0442", markdown: "Markdown", sheet: "\u0422\u0430\u0431\u043B\u0438\u0446\u044F", slides: "\u041F\u0440\u0435\u0437\u0435\u043D\u0442\u0430\u0446\u0456\u044F" },
841
+ templates: { blank: "\u041F\u043E\u0440\u043E\u0436\u043D\u0456\u0439", letter: "\u041B\u0438\u0441\u0442", contract: "\u0414\u043E\u0433\u043E\u0432\u0456\u0440", notes: "\u041D\u043E\u0442\u0430\u0442\u043A\u0438 \u0437\u0443\u0441\u0442\u0440\u0456\u0447\u0456", invoice: "\u0420\u0430\u0445\u0443\u043D\u043E\u043A", report: "\u0417\u0432\u0456\u0442" }
806
842
  };
807
843
  texts = { en: en2, pl: pl2, uk: uk2 };
808
844
  }
@@ -1433,7 +1469,7 @@ var init_pkg = __esm({
1433
1469
  }
1434
1470
  };
1435
1471
  Numbering = class {
1436
- constructor(s, styles) {
1472
+ constructor(s, styles2) {
1437
1473
  this.s = s;
1438
1474
  this.nums = /* @__PURE__ */ new Map();
1439
1475
  this.abs = /* @__PURE__ */ new Map();
@@ -1470,7 +1506,7 @@ var init_pkg = __esm({
1470
1506
  }
1471
1507
  }
1472
1508
  for (const [id, style] of links) {
1473
- const pr = styles.numPr(style);
1509
+ const pr = styles2.numPr(style);
1474
1510
  const target = pr && this.nums.get(pr.num);
1475
1511
  if (target && this.abs.has(target.abs)) this.abs.set(id, this.abs.get(target.abs));
1476
1512
  }
@@ -1508,8 +1544,8 @@ var init_pkg = __esm({
1508
1544
  const theme = this.byType("/theme");
1509
1545
  const t = theme ? this.text(theme.target) ?? "" : "";
1510
1546
  const fonts = { major: /<a:majorFont>\s*<a:latin typeface="([^"]*)"/.exec(t)?.[1] ?? null, minor: /<a:minorFont>\s*<a:latin typeface="([^"]*)"/.exec(t)?.[1] ?? null };
1511
- const styles = this.byType("/styles");
1512
- this.styles = new Styles((styles && this.text(styles.target)) ?? "", fonts);
1547
+ const styles2 = this.byType("/styles");
1548
+ this.styles = new Styles((styles2 && this.text(styles2.target)) ?? "", fonts);
1513
1549
  const nums = this.byType("/numbering");
1514
1550
  this.nums = new Numbering((nums && this.text(nums.target)) ?? "", this.styles);
1515
1551
  }
@@ -1571,13 +1607,13 @@ function hyperlink(instr) {
1571
1607
  if (!m || !m[1] && !m[2]) return null;
1572
1608
  return (m[1] ?? "") + (m[2] ? "#" + m[2] : "");
1573
1609
  }
1574
- function contents(xml, styles) {
1610
+ function contents(xml, styles2) {
1575
1611
  const entries2 = [];
1576
1612
  let title = null;
1577
1613
  let begun = false;
1578
1614
  for (const p of xml.match(/<w:p\b(?:[^>]*\/>|[\s\S]*?<\/w:p>)/g) ?? []) {
1579
1615
  const id = /<w:pStyle w:val="([^"]*)"/.exec(p)?.[1] ?? "";
1580
- const level = Number(/^toc ?(\d)$/i.exec(styles.name(id).trim())?.[1] ?? /^TOC(\d)$/i.exec(id)?.[1] ?? 0);
1616
+ const level = Number(/^toc ?(\d)$/i.exec(styles2.name(id).trim())?.[1] ?? /^TOC(\d)$/i.exec(id)?.[1] ?? 0);
1581
1617
  begun || (begun = level > 0 || /w:fldCharType="begin"/.test(p));
1582
1618
  const text = (p.replace(/<w:instrText\b[\s\S]*?<\/w:instrText>/g, "").match(/<w:t(?:\s[^>]*)?>[^<]*<\/w:t>|<w:tab\/>/g) ?? []).map((m) => m === "<w:tab/>" ? " " : unescape(m.replace(/<[^>]*>/g, ""))).join("");
1583
1619
  const shown = (text.includes(" ") ? text.slice(0, text.lastIndexOf(" ")) : text).trim();
@@ -1812,7 +1848,7 @@ var init_read = __esm({
1812
1848
  p.img = { src, alt: meta2.descr ?? null, title: meta2.title ?? null, width: Math.round(p.pic.cx / 9525), height: Math.round(p.pic.cy / 9525) };
1813
1849
  }
1814
1850
  const pPr = kid(el, "w:pPr");
1815
- const styles = this.pkg.styles;
1851
+ const styles2 = this.pkg.styles;
1816
1852
  const sEl = pPr && kid(pPr, "w:pStyle");
1817
1853
  const style = sEl ? attr(s, sEl, "w:val") : null;
1818
1854
  const jc = pPr && kid(pPr, "w:jc");
@@ -1823,21 +1859,21 @@ var init_read = __esm({
1823
1859
  const bdr = pPr && kid(pPr, "w:pBdr");
1824
1860
  if (!visible && (final.some((p) => p.brk === "hr") || bdr && kid(bdr, "w:bottom") && !kid(bdr, "w:top"))) return this.block("hr", el, { type: "horizontalRule", attrs: { align: null, indent: 0, ref } }, ref);
1825
1861
  const ol = pPr && kid(pPr, "w:outlineLvl");
1826
- const level = ol ? outline(attr(s, ol, "w:val")) : styles.heading(style);
1862
+ const level = ol ? outline(attr(s, ol, "w:val")) : styles2.heading(style);
1827
1863
  const np = pPr && kid(pPr, "w:numPr");
1828
1864
  let num = null;
1829
1865
  if (np) {
1830
1866
  const id = kid(np, "w:numId");
1831
1867
  const lv = kid(np, "w:ilvl");
1832
- const fromStyle = styles.numPr(style);
1868
+ const fromStyle = styles2.numPr(style);
1833
1869
  num = { num: id ? +(attr(s, id, "w:val") ?? 0) : fromStyle?.num ?? 0, lvl: lv ? +(attr(s, lv, "w:val") ?? 0) : fromStyle?.lvl ?? 0 };
1834
- } else num = styles.numPr(style);
1870
+ } else num = styles2.numPr(style);
1835
1871
  const type = num && num.num ? this.pkg.nums.kind(num.num, num.lvl) : null;
1836
1872
  const isList = !!type && st.task === null && level === null;
1837
1873
  const ind = pPr && kid(pPr, "w:ind");
1838
1874
  const left = ind && (attr(s, ind, "w:left") ?? attr(s, ind, "w:start"));
1839
- const indent2 = isList ? 0 : Math.max(0, Math.round((left !== null && left !== void 0 ? +left : styles.left(style)) / 720));
1840
- const base = { align: align(jc ? attr(s, jc, "w:val") : styles.jc(style)), indent: indent2, ref };
1875
+ const indent2 = isList ? 0 : Math.max(0, Math.round((left !== null && left !== void 0 ? +left : styles2.left(style)) / 720));
1876
+ const base = { align: align(jc ? attr(s, jc, "w:val") : styles2.jc(style)), indent: indent2, ref };
1841
1877
  const node = level ? { type: "heading", attrs: { level, ...base } } : { type: "paragraph", attrs: base };
1842
1878
  const content = inline2(final);
1843
1879
  if (content.length) node.content = content;
@@ -1845,7 +1881,7 @@ var init_read = __esm({
1845
1881
  b.pieces = final;
1846
1882
  b.level = level;
1847
1883
  b.task = level === null ? st.task : null;
1848
- b.quote = !isList && b.task === null && level === null && !!style && /quote|block text|цитата/i.test(styles.name(style));
1884
+ b.quote = !isList && b.task === null && level === null && !!style && /quote|block text|цитата/i.test(styles2.name(style));
1849
1885
  if (isList) {
1850
1886
  const counts = this.counters.get(num.num) ?? [];
1851
1887
  counts[num.lvl] = counts[num.lvl] === void 0 ? this.pkg.nums.start(num.num, num.lvl) : counts[num.lvl] + 1;
@@ -1924,17 +1960,17 @@ var init_read = __esm({
1924
1960
  out.push({ text: null, raw: s.slice(k.start, k.end), run: null, ctx, span: null });
1925
1961
  return;
1926
1962
  }
1927
- const run = { open: opened(s, k), rPr: rPrEl ? s.slice(rPrEl.start, rPrEl.end) : "", fmt: f, el: k, parent };
1963
+ const run2 = { open: opened(s, k), rPr: rPrEl ? s.slice(rPrEl.start, rPrEl.end) : "", fmt: f, el: k, parent };
1928
1964
  const push = (text, raw, extra) => {
1929
1965
  if (text !== null && st.box) {
1930
1966
  st.box = false;
1931
1967
  if (text.startsWith(" ") && raw === null) {
1932
- out.push({ text: null, raw: '<w:t xml:space="preserve"> </w:t>', run, ctx, span: null, box: true });
1968
+ out.push({ text: null, raw: '<w:t xml:space="preserve"> </w:t>', run: run2, ctx, span: null, box: true });
1933
1969
  text = text.slice(1);
1934
1970
  if (!text) return;
1935
1971
  }
1936
1972
  }
1937
- out.push({ text, raw, run, ctx, span: null, ...extra });
1973
+ out.push({ text, raw, run: run2, ctx, span: null, ...extra });
1938
1974
  };
1939
1975
  for (const c of k.kids) {
1940
1976
  const raw = s.slice(c.start, c.end);
@@ -2507,7 +2543,7 @@ var init_write = __esm({
2507
2543
  }
2508
2544
  toc(node) {
2509
2545
  this.tocs = true;
2510
- const styles = this.pkg.styles;
2546
+ const styles2 = this.pkg.styles;
2511
2547
  const sect = this.body.sect;
2512
2548
  const twips = (el, name, fallback) => Number((el && attr(this.s, el, name)) ?? fallback);
2513
2549
  const size2 = sect && kid(sect, "w:pgSz");
@@ -2516,7 +2552,7 @@ var init_write = __esm({
2516
2552
  const list = JSON.parse(String(node.attrs?.entries ?? "[]"));
2517
2553
  const begin = '<w:r><w:fldChar w:fldCharType="begin"/></w:r><w:r><w:instrText xml:space="preserve"> TOC \\o "1-3" \\h \\z \\u </w:instrText></w:r><w:r><w:fldChar w:fldCharType="separate"/></w:r>';
2518
2554
  const end = '<w:r><w:fldChar w:fldCharType="end"/></w:r>';
2519
- const style = (test, fallback) => escape2(styles.find((name) => test.test(name.trim())) ?? fallback);
2555
+ const style = (test, fallback) => escape2(styles2.find((name) => test.test(name.trim())) ?? fallback);
2520
2556
  const title = node.attrs?.title ? `<w:p><w:pPr><w:pStyle w:val="${style(/^toc heading$/i, "TOCHeading")}"/></w:pPr><w:r><w:t xml:space="preserve">${escape2(String(node.attrs.title))}</w:t></w:r></w:p>` : "";
2521
2557
  const rows = list.length ? list.map(([level, text], i) => `<w:p><w:pPr><w:pStyle w:val="${style(new RegExp(`^toc ${level}$`, "i"), `TOC${level}`)}"/><w:tabs><w:tab w:val="right" w:leader="dot" w:pos="${width}"/></w:tabs></w:pPr>${i ? "" : begin}<w:r><w:t xml:space="preserve">${escape2(text)}</w:t></w:r>${i === list.length - 1 ? end : ""}</w:p>`).join("") : `<w:p>${begin}<w:r><w:t>No table of contents entries found.</w:t></w:r>${end}</w:p>`;
2522
2558
  return `<w:sdt><w:sdtPr><w:docPartObj><w:docPartGallery w:val="Table of Contents"/><w:docPartUnique/></w:docPartObj></w:sdtPr><w:sdtContent>${title}${rows}</w:sdtContent></w:sdt>`;
@@ -2585,7 +2621,7 @@ var init_write = __esm({
2585
2621
  }
2586
2622
  pPr(o, b, src, pr) {
2587
2623
  const s = this.s;
2588
- const styles = this.pkg.styles;
2624
+ const styles2 = this.pkg.styles;
2589
2625
  const el = src && kid(src.el, "w:pPr");
2590
2626
  let xml = el ? s.slice(el.start, el.end) : "";
2591
2627
  const set = {};
@@ -2602,34 +2638,34 @@ var init_write = __esm({
2602
2638
  if (level !== was.level) {
2603
2639
  set["w:outlineLvl"] = null;
2604
2640
  if (level) style = this.headingStyle(level);
2605
- else if (styles.heading(style)) style = null;
2641
+ else if (styles2.heading(style)) style = null;
2606
2642
  }
2607
2643
  if (!level && o.quote !== was.quote) style = o.quote ? this.quoteStyle() : null;
2608
2644
  if (pr) {
2609
2645
  if (!(was.list && was.list.num === pr.num && was.list.lvl === pr.lvl)) set["w:numPr"] = `<w:numPr><w:ilvl w:val="${pr.lvl}"/><w:numId w:val="${pr.num}"/></w:numPr>`;
2610
2646
  if (!was.list) {
2611
2647
  set["w:ind"] = null;
2612
- if (!src) style = styles.find((name) => /^list paragraph$/i.test(name));
2648
+ if (!src) style = styles2.find((name) => /^list paragraph$/i.test(name));
2613
2649
  }
2614
2650
  } else if (was.list || get("w:numPr")) {
2615
2651
  set["w:numPr"] = null;
2616
- if (styles.numPr(style)) style = null;
2652
+ if (styles2.numPr(style)) style = null;
2617
2653
  }
2618
2654
  if (style !== was.style) set["w:pStyle"] = style ? `<w:pStyle w:val="${escape2(style)}"/>` : null;
2619
2655
  const jcEl = "w:jc" in set ? void 0 : get("w:jc");
2620
2656
  const direct = jcEl ? attr(xml, jcEl, "w:val") : null;
2621
2657
  const want = value("align", o.node.attrs?.align);
2622
- if (align(direct ?? styles.jc(style)) !== want) {
2623
- set["w:jc"] = align(styles.jc(style)) === want ? null : `<w:jc w:val="${{ center: "center", right: "right", justify: "both" }[want ?? ""] ?? "left"}"/>`;
2658
+ if (align(direct ?? styles2.jc(style)) !== want) {
2659
+ set["w:jc"] = align(styles2.jc(style)) === want ? null : `<w:jc w:val="${{ center: "center", right: "right", justify: "both" }[want ?? ""] ?? "left"}"/>`;
2624
2660
  }
2625
2661
  if (!pr) {
2626
2662
  const indEl = "w:ind" in set ? void 0 : get("w:ind");
2627
2663
  const list = indEl ? attrs(xml.slice(indEl.start, indEl.open)).filter(([k]) => k !== "w:left" && k !== "w:start") : [];
2628
2664
  const left = indEl ? attr(xml, indEl, "w:left") ?? attr(xml, indEl, "w:start") : null;
2629
2665
  const target = o.cont !== null ? this.contLeft(o) : 720 * (Number(o.node.attrs?.indent ?? 0) || 0);
2630
- const now = left !== null ? +left : styles.left(style);
2666
+ const now = left !== null ? +left : styles2.left(style);
2631
2667
  if (o.cont !== null ? now !== target : Math.max(0, Math.round(now / 720)) !== Math.round(target / 720)) {
2632
- if (target !== styles.left(style)) list.unshift(["w:left", String(target)]);
2668
+ if (target !== styles2.left(style)) list.unshift(["w:left", String(target)]);
2633
2669
  set["w:ind"] = list.length ? `<w:ind ${list.map(([k, v]) => `${k}="${escape2(v)}"`).join(" ")}/>` : null;
2634
2670
  }
2635
2671
  }
@@ -2757,18 +2793,18 @@ var init_write = __esm({
2757
2793
  const from = u.span ? u.base : u.fmt;
2758
2794
  const keep = u.ch === "\n" || keyOf(from) === want.key;
2759
2795
  const fmt = keep ? from : want.fmt;
2760
- const run = keep && u.run ? u.run : this.derive(u.run ?? paraBase.run, from, want.fmt);
2761
- out.push({ ch: u.ch, raw: u.raw, run, ctx: this.revised(this.linked(u.ctx, fmt.link, lastChar()), fmt.rev), u: keep && u.run ? u : null, fmt });
2796
+ const run2 = keep && u.run ? u.run : this.derive(u.run ?? paraBase.run, from, want.fmt);
2797
+ out.push({ ch: u.ch, raw: u.raw, run: run2, ctx: this.revised(this.linked(u.ctx, fmt.link, lastChar()), fmt.rev), u: keep && u.run ? u : null, fmt });
2762
2798
  } else {
2763
2799
  const left = lastChar();
2764
2800
  const right = next[j + 1] >= 0 ? A[next[j + 1]] : null;
2765
2801
  const base = left ? { run: left.run, fmt: left.fmt } : right ? { run: right.run ?? paraBase.run, fmt: right.span ? right.base : right.fmt } : paraBase;
2766
- const run = keyOf(base.fmt) === want.key ? base.run : this.derive(base.run, base.fmt, want.fmt);
2802
+ const run2 = keyOf(base.fmt) === want.key ? base.run : this.derive(base.run, base.fmt, want.fmt);
2767
2803
  const shared = [];
2768
2804
  if (left && right) {
2769
2805
  for (let k = 0; k < left.ctx.length && left.ctx[k] === right.ctx[k]; k++) if (!left.ctx[k].link) shared.push(left.ctx[k]);
2770
2806
  }
2771
- out.push({ ch: want.ch, raw: null, run, ctx: this.revised(this.linked(shared, want.fmt.link, left), want.fmt.rev), u: null, fmt: want.fmt });
2807
+ out.push({ ch: want.ch, raw: null, run: run2, ctx: this.revised(this.linked(shared, want.fmt.link, left), want.fmt.rev), u: null, fmt: want.fmt });
2772
2808
  }
2773
2809
  }
2774
2810
  let xml = "";
@@ -2851,10 +2887,10 @@ var init_write = __esm({
2851
2887
  this.relIds.add(`rId${n}`);
2852
2888
  return `rId${n}`;
2853
2889
  }
2854
- derive(run, from, to) {
2855
- const cache2 = run.derived ?? (run.derived = /* @__PURE__ */ new Map());
2890
+ derive(run2, from, to) {
2891
+ const cache2 = run2.derived ?? (run2.derived = /* @__PURE__ */ new Map());
2856
2892
  const key2 = keyOf(from) + ">" + keyOf(to);
2857
- if (!cache2.has(key2)) cache2.set(key2, { open: run.open, rPr: this.delta(run.rPr, from, to), fmt: to, el: null, parent: null });
2893
+ if (!cache2.has(key2)) cache2.set(key2, { open: run2.open, rPr: this.delta(run2.rPr, from, to), fmt: to, el: null, parent: null });
2858
2894
  return cache2.get(key2);
2859
2895
  }
2860
2896
  delta(rPr, from, to) {
@@ -2902,8 +2938,8 @@ var init_write = __esm({
2902
2938
  } else if (!to.link && from.link && this.pkg.styles.isLink(style)) set["w:rStyle"] = null;
2903
2939
  return Object.keys(set).length ? rebuild(rPr, "w:rPr", R, set) : rPr;
2904
2940
  }
2905
- runXml(run, glyphs, counts) {
2906
- if (run.el && glyphs.length === counts.get(run) && glyphs.every((g, n) => g.u && g.u.run === run && g.u.idx === n)) return this.s.slice(run.el.start, run.el.end);
2941
+ runXml(run2, glyphs, counts) {
2942
+ if (run2.el && glyphs.length === counts.get(run2) && glyphs.every((g, n) => g.u && g.u.run === run2 && g.u.idx === n)) return this.s.slice(run2.el.start, run2.el.end);
2907
2943
  let body = "";
2908
2944
  let text = "";
2909
2945
  const tag = glyphs[0]?.ctx.some((w) => w.rev?.startsWith('["del"')) ? "w:delText" : "w:t";
@@ -2918,7 +2954,7 @@ var init_write = __esm({
2918
2954
  } else text += g.ch;
2919
2955
  }
2920
2956
  flush();
2921
- return run.open + run.rPr + body + "</w:r>";
2957
+ return run2.open + run2.rPr + body + "</w:r>";
2922
2958
  }
2923
2959
  embed(src) {
2924
2960
  if (!this.srcs) {
@@ -2999,15 +3035,15 @@ var init_write = __esm({
2999
3035
  const rows = o.node.content ?? [];
3000
3036
  const layout2 = grid(rows);
3001
3037
  const cols = Math.max(1, ...layout2.map((r) => r.reduce((m, sl) => Math.max(m, sl.col + sl.span), 0)));
3002
- let head;
3038
+ let head2;
3003
3039
  let tail = "";
3004
3040
  if (b) {
3005
3041
  const first = b.rows[0];
3006
3042
  const last2 = b.rows[b.rows.length - 1];
3007
- head = opened(s, b.el) + s.slice(b.el.open, first ? first.el.start - first.lead.length : b.el.close);
3043
+ head2 = opened(s, b.el) + s.slice(b.el.open, first ? first.el.start - first.lead.length : b.el.close);
3008
3044
  if (last2) tail = s.slice(last2.el.end, b.el.close);
3009
3045
  if (b.cols && cols !== b.cols) {
3010
- head = head.replace(/(<w:tblGrid\b[^>]*>)([\s\S]*?)(<\/w:tblGrid>)/, (_, open, inside, close) => {
3046
+ head2 = head2.replace(/(<w:tblGrid\b[^>]*>)([\s\S]*?)(<\/w:tblGrid>)/, (_, open, inside, close) => {
3011
3047
  const list = [...inside.match(/<w:gridCol\b[^>]*\/>/g) ?? []];
3012
3048
  while (list.length < cols) list.push(list[list.length - 1] ?? "<w:gridCol/>");
3013
3049
  return open + list.slice(0, cols).join("") + close;
@@ -3019,10 +3055,10 @@ var init_write = __esm({
3019
3055
  const style = this.pkg.styles.find((name) => /^(table grid|сітка таблиці|сетка таблицы)$/i.test(name), "table");
3020
3056
  const line = (side2) => `<w:${side2} w:val="single" w:sz="4" w:space="0" w:color="auto"/>`;
3021
3057
  const tblPr = pr ? s.slice(pr.start, pr.end) : `<w:tblPr>${style ? `<w:tblStyle w:val="${escape2(style)}"/>` : ""}<w:tblW w:w="0" w:type="auto"/>${style ? "" : `<w:tblBorders>${["top", "left", "bottom", "right", "insideH", "insideV"].map(line).join("")}</w:tblBorders>`}<w:tblLook w:val="04A0" w:firstRow="1" w:lastRow="0" w:firstColumn="1" w:lastColumn="0" w:noHBand="0" w:noVBand="1"/></w:tblPr>`;
3022
- head = `<w:tbl>${tblPr}<w:tblGrid>${`<w:gridCol w:w="${Math.floor(this.textWidth() / cols)}"/>`.repeat(cols)}</w:tblGrid>`;
3058
+ head2 = `<w:tbl>${tblPr}<w:tblGrid>${`<w:gridCol w:w="${Math.floor(this.textWidth() / cols)}"/>`.repeat(cols)}</w:tblGrid>`;
3023
3059
  }
3024
3060
  const width = Math.floor(this.textWidth() / cols);
3025
- let xml = head;
3061
+ let xml = head2;
3026
3062
  let above = [];
3027
3063
  let aboveRow = null;
3028
3064
  const cover = /* @__PURE__ */ new Map();
@@ -3243,7 +3279,7 @@ var init_pager = __esm({
3243
3279
  view(view) {
3244
3280
  let timer = 0;
3245
3281
  let sig2 = "";
3246
- const run = () => {
3282
+ const run2 = () => {
3247
3283
  if (!view.dom.isConnected) return;
3248
3284
  const gaps = measure(view);
3249
3285
  const next = gaps.map((g) => `${g.pos}:${g.height}`).join();
@@ -3261,7 +3297,7 @@ var init_pager = __esm({
3261
3297
  };
3262
3298
  const later = (ms) => {
3263
3299
  clearTimeout(timer);
3264
- timer = window.setTimeout(run, ms);
3300
+ timer = window.setTimeout(run2, ms);
3265
3301
  };
3266
3302
  const watch = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(() => later(200));
3267
3303
  watch?.observe(view.dom);
@@ -3505,8 +3541,8 @@ var init_extensions = __esm({
3505
3541
  const paint2 = () => {
3506
3542
  const at = getPos() ?? 0;
3507
3543
  const list = entries(editor.state.doc, this.options.relative, at);
3508
- const head = document.createElement("b");
3509
- head.textContent = this.options.label;
3544
+ const head2 = document.createElement("b");
3545
+ head2.textContent = this.options.label;
3510
3546
  const items = list.map(([level, text], i) => {
3511
3547
  const go = document.createElement("button");
3512
3548
  go.type = "button";
@@ -3520,7 +3556,7 @@ var init_extensions = __esm({
3520
3556
  });
3521
3557
  const empty = document.createElement("small");
3522
3558
  empty.textContent = this.options.empty;
3523
- dom.replaceChildren(head, ...items.length ? items : [empty]);
3559
+ dom.replaceChildren(head2, ...items.length ? items : [empty]);
3524
3560
  };
3525
3561
  paint2();
3526
3562
  return {
@@ -3764,7 +3800,7 @@ var init_extensions = __esm({
3764
3800
  var version;
3765
3801
  var init_package = __esm({
3766
3802
  "package.json"() {
3767
- version = "0.12.1";
3803
+ version = "0.13.0";
3768
3804
  }
3769
3805
  });
3770
3806
 
@@ -3843,11 +3879,11 @@ function block(token2, hints) {
3843
3879
  }];
3844
3880
  }
3845
3881
  case "table": {
3846
- const table2 = token2;
3847
- const cell2 = (type) => (c, i) => ({ type, attrs: { align: table2.align[i] }, content: [{ type: "paragraph", content: inline3(c.tokens) }] });
3882
+ const table3 = token2;
3883
+ const cell2 = (type) => (c, i) => ({ type, attrs: { align: table3.align[i] }, content: [{ type: "paragraph", content: inline3(c.tokens) }] });
3848
3884
  return [{ type: "table", content: [
3849
- { type: "tableRow", content: table2.header.map(cell2("tableHeader")) },
3850
- ...table2.rows.map((row2) => ({ type: "tableRow", content: row2.map(cell2("tableCell")) }))
3885
+ { type: "tableRow", content: table3.header.map(cell2("tableHeader")) },
3886
+ ...table3.rows.map((row2) => ({ type: "tableRow", content: row2.map(cell2("tableCell")) }))
3851
3887
  ] }];
3852
3888
  }
3853
3889
  default:
@@ -3899,7 +3935,7 @@ function fromMarkdown(source) {
3899
3935
  const hints = {};
3900
3936
  const content = [];
3901
3937
  const raws2 = [];
3902
- let head = "";
3938
+ let head2 = "";
3903
3939
  let gap = "";
3904
3940
  for (let i = 0; i < tokens.length; i++) {
3905
3941
  const token2 = tokens[i];
@@ -3910,7 +3946,7 @@ function fromMarkdown(source) {
3910
3946
  continue;
3911
3947
  }
3912
3948
  if (raws2.length) raws2[raws2.length - 1] += gap;
3913
- else head = gap;
3949
+ else head2 = gap;
3914
3950
  gap = "";
3915
3951
  content.push(...made2);
3916
3952
  raws2.push(toc ? tokens.slice(i, toc.end + 1).map((t) => t.raw).join("") : token2.raw);
@@ -3919,14 +3955,14 @@ function fromMarkdown(source) {
3919
3955
  if (!content.length) {
3920
3956
  content.push({ type: "paragraph" });
3921
3957
  raws2.push("");
3922
- head = "";
3958
+ head2 = "";
3923
3959
  }
3924
- return { doc: { type: "doc", content }, raws: raws2, head, tail: gap, style: sniff(tokens), hints, crlf, bom };
3960
+ return { doc: { type: "doc", content }, raws: raws2, head: head2, tail: gap, style: sniff(tokens), hints, crlf, bom };
3925
3961
  }
3926
3962
  function serializer(style, hints, before, cell2 = false) {
3927
3963
  let form = null;
3928
3964
  const hint = (node) => hints[node.attrs.ref] ?? {};
3929
- const run = (parent, index, types2) => {
3965
+ const run2 = (parent, index, types2) => {
3930
3966
  let n = 0;
3931
3967
  for (let i = index - 1; i >= 0 && types2.includes(parent.child(i).type.name); i--) n++;
3932
3968
  if (!index && before && types2.includes(before.type.name)) n++;
@@ -3940,10 +3976,10 @@ function serializer(style, hints, before, cell2 = false) {
3940
3976
  state.options.tightLists = was;
3941
3977
  };
3942
3978
  const list = (state, node, parent, index) => {
3943
- const bullet = hint(node).bullet ?? (run(parent, index, ["bulletList", "taskList"]) ? style.bullet === "-" ? "*" : "-" : style.bullet);
3979
+ const bullet = hint(node).bullet ?? (run2(parent, index, ["bulletList", "taskList"]) ? style.bullet === "-" ? "*" : "-" : style.bullet);
3944
3980
  tight(state, node, () => state.renderList(node, " ", () => `${bullet} `));
3945
3981
  };
3946
- const blank5 = { open: "", close: "", mixable: true };
3982
+ const blank6 = { open: "", close: "", mixable: true };
3947
3983
  const wrap = (open, close = open) => ({ open, close, mixable: true, expelEnclosingWhitespace: true });
3948
3984
  return new import_prosemirror_markdown.MarkdownSerializer({
3949
3985
  paragraph(state, node) {
@@ -3988,7 +4024,7 @@ ${lines2.join("")}<!-- /toc -->`);
3988
4024
  taskList: list,
3989
4025
  orderedList(state, node, parent, index) {
3990
4026
  const start = node.attrs.start ?? 1;
3991
- const delim = hint(node).delim ?? (run(parent, index, ["orderedList"]) ? style.delim === "." ? ")" : "." : style.delim);
4027
+ const delim = hint(node).delim ?? (run2(parent, index, ["orderedList"]) ? style.delim === "." ? ")" : "." : style.delim);
3992
4028
  const width = String(start + node.childCount - 1).length;
3993
4029
  tight(state, node, () => state.renderList(node, " ".repeat(width + 2), (i) => `${start + i}${delim} `));
3994
4030
  },
@@ -4043,8 +4079,8 @@ ${lines2.join("")}<!-- /toc -->`);
4043
4079
  strike: wrap("~~"),
4044
4080
  underline: wrap("<u>", "</u>"),
4045
4081
  highlight: wrap("<mark>", "</mark>"),
4046
- textStyle: blank5,
4047
- comment: blank5,
4082
+ textStyle: blank6,
4083
+ comment: blank6,
4048
4084
  link: {
4049
4085
  open(state, mark, parent, index) {
4050
4086
  form = plain2(mark, parent, index);
@@ -4117,7 +4153,7 @@ var init_markdown = __esm({
4117
4153
  return nodes.length === parsed.raws.length ? { ...parsed, nodes } : { ...parsed, nodes: [], raws: [], head: "", tail: "\n" };
4118
4154
  };
4119
4155
  ticks = (node, side2) => {
4120
- const len = Math.max(0, ...(node.isText ? node.text.match(/`+/g) ?? [] : []).map((run) => run.length));
4156
+ const len = Math.max(0, ...(node.isText ? node.text.match(/`+/g) ?? [] : []).map((run2) => run2.length));
4121
4157
  return len ? side2 > 0 ? ` ${"`".repeat(len + 1)}` : `${"`".repeat(len + 1)} ` : "`";
4122
4158
  };
4123
4159
  plain2 = (mark, parent, index) => {
@@ -4156,10 +4192,10 @@ var init_model = __esm({
4156
4192
  "src/sheets/model.ts"() {
4157
4193
  "use strict";
4158
4194
  SheetRefusal = class extends Error {
4159
- constructor(code, sheet = "") {
4195
+ constructor(code, sheet2 = "") {
4160
4196
  super(code);
4161
4197
  this.code = code;
4162
- this.sheet = sheet;
4198
+ this.sheet = sheet2;
4163
4199
  }
4164
4200
  };
4165
4201
  counter = 0;
@@ -4212,11 +4248,11 @@ function encode(text, encoding, bom) {
4212
4248
  for (let i = 0; i < text.length; i++) view.setUint16(at + i * 2, text.charCodeAt(i), encoding === "utf-16le");
4213
4249
  return out2;
4214
4250
  }
4215
- const table2 = /* @__PURE__ */ new Map();
4251
+ const table3 = /* @__PURE__ */ new Map();
4216
4252
  const decoder2 = new TextDecoder(encoding);
4217
- for (let b = 255; b >= 0; b--) table2.set(decoder2.decode(new Uint8Array([b])), b);
4253
+ for (let b = 255; b >= 0; b--) table3.set(decoder2.decode(new Uint8Array([b])), b);
4218
4254
  const out = new Uint8Array(text.length);
4219
- for (let i = 0; i < text.length; i++) out[i] = table2.get(text[i]) ?? 63;
4255
+ for (let i = 0; i < text.length; i++) out[i] = table3.get(text[i]) ?? 63;
4220
4256
  return out;
4221
4257
  }
4222
4258
  function split(text, delimiter, limit = Infinity) {
@@ -4327,8 +4363,8 @@ function writeCsv(original, model) {
4327
4363
  const old = split(text, format.delimiter);
4328
4364
  if (format.end && old.length && old[old.length - 1].length === 1 && old[old.length - 1][0].raw === "") old.pop();
4329
4365
  const sid = model.book.sheetOrder[0];
4330
- const sheet = model.book.sheets[sid];
4331
- const cells = sheet.cellData ?? {};
4366
+ const sheet2 = model.book.sheets[sid];
4367
+ const cells = sheet2.cellData ?? {};
4332
4368
  const lines2 = model.lines[sid], origin = model.origin.lines[sid] ?? lines2;
4333
4369
  const rowFrom = new Map(origin.rows.map((id, i) => [id, i])), colFrom = new Map(origin.cols.map((id, i) => [id, i]));
4334
4370
  const quote2 = (s) => s.includes(format.delimiter) || s.includes('"') || s.includes("\n") || s.includes("\r") ? `"${s.replace(/"/g, '""')}"` : s;
@@ -4496,14 +4532,14 @@ function squeeze(b, rows, cols) {
4496
4532
  return r && c ? { startRow: r[0], endRow: r[1], startColumn: c[0], endColumn: c[1] } : null;
4497
4533
  }
4498
4534
  function refs(formula, visit) {
4499
- let sheet = null;
4535
+ let sheet2 = null;
4500
4536
  let outside = false;
4501
4537
  let last2 = 0;
4502
4538
  let out = "";
4503
4539
  token.lastIndex = 0;
4504
4540
  for (let m = token.exec(formula); m; m = token.exec(formula)) {
4505
4541
  if (m[1]) {
4506
- sheet = null;
4542
+ sheet2 = null;
4507
4543
  continue;
4508
4544
  }
4509
4545
  if (m[3]) {
@@ -4511,18 +4547,18 @@ function refs(formula, visit) {
4511
4547
  continue;
4512
4548
  }
4513
4549
  if (m[2]) {
4514
- sheet = outside ? "\0" : m[2].startsWith("'") ? m[2].slice(1, -1).replace(/''/g, "'") : m[2];
4550
+ sheet2 = outside ? "\0" : m[2].startsWith("'") ? m[2].slice(1, -1).replace(/''/g, "'") : m[2];
4515
4551
  outside = false;
4516
4552
  continue;
4517
4553
  }
4518
4554
  const before = formula[m.index - 1];
4519
4555
  if (before && /[\w.À-￿]/.test(before)) {
4520
- sheet = null;
4556
+ sheet2 = null;
4521
4557
  continue;
4522
4558
  }
4523
- out += formula.slice(last2, m.index) + visit({ sheet: before === "!" ? sheet : null, text: m[4] });
4559
+ out += formula.slice(last2, m.index) + visit({ sheet: before === "!" ? sheet2 : null, text: m[4] });
4524
4560
  last2 = m.index + m[0].length;
4525
- sheet = null;
4561
+ sheet2 = null;
4526
4562
  }
4527
4563
  return out + formula.slice(last2);
4528
4564
  }
@@ -4553,9 +4589,9 @@ function remapped(formula, mine, rows, cols) {
4553
4589
  }
4554
4590
  function renamed(formula, from, to) {
4555
4591
  token.lastIndex = 0;
4556
- return formula.replace(token, (all, str, sheet) => {
4557
- if (str || !sheet) return all;
4558
- const name = sheet.startsWith("'") ? sheet.slice(1, -1).replace(/''/g, "'") : sheet;
4592
+ return formula.replace(token, (all, str, sheet2) => {
4593
+ if (str || !sheet2) return all;
4594
+ const name = sheet2.startsWith("'") ? sheet2.slice(1, -1).replace(/''/g, "'") : sheet2;
4559
4595
  return name === from ? `${quoted(to)}!` : all;
4560
4596
  });
4561
4597
  }
@@ -4897,8 +4933,8 @@ var init_styles = __esm({
4897
4933
  if (known !== void 0) return known;
4898
4934
  const was = this.looks[base] ?? {};
4899
4935
  const xf = this.xfs[base] ?? this.xfs[0];
4900
- const head = xf.slice(0, xf.indexOf(">") + 1);
4901
- const a = new Map(attrs(head));
4936
+ const head2 = xf.slice(0, xf.indexOf(">") + 1);
4937
+ const a = new Map(attrs(head2));
4902
4938
  const same4 = (keys2) => keys2.every((k) => JSON.stringify(was[k]) === JSON.stringify(look[k]));
4903
4939
  const p = this.prefix();
4904
4940
  if (!same4(["bl", "it", "st", "ul", "va", "fs", "ff", "cl"])) {
@@ -4917,7 +4953,7 @@ var init_styles = __esm({
4917
4953
  a.set("numFmtId", String(this.format(look.n?.pattern ?? "General")));
4918
4954
  a.set("applyNumberFormat", "1");
4919
4955
  }
4920
- let inner2 = xf.endsWith("/>") && xf.indexOf(">") === xf.length - 1 ? "" : xf.slice(head.length, xf.lastIndexOf("<"));
4956
+ let inner2 = xf.endsWith("/>") && xf.indexOf(">") === xf.length - 1 ? "" : xf.slice(head2.length, xf.lastIndexOf("<"));
4921
4957
  if (!same4(["ht", "vt", "tb", "tr"])) {
4922
4958
  const old = /<(?:\w+:)?alignment\b[^>]*>/.exec(inner2)?.[0];
4923
4959
  const al = new Map(old ? attrs(old) : []);
@@ -4930,7 +4966,7 @@ var init_styles = __esm({
4930
4966
  inner2 = old ? inner2.replace(old, tag) : tag + inner2;
4931
4967
  a.set("applyAlignment", "1");
4932
4968
  }
4933
- const name = head.slice(1, head.search(/[\s/>]/));
4969
+ const name = head2.slice(1, head2.search(/[\s/>]/));
4934
4970
  const open = `<${name} ${[...a].map(([k, v]) => `${k}="${escape2(v)}"`).join(" ")}`;
4935
4971
  const next = inner2 ? `${open}>${inner2}</${name}>` : `${open}/>`;
4936
4972
  this.xfs.push(next);
@@ -5059,7 +5095,7 @@ function load2(bytes) {
5059
5095
  const target = (type) => rels.find((r) => r.type === type)?.target;
5060
5096
  const themePart = target("theme");
5061
5097
  const stylesPart = target("styles");
5062
- const styles = new Styles2(stylesPart ? pack.text(stylesPart) : null, themePart ? pack.text(themePart) : null);
5098
+ const styles2 = new Styles2(stylesPart ? pack.text(stylesPart) : null, themePart ? pack.text(themePart) : null);
5063
5099
  const stringsPart = target("sharedStrings");
5064
5100
  const strings = [];
5065
5101
  const sst = stringsPart ? pack.text(stringsPart) : null;
@@ -5081,7 +5117,7 @@ function load2(bytes) {
5081
5117
  sheetOrder: [],
5082
5118
  sheets: {},
5083
5119
  resources: [],
5084
- defaultStyle: styles.looks[0]
5120
+ defaultStyle: styles2.looks[0]
5085
5121
  };
5086
5122
  if (date1904) book.dateSystem = "date1904";
5087
5123
  const notes2 = {};
@@ -5092,7 +5128,7 @@ function load2(bytes) {
5092
5128
  const active = Number(/<(?:\w+:)?workbookView\b[^>]*\bactiveTab="(\d+)"/.exec(xml)?.[1] ?? 0);
5093
5129
  const useStyle = (xf) => {
5094
5130
  const id = `x${xf}`;
5095
- if (!(id in book.styles)) book.styles[id] = styles.looks[xf] ?? {};
5131
+ if (!(id in book.styles)) book.styles[id] = styles2.looks[xf] ?? {};
5096
5132
  return id;
5097
5133
  };
5098
5134
  for (const entry2 of entries2) {
@@ -5103,35 +5139,35 @@ function load2(bytes) {
5103
5139
  const sid = `s${entry2.sheetId}`;
5104
5140
  const p = /<(\w+:)?worksheet\b/.exec(sxml)?.[1] ?? "";
5105
5141
  const srels = pack.rels(rel.target);
5106
- const sheet = { id: sid, name: entry2.name, cellData: {}, rowData: {}, columnData: {}, mergeData: [] };
5142
+ const sheet2 = { id: sid, name: entry2.name, cellData: {}, rowData: {}, columnData: {}, mergeData: [] };
5107
5143
  const state = attr2(entry2.xml, "state");
5108
- if (state === "hidden") sheet.hidden = 1;
5109
- if (state === "veryHidden") sheet.hidden = 2;
5144
+ if (state === "hidden") sheet2.hidden = 1;
5145
+ if (state === "veryHidden") sheet2.hidden = 2;
5110
5146
  const open = element(sxml, `${p}sheetData`);
5111
5147
  const bounds = open ? [open.start, open.open, open.close, open.end] : [sxml.length, sxml.length, sxml.length, sxml.length];
5112
- const head = open ? sxml.slice(0, open.start) : sxml;
5148
+ const head2 = open ? sxml.slice(0, open.start) : sxml;
5113
5149
  const tail = open ? sxml.slice(open.end) : "";
5114
- const format = /<(?:\w+:)?sheetFormatPr\b[^>]*>/.exec(head)?.[0];
5150
+ const format = /<(?:\w+:)?sheetFormatPr\b[^>]*>/.exec(head2)?.[0];
5115
5151
  const defaultRow = format && attr2(format, "defaultRowHeight") ? px.row(Number(attr2(format, "defaultRowHeight"))) : 20;
5116
5152
  const defaultCol = format && attr2(format, "defaultColWidth") ? px.col(Number(attr2(format, "defaultColWidth"))) : format && attr2(format, "baseColWidth") ? px.col(Number(attr2(format, "baseColWidth")) + 0.71) : 64;
5117
- sheet.defaultRowHeight = defaultRow;
5118
- sheet.defaultColumnWidth = defaultCol;
5119
- const view = /<(?:\w+:)?sheetView\b[^>]*>/.exec(head)?.[0];
5120
- if (view && attr2(view, "showGridLines") === "0") sheet.showGridlines = 0;
5121
- if (view && attr2(view, "rightToLeft") === "1") sheet.rightToLeft = 1;
5122
- if (view && attr2(view, "zoomScale")) sheet.zoomRatio = Number(attr2(view, "zoomScale")) / 100;
5123
- const pane = /<(?:\w+:)?pane\b[^>]*>/.exec(head)?.[0];
5153
+ sheet2.defaultRowHeight = defaultRow;
5154
+ sheet2.defaultColumnWidth = defaultCol;
5155
+ const view = /<(?:\w+:)?sheetView\b[^>]*>/.exec(head2)?.[0];
5156
+ if (view && attr2(view, "showGridLines") === "0") sheet2.showGridlines = 0;
5157
+ if (view && attr2(view, "rightToLeft") === "1") sheet2.rightToLeft = 1;
5158
+ if (view && attr2(view, "zoomScale")) sheet2.zoomRatio = Number(attr2(view, "zoomScale")) / 100;
5159
+ const pane = /<(?:\w+:)?pane\b[^>]*>/.exec(head2)?.[0];
5124
5160
  if (pane && /^frozen/.test(attr2(pane, "state") ?? "")) {
5125
5161
  const x = Number(attr2(pane, "xSplit") ?? 0), y = Number(attr2(pane, "ySplit") ?? 0);
5126
- sheet.freeze = { xSplit: x, ySplit: y, startRow: y, startColumn: x };
5162
+ sheet2.freeze = { xSplit: x, ySplit: y, startRow: y, startColumn: x };
5127
5163
  }
5128
- const tab = /<(?:\w+:)?tabColor\b[^>]*>/.exec(head)?.[0];
5164
+ const tab = /<(?:\w+:)?tabColor\b[^>]*>/.exec(head2)?.[0];
5129
5165
  if (tab) {
5130
- const c = styles.color(tab);
5131
- if (c) sheet.tabColor = c;
5166
+ const c = styles2.color(tab);
5167
+ if (c) sheet2.tabColor = c;
5132
5168
  }
5133
5169
  const cols = [];
5134
- for (const m of head.matchAll(/<(?:\w+:)?col\b[^>]*\/?>/g)) {
5170
+ for (const m of head2.matchAll(/<(?:\w+:)?col\b[^>]*\/?>/g)) {
5135
5171
  const t = m[0];
5136
5172
  const spec = { min: Number(attr2(t, "min")), max: Number(attr2(t, "max")), xml: t, hidden: /^(1|true)$/.test(attr2(t, "hidden") ?? "") };
5137
5173
  if (attr2(t, "width") !== null && /^(1|true)$/.test(attr2(t, "customWidth") ?? "1")) spec.width = px.col(Number(attr2(t, "width")));
@@ -5265,7 +5301,7 @@ function load2(bytes) {
5265
5301
  if (!ref) continue;
5266
5302
  merges.push(ref);
5267
5303
  for (const b of boxes2(ref)) {
5268
- sheet.mergeData.push({ startRow: b.startRow, startColumn: b.startColumn, endRow: b.endRow, endColumn: b.endColumn });
5304
+ sheet2.mergeData.push({ startRow: b.startRow, startColumn: b.startColumn, endRow: b.endRow, endColumn: b.endColumn });
5269
5305
  maxRow = Math.max(maxRow, b.endRow);
5270
5306
  maxCol = Math.max(maxCol, b.endColumn);
5271
5307
  }
@@ -5311,14 +5347,14 @@ function load2(bytes) {
5311
5347
  if (spec.width !== void 0) cd.w = spec.width;
5312
5348
  if (spec.hidden) cd.hd = 1;
5313
5349
  if (spec.style !== void 0) cd.s = useStyle(spec.style);
5314
- if (Object.keys(cd).length) sheet.columnData[c] = cd;
5350
+ if (Object.keys(cd).length) sheet2.columnData[c] = cd;
5315
5351
  }
5316
5352
  }
5317
- sheet.rowCount = height;
5318
- sheet.columnCount = width;
5319
- sheet.cellData = cellData;
5320
- sheet.rowData = rowData;
5321
- book.sheets[sid] = sheet;
5353
+ sheet2.rowCount = height;
5354
+ sheet2.columnCount = width;
5355
+ sheet2.cellData = cellData;
5356
+ sheet2.rowData = rowData;
5357
+ book.sheets[sid] = sheet2;
5322
5358
  book.sheetOrder.push(sid);
5323
5359
  model.lines[sid] = { rows: numbered("r", height), cols: numbered("c", width) };
5324
5360
  model.origin.lines[sid] = { rows: numbered("r", height), cols: numbered("c", width) };
@@ -5360,7 +5396,7 @@ function load2(bytes) {
5360
5396
  if (Object.keys(filters).length) resources.push({ name: "SHEET_FILTER_PLUGIN", data: JSON.stringify(filters) });
5361
5397
  const shown = entries2[active];
5362
5398
  if (shown?.sheet && book.sheetOrder.includes(`s${shown.sheetId}`)) model.active = `s${shown.sheetId}`;
5363
- return { model, book: { pack, part, xml, rels, styles, stylesPart: stylesPart ?? null, sheets, entries: entries2 } };
5399
+ return { model, book: { pack, part, xml, rels, styles: styles2, stylesPart: stylesPart ?? null, sheets, entries: entries2 } };
5364
5400
  }
5365
5401
  function validation(xml, uid3) {
5366
5402
  const type = attr2(xml, "type") ?? "none";
@@ -5398,8 +5434,8 @@ function criteria(xml) {
5398
5434
  const inner2 = m[1];
5399
5435
  if (/<(?:\w+:)?filters\b/.test(inner2)) {
5400
5436
  const values = [...inner2.matchAll(/<(?:\w+:)?filter\b[^>]*\/?>/g)].map((f) => attr2(f[0], "val") ?? "");
5401
- const blank5 = /<(?:\w+:)?filters\b[^>]*\bblank="(1|true)"/.test(inner2);
5402
- out.push({ colId, filters: { ...values.length && { filters: values }, ...blank5 && { blank: true } } });
5437
+ const blank6 = /<(?:\w+:)?filters\b[^>]*\bblank="(1|true)"/.test(inner2);
5438
+ out.push({ colId, filters: { ...values.length && { filters: values }, ...blank6 && { blank: true } } });
5403
5439
  } else if (/<(?:\w+:)?customFilters\b/.test(inner2)) {
5404
5440
  const and = /<(?:\w+:)?customFilters\b[^>]*\band="(1|true)"/.test(inner2);
5405
5441
  const list = [...inner2.matchAll(/<(?:\w+:)?customFilter\b[^>]*\/?>/g)].map((f) => ({ ...attr2(f[0], "operator") && { operator: attr2(f[0], "operator") }, val: attr2(f[0], "val") ?? "" }));
@@ -5538,9 +5574,9 @@ function anchors(xml, rows, cols) {
5538
5574
  }
5539
5575
  function writeXlsx(original, model) {
5540
5576
  const { model: base, book } = load2(original);
5541
- const { pack, styles } = book;
5577
+ const { pack, styles: styles2 } = book;
5542
5578
  const cur = model.book;
5543
- const defaults = norm(styles.looks[0] ?? {});
5579
+ const defaults = norm(styles2.looks[0] ?? {});
5544
5580
  const bySheetId = new Map(book.sheets.map((s) => [s.sheetId, s]));
5545
5581
  const kept = new Set(cur.sheetOrder.map((sid) => model.origin.sheets[sid]).filter((id) => bySheetId.has(id)));
5546
5582
  const removed = book.sheets.filter((s) => !kept.has(s.sheetId));
@@ -5589,14 +5625,14 @@ function writeXlsx(original, model) {
5589
5625
  const filterNames = /* @__PURE__ */ new Map();
5590
5626
  for (const entry2 of sheetParts) {
5591
5627
  const { sid, rec } = entry2;
5592
- const sheet = cur.sheets[sid];
5628
+ const sheet2 = cur.sheets[sid];
5593
5629
  const ax = axes.get(sid);
5594
5630
  const rows = ax?.rows ?? new Axis([], model.lines[sid]?.rows ?? []);
5595
5631
  const cols = ax?.cols ?? new Axis([], model.lines[sid]?.cols ?? []);
5596
5632
  const old = rec ? base.book.sheets[rec.sid] : {};
5597
5633
  const xml = rec?.xml ?? blankSheet;
5598
5634
  const p = rec?.p ?? "";
5599
- const cells = sheet.cellData ?? {};
5635
+ const cells = sheet2.cellData ?? {};
5600
5636
  const oldCells = old.cellData ?? {};
5601
5637
  const fOf = formulas(cells);
5602
5638
  const rowStyle = (sh, r) => sh.rowData?.[r]?.s;
@@ -5614,8 +5650,8 @@ function writeXlsx(original, model) {
5614
5650
  };
5615
5651
  const xfOf = (s) => typeof s === "string" && /^x\d+$/.test(s) ? Number(s.slice(1)) : 0;
5616
5652
  const xfFor = (look, was) => {
5617
- if (same2(norm(styles.looks[was] ?? {}), look) || was === 0 && same2(defaults, look)) return was;
5618
- return styles.find(look) ?? styles.derive(was, look);
5653
+ if (same2(norm(styles2.looks[was] ?? {}), look) || was === 0 && same2(defaults, look)) return was;
5654
+ return styles2.find(look) ?? styles2.derive(was, look);
5619
5655
  };
5620
5656
  let changed2 = !rec || rows.moved || cols.moved;
5621
5657
  let reused = 0, total = 0;
@@ -5624,7 +5660,7 @@ function writeXlsx(original, model) {
5624
5660
  const filtered = new Set(curFilters?.[sid]?.cachedFilteredOut ?? []);
5625
5661
  const indices = /* @__PURE__ */ new Set();
5626
5662
  for (const [r, line] of Object.entries(cells)) if (line && Object.keys(line).length) indices.add(+r);
5627
- for (const [r, rd] of Object.entries(sheet.rowData ?? {})) if (rd && (rd.h !== void 0 || rd.hd || rd.s)) indices.add(+r);
5663
+ for (const [r, rd] of Object.entries(sheet2.rowData ?? {})) if (rd && (rd.h !== void 0 || rd.hd || rd.s)) indices.add(+r);
5628
5664
  if (rec) for (const r0 of rec.rows.keys()) {
5629
5665
  const r = rows.map(r0);
5630
5666
  if (r >= 0) indices.add(r);
@@ -5634,7 +5670,7 @@ function writeXlsx(original, model) {
5634
5670
  for (const r of [...indices].sort((a, b) => a - b)) {
5635
5671
  const r0 = rows.from(r);
5636
5672
  const orow = r0 >= 0 ? rec?.rows.get(r0) : void 0;
5637
- const rd = sheet.rowData?.[r] ?? {};
5673
+ const rd = sheet2.rowData?.[r] ?? {};
5638
5674
  const od = r0 >= 0 ? old.rowData?.[r0] ?? {} : {};
5639
5675
  let tag = orow ? orow.open.replace(/\s*\/>$/, ">") : `<${p}row>`;
5640
5676
  tag = setAttr(tag, "r", String(r + 1));
@@ -5663,7 +5699,7 @@ function writeXlsx(original, model) {
5663
5699
  const ox = r0 >= 0 && c0 >= 0 ? oldCells[r0]?.[c0] : void 0;
5664
5700
  const f = fOf(r, c, x);
5665
5701
  const v = textOf(x);
5666
- const look2 = looks(cur, sheet, r, c, x);
5702
+ const look2 = looks(cur, sheet2, r, c, x);
5667
5703
  const orec = r0 >= 0 && c0 >= 0 ? rec?.cells.get(key(r0, c0)) : void 0;
5668
5704
  const unchanged = !!ox && (ox.f ?? null) === f && equalValue(textOf(ox), v) && looks(base.book, old, r0, c0, ox).json === look2.json;
5669
5705
  if (unchanged) reused++;
@@ -5673,7 +5709,7 @@ function writeXlsx(original, model) {
5673
5709
  parts2.push(rows.moved || cols.moved ? raw.replace(/^<[^>]*>/, (t) => setAttr(t, "r", a1(r, c))) : raw);
5674
5710
  } else {
5675
5711
  if (!unchanged) changed2 = true;
5676
- const xf = xfFor(look2.look, xfOf(ox?.s ?? colStyle(sheet, c) ?? rowStyle(sheet, r)));
5712
+ const xf = xfFor(look2.look, xfOf(ox?.s ?? colStyle(sheet2, c) ?? rowStyle(sheet2, r)));
5677
5713
  const out = cellXml(p, a1(r, c), xf, x, f, v);
5678
5714
  if (!out) continue;
5679
5715
  parts2.push(out);
@@ -5687,37 +5723,37 @@ function writeXlsx(original, model) {
5687
5723
  body.push(parts2.length ? `${tag}${parts2.join("")}</${p}row>` : tag.replace(/>$/, "/>"));
5688
5724
  }
5689
5725
  if (rec && reused !== total) changed2 = true;
5690
- let head = xml.slice(0, rec ? rec.bounds[0] : xml.indexOf("<sheetData"));
5726
+ let head2 = xml.slice(0, rec ? rec.bounds[0] : xml.indexOf("<sheetData"));
5691
5727
  let tail = xml.slice(rec ? rec.bounds[3] : xml.indexOf("<sheetData/>") + 12);
5692
5728
  const mine = (s) => s === null || s === rec?.name;
5693
5729
  if (rec && (rows.moved || cols.moved)) {
5694
- head = remapZone(head, mine, rows, cols);
5730
+ head2 = remapZone(head2, mine, rows, cols);
5695
5731
  tail = remapZone(tail, mine, rows, cols);
5696
5732
  }
5697
- const colXml = columns(p, rec, sheet, old, cols, defaults, cur, base.book, xfFor, xfOf);
5733
+ const colXml = columns(p, rec, sheet2, old, cols, defaults, cur, base.book, xfFor, xfOf);
5698
5734
  if (colXml !== void 0) {
5699
5735
  changed2 = true;
5700
- head = place(head, "cols", colXml);
5736
+ head2 = place(head2, "cols", colXml);
5701
5737
  }
5702
- const merges = (sheet.mergeData ?? []).map((m) => span(m)).sort();
5738
+ const merges = (sheet2.mergeData ?? []).map((m) => span(m)).sort();
5703
5739
  const oldMerges = [...rec?.merges ?? []].map((m) => span(box(m))).sort();
5704
5740
  if (!same2(merges, oldMerges)) {
5705
5741
  changed2 = true;
5706
5742
  tail = place(tail, "mergeCells", merges.length ? `<${p}mergeCells count="${merges.length}">${merges.map((m) => `<${p}mergeCell ref="${m}"/>`).join("")}</${p}mergeCells>` : null);
5707
5743
  }
5708
- const freeze = sheet.freeze && (sheet.freeze.xSplit > 0 || sheet.freeze.ySplit > 0) ? [sheet.freeze.xSplit, sheet.freeze.ySplit] : [0, 0];
5744
+ const freeze = sheet2.freeze && (sheet2.freeze.xSplit > 0 || sheet2.freeze.ySplit > 0) ? [sheet2.freeze.xSplit, sheet2.freeze.ySplit] : [0, 0];
5709
5745
  const oldFreeze = old.freeze ? [old.freeze.xSplit, old.freeze.ySplit] : [0, 0];
5710
5746
  if (!same2(freeze, oldFreeze)) {
5711
5747
  changed2 = true;
5712
- head = frozen(head, p, freeze[0], freeze[1]);
5748
+ head2 = frozen(head2, p, freeze[0], freeze[1]);
5713
5749
  }
5714
- if ((sheet.showGridlines ?? 1) !== (old.showGridlines ?? 1)) {
5750
+ if ((sheet2.showGridlines ?? 1) !== (old.showGridlines ?? 1)) {
5715
5751
  changed2 = true;
5716
- head = head.replace(/<(?:\w+:)?sheetView\b[^>]*?>/, (t) => setAttr(t, "showGridLines", sheet.showGridlines === 0 ? "0" : null));
5752
+ head2 = head2.replace(/<(?:\w+:)?sheetView\b[^>]*?>/, (t) => setAttr(t, "showGridLines", sheet2.showGridlines === 0 ? "0" : null));
5717
5753
  }
5718
- if ((sheet.tabColor ?? "") !== (old.tabColor ?? "")) {
5754
+ if ((sheet2.tabColor ?? "") !== (old.tabColor ?? "")) {
5719
5755
  changed2 = true;
5720
- head = tabColour(head, p, sheet.tabColor ?? "");
5756
+ head2 = tabColour(head2, p, sheet2.tabColor ?? "");
5721
5757
  }
5722
5758
  const rules = (curRules ? curRules[sid] ?? [] : rec ? baseRules[rec.sid] ?? [] : []).map((r) => ({ ...r, ranges: r.ranges.map((b) => ({ startRow: b.startRow, startColumn: b.startColumn, endRow: b.endRow, endColumn: b.endColumn })) }));
5723
5759
  const oldRules = (rec ? baseRules[rec.sid] ?? [] : []).map((r) => ({ ...r, ranges: r.ranges.map((b) => squeeze(b, rows.map, cols.map)).filter(Boolean) }));
@@ -5739,7 +5775,7 @@ function writeXlsx(original, model) {
5739
5775
  if (curFilters && (fref !== oref || !same2(filter?.filterColumns ?? [], oldFilter?.filterColumns ?? []))) {
5740
5776
  changed2 = true;
5741
5777
  tail = place(tail, "autoFilter", filter?.ref ? filterXml(p, filter.ref, filter.filterColumns ?? []) : null);
5742
- filterNames.set(entry2.sheetId, filter?.ref ? `${quoted(sheet.name)}!${span(filter.ref).split(":").map((s) => s.replace(/([A-Z]+)(\d+)/, "$$$1$$$2")).join(":")}` : null);
5778
+ filterNames.set(entry2.sheetId, filter?.ref ? `${quoted(sheet2.name)}!${span(filter.ref).split(":").map((s) => s.replace(/([A-Z]+)(\d+)/, "$$$1$$$2")).join(":")}` : null);
5743
5779
  }
5744
5780
  const notes2 = Object.values(curNotes?.[sid] ?? {}).flatMap((line) => Object.values(line ?? {})).filter((n) => n && !blank3(n.note));
5745
5781
  const oldNotes = (rec?.notes ?? []).map((n) => ({ ref: n.ref, text: n.text }));
@@ -5754,12 +5790,12 @@ function writeXlsx(original, model) {
5754
5790
  continue;
5755
5791
  }
5756
5792
  touched = true;
5757
- head = rename(head);
5793
+ head2 = rename(head2);
5758
5794
  tail = rename(tail);
5759
- if (/\sr:id="/.test(tail) && !/xmlns:r=/.test(head)) head = head.replace(/<((?:\w+:)?worksheet)\b/, `<$1 xmlns:r="${REL2}"`);
5795
+ if (/\sr:id="/.test(tail) && !/xmlns:r=/.test(head2)) head2 = head2.replace(/<((?:\w+:)?worksheet)\b/, `<$1 xmlns:r="${REL2}"`);
5760
5796
  const dim = maxR < 0 ? "A1" : span({ startRow: minR, startColumn: minC, endRow: maxR, endColumn: maxC });
5761
- head = /<(?:\w+:)?dimension\b/.test(head) ? head.replace(/<((?:\w+:)?)dimension\b[^>]*\/?>/, `<$1dimension ref="${dim}"/>`) : place(head, "dimension", `<${p}dimension ref="${dim}"/>`);
5762
- pack.put(entry2.part, head + (body.length ? `<${p}sheetData>${body.join("")}</${p}sheetData>` : `<${p}sheetData/>`) + tail);
5797
+ head2 = /<(?:\w+:)?dimension\b/.test(head2) ? head2.replace(/<((?:\w+:)?)dimension\b[^>]*\/?>/, `<$1dimension ref="${dim}"/>`) : place(head2, "dimension", `<${p}dimension ref="${dim}"/>`);
5798
+ pack.put(entry2.part, head2 + (body.length ? `<${p}sheetData>${body.join("")}</${p}sheetData>` : `<${p}sheetData/>`) + tail);
5763
5799
  if (rec && (rows.moved || cols.moved)) {
5764
5800
  for (const rel of rec.rels) {
5765
5801
  if (rel.external) continue;
@@ -5779,7 +5815,7 @@ function writeXlsx(original, model) {
5779
5815
  }
5780
5816
  }
5781
5817
  }
5782
- const sheetStyles = styles.build();
5818
+ const sheetStyles = styles2.build();
5783
5819
  if (sheetStyles) {
5784
5820
  const target = book.stylesPart ?? "xl/styles.xml";
5785
5821
  pack.put(target, sheetStyles);
@@ -5829,10 +5865,10 @@ function writeXlsx(original, model) {
5829
5865
  const wp = /<(\w+:)?workbook\b/.exec(wb)?.[1] ?? "";
5830
5866
  const relPrefix = /xmlns:(\w+)="http:\/\/schemas\.openxmlformats\.org\/officeDocument\/2006\/relationships"/.exec(wb)?.[1] ?? "r";
5831
5867
  for (const s of sheetParts) {
5832
- const sheet = cur.sheets[s.sid];
5833
- const state = sheet.hidden === 2 ? "veryHidden" : sheet.hidden ? "hidden" : null;
5868
+ const sheet2 = cur.sheets[s.sid];
5869
+ const state = sheet2.hidden === 2 ? "veryHidden" : sheet2.hidden ? "hidden" : null;
5834
5870
  let tag = s.rec ? book.entries.find((e) => e.sheetId === s.sheetId).xml : `<${wp}sheet name="" sheetId="${s.sheetId}" ${relPrefix}:id="${s.rid}"/>`;
5835
- tag = setAttr(setAttr(tag, "name", sheet.name ?? `Sheet${s.sheetId}`), "state", state);
5871
+ tag = setAttr(setAttr(tag, "name", sheet2.name ?? `Sheet${s.sheetId}`), "state", state);
5836
5872
  listed2.push({ xml: tag, sheetId: s.sheetId, oldIndex: s.rec ? indexOf.get(s.sheetId) : -1 });
5837
5873
  }
5838
5874
  for (const { e, i } of nonSheets) {
@@ -5936,9 +5972,9 @@ function cellXml(p, ref, xf, x, f, v) {
5936
5972
  const space = /^\s|\s$|\n/.test(str) ? ' xml:space="preserve"' : "";
5937
5973
  return `<${p}c r="${ref}"${s} t="inlineStr"><${p}is><${p}t${space}>${escape2(str)}</${p}t></${p}is></${p}c>`;
5938
5974
  }
5939
- function columns(p, rec, sheet, old, cols, defaults, cur, baseBook, xfFor, xfOf) {
5940
- const now = sheet.columnData ?? {}, was = old.columnData ?? {};
5941
- const count = sheet.columnCount ?? 26;
5975
+ function columns(p, rec, sheet2, old, cols, defaults, cur, baseBook, xfFor, xfOf) {
5976
+ const now = sheet2.columnData ?? {}, was = old.columnData ?? {};
5977
+ const count = sheet2.columnCount ?? 26;
5942
5978
  const look = (bk, s) => s ? norm({ ...defaults, ...lookup(bk, s) }) : null;
5943
5979
  let differs2 = cols.moved;
5944
5980
  for (let c = 0; c < count && !differs2; c++) {
@@ -5970,7 +6006,7 @@ function columns(p, rec, sheet, old, cols, defaults, cur, baseBook, xfFor, xfOf)
5970
6006
  const ln = look(cur, n.s), lo = look(baseBook, o.s);
5971
6007
  if (!same2(ln, lo)) ln ? a.set("style", String(xfFor(ln, xfOf(o.s)))) : a.delete("style");
5972
6008
  if (!a.size) continue;
5973
- if (!a.has("width")) a.set("width", String(pt.col(sheet.defaultColumnWidth ?? 64)));
6009
+ if (!a.has("width")) a.set("width", String(pt.col(sheet2.defaultColumnWidth ?? 64)));
5974
6010
  out.push({ c, attrs: a });
5975
6011
  }
5976
6012
  const runs2 = [];
@@ -5989,24 +6025,24 @@ function columns(p, rec, sheet, old, cols, defaults, cur, baseBook, xfFor, xfOf)
5989
6025
  }
5990
6026
  return runs2.length ? `<${p}cols>${runs2.join("")}</${p}cols>` : null;
5991
6027
  }
5992
- function frozen(head, p, x, y) {
6028
+ function frozen(head2, p, x, y) {
5993
6029
  const pane = x || y ? `<${p}pane${x ? ` xSplit="${x}"` : ""}${y ? ` ySplit="${y}"` : ""} topLeftCell="${a1(y, x)}" activePane="${x && y ? "bottomRight" : y ? "bottomLeft" : "topRight"}" state="frozen"/>` : "";
5994
6030
  const selection = x || y ? `<${p}selection pane="${x && y ? "bottomRight" : y ? "bottomLeft" : "topRight"}" activeCell="${a1(y, x)}" sqref="${a1(y, x)}"/>` : `<${p}selection activeCell="A1" sqref="A1"/>`;
5995
- const view = /<((?:\w+:)?)sheetView\b[^>]*?(\/?)>/.exec(head);
5996
- if (!view) return place(head, "sheetViews", `<${p}sheetViews><${p}sheetView workbookViewId="0">${pane}${selection}</${p}sheetView></${p}sheetViews>`);
5997
- if (view[2]) return head.slice(0, view.index) + view[0].replace(/\s*\/>$/, ">") + pane + selection + `</${view[1]}sheetView>` + head.slice(view.index + view[0].length);
5998
- const close = head.indexOf(`</${view[1]}sheetView>`, view.index);
5999
- const inner2 = head.slice(view.index + view[0].length, close).replace(/<(?:\w+:)?pane\b[^>]*\/>/g, "").replace(/<(?:\w+:)?selection\b[^>]*\/>/g, "");
6000
- return head.slice(0, view.index) + view[0] + pane + selection + inner2 + head.slice(close);
6001
- }
6002
- function tabColour(head, p, colour) {
6031
+ const view = /<((?:\w+:)?)sheetView\b[^>]*?(\/?)>/.exec(head2);
6032
+ if (!view) return place(head2, "sheetViews", `<${p}sheetViews><${p}sheetView workbookViewId="0">${pane}${selection}</${p}sheetView></${p}sheetViews>`);
6033
+ if (view[2]) return head2.slice(0, view.index) + view[0].replace(/\s*\/>$/, ">") + pane + selection + `</${view[1]}sheetView>` + head2.slice(view.index + view[0].length);
6034
+ const close = head2.indexOf(`</${view[1]}sheetView>`, view.index);
6035
+ const inner2 = head2.slice(view.index + view[0].length, close).replace(/<(?:\w+:)?pane\b[^>]*\/>/g, "").replace(/<(?:\w+:)?selection\b[^>]*\/>/g, "");
6036
+ return head2.slice(0, view.index) + view[0] + pane + selection + inner2 + head2.slice(close);
6037
+ }
6038
+ function tabColour(head2, p, colour) {
6003
6039
  const tag = colour ? `<${p}tabColor rgb="FF${colour.replace("#", "").toUpperCase()}"/>` : "";
6004
- if (/<(?:\w+:)?tabColor\b/.test(head)) return head.replace(/<(?:\w+:)?tabColor\b[^>]*\/>/, tag);
6005
- if (!colour) return head;
6006
- const pr = /<((?:\w+:)?)sheetPr\b[^>]*?(\/?)>/.exec(head);
6007
- if (!pr) return place(head, "sheetPr", `<${p}sheetPr>${tag}</${p}sheetPr>`);
6008
- if (pr[2]) return head.slice(0, pr.index) + pr[0].replace(/\s*\/>$/, ">") + tag + `</${pr[1]}sheetPr>` + head.slice(pr.index + pr[0].length);
6009
- return head.slice(0, pr.index + pr[0].length) + tag + head.slice(pr.index + pr[0].length);
6040
+ if (/<(?:\w+:)?tabColor\b/.test(head2)) return head2.replace(/<(?:\w+:)?tabColor\b[^>]*\/>/, tag);
6041
+ if (!colour) return head2;
6042
+ const pr = /<((?:\w+:)?)sheetPr\b[^>]*?(\/?)>/.exec(head2);
6043
+ if (!pr) return place(head2, "sheetPr", `<${p}sheetPr>${tag}</${p}sheetPr>`);
6044
+ if (pr[2]) return head2.slice(0, pr.index) + pr[0].replace(/\s*\/>$/, ">") + tag + `</${pr[1]}sheetPr>` + head2.slice(pr.index + pr[0].length);
6045
+ return head2.slice(0, pr.index + pr[0].length) + tag + head2.slice(pr.index + pr[0].length);
6010
6046
  }
6011
6047
  function canonRule(r) {
6012
6048
  const out = {};
@@ -6248,15 +6284,15 @@ function fill2(doc, model) {
6248
6284
  book.set("styles", new Y.Map());
6249
6285
  book.set("order", Y.Array.from(wb.sheetOrder));
6250
6286
  book.set("sheets", new Y.Map());
6251
- const { sheets, styles, values, origin } = parts(doc);
6252
- for (const [id, look] of Object.entries(wb.styles)) if (look) styles.set(id, look);
6287
+ const { sheets, styles: styles2, values, origin } = parts(doc);
6288
+ for (const [id, look] of Object.entries(wb.styles)) if (look) styles2.set(id, look);
6253
6289
  for (const sid of wb.sheetOrder) {
6254
- const sheet = wb.sheets[sid];
6290
+ const sheet2 = wb.sheets[sid];
6255
6291
  const l = lines2[sid];
6256
- sheets.set(sid, made(sheet, l));
6257
- origin.set(sid, { id: model.origin.sheets[sid], name: sheet.name ?? "", rows: l.rows.length, cols: l.cols.length });
6292
+ sheets.set(sid, made(sheet2, l));
6293
+ origin.set(sid, { id: model.origin.sheets[sid], name: sheet2.name ?? "", rows: l.rows.length, cols: l.cols.length });
6258
6294
  const { cells, rowData, colData, merges, notes: kept } = pieces(sheets.get(sid));
6259
- for (const [r, line] of Object.entries(sheet.cellData ?? {})) for (const [c, x] of Object.entries(line ?? {})) {
6295
+ for (const [r, line] of Object.entries(sheet2.cellData ?? {})) for (const [c, x] of Object.entries(line ?? {})) {
6260
6296
  if (!x) continue;
6261
6297
  const at = spot2(l.rows[+r], l.cols[+c]);
6262
6298
  const out = {};
@@ -6271,9 +6307,9 @@ function fill2(doc, model) {
6271
6307
  if (typeof x.s === "string") out.s = x.s;
6272
6308
  cells.set(at, out);
6273
6309
  }
6274
- for (const [r, rd] of Object.entries(sheet.rowData ?? {})) if (rd) rowData.set(l.rows[+r], strip({ h: rd.h, hd: rd.hd, ia: rd.ia, s: typeof rd.s === "string" ? rd.s : void 0 }));
6275
- for (const [c, cd] of Object.entries(sheet.columnData ?? {})) if (cd) colData.set(l.cols[+c], strip({ w: cd.w, hd: cd.hd, s: typeof cd.s === "string" ? cd.s : void 0 }));
6276
- for (const b of sheet.mergeData ?? []) merges.set([l.rows[b.startRow], l.cols[b.startColumn], l.rows[b.endRow], l.cols[b.endColumn]].join(":"), 1);
6310
+ for (const [r, rd] of Object.entries(sheet2.rowData ?? {})) if (rd) rowData.set(l.rows[+r], strip({ h: rd.h, hd: rd.hd, ia: rd.ia, s: typeof rd.s === "string" ? rd.s : void 0 }));
6311
+ for (const [c, cd] of Object.entries(sheet2.columnData ?? {})) if (cd) colData.set(l.cols[+c], strip({ w: cd.w, hd: cd.hd, s: typeof cd.s === "string" ? cd.s : void 0 }));
6312
+ for (const b of sheet2.mergeData ?? []) merges.set([l.rows[b.startRow], l.cols[b.startColumn], l.rows[b.endRow], l.cols[b.endColumn]].join(":"), 1);
6277
6313
  for (const [r, line] of Object.entries(notes2[sid] ?? {})) for (const [c, n] of Object.entries(line)) kept.set(spot2(l.rows[+r], l.cols[+c]), { note: n.note, width: n.width, height: n.height });
6278
6314
  }
6279
6315
  });
@@ -6300,9 +6336,9 @@ function sheetOf(doc, sid, l) {
6300
6336
  return out;
6301
6337
  }
6302
6338
  function build(doc) {
6303
- const { book, order: order2, sheets, styles, origin } = parts(doc);
6339
+ const { book, order: order2, sheets, styles: styles2, origin } = parts(doc);
6304
6340
  const sheetOrder = [...new Set(order2.toArray())].filter((sid) => sheets.has(sid));
6305
- const wb = { ...book.get("head"), styles: styles.toJSON(), sheetOrder, sheets: {}, resources: [] };
6341
+ const wb = { ...book.get("head"), styles: styles2.toJSON(), sheetOrder, sheets: {}, resources: [] };
6306
6342
  const model = { book: wb, lines: {}, origin: { sheets: {}, lines: {} } };
6307
6343
  const notes2 = {};
6308
6344
  for (const sid of sheetOrder) {
@@ -6821,13 +6857,13 @@ var init_room = __esm({
6821
6857
  }
6822
6858
  store() {
6823
6859
  const room = this.room;
6824
- const run = room.busy.then(async () => {
6860
+ const run2 = room.busy.then(async () => {
6825
6861
  const done = await save(room.doc, this.kind, room.base ?? await this.host.content(this.id), async (bytes, note) => (await this.host.save(this.id, bytes, note)).versionId);
6826
6862
  if (done) room.base = done.bytes;
6827
6863
  return done;
6828
6864
  });
6829
- room.busy = run.catch(() => null);
6830
- return run;
6865
+ room.busy = run2.catch(() => null);
6866
+ return run2;
6831
6867
  }
6832
6868
  sendStateless(payload) {
6833
6869
  if (!this.live || this.authorizedScope !== "read-write" || !JSON.parse(payload).save) return;
@@ -6953,10 +6989,10 @@ __export(TextEditor_exports, {
6953
6989
  default: () => TextEditor
6954
6990
  });
6955
6991
  function TextEditor({ kind, bytes, t, language, rights, host, together, documentId, onSaved, onOutline, onPanel, slot, guard }) {
6956
- const docx = kind === "docx";
6992
+ const docx2 = kind === "docx";
6957
6993
  const can = { edit: !!host?.save && !!rights?.edit, comment: !!host?.comment && !!rights && (rights.comment || rights.edit) };
6958
6994
  const source = useLoad(async () => {
6959
- if (docx) return { ...await readDocx(bytes), md: null };
6995
+ if (docx2) return { ...await readDocx(bytes), md: null };
6960
6996
  const md = fromMarkdown(new TextDecoder().decode(bytes));
6961
6997
  return { doc: md.doc, md, styles: [], page: a4 };
6962
6998
  }, [bytes, kind]);
@@ -7030,14 +7066,14 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
7030
7066
  return at;
7031
7067
  })(),
7032
7068
  suggest: !!suggesting.getState(e.state)?.on,
7033
- revs: docx ? changes(e.state.doc) : [],
7069
+ revs: docx2 ? changes(e.state.doc) : [],
7034
7070
  dirty: !!baseline.current && !e.state.doc.eq(baseline.current.doc)
7035
7071
  };
7036
7072
  }
7037
7073
  });
7038
7074
  const page = layout2 ?? source.data?.page ?? a4;
7039
7075
  (0, import_react10.useEffect)(() => {
7040
- if (editor && docx && source.data) editor.view.dispatch(editor.state.tr.setMeta(paging, { page }));
7076
+ if (editor && docx2 && source.data) editor.view.dispatch(editor.state.tr.setMeta(paging, { page }));
7041
7077
  }, [editor, source.data, page]);
7042
7078
  const loaded = useLoad((signal) => host?.comments ? host.comments(documentId, { signal }) : Promise.resolve([]), [host, documentId]);
7043
7079
  const all = [...loaded.data ?? [], ...added].flatMap((c) => c.id in changed2 ? changed2[c.id] ?? [] : [c]).filter((c) => !c.replyTo || changed2[c.replyTo] !== null);
@@ -7058,7 +7094,7 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
7058
7094
  if (!editor || !source.data) return;
7059
7095
  let timer = 0;
7060
7096
  let last2 = "";
7061
- const run = () => {
7097
+ const run2 = () => {
7062
7098
  const list = [];
7063
7099
  editor.state.doc.forEach((node, offset) => {
7064
7100
  if (node.type.name !== "heading" || !node.textContent.trim()) return;
@@ -7074,9 +7110,9 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
7074
7110
  };
7075
7111
  const later = () => {
7076
7112
  clearTimeout(timer);
7077
- timer = window.setTimeout(run, 300);
7113
+ timer = window.setTimeout(run2, 300);
7078
7114
  };
7079
- run();
7115
+ run2();
7080
7116
  editor.on("update", later);
7081
7117
  return () => {
7082
7118
  clearTimeout(timer);
@@ -7113,7 +7149,7 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
7113
7149
  document.addEventListener("pointerdown", close);
7114
7150
  return () => document.removeEventListener("pointerdown", close);
7115
7151
  }, [pop]);
7116
- if (source.error) return docx ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w100n-docs-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DocxView, { bytes, onOutline, failed: t.failed }) }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w100n-docs-empty", children: t.failed });
7152
+ if (source.error) return docx2 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w100n-docs-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DocxView, { bytes, onOutline, failed: t.failed }) }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w100n-docs-empty", children: t.failed });
7117
7153
  if (!source.data || !editor || !state || live && !live.ready && !live.late && !live.denied) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w100n-docs-empty", children: t.loading });
7118
7154
  const save2 = async () => {
7119
7155
  if (live) {
@@ -7259,7 +7295,7 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
7259
7295
  const dom = editor.view.domAtPos(at).node;
7260
7296
  (dom instanceof HTMLElement ? dom : dom.parentElement)?.scrollIntoView({ behavior: "smooth", block: "center" });
7261
7297
  };
7262
- const percent = zoom ?? (docx && room ? Math.max(10, Math.min(100, Math.floor((room - 24) / page.width * 100))) : 100);
7298
+ const percent = zoom ?? (docx2 && room ? Math.max(10, Math.min(100, Math.floor((room - 24) / page.width * 100))) : 100);
7263
7299
  const zoomBy = (d) => setZoom(Math.min(200, Math.max(30, percent + d)));
7264
7300
  const keys2 = (e) => {
7265
7301
  if (e.defaultPrevented) return;
@@ -7272,9 +7308,9 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
7272
7308
  return;
7273
7309
  }
7274
7310
  if (!mod) return;
7275
- const act = (run) => {
7311
+ const act = (run2) => {
7276
7312
  e.preventDefault();
7277
- run();
7313
+ run2();
7278
7314
  };
7279
7315
  if (key2 === "s" && can.edit) act(() => void save2());
7280
7316
  else if (key2 === "k" && can.edit) act(linkUp);
@@ -7282,13 +7318,13 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
7282
7318
  else if (!can.edit || e.altKey) return;
7283
7319
  else if (key2 === "]" || key2 === "[") act(() => indent(editor, key2 === "]" ? 1 : -1));
7284
7320
  else if (key2 === "\\") act(() => clear(editor));
7285
- else if (key2 === "enter" && docx) act(() => editor.chain().focus().insertContent({ type: "pageBreak" }).run());
7286
- else if (e.shiftKey && docx && ["l", "e", "r", "j"].includes(key2)) act(() => align2(editor, { l: "left", e: "center", r: "right", j: "justify" }[key2]));
7321
+ else if (key2 === "enter" && docx2) act(() => editor.chain().focus().insertContent({ type: "pageBreak" }).run());
7322
+ else if (e.shiftKey && docx2 && ["l", "e", "r", "j"].includes(key2)) act(() => align2(editor, { l: "left", e: "center", r: "right", j: "justify" }[key2]));
7287
7323
  };
7288
- const tool = (icon, label, run, pressed, disabled) => {
7324
+ const tool = (icon, label, run2, pressed, disabled) => {
7289
7325
  const Icon = icon;
7290
7326
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", "aria-label": label, title: label, "aria-pressed": pressed, disabled, onClick: () => {
7291
- run();
7327
+ run2();
7292
7328
  }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { "aria-hidden": true }) });
7293
7329
  };
7294
7330
  const gap = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "w100n-pdf-gap" });
@@ -7297,8 +7333,8 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
7297
7333
  const name = known.find(test)?.name;
7298
7334
  return name && `${name[0].toUpperCase()}${name.slice(1)}`;
7299
7335
  };
7300
- const levels = docx ? [1, 2, 3, 4, 5, 6].filter((level) => level <= 4 || named3((s) => s.heading === level)) : [1, 2, 3, 4];
7301
- const styles = [
7336
+ const levels = docx2 ? [1, 2, 3, 4, 5, 6].filter((level) => level <= 4 || named3((s) => s.heading === level)) : [1, 2, 3, 4];
7337
+ const styles2 = [
7302
7338
  ["normal", t.normal, () => editor.chain().focus().clearNodes().setParagraph().run()],
7303
7339
  ...levels.map((level) => [
7304
7340
  `h${level}`,
@@ -7310,7 +7346,7 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
7310
7346
  ];
7311
7347
  const tabs = [
7312
7348
  ...can.edit ? [["home", t.home], ["insert", t.insert]] : [],
7313
- ...can.edit && docx ? [["layout", t.layout]] : [],
7349
+ ...can.edit && docx2 ? [["layout", t.layout]] : [],
7314
7350
  ...can.edit ? [["refs", t.references]] : [],
7315
7351
  ...host?.comments && (can.comment || open.length > 0) ? [["review", t.review]] : [],
7316
7352
  ["view", t.viewTab]
@@ -7383,10 +7419,10 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
7383
7419
  if (shown === "home") tools = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
7384
7420
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "w100n-text-anchor", children: [
7385
7421
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("button", { type: "button", className: "w100n-text-picker", "data-pop": true, "aria-haspopup": "listbox", "aria-expanded": pop === "style", "aria-label": t.paragraphStyle, title: t.paragraphStyle, onClick: () => pick("style"), children: [
7386
- styles.find(([key2]) => key2 === state.style)?.[1] ?? t.normal,
7422
+ styles2.find(([key2]) => key2 === state.style)?.[1] ?? t.normal,
7387
7423
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react5.ChevronDown, { "aria-hidden": true })
7388
7424
  ] }),
7389
- pop === "style" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "w100n-text-pop w100n-text-styles", role: "listbox", "aria-label": t.paragraphStyle, children: styles.map(([key2, label, run]) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
7425
+ pop === "style" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "w100n-text-pop w100n-text-styles", role: "listbox", "aria-label": t.paragraphStyle, children: styles2.map(([key2, label, run2]) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
7390
7426
  "button",
7391
7427
  {
7392
7428
  type: "button",
@@ -7394,7 +7430,7 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
7394
7430
  "data-style": key2,
7395
7431
  "aria-selected": state.style === key2,
7396
7432
  onClick: () => {
7397
- run();
7433
+ run2();
7398
7434
  setPop(null);
7399
7435
  },
7400
7436
  children: label
@@ -7405,17 +7441,17 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
7405
7441
  gap,
7406
7442
  tool(import_lucide_react5.Bold, t.bold, () => editor.chain().focus().toggleBold().run(), state.bold),
7407
7443
  tool(import_lucide_react5.Italic, t.italic, () => editor.chain().focus().toggleItalic().run(), state.italic),
7408
- docx && tool(import_lucide_react5.Underline, t.underline, () => editor.chain().focus().toggleUnderline().run(), state.underline),
7444
+ docx2 && tool(import_lucide_react5.Underline, t.underline, () => editor.chain().focus().toggleUnderline().run(), state.underline),
7409
7445
  tool(import_lucide_react5.Strikethrough, t.strike, () => editor.chain().focus().toggleStrike().run(), state.strike),
7410
- !docx && tool(import_lucide_react5.Code, t.code, () => editor.chain().focus().toggleCode().run(), state.code),
7411
- docx && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "w100n-text-anchor", children: [
7446
+ !docx2 && tool(import_lucide_react5.Code, t.code, () => editor.chain().focus().toggleCode().run(), state.code),
7447
+ docx2 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "w100n-text-anchor", children: [
7412
7448
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("button", { type: "button", "data-pop": true, "aria-expanded": pop === "color", "aria-label": t.textColour, title: t.textColour, onClick: () => pick("color"), children: [
7413
7449
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react5.Baseline, { "aria-hidden": true }),
7414
7450
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("i", { className: "w100n-text-bar", style: { background: state.color ?? "currentColor" } })
7415
7451
  ] }),
7416
7452
  pop === "color" && swatches(inks, state.color, (c) => c ? editor.chain().focus().setColor(c).run() : editor.chain().focus().unsetColor().run(), t.automatic)
7417
7453
  ] }),
7418
- docx && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "w100n-text-anchor", children: [
7454
+ docx2 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "w100n-text-anchor", children: [
7419
7455
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", "data-pop": true, "aria-expanded": pop === "mark", "aria-pressed": state.glow, "aria-label": t.highlight, title: t.highlight, onClick: () => pick("mark"), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react5.Highlighter, { "aria-hidden": true }) }),
7420
7456
  pop === "mark" && swatches(glows, null, (c) => c ? editor.chain().focus().setHighlight({ color: c }).run() : editor.chain().focus().unsetHighlight().run(), t.noColour)
7421
7457
  ] }),
@@ -7423,7 +7459,7 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
7423
7459
  tool(import_lucide_react5.List, t.bullets, () => editor.chain().focus().toggleBulletList().run(), state.bullets),
7424
7460
  tool(import_lucide_react5.ListOrdered, t.numbers, () => editor.chain().focus().toggleOrderedList().run(), state.numbers),
7425
7461
  tool(import_lucide_react5.ListChecks, t.tasks, () => editor.chain().focus().toggleTaskList().run(), state.tasks),
7426
- docx && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
7462
+ docx2 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
7427
7463
  gap,
7428
7464
  [[import_lucide_react5.AlignLeft, t.alignLeft, "left"], [import_lucide_react5.AlignCenter, t.alignCenter, "center"], [import_lucide_react5.AlignRight, t.alignRight, "right"], [import_lucide_react5.AlignJustify, t.justify, "justify"]].map(([icon, label, value3], i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react10.Fragment, { children: tool(icon, label, () => align2(editor, value3), state.align === value3) }, i))
7429
7465
  ] }),
@@ -7463,7 +7499,7 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
7463
7499
  tool(import_lucide_react5.BetweenVerticalStart, t.columnLeft, () => editor.chain().focus().addColumnBefore().run()),
7464
7500
  tool(import_lucide_react5.BetweenVerticalEnd, t.columnRight, () => editor.chain().focus().addColumnAfter().run()),
7465
7501
  tool(import_lucide_react5.PanelTop, t.headerRow, () => editor.chain().focus().toggleHeaderRow().run()),
7466
- docx && tool(import_lucide_react5.TableCellsMerge, t.mergeCells, () => editor.chain().focus().mergeOrSplit().run()),
7502
+ docx2 && tool(import_lucide_react5.TableCellsMerge, t.mergeCells, () => editor.chain().focus().mergeOrSplit().run()),
7467
7503
  tool(import_lucide_react5.TableRowsSplit, t.deleteRow, () => editor.chain().focus().deleteRow().run()),
7468
7504
  tool(import_lucide_react5.TableColumnsSplit, t.deleteColumn, () => editor.chain().focus().deleteColumn().run()),
7469
7505
  tool(import_lucide_react5.Trash2, t.deleteTable, () => editor.chain().focus().deleteTable().run())
@@ -7492,7 +7528,7 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
7492
7528
  }
7493
7529
  ),
7494
7530
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "w100n-docs-row", children: [
7495
- docx && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "w100n-pdf-link", children: [
7531
+ docx2 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "w100n-pdf-link", children: [
7496
7532
  t.chooseFile,
7497
7533
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "file", accept: "image/png,image/jpeg,image/gif", hidden: true, onChange: (e) => {
7498
7534
  const file = e.target.files?.[0];
@@ -7536,7 +7572,7 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
7536
7572
  ] })
7537
7573
  ] })
7538
7574
  ] }),
7539
- docx && tool(import_lucide_react5.SeparatorHorizontal, t.pageBreak, () => editor.chain().focus().insertContent({ type: "pageBreak" }).run()),
7575
+ docx2 && tool(import_lucide_react5.SeparatorHorizontal, t.pageBreak, () => editor.chain().focus().insertContent({ type: "pageBreak" }).run()),
7540
7576
  tool(import_lucide_react5.Minus, t.rule, () => editor.chain().focus().setHorizontalRule().run())
7541
7577
  ] });
7542
7578
  else if (shown === "layout") tools = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
@@ -7569,7 +7605,7 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
7569
7605
  else if (shown === "refs") tools = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
7570
7606
  state.toc < 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("button", { type: "button", className: "w100n-docs-action", onClick: () => {
7571
7607
  const at = editor.state.selection.$from.before(1);
7572
- editor.chain().focus().insertContentAt(at, { type: "toc", attrs: { entries: JSON.stringify(entries(editor.state.doc, !docx, at - 1)) } }).run();
7608
+ editor.chain().focus().insertContentAt(at, { type: "toc", attrs: { entries: JSON.stringify(entries(editor.state.doc, !docx2, at - 1)) } }).run();
7573
7609
  }, children: [
7574
7610
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react5.TableOfContents, { "aria-hidden": true }),
7575
7611
  t.tocInsert
@@ -7590,7 +7626,7 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
7590
7626
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react5.MessageSquarePlus, { "aria-hidden": true }),
7591
7627
  t.addComment
7592
7628
  ] }),
7593
- docx && can.edit && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
7629
+ docx2 && can.edit && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
7594
7630
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
7595
7631
  "button",
7596
7632
  {
@@ -7628,7 +7664,7 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
7628
7664
  "%"
7629
7665
  ] }),
7630
7666
  tool(import_lucide_react5.Plus, t.zoomIn, () => zoomBy(10)),
7631
- docx && tool(import_lucide_react5.MoveHorizontal, t.fitWidth, () => setZoom(null), zoom === null),
7667
+ docx2 && tool(import_lucide_react5.MoveHorizontal, t.fitWidth, () => setZoom(null), zoom === null),
7632
7668
  tool(import_lucide_react5.Maximize2, t.fit, () => setZoom(100)),
7633
7669
  gap,
7634
7670
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("button", { type: "button", className: "w100n-text-word", onClick: () => onPanel?.("outline"), children: [
@@ -7636,7 +7672,7 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
7636
7672
  t.outline
7637
7673
  ] })
7638
7674
  ] });
7639
- const sheet = docx ? { "--page-w": `${page.width}px`, "--page-h": `${page.height}px`, "--mt": `${page.margins[0]}px`, "--mr": `${page.margins[1]}px`, "--mb": `${page.margins[2]}px`, "--ml": `${page.margins[3]}px` } : void 0;
7675
+ const sheet2 = docx2 ? { "--page-w": `${page.width}px`, "--page-h": `${page.height}px`, "--mt": `${page.margins[0]}px`, "--mr": `${page.margins[1]}px`, "--mb": `${page.margins[2]}px`, "--ml": `${page.margins[3]}px` } : void 0;
7640
7676
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "w100n-text", "data-kind": kind, onKeyDown: keys2, children: [
7641
7677
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "w100n-text-ribbon", role: "toolbar", "aria-label": t.textTools, onKeyDown: rove, onPointerDown: (e) => {
7642
7678
  if (e.target.closest("button")) e.preventDefault();
@@ -7671,7 +7707,7 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
7671
7707
  if (!id) return;
7672
7708
  setActive(id);
7673
7709
  onPanel?.("comments");
7674
- }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w100n-text-zoomed", style: { zoom: percent / 100 }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: docx ? "w100n-text-sheet" : "w100n-docs-page w100n-text-column", style: sheet, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react9.EditorContent, { editor }) }) }) }),
7710
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w100n-text-zoomed", style: { zoom: percent / 100 }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: docx2 ? "w100n-text-sheet" : "w100n-docs-page w100n-text-column", style: sheet2, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react9.EditorContent, { editor }) }) }) }),
7675
7711
  slot && (0, import_react_dom2.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "w100n-text-notes", children: [
7676
7712
  draft && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "w100n-text-card w100n-text-draft", children: [
7677
7713
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("blockquote", { children: draft.quote }),
@@ -7844,10 +7880,10 @@ function snapshot(api, model) {
7844
7880
  const book = wb.save();
7845
7881
  const lines2 = Object.fromEntries(book.sheetOrder.map((sid) => {
7846
7882
  const l = model.lines[sid] ?? { rows: [], cols: [] };
7847
- const sheet = book.sheets[sid];
7883
+ const sheet2 = book.sheets[sid];
7848
7884
  const rows = [...l.rows], cols = [...l.cols];
7849
- resize(rows, sheet.rowCount ?? rows.length, "n");
7850
- resize(cols, sheet.columnCount ?? cols.length, "n");
7885
+ resize(rows, sheet2.rowCount ?? rows.length, "n");
7886
+ resize(cols, sheet2.columnCount ?? cols.length, "n");
7851
7887
  return [sid, { rows, cols }];
7852
7888
  }));
7853
7889
  return { ...model, book, lines: lines2, active: wb.getActiveSheet().getSheetId() };
@@ -7875,13 +7911,13 @@ var init_engine = __esm({
7875
7911
  function bind(api, injector, doc, model, edit) {
7876
7912
  const unit = model.book.id;
7877
7913
  const wb = injector.get(import_core4.IUniverInstanceService).getUnit(unit);
7878
- const { order: order2, sheets, styles, values } = parts(doc);
7914
+ const { order: order2, sheets, styles: styles2, values } = parts(doc);
7879
7915
  const lines2 = model.lines;
7880
7916
  const me = {};
7881
7917
  let open = true;
7882
7918
  const looks = wb.getStyles();
7883
7919
  const commands = injector.get(import_core4.ICommandService);
7884
- const run = (id, params) => commands.hasCommand(id) && commands.syncExecuteCommand(id, { unitId: unit, ...params }, { fromCollab: true });
7920
+ const run2 = (id, params) => commands.hasCommand(id) && commands.syncExecuteCommand(id, { unitId: unit, ...params }, { fromCollab: true });
7885
7921
  const ws = (sid) => wb.getSheetBySheetId(sid);
7886
7922
  const at = /* @__PURE__ */ new Map();
7887
7923
  const index = (sid) => at.get(sid) ?? at.set(sid, { rows: new Map(lines2[sid].rows.map((id, i) => [id, i])), cols: new Map(lines2[sid].cols.map((id, i) => [id, i])) }).get(sid);
@@ -7890,9 +7926,9 @@ function bind(api, injector, doc, model, edit) {
7890
7926
  const style = typeof s === "string" ? looks.get(s) : s;
7891
7927
  if (!style || !Object.keys(style).length) return void 0;
7892
7928
  const text = canon(style);
7893
- if (typeof s === "string" && styles.has(s) && canon(styles.get(s)) === text) return s;
7929
+ if (typeof s === "string" && styles2.has(s) && canon(styles2.get(s)) === text) return s;
7894
7930
  const id = `y${fnv(new TextEncoder().encode(text)).toString(36)}`;
7895
- if (!styles.has(id)) styles.set(id, style);
7931
+ if (!styles2.has(id)) styles2.set(id, style);
7896
7932
  return id;
7897
7933
  };
7898
7934
  const cellOf = (sid, r, c) => {
@@ -8107,7 +8143,7 @@ function bind(api, injector, doc, model, edit) {
8107
8143
  const full = (sid, key2, x) => {
8108
8144
  if (!x) return null;
8109
8145
  const kept = x.f ? values.get(`${sid}:${key2}`) : void 0;
8110
- return { v: (x.f ? kept?.v : x.v) ?? null, t: (x.f ? kept?.t : x.t) ?? void 0, f: x.f ?? null, si: null, p: x.p ?? null, s: x.s ? styles.get(x.s) ?? null : null };
8146
+ return { v: (x.f ? kept?.v : x.v) ?? null, t: (x.f ? kept?.t : x.t) ?? void 0, f: x.f ?? null, si: null, p: x.p ?? null, s: x.s ? styles2.get(x.s) ?? null : null };
8111
8147
  };
8112
8148
  const cellsTo = (sid, keys2) => {
8113
8149
  const { cells } = pieces(sheets.get(sid));
@@ -8118,7 +8154,7 @@ function bind(api, injector, doc, model, edit) {
8118
8154
  const r = rows.get(row2), c = cols.get(col);
8119
8155
  if (r !== void 0 && c !== void 0) (cellValue[r] ?? (cellValue[r] = {}))[c] = full(sid, key2, cells.get(key2));
8120
8156
  }
8121
- if (Object.keys(cellValue).length) run("sheet.mutation.set-range-values", { subUnitId: sid, cellValue, isOverrideStyle: true });
8157
+ if (Object.keys(cellValue).length) run2("sheet.mutation.set-range-values", { subUnitId: sid, cellValue, isOverrideStyle: true });
8122
8158
  };
8123
8159
  const linesTo = (sid, ids, row2) => {
8124
8160
  const { rowData, colData } = pieces(sheets.get(sid));
@@ -8129,7 +8165,7 @@ function bind(api, injector, doc, model, edit) {
8129
8165
  const i = map.get(id);
8130
8166
  if (i === void 0) continue;
8131
8167
  const x = (row2 ? rowData : colData).get(id);
8132
- const s = x?.s ? styles.get(x.s) : void 0;
8168
+ const s = x?.s ? styles2.get(x.s) : void 0;
8133
8169
  info[i] = x ? row2 ? { h: x.h, hd: x.hd, ia: x.ia, s } : { w: x.w, hd: x.hd, s } : null;
8134
8170
  const size2 = row2 ? x?.h : x?.w;
8135
8171
  if (size2 !== void 0) sizes[i] = size2;
@@ -8137,11 +8173,11 @@ function bind(api, injector, doc, model, edit) {
8137
8173
  }
8138
8174
  if (!ranges.length) return;
8139
8175
  if (row2) {
8140
- run("sheet.mutation.set-row-data", { subUnitId: sid, rowData: info });
8141
- run("sheet.mutation.set-worksheet-row-height", { subUnitId: sid, ranges, rowHeight: sizes });
8176
+ run2("sheet.mutation.set-row-data", { subUnitId: sid, rowData: info });
8177
+ run2("sheet.mutation.set-worksheet-row-height", { subUnitId: sid, ranges, rowHeight: sizes });
8142
8178
  } else {
8143
- run("sheet.mutation.set-col-data", { subUnitId: sid, columnData: info });
8144
- run("sheet.mutation.set-worksheet-col-width", { subUnitId: sid, ranges, colWidth: sizes });
8179
+ run2("sheet.mutation.set-col-data", { subUnitId: sid, columnData: info });
8180
+ run2("sheet.mutation.set-worksheet-col-width", { subUnitId: sid, ranges, colWidth: sizes });
8145
8181
  }
8146
8182
  };
8147
8183
  const mergesTo = (sid) => {
@@ -8150,28 +8186,28 @@ function bind(api, injector, doc, model, edit) {
8150
8186
  const want = [...kept.keys()].map((k) => k.split(":")).map(([r0, c0, r1, c1]) => ({ startRow: rows.get(r0), startColumn: cols.get(c0), endRow: rows.get(r1), endColumn: cols.get(c1) })).filter((b) => [b.startRow, b.startColumn, b.endRow, b.endColumn].every((n) => n !== void 0));
8151
8187
  const has = ws(sid).getMergeData().map((b) => ({ startRow: b.startRow, startColumn: b.startColumn, endRow: b.endRow, endColumn: b.endColumn }));
8152
8188
  const gone = has.filter((b) => !want.some((w) => canon(w) === canon(b))), added = want.filter((w) => !has.some((b) => canon(w) === canon(b)));
8153
- if (gone.length) run("sheet.mutation.remove-worksheet-merge", { subUnitId: sid, ranges: gone });
8154
- if (added.length) run("sheet.mutation.add-worksheet-merge", { subUnitId: sid, ranges: added });
8189
+ if (gone.length) run2("sheet.mutation.remove-worksheet-merge", { subUnitId: sid, ranges: gone });
8190
+ if (added.length) run2("sheet.mutation.add-worksheet-merge", { subUnitId: sid, ranges: added });
8155
8191
  };
8156
8192
  const notesTo = (sid) => {
8157
8193
  const want = notesOf2(sheets.get(sid), lines2[sid]);
8158
8194
  const shown = api.getWorkbook(unit).getSheetBySheetId(sid).getNotes();
8159
- for (const n of shown) if (!want.some((w) => w.row === n.row && w.col === n.col)) run("sheet.mutation.remove-note", { sheetId: sid, noteId: n.id, row: n.row, col: n.col });
8195
+ for (const n of shown) if (!want.some((w) => w.row === n.row && w.col === n.col)) run2("sheet.mutation.remove-note", { sheetId: sid, noteId: n.id, row: n.row, col: n.col });
8160
8196
  for (const w of want) {
8161
8197
  const n = shown.find((x) => x.row === w.row && x.col === w.col);
8162
- if (!n || n.note !== w.note || n.width !== w.width || n.height !== w.height) run("sheet.mutation.update-note", { sheetId: sid, row: w.row, col: w.col, note: { note: w.note, width: w.width, height: w.height } });
8198
+ if (!n || n.note !== w.note || n.width !== w.width || n.height !== w.height) run2("sheet.mutation.update-note", { sheetId: sid, row: w.row, col: w.col, note: { note: w.note, width: w.width, height: w.height } });
8163
8199
  }
8164
8200
  };
8165
8201
  const shape3 = () => {
8166
8202
  const want = [...new Set(order2.toArray())].filter((sid) => sheets.has(sid));
8167
- for (const sheet of wb.getSheets()) {
8168
- const sid = sheet.getSheetId();
8203
+ for (const sheet2 of wb.getSheets()) {
8204
+ const sid = sheet2.getSheetId();
8169
8205
  if (want.includes(sid)) continue;
8170
8206
  if (wb.getActiveSheet().getSheetId() === sid) {
8171
8207
  const other = want.find((x) => wb.getSheetBySheetId(x));
8172
8208
  if (other) api.syncExecuteCommand("sheet.operation.set-worksheet-active", { unitId: unit, subUnitId: other });
8173
8209
  }
8174
- run("sheet.mutation.remove-sheet", { subUnitId: sid });
8210
+ run2("sheet.mutation.remove-sheet", { subUnitId: sid });
8175
8211
  delete lines2[sid];
8176
8212
  at.delete(sid);
8177
8213
  }
@@ -8179,12 +8215,12 @@ function bind(api, injector, doc, model, edit) {
8179
8215
  if (wb.getSheetBySheetId(sid)) return;
8180
8216
  const { rows, cols } = pieces(sheets.get(sid));
8181
8217
  lines2[sid] = { rows: rows.toArray(), cols: cols.toArray() };
8182
- run("sheet.mutation.insert-sheet", { index: Math.min(i, wb.getSheets().length), sheet: (0, import_core4.mergeWorksheetSnapshotWithDefault)(sheetOf(doc, sid, lines2[sid])), styles: styles.toJSON() });
8218
+ run2("sheet.mutation.insert-sheet", { index: Math.min(i, wb.getSheets().length), sheet: (0, import_core4.mergeWorksheetSnapshotWithDefault)(sheetOf(doc, sid, lines2[sid])), styles: styles2.toJSON() });
8183
8219
  notesTo(sid);
8184
8220
  });
8185
8221
  want.forEach((sid, i) => {
8186
8222
  const now = wb.getSheetOrders().indexOf(sid);
8187
- if (now >= 0 && now !== i) run("sheet.mutation.set-worksheet-order", { subUnitId: sid, fromOrder: now, toOrder: i });
8223
+ if (now >= 0 && now !== i) run2("sheet.mutation.set-worksheet-order", { subUnitId: sid, fromOrder: now, toOrder: i });
8188
8224
  });
8189
8225
  };
8190
8226
  const move2 = (sid, delta, row2) => {
@@ -8196,15 +8232,15 @@ function bind(api, injector, doc, model, edit) {
8196
8232
  if (d.retain) i += d.retain;
8197
8233
  if (d.delete) {
8198
8234
  const end = i + d.delete - 1;
8199
- if (row2) run("sheet.mutation.remove-rows", { subUnitId: sid, range: { startRow: i, endRow: end, startColumn: 0, endColumn: lines2[sid].cols.length - 1, rangeType: 1 } });
8200
- else run("sheet.mutation.remove-col", { subUnitId: sid, range: { startRow: 0, endRow: lines2[sid].rows.length - 1, startColumn: i, endColumn: end, rangeType: 2 } });
8235
+ if (row2) run2("sheet.mutation.remove-rows", { subUnitId: sid, range: { startRow: i, endRow: end, startColumn: 0, endColumn: lines2[sid].cols.length - 1, rangeType: 1 } });
8236
+ else run2("sheet.mutation.remove-col", { subUnitId: sid, range: { startRow: 0, endRow: lines2[sid].rows.length - 1, startColumn: i, endColumn: end, rangeType: 2 } });
8201
8237
  list.splice(i, d.delete);
8202
8238
  }
8203
8239
  if (d.insert) {
8204
8240
  const ids = d.insert;
8205
8241
  const end = i + ids.length - 1;
8206
- if (row2) run("sheet.mutation.insert-row", { subUnitId: sid, range: { startRow: i, endRow: end, startColumn: 0, endColumn: lines2[sid].cols.length - 1 } });
8207
- else run("sheet.mutation.insert-col", { subUnitId: sid, range: { startRow: 0, endRow: lines2[sid].rows.length - 1, startColumn: i, endColumn: end } });
8242
+ if (row2) run2("sheet.mutation.insert-row", { subUnitId: sid, range: { startRow: i, endRow: end, startColumn: 0, endColumn: lines2[sid].cols.length - 1 } });
8243
+ else run2("sheet.mutation.insert-col", { subUnitId: sid, range: { startRow: 0, endRow: lines2[sid].rows.length - 1, startColumn: i, endColumn: end } });
8208
8244
  list.splice(i, 0, ...ids);
8209
8245
  ids.forEach((id) => added.add(id));
8210
8246
  i += ids.length;
@@ -8250,7 +8286,7 @@ function bind(api, injector, doc, model, edit) {
8250
8286
  if (s.rows || s.cols) structural = true;
8251
8287
  for (const [name, id, key2, empty] of setters) if (s.props.has(name)) {
8252
8288
  const v = sheets.get(sid).get(name) ?? empty;
8253
- run(id, { subUnitId: sid, ...key2 ? { [key2]: v } : v });
8289
+ run2(id, { subUnitId: sid, ...key2 ? { [key2]: v } : v });
8254
8290
  }
8255
8291
  const keys2 = new Set(s.cells);
8256
8292
  if (rows.size || cols.size) {
@@ -8570,12 +8606,12 @@ function SheetView({ bytes, name, kind, rights, language, theme, onChange, onSav
8570
8606
  });
8571
8607
  useRestore(pop !== null);
8572
8608
  const api = () => live.current?.api;
8573
- const run = (id, params) => {
8609
+ const run2 = (id, params) => {
8574
8610
  void api()?.executeCommand(id, params);
8575
8611
  setPop(null);
8576
8612
  };
8577
8613
  const range = () => api()?.getActiveWorkbook()?.getActiveRange();
8578
- const sheet = () => api()?.getActiveWorkbook()?.getActiveSheet();
8614
+ const sheet2 = () => api()?.getActiveWorkbook()?.getActiveSheet();
8579
8615
  const keys2 = (e) => {
8580
8616
  if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "s") {
8581
8617
  e.preventDefault();
@@ -8615,7 +8651,7 @@ function SheetView({ bytes, name, kind, rights, language, theme, onChange, onSav
8615
8651
  };
8616
8652
  const lines2 = (rows) => {
8617
8653
  const r = range()?.getRange();
8618
- const ws = sheet();
8654
+ const ws = sheet2();
8619
8655
  if (!r || !ws) return;
8620
8656
  if (rows) ws.deleteRows(r.startRow, r.endRow - r.startRow + 1);
8621
8657
  else ws.deleteColumns(r.startColumn, r.endColumn - r.startColumn + 1);
@@ -8669,18 +8705,18 @@ function SheetView({ bytes, name, kind, rights, language, theme, onChange, onSav
8669
8705
  )) })
8670
8706
  ),
8671
8707
  gap,
8672
- tool(import_lucide_react6.Bold, t.bold, () => run("sheet.command.set-range-bold"), look?.bl),
8673
- tool(import_lucide_react6.Italic, t.italic, () => run("sheet.command.set-range-italic"), look?.it),
8674
- tool(import_lucide_react6.Underline, t.underline, () => run("sheet.command.set-range-underline"), look?.ul),
8675
- tool(import_lucide_react6.Strikethrough, t.strike, () => run("sheet.command.set-range-stroke"), look?.st),
8708
+ tool(import_lucide_react6.Bold, t.bold, () => run2("sheet.command.set-range-bold"), look?.bl),
8709
+ tool(import_lucide_react6.Italic, t.italic, () => run2("sheet.command.set-range-italic"), look?.it),
8710
+ tool(import_lucide_react6.Underline, t.underline, () => run2("sheet.command.set-range-underline"), look?.ul),
8711
+ tool(import_lucide_react6.Strikethrough, t.strike, () => run2("sheet.command.set-range-stroke"), look?.st),
8676
8712
  anchor(
8677
8713
  "text",
8678
8714
  opener("text", import_lucide_react6.Baseline, t.textColour, look?.cl ?? ""),
8679
8715
  swatches(
8680
8716
  ["#0f172a", "#475569", "#dc2626", "#ea580c", "#ca8a04", "#16a34a", "#0891b2", "#2563eb", "#7c3aed", "#db2777"],
8681
- (c) => run("sheet.command.set-range-text-color", { value: c }),
8717
+ (c) => run2("sheet.command.set-range-text-color", { value: c }),
8682
8718
  t.automatic,
8683
- () => run("sheet.command.reset-range-text-color"),
8719
+ () => run2("sheet.command.reset-range-text-color"),
8684
8720
  look?.cl ?? ""
8685
8721
  )
8686
8722
  ),
@@ -8689,9 +8725,9 @@ function SheetView({ bytes, name, kind, rights, language, theme, onChange, onSav
8689
8725
  opener("fill", import_lucide_react6.PaintBucket, t.fill, look?.bg ?? ""),
8690
8726
  swatches(
8691
8727
  ["#fee2e2", "#ffedd5", "#fef9c3", "#dcfce7", "#cffafe", "#dbeafe", "#ede9fe", "#fce7f3", "#f1f5f9", "#cbd5e1"],
8692
- (c) => run("sheet.command.set-background-color", { value: c }),
8728
+ (c) => run2("sheet.command.set-background-color", { value: c }),
8693
8729
  t.noFill,
8694
- () => run("sheet.command.reset-background-color"),
8730
+ () => run2("sheet.command.reset-background-color"),
8695
8731
  look?.bg ?? ""
8696
8732
  )
8697
8733
  ),
@@ -8704,16 +8740,16 @@ function SheetView({ bytes, name, kind, rights, language, theme, onChange, onSav
8704
8740
  ] }, type)) })
8705
8741
  ),
8706
8742
  gap,
8707
- tool(import_lucide_react6.TextAlignStart, t.alignLeft, () => run("sheet.command.set-horizontal-text-align", { value: 1 }), look?.ht === 1),
8708
- tool(import_lucide_react6.TextAlignCenter, t.alignCenter, () => run("sheet.command.set-horizontal-text-align", { value: 2 }), look?.ht === 2),
8709
- tool(import_lucide_react6.TextAlignEnd, t.alignRight, () => run("sheet.command.set-horizontal-text-align", { value: 3 }), look?.ht === 3),
8710
- tool(import_lucide_react6.TextWrap, t.wrap, () => run("sheet.command.set-text-wrap", { value: look?.tb ? 1 : 3 }), look?.tb),
8711
- look?.merged ? tool(import_lucide_react6.TableCellsSplit, t.unmerge, () => run("sheet.command.remove-worksheet-merge"), true) : tool(import_lucide_react6.TableCellsMerge, t.merge, () => run("sheet.command.add-worksheet-merge-all")),
8743
+ tool(import_lucide_react6.TextAlignStart, t.alignLeft, () => run2("sheet.command.set-horizontal-text-align", { value: 1 }), look?.ht === 1),
8744
+ tool(import_lucide_react6.TextAlignCenter, t.alignCenter, () => run2("sheet.command.set-horizontal-text-align", { value: 2 }), look?.ht === 2),
8745
+ tool(import_lucide_react6.TextAlignEnd, t.alignRight, () => run2("sheet.command.set-horizontal-text-align", { value: 3 }), look?.ht === 3),
8746
+ tool(import_lucide_react6.TextWrap, t.wrap, () => run2("sheet.command.set-text-wrap", { value: look?.tb ? 1 : 3 }), look?.tb),
8747
+ look?.merged ? tool(import_lucide_react6.TableCellsSplit, t.unmerge, () => run2("sheet.command.remove-worksheet-merge"), true) : tool(import_lucide_react6.TableCellsMerge, t.merge, () => run2("sheet.command.add-worksheet-merge-all")),
8712
8748
  gap,
8713
- tool(import_lucide_react6.BetweenHorizontalStart, t.rowAbove, () => run("sheet.command.insert-row-before")),
8714
- tool(import_lucide_react6.BetweenHorizontalEnd, t.rowBelow, () => run("sheet.command.insert-row-after")),
8715
- tool(import_lucide_react6.BetweenVerticalStart, t.columnLeft, () => run("sheet.command.insert-col-before")),
8716
- tool(import_lucide_react6.BetweenVerticalEnd, t.columnRight, () => run("sheet.command.insert-col-after")),
8749
+ tool(import_lucide_react6.BetweenHorizontalStart, t.rowAbove, () => run2("sheet.command.insert-row-before")),
8750
+ tool(import_lucide_react6.BetweenHorizontalEnd, t.rowBelow, () => run2("sheet.command.insert-row-after")),
8751
+ tool(import_lucide_react6.BetweenVerticalStart, t.columnLeft, () => run2("sheet.command.insert-col-before")),
8752
+ tool(import_lucide_react6.BetweenVerticalEnd, t.columnRight, () => run2("sheet.command.insert-col-after")),
8717
8753
  tool(import_lucide_react6.TableRowsSplit, t.deleteRows, () => lines2(true)),
8718
8754
  tool(import_lucide_react6.TableColumnsSplit, t.deleteColumns, () => lines2(false)),
8719
8755
  anchor(
@@ -8721,28 +8757,28 @@ function SheetView({ bytes, name, kind, rights, language, theme, onChange, onSav
8721
8757
  opener("freeze", import_lucide_react6.Snowflake, t.freeze),
8722
8758
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-sheet-list", children: [
8723
8759
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", onClick: () => {
8724
- sheet()?.setFrozenRows(1);
8760
+ sheet2()?.setFrozenRows(1);
8725
8761
  setPop(null);
8726
8762
  }, children: t.freezeRow }),
8727
8763
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", onClick: () => {
8728
- sheet()?.setFrozenColumns(1);
8764
+ sheet2()?.setFrozenColumns(1);
8729
8765
  setPop(null);
8730
8766
  }, children: t.freezeColumn }),
8731
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", onClick: () => run("sheet.command.set-selection-frozen"), children: t.freezeHere }),
8767
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", onClick: () => run2("sheet.command.set-selection-frozen"), children: t.freezeHere }),
8732
8768
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", onClick: () => {
8733
- sheet()?.cancelFreeze();
8769
+ sheet2()?.cancelFreeze();
8734
8770
  setPop(null);
8735
8771
  }, children: t.freezeNone })
8736
8772
  ] })
8737
8773
  ),
8738
8774
  gap,
8739
- tool(import_lucide_react6.ArrowDownAZ, t.sortUp, () => run("sheet.command.sort-range-asc")),
8740
- tool(import_lucide_react6.ArrowDownZA, t.sortDown, () => run("sheet.command.sort-range-desc")),
8741
- !room && tool(import_lucide_react6.Funnel, t.filter, () => run("sheet.command.smart-toggle-filter")),
8775
+ tool(import_lucide_react6.ArrowDownAZ, t.sortUp, () => run2("sheet.command.sort-range-asc")),
8776
+ tool(import_lucide_react6.ArrowDownZA, t.sortDown, () => run2("sheet.command.sort-range-desc")),
8777
+ !room && tool(import_lucide_react6.Funnel, t.filter, () => run2("sheet.command.smart-toggle-filter")),
8742
8778
  gap
8743
8779
  ] }),
8744
- (edit || notes2) && tool(import_lucide_react6.StickyNote, t.note, () => run("sheet.operation.add-note-popup")),
8745
- tool(import_lucide_react6.Search, t.find, () => run("ui.operation.open-find-dialog"))
8780
+ (edit || notes2) && tool(import_lucide_react6.StickyNote, t.note, () => run2("sheet.operation.add-note-popup")),
8781
+ tool(import_lucide_react6.Search, t.find, () => run2("ui.operation.open-find-dialog"))
8746
8782
  ] }),
8747
8783
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-sheet-end", children: [
8748
8784
  room && (room.ready ? !room.online : room.late || room.denied) && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "w100n-text-live", title: room.denied ? void 0 : t.offlineHint, children: [
@@ -9176,7 +9212,7 @@ var titled = (src) => toText(src).replace(/\s+/g, " ").slice(0, 80);
9176
9212
  var escape = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
9177
9213
  var quote = (s) => escape(s).replace(/"/g, "&quot;");
9178
9214
  var notesHtml = (text) => escape(text).split("\n").join("<br>\n");
9179
- var sizeOf = (html, kind, scripts, styles, marks2) => {
9215
+ var sizeOf = (html, kind, scripts, styles2, marks2) => {
9180
9216
  if (kind === "reveal") {
9181
9217
  const code = scripts.map((s) => html.slice(s.open, s.close)).join("\n");
9182
9218
  const at = code.search(/Reveal\.initialize\s*\(/);
@@ -9190,7 +9226,7 @@ var sizeOf = (html, kind, scripts, styles, marks2) => {
9190
9226
  const height = Number(el.attrs.get("data-height")?.value);
9191
9227
  if (width > 0 && height > 0) return { width, height, center: false };
9192
9228
  }
9193
- const css2 = styles.map((s) => html.slice(s.open, s.close)).join("\n").replace(/\/\*[\s\S]*?\*\//g, "");
9229
+ const css2 = styles2.map((s) => html.slice(s.open, s.close)).join("\n").replace(/\/\*[\s\S]*?\*\//g, "");
9194
9230
  const target = kind === "marked" ? /(^|[\s>])\[data-slide[^\]]*\](\.[\w-]+)*$/ : /(^|[\s>])(section|\.slide)(\.[\w-]+)*$/;
9195
9231
  for (const rule of css2.matchAll(/([^{}]+)\{([^{}]*)\}/g)) {
9196
9232
  if (!rule[1].split(",").some((sel) => target.test(sel.trim()))) continue;
@@ -9204,13 +9240,13 @@ function shape(html) {
9204
9240
  const root = parse(html);
9205
9241
  const all = elements(root);
9206
9242
  const scripts = all.filter((el) => el.tag === "script");
9207
- const styles = all.filter((el) => el.tag === "style");
9243
+ const styles2 = all.filter((el) => el.tag === "style");
9208
9244
  const refresh = all.filter((el) => el.tag === "meta" && el.attrs.get("http-equiv")?.value.toLowerCase() === "refresh");
9209
- const head = all.find((el) => el.tag === "head");
9245
+ const head2 = all.find((el) => el.tag === "head");
9210
9246
  const outer = all.find((el) => el.tag === "html");
9211
9247
  const body = all.find((el) => el.tag === "body") ?? null;
9212
9248
  const doctype = /^\s*<!doctype[^>]*>/i.exec(html);
9213
- const at = head ? head.open : outer ? outer.open : doctype ? doctype[0].length : 0;
9249
+ const at = head2 ? head2.open : outer ? outer.open : doctype ? doctype[0].length : 0;
9214
9250
  const reveal = all.find((el) => classes(el).includes("reveal")) ?? null;
9215
9251
  const box2 = reveal && all.find((el) => classes(el).includes("slides") && under(el, (up) => up === reveal));
9216
9252
  const spots = [];
@@ -9250,14 +9286,14 @@ function shape(html) {
9250
9286
  }
9251
9287
  for (const unit of units) spot3(unit, null);
9252
9288
  }
9253
- const size2 = sizeOf(html, kind, scripts, styles, [container, ...body ? [body] : [], ...outer ? [outer] : []]);
9289
+ const size2 = sizeOf(html, kind, scripts, styles2, [container, ...body ? [body] : [], ...outer ? [outer] : []]);
9254
9290
  return { kind, ...size2, root, box: container, units, stacks, spots, scripts, refresh, head: at, body };
9255
9291
  }
9256
9292
  var titleOf = (html, s) => {
9257
9293
  const heading = elements(s.el).find((el2) => /^h[1-6]$/.test(el2.tag) && !(s.notes && under(el2, (up) => up === s.notes)));
9258
9294
  const el = heading ?? s.blocks[0];
9259
- const head = el ? s.blocks.indexOf(el) : -1;
9260
- return { title: el ? titled(html.slice(el.open, el.close)) : "", head: head < 0 ? null : head };
9295
+ const head2 = el ? s.blocks.indexOf(el) : -1;
9296
+ return { title: el ? titled(html.slice(el.open, el.close)) : "", head: head2 < 0 ? null : head2 };
9261
9297
  };
9262
9298
  var notesText = (html, s) => s.notes ? toText(html.slice(s.notes.open, s.notes.close)) : s.attr ? s.attr.value.trim() : "";
9263
9299
  function readDeck(html, known) {
@@ -9314,9 +9350,9 @@ function apply(html, from, to, list) {
9314
9350
  }
9315
9351
  var blank = (s) => !/\S/.test(s);
9316
9352
  var join = (html, box2, els, parts2) => {
9317
- const head = html.slice(box2.open, els[0].start);
9353
+ const head2 = html.slice(box2.open, els[0].start);
9318
9354
  const pre = els.map((el, i) => i ? html.slice(els[i - 1].end, el.start) : "");
9319
- const fill3 = pre.find((gap, i) => i && blank(gap)) ?? (/\s*$/.exec(head)[0] || "\n");
9355
+ const fill3 = pre.find((gap, i) => i && blank(gap)) ?? (/\s*$/.exec(head2)[0] || "\n");
9320
9356
  const used = /* @__PURE__ */ new Set();
9321
9357
  const body = parts2.map(([from, part], k) => {
9322
9358
  const first = !used.has(from);
@@ -9325,7 +9361,7 @@ var join = (html, box2, els, parts2) => {
9325
9361
  return (first && !blank(pre[from]) ? pre[from].trimStart() : "") + part;
9326
9362
  });
9327
9363
  const lost = pre.filter((gap, i) => !used.has(i) && !blank(gap)).map((gap) => gap.trimEnd());
9328
- return head + body.join("") + lost.join("") + html.slice(els[els.length - 1].end, box2.close);
9364
+ return head2 + body.join("") + lost.join("") + html.slice(els[els.length - 1].end, box2.close);
9329
9365
  };
9330
9366
  function writeDeck(original, deck, known) {
9331
9367
  const s = known ?? shape(original);
@@ -9355,8 +9391,8 @@ function moveSlide(deck, from, to) {
9355
9391
  const slide = deck.slides[from];
9356
9392
  const rest = deck.slides.filter((_, i) => i !== from);
9357
9393
  let at = Math.max(0, Math.min(rest.length, to));
9358
- const run = rest.flatMap((other, i) => slide.stack !== null && other.stack === slide.stack ? [i] : []);
9359
- if (run.length) at = Math.max(run[0], Math.min(run[run.length - 1] + 1, at));
9394
+ const run2 = rest.flatMap((other, i) => slide.stack !== null && other.stack === slide.stack ? [i] : []);
9395
+ if (run2.length) at = Math.max(run2[0], Math.min(run2[run2.length - 1] + 1, at));
9360
9396
  else if (at > 0 && at < rest.length && rest[at].stack !== null && rest[at - 1].stack === rest[at].stack) {
9361
9397
  let end = at;
9362
9398
  while (end < rest.length && rest[end].stack === rest[at].stack) end++;
@@ -9946,7 +9982,7 @@ function SlidesView({ html, name, rights, language = "en", theme = "light", base
9946
9982
  popup.close();
9947
9983
  };
9948
9984
  }, [popup]);
9949
- const tool = (Icon, text, run, disabled = false) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", "aria-label": text, title: text, disabled, onClick: run, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { "aria-hidden": true }) });
9985
+ const tool = (Icon, text, run2, disabled = false) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", "aria-label": text, title: text, disabled, onClick: run2, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { "aria-hidden": true }) });
9950
9986
  const thumb = 148;
9951
9987
  const seconds = Math.floor(Math.max(0, (timer.stop ?? now) - timer.from) / 1e3);
9952
9988
  const elapsed = `${seconds >= 3600 ? `${Math.floor(seconds / 3600)}:` : ""}${String(Math.floor(seconds / 60) % 60).padStart(2, "0")}:${String(seconds % 60).padStart(2, "0")}`;
@@ -11268,7 +11304,7 @@ function DocumentOverlay({ source, name, mimeType, info, download, actions, onCl
11268
11304
  link.click();
11269
11305
  setTimeout(() => URL.revokeObjectURL(url), 1e3);
11270
11306
  };
11271
- const sheet = readable(name, mimeType) !== "sheet" ? null : /\.csv$/i.test(name) || mimeType === "text/csv" ? "csv" : "xlsx";
11307
+ const sheet2 = readable(name, mimeType) !== "sheet" ? null : /\.csv$/i.test(name) || mimeType === "text/csv" ? "csv" : "xlsx";
11272
11308
  const wait = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "w100n-docs-empty", children: t.loading });
11273
11309
  let stage = null;
11274
11310
  if (bytes && !doc.loading) {
@@ -11288,7 +11324,7 @@ function DocumentOverlay({ source, name, mimeType, info, download, actions, onCl
11288
11324
  );
11289
11325
  else if (kind === "docx" || kind === "markdown") stage = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react12.Suspense, { fallback: wait, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TextEditor2, { kind, bytes, t, language, rights: read, documentId: documentId ?? name, onOutline: quiet2, slot: null }) });
11290
11326
  else if (kind === "slides") stage = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SlidesView, { html: new TextDecoder().decode(bytes), name, rights: read, language, theme, onOutline: quiet2 });
11291
- else if (sheet) stage = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react12.Suspense, { fallback: wait, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SheetView2, { bytes, name, kind: sheet, rights: read, language, theme, documentId: documentId ?? name }) });
11327
+ else if (sheet2) stage = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react12.Suspense, { fallback: wait, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SheetView2, { bytes, name, kind: sheet2, rights: read, language, theme, documentId: documentId ?? name }) });
11292
11328
  else stage = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "w100n-docs-empty", children: t.unsupported });
11293
11329
  }
11294
11330
  return (0, import_react_dom3.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { ref: box2, className: "w100n-docs w100n-docs-overlay", "data-theme": theme, role: "dialog", "aria-modal": true, "aria-label": name, tabIndex: -1, children: [
@@ -11323,26 +11359,233 @@ function DocumentOverlay({ source, name, mimeType, info, download, actions, onCl
11323
11359
  }
11324
11360
 
11325
11361
  // src/DocumentsWorkspace.tsx
11326
- var import_react15 = require("react");
11362
+ var import_react16 = require("react");
11327
11363
  var import_react_dom4 = require("react-dom");
11328
- var import_lucide_react9 = require("lucide-react");
11364
+ var import_lucide_react10 = require("lucide-react");
11329
11365
  init_focus();
11330
11366
 
11331
- // src/Sharing.tsx
11332
- var import_react13 = require("react");
11367
+ // src/NewDocument.tsx
11333
11368
  var import_lucide_react8 = require("lucide-react");
11334
- init_useLoad();
11369
+ var import_react13 = require("react");
11370
+
11371
+ // src/blank.ts
11372
+ var import_fflate2 = require("fflate");
11373
+ init_xml();
11374
+ var W = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
11375
+ var REL3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
11376
+ var PKG = "http://schemas.openxmlformats.org/package/2006/relationships";
11377
+ var head = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n';
11378
+ var mimes2 = {
11379
+ docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
11380
+ markdown: "text/markdown",
11381
+ sheet: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
11382
+ slides: "text/html"
11383
+ };
11384
+ var extensions = { docx: "docx", markdown: "md", sheet: "xlsx", slides: "html" };
11385
+ var templates = {
11386
+ letter: (name) => [["Title", name], [null, "Web100Now"], [null, ""], [null, "Dear Name,"], [null, "Write the message here."], [null, ""], [null, "Kind regards,"], [null, "Your name"]],
11387
+ contract: (name) => [
11388
+ ["Title", name],
11389
+ [null, "Between Party A and Party B, date"],
11390
+ ["Heading1", "1. Scope of work"],
11391
+ [null, "What is delivered and when."],
11392
+ ["Heading1", "2. Fees and payment"],
11393
+ [null, "Amount, currency and when it is paid."],
11394
+ ["Heading1", "3. Term"],
11395
+ [null, "Start date, length and how either side ends it."],
11396
+ ["Heading1", "4. Signatures"],
11397
+ [["Party A", "Party B"], ["Name, date", "Name, date"]]
11398
+ ],
11399
+ notes: (name) => [
11400
+ ["Title", name],
11401
+ [null, "Date, people"],
11402
+ ["Heading1", "Agenda"],
11403
+ [null, "Topic one"],
11404
+ ["Heading1", "Decisions"],
11405
+ [null, "What was decided"],
11406
+ ["Heading1", "Next steps"],
11407
+ [["Who", "What", "By when"], ["", "", ""]]
11408
+ ],
11409
+ invoice: (name) => [
11410
+ ["Title", name],
11411
+ [null, "Number, date, due date"],
11412
+ [null, "Billed to: client name and address"],
11413
+ [["Item", "Quantity", "Price", "Total"], ["", "", "", ""], ["", "", "Total", ""]],
11414
+ [null, "Bank details and payment terms"]
11415
+ ],
11416
+ report: (name) => [
11417
+ ["Title", name],
11418
+ [null, "Period, author"],
11419
+ ["Heading1", "Summary"],
11420
+ [null, "The main points in a few lines."],
11421
+ ["Heading1", "Results"],
11422
+ [null, "What happened and the numbers behind it."],
11423
+ ["Heading1", "Next"],
11424
+ [null, "What comes next and who owns it."]
11425
+ ]
11426
+ };
11427
+ var run = (text) => text ? `<w:r><w:t xml:space="preserve">${escape2(text)}</w:t></w:r>` : "";
11428
+ var para = ([style, text]) => `<w:p>${style ? `<w:pPr><w:pStyle w:val="${style}"/></w:pPr>` : ""}${run(text)}</w:p>`;
11429
+ var table2 = (rows) => {
11430
+ const width = Math.floor(9638 / rows[0].length);
11431
+ const border = (side2) => `<w:${side2} w:val="single" w:sz="4" w:space="0" w:color="94A3B8"/>`;
11432
+ 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((row2, r) => `<w:tr>${row2.map((cell2) => `<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">${escape2(cell2)}</w:t></w:r>` : run(cell2)}</w:p></w:tc>`).join("")}</w:tr>`).join("") + "</w:tbl><w:p/>";
11433
+ };
11434
+ 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>`;
11435
+ function docx(blocks3) {
11436
+ const body = blocks3.map((block2) => typeof block2[0] === "string" || block2[0] === null ? para(block2) : table2(block2)).join("") || "<w:p/>";
11437
+ return (0, import_fflate2.zipSync)({
11438
+ "[Content_Types].xml": (0, import_fflate2.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>`),
11439
+ "_rels/.rels": (0, import_fflate2.strToU8)(`${head}<Relationships xmlns="${PKG}"><Relationship Id="rId1" Type="${REL3}/officeDocument" Target="word/document.xml"/></Relationships>`),
11440
+ "word/_rels/document.xml.rels": (0, import_fflate2.strToU8)(`${head}<Relationships xmlns="${PKG}"><Relationship Id="rId1" Type="${REL3}/styles" Target="styles.xml"/></Relationships>`),
11441
+ "word/styles.xml": (0, import_fflate2.strToU8)(styles),
11442
+ "word/document.xml": (0, import_fflate2.strToU8)(`${head}<w:document xmlns:w="${W}" xmlns:r="${REL3}"><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>`)
11443
+ });
11444
+ }
11445
+ function markdown(blocks3) {
11446
+ const line = (block2) => {
11447
+ if (typeof block2[0] === "string" || block2[0] === null) {
11448
+ const [style, text] = block2;
11449
+ return style === "Title" ? `# ${text}` : style === "Heading1" ? `## ${text.replace(/^\d+\.\s*/, "")}` : text;
11450
+ }
11451
+ const rows = block2;
11452
+ return [rows[0], rows[0].map(() => "---"), ...rows.slice(1)].map((row2) => `| ${row2.join(" | ")} |`).join("\n");
11453
+ };
11454
+ return (0, import_fflate2.strToU8)(blocks3.map(line).join("\n\n").replace(/\n{3,}/g, "\n\n") + "\n");
11455
+ }
11456
+ var S = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
11457
+ function sheet() {
11458
+ return (0, import_fflate2.zipSync)({
11459
+ "[Content_Types].xml": (0, import_fflate2.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>`),
11460
+ "_rels/.rels": (0, import_fflate2.strToU8)(`${head}<Relationships xmlns="${PKG}"><Relationship Id="rId1" Type="${REL3}/officeDocument" Target="xl/workbook.xml"/></Relationships>`),
11461
+ "xl/workbook.xml": (0, import_fflate2.strToU8)(`${head}<workbook xmlns="${S}" xmlns:r="${REL3}"><sheets><sheet name="Sheet1" sheetId="1" r:id="rId1"/></sheets></workbook>`),
11462
+ "xl/_rels/workbook.xml.rels": (0, import_fflate2.strToU8)(`${head}<Relationships xmlns="${PKG}"><Relationship Id="rId1" Type="${REL3}/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId2" Type="${REL3}/styles" Target="styles.xml"/></Relationships>`),
11463
+ "xl/worksheets/sheet1.xml": (0, import_fflate2.strToU8)(`${head}<worksheet xmlns="${S}" xmlns:r="${REL3}"><sheetData/></worksheet>`),
11464
+ "xl/styles.xml": (0, import_fflate2.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>`)
11465
+ });
11466
+ }
11467
+ var slides = (name) => (0, import_fflate2.strToU8)(`<!DOCTYPE html>
11468
+ <html>
11469
+ <head>
11470
+ <meta charset="utf-8">
11471
+ <title>${escape2(name)}</title>
11472
+ <style>
11473
+ body { margin: 0; font-family: Inter, Arial, sans-serif; background: #0f172a; }
11474
+ section { width: 1920px; height: 1080px; padding: 120px; box-sizing: border-box; background: #fff; color: #0f172a; }
11475
+ section h1 { font-size: 96px; margin: 0 0 24px; }
11476
+ section h2 { font-size: 72px; margin: 0 0 24px; }
11477
+ section p { font-size: 40px; color: #475569; }
11478
+ </style>
11479
+ </head>
11480
+ <body>
11481
+ <section><h1>${escape2(name)}</h1><p>Subtitle</p></section>
11482
+ <section><h2>Title</h2><p>Text</p></section>
11483
+ </body>
11484
+ </html>
11485
+ `);
11486
+ function blank4(kind, name, template = "blank") {
11487
+ const blocks3 = template === "blank" ? [] : templates[template](name);
11488
+ const bytes = kind === "docx" ? docx(blocks3) : kind === "markdown" ? markdown(blocks3.length ? blocks3 : [["Title", name]]) : kind === "sheet" ? sheet() : slides(name);
11489
+ return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
11490
+ }
11491
+
11492
+ // src/NewDocument.tsx
11493
+ init_focus();
11335
11494
  var import_jsx_runtime9 = require("react/jsx-runtime");
11336
- var blank4 = { id: null, comment: false, download: false, askName: true, works: "30", day: "", password: false, secret: "", had: false };
11495
+ var icons2 = { docx: import_lucide_react8.FileText, markdown: import_lucide_react8.FileType, sheet: import_lucide_react8.FileSpreadsheet, slides: import_lucide_react8.Presentation };
11496
+ var shaped = ["blank", "letter", "contract", "notes", "invoice", "report"];
11497
+ function NewDocument({ host, t, onClose, onMade }) {
11498
+ const id = (0, import_react13.useId)();
11499
+ const [kind, setKind] = (0, import_react13.useState)("docx");
11500
+ const [template, setTemplate] = (0, import_react13.useState)("blank");
11501
+ const [name, setName] = (0, import_react13.useState)("");
11502
+ const [state, setState] = (0, import_react13.useState)("idle");
11503
+ useRestore(true);
11504
+ const choices = kind === "docx" || kind === "markdown" ? shaped : ["blank"];
11505
+ const make2 = async () => {
11506
+ const title = name.trim() || (template === "blank" ? t.untitled : t.templates[template]);
11507
+ setState("busy");
11508
+ try {
11509
+ onMade(await host.create({ name: `${title.replace(/[\\/:*?"<>|\s]+/g, " ").trim()}.${extensions[kind]}`, bytes: blank4(kind, title, template), mimeType: mimes2[kind] }));
11510
+ } catch {
11511
+ setState("failed");
11512
+ }
11513
+ };
11514
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "w100n-pdf-back", onKeyDown: (e) => {
11515
+ if (e.key === "Escape") {
11516
+ e.stopPropagation();
11517
+ onClose();
11518
+ }
11519
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("form", { className: "w100n-pdf-dialog w100n-new", role: "dialog", "aria-modal": true, "aria-labelledby": `${id}t`, onSubmit: (e) => {
11520
+ e.preventDefault();
11521
+ void make2();
11522
+ }, children: [
11523
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "w100n-new-head", children: [
11524
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "w100n-new-tile", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react8.Plus, { "aria-hidden": true }) }),
11525
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("b", { id: `${id}t`, className: "w100n-pdf-dialog-title", children: t.newTitle }),
11526
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: "w100n-docs-close", onClick: onClose, "aria-label": t.close, title: t.close, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react8.X, { "aria-hidden": true }) })
11527
+ ] }),
11528
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { role: "radiogroup", "aria-label": t.kind, className: "w100n-new-kinds", children: Object.keys(icons2).map((item) => {
11529
+ const Icon = icons2[item];
11530
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", role: "radio", "aria-checked": kind === item, "data-kind": item, onClick: () => {
11531
+ setKind(item);
11532
+ if (item === "sheet" || item === "slides") setTemplate("blank");
11533
+ }, children: [
11534
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "w100n-docs-tile", "data-kind": item, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { "aria-hidden": true }) }),
11535
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
11536
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("b", { children: t.newKinds[item] }),
11537
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("small", { children: t.kindHints[item] })
11538
+ ] })
11539
+ ] }, item);
11540
+ }) }),
11541
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "w100n-docs-caption", children: t.startFrom }),
11542
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { role: "radiogroup", "aria-label": t.startFrom, className: "w100n-new-templates", children: choices.map((item) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", role: "radio", "aria-checked": template === item, onClick: () => setTemplate(item), children: [
11543
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "w100n-new-sheet", "data-blank": item === "blank", children: item === "blank" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react8.Plus, { "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
11544
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("i", { "data-head": true }),
11545
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("i", {}),
11546
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("i", {}),
11547
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("i", { "data-accent": true }),
11548
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("i", {}),
11549
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("i", {})
11550
+ ] }) }),
11551
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: t.templates[item] })
11552
+ ] }, item)) }),
11553
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "w100n-new-fields", children: [
11554
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { children: [
11555
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "w100n-docs-caption", children: t.name }),
11556
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { className: "w100n-docs-field", autoFocus: true, value: name, onChange: (e) => setName(e.target.value), placeholder: template === "blank" ? t.untitled : t.templates[template] })
11557
+ ] }),
11558
+ host.createIn && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
11559
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "w100n-docs-caption", children: t.savesTo }),
11560
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "w100n-docs-field w100n-new-place", children: host.createIn })
11561
+ ] })
11562
+ ] }),
11563
+ state === "failed" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.makeFailed }),
11564
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "w100n-pdf-dialog-end", children: [
11565
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: "w100n-pdf-link", onClick: onClose, children: t.cancel }),
11566
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "submit", className: "w100n-docs-action", disabled: state === "busy", children: [
11567
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react8.Check, { "aria-hidden": true }),
11568
+ state === "busy" ? t.making : t.make
11569
+ ] })
11570
+ ] })
11571
+ ] }) });
11572
+ }
11573
+
11574
+ // src/Sharing.tsx
11575
+ var import_react14 = require("react");
11576
+ var import_lucide_react9 = require("lucide-react");
11577
+ init_useLoad();
11578
+ var import_jsx_runtime10 = require("react/jsx-runtime");
11579
+ var blank5 = { id: null, comment: false, download: false, askName: true, works: "30", day: "", password: false, secret: "", had: false };
11337
11580
  var local = (iso) => {
11338
11581
  const at = new Date(iso);
11339
11582
  return `${at.getFullYear()}-${String(at.getMonth() + 1).padStart(2, "0")}-${String(at.getDate()).padStart(2, "0")}`;
11340
11583
  };
11341
11584
  function Sharing({ host, doc, t, language, team }) {
11342
11585
  const links = useLoad((signal) => host.links(doc.id, { signal }), [host, doc.id]);
11343
- const [form, setForm] = (0, import_react13.useState)(null);
11344
- const [state, setState] = (0, import_react13.useState)("idle");
11345
- const [copied, setCopied] = (0, import_react13.useState)(null);
11586
+ const [form, setForm] = (0, import_react14.useState)(null);
11587
+ const [state, setState] = (0, import_react14.useState)("idle");
11588
+ const [copied, setCopied] = (0, import_react14.useState)(null);
11346
11589
  const text = doc.kind === "docx" || doc.kind === "markdown";
11347
11590
  const rules = new Intl.PluralRules(language);
11348
11591
  const count = (n, forms) => `${n} ${forms[rules.select(n)] ?? forms.other}`;
@@ -11404,31 +11647,31 @@ function Sharing({ host, doc, t, language, team }) {
11404
11647
  setCopied(null);
11405
11648
  }
11406
11649
  };
11407
- if (form) return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "w100n-share", children: [
11408
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("p", { className: "w100n-docs-caption", children: [
11409
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react8.Link, { "aria-hidden": true }),
11650
+ if (form) return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w100n-share", children: [
11651
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { className: "w100n-docs-caption", children: [
11652
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react9.Link, { "aria-hidden": true }),
11410
11653
  form.id ? t.changeLink : t.newLink
11411
11654
  ] }),
11412
- text && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "w100n-share-field", children: [
11413
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: t.guestsCan }),
11414
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "w100n-docs-chips", children: [
11415
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", "aria-pressed": !form.comment, onClick: () => setForm({ ...form, comment: false }), children: [
11416
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react8.Eye, { "aria-hidden": true }),
11655
+ text && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w100n-share-field", children: [
11656
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: t.guestsCan }),
11657
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w100n-docs-chips", children: [
11658
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", "aria-pressed": !form.comment, onClick: () => setForm({ ...form, comment: false }), children: [
11659
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react9.Eye, { "aria-hidden": true }),
11417
11660
  t.canRead
11418
11661
  ] }),
11419
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", "aria-pressed": form.comment, onClick: () => setForm({ ...form, comment: true }), children: [
11420
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react8.MessageSquarePlus, { "aria-hidden": true }),
11662
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", "aria-pressed": form.comment, onClick: () => setForm({ ...form, comment: true }), children: [
11663
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react9.MessageSquarePlus, { "aria-hidden": true }),
11421
11664
  t.canComment
11422
11665
  ] })
11423
11666
  ] })
11424
11667
  ] }),
11425
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "w100n-share-field", children: [
11426
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: t.linkWorks }),
11427
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "w100n-docs-chips", children: [["7", t.days7], ["30", t.days30], ["off", t.untilTurnOff], ["day", t.pickDay]].map(([key2, label]) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", "aria-pressed": form.works === key2, onClick: () => setForm({ ...form, works: key2 }), children: [
11428
- key2 === "day" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react8.CalendarDays, { "aria-hidden": true }),
11668
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w100n-share-field", children: [
11669
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: t.linkWorks }),
11670
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "w100n-docs-chips", children: [["7", t.days7], ["30", t.days30], ["off", t.untilTurnOff], ["day", t.pickDay]].map(([key2, label]) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", "aria-pressed": form.works === key2, onClick: () => setForm({ ...form, works: key2 }), children: [
11671
+ key2 === "day" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react9.CalendarDays, { "aria-hidden": true }),
11429
11672
  label
11430
11673
  ] }, key2)) }),
11431
- form.works === "day" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
11674
+ form.works === "day" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
11432
11675
  "input",
11433
11676
  {
11434
11677
  type: "date",
@@ -11440,14 +11683,14 @@ function Sharing({ host, doc, t, language, team }) {
11440
11683
  }
11441
11684
  )
11442
11685
  ] }),
11443
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "w100n-share-toggle", children: [
11444
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { type: "checkbox", checked: form.password, onChange: (e) => setForm({ ...form, password: e.target.checked }) }),
11445
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
11446
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("b", { children: t.passwordOn }),
11447
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("small", { children: t.passwordHint })
11686
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "w100n-share-toggle", children: [
11687
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "checkbox", checked: form.password, onChange: (e) => setForm({ ...form, password: e.target.checked }) }),
11688
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
11689
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("b", { children: t.passwordOn }),
11690
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("small", { children: t.passwordHint })
11448
11691
  ] })
11449
11692
  ] }),
11450
- form.password && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
11693
+ form.password && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
11451
11694
  "input",
11452
11695
  {
11453
11696
  type: "password",
@@ -11459,120 +11702,120 @@ function Sharing({ host, doc, t, language, team }) {
11459
11702
  onChange: (e) => setForm({ ...form, secret: e.target.value })
11460
11703
  }
11461
11704
  ),
11462
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "w100n-share-toggle", children: [
11463
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { type: "checkbox", checked: form.download, onChange: (e) => setForm({ ...form, download: e.target.checked }) }),
11464
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
11465
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("b", { children: t.downloadFile }),
11466
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("small", { children: t.downloadHint })
11705
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "w100n-share-toggle", children: [
11706
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "checkbox", checked: form.download, onChange: (e) => setForm({ ...form, download: e.target.checked }) }),
11707
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
11708
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("b", { children: t.downloadFile }),
11709
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("small", { children: t.downloadHint })
11467
11710
  ] })
11468
11711
  ] }),
11469
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "w100n-share-toggle", children: [
11470
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { type: "checkbox", checked: form.askName, onChange: (e) => setForm({ ...form, askName: e.target.checked }) }),
11471
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
11472
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("b", { children: t.askName }),
11473
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("small", { children: t.askNameHint })
11712
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "w100n-share-toggle", children: [
11713
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "checkbox", checked: form.askName, onChange: (e) => setForm({ ...form, askName: e.target.checked }) }),
11714
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
11715
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("b", { children: t.askName }),
11716
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("small", { children: t.askNameHint })
11474
11717
  ] })
11475
11718
  ] }),
11476
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "w100n-docs-muted", children: t.lastSaved }),
11477
- state === "failed" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.shareFailed }),
11478
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "w100n-pdf-dialog-end", children: [
11479
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: "w100n-pdf-link", onClick: () => {
11719
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "w100n-docs-muted", children: t.lastSaved }),
11720
+ state === "failed" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.shareFailed }),
11721
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "w100n-pdf-dialog-end", children: [
11722
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "w100n-pdf-link", onClick: () => {
11480
11723
  setForm(null);
11481
11724
  setState("idle");
11482
11725
  }, children: t.cancel }),
11483
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", className: "w100n-docs-action", disabled: !ready || state === "busy", onClick: () => void submit(), children: [
11484
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react8.Link, { "aria-hidden": true }),
11726
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", className: "w100n-docs-action", disabled: !ready || state === "busy", onClick: () => void submit(), children: [
11727
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react9.Link, { "aria-hidden": true }),
11485
11728
  form.id ? t.saveLink : t.makeLink
11486
11729
  ] })
11487
11730
  ] })
11488
11731
  ] });
11489
11732
  const on2 = links.data ?? [];
11490
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "w100n-share", children: [
11491
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("p", { className: "w100n-docs-caption", children: [
11492
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react8.Link, { "aria-hidden": true }),
11733
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w100n-share", children: [
11734
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { className: "w100n-docs-caption", children: [
11735
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react9.Link, { "aria-hidden": true }),
11493
11736
  t.guestLinks,
11494
- on2.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: on2.filter((l) => !l.ended).length })
11737
+ on2.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: on2.filter((l) => !l.ended).length })
11495
11738
  ] }),
11496
- links.error && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "w100n-docs-note", children: [
11739
+ links.error && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w100n-docs-note", children: [
11497
11740
  t.failed,
11498
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", onClick: links.retry, children: t.retry })
11741
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", onClick: links.retry, children: t.retry })
11499
11742
  ] }),
11500
- links.data && !on2.length && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "w100n-docs-muted", children: t.noLinks }),
11501
- state === "failed" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.shareFailed }),
11502
- on2.map((l) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("article", { className: "w100n-share-link", "data-ended": l.ended, children: [
11503
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("header", { children: [
11504
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "w100n-share-tile", "data-tone": l.comment ? "amber" : "blue", children: l.comment ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react8.MessageSquarePlus, { "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react8.Eye, { "aria-hidden": true }) }),
11505
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
11506
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("b", { children: l.comment ? t.commentLink : t.viewLink }),
11507
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("small", { children: [
11743
+ links.data && !on2.length && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "w100n-docs-muted", children: t.noLinks }),
11744
+ state === "failed" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.shareFailed }),
11745
+ on2.map((l) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("article", { className: "w100n-share-link", "data-ended": l.ended, children: [
11746
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("header", { children: [
11747
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "w100n-share-tile", "data-tone": l.comment ? "amber" : "blue", children: l.comment ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react9.MessageSquarePlus, { "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react9.Eye, { "aria-hidden": true }) }),
11748
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
11749
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("b", { children: l.comment ? t.commentLink : t.viewLink }),
11750
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("small", { children: [
11508
11751
  t.madeBy.replace("{name}", l.createdBy.name),
11509
11752
  " \xB7 ",
11510
11753
  day(l.createdAt)
11511
11754
  ] })
11512
11755
  ] })
11513
11756
  ] }),
11514
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "w100n-share-chips", children: [
11515
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
11516
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react8.Clock, { "aria-hidden": true }),
11757
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w100n-share-chips", children: [
11758
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
11759
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react9.Clock, { "aria-hidden": true }),
11517
11760
  l.ended ? t.linkEnded : l.endsAt ? t.endsOn.replace("{date}", day(l.endsAt)) : t.untilOff
11518
11761
  ] }),
11519
- l.download && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
11520
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react8.Download, { "aria-hidden": true }),
11762
+ l.download && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
11763
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react9.Download, { "aria-hidden": true }),
11521
11764
  t.downloadOn
11522
11765
  ] }),
11523
- l.password && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
11524
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react8.Lock, { "aria-hidden": true }),
11766
+ l.password && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
11767
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react9.Lock, { "aria-hidden": true }),
11525
11768
  t.passwordOn
11526
11769
  ] }),
11527
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
11528
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react8.Eye, { "aria-hidden": true }),
11770
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
11771
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react9.Eye, { "aria-hidden": true }),
11529
11772
  count(l.guests.reduce((n, g) => n + g.opens, 0), t.openForms)
11530
11773
  ] })
11531
11774
  ] }),
11532
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "w100n-share-url", children: [
11533
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: l.url.replace(/^https?:\/\//, "") }),
11534
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "blue", onClick: () => void copy2(l), children: [
11535
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react8.Copy, { "aria-hidden": true }),
11775
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w100n-share-url", children: [
11776
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: l.url.replace(/^https?:\/\//, "") }),
11777
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "blue", onClick: () => void copy2(l), children: [
11778
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react9.Copy, { "aria-hidden": true }),
11536
11779
  copied === l.id ? t.copied : t.copy
11537
11780
  ] })
11538
11781
  ] }),
11539
- l.guests.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "w100n-share-who", children: l.guests.map((g, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
11540
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "w100n-text-face", "aria-hidden": true, children: (g.name || "?").slice(0, 1).toUpperCase() }),
11541
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("b", { children: g.name || t.unnamed }),
11542
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("small", { children: [
11782
+ l.guests.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "w100n-share-who", children: l.guests.map((g, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
11783
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "w100n-text-face", "aria-hidden": true, children: (g.name || "?").slice(0, 1).toUpperCase() }),
11784
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("b", { children: g.name || t.unnamed }),
11785
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("small", { children: [
11543
11786
  g.comments ? count(g.comments, t.commentForms) : count(g.opens, t.openForms),
11544
11787
  " \xB7 ",
11545
11788
  ago(g.lastAt)
11546
11789
  ] })
11547
11790
  ] }, i)) }),
11548
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "w100n-share-tools", children: [
11549
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "slate", disabled: state === "busy", onClick: () => edit(l), children: [
11550
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react8.Clock, { "aria-hidden": true }),
11791
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w100n-share-tools", children: [
11792
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "slate", disabled: state === "busy", onClick: () => edit(l), children: [
11793
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react9.Clock, { "aria-hidden": true }),
11551
11794
  t.changeLink
11552
11795
  ] }),
11553
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "red", disabled: state === "busy", onClick: () => void off(l), children: [
11554
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react8.Ban, { "aria-hidden": true }),
11796
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "red", disabled: state === "busy", onClick: () => void off(l), children: [
11797
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react9.Ban, { "aria-hidden": true }),
11555
11798
  t.turnOff
11556
11799
  ] })
11557
11800
  ] })
11558
11801
  ] }, l.id)),
11559
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", className: "w100n-docs-action w100n-share-new", onClick: () => {
11802
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", className: "w100n-docs-action w100n-share-new", onClick: () => {
11560
11803
  setState("idle");
11561
- setForm(blank4);
11804
+ setForm(blank5);
11562
11805
  }, children: [
11563
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react8.Plus, { "aria-hidden": true }),
11806
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react9.Plus, { "aria-hidden": true }),
11564
11807
  t.newLink
11565
11808
  ] }),
11566
- team && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
11567
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("p", { className: "w100n-docs-caption", children: [
11568
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react8.Users, { "aria-hidden": true }),
11809
+ team && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
11810
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { className: "w100n-docs-caption", children: [
11811
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react9.Users, { "aria-hidden": true }),
11569
11812
  t.inTeam
11570
11813
  ] }),
11571
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "w100n-share-team", children: [
11572
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "w100n-share-tile", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react8.Users, { "aria-hidden": true }) }),
11573
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
11574
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("b", { children: t.peopleOf.replace("{space}", team) }),
11575
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("small", { children: t.teamHint })
11814
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w100n-share-team", children: [
11815
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "w100n-share-tile", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react9.Users, { "aria-hidden": true }) }),
11816
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
11817
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("b", { children: t.peopleOf.replace("{space}", team) }),
11818
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("small", { children: t.teamHint })
11576
11819
  ] })
11577
11820
  ] })
11578
11821
  ] })
@@ -11583,7 +11826,7 @@ function Sharing({ host, doc, t, language, team }) {
11583
11826
  init_text();
11584
11827
 
11585
11828
  // src/Thumb.tsx
11586
- var import_react14 = require("react");
11829
+ var import_react15 = require("react");
11587
11830
 
11588
11831
  // src/preview.ts
11589
11832
  var cache = /* @__PURE__ */ new Map();
@@ -11636,12 +11879,12 @@ function preview(host, doc) {
11636
11879
  }
11637
11880
 
11638
11881
  // src/Thumb.tsx
11639
- var import_jsx_runtime10 = require("react/jsx-runtime");
11882
+ var import_jsx_runtime11 = require("react/jsx-runtime");
11640
11883
  function Thumb({ host, item, label }) {
11641
- const box2 = (0, import_react14.useRef)(null);
11642
- const [seen2, setSeen] = (0, import_react14.useState)(false);
11643
- const [shot, setShot] = (0, import_react14.useState)(null);
11644
- (0, import_react14.useEffect)(() => {
11884
+ const box2 = (0, import_react15.useRef)(null);
11885
+ const [seen2, setSeen] = (0, import_react15.useState)(false);
11886
+ const [shot, setShot] = (0, import_react15.useState)(null);
11887
+ (0, import_react15.useEffect)(() => {
11645
11888
  if (item.thumbnailUrl || item.excerpt || typeof IntersectionObserver === "undefined") return;
11646
11889
  const watch = new IntersectionObserver((entries2) => {
11647
11890
  if (entries2.some((entry2) => entry2.isIntersecting)) setSeen(true);
@@ -11649,7 +11892,7 @@ function Thumb({ host, item, label }) {
11649
11892
  watch.observe(box2.current);
11650
11893
  return () => watch.disconnect();
11651
11894
  }, [item.thumbnailUrl, item.excerpt]);
11652
- (0, import_react14.useEffect)(() => {
11895
+ (0, import_react15.useEffect)(() => {
11653
11896
  if (!seen2) return;
11654
11897
  let live = true;
11655
11898
  void preview(host, item).then((found) => {
@@ -11662,47 +11905,47 @@ function Thumb({ host, item, label }) {
11662
11905
  const text = item.excerpt ?? shot?.text ?? "";
11663
11906
  const lines2 = text.split("\n").filter((line) => !line.trim().startsWith("```")).map((line) => line.replace(/^#+\s*/, "").replace(/[*_`>|]/g, "").trim()).filter(Boolean);
11664
11907
  const image = item.thumbnailUrl ?? shot?.image;
11665
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { ref: box2, className: "w100n-docs-thumb", "data-kind": item.kind, children: [
11666
- image ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("img", { src: image, alt: "" }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "w100n-docs-paper", "aria-hidden": true, children: lines2.length ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
11667
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("b", { children: lines2[0] }),
11908
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { ref: box2, className: "w100n-docs-thumb", "data-kind": item.kind, children: [
11909
+ image ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("img", { src: image, alt: "" }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w100n-docs-paper", "aria-hidden": true, children: lines2.length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
11910
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("b", { children: lines2[0] }),
11668
11911
  lines2.slice(1, 14).join(" ")
11669
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
11670
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("i", {}),
11671
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("i", {}),
11672
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("i", {}),
11673
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("i", {}),
11674
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("i", {})
11912
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
11913
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("i", {}),
11914
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("i", {}),
11915
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("i", {}),
11916
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("i", {}),
11917
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("i", {})
11675
11918
  ] }) }),
11676
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "w100n-docs-kind", "data-kind": item.kind, children: label })
11919
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w100n-docs-kind", "data-kind": item.kind, children: label })
11677
11920
  ] });
11678
11921
  }
11679
11922
 
11680
11923
  // src/DocumentsWorkspace.tsx
11681
11924
  init_useLoad();
11682
- var import_jsx_runtime11 = require("react/jsx-runtime");
11683
- var TextEditor3 = (0, import_react15.lazy)(() => Promise.resolve().then(() => (init_TextEditor(), TextEditor_exports)));
11684
- var SheetView3 = (0, import_react15.lazy)(() => Promise.resolve().then(() => (init_SheetView(), SheetView_exports)));
11685
- var icons2 = { docx: import_lucide_react9.FileText, markdown: import_lucide_react9.FileType, pdf: import_lucide_react9.Files, sheet: import_lucide_react9.FileSpreadsheet, slides: import_lucide_react9.Presentation };
11925
+ var import_jsx_runtime12 = require("react/jsx-runtime");
11926
+ var TextEditor3 = (0, import_react16.lazy)(() => Promise.resolve().then(() => (init_TextEditor(), TextEditor_exports)));
11927
+ var SheetView3 = (0, import_react16.lazy)(() => Promise.resolve().then(() => (init_SheetView(), SheetView_exports)));
11928
+ var icons3 = { docx: import_lucide_react10.FileText, markdown: import_lucide_react10.FileType, pdf: import_lucide_react10.Files, sheet: import_lucide_react10.FileSpreadsheet, slides: import_lucide_react10.Presentation };
11686
11929
  function DocumentsWorkspace({ host, language = "en", theme = "light", place: place2, onPlace, start, end, aside, actions }) {
11687
11930
  const t = texts[language];
11688
- const [own, setOwn] = (0, import_react15.useState)({ spaceId: null, documentId: null });
11931
+ const [own, setOwn] = (0, import_react16.useState)({ spaceId: null, documentId: null });
11689
11932
  const here = place2 ?? own;
11690
11933
  const go = (next) => {
11691
11934
  setOwn(next);
11692
11935
  onPlace?.(next);
11693
11936
  };
11694
- const [query, setQuery] = (0, import_react15.useState)("");
11695
- const [kind, setKind] = (0, import_react15.useState)("all");
11696
- const [listOpen, setListOpen] = (0, import_react15.useState)(true);
11697
- const [panelOpen, setPanelOpen] = (0, import_react15.useState)(true);
11698
- const [narrow, setNarrow] = (0, import_react15.useState)(false);
11699
- const body = (0, import_react15.useRef)(null);
11700
- const listButton = (0, import_react15.useRef)(null);
11701
- const panelButton = (0, import_react15.useRef)(null);
11702
- const listClose = (0, import_react15.useRef)(null);
11703
- const panel = (0, import_react15.useRef)(null);
11704
- const guard = (0, import_react15.useRef)(null);
11705
- (0, import_react15.useLayoutEffect)(() => {
11937
+ const [query, setQuery] = (0, import_react16.useState)("");
11938
+ const [kind, setKind] = (0, import_react16.useState)("all");
11939
+ const [listOpen, setListOpen] = (0, import_react16.useState)(true);
11940
+ const [panelOpen, setPanelOpen] = (0, import_react16.useState)(true);
11941
+ const [narrow, setNarrow] = (0, import_react16.useState)(false);
11942
+ const body = (0, import_react16.useRef)(null);
11943
+ const listButton = (0, import_react16.useRef)(null);
11944
+ const panelButton = (0, import_react16.useRef)(null);
11945
+ const listClose = (0, import_react16.useRef)(null);
11946
+ const panel = (0, import_react16.useRef)(null);
11947
+ const guard = (0, import_react16.useRef)(null);
11948
+ (0, import_react16.useLayoutEffect)(() => {
11706
11949
  const el = body.current;
11707
11950
  let was = false;
11708
11951
  const check = () => {
@@ -11720,8 +11963,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
11720
11963
  watch.observe(el);
11721
11964
  return () => watch.disconnect();
11722
11965
  }, [here.documentId]);
11723
- const [picking, setPicking] = (0, import_react15.useState)(false);
11724
- (0, import_react15.useEffect)(() => {
11966
+ const [picking, setPicking] = (0, import_react16.useState)(false);
11967
+ (0, import_react16.useEffect)(() => {
11725
11968
  if (!picking) return;
11726
11969
  const close = (e) => {
11727
11970
  if (!e.target.closest(".w100n-docs-picker")) setPicking(false);
@@ -11729,14 +11972,15 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
11729
11972
  document.addEventListener("pointerdown", close);
11730
11973
  return () => document.removeEventListener("pointerdown", close);
11731
11974
  }, [picking]);
11732
- const [tab, setTab] = (0, import_react15.useState)("outline");
11733
- const [outline2, setOutline] = (0, import_react15.useState)([]);
11734
- const [version2, setVersion] = (0, import_react15.useState)({ documentId: null, id: null });
11975
+ const [tab, setTab] = (0, import_react16.useState)("outline");
11976
+ const [outline2, setOutline] = (0, import_react16.useState)([]);
11977
+ const [version2, setVersion] = (0, import_react16.useState)({ documentId: null, id: null });
11735
11978
  const versionId = version2.documentId === here.documentId ? version2.id : null;
11736
- const [restoring, setRestoring] = (0, import_react15.useState)("idle");
11737
- const [exporting, setExporting] = (0, import_react15.useState)("idle");
11738
- const [copying, setCopying] = (0, import_react15.useState)("idle");
11739
- const [box2, setBox] = (0, import_react15.useState)(null);
11979
+ const [restoring, setRestoring] = (0, import_react16.useState)("idle");
11980
+ const [exporting, setExporting] = (0, import_react16.useState)("idle");
11981
+ const [copying, setCopying] = (0, import_react16.useState)("idle");
11982
+ const [box2, setBox] = (0, import_react16.useState)(null);
11983
+ const [making, setMaking] = (0, import_react16.useState)(false);
11740
11984
  const spaces = useLoad((signal) => host.spaces({ signal }), [host]);
11741
11985
  const single = spaces.data?.length === 1 ? spaces.data[0].id : null;
11742
11986
  const spaceId = here.spaceId ?? single;
@@ -11771,9 +12015,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
11771
12015
  return new Intl.DateTimeFormat(language, { day: "numeric", month: "short", year: "numeric" }).format(new Date(iso));
11772
12016
  };
11773
12017
  const size2 = (bytes) => bytes < 1024 ? `${bytes} B` : bytes < 1048576 ? `${(bytes / 1024).toFixed(0)} KB` : `${(bytes / 1048576).toFixed(1)} MB`;
11774
- const failed = (retry) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-docs-note", children: [
12018
+ const failed = (retry) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-docs-note", children: [
11775
12019
  t.failed,
11776
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", onClick: retry, children: t.retry })
12020
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", onClick: retry, children: t.retry })
11777
12021
  ] });
11778
12022
  const { ask, dialog } = useUnsaved(guard, t);
11779
12023
  const side2 = (which, open2) => {
@@ -11851,8 +12095,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
11851
12095
  setCopying("failed");
11852
12096
  }
11853
12097
  };
11854
- let stage = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-docs-empty", children: [
11855
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.FileText, { "aria-hidden": true }),
12098
+ let stage = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-docs-empty", children: [
12099
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.FileText, { "aria-hidden": true }),
11856
12100
  t.pick
11857
12101
  ] });
11858
12102
  if (here.documentId) {
@@ -11860,8 +12104,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
11860
12104
  doc.retry();
11861
12105
  content.retry();
11862
12106
  });
11863
- else if (!doc.data || !content.data) stage = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w100n-docs-empty", children: t.loading });
11864
- else if (doc.data.kind === "markdown" || doc.data.kind === "docx") stage = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react15.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
12107
+ else if (!doc.data || !content.data) stage = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w100n-docs-empty", children: t.loading });
12108
+ else if (doc.data.kind === "markdown" || doc.data.kind === "docx") stage = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react16.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
11865
12109
  TextEditor3,
11866
12110
  {
11867
12111
  kind: doc.data.kind,
@@ -11888,7 +12132,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
11888
12132
  },
11889
12133
  doc.data.id
11890
12134
  ) });
11891
- else if (doc.data.kind === "pdf") stage = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
12135
+ else if (doc.data.kind === "pdf") stage = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
11892
12136
  PdfView,
11893
12137
  {
11894
12138
  bytes: content.data,
@@ -11910,7 +12154,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
11910
12154
  },
11911
12155
  `${doc.data.id}:${versionId ?? ""}`
11912
12156
  );
11913
- else if (doc.data.kind === "slides") stage = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
12157
+ else if (doc.data.kind === "slides") stage = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
11914
12158
  SlidesView,
11915
12159
  {
11916
12160
  html: new TextDecoder().decode(content.data),
@@ -11929,7 +12173,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
11929
12173
  },
11930
12174
  doc.data.id
11931
12175
  );
11932
- else if (doc.data.kind === "sheet") stage = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react15.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
12176
+ else if (doc.data.kind === "sheet") stage = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react16.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
11933
12177
  SheetView3,
11934
12178
  {
11935
12179
  bytes: content.data,
@@ -11956,16 +12200,16 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
11956
12200
  },
11957
12201
  `${doc.data.id}:${versionId ?? ""}`
11958
12202
  ) });
11959
- else stage = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w100n-docs-empty", children: t.unsupported });
12203
+ else stage = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w100n-docs-empty", children: t.unsupported });
11960
12204
  }
11961
- const Kind = doc.data ? icons2[doc.data.kind] : import_lucide_react9.FileText;
12205
+ const Kind = doc.data ? icons3[doc.data.kind] : import_lucide_react10.FileText;
11962
12206
  const crumbs = doc.data ? [names2.get(doc.data.spaceId), doc.data.folder].filter(Boolean) : space ? [space.name] : [];
11963
- const panelTabs = [["outline", import_lucide_react9.ListTree, t.outline], ["versions", import_lucide_react9.History, t.versions], ["details", import_lucide_react9.Info, t.details]];
11964
- if (pdf && host.signatures) panelTabs.push(["signatures", import_lucide_react9.Signature, t.signatures]);
11965
- if (text && host.comments && !versionId) panelTabs.push(["comments", import_lucide_react9.MessagesSquare, t.comments]);
12207
+ const panelTabs = [["outline", import_lucide_react10.ListTree, t.outline], ["versions", import_lucide_react10.History, t.versions], ["details", import_lucide_react10.Info, t.details]];
12208
+ if (pdf && host.signatures) panelTabs.push(["signatures", import_lucide_react10.Signature, t.signatures]);
12209
+ if (text && host.comments && !versionId) panelTabs.push(["comments", import_lucide_react10.MessagesSquare, t.comments]);
11966
12210
  const sharing = !!host.links && !!doc.data?.rights.edit && !versionId;
11967
- if (sharing) panelTabs.push(["sharing", import_lucide_react9.Share2, t.sharing]);
11968
- const listToggle = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
12211
+ if (sharing) panelTabs.push(["sharing", import_lucide_react10.Share2, t.sharing]);
12212
+ const listToggle = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
11969
12213
  "button",
11970
12214
  {
11971
12215
  ref: listButton,
@@ -11975,10 +12219,10 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
11975
12219
  onClick: () => side2("list", !listOpen),
11976
12220
  "aria-label": listOpen ? t.closeList : t.openList,
11977
12221
  title: listOpen ? t.closeList : t.openList,
11978
- children: listOpen ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.PanelLeftClose, { "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.PanelLeftOpen, { "aria-hidden": true })
12222
+ children: listOpen ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.PanelLeftClose, { "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.PanelLeftOpen, { "aria-hidden": true })
11979
12223
  }
11980
12224
  );
11981
- const panelToggle = doc.data && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
12225
+ const panelToggle = doc.data && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
11982
12226
  "button",
11983
12227
  {
11984
12228
  ref: panelButton,
@@ -11988,163 +12232,167 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
11988
12232
  onClick: () => side2("panel", !panelOpen),
11989
12233
  "aria-label": panelOpen ? t.closePanel : t.openPanel,
11990
12234
  title: panelOpen ? t.closePanel : t.openPanel,
11991
- children: panelOpen ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.PanelRightClose, { "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.PanelRightOpen, { "aria-hidden": true })
12235
+ children: panelOpen ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.PanelRightClose, { "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.PanelRightOpen, { "aria-hidden": true })
11992
12236
  }
11993
12237
  );
11994
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-docs", "data-theme": theme, children: [
11995
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("header", { className: "w100n-docs-bar", children: [
11996
- start && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w100n-docs-start w100n-docs-slot", children: slot(start) }),
12238
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-docs", "data-theme": theme, children: [
12239
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("header", { className: "w100n-docs-bar", children: [
12240
+ start && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-start w100n-docs-slot", children: slot(start) }),
11997
12241
  narrow && listToggle,
11998
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w100n-docs-tile", "data-kind": doc.data?.kind, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Kind, { "aria-hidden": true }) }),
11999
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-docs-heading", children: [
12000
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { className: "w100n-docs-title", children: doc.data?.name ?? t.documents }),
12001
- crumbs.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w100n-docs-crumbs", children: crumbs.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
12002
- i > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.ChevronRight, { "aria-hidden": true }),
12242
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-tile", "data-kind": doc.data?.kind, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Kind, { "aria-hidden": true }) }),
12243
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-docs-heading", children: [
12244
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { className: "w100n-docs-title", children: doc.data?.name ?? t.documents }),
12245
+ crumbs.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-crumbs", children: crumbs.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [
12246
+ i > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.ChevronRight, { "aria-hidden": true }),
12003
12247
  item
12004
- ] }, i)) }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w100n-docs-hint", children: t.hint })
12248
+ ] }, i)) }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-hint", children: t.hint })
12005
12249
  ] }),
12006
- doc.data && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w100n-docs-badge", "data-kind": doc.data.kind, children: t.kinds[doc.data.kind] }),
12007
- versionId && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w100n-docs-badge", children: versions.data?.find((v) => v.id === versionId) && date(versions.data.find((v) => v.id === versionId).createdAt) }),
12008
- versionId && here.documentId && host.restore && doc.data?.rights.edit && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", className: "w100n-docs-action", disabled: restoring === "busy", onClick: () => void restore(here.documentId, versionId), children: [
12009
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.RotateCcw, { "aria-hidden": true }),
12250
+ doc.data && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-badge", "data-kind": doc.data.kind, children: t.kinds[doc.data.kind] }),
12251
+ versionId && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-badge", children: versions.data?.find((v) => v.id === versionId) && date(versions.data.find((v) => v.id === versionId).createdAt) }),
12252
+ versionId && here.documentId && host.restore && doc.data?.rights.edit && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("button", { type: "button", className: "w100n-docs-action", disabled: restoring === "busy", onClick: () => void restore(here.documentId, versionId), children: [
12253
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.RotateCcw, { "aria-hidden": true }),
12010
12254
  t.restore
12011
12255
  ] }),
12012
- restoring === "failed" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w100n-docs-muted", children: t.restoreFailed }),
12013
- doc.data?.convert && host.copyAs && !versionId && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "green", disabled: copying === "busy", onClick: () => void copyAs(doc.data), children: [
12014
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.FileSpreadsheet, { "aria-hidden": true }),
12256
+ restoring === "failed" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-muted", children: t.restoreFailed }),
12257
+ doc.data?.convert && host.copyAs && !versionId && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "green", disabled: copying === "busy", onClick: () => void copyAs(doc.data), children: [
12258
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.FileSpreadsheet, { "aria-hidden": true }),
12015
12259
  t.copyAs
12016
12260
  ] }),
12017
- copying === "failed" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w100n-docs-muted", children: t.copyFailed }),
12018
- sharing && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", className: "w100n-docs-action", "aria-label": t.share, title: t.share, onClick: () => {
12261
+ copying === "failed" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-muted", children: t.copyFailed }),
12262
+ sharing && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("button", { type: "button", className: "w100n-docs-action", "aria-label": t.share, title: t.share, onClick: () => {
12019
12263
  setTab("sharing");
12020
12264
  side2("panel", true);
12021
12265
  }, children: [
12022
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.Share2, { "aria-hidden": true }),
12023
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: t.share })
12266
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.Share2, { "aria-hidden": true }),
12267
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: t.share })
12024
12268
  ] }),
12025
12269
  doc.data && !versionId && actions?.(doc.data),
12270
+ host.create && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("button", { type: "button", className: "w100n-docs-action", "aria-label": t.create, title: t.create, onClick: () => setMaking(true), children: [
12271
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.Plus, { "aria-hidden": true }),
12272
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: t.create })
12273
+ ] }),
12026
12274
  narrow && panelToggle,
12027
- end && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w100n-docs-end w100n-docs-slot", children: slot(end) })
12275
+ end && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w100n-docs-end w100n-docs-slot", children: slot(end) })
12028
12276
  ] }),
12029
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { ref: body, className: "w100n-docs-body", children: [
12030
- listOpen && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("aside", { className: "w100n-docs-side w100n-docs-list", "aria-label": t.documents, children: [
12031
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-docs-head", children: [
12032
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-docs-row", children: [
12033
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("p", { className: "w100n-docs-caption", children: [
12034
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.Files, { "aria-hidden": true }),
12277
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { ref: body, className: "w100n-docs-body", children: [
12278
+ listOpen && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("aside", { className: "w100n-docs-side w100n-docs-list", "aria-label": t.documents, children: [
12279
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-docs-head", children: [
12280
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-docs-row", children: [
12281
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("p", { className: "w100n-docs-caption", children: [
12282
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.Files, { "aria-hidden": true }),
12035
12283
  t.documents,
12036
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: all.length })
12284
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: all.length })
12037
12285
  ] }),
12038
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { ref: listClose, type: "button", className: "w100n-docs-close", onClick: () => side2("list", false), "aria-label": t.closeList, title: t.closeList, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.X, { "aria-hidden": true }) })
12286
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { ref: listClose, type: "button", className: "w100n-docs-close", onClick: () => side2("list", false), "aria-label": t.closeList, title: t.closeList, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.X, { "aria-hidden": true }) })
12039
12287
  ] }),
12040
- (spaces.data?.length ?? 0) > 1 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-docs-picker", onKeyDown: (e) => {
12288
+ (spaces.data?.length ?? 0) > 1 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-docs-picker", onKeyDown: (e) => {
12041
12289
  if (e.key !== "Escape" || !picking) return;
12042
12290
  e.stopPropagation();
12043
12291
  setPicking(false);
12044
12292
  e.currentTarget.querySelector("button").focus();
12045
12293
  }, children: [
12046
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", className: "w100n-docs-field", "aria-haspopup": "listbox", "aria-expanded": picking, onClick: () => setPicking(!picking), children: [
12047
- space ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w100n-docs-dot", style: { background: space.color ?? void 0 } }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w100n-docs-all", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.LayoutGrid, { "aria-hidden": true }) }),
12048
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("b", { children: space?.name ?? t.allProjects }),
12049
- !space && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w100n-docs-count", children: all.length }),
12050
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.ChevronDown, { "aria-hidden": true })
12294
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("button", { type: "button", className: "w100n-docs-field", "aria-haspopup": "listbox", "aria-expanded": picking, onClick: () => setPicking(!picking), children: [
12295
+ space ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-dot", style: { background: space.color ?? void 0 } }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-all", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.LayoutGrid, { "aria-hidden": true }) }),
12296
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("b", { children: space?.name ?? t.allProjects }),
12297
+ !space && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-count", children: all.length }),
12298
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.ChevronDown, { "aria-hidden": true })
12051
12299
  ] }),
12052
- picking && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { role: "listbox", className: "w100n-docs-menu", children: [
12053
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", role: "option", "aria-selected": !spaceId, onClick: () => pick(null), children: [
12054
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w100n-docs-all", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.LayoutGrid, { "aria-hidden": true }) }),
12055
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("b", { children: t.allProjects }),
12056
- !spaceId && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.Check, { "aria-hidden": true })
12300
+ picking && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { role: "listbox", className: "w100n-docs-menu", children: [
12301
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("button", { type: "button", role: "option", "aria-selected": !spaceId, onClick: () => pick(null), children: [
12302
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-all", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.LayoutGrid, { "aria-hidden": true }) }),
12303
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("b", { children: t.allProjects }),
12304
+ !spaceId && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.Check, { "aria-hidden": true })
12057
12305
  ] }),
12058
- groups2.map((group) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { role: "group", "aria-label": group || void 0, children: [
12059
- group && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "w100n-docs-menu-caption", children: group }),
12060
- (spaces.data ?? []).filter((item) => (item.group ?? "") === group).map((item) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", role: "option", "aria-selected": item.id === spaceId, onClick: () => pick(item.id), children: [
12061
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w100n-docs-dot", style: { background: item.color ?? void 0 } }),
12062
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("b", { children: item.name }),
12063
- !spaceId && counts.get(item.id) ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w100n-docs-count", children: counts.get(item.id) }) : null,
12064
- item.id === spaceId && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.Check, { "aria-hidden": true })
12306
+ groups2.map((group) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { role: "group", "aria-label": group || void 0, children: [
12307
+ group && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "w100n-docs-menu-caption", children: group }),
12308
+ (spaces.data ?? []).filter((item) => (item.group ?? "") === group).map((item) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("button", { type: "button", role: "option", "aria-selected": item.id === spaceId, onClick: () => pick(item.id), children: [
12309
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-dot", style: { background: item.color ?? void 0 } }),
12310
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("b", { children: item.name }),
12311
+ !spaceId && counts.get(item.id) ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-count", children: counts.get(item.id) }) : null,
12312
+ item.id === spaceId && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.Check, { "aria-hidden": true })
12065
12313
  ] }, item.id))
12066
12314
  ] }, group))
12067
12315
  ] })
12068
12316
  ] }),
12069
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "w100n-docs-field w100n-docs-search", children: [
12070
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.Search, { "aria-hidden": true }),
12071
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { value: query, onChange: (event) => setQuery(event.target.value), placeholder: t.search, "aria-label": t.search })
12317
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "w100n-docs-field w100n-docs-search", children: [
12318
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.Search, { "aria-hidden": true }),
12319
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { value: query, onChange: (event) => setQuery(event.target.value), placeholder: t.search, "aria-label": t.search })
12072
12320
  ] }),
12073
- present.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w100n-docs-chips", role: "group", "aria-label": t.kind, children: ["all", ...present].map((item) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", "aria-pressed": kind === item, onClick: () => setKind(item), children: [
12321
+ present.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w100n-docs-chips", role: "group", "aria-label": t.kind, children: ["all", ...present].map((item) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("button", { type: "button", "aria-pressed": kind === item, onClick: () => setKind(item), children: [
12074
12322
  item === "all" ? t.all : t.kinds[item],
12075
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-hidden": true, children: item === "all" ? all.length : all.filter((doc2) => doc2.kind === item).length })
12323
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { "aria-hidden": true, children: item === "all" ? all.length : all.filter((doc2) => doc2.kind === item).length })
12076
12324
  ] }, item)) })
12077
12325
  ] }),
12078
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-docs-cards", children: [
12326
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-docs-cards", children: [
12079
12327
  list.error && failed(list.retry),
12080
- list.loading && !list.data && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "w100n-docs-muted", children: t.loading }),
12081
- list.data && !shown.length && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "w100n-docs-muted", children: all.length ? t.nothing : t.empty }),
12082
- folders.map((folder2) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-docs-folder", role: "group", "aria-label": folder2 || t.loose, children: [
12083
- folders.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "w100n-docs-group", children: folder2 || t.loose }),
12084
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w100n-docs-grid", children: shown.filter((item) => !spaceId || (item.folder ?? "") === folder2).map((item) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", className: "w100n-docs-card", "aria-current": item.id === here.documentId, onClick: () => open(item), title: item.name, children: [
12085
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Thumb, { host, item, label: t.kinds[item.kind] }),
12086
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "w100n-docs-card-text", children: [
12087
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("b", { children: item.name }),
12088
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("small", { children: [!spaceId && names2.get(item.spaceId), ago(item.updatedAt)].filter(Boolean).join(" \xB7 ") })
12328
+ list.loading && !list.data && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "w100n-docs-muted", children: t.loading }),
12329
+ list.data && !shown.length && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "w100n-docs-muted", children: all.length ? t.nothing : t.empty }),
12330
+ folders.map((folder2) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-docs-folder", role: "group", "aria-label": folder2 || t.loose, children: [
12331
+ folders.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "w100n-docs-group", children: folder2 || t.loose }),
12332
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w100n-docs-grid", children: shown.filter((item) => !spaceId || (item.folder ?? "") === folder2).map((item) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("button", { type: "button", className: "w100n-docs-card", "aria-current": item.id === here.documentId, onClick: () => open(item), title: item.name, children: [
12333
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Thumb, { host, item, label: t.kinds[item.kind] }),
12334
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "w100n-docs-card-text", children: [
12335
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("b", { children: item.name }),
12336
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("small", { children: [!spaceId && names2.get(item.spaceId), ago(item.updatedAt)].filter(Boolean).join(" \xB7 ") })
12089
12337
  ] })
12090
12338
  ] }, item.id)) })
12091
12339
  ] }, folder2))
12092
12340
  ] })
12093
12341
  ] }),
12094
12342
  !narrow && !listOpen && listToggle,
12095
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("main", { className: "w100n-docs-stage", children: [
12343
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("main", { className: "w100n-docs-stage", children: [
12096
12344
  !narrow && !panelOpen && panelToggle,
12097
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w100n-docs-bare", children: stage })
12345
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w100n-docs-bare", children: stage })
12098
12346
  ] }),
12099
- doc.data && panelOpen && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("aside", { ref: panel, className: "w100n-docs-side w100n-docs-panel", "aria-label": t.details, children: [
12100
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w100n-docs-head", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-docs-row", children: [
12101
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w100n-docs-tabs", role: "tablist", "aria-label": t.details, "data-compact": panelTabs.length > 3, onKeyDown: rove, children: panelTabs.map(([key2, Icon, label]) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", role: "tab", "aria-selected": tab === key2, tabIndex: tab === key2 ? 0 : -1, "aria-label": label, title: label, onClick: () => setTab(key2), children: [
12102
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { "aria-hidden": true }),
12347
+ doc.data && panelOpen && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("aside", { ref: panel, className: "w100n-docs-side w100n-docs-panel", "aria-label": t.details, children: [
12348
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w100n-docs-head", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-docs-row", children: [
12349
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w100n-docs-tabs", role: "tablist", "aria-label": t.details, "data-compact": panelTabs.length > 3, onKeyDown: rove, children: panelTabs.map(([key2, Icon, label]) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("button", { type: "button", role: "tab", "aria-selected": tab === key2, tabIndex: tab === key2 ? 0 : -1, "aria-label": label, title: label, onClick: () => setTab(key2), children: [
12350
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { "aria-hidden": true }),
12103
12351
  (panelTabs.length < 4 || tab === key2) && label
12104
12352
  ] }, key2)) }),
12105
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: "w100n-docs-close", onClick: () => side2("panel", false), "aria-label": t.closePanel, title: t.closePanel, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.X, { "aria-hidden": true }) })
12353
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: "w100n-docs-close", onClick: () => side2("panel", false), "aria-label": t.closePanel, title: t.closePanel, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.X, { "aria-hidden": true }) })
12106
12354
  ] }) }),
12107
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-docs-panel-body", role: "tabpanel", "aria-label": panelTabs.find(([key2]) => key2 === tab)?.[2], children: [
12108
- tab === "outline" && (outline2.length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("nav", { className: "w100n-docs-outline", children: outline2.map((item) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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__ */ (0, import_jsx_runtime11.jsx)("p", { className: "w100n-docs-muted", children: t.noOutline })),
12109
- tab === "versions" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-docs-versions", children: [
12355
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-docs-panel-body", role: "tabpanel", "aria-label": panelTabs.find(([key2]) => key2 === tab)?.[2], children: [
12356
+ tab === "outline" && (outline2.length ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("nav", { className: "w100n-docs-outline", children: outline2.map((item) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("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__ */ (0, import_jsx_runtime12.jsx)("p", { className: "w100n-docs-muted", children: t.noOutline })),
12357
+ tab === "versions" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-docs-versions", children: [
12110
12358
  versions.error && failed(versions.retry),
12111
- (versions.data ?? []).map((item) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
12359
+ (versions.data ?? []).map((item) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
12112
12360
  "button",
12113
12361
  {
12114
12362
  type: "button",
12115
12363
  "aria-pressed": (versionId ?? "current") === item.id || !versionId && item.current,
12116
12364
  onClick: () => view(item.current ? null : item.id),
12117
12365
  children: [
12118
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("b", { children: [
12366
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("b", { children: [
12119
12367
  date(item.createdAt),
12120
- item.current && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w100n-docs-badge", children: t.current })
12368
+ item.current && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-badge", children: t.current })
12121
12369
  ] }),
12122
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("small", { children: [item.author?.name, size2(item.size), item.note].filter(Boolean).join(" \xB7 ") })
12370
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("small", { children: [item.author?.name, size2(item.size), item.note].filter(Boolean).join(" \xB7 ") })
12123
12371
  ]
12124
12372
  },
12125
12373
  item.id
12126
12374
  ))
12127
12375
  ] }),
12128
- tab === "details" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("dl", { className: "w100n-docs-details", children: [
12129
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dt", { children: t.kind }),
12130
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dd", { children: t.kinds[doc.data.kind] }),
12131
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dt", { children: t.size }),
12132
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dd", { children: size2(doc.data.size) }),
12133
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dt", { children: t.updated }),
12134
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dd", { children: date(doc.data.updatedAt) }),
12135
- doc.data.updatedBy && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
12136
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dt", { children: t.by }),
12137
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dd", { children: doc.data.updatedBy.name })
12376
+ tab === "details" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("dl", { className: "w100n-docs-details", children: [
12377
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dt", { children: t.kind }),
12378
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dd", { children: t.kinds[doc.data.kind] }),
12379
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dt", { children: t.size }),
12380
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dd", { children: size2(doc.data.size) }),
12381
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dt", { children: t.updated }),
12382
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dd", { children: date(doc.data.updatedAt) }),
12383
+ doc.data.updatedBy && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
12384
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dt", { children: t.by }),
12385
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dd", { children: doc.data.updatedBy.name })
12138
12386
  ] }),
12139
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dt", { children: t.rights }),
12140
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dd", { children: [doc.data.rights.view && t.view, doc.data.rights.comment && t.comment, doc.data.rights.edit && t.edit].filter(Boolean).join(", ") })
12387
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dt", { children: t.rights }),
12388
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dd", { children: [doc.data.rights.view && t.view, doc.data.rights.comment && t.comment, doc.data.rights.edit && t.edit].filter(Boolean).join(", ") })
12141
12389
  ] }),
12142
- tab === "details" && host.exportAs && !!doc.data.exports?.length && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-docs-about", children: [
12143
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("p", { className: "w100n-docs-caption", children: [
12144
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.FileDown, { "aria-hidden": true }),
12390
+ tab === "details" && host.exportAs && !!doc.data.exports?.length && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-docs-about", children: [
12391
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("p", { className: "w100n-docs-caption", children: [
12392
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.FileDown, { "aria-hidden": true }),
12145
12393
  t.exportAs
12146
12394
  ] }),
12147
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w100n-docs-chips", children: doc.data.exports.map((format) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
12395
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w100n-docs-chips", children: doc.data.exports.map((format) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
12148
12396
  "button",
12149
12397
  {
12150
12398
  type: "button",
@@ -12152,22 +12400,22 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
12152
12400
  disabled: exporting === "busy",
12153
12401
  onClick: () => void exportAs(doc.data, format),
12154
12402
  children: [
12155
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react9.FileDown, { "aria-hidden": true }),
12403
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.FileDown, { "aria-hidden": true }),
12156
12404
  format.toUpperCase()
12157
12405
  ]
12158
12406
  },
12159
12407
  format
12160
12408
  )) }),
12161
- exporting === "failed" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "w100n-docs-muted", children: t.exportFailed })
12409
+ exporting === "failed" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "w100n-docs-muted", children: t.exportFailed })
12162
12410
  ] }),
12163
- tab === "comments" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { ref: setBox }),
12164
- tab === "sharing" && sharing && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Sharing, { host, doc: doc.data, t, language, team: names2.get(doc.data.spaceId) }),
12165
- tab === "signatures" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w100n-docs-versions", children: [
12411
+ tab === "comments" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { ref: setBox }),
12412
+ tab === "sharing" && sharing && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Sharing, { host, doc: doc.data, t, language, team: names2.get(doc.data.spaceId) }),
12413
+ tab === "signatures" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-docs-versions", children: [
12166
12414
  signatures.error && failed(signatures.retry),
12167
- signatures.data?.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "w100n-docs-muted", children: t.noSignatures }),
12415
+ signatures.data?.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "w100n-docs-muted", children: t.noSignatures }),
12168
12416
  (signatures.data ?? []).map((entry2) => {
12169
12417
  const signed = versions.data?.find((v) => v.id === entry2.versionId);
12170
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
12418
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
12171
12419
  "button",
12172
12420
  {
12173
12421
  type: "button",
@@ -12175,15 +12423,15 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
12175
12423
  "aria-pressed": !!signed && (versionId ?? versions.data?.find((v) => v.current)?.id) === signed.id,
12176
12424
  onClick: () => view(signed.current ? null : signed.id),
12177
12425
  children: [
12178
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("b", { children: [
12426
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("b", { children: [
12179
12427
  entry2.signer.name,
12180
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "w100n-docs-badge", children: [
12428
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "w100n-docs-badge", children: [
12181
12429
  t.page,
12182
12430
  " ",
12183
12431
  entry2.page
12184
12432
  ] })
12185
12433
  ] }),
12186
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("small", { children: [date(entry2.signedAt), t.methods[entry2.method], signed && (signed.current ? t.current : `${t.version} ${date(signed.createdAt)}`)].filter(Boolean).join(" \xB7 ") })
12434
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("small", { children: [date(entry2.signedAt), t.methods[entry2.method], signed && (signed.current ? t.current : `${t.version} ${date(signed.createdAt)}`)].filter(Boolean).join(" \xB7 ") })
12187
12435
  ]
12188
12436
  },
12189
12437
  entry2.id
@@ -12194,19 +12442,25 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
12194
12442
  ] })
12195
12443
  ] })
12196
12444
  ] }),
12445
+ making && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(NewDocument, { host, t, onClose: () => setMaking(false), onMade: (made2) => {
12446
+ setMaking(false);
12447
+ spaces.retry();
12448
+ list.retry();
12449
+ ask(() => go({ spaceId: here.spaceId && made2.spaceId, documentId: made2.id }));
12450
+ } }),
12197
12451
  dialog
12198
12452
  ] });
12199
12453
  }
12200
12454
 
12201
12455
  // src/GuestDocument.tsx
12202
- var import_react16 = require("react");
12203
- var import_lucide_react10 = require("lucide-react");
12456
+ var import_react17 = require("react");
12457
+ var import_lucide_react11 = require("lucide-react");
12204
12458
  init_text();
12205
12459
  init_useLoad();
12206
- var import_jsx_runtime12 = require("react/jsx-runtime");
12207
- var TextEditor4 = (0, import_react16.lazy)(() => Promise.resolve().then(() => (init_TextEditor(), TextEditor_exports)));
12208
- var SheetView4 = (0, import_react16.lazy)(() => Promise.resolve().then(() => (init_SheetView(), SheetView_exports)));
12209
- var icons3 = { docx: import_lucide_react10.FileText, markdown: import_lucide_react10.FileType, pdf: import_lucide_react10.Files, sheet: import_lucide_react10.FileSpreadsheet, slides: import_lucide_react10.Presentation };
12460
+ var import_jsx_runtime13 = require("react/jsx-runtime");
12461
+ var TextEditor4 = (0, import_react17.lazy)(() => Promise.resolve().then(() => (init_TextEditor(), TextEditor_exports)));
12462
+ var SheetView4 = (0, import_react17.lazy)(() => Promise.resolve().then(() => (init_SheetView(), SheetView_exports)));
12463
+ var icons4 = { docx: import_lucide_react11.FileText, markdown: import_lucide_react11.FileType, pdf: import_lucide_react11.Files, sheet: import_lucide_react11.FileSpreadsheet, slides: import_lucide_react11.Presentation };
12210
12464
  var GuestRefused = class extends Error {
12211
12465
  constructor(reason, file = "", sharedBy = "") {
12212
12466
  super(reason);
@@ -12231,14 +12485,14 @@ var remember = (name) => {
12231
12485
  };
12232
12486
  function GuestDocument({ host, language = "en", theme = "light", brand }) {
12233
12487
  const t = texts[language];
12234
- const [ask, setAsk] = (0, import_react16.useState)(() => ({ name: remembered() || void 0 }));
12235
- const [typed, setTyped] = (0, import_react16.useState)("");
12236
- const [name, setName] = (0, import_react16.useState)(remembered);
12237
- const named3 = (0, import_react16.useRef)(name);
12238
- const [slot, setSlot] = (0, import_react16.useState)(null);
12239
- const [saving, setSaving] = (0, import_react16.useState)("idle");
12488
+ const [ask, setAsk] = (0, import_react17.useState)(() => ({ name: remembered() || void 0 }));
12489
+ const [typed, setTyped] = (0, import_react17.useState)("");
12490
+ const [name, setName] = (0, import_react17.useState)(remembered);
12491
+ const named3 = (0, import_react17.useRef)(name);
12492
+ const [slot, setSlot] = (0, import_react17.useState)(null);
12493
+ const [saving, setSaving] = (0, import_react17.useState)("idle");
12240
12494
  const opened2 = useLoad((signal) => host.open(ask, { signal }), [host, ask]);
12241
- const [notes2] = (0, import_react16.useState)(() => ({
12495
+ const [notes2] = (0, import_react17.useState)(() => ({
12242
12496
  me: { id: "", name: "" },
12243
12497
  spaces: async () => [],
12244
12498
  documents: async () => [],
@@ -12264,18 +12518,18 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
12264
12518
  };
12265
12519
  const top = (file2, badge) => {
12266
12520
  const kind2 = file2 ? kindOf(file2.name, file2.mimeType) : null;
12267
- const Kind = kind2 ? icons3[kind2] : import_lucide_react10.FileText;
12268
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("header", { className: "w100n-docs-bar w100n-guest-bar", children: [
12269
- brand && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-guest-brand", children: brand }),
12270
- file2 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
12271
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-tile", "data-kind": kind2, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Kind, { "aria-hidden": true }) }),
12272
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-docs-heading", children: [
12273
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { className: "w100n-docs-title", children: file2.name }),
12274
- file2.sharedBy && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-crumbs", children: t.sharedBy.replace("{name}", file2.sharedBy) })
12521
+ const Kind = kind2 ? icons4[kind2] : import_lucide_react11.FileText;
12522
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("header", { className: "w100n-docs-bar w100n-guest-bar", children: [
12523
+ brand && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w100n-guest-brand", children: brand }),
12524
+ file2 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
12525
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w100n-docs-tile", "data-kind": kind2, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Kind, { "aria-hidden": true }) }),
12526
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-docs-heading", children: [
12527
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { className: "w100n-docs-title", children: file2.name }),
12528
+ file2.sharedBy && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w100n-docs-crumbs", children: t.sharedBy.replace("{name}", file2.sharedBy) })
12275
12529
  ] }),
12276
- badge && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-badge", "data-kind": kind2, children: badge }),
12277
- file2.download && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-docs-end", children: [
12278
- (kind2 === "docx" || kind2 === "markdown" || kind2 === "sheet" || kind2 === "slides") && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
12530
+ badge && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w100n-docs-badge", "data-kind": kind2, children: badge }),
12531
+ file2.download && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-docs-end", children: [
12532
+ (kind2 === "docx" || kind2 === "markdown" || kind2 === "sheet" || kind2 === "slides") && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
12279
12533
  "button",
12280
12534
  {
12281
12535
  type: "button",
@@ -12286,41 +12540,41 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
12286
12540
  "aria-label": t.pdfCopy,
12287
12541
  title: t.pdfCopy,
12288
12542
  children: [
12289
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.FileDown, { "aria-hidden": true }),
12290
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: t.pdfCopy })
12543
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.FileDown, { "aria-hidden": true }),
12544
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: t.pdfCopy })
12291
12545
  ]
12292
12546
  }
12293
12547
  ),
12294
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("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: [
12295
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.Download, { "aria-hidden": true }),
12296
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: t.download })
12548
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("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: [
12549
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Download, { "aria-hidden": true }),
12550
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: t.download })
12297
12551
  ] })
12298
12552
  ] })
12299
12553
  ] })
12300
12554
  ] });
12301
12555
  };
12302
- const gate = (tone, Icon, title, body, form) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
12556
+ const gate = (tone, Icon, title, body, form) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
12303
12557
  top(null, null),
12304
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w100n-guest-gate", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-guest-card", children: [
12305
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-share-tile", "data-tone": tone, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { "aria-hidden": true }) }),
12306
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h2", { children: title }),
12307
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { children: body }),
12558
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "w100n-guest-gate", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-guest-card", children: [
12559
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w100n-share-tile", "data-tone": tone, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, { "aria-hidden": true }) }),
12560
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h2", { children: title }),
12561
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { children: body }),
12308
12562
  form
12309
12563
  ] }) })
12310
12564
  ] });
12311
12565
  if (opened2.error) {
12312
12566
  const refused = opened2.error instanceof GuestRefused ? opened2.error : null;
12313
- if (refused?.reason === "ended") return gate("slate", import_lucide_react10.Ban, t.endedTitle, t.endedText);
12314
- if (refused?.reason === "missing") return gate("slate", import_lucide_react10.Ban, t.missingTitle, t.missingText);
12567
+ if (refused?.reason === "ended") return gate("slate", import_lucide_react11.Ban, t.endedTitle, t.endedText);
12568
+ if (refused?.reason === "missing") return gate("slate", import_lucide_react11.Ban, t.missingTitle, t.missingText);
12315
12569
  if (refused?.reason === "password" || refused?.reason === "wrong" || refused?.reason === "name") {
12316
12570
  const password = refused.reason !== "name";
12317
12571
  const shared = refused.sharedBy ? `${t.sharedBy.replace("{name}", refused.sharedBy)}. ` : "";
12318
12572
  return gate(
12319
12573
  "violet",
12320
- password ? import_lucide_react10.Lock : import_lucide_react10.UserRound,
12574
+ password ? import_lucide_react11.Lock : import_lucide_react11.UserRound,
12321
12575
  refused.file || t.documents,
12322
12576
  shared + (password ? t.passwordAsk : t.nameAsk),
12323
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("form", { className: "w100n-guest-form", onSubmit: (e) => {
12577
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("form", { className: "w100n-guest-form", onSubmit: (e) => {
12324
12578
  e.preventDefault();
12325
12579
  if (!typed.trim()) return;
12326
12580
  if (password) setAsk({ ...ask, password: typed });
@@ -12330,7 +12584,7 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
12330
12584
  }
12331
12585
  setTyped("");
12332
12586
  }, children: [
12333
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
12587
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
12334
12588
  "input",
12335
12589
  {
12336
12590
  className: "w100n-share-input",
@@ -12343,21 +12597,21 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
12343
12597
  onChange: (e) => setTyped(e.target.value)
12344
12598
  }
12345
12599
  ),
12346
- refused.reason === "wrong" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.wrongPassword }),
12347
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("button", { type: "submit", className: "w100n-docs-action", disabled: !typed.trim(), children: [
12348
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react10.Eye, { "aria-hidden": true }),
12600
+ refused.reason === "wrong" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.wrongPassword }),
12601
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "submit", className: "w100n-docs-action", disabled: !typed.trim(), children: [
12602
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react11.Eye, { "aria-hidden": true }),
12349
12603
  t.openDoc
12350
12604
  ] })
12351
12605
  ] })
12352
12606
  );
12353
12607
  }
12354
- if (refused?.reason === "busy") return gate("slate", import_lucide_react10.Ban, t.failed, t.tooMany);
12355
- return gate("slate", import_lucide_react10.Ban, t.failed, "", /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: "w100n-docs-action", onClick: opened2.retry, children: t.retry }));
12608
+ if (refused?.reason === "busy") return gate("slate", import_lucide_react11.Ban, t.failed, t.tooMany);
12609
+ return gate("slate", import_lucide_react11.Ban, t.failed, "", /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "w100n-docs-action", onClick: opened2.retry, children: t.retry }));
12356
12610
  }
12357
12611
  const file = opened2.data;
12358
- if (!file) return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
12612
+ if (!file) return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
12359
12613
  top(null, null),
12360
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w100n-docs-empty", children: t.loading })
12614
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "w100n-docs-empty", children: t.loading })
12361
12615
  ] });
12362
12616
  const kind = kindOf(file.name, file.mimeType);
12363
12617
  const text = kind === "docx" || kind === "markdown";
@@ -12365,23 +12619,23 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
12365
12619
  const rights = { view: true, comment: talk, edit: false };
12366
12620
  const quiet3 = () => {
12367
12621
  };
12368
- let stage = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w100n-docs-empty", children: t.unsupported });
12369
- if (text) stage = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react16.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TextEditor4, { kind, bytes: file.bytes, t, language, rights, host: talk ? notes2 : void 0, documentId: file.id, onOutline: quiet3, slot: talk ? slot : null }) });
12370
- else if (kind === "pdf") stage = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PdfView, { bytes: file.bytes, t, language, worker: host.pdfWorker, rights, documentId: file.id, onOutline: quiet3 });
12371
- else if (kind === "slides") stage = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SlidesView, { html: new TextDecoder().decode(file.bytes), name: file.name, rights, language, theme, onOutline: quiet3 });
12372
- else if (kind === "sheet") stage = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react16.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SheetView4, { bytes: file.bytes, name: file.name, kind: /\.csv$/i.test(file.name) || file.mimeType === "text/csv" ? "csv" : "xlsx", rights, language, theme, documentId: file.id }) });
12373
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
12622
+ let stage = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "w100n-docs-empty", children: t.unsupported });
12623
+ if (text) stage = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react17.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TextEditor4, { kind, bytes: file.bytes, t, language, rights, host: talk ? notes2 : void 0, documentId: file.id, onOutline: quiet3, slot: talk ? slot : null }) });
12624
+ else if (kind === "pdf") stage = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PdfView, { bytes: file.bytes, t, language, worker: host.pdfWorker, rights, documentId: file.id, onOutline: quiet3 });
12625
+ else if (kind === "slides") stage = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SlidesView, { html: new TextDecoder().decode(file.bytes), name: file.name, rights, language, theme, onOutline: quiet3 });
12626
+ else if (kind === "sheet") stage = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react17.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SheetView4, { bytes: file.bytes, name: file.name, kind: /\.csv$/i.test(file.name) || file.mimeType === "text/csv" ? "csv" : "xlsx", rights, language, theme, documentId: file.id }) });
12627
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
12374
12628
  top(file, talk ? t.badgeComment : t.badgeRead),
12375
- saving === "failed" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "w100n-docs-muted w100n-guest-note", role: "alert", children: t.exportFailed }),
12376
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-docs-body w100n-guest-body", children: [
12377
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("main", { className: "w100n-docs-stage", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w100n-docs-bare", children: stage }) }),
12378
- talk && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("aside", { className: "w100n-docs-side w100n-docs-panel w100n-guest-panel", "aria-label": t.comments, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w100n-docs-panel-body", children: [
12379
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "w100n-share-field", children: [
12380
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: t.yourName }),
12381
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { className: "w100n-share-input", value: name, autoComplete: "name", placeholder: t.yourName, onChange: (e) => typeName(e.target.value) })
12629
+ saving === "failed" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "w100n-docs-muted w100n-guest-note", role: "alert", children: t.exportFailed }),
12630
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-docs-body w100n-guest-body", children: [
12631
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("main", { className: "w100n-docs-stage", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "w100n-docs-bare", children: stage }) }),
12632
+ talk && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("aside", { className: "w100n-docs-side w100n-docs-panel w100n-guest-panel", "aria-label": t.comments, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w100n-docs-panel-body", children: [
12633
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "w100n-share-field", children: [
12634
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: t.yourName }),
12635
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { className: "w100n-share-input", value: name, autoComplete: "name", placeholder: t.yourName, onChange: (e) => typeName(e.target.value) })
12382
12636
  ] }),
12383
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "w100n-docs-muted", children: name.trim() ? t.nameHint : t.nameNeeded }),
12384
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { ref: setSlot })
12637
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "w100n-docs-muted", children: name.trim() ? t.nameHint : t.nameNeeded }),
12638
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { ref: setSlot })
12385
12639
  ] }) })
12386
12640
  ] })
12387
12641
  ] });