pptx-react-viewer 3.16.7 → 3.17.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/CHANGELOG.md +23 -0
- package/README.md +25 -3
- package/dist/{AiChatPanel-GLDW5OK4.mjs → AiChatPanel-4LKH44IE.mjs} +3 -3
- package/dist/AiChatPanel-4LKH44IE.mjs.br +0 -0
- package/dist/AiChatPanel-4LKH44IE.mjs.gz +0 -0
- package/dist/{AiChatPanel-N25STHYW.js → AiChatPanel-VWVGQ5DD.js} +24 -24
- package/dist/AiChatPanel-VWVGQ5DD.js.br +0 -0
- package/dist/AiChatPanel-VWVGQ5DD.js.gz +0 -0
- package/dist/{Area3DChartScene-5POI5LF7.js → Area3DChartScene-D7GSJGPQ.js} +2 -2
- package/dist/Area3DChartScene-D7GSJGPQ.js.br +0 -0
- package/dist/Area3DChartScene-D7GSJGPQ.js.gz +0 -0
- package/dist/{Area3DChartScene-FCHO4SK6.mjs → Area3DChartScene-X5SM67PZ.mjs} +1 -1
- package/dist/Area3DChartScene-X5SM67PZ.mjs.br +0 -0
- package/dist/Area3DChartScene-X5SM67PZ.mjs.gz +0 -0
- package/dist/{Bar3DChartScene-M3LLHXAL.mjs → Bar3DChartScene-HWIFFGI3.mjs} +1 -1
- package/dist/Bar3DChartScene-HWIFFGI3.mjs.br +0 -0
- package/dist/Bar3DChartScene-HWIFFGI3.mjs.gz +0 -0
- package/dist/{Bar3DChartScene-5CY5GRV5.js → Bar3DChartScene-M72WQW5Y.js} +2 -2
- package/dist/Bar3DChartScene-M72WQW5Y.js.br +0 -0
- package/dist/Bar3DChartScene-M72WQW5Y.js.gz +0 -0
- package/dist/{Line3DChartScene-77TZRLJY.mjs → Line3DChartScene-7MPZWVF3.mjs} +1 -1
- package/dist/Line3DChartScene-7MPZWVF3.mjs.br +0 -0
- package/dist/Line3DChartScene-7MPZWVF3.mjs.gz +0 -0
- package/dist/{Line3DChartScene-3TP7OUIP.js → Line3DChartScene-YOZEEQZ3.js} +2 -2
- package/dist/Line3DChartScene-YOZEEQZ3.js.br +0 -0
- package/dist/Line3DChartScene-YOZEEQZ3.js.gz +0 -0
- package/dist/{Model3DScene-QINKUHM2.mjs → Model3DScene-57LVY5QW.mjs} +1 -1
- package/dist/Model3DScene-57LVY5QW.mjs.br +0 -0
- package/dist/Model3DScene-57LVY5QW.mjs.gz +0 -0
- package/dist/{Model3DScene-CBETCFMI.js → Model3DScene-5IJSNGDZ.js} +2 -2
- package/dist/Model3DScene-5IJSNGDZ.js.br +0 -0
- package/dist/Model3DScene-5IJSNGDZ.js.gz +0 -0
- package/dist/{PieChart3DScene-NFXFVG7R.js → PieChart3DScene-UBI6X66Q.js} +2 -2
- package/dist/PieChart3DScene-UBI6X66Q.js.br +0 -0
- package/dist/PieChart3DScene-UBI6X66Q.js.gz +0 -0
- package/dist/{PieChart3DScene-H2DJSHW7.mjs → PieChart3DScene-WD5B6NP3.mjs} +1 -1
- package/dist/PieChart3DScene-WD5B6NP3.mjs.br +0 -0
- package/dist/PieChart3DScene-WD5B6NP3.mjs.gz +0 -0
- package/dist/{PowerPointViewer-Cl6jBPNw.d.ts → PowerPointViewer-Cde_wzd0.d.ts} +2 -2
- package/dist/{PowerPointViewer-Cl6jBPNw.d.ts.map → PowerPointViewer-Cde_wzd0.d.ts.map} +1 -1
- package/dist/{SurfaceChart3DScene-2IN5YKKE.js → SurfaceChart3DScene-JGNPYQ32.js} +2 -2
- package/dist/SurfaceChart3DScene-JGNPYQ32.js.br +0 -0
- package/dist/SurfaceChart3DScene-JGNPYQ32.js.gz +0 -0
- package/dist/{SurfaceChart3DScene-4AGI4O3L.mjs → SurfaceChart3DScene-JZGU6BBD.mjs} +1 -1
- package/dist/SurfaceChart3DScene-JZGU6BBD.mjs.br +0 -0
- package/dist/SurfaceChart3DScene-JZGU6BBD.mjs.gz +0 -0
- package/dist/{audience-content-store-CB2WVM1K.d.ts → audience-content-store-A8Km8rBo.d.ts} +2 -2
- package/dist/{audience-content-store-CB2WVM1K.d.ts.map → audience-content-store-A8Km8rBo.d.ts.map} +1 -1
- package/dist/{chunk-B3YVURJB.mjs → chunk-23PW4Y4R.mjs} +1 -1
- package/dist/chunk-23PW4Y4R.mjs.br +0 -0
- package/dist/chunk-23PW4Y4R.mjs.gz +0 -0
- package/dist/{chunk-4Q6VIX6M.js → chunk-3UGVURWU.js} +551 -498
- package/dist/chunk-3UGVURWU.js.br +0 -0
- package/dist/chunk-3UGVURWU.js.gz +0 -0
- package/dist/{chunk-3FVOKV4E.js → chunk-4SPZ5IZN.js} +1110 -470
- package/dist/chunk-4SPZ5IZN.js.br +0 -0
- package/dist/chunk-4SPZ5IZN.js.gz +0 -0
- package/dist/{chunk-SQNEE6AM.js → chunk-72LYFUGL.js} +1323 -1310
- package/dist/chunk-72LYFUGL.js.br +0 -0
- package/dist/chunk-72LYFUGL.js.gz +0 -0
- package/dist/{chunk-7ELFYC6K.mjs → chunk-7YJBRPCT.mjs} +9 -5
- package/dist/chunk-7YJBRPCT.mjs.br +0 -0
- package/dist/chunk-7YJBRPCT.mjs.gz +0 -0
- package/dist/{chunk-3PUFHKXW.mjs → chunk-7YOA4HNP.mjs} +102 -49
- package/dist/chunk-7YOA4HNP.mjs.br +0 -0
- package/dist/chunk-7YOA4HNP.mjs.gz +0 -0
- package/dist/{chunk-I5YSAIL5.mjs → chunk-EDMJYVCS.mjs} +44 -31
- package/dist/chunk-EDMJYVCS.mjs.br +0 -0
- package/dist/chunk-EDMJYVCS.mjs.gz +0 -0
- package/dist/{chunk-TYVSLRC7.js → chunk-KVXB22D3.js} +13 -9
- package/dist/chunk-KVXB22D3.js.br +0 -0
- package/dist/{chunk-TYVSLRC7.js.gz → chunk-KVXB22D3.js.gz} +0 -0
- package/dist/{chunk-4NSDMKFE.js → chunk-NJ3WCYYG.js} +169 -169
- package/dist/chunk-NJ3WCYYG.js.br +0 -0
- package/dist/chunk-NJ3WCYYG.js.gz +0 -0
- package/dist/{chunk-XMD6ZWUO.mjs → chunk-QTGCOL5H.mjs} +1104 -471
- package/dist/chunk-QTGCOL5H.mjs.br +0 -0
- package/dist/chunk-QTGCOL5H.mjs.gz +0 -0
- package/dist/index.d.ts +33 -3
- package/dist/index.js +45 -45
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/index.mjs +5 -5
- package/dist/index.mjs.br +0 -0
- package/dist/index.mjs.gz +0 -0
- package/dist/internals.d.ts +38 -3
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.js +78 -78
- package/dist/internals.js.br +0 -0
- package/dist/internals.js.gz +0 -0
- package/dist/internals.mjs +3 -3
- package/dist/internals.mjs.br +0 -0
- package/dist/internals.mjs.gz +0 -0
- package/dist/pptx-viewer.css +1 -1
- package/dist/pptx-viewer.css.br +0 -0
- package/dist/pptx-viewer.css.gz +0 -0
- package/dist/{types-Bzdkiakq.d.ts → types-BqB2ZCwS.d.ts} +3 -3
- package/dist/{types-Bzdkiakq.d.ts.map → types-BqB2ZCwS.d.ts.map} +1 -1
- package/dist/{useViewerBuildingBlocks-FbK-4ORi.d.ts → useViewerBuildingBlocks-DkUGmlkP.d.ts} +4 -4
- package/dist/{useViewerBuildingBlocks-FbK-4ORi.d.ts.map → useViewerBuildingBlocks-DkUGmlkP.d.ts.map} +1 -1
- package/dist/viewer/index.d.ts +31 -1
- package/dist/viewer/index.js +26 -26
- package/dist/viewer/index.js.br +0 -0
- package/dist/viewer/index.js.gz +0 -0
- package/dist/viewer/index.mjs +5 -5
- package/dist/viewer/index.mjs.br +0 -0
- package/dist/viewer/index.mjs.gz +0 -0
- package/package.json +1 -1
- package/dist/AiChatPanel-GLDW5OK4.mjs.br +0 -0
- package/dist/AiChatPanel-GLDW5OK4.mjs.gz +0 -0
- package/dist/AiChatPanel-N25STHYW.js.br +0 -0
- package/dist/AiChatPanel-N25STHYW.js.gz +0 -0
- package/dist/Area3DChartScene-5POI5LF7.js.br +0 -0
- package/dist/Area3DChartScene-5POI5LF7.js.gz +0 -0
- package/dist/Area3DChartScene-FCHO4SK6.mjs.br +0 -0
- package/dist/Area3DChartScene-FCHO4SK6.mjs.gz +0 -0
- package/dist/Bar3DChartScene-5CY5GRV5.js.br +0 -0
- package/dist/Bar3DChartScene-5CY5GRV5.js.gz +0 -0
- package/dist/Bar3DChartScene-M3LLHXAL.mjs.br +0 -0
- package/dist/Bar3DChartScene-M3LLHXAL.mjs.gz +0 -0
- package/dist/Line3DChartScene-3TP7OUIP.js.br +0 -0
- package/dist/Line3DChartScene-3TP7OUIP.js.gz +0 -0
- package/dist/Line3DChartScene-77TZRLJY.mjs.br +0 -0
- package/dist/Line3DChartScene-77TZRLJY.mjs.gz +0 -0
- package/dist/Model3DScene-CBETCFMI.js.br +0 -0
- package/dist/Model3DScene-CBETCFMI.js.gz +0 -0
- package/dist/Model3DScene-QINKUHM2.mjs.br +0 -0
- package/dist/Model3DScene-QINKUHM2.mjs.gz +0 -0
- package/dist/PieChart3DScene-H2DJSHW7.mjs.br +0 -0
- package/dist/PieChart3DScene-H2DJSHW7.mjs.gz +0 -0
- package/dist/PieChart3DScene-NFXFVG7R.js.br +0 -0
- package/dist/PieChart3DScene-NFXFVG7R.js.gz +0 -0
- package/dist/SurfaceChart3DScene-2IN5YKKE.js.br +0 -0
- package/dist/SurfaceChart3DScene-2IN5YKKE.js.gz +0 -0
- package/dist/SurfaceChart3DScene-4AGI4O3L.mjs.br +0 -0
- package/dist/SurfaceChart3DScene-4AGI4O3L.mjs.gz +0 -0
- package/dist/chunk-3FVOKV4E.js.br +0 -0
- package/dist/chunk-3FVOKV4E.js.gz +0 -0
- package/dist/chunk-3PUFHKXW.mjs.br +0 -0
- package/dist/chunk-3PUFHKXW.mjs.gz +0 -0
- package/dist/chunk-4NSDMKFE.js.br +0 -0
- package/dist/chunk-4NSDMKFE.js.gz +0 -0
- package/dist/chunk-4Q6VIX6M.js.br +0 -0
- package/dist/chunk-4Q6VIX6M.js.gz +0 -0
- package/dist/chunk-7ELFYC6K.mjs.br +0 -0
- package/dist/chunk-7ELFYC6K.mjs.gz +0 -0
- package/dist/chunk-B3YVURJB.mjs.br +0 -0
- package/dist/chunk-B3YVURJB.mjs.gz +0 -0
- package/dist/chunk-I5YSAIL5.mjs.br +0 -0
- package/dist/chunk-I5YSAIL5.mjs.gz +0 -0
- package/dist/chunk-SQNEE6AM.js.br +0 -0
- package/dist/chunk-SQNEE6AM.js.gz +0 -0
- package/dist/chunk-TYVSLRC7.js.br +0 -0
- package/dist/chunk-XMD6ZWUO.mjs.br +0 -0
- package/dist/chunk-XMD6ZWUO.mjs.gz +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkNJ3WCYYG_js = require('./chunk-NJ3WCYYG.js');
|
|
4
|
+
var chunk4SPZ5IZN_js = require('./chunk-4SPZ5IZN.js');
|
|
5
5
|
var chunk3AJ54EAB_js = require('./chunk-3AJ54EAB.js');
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var reactI18next = require('react-i18next');
|
|
@@ -9,7 +9,7 @@ var reactI18next = require('react-i18next');
|
|
|
9
9
|
function useVirtualizedSlides({
|
|
10
10
|
totalItems,
|
|
11
11
|
itemHeight,
|
|
12
|
-
overscan =
|
|
12
|
+
overscan = chunk4SPZ5IZN_js.DEFAULT_VIRTUAL_OVERSCAN
|
|
13
13
|
}) {
|
|
14
14
|
const scrollContainerRef = react.useRef(null);
|
|
15
15
|
const [scrollTop, setScrollTop] = react.useState(0);
|
|
@@ -39,7 +39,7 @@ function useVirtualizedSlides({
|
|
|
39
39
|
resizeObserver?.disconnect();
|
|
40
40
|
};
|
|
41
41
|
}, []);
|
|
42
|
-
const range =
|
|
42
|
+
const range = chunk4SPZ5IZN_js.computeVirtualRange(totalItems, itemHeight, scrollTop, viewportHeight, overscan);
|
|
43
43
|
const safeItemHeight = Math.max(itemHeight, 1);
|
|
44
44
|
const scrollToIndex = react.useCallback(
|
|
45
45
|
(index, behavior = "smooth") => {
|
|
@@ -80,7 +80,7 @@ function usePresenceTracking({
|
|
|
80
80
|
}) {
|
|
81
81
|
const [remoteUsers, setRemoteUsers] = react.useState([]);
|
|
82
82
|
const projectorRef = react.useRef(null);
|
|
83
|
-
projectorRef.current ??=
|
|
83
|
+
projectorRef.current ??= chunk4SPZ5IZN_js.createPresenceProjector();
|
|
84
84
|
const projector = projectorRef.current;
|
|
85
85
|
const lastBroadcastRef = react.useRef(0);
|
|
86
86
|
const pendingBroadcastRef = react.useRef(null);
|
|
@@ -105,7 +105,7 @@ function usePresenceTracking({
|
|
|
105
105
|
awareness.setLocalStateField("presence", state);
|
|
106
106
|
lastBroadcastRef.current = Date.now();
|
|
107
107
|
};
|
|
108
|
-
if (elapsed >=
|
|
108
|
+
if (elapsed >= chunk4SPZ5IZN_js.BROADCAST_THROTTLE_MS) {
|
|
109
109
|
if (pendingBroadcastRef.current) {
|
|
110
110
|
clearTimeout(pendingBroadcastRef.current);
|
|
111
111
|
pendingBroadcastRef.current = null;
|
|
@@ -115,7 +115,7 @@ function usePresenceTracking({
|
|
|
115
115
|
pendingBroadcastRef.current = setTimeout(() => {
|
|
116
116
|
pendingBroadcastRef.current = null;
|
|
117
117
|
flush();
|
|
118
|
-
},
|
|
118
|
+
}, chunk4SPZ5IZN_js.BROADCAST_THROTTLE_MS - elapsed);
|
|
119
119
|
}
|
|
120
120
|
},
|
|
121
121
|
[awareness, userName, userColor, userAvatar, role]
|
|
@@ -195,7 +195,7 @@ function useYjsProvider({ config }) {
|
|
|
195
195
|
const departureRef = react.useRef(null);
|
|
196
196
|
const gateRef = react.useRef(null);
|
|
197
197
|
if (!gateRef.current) {
|
|
198
|
-
gateRef.current =
|
|
198
|
+
gateRef.current = chunk4SPZ5IZN_js.createSyncGate(() => setSynced(true));
|
|
199
199
|
}
|
|
200
200
|
const teardown = react.useCallback(() => {
|
|
201
201
|
if (timeoutRef.current) {
|
|
@@ -215,7 +215,7 @@ function useYjsProvider({ config }) {
|
|
|
215
215
|
const buildCleanup = react.useCallback(
|
|
216
216
|
(provider, yDoc) => () => {
|
|
217
217
|
announceDeparture();
|
|
218
|
-
|
|
218
|
+
chunk4SPZ5IZN_js.clearLocalAwareness(provider.awareness);
|
|
219
219
|
provider.destroy();
|
|
220
220
|
yDoc.destroy();
|
|
221
221
|
setDoc(null);
|
|
@@ -240,9 +240,9 @@ function useYjsProvider({ config }) {
|
|
|
240
240
|
if (config.authToken) {
|
|
241
241
|
opts.password = config.authToken;
|
|
242
242
|
}
|
|
243
|
-
const roomId =
|
|
243
|
+
const roomId = chunk4SPZ5IZN_js.validateRoomId(config.roomId);
|
|
244
244
|
const provider = new WebrtcProvider(roomId, yDoc, opts);
|
|
245
|
-
departureRef.current =
|
|
245
|
+
departureRef.current = chunk4SPZ5IZN_js.createDepartureChannel(roomId, provider.awareness);
|
|
246
246
|
setDoc(yDoc);
|
|
247
247
|
setAwareness(provider.awareness);
|
|
248
248
|
setClientId(provider.awareness.clientID);
|
|
@@ -284,13 +284,13 @@ function useYjsProvider({ config }) {
|
|
|
284
284
|
if (!config) {
|
|
285
285
|
return;
|
|
286
286
|
}
|
|
287
|
-
const roomId =
|
|
288
|
-
const transport = config.transport ??
|
|
287
|
+
const roomId = chunk4SPZ5IZN_js.validateRoomId(config.roomId);
|
|
288
|
+
const transport = config.transport ?? chunk4SPZ5IZN_js.resolveTransportForServerUrl(config.serverUrl);
|
|
289
289
|
if (transport === "webrtc") {
|
|
290
290
|
await initWebrtc();
|
|
291
291
|
return;
|
|
292
292
|
}
|
|
293
|
-
if (
|
|
293
|
+
if (chunk4SPZ5IZN_js.isMixedContentBlocked(config.serverUrl)) {
|
|
294
294
|
console.warn(
|
|
295
295
|
`[pptx-viewer] Refusing to connect: insecure ws:// server "${config.serverUrl}" is blocked from a secure (https) page. Use a wss:// URL.`
|
|
296
296
|
);
|
|
@@ -304,7 +304,7 @@ function useYjsProvider({ config }) {
|
|
|
304
304
|
const provider = new WebsocketProvider(config.serverUrl, roomId, yDoc, {
|
|
305
305
|
params: config.authToken ? { token: config.authToken } : void 0
|
|
306
306
|
});
|
|
307
|
-
departureRef.current =
|
|
307
|
+
departureRef.current = chunk4SPZ5IZN_js.createDepartureChannel(roomId, provider.awareness);
|
|
308
308
|
let connected = false;
|
|
309
309
|
const handleStatus = (event) => {
|
|
310
310
|
if (event.status === "connected") {
|
|
@@ -344,7 +344,7 @@ function useYjsProvider({ config }) {
|
|
|
344
344
|
provider.off("status", handleStatus);
|
|
345
345
|
provider.off("sync", handleSynced);
|
|
346
346
|
announceDeparture();
|
|
347
|
-
|
|
347
|
+
chunk4SPZ5IZN_js.clearLocalAwareness(provider.awareness);
|
|
348
348
|
provider.destroy();
|
|
349
349
|
yDoc.destroy();
|
|
350
350
|
setDoc(null);
|
|
@@ -353,7 +353,7 @@ function useYjsProvider({ config }) {
|
|
|
353
353
|
cleanupRef.current = null;
|
|
354
354
|
setStatus("error");
|
|
355
355
|
}
|
|
356
|
-
},
|
|
356
|
+
}, chunk4SPZ5IZN_js.CONNECTION_TIMEOUT_MS);
|
|
357
357
|
}
|
|
358
358
|
setDoc(yDoc);
|
|
359
359
|
setAwareness(provider.awareness);
|
|
@@ -362,7 +362,7 @@ function useYjsProvider({ config }) {
|
|
|
362
362
|
provider.off("status", handleStatus);
|
|
363
363
|
provider.off("sync", handleSynced);
|
|
364
364
|
announceDeparture();
|
|
365
|
-
|
|
365
|
+
chunk4SPZ5IZN_js.clearLocalAwareness(provider.awareness);
|
|
366
366
|
provider.destroy();
|
|
367
367
|
yDoc.destroy();
|
|
368
368
|
setDoc(null);
|
|
@@ -388,7 +388,7 @@ function useYjsProvider({ config }) {
|
|
|
388
388
|
]);
|
|
389
389
|
react.useEffect(() => {
|
|
390
390
|
init();
|
|
391
|
-
const disposeTeardown =
|
|
391
|
+
const disposeTeardown = chunk4SPZ5IZN_js.registerCollaborationTeardown({
|
|
392
392
|
leave: teardown,
|
|
393
393
|
rejoin: init
|
|
394
394
|
});
|
|
@@ -409,7 +409,7 @@ function useCollaborativeState({
|
|
|
409
409
|
canvasWidth,
|
|
410
410
|
canvasHeight
|
|
411
411
|
}) {
|
|
412
|
-
const userColor =
|
|
412
|
+
const userColor = chunk4SPZ5IZN_js.sanitizeColor(config?.userColor, "#6366f1");
|
|
413
413
|
const { status, awareness, doc, clientId, synced, retry } = useYjsProvider({ config });
|
|
414
414
|
const { remoteUsers, broadcastPresence } = usePresenceTracking({
|
|
415
415
|
awareness,
|
|
@@ -527,8 +527,8 @@ function useEditorHistory(input) {
|
|
|
527
527
|
width: canvasSize.width,
|
|
528
528
|
height: canvasSize.height,
|
|
529
529
|
activeSlideIndex,
|
|
530
|
-
slides: slides.map(
|
|
531
|
-
templateElementsBySlideId:
|
|
530
|
+
slides: slides.map(chunk4SPZ5IZN_js.cloneSlide),
|
|
531
|
+
templateElementsBySlideId: chunk4SPZ5IZN_js.cloneTemplateElementsBySlideId(templateElementsBySlideId),
|
|
532
532
|
...actionLabel ? { actionLabel } : {}
|
|
533
533
|
};
|
|
534
534
|
},
|
|
@@ -541,9 +541,9 @@ function useEditorHistory(input) {
|
|
|
541
541
|
width: snapshot.width,
|
|
542
542
|
height: snapshot.height
|
|
543
543
|
});
|
|
544
|
-
setSlides(snapshot.slides.map(
|
|
544
|
+
setSlides(snapshot.slides.map(chunk4SPZ5IZN_js.cloneSlide));
|
|
545
545
|
setTemplateElementsBySlideId(
|
|
546
|
-
|
|
546
|
+
chunk4SPZ5IZN_js.cloneTemplateElementsBySlideId(snapshot.templateElementsBySlideId)
|
|
547
547
|
);
|
|
548
548
|
setActiveSlideIndex(Math.min(snapshot.activeSlideIndex, maxSlideIndex));
|
|
549
549
|
setSelectedElementIds([]);
|
|
@@ -582,8 +582,8 @@ function useEditorHistory(input) {
|
|
|
582
582
|
const currentSnapshot = buildHistorySnapshot();
|
|
583
583
|
historyFutureRef.current.push(currentSnapshot);
|
|
584
584
|
isApplyingHistoryRef.current = true;
|
|
585
|
-
const nextSnapshot =
|
|
586
|
-
lastHistorySnapshotRef.current =
|
|
585
|
+
const nextSnapshot = chunkNJ3WCYYG_js.cloneHistorySnapshot(previousSnapshot);
|
|
586
|
+
lastHistorySnapshotRef.current = chunkNJ3WCYYG_js.cloneHistorySnapshot(nextSnapshot);
|
|
587
587
|
lastHistorySerializedRef.current = serializeDocument(nextSnapshot);
|
|
588
588
|
applyHistorySnapshot(nextSnapshot);
|
|
589
589
|
updateHistoryAvailability();
|
|
@@ -604,8 +604,8 @@ function useEditorHistory(input) {
|
|
|
604
604
|
const currentSnapshot = buildHistorySnapshot();
|
|
605
605
|
historyPastRef.current.push(currentSnapshot);
|
|
606
606
|
isApplyingHistoryRef.current = true;
|
|
607
|
-
const targetSnapshot =
|
|
608
|
-
lastHistorySnapshotRef.current =
|
|
607
|
+
const targetSnapshot = chunkNJ3WCYYG_js.cloneHistorySnapshot(nextSnapshot);
|
|
608
|
+
lastHistorySnapshotRef.current = chunkNJ3WCYYG_js.cloneHistorySnapshot(targetSnapshot);
|
|
609
609
|
lastHistorySerializedRef.current = serializeDocument(targetSnapshot);
|
|
610
610
|
applyHistorySnapshot(targetSnapshot);
|
|
611
611
|
updateHistoryAvailability();
|
|
@@ -623,7 +623,7 @@ function useEditorHistory(input) {
|
|
|
623
623
|
historyPastRef.current = [];
|
|
624
624
|
historyFutureRef.current = [];
|
|
625
625
|
if (initialSnapshot) {
|
|
626
|
-
const clonedInitial =
|
|
626
|
+
const clonedInitial = chunkNJ3WCYYG_js.cloneHistorySnapshot(initialSnapshot);
|
|
627
627
|
lastHistorySnapshotRef.current = clonedInitial;
|
|
628
628
|
lastHistorySerializedRef.current = serializeDocument(clonedInitial);
|
|
629
629
|
} else {
|
|
@@ -671,19 +671,19 @@ function useEditorHistory(input) {
|
|
|
671
671
|
}
|
|
672
672
|
const previousSnapshot = lastHistorySnapshotRef.current;
|
|
673
673
|
if (!previousSnapshot) {
|
|
674
|
-
lastHistorySnapshotRef.current =
|
|
674
|
+
lastHistorySnapshotRef.current = chunkNJ3WCYYG_js.cloneHistorySnapshot(snapshot);
|
|
675
675
|
lastHistorySerializedRef.current = serialized;
|
|
676
676
|
lastCheapHashRef.current = cheapHash;
|
|
677
677
|
updateHistoryAvailability();
|
|
678
678
|
return;
|
|
679
679
|
}
|
|
680
680
|
onDirtyRef.current?.();
|
|
681
|
-
historyPastRef.current.push(
|
|
681
|
+
historyPastRef.current.push(chunkNJ3WCYYG_js.cloneHistorySnapshot(previousSnapshot));
|
|
682
682
|
while (historyPastRef.current.length > Math.max(1, maxHistoryEntries)) {
|
|
683
683
|
historyPastRef.current.shift();
|
|
684
684
|
}
|
|
685
685
|
historyFutureRef.current = [];
|
|
686
|
-
lastHistorySnapshotRef.current =
|
|
686
|
+
lastHistorySnapshotRef.current = chunkNJ3WCYYG_js.cloneHistorySnapshot(snapshot);
|
|
687
687
|
lastHistorySerializedRef.current = serialized;
|
|
688
688
|
lastCheapHashRef.current = cheapHash;
|
|
689
689
|
updateHistoryAvailability();
|
|
@@ -732,39 +732,75 @@ function useViewerStore(store, selector, isEqual = Object.is) {
|
|
|
732
732
|
);
|
|
733
733
|
return react.useSyncExternalStore(subscribe2, getSnapshot2, getSnapshot2);
|
|
734
734
|
}
|
|
735
|
+
var DEFAULT_FIT = { fitPadding: { horizontal: 4, vertical: 16 }, maxFitScale: 1 };
|
|
736
|
+
function useViewportFit(canvasSize, viewportRef, options) {
|
|
737
|
+
const [editorDimensions, setEditorDimensions] = react.useState(null);
|
|
738
|
+
const { fitPadding, maxFitScale } = chunk4SPZ5IZN_js.resolveViewportFitOptions(options, DEFAULT_FIT);
|
|
739
|
+
const { horizontal, vertical } = fitPadding;
|
|
740
|
+
const effectiveEditorDimensions = editorDimensions ?? canvasSize;
|
|
741
|
+
const { scale: fitScale } = chunk4SPZ5IZN_js.calculateViewportFit({
|
|
742
|
+
viewportWidth: effectiveEditorDimensions.width,
|
|
743
|
+
viewportHeight: effectiveEditorDimensions.height,
|
|
744
|
+
canvasWidth: canvasSize.width,
|
|
745
|
+
canvasHeight: canvasSize.height,
|
|
746
|
+
maxFitScale
|
|
747
|
+
});
|
|
748
|
+
react.useEffect(() => {
|
|
749
|
+
let observer = null;
|
|
750
|
+
let raf = 0;
|
|
751
|
+
const measure = (element) => {
|
|
752
|
+
const { availableWidth: width, availableHeight: height } = chunk4SPZ5IZN_js.calculateViewportFit({
|
|
753
|
+
viewportWidth: element.clientWidth,
|
|
754
|
+
viewportHeight: element.clientHeight,
|
|
755
|
+
canvasWidth: canvasSize.width,
|
|
756
|
+
canvasHeight: canvasSize.height,
|
|
757
|
+
fitPadding: { horizontal, vertical }
|
|
758
|
+
});
|
|
759
|
+
if (width > 0 && height > 0) {
|
|
760
|
+
setEditorDimensions({ width, height });
|
|
761
|
+
}
|
|
762
|
+
};
|
|
763
|
+
const attach = () => {
|
|
764
|
+
const element = viewportRef.current;
|
|
765
|
+
if (!element) {
|
|
766
|
+
raf = requestAnimationFrame(attach);
|
|
767
|
+
return;
|
|
768
|
+
}
|
|
769
|
+
observer = new ResizeObserver(() => measure(element));
|
|
770
|
+
observer.observe(element);
|
|
771
|
+
measure(element);
|
|
772
|
+
};
|
|
773
|
+
attach();
|
|
774
|
+
return () => {
|
|
775
|
+
cancelAnimationFrame(raf);
|
|
776
|
+
observer?.disconnect();
|
|
777
|
+
};
|
|
778
|
+
}, [viewportRef, canvasSize.width, canvasSize.height, horizontal, vertical]);
|
|
779
|
+
return { editorDimensions, setEditorDimensions, effectiveEditorDimensions, fitScale };
|
|
780
|
+
}
|
|
735
781
|
|
|
736
782
|
// src/viewer/hooks/useZoomViewport.ts
|
|
737
783
|
var selectZoom = (state) => state.zoom;
|
|
738
784
|
function useZoomViewport({
|
|
739
785
|
canvasSize,
|
|
740
|
-
selectedElements
|
|
786
|
+
selectedElements,
|
|
787
|
+
fitPadding,
|
|
788
|
+
maxFitScale
|
|
741
789
|
}) {
|
|
742
790
|
const editWrapperRef = react.useRef(null);
|
|
743
791
|
const canvasStageRef = react.useRef(null);
|
|
744
792
|
const canvasViewportRef = react.useRef(null);
|
|
745
793
|
const renderScaleRef = react.useRef(1);
|
|
746
|
-
const wheelBufferRef = react.useRef(
|
|
794
|
+
const wheelBufferRef = react.useRef(chunk4SPZ5IZN_js.createWheelStepBuffer());
|
|
747
795
|
const storeRef = react.useRef(null);
|
|
748
|
-
storeRef.current ??=
|
|
796
|
+
storeRef.current ??= chunk4SPZ5IZN_js.createViewerZoomStore();
|
|
749
797
|
const store = storeRef.current;
|
|
750
798
|
const scale = useViewerStore(store, selectZoom);
|
|
751
799
|
const setScale = react.useCallback(
|
|
752
800
|
(next) => store.dispatch({ type: "set-zoom", zoom: next }),
|
|
753
801
|
[store]
|
|
754
802
|
);
|
|
755
|
-
const
|
|
756
|
-
const effectiveEditorDimensions = editorDimensions || {
|
|
757
|
-
width: canvasSize.width,
|
|
758
|
-
height: canvasSize.height
|
|
759
|
-
};
|
|
760
|
-
const fitScale = react.useMemo(() => {
|
|
761
|
-
if (!effectiveEditorDimensions.width || !effectiveEditorDimensions.height) {
|
|
762
|
-
return 1;
|
|
763
|
-
}
|
|
764
|
-
const widthScale = effectiveEditorDimensions.width / canvasSize.width;
|
|
765
|
-
const heightScale = effectiveEditorDimensions.height / canvasSize.height;
|
|
766
|
-
return Math.min(widthScale, heightScale, 1);
|
|
767
|
-
}, [canvasSize, effectiveEditorDimensions.height, effectiveEditorDimensions.width]);
|
|
803
|
+
const { editorDimensions, setEditorDimensions, effectiveEditorDimensions, fitScale } = useViewportFit(canvasSize, canvasViewportRef, { fitPadding, maxFitScale });
|
|
768
804
|
const editorScale = fitScale * scale;
|
|
769
805
|
react.useEffect(() => {
|
|
770
806
|
renderScaleRef.current = editorScale;
|
|
@@ -772,33 +808,6 @@ function useZoomViewport({
|
|
|
772
808
|
react.useEffect(() => {
|
|
773
809
|
store.dispatch({ type: "set-fit-scale", fitScale });
|
|
774
810
|
}, [store, fitScale]);
|
|
775
|
-
react.useEffect(() => {
|
|
776
|
-
let observer = null;
|
|
777
|
-
let raf = 0;
|
|
778
|
-
const VERTICAL_MARGIN = 32;
|
|
779
|
-
const measure = (el) => {
|
|
780
|
-
const width = Math.max(0, el.clientWidth - 8);
|
|
781
|
-
const height = Math.max(0, el.clientHeight - VERTICAL_MARGIN);
|
|
782
|
-
if (width > 0 && height > 0) {
|
|
783
|
-
setEditorDimensions({ width, height });
|
|
784
|
-
}
|
|
785
|
-
};
|
|
786
|
-
const attach = () => {
|
|
787
|
-
const el = canvasViewportRef.current;
|
|
788
|
-
if (!el) {
|
|
789
|
-
raf = requestAnimationFrame(attach);
|
|
790
|
-
return;
|
|
791
|
-
}
|
|
792
|
-
observer = new ResizeObserver(() => measure(el));
|
|
793
|
-
observer.observe(el);
|
|
794
|
-
measure(el);
|
|
795
|
-
};
|
|
796
|
-
attach();
|
|
797
|
-
return () => {
|
|
798
|
-
cancelAnimationFrame(raf);
|
|
799
|
-
observer?.disconnect();
|
|
800
|
-
};
|
|
801
|
-
}, []);
|
|
802
811
|
const centerBoundsInViewport = react.useCallback(
|
|
803
812
|
(bounds, nextScale) => {
|
|
804
813
|
const wrapper = editWrapperRef.current;
|
|
@@ -806,7 +815,7 @@ function useZoomViewport({
|
|
|
806
815
|
if (!wrapper || !canvasViewport) {
|
|
807
816
|
return;
|
|
808
817
|
}
|
|
809
|
-
const boundedScale =
|
|
818
|
+
const boundedScale = chunk4SPZ5IZN_js.clampZoomScale(nextScale);
|
|
810
819
|
const nextEditorScale = fitScale * boundedScale;
|
|
811
820
|
const centerX = (bounds.minX + bounds.maxX) / 2;
|
|
812
821
|
const centerY = (bounds.minY + bounds.maxY) / 2;
|
|
@@ -843,29 +852,29 @@ function useZoomViewport({
|
|
|
843
852
|
selectedElements.forEach((element) => {
|
|
844
853
|
minX = Math.min(minX, element.x);
|
|
845
854
|
minY = Math.min(minY, element.y);
|
|
846
|
-
maxX = Math.max(maxX, element.x + Math.max(element.width,
|
|
847
|
-
maxY = Math.max(maxY, element.y + Math.max(element.height,
|
|
855
|
+
maxX = Math.max(maxX, element.x + Math.max(element.width, chunkNJ3WCYYG_js.MIN_ELEMENT_SIZE));
|
|
856
|
+
maxY = Math.max(maxY, element.y + Math.max(element.height, chunkNJ3WCYYG_js.MIN_ELEMENT_SIZE));
|
|
848
857
|
});
|
|
849
858
|
if (!Number.isFinite(minX) || !Number.isFinite(minY) || !Number.isFinite(maxX) || !Number.isFinite(maxY)) {
|
|
850
859
|
return;
|
|
851
860
|
}
|
|
852
861
|
const selectionBounds = { minX, minY, maxX, maxY };
|
|
853
|
-
const boundsWidth = Math.max(selectionBounds.maxX - selectionBounds.minX,
|
|
854
|
-
const boundsHeight = Math.max(selectionBounds.maxY - selectionBounds.minY,
|
|
862
|
+
const boundsWidth = Math.max(selectionBounds.maxX - selectionBounds.minX, chunkNJ3WCYYG_js.MIN_ELEMENT_SIZE);
|
|
863
|
+
const boundsHeight = Math.max(selectionBounds.maxY - selectionBounds.minY, chunkNJ3WCYYG_js.MIN_ELEMENT_SIZE);
|
|
855
864
|
const availableWidth = Math.max(
|
|
856
|
-
effectiveEditorDimensions.width -
|
|
857
|
-
|
|
865
|
+
effectiveEditorDimensions.width - chunkNJ3WCYYG_js.ZOOM_TO_SELECTION_PADDING,
|
|
866
|
+
chunkNJ3WCYYG_js.MIN_ELEMENT_SIZE
|
|
858
867
|
);
|
|
859
868
|
const availableHeight = Math.max(
|
|
860
|
-
effectiveEditorDimensions.height -
|
|
861
|
-
|
|
869
|
+
effectiveEditorDimensions.height - chunkNJ3WCYYG_js.ZOOM_TO_SELECTION_PADDING,
|
|
870
|
+
chunkNJ3WCYYG_js.MIN_ELEMENT_SIZE
|
|
862
871
|
);
|
|
863
872
|
const targetEditorScale = Math.min(
|
|
864
873
|
availableWidth / boundsWidth,
|
|
865
874
|
availableHeight / boundsHeight
|
|
866
875
|
);
|
|
867
876
|
const safeFitScale = fitScale > Number.EPSILON ? fitScale : Number.EPSILON;
|
|
868
|
-
const nextScale =
|
|
877
|
+
const nextScale = chunk4SPZ5IZN_js.clampZoomScale(targetEditorScale / safeFitScale);
|
|
869
878
|
setScale(nextScale);
|
|
870
879
|
window.requestAnimationFrame(() => {
|
|
871
880
|
window.requestAnimationFrame(() => {
|
|
@@ -882,14 +891,14 @@ function useZoomViewport({
|
|
|
882
891
|
]);
|
|
883
892
|
const handleWheel = react.useCallback(
|
|
884
893
|
(event) => {
|
|
885
|
-
const mapped =
|
|
894
|
+
const mapped = chunk4SPZ5IZN_js.mapEditingWheel(event, wheelBufferRef.current, true);
|
|
886
895
|
if (mapped.intent !== "zoom") {
|
|
887
896
|
return;
|
|
888
897
|
}
|
|
889
898
|
event.preventDefault();
|
|
890
899
|
store.dispatch({
|
|
891
900
|
type: "set-zoom",
|
|
892
|
-
zoom:
|
|
901
|
+
zoom: chunk4SPZ5IZN_js.clampZoomScale(store.getState().zoom + mapped.deltaScale)
|
|
893
902
|
});
|
|
894
903
|
},
|
|
895
904
|
[store]
|
|
@@ -984,8 +993,8 @@ function scheduleOpeningAutoPlayGroup(controller, ctx) {
|
|
|
984
993
|
if (!group) {
|
|
985
994
|
return;
|
|
986
995
|
}
|
|
987
|
-
|
|
988
|
-
|
|
996
|
+
chunk4SPZ5IZN_js.playGroup(controller, group, ctx);
|
|
997
|
+
chunk4SPZ5IZN_js.scheduleAutoAdvanceChain(controller, ctx);
|
|
989
998
|
}, firstGroup.autoAdvanceDelayMs ?? 0);
|
|
990
999
|
ctx.timers.push(timer);
|
|
991
1000
|
}
|
|
@@ -1004,7 +1013,7 @@ function scheduleEntranceAnimationTimers(slide, setPresentationAnimations, prese
|
|
|
1004
1013
|
}))
|
|
1005
1014
|
);
|
|
1006
1015
|
entranceAnimations.forEach((animation, animationIndex) => {
|
|
1007
|
-
const delay =
|
|
1016
|
+
const delay = chunk4SPZ5IZN_js.computeEntranceAnimationDelay(animation.delayMs, animationIndex);
|
|
1008
1017
|
const timer = window.setTimeout(() => {
|
|
1009
1018
|
setPresentationAnimations(
|
|
1010
1019
|
(previousAnimations) => previousAnimations.map(
|
|
@@ -1037,7 +1046,7 @@ function useAnimationPlayback(input) {
|
|
|
1037
1046
|
const presentationTimersRef = react.useRef([]);
|
|
1038
1047
|
const controllerRef = react.useRef(null);
|
|
1039
1048
|
const buildRafRef = react.useRef(null);
|
|
1040
|
-
const activeAnimationGroupRef = react.useRef(
|
|
1049
|
+
const activeAnimationGroupRef = react.useRef(chunk4SPZ5IZN_js.createActiveAnimationGroup());
|
|
1041
1050
|
const seededCompletedRef = react.useRef(false);
|
|
1042
1051
|
const mediaTimeNodeElementIdsRef = react.useRef(/* @__PURE__ */ new Map());
|
|
1043
1052
|
const lastSeedCompletedRef = react.useRef(false);
|
|
@@ -1054,15 +1063,15 @@ function useAnimationPlayback(input) {
|
|
|
1054
1063
|
}, [onPlayActionSound]);
|
|
1055
1064
|
react.useEffect(() => {
|
|
1056
1065
|
return () => {
|
|
1057
|
-
|
|
1066
|
+
chunk4SPZ5IZN_js.cancelBuildReveal(buildRafRef);
|
|
1058
1067
|
};
|
|
1059
1068
|
}, []);
|
|
1060
1069
|
const clearPresentationTimers = react.useCallback(() => {
|
|
1061
|
-
|
|
1070
|
+
chunk4SPZ5IZN_js.clearPlaybackTimers(buildPlaybackContext(), activeAnimationGroupRef.current);
|
|
1062
1071
|
}, [buildPlaybackContext]);
|
|
1063
1072
|
const resetSlideTimeline = react.useCallback(
|
|
1064
1073
|
(slideIndex) => {
|
|
1065
|
-
|
|
1074
|
+
chunk4SPZ5IZN_js.cancelBuildReveal(buildRafRef);
|
|
1066
1075
|
const slide = slides[slideIndex];
|
|
1067
1076
|
if (!slide) {
|
|
1068
1077
|
controllerRef.current = null;
|
|
@@ -1073,14 +1082,14 @@ function useAnimationPlayback(input) {
|
|
|
1073
1082
|
setHoverTriggerShapeIds(/* @__PURE__ */ new Set());
|
|
1074
1083
|
return;
|
|
1075
1084
|
}
|
|
1076
|
-
const controller =
|
|
1085
|
+
const controller = chunk4SPZ5IZN_js.PresentationAnimationController.fromSlide(slide, {
|
|
1077
1086
|
slideHeightPx: canvasSize?.height,
|
|
1078
1087
|
slideWidthPx: canvasSize?.width,
|
|
1079
1088
|
themeColorMap,
|
|
1080
1089
|
pixelateMosaic: pixelateMosaicAnimation
|
|
1081
1090
|
});
|
|
1082
1091
|
controllerRef.current = controller;
|
|
1083
|
-
mediaTimeNodeElementIdsRef.current =
|
|
1092
|
+
mediaTimeNodeElementIdsRef.current = chunk4SPZ5IZN_js.resolveMediaTimeNodeElementIds(
|
|
1084
1093
|
slide.nativeAnimations ?? []
|
|
1085
1094
|
);
|
|
1086
1095
|
setPresentationKeyframesCss(controller.keyframesCss);
|
|
@@ -1094,7 +1103,7 @@ function useAnimationPlayback(input) {
|
|
|
1094
1103
|
if (!animationsEnabled) {
|
|
1095
1104
|
return false;
|
|
1096
1105
|
}
|
|
1097
|
-
return
|
|
1106
|
+
return chunk4SPZ5IZN_js.advanceMainSequence(
|
|
1098
1107
|
controllerRef.current,
|
|
1099
1108
|
buildPlaybackContext(),
|
|
1100
1109
|
activeAnimationGroupRef.current
|
|
@@ -1110,7 +1119,7 @@ function useAnimationPlayback(input) {
|
|
|
1110
1119
|
if (!group) {
|
|
1111
1120
|
return false;
|
|
1112
1121
|
}
|
|
1113
|
-
|
|
1122
|
+
chunk4SPZ5IZN_js.playGroup(controller, group, buildPlaybackContext());
|
|
1114
1123
|
return true;
|
|
1115
1124
|
},
|
|
1116
1125
|
[buildPlaybackContext]
|
|
@@ -1129,7 +1138,7 @@ function useAnimationPlayback(input) {
|
|
|
1129
1138
|
if (!group) {
|
|
1130
1139
|
return false;
|
|
1131
1140
|
}
|
|
1132
|
-
|
|
1141
|
+
chunk4SPZ5IZN_js.playGroup(controller, group, buildPlaybackContext());
|
|
1133
1142
|
return true;
|
|
1134
1143
|
},
|
|
1135
1144
|
[animationsEnabled, buildPlaybackContext]
|
|
@@ -1210,12 +1219,12 @@ function useAnimationPlayback(input) {
|
|
|
1210
1219
|
presentationTimersRef
|
|
1211
1220
|
};
|
|
1212
1221
|
}
|
|
1213
|
-
var PRESENTER_CHANNEL_NAME =
|
|
1214
|
-
var AUDIENCE_HASH =
|
|
1215
|
-
var PRESENTER_MSG_ORIGIN =
|
|
1216
|
-
var AUDIENCE_NONCE_KEY =
|
|
1222
|
+
var PRESENTER_CHANNEL_NAME = chunk4SPZ5IZN_js.PRESENTATION_CHANNEL_NAME;
|
|
1223
|
+
var AUDIENCE_HASH = chunk4SPZ5IZN_js.PRESENTATION_HASH;
|
|
1224
|
+
var PRESENTER_MSG_ORIGIN = chunk4SPZ5IZN_js.PRESENTATION_MESSAGE_ORIGIN;
|
|
1225
|
+
var AUDIENCE_NONCE_KEY = chunk4SPZ5IZN_js.PRESENTATION_NONCE_KEY;
|
|
1217
1226
|
function generateSessionId() {
|
|
1218
|
-
return
|
|
1227
|
+
return chunk4SPZ5IZN_js.createPresentationSessionId();
|
|
1219
1228
|
}
|
|
1220
1229
|
function parseAudienceNonce() {
|
|
1221
1230
|
const hash = window.location.hash;
|
|
@@ -1251,7 +1260,7 @@ function usePresenterWindow(input) {
|
|
|
1251
1260
|
}, []);
|
|
1252
1261
|
const swapDisplays = react.useCallback(async () => {
|
|
1253
1262
|
const audience = audienceWindowRef.current;
|
|
1254
|
-
return audience && !audience.closed ?
|
|
1263
|
+
return audience && !audience.closed ? chunk4SPZ5IZN_js.swapPresentationWindows(window, audience) : false;
|
|
1255
1264
|
}, []);
|
|
1256
1265
|
const syncSlideToAudience = react.useCallback(
|
|
1257
1266
|
(slideIndex) => {
|
|
@@ -1315,7 +1324,7 @@ function usePresenterWindow(input) {
|
|
|
1315
1324
|
pollTimerRef.current = null;
|
|
1316
1325
|
}
|
|
1317
1326
|
if (closingSessionId) {
|
|
1318
|
-
void
|
|
1327
|
+
void chunk4SPZ5IZN_js.clearAudienceContent(closingSessionId);
|
|
1319
1328
|
}
|
|
1320
1329
|
}, [getChannel]);
|
|
1321
1330
|
const openAudienceWindow = react.useCallback(() => {
|
|
@@ -1333,10 +1342,10 @@ function usePresenterWindow(input) {
|
|
|
1333
1342
|
audienceWindowRef.current = blankWin;
|
|
1334
1343
|
const sessionId = generateSessionId();
|
|
1335
1344
|
sessionIdRef.current = sessionId;
|
|
1336
|
-
const audienceUrl =
|
|
1337
|
-
void
|
|
1345
|
+
const audienceUrl = chunk4SPZ5IZN_js.buildPresentationAudienceUrl(window.location.href, sessionId);
|
|
1346
|
+
void chunk4SPZ5IZN_js.resolveAudienceScreenPlacement(window).then((placement) => {
|
|
1338
1347
|
if (placement && audienceWindowRef.current === blankWin && !blankWin.closed) {
|
|
1339
|
-
|
|
1348
|
+
chunk4SPZ5IZN_js.placeAudienceWindow(blankWin, placement);
|
|
1340
1349
|
}
|
|
1341
1350
|
return void 0;
|
|
1342
1351
|
});
|
|
@@ -1366,7 +1375,7 @@ function usePresenterWindow(input) {
|
|
|
1366
1375
|
}
|
|
1367
1376
|
};
|
|
1368
1377
|
if (content) {
|
|
1369
|
-
void
|
|
1378
|
+
void chunk4SPZ5IZN_js.storeAudienceContent(content, sessionId).then(() => navigateOrClose(true)).catch(() => navigateOrClose(false));
|
|
1370
1379
|
} else {
|
|
1371
1380
|
navigateOrClose(true);
|
|
1372
1381
|
}
|
|
@@ -1392,7 +1401,7 @@ function usePresenterWindow(input) {
|
|
|
1392
1401
|
}
|
|
1393
1402
|
const handleMessage = (event) => {
|
|
1394
1403
|
const message = event.data;
|
|
1395
|
-
if (
|
|
1404
|
+
if (chunk4SPZ5IZN_js.isPresentationSessionMessage(message) && message.type === "audience-ready" && message.sessionId === sessionIdRef.current) {
|
|
1396
1405
|
syncStateToAudience(snapshotRef.current);
|
|
1397
1406
|
}
|
|
1398
1407
|
};
|
|
@@ -1421,7 +1430,7 @@ function usePresenterWindow(input) {
|
|
|
1421
1430
|
react.useEffect(() => {
|
|
1422
1431
|
const handleBeforeUnload = () => {
|
|
1423
1432
|
if (sessionIdRef.current) {
|
|
1424
|
-
void
|
|
1433
|
+
void chunk4SPZ5IZN_js.clearAudienceContent(sessionIdRef.current);
|
|
1425
1434
|
}
|
|
1426
1435
|
};
|
|
1427
1436
|
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
@@ -1483,7 +1492,7 @@ function useAudienceMode(input) {
|
|
|
1483
1492
|
}
|
|
1484
1493
|
channel.onmessage = (event) => {
|
|
1485
1494
|
const data = event.data;
|
|
1486
|
-
if (!
|
|
1495
|
+
if (!chunk4SPZ5IZN_js.isPresentationSessionMessage(data) || data.origin !== PRESENTER_MSG_ORIGIN) {
|
|
1487
1496
|
return;
|
|
1488
1497
|
}
|
|
1489
1498
|
if (expectedSessionId && data.sessionId !== expectedSessionId) {
|
|
@@ -1499,16 +1508,16 @@ function useAudienceMode(input) {
|
|
|
1499
1508
|
}
|
|
1500
1509
|
if (data.type === "presenter-exit") {
|
|
1501
1510
|
if (expectedSessionId) {
|
|
1502
|
-
void
|
|
1511
|
+
void chunk4SPZ5IZN_js.clearAudienceContent(expectedSessionId);
|
|
1503
1512
|
}
|
|
1504
|
-
if (
|
|
1513
|
+
if (chunk4SPZ5IZN_js.endAudienceDisplay(window)) {
|
|
1505
1514
|
handlers.onPresenterEnded?.();
|
|
1506
1515
|
}
|
|
1507
1516
|
}
|
|
1508
1517
|
};
|
|
1509
1518
|
if (expectedSessionId) {
|
|
1510
1519
|
channel.postMessage({
|
|
1511
|
-
origin:
|
|
1520
|
+
origin: chunk4SPZ5IZN_js.PRESENTATION_MESSAGE_ORIGIN,
|
|
1512
1521
|
type: "audience-ready",
|
|
1513
1522
|
sessionId: expectedSessionId
|
|
1514
1523
|
});
|
|
@@ -1522,7 +1531,7 @@ function useAudienceMode(input) {
|
|
|
1522
1531
|
}, []);
|
|
1523
1532
|
}
|
|
1524
1533
|
function usePresentationKeyboard(input) {
|
|
1525
|
-
const wheelBufferRef = react.useRef(
|
|
1534
|
+
const wheelBufferRef = react.useRef(chunk4SPZ5IZN_js.createWheelStepBuffer());
|
|
1526
1535
|
const {
|
|
1527
1536
|
mode,
|
|
1528
1537
|
movePresentationSlide,
|
|
@@ -1543,14 +1552,14 @@ function usePresentationKeyboard(input) {
|
|
|
1543
1552
|
presentationSlideIndex,
|
|
1544
1553
|
setShowRehearsalSummary
|
|
1545
1554
|
} = input;
|
|
1546
|
-
const keyBufferRef = react.useRef(
|
|
1555
|
+
const keyBufferRef = react.useRef(chunk4SPZ5IZN_js.createPresentationKeyBuffer());
|
|
1547
1556
|
react.useEffect(() => {
|
|
1548
|
-
if (mode !== "present" || !
|
|
1549
|
-
keyBufferRef.current =
|
|
1557
|
+
if (mode !== "present" || !chunk4SPZ5IZN_js.acceptsPresentationInput()) {
|
|
1558
|
+
keyBufferRef.current = chunk4SPZ5IZN_js.createPresentationKeyBuffer();
|
|
1550
1559
|
return;
|
|
1551
1560
|
}
|
|
1552
1561
|
const handleKeyDown = (event) => {
|
|
1553
|
-
const mapped =
|
|
1562
|
+
const mapped = chunk4SPZ5IZN_js.mapPresentationKey(event, keyBufferRef.current);
|
|
1554
1563
|
if (mapped.action === "none") {
|
|
1555
1564
|
return;
|
|
1556
1565
|
}
|
|
@@ -1570,12 +1579,12 @@ function usePresentationKeyboard(input) {
|
|
|
1570
1579
|
movePresentationSlide(-1);
|
|
1571
1580
|
return;
|
|
1572
1581
|
case "first": {
|
|
1573
|
-
const first =
|
|
1582
|
+
const first = chunk4SPZ5IZN_js.firstShowSlideIndex(showSlideIndexes);
|
|
1574
1583
|
navigateToSlide(first ?? 0);
|
|
1575
1584
|
return;
|
|
1576
1585
|
}
|
|
1577
1586
|
case "last": {
|
|
1578
|
-
const last =
|
|
1587
|
+
const last = chunk4SPZ5IZN_js.lastShowSlideIndex(showSlideIndexes);
|
|
1579
1588
|
navigateToSlide(last ?? Math.max(0, slideCount - 1));
|
|
1580
1589
|
return;
|
|
1581
1590
|
}
|
|
@@ -1613,10 +1622,10 @@ function usePresentationKeyboard(input) {
|
|
|
1613
1622
|
}
|
|
1614
1623
|
};
|
|
1615
1624
|
const handleWheel = (event) => {
|
|
1616
|
-
if (mode !== "present" || !
|
|
1625
|
+
if (mode !== "present" || !chunk4SPZ5IZN_js.acceptsPresentationInput()) {
|
|
1617
1626
|
return;
|
|
1618
1627
|
}
|
|
1619
|
-
const mapped =
|
|
1628
|
+
const mapped = chunk4SPZ5IZN_js.mapPresentationWheel(event, wheelBufferRef.current);
|
|
1620
1629
|
if (mapped.intent === "next-slide") {
|
|
1621
1630
|
event.preventDefault();
|
|
1622
1631
|
movePresentationSlide(1);
|
|
@@ -1749,7 +1758,7 @@ function useRehearsalTimings(input) {
|
|
|
1749
1758
|
|
|
1750
1759
|
// src/viewer/hooks/presentation-mode/presentation-actions.ts
|
|
1751
1760
|
function handlePresentationActionImpl(action, deps) {
|
|
1752
|
-
|
|
1761
|
+
chunk4SPZ5IZN_js.runPresentationAction(
|
|
1753
1762
|
action,
|
|
1754
1763
|
{ slideCount: deps.slidesLength, ...deps.elementId ? { elementId: deps.elementId } : {} },
|
|
1755
1764
|
{
|
|
@@ -1778,13 +1787,13 @@ function handlePresentationActionImpl(action, deps) {
|
|
|
1778
1787
|
function executeSlideTransition(nextSlideIndex, deps) {
|
|
1779
1788
|
const incomingSlide = deps.slides[nextSlideIndex];
|
|
1780
1789
|
const transition = deps.reverse ? deps.slides[deps.currentSlideIndex]?.transition : incomingSlide?.transition;
|
|
1781
|
-
const durationMs = deps.playTransition ?
|
|
1790
|
+
const durationMs = deps.playTransition ? chunk4SPZ5IZN_js.resolveTransitionDurationMs(transition) : 0;
|
|
1782
1791
|
deps.clearPresentationTimers();
|
|
1783
1792
|
deps.setPresentationSlideIndex(nextSlideIndex);
|
|
1784
1793
|
deps.onSetActiveSlideIndex(nextSlideIndex);
|
|
1785
1794
|
deps.setPresentationSlideVisible(true);
|
|
1786
1795
|
deps.seedSlideAnimations(nextSlideIndex, { completed: deps.seedCompleted });
|
|
1787
|
-
const soundAction =
|
|
1796
|
+
const soundAction = chunk4SPZ5IZN_js.resolveTransitionSoundAction(transition);
|
|
1788
1797
|
if (soundAction.kind === "play" && deps.onPlayActionSound) {
|
|
1789
1798
|
deps.onPlayActionSound(soundAction.soundPath, { loop: soundAction.loop });
|
|
1790
1799
|
} else if (soundAction.kind === "stop" && deps.onStopActionSound) {
|
|
@@ -1848,7 +1857,7 @@ function useSlideNavigation(input) {
|
|
|
1848
1857
|
});
|
|
1849
1858
|
const scheduleAutoAdvanceForSlide = react.useCallback(
|
|
1850
1859
|
(slideIndex) => {
|
|
1851
|
-
const delayMs =
|
|
1860
|
+
const delayMs = chunk4SPZ5IZN_js.resolveAutoAdvanceDelayMs(slides[slideIndex], { useTimings });
|
|
1852
1861
|
if (delayMs === void 0) {
|
|
1853
1862
|
return;
|
|
1854
1863
|
}
|
|
@@ -1871,7 +1880,7 @@ function useSlideNavigation(input) {
|
|
|
1871
1880
|
if (availableSlideIndexes.length === 0) {
|
|
1872
1881
|
return;
|
|
1873
1882
|
}
|
|
1874
|
-
const pastLastSlide = direction === 1 && !
|
|
1883
|
+
const pastLastSlide = direction === 1 && !chunk4SPZ5IZN_js.hasShowSlideAfter(presentationSlideIndex, availableSlideIndexes);
|
|
1875
1884
|
if (rehearsing && pastLastSlide) {
|
|
1876
1885
|
recordCurrentSlideTime(presentationSlideIndex);
|
|
1877
1886
|
try {
|
|
@@ -1889,9 +1898,9 @@ function useSlideNavigation(input) {
|
|
|
1889
1898
|
onAdvancePastLastSlide();
|
|
1890
1899
|
return;
|
|
1891
1900
|
}
|
|
1892
|
-
const nextSlideIndex = direction === 1 ?
|
|
1901
|
+
const nextSlideIndex = direction === 1 ? chunk4SPZ5IZN_js.nextShowSlideIndex(presentationSlideIndex, availableSlideIndexes, {
|
|
1893
1902
|
loop: Boolean(loopContinuously) && !rehearsing
|
|
1894
|
-
}) :
|
|
1903
|
+
}) : chunk4SPZ5IZN_js.previousShowSlideIndex(presentationSlideIndex, availableSlideIndexes);
|
|
1895
1904
|
if (nextSlideIndex === void 0 || nextSlideIndex === presentationSlideIndex) {
|
|
1896
1905
|
return;
|
|
1897
1906
|
}
|
|
@@ -2072,7 +2081,7 @@ function createCustomShowRunner(deps) {
|
|
|
2072
2081
|
return;
|
|
2073
2082
|
}
|
|
2074
2083
|
origin = returnAfter ? { showId: deps.getActiveCustomShowId(), slideIndex: deps.getPresentationSlideIndex() } : null;
|
|
2075
|
-
const first =
|
|
2084
|
+
const first = chunk4SPZ5IZN_js.firstShowSlideIndex(chunk4SPZ5IZN_js.resolveShowSlideIndexes(deps.getSlides(), target));
|
|
2076
2085
|
deps.setActiveCustomShowId(customShowId);
|
|
2077
2086
|
if (first !== void 0) {
|
|
2078
2087
|
deps.navigateToSlide(first);
|
|
@@ -2150,33 +2159,33 @@ function usePresentationActionExtensions(input) {
|
|
|
2150
2159
|
}
|
|
2151
2160
|
}, [navigateToSlideViaRef]);
|
|
2152
2161
|
const onOpenFile = react.useCallback((target) => {
|
|
2153
|
-
|
|
2162
|
+
chunk4SPZ5IZN_js.safeOpenUrl(target);
|
|
2154
2163
|
}, []);
|
|
2155
2164
|
const onOpenPresentation = react.useCallback((target) => {
|
|
2156
|
-
|
|
2165
|
+
chunk4SPZ5IZN_js.safeOpenUrl(target);
|
|
2157
2166
|
}, []);
|
|
2158
2167
|
const onRunProgram = react.useCallback(
|
|
2159
2168
|
(target) => {
|
|
2160
|
-
onAddRunProgramNotice?.(
|
|
2169
|
+
onAddRunProgramNotice?.(chunk4SPZ5IZN_js.buildRunProgramNotice(target));
|
|
2161
2170
|
},
|
|
2162
2171
|
[onAddRunProgramNotice]
|
|
2163
2172
|
);
|
|
2164
2173
|
const onPlayMedia = react.useCallback(
|
|
2165
2174
|
(elementId) => {
|
|
2166
|
-
|
|
2175
|
+
chunk4SPZ5IZN_js.toggleStageElementMedia(containerRef.current, elementId);
|
|
2167
2176
|
},
|
|
2168
2177
|
[containerRef]
|
|
2169
2178
|
);
|
|
2170
2179
|
const onOleVerb = react.useCallback(
|
|
2171
2180
|
(verb, elementId) => {
|
|
2172
|
-
const target =
|
|
2181
|
+
const target = chunk4SPZ5IZN_js.resolveOleVerbTarget(slides[presentationSlideIndex], elementId, verb);
|
|
2173
2182
|
if (!target) {
|
|
2174
2183
|
return;
|
|
2175
2184
|
}
|
|
2176
2185
|
if (target.action === "download") {
|
|
2177
|
-
|
|
2186
|
+
chunk4SPZ5IZN_js.downloadDataUrl(target.url, target.fileName ?? "download");
|
|
2178
2187
|
} else {
|
|
2179
|
-
|
|
2188
|
+
chunk4SPZ5IZN_js.openUrlInNewTab(target.url);
|
|
2180
2189
|
}
|
|
2181
2190
|
},
|
|
2182
2191
|
[slides, presentationSlideIndex]
|
|
@@ -2207,22 +2216,22 @@ function usePresentationActionExtensions(input) {
|
|
|
2207
2216
|
};
|
|
2208
2217
|
}
|
|
2209
2218
|
function usePresenterConsole(slideIndex, active) {
|
|
2210
|
-
const timerRef = react.useRef(
|
|
2211
|
-
const [snapshot, setSnapshot] = react.useState(() =>
|
|
2219
|
+
const timerRef = react.useRef(chunk4SPZ5IZN_js.createPresenterTimer());
|
|
2220
|
+
const [snapshot, setSnapshot] = react.useState(() => chunk4SPZ5IZN_js.createInitialPresentationSnapshot(slideIndex));
|
|
2212
2221
|
const patch = react.useCallback((value) => {
|
|
2213
|
-
setSnapshot((current) =>
|
|
2222
|
+
setSnapshot((current) => chunk4SPZ5IZN_js.mergePresentationSnapshot(current, value));
|
|
2214
2223
|
}, []);
|
|
2215
2224
|
react.useEffect(() => patch({ slideIndex }), [patch, slideIndex]);
|
|
2216
2225
|
react.useEffect(() => {
|
|
2217
2226
|
if (!active) {
|
|
2218
2227
|
return;
|
|
2219
2228
|
}
|
|
2220
|
-
timerRef.current =
|
|
2229
|
+
timerRef.current = chunk4SPZ5IZN_js.resetPresenterTimer();
|
|
2221
2230
|
patch({ paused: false, elapsedMs: 0 });
|
|
2222
2231
|
const timer = window.setInterval(() => {
|
|
2223
2232
|
patch({
|
|
2224
2233
|
paused: timerRef.current.paused,
|
|
2225
|
-
elapsedMs:
|
|
2234
|
+
elapsedMs: chunk4SPZ5IZN_js.presenterElapsed(timerRef.current)
|
|
2226
2235
|
});
|
|
2227
2236
|
}, 1e3);
|
|
2228
2237
|
return () => window.clearInterval(timer);
|
|
@@ -2232,19 +2241,19 @@ function usePresenterConsole(slideIndex, active) {
|
|
|
2232
2241
|
applyAudienceSnapshot: setSnapshot,
|
|
2233
2242
|
setBlackout: (blackout) => patch({ blackout }),
|
|
2234
2243
|
toggleTimer: () => {
|
|
2235
|
-
timerRef.current =
|
|
2244
|
+
timerRef.current = chunk4SPZ5IZN_js.togglePresenterTimer(timerRef.current);
|
|
2236
2245
|
patch({
|
|
2237
2246
|
paused: timerRef.current.paused,
|
|
2238
|
-
elapsedMs:
|
|
2247
|
+
elapsedMs: chunk4SPZ5IZN_js.presenterElapsed(timerRef.current)
|
|
2239
2248
|
});
|
|
2240
2249
|
},
|
|
2241
2250
|
resetTimer: () => {
|
|
2242
|
-
timerRef.current =
|
|
2251
|
+
timerRef.current = chunk4SPZ5IZN_js.resetPresenterTimer();
|
|
2243
2252
|
patch({ paused: false, elapsedMs: 0 });
|
|
2244
2253
|
},
|
|
2245
2254
|
stepZoom: (direction) => setSnapshot(
|
|
2246
|
-
(current) =>
|
|
2247
|
-
zoom:
|
|
2255
|
+
(current) => chunk4SPZ5IZN_js.mergePresentationSnapshot(current, {
|
|
2256
|
+
zoom: chunk4SPZ5IZN_js.stepPresenterZoom(
|
|
2248
2257
|
current.zoom ?? { scale: 1, originX: 0.5, originY: 0.5 },
|
|
2249
2258
|
direction
|
|
2250
2259
|
)
|
|
@@ -2299,7 +2308,7 @@ function usePresentationMode(input) {
|
|
|
2299
2308
|
const [allSlidesOpen, setAllSlidesOpen] = react.useState(false);
|
|
2300
2309
|
const [endOfShowVisible, setEndOfShowVisible] = react.useState(false);
|
|
2301
2310
|
const [presentationStartTime, setPresentationStartTime] = react.useState(null);
|
|
2302
|
-
const showGuard = react.useMemo(() =>
|
|
2311
|
+
const showGuard = react.useMemo(() => chunk4SPZ5IZN_js.createPresenterShowGuard(), []);
|
|
2303
2312
|
const {
|
|
2304
2313
|
presentationAnimations,
|
|
2305
2314
|
presentationElementStates,
|
|
@@ -2399,7 +2408,7 @@ function usePresentationMode(input) {
|
|
|
2399
2408
|
actionExtensions.bindNavigateToSlide(navigateToSlide);
|
|
2400
2409
|
const movePresentationSlide = react.useCallback(
|
|
2401
2410
|
(direction, trigger = "explicit") => {
|
|
2402
|
-
if (!
|
|
2411
|
+
if (!chunk4SPZ5IZN_js.acceptsPresentationInput()) {
|
|
2403
2412
|
return;
|
|
2404
2413
|
}
|
|
2405
2414
|
if (endOfShowVisible) {
|
|
@@ -2468,7 +2477,7 @@ function usePresentationMode(input) {
|
|
|
2468
2477
|
onSetMode("present");
|
|
2469
2478
|
}, [containerRef, onSetMode, setRehearsing]);
|
|
2470
2479
|
const enterPresentModeFromBeginning = react.useCallback(() => {
|
|
2471
|
-
const first =
|
|
2480
|
+
const first = chunk4SPZ5IZN_js.firstShowSlideIndex(visibleSlideIndexes);
|
|
2472
2481
|
if (first !== void 0) {
|
|
2473
2482
|
onSetActiveSlideIndex(first);
|
|
2474
2483
|
}
|
|
@@ -2548,7 +2557,7 @@ function usePresentationMode(input) {
|
|
|
2548
2557
|
if (mode !== "present") {
|
|
2549
2558
|
return;
|
|
2550
2559
|
}
|
|
2551
|
-
return
|
|
2560
|
+
return chunk4SPZ5IZN_js.attachPresentationVisibilityPause({
|
|
2552
2561
|
root: containerRef.current ?? void 0,
|
|
2553
2562
|
onHidden: () => clearPresentationTimersRef.current(),
|
|
2554
2563
|
onVisible: () => scheduleAutoAdvanceRef.current(presentationSlideIndexRef.current)
|
|
@@ -2556,7 +2565,7 @@ function usePresentationMode(input) {
|
|
|
2556
2565
|
}, [mode, containerRef]);
|
|
2557
2566
|
react.useLayoutEffect(() => {
|
|
2558
2567
|
if (mode === "present") {
|
|
2559
|
-
const idx =
|
|
2568
|
+
const idx = chunk4SPZ5IZN_js.presentationEntrySlideIndex(
|
|
2560
2569
|
activeSlideIndexRef.current,
|
|
2561
2570
|
visibleSlideIndexesRef.current
|
|
2562
2571
|
);
|
|
@@ -2635,11 +2644,11 @@ function usePresentationMode(input) {
|
|
|
2635
2644
|
return void 0;
|
|
2636
2645
|
}
|
|
2637
2646
|
const incoming = slides[transitionOverlay.incomingSlideIndex];
|
|
2638
|
-
return
|
|
2647
|
+
return chunk4SPZ5IZN_js.buildMorphTransitionPlan(
|
|
2639
2648
|
slides[transitionOverlay.outgoingSlideIndex],
|
|
2640
2649
|
incoming,
|
|
2641
2650
|
transitionOverlay.durationMs,
|
|
2642
|
-
|
|
2651
|
+
chunk4SPZ5IZN_js.morphOptionToMode(transitionOverlay.transition.morphOption),
|
|
2643
2652
|
// `PresentationStage` stacks the incoming slide's elements above its
|
|
2644
2653
|
// template shapes (`zIndex = templateElements.length + index`), so a
|
|
2645
2654
|
// z-index journey has to start counting where the stage does.
|
|
@@ -2664,7 +2673,7 @@ function usePresentationMode(input) {
|
|
|
2664
2673
|
if (!morphPlan) {
|
|
2665
2674
|
return presentationKeyframesCss;
|
|
2666
2675
|
}
|
|
2667
|
-
const imageRules =
|
|
2676
|
+
const imageRules = chunk4SPZ5IZN_js.buildMorphAnimationRules(morphPlan, "", "incoming", "image");
|
|
2668
2677
|
return `${presentationKeyframesCss ?? ""}
|
|
2669
2678
|
${morphPlan.keyframesCss}
|
|
2670
2679
|
${imageRules}`;
|
|
@@ -2961,7 +2970,7 @@ function useFindReplace({
|
|
|
2961
2970
|
const [findResults, setFindResults] = react.useState([]);
|
|
2962
2971
|
const [findResultIndex, setFindResultIndex] = react.useState(-1);
|
|
2963
2972
|
const performFind = react.useCallback(() => {
|
|
2964
|
-
const results =
|
|
2973
|
+
const results = chunk4SPZ5IZN_js.findInSlides(slides, findQuery, { matchCase: findMatchCase });
|
|
2965
2974
|
if (!findQuery) {
|
|
2966
2975
|
setFindResults([]);
|
|
2967
2976
|
setFindResultIndex(-1);
|
|
@@ -2995,7 +3004,7 @@ function useFindReplace({
|
|
|
2995
3004
|
return;
|
|
2996
3005
|
}
|
|
2997
3006
|
onUpdateSlides(
|
|
2998
|
-
(prevSlides) =>
|
|
3007
|
+
(prevSlides) => chunk4SPZ5IZN_js.applyFindReplacements(prevSlides, toReplace, replaceQuery).slides
|
|
2999
3008
|
);
|
|
3000
3009
|
onMarkDirty();
|
|
3001
3010
|
},
|
|
@@ -3017,9 +3026,9 @@ function useFindReplace({
|
|
|
3017
3026
|
}, [findResults, applyReplacements, performFind]);
|
|
3018
3027
|
react.useEffect(() => {
|
|
3019
3028
|
const handler = (event) => {
|
|
3020
|
-
const { action } =
|
|
3029
|
+
const { action } = chunk4SPZ5IZN_js.mapEditorKey(event, {
|
|
3021
3030
|
canEdit: mode === "edit",
|
|
3022
|
-
isTextInputTarget:
|
|
3031
|
+
isTextInputTarget: chunk4SPZ5IZN_js.isEditorTextInputTarget(event.target)
|
|
3023
3032
|
});
|
|
3024
3033
|
if (action !== "find") {
|
|
3025
3034
|
return;
|
|
@@ -3130,7 +3139,7 @@ function addCommentToSlide(slides, slideIndex, text, authorName, elementId, ment
|
|
|
3130
3139
|
if (!slide) {
|
|
3131
3140
|
return { slides, didAdd: false };
|
|
3132
3141
|
}
|
|
3133
|
-
const next =
|
|
3142
|
+
const next = chunk4SPZ5IZN_js.addCommentToList(
|
|
3134
3143
|
slide.comments || [],
|
|
3135
3144
|
text,
|
|
3136
3145
|
authorName,
|
|
@@ -3151,7 +3160,7 @@ function removeCommentFromSlide(slides, slideIndex, commentId) {
|
|
|
3151
3160
|
if (!slide) {
|
|
3152
3161
|
return { slides, didDelete: false };
|
|
3153
3162
|
}
|
|
3154
|
-
const next =
|
|
3163
|
+
const next = chunk4SPZ5IZN_js.removeCommentFromList(slide.comments || [], commentId);
|
|
3155
3164
|
if (!next) {
|
|
3156
3165
|
return { slides, didDelete: false };
|
|
3157
3166
|
}
|
|
@@ -3162,7 +3171,7 @@ function editCommentInSlide(slides, slideIndex, commentId, newText) {
|
|
|
3162
3171
|
if (!slide) {
|
|
3163
3172
|
return { slides, didUpdate: false };
|
|
3164
3173
|
}
|
|
3165
|
-
const next =
|
|
3174
|
+
const next = chunk4SPZ5IZN_js.editCommentInList(slide.comments || [], commentId, newText);
|
|
3166
3175
|
if (!next) {
|
|
3167
3176
|
return { slides, didUpdate: false };
|
|
3168
3177
|
}
|
|
@@ -3173,7 +3182,7 @@ function toggleResolvedInSlide(slides, slideIndex, commentId) {
|
|
|
3173
3182
|
if (!slide) {
|
|
3174
3183
|
return { slides, didUpdate: false };
|
|
3175
3184
|
}
|
|
3176
|
-
const next =
|
|
3185
|
+
const next = chunk4SPZ5IZN_js.toggleCommentResolvedInList(slide.comments || [], commentId);
|
|
3177
3186
|
if (!next) {
|
|
3178
3187
|
return { slides, didUpdate: false };
|
|
3179
3188
|
}
|
|
@@ -3184,7 +3193,7 @@ function addReplyToSlide(slides, slideIndex, parentId, text, authorName, mention
|
|
|
3184
3193
|
if (!slide) {
|
|
3185
3194
|
return { slides, didAdd: false };
|
|
3186
3195
|
}
|
|
3187
|
-
const next =
|
|
3196
|
+
const next = chunk4SPZ5IZN_js.replyToCommentInList(slide.comments || [], parentId, text, authorName);
|
|
3188
3197
|
if (!next) {
|
|
3189
3198
|
return { slides, didAdd: false };
|
|
3190
3199
|
}
|
|
@@ -3571,7 +3580,7 @@ function useDerivedElementState(input) {
|
|
|
3571
3580
|
return [];
|
|
3572
3581
|
}
|
|
3573
3582
|
return [
|
|
3574
|
-
...
|
|
3583
|
+
...chunk4SPZ5IZN_js.visibleTemplateElements(activeSlide, templateElementsBySlideId[activeSlide.id] ?? [])
|
|
3575
3584
|
];
|
|
3576
3585
|
}, [activeSlide, templateElementsBySlideId]);
|
|
3577
3586
|
const activeMaster = slideMasters[activeMasterIndex];
|
|
@@ -3638,7 +3647,7 @@ function useViewerCoreState(_input) {
|
|
|
3638
3647
|
const marqueeStateRef = react.useRef(null);
|
|
3639
3648
|
const isDrawingRef = react.useRef(false);
|
|
3640
3649
|
const justInteractedRef = react.useRef(false);
|
|
3641
|
-
const livePatcher = react.useMemo(() =>
|
|
3650
|
+
const livePatcher = react.useMemo(() => chunk4SPZ5IZN_js.createCollaborationLivePatcher(), []);
|
|
3642
3651
|
react.useEffect(() => () => livePatcher.dispose(), [livePatcher]);
|
|
3643
3652
|
const slidesRef = react.useRef([]);
|
|
3644
3653
|
const [mode, setMode] = react.useState("edit");
|
|
@@ -3647,8 +3656,8 @@ function useViewerCoreState(_input) {
|
|
|
3647
3656
|
const [slides, setSlides] = react.useState([]);
|
|
3648
3657
|
const [templateElementsBySlideId, setTemplateElementsBySlideId] = react.useState({});
|
|
3649
3658
|
const [canvasSize, setCanvasSize] = react.useState({
|
|
3650
|
-
width:
|
|
3651
|
-
height:
|
|
3659
|
+
width: chunkNJ3WCYYG_js.DEFAULT_CANVAS_WIDTH,
|
|
3660
|
+
height: chunkNJ3WCYYG_js.DEFAULT_CANVAS_HEIGHT
|
|
3652
3661
|
});
|
|
3653
3662
|
const [slideSizeEmu, setSlideSizeEmu] = react.useState();
|
|
3654
3663
|
const [activeSlideIndex, setActiveSlideIndex] = react.useState(0);
|
|
@@ -3669,7 +3678,7 @@ function useViewerCoreState(_input) {
|
|
|
3669
3678
|
const resolved = typeof value === "function" ? value(inlineEditingTextRef.current) : value;
|
|
3670
3679
|
inlineEditingTextRef.current = resolved;
|
|
3671
3680
|
setInlineEditingTextBase(value);
|
|
3672
|
-
|
|
3681
|
+
chunk4SPZ5IZN_js.publishLiveInlineText(
|
|
3673
3682
|
livePatcher,
|
|
3674
3683
|
slidesRef.current[activeSlideIndexRef.current],
|
|
3675
3684
|
inlineEditingElementIdRef.current,
|
|
@@ -3964,8 +3973,8 @@ function useViewerState(input) {
|
|
|
3964
3973
|
}
|
|
3965
3974
|
|
|
3966
3975
|
// src/viewer/utils/glyph-outline-cache.ts
|
|
3967
|
-
var glyphOutlineFontCache = new
|
|
3968
|
-
var getGlyphOutline =
|
|
3976
|
+
var glyphOutlineFontCache = new chunk4SPZ5IZN_js.GlyphOutlineFontCache();
|
|
3977
|
+
var getGlyphOutline = chunk4SPZ5IZN_js.createGlyphOutlineLookup(glyphOutlineFontCache);
|
|
3969
3978
|
|
|
3970
3979
|
// src/viewer/hooks/useLoadContent.ts
|
|
3971
3980
|
function useLoadContent({
|
|
@@ -4024,8 +4033,8 @@ function useLoadContent({
|
|
|
4024
4033
|
}
|
|
4025
4034
|
let cancelled = false;
|
|
4026
4035
|
const token = ++renderTokenRef.current;
|
|
4027
|
-
const handler = new
|
|
4028
|
-
const resources =
|
|
4036
|
+
const handler = new chunk4SPZ5IZN_js.PptxHandler();
|
|
4037
|
+
const resources = chunk4SPZ5IZN_js.createPresentationLoadResources(handler);
|
|
4029
4038
|
const loadBlobUrls = resources.blobUrls;
|
|
4030
4039
|
(async () => {
|
|
4031
4040
|
try {
|
|
@@ -4046,12 +4055,12 @@ function useLoadContent({
|
|
|
4046
4055
|
}
|
|
4047
4056
|
const mediaElements = [];
|
|
4048
4057
|
for (const slide of parsed.slides) {
|
|
4049
|
-
|
|
4058
|
+
chunk4SPZ5IZN_js.collectMediaElements(slide.elements, mediaElements);
|
|
4050
4059
|
}
|
|
4051
4060
|
const nextMediaUrls = /* @__PURE__ */ new Map();
|
|
4052
4061
|
await Promise.all(
|
|
4053
4062
|
mediaElements.map(async (mediaElement) => {
|
|
4054
|
-
const resolved = await
|
|
4063
|
+
const resolved = await chunk4SPZ5IZN_js.resolveMediaElementSource(mediaElement, handler);
|
|
4055
4064
|
if (resolved.missing || !resolved.mediaPath || !resolved.url) {
|
|
4056
4065
|
mediaElement.mediaMissing = true;
|
|
4057
4066
|
return;
|
|
@@ -4062,7 +4071,7 @@ function useLoadContent({
|
|
|
4062
4071
|
}
|
|
4063
4072
|
})
|
|
4064
4073
|
);
|
|
4065
|
-
const { paths: imagePaths, refs: imageRefs } =
|
|
4074
|
+
const { paths: imagePaths, refs: imageRefs } = chunk4SPZ5IZN_js.collectImagePaths(parsed.slides);
|
|
4066
4075
|
let nextSlides = parsed.slides;
|
|
4067
4076
|
if (imagePaths.size > 0) {
|
|
4068
4077
|
const resolvedMap = /* @__PURE__ */ new Map();
|
|
@@ -4078,15 +4087,15 @@ function useLoadContent({
|
|
|
4078
4087
|
})
|
|
4079
4088
|
);
|
|
4080
4089
|
nextSlides = parsed.slides.map((s) => {
|
|
4081
|
-
const newElements =
|
|
4090
|
+
const newElements = chunk4SPZ5IZN_js.applyImagePathPatches(s.elements, resolvedMap, imageRefs);
|
|
4082
4091
|
return newElements === s.elements ? s : { ...s, elements: newElements };
|
|
4083
4092
|
});
|
|
4084
4093
|
}
|
|
4085
|
-
nextSlides = await
|
|
4094
|
+
nextSlides = await chunk4SPZ5IZN_js.resolveTableCellImageUrls(
|
|
4086
4095
|
nextSlides,
|
|
4087
4096
|
(path) => handler.getImageData(path)
|
|
4088
4097
|
);
|
|
4089
|
-
const nextTableStyleMap = await
|
|
4098
|
+
const nextTableStyleMap = await chunk4SPZ5IZN_js.resolveTableStyleImageUrls(
|
|
4090
4099
|
parsed.tableStyleMap,
|
|
4091
4100
|
(path) => handler.getImageData(path)
|
|
4092
4101
|
);
|
|
@@ -4105,12 +4114,12 @@ function useLoadContent({
|
|
|
4105
4114
|
}
|
|
4106
4115
|
resources.commit();
|
|
4107
4116
|
handlerRef.current = handler;
|
|
4108
|
-
const partition =
|
|
4117
|
+
const partition = chunk4SPZ5IZN_js.partitionTemplateElements(nextSlides);
|
|
4109
4118
|
setSlides(partition.slides);
|
|
4110
4119
|
setTemplateElementsBySlideId(partition.templateElementsBySlideId);
|
|
4111
4120
|
setCanvasSize({
|
|
4112
|
-
width: parsed.width ??
|
|
4113
|
-
height: parsed.height ??
|
|
4121
|
+
width: parsed.width ?? chunkNJ3WCYYG_js.DEFAULT_CANVAS_WIDTH,
|
|
4122
|
+
height: parsed.height ?? chunkNJ3WCYYG_js.DEFAULT_CANVAS_HEIGHT
|
|
4114
4123
|
});
|
|
4115
4124
|
setSlideSizeEmu(
|
|
4116
4125
|
typeof parsed.widthEmu === "number" && typeof parsed.heightEmu === "number" && parsed.widthEmu > 0 && parsed.heightEmu > 0 ? {
|
|
@@ -4123,7 +4132,7 @@ function useLoadContent({
|
|
|
4123
4132
|
setLayoutOptions(parsed.layoutOptions ?? []);
|
|
4124
4133
|
setSlideMasters(parsed.slideMasters ?? []);
|
|
4125
4134
|
setModernCommentAuthors(parsed.modernCommentAuthors ?? []);
|
|
4126
|
-
setRecentColors(
|
|
4135
|
+
setRecentColors(chunk4SPZ5IZN_js.seedRecentColors({ mruColors: parsed.mruColors }));
|
|
4127
4136
|
setTheme(parsed.theme);
|
|
4128
4137
|
setTableStyleMap(nextTableStyleMap);
|
|
4129
4138
|
setTableStylesDefaultId(parsed.tableStylesDefaultId);
|
|
@@ -4131,7 +4140,7 @@ function useLoadContent({
|
|
|
4131
4140
|
setThemeOptions(parsed.themeOptions ?? []);
|
|
4132
4141
|
setCustomShows(parsed.customShows ?? []);
|
|
4133
4142
|
setActiveCustomShowId(
|
|
4134
|
-
|
|
4143
|
+
chunk4SPZ5IZN_js.resolveAuthoredCustomShowId(parsed.presentationProperties, parsed.customShows) ?? null
|
|
4135
4144
|
);
|
|
4136
4145
|
setSections(parsed.sections ?? []);
|
|
4137
4146
|
setPresentationProperties(parsed.presentationProperties ?? {});
|
|
@@ -4155,11 +4164,11 @@ function useLoadContent({
|
|
|
4155
4164
|
setHasMacros(parsed.hasMacros === true);
|
|
4156
4165
|
setHasDigitalSignatures(parsed.hasDigitalSignatures === true);
|
|
4157
4166
|
setDigitalSignatureCount(parsed.digitalSignatureCount ?? 0);
|
|
4158
|
-
setGuides(
|
|
4159
|
-
setReadOnlyRecommendation(
|
|
4167
|
+
setGuides(chunk4SPZ5IZN_js.buildInitialGuides(parsed.presentationGuides, parsed.slides[0]?.guides));
|
|
4168
|
+
setReadOnlyRecommendation(chunk4SPZ5IZN_js.readOnlyRecommendation(parsed));
|
|
4160
4169
|
setModifyVerifier(parsed.modifyVerifier ?? void 0);
|
|
4161
4170
|
setCompatToasts(
|
|
4162
|
-
|
|
4171
|
+
chunk4SPZ5IZN_js.compatibilityWarningToasts([
|
|
4163
4172
|
...parsed.warnings ?? [],
|
|
4164
4173
|
...parsed.slides.flatMap((slide) => slide.warnings ?? [])
|
|
4165
4174
|
])
|
|
@@ -4171,7 +4180,7 @@ function useLoadContent({
|
|
|
4171
4180
|
onContentApplied?.();
|
|
4172
4181
|
} catch (err) {
|
|
4173
4182
|
if (!cancelled && token === renderTokenRef.current) {
|
|
4174
|
-
if (err instanceof
|
|
4183
|
+
if (err instanceof chunk4SPZ5IZN_js.EncryptedFileError) {
|
|
4175
4184
|
setIsEncrypted(true);
|
|
4176
4185
|
} else {
|
|
4177
4186
|
console.error("[pptx] Failed to load presentation content:", err);
|
|
@@ -4200,7 +4209,7 @@ function useLoadContent({
|
|
|
4200
4209
|
}
|
|
4201
4210
|
function useAutosave(input) {
|
|
4202
4211
|
const { isDirty, filePath, serializeSlides, enabled = true, getChangeSources } = input;
|
|
4203
|
-
const intervalMs =
|
|
4212
|
+
const intervalMs = chunk4SPZ5IZN_js.resolveAutosaveIntervalMs({
|
|
4204
4213
|
hostIntervalMs: input.intervalMs,
|
|
4205
4214
|
optionsIntervalSeconds: input.intervalSeconds
|
|
4206
4215
|
});
|
|
@@ -4231,7 +4240,7 @@ function useAutosave(input) {
|
|
|
4231
4240
|
return;
|
|
4232
4241
|
}
|
|
4233
4242
|
const sources = changeSourcesRef.current?.() ?? [];
|
|
4234
|
-
if (!
|
|
4243
|
+
if (!chunk4SPZ5IZN_js.shouldWriteAutosaveSnapshot({
|
|
4235
4244
|
filePath: path,
|
|
4236
4245
|
isDirty: isDirtyRef.current,
|
|
4237
4246
|
saving: isSavingRef.current,
|
|
@@ -4249,8 +4258,8 @@ function useAutosave(input) {
|
|
|
4249
4258
|
isSavingRef.current = false;
|
|
4250
4259
|
return;
|
|
4251
4260
|
}
|
|
4252
|
-
await
|
|
4253
|
-
lastSnapshotRef.current =
|
|
4261
|
+
await chunk4SPZ5IZN_js.saveAutosaveSnapshot(path, data);
|
|
4262
|
+
lastSnapshotRef.current = chunk4SPZ5IZN_js.autosaveSnapshotMark(path, sources);
|
|
4254
4263
|
setAutosaveStatus({ state: "saved", timestamp: Date.now() });
|
|
4255
4264
|
} catch (err) {
|
|
4256
4265
|
setAutosaveStatus({
|
|
@@ -4304,13 +4313,13 @@ function useElementOperations(input) {
|
|
|
4304
4313
|
inlineEditingText
|
|
4305
4314
|
} = input;
|
|
4306
4315
|
const liveTextSegments = react.useCallback(() => {
|
|
4307
|
-
if (!selectedElement || !
|
|
4316
|
+
if (!selectedElement || !chunk4SPZ5IZN_js.hasTextProperties(selectedElement)) {
|
|
4308
4317
|
return void 0;
|
|
4309
4318
|
}
|
|
4310
4319
|
if (selectedElement.id !== inlineEditingElementId) {
|
|
4311
4320
|
return selectedElement.textSegments;
|
|
4312
4321
|
}
|
|
4313
|
-
return
|
|
4322
|
+
return chunk4SPZ5IZN_js.remapTextToSegments(
|
|
4314
4323
|
inlineEditingText,
|
|
4315
4324
|
selectedElement.textSegments,
|
|
4316
4325
|
selectedElement.textStyle
|
|
@@ -4351,11 +4360,11 @@ function useElementOperations(input) {
|
|
|
4351
4360
|
(elementId, updates) => {
|
|
4352
4361
|
if (masterView?.target) {
|
|
4353
4362
|
applyMasterViewWrite(
|
|
4354
|
-
|
|
4363
|
+
chunk4SPZ5IZN_js.updateMasterViewElement(masterView, masterView.target, elementId, updates)
|
|
4355
4364
|
);
|
|
4356
4365
|
return;
|
|
4357
4366
|
}
|
|
4358
|
-
if (
|
|
4367
|
+
if (chunk4SPZ5IZN_js.isTemplateElementId(elementId)) {
|
|
4359
4368
|
const slideId = activeSlide?.id;
|
|
4360
4369
|
if (slideId) {
|
|
4361
4370
|
setTemplateElementsBySlideId((prev) => ({
|
|
@@ -4366,7 +4375,7 @@ function useElementOperations(input) {
|
|
|
4366
4375
|
}));
|
|
4367
4376
|
}
|
|
4368
4377
|
} else {
|
|
4369
|
-
setSlides((prev) =>
|
|
4378
|
+
setSlides((prev) => chunk4SPZ5IZN_js.updateElement(prev, activeSlideIndex, elementId, updates));
|
|
4370
4379
|
}
|
|
4371
4380
|
history.markDirty();
|
|
4372
4381
|
},
|
|
@@ -4391,7 +4400,7 @@ function useElementOperations(input) {
|
|
|
4391
4400
|
);
|
|
4392
4401
|
const updateSelectedShapeStyle = react.useCallback(
|
|
4393
4402
|
(updates) => {
|
|
4394
|
-
if (!selectedElement || !
|
|
4403
|
+
if (!selectedElement || !chunk4SPZ5IZN_js.hasShapeProperties(selectedElement)) {
|
|
4395
4404
|
return;
|
|
4396
4405
|
}
|
|
4397
4406
|
updateSelectedElement({
|
|
@@ -4402,19 +4411,32 @@ function useElementOperations(input) {
|
|
|
4402
4411
|
);
|
|
4403
4412
|
const updateSelectedTextStyle = react.useCallback(
|
|
4404
4413
|
(updates) => {
|
|
4405
|
-
if (!selectedElement || !
|
|
4414
|
+
if (!selectedElement || !chunk4SPZ5IZN_js.hasTextProperties(selectedElement)) {
|
|
4406
4415
|
return;
|
|
4407
4416
|
}
|
|
4408
4417
|
const isLiveEditing = selectedElement.id === inlineEditingElementId;
|
|
4409
4418
|
const currentSegments = liveTextSegments();
|
|
4410
|
-
const inlineSel =
|
|
4419
|
+
const inlineSel = chunk4SPZ5IZN_js.getInlineEditorSelection(currentSegments);
|
|
4420
|
+
if (updates.listType) {
|
|
4421
|
+
const result = chunk4SPZ5IZN_js.applyListStyleUpdate(
|
|
4422
|
+
{ ...selectedElement, textSegments: currentSegments },
|
|
4423
|
+
updates,
|
|
4424
|
+
inlineSel
|
|
4425
|
+
);
|
|
4426
|
+
chunk4SPZ5IZN_js.setPendingSelectionRestore(result.selection);
|
|
4427
|
+
updateSelectedElement({
|
|
4428
|
+
...result.patch,
|
|
4429
|
+
...isLiveEditing ? { text: inlineEditingText } : {}
|
|
4430
|
+
});
|
|
4431
|
+
return;
|
|
4432
|
+
}
|
|
4411
4433
|
if (inlineSel && currentSegments) {
|
|
4412
|
-
const { newSegments: newSegments2, newSelection } =
|
|
4434
|
+
const { newSegments: newSegments2, newSelection } = chunk4SPZ5IZN_js.applyStyleToSelectedSegments(
|
|
4413
4435
|
currentSegments,
|
|
4414
4436
|
inlineSel,
|
|
4415
4437
|
updates
|
|
4416
4438
|
);
|
|
4417
|
-
|
|
4439
|
+
chunk4SPZ5IZN_js.setPendingSelectionRestore(newSelection);
|
|
4418
4440
|
updateSelectedElement({
|
|
4419
4441
|
textSegments: newSegments2,
|
|
4420
4442
|
...isLiveEditing ? { text: inlineEditingText } : {}
|
|
@@ -4422,10 +4444,7 @@ function useElementOperations(input) {
|
|
|
4422
4444
|
return;
|
|
4423
4445
|
}
|
|
4424
4446
|
const newTextStyle = { ...selectedElement.textStyle, ...updates };
|
|
4425
|
-
const newSegments = currentSegments?.map((seg) => (
|
|
4426
|
-
...seg,
|
|
4427
|
-
style: { ...seg.style, ...updates }
|
|
4428
|
-
}));
|
|
4447
|
+
const newSegments = currentSegments?.map((seg) => chunk4SPZ5IZN_js.updateTextSegmentStyle(seg, updates));
|
|
4429
4448
|
updateSelectedElement({
|
|
4430
4449
|
textStyle: newTextStyle,
|
|
4431
4450
|
textSegments: newSegments,
|
|
@@ -4442,14 +4461,14 @@ function useElementOperations(input) {
|
|
|
4442
4461
|
);
|
|
4443
4462
|
const updateSelectedTextCase = react.useCallback(
|
|
4444
4463
|
(mode) => {
|
|
4445
|
-
if (!selectedElement || !
|
|
4464
|
+
if (!selectedElement || !chunk4SPZ5IZN_js.hasTextProperties(selectedElement)) {
|
|
4446
4465
|
return;
|
|
4447
4466
|
}
|
|
4448
4467
|
const isLiveEditing = selectedElement.id === inlineEditingElementId;
|
|
4449
4468
|
const currentSegments = liveTextSegments();
|
|
4450
|
-
const inlineSel =
|
|
4469
|
+
const inlineSel = chunk4SPZ5IZN_js.getInlineEditorSelection(currentSegments);
|
|
4451
4470
|
if (inlineSel && currentSegments) {
|
|
4452
|
-
const newSegments =
|
|
4471
|
+
const newSegments = chunk4SPZ5IZN_js.applyCaseTransformToSegments(currentSegments, inlineSel, mode);
|
|
4453
4472
|
updateSelectedElement({
|
|
4454
4473
|
textSegments: newSegments,
|
|
4455
4474
|
...isLiveEditing ? { text: inlineEditingText } : {}
|
|
@@ -4458,7 +4477,7 @@ function useElementOperations(input) {
|
|
|
4458
4477
|
}
|
|
4459
4478
|
const updates = {};
|
|
4460
4479
|
if (currentSegments && currentSegments.length > 0) {
|
|
4461
|
-
updates.textSegments =
|
|
4480
|
+
updates.textSegments = chunk4SPZ5IZN_js.applyCaseTransformToSegments(
|
|
4462
4481
|
currentSegments,
|
|
4463
4482
|
null,
|
|
4464
4483
|
mode
|
|
@@ -4466,7 +4485,7 @@ function useElementOperations(input) {
|
|
|
4466
4485
|
}
|
|
4467
4486
|
const baseText = isLiveEditing ? inlineEditingText : selectedElement.text;
|
|
4468
4487
|
if (typeof baseText === "string") {
|
|
4469
|
-
updates.text =
|
|
4488
|
+
updates.text = chunk4SPZ5IZN_js.transformTextCase(baseText, mode);
|
|
4470
4489
|
}
|
|
4471
4490
|
updateSelectedElement(updates);
|
|
4472
4491
|
},
|
|
@@ -4485,15 +4504,15 @@ function useElementOperations(input) {
|
|
|
4485
4504
|
[setSlides]
|
|
4486
4505
|
);
|
|
4487
4506
|
const masterViewTarget = masterView?.target ?? null;
|
|
4488
|
-
const activeElements = masterViewTarget ?
|
|
4507
|
+
const activeElements = masterViewTarget ? chunk4SPZ5IZN_js.masterViewElements(masterView, masterViewTarget) : editTemplateMode ? templateElements : activeSlide?.elements ?? [];
|
|
4489
4508
|
const updateActiveElements = react.useCallback(
|
|
4490
4509
|
(updater) => {
|
|
4491
4510
|
if (masterView?.target) {
|
|
4492
4511
|
applyMasterViewWrite(
|
|
4493
|
-
|
|
4512
|
+
chunk4SPZ5IZN_js.replaceMasterViewElements(
|
|
4494
4513
|
masterView,
|
|
4495
4514
|
masterView.target,
|
|
4496
|
-
updater(
|
|
4515
|
+
updater(chunk4SPZ5IZN_js.masterViewElements(masterView, masterView.target))
|
|
4497
4516
|
)
|
|
4498
4517
|
);
|
|
4499
4518
|
return;
|
|
@@ -4546,7 +4565,7 @@ function useSectionOperations(input) {
|
|
|
4546
4565
|
const { sections, setSections, slides, setSlides, markDirty } = input;
|
|
4547
4566
|
const addSection2 = react.useCallback(
|
|
4548
4567
|
(name, afterSlideIndex) => {
|
|
4549
|
-
const result =
|
|
4568
|
+
const result = chunk4SPZ5IZN_js.addSection(sections, slides, name, afterSlideIndex);
|
|
4550
4569
|
setSlides(result.slides);
|
|
4551
4570
|
setSections(result.sections);
|
|
4552
4571
|
markDirty();
|
|
@@ -4555,7 +4574,7 @@ function useSectionOperations(input) {
|
|
|
4555
4574
|
);
|
|
4556
4575
|
const renameSection2 = react.useCallback(
|
|
4557
4576
|
(sectionId, newName) => {
|
|
4558
|
-
const result =
|
|
4577
|
+
const result = chunk4SPZ5IZN_js.renameSection(sections, slides, sectionId, newName);
|
|
4559
4578
|
setSections(result.sections);
|
|
4560
4579
|
setSlides(result.slides);
|
|
4561
4580
|
markDirty();
|
|
@@ -4564,7 +4583,7 @@ function useSectionOperations(input) {
|
|
|
4564
4583
|
);
|
|
4565
4584
|
const deleteSection2 = react.useCallback(
|
|
4566
4585
|
(sectionId) => {
|
|
4567
|
-
const result =
|
|
4586
|
+
const result = chunk4SPZ5IZN_js.deleteSection(sections, slides, sectionId);
|
|
4568
4587
|
setSections(result.sections);
|
|
4569
4588
|
setSlides(result.slides);
|
|
4570
4589
|
markDirty();
|
|
@@ -4573,21 +4592,21 @@ function useSectionOperations(input) {
|
|
|
4573
4592
|
);
|
|
4574
4593
|
const moveSectionUp2 = react.useCallback(
|
|
4575
4594
|
(sectionId) => {
|
|
4576
|
-
setSections(
|
|
4595
|
+
setSections(chunk4SPZ5IZN_js.moveSectionUp(sections, sectionId));
|
|
4577
4596
|
markDirty();
|
|
4578
4597
|
},
|
|
4579
4598
|
[sections, setSections, markDirty]
|
|
4580
4599
|
);
|
|
4581
4600
|
const moveSectionDown2 = react.useCallback(
|
|
4582
4601
|
(sectionId) => {
|
|
4583
|
-
setSections(
|
|
4602
|
+
setSections(chunk4SPZ5IZN_js.moveSectionDown(sections, sectionId));
|
|
4584
4603
|
markDirty();
|
|
4585
4604
|
},
|
|
4586
4605
|
[sections, setSections, markDirty]
|
|
4587
4606
|
);
|
|
4588
4607
|
const moveSlidesToSection2 = react.useCallback(
|
|
4589
4608
|
(slideIndexes, targetSectionId) => {
|
|
4590
|
-
const result =
|
|
4609
|
+
const result = chunk4SPZ5IZN_js.moveSlidesToSection(sections, slides, slideIndexes, targetSectionId);
|
|
4591
4610
|
setSlides(result.slides);
|
|
4592
4611
|
setSections(result.sections);
|
|
4593
4612
|
markDirty();
|
|
@@ -4653,15 +4672,15 @@ function syncSelectionHandleOverlay(elementNode, elementId, geometry) {
|
|
|
4653
4672
|
// src/viewer/hooks/pointer-move-handlers.ts
|
|
4654
4673
|
function computeResizeGeometry(handle, startX, startY, startWidth, startHeight, dx, dy, snapToGrid, gridSpacingPx, lockAspect = false) {
|
|
4655
4674
|
const startBox = { x: startX, y: startY, width: startWidth, height: startHeight };
|
|
4656
|
-
let resized =
|
|
4675
|
+
let resized = chunk4SPZ5IZN_js.applyResize(startBox, handle, dx, dy, 1, { minSize: chunkNJ3WCYYG_js.MIN_ELEMENT_SIZE });
|
|
4657
4676
|
if (lockAspect) {
|
|
4658
|
-
resized =
|
|
4677
|
+
resized = chunk4SPZ5IZN_js.lockResizeAspect(resized, startBox, handle, chunkNJ3WCYYG_js.MIN_ELEMENT_SIZE);
|
|
4659
4678
|
}
|
|
4660
4679
|
const box = { x: resized.x, y: resized.y, width: resized.width, height: resized.height };
|
|
4661
4680
|
if (!snapToGrid) {
|
|
4662
4681
|
return box;
|
|
4663
4682
|
}
|
|
4664
|
-
return
|
|
4683
|
+
return chunk4SPZ5IZN_js.snapBoxToGrid(box, handle, gridSpacingPx, chunkNJ3WCYYG_js.MIN_ELEMENT_SIZE);
|
|
4665
4684
|
}
|
|
4666
4685
|
function resolveLiveTarget(input) {
|
|
4667
4686
|
const { livePatcher, editTemplateMode, activeSlide } = input;
|
|
@@ -4774,7 +4793,7 @@ function processDragMove(e, drag, editorScale, snapToGrid, snapToShape, gridSpac
|
|
|
4774
4793
|
width: el.width,
|
|
4775
4794
|
height: el.height
|
|
4776
4795
|
}));
|
|
4777
|
-
const snapResult =
|
|
4796
|
+
const snapResult = chunk4SPZ5IZN_js.computeSnapToShape(
|
|
4778
4797
|
targetX,
|
|
4779
4798
|
targetY,
|
|
4780
4799
|
primaryEl.width,
|
|
@@ -4816,7 +4835,7 @@ function processDragMove(e, drag, editorScale, snapToGrid, snapToShape, gridSpac
|
|
|
4816
4835
|
if (live) {
|
|
4817
4836
|
for (const id of Object.keys(drag.startPositionsById)) {
|
|
4818
4837
|
const start = drag.startPositionsById[id];
|
|
4819
|
-
|
|
4838
|
+
chunk4SPZ5IZN_js.publishLiveGeometry(live.patcher, live.slideId, id, {
|
|
4820
4839
|
x: start.x + appliedDx,
|
|
4821
4840
|
y: start.y + appliedDy
|
|
4822
4841
|
});
|
|
@@ -4848,8 +4867,8 @@ function processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx, live)
|
|
|
4848
4867
|
rs.lastY = geo.y;
|
|
4849
4868
|
rs.lastWidth = geo.width;
|
|
4850
4869
|
rs.lastHeight = geo.height;
|
|
4851
|
-
const width = Math.max(geo.width,
|
|
4852
|
-
const height = Math.max(geo.height,
|
|
4870
|
+
const width = Math.max(geo.width, chunkNJ3WCYYG_js.MIN_ELEMENT_SIZE);
|
|
4871
|
+
const height = Math.max(geo.height, chunkNJ3WCYYG_js.MIN_ELEMENT_SIZE);
|
|
4853
4872
|
if (rs.domEl) {
|
|
4854
4873
|
rs.domEl.style.left = `${geo.x}px`;
|
|
4855
4874
|
rs.domEl.style.top = `${geo.y}px`;
|
|
@@ -4858,7 +4877,7 @@ function processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx, live)
|
|
|
4858
4877
|
syncSelectionHandleOverlay(rs.domEl, rs.elementId, { x: geo.x, y: geo.y, width, height });
|
|
4859
4878
|
}
|
|
4860
4879
|
if (live) {
|
|
4861
|
-
|
|
4880
|
+
chunk4SPZ5IZN_js.publishLiveGeometry(live.patcher, live.slideId, rs.elementId, {
|
|
4862
4881
|
x: geo.x,
|
|
4863
4882
|
y: geo.y,
|
|
4864
4883
|
width,
|
|
@@ -4869,7 +4888,7 @@ function processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx, live)
|
|
|
4869
4888
|
function processAdjustmentMove(e, adj, editorScale, updateElementById) {
|
|
4870
4889
|
const dx = (e.clientX - adj.startClientX) / editorScale;
|
|
4871
4890
|
const dy = (e.clientY - adj.startClientY) / editorScale;
|
|
4872
|
-
const adjustments =
|
|
4891
|
+
const adjustments = chunk4SPZ5IZN_js.getDraggedShapeAdjustments(adj, dx, dy);
|
|
4873
4892
|
if (!adj.moved && Math.hypot(dx, dy) > 2) {
|
|
4874
4893
|
adj.moved = true;
|
|
4875
4894
|
}
|
|
@@ -4944,13 +4963,13 @@ function processPointerUp(input) {
|
|
|
4944
4963
|
if (i !== activeSlideIndex) {
|
|
4945
4964
|
return s;
|
|
4946
4965
|
}
|
|
4947
|
-
const rerouted =
|
|
4966
|
+
const rerouted = chunk4SPZ5IZN_js.rerouteConnectorsForMovedElements(s.elements, movedIds);
|
|
4948
4967
|
if (rerouted.length === 0) {
|
|
4949
4968
|
return s;
|
|
4950
4969
|
}
|
|
4951
4970
|
return {
|
|
4952
4971
|
...s,
|
|
4953
|
-
elements:
|
|
4972
|
+
elements: chunk4SPZ5IZN_js.applyReroutedConnectors(s.elements, rerouted)
|
|
4954
4973
|
};
|
|
4955
4974
|
})
|
|
4956
4975
|
);
|
|
@@ -4977,9 +4996,9 @@ function processPointerUp(input) {
|
|
|
4977
4996
|
}
|
|
4978
4997
|
function commitMarquee(marquee, editTemplateMode, templateElements, activeSlide, applySelection, clearSelection) {
|
|
4979
4998
|
const sourceElements = editTemplateMode ? templateElements : activeSlide?.elements ?? [];
|
|
4980
|
-
const hitIds =
|
|
4999
|
+
const hitIds = chunk4SPZ5IZN_js.computeMarqueeHitIds(marquee, sourceElements);
|
|
4981
5000
|
if (marquee.additive) {
|
|
4982
|
-
const merged =
|
|
5001
|
+
const merged = chunk4SPZ5IZN_js.mergeAdditiveSelection(marquee.baseSelectionIds, hitIds);
|
|
4983
5002
|
if (merged.length > 0) {
|
|
4984
5003
|
applySelection(merged[0], merged);
|
|
4985
5004
|
} else {
|
|
@@ -5002,8 +5021,8 @@ function commitDrag(drag, editTemplateMode, activeSlide, activeSlideIndex, setTe
|
|
|
5002
5021
|
}
|
|
5003
5022
|
return { ...el, x: start.x + dx, y: start.y + dy };
|
|
5004
5023
|
});
|
|
5005
|
-
const rerouted =
|
|
5006
|
-
return
|
|
5024
|
+
const rerouted = chunk4SPZ5IZN_js.rerouteConnectorsForMovedElements(movedElements, movedIds);
|
|
5025
|
+
return chunk4SPZ5IZN_js.applyReroutedConnectors(movedElements, rerouted);
|
|
5007
5026
|
};
|
|
5008
5027
|
if (editTemplateMode) {
|
|
5009
5028
|
const slideId = activeSlide?.id;
|
|
@@ -5159,17 +5178,17 @@ function useCanvasInteractions(input) {
|
|
|
5159
5178
|
return;
|
|
5160
5179
|
}
|
|
5161
5180
|
const el = elementLookup.get(editId);
|
|
5162
|
-
if (el &&
|
|
5181
|
+
if (el && chunk4SPZ5IZN_js.hasTextProperties(el)) {
|
|
5163
5182
|
const committedText = transformCommittedText ? transformCommittedText(inlineEditingText) : inlineEditingText;
|
|
5164
|
-
const textPatch =
|
|
5183
|
+
const textPatch = chunk4SPZ5IZN_js.buildInlineTextCommitPatch(el, committedText);
|
|
5165
5184
|
if (!textPatch) {
|
|
5166
5185
|
setInlineEditingElementId(null);
|
|
5167
5186
|
setInlineEditingText("");
|
|
5168
5187
|
return;
|
|
5169
5188
|
}
|
|
5170
5189
|
const editorEl = document.querySelector("[data-inline-editor]");
|
|
5171
|
-
const newHeight =
|
|
5172
|
-
const shrink =
|
|
5190
|
+
const newHeight = chunk4SPZ5IZN_js.resolveInlineEditAutoFitHeight(el.textStyle, el.height, editorEl);
|
|
5191
|
+
const shrink = chunk4SPZ5IZN_js.resolveInlineEditNormAutofitShrink(el.textStyle, el.height, editorEl);
|
|
5173
5192
|
ops.updateElementById(editId, {
|
|
5174
5193
|
...textPatch,
|
|
5175
5194
|
...newHeight !== void 0 ? { height: newHeight } : {},
|
|
@@ -5187,7 +5206,7 @@ function useCanvasInteractions(input) {
|
|
|
5187
5206
|
setInlineEditingText("");
|
|
5188
5207
|
};
|
|
5189
5208
|
const openEquationEditorForElement = (el) => {
|
|
5190
|
-
if (!
|
|
5209
|
+
if (!chunk4SPZ5IZN_js.hasTextProperties(el)) {
|
|
5191
5210
|
return false;
|
|
5192
5211
|
}
|
|
5193
5212
|
const eqSeg = el.textSegments?.find((seg) => seg.equationXml);
|
|
@@ -5217,7 +5236,7 @@ function useCanvasInteractions(input) {
|
|
|
5217
5236
|
justInteractedRef.current = false;
|
|
5218
5237
|
} else {
|
|
5219
5238
|
const el = elementLookup.get(elementId);
|
|
5220
|
-
if (el &&
|
|
5239
|
+
if (el && chunk4SPZ5IZN_js.hasTextProperties(el) && chunk4SPZ5IZN_js.canInteractWithElement(el, "textEdit")) {
|
|
5221
5240
|
if (!openEquationEditorForElement(el)) {
|
|
5222
5241
|
setInlineEditingElementId(elementId);
|
|
5223
5242
|
setInlineEditingText(el.text ?? "");
|
|
@@ -5236,7 +5255,7 @@ function useCanvasInteractions(input) {
|
|
|
5236
5255
|
if (openEquationEditorForElement(el)) {
|
|
5237
5256
|
return;
|
|
5238
5257
|
}
|
|
5239
|
-
if (
|
|
5258
|
+
if (chunk4SPZ5IZN_js.hasTextProperties(el) && chunk4SPZ5IZN_js.canInteractWithElement(el, "textEdit")) {
|
|
5240
5259
|
setInlineEditingElementId(elementId);
|
|
5241
5260
|
setInlineEditingText(el.text ?? "");
|
|
5242
5261
|
}
|
|
@@ -5259,7 +5278,7 @@ function useCanvasInteractions(input) {
|
|
|
5259
5278
|
justSelectedRef.current = false;
|
|
5260
5279
|
}
|
|
5261
5280
|
const ids = !wasSelected ? [elementId] : effectiveSelectedIds.length ? effectiveSelectedIds : [elementId];
|
|
5262
|
-
const movableIds =
|
|
5281
|
+
const movableIds = chunk4SPZ5IZN_js.filterInteractableIds(ids, (id) => elementLookup.get(id), "move");
|
|
5263
5282
|
if (movableIds.length === 0) {
|
|
5264
5283
|
return;
|
|
5265
5284
|
}
|
|
@@ -5329,7 +5348,7 @@ function useCanvasInteractions(input) {
|
|
|
5329
5348
|
const handleResizePointerDown = (elementId, e, handle) => {
|
|
5330
5349
|
e.stopPropagation();
|
|
5331
5350
|
const el = elementLookup.get(elementId);
|
|
5332
|
-
if (!el || !
|
|
5351
|
+
if (!el || !chunk4SPZ5IZN_js.canInteractWithElement(el, "resize")) {
|
|
5333
5352
|
return;
|
|
5334
5353
|
}
|
|
5335
5354
|
resizeStateRef.current = {
|
|
@@ -5351,7 +5370,7 @@ function useCanvasInteractions(input) {
|
|
|
5351
5370
|
};
|
|
5352
5371
|
const handleRotate = (elementId, rotationDeg) => {
|
|
5353
5372
|
const el = elementLookup.get(elementId);
|
|
5354
|
-
if (!el || !
|
|
5373
|
+
if (!el || !chunk4SPZ5IZN_js.canInteractWithElement(el, "rotate")) {
|
|
5355
5374
|
return;
|
|
5356
5375
|
}
|
|
5357
5376
|
ops.updateElementById(elementId, { rotation: rotationDeg });
|
|
@@ -5371,10 +5390,10 @@ function useCanvasInteractions(input) {
|
|
|
5371
5390
|
const handleAdjustmentPointerDown = (elementId, e, descriptor) => {
|
|
5372
5391
|
e.stopPropagation();
|
|
5373
5392
|
const el = elementLookup.get(elementId);
|
|
5374
|
-
if (!el || !
|
|
5393
|
+
if (!el || !chunk4SPZ5IZN_js.canInteractWithElement(el, "adjustHandle")) {
|
|
5375
5394
|
return;
|
|
5376
5395
|
}
|
|
5377
|
-
shapeAdjustmentDragStateRef.current =
|
|
5396
|
+
shapeAdjustmentDragStateRef.current = chunk4SPZ5IZN_js.beginShapeAdjustment(
|
|
5378
5397
|
el,
|
|
5379
5398
|
descriptor,
|
|
5380
5399
|
e.clientX,
|
|
@@ -5421,7 +5440,7 @@ function createFileHandlers(deps) {
|
|
|
5421
5440
|
h = Math.round(h * scale);
|
|
5422
5441
|
}
|
|
5423
5442
|
addElement({
|
|
5424
|
-
id:
|
|
5443
|
+
id: chunk4SPZ5IZN_js.generateElementId(),
|
|
5425
5444
|
type: "image",
|
|
5426
5445
|
x: Math.round((canvasSize.width - w) / 2),
|
|
5427
5446
|
y: Math.round((canvasSize.height - h) / 2),
|
|
@@ -5432,7 +5451,7 @@ function createFileHandlers(deps) {
|
|
|
5432
5451
|
};
|
|
5433
5452
|
img.onerror = () => {
|
|
5434
5453
|
addElement({
|
|
5435
|
-
id:
|
|
5454
|
+
id: chunk4SPZ5IZN_js.generateElementId(),
|
|
5436
5455
|
type: "image",
|
|
5437
5456
|
x: 100,
|
|
5438
5457
|
y: 100,
|
|
@@ -5451,14 +5470,14 @@ function createFileHandlers(deps) {
|
|
|
5451
5470
|
return;
|
|
5452
5471
|
}
|
|
5453
5472
|
e.target.value = "";
|
|
5454
|
-
const mediaType =
|
|
5473
|
+
const mediaType = chunk4SPZ5IZN_js.classifyMediaType(file.type);
|
|
5455
5474
|
if (!mediaType) {
|
|
5456
5475
|
return;
|
|
5457
5476
|
}
|
|
5458
5477
|
const elFilePath = file.path;
|
|
5459
5478
|
const insertMediaElement = (mediaSourceUrl, width, height) => {
|
|
5460
5479
|
addElement({
|
|
5461
|
-
id:
|
|
5480
|
+
id: chunk4SPZ5IZN_js.generateElementId(),
|
|
5462
5481
|
type: "media",
|
|
5463
5482
|
mediaType,
|
|
5464
5483
|
mediaMimeType: file.type || void 0,
|
|
@@ -5633,13 +5652,13 @@ function createStructuredElementHandlers(deps) {
|
|
|
5633
5652
|
return;
|
|
5634
5653
|
}
|
|
5635
5654
|
addElement({
|
|
5636
|
-
id:
|
|
5655
|
+
id: chunk4SPZ5IZN_js.generateElementId(),
|
|
5637
5656
|
type: "smartArt",
|
|
5638
5657
|
x: 100,
|
|
5639
5658
|
y: 120,
|
|
5640
5659
|
width: 600,
|
|
5641
5660
|
height: 340,
|
|
5642
|
-
smartArtData:
|
|
5661
|
+
smartArtData: chunk4SPZ5IZN_js.buildSmartArtPresetData(
|
|
5643
5662
|
layout,
|
|
5644
5663
|
defaultItems,
|
|
5645
5664
|
(i) => `node-${Date.now()}-${i}-${Math.random().toString(36).slice(2, 8)}`
|
|
@@ -5651,7 +5670,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5651
5670
|
return;
|
|
5652
5671
|
}
|
|
5653
5672
|
addElement({
|
|
5654
|
-
id:
|
|
5673
|
+
id: chunk4SPZ5IZN_js.generateElementId(),
|
|
5655
5674
|
type: "shape",
|
|
5656
5675
|
x: 120,
|
|
5657
5676
|
y: 200,
|
|
@@ -5689,7 +5708,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5689
5708
|
return;
|
|
5690
5709
|
}
|
|
5691
5710
|
const resolved = resolveHyperlinkEditResult(data);
|
|
5692
|
-
if (resolved.url && !
|
|
5711
|
+
if (resolved.url && !chunk4SPZ5IZN_js.isUrlSafe(resolved.url)) {
|
|
5693
5712
|
return;
|
|
5694
5713
|
}
|
|
5695
5714
|
const actionClick = {
|
|
@@ -5713,7 +5732,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5713
5732
|
const displayText = value || fieldTexts[fieldType] || fieldType;
|
|
5714
5733
|
const fieldGuid = `{${crypto.randomUUID().toUpperCase()}}`;
|
|
5715
5734
|
addElement({
|
|
5716
|
-
id:
|
|
5735
|
+
id: chunk4SPZ5IZN_js.generateElementId(),
|
|
5717
5736
|
type: "shape",
|
|
5718
5737
|
x: 120,
|
|
5719
5738
|
y: 200,
|
|
@@ -5735,11 +5754,11 @@ function createStructuredElementHandlers(deps) {
|
|
|
5735
5754
|
if (!activeSlide) {
|
|
5736
5755
|
return;
|
|
5737
5756
|
}
|
|
5738
|
-
const preset =
|
|
5757
|
+
const preset = chunk4SPZ5IZN_js.ACTION_BUTTON_PRESETS.find((p) => p.shapeType === shapeType);
|
|
5739
5758
|
if (!preset) {
|
|
5740
5759
|
return;
|
|
5741
5760
|
}
|
|
5742
|
-
const defaultPptxAction =
|
|
5761
|
+
const defaultPptxAction = chunk4SPZ5IZN_js.elementActionToPptxAction({
|
|
5743
5762
|
trigger: "click",
|
|
5744
5763
|
type: preset.defaultAction
|
|
5745
5764
|
});
|
|
@@ -5748,7 +5767,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5748
5767
|
defaultPptxAction.highlightClick = true;
|
|
5749
5768
|
}
|
|
5750
5769
|
addElement({
|
|
5751
|
-
id:
|
|
5770
|
+
id: chunk4SPZ5IZN_js.generateElementId(),
|
|
5752
5771
|
type: "shape",
|
|
5753
5772
|
x: 150,
|
|
5754
5773
|
y: 150,
|
|
@@ -5815,14 +5834,14 @@ function useInsertElements(input) {
|
|
|
5815
5834
|
return;
|
|
5816
5835
|
}
|
|
5817
5836
|
addElement({
|
|
5818
|
-
id:
|
|
5837
|
+
id: chunk4SPZ5IZN_js.generateElementId(),
|
|
5819
5838
|
type: "text",
|
|
5820
5839
|
x: 100,
|
|
5821
5840
|
y: 100,
|
|
5822
5841
|
width: 300,
|
|
5823
5842
|
height: 60,
|
|
5824
5843
|
text: "",
|
|
5825
|
-
textStyle: { fontSize:
|
|
5844
|
+
textStyle: { fontSize: chunkNJ3WCYYG_js.DEFAULT_TEXT_FONT_SIZE }
|
|
5826
5845
|
});
|
|
5827
5846
|
};
|
|
5828
5847
|
const handleAddShape = () => {
|
|
@@ -5830,7 +5849,7 @@ function useInsertElements(input) {
|
|
|
5830
5849
|
return;
|
|
5831
5850
|
}
|
|
5832
5851
|
addElement({
|
|
5833
|
-
id:
|
|
5852
|
+
id: chunk4SPZ5IZN_js.generateElementId(),
|
|
5834
5853
|
type: "shape",
|
|
5835
5854
|
x: 150,
|
|
5836
5855
|
y: 150,
|
|
@@ -5849,15 +5868,15 @@ function useInsertElements(input) {
|
|
|
5849
5868
|
return;
|
|
5850
5869
|
}
|
|
5851
5870
|
addElement({
|
|
5852
|
-
...
|
|
5853
|
-
id:
|
|
5871
|
+
...chunk4SPZ5IZN_js.newTableElement(chunkNJ3WCYYG_js.DEFAULT_TABLE_ROWS, chunkNJ3WCYYG_js.DEFAULT_TABLE_COLUMNS, 100, 200),
|
|
5872
|
+
id: chunk4SPZ5IZN_js.generateElementId()
|
|
5854
5873
|
});
|
|
5855
5874
|
};
|
|
5856
5875
|
const handleAddChart = (chartKind) => {
|
|
5857
5876
|
if (!activeSlide) {
|
|
5858
5877
|
return;
|
|
5859
5878
|
}
|
|
5860
|
-
addElement(
|
|
5879
|
+
addElement(chunk4SPZ5IZN_js.createDefaultChartElement(chartKind));
|
|
5861
5880
|
};
|
|
5862
5881
|
const structured = createStructuredElementHandlers({
|
|
5863
5882
|
activeSlide,
|
|
@@ -5899,6 +5918,7 @@ function useInsertElements(input) {
|
|
|
5899
5918
|
history.markDirty();
|
|
5900
5919
|
};
|
|
5901
5920
|
return {
|
|
5921
|
+
addElement,
|
|
5902
5922
|
handleAddTextBox,
|
|
5903
5923
|
handleAddShape,
|
|
5904
5924
|
handleAddTable,
|
|
@@ -5927,7 +5947,7 @@ function useClipboardHandlers(input) {
|
|
|
5927
5947
|
if (!selectedElement) {
|
|
5928
5948
|
return;
|
|
5929
5949
|
}
|
|
5930
|
-
setClipboardPayload(
|
|
5950
|
+
setClipboardPayload(chunk4SPZ5IZN_js.buildElementClipboardPayload(selectedElement, editTemplateMode));
|
|
5931
5951
|
};
|
|
5932
5952
|
const handleDelete = () => {
|
|
5933
5953
|
const idsToDelete = effectiveSelectedIds;
|
|
@@ -5944,7 +5964,7 @@ function useClipboardHandlers(input) {
|
|
|
5944
5964
|
handleDelete();
|
|
5945
5965
|
};
|
|
5946
5966
|
const insertClone = (source) => {
|
|
5947
|
-
const clone =
|
|
5967
|
+
const clone = chunk4SPZ5IZN_js.cloneElementForPaste(source, { intoTemplate: editTemplateMode });
|
|
5948
5968
|
ops.updateActiveElements((els) => [...els, clone]);
|
|
5949
5969
|
ops.applySelection(clone.id);
|
|
5950
5970
|
history.markDirty();
|
|
@@ -5979,7 +5999,7 @@ function resolveShapePath(el) {
|
|
|
5979
5999
|
return el.pathData;
|
|
5980
6000
|
}
|
|
5981
6001
|
if ("shapeType" in el && typeof el.shapeType === "string") {
|
|
5982
|
-
const clipPath =
|
|
6002
|
+
const clipPath = chunk4SPZ5IZN_js.getPresetShapeClipPath(el.shapeType);
|
|
5983
6003
|
if (clipPath) {
|
|
5984
6004
|
const svgPath = clipPathToSvgPath(clipPath, el.width, el.height);
|
|
5985
6005
|
if (svgPath) {
|
|
@@ -6030,7 +6050,7 @@ function clipPathToSvgPath(clipPath, width, height) {
|
|
|
6030
6050
|
return parts.join(" ");
|
|
6031
6051
|
}
|
|
6032
6052
|
function transformPathToGlobal(pathData, el) {
|
|
6033
|
-
const polys =
|
|
6053
|
+
const polys = chunk4SPZ5IZN_js.svgPathToPolygons(pathData);
|
|
6034
6054
|
if (polys.length === 0) {
|
|
6035
6055
|
return pathData;
|
|
6036
6056
|
}
|
|
@@ -6050,10 +6070,10 @@ function transformPathToGlobal(pathData, el) {
|
|
|
6050
6070
|
y: pt.y * scaleY + el.y
|
|
6051
6071
|
}))
|
|
6052
6072
|
);
|
|
6053
|
-
return
|
|
6073
|
+
return chunk4SPZ5IZN_js.polygonsToSvgPath(transformed);
|
|
6054
6074
|
}
|
|
6055
6075
|
function transformPathToLocal(pathData, x, y, _width, _height) {
|
|
6056
|
-
const polys =
|
|
6076
|
+
const polys = chunk4SPZ5IZN_js.svgPathToPolygons(pathData);
|
|
6057
6077
|
if (polys.length === 0) {
|
|
6058
6078
|
return pathData;
|
|
6059
6079
|
}
|
|
@@ -6063,10 +6083,10 @@ function transformPathToLocal(pathData, x, y, _width, _height) {
|
|
|
6063
6083
|
y: pt.y - y
|
|
6064
6084
|
}))
|
|
6065
6085
|
);
|
|
6066
|
-
return
|
|
6086
|
+
return chunk4SPZ5IZN_js.polygonsToSvgPath(transformed);
|
|
6067
6087
|
}
|
|
6068
6088
|
function pathBounds(pathData) {
|
|
6069
|
-
const polys =
|
|
6089
|
+
const polys = chunk4SPZ5IZN_js.svgPathToPolygons(pathData);
|
|
6070
6090
|
let minX = Infinity;
|
|
6071
6091
|
let minY = Infinity;
|
|
6072
6092
|
let maxX = -Infinity;
|
|
@@ -6125,7 +6145,7 @@ function useMergeShapesHandler(input) {
|
|
|
6125
6145
|
let allFragments = [];
|
|
6126
6146
|
let remaining = globalPaths[0];
|
|
6127
6147
|
for (let i = 1; i < globalPaths.length; i++) {
|
|
6128
|
-
const frags =
|
|
6148
|
+
const frags = chunk4SPZ5IZN_js.mergeShapes("fragment", remaining, globalPaths[i]);
|
|
6129
6149
|
if (Array.isArray(frags)) {
|
|
6130
6150
|
allFragments = frags;
|
|
6131
6151
|
}
|
|
@@ -6154,7 +6174,7 @@ function useMergeShapesHandler(input) {
|
|
|
6154
6174
|
bounds.height
|
|
6155
6175
|
);
|
|
6156
6176
|
const newEl = {
|
|
6157
|
-
id:
|
|
6177
|
+
id: chunk4SPZ5IZN_js.generateElementId(),
|
|
6158
6178
|
type: "shape",
|
|
6159
6179
|
x: bounds.x,
|
|
6160
6180
|
y: bounds.y,
|
|
@@ -6192,7 +6212,7 @@ function useMergeShapesHandler(input) {
|
|
|
6192
6212
|
} else {
|
|
6193
6213
|
let resultPath = globalPaths[0];
|
|
6194
6214
|
for (let i = 1; i < globalPaths.length; i++) {
|
|
6195
|
-
const result =
|
|
6215
|
+
const result = chunk4SPZ5IZN_js.mergeShapes(operation, resultPath, globalPaths[i]);
|
|
6196
6216
|
if (typeof result === "string") {
|
|
6197
6217
|
resultPath = result;
|
|
6198
6218
|
}
|
|
@@ -6213,7 +6233,7 @@ function useMergeShapesHandler(input) {
|
|
|
6213
6233
|
);
|
|
6214
6234
|
const primary = targets[0];
|
|
6215
6235
|
const newEl = {
|
|
6216
|
-
id:
|
|
6236
|
+
id: chunk4SPZ5IZN_js.generateElementId(),
|
|
6217
6237
|
type: "shape",
|
|
6218
6238
|
x: bounds.x,
|
|
6219
6239
|
y: bounds.y,
|
|
@@ -6276,10 +6296,10 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6276
6296
|
if (ids.length < 2 || !activeSlide) {
|
|
6277
6297
|
return;
|
|
6278
6298
|
}
|
|
6279
|
-
if (!selectedElements.every((el) =>
|
|
6299
|
+
if (!selectedElements.every((el) => chunk4SPZ5IZN_js.canInteractWithElement(el, "group"))) {
|
|
6280
6300
|
return;
|
|
6281
6301
|
}
|
|
6282
|
-
const { elements, groupId } =
|
|
6302
|
+
const { elements, groupId } = chunk4SPZ5IZN_js.groupElements(ops.activeElements, ids, chunk4SPZ5IZN_js.generateElementId());
|
|
6283
6303
|
if (groupId === null) {
|
|
6284
6304
|
return;
|
|
6285
6305
|
}
|
|
@@ -6291,15 +6311,15 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6291
6311
|
if (!selectedElement || selectedElement.type !== "group" || !activeSlide) {
|
|
6292
6312
|
return;
|
|
6293
6313
|
}
|
|
6294
|
-
if (!
|
|
6314
|
+
if (!chunk4SPZ5IZN_js.canInteractWithElement(selectedElement, "group")) {
|
|
6295
6315
|
return;
|
|
6296
6316
|
}
|
|
6297
6317
|
const group = selectedElement;
|
|
6298
|
-
const intoTemplate =
|
|
6318
|
+
const intoTemplate = chunk4SPZ5IZN_js.isTemplateElementId(group.id);
|
|
6299
6319
|
const childIds = group.children.map(
|
|
6300
|
-
(child) => intoTemplate ?
|
|
6320
|
+
(child) => intoTemplate ? chunk4SPZ5IZN_js.makeCloneId(true, child.id || group.id) : child.id || chunk4SPZ5IZN_js.generateElementId()
|
|
6301
6321
|
);
|
|
6302
|
-
const { elements, childIds: usedIds } =
|
|
6322
|
+
const { elements, childIds: usedIds } = chunk4SPZ5IZN_js.ungroupElements(
|
|
6303
6323
|
ops.activeElements,
|
|
6304
6324
|
group.id,
|
|
6305
6325
|
childIds,
|
|
@@ -6328,7 +6348,7 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6328
6348
|
if (!edge) {
|
|
6329
6349
|
return;
|
|
6330
6350
|
}
|
|
6331
|
-
const positions =
|
|
6351
|
+
const positions = chunk4SPZ5IZN_js.alignElements(selectedElements, edge);
|
|
6332
6352
|
for (const [id, pos] of positions) {
|
|
6333
6353
|
const el = elementLookup.get(id);
|
|
6334
6354
|
if (!el) {
|
|
@@ -6346,7 +6366,7 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6346
6366
|
if (!distAxis) {
|
|
6347
6367
|
return;
|
|
6348
6368
|
}
|
|
6349
|
-
const positions =
|
|
6369
|
+
const positions = chunk4SPZ5IZN_js.distributeElements(selectedElements, distAxis);
|
|
6350
6370
|
for (const [id, pos] of positions) {
|
|
6351
6371
|
const el = elementLookup.get(id);
|
|
6352
6372
|
if (!el) {
|
|
@@ -6357,14 +6377,14 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6357
6377
|
history.markDirty();
|
|
6358
6378
|
};
|
|
6359
6379
|
const canDistribute = selectedElements.length >= 3;
|
|
6360
|
-
const selectionGroupable = selectedElements.every((el) =>
|
|
6380
|
+
const selectionGroupable = selectedElements.every((el) => chunk4SPZ5IZN_js.canInteractWithElement(el, "group"));
|
|
6361
6381
|
const handleMoveLayer = (direction) => {
|
|
6362
6382
|
if (!selectedElement || !activeSlide) {
|
|
6363
6383
|
return;
|
|
6364
6384
|
}
|
|
6365
6385
|
const id = selectedElement.id;
|
|
6366
6386
|
ops.updateActiveElements(
|
|
6367
|
-
(els) => direction === "forward" ?
|
|
6387
|
+
(els) => direction === "forward" ? chunk4SPZ5IZN_js.bringForward(els, id) : direction === "backward" ? chunk4SPZ5IZN_js.sendBackward(els, id) : els
|
|
6368
6388
|
);
|
|
6369
6389
|
history.markDirty();
|
|
6370
6390
|
};
|
|
@@ -6374,7 +6394,7 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6374
6394
|
}
|
|
6375
6395
|
const id = selectedElement.id;
|
|
6376
6396
|
ops.updateActiveElements(
|
|
6377
|
-
(els) => direction === "front" ?
|
|
6397
|
+
(els) => direction === "front" ? chunk4SPZ5IZN_js.bringToFront(els, id) : chunk4SPZ5IZN_js.sendToBack(els, id)
|
|
6378
6398
|
);
|
|
6379
6399
|
history.markDirty();
|
|
6380
6400
|
};
|
|
@@ -6509,7 +6529,7 @@ function useSlideManagement(input) {
|
|
|
6509
6529
|
} = input;
|
|
6510
6530
|
const handleAddSlideAfter = (afterIndex) => {
|
|
6511
6531
|
const insertAt = Math.max(0, Math.min(afterIndex + 1, slides.length));
|
|
6512
|
-
const newSlide =
|
|
6532
|
+
const newSlide = chunk4SPZ5IZN_js.createBlankSlide(slides.length + 1);
|
|
6513
6533
|
ops.updateSlides((prev) => {
|
|
6514
6534
|
const next = [...prev];
|
|
6515
6535
|
next.splice(insertAt, 0, newSlide);
|
|
@@ -6573,7 +6593,7 @@ function useSlideManagement(input) {
|
|
|
6573
6593
|
}
|
|
6574
6594
|
const clone = {
|
|
6575
6595
|
...src,
|
|
6576
|
-
id:
|
|
6596
|
+
id: chunk4SPZ5IZN_js.makeSlideId(),
|
|
6577
6597
|
elements: src.elements.map((el) => ({
|
|
6578
6598
|
...el,
|
|
6579
6599
|
id: `${el.id}-dup-${Math.random().toString(36).slice(2, 6)}`
|
|
@@ -6605,7 +6625,7 @@ function useSlideManagement(input) {
|
|
|
6605
6625
|
const handleInsertSlideFromLayout = (layoutPath, layoutName) => {
|
|
6606
6626
|
const insertAt = activeSlideIndex + 1;
|
|
6607
6627
|
const draft = {
|
|
6608
|
-
...
|
|
6628
|
+
...chunk4SPZ5IZN_js.createBlankSlide(slides.length + 1),
|
|
6609
6629
|
layoutPath,
|
|
6610
6630
|
...layoutName ? { layoutName } : {}
|
|
6611
6631
|
};
|
|
@@ -6638,9 +6658,9 @@ function useSlideManagement(input) {
|
|
|
6638
6658
|
};
|
|
6639
6659
|
const handleInsertSlideFromTemplate = (templateId) => {
|
|
6640
6660
|
const insertAt = activeSlideIndex + 1;
|
|
6641
|
-
const draft =
|
|
6661
|
+
const draft = chunk4SPZ5IZN_js.buildSlideTemplateSlide(templateId, chunk4SPZ5IZN_js.makeSlideId(), slides.length + 1, {
|
|
6642
6662
|
...canvasSize ? { slideWidth: canvasSize.width, slideHeight: canvasSize.height } : {},
|
|
6643
|
-
scheme:
|
|
6663
|
+
scheme: chunk4SPZ5IZN_js.templateSchemeFromTheme(theme?.colorScheme)
|
|
6644
6664
|
});
|
|
6645
6665
|
ops.updateSlides((prev) => insertSlideFromLayoutUpdater(prev, activeSlideIndex, draft));
|
|
6646
6666
|
setActiveSlideIndex(insertAt);
|
|
@@ -6678,7 +6698,7 @@ function createTableMergeHandlers(input) {
|
|
|
6678
6698
|
if (!nextCell || nextCell.hMerge || nextCell.vMerge) {
|
|
6679
6699
|
return;
|
|
6680
6700
|
}
|
|
6681
|
-
const newTableData =
|
|
6701
|
+
const newTableData = chunk4SPZ5IZN_js.mergeCells(
|
|
6682
6702
|
[
|
|
6683
6703
|
{ row: rowIndex, col: columnIndex },
|
|
6684
6704
|
{ row: rowIndex, col: nextColIdx }
|
|
@@ -6686,7 +6706,7 @@ function createTableMergeHandlers(input) {
|
|
|
6686
6706
|
td
|
|
6687
6707
|
);
|
|
6688
6708
|
const updates = { tableData: newTableData };
|
|
6689
|
-
const newRawXml =
|
|
6709
|
+
const newRawXml = chunk4SPZ5IZN_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
|
|
6690
6710
|
if (newRawXml) {
|
|
6691
6711
|
updates.rawXml = newRawXml;
|
|
6692
6712
|
}
|
|
@@ -6712,7 +6732,7 @@ function createTableMergeHandlers(input) {
|
|
|
6712
6732
|
if (!targetNextCell || targetNextCell.hMerge || targetNextCell.vMerge) {
|
|
6713
6733
|
return;
|
|
6714
6734
|
}
|
|
6715
|
-
const newTableData =
|
|
6735
|
+
const newTableData = chunk4SPZ5IZN_js.mergeCells(
|
|
6716
6736
|
[
|
|
6717
6737
|
{ row: rowIndex, col: columnIndex },
|
|
6718
6738
|
{ row: targetNextRowIdx, col: columnIndex }
|
|
@@ -6720,7 +6740,7 @@ function createTableMergeHandlers(input) {
|
|
|
6720
6740
|
td
|
|
6721
6741
|
);
|
|
6722
6742
|
const updates = { tableData: newTableData };
|
|
6723
|
-
const newRawXml =
|
|
6743
|
+
const newRawXml = chunk4SPZ5IZN_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
|
|
6724
6744
|
if (newRawXml) {
|
|
6725
6745
|
updates.rawXml = newRawXml;
|
|
6726
6746
|
}
|
|
@@ -6735,9 +6755,9 @@ function createTableMergeHandlers(input) {
|
|
|
6735
6755
|
return;
|
|
6736
6756
|
}
|
|
6737
6757
|
const td = selectedElement.tableData;
|
|
6738
|
-
const newTableData =
|
|
6758
|
+
const newTableData = chunk4SPZ5IZN_js.mergeCells(ts.selectedCells, td);
|
|
6739
6759
|
const updates = { tableData: newTableData };
|
|
6740
|
-
const newRawXml =
|
|
6760
|
+
const newRawXml = chunk4SPZ5IZN_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
|
|
6741
6761
|
if (newRawXml) {
|
|
6742
6762
|
updates.rawXml = newRawXml;
|
|
6743
6763
|
}
|
|
@@ -6754,9 +6774,9 @@ function createTableMergeHandlers(input) {
|
|
|
6754
6774
|
}
|
|
6755
6775
|
const { rowIndex, columnIndex } = ts;
|
|
6756
6776
|
const td = selectedElement.tableData;
|
|
6757
|
-
const newTableData =
|
|
6777
|
+
const newTableData = chunk4SPZ5IZN_js.splitCell(rowIndex, columnIndex, td);
|
|
6758
6778
|
const updates = { tableData: newTableData };
|
|
6759
|
-
const newRawXml =
|
|
6779
|
+
const newRawXml = chunk4SPZ5IZN_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
|
|
6760
6780
|
if (newRawXml) {
|
|
6761
6781
|
updates.rawXml = newRawXml;
|
|
6762
6782
|
}
|
|
@@ -6790,10 +6810,10 @@ function createTableStructHandlers(input) {
|
|
|
6790
6810
|
const text = transformCommittedText ? transformCommittedText(rawText) : rawText;
|
|
6791
6811
|
const updates = {};
|
|
6792
6812
|
if (el.tableData) {
|
|
6793
|
-
updates.tableData =
|
|
6813
|
+
updates.tableData = chunk4SPZ5IZN_js.setCellText(el, rowIndex, colIndex, text).tableData;
|
|
6794
6814
|
}
|
|
6795
6815
|
if (el.rawXml) {
|
|
6796
|
-
const newRawXml =
|
|
6816
|
+
const newRawXml = chunk4SPZ5IZN_js.updateCellTextInRawXml(el, rowIndex, colIndex, text);
|
|
6797
6817
|
if (newRawXml) {
|
|
6798
6818
|
updates.rawXml = newRawXml;
|
|
6799
6819
|
}
|
|
@@ -6817,7 +6837,7 @@ function createTableStructHandlers(input) {
|
|
|
6817
6837
|
const { rowIndex, columnIndex: colIndex } = ts;
|
|
6818
6838
|
const updates = {};
|
|
6819
6839
|
if (selectedElement.rawXml) {
|
|
6820
|
-
const newRawXml =
|
|
6840
|
+
const newRawXml = chunk4SPZ5IZN_js.updateCellTextStyleInRawXml(
|
|
6821
6841
|
selectedElement,
|
|
6822
6842
|
rowIndex,
|
|
6823
6843
|
colIndex,
|
|
@@ -6881,7 +6901,7 @@ function createTableStructHandlers(input) {
|
|
|
6881
6901
|
return;
|
|
6882
6902
|
}
|
|
6883
6903
|
const rowIdx = ts?.rowIndex ?? 0;
|
|
6884
|
-
const next =
|
|
6904
|
+
const next = chunk4SPZ5IZN_js.insertTableElementRow(selectedElement, rowIdx, position);
|
|
6885
6905
|
ops.updateSelectedElement({ tableData: next.tableData, rawXml: next.rawXml });
|
|
6886
6906
|
history.markDirty();
|
|
6887
6907
|
};
|
|
@@ -6890,7 +6910,7 @@ function createTableStructHandlers(input) {
|
|
|
6890
6910
|
return;
|
|
6891
6911
|
}
|
|
6892
6912
|
const rowIdx = ts?.rowIndex ?? 0;
|
|
6893
|
-
const next =
|
|
6913
|
+
const next = chunk4SPZ5IZN_js.removeTableElementRow(selectedElement, rowIdx);
|
|
6894
6914
|
if (next === selectedElement) {
|
|
6895
6915
|
return;
|
|
6896
6916
|
}
|
|
@@ -6902,7 +6922,7 @@ function createTableStructHandlers(input) {
|
|
|
6902
6922
|
return;
|
|
6903
6923
|
}
|
|
6904
6924
|
const colIdx = ts?.columnIndex ?? 0;
|
|
6905
|
-
const next =
|
|
6925
|
+
const next = chunk4SPZ5IZN_js.insertTableElementColumn(selectedElement, colIdx, position);
|
|
6906
6926
|
ops.updateSelectedElement({ tableData: next.tableData, rawXml: next.rawXml });
|
|
6907
6927
|
history.markDirty();
|
|
6908
6928
|
};
|
|
@@ -6911,7 +6931,7 @@ function createTableStructHandlers(input) {
|
|
|
6911
6931
|
return;
|
|
6912
6932
|
}
|
|
6913
6933
|
const colIdx = ts?.columnIndex ?? 0;
|
|
6914
|
-
const next =
|
|
6934
|
+
const next = chunk4SPZ5IZN_js.removeTableElementColumn(selectedElement, colIdx);
|
|
6915
6935
|
if (next === selectedElement) {
|
|
6916
6936
|
return;
|
|
6917
6937
|
}
|
|
@@ -6947,8 +6967,8 @@ async function renderToCanvas(element, options = {}) {
|
|
|
6947
6967
|
return html2canvasPro(element, {
|
|
6948
6968
|
...options,
|
|
6949
6969
|
onclone: async (doc, clonedEl) => {
|
|
6950
|
-
await
|
|
6951
|
-
|
|
6970
|
+
await chunk4SPZ5IZN_js.normalizeColorsForCapture(doc, clonedEl);
|
|
6971
|
+
chunk4SPZ5IZN_js.preprocessCssForCapture(clonedEl);
|
|
6952
6972
|
if (typeof userOnClone === "function") {
|
|
6953
6973
|
userOnClone(doc, clonedEl);
|
|
6954
6974
|
}
|
|
@@ -6978,7 +6998,7 @@ function useExportSaveAs(input) {
|
|
|
6978
6998
|
slideSizeEmu
|
|
6979
6999
|
} = input;
|
|
6980
7000
|
const handleSaveAsFormat = async (format) => {
|
|
6981
|
-
const downloadName =
|
|
7001
|
+
const downloadName = chunk4SPZ5IZN_js.savedPresentationFileName(filePath, format);
|
|
6982
7002
|
try {
|
|
6983
7003
|
const data = await serializeSlides(format);
|
|
6984
7004
|
if (!data) {
|
|
@@ -6986,16 +7006,16 @@ function useExportSaveAs(input) {
|
|
|
6986
7006
|
}
|
|
6987
7007
|
const mimeType = format === "ppt" ? "application/vnd.ms-powerpoint" : "application/vnd.openxmlformats-officedocument.presentationml.presentation";
|
|
6988
7008
|
const blob = new Blob([data], { type: mimeType });
|
|
6989
|
-
|
|
7009
|
+
chunk4SPZ5IZN_js.downloadBlob(blob, downloadName);
|
|
6990
7010
|
} catch (err) {
|
|
6991
7011
|
console.error(`[PowerPointViewer] Save as .${format} failed:`, err);
|
|
6992
7012
|
}
|
|
6993
7013
|
};
|
|
6994
7014
|
const handleExportJson = () => {
|
|
6995
7015
|
const sourceName = filePath ? filePath.replace(/\\/gu, "/").split("/").pop() : void 0;
|
|
6996
|
-
const slideSize =
|
|
7016
|
+
const slideSize = chunk4SPZ5IZN_js.resolveSlideSizeSelection({ current: slideSizeEmu, canvas: canvasSize }).size;
|
|
6997
7017
|
const data = {
|
|
6998
|
-
slides:
|
|
7018
|
+
slides: chunk4SPZ5IZN_js.buildSaveSlides(slides, templateElementsBySlideId),
|
|
6999
7019
|
width: canvasSize.width,
|
|
7000
7020
|
height: canvasSize.height,
|
|
7001
7021
|
widthEmu: slideSize.widthEmu,
|
|
@@ -7014,7 +7034,7 @@ function useExportSaveAs(input) {
|
|
|
7014
7034
|
handoutMaster
|
|
7015
7035
|
};
|
|
7016
7036
|
try {
|
|
7017
|
-
|
|
7037
|
+
chunk4SPZ5IZN_js.exportDeckJson(data, sourceName);
|
|
7018
7038
|
} catch (err) {
|
|
7019
7039
|
console.error("[PowerPointViewer] JSON export failed:", err);
|
|
7020
7040
|
}
|
|
@@ -7079,7 +7099,7 @@ function buildRasterOptions(element, scale, backgroundColor, mode) {
|
|
|
7079
7099
|
}
|
|
7080
7100
|
async function renderElementToRaster(element, scale = 2, backgroundColor, mode = "auto") {
|
|
7081
7101
|
const { width, height } = measureNaturalSize(element);
|
|
7082
|
-
return
|
|
7102
|
+
return chunk4SPZ5IZN_js.rasterizeElement(
|
|
7083
7103
|
element,
|
|
7084
7104
|
width,
|
|
7085
7105
|
height,
|
|
@@ -7089,7 +7109,7 @@ async function renderElementToRaster(element, scale = 2, backgroundColor, mode =
|
|
|
7089
7109
|
}
|
|
7090
7110
|
async function renderElementToTiles(element, scale = 2, backgroundColor, mode = "auto") {
|
|
7091
7111
|
const { width, height } = measureNaturalSize(element);
|
|
7092
|
-
return
|
|
7112
|
+
return chunk4SPZ5IZN_js.rasterizeElementTiles(
|
|
7093
7113
|
element,
|
|
7094
7114
|
width,
|
|
7095
7115
|
height,
|
|
@@ -7099,7 +7119,7 @@ async function renderElementToTiles(element, scale = 2, backgroundColor, mode =
|
|
|
7099
7119
|
}
|
|
7100
7120
|
async function renderElementToTiledCanvas(element, scale = 2, backgroundColor, mode = "auto") {
|
|
7101
7121
|
const { width, height } = measureNaturalSize(element);
|
|
7102
|
-
return
|
|
7122
|
+
return chunk4SPZ5IZN_js.rasterizeElementTiledToCanvas(
|
|
7103
7123
|
element,
|
|
7104
7124
|
width,
|
|
7105
7125
|
height,
|
|
@@ -7121,11 +7141,11 @@ function waitForRender(ms = 100) {
|
|
|
7121
7141
|
async function exportSlideToPngBlob(slideElement, options = {}) {
|
|
7122
7142
|
const { scale = 2, backgroundColor } = options;
|
|
7123
7143
|
const result = await renderElementToRaster(slideElement, scale, backgroundColor);
|
|
7124
|
-
return
|
|
7144
|
+
return chunk4SPZ5IZN_js.rasterResultToPngBlob(result);
|
|
7125
7145
|
}
|
|
7126
7146
|
async function exportSlideAsPng(slideElement, slideIndex, options = {}) {
|
|
7127
7147
|
const blob = await exportSlideToPngBlob(slideElement, options);
|
|
7128
|
-
|
|
7148
|
+
chunk4SPZ5IZN_js.downloadBlob(blob, `slide-${slideIndex + 1}.png`);
|
|
7129
7149
|
}
|
|
7130
7150
|
async function copySlideToClipboard(slideElement, options = {}) {
|
|
7131
7151
|
const blob = await exportSlideToPngBlob(slideElement, options);
|
|
@@ -7154,13 +7174,13 @@ async function captureAllSlidesAsPngDataUrls(slideStageRef, totalSlides, setActi
|
|
|
7154
7174
|
// src/viewer/utils/export-pdf.ts
|
|
7155
7175
|
function tilesToPdfPage(tilesResult) {
|
|
7156
7176
|
return tilesResult.tiles.map((tile) => ({
|
|
7157
|
-
image:
|
|
7158
|
-
placement:
|
|
7177
|
+
image: chunk4SPZ5IZN_js.canvasToJpegData(tile.canvas),
|
|
7178
|
+
placement: chunk4SPZ5IZN_js.placeTileOnPage(
|
|
7159
7179
|
tile,
|
|
7160
7180
|
tilesResult.fullWidth,
|
|
7161
7181
|
tilesResult.fullHeight,
|
|
7162
|
-
|
|
7163
|
-
|
|
7182
|
+
chunk4SPZ5IZN_js.PDF_SLIDES_PAGE_WIDTH_PT,
|
|
7183
|
+
chunk4SPZ5IZN_js.PDF_SLIDES_PAGE_HEIGHT_PT
|
|
7164
7184
|
)
|
|
7165
7185
|
}));
|
|
7166
7186
|
}
|
|
@@ -7187,8 +7207,8 @@ async function exportAllSlidesAsPdf(slideStageRef, totalSlides, setActiveSlide,
|
|
|
7187
7207
|
if (pages.length === 0) {
|
|
7188
7208
|
throw new Error(chunk3AJ54EAB_js.translationsEn["pptx.export.errorNoSlidesPdf"]);
|
|
7189
7209
|
}
|
|
7190
|
-
const pdfBlobUrl =
|
|
7191
|
-
|
|
7210
|
+
const pdfBlobUrl = chunkNJ3WCYYG_js.buildPdfFromTiledImageData(pages);
|
|
7211
|
+
chunk4SPZ5IZN_js.downloadDataUrl(pdfBlobUrl, filename);
|
|
7192
7212
|
}
|
|
7193
7213
|
async function exportAllSlidesAsNotesPdf(slideStageRef, totalSlides, setActiveSlide, currentSlideIndex, slideNotes, filename = "presentation-notes.pdf", options = {}) {
|
|
7194
7214
|
const { scale = 2, onProgress, signal } = options;
|
|
@@ -7217,8 +7237,8 @@ async function exportAllSlidesAsNotesPdf(slideStageRef, totalSlides, setActiveSl
|
|
|
7217
7237
|
if (pages.length === 0) {
|
|
7218
7238
|
throw new Error(chunk3AJ54EAB_js.translationsEn["pptx.export.errorNoSlidesNotesPdf"]);
|
|
7219
7239
|
}
|
|
7220
|
-
const pdfDataUrl =
|
|
7221
|
-
|
|
7240
|
+
const pdfDataUrl = chunkNJ3WCYYG_js.buildNotesPdf(pages);
|
|
7241
|
+
chunk4SPZ5IZN_js.downloadDataUrl(pdfDataUrl, filename);
|
|
7222
7242
|
}
|
|
7223
7243
|
|
|
7224
7244
|
// src/viewer/utils/export-video.ts
|
|
@@ -7262,7 +7282,7 @@ async function exportAllSlidesAsVideo(slideStageRef, totalSlides, setActiveSlide
|
|
|
7262
7282
|
const fps = 30;
|
|
7263
7283
|
const stream = recordingCanvas.captureStream(fps);
|
|
7264
7284
|
const recorder = new MediaRecorder(stream, {
|
|
7265
|
-
mimeType:
|
|
7285
|
+
mimeType: chunk4SPZ5IZN_js.pickSupportedMimeType([...chunk4SPZ5IZN_js.WEBM_MIME_CANDIDATES]),
|
|
7266
7286
|
videoBitsPerSecond: 5e6
|
|
7267
7287
|
});
|
|
7268
7288
|
const chunks = [];
|
|
@@ -7285,8 +7305,8 @@ async function exportAllSlidesAsVideo(slideStageRef, totalSlides, setActiveSlide
|
|
|
7285
7305
|
const duration = slideTimingsMs?.[i] ?? slideDurationMs;
|
|
7286
7306
|
ctx.clearRect(0, 0, recordingCanvas.width, recordingCanvas.height);
|
|
7287
7307
|
ctx.drawImage(slideCanvases[i], 0, 0);
|
|
7288
|
-
const frameInterval =
|
|
7289
|
-
const framesNeeded =
|
|
7308
|
+
const frameInterval = chunk4SPZ5IZN_js.fpsToFrameIntervalMs(fps);
|
|
7309
|
+
const framesNeeded = chunk4SPZ5IZN_js.segmentFrameCount(duration, fps);
|
|
7290
7310
|
for (let f = 0; f < framesNeeded; f++) {
|
|
7291
7311
|
if (signal?.aborted) {
|
|
7292
7312
|
recorder.stop();
|
|
@@ -7306,7 +7326,7 @@ async function exportAllSlidesAsVideo(slideStageRef, totalSlides, setActiveSlide
|
|
|
7306
7326
|
|
|
7307
7327
|
// src/viewer/utils/export-gif.ts
|
|
7308
7328
|
function frameFromCanvas(canvas, maxSide) {
|
|
7309
|
-
const { width, height } =
|
|
7329
|
+
const { width, height } = chunk4SPZ5IZN_js.clampGifDimensions(canvas.width, canvas.height, maxSide);
|
|
7310
7330
|
let source = canvas;
|
|
7311
7331
|
if (width !== canvas.width || height !== canvas.height) {
|
|
7312
7332
|
const scaled = canvas.ownerDocument.createElement("canvas");
|
|
@@ -7329,7 +7349,7 @@ async function exportAllSlidesAsGif(slideStageRef, totalSlides, setActiveSlide,
|
|
|
7329
7349
|
const {
|
|
7330
7350
|
scale = 0.5,
|
|
7331
7351
|
slideDurationMs = 2e3,
|
|
7332
|
-
maxSide =
|
|
7352
|
+
maxSide = chunk4SPZ5IZN_js.GIF_POST_CAPTURE_MAX_SIDE,
|
|
7333
7353
|
onProgress,
|
|
7334
7354
|
signal
|
|
7335
7355
|
} = options;
|
|
@@ -7356,7 +7376,7 @@ async function exportAllSlidesAsGif(slideStageRef, totalSlides, setActiveSlide,
|
|
|
7356
7376
|
if (frames.length === 0) {
|
|
7357
7377
|
throw new Error(chunk3AJ54EAB_js.translationsEn["pptx.export.errorNoSlidesGif"]);
|
|
7358
7378
|
}
|
|
7359
|
-
const gifBytes =
|
|
7379
|
+
const gifBytes = chunk4SPZ5IZN_js.encodeGif(frames, Math.round(slideDurationMs / 10));
|
|
7360
7380
|
onProgress?.(totalSlides, totalSlides);
|
|
7361
7381
|
const buf = new ArrayBuffer(gifBytes.length);
|
|
7362
7382
|
new Uint8Array(buf).set(gifBytes);
|
|
@@ -7410,7 +7430,7 @@ function exportAllSlidesToSvg(data, options = {}) {
|
|
|
7410
7430
|
continue;
|
|
7411
7431
|
}
|
|
7412
7432
|
onProgress?.(processedCount, data.slides.length);
|
|
7413
|
-
let svg =
|
|
7433
|
+
let svg = chunk4SPZ5IZN_js.SvgExporter.exportSlide(slide, data.width, data.height, svgOptions);
|
|
7414
7434
|
if (embedFonts && fontFaces?.length) {
|
|
7415
7435
|
svg = injectFontFaces(svg, fontFaces);
|
|
7416
7436
|
}
|
|
@@ -7462,7 +7482,7 @@ function useExportMediaHandlers(input) {
|
|
|
7462
7482
|
setExportProgress(0);
|
|
7463
7483
|
setExportModalOpen(true);
|
|
7464
7484
|
try {
|
|
7465
|
-
const { scale } =
|
|
7485
|
+
const { scale } = chunk4SPZ5IZN_js.resolveExportCaptureDecision(imageResolutionScale, "video");
|
|
7466
7486
|
const blob = await exportAllSlidesAsVideo(
|
|
7467
7487
|
canvasStageRef,
|
|
7468
7488
|
slides.length,
|
|
@@ -7472,22 +7492,22 @@ function useExportMediaHandlers(input) {
|
|
|
7472
7492
|
scale,
|
|
7473
7493
|
slideDurationMs: 3e3,
|
|
7474
7494
|
onProgress: (current, total) => {
|
|
7475
|
-
setExportProgress(
|
|
7476
|
-
setExportStatusMessage(
|
|
7495
|
+
setExportProgress(chunk4SPZ5IZN_js.slideProgressPercent(current, total, 45));
|
|
7496
|
+
setExportStatusMessage(chunk4SPZ5IZN_js.slideStatusLabel("Capturing", current, total));
|
|
7477
7497
|
},
|
|
7478
7498
|
onRecordProgress: (current, total) => {
|
|
7479
|
-
setExportProgress(
|
|
7480
|
-
setExportStatusMessage(
|
|
7499
|
+
setExportProgress(chunk4SPZ5IZN_js.recordProgressPercent(current, total));
|
|
7500
|
+
setExportStatusMessage(chunk4SPZ5IZN_js.slideStatusLabel("Recording", current, total));
|
|
7481
7501
|
},
|
|
7482
7502
|
signal: abortCtrl.signal
|
|
7483
7503
|
}
|
|
7484
7504
|
);
|
|
7485
|
-
setExportProgress(
|
|
7505
|
+
setExportProgress(chunk4SPZ5IZN_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7486
7506
|
setExportStatusMessage("Saving file...");
|
|
7487
|
-
|
|
7488
|
-
setExportProgress(
|
|
7507
|
+
chunk4SPZ5IZN_js.downloadBlob(blob, "presentation.webm");
|
|
7508
|
+
setExportProgress(chunk4SPZ5IZN_js.EXPORT_DONE_PERCENT);
|
|
7489
7509
|
} catch (err) {
|
|
7490
|
-
if (!
|
|
7510
|
+
if (!chunk4SPZ5IZN_js.isExportAbortError(err)) {
|
|
7491
7511
|
console.error("[PowerPointViewer] Video export failed:", err);
|
|
7492
7512
|
}
|
|
7493
7513
|
} finally {
|
|
@@ -7517,7 +7537,7 @@ function useExportMediaHandlers(input) {
|
|
|
7517
7537
|
setExportProgress(0);
|
|
7518
7538
|
setExportModalOpen(true);
|
|
7519
7539
|
try {
|
|
7520
|
-
const { scale, postCaptureMaxSide } =
|
|
7540
|
+
const { scale, postCaptureMaxSide } = chunk4SPZ5IZN_js.resolveExportCaptureDecision(
|
|
7521
7541
|
imageResolutionScale,
|
|
7522
7542
|
"gif"
|
|
7523
7543
|
);
|
|
@@ -7531,18 +7551,18 @@ function useExportMediaHandlers(input) {
|
|
|
7531
7551
|
maxSide: postCaptureMaxSide,
|
|
7532
7552
|
slideDurationMs: 2e3,
|
|
7533
7553
|
onProgress: (current, total) => {
|
|
7534
|
-
setExportProgress(
|
|
7535
|
-
setExportStatusMessage(
|
|
7554
|
+
setExportProgress(chunk4SPZ5IZN_js.slideProgressPercent(current, total));
|
|
7555
|
+
setExportStatusMessage(chunk4SPZ5IZN_js.slideStatusLabel("Encoding", current, total));
|
|
7536
7556
|
},
|
|
7537
7557
|
signal: abortCtrl.signal
|
|
7538
7558
|
}
|
|
7539
7559
|
);
|
|
7540
|
-
setExportProgress(
|
|
7560
|
+
setExportProgress(chunk4SPZ5IZN_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7541
7561
|
setExportStatusMessage("Saving file...");
|
|
7542
|
-
|
|
7543
|
-
setExportProgress(
|
|
7562
|
+
chunk4SPZ5IZN_js.downloadBlob(blob, "presentation.gif");
|
|
7563
|
+
setExportProgress(chunk4SPZ5IZN_js.EXPORT_DONE_PERCENT);
|
|
7544
7564
|
} catch (err) {
|
|
7545
|
-
if (!
|
|
7565
|
+
if (!chunk4SPZ5IZN_js.isExportAbortError(err)) {
|
|
7546
7566
|
console.error("[PowerPointViewer] GIF export failed:", err);
|
|
7547
7567
|
}
|
|
7548
7568
|
} finally {
|
|
@@ -7668,21 +7688,21 @@ function useExportHandlers(input) {
|
|
|
7668
7688
|
{
|
|
7669
7689
|
scale: imageExportScale,
|
|
7670
7690
|
onProgress: (current, total) => {
|
|
7671
|
-
setExportProgress(
|
|
7672
|
-
setExportStatusMessage(
|
|
7691
|
+
setExportProgress(chunk4SPZ5IZN_js.slideProgressPercent(current, total));
|
|
7692
|
+
setExportStatusMessage(chunk4SPZ5IZN_js.slideStatusLabel("Rendering", current, total));
|
|
7673
7693
|
},
|
|
7674
7694
|
signal: abortCtrl.signal
|
|
7675
7695
|
}
|
|
7676
7696
|
);
|
|
7677
|
-
setExportProgress(
|
|
7697
|
+
setExportProgress(chunk4SPZ5IZN_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7678
7698
|
setExportStatusMessage("Building PDF...");
|
|
7679
7699
|
await new Promise((r) => {
|
|
7680
7700
|
setTimeout(r, 100);
|
|
7681
7701
|
});
|
|
7682
|
-
setExportProgress(
|
|
7702
|
+
setExportProgress(chunk4SPZ5IZN_js.EXPORT_DONE_PERCENT);
|
|
7683
7703
|
setExportStatusMessage("Done!");
|
|
7684
7704
|
} catch (err) {
|
|
7685
|
-
if (!
|
|
7705
|
+
if (!chunk4SPZ5IZN_js.isExportAbortError(err)) {
|
|
7686
7706
|
console.error("[PowerPointViewer] PDF export failed:", err);
|
|
7687
7707
|
}
|
|
7688
7708
|
} finally {
|
|
@@ -7712,21 +7732,21 @@ function useExportHandlers(input) {
|
|
|
7712
7732
|
{
|
|
7713
7733
|
scale: imageExportScale,
|
|
7714
7734
|
onProgress: (current, total) => {
|
|
7715
|
-
setExportProgress(
|
|
7716
|
-
setExportStatusMessage(
|
|
7735
|
+
setExportProgress(chunk4SPZ5IZN_js.slideProgressPercent(current, total));
|
|
7736
|
+
setExportStatusMessage(chunk4SPZ5IZN_js.slideStatusLabel("Rendering", current, total));
|
|
7717
7737
|
},
|
|
7718
7738
|
signal: abortCtrl.signal
|
|
7719
7739
|
}
|
|
7720
7740
|
);
|
|
7721
|
-
setExportProgress(
|
|
7741
|
+
setExportProgress(chunk4SPZ5IZN_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7722
7742
|
setExportStatusMessage("Building PDF...");
|
|
7723
7743
|
await new Promise((r) => {
|
|
7724
7744
|
setTimeout(r, 100);
|
|
7725
7745
|
});
|
|
7726
|
-
setExportProgress(
|
|
7746
|
+
setExportProgress(chunk4SPZ5IZN_js.EXPORT_DONE_PERCENT);
|
|
7727
7747
|
setExportStatusMessage("Done!");
|
|
7728
7748
|
} catch (err) {
|
|
7729
|
-
if (!
|
|
7749
|
+
if (!chunk4SPZ5IZN_js.isExportAbortError(err)) {
|
|
7730
7750
|
console.error("[PowerPointViewer] Notes PDF export failed:", err);
|
|
7731
7751
|
}
|
|
7732
7752
|
} finally {
|
|
@@ -7774,7 +7794,7 @@ function useExportHandlers(input) {
|
|
|
7774
7794
|
exportStatusMessage
|
|
7775
7795
|
};
|
|
7776
7796
|
}
|
|
7777
|
-
var ViewerOptionsContext = react.createContext(
|
|
7797
|
+
var ViewerOptionsContext = react.createContext(chunk4SPZ5IZN_js.DEFAULT_VIEWER_OPTIONS);
|
|
7778
7798
|
function useViewerOptionsContext() {
|
|
7779
7799
|
return react.useContext(ViewerOptionsContext);
|
|
7780
7800
|
}
|
|
@@ -7786,13 +7806,13 @@ function usePrintHandlers(input) {
|
|
|
7786
7806
|
const { t } = reactI18next.useTranslation();
|
|
7787
7807
|
const viewerOptions = useViewerOptionsContext();
|
|
7788
7808
|
const includeHiddenSlides = viewerOptions.advanced.printHiddenSlides;
|
|
7789
|
-
const printRasterScale = (viewerOptions.advanced.printHighQuality ? 4 : 3) *
|
|
7809
|
+
const printRasterScale = (viewerOptions.advanced.printHighQuality ? 4 : 3) * chunk4SPZ5IZN_js.resolveImageResolutionScale(viewerOptions);
|
|
7790
7810
|
const handlePrint = () => {
|
|
7791
7811
|
setIsPrintDialogOpen(true);
|
|
7792
7812
|
};
|
|
7793
7813
|
const handlePrintSvg = async (settings) => {
|
|
7794
7814
|
setIsPrintDialogOpen(false);
|
|
7795
|
-
const printWindow =
|
|
7815
|
+
const printWindow = chunk4SPZ5IZN_js.openPendingPrintWindow(t("pptx.print.preparingToPrint"));
|
|
7796
7816
|
if (!printWindow) {
|
|
7797
7817
|
console.warn(
|
|
7798
7818
|
"[PowerPointViewer] Print window was blocked by the browser. Allow popups for this site to print."
|
|
@@ -7802,9 +7822,9 @@ function usePrintHandlers(input) {
|
|
|
7802
7822
|
if (!pptxData || settings.printWhat !== "slides") {
|
|
7803
7823
|
return runRasterPrint(printWindow, settings);
|
|
7804
7824
|
}
|
|
7805
|
-
const colorFilter =
|
|
7806
|
-
const slideIndices =
|
|
7807
|
-
|
|
7825
|
+
const colorFilter = chunk4SPZ5IZN_js.computeColorFilter(settings.colorMode);
|
|
7826
|
+
const slideIndices = chunk4SPZ5IZN_js.filterHiddenSlideIndices(
|
|
7827
|
+
chunk4SPZ5IZN_js.computeSlideIndices(
|
|
7808
7828
|
settings.slideRange,
|
|
7809
7829
|
activeSlideIndex,
|
|
7810
7830
|
slides.length,
|
|
@@ -7822,22 +7842,22 @@ function usePrintHandlers(input) {
|
|
|
7822
7842
|
printWindow.close();
|
|
7823
7843
|
return;
|
|
7824
7844
|
}
|
|
7825
|
-
const printDoc =
|
|
7845
|
+
const printDoc = chunk4SPZ5IZN_js.buildPrintDocument(svgs, pptxData.width, pptxData.height, {
|
|
7826
7846
|
title: "Slides (Vector)",
|
|
7827
7847
|
orientation: settings.orientation,
|
|
7828
7848
|
colorFilter,
|
|
7829
7849
|
scaleToFit: settings.scaleToFit
|
|
7830
7850
|
});
|
|
7831
|
-
|
|
7851
|
+
chunk4SPZ5IZN_js.finishPrintWindow(printWindow, printDoc);
|
|
7832
7852
|
} catch (err) {
|
|
7833
7853
|
console.warn("[PowerPointViewer] SVG print path failed, falling back to raster:", err);
|
|
7834
7854
|
return runRasterPrint(printWindow, settings);
|
|
7835
7855
|
}
|
|
7836
7856
|
};
|
|
7837
7857
|
const runRasterPrint = async (printWindow, settings) => {
|
|
7838
|
-
const colorFilter =
|
|
7839
|
-
const slideIndices =
|
|
7840
|
-
|
|
7858
|
+
const colorFilter = chunk4SPZ5IZN_js.computeColorFilter(settings.colorMode);
|
|
7859
|
+
const slideIndices = chunk4SPZ5IZN_js.filterHiddenSlideIndices(
|
|
7860
|
+
chunk4SPZ5IZN_js.computeSlideIndices(
|
|
7841
7861
|
settings.slideRange,
|
|
7842
7862
|
activeSlideIndex,
|
|
7843
7863
|
slides.length,
|
|
@@ -7848,11 +7868,11 @@ function usePrintHandlers(input) {
|
|
|
7848
7868
|
includeHiddenSlides
|
|
7849
7869
|
);
|
|
7850
7870
|
if (settings.printWhat === "outline") {
|
|
7851
|
-
|
|
7871
|
+
chunk4SPZ5IZN_js.finishPrintWindow(
|
|
7852
7872
|
printWindow,
|
|
7853
|
-
|
|
7873
|
+
chunk4SPZ5IZN_js.buildPrintHtmlDocument({
|
|
7854
7874
|
title: "Outline",
|
|
7855
|
-
bodyHtml: `<div class="outline-page">${
|
|
7875
|
+
bodyHtml: `<div class="outline-page">${chunk4SPZ5IZN_js.buildOutlineHtml(slideIndices, slides)}</div>`,
|
|
7856
7876
|
orientation: settings.orientation,
|
|
7857
7877
|
colorFilter,
|
|
7858
7878
|
frameSlides: settings.frameSlides,
|
|
@@ -7879,11 +7899,11 @@ function usePrintHandlers(input) {
|
|
|
7879
7899
|
}
|
|
7880
7900
|
const slideImages = slideIndices.map((idx) => allImages[idx]).filter(Boolean);
|
|
7881
7901
|
if (settings.printWhat === "slides") {
|
|
7882
|
-
|
|
7902
|
+
chunk4SPZ5IZN_js.finishPrintWindow(
|
|
7883
7903
|
printWindow,
|
|
7884
|
-
|
|
7904
|
+
chunk4SPZ5IZN_js.buildPrintHtmlDocument({
|
|
7885
7905
|
title: "Slides",
|
|
7886
|
-
bodyHtml:
|
|
7906
|
+
bodyHtml: chunk4SPZ5IZN_js.buildSlidesHtml(slideImages, slideIndices),
|
|
7887
7907
|
orientation: settings.orientation,
|
|
7888
7908
|
colorFilter,
|
|
7889
7909
|
frameSlides: settings.frameSlides,
|
|
@@ -7893,11 +7913,11 @@ function usePrintHandlers(input) {
|
|
|
7893
7913
|
return;
|
|
7894
7914
|
}
|
|
7895
7915
|
if (settings.printWhat === "notes") {
|
|
7896
|
-
|
|
7916
|
+
chunk4SPZ5IZN_js.finishPrintWindow(
|
|
7897
7917
|
printWindow,
|
|
7898
|
-
|
|
7918
|
+
chunk4SPZ5IZN_js.buildPrintHtmlDocument({
|
|
7899
7919
|
title: "Notes Pages",
|
|
7900
|
-
bodyHtml:
|
|
7920
|
+
bodyHtml: chunk4SPZ5IZN_js.buildNotesHtml(slideImages, slideIndices, slides),
|
|
7901
7921
|
orientation: "portrait",
|
|
7902
7922
|
colorFilter,
|
|
7903
7923
|
frameSlides: settings.frameSlides,
|
|
@@ -7908,11 +7928,11 @@ function usePrintHandlers(input) {
|
|
|
7908
7928
|
}
|
|
7909
7929
|
if (settings.printWhat === "handouts") {
|
|
7910
7930
|
const spp = settings.slidesPerPage;
|
|
7911
|
-
|
|
7931
|
+
chunk4SPZ5IZN_js.finishPrintWindow(
|
|
7912
7932
|
printWindow,
|
|
7913
|
-
|
|
7933
|
+
chunk4SPZ5IZN_js.buildPrintHtmlDocument({
|
|
7914
7934
|
title: `Handout ${spp} per page`,
|
|
7915
|
-
bodyHtml:
|
|
7935
|
+
bodyHtml: chunk4SPZ5IZN_js.buildHandoutsHtml(slideImages, slideIndices, spp, pptxData?.handoutMaster),
|
|
7916
7936
|
orientation: "portrait",
|
|
7917
7937
|
colorFilter,
|
|
7918
7938
|
frameSlides: settings.frameSlides,
|
|
@@ -7926,7 +7946,7 @@ function usePrintHandlers(input) {
|
|
|
7926
7946
|
};
|
|
7927
7947
|
const handlePrintWithSettings = async (settings) => {
|
|
7928
7948
|
setIsPrintDialogOpen(false);
|
|
7929
|
-
const printWindow =
|
|
7949
|
+
const printWindow = chunk4SPZ5IZN_js.openPendingPrintWindow(t("pptx.print.preparingToPrint"));
|
|
7930
7950
|
if (!printWindow) {
|
|
7931
7951
|
console.warn(
|
|
7932
7952
|
"[PowerPointViewer] Print window was blocked by the browser. Allow popups for this site to print."
|
|
@@ -7991,13 +8011,13 @@ function useThemeHandlers(input) {
|
|
|
7991
8011
|
return;
|
|
7992
8012
|
}
|
|
7993
8013
|
await handler.updateThemeColorScheme(colorScheme);
|
|
7994
|
-
const previousMap = theme?.colorScheme ?
|
|
7995
|
-
setSlides((prev) =>
|
|
8014
|
+
const previousMap = theme?.colorScheme ? chunk4SPZ5IZN_js.buildThemeColorMap(theme.colorScheme) : {};
|
|
8015
|
+
setSlides((prev) => chunk4SPZ5IZN_js.reResolveSlideColors(prev, previousMap, colorScheme));
|
|
7996
8016
|
if (Object.keys(templateElementsBySlideId).length > 0) {
|
|
7997
8017
|
setTemplateElementsBySlideId((prev) => {
|
|
7998
8018
|
const next = {};
|
|
7999
8019
|
for (const [slideId, elements] of Object.entries(prev)) {
|
|
8000
|
-
next[slideId] =
|
|
8020
|
+
next[slideId] = chunk4SPZ5IZN_js.reResolveElementColors(elements, previousMap, colorScheme);
|
|
8001
8021
|
}
|
|
8002
8022
|
return next;
|
|
8003
8023
|
});
|
|
@@ -8106,7 +8126,7 @@ function useThemeSwitching(input) {
|
|
|
8106
8126
|
}
|
|
8107
8127
|
try {
|
|
8108
8128
|
await handler.applyTheme(preset.colorScheme, preset.fontScheme, preset.name);
|
|
8109
|
-
const newData =
|
|
8129
|
+
const newData = chunk4SPZ5IZN_js.applyThemeToData(data, preset.colorScheme, preset.fontScheme, preset.name);
|
|
8110
8130
|
onDataChange(newData);
|
|
8111
8131
|
onThemeChanged?.(preset);
|
|
8112
8132
|
} catch (error) {
|
|
@@ -8123,7 +8143,7 @@ function useThemeSwitching(input) {
|
|
|
8123
8143
|
}
|
|
8124
8144
|
try {
|
|
8125
8145
|
await handler.applyTheme(colorScheme, fontScheme ?? {}, themeName);
|
|
8126
|
-
const newData =
|
|
8146
|
+
const newData = chunk4SPZ5IZN_js.applyThemeToData(data, colorScheme, fontScheme, themeName);
|
|
8127
8147
|
onDataChange(newData);
|
|
8128
8148
|
} catch (error) {
|
|
8129
8149
|
console.error("Failed to switch to custom theme:", error);
|
|
@@ -8135,12 +8155,12 @@ function useThemeSwitching(input) {
|
|
|
8135
8155
|
if (!data?.theme?.colorScheme) {
|
|
8136
8156
|
return void 0;
|
|
8137
8157
|
}
|
|
8138
|
-
return
|
|
8139
|
-
(p) =>
|
|
8158
|
+
return chunk4SPZ5IZN_js.THEME_PRESETS.find(
|
|
8159
|
+
(p) => chunk4SPZ5IZN_js.themeColorSchemesEqual(data.theme?.colorScheme, p.colorScheme)
|
|
8140
8160
|
);
|
|
8141
8161
|
}, [data?.theme?.colorScheme]);
|
|
8142
8162
|
return {
|
|
8143
|
-
presets:
|
|
8163
|
+
presets: chunk4SPZ5IZN_js.THEME_PRESETS,
|
|
8144
8164
|
switchToPreset,
|
|
8145
8165
|
switchToCustom,
|
|
8146
8166
|
currentPreset
|
|
@@ -8215,7 +8235,7 @@ function usePropertyHandlers(input) {
|
|
|
8215
8235
|
}
|
|
8216
8236
|
try {
|
|
8217
8237
|
const ab = await file.arrayBuffer();
|
|
8218
|
-
const h = new
|
|
8238
|
+
const h = new chunk4SPZ5IZN_js.PptxHandler();
|
|
8219
8239
|
const other = await h.load(ab);
|
|
8220
8240
|
if (!other) {
|
|
8221
8241
|
return;
|
|
@@ -8225,7 +8245,7 @@ function usePropertyHandlers(input) {
|
|
|
8225
8245
|
width: canvasSize.width,
|
|
8226
8246
|
height: canvasSize.height
|
|
8227
8247
|
};
|
|
8228
|
-
setCompareResult(
|
|
8248
|
+
setCompareResult(chunk4SPZ5IZN_js.comparePresentation(cur, other));
|
|
8229
8249
|
setIsComparePanelOpen(true);
|
|
8230
8250
|
} catch (err) {
|
|
8231
8251
|
console.warn("Compare failed:", err);
|
|
@@ -8242,7 +8262,7 @@ function usePropertyHandlers(input) {
|
|
|
8242
8262
|
if (!diff || diff.status === "unchanged") {
|
|
8243
8263
|
return;
|
|
8244
8264
|
}
|
|
8245
|
-
setSlides((prev) =>
|
|
8265
|
+
setSlides((prev) => chunk4SPZ5IZN_js.applyAcceptSlide(prev, diff));
|
|
8246
8266
|
setIsDirty(true);
|
|
8247
8267
|
},
|
|
8248
8268
|
[compareResult, setSlides, setIsDirty]
|
|
@@ -8253,10 +8273,10 @@ function usePropertyHandlers(input) {
|
|
|
8253
8273
|
if (!compareResult) {
|
|
8254
8274
|
return;
|
|
8255
8275
|
}
|
|
8256
|
-
setSlides((prev) =>
|
|
8276
|
+
setSlides((prev) => chunk4SPZ5IZN_js.applyAcceptAllSlides(prev, compareResult));
|
|
8257
8277
|
setIsDirty(true);
|
|
8258
8278
|
}, [compareResult, setSlides, setIsDirty]);
|
|
8259
|
-
const usedFontFamilies = react.useMemo(() =>
|
|
8279
|
+
const usedFontFamilies = react.useMemo(() => chunk4SPZ5IZN_js.collectUsedFonts(slides), [slides]);
|
|
8260
8280
|
return {
|
|
8261
8281
|
handleUpdateNotes,
|
|
8262
8282
|
handleUpdateSlide,
|
|
@@ -8411,7 +8431,7 @@ function useViewerDialogs(input) {
|
|
|
8411
8431
|
);
|
|
8412
8432
|
const embeddedFontKey = (embeddedFontFamilies ?? []).join("\0");
|
|
8413
8433
|
const fontEmbedding = react.useMemo(
|
|
8414
|
-
() =>
|
|
8434
|
+
() => chunk4SPZ5IZN_js.describeFontEmbedding(embeddedFontKey ? embeddedFontKey.split("\0") : []),
|
|
8415
8435
|
[embeddedFontKey]
|
|
8416
8436
|
);
|
|
8417
8437
|
const [embedFontsEnabled, setEmbedFontsEnabled] = react.useState(fontEmbedding.initialEnabled);
|
|
@@ -8421,11 +8441,11 @@ function useViewerDialogs(input) {
|
|
|
8421
8441
|
setEmbedFontsEnabled(fontEmbedding.initialEnabled);
|
|
8422
8442
|
}
|
|
8423
8443
|
const [isNarrowViewport, setIsNarrowViewport] = react.useState(
|
|
8424
|
-
() => typeof window !== "undefined" ?
|
|
8444
|
+
() => typeof window !== "undefined" ? chunk4SPZ5IZN_js.isMobileViewport(window.innerWidth, window.innerHeight, viewportIsTouch()) : false
|
|
8425
8445
|
);
|
|
8426
8446
|
react.useEffect(() => {
|
|
8427
8447
|
const handleWindow = () => setIsNarrowViewport(
|
|
8428
|
-
|
|
8448
|
+
chunk4SPZ5IZN_js.isMobileViewport(window.innerWidth, window.innerHeight, viewportIsTouch())
|
|
8429
8449
|
);
|
|
8430
8450
|
window.addEventListener("resize", handleWindow);
|
|
8431
8451
|
return () => window.removeEventListener("resize", handleWindow);
|
|
@@ -8578,16 +8598,16 @@ function useViewerDialogs(input) {
|
|
|
8578
8598
|
};
|
|
8579
8599
|
}
|
|
8580
8600
|
function computeGridSpacingPx2(documentGridSpacing) {
|
|
8581
|
-
return
|
|
8601
|
+
return chunk4SPZ5IZN_js.computeGridSpacingPx(documentGridSpacing, chunkNJ3WCYYG_js.GRID_SIZE);
|
|
8582
8602
|
}
|
|
8583
8603
|
function computeVisibleSlideIndexes(slides, activeCustomShowId, customShows, presentationProperties) {
|
|
8584
8604
|
const activeShow = activeCustomShowId ? customShows.find((show) => show.id === activeCustomShowId) : void 0;
|
|
8585
|
-
const authoredRange =
|
|
8586
|
-
return
|
|
8605
|
+
const authoredRange = chunk4SPZ5IZN_js.resolveAuthoredSlideRange(presentationProperties, slides.length);
|
|
8606
|
+
return chunk4SPZ5IZN_js.resolveShowSlideIndexes(slides, activeShow, authoredRange);
|
|
8587
8607
|
}
|
|
8588
8608
|
function computeSlideSectionGroups(slides, sections) {
|
|
8589
|
-
return
|
|
8590
|
-
id: group.section?.id ?? (sections.length > 0 ?
|
|
8609
|
+
return chunk4SPZ5IZN_js.groupSlidesBySection(sections, slides).map((group) => ({
|
|
8610
|
+
id: group.section?.id ?? (sections.length > 0 ? chunkNJ3WCYYG_js.UNGROUPED_SECTION_ID : chunkNJ3WCYYG_js.DEFAULT_SECTION_GROUP_ID),
|
|
8591
8611
|
label: group.section?.name ?? (sections.length > 0 ? "Ungrouped Slides" : "Slides"),
|
|
8592
8612
|
slideIndexes: group.slideIndexes,
|
|
8593
8613
|
...group.section?.color !== void 0 ? { color: group.section.color } : {},
|
|
@@ -8599,7 +8619,7 @@ function computeMasterPseudoSlide(mode, activeLayout, activeMaster) {
|
|
|
8599
8619
|
return void 0;
|
|
8600
8620
|
}
|
|
8601
8621
|
const document2 = activeLayout ? { slideMasters: [{ ...activeMaster, layouts: [activeLayout] }] } : { slideMasters: [activeMaster] };
|
|
8602
|
-
return
|
|
8622
|
+
return chunk4SPZ5IZN_js.masterViewPseudoSlide(document2, {
|
|
8603
8623
|
tab: "slides",
|
|
8604
8624
|
masterIndex: 0,
|
|
8605
8625
|
layoutIndex: activeLayout ? 0 : null
|
|
@@ -8627,15 +8647,15 @@ function useDerivedSlideState(input) {
|
|
|
8627
8647
|
[slides, activeCustomShowId, customShows, presentationProperties]
|
|
8628
8648
|
);
|
|
8629
8649
|
const authoredRange = react.useMemo(
|
|
8630
|
-
() =>
|
|
8650
|
+
() => chunk4SPZ5IZN_js.resolveAuthoredSlideRange(presentationProperties, slides.length),
|
|
8631
8651
|
[presentationProperties, slides.length]
|
|
8632
8652
|
);
|
|
8633
8653
|
const slideSectionGroups = react.useMemo(
|
|
8634
8654
|
() => computeSlideSectionGroups(slides, sections).map((group) => {
|
|
8635
|
-
if (group.id ===
|
|
8655
|
+
if (group.id === chunkNJ3WCYYG_js.UNGROUPED_SECTION_ID && group.label === "Ungrouped Slides") {
|
|
8636
8656
|
return { ...group, label: t("pptx.slides.ungroupedSlides") };
|
|
8637
8657
|
}
|
|
8638
|
-
if (group.id ===
|
|
8658
|
+
if (group.id === chunkNJ3WCYYG_js.DEFAULT_SECTION_GROUP_ID && group.label === "Slides") {
|
|
8639
8659
|
return { ...group, label: t("pptx.sections.slides") };
|
|
8640
8660
|
}
|
|
8641
8661
|
return group;
|
|
@@ -8736,13 +8756,13 @@ function useAnnotationHandlers(input) {
|
|
|
8736
8756
|
}, [annotations, setMode, setSlides, history]);
|
|
8737
8757
|
const handleSetMode = react.useCallback(
|
|
8738
8758
|
(nextMode) => {
|
|
8739
|
-
if (mode === "present" && nextMode !== "present" && !
|
|
8759
|
+
if (mode === "present" && nextMode !== "present" && !chunk4SPZ5IZN_js.mayLeaveSlideShow()) {
|
|
8740
8760
|
return;
|
|
8741
8761
|
}
|
|
8742
8762
|
if (nextMode === "present") {
|
|
8743
8763
|
presentation.enterPresentMode();
|
|
8744
8764
|
} else if (mode === "present" && annotations.hasAnyAnnotations) {
|
|
8745
|
-
|
|
8765
|
+
chunk4SPZ5IZN_js.stopAllPersistentAudio();
|
|
8746
8766
|
if (promptKeepInkAnnotations) {
|
|
8747
8767
|
pendingModeAfterAnnotationsRef.current = nextMode;
|
|
8748
8768
|
setShowKeepAnnotationsDialog(true);
|
|
@@ -8752,7 +8772,7 @@ function useAnnotationHandlers(input) {
|
|
|
8752
8772
|
}
|
|
8753
8773
|
} else {
|
|
8754
8774
|
if (mode === "present") {
|
|
8755
|
-
|
|
8775
|
+
chunk4SPZ5IZN_js.stopAllPersistentAudio();
|
|
8756
8776
|
}
|
|
8757
8777
|
setMode(nextMode);
|
|
8758
8778
|
}
|
|
@@ -8821,13 +8841,13 @@ function useSerialize(input) {
|
|
|
8821
8841
|
let processedSlide = slide;
|
|
8822
8842
|
if (pendingEditId) {
|
|
8823
8843
|
const updatedElements = slide.elements.map((el) => {
|
|
8824
|
-
if (el.id !== pendingEditId || !
|
|
8844
|
+
if (el.id !== pendingEditId || !chunk4SPZ5IZN_js.hasTextProperties(el)) {
|
|
8825
8845
|
return el;
|
|
8826
8846
|
}
|
|
8827
8847
|
return {
|
|
8828
8848
|
...el,
|
|
8829
8849
|
text: pendingEditText,
|
|
8830
|
-
textSegments:
|
|
8850
|
+
textSegments: chunk4SPZ5IZN_js.remapTextToSegments(pendingEditText, el.textSegments, el.textStyle)
|
|
8831
8851
|
};
|
|
8832
8852
|
});
|
|
8833
8853
|
if (updatedElements.some((el, i) => el !== slide.elements[i])) {
|
|
@@ -8840,19 +8860,19 @@ function useSerialize(input) {
|
|
|
8840
8860
|
const pptxGuides = guides.map((g) => ({
|
|
8841
8861
|
id: g.id,
|
|
8842
8862
|
orientation: g.axis === "h" ? "horz" : "vert",
|
|
8843
|
-
positionEmu:
|
|
8863
|
+
positionEmu: chunk4SPZ5IZN_js.guidePxToEmu(g.position)
|
|
8844
8864
|
}));
|
|
8845
8865
|
return {
|
|
8846
8866
|
...processedSlide,
|
|
8847
8867
|
guides: pptxGuides.length > 0 ? pptxGuides : void 0
|
|
8848
8868
|
};
|
|
8849
8869
|
});
|
|
8850
|
-
const slidesToSave =
|
|
8851
|
-
const saveOptions =
|
|
8870
|
+
const slidesToSave = chunk4SPZ5IZN_js.buildSaveSlides(slidesWithGuides, templateElementsBySlideId);
|
|
8871
|
+
const saveOptions = chunk4SPZ5IZN_js.buildDeckSaveOptions({
|
|
8852
8872
|
// Without this the Slide Size card edited a viewer-only pixel value and
|
|
8853
8873
|
// the saved `p:sldSz` never moved: passing `slideSize` is the only way a
|
|
8854
8874
|
// slide-size edit reaches the file.
|
|
8855
|
-
slideSize:
|
|
8875
|
+
slideSize: chunk4SPZ5IZN_js.resolveSlideSizeSelection({ current: slideSizeEmu, canvas: canvasSize }).size,
|
|
8856
8876
|
headerFooter,
|
|
8857
8877
|
presentationProperties,
|
|
8858
8878
|
viewProperties,
|
|
@@ -8871,7 +8891,7 @@ function useSerialize(input) {
|
|
|
8871
8891
|
embedFonts,
|
|
8872
8892
|
outputFormat: format
|
|
8873
8893
|
});
|
|
8874
|
-
return
|
|
8894
|
+
return chunk4SPZ5IZN_js.saveDeckWithPassword(handler, slidesToSave, saveOptions, { password, purpose });
|
|
8875
8895
|
},
|
|
8876
8896
|
[
|
|
8877
8897
|
slides,
|
|
@@ -8912,7 +8932,7 @@ function useRecoveryDetection(input) {
|
|
|
8912
8932
|
const onRestore = input.onRestore;
|
|
8913
8933
|
const openVersionHistory = input.openVersionHistory;
|
|
8914
8934
|
react.useEffect(() => {
|
|
8915
|
-
if (!
|
|
8935
|
+
if (!chunk4SPZ5IZN_js.shouldProbeAutosaveRecovery({
|
|
8916
8936
|
alreadyChecked: recoveryCheckedRef.current,
|
|
8917
8937
|
filePath,
|
|
8918
8938
|
loading,
|
|
@@ -8924,7 +8944,7 @@ function useRecoveryDetection(input) {
|
|
|
8924
8944
|
}
|
|
8925
8945
|
recoveryCheckedRef.current = true;
|
|
8926
8946
|
void (async () => {
|
|
8927
|
-
const offer = await
|
|
8947
|
+
const offer = await chunk4SPZ5IZN_js.probeAutosaveRecovery(filePath);
|
|
8928
8948
|
if (!offer) {
|
|
8929
8949
|
return;
|
|
8930
8950
|
}
|
|
@@ -8937,7 +8957,7 @@ function useRecoveryDetection(input) {
|
|
|
8937
8957
|
const record = recordRef.current;
|
|
8938
8958
|
setPrompt(null);
|
|
8939
8959
|
if (record && onRestore) {
|
|
8940
|
-
onRestore(
|
|
8960
|
+
onRestore(chunk4SPZ5IZN_js.acceptAutosaveRecovery(record));
|
|
8941
8961
|
}
|
|
8942
8962
|
recordRef.current = null;
|
|
8943
8963
|
}, [onRestore]);
|
|
@@ -8946,7 +8966,7 @@ function useRecoveryDetection(input) {
|
|
|
8946
8966
|
setPrompt(null);
|
|
8947
8967
|
recordRef.current = null;
|
|
8948
8968
|
if (record) {
|
|
8949
|
-
void
|
|
8969
|
+
void chunk4SPZ5IZN_js.discardAutosaveRecovery(record);
|
|
8950
8970
|
}
|
|
8951
8971
|
}, []);
|
|
8952
8972
|
return { prompt, restore, discard };
|
|
@@ -8997,11 +9017,11 @@ function usePresentationSetup(input) {
|
|
|
8997
9017
|
containerRef,
|
|
8998
9018
|
content,
|
|
8999
9019
|
onSetMode: (nextMode) => {
|
|
9000
|
-
if (mode === "present" && nextMode !== "present" && !
|
|
9020
|
+
if (mode === "present" && nextMode !== "present" && !chunk4SPZ5IZN_js.mayLeaveSlideShow()) {
|
|
9001
9021
|
return;
|
|
9002
9022
|
}
|
|
9003
9023
|
if (mode === "present" && nextMode !== "present") {
|
|
9004
|
-
|
|
9024
|
+
chunk4SPZ5IZN_js.stopAllPersistentAudio();
|
|
9005
9025
|
stopAnimationSound();
|
|
9006
9026
|
const exitHandler = exitModeHandlerRef.current;
|
|
9007
9027
|
if (exitHandler) {
|
|
@@ -9069,10 +9089,10 @@ function usePresentationSetup(input) {
|
|
|
9069
9089
|
onToggleToolbar: () => annotations.setToolbarVisible(!annotations.toolbarVisible),
|
|
9070
9090
|
onToggleSubtitles,
|
|
9071
9091
|
onSaveRehearsalTimings: (timings) => {
|
|
9072
|
-
setSlides((prev) =>
|
|
9092
|
+
setSlides((prev) => chunk4SPZ5IZN_js.applyRehearsalTimings(prev, timings));
|
|
9073
9093
|
history.markDirty();
|
|
9074
9094
|
},
|
|
9075
|
-
loopContinuously:
|
|
9095
|
+
loopContinuously: chunk4SPZ5IZN_js.shouldLoopContinuously(presentationProperties),
|
|
9076
9096
|
showWithAnimation: presentationProperties.showWithAnimation,
|
|
9077
9097
|
useTimings: presentationProperties.advanceMode !== "manual",
|
|
9078
9098
|
endWithBlackSlide,
|
|
@@ -9279,7 +9299,7 @@ function useEditorOperations(input) {
|
|
|
9279
9299
|
const { formatPainterActive, setFormatPainterActive, elementLookup } = state;
|
|
9280
9300
|
react.useEffect(() => {
|
|
9281
9301
|
if (formatPainterActive && !prevFormatPainterRef.current && selectedElement) {
|
|
9282
|
-
copiedFormatRef.current =
|
|
9302
|
+
copiedFormatRef.current = chunk4SPZ5IZN_js.copyFormatFromElement(selectedElement);
|
|
9283
9303
|
} else if (!formatPainterActive) {
|
|
9284
9304
|
copiedFormatRef.current = null;
|
|
9285
9305
|
}
|
|
@@ -9305,12 +9325,12 @@ function useEditorOperations(input) {
|
|
|
9305
9325
|
e.stopPropagation();
|
|
9306
9326
|
const element = elementLookup.get(elementId);
|
|
9307
9327
|
if (element) {
|
|
9308
|
-
const updated =
|
|
9328
|
+
const updated = chunk4SPZ5IZN_js.applyFormatToElement(element, copiedFormatRef.current);
|
|
9309
9329
|
const updates = {};
|
|
9310
|
-
if (
|
|
9330
|
+
if (chunk4SPZ5IZN_js.hasShapeProperties(updated)) {
|
|
9311
9331
|
updates.shapeStyle = updated.shapeStyle;
|
|
9312
9332
|
}
|
|
9313
|
-
if (
|
|
9333
|
+
if (chunk4SPZ5IZN_js.hasTextProperties(updated)) {
|
|
9314
9334
|
updates.textStyle = updated.textStyle;
|
|
9315
9335
|
}
|
|
9316
9336
|
ops.updateElementById(elementId, updates);
|
|
@@ -9496,10 +9516,10 @@ function useFontInjection({ embeddedFonts, slides }) {
|
|
|
9496
9516
|
}
|
|
9497
9517
|
};
|
|
9498
9518
|
}, [embeddedFonts]);
|
|
9499
|
-
const referencedFamilies = react.useMemo(() =>
|
|
9519
|
+
const referencedFamilies = react.useMemo(() => chunk4SPZ5IZN_js.collectReferencedFontFamilies(slides), [slides]);
|
|
9500
9520
|
react.useEffect(() => {
|
|
9501
9521
|
let cancelled = false;
|
|
9502
|
-
void
|
|
9522
|
+
void chunk4SPZ5IZN_js.resolveGoogleWebfontHref(slides, embeddedFonts).then((href) => {
|
|
9503
9523
|
if (cancelled) {
|
|
9504
9524
|
return null;
|
|
9505
9525
|
}
|
|
@@ -9524,15 +9544,15 @@ function useFontInjection({ embeddedFonts, slides }) {
|
|
|
9524
9544
|
const [, setOutlineFontsTick] = react.useState(0);
|
|
9525
9545
|
react.useEffect(() => {
|
|
9526
9546
|
let cancelled = false;
|
|
9527
|
-
const referenced =
|
|
9528
|
-
const candidates =
|
|
9547
|
+
const referenced = chunk4SPZ5IZN_js.collectReferencedFontFamilies(slides);
|
|
9548
|
+
const candidates = chunk4SPZ5IZN_js.selectGoogleWebfontFamilies(
|
|
9529
9549
|
referenced,
|
|
9530
9550
|
embeddedFonts.map((font) => font.name)
|
|
9531
9551
|
);
|
|
9532
9552
|
if (candidates.length === 0) {
|
|
9533
9553
|
return;
|
|
9534
9554
|
}
|
|
9535
|
-
void
|
|
9555
|
+
void chunk4SPZ5IZN_js.resolveGoogleWebfontHref(slides, embeddedFonts).then(async (href) => {
|
|
9536
9556
|
if (cancelled || !href) {
|
|
9537
9557
|
return;
|
|
9538
9558
|
}
|
|
@@ -9546,7 +9566,7 @@ function useFontInjection({ embeddedFonts, slides }) {
|
|
|
9546
9566
|
if (cancelled) {
|
|
9547
9567
|
return;
|
|
9548
9568
|
}
|
|
9549
|
-
const bytes = await
|
|
9569
|
+
const bytes = await chunk4SPZ5IZN_js.fetchGoogleWebfontOutlineBytes(
|
|
9550
9570
|
href,
|
|
9551
9571
|
family,
|
|
9552
9572
|
variant.bold,
|
|
@@ -9735,7 +9755,7 @@ function useKeyboardShortcuts(input) {
|
|
|
9735
9755
|
inputRef.current = input;
|
|
9736
9756
|
const handleKeyDown = react.useCallback((e) => {
|
|
9737
9757
|
const current = inputRef.current;
|
|
9738
|
-
const startAction =
|
|
9758
|
+
const startAction = chunk4SPZ5IZN_js.mapSlideShowStartKey(e, { isPresenting: current.mode === "present" });
|
|
9739
9759
|
if (startAction !== null) {
|
|
9740
9760
|
e.preventDefault();
|
|
9741
9761
|
if (startAction === "fromBeginning") {
|
|
@@ -9745,8 +9765,9 @@ function useKeyboardShortcuts(input) {
|
|
|
9745
9765
|
}
|
|
9746
9766
|
return;
|
|
9747
9767
|
}
|
|
9748
|
-
const { action, dx, dy } =
|
|
9768
|
+
const { action, dx, dy } = chunk4SPZ5IZN_js.mapEditorKey(e, {
|
|
9749
9769
|
canEdit: current.canEdit,
|
|
9770
|
+
canPaste: current.canPaste,
|
|
9750
9771
|
// The Slide Master view is an editing surface, not a viewing one.
|
|
9751
9772
|
// Gating on `mode !== 'edit'` alone made `mapEditorKey` return
|
|
9752
9773
|
// NO_ACTION there, so Delete, the arrow-key nudges and the clipboard
|
|
@@ -9758,7 +9779,7 @@ function useKeyboardShortcuts(input) {
|
|
|
9758
9779
|
hasSelection: current.hasSelection,
|
|
9759
9780
|
isEditingText: Boolean(current.inlineEditingElementId || current.tableEditorState?.isEditing),
|
|
9760
9781
|
isDrawing: current.activeTool !== "select",
|
|
9761
|
-
isTextInputTarget:
|
|
9782
|
+
isTextInputTarget: chunk4SPZ5IZN_js.isEditorTextInputTarget(e.target)
|
|
9762
9783
|
});
|
|
9763
9784
|
if (action === null) {
|
|
9764
9785
|
return;
|
|
@@ -9842,6 +9863,7 @@ function useKeyboardShortcutWiring(input) {
|
|
|
9842
9863
|
mode,
|
|
9843
9864
|
canEdit,
|
|
9844
9865
|
inlineEditingElementId: state.inlineEditingElementId,
|
|
9866
|
+
canPaste: Boolean(state.clipboardPayload && activeSlide),
|
|
9845
9867
|
tableEditorState: state.tableEditorState,
|
|
9846
9868
|
activeTool: state.activeTool,
|
|
9847
9869
|
hasSelection: state.effectiveSelectedIds.length > 0,
|
|
@@ -9932,6 +9954,7 @@ function useViewerIntegration(input) {
|
|
|
9932
9954
|
setModifyVerifier,
|
|
9933
9955
|
setCompatToasts,
|
|
9934
9956
|
canEdit,
|
|
9957
|
+
canInsertElement = true,
|
|
9935
9958
|
promptKeepInkAnnotations,
|
|
9936
9959
|
imageExportScale,
|
|
9937
9960
|
imageResolutionScale,
|
|
@@ -10090,7 +10113,7 @@ function useViewerIntegration(input) {
|
|
|
10090
10113
|
return zoom.scale;
|
|
10091
10114
|
},
|
|
10092
10115
|
setZoom(level) {
|
|
10093
|
-
zoom.setScale(
|
|
10116
|
+
zoom.setScale(chunk4SPZ5IZN_js.clampZoomScale(level));
|
|
10094
10117
|
},
|
|
10095
10118
|
zoomIn() {
|
|
10096
10119
|
zoom.handleZoomIn();
|
|
@@ -10175,6 +10198,21 @@ function useViewerIntegration(input) {
|
|
|
10175
10198
|
return s?.elements.find((e) => e.id === elementId);
|
|
10176
10199
|
},
|
|
10177
10200
|
// -- Element manipulation --
|
|
10201
|
+
addElement(element) {
|
|
10202
|
+
const inserted = chunk4SPZ5IZN_js.prepareElementForInsertion(element, {
|
|
10203
|
+
canEdit: canEdit && canInsertElement,
|
|
10204
|
+
mode,
|
|
10205
|
+
hasActiveSlide: !loading && !error && Boolean(activeSlide),
|
|
10206
|
+
editTemplateMode: state.editTemplateMode
|
|
10207
|
+
});
|
|
10208
|
+
if (!inserted) {
|
|
10209
|
+
return void 0;
|
|
10210
|
+
}
|
|
10211
|
+
editorOps.canvasHandlers.handleInlineEditCommit();
|
|
10212
|
+
editorOps.insertHandlers.addElement(inserted);
|
|
10213
|
+
editorOps.ops.applySelection(inserted.id, [inserted.id]);
|
|
10214
|
+
return inserted.id;
|
|
10215
|
+
},
|
|
10178
10216
|
updateElement(elementId, updates) {
|
|
10179
10217
|
editorOps.ops.updateElementById(elementId, updates);
|
|
10180
10218
|
},
|
|
@@ -10195,6 +10233,11 @@ function useViewerIntegration(input) {
|
|
|
10195
10233
|
onContentChange,
|
|
10196
10234
|
slides,
|
|
10197
10235
|
activeSlideIndex,
|
|
10236
|
+
activeSlide,
|
|
10237
|
+
canEdit,
|
|
10238
|
+
canInsertElement,
|
|
10239
|
+
loading,
|
|
10240
|
+
error,
|
|
10198
10241
|
state,
|
|
10199
10242
|
history,
|
|
10200
10243
|
zoom,
|
|
@@ -10312,7 +10355,7 @@ function useReducedMotion() {
|
|
|
10312
10355
|
}
|
|
10313
10356
|
function useViewerOptions() {
|
|
10314
10357
|
const storeRef = react.useRef(null);
|
|
10315
|
-
storeRef.current ??=
|
|
10358
|
+
storeRef.current ??= chunk4SPZ5IZN_js.createViewerOptionsStore();
|
|
10316
10359
|
const store = storeRef.current;
|
|
10317
10360
|
const options = react.useSyncExternalStore(
|
|
10318
10361
|
(onStoreChange) => store.subscribe(onStoreChange),
|
|
@@ -10321,9 +10364,9 @@ function useViewerOptions() {
|
|
|
10321
10364
|
);
|
|
10322
10365
|
return { optionsStore: store, options };
|
|
10323
10366
|
}
|
|
10324
|
-
var KNOWN_TAB_IDS = new Set(
|
|
10367
|
+
var KNOWN_TAB_IDS = new Set(chunk4SPZ5IZN_js.TOOLBAR_TABS.map((tab) => tab.id));
|
|
10325
10368
|
function computeToolbarVisibility(hiddenActions, hiddenTabIds = []) {
|
|
10326
|
-
const isHidden = (id) =>
|
|
10369
|
+
const isHidden = (id) => chunk4SPZ5IZN_js.isActionHidden(id, hiddenActions);
|
|
10327
10370
|
const userHidden = new Set(hiddenTabIds);
|
|
10328
10371
|
userHidden.delete("file");
|
|
10329
10372
|
const isTabVisible = (id) => !KNOWN_TAB_IDS.has(id) || !isHidden(id) && !userHidden.has(id);
|
|
@@ -10416,12 +10459,12 @@ function useYjsDocumentSync({
|
|
|
10416
10459
|
return;
|
|
10417
10460
|
}
|
|
10418
10461
|
try {
|
|
10419
|
-
const handler = new
|
|
10462
|
+
const handler = new chunk4SPZ5IZN_js.PptxHandler();
|
|
10420
10463
|
await handler.load(sourceBytes.buffer);
|
|
10421
|
-
const currentSlides =
|
|
10464
|
+
const currentSlides = chunk4SPZ5IZN_js.readSlidesFromYDoc(
|
|
10422
10465
|
doc
|
|
10423
10466
|
);
|
|
10424
|
-
const slidesToSave =
|
|
10467
|
+
const slidesToSave = chunk4SPZ5IZN_js.buildSaveSlides(currentSlides, templateElementsBySlideId);
|
|
10425
10468
|
const bytes = await handler.save(slidesToSave, getSaveOptions?.());
|
|
10426
10469
|
config.onWriteBack(bytes);
|
|
10427
10470
|
} catch {
|
|
@@ -10436,10 +10479,10 @@ function useYjsDocumentSync({
|
|
|
10436
10479
|
if (!doc || !isConnected) {
|
|
10437
10480
|
return;
|
|
10438
10481
|
}
|
|
10439
|
-
const docSlides =
|
|
10482
|
+
const docSlides = chunk4SPZ5IZN_js.readSlidesFromYDoc(
|
|
10440
10483
|
doc
|
|
10441
10484
|
);
|
|
10442
|
-
if (!
|
|
10485
|
+
if (!chunk4SPZ5IZN_js.shouldRoomSlidesReplaceLoad(loadOrigin, docSlides.length)) {
|
|
10443
10486
|
return;
|
|
10444
10487
|
}
|
|
10445
10488
|
lastSyncedRef.current = JSON.stringify(docSlides);
|
|
@@ -10458,11 +10501,11 @@ function useYjsDocumentSync({
|
|
|
10458
10501
|
lastSyncedRef.current = serialized;
|
|
10459
10502
|
void (async () => {
|
|
10460
10503
|
const factories = await getFactories();
|
|
10461
|
-
|
|
10504
|
+
chunk4SPZ5IZN_js.reconcileSlidesInYDoc(
|
|
10462
10505
|
slides,
|
|
10463
10506
|
doc,
|
|
10464
10507
|
factories,
|
|
10465
|
-
|
|
10508
|
+
chunk4SPZ5IZN_js.LOCAL_SYNC_ORIGIN
|
|
10466
10509
|
);
|
|
10467
10510
|
scheduleWriteBack();
|
|
10468
10511
|
})();
|
|
@@ -10476,10 +10519,10 @@ function useYjsDocumentSync({
|
|
|
10476
10519
|
return;
|
|
10477
10520
|
}
|
|
10478
10521
|
const handleChange = (_events, transaction) => {
|
|
10479
|
-
if (transaction?.origin ===
|
|
10522
|
+
if (transaction?.origin === chunk4SPZ5IZN_js.LOCAL_SYNC_ORIGIN) {
|
|
10480
10523
|
return;
|
|
10481
10524
|
}
|
|
10482
|
-
const remoteSlides =
|
|
10525
|
+
const remoteSlides = chunk4SPZ5IZN_js.readSlidesFromYDoc(
|
|
10483
10526
|
doc
|
|
10484
10527
|
);
|
|
10485
10528
|
if (remoteSlides.length === 0) {
|
|
@@ -10495,7 +10538,7 @@ function useYjsDocumentSync({
|
|
|
10495
10538
|
isApplyingRemoteRef.current = false;
|
|
10496
10539
|
scheduleWriteBack();
|
|
10497
10540
|
};
|
|
10498
|
-
const unobserve =
|
|
10541
|
+
const unobserve = chunk4SPZ5IZN_js.observeYDocSlides(
|
|
10499
10542
|
doc,
|
|
10500
10543
|
handleChange
|
|
10501
10544
|
);
|
|
@@ -10533,7 +10576,7 @@ function useBroadcastFollower({
|
|
|
10533
10576
|
if (!broadcaster) {
|
|
10534
10577
|
return;
|
|
10535
10578
|
}
|
|
10536
|
-
if (!
|
|
10579
|
+
if (!chunk4SPZ5IZN_js.shouldAutoFollowBroadcaster({
|
|
10537
10580
|
localRole: collab.config.role,
|
|
10538
10581
|
broadcasterRole: broadcaster.role
|
|
10539
10582
|
})) {
|
|
@@ -10691,7 +10734,7 @@ function useLayoutSwitching(input) {
|
|
|
10691
10734
|
currentLayoutPath
|
|
10692
10735
|
};
|
|
10693
10736
|
}
|
|
10694
|
-
var MIN_TOUCH_TARGET =
|
|
10737
|
+
var MIN_TOUCH_TARGET = chunk4SPZ5IZN_js.MIN_TOUCH_TARGET_PX;
|
|
10695
10738
|
function subscribeTouchCapability(callback) {
|
|
10696
10739
|
if (typeof window === "undefined") {
|
|
10697
10740
|
return () => {
|
|
@@ -10704,7 +10747,7 @@ function subscribeTouchCapability(callback) {
|
|
|
10704
10747
|
function useIsMobile() {
|
|
10705
10748
|
const isTouchDevice = react.useSyncExternalStore(
|
|
10706
10749
|
subscribeTouchCapability,
|
|
10707
|
-
|
|
10750
|
+
chunk4SPZ5IZN_js.detectTouchDevice,
|
|
10708
10751
|
() => false
|
|
10709
10752
|
// server snapshot
|
|
10710
10753
|
);
|
|
@@ -10714,7 +10757,7 @@ function useIsMobile() {
|
|
|
10714
10757
|
const [viewportHeight, setViewportHeight] = react.useState(
|
|
10715
10758
|
() => typeof window === "undefined" ? 768 : window.innerHeight
|
|
10716
10759
|
);
|
|
10717
|
-
const [orientation, setOrientation] = react.useState(
|
|
10760
|
+
const [orientation, setOrientation] = react.useState(chunk4SPZ5IZN_js.detectOrientation);
|
|
10718
10761
|
const [isVirtualKeyboardOpen, setIsVirtualKeyboardOpen] = react.useState(false);
|
|
10719
10762
|
const [initialViewportHeight] = react.useState(
|
|
10720
10763
|
() => typeof window !== "undefined" ? window.innerHeight : 800
|
|
@@ -10735,7 +10778,7 @@ function useIsMobile() {
|
|
|
10735
10778
|
return;
|
|
10736
10779
|
}
|
|
10737
10780
|
const handleOrientationChange = () => {
|
|
10738
|
-
setOrientation(
|
|
10781
|
+
setOrientation(chunk4SPZ5IZN_js.detectOrientation());
|
|
10739
10782
|
};
|
|
10740
10783
|
if (screen.orientation) {
|
|
10741
10784
|
screen.orientation.addEventListener("change", handleOrientationChange);
|
|
@@ -10765,7 +10808,7 @@ function useIsMobile() {
|
|
|
10765
10808
|
window.addEventListener("resize", handleResize);
|
|
10766
10809
|
return () => window.removeEventListener("resize", handleResize);
|
|
10767
10810
|
}, [isTouchDevice, initialViewportHeight]);
|
|
10768
|
-
const { isMobile, isTablet, isDesktop } =
|
|
10811
|
+
const { isMobile, isTablet, isDesktop } = chunk4SPZ5IZN_js.deriveViewportBreakpoints(
|
|
10769
10812
|
viewportWidth,
|
|
10770
10813
|
viewportHeight,
|
|
10771
10814
|
isTouchDevice
|
|
@@ -10798,10 +10841,10 @@ function useTouchGestures(input) {
|
|
|
10798
10841
|
if (!el || !enabled) {
|
|
10799
10842
|
return;
|
|
10800
10843
|
}
|
|
10801
|
-
const recognizer =
|
|
10844
|
+
const recognizer = chunk4SPZ5IZN_js.createTouchGestureRecognizer({
|
|
10802
10845
|
getScale: () => scaleRef.current,
|
|
10803
|
-
minScale:
|
|
10804
|
-
maxScale:
|
|
10846
|
+
minScale: chunk4SPZ5IZN_js.MIN_ZOOM_SCALE,
|
|
10847
|
+
maxScale: chunk4SPZ5IZN_js.MAX_ZOOM_SCALE,
|
|
10805
10848
|
callbacks: {
|
|
10806
10849
|
onPinchZoom: (newScale) => callbacksRef.current.onPinchZoom?.(newScale),
|
|
10807
10850
|
onSwipe: (direction) => callbacksRef.current.onSwipe?.(direction),
|
|
@@ -10841,7 +10884,7 @@ function scrollFocusedIntoView(keyboardInset) {
|
|
|
10841
10884
|
return;
|
|
10842
10885
|
}
|
|
10843
10886
|
const rect = active.getBoundingClientRect();
|
|
10844
|
-
const delta =
|
|
10887
|
+
const delta = chunk4SPZ5IZN_js.computeScrollDelta(
|
|
10845
10888
|
{ top: rect.top, bottom: rect.bottom },
|
|
10846
10889
|
window.innerHeight,
|
|
10847
10890
|
keyboardInset
|
|
@@ -10861,8 +10904,8 @@ function useKeyboardInsets(enabled = true) {
|
|
|
10861
10904
|
return;
|
|
10862
10905
|
}
|
|
10863
10906
|
const update = () => {
|
|
10864
|
-
const metrics =
|
|
10865
|
-
const inset = metrics ?
|
|
10907
|
+
const metrics = chunk4SPZ5IZN_js.readViewportMetrics(window);
|
|
10908
|
+
const inset = metrics ? chunk4SPZ5IZN_js.computeKeyboardInset(metrics) : 0;
|
|
10866
10909
|
setKeyboardInset(inset);
|
|
10867
10910
|
if (inset > 0) {
|
|
10868
10911
|
window.requestAnimationFrame(() => scrollFocusedIntoView(inset));
|
|
@@ -10873,8 +10916,8 @@ function useKeyboardInsets(enabled = true) {
|
|
|
10873
10916
|
vv.addEventListener("scroll", update);
|
|
10874
10917
|
const onFocusIn = () => {
|
|
10875
10918
|
window.requestAnimationFrame(() => {
|
|
10876
|
-
const metrics =
|
|
10877
|
-
const inset = metrics ?
|
|
10919
|
+
const metrics = chunk4SPZ5IZN_js.readViewportMetrics(window);
|
|
10920
|
+
const inset = metrics ? chunk4SPZ5IZN_js.computeKeyboardInset(metrics) : 0;
|
|
10878
10921
|
if (inset > 0) {
|
|
10879
10922
|
scrollFocusedIntoView(inset);
|
|
10880
10923
|
}
|
|
@@ -10887,7 +10930,7 @@ function useKeyboardInsets(enabled = true) {
|
|
|
10887
10930
|
document.removeEventListener("focusin", onFocusIn);
|
|
10888
10931
|
};
|
|
10889
10932
|
}, [enabled]);
|
|
10890
|
-
return { keyboardInset, isKeyboardOpen:
|
|
10933
|
+
return { keyboardInset, isKeyboardOpen: chunk4SPZ5IZN_js.isKeyboardOpen(keyboardInset) };
|
|
10891
10934
|
}
|
|
10892
10935
|
|
|
10893
10936
|
// src/viewer/hooks/useViewerBuildingBlocks-canvas-props.ts
|
|
@@ -10916,21 +10959,21 @@ function buildCanvasProps(input) {
|
|
|
10916
10959
|
} = input;
|
|
10917
10960
|
const effectiveSlide = mode === "master" ? masterPseudoSlide : activeSlide;
|
|
10918
10961
|
const effectiveTemplateElements = mode === "master" ? s.activeLayout ? s.activeMaster?.elements ?? [] : [] : templateElements;
|
|
10919
|
-
const fieldContext =
|
|
10962
|
+
const fieldContext = chunk4SPZ5IZN_js.buildFieldSubstitutionContext({
|
|
10920
10963
|
headerFooter: s.headerFooter,
|
|
10921
10964
|
customProperties: s.customProperties,
|
|
10922
10965
|
slide: activeSlide
|
|
10923
10966
|
});
|
|
10924
10967
|
const tableStyleContext = s.theme || s.tableStyleMap ? { theme: s.theme, tableStyleMap: s.tableStyleMap } : void 0;
|
|
10925
10968
|
const openExternalUrl = (url, target) => {
|
|
10926
|
-
if (
|
|
10969
|
+
if (chunk4SPZ5IZN_js.shouldConfirmExternalHyperlink(viewerOptions, url) && !window.confirm(buildHyperlinkConfirmMessage(url))) {
|
|
10927
10970
|
return;
|
|
10928
10971
|
}
|
|
10929
|
-
|
|
10972
|
+
chunk4SPZ5IZN_js.safeOpenUrl(url, target);
|
|
10930
10973
|
};
|
|
10931
10974
|
const handleActionClick = (elementId, action) => {
|
|
10932
10975
|
if (mode === "present") {
|
|
10933
|
-
const resolved =
|
|
10976
|
+
const resolved = chunk4SPZ5IZN_js.resolvePresentationAction(action, { slideCount: slides.length });
|
|
10934
10977
|
if (resolved.intent.kind === "openUrl") {
|
|
10935
10978
|
openExternalUrl(resolved.intent.url);
|
|
10936
10979
|
return;
|
|
@@ -10941,9 +10984,9 @@ function buildCanvasProps(input) {
|
|
|
10941
10984
|
}
|
|
10942
10985
|
};
|
|
10943
10986
|
const handleHyperlinkClick = (url, target) => {
|
|
10944
|
-
if (
|
|
10987
|
+
if (chunk4SPZ5IZN_js.isPpactionUrl(url)) {
|
|
10945
10988
|
if (mode === "present") {
|
|
10946
|
-
const parsed =
|
|
10989
|
+
const parsed = chunk4SPZ5IZN_js.parsePpactionUrl(url);
|
|
10947
10990
|
if (parsed) {
|
|
10948
10991
|
presentation.handlePresentationAction({
|
|
10949
10992
|
action: parsed.action,
|
|
@@ -11049,7 +11092,7 @@ function buildCanvasProps(input) {
|
|
|
11049
11092
|
|
|
11050
11093
|
// src/viewer/hooks/useScopedLayoutOptions.ts
|
|
11051
11094
|
function scopeLayoutOptionsToActiveSlide(options, activeSlide) {
|
|
11052
|
-
return
|
|
11095
|
+
return chunk4SPZ5IZN_js.scopeLayoutOptionsToSlide(options, activeSlide?.layoutPath);
|
|
11053
11096
|
}
|
|
11054
11097
|
|
|
11055
11098
|
// src/viewer/hooks/useViewerBuildingBlocks-toolbar-handlers.ts
|
|
@@ -11062,7 +11105,7 @@ function buildToolbarAnimationHandlers(input) {
|
|
|
11062
11105
|
const current = activeSlide.animations ?? [];
|
|
11063
11106
|
if (group === "motionPath") {
|
|
11064
11107
|
propertyHandlers.handleUpdateSlide({
|
|
11065
|
-
animations:
|
|
11108
|
+
animations: chunk4SPZ5IZN_js.applyMotionPathPreset(current, selectedElement.id, preset)
|
|
11066
11109
|
});
|
|
11067
11110
|
return;
|
|
11068
11111
|
}
|
|
@@ -11258,7 +11301,7 @@ function buildToolbarProps(input) {
|
|
|
11258
11301
|
onOpenFile,
|
|
11259
11302
|
onOpenRecentFile,
|
|
11260
11303
|
onCreatePresentation: (templateId) => {
|
|
11261
|
-
s.setSlides(
|
|
11304
|
+
s.setSlides(chunk4SPZ5IZN_js.createBackstagePresentation(templateId));
|
|
11262
11305
|
s.setActiveSlideIndex(0);
|
|
11263
11306
|
s.setSelectedElementId(null);
|
|
11264
11307
|
s.setSelectedElementIds([]);
|
|
@@ -11288,7 +11331,7 @@ function buildToolbarProps(input) {
|
|
|
11288
11331
|
loadLayoutPreviews: input.loadLayoutPreviews,
|
|
11289
11332
|
onInsertSlideFromLayout: slideOps.handleInsertSlideFromLayout,
|
|
11290
11333
|
onInsertSlideFromTemplate: slideOps.handleInsertSlideFromTemplate,
|
|
11291
|
-
templateScheme:
|
|
11334
|
+
templateScheme: chunk4SPZ5IZN_js.templateSchemeFromTheme(s.theme?.colorScheme),
|
|
11292
11335
|
customShows: s.customShows,
|
|
11293
11336
|
activeCustomShowId: s.activeCustomShowId,
|
|
11294
11337
|
onSetActiveCustomShowId: s.setActiveCustomShowId,
|
|
@@ -11329,7 +11372,7 @@ function buildToolbarProps(input) {
|
|
|
11329
11372
|
isCommentsPanelOpen: s.isInspectorPaneOpen,
|
|
11330
11373
|
slideCommentCount: activeSlide?.comments?.length ?? 0,
|
|
11331
11374
|
formatPainterActive: s.formatPainterActive,
|
|
11332
|
-
canActivateFormatPainter:
|
|
11375
|
+
canActivateFormatPainter: chunk4SPZ5IZN_js.hasCopyableFormat(selectedElement),
|
|
11333
11376
|
onToggleFormatPainter: () => s.setFormatPainterActive((p) => !p),
|
|
11334
11377
|
isSelectionPaneOpen: s.isSelectionPaneOpen,
|
|
11335
11378
|
onToggleSelectionPane: () => s.setIsSelectionPaneOpen((p) => !p),
|
|
@@ -11392,7 +11435,12 @@ function useViewerBuildingBlocksCore(input) {
|
|
|
11392
11435
|
state.isDrawingRef
|
|
11393
11436
|
]
|
|
11394
11437
|
);
|
|
11395
|
-
const zoom = useZoomViewport({
|
|
11438
|
+
const zoom = useZoomViewport({
|
|
11439
|
+
canvasSize,
|
|
11440
|
+
selectedElements: state.selectedElements,
|
|
11441
|
+
fitPadding: input.fitPadding,
|
|
11442
|
+
maxFitScale: input.maxFitScale
|
|
11443
|
+
});
|
|
11396
11444
|
const { options: viewerOptions } = useViewerOptions();
|
|
11397
11445
|
const { setIsDirty } = state;
|
|
11398
11446
|
const markDocumentDirty = react.useCallback(() => {
|
|
@@ -11407,7 +11455,7 @@ function useViewerBuildingBlocksCore(input) {
|
|
|
11407
11455
|
headerFooter: state.headerFooter,
|
|
11408
11456
|
loading,
|
|
11409
11457
|
error,
|
|
11410
|
-
maxHistoryEntries:
|
|
11458
|
+
maxHistoryEntries: chunk4SPZ5IZN_js.resolveHistoryDepth(viewerOptions),
|
|
11411
11459
|
hasActivePointerInteraction,
|
|
11412
11460
|
pointerCommitNonce: state.pointerCommitNonce,
|
|
11413
11461
|
onDirty: markDocumentDirty,
|
|
@@ -11432,7 +11480,7 @@ function useViewerBuildingBlocksCore(input) {
|
|
|
11432
11480
|
documentGridSpacing: state.viewProperties?.gridSpacing
|
|
11433
11481
|
});
|
|
11434
11482
|
const themeColorMap = react.useMemo(
|
|
11435
|
-
() => state.theme?.colorScheme ?
|
|
11483
|
+
() => state.theme?.colorScheme ? chunk4SPZ5IZN_js.buildThemeColorMap(state.theme.colorScheme) : void 0,
|
|
11436
11484
|
[state.theme?.colorScheme]
|
|
11437
11485
|
);
|
|
11438
11486
|
const { presentation, annotations, actionSoundHandlerRef, setExitModeHandler } = usePresentationSetup({
|
|
@@ -11481,8 +11529,8 @@ function useViewerBuildingBlocksCore(input) {
|
|
|
11481
11529
|
gridSpacingPx,
|
|
11482
11530
|
// Multiplied against the pre-existing 2x baseline; see the matching
|
|
11483
11531
|
// comment in `PowerPointViewer.tsx`.
|
|
11484
|
-
imageExportScale: 2 *
|
|
11485
|
-
imageResolutionScale:
|
|
11532
|
+
imageExportScale: 2 * chunk4SPZ5IZN_js.resolveImageResolutionScale(viewerOptions),
|
|
11533
|
+
imageResolutionScale: chunk4SPZ5IZN_js.resolveImageResolutionScale(viewerOptions),
|
|
11486
11534
|
viewerOptions
|
|
11487
11535
|
};
|
|
11488
11536
|
}
|
|
@@ -11498,7 +11546,7 @@ function useCompatibilityToastsState() {
|
|
|
11498
11546
|
}
|
|
11499
11547
|
function useReadOnlyRecommendationState(content) {
|
|
11500
11548
|
const [recommendation, setRecommendation] = react.useState(
|
|
11501
|
-
() =>
|
|
11549
|
+
() => chunk4SPZ5IZN_js.readOnlyRecommendation(void 0)
|
|
11502
11550
|
);
|
|
11503
11551
|
const [modifyVerifier, setModifyVerifier] = react.useState(void 0);
|
|
11504
11552
|
const [bannerHidden, setBannerHidden] = react.useState(false);
|
|
@@ -11538,7 +11586,7 @@ function useReadOnlyRecommendationState(content) {
|
|
|
11538
11586
|
async (password) => {
|
|
11539
11587
|
setCheckingPassword(true);
|
|
11540
11588
|
try {
|
|
11541
|
-
const result = await
|
|
11589
|
+
const result = await chunk4SPZ5IZN_js.checkModifyPassword(modifyVerifier, password);
|
|
11542
11590
|
if (result.ok) {
|
|
11543
11591
|
unlock();
|
|
11544
11592
|
} else {
|
|
@@ -11583,9 +11631,9 @@ function useViewPreferencesSync(input) {
|
|
|
11583
11631
|
setShowGuides
|
|
11584
11632
|
} = input;
|
|
11585
11633
|
react.useEffect(() => {
|
|
11586
|
-
const seeded =
|
|
11634
|
+
const seeded = chunk4SPZ5IZN_js.viewerPreferencesFromViewProperties(
|
|
11587
11635
|
{ viewProperties },
|
|
11588
|
-
{ ...
|
|
11636
|
+
{ ...chunk4SPZ5IZN_js.DEFAULT_VIEWER_PREFERENCES, snapToGrid, snapToObjects: snapToShape, showGuides }
|
|
11589
11637
|
);
|
|
11590
11638
|
setSnapToGrid(seeded.snapToGrid);
|
|
11591
11639
|
setSnapToShape(seeded.snapToObjects ?? snapToShape);
|
|
@@ -11595,7 +11643,7 @@ function useViewPreferencesSync(input) {
|
|
|
11595
11643
|
(prefsOverride) => {
|
|
11596
11644
|
setViewProperties((prev) => {
|
|
11597
11645
|
const merged = {
|
|
11598
|
-
...
|
|
11646
|
+
...chunk4SPZ5IZN_js.DEFAULT_VIEWER_PREFERENCES,
|
|
11599
11647
|
snapToGrid,
|
|
11600
11648
|
snapToObjects: snapToShape,
|
|
11601
11649
|
showGuides,
|
|
@@ -11603,7 +11651,7 @@ function useViewPreferencesSync(input) {
|
|
|
11603
11651
|
gridSpacingCy: prev?.gridSpacing?.cy,
|
|
11604
11652
|
...prefsOverride
|
|
11605
11653
|
};
|
|
11606
|
-
const patch =
|
|
11654
|
+
const patch = chunk4SPZ5IZN_js.viewPropertiesPatchFromPreferences(merged);
|
|
11607
11655
|
return {
|
|
11608
11656
|
...prev,
|
|
11609
11657
|
slideViewPr: { ...prev?.slideViewPr, ...patch.slideViewPr },
|
|
@@ -11748,6 +11796,7 @@ function useViewerBuildingBlocksState(input) {
|
|
|
11748
11796
|
allowExternalImages: viewerOptions.trust.allowExternalContent,
|
|
11749
11797
|
setReadOnlyRecommendation: readOnlyRec.setRecommendation,
|
|
11750
11798
|
setModifyVerifier: readOnlyRec.setModifyVerifier,
|
|
11799
|
+
canInsertElement: !readOnlyRec.locked && !viewerOptions.trust.openInProtectedView,
|
|
11751
11800
|
setCompatToasts: compatToastsState.setToasts,
|
|
11752
11801
|
canEdit,
|
|
11753
11802
|
promptKeepInkAnnotations: viewerOptions.advanced.slideShowPromptKeepInkAnnotations,
|
|
@@ -11825,7 +11874,7 @@ function useViewerBuildingBlocks(input) {
|
|
|
11825
11874
|
}, [incomingContent]);
|
|
11826
11875
|
const onOpenFile = react.useCallback(() => {
|
|
11827
11876
|
void (async () => {
|
|
11828
|
-
const picked = await
|
|
11877
|
+
const picked = await chunk4SPZ5IZN_js.openPptxFile();
|
|
11829
11878
|
if (picked) {
|
|
11830
11879
|
setContent(picked.buffer);
|
|
11831
11880
|
}
|
|
@@ -11833,13 +11882,17 @@ function useViewerBuildingBlocks(input) {
|
|
|
11833
11882
|
}, []);
|
|
11834
11883
|
const onOpenRecentFile = react.useCallback((key) => {
|
|
11835
11884
|
void (async () => {
|
|
11836
|
-
const bytes = await
|
|
11885
|
+
const bytes = await chunk4SPZ5IZN_js.readBackstageRecentFile(key);
|
|
11837
11886
|
if (bytes) {
|
|
11838
11887
|
setContent(bytes);
|
|
11839
11888
|
}
|
|
11840
11889
|
})();
|
|
11841
11890
|
}, []);
|
|
11842
|
-
const core = useViewerBuildingBlocksCore({
|
|
11891
|
+
const core = useViewerBuildingBlocksCore({
|
|
11892
|
+
content,
|
|
11893
|
+
fitPadding: input.fitPadding,
|
|
11894
|
+
maxFitScale: input.maxFitScale
|
|
11895
|
+
});
|
|
11843
11896
|
const {
|
|
11844
11897
|
state,
|
|
11845
11898
|
mode,
|