pptx-react-viewer 2.18.0 → 2.19.1
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 +712 -0
- package/dist/{AiChatPanel-SSSBERWJ.mjs → AiChatPanel-GRAIPSG3.mjs} +4 -4
- package/dist/AiChatPanel-GRAIPSG3.mjs.br +0 -0
- package/dist/AiChatPanel-GRAIPSG3.mjs.gz +0 -0
- package/dist/{AiChatPanel-UN5DHPZY.js → AiChatPanel-JSTZ6W7R.js} +24 -24
- package/dist/AiChatPanel-JSTZ6W7R.js.br +0 -0
- package/dist/AiChatPanel-JSTZ6W7R.js.gz +0 -0
- package/dist/{Model3DScene-LYEESYAI.mjs → Model3DScene-FXDA7OII.mjs} +1 -1
- package/dist/Model3DScene-FXDA7OII.mjs.br +0 -0
- package/dist/Model3DScene-FXDA7OII.mjs.gz +0 -0
- package/dist/{Model3DScene-4RPYKC2I.js → Model3DScene-WLRZXJHN.js} +2 -2
- package/dist/Model3DScene-WLRZXJHN.js.br +0 -0
- package/dist/Model3DScene-WLRZXJHN.js.gz +0 -0
- package/dist/{PowerPointViewer-Cf4YHjdF.d.ts → PowerPointViewer-DVFkeluD.d.ts} +2 -2
- package/dist/PowerPointViewer-DVFkeluD.d.ts.map +1 -0
- package/dist/{audience-content-store-CyS0oP6t.d.ts → audience-content-store-ChVOSdBh.d.ts} +2 -2
- package/dist/{audience-content-store-CyS0oP6t.d.ts.map → audience-content-store-ChVOSdBh.d.ts.map} +1 -1
- package/dist/{chunk-QUB5OSKY.mjs → chunk-5ZQ3ZQ3M.mjs} +71 -125
- package/dist/chunk-5ZQ3ZQ3M.mjs.br +0 -0
- package/dist/chunk-5ZQ3ZQ3M.mjs.gz +0 -0
- package/dist/{chunk-O7FTUUXP.mjs → chunk-B55E3KXL.mjs} +210 -92
- package/dist/chunk-B55E3KXL.mjs.br +0 -0
- package/dist/chunk-B55E3KXL.mjs.gz +0 -0
- package/dist/{chunk-7XF6S4AM.mjs → chunk-KQGS6A5J.mjs} +1 -1
- package/dist/chunk-KQGS6A5J.mjs.br +0 -0
- package/dist/chunk-KQGS6A5J.mjs.gz +0 -0
- package/dist/{chunk-ASKYZ5ZY.js → chunk-LMTUC7U7.js} +440 -494
- package/dist/chunk-LMTUC7U7.js.br +0 -0
- package/dist/chunk-LMTUC7U7.js.gz +0 -0
- package/dist/{chunk-RTUGI4HQ.js → chunk-MVKRI3CZ.js} +9 -0
- package/dist/chunk-MVKRI3CZ.js.br +0 -0
- package/dist/chunk-MVKRI3CZ.js.gz +0 -0
- package/dist/{chunk-4LWGAVAP.js → chunk-PIJAFM4B.js} +197 -2425
- package/dist/chunk-PIJAFM4B.js.br +0 -0
- package/dist/chunk-PIJAFM4B.js.gz +0 -0
- package/dist/{chunk-GODW6RNR.mjs → chunk-PNR3J26S.mjs} +1173 -1051
- package/dist/chunk-PNR3J26S.mjs.br +0 -0
- package/dist/chunk-PNR3J26S.mjs.gz +0 -0
- package/dist/{chunk-MAVLV56S.js → chunk-SCGIXXN5.js} +3 -3
- package/dist/chunk-SCGIXXN5.js.br +0 -0
- package/dist/chunk-SCGIXXN5.js.gz +0 -0
- package/dist/{chunk-SNL6LBRX.mjs → chunk-SQJBFMEX.mjs} +9 -0
- package/dist/chunk-SQJBFMEX.mjs.br +0 -0
- package/dist/chunk-SQJBFMEX.mjs.gz +0 -0
- package/dist/{chunk-WVDM36ZM.js → chunk-T7BIRNE4.js} +1185 -1067
- package/dist/chunk-T7BIRNE4.js.br +0 -0
- package/dist/chunk-T7BIRNE4.js.gz +0 -0
- package/dist/{chunk-ICZDMFF2.js → chunk-TPC65IB2.js} +1219 -1101
- package/dist/chunk-TPC65IB2.js.br +0 -0
- package/dist/chunk-TPC65IB2.js.gz +0 -0
- package/dist/{chunk-BZOL6FXF.mjs → chunk-WGXQXHCS.mjs} +52 -2280
- package/dist/chunk-WGXQXHCS.mjs.br +0 -0
- package/dist/chunk-WGXQXHCS.mjs.gz +0 -0
- package/dist/i18n.js +4 -4
- package/dist/i18n.js.br +0 -0
- package/dist/i18n.js.gz +0 -0
- package/dist/i18n.mjs +1 -1
- package/dist/i18n.mjs.br +0 -0
- package/dist/i18n.mjs.gz +0 -0
- package/dist/index.d.ts +38 -1
- package/dist/index.js +47 -47
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.br +0 -0
- package/dist/index.mjs.gz +0 -0
- package/dist/internals.d.ts +102 -15
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.js +79 -79
- package/dist/internals.js.br +0 -0
- package/dist/internals.js.gz +0 -0
- package/dist/internals.mjs +4 -4
- package/dist/internals.mjs.br +0 -0
- package/dist/internals.mjs.gz +0 -0
- package/dist/{types-C_CTI-QE.d.ts → types-TCH6icpi.d.ts} +23 -1
- package/dist/{types-C_CTI-QE.d.ts.map → types-TCH6icpi.d.ts.map} +1 -1
- package/dist/{useViewerBuildingBlocks-DItilDbP.d.ts → useViewerBuildingBlocks-BKb0qs1j.d.ts} +20 -4
- package/dist/{useViewerBuildingBlocks-DItilDbP.d.ts.map → useViewerBuildingBlocks-BKb0qs1j.d.ts.map} +1 -1
- package/dist/viewer/index.d.ts +38 -1
- package/dist/viewer/index.js +27 -27
- package/dist/viewer/index.js.br +0 -0
- package/dist/viewer/index.js.gz +0 -0
- package/dist/viewer/index.mjs +6 -6
- package/dist/viewer/index.mjs.br +0 -0
- package/dist/viewer/index.mjs.gz +0 -0
- package/package.json +1 -1
- package/dist/AiChatPanel-SSSBERWJ.mjs.br +0 -0
- package/dist/AiChatPanel-SSSBERWJ.mjs.gz +0 -0
- package/dist/AiChatPanel-UN5DHPZY.js.br +0 -0
- package/dist/AiChatPanel-UN5DHPZY.js.gz +0 -0
- package/dist/Model3DScene-4RPYKC2I.js.br +0 -0
- package/dist/Model3DScene-4RPYKC2I.js.gz +0 -0
- package/dist/Model3DScene-LYEESYAI.mjs.br +0 -0
- package/dist/Model3DScene-LYEESYAI.mjs.gz +0 -0
- package/dist/PowerPointViewer-Cf4YHjdF.d.ts.map +0 -1
- package/dist/SurfaceChart3DScene-ACPKCWLJ.js +0 -78
- package/dist/SurfaceChart3DScene-ACPKCWLJ.js.br +0 -0
- package/dist/SurfaceChart3DScene-ACPKCWLJ.js.gz +0 -0
- package/dist/SurfaceChart3DScene-JR62SOYO.mjs +0 -76
- package/dist/SurfaceChart3DScene-JR62SOYO.mjs.br +0 -0
- package/dist/SurfaceChart3DScene-JR62SOYO.mjs.gz +0 -0
- package/dist/chunk-4LWGAVAP.js.br +0 -0
- package/dist/chunk-4LWGAVAP.js.gz +0 -0
- package/dist/chunk-7XF6S4AM.mjs.br +0 -0
- package/dist/chunk-7XF6S4AM.mjs.gz +0 -0
- package/dist/chunk-ASKYZ5ZY.js.br +0 -0
- package/dist/chunk-ASKYZ5ZY.js.gz +0 -0
- package/dist/chunk-BZOL6FXF.mjs.br +0 -0
- package/dist/chunk-BZOL6FXF.mjs.gz +0 -0
- package/dist/chunk-GODW6RNR.mjs.br +0 -0
- package/dist/chunk-GODW6RNR.mjs.gz +0 -0
- package/dist/chunk-ICZDMFF2.js.br +0 -0
- package/dist/chunk-ICZDMFF2.js.gz +0 -0
- package/dist/chunk-MAVLV56S.js.br +0 -0
- package/dist/chunk-MAVLV56S.js.gz +0 -0
- package/dist/chunk-O7FTUUXP.mjs.br +0 -0
- package/dist/chunk-O7FTUUXP.mjs.gz +0 -0
- package/dist/chunk-QUB5OSKY.mjs.br +0 -0
- package/dist/chunk-QUB5OSKY.mjs.gz +0 -0
- package/dist/chunk-RTUGI4HQ.js.br +0 -0
- package/dist/chunk-RTUGI4HQ.js.gz +0 -0
- package/dist/chunk-SNL6LBRX.mjs.br +0 -0
- package/dist/chunk-SNL6LBRX.mjs.gz +0 -0
- package/dist/chunk-WVDM36ZM.js.br +0 -0
- package/dist/chunk-WVDM36ZM.js.gz +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkMVKRI3CZ_js = require('./chunk-MVKRI3CZ.js');
|
|
4
|
+
var chunkT7BIRNE4_js = require('./chunk-T7BIRNE4.js');
|
|
5
5
|
var clsx = require('clsx');
|
|
6
6
|
var tailwindMerge = require('tailwind-merge');
|
|
7
7
|
var React6 = require('react');
|
|
@@ -15,7 +15,7 @@ var React6__default = /*#__PURE__*/_interopDefault(React6);
|
|
|
15
15
|
|
|
16
16
|
// src/viewer/utils/animation-effects.ts
|
|
17
17
|
function getAnimationInitialStyle2(preset, nativeAnimation) {
|
|
18
|
-
return
|
|
18
|
+
return chunkT7BIRNE4_js.getAnimationInitialStyle(preset, nativeAnimation);
|
|
19
19
|
}
|
|
20
20
|
function cn(...inputs) {
|
|
21
21
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
@@ -23,7 +23,7 @@ function cn(...inputs) {
|
|
|
23
23
|
|
|
24
24
|
// src/viewer/utils/clone.ts
|
|
25
25
|
function cloneHistorySnapshot2(snapshot) {
|
|
26
|
-
return
|
|
26
|
+
return chunkT7BIRNE4_js.cloneHistorySnapshot(snapshot);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
// src/viewer/constants/scalar.ts
|
|
@@ -61,7 +61,7 @@ var TOOLBAR_SECTIONS = [
|
|
|
61
61
|
{ id: "view", labelKey: "pptx.ribbon.tab.view" },
|
|
62
62
|
{ id: "help", labelKey: "pptx.ribbon.tab.help" }
|
|
63
63
|
];
|
|
64
|
-
var SHORTCUT_REFERENCE_ITEMS =
|
|
64
|
+
var SHORTCUT_REFERENCE_ITEMS = chunkT7BIRNE4_js.VIEWER_SHORTCUT_REFERENCE;
|
|
65
65
|
|
|
66
66
|
// src/viewer/constants/theme.ts
|
|
67
67
|
var THEME_COLOR_SWATCHES = [
|
|
@@ -105,7 +105,7 @@ var GLYPH_COMPONENTS = {
|
|
|
105
105
|
plus: lu.LuPlus,
|
|
106
106
|
triangle: lu.LuTriangle
|
|
107
107
|
};
|
|
108
|
-
var SHAPE_PRESETS =
|
|
108
|
+
var SHAPE_PRESETS = chunkT7BIRNE4_js.SHAPE_PRESET_DEFS.map(
|
|
109
109
|
(def) => ({
|
|
110
110
|
type: def.type,
|
|
111
111
|
label: def.label,
|
|
@@ -264,7 +264,7 @@ function isConnectorOrLineElement(element) {
|
|
|
264
264
|
if (element.type === "connector") {
|
|
265
265
|
return true;
|
|
266
266
|
}
|
|
267
|
-
if (!
|
|
267
|
+
if (!chunkT7BIRNE4_js.hasShapeProperties(element)) {
|
|
268
268
|
return false;
|
|
269
269
|
}
|
|
270
270
|
const st = getShapeType(element.shapeType);
|
|
@@ -273,7 +273,7 @@ function isConnectorOrLineElement(element) {
|
|
|
273
273
|
|
|
274
274
|
// src/viewer/utils/image-style.ts
|
|
275
275
|
function getImageMaskStyle(element) {
|
|
276
|
-
if (!
|
|
276
|
+
if (!chunkT7BIRNE4_js.hasShapeProperties(element)) {
|
|
277
277
|
return void 0;
|
|
278
278
|
}
|
|
279
279
|
const shapeType = element.shapeType;
|
|
@@ -282,7 +282,7 @@ function getImageMaskStyle(element) {
|
|
|
282
282
|
}
|
|
283
283
|
const normalized = shapeType.toLowerCase();
|
|
284
284
|
if (normalized === "roundrect" || normalized === "round1rect" || normalized === "round2samerect" || normalized === "round2diagrect" || normalized === "sniproundrect" || normalized === "snip1rect" || normalized === "snip2diagrect") {
|
|
285
|
-
const radiusPx =
|
|
285
|
+
const radiusPx = chunkT7BIRNE4_js.getRoundRectRadiusPx2(element);
|
|
286
286
|
if (radiusPx <= 0.01) {
|
|
287
287
|
return void 0;
|
|
288
288
|
}
|
|
@@ -294,7 +294,7 @@ function getImageMaskStyle(element) {
|
|
|
294
294
|
if (normalized === "can" || normalized === "cylinder") {
|
|
295
295
|
return { borderRadius: "48% / 12%" };
|
|
296
296
|
}
|
|
297
|
-
const clipPath =
|
|
297
|
+
const clipPath = chunkT7BIRNE4_js.getResolvedShapeClipPath(element);
|
|
298
298
|
if (!clipPath) {
|
|
299
299
|
return void 0;
|
|
300
300
|
}
|
|
@@ -303,7 +303,7 @@ function getImageMaskStyle(element) {
|
|
|
303
303
|
function getImageRenderStyle(element) {
|
|
304
304
|
return {
|
|
305
305
|
...getImageMaskStyle(element) || {},
|
|
306
|
-
...
|
|
306
|
+
...chunkT7BIRNE4_js.getImageFitStyle(element)
|
|
307
307
|
};
|
|
308
308
|
}
|
|
309
309
|
var CROP_SHAPE_CLIP_PATHS = {
|
|
@@ -316,7 +316,7 @@ var CROP_SHAPE_CLIP_PATHS = {
|
|
|
316
316
|
star: "polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%)"
|
|
317
317
|
};
|
|
318
318
|
function getCropShapeClipPath(element) {
|
|
319
|
-
if (!
|
|
319
|
+
if (!chunkT7BIRNE4_js.isImageLikeElement(element)) {
|
|
320
320
|
return void 0;
|
|
321
321
|
}
|
|
322
322
|
const shape = element.cropShape;
|
|
@@ -326,7 +326,7 @@ function getCropShapeClipPath(element) {
|
|
|
326
326
|
return CROP_SHAPE_CLIP_PATHS[shape];
|
|
327
327
|
}
|
|
328
328
|
function getImageTilingStyle2(element) {
|
|
329
|
-
return
|
|
329
|
+
return chunkT7BIRNE4_js.getImageTilingStyle(element);
|
|
330
330
|
}
|
|
331
331
|
|
|
332
332
|
// src/viewer/utils/geometry-image.ts
|
|
@@ -526,9 +526,9 @@ function registerMediaElement(elementId, el) {
|
|
|
526
526
|
};
|
|
527
527
|
}
|
|
528
528
|
function executeMediaCommand(command, frameRoot) {
|
|
529
|
-
return
|
|
529
|
+
return chunkT7BIRNE4_js.runMediaCommand(
|
|
530
530
|
command,
|
|
531
|
-
(targetId) => registry.get(targetId) ??
|
|
531
|
+
(targetId) => registry.get(targetId) ?? chunkT7BIRNE4_js.findMediaElementByElementId(targetId, frameRoot?.())
|
|
532
532
|
);
|
|
533
533
|
}
|
|
534
534
|
function PresentationMediaController({
|
|
@@ -572,7 +572,7 @@ function PresentationMediaController({
|
|
|
572
572
|
loop: shouldLoop,
|
|
573
573
|
volume: playbackVolume,
|
|
574
574
|
playbackRate
|
|
575
|
-
} =
|
|
575
|
+
} = chunkT7BIRNE4_js.mediaPlaybackAttributes({
|
|
576
576
|
loop: element.loop,
|
|
577
577
|
volume: element.volume,
|
|
578
578
|
playbackSpeed: element.playbackSpeed
|
|
@@ -708,7 +708,7 @@ function PresentationMediaController({
|
|
|
708
708
|
if (element.playAcrossSlides && element.mediaType === "audio") {
|
|
709
709
|
const dataUrl = element.mediaData ?? resolvedDataUrl;
|
|
710
710
|
if (dataUrl) {
|
|
711
|
-
|
|
711
|
+
chunkT7BIRNE4_js.registerPersistentAudio(
|
|
712
712
|
element.id,
|
|
713
713
|
dataUrl,
|
|
714
714
|
element.mediaMimeType,
|
|
@@ -770,7 +770,7 @@ function PresentationMediaController({
|
|
|
770
770
|
] });
|
|
771
771
|
}
|
|
772
772
|
function label(key) {
|
|
773
|
-
return key === void 0 ? void 0 :
|
|
773
|
+
return key === void 0 ? void 0 : chunkMVKRI3CZ_js.translationsEn[key];
|
|
774
774
|
}
|
|
775
775
|
function FallbackIcon({
|
|
776
776
|
paths,
|
|
@@ -806,17 +806,17 @@ function Badge({
|
|
|
806
806
|
"div",
|
|
807
807
|
{
|
|
808
808
|
className: `absolute inset-0 flex flex-col items-center justify-center ${isMissing ? "gap-1" : ""}`,
|
|
809
|
-
...{ [
|
|
809
|
+
...{ [chunkT7BIRNE4_js.MEDIA_CHROME_ATTRIBUTE]: visual.badge },
|
|
810
810
|
children: [
|
|
811
811
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
812
812
|
FallbackIcon,
|
|
813
813
|
{
|
|
814
|
-
paths:
|
|
814
|
+
paths: chunkT7BIRNE4_js.mediaFallbackIcon(visual, element.mediaType),
|
|
815
815
|
size: isMissing ? 32 : 48,
|
|
816
816
|
className: isMissing ? "text-white/60" : "text-white/80 drop-shadow-md"
|
|
817
817
|
}
|
|
818
818
|
),
|
|
819
|
-
isMissing && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-white/60", children: label(
|
|
819
|
+
isMissing && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-white/60", children: label(chunkT7BIRNE4_js.mediaFallbackLabelKey(visual, element.mediaType)) })
|
|
820
820
|
]
|
|
821
821
|
}
|
|
822
822
|
);
|
|
@@ -833,17 +833,17 @@ function Placeholder({
|
|
|
833
833
|
"div",
|
|
834
834
|
{
|
|
835
835
|
className: `w-full h-full flex flex-col items-center justify-center gap-1 pointer-events-none rounded ${isMissing ? "bg-black/30 border border-dashed border-white/20" : element.mediaType === "audio" ? "bg-black/10" : "bg-black/20"}`,
|
|
836
|
-
...{ [
|
|
836
|
+
...{ [chunkT7BIRNE4_js.MEDIA_CHROME_ATTRIBUTE]: visual.placeholder },
|
|
837
837
|
children: [
|
|
838
838
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
839
839
|
FallbackIcon,
|
|
840
840
|
{
|
|
841
|
-
paths:
|
|
841
|
+
paths: chunkT7BIRNE4_js.mediaFallbackIcon(visual, element.mediaType),
|
|
842
842
|
size: isMissing ? 36 : element.mediaType === "audio" ? 24 : 32,
|
|
843
843
|
className: isMissing ? "text-white/50" : "text-white/70"
|
|
844
844
|
}
|
|
845
845
|
),
|
|
846
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `text-[10px] ${isMissing ? "text-white/50" : "text-white/70"}`, children: label(
|
|
846
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `text-[10px] ${isMissing ? "text-white/50" : "text-white/70"}`, children: label(chunkT7BIRNE4_js.mediaFallbackLabelKey(visual, element.mediaType)) })
|
|
847
847
|
]
|
|
848
848
|
}
|
|
849
849
|
);
|
|
@@ -853,7 +853,7 @@ function renderMediaFallback({
|
|
|
853
853
|
posterUrl,
|
|
854
854
|
surface
|
|
855
855
|
}) {
|
|
856
|
-
const visual =
|
|
856
|
+
const visual = chunkT7BIRNE4_js.mediaFallbackVisual(surface, {
|
|
857
857
|
hasPoster: Boolean(posterUrl),
|
|
858
858
|
missing: element.mediaMissing === true
|
|
859
859
|
});
|
|
@@ -863,7 +863,7 @@ function renderMediaFallback({
|
|
|
863
863
|
"img",
|
|
864
864
|
{
|
|
865
865
|
src: posterUrl,
|
|
866
|
-
alt: visual.dimPoster ?
|
|
866
|
+
alt: visual.dimPoster ? chunkMVKRI3CZ_js.translationsEn["pptx.media.posterAlt"] : chunkMVKRI3CZ_js.translationsEn["pptx.media.videoPosterAlt"],
|
|
867
867
|
className: `w-full h-full object-contain${visual.dimPoster ? " opacity-50" : ""}`
|
|
868
868
|
}
|
|
869
869
|
),
|
|
@@ -874,7 +874,7 @@ function renderMediaFallback({
|
|
|
874
874
|
}
|
|
875
875
|
function renderMediaElement(element, mediaDataUrls, options) {
|
|
876
876
|
if (element.type !== "media") {
|
|
877
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center text-[11px] text-white/80 pointer-events-none", children:
|
|
877
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center text-[11px] text-white/80 pointer-events-none", children: chunkMVKRI3CZ_js.translationsEn["pptx.media.title"] });
|
|
878
878
|
}
|
|
879
879
|
const mediaType = element.mediaType;
|
|
880
880
|
const mediaPath = element.mediaPath;
|
|
@@ -882,7 +882,7 @@ function renderMediaElement(element, mediaDataUrls, options) {
|
|
|
882
882
|
const dataUrl = element.mediaData ?? (mediaPath ? mediaDataUrls.get(mediaPath) : void 0);
|
|
883
883
|
const trimFragment = buildTrimFragment(element);
|
|
884
884
|
const posterUrl = element.posterFrameData ?? void 0;
|
|
885
|
-
const shouldLoop =
|
|
885
|
+
const shouldLoop = chunkT7BIRNE4_js.mediaPlaybackAttributes(element).loop;
|
|
886
886
|
const shouldAutoPlay = options?.autoPlay === true || element.autoPlay === true;
|
|
887
887
|
const isFullScreen = options?.fullScreen === true;
|
|
888
888
|
const isPresentationMode = options?.isPresentationMode === true;
|
|
@@ -960,24 +960,24 @@ function renderMediaElement(element, mediaDataUrls, options) {
|
|
|
960
960
|
if (surface.presenting || surface.preview) {
|
|
961
961
|
return null;
|
|
962
962
|
}
|
|
963
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center text-[11px] text-white/80 pointer-events-none", children:
|
|
963
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center text-[11px] text-white/80 pointer-events-none", children: chunkMVKRI3CZ_js.translationsEn["pptx.media.title"] });
|
|
964
964
|
}
|
|
965
965
|
|
|
966
966
|
// src/viewer/utils/text-utils.tsx
|
|
967
967
|
function getTextStyleForElement(element, fallbackColor) {
|
|
968
|
-
return
|
|
968
|
+
return chunkT7BIRNE4_js.buildTextBlockStyle(element, { fallbackColor });
|
|
969
969
|
}
|
|
970
970
|
|
|
971
971
|
// src/viewer/utils/text-layout.tsx
|
|
972
972
|
function getTextLayoutStyle(element) {
|
|
973
|
-
if (!
|
|
973
|
+
if (!chunkT7BIRNE4_js.hasTextProperties(element)) {
|
|
974
974
|
return {};
|
|
975
975
|
}
|
|
976
|
-
const writingMode =
|
|
977
|
-
const textOrientation =
|
|
978
|
-
const verticalDirection =
|
|
976
|
+
const writingMode = chunkT7BIRNE4_js.toCssWritingMode(element.textStyle?.textDirection);
|
|
977
|
+
const textOrientation = chunkT7BIRNE4_js.toCssTextOrientation(element.textStyle?.textDirection);
|
|
978
|
+
const verticalDirection = chunkT7BIRNE4_js.toCssVerticalDirection(element.textStyle?.textDirection);
|
|
979
979
|
const textWrapNone = element.textStyle?.textWrap === "none";
|
|
980
|
-
const hasParagraphIndents =
|
|
980
|
+
const hasParagraphIndents = chunkT7BIRNE4_js.hasTextProperties(element) && element.paragraphIndents && element.paragraphIndents.length > 0;
|
|
981
981
|
const paragraphMarginLeft = element.textStyle?.paragraphMarginLeft;
|
|
982
982
|
const paragraphIndent = element.textStyle?.paragraphIndent;
|
|
983
983
|
const marginLeft = !hasParagraphIndents && typeof paragraphMarginLeft === "number" && paragraphMarginLeft !== 0 ? paragraphMarginLeft : void 0;
|
|
@@ -986,7 +986,7 @@ function getTextLayoutStyle(element) {
|
|
|
986
986
|
const bodyBottom = element.textStyle?.bodyInsetBottom ?? DEFAULT_BODY_INSET_TB_PX;
|
|
987
987
|
return {
|
|
988
988
|
// Columns / flex anchoring / anchorCtr / tab-size / kinsoku, from shared.
|
|
989
|
-
...
|
|
989
|
+
...chunkT7BIRNE4_js.buildTextBodyLayoutStyle(element),
|
|
990
990
|
// Body inset only. Paragraph spacing (spcBef/spcAft) is applied
|
|
991
991
|
// per-paragraph by the paragraph renderer, not collapsed here.
|
|
992
992
|
paddingTop: bodyTop,
|
|
@@ -1005,7 +1005,7 @@ function getTextLayoutStyle(element) {
|
|
|
1005
1005
|
|
|
1006
1006
|
// src/viewer/utils/text-effects.tsx
|
|
1007
1007
|
function buildTextBody3DSceneStyle2(textStyle) {
|
|
1008
|
-
return
|
|
1008
|
+
return chunkT7BIRNE4_js.buildTextBody3DSceneStyle(textStyle);
|
|
1009
1009
|
}
|
|
1010
1010
|
|
|
1011
1011
|
// src/viewer/utils/text-warp-css.tsx
|
|
@@ -1190,13 +1190,13 @@ function wrapWithTextBuildAnimation(elementId, paraIndex, renderedSegments, para
|
|
|
1190
1190
|
if (!subElementAnimStates || subElementAnimStates.size === 0) {
|
|
1191
1191
|
return renderedSegments;
|
|
1192
1192
|
}
|
|
1193
|
-
const paraKey = `${elementId}${
|
|
1193
|
+
const paraKey = `${elementId}${chunkT7BIRNE4_js.TEXT_BUILD_ID_SEP}p${paraIndex}`;
|
|
1194
1194
|
const paraState = subElementAnimStates.get(paraKey);
|
|
1195
1195
|
if (paraState) {
|
|
1196
1196
|
const style = buildAnimStyle(paraState);
|
|
1197
1197
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { "data-anim-id": paraKey, style: { display: "inline", ...style }, children: renderedSegments }, paraKey);
|
|
1198
1198
|
}
|
|
1199
|
-
const spec =
|
|
1199
|
+
const spec = chunkT7BIRNE4_js.buildTextBuildSpec(
|
|
1200
1200
|
elementId,
|
|
1201
1201
|
paraIndex,
|
|
1202
1202
|
paraRuns.map((run) => ({ text: run.text, style: run })),
|
|
@@ -1214,7 +1214,7 @@ function wrapWithTextBuildAnimation(elementId, paraIndex, renderedSegments, para
|
|
|
1214
1214
|
"span",
|
|
1215
1215
|
{
|
|
1216
1216
|
"data-anim-id": span.animId,
|
|
1217
|
-
style:
|
|
1217
|
+
style: chunkT7BIRNE4_js.textBuildSpanStyle(span),
|
|
1218
1218
|
children: content
|
|
1219
1219
|
},
|
|
1220
1220
|
span.animId
|
|
@@ -1324,7 +1324,7 @@ function fillLeader(glyph, width, font) {
|
|
|
1324
1324
|
const count = Math.ceil(width / glyphWidth) + 1;
|
|
1325
1325
|
return glyph.repeat(count);
|
|
1326
1326
|
}
|
|
1327
|
-
function renderTabbedLine(line, ctx, keyPrefix, renderPiece) {
|
|
1327
|
+
function renderTabbedLine(line, ctx, keyPrefix, renderPiece, nestedStyle) {
|
|
1328
1328
|
const segments = line.split(" ");
|
|
1329
1329
|
const pieces = computeTabbedLayout(
|
|
1330
1330
|
segments,
|
|
@@ -1350,44 +1350,47 @@ function renderTabbedLine(line, ctx, keyPrefix, renderPiece) {
|
|
|
1350
1350
|
children: piece.leaderChar ? fillLeader(piece.leaderChar, piece.leaderWidth, ctx.font) : ""
|
|
1351
1351
|
}
|
|
1352
1352
|
) : null,
|
|
1353
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { display: "inline-block", whiteSpace: "pre" }, children: renderPiece(piece.text, key) })
|
|
1353
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { ...nestedStyle, display: "inline-block", whiteSpace: "pre" }, children: renderPiece(piece.text, key) })
|
|
1354
1354
|
] }, key);
|
|
1355
1355
|
}) });
|
|
1356
1356
|
}
|
|
1357
|
-
function renderScriptAwareText(text, needsScriptFonts, scriptFonts, baseFontFamily, keyPrefix) {
|
|
1357
|
+
function renderScriptAwareText(text, needsScriptFonts, scriptFonts, baseFontFamily, keyPrefix, nestedStyle) {
|
|
1358
1358
|
if (!needsScriptFonts || !text) {
|
|
1359
1359
|
return text;
|
|
1360
1360
|
}
|
|
1361
|
-
const runs =
|
|
1361
|
+
const runs = chunkT7BIRNE4_js.segmentByScript(text);
|
|
1362
1362
|
if (runs.length <= 1) {
|
|
1363
1363
|
if (runs.length === 1) {
|
|
1364
|
-
const font =
|
|
1364
|
+
const font = chunkT7BIRNE4_js.resolveFontForScript(runs[0].script, scriptFonts);
|
|
1365
1365
|
if (font && font !== baseFontFamily) {
|
|
1366
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontFamily: font }, children: text });
|
|
1366
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { style: { ...nestedStyle, fontFamily: font }, children: text });
|
|
1367
1367
|
}
|
|
1368
1368
|
}
|
|
1369
1369
|
return text;
|
|
1370
1370
|
}
|
|
1371
1371
|
return runs.map((run, i) => {
|
|
1372
|
-
const font =
|
|
1372
|
+
const font = chunkT7BIRNE4_js.resolveFontForScript(run.script, scriptFonts);
|
|
1373
1373
|
if (!font || font === baseFontFamily) {
|
|
1374
1374
|
return /* @__PURE__ */ jsxRuntime.jsx(React6__default.default.Fragment, { children: run.text }, `${keyPrefix}-r${i}`);
|
|
1375
1375
|
}
|
|
1376
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontFamily: font }, children: run.text }, `${keyPrefix}-r${i}`);
|
|
1376
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { style: { ...nestedStyle, fontFamily: font }, children: run.text }, `${keyPrefix}-r${i}`);
|
|
1377
1377
|
});
|
|
1378
1378
|
}
|
|
1379
1379
|
function renderMetricPieces(text, metric, keyPrefix, inner) {
|
|
1380
1380
|
if (!metric || !text) {
|
|
1381
1381
|
return inner(text, keyPrefix);
|
|
1382
1382
|
}
|
|
1383
|
-
const pieces =
|
|
1383
|
+
const pieces = chunkT7BIRNE4_js.splitRunForMetrics(text, metric.font);
|
|
1384
1384
|
if (pieces.length <= 1) {
|
|
1385
1385
|
return inner(text, keyPrefix);
|
|
1386
1386
|
}
|
|
1387
1387
|
return pieces.map((piece, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1388
1388
|
"span",
|
|
1389
1389
|
{
|
|
1390
|
-
style: {
|
|
1390
|
+
style: {
|
|
1391
|
+
...metric.nestedStyle,
|
|
1392
|
+
letterSpacing: chunkT7BIRNE4_js.pieceLetterSpacing(metric.authoredPx, piece.tracking)
|
|
1393
|
+
},
|
|
1391
1394
|
children: inner(piece.text, `${keyPrefix}-w${i}`)
|
|
1392
1395
|
},
|
|
1393
1396
|
`${keyPrefix}-w${i}`
|
|
@@ -1402,10 +1405,17 @@ function renderSegmentContent(elementId, segmentIndex, textValue, lines, needsSc
|
|
|
1402
1405
|
text,
|
|
1403
1406
|
metric,
|
|
1404
1407
|
key,
|
|
1405
|
-
(pieceText, pieceKey) => renderScriptAwareText(
|
|
1408
|
+
(pieceText, pieceKey) => renderScriptAwareText(
|
|
1409
|
+
pieceText,
|
|
1410
|
+
needsScriptFonts,
|
|
1411
|
+
scriptFonts,
|
|
1412
|
+
baseFontFamily,
|
|
1413
|
+
pieceKey,
|
|
1414
|
+
metric?.nestedStyle
|
|
1415
|
+
)
|
|
1406
1416
|
);
|
|
1407
1417
|
return /* @__PURE__ */ jsxRuntime.jsxs(React6__default.default.Fragment, { children: [
|
|
1408
|
-
tabContext && line.includes(" ") ? renderTabbedLine(line, tabContext, lineKey, renderPiece) : renderPiece(line, lineKey),
|
|
1418
|
+
tabContext && line.includes(" ") ? renderTabbedLine(line, tabContext, lineKey, renderPiece, metric?.nestedStyle) : renderPiece(line, lineKey),
|
|
1409
1419
|
lineIndex < lines.length - 1 ? /* @__PURE__ */ jsxRuntime.jsx("br", {}) : null
|
|
1410
1420
|
] }, lineKey);
|
|
1411
1421
|
});
|
|
@@ -1439,7 +1449,14 @@ function renderSegmentContent(elementId, segmentIndex, textValue, lines, needsSc
|
|
|
1439
1449
|
text,
|
|
1440
1450
|
metric,
|
|
1441
1451
|
key,
|
|
1442
|
-
(pieceText, pieceKey) => renderScriptAwareText(
|
|
1452
|
+
(pieceText, pieceKey) => renderScriptAwareText(
|
|
1453
|
+
pieceText,
|
|
1454
|
+
needsScriptFonts,
|
|
1455
|
+
scriptFonts,
|
|
1456
|
+
baseFontFamily,
|
|
1457
|
+
pieceKey,
|
|
1458
|
+
metric?.nestedStyle
|
|
1459
|
+
)
|
|
1443
1460
|
);
|
|
1444
1461
|
return chunks.map((chunk, ci) => {
|
|
1445
1462
|
const chunkKey = `${elementId}-seg-${segmentIndex}-hl-${ci}`;
|
|
@@ -1447,6 +1464,7 @@ function renderSegmentContent(elementId, segmentIndex, textValue, lines, needsSc
|
|
|
1447
1464
|
"mark",
|
|
1448
1465
|
{
|
|
1449
1466
|
style: {
|
|
1467
|
+
...metric?.nestedStyle,
|
|
1450
1468
|
backgroundColor: chunk.isCurrent ? "#f97316" : "#facc15",
|
|
1451
1469
|
color: "inherit",
|
|
1452
1470
|
borderRadius: 2
|
|
@@ -1458,8 +1476,8 @@ function renderSegmentContent(elementId, segmentIndex, textValue, lines, needsSc
|
|
|
1458
1476
|
});
|
|
1459
1477
|
}
|
|
1460
1478
|
function renderEquationSegment(elementId, segmentIndex, equationXml, equationNumber) {
|
|
1461
|
-
const mathml =
|
|
1462
|
-
const safeMathml = mathml ?
|
|
1479
|
+
const mathml = chunkT7BIRNE4_js.convertOmmlToMathMl(equationXml);
|
|
1480
|
+
const safeMathml = mathml ? chunkT7BIRNE4_js.sanitizeMathMl(mathml) : "";
|
|
1463
1481
|
const equationContent = safeMathml ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1464
1482
|
"span",
|
|
1465
1483
|
{
|
|
@@ -1469,7 +1487,7 @@ function renderEquationSegment(elementId, segmentIndex, equationXml, equationNum
|
|
|
1469
1487
|
},
|
|
1470
1488
|
dangerouslySetInnerHTML: { __html: safeMathml }
|
|
1471
1489
|
}
|
|
1472
|
-
) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-block px-1 py-0.5 rounded text-xs bg-gray-200/20 text-gray-400 italic", children:
|
|
1490
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-block px-1 py-0.5 rounded text-xs bg-gray-200/20 text-gray-400 italic", children: chunkMVKRI3CZ_js.translationsEn["pptx.textSegment.equationFallback"] });
|
|
1473
1491
|
if (equationNumber) {
|
|
1474
1492
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1475
1493
|
"span",
|
|
@@ -1519,7 +1537,7 @@ function renderParagraphRun(run, segment, ctx, keySuffix = "") {
|
|
|
1519
1537
|
const segmentStyle = segment?.style ?? {};
|
|
1520
1538
|
const textValue = run.text;
|
|
1521
1539
|
const lines = textValue.split("\n");
|
|
1522
|
-
const resolvedSegmentColor =
|
|
1540
|
+
const resolvedSegmentColor = chunkT7BIRNE4_js.normalizeHexColor(
|
|
1523
1541
|
segmentStyle.color || element.textStyle?.color,
|
|
1524
1542
|
run.hyperlink ? HYPERLINK_COLOR : fallbackColor
|
|
1525
1543
|
);
|
|
@@ -1527,16 +1545,16 @@ function renderParagraphRun(run, segment, ctx, keySuffix = "") {
|
|
|
1527
1545
|
const baselineFraction = rawBaseline === 0 ? 0 : Math.abs(rawBaseline) >= 1e3 ? rawBaseline / 1e5 : rawBaseline / 100;
|
|
1528
1546
|
const baselineFontScale = baselineFraction !== 0 ? BASELINE_FONT_SCALE : 1;
|
|
1529
1547
|
const rawFontSize = segmentStyle.fontSize || element.textStyle?.fontSize || DEFAULT_TEXT_FONT_SIZE;
|
|
1530
|
-
const baseFontSize = rawFontSize *
|
|
1548
|
+
const baseFontSize = rawFontSize * chunkT7BIRNE4_js.resolveAutoFitFontScale(element.textStyle);
|
|
1531
1549
|
const baselineShift = baselineFraction !== 0 ? `${baselineFraction * baseFontSize}px` : void 0;
|
|
1532
1550
|
const baseFontSizePt = baseFontSize * (72 / 96);
|
|
1533
1551
|
const fontKerning = typeof segmentStyle.kerning === "number" ? segmentStyle.kerning === 0 ? "none" : baseFontSizePt >= segmentStyle.kerning / 100 ? "normal" : "none" : void 0;
|
|
1534
1552
|
const rawFontFamily = segmentStyle.fontFamily || element.textStyle?.fontFamily;
|
|
1535
|
-
const baseFontFamily = rawFontFamily ?
|
|
1553
|
+
const baseFontFamily = rawFontFamily ? chunkT7BIRNE4_js.getSubstituteFontFamily(
|
|
1536
1554
|
rawFontFamily,
|
|
1537
|
-
|
|
1555
|
+
chunkT7BIRNE4_js.parsePanoseString(segmentStyle.latinFontPanose ?? element.textStyle?.latinFontPanose)
|
|
1538
1556
|
) : DEFAULT_FONT_FAMILY2;
|
|
1539
|
-
const scriptFont = (name, panose) => name ?
|
|
1557
|
+
const scriptFont = (name, panose) => name ? chunkT7BIRNE4_js.getSubstituteFontFamily(name, chunkT7BIRNE4_js.parsePanoseString(panose)) : baseFontFamily;
|
|
1540
1558
|
const scriptFonts = {
|
|
1541
1559
|
latin: baseFontFamily,
|
|
1542
1560
|
eastAsia: scriptFont(
|
|
@@ -1552,7 +1570,7 @@ function renderParagraphRun(run, segment, ctx, keySuffix = "") {
|
|
|
1552
1570
|
segmentStyle.symbolFontPanose ?? element.textStyle?.symbolFontPanose
|
|
1553
1571
|
)
|
|
1554
1572
|
};
|
|
1555
|
-
const needsScriptFonts =
|
|
1573
|
+
const needsScriptFonts = chunkT7BIRNE4_js.hasDistinctScriptFonts(scriptFonts);
|
|
1556
1574
|
const authoredLetterSpacing = typeof segmentStyle.characterSpacing === "number" && segmentStyle.characterSpacing !== 0 ? segmentStyle.characterSpacing / 100 * (96 / 72) : 0;
|
|
1557
1575
|
const metricFont = {
|
|
1558
1576
|
fontFamily: baseFontFamily,
|
|
@@ -1560,17 +1578,25 @@ function renderParagraphRun(run, segment, ctx, keySuffix = "") {
|
|
|
1560
1578
|
bold: Boolean(segmentStyle.bold),
|
|
1561
1579
|
italic: Boolean(segmentStyle.italic)
|
|
1562
1580
|
};
|
|
1563
|
-
const
|
|
1581
|
+
const nestedStyle = chunkT7BIRNE4_js.nestedTextDecorationStyle(run.style);
|
|
1582
|
+
const metricContext = { font: metricFont, authoredPx: authoredLetterSpacing, nestedStyle };
|
|
1564
1583
|
const spanStyle = { ...run.style };
|
|
1565
1584
|
spanStyle.color = resolvedSegmentColor;
|
|
1566
1585
|
spanStyle.fontSize = baseFontSize * baselineFontScale;
|
|
1567
1586
|
spanStyle.fontFamily = baseFontFamily;
|
|
1568
1587
|
spanStyle.verticalAlign = baselineShift;
|
|
1569
1588
|
spanStyle.fontKerning = fontKerning;
|
|
1570
|
-
spanStyle.letterSpacing =
|
|
1589
|
+
spanStyle.letterSpacing = chunkT7BIRNE4_js.pieceLetterSpacing(
|
|
1571
1590
|
authoredLetterSpacing,
|
|
1572
|
-
|
|
1591
|
+
chunkT7BIRNE4_js.resolveMetricTrackingPx(textValue, metricFont)
|
|
1573
1592
|
);
|
|
1593
|
+
const hollow = chunkT7BIRNE4_js.hollowTextFillStyle(segmentStyle, {
|
|
1594
|
+
color: resolvedSegmentColor,
|
|
1595
|
+
textStroke: typeof spanStyle.WebkitTextStroke === "string" ? spanStyle.WebkitTextStroke : void 0
|
|
1596
|
+
});
|
|
1597
|
+
if (hollow) {
|
|
1598
|
+
Object.assign(spanStyle, hollow);
|
|
1599
|
+
}
|
|
1574
1600
|
const runRtl = segmentStyle.rtl;
|
|
1575
1601
|
if (runRtl !== void 0) {
|
|
1576
1602
|
spanStyle.direction = runRtl ? "rtl" : "ltr";
|
|
@@ -1661,7 +1687,7 @@ function renderHyperlink(run, spanNode, key, ctx) {
|
|
|
1661
1687
|
);
|
|
1662
1688
|
}
|
|
1663
1689
|
function renderTextSegments(element, fallbackColor, emptyFallback, findHighlights, onHyperlinkClick, fieldContext, subElementAnimStates, segmentOverrides, requireCtrlClick) {
|
|
1664
|
-
if (!
|
|
1690
|
+
if (!chunkT7BIRNE4_js.hasTextProperties(element)) {
|
|
1665
1691
|
return emptyFallback || null;
|
|
1666
1692
|
}
|
|
1667
1693
|
const segments = segmentOverrides ?? element.textSegments;
|
|
@@ -1671,7 +1697,7 @@ function renderTextSegments(element, fallbackColor, emptyFallback, findHighlight
|
|
|
1671
1697
|
}
|
|
1672
1698
|
return element.text || emptyFallback || "";
|
|
1673
1699
|
}
|
|
1674
|
-
const paragraphs =
|
|
1700
|
+
const paragraphs = chunkT7BIRNE4_js.buildParagraphs(element, fieldContext, segmentOverrides);
|
|
1675
1701
|
const ctx = {
|
|
1676
1702
|
element,
|
|
1677
1703
|
fallbackColor,
|
|
@@ -1804,13 +1830,13 @@ function hexToRgbUnit(hex) {
|
|
|
1804
1830
|
};
|
|
1805
1831
|
}
|
|
1806
1832
|
function getDuotoneColors(element) {
|
|
1807
|
-
if (!
|
|
1833
|
+
if (!chunkT7BIRNE4_js.isImageLikeElement(element)) {
|
|
1808
1834
|
return void 0;
|
|
1809
1835
|
}
|
|
1810
1836
|
return element.imageEffects?.duotone;
|
|
1811
1837
|
}
|
|
1812
1838
|
function buildLineShadowCss(element) {
|
|
1813
|
-
if (!
|
|
1839
|
+
if (!chunkT7BIRNE4_js.hasShapeProperties(element)) {
|
|
1814
1840
|
return void 0;
|
|
1815
1841
|
}
|
|
1816
1842
|
const ss = element.shapeStyle;
|
|
@@ -1821,13 +1847,13 @@ function buildLineShadowCss(element) {
|
|
|
1821
1847
|
const offsetY = typeof ss.lineShadowOffsetY === "number" ? ss.lineShadowOffsetY : 2;
|
|
1822
1848
|
const blur = typeof ss.lineShadowBlur === "number" ? Math.max(0, ss.lineShadowBlur) : 4;
|
|
1823
1849
|
const opacity = typeof ss.lineShadowOpacity === "number" ? Math.max(0, Math.min(1, ss.lineShadowOpacity)) : 0.35;
|
|
1824
|
-
return `${Math.round(offsetX)}px ${Math.round(offsetY)}px ${Math.round(blur)}px ${
|
|
1825
|
-
|
|
1850
|
+
return `${Math.round(offsetX)}px ${Math.round(offsetY)}px ${Math.round(blur)}px ${chunkT7BIRNE4_js.colorWithOpacity(
|
|
1851
|
+
chunkT7BIRNE4_js.normalizeHexColor(ss.lineShadowColor, "#000000"),
|
|
1826
1852
|
opacity
|
|
1827
1853
|
)}`;
|
|
1828
1854
|
}
|
|
1829
1855
|
function buildLineGlowFilter(element) {
|
|
1830
|
-
if (!
|
|
1856
|
+
if (!chunkT7BIRNE4_js.hasShapeProperties(element)) {
|
|
1831
1857
|
return void 0;
|
|
1832
1858
|
}
|
|
1833
1859
|
const ss = element.shapeStyle;
|
|
@@ -1836,14 +1862,14 @@ function buildLineGlowFilter(element) {
|
|
|
1836
1862
|
}
|
|
1837
1863
|
const glowOpacity = typeof ss.lineGlowOpacity === "number" ? ss.lineGlowOpacity : 0.75;
|
|
1838
1864
|
const glowRad = Math.round(Math.max(0, ss.lineGlowRadius));
|
|
1839
|
-
const glowCol =
|
|
1865
|
+
const glowCol = chunkT7BIRNE4_js.colorWithOpacity(chunkT7BIRNE4_js.normalizeHexColor(ss.lineGlowColor, "#ffff00"), glowOpacity);
|
|
1840
1866
|
return `drop-shadow(0 0 ${glowRad}px ${glowCol})`;
|
|
1841
1867
|
}
|
|
1842
1868
|
function getDagDuotoneFilterId(elementId) {
|
|
1843
1869
|
return `dag-duotone-${elementId}`;
|
|
1844
1870
|
}
|
|
1845
1871
|
function hasDagDuotoneEffect(element) {
|
|
1846
|
-
if (!
|
|
1872
|
+
if (!chunkT7BIRNE4_js.hasShapeProperties(element)) {
|
|
1847
1873
|
return false;
|
|
1848
1874
|
}
|
|
1849
1875
|
return Boolean(element.shapeStyle?.dagDuotone);
|
|
@@ -1895,7 +1921,7 @@ function renderDagDuotoneSvgFilter(elementId, color1, color2) {
|
|
|
1895
1921
|
|
|
1896
1922
|
// src/viewer/utils/shape-visual-3d.ts
|
|
1897
1923
|
function build3DExtrusionData2(shape3d, scene3d, fillColor, elementWidth, elementHeight) {
|
|
1898
|
-
return
|
|
1924
|
+
return chunkT7BIRNE4_js.build3DExtrusionData(
|
|
1899
1925
|
shape3d,
|
|
1900
1926
|
scene3d,
|
|
1901
1927
|
fillColor,
|
|
@@ -1904,7 +1930,7 @@ function build3DExtrusionData2(shape3d, scene3d, fillColor, elementWidth, elemen
|
|
|
1904
1930
|
);
|
|
1905
1931
|
}
|
|
1906
1932
|
function apply3dEffects2(base, scene3d, shape3d, fillColorFallback) {
|
|
1907
|
-
|
|
1933
|
+
chunkT7BIRNE4_js.apply3dEffects(base, scene3d, shape3d, fillColorFallback);
|
|
1908
1934
|
}
|
|
1909
1935
|
|
|
1910
1936
|
// src/viewer/utils/shape-visual-style.ts
|
|
@@ -1912,13 +1938,13 @@ function rendersCustomVectorPath(element) {
|
|
|
1912
1938
|
return (element.type === "shape" || element.type === "image" || element.type === "picture") && Boolean(element.pathData) && typeof element.pathWidth === "number" && element.pathWidth > 0 && typeof element.pathHeight === "number" && element.pathHeight > 0;
|
|
1913
1939
|
}
|
|
1914
1940
|
function getShapeVisualStyle(element, _hasFill, fillColor, _strokeWidth, _strokeColor, animatesFill, animatesStroke, parentGroupFill) {
|
|
1915
|
-
if (!
|
|
1941
|
+
if (!chunkT7BIRNE4_js.hasShapeProperties(element)) {
|
|
1916
1942
|
return {};
|
|
1917
1943
|
}
|
|
1918
1944
|
const ss = element.shapeStyle;
|
|
1919
|
-
const fill = animatesFill ? void 0 :
|
|
1920
|
-
const fx =
|
|
1921
|
-
const stroke =
|
|
1945
|
+
const fill = animatesFill ? void 0 : chunkT7BIRNE4_js.getComputedFillStyle(element, parentGroupFill);
|
|
1946
|
+
const fx = chunkT7BIRNE4_js.getComputedEffectStyle(element);
|
|
1947
|
+
const stroke = chunkT7BIRNE4_js.getComputedStrokeStyle(element);
|
|
1922
1948
|
const base = {
|
|
1923
1949
|
// A gradient fill REPLACES the solid fill, it does not sit on top of it;
|
|
1924
1950
|
// the whole precedence lives in shared's `getComputedFillStyle`.
|
|
@@ -1953,7 +1979,7 @@ function getShapeVisualStyle(element, _hasFill, fillColor, _strokeWidth, _stroke
|
|
|
1953
1979
|
strokeLinecap: stroke.strokeLinecap
|
|
1954
1980
|
};
|
|
1955
1981
|
apply3dEffects2(base, ss?.scene3d, ss?.shape3d, ss?.fillColor ?? fillColor);
|
|
1956
|
-
if (rendersCustomVectorPath(element) ||
|
|
1982
|
+
if (rendersCustomVectorPath(element) || chunkT7BIRNE4_js.isStrokeOnlyPresetElement(element)) {
|
|
1957
1983
|
base.backgroundColor = "transparent";
|
|
1958
1984
|
base.backgroundImage = void 0;
|
|
1959
1985
|
base.borderWidth = void 0;
|
|
@@ -1964,7 +1990,7 @@ function getShapeVisualStyle(element, _hasFill, fillColor, _strokeWidth, _stroke
|
|
|
1964
1990
|
base.backgroundColor = void 0;
|
|
1965
1991
|
base.backgroundImage = void 0;
|
|
1966
1992
|
}
|
|
1967
|
-
const geometry =
|
|
1993
|
+
const geometry = chunkT7BIRNE4_js.resolveShapeGeometry(element);
|
|
1968
1994
|
switch (geometry.kind) {
|
|
1969
1995
|
case "bare":
|
|
1970
1996
|
return { backgroundColor: "transparent", borderWidth: 0, borderStyle: "none" };
|
|
@@ -1990,13 +2016,13 @@ function getShapeVisualStyle(element, _hasFill, fillColor, _strokeWidth, _stroke
|
|
|
1990
2016
|
function getConnectorAdjustment(element, key, fallback) {
|
|
1991
2017
|
const direct = element.shapeAdjustments?.[key];
|
|
1992
2018
|
if (typeof direct === "number" && Number.isFinite(direct)) {
|
|
1993
|
-
return
|
|
2019
|
+
return chunkT7BIRNE4_js.clampUnitInterval(direct / 1e5);
|
|
1994
2020
|
}
|
|
1995
2021
|
const fallbackKey = element.shapeAdjustments?.adj;
|
|
1996
2022
|
if (typeof fallbackKey === "number" && Number.isFinite(fallbackKey)) {
|
|
1997
|
-
return
|
|
2023
|
+
return chunkT7BIRNE4_js.clampUnitInterval(fallbackKey / 1e5);
|
|
1998
2024
|
}
|
|
1999
|
-
return
|
|
2025
|
+
return chunkT7BIRNE4_js.clampUnitInterval(fallback);
|
|
2000
2026
|
}
|
|
2001
2027
|
function getConnectorPathGeometry(element) {
|
|
2002
2028
|
const width = Math.max(element.width, 0);
|
|
@@ -2129,7 +2155,7 @@ function toHexByte(value) {
|
|
|
2129
2155
|
return clamped.toString(16).padStart(2, "0");
|
|
2130
2156
|
}
|
|
2131
2157
|
function shiftHex(hex, factor, towardsWhite) {
|
|
2132
|
-
const channels =
|
|
2158
|
+
const channels = chunkT7BIRNE4_js.hexToRgbChannels(hex);
|
|
2133
2159
|
if (!channels) {
|
|
2134
2160
|
return hex;
|
|
2135
2161
|
}
|
|
@@ -2155,7 +2181,7 @@ function buildCustomSubpathPaints(subpaths, hasFill, fillColor, fillOpacity) {
|
|
|
2155
2181
|
const fillOff = subpath.fillMode === "none" || !hasFill;
|
|
2156
2182
|
return {
|
|
2157
2183
|
d: subpath.d,
|
|
2158
|
-
fill: fillOff ? "none" :
|
|
2184
|
+
fill: fillOff ? "none" : chunkT7BIRNE4_js.colorWithOpacity(adjustFillForMode(fillColor, subpath.fillMode), fillOpacity),
|
|
2159
2185
|
stroked: subpath.stroke !== false
|
|
2160
2186
|
};
|
|
2161
2187
|
});
|
|
@@ -2171,11 +2197,11 @@ function strokeContext(shapeStyle, strokePaint, strokeWidth, dashArray) {
|
|
|
2171
2197
|
strokePaint,
|
|
2172
2198
|
strokeWidth,
|
|
2173
2199
|
dashArray,
|
|
2174
|
-
lineCap:
|
|
2200
|
+
lineCap: chunkT7BIRNE4_js.svgLineCap(shapeStyle?.lineCap),
|
|
2175
2201
|
lineJoin,
|
|
2176
2202
|
miterLimit,
|
|
2177
|
-
offsets:
|
|
2178
|
-
widths:
|
|
2203
|
+
offsets: chunkT7BIRNE4_js.getCompoundLineOffsets(shapeStyle?.compoundLine, strokeWidth),
|
|
2204
|
+
widths: chunkT7BIRNE4_js.getCompoundLineWidths(shapeStyle?.compoundLine, strokeWidth)
|
|
2179
2205
|
};
|
|
2180
2206
|
}
|
|
2181
2207
|
function strokeStrands(d, keyBase, ctx) {
|
|
@@ -2223,9 +2249,9 @@ function gradientDefs(gradient) {
|
|
|
2223
2249
|
}
|
|
2224
2250
|
function renderCustomGeometryVector(pathData, pathWidth, pathHeight, structuredPaths, shapeStyle, hasFill, fillColor, fillOpacity, strokePaint, strokeWidth, dashArray, animatesFill = false, gradient) {
|
|
2225
2251
|
const ctx = strokeContext(shapeStyle, strokePaint, strokeWidth, dashArray);
|
|
2226
|
-
const subpaths = structuredPaths && structuredPaths.length > 0 ?
|
|
2252
|
+
const subpaths = structuredPaths && structuredPaths.length > 0 ? chunkT7BIRNE4_js.customGeometryPathsToSvgSubpaths(structuredPaths, pathWidth, pathHeight) : void 0;
|
|
2227
2253
|
const needsPerSubpath = subpaths !== void 0 && subpaths.some((sp) => sp.fillMode && sp.fillMode !== "norm" || sp.stroke === false);
|
|
2228
|
-
const gradientPaint = gradient ?
|
|
2254
|
+
const gradientPaint = gradient ? chunkT7BIRNE4_js.svgGradientFillRef(gradient) : void 0;
|
|
2229
2255
|
const nodes = [];
|
|
2230
2256
|
if (subpaths && needsPerSubpath) {
|
|
2231
2257
|
const paints = buildCustomSubpathPaints(subpaths, hasFill, fillColor, fillOpacity);
|
|
@@ -2257,7 +2283,7 @@ function renderCustomGeometryVector(pathData, pathWidth, pathHeight, structuredP
|
|
|
2257
2283
|
"path",
|
|
2258
2284
|
{
|
|
2259
2285
|
d: pathData,
|
|
2260
|
-
fill: animatesFill ? "inherit" : gradientPaint ??
|
|
2286
|
+
fill: animatesFill ? "inherit" : gradientPaint ?? chunkT7BIRNE4_js.colorWithOpacity(fillColor, fillOpacity),
|
|
2261
2287
|
stroke: "none",
|
|
2262
2288
|
vectorEffect: "non-scaling-stroke"
|
|
2263
2289
|
},
|
|
@@ -2283,14 +2309,14 @@ function renderCustomGeometryVector(pathData, pathWidth, pathHeight, structuredP
|
|
|
2283
2309
|
);
|
|
2284
2310
|
}
|
|
2285
2311
|
function renderVectorShape(element, hasFill, fillColor, strokeWidth, strokeColor, animatesFill, animatesStroke) {
|
|
2286
|
-
if (!
|
|
2312
|
+
if (!chunkT7BIRNE4_js.hasShapeProperties(element)) {
|
|
2287
2313
|
return null;
|
|
2288
2314
|
}
|
|
2289
2315
|
const normalizedType = (element.shapeType || "").toLowerCase();
|
|
2290
|
-
const fillPaint = animatesFill ? "inherit" :
|
|
2291
|
-
const strokePaint = animatesStroke ? "inherit" :
|
|
2292
|
-
const dashType =
|
|
2293
|
-
const dashArray =
|
|
2316
|
+
const fillPaint = animatesFill ? "inherit" : chunkT7BIRNE4_js.colorWithOpacity(fillColor, element.shapeStyle?.fillOpacity);
|
|
2317
|
+
const strokePaint = animatesStroke ? "inherit" : chunkT7BIRNE4_js.colorWithOpacity(strokeColor, element.shapeStyle?.strokeOpacity);
|
|
2318
|
+
const dashType = chunkT7BIRNE4_js.normalizeStrokeDashType(element.shapeStyle?.strokeDash);
|
|
2319
|
+
const dashArray = chunkT7BIRNE4_js.getSvgStrokeDasharray(
|
|
2294
2320
|
dashType,
|
|
2295
2321
|
Math.max(strokeWidth, 1),
|
|
2296
2322
|
element.shapeStyle?.customDashSegments
|
|
@@ -2371,21 +2397,21 @@ function renderVectorShape(element, hasFill, fillColor, strokeWidth, strokeColor
|
|
|
2371
2397
|
// container's `background-image` is suppressed for custom geometry, so
|
|
2372
2398
|
// without this the shape fell back to the parser's representative solid
|
|
2373
2399
|
// and lost every fade (issue #132).
|
|
2374
|
-
|
|
2400
|
+
chunkT7BIRNE4_js.buildSvgGradientDef(element.shapeStyle, element.id)
|
|
2375
2401
|
);
|
|
2376
2402
|
}
|
|
2377
|
-
if (
|
|
2403
|
+
if (chunkT7BIRNE4_js.isCalloutShape(normalizedType)) {
|
|
2378
2404
|
const width = Math.max(element.width, 1);
|
|
2379
2405
|
const height = Math.max(element.height, 1);
|
|
2380
|
-
const geometry =
|
|
2406
|
+
const geometry = chunkT7BIRNE4_js.getCalloutLeaderLineGeometry(
|
|
2381
2407
|
normalizedType,
|
|
2382
2408
|
width,
|
|
2383
2409
|
height,
|
|
2384
2410
|
element.shapeAdjustments
|
|
2385
2411
|
);
|
|
2386
2412
|
if (geometry && geometry.points.length >= 2) {
|
|
2387
|
-
const leaderPath =
|
|
2388
|
-
const bounds =
|
|
2413
|
+
const leaderPath = chunkT7BIRNE4_js.buildCalloutLeaderLineSvgPath(geometry);
|
|
2414
|
+
const bounds = chunkT7BIRNE4_js.getCalloutViewBoxBounds(width, height, geometry);
|
|
2389
2415
|
const lineStroke = Math.max(strokeWidth, 1);
|
|
2390
2416
|
const offsetLeft = bounds.minX;
|
|
2391
2417
|
const offsetTop = bounds.minY;
|
|
@@ -2448,10 +2474,10 @@ function renderVectorShape(element, hasFill, fillColor, strokeWidth, strokeColor
|
|
|
2448
2474
|
const endArrowW = element.shapeStyle?.connectorEndArrowWidth;
|
|
2449
2475
|
const endArrowL = element.shapeStyle?.connectorEndArrowLength;
|
|
2450
2476
|
const compoundLine = element.shapeStyle?.compoundLine;
|
|
2451
|
-
const connectorLineCap =
|
|
2477
|
+
const connectorLineCap = chunkT7BIRNE4_js.svgLineCap(element.shapeStyle?.lineCap);
|
|
2452
2478
|
const hitTargetWidth = Math.max(strokeWidth * 3, 12);
|
|
2453
|
-
const offsets =
|
|
2454
|
-
const widths =
|
|
2479
|
+
const offsets = chunkT7BIRNE4_js.getCompoundLineOffsets(compoundLine, strokeWidth);
|
|
2480
|
+
const widths = chunkT7BIRNE4_js.getCompoundLineWidths(compoundLine, strokeWidth);
|
|
2455
2481
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2456
2482
|
"svg",
|
|
2457
2483
|
{
|
|
@@ -2518,15 +2544,15 @@ function parseGradientFillCss(gradFill) {
|
|
|
2518
2544
|
}
|
|
2519
2545
|
const parsed = stops.map((gs) => {
|
|
2520
2546
|
const pos = Number.parseInt(String(gs["@_pos"] || "0"), 10) / 1e3;
|
|
2521
|
-
const color =
|
|
2522
|
-
const opacity =
|
|
2523
|
-
return { pos, color:
|
|
2547
|
+
const color = chunkT7BIRNE4_js.parseDrawingColor(gs) ?? "#888888";
|
|
2548
|
+
const opacity = chunkT7BIRNE4_js.parseDrawingColorOpacity(gs);
|
|
2549
|
+
return { pos, color: chunkT7BIRNE4_js.colorWithOpacity(color, opacity) };
|
|
2524
2550
|
}).sort((a, b) => a.pos - b.pos);
|
|
2525
2551
|
const stopStrings = parsed.map((s) => `${s.color} ${s.pos.toFixed(1)}%`).join(", ");
|
|
2526
2552
|
const lin = gradFill["a:lin"];
|
|
2527
2553
|
if (lin) {
|
|
2528
2554
|
const angRaw = Number.parseInt(String(lin["@_ang"] || "0"), 10);
|
|
2529
|
-
const angleDeg = Math.round(
|
|
2555
|
+
const angleDeg = Math.round(chunkT7BIRNE4_js.ooxmlGradientAngleToCssDegrees(angRaw / 6e4));
|
|
2530
2556
|
return `linear-gradient(${angleDeg}deg, ${stopStrings})`;
|
|
2531
2557
|
}
|
|
2532
2558
|
const path = gradFill["a:path"];
|
|
@@ -2561,8 +2587,8 @@ function parsePatternFillCss(pattFill) {
|
|
|
2561
2587
|
if (!pattFill) {
|
|
2562
2588
|
return void 0;
|
|
2563
2589
|
}
|
|
2564
|
-
const fgColor =
|
|
2565
|
-
const bgColor =
|
|
2590
|
+
const fgColor = chunkT7BIRNE4_js.parseDrawingColor(pattFill["a:fgClr"]) ?? "#000000";
|
|
2591
|
+
const bgColor = chunkT7BIRNE4_js.parseDrawingColor(pattFill["a:bgClr"]) ?? "#ffffff";
|
|
2566
2592
|
const preset = String(pattFill["@_prst"] || "ltDnDiag");
|
|
2567
2593
|
switch (preset) {
|
|
2568
2594
|
case "ltHorz":
|
|
@@ -2673,11 +2699,11 @@ function parseCellBorders(cellProperties) {
|
|
|
2673
2699
|
const prstDash = ln["a:prstDash"];
|
|
2674
2700
|
const dashVal = prstDash ? String(prstDash["@_val"] || "") : void 0;
|
|
2675
2701
|
const cssBorderStyle = ooxmlDashToCss(dashVal);
|
|
2676
|
-
const color =
|
|
2702
|
+
const color = chunkT7BIRNE4_js.parseDrawingColor(ln["a:solidFill"]);
|
|
2677
2703
|
if (color) {
|
|
2678
|
-
const opacity =
|
|
2704
|
+
const opacity = chunkT7BIRNE4_js.parseDrawingColorOpacity(ln["a:solidFill"]);
|
|
2679
2705
|
const key = `${edge.prefix}`;
|
|
2680
|
-
borderStyle[key] = `${widthPx}px ${cssBorderStyle} ${
|
|
2706
|
+
borderStyle[key] = `${widthPx}px ${cssBorderStyle} ${chunkT7BIRNE4_js.colorWithOpacity(color, opacity)}`;
|
|
2681
2707
|
}
|
|
2682
2708
|
}
|
|
2683
2709
|
return borderStyle;
|
|
@@ -2690,7 +2716,7 @@ function parseCellTextEffects(runProps) {
|
|
|
2690
2716
|
const textShadowParts = [];
|
|
2691
2717
|
const outerShdw = effectLst["a:outerShdw"];
|
|
2692
2718
|
if (outerShdw) {
|
|
2693
|
-
const shdwColor =
|
|
2719
|
+
const shdwColor = chunkT7BIRNE4_js.parseDrawingColor(outerShdw);
|
|
2694
2720
|
if (shdwColor) {
|
|
2695
2721
|
const blurRad = Number.parseInt(String(outerShdw["@_blurRad"] || "0"), 10);
|
|
2696
2722
|
const blurPx = blurRad > 0 ? Math.round(blurRad / 12700) : 0;
|
|
@@ -2708,7 +2734,7 @@ function parseCellTextEffects(runProps) {
|
|
|
2708
2734
|
}
|
|
2709
2735
|
const glow = effectLst["a:glow"];
|
|
2710
2736
|
if (glow) {
|
|
2711
|
-
const glowColor =
|
|
2737
|
+
const glowColor = chunkT7BIRNE4_js.parseDrawingColor(glow);
|
|
2712
2738
|
if (glowColor) {
|
|
2713
2739
|
const glowRad = Number.parseInt(String(glow["@_rad"] || "0"), 10);
|
|
2714
2740
|
const glowPx = glowRad > 0 ? Math.round(glowRad / 12700) : 2;
|
|
@@ -2787,10 +2813,10 @@ function extractTableCellStyle(cellXml, fallbackStyle, schemeColorOverrides) {
|
|
|
2787
2813
|
if (runProps?.["@_u"] !== void 0) {
|
|
2788
2814
|
cellStyle.textDecorationLine = runProps["@_u"] === "sng" ? "underline" : "none";
|
|
2789
2815
|
}
|
|
2790
|
-
const runColor =
|
|
2816
|
+
const runColor = chunkT7BIRNE4_js.parseDrawingColor(runProps?.["a:solidFill"], schemeColorOverrides) || chunkT7BIRNE4_js.parseDrawingColor(runProps?.["a:highlight"], schemeColorOverrides);
|
|
2791
2817
|
if (runColor) {
|
|
2792
|
-
const opacity =
|
|
2793
|
-
cellStyle.color =
|
|
2818
|
+
const opacity = chunkT7BIRNE4_js.parseDrawingColorOpacity(runProps?.["a:solidFill"]);
|
|
2819
|
+
cellStyle.color = chunkT7BIRNE4_js.colorWithOpacity(runColor, opacity);
|
|
2794
2820
|
}
|
|
2795
2821
|
const fontFamily = runProps?.["a:latin"]?.["@_typeface"] || runProps?.["a:ea"]?.["@_typeface"] || runProps?.["a:cs"]?.["@_typeface"];
|
|
2796
2822
|
if (fontFamily) {
|
|
@@ -2800,15 +2826,15 @@ function extractTableCellStyle(cellXml, fallbackStyle, schemeColorOverrides) {
|
|
|
2800
2826
|
cellStyle.textAlign = parseParagraphAlignment(paragraphProperties["@_algn"]);
|
|
2801
2827
|
}
|
|
2802
2828
|
const cellProperties = cellXml["a:tcPr"];
|
|
2803
|
-
const cellFill =
|
|
2829
|
+
const cellFill = chunkT7BIRNE4_js.parseDrawingColor(
|
|
2804
2830
|
cellProperties?.["a:solidFill"],
|
|
2805
2831
|
schemeColorOverrides
|
|
2806
2832
|
);
|
|
2807
2833
|
if (cellFill) {
|
|
2808
|
-
const opacity =
|
|
2834
|
+
const opacity = chunkT7BIRNE4_js.parseDrawingColorOpacity(
|
|
2809
2835
|
cellProperties?.["a:solidFill"]
|
|
2810
2836
|
);
|
|
2811
|
-
cellStyle.backgroundColor =
|
|
2837
|
+
cellStyle.backgroundColor = chunkT7BIRNE4_js.colorWithOpacity(cellFill, opacity);
|
|
2812
2838
|
} else {
|
|
2813
2839
|
const gradCss = parseGradientFillCss(cellProperties?.["a:gradFill"]);
|
|
2814
2840
|
if (gradCss) {
|
|
@@ -2823,16 +2849,16 @@ function extractTableCellStyle(cellXml, fallbackStyle, schemeColorOverrides) {
|
|
|
2823
2849
|
const edgeBorders = parseCellBorders(cellProperties);
|
|
2824
2850
|
Object.assign(cellStyle, edgeBorders);
|
|
2825
2851
|
if (!cellStyle.borderLeftColor && !cellStyle.borderRightColor && !cellStyle.borderTopColor && !cellStyle.borderBottomColor) {
|
|
2826
|
-
const borderColor =
|
|
2852
|
+
const borderColor = chunkT7BIRNE4_js.parseDrawingColor(
|
|
2827
2853
|
cellProperties?.["a:lnL"]?.["a:solidFill"],
|
|
2828
2854
|
schemeColorOverrides
|
|
2829
|
-
) ||
|
|
2855
|
+
) || chunkT7BIRNE4_js.parseDrawingColor(
|
|
2830
2856
|
cellProperties?.["a:lnR"]?.["a:solidFill"],
|
|
2831
2857
|
schemeColorOverrides
|
|
2832
|
-
) ||
|
|
2858
|
+
) || chunkT7BIRNE4_js.parseDrawingColor(
|
|
2833
2859
|
cellProperties?.["a:lnT"]?.["a:solidFill"],
|
|
2834
2860
|
schemeColorOverrides
|
|
2835
|
-
) ||
|
|
2861
|
+
) || chunkT7BIRNE4_js.parseDrawingColor(
|
|
2836
2862
|
cellProperties?.["a:lnB"]?.["a:solidFill"],
|
|
2837
2863
|
schemeColorOverrides
|
|
2838
2864
|
);
|
|
@@ -2904,7 +2930,7 @@ function getTableCellBandStyle2(element, rowIndex, cellIndex, rowCount, columnCo
|
|
|
2904
2930
|
if (element.type !== "table") {
|
|
2905
2931
|
return void 0;
|
|
2906
2932
|
}
|
|
2907
|
-
return
|
|
2933
|
+
return chunkT7BIRNE4_js.getTableCellBandStyle(element.tableData, rowIndex, cellIndex, rowCount, columnCount, {
|
|
2908
2934
|
tableStyleMap: styleCtx?.tableStyleMap,
|
|
2909
2935
|
colorScheme: styleCtx?.theme?.colorScheme,
|
|
2910
2936
|
fontScheme: styleCtx?.theme?.fontScheme
|
|
@@ -2980,7 +3006,7 @@ function renderTableCellContent(cell, fallbackText) {
|
|
|
2980
3006
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2981
3007
|
"span",
|
|
2982
3008
|
{
|
|
2983
|
-
style: { position: "relative", ...
|
|
3009
|
+
style: { position: "relative", ...chunkT7BIRNE4_js.cellRunStyle(run) },
|
|
2984
3010
|
children: run.text
|
|
2985
3011
|
},
|
|
2986
3012
|
`r-${index}`
|
|
@@ -2988,7 +3014,7 @@ function renderTableCellContent(cell, fallbackText) {
|
|
|
2988
3014
|
});
|
|
2989
3015
|
}
|
|
2990
3016
|
function getCellDiagonalBorders2(style, tableData, pos, styleCtx) {
|
|
2991
|
-
return
|
|
3017
|
+
return chunkT7BIRNE4_js.getCellDiagonalBorders(style, tableData, pos, {
|
|
2992
3018
|
tableStyleMap: styleCtx?.tableStyleMap,
|
|
2993
3019
|
colorScheme: styleCtx?.theme?.colorScheme,
|
|
2994
3020
|
fontScheme: styleCtx?.theme?.fontScheme
|
|
@@ -3121,7 +3147,7 @@ function TableResizeOverlay({
|
|
|
3121
3147
|
const containerRef = React6.useRef(null);
|
|
3122
3148
|
const [rowBounds, setRowBounds] = React6.useState([]);
|
|
3123
3149
|
const dragRef = React6.useRef(null);
|
|
3124
|
-
const colBoundaries = React6.useMemo(() =>
|
|
3150
|
+
const colBoundaries = React6.useMemo(() => chunkT7BIRNE4_js.computeColumnBoundaries(columnWidths), [columnWidths]);
|
|
3125
3151
|
const measureRows = React6.useCallback(() => {
|
|
3126
3152
|
const container = containerRef.current;
|
|
3127
3153
|
if (!container) {
|
|
@@ -3168,11 +3194,11 @@ function TableResizeOverlay({
|
|
|
3168
3194
|
const rect = containerRef.current.getBoundingClientRect();
|
|
3169
3195
|
if (drag.type === "col" && drag.initialWidths && onResizeColumns) {
|
|
3170
3196
|
const deltaProp = (e.clientX - drag.startPos) / rect.width;
|
|
3171
|
-
onResizeColumns(
|
|
3197
|
+
onResizeColumns(chunkT7BIRNE4_js.computeResizedColumnWidths(drag.initialWidths, drag.index, deltaProp));
|
|
3172
3198
|
} else if (drag.type === "row" && onResizeRow) {
|
|
3173
3199
|
const deltaY = e.clientY - drag.startPos;
|
|
3174
|
-
const newHeight =
|
|
3175
|
-
drag.initialRowHeight ??
|
|
3200
|
+
const newHeight = chunkT7BIRNE4_js.computeResizedRowHeight(
|
|
3201
|
+
drag.initialRowHeight ?? chunkT7BIRNE4_js.DEFAULT_ROW_HEIGHT,
|
|
3176
3202
|
deltaY
|
|
3177
3203
|
);
|
|
3178
3204
|
onResizeRow(drag.index, newHeight);
|
|
@@ -3210,7 +3236,7 @@ function TableResizeOverlay({
|
|
|
3210
3236
|
e.stopPropagation();
|
|
3211
3237
|
const table = containerRef.current?.querySelector("table");
|
|
3212
3238
|
const tr = table?.querySelectorAll("tbody > tr")[index];
|
|
3213
|
-
const actualHeight = tr?.offsetHeight ??
|
|
3239
|
+
const actualHeight = tr?.offsetHeight ?? chunkT7BIRNE4_js.DEFAULT_ROW_HEIGHT;
|
|
3214
3240
|
document.body.style.cursor = "row-resize";
|
|
3215
3241
|
document.body.style.userSelect = "none";
|
|
3216
3242
|
dragRef.current = {
|
|
@@ -3257,7 +3283,7 @@ function renderTableFromTableData(element, textStyle, options) {
|
|
|
3257
3283
|
colorScheme: options?.styleCtx?.theme?.colorScheme,
|
|
3258
3284
|
fontScheme: options?.styleCtx?.theme?.fontScheme
|
|
3259
3285
|
};
|
|
3260
|
-
const cellCss = (cell, rowIndex, cellIndex) =>
|
|
3286
|
+
const cellCss = (cell, rowIndex, cellIndex) => chunkT7BIRNE4_js.tableCellCss(
|
|
3261
3287
|
tableData,
|
|
3262
3288
|
cell,
|
|
3263
3289
|
{ rowIndex, cellIndex, rowCount, columnCount },
|
|
@@ -3270,7 +3296,7 @@ function renderTableFromTableData(element, textStyle, options) {
|
|
|
3270
3296
|
}
|
|
3271
3297
|
const first = selectedCell.selectedCells[0];
|
|
3272
3298
|
const last = selectedCell.selectedCells[selectedCell.selectedCells.length - 1];
|
|
3273
|
-
return
|
|
3299
|
+
return chunkT7BIRNE4_js.computeSelectionRect(first.row, first.col, last.row, last.col, tableData);
|
|
3274
3300
|
})();
|
|
3275
3301
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3276
3302
|
TableResizeOverlay,
|
|
@@ -3291,9 +3317,9 @@ function renderTableFromTableData(element, textStyle, options) {
|
|
|
3291
3317
|
{
|
|
3292
3318
|
className: "w-full h-full border-collapse table-fixed",
|
|
3293
3319
|
style: {
|
|
3294
|
-
fontFamily:
|
|
3320
|
+
fontFamily: chunkT7BIRNE4_js.DEFAULT_FONT_FAMILY,
|
|
3295
3321
|
// `a:tblPr@rtl` mirrors the column order for RTL decks.
|
|
3296
|
-
...
|
|
3322
|
+
...chunkT7BIRNE4_js.tableContainerCss(tableData)
|
|
3297
3323
|
},
|
|
3298
3324
|
children: [
|
|
3299
3325
|
tableData.columnWidths.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("colgroup", { children: tableData.columnWidths.map((w, ci) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3312,7 +3338,7 @@ function renderTableFromTableData(element, textStyle, options) {
|
|
|
3312
3338
|
return null;
|
|
3313
3339
|
}
|
|
3314
3340
|
const isCellSelected = selectedCell?.rowIndex === rowIndex && selectedCell?.columnIndex === cellIndex;
|
|
3315
|
-
const isInMultiSelection =
|
|
3341
|
+
const isInMultiSelection = chunkT7BIRNE4_js.isCellInRect(rowIndex, cellIndex, selectionRect);
|
|
3316
3342
|
const isCellEditing = isCellSelected && selectedCell?.isEditing;
|
|
3317
3343
|
const diag = getCellDiagonalBorders2(
|
|
3318
3344
|
cell.style,
|
|
@@ -3341,7 +3367,7 @@ function renderTableFromTableData(element, textStyle, options) {
|
|
|
3341
3367
|
}
|
|
3342
3368
|
event.stopPropagation();
|
|
3343
3369
|
if (event.shiftKey && selectedCell) {
|
|
3344
|
-
const rect =
|
|
3370
|
+
const rect = chunkT7BIRNE4_js.computeSelectionRect(
|
|
3345
3371
|
selectedCell.rowIndex,
|
|
3346
3372
|
selectedCell.columnIndex,
|
|
3347
3373
|
rowIndex,
|
|
@@ -3351,7 +3377,7 @@ function renderTableFromTableData(element, textStyle, options) {
|
|
|
3351
3377
|
options?.onSelectCell?.({
|
|
3352
3378
|
rowIndex: selectedCell.rowIndex,
|
|
3353
3379
|
columnIndex: selectedCell.columnIndex,
|
|
3354
|
-
selectedCells:
|
|
3380
|
+
selectedCells: chunkT7BIRNE4_js.rectToCells(rect)
|
|
3355
3381
|
});
|
|
3356
3382
|
} else {
|
|
3357
3383
|
options?.onSelectCell?.({
|
|
@@ -3412,7 +3438,7 @@ function renderTableElement(element, textStyle, options) {
|
|
|
3412
3438
|
if (tableEl2.tableData && tableEl2.tableData.rows.length > 0) {
|
|
3413
3439
|
return renderTableFromTableData(tableEl2, textStyle, options);
|
|
3414
3440
|
}
|
|
3415
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center text-[11px] text-white/80 pointer-events-none", children:
|
|
3441
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center text-[11px] text-white/80 pointer-events-none", children: chunkMVKRI3CZ_js.translationsEn["pptx.table.title"] });
|
|
3416
3442
|
}
|
|
3417
3443
|
const selectedCell = options?.selectedCell || null;
|
|
3418
3444
|
const isEditable = Boolean(options?.editable);
|
|
@@ -3427,7 +3453,7 @@ function renderTableElement(element, textStyle, options) {
|
|
|
3427
3453
|
}
|
|
3428
3454
|
const first = selectedCell.selectedCells[0];
|
|
3429
3455
|
const last = selectedCell.selectedCells[selectedCell.selectedCells.length - 1];
|
|
3430
|
-
return
|
|
3456
|
+
return chunkT7BIRNE4_js.computeSelectionRect(first.row, first.col, last.row, last.col, tableEl.tableData);
|
|
3431
3457
|
})();
|
|
3432
3458
|
const schemeOverrides = options?.styleCtx?.theme?.colorScheme ? options.styleCtx.theme.colorScheme : void 0;
|
|
3433
3459
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3449,9 +3475,9 @@ function renderTableElement(element, textStyle, options) {
|
|
|
3449
3475
|
{
|
|
3450
3476
|
className: "w-full h-full border-collapse table-fixed",
|
|
3451
3477
|
style: {
|
|
3452
|
-
fontFamily:
|
|
3478
|
+
fontFamily: chunkT7BIRNE4_js.DEFAULT_FONT_FAMILY,
|
|
3453
3479
|
// `a:tblPr@rtl` mirrors the column order for RTL decks.
|
|
3454
|
-
...
|
|
3480
|
+
...chunkT7BIRNE4_js.tableContainerCss(tableEl.tableData)
|
|
3455
3481
|
},
|
|
3456
3482
|
children: [
|
|
3457
3483
|
parsedTable.columnPercentages.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("colgroup", { children: parsedTable.columnPercentages.map((percentage, columnIndex) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3503,7 +3529,7 @@ function renderTableElement(element, textStyle, options) {
|
|
|
3503
3529
|
const mergedStyle = {
|
|
3504
3530
|
...bandStyle,
|
|
3505
3531
|
...xmlCellStyle,
|
|
3506
|
-
...tdCellOverride ?
|
|
3532
|
+
...tdCellOverride ? chunkT7BIRNE4_js.cellStyleToCss(tdCellOverride) : void 0,
|
|
3507
3533
|
...diag ? { position: "relative" } : void 0
|
|
3508
3534
|
};
|
|
3509
3535
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -3513,7 +3539,7 @@ function renderTableElement(element, textStyle, options) {
|
|
|
3513
3539
|
"border px-1 py-0.5 align-top",
|
|
3514
3540
|
isEditable && hasCellSelectionHandler ? "border-blue-200/70 cursor-cell" : "border-white/30",
|
|
3515
3541
|
selectedCell?.rowIndex === rowIndex && selectedCell?.columnIndex === cellIndex ? "ring-1 ring-inset ring-blue-500" : null,
|
|
3516
|
-
|
|
3542
|
+
chunkT7BIRNE4_js.isCellInRect(rowIndex, cellIndex, xmlSelectionRect) && !(selectedCell?.rowIndex === rowIndex && selectedCell?.columnIndex === cellIndex) ? "bg-blue-500/15 ring-1 ring-inset ring-blue-400/50" : null
|
|
3517
3543
|
),
|
|
3518
3544
|
colSpan,
|
|
3519
3545
|
rowSpan: rSpan,
|
|
@@ -3524,7 +3550,7 @@ function renderTableElement(element, textStyle, options) {
|
|
|
3524
3550
|
}
|
|
3525
3551
|
event.stopPropagation();
|
|
3526
3552
|
if (event.shiftKey && selectedCell && tableEl.tableData) {
|
|
3527
|
-
const rect =
|
|
3553
|
+
const rect = chunkT7BIRNE4_js.computeSelectionRect(
|
|
3528
3554
|
selectedCell.rowIndex,
|
|
3529
3555
|
selectedCell.columnIndex,
|
|
3530
3556
|
rowIndex,
|
|
@@ -3534,7 +3560,7 @@ function renderTableElement(element, textStyle, options) {
|
|
|
3534
3560
|
options?.onSelectCell?.({
|
|
3535
3561
|
rowIndex: selectedCell.rowIndex,
|
|
3536
3562
|
columnIndex: selectedCell.columnIndex,
|
|
3537
|
-
selectedCells:
|
|
3563
|
+
selectedCells: chunkT7BIRNE4_js.rectToCells(rect)
|
|
3538
3564
|
});
|
|
3539
3565
|
} else {
|
|
3540
3566
|
options?.onSelectCell?.({
|
|
@@ -3594,24 +3620,24 @@ function renderTableElement(element, textStyle, options) {
|
|
|
3594
3620
|
}
|
|
3595
3621
|
var LEGEND_ITEM_WIDTH = 80;
|
|
3596
3622
|
function partAttrs(part) {
|
|
3597
|
-
return part ?
|
|
3623
|
+
return part ? chunkT7BIRNE4_js.chartPartToAttrs(part) : void 0;
|
|
3598
3624
|
}
|
|
3599
3625
|
function resolveReactPalette(chartData) {
|
|
3600
3626
|
if (chartData.colorPalette && chartData.colorPalette.length > 0) {
|
|
3601
3627
|
return chartData.colorPalette;
|
|
3602
3628
|
}
|
|
3603
|
-
return [...
|
|
3629
|
+
return [...chunkT7BIRNE4_js.getChartStylePalette(chartData.style?.styleId)];
|
|
3604
3630
|
}
|
|
3605
3631
|
function buildReactChartViewModel(element) {
|
|
3606
3632
|
if (element.type !== "chart" || !element.chartData) {
|
|
3607
|
-
return
|
|
3633
|
+
return chunkT7BIRNE4_js.buildChartViewModel(element);
|
|
3608
3634
|
}
|
|
3609
3635
|
const palette = resolveReactPalette(element.chartData);
|
|
3610
3636
|
const themedElement = {
|
|
3611
3637
|
...element,
|
|
3612
3638
|
chartData: { ...element.chartData, colorPalette: palette }
|
|
3613
3639
|
};
|
|
3614
|
-
return
|
|
3640
|
+
return chunkT7BIRNE4_js.buildChartViewModel(themedElement);
|
|
3615
3641
|
}
|
|
3616
3642
|
function renderPrimitive(prim, key) {
|
|
3617
3643
|
switch (prim.kind) {
|
|
@@ -3642,7 +3668,8 @@ function renderPrimitive(prim, key) {
|
|
|
3642
3668
|
stroke: p.stroke ?? "none",
|
|
3643
3669
|
strokeWidth: p.strokeWidth ?? 0,
|
|
3644
3670
|
fillOpacity: p.opacity ?? 1,
|
|
3645
|
-
...partAttrs(p.part)
|
|
3671
|
+
...partAttrs(p.part),
|
|
3672
|
+
children: p.title !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx("title", { children: p.title }) : null
|
|
3646
3673
|
},
|
|
3647
3674
|
key
|
|
3648
3675
|
);
|
|
@@ -3828,2277 +3855,22 @@ function renderChartViewModel(elementId, vm, preserveAspectRatio = "none") {
|
|
|
3828
3855
|
}
|
|
3829
3856
|
);
|
|
3830
3857
|
}
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
return renderChartViewModel(element.id, buildReactChartViewModel(element));
|
|
3835
|
-
}
|
|
3836
|
-
function renderLineChart(element, _chartData, _categoryLabels) {
|
|
3837
|
-
return renderChartViewModel(element.id, buildReactChartViewModel(element));
|
|
3838
|
-
}
|
|
3839
|
-
function renderBoxWhiskerChart(element, _chartData, _categoryLabels) {
|
|
3840
|
-
return renderChartViewModel(element.id, buildReactChartViewModel(element));
|
|
3841
|
-
}
|
|
3842
|
-
function renderHistogramChart(element, _chartData, _categoryLabels) {
|
|
3843
|
-
return renderChartViewModel(element.id, buildReactChartViewModel(element));
|
|
3844
|
-
}
|
|
3845
|
-
function renderDefaultBarChart(element, _chartData, _categoryLabels) {
|
|
3846
|
-
return renderChartViewModel(element.id, buildReactChartViewModel(element));
|
|
3847
|
-
}
|
|
3848
|
-
var WORLD_REGIONS = [
|
|
3849
|
-
// North America
|
|
3850
|
-
{
|
|
3851
|
-
code: "US",
|
|
3852
|
-
name: "United States",
|
|
3853
|
-
path: "M130,160 L250,155 265,170 270,190 260,210 230,215 200,220 170,215 145,205 130,195Z M280,175 L295,165 310,170 310,185 295,195 280,190Z",
|
|
3854
|
-
labelXY: [200, 190]
|
|
3855
|
-
},
|
|
3856
|
-
{
|
|
3857
|
-
code: "CA",
|
|
3858
|
-
name: "Canada",
|
|
3859
|
-
path: "M120,90 L280,85 290,100 295,130 280,150 250,155 200,155 160,155 130,155 115,140 110,115Z",
|
|
3860
|
-
labelXY: [200, 125]
|
|
3861
|
-
},
|
|
3862
|
-
{
|
|
3863
|
-
code: "MX",
|
|
3864
|
-
name: "Mexico",
|
|
3865
|
-
path: "M145,215 L200,220 210,235 200,255 185,265 165,260 150,245 140,230Z",
|
|
3866
|
-
labelXY: [175, 240]
|
|
3867
|
-
},
|
|
3868
|
-
// South America
|
|
3869
|
-
{
|
|
3870
|
-
code: "BR",
|
|
3871
|
-
name: "Brazil",
|
|
3872
|
-
path: "M270,300 L310,280 335,290 340,320 330,355 310,370 285,365 265,345 260,320Z",
|
|
3873
|
-
labelXY: [300, 330]
|
|
3874
|
-
},
|
|
3875
|
-
{
|
|
3876
|
-
code: "AR",
|
|
3877
|
-
name: "Argentina",
|
|
3878
|
-
path: "M260,370 L280,365 290,380 285,410 275,435 260,445 250,425 248,395Z",
|
|
3879
|
-
labelXY: [268, 410]
|
|
3880
|
-
},
|
|
3881
|
-
// Europe
|
|
3882
|
-
{
|
|
3883
|
-
code: "GB",
|
|
3884
|
-
name: "United Kingdom",
|
|
3885
|
-
path: "M440,120 L448,110 455,115 455,135 448,142 440,138Z",
|
|
3886
|
-
labelXY: [448, 128]
|
|
3887
|
-
},
|
|
3888
|
-
{
|
|
3889
|
-
code: "FR",
|
|
3890
|
-
name: "France",
|
|
3891
|
-
path: "M450,145 L470,140 480,150 478,168 465,175 450,170 445,158Z",
|
|
3892
|
-
labelXY: [463, 158]
|
|
3893
|
-
},
|
|
3894
|
-
{
|
|
3895
|
-
code: "DE",
|
|
3896
|
-
name: "Germany",
|
|
3897
|
-
path: "M478,125 L498,120 505,130 502,148 490,152 478,148 475,138Z",
|
|
3898
|
-
labelXY: [490, 138]
|
|
3899
|
-
},
|
|
3900
|
-
{
|
|
3901
|
-
code: "IT",
|
|
3902
|
-
name: "Italy",
|
|
3903
|
-
path: "M490,155 L498,152 505,162 500,180 492,190 488,178 486,165Z",
|
|
3904
|
-
labelXY: [495, 172]
|
|
3905
|
-
},
|
|
3906
|
-
{
|
|
3907
|
-
code: "ES",
|
|
3908
|
-
name: "Spain",
|
|
3909
|
-
path: "M432,168 L460,165 465,175 460,188 442,192 430,185 428,175Z",
|
|
3910
|
-
labelXY: [448, 180]
|
|
3911
|
-
},
|
|
3912
|
-
// Russia spans Europe/Asia
|
|
3913
|
-
{
|
|
3914
|
-
code: "RU",
|
|
3915
|
-
name: "Russia",
|
|
3916
|
-
path: "M510,60 L780,50 830,70 840,100 820,120 750,115 700,105 650,100 580,105 530,110 510,100 505,80Z",
|
|
3917
|
-
labelXY: [670, 85]
|
|
3918
|
-
},
|
|
3919
|
-
{
|
|
3920
|
-
code: "TR",
|
|
3921
|
-
name: "Turkey",
|
|
3922
|
-
path: "M530,165 L570,160 585,170 580,182 555,185 530,180Z",
|
|
3923
|
-
labelXY: [558, 175]
|
|
3924
|
-
},
|
|
3925
|
-
// Africa
|
|
3926
|
-
{
|
|
3927
|
-
code: "EG",
|
|
3928
|
-
name: "Egypt",
|
|
3929
|
-
path: "M530,200 L555,195 565,205 560,225 545,230 530,222Z",
|
|
3930
|
-
labelXY: [548, 215]
|
|
3931
|
-
},
|
|
3932
|
-
{
|
|
3933
|
-
code: "NG",
|
|
3934
|
-
name: "Nigeria",
|
|
3935
|
-
path: "M475,275 L500,270 510,280 505,298 490,302 475,295Z",
|
|
3936
|
-
labelXY: [492, 288]
|
|
3937
|
-
},
|
|
3938
|
-
{
|
|
3939
|
-
code: "ZA",
|
|
3940
|
-
name: "South Africa",
|
|
3941
|
-
path: "M520,380 L545,370 560,380 555,400 540,410 520,405 515,392Z",
|
|
3942
|
-
labelXY: [538, 392]
|
|
3943
|
-
},
|
|
3944
|
-
// Middle East
|
|
3945
|
-
{
|
|
3946
|
-
code: "SA",
|
|
3947
|
-
name: "Saudi Arabia",
|
|
3948
|
-
path: "M565,220 L600,210 615,225 610,250 590,258 570,250 560,238Z",
|
|
3949
|
-
labelXY: [590, 238]
|
|
3950
|
-
},
|
|
3951
|
-
// Asia
|
|
3952
|
-
{
|
|
3953
|
-
code: "IN",
|
|
3954
|
-
name: "India",
|
|
3955
|
-
path: "M640,210 L665,195 685,210 688,240 678,268 660,278 645,265 635,240Z",
|
|
3956
|
-
labelXY: [662, 240]
|
|
3957
|
-
},
|
|
3958
|
-
{
|
|
3959
|
-
code: "CN",
|
|
3960
|
-
name: "China",
|
|
3961
|
-
path: "M700,120 L775,115 800,130 805,160 790,180 760,185 730,180 710,168 695,150 690,135Z",
|
|
3962
|
-
labelXY: [750, 155]
|
|
3963
|
-
},
|
|
3964
|
-
{
|
|
3965
|
-
code: "JP",
|
|
3966
|
-
name: "Japan",
|
|
3967
|
-
path: "M835,145 L845,135 852,140 850,158 842,165 835,160Z",
|
|
3968
|
-
labelXY: [843, 152]
|
|
3969
|
-
},
|
|
3970
|
-
{
|
|
3971
|
-
code: "KR",
|
|
3972
|
-
name: "South Korea",
|
|
3973
|
-
path: "M815,158 L825,152 830,160 827,170 818,172 813,165Z",
|
|
3974
|
-
labelXY: [822, 163]
|
|
3975
|
-
},
|
|
3976
|
-
{
|
|
3977
|
-
code: "ID",
|
|
3978
|
-
name: "Indonesia",
|
|
3979
|
-
path: "M740,295 L780,288 810,292 830,298 825,310 790,312 755,308 740,305Z",
|
|
3980
|
-
labelXY: [785, 302]
|
|
3981
|
-
},
|
|
3982
|
-
// Oceania
|
|
3983
|
-
{
|
|
3984
|
-
code: "AU",
|
|
3985
|
-
name: "Australia",
|
|
3986
|
-
path: "M790,350 L850,340 880,355 885,385 870,405 840,410 810,400 790,380Z",
|
|
3987
|
-
labelXY: [838, 378]
|
|
3988
|
-
}
|
|
3989
|
-
];
|
|
3990
|
-
function renderMapChart(element, chartData, categoryLabels) {
|
|
3991
|
-
const svgWidth = element.width;
|
|
3992
|
-
const svgHeight = element.height;
|
|
3993
|
-
const categories = categoryLabels.length > 0 ? categoryLabels : chartData.categories;
|
|
3994
|
-
const series = chartData.series;
|
|
3995
|
-
const values = series.length > 0 ? series[0].values : [];
|
|
3996
|
-
const finiteVals = values.filter((v) => Number.isFinite(v));
|
|
3997
|
-
const minVal = finiteVals.length > 0 ? Math.min(...finiteVals) : 0;
|
|
3998
|
-
const maxVal = finiteVals.length > 0 ? Math.max(...finiteVals) : 1;
|
|
3999
|
-
const regionValueMap = /* @__PURE__ */ new Map();
|
|
4000
|
-
const unmatchedRows = [];
|
|
4001
|
-
categories.forEach((cat, i) => {
|
|
4002
|
-
const value = values[i] ?? 0;
|
|
4003
|
-
const code = chunkWVDM36ZM_js.resolveRegionCode(cat);
|
|
4004
|
-
if (code) {
|
|
4005
|
-
regionValueMap.set(code, { value, label: cat });
|
|
4006
|
-
} else {
|
|
4007
|
-
unmatchedRows.push({ label: cat, value });
|
|
4008
|
-
}
|
|
4009
|
-
});
|
|
4010
|
-
const legendHeight = 30;
|
|
4011
|
-
const fallbackRowH = 14;
|
|
4012
|
-
const fallbackTableH = unmatchedRows.length > 0 ? Math.min(unmatchedRows.length + 1, 6) * fallbackRowH + 8 : 0;
|
|
4013
|
-
const titleH = chartData.title ? 22 : 0;
|
|
4014
|
-
const mapAreaH = Math.max(svgHeight - titleH - legendHeight - fallbackTableH - 8, 80);
|
|
4015
|
-
const mapScale = Math.min((svgWidth - 20) / 1e3, mapAreaH / 500);
|
|
4016
|
-
const mapOffsetX = (svgWidth - 1e3 * mapScale) / 2;
|
|
4017
|
-
const mapOffsetY = titleH + 4;
|
|
4018
|
-
const elements = [];
|
|
4019
|
-
if (chartData.title) {
|
|
4020
|
-
elements.push(
|
|
4021
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4022
|
-
"text",
|
|
4023
|
-
{
|
|
4024
|
-
x: svgWidth / 2,
|
|
4025
|
-
y: 16,
|
|
4026
|
-
textAnchor: "middle",
|
|
4027
|
-
fontSize: 12,
|
|
4028
|
-
fontWeight: 700,
|
|
4029
|
-
fill: "#334155",
|
|
4030
|
-
children: chartData.title
|
|
4031
|
-
},
|
|
4032
|
-
`${element.id}-map-title`
|
|
4033
|
-
)
|
|
4034
|
-
);
|
|
3858
|
+
function renderChartElement(element) {
|
|
3859
|
+
if (element.type !== "chart") {
|
|
3860
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center text-[11px] text-white/80 pointer-events-none", children: chunkMVKRI3CZ_js.translationsEn["pptx.chart.heading"] });
|
|
4035
3861
|
}
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
let dataLabel = null;
|
|
4040
|
-
if (entry) {
|
|
4041
|
-
const t = chunkWVDM36ZM_js.normalizeValue(entry.value, minVal, maxVal);
|
|
4042
|
-
fill = chunkWVDM36ZM_js.sequentialColorScale(t);
|
|
4043
|
-
dataLabel = /* @__PURE__ */ jsxRuntime.jsx(
|
|
4044
|
-
"text",
|
|
4045
|
-
{
|
|
4046
|
-
x: region.labelXY[0] * mapScale + mapOffsetX,
|
|
4047
|
-
y: region.labelXY[1] * mapScale + mapOffsetY + 4,
|
|
4048
|
-
textAnchor: "middle",
|
|
4049
|
-
fontSize: Math.max(6, 7 * mapScale),
|
|
4050
|
-
fontWeight: 600,
|
|
4051
|
-
fill: "#1e293b",
|
|
4052
|
-
style: { pointerEvents: "none" },
|
|
4053
|
-
children: chunkWVDM36ZM_js.formatAxisValue(entry.value)
|
|
4054
|
-
},
|
|
4055
|
-
`${element.id}-map-dl-${region.code}`
|
|
4056
|
-
);
|
|
4057
|
-
}
|
|
4058
|
-
elements.push(
|
|
4059
|
-
/* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
|
|
4060
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4061
|
-
"path",
|
|
4062
|
-
{
|
|
4063
|
-
d: region.path,
|
|
4064
|
-
fill,
|
|
4065
|
-
stroke: "#94a3b8",
|
|
4066
|
-
strokeWidth: 0.5 / mapScale,
|
|
4067
|
-
transform: `translate(${mapOffsetX},${mapOffsetY}) scale(${mapScale})`,
|
|
4068
|
-
opacity: 0.9,
|
|
4069
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("title", { children: [
|
|
4070
|
-
region.name,
|
|
4071
|
-
entry ? `: ${chunkWVDM36ZM_js.formatAxisValue(entry.value)}` : ""
|
|
4072
|
-
] })
|
|
4073
|
-
}
|
|
4074
|
-
),
|
|
4075
|
-
dataLabel
|
|
4076
|
-
] }, `${element.id}-map-g-${region.code}`)
|
|
4077
|
-
);
|
|
4078
|
-
});
|
|
4079
|
-
const legendY = mapOffsetY + mapAreaH + 4;
|
|
4080
|
-
const barW = Math.min(svgWidth * 0.4, 160);
|
|
4081
|
-
const barX = (svgWidth - barW) / 2;
|
|
4082
|
-
const gradId = `${element.id}-map-choropleth-grad`;
|
|
4083
|
-
elements.push(
|
|
4084
|
-
/* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: gradId, x1: "0", y1: "0", x2: "1", y2: "0", children: [
|
|
4085
|
-
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: "#dbeafe" }),
|
|
4086
|
-
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "50%", stopColor: "#3b82f6" }),
|
|
4087
|
-
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: "#1e3a5f" })
|
|
4088
|
-
] }) }, `${element.id}-map-defs`),
|
|
4089
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4090
|
-
"rect",
|
|
4091
|
-
{
|
|
4092
|
-
x: barX,
|
|
4093
|
-
y: legendY,
|
|
4094
|
-
width: barW,
|
|
4095
|
-
height: 8,
|
|
4096
|
-
rx: 4,
|
|
4097
|
-
fill: `url(#${gradId})`
|
|
4098
|
-
},
|
|
4099
|
-
`${element.id}-map-legend-bar`
|
|
4100
|
-
),
|
|
4101
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4102
|
-
"text",
|
|
4103
|
-
{
|
|
4104
|
-
x: barX,
|
|
4105
|
-
y: legendY + 18,
|
|
4106
|
-
fontSize: 7,
|
|
4107
|
-
fill: "#64748b",
|
|
4108
|
-
textAnchor: "middle",
|
|
4109
|
-
children: chunkWVDM36ZM_js.formatAxisValue(minVal)
|
|
4110
|
-
},
|
|
4111
|
-
`${element.id}-map-legend-min`
|
|
4112
|
-
),
|
|
4113
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4114
|
-
"text",
|
|
4115
|
-
{
|
|
4116
|
-
x: barX + barW,
|
|
4117
|
-
y: legendY + 18,
|
|
4118
|
-
fontSize: 7,
|
|
4119
|
-
fill: "#64748b",
|
|
4120
|
-
textAnchor: "middle",
|
|
4121
|
-
children: chunkWVDM36ZM_js.formatAxisValue(maxVal)
|
|
4122
|
-
},
|
|
4123
|
-
`${element.id}-map-legend-max`
|
|
4124
|
-
)
|
|
4125
|
-
);
|
|
4126
|
-
if (unmatchedRows.length > 0) {
|
|
4127
|
-
const tableY = legendY + 26;
|
|
4128
|
-
const fontSize = Math.min(8, fallbackRowH * 0.7);
|
|
4129
|
-
const colW = Math.min((svgWidth - 20) / 2, 120);
|
|
4130
|
-
const tableX = (svgWidth - colW * 2) / 2;
|
|
4131
|
-
elements.push(
|
|
4132
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4133
|
-
"text",
|
|
4134
|
-
{
|
|
4135
|
-
x: svgWidth / 2,
|
|
4136
|
-
y: tableY,
|
|
4137
|
-
textAnchor: "middle",
|
|
4138
|
-
fontSize: 7,
|
|
4139
|
-
fill: "#94a3b8",
|
|
4140
|
-
children: chunkRTUGI4HQ_js.translationsEn["pptx.chart.additionalRegionsFallback"]
|
|
4141
|
-
},
|
|
4142
|
-
`${element.id}-map-ft-hdr`
|
|
4143
|
-
)
|
|
4144
|
-
);
|
|
4145
|
-
const maxRows = Math.min(unmatchedRows.length, 5);
|
|
4146
|
-
for (let i = 0; i < maxRows; i++) {
|
|
4147
|
-
const row = unmatchedRows[i];
|
|
4148
|
-
const y = tableY + fallbackRowH * (i + 1);
|
|
4149
|
-
if (y + fallbackRowH > svgHeight) {
|
|
4150
|
-
break;
|
|
4151
|
-
}
|
|
4152
|
-
if (i % 2 === 0) {
|
|
4153
|
-
elements.push(
|
|
4154
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4155
|
-
"rect",
|
|
4156
|
-
{
|
|
4157
|
-
x: tableX,
|
|
4158
|
-
y: y - fallbackRowH + 4,
|
|
4159
|
-
width: colW * 2,
|
|
4160
|
-
height: fallbackRowH,
|
|
4161
|
-
fill: "#f1f5f9",
|
|
4162
|
-
rx: 2
|
|
4163
|
-
},
|
|
4164
|
-
`${element.id}-map-ft-bg-${i}`
|
|
4165
|
-
)
|
|
4166
|
-
);
|
|
4167
|
-
}
|
|
4168
|
-
elements.push(
|
|
4169
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4170
|
-
"text",
|
|
4171
|
-
{
|
|
4172
|
-
x: tableX + 4,
|
|
4173
|
-
y,
|
|
4174
|
-
fontSize,
|
|
4175
|
-
fill: "#334155",
|
|
4176
|
-
children: row.label
|
|
4177
|
-
},
|
|
4178
|
-
`${element.id}-map-ft-lbl-${i}`
|
|
4179
|
-
),
|
|
4180
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4181
|
-
"text",
|
|
4182
|
-
{
|
|
4183
|
-
x: tableX + colW + 4,
|
|
4184
|
-
y,
|
|
4185
|
-
fontSize,
|
|
4186
|
-
fill: "#475569",
|
|
4187
|
-
children: chunkWVDM36ZM_js.formatAxisValue(row.value)
|
|
4188
|
-
},
|
|
4189
|
-
`${element.id}-map-ft-val-${i}`
|
|
4190
|
-
)
|
|
4191
|
-
);
|
|
4192
|
-
}
|
|
4193
|
-
if (unmatchedRows.length > 5) {
|
|
4194
|
-
const moreY = tableY + fallbackRowH * 6;
|
|
4195
|
-
elements.push(
|
|
4196
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4197
|
-
"text",
|
|
4198
|
-
{
|
|
4199
|
-
x: svgWidth / 2,
|
|
4200
|
-
y: moreY,
|
|
4201
|
-
textAnchor: "middle",
|
|
4202
|
-
fontSize: 6,
|
|
4203
|
-
fill: "#94a3b8",
|
|
4204
|
-
children: [
|
|
4205
|
-
"+",
|
|
4206
|
-
unmatchedRows.length - 5,
|
|
4207
|
-
" more regions"
|
|
4208
|
-
]
|
|
4209
|
-
},
|
|
4210
|
-
`${element.id}-map-ft-more`
|
|
4211
|
-
)
|
|
4212
|
-
);
|
|
4213
|
-
}
|
|
3862
|
+
const chartData = element.chartData;
|
|
3863
|
+
if (!chartData || chartData.series.length === 0) {
|
|
3864
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center text-[11px] text-white/80 pointer-events-none", children: chunkMVKRI3CZ_js.translationsEn["pptx.chart.heading"] });
|
|
4214
3865
|
}
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
preserveAspectRatio: "xMidYMid meet",
|
|
4221
|
-
role: "img",
|
|
4222
|
-
"aria-label": `Geographic map chart${chartData.title ? `: ${chartData.title}` : ""}`,
|
|
4223
|
-
children: [
|
|
4224
|
-
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: 0, y: 0, width: svgWidth, height: svgHeight, fill: "#f8fafc", rx: 4 }),
|
|
4225
|
-
elements
|
|
4226
|
-
]
|
|
4227
|
-
}
|
|
3866
|
+
const kind = chunkT7BIRNE4_js.resolveChartKind(chartData.chartType ?? "bar");
|
|
3867
|
+
return renderChartViewModel(
|
|
3868
|
+
element.id,
|
|
3869
|
+
buildReactChartViewModel(element),
|
|
3870
|
+
chunkT7BIRNE4_js.chartPreserveAspectRatio(kind)
|
|
4228
3871
|
);
|
|
4229
3872
|
}
|
|
4230
3873
|
|
|
4231
|
-
// src/viewer/utils/chart-pie.tsx
|
|
4232
|
-
function renderPieChart(element, _chartData, _categoryLabels) {
|
|
4233
|
-
const vm = buildReactChartViewModel(element);
|
|
4234
|
-
return renderChartViewModel(element.id, vm, "xMidYMid meet");
|
|
4235
|
-
}
|
|
4236
|
-
|
|
4237
|
-
// src/viewer/utils/chart-radar.tsx
|
|
4238
|
-
function renderRadarChart(element, _chartData, _categoryLabels) {
|
|
4239
|
-
const vm = buildReactChartViewModel(element);
|
|
4240
|
-
return renderChartViewModel(element.id, vm, "xMidYMid meet");
|
|
4241
|
-
}
|
|
4242
|
-
|
|
4243
|
-
// src/viewer/utils/chart-scatter-bubble.tsx
|
|
4244
|
-
function renderScatterChart(element, _chartData, _categoryLabels) {
|
|
4245
|
-
return renderChartViewModel(element.id, buildReactChartViewModel(element));
|
|
4246
|
-
}
|
|
4247
|
-
function renderBubbleChart(element, _chartData, _categoryLabels) {
|
|
4248
|
-
return renderChartViewModel(element.id, buildReactChartViewModel(element));
|
|
4249
|
-
}
|
|
4250
|
-
|
|
4251
|
-
// src/viewer/utils/chart-stacked-bar.tsx
|
|
4252
|
-
function renderStackedBarChart(element, _chartData, _categoryLabels) {
|
|
4253
|
-
return renderChartViewModel(element.id, buildReactChartViewModel(element));
|
|
4254
|
-
}
|
|
4255
|
-
|
|
4256
|
-
// src/viewer/utils/chart-overlay-utils.ts
|
|
4257
|
-
function sColor(series, idx) {
|
|
4258
|
-
return chunkWVDM36ZM_js.seriesColor(series, idx);
|
|
4259
|
-
}
|
|
4260
|
-
function valToY(val, range, topY, bottomY) {
|
|
4261
|
-
const usable = bottomY - topY;
|
|
4262
|
-
return bottomY - (val - range.min) / range.span * usable;
|
|
4263
|
-
}
|
|
4264
|
-
function xToPixel(xVal, catCount, layout, mode) {
|
|
4265
|
-
{
|
|
4266
|
-
const slotWidth = layout.plotWidth / Math.max(catCount, 1);
|
|
4267
|
-
return layout.plotLeft + slotWidth * xVal + slotWidth / 2;
|
|
4268
|
-
}
|
|
4269
|
-
}
|
|
4270
|
-
function computeLinearRegression(xVals, yVals) {
|
|
4271
|
-
const n = xVals.length;
|
|
4272
|
-
if (n < 2) {
|
|
4273
|
-
return { slope: 0, intercept: 0, rSquared: 0 };
|
|
4274
|
-
}
|
|
4275
|
-
let sumX = 0, sumY = 0, sumXY = 0, sumXX = 0;
|
|
4276
|
-
for (let i = 0; i < n; i++) {
|
|
4277
|
-
sumX += xVals[i];
|
|
4278
|
-
sumY += yVals[i];
|
|
4279
|
-
sumXY += xVals[i] * yVals[i];
|
|
4280
|
-
sumXX += xVals[i] * xVals[i];
|
|
4281
|
-
}
|
|
4282
|
-
const denom = n * sumXX - sumX * sumX;
|
|
4283
|
-
if (Math.abs(denom) < 1e-12) {
|
|
4284
|
-
return { slope: 0, intercept: sumY / n, rSquared: 0 };
|
|
4285
|
-
}
|
|
4286
|
-
const slope = (n * sumXY - sumX * sumY) / denom;
|
|
4287
|
-
const intercept = (sumY - slope * sumX) / n;
|
|
4288
|
-
const ssRes = yVals.reduce((s, y, i) => s + (y - (slope * xVals[i] + intercept)) ** 2, 0);
|
|
4289
|
-
const meanY = sumY / n;
|
|
4290
|
-
const ssTot = yVals.reduce((s, y) => s + (y - meanY) ** 2, 0);
|
|
4291
|
-
const rSquared = ssTot > 0 ? 1 - ssRes / ssTot : 0;
|
|
4292
|
-
return { slope, intercept, rSquared };
|
|
4293
|
-
}
|
|
4294
|
-
function fitPolynomial(xVals, yVals, order) {
|
|
4295
|
-
const n = xVals.length;
|
|
4296
|
-
const m = order + 1;
|
|
4297
|
-
const matrix = Array.from({ length: m }, () => Array(m + 1).fill(0));
|
|
4298
|
-
for (let i = 0; i < m; i++) {
|
|
4299
|
-
for (let j = 0; j < m; j++) {
|
|
4300
|
-
let sum2 = 0;
|
|
4301
|
-
for (let k = 0; k < n; k++) {
|
|
4302
|
-
sum2 += xVals[k] ** (i + j);
|
|
4303
|
-
}
|
|
4304
|
-
matrix[i][j] = sum2;
|
|
4305
|
-
}
|
|
4306
|
-
let sum = 0;
|
|
4307
|
-
for (let k = 0; k < n; k++) {
|
|
4308
|
-
sum += yVals[k] * xVals[k] ** i;
|
|
4309
|
-
}
|
|
4310
|
-
matrix[i][m] = sum;
|
|
4311
|
-
}
|
|
4312
|
-
for (let i = 0; i < m; i++) {
|
|
4313
|
-
let maxRow = i;
|
|
4314
|
-
for (let k = i + 1; k < m; k++) {
|
|
4315
|
-
if (Math.abs(matrix[k][i]) > Math.abs(matrix[maxRow][i])) {
|
|
4316
|
-
maxRow = k;
|
|
4317
|
-
}
|
|
4318
|
-
}
|
|
4319
|
-
[matrix[i], matrix[maxRow]] = [matrix[maxRow], matrix[i]];
|
|
4320
|
-
const pivot = matrix[i][i];
|
|
4321
|
-
if (Math.abs(pivot) < 1e-12) {
|
|
4322
|
-
continue;
|
|
4323
|
-
}
|
|
4324
|
-
for (let j = i; j <= m; j++) {
|
|
4325
|
-
matrix[i][j] /= pivot;
|
|
4326
|
-
}
|
|
4327
|
-
for (let k = 0; k < m; k++) {
|
|
4328
|
-
if (k === i) {
|
|
4329
|
-
continue;
|
|
4330
|
-
}
|
|
4331
|
-
const factor = matrix[k][i];
|
|
4332
|
-
for (let j = i; j <= m; j++) {
|
|
4333
|
-
matrix[k][j] -= factor * matrix[i][j];
|
|
4334
|
-
}
|
|
4335
|
-
}
|
|
4336
|
-
}
|
|
4337
|
-
return matrix.map((row) => row[m]);
|
|
4338
|
-
}
|
|
4339
|
-
function computeRSquared(xVals, yVals, evalFn) {
|
|
4340
|
-
const n = xVals.length;
|
|
4341
|
-
const meanY = yVals.reduce((s, y) => s + y, 0) / n;
|
|
4342
|
-
let ssRes = 0, ssTot = 0;
|
|
4343
|
-
for (let i = 0; i < n; i++) {
|
|
4344
|
-
ssRes += (yVals[i] - evalFn(xVals[i])) ** 2;
|
|
4345
|
-
ssTot += (yVals[i] - meanY) ** 2;
|
|
4346
|
-
}
|
|
4347
|
-
return ssTot > 0 ? 1 - ssRes / ssTot : 0;
|
|
4348
|
-
}
|
|
4349
|
-
function computeTrendlinePoints(trendline, values, catCount, layout, range, mode) {
|
|
4350
|
-
const n = values.length;
|
|
4351
|
-
if (n < 2) {
|
|
4352
|
-
return { points: [], equation: "", rSquared: 0 };
|
|
4353
|
-
}
|
|
4354
|
-
const xVals = values.map((_v, i) => i);
|
|
4355
|
-
const yVals = values;
|
|
4356
|
-
const forward = trendline.forward ?? 0;
|
|
4357
|
-
const backward = trendline.backward ?? 0;
|
|
4358
|
-
const startX = -backward;
|
|
4359
|
-
const endX = n - 1 + forward;
|
|
4360
|
-
const steps = Math.max(Math.ceil((endX - startX) * 4), 20);
|
|
4361
|
-
let evalFn;
|
|
4362
|
-
let equation = "";
|
|
4363
|
-
let rSquared = 0;
|
|
4364
|
-
switch (trendline.trendlineType) {
|
|
4365
|
-
case "linear": {
|
|
4366
|
-
const reg = computeLinearRegression(xVals, yVals);
|
|
4367
|
-
const slope = trendline.intercept !== void 0 ? yVals.reduce((s, y, i) => s + (y - trendline.intercept) * xVals[i], 0) / xVals.reduce((s, x) => s + x * x, 0) : reg.slope;
|
|
4368
|
-
const b = trendline.intercept ?? reg.intercept;
|
|
4369
|
-
evalFn = (x) => slope * x + b;
|
|
4370
|
-
equation = `y = ${slope.toFixed(2)}x + ${b.toFixed(2)}`;
|
|
4371
|
-
rSquared = reg.rSquared;
|
|
4372
|
-
break;
|
|
4373
|
-
}
|
|
4374
|
-
case "exponential": {
|
|
4375
|
-
const logY = yVals.filter((y) => y > 0).map((y) => Math.log(y));
|
|
4376
|
-
const filteredX = xVals.filter((_x, i) => yVals[i] > 0);
|
|
4377
|
-
if (logY.length < 2) {
|
|
4378
|
-
return { points: [], equation: "", rSquared: 0 };
|
|
4379
|
-
}
|
|
4380
|
-
const reg = computeLinearRegression(filteredX, logY);
|
|
4381
|
-
const a = Math.exp(reg.intercept);
|
|
4382
|
-
const b = reg.slope;
|
|
4383
|
-
evalFn = (x) => a * Math.exp(b * x);
|
|
4384
|
-
equation = `y = ${a.toFixed(2)}e^(${b.toFixed(2)}x)`;
|
|
4385
|
-
rSquared = reg.rSquared;
|
|
4386
|
-
break;
|
|
4387
|
-
}
|
|
4388
|
-
case "logarithmic": {
|
|
4389
|
-
const lnX = xVals.filter((x) => x > 0).map((x) => Math.log(x));
|
|
4390
|
-
const filteredY = yVals.filter((_y, i) => xVals[i] > 0);
|
|
4391
|
-
if (lnX.length < 2) {
|
|
4392
|
-
return { points: [], equation: "", rSquared: 0 };
|
|
4393
|
-
}
|
|
4394
|
-
const reg = computeLinearRegression(lnX, filteredY);
|
|
4395
|
-
evalFn = (x) => x > 0 ? reg.slope * Math.log(x) + reg.intercept : 0;
|
|
4396
|
-
equation = `y = ${reg.slope.toFixed(2)}ln(x) + ${reg.intercept.toFixed(2)}`;
|
|
4397
|
-
rSquared = reg.rSquared;
|
|
4398
|
-
break;
|
|
4399
|
-
}
|
|
4400
|
-
case "power": {
|
|
4401
|
-
const logX = xVals.filter((x, i) => x > 0 && yVals[i] > 0).map((x) => Math.log(x));
|
|
4402
|
-
const logY = yVals.filter((y, i) => y > 0 && xVals[i] > 0).map((y) => Math.log(y));
|
|
4403
|
-
if (logX.length < 2) {
|
|
4404
|
-
return { points: [], equation: "", rSquared: 0 };
|
|
4405
|
-
}
|
|
4406
|
-
const reg = computeLinearRegression(logX, logY);
|
|
4407
|
-
const a = Math.exp(reg.intercept);
|
|
4408
|
-
evalFn = (x) => x > 0 ? a * x ** reg.slope : 0;
|
|
4409
|
-
equation = `y = ${a.toFixed(2)}x^${reg.slope.toFixed(2)}`;
|
|
4410
|
-
rSquared = reg.rSquared;
|
|
4411
|
-
break;
|
|
4412
|
-
}
|
|
4413
|
-
case "polynomial": {
|
|
4414
|
-
const order = Math.min(trendline.order ?? 2, 6);
|
|
4415
|
-
const coeffs = fitPolynomial(xVals, yVals, order);
|
|
4416
|
-
evalFn = (x) => coeffs.reduce((s, c, i) => s + c * x ** i, 0);
|
|
4417
|
-
equation = coeffs.map((c, i) => `${c.toFixed(2)}x^${i}`).join(" + ");
|
|
4418
|
-
rSquared = computeRSquared(xVals, yVals, evalFn);
|
|
4419
|
-
break;
|
|
4420
|
-
}
|
|
4421
|
-
case "movingAvg": {
|
|
4422
|
-
const period = trendline.period ?? 2;
|
|
4423
|
-
const maPoints = [];
|
|
4424
|
-
for (let i = period - 1; i < n; i++) {
|
|
4425
|
-
let sum = 0;
|
|
4426
|
-
for (let j = i - period + 1; j <= i; j++) {
|
|
4427
|
-
sum += yVals[j];
|
|
4428
|
-
}
|
|
4429
|
-
const avgVal = sum / period;
|
|
4430
|
-
const px = xToPixel(i, catCount, layout);
|
|
4431
|
-
const py = valToY(avgVal, range, layout.plotTop, layout.plotBottom);
|
|
4432
|
-
maPoints.push({ x: px, y: py });
|
|
4433
|
-
}
|
|
4434
|
-
return {
|
|
4435
|
-
points: maPoints,
|
|
4436
|
-
equation: `${period}-period moving average`,
|
|
4437
|
-
rSquared: 0
|
|
4438
|
-
};
|
|
4439
|
-
}
|
|
4440
|
-
default:
|
|
4441
|
-
return { points: [], equation: "", rSquared: 0 };
|
|
4442
|
-
}
|
|
4443
|
-
const points = [];
|
|
4444
|
-
for (let step = 0; step <= steps; step++) {
|
|
4445
|
-
const xVal = startX + (endX - startX) * step / steps;
|
|
4446
|
-
const yVal = evalFn(xVal);
|
|
4447
|
-
if (!Number.isFinite(yVal)) {
|
|
4448
|
-
continue;
|
|
4449
|
-
}
|
|
4450
|
-
const px = xToPixel(xVal, catCount, layout);
|
|
4451
|
-
const py = valToY(yVal, range, layout.plotTop, layout.plotBottom);
|
|
4452
|
-
points.push({ x: px, y: py });
|
|
4453
|
-
}
|
|
4454
|
-
return { points, equation, rSquared };
|
|
4455
|
-
}
|
|
4456
|
-
function renderTrendlines(elementId, chartData, layout, range, mode) {
|
|
4457
|
-
const catCount = Math.max(chartData.categories.length, 1);
|
|
4458
|
-
const nodes = [];
|
|
4459
|
-
chartData.series.forEach((series, si) => {
|
|
4460
|
-
if (!series.trendlines || series.trendlines.length === 0) {
|
|
4461
|
-
return;
|
|
4462
|
-
}
|
|
4463
|
-
series.trendlines.forEach((tl, ti) => {
|
|
4464
|
-
const { points, equation, rSquared } = computeTrendlinePoints(
|
|
4465
|
-
tl,
|
|
4466
|
-
series.values,
|
|
4467
|
-
catCount,
|
|
4468
|
-
layout,
|
|
4469
|
-
range);
|
|
4470
|
-
if (points.length < 2) {
|
|
4471
|
-
return;
|
|
4472
|
-
}
|
|
4473
|
-
const pathD = points.map((p, i) => `${i === 0 ? "M" : "L"} ${p.x} ${p.y}`).join(" ");
|
|
4474
|
-
const strokeColor = tl.color || sColor(series, si);
|
|
4475
|
-
nodes.push(
|
|
4476
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4477
|
-
"path",
|
|
4478
|
-
{
|
|
4479
|
-
d: pathD,
|
|
4480
|
-
fill: "none",
|
|
4481
|
-
stroke: strokeColor,
|
|
4482
|
-
strokeWidth: 1.5,
|
|
4483
|
-
strokeDasharray: "6 3",
|
|
4484
|
-
opacity: 0.8
|
|
4485
|
-
},
|
|
4486
|
-
`${elementId}-tl-${si}-${ti}`
|
|
4487
|
-
)
|
|
4488
|
-
);
|
|
4489
|
-
const textParts = [];
|
|
4490
|
-
if (tl.displayEq && equation) {
|
|
4491
|
-
textParts.push(equation);
|
|
4492
|
-
}
|
|
4493
|
-
if (tl.displayRSq) {
|
|
4494
|
-
textParts.push(`R\xB2 = ${rSquared.toFixed(4)}`);
|
|
4495
|
-
}
|
|
4496
|
-
if (textParts.length > 0) {
|
|
4497
|
-
const lastPt = points[points.length - 1];
|
|
4498
|
-
nodes.push(
|
|
4499
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4500
|
-
"text",
|
|
4501
|
-
{
|
|
4502
|
-
x: lastPt.x,
|
|
4503
|
-
y: lastPt.y - 6,
|
|
4504
|
-
textAnchor: "end",
|
|
4505
|
-
fontSize: 7,
|
|
4506
|
-
fill: strokeColor,
|
|
4507
|
-
children: textParts.join(" ")
|
|
4508
|
-
},
|
|
4509
|
-
`${elementId}-tl-txt-${si}-${ti}`
|
|
4510
|
-
)
|
|
4511
|
-
);
|
|
4512
|
-
}
|
|
4513
|
-
});
|
|
4514
|
-
});
|
|
4515
|
-
if (nodes.length === 0) {
|
|
4516
|
-
return null;
|
|
4517
|
-
}
|
|
4518
|
-
return /* @__PURE__ */ jsxRuntime.jsx("g", { children: nodes }, `${elementId}-trendlines`);
|
|
4519
|
-
}
|
|
4520
|
-
function computeErrorValue(errBars, values, pointIndex, direction) {
|
|
4521
|
-
switch (errBars.valType) {
|
|
4522
|
-
case "fixedVal":
|
|
4523
|
-
return errBars.val ?? 0;
|
|
4524
|
-
case "percentage":
|
|
4525
|
-
return Math.abs(values[pointIndex]) * ((errBars.val ?? 0) / 100);
|
|
4526
|
-
case "stdDev": {
|
|
4527
|
-
const n = values.length;
|
|
4528
|
-
const mean = values.reduce((s, v) => s + v, 0) / n;
|
|
4529
|
-
const variance = values.reduce((s, v) => s + (v - mean) ** 2, 0) / n;
|
|
4530
|
-
const stdDev = Math.sqrt(variance);
|
|
4531
|
-
return stdDev * (errBars.val ?? 1);
|
|
4532
|
-
}
|
|
4533
|
-
case "stdErr": {
|
|
4534
|
-
const n2 = values.length;
|
|
4535
|
-
const mean2 = values.reduce((s, v) => s + v, 0) / n2;
|
|
4536
|
-
const variance2 = values.reduce((s, v) => s + (v - mean2) ** 2, 0) / n2;
|
|
4537
|
-
return Math.sqrt(variance2 / n2);
|
|
4538
|
-
}
|
|
4539
|
-
case "cust": {
|
|
4540
|
-
if (direction === "plus") {
|
|
4541
|
-
return errBars.customPlus?.[pointIndex] ?? 0;
|
|
4542
|
-
}
|
|
4543
|
-
return errBars.customMinus?.[pointIndex] ?? 0;
|
|
4544
|
-
}
|
|
4545
|
-
default:
|
|
4546
|
-
return 0;
|
|
4547
|
-
}
|
|
4548
|
-
}
|
|
4549
|
-
function renderErrorBars(elementId, chartData, layout, range, mode) {
|
|
4550
|
-
const catCount = Math.max(chartData.categories.length, 1);
|
|
4551
|
-
const nodes = [];
|
|
4552
|
-
const capW = 4;
|
|
4553
|
-
chartData.series.forEach((series, si) => {
|
|
4554
|
-
if (!series.errBars || series.errBars.length === 0) {
|
|
4555
|
-
return;
|
|
4556
|
-
}
|
|
4557
|
-
series.errBars.forEach((eb) => {
|
|
4558
|
-
if (eb.direction !== "y") {
|
|
4559
|
-
return;
|
|
4560
|
-
}
|
|
4561
|
-
series.values.forEach((val, vi) => {
|
|
4562
|
-
const cx = xToPixel(vi, catCount, layout);
|
|
4563
|
-
const baseY = valToY(val, range, layout.plotTop, layout.plotBottom);
|
|
4564
|
-
if (eb.barType === "plus" || eb.barType === "both") {
|
|
4565
|
-
const plusErr = computeErrorValue(eb, series.values, vi, "plus");
|
|
4566
|
-
const topY = valToY(val + plusErr, range, layout.plotTop, layout.plotBottom);
|
|
4567
|
-
nodes.push(
|
|
4568
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4569
|
-
"line",
|
|
4570
|
-
{
|
|
4571
|
-
x1: cx,
|
|
4572
|
-
y1: baseY,
|
|
4573
|
-
x2: cx,
|
|
4574
|
-
y2: topY,
|
|
4575
|
-
stroke: "#334155",
|
|
4576
|
-
strokeWidth: 1
|
|
4577
|
-
},
|
|
4578
|
-
`${elementId}-eb-p-${si}-${vi}`
|
|
4579
|
-
),
|
|
4580
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4581
|
-
"line",
|
|
4582
|
-
{
|
|
4583
|
-
x1: cx - capW,
|
|
4584
|
-
y1: topY,
|
|
4585
|
-
x2: cx + capW,
|
|
4586
|
-
y2: topY,
|
|
4587
|
-
stroke: "#334155",
|
|
4588
|
-
strokeWidth: 1
|
|
4589
|
-
},
|
|
4590
|
-
`${elementId}-eb-pc-${si}-${vi}`
|
|
4591
|
-
)
|
|
4592
|
-
);
|
|
4593
|
-
}
|
|
4594
|
-
if (eb.barType === "minus" || eb.barType === "both") {
|
|
4595
|
-
const minusErr = computeErrorValue(eb, series.values, vi, "minus");
|
|
4596
|
-
const botY = valToY(val - minusErr, range, layout.plotTop, layout.plotBottom);
|
|
4597
|
-
nodes.push(
|
|
4598
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4599
|
-
"line",
|
|
4600
|
-
{
|
|
4601
|
-
x1: cx,
|
|
4602
|
-
y1: baseY,
|
|
4603
|
-
x2: cx,
|
|
4604
|
-
y2: botY,
|
|
4605
|
-
stroke: "#334155",
|
|
4606
|
-
strokeWidth: 1
|
|
4607
|
-
},
|
|
4608
|
-
`${elementId}-eb-m-${si}-${vi}`
|
|
4609
|
-
),
|
|
4610
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4611
|
-
"line",
|
|
4612
|
-
{
|
|
4613
|
-
x1: cx - capW,
|
|
4614
|
-
y1: botY,
|
|
4615
|
-
x2: cx + capW,
|
|
4616
|
-
y2: botY,
|
|
4617
|
-
stroke: "#334155",
|
|
4618
|
-
strokeWidth: 1
|
|
4619
|
-
},
|
|
4620
|
-
`${elementId}-eb-mc-${si}-${vi}`
|
|
4621
|
-
)
|
|
4622
|
-
);
|
|
4623
|
-
}
|
|
4624
|
-
});
|
|
4625
|
-
});
|
|
4626
|
-
});
|
|
4627
|
-
if (nodes.length === 0) {
|
|
4628
|
-
return null;
|
|
4629
|
-
}
|
|
4630
|
-
return /* @__PURE__ */ jsxRuntime.jsx("g", { children: nodes }, `${elementId}-errorbars`);
|
|
4631
|
-
}
|
|
4632
|
-
function renderDropLines(elementId, chartData, layout, range, mode) {
|
|
4633
|
-
if (!chartData.dropLines) {
|
|
4634
|
-
return null;
|
|
4635
|
-
}
|
|
4636
|
-
const catCount = Math.max(chartData.categories.length, 1);
|
|
4637
|
-
const style = chartData.dropLines;
|
|
4638
|
-
const baselineY = valToY(range.min, range, layout.plotTop, layout.plotBottom);
|
|
4639
|
-
const nodes = [];
|
|
4640
|
-
chartData.series.forEach((series, si) => {
|
|
4641
|
-
series.values.forEach((val, vi) => {
|
|
4642
|
-
const cx = xToPixel(vi, catCount, layout);
|
|
4643
|
-
const dataY = valToY(val, range, layout.plotTop, layout.plotBottom);
|
|
4644
|
-
nodes.push(
|
|
4645
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4646
|
-
"line",
|
|
4647
|
-
{
|
|
4648
|
-
x1: cx,
|
|
4649
|
-
y1: dataY,
|
|
4650
|
-
x2: cx,
|
|
4651
|
-
y2: baselineY,
|
|
4652
|
-
stroke: style.color || "#94a3b8",
|
|
4653
|
-
strokeWidth: style.width ?? 0.8,
|
|
4654
|
-
strokeDasharray: style.dashStyle === "dash" ? "4 3" : void 0
|
|
4655
|
-
},
|
|
4656
|
-
`${elementId}-dl-${si}-${vi}`
|
|
4657
|
-
)
|
|
4658
|
-
);
|
|
4659
|
-
});
|
|
4660
|
-
});
|
|
4661
|
-
if (nodes.length === 0) {
|
|
4662
|
-
return null;
|
|
4663
|
-
}
|
|
4664
|
-
return /* @__PURE__ */ jsxRuntime.jsx("g", { children: nodes }, `${elementId}-droplines`);
|
|
4665
|
-
}
|
|
4666
|
-
function renderUpDownBars(elementId, chartData, layout, range, mode) {
|
|
4667
|
-
if (!chartData.upDownBars || chartData.series.length < 2) {
|
|
4668
|
-
return null;
|
|
4669
|
-
}
|
|
4670
|
-
const catCount = Math.max(chartData.categories.length, 1);
|
|
4671
|
-
const bars = chartData.upDownBars;
|
|
4672
|
-
const first = chartData.series[0];
|
|
4673
|
-
const last = chartData.series[chartData.series.length - 1];
|
|
4674
|
-
const slot = layout.plotWidth / catCount;
|
|
4675
|
-
const gapWidth = bars.gapWidth ?? 150;
|
|
4676
|
-
const barW = Math.max(slot / (1 + Math.max(gapWidth, 0) / 100), 1);
|
|
4677
|
-
const upFill = bars.upBars?.fillColor ?? "#e2e8f0";
|
|
4678
|
-
const downFill = bars.downBars?.fillColor ?? "#334155";
|
|
4679
|
-
const nodes = [];
|
|
4680
|
-
for (let vi = 0; vi < catCount; vi++) {
|
|
4681
|
-
const firstVal = first.values[vi];
|
|
4682
|
-
const lastVal = last.values[vi];
|
|
4683
|
-
if (firstVal === void 0 || lastVal === void 0) {
|
|
4684
|
-
continue;
|
|
4685
|
-
}
|
|
4686
|
-
const firstY = valToY(firstVal, range, layout.plotTop, layout.plotBottom);
|
|
4687
|
-
const lastY = valToY(lastVal, range, layout.plotTop, layout.plotBottom);
|
|
4688
|
-
const cx = xToPixel(vi, catCount, layout);
|
|
4689
|
-
nodes.push(
|
|
4690
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4691
|
-
"rect",
|
|
4692
|
-
{
|
|
4693
|
-
x: cx - barW / 2,
|
|
4694
|
-
y: Math.min(firstY, lastY),
|
|
4695
|
-
width: barW,
|
|
4696
|
-
height: Math.max(Math.abs(firstY - lastY), 1),
|
|
4697
|
-
fill: lastVal >= firstVal ? upFill : downFill,
|
|
4698
|
-
stroke: "#64748b",
|
|
4699
|
-
strokeWidth: 0.5
|
|
4700
|
-
},
|
|
4701
|
-
`${elementId}-udb-${vi}`
|
|
4702
|
-
)
|
|
4703
|
-
);
|
|
4704
|
-
}
|
|
4705
|
-
if (nodes.length === 0) {
|
|
4706
|
-
return null;
|
|
4707
|
-
}
|
|
4708
|
-
return /* @__PURE__ */ jsxRuntime.jsx("g", { children: nodes }, `${elementId}-updownbars`);
|
|
4709
|
-
}
|
|
4710
|
-
function renderHiLowLines(elementId, chartData, layout, range, mode) {
|
|
4711
|
-
if (!chartData.hiLowLines) {
|
|
4712
|
-
return null;
|
|
4713
|
-
}
|
|
4714
|
-
if (chartData.series.length < 2) {
|
|
4715
|
-
return null;
|
|
4716
|
-
}
|
|
4717
|
-
const catCount = Math.max(chartData.categories.length, 1);
|
|
4718
|
-
const style = chartData.hiLowLines;
|
|
4719
|
-
const nodes = [];
|
|
4720
|
-
for (let vi = 0; vi < catCount; vi++) {
|
|
4721
|
-
let highVal = -Infinity;
|
|
4722
|
-
let lowVal = Infinity;
|
|
4723
|
-
for (const series of chartData.series) {
|
|
4724
|
-
const v = series.values[vi];
|
|
4725
|
-
if (v !== void 0) {
|
|
4726
|
-
highVal = Math.max(highVal, v);
|
|
4727
|
-
lowVal = Math.min(lowVal, v);
|
|
4728
|
-
}
|
|
4729
|
-
}
|
|
4730
|
-
if (!Number.isFinite(highVal) || !Number.isFinite(lowVal)) {
|
|
4731
|
-
continue;
|
|
4732
|
-
}
|
|
4733
|
-
const cx = xToPixel(vi, catCount, layout);
|
|
4734
|
-
const highY = valToY(highVal, range, layout.plotTop, layout.plotBottom);
|
|
4735
|
-
const lowY = valToY(lowVal, range, layout.plotTop, layout.plotBottom);
|
|
4736
|
-
nodes.push(
|
|
4737
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4738
|
-
"line",
|
|
4739
|
-
{
|
|
4740
|
-
x1: cx,
|
|
4741
|
-
y1: highY,
|
|
4742
|
-
x2: cx,
|
|
4743
|
-
y2: lowY,
|
|
4744
|
-
stroke: style.color || "#334155",
|
|
4745
|
-
strokeWidth: style.width ?? 1,
|
|
4746
|
-
strokeDasharray: style.dashStyle === "dash" ? "4 3" : void 0
|
|
4747
|
-
},
|
|
4748
|
-
`${elementId}-hl-${vi}`
|
|
4749
|
-
)
|
|
4750
|
-
);
|
|
4751
|
-
}
|
|
4752
|
-
if (nodes.length === 0) {
|
|
4753
|
-
return null;
|
|
4754
|
-
}
|
|
4755
|
-
return /* @__PURE__ */ jsxRuntime.jsx("g", { children: nodes }, `${elementId}-hilowlines`);
|
|
4756
|
-
}
|
|
4757
|
-
function renderTitle(id, style, title, svgWidth) {
|
|
4758
|
-
if (!style?.hasTitle) {
|
|
4759
|
-
return null;
|
|
4760
|
-
}
|
|
4761
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4762
|
-
"text",
|
|
4763
|
-
{
|
|
4764
|
-
x: svgWidth / 2,
|
|
4765
|
-
y: 16,
|
|
4766
|
-
textAnchor: "middle",
|
|
4767
|
-
fontSize: 12,
|
|
4768
|
-
fontWeight: 600,
|
|
4769
|
-
fill: "#1e293b",
|
|
4770
|
-
children: title || "Chart"
|
|
4771
|
-
},
|
|
4772
|
-
`${id}-title`
|
|
4773
|
-
);
|
|
4774
|
-
}
|
|
4775
|
-
function renderLegend(id, style, series, layout, colorPalette) {
|
|
4776
|
-
if (!style?.hasLegend || series.length === 0) {
|
|
4777
|
-
return null;
|
|
4778
|
-
}
|
|
4779
|
-
const pos = style.legendPosition || "b";
|
|
4780
|
-
if (pos === "b" || pos === "t") {
|
|
4781
|
-
const y = pos === "b" ? layout.svgHeight - 10 : layout.plotTop - 14;
|
|
4782
|
-
const items = [];
|
|
4783
|
-
const charWidth = 6;
|
|
4784
|
-
const gap = 24;
|
|
4785
|
-
const totalWidth = series.reduce((w, s) => w + (s.name?.length ?? 4) * charWidth + gap, 0);
|
|
4786
|
-
let cx = (layout.svgWidth - totalWidth) / 2;
|
|
4787
|
-
series.forEach((s, i) => {
|
|
4788
|
-
items.push(
|
|
4789
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4790
|
-
"rect",
|
|
4791
|
-
{
|
|
4792
|
-
x: cx,
|
|
4793
|
-
y: y - 5,
|
|
4794
|
-
width: 10,
|
|
4795
|
-
height: 10,
|
|
4796
|
-
rx: 2,
|
|
4797
|
-
fill: chunkWVDM36ZM_js.seriesColor(s, i, style?.styleId, colorPalette)
|
|
4798
|
-
},
|
|
4799
|
-
`${id}-leg-r-${i}`
|
|
4800
|
-
)
|
|
4801
|
-
);
|
|
4802
|
-
items.push(
|
|
4803
|
-
/* @__PURE__ */ jsxRuntime.jsx("text", { x: cx + 14, y: y + 4, fontSize: 9, fill: "#475569", children: s.name || `Series ${i + 1}` }, `${id}-leg-t-${i}`)
|
|
4804
|
-
);
|
|
4805
|
-
cx += (s.name?.length ?? 4) * charWidth + gap;
|
|
4806
|
-
});
|
|
4807
|
-
return /* @__PURE__ */ jsxRuntime.jsx("g", { children: items }, `${id}-legend`);
|
|
4808
|
-
}
|
|
4809
|
-
const x = pos === "r" ? layout.plotRight + 8 : 4;
|
|
4810
|
-
return /* @__PURE__ */ jsxRuntime.jsx("g", { children: series.map((s, i) => {
|
|
4811
|
-
const cy = layout.plotTop + i * 16;
|
|
4812
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
|
|
4813
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4814
|
-
"rect",
|
|
4815
|
-
{
|
|
4816
|
-
x,
|
|
4817
|
-
y: cy,
|
|
4818
|
-
width: 10,
|
|
4819
|
-
height: 10,
|
|
4820
|
-
rx: 2,
|
|
4821
|
-
fill: chunkWVDM36ZM_js.seriesColor(s, i, style?.styleId, colorPalette)
|
|
4822
|
-
}
|
|
4823
|
-
),
|
|
4824
|
-
/* @__PURE__ */ jsxRuntime.jsx("text", { x: x + 14, y: cy + 8, fontSize: 9, fill: "#475569", children: s.name || `Series ${i + 1}` })
|
|
4825
|
-
] }, `${id}-leg-${i}`);
|
|
4826
|
-
}) }, `${id}-legend`);
|
|
4827
|
-
}
|
|
4828
|
-
function renderGridlines(id, style, range, layout) {
|
|
4829
|
-
if (!style?.hasGridlines) {
|
|
4830
|
-
return null;
|
|
4831
|
-
}
|
|
4832
|
-
const lines = [];
|
|
4833
|
-
if (range.logScale && range.logBase) {
|
|
4834
|
-
const ticks = chunkWVDM36ZM_js.generateLogTicks(range);
|
|
4835
|
-
ticks.forEach((tickVal, i) => {
|
|
4836
|
-
const y = chunkWVDM36ZM_js.valueToY(tickVal, range, layout.plotTop, layout.plotBottom);
|
|
4837
|
-
lines.push(
|
|
4838
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4839
|
-
"line",
|
|
4840
|
-
{
|
|
4841
|
-
x1: layout.plotLeft,
|
|
4842
|
-
y1: y,
|
|
4843
|
-
x2: layout.plotRight,
|
|
4844
|
-
y2: y,
|
|
4845
|
-
stroke: "#cbd5e1",
|
|
4846
|
-
strokeWidth: 0.7,
|
|
4847
|
-
strokeDasharray: "4 3"
|
|
4848
|
-
},
|
|
4849
|
-
`${id}-grid-log-${i}`
|
|
4850
|
-
)
|
|
4851
|
-
);
|
|
4852
|
-
});
|
|
4853
|
-
} else {
|
|
4854
|
-
const steps = 4;
|
|
4855
|
-
for (let i = 0; i <= steps; i++) {
|
|
4856
|
-
const val = range.min + range.span * i / steps;
|
|
4857
|
-
const y = chunkWVDM36ZM_js.valueToY(val, range, layout.plotTop, layout.plotBottom);
|
|
4858
|
-
lines.push(
|
|
4859
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4860
|
-
"line",
|
|
4861
|
-
{
|
|
4862
|
-
x1: layout.plotLeft,
|
|
4863
|
-
y1: y,
|
|
4864
|
-
x2: layout.plotRight,
|
|
4865
|
-
y2: y,
|
|
4866
|
-
stroke: "#cbd5e1",
|
|
4867
|
-
strokeWidth: 0.7,
|
|
4868
|
-
strokeDasharray: "4 3"
|
|
4869
|
-
},
|
|
4870
|
-
`${id}-grid-${i}`
|
|
4871
|
-
)
|
|
4872
|
-
);
|
|
4873
|
-
}
|
|
4874
|
-
}
|
|
4875
|
-
return /* @__PURE__ */ jsxRuntime.jsx("g", { children: lines }, `${id}-gridlines`);
|
|
4876
|
-
}
|
|
4877
|
-
function renderValueAxis(id, range, layout, axisFormatting) {
|
|
4878
|
-
const labels = [];
|
|
4879
|
-
const hasDisplayUnits = Boolean(axisFormatting?.displayUnits);
|
|
4880
|
-
if (range.logScale && range.logBase) {
|
|
4881
|
-
const ticks = chunkWVDM36ZM_js.generateLogTicks(range);
|
|
4882
|
-
ticks.forEach((tickVal, i) => {
|
|
4883
|
-
const y = chunkWVDM36ZM_js.valueToY(tickVal, range, layout.plotTop, layout.plotBottom);
|
|
4884
|
-
labels.push(
|
|
4885
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4886
|
-
"text",
|
|
4887
|
-
{
|
|
4888
|
-
x: layout.plotLeft - 4,
|
|
4889
|
-
y: y + 3,
|
|
4890
|
-
textAnchor: "end",
|
|
4891
|
-
fontSize: 8,
|
|
4892
|
-
fill: "#64748b",
|
|
4893
|
-
children: hasDisplayUnits ? chunkWVDM36ZM_js.formatAxisValueWithUnits(tickVal, axisFormatting) : chunkWVDM36ZM_js.formatAxisValue(tickVal)
|
|
4894
|
-
},
|
|
4895
|
-
`${id}-vaxis-log-${i}`
|
|
4896
|
-
)
|
|
4897
|
-
);
|
|
4898
|
-
});
|
|
4899
|
-
} else {
|
|
4900
|
-
const steps = 4;
|
|
4901
|
-
for (let i = 0; i <= steps; i++) {
|
|
4902
|
-
const val = range.min + range.span * i / steps;
|
|
4903
|
-
const y = chunkWVDM36ZM_js.valueToY(val, range, layout.plotTop, layout.plotBottom);
|
|
4904
|
-
labels.push(
|
|
4905
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4906
|
-
"text",
|
|
4907
|
-
{
|
|
4908
|
-
x: layout.plotLeft - 4,
|
|
4909
|
-
y: y + 3,
|
|
4910
|
-
textAnchor: "end",
|
|
4911
|
-
fontSize: 8,
|
|
4912
|
-
fill: "#64748b",
|
|
4913
|
-
children: hasDisplayUnits ? chunkWVDM36ZM_js.formatAxisValueWithUnits(val, axisFormatting) : chunkWVDM36ZM_js.formatAxisValue(val)
|
|
4914
|
-
},
|
|
4915
|
-
`${id}-vaxis-${i}`
|
|
4916
|
-
)
|
|
4917
|
-
);
|
|
4918
|
-
}
|
|
4919
|
-
}
|
|
4920
|
-
if (hasDisplayUnits) {
|
|
4921
|
-
const unitLabel = chunkWVDM36ZM_js.getDisplayUnitLabel(
|
|
4922
|
-
axisFormatting.displayUnits,
|
|
4923
|
-
axisFormatting.displayUnitsLabel
|
|
4924
|
-
);
|
|
4925
|
-
if (unitLabel) {
|
|
4926
|
-
const midY = (layout.plotTop + layout.plotBottom) / 2;
|
|
4927
|
-
labels.push(
|
|
4928
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4929
|
-
"text",
|
|
4930
|
-
{
|
|
4931
|
-
x: layout.plotLeft - 36,
|
|
4932
|
-
y: midY,
|
|
4933
|
-
textAnchor: "middle",
|
|
4934
|
-
fontSize: 9,
|
|
4935
|
-
fill: "#64748b",
|
|
4936
|
-
transform: `rotate(-90, ${layout.plotLeft - 36}, ${midY})`,
|
|
4937
|
-
children: unitLabel
|
|
4938
|
-
},
|
|
4939
|
-
`${id}-vaxis-dispunit`
|
|
4940
|
-
)
|
|
4941
|
-
);
|
|
4942
|
-
}
|
|
4943
|
-
}
|
|
4944
|
-
return /* @__PURE__ */ jsxRuntime.jsx("g", { children: labels }, `${id}-vaxis`);
|
|
4945
|
-
}
|
|
4946
|
-
function renderCategoryAxis(id, categories, layout) {
|
|
4947
|
-
const count = categories.length;
|
|
4948
|
-
if (count === 0) {
|
|
4949
|
-
return null;
|
|
4950
|
-
}
|
|
4951
|
-
return /* @__PURE__ */ jsxRuntime.jsx("g", { children: categories.map((cat, i) => {
|
|
4952
|
-
const slotWidth = layout.plotWidth / count;
|
|
4953
|
-
const x = layout.plotLeft + slotWidth * i + slotWidth / 2;
|
|
4954
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4955
|
-
"text",
|
|
4956
|
-
{
|
|
4957
|
-
x,
|
|
4958
|
-
y: layout.plotBottom + 14,
|
|
4959
|
-
textAnchor: "middle",
|
|
4960
|
-
fontSize: 8,
|
|
4961
|
-
fill: "#64748b",
|
|
4962
|
-
children: cat
|
|
4963
|
-
},
|
|
4964
|
-
`${id}-caxis-${i}`
|
|
4965
|
-
);
|
|
4966
|
-
}) }, `${id}-caxis`);
|
|
4967
|
-
}
|
|
4968
|
-
function renderCategoryAxisForLine(id, categories, layout) {
|
|
4969
|
-
const count = categories.length;
|
|
4970
|
-
if (count === 0) {
|
|
4971
|
-
return null;
|
|
4972
|
-
}
|
|
4973
|
-
return /* @__PURE__ */ jsxRuntime.jsx("g", { children: categories.map((cat, i) => {
|
|
4974
|
-
const x = count > 1 ? layout.plotLeft + layout.plotWidth * i / (count - 1) : layout.plotLeft + layout.plotWidth / 2;
|
|
4975
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4976
|
-
"text",
|
|
4977
|
-
{
|
|
4978
|
-
x,
|
|
4979
|
-
y: layout.plotBottom + 14,
|
|
4980
|
-
textAnchor: "middle",
|
|
4981
|
-
fontSize: 8,
|
|
4982
|
-
fill: "#64748b",
|
|
4983
|
-
children: cat
|
|
4984
|
-
},
|
|
4985
|
-
`${id}-caxis-${i}`
|
|
4986
|
-
);
|
|
4987
|
-
}) }, `${id}-caxis`);
|
|
4988
|
-
}
|
|
4989
|
-
function renderZeroLine(id, range, layout) {
|
|
4990
|
-
if (range.logScale) {
|
|
4991
|
-
return null;
|
|
4992
|
-
}
|
|
4993
|
-
if (range.min >= 0) {
|
|
4994
|
-
return null;
|
|
4995
|
-
}
|
|
4996
|
-
const y = chunkWVDM36ZM_js.valueToY(0, range, layout.plotTop, layout.plotBottom);
|
|
4997
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4998
|
-
"line",
|
|
4999
|
-
{
|
|
5000
|
-
x1: layout.plotLeft,
|
|
5001
|
-
y1: y,
|
|
5002
|
-
x2: layout.plotRight,
|
|
5003
|
-
y2: y,
|
|
5004
|
-
stroke: "#334155",
|
|
5005
|
-
strokeWidth: 1
|
|
5006
|
-
},
|
|
5007
|
-
`${id}-zero`
|
|
5008
|
-
);
|
|
5009
|
-
}
|
|
5010
|
-
function renderSecondaryValueAxis(id, range, layout, axisFormatting) {
|
|
5011
|
-
const steps = 4;
|
|
5012
|
-
const labels = [];
|
|
5013
|
-
const fontSize = axisFormatting?.fontSize ?? 8;
|
|
5014
|
-
const fontColor = axisFormatting?.fontColor ?? "#64748b";
|
|
5015
|
-
const fontFamily = axisFormatting?.fontFamily;
|
|
5016
|
-
const fontWeight = axisFormatting?.fontBold ? 700 : void 0;
|
|
5017
|
-
const hasDisplayUnits = Boolean(axisFormatting?.displayUnits);
|
|
5018
|
-
for (let i = 0; i <= steps; i++) {
|
|
5019
|
-
const val = range.min + range.span * i / steps;
|
|
5020
|
-
const y = chunkWVDM36ZM_js.valueToY(val, range, layout.plotTop, layout.plotBottom);
|
|
5021
|
-
labels.push(
|
|
5022
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5023
|
-
"text",
|
|
5024
|
-
{
|
|
5025
|
-
x: layout.plotRight + 4,
|
|
5026
|
-
y: y + 3,
|
|
5027
|
-
textAnchor: "start",
|
|
5028
|
-
fontSize,
|
|
5029
|
-
fontFamily,
|
|
5030
|
-
fontWeight,
|
|
5031
|
-
fill: fontColor,
|
|
5032
|
-
children: hasDisplayUnits ? chunkWVDM36ZM_js.formatAxisValueWithUnits(val, axisFormatting) : chunkWVDM36ZM_js.formatAxisValue(val)
|
|
5033
|
-
},
|
|
5034
|
-
`${id}-sec-vaxis-${i}`
|
|
5035
|
-
)
|
|
5036
|
-
);
|
|
5037
|
-
}
|
|
5038
|
-
if (axisFormatting?.titleText) {
|
|
5039
|
-
labels.push(
|
|
5040
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5041
|
-
"text",
|
|
5042
|
-
{
|
|
5043
|
-
x: layout.plotRight + 36,
|
|
5044
|
-
y: (layout.plotTop + layout.plotBottom) / 2,
|
|
5045
|
-
textAnchor: "middle",
|
|
5046
|
-
fontSize: 9,
|
|
5047
|
-
fill: fontColor,
|
|
5048
|
-
transform: `rotate(-90, ${layout.plotRight + 36}, ${(layout.plotTop + layout.plotBottom) / 2})`,
|
|
5049
|
-
children: axisFormatting.titleText
|
|
5050
|
-
},
|
|
5051
|
-
`${id}-sec-vaxis-title`
|
|
5052
|
-
)
|
|
5053
|
-
);
|
|
5054
|
-
}
|
|
5055
|
-
if (hasDisplayUnits) {
|
|
5056
|
-
const unitLabel = chunkWVDM36ZM_js.getDisplayUnitLabel(
|
|
5057
|
-
axisFormatting.displayUnits,
|
|
5058
|
-
axisFormatting.displayUnitsLabel
|
|
5059
|
-
);
|
|
5060
|
-
if (unitLabel) {
|
|
5061
|
-
const labelX = layout.plotRight + (axisFormatting?.titleText ? 52 : 36);
|
|
5062
|
-
const midY = (layout.plotTop + layout.plotBottom) / 2;
|
|
5063
|
-
labels.push(
|
|
5064
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5065
|
-
"text",
|
|
5066
|
-
{
|
|
5067
|
-
x: labelX,
|
|
5068
|
-
y: midY,
|
|
5069
|
-
textAnchor: "middle",
|
|
5070
|
-
fontSize: 9,
|
|
5071
|
-
fill: fontColor,
|
|
5072
|
-
transform: `rotate(-90, ${labelX}, ${midY})`,
|
|
5073
|
-
children: unitLabel
|
|
5074
|
-
},
|
|
5075
|
-
`${id}-sec-vaxis-dispunit`
|
|
5076
|
-
)
|
|
5077
|
-
);
|
|
5078
|
-
}
|
|
5079
|
-
}
|
|
5080
|
-
return /* @__PURE__ */ jsxRuntime.jsx("g", { children: labels }, `${id}-sec-vaxis`);
|
|
5081
|
-
}
|
|
5082
|
-
function renderSecondaryAxisTicks(id, range, layout) {
|
|
5083
|
-
const steps = 4;
|
|
5084
|
-
const ticks = [];
|
|
5085
|
-
for (let i = 0; i <= steps; i++) {
|
|
5086
|
-
const val = range.min + range.span * i / steps;
|
|
5087
|
-
const y = chunkWVDM36ZM_js.valueToY(val, range, layout.plotTop, layout.plotBottom);
|
|
5088
|
-
ticks.push(
|
|
5089
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5090
|
-
"line",
|
|
5091
|
-
{
|
|
5092
|
-
x1: layout.plotRight,
|
|
5093
|
-
y1: y,
|
|
5094
|
-
x2: layout.plotRight + 4,
|
|
5095
|
-
y2: y,
|
|
5096
|
-
stroke: "#94a3b8",
|
|
5097
|
-
strokeWidth: 0.7
|
|
5098
|
-
},
|
|
5099
|
-
`${id}-sec-tick-${i}`
|
|
5100
|
-
)
|
|
5101
|
-
);
|
|
5102
|
-
}
|
|
5103
|
-
return /* @__PURE__ */ jsxRuntime.jsx("g", { children: ticks }, `${id}-sec-ticks`);
|
|
5104
|
-
}
|
|
5105
|
-
function renderSecondaryGridlines(id, range, layout, axisFormatting) {
|
|
5106
|
-
if (!axisFormatting?.minorGridlinesSpPr && !axisFormatting?.majorGridlinesSpPr) {
|
|
5107
|
-
return null;
|
|
5108
|
-
}
|
|
5109
|
-
const steps = 4;
|
|
5110
|
-
const lines = [];
|
|
5111
|
-
const gridColor = axisFormatting.majorGridlinesSpPr?.strokeColor ?? "#e2e8f0";
|
|
5112
|
-
for (let i = 0; i <= steps; i++) {
|
|
5113
|
-
const val = range.min + range.span * i / steps;
|
|
5114
|
-
const y = chunkWVDM36ZM_js.valueToY(val, range, layout.plotTop, layout.plotBottom);
|
|
5115
|
-
lines.push(
|
|
5116
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5117
|
-
"line",
|
|
5118
|
-
{
|
|
5119
|
-
x1: layout.plotLeft,
|
|
5120
|
-
y1: y,
|
|
5121
|
-
x2: layout.plotRight,
|
|
5122
|
-
y2: y,
|
|
5123
|
-
stroke: gridColor,
|
|
5124
|
-
strokeWidth: 0.5,
|
|
5125
|
-
strokeDasharray: "2 3",
|
|
5126
|
-
opacity: 0.5
|
|
5127
|
-
},
|
|
5128
|
-
`${id}-sec-grid-${i}`
|
|
5129
|
-
)
|
|
5130
|
-
);
|
|
5131
|
-
}
|
|
5132
|
-
return /* @__PURE__ */ jsxRuntime.jsx("g", { children: lines }, `${id}-sec-gridlines`);
|
|
5133
|
-
}
|
|
5134
|
-
function renderChrome(id, chartData, layout, range, categories, options, secondaryOptions) {
|
|
5135
|
-
const style = chartData.style;
|
|
5136
|
-
const chrome = [];
|
|
5137
|
-
const primaryValueAxis = chartData.axes?.find((a) => a.axisType === "valAx" && a.axPos !== "r") ?? chartData.axes?.find((a) => a.axisType === "valAx");
|
|
5138
|
-
chrome.push(renderTitle(id, style, chartData.title, layout.svgWidth));
|
|
5139
|
-
chrome.push(renderGridlines(id, style, range, layout));
|
|
5140
|
-
chrome.push(renderValueAxis(id, range, layout, primaryValueAxis));
|
|
5141
|
-
chrome.push(renderZeroLine(id, range, layout));
|
|
5142
|
-
if (options.categoryAxisStyle === "bar") {
|
|
5143
|
-
chrome.push(renderCategoryAxis(id, categories, layout));
|
|
5144
|
-
} else {
|
|
5145
|
-
chrome.push(renderCategoryAxisForLine(id, categories, layout));
|
|
5146
|
-
}
|
|
5147
|
-
chrome.push(renderLegend(id, style, chartData.series, layout, chartData.colorPalette));
|
|
5148
|
-
if (secondaryOptions?.secondaryRange) {
|
|
5149
|
-
chrome.push(
|
|
5150
|
-
renderSecondaryValueAxis(
|
|
5151
|
-
id,
|
|
5152
|
-
secondaryOptions.secondaryRange,
|
|
5153
|
-
layout,
|
|
5154
|
-
secondaryOptions.secondaryAxisFormatting
|
|
5155
|
-
)
|
|
5156
|
-
);
|
|
5157
|
-
chrome.push(renderSecondaryAxisTicks(id, secondaryOptions.secondaryRange, layout));
|
|
5158
|
-
chrome.push(
|
|
5159
|
-
renderSecondaryGridlines(
|
|
5160
|
-
id,
|
|
5161
|
-
secondaryOptions.secondaryRange,
|
|
5162
|
-
layout,
|
|
5163
|
-
secondaryOptions.secondaryAxisFormatting
|
|
5164
|
-
)
|
|
5165
|
-
);
|
|
5166
|
-
}
|
|
5167
|
-
return chrome;
|
|
5168
|
-
}
|
|
5169
|
-
function renderOverlays(id, chartData, layout, range, mode) {
|
|
5170
|
-
const overlayLayout = layout;
|
|
5171
|
-
const overlayRange = range;
|
|
5172
|
-
const nodes = [];
|
|
5173
|
-
nodes.push(renderUpDownBars(id, chartData, overlayLayout, overlayRange));
|
|
5174
|
-
nodes.push(renderDropLines(id, chartData, overlayLayout, overlayRange));
|
|
5175
|
-
nodes.push(renderHiLowLines(id, chartData, overlayLayout, overlayRange));
|
|
5176
|
-
nodes.push(renderTrendlines(id, chartData, overlayLayout, overlayRange));
|
|
5177
|
-
nodes.push(renderErrorBars(id, chartData, overlayLayout, overlayRange));
|
|
5178
|
-
return nodes;
|
|
5179
|
-
}
|
|
5180
|
-
function formatValue(val) {
|
|
5181
|
-
if (Math.abs(val) >= 1e6) {
|
|
5182
|
-
return `${(val / 1e6).toFixed(1)}M`;
|
|
5183
|
-
}
|
|
5184
|
-
if (Math.abs(val) >= 1e3) {
|
|
5185
|
-
return `${(val / 1e3).toFixed(1)}K`;
|
|
5186
|
-
}
|
|
5187
|
-
if (Number.isInteger(val)) {
|
|
5188
|
-
return String(val);
|
|
5189
|
-
}
|
|
5190
|
-
return val.toFixed(1);
|
|
5191
|
-
}
|
|
5192
|
-
function renderChartDataTable(elementId, chartData, svgWidth) {
|
|
5193
|
-
const table = chartData.dataTable;
|
|
5194
|
-
if (!table) {
|
|
5195
|
-
return null;
|
|
5196
|
-
}
|
|
5197
|
-
const categories = chartData.categories;
|
|
5198
|
-
const series = chartData.series;
|
|
5199
|
-
if (categories.length === 0 && series.length === 0) {
|
|
5200
|
-
return null;
|
|
5201
|
-
}
|
|
5202
|
-
const borderColor = "#cbd5e1";
|
|
5203
|
-
const showH = table.showHorzBorder !== false;
|
|
5204
|
-
const showV = table.showVertBorder !== false;
|
|
5205
|
-
const showO = table.showOutline !== false;
|
|
5206
|
-
const showK = table.showKeys !== false;
|
|
5207
|
-
const borderStyle = `1px solid ${borderColor}`;
|
|
5208
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5209
|
-
"div",
|
|
5210
|
-
{
|
|
5211
|
-
style: {
|
|
5212
|
-
width: svgWidth,
|
|
5213
|
-
overflow: "hidden",
|
|
5214
|
-
fontSize: 8,
|
|
5215
|
-
lineHeight: "14px",
|
|
5216
|
-
color: "#334155",
|
|
5217
|
-
pointerEvents: "none"
|
|
5218
|
-
},
|
|
5219
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5220
|
-
"table",
|
|
5221
|
-
{
|
|
5222
|
-
style: {
|
|
5223
|
-
width: "100%",
|
|
5224
|
-
borderCollapse: "collapse",
|
|
5225
|
-
border: showO ? borderStyle : "none"
|
|
5226
|
-
},
|
|
5227
|
-
children: [
|
|
5228
|
-
/* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
5229
|
-
showK && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5230
|
-
"th",
|
|
5231
|
-
{
|
|
5232
|
-
"aria-label": chunkRTUGI4HQ_js.translationsEn["pptx.chart.rowLabelsAria"],
|
|
5233
|
-
style: {
|
|
5234
|
-
padding: "1px 4px",
|
|
5235
|
-
fontWeight: 400,
|
|
5236
|
-
borderBottom: showH ? borderStyle : "none",
|
|
5237
|
-
borderRight: showV ? borderStyle : "none",
|
|
5238
|
-
textAlign: "left"
|
|
5239
|
-
}
|
|
5240
|
-
}
|
|
5241
|
-
),
|
|
5242
|
-
categories.map((cat, ci) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5243
|
-
"th",
|
|
5244
|
-
{
|
|
5245
|
-
style: {
|
|
5246
|
-
padding: "1px 4px",
|
|
5247
|
-
fontWeight: 600,
|
|
5248
|
-
borderBottom: showH ? borderStyle : "none",
|
|
5249
|
-
borderRight: showV && ci < categories.length - 1 ? borderStyle : "none",
|
|
5250
|
-
textAlign: "center"
|
|
5251
|
-
},
|
|
5252
|
-
children: cat
|
|
5253
|
-
},
|
|
5254
|
-
`${elementId}-dtable-h-${ci}`
|
|
5255
|
-
))
|
|
5256
|
-
] }) }),
|
|
5257
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { children: series.map((s, si) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
5258
|
-
showK && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5259
|
-
"td",
|
|
5260
|
-
{
|
|
5261
|
-
style: {
|
|
5262
|
-
padding: "1px 4px",
|
|
5263
|
-
borderBottom: showH && si < series.length - 1 ? borderStyle : "none",
|
|
5264
|
-
borderRight: showV ? borderStyle : "none",
|
|
5265
|
-
whiteSpace: "nowrap"
|
|
5266
|
-
},
|
|
5267
|
-
children: [
|
|
5268
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5269
|
-
"span",
|
|
5270
|
-
{
|
|
5271
|
-
style: {
|
|
5272
|
-
display: "inline-block",
|
|
5273
|
-
width: 8,
|
|
5274
|
-
height: 8,
|
|
5275
|
-
borderRadius: 2,
|
|
5276
|
-
backgroundColor: chunkWVDM36ZM_js.seriesColor(
|
|
5277
|
-
s,
|
|
5278
|
-
si,
|
|
5279
|
-
chartData.style?.styleId,
|
|
5280
|
-
chartData.colorPalette
|
|
5281
|
-
),
|
|
5282
|
-
marginRight: 4,
|
|
5283
|
-
verticalAlign: "middle"
|
|
5284
|
-
}
|
|
5285
|
-
}
|
|
5286
|
-
),
|
|
5287
|
-
s.name
|
|
5288
|
-
]
|
|
5289
|
-
}
|
|
5290
|
-
),
|
|
5291
|
-
categories.map((_cat, ci) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5292
|
-
"td",
|
|
5293
|
-
{
|
|
5294
|
-
style: {
|
|
5295
|
-
padding: "1px 4px",
|
|
5296
|
-
textAlign: "center",
|
|
5297
|
-
borderBottom: showH && si < series.length - 1 ? borderStyle : "none",
|
|
5298
|
-
borderRight: showV && ci < categories.length - 1 ? borderStyle : "none"
|
|
5299
|
-
},
|
|
5300
|
-
children: s.values[ci] !== void 0 ? formatValue(s.values[ci]) : ""
|
|
5301
|
-
},
|
|
5302
|
-
`${elementId}-dtable-c-${si}-${ci}`
|
|
5303
|
-
))
|
|
5304
|
-
] }, `${elementId}-dtable-r-${si}`)) })
|
|
5305
|
-
]
|
|
5306
|
-
}
|
|
5307
|
-
)
|
|
5308
|
-
},
|
|
5309
|
-
`${elementId}-dtable`
|
|
5310
|
-
);
|
|
5311
|
-
}
|
|
5312
|
-
function renderStockChart(element, chartData, categoryLabels) {
|
|
5313
|
-
const style = chartData.style;
|
|
5314
|
-
const areaFill = chunkWVDM36ZM_js.chartAreaFill(chartData);
|
|
5315
|
-
const legendPos = style?.legendPosition || "b";
|
|
5316
|
-
const range = chunkWVDM36ZM_js.computeValueRangeForChart(chartData.series, chartData.axes);
|
|
5317
|
-
const layout = chunkWVDM36ZM_js.computeLayout(element.width, element.height, style, true, legendPos);
|
|
5318
|
-
const catCount = Math.max(categoryLabels.length, 1);
|
|
5319
|
-
const barGroupWidth = layout.plotWidth / catCount;
|
|
5320
|
-
const candleWidth = barGroupWidth * 0.5;
|
|
5321
|
-
const hasFour = chartData.series.length >= 4;
|
|
5322
|
-
const openSeries = hasFour ? chartData.series[0] : void 0;
|
|
5323
|
-
const highSeries = chartData.series[hasFour ? 1 : 0];
|
|
5324
|
-
const lowSeries = chartData.series[hasFour ? 2 : 1];
|
|
5325
|
-
const closeSeries = chartData.series[hasFour ? 3 : 2];
|
|
5326
|
-
if (!highSeries || !lowSeries || !closeSeries) {
|
|
5327
|
-
return null;
|
|
5328
|
-
}
|
|
5329
|
-
const elements = [];
|
|
5330
|
-
const dlElements = [];
|
|
5331
|
-
for (let ci = 0; ci < catCount; ci++) {
|
|
5332
|
-
const high = highSeries.values[ci] ?? 0;
|
|
5333
|
-
const low = lowSeries.values[ci] ?? 0;
|
|
5334
|
-
const open = openSeries?.values[ci] ?? low;
|
|
5335
|
-
const close = closeSeries.values[ci] ?? high;
|
|
5336
|
-
const isUp = close >= open;
|
|
5337
|
-
const cx = layout.plotLeft + barGroupWidth * ci + barGroupWidth / 2;
|
|
5338
|
-
const highY = chunkWVDM36ZM_js.valueToY(high, range, layout.plotTop, layout.plotBottom);
|
|
5339
|
-
const lowY = chunkWVDM36ZM_js.valueToY(low, range, layout.plotTop, layout.plotBottom);
|
|
5340
|
-
const openY = chunkWVDM36ZM_js.valueToY(open, range, layout.plotTop, layout.plotBottom);
|
|
5341
|
-
const closeY = chunkWVDM36ZM_js.valueToY(close, range, layout.plotTop, layout.plotBottom);
|
|
5342
|
-
elements.push(
|
|
5343
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5344
|
-
"line",
|
|
5345
|
-
{
|
|
5346
|
-
x1: cx,
|
|
5347
|
-
y1: highY,
|
|
5348
|
-
x2: cx,
|
|
5349
|
-
y2: lowY,
|
|
5350
|
-
stroke: "#334155",
|
|
5351
|
-
strokeWidth: 1
|
|
5352
|
-
},
|
|
5353
|
-
`${element.id}-stock-wick-${ci}`
|
|
5354
|
-
)
|
|
5355
|
-
);
|
|
5356
|
-
const bodyTop = Math.min(openY, closeY);
|
|
5357
|
-
const bodyHeight = Math.max(Math.abs(openY - closeY), 1);
|
|
5358
|
-
elements.push(
|
|
5359
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5360
|
-
"rect",
|
|
5361
|
-
{
|
|
5362
|
-
x: cx - candleWidth / 2,
|
|
5363
|
-
y: bodyTop,
|
|
5364
|
-
width: candleWidth,
|
|
5365
|
-
height: bodyHeight,
|
|
5366
|
-
fill: isUp ? "#22c55e" : "#ef4444",
|
|
5367
|
-
stroke: isUp ? "#16a34a" : "#dc2626",
|
|
5368
|
-
strokeWidth: 0.5,
|
|
5369
|
-
rx: 1
|
|
5370
|
-
},
|
|
5371
|
-
`${element.id}-stock-body-${ci}`
|
|
5372
|
-
)
|
|
5373
|
-
);
|
|
5374
|
-
if (style?.hasDataLabels) {
|
|
5375
|
-
dlElements.push(
|
|
5376
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5377
|
-
"text",
|
|
5378
|
-
{
|
|
5379
|
-
x: cx,
|
|
5380
|
-
y: highY - 4,
|
|
5381
|
-
textAnchor: "middle",
|
|
5382
|
-
fontSize: 7,
|
|
5383
|
-
fill: "#334155",
|
|
5384
|
-
children: chunkWVDM36ZM_js.formatAxisValue(close)
|
|
5385
|
-
},
|
|
5386
|
-
`${element.id}-stock-dl-${ci}`
|
|
5387
|
-
)
|
|
5388
|
-
);
|
|
5389
|
-
}
|
|
5390
|
-
}
|
|
5391
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5392
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
5393
|
-
"svg",
|
|
5394
|
-
{
|
|
5395
|
-
className: "w-full h-full pointer-events-none",
|
|
5396
|
-
viewBox: `0 0 ${layout.svgWidth} ${layout.svgHeight}`,
|
|
5397
|
-
preserveAspectRatio: "none",
|
|
5398
|
-
children: [
|
|
5399
|
-
areaFill && /* @__PURE__ */ jsxRuntime.jsx("rect", { x: 0, y: 0, width: layout.svgWidth, height: layout.svgHeight, fill: areaFill }),
|
|
5400
|
-
renderChrome(element.id, chartData, layout, range, categoryLabels, {
|
|
5401
|
-
categoryAxisStyle: "bar"
|
|
5402
|
-
}),
|
|
5403
|
-
elements,
|
|
5404
|
-
dlElements,
|
|
5405
|
-
renderOverlays(element.id, chartData, layout, range)
|
|
5406
|
-
]
|
|
5407
|
-
}
|
|
5408
|
-
),
|
|
5409
|
-
renderChartDataTable(element.id, chartData, layout.svgWidth)
|
|
5410
|
-
] });
|
|
5411
|
-
}
|
|
5412
|
-
|
|
5413
|
-
// src/viewer/utils/chart-sunburst-funnel.tsx
|
|
5414
|
-
function renderSunburstChart(element, _chartData, _categoryLabels) {
|
|
5415
|
-
return renderChartViewModel(element.id, buildReactChartViewModel(element));
|
|
5416
|
-
}
|
|
5417
|
-
function renderFunnelChart(element, _chartData, _categoryLabels) {
|
|
5418
|
-
return renderChartViewModel(element.id, buildReactChartViewModel(element));
|
|
5419
|
-
}
|
|
5420
|
-
function FailedToLoad() {
|
|
5421
|
-
return null;
|
|
5422
|
-
}
|
|
5423
|
-
var LazySurfaceChart3DScene = React6__default.default.lazy(
|
|
5424
|
-
async () => {
|
|
5425
|
-
try {
|
|
5426
|
-
return await import('./SurfaceChart3DScene-ACPKCWLJ.js');
|
|
5427
|
-
} catch {
|
|
5428
|
-
return { default: FailedToLoad };
|
|
5429
|
-
}
|
|
5430
|
-
}
|
|
5431
|
-
);
|
|
5432
|
-
var SurfaceChart3DErrorBoundary = class extends React6__default.default.Component {
|
|
5433
|
-
constructor(props) {
|
|
5434
|
-
super(props);
|
|
5435
|
-
this.state = { hasError: false };
|
|
5436
|
-
}
|
|
5437
|
-
static getDerivedStateFromError() {
|
|
5438
|
-
return { hasError: true };
|
|
5439
|
-
}
|
|
5440
|
-
render() {
|
|
5441
|
-
if (this.state.hasError) {
|
|
5442
|
-
return this.props.fallback;
|
|
5443
|
-
}
|
|
5444
|
-
return this.props.children;
|
|
5445
|
-
}
|
|
5446
|
-
};
|
|
5447
|
-
function buildSurfaceData(chartData, categoryLabels) {
|
|
5448
|
-
const rows = chartData.series.length;
|
|
5449
|
-
const cols = Math.max(categoryLabels.length, 1);
|
|
5450
|
-
const range = chunkWVDM36ZM_js.computeValueRangeForChart(chartData.series, chartData.axes);
|
|
5451
|
-
const heightMap = new Float32Array(rows * cols);
|
|
5452
|
-
const colorMap = new Float32Array(rows * cols * 3);
|
|
5453
|
-
for (let r = 0; r < rows; r++) {
|
|
5454
|
-
const series = chartData.series[r];
|
|
5455
|
-
for (let c = 0; c < cols; c++) {
|
|
5456
|
-
const val = series?.values[c] ?? 0;
|
|
5457
|
-
const t = range.span > 0 ? (val - range.min) / range.span : 0;
|
|
5458
|
-
const idx = r * cols + c;
|
|
5459
|
-
heightMap[idx] = t;
|
|
5460
|
-
const { r: cr, g: cg, b: cb } = surfaceColor(t);
|
|
5461
|
-
colorMap[idx * 3] = cr / 255;
|
|
5462
|
-
colorMap[idx * 3 + 1] = cg / 255;
|
|
5463
|
-
colorMap[idx * 3 + 2] = cb / 255;
|
|
5464
|
-
}
|
|
5465
|
-
}
|
|
5466
|
-
return { heightMap, colorMap, rows, cols };
|
|
5467
|
-
}
|
|
5468
|
-
function LoadingPlaceholder({ width, height }) {
|
|
5469
|
-
const { t } = reactI18next.useTranslation();
|
|
5470
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5471
|
-
"div",
|
|
5472
|
-
{
|
|
5473
|
-
style: {
|
|
5474
|
-
width,
|
|
5475
|
-
height,
|
|
5476
|
-
display: "flex",
|
|
5477
|
-
alignItems: "center",
|
|
5478
|
-
justifyContent: "center",
|
|
5479
|
-
background: "#f8fafc",
|
|
5480
|
-
border: "1px dashed #cbd5e1",
|
|
5481
|
-
borderRadius: 4,
|
|
5482
|
-
fontSize: 11,
|
|
5483
|
-
color: "#94a3b8"
|
|
5484
|
-
},
|
|
5485
|
-
children: t("pptx.chart.loading3dSurface")
|
|
5486
|
-
}
|
|
5487
|
-
);
|
|
5488
|
-
}
|
|
5489
|
-
var SurfaceChart3D = React6__default.default.memo(
|
|
5490
|
-
({ element, chartData, categoryLabels, fallback }) => {
|
|
5491
|
-
const [threeAvailable, setThreeAvailable] = React6.useState(null);
|
|
5492
|
-
React6.useEffect(() => {
|
|
5493
|
-
let cancelled = false;
|
|
5494
|
-
import('./three.module-GNNNRIMK.js').then(() => {
|
|
5495
|
-
if (!cancelled) {
|
|
5496
|
-
setThreeAvailable(true);
|
|
5497
|
-
}
|
|
5498
|
-
return void 0;
|
|
5499
|
-
}).catch(() => {
|
|
5500
|
-
if (!cancelled) {
|
|
5501
|
-
setThreeAvailable(false);
|
|
5502
|
-
}
|
|
5503
|
-
});
|
|
5504
|
-
return () => {
|
|
5505
|
-
cancelled = true;
|
|
5506
|
-
};
|
|
5507
|
-
}, []);
|
|
5508
|
-
const surfaceData = React6.useMemo(
|
|
5509
|
-
() => buildSurfaceData(chartData, categoryLabels),
|
|
5510
|
-
[chartData, categoryLabels]
|
|
5511
|
-
);
|
|
5512
|
-
const seriesNames = React6.useMemo(() => chartData.series.map((s) => s.name), [chartData.series]);
|
|
5513
|
-
if (threeAvailable === null) {
|
|
5514
|
-
return /* @__PURE__ */ jsxRuntime.jsx(LoadingPlaceholder, { width: element.width, height: element.height });
|
|
5515
|
-
}
|
|
5516
|
-
if (!threeAvailable) {
|
|
5517
|
-
return fallback;
|
|
5518
|
-
}
|
|
5519
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SurfaceChart3DErrorBoundary, { fallback, children: /* @__PURE__ */ jsxRuntime.jsx(React6.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(LoadingPlaceholder, { width: element.width, height: element.height }), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5520
|
-
LazySurfaceChart3DScene,
|
|
5521
|
-
{
|
|
5522
|
-
cols: surfaceData.cols,
|
|
5523
|
-
rows: surfaceData.rows,
|
|
5524
|
-
heightMap: surfaceData.heightMap,
|
|
5525
|
-
colorMap: surfaceData.colorMap,
|
|
5526
|
-
wireframe: true,
|
|
5527
|
-
categoryLabels,
|
|
5528
|
-
seriesNames,
|
|
5529
|
-
title: chartData.title,
|
|
5530
|
-
width: element.width,
|
|
5531
|
-
height: element.height
|
|
5532
|
-
}
|
|
5533
|
-
) }) });
|
|
5534
|
-
}
|
|
5535
|
-
);
|
|
5536
|
-
SurfaceChart3D.displayName = "SurfaceChart3D";
|
|
5537
|
-
var ISO_COS30 = Math.cos(Math.PI / 6);
|
|
5538
|
-
var ISO_SIN30 = Math.sin(Math.PI / 6);
|
|
5539
|
-
function isoProject(x, y, z) {
|
|
5540
|
-
return {
|
|
5541
|
-
screenX: (x - y) * ISO_COS30,
|
|
5542
|
-
screenY: (x + y) * ISO_SIN30 - z
|
|
5543
|
-
};
|
|
5544
|
-
}
|
|
5545
|
-
function surfaceColor(t) {
|
|
5546
|
-
return {
|
|
5547
|
-
r: Math.round(30 + 200 * t),
|
|
5548
|
-
g: Math.round(80 + 100 * (1 - Math.abs(t - 0.5) * 2)),
|
|
5549
|
-
b: Math.round(200 * (1 - t) + 30)
|
|
5550
|
-
};
|
|
5551
|
-
}
|
|
5552
|
-
function isoCellVertices(col, row, cellSize, zScale, getValue) {
|
|
5553
|
-
const corners = [
|
|
5554
|
-
[col, row],
|
|
5555
|
-
[col + 1, row],
|
|
5556
|
-
[col + 1, row + 1],
|
|
5557
|
-
[col, row + 1]
|
|
5558
|
-
];
|
|
5559
|
-
return corners.map(([c, r]) => {
|
|
5560
|
-
const val = getValue(r, c);
|
|
5561
|
-
return isoProject(c * cellSize, r * cellSize, val * zScale);
|
|
5562
|
-
});
|
|
5563
|
-
}
|
|
5564
|
-
function darkenRgb(r, g, b, factor) {
|
|
5565
|
-
return `rgb(${Math.round(r * factor)},${Math.round(g * factor)},${Math.round(b * factor)})`;
|
|
5566
|
-
}
|
|
5567
|
-
function renderIsometricSurfaceChart(element, chartData, categoryLabels) {
|
|
5568
|
-
const style = chartData.style;
|
|
5569
|
-
const areaFill = chunkWVDM36ZM_js.chartAreaFill(chartData);
|
|
5570
|
-
const legendPos = style?.legendPosition || "b";
|
|
5571
|
-
const layout = chunkWVDM36ZM_js.computeLayout(element.width, element.height, style, false, legendPos);
|
|
5572
|
-
const range = chunkWVDM36ZM_js.computeValueRangeForChart(chartData.series, chartData.axes);
|
|
5573
|
-
const catCount = Math.max(categoryLabels.length, 1);
|
|
5574
|
-
const seriesCount = chartData.series.length;
|
|
5575
|
-
const cols = catCount - 1;
|
|
5576
|
-
const rows = seriesCount - 1;
|
|
5577
|
-
const gridSpan = cols + rows;
|
|
5578
|
-
const baseHeightBudget = layout.plotHeight * 0.65;
|
|
5579
|
-
const widthBudget = layout.plotWidth * 0.9;
|
|
5580
|
-
const cellByWidth = widthBudget / (gridSpan * ISO_COS30);
|
|
5581
|
-
const cellByHeight = baseHeightBudget / (gridSpan * ISO_SIN30);
|
|
5582
|
-
const cellSize = Math.min(cellByWidth, cellByHeight);
|
|
5583
|
-
const zHeadroom = layout.plotHeight * 0.3;
|
|
5584
|
-
const zScale = range.span > 0 ? zHeadroom : 0;
|
|
5585
|
-
const normValue = (r, c) => {
|
|
5586
|
-
const ri = Math.min(r, seriesCount - 1);
|
|
5587
|
-
const ci = Math.min(c, catCount - 1);
|
|
5588
|
-
const val = chartData.series[ri]?.values[ci] ?? 0;
|
|
5589
|
-
return range.span > 0 ? (val - range.min) / range.span : 0;
|
|
5590
|
-
};
|
|
5591
|
-
const allProjected = [];
|
|
5592
|
-
for (let r = 0; r <= rows; r++) {
|
|
5593
|
-
for (let c = 0; c <= cols; c++) {
|
|
5594
|
-
const nv = normValue(r, c);
|
|
5595
|
-
allProjected.push(isoProject(c * cellSize, r * cellSize, nv * zScale));
|
|
5596
|
-
}
|
|
5597
|
-
}
|
|
5598
|
-
const minSX = Math.min(...allProjected.map((p) => p.screenX));
|
|
5599
|
-
const maxSX = Math.max(...allProjected.map((p) => p.screenX));
|
|
5600
|
-
const minSY = Math.min(...allProjected.map((p) => p.screenY));
|
|
5601
|
-
const maxSY = Math.max(...allProjected.map((p) => p.screenY));
|
|
5602
|
-
const projW = maxSX - minSX;
|
|
5603
|
-
const projH = maxSY - minSY;
|
|
5604
|
-
const offsetX = layout.plotLeft + layout.plotWidth / 2 - (minSX + projW / 2);
|
|
5605
|
-
const offsetY = layout.plotTop + layout.plotHeight / 2 - (minSY + projH / 2);
|
|
5606
|
-
const cellEntries = [];
|
|
5607
|
-
for (let r = 0; r < rows; r++) {
|
|
5608
|
-
for (let c = 0; c < cols; c++) {
|
|
5609
|
-
cellEntries.push({ row: r, col: c, depth: r + c });
|
|
5610
|
-
}
|
|
5611
|
-
}
|
|
5612
|
-
cellEntries.sort((a, b) => a.depth - b.depth);
|
|
5613
|
-
const polygons = [];
|
|
5614
|
-
for (const { row, col } of cellEntries) {
|
|
5615
|
-
const verts = isoCellVertices(col, row, cellSize, zScale, normValue);
|
|
5616
|
-
const avgT = (normValue(row, col) + normValue(row, col + 1) + normValue(row + 1, col + 1) + normValue(row + 1, col)) / 4;
|
|
5617
|
-
const { r, g, b } = surfaceColor(avgT);
|
|
5618
|
-
const points = verts.map((v) => `${(v.screenX + offsetX).toFixed(2)},${(v.screenY + offsetY).toFixed(2)}`).join(" ");
|
|
5619
|
-
polygons.push(
|
|
5620
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5621
|
-
"polygon",
|
|
5622
|
-
{
|
|
5623
|
-
points,
|
|
5624
|
-
fill: `rgb(${r},${g},${b})`,
|
|
5625
|
-
opacity: 0.9
|
|
5626
|
-
},
|
|
5627
|
-
`${element.id}-iso-${row}-${col}`
|
|
5628
|
-
)
|
|
5629
|
-
);
|
|
5630
|
-
polygons.push(
|
|
5631
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5632
|
-
"polygon",
|
|
5633
|
-
{
|
|
5634
|
-
points,
|
|
5635
|
-
fill: "none",
|
|
5636
|
-
stroke: darkenRgb(r, g, b, 0.6),
|
|
5637
|
-
strokeWidth: 0.5,
|
|
5638
|
-
opacity: 0.7
|
|
5639
|
-
},
|
|
5640
|
-
`${element.id}-iso-edge-${row}-${col}`
|
|
5641
|
-
)
|
|
5642
|
-
);
|
|
5643
|
-
}
|
|
5644
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5645
|
-
"svg",
|
|
5646
|
-
{
|
|
5647
|
-
className: "w-full h-full pointer-events-none",
|
|
5648
|
-
viewBox: `0 0 ${layout.svgWidth} ${layout.svgHeight}`,
|
|
5649
|
-
preserveAspectRatio: "xMidYMid meet",
|
|
5650
|
-
children: [
|
|
5651
|
-
areaFill && /* @__PURE__ */ jsxRuntime.jsx("rect", { x: 0, y: 0, width: layout.svgWidth, height: layout.svgHeight, fill: areaFill }),
|
|
5652
|
-
renderTitle(element.id, style, chartData.title, layout.svgWidth),
|
|
5653
|
-
renderLegend(element.id, style, chartData.series, layout),
|
|
5654
|
-
polygons
|
|
5655
|
-
]
|
|
5656
|
-
}
|
|
5657
|
-
);
|
|
5658
|
-
}
|
|
5659
|
-
function renderFlatSurfaceChart(element, chartData, categoryLabels) {
|
|
5660
|
-
const style = chartData.style;
|
|
5661
|
-
const areaFill = chunkWVDM36ZM_js.chartAreaFill(chartData);
|
|
5662
|
-
const legendPos = style?.legendPosition || "b";
|
|
5663
|
-
const layout = chunkWVDM36ZM_js.computeLayout(element.width, element.height, style, true, legendPos);
|
|
5664
|
-
const range = chunkWVDM36ZM_js.computeValueRangeForChart(chartData.series, chartData.axes);
|
|
5665
|
-
const catCount = Math.max(categoryLabels.length, 1);
|
|
5666
|
-
const seriesCount = chartData.series.length;
|
|
5667
|
-
const cellW = layout.plotWidth / Math.max(catCount - 1, 1);
|
|
5668
|
-
const cellH = layout.plotHeight / Math.max(seriesCount - 1, 1);
|
|
5669
|
-
const cells = [];
|
|
5670
|
-
for (let si = 0; si < seriesCount; si++) {
|
|
5671
|
-
for (let ci = 0; ci < catCount; ci++) {
|
|
5672
|
-
const val = chartData.series[si].values[ci] ?? 0;
|
|
5673
|
-
const t = range.span > 0 ? (val - range.min) / range.span : 0;
|
|
5674
|
-
const { r, g, b } = surfaceColor(t);
|
|
5675
|
-
cells.push(
|
|
5676
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5677
|
-
"rect",
|
|
5678
|
-
{
|
|
5679
|
-
x: layout.plotLeft + ci * cellW,
|
|
5680
|
-
y: layout.plotTop + si * cellH,
|
|
5681
|
-
width: cellW + 0.5,
|
|
5682
|
-
height: cellH + 0.5,
|
|
5683
|
-
fill: `rgb(${r},${g},${b})`,
|
|
5684
|
-
opacity: 0.85
|
|
5685
|
-
},
|
|
5686
|
-
`${element.id}-surf-${si}-${ci}`
|
|
5687
|
-
)
|
|
5688
|
-
);
|
|
5689
|
-
}
|
|
5690
|
-
}
|
|
5691
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5692
|
-
"svg",
|
|
5693
|
-
{
|
|
5694
|
-
className: "w-full h-full pointer-events-none",
|
|
5695
|
-
viewBox: `0 0 ${layout.svgWidth} ${layout.svgHeight}`,
|
|
5696
|
-
preserveAspectRatio: "none",
|
|
5697
|
-
children: [
|
|
5698
|
-
areaFill && /* @__PURE__ */ jsxRuntime.jsx("rect", { x: 0, y: 0, width: layout.svgWidth, height: layout.svgHeight, fill: areaFill }),
|
|
5699
|
-
renderChrome(element.id, chartData, layout, range, categoryLabels, {
|
|
5700
|
-
categoryAxisStyle: "bar"
|
|
5701
|
-
}),
|
|
5702
|
-
cells
|
|
5703
|
-
]
|
|
5704
|
-
}
|
|
5705
|
-
);
|
|
5706
|
-
}
|
|
5707
|
-
function renderSurfaceChart(element, chartData, categoryLabels) {
|
|
5708
|
-
const catCount = Math.max(categoryLabels.length, 1);
|
|
5709
|
-
const seriesCount = chartData.series.length;
|
|
5710
|
-
if (seriesCount >= 2 && catCount >= 2) {
|
|
5711
|
-
const svgFallback = renderIsometricSurfaceChart(element, chartData, categoryLabels);
|
|
5712
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5713
|
-
SurfaceChart3D,
|
|
5714
|
-
{
|
|
5715
|
-
element,
|
|
5716
|
-
chartData,
|
|
5717
|
-
categoryLabels,
|
|
5718
|
-
fallback: svgFallback
|
|
5719
|
-
}
|
|
5720
|
-
);
|
|
5721
|
-
}
|
|
5722
|
-
return renderFlatSurfaceChart(element, chartData, categoryLabels);
|
|
5723
|
-
}
|
|
5724
|
-
function renderTreemapChart(element, chartData, categoryLabels) {
|
|
5725
|
-
const style = chartData.style;
|
|
5726
|
-
const areaFill = chunkWVDM36ZM_js.chartAreaFill(chartData);
|
|
5727
|
-
const legendPos = style?.legendPosition || "b";
|
|
5728
|
-
const layout = chunkWVDM36ZM_js.computeLayout(element.width, element.height, style, false, legendPos);
|
|
5729
|
-
const allValues = chartData.series.flatMap((s) => s.values);
|
|
5730
|
-
const totalAbs = allValues.reduce((sum, v) => sum + Math.abs(v), 0) || 1;
|
|
5731
|
-
const rects = [];
|
|
5732
|
-
let curX = layout.plotLeft;
|
|
5733
|
-
let curY = layout.plotTop;
|
|
5734
|
-
let remainW = layout.plotWidth;
|
|
5735
|
-
let remainH = layout.plotHeight;
|
|
5736
|
-
const remaining = allValues.map((v, i) => ({ value: Math.abs(v), index: i })).sort((a, b) => b.value - a.value);
|
|
5737
|
-
let remainTotal = totalAbs;
|
|
5738
|
-
remaining.forEach((item) => {
|
|
5739
|
-
const fraction = remainTotal > 0 ? item.value / remainTotal : 0;
|
|
5740
|
-
const useWidth = remainW >= remainH;
|
|
5741
|
-
const w = useWidth ? remainW * fraction : remainW;
|
|
5742
|
-
const h = useWidth ? remainH : remainH * fraction;
|
|
5743
|
-
rects.push(
|
|
5744
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5745
|
-
"rect",
|
|
5746
|
-
{
|
|
5747
|
-
x: curX,
|
|
5748
|
-
y: curY,
|
|
5749
|
-
width: Math.max(w - 1, 1),
|
|
5750
|
-
height: Math.max(h - 1, 1),
|
|
5751
|
-
fill: chunkWVDM36ZM_js.paletteColor(item.index, chartData.style?.styleId, chartData.colorPalette),
|
|
5752
|
-
rx: 2,
|
|
5753
|
-
opacity: 0.85
|
|
5754
|
-
},
|
|
5755
|
-
`${element.id}-tm-${item.index}`
|
|
5756
|
-
)
|
|
5757
|
-
);
|
|
5758
|
-
const label2 = categoryLabels[item.index] ?? `${item.index + 1}`;
|
|
5759
|
-
if (w > 30 && h > 14) {
|
|
5760
|
-
rects.push(
|
|
5761
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5762
|
-
"text",
|
|
5763
|
-
{
|
|
5764
|
-
x: curX + Math.max(w - 1, 1) / 2,
|
|
5765
|
-
y: curY + Math.max(h - 1, 1) / 2 + 4,
|
|
5766
|
-
textAnchor: "middle",
|
|
5767
|
-
fontSize: Math.min(10, h * 0.3),
|
|
5768
|
-
fill: "#fff",
|
|
5769
|
-
fontWeight: 600,
|
|
5770
|
-
children: label2
|
|
5771
|
-
},
|
|
5772
|
-
`${element.id}-tm-lbl-${item.index}`
|
|
5773
|
-
)
|
|
5774
|
-
);
|
|
5775
|
-
}
|
|
5776
|
-
if (useWidth) {
|
|
5777
|
-
curX += w;
|
|
5778
|
-
remainW -= w;
|
|
5779
|
-
} else {
|
|
5780
|
-
curY += h;
|
|
5781
|
-
remainH -= h;
|
|
5782
|
-
}
|
|
5783
|
-
remainTotal -= item.value;
|
|
5784
|
-
});
|
|
5785
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5786
|
-
"svg",
|
|
5787
|
-
{
|
|
5788
|
-
className: "w-full h-full pointer-events-none",
|
|
5789
|
-
viewBox: `0 0 ${layout.svgWidth} ${layout.svgHeight}`,
|
|
5790
|
-
preserveAspectRatio: "none",
|
|
5791
|
-
children: [
|
|
5792
|
-
areaFill && /* @__PURE__ */ jsxRuntime.jsx("rect", { x: 0, y: 0, width: layout.svgWidth, height: layout.svgHeight, fill: areaFill }),
|
|
5793
|
-
renderTitle(element.id, style, chartData.title, layout.svgWidth),
|
|
5794
|
-
renderLegend(element.id, style, chartData.series, layout),
|
|
5795
|
-
rects
|
|
5796
|
-
]
|
|
5797
|
-
}
|
|
5798
|
-
);
|
|
5799
|
-
}
|
|
5800
|
-
function renderWaterfallChart(element, chartData, categoryLabels) {
|
|
5801
|
-
const style = chartData.style;
|
|
5802
|
-
const areaFill = chunkWVDM36ZM_js.chartAreaFill(chartData);
|
|
5803
|
-
const legendPos = style?.legendPosition || "b";
|
|
5804
|
-
const values = chartData.series[0]?.values ?? [];
|
|
5805
|
-
const range = chunkWVDM36ZM_js.computeValueRangeForChart(chartData.series, chartData.axes);
|
|
5806
|
-
const layout = chunkWVDM36ZM_js.computeLayout(element.width, element.height, style, true, legendPos);
|
|
5807
|
-
const catCount = Math.max(categoryLabels.length, values.length, 1);
|
|
5808
|
-
const barWidth = layout.plotWidth / catCount * 0.6;
|
|
5809
|
-
const gap = layout.plotWidth / catCount * 0.2;
|
|
5810
|
-
let runningTotal = 0;
|
|
5811
|
-
const bars = [];
|
|
5812
|
-
const dataLabels = [];
|
|
5813
|
-
values.forEach((val, i) => {
|
|
5814
|
-
const isLast = i === values.length - 1;
|
|
5815
|
-
const startVal = isLast ? 0 : runningTotal;
|
|
5816
|
-
const endVal = isLast ? runningTotal + val : runningTotal + val;
|
|
5817
|
-
const barStartY = chunkWVDM36ZM_js.valueToY(startVal, range, layout.plotTop, layout.plotBottom);
|
|
5818
|
-
const barEndY = chunkWVDM36ZM_js.valueToY(endVal, range, layout.plotTop, layout.plotBottom);
|
|
5819
|
-
const x = layout.plotLeft + layout.plotWidth / catCount * i + gap;
|
|
5820
|
-
const y = Math.min(barStartY, barEndY);
|
|
5821
|
-
const h = Math.max(Math.abs(barEndY - barStartY), 1);
|
|
5822
|
-
const barColor = isLast ? "#6366f1" : val >= 0 ? "#22c55e" : "#ef4444";
|
|
5823
|
-
bars.push(
|
|
5824
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5825
|
-
"rect",
|
|
5826
|
-
{
|
|
5827
|
-
x,
|
|
5828
|
-
y,
|
|
5829
|
-
width: barWidth,
|
|
5830
|
-
height: h,
|
|
5831
|
-
fill: barColor,
|
|
5832
|
-
rx: 1
|
|
5833
|
-
},
|
|
5834
|
-
`${element.id}-wf-bar-${i}`
|
|
5835
|
-
)
|
|
5836
|
-
);
|
|
5837
|
-
if (style?.hasDataLabels) {
|
|
5838
|
-
dataLabels.push(
|
|
5839
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5840
|
-
"text",
|
|
5841
|
-
{
|
|
5842
|
-
x: x + barWidth / 2,
|
|
5843
|
-
y: y - 4,
|
|
5844
|
-
textAnchor: "middle",
|
|
5845
|
-
fontSize: 7,
|
|
5846
|
-
fill: "#334155",
|
|
5847
|
-
children: chunkWVDM36ZM_js.formatAxisValue(isLast ? endVal : val)
|
|
5848
|
-
},
|
|
5849
|
-
`${element.id}-wf-dl-${i}`
|
|
5850
|
-
)
|
|
5851
|
-
);
|
|
5852
|
-
}
|
|
5853
|
-
if (!isLast && i < values.length - 1) {
|
|
5854
|
-
const nextX = layout.plotLeft + layout.plotWidth / catCount * (i + 1) + gap;
|
|
5855
|
-
bars.push(
|
|
5856
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5857
|
-
"line",
|
|
5858
|
-
{
|
|
5859
|
-
x1: x + barWidth,
|
|
5860
|
-
y1: barEndY,
|
|
5861
|
-
x2: nextX,
|
|
5862
|
-
y2: barEndY,
|
|
5863
|
-
stroke: "#94a3b8",
|
|
5864
|
-
strokeWidth: 0.8,
|
|
5865
|
-
strokeDasharray: "3 2"
|
|
5866
|
-
},
|
|
5867
|
-
`${element.id}-wf-conn-${i}`
|
|
5868
|
-
)
|
|
5869
|
-
);
|
|
5870
|
-
}
|
|
5871
|
-
if (!isLast) {
|
|
5872
|
-
runningTotal += val;
|
|
5873
|
-
}
|
|
5874
|
-
});
|
|
5875
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5876
|
-
"svg",
|
|
5877
|
-
{
|
|
5878
|
-
className: "w-full h-full pointer-events-none",
|
|
5879
|
-
viewBox: `0 0 ${layout.svgWidth} ${layout.svgHeight}`,
|
|
5880
|
-
preserveAspectRatio: "none",
|
|
5881
|
-
children: [
|
|
5882
|
-
areaFill && /* @__PURE__ */ jsxRuntime.jsx("rect", { x: 0, y: 0, width: layout.svgWidth, height: layout.svgHeight, fill: areaFill }),
|
|
5883
|
-
renderChrome(element.id, chartData, layout, range, categoryLabels, {
|
|
5884
|
-
categoryAxisStyle: "bar"
|
|
5885
|
-
}),
|
|
5886
|
-
bars,
|
|
5887
|
-
dataLabels
|
|
5888
|
-
]
|
|
5889
|
-
}
|
|
5890
|
-
);
|
|
5891
|
-
}
|
|
5892
|
-
function renderComboChart(element, chartData, categoryLabels) {
|
|
5893
|
-
const style = chartData.style;
|
|
5894
|
-
const areaFill = chunkWVDM36ZM_js.chartAreaFill(chartData);
|
|
5895
|
-
const legendPos = style?.legendPosition || "b";
|
|
5896
|
-
const layoutOpts = chunkWVDM36ZM_js.computeLayoutOptions(
|
|
5897
|
-
chartData.axes,
|
|
5898
|
-
chartData.dataTable,
|
|
5899
|
-
chartData.series.length
|
|
5900
|
-
);
|
|
5901
|
-
const layout = chunkWVDM36ZM_js.computeLayout(element.width, element.height, style, true, legendPos, layoutOpts);
|
|
5902
|
-
const { primary, secondary } = chunkWVDM36ZM_js.splitSeriesByAxis(chartData.series, chartData.axes);
|
|
5903
|
-
const primarySeries = primary.length > 0 ? primary.map((e) => e.series) : chartData.series;
|
|
5904
|
-
const secondarySeries = secondary.map((e) => e.series);
|
|
5905
|
-
const range = chunkWVDM36ZM_js.computeValueRangeForChart(primarySeries, chartData.axes);
|
|
5906
|
-
const secondaryRange = secondarySeries.length > 0 ? chunkWVDM36ZM_js.computeValueRange(secondarySeries) : void 0;
|
|
5907
|
-
const secondaryAxisFmt = chunkWVDM36ZM_js.getSecondaryValueAxis(chartData.axes);
|
|
5908
|
-
const catCount = Math.max(categoryLabels.length, 1);
|
|
5909
|
-
const barSeriesCount = 1;
|
|
5910
|
-
const barGroupWidth = layout.plotWidth / catCount;
|
|
5911
|
-
const barWidth = barGroupWidth * 0.5;
|
|
5912
|
-
const barOffset = (barGroupWidth - barWidth) / 2;
|
|
5913
|
-
const barSeries = chartData.series[0];
|
|
5914
|
-
const lineSeries = chartData.series.slice(1);
|
|
5915
|
-
const barElements = [];
|
|
5916
|
-
const lineElements = [];
|
|
5917
|
-
const dlElements = [];
|
|
5918
|
-
if (barSeries) {
|
|
5919
|
-
const isBarSecondary = secondary.some((e) => e.index === 0);
|
|
5920
|
-
const barRange = isBarSecondary && secondaryRange ? secondaryRange : range;
|
|
5921
|
-
barSeries.values.forEach((val, vi) => {
|
|
5922
|
-
const x = layout.plotLeft + barGroupWidth * vi + barOffset;
|
|
5923
|
-
const zeroY = chunkWVDM36ZM_js.valueToY(0, barRange, layout.plotTop, layout.plotBottom);
|
|
5924
|
-
const valY = chunkWVDM36ZM_js.valueToY(val, barRange, layout.plotTop, layout.plotBottom);
|
|
5925
|
-
const y = Math.min(zeroY, valY);
|
|
5926
|
-
const h = Math.max(Math.abs(zeroY - valY), 1);
|
|
5927
|
-
barElements.push(
|
|
5928
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5929
|
-
"rect",
|
|
5930
|
-
{
|
|
5931
|
-
x,
|
|
5932
|
-
y,
|
|
5933
|
-
width: barWidth,
|
|
5934
|
-
height: h,
|
|
5935
|
-
fill: chunkWVDM36ZM_js.seriesColor(barSeries, 0, chartData.style?.styleId, chartData.colorPalette),
|
|
5936
|
-
rx: 1
|
|
5937
|
-
},
|
|
5938
|
-
`${element.id}-combo-bar-${vi}`
|
|
5939
|
-
)
|
|
5940
|
-
);
|
|
5941
|
-
if (style?.hasDataLabels) {
|
|
5942
|
-
dlElements.push(
|
|
5943
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5944
|
-
"text",
|
|
5945
|
-
{
|
|
5946
|
-
x: x + barWidth / 2,
|
|
5947
|
-
y: val >= 0 ? y - 4 : y + h + 10,
|
|
5948
|
-
textAnchor: "middle",
|
|
5949
|
-
fontSize: 7,
|
|
5950
|
-
fill: "#334155",
|
|
5951
|
-
children: chunkWVDM36ZM_js.formatAxisValue(val)
|
|
5952
|
-
},
|
|
5953
|
-
`${element.id}-combo-bar-dl-${vi}`
|
|
5954
|
-
)
|
|
5955
|
-
);
|
|
5956
|
-
}
|
|
5957
|
-
});
|
|
5958
|
-
}
|
|
5959
|
-
lineSeries.forEach((series, si) => {
|
|
5960
|
-
if (series.values.length === 0) {
|
|
5961
|
-
return;
|
|
5962
|
-
}
|
|
5963
|
-
const seriesIdx = si + barSeriesCount;
|
|
5964
|
-
const isSecondary = secondary.some((e) => e.index === seriesIdx);
|
|
5965
|
-
const activeRange = isSecondary && secondaryRange ? secondaryRange : range;
|
|
5966
|
-
const points = series.values.map((val, vi) => {
|
|
5967
|
-
const x = layout.plotLeft + barGroupWidth * vi + barGroupWidth / 2;
|
|
5968
|
-
const y = chunkWVDM36ZM_js.valueToY(val, activeRange, layout.plotTop, layout.plotBottom);
|
|
5969
|
-
return { x, y, val };
|
|
5970
|
-
});
|
|
5971
|
-
const c = chunkWVDM36ZM_js.seriesColor(series, seriesIdx, chartData.style?.styleId, chartData.colorPalette);
|
|
5972
|
-
lineElements.push(
|
|
5973
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5974
|
-
"polyline",
|
|
5975
|
-
{
|
|
5976
|
-
fill: "none",
|
|
5977
|
-
stroke: c,
|
|
5978
|
-
strokeWidth: 2.4,
|
|
5979
|
-
points: points.map((p) => `${p.x},${p.y}`).join(" ")
|
|
5980
|
-
},
|
|
5981
|
-
`${element.id}-combo-line-${si}`
|
|
5982
|
-
)
|
|
5983
|
-
);
|
|
5984
|
-
points.forEach((p, vi) => {
|
|
5985
|
-
lineElements.push(
|
|
5986
|
-
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: p.x, cy: p.y, r: 2.5, fill: c }, `${element.id}-combo-dot-${si}-${vi}`)
|
|
5987
|
-
);
|
|
5988
|
-
if (style?.hasDataLabels) {
|
|
5989
|
-
dlElements.push(
|
|
5990
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5991
|
-
"text",
|
|
5992
|
-
{
|
|
5993
|
-
x: p.x,
|
|
5994
|
-
y: p.y - 7,
|
|
5995
|
-
textAnchor: "middle",
|
|
5996
|
-
fontSize: 7,
|
|
5997
|
-
fill: "#334155",
|
|
5998
|
-
children: chunkWVDM36ZM_js.formatAxisValue(p.val)
|
|
5999
|
-
},
|
|
6000
|
-
`${element.id}-combo-line-dl-${si}-${vi}`
|
|
6001
|
-
)
|
|
6002
|
-
);
|
|
6003
|
-
}
|
|
6004
|
-
});
|
|
6005
|
-
});
|
|
6006
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6007
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
6008
|
-
"svg",
|
|
6009
|
-
{
|
|
6010
|
-
className: "w-full h-full pointer-events-none",
|
|
6011
|
-
viewBox: `0 0 ${layout.svgWidth} ${layout.svgHeight}`,
|
|
6012
|
-
preserveAspectRatio: "none",
|
|
6013
|
-
children: [
|
|
6014
|
-
areaFill && /* @__PURE__ */ jsxRuntime.jsx("rect", { x: 0, y: 0, width: layout.svgWidth, height: layout.svgHeight, fill: areaFill }),
|
|
6015
|
-
renderChrome(
|
|
6016
|
-
element.id,
|
|
6017
|
-
chartData,
|
|
6018
|
-
layout,
|
|
6019
|
-
range,
|
|
6020
|
-
categoryLabels,
|
|
6021
|
-
{ categoryAxisStyle: "bar" },
|
|
6022
|
-
secondaryRange ? { secondaryRange, secondaryAxisFormatting: secondaryAxisFmt } : void 0
|
|
6023
|
-
),
|
|
6024
|
-
barElements,
|
|
6025
|
-
lineElements,
|
|
6026
|
-
dlElements,
|
|
6027
|
-
renderOverlays(element.id, chartData, layout, range)
|
|
6028
|
-
]
|
|
6029
|
-
}
|
|
6030
|
-
),
|
|
6031
|
-
renderChartDataTable(element.id, chartData, layout.svgWidth)
|
|
6032
|
-
] });
|
|
6033
|
-
}
|
|
6034
|
-
function renderChartElement(element) {
|
|
6035
|
-
if (element.type !== "chart") {
|
|
6036
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center text-[11px] text-white/80 pointer-events-none", children: chunkRTUGI4HQ_js.translationsEn["pptx.chart.heading"] });
|
|
6037
|
-
}
|
|
6038
|
-
const chartData = element.chartData;
|
|
6039
|
-
if (!chartData || chartData.series.length === 0) {
|
|
6040
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center text-[11px] text-white/80 pointer-events-none", children: chunkRTUGI4HQ_js.translationsEn["pptx.chart.heading"] });
|
|
6041
|
-
}
|
|
6042
|
-
const longestSeriesLength = chartData.series.reduce(
|
|
6043
|
-
(maxLength, series) => Math.max(maxLength, series.values.length),
|
|
6044
|
-
0
|
|
6045
|
-
);
|
|
6046
|
-
const categoryLabels = chartData.categories.length > 0 ? chartData.categories : Array.from({ length: longestSeriesLength }, (_, index) => String(index + 1));
|
|
6047
|
-
const chartType = chartData.chartType ?? "bar";
|
|
6048
|
-
if (chartType === "pie" || chartType === "doughnut" || chartType === "pie3D" || chartType === "ofPie") {
|
|
6049
|
-
return renderPieChart(element);
|
|
6050
|
-
}
|
|
6051
|
-
if (chartType === "scatter") {
|
|
6052
|
-
return renderScatterChart(element);
|
|
6053
|
-
}
|
|
6054
|
-
if (chartType === "bubble") {
|
|
6055
|
-
return renderBubbleChart(element);
|
|
6056
|
-
}
|
|
6057
|
-
if (chartType === "radar") {
|
|
6058
|
-
return renderRadarChart(element);
|
|
6059
|
-
}
|
|
6060
|
-
if (chartType === "stock") {
|
|
6061
|
-
return renderStockChart(element, chartData, categoryLabels);
|
|
6062
|
-
}
|
|
6063
|
-
if (chartType === "area" || chartType === "area3D") {
|
|
6064
|
-
return renderAreaChart(element);
|
|
6065
|
-
}
|
|
6066
|
-
if (chartType === "line" || chartType === "line3D") {
|
|
6067
|
-
return renderLineChart(element);
|
|
6068
|
-
}
|
|
6069
|
-
if (chartType === "waterfall") {
|
|
6070
|
-
return renderWaterfallChart(element, chartData, categoryLabels);
|
|
6071
|
-
}
|
|
6072
|
-
if (chartType === "combo") {
|
|
6073
|
-
return renderComboChart(element, chartData, categoryLabels);
|
|
6074
|
-
}
|
|
6075
|
-
if (chartType === "bar" && (chartData.grouping === "stacked" || chartData.grouping === "percentStacked")) {
|
|
6076
|
-
return renderStackedBarChart(element);
|
|
6077
|
-
}
|
|
6078
|
-
if (chartType === "surface") {
|
|
6079
|
-
return renderSurfaceChart(element, chartData, categoryLabels);
|
|
6080
|
-
}
|
|
6081
|
-
if (chartType === "treemap") {
|
|
6082
|
-
return renderTreemapChart(element, chartData, categoryLabels);
|
|
6083
|
-
}
|
|
6084
|
-
if (chartType === "sunburst") {
|
|
6085
|
-
return renderSunburstChart(element);
|
|
6086
|
-
}
|
|
6087
|
-
if (chartType === "funnel") {
|
|
6088
|
-
return renderFunnelChart(element);
|
|
6089
|
-
}
|
|
6090
|
-
if (chartType === "boxWhisker") {
|
|
6091
|
-
return renderBoxWhiskerChart(element);
|
|
6092
|
-
}
|
|
6093
|
-
if (chartType === "histogram") {
|
|
6094
|
-
return renderHistogramChart(element);
|
|
6095
|
-
}
|
|
6096
|
-
if (chartType === "regionMap") {
|
|
6097
|
-
return renderMapChart(element, chartData, categoryLabels);
|
|
6098
|
-
}
|
|
6099
|
-
return renderDefaultBarChart(element);
|
|
6100
|
-
}
|
|
6101
|
-
|
|
6102
3874
|
// src/viewer/utils/pdf-builder-notes-builder.ts
|
|
6103
3875
|
function buildNotesPdf(pages) {
|
|
6104
3876
|
const images = pages.map((page) => {
|
|
@@ -6115,14 +3887,14 @@ function buildNotesPdf(pages) {
|
|
|
6115
3887
|
notes: page.notes,
|
|
6116
3888
|
slideNumber: page.slideNumber
|
|
6117
3889
|
}));
|
|
6118
|
-
const bytes =
|
|
3890
|
+
const bytes = chunkT7BIRNE4_js.buildNotesPdfBytes(images, meta);
|
|
6119
3891
|
const blob = new Blob([bytes], { type: "application/pdf" });
|
|
6120
3892
|
return URL.createObjectURL(blob);
|
|
6121
3893
|
}
|
|
6122
3894
|
|
|
6123
3895
|
// src/viewer/utils/pdf-builder-slides.ts
|
|
6124
3896
|
function buildPdfFromImageData(images) {
|
|
6125
|
-
const bytes =
|
|
3897
|
+
const bytes = chunkT7BIRNE4_js.buildSlidesPdfBytes(images);
|
|
6126
3898
|
const blob = new Blob([bytes], { type: "application/pdf" });
|
|
6127
3899
|
return URL.createObjectURL(blob);
|
|
6128
3900
|
}
|
|
@@ -6131,7 +3903,7 @@ function buildPdfFromImageData(images) {
|
|
|
6131
3903
|
var activePreview = null;
|
|
6132
3904
|
function startPreviewAnimation(elementId, preset, options) {
|
|
6133
3905
|
stopPreviewAnimation();
|
|
6134
|
-
const descriptor =
|
|
3906
|
+
const descriptor = chunkT7BIRNE4_js.buildPreviewAnimation(preset, options);
|
|
6135
3907
|
if (!descriptor) {
|
|
6136
3908
|
return;
|
|
6137
3909
|
}
|
|
@@ -6144,7 +3916,7 @@ function startMotionPathPreview(elementId, path, options) {
|
|
|
6144
3916
|
return;
|
|
6145
3917
|
}
|
|
6146
3918
|
const stage = domEl.offsetParent;
|
|
6147
|
-
const descriptor =
|
|
3919
|
+
const descriptor = chunkT7BIRNE4_js.buildMotionPathPreview({
|
|
6148
3920
|
path,
|
|
6149
3921
|
slideWidth: stage?.offsetWidth || DEFAULT_PREVIEW_SLIDE_WIDTH,
|
|
6150
3922
|
slideHeight: stage?.offsetHeight || DEFAULT_PREVIEW_SLIDE_HEIGHT,
|