ooxml-core 1.26.0 → 1.26.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/dist/{PptxHandler-5QBRBXRX.mjs → PptxHandler-64BZOBWX.mjs} +2 -2
- package/dist/{PptxHandler-CVYP5PAN.cjs → PptxHandler-AILFLRH7.cjs} +2 -2
- package/dist/{PptxHandler-TOAD6P7N.mjs → PptxHandler-PMLQGMFQ.mjs} +1 -1
- package/dist/{PresentationBuilder-EBVNYMLE.mjs → PresentationBuilder-EJY2TYWL.mjs} +1 -1
- package/dist/{PresentationBuilder-M5UXW4AF.mjs → PresentationBuilder-HBCCO2CF.mjs} +2 -2
- package/dist/{PresentationBuilder-RVQZCTIO.cjs → PresentationBuilder-RBQP6A37.cjs} +4 -4
- package/dist/{chunk-EBJ724RB.mjs → chunk-DHAZSMC7.mjs} +1 -1
- package/dist/{chunk-4IIR2QEH.mjs → chunk-FZBAMWCJ.mjs} +181 -172
- package/dist/{chunk-EEHK52XB.cjs → chunk-NXTHB2M3.cjs} +180 -171
- package/dist/{chunk-KONCS53X.mjs → chunk-OQPT5IC3.mjs} +4 -4
- package/dist/{chunk-K6OFJ5GJ.mjs → chunk-OTXJVFMY.mjs} +180 -171
- package/dist/{chunk-DNYZX6YG.mjs → chunk-R7RL7W43.mjs} +1 -1
- package/dist/{chunk-ZXPPM63Y.mjs → chunk-WRFMS5CL.mjs} +1 -1
- package/dist/pptx/automation/index.cjs +188 -178
- package/dist/pptx/automation/index.d.ts +3 -3
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{index-D3gKRIAi.d.ts → index-CbFowkp4.d.ts} +3 -3
- package/dist/pptx/chunks/{index-D3gKRIAi.d.ts.map → index-CbFowkp4.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-BOpULlxB.d.ts → index-D4FnOx6x.d.ts} +2 -2
- package/dist/pptx/chunks/{index-BOpULlxB.d.ts.map → index-D4FnOx6x.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-B94RKk84.d.ts → index-D8DNpc1X.d.ts} +14 -4
- package/dist/pptx/chunks/{index-B94RKk84.d.ts.map → index-D8DNpc1X.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +188 -178
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/find-replace.d.ts +1 -1
- package/dist/pptx/editor/render/slide-operations.cjs +1 -1
- package/dist/pptx/editor/render/slide-operations.mjs +1 -1
- package/dist/pptx/index.cjs +188 -178
- package/dist/pptx/index.d.ts +3 -3
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/node/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -50518,6 +50518,152 @@ function applyCommonViewContainer(root, name, props) {
|
|
|
50518
50518
|
root[key2] = container;
|
|
50519
50519
|
}
|
|
50520
50520
|
|
|
50521
|
+
// pptx/core/core/runtime/chart-part-registration.ts
|
|
50522
|
+
var CHART_GRAPHIC_DATA_URI = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
50523
|
+
var CHART_EX_GRAPHIC_DATA_URI = "http://schemas.microsoft.com/office/drawing/2014/chartex";
|
|
50524
|
+
var NS_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
50525
|
+
function asArray3(value) {
|
|
50526
|
+
if (value === void 0 || value === null) {
|
|
50527
|
+
return [];
|
|
50528
|
+
}
|
|
50529
|
+
return (Array.isArray(value) ? value : [value]).filter(
|
|
50530
|
+
(entry2) => Boolean(entry2) && typeof entry2 === "object"
|
|
50531
|
+
);
|
|
50532
|
+
}
|
|
50533
|
+
function nextFreeChartPartPath(zip, directory) {
|
|
50534
|
+
let n = 1;
|
|
50535
|
+
while (zip.file(`${directory}/chart${n}.xml`)) {
|
|
50536
|
+
n += 1;
|
|
50537
|
+
}
|
|
50538
|
+
return `${directory}/chart${n}.xml`;
|
|
50539
|
+
}
|
|
50540
|
+
function resolvePartTarget(fromPart, target) {
|
|
50541
|
+
if (target.startsWith("/")) {
|
|
50542
|
+
return target.slice(1);
|
|
50543
|
+
}
|
|
50544
|
+
const segments = fromPart.split("/").slice(0, -1);
|
|
50545
|
+
for (const segment of target.split("/")) {
|
|
50546
|
+
if (segment === "..") {
|
|
50547
|
+
segments.pop();
|
|
50548
|
+
} else if (segment !== "." && segment !== "") {
|
|
50549
|
+
segments.push(segment);
|
|
50550
|
+
}
|
|
50551
|
+
}
|
|
50552
|
+
return segments.join("/");
|
|
50553
|
+
}
|
|
50554
|
+
function relativePartTarget2(fromPart, toPart) {
|
|
50555
|
+
const from = fromPart.split("/").slice(0, -1);
|
|
50556
|
+
const to = toPart.split("/");
|
|
50557
|
+
let common = 0;
|
|
50558
|
+
while (common < from.length && common < to.length - 1 && from[common] === to[common]) {
|
|
50559
|
+
common += 1;
|
|
50560
|
+
}
|
|
50561
|
+
return [...from.slice(common).map(() => ".."), ...to.slice(common)].join("/");
|
|
50562
|
+
}
|
|
50563
|
+
async function ensureContentTypeOverride2(deps, partPath, contentType) {
|
|
50564
|
+
const xml = await deps.zip.file("[Content_Types].xml")?.async("string");
|
|
50565
|
+
if (!xml) {
|
|
50566
|
+
return;
|
|
50567
|
+
}
|
|
50568
|
+
const tree = deps.parser.parse(xml);
|
|
50569
|
+
const types = tree["Types"] ?? {};
|
|
50570
|
+
const overrides = asArray3(types["Override"]);
|
|
50571
|
+
const partName = `/${partPath}`;
|
|
50572
|
+
if (overrides.some((entry2) => String(entry2["@_PartName"]) === partName)) {
|
|
50573
|
+
return;
|
|
50574
|
+
}
|
|
50575
|
+
overrides.push({ "@_PartName": partName, "@_ContentType": contentType });
|
|
50576
|
+
types["Override"] = overrides;
|
|
50577
|
+
tree["Types"] = types;
|
|
50578
|
+
deps.zip.file("[Content_Types].xml", deps.builder.build(tree));
|
|
50579
|
+
}
|
|
50580
|
+
async function rewriteChartRelationship(deps, slidePath, rewrite) {
|
|
50581
|
+
const slash = slidePath.lastIndexOf("/");
|
|
50582
|
+
const relsPath2 = `${slidePath.slice(0, slash + 1)}_rels/${slidePath.slice(slash + 1)}.rels`;
|
|
50583
|
+
const xml = await deps.zip.file(relsPath2)?.async("string");
|
|
50584
|
+
if (!xml) {
|
|
50585
|
+
return void 0;
|
|
50586
|
+
}
|
|
50587
|
+
const tree = deps.parser.parse(xml);
|
|
50588
|
+
const root = tree["Relationships"];
|
|
50589
|
+
const relationships2 = asArray3(root?.["Relationship"]);
|
|
50590
|
+
const match = relationships2.find((rel) => String(rel["@_Id"]) === rewrite.relationshipId) ?? relationships2.find(
|
|
50591
|
+
(rel) => resolvePartTarget(slidePath, String(rel["@_Target"] ?? "")) === rewrite.oldPartPath
|
|
50592
|
+
);
|
|
50593
|
+
if (!match || !root) {
|
|
50594
|
+
return void 0;
|
|
50595
|
+
}
|
|
50596
|
+
match["@_Type"] = rewrite.relationshipType;
|
|
50597
|
+
match["@_Target"] = relativePartTarget2(slidePath, rewrite.newPartPath);
|
|
50598
|
+
delete match["@_TargetMode"];
|
|
50599
|
+
root["Relationship"] = relationships2.length === 1 ? relationships2[0] : relationships2;
|
|
50600
|
+
deps.zip.file(relsPath2, deps.builder.build(tree));
|
|
50601
|
+
return String(match["@_Id"]);
|
|
50602
|
+
}
|
|
50603
|
+
function rebindGraphicData(node, relationshipId, extended) {
|
|
50604
|
+
for (const key2 of Object.keys(node)) {
|
|
50605
|
+
delete node[key2];
|
|
50606
|
+
}
|
|
50607
|
+
node["@_uri"] = extended ? CHART_EX_GRAPHIC_DATA_URI : CHART_GRAPHIC_DATA_URI;
|
|
50608
|
+
if (extended) {
|
|
50609
|
+
node["cx:chart"] = {
|
|
50610
|
+
"@_xmlns:cx": CHART_EX_GRAPHIC_DATA_URI,
|
|
50611
|
+
"@_xmlns:r": NS_R,
|
|
50612
|
+
"@_r:id": relationshipId
|
|
50613
|
+
};
|
|
50614
|
+
} else {
|
|
50615
|
+
node["c:chart"] = {
|
|
50616
|
+
"@_xmlns:c": CHART_GRAPHIC_DATA_URI,
|
|
50617
|
+
"@_xmlns:r": NS_R,
|
|
50618
|
+
"@_r:id": relationshipId
|
|
50619
|
+
};
|
|
50620
|
+
}
|
|
50621
|
+
}
|
|
50622
|
+
function visitGraphicData(node, relationshipId, extended, getLocalName2) {
|
|
50623
|
+
if (!node || typeof node !== "object") {
|
|
50624
|
+
return 0;
|
|
50625
|
+
}
|
|
50626
|
+
if (Array.isArray(node)) {
|
|
50627
|
+
return node.reduce(
|
|
50628
|
+
(count2, entry2) => count2 + visitGraphicData(entry2, relationshipId, extended, getLocalName2),
|
|
50629
|
+
0
|
|
50630
|
+
);
|
|
50631
|
+
}
|
|
50632
|
+
const object = node;
|
|
50633
|
+
let count = 0;
|
|
50634
|
+
for (const key2 of Object.keys(object)) {
|
|
50635
|
+
if (key2.startsWith("@_")) {
|
|
50636
|
+
continue;
|
|
50637
|
+
}
|
|
50638
|
+
const value = object[key2];
|
|
50639
|
+
if (getLocalName2(key2) === "graphicData" && value && typeof value === "object") {
|
|
50640
|
+
for (const candidate of asArray3(value)) {
|
|
50641
|
+
const chartKey = Object.keys(candidate).find((k) => getLocalName2(k) === "chart");
|
|
50642
|
+
const chart = chartKey ? candidate[chartKey] : void 0;
|
|
50643
|
+
if (chart && String(chart["@_r:id"]) === relationshipId) {
|
|
50644
|
+
rebindGraphicData(candidate, relationshipId, extended);
|
|
50645
|
+
count += 1;
|
|
50646
|
+
}
|
|
50647
|
+
}
|
|
50648
|
+
continue;
|
|
50649
|
+
}
|
|
50650
|
+
count += visitGraphicData(value, relationshipId, extended, getLocalName2);
|
|
50651
|
+
}
|
|
50652
|
+
return count;
|
|
50653
|
+
}
|
|
50654
|
+
async function rewriteChartGraphicFrames(deps, slidePath, relationshipId, extended) {
|
|
50655
|
+
const xml = await deps.zip.file(slidePath)?.async("string");
|
|
50656
|
+
if (!xml) {
|
|
50657
|
+
return 0;
|
|
50658
|
+
}
|
|
50659
|
+
const tree = deps.parser.parse(xml);
|
|
50660
|
+
const count = visitGraphicData(tree, relationshipId, extended, deps.getLocalName);
|
|
50661
|
+
if (count > 0) {
|
|
50662
|
+
deps.zip.file(slidePath, deps.builder.build(tree));
|
|
50663
|
+
}
|
|
50664
|
+
return count;
|
|
50665
|
+
}
|
|
50666
|
+
|
|
50521
50667
|
// pptx/core/utils/chart-color-style-writer.ts
|
|
50522
50668
|
var METHODS = /* @__PURE__ */ new Set(["cycle", "withinLinear", "acrossLinear"]);
|
|
50523
50669
|
var COLOR_NAMES = /* @__PURE__ */ new Set(["scrgbClr", "srgbClr", "hslClr", "sysClr", "schemeClr", "prstClr"]);
|
|
@@ -50587,7 +50733,7 @@ function buildChartExLegend(legendPosition) {
|
|
|
50587
50733
|
// pptx/core/utils/chart-cx-generator.ts
|
|
50588
50734
|
var NS_CX = "http://schemas.microsoft.com/office/drawing/2014/chartex";
|
|
50589
50735
|
var NS_A = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
50590
|
-
var
|
|
50736
|
+
var NS_R2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
50591
50737
|
var NS_C = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
50592
50738
|
function points4(values) {
|
|
50593
50739
|
return values.map((value, index) => ({ "@_idx": String(index), "#text": String(value) }));
|
|
@@ -50782,7 +50928,7 @@ function buildChartExSpaceXml(chartData) {
|
|
|
50782
50928
|
const chartSpace = {
|
|
50783
50929
|
"@_xmlns:cx": NS_CX,
|
|
50784
50930
|
"@_xmlns:a": NS_A,
|
|
50785
|
-
"@_xmlns:r":
|
|
50931
|
+
"@_xmlns:r": NS_R2,
|
|
50786
50932
|
"cx:chartData": {
|
|
50787
50933
|
"cx:data": chartData.series.map(
|
|
50788
50934
|
(series, index) => buildChartExData(chartData, series, index)
|
|
@@ -52345,7 +52491,7 @@ function buildGeneratedSeriesSpPr(series, family) {
|
|
|
52345
52491
|
// pptx/core/utils/chart-xml-generator.ts
|
|
52346
52492
|
var NS_C2 = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
52347
52493
|
var NS_A2 = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
52348
|
-
var
|
|
52494
|
+
var NS_R3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
52349
52495
|
var CAT_AX_ID = 111111111;
|
|
52350
52496
|
var VAL_AX_ID = 222222222;
|
|
52351
52497
|
var SER_AX_ID = 333333333;
|
|
@@ -52551,7 +52697,7 @@ function buildChartSpaceXml(chartData) {
|
|
|
52551
52697
|
"c:chartSpace": {
|
|
52552
52698
|
"@_xmlns:c": NS_C2,
|
|
52553
52699
|
"@_xmlns:a": NS_A2,
|
|
52554
|
-
"@_xmlns:r":
|
|
52700
|
+
"@_xmlns:r": NS_R3,
|
|
52555
52701
|
"c:chart": chart
|
|
52556
52702
|
}
|
|
52557
52703
|
};
|
|
@@ -54600,7 +54746,7 @@ function buildTitleDefRPr(style, existing, resolveColor2) {
|
|
|
54600
54746
|
}
|
|
54601
54747
|
return rPr;
|
|
54602
54748
|
}
|
|
54603
|
-
function
|
|
54749
|
+
function asArray4(value) {
|
|
54604
54750
|
if (Array.isArray(value)) {
|
|
54605
54751
|
return value;
|
|
54606
54752
|
}
|
|
@@ -54619,7 +54765,7 @@ function applyRichTitleFont(title, style, getLocalName2, resolveColor2) {
|
|
|
54619
54765
|
return txKey;
|
|
54620
54766
|
}
|
|
54621
54767
|
const pKey = findKey19(rich, "p", getLocalName2) ?? "a:p";
|
|
54622
|
-
const paragraphs =
|
|
54768
|
+
const paragraphs = asArray4(rich[pKey]).map((para) => {
|
|
54623
54769
|
const next = { ...para };
|
|
54624
54770
|
const pPrKey = findKey19(next, "pPr", getLocalName2) ?? "a:pPr";
|
|
54625
54771
|
const pPr = { ...chunkMU3XSASV_cjs.ensureXmlChildOrCreate(next, pPrKey, "first") };
|
|
@@ -54632,7 +54778,7 @@ function applyRichTitleFont(title, style, getLocalName2, resolveColor2) {
|
|
|
54632
54778
|
next[pPrKey] = pPr;
|
|
54633
54779
|
const rKey = findKey19(next, "r", getLocalName2);
|
|
54634
54780
|
if (rKey) {
|
|
54635
|
-
const runs =
|
|
54781
|
+
const runs = asArray4(next[rKey]).map((run2) => {
|
|
54636
54782
|
const rPrKey = findKey19(run2, "rPr", getLocalName2) ?? "a:rPr";
|
|
54637
54783
|
const existingRPr = run2[rPrKey] ?? {};
|
|
54638
54784
|
const nextRun = { ...run2 };
|
|
@@ -54996,7 +55142,7 @@ function saveChartPartThroughNeutral(xml, before, after) {
|
|
|
54996
55142
|
function findKey20(node, localName15, getLocalName2) {
|
|
54997
55143
|
return Object.keys(node).find((key2) => getLocalName2(key2) === localName15);
|
|
54998
55144
|
}
|
|
54999
|
-
function
|
|
55145
|
+
function asArray5(value) {
|
|
55000
55146
|
if (value === void 0 || value === null) {
|
|
55001
55147
|
return [];
|
|
55002
55148
|
}
|
|
@@ -55010,8 +55156,8 @@ function dimensionType(node) {
|
|
|
55010
55156
|
function replaceLevels(target, source, getLocalName2) {
|
|
55011
55157
|
const targetKey = findKey20(target, "lvl", getLocalName2) ?? "cx:lvl";
|
|
55012
55158
|
const sourceKey = findKey20(source, "lvl", getLocalName2);
|
|
55013
|
-
const oldLevels =
|
|
55014
|
-
const newLevels =
|
|
55159
|
+
const oldLevels = asArray5(target[targetKey]);
|
|
55160
|
+
const newLevels = asArray5(sourceKey ? source[sourceKey] : void 0).map((level, index) => {
|
|
55015
55161
|
const old = oldLevels[index];
|
|
55016
55162
|
if (!old) {
|
|
55017
55163
|
return level;
|
|
@@ -55030,8 +55176,8 @@ function replaceChartExDataDimensions(target, fresh, getLocalName2) {
|
|
|
55030
55176
|
for (const kind of ["strDim", "numDim"]) {
|
|
55031
55177
|
const targetKey = findKey20(target, kind, getLocalName2) ?? `cx:${kind}`;
|
|
55032
55178
|
const freshKey = findKey20(fresh, kind, getLocalName2);
|
|
55033
|
-
const existing =
|
|
55034
|
-
const incoming =
|
|
55179
|
+
const existing = asArray5(target[targetKey]);
|
|
55180
|
+
const incoming = asArray5(freshKey ? fresh[freshKey] : void 0);
|
|
55035
55181
|
for (const dimension of incoming) {
|
|
55036
55182
|
const wantedType = dimensionType(dimension);
|
|
55037
55183
|
let match = existing.find((candidate) => dimensionType(candidate) === wantedType);
|
|
@@ -55065,7 +55211,7 @@ function child13(node, localName15, getLocalName2) {
|
|
|
55065
55211
|
const value = key2 ? node[key2] : void 0;
|
|
55066
55212
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
55067
55213
|
}
|
|
55068
|
-
function
|
|
55214
|
+
function asArray6(value) {
|
|
55069
55215
|
if (value === void 0 || value === null) {
|
|
55070
55216
|
return [];
|
|
55071
55217
|
}
|
|
@@ -55247,7 +55393,7 @@ function chartExLayoutChanged(chartSpace, chartData, getLocalName2) {
|
|
|
55247
55393
|
getLocalName2
|
|
55248
55394
|
);
|
|
55249
55395
|
const seriesKey = region ? findKey21(region, "series", getLocalName2) : void 0;
|
|
55250
|
-
const first2 = region && seriesKey ?
|
|
55396
|
+
const first2 = region && seriesKey ? asArray6(region[seriesKey])[0] : void 0;
|
|
55251
55397
|
const existing = String(first2?.["@_layoutId"] ?? "").toLowerCase();
|
|
55252
55398
|
const series = chartData.series[0];
|
|
55253
55399
|
if (!existing || !series) {
|
|
@@ -55265,9 +55411,9 @@ function applyChartExUpdate(chartSpace, chartData, getLocalName2) {
|
|
|
55265
55411
|
const chartDataKey = findKey21(chartSpace, "chartData", getLocalName2);
|
|
55266
55412
|
const chartDataNode = (chartDataKey ? chartSpace[chartDataKey] : void 0) ?? {};
|
|
55267
55413
|
const dataKey = findKey21(chartDataNode, "data", getLocalName2) ?? "cx:data";
|
|
55268
|
-
const dataNodes =
|
|
55414
|
+
const dataNodes = asArray6(chartDataNode[dataKey]);
|
|
55269
55415
|
const seriesKey = findKey21(region, "series", getLocalName2) ?? "cx:series";
|
|
55270
|
-
const existing =
|
|
55416
|
+
const existing = asArray6(region[seriesKey]);
|
|
55271
55417
|
const updated = [];
|
|
55272
55418
|
chartData.series.forEach((series, index) => {
|
|
55273
55419
|
const node = existing[index];
|
|
@@ -55337,152 +55483,6 @@ async function saveChartExternalWorkbookUpdates(deps, chartPartPath, slidePath,
|
|
|
55337
55483
|
);
|
|
55338
55484
|
}
|
|
55339
55485
|
|
|
55340
|
-
// pptx/core/core/runtime/chart-part-registration.ts
|
|
55341
|
-
var CHART_GRAPHIC_DATA_URI = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
55342
|
-
var CHART_EX_GRAPHIC_DATA_URI = "http://schemas.microsoft.com/office/drawing/2014/chartex";
|
|
55343
|
-
var NS_R3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
55344
|
-
function asArray6(value) {
|
|
55345
|
-
if (value === void 0 || value === null) {
|
|
55346
|
-
return [];
|
|
55347
|
-
}
|
|
55348
|
-
return (Array.isArray(value) ? value : [value]).filter(
|
|
55349
|
-
(entry2) => Boolean(entry2) && typeof entry2 === "object"
|
|
55350
|
-
);
|
|
55351
|
-
}
|
|
55352
|
-
function nextFreeChartPartPath(zip, directory) {
|
|
55353
|
-
let n = 1;
|
|
55354
|
-
while (zip.file(`${directory}/chart${n}.xml`)) {
|
|
55355
|
-
n += 1;
|
|
55356
|
-
}
|
|
55357
|
-
return `${directory}/chart${n}.xml`;
|
|
55358
|
-
}
|
|
55359
|
-
function resolvePartTarget(fromPart, target) {
|
|
55360
|
-
if (target.startsWith("/")) {
|
|
55361
|
-
return target.slice(1);
|
|
55362
|
-
}
|
|
55363
|
-
const segments = fromPart.split("/").slice(0, -1);
|
|
55364
|
-
for (const segment of target.split("/")) {
|
|
55365
|
-
if (segment === "..") {
|
|
55366
|
-
segments.pop();
|
|
55367
|
-
} else if (segment !== "." && segment !== "") {
|
|
55368
|
-
segments.push(segment);
|
|
55369
|
-
}
|
|
55370
|
-
}
|
|
55371
|
-
return segments.join("/");
|
|
55372
|
-
}
|
|
55373
|
-
function relativePartTarget2(fromPart, toPart) {
|
|
55374
|
-
const from = fromPart.split("/").slice(0, -1);
|
|
55375
|
-
const to = toPart.split("/");
|
|
55376
|
-
let common = 0;
|
|
55377
|
-
while (common < from.length && common < to.length - 1 && from[common] === to[common]) {
|
|
55378
|
-
common += 1;
|
|
55379
|
-
}
|
|
55380
|
-
return [...from.slice(common).map(() => ".."), ...to.slice(common)].join("/");
|
|
55381
|
-
}
|
|
55382
|
-
async function ensureContentTypeOverride2(deps, partPath, contentType) {
|
|
55383
|
-
const xml = await deps.zip.file("[Content_Types].xml")?.async("string");
|
|
55384
|
-
if (!xml) {
|
|
55385
|
-
return;
|
|
55386
|
-
}
|
|
55387
|
-
const tree = deps.parser.parse(xml);
|
|
55388
|
-
const types = tree["Types"] ?? {};
|
|
55389
|
-
const overrides = asArray6(types["Override"]);
|
|
55390
|
-
const partName = `/${partPath}`;
|
|
55391
|
-
if (overrides.some((entry2) => String(entry2["@_PartName"]) === partName)) {
|
|
55392
|
-
return;
|
|
55393
|
-
}
|
|
55394
|
-
overrides.push({ "@_PartName": partName, "@_ContentType": contentType });
|
|
55395
|
-
types["Override"] = overrides;
|
|
55396
|
-
tree["Types"] = types;
|
|
55397
|
-
deps.zip.file("[Content_Types].xml", deps.builder.build(tree));
|
|
55398
|
-
}
|
|
55399
|
-
async function rewriteChartRelationship(deps, slidePath, rewrite) {
|
|
55400
|
-
const slash = slidePath.lastIndexOf("/");
|
|
55401
|
-
const relsPath2 = `${slidePath.slice(0, slash + 1)}_rels/${slidePath.slice(slash + 1)}.rels`;
|
|
55402
|
-
const xml = await deps.zip.file(relsPath2)?.async("string");
|
|
55403
|
-
if (!xml) {
|
|
55404
|
-
return void 0;
|
|
55405
|
-
}
|
|
55406
|
-
const tree = deps.parser.parse(xml);
|
|
55407
|
-
const root = tree["Relationships"];
|
|
55408
|
-
const relationships2 = asArray6(root?.["Relationship"]);
|
|
55409
|
-
const match = relationships2.find((rel) => String(rel["@_Id"]) === rewrite.relationshipId) ?? relationships2.find(
|
|
55410
|
-
(rel) => resolvePartTarget(slidePath, String(rel["@_Target"] ?? "")) === rewrite.oldPartPath
|
|
55411
|
-
);
|
|
55412
|
-
if (!match || !root) {
|
|
55413
|
-
return void 0;
|
|
55414
|
-
}
|
|
55415
|
-
match["@_Type"] = rewrite.relationshipType;
|
|
55416
|
-
match["@_Target"] = relativePartTarget2(slidePath, rewrite.newPartPath);
|
|
55417
|
-
delete match["@_TargetMode"];
|
|
55418
|
-
root["Relationship"] = relationships2.length === 1 ? relationships2[0] : relationships2;
|
|
55419
|
-
deps.zip.file(relsPath2, deps.builder.build(tree));
|
|
55420
|
-
return String(match["@_Id"]);
|
|
55421
|
-
}
|
|
55422
|
-
function rebindGraphicData(node, relationshipId, extended) {
|
|
55423
|
-
for (const key2 of Object.keys(node)) {
|
|
55424
|
-
delete node[key2];
|
|
55425
|
-
}
|
|
55426
|
-
node["@_uri"] = extended ? CHART_EX_GRAPHIC_DATA_URI : CHART_GRAPHIC_DATA_URI;
|
|
55427
|
-
if (extended) {
|
|
55428
|
-
node["cx:chart"] = {
|
|
55429
|
-
"@_xmlns:cx": CHART_EX_GRAPHIC_DATA_URI,
|
|
55430
|
-
"@_xmlns:r": NS_R3,
|
|
55431
|
-
"@_r:id": relationshipId
|
|
55432
|
-
};
|
|
55433
|
-
} else {
|
|
55434
|
-
node["c:chart"] = {
|
|
55435
|
-
"@_xmlns:c": CHART_GRAPHIC_DATA_URI,
|
|
55436
|
-
"@_xmlns:r": NS_R3,
|
|
55437
|
-
"@_r:id": relationshipId
|
|
55438
|
-
};
|
|
55439
|
-
}
|
|
55440
|
-
}
|
|
55441
|
-
function visitGraphicData(node, relationshipId, extended, getLocalName2) {
|
|
55442
|
-
if (!node || typeof node !== "object") {
|
|
55443
|
-
return 0;
|
|
55444
|
-
}
|
|
55445
|
-
if (Array.isArray(node)) {
|
|
55446
|
-
return node.reduce(
|
|
55447
|
-
(count2, entry2) => count2 + visitGraphicData(entry2, relationshipId, extended, getLocalName2),
|
|
55448
|
-
0
|
|
55449
|
-
);
|
|
55450
|
-
}
|
|
55451
|
-
const object = node;
|
|
55452
|
-
let count = 0;
|
|
55453
|
-
for (const key2 of Object.keys(object)) {
|
|
55454
|
-
if (key2.startsWith("@_")) {
|
|
55455
|
-
continue;
|
|
55456
|
-
}
|
|
55457
|
-
const value = object[key2];
|
|
55458
|
-
if (getLocalName2(key2) === "graphicData" && value && typeof value === "object") {
|
|
55459
|
-
for (const candidate of asArray6(value)) {
|
|
55460
|
-
const chartKey = Object.keys(candidate).find((k) => getLocalName2(k) === "chart");
|
|
55461
|
-
const chart = chartKey ? candidate[chartKey] : void 0;
|
|
55462
|
-
if (chart && String(chart["@_r:id"]) === relationshipId) {
|
|
55463
|
-
rebindGraphicData(candidate, relationshipId, extended);
|
|
55464
|
-
count += 1;
|
|
55465
|
-
}
|
|
55466
|
-
}
|
|
55467
|
-
continue;
|
|
55468
|
-
}
|
|
55469
|
-
count += visitGraphicData(value, relationshipId, extended, getLocalName2);
|
|
55470
|
-
}
|
|
55471
|
-
return count;
|
|
55472
|
-
}
|
|
55473
|
-
async function rewriteChartGraphicFrames(deps, slidePath, relationshipId, extended) {
|
|
55474
|
-
const xml = await deps.zip.file(slidePath)?.async("string");
|
|
55475
|
-
if (!xml) {
|
|
55476
|
-
return 0;
|
|
55477
|
-
}
|
|
55478
|
-
const tree = deps.parser.parse(xml);
|
|
55479
|
-
const count = visitGraphicData(tree, relationshipId, extended, deps.getLocalName);
|
|
55480
|
-
if (count > 0) {
|
|
55481
|
-
deps.zip.file(slidePath, deps.builder.build(tree));
|
|
55482
|
-
}
|
|
55483
|
-
return count;
|
|
55484
|
-
}
|
|
55485
|
-
|
|
55486
55486
|
// pptx/core/core/runtime/chart-part-family-switch.ts
|
|
55487
55487
|
var CHART_EX_CONTENT_TYPE = "application/vnd.ms-office.chartex+xml";
|
|
55488
55488
|
var CHART_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
|
|
@@ -59313,18 +59313,22 @@ var PptxHandlerRuntime3 = class extends PptxHandlerRuntime2 {
|
|
|
59313
59313
|
* Write or remove a single `a:hlinkClick` / `a:hlinkHover` node on
|
|
59314
59314
|
* a `p:cNvPr` parent.
|
|
59315
59315
|
*/
|
|
59316
|
-
serializeSingleAction(cNvPr, nodeName, action,
|
|
59316
|
+
serializeSingleAction(cNvPr, nodeName, action, links) {
|
|
59317
59317
|
if (!action) {
|
|
59318
59318
|
delete cNvPr[nodeName];
|
|
59319
59319
|
return;
|
|
59320
59320
|
}
|
|
59321
59321
|
const node = {};
|
|
59322
|
+
const url = action.url?.trim() || (/^ppaction:\/\/hlinksldjump\b/iu.test(action.action ?? "") && typeof action.targetSlideIndex === "number" ? links.slideTargetAt?.(action.targetSlideIndex) : void 0);
|
|
59322
59323
|
let rId = action.rId;
|
|
59323
|
-
if (
|
|
59324
|
+
if (rId && url && links.getSlideRelationshipMap().get(rId) !== url) {
|
|
59325
|
+
rId = void 0;
|
|
59326
|
+
}
|
|
59327
|
+
if (!rId && url) {
|
|
59324
59328
|
const forceExternal = /^ppaction:\/\/(program|hlinkfile|hlinkpres)\b/iu.test(
|
|
59325
59329
|
action.action ?? ""
|
|
59326
59330
|
);
|
|
59327
|
-
rId = resolveHyperlinkRelationshipId(
|
|
59331
|
+
rId = links.resolveHyperlinkRelationshipId(url, forceExternal) ?? void 0;
|
|
59328
59332
|
}
|
|
59329
59333
|
node["@_r:id"] = rId ?? "";
|
|
59330
59334
|
if (action.action) {
|
|
@@ -59398,7 +59402,7 @@ var PptxHandlerRuntime3 = class extends PptxHandlerRuntime2 {
|
|
|
59398
59402
|
* the `a:hlinkClick` and `a:hlinkHover` nodes on the element's
|
|
59399
59403
|
* non-visual properties.
|
|
59400
59404
|
*/
|
|
59401
|
-
serializeElementActions(shape, el,
|
|
59405
|
+
serializeElementActions(shape, el, links) {
|
|
59402
59406
|
const key2 = this.getTreeBucketKeyForElementType(el.type);
|
|
59403
59407
|
const cNvPr = this.getCnvPrNode(shape, key2);
|
|
59404
59408
|
if (!cNvPr) {
|
|
@@ -59406,8 +59410,8 @@ var PptxHandlerRuntime3 = class extends PptxHandlerRuntime2 {
|
|
|
59406
59410
|
}
|
|
59407
59411
|
const actionClick = "actionClick" in el ? el.actionClick : void 0;
|
|
59408
59412
|
const actionHover = "actionHover" in el ? el.actionHover : void 0;
|
|
59409
|
-
this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick,
|
|
59410
|
-
this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover,
|
|
59413
|
+
this.serializeSingleAction(cNvPr, "a:hlinkClick", actionClick, links);
|
|
59414
|
+
this.serializeSingleAction(cNvPr, "a:hlinkHover", actionHover, links);
|
|
59411
59415
|
const isDecorative = "isDecorative" in el ? el.isDecorative : void 0;
|
|
59412
59416
|
serializeDecorativeExtension(cNvPr, isDecorative);
|
|
59413
59417
|
}
|
|
@@ -71801,7 +71805,7 @@ var PptxHandlerRuntime41 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
71801
71805
|
if (ctx.connectorShapeIds) {
|
|
71802
71806
|
applyConnectorShapeIds(shape, el, ctx.connectorShapeIds);
|
|
71803
71807
|
}
|
|
71804
|
-
this.serializeElementActions(shape, el, ctx
|
|
71808
|
+
this.serializeElementActions(shape, el, ctx);
|
|
71805
71809
|
this.serializeShapeLocks(shape, el);
|
|
71806
71810
|
this.applyHiddenToCnvPr(shape, el);
|
|
71807
71811
|
this.applyNameToCnvPr(shape, el);
|
|
@@ -72842,7 +72846,7 @@ var PptxHandlerRuntime42 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
72842
72846
|
* Process a single slide during save: update slide XML, process elements,
|
|
72843
72847
|
* rebuild shape tree, and persist relationships.
|
|
72844
72848
|
*/
|
|
72845
|
-
async processSlideForSave(slide, saveSession, constants) {
|
|
72849
|
+
async processSlideForSave(slide, saveSession, constants, slidePaths = []) {
|
|
72846
72850
|
if (this.canSkipSlideSave(slide)) {
|
|
72847
72851
|
return;
|
|
72848
72852
|
}
|
|
@@ -73027,6 +73031,10 @@ var PptxHandlerRuntime42 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
73027
73031
|
slideRelationshipRegistry,
|
|
73028
73032
|
resolveHyperlinkRelationshipId: (target, forceExternal) => slideRelationshipRegistry.resolveHyperlinkRelationshipId(target, forceExternal),
|
|
73029
73033
|
getSlideRelationshipMap: () => slideRelationshipRegistry.toRelationshipMap(),
|
|
73034
|
+
slideTargetAt: (index) => {
|
|
73035
|
+
const target = slidePaths[index];
|
|
73036
|
+
return target ? relativePartTarget2(slide.id, target) : void 0;
|
|
73037
|
+
},
|
|
73030
73038
|
resolvedMediaBytes,
|
|
73031
73039
|
saveSession,
|
|
73032
73040
|
slideImageRelationshipType: constants.slideImageRelationshipType,
|
|
@@ -75251,8 +75259,9 @@ var PptxHandlerRuntime54 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
|
|
|
75251
75259
|
await this.ensureNotesMasterForAuthoredNotes(slides, saveConstants);
|
|
75252
75260
|
await this.ensureHandoutMasterInfrastructure(options?.handoutMaster, saveConstants);
|
|
75253
75261
|
this.templateElementBaselines.beginSave();
|
|
75262
|
+
const slidePaths = slides.map((slide) => slide.id);
|
|
75254
75263
|
for (const slide of slides) {
|
|
75255
|
-
await this.processSlideForSave(slide, saveSession, saveConstants);
|
|
75264
|
+
await this.processSlideForSave(slide, saveSession, saveConstants, slidePaths);
|
|
75256
75265
|
}
|
|
75257
75266
|
this.templateElementBaselines.commitSave();
|
|
75258
75267
|
const contentTypesXml3 = await this.zip.file("[Content_Types].xml")?.async("string");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { findText, replaceText, replaceTextInSlide, mergePresentation } from './chunk-
|
|
2
|
-
import { PresentationBuilder, PptxHandler, SlideBuilder, validateSeriesIndex, removeEmptyDataPoint, ensureDataPoint, ensureChartData, assertChartGradientSupported, toChartGradientFill, isLineDrawnChartType, chartFormatTargetKey, applyChartGroupOptionsInput, countExistingLayouts, addLayoutToSlideMaster, addLayoutContentType, createLayout, STANDARD_LAYOUTS, generateLayoutXml, layoutRelsXml, createTextElement, createShapeElement, createImageElement, createTableElement, createChartElement, createConnectorElement, createMediaElement, createGroupElement, relationshipsPartFor, parseRelationships, resolvePartPath, clonePartGraph, buildRelationshipsXml, buildBlankPresentationArchive, nextRelationshipId, relativePartTarget, PptxXmlBuilder } from './chunk-
|
|
3
|
-
import { EMU_PER_PIXEL, EMU_PER_INCH, parseXml, first, elements, buildXml, bytesToBase64, base64ToBytes, hasTextProperties, escAttr } from './chunk-
|
|
1
|
+
import { findText, replaceText, replaceTextInSlide, mergePresentation } from './chunk-WRFMS5CL.mjs';
|
|
2
|
+
import { PresentationBuilder, PptxHandler, SlideBuilder, validateSeriesIndex, removeEmptyDataPoint, ensureDataPoint, ensureChartData, assertChartGradientSupported, toChartGradientFill, isLineDrawnChartType, chartFormatTargetKey, applyChartGroupOptionsInput, countExistingLayouts, addLayoutToSlideMaster, addLayoutContentType, createLayout, STANDARD_LAYOUTS, generateLayoutXml, layoutRelsXml, createTextElement, createShapeElement, createImageElement, createTableElement, createChartElement, createConnectorElement, createMediaElement, createGroupElement, relationshipsPartFor, parseRelationships, resolvePartPath, clonePartGraph, buildRelationshipsXml, buildBlankPresentationArchive, nextRelationshipId, relativePartTarget, PptxXmlBuilder } from './chunk-FZBAMWCJ.mjs';
|
|
3
|
+
import { EMU_PER_PIXEL, EMU_PER_INCH, parseXml, first, elements, buildXml, bytesToBase64, base64ToBytes, hasTextProperties, escAttr } from './chunk-R7RL7W43.mjs';
|
|
4
4
|
import { openPptxZip } from './chunk-JJ37PCNR.mjs';
|
|
5
5
|
import { cloneSlide, cloneElement } from './chunk-54S5A5PZ.mjs';
|
|
6
6
|
|
|
@@ -14771,7 +14771,7 @@ async function setPresentationRunText(bytes, slideIndex, elementId, runIndex, te
|
|
|
14771
14771
|
async function createPresentationFromOutline(slides, options = {}) {
|
|
14772
14772
|
if (!(slides instanceof Array) || !slides.length || slides.length > 200)
|
|
14773
14773
|
throw new Error("A presentation outline has 1 to 200 slides");
|
|
14774
|
-
const { PresentationBuilder: PresentationBuilder2 } = await import('./PresentationBuilder-
|
|
14774
|
+
const { PresentationBuilder: PresentationBuilder2 } = await import('./PresentationBuilder-HBCCO2CF.mjs');
|
|
14775
14775
|
const { handler, data, createSlide } = await PresentationBuilder2.create({
|
|
14776
14776
|
...options.title ? { title: options.title } : {}
|
|
14777
14777
|
});
|