@files-preview-app/preview-file 1.2.9 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -336,16 +336,21 @@ async function sourceToArrayBuffer(source, signal) {
336
336
  metadata.mimeType = source.type || void 0;
337
337
  metadata.extension = extractExtension(source.name);
338
338
  buffer = await source.arrayBuffer();
339
- } else if (source instanceof Blob) {
339
+ } else if (source instanceof Blob || source && typeof source.arrayBuffer === "function" && typeof source.size === "number") {
340
340
  metadata.size = source.size;
341
341
  metadata.mimeType = source.type || void 0;
342
+ if (source.name) {
343
+ metadata.name = source.name;
344
+ metadata.extension = extractExtension(source.name);
345
+ }
342
346
  buffer = await source.arrayBuffer();
343
- } else if (source instanceof ArrayBuffer) {
347
+ } else if (source instanceof ArrayBuffer || Object.prototype.toString.call(source) === "[object ArrayBuffer]" || source && typeof source.byteLength === "number" && typeof source.slice === "function") {
344
348
  buffer = source;
345
- } else if (source instanceof Uint8Array) {
346
- buffer = source.buffer.slice(
347
- source.byteOffset,
348
- source.byteOffset + source.byteLength
349
+ } else if (source instanceof Uint8Array || ArrayBuffer.isView(source)) {
350
+ const view = source;
351
+ buffer = view.buffer.slice(
352
+ view.byteOffset,
353
+ view.byteOffset + view.byteLength
349
354
  );
350
355
  } else {
351
356
  throw new Error("Unsupported file source type");
@@ -474,6 +479,86 @@ function createElement(tag, attrs, ...children) {
474
479
  }
475
480
  return el;
476
481
  }
482
+ var DB_NAME = "PreviewFileTransferDB";
483
+ var DB_STORE = "transfers";
484
+ function openDB() {
485
+ return new Promise((resolve, reject) => {
486
+ if (typeof indexedDB === "undefined") {
487
+ return reject(new Error("IndexedDB is not available"));
488
+ }
489
+ const req = indexedDB.open(DB_NAME, 1);
490
+ req.onupgradeneeded = () => {
491
+ const db = req.result;
492
+ if (!db.objectStoreNames.contains(DB_STORE)) {
493
+ db.createObjectStore(DB_STORE, { keyPath: "id" });
494
+ }
495
+ };
496
+ req.onsuccess = () => resolve(req.result);
497
+ req.onerror = () => reject(req.error);
498
+ });
499
+ }
500
+ async function saveTransferPayload(id, payload) {
501
+ if (typeof window !== "undefined") {
502
+ try {
503
+ window[id] = payload;
504
+ window.__lastTransfer = payload;
505
+ } catch {
506
+ }
507
+ }
508
+ try {
509
+ const db = await openDB();
510
+ return new Promise((resolve, reject) => {
511
+ const tx = db.transaction(DB_STORE, "readwrite");
512
+ const store = tx.objectStore(DB_STORE);
513
+ store.put({ id, ...payload, timestamp: Date.now() });
514
+ tx.oncomplete = () => resolve();
515
+ tx.onerror = () => reject(tx.error);
516
+ });
517
+ } catch (e) {
518
+ console.warn("[saveTransferPayload] IndexedDB store warning:", e);
519
+ }
520
+ }
521
+ async function getTransferPayload(id) {
522
+ if (typeof window !== "undefined") {
523
+ try {
524
+ if (window.opener && window.opener[id]) {
525
+ return window.opener[id];
526
+ }
527
+ if (window[id]) {
528
+ return window[id];
529
+ }
530
+ if (window.opener && window.opener.__lastTransfer) {
531
+ return window.opener.__lastTransfer;
532
+ }
533
+ if (window.__lastTransfer) {
534
+ return window.__lastTransfer;
535
+ }
536
+ } catch {
537
+ }
538
+ }
539
+ try {
540
+ const db = await openDB();
541
+ return new Promise((resolve) => {
542
+ const tx = db.transaction(DB_STORE, "readonly");
543
+ const store = tx.objectStore(DB_STORE);
544
+ const req = store.get(id);
545
+ req.onsuccess = () => {
546
+ if (req.result && req.result.buffer) {
547
+ resolve({
548
+ buffer: req.result.buffer,
549
+ metadata: req.result.metadata,
550
+ options: req.result.options
551
+ });
552
+ } else {
553
+ resolve(null);
554
+ }
555
+ };
556
+ req.onerror = () => resolve(null);
557
+ });
558
+ } catch {
559
+ return null;
560
+ }
561
+ }
477
562
  var ICON_ZOOM_IN = `<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="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line><line x1="11" y1="8" x2="11" y2="14"></line><line x1="8" y1="11" x2="14" y2="11"></line></svg>`;
478
563
  var ICON_ZOOM_OUT = `<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="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line><line x1="8" y1="11" x2="14" y2="11"></line></svg>`;
479
564
  var ICON_FIT_PAGE = `<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="3" y="3" width="18" height="18" rx="2"></rect><line x1="8" y1="12" x2="16" y2="12"></line><polyline points="11 9 8 12 11 15"></polyline><polyline points="13 9 16 12 13 15"></polyline></svg>`;
@@ -493,6 +578,7 @@ var ICON_COPY = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" str
493
578
  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>`;
494
579
  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>`;
495
580
  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>`;
581
+ var ICON_EXTERNAL_WINDOW = `<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="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg>`;
496
582
  var ICON_MAP = {
497
583
  "zoom-in": ICON_ZOOM_IN,
498
584
  "zoom-out": ICON_ZOOM_OUT,
@@ -519,7 +605,9 @@ var ICON_MAP = {
519
605
  "forward-10": ICON_FAST_FORWARD,
520
606
  "rewind": ICON_REWIND,
521
607
  "replay-10": ICON_REWIND,
522
- "speed": ICON_SPEED
608
+ "speed": ICON_SPEED,
609
+ "open-window": ICON_EXTERNAL_WINDOW,
610
+ "external-window": ICON_EXTERNAL_WINDOW
523
611
  };
524
612
  var ToolbarController = class {
525
613
  el;
@@ -736,7 +824,7 @@ var ThumbnailPanel = class {
736
824
  }
737
825
  }
738
826
  };
739
- var FilePreviewViewer = class {
827
+ var FilePreviewViewer = class _FilePreviewViewer {
740
828
  plugins = [];
741
829
  activeInstance = null;
742
830
  abortController = null;
@@ -773,6 +861,7 @@ var FilePreviewViewer = class {
773
861
  * Preview a file in the given container element.
774
862
  */
775
863
  async preview(container, source, options = {}) {
864
+ this.currentOptions = options;
776
865
  this.abort();
777
866
  this.abortController = new AbortController();
778
867
  const { signal } = this.abortController;
@@ -782,7 +871,10 @@ var FilePreviewViewer = class {
782
871
  this.showLoading();
783
872
  try {
784
873
  const { buffer, metadata } = await sourceToArrayBuffer(source, signal);
785
- this.currentBuffer = buffer;
874
+ if (options.metadata) {
875
+ Object.assign(metadata, options.metadata);
876
+ }
877
+ this.currentBuffer = buffer.slice(0);
786
878
  this.currentMetadata = metadata;
787
879
  if (signal.aborted) throw new DOMException("Aborted", "AbortError");
788
880
  const fileInfo = { metadata, buffer };
@@ -812,6 +904,7 @@ var FilePreviewViewer = class {
812
904
  }
813
905
  });
814
906
  this.activeInstance = instance;
907
+ instance.openInSeparateWindow = () => this.openInSeparateWindow();
815
908
  this.hideLoading();
816
909
  this.eventEmitter.emit("loaded", { metadata, plugin: matchedPlugin.id });
817
910
  if (options.showToolbar !== false && this.toolbar) {
@@ -821,26 +914,16 @@ var FilePreviewViewer = class {
821
914
  actions.push({
822
915
  id: "fullscreen",
823
916
  icon: "fullscreen",
824
- label: "Toggle Fullscreen",
917
+ label: "Fullscreen",
825
918
  type: "button",
826
919
  group: "view",
827
- execute: async () => {
920
+ execute: () => {
828
921
  try {
829
- const isNativeFs = !!document.fullscreenElement;
830
- const isCssFs = this.wrapperEl?.classList.contains("fp-fullscreen-active");
831
- if (!isNativeFs && !isCssFs) {
832
- if (this.wrapperEl?.requestFullscreen) {
833
- await this.wrapperEl.requestFullscreen().catch(() => {
834
- this.wrapperEl?.classList.add("fp-fullscreen-active");
835
- });
836
- } else {
837
- this.wrapperEl?.classList.add("fp-fullscreen-active");
838
- }
922
+ if (!document.fullscreenElement) {
923
+ this.wrapperEl?.requestFullscreen?.();
924
+ this.wrapperEl?.classList.add("fp-fullscreen-active");
839
925
  } else {
840
- if (document.fullscreenElement) {
841
- await document.exitFullscreen().catch(() => {
842
- });
843
- }
926
+ document.exitFullscreen?.();
844
927
  this.wrapperEl?.classList.remove("fp-fullscreen-active");
845
928
  }
846
929
  } catch {
@@ -852,6 +935,28 @@ var FilePreviewViewer = class {
852
935
  }
853
936
  });
854
937
  }
938
+ const openWinAction = actions.find((a) => a.id === "open-window");
939
+ if (openWinAction) {
940
+ if (options?._isSeparateWindow) {
941
+ const idx = actions.indexOf(openWinAction);
942
+ if (idx !== -1) actions.splice(idx, 1);
943
+ } else {
944
+ openWinAction.execute = () => {
945
+ this.openInSeparateWindow();
946
+ };
947
+ }
948
+ } else if (!options?._isSeparateWindow) {
949
+ actions.push({
950
+ id: "open-window",
951
+ icon: "open-window",
952
+ label: "Open in Separate Full Window",
953
+ type: "button",
954
+ group: "actions",
955
+ execute: () => {
956
+ this.openInSeparateWindow();
957
+ }
958
+ });
959
+ }
855
960
  this.toolbar.update(actions);
856
961
  this.toolbar.show();
857
962
  }
@@ -884,6 +989,104 @@ var FilePreviewViewer = class {
884
989
  throw error;
885
990
  }
886
991
  }
992
+ /**
993
+ * Opens the current file preview in a separate full browser window.
994
+ */
995
+ openInSeparateWindow() {
996
+ if (!this.currentBuffer) {
997
+ console.warn("[FilePreviewViewer] No active file buffer to open in separate window");
998
+ return null;
999
+ }
1000
+ if (this.currentOptions.onOpenSeparateWindow) {
1001
+ return this.currentOptions.onOpenSeparateWindow({
1002
+ buffer: this.currentBuffer,
1003
+ metadata: this.currentMetadata || { name: "Document" },
1004
+ options: this.currentOptions
1005
+ });
1006
+ }
1007
+ const transferId = "fp_win_" + Date.now() + "_" + Math.random().toString(36).slice(2, 8);
1008
+ let clonedBuffer;
1009
+ try {
1010
+ clonedBuffer = this.currentBuffer.slice(0);
1011
+ } catch {
1012
+ clonedBuffer = this.currentBuffer;
1013
+ }
1014
+ const payload = {
1015
+ buffer: clonedBuffer,
1016
+ metadata: this.currentMetadata ? { ...this.currentMetadata } : void 0,
1017
+ options: { ...this.currentOptions, _isSeparateWindow: true }
1018
+ };
1019
+ if (typeof window !== "undefined") {
1020
+ try {
1021
+ window[transferId] = payload;
1022
+ window.__lastTransfer = payload;
1023
+ } catch {
1024
+ }
1025
+ }
1026
+ saveTransferPayload(transferId, payload).catch((err) => {
1027
+ console.warn("[FilePreviewViewer] Transfer payload save warning:", err);
1028
+ });
1029
+ let targetUrl = null;
1030
+ if (this.currentOptions.standaloneViewerUrl) {
1031
+ const u = new URL(this.currentOptions.standaloneViewerUrl, window.location.href);
1032
+ u.searchParams.set("mode", "fullscreen");
1033
+ u.searchParams.set("transferId", transferId);
1034
+ targetUrl = u.toString();
1035
+ } else if (typeof window !== "undefined" && window.location?.href && !window.location.href.startsWith("about:")) {
1036
+ const u = new URL(window.location.href);
1037
+ u.searchParams.set("mode", "fullscreen");
1038
+ u.searchParams.set("transferId", transferId);
1039
+ targetUrl = u.toString();
1040
+ }
1041
+ if (targetUrl) {
1042
+ const newWin2 = window.open(targetUrl, "_blank");
1043
+ if (!newWin2) {
1044
+ alert("Popup blocker prevented opening the preview in a separate window. Please allow popups for this site.");
1045
+ return null;
1046
+ }
1047
+ return newWin2;
1048
+ }
1049
+ const title = (this.currentMetadata?.name || "Document Preview") + " - Full Preview";
1050
+ const newWin = window.open("", "_blank");
1051
+ if (!newWin) {
1052
+ alert("Popup blocker prevented opening the preview in a separate window. Please allow popups for this site.");
1053
+ return null;
1054
+ }
1055
+ newWin.document.title = title;
1056
+ newWin.document.body.style.margin = "0";
1057
+ newWin.document.body.style.padding = "0";
1058
+ newWin.document.body.style.width = "100vw";
1059
+ newWin.document.body.style.height = "100vh";
1060
+ newWin.document.body.style.overflow = "hidden";
1061
+ newWin.document.body.style.backgroundColor = "#f8fafc";
1062
+ const headNodes = document.querySelectorAll('link[rel="stylesheet"], style');
1063
+ headNodes.forEach((node) => {
1064
+ newWin.document.head.appendChild(node.cloneNode(true));
1065
+ });
1066
+ const root = newWin.document.createElement("div");
1067
+ root.id = "full-window-preview-root";
1068
+ root.style.width = "100%";
1069
+ root.style.height = "100%";
1070
+ root.style.overflow = "hidden";
1071
+ newWin.document.body.appendChild(root);
1072
+ const separateViewer = new _FilePreviewViewer();
1073
+ for (const plugin of this.plugins) {
1074
+ separateViewer.registerPlugin(plugin);
1075
+ }
1076
+ separateViewer.preview(root, this.currentBuffer.slice(0), {
1077
+ ...this.currentOptions,
1078
+ showToolbar: true,
1079
+ toolbarPosition: "top",
1080
+ metadata: this.currentMetadata || void 0,
1081
+ _isSeparateWindow: true
1082
+ }).catch((err) => {
1083
+ console.error("[FilePreviewViewer] Error rendering in separate window:", err);
1084
+ });
1085
+ newWin.addEventListener("beforeunload", () => {
1086
+ separateViewer.destroy();
1087
+ });
1088
+ return newWin;
1089
+ }
887
1090
  /**
888
1091
  * Subscribe to viewer events.
889
1092
  */
@@ -1289,8 +1492,20 @@ var CfbfReader = class {
1289
1492
  }
1290
1493
  };
1291
1494
  if (typeof window !== "undefined" && pdfjsLib.GlobalWorkerOptions) {
1292
- if (!pdfjsLib.GlobalWorkerOptions.workerSrc) {
1293
- pdfjsLib.GlobalWorkerOptions.workerSrc = `https://unpkg.com/pdfjs-dist@${pdfjsLib.version || "4.10.38"}/build/pdf.worker.min.mjs`;
1495
+ if (!pdfjsLib.GlobalWorkerOptions.workerPort && !pdfjsLib.GlobalWorkerOptions.workerSrc) {
1496
+ const customWorker = window.__PDF_WORKER_SRC__;
1497
+ if (customWorker) {
1498
+ pdfjsLib.GlobalWorkerOptions.workerSrc = customWorker;
1499
+ } else {
1500
+ try {
1501
+ pdfjsLib.GlobalWorkerOptions.workerPort = new Worker(
1502
+ new URL("pdfjs-dist/build/pdf.worker.min.mjs", import.meta.url),
1503
+ { type: "module" }
1504
+ );
1505
+ } catch {
1506
+ pdfjsLib.GlobalWorkerOptions.workerSrc = "./pdf.worker.min.mjs";
1507
+ }
1508
+ }
1294
1509
  }
1295
1510
  }
1296
1511
  var PdfPlugin = class {
@@ -1384,6 +1599,14 @@ var PdfPlugin = class {
1384
1599
  type: "button",
1385
1600
  group: "actions",
1386
1601
  execute: () => instance.print?.()
1602
+ },
1603
+ {
1604
+ id: "open-window",
1605
+ icon: "open-window",
1606
+ label: "Open in Separate Full Window",
1607
+ type: "button",
1608
+ group: "actions",
1609
+ execute: () => instance.openInSeparateWindow?.()
1387
1610
  }
1388
1611
  ];
1389
1612
  }
@@ -1433,18 +1656,21 @@ var PdfPlugin = class {
1433
1656
  indicator.style.pointerEvents = "none";
1434
1657
  container.appendChild(indicator);
1435
1658
  ctx.container.appendChild(container);
1659
+ const standardFontsUrl = typeof window !== "undefined" && window.__PDF_STANDARD_FONTS_URL__ || "./standard_fonts/";
1660
+ const cmapsUrl = typeof window !== "undefined" && window.__PDF_CMAPS_URL__ || "./cmaps/";
1436
1661
  const loadingTask = pdfjsLib.getDocument({
1437
- data: new Uint8Array(ctx.buffer),
1438
- cMapUrl: `https://unpkg.com/pdfjs-dist@${pdfjsLib.version || "4.10.38"}/cmaps/`,
1662
+ data: new Uint8Array(ctx.buffer.slice(0)),
1663
+ cMapUrl: cmapsUrl,
1439
1664
  cMapPacked: true,
1440
- standardFontDataUrl: `https://unpkg.com/pdfjs-dist@${pdfjsLib.version || "4.10.38"}/standard_fonts/`
1665
+ standardFontDataUrl: standardFontsUrl,
1666
+ verbosity: 0
1441
1667
  });
1442
1668
  const pdfDoc = await loadingTask.promise;
1443
1669
  const totalPages = Math.max(1, pdfDoc.numPages);
1444
1670
  let currentPage = 1;
1445
1671
  let zoomScale = 1;
1446
1672
  let rotation = 0;
1447
- let fitMode = "width";
1673
+ let fitMode = "page";
1448
1674
  let currentRenderTask = null;
1449
1675
  const renderPage = async (pageNum) => {
1450
1676
  if (currentRenderTask) {
@@ -1464,15 +1690,15 @@ var PdfPlugin = class {
1464
1690
  const containerWidth = container.clientWidth || 900;
1465
1691
  const containerHeight = container.clientHeight || 700;
1466
1692
  const unscaledVp = page.getViewport({ scale: 1, rotation });
1467
- const availWidth = Math.max(280, containerWidth - 48);
1468
- const availHeight = Math.max(280, containerHeight - 88);
1693
+ const availWidth = Math.max(320, containerWidth - 48);
1694
+ const availHeight = Math.max(550, containerHeight - 88);
1469
1695
  const scaleW = availWidth / unscaledVp.width;
1470
1696
  const scaleH = availHeight / unscaledVp.height;
1471
1697
  let fitScale;
1472
1698
  if (fitMode === "page") {
1473
- fitScale = Math.max(0.5, Math.min(scaleW, scaleH));
1699
+ fitScale = Math.max(0.4, Math.min(scaleW, scaleH));
1474
1700
  } else {
1475
- fitScale = Math.max(0.65, Math.min(1.15, scaleW));
1701
+ fitScale = Math.max(0.65, Math.min(1.25, scaleW));
1476
1702
  }
1477
1703
  const effectiveScale = (fitScale > 0 ? fitScale : 1) * zoomScale;
1478
1704
  const pixelRatio = window.devicePixelRatio || 1;
@@ -1498,7 +1724,7 @@ var PdfPlugin = class {
1498
1724
  currentRenderTask = null;
1499
1725
  }
1500
1726
  };
1501
- await renderPage(1);
1727
+ renderPage(1);
1502
1728
  let resizeTimer = null;
1503
1729
  const resizeObserver = new ResizeObserver(() => {
1504
1730
  if (resizeTimer) clearTimeout(resizeTimer);
@@ -1542,7 +1768,7 @@ var PdfPlugin = class {
1542
1768
  renderPage(currentPage);
1543
1769
  },
1544
1770
  fitToPage: () => {
1545
- fitMode = fitMode === "width" ? "page" : "width";
1771
+ fitMode = fitMode === "page" ? "width" : "page";
1546
1772
  zoomScale = 1;
1547
1773
  rotation = 0;
1548
1774
  renderPage(currentPage);
@@ -2019,6 +2245,14 @@ var DocxPlugin = class {
2019
2245
  type: "button",
2020
2246
  group: "actions",
2021
2247
  execute: () => instance.print?.()
2248
+ },
2249
+ {
2250
+ id: "open-window",
2251
+ icon: "open-window",
2252
+ label: "Open in Separate Full Window",
2253
+ type: "button",
2254
+ group: "actions",
2255
+ execute: () => instance.openInSeparateWindow?.()
2022
2256
  }
2023
2257
  );
2024
2258
  return actions;
@@ -2078,6 +2312,31 @@ var DocxPlugin = class {
2078
2312
  }
2079
2313
  if (wrapper.children.length > 0 && (wrapper.textContent?.trim().length ?? 0) > 0) {
2080
2314
  renderedSuccessfully = true;
2315
+ try {
2316
+ const unzipped = unzipSync(new Uint8Array(ctx.buffer));
2317
+ const chartKeys = Object.keys(unzipped).filter((k) => k.replace(/^[./\\]+/, "").toLowerCase().startsWith("word/charts/chart") && k.endsWith(".xml")).sort();
2318
+ if (chartKeys.length > 0) {
2319
+ const allDivs = Array.from(wrapper.querySelectorAll("div"));
2320
+ const emptyContainers = allDivs.filter((div) => {
2321
+ const st = div.getAttribute("style") || "";
2322
+ return st.includes("width:") && st.includes("height:") && div.children.length === 0 && (div.textContent?.trim().length ?? 0) === 0;
2323
+ });
2324
+ chartKeys.forEach((cKey, idx) => {
2325
+ const target = emptyContainers[idx];
2326
+ if (target) {
2327
+ const xmlStr = strFromU8(unzipped[cKey]);
2328
+ const svg = this.parseAndRenderChartSvg(xmlStr);
2329
+ if (svg) {
2330
+ target.innerHTML = svg;
2331
+ target.style.display = "block";
2332
+ target.style.margin = "12px auto";
2333
+ }
2334
+ }
2335
+ });
2336
+ }
2337
+ } catch (chartErr) {
2338
+ console.warn("[DocxPlugin] Non-critical error rendering DrawingML charts:", chartErr);
2339
+ }
2081
2340
  }
2082
2341
  } catch (err) {
2083
2342
  console.warn("[DocxPlugin] docx-preview failed, triggering native fallback:", err);
@@ -2109,64 +2368,74 @@ var DocxPlugin = class {
2109
2368
  }
2110
2369
  let sections = Array.from(wrapper.querySelectorAll("section.docx"));
2111
2370
  const cards = Array.from(wrapper.querySelectorAll(".fp-docx-page-card"));
2112
- if (sections.length === 1 && cards.length === 0) {
2113
- const singleSec = sections[0];
2114
- const contentContainer = singleSec.querySelector("article") || singleSec;
2115
- const children = Array.from(contentContainer.children);
2116
- const pageH = singleSec.offsetHeight > 1300 ? 1122 : Math.max(1056, singleSec.offsetHeight);
2117
- const secH = singleSec.offsetHeight || singleSec.scrollHeight;
2118
- if (secH > pageH * 1.25 && children.length > 1) {
2119
- const childHeights = children.map((c) => {
2120
- const rectH = c.getBoundingClientRect().height;
2121
- const offH = c.offsetHeight;
2122
- const textLen = c.textContent?.trim().length || 0;
2123
- const estH = Math.max(24, Math.ceil(textLen / 80) * 22 + 16);
2124
- return Math.max(rectH, offH, estH);
2125
- });
2126
- const parent = singleSec.parentElement || wrapper;
2127
- const newSections = [singleSec];
2128
- const headerEl = singleSec.querySelector("header");
2129
- const footerEl = singleSec.querySelector("footer");
2130
- contentContainer.innerHTML = "";
2131
- singleSec.style.minHeight = `${pageH}px`;
2132
- singleSec.style.boxSizing = "border-box";
2133
- let curContent = contentContainer;
2134
- let curH = 0;
2135
- const maxH = pageH - 140;
2136
- for (let i = 0; i < children.length; i++) {
2137
- const child = children[i];
2138
- const chH = childHeights[i];
2139
- curContent.appendChild(child);
2140
- curH += chH;
2141
- if (curH >= maxH && i < children.length - 1) {
2142
- const nextSec = document.createElement("section");
2143
- nextSec.className = singleSec.className;
2144
- nextSec.style.cssText = singleSec.style.cssText;
2145
- nextSec.style.minHeight = `${pageH}px`;
2146
- nextSec.style.boxSizing = "border-box";
2147
- nextSec.style.backgroundColor = "#ffffff";
2148
- nextSec.style.boxShadow = "0 4px 24px rgba(0, 0, 0, 0.08)";
2149
- nextSec.style.borderRadius = "4px";
2150
- nextSec.style.marginBottom = "24px";
2151
- if (headerEl) {
2152
- nextSec.appendChild(headerEl.cloneNode(true));
2153
- }
2154
- const nextArticle = document.createElement("article");
2155
- if (contentContainer.tagName.toLowerCase() === "article") {
2156
- nextArticle.style.cssText = contentContainer.style.cssText;
2157
- }
2158
- nextSec.appendChild(nextArticle);
2159
- if (footerEl) {
2160
- nextSec.appendChild(footerEl.cloneNode(true));
2371
+ if (sections.length > 0 && cards.length === 0) {
2372
+ const finalSections = [];
2373
+ for (const singleSec of sections) {
2374
+ const contentContainer = singleSec.querySelector("article") || singleSec;
2375
+ const children = Array.from(contentContainer.children);
2376
+ const pageH = singleSec.offsetHeight > 1300 ? 1122 : Math.max(1056, singleSec.offsetHeight);
2377
+ const secH = singleSec.scrollHeight || singleSec.offsetHeight;
2378
+ if (secH > pageH * 1.25 && children.length > 1) {
2379
+ const childHeights = children.map((c) => {
2380
+ const rectH = c.getBoundingClientRect().height;
2381
+ const offH = c.offsetHeight;
2382
+ const textLen = c.textContent?.trim().length || 0;
2383
+ const estH = Math.max(24, Math.ceil(textLen / 80) * 22 + 16);
2384
+ return Math.max(rectH, offH, estH);
2385
+ });
2386
+ const parent = singleSec.parentElement || wrapper;
2387
+ const headerEl = singleSec.querySelector("header");
2388
+ const footerEl = singleSec.querySelector("footer");
2389
+ contentContainer.innerHTML = "";
2390
+ singleSec.style.minHeight = `${pageH}px`;
2391
+ singleSec.style.boxSizing = "border-box";
2392
+ let curContent = contentContainer;
2393
+ let curSec = singleSec;
2394
+ let curH = 0;
2395
+ const maxH = pageH - 140;
2396
+ finalSections.push(singleSec);
2397
+ for (let i = 0; i < children.length; i++) {
2398
+ const child = children[i];
2399
+ const chH = childHeights[i];
2400
+ curContent.appendChild(child);
2401
+ curH += chH;
2402
+ if (curH >= maxH && i < children.length - 1) {
2403
+ const nextSec = document.createElement("section");
2404
+ nextSec.className = singleSec.className;
2405
+ nextSec.style.cssText = singleSec.style.cssText;
2406
+ nextSec.style.minHeight = `${pageH}px`;
2407
+ nextSec.style.boxSizing = "border-box";
2408
+ nextSec.style.backgroundColor = "#ffffff";
2409
+ nextSec.style.boxShadow = "0 4px 24px rgba(0, 0, 0, 0.08)";
2410
+ nextSec.style.borderRadius = "4px";
2411
+ nextSec.style.marginBottom = "24px";
2412
+ if (headerEl) {
2413
+ nextSec.appendChild(headerEl.cloneNode(true));
2414
+ }
2415
+ const nextArticle = document.createElement("article");
2416
+ if (contentContainer.tagName.toLowerCase() === "article") {
2417
+ nextArticle.style.cssText = contentContainer.style.cssText;
2418
+ }
2419
+ nextSec.appendChild(nextArticle);
2420
+ if (footerEl) {
2421
+ nextSec.appendChild(footerEl.cloneNode(true));
2422
+ }
2423
+ if (curSec.nextSibling) {
2424
+ parent.insertBefore(nextSec, curSec.nextSibling);
2425
+ } else {
2426
+ parent.appendChild(nextSec);
2427
+ }
2428
+ finalSections.push(nextSec);
2429
+ curSec = nextSec;
2430
+ curContent = nextArticle;
2431
+ curH = 0;
2161
2432
  }
2162
- parent.appendChild(nextSec);
2163
- newSections.push(nextSec);
2164
- curContent = nextArticle;
2165
- curH = 0;
2166
2433
  }
2434
+ } else {
2435
+ finalSections.push(singleSec);
2167
2436
  }
2168
- sections = newSections;
2169
2437
  }
2438
+ sections = finalSections;
2170
2439
  }
2171
2440
  const pageElements = sections.length > 0 ? sections : cards;
2172
2441
  const totalPages = Math.max(1, pageElements.length);
@@ -2558,6 +2827,88 @@ var DocxPlugin = class {
2558
2827
  }
2559
2828
  return result;
2560
2829
  }
2830
+ parseAndRenderChartSvg(xmlStr, width = 500, height = 260) {
2831
+ const catMatches = [...xmlStr.matchAll(/<c:cat>[\s\S]*?<c:strCache>([\s\S]*?)<\/c:strCache>/g)];
2832
+ let categories = [];
2833
+ if (catMatches.length > 0) {
2834
+ categories = [...catMatches[0][1].matchAll(/<c:v>([^<]+)<\/c:v>/g)].map((m) => m[1]);
2835
+ }
2836
+ if (categories.length === 0) {
2837
+ categories = ["Category 1", "Category 2", "Category 3", "Category 4"];
2838
+ }
2839
+ const defaultColors = ["#004586", "#ff420e", "#ffd320", "#579d1c", "#7e0021", "#83caff"];
2840
+ const sers = [...xmlStr.matchAll(/<c:ser>([\s\S]*?)<\/c:ser>/g)];
2841
+ const series = [];
2842
+ sers.forEach((s, sIdx) => {
2843
+ const titleMatch = s[1].match(/<c:tx>[\s\S]*?<c:v>([^<]+)<\/c:v>/);
2844
+ const title = titleMatch ? titleMatch[1] : `Series ${sIdx + 1}`;
2845
+ const clrMatch = s[1].match(/<a:srgbClr\s+val="([^"]+)"/);
2846
+ const color = clrMatch ? "#" + clrMatch[1] : defaultColors[sIdx % defaultColors.length];
2847
+ const valMatch = s[1].match(/<c:val>[\s\S]*?<c:numCache>([\s\S]*?)<\/c:numCache>/);
2848
+ let values = [];
2849
+ if (valMatch) {
2850
+ values = [...valMatch[1].matchAll(/<c:pt\s+idx="(\d+)">\s*<c:v>([^<]+)<\/c:v>/g)].sort((a, b) => parseInt(a[1], 10) - parseInt(b[1], 10)).map((m) => parseFloat(m[2]) || 0);
2851
+ }
2852
+ series.push({ title, color, values });
2853
+ });
2854
+ if (series.length === 0) return "";
2855
+ let maxVal = 10;
2856
+ series.forEach((s) => s.values.forEach((v) => {
2857
+ if (v > maxVal) maxVal = v;
2858
+ }));
2859
+ maxVal = Math.ceil(maxVal * 1.15);
2860
+ if (maxVal % 2 !== 0) maxVal++;
2861
+ const padLeft = 45;
2862
+ const padBottom = 55;
2863
+ const padTop = 20;
2864
+ const padRight = 20;
2865
+ const plotW = width - padLeft - padRight;
2866
+ const plotH = height - padTop - padBottom;
2867
+ const yTicks = 5;
2868
+ let gridLines = "";
2869
+ for (let i = 0; i <= yTicks; i++) {
2870
+ const val = maxVal / yTicks * i;
2871
+ const y = padTop + plotH - val / maxVal * plotH;
2872
+ gridLines += `<line x1="${padLeft}" y1="${y}" x2="${padLeft + plotW}" y2="${y}" stroke="#e2e8f0" stroke-width="1" />`;
2873
+ gridLines += `<text x="${padLeft - 8}" y="${y + 4}" text-anchor="end" font-size="11" fill="#64748b" font-family="Calibri, sans-serif">${Math.round(val)}</text>`;
2874
+ }
2875
+ const numCats = categories.length;
2876
+ const numSers = series.length;
2877
+ const groupW = plotW / numCats;
2878
+ const barW = Math.max(8, Math.min(28, groupW * 0.7 / numSers));
2879
+ const groupPad = (groupW - barW * numSers) / 2;
2880
+ let bars = "";
2881
+ let catLabels = "";
2882
+ for (let c = 0; c < numCats; c++) {
2883
+ const catX = padLeft + c * groupW;
2884
+ catLabels += `<text x="${catX + groupW / 2}" y="${padTop + plotH + 18}" text-anchor="middle" font-size="11" fill="#334155" font-family="Calibri, sans-serif">${categories[c]}</text>`;
2885
+ for (let s = 0; s < numSers; s++) {
2886
+ const val = series[s].values[c] ?? 0;
2887
+ const bH = Math.max(0, val / maxVal * plotH);
2888
+ const bX = catX + groupPad + s * barW;
2889
+ const bY = padTop + plotH - bH;
2890
+ bars += `<rect x="${bX}" y="${bY}" width="${barW - 2}" height="${bH}" fill="${series[s].color}" rx="1" />`;
2891
+ }
2892
+ }
2893
+ let legend = "";
2894
+ const legY = height - 12;
2895
+ let legX = padLeft + (plotW - numSers * 100) / 2;
2896
+ series.forEach((s) => {
2897
+ legend += `<rect x="${legX}" y="${legY - 9}" width="10" height="10" fill="${s.color}" rx="2" />`;
2898
+ legend += `<text x="${legX + 15}" y="${legY}" font-size="11" fill="#475569" font-family="Calibri, sans-serif">${s.title}</text>`;
2899
+ legX += 95;
2900
+ });
2901
+ return `
2902
+ <svg viewBox="0 0 ${width} ${height}" width="100%" height="100%" style="background:#ffffff; border-radius:4px; overflow:visible;" xmlns="http://www.w3.org/2000/svg">
2903
+ ${gridLines}
2904
+ <line x1="${padLeft}" y1="${padTop + plotH}" x2="${padLeft + plotW}" y2="${padTop + plotH}" stroke="#94a3b8" stroke-width="1.5" />
2905
+ <line x1="${padLeft}" y1="${padTop}" x2="${padLeft}" y2="${padTop + plotH}" stroke="#94a3b8" stroke-width="1.5" />
2906
+ ${bars}
2907
+ ${catLabels}
2908
+ ${legend}
2909
+ </svg>
2910
+ `.trim();
2911
+ }
2561
2912
  };
2562
2913
  function docxPlugin() {
2563
2914
  return new DocxPlugin();
@@ -3124,6 +3475,16 @@ var CodePlugin = class {
3124
3475
  execute: () => {
3125
3476
  instance.print?.();
3126
3477
  }
3478
+ },
3479
+ {
3480
+ id: "open-window",
3481
+ icon: "open-window",
3482
+ label: "Open in Separate Full Window",
3483
+ type: "button",
3484
+ group: "actions",
3485
+ execute: () => {
3486
+ instance.openInSeparateWindow?.();
3487
+ }
3127
3488
  }
3128
3489
  );
3129
3490
  return actions;
@@ -4292,6 +4653,14 @@ var RtfPlugin = class {
4292
4653
  type: "button",
4293
4654
  group: "actions",
4294
4655
  execute: () => instance.print?.()
4656
+ },
4657
+ {
4658
+ id: "open-window",
4659
+ icon: "open-window",
4660
+ label: "Open in Separate Full Window",
4661
+ type: "button",
4662
+ group: "actions",
4663
+ execute: () => instance.openInSeparateWindow?.()
4295
4664
  }
4296
4665
  );
4297
4666
  return actions;
@@ -4344,59 +4713,54 @@ var RtfPlugin = class {
4344
4713
  }
4345
4714
  const doc = new RTFJS.Document(ctx.buffer, {});
4346
4715
  const htmlElements = await doc.render();
4347
- if (htmlElements.length === 1) {
4348
- const singleEl = htmlElements[0];
4349
- wrapper.appendChild(singleEl);
4350
- const children = Array.from(singleEl.children);
4351
- const secH = singleEl.offsetHeight || singleEl.scrollHeight;
4352
- if (secH > 1300 && children.length > 1) {
4353
- const childHeights = children.map((c) => {
4354
- const rectH = c.getBoundingClientRect().height;
4355
- const offH = c.offsetHeight;
4356
- const textLen = c.textContent?.trim().length || 0;
4357
- const estH = Math.max(24, Math.ceil(textLen / 80) * 22 + 16);
4358
- return Math.max(rectH, offH, estH);
4359
- });
4360
- wrapper.innerHTML = "";
4361
- const createRtfCard = () => {
4362
- const card = document.createElement("div");
4363
- card.className = "fp-rtf-page-card";
4364
- card.style.backgroundColor = "#ffffff";
4365
- card.style.boxShadow = "0 4px 24px rgba(0,0,0,0.08)";
4366
- card.style.borderRadius = "4px";
4367
- card.style.padding = "72px 56px";
4368
- card.style.width = "816px";
4369
- card.style.minHeight = "1056px";
4370
- card.style.boxSizing = "border-box";
4371
- card.style.marginBottom = "24px";
4372
- return card;
4373
- };
4374
- let curCard = createRtfCard();
4375
- wrapper.appendChild(curCard);
4376
- pageElements = [curCard];
4377
- let curH = 0;
4378
- const maxH = 920;
4379
- for (let i = 0; i < children.length; i++) {
4380
- const child = children[i];
4381
- const chH = childHeights[i];
4382
- curCard.appendChild(child);
4383
- curH += chH;
4384
- if (curH >= maxH && i < children.length - 1) {
4385
- curCard = createRtfCard();
4386
- wrapper.appendChild(curCard);
4387
- pageElements.push(curCard);
4388
- curH = 0;
4389
- }
4390
- }
4716
+ const contentNodes = [];
4717
+ for (const item of htmlElements) {
4718
+ if (item.children && item.children.length > 0 && !item.tagName.toLowerCase().startsWith("table")) {
4719
+ contentNodes.push(...Array.from(item.children));
4391
4720
  } else {
4392
- pageElements = [singleEl];
4721
+ contentNodes.push(item);
4393
4722
  }
4394
- } else {
4395
- pageElements = htmlElements;
4396
- for (let i = 0; i < htmlElements.length; i++) {
4397
- const el = htmlElements[i];
4398
- el.style.display = i === 0 ? "block" : "none";
4399
- wrapper.appendChild(el);
4723
+ }
4724
+ wrapper.innerHTML = "";
4725
+ contentNodes.forEach((node) => wrapper.appendChild(node));
4726
+ const childHeights = contentNodes.map((c) => {
4727
+ const rectH = c.getBoundingClientRect ? c.getBoundingClientRect().height : 0;
4728
+ const offH = c.offsetHeight || 0;
4729
+ const textLen = c.textContent?.trim().length || 0;
4730
+ const estH = Math.max(24, Math.ceil(textLen / 75) * 22 + 14);
4731
+ return Math.max(rectH, offH, estH);
4732
+ });
4733
+ wrapper.innerHTML = "";
4734
+ const createRtfCard = () => {
4735
+ const card = document.createElement("div");
4736
+ card.className = "fp-rtf-page-card";
4737
+ card.style.backgroundColor = "#ffffff";
4738
+ card.style.boxShadow = "0 4px 24px rgba(0,0,0,0.08)";
4739
+ card.style.borderRadius = "4px";
4740
+ card.style.padding = "72px 56px";
4741
+ card.style.width = "816px";
4742
+ card.style.minHeight = "1056px";
4743
+ card.style.boxSizing = "border-box";
4744
+ card.style.marginBottom = "24px";
4745
+ card.style.fontFamily = 'Calibri, "Segoe UI", Arial, sans-serif';
4746
+ card.style.lineHeight = "1.6";
4747
+ return card;
4748
+ };
4749
+ let curCard = createRtfCard();
4750
+ wrapper.appendChild(curCard);
4751
+ pageElements = [curCard];
4752
+ let curH = 0;
4753
+ const maxH = 912;
4754
+ for (let i = 0; i < contentNodes.length; i++) {
4755
+ const child = contentNodes[i];
4756
+ const chH = childHeights[i];
4757
+ curCard.appendChild(child);
4758
+ curH += chH;
4759
+ if (curH >= maxH && i < contentNodes.length - 1) {
4760
+ curCard = createRtfCard();
4761
+ wrapper.appendChild(curCard);
4762
+ pageElements.push(curCard);
4763
+ curH = 0;
4400
4764
  }
4401
4765
  }
4402
4766
  } catch (err) {
@@ -4765,6 +5129,14 @@ var OpenDocumentPlugin = class {
4765
5129
  type: "button",
4766
5130
  group: "actions",
4767
5131
  execute: () => instance.print?.()
5132
+ },
5133
+ {
5134
+ id: "open-window",
5135
+ icon: "open-window",
5136
+ label: "Open in Separate Full Window",
5137
+ type: "button",
5138
+ group: "actions",
5139
+ execute: () => instance.openInSeparateWindow?.()
4768
5140
  }
4769
5141
  );
4770
5142
  return actions;
@@ -5353,6 +5725,14 @@ var DocPlugin = class {
5353
5725
  type: "button",
5354
5726
  group: "actions",
5355
5727
  execute: () => instance.print?.()
5728
+ },
5729
+ {
5730
+ id: "open-window",
5731
+ icon: "open-window",
5732
+ label: "Open in Separate Full Window",
5733
+ type: "button",
5734
+ group: "actions",
5735
+ execute: () => instance.openInSeparateWindow?.()
5356
5736
  }
5357
5737
  );
5358
5738
  return actions;
@@ -5644,9 +6024,25 @@ var DocPlugin = class {
5644
6024
  heuristicTextExtraction(buffer) {
5645
6025
  return this.extractStringsFromBytes(new Uint8Array(buffer));
5646
6026
  }
6027
+ cleanWordDocFields(text) {
6028
+ if (!text) return "";
6029
+ let cleaned = text.replace(
6030
+ /\x13\s*HYPERLINK\s*"?([^"\x14]+)"?\s*\x14([\s\S]*?)\x15/gi,
6031
+ (_match, url, label) => {
6032
+ const cleanUrl = url.trim();
6033
+ const cleanLabel = label.trim() || cleanUrl;
6034
+ return `<a href="${cleanUrl}" target="_blank" rel="noopener noreferrer" style="color: #2563eb; text-decoration: underline;">${cleanLabel}</a>`;
6035
+ }
6036
+ );
6037
+ cleaned = cleaned.replace(/\x13[^\x14\x15]*\x14([^\x15]*)\x15/g, "$1");
6038
+ cleaned = cleaned.replace(/\x13[^\x15]*\x15/g, "");
6039
+ cleaned = cleaned.replace(/[\x13\x14\x15]/g, "");
6040
+ return cleaned;
6041
+ }
5647
6042
  splitIntoPages(text) {
5648
6043
  if (!text) return [""];
5649
- const normalized = text.replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/\x0B/g, "\n").replace(/\x07\n/g, "\n").replace(/\x07/g, " ");
6044
+ const cleanedText = this.cleanWordDocFields(text);
6045
+ const normalized = cleanedText.replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/\x0B/g, "\n").replace(/\x07\n/g, "\n").replace(/\x07/g, " ");
5650
6046
  const explicitParts = normalized.split(/[\x0C\f]|\n\s*[-=_]{3,}\s*(?:PAGE|Page|page break)[\s\d\w-]*[-=_]{3,}\s*\n/i).map((p) => p.trim()).filter((p) => p.length > 0);
5651
6047
  if (explicitParts.length === 0) explicitParts.push(normalized);
5652
6048
  const maxLinesPerPage = 32;
@@ -5657,7 +6053,8 @@ var DocPlugin = class {
5657
6053
  let currentLines = [];
5658
6054
  let count = 0;
5659
6055
  for (const line of lines) {
5660
- const vLines = Math.max(1, Math.ceil((line.length || 1) / charsPerLine));
6056
+ const plainLine = line.replace(/<[^>]+>/g, "");
6057
+ const vLines = Math.max(1, Math.ceil((plainLine.length || 1) / charsPerLine));
5661
6058
  if (count + vLines > maxLinesPerPage && currentLines.length > 0) {
5662
6059
  finalPages.push(currentLines.join("\n"));
5663
6060
  currentLines = [];
@@ -5733,25 +6130,26 @@ var DocPlugin = class {
5733
6130
  i++;
5734
6131
  continue;
5735
6132
  }
6133
+ const sanitizeOptions = { ADD_TAGS: ["a"], ADD_ATTR: ["href", "target", "rel", "style"] };
5736
6134
  if (line.length < 60 && !line.endsWith(".") && (/^[A-Z0-9\s:_-]+$/.test(line) || line.startsWith("#"))) {
5737
6135
  if (inList) {
5738
6136
  html += "</ul>";
5739
6137
  inList = false;
5740
6138
  }
5741
- html += `<h2 style="font-size: 16px; font-weight: 700; color: #1e3a8a; margin: 16px 0 8px; border-bottom: 1px solid #e2e8f0; padding-bottom: 4px;">${DOMPurify6.sanitize(line)}</h2>`;
6139
+ html += `<h2 style="font-size: 16px; font-weight: 700; color: #1e3a8a; margin: 16px 0 8px; border-bottom: 1px solid #e2e8f0; padding-bottom: 4px;">${DOMPurify6.sanitize(line, sanitizeOptions)}</h2>`;
5742
6140
  } else if (line.startsWith("\u2022") || line.startsWith("-") || line.startsWith("*")) {
5743
6141
  if (!inList) {
5744
6142
  html += '<ul style="margin: 8px 0; padding-left: 24px;">';
5745
6143
  inList = true;
5746
6144
  }
5747
6145
  const bulletText = line.replace(/^[•\-\*]\s*/, "");
5748
- html += `<li style="margin: 4px 0; line-height: 1.15; font-size: 12pt;">${DOMPurify6.sanitize(bulletText)}</li>`;
6146
+ html += `<li style="margin: 4px 0; line-height: 1.15; font-size: 12pt;">${DOMPurify6.sanitize(bulletText, sanitizeOptions)}</li>`;
5749
6147
  } else {
5750
6148
  if (inList) {
5751
6149
  html += "</ul>";
5752
6150
  inList = false;
5753
6151
  }
5754
- html += `<p style="line-height: 1.15; margin: 0; font-size: 12pt; text-align: justify;">${DOMPurify6.sanitize(line)}</p>`;
6152
+ html += `<p style="line-height: 1.15; margin: 0; font-size: 12pt; text-align: justify;">${DOMPurify6.sanitize(line, sanitizeOptions)}</p>`;
5755
6153
  }
5756
6154
  i++;
5757
6155
  }
@@ -6304,6 +6702,6 @@ var FilePreviewViewer2 = class extends FilePreviewViewer {
6304
6702
  }
6305
6703
  };
6306
6704
 
6307
- export { CfbfReader, EventEmitter, FilePreviewViewer2 as FilePreviewViewer, ThumbnailPanel, ToolbarController, archivePlugin, clamp, codePlugin, createElement, csvPlugin, debounce, detectMagicBytes, detectOoxmlType, docPlugin, docxPlugin, downloadFile, excelPlugin, extractExtension, formatFileSize, getDefaultPlugins, htmlPreviewPlugin, markdownPlugin, mediaPlugin, mimeFromExtension, openDocumentPlugin, pdfPlugin, pptPlugin, pptxPlugin, printElement, rtfPlugin, sanitizeHTML, sanitizeSVG, sourceToArrayBuffer, threeDPlugin };
6705
+ export { CfbfReader, EventEmitter, FilePreviewViewer2 as FilePreviewViewer, ThumbnailPanel, ToolbarController, archivePlugin, clamp, codePlugin, createElement, csvPlugin, debounce, detectMagicBytes, detectOoxmlType, docPlugin, docxPlugin, downloadFile, excelPlugin, extractExtension, formatFileSize, getDefaultPlugins, getTransferPayload, htmlPreviewPlugin, markdownPlugin, mediaPlugin, mimeFromExtension, openDocumentPlugin, pdfPlugin, pptPlugin, pptxPlugin, printElement, rtfPlugin, sanitizeHTML, sanitizeSVG, saveTransferPayload, sourceToArrayBuffer, threeDPlugin };
6308
6706
  //# sourceMappingURL=index.js.map
6309
6707
  //# sourceMappingURL=index.js.map