pptx-react-viewer 2.18.0 → 2.19.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 (124) hide show
  1. package/CHANGELOG.md +701 -0
  2. package/dist/{AiChatPanel-UN5DHPZY.js → AiChatPanel-2GBJETOY.js} +24 -24
  3. package/dist/AiChatPanel-2GBJETOY.js.br +0 -0
  4. package/dist/AiChatPanel-2GBJETOY.js.gz +0 -0
  5. package/dist/{AiChatPanel-SSSBERWJ.mjs → AiChatPanel-FZUKTQPQ.mjs} +4 -4
  6. package/dist/AiChatPanel-FZUKTQPQ.mjs.br +0 -0
  7. package/dist/AiChatPanel-FZUKTQPQ.mjs.gz +0 -0
  8. package/dist/{Model3DScene-4RPYKC2I.js → Model3DScene-JHTI2AQ6.js} +2 -2
  9. package/dist/Model3DScene-JHTI2AQ6.js.br +0 -0
  10. package/dist/Model3DScene-JHTI2AQ6.js.gz +0 -0
  11. package/dist/{Model3DScene-LYEESYAI.mjs → Model3DScene-WRRQSYAZ.mjs} +1 -1
  12. package/dist/Model3DScene-WRRQSYAZ.mjs.br +0 -0
  13. package/dist/Model3DScene-WRRQSYAZ.mjs.gz +0 -0
  14. package/dist/{PowerPointViewer-Cf4YHjdF.d.ts → PowerPointViewer-DVFkeluD.d.ts} +2 -2
  15. package/dist/PowerPointViewer-DVFkeluD.d.ts.map +1 -0
  16. package/dist/{audience-content-store-CyS0oP6t.d.ts → audience-content-store-ChVOSdBh.d.ts} +2 -2
  17. package/dist/{audience-content-store-CyS0oP6t.d.ts.map → audience-content-store-ChVOSdBh.d.ts.map} +1 -1
  18. package/dist/{chunk-WVDM36ZM.js → chunk-7ARD2J6Y.js} +1096 -1033
  19. package/dist/chunk-7ARD2J6Y.js.br +0 -0
  20. package/dist/chunk-7ARD2J6Y.js.gz +0 -0
  21. package/dist/{chunk-QUB5OSKY.mjs → chunk-BO373PYH.mjs} +70 -115
  22. package/dist/chunk-BO373PYH.mjs.br +0 -0
  23. package/dist/chunk-BO373PYH.mjs.gz +0 -0
  24. package/dist/{chunk-ASKYZ5ZY.js → chunk-IRLOXBO7.js} +439 -484
  25. package/dist/chunk-IRLOXBO7.js.br +0 -0
  26. package/dist/chunk-IRLOXBO7.js.gz +0 -0
  27. package/dist/{chunk-RTUGI4HQ.js → chunk-MVKRI3CZ.js} +9 -0
  28. package/dist/chunk-MVKRI3CZ.js.br +0 -0
  29. package/dist/chunk-MVKRI3CZ.js.gz +0 -0
  30. package/dist/{chunk-BZOL6FXF.mjs → chunk-MWEBCWVD.mjs} +16 -2270
  31. package/dist/chunk-MWEBCWVD.mjs.br +0 -0
  32. package/dist/chunk-MWEBCWVD.mjs.gz +0 -0
  33. package/dist/{chunk-ICZDMFF2.js → chunk-NFFV3RDS.js} +1219 -1101
  34. package/dist/chunk-NFFV3RDS.js.br +0 -0
  35. package/dist/chunk-NFFV3RDS.js.gz +0 -0
  36. package/dist/{chunk-4LWGAVAP.js → chunk-OVPJT4EQ.js} +162 -2416
  37. package/dist/chunk-OVPJT4EQ.js.br +0 -0
  38. package/dist/chunk-OVPJT4EQ.js.gz +0 -0
  39. package/dist/{chunk-MAVLV56S.js → chunk-RPJ2BIQ7.js} +3 -3
  40. package/dist/chunk-RPJ2BIQ7.js.br +0 -0
  41. package/dist/chunk-RPJ2BIQ7.js.gz +0 -0
  42. package/dist/{chunk-SNL6LBRX.mjs → chunk-SQJBFMEX.mjs} +9 -0
  43. package/dist/chunk-SQJBFMEX.mjs.br +0 -0
  44. package/dist/chunk-SQJBFMEX.mjs.gz +0 -0
  45. package/dist/{chunk-GODW6RNR.mjs → chunk-XF3EOHY2.mjs} +1087 -1017
  46. package/dist/chunk-XF3EOHY2.mjs.br +0 -0
  47. package/dist/chunk-XF3EOHY2.mjs.gz +0 -0
  48. package/dist/{chunk-O7FTUUXP.mjs → chunk-YWJBD7KV.mjs} +210 -92
  49. package/dist/chunk-YWJBD7KV.mjs.br +0 -0
  50. package/dist/chunk-YWJBD7KV.mjs.gz +0 -0
  51. package/dist/{chunk-7XF6S4AM.mjs → chunk-ZMEYXAC6.mjs} +1 -1
  52. package/dist/chunk-ZMEYXAC6.mjs.br +0 -0
  53. package/dist/{chunk-7XF6S4AM.mjs.gz → chunk-ZMEYXAC6.mjs.gz} +0 -0
  54. package/dist/i18n.js +4 -4
  55. package/dist/i18n.js.br +0 -0
  56. package/dist/i18n.js.gz +0 -0
  57. package/dist/i18n.mjs +1 -1
  58. package/dist/i18n.mjs.br +0 -0
  59. package/dist/i18n.mjs.gz +0 -0
  60. package/dist/index.d.ts +38 -1
  61. package/dist/index.js +47 -47
  62. package/dist/index.js.br +0 -0
  63. package/dist/index.js.gz +0 -0
  64. package/dist/index.mjs +6 -6
  65. package/dist/index.mjs.br +0 -0
  66. package/dist/index.mjs.gz +0 -0
  67. package/dist/internals.d.ts +102 -15
  68. package/dist/internals.d.ts.map +1 -1
  69. package/dist/internals.js +79 -79
  70. package/dist/internals.js.br +0 -0
  71. package/dist/internals.js.gz +0 -0
  72. package/dist/internals.mjs +4 -4
  73. package/dist/internals.mjs.br +0 -0
  74. package/dist/internals.mjs.gz +0 -0
  75. package/dist/{types-C_CTI-QE.d.ts → types-TCH6icpi.d.ts} +23 -1
  76. package/dist/{types-C_CTI-QE.d.ts.map → types-TCH6icpi.d.ts.map} +1 -1
  77. package/dist/{useViewerBuildingBlocks-DItilDbP.d.ts → useViewerBuildingBlocks-BKb0qs1j.d.ts} +20 -4
  78. package/dist/{useViewerBuildingBlocks-DItilDbP.d.ts.map → useViewerBuildingBlocks-BKb0qs1j.d.ts.map} +1 -1
  79. package/dist/viewer/index.d.ts +38 -1
  80. package/dist/viewer/index.js +27 -27
  81. package/dist/viewer/index.js.br +0 -0
  82. package/dist/viewer/index.js.gz +0 -0
  83. package/dist/viewer/index.mjs +6 -6
  84. package/dist/viewer/index.mjs.br +0 -0
  85. package/dist/viewer/index.mjs.gz +0 -0
  86. package/package.json +1 -1
  87. package/dist/AiChatPanel-SSSBERWJ.mjs.br +0 -0
  88. package/dist/AiChatPanel-SSSBERWJ.mjs.gz +0 -0
  89. package/dist/AiChatPanel-UN5DHPZY.js.br +0 -0
  90. package/dist/AiChatPanel-UN5DHPZY.js.gz +0 -0
  91. package/dist/Model3DScene-4RPYKC2I.js.br +0 -0
  92. package/dist/Model3DScene-4RPYKC2I.js.gz +0 -0
  93. package/dist/Model3DScene-LYEESYAI.mjs.br +0 -0
  94. package/dist/Model3DScene-LYEESYAI.mjs.gz +0 -0
  95. package/dist/PowerPointViewer-Cf4YHjdF.d.ts.map +0 -1
  96. package/dist/SurfaceChart3DScene-ACPKCWLJ.js +0 -78
  97. package/dist/SurfaceChart3DScene-ACPKCWLJ.js.br +0 -0
  98. package/dist/SurfaceChart3DScene-ACPKCWLJ.js.gz +0 -0
  99. package/dist/SurfaceChart3DScene-JR62SOYO.mjs +0 -76
  100. package/dist/SurfaceChart3DScene-JR62SOYO.mjs.br +0 -0
  101. package/dist/SurfaceChart3DScene-JR62SOYO.mjs.gz +0 -0
  102. package/dist/chunk-4LWGAVAP.js.br +0 -0
  103. package/dist/chunk-4LWGAVAP.js.gz +0 -0
  104. package/dist/chunk-7XF6S4AM.mjs.br +0 -0
  105. package/dist/chunk-ASKYZ5ZY.js.br +0 -0
  106. package/dist/chunk-ASKYZ5ZY.js.gz +0 -0
  107. package/dist/chunk-BZOL6FXF.mjs.br +0 -0
  108. package/dist/chunk-BZOL6FXF.mjs.gz +0 -0
  109. package/dist/chunk-GODW6RNR.mjs.br +0 -0
  110. package/dist/chunk-GODW6RNR.mjs.gz +0 -0
  111. package/dist/chunk-ICZDMFF2.js.br +0 -0
  112. package/dist/chunk-ICZDMFF2.js.gz +0 -0
  113. package/dist/chunk-MAVLV56S.js.br +0 -0
  114. package/dist/chunk-MAVLV56S.js.gz +0 -0
  115. package/dist/chunk-O7FTUUXP.mjs.br +0 -0
  116. package/dist/chunk-O7FTUUXP.mjs.gz +0 -0
  117. package/dist/chunk-QUB5OSKY.mjs.br +0 -0
  118. package/dist/chunk-QUB5OSKY.mjs.gz +0 -0
  119. package/dist/chunk-RTUGI4HQ.js.br +0 -0
  120. package/dist/chunk-RTUGI4HQ.js.gz +0 -0
  121. package/dist/chunk-SNL6LBRX.mjs.br +0 -0
  122. package/dist/chunk-SNL6LBRX.mjs.gz +0 -0
  123. package/dist/chunk-WVDM36ZM.js.br +0 -0
  124. package/dist/chunk-WVDM36ZM.js.gz +0 -0
Binary file
Binary file
@@ -1,6 +1,6 @@
1
- import { cloneHistorySnapshot, MIN_ELEMENT_SIZE, ZOOM_TO_SELECTION_PADDING, DEFAULT_CANVAS_HEIGHT, DEFAULT_CANVAS_WIDTH, UNGROUPED_SECTION_ID, DEFAULT_SECTION_GROUP_ID, DEFAULT_TABLE_ROWS, DEFAULT_TABLE_COLUMNS, executeMediaCommand, buildPdfFromImageData, buildNotesPdf, EMU_PER_PX, GRID_SIZE, DEFAULT_TEXT_FONT_SIZE } from './chunk-BZOL6FXF.mjs';
2
- import { translationsEn } from './chunk-SNL6LBRX.mjs';
3
- import { TOOLBAR_TABS, computeVirtualRange, DEFAULT_VIRTUAL_OVERSCAN, createPresenceProjector, BROADCAST_THROTTLE_MS, createSyncGate, clearLocalAwareness, validateRoomId, createDepartureChannel, resolveTransportForServerUrl, isMixedContentBlocked, CONNECTION_TIMEOUT_MS, registerCollaborationTeardown, sanitizeColor, cloneTemplateElementsBySlideId, cloneSlide, createWheelStepBuffer, createViewerZoomStore, clampZoomScale, mapEditingWheel, PresentationAnimationController, PRESENTATION_HASH, PRESENTATION_NONCE_KEY, PRESENTATION_CHANNEL_NAME, swapPresentationWindows, PRESENTATION_MESSAGE_ORIGIN, clearAudienceContent, buildPresentationAudienceUrl, resolveAudienceScreenPlacement, placeAudienceWindow, storeAudienceContent, isPresentationSessionMessage, endAudienceDisplay, createPresentationKeyBuffer, acceptsPresentationInput, resolveAutoAdvanceDelayMs, hasShowSlideAfter, nextShowSlideIndex, previousShowSlideIndex, createPresenterShowGuard, attachPresentationVisibilityPause, buildMorphTransitionPlan, morphOptionToMode, buildMorphAnimationRules, findInSlides, applyFindReplacements, createCollaborationLivePatcher, publishLiveInlineText, PptxHandler, collectMediaElements, collectImagePaths, partitionTemplateElements, resolveAuthoredCustomShowId, buildInitialGuides, EncryptedFileError, shouldWriteAutosaveSnapshot, saveAutosaveSnapshot, autosaveSnapshotMark, updateMasterViewElement, isTemplateElementId, hasShapeProperties, hasTextProperties, getInlineEditorSelection, applyStyleToSelectedSegments, setPendingSelectionRestore, applyCaseTransformToSegments, transformTextCase, masterViewElements, replaceMasterViewElements, addSection, renameSection, deleteSection, moveSectionUp, moveSectionDown, moveSlidesToSection, normalizeColorsForCapture, preprocessCssForCapture, downloadBlob, sanitizeDownloadFilename, slideProgressPercent, slideStatusLabel, EXPORT_ASSEMBLING_PERCENT, EXPORT_DONE_PERCENT, isExportAbortError, recordProgressPercent, applyThemeToData, THEME_PRESETS, themeColorSchemesEqual, comparePresentation, applyAcceptSlide, applyAcceptAllSlides, collectUsedFonts, detectTouchDevice, detectOrientation, isMobileViewport, MOBILE_BREAKPOINT, TABLET_BREAKPOINT, describeFontEmbedding, mayLeaveSlideShow, stopAllPersistentAudio, remapTextToSegments, guidePxToEmu, buildSaveSlides, embeddedFontSaveOptions, resolveSlideSizeSelection, saveDeckWithPassword, shouldLoopContinuously, applyRehearsalTimings, copyFormatFromElement, applyFormatToElement, mapEditorKey, isEditorTextInputTarget, createViewerOptionsStore, readSlidesFromYDoc, reconcileSlidesInYDoc, LOCAL_SYNC_ORIGIN, observeYDocSlides, shouldAutoFollowBroadcaster, createTouchGestureRecognizer, MAX_ZOOM_SCALE, MIN_ZOOM_SCALE, isKeyboardOpen, scopeLayoutOptionsToSlide, openPptxFile, readBackstageRecentFile, isActionHidden, canInteractWithElement, filterInteractableIds, beginShapeAdjustment, buildElementClipboardPayload, savedPresentationFileName, generatePackageReadme, presentationBaseName, exportDeckJson, groupElements, generateElementId, makeCloneId, ungroupElements, alignElements, distributeElements, bringForward, sendBackward, bringToFront, sendToBack, newTableElement, createDefaultChartElement, readViewportMetrics, computeKeyboardInset, mergeShapes, mapPresentationKey, lastShowSlideIndex, firstShowSlideIndex, mapPresentationWheel, buildPrintDocument, buildOutlineHtml, buildSlidesHtml, buildNotesHtml, buildHandoutsHtml, createBlankSlide, makeSlideId, buildSlideTemplateSlide, templateSchemeFromTheme, buildThemeColorMap, reResolveSlideColors, computeEntranceAnimationDelay, createPresentationSessionId, resolveTransitionDurationMs, runPresentationAction, createPresenterTimer, createInitialPresentationSnapshot, mergePresentationSnapshot, resetPresenterTimer, presenterElapsed, stepPresenterZoom, togglePresenterTimer, canvasToJpegData, downloadDataUrl, pickSupportedMimeType, WEBM_MIME_CANDIDATES, fpsToFrameIntervalMs, segmentFrameCount, encodeGif, resolveShowSlideIndexes, groupSlidesBySection, masterViewPseudoSlide, hasCopyableFormat, createBackstagePresentation, buildFieldSubstitutionContext, cloneElementForPaste, computeScrollDelta, getPresetShapeClipPath, svgPathToPolygons, polygonsToSvgPath, rerouteConnectorsForMovedElements, applyReroutedConnectors, SvgExporter, buildPrintHtmlDocument, deleteTableColumn, rebuildTableStructureInRawXml, insertTableColumn, deleteTableRow, insertTableRow, updateCellTextStyleInRawXml, updateCellTextInRawXml, splitCell, updateMergeAttrsInRawXml, mergeCells, isPpactionUrl, parsePpactionUrl, safeOpenUrl, ACTION_BUTTON_PRESETS, elementActionToPptxAction, buildSmartArtPresetData, computeSnapToShape, publishLiveGeometry, getDraggedShapeAdjustments, computeMarqueeHitIds, mergeAdditiveSelection, applyResize, snapBoxToGrid, applyMotionPathPreset } from './chunk-GODW6RNR.mjs';
1
+ import { cloneHistorySnapshot, MIN_ELEMENT_SIZE, ZOOM_TO_SELECTION_PADDING, DEFAULT_CANVAS_HEIGHT, DEFAULT_CANVAS_WIDTH, UNGROUPED_SECTION_ID, DEFAULT_SECTION_GROUP_ID, DEFAULT_TABLE_ROWS, DEFAULT_TABLE_COLUMNS, executeMediaCommand, buildPdfFromImageData, buildNotesPdf, EMU_PER_PX, GRID_SIZE, DEFAULT_TEXT_FONT_SIZE } from './chunk-MWEBCWVD.mjs';
2
+ import { translationsEn } from './chunk-SQJBFMEX.mjs';
3
+ import { TOOLBAR_TABS, computeVirtualRange, DEFAULT_VIRTUAL_OVERSCAN, createPresenceProjector, BROADCAST_THROTTLE_MS, createSyncGate, clearLocalAwareness, validateRoomId, createDepartureChannel, resolveTransportForServerUrl, isMixedContentBlocked, CONNECTION_TIMEOUT_MS, registerCollaborationTeardown, sanitizeColor, cloneTemplateElementsBySlideId, cloneSlide, createWheelStepBuffer, createViewerZoomStore, clampZoomScale, mapEditingWheel, PresentationAnimationController, PRESENTATION_HASH, PRESENTATION_NONCE_KEY, PRESENTATION_CHANNEL_NAME, swapPresentationWindows, PRESENTATION_MESSAGE_ORIGIN, clearAudienceContent, buildPresentationAudienceUrl, resolveAudienceScreenPlacement, placeAudienceWindow, storeAudienceContent, isPresentationSessionMessage, endAudienceDisplay, createPresentationKeyBuffer, acceptsPresentationInput, resolveAutoAdvanceDelayMs, hasShowSlideAfter, nextShowSlideIndex, previousShowSlideIndex, createPresenterShowGuard, attachPresentationVisibilityPause, buildMorphTransitionPlan, morphOptionToMode, buildMorphAnimationRules, findInSlides, applyFindReplacements, createCollaborationLivePatcher, publishLiveInlineText, PptxHandler, collectMediaElements, collectImagePaths, partitionTemplateElements, resolveAuthoredCustomShowId, buildInitialGuides, EncryptedFileError, resolveAutosaveIntervalMs, shouldWriteAutosaveSnapshot, saveAutosaveSnapshot, autosaveSnapshotMark, updateMasterViewElement, isTemplateElementId, hasShapeProperties, hasTextProperties, getInlineEditorSelection, applyStyleToSelectedSegments, setPendingSelectionRestore, applyCaseTransformToSegments, transformTextCase, masterViewElements, replaceMasterViewElements, addSection, renameSection, deleteSection, moveSectionUp, moveSectionDown, moveSlidesToSection, normalizeColorsForCapture, preprocessCssForCapture, downloadBlob, sanitizeDownloadFilename, slideProgressPercent, slideStatusLabel, EXPORT_ASSEMBLING_PERCENT, EXPORT_DONE_PERCENT, isExportAbortError, recordProgressPercent, applyThemeToData, THEME_PRESETS, themeColorSchemesEqual, comparePresentation, applyAcceptSlide, applyAcceptAllSlides, collectUsedFonts, detectTouchDevice, detectOrientation, isMobileViewport, MOBILE_BREAKPOINT, TABLET_BREAKPOINT, describeFontEmbedding, mayLeaveSlideShow, stopAllPersistentAudio, remapTextToSegments, guidePxToEmu, buildSaveSlides, embeddedFontSaveOptions, resolveSlideSizeSelection, saveDeckWithPassword, shouldProbeAutosaveRecovery, probeAutosaveRecovery, acceptAutosaveRecovery, discardAutosaveRecovery, shouldLoopContinuously, applyRehearsalTimings, copyFormatFromElement, applyFormatToElement, mapEditorKey, isEditorTextInputTarget, createViewerOptionsStore, readSlidesFromYDoc, reconcileSlidesInYDoc, LOCAL_SYNC_ORIGIN, observeYDocSlides, shouldAutoFollowBroadcaster, createTouchGestureRecognizer, MAX_ZOOM_SCALE, MIN_ZOOM_SCALE, isKeyboardOpen, scopeLayoutOptionsToSlide, openPptxFile, readBackstageRecentFile, isActionHidden, canInteractWithElement, filterInteractableIds, beginShapeAdjustment, buildElementClipboardPayload, savedPresentationFileName, generatePackageReadme, presentationBaseName, exportDeckJson, groupElements, generateElementId, makeCloneId, ungroupElements, alignElements, distributeElements, bringForward, sendBackward, bringToFront, sendToBack, newTableElement, createDefaultChartElement, readViewportMetrics, computeKeyboardInset, mergeShapes, mapPresentationKey, lastShowSlideIndex, firstShowSlideIndex, mapPresentationWheel, buildPrintDocument, buildOutlineHtml, buildSlidesHtml, buildNotesHtml, buildHandoutsHtml, createBlankSlide, makeSlideId, buildSlideTemplateSlide, templateSchemeFromTheme, buildThemeColorMap, reResolveSlideColors, computeEntranceAnimationDelay, createPresentationSessionId, resolveTransitionDurationMs, runPresentationAction, createPresenterTimer, createInitialPresentationSnapshot, mergePresentationSnapshot, resetPresenterTimer, presenterElapsed, stepPresenterZoom, togglePresenterTimer, canvasToJpegData, downloadDataUrl, pickSupportedMimeType, WEBM_MIME_CANDIDATES, fpsToFrameIntervalMs, segmentFrameCount, encodeGif, resolveShowSlideIndexes, groupSlidesBySection, masterViewPseudoSlide, hasCopyableFormat, createBackstagePresentation, buildFieldSubstitutionContext, cloneElementForPaste, computeScrollDelta, getPresetShapeClipPath, svgPathToPolygons, polygonsToSvgPath, rerouteConnectorsForMovedElements, applyReroutedConnectors, SvgExporter, buildPrintHtmlDocument, deleteTableColumn, rebuildTableStructureInRawXml, insertTableColumn, deleteTableRow, insertTableRow, updateCellTextStyleInRawXml, updateCellTextInRawXml, splitCell, updateMergeAttrsInRawXml, mergeCells, isPpactionUrl, parsePpactionUrl, safeOpenUrl, ACTION_BUTTON_PRESETS, elementActionToPptxAction, buildSmartArtPresetData, computeSnapToShape, publishLiveGeometry, getDraggedShapeAdjustments, computeMarqueeHitIds, mergeAdditiveSelection, applyResize, snapBoxToGrid, applyMotionPathPreset } from './chunk-XF3EOHY2.mjs';
4
4
  import { useRef, useState, useEffect, useCallback, useMemo, useLayoutEffect, useSyncExternalStore, useImperativeHandle } from 'react';
5
5
  import JSZip from 'jszip';
6
6
  import { useTranslation } from 'react-i18next';
@@ -473,6 +473,14 @@ function useSheetDismissDrag(onClose, threshold = 120) {
473
473
  };
474
474
  }
475
475
  var DEFAULT_MAX_HISTORY_ENTRIES = 120;
476
+ function serializeDocument(snapshot) {
477
+ return JSON.stringify({
478
+ width: snapshot.width,
479
+ height: snapshot.height,
480
+ slides: snapshot.slides,
481
+ templateElementsBySlideId: snapshot.templateElementsBySlideId
482
+ });
483
+ }
476
484
  function useEditorHistory(input) {
477
485
  const {
478
486
  slides,
@@ -575,7 +583,7 @@ function useEditorHistory(input) {
575
583
  isApplyingHistoryRef.current = true;
576
584
  const nextSnapshot = cloneHistorySnapshot(previousSnapshot);
577
585
  lastHistorySnapshotRef.current = cloneHistorySnapshot(nextSnapshot);
578
- lastHistorySerializedRef.current = JSON.stringify(nextSnapshot);
586
+ lastHistorySerializedRef.current = serializeDocument(nextSnapshot);
579
587
  applyHistorySnapshot(nextSnapshot);
580
588
  updateHistoryAvailability();
581
589
  unlockHistoryTracking();
@@ -597,7 +605,7 @@ function useEditorHistory(input) {
597
605
  isApplyingHistoryRef.current = true;
598
606
  const targetSnapshot = cloneHistorySnapshot(nextSnapshot);
599
607
  lastHistorySnapshotRef.current = cloneHistorySnapshot(targetSnapshot);
600
- lastHistorySerializedRef.current = JSON.stringify(targetSnapshot);
608
+ lastHistorySerializedRef.current = serializeDocument(targetSnapshot);
601
609
  applyHistorySnapshot(targetSnapshot);
602
610
  updateHistoryAvailability();
603
611
  unlockHistoryTracking();
@@ -616,7 +624,7 @@ function useEditorHistory(input) {
616
624
  if (initialSnapshot) {
617
625
  const clonedInitial = cloneHistorySnapshot(initialSnapshot);
618
626
  lastHistorySnapshotRef.current = clonedInitial;
619
- lastHistorySerializedRef.current = JSON.stringify(clonedInitial);
627
+ lastHistorySerializedRef.current = serializeDocument(clonedInitial);
620
628
  } else {
621
629
  lastHistorySnapshotRef.current = null;
622
630
  lastHistorySerializedRef.current = "";
@@ -648,8 +656,15 @@ function useEditorHistory(input) {
648
656
  return;
649
657
  }
650
658
  const snapshot = buildHistorySnapshot();
651
- const serialized = JSON.stringify(snapshot);
659
+ const serialized = serializeDocument(snapshot);
652
660
  if (serialized === lastHistorySerializedRef.current) {
661
+ const previous = lastHistorySnapshotRef.current;
662
+ if (previous && previous.activeSlideIndex !== snapshot.activeSlideIndex) {
663
+ lastHistorySnapshotRef.current = {
664
+ ...previous,
665
+ activeSlideIndex: snapshot.activeSlideIndex
666
+ };
667
+ }
653
668
  lastCheapHashRef.current = cheapHash;
654
669
  return;
655
670
  }
@@ -3983,24 +3998,12 @@ function useLoadContent({
3983
3998
  }, [content]);
3984
3999
  return { handlerRef };
3985
4000
  }
3986
-
3987
- // src/viewer/hooks/useAutosave-helpers.ts
3988
- var DEFAULT_AUTOSAVE_INTERVAL_SECONDS = 120;
3989
- var MIN_AUTOSAVE_INTERVAL_SECONDS = 10;
3990
- function computeAutosaveIntervalMs(intervalSeconds) {
3991
- return Math.max(intervalSeconds, MIN_AUTOSAVE_INTERVAL_SECONDS) * 1e3;
3992
- }
3993
-
3994
- // src/viewer/hooks/useAutosave.ts
3995
4001
  function useAutosave(input) {
3996
- const {
3997
- isDirty,
3998
- filePath,
3999
- serializeSlides,
4000
- intervalSeconds = DEFAULT_AUTOSAVE_INTERVAL_SECONDS,
4001
- enabled = true,
4002
- getChangeSources
4003
- } = input;
4002
+ const { isDirty, filePath, serializeSlides, enabled = true, getChangeSources } = input;
4003
+ const intervalMs = resolveAutosaveIntervalMs({
4004
+ hostIntervalMs: input.intervalMs,
4005
+ optionsIntervalSeconds: input.intervalSeconds
4006
+ });
4004
4007
  const [autosaveStatus, setAutosaveStatus] = useState({
4005
4008
  state: "idle"
4006
4009
  });
@@ -4071,12 +4074,11 @@ function useAutosave(input) {
4071
4074
  return;
4072
4075
  }
4073
4076
  setAutosaveStatus((prev) => prev.state === "disabled" ? { state: "idle" } : prev);
4074
- const ms = computeAutosaveIntervalMs(intervalSeconds);
4075
4077
  const id = setInterval(() => {
4076
4078
  void doAutosave({ polled: true });
4077
- }, ms);
4079
+ }, intervalMs);
4078
4080
  return () => clearInterval(id);
4079
- }, [enabled, filePath, intervalSeconds, doAutosave]);
4081
+ }, [enabled, filePath, intervalMs, doAutosave]);
4080
4082
  return {
4081
4083
  autosaveStatus,
4082
4084
  triggerAutosave: () => doAutosave()
@@ -8731,102 +8733,52 @@ function useSerialize(input) {
8731
8733
  purpose
8732
8734
  ]);
8733
8735
  }
8734
-
8735
- // src/viewer/hooks/useRecoveryDetection-helpers.ts
8736
- function shouldCheckRecovery(input) {
8737
- const { alreadyChecked, filePath, loading, error, slideCount } = input;
8738
- if (alreadyChecked) {
8739
- return false;
8740
- }
8741
- if (!filePath) {
8742
- return false;
8743
- }
8744
- if (loading) {
8745
- return false;
8746
- }
8747
- if (error) {
8748
- return false;
8749
- }
8750
- if (slideCount === 0) {
8751
- return false;
8752
- }
8753
- return true;
8754
- }
8755
- var RECOVERY_WINDOW_MS = 24 * 60 * 60 * 1e3;
8756
- function isRecentRecovery(timestamp, now) {
8757
- return now - timestamp < RECOVERY_WINDOW_MS;
8758
- }
8759
- function hasRecentRecoveryVersion(versions, now) {
8760
- if (versions.length === 0) {
8761
- return false;
8762
- }
8763
- return isRecentRecovery(versions[0].timestamp, now);
8764
- }
8765
-
8766
- // src/viewer/hooks/useRecoveryDetection.ts
8767
- var DB_NAME = "pptx-viewer-autosave";
8768
- var DB_VERSION = 1;
8769
- var STORE_NAME = "recoveryVersions";
8770
- function openAutosaveDb() {
8771
- return new Promise((resolve, reject) => {
8772
- const req = indexedDB.open(DB_NAME, DB_VERSION);
8773
- req.onupgradeneeded = () => {
8774
- const db = req.result;
8775
- if (!db.objectStoreNames.contains(STORE_NAME)) {
8776
- db.createObjectStore(STORE_NAME, { keyPath: "key" });
8777
- }
8778
- };
8779
- req.onsuccess = () => resolve(req.result);
8780
- req.onerror = () => reject(req.error);
8781
- });
8782
- }
8783
- async function getRecoveryVersion(filePath) {
8784
- try {
8785
- const db = await openAutosaveDb();
8786
- return new Promise((resolve) => {
8787
- const tx = db.transaction(STORE_NAME, "readonly");
8788
- const store = tx.objectStore(STORE_NAME);
8789
- const req = store.get(filePath);
8790
- req.onsuccess = () => {
8791
- db.close();
8792
- resolve(req.result);
8793
- };
8794
- req.onerror = () => {
8795
- db.close();
8796
- resolve(void 0);
8797
- };
8798
- });
8799
- } catch {
8800
- return void 0;
8801
- }
8802
- }
8803
8736
  function useRecoveryDetection(input) {
8804
- const { filePath, loading, error, slideCount, openVersionHistory } = input;
8737
+ const { filePath, loading, error, slideCount, autosaveAllowed = true } = input;
8805
8738
  const recoveryCheckedRef = useRef(false);
8739
+ const recordRef = useRef(null);
8740
+ const [prompt, setPrompt] = useState(null);
8741
+ const onRestore = input.onRestore;
8742
+ const openVersionHistory = input.openVersionHistory;
8806
8743
  useEffect(() => {
8807
- if (!shouldCheckRecovery({
8744
+ if (!shouldProbeAutosaveRecovery({
8808
8745
  alreadyChecked: recoveryCheckedRef.current,
8809
8746
  filePath,
8810
8747
  loading,
8811
8748
  error,
8812
- slideCount
8749
+ slideCount,
8750
+ autosaveAllowed
8813
8751
  })) {
8814
8752
  return;
8815
8753
  }
8816
8754
  recoveryCheckedRef.current = true;
8817
- if (typeof indexedDB === "undefined") {
8818
- return;
8819
- }
8820
8755
  void (async () => {
8821
- try {
8822
- const version = await getRecoveryVersion(filePath);
8823
- if (version && hasRecentRecoveryVersion([version], Date.now())) {
8824
- openVersionHistory();
8825
- }
8826
- } catch {
8756
+ const offer = await probeAutosaveRecovery(filePath);
8757
+ if (!offer) {
8758
+ return;
8827
8759
  }
8760
+ recordRef.current = offer.record;
8761
+ setPrompt(offer.prompt);
8762
+ openVersionHistory?.();
8828
8763
  })();
8829
- }, [filePath, loading, error, slideCount, openVersionHistory]);
8764
+ }, [filePath, loading, error, slideCount, autosaveAllowed, openVersionHistory]);
8765
+ const restore = useCallback(() => {
8766
+ const record = recordRef.current;
8767
+ setPrompt(null);
8768
+ if (record && onRestore) {
8769
+ onRestore(acceptAutosaveRecovery(record));
8770
+ }
8771
+ recordRef.current = null;
8772
+ }, [onRestore]);
8773
+ const discard = useCallback(() => {
8774
+ const record = recordRef.current;
8775
+ setPrompt(null);
8776
+ recordRef.current = null;
8777
+ if (record) {
8778
+ void discardAutosaveRecovery(record);
8779
+ }
8780
+ }, []);
8781
+ return { prompt, restore, discard };
8830
8782
  }
8831
8783
  function usePresentationSetup(input) {
8832
8784
  const {
@@ -9437,7 +9389,7 @@ function useContentLifecycle(input) {
9437
9389
  content,
9438
9390
  filePath,
9439
9391
  autosaveEnabled = true,
9440
- autosaveIntervalSeconds,
9392
+ autosaveIntervalMs,
9441
9393
  embedFonts = true,
9442
9394
  slides,
9443
9395
  state,
@@ -9521,7 +9473,7 @@ function useContentLifecycle(input) {
9521
9473
  filePath,
9522
9474
  serializeSlides: serializeForRecovery,
9523
9475
  enabled: autosaveEnabled,
9524
- ...autosaveIntervalSeconds === void 0 ? {} : { intervalSeconds: autosaveIntervalSeconds },
9476
+ ...autosaveIntervalMs === void 0 ? {} : { intervalMs: autosaveIntervalMs },
9525
9477
  // Everything `serializeForRecovery` reads that changes by REASSIGNMENT,
9526
9478
  // so a poll that finds all of them unchanged can skip re-serializing a
9527
9479
  // deck it has already snapshotted. The two refs are read by `.current`
@@ -9721,7 +9673,8 @@ function useViewerIntegration(input) {
9721
9673
  content,
9722
9674
  filePath,
9723
9675
  autosaveEnabled,
9724
- autosaveIntervalSeconds,
9676
+ autosaveAllowed = true,
9677
+ autosaveIntervalMs,
9725
9678
  canEdit,
9726
9679
  mode,
9727
9680
  slides,
@@ -9777,7 +9730,7 @@ function useViewerIntegration(input) {
9777
9730
  content,
9778
9731
  filePath,
9779
9732
  autosaveEnabled,
9780
- autosaveIntervalSeconds,
9733
+ autosaveIntervalMs,
9781
9734
  // The File > Fonts toggle, finally reaching a save call.
9782
9735
  embedFonts: dialogs.embedFontsEnabled,
9783
9736
  slides,
@@ -9821,12 +9774,13 @@ function useViewerIntegration(input) {
9821
9774
  setMode: state.setMode,
9822
9775
  setSlides: state.setSlides
9823
9776
  });
9824
- useRecoveryDetection({
9777
+ const recovery = useRecoveryDetection({
9825
9778
  filePath,
9826
9779
  loading,
9827
9780
  error,
9828
9781
  slideCount: slides.length,
9829
- openVersionHistory: () => propertyHandlers.setIsVersionHistoryOpen(true)
9782
+ autosaveAllowed,
9783
+ onRestore: setContent
9830
9784
  });
9831
9785
  useImperativeHandle(
9832
9786
  ref,
@@ -10034,6 +9988,7 @@ function useViewerIntegration(input) {
10034
9988
  handleEnterPresenterView,
10035
9989
  handleEnterRehearsalMode,
10036
9990
  autosaveStatus,
9991
+ recovery,
10037
9992
  isEncryptedDialogOpen,
10038
9993
  setIsEncryptedDialogOpen,
10039
9994
  handlerRef,
Binary file
Binary file