ooxml-core 1.43.0 → 1.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PptxHandler-V23RDNEX.cjs → PptxHandler-3RDVJFQV.cjs} +2 -2
- package/dist/{PptxHandler-WB3KL2WH.mjs → PptxHandler-EI6DMHPM.mjs} +1 -1
- package/dist/{PptxHandler-3VAVJDFB.mjs → PptxHandler-FXLXIOLT.mjs} +2 -2
- package/dist/{PresentationBuilder-7LJMTRJ6.mjs → PresentationBuilder-3FKFRSSV.mjs} +2 -2
- package/dist/{PresentationBuilder-KHL6GONR.cjs → PresentationBuilder-CSKLG64K.cjs} +4 -4
- package/dist/{PresentationBuilder-PY2GB4IG.mjs → PresentationBuilder-DDYHRV26.mjs} +1 -1
- package/dist/automation/index.cjs +10 -1
- package/dist/automation/index.mjs +10 -1
- package/dist/chart/edit/fill.d.ts +6 -2
- package/dist/chart/edit/fill.d.ts.map +1 -1
- package/dist/chart/index.cjs +12 -3
- package/dist/chart/index.mjs +12 -3
- package/dist/{chunk-HLYOHD2Z.mjs → chunk-CVJX6NNO.mjs} +438 -108
- package/dist/{chunk-243ZYX2B.mjs → chunk-GGJUWJXB.mjs} +1 -1
- package/dist/{chunk-KCDLTVUI.mjs → chunk-GXYK3H4O.mjs} +1 -1
- package/dist/{chunk-WEAWSXUX.mjs → chunk-LCXBTJXE.mjs} +4 -4
- package/dist/{chunk-JHYU7HGG.mjs → chunk-RVYGAYCP.mjs} +1 -1
- package/dist/{chunk-4LEVL6ZW.mjs → chunk-U5BXJQZG.mjs} +457 -105
- package/dist/{chunk-RNZQ2OU4.cjs → chunk-YBSNMVSN.cjs} +437 -107
- package/dist/index.cjs +164 -71
- package/dist/index.mjs +165 -72
- package/dist/opc/declared-fonts.d.ts +9 -0
- package/dist/opc/declared-fonts.d.ts.map +1 -0
- package/dist/opc/index.cjs +84 -0
- package/dist/opc/index.d.ts +1 -0
- package/dist/opc/index.d.ts.map +1 -1
- package/dist/opc/index.mjs +85 -2
- package/dist/pptx/automation/index.cjs +529 -167
- package/dist/pptx/automation/index.d.ts +6 -6
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{elements-PBugbKtv.d.ts → elements-B4Z6N-Gz.d.ts} +4 -477
- package/dist/pptx/chunks/elements-B4Z6N-Gz.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-CCJiD-Bm.d.ts → index-6Ot1b-4U.d.ts} +6 -6
- package/dist/pptx/chunks/{index-CCJiD-Bm.d.ts.map → index-6Ot1b-4U.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-CGNb1TV9.d.ts → index-DGKI80Hj.d.ts} +61 -6
- package/dist/pptx/chunks/{index-CGNb1TV9.d.ts.map → index-DGKI80Hj.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-Bj-hur0D.d.ts → index-jdZUtLGB.d.ts} +4 -4
- package/dist/pptx/chunks/{index-Bj-hur0D.d.ts.map → index-jdZUtLGB.d.ts.map} +1 -1
- package/dist/pptx/chunks/{table-C7ITXL3Y.d.ts → table-BfgZfw5R.d.ts} +488 -4
- package/dist/pptx/chunks/table-BfgZfw5R.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-operations-BNJr7aGa.d.ts → text-operations-Mek86RBL.d.ts} +3 -3
- package/dist/pptx/chunks/{text-operations-BNJr7aGa.d.ts.map → text-operations-Mek86RBL.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +525 -163
- package/dist/pptx/cli/index.d.ts +1 -1
- 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 +2 -2
- package/dist/pptx/editor/render/slide-operations.cjs +1 -1
- package/dist/pptx/editor/render/slide-operations.mjs +1 -1
- package/dist/pptx/editor/render/table-layout.d.ts +1 -1
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts +1 -1
- package/dist/pptx/editor/render/text-style-scope.d.ts +1 -1
- package/dist/pptx/index.cjs +558 -168
- package/dist/pptx/index.d.ts +7 -7
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/node/index.d.ts +1 -1
- package/dist/xlsx/index.cjs +10 -1
- package/dist/xlsx/index.mjs +10 -1
- package/dist/xlsx/ui/index.cjs +50 -6
- package/dist/xlsx/ui/index.mjs +50 -6
- package/dist/xlsx/ui/locales/de/options.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/en/options.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/es/options.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/fr/options.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/zh-CN/options.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/pptx/chunks/elements-PBugbKtv.d.ts.map +0 -1
- package/dist/pptx/chunks/table-C7ITXL3Y.d.ts.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -14811,28 +14811,28 @@ function fillChild(doc, fill) {
|
|
|
14811
14811
|
}
|
|
14812
14812
|
function modelledChildren(doc, value) {
|
|
14813
14813
|
const out = [];
|
|
14814
|
-
const
|
|
14814
|
+
const add3 = (name2, node) => out.push({ name: name2, node });
|
|
14815
14815
|
if (value.line || value.lineSourceXml) {
|
|
14816
14816
|
const ln = value.lineSourceXml ? importDrawingXml(doc, value.lineSourceXml) : drawingElement(doc, "ln");
|
|
14817
14817
|
if (value.line) patchDrawingLine(ln, value.line);
|
|
14818
|
-
|
|
14818
|
+
add3("ln", ln);
|
|
14819
14819
|
}
|
|
14820
14820
|
const fill = fillChild(doc, value.fill);
|
|
14821
14821
|
if (fill) out.push(fill);
|
|
14822
14822
|
if (value.highlight) {
|
|
14823
14823
|
const highlight = drawingElement(doc, "highlight");
|
|
14824
14824
|
highlight.appendChild(importDrawingXml(doc, drawingColorXml(value.highlight)));
|
|
14825
|
-
|
|
14825
|
+
add3("highlight", highlight);
|
|
14826
14826
|
}
|
|
14827
|
-
if (value.underlineLineFollowsText)
|
|
14828
|
-
else if (value.underlineLineXml)
|
|
14829
|
-
if (value.underlineFillFollowsText)
|
|
14827
|
+
if (value.underlineLineFollowsText) add3("uLnTx", drawingElement(doc, "uLnTx"));
|
|
14828
|
+
else if (value.underlineLineXml) add3("uLn", importDrawingXml(doc, value.underlineLineXml));
|
|
14829
|
+
if (value.underlineFillFollowsText) add3("uFillTx", drawingElement(doc, "uFillTx"));
|
|
14830
14830
|
else {
|
|
14831
14831
|
const underline = fillChild(doc, value.underlineFill);
|
|
14832
14832
|
if (underline) {
|
|
14833
14833
|
const uFill = drawingElement(doc, "uFill");
|
|
14834
14834
|
uFill.appendChild(underline.node);
|
|
14835
|
-
|
|
14835
|
+
add3("uFill", uFill);
|
|
14836
14836
|
}
|
|
14837
14837
|
}
|
|
14838
14838
|
for (const [local, key] of [
|
|
@@ -14842,16 +14842,16 @@ function modelledChildren(doc, value) {
|
|
|
14842
14842
|
["sym", "symbol"]
|
|
14843
14843
|
]) {
|
|
14844
14844
|
const font = value[key];
|
|
14845
|
-
if (font)
|
|
14845
|
+
if (font) add3(local, writeDrawingFont(doc, local, font));
|
|
14846
14846
|
}
|
|
14847
14847
|
if (value.hyperlinkClick)
|
|
14848
|
-
|
|
14848
|
+
add3("hlinkClick", writeHyperlink(doc, "hlinkClick", value.hyperlinkClick));
|
|
14849
14849
|
if (value.hyperlinkMouseOver)
|
|
14850
|
-
|
|
14850
|
+
add3("hlinkMouseOver", writeHyperlink(doc, "hlinkMouseOver", value.hyperlinkMouseOver));
|
|
14851
14851
|
if (value.rightToLeft !== void 0) {
|
|
14852
14852
|
const rtl = drawingElement(doc, "rtl");
|
|
14853
14853
|
if (!value.rightToLeft) rtl.setAttribute("val", "0");
|
|
14854
|
-
|
|
14854
|
+
add3("rtl", rtl);
|
|
14855
14855
|
}
|
|
14856
14856
|
return out;
|
|
14857
14857
|
}
|
|
@@ -14913,35 +14913,35 @@ function setAttributes2(element4, value) {
|
|
|
14913
14913
|
}
|
|
14914
14914
|
function bulletChildren(doc, value) {
|
|
14915
14915
|
const out = [];
|
|
14916
|
-
const
|
|
14917
|
-
if (value.bulletColor === "text")
|
|
14916
|
+
const add3 = (name2, node) => out.push({ name: name2, node });
|
|
14917
|
+
if (value.bulletColor === "text") add3("buClrTx", drawingElement(doc, "buClrTx"));
|
|
14918
14918
|
else if (value.bulletColor) {
|
|
14919
14919
|
const color2 = drawingElement(doc, "buClr");
|
|
14920
14920
|
color2.appendChild(importDrawingXml(doc, drawingColorXml(value.bulletColor)));
|
|
14921
|
-
|
|
14921
|
+
add3("buClr", color2);
|
|
14922
14922
|
}
|
|
14923
14923
|
const size = value.bulletSize;
|
|
14924
|
-
if (size === "text")
|
|
14924
|
+
if (size === "text") add3("buSzTx", drawingElement(doc, "buSzTx"));
|
|
14925
14925
|
else if (size) {
|
|
14926
14926
|
const local = size.unit === "percent" ? "buSzPct" : "buSzPts";
|
|
14927
14927
|
const element4 = drawingElement(doc, local);
|
|
14928
14928
|
setScaled(element4, "val", size.value, size.unit === "percent" ? 1e5 : 100);
|
|
14929
|
-
|
|
14929
|
+
add3(local, element4);
|
|
14930
14930
|
}
|
|
14931
|
-
if (value.bulletFont === "text")
|
|
14932
|
-
else if (value.bulletFont)
|
|
14931
|
+
if (value.bulletFont === "text") add3("buFontTx", drawingElement(doc, "buFontTx"));
|
|
14932
|
+
else if (value.bulletFont) add3("buFont", writeDrawingFont(doc, "buFont", value.bulletFont));
|
|
14933
14933
|
const bullet = value.bullet;
|
|
14934
|
-
if (bullet?.kind === "none")
|
|
14934
|
+
if (bullet?.kind === "none") add3("buNone", drawingElement(doc, "buNone"));
|
|
14935
14935
|
else if (bullet?.kind === "char") {
|
|
14936
14936
|
const element4 = drawingElement(doc, "buChar");
|
|
14937
14937
|
element4.setAttribute("char", bullet.char);
|
|
14938
|
-
|
|
14938
|
+
add3("buChar", element4);
|
|
14939
14939
|
} else if (bullet?.kind === "autoNumber") {
|
|
14940
14940
|
const element4 = drawingElement(doc, "buAutoNum");
|
|
14941
14941
|
element4.setAttribute("type", bullet.scheme);
|
|
14942
14942
|
setValue(element4, "startAt", bullet.startAt);
|
|
14943
|
-
|
|
14944
|
-
} else if (bullet?.kind === "picture")
|
|
14943
|
+
add3("buAutoNum", element4);
|
|
14944
|
+
} else if (bullet?.kind === "picture") add3("buBlip", importDrawingXml(doc, bullet.xml));
|
|
14945
14945
|
return out;
|
|
14946
14946
|
}
|
|
14947
14947
|
function writeDrawingParagraphProperties(doc, value, local = "pPr") {
|
|
@@ -19326,7 +19326,16 @@ function repaintSeriesForFamily(series2, toLine) {
|
|
|
19326
19326
|
shape.fill = structuredClone(shape.line.fill);
|
|
19327
19327
|
}
|
|
19328
19328
|
function clearPointPaint(series2, key) {
|
|
19329
|
-
|
|
19329
|
+
const emptied = (part) => Object.keys(part).every((name2) => name2 === "sourceXml");
|
|
19330
|
+
for (const point of series2.dataPoints) {
|
|
19331
|
+
if (!point.spPr) continue;
|
|
19332
|
+
delete point.spPr[key];
|
|
19333
|
+
if (point.spPr.line && emptied(point.spPr.line)) delete point.spPr.line;
|
|
19334
|
+
if (emptied(point.spPr)) delete point.spPr;
|
|
19335
|
+
}
|
|
19336
|
+
series2.dataPoints = series2.dataPoints.filter(
|
|
19337
|
+
(point) => Object.keys(point).some((name2) => name2 !== "index")
|
|
19338
|
+
);
|
|
19330
19339
|
}
|
|
19331
19340
|
function setChartSeriesFill(space3, index, fill) {
|
|
19332
19341
|
return editChartSpace(space3, (draft) => {
|
|
@@ -19345,7 +19354,7 @@ function setChartSeriesLine(space3, index, line4) {
|
|
|
19345
19354
|
);
|
|
19346
19355
|
});
|
|
19347
19356
|
}
|
|
19348
|
-
function setChartSeriesColor(space3, index, color2) {
|
|
19357
|
+
function setChartSeriesColor(space3, index, color2, options2 = {}) {
|
|
19349
19358
|
return editChartSpace(space3, (draft) => {
|
|
19350
19359
|
const { series: series2 } = chartSeriesEntryAt(draft, index);
|
|
19351
19360
|
const shape = series2.spPr ??= {};
|
|
@@ -19355,7 +19364,7 @@ function setChartSeriesColor(space3, index, color2) {
|
|
|
19355
19364
|
const fill = color2 ? { kind: "solid", color: withAlphaOf(color2, previous) } : void 0;
|
|
19356
19365
|
if (line4) assignOrDelete(shape.line ??= {}, "fill", fill);
|
|
19357
19366
|
else assignOrDelete(shape, "fill", fill);
|
|
19358
|
-
clearPointPaint(series2, line4 ? "line" : "fill");
|
|
19367
|
+
if (!options2.keepPointColors) clearPointPaint(series2, line4 ? "line" : "fill");
|
|
19359
19368
|
});
|
|
19360
19369
|
}
|
|
19361
19370
|
function setChartSeriesTransparency(space3, index, percent) {
|
|
@@ -20339,22 +20348,22 @@ function patchRange(labels2, range2, show) {
|
|
|
20339
20348
|
for (const child6 of elements(ext))
|
|
20340
20349
|
if (child6.namespaceURI === C15 && ["datalabelsRange", "showDataLabelsRange"].includes(child6.localName))
|
|
20341
20350
|
ext.removeChild(child6);
|
|
20342
|
-
const
|
|
20351
|
+
const add3 = (parent, ns, name2, text3) => {
|
|
20343
20352
|
const node = root.ownerDocument.createElementNS(ns, name2);
|
|
20344
20353
|
if (text3 !== void 0) node.textContent = text3;
|
|
20345
20354
|
parent.appendChild(node);
|
|
20346
20355
|
return node;
|
|
20347
20356
|
};
|
|
20348
20357
|
if (range2) {
|
|
20349
|
-
|
|
20350
|
-
const node =
|
|
20351
|
-
|
|
20352
|
-
const cache =
|
|
20353
|
-
|
|
20358
|
+
add3(ext, C15, "c15:showDataLabelsRange").setAttribute("val", show ? "1" : "0");
|
|
20359
|
+
const node = add3(ext, C15, "c15:datalabelsRange");
|
|
20360
|
+
add3(node, C15, "c15:f", range2.formula);
|
|
20361
|
+
const cache = add3(node, C15, "c15:dlblRangeCache");
|
|
20362
|
+
add3(cache, NS.c, "c:ptCount").setAttribute("val", String(range2.cache.length));
|
|
20354
20363
|
range2.cache.forEach((text3, index) => {
|
|
20355
|
-
const pt2 =
|
|
20364
|
+
const pt2 = add3(cache, NS.c, "c:pt");
|
|
20356
20365
|
pt2.setAttribute("idx", String(index));
|
|
20357
|
-
|
|
20366
|
+
add3(pt2, NS.c, "c:v", text3);
|
|
20358
20367
|
});
|
|
20359
20368
|
}
|
|
20360
20369
|
if (!elements(ext).length) root.removeChild(ext);
|
|
@@ -24294,14 +24303,14 @@ function components(outline2) {
|
|
|
24294
24303
|
function subsetTrueType(font, used) {
|
|
24295
24304
|
const glyphs = [0];
|
|
24296
24305
|
const mapped = /* @__PURE__ */ new Map([[0, 0]]);
|
|
24297
|
-
const
|
|
24306
|
+
const add3 = (glyph2) => {
|
|
24298
24307
|
if (mapped.has(glyph2) || glyph2 >= font.glyphCount) return;
|
|
24299
24308
|
mapped.set(glyph2, glyphs.length);
|
|
24300
24309
|
glyphs.push(glyph2);
|
|
24301
24310
|
};
|
|
24302
|
-
for (const glyph2 of used)
|
|
24311
|
+
for (const glyph2 of used) add3(glyph2);
|
|
24303
24312
|
for (let index = 1; index < glyphs.length; index++)
|
|
24304
|
-
for (const part of components(font.outline(glyphs[index])))
|
|
24313
|
+
for (const part of components(font.outline(glyphs[index]))) add3(part.glyph);
|
|
24305
24314
|
const outlines = glyphs.map((glyph2) => {
|
|
24306
24315
|
const source2 = font.outline(glyph2);
|
|
24307
24316
|
if (!source2.length) return source2;
|
|
@@ -43861,7 +43870,7 @@ function siblingGroupOf(node, parentOf, childrenOf, roots2) {
|
|
|
43861
43870
|
function navigateAxisHop(current, axis, nodes, childrenOf, parentOf, roots2) {
|
|
43862
43871
|
const out = [];
|
|
43863
43872
|
const seen = /* @__PURE__ */ new Set();
|
|
43864
|
-
const
|
|
43873
|
+
const add3 = (node) => {
|
|
43865
43874
|
if (!seen.has(node.id)) {
|
|
43866
43875
|
seen.add(node.id);
|
|
43867
43876
|
out.push(node);
|
|
@@ -43869,13 +43878,13 @@ function navigateAxisHop(current, axis, nodes, childrenOf, parentOf, roots2) {
|
|
|
43869
43878
|
};
|
|
43870
43879
|
const addAll = (list2) => {
|
|
43871
43880
|
for (const node of list2) {
|
|
43872
|
-
|
|
43881
|
+
add3(node);
|
|
43873
43882
|
}
|
|
43874
43883
|
};
|
|
43875
43884
|
for (const node of current) {
|
|
43876
43885
|
switch (axis) {
|
|
43877
43886
|
case "self":
|
|
43878
|
-
|
|
43887
|
+
add3(node);
|
|
43879
43888
|
break;
|
|
43880
43889
|
case "ch":
|
|
43881
43890
|
addAll(childrenOf.get(node.id) ?? []);
|
|
@@ -43884,13 +43893,13 @@ function navigateAxisHop(current, axis, nodes, childrenOf, parentOf, roots2) {
|
|
|
43884
43893
|
addAll(descendantsOf(node, childrenOf));
|
|
43885
43894
|
break;
|
|
43886
43895
|
case "desOrSelf":
|
|
43887
|
-
|
|
43896
|
+
add3(node);
|
|
43888
43897
|
addAll(descendantsOf(node, childrenOf));
|
|
43889
43898
|
break;
|
|
43890
43899
|
case "par": {
|
|
43891
43900
|
const parent = parentOf.get(node.id);
|
|
43892
43901
|
if (parent) {
|
|
43893
|
-
|
|
43902
|
+
add3(parent);
|
|
43894
43903
|
}
|
|
43895
43904
|
break;
|
|
43896
43905
|
}
|
|
@@ -43898,7 +43907,7 @@ function navigateAxisHop(current, axis, nodes, childrenOf, parentOf, roots2) {
|
|
|
43898
43907
|
addAll(ancestorsOf(node, parentOf));
|
|
43899
43908
|
break;
|
|
43900
43909
|
case "ancstOrSelf":
|
|
43901
|
-
|
|
43910
|
+
add3(node);
|
|
43902
43911
|
addAll(ancestorsOf(node, parentOf));
|
|
43903
43912
|
break;
|
|
43904
43913
|
case "followSib":
|
|
@@ -43925,7 +43934,7 @@ function navigateAxisHop(current, axis, nodes, childrenOf, parentOf, roots2) {
|
|
|
43925
43934
|
}
|
|
43926
43935
|
case "root": {
|
|
43927
43936
|
const ancestors = ancestorsOf(node, parentOf);
|
|
43928
|
-
|
|
43937
|
+
add3(ancestors.length > 0 ? ancestors[ancestors.length - 1] : node);
|
|
43929
43938
|
break;
|
|
43930
43939
|
}
|
|
43931
43940
|
}
|
|
@@ -53104,8 +53113,8 @@ function applyOperation(data, edit, options2) {
|
|
|
53104
53113
|
if (edit.position === "below") return addDiagramNodeBelow(data, edit.nodeId, text3, options2);
|
|
53105
53114
|
if (edit.position === "above")
|
|
53106
53115
|
return edit.nodeId ? addDiagramNodeAbove(data, edit.nodeId, text3, options2) : data;
|
|
53107
|
-
const
|
|
53108
|
-
return
|
|
53116
|
+
const add3 = edit.position === "after" ? addDiagramNodeAfter : addDiagramNodeBefore;
|
|
53117
|
+
return add3(data, text3, edit.nodeId, options2);
|
|
53109
53118
|
}
|
|
53110
53119
|
case "remove":
|
|
53111
53120
|
return removeDiagramNode(data, edit.nodeId);
|
|
@@ -54297,8 +54306,8 @@ function parseDefinitionHeader(root) {
|
|
|
54297
54306
|
uniqueId: stringAttribute(root, "uniqueId") ?? "",
|
|
54298
54307
|
categories: children(first(root, "catLst", NS.dgm) ?? root, "cat", NS.dgm).flatMap((cat) => {
|
|
54299
54308
|
const type = stringAttribute(cat, "type");
|
|
54300
|
-
const
|
|
54301
|
-
return type ? [{ type, ...Number.isFinite(
|
|
54309
|
+
const priority2 = Number.parseInt(cat.getAttribute("pri") ?? "", 10);
|
|
54310
|
+
return type ? [{ type, ...Number.isFinite(priority2) ? { priority: priority2 } : {} }] : [];
|
|
54302
54311
|
})
|
|
54303
54312
|
};
|
|
54304
54313
|
const title = stringAttribute(first(root, "title", NS.dgm), "val");
|
|
@@ -54549,6 +54558,7 @@ __export(opc_exports, {
|
|
|
54549
54558
|
parseCustomProperties: () => parseCustomProperties,
|
|
54550
54559
|
parseCustomPropertyTexts: () => parseCustomPropertyTexts,
|
|
54551
54560
|
parseRelationships: () => parseRelationships,
|
|
54561
|
+
readDeclaredFonts: () => readDeclaredFonts,
|
|
54552
54562
|
relationshipsPartFor: () => relationshipsPartFor,
|
|
54553
54563
|
relativePartTarget: () => relativePartTarget,
|
|
54554
54564
|
removeContentTypeOverride: () => removeContentTypeOverride,
|
|
@@ -55936,6 +55946,89 @@ async function stripPackageSignatures(zip) {
|
|
|
55936
55946
|
function zlibCompress(data) {
|
|
55937
55947
|
return fflate.zlibSync(data);
|
|
55938
55948
|
}
|
|
55949
|
+
var PARTS = [
|
|
55950
|
+
/^word\/(fontTable|styles)\.xml$/u,
|
|
55951
|
+
/^xl\/styles\.xml$/u,
|
|
55952
|
+
/^ppt\/presentation\.xml$/u,
|
|
55953
|
+
/^ppt\/slideMasters\/slideMaster\d+\.xml$/u,
|
|
55954
|
+
/^ppt\/slides\/slide([1-9]|1[0-9]|20)\.xml$/u,
|
|
55955
|
+
/^visio\/document\.xml$/u,
|
|
55956
|
+
/^(word|xl|ppt|visio)\/theme\/theme\d+\.xml$/u
|
|
55957
|
+
];
|
|
55958
|
+
var MAX_PART_BYTES = 2 * 1024 * 1024;
|
|
55959
|
+
var MAX_TOTAL_BYTES = 8 * 1024 * 1024;
|
|
55960
|
+
var FAMILY_PATTERNS = [
|
|
55961
|
+
/\btypeface="([^"]+)"/gu,
|
|
55962
|
+
/<w:font\s+w:name="([^"]+)"/gu,
|
|
55963
|
+
/\bw:(?:ascii|hAnsi|eastAsia|cs)="([^"]+)"/gu,
|
|
55964
|
+
/<name\s+val="([^"]+)"/gu,
|
|
55965
|
+
/<FaceName\b[^>]*?\bNameU="([^"]+)"/gu
|
|
55966
|
+
];
|
|
55967
|
+
var decodeXml = (value) => value.replace(/"/gu, '"').replace(/'/gu, "'").replace(/</gu, "<").replace(/>/gu, ">").replace(/&/gu, "&");
|
|
55968
|
+
function add(into, raw2) {
|
|
55969
|
+
const family = decodeXml(raw2).trim();
|
|
55970
|
+
if (!family || family.startsWith("+") || family.length > 64) return;
|
|
55971
|
+
const key = family.toLowerCase();
|
|
55972
|
+
if (!into.has(key)) into.set(key, family);
|
|
55973
|
+
}
|
|
55974
|
+
function collectEmbedded(name2, xml2, into) {
|
|
55975
|
+
if (name2 === "ppt/presentation.xml") {
|
|
55976
|
+
for (const match of xml2.matchAll(/<p:embeddedFont>\s*<p:font\b[^>]*?\btypeface="([^"]+)"/gu)) {
|
|
55977
|
+
if (match[1]) add(into, match[1]);
|
|
55978
|
+
}
|
|
55979
|
+
}
|
|
55980
|
+
if (name2 === "word/fontTable.xml") {
|
|
55981
|
+
for (const match of xml2.matchAll(/<w:font\s+w:name="([^"]+)"[^>]*>([\s\S]*?)<\/w:font>/gu)) {
|
|
55982
|
+
if (match[1] && /<w:embed(Regular|Bold|Italic|BoldItalic)\b/u.test(match[2] ?? "")) {
|
|
55983
|
+
add(into, match[1]);
|
|
55984
|
+
}
|
|
55985
|
+
}
|
|
55986
|
+
}
|
|
55987
|
+
}
|
|
55988
|
+
function readDeclaredFonts(bytes) {
|
|
55989
|
+
const data = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes);
|
|
55990
|
+
let total = 0;
|
|
55991
|
+
let parts;
|
|
55992
|
+
try {
|
|
55993
|
+
parts = fflate.unzipSync(data, {
|
|
55994
|
+
filter: (file) => {
|
|
55995
|
+
if (!PARTS.some((pattern) => pattern.test(file.name))) return false;
|
|
55996
|
+
if (file.originalSize > MAX_PART_BYTES || total + file.originalSize > MAX_TOTAL_BYTES) {
|
|
55997
|
+
return false;
|
|
55998
|
+
}
|
|
55999
|
+
total += file.originalSize;
|
|
56000
|
+
return true;
|
|
56001
|
+
}
|
|
56002
|
+
});
|
|
56003
|
+
} catch {
|
|
56004
|
+
return { families: [], embedded: [] };
|
|
56005
|
+
}
|
|
56006
|
+
const families = /* @__PURE__ */ new Map();
|
|
56007
|
+
const embedded = /* @__PURE__ */ new Map();
|
|
56008
|
+
for (const name2 of Object.keys(parts).sort(byPriority)) {
|
|
56009
|
+
const part = parts[name2];
|
|
56010
|
+
if (!part) continue;
|
|
56011
|
+
const xml2 = fflate.strFromU8(part);
|
|
56012
|
+
for (const pattern of FAMILY_PATTERNS) {
|
|
56013
|
+
for (const match of xml2.matchAll(pattern)) if (match[1]) add(families, match[1]);
|
|
56014
|
+
}
|
|
56015
|
+
collectEmbedded(name2, xml2, embedded);
|
|
56016
|
+
}
|
|
56017
|
+
const embeddedKeys = new Set(embedded.keys());
|
|
56018
|
+
return {
|
|
56019
|
+
families: [...families].filter(([key]) => !embeddedKeys.has(key)).map(([, name2]) => name2),
|
|
56020
|
+
embedded: [...embedded.values()]
|
|
56021
|
+
};
|
|
56022
|
+
}
|
|
56023
|
+
function priority(name2) {
|
|
56024
|
+
if (name2.includes("/theme/")) return 0;
|
|
56025
|
+
if (/styles\.xml$|fontTable\.xml$|presentation\.xml$|document\.xml$/u.test(name2)) return 1;
|
|
56026
|
+
if (name2.includes("slideMaster")) return 2;
|
|
56027
|
+
return 3;
|
|
56028
|
+
}
|
|
56029
|
+
function byPriority(a2, b) {
|
|
56030
|
+
return priority(a2) - priority(b) || a2.localeCompare(b, "en", { numeric: true });
|
|
56031
|
+
}
|
|
55939
56032
|
|
|
55940
56033
|
// diagram/picture-layout.ts
|
|
55941
56034
|
var DIAGRAM_PICTURE_SOURCE_NS = "urn:ooxml-core:diagram-picture-sources:1";
|
|
@@ -55952,7 +56045,7 @@ function remapFill(fill, id) {
|
|
|
55952
56045
|
function captureDiagramPictures(model, dataXml2, dataParts, drawing) {
|
|
55953
56046
|
const pictures = [];
|
|
55954
56047
|
const parts = { ...dataParts };
|
|
55955
|
-
const
|
|
56048
|
+
const add3 = (source2, owner) => {
|
|
55956
56049
|
const part = source2.fill.relId ? owner[source2.fill.relId] : void 0;
|
|
55957
56050
|
if (!part) return;
|
|
55958
56051
|
let id = Object.keys(parts).find((key) => parts[key] === part);
|
|
@@ -55975,7 +56068,7 @@ function captureDiagramPictures(model, dataXml2, dataParts, drawing) {
|
|
|
55975
56068
|
const nodeId = element4.getAttribute("nodeId");
|
|
55976
56069
|
const fill = first(element4, "blipFill", NS.a);
|
|
55977
56070
|
if (nodeId && fill && model.nodes.some((node) => node.modelId === nodeId))
|
|
55978
|
-
|
|
56071
|
+
add3(
|
|
55979
56072
|
{
|
|
55980
56073
|
nodeId,
|
|
55981
56074
|
fill: parseDrawingPictureFill(fill),
|
|
@@ -55989,7 +56082,7 @@ function captureDiagramPictures(model, dataXml2, dataParts, drawing) {
|
|
|
55989
56082
|
if (point.fill?.kind !== "picture") continue;
|
|
55990
56083
|
const nodeId = point.type === "pres" ? point.presAssocId : point.modelId;
|
|
55991
56084
|
if (nodeId && model.nodes.some((node) => node.modelId === nodeId) && !pictures.some((item2) => item2.nodeId === nodeId))
|
|
55992
|
-
|
|
56085
|
+
add3(
|
|
55993
56086
|
{
|
|
55994
56087
|
nodeId,
|
|
55995
56088
|
fill: point.fill,
|
|
@@ -56009,7 +56102,7 @@ function captureDiagramPictures(model, dataXml2, dataParts, drawing) {
|
|
|
56009
56102
|
))
|
|
56010
56103
|
continue;
|
|
56011
56104
|
if (nodeId && model.nodes.some((node) => node.modelId === nodeId))
|
|
56012
|
-
|
|
56105
|
+
add3(
|
|
56013
56106
|
{
|
|
56014
56107
|
nodeId,
|
|
56015
56108
|
fill: shape.fill,
|
|
@@ -56376,7 +56469,7 @@ function resolveDiagramDrawingStyles(drawing, scheme2) {
|
|
|
56376
56469
|
|
|
56377
56470
|
// diagram/write/cache.ts
|
|
56378
56471
|
var DSP2 = "http://schemas.microsoft.com/office/drawing/2008/diagram";
|
|
56379
|
-
function
|
|
56472
|
+
function add2(parent, namespace, name2, attrs2 = {}) {
|
|
56380
56473
|
const child6 = parent.ownerDocument.createElementNS(namespace, name2);
|
|
56381
56474
|
for (const [key, value] of Object.entries(attrs2)) child6.setAttribute(key, value);
|
|
56382
56475
|
parent.appendChild(child6);
|
|
@@ -56387,8 +56480,8 @@ function withDiagramDrawingRelationship(xml2, relationshipId) {
|
|
|
56387
56480
|
const model = doc.documentElement;
|
|
56388
56481
|
let extension = descendants(model, "dataModelExt").find((node) => node.namespaceURI === DSP2);
|
|
56389
56482
|
if (!extension) {
|
|
56390
|
-
const extLst = first(model, "extLst", NS.dgm) ??
|
|
56391
|
-
extension =
|
|
56483
|
+
const extLst = first(model, "extLst", NS.dgm) ?? add2(model, NS.dgm, "dgm:extLst");
|
|
56484
|
+
extension = add2(add2(extLst, NS.a, "a:ext", { uri: DSP2 }), DSP2, "dsp:dataModelExt", {
|
|
56392
56485
|
minVer: NS.dgm
|
|
56393
56486
|
});
|
|
56394
56487
|
}
|
|
@@ -56517,9 +56610,9 @@ function buildGeneratedDiagramCache(dataXml2, input) {
|
|
|
56517
56610
|
parent.parentNode?.removeChild(parent);
|
|
56518
56611
|
else parent?.removeChild(marker2);
|
|
56519
56612
|
}
|
|
56520
|
-
const extLst = first(root, "extLst", NS.dgm) ??
|
|
56521
|
-
const marker =
|
|
56522
|
-
|
|
56613
|
+
const extLst = first(root, "extLst", NS.dgm) ?? add2(root, NS.dgm, "dgm:extLst");
|
|
56614
|
+
const marker = add2(
|
|
56615
|
+
add2(extLst, NS.a, "a:ext", { uri: GENERATED_DIAGRAM_CACHE_NS }),
|
|
56523
56616
|
GENERATED_DIAGRAM_CACHE_NS,
|
|
56524
56617
|
"oc:generatedCache",
|
|
56525
56618
|
{
|
|
@@ -56530,20 +56623,20 @@ function buildGeneratedDiagramCache(dataXml2, input) {
|
|
|
56530
56623
|
);
|
|
56531
56624
|
drawing.shapes.forEach((shape, index) => {
|
|
56532
56625
|
const id = serialized.modelIds.get(shape.modelId);
|
|
56533
|
-
const point =
|
|
56534
|
-
|
|
56626
|
+
const point = add2(points2, NS.dgm, "dgm:pt", { modelId: id, type: "pres" });
|
|
56627
|
+
add2(point, NS.dgm, "dgm:prSet", {
|
|
56535
56628
|
...shape.sourceNodeId ? { presAssocID: shape.sourceNodeId } : {},
|
|
56536
56629
|
presName: shape.sourceLayoutRole ?? "node",
|
|
56537
56630
|
presStyleLbl: shape.sourceStyleLabel ?? "node1",
|
|
56538
56631
|
presStyleIdx: String(index),
|
|
56539
56632
|
presStyleCnt: String(drawing.shapes.length)
|
|
56540
56633
|
});
|
|
56541
|
-
const properties =
|
|
56634
|
+
const properties = add2(point, NS.dgm, "dgm:spPr");
|
|
56542
56635
|
if (shape.fill?.kind === "picture" && shape.fill.sourceXml) {
|
|
56543
56636
|
properties.appendChild(doc.importNode(parseXml(shape.fill.sourceXml).documentElement, true));
|
|
56544
56637
|
}
|
|
56545
56638
|
if (shape.sourceNodeId)
|
|
56546
|
-
|
|
56639
|
+
add2(connections, NS.dgm, "dgm:cxn", {
|
|
56547
56640
|
modelId: createOfficeGuid(),
|
|
56548
56641
|
type: "presOf",
|
|
56549
56642
|
srcId: shape.sourceNodeId,
|
|
@@ -56552,7 +56645,7 @@ function buildGeneratedDiagramCache(dataXml2, input) {
|
|
|
56552
56645
|
destOrd: "0",
|
|
56553
56646
|
presId: input.layoutId ?? ""
|
|
56554
56647
|
});
|
|
56555
|
-
|
|
56648
|
+
add2(marker, GENERATED_DIAGRAM_CACHE_NS, "oc:shape", { id });
|
|
56556
56649
|
});
|
|
56557
56650
|
return {
|
|
56558
56651
|
dataXml: buildXml(doc),
|
|
@@ -58698,19 +58791,19 @@ function compress3(h2, data, offset) {
|
|
|
58698
58791
|
ah = t1h + t2h + Math.floor(nl / 4294967296) >>> 0;
|
|
58699
58792
|
al = nl >>> 0;
|
|
58700
58793
|
}
|
|
58701
|
-
const
|
|
58794
|
+
const add3 = (i2, xh, xl) => {
|
|
58702
58795
|
const lo = (h2[i2 + 1] >>> 0) + (xl >>> 0);
|
|
58703
58796
|
h2[i2] = h2[i2] + xh + Math.floor(lo / 4294967296) >>> 0;
|
|
58704
58797
|
h2[i2 + 1] = lo >>> 0;
|
|
58705
58798
|
};
|
|
58706
|
-
|
|
58707
|
-
|
|
58708
|
-
|
|
58709
|
-
|
|
58710
|
-
|
|
58711
|
-
|
|
58712
|
-
|
|
58713
|
-
|
|
58799
|
+
add3(0, ah, al);
|
|
58800
|
+
add3(2, bh, bl);
|
|
58801
|
+
add3(4, ch, cl);
|
|
58802
|
+
add3(6, dh, dl);
|
|
58803
|
+
add3(8, eh, el);
|
|
58804
|
+
add3(10, fh, fl);
|
|
58805
|
+
add3(12, gh, gl);
|
|
58806
|
+
add3(14, hh, hl);
|
|
58714
58807
|
}
|
|
58715
58808
|
function digest64(data, iv, bytes) {
|
|
58716
58809
|
const h2 = new Uint32Array(iv);
|