@files-preview-app/preview-file 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/angular.cjs CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var core = require('@angular/core');
6
6
  var common = require('@angular/common');
7
- var DOMPurify6 = require('dompurify');
7
+ var DOMPurify2 = require('dompurify');
8
8
  var docx = require('docx-preview');
9
9
  var fflate = require('fflate');
10
10
  var XLSX = require('xlsx');
@@ -37,7 +37,7 @@ function _interopNamespace(e) {
37
37
  return Object.freeze(n);
38
38
  }
39
39
 
40
- var DOMPurify6__default = /*#__PURE__*/_interopDefault(DOMPurify6);
40
+ var DOMPurify2__default = /*#__PURE__*/_interopDefault(DOMPurify2);
41
41
  var docx__namespace = /*#__PURE__*/_interopNamespace(docx);
42
42
  var XLSX__namespace = /*#__PURE__*/_interopNamespace(XLSX);
43
43
  var hljs__default = /*#__PURE__*/_interopDefault(hljs);
@@ -418,7 +418,7 @@ async function sourceToArrayBuffer(source, signal) {
418
418
  return { buffer, metadata };
419
419
  }
420
420
  function sanitizeSVG(svg) {
421
- return DOMPurify6__default.default.sanitize(svg, {
421
+ return DOMPurify2__default.default.sanitize(svg, {
422
422
  USE_PROFILES: { svg: true, svgFilters: true }
423
423
  });
424
424
  }
@@ -478,6 +478,9 @@ var ICON_THUMBNAILS = `<svg width="24" height="24" viewBox="0 0 24 24" fill="non
478
478
  var ICON_CLOSE = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>`;
479
479
  var ICON_FULLSCREEN = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"></path></svg>`;
480
480
  var ICON_COPY = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>`;
481
+ var ICON_FAST_FORWARD = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="13 19 22 12 13 5 13 19"></polygon><polygon points="2 19 11 12 2 5 2 19"></polygon></svg>`;
482
+ var ICON_REWIND = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="11 19 2 12 11 5 11 19"></polygon><polygon points="22 19 13 12 22 5 22 19"></polygon></svg>`;
483
+ var ICON_SPEED = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>`;
481
484
  var ICON_MAP = {
482
485
  "zoom-in": ICON_ZOOM_IN,
483
486
  "zoom-out": ICON_ZOOM_OUT,
@@ -498,7 +501,12 @@ var ICON_MAP = {
498
501
  "page-prev": ICON_PAGE_PREV,
499
502
  "page-next": ICON_PAGE_NEXT,
500
503
  "chevron-left": ICON_PAGE_PREV,
501
- "chevron-right": ICON_PAGE_NEXT
504
+ "chevron-right": ICON_PAGE_NEXT,
505
+ "fast-forward": ICON_FAST_FORWARD,
506
+ "forward-10": ICON_FAST_FORWARD,
507
+ "rewind": ICON_REWIND,
508
+ "replay-10": ICON_REWIND,
509
+ "speed": ICON_SPEED
502
510
  };
503
511
  var ToolbarController = class {
504
512
  el;
@@ -1466,6 +1474,16 @@ var MediaPlugin = class {
1466
1474
  }
1467
1475
  if (instance.play) {
1468
1476
  actions.push(
1477
+ {
1478
+ id: "replay-10",
1479
+ icon: "replay-10",
1480
+ label: "Rewind 10s",
1481
+ type: "button",
1482
+ group: "actions",
1483
+ execute: () => {
1484
+ instance.rewind?.(10);
1485
+ }
1486
+ },
1469
1487
  {
1470
1488
  id: "play",
1471
1489
  icon: "play",
@@ -1485,6 +1503,26 @@ var MediaPlugin = class {
1485
1503
  execute: () => {
1486
1504
  instance.pause?.();
1487
1505
  }
1506
+ },
1507
+ {
1508
+ id: "forward-10",
1509
+ icon: "forward-10",
1510
+ label: "Fast Forward 10s",
1511
+ type: "button",
1512
+ group: "actions",
1513
+ execute: () => {
1514
+ instance.fastForward?.(10);
1515
+ }
1516
+ },
1517
+ {
1518
+ id: "speed",
1519
+ icon: "speed",
1520
+ label: "Playback Speed",
1521
+ type: "button",
1522
+ group: "actions",
1523
+ execute: () => {
1524
+ instance.cycleSpeed?.();
1525
+ }
1488
1526
  }
1489
1527
  );
1490
1528
  }
@@ -1607,6 +1645,28 @@ var MediaPlugin = class {
1607
1645
  play: mediaElement ? () => mediaElement?.play() : void 0,
1608
1646
  pause: mediaElement ? () => mediaElement?.pause() : void 0,
1609
1647
  isPlaying: mediaElement ? () => !mediaElement?.paused : void 0,
1648
+ fastForward: mediaElement ? (seconds = 10) => {
1649
+ if (mediaElement) {
1650
+ mediaElement.currentTime = Math.min(mediaElement.duration || Infinity, mediaElement.currentTime + seconds);
1651
+ }
1652
+ } : void 0,
1653
+ rewind: mediaElement ? (seconds = 10) => {
1654
+ if (mediaElement) {
1655
+ mediaElement.currentTime = Math.max(0, mediaElement.currentTime - seconds);
1656
+ }
1657
+ } : void 0,
1658
+ cycleSpeed: mediaElement ? () => {
1659
+ if (mediaElement) {
1660
+ const speeds = [1, 1.25, 1.5, 2, 0.5];
1661
+ const curIndex = speeds.indexOf(mediaElement.playbackRate);
1662
+ const nextIndex = curIndex === -1 ? 0 : (curIndex + 1) % speeds.length;
1663
+ mediaElement.playbackRate = speeds[nextIndex];
1664
+ }
1665
+ } : void 0,
1666
+ setPlaybackRate: mediaElement ? (rate) => {
1667
+ if (mediaElement) mediaElement.playbackRate = rate;
1668
+ } : void 0,
1669
+ getPlaybackRate: mediaElement ? () => mediaElement?.playbackRate ?? 1 : void 0,
1610
1670
  download: () => {
1611
1671
  const a = document.createElement("a");
1612
1672
  a.href = url;
@@ -1688,16 +1748,35 @@ var DocxPlugin = class {
1688
1748
  wrapper.style.transformOrigin = "top center";
1689
1749
  wrapper.style.transition = "transform 0.2s ease";
1690
1750
  wrapper.style.padding = "24px 16px";
1691
- wrapper.style.maxWidth = "900px";
1751
+ wrapper.style.maxWidth = "950px";
1692
1752
  wrapper.style.margin = "0 auto";
1693
1753
  wrapper.style.boxSizing = "border-box";
1694
1754
  ctx.container.style.overflow = "auto";
1695
1755
  ctx.container.style.backgroundColor = "#f1f5f9";
1696
1756
  ctx.container.appendChild(wrapper);
1757
+ const styleOverride = document.createElement("style");
1758
+ styleOverride.textContent = `
1759
+ .fp-docx-wrapper .docx-wrapper {
1760
+ background: transparent !important;
1761
+ padding: 0 !important;
1762
+ display: flex !important;
1763
+ flex-direction: column !important;
1764
+ align-items: center !important;
1765
+ box-sizing: border-box !important;
1766
+ }
1767
+ .fp-docx-wrapper section.docx {
1768
+ box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08) !important;
1769
+ border-radius: 4px !important;
1770
+ margin-bottom: 24px !important;
1771
+ background-color: #ffffff !important;
1772
+ }
1773
+ `;
1774
+ ctx.container.appendChild(styleOverride);
1697
1775
  let scale = 1;
1698
1776
  let renderedSuccessfully = false;
1777
+ const createdBlobUrls = [];
1699
1778
  try {
1700
- await docx__namespace.renderAsync(ctx.buffer, wrapper, ctx.container, {
1779
+ await docx__namespace.renderAsync(ctx.buffer, wrapper, wrapper, {
1701
1780
  inWrapper: true,
1702
1781
  ignoreWidth: false,
1703
1782
  ignoreHeight: false,
@@ -1706,19 +1785,25 @@ var DocxPlugin = class {
1706
1785
  breakPages: true,
1707
1786
  experimental: true
1708
1787
  });
1788
+ if (!ctx.container.contains(wrapper)) {
1789
+ ctx.container.appendChild(wrapper);
1790
+ }
1709
1791
  if (wrapper.children.length > 0 && (wrapper.textContent?.trim().length ?? 0) > 0) {
1710
1792
  renderedSuccessfully = true;
1711
1793
  }
1712
1794
  } catch (err) {
1713
- console.warn("[DocxPlugin] docx-preview failed, triggering native XML fallback:", err);
1795
+ console.warn("[DocxPlugin] docx-preview failed, triggering native fallback:", err);
1714
1796
  }
1715
1797
  if (!renderedSuccessfully) {
1716
1798
  try {
1717
1799
  wrapper.innerHTML = "";
1718
- this.renderXmlFallback(ctx, wrapper);
1800
+ this.renderXmlFallback(ctx, wrapper, createdBlobUrls);
1801
+ if (!ctx.container.contains(wrapper)) {
1802
+ ctx.container.appendChild(wrapper);
1803
+ }
1719
1804
  renderedSuccessfully = true;
1720
1805
  } catch (fallbackErr) {
1721
- console.error("[DocxPlugin] XML fallback failed:", fallbackErr);
1806
+ console.error("[DocxPlugin] Native fallback failed:", fallbackErr);
1722
1807
  wrapper.innerHTML = `
1723
1808
  <div style="text-align:center; padding: 48px; background: #fff; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.06);">
1724
1809
  <div style="font-size:48px; margin-bottom: 16px;">\u{1F4C4}</div>
@@ -1726,10 +1811,17 @@ var DocxPlugin = class {
1726
1811
  <p style="color: #64748b; margin: 0;">Could not parse document content</p>
1727
1812
  </div>
1728
1813
  `;
1814
+ if (!ctx.container.contains(wrapper)) {
1815
+ ctx.container.appendChild(wrapper);
1816
+ }
1729
1817
  }
1730
1818
  }
1731
1819
  const cleanup = () => {
1820
+ for (const url of createdBlobUrls) {
1821
+ URL.revokeObjectURL(url);
1822
+ }
1732
1823
  wrapper.remove();
1824
+ styleOverride.remove();
1733
1825
  ctx.container.innerHTML = "";
1734
1826
  };
1735
1827
  ctx.signal.addEventListener("abort", cleanup);
@@ -1766,13 +1858,50 @@ var DocxPlugin = class {
1766
1858
  }
1767
1859
  };
1768
1860
  }
1769
- renderXmlFallback(ctx, wrapper) {
1861
+ renderXmlFallback(ctx, wrapper, createdBlobUrls) {
1862
+ const magic = new Uint8Array(ctx.buffer.slice(0, 8));
1863
+ if (magic[0] === 208 && magic[1] === 207 && magic[2] === 17 && magic[3] === 224) {
1864
+ this.renderBinaryDocFallback(ctx, wrapper);
1865
+ return;
1866
+ }
1770
1867
  const unzipped = fflate.unzipSync(new Uint8Array(ctx.buffer));
1771
- const docXmlEntry = unzipped["word/document.xml"];
1868
+ const docKey = Object.keys(unzipped).find((k) => k.replace(/^[./\\]+/, "").toLowerCase() === "word/document.xml");
1869
+ const docXmlEntry = docKey ? unzipped[docKey] : void 0;
1772
1870
  if (!docXmlEntry) throw new Error("Missing word/document.xml in DOCX package");
1773
1871
  const xmlStr = fflate.strFromU8(docXmlEntry);
1774
1872
  const parser = new DOMParser();
1775
1873
  const doc = parser.parseFromString(xmlStr, "application/xml");
1874
+ const imageMap = {};
1875
+ const relsKey = Object.keys(unzipped).find((k) => k.replace(/^[./\\]+/, "").toLowerCase() === "word/_rels/document.xml.rels");
1876
+ if (relsKey && unzipped[relsKey]) {
1877
+ try {
1878
+ const relsXml = fflate.strFromU8(unzipped[relsKey]);
1879
+ const relsDoc = parser.parseFromString(relsXml, "application/xml");
1880
+ const relEls = Array.from(relsDoc.getElementsByTagName("Relationship"));
1881
+ for (const rel of relEls) {
1882
+ const rId = rel.getAttribute("Id");
1883
+ const target = rel.getAttribute("Target");
1884
+ if (rId && target) {
1885
+ const cleanTarget = target.replace(/^\.\.\//, "").replace(/^\//, "");
1886
+ const fullTargetKey = Object.keys(unzipped).find((k) => {
1887
+ const norm = k.replace(/^[./\\]+/, "").toLowerCase();
1888
+ return norm === ("word/" + cleanTarget).toLowerCase() || norm === cleanTarget.toLowerCase();
1889
+ });
1890
+ if (fullTargetKey && unzipped[fullTargetKey]) {
1891
+ const bytes = unzipped[fullTargetKey];
1892
+ const ext = cleanTarget.split(".").pop()?.toLowerCase() || "png";
1893
+ const mime = ext === "jpg" || ext === "jpeg" ? "image/jpeg" : ext === "gif" ? "image/gif" : ext === "svg" ? "image/svg+xml" : "image/png";
1894
+ const blob = new Blob([bytes], { type: mime });
1895
+ const blobUrl = URL.createObjectURL(blob);
1896
+ imageMap[rId] = blobUrl;
1897
+ createdBlobUrls.push(blobUrl);
1898
+ }
1899
+ }
1900
+ }
1901
+ } catch (relsErr) {
1902
+ console.warn("[DocxPlugin] Error parsing relationships:", relsErr);
1903
+ }
1904
+ }
1776
1905
  const card = document.createElement("div");
1777
1906
  card.className = "fp-docx-page-card";
1778
1907
  card.style.backgroundColor = "#ffffff";
@@ -1790,7 +1919,7 @@ var DocxPlugin = class {
1790
1919
  const pStyle = child.getElementsByTagNameNS("*", "pStyle")[0];
1791
1920
  const styleVal = pStyle?.getAttribute("w:val") || pStyle?.getAttribute("val") || "";
1792
1921
  const numPr = child.getElementsByTagNameNS("*", "numPr")[0];
1793
- const textContent = this.extractParagraphHtml(child);
1922
+ const textContent = this.extractParagraphHtml(child, imageMap);
1794
1923
  if (!textContent.trim()) {
1795
1924
  html += '<div style="height: 10px;"></div>';
1796
1925
  continue;
@@ -1816,7 +1945,7 @@ var DocxPlugin = class {
1816
1945
  html += `<tr style="${rIdx === 0 ? "background-color: #f8fafc; font-weight: 600;" : ""}">`;
1817
1946
  const cells = Array.from(tr.getElementsByTagNameNS("*", "tc"));
1818
1947
  cells.forEach((tc) => {
1819
- const cellText = this.extractParagraphHtml(tc);
1948
+ const cellText = this.extractParagraphHtml(tc, imageMap);
1820
1949
  html += `<td style="border: 1px solid #cbd5e1; padding: 8px 12px; font-size: 13px;">${cellText || "&nbsp;"}</td>`;
1821
1950
  });
1822
1951
  html += "</tr>";
@@ -1824,34 +1953,63 @@ var DocxPlugin = class {
1824
1953
  html += "</table>";
1825
1954
  }
1826
1955
  }
1827
- card.innerHTML = DOMPurify6__default.default.sanitize(html, {
1828
- ADD_TAGS: ["h1", "h2", "h3", "h4", "p", "table", "tr", "td", "span", "b", "i", "u", "img", "div"],
1956
+ card.innerHTML = DOMPurify2__default.default.sanitize(html, {
1957
+ ADD_TAGS: ["h1", "h2", "h3", "h4", "p", "table", "tr", "td", "span", "b", "i", "u", "s", "strike", "img", "div", "br"],
1829
1958
  ADD_ATTR: ["style", "src", "alt", "colspan", "rowspan"]
1830
1959
  });
1831
1960
  wrapper.appendChild(card);
1832
1961
  }
1833
- extractParagraphHtml(pElement) {
1962
+ extractParagraphHtml(pElement, imageMap = {}) {
1834
1963
  let result = "";
1964
+ const drawings = Array.from(pElement.getElementsByTagNameNS("*", "drawing"));
1965
+ for (const drawing of drawings) {
1966
+ const blip = drawing.getElementsByTagNameNS("*", "blip")[0];
1967
+ const rId = blip?.getAttribute("r:embed") || blip?.getAttribute("r:id");
1968
+ if (rId && imageMap[rId]) {
1969
+ result += `<div style="text-align:center; margin: 12px 0;"><img src="${imageMap[rId]}" style="max-width: 100%; height: auto; border-radius: 4px;" /></div>`;
1970
+ }
1971
+ }
1835
1972
  const runs = Array.from(pElement.getElementsByTagNameNS("*", "r"));
1836
- if (runs.length === 0) {
1837
- return DOMPurify6__default.default.sanitize(pElement.textContent || "");
1973
+ if (runs.length === 0 && !result) {
1974
+ return DOMPurify2__default.default.sanitize(pElement.textContent || "");
1838
1975
  }
1839
1976
  for (const r of runs) {
1977
+ const blip = r.getElementsByTagNameNS("*", "blip")[0] || r.getElementsByTagNameNS("*", "imagedata")[0];
1978
+ const rId = blip?.getAttribute("r:embed") || blip?.getAttribute("r:id");
1979
+ if (rId && imageMap[rId]) {
1980
+ result += `<img src="${imageMap[rId]}" style="max-width: 100%; height: auto; display: inline-block; margin: 4px;" />`;
1981
+ }
1982
+ const brs = r.getElementsByTagNameNS("*", "br");
1983
+ for (let i = 0; i < brs.length; i++) {
1984
+ result += "<br/>";
1985
+ }
1986
+ const tabs = r.getElementsByTagNameNS("*", "tab");
1987
+ if (tabs.length > 0) {
1988
+ result += "&emsp;";
1989
+ }
1840
1990
  const rPr = r.getElementsByTagNameNS("*", "rPr")[0];
1841
1991
  const isBold = !!rPr?.getElementsByTagNameNS("*", "b")[0];
1842
1992
  const isItalic = !!rPr?.getElementsByTagNameNS("*", "i")[0];
1843
1993
  const isUnderline = !!rPr?.getElementsByTagNameNS("*", "u")[0];
1994
+ const isStrike = !!rPr?.getElementsByTagNameNS("*", "strike")[0];
1844
1995
  const colorNode = rPr?.getElementsByTagNameNS("*", "color")[0];
1845
1996
  const colorVal = colorNode?.getAttribute("w:val") || colorNode?.getAttribute("val");
1997
+ const szNode = rPr?.getElementsByTagNameNS("*", "sz")[0];
1998
+ const szVal = szNode?.getAttribute("w:val") || szNode?.getAttribute("val");
1846
1999
  const texts = Array.from(r.getElementsByTagNameNS("*", "t"));
1847
2000
  let text = texts.map((t) => t.textContent || "").join("");
1848
2001
  if (!text) continue;
1849
- text = DOMPurify6__default.default.sanitize(text);
2002
+ text = DOMPurify2__default.default.sanitize(text);
1850
2003
  let styles = "";
1851
2004
  if (isBold) styles += "font-weight: bold; ";
1852
2005
  if (isItalic) styles += "font-style: italic; ";
1853
2006
  if (isUnderline) styles += "text-decoration: underline; ";
2007
+ if (isStrike) styles += "text-decoration: line-through; ";
1854
2008
  if (colorVal && colorVal !== "auto") styles += `color: #${colorVal}; `;
2009
+ if (szVal) {
2010
+ const pt = parseInt(szVal, 10) / 2;
2011
+ if (!isNaN(pt) && pt > 0) styles += `font-size: ${pt}pt; `;
2012
+ }
1855
2013
  if (styles) {
1856
2014
  result += `<span style="${styles}">${text}</span>`;
1857
2015
  } else {
@@ -1860,6 +2018,52 @@ var DocxPlugin = class {
1860
2018
  }
1861
2019
  return result;
1862
2020
  }
2021
+ renderBinaryDocFallback(ctx, wrapper) {
2022
+ const card = document.createElement("div");
2023
+ card.className = "fp-docx-page-card";
2024
+ card.style.backgroundColor = "#ffffff";
2025
+ card.style.borderRadius = "6px";
2026
+ card.style.boxShadow = "0 4px 24px rgba(0,0,0,0.08)";
2027
+ card.style.padding = "48px 56px";
2028
+ card.style.fontFamily = 'Calibri, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
2029
+ card.style.color = "#1e293b";
2030
+ card.style.lineHeight = "1.6";
2031
+ try {
2032
+ const cfbf = new CfbfReader(ctx.buffer);
2033
+ const wordDocStream = cfbf.readStream("WordDocument");
2034
+ if (wordDocStream && wordDocStream.length >= 512) {
2035
+ const text2 = this.extractReadableStrings(wordDocStream);
2036
+ card.innerHTML = `<div style="white-space: pre-wrap;">${DOMPurify2__default.default.sanitize(text2)}</div>`;
2037
+ wrapper.appendChild(card);
2038
+ return;
2039
+ }
2040
+ } catch {
2041
+ }
2042
+ const text = this.extractReadableStrings(new Uint8Array(ctx.buffer));
2043
+ card.innerHTML = `<div style="white-space: pre-wrap;">${DOMPurify2__default.default.sanitize(text)}</div>`;
2044
+ wrapper.appendChild(card);
2045
+ }
2046
+ extractReadableStrings(bytes) {
2047
+ let result = "";
2048
+ let current = "";
2049
+ for (let i = 0; i < bytes.length; i++) {
2050
+ const b = bytes[i];
2051
+ if (b >= 32 && b <= 126 || b === 10 || b === 13 || b === 9) {
2052
+ current += String.fromCharCode(b);
2053
+ } else if (b === 0 && i + 1 < bytes.length && bytes[i + 1] >= 32 && bytes[i + 1] <= 126) {
2054
+ continue;
2055
+ } else {
2056
+ if (current.trim().length > 3) {
2057
+ result += current.trim() + "\n\n";
2058
+ }
2059
+ current = "";
2060
+ }
2061
+ }
2062
+ if (current.trim().length > 3) {
2063
+ result += current.trim();
2064
+ }
2065
+ return result;
2066
+ }
1863
2067
  };
1864
2068
  function docxPlugin() {
1865
2069
  return new DocxPlugin();
@@ -2671,7 +2875,7 @@ var MarkdownPlugin = class {
2671
2875
  gfm: true,
2672
2876
  breaks: true
2673
2877
  });
2674
- const cleanHtml = DOMPurify6__default.default.sanitize(rawHtml, {
2878
+ const cleanHtml = DOMPurify2__default.default.sanitize(rawHtml, {
2675
2879
  USE_PROFILES: { html: true }
2676
2880
  });
2677
2881
  const wrapper = document.createElement("div");
@@ -3386,7 +3590,7 @@ var HtmlPreviewPlugin = class {
3386
3590
  }
3387
3591
  async render(ctx) {
3388
3592
  const rawHtml = new TextDecoder("utf-8").decode(ctx.buffer);
3389
- const sanitized = DOMPurify6__default.default.sanitize(rawHtml, {
3593
+ const sanitized = DOMPurify2__default.default.sanitize(rawHtml, {
3390
3594
  WHOLE_DOCUMENT: true,
3391
3595
  ADD_TAGS: ["style", "link"],
3392
3596
  ADD_ATTR: ["target", "rel"]
@@ -3629,7 +3833,7 @@ var OpenDocumentPlugin = class {
3629
3833
  wrapper.style.padding = "48px";
3630
3834
  wrapper.style.minHeight = "100%";
3631
3835
  const bodyHtml = this.renderOdfBody(contentDoc, styleMap, imageUrls);
3632
- wrapper.innerHTML = DOMPurify6__default.default.sanitize(bodyHtml, {
3836
+ wrapper.innerHTML = DOMPurify2__default.default.sanitize(bodyHtml, {
3633
3837
  ADD_TAGS: ["math", "semantics", "mrow", "mi", "mo", "mn", "msup", "msub"],
3634
3838
  ADD_ATTR: ["style", "colspan", "rowspan"]
3635
3839
  });
@@ -4149,24 +4353,24 @@ var DocPlugin = class {
4149
4353
  html += "</ul>";
4150
4354
  inList = false;
4151
4355
  }
4152
- html += `<h2 style="font-size: 18px; font-weight: 700; color: #1e3a8a; margin: 20px 0 8px; border-bottom: 1px solid #e2e8f0; padding-bottom: 4px;">${DOMPurify6__default.default.sanitize(line)}</h2>`;
4356
+ html += `<h2 style="font-size: 18px; font-weight: 700; color: #1e3a8a; margin: 20px 0 8px; border-bottom: 1px solid #e2e8f0; padding-bottom: 4px;">${DOMPurify2__default.default.sanitize(line)}</h2>`;
4153
4357
  } else if (line.startsWith("\u2022") || line.startsWith("-") || line.startsWith("*")) {
4154
4358
  if (!inList) {
4155
4359
  html += '<ul style="margin: 8px 0; padding-left: 24px;">';
4156
4360
  inList = true;
4157
4361
  }
4158
4362
  const bulletText = line.replace(/^[•\-\*]\s*/, "");
4159
- html += `<li style="margin: 4px 0; line-height: 1.6;">${DOMPurify6__default.default.sanitize(bulletText)}</li>`;
4363
+ html += `<li style="margin: 4px 0; line-height: 1.6;">${DOMPurify2__default.default.sanitize(bulletText)}</li>`;
4160
4364
  } else {
4161
4365
  if (inList) {
4162
4366
  html += "</ul>";
4163
4367
  inList = false;
4164
4368
  }
4165
- html += `<p style="line-height: 1.7; margin: 10px 0; font-size: 14px; text-align: justify;">${DOMPurify6__default.default.sanitize(line)}</p>`;
4369
+ html += `<p style="line-height: 1.7; margin: 10px 0; font-size: 14px; text-align: justify;">${DOMPurify2__default.default.sanitize(line)}</p>`;
4166
4370
  }
4167
4371
  }
4168
4372
  if (inList) html += "</ul>";
4169
- return html || `<p style="color: #64748b; font-style: italic;">(No readable text found in ${DOMPurify6__default.default.sanitize(filename)})</p>`;
4373
+ return html || `<p style="color: #64748b; font-style: italic;">(No readable text found in ${DOMPurify2__default.default.sanitize(filename)})</p>`;
4170
4374
  }
4171
4375
  };
4172
4376
  function docPlugin() {
@@ -4321,10 +4525,10 @@ var PptPlugin = class {
4321
4525
  </div>
4322
4526
  <div style="text-align: center; width: 100%;">
4323
4527
  <h1 style="font-size: ${idx === 1 ? "36px" : "28px"}; color: #1e3a8a; margin: 0 0 24px; font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-weight: 700;">
4324
- ${DOMPurify6__default.default.sanitize(s.title || `Slide ${idx}`)}
4528
+ ${DOMPurify2__default.default.sanitize(s.title || `Slide ${idx}`)}
4325
4529
  </h1>
4326
4530
  <div style="display: flex; flex-direction: column; gap: 12px; max-width: 80%; margin: 0 auto; text-align: ${idx === 1 ? "center" : "left"};">
4327
- ${s.texts.map((t) => `<div style="font-size: 18px; color: #334155; line-height: 1.5; font-family: -apple-system, BlinkMacSystemFont, sans-serif;">${DOMPurify6__default.default.sanitize(t)}</div>`).join("")}
4531
+ ${s.texts.map((t) => `<div style="font-size: 18px; color: #334155; line-height: 1.5; font-family: -apple-system, BlinkMacSystemFont, sans-serif;">${DOMPurify2__default.default.sanitize(t)}</div>`).join("")}
4328
4532
  </div>
4329
4533
  </div>
4330
4534
  `;